73SCENARIO(
"TriangulatedSurface< RealPoint3 > build tests",
"[trisurf][build]" )
75 GIVEN(
"Two triangles incident by an edge" ) {
77 THEN(
"The mesh has 4 vertices, v0 has 2 neighbors, v1 has 3 neighbors, etc" ) {
84 THEN(
"Euler number is 1 as is the Euler number of a disk." )
91 THEN(
"Breadth-first visiting the mesh from vertex 3, visit 3, then {1,2}, then 0." )
94 std::vector<unsigned long> vertices;
95 std::vector<unsigned long> distances;
98 vertices.push_back( visitor.
current().first );
99 distances.push_back( visitor.
current().second );
102 REQUIRE( vertices.size() == 4 );
103 REQUIRE( distances.size() == 4 );
104 int expected_vertices1[] = { 3, 1, 2, 0};
105 int expected_vertices2[] = { 3, 2, 1, 0};
106 int expected_distance [] = { 0, 1, 1, 2};
108 = std::equal( vertices.begin(), vertices.end(), expected_vertices1 )
109 || std::equal( vertices.begin(), vertices.end(), expected_vertices2 );
112 = std::equal( distances.begin(), distances.end(), expected_distance );
115 THEN(
"The mesh has 4 boundary vertices" ) {
117 std::sort( bv.begin(), bv.end() );
118 int expected_bv [] = { 0, 1, 2, 3};
120 bool bv_ok = std::equal( bv.begin(), bv.end(), expected_bv );
123 THEN(
"The mesh has 4 boundary arcs" ) {
127 THEN(
"The face along (1,2) is a triangle (0,1,2)" ) {
128 ArcT a12 = trimesh.
arc( 1, 2 );
137 std::sort( T.begin(), T.end() );
142 THEN(
"The face along (2,1) is a triangle (2,1,3)" ) {
143 ArcT a21 = trimesh.
arc( 2, 1 );
147 std::sort( T.begin(), T.end() );
152 THEN(
"The mesh has the barycenter (0.5, 0.5, 0.25) " ) {
162 THEN(
"We can convert the triangulated surface to a mesh and vice versa" ) {
173 THEN(
"We can iterate over the vertices" ) {
175 RealPoint exp_positions[] = { { 0,0,0 }, { 1,0,0 }, { 0,1,0 }, { 1,1,1 } };
176 for (
auto it = trimesh.
begin(), itE = trimesh.
end(); it != itE; ++it ) {
177 REQUIRE( positions[ *it ] == exp_positions[ *it ] );