25 #ifndef WMARCHINGCUBESALGORITHM_TEST_H
26 #define WMARCHINGCUBESALGORITHM_TEST_H
29 #include <cxxtest/TestSuite.h>
31 #include "../WMarchingCubesAlgorithm.h"
49 expected.
x = 1.3545454545454545;
50 expected.
y = 2.4545454545454545;
51 expected.
z = 5.4090909090909091;
58 TS_ASSERT_DELTA( expected.
x, result.
x, delta );
59 TS_ASSERT_DELTA( expected.
y, result.
y, delta );
60 TS_ASSERT_DELTA( expected.
z, result.
z, delta );
61 TS_ASSERT_EQUALS( expected.
newID, result.
newID );
78 unsigned int nbVertsInXDir = ( mc.
m_nCellsX + 1 );
79 unsigned int nbVertsInSlice = nbVertsInXDir * ( mc.
m_nCellsY + 1 );
80 unsigned int expected = z * nbVertsInSlice + y * nbVertsInXDir + x;
82 TS_ASSERT_EQUALS( expected, mc.
getVertexID( x, y, z ) );
95 unsigned int nbVertsInXDir = ( mc.
m_nCellsX + 1 );
96 unsigned int nbVertsInSlice = nbVertsInXDir * ( mc.
m_nCellsY + 1 );
99 TS_ASSERT_EQUALS( 1 , mc.
getEdgeID( 0, 0, 0, 0 ) );
100 TS_ASSERT_EQUALS( 3 * nbVertsInXDir , mc.
getEdgeID( 0, 0, 0, 1 ) );
101 TS_ASSERT_EQUALS( 3 * 1 + 1 , mc.
getEdgeID( 0, 0, 0, 2 ) );
102 TS_ASSERT_EQUALS( 0 , mc.
getEdgeID( 0, 0, 0, 3 ) );
103 TS_ASSERT_EQUALS( 3 * nbVertsInSlice + 1 , mc.
getEdgeID( 0, 0, 0, 4 ) );
104 TS_ASSERT_EQUALS( 3 * ( nbVertsInSlice + nbVertsInXDir ), mc.
getEdgeID( 0, 0, 0, 5 ) );
105 TS_ASSERT_EQUALS( 3 * ( 1 + nbVertsInSlice ) + 1, mc.
getEdgeID( 0, 0, 0, 6 ) );
106 TS_ASSERT_EQUALS( 3 * nbVertsInSlice, mc.
getEdgeID( 0, 0, 0, 7 ) );
107 TS_ASSERT_EQUALS( 2 , mc.
getEdgeID( 0, 0, 0, 8 ) );
108 TS_ASSERT_EQUALS( 3 * nbVertsInXDir + 2, mc.
getEdgeID( 0, 0, 0, 9 ) );
109 TS_ASSERT_EQUALS( 3 * ( 1 + nbVertsInXDir ) + 2, mc.
getEdgeID( 0, 0, 0, 10 ) );
110 TS_ASSERT_EQUALS( 3 * 1 + 2, mc.
getEdgeID( 0, 0, 0, 11 ) );
113 TS_ASSERT_EQUALS( -1 , mc.
getEdgeID( 0, 0, 0, -1 ) );
114 TS_ASSERT_EQUALS( -1 , mc.
getEdgeID( 0, 0, 0, 12 ) );
115 TS_ASSERT_DIFFERS( -1 , mc.
getEdgeID( 0, 0, 0, 1 ) );
129 std::vector< unsigned char > data;
149 TS_ASSERT_DELTA( expected.
x, result.
x, delta );
150 TS_ASSERT_DELTA( expected.
y, result.
y, delta );
151 TS_ASSERT_DELTA( expected.
z, result.
z, delta );
152 TS_ASSERT_EQUALS( expected.
newID, result.
newID );
167 std::vector< float > data;
187 TS_ASSERT_DELTA( expected.
x, result.
x, delta );
188 TS_ASSERT_DELTA( expected.
y, result.
y, delta );
189 TS_ASSERT_DELTA( expected.
z, result.
z, delta );
190 TS_ASSERT_EQUALS( expected.
newID, result.
newID );
194 #endif // WMARCHINGCUBESALGORITHM_TEST_H
WPointXYZId interpolate(double fX1, double fY1, double fZ1, double fX2, double fY2, double fZ2, double tVal1, double tVal2)
Interpolates between two grid points to produce the point at which the isosurface intersects an edge...
unsigned int m_nCellsY
No. of cells in y direction.
unsigned int m_nCellsZ
No. of cells in z direction.
This class does the actual computation of marching cubes.
double m_tIsoLevel
The isovalue.
void testGetVertexID()
Test computation of veretexID.
void testCalculateIntersectionFloat()
Test calculateIntersection with float.
void testCalculateIntersectionUnsignedChar()
Test calculateIntersection with unsigned char.
int getEdgeID(unsigned int nX, unsigned int nY, unsigned int nZ, unsigned int nEdgeNo)
Returns the edge ID.
unsigned int getVertexID(unsigned int nX, unsigned int nY, unsigned int nZ)
Returns the ID of the vertex given by by the IDs along the axis.
void testGetEdgeID()
Test computation of egeId.
unsigned int m_nCellsX
No. of cells in x direction.
void testInterpolate()
Test interpolate on edge.
double z
z coordinates of the point.
Tests for the class computing the actual marching cubes.
WPointXYZId calculateIntersection(const std::vector< T > *vals, unsigned int nX, unsigned int nY, unsigned int nZ, unsigned int nEdgeNo)
Calculates the intersection point id of the isosurface with an edge.
double y
y coordinates of the point.
A point consisting of its coordinates and ID.
unsigned int newID
ID of the point.
double x
x coordinates of the point.