From 1dca582e6209671241a45d9f3ab65b1b89ac1cb6 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 23 Aug 2023 13:53:03 +0100 Subject: [PATCH] whitespace --- Nef_2/include/CGAL/Nef_2/PM_decorator.h | 2 +- Nef_2/test/Nef_2/issue7662.cpp | 71 +++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/Nef_2/include/CGAL/Nef_2/PM_decorator.h b/Nef_2/include/CGAL/Nef_2/PM_decorator.h index 9b3881c426c..2f9005c95c6 100644 --- a/Nef_2/include/CGAL/Nef_2/PM_decorator.h +++ b/Nef_2/include/CGAL/Nef_2/PM_decorator.h @@ -799,7 +799,7 @@ void PM_decorator::clone(const HDS& H) const CGAL::Unique_hash_map Vnew; CGAL::Unique_hash_map Hnew; CGAL::Unique_hash_map Fnew; - + /* First clone all objects and store correspondence in three maps.*/ Vertex_const_iterator vit, vend = H.vertices_end(); for (vit = H.vertices_begin(); vit != vend; ++vit) { diff --git a/Nef_2/test/Nef_2/issue7662.cpp b/Nef_2/test/Nef_2/issue7662.cpp index e8354283737..85dd1503cf6 100644 --- a/Nef_2/test/Nef_2/issue7662.cpp +++ b/Nef_2/test/Nef_2/issue7662.cpp @@ -11,6 +11,75 @@ typedef CGAL::Bounded_kernel Bounded_kernel; typedef CGAL::Nef_polyhedron_2 Nef_polyhedron; typedef Nef_polyhedron::Point Point; +typedef Nef_polyhedron::Explorer Explorer; +typedef Explorer::Face_const_iterator Face_const_iterator; +typedef Explorer::Hole_const_iterator Hole_const_iterator; +typedef Explorer::Halfedge_around_face_const_circulator Halfedge_around_face_const_circulator; +typedef Explorer::Vertex_const_handle Vertex_const_handle; +typedef Explorer::Isolated_vertex_const_iterator Isolated_vertex_const_iterator; + +void print(Explorer& explorer, Vertex_const_handle vh, bool exact) +{ + std::cout << explorer.point(vh); + if (exact) + std::cout << " [" << explorer.point(vh).x().exact() << " | " << explorer.point(vh).y().exact() << "]"; + std::cout << ", "; +} + +void print(const Nef_polyhedron& poly, bool exact = false) +{ + + + Explorer explorer = poly.explorer(); + + // The first face is the infinite one. It has no outer face cycle but only holes + Face_const_iterator fit = explorer.faces_begin(); + std::cout << "explorer.mark(explorer.faces_begin()) " << ((explorer.mark(fit)) ? "is part of polygon" : "is not part of polygon") << std::endl; + for (Hole_const_iterator hit = explorer.holes_begin(fit); hit != explorer.holes_end(fit); hit++) { + std::cout << " A hole" << std::endl; + Halfedge_around_face_const_circulator hafc(hit), done(hit); + do { + Vertex_const_handle vh = explorer.target(hafc); + print(explorer, vh, exact); + hafc++; + } while (hafc != done); + std::cout << std::endl; + } + + for (Isolated_vertex_const_iterator it = explorer.isolated_vertices_begin(fit); it != explorer.isolated_vertices_end(fit); ++it) { + std::cout << "isolated vertex A" << explorer.point(it) << std::endl; + } + + // The other faces have outer face cycles, and they may have holes + for (fit++; + fit != explorer.faces_end(); + fit++) { + for (Isolated_vertex_const_iterator it = explorer.isolated_vertices_begin(fit); it != explorer.isolated_vertices_end(fit); ++it) { + std::cout << "isolated vertex B" << std::endl; + } + Halfedge_around_face_const_circulator hafc = explorer.face_cycle(fit), done(hafc); + std::cout << "face: " << ((explorer.mark(fit)) ? "is part of polygon" : "is not part of polygon") << std::endl; + do { + Vertex_const_handle vh = explorer.target(hafc); + print(explorer, vh, exact); + hafc++; + } while (hafc != done); + std::cout << std::endl; + for (Hole_const_iterator hit = explorer.holes_begin(fit); hit != explorer.holes_end(fit); hit++) { + std::cout << " A hole" << std::endl; + Halfedge_around_face_const_circulator hafc(hit), done(hit); + do { + Vertex_const_handle vh = explorer.target(hafc); + print(explorer, vh, exact); + hafc++; + } while (hafc != done); + std::cout << std::endl; + } + } + +} + + int main(int argc, char *argv[]) { @@ -39,6 +108,8 @@ int main(int argc, char *argv[]) Nef_polyhedron intersect = poly1.intersection(poly2); intersect.explorer().check_integrity_and_topological_planarity(); + print(intersect); + Nef_polyhedron comp = intersect.complement(); //leads to crash/exception since topological plane map of intersect is not correct! comp.explorer().check_integrity_and_topological_planarity(); return 0;