On Aug 28, 6:42 am, Gregory Short <[email protected]> wrote: > > Not to be pedantic, but that's not *quite* correct. Checking each > vertex is insufficient for genuine clipping. Instead, you have to > check the line created by each (sequential) pair of vertices against > the polygon. The simple case being a rectangle from (1, 1) to (3, 3) > and a line from (0, 2) to (4, 2)...neither of the line's endpoints > clip the rectangle, but the line between them goes right through the > middle. :)
Yes, OK, you're correct, but the OP is asking about a "route" versus a "city", so it is highly unlikely that the route will go through the city but not have at least one point inside the city bounds. :-) -- Marcelo - http://maps.forum.nu -- > > Either way, testing for intersection of a (point, line, polygon) > against a (point, line, polygon) is a very standard operation and you > should be able to find all sorts of examples out there. Try googling > something like "clipping algorithm," adding point, line, or polygon to > that as needed. You'll have your pick as to how efficient you want to > get (more efficient will generally involve more overhead.) > > -G --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
