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 cube 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 hexahedra, a second node is used to represent the quad topology.
This second representation won't reproduce all quads of the hexahedra topology, but only quads on the mesh borders. I.e quads with only one adjacent hexahedron. This process is similar to the
Tetra2TriangleTopologicalMapping.
Edges of hexahedra are represented in yellow in the simulation, whereas the visual model is based on the quads. Thus, display the scene in wire frame to see hexahedra and quads (in green).
To create this mapping, the component
Hexa2QuadTopologicalMapping is used. This component takes an input topology (Data Object1) which is the container of the "upper" topology (hexahedron here) and has an output topology (Data Object2) which is the container of the above topology (quad here).
Results
As explained, the visual model uses the output topology (quads) to render the surface model.
You can try to use directly the quads created in the
HexahedronSetTopologyContainer for the ogl model. The result will be a cube with quads displayed inside the volume.
Finally try to remove the
HexahedronFEMForceField or
QuadularBendingSprings component. The result will be a bad behavior of the cube.
Additional results
When deleting quads (Shift + right click during the simulation), the topological mapping is updated. Thus, hexahedrons behind the selected quad will be deleted as well. Then, the list of quads on the border will be updated and the surface rendering also.