meshmash / Plankton

A C# half-edge mesh data structure, and components for using this in Grasshopper/Rhino
http://meshmash.github.io/Plankton
GNU Lesser General Public License v3.0
216 stars 66 forks source link

Halfedge datastructure indexing #44

Closed petrasvestartas closed 6 years ago

petrasvestartas commented 6 years ago

Hi,

I am using a bit different library in c++ but I would like to ask question about halfedge datastructure

one thing that I am not used to is indexing or absence of it.

For quering adjacent edges or vertices I am using circulators. For looping through vertices I am using foreach loop.

Is it common thing to halfedge mesh?

For indexing I assigned property to each vertex to track them. Which is a bit weird.

Any insight it would be useful. I am using surface mesh.

pearswj commented 6 years ago

Hey Petras, really sorry I left this question unanswered! We used a lot of LINQ queries in Plankton instead of foreach loops, e.g. in PlanktonVertexList.GetVertexNeighbours(int) but essentially it's the same thing. Indices are implicit; no need to store them in the actual elements. Adjacent elements are defined by their index, instead of using references/pointers to the actual objects. This makes things painful at times, but there's also less to keep track of! Please feel free to reopen this if you have any other questions and I'll try to answer them quicker next time!