Quickly determining if a closed polyline is clockwise or counter-clockwise

Moderator
Posts: 1,554
Joined: 2003.10
Post: #5
(Apr 9, 2011 01:24 PM)Skorche Wrote:  You do need a point inside the polygon to start though. An easy way to handle that would be to pick a segment on the perimeter. Have the point be the midpoint of the segment, and the ray direction be it's negative normal.

How will you know the normal if you don't know the winding order, though? I suppose you could check in both possible normal directions, and determine winding based on which one gets an intersection with another segment.

You say there's no guarantee of convexity/concavity; hopefully there's at least a guarantee that it's not self-intersecting? If not, you're hosed, since it'd have both clockwise and counterclockwise portions in that case.
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Quickly determining if a closed polyline is clockwise or counter-clockwise - ThemsAllTook - Apr 9, 2011 01:40 PM
Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  ? Techniques for determining speed / efficiency Elphaba 9 4,219 Jul 19, 2009 03:42 AM
Last Post: DoG
  Quickly refreshing NSViews Steven 24 10,551 Nov 13, 2002 07:30 AM
Last Post: Steven