Re: Winding Order?
Re: Winding Order?
- Subject: Re: Winding Order?
- From: Robert Clair <email@hidden>
- Date: Fri, 3 Jun 2005 15:40:39 -0400
I assume by "winding order" you mean determining if the polygon is
oriented clockwise or counter-clockwise. Assuming that you know or
have determined that the polygon *has* an orientation (self-
intersecting ones -think figure 8 - don't have an orientation) the
usual algorithm goes something like: find an extremal point (top
most, left most, etc) and then look at the sign of the cross product
of the vector going from the extremal point to the point before and
the vector going from the extremal point to the point after.
This is simple in concept but tricky to make robust - you have to
worry about points very close to each other, cases where the extremal
point is really a series of points on a straight line (keep hunting
until you find a point isn't on the extremal line), etc.
Look in a book on computational geometry or poke around some of the
web sites that cover the topic.
Reversing it is just a matter of reversing the elements of the array
holding the points.
.....Bob Clair
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden