The aim of this tutorial is to show the interest of using a topological mapping between a 3D volume mesh and a 2D surface mesh. In this tutorial, a cylinder is represented, implying:
- A mesh loader to read mesh file. (not necessary in regular mesh)
- A mechanicalObject with geometry point positions.
- A mass for gravity and fixed points.
- A FEM forcefield to create interactions between points
- An ODE scheme and a linear solver to solve the system at each time step.
- Dynamic topological components.
- A visual model which reproduces the current model geometry thanks to the identity mapping.
Key points
Under the first node representing the tetrahedrization, a second node is used to represent the triangle topology.
This second representation won't reproduce all triangles of the tetrahedrization, but only triangles on the mesh borders. I.e triangles with only one adjacent tetrahedron. This process is similar to the
Triangle2EdgeTopologicalMapping.
Edges of tetrahedra are represented in yellow in the simulation whereas the visual model is based on the triangles. Thus, display the scene in wire frame to see tetrahedra and triangles (in blue).
To create this mapping, the component
Tetra2TriangleTopologicalMapping is used. This component takes an input topology (Data Object1) which is the container of the "upper" topology (tetrahedron here) and has an output topology (Data Object2) which is the container of the above topology (triangle here).
Results
As explained the visual model uses the output topology (triangles) to render the surface model.
You can try to directly use the triangles created in the
TetrahedronSetTopologyContainer for the ogl model. The result will be a cylinder with triangles displayed inside the volume.
Finally, try to remove the
TetrahedralCorotationalFEMForceField or
TriangularBendingSprings component. The result will be a bad behavior of the cylinder.
Additional results
When deleting triangles, the topological mapping is updated. Thus, tetrahedra behind the selected triangle will be deleted as well. Then, the list of triangles on border will be updated and the surface rendering also.