From dd653cd3960c2db50239aea70c33466f2e006b35 Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Mon, 7 Mar 2022 17:32:26 +0100 Subject: [PATCH 1/3] Update nef_3 draw to deal with faces with holes. --- Nef_3/include/CGAL/draw_nef_3.h | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/Nef_3/include/CGAL/draw_nef_3.h b/Nef_3/include/CGAL/draw_nef_3.h index 2931c43f407..14f8332262a 100644 --- a/Nef_3/include/CGAL/draw_nef_3.h +++ b/Nef_3/include/CGAL/draw_nef_3.h @@ -103,9 +103,10 @@ protected: return; } + + SHalfedge_const_handle se; - Halffacet_cycle_const_iterator fc; - fc = f->facet_cycles_begin(); + Halffacet_cycle_const_iterator fc=f->facet_cycles_begin(); se = SHalfedge_const_handle(fc); // non-zero if shalfedge is returned if(se == 0) @@ -118,13 +119,35 @@ protected: SHalfedge_around_facet_const_circulator hc_start(se); SHalfedge_around_facet_const_circulator hc_end(hc_start); + Vertex_const_handle lastvh; CGAL_For_all(hc_start, hc_end) { - Vertex_const_handle vh = hc_start->source()->center_vertex(); + Vertex_const_handle vh=hc_start->source()->center_vertex(); + lastvh=vh; viewer.add_point_in_face(vh->point(), viewer.get_vertex_normal(vh)); } + + // Now iterate through holes of the face + ++fc; + while(fc!=f->facet_cycles_end()) + { + se = SHalfedge_const_handle(fc); + hc_start=se; + hc_end=hc_start; + CGAL_For_all(hc_start, hc_end) { + Vertex_const_handle vh=hc_start->source()->center_vertex(); + viewer.add_point_in_face(vh->point(), + viewer.get_vertex_normal(vh)); + } + viewer.add_point_in_face(hc_start->source()->center_vertex()->point(), + viewer.get_vertex_normal(hc_start->source()->center_vertex())); + viewer.add_point_in_face(lastvh->point(), + viewer.get_vertex_normal(lastvh)); + ++fc; + } + viewer.face_end(); - facets_done[f] = true; + facets_done[f]=true; n_faces++; } From 182389ed44328d7f2fe6b183ee0a2a9c4b32e431 Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Mon, 7 Mar 2022 17:33:07 +0100 Subject: [PATCH 2/3] Update draw nef3 example to observe faces with holes --- Data/data/meshes/beam.off | 16 ++++++++++++++++ Nef_3/examples/Nef_3/draw_nef_3.cpp | 13 ++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 Data/data/meshes/beam.off diff --git a/Data/data/meshes/beam.off b/Data/data/meshes/beam.off new file mode 100644 index 00000000000..8d0908dc812 --- /dev/null +++ b/Data/data/meshes/beam.off @@ -0,0 +1,16 @@ +OFF +8 6 0 +2.7 2.7 2.3 +2.7 2.3 2.3 +2.3 2.7 2.3 +2.3 2.3 2.3 +2.7 2.7 -1.3 +2.7 2.3 -1.3 +2.3 2.7 -1.3 +2.3 2.3 -1.3 +4 0 1 3 2 +4 5 4 6 7 +4 0 2 6 4 +4 3 1 5 7 +4 0 4 5 1 +4 6 2 3 7 diff --git a/Nef_3/examples/Nef_3/draw_nef_3.cpp b/Nef_3/examples/Nef_3/draw_nef_3.cpp index f5923ffe451..0ccd07ba6f9 100644 --- a/Nef_3/examples/Nef_3/draw_nef_3.cpp +++ b/Nef_3/examples/Nef_3/draw_nef_3.cpp @@ -13,15 +13,18 @@ typedef CGAL::Nef_polyhedron_3 Nef_polyhedron; int main(int argc, char *argv[]) { // read OFF file into a polyhedron - Polyhedron P; - std::ifstream ifs((argc > 1) ? argv[1] : CGAL::data_file_path("meshes/cross_quad.off")); - ifs >> P; + Polyhedron P1, P2; + std::ifstream ifs1((argc > 1) ? argv[1] : CGAL::data_file_path("meshes/cross_quad.off")); + ifs1 >> P1; + std::ifstream ifs2((argc > 1) ? argv[1] : CGAL::data_file_path("meshes/beam.off")); + ifs2 >> P2; // initialize nef from polyhedron - Nef_polyhedron N(P); + Nef_polyhedron N1(P1); + Nef_polyhedron N2(P2); // draw Nef Polyhedron - CGAL::draw(N); + CGAL::draw(N1-N2); return EXIT_SUCCESS; } From 2df2398108427a7b101f6d9f57ee482100413064 Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Mon, 7 Mar 2022 17:37:54 +0100 Subject: [PATCH 3/3] trailing... --- Nef_3/include/CGAL/draw_nef_3.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Nef_3/include/CGAL/draw_nef_3.h b/Nef_3/include/CGAL/draw_nef_3.h index 14f8332262a..e654ea9aae7 100644 --- a/Nef_3/include/CGAL/draw_nef_3.h +++ b/Nef_3/include/CGAL/draw_nef_3.h @@ -104,7 +104,7 @@ protected: } - + SHalfedge_const_handle se; Halffacet_cycle_const_iterator fc=f->facet_cycles_begin(); @@ -145,7 +145,7 @@ protected: viewer.get_vertex_normal(lastvh)); ++fc; } - + viewer.face_end(); facets_done[f]=true; n_faces++;