1 #include <gtest/gtest.h> 2 #include <Unittests/unittests_common.hh> 4 #include <OpenMesh/Tools/SmartTagger/SmartTaggerT.hh> 13 virtual void SetUp() {
19 virtual void TearDown() {
36 TEST_F(OpenMeshSmartTagger, SmartTaggerVertices) {
52 std::vector<Mesh::VertexHandle> face_vhandles;
54 face_vhandles.push_back(vhandle[0]);
55 face_vhandles.push_back(vhandle[1]);
56 face_vhandles.push_back(vhandle[2]);
57 mesh_.add_face(face_vhandles);
59 face_vhandles.clear();
61 face_vhandles.push_back(vhandle[1]);
62 face_vhandles.push_back(vhandle[3]);
63 face_vhandles.push_back(vhandle[4]);
64 mesh_.add_face(face_vhandles);
66 face_vhandles.clear();
68 face_vhandles.push_back(vhandle[0]);
69 face_vhandles.push_back(vhandle[3]);
70 face_vhandles.push_back(vhandle[1]);
71 mesh_.add_face(face_vhandles);
73 face_vhandles.clear();
75 face_vhandles.push_back(vhandle[2]);
76 face_vhandles.push_back(vhandle[1]);
77 face_vhandles.push_back(vhandle[4]);
78 mesh_.add_face(face_vhandles);
80 face_vhandles.clear();
82 face_vhandles.push_back(vhandle[5]);
83 face_vhandles.push_back(vhandle[2]);
84 face_vhandles.push_back(vhandle[4]);
85 mesh_.add_face(face_vhandles);
102 EXPECT_FALSE( tagger.is_tagged(vhandle[0] ) ) <<
"Vertex should be untagged after init!";
103 EXPECT_FALSE( tagger.is_tagged(vhandle[1] ) ) <<
"Vertex should be untagged after init!";
104 EXPECT_FALSE( tagger.is_tagged(vhandle[2] ) ) <<
"Vertex should be untagged after init!";
105 EXPECT_FALSE( tagger.is_tagged(vhandle[3] ) ) <<
"Vertex should be untagged after init!";
106 EXPECT_FALSE( tagger.is_tagged(vhandle[4] ) ) <<
"Vertex should be untagged after init!";
107 EXPECT_FALSE( tagger.is_tagged(vhandle[5] ) ) <<
"Vertex should be untagged after init!";
112 EXPECT_FALSE( tagger.is_tagged(vhandle[0] ) ) <<
"Vertex should be untagged after first untag_all!";
113 EXPECT_FALSE( tagger.is_tagged(vhandle[1] ) ) <<
"Vertex should be untagged after first untag_all!";
114 EXPECT_FALSE( tagger.is_tagged(vhandle[2] ) ) <<
"Vertex should be untagged after first untag_all!";
115 EXPECT_FALSE( tagger.is_tagged(vhandle[3] ) ) <<
"Vertex should be untagged after first untag_all!";
116 EXPECT_FALSE( tagger.is_tagged(vhandle[4] ) ) <<
"Vertex should be untagged after first untag_all!";
117 EXPECT_FALSE( tagger.is_tagged(vhandle[5] ) ) <<
"Vertex should be untagged after first untag_all!";
121 tagger.set_tag(vhandle[2]);
122 tagger.set_tag(vhandle[4]);
124 EXPECT_FALSE( tagger.is_tagged(vhandle[0] ) ) <<
"Vertex should be untagged!";
125 EXPECT_FALSE( tagger.is_tagged(vhandle[1] ) ) <<
"Vertex should be untagged!";
126 EXPECT_TRUE( tagger.is_tagged(vhandle[2] ) ) <<
"Vertex should be tagged!";
127 EXPECT_FALSE( tagger.is_tagged(vhandle[3] ) ) <<
"Vertex should be untagged!";
128 EXPECT_TRUE( tagger.is_tagged(vhandle[4] ) ) <<
"Vertex should be tagged!";
129 EXPECT_FALSE( tagger.is_tagged(vhandle[5] ) ) <<
"Vertex should be untagged!";
134 EXPECT_FALSE( tagger.is_tagged(vhandle[0] ) ) <<
"Vertex should be untagged after second untag_all!";
135 EXPECT_FALSE( tagger.is_tagged(vhandle[1] ) ) <<
"Vertex should be untagged after second untag_all!";
136 EXPECT_FALSE( tagger.is_tagged(vhandle[2] ) ) <<
"Vertex should be untagged after second untag_all!";
137 EXPECT_FALSE( tagger.is_tagged(vhandle[3] ) ) <<
"Vertex should be untagged after second untag_all!";
138 EXPECT_FALSE( tagger.is_tagged(vhandle[4] ) ) <<
"Vertex should be untagged after second untag_all!";
139 EXPECT_FALSE( tagger.is_tagged(vhandle[5] ) ) <<
"Vertex should be untagged after second untag_all!";
145 TEST_F(OpenMeshSmartTagger, SmartTaggerFaces) {
161 std::vector<Mesh::VertexHandle> face_vhandles;
163 face_vhandles.push_back(vhandle[0]);
164 face_vhandles.push_back(vhandle[1]);
165 face_vhandles.push_back(vhandle[2]);
166 Mesh::FaceHandle fh1 = mesh_.add_face(face_vhandles);
168 face_vhandles.clear();
170 face_vhandles.push_back(vhandle[1]);
171 face_vhandles.push_back(vhandle[3]);
172 face_vhandles.push_back(vhandle[4]);
173 Mesh::FaceHandle fh2 = mesh_.add_face(face_vhandles);
175 face_vhandles.clear();
177 face_vhandles.push_back(vhandle[0]);
178 face_vhandles.push_back(vhandle[3]);
179 face_vhandles.push_back(vhandle[1]);
180 Mesh::FaceHandle fh3 = mesh_.add_face(face_vhandles);
182 face_vhandles.clear();
184 face_vhandles.push_back(vhandle[2]);
185 face_vhandles.push_back(vhandle[1]);
186 face_vhandles.push_back(vhandle[4]);
187 Mesh::FaceHandle fh4 = mesh_.add_face(face_vhandles);
189 face_vhandles.clear();
191 face_vhandles.push_back(vhandle[5]);
192 face_vhandles.push_back(vhandle[2]);
193 face_vhandles.push_back(vhandle[4]);
194 Mesh::FaceHandle fh5 = mesh_.add_face(face_vhandles);
211 EXPECT_FALSE( tagger.is_tagged( fh1 ) ) <<
"Face should be untagged after init!";
212 EXPECT_FALSE( tagger.is_tagged( fh2 ) ) <<
"Face should be untagged after init!";
213 EXPECT_FALSE( tagger.is_tagged( fh3 ) ) <<
"Face should be untagged after init!";
214 EXPECT_FALSE( tagger.is_tagged( fh4 ) ) <<
"Face should be untagged after init!";
215 EXPECT_FALSE( tagger.is_tagged( fh5 ) ) <<
"Face should be untagged after init!";
221 EXPECT_FALSE( tagger.is_tagged( fh1 ) ) <<
"Face should be untagged after first untag_all!";
222 EXPECT_FALSE( tagger.is_tagged( fh2 ) ) <<
"Face should be untagged after first untag_all!";
223 EXPECT_FALSE( tagger.is_tagged( fh3 ) ) <<
"Face should be untagged after first untag_all!";
224 EXPECT_FALSE( tagger.is_tagged( fh4 ) ) <<
"Face should be untagged after first untag_all!";
225 EXPECT_FALSE( tagger.is_tagged( fh5 ) ) <<
"Face should be untagged after first untag_all!";
234 EXPECT_FALSE( tagger.is_tagged(fh1 ) ) <<
"Face should be untagged!";
235 EXPECT_FALSE( tagger.is_tagged(fh2 ) ) <<
"Face should be untagged!";
236 EXPECT_TRUE( tagger.is_tagged(fh3 ) ) <<
"Face should be tagged!";
237 EXPECT_FALSE( tagger.is_tagged(fh4 ) ) <<
"Face should be tagged!";
238 EXPECT_TRUE( tagger.is_tagged(fh5 ) ) <<
"Face should be tagged!";
244 EXPECT_FALSE( tagger.is_tagged( fh1 ) ) <<
"Face should be untagged after second untag_all!";
245 EXPECT_FALSE( tagger.is_tagged( fh2 ) ) <<
"Face should be untagged after second untag_all!";
246 EXPECT_FALSE( tagger.is_tagged( fh3 ) ) <<
"Face should be untagged after second untag_all!";
247 EXPECT_FALSE( tagger.is_tagged( fh4 ) ) <<
"Face should be untagged after second untag_all!";
248 EXPECT_FALSE( tagger.is_tagged( fh5 ) ) <<
"Face should be untagged after second untag_all!";
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.