I am looking for a memory-efficient yet convenient data structure for a 3D mesh or face-set consisting of triangles.
Currently I am using this 'classical' structure:
This is the most compact layout I can think of. It is perfect if all I want to do is draw the mesh, and never modify or filter it. However it does make most operations that modify the mesh or generate a new partial mesh very cumbersome, for example:
Basically anything that requires modifying the mesh, or iterating over the edges or finding neighboring faces/edges, requires generating and discarding several temporary dictionaries and hash sets. There is no easy way to iterate over the points or edges of an individual face, or the edges/faces around an individual point. removing a point means removing it from each triangle, then changing the index values for all other points in all triangles, etc.
Is there a canonical data structure that does not have these drawbacks, yet is memory-efficient?
I am not looking for an entire library, just a structure I can implement myself (although it may be interesting to know how particular libraries have solved this problem)
There's a couple of open source data structure that may fit your needs:
I've oredered them from the harder to the easier to use. They are all half edge data structures
Take a look at this paper from Bielefeld university (developers of the Surface mesh), I think that it's a good starting point for you!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With