25 #ifndef WBRESENHAM_TEST_H
26 #define WBRESENHAM_TEST_H
31 #include <cxxtest/TestSuite.h>
33 #include "../WBresenham.h"
34 #include "core/common/WLogger.h"
50 std::shared_ptr< WGridRegular3D > grid(
new WGridRegular3D( 3, 3, 3 ) );
72 std::vector< double > expected( 27, 0.0 );
74 TS_ASSERT_EQUALS(
m_algo->m_values, expected );
87 std::vector< double > expected( 27, 0.0 );
89 TS_ASSERT_EQUALS(
m_algo->m_values, expected );
103 std::vector< double > expected( 27, 0.0 );
107 TS_ASSERT_EQUALS(
m_algo->m_values, expected );
122 std::shared_ptr< WGridRegular3D > grid(
new WGridRegular3D( 3, 3, 3, trans ) );
130 std::vector< double > expected( 27, 0.0 );
134 TS_ASSERT_EQUALS(
m_algo->m_values, expected );
148 std::vector< double > expected( 27, 0.0 );
152 TS_ASSERT_EQUALS(
m_algo->m_values, expected );
159 TS_ASSERT_EQUALS(
m_algo->m_values, expected );
173 std::vector< double > expected( 27, 0.0 );
177 TS_ASSERT_EQUALS(
m_algo->m_values, expected );
180 m_algo->m_values[0] = 0.0;
181 m_algo->m_values[3] = 0.0;
182 m_algo->m_values[7] = 0.0;
189 TS_ASSERT_EQUALS(
m_algo->m_values, expected );
Unit tests the Bresenham algorithm.
void testExactLineIsRasteredTheSameWayAsMidpointLines(void)
Lines starting in a voxel A and ending in voxel B are rastered exactly the same way as all lines star...
void testPolyLineRastering(void)
Lines like WFibers consisting out of multiple line segements should be traced segment by segment.
void tearDown(void)
Clean up after each test.
std::shared_ptr< WBresenham > m_algo
test instace of the WBresenham algo
void testSymmetry(void)
If you have a line from A to B then rastering it from B to should be equivalent.
void testPolySegmentOneVoxelRastering(void)
Multiple segments in one voxel should also mark only this voxel.
void testLineSegementWithSameStartAndEndPoint(void)
If a line segments starts and ends on the same point only its voxel should be selected.
void setUp(void)
Creates a member variable with a WBresenham instance which you may use for testing.
void testRasteringIn3rdQuadrant(void)
Lines rastered in the 3rd Quadrant should also be traced.
Implements basic Bresenham algorithm for rasterization.
A grid that has parallelepiped cells which all have the same proportion.
A line is an ordered sequence of WPositions.
static void startup(std::ostream &output=std::cout, LogLevel level=LL_DEBUG)
Create the first and only instance of the logger as it is a singleton.
WMatrix & makeIdentity()
Makes the matrix contain the identity matrix, i.e.
void push_back(const value_type &value)
Wrapper around std::vector member function.
void clear()
Wrapper around std::vector member function.
This only is a 3d double vector.
const double DBL_EPS
Smallest double such: 1.0 + DBL_EPS == 1.0 is still true.