### Topological Mapping (4/7)

Description

Here is the important step of this tutorial. We add a child node containing the triangular topology which is directly linked to the tetrahedral mesh thanks to the topological mapping component. This will allow us to display a visual model.

Key points

In this step, we add a number of components that will contribute to the visual model.

- Dynamic topological components to store the surface mesh.
- Tetra2TriangleTopologicalMapping component is used to map triangles on the border of the tetrahedral mesh to the surface topological container.
- Then, OglModel can be used to visualize the surface mesh.

Add a new GNode to the Tetrahedrons Mesh node. Rename it "Triangles Mesh".

Add the following components to the Triangles Mesh node, giving them appropriate names:

- TriangleSetTopologyContainer named "Container"
- TriangleSetTopoologyModifier named "Modifier"
- TriangleSetGeometryAlgorithms named "GeomAlgo"
- Tetra2TriangleTopologicalMapping named "Mapping"

The TriangleSetTopoologyModifier is a component which can manipulate an associated TriangleSetTopologyContainer. There is therefore a clean separation between the container, which allocates and store the memory, and the algorithms which can manipulate this data.

In the Mapping properties, change the Input topology to map to "@../Container", and change the Output topology to map to @Container.

This tells the mapping to convert the tetrahedron topology to a triangle topology.

Add a new GNode to the Triangles Mesh node, and rename it "Visu".

Add an OglModel component to the Visu node. Rename it "Visual".

Find the IdentityMapping component using the Filter. In the dropdown menu on the right, select Vec3d, ExtVec3f, and add it to the Visu node.

In the Property 2/2 tab, change the Input object to map to "@../../Volume" and the Output object to map to "@Visual".

Results

Run in SOFA and animate.

In this step the mechanical behavior stays the same. But a visual model can now be used to display the surface of the object.

### Previous ____________ Next