2 #include <gtest/gtest.h>
3 #include <Unittests/unittests_common.hh>
14 virtual void SetUp() {
20 virtual void TearDown() {
29 class OpenMeshSubdividerUniform_Triangle :
public OpenMeshBase {
34 virtual void SetUp() {
40 virtual void TearDown() {
57 TEST_F(OpenMeshSubdividerUniform_Triangle, Subdivider_Loop) {
75 std::vector<Mesh::VertexHandle> face_vhandles;
77 face_vhandles.push_back(vhandle[0]);
78 face_vhandles.push_back(vhandle[4]);
79 face_vhandles.push_back(vhandle[3]);
81 mesh_.add_face(face_vhandles);
82 face_vhandles.clear();
84 face_vhandles.push_back(vhandle[0]);
85 face_vhandles.push_back(vhandle[1]);
86 face_vhandles.push_back(vhandle[4]);
88 mesh_.add_face(face_vhandles);
89 face_vhandles.clear();
91 face_vhandles.push_back(vhandle[1]);
92 face_vhandles.push_back(vhandle[2]);
93 face_vhandles.push_back(vhandle[4]);
95 mesh_.add_face(face_vhandles);
96 face_vhandles.clear();
98 face_vhandles.push_back(vhandle[2]);
99 face_vhandles.push_back(vhandle[5]);
100 face_vhandles.push_back(vhandle[4]);
102 mesh_.add_face(face_vhandles);
103 face_vhandles.clear();
105 face_vhandles.push_back(vhandle[3]);
106 face_vhandles.push_back(vhandle[7]);
107 face_vhandles.push_back(vhandle[6]);
109 mesh_.add_face(face_vhandles);
110 face_vhandles.clear();
112 face_vhandles.push_back(vhandle[3]);
113 face_vhandles.push_back(vhandle[4]);
114 face_vhandles.push_back(vhandle[7]);
116 mesh_.add_face(face_vhandles);
117 face_vhandles.clear();
119 face_vhandles.push_back(vhandle[4]);
120 face_vhandles.push_back(vhandle[8]);
121 face_vhandles.push_back(vhandle[7]);
123 mesh_.add_face(face_vhandles);
124 face_vhandles.clear();
126 face_vhandles.push_back(vhandle[4]);
127 face_vhandles.push_back(vhandle[5]);
128 face_vhandles.push_back(vhandle[8]);
130 mesh_.add_face(face_vhandles);
147 EXPECT_EQ(9u, mesh_.n_vertices() ) <<
"Wrong number of vertices";
148 EXPECT_EQ(8u, mesh_.n_faces() ) <<
"Wrong number of faces";
156 EXPECT_EQ(121u, mesh_.n_vertices() ) <<
"Wrong number of vertices after subdivision with sqrt3";
157 EXPECT_EQ(216u, mesh_.n_faces() ) <<
"Wrong number of faces after subdivision with sqrt3";
169 TEST_F(OpenMeshSubdividerUniform_Poly, Subdivider_CatmullClark) {
187 std::vector<Mesh::VertexHandle> face_vhandles;
189 face_vhandles.push_back(vhandle[0]);
190 face_vhandles.push_back(vhandle[1]);
191 face_vhandles.push_back(vhandle[4]);
192 face_vhandles.push_back(vhandle[3]);
194 mesh_.add_face(face_vhandles);
195 face_vhandles.clear();
197 face_vhandles.push_back(vhandle[1]);
198 face_vhandles.push_back(vhandle[2]);
199 face_vhandles.push_back(vhandle[5]);
200 face_vhandles.push_back(vhandle[4]);
202 mesh_.add_face(face_vhandles);
203 face_vhandles.clear();
205 face_vhandles.push_back(vhandle[4]);
206 face_vhandles.push_back(vhandle[5]);
207 face_vhandles.push_back(vhandle[8]);
208 face_vhandles.push_back(vhandle[7]);
210 mesh_.add_face(face_vhandles);
211 face_vhandles.clear();
213 face_vhandles.push_back(vhandle[3]);
214 face_vhandles.push_back(vhandle[4]);
215 face_vhandles.push_back(vhandle[7]);
216 face_vhandles.push_back(vhandle[6]);
218 mesh_.add_face(face_vhandles);
235 EXPECT_EQ(9u, mesh_.n_vertices() ) <<
"Wrong number of vertices";
236 EXPECT_EQ(4u, mesh_.n_faces() ) <<
"Wrong number of faces";
243 EXPECT_EQ(289u, mesh_.n_vertices() ) <<
"Wrong number of vertices after subdivision with catmull clark";
244 EXPECT_EQ(256u, mesh_.n_faces() ) <<
"Wrong number of faces after subdivision with catmull clark";
bool attach(MeshType &_m)
Kernel::Point Point
Coordinate type.
VertexHandle add_vertex(const Point &_p)
Alias for new_vertex(const Point&).
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.