Defines a surface mesh of polygons. More...
#include <MeshViz/3Ddata/PbIndexedMesh2D.h>
Public Types | |
enum | ElemOrientation { ORIENTATION_AS_IS, ORIENTATION_ZPOS, ORIENTATION_ZNEG } |
Public Member Functions | |
PbIndexedMesh2D (SbBool is_data_duplicate=TRUE) | |
PbIndexedMesh2D (const PbIndexedMesh2D &mesh) | |
PbIndexedMesh2D (int num_nodes, const float *x_nod, const float *y_nod, int num_cells, const int *cell_index, const int *cell_type, SbBool is_data_duplicate=TRUE) | |
PbIndexedMesh2D (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) | |
~PbIndexedMesh2D () | |
PbIndexedMesh2D & | operator= (const PbIndexedMesh2D &mesh) |
void | setGeometry (int num_nodes, const float *x_nod, const float *y_nod, int num_cells, const int *cell_index, const int *cell_type) |
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 | getGeometry (int &numNode, const float *&x_nod, const float *&y_nod, const float *&z_nod, int &num_cells, const int32_t *&cell_index, const int32_t *&cell_type) const |
void | getGeometry (int &numNode, const float *&x_nod, const float *&y_nod, int &num_cells, const int32_t *&cell_index, const int32_t *&cell_type) const |
void | getNodes (int &num_nodes, const float *&x_nod, const float *&y_nod, const float *&z_nod) const |
void | getNodes (int &num_nodes, const float *&x_nod, const float *&y_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 |
virtual void | setElemOrientation (ElemOrientation cell_orient) |
Friends | |
int | operator== (const PbIndexedMesh2D &m1, const PbIndexedMesh2D &m2) |
int | operator!= (const PbIndexedMesh2D &m1, const PbIndexedMesh2D &m2) |
Class to define an indexed 2D mesh. Each cell of this type of mesh is a polygon with any number of nodes. Each polygon cell is defined by a list of indices in an array of nodes.
The nodes coordinates are defined by 2 (or 3) arrays x_nod, y_nod (and 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] = 3, the i-th cell is a triangle, if cell_type[i] = 4, it is a quadrangle... 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 edge of a cell may have 2 references in the mesh, that is, one edge is common to 2 cells. The edges which are referred to once in the mesh define the limits of the 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.
PbIndexedMesh2D::PbIndexedMesh2D | ( | SbBool | is_data_duplicate = TRUE |
) |
Constructor of a default simple mesh.
See also PbMesh for more explanations about data duplication.
PbIndexedMesh2D::PbIndexedMesh2D | ( | const PbIndexedMesh2D & | mesh | ) |
Copy constructor.
PbIndexedMesh2D::PbIndexedMesh2D | ( | int | num_nodes, | |
const float * | x_nod, | |||
const float * | y_nod, | |||
int | num_cells, | |||
const int * | cell_index, | |||
const int * | cell_type, | |||
SbBool | is_data_duplicate = TRUE | |||
) |
Constructor of a 2D surface mesh.
See also PbMesh for more explanations about data duplication.
PbIndexedMesh2D::PbIndexedMesh2D | ( | 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 surface mesh.
See also PbMesh for more explanations about data duplication.
PbIndexedMesh2D::~PbIndexedMesh2D | ( | ) |
Destructor.
virtual const PbCell* PbIndexedMesh2D::getCell | ( | int | cell_index | ) | const [virtual] |
Gets the cell which index is cell_index.
Returns NULL if the cell does not exist. 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 PbQuadrangleMesh2D, and PbTriangleMesh2D.
void PbIndexedMesh2D::getGeometry | ( | int & | numNode, | |
const float *& | x_nod, | |||
const float *& | y_nod, | |||
int & | num_cells, | |||
const int32_t *& | cell_index, | |||
const int32_t *& | cell_type | |||
) | const |
Gets the current mesh geometry (x, y nodes coordinates).
void PbIndexedMesh2D::getGeometry | ( | int & | numNode, | |
const float *& | x_nod, | |||
const float *& | y_nod, | |||
const float *& | z_nod, | |||
int & | num_cells, | |||
const int32_t *& | cell_index, | |||
const int32_t *& | cell_type | |||
) | const |
Gets the current mesh geometry (x, y and z nodes coordinates).
virtual SbVec3f PbIndexedMesh2D::getNodeCoord | ( | int | nod_index | ) | const [virtual] |
Gets the coordinates of a node.
Implements PbMesh.
virtual void PbIndexedMesh2D::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 PbIndexedMesh2D::getNodes | ( | int & | num_nodes, | |
const float *& | x_nod, | |||
const float *& | y_nod | |||
) | const |
Gets the mesh nodes coordinates (only x,y coordinates).
void PbIndexedMesh2D::getNodes | ( | int & | num_nodes, | |
const float *& | x_nod, | |||
const float *& | y_nod, | |||
const float *& | z_nod | |||
) | const |
Gets the mesh nodes coordinates (x,y,z coordinates).
PbIndexedMesh2D& PbIndexedMesh2D::operator= | ( | const PbIndexedMesh2D & | mesh | ) |
Assignment operator.
Reimplemented from PbMesh2D.
Reimplemented in PbQuadrangleMesh2D, and PbTriangleMesh2D.
virtual void PbIndexedMesh2D::setElemOrientation | ( | ElemOrientation | cell_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 in PbQuadrangleMesh2D, and PbTriangleMesh2D.
void PbIndexedMesh2D::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 3D geometry.
void PbIndexedMesh2D::setGeometry | ( | int | num_nodes, | |
const float * | x_nod, | |||
const float * | y_nod, | |||
int | num_cells, | |||
const int * | cell_index, | |||
const int * | cell_type | |||
) |
Sets a new 2D geometry.
int operator!= | ( | const PbIndexedMesh2D & | m1, | |
const PbIndexedMesh2D & | m2 | |||
) | [friend] |
Inequality comparison operator.
Reimplemented in PbQuadrangleMesh2D, and PbTriangleMesh2D.
int operator== | ( | const PbIndexedMesh2D & | m1, | |
const PbIndexedMesh2D & | m2 | |||
) | [friend] |
Equality comparison operator.
Reimplemented in PbQuadrangleMesh2D, and PbTriangleMesh2D.