Commit ae9e82f5 authored by Matthias Möller's avatar Matthias Möller

add unittest for normal flipping module

git-svn-id: fdac6126-5c0c-442c-9429-916003d36597
parent 14794ad2
......@@ -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/ModNormalFlippingT.hh>
namespace {
......@@ -132,16 +133,38 @@ TEST_F(OpenMeshDecimater, DecimateMeshExampleFromDoc) {
TEST_F(OpenMeshDecimater, DecimateMeshNormalFlipping) {
bool ok = OpenMesh::IO::read_mesh(mesh_, "");
typedef OpenMesh::Decimater::DecimaterT< Mesh > Decimater;
typedef OpenMesh::Decimater::ModNormalFlippingT < Mesh >::Handle HModNormalFlipping;
typedef OpenMesh::Decimater::ModQuadricT< Mesh >::Handle HModQuadric;
Decimater decimaterDBG(mesh_);
HModNormalFlipping hModNormalFlippingDGB;
decimaterDBG.add( hModNormalFlippingDGB );
HModQuadric hModQuadricDBG;
decimaterDBG.add( hModQuadricDBG );
std::cout << decimaterDBG.module( hModQuadricDBG ).name() << std::endl;
decimaterDBG.module( hModQuadricDBG ).unset_max_err();
std::cout << decimaterDBG.module( hModNormalFlippingDGB ).name() << std::endl;
decimaterDBG.module( hModNormalFlippingDGB ).set_max_normal_deviation(45.0);
EXPECT_TRUE(decimaterDBG.module( hModNormalFlippingDGB ).is_binary()) << "Normal Flipping Module is not binary.";
size_t removedVertices = 0;
removedVertices = decimaterDBG.decimate_to_faces(4500, 9996);
EXPECT_EQ(2526u, removedVertices) << "The number of remove vertices is not correct!";
EXPECT_EQ(5000u, mesh_.n_vertices()) << "The number of vertices after decimation is not correct!";
EXPECT_EQ(14994u, mesh_.n_edges()) << "The number of edges after decimation is not correct!";
EXPECT_EQ(9996u, mesh_.n_faces()) << "The number of faces after decimation is not correct!";
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