OpenMesh
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
unittests_trimesh_circulators.hh
1 #ifndef INCLUDE_UNITTESTS_TRIMESH_CIRCULATORS_HH
2 #define INCLUDE_UNITTESTS_TRIMESH_CIRCULATORS_HH
3 
4 #include <gtest/gtest.h>
5 #include <Unittests/unittests_common.hh>
6 
7 #include <iostream>
8 
10 
11  protected:
12 
13  // This function is called before each test is run
14  virtual void SetUp() {
15  }
16 
17  // This function is called after all tests are through
18  virtual void TearDown() {
19 
20  // Do some final stuff with the member data here...
21  }
22 
23  // Member already defined in OpenMeshBase
24  //Mesh mesh_;
25 };
26 
27 /*
28  * ====================================================================
29  * Define tests below
30  * ====================================================================
31  */
32 
33 
34 /*
35  * Small VertexFaceIterator Test with holes in it
36  *
37  * WARNING!!! Basically this is an illegal configuration!
38  * But this way we can still detect if it breaks!
39  */
40 TEST_F(OpenMeshCirculators, VertexFaceIterWithHoles) {
41 
42  mesh_.clear();
43 
44  // Add some vertices
45  Mesh::VertexHandle vhandle[5];
46 
47  vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0));
48  vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0));
49  vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0));
50  vhandle[3] = mesh_.add_vertex(Mesh::Point(0,-1, 0));
51  vhandle[4] = mesh_.add_vertex(Mesh::Point(2,-1, 0));
52 
53  // Add two faces
54  std::vector<Mesh::VertexHandle> face_vhandles;
55 
56  face_vhandles.push_back(vhandle[0]);
57  face_vhandles.push_back(vhandle[1]);
58  face_vhandles.push_back(vhandle[2]);
59  mesh_.add_face(face_vhandles);
60 
61  face_vhandles.clear();
62 
63  face_vhandles.push_back(vhandle[1]);
64  face_vhandles.push_back(vhandle[3]);
65  face_vhandles.push_back(vhandle[4]);
66  mesh_.add_face(face_vhandles);
67 
68  /* Test setup:
69  0 ==== 2
70  \ /
71  \ /
72  1
73  / \
74  / \
75  3 ==== 4 */
76 
77  // Iterate around vertex 1 at the middle (with holes in between)
78  Mesh::VertexFaceIter vf_it = mesh_.vf_begin(vhandle[1]);
79  Mesh::VertexFaceIter vf_end = mesh_.vf_end(vhandle[1]);
80  EXPECT_EQ(0, vf_it.handle().idx() ) << "Index wrong in VertexFaceIter at initialization";
81  EXPECT_TRUE(vf_it) << "Iterator invalid in VertexFaceIter at initialization";
82  ++vf_it ;
83  EXPECT_EQ(1, vf_it.handle().idx() ) << "Index wrong in VertexFaceIter at step 1";
84  EXPECT_TRUE(vf_it) << "Iterator invalid in VertexFaceIter at step 1";
85  ++vf_it ;
86  EXPECT_EQ(-1, vf_it.handle().idx() ) << "Index wrong in VertexFaceIter at end";
87  EXPECT_FALSE(vf_it) << "Iterator not invalid in VertexFaceIter at end";
88  EXPECT_TRUE( vf_it == vf_end ) << "End iterator for VertexFaceIter not matching";
89 
90  // Iterate around vertex 1 at the middle (with holes in between) with const iterator
91  Mesh::ConstVertexFaceIter cvf_it = mesh_.cvf_begin(vhandle[1]);
92  Mesh::ConstVertexFaceIter cvf_end = mesh_.cvf_end(vhandle[1]);
93  EXPECT_EQ(0, cvf_it.handle().idx() ) << "Index wrong in ConstVertexFaceIter at initialization";
94  EXPECT_TRUE(cvf_it) << "Iterator invalid in ConstVertexFaceIter at initialization";
95  ++cvf_it ;
96  EXPECT_EQ(1, cvf_it.handle().idx() ) << "Index wrong in ConstVertexFaceIter at step one";
97  EXPECT_TRUE(cvf_it) << "Iterator invalid in ConstVertexFaceIter at step one";
98  ++cvf_it ;
99  EXPECT_EQ(-1, cvf_it.handle().idx() ) << "Index wrong in ConstVertexFaceIter at end";
100  EXPECT_FALSE(cvf_it) << "Iterator not invalid in ConstVertexFaceIter at end";
101  EXPECT_TRUE( cvf_it == cvf_end ) << "End iterator for ConstVertexFaceIter not matching";
102 
103 }
104 
105 /*
106  * Small VertexFaceIterator Test without holes in it
107  */
108 TEST_F(OpenMeshCirculators, VertexFaceIterWithoutHoles) {
109 
110  mesh_.clear();
111 
112  // Add some vertices
113  Mesh::VertexHandle vhandle[5];
114 
115  vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0));
116  vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0));
117  vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0));
118  vhandle[3] = mesh_.add_vertex(Mesh::Point(0,-1, 0));
119  vhandle[4] = mesh_.add_vertex(Mesh::Point(2,-1, 0));
120 
121  // Add two faces
122  std::vector<Mesh::VertexHandle> face_vhandles;
123 
124  face_vhandles.push_back(vhandle[0]);
125  face_vhandles.push_back(vhandle[1]);
126  face_vhandles.push_back(vhandle[2]);
127  mesh_.add_face(face_vhandles);
128 
129  face_vhandles.clear();
130 
131  face_vhandles.push_back(vhandle[1]);
132  face_vhandles.push_back(vhandle[3]);
133  face_vhandles.push_back(vhandle[4]);
134  mesh_.add_face(face_vhandles);
135 
136  face_vhandles.clear();
137 
138  face_vhandles.push_back(vhandle[0]);
139  face_vhandles.push_back(vhandle[3]);
140  face_vhandles.push_back(vhandle[1]);
141  mesh_.add_face(face_vhandles);
142 
143  face_vhandles.clear();
144 
145  face_vhandles.push_back(vhandle[2]);
146  face_vhandles.push_back(vhandle[1]);
147  face_vhandles.push_back(vhandle[4]);
148  mesh_.add_face(face_vhandles);
149 
150  /* Test setup:
151  0 ==== 2
152  |\ 0 /|
153  | \ / |
154  |2 1 3|
155  | / \ |
156  |/ 1 \|
157  3 ==== 4 */
158 
159  Mesh::VertexFaceIter vfa_it = mesh_.vf_begin(vhandle[1]);
160 
161  // Iterate around vertex 1 at the middle (with holes in between)
162  Mesh::VertexFaceIter vf_it = mesh_.vf_begin(vhandle[1]);
163  Mesh::VertexFaceIter vf_end = mesh_.vf_end(vhandle[1]);
164  EXPECT_EQ(3, vf_it.handle().idx() ) << "Index wrong in VertexFaceIter at initialization";
165  EXPECT_TRUE(vf_it) << "Iterator invalid in VertexFaceIter at initialization";
166  ++vf_it ;
167  EXPECT_EQ(1, vf_it.handle().idx() ) << "Index wrong in VertexFaceIter at step 1";
168  EXPECT_TRUE(vf_it) << "Iterator invalid in VertexFaceIter at step 1";
169  ++vf_it ;
170  EXPECT_EQ(2, vf_it.handle().idx() ) << "Index wrong in VertexFaceIter at step 2";
171  EXPECT_TRUE(vf_it) << "Iterator invalid in VertexFaceIter at step 2";
172  ++vf_it ;
173  EXPECT_EQ(0, vf_it.handle().idx() ) << "Index wrong in VertexFaceIter at step 3";
174  EXPECT_TRUE(vf_it) << "Iterator invalid in VertexFaceIter at step 3";
175  ++vf_it ;
176  EXPECT_EQ(3, vf_it.handle().idx() ) << "Index wrong in VertexFaceIter at end";
177  EXPECT_FALSE(vf_it) << "Iterator not invalid in VertexFaceIter at end";
178  EXPECT_TRUE( vf_it == vf_end ) << "End iterator for VertexFaceIter not matching";
179 
180  // Iterate around vertex 1 at the middle (with holes in between) with const iterator
181  Mesh::ConstVertexFaceIter cvf_it = mesh_.cvf_begin(vhandle[1]);
182  Mesh::ConstVertexFaceIter cvf_end = mesh_.cvf_end(vhandle[1]);
183  EXPECT_EQ(3, cvf_it.handle().idx() ) << "Index wrong in ConstVertexFaceIter at initialization";
184  EXPECT_TRUE(cvf_it) << "Iterator invalid in ConstVertexFaceIter at initialization";
185  ++cvf_it ;
186  EXPECT_EQ(1, cvf_it.handle().idx() ) << "Index wrong in ConstVertexFaceIter at step 1";
187  EXPECT_TRUE(cvf_it) << "Iterator invalid in ConstVertexFaceIter at step 1";
188  ++cvf_it ;
189  EXPECT_EQ(2, cvf_it.handle().idx() ) << "Index wrong in ConstVertexFaceIter at step 2";
190  EXPECT_TRUE(cvf_it) << "Iterator invalid in ConstVertexFaceIter at step 2";
191  ++cvf_it ;
192  EXPECT_EQ(0, cvf_it.handle().idx() ) << "Index wrong in ConstVertexFaceIter at step 3";
193  EXPECT_TRUE(cvf_it) << "Iterator invalid in ConstVertexFaceIter at step 3";
194  ++cvf_it ;
195  EXPECT_EQ(3, cvf_it.handle().idx() ) << "Index wrong in ConstVertexFaceIter at end";
196  EXPECT_FALSE(cvf_it) << "Iterator not invalid in VertexFaceIter at end";
197  EXPECT_TRUE( cvf_it == cvf_end ) << "End iterator for ConstVertexFaceIter not matching";
198 
199 
200 }
201 
202 /*
203  * Small VertexFaceIterator Test without holes in it
204  */
205 TEST_F(OpenMeshCirculators, VertexOutgoingHalfedgeWithoutHoles) {
206 
207  mesh_.clear();
208 
209  // Add some vertices
210  Mesh::VertexHandle vhandle[5];
211 
212  vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0));
213  vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0));
214  vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0));
215  vhandle[3] = mesh_.add_vertex(Mesh::Point(0,-1, 0));
216  vhandle[4] = mesh_.add_vertex(Mesh::Point(2,-1, 0));
217 
218  // Add two faces
219  std::vector<Mesh::VertexHandle> face_vhandles;
220 
221  face_vhandles.push_back(vhandle[0]);
222  face_vhandles.push_back(vhandle[1]);
223  face_vhandles.push_back(vhandle[2]);
224  mesh_.add_face(face_vhandles);
225 
226  face_vhandles.clear();
227 
228  face_vhandles.push_back(vhandle[1]);
229  face_vhandles.push_back(vhandle[3]);
230  face_vhandles.push_back(vhandle[4]);
231  mesh_.add_face(face_vhandles);
232 
233  face_vhandles.clear();
234 
235  face_vhandles.push_back(vhandle[0]);
236  face_vhandles.push_back(vhandle[3]);
237  face_vhandles.push_back(vhandle[1]);
238  mesh_.add_face(face_vhandles);
239 
240  face_vhandles.clear();
241 
242  face_vhandles.push_back(vhandle[2]);
243  face_vhandles.push_back(vhandle[1]);
244  face_vhandles.push_back(vhandle[4]);
245  mesh_.add_face(face_vhandles);
246 
247  /* Test setup:
248  0 ==== 2
249  |\ 0 /|
250  | \ / |
251  |2 1 3|
252  | / \ |
253  |/ 1 \|
254  3 ==== 4 */
255 
256 
257  // Iterate around vertex 1 at the middle (with holes in between)
258  Mesh::VertexOHalfedgeIter voh_it = mesh_.voh_begin(vhandle[1]);
259  Mesh::VertexOHalfedgeIter voh_end = mesh_.voh_end(vhandle[1]);
260 
261  EXPECT_EQ(11, voh_it.handle().idx() ) << "Index wrong in VertexOHalfedgeIter begin at initialization";
262  EXPECT_EQ(11, voh_end.handle().idx() ) << "Index wrong in VertexOHalfedgeIter end at initialization";
263  EXPECT_EQ(3, mesh_.face_handle(voh_it.handle()).idx() ) << "Corresponding face Index wrong in VertexOHalfedgeIter begin at initialization";
264  EXPECT_TRUE(voh_it) << "Iterator invalid in VertexOHalfedgeIter at initialization";
265 
266  ++voh_it ;
267 
268  EXPECT_EQ(6, voh_it.handle().idx() ) << "Index wrong in VertexOHalfedgeIter step 1";
269  EXPECT_EQ(1, mesh_.face_handle(voh_it.handle()).idx() ) << "Corresponding face Index wrong in VertexOHalfedgeIter step 1";
270  EXPECT_TRUE(voh_it) << "Iterator invalid in VertexOHalfedgeIter at step 1";
271 
272  ++voh_it ;
273 
274  EXPECT_EQ(1, voh_it.handle().idx() ) << "Index wrong in VertexOHalfedgeIter step 2";
275  EXPECT_EQ(2, mesh_.face_handle(voh_it.handle()).idx() ) << "Corresponding face Index wrong in VertexOHalfedgeIter step 2";
276  EXPECT_TRUE(voh_it) << "Iterator invalid in VertexOHalfedgeIter at step 2";
277 
278  ++voh_it ;
279 
280  EXPECT_EQ(2, voh_it.handle().idx() ) << "Index wrong in VertexOHalfedgeIter step 3";
281  EXPECT_EQ(0, mesh_.face_handle(voh_it.handle()).idx() ) << "Corresponding face Index wrong in VertexOHalfedgeIter step 3";
282  EXPECT_TRUE(voh_it) << "Iterator invalid in VertexOHalfedgeIter at step 3";
283 
284  ++voh_it ;
285 
286  EXPECT_EQ(11, voh_it.handle().idx() ) << "Index wrong in VertexOHalfedgeIter step 4";
287  EXPECT_EQ(3, mesh_.face_handle(voh_it.handle()).idx() ) << "Corresponding face Index wrong in VertexOHalfedgeIter step 4";
288  EXPECT_FALSE(voh_it) << "Iterator still valid in VertexOHalfedgeIter at step 4";
289  EXPECT_TRUE( voh_it == voh_end ) << "Miss matched end iterator";
290 
291  ++voh_it ;
292 
293  EXPECT_EQ(6, voh_it.handle().idx() ) << "Index wrong in VertexOHalfedgeIter step 5";
294  EXPECT_EQ(1, mesh_.face_handle(voh_it.handle()).idx() ) << "Corresponding face Index wrong in VertexOHalfedgeIter step 5";
295  //EXPECT_FALSE(voh_it) << "Iterator still valid in VertexOHalfedgeIter at step 5";
296 
297 
298 
299  // Iterate around vertex 1 at the middle (with holes in between)
300  Mesh::ConstVertexOHalfedgeIter cvoh_it = mesh_.cvoh_begin(vhandle[1]);
301  Mesh::ConstVertexOHalfedgeIter cvoh_end = mesh_.cvoh_end(vhandle[1]);
302 
303  EXPECT_EQ(11, cvoh_it.handle().idx() ) << "Index wrong in ConstVertexOHalfedgeIter begin at initialization";
304  EXPECT_EQ(11, cvoh_end.handle().idx() ) << "Index wrong in ConstVertexOHalfedgeIter end at initialization";
305  EXPECT_EQ(3, mesh_.face_handle(cvoh_it.handle()).idx() ) << "Corresponding face Index wrong in ConstVertexOHalfedgeIter begin at initialization";
306  EXPECT_TRUE(cvoh_it) << "Iterator invalid in ConstVertexOHalfedgeIter at initialization";
307 
308  ++cvoh_it ;
309 
310  EXPECT_EQ(6, cvoh_it.handle().idx() ) << "Index wrong in ConstVertexOHalfedgeIter step 1";
311  EXPECT_EQ(1, mesh_.face_handle(cvoh_it.handle()).idx() ) << "Corresponding face Index wrong in ConstVertexOHalfedgeIter step 1";
312  EXPECT_TRUE(cvoh_it) << "Iterator invalid in ConstVertexOHalfedgeIter at step 1";
313 
314  ++cvoh_it ;
315 
316  EXPECT_EQ(1, cvoh_it.handle().idx() ) << "Index wrong in ConstVertexOHalfedgeIter step 2";
317  EXPECT_EQ(2, mesh_.face_handle(cvoh_it.handle()).idx() ) << "Corresponding face Index wrong in ConstVertexOHalfedgeIter step 2";
318  EXPECT_TRUE(cvoh_it) << "Iterator invalid in ConstVertexOHalfedgeIter at step 2";
319 
320  ++cvoh_it ;
321 
322  EXPECT_EQ(2, cvoh_it.handle().idx() ) << "Index wrong in ConstVertexOHalfedgeIter step 3";
323  EXPECT_EQ(0, mesh_.face_handle(cvoh_it.handle()).idx() ) << "Corresponding face Index wrong in ConstVertexOHalfedgeIter step 3";
324  EXPECT_TRUE(cvoh_it) << "Iterator invalid in ConstVertexOHalfedgeIter at step 3";
325 
326  ++cvoh_it ;
327 
328  EXPECT_EQ(11, cvoh_it.handle().idx() ) << "Index wrong in ConstVertexOHalfedgeIter step 4";
329  EXPECT_EQ(3, mesh_.face_handle(cvoh_it.handle()).idx() ) << "Corresponding face Index wrong in ConstVertexOHalfedgeIter step 4";
330  EXPECT_FALSE(cvoh_it) << "Iterator still valid in ConstVertexOHalfedgeIter at step 4";
331  EXPECT_TRUE( cvoh_it == cvoh_end ) << "Miss matched end iterator";
332 
333  ++cvoh_it ;
334 
335  EXPECT_EQ(6, cvoh_it.handle().idx() ) << "Index wrong in ConstVertexOHalfedgeIter step 5";
336  EXPECT_EQ(1, mesh_.face_handle(cvoh_it.handle()).idx() ) << "Corresponding face Index wrong in ConstVertexOHalfedgeIter step 5";
337  //EXPECT_FALSE(cvoh_it) << "Iterator still valid in ConstVertexOHalfedgeIter at step 5";
338 
339 
340 }
341 
342 /*
343  * Small FaceFaceIterator Test with holes in it
344  */
345 TEST_F(OpenMeshCirculators, FaceFaceIterWithHoles) {
346 
347  mesh_.clear();
348 
349  // Add some vertices
350  Mesh::VertexHandle vhandle[5];
351 
352  vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0));
353  vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0));
354  vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0));
355  vhandle[3] = mesh_.add_vertex(Mesh::Point(3, 0, 0));
356  vhandle[4] = mesh_.add_vertex(Mesh::Point(4, 1, 0));
357 
358  // Add three faces
359  std::vector<Mesh::VertexHandle> face_vhandles;
360 
361  face_vhandles.push_back(vhandle[0]);
362  face_vhandles.push_back(vhandle[1]);
363  face_vhandles.push_back(vhandle[2]);
364  mesh_.add_face(face_vhandles);
365 
366  face_vhandles.clear();
367 
368  face_vhandles.push_back(vhandle[2]);
369  face_vhandles.push_back(vhandle[1]);
370  face_vhandles.push_back(vhandle[3]);
371  mesh_.add_face(face_vhandles);
372 
373  face_vhandles.clear();
374 
375  face_vhandles.push_back(vhandle[2]);
376  face_vhandles.push_back(vhandle[3]);
377  face_vhandles.push_back(vhandle[4]);
378  mesh_.add_face(face_vhandles);
379 
380  /* Test setup:
381  *
382  * 0 ------ 2 ------ 4
383  * \ / \ /
384  * \ 0 / \ 2 /
385  * \ / 1 \ /
386  * 1 ------- 3
387  */
388 
389 
390  Mesh::FaceFaceIter ff_it = mesh_.ff_begin(mesh_.face_handle(1));
391  Mesh::FaceFaceIter ff_end = mesh_.ff_end(mesh_.face_handle(1));
392 
393  EXPECT_EQ(2, ff_it.handle().idx() ) << "Index wrong in FaceFaceIter at initialization";
394  EXPECT_TRUE(ff_it) << "Iterator invalid in FaceFaceIter at initialization";
395  ++ff_it;
396  EXPECT_EQ(0, ff_it.handle().idx() ) << "Index wrong in FaceFaceIter at step 1";
397  EXPECT_TRUE(ff_it) << "Iterator invalid in FaceFaceIter at step 1";
398  ++ff_it;
399  EXPECT_EQ(2, ff_it.handle().idx() ) << "Index wrong in FaceFaceIter at end";
400  EXPECT_FALSE(ff_it) << "Iterator invalid in FaceFaceIter at end";
401  EXPECT_TRUE( ff_it == ff_end ) << "End iterator for FaceFaceIter not matching";
402 
403  Mesh::ConstFaceFaceIter cff_it = mesh_.cff_begin(mesh_.face_handle(1));
404  Mesh::ConstFaceFaceIter cff_end = mesh_.cff_end(mesh_.face_handle(1));
405 
406  EXPECT_EQ(2, cff_it.handle().idx() ) << "Index wrong in ConstFaceFaceIter at initialization";
407  EXPECT_TRUE(cff_it) << "Iterator invalid in ConstFaceFaceIter at initialization";
408  ++cff_it;
409  EXPECT_EQ(0, cff_it.handle().idx() ) << "Index wrong in ConstFaceFaceIter at step 1";
410  EXPECT_TRUE(cff_it) << "Iterator invalid in ConstFaceFaceIter at step 1";
411  ++cff_it;
412  EXPECT_EQ(2, cff_it.handle().idx() ) << "Index wrong in ConstFaceFaceIter at end";
413  EXPECT_FALSE(cff_it) << "Iterator invalid in ConstFaceFaceIter at end";
414  EXPECT_TRUE( cff_it == cff_end ) << "End iterator for ConstFaceFaceIter not matching";
415 
416 }
417 
418 /*
419  * Small FaceFaceIterator Test with holes in it
420  */
421 TEST_F(OpenMeshCirculators, FaceFaceIterWithoutHoles) {
422 
423  mesh_.clear();
424 
425  // Add some vertices
426  Mesh::VertexHandle vhandle[6];
427 
428  vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0));
429  vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0));
430  vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0));
431  vhandle[3] = mesh_.add_vertex(Mesh::Point(3, 0, 0));
432  vhandle[4] = mesh_.add_vertex(Mesh::Point(4, 1, 0));
433  vhandle[5] = mesh_.add_vertex(Mesh::Point(2,-1, 0));
434 
435  // Add three faces
436  std::vector<Mesh::VertexHandle> face_vhandles;
437 
438  face_vhandles.push_back(vhandle[0]);
439  face_vhandles.push_back(vhandle[1]);
440  face_vhandles.push_back(vhandle[2]);
441  mesh_.add_face(face_vhandles);
442 
443  face_vhandles.clear();
444 
445  face_vhandles.push_back(vhandle[2]);
446  face_vhandles.push_back(vhandle[1]);
447  face_vhandles.push_back(vhandle[3]);
448  mesh_.add_face(face_vhandles);
449 
450  face_vhandles.clear();
451 
452  face_vhandles.push_back(vhandle[2]);
453  face_vhandles.push_back(vhandle[3]);
454  face_vhandles.push_back(vhandle[4]);
455  mesh_.add_face(face_vhandles);
456 
457  face_vhandles.clear();
458 
459  face_vhandles.push_back(vhandle[1]);
460  face_vhandles.push_back(vhandle[5]);
461  face_vhandles.push_back(vhandle[3]);
462  mesh_.add_face(face_vhandles);
463 
464  /* Test setup:
465  *
466  * 0 ------ 2 ------ 4
467  * \ / \ /
468  * \ 0 / \ 2 /
469  * \ / 1 \ /
470  * 1 ------- 3
471  * \ /
472  * \ 3 /
473  * \ /
474  * \ /
475  * 5
476  */
477 
478 
479  Mesh::FaceFaceIter ff_it = mesh_.ff_begin(mesh_.face_handle(1));
480  Mesh::FaceFaceIter ff_end = mesh_.ff_end(mesh_.face_handle(1));
481 
482  EXPECT_EQ(2, ff_it.handle().idx() ) << "Index wrong in FaceFaceIter at initialization";
483  EXPECT_TRUE(ff_it) << "Iterator invalid in FaceFaceIter at initialization";
484  ++ff_it;
485  EXPECT_EQ(0, ff_it.handle().idx() ) << "Index wrong in FaceFaceIter at step 1";
486  EXPECT_TRUE(ff_it) << "Iterator invalid in FaceFaceIter at step 1";
487  ++ff_it;
488  EXPECT_EQ(3, ff_it.handle().idx() ) << "Index wrong in FaceFaceIter at step 2";
489  EXPECT_TRUE(ff_it) << "Iterator invalid in FaceFaceIter at step 2";
490  ++ff_it;
491  EXPECT_EQ(2, ff_it.handle().idx() ) << "Index wrong in FaceFaceIter at end";
492  EXPECT_FALSE(ff_it) << "Iterator invalid in FaceFaceIter at end";
493  EXPECT_TRUE( ff_it == ff_end ) << "End iterator for FaceFaceIter not matching";
494 
495  Mesh::ConstFaceFaceIter cff_it = mesh_.cff_begin(mesh_.face_handle(1));
496  Mesh::ConstFaceFaceIter cff_end = mesh_.cff_end(mesh_.face_handle(1));
497 
498  EXPECT_EQ(2, cff_it.handle().idx() ) << "Index wrong in ConstFaceFaceIter at initialization";
499  EXPECT_TRUE(cff_it) << "Iterator invalid in ConstFaceFaceIter at initialization";
500  ++cff_it;
501  EXPECT_EQ(0, cff_it.handle().idx() ) << "Index wrong in ConstFaceFaceIter at step 1";
502  EXPECT_TRUE(cff_it) << "Iterator invalid in ConstFaceFaceIter at step 1";
503  ++cff_it;
504  EXPECT_EQ(3, cff_it.handle().idx() ) << "Index wrong in ConstFaceFaceIter at step 2";
505  EXPECT_TRUE(cff_it) << "Iterator invalid in ConstFaceFaceIter at step 2";
506  ++cff_it;
507  EXPECT_EQ(2, cff_it.handle().idx() ) << "Index wrong in ConstFaceFaceIter at end";
508  EXPECT_FALSE(cff_it) << "Iterator invalid in ConstFaceFaceIter at end";
509  EXPECT_TRUE( cff_it == cff_end ) << "End iterator for ConstFaceFaceIter not matching";
510 
511 }
512 
513 
514 
515 
516 
517 #endif // INCLUDE GUARD

acg pic Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .