49SCENARIO(
"TangencyComputer::ShortestPaths 3D tests",
"[shortest_paths][3d][tangency]" )
55 typedef std::size_t
Index;
57 SECTION(
"Computing shortest paths on a 3D unit sphere digitized at gridstep 0.25" )
60 const double h = 0.25;
62 params(
"polynomial",
"sphere1" )(
"gridstep", h );
63 params(
"minAABB", -2)(
"maxAABB", 2)(
"offset", 1.0 )(
"closed", 1 );
71 std::vector< Point > lattice_points;
73 for (
auto p : pointels ) lattice_points.push_back(
K.uCoords( p ) );
74 REQUIRE( pointels.size() == 296 );
76 const Index nb = lattice_points.size();
79 for (
Index i = 1; i < nb; i++ )
81 if ( lattice_points[ i ] < lattice_points[ lowest ] ) lowest = i;
82 if ( lattice_points[ uppest ] < lattice_points[ i ] ) uppest = i;
87 TC.init( lattice_points.cbegin(), lattice_points.cend() );
88 auto SP = TC.makeShortestPaths( sqrt(3.0) );
90 double last_distance = 0.0;
92 double prev_distance = 0.0;
94 unsigned int nb_multiple_pops = 0;
95 unsigned int nb_decreasing_distance = 0;
96 while ( ! SP.finished() )
98 last = std::get<0>( SP.current() );
99 last_distance = std::get<2>( SP.current() );
100 if ( V.count( last ) ) nb_multiple_pops += 1;
103 if ( last_distance < prev_distance ) nb_decreasing_distance += 1;
104 prev_distance = last_distance;
107 REQUIRE( nb_multiple_pops == 0 );
109 REQUIRE( nb_decreasing_distance == 0 );
113 REQUIRE( last_distance*h >= 2.8 );
114 REQUIRE( last_distance*h <= 3.14159265358979323844 );
116 SP = TC.makeShortestPaths( 0 );
118 double last_distance_opt = 0.0;
119 while ( ! SP.finished() )
121 last = std::get<0>( SP.current() );
122 last_distance_opt = std::get<2>( SP.current() );
128 REQUIRE( last_distance_opt*h >= 2.8 );
129 REQUIRE( last_distance_opt*h <= 3.14159265358979323844 );
131 REQUIRE( last_distance_opt*h >= last_distance*h );