Changed Surface_sweep_2 and No_intersection_surface_sweep_2 to be templates parameterized only by visitors.

This commit is contained in:
Efi Fogel 2017-06-15 16:19:00 +03:00
parent 2c09a3f378
commit ae01194712
38 changed files with 707 additions and 712 deletions

View File

@ -47,7 +47,7 @@ namespace Ss2 = Surface_sweep_2;
* Face_const_handle> >. * Face_const_handle> >.
* It represents the arrangement feature containing the point. * It represents the arrangement feature containing the point.
*/ */
template<typename GeometryTraits_2, typename TopologyTraits, template <typename GeometryTraits_2, typename TopologyTraits,
typename PointsIterator, typename OutputIterator> typename PointsIterator, typename OutputIterator>
OutputIterator OutputIterator
locate(const Arrangement_on_surface_2<GeometryTraits_2, TopologyTraits>& arr, locate(const Arrangement_on_surface_2<GeometryTraits_2, TopologyTraits>& arr,
@ -123,9 +123,7 @@ locate(const Arrangement_on_surface_2<GeometryTraits_2, TopologyTraits>& arr,
// Define the sweep-line visitor and perform the sweep. // Define the sweep-line visitor and perform the sweep.
Bpl_visitor visitor(&arr, oi); Bpl_visitor visitor(&arr, oi);
Ss2::No_intersection_surface_sweep_2<Bpl_traits_2, Bpl_visitor, Ss2::No_intersection_surface_sweep_2<Bpl_visitor>
typename Bpl_visitor::Event,
typename Bpl_visitor::Subcurve>
surface_sweep(&ex_traits, &visitor); surface_sweep(&ex_traits, &visitor);
surface_sweep.sweep(xcurves_vec.begin(), xcurves_vec.end(), // Curves. surface_sweep.sweep(xcurves_vec.begin(), xcurves_vec.end(), // Curves.
iso_pts_vec.begin(), iso_pts_vec.end(), // Action points. iso_pts_vec.begin(), iso_pts_vec.end(), // Action points.

View File

@ -301,17 +301,24 @@ public:
typedef Arr_no_intersection_insertion_sl_visitor<NxIHelper> typedef Arr_no_intersection_insertion_sl_visitor<NxIHelper>
Surface_sweep_no_intersection_insertion_visitor; Surface_sweep_no_intersection_insertion_visitor;
template <typename OutputIterator_> /*! \class Surface_sweep_batched_point_location_visitor
*/
template <typename OutputIterator>
struct Surface_sweep_batched_point_location_visitor : struct Surface_sweep_batched_point_location_visitor :
public Arr_batched_pl_sl_visitor<BplHelper, OutputIterator_> public Arr_batched_pl_sl_visitor<
BplHelper, OutputIterator,
Surface_sweep_batched_point_location_visitor<OutputIterator> >
{ {
typedef OutputIterator_ Output_iterator; typedef OutputIterator Output_iterator;
typedef Arr_batched_pl_sl_visitor<BplHelper, Output_iterator> typedef Surface_sweep_batched_point_location_visitor<Output_iterator>
Self;
typedef Arr_batched_pl_sl_visitor<BplHelper, Output_iterator, Self>
Base; Base;
typedef typename Base::Geometry_traits_2 Geometry_traits_2;
typedef typename Base::Event Event; typedef typename BplHelper::Geometry_traits_2 Geometry_traits_2;
typedef typename Base::Subcurve Subcurve; typedef typename BplHelper::Event Event;
typedef typename BplHelper::Subcurve Subcurve;
Surface_sweep_batched_point_location_visitor(const Arr* arr, Surface_sweep_batched_point_location_visitor(const Arr* arr,
Output_iterator& oi) : Output_iterator& oi) :
@ -319,13 +326,20 @@ public:
{} {}
}; };
template <typename OutputIterator_> /*! \class Surface_sweep_vertical_decomposition_visitor
*/
template <typename OutputIterator>
struct Surface_sweep_vertical_decomposition_visitor : struct Surface_sweep_vertical_decomposition_visitor :
public Arr_vert_decomp_sl_visitor<VdHelper, OutputIterator_> public Arr_vert_decomp_sl_visitor<
VdHelper, OutputIterator,
Surface_sweep_vertical_decomposition_visitor<OutputIterator> >
{ {
typedef OutputIterator_ Output_iterator; typedef OutputIterator Output_iterator;
typedef Surface_sweep_vertical_decomposition_visitor<Output_iterator>
Self;
typedef Arr_vert_decomp_sl_visitor<VdHelper, Output_iterator, Self>
Base;
typedef Arr_vert_decomp_sl_visitor<VdHelper, Output_iterator> Base;
typedef typename Base::Geometry_traits_2 Geometry_traits_2; typedef typename Base::Geometry_traits_2 Geometry_traits_2;
typedef typename Base::Event Event; typedef typename Base::Event Event;
typedef typename Base::Subcurve Subcurve; typedef typename Base::Subcurve Subcurve;
@ -336,6 +350,8 @@ public:
{} {}
}; };
/*! \class Surface_sweep_overlay_visitor
*/
template <typename ArrangementA, typename ArrangementB, template <typename ArrangementA, typename ArrangementB,
typename OverlayTraits> typename OverlayTraits>
struct Surface_sweep_overlay_visitor : struct Surface_sweep_overlay_visitor :
@ -344,7 +360,10 @@ public:
Geometry_traits_2>, Geometry_traits_2>,
ArrangementA, ArrangementB>, ArrangementA, ArrangementB>,
ArrangementA, ArrangementB>, ArrangementA, ArrangementB>,
OverlayTraits> OverlayTraits,
Surface_sweep_overlay_visitor<ArrangementA,
ArrangementB,
OverlayTraits> >
{ {
typedef ArrangementA Arrangement_a; typedef ArrangementA Arrangement_a;
typedef ArrangementB Arrangement_b; typedef ArrangementB Arrangement_b;
@ -358,7 +377,10 @@ public:
typedef _Overlay_helper<Geom_ovl_traits_2, Arrangement_a, Arrangement_b> typedef _Overlay_helper<Geom_ovl_traits_2, Arrangement_a, Arrangement_b>
Ovl_helper; Ovl_helper;
typedef Arr_overlay_sl_visitor<Ovl_helper, Overlay_traits> typedef Surface_sweep_overlay_visitor<ArrangementA, ArrangementB,
OverlayTraits>
Self;
typedef Arr_overlay_sl_visitor<Ovl_helper, Overlay_traits, Self>
Base; Base;
// typedef typename Base::Geometry_traits_2 Geometry_traits_2; // typedef typename Base::Geometry_traits_2 Geometry_traits_2;

View File

@ -21,6 +21,7 @@
#include <CGAL/license/Arrangement_on_surface_2.h> #include <CGAL/license/Arrangement_on_surface_2.h>
/*! \file /*! \file
*
* Definition of the global Arr_overlay_2() function. * Definition of the global Arr_overlay_2() function.
*/ */
@ -150,10 +151,7 @@ void overlay(const Arrangement_on_surface_2<GeomTraitsA, TopTraitsA>& arr1,
ex_traits(*traits_adaptor); ex_traits(*traits_adaptor);
Ovl_visitor visitor(&arr1, &arr2, &arr_res, &ovl_tr); Ovl_visitor visitor(&arr1, &arr2, &arr_res, &ovl_tr);
Ss2::Surface_sweep_2<Ovl_traits_2, Ovl_visitor, Ss2::Surface_sweep_2<Ovl_visitor> sweep_line(&ex_traits, &visitor);
typename Ovl_visitor::Event,
typename Ovl_visitor::Subcurve>
sweep_line(&ex_traits, &visitor);
// In case both arrangement do not contain isolated vertices, go on and // In case both arrangement do not contain isolated vertices, go on and
// overlay them. // overlay them.

View File

@ -344,8 +344,8 @@ private:
// Type definition for the basic insertion sweep-line visitor. // Type definition for the basic insertion sweep-line visitor.
typedef Arr_basic_insertion_traits_2<Gt2, Arr> NxITraits; typedef Arr_basic_insertion_traits_2<Gt2, Arr> NxITraits;
typedef Arr_construction_event<NxITraits, Arr, Ss2::No_overlap_event_base> typedef Arr_construction_event<NxITraits, Arr, Ss2::No_overlap_event_base,
NxIEvent; Ss2::No_overlap_subcurve> NxIEvent;
typedef Arr_construction_subcurve<NxITraits, NxIEvent, typedef Arr_construction_subcurve<NxITraits, NxIEvent,
Ss2::No_overlap_subcurve> NxISubcurve; Ss2::No_overlap_subcurve> NxISubcurve;
typedef Arr_spherical_insertion_helper<NxITraits, Arr, NxIEvent, NxISubcurve> typedef Arr_spherical_insertion_helper<NxITraits, Arr, NxIEvent, NxISubcurve>
@ -360,11 +360,10 @@ private:
// Type definition for the vertical decomposition sweep-line visitor. // Type definition for the vertical decomposition sweep-line visitor.
typedef Arr_batched_point_location_traits_2<Arr> VdTraits; typedef Arr_batched_point_location_traits_2<Arr> VdTraits;
// typedef Ss2::No_overlap_event<VdTraits> VdEvent; typedef Ss2::No_overlap_event<VdTraits> VdEvent;
// typedef Ss2::No_overlap_subcurve<VdTraits, VdEvent> VdSubcurve; typedef Ss2::No_overlap_subcurve<VdTraits, VdEvent> VdSubcurve;
// typedef Arr_spherical_vert_decomp_helper<VdTraits, Arr, VdEvent, VdSubcurve> typedef Arr_spherical_vert_decomp_helper<VdTraits, Arr, VdEvent, VdSubcurve>
// VdHelper; VdHelper;
typedef Arr_spherical_vert_decomp_helper<VdTraits, Arr> VdHelper;
// Type definition for the overlay sweep-line visitor. // Type definition for the overlay sweep-line visitor.
template <typename ExtendedGeometryTraits_2, typename ArrangementA, template <typename ExtendedGeometryTraits_2, typename ArrangementA,
@ -417,17 +416,23 @@ public:
typedef Arr_no_intersection_insertion_sl_visitor<NxIHelper> typedef Arr_no_intersection_insertion_sl_visitor<NxIHelper>
Surface_sweep_no_intersection_insertion_visitor; Surface_sweep_no_intersection_insertion_visitor;
/*! \class Surface_sweep_batched_point_location_visitor
*/
template <typename OutputIterator> template <typename OutputIterator>
struct Surface_sweep_batched_point_location_visitor : struct Surface_sweep_batched_point_location_visitor :
public Arr_batched_pl_sl_visitor<BplHelper, OutputIterator> public Arr_batched_pl_sl_visitor<
BplHelper, OutputIterator,
Surface_sweep_batched_point_location_visitor<OutputIterator> >
{ {
typedef OutputIterator Output_iterator; typedef OutputIterator Output_iterator;
typedef Arr_batched_pl_sl_visitor<BplHelper, Output_iterator> typedef Surface_sweep_batched_point_location_visitor<Output_iterator>
Self;
typedef Arr_batched_pl_sl_visitor<BplHelper, Output_iterator, Self>
Base; Base;
typedef typename Base::Geometry_traits_2 Geometry_traits_2; typedef typename BplHelper::Geometry_traits_2 Geometry_traits_2;
typedef typename Base::Event Event; typedef typename BplHelper::Event Event;
typedef typename Base::Subcurve Subcurve; typedef typename BplHelper::Subcurve Subcurve;
Surface_sweep_batched_point_location_visitor(const Arr* arr, Surface_sweep_batched_point_location_visitor(const Arr* arr,
Output_iterator& oi) : Output_iterator& oi) :
@ -435,12 +440,19 @@ public:
{} {}
}; };
/*! \class Surface_sweep_vertical_decomposition_visitor
*/
template <typename OutputIterator> template <typename OutputIterator>
struct Surface_sweep_vertical_decomposition_visitor : struct Surface_sweep_vertical_decomposition_visitor :
public Arr_vert_decomp_sl_visitor<VdHelper, OutputIterator> public Arr_vert_decomp_sl_visitor<
VdHelper, OutputIterator,
Surface_sweep_vertical_decomposition_visitor<OutputIterator> >
{ {
typedef OutputIterator Output_iterator; typedef OutputIterator Output_iterator;
typedef Arr_vert_decomp_sl_visitor<VdHelper,Output_iterator> Base; typedef Surface_sweep_vertical_decomposition_visitor<Output_iterator>
Self;
typedef Arr_vert_decomp_sl_visitor<VdHelper, Output_iterator, Self>
Base;
typedef typename Base::Geometry_traits_2 Geometry_traits_2; typedef typename Base::Geometry_traits_2 Geometry_traits_2;
typedef typename Base::Event Event; typedef typename Base::Event Event;
@ -460,7 +472,10 @@ public:
ArrangementA, ArrangementA,
ArrangementB>, ArrangementB>,
ArrangementA, ArrangementB>, ArrangementA, ArrangementB>,
OverlayTraits> OverlayTraits,
Surface_sweep_overlay_visitor<ArrangementA,
ArrangementB,
OverlayTraits> >
{ {
typedef ArrangementA Arrangement_a; typedef ArrangementA Arrangement_a;
typedef ArrangementB Arrangement_b; typedef ArrangementB Arrangement_b;
@ -473,7 +488,10 @@ public:
typedef _Overlay_helper<Geom_ovl_traits_2, Arrangement_a, Arrangement_b> typedef _Overlay_helper<Geom_ovl_traits_2, Arrangement_a, Arrangement_b>
Ovl_helper; Ovl_helper;
typedef Arr_overlay_sl_visitor<Ovl_helper, Overlay_traits> typedef Surface_sweep_overlay_visitor<ArrangementA, ArrangementB,
OverlayTraits>
Self;
typedef Arr_overlay_sl_visitor<Ovl_helper, Overlay_traits, Self>
Base; Base;
// typedef typename Base::Geometry_traits_2 Geometry_traits_2; // typedef typename Base::Geometry_traits_2 Geometry_traits_2;

View File

@ -14,6 +14,7 @@
// //
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il> // Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Ron Wein <wein@post.tau.ac.il> // Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
#ifndef CGAL_ARR_BOUNDED_PLANAR_BATCHED_PL_HELPER_H #ifndef CGAL_ARR_BOUNDED_PLANAR_BATCHED_PL_HELPER_H
#define 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; namespace Ss2 = Surface_sweep_2;
#include <CGAL/Surface_sweep_empty_visitor.h> #include <CGAL/Surface_sweep_2/Visitor.h>
/*! \class Arr_bounded_planar_batched_pl_helper /*! \class Arr_bounded_planar_batched_pl_helper
* *
@ -45,15 +46,13 @@ public:
typedef Arrangement_ Arrangement_2; typedef Arrangement_ Arrangement_2;
typedef Event_ Event; typedef Event_ Event;
typedef Subcurve_ Subcurve; typedef Subcurve_ Subcurve;
typedef typename Subcurve::Allocator Allocator;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
typedef typename Arrangement_2::Face_const_handle Face_const_handle; typedef typename Arrangement_2::Face_const_handle Face_const_handle;
public: public:
typedef Ss2::Surface_sweep_empty_visitor<Gt2, Event, Subcurve>
Base_visitor;
typedef typename Arrangement_2::Topology_traits Topology_traits; typedef typename Arrangement_2::Topology_traits Topology_traits;
protected: protected:

View File

@ -14,6 +14,7 @@
// //
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il> // Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Ron Wein <wein@post.tau.ac.il> // Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
#ifndef CGAL_ARR_BOUNDED_PLANAR_CONSTRUCTION_HELPER_H #ifndef CGAL_ARR_BOUNDED_PLANAR_CONSTRUCTION_HELPER_H
#define 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. * Definition of the Arr_bounded_planar_construction_helper class-template.
*/ */
#include <CGAL/Surface_sweep_empty_visitor.h> #include <CGAL/Surface_sweep_2/Visitor.h>
#include <CGAL/Unique_hash_map.h> #include <CGAL/Unique_hash_map.h>
namespace CGAL { namespace CGAL {
@ -46,6 +47,7 @@ public:
typedef Arrangement_ Arrangement_2; typedef Arrangement_ Arrangement_2;
typedef Event_ Event; typedef Event_ Event;
typedef Subcurve_ Subcurve; typedef Subcurve_ Subcurve;
typedef typename Subcurve::Allocator Allocator;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
@ -54,9 +56,6 @@ public:
typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Gt2::Point_2 Point_2; typedef typename Gt2::Point_2 Point_2;
typedef Ss2::Surface_sweep_empty_visitor<Gt2, Event, Subcurve>
Base_visitor;
typedef typename Arrangement_2::Face_handle Face_handle; typedef typename Arrangement_2::Face_handle Face_handle;
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;

View File

@ -14,6 +14,7 @@
// //
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il> // Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Ron Wein <wein@post.tau.ac.il> // Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
#ifndef CGAL_ARR_BOUNDED_PLANAR_INSERTION_HELPER_H #ifndef CGAL_ARR_BOUNDED_PLANAR_INSERTION_HELPER_H
#define 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. * Definition of the Arr_bounded_planar_insertion_helper class-template.
*/ */
#include <CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h>
#include <CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h> #include <CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h>
namespace CGAL { namespace CGAL {
@ -62,18 +62,12 @@ public:
typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Gt2::Point_2 Point_2; typedef typename Gt2::Point_2 Point_2;
typedef Ss2::Surface_sweep_empty_visitor<Gt2, Event, Subcurve>
Base_visitor;
typedef Arr_construction_sl_visitor<Self> Parent_visitor;
typedef typename Arrangement_2::Face_handle Face_handle; typedef typename Arrangement_2::Face_handle Face_handle;
typedef typename Base::Indices_list Indices_list; typedef typename Base::Indices_list Indices_list;
typedef typename Base::Halfedge_indices_map Halfedge_indices_map; typedef typename Base::Halfedge_indices_map Halfedge_indices_map;
public: public:
/*! Constructor. */ /*! Constructor. */
Arr_bounded_planar_insertion_helper(Arrangement_2* arr) : Arr_bounded_planar_insertion_helper(Arrangement_2* arr) :
Base(arr) Base(arr)

View File

@ -14,6 +14,7 @@
// //
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il> // Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Ron Wein <wein@post.tau.ac.il> // Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
#ifndef CGAL_ARR_BOUNDED_PLANAR_OVERLAY_HELPER_H #ifndef CGAL_ARR_BOUNDED_PLANAR_OVERLAY_HELPER_H
#define CGAL_ARR_BOUNDED_PLANAR_OVERLAY_HELPER_H #define CGAL_ARR_BOUNDED_PLANAR_OVERLAY_HELPER_H
@ -79,7 +80,7 @@ protected:
public: public:
/*! Constructor, given the input red and blue arrangements. */ /*! 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_red_top_traits (red_arr->topology_traits()),
m_blue_top_traits (blue_arr->topology_traits()) m_blue_top_traits (blue_arr->topology_traits())
{} {}
@ -88,25 +89,24 @@ public:
//@{ //@{
/* A notification issued before the sweep process starts. */ /* A notification issued before the sweep process starts. */
void before_sweep () void before_sweep()
{ {
// Get the unbounded faces in both arrangements. // Get the unbounded faces in both arrangements.
m_red_ubf = Face_handle_red (m_red_top_traits->unbounded_face()); m_red_ubf = Face_handle_red (m_red_top_traits->unbounded_face());
m_blue_ubf = Face_handle_blue (m_blue_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 /*! A notification invoked before the sweep-line starts handling the given
* event. * event.
*/ */
void before_handle_event (Event* /* e */) {} void before_handle_event(Event* /* e */) {}
//@} //@}
/*! Obtain the current red top face. */ /*! 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. */ /*! 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 } // namespace CGAL

View File

@ -13,6 +13,7 @@
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// Author(s) : Ron Wein <wein@post.tau.ac.il> // Author(s) : Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
#ifndef CGAL_ARR_BOUNDED_PLANAR_VERT_DEOCMP_HELPER_H #ifndef CGAL_ARR_BOUNDED_PLANAR_VERT_DEOCMP_HELPER_H
#define 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; namespace Ss2 = Surface_sweep_2;
#include <CGAL/Surface_sweep_empty_visitor.h> #include <CGAL/Surface_sweep_2/Visitor.h>
/*! \class Arr_bounded_planar_vert_decomp_helper /*! \class Arr_bounded_planar_vert_decomp_helper
* *
@ -44,17 +45,13 @@ public:
typedef Arrangement_ Arrangement_2; typedef Arrangement_ Arrangement_2;
typedef Event_ Event; typedef Event_ Event;
typedef Subcurve_ Subcurve; typedef Subcurve_ Subcurve;
typedef typename Subcurve::Allocator Allocator;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
public: public:
typedef typename Arrangement_2::Face_const_handle Face_const_handle; typedef typename Arrangement_2::Face_const_handle Face_const_handle;
public:
typedef Ss2::Surface_sweep_empty_visitor<Gt2, Event, Subcurve>
Base_visitor;
typedef typename Arrangement_2::Topology_traits Topology_traits; typedef typename Arrangement_2::Topology_traits Topology_traits;
protected: protected:
@ -73,7 +70,7 @@ public:
/// \name Notification functions. /// \name Notification functions.
//@{ //@{
/* A notification issued before the sweep process starts. */ /*! A notification issued before the sweep process starts. */
void before_sweep() void before_sweep()
{ {
// Get the unbounded face. // Get the unbounded face.
@ -93,6 +90,6 @@ public:
CGAL::Object bottom_object() const { return CGAL::make_object(m_unb_face); } CGAL::Object bottom_object() const { return CGAL::make_object(m_unb_face); }
}; };
} //namespace CGAL } // namespace CGAL
#endif #endif

View File

@ -15,7 +15,6 @@
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il> // Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Ron Wein <wein@post.tau.ac.il> // Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il> // Efi Fogel <efif@post.tau.ac.il>
//
#ifndef CGAL_ARR_SPHERICAL_BATCHED_PL_HELPER_H #ifndef CGAL_ARR_SPHERICAL_BATCHED_PL_HELPER_H
#define 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; namespace Ss2 = Surface_sweep_2;
#include <CGAL/Surface_sweep_empty_visitor.h>
/*! \class Arr_spherical_batched_pl_helper /*! \class Arr_spherical_batched_pl_helper
* *
* A helper class for the batched point-location sweep-line visitor, suitable * A helper class for the batched point-location sweep-line visitor, suitable
@ -47,13 +44,12 @@ public:
typedef Arrangement_ Arrangement_2; typedef Arrangement_ Arrangement_2;
typedef Event_ Event; typedef Event_ Event;
typedef Subcurve_ Subcurve; typedef Subcurve_ Subcurve;
typedef typename Subcurve::Allocator Allocator;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
public: public:
typedef Ss2::Surface_sweep_empty_visitor<Gt2, Event, Subcurve>
Base_visitor;
typedef typename Arrangement_2::Face_const_handle Face_const_handle; typedef typename Arrangement_2::Face_const_handle Face_const_handle;
typedef typename Event::Subcurve_iterator Subcurve_iterator; typedef typename Event::Subcurve_iterator Subcurve_iterator;

View File

@ -25,7 +25,6 @@
* Definition of the Arr_spherical_construction_helper class-template. * Definition of the Arr_spherical_construction_helper class-template.
*/ */
#include <CGAL/Surface_sweep_empty_visitor.h>
#include <CGAL/Unique_hash_map.h> #include <CGAL/Unique_hash_map.h>
namespace CGAL { namespace CGAL {
@ -38,14 +37,15 @@ namespace Ss2 = Surface_sweep_2;
* for an Arrangement_on_surface_2 instantiated with a topology-traits class * for an Arrangement_on_surface_2 instantiated with a topology-traits class
* for bounded curves in the plane. * for bounded curves in the plane.
*/ */
template <typename Traits_, typename Arrangement_, typename Event_, template <typename GeometryTraits_2, typename Arrangement_, typename Event_,
typename Subcurve_> typename Subcurve_>
class Arr_spherical_construction_helper { class Arr_spherical_construction_helper {
public: public:
typedef Traits_ Geometry_traits_2; typedef GeometryTraits_2 Geometry_traits_2;
typedef Arrangement_ Arrangement_2; typedef Arrangement_ Arrangement_2;
typedef Event_ Event; typedef Event_ Event;
typedef Subcurve_ Subcurve; typedef Subcurve_ Subcurve;
typedef typename Subcurve::Allocator Allocator;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
@ -54,9 +54,6 @@ public:
typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Gt2::Point_2 Point_2; typedef typename Gt2::Point_2 Point_2;
typedef Ss2::Surface_sweep_empty_visitor<Gt2, Event, Subcurve>
Base_visitor;
typedef typename Arrangement_2::Vertex_handle Vertex_handle; typedef typename Arrangement_2::Vertex_handle Vertex_handle;
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
typedef typename Arrangement_2::Face_handle Face_handle; typedef typename Arrangement_2::Face_handle Face_handle;

View File

@ -25,7 +25,6 @@
* Definition of the Arr_spherical_insertion_helper class-template. * Definition of the Arr_spherical_insertion_helper class-template.
*/ */
#include <CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h>
#include <CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h> #include <CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h>
namespace CGAL { namespace CGAL {
@ -61,11 +60,6 @@ public:
typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Gt2::Point_2 Point_2; typedef typename Gt2::Point_2 Point_2;
typedef Ss2::Surface_sweep_empty_visitor<Gt2, Event, Subcurve>
Base_visitor;
typedef Arr_construction_sl_visitor<Self> Parent_visitor;
typedef typename Arrangement_2::Vertex_handle Vertex_handle; typedef typename Arrangement_2::Vertex_handle Vertex_handle;
typedef typename Arrangement_2::Face_handle Face_handle; typedef typename Arrangement_2::Face_handle Face_handle;
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
@ -231,6 +225,6 @@ Arr_spherical_insertion_helper<Tr, Arr, Evnt, Sbcv>::top_face() const
return this->m_spherical_face; return this->m_spherical_face;
} }
} //namespace CGAL } // namespace CGAL
#endif #endif

View File

@ -14,7 +14,6 @@
// //
// Author(s) : Ron Wein <wein@post.tau.ac.il> // Author(s) : Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il> // Efi Fogel <efif@post.tau.ac.il>
//
#ifndef CGAL_ARR_SPHERICAL_VERT_DECOMP_HELPER_H #ifndef CGAL_ARR_SPHERICAL_VERT_DECOMP_HELPER_H
#define 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; namespace Ss2 = Surface_sweep_2;
#include <CGAL/Surface_sweep_empty_visitor.h>
/*! \class Arr_spherical_vert_decomp_helper /*! \class Arr_spherical_vert_decomp_helper
* *
* A helper class for the vertical decomposition sweep-line visitor, suitable * A helper class for the vertical decomposition sweep-line visitor, suitable
* for an Arrangement_on_surface_2 instantiated with a topology-traits class * for an Arrangement_on_surface_2 instantiated with a topology-traits class
* for bounded curves in the plane. * for bounded curves in the plane.
*/ */
template <typename GeometryTraits_2, typename Arrangement_> template <typename GeometryTraits_2, typename Arrangement_, typename Event_,
typename Subcurve_>
class Arr_spherical_vert_decomp_helper { class Arr_spherical_vert_decomp_helper {
public: public:
typedef GeometryTraits_2 Geometry_traits_2; typedef GeometryTraits_2 Geometry_traits_2;
typedef Arrangement_ Arrangement_2; typedef Arrangement_ Arrangement_2;
typedef Event_ Event;
typedef Subcurve_ Subcurve;
typedef typename Subcurve::Allocator Allocator;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
public: public:
typedef Ss2::Surface_sweep_empty_visitor<Gt2> Base_visitor;
typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; 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::Face_const_handle Face_const_handle;
typedef typename Arrangement_2::Vertex_const_handle Vertex_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: protected:
typedef typename Arrangement_2::Topology_traits Topology_traits; typedef typename Arrangement_2::Topology_traits Topology_traits;
@ -111,8 +108,8 @@ public:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// A notification issued before the sweep process starts. // A notification issued before the sweep process starts.
// //
template <typename Tr, typename Arr> template <typename Tr, typename Arr, typename Evnt, typename Sbcv>
void Arr_spherical_vert_decomp_helper<Tr, Arr>::before_sweep() void Arr_spherical_vert_decomp_helper<Tr, Arr, Evnt, Sbcv>::before_sweep()
{ {
// Get the north pole and the face that intially contains it. // Get the north pole and the face that intially contains it.
m_valid_north_pole = (m_top_traits->north_pole() != NULL); m_valid_north_pole = (m_top_traits->north_pole() != NULL);
@ -133,9 +130,9 @@ void Arr_spherical_vert_decomp_helper<Tr, Arr>::before_sweep()
// A notification invoked after the sweep-line finishes handling the given // A notification invoked after the sweep-line finishes handling the given
// event. // event.
/// ///
template <typename Tr, typename Arr> template <typename Tr, typename Arr, typename Evnt, typename Sbcv>
void void Arr_spherical_vert_decomp_helper<Tr, Arr, Evnt, Sbcv>::
Arr_spherical_vert_decomp_helper<Tr, Arr>::after_handle_event (Event *event) after_handle_event(Event *event)
{ {
// Ignore events that are not incident to the poles. // Ignore events that are not incident to the poles.
if (event->parameter_space_in_y() == ARR_INTERIOR) return; if (event->parameter_space_in_y() == ARR_INTERIOR) return;

View File

@ -30,7 +30,7 @@ namespace CGAL {
namespace Ss2 = Surface_sweep_2; namespace Ss2 = Surface_sweep_2;
#include <CGAL/Surface_sweep_empty_visitor.h> #include <CGAL/Surface_sweep_2/Visitor.h>
/*! \class Arr_unb_planar_batched_pl_helper /*! \class Arr_unb_planar_batched_pl_helper
* *
@ -46,13 +46,12 @@ public:
typedef Arrangement_ Arrangement_2; typedef Arrangement_ Arrangement_2;
typedef Event_ Event; typedef Event_ Event;
typedef Subcurve_ Subcurve; typedef Subcurve_ Subcurve;
typedef typename Subcurve::Allocator Allocator;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
public: public:
typedef Ss2::Surface_sweep_empty_visitor<Gt2, Event, Subcurve>
Base_visitor;
typedef typename Arrangement_2::Face_const_handle Face_const_handle; typedef typename Arrangement_2::Face_const_handle Face_const_handle;
protected: protected:

View File

@ -26,7 +26,7 @@
* Definition of the Arr_unb_planar_construction_helper class-template. * Definition of the Arr_unb_planar_construction_helper class-template.
*/ */
#include <CGAL/Surface_sweep_empty_visitor.h> #include <CGAL/Surface_sweep_2/Visitor.h>
#include <CGAL/Unique_hash_map.h> #include <CGAL/Unique_hash_map.h>
namespace CGAL { namespace CGAL {
@ -47,13 +47,12 @@ public:
typedef Arrangement_ Arrangement_2; typedef Arrangement_ Arrangement_2;
typedef Event_ Event; typedef Event_ Event;
typedef Subcurve_ Subcurve; typedef Subcurve_ Subcurve;
typedef typename Subcurve::Allocator Allocator;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
public: public:
typedef Ss2::Surface_sweep_empty_visitor<Gt2, Event, Subcurve>
Base_visitor;
typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Gt2::Point_2 Point_2; typedef typename Gt2::Point_2 Point_2;

View File

@ -26,7 +26,6 @@
* Definition of the Arr_unb_planar_insertion_helper class-template. * Definition of the Arr_unb_planar_insertion_helper class-template.
*/ */
#include <CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h>
#include <CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h> #include <CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h>
namespace CGAL { namespace CGAL {
@ -62,11 +61,6 @@ public:
typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Gt2::Point_2 Point_2; typedef typename Gt2::Point_2 Point_2;
typedef Ss2::Surface_sweep_empty_visitor<Gt2, Event, Subcurve>
Base_visitor;
typedef Arr_construction_sl_visitor<Self> Parent_visitor;
typedef typename Arrangement_2::Face_handle Face_handle; typedef typename Arrangement_2::Face_handle Face_handle;
typedef typename Base::Indices_list Indices_list; typedef typename Base::Indices_list Indices_list;

View File

@ -119,7 +119,8 @@ public:
// //
template <typename Tr, typename ArrR, typename ArrB, typename Arr, template <typename Tr, typename ArrR, typename ArrB, typename Arr,
typename Evnt, typename Sbcv> typename Evnt, typename Sbcv>
void Arr_unb_planar_overlay_helper<Tr,ArrR,ArrB,Arr,Evnt,Sbcv>::before_sweep() void Arr_unb_planar_overlay_helper<Tr, ArrR, ArrB, Arr, Evnt, Sbcv>::
before_sweep()
{ {
// Get the top-left fictitious vertices in both arrangements. // Get the top-left fictitious vertices in both arrangements.
v_red_tl = Vertex_handle_red(m_red_top_traits->top_left_vertex()); v_red_tl = Vertex_handle_red(m_red_top_traits->top_left_vertex());
@ -155,7 +156,7 @@ void Arr_unb_planar_overlay_helper<Tr,ArrR,ArrB,Arr,Evnt,Sbcv>::before_sweep()
// //
template <typename Tr, typename ArrR, typename ArrB, typename Arr, template <typename Tr, typename ArrR, typename ArrB, typename Arr,
typename Evnt, typename Sbcv> typename Evnt, typename Sbcv>
void Arr_unb_planar_overlay_helper<Tr,ArrR,ArrB,Arr,Evnt,Sbcv>:: void Arr_unb_planar_overlay_helper<Tr, ArrR, ArrB, Arr, Evnt, Sbcv>::
before_handle_event(Event* e) before_handle_event(Event* e)
{ {
// Nothing to do in case the event represents a valid point. // Nothing to do in case the event represents a valid point.

View File

@ -29,7 +29,7 @@ namespace CGAL {
namespace Ss2 = Surface_sweep_2; namespace Ss2 = Surface_sweep_2;
#include <CGAL/Surface_sweep_empty_visitor.h> #include <CGAL/Surface_sweep_2/Visitor.h>
/*! \class Arr_unb_planar_vert_decomp_helper /*! \class Arr_unb_planar_vert_decomp_helper
* *
@ -45,13 +45,12 @@ public:
typedef Arrangement_ Arrangement_2; typedef Arrangement_ Arrangement_2;
typedef Event_ Event; typedef Event_ Event;
typedef Subcurve_ Subcurve; typedef Subcurve_ Subcurve;
typedef typename Subcurve::Allocator Allocator;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
public: public:
typedef Ss2::Surface_sweep_empty_visitor<Gt2, Event, Subcurve>
Base_visitor;
typedef typename Arrangement_2::Face_const_handle Face_const_handle; typedef typename Arrangement_2::Face_const_handle Face_const_handle;
protected: protected:
@ -146,8 +145,8 @@ before_sweep()
// A notification invoked after the sweep-line finishes handling the given // A notification invoked after the sweep-line finishes handling the given
// event. // event.
// //
template <typename Tr, typename Arr, typename Event_, typename Subcurve_> template <typename Tr, typename Arr, typename Evnt, typename Sbcv>
void Arr_unb_planar_vert_decomp_helper<Tr, Arr, Event_, Subcurve_>:: void Arr_unb_planar_vert_decomp_helper<Tr, Arr, Evnt, Sbcv>::
after_handle_event(Event* event) after_handle_event(Event* event)
{ {
// If the event is at infinity and occurs on the top edge of the fictitious // If the event is at infinity and occurs on the top edge of the fictitious

View File

@ -240,8 +240,8 @@ private:
// Type definition for the basic insertion surface-sweep visitor. // Type definition for the basic insertion surface-sweep visitor.
typedef Arr_basic_insertion_traits_2<Gt2, Arr> NxITraits; typedef Arr_basic_insertion_traits_2<Gt2, Arr> NxITraits;
typedef Arr_construction_event<NxITraits, Arr, Ss2::No_overlap_event_base> typedef Arr_construction_event<NxITraits, Arr, Ss2::No_overlap_event_base,
NxIEvent; Ss2::No_overlap_subcurve> NxIEvent;
typedef Arr_construction_subcurve<NxITraits, NxIEvent, typedef Arr_construction_subcurve<NxITraits, NxIEvent,
Ss2::No_overlap_subcurve> NxISubcurve; Ss2::No_overlap_subcurve> NxISubcurve;
typedef Arr_unb_planar_insertion_helper<NxITraits, Arr, NxIEvent, NxISubcurve> typedef Arr_unb_planar_insertion_helper<NxITraits, Arr, NxIEvent, NxISubcurve>
@ -311,15 +311,24 @@ public:
typedef Arr_no_intersection_insertion_sl_visitor<NxIHelper> typedef Arr_no_intersection_insertion_sl_visitor<NxIHelper>
Surface_sweep_no_intersection_insertion_visitor; Surface_sweep_no_intersection_insertion_visitor;
/*! \class Surface_sweep_batched_point_location_visitor
*/
template <typename OutputIterator> template <typename OutputIterator>
struct Surface_sweep_batched_point_location_visitor : struct Surface_sweep_batched_point_location_visitor :
public Arr_batched_pl_sl_visitor<BplHelper, OutputIterator> public Arr_batched_pl_sl_visitor<
BplHelper, OutputIterator,
Surface_sweep_batched_point_location_visitor<OutputIterator> >
{ {
typedef OutputIterator Output_iterator; typedef OutputIterator Output_iterator;
typedef Arr_batched_pl_sl_visitor<BplHelper, Output_iterator> Base;
typedef typename Base::Geometry_traits_2 Geometry_traits_2; typedef Surface_sweep_batched_point_location_visitor<Output_iterator>
typedef typename Base::Event Event; Self;
typedef typename Base::Subcurve Subcurve; typedef Arr_batched_pl_sl_visitor<BplHelper, Output_iterator, Self>
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, Surface_sweep_batched_point_location_visitor(const Arr* arr,
Output_iterator& oi) : Output_iterator& oi) :
@ -327,12 +336,19 @@ public:
{} {}
}; };
/*! \class Surface_sweep_vertical_decomposition_visitor
*/
template <typename OutputIterator> template <typename OutputIterator>
struct Surface_sweep_vertical_decomposition_visitor : struct Surface_sweep_vertical_decomposition_visitor :
public Arr_vert_decomp_sl_visitor<VdHelper, OutputIterator> public Arr_vert_decomp_sl_visitor<
VdHelper, OutputIterator,
Surface_sweep_vertical_decomposition_visitor<OutputIterator> >
{ {
typedef OutputIterator Output_iterator; typedef OutputIterator Output_iterator;
typedef Arr_vert_decomp_sl_visitor<VdHelper, Output_iterator> Base; typedef Surface_sweep_vertical_decomposition_visitor<Output_iterator>
Self;
typedef Arr_vert_decomp_sl_visitor<VdHelper, Output_iterator, Self>
Base;
typedef typename Base::Geometry_traits_2 Geometry_traits_2; typedef typename Base::Geometry_traits_2 Geometry_traits_2;
typedef typename Base::Event Event; typedef typename Base::Event Event;
typedef typename Base::Subcurve Subcurve; typedef typename Base::Subcurve Subcurve;
@ -342,6 +358,8 @@ public:
Base(arr, oi) {} Base(arr, oi) {}
}; };
/*! \class Surface_sweep_overlay_visitor
*/
template <typename ArrangementA, typename ArrangementB, template <typename ArrangementA, typename ArrangementB,
typename OverlayTraits> typename OverlayTraits>
struct Surface_sweep_overlay_visitor : struct Surface_sweep_overlay_visitor :
@ -349,7 +367,10 @@ public:
Gt2, Gt2,
ArrangementA, ArrangementB>, ArrangementA, ArrangementB>,
ArrangementA, ArrangementB>, ArrangementA, ArrangementB>,
OverlayTraits> OverlayTraits,
Surface_sweep_overlay_visitor<ArrangementA,
ArrangementB,
OverlayTraits> >
{ {
typedef ArrangementA Arrangement_a; typedef ArrangementA Arrangement_a;
typedef ArrangementB Arrangement_b; typedef ArrangementB Arrangement_b;
@ -362,9 +383,14 @@ public:
typedef _Overlay_helper<Geom_ovl_traits_2, Arrangement_a, Arrangement_b> typedef _Overlay_helper<Geom_ovl_traits_2, Arrangement_a, Arrangement_b>
Ovl_helper; Ovl_helper;
typedef Arr_overlay_sl_visitor<Ovl_helper, Overlay_traits> Base; typedef Surface_sweep_overlay_visitor<ArrangementA, ArrangementB,
OverlayTraits>
Self;
typedef Arr_overlay_sl_visitor<Ovl_helper, Overlay_traits, Self>
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::Event Event;
typedef typename Base::Subcurve Subcurve; typedef typename Base::Subcurve Subcurve;

View File

@ -123,10 +123,7 @@ decompose(const Arrangement_on_surface_2<GeometryTraits_2, TopologyTraits>& arr,
// Define the sweep-line visitor and perform the sweep. // Define the sweep-line visitor and perform the sweep.
Vd_visitor visitor(&arr, &oi); Vd_visitor visitor(&arr, &oi);
Ss2::No_intersection_surface_sweep_2<typename Vd_visitor::Geometry_traits_2, Ss2::No_intersection_surface_sweep_2<Vd_visitor>
Vd_visitor,
typename Vd_visitor::Event,
typename Vd_visitor::Subcurve>
surface_sweep(&ex_traits, &visitor); surface_sweep(&ex_traits, &visitor);
surface_sweep.sweep(xcurves_vec.begin(), xcurves_vec.end(), // Curves. surface_sweep.sweep(xcurves_vec.begin(), xcurves_vec.end(), // Curves.
iso_pts_vec.begin(), iso_pts_vec.end()); // Action points. iso_pts_vec.begin(), iso_pts_vec.end()); // Action points.

View File

@ -277,11 +277,7 @@ void insert_empty(Arrangement_on_surface_2<GeometryTraits_2, TopTraits>& arr,
traits(*geom_traits); traits(*geom_traits);
// Define a surface-sweep instance and perform the sweep: // Define a surface-sweep instance and perform the sweep:
Ss2::Surface_sweep_2<Cgt2, Ss2::Surface_sweep_2<Construct_visitor> surface_sweep(&traits, &visitor);
Construct_visitor,
typename Construct_visitor::Event,
typename Construct_visitor::Subcurve>
surface_sweep(&traits, &visitor);
surface_sweep.sweep(begin_xcurves, end_xcurves); surface_sweep.sweep(begin_xcurves, end_xcurves);
} }
@ -324,11 +320,7 @@ void insert_empty(Arrangement_on_surface_2<GeometryTraits_2, TopTraits>& arr,
traits(*geom_traits); traits(*geom_traits);
// Define a surface-sweep instance and perform the sweep. // Define a surface-sweep instance and perform the sweep.
Ss2::Surface_sweep_2<Cgt2, Ss2::Surface_sweep_2<Construct_visitor> surface_sweep(&traits, &visitor);
Construct_visitor,
typename Construct_visitor::Event,
typename Construct_visitor::Subcurve>
surface_sweep(&traits, &visitor);
surface_sweep.sweep(begin_xcurves, end_xcurves, begin_points, end_points); surface_sweep.sweep(begin_xcurves, end_xcurves, begin_points, end_points);
} }
@ -383,11 +375,7 @@ void insert_non_empty(Arrangement_on_surface_2<GeometryTraits_2,
&traits); &traits);
// Define a basic surface-sweep instance and perform the sweep. // Define a basic surface-sweep instance and perform the sweep.
Ss2::Surface_sweep_2<Igt2, Ss2::Surface_sweep_2<Insert_visitor> surface_sweep(&traits, &visitor);
Insert_visitor,
typename Insert_visitor::Event,
typename Insert_visitor::Subcurve>
surface_sweep(&traits, &visitor);
surface_sweep.sweep(ex_cvs.begin(), ex_cvs.end(),ex_pts.begin(), ex_pts.end()); 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<GeometryTraits_2,
// Define a basic surface-sweep instance (which is not supposed to handle // Define a basic surface-sweep instance (which is not supposed to handle
// insersections) and perform the sweep. // insersections) and perform the sweep.
Ss2::No_intersection_surface_sweep_2<Cgt2, Ss2::No_intersection_surface_sweep_2<Construct_visitor>
Construct_visitor,
typename Construct_visitor::Event,
typename Construct_visitor::Subcurve>
surface_sweep(&traits, &visitor); surface_sweep(&traits, &visitor);
surface_sweep.sweep(begin_xcurves, end_xcurves); surface_sweep.sweep(begin_xcurves, end_xcurves);
} }
@ -871,10 +856,7 @@ void non_intersecting_insert_empty(Arrangement_on_surface_2<GeometryTraits_2,
// Define a basic surface-sweep instance (which is not supposed to handle // Define a basic surface-sweep instance (which is not supposed to handle
// insersections) and perform the sweep. // insersections) and perform the sweep.
Ss2::No_intersection_surface_sweep_2<Cgt2, Ss2::No_intersection_surface_sweep_2<Construct_visitor>
Construct_visitor,
typename Construct_visitor::Event,
typename Construct_visitor::Subcurve>
surface_sweep(&traits, &visitor); surface_sweep(&traits, &visitor);
surface_sweep.sweep(begin_xcurves, end_xcurves, begin_points, end_points); 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<GeometryTraits_2
&traits); &traits);
// Define a basic surface-sweep instance and perform the sweep. // Define a basic surface-sweep instance and perform the sweep.
Ss2::No_intersection_surface_sweep_2<Igt2, Insert_visitor, Ss2::No_intersection_surface_sweep_2<Insert_visitor>
typename Insert_visitor::Event,
typename Insert_visitor::Subcurve>
surface_sweep(&traits, &visitor); surface_sweep(&traits, &visitor);
surface_sweep.sweep(ex_cvs.begin(), ex_cvs.end(), surface_sweep.sweep(ex_cvs.begin(), ex_cvs.end(),
ex_pts.begin(), ex_pts.end()); ex_pts.begin(), ex_pts.end());
@ -1210,10 +1190,7 @@ bool is_valid(const Arrangement_on_surface_2<GeometryTraits_2, TopTraits>& arr)
// The surface-sweep types: // The surface-sweep types:
typedef Ss2::Surface_sweep_do_curves_x_visitor<Gt2> Visitor; typedef Ss2::Surface_sweep_do_curves_x_visitor<Gt2> Visitor;
typedef typename Visitor::Event Event; typedef Ss2::Surface_sweep_2<Visitor> Surface_sweep_2;
typedef typename Visitor::Subcurve Subcurve;
typedef Ss2::Surface_sweep_2<Gt2, Visitor, Event, Subcurve>
Surface_sweep_2;
// The arrangement iterator and circulator types: // The arrangement iterator and circulator types:
typedef typename Arr::Edge_const_iterator Edge_const_iterator; typedef typename Arr::Edge_const_iterator Edge_const_iterator;

View File

@ -111,18 +111,15 @@ namespace Surface_sweep_2 {
* The x-montone curve type and the point type are defined by the traits class * The x-montone curve type and the point type are defined by the traits class
* that is one of the template parameters. * that is one of the template parameters.
*/ */
template <typename GeometryTraits_2, template <typename Visitor_>
typename Visitor_,
typename Event_ = No_overlap_event<GeometryTraits_2>,
typename Subcurve_ = No_overlap_subcurve<GeometryTraits_2, Event_>,
typename Allocator_ = CGAL_ALLOCATOR(int)>
class No_intersection_surface_sweep_2 { class No_intersection_surface_sweep_2 {
public: public:
typedef GeometryTraits_2 Geometry_traits_2;
typedef Visitor_ Visitor; typedef Visitor_ Visitor;
typedef Event_ Event;
typedef Subcurve_ Subcurve; typedef typename Visitor::Geometry_traits_2 Geometry_traits_2;
typedef Allocator_ Allocator; typedef typename Visitor::Event Event;
typedef typename Visitor::Subcurve Subcurve;
typedef typename Visitor::Allocator Allocator;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;

View File

@ -78,28 +78,20 @@ namespace Surface_sweep_2 {
* *
*/ */
template <typename GeometryTraits_2, template <typename Visitor_>
typename Visitor_, class Surface_sweep_2 : public No_intersection_surface_sweep_2<Visitor_> {
typename Event_ = Default_event<GeometryTraits_2>,
typename Subcurve_ = Default_subcurve<GeometryTraits_2, Event_>,
typename Allocator_ = CGAL_ALLOCATOR(int) >
class Surface_sweep_2 :
public No_intersection_surface_sweep_2<GeometryTraits_2, Visitor_, Event_,
Subcurve_, Allocator_>
{
public: public:
typedef GeometryTraits_2 Geometry_traits_2;
typedef Visitor_ Visitor; typedef Visitor_ Visitor;
typedef Event_ Event;
typedef Subcurve_ Subcurve;
typedef Allocator_ Allocator;
private: private:
typedef Geometry_traits_2 Gt2; typedef No_intersection_surface_sweep_2<Visitor> Base;
typedef No_intersection_surface_sweep_2<Gt2, Visitor, Event, Subcurve,
Allocator> Base;
public: 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 Base::Traits_adaptor_2 Traits_adaptor_2;
typedef typename Traits_adaptor_2::Point_2 Point_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::X_monotone_curve_2 X_monotone_curve_2;
@ -149,7 +141,7 @@ public:
* \param traits A pointer to a sweep-line traits object. * \param traits A pointer to a sweep-line traits object.
* \param visitor A pointer to a sweep-line visitor 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), Base(traits, visitor),
m_curves_pair_set(0) m_curves_pair_set(0)
{} {}

View File

@ -14,6 +14,7 @@
// //
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il> // Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Ron Wein <wein@post.tau.ac.il> // Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
#ifndef CGAL_ARR_BATCHED_PL_SL_VISITOR_H #ifndef CGAL_ARR_BATCHED_PL_SL_VISITOR_H
#define CGAL_ARR_BATCHED_PL_SL_VISITOR_H #define CGAL_ARR_BATCHED_PL_SL_VISITOR_H
@ -27,34 +28,53 @@
#include <CGAL/Arr_point_location_result.h> #include <CGAL/Arr_point_location_result.h>
#include <CGAL/Object.h> #include <CGAL/Object.h>
#include <CGAL/Surface_sweep_2/Visitor.h>
#include <boost/variant.hpp> #include <CGAL/Default.h>
#include <boost/optional.hpp>
namespace CGAL { namespace CGAL {
namespace Ss2 = Surface_sweep_2;
/*! \class Arr_batched_pl_sl_visitor /*! \class Arr_batched_pl_sl_visitor
* *
* A surface-sweep visitor for performing batched point-location queries on an * A surface-sweep visitor for performing batched point-location queries on an
* arrangement embedded on a surface. * arrangement embedded on a surface.
*/ */
template <typename Helper_, typename OutputIterator_> template <typename Helper_, typename OutputIterator, typename Visitor_ = Default>
class Arr_batched_pl_sl_visitor : public Helper_::Base_visitor { class Arr_batched_pl_sl_visitor :
public Ss2::Visitor_base<typename Helper_::Geometry_traits_2,
typename Helper_::Event,
typename Helper_::Subcurve,
typename Helper_::Allocator,
typename Default::Get<Visitor_,
Arr_batched_pl_sl_visitor<
Helper_, OutputIterator,
Visitor_> >::type>
{
public: public:
typedef Helper_ Helper; typedef Helper_ Helper;
typedef OutputIterator_ OutputIterator; typedef OutputIterator Output_iterator;
typedef typename Helper::Geometry_traits_2 Geometry_traits_2; typedef typename Helper::Geometry_traits_2 Geometry_traits_2;
typedef typename Helper::Arrangement_2 Arrangement_2;
typedef typename Helper::Event Event; typedef typename Helper::Event Event;
typedef typename Helper::Subcurve Subcurve; typedef typename Helper::Subcurve Subcurve;
typedef typename Helper::Allocator Allocator;
private:
typedef Geometry_traits_2 Gt2;
typedef Arr_batched_pl_sl_visitor<Helper, Output_iterator, Visitor_>
Self;
typedef typename Default::Get<Visitor_, Self>::type Visitor;
typedef typename Ss2::Visitor_base<Gt2, Event, Subcurve, Allocator, Visitor>
Base;
public:
typedef typename Helper::Arrangement_2 Arrangement_2;
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
typedef typename Arrangement_2::Face_const_handle Face_const_handle; typedef typename Arrangement_2::Face_const_handle Face_const_handle;
protected: protected:
typedef typename Helper::Base_visitor Base;
typedef typename Base::Status_line_iterator Status_line_iterator; typedef typename Base::Status_line_iterator Status_line_iterator;
typedef Arr_point_location_result<Arrangement_2> Pl_result; typedef Arr_point_location_result<Arrangement_2> Pl_result;
@ -62,7 +82,7 @@ protected:
// Data members: // Data members:
Helper m_helper; // The helper class. 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<typename T> template<typename T>
Pl_result_type pl_make_result(T t) { return Pl_result::make_result(t); } Pl_result_type pl_make_result(T t) { return Pl_result::make_result(t); }
@ -75,7 +95,7 @@ public:
* \param arr The arrangement. * \param arr The arrangement.
* \param oi A pointer to the output iterator that will store the result. * \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_helper(arr),
m_out(oi) m_out(oi)
{} {}
@ -102,8 +122,8 @@ public:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// A notification issued before the sweep process starts. // A notification issued before the sweep process starts.
// //
template <class Hlpr, class OutIt> template <typename Hlpr, typename OutIt, typename Vis>
void Arr_batched_pl_sl_visitor<Hlpr, OutIt>::before_sweep() void Arr_batched_pl_sl_visitor<Hlpr, OutIt, Vis>::before_sweep()
{ {
// We just have to notify the helper that the sweep process now starts. // We just have to notify the helper that the sweep process now starts.
m_helper.before_sweep(); m_helper.before_sweep();
@ -113,8 +133,8 @@ void Arr_batched_pl_sl_visitor<Hlpr, OutIt>::before_sweep()
// A notification invoked after the surface-sweep finishes handling the given // A notification invoked after the surface-sweep finishes handling the given
// event. // event.
// //
template <class Hlpr, class OutIt> template <typename Hlpr, typename OutIt, typename Vis>
bool Arr_batched_pl_sl_visitor<Hlpr, OutIt>:: bool Arr_batched_pl_sl_visitor<Hlpr, OutIt, Vis>::
after_handle_event(Event* event, Status_line_iterator above, bool on_above) after_handle_event(Event* event, Status_line_iterator above, bool on_above)
{ {
// Notify the helper on the event. // Notify the helper on the event.

View File

@ -30,12 +30,17 @@
* Definition of the Arr_construction_sl_visitor class-template. * Definition of the Arr_construction_sl_visitor class-template.
*/ */
#include <CGAL/Arr_accessor.h>
#include <CGAL/Unique_hash_map.h>
#include <vector> #include <vector>
#include <CGAL/Arr_accessor.h>
#include <CGAL/Unique_hash_map.h>
#include <CGAL/Surface_sweep_2/Visitor.h>
#include <CGAL/Default.h>
namespace CGAL { namespace CGAL {
namespace Ss2 = Surface_sweep_2;
/*! \struct Integer_hash_function /*! \struct Integer_hash_function
* An auxiliary hash functor for integers. * An auxiliary hash functor for integers.
*/ */
@ -48,25 +53,37 @@ struct Integer_hash_function {
/*! \class Arr_construction_sl_visitor /*! \class Arr_construction_sl_visitor
* A sweep-line visitor for constructing an arrangement embedded on a surface. * A sweep-line visitor for constructing an arrangement embedded on a surface.
*/ */
template <typename Helper_> template <typename Helper_, typename Visitor_ = Default>
class Arr_construction_sl_visitor : public Helper_::Base_visitor { class Arr_construction_sl_visitor :
public Ss2::Visitor_base<typename Helper_::Geometry_traits_2,
typename Helper_::Event,
typename Helper_::Subcurve,
typename Helper_::Allocator,
typename Default::Get<Visitor_,
Arr_construction_sl_visitor<
Helper_, Visitor_> >::type>
{
public: public:
typedef Helper_ Helper; typedef Helper_ Helper;
typedef typename Helper::Geometry_traits_2 Geometry_traits_2; 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::Event Event;
typedef typename Helper::Subcurve Subcurve; typedef typename Helper::Subcurve Subcurve;
typedef typename Helper::Allocator Allocator;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
typedef Arr_construction_sl_visitor<Helper, Visitor_> Self;
typedef typename Default::Get<Visitor_, Self>::type Visitor;
typedef Ss2::Visitor_base<Gt2, Event, Subcurve, Allocator, Visitor>
Base;
public: public:
typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Gt2::Point_2 Point_2; typedef typename Gt2::Point_2 Point_2;
protected: protected:
typedef typename Helper::Arrangement_2 Arrangement_2;
typedef typename Arrangement_2::Topology_traits Topology_traits; typedef typename Arrangement_2::Topology_traits Topology_traits;
typedef typename Arrangement_2::Vertex_handle Vertex_handle; typedef typename Arrangement_2::Vertex_handle Vertex_handle;
typedef typename Arrangement_2::Halfedge_handle Halfedge_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_iterator Event_subcurve_iterator;
typedef typename Base::Event_subcurve_reverse_iterator typedef typename Base::Event_subcurve_reverse_iterator
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::Indices_list Indices_list;
typedef typename Helper::Halfedge_indices_map Halfedge_indices_map; typedef typename Helper::Halfedge_indices_map Halfedge_indices_map;
@ -251,16 +268,16 @@ private:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// A notification issued before the sweep process starts. // A notification issued before the sweep process starts.
// Notifies the helper that the sweep process now starts. // Notifies the helper that the sweep process now starts.
template <typename Hlpr> template <typename Hlpr, typename Vis>
void Arr_construction_sl_visitor<Hlpr>::before_sweep() void Arr_construction_sl_visitor<Hlpr, Vis>::before_sweep()
{ m_helper.before_sweep(); } { m_helper.before_sweep(); }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// A notification invoked before the sweep-line starts handling the given // A notification invoked before the sweep-line starts handling the given
// event. // event.
// //
template <class Hlpr> template <class Hlpr, typename Vis>
void Arr_construction_sl_visitor<Hlpr>::before_handle_event(Event* event) void Arr_construction_sl_visitor<Hlpr, Vis>::before_handle_event(Event* event)
{ {
#if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE #if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE
std::cout << "CGAL_CSLV before_handle_event" << std::endl; std::cout << "CGAL_CSLV before_handle_event" << std::endl;
@ -273,8 +290,8 @@ void Arr_construction_sl_visitor<Hlpr>::before_handle_event(Event* event)
// A notification invoked after the sweep-line finishes handling the given // A notification invoked after the sweep-line finishes handling the given
// event. // event.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
bool Arr_construction_sl_visitor<Hlpr>:: bool Arr_construction_sl_visitor<Hlpr, Vis>::
after_handle_event(Event* event, Status_line_iterator iter, bool /* flag */) after_handle_event(Event* event, Status_line_iterator iter, bool /* flag */)
{ {
#if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE #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). // to their right endpoint).
Event_subcurve_iterator left_it; Event_subcurve_iterator left_it;
for (left_it = event->left_curves_begin(); for (left_it = event->left_curves_begin();
left_it != event->left_curves_end(); left_it != event->left_curves_end(); ++left_it)
++left_it)
{
(*left_it)->set_last_event(event); (*left_it)->set_last_event(event);
}
// In case there are no right subcurves, the event can be deallocated. // In case there are no right subcurves, the event can be deallocated.
if (event->number_of_right_curves() == 0) { 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). // to their left endpoint).
Event_subcurve_iterator right_it; Event_subcurve_iterator right_it;
for (right_it = event->right_curves_begin(); for (right_it = event->right_curves_begin();
right_it != event->right_curves_end(); right_it != event->right_curves_end(); ++right_it)
++right_it)
{
(*right_it)->set_last_event(event); (*right_it)->set_last_event(event);
}
// Mark that the event cannot be deallocated just yet. // Mark that the event cannot be deallocated just yet.
return false; 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. // A notification invoked when a new subcurve is created.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
void Arr_construction_sl_visitor<Hlpr>:: void Arr_construction_sl_visitor<Hlpr, Vis>::
add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc) add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc)
{ {
#if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE #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; const Halfedge_handle invalid_he;
#if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE #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; std::cout << "CGAL_CSLG lastevent: " << last_event->point() << std::endl;
}
if (he_left != invalid_he) { if (he_left != invalid_he) {
std::cout << "he_left : " << &(*he_left) << std::endl; 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; std::cout << "he_leftcv : " << he_left->curve() << std::endl;
} else { else std::cout << "he_left : fictitious" << std::endl;
std::cout << "he_left : fictitious" << std::endl;
}
std::cout << "he_leftdir : " << he_left->direction() << std::endl; std::cout << "he_leftdir : " << he_left->direction() << std::endl;
std::cout << "he_leftfac : " << &(*he_left->face()) << 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) { if (he_right != invalid_he) {
std::cout << "he_right : " << &(*he_right) << std::endl; 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; std::cout << "he_rightcv : " << he_right->curve() << std::endl;
} else { else std::cout << "he_right : fictitious" << std::endl;
std::cout << "he_right : fictitious" << std::endl;
}
std::cout << "he_rightdir: " << he_right->direction() << std::endl; std::cout << "he_rightdir: " << he_right->direction() << std::endl;
std::cout << "he_rightfac: " << &(*he_right->face()) << std::endl; std::cout << "he_rightfac: " << &(*he_right->face()) << std::endl;
} else { } else std::cout << "he_right : invalid" << std::endl;
std::cout << "he_right : invalid" << std::endl;
}
#endif #endif
// Check whether the previous event on the curve is not in the arrangement // 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. // Therefore, we use it to insert the subcurve.
// First, we skip some halfedges around the left vertex to get the true // First, we skip some halfedges around the left vertex to get the true
// predecessor halfedge for the insertion. // predecessor halfedge for the insertion.
for (int i = 0; i < jump; i++) for (int i = 0; i < jump; i++) he_left = (he_left->next())->twin();
he_left = (he_left->next())->twin();
#if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE #if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE
if (jump != 0) { if (jump != 0) {
std::cout << "CGAL_CSLV JUMP: " << jump << std::endl; 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; std::cout << "he_leftcv : " << he_left->curve() << std::endl;
} else { else std::cout << "he_left : fictitious" << std::endl;
std::cout << "he_left : fictitious" << std::endl;
}
std::cout << "he_leftdir : " << he_left->direction() << std::endl; std::cout << "he_leftdir : " << he_left->direction() << std::endl;
std::cout << "he_leftfac : " << &(*he_left->face()) << 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. // Insert the given subcurve in the interior of an arrangement face.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
typename Arr_construction_sl_visitor<Hlpr>::Halfedge_handle typename Arr_construction_sl_visitor<Hlpr, Vis>::Halfedge_handle
Arr_construction_sl_visitor<Hlpr>:: Arr_construction_sl_visitor<Hlpr, Vis>::
insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc)
{ {
#if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE #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. // Insert the given subcurve using its two end-vertices.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
typename Arr_construction_sl_visitor<Hlpr>::Halfedge_handle typename Arr_construction_sl_visitor<Hlpr, Vis>::Halfedge_handle
Arr_construction_sl_visitor<Hlpr>:: Arr_construction_sl_visitor<Hlpr, Vis>::
insert_at_vertices(const X_monotone_curve_2& cv, insert_at_vertices(const X_monotone_curve_2& cv,
Halfedge_handle prev1, Halfedge_handle prev1,
Halfedge_handle prev2, Halfedge_handle prev2,
@ -623,20 +623,14 @@ insert_at_vertices(const X_monotone_curve_2& cv,
{ {
#if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE #if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE
std::cout << "CGAL_CSLV insert_at_vertices:\ncurve:" << cv << std::endl; 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; 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 << "prev1dir : " << prev1->direction() << std::endl;
std::cout << "prev1fac : " << &(*prev1->face()) << std::endl; std::cout << "prev1fac : " << &(*prev1->face()) << std::endl;
if (!prev2->is_fictitious()) { if (!prev2->is_fictitious())
std::cout << "prev2cv : " << prev2->curve() << std::endl; 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 << "prev2dir : " << prev2->direction() << std::endl;
std::cout << "prev2fac : " << &(*prev2->face()) << std::endl; std::cout << "prev2fac : " << &(*prev2->face()) << std::endl;
#endif #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. // Insert the given subcurve from a vertex that corresponds to its right end.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
typename Arr_construction_sl_visitor<Hlpr>::Halfedge_handle typename Arr_construction_sl_visitor<Hlpr, Vis>::Halfedge_handle
Arr_construction_sl_visitor<Hlpr>:: Arr_construction_sl_visitor<Hlpr, Vis>::
insert_from_right_vertex(const X_monotone_curve_2& cv, insert_from_right_vertex(const X_monotone_curve_2& cv,
Halfedge_handle prev, Halfedge_handle prev,
Subcurve* sc) 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. // Insert the given subcurve from a vertex that corresponds to its left end.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
typename Arr_construction_sl_visitor<Hlpr>::Halfedge_handle typename Arr_construction_sl_visitor<Hlpr, Vis>::Halfedge_handle
Arr_construction_sl_visitor<Hlpr>:: Arr_construction_sl_visitor<Hlpr, Vis>::
insert_from_left_vertex(const X_monotone_curve_2& cv, insert_from_left_vertex(const X_monotone_curve_2& cv,
Halfedge_handle prev, Halfedge_handle prev,
Subcurve* sc) Subcurve* sc)
{ {
#if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE #if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE
std::cout << "CGAL_CSLV insert_from_left_vertex:\ncurve:" << cv << std::endl; 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; std::cout << "prevcv : " << prev->curve() << std::endl;
} else { else std::cout << "prev : fictitious" << std::endl;
std::cout << "prev : fictitious" << std::endl;
}
std::cout << "prevdir : " << prev->direction() << std::endl; std::cout << "prevdir : " << prev->direction() << std::endl;
std::cout << "prevfac : " << &(*prev->face()) << std::endl; std::cout << "prevfac : " << &(*prev->face()) << std::endl;
#endif #endif
@ -812,9 +804,9 @@ insert_from_left_vertex(const X_monotone_curve_2& cv,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Insert an isolated vertex into the arrangement. // Insert an isolated vertex into the arrangement.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
typename Arr_construction_sl_visitor<Hlpr>::Vertex_handle typename Arr_construction_sl_visitor<Hlpr, Vis>::Vertex_handle
Arr_construction_sl_visitor<Hlpr>:: Arr_construction_sl_visitor<Hlpr, Vis>::
insert_isolated_vertex(const Point_2& pt, Status_line_iterator /* iter */) insert_isolated_vertex(const Point_2& pt, Status_line_iterator /* iter */)
{ {
#if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE #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 // Insert the isolated vertex in the interior of the current top face, as
// given by the helper class. // 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. // Reloacte holes and isolated vertices inside a newly created face.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
void Arr_construction_sl_visitor<Hlpr>::relocate_in_new_face(Halfedge_handle he) void Arr_construction_sl_visitor<Hlpr, Vis>::
relocate_in_new_face(Halfedge_handle he)
{ {
#if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE #if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE
std::cout << "CGAL_CSLV relocate" << std::endl; std::cout << "CGAL_CSLV relocate" << std::endl;
@ -909,8 +902,8 @@ void Arr_construction_sl_visitor<Hlpr>::relocate_in_new_face(Halfedge_handle he)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Map the given subcurve index to the given halfedge handle. // Map the given subcurve index to the given halfedge handle.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
void Arr_construction_sl_visitor<Hlpr>:: void Arr_construction_sl_visitor<Hlpr, Vis>::
_map_new_halfedge(unsigned int i, Halfedge_handle he) _map_new_halfedge(unsigned int i, Halfedge_handle he)
{ {
#if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE #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; m_sc_he_table[i] = he;
} }
} //namespace CGAL } // namespace CGAL
#endif #endif

View File

@ -30,6 +30,7 @@
*/ */
#include <CGAL/Surface_sweep_2/Arr_no_intersection_insertion_sl_visitor.h> #include <CGAL/Surface_sweep_2/Arr_no_intersection_insertion_sl_visitor.h>
#include <CGAL/Default.h>
namespace CGAL { namespace CGAL {
@ -37,23 +38,33 @@ namespace CGAL {
* A sweep-line visitor for inserting new curves into an existing arrangement * A sweep-line visitor for inserting new curves into an existing arrangement
* embedded on a surface. * embedded on a surface.
*/ */
template <typename Helper_> template <typename Helper_, typename Visitor_ = Default>
class Arr_insertion_sl_visitor : class Arr_insertion_sl_visitor :
public Arr_no_intersection_insertion_sl_visitor<Helper_> public Arr_no_intersection_insertion_sl_visitor<
Helper_,
typename Default::Get<Visitor_,
Arr_insertion_sl_visitor<Helper_, Visitor_> >::type>
{ {
public: public:
typedef Helper_ Helper; typedef Helper_ Helper;
typedef Arr_no_intersection_insertion_sl_visitor<Helper> 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; private:
typedef typename Base::Arrangement_2 Arrangement_2; typedef Geometry_traits_2 Gt2;
typedef typename Base::Event Event; typedef Arr_insertion_sl_visitor<Helper, Visitor_> Self;
typedef typename Base::Subcurve Subcurve; typedef typename Default::Get<Visitor_, Self>::type Visitor;
typedef Arr_no_intersection_insertion_sl_visitor<Helper, Visitor>
Base;
typedef typename Base::Halfedge_handle Halfedge_handle; public:
typedef typename Base::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Base::Point_2 Point_2; typedef typename Gt2::Point_2 Point_2;
typedef typename Helper::Arrangement_2 Arrangement_2;
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
private: private:
X_monotone_curve_2 sub_cv1; // Auxiliary variables 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 // Check if the halfedge associated with the given subcurve will be split
// at the given event. // at the given event.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
bool Arr_insertion_sl_visitor<Hlpr>::is_split_event(Subcurve* sc, Event* event) bool Arr_insertion_sl_visitor<Hlpr, Vis>::
is_split_event(Subcurve* sc, Event* event)
{ {
if (sc->last_curve().halfedge_handle() == Halfedge_handle(NULL)) return false; if (sc->last_curve().halfedge_handle() == Halfedge_handle(NULL)) return false;
@ -109,9 +121,9 @@ bool Arr_insertion_sl_visitor<Hlpr>::is_split_event(Subcurve* sc, Event* event)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Split an edge. // Split an edge.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
typename Arr_insertion_sl_visitor<Hlpr>::Halfedge_handle typename Arr_insertion_sl_visitor<Hlpr, Vis>::Halfedge_handle
Arr_insertion_sl_visitor<Hlpr>::split_edge(Halfedge_handle he, Subcurve* sc, Arr_insertion_sl_visitor<Hlpr, Vis>::split_edge(Halfedge_handle he, Subcurve* sc,
const Point_2& pt) const Point_2& pt)
{ {
// Make sure that the halfedge associated with sc is the directed from // Make sure that the halfedge associated with sc is the directed from
@ -133,8 +145,8 @@ Arr_insertion_sl_visitor<Hlpr>::split_edge(Halfedge_handle he, Subcurve* sc,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// A notification invoked when a new subcurve is created. // A notification invoked when a new subcurve is created.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
void Arr_insertion_sl_visitor<Hlpr>:: void Arr_insertion_sl_visitor<Hlpr, Vis>::
add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc) add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc)
{ {
if (Base::add_subcurve_(cv, sc)) return; 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); this->current_event()->set_halfedge_handle(next_ccw_he);
} }
} //namespace CGAL } // namespace CGAL
#endif #endif

View File

@ -49,7 +49,6 @@ private:
typedef Arr_basic_insertion_traits_2<Gt2, Arr2> Base; typedef Arr_basic_insertion_traits_2<Gt2, Arr2> Base;
public: public:
typedef typename Gt2::Intersect_2 Base_intersect_2; typedef typename Gt2::Intersect_2 Base_intersect_2;
typedef typename Gt2::Split_2 Base_split_2; typedef typename Gt2::Split_2 Base_split_2;
typedef typename Base::Base_x_monotone_curve_2 Base_x_monotone_curve_2; typedef typename Base::Base_x_monotone_curve_2 Base_x_monotone_curve_2;
@ -76,9 +75,7 @@ public:
public: public:
/*! Constructor with a traits class. */ /*! Constructor with a traits class. */
Arr_insertion_traits_2(const Gt2& tr) : Arr_insertion_traits_2(const Gt2& tr) : Base(tr) {}
Base (tr)
{}
/*! A functor that compares compares the y-coordinates of two x-monotone /*! A functor that compares compares the y-coordinates of two x-monotone
* curves immediately to the right of their intersection point. * curves immediately to the right of their intersection point.
@ -139,7 +136,7 @@ public:
} }
else { else {
intersect_p = intersect_p =
object_cast<std::pair<Base_point_2, unsigned int> > (&(*oi)); object_cast<std::pair<Base_point_2, unsigned int> >(&(*oi));
CGAL_assertion (intersect_p != NULL); CGAL_assertion (intersect_p != NULL);
@ -155,7 +152,7 @@ public:
/*! Obtain a Intersect_2 function object */ /*! Obtain a Intersect_2 function object */
Intersect_2 intersect_2_object () const 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. */ /*! A functor that splits an arc at a point. */
class Split_2 { class Split_2 {
@ -183,9 +180,9 @@ public:
} }
}; };
/*! Obtain a plit_2 function object */ /*! Obtain a Split_2 function object */
Split_2 split_2_object() const 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 } // namespace CGAL

View File

@ -29,6 +29,9 @@
* inserting non-intersecting curves into a empty arrangement. * inserting non-intersecting curves into a empty arrangement.
*/ */
#include <CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h>
#include <CGAL/Default.h>
namespace CGAL { namespace CGAL {
/*! \class Arr_no_intersection_insertion_sl_visitor /*! \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 * embedded on a surface, where these curves are interior-disjoint from all
* existing arrangement edges and vertices (so no intersections occur). * existing arrangement edges and vertices (so no intersections occur).
*/ */
template <typename Helper_> template <typename Helper_, typename Visitor_ = Default>
class Arr_no_intersection_insertion_sl_visitor : public Helper_::Parent_visitor { class Arr_no_intersection_insertion_sl_visitor :
public Arr_construction_sl_visitor<
Helper_,
typename Default::Get<Visitor_, Arr_no_intersection_insertion_sl_visitor<
Helper_, Visitor_> >::type>
{
public: public:
typedef Helper_ Helper; typedef Helper_ Helper;
typedef typename Helper::Geometry_traits_2 Geometry_traits_2; 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::Event Event;
typedef typename Helper::Subcurve Subcurve; typedef typename Helper::Subcurve Subcurve;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
typedef Arr_no_intersection_insertion_sl_visitor<Helper, Visitor_>
Self;
typedef typename Default::Get<Visitor_, Self>::type Visitor;
typedef Arr_construction_sl_visitor<Helper, Visitor> Base;
public: public:
typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Gt2::Point_2 Point_2; typedef typename Gt2::Point_2 Point_2;
protected: protected:
typedef typename Base::Status_line_iterator Status_line_iterator; typedef typename Subcurve::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 Base::Event_subcurve_reverse_iterator typedef typename Base::Event_subcurve_reverse_iterator
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: public:
/*! Constructor. */ /*! Constructor. */
Arr_no_intersection_insertion_sl_visitor(Arrangement_2* arr) : Base(arr) {} Arr_no_intersection_insertion_sl_visitor(Arrangement_2* arr) : Base(arr) {}
@ -217,16 +228,16 @@ protected:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// A notification issued before the sweep process starts. // A notification issued before the sweep process starts.
// Notifies the helper that the sweep process now starts. // Notifies the helper that the sweep process now starts.
template <typename Hlpr> template <typename Hlpr, typename Vis>
void Arr_no_intersection_insertion_sl_visitor<Hlpr>::before_sweep() void Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::before_sweep()
{ this->m_helper.before_sweep(); } { this->m_helper.before_sweep(); }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// A notification invoked before the sweep-line starts handling the given // A notification invoked before the sweep-line starts handling the given
// event. // event.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
void Arr_no_intersection_insertion_sl_visitor<Hlpr>:: void Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::
before_handle_event(Event* event) before_handle_event(Event* event)
{ {
// First we notify the helper class on the event. // First we notify the helper class on the event.
@ -319,8 +330,8 @@ before_handle_event(Event* event)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Add a new curve. // Add a new curve.
// //
template <typename Helper_> template <typename Hlpr, typename Vis>
bool Arr_no_intersection_insertion_sl_visitor<Helper_>:: bool Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::
add_subcurve_(const X_monotone_curve_2& cv, Subcurve* sc) add_subcurve_(const X_monotone_curve_2& cv, Subcurve* sc)
{ {
const Halfedge_handle invalid_he; 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. // A notification invoked when a new subcurve is created.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
void Arr_no_intersection_insertion_sl_visitor<Hlpr>:: void Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::
add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc) add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc)
{ {
if (add_subcurve_(cv, sc)) return; 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. // Insert the given subcurve in the interior of an arrangement face.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
typename Arr_no_intersection_insertion_sl_visitor<Hlpr>::Halfedge_handle typename Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::Halfedge_handle
Arr_no_intersection_insertion_sl_visitor<Hlpr>:: Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::
insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc)
{ {
Event* last_event = this->last_event_on_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. // Insert the given subcurve from a vertex that corresponds to its left end.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
typename Arr_no_intersection_insertion_sl_visitor<Hlpr>::Halfedge_handle typename Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::Halfedge_handle
Arr_no_intersection_insertion_sl_visitor<Hlpr>:: Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::
insert_from_left_vertex(const X_monotone_curve_2& cv, Halfedge_handle he, insert_from_left_vertex(const X_monotone_curve_2& cv, Halfedge_handle he,
Subcurve* sc) 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. // Insert the given subcurve from a vertex that corresponds to its right end.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
typename Arr_no_intersection_insertion_sl_visitor<Hlpr>::Halfedge_handle typename Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::Halfedge_handle
Arr_no_intersection_insertion_sl_visitor<Hlpr>:: Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::
insert_from_right_vertex(const X_monotone_curve_2& cv, Halfedge_handle he, insert_from_right_vertex(const X_monotone_curve_2& cv, Halfedge_handle he,
Subcurve* sc) 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. // Insert the given subcurve using its two end-vertices.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
typename Arr_no_intersection_insertion_sl_visitor<Hlpr>::Halfedge_handle typename Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::Halfedge_handle
Arr_no_intersection_insertion_sl_visitor<Hlpr>:: Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::
insert_at_vertices(const X_monotone_curve_2& cv, insert_at_vertices(const X_monotone_curve_2& cv,
Halfedge_handle prev1, Halfedge_handle prev2, Halfedge_handle prev1, Halfedge_handle prev2,
Subcurve* sc, bool &new_face_created) 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. // Insert an isolated vertex into the arrangement.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
typename Arr_no_intersection_insertion_sl_visitor<Hlpr>::Vertex_handle typename Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::Vertex_handle
Arr_no_intersection_insertion_sl_visitor<Hlpr>:: Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::
insert_isolated_vertex(const Point_2& pt, Status_line_iterator iter) insert_isolated_vertex(const Point_2& pt, Status_line_iterator iter)
{ {
// If the isolated vertex is already at the arrangement, return: // 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 // Perform the actual insertion
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
typename Arr_no_intersection_insertion_sl_visitor<Hlpr>::Halfedge_handle typename Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::Halfedge_handle
Arr_no_intersection_insertion_sl_visitor<Hlpr>:: Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::
_insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) _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 // 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 // Look up and insert the edge in the interior of the incident face of the
// halfedge we see. // 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(), return (this->m_arr_access.insert_in_face_interior_ex(f, cv.base(),
ARR_LEFT_TO_RIGHT, ARR_LEFT_TO_RIGHT,
v1, v2)); v1, v2));
@ -505,9 +516,9 @@ _insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Perform the actual insertion // Perform the actual insertion
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
typename Arr_no_intersection_insertion_sl_visitor<Hlpr>::Halfedge_handle typename Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::Halfedge_handle
Arr_no_intersection_insertion_sl_visitor<Hlpr>:: Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::
_insert_from_left_vertex(const X_monotone_curve_2& cv, _insert_from_left_vertex(const X_monotone_curve_2& cv,
Halfedge_handle prev, Subcurve* sc) Halfedge_handle prev, Subcurve* sc)
{ {
@ -542,9 +553,9 @@ _insert_from_left_vertex(const X_monotone_curve_2& cv,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Perform the actual insertion // Perform the actual insertion
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
typename Arr_no_intersection_insertion_sl_visitor<Hlpr>::Halfedge_handle typename Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::Halfedge_handle
Arr_no_intersection_insertion_sl_visitor<Hlpr>:: Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::
_insert_from_right_vertex(const X_monotone_curve_2& cv, Halfedge_handle prev, _insert_from_right_vertex(const X_monotone_curve_2& cv, Halfedge_handle prev,
Subcurve* sc) Subcurve* sc)
{ {
@ -579,9 +590,9 @@ _insert_from_right_vertex(const X_monotone_curve_2& cv, Halfedge_handle prev,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Perform the actual insertion // Perform the actual insertion
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
typename Arr_no_intersection_insertion_sl_visitor<Hlpr>::Halfedge_handle typename Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::Halfedge_handle
Arr_no_intersection_insertion_sl_visitor<Hlpr>:: Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::
_insert_at_vertices(const X_monotone_curve_2& cv, _insert_at_vertices(const X_monotone_curve_2& cv,
Halfedge_handle prev1, Halfedge_handle prev2, Halfedge_handle prev1, Halfedge_handle prev2,
Subcurve* sc, bool& new_face_created) 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. // Locate the face containing the current object in its interior.
// //
template <typename Hlpr> template <typename Hlpr, typename Vis>
typename Arr_no_intersection_insertion_sl_visitor<Hlpr>::Face_handle typename Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::Face_handle
Arr_no_intersection_insertion_sl_visitor<Hlpr>:: Arr_no_intersection_insertion_sl_visitor<Hlpr, Vis>::
_ray_shoot_up(Status_line_iterator iter) _ray_shoot_up(Status_line_iterator iter)
{ {
// Go up the status line and try to locate a curve which is associated // 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()); return (this->m_helper.top_face());
} }
} //namespace CGAL } // namespace CGAL
#endif #endif

View File

@ -22,6 +22,7 @@
#include <CGAL/license/Surface_sweep_2.h> #include <CGAL/license/Surface_sweep_2.h>
/*! \file /*! \file
*
* Definition of the Arr_overlay_sl_visitor class-template. * Definition of the Arr_overlay_sl_visitor class-template.
*/ */
@ -33,6 +34,7 @@
#include <CGAL/Arr_tags.h> #include <CGAL/Arr_tags.h>
#include <CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h> #include <CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h>
#include <CGAL/Unique_hash_map.h> #include <CGAL/Unique_hash_map.h>
#include <CGAL/Default.h>
namespace CGAL { namespace CGAL {
@ -42,13 +44,18 @@ namespace CGAL {
* arrangement, creating a result arrangement. All three arrangements are * arrangement, creating a result arrangement. All three arrangements are
* embedded on the same type of surface and use the same geometry traits. * embedded on the same type of surface and use the same geometry traits.
*/ */
template <typename OverlayHelper_, typename OverlayTraits_> template <typename OverlayHelper, typename OverlayTraits,
class Arr_overlay_sl_visitor : public typename Visitor_ = Default>
Arr_construction_sl_visitor<typename OverlayHelper_::Construction_helper> class Arr_overlay_sl_visitor :
public Arr_construction_sl_visitor<
typename OverlayHelper::Construction_helper,
typename Default::Get<Visitor_,
Arr_overlay_sl_visitor<OverlayHelper, OverlayTraits,
Visitor_> >::type>
{ {
public: public:
typedef OverlayHelper_ Overlay_helper; typedef OverlayHelper Overlay_helper;
typedef OverlayTraits_ Overlay_traits; typedef OverlayTraits Overlay_traits;
typedef typename Overlay_helper::Geometry_traits_2 Geometry_traits_2; typedef typename Overlay_helper::Geometry_traits_2 Geometry_traits_2;
typedef typename Overlay_helper::Event Event; 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_red_2 Arrangement_red_2;
typedef typename Overlay_helper::Arrangement_blue_2 Arrangement_blue_2; typedef typename Overlay_helper::Arrangement_blue_2 Arrangement_blue_2;
typedef typename Overlay_helper::Construction_helper Construction_helper;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
typedef Arrangement_red_2 Ar2; typedef Arrangement_red_2 Ar2;
typedef Arrangement_blue_2 Ab2; typedef Arrangement_blue_2 Ab2;
typedef Arr_overlay_sl_visitor<Overlay_helper, Overlay_traits, Visitor_>
Self;
typedef typename Default::Get<Visitor_, Self>::type Visitor;
typedef Arr_construction_sl_visitor<Construction_helper, Visitor>
Base;
public: public:
typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Gt2::Point_2 Point_2; typedef typename Gt2::Point_2 Point_2;
@ -84,10 +100,6 @@ public:
Ccb_halfedge_circulator; Ccb_halfedge_circulator;
typedef typename Arrangement_2::Outer_ccb_iterator Outer_ccb_iterator; 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<Construction_helper> Base;
typedef typename Base::Event_subcurve_iterator typedef typename Base::Event_subcurve_iterator
Event_subcurve_iterator; Event_subcurve_iterator;
typedef typename Base::Event_subcurve_reverse_iterator typedef typename Base::Event_subcurve_reverse_iterator
@ -397,8 +409,8 @@ protected:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// A notification issued before the sweep process starts. // A notification issued before the sweep process starts.
// //
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
void Arr_overlay_sl_visitor<OvlHlpr, OvlTr>::before_sweep() void Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::before_sweep()
{ {
// Initialize the necessary fields in the base construction visitor. // Initialize the necessary fields in the base construction visitor.
// Note that the construction visitor also informs its helper class that // Note that the construction visitor also informs its helper class that
@ -413,8 +425,9 @@ void Arr_overlay_sl_visitor<OvlHlpr, OvlTr>::before_sweep()
// A notification invoked before the sweep-line starts handling the given // A notification invoked before the sweep-line starts handling the given
// event. // event.
// //
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
void Arr_overlay_sl_visitor<OvlHlpr, OvlTr>::before_handle_event(Event* event) void
Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::before_handle_event(Event* event)
{ {
// Let the base construction visitor do the work (and also inform its helper // Let the base construction visitor do the work (and also inform its helper
// class on the event). // class on the event).
@ -428,8 +441,8 @@ void Arr_overlay_sl_visitor<OvlHlpr, OvlTr>::before_handle_event(Event* event)
// A notification invoked after the sweep-line finishes handling the given // A notification invoked after the sweep-line finishes handling the given
// event. // event.
// //
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
bool Arr_overlay_sl_visitor<OvlHlpr, OvlTr>:: bool Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::
after_handle_event(Event* event, Status_line_iterator iter, bool flag) after_handle_event(Event* event, Status_line_iterator iter, bool flag)
{ {
// Let the base construction visitor handle the event. // 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. // Update an event that corresponds to a curve endpoint.
// //
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
void Arr_overlay_sl_visitor<OvlHlpr, OvlTr>:: void Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::
update_event(Event* e, update_event(Event* e,
const Point_2& end_point, const Point_2& end_point,
const X_monotone_curve_2& /* cv */, const X_monotone_curve_2& /* cv */,
@ -500,8 +513,8 @@ update_event(Event* e,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Update an event. // Update an event.
// //
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
void Arr_overlay_sl_visitor<OvlHlpr, OvlTr>::update_event(Event* e, void Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::update_event(Event* e,
Subcurve* sc) Subcurve* sc)
{ {
// Update the red and blue halfedges associated with the point as necessary. // Update the red and blue halfedges associated with the point as necessary.
@ -523,8 +536,9 @@ void Arr_overlay_sl_visitor<OvlHlpr, OvlTr>::update_event(Event* e,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Update an event. // Update an event.
// //
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
void Arr_overlay_sl_visitor<OvlHlpr, OvlTr>::update_event(Event* e, void
Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::update_event(Event* e,
const Point_2& p, const Point_2& p,
bool /* is_new */) bool /* is_new */)
{ {
@ -537,8 +551,8 @@ void Arr_overlay_sl_visitor<OvlHlpr, OvlTr>::update_event(Event* e,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// A notification issued when the sweep process has ended. // A notification issued when the sweep process has ended.
// //
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
void Arr_overlay_sl_visitor<OvlHlpr, OvlTr>::after_sweep() void Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::after_sweep()
{ {
// Notify boundary vertices: // Notify boundary vertices:
typename Vertex_map::iterator it; typename Vertex_map::iterator it;
@ -563,9 +577,9 @@ void Arr_overlay_sl_visitor<OvlHlpr, OvlTr>::after_sweep()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Insert the given subcurve in the interior of an arrangement face. // Insert the given subcurve in the interior of an arrangement face.
// //
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
typename Arr_overlay_sl_visitor<OvlHlpr, OvlTr>::Halfedge_handle typename Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::Halfedge_handle
Arr_overlay_sl_visitor<OvlHlpr, OvlTr>:: Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::
insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc)
{ {
// Insert the halfedge using the base construction visitor. // 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. // Insert the given subcurve given its left end-vertex.
// //
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
typename Arr_overlay_sl_visitor<OvlHlpr, OvlTr>::Halfedge_handle typename Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::Halfedge_handle
Arr_overlay_sl_visitor<OvlHlpr, OvlTr>:: Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::
insert_from_left_vertex(const X_monotone_curve_2& cv, insert_from_left_vertex(const X_monotone_curve_2& cv,
Halfedge_handle prev, Halfedge_handle prev,
Subcurve* sc) 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. // Insert the given subcurve given its right end-vertex.
// //
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
typename Arr_overlay_sl_visitor<OvlHlpr, OvlTr>::Halfedge_handle typename Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::Halfedge_handle
Arr_overlay_sl_visitor<OvlHlpr, OvlTr>:: Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::
insert_from_right_vertex(const X_monotone_curve_2& cv, insert_from_right_vertex(const X_monotone_curve_2& cv,
Halfedge_handle prev, Halfedge_handle prev,
Subcurve* sc) 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. // Insert the given subcurve given its two end-vertices.
// //
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
typename Arr_overlay_sl_visitor<OvlHlpr, OvlTr>::Halfedge_handle typename Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::Halfedge_handle
Arr_overlay_sl_visitor<OvlHlpr, OvlTr>:: Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::
insert_at_vertices(const X_monotone_curve_2& cv, insert_at_vertices(const X_monotone_curve_2& cv,
Halfedge_handle prev1, Halfedge_handle prev1,
Halfedge_handle prev2, Halfedge_handle prev2,
@ -777,9 +791,9 @@ insert_at_vertices(const X_monotone_curve_2& cv,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Insert an isolated vertex into the arrangement. // Insert an isolated vertex into the arrangement.
// //
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
typename Arr_overlay_sl_visitor<OvlHlpr, OvlTr>::Vertex_handle typename Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::Vertex_handle
Arr_overlay_sl_visitor<OvlHlpr, OvlTr>:: Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::
insert_isolated_vertex(const Point_2& pt, insert_isolated_vertex(const Point_2& pt,
Status_line_iterator iter) 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 // Map a newly created halfedge in the result arrangement to its originator
// red and blue halfedges. // red and blue halfedges.
// //
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
void Arr_overlay_sl_visitor<OvlHlpr, OvlTr>:: void Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::
_map_halfedge_and_twin(Halfedge_handle he, _map_halfedge_and_twin(Halfedge_handle he,
Halfedge_handle_red red_he, Halfedge_handle_red red_he,
Halfedge_handle_blue blue_he) Halfedge_handle_blue blue_he)
@ -906,8 +920,8 @@ _map_halfedge_and_twin(Halfedge_handle he,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Update the boundary vertices map. // Update the boundary vertices map.
// //
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
void Arr_overlay_sl_visitor<OvlHlpr, OvlTr>:: void Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::
_map_boundary_vertices(Event* event, Vertex_handle v, boost::mpl::bool_<true>) _map_boundary_vertices(Event* event, Vertex_handle v, boost::mpl::bool_<true>)
{ {
// Update the red and blue object if the last event on sc is on the boundary. // 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_<true>)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Update the boundary vertices map. // Update the boundary vertices map.
// //
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
void Arr_overlay_sl_visitor<OvlHlpr, OvlTr>:: void Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::
_map_boundary_vertices(Event* /* event */, Vertex_handle /* v */, boost::mpl::bool_<false>) _map_boundary_vertices(Event* /* event */, Vertex_handle /* v */,
boost::mpl::bool_<false>)
{} {}
/* Notify the overlay traits about a newly created vertex. /* 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) * this case, we postpone the notification for all (contracted and identified)
* boundary side vertices to the end of the sweep. * boundary side vertices to the end of the sweep.
*/ */
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
void Arr_overlay_sl_visitor<OvlHlpr, OvlTr>:: void Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::
_create_vertex(Event* event, _create_vertex(Event* event,
Vertex_handle new_v, Vertex_handle new_v,
Subcurve* sc, Subcurve* sc,
@ -1000,8 +1015,8 @@ _create_vertex(Event* event,
} }
/* Notify the overlay traits about a newly created vertex. */ /* Notify the overlay traits about a newly created vertex. */
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
void Arr_overlay_sl_visitor<OvlHlpr, OvlTr>:: void Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::
_create_vertex(Event* event, _create_vertex(Event* event,
Vertex_handle new_v, Vertex_handle new_v,
Subcurve* sc, Subcurve* sc,
@ -1045,9 +1060,9 @@ _create_vertex(Event* event,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Update a newly created result edge using the overlay traits. // Update a newly created result edge using the overlay traits.
// //
template <typename OvlHlpr, typename OvlTr> template <typename OvlHlpr, typename OvlTr, typename Vis>
void void Arr_overlay_sl_visitor<OvlHlpr, OvlTr, Vis>::
Arr_overlay_sl_visitor<OvlHlpr, OvlTr>::_create_edge(Subcurve* sc, _create_edge(Subcurve* sc,
Halfedge_handle new_he) Halfedge_handle new_he)
{ {
// Note that the "red" and "blue" halfedges are always directed from right // Note that the "red" and "blue" halfedges are always directed from right
@ -1084,6 +1099,6 @@ Arr_overlay_sl_visitor<OvlHlpr, OvlTr>::_create_edge(Subcurve* sc,
} }
} }
} //namespace CGAL } // namespace CGAL
#endif #endif

View File

@ -13,6 +13,7 @@
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// Author(s) : Ron Wein <wein@post.tau.ac.il> // Author(s) : Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efifogel@gmail.com>
#ifndef CGAL_ARR_VERT_DECOMP_SL_VISITOR_H #ifndef CGAL_ARR_VERT_DECOMP_SL_VISITOR_H
#define CGAL_ARR_VERT_DECOMP_SL_VISITOR_H #define CGAL_ARR_VERT_DECOMP_SL_VISITOR_H
@ -26,29 +27,47 @@
namespace CGAL { namespace CGAL {
#include <CGAL/Object.h> #include <CGAL/Object.h>
#include <CGAL/Default.h>
/*! \class Arr_vert_decomp_sl_visitor /*! \class Arr_vert_decomp_sl_visitor
* A sweep-line visitor for performing vertical decomposition on an * A sweep-line visitor for performing vertical decomposition on an
* arrangement embedded on a surface. * arrangement embedded on a surface.
*/ */
template <typename Helper_, typename OutputIterator> template <typename Helper_, typename OutputIterator, typename Visitor_ = Default>
class Arr_vert_decomp_sl_visitor : public Helper_::Base_visitor { class Arr_vert_decomp_sl_visitor :
public Ss2::Visitor_base<typename Helper_::Geometry_traits_2,
typename Helper_::Event,
typename Helper_::Subcurve,
typename Helper_::Allocator,
typename Default::Get<Visitor_,
Arr_batched_pl_sl_visitor<
Helper_, OutputIterator,
Visitor_> >::type>
{
public: public:
typedef Helper_ Helper; typedef Helper_ Helper;
typedef OutputIterator Output_iterator; typedef OutputIterator Output_iterator;
typedef typename Helper::Geometry_traits_2 Geometry_traits_2; typedef typename Helper::Geometry_traits_2 Geometry_traits_2;
typedef typename Helper::Arrangement_2 Arrangement_2;
typedef typename Helper::Event Event; typedef typename Helper::Event Event;
typedef typename Helper::Subcurve Subcurve; typedef typename Helper::Subcurve Subcurve;
typedef typename Helper::Allocator Allocator;
private:
typedef Geometry_traits_2 Gt2;
typedef Arr_vert_decomp_sl_visitor<Helper, Output_iterator, Visitor_>
Self;
typedef typename Default::Get<Visitor_, Self>::type Visitor;
typedef typename Ss2::Visitor_base<Gt2, Event, Subcurve, Allocator, Visitor>
Base;
public:
typedef typename Helper::Arrangement_2 Arrangement_2;
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
typedef std::pair<CGAL::Object, CGAL::Object> Vert_pair; typedef std::pair<CGAL::Object, CGAL::Object> Vert_pair;
typedef std::pair<Vertex_const_handle, Vert_pair> Vert_entry; typedef std::pair<Vertex_const_handle, Vert_pair> Vert_entry;
protected: protected:
typedef typename Helper::Base_visitor Base;
typedef typename Base::Status_line_iterator Status_line_iterator; typedef typename Base::Status_line_iterator Status_line_iterator;
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
//typedef typename Arrangement_2::Vertex_const_handle Vertex_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. // A notification issued before the sweep process starts.
// //
template <typename Hlpr, typename OutIt> template <typename Hlpr, typename OutIt, typename Vis>
void Arr_vert_decomp_sl_visitor<Hlpr, OutIt>::before_sweep() void Arr_vert_decomp_sl_visitor<Hlpr, OutIt, Vis>::before_sweep()
{ {
// Notify the helper that the sweep process now starts. // Notify the helper that the sweep process now starts.
m_helper.before_sweep(); m_helper.before_sweep();
@ -122,8 +141,8 @@ void Arr_vert_decomp_sl_visitor<Hlpr, OutIt>::before_sweep()
// A notification invoked after the sweep-line finishes handling the given // A notification invoked after the sweep-line finishes handling the given
// event. // event.
// //
template <class Hlpr, class OutIt> template <class Hlpr, class OutIt, typename Vis>
bool Arr_vert_decomp_sl_visitor<Hlpr, OutIt>:: bool Arr_vert_decomp_sl_visitor<Hlpr, OutIt, Vis>::
after_handle_event(Event* event, after_handle_event(Event* event,
Status_line_iterator above, bool /* on_above */) 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. // A notification issued when the sweep process is over.
// //
template <typename Hlpr, typename OutIt> template <typename Hlpr, typename OutIt, typename Vis>
void Arr_vert_decomp_sl_visitor<Hlpr, OutIt>::after_sweep() void Arr_vert_decomp_sl_visitor<Hlpr, OutIt, Vis>::after_sweep()
{ {
// Create an entry for the last vertex (the xy-largest one). // Create an entry for the last vertex (the xy-largest one).
if (m_prev_vh != invalid_vh) { if (m_prev_vh != invalid_vh) {
@ -289,6 +308,6 @@ void Arr_vert_decomp_sl_visitor<Hlpr, OutIt>::after_sweep()
} }
} }
} //namespace CGAL } // namespace CGAL
#endif #endif

View File

@ -232,7 +232,7 @@ class Default_subcurve :
public Default_subcurve_base<GeometryTraits_2, Event_, public Default_subcurve_base<GeometryTraits_2, Event_,
typename Default::Get<Subcurve_, typename Default::Get<Subcurve_,
Default_subcurve< Default_subcurve<
GeometryTraits_2, GeometryTraits_2, Event_,
Subcurve_> >::type> Subcurve_> >::type>
{ {
public: public:

View File

@ -33,9 +33,8 @@ namespace Surface_sweep_2 {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Constructor. // Constructor.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> No_intersection_surface_sweep_2<Vis>::
No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
No_intersection_surface_sweep_2(Visitor* visitor) : No_intersection_surface_sweep_2(Visitor* visitor) :
m_traits(new Traits_adaptor_2()), m_traits(new Traits_adaptor_2()),
m_traitsOwner(true), m_traitsOwner(true),
@ -55,9 +54,8 @@ No_intersection_surface_sweep_2(Visitor* visitor) :
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Constructor with a given traits-class. // Constructor with a given traits-class.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> No_intersection_surface_sweep_2<Vis>::
No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
No_intersection_surface_sweep_2(const Gt2* traits, Visitor* visitor) : No_intersection_surface_sweep_2(const Gt2* traits, Visitor* visitor) :
m_traits(static_cast<const Traits_adaptor_2*>(traits)), m_traits(static_cast<const Traits_adaptor_2*>(traits)),
m_traitsOwner(false), m_traitsOwner(false),
@ -77,10 +75,8 @@ No_intersection_surface_sweep_2(const Gt2* traits, Visitor* visitor) :
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Destrcutor. // Destrcutor.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> No_intersection_surface_sweep_2<Vis>::~No_intersection_surface_sweep_2()
No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
~No_intersection_surface_sweep_2()
{ {
// Free the traits-class object, if we own it. // Free the traits-class object, if we own it.
if (m_traitsOwner) delete m_traits; if (m_traitsOwner) delete m_traits;
@ -101,9 +97,8 @@ No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Stop the sweep-line process. // Stop the sweep-line process.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void No_intersection_surface_sweep_2<Vis>::stop_sweep()
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::stop_sweep()
{ {
// Clear the event queue, deallocating all events but the current one // Clear the event queue, deallocating all events but the current one
// (the first event in the queue). // (the first event in the queue).
@ -131,10 +126,8 @@ void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::stop_sweep()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Deallocate event object.. // Deallocate event object..
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void No_intersection_surface_sweep_2<Vis>::deallocate_event(Event* event)
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
deallocate_event(Event* event)
{ {
// Remove the event from the set of allocated events. // Remove the event from the set of allocated events.
m_allocated_events.erase(event); m_allocated_events.erase(event);
@ -147,9 +140,8 @@ deallocate_event(Event* event)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Perform the main sweep-line loop. // Perform the main sweep-line loop.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void No_intersection_surface_sweep_2<Vis>::_sweep()
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_sweep()
{ {
CGAL_SL_PRINT_TEXT("Ordered sequence of "); CGAL_SL_PRINT_TEXT("Ordered sequence of ");
CGAL_SL_PRINT(m_queue->size()); CGAL_SL_PRINT(m_queue->size());
@ -208,10 +200,8 @@ void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_sweep()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Initialize the data structures for the sweep-line algorithm. // Initialize the data structures for the sweep-line algorithm.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void No_intersection_surface_sweep_2<Vis>::_init_structures()
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
_init_structures()
{ {
CGAL_assertion(m_queue->empty()); CGAL_assertion(m_queue->empty());
CGAL_assertion((m_statusLine.size() == 0)); CGAL_assertion((m_statusLine.size() == 0));
@ -225,10 +215,8 @@ _init_structures()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Complete the sweep (complete the data structures). // Complete the sweep (complete the data structures).
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void No_intersection_surface_sweep_2<Vis>::_complete_sweep()
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
_complete_sweep()
{ {
CGAL_assertion(m_queue->empty()); CGAL_assertion(m_queue->empty());
CGAL_assertion((m_statusLine.size() == 0)); CGAL_assertion((m_statusLine.size() == 0));
@ -244,10 +232,9 @@ _complete_sweep()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Initialize an event associated with a point. // Initialize an event associated with a point.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void No_intersection_surface_sweep_2<Vis>::_init_point(const Point_2& pt,
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>:: Attribute type)
_init_point(const Point_2& pt, Attribute type)
{ {
// Create the event, or obtain an existing event in the queue. // Create the event, or obtain an existing event in the queue.
// Note that an isolated point does not have any boundary conditions. // 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. // Initialize the events associated with an x-monotone curve.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void No_intersection_surface_sweep_2<Vis>::
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
_init_curve(const X_monotone_curve_2& curve, unsigned int index) _init_curve(const X_monotone_curve_2& curve, unsigned int index)
{ {
// Construct and initialize a subcurve object. // 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. // Initialize an event associated with an x-monotone curve end.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void No_intersection_surface_sweep_2<Vis>::
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
_init_curve_end(const X_monotone_curve_2& cv, Arr_curve_end ind, Subcurve* sc) _init_curve_end(const X_monotone_curve_2& cv, Arr_curve_end ind, Subcurve* sc)
{ {
// Get the boundary conditions of the curve end. // 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. // Handle the subcurves to the left of the current event point.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void No_intersection_surface_sweep_2<Vis>::_handle_left_curves()
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
_handle_left_curves()
{ {
CGAL_SL_PRINT_START_EOL("handling left curves at ("); CGAL_SL_PRINT_START_EOL("handling left curves at (");
CGAL_SL_DEBUG(PrintEvent(m_currentEvent)); CGAL_SL_DEBUG(PrintEvent(m_currentEvent));
@ -398,10 +381,8 @@ _handle_left_curves()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Handle an event that does not have any incident left curves. // Handle an event that does not have any incident left curves.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void No_intersection_surface_sweep_2<Vis>::_handle_event_without_left_curves()
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
_handle_event_without_left_curves()
{ {
// Check if the event is a boundary event or not. // Check if the event is a boundary event or not.
const Arr_parameter_space ps_x = m_currentEvent->parameter_space_in_x(); 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 // Sort the left subcurves of an event point according to their order in
// their status line (no geometric comprasions are needed). // their status line (no geometric comprasions are needed).
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void No_intersection_surface_sweep_2<Vis>::_sort_left_curves()
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
_sort_left_curves()
{ {
CGAL_SL_PRINT_START_EOL("sorting left curves"); CGAL_SL_PRINT_START_EOL("sorting left curves");
CGAL_assertion(m_currentEvent->has_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. // Handle the subcurves to the right of the current event point.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void No_intersection_surface_sweep_2<Vis>::_handle_right_curves()
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
_handle_right_curves()
{ {
CGAL_SL_PRINT_START("Handling right curves at ("); CGAL_SL_PRINT_START("Handling right curves at (");
CGAL_SL_DEBUG(PrintEvent(m_currentEvent)); CGAL_SL_DEBUG(PrintEvent(m_currentEvent));
@ -561,9 +538,8 @@ _handle_right_curves()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Add a subcurve to the right of an event point. // Add a subcurve to the right of an event point.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> bool No_intersection_surface_sweep_2<Vis>::
bool No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
_add_curve_to_right(Event* event, Subcurve* curve, bool /* overlap_exist */) _add_curve_to_right(Event* event, Subcurve* curve, bool /* overlap_exist */)
{ {
#if defined(CGAL_NO_ASSERTIONS) #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. // Remove a curve from the status line.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void No_intersection_surface_sweep_2<Vis>::
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
_remove_curve_from_status_line(Subcurve* sc) _remove_curve_from_status_line(Subcurve* sc)
{ {
CGAL_SL_PRINT_START("removing a curve from the status line, "); 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. // Allocate an event object associated with a valid point.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> typename No_intersection_surface_sweep_2<Vis>::Event*
typename No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::Event* No_intersection_surface_sweep_2<Vis>::_allocate_event(const Point_2& pt,
No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>:: Attribute type,
_allocate_event(const Point_2& pt, Attribute type, Arr_parameter_space ps_x,
Arr_parameter_space ps_x, Arr_parameter_space ps_y) Arr_parameter_space ps_y)
{ {
// Allocate the event. // Allocate the event.
Event* e = m_eventAlloc.allocate(1); Event* e = m_eventAlloc.allocate(1);
@ -628,10 +603,9 @@ _allocate_event(const Point_2& pt, Attribute type,
// Allocate an event at open boundary, // Allocate an event at open boundary,
// which is not associated with a valid point. // which is not associated with a valid point.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> typename No_intersection_surface_sweep_2<Vis>::Event*
typename No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::Event* No_intersection_surface_sweep_2<Vis>::
No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
_allocate_event_at_open_boundary(Attribute type, _allocate_event_at_open_boundary(Attribute type,
Arr_parameter_space ps_x, Arr_parameter_space ps_x,
Arr_parameter_space ps_y) 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. // Push a closed event point into the event queue.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> std::pair<typename No_intersection_surface_sweep_2<Vis>::Event*, bool>
std::pair<typename No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, No_intersection_surface_sweep_2<Vis>::_push_event(const Point_2& pt,
Alloc>::Event*, bool> Attribute type,
No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>:: Arr_parameter_space ps_x,
_push_event(const Point_2& pt, Attribute type, Arr_parameter_space ps_y,
Arr_parameter_space ps_x, Arr_parameter_space ps_y, Subcurve* sc) Subcurve* sc)
{ {
// Look for the point in the event queue. // Look for the point in the event queue.
Event* e; 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. // Push an event point associated with a curve end into the event queue.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> std::pair<typename No_intersection_surface_sweep_2<Vis>::Event*, bool>
std::pair<typename No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, No_intersection_surface_sweep_2<Vis>::_push_event(const X_monotone_curve_2& cv,
Alloc>::Event*, Arr_curve_end ind,
bool> Attribute type,
No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>:: Arr_parameter_space ps_x,
_push_event(const X_monotone_curve_2& cv, Arr_curve_end ind, Attribute type, Arr_parameter_space ps_y,
Arr_parameter_space ps_x, Arr_parameter_space ps_y, Subcurve* sc) Subcurve* sc)
{ {
// Look for the curve end in the event queue. // Look for the curve end in the event queue.
Event* e; 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 // add a curve as a right curve or left curve when the event is created
// or updated. // or updated.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void No_intersection_surface_sweep_2<Vis>::_add_curve(Event* e, Subcurve* sc,
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>:: Attribute type)
_add_curve(Event* e, Subcurve* sc, Attribute type)
{ {
if (sc == NULL) return; if (sc == NULL) return;

View File

@ -15,7 +15,7 @@
// Author(s) : Tali Zvi <talizvi@post.tau.ac.il>, // Author(s) : Tali Zvi <talizvi@post.tau.ac.il>,
// Baruch Zukerman <baruchzu@post.tau.ac.il> // Baruch Zukerman <baruchzu@post.tau.ac.il>
// Ron Wein <wein@post.tau.ac.il> // Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@gmail.com> // Efi Fogel <efifogel@gmail.com>
#ifndef CGAL_SURFACE_SWEEP_2_NO_OVERLAP_EVENT_H #ifndef CGAL_SURFACE_SWEEP_2_NO_OVERLAP_EVENT_H
#define CGAL_SURFACE_SWEEP_2_NO_OVERLAP_EVENT_H #define CGAL_SURFACE_SWEEP_2_NO_OVERLAP_EVENT_H
@ -23,6 +23,7 @@
#include <CGAL/license/Surface_sweep_2.h> #include <CGAL/license/Surface_sweep_2.h>
/*! \file /*! \file
*
* Defintion of the No_overlap_event class. * Defintion of the No_overlap_event class.
*/ */

View File

@ -66,13 +66,14 @@ public:
typedef GeometryTraits_2 Geometry_traits_2; typedef GeometryTraits_2 Geometry_traits_2;
typedef Subcurve_ Subcurve; typedef Subcurve_ Subcurve;
typedef Event_ Event; typedef Event_ Event;
typedef CGAL_ALLOCATOR(int) Allocator;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
public: public:
typedef Curve_comparer<Gt2, Event, Subcurve> Compare_curves; typedef Curve_comparer<Gt2, Event, Subcurve> Compare_curves;
typedef Multiset<Subcurve*, Compare_curves, CGAL_ALLOCATOR(int)> typedef Multiset<Subcurve*, Compare_curves, Allocator>
Status_line; Status_line;
typedef typename Status_line::iterator Status_line_iterator; typedef typename Status_line::iterator Status_line_iterator;
@ -143,7 +144,8 @@ private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
typedef No_overlap_subcurve<Gt2, Event, Subcurve_> Self; typedef No_overlap_subcurve<Gt2, Event, Subcurve_> Self;
typedef typename Default::Get<Subcurve_, Self>::type Subcurve; typedef typename Default::Get<Subcurve_, Self>::type Subcurve;
typedef No_overlap_subcurve_base<Gt2, Event, Subcurve> Base; typedef No_overlap_subcurve_base<Gt2, Event, Subcurve>
Base;
public: public:
typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2;

View File

@ -32,9 +32,8 @@ namespace Surface_sweep_2 {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Initialize the data structures for the sweep-line algorithm. // Initialize the data structures for the sweep-line algorithm.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void Surface_sweep_2<Vis>::_init_structures()
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_init_structures()
{ {
// Initailize the structures maintained by the base sweep-line class. // Initailize the structures maintained by the base sweep-line class.
Base::_init_structures(); Base::_init_structures();
@ -46,9 +45,8 @@ void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_init_structures()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Complete the sweep (complete the data structures). // Complete the sweep (complete the data structures).
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void Surface_sweep_2<Vis>::_complete_sweep()
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_complete_sweep()
{ {
CGAL_SL_PRINT_START_EOL("completing the sweep"); CGAL_SL_PRINT_START_EOL("completing the sweep");
@ -75,9 +73,8 @@ void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_complete_sweep()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Handle the subcurves to the left of the current event point. // Handle the subcurves to the left of the current event point.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void Surface_sweep_2<Vis>::_handle_left_curves()
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_handle_left_curves()
{ {
CGAL_SL_PRINT_START("handling left curves at ("); CGAL_SL_PRINT_START("handling left curves at (");
CGAL_SL_DEBUG(this->PrintEvent(this->m_currentEvent)); CGAL_SL_DEBUG(this->PrintEvent(this->m_currentEvent));
@ -206,9 +203,8 @@ void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_handle_left_curves()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Handle the subcurves to the right of the current event point. // Handle the subcurves to the right of the current event point.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void Surface_sweep_2<Vis>::_handle_right_curves()
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_handle_right_curves()
{ {
CGAL_SL_PRINT_START("handling right curves at ("); CGAL_SL_PRINT_START("handling right curves at (");
CGAL_SL_DEBUG(this->PrintEvent(this->m_currentEvent)); CGAL_SL_DEBUG(this->PrintEvent(this->m_currentEvent));
@ -285,9 +281,8 @@ void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_handle_right_curves()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Add a subcurve to the right of an event point. // Add a subcurve to the right of an event point.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> bool Surface_sweep_2<Vis>::
bool Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
_add_curve_to_right(Event* event, Subcurve* curve, bool overlap_exist) _add_curve_to_right(Event* event, Subcurve* curve, bool overlap_exist)
{ {
CGAL_SL_PRINT_START("adding a Curve to the right of ("); 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. // Remove a curve from the status line.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void Surface_sweep_2<Vis>::_remove_curve_from_status_line(Subcurve* leftCurve,
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>:: bool remove_for_good)
_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_START("removing a curve from the status line, ");
CGAL_SL_PRINT_CURVE(leftCurve); 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. // Compute intersections between the two given curves.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void Surface_sweep_2<Vis>::_intersect(Subcurve* c1, Subcurve* c2)
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_intersect(Subcurve* c1,
Subcurve* c2)
{ {
CGAL_SL_PRINT_START("computing intersection of "); CGAL_SL_PRINT_START("computing intersection of ");
CGAL_SL_PRINT_CURVE(c1); CGAL_SL_PRINT_CURVE(c1);
@ -423,7 +415,7 @@ void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_intersect(Subcurve* c1,
CGAL_SL_PRINT_CURVE(c2); CGAL_SL_PRINT_CURVE(c2);
CGAL_SL_PRINT_EOL(); CGAL_SL_PRINT_EOL();
typedef typename Tr::Multiplicity Multiplicity; typedef typename Geometry_traits_2::Multiplicity Multiplicity;
CGAL_assertion(c1 != c2); CGAL_assertion(c1 != c2);
@ -583,12 +575,11 @@ void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_intersect(Subcurve* c1,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Create an intersection-point event between two curves. // Create an intersection-point event between two curves.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void Surface_sweep_2<Vis>::_create_intersection_point(const Point_2& xp,
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
_create_intersection_point(const Point_2& xp,
unsigned int multiplicity, unsigned int multiplicity,
Subcurve*& c1, Subcurve*& c2, Subcurve*& c1,
Subcurve*& c2,
bool is_overlap) bool is_overlap)
{ {
CGAL_SL_PRINT_START_EOL("createing an intersection point netween"); CGAL_SL_PRINT_START_EOL("createing an intersection point netween");
@ -687,9 +678,8 @@ _create_intersection_point(const Point_2& xp,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Fix overlap Subcurves before handling the current event. // Fix overlap Subcurves before handling the current event.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void Surface_sweep_2<Vis>::_fix_overlap_subcurves()
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_fix_overlap_subcurves()
{ {
CGAL_SL_PRINT_START_EOL("fixing overlap subcurves"); CGAL_SL_PRINT_START_EOL("fixing overlap subcurves");
@ -727,10 +717,9 @@ void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_fix_overlap_subcurves()
* \param overlap_exist a flag indicates if the overlap X_monotone_curve_2 was * \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). * computed already (is true than its stored at sub_cv1 data member).
*/ */
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void Surface_sweep_2<Vis>::_handle_overlap(Event* event, Subcurve* curve,
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>:: Event_subcurve_iterator iter,
_handle_overlap(Event* event, Subcurve* curve, Event_subcurve_iterator iter,
bool overlap_exist) bool overlap_exist)
{ {
// An overlap occurs: // An overlap occurs:
@ -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 // sc - some originating subcurve of a aubcurve that stores an overlap
// notice thah this function is recursive since an originating subcurve of // notice thah this function is recursive since an originating subcurve of
// an overlap can be itself a subcurve that stores overlap and so on. // an overlap can be itself a subcurve that stores overlap and so on.
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void Surface_sweep_2<Vis>::_fix_finished_overlap_subcurve(Subcurve* sc)
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
_fix_finished_overlap_subcurve(Subcurve* sc)
{ {
CGAL_SL_PRINT_START("fixing finished overlap subcurve "); CGAL_SL_PRINT_START("fixing finished overlap subcurve ");
CGAL_SL_PRINT_CURVE(sc); 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 // add a curve as a right curve or left curve when the event is created
// or updated. // or updated.
// //
template <typename Tr, typename Vis, typename Subcv, typename Evnt, template <typename Vis>
typename Alloc> void Surface_sweep_2<Vis>::_add_curve(Event* e, Subcurve* sc, Attribute type)
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
_add_curve(Event* e, Subcurve* sc, Attribute type)
{ {
if (sc == NULL) return; if (sc == NULL) return;

View File

@ -14,6 +14,7 @@
// //
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il> // Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Ron Wein <wein@post.tau.ac.il> // Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
#ifndef CGAL_SURFACE_SWEEP_2_VISITORS_H #ifndef CGAL_SURFACE_SWEEP_2_VISITORS_H
#define CGAL_SURFACE_SWEEP_2_VISITORS_H #define CGAL_SURFACE_SWEEP_2_VISITORS_H
@ -26,45 +27,47 @@
* sweep-line functions. * sweep-line functions.
*/ */
#include <CGAL/Surface_sweep_2/Surface_sweep_2_utils.h>
#include <CGAL/Surface_sweep_empty_visitor.h>
#include <vector> #include <vector>
#include <iterator> #include <iterator>
#include <CGAL/Surface_sweep_2.h>
#include <CGAL/Surface_sweep_2/Surface_sweep_2_utils.h>
#include <CGAL/Surface_sweep_2/Visitor.h>
namespace CGAL { namespace CGAL {
namespace Surface_sweep_2 { namespace Surface_sweep_2 {
/*! \class /*! \class Surface_sweep_points_visitor
* *
* A simple sweep-line visitor that reports all intersection points among a * A simple sweep-line visitor that reports all intersection points among a
* set of input curves. * set of input curves.
*/ */
template <typename GeometryTraits_2, typename OutputIerator_> template <typename GeometryTraits_2, typename OutputIerator>
class Surface_sweep_points_visitor : class Surface_sweep_points_visitor :
public Surface_sweep_empty_visitor<GeometryTraits_2> public Default_visitor<Surface_sweep_points_visitor<GeometryTraits_2,
OutputIerator>,
GeometryTraits_2>
{ {
public: public:
typedef GeometryTraits_2 Geometry_traits_2; typedef GeometryTraits_2 Geometry_traits_2;
typedef OutputIerator_ Output_ierator; typedef OutputIerator Output_ierator;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
typedef Surface_sweep_points_visitor<Gt2, Output_ierator> typedef Surface_sweep_points_visitor<Gt2, Output_ierator>
Self; Self;
typedef Surface_sweep_empty_visitor<Gt2> Base; typedef Default_visitor<Self, Gt2> Base;
public: public:
typedef typename Base::Event Event; typedef typename Base::Event Event;
typedef typename Base::Subcurve Subcurve; 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::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Gt2::Point_2 Point_2; typedef typename Gt2::Point_2 Point_2;
typedef CGAL::Surface_sweep_2::Surface_sweep_2<Gt2, Self> typedef CGAL::Surface_sweep_2::Surface_sweep_2<Self> Surface_sweep_2;
Surface_sweep_2;
protected: protected:
Output_ierator m_out; // The output points. Output_ierator m_out; // The output points.
@ -113,22 +116,26 @@ public:
Output_ierator output_iterator() { return m_out; } Output_ierator output_iterator() { return m_out; }
}; };
/*! \class /*! \class Surface_sweep_subcurves_visitor
*
* A simple sweep-line visitor that reports all non-intersecting * A simple sweep-line visitor that reports all non-intersecting
* x-monotone curves induced by a set of input curves. * x-monotone curves induced by a set of input curves.
*/ */
template <typename GeometryTraits_2, typename OutputIerator_> template <typename GeometryTraits_2, typename OutputIerator>
class Surface_sweep_subcurves_visitor : class Surface_sweep_subcurves_visitor :
public Surface_sweep_empty_visitor<GeometryTraits_2> public Default_visitor<Surface_sweep_subcurves_visitor<
GeometryTraits_2, OutputIerator>,
GeometryTraits_2>
{ {
public:
typedef GeometryTraits_2 Geometry_traits_2; typedef GeometryTraits_2 Geometry_traits_2;
typedef OutputIerator_ Output_ierator; typedef OutputIerator Output_ierator;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
typedef Surface_sweep_subcurves_visitor<Gt2, Output_ierator> typedef Surface_sweep_subcurves_visitor<Gt2, Output_ierator>
Self; Self;
typedef Surface_sweep_empty_visitor<Gt2> Base; typedef Default_visitor<Self, Gt2> Base;
public: public:
typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2;
@ -136,10 +143,10 @@ public:
typedef typename Base::Event Event; typedef typename Base::Event Event;
typedef typename Base::Subcurve Subcurve; typedef typename Base::Subcurve Subcurve;
typedef typename Base::Status_line_iterator Status_line_iterator;
typedef CGAL::Surface_sweep_2::Surface_sweep_2<Gt2, Self> typedef typename Subcurve::Status_line_iterator Status_line_iterator;
Surface_sweep_2;
typedef CGAL::Surface_sweep_2::Surface_sweep_2<Self> Surface_sweep_2;
protected: protected:
// Data members: // Data members:
@ -191,31 +198,34 @@ public:
Output_ierator output_iterator() { return m_out; } 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 * A simple sweep-line visitor that determines if there are intersections
* in the interiors of the given curve set. * in the interiors of the given curve set.
*/ */
template <typename GeometryTraits_2> template <typename GeometryTraits_2>
class Surface_sweep_do_curves_x_visitor : class Surface_sweep_do_curves_x_visitor :
public Surface_sweep_empty_visitor<GeometryTraits_2> public Default_visitor<Surface_sweep_do_curves_x_visitor<GeometryTraits_2>,
GeometryTraits_2>
{ {
public:
typedef GeometryTraits_2 Geometry_traits_2; typedef GeometryTraits_2 Geometry_traits_2;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
typedef Surface_sweep_do_curves_x_visitor<Gt2> Self; typedef Surface_sweep_do_curves_x_visitor<Gt2> Self;
typedef Surface_sweep_empty_visitor<Gt2> Base; typedef Default_visitor<Self, Gt2> Base;
public: 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::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Gt2::Point_2 Point_2; typedef typename Gt2::Point_2 Point_2;
typedef typename Base::Event Event; typedef CGAL::Surface_sweep_2::Surface_sweep_2<Self> Surface_sweep_2;
typedef typename Base::Subcurve Subcurve;
typedef typename Base::Status_line_iterator Status_line_iterator;
typedef CGAL::Surface_sweep_2::Surface_sweep_2<Gt2, Self>
Surface_sweep_2;
protected: protected:
// Data members: // Data members:

View File

@ -13,9 +13,10 @@
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il> // Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
#ifndef CGAL_SURFACE_SWEEP_EMPTY_VISITOR_H #ifndef CGAL_SURFACE_SWEEP_2_VISITOR_H
#define CGAL_SURFACE_SWEEP_EMPTY_VISITOR_H #define CGAL_SURFACE_SWEEP_2_VISITOR_H
#include <CGAL/license/Surface_sweep_2.h> #include <CGAL/license/Surface_sweep_2.h>
@ -31,90 +32,52 @@
namespace CGAL { namespace CGAL {
namespace Surface_sweep_2 { namespace Surface_sweep_2 {
/*! \class /*! \class Visitor_base
* *
* An empty surface-sweep visitor that does nothing. It is used as a base-class * An empty surface-sweep visitor that does nothing. It is used as a base-class
* for other concrete visitors that produce some output. * for other concrete visitors that produce some output.
*/ */
template <typename GeometryTraits_2, template <typename GeometryTraits_2, typename Event_, typename Subcurve_,
typename Event_ = Default_event<GeometryTraits_2>, typename Allocator_, typename Visitor_>
typename Subcurve_ = Default_subcurve<GeometryTraits_2, Event_>, class Visitor_base {
typename Allocator_ = CGAL_ALLOCATOR(int)>
class Surface_sweep_empty_visitor {
public: public:
typedef GeometryTraits_2 Geometry_traits_2; typedef GeometryTraits_2 Geometry_traits_2;
typedef Event_ Event; typedef Event_ Event;
typedef Subcurve_ Subcurve; typedef Subcurve_ Subcurve;
typedef Allocator_ Allocator; typedef Allocator_ Allocator;
typedef Visitor_ Visitor;
private: private:
typedef Geometry_traits_2 Gt2; typedef Geometry_traits_2 Gt2;
typedef Surface_sweep_empty_visitor<Gt2, Event, Subcurve, Allocator> typedef Visitor_base<Gt2, Event, Subcurve, Allocator, Visitor>
Self; Self;
// we want to hide the Surface_sweep type
typedef No_intersection_surface_sweep_2<Gt2, Self, Event, Subcurve, Allocator>
Surface_sweep;
typedef typename Surface_sweep::Status_line_iterator Base_status_line_iter;
public: public:
typedef typename Subcurve::Status_line_iterator Status_line_iterator;
typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Gt2::Point_2 Point_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<reference>
(((Base_status_line_iter*)this)->operator*()));
}
// Overriden operator->
pointer operator->()
{
return (reinterpret_cast<pointer>(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 typedef typename Event::Subcurve_reverse_iterator
Event_subcurve_reverse_iterator; Event_subcurve_reverse_iterator;
typedef No_intersection_surface_sweep_2<Visitor> Surface_sweep_2;
protected: protected:
// Data members: // Data members:
void* m_surface_sweep; // The sweep-line object. Surface_sweep_2* m_surface_sweep; // The sweep-line object.
public: public:
/*! Constructor. */ /*! Constructor. */
Surface_sweep_empty_visitor () : Visitor_base () : m_surface_sweep(NULL) {}
m_surface_sweep(NULL)
{}
/*! Attach the a sweep-line object. */
void attach(void* sl) { m_surface_sweep = sl; }
/*! Destructor */ /*! 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 * A notification invoked before the sweep-line starts handling the given
@ -185,47 +148,52 @@ public:
/*! Obtain the first subcurve in the status line. */ /*! Obtain the first subcurve in the status line. */
Status_line_iterator status_line_begin() 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. */ /*! Obtain a past-the-end iterator for the subcurves in the status line. */
Status_line_iterator status_line_end() Status_line_iterator status_line_end()
{ return (this->_surface_sweep()->status_line_end()); } { return 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()); }
/*! Obtain the number of subcurves in the status line. */ /*! Obtain the number of subcurves in the status line. */
unsigned status_line_size() const 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. */ /*! Check if the status line is empty. */
bool is_status_line_empty() const 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. */ /*! Deallocate the given event. */
void deallocate_event(Event* e) void deallocate_event(Event* e) { surface_sweep()->deallocate_event(e); }
{ this->_surface_sweep()->deallocate_event(e); }
/*! Stop the sweep-line process. */ /*! 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. */ /*! 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. */ /*! 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. */ /*! Obtain the geometry-traits class. */
const Gt2* traits() { return (this->_surface_sweep()->traits()); } const Gt2* traits() { return surface_sweep()->traits(); }
};
private: template <typename Visitor_,
/*! Obtain the sweep-line object. */ typename GeometryTraits_2,
Surface_sweep* _surface_sweep() typename Event_ = Default_event<GeometryTraits_2>,
{ return (reinterpret_cast<Surface_sweep*>(m_surface_sweep)); } typename Subcurve_ = Default_subcurve<GeometryTraits_2, Event_>,
typename Allocator_ = CGAL_ALLOCATOR(int)>
const Surface_sweep* _surface_sweep() const class Default_visitor : public Visitor_base<GeometryTraits_2, Event_, Subcurve_,
{ return (reinterpret_cast<const Surface_sweep*>(m_surface_sweep)); } Allocator_, Visitor_>
{
public:
typedef GeometryTraits_2 Geometry_traits_2;
typedef Event_ Event;
typedef Subcurve_ Subcurve;
typedef Allocator_ Allocator;
}; };
} // namespace Surface_sweep_2 } // namespace Surface_sweep_2

View File

@ -119,14 +119,14 @@ OutputIterator compute_intersection_points(CurveInputIterator curves_begin,
// Define the surface-sweep types: // Define the surface-sweep types:
typedef Ss2::Surface_sweep_points_visitor<Traits, OutputIterator> typedef Ss2::Surface_sweep_points_visitor<Traits, OutputIterator>
Visitor; Visitor;
typedef Ss2::Surface_sweep_2<Traits, Visitor> Surface_sweep; typedef Ss2::Surface_sweep_2<Visitor> Surface_sweep;
// Perform the sweep and obtain the intersection points. // Perform the sweep and obtain the intersection points.
Visitor visitor(points, report_endpoints); Visitor visitor(points, report_endpoints);
Surface_sweep surface_sweep(&tr, &visitor); Surface_sweep surface_sweep(&tr, &visitor);
visitor.sweep(curves_begin, curves_end); visitor.sweep(curves_begin, curves_end);
return (visitor.output_iterator()); return visitor.output_iterator();
} }
template <typename CurveInputIterator, typename OutputIterator> template <typename CurveInputIterator, typename OutputIterator>
@ -139,8 +139,8 @@ OutputIterator compute_intersection_points(CurveInputIterator curves_begin,
typename Default_arr_traits<Curve>::Traits traits; typename Default_arr_traits<Curve>::Traits traits;
return (compute_intersection_points(curves_begin, curves_end, points, return compute_intersection_points(curves_begin, curves_end, points,
report_endpoints, traits)); report_endpoints, traits);
} }
/*! Compute all x-monotone subcurves that are disjoint in their interiors /*! 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: // Define the surface-sweep types:
typedef Ss2::Surface_sweep_subcurves_visitor<Traits, OutputIterator> typedef Ss2::Surface_sweep_subcurves_visitor<Traits, OutputIterator>
Visitor; Visitor;
typedef Ss2::Surface_sweep_2<Traits, Visitor> Surface_sweep; typedef Ss2::Surface_sweep_2<Visitor> Surface_sweep;
// Perform the sweep and obtain the subcurves. // Perform the sweep and obtain the subcurves.
Visitor visitor(subcurves, mult_overlaps); Visitor visitor(subcurves, mult_overlaps);
Surface_sweep surface_sweep(&tr, &visitor); Surface_sweep surface_sweep(&tr, &visitor);
visitor.sweep(curves_begin, curves_end); visitor.sweep(curves_begin, curves_end);
return (visitor.output_iterator()); return visitor.output_iterator();
} }
template <typename CurveInputIterator, typename OutputIterator> template <typename CurveInputIterator, typename OutputIterator>
@ -197,14 +197,13 @@ bool do_curves_intersect(CurveInputIterator curves_begin,
{ {
// Define the surface-sweep types: // Define the surface-sweep types:
typedef Ss2::Surface_sweep_do_curves_x_visitor<Traits> Visitor; typedef Ss2::Surface_sweep_do_curves_x_visitor<Traits> Visitor;
typedef Ss2::Surface_sweep_2<Traits, Visitor> Surface_sweep; typedef Ss2::Surface_sweep_2<Visitor> Surface_sweep;
// Perform the sweep and obtain the subcurves. // Perform the sweep and obtain the subcurves.
Visitor visitor; Visitor visitor;
Surface_sweep surface_sweep(&tr, &visitor); Surface_sweep surface_sweep(&tr, &visitor);
visitor.sweep(curves_begin, curves_end); visitor.sweep(curves_begin, curves_end);
return visitor.found_intersection();
return (visitor.found_intersection());
} }
template <typename CurveInputIterator> template <typename CurveInputIterator>