[OSM-talk] osmxapi/bbox question
80n80n at gmail.com
Fri Apr 11 17:23:17 BST 2008
On Fri, Apr 11, 2008 at 4:39 PM, Frederik Ramm <frederik at remote.org> wrote:
> Can anyone point me to a good algorithm for selecting points within an
> > > arbitrary polygon?
> > >
> I don't have it in pseudocode, but one I've heard of casts a ray
> > (horizontal
> > is common) out from the point being tested and then checks the
> > intersection
> > of that ray against each segment of the polygon. If the total number of
> > intersections is odd, then the point lies inside the polygon. If the
> > number
> > is even, then it's outside. This works for holes in a polygon, too.
> I think I saw an XSLT implementation of that in one of the OSM projects
> somewhere but I tried very hard to forget ;-)
Well, I wasn't going to use XSLT for this, but now you mentioned it... ;)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the talk