From fa0a8a2bedbbb28c85b0bc671d28dbcd3cd644e7 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 7 Mar 2022 11:59:06 +0000 Subject: [PATCH] Triangulation_2: Add an example that stars a conflict zone --- .../CGAL/Delaunay_triangulation_2.h | 6 ++--- .../Triangulation_2/star_conflict_zone.cpp | 25 +++++++++++-------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Delaunay_triangulation_2.h b/Triangulation_2/doc/Triangulation_2/CGAL/Delaunay_triangulation_2.h index 911caf7983c..45a4fe12c20 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Delaunay_triangulation_2.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Delaunay_triangulation_2.h @@ -236,7 +236,7 @@ std::pair get_conflicts_and_boundary(const Point &p, OutputItFaces fit, OutputItBoundaryEdges eit, -Face_handle start) const; +Face_handle start = Face_handle()) const; /*! outputs the faces of the conflict zone of point `p` into an output iterator. @@ -248,7 +248,7 @@ template OutputItFaces get_conflicts (const Point &p, OutputItFaces fit, -Face_handle start) const; +Face_handle start = Face_handle()) const; /*! outputs the boundary edges of the conflict zone of point `p` into an output iterator. @@ -266,7 +266,7 @@ template OutputItBoundaryEdges get_boundary_of_conflicts(const Point &p, OutputItBoundaryEdges eit, -Face_handle start) const; +Face_handle start = Face_handle()) const; /// @} diff --git a/Triangulation_2/examples/Triangulation_2/star_conflict_zone.cpp b/Triangulation_2/examples/Triangulation_2/star_conflict_zone.cpp index bb42398e09c..2093d144e7b 100644 --- a/Triangulation_2/examples/Triangulation_2/star_conflict_zone.cpp +++ b/Triangulation_2/examples/Triangulation_2/star_conflict_zone.cpp @@ -22,7 +22,7 @@ int main( ) dt2.insert(Point_2(10,0)); dt2.insert(Point_2(0,10)); - std::array points = { Point_2(2,2), Point_2(1,0), Point_2(9,9) }; + std::array points = { Point_2(2,2), Point_2(1,0), Point_2(2,2) }; CGAL::spatial_sort(points.begin(), points.end()); @@ -40,19 +40,22 @@ int main( ) std::back_inserter(edges), hint); - // Do something with the faces before the insertion + if(faces.empty()){ + std::cout << "point " << p << " already in the triangulation" << std::endl; + }else{ + // Do something with the faces before the insertion - Vertex_handle vh = dt2.star_hole(p, - edges.begin(), edges.end(), - faces.begin(), faces.end()); - hint = vh->face(); // we could also take any element of faces + Vertex_handle vh = dt2.star_hole(p, + edges.begin(), edges.end(), + faces.begin(), faces.end()); + hint = vh->face(); // we could also take any element of faces - // Do something with the faces after the insertion - Face_circulator fc = dt2.incident_faces(vh), done(fc); - do { + // Do something with the faces after the insertion + Face_circulator fc = dt2.incident_faces(vh), done(fc); + do { fc++; - } while (fc != done); - + } while (fc != done); + } draw(dt2); } return 0;