🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How to reorder indices for half-edge data structure?

Started by
2 comments, last by ddlox 3 years, 8 months ago

Using OpenMesh, I have a mesh generated by third-party tools that I read in and when adding faces to the mesh, I get exactly this problem. addface::complex edge error in OpenMesh

Basically, the error is because the half-edge data structure uses directional edges between vertices of adjacent faces and when adding a face adjacent to another face with half-edges in the same direction ... this is a problem for OpenMesh, rather, the half-edge data structure.

This error results from some of the faces' vertices being added in the wrong order.

So my question is, how does one rearrange the indices of an imported file so that all the edges are in the correct order as required when using half-edge data structures?

Advertisement

I don't use OpenMesh but I do have my own mesh format with edges. Doesn't the file you are reading have a standard winding? Perhaps it's reversed from what OpenMesh expects. Maybe you can just flip the vertex order of the 2nd and 3rd vertexes when putting them into the mesh. I'm just guessing however

don't forget to first of all determine in which winding order a given triangle is in before swapping its 2nd and 3rd verts:

https://stackoverflow.com/questions/9120032/determine-winding-of-a-2d-triangles-after-triangulation

or this

http://www.dillonbhuff.com/?p=30​

A triangle which has its winding order as you expect doesn't need swapping its verts, right ?

That's it … all the best ?

This topic is closed to new replies.

Advertisement