OpenWalnut  1.4.0
Public Member Functions | Private Attributes
WGridRegular3DTest Class Reference

Tests the WGridRegular3D class. More...

#include <WGridRegular3D_test.h>

+ Inheritance diagram for WGridRegular3DTest:

List of all members.

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.

Detailed Description

Tests the WGridRegular3D class.

Definition at line 46 of file WGridRegular3D_test.h.


Member Function Documentation

void WGridRegular3DTest::setUp ( void  ) [inline]

Called before every test.

Definition at line 52 of file WGridRegular3D_test.h.

References m_delta.

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.

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().

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().

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().

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().

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.

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().

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().

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().

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().

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]
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().


Member Data Documentation

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().


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