Reputation: 43
https://i.sstatic.net/30nLa.png
I have an arbitrary mesh like the one in the picture in the above link (it's just an example, but I need this to work on any mesh; numbers are just there for reference, I cannot rely on vertex ordering).
Cycling through all the vertices (let's say starting from the vertex marked in red) I need to find the four neighbor vertices marked in blue.
I have the following data:
Triangles array (vertices and edges)
Vertices array (positions in space)
Edges array (pair of vertices)
I tried cycling through the Triangles array and pick the ones that share the starting vertex, ending up with something like this: https://i.sstatic.net/x6Fqa.png
How can I filter the data further to end up with only the four vertices marked in blue?
Upvotes: 1
Views: 1276
Reputation: 43
I solved it in two steps: https://i.sstatic.net/WHyyW.png
1) select all triangles sharing the starting vertex
2) filter out edges that fall in this criteria:
Upvotes: 2