DGtal
1.5.beta
|
Aim: This class is defined to represent a surface mesh through a set of vertices and faces. By using the default constructor, the mesh does not store any color information (it can be changed by setting the default constructor parameter saveFaceColor to 'true'). More...
#include <DGtal/shapes/Mesh.h>
Data Structures | |
struct | CompPoints |
Public Types | |
typedef TPoint | Point |
typedef DGtal::PointVector< TPoint::dimension, double > | RealPoint |
typedef std::vector< TPoint > | VertexStorage |
typedef VertexStorage::size_type | Index |
typedef std::vector< Index > | MeshFace |
typedef std::vector< MeshFace > | FaceStorage |
typedef std::vector< DGtal::Color > | ColorStorage |
typedef VertexStorage::const_iterator | ConstIterator |
typedef VertexStorage::iterator | Iterator |
typedef std::size_t | Size |
Public Member Functions | |
Mesh (bool saveFaceColor=false) | |
Mesh (const DGtal::Color &aColor) | |
Mesh (const std::vector< TPoint > &vertexSet) | |
~Mesh () | |
Mesh (const Mesh &other) | |
Mesh & | operator= (const Mesh &other) |
std::string | className () const |
void | addVertex (const TPoint &vertex) |
void | addTriangularFace (Index indexVertex1, Index indexVertex2, Index indexVertex3, const DGtal::Color &aColor=DGtal::Color::White) |
void | addQuadFace (Index indexVertex1, Index indexVertex2, Index indexVertex3, Index indexVertex4, const DGtal::Color &aColor=DGtal::Color::White) |
void | addFace (const MeshFace &aFace, const DGtal::Color &aColor=DGtal::Color::White) |
void | removeFaces (const std::vector< Index > &facesIndex) |
const TPoint & | getVertex (Index i) const |
TPoint & | getVertex (Index i) |
const MeshFace & | getFace (Index i) const |
RealPoint | getFaceBarycenter (Index i) const |
MeshFace & | getFace (Index i) |
const Color & | getFaceColor (Index i) const |
std::pair< TPoint, TPoint > | getBoundingBox () const |
void | setFaceColor (Index i, const DGtal::Color &aColor) |
bool | isStoringFaceColors () const |
ConstIterator | vertexBegin () const |
ConstIterator | vertexEnd () const |
Iterator | vertexBegin () |
Iterator | vertexEnd () |
FaceStorage::const_iterator | faceBegin () const |
FaceStorage::const_iterator | faceEnd () const |
FaceStorage::iterator | faceBegin () |
FaceStorage::iterator | faceEnd () |
Size | nbFaces () const |
Size | nbVertex () const |
void | invertVertexFaceOrder () |
void | clearFaces () |
void | clearVertices () |
void | removeIsolatedVertices () |
void | rescale (const typename TPoint::Component aScale) |
double | subDivideTriangularFaces (const double minArea) |
unsigned int | quadToTriangularFaces () |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Static Public Member Functions | |
static void | createTubularMesh (Mesh< TPoint > &aMesh, const std::vector< TPoint > &aSkeleton, const double aRadius, const double angleStep=0.2, const DGtal::Color &aMeshColor=DGtal::Color::White) |
static void | createTubularMesh (Mesh< TPoint > &aMesh, const std::vector< TPoint > &aSkeleton, const std::vector< double > &aVectOfRadius, const double angleStep=0.2, const DGtal::Color &aMeshColor=DGtal::Color::White) |
template<typename TValue > | |
static void | createMeshFromHeightSequence (Mesh< TPoint > &aMesh, const std::vector< TValue > &anValueSequence, const unsigned int lengthSequence, double stepX, double stepY, double stepZ, const DGtal::Color &aMeshColor=DGtal::Color::White) |
Private Attributes | |
FaceStorage | myFaceList |
VertexStorage | myVertexList |
ColorStorage | myFaceColorList |
bool | mySaveFaceColor |
DGtal::Color | myDefaultColor |
Aim: This class is defined to represent a surface mesh through a set of vertices and faces. By using the default constructor, the mesh does not store any color information (it can be changed by setting the default constructor parameter saveFaceColor to 'true').
Description of template class 'Mesh'
The mesh object stores explicitly each vertex and each face are represented with the list of point index.
This class was defined to import and display a mesh from different formats like OFF file format. Since it realized the concept of CDrawableWithDisplay3D we can display an Mesh with a Display3D object:
First we have to include the following header files:
Prepare display using QGLviewer: Viewer3D
Construct a Mesh with various faces:
Displaying the result:
typedef std::vector<DGtal::Color> DGtal::Mesh< TPoint >::ColorStorage |
typedef VertexStorage::const_iterator DGtal::Mesh< TPoint >::ConstIterator |
typedef std::vector<MeshFace> DGtal::Mesh< TPoint >::FaceStorage |
typedef VertexStorage::size_type DGtal::Mesh< TPoint >::Index |
typedef VertexStorage::iterator DGtal::Mesh< TPoint >::Iterator |
typedef std::vector<Index> DGtal::Mesh< TPoint >::MeshFace |
typedef TPoint DGtal::Mesh< TPoint >::Point |
typedef DGtal::PointVector<TPoint::dimension, double> DGtal::Mesh< TPoint >::RealPoint |
typedef std::size_t DGtal::Mesh< TPoint >::Size |
typedef std::vector<TPoint> DGtal::Mesh< TPoint >::VertexStorage |
DGtal::Mesh< TPoint >::Mesh | ( | bool | saveFaceColor = false | ) |
Constructor. By default the constructed mesh does not store color information about the mesh. If you want to include color in the Mesh object you have to set the constructor parameter saveFaceColor to true.
saveFaceColor | used to memorize the color of a face (default= false) |
DGtal::Mesh< TPoint >::Mesh | ( | const DGtal::Color & | aColor | ) |
Constructor. The constructed mesh will store an unique default color information about the mesh.
aColor | used to memorize the color of a face (default= false) |
DGtal::Mesh< TPoint >::Mesh | ( | const std::vector< TPoint > & | vertexSet | ) |
Constructor by usung a vertex set as init. The color are not stored in this case.
vertexSet | the set of vertex. |
DGtal::Mesh< TPoint >::~Mesh | ( | ) |
Destructor.
DGtal::Mesh< TPoint >::Mesh | ( | const Mesh< TPoint > & | other | ) |
Copy constructor.
other | the object to clone. |
void DGtal::Mesh< TPoint >::addFace | ( | const MeshFace & | aFace, |
const DGtal::Color & | aColor = DGtal::Color::White |
||
) |
Add a quad face given from index position.
Referenced by main().
void DGtal::Mesh< TPoint >::addQuadFace | ( | Index | indexVertex1, |
Index | indexVertex2, | ||
Index | indexVertex3, | ||
Index | indexVertex4, | ||
const DGtal::Color & | aColor = DGtal::Color::White |
||
) |
Add a quad face given from index position.
indexVertex1 | the index of the first vertex face. |
indexVertex2 | the index of the second vertex face. |
indexVertex3 | the index of the third vertex face. |
indexVertex4 | the index of the fourth vertex face. |
aColor | the quad face color. |
Referenced by main(), testMesh(), and testMeshWriter().
void DGtal::Mesh< TPoint >::addTriangularFace | ( | Index | indexVertex1, |
Index | indexVertex2, | ||
Index | indexVertex3, | ||
const DGtal::Color & | aColor = DGtal::Color::White |
||
) |
Add a triangle face given from index position.
indexVertex1 | the index of the first vertex face. |
indexVertex2 | the index of the second vertex face. |
indexVertex3 | the index of the third vertex face. |
aColor | the triangle face color. |
Referenced by main(), and testMesh().
void DGtal::Mesh< TPoint >::addVertex | ( | const TPoint & | vertex | ) |
Adding new vertex.
Referenced by main(), testMesh(), and testMeshWriter().
std::string DGtal::Mesh< TPoint >::className | ( | ) | const |
void DGtal::Mesh< TPoint >::clearFaces | ( | ) |
Clear all faces of the mesh.
void DGtal::Mesh< TPoint >::clearVertices | ( | ) |
Clear all vertices of the mesh.
|
static |
Generates a surface mesh defined from a sequence of 2D height values (can be seen as a height map).
[out] | aMesh | the mesh in which the new surface mesh will be created. |
[in] | anValueSequence | the sequence of values defining the height points. |
[in] | lengthSequence | the number of points constituing a line in the height map. |
[in] | stepX | the x grid step to define the scale of the resulting mesh. |
[in] | stepY | the y grid step to define the scale of the resulting mesh. |
[in] | stepZ | the z grid step to define the scale of the resulting mesh. |
[in] | aMeshColor | the color given to the generated tube mesh. |
|
static |
Generates a tube mesh (of constant radius) from a set of points representing the tube skeleton. Each circular section is connected with quads.
[out] | aMesh | the mesh in which the new tube mesh will be created. |
[in] | aSkeleton | the set of points which defines the tube skeleton. |
[in] | aRadius | the tube radius. |
[in] | angleStep | the circular precision of the tube approximation. |
[in] | aMeshColor | the color given to the generated tube mesh. |
Referenced by testVisualTubularMesh().
|
static |
Generates a tube mesh from a tube skeleton and from its associated circular section radii. Each circular section is connected with quads.
[out] | aMesh | the mesh in which the new tube mesh will be created. |
[in] | aSkeleton | the set of points which defines the tube skeleton. |
[in] | aVectOfRadius | the vector containing all circular sections (if it contains not enougth it value, the next values will be taken from the begining of the vector). |
[in] | angleStep | the circular precision of the tube approximation. |
[in] | aMeshColor | the color given to the generated tube mesh. |
|
inline |
Definition at line 425 of file Mesh.h.
References DGtal::Mesh< TPoint >::myFaceList.
|
inline |
Definition at line 402 of file Mesh.h.
References DGtal::Mesh< TPoint >::myFaceList.
Referenced by testMesh().
|
inline |
Definition at line 437 of file Mesh.h.
References DGtal::Mesh< TPoint >::myFaceList.
|
inline |
Definition at line 414 of file Mesh.h.
References DGtal::Mesh< TPoint >::myFaceList.
Referenced by testMesh().
std::pair<TPoint, TPoint> DGtal::Mesh< TPoint >::getBoundingBox | ( | ) | const |
Referenced by testMesh().
MeshFace& DGtal::Mesh< TPoint >::getFace | ( | Index | i | ) |
i | the index of the face. |
const MeshFace& DGtal::Mesh< TPoint >::getFace | ( | Index | i | ) | const |
i | the index of the face. |
Referenced by testMesh(), and testMeshReader().
RealPoint DGtal::Mesh< TPoint >::getFaceBarycenter | ( | Index | i | ) | const |
i | the index of the face. |
Referenced by testMesh().
const Color& DGtal::Mesh< TPoint >::getFaceColor | ( | Index | i | ) | const |
Return a reference to a face Color of index i.
i | the index of the face. |
Referenced by testMesh(), and testMeshReader().
TPoint& DGtal::Mesh< TPoint >::getVertex | ( | Index | i | ) |
i | the index of the vertex. |
const TPoint& DGtal::Mesh< TPoint >::getVertex | ( | Index | i | ) | const |
i | the index of the vertex. |
Referenced by testMesh().
void DGtal::Mesh< TPoint >::invertVertexFaceOrder | ( | ) |
Invert the face order (useful when normal is deducted from vertex order).
Referenced by testMesh().
bool DGtal::Mesh< TPoint >::isStoringFaceColors | ( | ) | const |
bool DGtal::Mesh< TPoint >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
Size DGtal::Mesh< TPoint >::nbFaces | ( | ) | const |
Return the number of faces contained on the mesh object.
Referenced by SCENARIO(), TEST_CASE(), testMesh(), testMeshGeneration(), testMeshReader(), and testVisualTubularMesh().
Size DGtal::Mesh< TPoint >::nbVertex | ( | ) | const |
Return the number of faces contained on the mesh object.
Referenced by SCENARIO(), testMesh(), testMeshGeneration(), and testMeshReader().
Mesh& DGtal::Mesh< TPoint >::operator= | ( | const Mesh< TPoint > & | other | ) |
Assignment.
other | the object to copy. |
unsigned int DGtal::Mesh< TPoint >::quadToTriangularFaces | ( | ) |
Transform quad faces of the mesh to triangular one.
Referenced by testMesh().
void DGtal::Mesh< TPoint >::removeFaces | ( | const std::vector< Index > & | facesIndex | ) |
Remove faces from the mesh.
[in] | facesIndex | the index of the face to be removed. |
Referenced by testMesh().
void DGtal::Mesh< TPoint >::removeIsolatedVertices | ( | ) |
Removed isolated vertices of input mesh that are not associated to a face.
Referenced by testMesh().
void DGtal::Mesh< TPoint >::rescale | ( | const typename TPoint::Component | aScale | ) |
Change the scale of the mesh (i.e all vertex coordinates are multiplied by a given factor aScale).
[in] | aScale | the scale factor. |
Referenced by testMesh().
void DGtal::Mesh< TPoint >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
void DGtal::Mesh< TPoint >::setFaceColor | ( | Index | i, |
const DGtal::Color & | aColor | ||
) |
Set the color of a particular face of the mesh. If the mesh does not yet store the color of all individual faces (isStoringFaceColors to false) it fills each face color with the default color and the value of isStoringFaceColors is set to true.
[in] | i | the index of the face |
[in] | aColor | the color for the considered face. |
Referenced by testMesh().
double DGtal::Mesh< TPoint >::subDivideTriangularFaces | ( | const double | minArea | ) |
SubDivide triangular mesh if triangle area is larger than the given parameter.
[in] | minArea | the minimum area factor. |
Referenced by testMesh().
|
inline |
Definition at line 379 of file Mesh.h.
References DGtal::Mesh< TPoint >::myVertexList.
|
inline |
Definition at line 359 of file Mesh.h.
References DGtal::Mesh< TPoint >::myVertexList.
Referenced by testMesh().
|
inline |
Definition at line 390 of file Mesh.h.
References DGtal::Mesh< TPoint >::myVertexList.
|
inline |
Definition at line 369 of file Mesh.h.
References DGtal::Mesh< TPoint >::myVertexList.
Referenced by testMesh().
|
private |
|
private |
|
private |
Definition at line 513 of file Mesh.h.
Referenced by DGtal::Mesh< TPoint >::faceBegin(), and DGtal::Mesh< TPoint >::faceEnd().
|
private |
|
private |
Definition at line 514 of file Mesh.h.
Referenced by DGtal::Mesh< TPoint >::vertexBegin(), and DGtal::Mesh< TPoint >::vertexEnd().