Problem: Diff Between TopologyEdges (indices) Before and After Removing MeshFaces

Short version: TopologyEdges (indices) changes when removing mesh faces (no surprise). But how do I map the new TopologyEdge indices to the earlier recorded indices?

So when removing some unwanted faces from a mesh, then:

  1. Before modifying the Mesh I record (or “anchor”) all NakedEdges (indices).
  2. Then I go about removing some unwanted MeshFaces.
  3. Then I check all NakedEdges (indices) again (some new NakedEdges must have emerged due to more faces being removed).
  4. Then I want to filter out all the “new” NakedEdges (by omitting the edges which was already there from start).
  5. Problem: The TopologyEdge indices are changed when the faces are removed (destroying my initially recorded naked edge indices).

Q: Does anyone have a good strategy to share for a super-fast way of finding out which edge indices belong ONLY to the new naked edges due to the removed faces? (If also the face indices are modified, then the road to salvation will be very narrow…)

This operation destroys my already recorded (topology edge) indices:

   mesh.Faces.DeleteFaces(face_indices, false);

All ideas are welcome. Not expecting the code, only some interesting ideas.

// Rolf

What about a python set / c# hashset that gets populated by all your edges before removing some. With these you can check if the edges are already known or new ones. I am not sure what would be a good hash function for this. Maybe you can use some grasshopper information and can avoid duplicating the edge structure.

Hi Martin,
I have come to the conclusion that I want to apply the following index-mapping strategy, which is applicable for Faces, Edges and even Vertices (Short version: Storing midpoints + indices in Key-Value Dictionaries)

// Rolf