From 81bb832333848b49bac816b6457a330e8155d47d Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Tue, 26 Aug 2025 22:04:00 +0300 Subject: [PATCH] More clean ups --- .../Bso_internal_functions.h | 8 ++-- .../Boolean_set_operations_2/Gps_agg_op.h | 4 +- .../Gps_agg_op_surface_sweep_2.h | 2 +- .../Gps_agg_op_visitor.h | 31 +++++------- .../Gps_bfs_base_visitor.h | 2 +- .../Gps_bfs_intersection_visitor.h | 6 +-- .../Gps_bfs_xor_visitor.h | 15 +++--- .../CGAL/Boolean_set_operations_2/Gps_merge.h | 8 ++-- .../Gps_simplifier_traits.h | 4 +- .../Boolean_set_operations_2/do_intersect.h | 8 ++-- .../Boolean_set_operations_2/intersection.h | 1 - .../CGAL/Boolean_set_operations_2/join.h | 1 - .../symmetric_difference.h | 1 - .../Boolean_set_operations_2/bug_3989.cpp | 48 ------------------- .../test_compilation.cpp | 48 ++++++++----------- 15 files changed, 60 insertions(+), 127 deletions(-) delete mode 100644 Boolean_set_operations_2/test/Boolean_set_operations_2/bug_3989.cpp diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Bso_internal_functions.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Bso_internal_functions.h index 451bda3e4f1..875995c4f8e 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Bso_internal_functions.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Bso_internal_functions.h @@ -8,10 +8,10 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // -// Author(s): Baruch Zukerman -// Ron Wein -// Efi Fogel -// Simon Giraudot +// Author(s) : Baruch Zukerman +// Ron Wein +// Efi Fogel +// Simon Giraudot #ifndef CGAL_BSO_INTERNAL_FUNCTIONS_H #define CGAL_BSO_INTERNAL_FUNCTIONS_H diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op.h index c3f19bf44ab..f760a668013 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op.h @@ -7,8 +7,8 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// Author(s): Baruch Zukerman -// Ophir Setter +// Author(s) : Baruch Zukerman +// Ophir Setter #ifndef CGAL_BSO_2_GPS_AGG_OP_H #define CGAL_BSO_2_GPS_AGG_OP_H diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_surface_sweep_2.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_surface_sweep_2.h index be5e8ae9f75..be310948033 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_surface_sweep_2.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_surface_sweep_2.h @@ -71,7 +71,7 @@ public: {} /*! Perform the sweep. */ - template + template void sweep(CurveInputIterator curves_begin, CurveInputIterator curves_end, std::size_t lower, std::size_t upper, std::size_t jump, std::vector& arr_vec) { diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h index c51b7d457d5..b18a3ad2b0e 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h @@ -8,8 +8,8 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // -// Author(s): Baruch Zukerman -// Ron Wein +// Author(s) : Baruch Zukerman +// Ron Wein #ifndef CGAL_BSO_2_GSP_AGG_OP_VISITOR_H #define CGAL_BSO_2_GSP_AGG_OP_VISITOR_H @@ -31,8 +31,7 @@ class Gps_agg_op_base_visitor : Helper_, typename Default::Get >::type> -{ + Visitor_> >::type> { public: using Helper = Helper_; using Arrangement_2 = Arrangement_; @@ -70,8 +69,7 @@ public: // TODO add mpl-warning virtual Halfedge_handle insert_in_face_interior(const X_monotone_curve_2& cv, - Subcurve* sc) - { + Subcurve* sc) { Halfedge_handle he = Base::insert_in_face_interior(cv, sc); insert_edge_to_hash(he, cv); return he; @@ -81,8 +79,7 @@ public: Halfedge_handle hhandle, Halfedge_handle prev, Subcurve* sc, - bool& new_face_created) - { + bool& new_face_created) { Halfedge_handle res_he = Base::insert_at_vertices(cv, hhandle, prev, sc, new_face_created); insert_edge_to_hash(res_he, cv); @@ -91,8 +88,7 @@ public: virtual Halfedge_handle insert_from_right_vertex(const X_monotone_curve_2& cv, Halfedge_handle he, - Subcurve* sc) - { + Subcurve* sc) { Halfedge_handle res_he = Base::insert_from_right_vertex(cv, he, sc); insert_edge_to_hash(res_he, cv); return res_he; @@ -100,16 +96,14 @@ public: virtual Halfedge_handle insert_from_left_vertex(const X_monotone_curve_2& cv, Halfedge_handle he, - Subcurve* sc) - { + Subcurve* sc) { Halfedge_handle res_he = Base::insert_from_left_vertex(cv, he, sc); insert_edge_to_hash(res_he, cv); return res_he; } private: - void insert_edge_to_hash(Halfedge_handle he, const X_monotone_curve_2& cv) - { + void insert_edge_to_hash(Halfedge_handle he, const X_monotone_curve_2& cv) { const Comparison_result he_dir = ((Arr_halfedge_direction)he->direction() == ARR_LEFT_TO_RIGHT) ? SMALLER : LARGER; @@ -131,10 +125,9 @@ private: template class Gps_agg_op_visitor : - public Gps_agg_op_base_visitor > -{ + public Gps_agg_op_base_visitor< + Helper_, Arrangement_, + Gps_agg_op_visitor> { public: using Helper = Helper_; using Arrangement_2 = Arrangement_; @@ -209,7 +202,7 @@ public: virtual Halfedge_handle insert_from_left_vertex(const X_monotone_curve_2& cv, Halfedge_handle he, Subcurve* sc) { - Halfedge_handle res_he = Base::insert_from_left_vertex(cv, he, sc); + Halfedge_handle res_he = Base::insert_from_left_vertex(cv, he, sc); // We now have a halfedge whose target vertex is associated with the // current event(we have already dealt with its source vertex). diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_bfs_base_visitor.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_bfs_base_visitor.h index 512b2fc16e4..1dca9c8c9f1 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_bfs_base_visitor.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_bfs_base_visitor.h @@ -27,7 +27,7 @@ namespace CGAL { * which determines if we should mark the face as contained given the inside * count of the face. */ -template +template class Gps_bfs_base_visitor { using Arrangement = Arrangement_; using Face_iterator = typename Arrangement::Face_iterator; diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_bfs_intersection_visitor.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_bfs_intersection_visitor.h index e5c20395acf..b562c8ca52c 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_bfs_intersection_visitor.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_bfs_intersection_visitor.h @@ -9,8 +9,8 @@ // // -// Author(s): Baruch Zukerman -// Ophir Setter +// Author(s) : Baruch Zukerman +// Ophir Setter #ifndef CGAL_GPS_BFS_INTERSECTION_VISITOR_H #define CGAL_GPS_BFS_INTERSECTION_VISITOR_H @@ -21,7 +21,7 @@ namespace CGAL { -template +template class Gps_bfs_intersection_visitor : public Gps_bfs_base_visitor> { using Arrangement = Arrangement_; diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_bfs_xor_visitor.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_bfs_xor_visitor.h index d06ecbae13e..f3dfb43fca7 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_bfs_xor_visitor.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_bfs_xor_visitor.h @@ -21,7 +21,7 @@ namespace CGAL { -template +template class Gps_bfs_xor_visitor : public Gps_bfs_base_visitor> { using Arrangement = Arrangement_; @@ -51,10 +51,10 @@ public: //! after_scan postprocessing after bfs scan. /*! The function fixes some of the curves, to be in the same direction as the - half-edges. - - \param arr The given arrangement. - */ + * half-edges. + * + * \param arr The given arrangement. + */ void after_scan(Arrangement& arr) { typedef typename Arrangement::Geometry_traits_2 Traits; typedef typename Traits::Compare_endpoints_xy_2 Compare_endpoints_xy_2; @@ -63,9 +63,8 @@ public: typedef typename Arrangement::Edge_iterator Edge_iterator; Traits tr; - Compare_endpoints_xy_2 cmp_endpoints = - tr.compare_endpoints_xy_2_object(); - Construct_opposite_2 ctr_opp = tr.construct_opposite_2_object(); + auto cmp_endpoints = tr.compare_endpoints_xy_2_object(); + auto ctr_opp = tr.construct_opposite_2_object(); for (auto eit = arr.edges_begin(); eit != arr.edges_end(); ++eit) { Halfedge_iterator he = eit; diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_merge.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_merge.h index f05854b10fb..85ddf2a9492 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_merge.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_merge.h @@ -7,7 +7,7 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// Author(s): Baruch Zukerman +// Author(s) : Baruch Zukerman #ifndef CGAL_GPS_MERGE_H #define CGAL_GPS_MERGE_H @@ -71,7 +71,7 @@ public: /*! Join_merge is used to join two sets of polygons together in the D&C * algorithm. It is a base merge with a visitor that joins faces. */ -template +template class Join_merge : public Base_merge> {}; @@ -79,7 +79,7 @@ class Join_merge : public Base_merge +template class Intersection_merge : public Base_merge> {}; @@ -87,7 +87,7 @@ class Intersection_merge : public Base_merge +template class Xor_merge : public Base_merge> {}; diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_simplifier_traits.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_simplifier_traits.h index 4e8aa42d1f6..058b9c7df9b 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_simplifier_traits.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_simplifier_traits.h @@ -7,7 +7,6 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// // Author(s) : Baruch Zukerman // Efi Fogel @@ -214,8 +213,7 @@ public: public: void operator()(const X_monotone_curve_2& cv, const Point_2 & p, - X_monotone_curve_2& c1, X_monotone_curve_2& c2) const - { + X_monotone_curve_2& c1, X_monotone_curve_2& c2) const { const auto* base_traits = m_traits.m_base_traits; auto base_split = base_traits->split_2_object(); base_split(cv.base(), p.base(), c1.base(), c2.base()); diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/do_intersect.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/do_intersect.h index 66c9852607d..aa30de940dd 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/do_intersect.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/do_intersect.h @@ -8,10 +8,10 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // -// Author(s): Baruch Zukerman -// Ron Wein -// Efi Fogel -// Simon Giraudot +// Author(s) : Baruch Zukerman +// Ron Wein +// Efi Fogel +// Simon Giraudot #ifndef CGAL_BOOLEAN_SET_OPERATIONS_2_DO_INTERSECT_H #define CGAL_BOOLEAN_SET_OPERATIONS_2_DO_INTERSECT_H diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/intersection.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/intersection.h index d9696c926ae..f38054d63c4 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/intersection.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/intersection.h @@ -7,7 +7,6 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// // Author(s) : Baruch Zukerman // Ron Wein // Efi Fogel diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/join.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/join.h index b3601681119..88c0d338b0e 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/join.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/join.h @@ -7,7 +7,6 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// // Author(s) : Baruch Zukerman // Ron Wein // Efi Fogel diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/symmetric_difference.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/symmetric_difference.h index b59716a772c..544bf4d0dc3 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/symmetric_difference.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/symmetric_difference.h @@ -7,7 +7,6 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// // Author(s) : Baruch Zukerman // Ron Wein // Efi Fogel diff --git a/Boolean_set_operations_2/test/Boolean_set_operations_2/bug_3989.cpp b/Boolean_set_operations_2/test/Boolean_set_operations_2/bug_3989.cpp deleted file mode 100644 index 36c1354c549..00000000000 --- a/Boolean_set_operations_2/test/Boolean_set_operations_2/bug_3989.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include -#include -#include - -typedef CGAL::Exact_predicates_exact_constructions_kernel K; - - -int main() -{ - CGAL::Polygon_2 ob; - ob.push_back(CGAL::Point_2(1, 1)); - ob.push_back(CGAL::Point_2(1, 0)); - ob.push_back(CGAL::Point_2(6, 0)); - ob.push_back(CGAL::Point_2(6, 7)); - ob.push_back(CGAL::Point_2(0, 7)); - ob.push_back(CGAL::Point_2(0, 1)); - - CGAL::Polygon_2 h; - h.push_back(CGAL::Point_2(2, 1)); - h.push_back(CGAL::Point_2(2, 2)); - h.push_back(CGAL::Point_2(3, 2)); - h.push_back(CGAL::Point_2(3, 3)); - h.push_back(CGAL::Point_2(2, 3)); - h.push_back(CGAL::Point_2(2, 4)); - h.push_back(CGAL::Point_2(3, 4)); - h.push_back(CGAL::Point_2(3, 5)); - h.push_back(CGAL::Point_2(4, 5)); - h.push_back(CGAL::Point_2(4, 1)); - - CGAL::Polygon_with_holes_2 ob_with_holes(ob); - ob_with_holes.add_hole(h); - CGAL::Polygon_set_2 inter(ob_with_holes); - - CGAL::Polygon_2 new_poly; - new_poly.push_back(CGAL::Point_2(1, 1)); - new_poly.push_back(CGAL::Point_2(2, 1)); - new_poly.push_back(CGAL::Point_2(2, 2)); - new_poly.push_back(CGAL::Point_2(2, 3)); - new_poly.push_back(CGAL::Point_2(2, 4)); - new_poly.push_back(CGAL::Point_2(2, 5)); - new_poly.push_back(CGAL::Point_2(3, 5)); - new_poly.push_back(CGAL::Point_2(4, 5)); - new_poly.push_back(CGAL::Point_2(4, 6)); - new_poly.push_back(CGAL::Point_2(1, 6)); - - inter.difference(new_poly); -} \ No newline at end of file diff --git a/Boolean_set_operations_2/test/Boolean_set_operations_2/test_compilation.cpp b/Boolean_set_operations_2/test/Boolean_set_operations_2/test_compilation.cpp index 5941ab1121e..065a7d27bcf 100644 --- a/Boolean_set_operations_2/test/Boolean_set_operations_2/test_compilation.cpp +++ b/Boolean_set_operations_2/test/Boolean_set_operations_2/test_compilation.cpp @@ -1,4 +1,3 @@ - #include #include @@ -13,35 +12,32 @@ #include //typedef CGAL::Quotient Number_type; -typedef int Number_type; +using Number_type = int; -typedef CGAL::Simple_cartesian Kernel; +using Kernel = CGAL::Simple_cartesian; -typedef CGAL::Gps_segment_traits_2 Traits; -typedef CGAL::Polygon_set_2 Ps; +using Traits = CGAL::Gps_segment_traits_2; +using Ps = CGAL::Polygon_set_2; -typedef CGAL::Arr_segment_traits_2 Arr_traits; -typedef CGAL::Gps_traits_2 General_traits; -typedef CGAL::General_polygon_set_2 Gps; +using Arr_traits = CGAL::Arr_segment_traits_2; +using General_traits = CGAL::Gps_traits_2; +using Gps = CGAL::General_polygon_set_2; -typedef CGAL::Arr_non_caching_segment_traits_2 Nc_traits; -typedef CGAL::Gps_segment_traits_2, - Nc_traits> Traits_non_caching; -typedef CGAL::General_polygon_set_2 Gps_non_caching; +using Nc_traits = CGAL::Arr_non_caching_segment_traits_2; +using Traits_non_caching = CGAL::Gps_segment_traits_2, Nc_traits>; +using Gps_non_caching = CGAL::General_polygon_set_2; -template -void test() -{ - typedef typename GPS::Traits_2 Traits; - typedef typename Traits::Point_2 Point_2; - typedef typename Traits::Polygon_2 Polygon_2; - typedef typename Traits::Polygon_with_holes_2 Polygon_with_holes_2; +template +void test() { + using Traits = typename GPS::Traits_2; + using Point_2 = typename Traits::Point_2; + using Polygon_2 = typename Traits::Polygon_2; + using Polygon_with_holes_2 = typename Traits::Polygon_with_holes_2; Polygon_2 pgn1, pgn2; - Polygon_with_holes_2 pgn_with_holes1, pgn_with_holes2; - std::vector polygons; - std::vector polygons_with_holes; + Polygon_with_holes_2 pgn_with_holes1, pgn_with_holes2; + std::vector polygons; + std::vector polygons_with_holes; GPS gps; GPS other; @@ -242,8 +238,7 @@ void test() GPS new_gps2 = gps; } -void test_CGAL_Polygon_variants() -{ +void test_CGAL_Polygon_variants() { typedef CGAL::Polygon_2 Polygon_2; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; typedef CGAL::Gps_default_traits::Traits Traits; @@ -499,8 +494,7 @@ void test_CGAL_Polygon_variants() CGAL::complement(pgn_with_holes1, std::back_inserter(result), tr); } -int main() -{ +int main() { test(); test(); test();