So my big question here is how does the Google Maps API determine the "inner" versus the "outer" for a filled polygon?
Playing around with the polygon creator @ http://www.the-di-lab.com/polygon/ there seems to be a preference to:
- wrap the north pole;
- take the "smallest" polygon possible?
The big reason I want to know is to assist with answering the question "is point (x,y) in multipolygon z?"
Thoughts?
Answer
The big reason I want to know is to assist with answering the question "is point (x,y) in multipolygon z?"
Using a Ray casting algorithm to solve the point in polygon problem, you don't need to know how the Google Code works.
The number of intersections for a ray passing from the exterior of the polygon to any point, if odd, shows the point lies inside the polygon. If even, the point lies outside the polygon. This test also works in three dimensions.
No comments:
Post a Comment