Commit d4c65be9 authored by Daniel Gotzen's avatar Daniel Gotzen
Browse files

fixed last unittest

parent 40a8f27c
...@@ -19,13 +19,10 @@ void decimateRoundness(ExampleMesh& mesh ){ ...@@ -19,13 +19,10 @@ void decimateRoundness(ExampleMesh& mesh ){
decimater.module(hModRoundness).set_min_roundness(0.7, true); // choose a minimal roundness value between 0 and 1.0 and set binary mode to true decimater.module(hModRoundness).set_min_roundness(0.7, true); // choose a minimal roundness value between 0 and 1.0 and set binary mode to true
decimater.module(hModRoundness).set_min_angle(15.0, true); // or choose a minimal angle in degrees. second argument gets ignored decimater.module(hModRoundness).set_min_angle(15.0, true); // or choose a minimal angle in degrees. second argument gets ignored
//in non-binary mode set OR unset minimal roundness //in non-binary mode unset OR set minimal roundness
decimater.module(hModRoundness).unset_min_roundness(); // unset minimal roundness decimater.module(hModRoundness).unset_min_roundness(); // unset minimal roundness
decimater.module(hModRoundness).set_min_roundness(0.7, false); // or choose a minimal roundness value between 0 and 1.0 and set binary mode to false decimater.module(hModRoundness).set_min_roundness(0.7, false); // or choose a minimal roundness value between 0 and 1.0 and set binary mode to false
decimater.initialize(); decimater.initialize();
decimater.decimate(); decimater.decimate();
// after decimation: remove decimated elements from the mesh // after decimation: remove decimated elements from the mesh
......
...@@ -141,7 +141,6 @@ TEST_F(OpenMeshDocDecimater, DecimateEdgeLength) { ...@@ -141,7 +141,6 @@ TEST_F(OpenMeshDocDecimater, DecimateEdgeLength) {
face_vhandles2.push_back(vhandle[2]); face_vhandles2.push_back(vhandle[2]);
mesh_.add_face(face_vhandles2); mesh_.add_face(face_vhandles2);
decimateEdgeLength(mesh_); decimateEdgeLength(mesh_);
EXPECT_EQ(1,mesh_.n_faces()) << "Faces did not get decimated to face with shorter edges"; EXPECT_EQ(1,mesh_.n_faces()) << "Faces did not get decimated to face with shorter edges";
} }
...@@ -500,59 +499,55 @@ TEST_F(OpenMeshDocDecimater, DecimateRoundness) { ...@@ -500,59 +499,55 @@ TEST_F(OpenMeshDocDecimater, DecimateRoundness) {
mesh_.clear(); mesh_.clear();
// Add some vertices // Add some vertices
TriMeshVec3f::VertexHandle vhandle[4]; TriMeshVec3f::VertexHandle vhandle[6];
vhandle[0] = mesh_.add_vertex(TriMeshVec3f::Point(0.0, 0.0, 0.0)); vhandle[0] = mesh_.add_vertex(TriMeshVec3f::Point(0.0, 0.0, 0.0));
vhandle[1] = mesh_.add_vertex(TriMeshVec3f::Point(0.0, 1.0, 0.0)); vhandle[1] = mesh_.add_vertex(TriMeshVec3f::Point(0.0, 2.0, 0.0));
vhandle[2] = mesh_.add_vertex(TriMeshVec3f::Point(2.0, 1.0, 0.0)); vhandle[2] = mesh_.add_vertex(TriMeshVec3f::Point(1.0, 1.0, 0.0));
vhandle[3] = mesh_.add_vertex(TriMeshVec3f::Point(1.0, 0.0, 0.0)); vhandle[3] = mesh_.add_vertex(TriMeshVec3f::Point(3.0, 0.0, 0.0));
vhandle[4] = mesh_.add_vertex(TriMeshVec3f::Point(2.0, 1.0, 0.0));
vhandle[5] = mesh_.add_vertex(TriMeshVec3f::Point(3.0, 2.0, 0.0));
// Add faces // Add faces
std::vector<TriMeshVec3f::VertexHandle> face_vhandles1; std::vector<TriMeshVec3f::VertexHandle> face_vhandles1;
std::vector<TriMeshVec3f::VertexHandle> face_vhandles2; std::vector<TriMeshVec3f::VertexHandle> face_vhandles2;
std::vector<TriMeshVec3f::VertexHandle> face_vhandles3;
std::vector<TriMeshVec3f::VertexHandle> face_vhandles4;
std::vector<TriMeshVec3f::VertexHandle> face_vhandles5;
std::vector<TriMeshVec3f::VertexHandle> face_vhandles6;
face_vhandles1.push_back(vhandle[0]); face_vhandles1.push_back(vhandle[0]);
face_vhandles1.push_back(vhandle[1]); face_vhandles1.push_back(vhandle[1]);
face_vhandles1.push_back(vhandle[3]); face_vhandles1.push_back(vhandle[2]);
mesh_.add_face(face_vhandles1); mesh_.add_face(face_vhandles1);
face_vhandles2.push_back(vhandle[3]); face_vhandles2.push_back(vhandle[3]);
face_vhandles2.push_back(vhandle[1]); face_vhandles2.push_back(vhandle[4]);
face_vhandles2.push_back(vhandle[2]); face_vhandles2.push_back(vhandle[5]);
mesh_.add_face(face_vhandles2); mesh_.add_face(face_vhandles2);
face_vhandles3.push_back(vhandle[1]);
face_vhandles3.push_back(vhandle[4]);
face_vhandles3.push_back(vhandle[2]);
mesh_.add_face(face_vhandles3);
decimateRoundness(mesh_); face_vhandles4.push_back(vhandle[0]);
EXPECT_EQ(1,mesh_.n_faces()) << "Faces did not get decimated but the roundness would be greater 0.5."; face_vhandles4.push_back(vhandle[2]);
} face_vhandles4.push_back(vhandle[3]);
{ mesh_.add_face(face_vhandles4);
mesh_.clear();
// Add some vertices
TriMeshVec3f::VertexHandle vhandle[4];
vhandle[0] = mesh_.add_vertex(TriMeshVec3f::Point(0.0, 0.0, 0.0));
vhandle[1] = mesh_.add_vertex(TriMeshVec3f::Point(0.0, 1.0, 0.0));
vhandle[2] = mesh_.add_vertex(TriMeshVec3f::Point(10.0, 10.0, 100.0));
vhandle[3] = mesh_.add_vertex(TriMeshVec3f::Point(10.0, 0.0, 0.0));
// Add faces
std::vector<TriMeshVec3f::VertexHandle> face_vhandles1;
std::vector<TriMeshVec3f::VertexHandle> face_vhandles2;
face_vhandles1.push_back(vhandle[0]);
face_vhandles1.push_back(vhandle[1]);
face_vhandles1.push_back(vhandle[3]);
mesh_.add_face(face_vhandles1);
face_vhandles2.push_back(vhandle[3]); face_vhandles5.push_back(vhandle[1]);
face_vhandles2.push_back(vhandle[1]); face_vhandles5.push_back(vhandle[5]);
face_vhandles2.push_back(vhandle[2]); face_vhandles5.push_back(vhandle[4]);
mesh_.add_face(face_vhandles2); mesh_.add_face(face_vhandles5);
face_vhandles6.push_back(vhandle[0]);
face_vhandles6.push_back(vhandle[4]);
face_vhandles6.push_back(vhandle[3]);
mesh_.add_face(face_vhandles6);
decimateRoundness(mesh_); decimateRoundness(mesh_);
EXPECT_EQ(2,mesh_.n_faces()) << "Faces got decimated but roundness is to high"; EXPECT_EQ(4,mesh_.n_faces()) << "Faces did not get decimated but the roundness would be greater 0.5.";
} }
} }
...@@ -617,7 +612,7 @@ TEST_F(OpenMeshDocDecimater, Decimate) { ...@@ -617,7 +612,7 @@ TEST_F(OpenMeshDocDecimater, Decimate) {
decimate(mesh_); decimate(mesh_);
EXPECT_EQ(2,mesh_.n_faces()) << "Faces got decimated illigally"; EXPECT_EQ(2,mesh_.n_faces()) << "Faces got decimated illegally";
} }
} }
...@@ -628,6 +623,4 @@ TEST_F(OpenMeshDocDecimater, Decimate) { ...@@ -628,6 +623,4 @@ TEST_F(OpenMeshDocDecimater, Decimate) {
break; break;
}*/ }*/
/* decimateAspectRatio(mesh_);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment