Developer Documentation
Loading...
Searching...
No Matches
unittests_smart_handles.cc
1#include <gtest/gtest.h>
2#include <Unittests/unittests_common.hh>
3
4#include <OpenMesh/Core/Mesh/PolyConnectivity.hh>
5
6#include <iostream>
7#include <chrono>
8
9namespace {
10
11class OpenMeshSmartHandles : public OpenMeshBase {
12
13protected:
14
15 // This function is called before each test is run
16 virtual void SetUp() {
17
18 mesh_.clear();
19
20 // Add some vertices
21 Mesh::VertexHandle vhandle[8];
22 vhandle[0] = mesh_.add_vertex(Mesh::Point(-1, -1, 1));
23 vhandle[1] = mesh_.add_vertex(Mesh::Point( 1, -1, 1));
24 vhandle[2] = mesh_.add_vertex(Mesh::Point( 1, 1, 1));
25 vhandle[3] = mesh_.add_vertex(Mesh::Point(-1, 1, 1));
26 vhandle[4] = mesh_.add_vertex(Mesh::Point(-1, -1, -1));
27 vhandle[5] = mesh_.add_vertex(Mesh::Point( 1, -1, -1));
28 vhandle[6] = mesh_.add_vertex(Mesh::Point( 1, 1, -1));
29 vhandle[7] = mesh_.add_vertex(Mesh::Point(-1, 1, -1));
30
31 // Add six faces to form a cube
32 std::vector<Mesh::VertexHandle> face_vhandles;
33
34 face_vhandles.clear();
35 face_vhandles.push_back(vhandle[0]);
36 face_vhandles.push_back(vhandle[1]);
37 face_vhandles.push_back(vhandle[3]);
38 mesh_.add_face(face_vhandles);
39
40 face_vhandles.clear();
41 face_vhandles.push_back(vhandle[1]);
42 face_vhandles.push_back(vhandle[2]);
43 face_vhandles.push_back(vhandle[3]);
44 mesh_.add_face(face_vhandles);
45
46 //=======================
47
48 face_vhandles.clear();
49 face_vhandles.push_back(vhandle[7]);
50 face_vhandles.push_back(vhandle[6]);
51 face_vhandles.push_back(vhandle[5]);
52 mesh_.add_face(face_vhandles);
53
54 face_vhandles.clear();
55 face_vhandles.push_back(vhandle[7]);
56 face_vhandles.push_back(vhandle[5]);
57 face_vhandles.push_back(vhandle[4]);
58 mesh_.add_face(face_vhandles);
59
60 //=======================
61
62 face_vhandles.clear();
63 face_vhandles.push_back(vhandle[1]);
64 face_vhandles.push_back(vhandle[0]);
65 face_vhandles.push_back(vhandle[4]);
66 mesh_.add_face(face_vhandles);
67
68 face_vhandles.clear();
69 face_vhandles.push_back(vhandle[1]);
70 face_vhandles.push_back(vhandle[4]);
71 face_vhandles.push_back(vhandle[5]);
72 mesh_.add_face(face_vhandles);
73
74 //=======================
75
76 face_vhandles.clear();
77 face_vhandles.push_back(vhandle[2]);
78 face_vhandles.push_back(vhandle[1]);
79 face_vhandles.push_back(vhandle[5]);
80 mesh_.add_face(face_vhandles);
81
82 face_vhandles.clear();
83 face_vhandles.push_back(vhandle[2]);
84 face_vhandles.push_back(vhandle[5]);
85 face_vhandles.push_back(vhandle[6]);
86 mesh_.add_face(face_vhandles);
87
88
89 //=======================
90
91 face_vhandles.clear();
92 face_vhandles.push_back(vhandle[3]);
93 face_vhandles.push_back(vhandle[2]);
94 face_vhandles.push_back(vhandle[6]);
95 mesh_.add_face(face_vhandles);
96
97 face_vhandles.clear();
98 face_vhandles.push_back(vhandle[3]);
99 face_vhandles.push_back(vhandle[6]);
100 face_vhandles.push_back(vhandle[7]);
101 mesh_.add_face(face_vhandles);
102
103 //=======================
104
105 face_vhandles.clear();
106 face_vhandles.push_back(vhandle[0]);
107 face_vhandles.push_back(vhandle[3]);
108 face_vhandles.push_back(vhandle[7]);
109 mesh_.add_face(face_vhandles);
110
111 face_vhandles.clear();
112 face_vhandles.push_back(vhandle[0]);
113 face_vhandles.push_back(vhandle[7]);
114 face_vhandles.push_back(vhandle[4]);
115 mesh_.add_face(face_vhandles);
116
117
118 // Test setup:
119 //
120 //
121 // 3 ======== 2
122 // / /|
123 // / / | z
124 // 0 ======== 1 | |
125 // | | | | y
126 // | 7 | 6 | /
127 // | | / | /
128 // | |/ |/
129 // 4 ======== 5 -------> x
130 //
131
132 // Check setup
133 EXPECT_EQ(18u, mesh_.n_edges() ) << "Wrong number of Edges";
134 EXPECT_EQ(36u, mesh_.n_halfedges() ) << "Wrong number of HalfEdges";
135 EXPECT_EQ(8u, mesh_.n_vertices() ) << "Wrong number of vertices";
136 EXPECT_EQ(12u, mesh_.n_faces() ) << "Wrong number of faces";
137 }
138
139 // This function is called after all tests are through
140 virtual void TearDown() {
141
142 // Do some final stuff with the member data here...
143
144 mesh_.clear();
145 }
146
147 // Member already defined in OpenMeshBase
148 //Mesh mesh_;
149};
150
151/*
152 * ====================================================================
153 * Define tests below
154 * ====================================================================
155 */
156
157
158
159/* Test if navigation operations on smart handles yield the expected element
160 */
161TEST_F(OpenMeshSmartHandles, SimpleNavigation)
162{
163 for (auto vh : mesh_.vertices())
164 {
165 EXPECT_EQ(mesh_.halfedge_handle(vh), vh.halfedge()) << "outgoing halfedge of vertex does not match";
166 }
167
168 for (auto heh : mesh_.halfedges())
169 {
170 EXPECT_EQ(mesh_.next_halfedge_handle(heh), heh.next()) << "next halfedge of halfedge does not match";
171 EXPECT_EQ(mesh_.prev_halfedge_handle(heh), heh.prev()) << "prevt halfedge of halfedge does not match";
172 EXPECT_EQ(mesh_.opposite_halfedge_handle(heh), heh.opp()) << "opposite halfedge of halfedge does not match";
173 EXPECT_EQ(mesh_.to_vertex_handle(heh), heh.to()) << "to vertex handle of halfedge does not match";
174 EXPECT_EQ(mesh_.from_vertex_handle(heh), heh.from()) << "from vertex handle of halfedge does not match";
175 EXPECT_EQ(mesh_.face_handle(heh), heh.face()) << "face handle of halfedge does not match";
176 }
177
178 for (auto eh : mesh_.edges())
179 {
180 EXPECT_EQ(mesh_.halfedge_handle(eh), eh.halfedge()) << "halfedge of edge does not match";
181 EXPECT_EQ(mesh_.halfedge_handle(eh, 0), eh.halfedge(0)) << "halfedge 0 of edge does not match";
182 EXPECT_EQ(mesh_.halfedge_handle(eh, 1), eh.halfedge(1)) << "halfedge 1 of edge does not match";
183 EXPECT_EQ(mesh_.halfedge_handle(eh), eh.h()) << "halfedge of edge does not match";
184 EXPECT_EQ(mesh_.halfedge_handle(eh, 0), eh.h0()) << "halfedge 0 of edge does not match";
185 EXPECT_EQ(mesh_.halfedge_handle(eh, 1), eh.h1()) << "halfedge 1 of edge does not match";
186 EXPECT_EQ(mesh_.from_vertex_handle(mesh_.halfedge_handle(eh, 0)), eh.v0()) << "first vertex of edge does not match";
187 EXPECT_EQ(mesh_.to_vertex_handle (mesh_.halfedge_handle(eh, 0)), eh.v1()) << "second vertex of edge does not match";
188 }
189
190 for (auto fh : mesh_.faces())
191 {
192 EXPECT_EQ(mesh_.halfedge_handle(fh), fh.halfedge()) << "halfedge of face does not match";
193 }
194}
195
196
197/* Test if ranges yield the same elements when using smart handles
198 */
199TEST_F(OpenMeshSmartHandles, SimpleRanges)
200{
201 for (auto vh : mesh_.vertices())
202 {
203 {
204 std::vector<OpenMesh::VertexHandle> handles0;
205 std::vector<OpenMesh::VertexHandle> handles1;
206 for (auto h : mesh_.vv_range(vh))
207 handles0.push_back(h);
208 for (auto h : vh.vertices())
209 handles1.push_back(h);
210 EXPECT_EQ(handles0, handles1) << "vertex range of vertex does not match";
211 }
212 {
213 std::vector<OpenMesh::HalfedgeHandle> handles0;
214 std::vector<OpenMesh::HalfedgeHandle> handles1;
215 for (auto h : mesh_.voh_range(vh))
216 handles0.push_back(h);
217 for (auto h : vh.outgoing_halfedges())
218 handles1.push_back(h);
219 EXPECT_EQ(handles0, handles1) << "outgoing halfedge range of vertex does not match";
220 }
221 {
222 std::vector<OpenMesh::HalfedgeHandle> handles0;
223 std::vector<OpenMesh::HalfedgeHandle> handles1;
224 for (auto h : mesh_.vih_range(vh))
225 handles0.push_back(h);
226 for (auto h : vh.incoming_halfedges())
227 handles1.push_back(h);
228 EXPECT_EQ(handles0, handles1) << "incoming halfedge range of vertex does not match";
229 }
230 {
231 std::vector<OpenMesh::EdgeHandle> handles0;
232 std::vector<OpenMesh::EdgeHandle> handles1;
233 for (auto h : mesh_.ve_range(vh))
234 handles0.push_back(h);
235 for (auto h : vh.edges())
236 handles1.push_back(h);
237 EXPECT_EQ(handles0, handles1) << "edge range of vertex does not match";
238 }
239 {
240 std::vector<OpenMesh::FaceHandle> handles0;
241 std::vector<OpenMesh::FaceHandle> handles1;
242 for (auto h : mesh_.vf_range(vh))
243 handles0.push_back(h);
244 for (auto h : vh.faces())
245 handles1.push_back(h);
246 EXPECT_EQ(handles0, handles1) << "face range of vertex does not match";
247 }
248 }
249
250 for (auto fh : mesh_.faces())
251 {
252 {
253 std::vector<OpenMesh::VertexHandle> handles0;
254 std::vector<OpenMesh::VertexHandle> handles1;
255 for (auto h : mesh_.fv_range(fh))
256 handles0.push_back(h);
257 for (auto h : fh.vertices())
258 handles1.push_back(h);
259 EXPECT_EQ(handles0, handles1) << "vertex range of face does not match";
260 }
261 {
262 std::vector<OpenMesh::HalfedgeHandle> handles0;
263 std::vector<OpenMesh::HalfedgeHandle> handles1;
264 for (auto h : mesh_.fh_range(fh))
265 handles0.push_back(h);
266 for (auto h : fh.halfedges())
267 handles1.push_back(h);
268 EXPECT_EQ(handles0, handles1) << "halfedge range of face does not match";
269 }
270 {
271 std::vector<OpenMesh::EdgeHandle> handles0;
272 std::vector<OpenMesh::EdgeHandle> handles1;
273 for (auto h : mesh_.fe_range(fh))
274 handles0.push_back(h);
275 for (auto h : fh.edges())
276 handles1.push_back(h);
277 EXPECT_EQ(handles0, handles1) << "edge range of face does not match";
278 }
279 {
280 std::vector<OpenMesh::FaceHandle> handles0;
281 std::vector<OpenMesh::FaceHandle> handles1;
282 for (auto h : mesh_.ff_range(fh))
283 handles0.push_back(h);
284 for (auto h : fh.faces())
285 handles1.push_back(h);
286 EXPECT_EQ(handles0, handles1) << "face range of face does not match";
287 }
288 }
289}
290
291/* Test if ranges yield the same elements when using smart handles
292 */
293TEST_F(OpenMeshSmartHandles, RangesOfRanges)
294{
295 for (auto vh : mesh_.vertices())
296 {
297 {
298 std::vector<OpenMesh::VertexHandle> handles0;
299 std::vector<OpenMesh::VertexHandle> handles1;
300 for (auto h : mesh_.vv_range(vh))
301 for (auto h2 : mesh_.vv_range(h))
302 handles0.push_back(h2);
303 for (auto h : vh.vertices())
304 for (auto h2 : h.vertices())
305 handles1.push_back(h2);
306 EXPECT_EQ(handles0, handles1) << "vertex range of vertex range does not match";
307 }
308 {
309 std::vector<OpenMesh::HalfedgeHandle> handles0;
310 std::vector<OpenMesh::HalfedgeHandle> handles1;
311 for (auto h : mesh_.vv_range(vh))
312 for (auto h2 : mesh_.voh_range(h))
313 handles0.push_back(h2);
314 for (auto h : vh.vertices())
315 for (auto h2 : h.outgoing_halfedges())
316 handles1.push_back(h2);
317 EXPECT_EQ(handles0, handles1) << "outgoing halfedge range of vertex range does not match";
318 }
319 {
320 std::vector<OpenMesh::HalfedgeHandle> handles0;
321 std::vector<OpenMesh::HalfedgeHandle> handles1;
322 for (auto h : mesh_.vv_range(vh))
323 for (auto h2 : mesh_.vih_range(h))
324 handles0.push_back(h2);
325 for (auto h : vh.vertices())
326 for (auto h2 : h.incoming_halfedges())
327 handles1.push_back(h2);
328 EXPECT_EQ(handles0, handles1) << "incoming halfedge range of vertex range does not match";
329 }
330 {
331 std::vector<OpenMesh::EdgeHandle> handles0;
332 std::vector<OpenMesh::EdgeHandle> handles1;
333 for (auto h : mesh_.vv_range(vh))
334 for (auto h2 : mesh_.ve_range(h))
335 handles0.push_back(h2);
336 for (auto h : vh.vertices())
337 for (auto h2 : h.edges())
338 handles1.push_back(h2);
339 EXPECT_EQ(handles0, handles1) << "edge range of vertex range does not match";
340 }
341 {
342 std::vector<OpenMesh::FaceHandle> handles0;
343 std::vector<OpenMesh::FaceHandle> handles1;
344 for (auto h : mesh_.vv_range(vh))
345 for (auto h2 : mesh_.vf_range(h))
346 handles0.push_back(h2);
347 for (auto h : vh.vertices())
348 for (auto h2 : h.faces())
349 handles1.push_back(h2);
350 EXPECT_EQ(handles0, handles1) << "face range of vertex range does not match";
351 }
352 {
353 std::vector<OpenMesh::VertexHandle> handles0;
354 std::vector<OpenMesh::VertexHandle> handles1;
355 for (auto h : mesh_.vf_range(vh))
356 for (auto h2 : mesh_.fv_range(h))
357 handles0.push_back(h2);
358 for (auto h : vh.faces())
359 for (auto h2 : h.vertices())
360 handles1.push_back(h2);
361 EXPECT_EQ(handles0, handles1) << "vertex range of face range does not match";
362 }
363 {
364 std::vector<OpenMesh::HalfedgeHandle> handles0;
365 std::vector<OpenMesh::HalfedgeHandle> handles1;
366 for (auto h : mesh_.vf_range(vh))
367 for (auto h2 : mesh_.fh_range(h))
368 handles0.push_back(h2);
369 for (auto h : vh.faces())
370 for (auto h2 : h.halfedges())
371 handles1.push_back(h2);
372 EXPECT_EQ(handles0, handles1) << "vertex range of face range does not match";
373 }
374 {
375 std::vector<OpenMesh::FaceHandle> handles0;
376 std::vector<OpenMesh::FaceHandle> handles1;
377 for (auto h : mesh_.vf_range(vh))
378 for (auto h2 : mesh_.ff_range(h))
379 handles0.push_back(h2);
380 for (auto h : vh.faces())
381 for (auto h2 : h.faces())
382 handles1.push_back(h2);
383 EXPECT_EQ(handles0, handles1) << "vertex range of face range does not match";
384 }
385 }
386}
387
388
389/* Test a chain of navigation on a cube
390 */
391TEST_F(OpenMeshSmartHandles, ComplicatedNavigtaion)
392{
393 for (auto vh : mesh_.vertices())
394 {
395 EXPECT_EQ(mesh_.next_halfedge_handle(
396 mesh_.opposite_halfedge_handle(
397 mesh_.halfedge_handle(vh))),
398 vh.out().opp().next());
399 EXPECT_EQ(mesh_.prev_halfedge_handle(
400 mesh_.prev_halfedge_handle(
401 mesh_.opposite_halfedge_handle(
402 mesh_.next_halfedge_handle(
403 mesh_.next_halfedge_handle(
404 mesh_.halfedge_handle(vh)))))),
405 vh.out().next().next().opp().prev().prev());
406 EXPECT_EQ(mesh_.face_handle(
407 mesh_.opposite_halfedge_handle(
408 mesh_.halfedge_handle(
409 mesh_.face_handle(
410 mesh_.opposite_halfedge_handle(
411 mesh_.next_halfedge_handle(
412 mesh_.halfedge_handle(vh))))))),
413 vh.out().next().opp().face().halfedge().opp().face());
414 }
415}
416
417
418/* Test performance of smart handles
419 */
420TEST_F(OpenMeshSmartHandles, Performance)
421{
422#if NDEBUG
423 int n_tests = 10000000;
424#else
425 int n_tests = 300000;
426#endif
427
428 auto t_before_old = std::chrono::high_resolution_clock::now();
429
430 std::vector<OpenMesh::HalfedgeHandle> halfedges0;
431 for (int i = 0; i < n_tests; ++i)
432 {
433 for (auto vh : mesh_.vertices())
434 {
435 auto heh = mesh_.prev_halfedge_handle(
436 mesh_.prev_halfedge_handle(
437 mesh_.opposite_halfedge_handle(
438 mesh_.next_halfedge_handle(
439 mesh_.next_halfedge_handle(
440 mesh_.halfedge_handle(vh))))));
441 if (i == 0)
442 halfedges0.push_back(heh);
443 }
444 }
445
446 auto t_after_old = std::chrono::high_resolution_clock::now();
447
448 std::vector<OpenMesh::HalfedgeHandle> halfedges1;
449 for (int i = 0; i < n_tests; ++i)
450 {
451 for (auto vh : mesh_.vertices())
452 {
453 auto heh = vh.out().next().next().opp().prev().prev();
454 if (i == 0)
455 halfedges1.push_back(heh);
456 }
457 }
458
459 auto t_after_new = std::chrono::high_resolution_clock::now();
460
461 std::cout << "Conventional navigation took " << std::chrono::duration_cast<std::chrono::milliseconds>(t_after_old-t_before_old).count() << "ms" << std::endl;
462 std::cout << "SmartHandle navigation took " << std::chrono::duration_cast<std::chrono::milliseconds>(t_after_new-t_after_old ).count() << "ms" << std::endl;
463
464 EXPECT_EQ(halfedges0, halfedges1) << "halfedges do not match";
465
466}
467
468
469/* Mix old and new api
470 */
471TEST_F(OpenMeshSmartHandles, MixOldAndNew)
472{
473 for (OpenMesh::SmartHalfedgeHandle heh : mesh_.halfedges())
474 {
475 heh = mesh_.opposite_halfedge_handle(heh);
476 EXPECT_TRUE((std::is_same<OpenMesh::SmartEdgeHandle, decltype(OpenMesh::PolyConnectivity::s_edge_handle(heh))>::value));
477 EXPECT_TRUE((std::is_same<OpenMesh::SmartEdgeHandle, decltype(mesh_.edge_handle(heh))>::value));
478 EXPECT_TRUE((std::is_same<OpenMesh::SmartFaceHandle, decltype(mesh_.face_handle(heh))>::value));
479 }
480}
481
482
483
484/* comparability
485 */
486TEST_F(OpenMeshSmartHandles, ComparisionBetweenSmartHandleAndNormalHandles)
487{
489 OpenMesh::SmartVertexHandle svh(0, &mesh_);
490 EXPECT_EQ(vh, svh) << "Vertex handle and smart vertex handle are different";
491
492 std::vector<OpenMesh::VertexHandle> vertices = mesh_.vertices().to_vector([](OpenMesh::SmartVertexHandle _svh) { return OpenMesh::VertexHandle(_svh); });
493
494 std::replace(vertices.begin(), vertices.end(), OpenMesh::VertexHandle(0), OpenMesh::VertexHandle(1));
495 EXPECT_EQ(vertices[0], OpenMesh::VertexHandle(1));
496
497 std::vector<OpenMesh::SmartVertexHandle> smart_vertices = mesh_.vertices().to_vector();
498
499 std::replace(smart_vertices.begin(), smart_vertices.end(), OpenMesh::SmartVertexHandle(0, &mesh_), OpenMesh::SmartVertexHandle(1, &mesh_));
500 EXPECT_EQ(smart_vertices[0], OpenMesh::VertexHandle(1));
501 EXPECT_EQ(smart_vertices[0], OpenMesh::SmartVertexHandle(1, &mesh_));
502
503 std::replace(vertices.begin(), vertices.end(), OpenMesh::SmartVertexHandle(1, &mesh_), OpenMesh::SmartVertexHandle(2, &mesh_));
504 EXPECT_EQ(vertices[0], OpenMesh::VertexHandle(2));
505
506}
507
508TEST(OpenMeshSmartHandlesNoFixture, AddingFacesPolyMesh)
509{
511
512 MyMesh mesh;
513
514 std::vector<OpenMesh::SmartVertexHandle> vertices;
515 for (int i = 0; i < 4; ++i)
516 vertices.push_back(mesh.add_vertex(MyMesh::Point()));
517
518 auto fh = mesh.add_face(vertices);
519
520 for (auto heh : fh.halfedges())
521 {
522 heh = heh.next();
523 }
524}
525
526TEST(OpenMeshSmartHandlesNoFixture, AddingFacesTriMesh)
527{
529
530 MyMesh mesh;
531
532 std::vector<OpenMesh::SmartVertexHandle> vertices;
533 for (int i = 0; i < 4; ++i)
534 vertices.push_back(mesh.add_vertex(MyMesh::Point()));
535
536 auto fh = mesh.add_face(vertices);
537
538 for (auto heh : fh.halfedges())
539 {
540 heh = heh.next();
541 }
542}
543
544TEST(OpenMeshSmartHandlesNoFixture, SplitTriMesh)
545{
547
548 MyMesh mesh;
549
550 std::vector<OpenMesh::SmartVertexHandle> vertices;
551 for (int i = 0; i < 3; ++i)
552 vertices.push_back(mesh.add_vertex(MyMesh::Point()));
553
554 auto fh = mesh.add_face(vertices);
555
556 auto p = (MyMesh::Point());
557
558 OpenMesh::SmartVertexHandle vh = mesh.split(fh, p);
560 OpenMesh::SmartVertexHandle vh2 = mesh.split(eh, p);
561
562 EXPECT_NE(vh.idx(), vh2.idx()) << "This was only intended to fix an unused variable warning but cool that it caugth an actual error now";
563
564}
565
566
567template <typename MeshT, typename RangeT>
568void test_status_fields(MeshT& _mesh, const RangeT& _range)
569{
570 for (auto el : _range)
571 _mesh.status(el).set_selected(el.idx() % 3 == 0);
572 for (auto el : _range)
573 EXPECT_EQ(_mesh.status(el).selected(), el.selected());
574
575 for (auto el : _range)
576 _mesh.status(el).set_feature(el.idx() % 3 == 0);
577 for (auto el : _range)
578 EXPECT_EQ(_mesh.status(el).feature(), el.feature());
579
580 for (auto el : _range)
581 _mesh.status(el).set_tagged(el.idx() % 3 == 0);
582 for (auto el : _range)
583 EXPECT_EQ(_mesh.status(el).tagged(), el.tagged());
584
585 for (auto el : _range)
586 _mesh.status(el).set_tagged2(el.idx() % 3 == 0);
587 for (auto el : _range)
588 EXPECT_EQ(_mesh.status(el).tagged2(), el.tagged2());
589
590 for (auto el : _range)
591 _mesh.status(el).set_hidden(el.idx() % 3 == 0);
592 for (auto el : _range)
593 EXPECT_EQ(_mesh.status(el).hidden(), el.hidden());
594
595 for (auto el : _range)
596 _mesh.status(el).set_locked(el.idx() % 3 == 0);
597 for (auto el : _range)
598 EXPECT_EQ(_mesh.status(el).locked(), el.locked());
599
600 for (auto el : _range)
601 _mesh.status(el).set_deleted(el.idx() % 3 == 0);
602 for (auto el : _range)
603 EXPECT_EQ(_mesh.status(el).deleted(), el.deleted());
604 }
605
606TEST_F(OpenMeshSmartHandles, StatusAccess)
607{
608 ASSERT_TRUE(mesh_.n_vertices() > 0) << "Mesh is empty";
609
610 mesh_.request_vertex_status();
611 mesh_.request_halfedge_status();
612 mesh_.request_edge_status();
613 mesh_.request_face_status();
614
615 test_status_fields(mesh_, mesh_.all_vertices());
616 test_status_fields(mesh_, mesh_.all_edges());
617 test_status_fields(mesh_, mesh_.all_halfedges());
618 test_status_fields(mesh_, mesh_.all_faces());
619}
620
621
622
623
624}
int idx() const
Get the underlying index of this handle.
Definition Handles.hh:69
static SmartEdgeHandle s_edge_handle(SmartHalfedgeHandle _heh)
returns the face handle of the opposite halfedge
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition PolyMeshT.hh:136
SmartVertexHandle add_vertex(const Point _p)
Definition PolyMeshT.hh:255
Kernel::Point Point
Coordinate type.
Definition PolyMeshT.hh:112
SmartVertexHandle split(EdgeHandle _eh, const Point &_p)
Edge split (= 2-to-4 split)
Definition TriMeshT.hh:275
SmartHalfedgeHandle halfedge(unsigned int _i) const
Returns one of the two halfedges of the edge.
SmartEdgeHandle edge() const
Returns incident edge of halfedge.
Smart version of VertexHandle contains a pointer to the corresponding mesh and allows easier access t...
Handle for a vertex entity.
Definition Handles.hh:121