WIP: Add cutting through element removal
To implement cutting, we employ a very rudimentary element removal strategy, which is free from mesh manipulation, therefore easier to implement, and faster in terms of execution. The trade off is that the results are not accurate, as we do not re-mesh.
To remove an element, we use a (point-based) laparoscopic tool, in this case, a pencil. The pencil tip gives the position of the "cutting" object, which interacts with the deformable object in the scene. The deformable object comprises of tetrahedral elements. Whenever the tooltip interacts with any tetrahedron of the deformable object, the element's contribution from the global force vector, stiffness matrix, and the internal force vector is removed. In addition to this, the element is not rendered in the scene, thereby giving an illusion of cutting.
For this, we have a new class imstkPointToVolumetricMeshCD, which stores the point (tooltip) position, the ID of the tetrahedron in the case of an interaction between the scene objects (pencil, and deformable object). Then using
imstkTetMeshToPointCH class, we attach a vector storing IDs of the removed tetrahedra to the mesh object.
Using imstkFEMDeformableBody class, we update the physics for the removed elements. We then remove these element's contribution from the global stiffness matrix, the gravity force vector, and the internal force vector, without changing the data structures. For this, we have the following new methods in
Lastly, we have new code-block to un-render the removed tetrahedra from the scene in imstkVTKTetrahedralMeshRenderDelegate class.
Attached is a picture of the "cutting" simulation on muscle-tendon produced from this commit: The muscle is held fixed at the ends and some nodes in the middle are fixed. It is put in a gravitational field, which acts in the negative y-direction. As soon as the right portion is cut, it falls due to the gravitational pull and bulges, as observed in the picture.