• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Winding Order?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Prev by Date: Re: CFMessagePortCreateLocal(): failed to name Mach port
  • Next by Date: Re: NSServices with files
  • Previous by thread: Re: Winding Order?
  • Next by thread: fontManager:willIncludeFont:
  • Index(es):
    • Date
    • Thread