Class axlMesh defines a piecewise-linear 3D object. More...
#include <axlMesh.h>
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... | |
axlPoint * | vertex2 (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... | |
axlPoint * | normal2 (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< Edge > | edgeSet (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< Face > | faceSet (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) |
axlMesh * | mesh (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 |
Class axlMesh defines a piecewise-linear 3D object.
This class enables to represent and manipulate piecewise-linear 3D object.
A mesh is composed of
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.
A mesh can be used to represent for instance
Example:
typedef QVector<int> axlMesh::Edge |
typedef QVector<int> axlMesh::Face |
typedef axlPoint axlMesh::Point |
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.
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.
|
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.
|
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.
|
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.
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.
|
virtual |
Definition at line 1000 of file axlMesh.cpp.
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.
|
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.
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.
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.
axlPoint | containing the 3 (x, y, z) wished coordinates to set |
index | of the vertex to set in the mesh |
Definition at line 387 of file axlMesh.cpp.
void axlMesh::setEpsilon | ( | double | epsilon | ) |
Set the precision parameter for point comparison.
epsilon | the maximal distance between two identified points |
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.
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.
|
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.