Commit fb8baf09 authored by Jan Möbius's avatar Jan Möbius

Mesh Dual unittest

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@927 fdac6126-5c0c-442c-9429-916003d36597
parent 861fe9f1
......@@ -99,7 +99,7 @@ PolyMesh_ArrayKernelT<MeshTraits>* MeshDual (PolyMesh_ArrayKernelT<MeshTraits> &
for(typename PolyMesh_ArrayKernelT<MeshTraits>::ConstFaceIter fit=primal.faces_begin(); fit!=primal.faces_end(); ++fit)
{
typename PolyMesh_ArrayKernelT<MeshTraits>::Point centerPoint(0,0,0);
unsigned int degree= 0;
typename PolyMesh_ArrayKernelT<MeshTraits>::Scalar degree= 0.0;
for(typename PolyMesh_ArrayKernelT<MeshTraits>::ConstFaceVertexIter vit=primal.cfv_iter(*fit); vit.is_valid(); ++vit, ++degree)
centerPoint += primal.point(*vit);
assert(degree!=0);
......@@ -124,7 +124,7 @@ PolyMesh_ArrayKernelT<MeshTraits>* MeshDual (PolyMesh_ArrayKernelT<MeshTraits> &
return dual;
};
}
//=============================================================================
} // namespace Util
......
......@@ -11,6 +11,7 @@
#include "unittests_trimesh_collapse.hh"
#include "unittests_decimater.hh"
#include "unittests_mc_decimater.hh"
#include "unittests_mesh_dual.hh"
#include "unittests_mixed_decimater.hh"
#include "unittests_subdivider_uniform.hh"
#include "unittests_subdivider_adaptive.hh"
......
#ifndef INCLUDE_UNITTESTS_MESHDUAL_HH
#define INCLUDE_UNITTESTS_MESHDUAL_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <OpenMesh/Tools/Dualizer/meshDualT.hh>
class OpenMeshMeshDual : public OpenMeshBasePoly {
protected:
// This function is called before each test is run
virtual void SetUp() {
// Do some initial stuff with the member data here...
}
// This function is called after all tests are through
virtual void TearDown() {
// Do some final stuff with the member data here...
}
// Member already defined in OpenMeshBase
//Mesh mesh_;
};
/*
* ====================================================================
* Define tests below
* ====================================================================
*/
/*
*/
TEST_F(OpenMeshMeshDual, Dualize) {
bool ok = OpenMesh::IO::read_mesh(mesh_, "cube1.off");
ASSERT_TRUE(ok);
PolyMesh* dualMesh;
dualMesh = OpenMesh::Util::MeshDual(mesh_);
std::cerr << "Original has " << mesh_.n_vertices() << " , " << mesh_.n_edges() << " , " << mesh_.n_faces() << std::endl;
EXPECT_EQ(15048u, dualMesh->n_vertices()) << "The number of vertices after decimation is not correct!";
EXPECT_EQ(22572u, dualMesh->n_edges()) << "The number of edges after decimation is not correct!";
EXPECT_EQ(7526u, dualMesh->n_faces()) << "The number of faces after decimation is not correct!";
delete(dualMesh);
}
#endif // INCLUDE GUARD
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