Developer documentation | Axl-2.5.1

axlMesh Class Reference

Class axlMesh defines a piecewise-linear 3D object. More...

#include <axlMesh.h>

Inheritance diagram for axlMesh:
axlAbstractData

Public Types

enum  Intepolation { FLAT, GOURAUD, PHONG }
 
typedef axlPoint Point
 A point of the mesh is an axlPoint. More...
 
typedef QVector< int > Edge
 An edge is represented by a sequence of vertices. More...
 
typedef QVector< int > Face
 A face is a polygon represented by a loop of vertices. More...
 

Public Member Functions

 axlMesh (void)
 Construct an axlMesh. More...
 
 ~axlMesh (void)
 Destroy the axlMesh. More...
 
virtual QString description (void) const
 
virtual QString identifier (void) const
 
int vertex_count (void) const
 
int color_count (void) const
 
int normal_count (void) const
 
int face_count (void) const
 
int edge_count (void) const
 
int all_edge_count (void) const
 
bool vertex_show (void) const
 
bool & vertex_show ()
 
bool normal_used (void) const
 
bool & normal_used (void)
 
bool color_used (void) const
 
bool & color_used (void)
 
bool edge_show (void) const
 
bool & edge_show (void)
 
bool face_show (void) const
 
bool & face_show (void)
 
bool isPlanar (void) const
 
bool & isPlanar (void)
 
void setEpsilon (double epsilon)
 Set the precision parameter for point comparison. More...
 
double espilon (void)
 Return the parameter used to identify points. More...
 
int interpolation (void) const
 
void setInterpolation (int interpolation)
 
double vertexX (const int &ind) const
 Return X coordinates of vertex with index ind. More...
 
double vertexY (const int &ind) const
 return Y coordinates of vertex with index ind. More...
 
double vertexZ (const int &ind) const
 return Z coordinates of vertex with index ind. More...
 
void vertex (const int &ind, double vertex[3])
 set vertex values of vertices with index ind. More...
 
void vertex (int ind, axlPoint &point) const
 Get values of vertex of index ind. More...
 
void vertex (int ind, axlPoint *point) const
 Set vertex values of vertices with index ind. More...
 
axlPoint operator[] (int i)
 Return the i th vertex of the mesh. More...
 
axlPointvertex2 (int ind, axlPoint *point) const
 Set vertex values of vertices with index ind and return it. More...
 
QVector< double > vertexSet (void) const
 
void push_back_vertex (const double &x, const double &y, const double &z)
 Add a new vertex to the mesh. More...
 
void push_back_vertex (const double vertex[3])
 
void push_back_vertex (const axlPoint &vertex)
 Add a new vertex to the mesh. More...
 
void push_back_vertex (axlPoint *vertex)
 Add a new vertex to the mesh. More...
 
void set_vertex (axlPoint *point, const int &ind)
 Function to set a vertex. More...
 
void setVertices (const QVector< axlPoint * > &pointSet)
 
double normalX (const int &ind) const
 return X coordinates of normal with index ind. More...
 
double normalY (const int &ind) const
 return Y coordinates of normal with index ind. More...
 
double normalZ (const int &ind) const
 return Z coordinates of normal with index ind. More...
 
void normal (const int &ind, double normal[3])
 set normal values of normals with index ind. More...
 
void normal (int ind, axlPoint &normal)
 Set normal values of vertices with index ind. More...
 
void normal (int ind, axlPoint *normal)
 Set normal values of vertices with index ind. More...
 
axlPointnormal2 (int ind, axlPoint *normal)
 Set normal values of vertices with index ind and return it. More...
 
QVector< double > normalSet (void)
 
void push_back_normal (axlPoint *normal)
 
void setNormals (const QList< axlPoint * > &pointSet)
 
void push_back_normal (const double &x, const double &y, const double &z)
 add normal to the mesh. More...
 
void push_back_normal (const double normal[3])
 add normal to the mesh. More...
 
void clearNormals (void)
 
int colorR (const int &ind)
 return int Red component of color with index ind. More...
 
int colorG (const int &ind)
 return int Green component of color with index ind. More...
 
int colorB (const int &ind)
 Return int Blue component of color with index ind. More...
 
double colorRF (const int &ind)
 return double Red component of color with index ind. More...
 
double colorGF (const int &ind)
 Return double Green component of color with index ind. More...
 
double colorBF (const int &ind)
 Return double Blue component of color with index ind. More...
 
void getColor (const int &ind, int color[3])
 Set color values of colors with index ind. More...
 
void push_back_color (const int &r, const int &g, const int &b)
 Add color to the mesh. More...
 
void push_back_color (const int color[3])
 Add color to the mesh. More...
 
Edge edge (int ind) const
 
QVector< EdgeedgeSet (void) const
 
int edgePointIndex (int i, int j) const
 Returns the index of the j-th point of the i-th edge of the mesh. More...
 
int edgePointCount (int i) const
 Return the number of point contained in the i-th edge of the mesh. More...
 
void push_back_edge (int, int)
 
void push_back_edge (const Edge &e)
 Add an edge to the mesh. More...
 
int push_back_new_edge (void)
 Add an empty edge to the mesh. More...
 
void edgePushBack (int, int)
 Add to the edge i the index j. More...
 
Face face (int ind) const
 
QVector< FacefaceSet (void) const
 
int facePointIndex (int i, int j) const
 Returns the index of the j-th point of the i-th face of the mesh. More...
 
int facePointCount (int i) const
 Returns the number of vertex of a mesh face. More...
 
void push_back_face (const Face &face)
 
void insert_face (const Face &face)
 
void push_back_face (int i1, int i2, int i3)
 
const QVector< double > boundingBoxVertex (void) const
 Return the bounding box vector of the mesh. More...
 
double meshVertexScaleFactor () const
 Return a scale factor based on the distance max founded with the bounding box. More...
 
void append (axlMesh *mesh)
 
void noDuplicateVertices (void)
 Remove duplicated vertices. More...
 
double distance (int ind1, int ind2)
 Compute the distance in the 3d space between two points of indices ind1 and ind2. More...
 
QVariantList convertDataToQVariant (void) const
 Convert an axlAbstractData into a QVariantList that specifies all properties of the axlAbstractData. More...
 
int convertQVariantToData (const QVariantList &data)
 Modify properties and geometry variables of the axlAbstractData. Return 1 if the modification was sucessfully made. Otherwise return 0. More...
 
- Public Member Functions inherited from axlAbstractData
 axlAbstractData (axlAbstractData *parent=NULL)
 
 axlAbstractData (const axlAbstractData &data)
 
virtual ~axlAbstractData (void)
 
const QColor & color (void) const
 
const double & opacity (void) const
 
const double & size (void) const
 
const QString & shader (void) const
 
const bool & editable (void)
 
const bool & updateView (void)
 
void setColor (double r, double g, double b)
 
void addField (axlAbstractField *field)
 Add a field to the field list of the object. More...
 
bool updateFieldList (QString nameField)
 Check if a field with the same name is already applied on the object. More...
 
QString changeFieldName (QString fieldName)
 
axlMeshmesh (void)
 Return the mesh of that object is computed. More...
 
void setMesh (axlMesh *mesh)
 Set a corresponding mesh for that object. More...
 
void setUpdateView (bool updateView)
 
QList< axlAbstractField * > fields (void)
 

Static Public Member Functions

static QVector< QSet< int > > neighborsFace (const axlMesh &mesh)
 Construct neighbors of all points of the mesh. More...
 
static QVector< QSet< int > > VertexTofaceIndexes (const axlMesh &mesh)
 Construct Faces Indexes Table. of all points of the mesh. More...
 

Additional Inherited Members

- Public Slots inherited from axlAbstractData
void touchGeometry (void)
 
void touchProperty (void)
 
void touchStructure (void)
 
virtual void touchField (void)
 
void setColor (const QColor &color)
 
void setOpacity (const double &opacity)
 
void setSize (const double &size)
 
void setShader (const QString &shader)
 
void setEditable (bool edit)
 
- Signals inherited from axlAbstractData
void modifiedGeometry (void)
 
void modifiedStructure (void)
 
void modifiedField (void)
 
void modifiedProperty (void)
 
- Properties inherited from axlAbstractData
QColor color
 
double opacity
 
double size
 
QString shader
 

Detailed Description

Class axlMesh defines a piecewise-linear 3D object.

This class enables to represent and manipulate piecewise-linear 3D object.

A mesh is composed of

  • a list of vertices,
  • a list of edges (axlMesh::Edge) that can be empty,
  • a list of faces (axlMesh::Face) that can be empty,
  • a list of normals that can be empty,
  • a list of colors that can be empty.

An edge is a list of indices of vertices, describing a polygonal line from the first point to the last point.

A face is a list of indices of vertices, describing a polygon. The last point of the list is connected to the first point.

Note
If the list of colors (resp. normals) is provided, it should have the same size as the vertex list. The color (resp. normal) of index i in the color list corresponds to the point of index i in the vertex list.

A mesh can be used to represent for instance

  • a point set (vertex list),
  • a polygonal curve (vertex list and list of edges),
  • a polygonal surface (vertex list and face list),
  • a polygonal surface with additional polygonal curves (vertex list, edge list, face list).

Example:

mesh->push_back_vertex(pt);
mesh->push_back_vertex(1,0,0);
mesh->push_back_vertex(0,1,0);
mesh->push_back_vertex(1,1,1);
mesh->push_back_edge(0,1);
mesh->push_back_edge(1,3);
mesh->push_back_edge(3,2);
mesh->push_back_edge(2,1);
mesh->push_back_face(0,1,2);
mesh->push_back_face(1,2,3);

Definition at line 41 of file axlMesh.h.

Member Typedef Documentation

typedef QVector<int> axlMesh::Edge

An edge is represented by a sequence of vertices.

Definition at line 55 of file axlMesh.h.

typedef QVector<int> axlMesh::Face

A face is a polygon represented by a loop of vertices.

Definition at line 58 of file axlMesh.h.

A point of the mesh is an axlPoint.

Definition at line 52 of file axlMesh.h.

Member Enumeration Documentation

Enumerator
FLAT 
GOURAUD 
PHONG 

Definition at line 45 of file axlMesh.h.

Constructor & Destructor Documentation

axlMesh::axlMesh ( void  )

Construct an axlMesh.

The list of points, edges, faces, colors, normals are empty. The default precision parameter is 1.e-9.

Definition at line 70 of file axlMesh.cpp.

axlMesh::~axlMesh ( void  )

Destroy the axlMesh.

Definition at line 98 of file axlMesh.cpp.

Member Function Documentation

int axlMesh::all_edge_count ( void  ) const

Definition at line 148 of file axlMesh.cpp.

void axlMesh::append ( axlMesh mesh)

Definition at line 814 of file axlMesh.cpp.

const QVector< double > axlMesh::boundingBoxVertex ( void  ) const

Return the bounding box vector of the mesh.

Only compute with vertices bbox[0] will give min X value; bbox[1] will give max X value; bbox[2] will give min Y value; bbox[3] will give max Y value; bbox[4] will give min Z value; bbox[5] will give max Z value;

Definition at line 758 of file axlMesh.cpp.

void axlMesh::clearNormals ( void  )

Definition at line 635 of file axlMesh.cpp.

int axlMesh::color_count ( void  ) const

Definition at line 127 of file axlMesh.cpp.

bool axlMesh::color_used ( void  ) const

Definition at line 180 of file axlMesh.cpp.

bool & axlMesh::color_used ( void  )

Definition at line 185 of file axlMesh.cpp.

int axlMesh::colorB ( const int &  ind)

Return int Blue component of color with index ind.

Definition at line 511 of file axlMesh.cpp.

double axlMesh::colorBF ( const int &  ind)

Return double Blue component of color with index ind.

Definition at line 520 of file axlMesh.cpp.

int axlMesh::colorG ( const int &  ind)

return int Green component of color with index ind.

Definition at line 492 of file axlMesh.cpp.

double axlMesh::colorGF ( const int &  ind)

Return double Green component of color with index ind.

Definition at line 501 of file axlMesh.cpp.

int axlMesh::colorR ( const int &  ind)

return int Red component of color with index ind.

Definition at line 474 of file axlMesh.cpp.

double axlMesh::colorRF ( const int &  ind)

return double Red component of color with index ind.

Definition at line 483 of file axlMesh.cpp.

QVariantList axlMesh::convertDataToQVariant ( void  ) const
virtual

Convert an axlAbstractData into a QVariantList that specifies all properties of the axlAbstractData.

Reimplemented from axlAbstractData.

Definition at line 1089 of file axlMesh.cpp.

int axlMesh::convertQVariantToData ( const QVariantList &  data)
virtual

Modify properties and geometry variables of the axlAbstractData. Return 1 if the modification was sucessfully made. Otherwise return 0.

Reimplemented from axlAbstractData.

Definition at line 1165 of file axlMesh.cpp.

QString axlMesh::description ( void  ) const
virtual

Definition at line 985 of file axlMesh.cpp.

double axlMesh::distance ( int  ind1,
int  ind2 
)

Compute the distance in the 3d space between two points of indices ind1 and ind2.

If one of these indices if higher than this->vertex_count() -1, the function return -1.0

Definition at line 975 of file axlMesh.cpp.

axlMesh::Edge axlMesh::edge ( int  ind) const

Definition at line 640 of file axlMesh.cpp.

int axlMesh::edge_count ( void  ) const

Definition at line 143 of file axlMesh.cpp.

bool axlMesh::edge_show ( void  ) const

Definition at line 190 of file axlMesh.cpp.

bool & axlMesh::edge_show ( void  )

Definition at line 195 of file axlMesh.cpp.

int axlMesh::edgePointCount ( int  i) const

Return the number of point contained in the i-th edge of the mesh.

Definition at line 664 of file axlMesh.cpp.

int axlMesh::edgePointIndex ( int  i,
int  j 
) const

Returns the index of the j-th point of the i-th edge of the mesh.

Definition at line 655 of file axlMesh.cpp.

void axlMesh::edgePushBack ( int  i,
int  j 
)

Add to the edge i the index j.

The index j is pushed at the end of edge i.

Definition at line 704 of file axlMesh.cpp.

QVector< axlMesh::Edge > axlMesh::edgeSet ( void  ) const

Definition at line 645 of file axlMesh.cpp.

double axlMesh::espilon ( void  )

Return the parameter used to identify points.

See also
axlMesh::setEpsilon, axlMesh::noDuplicateVertices,

Definition at line 286 of file axlMesh.cpp.

axlMesh::Face axlMesh::face ( int  ind) const

Definition at line 709 of file axlMesh.cpp.

int axlMesh::face_count ( void  ) const

Definition at line 138 of file axlMesh.cpp.

bool axlMesh::face_show ( void  ) const

Definition at line 200 of file axlMesh.cpp.

bool & axlMesh::face_show ( void  )

Definition at line 205 of file axlMesh.cpp.

int axlMesh::facePointCount ( int  i) const

Returns the number of vertex of a mesh face.

Definition at line 731 of file axlMesh.cpp.

int axlMesh::facePointIndex ( int  i,
int  j 
) const

Returns the index of the j-th point of the i-th face of the mesh.

Definition at line 723 of file axlMesh.cpp.

QVector< axlMesh::Face > axlMesh::faceSet ( void  ) const

Definition at line 714 of file axlMesh.cpp.

void axlMesh::getColor ( const int &  ind,
int  color[3] 
)

Set color values of colors with index ind.

Definition at line 530 of file axlMesh.cpp.

QString axlMesh::identifier ( void  ) const
virtual

Definition at line 1000 of file axlMesh.cpp.

void axlMesh::insert_face ( const Face face)
inline

Definition at line 180 of file axlMesh.h.

int axlMesh::interpolation ( void  ) const

Definition at line 220 of file axlMesh.cpp.

bool axlMesh::isPlanar ( void  ) const

Definition at line 210 of file axlMesh.cpp.

bool & axlMesh::isPlanar ( void  )

Definition at line 215 of file axlMesh.cpp.

double axlMesh::meshVertexScaleFactor ( ) const

Return a scale factor based on the distance max founded with the bounding box.

Usufull if you want to use an epsilon for the mesh

Definition at line 798 of file axlMesh.cpp.

QVector< QSet< int > > axlMesh::neighborsFace ( const axlMesh mesh)
static

Construct neighbors of all points of the mesh.

This method use only faces of the mesh and not edges

Definition at line 1009 of file axlMesh.cpp.

void axlMesh::noDuplicateVertices ( void  )

Remove duplicated vertices.

Identify all points which are within distance d->epsilon, keeping the point of smaller index. Remove the redundant points and the degenerate edges and faces.

Note
The identification of points is based a naive quadratic algorithm. It envolves at most n*(n-1)/2 distance tests if n is the number of points.
See also
axlMesh::setEpsilon

Definition at line 863 of file axlMesh.cpp.

void axlMesh::normal ( const int &  ind,
double  normal[3] 
)

set normal values of normals with index ind.

Definition at line 438 of file axlMesh.cpp.

void axlMesh::normal ( int  ind,
axlPoint normal 
)

Set normal values of vertices with index ind.

Definition at line 583 of file axlMesh.cpp.

void axlMesh::normal ( int  ind,
axlPoint normal 
)

Set normal values of vertices with index ind.

Definition at line 592 of file axlMesh.cpp.

axlPoint * axlMesh::normal2 ( int  ind,
axlPoint normal 
)

Set normal values of vertices with index ind and return it.

Definition at line 601 of file axlMesh.cpp.

int axlMesh::normal_count ( void  ) const

Definition at line 132 of file axlMesh.cpp.

bool axlMesh::normal_used ( void  ) const

Definition at line 170 of file axlMesh.cpp.

bool & axlMesh::normal_used ( void  )

Definition at line 175 of file axlMesh.cpp.

QVector< double > axlMesh::normalSet ( void  )

Definition at line 607 of file axlMesh.cpp.

double axlMesh::normalX ( const int &  ind) const

return X coordinates of normal with index ind.

Definition at line 411 of file axlMesh.cpp.

double axlMesh::normalY ( const int &  ind) const

return Y coordinates of normal with index ind.

Definition at line 420 of file axlMesh.cpp.

double axlMesh::normalZ ( const int &  ind) const

return Z coordinates of normal with index ind.

Definition at line 429 of file axlMesh.cpp.

axlPoint axlMesh::operator[] ( int  i)

Return the i th vertex of the mesh.

Definition at line 234 of file axlMesh.cpp.

void axlMesh::push_back_color ( const int &  r,
const int &  g,
const int &  b 
)

Add color to the mesh.

The list of colors is extended by the color (r,g,b). The color is attached to the point with the same index in the list of vertices.

Definition at line 542 of file axlMesh.cpp.

void axlMesh::push_back_color ( const int  color[3])

Add color to the mesh.

The list of colors is extended by the color color. The color is attached to the point with the same index in the list of vertices.

Definition at line 555 of file axlMesh.cpp.

void axlMesh::push_back_edge ( int  i1,
int  i2 
)

Definition at line 669 of file axlMesh.cpp.

void axlMesh::push_back_edge ( const Edge e)

Add an edge to the mesh.

The edge is pushed at the the end of the list of edges.

Definition at line 680 of file axlMesh.cpp.

void axlMesh::push_back_face ( const Face face)

Definition at line 735 of file axlMesh.cpp.

void axlMesh::push_back_face ( int  i1,
int  i2,
int  i3 
)

Definition at line 741 of file axlMesh.cpp.

int axlMesh::push_back_new_edge ( void  )

Add an empty edge to the mesh.

The edge is pushed at the the end of the list of edges.

Definition at line 690 of file axlMesh.cpp.

void axlMesh::push_back_normal ( axlPoint normal)

Definition at line 613 of file axlMesh.cpp.

void axlMesh::push_back_normal ( const double &  x,
const double &  y,
const double &  z 
)

add normal to the mesh.

Definition at line 450 of file axlMesh.cpp.

void axlMesh::push_back_normal ( const double  normal[3])

add normal to the mesh.

Definition at line 462 of file axlMesh.cpp.

void axlMesh::push_back_vertex ( const double &  x,
const double &  y,
const double &  z 
)

Add a new vertex to the mesh.

The vertex is added at the end of the list.

Definition at line 333 of file axlMesh.cpp.

void axlMesh::push_back_vertex ( const double  vertex[3])
void axlMesh::push_back_vertex ( const axlPoint vertex)

Add a new vertex to the mesh.

The vertex is added at the end of the list. The coordinnates of the vertex are copied in the vertex array of the mesh.

Definition at line 359 of file axlMesh.cpp.

void axlMesh::push_back_vertex ( axlPoint vertex)

Add a new vertex to the mesh.

The vertex is added at the end of the list. The coordinnates of vertex are copied in the vertex array of the mesh.

Definition at line 372 of file axlMesh.cpp.

void axlMesh::set_vertex ( axlPoint point,
const int &  ind 
)

Function to set a vertex.

Parameters
axlPointcontaining the 3 (x, y, z) wished coordinates to set
indexof the vertex to set in the mesh
Returns
none

Definition at line 387 of file axlMesh.cpp.

void axlMesh::setEpsilon ( double  epsilon)

Set the precision parameter for point comparison.

Parameters
epsilonthe maximal distance between two identified points
See also
axlMesh::noDuplicateVertices

Definition at line 277 of file axlMesh.cpp.

void axlMesh::setInterpolation ( int  interpolation)

Definition at line 225 of file axlMesh.cpp.

void axlMesh::setNormals ( const QList< axlPoint * > &  pointSet)

Definition at line 621 of file axlMesh.cpp.

void axlMesh::setVertices ( const QVector< axlPoint * > &  pointSet)

Definition at line 564 of file axlMesh.cpp.

void axlMesh::vertex ( const int &  ind,
double  vertex[3] 
)

set vertex values of vertices with index ind.

Definition at line 322 of file axlMesh.cpp.

void axlMesh::vertex ( int  ind,
axlPoint point 
) const

Get values of vertex of index ind.

Definition at line 242 of file axlMesh.cpp.

void axlMesh::vertex ( int  ind,
axlPoint point 
) const

Set vertex values of vertices with index ind.

Definition at line 251 of file axlMesh.cpp.

axlPoint * axlMesh::vertex2 ( int  ind,
axlPoint point 
) const

Set vertex values of vertices with index ind and return it.

Definition at line 260 of file axlMesh.cpp.

int axlMesh::vertex_count ( void  ) const

Definition at line 122 of file axlMesh.cpp.

bool axlMesh::vertex_show ( void  ) const

Definition at line 159 of file axlMesh.cpp.

bool & axlMesh::vertex_show ( void  )

Definition at line 164 of file axlMesh.cpp.

QVector< double > axlMesh::vertexSet ( void  ) const

Definition at line 266 of file axlMesh.cpp.

QVector< QSet< int > > axlMesh::VertexTofaceIndexes ( const axlMesh mesh)
static

Construct Faces Indexes Table. of all points of the mesh.

Store for feach point all faces Indexes where the point is one the face vertex

Definition at line 1063 of file axlMesh.cpp.

double axlMesh::vertexX ( const int &  ind) const

Return X coordinates of vertex with index ind.

Definition at line 295 of file axlMesh.cpp.

double axlMesh::vertexY ( const int &  ind) const

return Y coordinates of vertex with index ind.

Definition at line 304 of file axlMesh.cpp.

double axlMesh::vertexZ ( const int &  ind) const

return Z coordinates of vertex with index ind.

Definition at line 313 of file axlMesh.cpp.


The documentation for this class was generated from the following files: