From a74945062c6d462db8c7279e93e82d6d6a977931 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Tue, 26 Aug 2025 21:58:34 +0300 Subject: [PATCH] Cleaned up; replaced `typedef` with `using`, etc. --- .../include/CGAL/Arr_overlay_2.h | 4 +- .../Arr_do_intersect_overlay_ss_visitor.h | 2 +- .../Surface_sweep_2/Arr_overlay_ss_visitor.h | 6 +- .../Bso_internal_functions.h | 32 +-- .../Gps_agg_meta_traits.h | 147 +++++----- .../Boolean_set_operations_2/Gps_agg_op.h | 72 +++-- .../Gps_agg_op_surface_sweep_2.h | 67 +++-- .../Gps_agg_op_visitor.h | 82 +++--- .../Gps_bfs_base_visitor.h | 72 +++-- .../Gps_bfs_intersection_visitor.h | 44 ++- .../Gps_bfs_join_visitor.h | 46 ++- .../Gps_bfs_xor_visitor.h | 52 ++-- .../CGAL/Boolean_set_operations_2/Gps_merge.h | 77 ++--- .../Gps_on_surface_base_2.h | 266 +++++++++--------- .../Gps_polygon_simplifier.h | 84 +++--- .../Gps_simplifier_traits.h | 115 ++++---- .../Boolean_set_operations_2/Indexed_event.h | 9 +- .../Boolean_set_operations_2/do_intersect.h | 12 +- .../Boolean_set_operations_2/intersection.h | 81 +++--- .../CGAL/Boolean_set_operations_2/join.h | 81 +++--- .../symmetric_difference.h | 81 +++--- .../include/CGAL/General_polygon_set_2.h | 4 +- .../test_compilation.cpp | 20 -- 23 files changed, 647 insertions(+), 809 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h index d9784d52743..03f105b5c0d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h @@ -8,8 +8,8 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // -// Author(s): Baruch Zukerman -// Efi Fogel +// Author(s) : Baruch Zukerman +// Efi Fogel #ifndef CGAL_ARR_OVERLAY_2_H #define CGAL_ARR_OVERLAY_2_H diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_do_intersect_overlay_ss_visitor.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_do_intersect_overlay_ss_visitor.h index 80c08031a50..8ef971ec5c7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_do_intersect_overlay_ss_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_do_intersect_overlay_ss_visitor.h @@ -8,7 +8,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // -// Author(s): Efi Fogel +// Author(s) : Efi Fogel #ifndef CGAL_DO_INTERSECT_ARR_OVERLAY_SS_VISITOR_H #define CGAL_DO_INTERSECT_ARR_OVERLAY_SS_VISITOR_H diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h index a7ec1a0ae90..2d10d616f74 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h @@ -8,9 +8,9 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // -// Author(s): Baruch Zukerman -// Ron Wein -// Efi Fogel +// Author(s) : Baruch Zukerman +// Ron Wein +// Efi Fogel #ifndef CGAL_ARR_OVERLAY_SS_VISITOR_H #define CGAL_ARR_OVERLAY_SS_VISITOR_H 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 fdab75fd678..451bda3e4f1 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 @@ -52,7 +52,7 @@ inline bool s_do_intersect(const Pgn1& pgn1, const Pgn2& pgn2) { // With Traits template inline bool r_do_intersect(InputIterator begin, InputIterator end, - Traits& traits, unsigned int k = 5) { + Traits& traits, std::size_t k = 5) { if (begin == end) return false; General_polygon_set_2 gps(*begin, traits); return gps.do_intersect(std::next(begin), end, k); @@ -61,7 +61,7 @@ inline bool r_do_intersect(InputIterator begin, InputIterator end, // Without Traits template inline bool r_do_intersect(InputIterator begin, InputIterator end, - unsigned int k = 5) { + std::size_t k = 5) { using Pgn = typename std::iterator_traits::value_type; typename Gps_polyline_traits::Traits traits; const typename Gps_polyline_traits::Polyline_traits& ptraits(traits); @@ -74,7 +74,7 @@ inline bool r_do_intersect(InputIterator begin, InputIterator end, template inline bool r_do_intersect(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, InputIterator2 end2, - Traits& traits, unsigned int k = 5) { + Traits& traits, std::size_t k = 5) { if (begin1 == end1) return do_intersect(begin2, end2, traits, k); General_polygon_set_2 gps(*begin1, traits); return gps.do_intersect(std::next(begin1), end1, begin2, end2, k); @@ -84,7 +84,7 @@ inline bool r_do_intersect(InputIterator1 begin1, InputIterator1 end1, template inline bool r_do_intersect (InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, InputIterator2 end2, - unsigned int k = 5) { + std::size_t k = 5) { using Pgn = typename std::iterator_traits::value_type; typename Gps_polyline_traits::Traits traits; const typename Gps_polyline_traits::Polyline_traits& ptraits(traits); @@ -162,7 +162,7 @@ inline OutputIterator s_intersection(const Pgn1& pgn1, const Pgn2& pgn2, template inline OutputIterator r_intersection(InputIterator begin, InputIterator end, OutputIterator oi, Traits& traits, - unsigned int k = 5) { + std::size_t k = 5) { if (begin == end) return (oi); General_polygon_set_2 gps(*begin, traits); gps.intersection(std::next(begin), end, k); @@ -172,7 +172,7 @@ inline OutputIterator r_intersection(InputIterator begin, InputIterator end, // Without Traits template inline OutputIterator r_intersection(InputIterator begin, InputIterator end, - OutputIterator oi, unsigned int k = 5) { + OutputIterator oi, std::size_t k = 5) { using Pgn = typename std::iterator_traits::value_type; typename Gps_polyline_traits::Traits traits; const typename Gps_polyline_traits::Polyline_traits& ptraits(traits); @@ -189,7 +189,7 @@ template gps(*begin1, traits); gps.intersection(std::next(begin1), end1, begin2, end2, k); @@ -202,7 +202,7 @@ template ::value_type; typename Gps_polyline_traits::Traits traits; const typename Gps_polyline_traits::Polyline_traits& ptraits(traits); @@ -286,7 +286,7 @@ inline bool s_join(const Pgn1& pgn1, const Pgn2& pgn2, Pwh& pwh) { template inline OutputIterator r_join(InputIterator begin, InputIterator end, OutputIterator oi, Traits& traits, - unsigned int k = 5) { + std::size_t k = 5) { if (begin == end) return oi; General_polygon_set_2 gps(*begin, traits); gps.join(std::next(begin), end, k); @@ -296,7 +296,7 @@ inline OutputIterator r_join(InputIterator begin, InputIterator end, // Without traits template inline OutputIterator r_join(InputIterator begin, InputIterator end, - OutputIterator oi, unsigned int k = 5) { + OutputIterator oi, std::size_t k = 5) { using Pgn = typename std::iterator_traits::value_type; typename Gps_polyline_traits::Traits traits; const typename Gps_polyline_traits::Polyline_traits& ptraits(traits); @@ -315,7 +315,7 @@ template gps(*begin1, traits); gps.join(std::next(begin1), end1, begin2, end2, k); @@ -327,7 +327,7 @@ template inline OutputIterator r_join(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, InputIterator2 end2, - OutputIterator oi, unsigned int k = 5) { + OutputIterator oi, std::size_t k = 5) { using Pgn = typename std::iterator_traits::value_type; typename Gps_polyline_traits::Traits traits; const typename Gps_polyline_traits::Polyline_traits& ptraits(traits); @@ -407,7 +407,7 @@ template inline OutputIterator r_symmetric_difference(InputIterator begin, InputIterator end, OutputIterator oi, Traits& traits, - unsigned int k = 5) { + std::size_t k = 5) { if (begin == end) return (oi); General_polygon_set_2 gps(*begin, traits); gps.symmetric_difference(std::next(begin), end, k); @@ -419,7 +419,7 @@ template inline OutputIterator r_symmetric_difference(InputIterator begin, InputIterator end, OutputIterator oi, - unsigned int k = 5) { + std::size_t k = 5) { using Pgn = typename std::iterator_traits::value_type; typename Gps_polyline_traits::Traits traits; const typename Gps_polyline_traits::Polyline_traits& ptraits(traits); @@ -438,7 +438,7 @@ inline OutputIterator r_symmetric_difference(InputIterator1 begin1, InputIterator2 begin2, InputIterator2 end2, OutputIterator oi, Traits& traits, - unsigned int k = 5) { + std::size_t k = 5) { if (begin1 == end1) return r_symmetric_difference(begin2, end2, oi, traits, k); General_polygon_set_2 gps(*begin1, traits); gps.symmetric_difference(std::next(begin1), end1, begin2, end2, k); @@ -453,7 +453,7 @@ inline OutputIterator r_symmetric_difference(InputIterator1 begin1, InputIterator2 begin2, InputIterator2 end2, OutputIterator oi, - unsigned int k = 5) { + std::size_t k = 5) { using Pgn = typename std::iterator_traits::value_type; typename Gps_polyline_traits::Traits traits; const typename Gps_polyline_traits::Polyline_traits& ptraits(traits); diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h index e4d6936e78f..ec25b70e006 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h @@ -8,8 +8,8 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // -// Author(s): Baruch Zukerman -// Efi Fogel +// Author(s) : Baruch Zukerman +// Efi Fogel #ifndef CGAL_BSO_2_GPS_AGG_META_TRAITS_H #define CGAL_BSO_2_GPS_AGG_META_TRAITS_H @@ -24,18 +24,17 @@ namespace CGAL { template -class Gps_agg_curve_data : public Curve_with_halfedge -{ +class Gps_agg_curve_data : public Curve_with_halfedge { protected: - typedef Arrangement_ Arrangement; - typedef typename Arrangement::Halfedge_handle Halfedge_handle; - typedef Curve_with_halfedge Base; + using Arrangement = Arrangement_; + using Halfedge_handle = typename Arrangement::Halfedge_handle; + using Base = Curve_with_halfedge; const Arrangement* m_arr; // pointer to the arrangement containing the edge. - unsigned int m_bc; // the boundary counter of the halfedge with the same + std::size_t m_bc; // the boundary counter of the halfedge with the same // direction as the curve - unsigned int m_twin_bc; // the boundary counter of the halfedge with the same + std::size_t m_twin_bc; // the boundary counter of the halfedge with the same // direction as the curve public: @@ -47,24 +46,24 @@ public: {} Gps_agg_curve_data(const Arrangement* arr, Halfedge_handle he, - unsigned int bc, unsigned int twin_bc) : + std::size_t bc, std::size_t twin_bc) : Base(he), m_arr(arr), m_bc(bc), m_twin_bc(twin_bc) {} - unsigned int bc() const { return m_bc; } + std::size_t bc() const { return m_bc; } - unsigned int twin_bc() const { return m_twin_bc; } + std::size_t twin_bc() const { return m_twin_bc; } - unsigned int& bc() { return m_bc; } + std::size_t& bc() { return m_bc; } - unsigned int& twin_bc() { return m_twin_bc; } + std::size_t& twin_bc() { return m_twin_bc; } - void set_bc(unsigned int bc) { m_bc = bc; } + void set_bc(std::size_t bc) { m_bc = bc; } - void set_twin_bc(unsigned int twin_bc) { m_twin_bc = twin_bc; } + void set_twin_bc(std::size_t twin_bc) { m_twin_bc = twin_bc; } const Arrangement* arr() const { return m_arr; } }; @@ -73,54 +72,50 @@ template class Gps_agg_meta_traits : public Gps_traits_decorator, - Point_with_vertex > -{ - typedef Arrangement_ Arrangement; - typedef Arrangement Arr; + Point_with_vertex> { + using Arrangement = Arrangement_; + using Arr = Arrangement; - typedef typename Arr::Traits_adaptor_2 Traits; - typedef Traits Gt2; + using Traits = typename Arr::Traits_adaptor_2; + using Gt2 = Traits; - typedef typename Gt2::X_monotone_curve_2 Base_x_monotone_curve_2; - typedef typename Gt2::Point_2 Base_point_2; - typedef typename Gt2::Construct_min_vertex_2 Base_Construct_min_vertex_2; - typedef typename Gt2::Construct_max_vertex_2 Base_Construct_max_vertex_2; - typedef typename Gt2::Compare_endpoints_xy_2 Base_Compare_endpoints_xy_2; - typedef typename Gt2::Compare_xy_2 Base_Compare_xy_2; - typedef typename Gt2::Compare_y_at_x_right_2 Base_Compare_y_at_x_right_2; - typedef typename Gt2::Compare_y_at_x_2 Base_Compare_y_at_x_2; - typedef typename Gt2::Intersect_2 Base_Intersect_2; - typedef typename Gt2::Split_2 Base_Split_2; + using Base_x_monotone_curve_2 = typename Gt2::X_monotone_curve_2; + using Base_point_2 = typename Gt2::Point_2; + using Base_Construct_min_vertex_2 = typename Gt2::Construct_min_vertex_2; + using Base_Construct_max_vertex_2 = typename Gt2::Construct_max_vertex_2; + using Base_Compare_endpoints_xy_2 = typename Gt2::Compare_endpoints_xy_2; + using Base_Compare_xy_2 = typename Gt2::Compare_xy_2; + using Base_Compare_y_at_x_right_2 = typename Gt2::Compare_y_at_x_right_2; + using Base_Compare_y_at_x_2 = typename Gt2::Compare_y_at_x_2; + using Base_Intersect_2 = typename Gt2::Intersect_2; + using Base_Split_2 = typename Gt2::Split_2; - typedef typename Gt2::Parameter_space_in_x_2 Base_Parameter_space_in_x_2; - typedef typename Gt2::Compare_y_near_boundary_2 - Base_Compare_y_near_boundary_2; + using Base_Parameter_space_in_x_2 = typename Gt2::Parameter_space_in_x_2; + using Base_Compare_y_near_boundary_2 = typename Gt2::Compare_y_near_boundary_2; - typedef typename Gt2::Parameter_space_in_y_2 Base_Parameter_space_in_y_2; - typedef typename Gt2::Compare_x_near_boundary_2 - Base_Compare_x_near_boundary_2; + using Base_Parameter_space_in_y_2 = typename Gt2::Parameter_space_in_y_2; + using Base_Compare_x_near_boundary_2 = typename Gt2::Compare_x_near_boundary_2; public: - typedef typename Gt2::Multiplicity Multiplicity; - typedef Gps_agg_curve_data Curve_data; - typedef Point_with_vertex Point_data; + using Multiplicity = typename Gt2::Multiplicity; + using Curve_data = Gps_agg_curve_data; + using Point_data = Point_with_vertex; private: - typedef Gps_agg_meta_traits Self; - typedef Gps_traits_decorator Base; + using Self = Gps_agg_meta_traits; + using Base = Gps_traits_decorator; public: - typedef typename Base::X_monotone_curve_2 X_monotone_curve_2; - typedef typename Base::Point_2 Point_2; - typedef typename Gt2::Has_left_category Has_left_category; - typedef typename Gt2::Has_merge_category Has_merge_category; - typedef typename Gt2::Has_do_intersect_category - Has_do_intersect_category; + using X_monotone_curve_2 = typename Base::X_monotone_curve_2; + using Point_2 = typename Base::Point_2; + using Has_left_category = typename Gt2::Has_left_category; + using Has_merge_category = typename Gt2::Has_merge_category; + using Has_do_intersect_category = typename Gt2::Has_do_intersect_category; - typedef typename Arr::Left_side_category Left_side_category; - typedef typename Arr::Bottom_side_category Bottom_side_category; - typedef typename Arr::Top_side_category Top_side_category; - typedef typename Arr::Right_side_category Right_side_category; + using Left_side_category = typename Arr::Left_side_category; + using Bottom_side_category = typename Arr::Bottom_side_category; + using Top_side_category = typename Arr::Top_side_category; + using Right_side_category = typename Arr::Right_side_category; // a side is either oblivious or open (unbounded) static_assert(std::is_same::value || @@ -132,8 +127,8 @@ public: static_assert(std::is_same::value || std::is_same::value); - typedef typename Arr::Halfedge_handle Halfedge_handle; - typedef typename Arr::Vertex_handle Vertex_handle; + using Halfedge_handle = typename Arr::Halfedge_handle; + using Vertex_handle = typename Arr::Vertex_handle; Gps_agg_meta_traits() {} @@ -152,16 +147,13 @@ public: template OutputIterator operator()(const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2, - OutputIterator oi) const - { + OutputIterator oi) const { // Check whether the curves are already in the same arrangement, and thus // must be interior-disjoint if (cv1.data().arr() == cv2.data().arr()) return oi; - typedef const std::pair - Intersection_base_point; - typedef std::variant - Intersection_base_result; + using Intersection_base_point = const std::pair; + using Intersection_base_result = std::variant; const auto* base_traits = m_traits.m_base_traits; auto base_cmp_xy = base_traits->compare_xy_2_object(); @@ -191,8 +183,8 @@ public: const Base_x_monotone_curve_2* overlap_cv = std::get_if(&xection); CGAL_assertion(overlap_cv != nullptr); - unsigned int ov_bc; - unsigned int ov_twin_bc; + std::size_t ov_bc; + std::size_t ov_twin_bc; if (base_cmp_endpoints(cv1) == base_cmp_endpoints(cv2)) { // cv1 and cv2 have the same directions ov_bc = cv1.data().bc() + cv2.data().bc(); @@ -230,8 +222,7 @@ public: Split_2(const Base_Split_2& base) : m_base_split(base) {} 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 { m_base_split(cv.base(), p.base(), c1.base(), c2.base()); const Curve_data& cv_data = cv.data(); c1.set_data(Curve_data(cv_data.arr(), Halfedge_handle(), cv_data.bc(), @@ -259,8 +250,7 @@ public: * \param cv The curve. * \return The left endpoint. */ - Point_2 operator()(const X_monotone_curve_2 & cv) const - { + Point_2 operator()(const X_monotone_curve_2 & cv) const { if (cv.data().halfedge() == Halfedge_handle()) return (Point_2(m_base(cv.base()))); @@ -272,8 +262,7 @@ public: }; /*! Get a Construct_min_vertex_2 functor object. */ - Construct_min_vertex_2 construct_min_vertex_2_object() const - { + Construct_min_vertex_2 construct_min_vertex_2_object() const { return Construct_min_vertex_2(this->m_base_traits-> construct_min_vertex_2_object()); } @@ -285,15 +274,14 @@ public: public: Construct_max_vertex_2(const Base_Construct_max_vertex_2& base) : - m_base(base) + m_base(base) {} /*! Obtain the right endpoint of the x-monotone curve (segment). * \param cv The curve. * \return The right endpoint. */ - Point_2 operator()(const X_monotone_curve_2& cv) const - { + Point_2 operator()(const X_monotone_curve_2& cv) const { if (cv.data().halfedge() == Halfedge_handle()) return (Point_2(m_base(cv.base()))); @@ -304,8 +292,7 @@ public: }; /*! Get a Construct_min_vertex_2 functor object. */ - Construct_max_vertex_2 construct_max_vertex_2_object() const - { + Construct_max_vertex_2 construct_max_vertex_2_object() const { return Construct_max_vertex_2(this->m_base_traits-> construct_max_vertex_2_object()); } @@ -321,8 +308,7 @@ public: * \param cv The curve. * \return The left endpoint. */ - Comparison_result operator()(const Point_2& p1, const Point_2& p2) const - { + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { const Point_data& inf1 = p1.data(); const Point_data& inf2 = p2.data(); @@ -390,8 +376,7 @@ public: }; /*! Obtain a Construct_min_vertex_2 functor object. */ - Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const - { + Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const { return Compare_y_near_boundary_2(this->m_base_traits-> compare_y_near_boundary_2_object() ); @@ -429,8 +414,7 @@ public: }; /*! Obtain a Construct_min_vertex_2 functor object. */ - Parameter_space_in_y_2 parameter_space_in_y_2_object() const - { + Parameter_space_in_y_2 parameter_space_in_y_2_object() const { return Parameter_space_in_y_2(this->m_base_traits-> parameter_space_in_y_2_object()); } @@ -462,8 +446,7 @@ public: }; /*! Obtain a Construct_min_vertex_2 functor object. */ - Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const - { + Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const { return Compare_x_near_boundary_2(this->m_base_traits-> compare_x_near_boundary_2_object()); } 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 e047d78f884..c3f19bf44ab 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,7 +7,7 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// Author(s) : Baruch Zukerman +// Author(s): Baruch Zukerman // Ophir Setter #ifndef CGAL_BSO_2_GPS_AGG_OP_H @@ -39,29 +39,29 @@ namespace CGAL { template class Gps_agg_op { - typedef Arrangement_ Arrangement_2; - typedef BfsVisitor Bfs_visitor; + using Arrangement_2 = Arrangement_; + using Bfs_visitor = BfsVisitor; - typedef typename Arrangement_2::Traits_adaptor_2 Geometry_traits_2; - typedef typename Arrangement_2::Topology_traits Topology_traits; + using Geometry_traits_2 = typename Arrangement_2::Traits_adaptor_2; + using Topology_traits = typename Arrangement_2::Topology_traits; - typedef Arrangement_2 Arr; - typedef Geometry_traits_2 Gt2; - typedef Topology_traits Tt; + using Arr = Arrangement_2; + using Gt2 = Geometry_traits_2; + using Tt = Topology_traits; - typedef typename Gt2::Curve_const_iterator Curve_const_iterator; - typedef Gps_agg_meta_traits Mgt2; - typedef typename Mgt2::Curve_data Curve_data; - typedef typename Mgt2::X_monotone_curve_2 Meta_X_monotone_curve_2; + using Curve_const_iterator = typename Gt2::Curve_const_iterator; + using Mgt2 = Gps_agg_meta_traits; + using Curve_data = typename Mgt2::Curve_data; + using Meta_X_monotone_curve_2 = typename Mgt2::X_monotone_curve_2; - typedef typename Arr::Halfedge_handle Halfedge_handle; - typedef typename Arr::Halfedge_iterator Halfedge_iterator; - typedef typename Arr::Face_handle Face_handle; - typedef typename Arr::Edge_iterator Edge_iterator; - typedef typename Arr::Vertex_handle Vertex_handle; - typedef typename Arr::Allocator Allocator; + using Halfedge_handle = typename Arr::Halfedge_handle; + using Halfedge_iterator = typename Arr::Halfedge_iterator; + using Face_handle = typename Arr::Face_handle; + using Edge_iterator = typename Arr::Edge_iterator; + using Vertex_handle = typename Arr::Vertex_handle; + using Allocator = typename Arr::Allocator; - typedef std::pair *> Arr_entry; + using Arr_entry = std::pair *>; // We obtain a proper helper type from the topology traits of the arrangement. // However, the arrangement is parametrized with the Gt2 geometry traits, @@ -70,21 +70,17 @@ class Gps_agg_op { // We cannot parameterized the arrangement with the Mgt2 geometry // traits to start with, because it extends the curve type with arrangement // dependent types. (It is parameterized with the arrangement type.) - typedef Indexed_event Event; - typedef Arr_construction_subcurve - Subcurve; - typedef typename Tt::template Construction_helper - Helper_tmp; - typedef typename Helper_tmp::template rebind::other - Helper; - typedef Gps_agg_op_visitor Visitor; - typedef Gps_agg_op_surface_sweep_2 Surface_sweep_2; + using Event = Indexed_event; + using Subcurve = Arr_construction_subcurve; + using Helper_tmp = typename Tt::template Construction_helper; + using Helper = typename Helper_tmp::template rebind::other; + using Visitor = Gps_agg_op_visitor; + using Surface_sweep_2 = Gps_agg_op_surface_sweep_2; - typedef Unique_hash_map - Edges_hash; + using Edges_hash = Unique_hash_map; - typedef Unique_hash_map Faces_hash; - typedef Gps_bfs_scanner Bfs_scanner; + using Faces_hash = Unique_hash_map; + using Bfs_scanner = Gps_bfs_scanner; protected: Arr* m_arr; @@ -103,17 +99,15 @@ public: m_surface_sweep(m_traits, &m_visitor) {} - void sweep_arrangements(unsigned int lower, unsigned int upper, - unsigned int jump, std::vector& arr_vec) - { + void sweep_arrangements(std::size_t lower, std::size_t upper, + std::size_t jump, std::vector& arr_vec) { std::list curves_list; - unsigned int n_inf_pgn = 0; // number of infinite polygons (arrangement + std::size_t n_inf_pgn = 0; // number of infinite polygons (arrangement // with a contained unbounded face - unsigned int n_pgn = 0; // number of polygons (arrangements) - unsigned int i; + std::size_t n_pgn = 0; // number of polygons (arrangements) - for (i = lower; i <= upper; i += jump, ++n_pgn) { + for (std::size_t i = lower; i <= upper; i += jump, ++n_pgn) { // The BFS scan (after the loop) starts in the reference face, // so we count the number of polygons that contain the reference face. Arr* arr = (arr_vec[i]).first; 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 2a76a46c271..be5e8ae9f75 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 @@ -7,8 +7,8 @@ // $Id$ // 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_SURFACE_SWEEP_2_H #define CGAL_BSO_2_GSP_AGG_OP_SURFACE_SWEEP_2_H @@ -27,34 +27,34 @@ namespace Ss2 = Surface_sweep_2; template class Gps_agg_op_surface_sweep_2 : public Ss2::Surface_sweep_2 { public: - typedef Arrangement_ Arrangement_2; - typedef Visitor_ Visitor; + using Arrangement_2 = Arrangement_; + using Visitor = Visitor_; - typedef typename Visitor::Geometry_traits_2 Geometry_traits_2; + using Geometry_traits_2 = typename Visitor::Geometry_traits_2; - typedef Arrangement_2 Arr; - typedef Geometry_traits_2 Gt2; + using Arr = Arrangement_2; + using Gt2 = Geometry_traits_2; - typedef typename Gt2::Point_2 Point_2; - typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; + using Point_2 = typename Gt2::Point_2; + using X_monotone_curve_2 = typename Gt2::X_monotone_curve_2; - typedef typename Arr::Vertex_handle Vertex_handle; - typedef typename Arr::Halfedge_handle Halfedge_handle; + using Vertex_handle = typename Arr::Vertex_handle; + using Halfedge_handle = typename Arr::Halfedge_handle; - typedef std::pair *> Arr_entry; + using Arr_entry = std::pair *>; - typedef Ss2::Surface_sweep_2 Base; + using Base = Ss2::Surface_sweep_2; - typedef typename Visitor::Event Event; - typedef typename Visitor::Subcurve Subcurve; + using Event = typename Visitor::Event; + using Subcurve = typename Visitor::Subcurve; - typedef typename Base::Event_queue_iterator EventQueueIter; - typedef typename Event::Subcurve_iterator EventCurveIter; + using EventQueueIter = typename Base::Event_queue_iterator; + using EventCurveIter = typename Event::Subcurve_iterator; - typedef typename Event::Attribute Attribute; + using Attribute = typename Event::Attribute; - typedef std::list SubCurveList; - typedef typename SubCurveList::iterator SubCurveListIter; + using SubCurveList = std::list; + using SubCurveListIter = typename SubCurveList::iterator; public: /*! Constructor. @@ -73,18 +73,16 @@ public: /*! Perform the sweep. */ template void sweep(CurveInputIterator curves_begin, CurveInputIterator curves_end, - unsigned int lower, unsigned int upper, unsigned int jump, - std::vector& arr_vec) - { + std::size_t lower, std::size_t upper, std::size_t jump, + std::vector& arr_vec) { CGAL_assertion(this->m_queue->empty() && this->m_statusLine.size() == 0); - typedef Unique_hash_map Vertices_map; - typedef typename Gt2::Compare_xy_2 Compare_xy_2; + using Vertices_map = Unique_hash_map; + using Compare_xy_2 = typename Gt2::Compare_xy_2; this->m_visitor->before_sweep(); // Allocate all of the Subcurve objects as one block. - this->m_num_of_subCurves = - static_cast(std::distance(curves_begin, curves_end)); + this->m_num_of_subCurves = std::distance(curves_begin, curves_end); if (this->m_num_of_subCurves > 0) this->m_subCurves = this->m_subCurveAlloc.allocate(this->m_num_of_subCurves); @@ -95,9 +93,9 @@ public: Vertices_map vert_map; Vertex_handle vh; Vertex_handle invalid_v; - unsigned int i = lower; - unsigned int n = static_cast((arr_vec[i].second)->size()); - unsigned int j; + std::size_t i = lower; + auto n = (arr_vec[i].second)->size(); + std::size_t j; EventQueueIter q_iter; bool first = true; Attribute event_type; @@ -135,7 +133,7 @@ public: for (i += jump; i <= upper; i += jump) { // Merge the vertices of the other vectors into the existing queue. q_iter = this->m_queue->begin(); - n = static_cast((arr_vec[i].second)->size()); + n = (arr_vec[i].second)->size(); for (j = 0; j < n && (vh = (*(arr_vec[i].second))[j]) != invalid_v; j++) { event_type = _type_of_vertex(vh); @@ -170,7 +168,7 @@ public: // Go over all curves (which are associated with halfedges) and associate // them with the events we have just created. - unsigned int index = 0; + std::size_t index = 0; CurveInputIterator iter; Halfedge_handle he; Event* e_left; @@ -194,7 +192,7 @@ public: } // Create the subcurve object. - typedef decltype(this->m_subCurveAlloc) Subcurve_alloc; + using Subcurve_alloc = decltype(this->m_subCurveAlloc); std::allocator_traits::construct(this->m_subCurveAlloc, this->m_subCurves + index, this->m_masterSubcurve); (this->m_subCurves + index)->init(*iter); @@ -218,8 +216,7 @@ private: * Check if the given vertex is an endpoint of an edge we are going * to use in the sweep. */ - Attribute _type_of_vertex(Vertex_handle v) - { + Attribute _type_of_vertex(Vertex_handle v) { typename Arr::Halfedge_around_vertex_circulator first, circ; circ = first = v->incident_halfedges(); 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 3e88b1ecef5..c51b7d457d5 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,7 +8,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // -// Author(s) : Baruch Zukerman +// Author(s): Baruch Zukerman // Ron Wein #ifndef CGAL_BSO_2_GSP_AGG_OP_VISITOR_H @@ -34,30 +34,28 @@ class Gps_agg_op_base_visitor : Visitor_> >::type> { public: - typedef Helper_ Helper; - typedef Arrangement_ Arrangement_2; + using Helper = Helper_; + using Arrangement_2 = Arrangement_; - typedef typename Helper::Geometry_traits_2 Geometry_traits_2; - typedef typename Helper::Event Event; - typedef typename Helper::Subcurve Subcurve; + using Geometry_traits_2 = typename Helper::Geometry_traits_2; + using Event = typename Helper::Event; + using Subcurve = typename Helper::Subcurve; private: - typedef Geometry_traits_2 Gt2; - typedef Arrangement_2 Arr; + using Gt2 = Geometry_traits_2; + using Arr = Arrangement_2; - typedef Gps_agg_op_base_visitor - Self; - typedef typename Default::Get::type Visitor; - typedef Arr_construction_ss_visitor Base; + using Self = Gps_agg_op_base_visitor; + using Visitor = typename Default::Get::type; + using Base = Arr_construction_ss_visitor; public: - typedef typename Arr::Halfedge_handle Halfedge_handle; - typedef typename Arr::Vertex_handle Vertex_handle; - typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; - typedef typename Gt2::Point_2 Point_2; + using Halfedge_handle = typename Arr::Halfedge_handle; + using Vertex_handle = typename Arr::Vertex_handle; + using X_monotone_curve_2 = typename Gt2::X_monotone_curve_2; + using Point_2 = typename Gt2::Point_2; - typedef Unique_hash_map - Edges_hash; + using Edges_hash = Unique_hash_map; protected: Edges_hash* m_edges_hash; // maps halfedges to their BC (coundary counter) @@ -138,29 +136,29 @@ class Gps_agg_op_visitor : Visitor_> > { public: - typedef Helper_ Helper; - typedef Arrangement_ Arrangement_2; + using Helper = Helper_; + using Arrangement_2 = Arrangement_; - typedef typename Helper::Geometry_traits_2 Geometry_traits_2; - typedef typename Helper::Event Event; - typedef typename Helper::Subcurve Subcurve; + using Geometry_traits_2 = typename Helper::Geometry_traits_2; + using Event = typename Helper::Event; + using Subcurve = typename Helper::Subcurve; private: - typedef Geometry_traits_2 Gt2; - typedef Arrangement_2 Arr; + using Gt2 = Geometry_traits_2; + using Arr = Arrangement_2; - typedef Gps_agg_op_visitor Self; - typedef typename Default::Get::type Visitor; - typedef Gps_agg_op_base_visitor Base; + using Self = Gps_agg_op_visitor; + using Visitor = typename Default::Get::type; + using Base = Gps_agg_op_base_visitor; public: - typedef typename Base::Halfedge_handle Halfedge_handle; - typedef typename Base::Vertex_handle Vertex_handle; - typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; - typedef typename Gt2::Point_2 Point_2; + using Halfedge_handle = typename Base::Halfedge_handle; + using Vertex_handle = typename Base::Vertex_handle; + using X_monotone_curve_2 = typename Gt2::X_monotone_curve_2; + using Point_2 = typename Gt2::Point_2; protected: - unsigned int m_event_count; // The number of events so far. + std::size_t m_event_count; // The number of events so far. std::vector* m_vertices_vec; // The vertices, sorted in // ascending order. @@ -172,15 +170,13 @@ public: m_vertices_vec(vertices_vec) {} - void before_handle_event(Event* event) - { + void before_handle_event(Event* event) { event->set_index(m_event_count); m_event_count++; } virtual Halfedge_handle - insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) - { + insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) { Halfedge_handle res_he = Base::insert_in_face_interior(cv, sc); // We now have a halfedge whose source vertex is associated with the @@ -198,8 +194,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); // We now have a halfedge whose target vertex is associated with the @@ -213,8 +208,7 @@ 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); // We now have a halfedge whose target vertex is associated with the @@ -228,13 +222,11 @@ public: } private: - void _insert_vertex(const Event* event, Vertex_handle v) - { - const unsigned int index = event->index(); + void _insert_vertex(const Event* event, Vertex_handle v) { + const auto index = event->index(); if (index >= m_vertices_vec->size()) m_vertices_vec->resize(2 * (index + 1)); (*m_vertices_vec)[index] = v; } - }; } // namespace CGAL 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 0312f6781c3..512b2fc16e4 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 @@ -8,90 +8,84 @@ // 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_GPS_BPS_BASE_VISITOR_H #define CGAL_GPS_BPS_BASE_VISITOR_H #include - #include namespace CGAL { //! Gps_bfs_base_visitor /*! This is a base class for all visitors that are responsible for merging - polygon sets. - We use DerivedVisitor for static polymorphism for using contained_criteria - which determines if we should mark the face as contained given the inside - count of the face. -*/ + * polygon sets. + * We use DerivedVisitor for static polymorphism for using contained_criteria + * which determines if we should mark the face as contained given the inside + * count of the face. + */ template -class Gps_bfs_base_visitor -{ - typedef Arrangement_ Arrangement; - typedef typename Arrangement::Face_iterator Face_iterator; - typedef typename Arrangement::Halfedge_iterator Halfedge_iterator; +class Gps_bfs_base_visitor { + using Arrangement = Arrangement_; + using Face_iterator = typename Arrangement::Face_iterator; + using Halfedge_iterator = typename Arrangement::Halfedge_iterator; + public: - typedef Unique_hash_map Edges_hash; - typedef Unique_hash_map Faces_hash; + using Edges_hash = Unique_hash_map; + using Faces_hash = Unique_hash_map; protected: - Edges_hash* m_edges_hash; - Faces_hash* m_faces_hash; - unsigned int m_num_of_polygons; // number of polygons + Edges_hash* m_edges_hash; + Faces_hash* m_faces_hash; + std::size_t m_num_of_polygons; // number of polygons public: Gps_bfs_base_visitor(Edges_hash* edges_hash, Faces_hash* faces_hash, - unsigned int n_pgn): + std::size_t n_pgn): m_edges_hash(edges_hash), m_faces_hash(faces_hash), m_num_of_polygons(n_pgn) {} - - //! discovered_face -/*! discovered_face is called by Gps_bfs_scanner when it reveals a new face - during a BFS scan. In the BFS traversal we are going from old_face to - new_face through the half-edge he. - \param old_face The face that was already revealed - \param new_face The face that we have just now revealed - \param he The half-edge that is used to traverse between them. -*/ + //! discovered_face + /*! discovered_face is called by Gps_bfs_scanner when it reveals a new face + * during a BFS scan. In the BFS traversal we are going from old_face to + * new_face through the half-edge he. + * \param old_face The face that was already revealed + * \param new_face The face that we have just now revealed + * \param he The half-edge that is used to traverse between them. + */ void discovered_face(Face_iterator old_face, Face_iterator new_face, - Halfedge_iterator he) - { - unsigned int ic = compute_ic(old_face, new_face, he); + Halfedge_iterator he) { + std::size_t ic = compute_ic(old_face, new_face, he); if (static_cast(this)->contained_criteria(ic)) new_face->set_contained(true); } // mark the unbounded_face (true iff contained) - void visit_ubf(Face_iterator ubf, unsigned int ubf_ic) - { + void visit_ubf(Face_iterator ubf, std::size_t ubf_ic) { CGAL_assertion(ubf->is_unbounded()); - if(static_cast(this)->contained_criteria(ubf_ic)) + if (static_cast(this)->contained_criteria(ubf_ic)) ubf->set_contained(true); } protected: - // compute the inside count of a face - unsigned int compute_ic(Face_iterator f1, + std::size_t compute_ic(Face_iterator f1, Face_iterator f2, - Halfedge_iterator he) - { + Halfedge_iterator he) { CGAL_assertion(m_edges_hash->is_defined(he) && m_edges_hash->is_defined(he->twin()) && m_faces_hash->is_defined(f1) && !m_faces_hash->is_defined(f2)); - unsigned int ic_f2 = + std::size_t ic_f2 = (*m_faces_hash)[f1] - (*m_edges_hash)[he] + (*m_edges_hash)[he->twin()]; (*m_faces_hash)[f2] = ic_f2; 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 cb624debf2c..e5c20395acf 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,57 +9,49 @@ // // -// Author(s) : Baruch Zukerman +// Author(s): Baruch Zukerman // Ophir Setter - #ifndef CGAL_GPS_BFS_INTERSECTION_VISITOR_H #define CGAL_GPS_BFS_INTERSECTION_VISITOR_H #include - #include namespace CGAL { template class Gps_bfs_intersection_visitor : -public Gps_bfs_base_visitor > -{ - typedef Arrangement_ Arrangement; - typedef typename Arrangement::Face_iterator Face_iterator; - typedef typename Arrangement::Halfedge_iterator Halfedge_iterator; - typedef Gps_bfs_intersection_visitor Self; - typedef Gps_bfs_base_visitor Base; - typedef typename Base::Edges_hash Edges_hash; - typedef typename Base::Faces_hash Faces_hash; - + public Gps_bfs_base_visitor> { + using Arrangement = Arrangement_; + using Face_iterator = typename Arrangement::Face_iterator; + using Halfedge_iterator = typename Arrangement::Halfedge_iterator; + using Self = Gps_bfs_intersection_visitor; + using Base = Gps_bfs_base_visitor; + using Edges_hash = typename Base::Edges_hash; + using Faces_hash = typename Base::Faces_hash; public: - Gps_bfs_intersection_visitor(Edges_hash* edges_hash, Faces_hash* faces_hash, - unsigned int n_polygons): + std::size_t n_polygons): Base(edges_hash, faces_hash, n_polygons) {} - - //! contained_criteria -/*! contained_criteria is used to the determine if the face which has - inside count should be marked as contained. - \param ic the inner count of the talked-about face. - \return true if the face of ic, otherwise false. -*/ - bool contained_criteria(unsigned int ic) - { + //! contained_criteria + /*! contained_criteria is used to the determine if the face which has + * inside count should be marked as contained. + * \param ic the inner count of the talked-about face. + * \return true if the face of ic, otherwise false. + */ + bool contained_criteria(std::size_t ic) { // intersection means that all polygons contain the face. CGAL_assertion(ic <= this->m_num_of_polygons); return (ic == this->m_num_of_polygons); } - void after_scan(Arrangement&) - {} + void after_scan(Arrangement&) {} }; } //namespace CGAL diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_bfs_join_visitor.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_bfs_join_visitor.h index 3d81533d19f..702d3c22ed0 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_bfs_join_visitor.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_bfs_join_visitor.h @@ -8,52 +8,46 @@ // 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_GPS_BFS_JOIN_VISITOR_H #define CGAL_GPS_BFS_JOIN_VISITOR_H #include - #include namespace CGAL { -template +template class Gps_bfs_join_visitor : -public Gps_bfs_base_visitor > -{ - typedef Arrangement_ Arrangement; - typedef typename Arrangement::Face_iterator Face_iterator; - typedef typename Arrangement::Halfedge_iterator Halfedge_iterator; - typedef Gps_bfs_join_visitor Self; - typedef Gps_bfs_base_visitor Base; - typedef typename Base::Edges_hash Edges_hash; - typedef typename Base::Faces_hash Faces_hash; +public Gps_bfs_base_visitor> { + using Arrangement = Arrangement_; + using Face_iterator = typename Arrangement::Face_iterator; + using Halfedge_iterator = typename Arrangement::Halfedge_iterator; + using Self = Gps_bfs_join_visitor; + using Base = Gps_bfs_base_visitor; + using Edges_hash = typename Base::Edges_hash; + using Faces_hash = typename Base::Faces_hash; public: - - Gps_bfs_join_visitor(Edges_hash* edges_hash, Faces_hash* faces_hash, unsigned int n_pgn): + Gps_bfs_join_visitor(Edges_hash* edges_hash, Faces_hash* faces_hash, std::size_t n_pgn): Base(edges_hash, faces_hash, n_pgn) {} - //! contained_criteria -/*! contained_criteria is used to the determine if the face which has - inside count should be marked as contained. - \param ic the inner count of the talked-about face. - \return true if the face of ic, otherwise false. -*/ - bool contained_criteria(unsigned int ic) - { + //! contained_criteria + /*! contained_criteria is used to the determine if the face which has + * inside count should be marked as contained. + * \param ic the inner count of the talked-about face. + * \return true if the face of ic, otherwise false. + */ + bool contained_criteria(std::size_t ic) { // at least one polygon contains the face. return (ic > 0); } - void after_scan(Arrangement&) - {} - + void after_scan(Arrangement&) {} }; } //namespace CGAL 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 591113740d9..d06ecbae13e 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 @@ -8,8 +8,8 @@ // 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_GPS_BFS_XOR_VISITOR_H #define CGAL_GPS_BFS_XOR_VISITOR_H @@ -23,43 +23,39 @@ namespace CGAL { template class Gps_bfs_xor_visitor : -public Gps_bfs_base_visitor > -{ - typedef Arrangement_ Arrangement; - typedef typename Arrangement::Face_iterator Face_iterator; - typedef typename Arrangement::Halfedge_iterator Halfedge_iterator; - typedef Gps_bfs_xor_visitor Self; - typedef Gps_bfs_base_visitor Base; - typedef typename Base::Edges_hash Edges_hash; - typedef typename Base::Faces_hash Faces_hash; + public Gps_bfs_base_visitor> { + using Arrangement = Arrangement_; + using Face_iterator = typename Arrangement::Face_iterator; + using Halfedge_iterator = typename Arrangement::Halfedge_iterator; + using Self = Gps_bfs_xor_visitor; + using Base = Gps_bfs_base_visitor; + using Edges_hash = typename Base::Edges_hash; + using Faces_hash = typename Base::Faces_hash; public: - Gps_bfs_xor_visitor(Edges_hash* edges_hash, Faces_hash* faces_hash, - unsigned int n_pgn) : + std::size_t n_pgn) : Base(edges_hash, faces_hash, n_pgn) {} - //! contained_criteria + //! contained_criteria /*! contained_criteria is used to the determine if the face which has inside count should be marked as contained. \param ic the inner count of the talked-about face. \return true if the face of ic, otherwise false. */ - bool contained_criteria(unsigned int ic) - { + bool contained_criteria(std::size_t ic) { // xor means odd number of polygons. return (ic % 2) == 1; } //! after_scan postprocessing after bfs scan. -/*! The function fixes some of the curves, to be in the same direction as the + /*! The function fixes some of the curves, to be in the same direction as the half-edges. - \param arr The given arrangement. -*/ - void after_scan(Arrangement& arr) - { + \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; typedef typename Traits::Construct_opposite_2 Construct_opposite_2; @@ -71,23 +67,19 @@ public: tr.compare_endpoints_xy_2_object(); Construct_opposite_2 ctr_opp = tr.construct_opposite_2_object(); - for(Edge_iterator eit = arr.edges_begin(); - eit != arr.edges_end(); - ++eit) - { - Halfedge_iterator he = eit; + for (auto eit = arr.edges_begin(); eit != arr.edges_end(); ++eit) { + Halfedge_iterator he = eit; const X_monotone_curve_2& cv = he->curve(); - const bool is_cont = he->face()->contained(); - const Comparison_result he_res = + const bool is_cont = he->face()->contained(); + const Comparison_result he_res = ((Arr_halfedge_direction)he->direction() == ARR_LEFT_TO_RIGHT) ? - SMALLER : LARGER; + SMALLER : LARGER; const bool has_same_dir = (cmp_endpoints(cv) == he_res); if ((is_cont && !has_same_dir) || (!is_cont && has_same_dir)) arr.modify_edge(he, ctr_opp(cv)); } } - }; } //namespace CGAL 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 95a4d282ab7..f05854b10fb 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,14 +7,13 @@ // $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 #include - #include #include #include @@ -23,50 +22,42 @@ namespace CGAL { -/*! - \file Gps_merge.h - \brief This file contains classes that are responsible for merging - two sets of polygons in the divide-and-conquer algorithm. - The file contains 3 mergers: Join_merge, Intersection_merge and - Xor_merge. Join_merge is used when we want to merge the two sets, - Intersection_merge is used for intersection, and Xor_merge is used - for symmetric difference. -*/ +/*! \file Gps_merge.h + * \brief This file contains classes that are responsible for merging + * two sets of polygons in the divide-and-conquer algorithm. + * The file contains 3 mergers: Join_merge, Intersection_merge and + * Xor_merge. Join_merge is used when we want to merge the two sets, + * Intersection_merge is used for intersection, and Xor_merge is used + * for symmetric difference. + */ //! Base_merge /*! Base_merge is the base class for all merger classes. - All merges used BFS algorithm with a different visitor when discovering - a new face. + * All merges used BFS algorithm with a different visitor when discovering + * a new face. */ -template -class Base_merge -{ - typedef Arrangement_ Arrangement_2; - typedef Visitor_ Visitor; - typedef typename Arrangement_2::Vertex_handle Vertex_handle; - typedef std::pair *> Arr_entry; +template +class Base_merge { + using Arrangement_2 = Arrangement_; + using Visitor = Visitor_; + using Vertex_handle = typename Arrangement_2::Vertex_handle; + using Arr_entry = std::pair*>; public: - void operator()(unsigned int i, - unsigned int j, - unsigned int jump, - std::vector& arr_vec) - { - if(i==j) - return; + void operator()(std::size_t i, std::size_t j, std::size_t jump, + std::vector& arr_vec) { + if (i == j) return; - const typename Arrangement_2::Geometry_traits_2 * tr = + const typename Arrangement_2::Geometry_traits_2* tr = arr_vec[i].first->geometry_traits(); - Arrangement_2 *res = new Arrangement_2(tr); - std::vector *verts = new std::vector; + Arrangement_2* res = new Arrangement_2(tr); + std::vector* verts = new std::vector; Gps_agg_op agg_op(*res, *verts, *(res->traits_adaptor())); agg_op.sweep_arrangements(i, j, jump, arr_vec); - for(unsigned int count=i; count<=j; count+=jump) - { + for (std::size_t count = i; count <= j; count += jump) { delete (arr_vec[count].first); delete (arr_vec[count].second); } @@ -74,37 +65,31 @@ public: arr_vec[i].first = res; arr_vec[i].second = verts; } - }; //! Join_merge /*! 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. + * algorithm. It is a base merge with a visitor that joins faces. */ template -class Join_merge : public Base_merge > +class Join_merge : public Base_merge> {}; - //! Intersection_merge /*! Intersection_merge is used to merge two sets of polygons creating their - intersection. + * intersection. */ template -class Intersection_merge : public Base_merge > +class Intersection_merge : public Base_merge> {}; //! Xor_merge /*! Xor_merge is used to merge two sets of polygons creating their - symmetric difference. + * symmetric difference. */ template -class Xor_merge : public Base_merge > -{ -}; +class Xor_merge : public Base_merge> +{}; } //namespace CGAL diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2.h index 25979830273..d7d3b9f911c 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2.h @@ -7,9 +7,9 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// Author(s): Baruch Zukerman -// Ophir Setter -// Guy Zucker +// Author(s) : Baruch Zukerman +// Ophir Setter +// Guy Zucker #ifndef CGAL_GPS_ON_SURFACE_BASE_2_H @@ -131,7 +131,7 @@ protected: Aos_2* m_arr; public: - // default constructor + // constructs default Gps_on_surface_base_2() : m_traits(new Traits_2()), m_traits_adaptor(*m_traits), @@ -140,7 +140,7 @@ public: {} - // constructor with traits object + // constructs with traits object Gps_on_surface_base_2(const Traits_2& tr) : m_traits(&tr), m_traits_adaptor(*m_traits), @@ -148,7 +148,7 @@ public: m_arr(new Aos_2(m_traits)) {} - // Copy constructor + // copy constructs Gps_on_surface_base_2(const Self& ps) : m_traits(new Traits_2(*(ps.m_traits))), m_traits_adaptor(*m_traits), @@ -156,7 +156,7 @@ public: m_arr(new Aos_2(*(ps.m_arr))) {} - // Assignment operator + // assigns Gps_on_surface_base_2& operator=(const Self& ps) { if (this == &ps) return (*this); @@ -169,7 +169,7 @@ public: return (*this); } - // Constructor + // constructs explicit Gps_on_surface_base_2(const Polygon_2& pgn) : m_traits(new Traits_2()), m_traits_adaptor(*m_traits), @@ -179,7 +179,7 @@ public: _insert(pgn, *m_arr); } - // Constructor + // constructs explicit Gps_on_surface_base_2(const Polygon_2& pgn, const Traits_2& tr) : m_traits(&tr), m_traits_adaptor(*m_traits), @@ -189,7 +189,7 @@ public: _insert(pgn, *m_arr); } - // Constructor + // constructs explicit Gps_on_surface_base_2(const Polygon_with_holes_2& pgn_with_holes) : m_traits(new Traits_2()), m_traits_adaptor(*m_traits), @@ -199,7 +199,7 @@ public: _insert(pgn_with_holes, *m_arr); } - // Constructor + // constructs explicit Gps_on_surface_base_2(const Polygon_with_holes_2& pgn_with_holes, const Traits_2& tr) : m_traits(&tr), @@ -211,14 +211,15 @@ public: } protected: - Gps_on_surface_base_2(Aos_2* arr) : m_traits(new Traits_2()), - m_traits_adaptor(*m_traits), - m_traits_owner(true), - m_arr(arr) + Gps_on_surface_base_2(Aos_2* arr) : + m_traits(new Traits_2()), + m_traits_adaptor(*m_traits), + m_traits_owner(true), + m_arr(arr) {} public: - //destructor + // destructs virtual ~Gps_on_surface_base_2() { delete m_arr; @@ -241,25 +242,25 @@ public: gps.polygons_with_holes(oi); } - // insert a simple polygon + // inserts a simple polygon void insert(const Polygon_2& pgn) { ValidationPolicy::is_valid(pgn, *m_traits); _insert(pgn, *m_arr); } - // insert a polygon with holes + // inserts a polygon with holes void insert(const Polygon_with_holes_2& pgn_with_holes) { ValidationPolicy::is_valid(pgn_with_holes, *m_traits); _insert(pgn_with_holes, *m_arr); } - // insert a range of polygons that can be either simple polygons + // inserts a range of polygons that can be either simple polygons // or polygons with holes // precondition: the polygons are disjoint and simple template void insert(PolygonIterator pgn_begin, PolygonIterator pgn_end); - // insert two ranges of : the first one for simple polygons, + // inserts two ranges of : the first one for simple polygons, // the second one for polygons with holes // precondition: the first range is disjoint simple polygons // the second range is disjoint polygons with holes @@ -268,21 +269,21 @@ public: PolygonWithHolesIterator pgn_with_holes_begin, PolygonWithHolesIterator pgn_with_holes_end); - // test for intersection with a simple polygon + // tests for intersection with a simple polygon bool do_intersect(const Polygon_2& pgn) const { ValidationPolicy::is_valid(pgn, *m_traits); Self other(pgn, *m_traits); return do_intersect(other); } - // test for intersection with a polygon with holes + // tests for intersection with a polygon with holes bool do_intersect(const Polygon_with_holes_2& pgn_with_holes) const { ValidationPolicy::is_valid(pgn_with_holes, *m_traits); Self other(pgn_with_holes, *m_traits); return do_intersect(other); } - //test for intersection with another Gps_on_surface_base_2 object + // tests for intersection with another Gps_on_surface_base_2 object bool do_intersect(const Self& other) const { if (this->is_empty() || other.is_empty()) return false; if (this->is_plane() || other.is_plane()) return true; @@ -292,19 +293,19 @@ public: return func.found_reg_intersection(); } - // intersection with a simple polygon + // intersects with a simple polygon void intersection(const Polygon_2& pgn) { ValidationPolicy::is_valid(pgn, *m_traits); _intersection(pgn); } - // intersection with a polygon with holes + // intersects with a polygon with holes void intersection(const Polygon_with_holes_2& pgn) { ValidationPolicy::is_valid(pgn, *m_traits); _intersection(pgn); } - // intersection with another Gps_on_surface_base_2 object + // intersects with another Gps_on_surface_base_2 object void intersection(const Self& other) { _intersection(other); } void intersection(const Self& gps1, const Self& gps2) { @@ -312,19 +313,19 @@ public: _intersection(*(gps1.m_arr), *(gps2.m_arr), *(this->m_arr)); } - // join with a simple polygon + // joins with a simple polygon void join(const Polygon_2& pgn) { ValidationPolicy::is_valid(pgn, *m_traits); _join(pgn); } - // join with a polygon with holes + // joins with a polygon with holes void join(const Polygon_with_holes_2& pgn) { ValidationPolicy::is_valid(pgn, *m_traits); _join(pgn); } - //join with another Gps_on_surface_base_2 object + // joins with another Gps_on_surface_base_2 object void join(const Self& other) { _join(other); } void join(const Self& gps1, const Self& gps2) { @@ -332,19 +333,19 @@ public: _join(*(gps1.m_arr), *(gps2.m_arr), *(this->m_arr)); } - // difference with a simple polygon + // computes the difference with a simple polygon void difference(const Polygon_2& pgn) { ValidationPolicy::is_valid(pgn, *m_traits); _difference(pgn); } - // difference with a polygon with holes + // computes the difference with a polygon with holes void difference(const Polygon_with_holes_2& pgn) { ValidationPolicy::is_valid(pgn, *m_traits); _difference(pgn); } - //difference with another Gps_on_surface_base_2 object + // computes the difference with another Gps_on_surface_base_2 object void difference(const Self& other) { _difference(other); } void difference(const Self& gps1, const Self& gps2) { @@ -352,19 +353,19 @@ public: _difference(*(gps1.m_arr), *(gps2.m_arr), *(this->m_arr)); } - // symmetric_difference with a simple polygon + // computes the symmetric_difference with a simple polygon void symmetric_difference(const Polygon_2& pgn) { ValidationPolicy::is_valid(pgn, *m_traits); _symmetric_difference(pgn); } - // symmetric_difference with a polygon with holes + // computes the symmetric_difference with a polygon with holes void symmetric_difference(const Polygon_with_holes_2& pgn) { ValidationPolicy::is_valid(pgn, *m_traits); _symmetric_difference(pgn); } - //symmetric_difference with another Gps_on_surface_base_2 object + // computes the symmetric_difference with another Gps_on_surface_base_2 object void symmetric_difference(const Self& other) { _symmetric_difference(other); } void symmetric_difference(const Self& gps1, const Self& gps2) { @@ -414,7 +415,6 @@ public: Face_const_iterator f; if (CGAL::assign(f, obj)) { if (f->contained()) return ON_POSITIVE_SIDE; - return ON_NEGATIVE_SIDE ; } return ON_ORIENTED_BOUNDARY ; @@ -433,14 +433,10 @@ public: } Oriented_side oriented_side(const Self& other) const { - if (this->is_empty() || other.is_empty()) - return ON_NEGATIVE_SIDE; - - if (this->is_plane() || other.is_plane()) - return ON_POSITIVE_SIDE; + if (this->is_empty() || other.is_empty()) return ON_NEGATIVE_SIDE; + if (this->is_plane() || other.is_plane()) return ON_POSITIVE_SIDE; Aos_2 res_arr; - Gps_do_intersect_functor func; overlay(*m_arr, *(other.m_arr), res_arr, func); if (func.found_reg_intersection()) return ON_POSITIVE_SIDE; @@ -448,15 +444,15 @@ public: return ON_NEGATIVE_SIDE; } - // returns the location of the query point + // obtains the location of the query point bool locate(const Point_2& q, Polygon_with_holes_2& pgn) const; - /*! Obtain a const reference to the underlying arrangement + /*! obtains a const reference to the underlying arrangement * \return the underlying arrangement. */ const Aos_2& arrangement() const { return *m_arr; } - /*! Obtain a reference to the underlying arrangement + /*! obtains a reference to the underlying arrangement * \return the underlying arrangement. */ Aos_2& arrangement() { return *m_arr; } @@ -486,16 +482,16 @@ protected: } public: - /*! */ + // bool is_valid() { return _is_valid(*this->m_arr); } - // get the simple polygons, takes O(n) + // obtains the simple polygons, takes O(n) template OutputIterator polygons_with_holes(OutputIterator out) const; - // test for intersection of a range of polygons + // tests for intersection of a range of polygons template - bool do_intersect(InputIterator begin, InputIterator end, unsigned int k = 5) { + bool do_intersect(InputIterator begin, InputIterator end, std::size_t k = 5) { Self other(*this); other.intersection(begin, end, k); return (other.is_empty()); @@ -504,32 +500,32 @@ public: template bool do_intersect(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, InputIterator2 end2, - unsigned int k = 5) { + std::size_t k = 5) { Self other(*this); other.intersection(begin1, end1, begin2, end2, k); return (other.is_empty()); } - // join a range of polygons + // joins a range of polygons template - void join(InputIterator begin, InputIterator end, unsigned int k = 5) { + void join(InputIterator begin, InputIterator end, std::size_t k = 5) { typename std::iterator_traits::value_type pgn; this->join(begin, end, pgn, k); this->remove_redundant_edges(); this->_reset_faces(); } - // join range of simple polygons + // joins a range of simple polygons // 5 is the magic number in which we switch to a sweep-based algorithm // instead of a D&C algorithm. This point should be further studies, as // it is hard to believe that this is the best value for all applications. template inline void join(InputIterator begin, InputIterator end, Polygon_2&, - unsigned int k = 5) { + std::size_t k = 5) { std::vector arr_vec(std::distance(begin, end) + 1); arr_vec[0].first = this->m_arr; - unsigned int i = 1; + std::size_t i = 1; for (InputIterator itr = begin; itr != end; ++itr, ++i) { ValidationPolicy::is_valid((*itr), *m_traits); arr_vec[i].first = new Aos_2(m_traits); @@ -537,22 +533,22 @@ public: } Join_merge join_merge; - _build_sorted_vertices_vectors (arr_vec); - _divide_and_conquer(0, static_cast(arr_vec.size()-1), arr_vec, k, join_merge); + _build_sorted_vertices_vectors(arr_vec); + _divide_and_conquer(0, arr_vec.size() - 1, arr_vec, k, join_merge); //the result arrangement is at index 0 this->m_arr = arr_vec[0].first; delete arr_vec[0].second; } - //join range of polygons with holes (see previous comment about k=5). + // joins a range of polygons with holes (see previous comment about k=5). template inline void join(InputIterator begin, InputIterator end, - Polygon_with_holes_2&, unsigned int k = 5) { + Polygon_with_holes_2&, std::size_t k = 5) { std::vector arr_vec(std::distance(begin, end) + 1); arr_vec[0].first = this->m_arr; - unsigned int i = 1; + std::size_t i = 1; for (InputIterator itr = begin; itr!=end; ++itr, ++i) { ValidationPolicy::is_valid((*itr), *m_traits); arr_vec[i].first = new Aos_2(m_traits); @@ -560,10 +556,10 @@ public: } Join_merge join_merge; - _build_sorted_vertices_vectors (arr_vec); - _divide_and_conquer(0, static_cast(arr_vec.size()-1), arr_vec, k, join_merge); + _build_sorted_vertices_vectors(arr_vec); + _divide_and_conquer(0, arr_vec.size() - 1, arr_vec, k, join_merge); - //the result arrangement is at index 0 + // the result arrangement is at index 0 this->m_arr = arr_vec[0].first; delete arr_vec[0].second; } @@ -572,11 +568,11 @@ public: template inline void join(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, InputIterator2 end2, - unsigned int k = 5) { + std::size_t k = 5) { std::vector arr_vec(std::distance(begin1, end1) + std::distance(begin2, end2) + 1); arr_vec[0].first = this->m_arr; - unsigned int i = 1; + std::size_t i = 1; for (InputIterator1 itr1 = begin1; itr1 != end1; ++itr1, ++i) { arr_vec[i].first = new Aos_2(m_traits); @@ -589,8 +585,8 @@ public: } Join_merge join_merge; - _build_sorted_vertices_vectors (arr_vec); - _divide_and_conquer(0, static_cast(arr_vec.size()-1), arr_vec, k, join_merge); + _build_sorted_vertices_vectors(arr_vec); + _divide_and_conquer(0, arr_vec.size() - 1, arr_vec, k, join_merge); // the result arrangement is at index 0 this->m_arr = arr_vec[0].first; @@ -599,23 +595,23 @@ public: this->_reset_faces(); } - // intersect range of polygins (see previous comment about k=5). + // intersects a range of polygins (see previous comment about k=5). template inline void intersection(InputIterator begin, InputIterator end, - unsigned int k = 5) { + std::size_t k = 5) { typename std::iterator_traits::value_type pgn; this->intersection(begin, end, pgn, k); this->remove_redundant_edges(); this->_reset_faces(); } - // intersect range of simple polygons + // intersects a range of simple polygons template inline void intersection(InputIterator begin, InputIterator end, - Polygon_2&, unsigned int k) { + Polygon_2&, std::size_t k) { std::vector arr_vec(std::distance(begin, end) + 1); arr_vec[0].first = this->m_arr; - unsigned int i = 1; + std::size_t i = 1; for (InputIterator itr = begin; itr != end; ++itr, ++i) { ValidationPolicy::is_valid((*itr), *m_traits); @@ -625,20 +621,20 @@ public: Intersection_merge intersection_merge; _build_sorted_vertices_vectors(arr_vec); - _divide_and_conquer(0, static_cast(arr_vec.size()-1), arr_vec, k, intersection_merge); + _divide_and_conquer(0, arr_vec.size() - 1, arr_vec, k, intersection_merge); - //the result arrangement is at index 0 + // the result arrangement is at index 0 this->m_arr = arr_vec[0].first; delete arr_vec[0].second; } - // intersect range of polygons with holes + // intersects a range of polygons with holes template inline void intersection(InputIterator begin, InputIterator end, - Polygon_with_holes_2&, unsigned int k) { + Polygon_with_holes_2&, std::size_t k) { std::vector arr_vec(std::distance(begin, end) + 1); arr_vec[0].first = this->m_arr; - unsigned int i = 1; + std::size_t i = 1; for (InputIterator itr = begin; itr!=end; ++itr, ++i) { ValidationPolicy::is_valid((*itr), *m_traits); @@ -647,10 +643,10 @@ public: } Intersection_merge intersection_merge; - _build_sorted_vertices_vectors (arr_vec); - _divide_and_conquer(0, static_cast(arr_vec.size()-1), arr_vec, k, intersection_merge); + _build_sorted_vertices_vectors(arr_vec); + _divide_and_conquer(0, arr_vec.size() - 1, arr_vec, k, intersection_merge); - //the result arrangement is at index 0 + // the result arrangement is at index 0 this->m_arr = arr_vec[0].first; delete arr_vec[0].second; } @@ -658,10 +654,10 @@ public: template inline void intersection(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, InputIterator2 end2, - unsigned int k = 5) { + std::size_t k = 5) { std::vector arr_vec(std::distance(begin1, end1) + std::distance(begin2, end2) + 1); arr_vec[0].first = this->m_arr; - unsigned int i = 1; + std::size_t i = 1; for (InputIterator1 itr1 = begin1; itr1!=end1; ++itr1, ++i) { ValidationPolicy::is_valid(*itr1, *m_traits); @@ -676,34 +672,34 @@ public: } Intersection_merge intersection_merge; - _build_sorted_vertices_vectors (arr_vec); - _divide_and_conquer(0, static_cast(arr_vec.size()-1), arr_vec, k, intersection_merge); + _build_sorted_vertices_vectors(arr_vec); + _divide_and_conquer(0, arr_vec.size() - 1, arr_vec, k, intersection_merge); - //the result arrangement is at index 0 + // the result arrangement is at index 0 this->m_arr = arr_vec[0].first; delete arr_vec[0].second; this->remove_redundant_edges(); this->_reset_faces(); } - // symmetric_difference of a range of polygons (similar to xor) + // computes the symmetric_difference of a range of polygons (similar to xor) // (see previous comment about k=5). template inline void symmetric_difference(InputIterator begin, InputIterator end, - unsigned int k = 5) { + std::size_t k = 5) { typename std::iterator_traits::value_type pgn; this->symmetric_difference(begin, end, pgn, k); this->remove_redundant_edges(); this->_reset_faces(); } - // intersect range of simple polygons (see previous comment about k=5). + // intersect a range of simple polygons (see previous comment about k=5). template inline void symmetric_difference(InputIterator begin, InputIterator end, - Polygon_2&, unsigned int k = 5) { + Polygon_2&, std::size_t k = 5) { std::vector arr_vec(std::distance(begin, end) + 1); arr_vec[0].first = this->m_arr; - unsigned int i = 1; + std::size_t i = 1; for (InputIterator itr = begin; itr!=end; ++itr, ++i) { ValidationPolicy::is_valid(*itr,*m_traits); @@ -712,33 +708,33 @@ public: } Xor_merge xor_merge; - _build_sorted_vertices_vectors (arr_vec); - _divide_and_conquer(0, static_cast(arr_vec.size()-1), arr_vec, k, xor_merge); + _build_sorted_vertices_vectors(arr_vec); + _divide_and_conquer(0, arr_vec.size() - 1, arr_vec, k, xor_merge); - //the result arrangement is at index 0 + // the result arrangement is at index 0 this->m_arr = arr_vec[0].first; delete arr_vec[0].second; } - //intersect range of polygons with holes (see previous comment about k=5). + // intersects a range of polygons with holes (see previous comment about k=5). template inline void symmetric_difference(InputIterator begin, InputIterator end, - Polygon_with_holes_2&, unsigned int k = 5) { + Polygon_with_holes_2&, std::size_t k = 5) { std::vector arr_vec(std::distance(begin, end) + 1); arr_vec[0].first = this->m_arr; - unsigned int i = 1; + std::size_t i = 1; - for (InputIterator itr = begin; itr!=end; ++itr, ++i) { + for (InputIterator itr = begin; itr != end; ++itr, ++i) { ValidationPolicy::is_valid(*itr,*m_traits); arr_vec[i].first = new Aos_2(m_traits); _insert(*itr, *(arr_vec[i].first)); } Xor_merge xor_merge; - _build_sorted_vertices_vectors (arr_vec); - _divide_and_conquer(0, static_cast(arr_vec.size()-1), arr_vec, k, xor_merge); + _build_sorted_vertices_vectors(arr_vec); + _divide_and_conquer(0, arr_vec.size() - 1, arr_vec, k, xor_merge); - //the result arrangement is at index 0 + // the result arrangement is at index 0 this->m_arr = arr_vec[0].first; delete arr_vec[0].second; } @@ -747,28 +743,28 @@ public: template inline void symmetric_difference(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, InputIterator2 end2, - unsigned int k = 5) { + std::size_t k = 5) { std::vector arr_vec(std::distance(begin1, end1) + std::distance(begin2, end2) + 1); arr_vec[0].first = this->m_arr; - unsigned int i = 1; + std::size_t i = 1; - for (InputIterator1 itr1 = begin1; itr1!=end1; ++itr1, ++i) { + for (InputIterator1 itr1 = begin1; itr1 != end1; ++itr1, ++i) { ValidationPolicy::is_valid(*itr1, *m_traits); arr_vec[i].first = new Aos_2(m_traits); _insert(*itr1, *(arr_vec[i].first)); } - for (InputIterator2 itr2 = begin2; itr2!=end2; ++itr2, ++i) { + for (InputIterator2 itr2 = begin2; itr2 != end2; ++itr2, ++i) { ValidationPolicy::is_valid(*itr2, *m_traits); arr_vec[i].first = new Aos_2(m_traits); _insert(*itr2, *(arr_vec[i].first)); } Xor_merge xor_merge; - _build_sorted_vertices_vectors (arr_vec); - _divide_and_conquer(0, static_cast(arr_vec.size()-1), arr_vec, k, xor_merge); + _build_sorted_vertices_vectors(arr_vec); + _divide_and_conquer(0, arr_vec.size() - 1, arr_vec, k, xor_merge); - //the result arrangement is at index 0 + // the result arrangement is at index 0 this->m_arr = arr_vec[0].first; delete arr_vec[0].second; this->remove_redundant_edges(); @@ -1051,9 +1047,9 @@ protected: // thus this hack f = *(face_handles[(*uf_faces.find(face_handles[f->id()]))->id()]); if (h->flag() == ON_INNER_CCB) { - bool reuse_inner_ccb = !inner_ccbs_to_remove.empty(); - typename Dcel::Inner_ccb* inner_ccb = !reuse_inner_ccb? - accessor.new_inner_ccb():inner_ccbs_to_remove.back(); + bool reuse_inner_ccb = ! inner_ccbs_to_remove.empty(); + typename Dcel::Inner_ccb* inner_ccb = ! reuse_inner_ccb ? + accessor.new_inner_ccb() : inner_ccbs_to_remove.back(); if ( reuse_inner_ccb ) inner_ccbs_to_remove.pop_back(); Halfedge_handle hstart = h; @@ -1115,11 +1111,11 @@ protected: typename Traits_2::Compare_xy_2 comp_xy; public: - Less_vertex_handle (const typename Traits_2::Compare_xy_2& cmp) : + Less_vertex_handle(const typename Traits_2::Compare_xy_2& cmp) : comp_xy(cmp) {} - bool operator() (Vertex_handle v1, Vertex_handle v2) const + bool operator()(Vertex_handle v1, Vertex_handle v2) const { return (comp_xy (v1->point(), v2->point()) == SMALLER); } }; @@ -1136,7 +1132,7 @@ protected: } } - //fix the directions of the curves (given correct marked face) + // fixes the directions of the curves (given correct marked face) // it should be called mostly after symmetric_difference. void _fix_curves_direction(Aos_2& arr) { Compare_endpoints_xy_2 cmp_endpoints = @@ -1160,21 +1156,17 @@ protected: } void _build_sorted_vertices_vectors(std::vector& arr_vec) { - Less_vertex_handle comp (m_traits->compare_xy_2_object()); - Aos_2* p_arr; - Vertex_iterator vit; + Less_vertex_handle comp(m_traits->compare_xy_2_object()); const std::size_t n = arr_vec.size(); - std::size_t i, j; - - for (i = 0; i < n; i++) { - // Allocate a vector of handles to all vertices in the current - // arrangement. - p_arr = arr_vec[i].first; + for (std::size_t i = 0; i < n; i++) { + // Allocate a vector of handles to all vertices in the current arrangement. + Aos_2* p_arr = arr_vec[i].first; arr_vec[i].second = new std::vector; - arr_vec[i].second->resize (p_arr->number_of_vertices()); + arr_vec[i].second->resize(p_arr->number_of_vertices()); - for (j = 0, vit = p_arr->vertices_begin(); vit != p_arr->vertices_end(); j++, ++vit) { - (*(arr_vec[i].second))[j] = vit; + std::size_t j = 0; + for (auto vit = p_arr->vertices_begin(); vit != p_arr->vertices_end(); ++vit) { + (*(arr_vec[i].second))[j++] = vit; } // Sort the vector. @@ -1183,25 +1175,25 @@ protected: } template - void _divide_and_conquer(unsigned int lower, unsigned int upper, + void _divide_and_conquer(std::size_t lower, std::size_t upper, std::vector& arr_vec, - unsigned int k, Merge merge_func) { + std::size_t k, Merge merge_func) { if ((upper - lower) < k) { merge_func(lower, upper, 1, arr_vec); return; } - unsigned int sub_size = ((upper - lower + 1) / k); - unsigned int curr_lower = lower; + auto sub_size = ((upper - lower + 1) / k); + auto curr_lower = lower; - for (unsigned int i = 0; i < k - 1; ++i, curr_lower += sub_size) { + for (std::size_t i = 0; i < k - 1; ++i, curr_lower += sub_size) { _divide_and_conquer(curr_lower, curr_lower + sub_size-1, arr_vec, k, merge_func); } - _divide_and_conquer(curr_lower, upper,arr_vec, k, merge_func); - merge_func(lower, curr_lower, sub_size ,arr_vec); + _divide_and_conquer(curr_lower, upper, arr_vec, k, merge_func); + merge_func(lower, curr_lower, sub_size, arr_vec); } - // mark all faces as non-visited + // marks all faces as non-visited void _reset_faces() const { _reset_faces(m_arr); } void _reset_faces(Aos_2* arr) const { @@ -1250,7 +1242,7 @@ protected: GP_Holes_const_iterator> pair = m_traits->construct_holes_object()(pgn); return (unbounded && (pair.first == pair.second)); - //used to return + // used to return // (pgn.is_unbounded() && (pgn.holes_begin() == pgn.holes_end())) } @@ -1262,7 +1254,7 @@ protected: m_arr = res_arr; remove_redundant_edges(); - //fix_curves_direction(); // not needed for intersection + // fix_curves_direction(); // not needed for intersection CGAL_assertion(is_valid()); } @@ -1315,7 +1307,7 @@ protected: m_arr = res_arr; remove_redundant_edges(); - //fix_curves_direction(); // not needed for join + // fix_curves_direction(); // not needed for join CGAL_assertion(is_valid()); } @@ -1323,7 +1315,7 @@ protected: Gps_join_functor func; overlay(arr1, arr2, res, func); _remove_redundant_edges(&res); - //_fix_curves_direction(res); // not needed for join + // _fix_curves_direction(res); // not needed for join CGAL_assertion(_is_valid(res)); } diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_polygon_simplifier.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_polygon_simplifier.h index 224a3b9570c..0912d3dc17a 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_polygon_simplifier.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_polygon_simplifier.h @@ -8,7 +8,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // -// Author(s) : Baruch Zukerman +// Author(s) : Baruch Zukerman #ifndef CGAL_BSO_2_GPS_POLYGON_SIMPILFIER_H #define CGAL_BSO_2_GPS_POLYGON_SIMPILFIER_H @@ -31,34 +31,33 @@ namespace Ss2 = Surface_sweep_2; template class Gps_polygon_simplifier { - typedef Arrangement_ Arrangement_2; + using Arrangement_2 = Arrangement_; - typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2; - typedef typename Arrangement_2::Topology_traits Topology_traits; + using Geometry_traits_2 = typename Arrangement_2::Geometry_traits_2; + using Topology_traits = typename Arrangement_2::Topology_traits; - typedef Arrangement_2 Arr; - typedef Geometry_traits_2 Gt2; - typedef Topology_traits Tt; + using Arr = Arrangement_2; + using Gt2 = Geometry_traits_2; + using Tt = Topology_traits; - typedef typename Gt2::Curve_const_iterator Curve_const_iterator; - typedef typename Gt2::Polygon_2 Polygon_2; - typedef typename Gt2::Polygon_with_holes_2 Polygon_with_holes_2; - typedef typename Gt2::Construct_curves_2 Construct_curves_2; + using Curve_const_iterator = typename Gt2::Curve_const_iterator; + using Polygon_2 = typename Gt2::Polygon_2; + using Polygon_with_holes_2 = typename Gt2::Polygon_with_holes_2; + using Construct_curves_2 = typename Gt2::Construct_curves_2; - typedef Gps_simplifier_traits Mgt2; - typedef typename Mgt2::Curve_data Curve_data; - typedef typename Mgt2::X_monotone_curve_2 Meta_X_monotone_curve_2; + using Mgt2 = Gps_simplifier_traits; + using Curve_data = typename Mgt2::Curve_data; + using Meta_X_monotone_curve_2 = typename Mgt2::X_monotone_curve_2; - typedef typename Arr::Halfedge_handle Halfedge_handle; - typedef typename Arr::Halfedge_iterator Halfedge_iterator; - typedef typename Arr::Face_handle Face_handle; - typedef typename Arr::Face_iterator Face_iterator; - typedef typename Arr::Edge_iterator Edge_iterator; - typedef typename Arr::Vertex_handle Vertex_handle; - typedef typename Arr::Ccb_halfedge_const_circulator - Ccb_halfedge_const_circulator; - typedef typename Arr::Ccb_halfedge_circulator Ccb_halfedge_circulator; - typedef typename Arr::Allocator Allocator; + using Halfedge_handle = typename Arr::Halfedge_handle; + using Halfedge_iterator = typename Arr::Halfedge_iterator; + using Face_handle = typename Arr::Face_handle; + using Face_iterator = typename Arr::Face_iterator; + using Edge_iterator = typename Arr::Edge_iterator; + using Vertex_handle = typename Arr::Vertex_handle; + using Ccb_halfedge_const_circulator = typename Arr::Ccb_halfedge_const_circulator; + using Ccb_halfedge_circulator = typename Arr::Ccb_halfedge_circulator; + using Allocator = typename Arr::Allocator; // We obtain a proper helper type from the topology traits of the arrangement. // However, the arrangement is parametrized with the Gt2 geometry traits, @@ -67,22 +66,18 @@ class Gps_polygon_simplifier { // We cannot parameterized the arrangement with the Mgt2 geometry // traits to start with, because it extends the curve type with arrangement // dependent types. (It is parameterized with the arrangement type.) - typedef Indexed_event Event; - typedef Arr_construction_subcurve - Subcurve; - typedef typename Tt::template Construction_helper - Helper_tmp; - typedef typename Helper_tmp::template rebind::other - Helper; - typedef Gps_agg_op_base_visitor Visitor; - typedef Ss2::Surface_sweep_2 Surface_sweep_2; + using Event = Indexed_event; + using Subcurve = Arr_construction_subcurve; + using Helper_tmp = typename Tt::template Construction_helper; + using Helper = typename Helper_tmp::template rebind::other; + using Visitor = Gps_agg_op_base_visitor; + using Surface_sweep_2 = Ss2::Surface_sweep_2; - typedef Unique_hash_map - Edges_hash; + using Edges_hash = Unique_hash_map; - typedef Unique_hash_map Faces_hash; - typedef Gps_bfs_join_visitor Bfs_visitor; - typedef Gps_bfs_scanner Bfs_scanner; + using Faces_hash = Unique_hash_map; + using Bfs_visitor = Gps_bfs_join_visitor; + using Bfs_scanner = Gps_bfs_scanner; protected: Arr* m_arr; @@ -104,16 +99,14 @@ public: {} /*! Destructor. */ - ~Gps_polygon_simplifier() - { + ~Gps_polygon_simplifier() { if (m_own_traits && (m_traits != nullptr)) { delete m_traits; m_traits = nullptr; } } - void simplify(const Polygon_2& pgn) - { + void simplify(const Polygon_2& pgn) { Construct_curves_2 ctr_curves = reinterpret_cast(m_traits)->construct_curves_2_object(); @@ -122,14 +115,13 @@ public: std::pair itr_pair = ctr_curves(pgn); - unsigned int index = 0; + std::size_t index = 0; for (Curve_const_iterator itr = itr_pair.first; itr != itr_pair.second; - ++itr, ++index) - { + ++itr, ++index) { Curve_data cv_data(1, 0, index); curves_list.push_back(Meta_X_monotone_curve_2(*itr, cv_data)); } - m_traits->set_polygon_size(static_cast(curves_list.size())); + m_traits->set_polygon_size(curves_list.size()); m_surface_sweep.sweep(curves_list.begin(), curves_list.end()); 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 24b69369a43..4e8aa42d1f6 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 @@ -8,8 +8,8 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // -// Author(s): Baruch Zukerman -// Efi Fogel +// Author(s) : Baruch Zukerman +// Efi Fogel #ifndef CGAL_GPS_SIMPLIFIER_TRAITS_H #define CGAL_GPS_SIMPLIFIER_TRAITS_H @@ -23,97 +23,94 @@ namespace CGAL { class Gps_simplifier_curve_data { protected: - unsigned int m_bc; - unsigned int m_twin_bc; - unsigned int m_index; + std::size_t m_bc; + std::size_t m_twin_bc; + std::size_t m_index; public: Gps_simplifier_curve_data() {} - Gps_simplifier_curve_data(unsigned int bc, unsigned int twin_bc, - unsigned int index): + Gps_simplifier_curve_data(std::size_t bc, std::size_t twin_bc, + std::size_t index): m_bc(bc), m_twin_bc(twin_bc), m_index(index) {} - unsigned int bc() const { return m_bc; } + std::size_t bc() const { return m_bc; } - unsigned int twin_bc() const { return m_twin_bc; } + std::size_t twin_bc() const { return m_twin_bc; } - unsigned int index() const { return m_index; } + std::size_t index() const { return m_index; } - unsigned int& index() { return m_index; } + std::size_t& index() { return m_index; } - unsigned int& twin_bc() { return m_twin_bc; } + std::size_t& twin_bc() { return m_twin_bc; } - void set_bc(unsigned int bc) { m_bc = bc; } + void set_bc(std::size_t bc) { m_bc = bc; } - void set_twin_bc(unsigned int twin_bc) { m_twin_bc = twin_bc; } + void set_twin_bc(std::size_t twin_bc) { m_twin_bc = twin_bc; } - void set_index(unsigned int index) { m_index = index; } + void set_index(std::size_t index) { m_index = index; } }; struct Gps_simplifier_point_data { protected: - unsigned int m_index; + std::size_t m_index; public: Gps_simplifier_point_data() {} - Gps_simplifier_point_data(unsigned int index) : m_index(index) {} + Gps_simplifier_point_data(std::size_t index) : m_index(index) {} - unsigned int index() const { return m_index; } + std::size_t index() const { return m_index; } - void set_index(unsigned int index) { m_index = index; } + void set_index(std::size_t index) { m_index = index; } }; template class Gps_simplifier_traits : public Gps_traits_decorator -{ + Gps_simplifier_point_data> { public: - typedef Traits_ Traits; - typedef Gps_traits_decorator Base; - typedef Gps_simplifier_traits Self; - typedef typename Traits::X_monotone_curve_2 Base_x_monotone_curve_2; - typedef typename Traits::Point_2 Base_point_2; - typedef typename Traits::Construct_min_vertex_2 Base_Construct_min_vertex_2; - typedef typename Traits::Construct_max_vertex_2 Base_Construct_max_vertex_2; - typedef typename Traits::Compare_endpoints_xy_2 Base_Compare_endpoints_xy_2; - typedef typename Traits::Compare_xy_2 Base_Compare_xy_2; - typedef typename Traits::Compare_y_at_x_right_2 Base_Compare_y_at_x_right_2; - typedef typename Traits::Compare_y_at_x_2 Base_Compare_y_at_x_2; - typedef typename Traits::Intersect_2 Base_Intersect_2; - typedef typename Traits::Split_2 Base_Split_2; + using Traits = Traits_; + using Base = Gps_traits_decorator; + using Self = Gps_simplifier_traits; + using Base_x_monotone_curve_2 = typename Traits::X_monotone_curve_2; + using Base_point_2 = typename Traits::Point_2; + using Base_Construct_min_vertex_2 = typename Traits::Construct_min_vertex_2; + using Base_Construct_max_vertex_2 = typename Traits::Construct_max_vertex_2; + using Base_Compare_endpoints_xy_2 = typename Traits::Compare_endpoints_xy_2; + using Base_Compare_xy_2 = typename Traits::Compare_xy_2; + using Base_Compare_y_at_x_right_2 = typename Traits::Compare_y_at_x_right_2; + using Base_Compare_y_at_x_2 = typename Traits::Compare_y_at_x_2; + using Base_Intersect_2 = typename Traits::Intersect_2; + using Base_Split_2 = typename Traits::Split_2; protected: - mutable unsigned int m_pgn_size; + mutable std::size_t m_pgn_size; public: - typedef typename Base::X_monotone_curve_2 X_monotone_curve_2; - typedef typename Base::Point_2 Point_2; - typedef typename Base::Multiplicity Multiplicity; + using X_monotone_curve_2 = typename Base::X_monotone_curve_2; + using Point_2 = typename Base::Point_2; + using Multiplicity = typename Base::Multiplicity; - typedef typename Base::Curve_data Curve_data; - typedef typename Base::Point_data Point_data; + using Curve_data = typename Base::Curve_data; + using Point_data = typename Base::Point_data; Gps_simplifier_traits() {} Gps_simplifier_traits(const Traits& tr) : Base(tr) {} - unsigned int polygon_size() const { return m_pgn_size; } + std::size_t polygon_size() const { return m_pgn_size; } - void set_polygon_size(unsigned int pgn_size) const { m_pgn_size = pgn_size; } + void set_polygon_size(std::size_t pgn_size) const { m_pgn_size = pgn_size; } - bool is_valid_index(unsigned int index) const + bool is_valid_index(std::size_t index) const { return (index < m_pgn_size); } - unsigned int invalid_index() const { return (m_pgn_size); } + std::size_t invalid_index() const { return (m_pgn_size); } class Intersect_2 { private: @@ -129,12 +126,9 @@ public: template OutputIterator operator()(const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2, - OutputIterator oi) const - { - typedef const std::pair - Intersection_base_point; - typedef std::variant - Intersection_base_result; + OutputIterator oi) const { + using Intersection_base_point = const std::pair; + using Intersection_base_result = std::variant; const auto* base_traits = m_traits.m_base_traits; auto base_cmp_xy = base_traits->compare_xy_2_object(); @@ -146,7 +140,7 @@ public: //if (m_traits.is_valid_index(cv1.data().index()) && // m_traits.is_valid_index(cv2.data().index())) //{ - // unsigned int index_diff = + // std::size_t index_diff = // (cv1.data().index() > cv2.data().index()) ? // (cv1.data().index() - cv2.data().index()): // (cv2.data().index() - cv1.data().index()); @@ -180,8 +174,8 @@ public: std::get_if(&xection); CGAL_assertion(overlap_cv != nullptr); - unsigned int ov_bc; - unsigned int ov_twin_bc; + std::size_t ov_bc; + std::size_t ov_twin_bc; if (base_cmp_endpoints(cv1) == base_cmp_endpoints(cv2)) { // cv1 and cv2 have the same directions ov_bc = cv1.data().bc() + cv2.data().bc(); @@ -207,7 +201,7 @@ public: }; /*! Obtain an Intersect_2 functor object. */ - Intersect_2 intersect_2_object () const { return Intersect_2(*this); } + Intersect_2 intersect_2_object() const { return Intersect_2(*this); } class Split_2 { private: @@ -250,8 +244,7 @@ public: * \param cv The curve. * \return The left endpoint. */ - Point_2 operator()(const X_monotone_curve_2 & cv) const - { + Point_2 operator()(const X_monotone_curve_2 & cv) const { const auto* base_traits = m_traits.m_base_traits; auto base_ctr_min_vertex = base_traits->construct_min_vertex_2_object(); @@ -290,8 +283,7 @@ public: * \param cv The curve. * \return The left endpoint. */ - Point_2 operator() (const X_monotone_curve_2 & cv) const - { + Point_2 operator() (const X_monotone_curve_2 & cv) const { const auto* base_traits = m_traits.m_base_traits; auto base_ctr_max_vertex = base_traits->construct_max_vertex_2_object(); if (! m_traits.is_valid_index(cv.data().index())) @@ -329,8 +321,7 @@ public: * \param cv The curve. * \return The left endpoint. */ - Comparison_result operator()(const Point_2& p1, const Point_2& p2) const - { + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { const auto* base_traits = m_traits.m_base_traits; auto base_cmp_xy = base_traits->compare_xy_2_object(); diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Indexed_event.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Indexed_event.h index 3203bbbd7bb..384080956a6 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Indexed_event.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Indexed_event.h @@ -32,17 +32,16 @@ class Indexed_event : Arrangement_, Allocator_>, Allocator_>, - Arrangement_> -{ + Arrangement_> { private: - unsigned int m_index; + std::size_t m_index; public: Indexed_event() : m_index (0) {} - unsigned int index() const { return (m_index); } + std::size_t index() const { return (m_index); } - void set_index(unsigned int index) { m_index = index; } + void set_index(std::size_t index) { m_index = index; } }; } // namespace CGAL 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 a9baafe8fa3..66c9852607d 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 @@ -201,13 +201,13 @@ inline bool do_intersect(const General_polygon_with_holes_2& pgn1, // With Traits template inline bool do_intersect(InputIterator begin, InputIterator end, Traits& traits, - unsigned int k = 5, + std::size_t k = 5, std::enable_if_t::value>* = 0) { return r_do_intersect(begin, end, traits, k); } // Without Traits template -inline bool do_intersect(InputIterator begin, InputIterator end, unsigned int k = 5, +inline bool do_intersect(InputIterator begin, InputIterator end, std::size_t k = 5, std::enable_if_t::value>* = 0, Enable_if_Polygon_2_iterator* = 0) { typename Iterator_to_gps_traits::Traits traits; @@ -217,7 +217,7 @@ inline bool do_intersect(InputIterator begin, InputIterator end, unsigned int k // General polygons or polygons with holes template inline bool do_intersect(InputIterator begin, InputIterator end, - unsigned int k = 5, + std::size_t k = 5, std::enable_if_t::value>* = 0, Disable_if_Polygon_2_iterator* = 0) { typename Iterator_to_gps_traits::Traits traits; @@ -228,14 +228,14 @@ inline bool do_intersect(InputIterator begin, InputIterator end, template inline bool do_intersect(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, InputIterator2 end2, - Traits& traits, unsigned int k = 5) + Traits& traits, std::size_t k = 5) { return r_do_intersect(begin1, end1, begin2, end2, traits, k); } // Without Traits template inline bool do_intersect(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, InputIterator2 end2, - unsigned int k = 5, + std::size_t k = 5, Enable_if_Polygon_2_iterator* = 0) { return r_do_intersect(begin1, end1, begin2, end2, k); } @@ -243,7 +243,7 @@ inline bool do_intersect(InputIterator1 begin1, InputIterator1 end1, template inline bool do_intersect(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, InputIterator2 end2, - unsigned int k = 5, + std::size_t k = 5, Disable_if_Polygon_2_iterator* = 0) { typename Iterator_to_gps_traits::Traits traits; return r_do_intersect(begin1, end1, begin2, end2, traits, k); 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 180fe406107..d9696c926ae 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 @@ -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_INTERSECTION_H #define CGAL_BOOLEAN_SET_OPERATIONS_2_INTERSECTION_H @@ -33,8 +33,7 @@ #include #include -namespace CGAL -{ +namespace CGAL { /// \name intersection() functions. //@{ @@ -59,10 +58,9 @@ inline OutputIterator intersection(const Polygon_2& pgn1, template inline OutputIterator intersection(const Polygon_2& pgn1, const Polygon_2& pgn2, - OutputIterator out, Tag_false) -{ + OutputIterator out, Tag_false) { // Use the first polygon to determine the (default) traits - typedef Polygon_2 Polygon; + using Polygon = Polygon_2; typename Gps_default_traits::Traits traits; return s_intersection(pgn1, pgn2, out, traits); } @@ -90,10 +88,9 @@ template inline OutputIterator intersection(const Polygon_2& pgn1, const Polygon_with_holes_2& pgn2, - OutputIterator out, Tag_false) -{ + OutputIterator out, Tag_false) { // Use the first polygon to determine the (default) traits - typedef Polygon_2 Polygon; + using Polygon = Polygon_2; typename Gps_default_traits::Traits traits; return s_intersection(pgn1, pgn2, out, traits); } @@ -121,10 +118,9 @@ template inline OutputIterator intersection(const Polygon_with_holes_2& pgn1, const Polygon_2& pgn2, - OutputIterator out, Tag_false) -{ + OutputIterator out, Tag_false) { // Use the first polygon to determine the (default) traits - typedef Polygon_with_holes_2 Polygon_with_holes; + using Polygon_with_holes = Polygon_with_holes_2; typename Gps_default_traits::Traits traits; return s_intersection(pgn1, pgn2, out, traits); } @@ -152,10 +148,9 @@ template inline OutputIterator intersection(const Polygon_with_holes_2& pgn1, const Polygon_with_holes_2& pgn2, - OutputIterator out, Tag_false) -{ + OutputIterator out, Tag_false) { // Use the first polygon to determine the (default) traits - typedef Polygon_with_holes_2 Polygon_with_holes; + using Polygon_with_holes = Polygon_with_holes_2; typename Gps_default_traits::Traits traits; return s_intersection(pgn1, pgn2, out, traits); } @@ -172,10 +167,9 @@ inline OutputIterator intersection(const General_polygon_2& pgn1, template inline OutputIterator intersection(const General_polygon_2& pgn1, const General_polygon_2& pgn2, - OutputIterator out) -{ + OutputIterator out) { // Use the first polygon to determine the (default) traits - typedef General_polygon_2 Polygon; + using Polygon = General_polygon_2; typename Gps_default_traits::Traits traits; return s_intersection(pgn1, pgn2, out, traits); } @@ -194,10 +188,9 @@ template inline OutputIterator intersection(const General_polygon_2& pgn1, const General_polygon_with_holes_2 >& pgn2, - OutputIterator out) -{ + OutputIterator out) { // Use the first polygon to determine the (default) traits - typedef General_polygon_2 Polygon; + using Polygon = General_polygon_2; typename Gps_default_traits::Traits traits; return s_intersection(pgn1, pgn2, out, traits); } @@ -216,11 +209,10 @@ template inline OutputIterator intersection(const General_polygon_with_holes_2 >& pgn1, const General_polygon_2& pgn2, - OutputIterator out) -{ + OutputIterator out) { // Use the first polygon to determine the (default) traits - typedef General_polygon_2 Polygon; - typedef General_polygon_with_holes_2 Polygon_with_holes; + using Polygon = General_polygon_2; + using Polygon_with_holes = General_polygon_with_holes_2; typename Gps_default_traits::Traits traits; return s_intersection(pgn1, pgn2, out, traits); } @@ -239,10 +231,9 @@ template inline OutputIterator intersection(const General_polygon_with_holes_2& pgn1, const General_polygon_with_holes_2& pgn2, - OutputIterator out) -{ + OutputIterator out) { // Use the first polygon to determine the (default) traits - typedef General_polygon_with_holes_2 Polygon_with_holes; + using Polygon_with_holes = General_polygon_with_holes_2; typename Gps_default_traits::Traits traits; return s_intersection(pgn1, pgn2, out, traits); } @@ -256,7 +247,7 @@ intersection(const General_polygon_with_holes_2& pgn1, template inline OutputIterator intersection(InputIterator begin, InputIterator end, OutputIterator oi, Traits& traits, - unsigned int k=5) + std::size_t k = 5) { return r_intersection(begin, end, oi, traits, k); } // Without Traits @@ -265,7 +256,7 @@ template inline OutputIterator intersection(InputIterator begin, InputIterator end, OutputIterator oi, Tag_true = Tag_true(), - unsigned int k=5, + std::size_t k = 5, Enable_if_Polygon_2_iterator* = 0) { return r_intersection(begin, end, oi, k); } @@ -273,9 +264,8 @@ intersection(InputIterator begin, InputIterator end, template inline OutputIterator intersection(InputIterator begin, InputIterator end, - OutputIterator oi, Tag_false, unsigned int k=5, - Enable_if_Polygon_2_iterator* = 0) -{ + OutputIterator oi, Tag_false, std::size_t k = 5, + Enable_if_Polygon_2_iterator* = 0) { typename Iterator_to_gps_traits::Traits traits; return r_intersection(begin, end, oi, traits, k); } @@ -284,11 +274,10 @@ intersection(InputIterator begin, InputIterator end, template inline OutputIterator intersection(InputIterator begin, InputIterator end, - OutputIterator oi, unsigned int k=5, + OutputIterator oi, std::size_t k = 5, // workaround to avoid ambiguous calls with kernel functions std::enable_if_t::value>* = 0, - Disable_if_Polygon_2_iterator* = 0) -{ + Disable_if_Polygon_2_iterator* = 0) { typename Iterator_to_gps_traits::Traits traits; return r_intersection(begin, end, oi, traits, k); } @@ -300,7 +289,7 @@ template * = 0) { return r_intersection(begin1, end1, begin2, end2, oi, k); } @@ -320,9 +309,8 @@ template * = 0) -{ + OutputIterator oi, Tag_false, std::size_t k = 5, + Enable_if_Polygon_2_iterator* = 0) { typename Iterator_to_gps_traits::Traits traits; return r_intersection(begin1, end1, begin2, end2, oi, traits, k); } @@ -333,9 +321,8 @@ template * = 0) -{ + OutputIterator oi, std::size_t k = 5, + Disable_if_Polygon_2_iterator* = 0) { typename Iterator_to_gps_traits::Traits traits; return r_intersection(begin1, end1, begin2, end2, oi, traits, k); } 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 9ec9ea2527d..b3601681119 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 @@ -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_JOIN_H #define CGAL_BOOLEAN_SET_OPERATIONS_2_JOIN_H @@ -33,8 +33,7 @@ #include #include -namespace CGAL -{ +namespace CGAL { /// \name join() functions. //@{ @@ -60,10 +59,9 @@ template inline bool join(const Polygon_2& pgn1, const Polygon_2& pgn2, Polygon_with_holes_2& res, - Tag_false) -{ + Tag_false) { // Use the first polygon to determine the (default) traits - typedef Polygon_2 Polygon; + using Polygon = Polygon_2; typename Gps_default_traits::Traits traits; return s_join(pgn1, pgn2, res, traits); } @@ -89,10 +87,9 @@ template inline bool join(const Polygon_2& pgn1, const Polygon_with_holes_2& pgn2, Polygon_with_holes_2& res, - Tag_false) -{ + Tag_false) { // Use the first polygon to determine the (default) traits - typedef Polygon_2 Polygon; + using Polygon = Polygon_2; typename Gps_default_traits::Traits traits; return s_join(pgn1, pgn2, res, traits); } @@ -118,10 +115,9 @@ template inline bool join(const Polygon_with_holes_2& pgn1, const Polygon_2& pgn2, Polygon_with_holes_2& res, - Tag_false) -{ + Tag_false) { // Use the first polygon to determine the (default) traits - typedef Polygon_with_holes_2 Polygon_with_holes; + using Polygon_with_holes = Polygon_with_holes_2; typename Gps_default_traits::Traits traits; return s_join(pgn1, pgn2, res, traits); } @@ -147,10 +143,9 @@ template inline bool join(const Polygon_with_holes_2& pgn1, const Polygon_with_holes_2& pgn2, Polygon_with_holes_2& res, - Tag_false) -{ + Tag_false) { // Use the first polygon to determine the (default) traits - typedef Polygon_with_holes_2 Polygon_with_holes; + using Polygon_with_holes = Polygon_with_holes_2; typename Gps_default_traits::Traits traits; return s_join(pgn1, pgn2, res, traits); } @@ -170,10 +165,9 @@ template inline bool join(const General_polygon_2& pgn1, const General_polygon_2& pgn2, - General_polygon_with_holes_2 >& res) -{ + General_polygon_with_holes_2 >& res) { // Use the first polygon to determine the (default) traits - typedef General_polygon_2 Polygon; + using Polygon = General_polygon_2; typename Gps_default_traits::Traits traits; return s_join(pgn1, pgn2, res, traits); } @@ -193,10 +187,9 @@ template inline bool join(const General_polygon_2& pgn1, const General_polygon_with_holes_2 >& pgn2, - General_polygon_with_holes_2 >& res) -{ + General_polygon_with_holes_2 >& res) { // Use the first polygon to determine the (default) traits - typedef General_polygon_2 Polygon; + using Polygon = General_polygon_2; typename Gps_default_traits::Traits traits; return s_join(pgn1, pgn2, res, traits); } @@ -216,11 +209,10 @@ template inline bool join(const General_polygon_with_holes_2 >& pgn1, const General_polygon_2& pgn2, - General_polygon_with_holes_2 >& res) -{ + General_polygon_with_holes_2 >& res) { // Use the first polygon to determine the (default) traits - typedef General_polygon_2 Polygon; - typedef General_polygon_with_holes_2 Polygon_with_holes; + using Polygon = General_polygon_2; + using Polygon_with_holes = General_polygon_with_holes_2; typename Gps_default_traits::Traits traits; return s_join(pgn1, pgn2, res, traits); } @@ -237,10 +229,9 @@ inline bool join(const General_polygon_with_holes_2& pgn1, template inline bool join(const General_polygon_with_holes_2& pgn1, const General_polygon_with_holes_2& pgn2, - General_polygon_with_holes_2& res) -{ + General_polygon_with_holes_2& res) { // Use the first polygon to determine the (default) traits - typedef General_polygon_with_holes_2 Polygon_with_holes; + using Polygon_with_holes = General_polygon_with_holes_2; typename Gps_default_traits::Traits traits; return s_join(pgn1, pgn2, res, traits); } @@ -253,7 +244,7 @@ inline bool join(const General_polygon_with_holes_2& pgn1, // With Traits template inline OutputIterator join(InputIterator begin, InputIterator end, - OutputIterator oi, Traits& traits, unsigned int k=5) + OutputIterator oi, Traits& traits, std::size_t k = 5) { return r_join(begin, end, oi, traits, k); } // Without Traits @@ -261,16 +252,15 @@ inline OutputIterator join(InputIterator begin, InputIterator end, template inline OutputIterator join(InputIterator begin, InputIterator end, OutputIterator oi, Tag_true = Tag_true(), - unsigned int k=5, + std::size_t k = 5, Enable_if_Polygon_2_iterator* = 0) { return r_join(begin, end, oi, k); } // Tag_false => do not convert to polylines template inline OutputIterator join(InputIterator begin, InputIterator end, - OutputIterator oi, Tag_false, unsigned int k=5, - Enable_if_Polygon_2_iterator* = 0) -{ + OutputIterator oi, Tag_false, std::size_t k = 5, + Enable_if_Polygon_2_iterator* = 0) { typename Iterator_to_gps_traits::Traits traits; return r_join(begin, end, oi, traits, k); } @@ -278,9 +268,8 @@ inline OutputIterator join(InputIterator begin, InputIterator end, // General polygons or polygons with holes template inline OutputIterator join(InputIterator begin, InputIterator end, - OutputIterator oi, unsigned int k=5, - Disable_if_Polygon_2_iterator* = 0) -{ + OutputIterator oi, std::size_t k = 5, + Disable_if_Polygon_2_iterator* = 0) { typename Iterator_to_gps_traits::Traits traits; return r_join(begin, end, oi, traits, k); } @@ -291,7 +280,7 @@ template inline OutputIterator join(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, InputIterator2 end2, - OutputIterator oi, Traits& traits, unsigned int k=5) + OutputIterator oi, Traits& traits, std::size_t k = 5) { return r_join(begin1, end1, begin2, end2, oi, traits, k); } // Without Traits @@ -301,7 +290,7 @@ template * = 0) { return r_join(begin1, end1, begin2, end2, oi, k); } @@ -310,9 +299,8 @@ template inline OutputIterator join(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, InputIterator2 end2, - OutputIterator oi, Tag_false, unsigned int k=5, - Enable_if_Polygon_2_iterator* = 0) -{ + OutputIterator oi, Tag_false, std::size_t k = 5, + Enable_if_Polygon_2_iterator* = 0) { typename Iterator_to_gps_traits::Traits traits; return r_join(begin1, end1, begin2, end2, oi, traits, k); } @@ -322,9 +310,8 @@ template inline OutputIterator join(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, InputIterator2 end2, - OutputIterator oi, unsigned int k=5, - Disable_if_Polygon_2_iterator* = 0) -{ + OutputIterator oi, std::size_t k = 5, + Disable_if_Polygon_2_iterator* = 0) { typename Iterator_to_gps_traits::Traits traits; return r_join(begin1, end1, begin2, end2, oi, traits, k); } 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 dfe0297dcde..b59716a772c 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 @@ -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_SYMMETRIC_DIFFERENCE_H #define CGAL_BOOLEAN_SET_OPERATIONS_SYMMETRIC_DIFFERENCE_H @@ -33,8 +33,7 @@ #include #include -namespace CGAL -{ +namespace CGAL { /// \name symmetric_difference() functions. //@{ @@ -62,10 +61,9 @@ template inline OutputIterator symmetric_difference(const Polygon_2& pgn1, const Polygon_2& pgn2, - OutputIterator oi, Tag_false) -{ + OutputIterator oi, Tag_false) { // Use the first polygon to determine the (default) traits - typedef Polygon_2 Polygon; + using Polygon = Polygon_2; typename Gps_default_traits::Traits traits; return s_symmetric_difference(pgn1, pgn2, oi, traits); } @@ -93,10 +91,9 @@ template inline OutputIterator symmetric_difference(const Polygon_2& pgn1, const Polygon_with_holes_2& pgn2, - OutputIterator oi, Tag_false) -{ + OutputIterator oi, Tag_false) { // Use the first polygon to determine the (default) traits - typedef Polygon_2 Polygon; + using Polygon = Polygon_2; typename Gps_default_traits::Traits traits; return s_symmetric_difference(pgn1, pgn2, oi, traits); } @@ -124,10 +121,9 @@ template inline OutputIterator symmetric_difference(const Polygon_with_holes_2& pgn1, const Polygon_2& pgn2, - OutputIterator oi, Tag_false) -{ + OutputIterator oi, Tag_false) { // Use the first polygon to determine the (default) traits - typedef Polygon_with_holes_2 Polygon_with_holes; + using Polygon_with_holes = Polygon_with_holes_2; typename Gps_default_traits::Traits traits; return s_symmetric_difference(pgn1, pgn2, oi, traits); } @@ -155,10 +151,9 @@ template inline OutputIterator symmetric_difference(const Polygon_with_holes_2& pgn1, const Polygon_with_holes_2& pgn2, - OutputIterator oi, Tag_false) -{ + OutputIterator oi, Tag_false) { // Use the first polygon to determine the (default) traits - typedef Polygon_with_holes_2 Polygon_with_holes; + using Polygon_with_holes = Polygon_with_holes_2; typename Gps_default_traits::Traits traits; return s_symmetric_difference(pgn1, pgn2, oi, traits); } @@ -176,10 +171,9 @@ template inline OutputIterator symmetric_difference(const General_polygon_2& pgn1, const General_polygon_2& pgn2, - OutputIterator oi) -{ + OutputIterator oi) { // Use the first polygon to determine the (default) traits - typedef General_polygon_2 Polygon; + using Polygon = General_polygon_2; typename Gps_default_traits::Traits traits; return s_symmetric_difference(pgn1, pgn2, oi, traits); } @@ -200,10 +194,9 @@ inline OutputIterator symmetric_difference(const General_polygon_2& pgn1, const General_polygon_with_holes_2 >& pgn2, - OutputIterator oi) -{ + OutputIterator oi) { // Use the first polygon to determine the (default) traits - typedef General_polygon_2 Polygon; + using Polygon = General_polygon_2; typename Gps_default_traits::Traits traits; return s_symmetric_difference(pgn1, pgn2, oi, traits); } @@ -224,11 +217,10 @@ inline OutputIterator symmetric_difference(const General_polygon_with_holes_2 >& pgn1, const General_polygon_2& pgn2, - OutputIterator oi) -{ + OutputIterator oi) { // Use the first polygon to determine the (default) traits - typedef General_polygon_2 Polygon; - typedef General_polygon_with_holes_2 Polygon_with_holes; + using Polygon = General_polygon_2; + using Polygon_with_holes = General_polygon_with_holes_2; typename Gps_default_traits::Traits traits; return s_symmetric_difference(pgn1, pgn2, oi, traits); } @@ -247,9 +239,8 @@ template inline OutputIterator symmetric_difference(const General_polygon_with_holes_2& pgn1, const General_polygon_with_holes_2& pgn2, - OutputIterator oi) -{ - typedef General_polygon_with_holes_2 Polygon_with_holes; + OutputIterator oi) { + using Polygon_with_holes = General_polygon_with_holes_2; typename Gps_default_traits::Traits traits; return s_symmetric_difference(pgn1, pgn2, oi, traits); } @@ -264,7 +255,7 @@ template inline OutputIterator symmetric_difference(InputIterator begin, InputIterator end, OutputIterator oi, Traits& traits, - unsigned int k=5) + std::size_t k = 5) { return r_symmetric_difference(begin, end, oi, traits, k); } // Without Traits @@ -272,7 +263,7 @@ OutputIterator symmetric_difference(InputIterator begin, InputIterator end, template inline OutputIterator symmetric_difference(InputIterator begin, InputIterator end, - OutputIterator oi, Tag_true = Tag_true(), unsigned int k=5, + OutputIterator oi, Tag_true = Tag_true(), std::size_t k = 5, Enable_if_Polygon_2_iterator* = 0) { return r_symmetric_difference(begin, end, oi, k); } @@ -280,9 +271,8 @@ symmetric_difference(InputIterator begin, InputIterator end, template inline OutputIterator symmetric_difference(InputIterator begin, InputIterator end, - OutputIterator oi, Tag_false, unsigned int k=5, - Enable_if_Polygon_2_iterator* = 0) -{ + OutputIterator oi, Tag_false, std::size_t k = 5, + Enable_if_Polygon_2_iterator* = 0) { typename Iterator_to_gps_traits::Traits traits; return r_symmetric_difference(begin, end, oi, traits, k); } @@ -291,9 +281,8 @@ symmetric_difference(InputIterator begin, InputIterator end, template inline OutputIterator symmetric_difference(InputIterator begin, InputIterator end, - OutputIterator oi, unsigned int k=5, - Disable_if_Polygon_2_iterator* = 0) -{ + OutputIterator oi, std::size_t k = 5, + Disable_if_Polygon_2_iterator* = 0) { typename Iterator_to_gps_traits::Traits traits; return r_symmetric_difference(begin, end, oi, traits, k); } @@ -306,7 +295,7 @@ inline OutputIterator symmetric_difference(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, InputIterator2 end2, OutputIterator oi, Traits& traits, - unsigned int k=5) + std::size_t k = 5) { return r_symmetric_difference(begin1, end1, begin2, end2, oi, traits, k); } // Without Traits @@ -316,7 +305,7 @@ template * = 0) { return r_symmetric_difference(begin1, end1, begin2, end2, oi, k); } @@ -326,9 +315,8 @@ template * = 0) -{ + OutputIterator oi, Tag_false, std::size_t k = 5, + Enable_if_Polygon_2_iterator* = 0) { typename Iterator_to_gps_traits::Traits traits; return r_symmetric_difference(begin1, end1, begin2, end2, oi, traits, k); } @@ -339,9 +327,8 @@ template * = 0) -{ + OutputIterator oi, std::size_t k = 5, + Disable_if_Polygon_2_iterator* = 0) { typename Iterator_to_gps_traits::Traits traits; return r_symmetric_difference(begin1, end1, begin2, end2, oi, traits, k); } diff --git a/Boolean_set_operations_2/include/CGAL/General_polygon_set_2.h b/Boolean_set_operations_2/include/CGAL/General_polygon_set_2.h index 8ab14d4566b..88af2b5eae7 100644 --- a/Boolean_set_operations_2/include/CGAL/General_polygon_set_2.h +++ b/Boolean_set_operations_2/include/CGAL/General_polygon_set_2.h @@ -7,8 +7,8 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// Author(s): Baruch Zukerman -// Efi Fogel +// Author(s) : Baruch Zukerman +// Efi Fogel #ifndef CGAL_GENERAL_POLYGON_SET_2_H #define CGAL_GENERAL_POLYGON_SET_2_H 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 38b40217451..5941ab1121e 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 @@ -257,45 +257,25 @@ void test_CGAL_Polygon_variants() Traits tr; CGAL::do_intersect(pgn1, pgn2); - CGAL::do_intersect(pgn1, pgn2, CGAL::Tag_true()); - CGAL::do_intersect(pgn1, pgn2, CGAL::Tag_false()); CGAL::do_intersect(pgn1, pgn2, tr); CGAL::do_intersect(pgn1, pgn_with_holes2); - CGAL::do_intersect(pgn1, pgn_with_holes2, CGAL::Tag_true()); - CGAL::do_intersect(pgn1, pgn_with_holes2, CGAL::Tag_false()); CGAL::do_intersect(pgn1, pgn_with_holes2, tr); CGAL::do_intersect(pgn_with_holes1, pgn2); - CGAL::do_intersect(pgn_with_holes1, pgn2, CGAL::Tag_true()); - CGAL::do_intersect(pgn_with_holes1, pgn2, CGAL::Tag_false()); CGAL::do_intersect(pgn_with_holes1, pgn2, tr); CGAL::do_intersect(pgn_with_holes1, pgn_with_holes2); - CGAL::do_intersect(pgn_with_holes1, pgn_with_holes2, CGAL::Tag_true()); - CGAL::do_intersect(pgn_with_holes1, pgn_with_holes2, CGAL::Tag_false()); CGAL::do_intersect(pgn_with_holes1, pgn_with_holes2, tr); CGAL::do_intersect(polygons.begin(), polygons.end()); - CGAL::do_intersect(polygons.begin(), polygons.end(), CGAL::Tag_true()); - CGAL::do_intersect(polygons.begin(), polygons.end(), CGAL::Tag_false()); CGAL::do_intersect(polygons.begin(), polygons.end(), tr); CGAL::do_intersect(polygons_with_holes.begin(), polygons_with_holes.end()); - CGAL::do_intersect(polygons_with_holes.begin(), polygons_with_holes.end(), - CGAL::Tag_true()); - CGAL::do_intersect(polygons_with_holes.begin(), polygons_with_holes.end(), - CGAL::Tag_false()); CGAL::do_intersect(polygons_with_holes.begin(), polygons_with_holes.end(), tr); CGAL::do_intersect(polygons.begin(), polygons.end(), polygons_with_holes.begin(), polygons_with_holes.end()); - CGAL::do_intersect(polygons.begin(), polygons.end(), - polygons_with_holes.begin(), polygons_with_holes.end(), - CGAL::Tag_true()); - CGAL::do_intersect(polygons.begin(), polygons.end(), - polygons_with_holes.begin(), polygons_with_holes.end(), - CGAL::Tag_false()); CGAL::do_intersect(polygons.begin(), polygons.end(), polygons_with_holes.begin(), polygons_with_holes.end(), tr);