OpenWalnut
1.4.0
|
Tests the WGridRegular3D class. More...
#include <WGridRegular3D_test.h>
Public Member Functions | |
void | setUp (void) |
Called before every test. | |
void | testInstantiation (void) |
Ensure that nothing is thrown when an instance is created. | |
void | testSize (void) |
After instantiation there should be the requested number of positions. | |
void | testConvinienceFunctions (void) |
Each convinience function just assembles the three values into an boost array. | |
void | testOrientation (void) |
After instantiation there should be the right vectors, matrix and origin. | |
void | testGetNbCoords (void) |
getNbCoords should return the samples prescribed by the use of the constructor | |
void | testGetVectorOffset (void) |
getOffset should return the vector offsets prescribed by the use of the constructor | |
void | testGetPositionScalarOffset (void) |
getPosition should return the correct position for scalar offsets | |
void | testGetVoxelNumberOfGeneralPosition (void) |
The cell number of a Position is defined as follows: | |
void | testGetVoxelNumberOfPositionOutsideOfGrid (void) |
If a grid point is outside of the grid then -1 should be returned. | |
void | testGetVoxelNumberOfPositionExactlyBetweenVoxels (void) |
All points of the surfaces belonging to the lower,left,front corner of a voxel belong to this voxel. | |
void | testNeighboursInsideAGrid (void) |
A voxel inside a grid (not located on a border) has 6 neighbours. | |
void | testRotatedVoxelNum () |
The correct voxel numbers should be returned in a rotated grid. | |
void | testRotatedVoxelOutOfGrid () |
Positions outside of a rotated grid should return voxel positions of -1. | |
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. | |
void | testNeighbourOnBackUpperRight (void) |
A voxel in the back upper right corner should also have only 3 neighbours. | |
void | testNeighbourOnLeftBorderPlane (void) |
A Voxel on a border plane should have neighbours on the plane but not out side the grid. | |
void | testNeighbourOfVoxelNotInsideThisGrid (void) |
If the neighbours of a voxel not inside this grid are requested an Exception WOutOfBounds should be thrown. | |
void | testGetCellVertexIds (void) |
Check whether we get the right Ids. | |
void | testGetCellId (void) |
Check whether we get the right cellId. | |
void | testEnclosesQuery (void) |
If a point is inside of the boundary of a grid encloses should return true, otherwise false. | |
void | testEnclosesRotated () |
If a point is inside of the boundary of a grid encloses should return true, otherwise false. | |
Private Attributes | |
double | m_delta |
Maximum amount to values are allowed to differ. |
Tests the WGridRegular3D class.
Definition at line 46 of file WGridRegular3D_test.h.
void WGridRegular3DTest::setUp | ( | void | ) | [inline] |
void WGridRegular3DTest::testConvinienceFunctions | ( | void | ) | [inline] |
Each convinience function just assembles the three values into an boost array.
Definition at line 78 of file WGridRegular3D_test.h.
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 513 of file WGridRegular3D_test.h.
References WGridRegular3DTemplate< T >::encloses(), and wlimits::FLT_EPS.
void WGridRegular3DTest::testEnclosesRotated | ( | ) | [inline] |
If a point is inside of the boundary of a grid encloses should return true, otherwise false.
Definition at line 539 of file WGridRegular3D_test.h.
References WGridRegular3DTemplate< T >::encloses(), wlimits::FLT_EPS, and WMatrix< T >::makeIdentity().
void WGridRegular3DTest::testGetCellId | ( | void | ) | [inline] |
Check whether we get the right cellId.
Definition at line 460 of file WGridRegular3D_test.h.
References wlimits::FLT_EPS, and WGridRegular3DTemplate< T >::getCellId().
void WGridRegular3DTest::testGetCellVertexIds | ( | void | ) | [inline] |
Check whether we get the right Ids.
Definition at line 450 of file WGridRegular3D_test.h.
References WGridRegular3DTemplate< T >::getCellVertexIds().
void WGridRegular3DTest::testGetNbCoords | ( | void | ) | [inline] |
getNbCoords should return the samples prescribed by the use of the constructor
Definition at line 113 of file WGridRegular3D_test.h.
References WGridRegular3DTemplate< T >::getNbCoordsX(), WGridRegular3DTemplate< T >::getNbCoordsY(), and WGridRegular3DTemplate< T >::getNbCoordsZ().
void WGridRegular3DTest::testGetPositionScalarOffset | ( | void | ) | [inline] |
getPosition should return the correct position for scalar offsets
Definition at line 157 of file WGridRegular3D_test.h.
References WGridRegular3DTemplate< T >::getPosition(), m_delta, and WMatrix< T >::makeIdentity().
void WGridRegular3DTest::testGetVectorOffset | ( | void | ) | [inline] |
getOffset should return the vector offsets prescribed by the use of the constructor
Definition at line 128 of file WGridRegular3D_test.h.
References WGridRegular3DTemplate< T >::getOffsetX(), WGridRegular3DTemplate< T >::getOffsetY(), WGridRegular3DTemplate< T >::getOffsetZ(), m_delta, and WMatrix< T >::makeIdentity().
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 221 of file WGridRegular3D_test.h.
References WMatrix< T >::makeIdentity().
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 254 of file WGridRegular3D_test.h.
References WGridRegular3DTemplate< T >::getVoxelNum().
void WGridRegular3DTest::testGetVoxelNumberOfPositionOutsideOfGrid | ( | void | ) | [inline] |
If a grid point is outside of the grid then -1 should be returned.
Definition at line 239 of file WGridRegular3D_test.h.
References m_delta.
void WGridRegular3DTest::testInstantiation | ( | void | ) | [inline] |
Ensure that nothing is thrown when an instance is created.
Definition at line 60 of file WGridRegular3D_test.h.
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 440 of file WGridRegular3D_test.h.
References WGridRegular3DTemplate< T >::getNeighbours(), and WException::what().
void WGridRegular3DTest::testNeighbourOnBackUpperRight | ( | void | ) | [inline] |
A voxel in the back upper right corner should also have only 3 neighbours.
Definition at line 416 of file WGridRegular3D_test.h.
References WGridRegular3DTemplate< T >::getNeighbours().
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 428 of file WGridRegular3D_test.h.
References WGridRegular3DTemplate< T >::getNeighbours().
void WGridRegular3DTest::testNeighboursInsideAGrid | ( | void | ) | [inline] |
A voxel inside a grid (not located on a border) has 6 neighbours.
Definition at line 309 of file WGridRegular3D_test.h.
References WGridRegular3DTemplate< T >::getNeighbours().
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 405 of file WGridRegular3D_test.h.
References WGridRegular3DTemplate< T >::getNeighbours().
void WGridRegular3DTest::testOrientation | ( | void | ) | [inline] |
After instantiation there should be the right vectors, matrix and origin.
Definition at line 93 of file WGridRegular3D_test.h.
References WGridRegular3DTemplate< T >::getDirectionX(), WGridRegular3DTemplate< T >::getDirectionY(), WGridRegular3DTemplate< T >::getDirectionZ(), WGridRegular3DTemplate< T >::getOrigin(), WMatrix< T >::makeIdentity(), and WGrid::size().
void WGridRegular3DTest::testRotatedVoxelNum | ( | ) | [inline] |
The correct voxel numbers should be returned in a rotated grid.
Definition at line 320 of file WGridRegular3D_test.h.
References WGridRegular3DTemplate< T >::getXVoxelCoord(), WGridRegular3DTemplate< T >::getYVoxelCoord(), WGridRegular3DTemplate< T >::getZVoxelCoord(), and WMatrix< T >::makeIdentity().
void WGridRegular3DTest::testRotatedVoxelOutOfGrid | ( | ) | [inline] |
Positions outside of a rotated grid should return voxel positions of -1.
Definition at line 356 of file WGridRegular3D_test.h.
References wlimits::FLT_EPS, WGridRegular3DTemplate< T >::getXVoxelCoord(), WGridRegular3DTemplate< T >::getYVoxelCoord(), WGridRegular3DTemplate< T >::getZVoxelCoord(), and WMatrix< T >::makeIdentity().
void WGridRegular3DTest::testSize | ( | void | ) | [inline] |
After instantiation there should be the requested number of positions.
Definition at line 68 of file WGridRegular3D_test.h.
References WGrid::size().
double WGridRegular3DTest::m_delta [private] |
Maximum amount to values are allowed to differ.
Definition at line 591 of file WGridRegular3D_test.h.
Referenced by setUp(), testGetPositionScalarOffset(), testGetVectorOffset(), and testGetVoxelNumberOfPositionOutsideOfGrid().