OpenWalnut  1.5.0dev
Public Member Functions | Private Attributes | List of all members
WGridRegular3DTest Class Reference

Tests the WGridRegular3D class. More...

#include <WGridRegular3D_test.h>

+ Inheritance diagram for WGridRegular3DTest:
+ Collaboration diagram for WGridRegular3DTest:

Public Member Functions

void setUp (void)
 Called before every test. More...
 
void testInstantiation (void)
 Ensure that nothing is thrown when an instance is created. More...
 
void testSize (void)
 After instantiation there should be the requested number of positions. More...
 
void testConvinienceFunctions (void)
 Each convinience function just assembles the three values into an boost array. More...
 
void testOrientation (void)
 After instantiation there should be the right vectors, matrix and origin. More...
 
void testGetNbCoords (void)
 getNbCoords should return the samples prescribed by the use of the constructor More...
 
void testGetVectorOffset (void)
 getOffset should return the vector offsets prescribed by the use of the constructor More...
 
void testGetPositionScalarOffset (void)
 getPosition should return the correct position for scalar offsets More...
 
void testGetVoxelNumberOfGeneralPosition (void)
 The cell number of a Position is defined as follows: More...
 
void testGetVoxelNumberOfPositionOutsideOfGrid (void)
 If a grid point is outside of the grid then -1 should be returned. More...
 
void testGetVoxelNumberOfPositionExactlyBetweenVoxels (void)
 All points of the surfaces belonging to the lower,left,front corner of a voxel belong to this voxel. More...
 
void testNeighboursInsideAGrid (void)
 A voxel inside a grid (not located on a border) has 6 neighbours. More...
 
void testRotatedVoxelNum ()
 The correct voxel numbers should be returned in a rotated grid. More...
 
void testRotatedVoxelOutOfGrid ()
 Positions outside of a rotated grid should return voxel positions of -1. More...
 
void testNeighboursOnFrontLowerLeft (void)
 A voxel with voxel-coordinates 0,0,0 has only three neighbours: 1,0,0; 0,1,0 and 0,0,1. More...
 
void testNeighbourOnBackUpperRight (void)
 A voxel in the back upper right corner should also have only 3 neighbours. More...
 
void testNeighbourOnLeftBorderPlane (void)
 A Voxel on a border plane should have neighbours on the plane but not out side the grid. More...
 
void testNeighbourOfVoxelNotInsideThisGrid (void)
 If the neighbours of a voxel not inside this grid are requested an Exception WOutOfBounds should be thrown. More...
 
void testGetCellVertexIds (void)
 Check whether we get the right Ids. More...
 
void testGetCellId (void)
 Check whether we get the right cellId. More...
 
void testEnclosesQuery (void)
 If a point is inside of the boundary of a grid encloses should return true, otherwise false. More...
 
void testEnclosesRotated ()
 If a point is inside of the boundary of a grid encloses should return true, otherwise false. More...
 

Private Attributes

double m_delta
 Maximum amount to values are allowed to differ. More...
 

Detailed Description

Tests the WGridRegular3D class.

Definition at line 45 of file WGridRegular3D_test.h.

Member Function Documentation

◆ setUp()

void WGridRegular3DTest::setUp ( void  )
inline

Called before every test.

Definition at line 51 of file WGridRegular3D_test.h.

References m_delta.

◆ testConvinienceFunctions()

void WGridRegular3DTest::testConvinienceFunctions ( void  )
inline

Each convinience function just assembles the three values into an boost array.

Definition at line 77 of file WGridRegular3D_test.h.

◆ testEnclosesQuery()

void WGridRegular3DTest::testEnclosesQuery ( void  )
inline

If a point is inside of the boundary of a grid encloses should return true, otherwise false.

Definition at line 512 of file WGridRegular3D_test.h.

References WGridRegular3DTemplate< T >::encloses(), and wlimits::FLT_EPS.

+ Here is the call graph for this function:

◆ testEnclosesRotated()

void WGridRegular3DTest::testEnclosesRotated ( )
inline

If a point is inside of the boundary of a grid encloses should return true, otherwise false.

Definition at line 538 of file WGridRegular3D_test.h.

References WGridRegular3DTemplate< T >::encloses(), wlimits::FLT_EPS, and WMatrix< T >::makeIdentity().

+ Here is the call graph for this function:

◆ testGetCellId()

void WGridRegular3DTest::testGetCellId ( void  )
inline

Check whether we get the right cellId.

Definition at line 459 of file WGridRegular3D_test.h.

References wlimits::FLT_EPS, and WGridRegular3DTemplate< T >::getCellId().

+ Here is the call graph for this function:

◆ testGetCellVertexIds()

void WGridRegular3DTest::testGetCellVertexIds ( void  )
inline

Check whether we get the right Ids.

Definition at line 449 of file WGridRegular3D_test.h.

References WGridRegular3DTemplate< T >::getCellVertexIds().

+ Here is the call graph for this function:

◆ testGetNbCoords()

void WGridRegular3DTest::testGetNbCoords ( void  )
inline

getNbCoords should return the samples prescribed by the use of the constructor

Definition at line 112 of file WGridRegular3D_test.h.

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

+ Here is the call graph for this function:

◆ testGetPositionScalarOffset()

void WGridRegular3DTest::testGetPositionScalarOffset ( void  )
inline

getPosition should return the correct position for scalar offsets

Definition at line 156 of file WGridRegular3D_test.h.

References WGridRegular3DTemplate< T >::getPosition(), m_delta, and WMatrix< T >::makeIdentity().

+ Here is the call graph for this function:

◆ testGetVectorOffset()

void WGridRegular3DTest::testGetVectorOffset ( void  )
inline

getOffset should return the vector offsets prescribed by the use of the constructor

Definition at line 127 of file WGridRegular3D_test.h.

References WGridRegular3DTemplate< T >::getOffsetX(), WGridRegular3DTemplate< T >::getOffsetY(), WGridRegular3DTemplate< T >::getOffsetZ(), m_delta, and WMatrix< T >::makeIdentity().

+ Here is the call graph for this function:

◆ testGetVoxelNumberOfGeneralPosition()

void WGridRegular3DTest::testGetVoxelNumberOfGeneralPosition ( void  )
inline

The cell number of a Position is defined as follows:

 y-axis
   |_____ _____ ___   _
 3 |     |     |       |
   |     |     | ...   + dy
   |_____|_____|___   _|
 2 |     | . Line
   |     |/    | ...
   |_____/___ _|___
 1 |    /|     |
   |   ' |     | ...
   |_____|_____|______ x-axis
  /0     1     2
 / `--.--ยด
/    dx
origin e.g. ( 3.1, 3.2, -6 ) and dx == dy == 1.0 ( the z-axis is ignored in this example )

Hence the line starts at approx. ( 3.85, 3.7, -6 ) and ends at approx. ( 4.35, 5.0 , -6 ). The Cell number e.g. of the start point is then: 4 and of the end point: 7.

Definition at line 220 of file WGridRegular3D_test.h.

References WMatrix< T >::makeIdentity().

+ Here is the call graph for this function:

◆ testGetVoxelNumberOfPositionExactlyBetweenVoxels()

void WGridRegular3DTest::testGetVoxelNumberOfPositionExactlyBetweenVoxels ( void  )
inline

All points of the surfaces belonging to the lower,left,front corner of a voxel belong to this voxel.

Instead all points located on the three surfaces belonging to the upper right back corner are considered not to belong to this voxel.

Definition at line 253 of file WGridRegular3D_test.h.

References WGridRegular3DTemplate< T >::getVoxelNum().

+ Here is the call graph for this function:

◆ testGetVoxelNumberOfPositionOutsideOfGrid()

void WGridRegular3DTest::testGetVoxelNumberOfPositionOutsideOfGrid ( void  )
inline

If a grid point is outside of the grid then -1 should be returned.

Definition at line 238 of file WGridRegular3D_test.h.

References m_delta.

◆ testInstantiation()

void WGridRegular3DTest::testInstantiation ( void  )
inline

Ensure that nothing is thrown when an instance is created.

Definition at line 59 of file WGridRegular3D_test.h.

◆ testNeighbourOfVoxelNotInsideThisGrid()

void WGridRegular3DTest::testNeighbourOfVoxelNotInsideThisGrid ( void  )
inline

If the neighbours of a voxel not inside this grid are requested an Exception WOutOfBounds should be thrown.

Definition at line 439 of file WGridRegular3D_test.h.

References WGridRegular3DTemplate< T >::getNeighbours(), and WException::what().

+ Here is the call graph for this function:

◆ testNeighbourOnBackUpperRight()

void WGridRegular3DTest::testNeighbourOnBackUpperRight ( void  )
inline

A voxel in the back upper right corner should also have only 3 neighbours.

Definition at line 415 of file WGridRegular3D_test.h.

References WGridRegular3DTemplate< T >::getNeighbours().

+ Here is the call graph for this function:

◆ testNeighbourOnLeftBorderPlane()

void WGridRegular3DTest::testNeighbourOnLeftBorderPlane ( void  )
inline

A Voxel on a border plane should have neighbours on the plane but not out side the grid.

Definition at line 427 of file WGridRegular3D_test.h.

References WGridRegular3DTemplate< T >::getNeighbours().

+ Here is the call graph for this function:

◆ testNeighboursInsideAGrid()

void WGridRegular3DTest::testNeighboursInsideAGrid ( void  )
inline

A voxel inside a grid (not located on a border) has 6 neighbours.

Definition at line 308 of file WGridRegular3D_test.h.

References WGridRegular3DTemplate< T >::getNeighbours().

+ Here is the call graph for this function:

◆ testNeighboursOnFrontLowerLeft()

void WGridRegular3DTest::testNeighboursOnFrontLowerLeft ( void  )
inline

A voxel with voxel-coordinates 0,0,0 has only three neighbours: 1,0,0; 0,1,0 and 0,0,1.

Definition at line 404 of file WGridRegular3D_test.h.

References WGridRegular3DTemplate< T >::getNeighbours().

+ Here is the call graph for this function:

◆ testOrientation()

void WGridRegular3DTest::testOrientation ( void  )
inline

After instantiation there should be the right vectors, matrix and origin.

Definition at line 92 of file WGridRegular3D_test.h.

References WGridRegular3DTemplate< T >::getDirectionX(), WGridRegular3DTemplate< T >::getDirectionY(), WGridRegular3DTemplate< T >::getDirectionZ(), WGridRegular3DTemplate< T >::getOrigin(), WMatrix< T >::makeIdentity(), and WGrid::size().

+ Here is the call graph for this function:

◆ testRotatedVoxelNum()

void WGridRegular3DTest::testRotatedVoxelNum ( )
inline

The correct voxel numbers should be returned in a rotated grid.

Definition at line 319 of file WGridRegular3D_test.h.

References WGridRegular3DTemplate< T >::getXVoxelCoord(), WGridRegular3DTemplate< T >::getYVoxelCoord(), WGridRegular3DTemplate< T >::getZVoxelCoord(), and WMatrix< T >::makeIdentity().

+ Here is the call graph for this function:

◆ testRotatedVoxelOutOfGrid()

void WGridRegular3DTest::testRotatedVoxelOutOfGrid ( )
inline

Positions outside of a rotated grid should return voxel positions of -1.

Definition at line 355 of file WGridRegular3D_test.h.

References wlimits::FLT_EPS, WGridRegular3DTemplate< T >::getXVoxelCoord(), WGridRegular3DTemplate< T >::getYVoxelCoord(), WGridRegular3DTemplate< T >::getZVoxelCoord(), and WMatrix< T >::makeIdentity().

+ Here is the call graph for this function:

◆ testSize()

void WGridRegular3DTest::testSize ( void  )
inline

After instantiation there should be the requested number of positions.

Definition at line 67 of file WGridRegular3D_test.h.

References WGrid::size().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_delta

double WGridRegular3DTest::m_delta
private

Maximum amount to values are allowed to differ.

Definition at line 590 of file WGridRegular3D_test.h.

Referenced by setUp(), testGetPositionScalarOffset(), testGetVectorOffset(), and testGetVoxelNumberOfPositionOutsideOfGrid().


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