Defines a regular cartesian grid surface mesh. More...
#include <MeshViz/3Ddata/PbRegularCartesianGrid2D.h>
Public Member Functions | |
PbRegularCartesianGrid2D (SbBool isDataDuplicate=TRUE) | |
PbRegularCartesianGrid2D (const PbRegularCartesianGrid2D &mesh) | |
PbRegularCartesianGrid2D (int num_x, int num_y, float x_min, float y_min, float x_max, float y_max, SbBool isDataDuplicate=TRUE) | |
PbRegularCartesianGrid2D (int num_x, int num_y, float x_min, float y_min, float x_max, float y_max, const float *z, SbBool isDataDuplicate=TRUE) | |
PbRegularCartesianGrid2D (int num_x, int num_y, const PbRegularCartesianGrid2D &other_mesh) | |
~PbRegularCartesianGrid2D () | |
PbRegularCartesianGrid2D & | operator= (const PbRegularCartesianGrid2D &mesh) |
void | setGeometry (int num_x, int num_y, float x_min, float y_min, float x_max, float y_max) |
void | setGeometry (int num_x, int num_y, float x_min, float y_min, float x_max, float y_max, const float *z) |
void | getGeometry (int &num_x, int &num_y, float &x_min, float &y_min, float &x_max, float &y_max) const |
void | getGeometry (int &num_x, int &num_y, float &x_min, float &y_min, float &x_max, float &y_max, const float *&z) 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) const |
virtual float | getArea () const |
Friends | |
int | operator== (const PbRegularCartesianGrid2D &m1, const PbRegularCartesianGrid2D &m2) |
int | operator!= (const PbRegularCartesianGrid2D &m1, const PbRegularCartesianGrid2D &m2) |
Class to define a surface mesh represented by a grid, with cartesian coordinates, of which the lines are parallel to X-axis or Y-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 2 dimensions of its grid (num_x,num_y), by its bounding box (x_min,y_min,x_max,y_max) and for a 3D mesh by its z altitudes on each nodes. z is an array of num_x * num_y floats.
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 floats.
PbRegularCartesianGrid2D::PbRegularCartesianGrid2D | ( | SbBool | isDataDuplicate = TRUE |
) |
Constructor of a default simple mesh.
See also PbMesh for more explanations about data duplication.
PbRegularCartesianGrid2D::PbRegularCartesianGrid2D | ( | const PbRegularCartesianGrid2D & | mesh | ) |
Copy constructor.
PbRegularCartesianGrid2D::PbRegularCartesianGrid2D | ( | int | num_x, | |
int | num_y, | |||
float | x_min, | |||
float | y_min, | |||
float | x_max, | |||
float | y_max, | |||
SbBool | isDataDuplicate = TRUE | |||
) |
Constructor of a 2D regular grid mesh.
See also PbMesh for more explanations about data duplication.
PbRegularCartesianGrid2D::PbRegularCartesianGrid2D | ( | int | num_x, | |
int | num_y, | |||
float | x_min, | |||
float | y_min, | |||
float | x_max, | |||
float | y_max, | |||
const float * | z, | |||
SbBool | isDataDuplicate = TRUE | |||
) |
Constructor of a 3D regular grid mesh.
See also PbMesh for more explanations about data duplication.
PbRegularCartesianGrid2D::PbRegularCartesianGrid2D | ( | int | num_x, | |
int | num_y, | |||
const PbRegularCartesianGrid2D & | other_mesh | |||
) |
Constructor of a regular grid mesh, by refining the given other_mesh.
PbRegularCartesianGrid2D::~PbRegularCartesianGrid2D | ( | ) |
Destructor.
virtual const PbCell* PbRegularCartesianGrid2D::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 PbPixelCell for a 2D mesh, or a PbQuadrangleCell for a 3D mesh.
Reimplemented from PbMesh.
virtual const PbCell* PbRegularCartesianGrid2D::findContainingCell | ( | const SbVec3f & | point, | |
float | tolerance, | |||
SbVec3f & | pcoord, | |||
const PbCell * | adjacent_cell | |||
) | const [virtual] |
Reimplemented from PbMesh.
virtual float PbRegularCartesianGrid2D::getArea | ( | ) | const [virtual] |
Gets the area of the mesh.
Reimplemented from PbMesh2D.
virtual const PbCell* PbRegularCartesianGrid2D::getCell | ( | int | cell_index | ) | const [virtual] |
Gets the cell which index is cell_index.
Returns NULL if the cell does not exist. If the cell exists, it returns a PbPixelCell for a 2D mesh, or a PbQuadrangleCell for a 3D mesh. 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 PbRegularCartesianGrid2D::getGeometry | ( | int & | num_x, | |
int & | num_y, | |||
float & | x_min, | |||
float & | y_min, | |||
float & | x_max, | |||
float & | y_max, | |||
const float *& | z | |||
) | const [inline] |
Gets the mesh 3D geometry.
Attention! For a 2D mesh, z is NULL.
void PbRegularCartesianGrid2D::getGeometry | ( | int & | num_x, | |
int & | num_y, | |||
float & | x_min, | |||
float & | y_min, | |||
float & | x_max, | |||
float & | y_max | |||
) | const [inline] |
Gets the mesh 2D geometry.
virtual SbVec3f PbRegularCartesianGrid2D::getNodeCoord | ( | int | i, | |
int | j | |||
) | const [virtual] |
Gets the coordinates of a node defined by its i,j indices on the grid.
Implements PbGrid2D.
virtual SbVec3f PbRegularCartesianGrid2D::getNodeCoord | ( | int | nod_index | ) | const [virtual] |
Gets the coordinates of a node defined by its index.
Implements PbGrid2D.
PbRegularCartesianGrid2D& PbRegularCartesianGrid2D::operator= | ( | const PbRegularCartesianGrid2D & | mesh | ) |
Assignment operator.
Reimplemented from PbGrid2D.
void PbRegularCartesianGrid2D::setGeometry | ( | int | num_x, | |
int | num_y, | |||
float | x_min, | |||
float | y_min, | |||
float | x_max, | |||
float | y_max, | |||
const float * | z | |||
) |
Defines a new 3D geometry.
void PbRegularCartesianGrid2D::setGeometry | ( | int | num_x, | |
int | num_y, | |||
float | x_min, | |||
float | y_min, | |||
float | x_max, | |||
float | y_max | |||
) |
Defines a new 2D geometry.
int operator!= | ( | const PbRegularCartesianGrid2D & | m1, | |
const PbRegularCartesianGrid2D & | m2 | |||
) | [friend] |
Inequality comparison operator.
int operator== | ( | const PbRegularCartesianGrid2D & | m1, | |
const PbRegularCartesianGrid2D & | m2 | |||
) | [friend] |
Equality comparison operator.