On Thu, May 29, 2008 at 9:07 AM, SteveC <[EMAIL PROTECTED]> wrote:
> if the polygon is p1,p2,p3,p4...
>
> c = centre point of polygon
>
> v1 = the vector from c to p1 (p1 - c)
> v2 = the vector from c to p2 (p2 - c)
>
> take the cross product of v1 and v2
>
>        http://en.wikipedia.org/wiki/Cross_Product
>
> if its positive in the z axis its one way, if its negative its the other
>

This only works for nice, simple polygons, of the type that are
probably few and far between in OSM data. It'll work on roundabouts
though which is my major use case for potlatch. The algorithm FAQ had
a nice way using the cross product that will work for all polygons, by
requiring some careful point selection.

Dave

_______________________________________________
dev mailing list
[email protected]
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev

Reply via email to