Then, the main problem is the next one:
As I can’t compare vertices indices because iMSTK reuses the deleted vertices and reorder the array to make the “new” modified mesh, I need to compare positions. The problem is that visual geometry filter is not updating ANY information about the new mesh even if I set a new inputMesh, so I can’t compare correctly.
Now I’m comparing vertices with a tolerance, that doesn’t allows me to use a better way like dictionary, that would allow me to use positions as a key.
In conclussion, I need to update the visual geometry filter when the mesh has been modified, to make it return the modified one, to compare it with a possible new modification in the mesh.
In the next images, the white lines are the deleted triangles found between the new modified mesh (cut) and the “GetVisualGeometry” function mesh.
Cutting fist time → New mesh is compared with the visual one, so I can find the created, deleted and common vertices
Cutting second time → For the geometry filter, the last deleted vertices are still part of the mesh, so they are found like deleted ones again