Jump to content
  • Advertisement
Sign in to follow this  

Vertex winding order (counter clockwise oder vertex) - algorithm

This topic is 3112 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

I can think of a way:
You can set the winding to the same to triangles that share an edge. So in most cases, it will be okay. And you need to find a well winded triangle first.


Red is the first triangle.
You have to find its edge neighbors.
Lets say the shared edge has vertex indices a,b in the correct, CCW order.
The index of the neighbor's other vertex is k

if its edge neighbor has indices b,a,k or k,b,a or a,k,b, its winding is the same as the first. If not, rewind.
If you have all neighbor triangles done, go the the next triangle, and do the stuff with its neighbors. You can traverse through the whole mesh with some flood-fill algorithm.

I hope that works, it's early, and haven't slept too much.

But the other method that presented in the other thread works well too (but I'm not sure about non-closed meshes), don't expect that you will get a pseudo, or complete code.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!