I ve read How can I determine whether a 2D Point is within a Polygon? but I m not sure if the solution would apply to a polygon that is divided down the middle by an interior segment. Think of a squared-off figure 8 or simply two squares stacked on one another. A point inside either square would surely be "inside" the polygon but the crossing count would differ depending on which direction you went (and whether you crossed that interior segment).
I suppose one way of dealing with this is to treat the polygon as two separate polygons... (in which case I ll need an algorithm to divide a complex polygon into a set of simpler ones?)
Or is there a refinement to the ray-casting algorithm, or another point-in-polygon algorithm, to deal with the case I described?