From 8d4877b02542b54cf7206e8efcd8fda300e42855 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 9 Jul 2025 15:09:42 +0100 Subject: [PATCH 1/4] Triangulation_2: Document degree() --- .../doc/Triangulation_2/CGAL/Triangulation_2.h | 14 +++++++++++++- Triangulation_2/include/CGAL/Triangulation_2.h | 9 +++++++++ .../doc/Triangulation_3/CGAL/Triangulation_3.h | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h index ffc29f933bb..d467d1f1d67 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h @@ -472,7 +472,7 @@ const TriangulationDataStructure_2 & tds() const; /// @} -/// \name Non const access +/// \name Non Const Access /// \attention The responsibility of keeping a valid triangulation belongs to the /// user when using advanced operations allowing a direct manipulation /// of the `tds`. This method is mainly a help for users implementing @@ -528,6 +528,11 @@ is_infinite(Edge_circulator ec) const; bool is_infinite(All_edges_iterator ei) const; +/*! +`true` if `v` is a vertex of the triangulation. +*/ +bool is_vertex(Vertex_handle v); + /*! `true` if there is an edge having `va` and `vb` as vertices. @@ -1117,6 +1122,13 @@ in counterclockwise order around `v`. */ Vertex_circulator incident_vertices(Vertex_handle v, Face_handle f) ; +/*! +Returns the degree of `v`, that is, the number of incident vertices. +The infinite vertex is counted. +\pre `v != Vertex_handle()`, `t.is_vertex(v)`. +*/ +size_type degree(Vertex_handle v) const; + /// @} /// \name Traversal Between Adjacent Faces diff --git a/Triangulation_2/include/CGAL/Triangulation_2.h b/Triangulation_2/include/CGAL/Triangulation_2.h index 5078301504b..95e331ef2b7 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2.h @@ -294,6 +294,7 @@ public: bool is_infinite(const Edge& e) const; bool is_infinite(const Edge_circulator& ec) const; bool is_infinite(const All_edges_iterator& ei) const; + bool is_vertex(Vertex_handle va) const; bool is_edge(Vertex_handle va, Vertex_handle vb) const; bool is_edge(Vertex_handle va, Vertex_handle vb, Face_handle& fr, int & i) const; @@ -1096,6 +1097,14 @@ is_infinite(const All_edges_iterator& ei) const return is_infinite(*ei); } +template +inline bool +Triangulation_2:: +is_vertex(Vertex_handle va) const +{ + return _tds.is_vertex(va); +} + template inline bool Triangulation_2:: diff --git a/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_3.h b/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_3.h index 045d2be3c20..b4a4c8e672c 100644 --- a/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_3.h +++ b/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_3.h @@ -1669,7 +1669,7 @@ OutputIterator finite_adjacent_vertices(Vertex_handle v, OutputIterator vertices) const; /*! -Returns the degree of a vertex, that is, the number of incident vertices. +Returns the degree of a `v`, that is, the number of incident vertices. The infinite vertex is counted. \pre `v != Vertex_handle()`, `t.is_vertex(v)`. */ From 61baefa79ae21ca77e848ff93332d81fbecae149 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 15 Jul 2025 12:00:44 +0200 Subject: [PATCH 2/4] Apply suggestions from code review Co-authored-by: Mael --- Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h index d467d1f1d67..8ae0ea8c2fe 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2.h @@ -472,7 +472,7 @@ const TriangulationDataStructure_2 & tds() const; /// @} -/// \name Non Const Access +/// \name Non-Const Access /// \attention The responsibility of keeping a valid triangulation belongs to the /// user when using advanced operations allowing a direct manipulation /// of the `tds`. This method is mainly a help for users implementing @@ -531,7 +531,7 @@ is_infinite(All_edges_iterator ei) const; /*! `true` if `v` is a vertex of the triangulation. */ -bool is_vertex(Vertex_handle v); +bool is_vertex(Vertex_handle v) const; /*! `true` if there is an edge having `va` and `vb` as From 3fbdc2deed2b1c03e7f140c7abaf25d3c353f41c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 15 Jul 2025 11:03:47 +0100 Subject: [PATCH 3/4] polish --- .../CGAL/Periodic_3_triangulation_3.h | 2 +- TDS_3/doc/TDS_3/Concepts/TriangulationDataStructure_3.h | 2 +- Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_3.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h index 8a4de97b43a..daec23b7c5d 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h @@ -1312,7 +1312,7 @@ OutputIterator adjacent_vertices(Vertex_handle v, OutputIterator vertices) const; /*! -Returns the degree of a vertex, that is, the number of adjacent vertices. +Returns the degree of `v`, that is, the number of adjacent vertices. \pre `v` \f$ \neq\f$ `Vertex_handle()`, `t`.`is_vertex(v)`. */ size_type degree(Vertex_handle v) const; diff --git a/TDS_3/doc/TDS_3/Concepts/TriangulationDataStructure_3.h b/TDS_3/doc/TDS_3/Concepts/TriangulationDataStructure_3.h index 03e4ad24928..752093512af 100644 --- a/TDS_3/doc/TDS_3/Concepts/TriangulationDataStructure_3.h +++ b/TDS_3/doc/TDS_3/Concepts/TriangulationDataStructure_3.h @@ -960,7 +960,7 @@ OutputIterator adjacent_vertices(Vertex_handle v, OutputIterator vertices) const; /*! -Returns the degree of a vertex, that is, the number of incident vertices. +Returns the degree of `v`, that is, the number of incident vertices. \pre `v` \f$ \neq\f$ `Vertex_handle()`, `tds.is_vertex(v)`. */ size_type degree(Vertex_handle v) const; diff --git a/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_3.h b/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_3.h index b4a4c8e672c..32a38695566 100644 --- a/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_3.h +++ b/Triangulation_3/doc/Triangulation_3/CGAL/Triangulation_3.h @@ -1669,7 +1669,7 @@ OutputIterator finite_adjacent_vertices(Vertex_handle v, OutputIterator vertices) const; /*! -Returns the degree of a `v`, that is, the number of incident vertices. +Returns the degree of `v`, that is, the number of incident vertices. The infinite vertex is counted. \pre `v != Vertex_handle()`, `t.is_vertex(v)`. */ From 84763072763cfcfe55f23abbbfe505df781f40f2 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 15 Jul 2025 11:14:26 +0100 Subject: [PATCH 4/4] Add call of T2::is_vertex() in the testsuite --- .../Triangulation_2/include/CGAL/_test_cls_triangulation_2.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_2.h b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_2.h index 0aee5fb2e42..27815a98f9f 100644 --- a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_2.h +++ b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_2.h @@ -182,6 +182,7 @@ _test_cls_triangulation_2( const Triangul & ) Triangul T0_2; Vertex_handle v0_2_0 = T0_2.insert_first(p0); assert( v0_2_0 != nullptr ); + assert( T0_2.is_vertex(v0_2_0) ); assert( T0_2.dimension() == 0 ); assert( T0_2.number_of_vertices() == 1 ); assert( T0_2.number_of_faces() == 0);