Defines a regular cartesian grid volume mesh. More...
#include <MeshViz/3Ddata/PbRegularCartesianGrid3D.h>
Public Member Functions | |
PbRegularCartesianGrid3D (SbBool isDataDuplicate=TRUE) | |
PbRegularCartesianGrid3D (const PbRegularCartesianGrid3D &mesh) | |
PbRegularCartesianGrid3D (int num_x, int num_y, int num_z, float x_min, float y_min, float z_min, float x_max, float y_max, float z_max, SbBool isDataDuplicate=TRUE) | |
~PbRegularCartesianGrid3D () | |
PbRegularCartesianGrid3D & | operator= (const PbRegularCartesianGrid3D &mesh) |
void | setGeometry (int num_x, int num_y, int num_z, float x_min, float y_min, float z_min, float x_max, float y_max, float z_max) |
void | getGeometry (int &num_x, int &num_y, int &num_z, float &x_min, float &y_min, float &z_min, float &x_max, float &y_max, float &z_max) const |
virtual const PbCell * | findContainingCell (const SbVec3f &point, float tolerance, SbVec3f &pcoord, const PbCell *adjacent_cell) const |
virtual const PbCell * | findContainingCell (const SbVec3f &point, float tolerance, SbVec3f &pcoord) const |
virtual const PbCell * | getCell (int cell_index) const |
virtual SbVec3f | getNodeCoord (int nod_index) const |
virtual SbVec3f | getNodeCoord (int i, int j, int k) const |
virtual float | getVolume () const |
void | setCoordinates (const float *xnod, const float *ynod, const float *znod) |
void | getCoordinates (const float *&xnod, const float *&ynod, const float *&znod, int &size_xnod, int &size_ynod, int &size_znod) const |
Friends | |
int | operator== (const PbRegularCartesianGrid3D &m1, const PbRegularCartesianGrid3D &m2) |
int | operator!= (const PbRegularCartesianGrid3D &m1, const PbRegularCartesianGrid3D &m2) |
Class to define a volume mesh represented by a grid, with cartesian coordinates, of which the lines are parallel to X-axis, Y-axis or Z-axis. This mesh is said regular because the gap between 2 consecutive parallel lines is constant.
The geometry of such a mesh is defined by the 3 dimensions of its grid (num_x, num_y, num_z), and by its bounding box (x_min, y_min, z_min, x_max, y_max, z_max)
The values on the mesh nodes are defined by the PbMesh::addValuesSet(set_index, val) method, where val argument is an array of num_x * num_y * num_z floats.
PbRegularCartesianGrid3D::PbRegularCartesianGrid3D | ( | SbBool | isDataDuplicate = TRUE |
) |
Constructor of a default simple mesh.
See also PbMesh for more explanations about data duplication.
PbRegularCartesianGrid3D::PbRegularCartesianGrid3D | ( | const PbRegularCartesianGrid3D & | mesh | ) |
Copy constructor.
PbRegularCartesianGrid3D::PbRegularCartesianGrid3D | ( | int | num_x, | |
int | num_y, | |||
int | num_z, | |||
float | x_min, | |||
float | y_min, | |||
float | z_min, | |||
float | x_max, | |||
float | y_max, | |||
float | z_max, | |||
SbBool | isDataDuplicate = TRUE | |||
) |
Constructor of a 3D regular grid mesh.
See also PbMesh for more explanations about data duplication.
PbRegularCartesianGrid3D::~PbRegularCartesianGrid3D | ( | ) |
Destructor.
virtual const PbCell* PbRegularCartesianGrid3D::findContainingCell | ( | const SbVec3f & | point, | |
float | tolerance, | |||
SbVec3f & | pcoord | |||
) | const [virtual] |
Find the mesh's cell that contains the point.
If the (optional) adjacent cell is given, searching the containing cell starts by the cells around this adjacent one. Returns also the parametric coordinates of the point in the found cell. Parametric coordinates are the coordinates of the point relative to a topologically equivalent unit cell. A point is inside a cell if its parametric coordinates range from 0 to 1. However we use a test with a tolerance value: a point is inside the cell if its parametric coordinates p verify -tolerance <= p <= 1+tolerance. Parametric coordinates are useful to interpolate the value in the cell (see PbCell::getValue). Attention! This method returns always the same address of an internal private cell. This private cell is updated each time findContainingCell is called. If the cell exists, it returns a PbVoxelCell.
Reimplemented from PbMesh.
virtual const PbCell* PbRegularCartesianGrid3D::findContainingCell | ( | const SbVec3f & | point, | |
float | tolerance, | |||
SbVec3f & | pcoord, | |||
const PbCell * | adjacent_cell | |||
) | const [virtual] |
Reimplemented from PbMesh.
virtual const PbCell* PbRegularCartesianGrid3D::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 PbVoxelCell object. Attention! This method returns always the same address of an internal private cell. This private cell is updated each time getCell is called.
Implements PbMesh.
void PbRegularCartesianGrid3D::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 2 floats, min and max x coord | |
ynod | array of 2 floats, min and max y coord | |
znod | array of 2 floats, min and max z coord | |
size_xnod | : size of the array xnod = 2 | |
size_ynod | : size of the array ynod = 2 | |
size_znod | : size of the array znod = 2 |
Reimplemented from PbMesh.
void PbRegularCartesianGrid3D::getGeometry | ( | int & | num_x, | |
int & | num_y, | |||
int & | num_z, | |||
float & | x_min, | |||
float & | y_min, | |||
float & | z_min, | |||
float & | x_max, | |||
float & | y_max, | |||
float & | z_max | |||
) | const [inline] |
Gets the mesh geometry.
virtual SbVec3f PbRegularCartesianGrid3D::getNodeCoord | ( | int | i, | |
int | j, | |||
int | k | |||
) | const [inline, virtual] |
Gets the coordinates of a node defined by its i, j, k indices on the grid.
Implements PbGrid3D.
virtual SbVec3f PbRegularCartesianGrid3D::getNodeCoord | ( | int | nod_index | ) | const [virtual] |
Gets the coordinates of a node defined by its index.
Implements PbGrid3D.
virtual float PbRegularCartesianGrid3D::getVolume | ( | ) | const [inline, virtual] |
Gets the volume of the mesh.
Reimplemented from PbMesh3D.
PbRegularCartesianGrid3D& PbRegularCartesianGrid3D::operator= | ( | const PbRegularCartesianGrid3D & | mesh | ) |
Assignment operator.
Reimplemented from PbGrid3D.
void PbRegularCartesianGrid3D::setCoordinates | ( | const float * | xnod, | |
const float * | ynod, | |||
const float * | znod | |||
) | [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.
xnod | array of 2 floats, min and max x coord | |
ynod | array of 2 floats, min and max y coord | |
znod | array of 2 floats, min and max z coord |
Reimplemented from PbMesh.
void PbRegularCartesianGrid3D::setGeometry | ( | int | num_x, | |
int | num_y, | |||
int | num_z, | |||
float | x_min, | |||
float | y_min, | |||
float | z_min, | |||
float | x_max, | |||
float | y_max, | |||
float | z_max | |||
) |
Defines a new geometry.
int operator!= | ( | const PbRegularCartesianGrid3D & | m1, | |
const PbRegularCartesianGrid3D & | m2 | |||
) | [friend] |
Inequality comparison operator.
int operator== | ( | const PbRegularCartesianGrid3D & | m1, | |
const PbRegularCartesianGrid3D & | m2 | |||
) | [friend] |
Equality comparison operator.