Jump to content
  • Advertisement
Sign in to follow this  
thezbuffer

Detecting winding of an arbitrry polygon

This topic is 3601 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Given a closed 2d polygon how can I tell if its clockwise or counter clockwise? I'm feeding it to a triangulation routine which requires a certain winding. Right now the best I ahve come up with is feed it to the triangulation and throw away the result that has fewer triangles ;-) Seems like something I should be able to tell in advance and my google voodo has not come up with the right magic words.

Share this post


Link to post
Share on other sites
Advertisement
Calculate the normal from 2 edge vectors and compare it with the actual normal of the polygon: (((v0-v1) cross (v2-v1)) dot orig_normal) > 0.

Should work...

Share this post


Link to post
Share on other sites
Which 2 edges though? I believe that only works for a convex polygon. For a concave one you might just be on an inside corner.




Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!