add unittest for decimater using normal deviation as binary check
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <Unittests/unittests_common.hh>
|
||||
#include <OpenMesh/Tools/Decimater/DecimaterT.hh>
|
||||
#include <OpenMesh/Tools/Decimater/ModQuadricT.hh>
|
||||
#include <OpenMesh/Tools/Decimater/ModNormalDeviationT.hh>
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -103,6 +104,34 @@ TEST_F(OpenMeshDecimater, DecimateMeshToFaceFaceLimit) {
|
||||
EXPECT_EQ(9996u, mesh_.n_faces()) << "The number of faces after decimation is not correct!";
|
||||
}
|
||||
|
||||
|
||||
TEST_F(OpenMeshDecimater, DecimateMeshToVertexLimitWithLowNormalDeviation) {
|
||||
|
||||
bool ok = OpenMesh::IO::read_mesh(mesh_, "cube1.off");
|
||||
|
||||
ASSERT_TRUE(ok);
|
||||
|
||||
typedef OpenMesh::Decimater::DecimaterT< Mesh > Decimater;
|
||||
typedef OpenMesh::Decimater::ModQuadricT< Mesh >::Handle HModQuadric;
|
||||
typedef OpenMesh::Decimater::ModNormalDeviationT< Mesh >::Handle HModNormalDeviation;
|
||||
|
||||
Decimater decimaterDBG(mesh_);
|
||||
HModQuadric hModQuadricDBG;
|
||||
decimaterDBG.add( hModQuadricDBG );
|
||||
HModNormalDeviation hModNormalDeviation;
|
||||
decimaterDBG.add( hModNormalDeviation );
|
||||
decimaterDBG.module(hModNormalDeviation).set_normal_deviation(15.0);
|
||||
decimaterDBG.initialize();
|
||||
size_t removedVertices = 0;
|
||||
removedVertices = decimaterDBG.decimate_to(8);
|
||||
decimaterDBG.mesh().garbage_collection();
|
||||
|
||||
EXPECT_EQ(6998u, removedVertices) << "The number of remove vertices is not correct!";
|
||||
EXPECT_EQ( 528u, mesh_.n_vertices()) << "The number of vertices after decimation is not correct!";
|
||||
EXPECT_EQ(1578u, mesh_.n_edges()) << "The number of edges after decimation is not correct!";
|
||||
EXPECT_EQ(1052u, mesh_.n_faces()) << "The number of faces after decimation is not correct!";
|
||||
}
|
||||
|
||||
TEST_F(OpenMeshDecimater, DecimateMeshExampleFromDoc) {
|
||||
|
||||
bool ok = OpenMesh::IO::read_mesh(mesh_, "cube1.off");
|
||||
|
||||
Reference in New Issue
Block a user