DGtal 1.3.0
|
The aim of this class is to handle basic simple mesh mainly for basic tasks such as to import/export/display of digital surface. This class is able to deal with triangulated, quad or polygonal faces and can include specific colors to display faces. It also provides several static tools to generate simple shapes like tubular objects or the 3d surface from height map.
The mesh object stores explicitly the vertices and each face is represented as a list of vertex indices.
To construct a Mesh object you need first to include the associated header file:
Then the mesh construction is very simple, for instance you start constructing an empty mesh input and specify if you want to store or not the vertex colors in the mesh:
Then you can add some vertices mesh:
and add some triangular/quad faces from the vertex indices:
You can also insert some polygonal faces by defining a vector containing the vertices of the face:
An example of mesh construction is given here: mesh3DConstructionAndVisualisation.cpp and will produce the following faces:
The Mesh object is integrated in the main IO framework of DGtal. You can for instance display a Mesh object directly through a Viewer3d object:
(See complete example in mesh3DConstructionAndVisualisation.cpp)
You can also export a mesh by using the MeshWriter class given in the header file:
and export it:
The mesh import is also simple:
The Mesh class also provides some methods to generate shape mesh associated to tubular object or 3d surface from height map.
For instance you can first define the vector of the 3D skeleton points:
Then you can reconstruct a tubular mesh with a given radius:
You will obtain such a tube display:
Another example is given in testMesh.cpp which generates an height field from a sequence of height values. In the same way than the previous example, you can construct your input height vector:
and then construct the height field mesh:
You will obtain such a small height field display (with previous tube mesh):
Class Mesh does not provide a topology between the face elements. If you wish to do so, you should consider using classes TriangulatedSurface and PolygonalSurface. You can also use conversions:
See also Shortcuts (for the impatient developper).