OpenWalnut  1.5.0dev
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
WGridRegular3DTemplate< T > Class Template Reference

A grid that has parallelepiped cells which all have the same proportion. More...

#include <WGridRegular3D.h>

+ Inheritance diagram for WGridRegular3DTemplate< T >:
+ Collaboration diagram for WGridRegular3DTemplate< T >:

Public Types

typedef WMatrixFixed< T, 3, 1 > Vector3Type
 Convenience typedef for 3d vectors of the appropriate numerical type. More...
 
typedef std::shared_ptr< WGridRegular3DTemplateSPtr
 Convenience typedef for a std::shared_ptr< WGridRegular3DTemplate >. More...
 
typedef std::shared_ptr< const WGridRegular3DTemplateConstSPtr
 Convenience typedef for a std::shared_ptr< const WGridRegular3DTemplate >. More...
 
typedef boost::array< size_t, 8 > CellVertexArray
 Convenience typedef for a boost::array< size_t, 8 >. More...
 

Public Member Functions

template<typename InputType >
 WGridRegular3DTemplate (WGridRegular3DTemplate< InputType > const &rhs)
 Copy constructor. More...
 
 WGridRegular3DTemplate (unsigned int nbPosX, unsigned int nbPosY, unsigned int nbPosZ, WGridTransformOrthoTemplate< T > const transform=WGridTransformOrthoTemplate< T >())
 Defines the number of samples in each coordinate direction as ints, and the transformation of the grid via a grid transform. More...
 
 WGridRegular3DTemplate (unsigned int nbPosX, unsigned int nbPosY, unsigned int nbPosZ, double scaleX, double scaleY, double scaleZ)
 Defines the number of samples in each coordinate direction as ints, and the transformation of the grid via a grid transform. More...
 
unsigned int getNbCoordsX () const
 Returns the number of samples in x direction. More...
 
unsigned int getNbCoordsY () const
 Returns the number of samples in y direction. More...
 
unsigned int getNbCoordsZ () const
 Returns the number of samples in z direction. More...
 
getOffsetX () const
 Returns the distance between samples in x direction. More...
 
getOffsetY () const
 Returns the distance between samples in y direction. More...
 
getOffsetZ () const
 Returns the distance between samples in z direction. More...
 
Vector3Type getDirectionX () const
 Returns the vector determining the direction of samples in x direction. More...
 
Vector3Type getDirectionY () const
 Returns the vector determining the direction of samples in y direction. More...
 
Vector3Type getDirectionZ () const
 Returns the vector determining the direction of samples in z direction. More...
 
Vector3Type getUnitDirectionX () const
 Returns the vector determining the unit (normalized) direction of samples in x direction. More...
 
Vector3Type getUnitDirectionY () const
 Returns the vector determining the unit (normalized) direction of samples in y direction. More...
 
Vector3Type getUnitDirectionZ () const
 Returns the vector determining the unit (normalized) direction of samples in z direction. More...
 
Vector3Type getOrigin () const
 Returns the position of the origin of the grid. More...
 
WMatrix< T > getTransformationMatrix () const
 Returns a 4x4 matrix that represents the grid's transformation. More...
 
WBoundingBox getBoundingBox () const
 Axis aligned Bounding Box that encloses this grid. More...
 
WBoundingBox getBoundingBoxIncludingBorder () const
 Calculates the bounding box but includes the border voxel associated cell too. More...
 
WBoundingBox getVoxelBoundingBox () const
 Calculate the bounding box in voxel space. More...
 
Vector3Type getPosition (unsigned int i) const
 Returns the i-th position on the grid. More...
 
Vector3Type getPosition (unsigned int iX, unsigned int iY, unsigned int iZ) const
 Returns the position that is the iX-th in x direction, the iY-th in y direction and the iZ-th in z direction. More...
 
Vector3Type worldCoordToTexCoord (Vector3Type point)
 Transforms world coordinates to texture coordinates. More...
 
int getVoxelNum (const Vector3Type &pos) const
 Returns the i'th voxel where the given position belongs too. More...
 
int getVoxelNum (const size_t x, const size_t y, const size_t z) const
 returns the voxel index for a given discrete position in the grid More...
 
int getXVoxelCoord (const Vector3Type &pos) const
 Computes the X coordinate of that voxel that contains the position pos. More...
 
int getYVoxelCoord (const Vector3Type &pos) const
 Computes the Y coordinate of that voxel that contains the position pos. More...
 
int getZVoxelCoord (const Vector3Type &pos) const
 Computes the Z coordinate of that voxel that contains the position pos. More...
 
WVector3i getVoxelCoord (const Vector3Type &pos) const
 Computes the voxel coordinates of that voxel which contains the position pos. More...
 
size_t getCellId (const Vector3Type &pos, bool *success) const
 Computes the id of the cell containing the position pos. More...
 
CellVertexArray getCellVertexIds (size_t cellId) const
 Computes the ids of the vertices of a cell given by its id. More...
 
std::shared_ptr< std::vector< Vector3Type > > getVoxelVertices (const Vector3Type &point, const T margin=0.0) const
 Computes the vertices for a voxel cuboid around the given point: More...
 
std::vector< size_t > getNeighbours (size_t id) const
 Return the list of neighbour voxels. More...
 
std::vector< size_t > getNeighbours27 (size_t id) const
 Return the list of all neighbour voxels. More...
 
std::vector< size_t > getNeighboursRange (size_t id, size_t range) const
 Return the list of all neighbour voxels. More...
 
std::vector< size_t > getNeighbours9XY (size_t id) const
 Return the list of all neighbour voxels. More...
 
std::vector< size_t > getNeighbours9YZ (size_t id) const
 Return the list of all neighbour voxels. More...
 
std::vector< size_t > getNeighbours9XZ (size_t id) const
 Return the list of all neighbour voxels. More...
 
bool encloses (const Vector3Type &pos) const
 Decides whether a certain position is inside this grid or not. More...
 
bool isNotRotated () const
 Return whether the transformations of the grid are only translation and/or scaling. More...
 
WGridTransformOrthoTemplate< T > const getTransform () const
 Returns the transformation used by this grid. More...
 
bool operator== (const WGridRegular3DTemplate< T > &other) const
 Compares two grids. More...
 
- Public Member Functions inherited from WGrid
 WGrid (size_t size)
 Constructs a new WGrid instance. More...
 
virtual ~WGrid ()
 Since WGrid is a base class and thus should be polymorphic we add virtual destructor. More...
 
size_t size () const
 The number of positions in this grid. More...
 
std::shared_ptr< WPropertyGroupgetInformationProperties () const
 Returns a pointer to the information properties object of the grid. More...
 

Private Member Functions

int getNVoxelCoord (const Vector3Type &pos, size_t axis) const
 Computes for the n'th component of the voxel coordinate where the voxel contains the position pos. More...
 
void initInformationProperties ()
 Adds the specific information of this grid type to the informational properties. More...
 

Private Attributes

unsigned int m_nbPosX
 Number of positions in x direction. More...
 
unsigned int m_nbPosY
 Number of positions in y direction. More...
 
unsigned int m_nbPosZ
 Number of positions in z direction. More...
 
WGridTransformOrthoTemplate< T > const m_transform
 The grid's transformation. More...
 

Friends

template<class U >
class WGridRegular3DTemplate
 this (friend) is necessary to allow casting More...
 
class WGridRegular3DTest
 Only test are allowed as friends. More...
 

Additional Inherited Members

- Protected Attributes inherited from WGrid
std::shared_ptr< WPropertyGroupm_infoProperties
 The property object for the grid containing only props whose purpose is "PV_PURPOSE_INFORMNATION". More...
 

Detailed Description

template<typename T>
class WGridRegular3DTemplate< T >

A grid that has parallelepiped cells which all have the same proportion.

I.e. the samples along a single axis are equidistant. The distance of samples may vary between axes.

Warning
Positions on the upper bounddaries in x, y and z are considered outside the grid.

Definition at line 58 of file WGridRegular3D.h.

Member Typedef Documentation

◆ CellVertexArray

template<typename T >
typedef boost::array< size_t, 8 > WGridRegular3DTemplate< T >::CellVertexArray

Convenience typedef for a boost::array< size_t, 8 >.

Return type of getCellVertexIds.

Definition at line 86 of file WGridRegular3D.h.

◆ ConstSPtr

template<typename T >
typedef std::shared_ptr< const WGridRegular3DTemplate > WGridRegular3DTemplate< T >::ConstSPtr

Convenience typedef for a std::shared_ptr< const WGridRegular3DTemplate >.

Definition at line 81 of file WGridRegular3D.h.

◆ SPtr

template<typename T >
typedef std::shared_ptr< WGridRegular3DTemplate > WGridRegular3DTemplate< T >::SPtr

Convenience typedef for a std::shared_ptr< WGridRegular3DTemplate >.

Definition at line 76 of file WGridRegular3D.h.

◆ Vector3Type

template<typename T >
typedef WMatrixFixed< T, 3, 1 > WGridRegular3DTemplate< T >::Vector3Type

Convenience typedef for 3d vectors of the appropriate numerical type.

Definition at line 71 of file WGridRegular3D.h.

Constructor & Destructor Documentation

◆ WGridRegular3DTemplate() [1/3]

template<typename T >
template<typename InputType >
WGridRegular3DTemplate< T >::WGridRegular3DTemplate ( WGridRegular3DTemplate< InputType > const &  rhs)

Copy constructor.

Copies the data from an WGridRegular3DTemplate object with arbitary numerical type.

Parameters
rhsA WGridRegular3DTemplate object, which mustn't have the same numerical type.

Definition at line 550 of file WGridRegular3D.h.

References WGridRegular3DTemplate< T >::initInformationProperties().

+ Here is the call graph for this function:

◆ WGridRegular3DTemplate() [2/3]

template<typename T >
WGridRegular3DTemplate< T >::WGridRegular3DTemplate ( unsigned int  nbPosX,
unsigned int  nbPosY,
unsigned int  nbPosZ,
WGridTransformOrthoTemplate< T > const  transform = WGridTransformOrthoTemplate< T >() 
)

Defines the number of samples in each coordinate direction as ints, and the transformation of the grid via a grid transform.

Parameters
nbPosXnumber of positions along first axis
nbPosYnumber of positions along second axis
nbPosZnumber of positions along third axis
transforma grid transformation

Definition at line 561 of file WGridRegular3D.h.

References WGridRegular3DTemplate< T >::initInformationProperties().

+ Here is the call graph for this function:

◆ WGridRegular3DTemplate() [3/3]

template<typename T >
WGridRegular3DTemplate< T >::WGridRegular3DTemplate ( unsigned int  nbPosX,
unsigned int  nbPosY,
unsigned int  nbPosZ,
double  scaleX,
double  scaleY,
double  scaleZ 
)

Defines the number of samples in each coordinate direction as ints, and the transformation of the grid via a grid transform.

Parameters
nbPosXnumber of positions along first axis
nbPosYnumber of positions along second axis
nbPosZnumber of positions along third axis
scaleXscaling of a voxel in x direction
scaleYscaling of a voxel in y direction
scaleZscaling of a voxel in z direction

Definition at line 573 of file WGridRegular3D.h.

References WGridRegular3DTemplate< T >::initInformationProperties().

+ Here is the call graph for this function:

Member Function Documentation

◆ encloses()

template<typename T >
bool WGridRegular3DTemplate< T >::encloses ( const Vector3Type pos) const
inline

Decides whether a certain position is inside this grid or not.

Parameters
posPosition to test
Returns
True if and only if the given point is inside or on boundary of this grid, otherwise false.

Definition at line 1222 of file WGridRegular3D.h.

Referenced by WGridRegular3DTest::testEnclosesQuery(), and WGridRegular3DTest::testEnclosesRotated().

+ Here is the caller graph for this function:

◆ getBoundingBox()

template<typename T >
WBoundingBox WGridRegular3DTemplate< T >::getBoundingBox
inlinevirtual

Axis aligned Bounding Box that encloses this grid.

Returns
Axis aligned Bounding Box that encloses this grid.

Implements WGrid.

Definition at line 669 of file WGridRegular3D.h.

References WBoundingBoxImpl< VT >::expandBy().

+ Here is the call graph for this function:

◆ getBoundingBoxIncludingBorder()

template<typename T >
WBoundingBox WGridRegular3DTemplate< T >::getBoundingBoxIncludingBorder
inline

Calculates the bounding box but includes the border voxel associated cell too.

Returns
the bounding box

Definition at line 684 of file WGridRegular3D.h.

References WBoundingBoxImpl< VT >::expandBy().

+ Here is the call graph for this function:

◆ getCellId()

template<typename T >
size_t WGridRegular3DTemplate< T >::getCellId ( const Vector3Type pos,
bool *  success 
) const
inline

Computes the id of the cell containing the position pos.

Note that the upper bound of the grid does not belong to any cell

Parameters
posThe position selecting the cell.
successTrue if the position pos is inside the grid.
Returns
id of the containing the position.

Definition at line 829 of file WGridRegular3D.h.

Referenced by WGridRegular3DTest::testGetCellId().

+ Here is the caller graph for this function:

◆ getCellVertexIds()

template<typename T >
WGridRegular3DTemplate< T >::CellVertexArray WGridRegular3DTemplate< T >::getCellVertexIds ( size_t  cellId) const
inline

Computes the ids of the vertices of a cell given by its id.

Parameters
cellIdThe id of the cell we want to know ther vertices of.
Returns
Ids of vertices belonging to cell with given cellId.
 z-axis  y-axis
 |      /
 | 6___/_7
 |/:    /|
 4_:___5 |
 | :...|.|
 |.2   | 3
 |_____|/ ____x-axis
0      1

Definition at line 843 of file WGridRegular3D.h.

Referenced by WGridRegular3DTest::testGetCellVertexIds().

+ Here is the caller graph for this function:

◆ getDirectionX()

template<typename T >
WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getDirectionX
inline

Returns the vector determining the direction of samples in x direction.

Adding this vector to a grid position in world coordinates yields the position of the next sample along the grids (world coordinate) x-axis.

Returns
The vector determining the direction of samples in x direction.

Definition at line 621 of file WGridRegular3D.h.

Referenced by WGridRegular3DTest::testOrientation().

+ Here is the caller graph for this function:

◆ getDirectionY()

template<typename T >
WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getDirectionY
inline

Returns the vector determining the direction of samples in y direction.

Adding this vector to a grid position in world coordinates yields the position of the next sample along the grids (world coordinate) y-axis.

Returns
The vector determining the direction of samples in y direction.

Definition at line 627 of file WGridRegular3D.h.

Referenced by WGridRegular3DTest::testOrientation().

+ Here is the caller graph for this function:

◆ getDirectionZ()

template<typename T >
WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getDirectionZ
inline

Returns the vector determining the direction of samples in z direction.

Adding this vector to a grid position in world coordinates yields the position of the next sample along the grids (world coordinate) z-axis.

Returns
The vector determining the direction of samples in z direction.

Definition at line 633 of file WGridRegular3D.h.

Referenced by WGridRegular3DTest::testOrientation().

+ Here is the caller graph for this function:

◆ getNbCoordsX()

template<typename T >
unsigned int WGridRegular3DTemplate< T >::getNbCoordsX
inline

Returns the number of samples in x direction.

Returns
The number of samples in x direction.

Definition at line 585 of file WGridRegular3D.h.

Referenced by WGridRegular3DTemplate< T >::operator==(), and WGridRegular3DTest::testGetNbCoords().

+ Here is the caller graph for this function:

◆ getNbCoordsY()

template<typename T >
unsigned int WGridRegular3DTemplate< T >::getNbCoordsY
inline

Returns the number of samples in y direction.

Returns
The number of samples in y direction.

Definition at line 591 of file WGridRegular3D.h.

Referenced by WGridRegular3DTemplate< T >::operator==(), and WGridRegular3DTest::testGetNbCoords().

+ Here is the caller graph for this function:

◆ getNbCoordsZ()

template<typename T >
unsigned int WGridRegular3DTemplate< T >::getNbCoordsZ
inline

Returns the number of samples in z direction.

Returns
The number of samples in z direction.

Definition at line 597 of file WGridRegular3D.h.

Referenced by WGridRegular3DTemplate< T >::operator==(), and WGridRegular3DTest::testGetNbCoords().

+ Here is the caller graph for this function:

◆ getNeighbours()

template<typename T >
std::vector< size_t > WGridRegular3DTemplate< T >::getNeighbours ( size_t  id) const

Return the list of neighbour voxels.

Exceptions
WOutOfBoundsIf the voxel id is outside of the grid.
Parameters
idNumber of the voxel for which the neighbours should be computed
Returns
Vector of voxel ids which are all neighboured

Definition at line 885 of file WGridRegular3D.h.

Referenced by WGridRegular3DTest::testNeighbourOfVoxelNotInsideThisGrid(), WGridRegular3DTest::testNeighbourOnBackUpperRight(), WGridRegular3DTest::testNeighbourOnLeftBorderPlane(), WGridRegular3DTest::testNeighboursInsideAGrid(), and WGridRegular3DTest::testNeighboursOnFrontLowerLeft().

+ Here is the caller graph for this function:

◆ getNeighbours27()

template<typename T >
std::vector< size_t > WGridRegular3DTemplate< T >::getNeighbours27 ( size_t  id) const

Return the list of all neighbour voxels.

Exceptions
WOutOfBoundsIf the voxel id is outside of the grid.
Parameters
idNumber of the voxel for which the neighbours should be computed
Returns
Vector of voxel ids which are all neighboured

Definition at line 930 of file WGridRegular3D.h.

◆ getNeighbours9XY()

template<typename T >
std::vector< size_t > WGridRegular3DTemplate< T >::getNeighbours9XY ( size_t  id) const

Return the list of all neighbour voxels.

Exceptions
WOutOfBoundsIf the voxel id is outside of the grid.
Parameters
idNumber of the voxel for which the neighbours should be computed
Returns
Vector of voxel ids which are all neighboured along the XY plane

Definition at line 1031 of file WGridRegular3D.h.

◆ getNeighbours9XZ()

template<typename T >
std::vector< size_t > WGridRegular3DTemplate< T >::getNeighbours9XZ ( size_t  id) const

Return the list of all neighbour voxels.

Exceptions
WOutOfBoundsIf the voxel id is outside of the grid.
Parameters
idNumber of the voxel for which the neighbours should be computed
Returns
Vector of voxel ids which are all neighboured along the XZ plane

Definition at line 1158 of file WGridRegular3D.h.

◆ getNeighbours9YZ()

template<typename T >
std::vector< size_t > WGridRegular3DTemplate< T >::getNeighbours9YZ ( size_t  id) const

Return the list of all neighbour voxels.

Exceptions
WOutOfBoundsIf the voxel id is outside of the grid.
Parameters
idNumber of the voxel for which the neighbours should be computed
Returns
Vector of voxel ids which are all neighboured along the YZ plane

Definition at line 1094 of file WGridRegular3D.h.

◆ getNeighboursRange()

template<typename T >
std::vector< size_t > WGridRegular3DTemplate< T >::getNeighboursRange ( size_t  id,
size_t  range 
) const

Return the list of all neighbour voxels.

Exceptions
WOutOfBoundsIf the voxel id is outside of the grid.
Parameters
idNumber of the voxel for which the neighbours should be computed
rangeneighborhood range selected. It specifies the distance to count as neighbour in each direction.
Returns
Vector of voxel ids which are all neighboured

Definition at line 990 of file WGridRegular3D.h.

◆ getNVoxelCoord()

template<typename T >
int WGridRegular3DTemplate< T >::getNVoxelCoord ( const Vector3Type pos,
size_t  axis 
) const
private

Computes for the n'th component of the voxel coordinate where the voxel contains the position pos.

Parameters
posThe position for which the n'th component of the voxel coordinates should be computed.
axisThe number of the component. (0 == x-axis, 1 == y-axis, ...)
Returns
The n'th component of the voxel coordinate

◆ getOffsetX()

template<typename T >
T WGridRegular3DTemplate< T >::getOffsetX
inline

Returns the distance between samples in x direction.

Returns
The distance between samples in x direction.

Definition at line 603 of file WGridRegular3D.h.

Referenced by WGridRegular3DTest::testGetVectorOffset().

+ Here is the caller graph for this function:

◆ getOffsetY()

template<typename T >
T WGridRegular3DTemplate< T >::getOffsetY
inline

Returns the distance between samples in y direction.

Returns
The distance between samples in y direction.

Definition at line 609 of file WGridRegular3D.h.

Referenced by WGridRegular3DTest::testGetVectorOffset().

+ Here is the caller graph for this function:

◆ getOffsetZ()

template<typename T >
T WGridRegular3DTemplate< T >::getOffsetZ
inline

Returns the distance between samples in z direction.

Returns
The distance between samples in z direction.

Definition at line 615 of file WGridRegular3D.h.

Referenced by WGridRegular3DTest::testGetVectorOffset().

+ Here is the caller graph for this function:

◆ getOrigin()

template<typename T >
WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getOrigin
inline

Returns the position of the origin of the grid.

Returns
The position of the origin of the grid.

Definition at line 657 of file WGridRegular3D.h.

Referenced by WGridRegular3DTest::testOrientation().

+ Here is the caller graph for this function:

◆ getPosition() [1/2]

template<typename T >
WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getPosition ( unsigned int  i) const
inline

Returns the i-th position on the grid.

Parameters
iid of position to be obtained
Returns
i-th position of the grid.

Definition at line 714 of file WGridRegular3D.h.

Referenced by WGridRegular3DTest::testGetPositionScalarOffset().

+ Here is the caller graph for this function:

◆ getPosition() [2/2]

template<typename T >
WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getPosition ( unsigned int  iX,
unsigned int  iY,
unsigned int  iZ 
) const
inline

Returns the position that is the iX-th in x direction, the iY-th in y direction and the iZ-th in z direction.

Parameters
iXid along first axis of position to be obtained
iYid along second axis of position to be obtained
iZid along third axis of position to be obtained
Returns
Position (iX,iY,iZ)

Definition at line 720 of file WGridRegular3D.h.

◆ getTransform()

template<typename T >
WGridTransformOrthoTemplate< T > const WGridRegular3DTemplate< T >::getTransform
inline

Returns the transformation used by this grid.

Returns
The transformation.

Definition at line 1248 of file WGridRegular3D.h.

◆ getTransformationMatrix()

template<typename T >
WMatrix< T > WGridRegular3DTemplate< T >::getTransformationMatrix
inline

Returns a 4x4 matrix that represents the grid's transformation.

Returns
The grid's transformation.

Definition at line 663 of file WGridRegular3D.h.

◆ getUnitDirectionX()

template<typename T >
WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getUnitDirectionX
inline

Returns the vector determining the unit (normalized) direction of samples in x direction.

Returns
The vector determining the unit (normalized) direction of samples in x direction.

Definition at line 639 of file WGridRegular3D.h.

◆ getUnitDirectionY()

template<typename T >
WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getUnitDirectionY
inline

Returns the vector determining the unit (normalized) direction of samples in y direction.

Returns
The vector determining the unit (normalized) direction of samples in y direction.

Definition at line 645 of file WGridRegular3D.h.

◆ getUnitDirectionZ()

template<typename T >
WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::getUnitDirectionZ
inline

Returns the vector determining the unit (normalized) direction of samples in z direction.

Returns
The vector determining the unit (normalized) direction of samples in z direction.

Definition at line 651 of file WGridRegular3D.h.

◆ getVoxelBoundingBox()

template<typename T >
WBoundingBox WGridRegular3DTemplate< T >::getVoxelBoundingBox
inline

Calculate the bounding box in voxel space.

In contrast to the cell bounding box, this includes the space of the last voxel in each direction.

Returns
the voxel space bounding box.

Definition at line 699 of file WGridRegular3D.h.

References WBoundingBoxImpl< VT >::expandBy().

+ Here is the call graph for this function:

◆ getVoxelCoord()

template<typename T >
WVector3i WGridRegular3DTemplate< T >::getVoxelCoord ( const Vector3Type pos) const
inline

Computes the voxel coordinates of that voxel which contains the position pos.

Parameters
posThe position selecting the voxel.
Returns
A vector of ints where the first component is the X voxel coordinate, the second the Y component voxel coordinate and the last the Z component of the voxel coordinate. If the selecting position is outside of the grid then -1 -1 -1 is returned.

Definition at line 819 of file WGridRegular3D.h.

◆ getVoxelNum() [1/2]

template<typename T >
int WGridRegular3DTemplate< T >::getVoxelNum ( const size_t  x,
const size_t  y,
const size_t  z 
) const
inline

returns the voxel index for a given discrete position in the grid

Parameters
xPosition for which we want to have the voxel number.
yPosition for which we want to have the voxel number.
zPosition for which we want to have the voxel number.
Returns
Voxel number or -1 if the position refers to a point outside of the grid.

Definition at line 773 of file WGridRegular3D.h.

◆ getVoxelNum() [2/2]

template<typename T >
int WGridRegular3DTemplate< T >::getVoxelNum ( const Vector3Type pos) const
inline

Returns the i'th voxel where the given position belongs too.

A voxel is a cuboid which surrounds a point on the grid.

Voxel:
               ______________ ____ (0.5, 0.5, 0.5)
              /:            /|
             / :           / |
            /  :          /  |
           /   :         /   |
         _/____:_ ___ __/    |
          |    :        |    |
          |    :    *<--|--------- grid point (0, 0, 0)
          |    :........|....|__
   dz == 1|   /         |   /
          |  /          |  / dy == 1
          | /           | /
         _|/____________|/__
          |<- dx == 1 ->|
   -0.5,-0.5,-0.5

Please note the first voxel has only 1/8 of the size a normal voxel would have since all positions outside the grid do not belong to any voxel. Note: a cell is different to a voxel in terms of position. A voxel has a grid point as center whereas a cell has grid points as corners.

Parameters
posPosition for which we want to have the voxel number.
Returns
Voxel number or -1 if the position refers to a point outside of the grid.

Definition at line 747 of file WGridRegular3D.h.

Referenced by WGridRegular3DTest::testGetVoxelNumberOfPositionExactlyBetweenVoxels().

+ Here is the caller graph for this function:

◆ getVoxelVertices()

template<typename T >
std::shared_ptr< std::vector< typename WGridRegular3DTemplate< T >::Vector3Type > > WGridRegular3DTemplate< T >::getVoxelVertices ( const Vector3Type point,
const T  margin = 0.0 
) const

Computes the vertices for a voxel cuboid around the given point:

 z-axis  y-axis
 |      /
 | h___/_g
 |/:    /|
 d_:___c |
 | :...|.|
 |.e   | f
 |_____|/ ____x-axis
a      b

As you can see the order of the points is: a, b, c, d, e, f, g, h.

Parameters
pointCenter of the cuboid which must not necesarrily be a point of the grid.
marginIf you need to shrink the Voxel put here the delta > 0.
Returns
Reference to a list of vertices which are the corner points of the cube. Note this must not be a voxel, but has the same size of the an voxel. If you need voxels at grid positions fill this function with voxel center positions aka grid points.

Definition at line 865 of file WGridRegular3D.h.

◆ getXVoxelCoord()

template<typename T >
int WGridRegular3DTemplate< T >::getXVoxelCoord ( const Vector3Type pos) const
inline

Computes the X coordinate of that voxel that contains the position pos.

Parameters
posThe position which selects the voxel for which the X coordinate is computed.
Returns
The X coordinate or -1 if pos refers to point outside of the grid.

Definition at line 784 of file WGridRegular3D.h.

Referenced by WGridRegular3DTest::testRotatedVoxelNum(), and WGridRegular3DTest::testRotatedVoxelOutOfGrid().

+ Here is the caller graph for this function:

◆ getYVoxelCoord()

template<typename T >
int WGridRegular3DTemplate< T >::getYVoxelCoord ( const Vector3Type pos) const
inline

Computes the Y coordinate of that voxel that contains the position pos.

Parameters
posThe position which selects the voxel for which the Y coordinate is computed.
Returns
The Y coordinate or -1 if pos refers to point outside of the grid.

Definition at line 797 of file WGridRegular3D.h.

Referenced by WGridRegular3DTest::testRotatedVoxelNum(), and WGridRegular3DTest::testRotatedVoxelOutOfGrid().

+ Here is the caller graph for this function:

◆ getZVoxelCoord()

template<typename T >
int WGridRegular3DTemplate< T >::getZVoxelCoord ( const Vector3Type pos) const
inline

Computes the Z coordinate of that voxel that contains the position pos.

Parameters
posThe position which selects the voxel for which the Z coordinate is computed.
Returns
The Z coordinate or -1 if pos refers to point outside of the grid.

Definition at line 808 of file WGridRegular3D.h.

Referenced by WGridRegular3DTest::testRotatedVoxelNum(), and WGridRegular3DTest::testRotatedVoxelOutOfGrid().

+ Here is the caller graph for this function:

◆ initInformationProperties()

template<typename T >
void WGridRegular3DTemplate< T >::initInformationProperties
private

Adds the specific information of this grid type to the informational properties.

Definition at line 1254 of file WGridRegular3D.h.

Referenced by WGridRegular3DTemplate< T >::WGridRegular3DTemplate().

+ Here is the caller graph for this function:

◆ isNotRotated()

template<typename T >
bool WGridRegular3DTemplate< T >::isNotRotated
inline

Return whether the transformations of the grid are only translation and/or scaling.

Returns
Transformation does not contain rotation?

Definition at line 1242 of file WGridRegular3D.h.

◆ operator==()

template<typename T >
bool WGridRegular3DTemplate< T >::operator== ( const WGridRegular3DTemplate< T > &  other) const

Compares two grids.

Matches the transform and x,y,z resolution.

Parameters
otherthe one to compare against
Returns
true if transform and resolution matches

Definition at line 1278 of file WGridRegular3D.h.

References WGridRegular3DTemplate< T >::getNbCoordsX(), WGridRegular3DTemplate< T >::getNbCoordsY(), WGridRegular3DTemplate< T >::getNbCoordsZ(), and WGridRegular3DTemplate< T >::m_transform.

+ Here is the call graph for this function:

◆ worldCoordToTexCoord()

template<typename T >
WGridRegular3DTemplate< T >::Vector3Type WGridRegular3DTemplate< T >::worldCoordToTexCoord ( Vector3Type  point)
inline

Transforms world coordinates to texture coordinates.

Parameters
pointThe point with these coordinates will be transformed.
Returns
point transformed into texture coordinate system

Definition at line 729 of file WGridRegular3D.h.

Friends And Related Function Documentation

◆ WGridRegular3DTemplate

template<typename T >
template<class U >
friend class WGridRegular3DTemplate
friend

this (friend) is necessary to allow casting

Definition at line 62 of file WGridRegular3D.h.

◆ WGridRegular3DTest

template<typename T >
friend class WGridRegular3DTest
friend

Only test are allowed as friends.

Definition at line 66 of file WGridRegular3D.h.

Member Data Documentation

◆ m_nbPosX

template<typename T >
unsigned int WGridRegular3DTemplate< T >::m_nbPosX
private

Number of positions in x direction.

Definition at line 535 of file WGridRegular3D.h.

◆ m_nbPosY

template<typename T >
unsigned int WGridRegular3DTemplate< T >::m_nbPosY
private

Number of positions in y direction.

Definition at line 536 of file WGridRegular3D.h.

◆ m_nbPosZ

template<typename T >
unsigned int WGridRegular3DTemplate< T >::m_nbPosZ
private

Number of positions in z direction.

Definition at line 537 of file WGridRegular3D.h.

◆ m_transform

template<typename T >
WGridTransformOrthoTemplate< T > const WGridRegular3DTemplate< T >::m_transform
private

The grid's transformation.

Definition at line 540 of file WGridRegular3D.h.

Referenced by WGridRegular3DTemplate< T >::operator==().


The documentation for this class was generated from the following file: