1 #ifndef INCLUDE_UNITTESTS_MC_DECIMATER_HH
2 #define INCLUDE_UNITTESTS_MC_DECIMATER_HH
4 #include <gtest/gtest.h>
5 #include <Unittests/unittests_common.hh>
15 virtual void SetUp() {
21 virtual void TearDown() {
44 typedef OpenMesh::Decimater::McDecimaterT< Mesh > Decimater;
45 typedef OpenMesh::Decimater::ModQuadricT< Mesh >::Handle HModQuadric;
46 typedef OpenMesh::Decimater::ModNormalFlippingT< Mesh >::Handle HModNormal;
48 Decimater decimaterDBG(mesh_);
49 HModQuadric hModQuadricDBG;
50 decimaterDBG.add( hModQuadricDBG );
51 decimaterDBG.initialize();
52 int removedVertices = 0;
53 removedVertices = decimaterDBG.decimate_to(5000);
54 decimaterDBG.mesh().garbage_collection();
56 EXPECT_EQ(2526, removedVertices) <<
"The number of remove vertices is not correct!";
57 EXPECT_EQ(5000u, mesh_.n_vertices()) <<
"The number of vertices after decimation is not correct!";
58 EXPECT_EQ(14994u, mesh_.n_edges()) <<
"The number of edges after decimation is not correct!";
59 EXPECT_EQ(9996u, mesh_.n_faces()) <<
"The number of faces after decimation is not correct!";
68 typedef OpenMesh::Decimater::McDecimaterT< Mesh > Decimater;
69 typedef OpenMesh::Decimater::ModQuadricT< Mesh >::Handle HModQuadric;
70 typedef OpenMesh::Decimater::ModNormalFlippingT< Mesh >::Handle HModNormal;
72 Decimater decimaterDBG(mesh_);
73 HModQuadric hModQuadricDBG;
74 decimaterDBG.add( hModQuadricDBG );
75 decimaterDBG.initialize();
76 int removedVertices = 0;
77 removedVertices = decimaterDBG.decimate_to_faces(5000, 8000);
78 decimaterDBG.mesh().garbage_collection();
80 EXPECT_EQ(2526, removedVertices) <<
"The number of remove vertices is not correct!";
81 EXPECT_EQ(5000u, mesh_.n_vertices()) <<
"The number of vertices after decimation is not correct!";
82 EXPECT_EQ(14994u, mesh_.n_edges()) <<
"The number of edges after decimation is not correct!";
83 EXPECT_EQ(9996u, mesh_.n_faces()) <<
"The number of faces after decimation is not correct!";
92 typedef OpenMesh::Decimater::McDecimaterT< Mesh > Decimater;
93 typedef OpenMesh::Decimater::ModQuadricT< Mesh >::Handle HModQuadric;
94 typedef OpenMesh::Decimater::ModNormalFlippingT< Mesh >::Handle HModNormal;
96 Decimater decimaterDBG(mesh_);
97 HModQuadric hModQuadricDBG;
98 decimaterDBG.add( hModQuadricDBG );
99 decimaterDBG.initialize();
100 int removedVertices = 0;
101 removedVertices = decimaterDBG.decimate_to_faces(4500, 9996);
102 decimaterDBG.mesh().garbage_collection();
104 EXPECT_EQ(2526, removedVertices) <<
"The number of remove vertices is not correct!";
105 EXPECT_EQ(5000u, mesh_.n_vertices()) <<
"The number of vertices after decimation is not correct!";
106 EXPECT_EQ(14994u, mesh_.n_edges()) <<
"The number of edges after decimation is not correct!";
107 EXPECT_EQ(9996u, mesh_.n_faces()) <<
"The number of faces after decimation is not correct!";
110 #endif // INCLUDE GUARD