25 #ifndef WVISITRACE_TEST_H
26 #define WVISITRACE_TEST_H
31 #include <cxxtest/TestSuite.h>
33 #include "../WVisiTrace.h"
34 #include "../../../core/common/math/test/WPositionTraits.h"
63 std::vector< WPosition > line = myVisiTrace.
getLine();
64 TS_ASSERT_EQUALS( line.size(), 0 );
73 std::vector< std::vector< WPosition > > candidates;
74 const std::vector< int > sizes = { 4, 2, 5, 8, 3, 6 };
75 for(
size_t id = 0;
id < sizes.size(); ++id )
82 TS_ASSERT_EQUALS( order.size(), 28 );
84 TS_ASSERT_EQUALS( order[0], std::make_pair( 0, 0 ) );
85 TS_ASSERT_EQUALS( order[1], std::make_pair( 0, 1 ) );
86 TS_ASSERT_EQUALS( order[2], std::make_pair( 0, 2 ) );
87 TS_ASSERT_EQUALS( order[3], std::make_pair( 0, 3 ) );
89 TS_ASSERT_EQUALS( order[5], std::make_pair( 1, 1 ) );
90 TS_ASSERT_EQUALS( order[6], std::make_pair( 2, 0 ) );
92 TS_ASSERT_EQUALS( order[27], std::make_pair( 5, 5 ) );
101 std::vector< std::vector< WPosition > > candidates;
102 const std::vector< int > sizes = { 4, 2, 5, 8, 3, 6 };
103 for(
size_t id = 0;
id < sizes.size(); ++id )
110 TS_ASSERT_EQUALS( inverseRefs.size(), 6 );
112 TS_ASSERT_EQUALS( inverseRefs[0][0], 0 );
113 TS_ASSERT_EQUALS( inverseRefs[0][1], 1 );
114 TS_ASSERT_EQUALS( inverseRefs[0][2], 2 );
115 TS_ASSERT_EQUALS( inverseRefs[0][3], 3 );
117 TS_ASSERT_EQUALS( inverseRefs[1][0], 4 );
118 TS_ASSERT_EQUALS( inverseRefs[1][1], 5 );
120 TS_ASSERT_EQUALS( inverseRefs[2][0], 6 );
122 TS_ASSERT_EQUALS( inverseRefs[5][5], 27 );
162 TS_ASSERT_EQUALS( myVisiTrace.
m_curve3D.size(), 3 );
177 const size_t numCands1 = 11;
178 const size_t numCands2 = 12;
179 const size_t numCands3 = 13;
181 std::vector< std::pair< double, WPosition > > cands1;
182 const double someDoubleValue1 = 1.1;
183 for(
size_t id = 0;
id < numCands1; ++id )
185 cands1.push_back( std::make_pair( someDoubleValue1 *
id,
WPosition( someDoubleValue1 *
id, someDoubleValue1, someDoubleValue1 ) ) );
190 std::vector< std::pair< double, WPosition > > cands2;
191 const double someDoubleValue2 = 1.2;
192 for(
size_t id = 0;
id < numCands2; ++id )
194 cands2.push_back( std::make_pair( someDoubleValue2 *
id,
WPosition( someDoubleValue2 *
id, someDoubleValue2, someDoubleValue2 ) ) );
199 std::vector< std::pair< double, WPosition > > cands3;
200 const double someDoubleValue3 = 1.3;
201 for(
size_t id = 0;
id < numCands3; ++id )
203 cands3.push_back( std::make_pair( someDoubleValue3 *
id,
WPosition( someDoubleValue3 *
id, someDoubleValue3, someDoubleValue3 ) ) );
This only is a 3d double vector.
void testGetLineOfInitial()
Ensure that getline does not return anything until something is added.
void setUp()
Setup method called before every test case.
void testAddingPositions()
Does addCandidatesForRay() actually add positions.
void testPerformDijkstraException()
Check throwing of Dijkstra and result according to VisiTrace with constant opacity weights.
void testLinearization()
Check correct order resulting from getLinearizedNodesRefs.
void testInstatiation()
Ensure instantiation does not throw and does initialization right.
void testInverseLinearization()
Check getLinearizedNodesRefs.
Class performing graph computations for VisiTrace algorithm.
std::vector< std::vector< WPosition > > m_candidatePositions
The candidate positions for all rays.
std::vector< std::vector< double > > m_candidateJumps
The opacity jumps belonging to the intervals of the candidate positions.
std::vector< std::vector< int > > getInverseLinearizedNodesRefs() const
Get ids in the vector of getLinearizedNodesRefs from structure of m_candidatePositions.
std::vector< WPosition > getLine()
Get the final 3D line a vector of WPosition.
void addCandidatesForRay(const std::vector< std::pair< double, WPosition > > candidates)
Add candidate positions and corresponding opacity jump values for one viewing ray.
std::vector< std::pair< int, int > > getLinearizedNodesRefs() const
Get an vector with reference ids for all nodes.
std::vector< WPosition > m_curve3D
The 3D curve computed by VisiTrace.
void performDijkstra()
Create weighted graph and find shortest path from according to VisiTrace.