Defines a volume mesh of polyhedrons. More...
#include <MeshViz/3Ddata/PbIndexedMesh3D.h>
Public Member Functions | |
PbIndexedMesh3D (SbBool is_data_duplicate=TRUE) | |
PbIndexedMesh3D (const PbIndexedMesh3D &mesh) | |
PbIndexedMesh3D (int num_nodes, const float *x_nod, const float *y_nod, const float *z_nod, int num_cells, const int *cell_index, const int *cell_type, SbBool is_data_duplicate=TRUE) | |
~PbIndexedMesh3D () | |
PbIndexedMesh3D & | operator= (const PbIndexedMesh3D &mesh) |
void | setGeometry (int num_nodes, const float *x_nod, const float *y_nod, const float *z_nod, int num_cells, const int *cell_index, const int *cell_type) |
void | setCoordinates (const float *x_nod, const float *y_nod, const float *z_nod) |
void | getCoordinates (const float *&xnod, const float *&ynod, const float *&znod, int &size_xnod, int &size_ynod, int &size_znod) const |
void | getGeometry (int &num_nodes, const float *&x_nod, const float *&y_nod, const float *&z_nod, int &num_cells, const int *&cell_index, const int *&cell_type) const |
void | getNodes (int &num_nodes, const float *&x_nod, const float *&y_nod, const float *&z_nod) const |
virtual SbVec3f | getNodeCoord (int nod_index) const |
virtual void | getNodeOwnerCellsInd (int nod_index, PbArrayOfInt &owner_cells) const |
virtual const PbCell * | getCell (int cell_index) const |
Friends | |
int | operator== (const PbIndexedMesh3D &m1, const PbIndexedMesh3D &m2) |
int | operator!= (const PbIndexedMesh3D &m1, const PbIndexedMesh3D &m2) |
Class to define an indexed 3D mesh. Each cell of this type of mesh is a polyhedron with 4, 5, 6 or 8 nodes. Each polyhedron is defined by a list of node indices.
The nodes coordinates are defined by 3 arrays x_nod, y_nod, z_nod of num_nodes floats. The cells are defined by the array cell_type (size num_cells) and cell_index. cell_type[n] defines the number of nodes in the n-th cells: if cell_type[i] = 4, the i-th cell is a tetrahedron, if cell_type[i] = 5 it is a pyramid, if cell_type[i] = 6 it is a prism, and if cell_type[i] = 8 it is an hexahedron. cell_index is an array of S integers, where S = cell_type[0] + cell_type[1] + ... + cell_type[num_nodes - 1]. cell_index contains the num_cells lists of node indices which define each cell topology.
Each facet of a cell may have 2 references in the mesh, that is, one facet is common to 2 cells. The facets which are referred to once in the mesh define the mesh skin.
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.
PbIndexedMesh3D::PbIndexedMesh3D | ( | SbBool | is_data_duplicate = TRUE |
) |
Constructor of a default simple mesh.
See also PbMesh for more explanations about data duplication.
PbIndexedMesh3D::PbIndexedMesh3D | ( | const PbIndexedMesh3D & | mesh | ) |
Copy constructor.
PbIndexedMesh3D::PbIndexedMesh3D | ( | int | num_nodes, | |
const float * | x_nod, | |||
const float * | y_nod, | |||
const float * | z_nod, | |||
int | num_cells, | |||
const int * | cell_index, | |||
const int * | cell_type, | |||
SbBool | is_data_duplicate = TRUE | |||
) |
Constructor of a 3D volume mesh.
See also PbMesh for more explanations about data duplication.
PbIndexedMesh3D::~PbIndexedMesh3D | ( | ) |
Destructor.
virtual const PbCell* PbIndexedMesh3D::getCell | ( | int | cell_index | ) | const [virtual] |
Gets the cell which index is cell_index.
Returns NULL if the cell does not exist or if it is incorrect (ie flat tetrahedron). Attention! this method returns always the same adress of an internal private cell. This private cell is updated each time getCell is called.
Implements PbMesh.
Reimplemented in PbHexahedronMesh3D, and PbTetrahedronMesh3D.
void PbIndexedMesh3D::getCoordinates | ( | const float *& | xnod, | |
const float *& | ynod, | |||
const float *& | znod, | |||
int & | size_xnod, | |||
int & | size_ynod, | |||
int & | size_znod | |||
) | const [inline, virtual] |
Get the current coordinates of the nodes of this mesh.
xnod | array of x coord | |
ynod | array of y coord | |
znod | array of z coord | |
size_xnod | size of the array xnod | |
size_ynod | size of the array ynod | |
size_znod | size of the array znod |
Reimplemented from PbMesh.
void PbIndexedMesh3D::getGeometry | ( | int & | num_nodes, | |
const float *& | x_nod, | |||
const float *& | y_nod, | |||
const float *& | z_nod, | |||
int & | num_cells, | |||
const int *& | cell_index, | |||
const int *& | cell_type | |||
) | const |
Gets the current mesh geometry.
virtual SbVec3f PbIndexedMesh3D::getNodeCoord | ( | int | nod_index | ) | const [inline, virtual] |
Gets the coordinates of a node.
Implements PbMesh.
virtual void PbIndexedMesh3D::getNodeOwnerCellsInd | ( | int | nod_index, | |
PbArrayOfInt & | owner_cells | |||
) | const [virtual] |
Gets the list of index of cells that own the node "nod_index".
Implements PbMesh.
void PbIndexedMesh3D::getNodes | ( | int & | num_nodes, | |
const float *& | x_nod, | |||
const float *& | y_nod, | |||
const float *& | z_nod | |||
) | const |
Gets the mesh nodes coordinate arrays.
PbIndexedMesh3D& PbIndexedMesh3D::operator= | ( | const PbIndexedMesh3D & | mesh | ) |
Assignment operator.
Reimplemented from PbMesh3D.
Reimplemented in PbHexahedronMesh3D, and PbTetrahedronMesh3D.
void PbIndexedMesh3D::setCoordinates | ( | const float * | x_nod, | |
const float * | y_nod, | |||
const float * | z_nod | |||
) | [virtual] |
Set new node coordinates without modifying the mesh topology.
For performance reasons, this method should be called instead of setGeometry when doing a mesh deformation animation. It allows to update the coordinates of a existing level surface, skin, cross section etc, without rebuilding them totally.
Reimplemented from PbMesh.
void PbIndexedMesh3D::setGeometry | ( | int | num_nodes, | |
const float * | x_nod, | |||
const float * | y_nod, | |||
const float * | z_nod, | |||
int | num_cells, | |||
const int * | cell_index, | |||
const int * | cell_type | |||
) |
Sets a new geometry.
int operator!= | ( | const PbIndexedMesh3D & | m1, | |
const PbIndexedMesh3D & | m2 | |||
) | [friend] |
Inequality comparison operator.
Reimplemented in PbHexahedronMesh3D, and PbTetrahedronMesh3D.
int operator== | ( | const PbIndexedMesh3D & | m1, | |
const PbIndexedMesh3D & | m2 | |||
) | [friend] |
Equality comparison operator.
Reimplemented in PbHexahedronMesh3D, and PbTetrahedronMesh3D.