On Jul 14, 12:13 pm, Prabu Proxy <[email protected]> wrote: > Suppose I have 2 Gpolygons. They may overlap with each other or one > inside of another, but are not identical. How could i find out whether > the 2 Gpolygons are intersects or inside to one another?
Use Mike's EPoly extension: http://econym.org.uk/gmap/epoly.htm Loop through all the vertices of one polygon; for each vertex, test whether the other polygon contains it. If it does, increment a "contains" variable. If it doesn't, increment a "not-contains" variable. [The names of those variables are up to you] At the end of the loop, if your "contains" variable is the same as the number of points checked, the polygon is entirely contained within the other. If the "not-contains" variable is the same, the polygon is entirely outside the other. Note that with this method, if you have two concentric polygons and test whether the outer one is contained by the inner one, the result will be that it isn't. You shouldn't assume that there is no intersection until you have tested the other way round as well. Andrew --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
