Defines a surface mesh of triangles. More...
#include <MeshViz/3Ddata/PbTriangleMesh2D.h>
Public Member Functions | |
PbTriangleMesh2D (SbBool isDataDuplicate=TRUE) | |
PbTriangleMesh2D (const PbTriangleMesh2D &mesh) | |
PbTriangleMesh2D (int num_nodes, const float *x_nod, const float *y_nod, int num_triangles, const int32_t *triangle_index, SbBool is_data_duplicate=TRUE) | |
PbTriangleMesh2D (int num_nodes, const float *x_nod, const float *y_nod, const float *z_nod, int num_triangles, const int32_t *triangle_index, SbBool is_data_duplicate=TRUE) | |
~PbTriangleMesh2D () | |
PbTriangleMesh2D & | operator= (const PbTriangleMesh2D &mesh) |
void | setGeometry (int num_nodes, const float *x_nod, const float *y_nod, int num_triangles, const int *triangle_index) |
void | setGeometry (int numPoints, const float *xPointsField, const float *yPointsField) |
void | setGeometry (int num_nodes, const float *x_nod, const float *y_nod, const float *z_nod, int num_triangles, const int *triangle_index) |
void | getGeometry (int &num_nodes, const float *&x_nod, const float *&y_nod, int &num_triangles, const int32_t *&triangle_index) const |
void | getGeometry (int &num_nodes, const float *&x_nod, const float *&y_nod, const float *&z_nod, int &num_triangles, const int32_t *&triangle_index) const |
void | getGeometry (int &num_nodes, const float *&x_nod, const float *&y_nod, int &num_triangles, const int32_t **&triangle_index) const |
void | getGeometry (int &num_nodes, const float *&x_nod, const float *&y_nod, const float *&z_nod, int &num_triangles, const int32_t **&triangle_index) const |
virtual void | getNodesOwnerCellsInd (const PbArrayOfInt &nod_indices, PbArrayOfInt &owner_cells) const |
virtual const PbCell * | getCell (int cell_index) const |
void | setElemOrientation (ElemOrientation elem_orient) |
Friends | |
int | operator== (const PbTriangleMesh2D &m1, const PbTriangleMesh2D &m2) |
int | operator!= (const PbTriangleMesh2D &m1, const PbTriangleMesh2D &m2) |
Class to define an indexed 2D mesh made up of triangles cells. This mesh is defined by a list of triangles. Each triangles is defined by 3 indices of nodes.
The nodes coordinates are defined by 2 (or 3) arrays x_nod, y_nod, (and z_nod) of num_nodes floats. The triangles are defined by the array triangle_index of num_triangles*3 integers. triangle_index[(n*3)+p] is the p-th node index of the n-th triangle of the mesh (0 <= p <= 3).
Each edge of a triangle may have 2 references in the mesh, that is, one edge is common to 2 triangles. The edges which are referred to once in the mesh define the limits of the mesh.
The geometry of this mesh can be defined also from a points field. In this case the Voronoi method is used to build the triangle mesh.
The values on the mesh nodes are defined by the PbMesh::addValuesSet(set_index,val) method, where val argument is an array of num_nodes floats.
PbTriangleMesh2D::PbTriangleMesh2D | ( | SbBool | isDataDuplicate = TRUE |
) |
Constructor of a default simple mesh.
See also PbMesh for more explanations about data duplication.
PbTriangleMesh2D::PbTriangleMesh2D | ( | const PbTriangleMesh2D & | mesh | ) |
Copy constructor.
PbTriangleMesh2D::PbTriangleMesh2D | ( | int | num_nodes, | |
const float * | x_nod, | |||
const float * | y_nod, | |||
int | num_triangles, | |||
const int32_t * | triangle_index, | |||
SbBool | is_data_duplicate = TRUE | |||
) |
Constructor of a 2D surface mesh.
See also PbMesh for more explanations about data duplication.
PbTriangleMesh2D::PbTriangleMesh2D | ( | int | num_nodes, | |
const float * | x_nod, | |||
const float * | y_nod, | |||
const float * | z_nod, | |||
int | num_triangles, | |||
const int32_t * | triangle_index, | |||
SbBool | is_data_duplicate = TRUE | |||
) |
Constructor of a 3D surface mesh.
See also PbMesh for more explanations about data duplication.
PbTriangleMesh2D::~PbTriangleMesh2D | ( | ) |
Destructor.
virtual const PbCell* PbTriangleMesh2D::getCell | ( | int | cell_index | ) | const [virtual] |
Gets the cell which index is cell_index.
Returns NULL if the cell does not exist, otherwise returns always a PbTriangleCell object. Attention! this method returns always the same adress of an internal private cell. This private cell is updated each time getCell is called.
Reimplemented from PbIndexedMesh2D.
void PbTriangleMesh2D::getGeometry | ( | int & | num_nodes, | |
const float *& | x_nod, | |||
const float *& | y_nod, | |||
const float *& | z_nod, | |||
int & | num_triangles, | |||
const int32_t **& | triangle_index | |||
) | const |
Gets the current mesh geometry (x, y and z nodes coordinates).
triangle_index must be used like a matrix. (i.e. triangle_index[cell_index][n], with 0 <= n < 3)
void PbTriangleMesh2D::getGeometry | ( | int & | num_nodes, | |
const float *& | x_nod, | |||
const float *& | y_nod, | |||
int & | num_triangles, | |||
const int32_t **& | triangle_index | |||
) | const |
Gets the current mesh geometry (x, y nodes coordinates).
triangle_index must be used like a matrix. (i.e. triangle_index[cell_index][n], with 0 <= n < 3)
void PbTriangleMesh2D::getGeometry | ( | int & | num_nodes, | |
const float *& | x_nod, | |||
const float *& | y_nod, | |||
const float *& | z_nod, | |||
int & | num_triangles, | |||
const int32_t *& | triangle_index | |||
) | const |
Gets the current mesh geometry (x, y and z nodes coordinates).
void PbTriangleMesh2D::getGeometry | ( | int & | num_nodes, | |
const float *& | x_nod, | |||
const float *& | y_nod, | |||
int & | num_triangles, | |||
const int32_t *& | triangle_index | |||
) | const |
Gets the current mesh geometry (x, y nodes coordinates).
virtual void PbTriangleMesh2D::getNodesOwnerCellsInd | ( | const PbArrayOfInt & | nod_indices, | |
PbArrayOfInt & | owner_cells | |||
) | const [virtual] |
Gets the list of index of cells that own the node "nod_index".
Reimplemented from PbMesh.
PbTriangleMesh2D& PbTriangleMesh2D::operator= | ( | const PbTriangleMesh2D & | mesh | ) |
Assignment operator.
Reimplemented from PbIndexedMesh2D.
void PbTriangleMesh2D::setElemOrientation | ( | ElemOrientation | elem_orient | ) | [virtual] |
Changes orientation of cells during visualization of 2D surface mesh.
The ordering of the indices of an cell defines the direction of its normal vector and so its orientation. When the mesh is visualized in 2D, the direction of the normal of an cell is either Z+ or Z-. If any cell of the mesh does not have the same orientation, it can change the representation because the lighting depends on the orientation.
Reimplemented from PbIndexedMesh2D.
void PbTriangleMesh2D::setGeometry | ( | int | num_nodes, | |
const float * | x_nod, | |||
const float * | y_nod, | |||
const float * | z_nod, | |||
int | num_triangles, | |||
const int * | triangle_index | |||
) |
Sets a new 3D geometry.
void PbTriangleMesh2D::setGeometry | ( | int | numPoints, | |
const float * | xPointsField, | |||
const float * | yPointsField | |||
) |
Set a new 2D geometry from a points field.
The triangulation is realized by the DELAUNAY method.
void PbTriangleMesh2D::setGeometry | ( | int | num_nodes, | |
const float * | x_nod, | |||
const float * | y_nod, | |||
int | num_triangles, | |||
const int * | triangle_index | |||
) |
Sets a new 2D geometry.
int operator!= | ( | const PbTriangleMesh2D & | m1, | |
const PbTriangleMesh2D & | m2 | |||
) | [friend] |
Inequality comparison operator.
Reimplemented from PbIndexedMesh2D.
int operator== | ( | const PbTriangleMesh2D & | m1, | |
const PbTriangleMesh2D & | m2 | |||
) | [friend] |
Equality comparison operator.
Reimplemented from PbIndexedMesh2D.