From ae0119471262c306cfac8934d75a1a17060f9e4c Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Thu, 15 Jun 2017 16:19:00 +0300 Subject: [PATCH] Changed Surface_sweep_2 and No_intersection_surface_sweep_2 to be templates parameterized only by visitors. --- .../include/CGAL/Arr_batched_point_location.h | 8 +- .../Arr_bounded_planar_topology_traits_2.h | 54 ++++-- .../include/CGAL/Arr_overlay_2.h | 6 +- .../CGAL/Arr_spherical_topology_traits_2.h | 54 ++++-- .../Arr_bounded_planar_batched_pl_helper.h | 7 +- .../Arr_bounded_planar_construction_helper.h | 7 +- .../Arr_bounded_planar_insertion_helper.h | 8 +- .../Arr_bounded_planar_overlay_helper.h | 12 +- .../Arr_bounded_planar_vert_decomp_helper.h | 13 +- .../Arr_spherical_batched_pl_helper.h | 6 +- .../Arr_spherical_construction_helper.h | 9 +- .../Arr_spherical_insertion_helper.h | 8 +- .../Arr_spherical_vert_decomp_helper.h | 23 ++- .../Arr_unb_planar_batched_pl_helper.h | 9 +- .../Arr_unb_planar_construction_helper.h | 9 +- .../Arr_unb_planar_insertion_helper.h | 10 +- .../Arr_unb_planar_overlay_helper.h | 5 +- .../Arr_unb_planar_vert_decomp_helper.h | 9 +- .../CGAL/Arr_unb_planar_topology_traits_2.h | 54 ++++-- .../CGAL/Arr_vertical_decomposition_2.h | 5 +- .../Arrangement_on_surface_2_global.h | 43 ++--- .../CGAL/No_intersection_surface_sweep_2.h | 23 ++- .../include/CGAL/Surface_sweep_2.h | 26 +-- .../Arr_batched_pl_sl_visitor.h | 48 ++++-- .../Arr_construction_sl_visitor.h | 151 ++++++++--------- .../Arr_insertion_sl_visitor.h | 50 +++--- .../Surface_sweep_2/Arr_insertion_traits_2.h | 15 +- ...Arr_no_intersection_insertion_sl_visitor.h | 109 ++++++------ .../Surface_sweep_2/Arr_overlay_sl_visitor.h | 137 ++++++++------- .../Arr_vert_decomp_sl_visitor.h | 41 +++-- .../CGAL/Surface_sweep_2/Default_subcurve.h | 2 +- .../No_intersection_surface_sweep_2_impl.h | 157 ++++++++---------- .../CGAL/Surface_sweep_2/No_overlap_event.h | 3 +- .../Surface_sweep_2/No_overlap_subcurve.h | 6 +- .../Surface_sweep_2/Surface_sweep_2_impl.h | 81 ++++----- .../Surface_sweep_2_visitors.h | 68 ++++---- .../Visitor.h} | 126 ++++++-------- .../include/CGAL/Surface_sweep_2_algorithms.h | 17 +- 38 files changed, 707 insertions(+), 712 deletions(-) rename Surface_sweep_2/include/CGAL/{Surface_sweep_empty_visitor.h => Surface_sweep_2/Visitor.h} (62%) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h index 3719514d739..60a703b0b75 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h @@ -47,8 +47,8 @@ namespace Ss2 = Surface_sweep_2; * Face_const_handle> >. * It represents the arrangement feature containing the point. */ -template +template OutputIterator locate(const Arrangement_on_surface_2& arr, PointsIterator points_begin, PointsIterator points_end, @@ -123,9 +123,7 @@ locate(const Arrangement_on_surface_2& arr, // Define the sweep-line visitor and perform the sweep. Bpl_visitor visitor(&arr, oi); - Ss2::No_intersection_surface_sweep_2 + Ss2::No_intersection_surface_sweep_2 surface_sweep(&ex_traits, &visitor); surface_sweep.sweep(xcurves_vec.begin(), xcurves_vec.end(), // Curves. iso_pts_vec.begin(), iso_pts_vec.end(), // Action points. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h index bcf63bc1294..a541addea74 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h @@ -12,9 +12,9 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// Author(s) : Ron Wein -// Efi Fogel -// Eric Berberich +// Author(s) : Ron Wein +// Efi Fogel +// Eric Berberich #ifndef CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_H #define CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_H @@ -301,17 +301,24 @@ public: typedef Arr_no_intersection_insertion_sl_visitor Surface_sweep_no_intersection_insertion_visitor; - template + /*! \class Surface_sweep_batched_point_location_visitor + */ + template struct Surface_sweep_batched_point_location_visitor : - public Arr_batched_pl_sl_visitor + public Arr_batched_pl_sl_visitor< + BplHelper, OutputIterator, + Surface_sweep_batched_point_location_visitor > { - typedef OutputIterator_ Output_iterator; + typedef OutputIterator Output_iterator; - typedef Arr_batched_pl_sl_visitor + typedef Surface_sweep_batched_point_location_visitor + Self; + typedef Arr_batched_pl_sl_visitor Base; - typedef typename Base::Geometry_traits_2 Geometry_traits_2; - typedef typename Base::Event Event; - typedef typename Base::Subcurve Subcurve; + + typedef typename BplHelper::Geometry_traits_2 Geometry_traits_2; + typedef typename BplHelper::Event Event; + typedef typename BplHelper::Subcurve Subcurve; Surface_sweep_batched_point_location_visitor(const Arr* arr, Output_iterator& oi) : @@ -319,13 +326,20 @@ public: {} }; - template + /*! \class Surface_sweep_vertical_decomposition_visitor + */ + template struct Surface_sweep_vertical_decomposition_visitor : - public Arr_vert_decomp_sl_visitor + public Arr_vert_decomp_sl_visitor< + VdHelper, OutputIterator, + Surface_sweep_vertical_decomposition_visitor > { - typedef OutputIterator_ Output_iterator; + typedef OutputIterator Output_iterator; + typedef Surface_sweep_vertical_decomposition_visitor + Self; + typedef Arr_vert_decomp_sl_visitor + Base; - typedef Arr_vert_decomp_sl_visitor Base; typedef typename Base::Geometry_traits_2 Geometry_traits_2; typedef typename Base::Event Event; typedef typename Base::Subcurve Subcurve; @@ -336,6 +350,8 @@ public: {} }; + /*! \class Surface_sweep_overlay_visitor + */ template struct Surface_sweep_overlay_visitor : @@ -344,7 +360,10 @@ public: Geometry_traits_2>, ArrangementA, ArrangementB>, ArrangementA, ArrangementB>, - OverlayTraits> + OverlayTraits, + Surface_sweep_overlay_visitor > { typedef ArrangementA Arrangement_a; typedef ArrangementB Arrangement_b; @@ -358,7 +377,10 @@ public: typedef _Overlay_helper Ovl_helper; - typedef Arr_overlay_sl_visitor + typedef Surface_sweep_overlay_visitor + Self; + typedef Arr_overlay_sl_visitor Base; // typedef typename Base::Geometry_traits_2 Geometry_traits_2; 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 69a2a43ca8e..8d1f63713f1 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h @@ -21,6 +21,7 @@ #include /*! \file + * * Definition of the global Arr_overlay_2() function. */ @@ -150,10 +151,7 @@ void overlay(const Arrangement_on_surface_2& arr1, ex_traits(*traits_adaptor); Ovl_visitor visitor(&arr1, &arr2, &arr_res, &ovl_tr); - Ss2::Surface_sweep_2 - sweep_line(&ex_traits, &visitor); + Ss2::Surface_sweep_2 sweep_line(&ex_traits, &visitor); // In case both arrangement do not contain isolated vertices, go on and // overlay them. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h index 4b188d1678e..cdb3fdc47ce 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h @@ -12,8 +12,8 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// Author(s) : Efi Fogel -// Eric Berberich +// Author(s) : Efi Fogel +// Eric Berberich #ifndef CGAL_ARR_SPHERICAL_TOPOLOGY_TRAITS_2_H #define CGAL_ARR_SPHERICAL_TOPOLOGY_TRAITS_2_H @@ -344,8 +344,8 @@ private: // Type definition for the basic insertion sweep-line visitor. typedef Arr_basic_insertion_traits_2 NxITraits; - typedef Arr_construction_event - NxIEvent; + typedef Arr_construction_event NxIEvent; typedef Arr_construction_subcurve NxISubcurve; typedef Arr_spherical_insertion_helper @@ -360,11 +360,10 @@ private: // Type definition for the vertical decomposition sweep-line visitor. typedef Arr_batched_point_location_traits_2 VdTraits; - // typedef Ss2::No_overlap_event VdEvent; - // typedef Ss2::No_overlap_subcurve VdSubcurve; - // typedef Arr_spherical_vert_decomp_helper - // VdHelper; - typedef Arr_spherical_vert_decomp_helper VdHelper; + typedef Ss2::No_overlap_event VdEvent; + typedef Ss2::No_overlap_subcurve VdSubcurve; + typedef Arr_spherical_vert_decomp_helper + VdHelper; // Type definition for the overlay sweep-line visitor. template Surface_sweep_no_intersection_insertion_visitor; + /*! \class Surface_sweep_batched_point_location_visitor + */ template struct Surface_sweep_batched_point_location_visitor : - public Arr_batched_pl_sl_visitor + public Arr_batched_pl_sl_visitor< + BplHelper, OutputIterator, + Surface_sweep_batched_point_location_visitor > { typedef OutputIterator Output_iterator; - typedef Arr_batched_pl_sl_visitor + typedef Surface_sweep_batched_point_location_visitor + Self; + typedef Arr_batched_pl_sl_visitor Base; - typedef typename Base::Geometry_traits_2 Geometry_traits_2; - typedef typename Base::Event Event; - typedef typename Base::Subcurve Subcurve; + typedef typename BplHelper::Geometry_traits_2 Geometry_traits_2; + typedef typename BplHelper::Event Event; + typedef typename BplHelper::Subcurve Subcurve; Surface_sweep_batched_point_location_visitor(const Arr* arr, Output_iterator& oi) : @@ -435,12 +440,19 @@ public: {} }; + /*! \class Surface_sweep_vertical_decomposition_visitor + */ template struct Surface_sweep_vertical_decomposition_visitor : - public Arr_vert_decomp_sl_visitor + public Arr_vert_decomp_sl_visitor< + VdHelper, OutputIterator, + Surface_sweep_vertical_decomposition_visitor > { typedef OutputIterator Output_iterator; - typedef Arr_vert_decomp_sl_visitor Base; + typedef Surface_sweep_vertical_decomposition_visitor + Self; + typedef Arr_vert_decomp_sl_visitor + Base; typedef typename Base::Geometry_traits_2 Geometry_traits_2; typedef typename Base::Event Event; @@ -460,7 +472,10 @@ public: ArrangementA, ArrangementB>, ArrangementA, ArrangementB>, - OverlayTraits> + OverlayTraits, + Surface_sweep_overlay_visitor > { typedef ArrangementA Arrangement_a; typedef ArrangementB Arrangement_b; @@ -473,7 +488,10 @@ public: typedef _Overlay_helper Ovl_helper; - typedef Arr_overlay_sl_visitor + typedef Surface_sweep_overlay_visitor + Self; + typedef Arr_overlay_sl_visitor Base; // typedef typename Base::Geometry_traits_2 Geometry_traits_2; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_batched_pl_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_batched_pl_helper.h index 6e26e4e8379..37eb126844b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_batched_pl_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_batched_pl_helper.h @@ -14,6 +14,7 @@ // // Author(s) : Baruch Zukerman // Ron Wein +// Efi Fogel #ifndef CGAL_ARR_BOUNDED_PLANAR_BATCHED_PL_HELPER_H #define CGAL_ARR_BOUNDED_PLANAR_BATCHED_PL_HELPER_H @@ -29,7 +30,7 @@ namespace CGAL { namespace Ss2 = Surface_sweep_2; -#include +#include /*! \class Arr_bounded_planar_batched_pl_helper * @@ -45,15 +46,13 @@ public: typedef Arrangement_ Arrangement_2; typedef Event_ Event; typedef Subcurve_ Subcurve; + typedef typename Subcurve::Allocator Allocator; private: typedef Geometry_traits_2 Gt2; typedef typename Arrangement_2::Face_const_handle Face_const_handle; public: - typedef Ss2::Surface_sweep_empty_visitor - Base_visitor; - typedef typename Arrangement_2::Topology_traits Topology_traits; protected: diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h index da40b1b1786..7d689452e8f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h @@ -14,6 +14,7 @@ // // Author(s) : Baruch Zukerman // Ron Wein +// Efi Fogel #ifndef CGAL_ARR_BOUNDED_PLANAR_CONSTRUCTION_HELPER_H #define CGAL_ARR_BOUNDED_PLANAR_CONSTRUCTION_HELPER_H @@ -25,7 +26,7 @@ * Definition of the Arr_bounded_planar_construction_helper class-template. */ -#include +#include #include namespace CGAL { @@ -46,6 +47,7 @@ public: typedef Arrangement_ Arrangement_2; typedef Event_ Event; typedef Subcurve_ Subcurve; + typedef typename Subcurve::Allocator Allocator; private: typedef Geometry_traits_2 Gt2; @@ -54,9 +56,6 @@ public: typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::Point_2 Point_2; - typedef Ss2::Surface_sweep_empty_visitor - Base_visitor; - typedef typename Arrangement_2::Face_handle Face_handle; typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_insertion_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_insertion_helper.h index 9d55b4f8dfc..48bcd1a3026 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_insertion_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_insertion_helper.h @@ -14,6 +14,7 @@ // // Author(s) : Baruch Zukerman // Ron Wein +// Efi Fogel #ifndef CGAL_ARR_BOUNDED_PLANAR_INSERTION_HELPER_H #define CGAL_ARR_BOUNDED_PLANAR_INSERTION_HELPER_H @@ -25,7 +26,6 @@ * Definition of the Arr_bounded_planar_insertion_helper class-template. */ -#include #include namespace CGAL { @@ -62,18 +62,12 @@ public: typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::Point_2 Point_2; - typedef Ss2::Surface_sweep_empty_visitor - Base_visitor; - - typedef Arr_construction_sl_visitor Parent_visitor; - typedef typename Arrangement_2::Face_handle Face_handle; typedef typename Base::Indices_list Indices_list; typedef typename Base::Halfedge_indices_map Halfedge_indices_map; public: - /*! Constructor. */ Arr_bounded_planar_insertion_helper(Arrangement_2* arr) : Base(arr) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_overlay_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_overlay_helper.h index 3b4f2aa3159..ad7b2e4efb6 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_overlay_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_overlay_helper.h @@ -14,6 +14,7 @@ // // Author(s) : Baruch Zukerman // Ron Wein +// Efi Fogel #ifndef CGAL_ARR_BOUNDED_PLANAR_OVERLAY_HELPER_H #define CGAL_ARR_BOUNDED_PLANAR_OVERLAY_HELPER_H @@ -79,7 +80,7 @@ protected: public: /*! Constructor, given the input red and blue arrangements. */ - Arr_bounded_planar_overlay_helper(const Ar2 *red_arr, const Ab2 *blue_arr) : + Arr_bounded_planar_overlay_helper(const Ar2* red_arr, const Ab2* blue_arr) : m_red_top_traits (red_arr->topology_traits()), m_blue_top_traits (blue_arr->topology_traits()) {} @@ -88,25 +89,24 @@ public: //@{ /* A notification issued before the sweep process starts. */ - void before_sweep () + void before_sweep() { // Get the unbounded faces in both arrangements. m_red_ubf = Face_handle_red (m_red_top_traits->unbounded_face()); m_blue_ubf = Face_handle_blue (m_blue_top_traits->unbounded_face()); - return; } /*! A notification invoked before the sweep-line starts handling the given * event. */ - void before_handle_event (Event* /* e */) {} + void before_handle_event(Event* /* e */) {} //@} /*! Obtain the current red top face. */ - Face_handle_red red_top_face () const { return m_red_ubf; } + Face_handle_red red_top_face() const { return m_red_ubf; } /*! Obtain the current blue top face. */ - Face_handle_blue blue_top_face () const { return m_blue_ubf; } + Face_handle_blue blue_top_face() const { return m_blue_ubf; } }; } // namespace CGAL diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h index e4e9bade56a..ea0280e2b13 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h @@ -13,6 +13,7 @@ // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // Author(s) : Ron Wein +// Efi Fogel #ifndef CGAL_ARR_BOUNDED_PLANAR_VERT_DEOCMP_HELPER_H #define CGAL_ARR_BOUNDED_PLANAR_VERT_DEOCMP_HELPER_H @@ -28,7 +29,7 @@ namespace CGAL { namespace Ss2 = Surface_sweep_2; -#include +#include /*! \class Arr_bounded_planar_vert_decomp_helper * @@ -44,17 +45,13 @@ public: typedef Arrangement_ Arrangement_2; typedef Event_ Event; typedef Subcurve_ Subcurve; + typedef typename Subcurve::Allocator Allocator; private: typedef Geometry_traits_2 Gt2; public: typedef typename Arrangement_2::Face_const_handle Face_const_handle; - -public: - typedef Ss2::Surface_sweep_empty_visitor - Base_visitor; - typedef typename Arrangement_2::Topology_traits Topology_traits; protected: @@ -73,7 +70,7 @@ public: /// \name Notification functions. //@{ - /* A notification issued before the sweep process starts. */ + /*! A notification issued before the sweep process starts. */ void before_sweep() { // Get the unbounded face. @@ -93,6 +90,6 @@ public: CGAL::Object bottom_object() const { return CGAL::make_object(m_unb_face); } }; -} //namespace CGAL +} // namespace CGAL #endif diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h index b85acfdb0f4..71f0de0c068 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h @@ -15,7 +15,6 @@ // Author(s) : Baruch Zukerman // Ron Wein // Efi Fogel -// #ifndef CGAL_ARR_SPHERICAL_BATCHED_PL_HELPER_H #define CGAL_ARR_SPHERICAL_BATCHED_PL_HELPER_H @@ -31,8 +30,6 @@ namespace CGAL { namespace Ss2 = Surface_sweep_2; -#include - /*! \class Arr_spherical_batched_pl_helper * * A helper class for the batched point-location sweep-line visitor, suitable @@ -47,13 +44,12 @@ public: typedef Arrangement_ Arrangement_2; typedef Event_ Event; typedef Subcurve_ Subcurve; + typedef typename Subcurve::Allocator Allocator; private: typedef Geometry_traits_2 Gt2; public: - typedef Ss2::Surface_sweep_empty_visitor - Base_visitor; typedef typename Arrangement_2::Face_const_handle Face_const_handle; typedef typename Event::Subcurve_iterator Subcurve_iterator; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h index 0e55fcd72eb..517d7e8f08d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h @@ -25,7 +25,6 @@ * Definition of the Arr_spherical_construction_helper class-template. */ -#include #include namespace CGAL { @@ -38,14 +37,15 @@ namespace Ss2 = Surface_sweep_2; * for an Arrangement_on_surface_2 instantiated with a topology-traits class * for bounded curves in the plane. */ -template class Arr_spherical_construction_helper { public: - typedef Traits_ Geometry_traits_2; + typedef GeometryTraits_2 Geometry_traits_2; typedef Arrangement_ Arrangement_2; typedef Event_ Event; typedef Subcurve_ Subcurve; + typedef typename Subcurve::Allocator Allocator; private: typedef Geometry_traits_2 Gt2; @@ -54,9 +54,6 @@ public: typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::Point_2 Point_2; - typedef Ss2::Surface_sweep_empty_visitor - Base_visitor; - typedef typename Arrangement_2::Vertex_handle Vertex_handle; typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; typedef typename Arrangement_2::Face_handle Face_handle; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h index b2ef8867750..7a6b29a3484 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h @@ -25,7 +25,6 @@ * Definition of the Arr_spherical_insertion_helper class-template. */ -#include #include namespace CGAL { @@ -61,11 +60,6 @@ public: typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::Point_2 Point_2; - typedef Ss2::Surface_sweep_empty_visitor - Base_visitor; - - typedef Arr_construction_sl_visitor Parent_visitor; - typedef typename Arrangement_2::Vertex_handle Vertex_handle; typedef typename Arrangement_2::Face_handle Face_handle; typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; @@ -231,6 +225,6 @@ Arr_spherical_insertion_helper::top_face() const return this->m_spherical_face; } -} //namespace CGAL +} // namespace CGAL #endif diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h index e4c8555346f..3c11409267e 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h @@ -14,7 +14,6 @@ // // Author(s) : Ron Wein // Efi Fogel -// #ifndef CGAL_ARR_SPHERICAL_VERT_DECOMP_HELPER_H #define CGAL_ARR_SPHERICAL_VERT_DECOMP_HELPER_H @@ -30,33 +29,31 @@ namespace CGAL { namespace Ss2 = Surface_sweep_2; -#include - /*! \class Arr_spherical_vert_decomp_helper * * A helper class for the vertical decomposition sweep-line visitor, suitable * for an Arrangement_on_surface_2 instantiated with a topology-traits class * for bounded curves in the plane. */ -template +template class Arr_spherical_vert_decomp_helper { public: typedef GeometryTraits_2 Geometry_traits_2; typedef Arrangement_ Arrangement_2; + typedef Event_ Event; + typedef Subcurve_ Subcurve; + typedef typename Subcurve::Allocator Allocator; private: typedef Geometry_traits_2 Gt2; public: - typedef Ss2::Surface_sweep_empty_visitor Base_visitor; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Arrangement_2::Face_const_handle Face_const_handle; typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; - typedef typename Base_visitor::Event Event; - typedef typename Base_visitor::Subcurve Subcurve; - protected: typedef typename Arrangement_2::Topology_traits Topology_traits; @@ -111,8 +108,8 @@ public: //----------------------------------------------------------------------------- // A notification issued before the sweep process starts. // -template -void Arr_spherical_vert_decomp_helper::before_sweep() + template + void Arr_spherical_vert_decomp_helper::before_sweep() { // Get the north pole and the face that intially contains it. m_valid_north_pole = (m_top_traits->north_pole() != NULL); @@ -133,9 +130,9 @@ void Arr_spherical_vert_decomp_helper::before_sweep() // A notification invoked after the sweep-line finishes handling the given // event. /// -template -void -Arr_spherical_vert_decomp_helper::after_handle_event (Event *event) +template +void Arr_spherical_vert_decomp_helper:: +after_handle_event(Event *event) { // Ignore events that are not incident to the poles. if (event->parameter_space_in_y() == ARR_INTERIOR) return; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h index 1f1a9de9406..9e2e1d3a125 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h @@ -13,8 +13,8 @@ // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // Author(s) : Baruch Zukerman -// Ron Wein -// Efi Fogel +// Ron Wein +// Efi Fogel #ifndef CGAL_ARR_UNB_PLANAR_BATCHED_PL_HELPER_H #define CGAL_ARR_UNB_PLANAR_BATCHED_PL_HELPER_H @@ -30,7 +30,7 @@ namespace CGAL { namespace Ss2 = Surface_sweep_2; -#include +#include /*! \class Arr_unb_planar_batched_pl_helper * @@ -46,13 +46,12 @@ public: typedef Arrangement_ Arrangement_2; typedef Event_ Event; typedef Subcurve_ Subcurve; + typedef typename Subcurve::Allocator Allocator; private: typedef Geometry_traits_2 Gt2; public: - typedef Ss2::Surface_sweep_empty_visitor - Base_visitor; typedef typename Arrangement_2::Face_const_handle Face_const_handle; protected: diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h index f2f12125a42..077d5e4ecd0 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h @@ -13,8 +13,8 @@ // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // Author(s) : Baruch Zukerman -// Ron Wein -// Efi Fogel +// Ron Wein +// Efi Fogel #ifndef CGAL_ARR_UNB_PLANAR_CONSTRUCTION_HELPER_H #define CGAL_ARR_UNB_PLANAR_CONSTRUCTION_HELPER_H @@ -26,7 +26,7 @@ * Definition of the Arr_unb_planar_construction_helper class-template. */ -#include +#include #include namespace CGAL { @@ -47,13 +47,12 @@ public: typedef Arrangement_ Arrangement_2; typedef Event_ Event; typedef Subcurve_ Subcurve; + typedef typename Subcurve::Allocator Allocator; private: typedef Geometry_traits_2 Gt2; public: - typedef Ss2::Surface_sweep_empty_visitor - Base_visitor; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::Point_2 Point_2; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h index 51a362ccc97..77c12571187 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h @@ -13,8 +13,8 @@ // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // Author(s) : Baruch Zukerman -// Ron Wein -// Efi Fogel +// Ron Wein +// Efi Fogel #ifndef CGAL_ARR_UNB_PLANAR_INSERTION_HELPER_H #define CGAL_ARR_UNB_PLANAR_INSERTION_HELPER_H @@ -26,7 +26,6 @@ * Definition of the Arr_unb_planar_insertion_helper class-template. */ -#include #include namespace CGAL { @@ -62,11 +61,6 @@ public: typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::Point_2 Point_2; - typedef Ss2::Surface_sweep_empty_visitor - Base_visitor; - - typedef Arr_construction_sl_visitor Parent_visitor; - typedef typename Arrangement_2::Face_handle Face_handle; typedef typename Base::Indices_list Indices_list; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_overlay_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_overlay_helper.h index 846a1dc6469..45974a0a214 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_overlay_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_overlay_helper.h @@ -119,7 +119,8 @@ public: // template -void Arr_unb_planar_overlay_helper::before_sweep() +void Arr_unb_planar_overlay_helper:: +before_sweep() { // Get the top-left fictitious vertices in both arrangements. v_red_tl = Vertex_handle_red(m_red_top_traits->top_left_vertex()); @@ -155,7 +156,7 @@ void Arr_unb_planar_overlay_helper::before_sweep() // template -void Arr_unb_planar_overlay_helper:: +void Arr_unb_planar_overlay_helper:: before_handle_event(Event* e) { // Nothing to do in case the event represents a valid point. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h index e3ab64734ef..31305a3ef73 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h @@ -29,7 +29,7 @@ namespace CGAL { namespace Ss2 = Surface_sweep_2; -#include +#include /*! \class Arr_unb_planar_vert_decomp_helper * @@ -45,13 +45,12 @@ public: typedef Arrangement_ Arrangement_2; typedef Event_ Event; typedef Subcurve_ Subcurve; + typedef typename Subcurve::Allocator Allocator; private: typedef Geometry_traits_2 Gt2; public: - typedef Ss2::Surface_sweep_empty_visitor - Base_visitor; typedef typename Arrangement_2::Face_const_handle Face_const_handle; protected: @@ -146,8 +145,8 @@ before_sweep() // A notification invoked after the sweep-line finishes handling the given // event. // -template -void Arr_unb_planar_vert_decomp_helper:: +template +void Arr_unb_planar_vert_decomp_helper:: after_handle_event(Event* event) { // If the event is at infinity and occurs on the top edge of the fictitious diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h index 9735378467b..ee5c8f5a7f6 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h @@ -12,8 +12,8 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// Author(s) : Ron Wein -// Efi Fogel +// Author(s) : Ron Wein +// Efi Fogel #ifndef CGAL_ARR_UNB_PLANAR_TOPOLOGY_TRAITS_2_H #define CGAL_ARR_UNB_PLANAR_TOPOLOGY_TRAITS_2_H @@ -240,8 +240,8 @@ private: // Type definition for the basic insertion surface-sweep visitor. typedef Arr_basic_insertion_traits_2 NxITraits; - typedef Arr_construction_event - NxIEvent; + typedef Arr_construction_event NxIEvent; typedef Arr_construction_subcurve NxISubcurve; typedef Arr_unb_planar_insertion_helper @@ -311,15 +311,24 @@ public: typedef Arr_no_intersection_insertion_sl_visitor Surface_sweep_no_intersection_insertion_visitor; + /*! \class Surface_sweep_batched_point_location_visitor + */ template struct Surface_sweep_batched_point_location_visitor : - public Arr_batched_pl_sl_visitor + public Arr_batched_pl_sl_visitor< + BplHelper, OutputIterator, + Surface_sweep_batched_point_location_visitor > { typedef OutputIterator Output_iterator; - typedef Arr_batched_pl_sl_visitor Base; - typedef typename Base::Geometry_traits_2 Geometry_traits_2; - typedef typename Base::Event Event; - typedef typename Base::Subcurve Subcurve; + + typedef Surface_sweep_batched_point_location_visitor + Self; + typedef Arr_batched_pl_sl_visitor + Base; + + typedef typename BplHelper::Geometry_traits_2 Geometry_traits_2; + typedef typename BplHelper::Event Event; + typedef typename BplHelper::Subcurve Subcurve; Surface_sweep_batched_point_location_visitor(const Arr* arr, Output_iterator& oi) : @@ -327,12 +336,19 @@ public: {} }; + /*! \class Surface_sweep_vertical_decomposition_visitor + */ template struct Surface_sweep_vertical_decomposition_visitor : - public Arr_vert_decomp_sl_visitor + public Arr_vert_decomp_sl_visitor< + VdHelper, OutputIterator, + Surface_sweep_vertical_decomposition_visitor > { typedef OutputIterator Output_iterator; - typedef Arr_vert_decomp_sl_visitor Base; + typedef Surface_sweep_vertical_decomposition_visitor + Self; + typedef Arr_vert_decomp_sl_visitor + Base; typedef typename Base::Geometry_traits_2 Geometry_traits_2; typedef typename Base::Event Event; typedef typename Base::Subcurve Subcurve; @@ -342,6 +358,8 @@ public: Base(arr, oi) {} }; + /*! \class Surface_sweep_overlay_visitor + */ template struct Surface_sweep_overlay_visitor : @@ -349,7 +367,10 @@ public: Gt2, ArrangementA, ArrangementB>, ArrangementA, ArrangementB>, - OverlayTraits> + OverlayTraits, + Surface_sweep_overlay_visitor > { typedef ArrangementA Arrangement_a; typedef ArrangementB Arrangement_b; @@ -362,9 +383,14 @@ public: typedef _Overlay_helper Ovl_helper; - typedef Arr_overlay_sl_visitor Base; + typedef Surface_sweep_overlay_visitor + Self; + typedef Arr_overlay_sl_visitor + Base; - // typedef typename Base::Traits_2 Traits_2; + + // typedef typename Base::Geometry_traits_2 Geometry_traits_2; typedef typename Base::Event Event; typedef typename Base::Subcurve Subcurve; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_vertical_decomposition_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_vertical_decomposition_2.h index f7383e29d9c..9641ddc7bbb 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_vertical_decomposition_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_vertical_decomposition_2.h @@ -123,10 +123,7 @@ decompose(const Arrangement_on_surface_2& arr, // Define the sweep-line visitor and perform the sweep. Vd_visitor visitor(&arr, &oi); - Ss2::No_intersection_surface_sweep_2 + Ss2::No_intersection_surface_sweep_2 surface_sweep(&ex_traits, &visitor); surface_sweep.sweep(xcurves_vec.begin(), xcurves_vec.end(), // Curves. iso_pts_vec.begin(), iso_pts_vec.end()); // Action points. diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h index 4f102da6c14..17ad568cd86 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h @@ -12,9 +12,9 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// Author(s) : Ron Wein -// Baruch Zukerman -// Efi Fogel +// Author(s) : Ron Wein +// Baruch Zukerman +// Efi Fogel // #ifndef CGAL_ARRANGEMENT_ON_SURFACE_2_GLOBAL_H @@ -277,11 +277,7 @@ void insert_empty(Arrangement_on_surface_2& arr, traits(*geom_traits); // Define a surface-sweep instance and perform the sweep: - Ss2::Surface_sweep_2 - surface_sweep(&traits, &visitor); + Ss2::Surface_sweep_2 surface_sweep(&traits, &visitor); surface_sweep.sweep(begin_xcurves, end_xcurves); } @@ -324,11 +320,7 @@ void insert_empty(Arrangement_on_surface_2& arr, traits(*geom_traits); // Define a surface-sweep instance and perform the sweep. - Ss2::Surface_sweep_2 - surface_sweep(&traits, &visitor); + Ss2::Surface_sweep_2 surface_sweep(&traits, &visitor); surface_sweep.sweep(begin_xcurves, end_xcurves, begin_points, end_points); } @@ -383,11 +375,7 @@ void insert_non_empty(Arrangement_on_surface_2 - surface_sweep(&traits, &visitor); + Ss2::Surface_sweep_2 surface_sweep(&traits, &visitor); surface_sweep.sweep(ex_cvs.begin(), ex_cvs.end(),ex_pts.begin(), ex_pts.end()); } @@ -824,10 +812,7 @@ void non_intersecting_insert_empty(Arrangement_on_surface_2 + Ss2::No_intersection_surface_sweep_2 surface_sweep(&traits, &visitor); surface_sweep.sweep(begin_xcurves, end_xcurves); } @@ -871,10 +856,7 @@ void non_intersecting_insert_empty(Arrangement_on_surface_2 + Ss2::No_intersection_surface_sweep_2 surface_sweep(&traits, &visitor); surface_sweep.sweep(begin_xcurves, end_xcurves, begin_points, end_points); } @@ -931,9 +913,7 @@ void non_intersecting_insert_non_empty(Arrangement_on_surface_2 + Ss2::No_intersection_surface_sweep_2 surface_sweep(&traits, &visitor); surface_sweep.sweep(ex_cvs.begin(), ex_cvs.end(), ex_pts.begin(), ex_pts.end()); @@ -1210,10 +1190,7 @@ bool is_valid(const Arrangement_on_surface_2& arr) // The surface-sweep types: typedef Ss2::Surface_sweep_do_curves_x_visitor Visitor; - typedef typename Visitor::Event Event; - typedef typename Visitor::Subcurve Subcurve; - typedef Ss2::Surface_sweep_2 - Surface_sweep_2; + typedef Ss2::Surface_sweep_2 Surface_sweep_2; // The arrangement iterator and circulator types: typedef typename Arr::Edge_const_iterator Edge_const_iterator; diff --git a/Surface_sweep_2/include/CGAL/No_intersection_surface_sweep_2.h b/Surface_sweep_2/include/CGAL/No_intersection_surface_sweep_2.h index 110a016f7b3..5fd01621e4b 100644 --- a/Surface_sweep_2/include/CGAL/No_intersection_surface_sweep_2.h +++ b/Surface_sweep_2/include/CGAL/No_intersection_surface_sweep_2.h @@ -13,7 +13,7 @@ // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // Author(s) : Baruch Zukerman -// Efi Fogel +// Efi Fogel // (based on old version by Tali Zvi) #ifndef CGAL_BASIC_SWEEP_LINE_2_H @@ -111,26 +111,23 @@ namespace Surface_sweep_2 { * The x-montone curve type and the point type are defined by the traits class * that is one of the template parameters. */ -template , - typename Subcurve_ = No_overlap_subcurve, - typename Allocator_ = CGAL_ALLOCATOR(int)> +template class No_intersection_surface_sweep_2 { public: - typedef GeometryTraits_2 Geometry_traits_2; typedef Visitor_ Visitor; - typedef Event_ Event; - typedef Subcurve_ Subcurve; - typedef Allocator_ Allocator; + + typedef typename Visitor::Geometry_traits_2 Geometry_traits_2; + typedef typename Visitor::Event Event; + typedef typename Visitor::Subcurve Subcurve; + typedef typename Visitor::Allocator Allocator; private: typedef Geometry_traits_2 Gt2; public: - typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; - typedef typename Traits_adaptor_2::Point_2 Point_2; - typedef typename Traits_adaptor_2::X_monotone_curve_2 X_monotone_curve_2; + typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; + typedef typename Traits_adaptor_2::Point_2 Point_2; + typedef typename Traits_adaptor_2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Traits_adaptor_2::Left_side_category Left_side_category; typedef typename Traits_adaptor_2::Bottom_side_category Bottom_side_category; diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2.h index b516bfc62ab..eb6acaaf97e 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2.h @@ -78,28 +78,20 @@ namespace Surface_sweep_2 { * */ -template , - typename Subcurve_ = Default_subcurve, - typename Allocator_ = CGAL_ALLOCATOR(int) > -class Surface_sweep_2 : - public No_intersection_surface_sweep_2 -{ +template +class Surface_sweep_2 : public No_intersection_surface_sweep_2 { public: - typedef GeometryTraits_2 Geometry_traits_2; typedef Visitor_ Visitor; - typedef Event_ Event; - typedef Subcurve_ Subcurve; - typedef Allocator_ Allocator; private: - typedef Geometry_traits_2 Gt2; - typedef No_intersection_surface_sweep_2 Base; + typedef No_intersection_surface_sweep_2 Base; public: + typedef typename Base::Geometry_traits_2 Geometry_traits_2; + typedef typename Base::Event Event; + typedef typename Base::Subcurve Subcurve; + typedef typename Base::Allocator Allocator; + typedef typename Base::Traits_adaptor_2 Traits_adaptor_2; typedef typename Traits_adaptor_2::Point_2 Point_2; typedef typename Traits_adaptor_2::X_monotone_curve_2 X_monotone_curve_2; @@ -149,7 +141,7 @@ public: * \param traits A pointer to a sweep-line traits object. * \param visitor A pointer to a sweep-line visitor object. */ - Surface_sweep_2(const Gt2* traits, Visitor* visitor) : + Surface_sweep_2(const Geometry_traits_2* traits, Visitor* visitor) : Base(traits, visitor), m_curves_pair_set(0) {} diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_batched_pl_sl_visitor.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_batched_pl_sl_visitor.h index 72489d801e7..5fc6fd2fe3b 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_batched_pl_sl_visitor.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_batched_pl_sl_visitor.h @@ -14,6 +14,7 @@ // // Author(s) : Baruch Zukerman // Ron Wein +// Efi Fogel #ifndef CGAL_ARR_BATCHED_PL_SL_VISITOR_H #define CGAL_ARR_BATCHED_PL_SL_VISITOR_H @@ -27,34 +28,53 @@ #include #include - -#include -#include +#include +#include namespace CGAL { +namespace Ss2 = Surface_sweep_2; + /*! \class Arr_batched_pl_sl_visitor * * A surface-sweep visitor for performing batched point-location queries on an * arrangement embedded on a surface. */ -template -class Arr_batched_pl_sl_visitor : public Helper_::Base_visitor { +template +class Arr_batched_pl_sl_visitor : + public Ss2::Visitor_base >::type> +{ public: typedef Helper_ Helper; - typedef OutputIterator_ OutputIterator; + typedef OutputIterator Output_iterator; typedef typename Helper::Geometry_traits_2 Geometry_traits_2; - typedef typename Helper::Arrangement_2 Arrangement_2; typedef typename Helper::Event Event; typedef typename Helper::Subcurve Subcurve; + typedef typename Helper::Allocator Allocator; +private: + typedef Geometry_traits_2 Gt2; + typedef Arr_batched_pl_sl_visitor + Self; + typedef typename Default::Get::type Visitor; + typedef typename Ss2::Visitor_base + Base; + +public: + typedef typename Helper::Arrangement_2 Arrangement_2; typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; typedef typename Arrangement_2::Face_const_handle Face_const_handle; protected: - typedef typename Helper::Base_visitor Base; typedef typename Base::Status_line_iterator Status_line_iterator; typedef Arr_point_location_result Pl_result; @@ -62,7 +82,7 @@ protected: // Data members: Helper m_helper; // The helper class. - OutputIterator& m_out; // An output iterator for the result. + Output_iterator& m_out; // An output iterator for the result. template Pl_result_type pl_make_result(T t) { return Pl_result::make_result(t); } @@ -75,7 +95,7 @@ public: * \param arr The arrangement. * \param oi A pointer to the output iterator that will store the result. */ - Arr_batched_pl_sl_visitor(const Arrangement_2* arr, OutputIterator& oi) : + Arr_batched_pl_sl_visitor(const Arrangement_2* arr, Output_iterator& oi) : m_helper(arr), m_out(oi) {} @@ -102,8 +122,8 @@ public: //----------------------------------------------------------------------------- // A notification issued before the sweep process starts. // -template -void Arr_batched_pl_sl_visitor::before_sweep() + template + void Arr_batched_pl_sl_visitor::before_sweep() { // We just have to notify the helper that the sweep process now starts. m_helper.before_sweep(); @@ -113,8 +133,8 @@ void Arr_batched_pl_sl_visitor::before_sweep() // A notification invoked after the surface-sweep finishes handling the given // event. // -template -bool Arr_batched_pl_sl_visitor:: +template +bool Arr_batched_pl_sl_visitor:: after_handle_event(Event* event, Status_line_iterator above, bool on_above) { // Notify the helper on the event. diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h index 8c899a205f4..695c53fc2c6 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h @@ -30,12 +30,17 @@ * Definition of the Arr_construction_sl_visitor class-template. */ -#include -#include #include +#include +#include +#include +#include + namespace CGAL { +namespace Ss2 = Surface_sweep_2; + /*! \struct Integer_hash_function * An auxiliary hash functor for integers. */ @@ -48,25 +53,37 @@ struct Integer_hash_function { /*! \class Arr_construction_sl_visitor * A sweep-line visitor for constructing an arrangement embedded on a surface. */ -template -class Arr_construction_sl_visitor : public Helper_::Base_visitor { +template +class Arr_construction_sl_visitor : + public Ss2::Visitor_base >::type> +{ public: typedef Helper_ Helper; typedef typename Helper::Geometry_traits_2 Geometry_traits_2; - typedef typename Helper::Arrangement_2 Arrangement_2; - typedef typename Helper::Base_visitor Base; typedef typename Helper::Event Event; typedef typename Helper::Subcurve Subcurve; + typedef typename Helper::Allocator Allocator; private: typedef Geometry_traits_2 Gt2; + typedef Arr_construction_sl_visitor Self; + typedef typename Default::Get::type Visitor; + typedef Ss2::Visitor_base + Base; public: typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::Point_2 Point_2; protected: + typedef typename Helper::Arrangement_2 Arrangement_2; typedef typename Arrangement_2::Topology_traits Topology_traits; typedef typename Arrangement_2::Vertex_handle Vertex_handle; typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; @@ -75,7 +92,7 @@ protected: typedef typename Base::Event_subcurve_iterator Event_subcurve_iterator; typedef typename Base::Event_subcurve_reverse_iterator Event_subcurve_reverse_iterator; - typedef typename Base::Status_line_iterator Status_line_iterator; + typedef typename Subcurve::Status_line_iterator Status_line_iterator; typedef typename Helper::Indices_list Indices_list; typedef typename Helper::Halfedge_indices_map Halfedge_indices_map; @@ -251,16 +268,16 @@ private: //----------------------------------------------------------------------------- // A notification issued before the sweep process starts. // Notifies the helper that the sweep process now starts. -template -void Arr_construction_sl_visitor::before_sweep() +template +void Arr_construction_sl_visitor::before_sweep() { m_helper.before_sweep(); } //----------------------------------------------------------------------------- // A notification invoked before the sweep-line starts handling the given // event. // -template -void Arr_construction_sl_visitor::before_handle_event(Event* event) +template +void Arr_construction_sl_visitor::before_handle_event(Event* event) { #if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE std::cout << "CGAL_CSLV before_handle_event" << std::endl; @@ -273,8 +290,8 @@ void Arr_construction_sl_visitor::before_handle_event(Event* event) // A notification invoked after the sweep-line finishes handling the given // event. // -template -bool Arr_construction_sl_visitor:: +template +bool Arr_construction_sl_visitor:: after_handle_event(Event* event, Status_line_iterator iter, bool /* flag */) { #if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE @@ -359,11 +376,8 @@ after_handle_event(Event* event, Status_line_iterator iter, bool /* flag */) // to their right endpoint). Event_subcurve_iterator left_it; for (left_it = event->left_curves_begin(); - left_it != event->left_curves_end(); - ++left_it) - { + left_it != event->left_curves_end(); ++left_it) (*left_it)->set_last_event(event); - } // In case there are no right subcurves, the event can be deallocated. if (event->number_of_right_curves() == 0) { @@ -380,11 +394,8 @@ after_handle_event(Event* event, Status_line_iterator iter, bool /* flag */) // to their left endpoint). Event_subcurve_iterator right_it; for (right_it = event->right_curves_begin(); - right_it != event->right_curves_end(); - ++right_it) - { + right_it != event->right_curves_end(); ++right_it) (*right_it)->set_last_event(event); - } // Mark that the event cannot be deallocated just yet. return false; @@ -393,8 +404,8 @@ after_handle_event(Event* event, Status_line_iterator iter, bool /* flag */) //----------------------------------------------------------------------------- // A notification invoked when a new subcurve is created. // -template -void Arr_construction_sl_visitor:: +template +void Arr_construction_sl_visitor:: add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc) { #if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE @@ -412,33 +423,25 @@ add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc) const Halfedge_handle invalid_he; #if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE - if (last_event->is_closed()) { + if (last_event->is_closed()) std::cout << "CGAL_CSLG lastevent: " << last_event->point() << std::endl; - } if (he_left != invalid_he) { std::cout << "he_left : " << &(*he_left) << std::endl; - if (!he_left->is_fictitious()) { + if (!he_left->is_fictitious()) std::cout << "he_leftcv : " << he_left->curve() << std::endl; - } else { - std::cout << "he_left : fictitious" << std::endl; - } + else std::cout << "he_left : fictitious" << std::endl; std::cout << "he_leftdir : " << he_left->direction() << std::endl; std::cout << "he_leftfac : " << &(*he_left->face()) << std::endl; - } else { - std::cout << "he_left : invalid" << std::endl; } + else std::cout << "he_left : invalid" << std::endl; if (he_right != invalid_he) { std::cout << "he_right : " << &(*he_right) << std::endl; - if (!he_right->is_fictitious()) { + if (!he_right->is_fictitious()) std::cout << "he_rightcv : " << he_right->curve() << std::endl; - } else { - std::cout << "he_right : fictitious" << std::endl; - } + else std::cout << "he_right : fictitious" << std::endl; std::cout << "he_rightdir: " << he_right->direction() << std::endl; std::cout << "he_rightfac: " << &(*he_right->face()) << std::endl; - } else { - std::cout << "he_right : invalid" << std::endl; - } + } else std::cout << "he_right : invalid" << std::endl; #endif // Check whether the previous event on the curve is not in the arrangement @@ -464,17 +467,14 @@ add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc) // Therefore, we use it to insert the subcurve. // First, we skip some halfedges around the left vertex to get the true // predecessor halfedge for the insertion. - for (int i = 0; i < jump; i++) - he_left = (he_left->next())->twin(); + for (int i = 0; i < jump; i++) he_left = (he_left->next())->twin(); #if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE if (jump != 0) { std::cout << "CGAL_CSLV JUMP: " << jump << std::endl; - if (!he_left->is_fictitious()) { + if (!he_left->is_fictitious()) std::cout << "he_leftcv : " << he_left->curve() << std::endl; - } else { - std::cout << "he_left : fictitious" << std::endl; - } + else std::cout << "he_left : fictitious" << std::endl; std::cout << "he_leftdir : " << he_left->direction() << std::endl; std::cout << "he_leftfac : " << &(*he_left->face()) << std::endl; } @@ -563,9 +563,9 @@ add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc) //----------------------------------------------------------------------------- // Insert the given subcurve in the interior of an arrangement face. // -template -typename Arr_construction_sl_visitor::Halfedge_handle -Arr_construction_sl_visitor:: +template +typename Arr_construction_sl_visitor::Halfedge_handle +Arr_construction_sl_visitor:: insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) { #if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE @@ -612,9 +612,9 @@ insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) //----------------------------------------------------------------------------- // Insert the given subcurve using its two end-vertices. // -template -typename Arr_construction_sl_visitor::Halfedge_handle -Arr_construction_sl_visitor:: +template +typename Arr_construction_sl_visitor::Halfedge_handle +Arr_construction_sl_visitor:: insert_at_vertices(const X_monotone_curve_2& cv, Halfedge_handle prev1, Halfedge_handle prev2, @@ -623,20 +623,14 @@ insert_at_vertices(const X_monotone_curve_2& cv, { #if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE std::cout << "CGAL_CSLV insert_at_vertices:\ncurve:" << cv << std::endl; - if (!prev1->is_fictitious()) { + if (!prev1->is_fictitious()) std::cout << "prev1cv : " << prev1->curve() << std::endl; - } - else { - std::cout << "prev1 : fictitious" << std::endl; - } + else std::cout << "prev1 : fictitious" << std::endl; std::cout << "prev1dir : " << prev1->direction() << std::endl; std::cout << "prev1fac : " << &(*prev1->face()) << std::endl; - if (!prev2->is_fictitious()) { + if (!prev2->is_fictitious()) std::cout << "prev2cv : " << prev2->curve() << std::endl; - } - else { - std::cout << "prev2 : fictitious" << std::endl; - } + else std::cout << "prev2 : fictitious" << std::endl; std::cout << "prev2dir : " << prev2->direction() << std::endl; std::cout << "prev2fac : " << &(*prev2->face()) << std::endl; #endif @@ -716,9 +710,9 @@ insert_at_vertices(const X_monotone_curve_2& cv, //----------------------------------------------------------------------------- // Insert the given subcurve from a vertex that corresponds to its right end. // -template -typename Arr_construction_sl_visitor::Halfedge_handle -Arr_construction_sl_visitor:: +template +typename Arr_construction_sl_visitor::Halfedge_handle +Arr_construction_sl_visitor:: insert_from_right_vertex(const X_monotone_curve_2& cv, Halfedge_handle prev, Subcurve* sc) @@ -764,20 +758,18 @@ insert_from_right_vertex(const X_monotone_curve_2& cv, //----------------------------------------------------------------------------- // Insert the given subcurve from a vertex that corresponds to its left end. // -template -typename Arr_construction_sl_visitor::Halfedge_handle -Arr_construction_sl_visitor:: +template +typename Arr_construction_sl_visitor::Halfedge_handle +Arr_construction_sl_visitor:: insert_from_left_vertex(const X_monotone_curve_2& cv, Halfedge_handle prev, Subcurve* sc) { #if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE std::cout << "CGAL_CSLV insert_from_left_vertex:\ncurve:" << cv << std::endl; - if (!prev->is_fictitious()) { + if (!prev->is_fictitious()) std::cout << "prevcv : " << prev->curve() << std::endl; - } else { - std::cout << "prev : fictitious" << std::endl; - } + else std::cout << "prev : fictitious" << std::endl; std::cout << "prevdir : " << prev->direction() << std::endl; std::cout << "prevfac : " << &(*prev->face()) << std::endl; #endif @@ -812,9 +804,9 @@ insert_from_left_vertex(const X_monotone_curve_2& cv, //----------------------------------------------------------------------------- // Insert an isolated vertex into the arrangement. // -template -typename Arr_construction_sl_visitor::Vertex_handle -Arr_construction_sl_visitor:: +template +typename Arr_construction_sl_visitor::Vertex_handle +Arr_construction_sl_visitor:: insert_isolated_vertex(const Point_2& pt, Status_line_iterator /* iter */) { #if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE @@ -823,14 +815,15 @@ insert_isolated_vertex(const Point_2& pt, Status_line_iterator /* iter */) // Insert the isolated vertex in the interior of the current top face, as // given by the helper class. - return (m_arr->insert_in_face_interior(_point(pt), m_helper.top_face())); + return m_arr->insert_in_face_interior(_point(pt), m_helper.top_face()); } //----------------------------------------------------------------------------- // Reloacte holes and isolated vertices inside a newly created face. // -template -void Arr_construction_sl_visitor::relocate_in_new_face(Halfedge_handle he) +template +void Arr_construction_sl_visitor:: +relocate_in_new_face(Halfedge_handle he) { #if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE std::cout << "CGAL_CSLV relocate" << std::endl; @@ -909,8 +902,8 @@ void Arr_construction_sl_visitor::relocate_in_new_face(Halfedge_handle he) //----------------------------------------------------------------------------- // Map the given subcurve index to the given halfedge handle. // -template -void Arr_construction_sl_visitor:: +template +void Arr_construction_sl_visitor:: _map_new_halfedge(unsigned int i, Halfedge_handle he) { #if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE @@ -925,6 +918,6 @@ _map_new_halfedge(unsigned int i, Halfedge_handle he) m_sc_he_table[i] = he; } -} //namespace CGAL +} // namespace CGAL #endif diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_insertion_sl_visitor.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_insertion_sl_visitor.h index 2a48491d85c..dc35d8d7df2 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_insertion_sl_visitor.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_insertion_sl_visitor.h @@ -30,6 +30,7 @@ */ #include +#include namespace CGAL { @@ -37,23 +38,33 @@ namespace CGAL { * A sweep-line visitor for inserting new curves into an existing arrangement * embedded on a surface. */ -template +template class Arr_insertion_sl_visitor : - public Arr_no_intersection_insertion_sl_visitor + public Arr_no_intersection_insertion_sl_visitor< + Helper_, + typename Default::Get >::type> { public: typedef Helper_ Helper; - typedef Arr_no_intersection_insertion_sl_visitor Base; + typedef typename Helper::Geometry_traits_2 Geometry_traits_2; + typedef typename Helper::Event Event; + typedef typename Helper::Subcurve Subcurve; - typedef typename Base::Geometry_traits_2 Geometry_traits_2; - typedef typename Base::Arrangement_2 Arrangement_2; - typedef typename Base::Event Event; - typedef typename Base::Subcurve Subcurve; +private: + typedef Geometry_traits_2 Gt2; + typedef Arr_insertion_sl_visitor Self; + typedef typename Default::Get::type Visitor; + typedef Arr_no_intersection_insertion_sl_visitor + Base; - typedef typename Base::Halfedge_handle Halfedge_handle; - typedef typename Base::X_monotone_curve_2 X_monotone_curve_2; - typedef typename Base::Point_2 Point_2; +public: + typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; + typedef typename Gt2::Point_2 Point_2; + + typedef typename Helper::Arrangement_2 Arrangement_2; + typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; private: X_monotone_curve_2 sub_cv1; // Auxiliary variables @@ -95,8 +106,9 @@ public: // Check if the halfedge associated with the given subcurve will be split // at the given event. // -template -bool Arr_insertion_sl_visitor::is_split_event(Subcurve* sc, Event* event) +template +bool Arr_insertion_sl_visitor:: +is_split_event(Subcurve* sc, Event* event) { if (sc->last_curve().halfedge_handle() == Halfedge_handle(NULL)) return false; @@ -109,10 +121,10 @@ bool Arr_insertion_sl_visitor::is_split_event(Subcurve* sc, Event* event) //----------------------------------------------------------------------------- // Split an edge. // -template -typename Arr_insertion_sl_visitor::Halfedge_handle -Arr_insertion_sl_visitor::split_edge(Halfedge_handle he, Subcurve* sc, - const Point_2& pt) +template +typename Arr_insertion_sl_visitor::Halfedge_handle +Arr_insertion_sl_visitor::split_edge(Halfedge_handle he, Subcurve* sc, + const Point_2& pt) { // Make sure that the halfedge associated with sc is the directed from // right to left, since we always "look" above , and the incident face @@ -133,8 +145,8 @@ Arr_insertion_sl_visitor::split_edge(Halfedge_handle he, Subcurve* sc, //----------------------------------------------------------------------------- // A notification invoked when a new subcurve is created. // -template -void Arr_insertion_sl_visitor:: +template +void Arr_insertion_sl_visitor:: add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc) { if (Base::add_subcurve_(cv, sc)) return; @@ -151,6 +163,6 @@ add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc) this->current_event()->set_halfedge_handle(next_ccw_he); } -} //namespace CGAL +} // namespace CGAL #endif diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_insertion_traits_2.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_insertion_traits_2.h index 5c7cf3d6bd7..d117a4ed4c0 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_insertion_traits_2.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_insertion_traits_2.h @@ -49,7 +49,6 @@ private: typedef Arr_basic_insertion_traits_2 Base; public: - typedef typename Gt2::Intersect_2 Base_intersect_2; typedef typename Gt2::Split_2 Base_split_2; typedef typename Base::Base_x_monotone_curve_2 Base_x_monotone_curve_2; @@ -76,9 +75,7 @@ public: public: /*! Constructor with a traits class. */ - Arr_insertion_traits_2(const Gt2& tr) : - Base (tr) - {} + Arr_insertion_traits_2(const Gt2& tr) : Base(tr) {} /*! A functor that compares compares the y-coordinates of two x-monotone * curves immediately to the right of their intersection point. @@ -139,7 +136,7 @@ public: } else { intersect_p = - object_cast > (&(*oi)); + object_cast >(&(*oi)); CGAL_assertion (intersect_p != NULL); @@ -155,13 +152,13 @@ public: /*! Obtain a Intersect_2 function object */ Intersect_2 intersect_2_object () const - { return (Intersect_2 (this->m_base_traits->intersect_2_object())); } + { return (Intersect_2(this->m_base_traits->intersect_2_object())); } /*! A functor that splits an arc at a point. */ class Split_2 { protected: //! The base operator. - Base_split_2 m_base_split; + Base_split_2 m_base_split; /*! Constructor. * The constructor is declared private to allow only the functor @@ -183,9 +180,9 @@ public: } }; - /*! Obtain a plit_2 function object */ + /*! Obtain a Split_2 function object */ Split_2 split_2_object() const - { return (Split_2 (this->m_base_traits->split_2_object())); } + { return (Split_2(this->m_base_traits->split_2_object())); } }; } // namespace CGAL diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_no_intersection_insertion_sl_visitor.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_no_intersection_insertion_sl_visitor.h index acaf43b2a52..f1b41cc488a 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_no_intersection_insertion_sl_visitor.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_no_intersection_insertion_sl_visitor.h @@ -29,6 +29,9 @@ * inserting non-intersecting curves into a empty arrangement. */ +#include +#include + namespace CGAL { /*! \class Arr_no_intersection_insertion_sl_visitor @@ -36,33 +39,41 @@ namespace CGAL { * embedded on a surface, where these curves are interior-disjoint from all * existing arrangement edges and vertices (so no intersections occur). */ -template -class Arr_no_intersection_insertion_sl_visitor : public Helper_::Parent_visitor { +template +class Arr_no_intersection_insertion_sl_visitor : + public Arr_construction_sl_visitor< + Helper_, + typename Default::Get >::type> +{ public: typedef Helper_ Helper; typedef typename Helper::Geometry_traits_2 Geometry_traits_2; - typedef typename Helper::Arrangement_2 Arrangement_2; - typedef typename Helper::Parent_visitor Base; typedef typename Helper::Event Event; typedef typename Helper::Subcurve Subcurve; private: typedef Geometry_traits_2 Gt2; + typedef Arr_no_intersection_insertion_sl_visitor + Self; + typedef typename Default::Get::type Visitor; + typedef Arr_construction_sl_visitor Base; public: typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::Point_2 Point_2; protected: - typedef typename Base::Status_line_iterator Status_line_iterator; - typedef typename Base::Vertex_handle Vertex_handle; - typedef typename Base::Halfedge_handle Halfedge_handle; - typedef typename Base::Face_handle Face_handle; - typedef typename Base::Event_subcurve_iterator Event_subcurve_iterator; + typedef typename Subcurve::Status_line_iterator Status_line_iterator; typedef typename Base::Event_subcurve_reverse_iterator Event_subcurve_reverse_iterator; + typedef typename Helper::Arrangement_2 Arrangement_2; + typedef typename Arrangement_2::Vertex_handle Vertex_handle; + typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; + typedef typename Arrangement_2::Face_handle Face_handle; + public: /*! Constructor. */ Arr_no_intersection_insertion_sl_visitor(Arrangement_2* arr) : Base(arr) {} @@ -217,16 +228,16 @@ protected: //----------------------------------------------------------------------------- // A notification issued before the sweep process starts. // Notifies the helper that the sweep process now starts. -template -void Arr_no_intersection_insertion_sl_visitor::before_sweep() +template +void Arr_no_intersection_insertion_sl_visitor::before_sweep() { this->m_helper.before_sweep(); } //----------------------------------------------------------------------------- // A notification invoked before the sweep-line starts handling the given // event. // -template -void Arr_no_intersection_insertion_sl_visitor:: +template +void Arr_no_intersection_insertion_sl_visitor:: before_handle_event(Event* event) { // First we notify the helper class on the event. @@ -319,8 +330,8 @@ before_handle_event(Event* event) //----------------------------------------------------------------------------- // Add a new curve. // -template -bool Arr_no_intersection_insertion_sl_visitor:: +template +bool Arr_no_intersection_insertion_sl_visitor:: add_subcurve_(const X_monotone_curve_2& cv, Subcurve* sc) { const Halfedge_handle invalid_he; @@ -336,8 +347,8 @@ add_subcurve_(const X_monotone_curve_2& cv, Subcurve* sc) //----------------------------------------------------------------------------- // A notification invoked when a new subcurve is created. // -template -void Arr_no_intersection_insertion_sl_visitor:: +template +void Arr_no_intersection_insertion_sl_visitor:: add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc) { if (add_subcurve_(cv, sc)) return; @@ -350,9 +361,9 @@ add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc) //----------------------------------------------------------------------------- // Insert the given subcurve in the interior of an arrangement face. // -template -typename Arr_no_intersection_insertion_sl_visitor::Halfedge_handle -Arr_no_intersection_insertion_sl_visitor:: +template +typename Arr_no_intersection_insertion_sl_visitor::Halfedge_handle +Arr_no_intersection_insertion_sl_visitor:: insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) { Event* last_event = this->last_event_on_subcurve(sc); @@ -375,9 +386,9 @@ insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) //----------------------------------------------------------------------------- // Insert the given subcurve from a vertex that corresponds to its left end. // -template -typename Arr_no_intersection_insertion_sl_visitor::Halfedge_handle -Arr_no_intersection_insertion_sl_visitor:: +template +typename Arr_no_intersection_insertion_sl_visitor::Halfedge_handle +Arr_no_intersection_insertion_sl_visitor:: insert_from_left_vertex(const X_monotone_curve_2& cv, Halfedge_handle he, Subcurve* sc) { @@ -391,9 +402,9 @@ insert_from_left_vertex(const X_monotone_curve_2& cv, Halfedge_handle he, //----------------------------------------------------------------------------- // Insert the given subcurve from a vertex that corresponds to its right end. // -template -typename Arr_no_intersection_insertion_sl_visitor::Halfedge_handle -Arr_no_intersection_insertion_sl_visitor:: +template +typename Arr_no_intersection_insertion_sl_visitor::Halfedge_handle +Arr_no_intersection_insertion_sl_visitor:: insert_from_right_vertex(const X_monotone_curve_2& cv, Halfedge_handle he, Subcurve* sc) { @@ -407,9 +418,9 @@ insert_from_right_vertex(const X_monotone_curve_2& cv, Halfedge_handle he, //----------------------------------------------------------------------------- // Insert the given subcurve using its two end-vertices. // -template -typename Arr_no_intersection_insertion_sl_visitor::Halfedge_handle -Arr_no_intersection_insertion_sl_visitor:: +template +typename Arr_no_intersection_insertion_sl_visitor::Halfedge_handle +Arr_no_intersection_insertion_sl_visitor:: insert_at_vertices(const X_monotone_curve_2& cv, Halfedge_handle prev1, Halfedge_handle prev2, Subcurve* sc, bool &new_face_created) @@ -418,9 +429,9 @@ insert_at_vertices(const X_monotone_curve_2& cv, //----------------------------------------------------------------------------- // Insert an isolated vertex into the arrangement. // -template -typename Arr_no_intersection_insertion_sl_visitor::Vertex_handle -Arr_no_intersection_insertion_sl_visitor:: +template +typename Arr_no_intersection_insertion_sl_visitor::Vertex_handle +Arr_no_intersection_insertion_sl_visitor:: insert_isolated_vertex(const Point_2& pt, Status_line_iterator iter) { // If the isolated vertex is already at the arrangement, return: @@ -435,9 +446,9 @@ insert_isolated_vertex(const Point_2& pt, Status_line_iterator iter) //----------------------------------------------------------------------------- // Perform the actual insertion // -template -typename Arr_no_intersection_insertion_sl_visitor::Halfedge_handle -Arr_no_intersection_insertion_sl_visitor:: +template +typename Arr_no_intersection_insertion_sl_visitor::Halfedge_handle +Arr_no_intersection_insertion_sl_visitor:: _insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) { // Check if the vertex to be associated with the left end of the curve has @@ -496,7 +507,7 @@ _insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) // Look up and insert the edge in the interior of the incident face of the // halfedge we see. - Face_handle f = _ray_shoot_up(this->status_line_position(sc)); + Face_handle f = _ray_shoot_up(sc->hint()); return (this->m_arr_access.insert_in_face_interior_ex(f, cv.base(), ARR_LEFT_TO_RIGHT, v1, v2)); @@ -505,9 +516,9 @@ _insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) //----------------------------------------------------------------------------- // Perform the actual insertion // -template -typename Arr_no_intersection_insertion_sl_visitor::Halfedge_handle -Arr_no_intersection_insertion_sl_visitor:: +template +typename Arr_no_intersection_insertion_sl_visitor::Halfedge_handle +Arr_no_intersection_insertion_sl_visitor:: _insert_from_left_vertex(const X_monotone_curve_2& cv, Halfedge_handle prev, Subcurve* sc) { @@ -542,9 +553,9 @@ _insert_from_left_vertex(const X_monotone_curve_2& cv, //----------------------------------------------------------------------------- // Perform the actual insertion // -template -typename Arr_no_intersection_insertion_sl_visitor::Halfedge_handle -Arr_no_intersection_insertion_sl_visitor:: +template +typename Arr_no_intersection_insertion_sl_visitor::Halfedge_handle +Arr_no_intersection_insertion_sl_visitor:: _insert_from_right_vertex(const X_monotone_curve_2& cv, Halfedge_handle prev, Subcurve* sc) { @@ -579,9 +590,9 @@ _insert_from_right_vertex(const X_monotone_curve_2& cv, Halfedge_handle prev, //----------------------------------------------------------------------------- // Perform the actual insertion // -template -typename Arr_no_intersection_insertion_sl_visitor::Halfedge_handle -Arr_no_intersection_insertion_sl_visitor:: +template +typename Arr_no_intersection_insertion_sl_visitor::Halfedge_handle +Arr_no_intersection_insertion_sl_visitor:: _insert_at_vertices(const X_monotone_curve_2& cv, Halfedge_handle prev1, Halfedge_handle prev2, Subcurve* sc, bool& new_face_created) @@ -624,9 +635,9 @@ _insert_at_vertices(const X_monotone_curve_2& cv, //----------------------------------------------------------------------------- // Locate the face containing the current object in its interior. // -template -typename Arr_no_intersection_insertion_sl_visitor::Face_handle -Arr_no_intersection_insertion_sl_visitor:: +template +typename Arr_no_intersection_insertion_sl_visitor::Face_handle +Arr_no_intersection_insertion_sl_visitor:: _ray_shoot_up(Status_line_iterator iter) { // Go up the status line and try to locate a curve which is associated @@ -643,6 +654,6 @@ _ray_shoot_up(Status_line_iterator iter) return (this->m_helper.top_face()); } -} //namespace CGAL +} // namespace CGAL #endif diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_overlay_sl_visitor.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_overlay_sl_visitor.h index 82f624d15be..6ee56813b21 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_overlay_sl_visitor.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_overlay_sl_visitor.h @@ -22,6 +22,7 @@ #include /*! \file + * * Definition of the Arr_overlay_sl_visitor class-template. */ @@ -33,6 +34,7 @@ #include #include #include +#include namespace CGAL { @@ -42,13 +44,18 @@ namespace CGAL { * arrangement, creating a result arrangement. All three arrangements are * embedded on the same type of surface and use the same geometry traits. */ -template -class Arr_overlay_sl_visitor : public - Arr_construction_sl_visitor +template +class Arr_overlay_sl_visitor : + public Arr_construction_sl_visitor< + typename OverlayHelper::Construction_helper, + typename Default::Get >::type> { public: - typedef OverlayHelper_ Overlay_helper; - typedef OverlayTraits_ Overlay_traits; + typedef OverlayHelper Overlay_helper; + typedef OverlayTraits Overlay_traits; typedef typename Overlay_helper::Geometry_traits_2 Geometry_traits_2; typedef typename Overlay_helper::Event Event; @@ -57,11 +64,20 @@ public: typedef typename Overlay_helper::Arrangement_red_2 Arrangement_red_2; typedef typename Overlay_helper::Arrangement_blue_2 Arrangement_blue_2; + typedef typename Overlay_helper::Construction_helper Construction_helper; + + private: typedef Geometry_traits_2 Gt2; typedef Arrangement_red_2 Ar2; typedef Arrangement_blue_2 Ab2; + typedef Arr_overlay_sl_visitor + Self; + typedef typename Default::Get::type Visitor; + typedef Arr_construction_sl_visitor + Base; + public: typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::Point_2 Point_2; @@ -84,10 +100,6 @@ public: Ccb_halfedge_circulator; typedef typename Arrangement_2::Outer_ccb_iterator Outer_ccb_iterator; - // The base construction visitor: - typedef typename Overlay_helper::Construction_helper Construction_helper; - typedef Arr_construction_sl_visitor Base; - typedef typename Base::Event_subcurve_iterator Event_subcurve_iterator; typedef typename Base::Event_subcurve_reverse_iterator @@ -397,8 +409,8 @@ protected: //----------------------------------------------------------------------------- // A notification issued before the sweep process starts. // -template -void Arr_overlay_sl_visitor::before_sweep() + template + void Arr_overlay_sl_visitor::before_sweep() { // Initialize the necessary fields in the base construction visitor. // Note that the construction visitor also informs its helper class that @@ -413,8 +425,9 @@ void Arr_overlay_sl_visitor::before_sweep() // A notification invoked before the sweep-line starts handling the given // event. // -template -void Arr_overlay_sl_visitor::before_handle_event(Event* event) +template +void +Arr_overlay_sl_visitor::before_handle_event(Event* event) { // Let the base construction visitor do the work (and also inform its helper // class on the event). @@ -428,8 +441,8 @@ void Arr_overlay_sl_visitor::before_handle_event(Event* event) // A notification invoked after the sweep-line finishes handling the given // event. // -template -bool Arr_overlay_sl_visitor:: +template +bool Arr_overlay_sl_visitor:: after_handle_event(Event* event, Status_line_iterator iter, bool flag) { // Let the base construction visitor handle the event. @@ -480,8 +493,8 @@ after_handle_event(Event* event, Status_line_iterator iter, bool flag) //----------------------------------------------------------------------------- // Update an event that corresponds to a curve endpoint. // -template -void Arr_overlay_sl_visitor:: +template +void Arr_overlay_sl_visitor:: update_event(Event* e, const Point_2& end_point, const X_monotone_curve_2& /* cv */, @@ -500,9 +513,9 @@ update_event(Event* e, //----------------------------------------------------------------------------- // Update an event. // -template -void Arr_overlay_sl_visitor::update_event(Event* e, - Subcurve* sc) +template +void Arr_overlay_sl_visitor::update_event(Event* e, + Subcurve* sc) { // Update the red and blue halfedges associated with the point as necessary. Point_2& pt = e->point(); @@ -523,8 +536,9 @@ void Arr_overlay_sl_visitor::update_event(Event* e, //----------------------------------------------------------------------------- // Update an event. // -template -void Arr_overlay_sl_visitor::update_event(Event* e, +template +void +Arr_overlay_sl_visitor::update_event(Event* e, const Point_2& p, bool /* is_new */) { @@ -537,8 +551,8 @@ void Arr_overlay_sl_visitor::update_event(Event* e, //----------------------------------------------------------------------------- // A notification issued when the sweep process has ended. // -template -void Arr_overlay_sl_visitor::after_sweep() +template +void Arr_overlay_sl_visitor::after_sweep() { // Notify boundary vertices: typename Vertex_map::iterator it; @@ -563,9 +577,9 @@ void Arr_overlay_sl_visitor::after_sweep() //----------------------------------------------------------------------------- // Insert the given subcurve in the interior of an arrangement face. // -template -typename Arr_overlay_sl_visitor::Halfedge_handle -Arr_overlay_sl_visitor:: +template +typename Arr_overlay_sl_visitor::Halfedge_handle +Arr_overlay_sl_visitor:: insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) { // Insert the halfedge using the base construction visitor. @@ -596,9 +610,9 @@ insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) //----------------------------------------------------------------------------- // Insert the given subcurve given its left end-vertex. // -template -typename Arr_overlay_sl_visitor::Halfedge_handle -Arr_overlay_sl_visitor:: +template +typename Arr_overlay_sl_visitor::Halfedge_handle +Arr_overlay_sl_visitor:: insert_from_left_vertex(const X_monotone_curve_2& cv, Halfedge_handle prev, Subcurve* sc) @@ -628,9 +642,9 @@ insert_from_left_vertex(const X_monotone_curve_2& cv, //----------------------------------------------------------------------------- // Insert the given subcurve given its right end-vertex. // -template -typename Arr_overlay_sl_visitor::Halfedge_handle -Arr_overlay_sl_visitor:: +template +typename Arr_overlay_sl_visitor::Halfedge_handle +Arr_overlay_sl_visitor:: insert_from_right_vertex(const X_monotone_curve_2& cv, Halfedge_handle prev, Subcurve* sc) @@ -659,9 +673,9 @@ insert_from_right_vertex(const X_monotone_curve_2& cv, //----------------------------------------------------------------------------- // Insert the given subcurve given its two end-vertices. // -template -typename Arr_overlay_sl_visitor::Halfedge_handle -Arr_overlay_sl_visitor:: +template +typename Arr_overlay_sl_visitor::Halfedge_handle +Arr_overlay_sl_visitor:: insert_at_vertices(const X_monotone_curve_2& cv, Halfedge_handle prev1, Halfedge_handle prev2, @@ -697,17 +711,17 @@ insert_at_vertices(const X_monotone_curve_2& cv, // Traverse the boundary of the new face, and locate halfedge originated // by red or by blue halfedges along its boundary. // We stop the traversal earlier if we locate a red and a blue halfedge. - const Halfedge_handle_red invalid_red_he; - const Halfedge_handle_blue invalid_blue_he; + const Halfedge_handle_red invalid_red_he; + const Halfedge_handle_blue invalid_blue_he; - Halfedge_handle_red red_he; - Halfedge_handle_blue blue_he; + Halfedge_handle_red red_he; + Halfedge_handle_blue blue_he; CGAL_assertion(new_face->number_of_outer_ccbs() > 0); Outer_ccb_iterator occb_it = new_face->outer_ccbs_begin(); // msvc CL requires the breakdown to the following 2 statements: - Ccb_halfedge_circulator ccb_first = *occb_it; - Ccb_halfedge_circulator ccb_circ = ccb_first; + Ccb_halfedge_circulator ccb_first = *occb_it; + Ccb_halfedge_circulator ccb_circ = ccb_first; do { // Get the current halfedge on the face boundary and obtain its @@ -777,9 +791,9 @@ insert_at_vertices(const X_monotone_curve_2& cv, //----------------------------------------------------------------------------- // Insert an isolated vertex into the arrangement. // -template -typename Arr_overlay_sl_visitor::Vertex_handle -Arr_overlay_sl_visitor:: +template +typename Arr_overlay_sl_visitor::Vertex_handle +Arr_overlay_sl_visitor:: insert_isolated_vertex(const Point_2& pt, Status_line_iterator iter) { @@ -879,8 +893,8 @@ insert_isolated_vertex(const Point_2& pt, // Map a newly created halfedge in the result arrangement to its originator // red and blue halfedges. // -template -void Arr_overlay_sl_visitor:: +template +void Arr_overlay_sl_visitor:: _map_halfedge_and_twin(Halfedge_handle he, Halfedge_handle_red red_he, Halfedge_handle_blue blue_he) @@ -906,8 +920,8 @@ _map_halfedge_and_twin(Halfedge_handle he, //----------------------------------------------------------------------------- // Update the boundary vertices map. // -template -void Arr_overlay_sl_visitor:: +template +void Arr_overlay_sl_visitor:: _map_boundary_vertices(Event* event, Vertex_handle v, boost::mpl::bool_) { // Update the red and blue object if the last event on sc is on the boundary. @@ -943,9 +957,10 @@ _map_boundary_vertices(Event* event, Vertex_handle v, boost::mpl::bool_) //----------------------------------------------------------------------------- // Update the boundary vertices map. // -template -void Arr_overlay_sl_visitor:: -_map_boundary_vertices(Event* /* event */, Vertex_handle /* v */, boost::mpl::bool_) +template +void Arr_overlay_sl_visitor:: +_map_boundary_vertices(Event* /* event */, Vertex_handle /* v */, + boost::mpl::bool_) {} /* Notify the overlay traits about a newly created vertex. @@ -954,8 +969,8 @@ _map_boundary_vertices(Event* /* event */, Vertex_handle /* v */, boost::mpl::bo * this case, we postpone the notification for all (contracted and identified) * boundary side vertices to the end of the sweep. */ -template -void Arr_overlay_sl_visitor:: +template +void Arr_overlay_sl_visitor:: _create_vertex(Event* event, Vertex_handle new_v, Subcurve* sc, @@ -1000,8 +1015,8 @@ _create_vertex(Event* event, } /* Notify the overlay traits about a newly created vertex. */ -template -void Arr_overlay_sl_visitor:: +template +void Arr_overlay_sl_visitor:: _create_vertex(Event* event, Vertex_handle new_v, Subcurve* sc, @@ -1045,10 +1060,10 @@ _create_vertex(Event* event, //----------------------------------------------------------------------------- // Update a newly created result edge using the overlay traits. // -template -void -Arr_overlay_sl_visitor::_create_edge(Subcurve* sc, - Halfedge_handle new_he) +template +void Arr_overlay_sl_visitor:: +_create_edge(Subcurve* sc, + Halfedge_handle new_he) { // Note that the "red" and "blue" halfedges are always directed from right // to left, so we make sure the overlaid halfedge is also directed from @@ -1084,6 +1099,6 @@ Arr_overlay_sl_visitor::_create_edge(Subcurve* sc, } } -} //namespace CGAL +} // namespace CGAL #endif diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_vert_decomp_sl_visitor.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_vert_decomp_sl_visitor.h index 62f2c6bc7a3..3997e0b610a 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_vert_decomp_sl_visitor.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_vert_decomp_sl_visitor.h @@ -13,6 +13,7 @@ // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // Author(s) : Ron Wein +// Efi Fogel #ifndef CGAL_ARR_VERT_DECOMP_SL_VISITOR_H #define CGAL_ARR_VERT_DECOMP_SL_VISITOR_H @@ -26,29 +27,47 @@ namespace CGAL { #include +#include /*! \class Arr_vert_decomp_sl_visitor * A sweep-line visitor for performing vertical decomposition on an * arrangement embedded on a surface. */ -template -class Arr_vert_decomp_sl_visitor : public Helper_::Base_visitor { +template +class Arr_vert_decomp_sl_visitor : + public Ss2::Visitor_base >::type> +{ public: typedef Helper_ Helper; typedef OutputIterator Output_iterator; typedef typename Helper::Geometry_traits_2 Geometry_traits_2; - typedef typename Helper::Arrangement_2 Arrangement_2; typedef typename Helper::Event Event; typedef typename Helper::Subcurve Subcurve; + typedef typename Helper::Allocator Allocator; +private: + typedef Geometry_traits_2 Gt2; + typedef Arr_vert_decomp_sl_visitor + Self; + typedef typename Default::Get::type Visitor; + typedef typename Ss2::Visitor_base + Base; +public: + typedef typename Helper::Arrangement_2 Arrangement_2; typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; typedef std::pair Vert_pair; typedef std::pair Vert_entry; protected: - typedef typename Helper::Base_visitor Base; typedef typename Base::Status_line_iterator Status_line_iterator; typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; //typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; @@ -108,8 +127,8 @@ public: //----------------------------------------------------------------------------- // A notification issued before the sweep process starts. // -template -void Arr_vert_decomp_sl_visitor::before_sweep() +template +void Arr_vert_decomp_sl_visitor::before_sweep() { // Notify the helper that the sweep process now starts. m_helper.before_sweep(); @@ -122,8 +141,8 @@ void Arr_vert_decomp_sl_visitor::before_sweep() // A notification invoked after the sweep-line finishes handling the given // event. // -template -bool Arr_vert_decomp_sl_visitor:: +template +bool Arr_vert_decomp_sl_visitor:: after_handle_event(Event* event, Status_line_iterator above, bool /* on_above */) { @@ -278,8 +297,8 @@ after_handle_event(Event* event, //----------------------------------------------------------------------------- // A notification issued when the sweep process is over. // -template -void Arr_vert_decomp_sl_visitor::after_sweep() +template +void Arr_vert_decomp_sl_visitor::after_sweep() { // Create an entry for the last vertex (the xy-largest one). if (m_prev_vh != invalid_vh) { @@ -289,6 +308,6 @@ void Arr_vert_decomp_sl_visitor::after_sweep() } } -} //namespace CGAL +} // namespace CGAL #endif diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Default_subcurve.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Default_subcurve.h index ece5599de4b..989027f1d44 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Default_subcurve.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Default_subcurve.h @@ -232,7 +232,7 @@ class Default_subcurve : public Default_subcurve_base >::type> { public: diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_intersection_surface_sweep_2_impl.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_intersection_surface_sweep_2_impl.h index 1f9f9ad9c05..3e98b7213b1 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_intersection_surface_sweep_2_impl.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_intersection_surface_sweep_2_impl.h @@ -12,9 +12,9 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// Author(s) : Baruch Zukerman -// Efi Fogel -// Eric Berberich +// Author(s) : Baruch Zukerman +// Efi Fogel +// Eric Berberich // (based on old version by Tali Zvi) #ifndef CGAL_NO_INTERSECTION_SURFACE_SWEEP_2_IMPL_H @@ -33,9 +33,8 @@ namespace Surface_sweep_2 { //----------------------------------------------------------------------------- // Constructor. // -template -No_intersection_surface_sweep_2:: +template +No_intersection_surface_sweep_2:: No_intersection_surface_sweep_2(Visitor* visitor) : m_traits(new Traits_adaptor_2()), m_traitsOwner(true), @@ -55,9 +54,8 @@ No_intersection_surface_sweep_2(Visitor* visitor) : //----------------------------------------------------------------------------- // Constructor with a given traits-class. // -template -No_intersection_surface_sweep_2:: +template +No_intersection_surface_sweep_2:: No_intersection_surface_sweep_2(const Gt2* traits, Visitor* visitor) : m_traits(static_cast(traits)), m_traitsOwner(false), @@ -77,10 +75,8 @@ No_intersection_surface_sweep_2(const Gt2* traits, Visitor* visitor) : //----------------------------------------------------------------------------- // Destrcutor. // -template -No_intersection_surface_sweep_2:: -~No_intersection_surface_sweep_2() +template +No_intersection_surface_sweep_2::~No_intersection_surface_sweep_2() { // Free the traits-class object, if we own it. if (m_traitsOwner) delete m_traits; @@ -101,9 +97,8 @@ No_intersection_surface_sweep_2:: //----------------------------------------------------------------------------- // Stop the sweep-line process. // -template -void No_intersection_surface_sweep_2::stop_sweep() +template +void No_intersection_surface_sweep_2::stop_sweep() { // Clear the event queue, deallocating all events but the current one // (the first event in the queue). @@ -131,10 +126,8 @@ void No_intersection_surface_sweep_2::stop_sweep() //----------------------------------------------------------------------------- // Deallocate event object.. // -template -void No_intersection_surface_sweep_2:: -deallocate_event(Event* event) +template +void No_intersection_surface_sweep_2::deallocate_event(Event* event) { // Remove the event from the set of allocated events. m_allocated_events.erase(event); @@ -147,9 +140,8 @@ deallocate_event(Event* event) //----------------------------------------------------------------------------- // Perform the main sweep-line loop. // -template -void No_intersection_surface_sweep_2::_sweep() +template +void No_intersection_surface_sweep_2::_sweep() { CGAL_SL_PRINT_TEXT("Ordered sequence of "); CGAL_SL_PRINT(m_queue->size()); @@ -208,10 +200,8 @@ void No_intersection_surface_sweep_2::_sweep() //----------------------------------------------------------------------------- // Initialize the data structures for the sweep-line algorithm. // -template -void No_intersection_surface_sweep_2:: -_init_structures() +template +void No_intersection_surface_sweep_2::_init_structures() { CGAL_assertion(m_queue->empty()); CGAL_assertion((m_statusLine.size() == 0)); @@ -225,10 +215,8 @@ _init_structures() //----------------------------------------------------------------------------- // Complete the sweep (complete the data structures). // -template -void No_intersection_surface_sweep_2:: -_complete_sweep() +template +void No_intersection_surface_sweep_2::_complete_sweep() { CGAL_assertion(m_queue->empty()); CGAL_assertion((m_statusLine.size() == 0)); @@ -244,10 +232,9 @@ _complete_sweep() //----------------------------------------------------------------------------- // Initialize an event associated with a point. // -template -void No_intersection_surface_sweep_2:: -_init_point(const Point_2& pt, Attribute type) +template +void No_intersection_surface_sweep_2::_init_point(const Point_2& pt, + Attribute type) { // Create the event, or obtain an existing event in the queue. // Note that an isolated point does not have any boundary conditions. @@ -261,9 +248,8 @@ _init_point(const Point_2& pt, Attribute type) //----------------------------------------------------------------------------- // Initialize the events associated with an x-monotone curve. // -template -void No_intersection_surface_sweep_2:: +template +void No_intersection_surface_sweep_2:: _init_curve(const X_monotone_curve_2& curve, unsigned int index) { // Construct and initialize a subcurve object. @@ -279,9 +265,8 @@ _init_curve(const X_monotone_curve_2& curve, unsigned int index) //----------------------------------------------------------------------------- // Initialize an event associated with an x-monotone curve end. // -template -void No_intersection_surface_sweep_2:: +template +void No_intersection_surface_sweep_2:: _init_curve_end(const X_monotone_curve_2& cv, Arr_curve_end ind, Subcurve* sc) { // Get the boundary conditions of the curve end. @@ -323,10 +308,8 @@ _init_curve_end(const X_monotone_curve_2& cv, Arr_curve_end ind, Subcurve* sc) //----------------------------------------------------------------------------- // Handle the subcurves to the left of the current event point. // -template -void No_intersection_surface_sweep_2:: -_handle_left_curves() +template +void No_intersection_surface_sweep_2::_handle_left_curves() { CGAL_SL_PRINT_START_EOL("handling left curves at ("); CGAL_SL_DEBUG(PrintEvent(m_currentEvent)); @@ -398,10 +381,8 @@ _handle_left_curves() //----------------------------------------------------------------------------- // Handle an event that does not have any incident left curves. // -template -void No_intersection_surface_sweep_2:: -_handle_event_without_left_curves() +template +void No_intersection_surface_sweep_2::_handle_event_without_left_curves() { // Check if the event is a boundary event or not. const Arr_parameter_space ps_x = m_currentEvent->parameter_space_in_x(); @@ -451,10 +432,8 @@ _handle_event_without_left_curves() // Sort the left subcurves of an event point according to their order in // their status line (no geometric comprasions are needed). // -template -void No_intersection_surface_sweep_2:: -_sort_left_curves() +template +void No_intersection_surface_sweep_2::_sort_left_curves() { CGAL_SL_PRINT_START_EOL("sorting left curves"); CGAL_assertion(m_currentEvent->has_left_curves()); @@ -517,10 +496,8 @@ _sort_left_curves() //----------------------------------------------------------------------------- // Handle the subcurves to the right of the current event point. // -template -void No_intersection_surface_sweep_2:: -_handle_right_curves() +template +void No_intersection_surface_sweep_2::_handle_right_curves() { CGAL_SL_PRINT_START("Handling right curves at ("); CGAL_SL_DEBUG(PrintEvent(m_currentEvent)); @@ -561,9 +538,8 @@ _handle_right_curves() //----------------------------------------------------------------------------- // Add a subcurve to the right of an event point. // -template -bool No_intersection_surface_sweep_2:: +template +bool No_intersection_surface_sweep_2:: _add_curve_to_right(Event* event, Subcurve* curve, bool /* overlap_exist */) { #if defined(CGAL_NO_ASSERTIONS) @@ -580,9 +556,8 @@ _add_curve_to_right(Event* event, Subcurve* curve, bool /* overlap_exist */) //----------------------------------------------------------------------------- // Remove a curve from the status line. // -template -void No_intersection_surface_sweep_2:: +template +void No_intersection_surface_sweep_2:: _remove_curve_from_status_line(Subcurve* sc) { CGAL_SL_PRINT_START("removing a curve from the status line, "); @@ -607,12 +582,12 @@ _remove_curve_from_status_line(Subcurve* sc) //----------------------------------------------------------------------------- // Allocate an event object associated with a valid point. // -template -typename No_intersection_surface_sweep_2::Event* -No_intersection_surface_sweep_2:: -_allocate_event(const Point_2& pt, Attribute type, - Arr_parameter_space ps_x, Arr_parameter_space ps_y) +template +typename No_intersection_surface_sweep_2::Event* +No_intersection_surface_sweep_2::_allocate_event(const Point_2& pt, + Attribute type, + Arr_parameter_space ps_x, + Arr_parameter_space ps_y) { // Allocate the event. Event* e = m_eventAlloc.allocate(1); @@ -628,10 +603,9 @@ _allocate_event(const Point_2& pt, Attribute type, // Allocate an event at open boundary, // which is not associated with a valid point. // -template -typename No_intersection_surface_sweep_2::Event* -No_intersection_surface_sweep_2:: +template +typename No_intersection_surface_sweep_2::Event* +No_intersection_surface_sweep_2:: _allocate_event_at_open_boundary(Attribute type, Arr_parameter_space ps_x, Arr_parameter_space ps_y) @@ -647,13 +621,13 @@ _allocate_event_at_open_boundary(Attribute type, //----------------------------------------------------------------------------- // Push a closed event point into the event queue. // -template -std::pair::Event*, bool> -No_intersection_surface_sweep_2:: -_push_event(const Point_2& pt, Attribute type, - Arr_parameter_space ps_x, Arr_parameter_space ps_y, Subcurve* sc) +template +std::pair::Event*, bool> +No_intersection_surface_sweep_2::_push_event(const Point_2& pt, + Attribute type, + Arr_parameter_space ps_x, + Arr_parameter_space ps_y, + Subcurve* sc) { // Look for the point in the event queue. Event* e; @@ -698,14 +672,14 @@ _push_event(const Point_2& pt, Attribute type, //----------------------------------------------------------------------------- // Push an event point associated with a curve end into the event queue. // -template -std::pair::Event*, - bool> -No_intersection_surface_sweep_2:: -_push_event(const X_monotone_curve_2& cv, Arr_curve_end ind, Attribute type, - Arr_parameter_space ps_x, Arr_parameter_space ps_y, Subcurve* sc) +template +std::pair::Event*, bool> +No_intersection_surface_sweep_2::_push_event(const X_monotone_curve_2& cv, + Arr_curve_end ind, + Attribute type, + Arr_parameter_space ps_x, + Arr_parameter_space ps_y, + Subcurve* sc) { // Look for the curve end in the event queue. Event* e; @@ -762,10 +736,9 @@ _push_event(const X_monotone_curve_2& cv, Arr_curve_end ind, Attribute type, // add a curve as a right curve or left curve when the event is created // or updated. // -template -void No_intersection_surface_sweep_2:: -_add_curve(Event* e, Subcurve* sc, Attribute type) +template +void No_intersection_surface_sweep_2::_add_curve(Event* e, Subcurve* sc, + Attribute type) { if (sc == NULL) return; diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_overlap_event.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_overlap_event.h index 9a17460c0a4..1aea108f42d 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_overlap_event.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_overlap_event.h @@ -15,7 +15,7 @@ // Author(s) : Tali Zvi , // Baruch Zukerman // Ron Wein -// Efi Fogel +// Efi Fogel #ifndef CGAL_SURFACE_SWEEP_2_NO_OVERLAP_EVENT_H #define CGAL_SURFACE_SWEEP_2_NO_OVERLAP_EVENT_H @@ -23,6 +23,7 @@ #include /*! \file + * * Defintion of the No_overlap_event class. */ diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_overlap_subcurve.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_overlap_subcurve.h index 0290841576f..dae78314fa8 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_overlap_subcurve.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_overlap_subcurve.h @@ -66,13 +66,14 @@ public: typedef GeometryTraits_2 Geometry_traits_2; typedef Subcurve_ Subcurve; typedef Event_ Event; + typedef CGAL_ALLOCATOR(int) Allocator; private: typedef Geometry_traits_2 Gt2; public: typedef Curve_comparer Compare_curves; - typedef Multiset + typedef Multiset Status_line; typedef typename Status_line::iterator Status_line_iterator; @@ -143,7 +144,8 @@ private: typedef Geometry_traits_2 Gt2; typedef No_overlap_subcurve Self; typedef typename Default::Get::type Subcurve; - typedef No_overlap_subcurve_base Base; + typedef No_overlap_subcurve_base + Base; public: typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h index 5f9d56b5f7e..1a8d25c95f9 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h @@ -32,9 +32,8 @@ namespace Surface_sweep_2 { //----------------------------------------------------------------------------- // Initialize the data structures for the sweep-line algorithm. // -template -void Surface_sweep_2::_init_structures() +template +void Surface_sweep_2::_init_structures() { // Initailize the structures maintained by the base sweep-line class. Base::_init_structures(); @@ -46,9 +45,8 @@ void Surface_sweep_2::_init_structures() //----------------------------------------------------------------------------- // Complete the sweep (complete the data structures). // -template -void Surface_sweep_2::_complete_sweep() +template +void Surface_sweep_2::_complete_sweep() { CGAL_SL_PRINT_START_EOL("completing the sweep"); @@ -75,9 +73,8 @@ void Surface_sweep_2::_complete_sweep() //----------------------------------------------------------------------------- // Handle the subcurves to the left of the current event point. // -template -void Surface_sweep_2::_handle_left_curves() +template +void Surface_sweep_2::_handle_left_curves() { CGAL_SL_PRINT_START("handling left curves at ("); CGAL_SL_DEBUG(this->PrintEvent(this->m_currentEvent)); @@ -206,9 +203,8 @@ void Surface_sweep_2::_handle_left_curves() //----------------------------------------------------------------------------- // Handle the subcurves to the right of the current event point. // -template -void Surface_sweep_2::_handle_right_curves() +template +void Surface_sweep_2::_handle_right_curves() { CGAL_SL_PRINT_START("handling right curves at ("); CGAL_SL_DEBUG(this->PrintEvent(this->m_currentEvent)); @@ -285,9 +281,8 @@ void Surface_sweep_2::_handle_right_curves() //----------------------------------------------------------------------------- // Add a subcurve to the right of an event point. // -template -bool Surface_sweep_2:: +template +bool Surface_sweep_2:: _add_curve_to_right(Event* event, Subcurve* curve, bool overlap_exist) { CGAL_SL_PRINT_START("adding a Curve to the right of ("); @@ -365,10 +360,9 @@ _add_curve_to_right(Event* event, Subcurve* curve, bool overlap_exist) //----------------------------------------------------------------------------- // Remove a curve from the status line. // -template -void Surface_sweep_2:: -_remove_curve_from_status_line(Subcurve* leftCurve, bool remove_for_good) +template +void Surface_sweep_2::_remove_curve_from_status_line(Subcurve* leftCurve, + bool remove_for_good) { CGAL_SL_PRINT_START("removing a curve from the status line, "); CGAL_SL_PRINT_CURVE(leftCurve); @@ -412,10 +406,8 @@ _remove_curve_from_status_line(Subcurve* leftCurve, bool remove_for_good) //----------------------------------------------------------------------------- // Compute intersections between the two given curves. // -template -void Surface_sweep_2::_intersect(Subcurve* c1, - Subcurve* c2) +template +void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2) { CGAL_SL_PRINT_START("computing intersection of "); CGAL_SL_PRINT_CURVE(c1); @@ -423,7 +415,7 @@ void Surface_sweep_2::_intersect(Subcurve* c1, CGAL_SL_PRINT_CURVE(c2); CGAL_SL_PRINT_EOL(); - typedef typename Tr::Multiplicity Multiplicity; + typedef typename Geometry_traits_2::Multiplicity Multiplicity; CGAL_assertion(c1 != c2); @@ -583,13 +575,12 @@ void Surface_sweep_2::_intersect(Subcurve* c1, //----------------------------------------------------------------------------- // Create an intersection-point event between two curves. // -template -void Surface_sweep_2:: -_create_intersection_point(const Point_2& xp, - unsigned int multiplicity, - Subcurve*& c1, Subcurve*& c2, - bool is_overlap) +template +void Surface_sweep_2::_create_intersection_point(const Point_2& xp, + unsigned int multiplicity, + Subcurve*& c1, + Subcurve*& c2, + bool is_overlap) { CGAL_SL_PRINT_START_EOL("createing an intersection point netween"); CGAL_SL_PRINT_CURVE(c1); @@ -687,9 +678,8 @@ _create_intersection_point(const Point_2& xp, //----------------------------------------------------------------------------- // Fix overlap Subcurves before handling the current event. // -template -void Surface_sweep_2::_fix_overlap_subcurves() +template +void Surface_sweep_2::_fix_overlap_subcurves() { CGAL_SL_PRINT_START_EOL("fixing overlap subcurves"); @@ -727,11 +717,10 @@ void Surface_sweep_2::_fix_overlap_subcurves() * \param overlap_exist a flag indicates if the overlap X_monotone_curve_2 was * computed already (is true than its stored at sub_cv1 data member). */ -template -void Surface_sweep_2:: -_handle_overlap(Event* event, Subcurve* curve, Event_subcurve_iterator iter, - bool overlap_exist) +template +void Surface_sweep_2::_handle_overlap(Event* event, Subcurve* curve, + Event_subcurve_iterator iter, + bool overlap_exist) { // An overlap occurs: CGAL_SL_PRINT_START_EOL("handling overlap at right insertion"); @@ -740,7 +729,7 @@ _handle_overlap(Event* event, Subcurve* curve, Event_subcurve_iterator iter, if (overlap_exist) overlap_cv = sub_cv1; else { // compute the overlap. - std::vector obj_vec; + std::vector obj_vec; vector_inserter vit(obj_vec); this->m_traits->intersect_2_object()(curve->last_curve(), (*iter)->last_curve(), @@ -879,10 +868,8 @@ _handle_overlap(Event* event, Subcurve* curve, Event_subcurve_iterator iter, // sc - some originating subcurve of a aubcurve that stores an overlap // notice thah this function is recursive since an originating subcurve of // an overlap can be itself a subcurve that stores overlap and so on. -template -void Surface_sweep_2:: -_fix_finished_overlap_subcurve(Subcurve* sc) +template +void Surface_sweep_2::_fix_finished_overlap_subcurve(Subcurve* sc) { CGAL_SL_PRINT_START("fixing finished overlap subcurve "); CGAL_SL_PRINT_CURVE(sc); @@ -925,10 +912,8 @@ _fix_finished_overlap_subcurve(Subcurve* sc) // add a curve as a right curve or left curve when the event is created // or updated. // -template -void Surface_sweep_2:: -_add_curve(Event* e, Subcurve* sc, Attribute type) +template +void Surface_sweep_2::_add_curve(Event* e, Subcurve* sc, Attribute type) { if (sc == NULL) return; diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_visitors.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_visitors.h index b032a2f431a..af3818c80e9 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_visitors.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_visitors.h @@ -13,7 +13,8 @@ // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // Author(s) : Baruch Zukerman -// Ron Wein +// Ron Wein +// Efi Fogel #ifndef CGAL_SURFACE_SWEEP_2_VISITORS_H #define CGAL_SURFACE_SWEEP_2_VISITORS_H @@ -26,45 +27,47 @@ * sweep-line functions. */ -#include -#include #include #include +#include +#include +#include + namespace CGAL { namespace Surface_sweep_2 { -/*! \class +/*! \class Surface_sweep_points_visitor * * A simple sweep-line visitor that reports all intersection points among a * set of input curves. */ -template +template class Surface_sweep_points_visitor : - public Surface_sweep_empty_visitor + public Default_visitor, + GeometryTraits_2> { public: typedef GeometryTraits_2 Geometry_traits_2; - typedef OutputIerator_ Output_ierator; + typedef OutputIerator Output_ierator; private: typedef Geometry_traits_2 Gt2; typedef Surface_sweep_points_visitor Self; - typedef Surface_sweep_empty_visitor Base; + typedef Default_visitor Base; public: typedef typename Base::Event Event; typedef typename Base::Subcurve Subcurve; - typedef typename Base::Event_subcurve_iterator Event_subcurve_iterator; - typedef typename Base::Status_line_iterator Status_line_iterator; + typedef typename Subcurve::Status_line_iterator Status_line_iterator; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::Point_2 Point_2; - typedef CGAL::Surface_sweep_2::Surface_sweep_2 - Surface_sweep_2; + typedef CGAL::Surface_sweep_2::Surface_sweep_2 Surface_sweep_2; protected: Output_ierator m_out; // The output points. @@ -113,22 +116,26 @@ public: Output_ierator output_iterator() { return m_out; } }; -/*! \class +/*! \class Surface_sweep_subcurves_visitor + * * A simple sweep-line visitor that reports all non-intersecting * x-monotone curves induced by a set of input curves. */ -template +template class Surface_sweep_subcurves_visitor : - public Surface_sweep_empty_visitor + public Default_visitor, + GeometryTraits_2> { +public: typedef GeometryTraits_2 Geometry_traits_2; - typedef OutputIerator_ Output_ierator; + typedef OutputIerator Output_ierator; private: typedef Geometry_traits_2 Gt2; typedef Surface_sweep_subcurves_visitor Self; - typedef Surface_sweep_empty_visitor Base; + typedef Default_visitor Base; public: typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; @@ -136,10 +143,10 @@ public: typedef typename Base::Event Event; typedef typename Base::Subcurve Subcurve; - typedef typename Base::Status_line_iterator Status_line_iterator; - typedef CGAL::Surface_sweep_2::Surface_sweep_2 - Surface_sweep_2; + typedef typename Subcurve::Status_line_iterator Status_line_iterator; + + typedef CGAL::Surface_sweep_2::Surface_sweep_2 Surface_sweep_2; protected: // Data members: @@ -191,31 +198,34 @@ public: Output_ierator output_iterator() { return m_out; } }; -/*! \class +/*! \class Surface_sweep_do_curves_x_visitor + * * A simple sweep-line visitor that determines if there are intersections * in the interiors of the given curve set. */ template class Surface_sweep_do_curves_x_visitor : - public Surface_sweep_empty_visitor + public Default_visitor, + GeometryTraits_2> { +public: typedef GeometryTraits_2 Geometry_traits_2; private: typedef Geometry_traits_2 Gt2; typedef Surface_sweep_do_curves_x_visitor Self; - typedef Surface_sweep_empty_visitor Base; + typedef Default_visitor Base; public: + typedef typename Base::Event Event; + typedef typename Base::Subcurve Subcurve; + + typedef typename Subcurve::Status_line_iterator Status_line_iterator; + typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::Point_2 Point_2; - typedef typename Base::Event Event; - typedef typename Base::Subcurve Subcurve; - typedef typename Base::Status_line_iterator Status_line_iterator; - - typedef CGAL::Surface_sweep_2::Surface_sweep_2 - Surface_sweep_2; + typedef CGAL::Surface_sweep_2::Surface_sweep_2 Surface_sweep_2; protected: // Data members: diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_empty_visitor.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Visitor.h similarity index 62% rename from Surface_sweep_2/include/CGAL/Surface_sweep_empty_visitor.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Visitor.h index 986dc73a872..56121d4ee16 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_empty_visitor.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Visitor.h @@ -13,9 +13,10 @@ // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // Author(s) : Baruch Zukerman +// Efi Fogel -#ifndef CGAL_SURFACE_SWEEP_EMPTY_VISITOR_H -#define CGAL_SURFACE_SWEEP_EMPTY_VISITOR_H +#ifndef CGAL_SURFACE_SWEEP_2_VISITOR_H +#define CGAL_SURFACE_SWEEP_2_VISITOR_H #include @@ -31,90 +32,52 @@ namespace CGAL { namespace Surface_sweep_2 { -/*! \class +/*! \class Visitor_base * * An empty surface-sweep visitor that does nothing. It is used as a base-class * for other concrete visitors that produce some output. */ -template , - typename Subcurve_ = Default_subcurve, - typename Allocator_ = CGAL_ALLOCATOR(int)> -class Surface_sweep_empty_visitor { +template +class Visitor_base { public: typedef GeometryTraits_2 Geometry_traits_2; typedef Event_ Event; typedef Subcurve_ Subcurve; typedef Allocator_ Allocator; + typedef Visitor_ Visitor; private: typedef Geometry_traits_2 Gt2; - typedef Surface_sweep_empty_visitor + typedef Visitor_base Self; - // we want to hide the Surface_sweep type - typedef No_intersection_surface_sweep_2 - Surface_sweep; - - typedef typename Surface_sweep::Status_line_iterator Base_status_line_iter; - public: + typedef typename Subcurve::Status_line_iterator Status_line_iterator; + typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::Point_2 Point_2; -public: - /*! \class - * A wrapper for the base status-line iterator. - */ - class Status_line_iterator : public Base_status_line_iter { - public: - typedef Subcurve* value_type; - typedef value_type& reference; - typedef value_type* pointer; - typedef typename Base_status_line_iter::difference_type difference_type; - typedef typename Base_status_line_iter::iterator_category - iterator_category; - /*! Constructor. */ - Status_line_iterator() {} - - /*! Constructor from a base iterator. */ - Status_line_iterator(Base_status_line_iter iter) : - Base_status_line_iter(iter) - {} - - // Overriden operator* - reference operator*() - { - return (reinterpret_cast - (((Base_status_line_iter*)this)->operator*())); - } - - // Overriden operator-> - pointer operator->() - { - return (reinterpret_cast(Base_status_line_iter::operator->())); - } - }; - - typedef typename Event::Subcurve_iterator Event_subcurve_iterator; + typedef typename Event::Subcurve_iterator Event_subcurve_iterator; typedef typename Event::Subcurve_reverse_iterator Event_subcurve_reverse_iterator; + typedef No_intersection_surface_sweep_2 Surface_sweep_2; + protected: // Data members: - void* m_surface_sweep; // The sweep-line object. + Surface_sweep_2* m_surface_sweep; // The sweep-line object. public: /*! Constructor. */ - Surface_sweep_empty_visitor () : - m_surface_sweep(NULL) - {} - - /*! Attach the a sweep-line object. */ - void attach(void* sl) { m_surface_sweep = sl; } + Visitor_base () : m_surface_sweep(NULL) {} /*! Destructor */ - virtual ~Surface_sweep_empty_visitor() {} + virtual ~Visitor_base() {} + + /*! Attach the a sweep-line object. */ + void attach(const Surface_sweep_2* sl) + { m_surface_sweep = (Surface_sweep_2*)(sl); } /*! * A notification invoked before the sweep-line starts handling the given @@ -185,47 +148,52 @@ public: /*! Obtain the first subcurve in the status line. */ Status_line_iterator status_line_begin() - { return (this->_surface_sweep()->status_line_begin()); } + { return surface_sweep()->status_line_begin(); } /*! Obtain a past-the-end iterator for the subcurves in the status line. */ Status_line_iterator status_line_end() - { return (this->_surface_sweep()->status_line_end()); } - - /*! Obtain the position of the given subcurve in the status line. */ - Status_line_iterator status_line_position(Subcurve* sc) - { return (sc->hint()); } + { return surface_sweep()->status_line_end(); } /*! Obtain the number of subcurves in the status line. */ unsigned status_line_size() const - { return (this->_surface_sweep()->status_line_size()); } + { return surface_sweep()->status_line_size(); } /*! Check if the status line is empty. */ bool is_status_line_empty() const - { return (this->_surface_sweep()->is_status_line_empty()); } + { return surface_sweep()->is_status_line_empty(); } /*! Deallocate the given event. */ - void deallocate_event(Event* e) - { this->_surface_sweep()->deallocate_event(e); } + void deallocate_event(Event* e) { surface_sweep()->deallocate_event(e); } /*! Stop the sweep-line process. */ - void stop_sweep() { this->_surface_sweep()->stop_sweep(); } + void stop_sweep() { surface_sweep()->stop_sweep(); } /*! Obtain the sweep-line object. */ - void* surface_sweep() { return m_surface_sweep; } + Surface_sweep_2* surface_sweep() { return m_surface_sweep; } + + /*! Obtain the sweep-line object. */ + const Surface_sweep_2* surface_sweep() const { return m_surface_sweep; } /*! Obtain the current event. */ - Event* current_event() { return (this->_surface_sweep()->current_event()); } + Event* current_event() { return surface_sweep()->current_event(); } /*! Obtain the geometry-traits class. */ - const Gt2* traits() { return (this->_surface_sweep()->traits()); } + const Gt2* traits() { return surface_sweep()->traits(); } +}; -private: - /*! Obtain the sweep-line object. */ - Surface_sweep* _surface_sweep() - { return (reinterpret_cast(m_surface_sweep)); } - - const Surface_sweep* _surface_sweep() const - { return (reinterpret_cast(m_surface_sweep)); } +template , + typename Subcurve_ = Default_subcurve, + typename Allocator_ = CGAL_ALLOCATOR(int)> +class Default_visitor : public Visitor_base +{ +public: + typedef GeometryTraits_2 Geometry_traits_2; + typedef Event_ Event; + typedef Subcurve_ Subcurve; + typedef Allocator_ Allocator; }; } // namespace Surface_sweep_2 diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2_algorithms.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2_algorithms.h index c7696645dcc..0cde9fa34e9 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2_algorithms.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2_algorithms.h @@ -119,14 +119,14 @@ OutputIterator compute_intersection_points(CurveInputIterator curves_begin, // Define the surface-sweep types: typedef Ss2::Surface_sweep_points_visitor Visitor; - typedef Ss2::Surface_sweep_2 Surface_sweep; + typedef Ss2::Surface_sweep_2 Surface_sweep; // Perform the sweep and obtain the intersection points. Visitor visitor(points, report_endpoints); Surface_sweep surface_sweep(&tr, &visitor); visitor.sweep(curves_begin, curves_end); - return (visitor.output_iterator()); + return visitor.output_iterator(); } template @@ -139,8 +139,8 @@ OutputIterator compute_intersection_points(CurveInputIterator curves_begin, typename Default_arr_traits::Traits traits; - return (compute_intersection_points(curves_begin, curves_end, points, - report_endpoints, traits)); + return compute_intersection_points(curves_begin, curves_end, points, + report_endpoints, traits); } /*! Compute all x-monotone subcurves that are disjoint in their interiors @@ -163,14 +163,14 @@ OutputIterator compute_subcurves(CurveInputIterator curves_begin, // Define the surface-sweep types: typedef Ss2::Surface_sweep_subcurves_visitor Visitor; - typedef Ss2::Surface_sweep_2 Surface_sweep; + typedef Ss2::Surface_sweep_2 Surface_sweep; // Perform the sweep and obtain the subcurves. Visitor visitor(subcurves, mult_overlaps); Surface_sweep surface_sweep(&tr, &visitor); visitor.sweep(curves_begin, curves_end); - return (visitor.output_iterator()); + return visitor.output_iterator(); } template @@ -197,14 +197,13 @@ bool do_curves_intersect(CurveInputIterator curves_begin, { // Define the surface-sweep types: typedef Ss2::Surface_sweep_do_curves_x_visitor Visitor; - typedef Ss2::Surface_sweep_2 Surface_sweep; + typedef Ss2::Surface_sweep_2 Surface_sweep; // Perform the sweep and obtain the subcurves. Visitor visitor; Surface_sweep surface_sweep(&tr, &visitor); visitor.sweep(curves_begin, curves_end); - - return (visitor.found_intersection()); + return visitor.found_intersection(); } template