remove TriMesh test case for Midpoint subdivision
This commit is contained in:
@@ -8,18 +8,14 @@
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class OpenMeshSubdividerUniform_Poly : public OpenMeshBasePoly {
|
class OpenMeshSubdividerUniform_Poly : public OpenMeshBasePoly {
|
||||||
|
protected:
|
||||||
protected:
|
|
||||||
|
|
||||||
// This function is called before each test is run
|
// This function is called before each test is run
|
||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
|
|
||||||
// Do some initial stuff with the member data here...
|
// Do some initial stuff with the member data here...
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function is called after all tests are through
|
// This function is called after all tests are through
|
||||||
virtual void TearDown() {
|
virtual void TearDown() {
|
||||||
|
|
||||||
// Do some final stuff with the member data here...
|
// Do some final stuff with the member data here...
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,18 +24,14 @@ class OpenMeshSubdividerUniform_Poly : public OpenMeshBasePoly {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class OpenMeshSubdividerUniform_Triangle : public OpenMeshBase {
|
class OpenMeshSubdividerUniform_Triangle : public OpenMeshBase {
|
||||||
|
protected:
|
||||||
protected:
|
|
||||||
|
|
||||||
// This function is called before each test is run
|
// This function is called before each test is run
|
||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
|
|
||||||
// Do some initial stuff with the member data here...
|
// Do some initial stuff with the member data here...
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function is called after all tests are through
|
// This function is called after all tests are through
|
||||||
virtual void TearDown() {
|
virtual void TearDown() {
|
||||||
|
|
||||||
// Do some final stuff with the member data here...
|
// Do some final stuff with the member data here...
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,10 +45,7 @@ class OpenMeshSubdividerUniform_Triangle : public OpenMeshBase {
|
|||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
TEST_F(OpenMeshSubdividerUniform_Triangle, Subdivider_Sqrt3) {
|
||||||
*/
|
|
||||||
TEST_F(OpenMeshSubdividerUniform_Triangle, Subdivider_Loop) {
|
|
||||||
|
|
||||||
mesh_.clear();
|
mesh_.clear();
|
||||||
|
|
||||||
// Add some vertices
|
// Add some vertices
|
||||||
@@ -156,7 +145,6 @@ TEST_F(OpenMeshSubdividerUniform_Triangle, Subdivider_Loop) {
|
|||||||
// Check setup
|
// Check setup
|
||||||
EXPECT_EQ(121u, mesh_.n_vertices() ) << "Wrong number of vertices after subdivision with sqrt3";
|
EXPECT_EQ(121u, mesh_.n_vertices() ) << "Wrong number of vertices after subdivision with sqrt3";
|
||||||
EXPECT_EQ(216u, mesh_.n_faces() ) << "Wrong number of faces after subdivision with sqrt3";
|
EXPECT_EQ(216u, mesh_.n_faces() ) << "Wrong number of faces after subdivision with sqrt3";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -168,7 +156,6 @@ TEST_F(OpenMeshSubdividerUniform_Triangle, Subdivider_Loop) {
|
|||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
TEST_F(OpenMeshSubdividerUniform_Poly, Subdivider_CatmullClark) {
|
TEST_F(OpenMeshSubdividerUniform_Poly, Subdivider_CatmullClark) {
|
||||||
|
|
||||||
mesh_.clear();
|
mesh_.clear();
|
||||||
|
|
||||||
// Add some vertices
|
// Add some vertices
|
||||||
@@ -243,153 +230,11 @@ TEST_F(OpenMeshSubdividerUniform_Poly, Subdivider_CatmullClark) {
|
|||||||
|
|
||||||
EXPECT_EQ(289u, mesh_.n_vertices() ) << "Wrong number of vertices after subdivision with catmull clark";
|
EXPECT_EQ(289u, mesh_.n_vertices() ) << "Wrong number of vertices after subdivision with catmull clark";
|
||||||
EXPECT_EQ(256u, mesh_.n_faces() ) << "Wrong number of faces after subdivision with catmull clark";
|
EXPECT_EQ(256u, mesh_.n_faces() ) << "Wrong number of faces after subdivision with catmull clark";
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Adds a cube to a trimesh
|
|
||||||
*/
|
|
||||||
TEST_F(OpenMeshSubdividerUniform_Triangle,Midpoint) {
|
|
||||||
|
|
||||||
mesh_.clear();
|
|
||||||
|
|
||||||
// Add some vertices
|
|
||||||
Mesh::VertexHandle vhandle[8];
|
|
||||||
vhandle[0] = mesh_.add_vertex(Mesh::Point(-1, -1, 1));
|
|
||||||
vhandle[1] = mesh_.add_vertex(Mesh::Point( 1, -1, 1));
|
|
||||||
vhandle[2] = mesh_.add_vertex(Mesh::Point( 1, 1, 1));
|
|
||||||
vhandle[3] = mesh_.add_vertex(Mesh::Point(-1, 1, 1));
|
|
||||||
vhandle[4] = mesh_.add_vertex(Mesh::Point(-1, -1, -1));
|
|
||||||
vhandle[5] = mesh_.add_vertex(Mesh::Point( 1, -1, -1));
|
|
||||||
vhandle[6] = mesh_.add_vertex(Mesh::Point( 1, 1, -1));
|
|
||||||
vhandle[7] = mesh_.add_vertex(Mesh::Point(-1, 1, -1));
|
|
||||||
|
|
||||||
// Add six faces to form a cube
|
|
||||||
std::vector<Mesh::VertexHandle> face_vhandles;
|
|
||||||
|
|
||||||
face_vhandles.clear();
|
|
||||||
face_vhandles.push_back(vhandle[0]);
|
|
||||||
face_vhandles.push_back(vhandle[1]);
|
|
||||||
face_vhandles.push_back(vhandle[3]);
|
|
||||||
mesh_.add_face(face_vhandles);
|
|
||||||
|
|
||||||
face_vhandles.clear();
|
|
||||||
face_vhandles.push_back(vhandle[1]);
|
|
||||||
face_vhandles.push_back(vhandle[2]);
|
|
||||||
face_vhandles.push_back(vhandle[3]);
|
|
||||||
mesh_.add_face(face_vhandles);
|
|
||||||
|
|
||||||
//=======================
|
|
||||||
|
|
||||||
face_vhandles.clear();
|
|
||||||
face_vhandles.push_back(vhandle[7]);
|
|
||||||
face_vhandles.push_back(vhandle[6]);
|
|
||||||
face_vhandles.push_back(vhandle[5]);
|
|
||||||
mesh_.add_face(face_vhandles);
|
|
||||||
|
|
||||||
face_vhandles.clear();
|
|
||||||
face_vhandles.push_back(vhandle[7]);
|
|
||||||
face_vhandles.push_back(vhandle[5]);
|
|
||||||
face_vhandles.push_back(vhandle[4]);
|
|
||||||
mesh_.add_face(face_vhandles);
|
|
||||||
|
|
||||||
//=======================
|
|
||||||
|
|
||||||
face_vhandles.clear();
|
|
||||||
face_vhandles.push_back(vhandle[1]);
|
|
||||||
face_vhandles.push_back(vhandle[0]);
|
|
||||||
face_vhandles.push_back(vhandle[4]);
|
|
||||||
mesh_.add_face(face_vhandles);
|
|
||||||
|
|
||||||
face_vhandles.clear();
|
|
||||||
face_vhandles.push_back(vhandle[1]);
|
|
||||||
face_vhandles.push_back(vhandle[4]);
|
|
||||||
face_vhandles.push_back(vhandle[5]);
|
|
||||||
mesh_.add_face(face_vhandles);
|
|
||||||
|
|
||||||
//=======================
|
|
||||||
|
|
||||||
face_vhandles.clear();
|
|
||||||
face_vhandles.push_back(vhandle[2]);
|
|
||||||
face_vhandles.push_back(vhandle[1]);
|
|
||||||
face_vhandles.push_back(vhandle[5]);
|
|
||||||
mesh_.add_face(face_vhandles);
|
|
||||||
|
|
||||||
face_vhandles.clear();
|
|
||||||
face_vhandles.push_back(vhandle[2]);
|
|
||||||
face_vhandles.push_back(vhandle[5]);
|
|
||||||
face_vhandles.push_back(vhandle[6]);
|
|
||||||
mesh_.add_face(face_vhandles);
|
|
||||||
|
|
||||||
|
|
||||||
//=======================
|
|
||||||
|
|
||||||
face_vhandles.clear();
|
|
||||||
face_vhandles.push_back(vhandle[3]);
|
|
||||||
face_vhandles.push_back(vhandle[2]);
|
|
||||||
face_vhandles.push_back(vhandle[6]);
|
|
||||||
mesh_.add_face(face_vhandles);
|
|
||||||
|
|
||||||
face_vhandles.clear();
|
|
||||||
face_vhandles.push_back(vhandle[3]);
|
|
||||||
face_vhandles.push_back(vhandle[6]);
|
|
||||||
face_vhandles.push_back(vhandle[7]);
|
|
||||||
mesh_.add_face(face_vhandles);
|
|
||||||
|
|
||||||
//=======================
|
|
||||||
|
|
||||||
face_vhandles.clear();
|
|
||||||
face_vhandles.push_back(vhandle[0]);
|
|
||||||
face_vhandles.push_back(vhandle[3]);
|
|
||||||
face_vhandles.push_back(vhandle[7]);
|
|
||||||
mesh_.add_face(face_vhandles);
|
|
||||||
|
|
||||||
face_vhandles.clear();
|
|
||||||
face_vhandles.push_back(vhandle[0]);
|
|
||||||
face_vhandles.push_back(vhandle[7]);
|
|
||||||
face_vhandles.push_back(vhandle[4]);
|
|
||||||
mesh_.add_face(face_vhandles);
|
|
||||||
|
|
||||||
|
|
||||||
// Test setup:
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// 3 ======== 2
|
|
||||||
// / /|
|
|
||||||
// / / | z
|
|
||||||
// 0 ======== 1 | |
|
|
||||||
// | | | | y
|
|
||||||
// | 7 | 6 | /
|
|
||||||
// | | / | /
|
|
||||||
// | |/ |/
|
|
||||||
// 4 ======== 5 -------> x
|
|
||||||
//
|
|
||||||
|
|
||||||
// Check setup
|
|
||||||
EXPECT_EQ(18u, mesh_.n_edges() ) << "Wrong number of Edges";
|
|
||||||
EXPECT_EQ(36u, mesh_.n_halfedges() ) << "Wrong number of HalfEdges";
|
|
||||||
EXPECT_EQ(8u, mesh_.n_vertices() ) << "Wrong number of vertices";
|
|
||||||
EXPECT_EQ(12u, mesh_.n_faces() ) << "Wrong number of faces";
|
|
||||||
|
|
||||||
// Initialize subdivider
|
|
||||||
OpenMesh::Subdivider::Uniform::MidpointT<Mesh> midpoint;
|
|
||||||
|
|
||||||
// Execute 2 subdivision steps
|
|
||||||
midpoint.attach(mesh_);
|
|
||||||
midpoint( 2 );
|
|
||||||
midpoint.detach();
|
|
||||||
|
|
||||||
// Check Result
|
|
||||||
EXPECT_EQ(18u, mesh_.n_edges() ) << "Wrong number of Edges";
|
|
||||||
EXPECT_EQ(36u, mesh_.n_halfedges() ) << "Wrong number of HalfEdges";
|
|
||||||
EXPECT_EQ(8u, mesh_.n_vertices() ) << "Wrong number of vertices";
|
|
||||||
EXPECT_EQ(12u, mesh_.n_faces() ) << "Wrong number of faces";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Adds a cube to a polymesh
|
/* Adds a cube to a polymesh
|
||||||
*/
|
*/
|
||||||
TEST_F(OpenMeshSubdividerUniform_Poly, Midpoint) {
|
TEST_F(OpenMeshSubdividerUniform_Poly, Midpoint) {
|
||||||
|
|
||||||
mesh_.clear();
|
mesh_.clear();
|
||||||
|
|
||||||
// Add some vertices
|
// Add some vertices
|
||||||
@@ -464,27 +309,24 @@ TEST_F(OpenMeshSubdividerUniform_Poly, Midpoint) {
|
|||||||
//
|
//
|
||||||
|
|
||||||
// Check setup
|
// Check setup
|
||||||
EXPECT_EQ(12u, mesh_.n_edges() ) << "Wrong number of Edges";
|
EXPECT_EQ(12u, mesh_.n_edges()) << "Wrong number of Edges";
|
||||||
EXPECT_EQ(24u, mesh_.n_halfedges() ) << "Wrong number of HalfEdges";
|
EXPECT_EQ(24u, mesh_.n_halfedges()) << "Wrong number of HalfEdges";
|
||||||
EXPECT_EQ(8u, mesh_.n_vertices() ) << "Wrong number of vertices";
|
EXPECT_EQ(8u, mesh_.n_vertices()) << "Wrong number of vertices";
|
||||||
EXPECT_EQ(6u, mesh_.n_faces() ) << "Wrong number of faces";
|
EXPECT_EQ(6u, mesh_.n_faces()) << "Wrong number of faces";
|
||||||
|
|
||||||
// Initialize subdivider
|
// Initialize subdivider
|
||||||
OpenMesh::Subdivider::Uniform::MidpointT<PolyMesh> midpoint;
|
OpenMesh::Subdivider::Uniform::MidpointT<PolyMesh> midpoint;
|
||||||
|
|
||||||
// Execute 2 subdivision steps
|
// Execute 2 subdivision steps
|
||||||
midpoint.attach(mesh_);
|
midpoint.attach(mesh_);
|
||||||
midpoint( 2 );
|
midpoint(2);
|
||||||
midpoint.detach();
|
midpoint.detach();
|
||||||
|
|
||||||
// Check Result
|
// Check Result
|
||||||
EXPECT_EQ(18u, mesh_.n_edges() ) << "Wrong number of Edges";
|
EXPECT_EQ(48u, mesh_.n_edges()) << "Wrong number of Edges";
|
||||||
EXPECT_EQ(36u, mesh_.n_halfedges() ) << "Wrong number of HalfEdges";
|
EXPECT_EQ(96u, mesh_.n_halfedges()) << "Wrong number of HalfEdges";
|
||||||
EXPECT_EQ(8u, mesh_.n_vertices() ) << "Wrong number of vertices";
|
EXPECT_EQ(24u, mesh_.n_vertices()) << "Wrong number of vertices";
|
||||||
EXPECT_EQ(12u, mesh_.n_faces() ) << "Wrong number of faces";
|
EXPECT_EQ(26u, mesh_.n_faces()) << "Wrong number of faces";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user