mirror of https://github.com/CGAL/cgal
Renamed sweep-line to surface-sweep and cleaned up
This commit is contained in:
parent
7e651b6b78
commit
3e6de6b439
|
|
@ -39,7 +39,7 @@ env:
|
|||
- PACKAGE='Stream_support Subdivision_method_3 Surface_mesh '
|
||||
- PACKAGE='Surface_mesh_deformation Surface_mesher Surface_mesh_parameterization '
|
||||
- PACKAGE='Surface_mesh_segmentation Surface_mesh_shortest_path Surface_mesh_simplification '
|
||||
- PACKAGE='Surface_mesh_skeletonization Sweep_line_2 TDS_2 '
|
||||
- PACKAGE='Surface_mesh_skeletonization Surface_sweep_2 TDS_2 '
|
||||
- PACKAGE='TDS_3 Three Triangulation '
|
||||
- PACKAGE='Triangulation_2 Triangulation_3 Union_find '
|
||||
- PACKAGE='Visibility_2 Voronoi_diagram_2 '
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ Surface_mesh_segmentation
|
|||
Surface_mesh_shortest_path
|
||||
Surface_mesh_simplification
|
||||
Surface_mesh_skeletonization
|
||||
Sweep_line_2
|
||||
Surface_sweep_2
|
||||
TDS_2
|
||||
TDS_3
|
||||
Three
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
//! \file examples/Arrangement_on_surface_2/batched_point_location.cpp
|
||||
// Answering a batched point-location query.
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/MP_Float.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Arr_segment_traits_2.h>
|
||||
#include <CGAL/Arrangement_2.h>
|
||||
#include <CGAL/Arr_batched_point_location.h>
|
||||
|
|
@ -10,46 +9,48 @@
|
|||
|
||||
#include "point_location_utils.h"
|
||||
|
||||
typedef CGAL::MP_Float Number_type;
|
||||
typedef CGAL::Cartesian<Number_type> Kernel;
|
||||
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
|
||||
typedef Traits_2::Point_2 Point_2;
|
||||
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
|
||||
typedef CGAL::Arr_point_location_result<Arrangement_2> Point_location_result;
|
||||
typedef std::pair<Point_2, Point_location_result::Type> Query_result;
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef CGAL::Arr_segment_traits_2<Kernel> Traits;
|
||||
typedef Traits::Point_2 Point;
|
||||
typedef CGAL::Arrangement_2<Traits> Arrangement;
|
||||
typedef CGAL::Arr_point_location_result<Arrangement> Point_location_result;
|
||||
typedef std::pair<Point, Point_location_result::Type> Query_result;
|
||||
|
||||
typedef Arrangement_2::Vertex_const_handle Vertex_const_handle;
|
||||
typedef Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef Arrangement_2::Face_const_handle Face_const_handle;
|
||||
typedef Arrangement::Vertex_const_handle Vertex_const_handle;
|
||||
typedef Arrangement::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef Arrangement::Face_const_handle Face_const_handle;
|
||||
|
||||
int main ()
|
||||
int main()
|
||||
{
|
||||
// Construct the arrangement.
|
||||
Arrangement_2 arr;
|
||||
Arrangement arr;
|
||||
construct_segments_arr(arr);
|
||||
|
||||
// Perform a batched point-location query.
|
||||
std::list<Point_2> points;
|
||||
points.push_back(Point_2(1, 4));
|
||||
points.push_back(Point_2(4, 3));
|
||||
points.push_back(Point_2(6, 3));
|
||||
points.push_back(Point_2(3, 2));
|
||||
points.push_back(Point_2(5, 2));
|
||||
points.push_back(Point_2(1, 0));
|
||||
std::list<Query_result> results;
|
||||
std::list<Point> points;
|
||||
points.push_back(Point(1, 4));
|
||||
points.push_back(Point(4, 3));
|
||||
points.push_back(Point(6, 3));
|
||||
points.push_back(Point(3, 2));
|
||||
points.push_back(Point(5, 2));
|
||||
points.push_back(Point(1, 0));
|
||||
std::list<Query_result> results;
|
||||
locate(arr, points.begin(), points.end(), std::back_inserter(results));
|
||||
|
||||
// Print the results.
|
||||
std::list<Query_result>::const_iterator it;
|
||||
for (it = results.begin(); it != results.end(); ++it) {
|
||||
std::cout << "The point (" << it->first << ") is located ";
|
||||
if (const Face_const_handle* f = boost::get<Face_const_handle>(&(it->second))) // inside a face
|
||||
if (const Face_const_handle* f =
|
||||
boost::get<Face_const_handle>(&(it->second))) // inside a face
|
||||
std::cout << "inside "
|
||||
<< (((*f)->is_unbounded()) ? "the unbounded" : "a bounded")
|
||||
<< " face." << std::endl;
|
||||
else if (const Halfedge_const_handle* e = boost::get<Halfedge_const_handle>(&(it->second))) // on an edge
|
||||
else if (const Halfedge_const_handle* e =
|
||||
boost::get<Halfedge_const_handle>(&(it->second))) // on an edge
|
||||
std::cout << "on an edge: " << (*e)->curve() << std::endl;
|
||||
else if (const Vertex_const_handle* v = boost::get<Vertex_const_handle>(&(it->second))) // on a vertex
|
||||
else if (const Vertex_const_handle* v =
|
||||
boost::get<Vertex_const_handle>(&(it->second))) // on a vertex
|
||||
std::cout << "on "
|
||||
<< (((*v)->is_isolated()) ? "an isolated" : "a")
|
||||
<< " vertex: " << (*v)->point() << std::endl;
|
||||
|
|
|
|||
|
|
@ -12,9 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
|
@ -24,9 +21,8 @@
|
|||
|
||||
#include <CGAL/license/Arrangement_on_surface_2.h>
|
||||
|
||||
|
||||
#include <CGAL/Arrangement_on_surface_2.h>
|
||||
#include <CGAL/Basic_sweep_line_2.h>
|
||||
#include <CGAL/No_intersection_surface_sweep_2.h>
|
||||
|
||||
#include <vector>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
|
@ -34,8 +30,7 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
/*!
|
||||
* Issue a batched point-location query on an arrangement given an input
|
||||
/*! Issue a batched point-location query on an arrangement given an input
|
||||
* range of points.
|
||||
* \param arr The arrangement.
|
||||
* \param points_begin An iterator for the range of query points.
|
||||
|
|
@ -60,25 +55,25 @@ locate(const Arrangement_on_surface_2<GeomTraits, TopTraits>& arr,
|
|||
// Arrangement types:
|
||||
typedef Arrangement_on_surface_2<GeomTraits, TopTraits> Arr;
|
||||
typedef typename TopTraits::template
|
||||
Sweep_line_batched_point_location_visitor<OutputIterator>
|
||||
Bpl_visitor;
|
||||
Surface_sweep_batched_point_location_visitor<OutputIterator>
|
||||
Bpl_visitor;
|
||||
|
||||
typedef typename Arr::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef typename Arr::Vertex_const_iterator Vertex_const_iterator;
|
||||
typedef typename Arr::Edge_const_iterator Edge_const_iterator;
|
||||
typedef typename Arr::Vertex_const_handle Vertex_const_handle;
|
||||
typedef typename Arr::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef typename Arr::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef typename Arr::Vertex_const_iterator Vertex_const_iterator;
|
||||
typedef typename Arr::Edge_const_iterator Edge_const_iterator;
|
||||
typedef typename Arr::Vertex_const_handle Vertex_const_handle;
|
||||
typedef typename Arr::Halfedge_const_handle Halfedge_const_handle;
|
||||
|
||||
typedef typename Bpl_visitor::Traits_2 Bpl_traits_2;
|
||||
typedef typename Bpl_traits_2::X_monotone_curve_2 Bpl_x_monotone_curve_2;
|
||||
typedef typename Bpl_traits_2::Point_2 Bpl_point_2;
|
||||
typedef typename Bpl_visitor::Traits_2 Bpl_traits_2;
|
||||
typedef typename Bpl_traits_2::X_monotone_curve_2 Bpl_x_monotone_curve_2;
|
||||
typedef typename Bpl_traits_2::Point_2 Bpl_point_2;
|
||||
|
||||
// Go over all arrangement edges and collect their associated x-monotone
|
||||
// curves. To each curve we attach a halfedge handle going from right to
|
||||
// left.
|
||||
std::vector<Bpl_x_monotone_curve_2> xcurves_vec(arr.number_of_edges());
|
||||
Edge_const_iterator eit;
|
||||
unsigned int i = 0;
|
||||
std::vector<Bpl_x_monotone_curve_2> xcurves_vec(arr.number_of_edges());
|
||||
Edge_const_iterator eit;
|
||||
unsigned int i = 0;
|
||||
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit) {
|
||||
// Associate each x-monotone curve with the halfedge that represent it
|
||||
// that is directed from right to left.
|
||||
|
|
@ -89,8 +84,8 @@ locate(const Arrangement_on_surface_2<GeomTraits, TopTraits>& arr,
|
|||
|
||||
// Go over all isolated vertices and collect their points. To each point
|
||||
// we attach its vertex handle.
|
||||
std::vector<Bpl_point_2> iso_pts_vec(arr.number_of_isolated_vertices());
|
||||
Vertex_const_iterator vit;
|
||||
std::vector<Bpl_point_2> iso_pts_vec(arr.number_of_isolated_vertices());
|
||||
Vertex_const_iterator vit;
|
||||
i = 0;
|
||||
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) {
|
||||
if (vit->is_isolated()) {
|
||||
|
|
@ -119,14 +114,14 @@ locate(const Arrangement_on_surface_2<GeomTraits, TopTraits>& arr,
|
|||
ex_traits(*geom_traits);
|
||||
|
||||
// Define the sweep-line visitor and perform the sweep.
|
||||
Bpl_visitor visitor(&arr, oi);
|
||||
Basic_sweep_line_2<typename Bpl_visitor::Traits_2, Bpl_visitor,
|
||||
typename Bpl_visitor::Subcurve,
|
||||
typename Bpl_visitor::Event>
|
||||
sweep_line(&ex_traits, &visitor);
|
||||
sweep_line.sweep(xcurves_vec.begin(), xcurves_vec.end(), // Curves.
|
||||
iso_pts_vec.begin(), iso_pts_vec.end(), // Action points.
|
||||
points_begin, points_end); // Query points.
|
||||
Bpl_visitor visitor(&arr, oi);
|
||||
No_intersection_surface_sweep_2<typename Bpl_visitor::Traits_2, Bpl_visitor,
|
||||
typename Bpl_visitor::Subcurve,
|
||||
typename Bpl_visitor::Event>
|
||||
surface_sweep(&ex_traits, &visitor);
|
||||
surface_sweep.sweep(xcurves_vec.begin(), xcurves_vec.end(), // Curves.
|
||||
iso_pts_vec.begin(), iso_pts_vec.end(), // Action points.
|
||||
points_begin, points_end); // Query points.
|
||||
|
||||
return oi;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
// Eric Berberich <ericb@post.tau.ac.il>
|
||||
|
|
@ -25,7 +21,6 @@
|
|||
|
||||
#include <CGAL/license/Arrangement_on_surface_2.h>
|
||||
|
||||
|
||||
/*! \file
|
||||
* Definition of the Arr_bounded_planar_topology_traits_2<GeomTraits> class.
|
||||
*/
|
||||
|
|
@ -39,6 +34,7 @@
|
|||
#include <CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h>
|
||||
#include <CGAL/Arr_topology_traits/Arr_inc_insertion_zone_visitor.h>
|
||||
#include <CGAL/use.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
// Forward declaration:
|
||||
|
|
@ -264,19 +260,19 @@ public:
|
|||
//@{
|
||||
|
||||
typedef Arr_construction_sl_visitor<CHelper>
|
||||
Sweep_line_construction_visitor;
|
||||
Surface_sweep_construction_visitor;
|
||||
|
||||
typedef Arr_insertion_sl_visitor<IHelper>
|
||||
Sweep_line_insertion_visitor;
|
||||
Surface_sweep_insertion_visitor;
|
||||
|
||||
typedef Sweep_line_construction_visitor
|
||||
Sweep_line_non_intersecting_construction_visitor;
|
||||
typedef Surface_sweep_construction_visitor
|
||||
Surface_sweep_non_intersecting_construction_visitor;
|
||||
|
||||
typedef Arr_basic_insertion_sl_visitor<BIHelper>
|
||||
Sweep_line_non_intersecting_insertion_visitor;
|
||||
Surface_sweep_non_intersecting_insertion_visitor;
|
||||
|
||||
template <class OutputIterator_>
|
||||
struct Sweep_line_batched_point_location_visitor :
|
||||
struct Surface_sweep_batched_point_location_visitor :
|
||||
public Arr_batched_pl_sl_visitor<BplHelper, OutputIterator_>
|
||||
{
|
||||
typedef OutputIterator_ Output_iterator;
|
||||
|
|
@ -286,14 +282,14 @@ public:
|
|||
typedef typename Base::Event Event;
|
||||
typedef typename Base::Subcurve Subcurve;
|
||||
|
||||
Sweep_line_batched_point_location_visitor(const Arr* arr,
|
||||
Surface_sweep_batched_point_location_visitor(const Arr* arr,
|
||||
Output_iterator& oi) :
|
||||
Base(arr, oi)
|
||||
{}
|
||||
};
|
||||
|
||||
template <class OutputIterator_>
|
||||
struct Sweep_line_vertical_decomposition_visitor :
|
||||
struct Surface_sweep_vertical_decomposition_visitor :
|
||||
public Arr_vert_decomp_sl_visitor<VdHelper, OutputIterator_>
|
||||
{
|
||||
typedef OutputIterator_ Output_iterator;
|
||||
|
|
@ -303,14 +299,14 @@ public:
|
|||
typedef typename Base::Event Event;
|
||||
typedef typename Base::Subcurve Subcurve;
|
||||
|
||||
Sweep_line_vertical_decomposition_visitor(const Arr* arr,
|
||||
Surface_sweep_vertical_decomposition_visitor(const Arr* arr,
|
||||
Output_iterator* oi) :
|
||||
Base(arr, oi)
|
||||
{}
|
||||
};
|
||||
|
||||
template <class ArrangementA_, class ArrangementB_, class OverlayTraits_>
|
||||
struct Sweep_line_overlay_visitor :
|
||||
struct Surface_sweep_overlay_visitor :
|
||||
public Arr_overlay_sl_visitor <
|
||||
_Overlay_helper<
|
||||
Arr_overlay_traits_2< Arr_traits_basic_adaptor_2<Geometry_traits_2>,
|
||||
|
|
@ -340,10 +336,10 @@ public:
|
|||
typedef typename Base::Event Event;
|
||||
typedef typename Base::Subcurve Subcurve;
|
||||
|
||||
Sweep_line_overlay_visitor (const ArrangementA_2* arrA,
|
||||
const ArrangementB_2* arrB,
|
||||
Arrangement_result_2* arr_res,
|
||||
Overlay_traits* overlay_tr) :
|
||||
Surface_sweep_overlay_visitor(const ArrangementA_2* arrA,
|
||||
const ArrangementB_2* arrB,
|
||||
Arrangement_result_2* arr_res,
|
||||
Overlay_traits* overlay_tr) :
|
||||
Base (arrA, arrB, arr_res, overlay_tr)
|
||||
{}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Ron Wein <wein@post.tau.ac.il>
|
||||
// Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
|
||||
|
|
@ -31,7 +27,7 @@
|
|||
|
||||
#include <CGAL/Arr_default_dcel.h>
|
||||
#include <CGAL/Arr_extended_dcel.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_default_overlay_traits_base.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_default_overlay_traits_base.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
||||
|
|
@ -32,8 +28,8 @@
|
|||
#include <boost/optional/optional.hpp>
|
||||
|
||||
#include <CGAL/Arrangement_on_surface_2.h>
|
||||
#include <CGAL/Sweep_line_2.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_default_overlay_traits_base.h>
|
||||
#include <CGAL/Surface_sweep_2.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_default_overlay_traits_base.h>
|
||||
|
||||
#include <vector>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
|
@ -92,7 +88,7 @@ void overlay(const Arrangement_on_surface_2<GeomTraitsA, TopTraitsA>& arr1,
|
|||
typename GeomTraitsRes::X_monotone_curve_2>::value));
|
||||
|
||||
typedef typename TopTraitsRes::template
|
||||
Sweep_line_overlay_visitor<ArrA, ArrB, OverlayTraits>
|
||||
Surface_sweep_overlay_visitor<ArrA, ArrB, OverlayTraits>
|
||||
Ovl_visitor;
|
||||
|
||||
typedef typename Ovl_visitor::Traits_2 Ovl_traits_2;
|
||||
|
|
@ -156,7 +152,7 @@ void overlay(const Arrangement_on_surface_2<GeomTraitsA, TopTraitsA>& arr1,
|
|||
ex_traits(*traits_adaptor);
|
||||
|
||||
Ovl_visitor visitor(&arr1, &arr2, &arr_res, &ovl_tr);
|
||||
Sweep_line_2<Ovl_traits_2, Ovl_visitor,
|
||||
Surface_sweep_2<Ovl_traits_2, Ovl_visitor,
|
||||
typename Ovl_visitor::Subcurve, typename Ovl_visitor::Event>
|
||||
sweep_line(&ex_traits, &visitor);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,9 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// Author(s) : Efi Fogel <efif@post.tau.ac.il>
|
||||
// Eric Berberich <ericb@post.tau.ac.il>
|
||||
|
||||
|
|
@ -34,18 +31,18 @@
|
|||
#include <CGAL/Arr_default_dcel.h>
|
||||
#include <CGAL/Arr_naive_point_location.h>
|
||||
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_construction_event.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_construction_subcurve.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_construction_sl_visitor.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_basic_insertion_sl_visitor.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_insertion_traits_2.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_insertion_sl_visitor.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_overlay_subcurve.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_overlay_traits_2.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_overlay_sl_visitor.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_vert_decomp_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_construction_event.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_construction_subcurve.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_basic_insertion_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_insertion_traits_2.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_insertion_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_overlay_subcurve.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_overlay_traits_2.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_overlay_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_batched_pl_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_vert_decomp_sl_visitor.h>
|
||||
#include <CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h>
|
||||
|
||||
#include <CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h>
|
||||
|
|
@ -387,19 +384,19 @@ public:
|
|||
//@{
|
||||
|
||||
typedef Arr_construction_sl_visitor<CHelper>
|
||||
Sweep_line_construction_visitor;
|
||||
Surface_sweep_construction_visitor;
|
||||
|
||||
typedef Arr_insertion_sl_visitor<IHelper>
|
||||
Sweep_line_insertion_visitor;
|
||||
Surface_sweep_insertion_visitor;
|
||||
|
||||
typedef Sweep_line_construction_visitor
|
||||
Sweep_line_non_intersecting_construction_visitor;
|
||||
typedef Surface_sweep_construction_visitor
|
||||
Surface_sweep_non_intersecting_construction_visitor;
|
||||
|
||||
typedef Arr_basic_insertion_sl_visitor<BIHelper>
|
||||
Sweep_line_non_intersecting_insertion_visitor;
|
||||
Surface_sweep_non_intersecting_insertion_visitor;
|
||||
|
||||
template <typename OutputIterator_>
|
||||
struct Sweep_line_batched_point_location_visitor :
|
||||
struct Surface_sweep_batched_point_location_visitor :
|
||||
public Arr_batched_pl_sl_visitor<BplHelper, OutputIterator_>
|
||||
{
|
||||
typedef OutputIterator_ Output_iterator;
|
||||
|
|
@ -409,14 +406,14 @@ public:
|
|||
typedef typename Base::Event Event;
|
||||
typedef typename Base::Subcurve Subcurve;
|
||||
|
||||
Sweep_line_batched_point_location_visitor(const Arr* arr,
|
||||
Surface_sweep_batched_point_location_visitor(const Arr* arr,
|
||||
Output_iterator& oi) :
|
||||
Base(arr, oi)
|
||||
{}
|
||||
};
|
||||
|
||||
template <typename OutputIterator_>
|
||||
struct Sweep_line_vertical_decomposition_visitor :
|
||||
struct Surface_sweep_vertical_decomposition_visitor :
|
||||
public Arr_vert_decomp_sl_visitor<VdHelper, OutputIterator_>
|
||||
{
|
||||
typedef OutputIterator_ Output_iterator;
|
||||
|
|
@ -426,7 +423,7 @@ public:
|
|||
typedef typename Base::Event Event;
|
||||
typedef typename Base::Subcurve Subcurve;
|
||||
|
||||
Sweep_line_vertical_decomposition_visitor(const Arr* arr,
|
||||
Surface_sweep_vertical_decomposition_visitor(const Arr* arr,
|
||||
Output_iterator* oi) :
|
||||
Base(arr, oi)
|
||||
{}
|
||||
|
|
@ -434,7 +431,7 @@ public:
|
|||
|
||||
template <typename ArrangementA_, typename ArrangementB_,
|
||||
typename OverlayTraits_>
|
||||
struct Sweep_line_overlay_visitor :
|
||||
struct Surface_sweep_overlay_visitor :
|
||||
public Arr_overlay_sl_visitor
|
||||
<_Overlay_helper<Arr_overlay_traits_2<Geometry_traits_2,ArrangementA_,
|
||||
ArrangementB_>,
|
||||
|
|
@ -458,10 +455,10 @@ public:
|
|||
typedef typename Base::Event Event;
|
||||
typedef typename Base::Subcurve Subcurve;
|
||||
|
||||
Sweep_line_overlay_visitor(const Arrangement_a* arr_a,
|
||||
const Arrangement_b* arr_b,
|
||||
Arrangement_result_2* arr_res,
|
||||
Overlay_traits* overlay_tr) :
|
||||
Surface_sweep_overlay_visitor(const Arrangement_a* arr_a,
|
||||
const Arrangement_b* arr_b,
|
||||
Arrangement_result_2* arr_res,
|
||||
Overlay_traits* overlay_tr) :
|
||||
Base(arr_a, arr_b, arr_res, overlay_tr)
|
||||
{}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
|
||||
|
|
@ -24,77 +20,64 @@
|
|||
|
||||
#include <CGAL/license/Arrangement_on_surface_2.h>
|
||||
|
||||
|
||||
/*!
|
||||
* Definition of the Arr_bounded_planar_batched_pl_helper class-template.
|
||||
*/
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
#include <CGAL/Sweep_line_empty_visitor.h>
|
||||
#include <CGAL/Surface_sweep_empty_visitor.h>
|
||||
|
||||
/*! \class Arr_bounded_planar_batched_pl_helper
|
||||
* A helper class for the batched point-location sweep-line visitor, suitable
|
||||
* A helper class for the batched point-location surface-sweep visitor, suitable
|
||||
* for an Arrangement_on_surface_2 instantiated with a topology-traits class
|
||||
* for bounded curves in the plane.
|
||||
*/
|
||||
template <class Traits_, class Arrangement_>
|
||||
class Arr_bounded_planar_batched_pl_helper
|
||||
{
|
||||
template <typename Traits_, typename Arrangement_>
|
||||
class Arr_bounded_planar_batched_pl_helper {
|
||||
public:
|
||||
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Arrangement_ Arrangement_2;
|
||||
|
||||
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
|
||||
|
||||
typedef Sweep_line_empty_visitor<Traits_2> Base_visitor;
|
||||
typedef Surface_sweep_empty_visitor<Traits_2> Base_visitor;
|
||||
typedef typename Base_visitor::Event Event;
|
||||
typedef typename Base_visitor::Subcurve Subcurve;
|
||||
|
||||
protected:
|
||||
|
||||
typedef typename Arrangement_2::Topology_traits Topology_traits;
|
||||
|
||||
// Data members:
|
||||
const Topology_traits *m_top_traits; // The topology-traits class.
|
||||
Face_const_handle m_unb_face; // The unbounded arrangement face.
|
||||
const Topology_traits* m_top_traits; // The topology-traits class.
|
||||
Face_const_handle m_unb_face; // The unbounded arrangement face.
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* Constructor.
|
||||
/*! Constructor.
|
||||
* \param arr The arrangement.
|
||||
*/
|
||||
Arr_bounded_planar_batched_pl_helper (const Arrangement_2 *arr) :
|
||||
m_top_traits (arr->topology_traits())
|
||||
Arr_bounded_planar_batched_pl_helper(const Arrangement_2* arr) :
|
||||
m_top_traits(arr->topology_traits())
|
||||
{}
|
||||
|
||||
/// \name Notification functions.
|
||||
//@{
|
||||
|
||||
/* A notification issued before the sweep process starts. */
|
||||
void before_sweep ()
|
||||
void before_sweep()
|
||||
{
|
||||
// Get the unbounded face.
|
||||
m_unb_face = Face_const_handle (m_top_traits->unbounded_face());
|
||||
m_unb_face = Face_const_handle(m_top_traits->unbounded_face());
|
||||
}
|
||||
|
||||
/*!
|
||||
* A notification invoked after the sweep-line finishes handling the given
|
||||
/*! A notification invoked after the sweep-line finishes handling the given
|
||||
* event.
|
||||
*/
|
||||
void after_handle_event (Event* /* event */)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void after_handle_event(Event* /* event */) { return; }
|
||||
//@}
|
||||
|
||||
/*! Get the current top face. */
|
||||
Face_const_handle top_face () const
|
||||
{
|
||||
return (m_unb_face);
|
||||
}
|
||||
Face_const_handle top_face() const { return (m_unb_face); }
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
|
||||
|
|
@ -24,12 +20,11 @@
|
|||
|
||||
#include <CGAL/license/Arrangement_on_surface_2.h>
|
||||
|
||||
|
||||
/*!
|
||||
* Definition of the Arr_bounded_planar_construction_helper class-template.
|
||||
*/
|
||||
|
||||
#include <CGAL/Sweep_line_empty_visitor.h>
|
||||
#include <CGAL/Surface_sweep_empty_visitor.h>
|
||||
#include <CGAL/Unique_hash_map.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -39,11 +34,10 @@ namespace CGAL {
|
|||
* for an Arrangement_on_surface_2 instantiated with a topology-traits class
|
||||
* for bounded curves in the plane.
|
||||
*/
|
||||
template <class Traits_, class Arrangement_, class Event_, class Subcurve_>
|
||||
class Arr_bounded_planar_construction_helper
|
||||
{
|
||||
template <typename Traits_, typename Arrangement_, typename Event_,
|
||||
typename Subcurve_>
|
||||
class Arr_bounded_planar_construction_helper {
|
||||
public:
|
||||
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Arrangement_ Arrangement_2;
|
||||
typedef Event_ Event;
|
||||
|
|
@ -52,9 +46,8 @@ public:
|
|||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Traits_2::Point_2 Point_2;
|
||||
|
||||
typedef Sweep_line_empty_visitor<Traits_2,
|
||||
Subcurve,
|
||||
Event> Base_visitor;
|
||||
typedef Surface_sweep_empty_visitor<Traits_2, Subcurve, Event>
|
||||
Base_visitor;
|
||||
|
||||
typedef typename Arrangement_2::Face_handle Face_handle;
|
||||
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
|
||||
|
|
@ -64,20 +57,18 @@ public:
|
|||
Indices_list> Halfedge_indices_map;
|
||||
|
||||
protected:
|
||||
|
||||
typedef typename Arrangement_2::Topology_traits Topology_traits;
|
||||
|
||||
// Data members:
|
||||
Topology_traits *m_top_traits; // The topology-traits class.
|
||||
Face_handle m_unb_face; // The unbounded arrangement face.
|
||||
Topology_traits* m_top_traits; // The topology-traits class.
|
||||
Face_handle m_unb_face; // The unbounded arrangement face.
|
||||
|
||||
Indices_list m_emptylist;
|
||||
|
||||
public:
|
||||
|
||||
/*! Constructor. */
|
||||
Arr_bounded_planar_construction_helper (Arrangement_2 *arr) :
|
||||
m_top_traits (arr->topology_traits())
|
||||
Arr_bounded_planar_construction_helper(Arrangement_2* arr) :
|
||||
m_top_traits(arr->topology_traits())
|
||||
{}
|
||||
|
||||
/*! Destructor. */
|
||||
|
|
@ -88,69 +79,48 @@ public:
|
|||
//@{
|
||||
|
||||
/* A notification issued before the sweep process starts. */
|
||||
virtual void before_sweep ()
|
||||
virtual void before_sweep()
|
||||
{
|
||||
// Get the unbounded face.
|
||||
m_unb_face = Face_handle (m_top_traits->unbounded_face());
|
||||
m_unb_face = Face_handle(m_top_traits->unbounded_face());
|
||||
}
|
||||
|
||||
/*!
|
||||
* A notification invoked before the sweep-line starts handling the given
|
||||
/*! A notification invoked before the sweep-line starts handling the given
|
||||
* event.
|
||||
*/
|
||||
virtual void before_handle_event (Event* /* event */)
|
||||
{
|
||||
return;
|
||||
}
|
||||
virtual void before_handle_event(Event* /* event */) { return; }
|
||||
|
||||
/*! A notification invoked when a new subcurve is created. */
|
||||
virtual void add_subcurve (Halfedge_handle /* he */, Subcurve* /* sc */)
|
||||
{
|
||||
return;
|
||||
}
|
||||
virtual void add_subcurve(Halfedge_handle /* he */, Subcurve* /* sc */)
|
||||
{ return; }
|
||||
|
||||
Indices_list& halfedge_indices_list() {
|
||||
return m_emptylist;
|
||||
}
|
||||
Indices_list& halfedge_indices_list() { return m_emptylist; }
|
||||
|
||||
/*! Collect a subcurve index that does not see any status-line from below. */
|
||||
void add_subcurve_in_top_face (unsigned int /* index */)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void add_subcurve_in_top_face(unsigned int /* index */) { return; }
|
||||
|
||||
/*! A notification invoked before the given event it deallocated. */
|
||||
void before_deallocate_event (Event* /* event */)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void before_deallocate_event(Event* /* event */) { return; }
|
||||
//@}
|
||||
|
||||
/*!
|
||||
* Set the map that maps each halfedge to the list of subcurve indices
|
||||
/*! Set the map that maps each halfedge to the list of subcurve indices
|
||||
* that "see" the halfedge from below.
|
||||
*/
|
||||
void set_halfedge_indices_map (Halfedge_indices_map& /* table */)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void set_halfedge_indices_map(Halfedge_indices_map& /* table */)
|
||||
{ return; }
|
||||
|
||||
/*!
|
||||
* Determine if we should swap the order of predecessor halfedges when
|
||||
/*! Determine if we should swap the order of predecessor halfedges when
|
||||
* calling insert_at_vertices_ex() .
|
||||
*/
|
||||
bool swap_predecessors (Event* /* event */) const
|
||||
bool swap_predecessors(Event* /* event */) const
|
||||
{
|
||||
// In the bounded case the order of the predecessor is always correct
|
||||
// and there is no need to swap them.
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*! Get the current top face. */
|
||||
Face_handle top_face () const
|
||||
{
|
||||
return (m_unb_face);
|
||||
}
|
||||
Face_handle top_face() const { return m_unb_face; }
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
|
||||
|
|
@ -29,7 +25,7 @@
|
|||
* Definition of the Arr_bounded_planar_insertion_helper class-template.
|
||||
*/
|
||||
|
||||
#include <CGAL/Sweep_line_2/Arr_construction_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h>
|
||||
#include <CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -46,34 +42,30 @@ class Arr_bounded_planar_insertion_helper :
|
|||
{
|
||||
public:
|
||||
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Arrangement_ Arrangement_2;
|
||||
typedef Event_ Event;
|
||||
typedef Subcurve_ Subcurve;
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Arrangement_ Arrangement_2;
|
||||
typedef Event_ Event;
|
||||
typedef Subcurve_ Subcurve;
|
||||
|
||||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Traits_2::Point_2 Point_2;
|
||||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Traits_2::Point_2 Point_2;
|
||||
|
||||
typedef Arr_bounded_planar_construction_helper<Traits_2,
|
||||
Arrangement_2,
|
||||
Event,
|
||||
Subcurve> Base;
|
||||
typedef Arr_bounded_planar_construction_helper<Traits_2, Arrangement_2,
|
||||
Event, Subcurve>
|
||||
Base;
|
||||
|
||||
typedef Sweep_line_empty_visitor<Traits_2,
|
||||
Subcurve,
|
||||
Event> Base_visitor;
|
||||
typedef Surface_sweep_empty_visitor<Traits_2, Subcurve, Event>
|
||||
Base_visitor;
|
||||
|
||||
typedef Arr_bounded_planar_insertion_helper<Traits_2,
|
||||
Arrangement_2,
|
||||
Event,
|
||||
Subcurve> Self;
|
||||
typedef Arr_bounded_planar_insertion_helper<Traits_2, Arrangement_2, Event,
|
||||
Subcurve> Self;
|
||||
|
||||
typedef Arr_construction_sl_visitor<Self> Parent_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::Halfedge_indices_map Halfedge_indices_map;
|
||||
typedef typename Base::Indices_list Indices_list;
|
||||
typedef typename Base::Halfedge_indices_map Halfedge_indices_map;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Ron Wein <wein@post.tau.ac.il>
|
||||
|
||||
#ifndef CGAL_ARR_BOUNDED_PLANAR_VERT_DEOCMP_HELPER_H
|
||||
|
|
@ -23,86 +19,75 @@
|
|||
|
||||
#include <CGAL/license/Arrangement_on_surface_2.h>
|
||||
|
||||
|
||||
/*! \file
|
||||
* Definition of the Arr_bounded_planar_vert_decomp_helper class-template.
|
||||
*/
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
#include <CGAL/Sweep_line_empty_visitor.h>
|
||||
#include <CGAL/Surface_sweep_empty_visitor.h>
|
||||
|
||||
/*! \class Arr_bounded_planar_vert_decomp_helper
|
||||
* A helper class for the vertical decomposition sweep-line visitor, suitable
|
||||
* for an Arrangement_on_surface_2 instantiated with a topology-traits class
|
||||
* for bounded curves in the plane.
|
||||
*/
|
||||
template <class Traits_, class Arrangement_>
|
||||
class Arr_bounded_planar_vert_decomp_helper
|
||||
{
|
||||
template <typename Traits_, typename Arrangement_>
|
||||
class Arr_bounded_planar_vert_decomp_helper {
|
||||
public:
|
||||
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Arrangement_ Arrangement_2;
|
||||
|
||||
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
|
||||
|
||||
typedef Sweep_line_empty_visitor<Traits_2> Base_visitor;
|
||||
typedef Surface_sweep_empty_visitor<Traits_2> Base_visitor;
|
||||
typedef typename Base_visitor::Event Event;
|
||||
typedef typename Base_visitor::Subcurve Subcurve;
|
||||
|
||||
protected:
|
||||
|
||||
typedef typename Arrangement_2::Topology_traits Topology_traits;
|
||||
|
||||
// Data members:
|
||||
const Topology_traits *m_top_traits; // The topology-traits class.
|
||||
Face_const_handle m_unb_face; // The unbounded arrangement face.
|
||||
const Topology_traits* m_top_traits; // The topology-traits class.
|
||||
Face_const_handle m_unb_face; // The unbounded arrangement face.
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* Constructor.
|
||||
/*! Constructor.
|
||||
* \param arr The arrangement.
|
||||
*/
|
||||
Arr_bounded_planar_vert_decomp_helper (const Arrangement_2 *arr) :
|
||||
m_top_traits (arr->topology_traits())
|
||||
Arr_bounded_planar_vert_decomp_helper(const Arrangement_2* arr) :
|
||||
m_top_traits(arr->topology_traits())
|
||||
{}
|
||||
|
||||
/// \name Notification functions.
|
||||
//@{
|
||||
|
||||
/* A notification issued before the sweep process starts. */
|
||||
void before_sweep ()
|
||||
void before_sweep()
|
||||
{
|
||||
// Get the unbounded face.
|
||||
m_unb_face = Face_const_handle (m_top_traits->unbounded_face());
|
||||
m_unb_face = Face_const_handle(m_top_traits->unbounded_face());
|
||||
}
|
||||
|
||||
/*!
|
||||
* A notification invoked after the sweep-line finishes handling the given
|
||||
/*! A notification invoked after the sweep-line finishes handling the given
|
||||
* event.
|
||||
*/
|
||||
void after_handle_event (Event* /* event */)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void after_handle_event(Event* /* event */) { return; }
|
||||
//@}
|
||||
|
||||
/*! Get the current top object. */
|
||||
CGAL::Object top_object () const
|
||||
CGAL::Object top_object() const
|
||||
{
|
||||
// Wrap the unbounded face by a CGAL object.
|
||||
return (CGAL::make_object (m_unb_face));
|
||||
return (CGAL::make_object(m_unb_face));
|
||||
}
|
||||
|
||||
/*! Get the current bottom object. */
|
||||
CGAL::Object bottom_object () const
|
||||
CGAL::Object bottom_object() const
|
||||
{
|
||||
// Wrap the unbounded face by a CGAL object.
|
||||
return (CGAL::make_object (m_unb_face));
|
||||
return (CGAL::make_object(m_unb_face));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
||||
|
|
@ -33,18 +29,18 @@
|
|||
#include <CGAL/Arr_default_dcel.h>
|
||||
#include <CGAL/Arr_walk_along_line_point_location.h>
|
||||
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_construction_event.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_construction_subcurve.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_construction_sl_visitor.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_basic_insertion_sl_visitor.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_insertion_traits_2.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_insertion_sl_visitor.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_overlay_subcurve.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_overlay_traits_2.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_overlay_sl_visitor.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_vert_decomp_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_construction_event.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_construction_subcurve.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_basic_insertion_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_insertion_traits_2.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_insertion_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_overlay_subcurve.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_overlay_traits_2.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_overlay_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_batched_pl_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_vert_decomp_sl_visitor.h>
|
||||
#include <CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
|
|||
|
|
@ -12,9 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
|
@ -32,30 +29,27 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
#include <CGAL/Sweep_line_empty_visitor.h>
|
||||
#include <CGAL/Surface_sweep_empty_visitor.h>
|
||||
|
||||
/*! \class Arr_spherical_batched_pl_helper
|
||||
* A helper class for the batched point-location sweep-line visitor, suitable
|
||||
* for an Arrangement_on_surface_2 instantiated with a topology-traits class
|
||||
* for bounded curves in the plane.
|
||||
*/
|
||||
template <class Traits_, class Arrangement_>
|
||||
class Arr_spherical_batched_pl_helper
|
||||
{
|
||||
template <typename Traits_, typename Arrangement_>
|
||||
class Arr_spherical_batched_pl_helper {
|
||||
public:
|
||||
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Arrangement_ Arrangement_2;
|
||||
|
||||
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
|
||||
|
||||
typedef Sweep_line_empty_visitor<Traits_2> Base_visitor;
|
||||
typedef Surface_sweep_empty_visitor<Traits_2> Base_visitor;
|
||||
typedef typename Base_visitor::Event Event;
|
||||
typedef typename Base_visitor::Subcurve Subcurve;
|
||||
typedef typename Event::Subcurve_iterator Subcurve_iterator;
|
||||
|
||||
protected:
|
||||
|
||||
typedef typename Arrangement_2::Topology_traits Topology_traits;
|
||||
|
||||
// Data members:
|
||||
|
|
@ -93,7 +87,8 @@ public:
|
|||
if (ind == ARR_MIN_END) {
|
||||
it = nit = event->right_curves_begin();
|
||||
it_end = event->right_curves_end();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
it = nit = event->left_curves_begin();
|
||||
it_end = event->left_curves_end();
|
||||
}
|
||||
|
|
@ -125,7 +120,8 @@ public:
|
|||
}
|
||||
const Subcurve* sc = *it;
|
||||
// pick the one facing the top right corner now
|
||||
CGAL_assertion(sc->last_curve().halfedge_handle()->direction() == ARR_LEFT_TO_RIGHT);
|
||||
CGAL_assertion(sc->last_curve().halfedge_handle()->direction() ==
|
||||
ARR_LEFT_TO_RIGHT);
|
||||
m_spherical_face = sc->last_curve().halfedge_handle()->face();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
||||
|
|
@ -29,7 +25,7 @@
|
|||
* Definition of the Arr_spherical_construction_helper class-template.
|
||||
*/
|
||||
|
||||
#include <CGAL/Sweep_line_empty_visitor.h>
|
||||
#include <CGAL/Surface_sweep_empty_visitor.h>
|
||||
#include <CGAL/Unique_hash_map.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -51,7 +47,7 @@ public:
|
|||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Traits_2::Point_2 Point_2;
|
||||
|
||||
typedef Sweep_line_empty_visitor<Traits_2, Subcurve, Event>
|
||||
typedef Surface_sweep_empty_visitor<Traits_2, Subcurve, Event>
|
||||
Base_visitor;
|
||||
|
||||
typedef typename Arrangement_2::Vertex_handle Vertex_handle;
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
||||
|
|
@ -29,7 +25,7 @@
|
|||
* Definition of the Arr_spherical_insertion_helper class-template.
|
||||
*/
|
||||
|
||||
#include <CGAL/Sweep_line_2/Arr_construction_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h>
|
||||
#include <CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -57,7 +53,7 @@ public:
|
|||
typedef Arr_spherical_construction_helper<Traits_2, Arrangement_2, Event,
|
||||
Subcurve> Base;
|
||||
|
||||
typedef Sweep_line_empty_visitor<Traits_2, Subcurve, Event>
|
||||
typedef Surface_sweep_empty_visitor<Traits_2, Subcurve, Event>
|
||||
Base_visitor;
|
||||
|
||||
typedef Arr_spherical_insertion_helper<Traits_2, Arrangement_2, Event,
|
||||
|
|
|
|||
|
|
@ -12,9 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// Author(s) : Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
//
|
||||
|
|
@ -24,25 +21,22 @@
|
|||
|
||||
#include <CGAL/license/Arrangement_on_surface_2.h>
|
||||
|
||||
|
||||
/*! \file
|
||||
* Definition of the Arr_spherical_vert_decomp_helper class-template.
|
||||
*/
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
#include <CGAL/Sweep_line_empty_visitor.h>
|
||||
#include <CGAL/Surface_sweep_empty_visitor.h>
|
||||
|
||||
/*! \class Arr_spherical_vert_decomp_helper
|
||||
* A helper class for the vertical decomposition sweep-line visitor, suitable
|
||||
* for an Arrangement_on_surface_2 instantiated with a topology-traits class
|
||||
* for bounded curves in the plane.
|
||||
*/
|
||||
template <class Traits_, class Arrangement_>
|
||||
class Arr_spherical_vert_decomp_helper
|
||||
{
|
||||
template <typename Traits_, typename Arrangement_>
|
||||
class Arr_spherical_vert_decomp_helper {
|
||||
public:
|
||||
|
||||
typedef Traits_ Traits_2;
|
||||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef Arrangement_ Arrangement_2;
|
||||
|
|
@ -50,28 +44,26 @@ public:
|
|||
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
|
||||
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
|
||||
|
||||
typedef Sweep_line_empty_visitor<Traits_2> Base_visitor;
|
||||
typedef Surface_sweep_empty_visitor<Traits_2> Base_visitor;
|
||||
typedef typename Base_visitor::Event Event;
|
||||
typedef typename Base_visitor::Subcurve Subcurve;
|
||||
|
||||
protected:
|
||||
|
||||
typedef typename Arrangement_2::Topology_traits Topology_traits;
|
||||
|
||||
const Topology_traits *m_top_traits; // The topology traits.
|
||||
Vertex_const_handle m_north_pole; // The north pole.
|
||||
bool m_valid_north_pole; // Is this a valid vertex.
|
||||
Face_const_handle m_north_face; // Current north face.
|
||||
Vertex_const_handle m_south_pole; // The south pole.
|
||||
bool m_valid_south_pole; // Is this a valid vertex.
|
||||
Face_const_handle m_south_face; // Current south face.
|
||||
const Topology_traits* m_top_traits; // The topology traits.
|
||||
Vertex_const_handle m_north_pole; // The north pole.
|
||||
bool m_valid_north_pole; // Is this a valid vertex.
|
||||
Face_const_handle m_north_face; // Current north face.
|
||||
Vertex_const_handle m_south_pole; // The south pole.
|
||||
bool m_valid_south_pole; // Is this a valid vertex.
|
||||
Face_const_handle m_south_face; // Current south face.
|
||||
|
||||
public:
|
||||
|
||||
/*! Constructor.
|
||||
* \param arr The arrangement.
|
||||
*/
|
||||
Arr_spherical_vert_decomp_helper(const Arrangement_2 *arr) :
|
||||
Arr_spherical_vert_decomp_helper(const Arrangement_2* arr) :
|
||||
m_top_traits(arr->topology_traits())
|
||||
{}
|
||||
|
||||
|
|
@ -110,7 +102,7 @@ public:
|
|||
//-----------------------------------------------------------------------------
|
||||
// A notification issued before the sweep process starts.
|
||||
//
|
||||
template <class Tr, class Arr>
|
||||
template <typename Tr, typename Arr>
|
||||
void Arr_spherical_vert_decomp_helper<Tr, Arr>::before_sweep()
|
||||
{
|
||||
// Get the north pole and the face that intially contains it.
|
||||
|
|
@ -132,13 +124,12 @@ void Arr_spherical_vert_decomp_helper<Tr, Arr>::before_sweep()
|
|||
// A notification invoked after the sweep-line finishes handling the given
|
||||
// event.
|
||||
///
|
||||
template <class Tr, class Arr>
|
||||
template <typename Tr, typename Arr>
|
||||
void
|
||||
Arr_spherical_vert_decomp_helper<Tr, Arr>::after_handle_event (Event *event)
|
||||
{
|
||||
// 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;
|
||||
|
||||
// The is exactly one curve incident to an event with boundary conditions.
|
||||
// Obtain this curve and check whether it already exists in the arrangement.
|
||||
|
|
@ -147,31 +138,25 @@ Arr_spherical_vert_decomp_helper<Tr, Arr>::after_handle_event (Event *event)
|
|||
((event->number_of_left_curves() == 1) &&
|
||||
(event->number_of_right_curves() == 0)));
|
||||
|
||||
const Arr_curve_end ind =
|
||||
const Arr_curve_end ind =
|
||||
(event->number_of_left_curves() == 0 &&
|
||||
event->number_of_right_curves() == 1) ? ARR_MIN_END : ARR_MAX_END;
|
||||
const X_monotone_curve_2& xc = (ind == ARR_MIN_END) ?
|
||||
(*(event->right_curves_begin()))->last_curve() :
|
||||
(*(event->left_curves_begin()))->last_curve();
|
||||
|
||||
if (event->parameter_space_in_y() == ARR_TOP_BOUNDARY)
|
||||
{
|
||||
if (event->parameter_space_in_y() == ARR_TOP_BOUNDARY) {
|
||||
// The event is incident to the north pole: update the north face.
|
||||
if (ind == ARR_MIN_END)
|
||||
m_north_face = xc.halfedge_handle()->twin()->face();
|
||||
else
|
||||
m_north_face = xc.halfedge_handle()->face();
|
||||
}
|
||||
else if (event->parameter_space_in_y() == ARR_BOTTOM_BOUNDARY)
|
||||
{
|
||||
else if (event->parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) {
|
||||
// The event is incident to the south pole: update the south face.
|
||||
if (ind == ARR_MIN_END)
|
||||
m_south_face = xc.halfedge_handle()->face();
|
||||
else
|
||||
m_south_face = xc.halfedge_handle()->twin()->face();
|
||||
if (ind == ARR_MIN_END) m_south_face = xc.halfedge_handle()->face();
|
||||
else m_south_face = xc.halfedge_handle()->twin()->face();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
|
@ -25,72 +21,63 @@
|
|||
|
||||
#include <CGAL/license/Arrangement_on_surface_2.h>
|
||||
|
||||
|
||||
/*!
|
||||
* Definition of the Arr_unb_planar_batched_pl_helper class-template.
|
||||
*/
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
#include <CGAL/Sweep_line_empty_visitor.h>
|
||||
#include <CGAL/Surface_sweep_empty_visitor.h>
|
||||
|
||||
/*! \class Arr_unb_planar_batched_pl_helper
|
||||
* A helper class for the batched point-location sweep-line visitor, suitable
|
||||
* for an Arrangement_on_surface_2 instantiated with a topology-traits class
|
||||
* for unbounded curves in the plane.
|
||||
*/
|
||||
template <class Traits_, class Arrangement_>
|
||||
class Arr_unb_planar_batched_pl_helper
|
||||
{
|
||||
template <typename Traits_, typename Arrangement_>
|
||||
class Arr_unb_planar_batched_pl_helper {
|
||||
public:
|
||||
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Arrangement_ Arrangement_2;
|
||||
|
||||
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
|
||||
|
||||
typedef Sweep_line_empty_visitor<Traits_2> Base_visitor;
|
||||
typedef Surface_sweep_empty_visitor<Traits_2> Base_visitor;
|
||||
typedef typename Base_visitor::Event Event;
|
||||
typedef typename Base_visitor::Subcurve Subcurve;
|
||||
|
||||
protected:
|
||||
|
||||
typedef typename Arrangement_2::Topology_traits Topology_traits;
|
||||
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
|
||||
|
||||
// Data members:
|
||||
const Topology_traits *m_top_traits; // The topology-traits class.
|
||||
Halfedge_const_handle m_top_fict; // The current top fictitious halfedge.
|
||||
const Topology_traits* m_top_traits; // The topology-traits class.
|
||||
Halfedge_const_handle m_top_fict; // The current top fictitious halfedge.
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* Constructor.
|
||||
* \param arr The arrangement.
|
||||
*/
|
||||
Arr_unb_planar_batched_pl_helper (const Arrangement_2 *arr) :
|
||||
m_top_traits (arr->topology_traits())
|
||||
Arr_unb_planar_batched_pl_helper (const Arrangement_2* arr) :
|
||||
m_top_traits(arr->topology_traits())
|
||||
{}
|
||||
|
||||
/// \name Notification functions.
|
||||
//@{
|
||||
|
||||
/* A notification issued before the sweep process starts. */
|
||||
void before_sweep ();
|
||||
void 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.
|
||||
*/
|
||||
void after_handle_event (Event* event);
|
||||
void after_handle_event(Event* event);
|
||||
//@}
|
||||
|
||||
/*! Get the current top face. */
|
||||
Face_const_handle top_face () const
|
||||
{
|
||||
return (m_top_fict->face());
|
||||
}
|
||||
Face_const_handle top_face() const { return (m_top_fict->face()); }
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -100,52 +87,46 @@ public:
|
|||
//-----------------------------------------------------------------------------
|
||||
// A notification issued before the sweep process starts.
|
||||
//
|
||||
template <class Tr, class Arr>
|
||||
void Arr_unb_planar_batched_pl_helper<Tr, Arr>::before_sweep ()
|
||||
template <typename Tr, typename Arr>
|
||||
void Arr_unb_planar_batched_pl_helper<Tr, Arr>::before_sweep()
|
||||
{
|
||||
// Initialize the fictitious halfedge lying on the top edge of the
|
||||
// fictitious face. We start from the leftmost halfedge, which is
|
||||
// incident to the top-left vertex and directed from right to left.
|
||||
Vertex_const_handle v_tl =
|
||||
Vertex_const_handle (m_top_traits->top_left_vertex());
|
||||
Vertex_const_handle v_tl =
|
||||
Vertex_const_handle(m_top_traits->top_left_vertex());
|
||||
|
||||
m_top_fict = v_tl->incident_halfedges();
|
||||
if (m_top_fict->direction() == ARR_LEFT_TO_RIGHT)
|
||||
m_top_fict = m_top_fict->next()->twin();
|
||||
|
||||
CGAL_assertion_code (
|
||||
Vertex_const_handle v_tr =
|
||||
Vertex_const_handle (m_top_traits->top_right_vertex());
|
||||
CGAL_assertion_code(
|
||||
Vertex_const_handle v_tr =
|
||||
Vertex_const_handle(m_top_traits->top_right_vertex());
|
||||
);
|
||||
CGAL_assertion
|
||||
((m_top_fict->source() == v_tr) ||
|
||||
(m_top_fict->source()->parameter_space_in_x() == ARR_INTERIOR &&
|
||||
m_top_fict->source()->parameter_space_in_y() == ARR_TOP_BOUNDARY));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// A notification invoked after the sweep-line finishes handling the given
|
||||
// event.
|
||||
//
|
||||
template <class Tr, class Arr>
|
||||
template <typename Tr, typename Arr>
|
||||
void Arr_unb_planar_batched_pl_helper<Tr, Arr>::
|
||||
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
|
||||
// face (namely x is finite and y = +oo), we have to update the fictitious
|
||||
// edge we keep.
|
||||
if (event->is_closed())
|
||||
return;
|
||||
if (event->is_closed()) return;
|
||||
|
||||
if (event->parameter_space_in_x() != ARR_INTERIOR)
|
||||
return;
|
||||
if (event->parameter_space_in_x() != ARR_INTERIOR) return;
|
||||
|
||||
if (event->parameter_space_in_y() == ARR_TOP_BOUNDARY)
|
||||
m_top_fict = m_top_fict->twin()->next()->twin();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
|
@ -30,7 +26,7 @@
|
|||
* Definition of the Arr_unb_planar_construction_helper class-template.
|
||||
*/
|
||||
|
||||
#include <CGAL/Sweep_line_empty_visitor.h>
|
||||
#include <CGAL/Surface_sweep_empty_visitor.h>
|
||||
#include <CGAL/Unique_hash_map.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -40,9 +36,9 @@ namespace CGAL {
|
|||
* for an Arrangement_on_surface_2 instantiated with a topology-traits class
|
||||
* for unbounded curves in the plane.
|
||||
*/
|
||||
template <class Traits_, class Arrangement_, class Event_, class Subcurve_>
|
||||
class Arr_unb_planar_construction_helper
|
||||
{
|
||||
template <typename Traits_, typename Arrangement_, typename Event_,
|
||||
typename Subcurve_>
|
||||
class Arr_unb_planar_construction_helper {
|
||||
public:
|
||||
|
||||
typedef Traits_ Traits_2;
|
||||
|
|
@ -53,7 +49,7 @@ public:
|
|||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Traits_2::Point_2 Point_2;
|
||||
|
||||
typedef Sweep_line_empty_visitor<Traits_2, Subcurve, Event>
|
||||
typedef Surface_sweep_empty_visitor<Traits_2, Subcurve, Event>
|
||||
Base_visitor;
|
||||
|
||||
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
|
||||
|
|
@ -64,35 +60,32 @@ public:
|
|||
Indices_list> Halfedge_indices_map;
|
||||
|
||||
protected:
|
||||
|
||||
typedef typename Arrangement_2::Topology_traits Topology_traits;
|
||||
typedef typename Arrangement_2::Vertex_handle Vertex_handle;
|
||||
|
||||
// Data members:
|
||||
Topology_traits* m_top_traits; // The topology-traits class.
|
||||
Arr_accessor<Arrangement_2>
|
||||
m_arr_access; // An arrangement accessor.
|
||||
Topology_traits* m_top_traits; // The topology-traits class.
|
||||
Arr_accessor<Arrangement_2> m_arr_access; // An arrangement accessor.
|
||||
|
||||
Halfedge_handle m_lh; // The current left fictitious
|
||||
// halfedge (on x = -oo).
|
||||
Halfedge_handle m_th; // The current top fictitious
|
||||
// halfedge (on y = +oo).
|
||||
Halfedge_handle m_bh; // The current bottom fictitious
|
||||
// halfedge (on y = -oo).
|
||||
Halfedge_handle m_rh; // The current right fictitious
|
||||
// halfedge (on x = +oo).
|
||||
Halfedge_handle m_lh; // The current left fictitious
|
||||
// halfedge (on x = -oo).
|
||||
Halfedge_handle m_th; // The current top fictitious
|
||||
// halfedge (on y = +oo).
|
||||
Halfedge_handle m_bh; // The current bottom fictitious
|
||||
// halfedge (on y = -oo).
|
||||
Halfedge_handle m_rh; // The current right fictitious
|
||||
// halfedge (on x = +oo).
|
||||
|
||||
Indices_list m_subcurves_at_ubf; // Indices of the curves that
|
||||
Indices_list m_subcurves_at_ubf; // Indices of the curves that
|
||||
// "see" m_th from below.
|
||||
Event* m_prev_minus_inf_x_event; // The previous event at x = -oo.
|
||||
Event* m_prev_plus_inf_y_event; // The previous event at y = +oo.
|
||||
Event* m_prev_minus_inf_x_event; // The previous event at x = -oo.
|
||||
Event* m_prev_plus_inf_y_event; // The previous event at y = +oo.
|
||||
|
||||
Halfedge_indices_map* m_he_ind_map_p; // A pointer to a map of
|
||||
// halfedges to indices lists
|
||||
// (stored in the visitor class).
|
||||
Halfedge_indices_map* m_he_ind_map_p; // A pointer to a map of
|
||||
// halfedges to indices lists
|
||||
// (stored in the visitor class).
|
||||
|
||||
public:
|
||||
|
||||
/*! Constructor. */
|
||||
Arr_unb_planar_construction_helper(Arrangement_2* arr) :
|
||||
m_top_traits(arr->topology_traits()),
|
||||
|
|
@ -124,15 +117,10 @@ public:
|
|||
|
||||
/*! Collect a subcurve index that does not see any status-line from below. */
|
||||
void add_subcurve_in_top_face(unsigned int index)
|
||||
{
|
||||
m_subcurves_at_ubf.push_back(index);
|
||||
}
|
||||
{ m_subcurves_at_ubf.push_back(index); }
|
||||
|
||||
/*! Get the indices of the halfedges below the subcurve. */
|
||||
Indices_list& halfedge_indices_list()
|
||||
{
|
||||
return (m_subcurves_at_ubf);
|
||||
}
|
||||
Indices_list& halfedge_indices_list() { return (m_subcurves_at_ubf); }
|
||||
|
||||
|
||||
/*! A notification invoked before the given event it deallocated. */
|
||||
|
|
@ -150,9 +138,7 @@ public:
|
|||
* that "see" the halfedge from below.
|
||||
*/
|
||||
void set_halfedge_indices_map(Halfedge_indices_map& table)
|
||||
{
|
||||
m_he_ind_map_p = &table;
|
||||
}
|
||||
{ m_he_ind_map_p = &table; }
|
||||
|
||||
/*!
|
||||
* Determine if we should swap the order of predecessor halfedges when
|
||||
|
|
@ -169,9 +155,7 @@ public:
|
|||
|
||||
/*! Get the current top face. */
|
||||
Face_handle top_face() const
|
||||
{
|
||||
return (m_th->face());
|
||||
}
|
||||
{ return (m_th->face()); }
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -246,15 +230,15 @@ before_handle_event(Event* event)
|
|||
(event->number_of_right_curves() == 1)) ||
|
||||
((event->number_of_left_curves() == 1) &&
|
||||
(event->number_of_right_curves() == 0)));
|
||||
Arr_curve_end ind = (event->number_of_left_curves() == 0 &&
|
||||
event->number_of_right_curves() == 1) ?
|
||||
Arr_curve_end ind = (event->number_of_left_curves() == 0 &&
|
||||
event->number_of_right_curves() == 1) ?
|
||||
ARR_MIN_END : ARR_MAX_END;
|
||||
const X_monotone_curve_2& xc = (ind == ARR_MIN_END) ?
|
||||
const X_monotone_curve_2& xc = (ind == ARR_MIN_END) ?
|
||||
(*(event->right_curves_begin()))->last_curve() :
|
||||
(*(event->left_curves_begin()))->last_curve();
|
||||
|
||||
const Arr_parameter_space ps_x = event->parameter_space_in_x();
|
||||
const Arr_parameter_space ps_y = event->parameter_space_in_y();
|
||||
const Arr_parameter_space ps_x = event->parameter_space_in_x();
|
||||
const Arr_parameter_space ps_y = event->parameter_space_in_y();
|
||||
|
||||
// Create a vertex at infinity and split the corresponding fictitious edge.
|
||||
Vertex_handle v_at_inf =
|
||||
|
|
@ -303,7 +287,7 @@ before_handle_event(Event* event)
|
|||
|
||||
// Update the incident halfedge of the previous vertex at y = +oo
|
||||
// (m_th used to be incident to it, but now we have split it).
|
||||
if(m_prev_plus_inf_y_event != NULL)
|
||||
if (m_prev_plus_inf_y_event != NULL)
|
||||
m_prev_plus_inf_y_event->set_halfedge_handle(m_th->next());
|
||||
m_prev_plus_inf_y_event = event;
|
||||
|
||||
|
|
@ -315,8 +299,7 @@ before_handle_event(Event* event)
|
|||
list_ref.clear();
|
||||
list_ref.splice(list_ref.end(), m_subcurves_at_ubf);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
m_subcurves_at_ubf.clear();
|
||||
}
|
||||
CGAL_assertion(m_subcurves_at_ubf.empty());
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
|
@ -30,7 +26,7 @@
|
|||
* Definition of the Arr_unb_planar_insertion_helper class-template.
|
||||
*/
|
||||
|
||||
#include <CGAL/Sweep_line_2/Arr_construction_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h>
|
||||
#include <CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -46,7 +42,6 @@ class Arr_unb_planar_insertion_helper :
|
|||
Event_, Subcurve_>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Arrangement_ Arrangement_2;
|
||||
typedef Event_ Event;
|
||||
|
|
@ -59,7 +54,7 @@ public:
|
|||
typedef Arr_unb_planar_construction_helper<Traits_2, Arrangement_2, Event,
|
||||
Subcurve> Base;
|
||||
|
||||
typedef Sweep_line_empty_visitor<Traits_2, Subcurve, Event>
|
||||
typedef Surface_sweep_empty_visitor<Traits_2, Subcurve, Event>
|
||||
Base_visitor;
|
||||
|
||||
typedef Arr_unb_planar_insertion_helper<Traits_2, Arrangement_2, Event,
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
||||
|
|
@ -24,53 +20,48 @@
|
|||
|
||||
#include <CGAL/license/Arrangement_on_surface_2.h>
|
||||
|
||||
|
||||
/*! \file
|
||||
* Definition of the Arr_unb_planar_vert_decomp_helper class-template.
|
||||
*/
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
#include <CGAL/Sweep_line_empty_visitor.h>
|
||||
#include <CGAL/Surface_sweep_empty_visitor.h>
|
||||
|
||||
/*! \class Arr_unb_planar_vert_decomp_helper
|
||||
* A helper class for the vertical decomposition sweep-line visitor, suitable
|
||||
* for an Arrangement_on_surface_2 instantiated with a topology-traits class
|
||||
* for unbounded curves in the plane.
|
||||
*/
|
||||
template <class Traits_, class Arrangement_>
|
||||
class Arr_unb_planar_vert_decomp_helper
|
||||
{
|
||||
template <typename Traits_, typename Arrangement_>
|
||||
class Arr_unb_planar_vert_decomp_helper {
|
||||
public:
|
||||
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Arrangement_ Arrangement_2;
|
||||
|
||||
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
|
||||
|
||||
typedef Sweep_line_empty_visitor<Traits_2> Base_visitor;
|
||||
typedef Surface_sweep_empty_visitor<Traits_2> Base_visitor;
|
||||
typedef typename Base_visitor::Event Event;
|
||||
typedef typename Base_visitor::Subcurve Subcurve;
|
||||
|
||||
protected:
|
||||
|
||||
typedef typename Arrangement_2::Topology_traits Topology_traits;
|
||||
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
|
||||
|
||||
// Data members:
|
||||
const Topology_traits *m_top_traits; // The topology-traits class.
|
||||
Halfedge_const_handle m_top_fict; // The current top fictitious halfedge.
|
||||
Halfedge_const_handle m_bottom_fict; // The current bottom fictitious
|
||||
const Topology_traits* m_top_traits; // The topology-traits class.
|
||||
Halfedge_const_handle m_top_fict; // The current top fictitious halfedge.
|
||||
Halfedge_const_handle m_bottom_fict; // The current bottom fictitious
|
||||
// halfedge.
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* Constructor.
|
||||
* \param arr The arrangement.
|
||||
*/
|
||||
Arr_unb_planar_vert_decomp_helper (const Arrangement_2 *arr) :
|
||||
Arr_unb_planar_vert_decomp_helper(const Arrangement_2* arr) :
|
||||
m_top_traits (arr->topology_traits())
|
||||
{}
|
||||
|
||||
|
|
@ -78,27 +69,27 @@ public:
|
|||
//@{
|
||||
|
||||
/* A notification issued before the sweep process starts. */
|
||||
void before_sweep ();
|
||||
void before_sweep();
|
||||
|
||||
/*!
|
||||
* A notification invoked after the sweep-line finishes handling the given
|
||||
* event.
|
||||
*/
|
||||
void after_handle_event (Event* event);
|
||||
void after_handle_event(Event* event);
|
||||
//@}
|
||||
|
||||
/*! Get the current top object. */
|
||||
CGAL::Object top_object () const
|
||||
CGAL::Object top_object() const
|
||||
{
|
||||
// Wrap the top fictitious halfedge by a CGAL object.
|
||||
return (CGAL::make_object (m_top_fict));
|
||||
return (CGAL::make_object(m_top_fict));
|
||||
}
|
||||
|
||||
/*! Get the current bottom object. */
|
||||
CGAL::Object bottom_object () const
|
||||
CGAL::Object bottom_object() const
|
||||
{
|
||||
// Wrap the bottom fictitious halfedge by a CGAL object.
|
||||
return (CGAL::make_object (m_bottom_fict));
|
||||
return (CGAL::make_object(m_bottom_fict));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -109,8 +100,8 @@ public:
|
|||
//-----------------------------------------------------------------------------
|
||||
// A notification issued before the sweep process starts.
|
||||
//
|
||||
template <class Tr, class Arr>
|
||||
void Arr_unb_planar_vert_decomp_helper<Tr, Arr>::before_sweep ()
|
||||
template <typename Tr, typename Arr>
|
||||
void Arr_unb_planar_vert_decomp_helper<Tr, Arr>::before_sweep()
|
||||
{
|
||||
// Initialize the fictitious halfedge lying on the top edge of the
|
||||
// bounding rectangle. We start from the leftmost halfedge, which is
|
||||
|
|
@ -149,17 +140,15 @@ void Arr_unb_planar_vert_decomp_helper<Tr, Arr>::before_sweep ()
|
|||
((m_bottom_fict->source() == v_br) ||
|
||||
(m_bottom_fict->source()->parameter_space_in_x() == ARR_INTERIOR &&
|
||||
m_bottom_fict->source()->parameter_space_in_y() == ARR_BOTTOM_BOUNDARY));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// A notification invoked after the sweep-line finishes handling the given
|
||||
// event.
|
||||
//
|
||||
template <class Tr, class Arr>
|
||||
template <typename Tr, typename Arr>
|
||||
void Arr_unb_planar_vert_decomp_helper<Tr, Arr>::
|
||||
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
|
||||
// face (namely x is finite and y = +oo), we have to update the fictitious
|
||||
|
|
@ -167,25 +156,20 @@ after_handle_event (Event* event)
|
|||
if (event->is_closed())
|
||||
return;
|
||||
|
||||
if (event->parameter_space_in_x() != ARR_INTERIOR)
|
||||
return;
|
||||
if (event->parameter_space_in_x() != ARR_INTERIOR) return;
|
||||
|
||||
Arr_parameter_space ps_y = event->parameter_space_in_y();
|
||||
|
||||
if (ps_y == ARR_TOP_BOUNDARY)
|
||||
{
|
||||
if (ps_y == ARR_TOP_BOUNDARY) {
|
||||
// Update the fictitious top halfedge.
|
||||
m_top_fict = m_top_fict->twin()->next()->twin();
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
CGAL_assertion (ps_y == ARR_BOTTOM_BOUNDARY);
|
||||
|
||||
// Update the fictitious bottom halfedge.
|
||||
m_bottom_fict = m_bottom_fict->prev();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
||||
|
|
@ -24,7 +20,6 @@
|
|||
|
||||
#include <CGAL/license/Arrangement_on_surface_2.h>
|
||||
|
||||
|
||||
/*! \file
|
||||
* Definition of the Arr_unb_planar_topology_traits_2<GeomTraits> class.
|
||||
*/
|
||||
|
|
@ -292,19 +287,19 @@ public:
|
|||
//@{
|
||||
|
||||
typedef Arr_construction_sl_visitor<CHelper>
|
||||
Sweep_line_construction_visitor;
|
||||
Surface_sweep_construction_visitor;
|
||||
|
||||
typedef Arr_insertion_sl_visitor<IHelper>
|
||||
Sweep_line_insertion_visitor;
|
||||
Surface_sweep_insertion_visitor;
|
||||
|
||||
typedef Sweep_line_construction_visitor
|
||||
Sweep_line_non_intersecting_construction_visitor;
|
||||
typedef Surface_sweep_construction_visitor
|
||||
Surface_sweep_non_intersecting_construction_visitor;
|
||||
|
||||
typedef Arr_basic_insertion_sl_visitor<BIHelper>
|
||||
Sweep_line_non_intersecting_insertion_visitor;
|
||||
Surface_sweep_non_intersecting_insertion_visitor;
|
||||
|
||||
template <class OutputIterator_>
|
||||
struct Sweep_line_batched_point_location_visitor :
|
||||
struct Surface_sweep_batched_point_location_visitor :
|
||||
public Arr_batched_pl_sl_visitor<BplHelper, OutputIterator_>
|
||||
{
|
||||
typedef OutputIterator_ Output_iterator;
|
||||
|
|
@ -314,14 +309,14 @@ public:
|
|||
typedef typename Base::Event Event;
|
||||
typedef typename Base::Subcurve Subcurve;
|
||||
|
||||
Sweep_line_batched_point_location_visitor(const Arr* arr,
|
||||
Surface_sweep_batched_point_location_visitor(const Arr* arr,
|
||||
Output_iterator& oi) :
|
||||
Base(arr, oi)
|
||||
{}
|
||||
};
|
||||
|
||||
template <class OutputIterator_>
|
||||
struct Sweep_line_vertical_decomposition_visitor :
|
||||
struct Surface_sweep_vertical_decomposition_visitor :
|
||||
public Arr_vert_decomp_sl_visitor<VdHelper, OutputIterator_>
|
||||
{
|
||||
typedef OutputIterator_ Output_iterator;
|
||||
|
|
@ -332,13 +327,13 @@ public:
|
|||
typedef typename Base::Event Event;
|
||||
typedef typename Base::Subcurve Subcurve;
|
||||
|
||||
Sweep_line_vertical_decomposition_visitor(const Arr* arr,
|
||||
Surface_sweep_vertical_decomposition_visitor(const Arr* arr,
|
||||
Output_iterator* oi) :
|
||||
Base(arr, oi) {}
|
||||
};
|
||||
|
||||
template <class ArrangementA_, class ArrangementB_, class OverlayTraits_>
|
||||
struct Sweep_line_overlay_visitor :
|
||||
struct Surface_sweep_overlay_visitor :
|
||||
public Arr_overlay_sl_visitor
|
||||
<_Overlay_helper<Arr_overlay_traits_2<Geometry_traits_2,
|
||||
ArrangementA_,
|
||||
|
|
@ -367,10 +362,10 @@ public:
|
|||
typedef typename Base::Event Event;
|
||||
typedef typename Base::Subcurve Subcurve;
|
||||
|
||||
Sweep_line_overlay_visitor(const ArrangementA_2* arrA,
|
||||
const ArrangementB_2* arrB,
|
||||
Arrangement_result_2* arr_res,
|
||||
Overlay_traits* overlay_tr) :
|
||||
Surface_sweep_overlay_visitor(const ArrangementA_2* arrA,
|
||||
const ArrangementB_2* arrB,
|
||||
Arrangement_result_2* arr_res,
|
||||
Overlay_traits* overlay_tr) :
|
||||
Base(arrA, arrB, arr_res, overlay_tr)
|
||||
{}
|
||||
};
|
||||
|
|
@ -388,18 +383,15 @@ public:
|
|||
///! \name Topology-traits methods.
|
||||
//@{
|
||||
|
||||
/*!
|
||||
* Initialize an empty DCEL structure.
|
||||
/*! Initialize an empty DCEL structure.
|
||||
*/
|
||||
void init_dcel();
|
||||
|
||||
/*!
|
||||
* Make the necessary updates after the DCEL structure have been updated.
|
||||
/*! Make the necessary updates after the DCEL structure have been updated.
|
||||
*/
|
||||
void dcel_updated();
|
||||
|
||||
/*!
|
||||
* Check if the given vertex is associated with the given curve end.
|
||||
/*! Check if the given vertex is associated with the given curve end.
|
||||
* \param v The vertex.
|
||||
* \param cv The x-monotone curve.
|
||||
* \param ind The curve end.
|
||||
|
|
@ -412,8 +404,7 @@ public:
|
|||
const X_monotone_curve_2& cv, Arr_curve_end ind,
|
||||
Arr_parameter_space ps_x, Arr_parameter_space ps_y) const;
|
||||
|
||||
/*!
|
||||
* Given a curve end with boundary conditions and a face that contains the
|
||||
/*! Given a curve end with boundary conditions and a face that contains the
|
||||
* interior of the curve, find a place for a boundary vertex that will
|
||||
* represent the curve end along the face boundary.
|
||||
* \param f The face.
|
||||
|
|
@ -431,8 +422,7 @@ public:
|
|||
Arr_parameter_space ps_x,
|
||||
Arr_parameter_space ps_y);
|
||||
|
||||
/*!
|
||||
* Locate the predecessor halfedge for the given curve around a given
|
||||
/*! Locate the predecessor halfedge for the given curve around a given
|
||||
* vertex with boundary conditions.
|
||||
* \param v The vertex.
|
||||
* \param cv The x-monotone curve.
|
||||
|
|
@ -454,8 +444,7 @@ public:
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Locate a DCEL feature that contains the given unbounded curve end.
|
||||
/*! Locate a DCEL feature that contains the given unbounded curve end.
|
||||
* \param cv The x-monotone curve.
|
||||
* \param ind The curve end.
|
||||
* \param ps_x The boundary condition of the curve end in x.
|
||||
|
|
@ -470,8 +459,7 @@ public:
|
|||
Arr_parameter_space ps_x,
|
||||
Arr_parameter_space ps_y);
|
||||
|
||||
/*!
|
||||
* Split a fictitious edge using the given vertex.
|
||||
/*! Split a fictitious edge using the given vertex.
|
||||
* \param e The edge to split (one of the pair of halfedges).
|
||||
* \param v The split vertex.
|
||||
* \pre e is a fictitious halfedge.
|
||||
|
|
@ -480,22 +468,19 @@ public:
|
|||
*/
|
||||
Halfedge* split_fictitious_edge(Halfedge* e, Vertex* v);
|
||||
|
||||
/*!
|
||||
* Determine whether the given face is unbounded.
|
||||
/*! Determine whether the given face is unbounded.
|
||||
* \param f The face.
|
||||
* \return Whether f is unbounded.
|
||||
*/
|
||||
bool is_unbounded(const Face* f) const;
|
||||
|
||||
/*!
|
||||
* Determine whether the given boundary vertex is redundant.
|
||||
/*! Determine whether the given boundary vertex is redundant.
|
||||
* \param v The vertex.
|
||||
* \return Whether v is redundant, and should be erased.
|
||||
*/
|
||||
bool is_redundant(const Vertex* v) const;
|
||||
|
||||
/*!
|
||||
* Erase the given redundant vertex by merging a fictitious edge.
|
||||
/*! Erase the given redundant vertex by merging a fictitious edge.
|
||||
* The function does not free the vertex v itself.
|
||||
* \param v The vertex.
|
||||
* \pre v is a redundant vertex.
|
||||
|
|
@ -569,8 +554,7 @@ public:
|
|||
/// \name Additional predicates, specialized for this topology-traits class.
|
||||
//@{
|
||||
|
||||
/*!
|
||||
* Compare the given vertex (which may lie at infinity) and the given point.
|
||||
/*! Compare the given vertex (which may lie at infinity) and the given point.
|
||||
* \param p The point.
|
||||
* \param v The vertex.
|
||||
* \return The result of the comparison of the x-coordinates of p and v.
|
||||
|
|
@ -578,8 +562,7 @@ public:
|
|||
virtual Comparison_result compare_x(const Point_2& p,
|
||||
const Vertex* v) const;
|
||||
|
||||
/*!
|
||||
* Compare the given vertex (which may lie at infinity) and the given point.
|
||||
/*! Compare the given vertex (which may lie at infinity) and the given point.
|
||||
* \param p The point.
|
||||
* \param v The vertex.
|
||||
* \return The result of the xy-lexicographic comparison of p and v.
|
||||
|
|
@ -587,8 +570,7 @@ public:
|
|||
virtual Comparison_result compare_xy(const Point_2& p,
|
||||
const Vertex* v) const;
|
||||
|
||||
/*!
|
||||
* Compare the relative y-position of the given point and the given edge
|
||||
/*! Compare the relative y-position of the given point and the given edge
|
||||
* (which may be fictitious).
|
||||
* \param p The point.
|
||||
* \param he The edge (one of the pair of halfedges).
|
||||
|
|
@ -604,8 +586,7 @@ protected:
|
|||
/// \name Auxiliary functions.
|
||||
//@{
|
||||
|
||||
/*!
|
||||
* Get the curve associated with a boundary vertex.
|
||||
/*! Get the curve associated with a boundary vertex.
|
||||
* \param v The vertex as infinity.
|
||||
* \param ind Output: ARR_MIN_END if the vertex is induced by the minimal end;
|
||||
* ARR_MAX_END if it is induced by the curve's maximal end.
|
||||
|
|
@ -614,8 +595,7 @@ protected:
|
|||
*/
|
||||
const X_monotone_curve_2* _curve(const Vertex* v, Arr_curve_end& ind) const;
|
||||
|
||||
/*!
|
||||
* Check whether the given infinite curve end lies on the given fictitious
|
||||
/*! Check whether the given infinite curve end lies on the given fictitious
|
||||
* halfedge.
|
||||
* \param cv The curve.
|
||||
* \param ind Whether we refer to the minimal or maximal end of cv.
|
||||
|
|
|
|||
|
|
@ -12,9 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// Author(s) : Ron Wein <wein@post.tau.ac.il>
|
||||
|
||||
#ifndef CGAL_ARR_VERTICAL_DECOMPOSITION_2_H
|
||||
|
|
@ -22,9 +19,8 @@
|
|||
|
||||
#include <CGAL/license/Arrangement_on_surface_2.h>
|
||||
|
||||
|
||||
#include <CGAL/Arrangement_on_surface_2.h>
|
||||
#include <CGAL/Basic_sweep_line_2.h>
|
||||
#include <CGAL/No_intersection_surface_sweep_2.h>
|
||||
|
||||
#include <vector>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
|
@ -32,8 +28,7 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
/*!
|
||||
* Perform a vertical decomposition of an arrangement, by performing a
|
||||
/*! Perform a vertical decomposition of an arrangement, by performing a
|
||||
* "batched vertical ray-shooting" query from all arrangement vertices.
|
||||
* \param arr The arrangement.
|
||||
* \param oi Output: An output iterator of the vertices, each paired with
|
||||
|
|
@ -45,8 +40,8 @@ namespace CGAL {
|
|||
* pair<Vertex_const_handle, pair<Object, Object> >, where
|
||||
* the Object represents a handle to an arrangement feature.
|
||||
*/
|
||||
template<typename GeomTraits, typename TopTraits,
|
||||
typename OutputIterator>
|
||||
template <typename GeomTraits, typename TopTraits,
|
||||
typename OutputIterator>
|
||||
OutputIterator
|
||||
decompose(const Arrangement_on_surface_2<GeomTraits, TopTraits>& arr,
|
||||
OutputIterator oi)
|
||||
|
|
@ -54,7 +49,7 @@ decompose(const Arrangement_on_surface_2<GeomTraits, TopTraits>& arr,
|
|||
// Arrangement types:
|
||||
typedef Arrangement_on_surface_2<GeomTraits, TopTraits> Arrangement_2;
|
||||
typedef typename TopTraits::template
|
||||
Sweep_line_vertical_decomposition_visitor<OutputIterator>
|
||||
Surface_sweep_vertical_decomposition_visitor<OutputIterator>
|
||||
Vd_visitor;
|
||||
|
||||
typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator;
|
||||
|
|
@ -70,49 +65,40 @@ decompose(const Arrangement_on_surface_2<GeomTraits, TopTraits>& arr,
|
|||
// Go over all arrangement edges and collect their associated x-monotone
|
||||
// curves. To each curve we attach a halfedge handle going from right to
|
||||
// left.
|
||||
std::vector<Vd_x_monotone_curve_2> xcurves_vec (arr.number_of_edges());
|
||||
Edge_const_iterator eit;
|
||||
Halfedge_const_handle he;
|
||||
unsigned int i = 0;
|
||||
std::vector<Vd_x_monotone_curve_2> xcurves_vec(arr.number_of_edges());
|
||||
|
||||
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit, ++i)
|
||||
{
|
||||
size_t i(0);
|
||||
Edge_const_iterator eit;
|
||||
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit) {
|
||||
// Associate each x-monotone curve with the halfedge that represents it
|
||||
// and is directed from right to left.
|
||||
if (eit->direction() == ARR_RIGHT_TO_LEFT)
|
||||
he = eit;
|
||||
else
|
||||
he = eit->twin();
|
||||
Halfedge_const_handle he = (eit->direction() == ARR_RIGHT_TO_LEFT) ?
|
||||
eit : eit->twin();
|
||||
//attempt to solve compile problem in one of the tests. created the
|
||||
// tmp_curve instead of passing eit->curve() as a parmeter to the function
|
||||
X_monotone_curve_2 tmp_curve = eit->curve();
|
||||
xcurves_vec[i] = Vd_x_monotone_curve_2 (tmp_curve, he);
|
||||
xcurves_vec[i++] = Vd_x_monotone_curve_2(tmp_curve, he);
|
||||
}
|
||||
|
||||
// Go over all isolated vertices and collect their points. To each point
|
||||
// we attach its vertex handle.
|
||||
std::vector<Vd_point_2> iso_pts_vec (arr.number_of_isolated_vertices());
|
||||
Vertex_const_iterator vit;
|
||||
Vertex_const_handle iso_v;
|
||||
|
||||
std::vector<Vd_point_2> iso_pts_vec(arr.number_of_isolated_vertices());
|
||||
i = 0;
|
||||
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit)
|
||||
{
|
||||
Vertex_const_iterator vit;
|
||||
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) {
|
||||
// Associate isolated point with the vertex that represents it.
|
||||
if (vit->is_isolated())
|
||||
{
|
||||
iso_v = vit;
|
||||
if (vit->is_isolated()) {
|
||||
Vertex_const_handle iso_v = vit;
|
||||
//attempt to solve compile problem in one of the tests. created the
|
||||
// tmp_curve instead of passing eit->curve() as a parmeter to the
|
||||
// function
|
||||
Point_2 tmp_point = vit->point();
|
||||
iso_pts_vec[i] = Vd_point_2 (tmp_point, iso_v);
|
||||
++i;
|
||||
iso_pts_vec[i++] = Vd_point_2(tmp_point, iso_v);
|
||||
}
|
||||
}
|
||||
|
||||
// Obtain a extended traits-class object.
|
||||
const GeomTraits * geom_traits = arr.geometry_traits();
|
||||
const GeomTraits* geom_traits = arr.geometry_traits();
|
||||
|
||||
/* We would like to avoid copy construction of the geometry traits class.
|
||||
* Copy construction is undesired, because it may results with data
|
||||
|
|
@ -131,21 +117,20 @@ decompose(const Arrangement_on_surface_2<GeomTraits, TopTraits>& arr,
|
|||
ex_traits(*geom_traits);
|
||||
|
||||
// Define the sweep-line visitor and perform the sweep.
|
||||
Vd_visitor visitor (&arr, &oi);
|
||||
Basic_sweep_line_2<typename Vd_visitor::Traits_2,
|
||||
Vd_visitor,
|
||||
typename Vd_visitor::Subcurve,
|
||||
typename Vd_visitor::Event>
|
||||
sweep_line (&ex_traits, &visitor);
|
||||
Vd_visitor visitor(&arr, &oi);
|
||||
No_intersection_surface_sweep_2<typename Vd_visitor::Traits_2,
|
||||
Vd_visitor,
|
||||
typename Vd_visitor::Subcurve,
|
||||
typename Vd_visitor::Event>
|
||||
surface_sweep(&ex_traits, &visitor);
|
||||
|
||||
sweep_line.sweep (xcurves_vec.begin(), xcurves_vec.end(), // Curves.
|
||||
iso_pts_vec.begin(), iso_pts_vec.end()); // Action points.
|
||||
surface_sweep.sweep(xcurves_vec.begin(), xcurves_vec.end(), // Curves.
|
||||
iso_pts_vec.begin(), iso_pts_vec.end()); // Action points.
|
||||
|
||||
// Return a past-the-end iterator.
|
||||
return (oi);
|
||||
return oi;
|
||||
}
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -18,7 +18,7 @@ int main()
|
|||
#include <CGAL/Algebraic_kernel_d_1.h> //Algebraic Kernel
|
||||
#include <CGAL/Arr_rational_function_traits_2.h> //Traits
|
||||
#include <CGAL/Arrangement_2.h> //Arrangement
|
||||
#include <CGAL/Sweep_line_2_algorithms.h>
|
||||
#include <CGAL/Surface_sweep_2_algorithms.h>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
typedef CGAL::CORE_arithmetic_kernel::Integer Number_type;
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$ $Date$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ophir Setter <ophir.setter@cs.tau.ac.il>
|
||||
|
||||
|
|
@ -38,8 +34,8 @@
|
|||
|
||||
#include <CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h>
|
||||
#include <CGAL/Boolean_set_operations_2/Gps_agg_op_sweep.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_construction_subcurve.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_construction_event.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_construction_subcurve.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_construction_event.h>
|
||||
|
||||
#include <CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h>
|
||||
#include <CGAL/Boolean_set_operations_2/Gps_bfs_scanner.h>
|
||||
|
|
@ -51,8 +47,7 @@
|
|||
namespace CGAL {
|
||||
|
||||
template <class Arrangement_, class Bfs_visitor_>
|
||||
class Gps_agg_op
|
||||
{
|
||||
class Gps_agg_op {
|
||||
typedef Arrangement_ Arrangement_2;
|
||||
typedef typename Arrangement_2::Traits_adaptor_2 Traits_2;
|
||||
typedef typename Traits_2::Curve_const_iterator Curve_const_iterator;
|
||||
|
|
@ -90,7 +85,7 @@ class Gps_agg_op
|
|||
Meta_traits,
|
||||
Visitor,
|
||||
Subcurve,
|
||||
Event> Sweep_line_2;
|
||||
Event> Surface_sweep_2;
|
||||
|
||||
typedef Unique_hash_map<Halfedge_handle,
|
||||
unsigned int> Edges_hash;
|
||||
|
|
@ -104,7 +99,7 @@ protected:
|
|||
Arrangement_2* m_arr;
|
||||
Meta_traits* m_traits;
|
||||
Visitor m_visitor;
|
||||
Sweep_line_2 m_sweep_line;
|
||||
Surface_sweep_2 m_sweep_line;
|
||||
Edges_hash m_edges_hash; // maps halfedge to its BC (boundary counter)
|
||||
Faces_hash m_faces_hash; // maps face to its IC (inside count)
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$ $Date$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
|
||||
|
|
@ -25,42 +21,35 @@
|
|||
#include <CGAL/license/Boolean_set_operations_2.h>
|
||||
|
||||
|
||||
#include <CGAL/Sweep_line_2.h>
|
||||
#include <CGAL/Surface_sweep_2.h>
|
||||
#include <CGAL/Unique_hash_map.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class Arrangement_,
|
||||
class MetaTraits_,
|
||||
class SweepVisitor,
|
||||
class CurveWrap,
|
||||
class SweepEvent,
|
||||
template <typename Arrangement_,
|
||||
typename MetaTraits_,
|
||||
typename SweepVisitor,
|
||||
typename CurveWrap,
|
||||
typename SweepEvent,
|
||||
typename Allocator = CGAL_ALLOCATOR(int) >
|
||||
class Gps_agg_op_sweep_line_2 :
|
||||
public Sweep_line_2<MetaTraits_,
|
||||
SweepVisitor,
|
||||
CurveWrap,
|
||||
SweepEvent,
|
||||
Allocator>
|
||||
public Surface_sweep_2<MetaTraits_, SweepVisitor, CurveWrap, SweepEvent,
|
||||
Allocator>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Arrangement_ Arrangement_2;
|
||||
typedef MetaTraits_ Traits_2;
|
||||
typedef typename Traits_2::Point_2 Point_2;
|
||||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
|
||||
typedef typename Arrangement_2::Vertex_handle Vertex_handle;
|
||||
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
|
||||
typedef typename Arrangement_2::Vertex_handle Vertex_handle;
|
||||
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
|
||||
|
||||
typedef std::pair<Arrangement_2 *,
|
||||
std::vector<Vertex_handle> *> Arr_entry;
|
||||
std::vector<Vertex_handle> *> Arr_entry;
|
||||
|
||||
typedef Sweep_line_2<Traits_2,
|
||||
SweepVisitor,
|
||||
CurveWrap,
|
||||
SweepEvent,
|
||||
Allocator> Base;
|
||||
typedef Surface_sweep_2<Traits_2, SweepVisitor, CurveWrap, SweepEvent,
|
||||
Allocator> Base;
|
||||
|
||||
typedef SweepEvent Event;
|
||||
|
||||
|
|
@ -82,12 +71,11 @@ public:
|
|||
typedef typename Base::Status_line_iterator StatusLineIter;
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* Constructor.
|
||||
* \param visitor A pointer to a sweep-line visitor object.
|
||||
*/
|
||||
Gps_agg_op_sweep_line_2 (SweepVisitor* visitor) :
|
||||
Gps_agg_op_sweep_line_2(SweepVisitor* visitor) :
|
||||
Base (visitor)
|
||||
{}
|
||||
|
||||
|
|
@ -96,18 +84,18 @@ public:
|
|||
* \param traits A pointer to a sweep-line traits object.
|
||||
* \param visitor A pointer to a sweep-line visitor object.
|
||||
*/
|
||||
Gps_agg_op_sweep_line_2 (Traits_2 *traits, SweepVisitor* visitor) :
|
||||
Gps_agg_op_sweep_line_2(Traits_2 *traits, SweepVisitor* visitor) :
|
||||
Base(traits, visitor)
|
||||
{}
|
||||
|
||||
/*! Perform the sweep. */
|
||||
template<class CurveInputIterator>
|
||||
void sweep (CurveInputIterator curves_begin,
|
||||
CurveInputIterator curves_end,
|
||||
unsigned int lower,
|
||||
unsigned int upper,
|
||||
unsigned int jump,
|
||||
std::vector<Arr_entry>& arr_vec)
|
||||
void sweep(CurveInputIterator curves_begin,
|
||||
CurveInputIterator curves_end,
|
||||
unsigned int lower,
|
||||
unsigned int upper,
|
||||
unsigned int jump,
|
||||
std::vector<Arr_entry>& arr_vec)
|
||||
{
|
||||
CGAL_assertion (this->m_queue->empty() &&
|
||||
this->m_statusLine.size() == 0);
|
||||
|
|
@ -117,7 +105,8 @@ public:
|
|||
|
||||
this->m_visitor->before_sweep();
|
||||
// Allocate all of the Subcurve objects as one block.
|
||||
this->m_num_of_subCurves = static_cast<unsigned int>(std::distance (curves_begin, curves_end));
|
||||
this->m_num_of_subCurves =
|
||||
static_cast<unsigned int>(std::distance (curves_begin, curves_end));
|
||||
if (this->m_num_of_subCurves > 0)
|
||||
this->m_subCurves =
|
||||
this->m_subCurveAlloc.allocate (this->m_num_of_subCurves);
|
||||
|
|
@ -264,7 +253,6 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
|
||||
/*!
|
||||
* Check if the given vertex is an endpoint of an edge we are going
|
||||
* to use in the sweep.
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
|
||||
|
|
@ -24,9 +20,8 @@
|
|||
|
||||
#include <CGAL/license/Boolean_set_operations_2.h>
|
||||
|
||||
|
||||
#include <CGAL/Unique_hash_map.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_construction_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <CGAL/Arr_tags.h>
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
|
||||
#ifndef CGAL_GPS_POLYGON_SIMPILFIER_H
|
||||
|
|
@ -25,9 +21,9 @@
|
|||
|
||||
|
||||
#include <CGAL/Boolean_set_operations_2/Gps_simplifier_traits.h>
|
||||
#include <CGAL/Sweep_line_2.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_construction_subcurve.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_construction_event.h>
|
||||
#include <CGAL/Surface_sweep_2.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_construction_subcurve.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_construction_event.h>
|
||||
|
||||
#include <CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h>
|
||||
#include <CGAL/Boolean_set_operations_2/Gps_bfs_scanner.h>
|
||||
|
|
@ -39,9 +35,8 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
template <class Arrangement_>
|
||||
class Gps_polygon_simplifier
|
||||
{
|
||||
template <typename Arrangement_>
|
||||
class Gps_polygon_simplifier {
|
||||
typedef Arrangement_ Arrangement_2;
|
||||
typedef typename Arrangement_2::Geometry_traits_2 Traits_2;
|
||||
typedef typename Traits_2::Curve_const_iterator Curve_const_iterator;
|
||||
|
|
@ -72,10 +67,10 @@ class Gps_polygon_simplifier
|
|||
Event,
|
||||
Subcurve> Visitor;
|
||||
|
||||
typedef CGAL::Sweep_line_2<Meta_traits,
|
||||
typedef CGAL::Surface_sweep_2<Meta_traits,
|
||||
Visitor,
|
||||
Subcurve,
|
||||
Event> Sweep_line_2;
|
||||
Event> Surface_sweep_2;
|
||||
|
||||
typedef Unique_hash_map<Halfedge_handle,
|
||||
unsigned int> Edges_hash;
|
||||
|
|
@ -88,11 +83,11 @@ class Gps_polygon_simplifier
|
|||
protected:
|
||||
Arrangement_2* m_arr;
|
||||
const Meta_traits* m_traits;
|
||||
bool m_own_traits;
|
||||
Visitor m_visitor;
|
||||
Sweep_line_2 m_sweep_line;
|
||||
Edges_hash m_edges_hash; // maps halfedge to its BC (boundary counter)
|
||||
Faces_hash m_faces_hash; // maps face to its IC (inside count)
|
||||
bool m_own_traits;
|
||||
Visitor m_visitor;
|
||||
Surface_sweep_2 m_sweep_line;
|
||||
Edges_hash m_edges_hash; // maps halfedge to its BC (boundary counter)
|
||||
Faces_hash m_faces_hash; // maps face to its IC (inside count)
|
||||
|
||||
public:
|
||||
/*! Constructor. */
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s): Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
// Boris Kozorovitzky <boriskoz@post.tau.ac.il>
|
||||
|
|
@ -32,10 +28,10 @@
|
|||
#include <CGAL/Boolean_set_operations_2/Gps_on_surface_base_2.h>
|
||||
|
||||
#include <CGAL/Arrangement_2/Arr_default_planar_topology.h>
|
||||
#include <CGAL/Sweep_line_2.h>
|
||||
#include <CGAL/Sweep_line_2/Sweep_line_event.h>
|
||||
#include <CGAL/Sweep_line_2/Sweep_line_subcurve.h>
|
||||
#include <CGAL/Sweep_line_empty_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_event.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_subcurve.h>
|
||||
#include <CGAL/Surface_sweep_empty_visitor.h>
|
||||
#include <CGAL/Arr_default_overlay_traits.h>
|
||||
#include <CGAL/Arr_naive_point_location.h>
|
||||
|
||||
|
|
@ -44,7 +40,6 @@
|
|||
#include <list>
|
||||
#include <iterator>
|
||||
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
/*Arrangement is templated with extended face dcel*/
|
||||
|
|
@ -87,6 +82,7 @@ public:
|
|||
hole_overlap = b;
|
||||
return;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable bool hole_overlap;
|
||||
};
|
||||
|
|
@ -97,7 +93,7 @@ private:
|
|||
*/
|
||||
template <class ArrTraits_>
|
||||
class Gps_polygon_validation_visitor :
|
||||
public Sweep_line_empty_visitor<ArrTraits_>
|
||||
public Surface_sweep_empty_visitor<ArrTraits_>
|
||||
{
|
||||
private:
|
||||
typedef ArrTraits_ Traits_2;
|
||||
|
|
@ -105,12 +101,12 @@ private:
|
|||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Traits_2::Point_2 Point_2;
|
||||
|
||||
typedef Sweep_line_empty_visitor<Traits_2> Base;
|
||||
typedef Surface_sweep_empty_visitor<Traits_2> Base;
|
||||
typedef typename Base::Event Event;
|
||||
typedef typename Base::Subcurve Subcurve;
|
||||
typedef typename Base::Status_line_iterator SL_iterator;
|
||||
|
||||
typedef Basic_sweep_line_2<Traits_2, Self> Sweep_line;
|
||||
typedef Basic_sweep_line_2<Traits_2, Self> Surface_sweep;
|
||||
|
||||
public:
|
||||
enum Error_code {
|
||||
|
|
@ -131,7 +127,7 @@ public:
|
|||
void sweep(XCurveIterator begin, XCurveIterator end)
|
||||
{
|
||||
//Perform the sweep
|
||||
reinterpret_cast<Sweep_line*>(this->m_sweep_line)->sweep(begin, end);
|
||||
reinterpret_cast<Surface_sweep*>(this->m_sweep_line)->sweep(begin, end);
|
||||
}
|
||||
|
||||
bool after_handle_event(Event* event, SL_iterator, bool)
|
||||
|
|
@ -139,17 +135,17 @@ public:
|
|||
if (event->is_intersection()) {
|
||||
m_error_code = ERROR_EDGE_INTERSECTION;
|
||||
m_is_valid = false;
|
||||
reinterpret_cast<Sweep_line*>(this->m_sweep_line)->stop_sweep();
|
||||
reinterpret_cast<Surface_sweep*>(this->m_sweep_line)->stop_sweep();
|
||||
}
|
||||
else if (event->is_weak_intersection()) {
|
||||
m_error_code = ERROR_EDGE_VERTEX_INTERSECTION;
|
||||
m_is_valid = false;
|
||||
reinterpret_cast<Sweep_line*>(this->m_sweep_line)->stop_sweep();
|
||||
reinterpret_cast<Surface_sweep*>(this->m_sweep_line)->stop_sweep();
|
||||
}
|
||||
else if (event->is_overlap()) {
|
||||
m_error_code = ERROR_EDGE_OVERLAP;
|
||||
m_is_valid = false;
|
||||
reinterpret_cast<Sweep_line*>(this->m_sweep_line)->stop_sweep();
|
||||
reinterpret_cast<Surface_sweep*>(this->m_sweep_line)->stop_sweep();
|
||||
} else {
|
||||
if (m_is_s_simple &&
|
||||
(event->number_of_right_curves() + event->number_of_left_curves()) !=
|
||||
|
|
@ -157,7 +153,7 @@ public:
|
|||
{
|
||||
m_error_code = ERROR_VERTEX_INTERSECTION;
|
||||
m_is_valid = false;
|
||||
reinterpret_cast<Sweep_line*>(this->m_sweep_line)->stop_sweep();
|
||||
reinterpret_cast<Surface_sweep*>(this->m_sweep_line)->stop_sweep();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -240,11 +236,11 @@ bool is_simple_polygon(const typename Traits_2::Polygon_2& pgn,
|
|||
|
||||
// Sweep the boundary curves and look for intersections.
|
||||
typedef Gps_polygon_validation_visitor<Traits_2> Visitor;
|
||||
typedef Sweep_line_2<Traits_2, Visitor> Sweep_line;
|
||||
typedef Surface_sweep_2<Traits_2, Visitor> Surface_sweep;
|
||||
|
||||
Cci_pair itr_pair = traits.construct_curves_2_object()(pgn);
|
||||
Visitor visitor;
|
||||
Sweep_line sweep_line (&traits, &visitor);
|
||||
Surface_sweep sweep_line (&traits, &visitor);
|
||||
|
||||
visitor.sweep(itr_pair.first, itr_pair.second);
|
||||
if (!visitor.is_valid()) {
|
||||
|
|
@ -495,7 +491,7 @@ bool is_relatively_simple_polygon_with_holes
|
|||
|
||||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef Gps_polygon_validation_visitor<Traits_2> Visitor;
|
||||
typedef Sweep_line_2<Traits_2, Visitor> Sweep_line;
|
||||
typedef Surface_sweep_2<Traits_2, Visitor> Surface_sweep;
|
||||
typedef typename Traits_2::Polygon_with_holes_2 Polygon_with_holes_2;
|
||||
|
||||
Construct_curves_2 construct_curves_func = traits.construct_curves_2_object();
|
||||
|
|
@ -506,7 +502,7 @@ bool is_relatively_simple_polygon_with_holes
|
|||
std::back_inserter(outer_curves));
|
||||
// Create visitor and sweep to verify outer boundary is relatively simple
|
||||
Visitor relative_visitor(false);
|
||||
Sweep_line sweep_line (&traits, &relative_visitor);
|
||||
Surface_sweep sweep_line (&traits, &relative_visitor);
|
||||
relative_visitor.sweep (outer_curves.begin(), outer_curves.end());
|
||||
if (!relative_visitor.is_valid()) {
|
||||
switch (relative_visitor.error_code()) {
|
||||
|
|
@ -627,7 +623,7 @@ bool are_holes_and_boundary_pairwise_disjoint
|
|||
Construct_polygon_with_holes_2;
|
||||
|
||||
typedef Gps_polygon_validation_visitor<Traits_2> Visitor;
|
||||
typedef Sweep_line_2<Traits_2, Visitor> Sweep_line ;
|
||||
typedef Surface_sweep_2<Traits_2, Visitor> Surface_sweep ;
|
||||
typedef typename Polygon_set_2::Arrangement_on_surface_2 Arrangement_2;
|
||||
|
||||
/* Should be perfored more efficeintly than using sweep and than
|
||||
|
|
@ -661,7 +657,7 @@ bool are_holes_and_boundary_pairwise_disjoint
|
|||
// Perform the sweep and check for curve intersections on the interior.
|
||||
// Traits_2 traits; moved to top, needed also for boundary.
|
||||
Visitor visitor(false);
|
||||
Sweep_line sweep_line(&traits, &visitor);
|
||||
Surface_sweep sweep_line(&traits, &visitor);
|
||||
visitor.sweep(curves.begin(), curves.end());
|
||||
if (!visitor.is_valid()) return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#endif
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Arr_circle_segment_traits_2.h>
|
||||
#include <CGAL/Sweep_line_2_algorithms.h>
|
||||
#include <CGAL/Surface_sweep_2_algorithms.h>
|
||||
#include <CGAL/Object.h>
|
||||
#include <CGAL/CGAL_Ipelet_base.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ PkgDescBegin and PkgDescEnd in the file ../PKG_NAME/doc/PKG_NAME/PackageDescript
|
|||
|
||||
If PKG_NAME is of the form A/B the selected file is
|
||||
../A/doc/B/PackageDescription.txt. This is to support packages like
|
||||
Sweep_line_2 and TDS_2 which don't reside in their own packages in the SCM.
|
||||
TDS_2, which don't reside in their own packages in the SCM.
|
||||
|
||||
### Footnotes ###
|
||||
|
||||
|
|
@ -83,4 +83,3 @@ try.
|
|||
## Package Overview ##
|
||||
|
||||
Build the Package Overview with the help of the Build System.
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ Principal_component_analysis
|
|||
STL_Extension
|
||||
Skin_surface_3
|
||||
Snap_rounding_2
|
||||
Sweep_line_2
|
||||
Surface_sweep_2
|
||||
Arrangement_on_surface_2
|
||||
Boolean_set_operations_2
|
||||
TDS_2
|
||||
|
|
@ -97,6 +97,3 @@ Barycentric_coordinates_2
|
|||
Surface_mesh
|
||||
Surface_mesh_shortest_path
|
||||
Polygon_mesh_processing
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ h1 {
|
|||
\section PartArrangements Arrangements
|
||||
|
||||
\package_listing{Arrangement_on_surface_2}
|
||||
\package_listing{Sweep_line_2}
|
||||
\package_listing{Surface_sweep_2}
|
||||
\package_listing{Snap_rounding_2}
|
||||
\package_listing{Envelope_2}
|
||||
\package_listing{Envelope_3}
|
||||
|
|
|
|||
|
|
@ -823,7 +823,7 @@ CGAL/Surface_mesh/Surface_mesh.h
|
|||
CGAL/Surface_mesh_traits_generator_3.h
|
||||
CGAL/Surface_mesh_vertex_base_3.h
|
||||
CGAL/surface_neighbor_coordinates_3.h
|
||||
CGAL/Sweep_line_2_algorithms.h
|
||||
CGAL/Surface_Sweep_2_algorithms.h
|
||||
CGAL/tags.h
|
||||
CGAL/Taucs_solver_traits.h
|
||||
CGAL/Tetrahedron_3.h
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ Surface_mesh_segmentation Triangulated Surface Mesh Segmentation
|
|||
Surface_mesh_shortest_path Triangulated Surface Mesh Shortest Paths
|
||||
Surface_mesh_simplification Triangulated Surface Mesh Simplification
|
||||
Surface_mesh_skeletonization Triangulated Surface Mesh Skeletonization
|
||||
Sweep_line_2 2D Intersection of Curves
|
||||
Surface_sweep_2 2D Intersection of Curves
|
||||
TDS_2 2D Triangulation Data Structure
|
||||
TDS_3 3D Triangulation Data Structure
|
||||
Three Three
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ Algebraic_foundations
|
|||
Circulator
|
||||
Stream_support
|
||||
Arrangement_on_surface_2
|
||||
Sweep_line_2
|
||||
Surface_sweep_2
|
||||
Spatial_searching
|
||||
|
|
|
|||
|
|
@ -12,11 +12,8 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// author(s) : Eli Packer <elip@post.tau.ac.il>
|
||||
|
||||
#ifndef CGAL_SNAP_ROUNDING_2_H
|
||||
#define CGAL_SNAP_ROUNDING_2_H
|
||||
|
||||
|
|
@ -28,7 +25,7 @@
|
|||
#include <CGAL/enum.h>
|
||||
#include <CGAL/predicates_on_points_2.h>
|
||||
#include <CGAL/intersection_2.h>
|
||||
#include <CGAL/Sweep_line_2_algorithms.h>
|
||||
#include <CGAL/Surface_sweep_2_algorithms.h>
|
||||
#include <list>
|
||||
#include <set>
|
||||
#include <CGAL/Snap_rounding_kd_2.h>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
namespace CGAL {
|
||||
/*!
|
||||
|
||||
\mainpage User Manual
|
||||
\anchor Chapter_2D_Intersection_of_Curves
|
||||
\anchor I1_ChapterSurfaceSweep
|
||||
|
||||
\cgalAutoToc
|
||||
\authors Baruch Zukerman, Ron Wein, and Efi Fogel
|
||||
|
||||
\section Surface_sweep_2Introduction Introduction
|
||||
|
||||
Let \f$ {\mathcal C} = \{C_1, C_2, \ldots, C_n\}\f$ be a set of
|
||||
curves. We wish to compute all intersection points between two curves
|
||||
in the set in an output-sensitive manner, without having to go over
|
||||
all \f$ O(n^2)\f$ curve pairs. To this end, we sweep an imaginary line
|
||||
\f$ l\f$ from \f$ x = -\infty\f$ to \f$ x = \infty\f$ over the
|
||||
plane. While sweeping the plane, we keep track of the order of curves
|
||||
intersecting it. This order changes at a finite number of <I>event
|
||||
points</I>, such that we only have to calculate the intersection
|
||||
points between two curves when they become contiguous. For more
|
||||
details on the <I>surface-sweep algorithm</I> see, for example,
|
||||
\cgalCite{bkos-cgaa-00}, Chapter 2.
|
||||
|
||||
This chapter describes three functions implemented using the
|
||||
surface-sweep algorithm: given a collection of input curves, compute all
|
||||
intersection points, compute the set of subcurves that are pairwise
|
||||
interior-disjoint induced by them, and checking whether there is at
|
||||
least one pair of curves among them that intersect in their interior.
|
||||
|
||||
The implementation is robust. It supports general curves and handles
|
||||
all degenerate cases, including overlapping curves, vertical segments,
|
||||
and tangency between curves. The robustness of the algorithm is
|
||||
guaranteed if the functions are instantiated with a traits class that
|
||||
employs certified computations. This traits class must be a model of
|
||||
the `ArrangementTraits_2` concept - see the Chapter \ref
|
||||
chapterArrangement_on_surface_2 "2D Arrangements" for more details.
|
||||
|
||||
The complexity of the surface-sweep algorithm is \f$ O((n +
|
||||
k)\log{n})\f$ where \f$ n\f$ is the number of the input curves and \f$
|
||||
k\f$ is the number of intersection points induced by these curves.
|
||||
|
||||
\section Surface_sweep_2Example Example
|
||||
|
||||
The simple program listed below computes intersection points induced by
|
||||
a set of four input segments illustrated in \cgalFigureRef{SL_secsimple}.
|
||||
|
||||
\cgalFigureBegin{SL_secsimple,sl_simple.png}
|
||||
Four input segments
|
||||
\cgalFigureEnd
|
||||
|
||||
\cgalExample{Surface_sweep_2/plane_sweep.cpp}
|
||||
|
||||
\section Surface_sweep_2Design Design and Implementation History
|
||||
|
||||
The current version of the surface-sweep algorithm was written by Efi
|
||||
Fogel, based on previous implementations by Baruch Ester Ezra, Tali
|
||||
Zvi, and Baruch Zukerman.
|
||||
|
||||
*/
|
||||
} /* namespace CGAL */
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
/*!
|
||||
\example Surface_sweep_2/plane_sweep.cpp
|
||||
*/
|
||||
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
|
@ -1,7 +1,7 @@
|
|||
# Created by the script cgal_create_CMakeLists
|
||||
# This is the CMake script for compiling a set of CGAL applications.
|
||||
|
||||
project( Sweep_line_2_Examples )
|
||||
project( Surface_sweep_2_Examples )
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 2.6.2)
|
||||
|
|
@ -56,8 +56,4 @@ include_directories( BEFORE ../../include )
|
|||
include( CGAL_CreateSingleSourceCGALProgram )
|
||||
|
||||
|
||||
create_single_source_cgal_program( "sweep_line.cpp" )
|
||||
|
||||
|
||||
|
||||
|
||||
create_single_source_cgal_program( "plane_sweep.cpp" )
|
||||
|
|
@ -1,18 +1,16 @@
|
|||
//! \file examples/Arrangement_on_surface_2/sweep_line.cpp
|
||||
//! \file examples/Arrangement_on_surface_2/plane_sweep.cpp
|
||||
// Computing intersection points among curves using the sweep line.
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/MP_Float.h>
|
||||
#include <CGAL/Quotient.h>
|
||||
#include <CGAL/Arr_segment_traits_2.h>
|
||||
#include <CGAL/Sweep_line_2_algorithms.h>
|
||||
#include <list>
|
||||
|
||||
typedef CGAL::Quotient<CGAL::MP_Float> NT;
|
||||
typedef CGAL::Cartesian<NT> Kernel;
|
||||
typedef Kernel::Point_2 Point_2;
|
||||
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
|
||||
typedef Traits_2::Curve_2 Segment_2;
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Arr_segment_traits_2.h>
|
||||
#include <CGAL/Surface_sweep_2_algorithms.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
|
||||
typedef Kernel::Point_2 Point_2;
|
||||
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
|
||||
typedef Traits_2::Curve_2 Segment_2;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
|
@ -23,10 +21,10 @@ int main()
|
|||
Segment_2 (Point_2 (8, 5), Point_2 (8, 8))};
|
||||
|
||||
// Compute all intersection points.
|
||||
std::list<Point_2> pts;
|
||||
std::list<Point_2> pts;
|
||||
|
||||
CGAL::compute_intersection_points (segments, segments + 4,
|
||||
std::back_inserter (pts));
|
||||
CGAL::compute_intersection_points(segments, segments + 4,
|
||||
std::back_inserter(pts));
|
||||
|
||||
// Print the result.
|
||||
std::cout << "Found " << pts.size() << " intersection points: " << std::endl;
|
||||
|
|
@ -34,14 +32,14 @@ int main()
|
|||
std::ostream_iterator<Point_2>(std::cout, "\n"));
|
||||
|
||||
// Compute the non-intersecting sub-segments induced by the input segments.
|
||||
std::list<Segment_2> sub_segs;
|
||||
std::list<Segment_2> sub_segs;
|
||||
|
||||
CGAL::compute_subcurves(segments, segments + 4, std::back_inserter(sub_segs));
|
||||
|
||||
std::cout << "Found " << sub_segs.size()
|
||||
<< " interior-disjoint sub-segments." << std::endl;
|
||||
|
||||
CGAL_assertion (CGAL::do_curves_intersect (segments, segments + 4));
|
||||
CGAL_assertion(CGAL::do_curves_intersect (segments, segments + 4));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -19,20 +19,18 @@
|
|||
#ifndef CGAL_BASIC_SWEEP_LINE_2_H
|
||||
#define CGAL_BASIC_SWEEP_LINE_2_H
|
||||
|
||||
#include <CGAL/license/Arrangement_on_surface_2.h>
|
||||
|
||||
|
||||
/*! \file
|
||||
* Definition of the Basic_sweep_line_2 class.
|
||||
* Definition of the No_intersection_surface_sweep_2 class.
|
||||
*/
|
||||
// #include <cstdint>
|
||||
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
#include <CGAL/assertions.h>
|
||||
#include <CGAL/memory.h>
|
||||
#include <CGAL/Sweep_line_2/Sweep_line_functors.h>
|
||||
#include <CGAL/Sweep_line_2/Sweep_line_subcurve.h>
|
||||
#include <CGAL/Sweep_line_2/Sweep_line_event.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_functors.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_subcurve.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_event.h>
|
||||
#include <CGAL/Multiset.h>
|
||||
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
|
||||
#include <CGAL/Arr_tags.h>
|
||||
|
|
@ -104,7 +102,7 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
/*! \class Basic_Sweep_line_2
|
||||
/*! \class No_intersection_surface_sweep_2
|
||||
* A class that implements the sweep line algorithm for general x-monotone
|
||||
* curves that are pairwise disjoint in their interiors (an additional set
|
||||
* of isolated points may also be supplied).
|
||||
|
|
@ -113,10 +111,10 @@ namespace CGAL {
|
|||
*/
|
||||
template <typename Traits_,
|
||||
typename Visitor_,
|
||||
typename Subcurve_ = Sweep_line_subcurve<Traits_>,
|
||||
typename Event_ = Sweep_line_event<Traits_, Subcurve_>,
|
||||
typename Subcurve_ = Surface_sweep_subcurve<Traits_>,
|
||||
typename Event_ = Surface_sweep_event<Traits_, Subcurve_>,
|
||||
typename Allocator_ = CGAL_ALLOCATOR(int)>
|
||||
class Basic_sweep_line_2 {
|
||||
class No_intersection_surface_sweep_2 {
|
||||
public:
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Visitor_ Visitor;
|
||||
|
|
@ -155,10 +153,10 @@ public:
|
|||
typedef typename Event::Subcurve_const_iterator
|
||||
Event_subcurve_const_iterator;
|
||||
|
||||
typedef Sweep_line_event<Traits_2, Subcurve> Base_event;
|
||||
typedef Surface_sweep_event<Traits_2, Subcurve> Base_event;
|
||||
typedef typename Base_event::Attribute Attribute;
|
||||
|
||||
typedef Sweep_line_subcurve<Traits_2> Base_subcurve;
|
||||
typedef Surface_sweep_subcurve<Traits_2> Base_subcurve;
|
||||
typedef class Curve_comparer<Traits_2, Base_subcurve> Compare_curves;
|
||||
typedef Multiset<Base_subcurve*,
|
||||
Compare_curves,
|
||||
|
|
@ -232,16 +230,16 @@ public:
|
|||
/*! Constructor.
|
||||
* \param visitor A pointer to a sweep-line visitor object.
|
||||
*/
|
||||
Basic_sweep_line_2(Visitor* visitor);
|
||||
No_intersection_surface_sweep_2(Visitor* visitor);
|
||||
|
||||
/*! Constructor with a traits class.
|
||||
* \param traits A pointer to a sweep-line traits object.
|
||||
* \param visitor A pointer to a sweep-line visitor object.
|
||||
*/
|
||||
Basic_sweep_line_2(const Traits_2* traits, Visitor* visitor);
|
||||
No_intersection_surface_sweep_2(const Traits_2* traits, Visitor* visitor);
|
||||
|
||||
/*! Destructor. */
|
||||
virtual ~Basic_sweep_line_2();
|
||||
virtual ~No_intersection_surface_sweep_2();
|
||||
|
||||
/*! Run the sweep-line algorithm on a given range of x-monotone curves.
|
||||
* \param curves_begin An iterator for the first curve in the range.
|
||||
|
|
@ -556,11 +554,11 @@ protected:
|
|||
|
||||
//DEBUG UTILITIES
|
||||
#ifdef CGAL_SL_VERBOSE
|
||||
#include <CGAL/Sweep_line_2/Sweep_line_2_debug.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_2_debug.h>
|
||||
#endif
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#include <CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h>
|
||||
#include <CGAL/Surface_sweep_2/No_intersection_surface_sweep_2_impl.h>
|
||||
|
||||
#endif
|
||||
|
|
@ -16,26 +16,27 @@
|
|||
// Efi Fogel <efifogel@gmail.com>
|
||||
// (based on old version by Tali Zvi)
|
||||
|
||||
#ifndef CGAL_SWEEP_LINE_2_H
|
||||
#define CGAL_SWEEP_LINE_2_H
|
||||
#ifndef CGAL_SURFACE_SWEEP_2_H
|
||||
#define CGAL_SURFACE_SWEEP_2_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
/*! \file
|
||||
* Definition of the Sweep_line_2 class.
|
||||
* Definition of the Surface_sweep_2 class.
|
||||
*/
|
||||
|
||||
#include <list>
|
||||
|
||||
#include <CGAL/Object.h>
|
||||
#include <CGAL/Basic_sweep_line_2.h>
|
||||
#include <CGAL/Sweep_line_2/Sweep_line_curve_pair.h>
|
||||
#include <CGAL/No_intersection_surface_sweep_2.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_curve_pair.h>
|
||||
#include <CGAL/Arrangement_2/Open_hash.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
/*! \class
|
||||
* Sweep_line_2 is a class that implements the sweep line algorithm based
|
||||
* Surface_sweep_2 is a class that implements the sweep line algorithm based
|
||||
* on the algorithm of Bentley and Ottmann.
|
||||
* It extends the algorithm to support not only segments but general x-monotone
|
||||
* curves as well and isolated points.
|
||||
|
|
@ -74,25 +75,26 @@ namespace CGAL {
|
|||
*/
|
||||
|
||||
template <typename Traits_, typename Visitor_,
|
||||
typename Subcurve_ = Sweep_line_subcurve<Traits_>,
|
||||
typename Event_ = Sweep_line_event<Traits_, Subcurve_>,
|
||||
typename Subcurve_ = Surface_sweep_subcurve<Traits_>,
|
||||
typename Event_ = Surface_sweep_event<Traits_, Subcurve_>,
|
||||
typename Allocator_ = CGAL_ALLOCATOR(int) >
|
||||
class Sweep_line_2 :
|
||||
public Basic_sweep_line_2<Traits_, Visitor_, Subcurve_, Event_, Allocator_>
|
||||
class Surface_sweep_2 :
|
||||
public No_intersection_surface_sweep_2<Traits_, Visitor_, Subcurve_,
|
||||
Event_, Allocator_>
|
||||
{
|
||||
public:
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Visitor_ Visitor;
|
||||
typedef Event_ Event;
|
||||
typedef Subcurve_ Subcurve;
|
||||
typedef Allocator_ Allocator;
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Visitor_ Visitor;
|
||||
typedef Event_ Event;
|
||||
typedef Subcurve_ Subcurve;
|
||||
typedef Allocator_ Allocator;
|
||||
|
||||
typedef Basic_sweep_line_2<Traits_2, Visitor, Subcurve, Event, Allocator>
|
||||
Base;
|
||||
typedef No_intersection_surface_sweep_2<Traits_2, Visitor, Subcurve, Event,
|
||||
Allocator> Base;
|
||||
|
||||
typedef typename Base::Traits_adaptor_2 Traits_adaptor_2;
|
||||
typedef typename Traits_adaptor_2::Point_2 Point_2;
|
||||
typedef typename Traits_adaptor_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Base::Traits_adaptor_2 Traits_adaptor_2;
|
||||
typedef typename Traits_adaptor_2::Point_2 Point_2;
|
||||
typedef typename Traits_adaptor_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
|
||||
typedef typename Base::Event_queue_iterator Event_queue_iterator;
|
||||
typedef typename Event::Subcurve_iterator Event_subcurve_iterator;
|
||||
|
|
@ -135,20 +137,20 @@ public:
|
|||
/*! Constructor.
|
||||
* \param visitor A pointer to a sweep-line visitor object.
|
||||
*/
|
||||
Sweep_line_2(Visitor* visitor) : Base(visitor), m_curves_pair_set(0) {}
|
||||
Surface_sweep_2(Visitor* visitor) : Base(visitor), m_curves_pair_set(0) {}
|
||||
|
||||
/*!
|
||||
* Construct.
|
||||
* \param traits A pointer to a sweep-line traits object.
|
||||
* \param visitor A pointer to a sweep-line visitor object.
|
||||
*/
|
||||
Sweep_line_2(const Traits_2* traits, Visitor* visitor) :
|
||||
Surface_sweep_2(const Traits_2* traits, Visitor* visitor) :
|
||||
Base(traits, visitor),
|
||||
m_curves_pair_set(0)
|
||||
{}
|
||||
|
||||
/*! Destrcut. */
|
||||
virtual ~Sweep_line_2() {}
|
||||
virtual ~Surface_sweep_2() {}
|
||||
|
||||
protected:
|
||||
|
||||
|
|
@ -224,6 +226,6 @@ protected:
|
|||
} //namespace CGAL
|
||||
|
||||
// The member-function definitions can be found in:
|
||||
#include <CGAL/Sweep_line_2/Sweep_line_2_impl.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_2_impl.h>
|
||||
|
||||
#endif
|
||||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
|
@ -23,7 +19,7 @@
|
|||
#ifndef CGAL_ARR_BASIC_INSERTION_SL_VISITOR_H
|
||||
#define CGAL_ARR_BASIC_INSERTION_SL_VISITOR_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
/*!
|
||||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
|
@ -24,7 +20,7 @@
|
|||
#ifndef CGAL_ARR_BASIC_INSERTION_TRAITS_2_H
|
||||
#define CGAL_ARR_BASIC_INSERTION_TRAITS_2_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
/*!
|
||||
|
|
@ -80,8 +76,8 @@ public:
|
|||
typedef typename internal::Arr_complete_right_side_category< Traits_2 >::Category
|
||||
Right_side_category;
|
||||
|
||||
/* Insertion is implemented as sweep-line visitor. The sweep-line algorithm
|
||||
* never uses Compare_y_at_x_left_2.
|
||||
/* Insertion is implemented as surface-sweep visitor. The surface-sweep
|
||||
* algorithm never uses Compare_y_at_x_left_2.
|
||||
*/
|
||||
typedef Tag_false Has_left_category;
|
||||
|
||||
|
|
@ -12,18 +12,13 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
|
||||
#ifndef CGAL_ARR_BATCHED_PL_SL_VISITOR_H
|
||||
#define CGAL_ARR_BATCHED_PL_SL_VISITOR_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
/*!
|
||||
* Definition of the Arr_batched_pl_sl_visitor class-template.
|
||||
|
|
@ -38,10 +33,10 @@
|
|||
namespace CGAL {
|
||||
|
||||
/*! \class Arr_batched_pl_sl_visitor
|
||||
* A sweep-line 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.
|
||||
*/
|
||||
template <class Helper_, class OutputIterator_>
|
||||
template <typename Helper_, typename OutputIterator_>
|
||||
class Arr_batched_pl_sl_visitor : public Helper_::Base_visitor {
|
||||
public:
|
||||
typedef Helper_ Helper;
|
||||
|
|
@ -64,16 +59,15 @@ protected:
|
|||
typedef typename Pl_result::Type Pl_result_type;
|
||||
|
||||
// Data members:
|
||||
Helper m_helper; // The helper class.
|
||||
OutputIterator& m_out; // An output iterator for the result.
|
||||
Helper m_helper; // The helper class.
|
||||
OutputIterator& m_out; // An output iterator for the result.
|
||||
|
||||
template<typename T>
|
||||
Pl_result_type pl_make_result(T t) { return Pl_result::make_result(t); }
|
||||
inline Pl_result_type pl_default_result() { return Pl_result::default_result(); }
|
||||
|
||||
public:
|
||||
/*!
|
||||
* Constructor.
|
||||
/*! Constructor.
|
||||
* \param arr The arrangement.
|
||||
* \param oi A pointer to the output iterator that will store the result.
|
||||
*/
|
||||
|
|
@ -85,11 +79,10 @@ public:
|
|||
/* A notification issued before the sweep process starts. */
|
||||
void before_sweep();
|
||||
|
||||
/*!
|
||||
* A notification invoked after the sweep-line finishes handling the given
|
||||
/*! A notification invoked after the surface-sweep finishes handling the given
|
||||
* event.
|
||||
* \param event The event.
|
||||
* \param above An iterator to the sweep-line subcurves lying right above
|
||||
* \param above An iterator to the surface-sweep subcurves lying right above
|
||||
* (or on) the event point.
|
||||
* \param on_above Whether the event is locates on the subcurve above it.
|
||||
*/
|
||||
|
|
@ -113,7 +106,7 @@ void Arr_batched_pl_sl_visitor<Hlpr, OutIt>::before_sweep()
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// A notification invoked after the sweep-line finishes handling the given
|
||||
// A notification invoked after the surface-sweep finishes handling the given
|
||||
// event.
|
||||
//
|
||||
template <class Hlpr, class OutIt>
|
||||
|
|
@ -124,8 +117,7 @@ after_handle_event(Event* event, Status_line_iterator above, bool on_above)
|
|||
m_helper.after_handle_event(event);
|
||||
|
||||
// We are only interested in events associated with query points:
|
||||
if (! event->is_query())
|
||||
return true;
|
||||
if (! event->is_query()) return true;
|
||||
|
||||
// Check on what kind of feature does the current query point lie.
|
||||
if (event->is_action()) {
|
||||
|
|
@ -177,7 +169,7 @@ after_handle_event(Event* event, Status_line_iterator above, bool on_above)
|
|||
// If we reached here, the status-line iterator refers to a halfedge above
|
||||
// the query point, such that the query point is located in the incident
|
||||
// face of this halfedge.
|
||||
Halfedge_const_handle he = (*above)->last_curve().halfedge_handle();
|
||||
Halfedge_const_handle he = (*above)->last_curve().halfedge_handle();
|
||||
*m_out++ = std::make_pair(event->point().base(), pl_make_result(he->face()));
|
||||
return true;
|
||||
}
|
||||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Tali Zvi <talizvi@post.tau.ac.il>
|
||||
// Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
|
@ -23,14 +19,14 @@
|
|||
#ifndef CGAL_ARR_CONSTRUCTION_EVENT_H
|
||||
#define CGAL_ARR_CONSTRUCTION_EVENT_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
/*! \file
|
||||
* Definition of the Arr_construction_event class-template.
|
||||
*/
|
||||
|
||||
#include <CGAL/Sweep_line_2/Sweep_line_event.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_event.h>
|
||||
#include <CGAL/assertions.h>
|
||||
#include <vector>
|
||||
|
||||
|
|
@ -39,7 +35,7 @@ namespace CGAL {
|
|||
/*! \class Arr_construction_event
|
||||
*
|
||||
* Stores the data associated with an event.
|
||||
* In addition to the information stored in Sweep_line_event, when
|
||||
* In addition to the information stored in Surface_sweep_event, when
|
||||
* constructing an arrangement, additional information is kept, in
|
||||
* order to speed insertion of curves into the planar map.
|
||||
*
|
||||
|
|
@ -48,16 +44,15 @@ namespace CGAL {
|
|||
* was inserted into the arrangement at any given time and when there no
|
||||
* left curves, we keep the highest halfedge that was inseted to the right.
|
||||
*
|
||||
* Inherits from `Sweep_line_event`.
|
||||
* \sa `Sweep_line_event`
|
||||
* Inherits from `Surface_sweep_event`.
|
||||
* \sa `Surface_sweep_event`
|
||||
*/
|
||||
|
||||
template<class Traits_, class Subcurve_, class Arrangement_>
|
||||
class Arr_construction_event :
|
||||
public Sweep_line_event<Traits_, Subcurve_>
|
||||
public Surface_sweep_event<Traits_, Subcurve_>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Subcurve_ Subcurve;
|
||||
typedef Arrangement_ Arrangement_2;
|
||||
|
|
@ -67,28 +62,25 @@ public:
|
|||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Traits_2::Point_2 Point_2;
|
||||
|
||||
typedef Sweep_line_event<Traits_2,
|
||||
Subcurve> Base;
|
||||
typedef Surface_sweep_event<Traits_2, Subcurve> Base;
|
||||
|
||||
typedef Arr_construction_event<Traits_2,
|
||||
Subcurve,
|
||||
Halfedge_handle> Self;
|
||||
typedef Arr_construction_event<Traits_2, Subcurve, Halfedge_handle>
|
||||
Self;
|
||||
|
||||
typedef typename Base::Subcurve_container Subcurve_container;
|
||||
typedef typename Base::Subcurve_iterator Subcurve_iterator;
|
||||
typedef typename Base::Subcurve_reverse_iterator Subcurve_reverse_iterator;
|
||||
|
||||
protected:
|
||||
|
||||
// Data members:
|
||||
std::vector<bool> m_isCurveInArr; // Stores for each incident
|
||||
std::vector<bool> m_isCurveInArr; // Stores for each incident
|
||||
// subcurve whether it has been
|
||||
// inserted into the arrangement.
|
||||
|
||||
Halfedge_handle m_halfedge; // A halfedge handle.
|
||||
Vertex_handle m_vertex; // A vertex handle.
|
||||
Halfedge_handle m_halfedge; // A halfedge handle.
|
||||
Vertex_handle m_vertex; // A vertex handle.
|
||||
|
||||
unsigned int m_right_curves_counter; // Number of subcurves defined
|
||||
unsigned int m_right_curves_counter; // Number of subcurves defined
|
||||
// to the event's right that
|
||||
// haven't been added to the
|
||||
// arrangement, when that counter
|
||||
|
|
@ -96,7 +88,6 @@ protected:
|
|||
// event.
|
||||
|
||||
public:
|
||||
|
||||
/*! Default constructor. */
|
||||
Arr_construction_event():
|
||||
m_halfedge(),
|
||||
|
|
@ -105,13 +96,11 @@ public:
|
|||
{}
|
||||
|
||||
/*! Destructor */
|
||||
~Arr_construction_event()
|
||||
{}
|
||||
~Arr_construction_event() {}
|
||||
|
||||
/*! Add a curve to the right of the event. */
|
||||
std::pair<bool, Subcurve_iterator>
|
||||
add_curve_to_right (Subcurve *curve,
|
||||
const Traits_2 * tr)
|
||||
add_curve_to_right(Subcurve* curve, const Traits_2* tr)
|
||||
{
|
||||
std::pair<bool,Subcurve_iterator> res =
|
||||
Base::add_curve_to_right(curve, tr);
|
||||
|
|
@ -124,7 +113,7 @@ public:
|
|||
|
||||
/*! Add a curve pair to the right of the event. */
|
||||
std::pair<bool, Subcurve_iterator>
|
||||
add_curve_pair_to_right (Subcurve *sc1, Subcurve *sc2)
|
||||
add_curve_pair_to_right(Subcurve* sc1, Subcurve* sc2)
|
||||
{
|
||||
//increment twice the counter of right curves
|
||||
m_right_curves_counter+=2;
|
||||
|
|
@ -138,45 +127,36 @@ public:
|
|||
*/
|
||||
int compute_halfedge_jump_count(Subcurve *curve)
|
||||
{
|
||||
int i = 0;
|
||||
int skip = 0;
|
||||
int counter = 0;
|
||||
int i = 0;
|
||||
int skip = 0;
|
||||
int counter = 0;
|
||||
unsigned int j;
|
||||
|
||||
for (j = 0 ; j < m_isCurveInArr.size() ; j++ )
|
||||
{
|
||||
if (m_isCurveInArr[j])
|
||||
skip++;
|
||||
for (j = 0 ; j < m_isCurveInArr.size() ; j++) {
|
||||
if (m_isCurveInArr[j]) skip++;
|
||||
}
|
||||
skip--; // now 'skip' holds the amount of the right curves of the event
|
||||
// that are already inserted to the planar map - 1 (minus 1)
|
||||
|
||||
Subcurve_iterator iter = this->m_rightCurves.end();
|
||||
Subcurve_iterator iter = this->m_rightCurves.end();
|
||||
size_t num_left_curves = this->number_of_left_curves();
|
||||
|
||||
for (--iter; iter != this->m_rightCurves.begin() ; --iter, ++counter)
|
||||
{
|
||||
if (curve == (*iter))
|
||||
{
|
||||
for (--iter; iter != this->m_rightCurves.begin() ; --iter, ++counter) {
|
||||
if (curve == (*iter)) {
|
||||
m_isCurveInArr[counter] = true;
|
||||
|
||||
if ((i == 0) && (num_left_curves == 0))
|
||||
return (skip);
|
||||
if (num_left_curves == 0)
|
||||
return (i - 1);
|
||||
|
||||
if ((i == 0) && (num_left_curves == 0)) return (skip);
|
||||
if (num_left_curves == 0) return (i - 1);
|
||||
return (i);
|
||||
}
|
||||
|
||||
if (m_isCurveInArr[counter])
|
||||
i++;
|
||||
if (m_isCurveInArr[counter]) i++;
|
||||
}
|
||||
|
||||
CGAL_assertion(curve == (*iter));
|
||||
m_isCurveInArr[counter] = true;
|
||||
|
||||
if (num_left_curves == 0)
|
||||
i--;
|
||||
if (num_left_curves == 0) i--;
|
||||
|
||||
return (i);
|
||||
}
|
||||
|
|
@ -194,8 +174,7 @@ public:
|
|||
rev_iter != this->m_rightCurves.rend() && curve != (*rev_iter) ;
|
||||
++rev_iter, ++ counter)
|
||||
{
|
||||
if(m_isCurveInArr[counter] == true)
|
||||
return false;
|
||||
if (m_isCurveInArr[counter] == true) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -205,65 +184,44 @@ public:
|
|||
* in the arrangement, and set all flags to false.
|
||||
*/
|
||||
void init_subcurve_in_arrangement_flags (size_t n)
|
||||
{
|
||||
m_isCurveInArr.resize (n, false);
|
||||
return;
|
||||
}
|
||||
{ m_isCurveInArr.resize (n, false); }
|
||||
|
||||
/*! Check if the i'th subcurve is in the arrangement. */
|
||||
bool is_subcurve_in_arrangement (unsigned int i) const
|
||||
{
|
||||
return (m_isCurveInArr[i]);
|
||||
}
|
||||
{ return (m_isCurveInArr[i]); }
|
||||
|
||||
/*!
|
||||
* Set the flag indicating whether the i'th subcurve is in the arrangement.
|
||||
*/
|
||||
void set_subcurve_in_arrangement (unsigned int i, bool flag)
|
||||
{
|
||||
m_isCurveInArr[i] = flag;
|
||||
return;
|
||||
}
|
||||
{ m_isCurveInArr[i] = flag; }
|
||||
|
||||
/*! Set the halfedge handle. */
|
||||
void set_halfedge_handle (Halfedge_handle h)
|
||||
{
|
||||
m_halfedge = h;
|
||||
}
|
||||
{ m_halfedge = h; }
|
||||
|
||||
/*! Get the halfedge handle. */
|
||||
Halfedge_handle halfedge_handle() const
|
||||
{
|
||||
return m_halfedge;
|
||||
}
|
||||
{ return m_halfedge; }
|
||||
|
||||
/*! Set the vertex handle. */
|
||||
void set_vertex_handle (Vertex_handle v)
|
||||
{
|
||||
m_vertex = v;
|
||||
}
|
||||
{ m_vertex = v; }
|
||||
|
||||
/*! Get the vertex handle. */
|
||||
Vertex_handle vertex_handle() const
|
||||
{
|
||||
return m_vertex;
|
||||
}
|
||||
{ return m_vertex; }
|
||||
|
||||
/*! Decrement the count of curves to the right that we have't done yet with
|
||||
* (haven't been inserted to the arrangement). */
|
||||
unsigned int dec_right_curves_counter()
|
||||
{
|
||||
return (--m_right_curves_counter);
|
||||
}
|
||||
{ return (--m_right_curves_counter); }
|
||||
|
||||
/*! Get the number of subcurves to the right of the event that we have't
|
||||
* done yet with (haven't been inserted to the arrangement).
|
||||
*/
|
||||
unsigned int right_curves_counter() const
|
||||
{
|
||||
return (m_right_curves_counter);
|
||||
}
|
||||
|
||||
{ return (m_right_curves_counter); }
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efifogel@gmail.com>
|
||||
|
|
@ -23,7 +19,7 @@
|
|||
#ifndef CGAL_ARR_CONSTRUCTION_SL_VISITOR_H
|
||||
#define CGAL_ARR_CONSTRUCTION_SL_VISITOR_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
#ifndef CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE
|
||||
|
|
@ -12,24 +12,20 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Tali Zvi <talizvi@post.tau.ac.il>
|
||||
// Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
|
||||
#ifndef CGAL_ARR_CONSTRUCTION_SUBCURVE_H
|
||||
#define CGAL_ARR_CONSTRUCTION_SUBCURVE_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
/*! \file
|
||||
* Definition of the Arr_construction_subcurve class-template.
|
||||
*/
|
||||
|
||||
#include <CGAL/Sweep_line_2/Sweep_line_subcurve.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_subcurve.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -37,24 +33,24 @@ namespace CGAL {
|
|||
*
|
||||
* a class that holds information about a curve that is added to
|
||||
* the arrangement.
|
||||
* In addition to the information that is contained in Sweep_line_subcurve,
|
||||
* In addition to the information that is contained in Surface_sweep_subcurve,
|
||||
* when an arrangement is constructed, a pointer to the last handled event
|
||||
* on the curve is stored. This information is used to retrieve
|
||||
* hints when a subcurve of this curve is inserted into the planar map.
|
||||
*
|
||||
* Inherits from `Sweep_line_subcurve`
|
||||
* \sa `Sweep_line_subcurve`
|
||||
* Inherits from `Surface_sweep_subcurve`
|
||||
* \sa `Surface_sweep_subcurve`
|
||||
*/
|
||||
|
||||
template <typename Traits_>
|
||||
class Arr_construction_subcurve : public Sweep_line_subcurve<Traits_>
|
||||
class Arr_construction_subcurve : public Surface_sweep_subcurve<Traits_>
|
||||
{
|
||||
public:
|
||||
typedef Traits_ Traits_2;
|
||||
typedef typename Traits_2::Point_2 Point_2;
|
||||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
|
||||
typedef Sweep_line_subcurve<Traits_2> Base;
|
||||
typedef Surface_sweep_subcurve<Traits_2> Base;
|
||||
typedef Arr_construction_subcurve<Traits_2> Self;
|
||||
|
||||
typedef typename Base::Status_line_iterator Status_line_iterator;
|
||||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Ron Wein <baruchzu@post.tau.ac.il>
|
||||
// Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
|
||||
|
|
@ -26,8 +22,7 @@
|
|||
#ifndef CGAL_ARR_DEFAULT_OVERLAY_TRAITS_BASE_H
|
||||
#define CGAL_ARR_DEFAULT_OVERLAY_TRAITS_BASE_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -12,9 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
|
@ -22,14 +19,14 @@
|
|||
#ifndef CGAL_ARR_INSERTION_SL_VISITOR_H
|
||||
#define CGAL_ARR_INSERTION_SL_VISITOR_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
/*!
|
||||
* Definition of the Arr_insertion_sl_visitor class-template.
|
||||
*/
|
||||
|
||||
#include <CGAL/Sweep_line_2/Arr_basic_insertion_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_basic_insertion_sl_visitor.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -61,7 +58,7 @@ private:
|
|||
|
||||
public:
|
||||
/*! Constructor. */
|
||||
Arr_insertion_sl_visitor (Arrangement_2* arr) : Base(arr) {}
|
||||
Arr_insertion_sl_visitor(Arrangement_2* arr) : Base(arr) {}
|
||||
|
||||
/// \name Edge-split functions (to be overridden by the child visitor).
|
||||
//@{
|
||||
|
|
@ -12,24 +12,20 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
||||
#ifndef CGAL_ARR_INSERTION_TRAITS_2_H
|
||||
#define CGAL_ARR_INSERTION_TRAITS_2_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
/*!
|
||||
* Defintion of the Arr_insertion_traits_2<Traits,Arrangement> class.
|
||||
*/
|
||||
|
||||
#include <CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -43,7 +39,6 @@ class Arr_insertion_traits_2 :
|
|||
public Arr_basic_insertion_traits_2<Traits_, Arrangement_>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Arr_basic_insertion_traits_2<Traits_, Arrangement_> Base;
|
||||
|
||||
|
|
@ -92,7 +87,7 @@ public:
|
|||
* obtaining function, which is a member of the nesting class,
|
||||
* constructing it.
|
||||
*/
|
||||
Intersect_2 (const Base_intersect_2& base) :
|
||||
Intersect_2(const Base_intersect_2& base) :
|
||||
m_base_intersect (base),
|
||||
invalid_he()
|
||||
{}
|
||||
|
|
@ -102,52 +97,47 @@ public:
|
|||
|
||||
public:
|
||||
template<typename OutputIterator>
|
||||
OutputIterator operator() (const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
OutputIterator oi)
|
||||
OutputIterator operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
OutputIterator oi)
|
||||
{
|
||||
if(cv1.halfedge_handle() != invalid_he &&
|
||||
cv2.halfedge_handle() != invalid_he)
|
||||
if ((cv1.halfedge_handle() != invalid_he) &&
|
||||
(cv2.halfedge_handle() != invalid_he))
|
||||
{
|
||||
// The curves are interior-disjoint as both of them are already in
|
||||
// the arrangement.
|
||||
return (oi);
|
||||
}
|
||||
|
||||
OutputIterator oi_end = m_base_intersect(cv1.base(),
|
||||
cv2.base(), oi);
|
||||
const Base_x_monotone_curve_2 *base_overlap_cv;
|
||||
const std::pair<Base_point_2, unsigned int> *intersect_p;
|
||||
OutputIterator oi_end = m_base_intersect(cv1.base(), cv2.base(), oi);
|
||||
const Base_x_monotone_curve_2* base_overlap_cv;
|
||||
const std::pair<Base_point_2, unsigned int>* intersect_p;
|
||||
|
||||
// convert objects that are associated with Base_x_monotone_curve_2 to
|
||||
// X_monotone_curve_2
|
||||
for(; oi != oi_end; ++oi)
|
||||
{
|
||||
base_overlap_cv = object_cast<Base_x_monotone_curve_2> (&(*oi));
|
||||
if (base_overlap_cv != NULL)
|
||||
{
|
||||
for(; oi != oi_end; ++oi) {
|
||||
base_overlap_cv = object_cast<Base_x_monotone_curve_2>(&(*oi));
|
||||
if (base_overlap_cv != NULL) {
|
||||
// Add halfedge handles to the resulting curve.
|
||||
Halfedge_handle he;
|
||||
Halfedge_handle he;
|
||||
|
||||
if (cv1.halfedge_handle() != invalid_he)
|
||||
he = cv1.halfedge_handle();
|
||||
if (cv1.halfedge_handle() != invalid_he) he = cv1.halfedge_handle();
|
||||
else if (cv2.halfedge_handle() != invalid_he)
|
||||
he = cv2.halfedge_handle();
|
||||
|
||||
X_monotone_curve_2 overlap_cv (*base_overlap_cv, he);
|
||||
X_monotone_curve_2 overlap_cv (*base_overlap_cv, he);
|
||||
|
||||
overlap_cv.set_overlapping();
|
||||
*oi = make_object (overlap_cv);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
intersect_p =
|
||||
object_cast<std::pair<Base_point_2, unsigned int> > (&(*oi));
|
||||
|
||||
CGAL_assertion (intersect_p != NULL);
|
||||
|
||||
*oi = make_object (std::make_pair (Point_2(intersect_p->first),
|
||||
intersect_p->second));
|
||||
*oi = make_object(std::make_pair(Point_2(intersect_p->first),
|
||||
intersect_p->second));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -158,9 +148,7 @@ public:
|
|||
|
||||
/*! Obtain a Intersect_2 function object */
|
||||
Intersect_2 intersect_2_object () const
|
||||
{
|
||||
return (Intersect_2 (this->m_base_traits->intersect_2_object()));
|
||||
}
|
||||
{ return (Intersect_2 (this->m_base_traits->intersect_2_object())); }
|
||||
|
||||
/*! A functor that splits an arc at a point. */
|
||||
class Split_2 {
|
||||
|
|
@ -179,8 +167,8 @@ public:
|
|||
friend class Arr_insertion_traits_2<Traits_2, Arrangement_>;
|
||||
|
||||
public:
|
||||
void operator() (const X_monotone_curve_2& cv, const Point_2 & p,
|
||||
X_monotone_curve_2& c1, X_monotone_curve_2& c2)
|
||||
void operator()(const X_monotone_curve_2& cv, const Point_2 & p,
|
||||
X_monotone_curve_2& c1, X_monotone_curve_2& c2)
|
||||
{
|
||||
m_base_split(cv.base(), p.base(), c1.base(), c2.base());
|
||||
c1.set_halfedge_handle(cv.halfedge_handle());
|
||||
|
|
@ -189,10 +177,8 @@ public:
|
|||
};
|
||||
|
||||
/*! Obtain a plit_2 function object */
|
||||
Split_2 split_2_object () const
|
||||
{
|
||||
return (Split_2 (this->m_base_traits->split_2_object()));
|
||||
}
|
||||
Split_2 split_2_object() const
|
||||
{ return (Split_2 (this->m_base_traits->split_2_object())); }
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
|
@ -23,7 +19,7 @@
|
|||
#ifndef CGAL_ARR_OVERLAY_SL_VISITOR_H
|
||||
#define CGAL_ARR_OVERLAY_SL_VISITOR_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
/*! \file
|
||||
|
|
@ -36,7 +32,7 @@
|
|||
#include <boost/variant/apply_visitor.hpp>
|
||||
|
||||
#include <CGAL/Arr_tags.h>
|
||||
#include <CGAL/Sweep_line_2/Arr_construction_sl_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h>
|
||||
#include <CGAL/Unique_hash_map.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -12,24 +12,20 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
|
||||
#ifndef CGAL_OVERLAY_SUBCURVE_H
|
||||
#define CGAL_OVERLAY_SUBCURVE_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
/*! \file
|
||||
* Definition of the Arr_overlay_subcurve class-template.
|
||||
*/
|
||||
|
||||
#include <CGAL/Sweep_line_2/Arr_construction_subcurve.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_construction_subcurve.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -64,7 +60,7 @@ public:
|
|||
typedef typename Traits_2::Face_handle_blue Face_handle_blue;
|
||||
typedef typename Face_handle_blue::value_type Face_blue;
|
||||
|
||||
typedef Sweep_line_event<Traits_2, Self> Event;
|
||||
typedef Surface_sweep_event<Traits_2, Self> Event;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
@ -12,10 +12,6 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
|
@ -23,7 +19,7 @@
|
|||
#ifndef CGAL_ARR_OVERLAY_TRAITS_2_H
|
||||
#define CGAL_ARR_OVERLAY_TRAITS_2_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
/*!
|
||||
|
|
@ -12,16 +12,12 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Ron Wein <wein@post.tau.ac.il>
|
||||
|
||||
#ifndef CGAL_ARR_VERT_DECOMP_SL_VISITOR_H
|
||||
#define CGAL_ARR_VERT_DECOMP_SL_VISITOR_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
/*!
|
||||
|
|
@ -36,12 +32,9 @@ namespace CGAL {
|
|||
* A sweep-line visitor for performing vertical decomposition on an
|
||||
* arrangement embedded on a surface.
|
||||
*/
|
||||
template <class Helper_, class OutputIterator_>
|
||||
class Arr_vert_decomp_sl_visitor :
|
||||
public Helper_::Base_visitor
|
||||
{
|
||||
template <typename Helper_, typename OutputIterator_>
|
||||
class Arr_vert_decomp_sl_visitor : public Helper_::Base_visitor {
|
||||
public:
|
||||
|
||||
typedef Helper_ Helper;
|
||||
typedef OutputIterator_ OutputIterator;
|
||||
|
||||
|
|
@ -57,7 +50,6 @@ public:
|
|||
typedef std::pair<Vertex_const_handle, Vert_pair> Vert_entry;
|
||||
|
||||
protected:
|
||||
|
||||
typedef typename Base::Status_line_iterator Status_line_iterator;
|
||||
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
|
||||
//typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
|
||||
|
|
@ -65,37 +57,36 @@ protected:
|
|||
Halfedge_around_vertex_const_circulator;
|
||||
|
||||
// Data members:
|
||||
Helper m_helper; // The helper class.
|
||||
Helper m_helper; // The helper class.
|
||||
|
||||
const typename Arrangement_2::Geometry_traits_2 *m_traits;
|
||||
// The traits class.
|
||||
const typename Arrangement_2::Geometry_traits_2* m_traits;
|
||||
// The traits class.
|
||||
|
||||
const Vertex_const_handle invalid_vh;
|
||||
// An invalid vertex handle.
|
||||
const Vertex_const_handle invalid_vh;
|
||||
// An invalid vertex handle.
|
||||
|
||||
Vertex_const_handle m_prev_vh; // The previous vertex.
|
||||
CGAL::Object m_prev_obj_below; // The object this vertex sees below it.
|
||||
CGAL::Object m_prev_obj_above; // The object this vertex sees above it.
|
||||
Vertex_const_handle m_prev_vh; // The previous vertex.
|
||||
CGAL::Object m_prev_obj_below; // The object this vertex sees below it.
|
||||
CGAL::Object m_prev_obj_above; // The object this vertex sees above it.
|
||||
|
||||
OutputIterator *m_out; // An output iterator for the result.
|
||||
OutputIterator* m_out; // An output iterator for the result.
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* Constructor.
|
||||
* \param arr The arrangement.
|
||||
* \param oi A pointer to the output iterator that will store the result.
|
||||
*/
|
||||
Arr_vert_decomp_sl_visitor (const Arrangement_2 *arr,
|
||||
OutputIterator *oi) :
|
||||
m_helper (arr),
|
||||
m_traits (arr->geometry_traits()),
|
||||
Arr_vert_decomp_sl_visitor(const Arrangement_2* arr,
|
||||
OutputIterator* oi) :
|
||||
m_helper(arr),
|
||||
m_traits(arr->geometry_traits()),
|
||||
invalid_vh(),
|
||||
m_out (oi)
|
||||
m_out(oi)
|
||||
{}
|
||||
|
||||
/* A notification issued before the sweep process starts. */
|
||||
void before_sweep ();
|
||||
void before_sweep();
|
||||
|
||||
/*!
|
||||
* A notification invoked after the sweep-line finishes handling the given
|
||||
|
|
@ -105,14 +96,14 @@ public:
|
|||
* (or on) the event point.
|
||||
* \param on_above Whether the event is locates on the subcurve above it.
|
||||
*/
|
||||
bool after_handle_event (Event* event,
|
||||
Status_line_iterator above,
|
||||
bool on_above);
|
||||
bool after_handle_event(Event* event,
|
||||
Status_line_iterator above,
|
||||
bool on_above);
|
||||
|
||||
/*!
|
||||
* A notification issued when the sweep process is over.
|
||||
*/
|
||||
void after_sweep ();
|
||||
void after_sweep();
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -122,16 +113,14 @@ public:
|
|||
//-----------------------------------------------------------------------------
|
||||
// A notification issued before the sweep process starts.
|
||||
//
|
||||
template <class Hlpr, class OutIt>
|
||||
void Arr_vert_decomp_sl_visitor<Hlpr, OutIt>::before_sweep ()
|
||||
template <typename Hlpr, typename OutIt>
|
||||
void Arr_vert_decomp_sl_visitor<Hlpr, OutIt>::before_sweep()
|
||||
{
|
||||
// Notify the helper that the sweep process now starts.
|
||||
m_helper.before_sweep();
|
||||
|
||||
// Set an invalid previous vertex.
|
||||
m_prev_vh = Vertex_const_handle();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -139,31 +128,28 @@ void Arr_vert_decomp_sl_visitor<Hlpr, OutIt>::before_sweep ()
|
|||
// event.
|
||||
//
|
||||
template <class Hlpr, class OutIt>
|
||||
bool Arr_vert_decomp_sl_visitor<Hlpr, OutIt>::after_handle_event
|
||||
(Event* event,
|
||||
Status_line_iterator above, bool /* on_above */)
|
||||
bool Arr_vert_decomp_sl_visitor<Hlpr, OutIt>::
|
||||
after_handle_event(Event* event,
|
||||
Status_line_iterator above, bool /* on_above */)
|
||||
{
|
||||
// Notify the helper on the event.
|
||||
m_helper.after_handle_event (event);
|
||||
|
||||
// We are only interested in events associated with valid points:
|
||||
if (! event->is_closed())
|
||||
return (true);
|
||||
if (! event->is_closed()) return true;
|
||||
|
||||
// Get the vertex handle associated with the current event (stored with
|
||||
// the point).
|
||||
Vertex_const_handle vh = event->point().vertex_handle();
|
||||
CGAL::Object obj_above, obj_below;
|
||||
Vertex_const_handle vh = event->point().vertex_handle();
|
||||
CGAL::Object obj_above, obj_below;
|
||||
|
||||
// Check the feature from above.
|
||||
if (above == this->status_line_end())
|
||||
{
|
||||
if (above == this->status_line_end()) {
|
||||
// There is no concrete subcurve above the current event point, so we use
|
||||
// the helper class to obtain the object above.
|
||||
obj_above = m_helper.top_object();
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
// We have a valid subcurve above the event: get its halfedge handle
|
||||
// and associate it with the vertex.
|
||||
obj_above =
|
||||
|
|
@ -172,10 +158,10 @@ bool Arr_vert_decomp_sl_visitor<Hlpr, OutIt>::after_handle_event
|
|||
|
||||
// Check if the previous vertex we handled has the same x-coordinate
|
||||
// as the current one (it lies vertically below the current vertex).
|
||||
const bool prev_same_x =
|
||||
const bool prev_same_x =
|
||||
(m_prev_vh != invalid_vh &&
|
||||
m_traits->compare_x_2_object() (vh->point(),
|
||||
m_prev_vh->point()) == EQUAL);
|
||||
m_traits->compare_x_2_object()(vh->point(),
|
||||
m_prev_vh->point()) == EQUAL);
|
||||
|
||||
// Decrement the status-line iterator to reach the subcurve below the
|
||||
// event point. If the number of right subcurves associated with the
|
||||
|
|
@ -185,52 +171,43 @@ bool Arr_vert_decomp_sl_visitor<Hlpr, OutIt>::after_handle_event
|
|||
const size_t n_right = event->number_of_right_curves();
|
||||
size_t k;
|
||||
|
||||
for (k = 0; k < n_right; k++)
|
||||
--below;
|
||||
for (k = 0; k < n_right; k++) --below;
|
||||
|
||||
if (below == this->status_line_begin())
|
||||
{
|
||||
if (prev_same_x)
|
||||
{
|
||||
if (below == this->status_line_begin()) {
|
||||
if (prev_same_x) {
|
||||
// The previous vertex is vertically below the current vertex,
|
||||
// so we update their respective entries in the output map.
|
||||
// We first check if the two vertices are connected (by a vertical
|
||||
// segment) - if so, they "see" empty features.
|
||||
bool vert_connected = false;
|
||||
bool vert_connected = false;
|
||||
|
||||
if (! vh->is_isolated())
|
||||
{
|
||||
if (! vh->is_isolated()) {
|
||||
Halfedge_around_vertex_const_circulator circ, first;
|
||||
|
||||
first = circ = vh->incident_halfedges();
|
||||
do
|
||||
{
|
||||
do {
|
||||
if (circ->source() == m_prev_vh)
|
||||
vert_connected = true;
|
||||
++circ;
|
||||
} while (! vert_connected && circ != first);
|
||||
}
|
||||
|
||||
if (! vert_connected)
|
||||
{
|
||||
if (! vert_connected) {
|
||||
obj_below = CGAL::make_object(m_prev_vh);
|
||||
m_prev_obj_above = CGAL::make_object(vh);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
obj_below = CGAL::Object();
|
||||
m_prev_obj_above = CGAL::Object();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
// There is no concrete subcurve below the current event point, so we
|
||||
// use the helper class to obtain the object below.
|
||||
obj_below = m_helper.bottom_object();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
// Decrement the iterator once more in order to reach the subcurve below
|
||||
// the current event.
|
||||
--below;
|
||||
|
|
@ -256,34 +233,29 @@ bool Arr_vert_decomp_sl_visitor<Hlpr, OutIt>::after_handle_event
|
|||
// the respective entries in the output map accordingly.
|
||||
// We first check if the two vertices are connected (by a vertical
|
||||
// segment) - if so, they "see" empty features.
|
||||
bool vert_connected = false;
|
||||
bool vert_connected = false;
|
||||
|
||||
if (! vh->is_isolated())
|
||||
{
|
||||
Halfedge_around_vertex_const_circulator circ, first;
|
||||
if (! vh->is_isolated()) {
|
||||
Halfedge_around_vertex_const_circulator circ, first;
|
||||
|
||||
first = circ = vh->incident_halfedges();
|
||||
do
|
||||
{
|
||||
do {
|
||||
if (circ->source() == m_prev_vh)
|
||||
vert_connected = true;
|
||||
++circ;
|
||||
} while (! vert_connected && circ != first);
|
||||
}
|
||||
|
||||
if (! vert_connected)
|
||||
{
|
||||
if (! vert_connected) {
|
||||
obj_below = CGAL::make_object(m_prev_vh);
|
||||
m_prev_obj_above = CGAL::make_object(vh);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
obj_below = CGAL::Object();
|
||||
m_prev_obj_above = CGAL::Object();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
// Get the halfedge handle of the subcurve below the current event and
|
||||
// associate it with its vertex.
|
||||
obj_below =
|
||||
|
|
@ -293,10 +265,9 @@ bool Arr_vert_decomp_sl_visitor<Hlpr, OutIt>::after_handle_event
|
|||
|
||||
// We can now create the entry for the previous vertex, as we are not
|
||||
// going to change the identity of the features below or above it.
|
||||
if (m_prev_vh != Vertex_const_handle())
|
||||
{
|
||||
*(*m_out) = Vert_entry (m_prev_vh, Vert_pair (m_prev_obj_below,
|
||||
m_prev_obj_above));
|
||||
if (m_prev_vh != Vertex_const_handle()) {
|
||||
*(*m_out) = Vert_entry (m_prev_vh, Vert_pair(m_prev_obj_below,
|
||||
m_prev_obj_above));
|
||||
++(*m_out);
|
||||
}
|
||||
|
||||
|
|
@ -307,24 +278,21 @@ bool Arr_vert_decomp_sl_visitor<Hlpr, OutIt>::after_handle_event
|
|||
m_prev_obj_above = obj_above;
|
||||
|
||||
// It is safe to deallocate the event.
|
||||
return (true);
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// A notification issued when the sweep process is over.
|
||||
//
|
||||
template <class Hlpr, class OutIt>
|
||||
void Arr_vert_decomp_sl_visitor<Hlpr, OutIt>::after_sweep ()
|
||||
template <typename Hlpr, typename OutIt>
|
||||
void Arr_vert_decomp_sl_visitor<Hlpr, OutIt>::after_sweep()
|
||||
{
|
||||
// Create an entry for the last vertex (the xy-largest one).
|
||||
if (m_prev_vh != invalid_vh)
|
||||
{
|
||||
if (m_prev_vh != invalid_vh) {
|
||||
*(*m_out) = Vert_entry (m_prev_vh, Vert_pair (m_prev_obj_below,
|
||||
m_prev_obj_above));
|
||||
++(*m_out);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
@ -17,14 +17,13 @@
|
|||
// Eric Berberich <ericb@post.tau.ac.il>
|
||||
// (based on old version by Tali Zvi)
|
||||
|
||||
#ifndef CGAL_BASIC_SWEEP_LINE_2_IMPL_H
|
||||
#define CGAL_BASIC_SWEEP_LINE_2_IMPL_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#ifndef CGAL_NO_INTERSECTION_SURFACE_SWEEP_2_IMPL_H
|
||||
#define CGAL_NO_INTERSECTION_SURFACE_SWEEP_2_IMPL_H
|
||||
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
/*! \file
|
||||
* Member-function definitions for the Basic_sweep_line_2 class.
|
||||
* Member-function definitions for the No_intersection_surface_sweep_2 class.
|
||||
*/
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -34,8 +33,8 @@ namespace CGAL {
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
Basic_sweep_line_2(Visitor* visitor) :
|
||||
No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
No_intersection_surface_sweep_2(Visitor* visitor) :
|
||||
m_traits(new Traits_adaptor_2()),
|
||||
m_traitsOwner(true),
|
||||
m_statusLineCurveLess(m_traits, &m_currentEvent),
|
||||
|
|
@ -56,8 +55,8 @@ Basic_sweep_line_2(Visitor* visitor) :
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
Basic_sweep_line_2(const Traits_2* traits, Visitor* visitor) :
|
||||
No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
No_intersection_surface_sweep_2(const Traits_2* traits, Visitor* visitor) :
|
||||
m_traits(static_cast<const Traits_adaptor_2*>(traits)),
|
||||
m_traitsOwner(false),
|
||||
m_statusLineCurveLess(m_traits, &m_currentEvent),
|
||||
|
|
@ -78,7 +77,7 @@ Basic_sweep_line_2(const Traits_2* traits, Visitor* visitor) :
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::~Basic_sweep_line_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.
|
||||
if (m_traitsOwner) delete m_traits;
|
||||
|
|
@ -101,7 +100,7 @@ Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::~Basic_sweep_line_2()
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::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
|
||||
// (the first event in the queue).
|
||||
|
|
@ -131,7 +130,7 @@ void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::stop_sweep()
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
deallocate_event(Event* event)
|
||||
{
|
||||
// Remove the event from the set of allocated events.
|
||||
|
|
@ -147,7 +146,7 @@ deallocate_event(Event* event)
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_sweep()
|
||||
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_sweep()
|
||||
{
|
||||
CGAL_SL_PRINT_TEXT("Ordered sequence of ");
|
||||
CGAL_SL_PRINT(m_queue->size());
|
||||
|
|
@ -208,7 +207,7 @@ void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_sweep()
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_init_structures()
|
||||
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_init_structures()
|
||||
{
|
||||
CGAL_assertion(m_queue->empty());
|
||||
CGAL_assertion((m_statusLine.size() == 0));
|
||||
|
|
@ -224,7 +223,7 @@ void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_init_structures()
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_complete_sweep()
|
||||
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_complete_sweep()
|
||||
{
|
||||
CGAL_assertion(m_queue->empty());
|
||||
CGAL_assertion((m_statusLine.size() == 0));
|
||||
|
|
@ -242,7 +241,7 @@ void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_complete_sweep()
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
_init_point(const Point_2& pt, Attribute type)
|
||||
{
|
||||
// Create the event, or obtain an existing event in the queue.
|
||||
|
|
@ -259,7 +258,7 @@ _init_point(const Point_2& pt, Attribute type)
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
_init_curve(const X_monotone_curve_2& curve, unsigned int index)
|
||||
{
|
||||
// Construct and initialize a subcurve object.
|
||||
|
|
@ -277,7 +276,7 @@ _init_curve(const X_monotone_curve_2& curve, unsigned int index)
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
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)
|
||||
{
|
||||
// Get the boundary conditions of the curve end.
|
||||
|
|
@ -321,7 +320,7 @@ _init_curve_end(const X_monotone_curve_2& cv, Arr_curve_end ind, Subcurve* sc)
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_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_DEBUG(PrintEvent(m_currentEvent));
|
||||
|
|
@ -398,7 +397,7 @@ void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_handle_left_curves()
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
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.
|
||||
|
|
@ -451,7 +450,7 @@ _handle_event_without_left_curves()
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_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_assertion(m_currentEvent->has_left_curves());
|
||||
|
|
@ -516,7 +515,7 @@ void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_sort_left_curves()
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_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_DEBUG(PrintEvent(m_currentEvent));
|
||||
|
|
@ -554,7 +553,7 @@ void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_handle_right_curves()
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
bool Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
bool No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
_add_curve_to_right(Event* event, Subcurve* curve, bool /* overlap_exist */)
|
||||
{
|
||||
#if defined(CGAL_NO_ASSERTIONS)
|
||||
|
|
@ -573,7 +572,7 @@ _add_curve_to_right(Event* event, Subcurve* curve, bool /* overlap_exist */)
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
void No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
_remove_curve_from_status_line(Subcurve* sc)
|
||||
{
|
||||
CGAL_SL_PRINT_START("removing a curve from the status line, ");
|
||||
|
|
@ -600,8 +599,8 @@ _remove_curve_from_status_line(Subcurve* sc)
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
typename Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::Event*
|
||||
Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
typename No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::Event*
|
||||
No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
_allocate_event(const Point_2& pt, Attribute type,
|
||||
Arr_parameter_space ps_x, Arr_parameter_space ps_y)
|
||||
{
|
||||
|
|
@ -621,8 +620,8 @@ _allocate_event(const Point_2& pt, Attribute type,
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
typename Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::Event*
|
||||
Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
typename No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::Event*
|
||||
No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
_allocate_event_at_open_boundary(Attribute type,
|
||||
Arr_parameter_space ps_x,
|
||||
Arr_parameter_space ps_y)
|
||||
|
|
@ -640,9 +639,9 @@ _allocate_event_at_open_boundary(Attribute type,
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
std::pair<typename Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::Event*,
|
||||
std::pair<typename No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::Event*,
|
||||
bool>
|
||||
Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
_push_event(const Point_2& pt, Attribute type,
|
||||
Arr_parameter_space ps_x, Arr_parameter_space ps_y, Subcurve* sc)
|
||||
{
|
||||
|
|
@ -704,9 +703,9 @@ _push_event(const Point_2& pt, Attribute type,
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
std::pair<typename Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::Event*,
|
||||
std::pair<typename No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::Event*,
|
||||
bool>
|
||||
Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
No_intersection_surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
_push_event(const X_monotone_curve_2& cv, Arr_curve_end ind, Attribute type,
|
||||
Arr_parameter_space ps_x, Arr_parameter_space ps_y, Subcurve* sc)
|
||||
{
|
||||
|
|
@ -15,13 +15,12 @@
|
|||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Efi Fogel <efifogel@gmail.com>
|
||||
|
||||
#ifndef CGAL_SWEEP_LINE_2_DEBUG_H
|
||||
#define CGAL_SWEEP_LINE_2_DEBUG_H
|
||||
#ifndef CGAL_SURFACE_SWEEP_2_DEBUG_H
|
||||
#define CGAL_SURFACE_SWEEP_2_DEBUG_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
#include <CGAL/Basic_sweep_line_2.h>
|
||||
#include <CGAL/No_intersection_surface_sweep_2.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -30,7 +29,7 @@
|
|||
////////////////////////////////////////////////////////////////////////////
|
||||
template <typename Tr, typename Visit, typename Crv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
void No_intersection_surface_sweep_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
print_text(const char* text, bool do_eol)
|
||||
{
|
||||
if (m_need_indent)
|
||||
|
|
@ -42,7 +41,7 @@ print_text(const char* text, bool do_eol)
|
|||
|
||||
template <typename Tr, typename Visit, typename Crv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::print_eol()
|
||||
void No_intersection_surface_sweep_2<Tr, Visit, Crv, Evnt, Alloc>::print_eol()
|
||||
{
|
||||
std::cout << std::endl;
|
||||
m_need_indent = true;
|
||||
|
|
@ -50,17 +49,19 @@ void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::print_eol()
|
|||
|
||||
template <typename Tr, typename Visit, typename Crv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::increase_indent()
|
||||
void No_intersection_surface_sweep_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
increase_indent()
|
||||
{ m_indent_size += 2; }
|
||||
|
||||
template <typename Tr, typename Visit, typename Crv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::decrease_indent()
|
||||
void No_intersection_surface_sweep_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
decrease_indent()
|
||||
{ m_indent_size -= 2; }
|
||||
|
||||
template <typename Tr, typename Visit, typename Crv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
void No_intersection_surface_sweep_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
print_start(const char* name, bool do_eol)
|
||||
{
|
||||
print_text("Start ");
|
||||
|
|
@ -71,7 +72,7 @@ print_start(const char* name, bool do_eol)
|
|||
|
||||
template <typename Tr, typename Visit, typename Crv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
void No_intersection_surface_sweep_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
print_end(const char* name, bool do_eol)
|
||||
{
|
||||
decrease_indent();
|
||||
|
|
@ -82,7 +83,7 @@ print_end(const char* name, bool do_eol)
|
|||
|
||||
template <typename Tr, typename Visit, typename Crv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
void No_intersection_surface_sweep_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
print_curve(const Base_subcurve* sc)
|
||||
{
|
||||
if (m_need_indent)
|
||||
|
|
@ -93,7 +94,8 @@ print_curve(const Base_subcurve* sc)
|
|||
|
||||
template <typename Tr, typename Visit, typename Crv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::PrintEventQueue()
|
||||
void No_intersection_surface_sweep_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
PrintEventQueue()
|
||||
{
|
||||
print_text("Event queue: ", true);
|
||||
Event_queue_iterator iter = m_queue->begin();
|
||||
|
|
@ -106,7 +108,8 @@ void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::PrintEventQueue()
|
|||
|
||||
template <typename Tr, typename Visit, typename Crv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::PrintSubCurves()
|
||||
void No_intersection_surface_sweep_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
PrintSubCurves()
|
||||
{
|
||||
print_text("Sub curves: ", true);
|
||||
for (size_t i = 0; i < m_num_of_subCurves; ++i) m_subCurves[i].Print();
|
||||
|
|
@ -115,7 +118,8 @@ void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::PrintSubCurves()
|
|||
|
||||
template <typename Tr, typename Visit, typename Crv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::PrintStatusLine()
|
||||
void No_intersection_surface_sweep_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
PrintStatusLine()
|
||||
{
|
||||
if (m_statusLine.size() == 0) {
|
||||
print_text("Status line: empty", true);
|
||||
|
|
@ -144,8 +148,8 @@ void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::PrintStatusLine()
|
|||
|
||||
template <typename Tr, typename Visit, typename Crv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
PrintOpenBoundaryType (Arr_parameter_space ps_x, Arr_parameter_space ps_y)
|
||||
void No_intersection_surface_sweep_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
PrintOpenBoundaryType(Arr_parameter_space ps_x, Arr_parameter_space ps_y)
|
||||
{
|
||||
switch (ps_x) {
|
||||
case ARR_LEFT_BOUNDARY: std::cout << "left boundary"; return;
|
||||
|
|
@ -164,7 +168,7 @@ PrintOpenBoundaryType (Arr_parameter_space ps_x, Arr_parameter_space ps_y)
|
|||
|
||||
template <typename Tr, typename Visit, typename Crv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
void No_intersection_surface_sweep_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
PrintEvent(const Event* e)
|
||||
{
|
||||
if (e->is_closed()) std::cout << e->point();
|
||||
|
|
@ -178,7 +182,7 @@ PrintEvent(const Event* e)
|
|||
|
||||
template <typename Tr, typename Visit, typename Crv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
void No_intersection_surface_sweep_2<Tr, Visit, Crv, Evnt, Alloc>::
|
||||
print_event_info(const Event* e)
|
||||
{
|
||||
print_text("Event Info: ");
|
||||
|
|
@ -16,14 +16,14 @@
|
|||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
// (based on old version by Tali Zvi)
|
||||
|
||||
#ifndef CGAL_SWEEP_LINE_2_IMPL_H
|
||||
#define CGAL_SWEEP_LINE_2_IMPL_H
|
||||
#ifndef CGAL_SURFACE_SWEEP_2_IMPL_H
|
||||
#define CGAL_SURFACE_SWEEP_2_IMPL_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
/*! \file
|
||||
* Member-function definitions of the Sweep_line_2 class-template.
|
||||
* Member-function definitions of the Surface_sweep_2 class-template.
|
||||
*/
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -33,7 +33,7 @@ namespace CGAL {
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_init_structures()
|
||||
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_init_structures()
|
||||
{
|
||||
// Initailize the structures maintained by the base sweep-line class.
|
||||
Base::_init_structures();
|
||||
|
|
@ -47,7 +47,7 @@ void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_init_structures()
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_complete_sweep()
|
||||
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_complete_sweep()
|
||||
{
|
||||
CGAL_SL_PRINT_START_EOL("completing the sweep");
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_complete_sweep()
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_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_DEBUG(this->PrintEvent(this->m_currentEvent));
|
||||
|
|
@ -206,7 +206,7 @@ void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_handle_left_curves()
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_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_DEBUG(this->PrintEvent(this->m_currentEvent));
|
||||
|
|
@ -285,7 +285,7 @@ void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_handle_right_curves()
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
bool Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
bool Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
_add_curve_to_right(Event* event, Subcurve* curve, bool overlap_exist)
|
||||
{
|
||||
CGAL_SL_PRINT_START("adding a Curve to the right of (");
|
||||
|
|
@ -365,7 +365,7 @@ _add_curve_to_right(Event* event, Subcurve* curve, bool overlap_exist)
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
_remove_curve_from_status_line(Subcurve* leftCurve, bool remove_for_good)
|
||||
{
|
||||
CGAL_SL_PRINT_START("removing a curve from the status line, ");
|
||||
|
|
@ -412,7 +412,7 @@ _remove_curve_from_status_line(Subcurve* leftCurve, bool remove_for_good)
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_intersect(Subcurve* c1,
|
||||
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_intersect(Subcurve* c1,
|
||||
Subcurve* c2)
|
||||
{
|
||||
CGAL_SL_PRINT_START("computing intersection of ");
|
||||
|
|
@ -585,7 +585,7 @@ void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_intersect(Subcurve* c1,
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
_create_intersection_point(const Point_2& xp,
|
||||
unsigned int multiplicity,
|
||||
Subcurve*& c1, Subcurve*& c2,
|
||||
|
|
@ -689,7 +689,7 @@ _create_intersection_point(const Point_2& xp,
|
|||
//
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_fix_overlap_subcurves()
|
||||
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::_fix_overlap_subcurves()
|
||||
{
|
||||
CGAL_SL_PRINT_START_EOL("fixing overlap subcurves");
|
||||
|
||||
|
|
@ -729,7 +729,7 @@ void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_fix_overlap_subcurves()
|
|||
*/
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
_handle_overlap(Event* event, Subcurve* curve, Event_subcurve_iterator iter,
|
||||
bool overlap_exist)
|
||||
{
|
||||
|
|
@ -881,7 +881,7 @@ _handle_overlap(Event* event, Subcurve* curve, Event_subcurve_iterator iter,
|
|||
// an overlap can be itself a subcurve that stores overlap and so on.
|
||||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
void Surface_sweep_2<Tr, Vis, Subcv, Evnt, Alloc>::
|
||||
_fix_finished_overlap_subcurve(Subcurve* sc)
|
||||
{
|
||||
CGAL_SL_PRINT_START("fixing finished overlap subcurve ");
|
||||
|
|
@ -12,18 +12,14 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
||||
#ifndef CGAL_SWEEP_LINE_2_UTILS
|
||||
#define CGAL_SWEEP_LINE_2_UTILS
|
||||
#ifndef CGAL_SURFACE_SWEEP_2_UTILS
|
||||
#define CGAL_SURFACE_SWEEP_2_UTILS
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
/*! \file
|
||||
|
|
@ -49,10 +45,10 @@ namespace CGAL {
|
|||
* \param iso_points Output: The isolated points (of type Point_2).
|
||||
* \param tr A geometry-traits class.
|
||||
*/
|
||||
template <class Traits,
|
||||
class CurveInputIter,
|
||||
class XCurveOutIter,
|
||||
class PointOutIter>
|
||||
template <typename Traits,
|
||||
typename CurveInputIter,
|
||||
typename XCurveOutIter,
|
||||
typename PointOutIter>
|
||||
void make_x_monotone (CurveInputIter begin, CurveInputIter end,
|
||||
XCurveOutIter x_curves,
|
||||
PointOutIter iso_points,
|
||||
|
|
@ -122,12 +118,12 @@ void make_x_monotone (CurveInputIter begin, CurveInputIter end,
|
|||
* This parameter is not actually in use, but is needed in order
|
||||
* to instantiate the template parameter ExTraits.
|
||||
*/
|
||||
template <class Arrangement,
|
||||
class ExTraits,
|
||||
class XCurveInputIter,
|
||||
class PointInputIter,
|
||||
class XCurveOutIter,
|
||||
class PointOutIter>
|
||||
template <typename Arrangement,
|
||||
typename ExTraits,
|
||||
typename XCurveInputIter,
|
||||
typename PointInputIter,
|
||||
typename XCurveOutIter,
|
||||
typename PointOutIter>
|
||||
void prepare_for_sweep (Arrangement& arr,
|
||||
XCurveInputIter xcvs_begin, XCurveInputIter xcvs_end,
|
||||
PointInputIter pts_begin, PointInputIter pts_end,
|
||||
|
|
@ -12,17 +12,13 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
|
||||
#ifndef CGAL_SWEEP_LINE_2_VISITORS_H
|
||||
#define CGAL_SWEEP_LINE_2_VISITORS_H
|
||||
#ifndef CGAL_SURFACE_SWEEP_2_VISITORS_H
|
||||
#define CGAL_SURFACE_SWEEP_2_VISITORS_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
/*! \file
|
||||
|
|
@ -30,10 +26,10 @@
|
|||
* sweep-line functions.
|
||||
*/
|
||||
|
||||
#include <CGAL/Sweep_line_2/Sweep_line_event.h>
|
||||
#include <CGAL/Sweep_line_2/Sweep_line_subcurve.h>
|
||||
#include <CGAL/Sweep_line_2/Sweep_line_2_utils.h>
|
||||
#include <CGAL/Sweep_line_empty_visitor.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_event.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_subcurve.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_2_utils.h>
|
||||
#include <CGAL/Surface_sweep_empty_visitor.h>
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
|
||||
|
|
@ -44,14 +40,14 @@ namespace CGAL {
|
|||
* set of input curves.
|
||||
*/
|
||||
template <typename Traits_, typename OutputIerator_>
|
||||
class Sweep_line_points_visitor :
|
||||
public Sweep_line_empty_visitor<Traits_>
|
||||
class Surface_sweep_points_visitor :
|
||||
public Surface_sweep_empty_visitor<Traits_>
|
||||
{
|
||||
typedef Traits_ Traits_2;
|
||||
typedef OutputIerator_ Output_ierator;
|
||||
typedef Sweep_line_points_visitor<Traits_2, Output_ierator> Self;
|
||||
typedef Traits_ Traits_2;
|
||||
typedef OutputIerator_ Output_ierator;
|
||||
typedef Surface_sweep_points_visitor<Traits_2, Output_ierator> Self;
|
||||
|
||||
typedef Sweep_line_empty_visitor<Traits_2> Base;
|
||||
typedef Surface_sweep_empty_visitor<Traits_2> Base;
|
||||
typedef typename Base::Event Event;
|
||||
typedef typename Base::Subcurve Subcurve;
|
||||
typedef typename Base::Event_subcurve_iterator Event_subcurve_iterator;
|
||||
|
|
@ -61,23 +57,23 @@ class Sweep_line_points_visitor :
|
|||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Traits_2::Point_2 Point_2;
|
||||
|
||||
typedef CGAL::Sweep_line_2<Traits_2, Self> Sweep_line_2;
|
||||
typedef CGAL::Surface_sweep_2<Traits_2, Self> Surface_sweep_2;
|
||||
|
||||
protected:
|
||||
Output_ierator m_out; // The output points.
|
||||
bool m_includeEndPoints; // Should we include endpoints.
|
||||
Output_ierator m_out; // The output points.
|
||||
bool m_includeEndPoints; // Should we include endpoints.
|
||||
|
||||
public:
|
||||
Sweep_line_points_visitor(Output_ierator out, bool endpoints) :
|
||||
Surface_sweep_points_visitor(Output_ierator out, bool endpoints) :
|
||||
m_out(out),
|
||||
m_includeEndPoints(endpoints)
|
||||
{}
|
||||
|
||||
template <class CurveIterator>
|
||||
template <typename CurveIterator>
|
||||
void sweep(CurveIterator begin, CurveIterator end)
|
||||
{
|
||||
std::vector<X_monotone_curve_2> curves_vec;
|
||||
std::vector<Point_2> points_vec;
|
||||
std::vector<Point_2> points_vec;
|
||||
|
||||
curves_vec.reserve(std::distance(begin,end));
|
||||
make_x_monotone(begin, end,
|
||||
|
|
@ -86,7 +82,8 @@ public:
|
|||
this->traits());
|
||||
|
||||
//Perform the sweep
|
||||
Sweep_line_2* sl = reinterpret_cast<Sweep_line_2*>(this->sweep_line());
|
||||
Surface_sweep_2* sl =
|
||||
reinterpret_cast<Surface_sweep_2*>(this->surface_sweep());
|
||||
|
||||
sl->sweep(curves_vec.begin(), curves_vec.end(),
|
||||
points_vec.begin(), points_vec.end());
|
||||
|
|
@ -113,40 +110,40 @@ public:
|
|||
* A simple sweep-line visitor that reports all non-intersecting
|
||||
* x-monotone curves induced by a set of input curves.
|
||||
*/
|
||||
template <class Traits_, class OutputIerator_>
|
||||
class Sweep_line_subcurves_visitor :
|
||||
public Sweep_line_empty_visitor<Traits_>
|
||||
template <typename Traits_, typename OutputIerator_>
|
||||
class Surface_sweep_subcurves_visitor :
|
||||
public Surface_sweep_empty_visitor<Traits_>
|
||||
{
|
||||
typedef Traits_ Traits_2;
|
||||
typedef OutputIerator_ Output_ierator;
|
||||
typedef Sweep_line_subcurves_visitor<Traits_2, Output_ierator> Self;
|
||||
typedef Traits_ Traits_2;
|
||||
typedef OutputIerator_ Output_ierator;
|
||||
typedef Surface_sweep_subcurves_visitor<Traits_2, Output_ierator> Self;
|
||||
|
||||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Traits_2::Point_2 Point_2;
|
||||
|
||||
typedef Sweep_line_empty_visitor<Traits_2> Base;
|
||||
typedef Surface_sweep_empty_visitor<Traits_2> Base;
|
||||
typedef typename Base::Event Event;
|
||||
typedef typename Base::Subcurve Subcurve;
|
||||
typedef typename Base::Status_line_iterator Status_line_iterator;
|
||||
|
||||
typedef CGAL::Sweep_line_2<Traits_2, Self> Sweep_line_2;
|
||||
typedef CGAL::Surface_sweep_2<Traits_2, Self> Surface_sweep_2;
|
||||
|
||||
protected:
|
||||
// Data members:
|
||||
Output_ierator m_out; // The output curves.
|
||||
bool m_overlapping; // Should we report overlapping curves twice.
|
||||
bool m_overlapping; // Should we report overlapping curves twice.
|
||||
|
||||
public:
|
||||
Sweep_line_subcurves_visitor(Output_ierator out, bool overlapping) :
|
||||
Surface_sweep_subcurves_visitor(Output_ierator out, bool overlapping) :
|
||||
m_out(out),
|
||||
m_overlapping(overlapping)
|
||||
{}
|
||||
|
||||
template <class CurveIterator>
|
||||
template <typename CurveIterator>
|
||||
void sweep(CurveIterator begin, CurveIterator end)
|
||||
{
|
||||
std::vector<X_monotone_curve_2> curves_vec;
|
||||
std::vector<Point_2> points_vec;
|
||||
std::vector<X_monotone_curve_2> curves_vec;
|
||||
std::vector<Point_2> points_vec;
|
||||
|
||||
curves_vec.reserve(std::distance(begin,end));
|
||||
make_x_monotone(begin, end,
|
||||
|
|
@ -155,7 +152,8 @@ public:
|
|||
this->traits());
|
||||
|
||||
// Perform the sweep.
|
||||
Sweep_line_2* sl = reinterpret_cast<Sweep_line_2*>(this->sweep_line());
|
||||
Surface_sweep_2* sl =
|
||||
reinterpret_cast<Surface_sweep_2*>(this->surface_sweep());
|
||||
|
||||
sl->sweep(curves_vec.begin(), curves_vec.end(),
|
||||
points_vec.begin(), points_vec.end());
|
||||
|
|
@ -184,33 +182,31 @@ public:
|
|||
* A simple sweep-line visitor that determines if there are intersections
|
||||
* in the interiors of the given curve set.
|
||||
*/
|
||||
template <class Traits_>
|
||||
class Sweep_line_do_curves_x_visitor :
|
||||
public Sweep_line_empty_visitor<Traits_>
|
||||
template <typename Traits_>
|
||||
class Surface_sweep_do_curves_x_visitor :
|
||||
public Surface_sweep_empty_visitor<Traits_>
|
||||
{
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Sweep_line_do_curves_x_visitor<Traits_2> Self;
|
||||
typedef Surface_sweep_do_curves_x_visitor<Traits_2> Self;
|
||||
|
||||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Traits_2::Point_2 Point_2;
|
||||
|
||||
typedef Sweep_line_empty_visitor<Traits_2> Base;
|
||||
typedef Surface_sweep_empty_visitor<Traits_2> Base;
|
||||
typedef typename Base::Event Event;
|
||||
typedef typename Base::Subcurve Subcurve;
|
||||
typedef typename Base::Status_line_iterator Status_line_iterator;
|
||||
|
||||
typedef CGAL::Sweep_line_2<Traits_2, Self> Sweep_line_2;
|
||||
typedef CGAL::Surface_sweep_2<Traits_2, Self> Surface_sweep_2;
|
||||
|
||||
protected:
|
||||
// Data members:
|
||||
bool m_found_x; // Have we found an intersection so far.
|
||||
bool m_found_x; // Have we found an intersection so far.
|
||||
|
||||
public:
|
||||
Sweep_line_do_curves_x_visitor() :
|
||||
m_found_x(false)
|
||||
{}
|
||||
Surface_sweep_do_curves_x_visitor() : m_found_x(false) {}
|
||||
|
||||
template <class CurveIterator>
|
||||
template <typename CurveIterator>
|
||||
void sweep(CurveIterator begin, CurveIterator end)
|
||||
{
|
||||
std::vector<X_monotone_curve_2> curves_vec;
|
||||
|
|
@ -223,7 +219,8 @@ public:
|
|||
this-> traits());
|
||||
|
||||
// Perform the sweep.
|
||||
Sweep_line_2* sl = reinterpret_cast<Sweep_line_2*>(this->sweep_line());
|
||||
Surface_sweep_2* sl =
|
||||
reinterpret_cast<Surface_sweep_2*>(this->surface_sweep());
|
||||
|
||||
sl->sweep(curves_vec.begin(), curves_vec.end(),
|
||||
points_vec.begin(), points_vec.end());
|
||||
|
|
@ -257,11 +254,12 @@ public:
|
|||
bool /* is_new */)
|
||||
{}
|
||||
|
||||
template <class XCurveIterator>
|
||||
template <typename XCurveIterator>
|
||||
void sweep_xcurves(XCurveIterator begin, XCurveIterator end)
|
||||
{
|
||||
// Perform the sweep.
|
||||
Sweep_line_2* sl = reinterpret_cast<Sweep_line_2*>(this->sweep_line());
|
||||
Surface_sweep_2* sl =
|
||||
reinterpret_cast<Surface_sweep_2*>(this->surface_sweep());
|
||||
sl->sweep(begin, end);
|
||||
}
|
||||
|
||||
|
|
@ -275,7 +273,8 @@ public:
|
|||
bool /* flag */)
|
||||
{
|
||||
if (m_found_x) {
|
||||
Sweep_line_2* sl = reinterpret_cast<Sweep_line_2*>(this->sweep_line());
|
||||
Surface_sweep_2* sl =
|
||||
reinterpret_cast<Surface_sweep_2*>(this->surface_sweep());
|
||||
sl->stop_sweep();
|
||||
}
|
||||
return true;
|
||||
|
|
@ -12,18 +12,13 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
|
||||
#ifndef CGAL_SWEEP_LINE_CURVE_PAIR_H
|
||||
#define CGAL_SWEEP_LINE_CURVE_PAIR_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#ifndef CGAL_SURFACE_SWEEP_CURVE_PAIR_H
|
||||
#define CGAL_SURFACE_SWEEP_CURVE_PAIR_H
|
||||
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
/*! \file
|
||||
* Definition of the Curve_pair<Subcurve> class and related functors.
|
||||
|
|
@ -34,63 +29,47 @@ namespace CGAL {
|
|||
/*! \class
|
||||
* A pair of subcurves.
|
||||
*/
|
||||
template <class Subcurve_>
|
||||
class Curve_pair
|
||||
{
|
||||
template <typename Subcurve_>
|
||||
class Curve_pair {
|
||||
public:
|
||||
|
||||
typedef Subcurve_ Subcurve;
|
||||
typedef Subcurve_ Subcurve;
|
||||
|
||||
private:
|
||||
|
||||
// Data members:
|
||||
std::pair<Subcurve*, Subcurve*> m_pair;
|
||||
std::pair<Subcurve*, Subcurve*> m_pair;
|
||||
|
||||
public:
|
||||
|
||||
/*! Default constructor. */
|
||||
Curve_pair(){}
|
||||
|
||||
/*! Constructor from two subcurves. */
|
||||
Curve_pair (Subcurve *sc1, Subcurve *sc2)
|
||||
Curve_pair (Subcurve* sc1, Subcurve* sc2)
|
||||
{
|
||||
// The smallest pointer will be the first.
|
||||
if(sc1 < sc2)
|
||||
m_pair = std::make_pair (sc1,sc2);
|
||||
else
|
||||
m_pair = std::make_pair (sc2,sc1);
|
||||
if (sc1 < sc2) m_pair = std::make_pair (sc1,sc2);
|
||||
else m_pair = std::make_pair (sc2,sc1);
|
||||
}
|
||||
|
||||
/*! Get the first subcurve. */
|
||||
Subcurve* first() const
|
||||
{
|
||||
return (m_pair.first);
|
||||
}
|
||||
Subcurve* first() const { return (m_pair.first); }
|
||||
|
||||
/*! Get the second subcurve. */
|
||||
Subcurve* second() const
|
||||
{
|
||||
return (m_pair.second);
|
||||
}
|
||||
Subcurve* second() const { return (m_pair.second); }
|
||||
};
|
||||
|
||||
/*! \struct
|
||||
* Less functor for curve pairs.
|
||||
*/
|
||||
template <class Subcurve_>
|
||||
struct Less_curve_pair
|
||||
{
|
||||
template <typename Subcurve_>
|
||||
struct Less_curve_pair {
|
||||
typedef Subcurve_ Subcurve;
|
||||
typedef class Curve_pair<Subcurve> Curve_pair;
|
||||
typedef class Curve_pair<Subcurve> Curve_pair;
|
||||
|
||||
bool operator() (const Curve_pair& pair1, const Curve_pair& pair2) const
|
||||
{
|
||||
if (pair1.first() < pair2.first())
|
||||
return true;
|
||||
if (pair1.first() > pair2.first())
|
||||
return false;
|
||||
if (pair1.second() < pair2.second())
|
||||
return true;
|
||||
if (pair1.first() < pair2.first()) return true;
|
||||
if (pair1.first() > pair2.first()) return false;
|
||||
if (pair1.second() < pair2.second()) return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
@ -98,17 +77,16 @@ struct Less_curve_pair
|
|||
/*! \struct
|
||||
* A hash functor for curve pairs.
|
||||
*/
|
||||
template <class Subcurve_>
|
||||
struct Curve_pair_hasher
|
||||
{
|
||||
typedef Subcurve_ Subcurve;
|
||||
typedef class Curve_pair<Subcurve> Curve_pair;
|
||||
template <typename Subcurve_>
|
||||
struct Curve_pair_hasher {
|
||||
typedef Subcurve_ Subcurve;
|
||||
typedef class Curve_pair<Subcurve> Curve_pair;
|
||||
|
||||
size_t operator() (const Curve_pair& pair) const
|
||||
{
|
||||
const size_t half_n_bits = sizeof(size_t) * 8 / 2;
|
||||
const size_t val1 = reinterpret_cast<size_t> (pair.first());
|
||||
const size_t val2 = reinterpret_cast<size_t> (pair.second());
|
||||
const size_t half_n_bits = sizeof(size_t) * 8 / 2;
|
||||
const size_t val1 = reinterpret_cast<size_t> (pair.first());
|
||||
const size_t val2 = reinterpret_cast<size_t> (pair.second());
|
||||
|
||||
return (((val1 << half_n_bits) | (val1 >> half_n_bits)) ^ val2);
|
||||
}
|
||||
|
|
@ -117,11 +95,10 @@ struct Curve_pair_hasher
|
|||
/*! \struct
|
||||
* Equaility functor for curve pairs.
|
||||
*/
|
||||
template <class Subcurve_>
|
||||
struct Equal_curve_pair
|
||||
{
|
||||
template <typename Subcurve_>
|
||||
struct Equal_curve_pair {
|
||||
typedef Subcurve_ Subcurve;
|
||||
typedef class Curve_pair<Subcurve> Curve_pair;
|
||||
typedef class Curve_pair<Subcurve> Curve_pair;
|
||||
|
||||
bool operator() (const Curve_pair& pair1, const Curve_pair& pair2) const
|
||||
{
|
||||
|
|
@ -133,11 +110,9 @@ struct Equal_curve_pair
|
|||
/*! \class
|
||||
* A random-access iterator that can automatically resize its container.
|
||||
*/
|
||||
template <class Container_>
|
||||
class random_access_input_iterator
|
||||
{
|
||||
template <typename Container_>
|
||||
class random_access_input_iterator {
|
||||
public:
|
||||
|
||||
typedef Container_ Container;
|
||||
typedef typename Container::value_type value_type;
|
||||
typedef random_access_input_iterator<Container> Self;
|
||||
|
|
@ -145,30 +120,26 @@ public:
|
|||
private:
|
||||
|
||||
// Data members:
|
||||
Container *m_container; // The container.
|
||||
unsigned int m_index; // The current index.
|
||||
Container* m_container; // The container.
|
||||
unsigned int m_index; // The current index.
|
||||
|
||||
public:
|
||||
random_access_input_iterator() {}
|
||||
|
||||
random_access_input_iterator()
|
||||
{}
|
||||
|
||||
random_access_input_iterator (Container& _container,
|
||||
unsigned int _index = 0):
|
||||
random_access_input_iterator(Container& _container,
|
||||
unsigned int _index = 0) :
|
||||
m_container(&_container),
|
||||
m_index(_index)
|
||||
{}
|
||||
|
||||
value_type& operator*()
|
||||
{
|
||||
if(m_index >= m_container->capacity())
|
||||
{
|
||||
if(m_index >= m_container->capacity()) {
|
||||
m_container->reserve(2 * m_index + 1);
|
||||
m_container->resize(m_index+1);
|
||||
}
|
||||
else
|
||||
if(m_index >= m_container->size())
|
||||
m_container->resize(m_index+1);
|
||||
else if(m_index >= m_container->size())
|
||||
m_container->resize(m_index+1);
|
||||
return (*m_container)[m_index];
|
||||
}
|
||||
|
||||
|
|
@ -191,14 +162,14 @@ public:
|
|||
return (*this);
|
||||
}
|
||||
|
||||
Self operator-- (int)
|
||||
Self operator--(int)
|
||||
{
|
||||
Self temp = *this;
|
||||
--m_index;
|
||||
return (temp);
|
||||
}
|
||||
|
||||
bool operator== (const Self& other)
|
||||
bool operator==(const Self& other)
|
||||
{
|
||||
CGAL_precondition (m_container == other.m_container);
|
||||
return (m_index == other.m_index);
|
||||
|
|
@ -12,28 +12,25 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// Author(s) : Tali Zvi <talizvi@post.tau.ac.il>,
|
||||
// Author(s) : Tali Zvi <talizvi@post.tau.ac.il>,
|
||||
// Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@gmail.com>
|
||||
|
||||
#ifndef CGAL_SWEEP_LINE_EVENT_H
|
||||
#define CGAL_SWEEP_LINE_EVENT_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@gmail.com>
|
||||
|
||||
#ifndef CGAL_SURFACE_SWEEP_EVENT_H
|
||||
#define CGAL_SURFACE_SWEEP_EVENT_H
|
||||
|
||||
/*! \file
|
||||
* Defintion of the Sweep_line_event class.
|
||||
* Defintion of the Surface_sweep_event class.
|
||||
*/
|
||||
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
#include <list>
|
||||
|
||||
#include <CGAL/Sweep_line_2/Sweep_line_subcurve.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
/*! \class Sweep_line_event
|
||||
/*! \class Surface_sweep_event
|
||||
*
|
||||
* A class associated with an event in a sweep line algorithm.
|
||||
* An intersection point in the sweep line algorithm is refered to as an event.
|
||||
|
|
@ -50,13 +47,12 @@ namespace CGAL {
|
|||
*
|
||||
*/
|
||||
template <typename Traits_, typename Subcurve_>
|
||||
class Sweep_line_event {
|
||||
class Surface_sweep_event {
|
||||
public:
|
||||
typedef Traits_ Traits_2;
|
||||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Traits_2::Point_2 Point_2;
|
||||
|
||||
// should be ok, as Traits_ has already extended by Basic_sweep_line
|
||||
typedef typename internal::Arr_complete_left_side_category<Traits_2>::Category
|
||||
Left_side_category;
|
||||
typedef typename internal::Arr_complete_bottom_side_category<Traits_2>::Category
|
||||
|
|
@ -107,7 +103,7 @@ protected:
|
|||
|
||||
public:
|
||||
/*! Default constructor. */
|
||||
Sweep_line_event() :
|
||||
Surface_sweep_event() :
|
||||
m_type(0),
|
||||
m_ps_x(static_cast<char>(ARR_INTERIOR)),
|
||||
m_ps_y(static_cast<char>(ARR_INTERIOR)),
|
||||
|
|
@ -146,19 +142,12 @@ public:
|
|||
//curve->Print();
|
||||
|
||||
for (iter = m_leftCurves.begin(); iter != m_leftCurves.end(); ++iter) {
|
||||
//std::cout << "add_curve_to_left, iter: ";
|
||||
//(*iter)->Print();
|
||||
|
||||
// Do nothing if the curve exists.
|
||||
if ((curve == *iter) || (*iter)->is_inner_node(curve)) {
|
||||
//std::cout << "add_curve_to_left, curve exists" << std::endl;
|
||||
return;
|
||||
}
|
||||
if ((curve == *iter) || (*iter)->is_inner_node(curve)) return;
|
||||
|
||||
// Replace the existing curve in case of overlap.
|
||||
// EBEB 2011-10-27: Fixed to detect overlaps correctly
|
||||
if ((curve != *iter) && (curve->has_common_leaf(*iter))) {
|
||||
//std::cout << "add_curve_to_left, curve overlaps" << std::endl;
|
||||
*iter = curve;
|
||||
return;
|
||||
}
|
||||
|
|
@ -166,9 +155,6 @@ public:
|
|||
|
||||
// The curve does not exist - insert it to the container.
|
||||
m_leftCurves.push_back(curve);
|
||||
// std::cout << "add_curve_to_left, pushed back" << std::endl;
|
||||
|
||||
//this->Print();
|
||||
}
|
||||
|
||||
/*! Add a subcurve to the container of left curves (without checks). */
|
||||
|
|
@ -204,10 +190,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if (res == EQUAL) //overlap !!
|
||||
{
|
||||
return std::make_pair(true, iter);
|
||||
}
|
||||
//overlap !!
|
||||
if (res == EQUAL) return std::make_pair(true, iter);
|
||||
|
||||
m_rightCurves.insert(iter, curve);
|
||||
return std::make_pair(false, --iter);
|
||||
|
|
@ -314,8 +298,7 @@ public:
|
|||
return m_point;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Get the actual event point (non-const version).
|
||||
/*! Get the actual event point (non-const version).
|
||||
* \pre The event is associated with a valid point.
|
||||
*/
|
||||
Point_2& point()
|
||||
|
|
@ -324,14 +307,12 @@ public:
|
|||
return m_point;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Get a curve associated with the event (const version).
|
||||
/*! Get a curve associated with the event (const version).
|
||||
* \pre The event has incident curves.
|
||||
*/
|
||||
const X_monotone_curve_2& curve() const
|
||||
{
|
||||
if (has_left_curves())
|
||||
return (m_leftCurves.front()->last_curve());
|
||||
if (has_left_curves()) return (m_leftCurves.front()->last_curve());
|
||||
|
||||
CGAL_assertion (has_right_curves());
|
||||
return (m_rightCurves.front()->last_curve());
|
||||
|
|
@ -452,7 +433,7 @@ public:
|
|||
|
||||
#ifdef CGAL_SL_VERBOSE
|
||||
template<typename Traits, typename Subcurve>
|
||||
void Sweep_line_event<Traits, Subcurve>::Print()
|
||||
void Surface_sweep_event<Traits, Subcurve>::Print()
|
||||
{
|
||||
std::cout << "\tEvent info: " << "\n" ;
|
||||
if (this->is_closed())
|
||||
|
|
@ -12,19 +12,15 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Tali Zvi <talizvi@post.tau.ac.il>
|
||||
// Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
|
||||
#ifndef CGAL_SWEEP_LINE_FUNCTORS_H
|
||||
#define CGAL_SWEEP_LINE_FUNCTORS_H
|
||||
#ifndef CGAL_SURFACE_SWEEP_FUNCTORS_H
|
||||
#define CGAL_SURFACE_SWEEP_FUNCTORS_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
/*! \file
|
||||
|
|
@ -43,11 +39,9 @@ namespace CGAL {
|
|||
* order. Used to maintain the order of the event queue (the X-structure)
|
||||
* in the sweep-line algorithm.
|
||||
*/
|
||||
template <class Traits_, class Event_>
|
||||
class Compare_events
|
||||
{
|
||||
template <typename Traits_, typename Event_>
|
||||
class Compare_events {
|
||||
public:
|
||||
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Event_ Event;
|
||||
|
||||
|
|
@ -55,52 +49,47 @@ public:
|
|||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
|
||||
// should be ok, as Traits_2 is supposed to be the adaptor
|
||||
typedef typename Traits_2::Left_side_category Left_side_category;
|
||||
typedef typename Traits_2::Bottom_side_category Bottom_side_category;
|
||||
typedef typename Traits_2::Top_side_category Top_side_category;
|
||||
typedef typename Traits_2::Right_side_category Right_side_category;
|
||||
typedef typename Traits_2::Left_side_category Left_side_category;
|
||||
typedef typename Traits_2::Bottom_side_category Bottom_side_category;
|
||||
typedef typename Traits_2::Top_side_category Top_side_category;
|
||||
typedef typename Traits_2::Right_side_category Right_side_category;
|
||||
|
||||
private:
|
||||
|
||||
// Data members:
|
||||
const Traits_2 * m_traits; // The geometric-traits object.
|
||||
const Traits_2* m_traits; // The geometric-traits object.
|
||||
|
||||
Arr_parameter_space m_ps_in_x; // Storing curve information when
|
||||
Arr_parameter_space m_ps_in_y; // comparing a curve end with
|
||||
Arr_curve_end m_index; // boundary conditions.
|
||||
Arr_parameter_space m_ps_in_x; // Storing curve information when
|
||||
Arr_parameter_space m_ps_in_y; // comparing a curve end with
|
||||
Arr_curve_end m_index; // boundary conditions.
|
||||
|
||||
public:
|
||||
|
||||
/*! Cosntructor. */
|
||||
Compare_events (const Traits_2 * traits) :
|
||||
m_traits (traits)
|
||||
Compare_events (const Traits_2* traits) :
|
||||
m_traits(traits)
|
||||
{}
|
||||
|
||||
/*!
|
||||
* Compare two existing events.
|
||||
/*! Compare two existing events.
|
||||
* This operator is called by the multiset assertions only in
|
||||
* debug mode (to verify that event was inserted at the right place).
|
||||
*/
|
||||
Comparison_result operator()(const Event* e1, const Event* e2) const
|
||||
{
|
||||
const bool on_boundary1 = e1->is_on_boundary();
|
||||
const bool on_boundary2 = e2->is_on_boundary();
|
||||
const bool on_boundary1 = e1->is_on_boundary();
|
||||
const bool on_boundary2 = e2->is_on_boundary();
|
||||
|
||||
if (! on_boundary1 && ! on_boundary2)
|
||||
{
|
||||
if (! on_boundary1 && ! on_boundary2) {
|
||||
// Both events do not have boundary conditions - just compare the points.
|
||||
return (m_traits->compare_xy_2_object()(e1->point(), e2->point()));
|
||||
}
|
||||
|
||||
if (! on_boundary1)
|
||||
{
|
||||
if (! on_boundary1) {
|
||||
// Compare the point associated with the first event with the second
|
||||
// boundary event.
|
||||
return ( this->operator()(e1->point(), e2) );
|
||||
}
|
||||
|
||||
if (! on_boundary2)
|
||||
{
|
||||
if (! on_boundary2) {
|
||||
// Compare the point associated with the second event with the first
|
||||
// boundary event.
|
||||
return (CGAL::opposite(this->operator()(e2->point(), e1)));
|
||||
|
|
@ -112,8 +101,7 @@ public:
|
|||
e2));
|
||||
}
|
||||
|
||||
/*!
|
||||
* Compare a point, which should be inserted into the event queue,
|
||||
/*! Compare a point, which should be inserted into the event queue,
|
||||
* with an existing event point.
|
||||
*/
|
||||
Comparison_result operator() (const Point_2& pt, const Event* e2) const
|
||||
|
|
@ -161,34 +149,23 @@ public:
|
|||
* Note that the index of the curve end as well as its boundary conditions
|
||||
* must be set beforehand using set_index() and set_parameter_space_in_x/y().
|
||||
*/
|
||||
Comparison_result operator() (const X_monotone_curve_2& cv,
|
||||
const Event* e2) const
|
||||
Comparison_result operator()(const X_monotone_curve_2& cv,
|
||||
const Event* e2) const
|
||||
{
|
||||
return _compare_curve_end_with_event(cv, m_index, m_ps_in_x, m_ps_in_y, e2);
|
||||
}
|
||||
|
||||
/// \name Set the boundary conditions of a curve end we are about to compare.
|
||||
//@{
|
||||
void set_parameter_space_in_x (Arr_parameter_space bx)
|
||||
{
|
||||
m_ps_in_x = bx;
|
||||
}
|
||||
void set_parameter_space_in_x (Arr_parameter_space bx) { m_ps_in_x = bx; }
|
||||
|
||||
void set_parameter_space_in_y (Arr_parameter_space by)
|
||||
{
|
||||
m_ps_in_y = by;
|
||||
}
|
||||
void set_parameter_space_in_y (Arr_parameter_space by) { m_ps_in_y = by; }
|
||||
|
||||
void set_index (Arr_curve_end ind)
|
||||
{
|
||||
m_index = ind;
|
||||
}
|
||||
void set_index (Arr_curve_end ind) { m_index = ind; }
|
||||
//@}
|
||||
|
||||
private:
|
||||
|
||||
/*!
|
||||
* Compare a given curve end with an event.
|
||||
/*! Compare a given curve end with an event.
|
||||
* \param cv The curve.
|
||||
* \param ind The curve end.
|
||||
* \param ps_x The boundary condition of the curve end in x.
|
||||
|
|
@ -197,17 +174,15 @@ private:
|
|||
* \return The comparison result of the curve end with the event.
|
||||
*/
|
||||
Comparison_result
|
||||
_compare_curve_end_with_event (const X_monotone_curve_2& cv,
|
||||
Arr_curve_end ind,
|
||||
Arr_parameter_space ps_x,
|
||||
Arr_parameter_space ps_y,
|
||||
const Event* e2) const
|
||||
_compare_curve_end_with_event(const X_monotone_curve_2& cv,
|
||||
Arr_curve_end ind,
|
||||
Arr_parameter_space ps_x,
|
||||
Arr_parameter_space ps_y,
|
||||
const Event* e2) const
|
||||
{
|
||||
// Check if the curve end has a boundary condition in x.
|
||||
if (ps_x == ARR_LEFT_BOUNDARY)
|
||||
{
|
||||
if (e2->parameter_space_in_x() == ARR_LEFT_BOUNDARY)
|
||||
{
|
||||
if (ps_x == ARR_LEFT_BOUNDARY) {
|
||||
if (e2->parameter_space_in_x() == ARR_LEFT_BOUNDARY) {
|
||||
// Both defined on the left boundary - compare them there.
|
||||
CGAL_assertion (ind == ARR_MIN_END);
|
||||
|
||||
|
|
@ -219,15 +194,13 @@ private:
|
|||
return (SMALLER);
|
||||
}
|
||||
|
||||
if (ps_x == ARR_RIGHT_BOUNDARY)
|
||||
{
|
||||
if (e2->parameter_space_in_x() == ARR_RIGHT_BOUNDARY)
|
||||
{
|
||||
if (ps_x == ARR_RIGHT_BOUNDARY) {
|
||||
if (e2->parameter_space_in_x() == ARR_RIGHT_BOUNDARY) {
|
||||
// Both defined on the right boundary - compare them there.
|
||||
CGAL_assertion (ind == ARR_MAX_END);
|
||||
|
||||
return (m_traits->compare_y_curve_ends_2_object() (cv, e2->curve(),
|
||||
ind));
|
||||
return (m_traits->compare_y_curve_ends_2_object()(cv, e2->curve(),
|
||||
ind));
|
||||
}
|
||||
|
||||
// The curve end is obviously larger.
|
||||
|
|
@ -237,11 +210,8 @@ private:
|
|||
// Check if the event has a boundary condition in x. Note that if it
|
||||
// has a negative boundary condition, the curve end is larger than it,
|
||||
// and if it has a positive boundary condition, the curve end is smaller.
|
||||
if (e2->parameter_space_in_x() == ARR_LEFT_BOUNDARY)
|
||||
return (LARGER);
|
||||
|
||||
if (e2->parameter_space_in_x() == ARR_RIGHT_BOUNDARY)
|
||||
return (SMALLER);
|
||||
if (e2->parameter_space_in_x() == ARR_LEFT_BOUNDARY) return (LARGER);
|
||||
if (e2->parameter_space_in_x() == ARR_RIGHT_BOUNDARY) return (SMALLER);
|
||||
|
||||
CGAL_assertion (ps_y != ARR_INTERIOR);
|
||||
Comparison_result res;
|
||||
|
|
@ -249,37 +219,31 @@ private:
|
|||
Arr_curve_end ind2 = _curve_end(e2);
|
||||
|
||||
// Act according to the boundary sign of the event.
|
||||
if (e2->parameter_space_in_y() == ARR_BOTTOM_BOUNDARY)
|
||||
{
|
||||
if (e2->parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) {
|
||||
|
||||
// Compare the x-positions of the two entities.
|
||||
res = m_traits->compare_x_curve_ends_2_object() (cv, ind,
|
||||
e2->curve(), ind2);
|
||||
if (res != EQUAL)
|
||||
return (res);
|
||||
res = m_traits->compare_x_curve_ends_2_object()(cv, ind,
|
||||
e2->curve(), ind2);
|
||||
if (res != EQUAL) return (res);
|
||||
|
||||
// In case of equal x-positions, the curve end is larger than the event,
|
||||
// which lies on the bottom boundary (unless it also lies on the bottom
|
||||
// boundary).
|
||||
if (ps_y == ARR_BOTTOM_BOUNDARY)
|
||||
return (EQUAL);
|
||||
if (ps_y == ARR_BOTTOM_BOUNDARY) return (EQUAL);
|
||||
|
||||
return (LARGER);
|
||||
}
|
||||
|
||||
if (e2->parameter_space_in_y() == ARR_TOP_BOUNDARY)
|
||||
{
|
||||
if (e2->parameter_space_in_y() == ARR_TOP_BOUNDARY) {
|
||||
// Compare the x-positions of the two entities.
|
||||
res = m_traits->compare_x_curve_ends_2_object() (cv, ind,
|
||||
e2->curve(), ind2);
|
||||
if (res != EQUAL)
|
||||
return (res);
|
||||
res = m_traits->compare_x_curve_ends_2_object()(cv, ind,
|
||||
e2->curve(), ind2);
|
||||
if (res != EQUAL) return (res);
|
||||
|
||||
// In case of equal x-positions, the curve end is smaller than the event,
|
||||
// which lies on the top boundary (unless it also lies on the top
|
||||
// boundary).
|
||||
if (ps_y == ARR_TOP_BOUNDARY)
|
||||
return (EQUAL);
|
||||
if (ps_y == ARR_TOP_BOUNDARY) return (EQUAL);
|
||||
|
||||
return (SMALLER);
|
||||
}
|
||||
|
|
@ -287,10 +251,9 @@ private:
|
|||
// If we reached here, e2 is not a boundary event and is associated with
|
||||
// a valid point. We compare the x-position of this point with the curve
|
||||
// end.
|
||||
res = m_traits->compare_x_point_curve_end_2_object() (e2->point(), cv, ind);
|
||||
res = m_traits->compare_x_point_curve_end_2_object()(e2->point(), cv, ind);
|
||||
|
||||
if (res != EQUAL)
|
||||
return (CGAL::opposite(res));
|
||||
if (res != EQUAL) return (CGAL::opposite(res));
|
||||
|
||||
// In case of equal x-positions, is the curve end has a negative boundary
|
||||
// sign, then it lies on the bottom boundary below the event. Otherwise,
|
||||
|
|
@ -299,7 +262,7 @@ private:
|
|||
}
|
||||
|
||||
/*! Detemine if the given event represents a left or a right curve end. */
|
||||
inline Arr_curve_end _curve_end (const Event* e) const
|
||||
inline Arr_curve_end _curve_end(const Event* e) const
|
||||
{
|
||||
return (e->has_left_curves()) ?
|
||||
((e->is_right_end()) ? ARR_MAX_END : ARR_MIN_END) :
|
||||
|
|
@ -307,38 +270,32 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
// Forward decleration:
|
||||
template <class Traits, class Subcurve>
|
||||
class Sweep_line_event;
|
||||
template <class Traits, class Subcurve> class Surface_sweep_event;
|
||||
|
||||
/*! \class
|
||||
/*! \typename
|
||||
* A functor used to compare curves and curve endpoints by their vertical
|
||||
* y-order. Used to maintain the order of the status line (the Y-structure)
|
||||
* in the sweep-line algorithm.
|
||||
*/
|
||||
template <class Traits_, class Subcurve_>
|
||||
class Curve_comparer
|
||||
{
|
||||
template <typename Traits_, typename Subcurve_>
|
||||
class Curve_comparer {
|
||||
public:
|
||||
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Subcurve_ Subcurve;
|
||||
typedef Arr_traits_basic_adaptor_2<Traits_2> Traits_adaptor_2;
|
||||
|
||||
typedef typename Traits_adaptor_2::Point_2 Point_2;
|
||||
typedef typename Traits_adaptor_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef Sweep_line_event<Traits_2, Subcurve> Event;
|
||||
typedef Surface_sweep_event<Traits_2, Subcurve> Event;
|
||||
|
||||
private:
|
||||
|
||||
const Traits_adaptor_2 * m_traits; // A geometric-traits object.
|
||||
Event **m_curr_event; // Points to the current event point.
|
||||
const Traits_adaptor_2* m_traits; // A geometric-traits object.
|
||||
Event** m_curr_event; // Points to the current event point.
|
||||
|
||||
public:
|
||||
|
||||
/*! Constructor. */
|
||||
template <class Sweep_event>
|
||||
Curve_comparer (const Traits_adaptor_2 * t, Sweep_event** e_ptr) :
|
||||
template <typename Sweep_event>
|
||||
Curve_comparer (const Traits_adaptor_2* t, Sweep_event** e_ptr) :
|
||||
m_traits(t),
|
||||
m_curr_event(reinterpret_cast<Event**>(e_ptr))
|
||||
{}
|
||||
|
|
@ -347,7 +304,7 @@ public:
|
|||
* Compare the vertical position of two subcurves in the status line.
|
||||
* This operator is called only in debug mode.
|
||||
*/
|
||||
Comparison_result operator()(const Subcurve *c1, const Subcurve *c2) const
|
||||
Comparison_result operator()(const Subcurve* c1, const Subcurve* c2) const
|
||||
{
|
||||
// In case to two curves are right curves at the same event, compare
|
||||
// to the right of the event point.
|
||||
|
|
@ -393,10 +350,8 @@ public:
|
|||
/*!
|
||||
* Compare the relative y-order of the given point and the given subcurve.
|
||||
*/
|
||||
Comparison_result operator() (const Point_2& pt, const Subcurve *sc) const
|
||||
{
|
||||
return (m_traits->compare_y_at_x_2_object()(pt, sc->last_curve()));
|
||||
}
|
||||
Comparison_result operator()(const Point_2& pt, const Subcurve* sc) const
|
||||
{ return (m_traits->compare_y_at_x_2_object()(pt, sc->last_curve())); }
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -17,24 +17,23 @@
|
|||
// Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efifogel@gmail.com>
|
||||
|
||||
#ifndef CGAL_SWEEP_LINE_SUBCURVE_H
|
||||
#define CGAL_SWEEP_LINE_SUBCURVE_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#ifndef CGAL_SURFACE_SWEEP_SUBCURVE_H
|
||||
#define CGAL_SURFACE_SWEEP_SUBCURVE_H
|
||||
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
/*! \file
|
||||
* Defintion of the Sweep_line_subcurve class.
|
||||
* Defintion of the Surface_sweep_subcurve class.
|
||||
*/
|
||||
|
||||
#include <CGAL/Sweep_line_2/Sweep_line_functors.h>
|
||||
#include <CGAL/Sweep_line_2/Sweep_line_event.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_functors.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_event.h>
|
||||
#include <CGAL/Multiset.h>
|
||||
#include <CGAL/assertions.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
/*! \class Sweep_line_subcurve
|
||||
/*! \class Surface_sweep_subcurve
|
||||
*
|
||||
* This is a wrapper class to X_monotone_curve_2 in the traits class, that
|
||||
* contains data that is used when applying the sweep algorithm on a set of
|
||||
|
|
@ -50,19 +49,19 @@ namespace CGAL {
|
|||
* an overlap, otherwise thay are both NULL.
|
||||
*/
|
||||
template <typename Traits_>
|
||||
class Sweep_line_subcurve {
|
||||
class Surface_sweep_subcurve {
|
||||
public:
|
||||
typedef Traits_ Traits_2;
|
||||
typedef typename Traits_2::Point_2 Point_2;
|
||||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
|
||||
typedef Sweep_line_subcurve<Traits_2> Self;
|
||||
typedef Surface_sweep_subcurve<Traits_2> Self;
|
||||
typedef Curve_comparer<Traits_2, Self> Compare_curves;
|
||||
typedef Multiset<Self*, Compare_curves, CGAL_ALLOCATOR(int)>
|
||||
Status_line;
|
||||
typedef typename Status_line::iterator Status_line_iterator;
|
||||
|
||||
typedef Sweep_line_event<Traits_2, Self> Event;
|
||||
typedef Surface_sweep_event<Traits_2, Self> Event;
|
||||
|
||||
protected:
|
||||
// Data members:
|
||||
|
|
@ -83,14 +82,14 @@ public:
|
|||
|
||||
/*! Construct default.
|
||||
*/
|
||||
Sweep_line_subcurve() :
|
||||
Surface_sweep_subcurve() :
|
||||
m_orig_subcurve1(NULL),
|
||||
m_orig_subcurve2(NULL)
|
||||
{}
|
||||
|
||||
/*! Construct from a curve.
|
||||
*/
|
||||
Sweep_line_subcurve(const X_monotone_curve_2& curve) :
|
||||
Surface_sweep_subcurve(const X_monotone_curve_2& curve) :
|
||||
m_lastCurve(curve),
|
||||
m_orig_subcurve1(NULL),
|
||||
m_orig_subcurve2(NULL)
|
||||
|
|
@ -100,7 +99,7 @@ public:
|
|||
void init(const X_monotone_curve_2& curve) { m_lastCurve = curve; }
|
||||
|
||||
/*! Destructor. */
|
||||
~Sweep_line_subcurve() {}
|
||||
~Surface_sweep_subcurve() {}
|
||||
|
||||
/*! Get the last intersecing curve so far (const version). */
|
||||
const X_monotone_curve_2& last_curve() const { return m_lastCurve; }
|
||||
|
|
@ -163,7 +162,7 @@ public:
|
|||
}
|
||||
|
||||
/*! Check if the given subcurve is a node in the overlapping hierarchy. */
|
||||
bool is_inner_node(Self *s)
|
||||
bool is_inner_node(Self* s)
|
||||
{
|
||||
if (this == s) return true;
|
||||
if (m_orig_subcurve1 == NULL) return false;
|
||||
|
|
@ -204,7 +203,7 @@ public:
|
|||
}
|
||||
|
||||
/*! Check if the two hierarchies contain a common leaf node. */
|
||||
bool has_common_leaf(Self *s)
|
||||
bool has_common_leaf(Self* s)
|
||||
{
|
||||
std::list<Self*> my_leaves;
|
||||
std::list<Self*> other_leaves;
|
||||
|
|
@ -257,7 +256,7 @@ public:
|
|||
|
||||
#ifdef CGAL_SL_VERBOSE
|
||||
template<class Traits>
|
||||
void Sweep_line_subcurve<Traits>::Print() const
|
||||
void Surface_sweep_subcurve<Traits>::Print() const
|
||||
{
|
||||
std::cout << "Curve " << this
|
||||
<< " (" << m_lastCurve << ") "
|
||||
|
|
@ -12,26 +12,22 @@
|
|||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s): Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
// (based on old version by Tali Zvi)
|
||||
|
||||
#ifndef CGAL_SWEEP_LINE_2_ALGORITHMS_H
|
||||
#define CGAL_SWEEP_LINE_2_ALGORITHMS_H
|
||||
#ifndef CGAL_SURFACE_SWEEP_2_ALGORITHMS_H
|
||||
#define CGAL_SURFACE_SWEEP_2_ALGORITHMS_H
|
||||
|
||||
#include <CGAL/license/Sweep_line_2.h>
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
|
||||
/*!
|
||||
* \file Definition of the sweep-line related functions.
|
||||
* \file Definition of the surface-sweep related functions.
|
||||
*/
|
||||
|
||||
#include <CGAL/Sweep_line_2.h>
|
||||
#include <CGAL/Sweep_line_2/Sweep_line_2_visitors.h>
|
||||
#include <CGAL/Surface_sweep_2.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_2_visitors.h>
|
||||
|
||||
#include <CGAL/Segment_2.h>
|
||||
#include <CGAL/Arr_segment_traits_2.h>
|
||||
|
|
@ -99,9 +95,8 @@ struct Default_arr_traits<CGAL::Arr_linear_object_2<Kernel> >
|
|||
typedef CGAL::Arr_linear_traits_2<Kernel> Traits;
|
||||
};
|
||||
|
||||
/*!
|
||||
* Compute all intersection points induced by a range of input curves.
|
||||
* The intersections are calculated using the sweep-line algorithm.
|
||||
/*! Compute all intersection points induced by a range of input curves.
|
||||
* The intersections are calculated using the surface-sweep algorithm.
|
||||
* \param begin An input iterator for the first curve in the range.
|
||||
* \param end A input past-the-end iterator for the range.
|
||||
* \param points Output: An output iterator for the intersection points
|
||||
|
|
@ -111,28 +106,28 @@ struct Default_arr_traits<CGAL::Arr_linear_object_2<Kernel> >
|
|||
* \pre The value-type of CurveInputIterator is Traits::Curve_2, and the
|
||||
* value-type of OutputIterator is Traits::Point_2.
|
||||
*/
|
||||
template <class CurveInputIterator, class OutputIterator, class Traits>
|
||||
OutputIterator compute_intersection_points (CurveInputIterator curves_begin,
|
||||
CurveInputIterator curves_end,
|
||||
OutputIterator points,
|
||||
bool report_endpoints,
|
||||
Traits &tr)
|
||||
template <typename CurveInputIterator, class OutputIterator, typename Traits>
|
||||
OutputIterator compute_intersection_points(CurveInputIterator curves_begin,
|
||||
CurveInputIterator curves_end,
|
||||
OutputIterator points,
|
||||
bool report_endpoints,
|
||||
Traits &tr)
|
||||
{
|
||||
// Define the sweep-line types:
|
||||
typedef Sweep_line_points_visitor<Traits,OutputIterator> Visitor;
|
||||
typedef Sweep_line_2< Traits,
|
||||
Sweep_line_points_visitor<Traits, OutputIterator> >
|
||||
Sweep_line;
|
||||
// Define the surface-sweep types:
|
||||
typedef Surface_sweep_points_visitor<Traits,OutputIterator> Visitor;
|
||||
typedef Surface_sweep_2< Traits,
|
||||
Surface_sweep_points_visitor<Traits, OutputIterator> >
|
||||
Surface_sweep;
|
||||
|
||||
// Perform the sweep and obtain the intersection points.
|
||||
Visitor visitor (points, report_endpoints);
|
||||
Sweep_line sweep_line (&tr, &visitor);
|
||||
Surface_sweep surface_sweep (&tr, &visitor);
|
||||
visitor.sweep(curves_begin, curves_end);
|
||||
|
||||
return (visitor.output_iterator());
|
||||
}
|
||||
|
||||
template <class CurveInputIterator, class OutputIterator>
|
||||
template <typename CurveInputIterator, typename OutputIterator>
|
||||
OutputIterator compute_intersection_points (CurveInputIterator curves_begin,
|
||||
CurveInputIterator curves_end,
|
||||
OutputIterator points,
|
||||
|
|
@ -146,10 +141,9 @@ OutputIterator compute_intersection_points (CurveInputIterator curves_begin,
|
|||
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
|
||||
* induced by a range of input curves.
|
||||
* The subcurves are calculated using the sweep-line algorithm.
|
||||
* The subcurves are calculated using the surface-sweep algorithm.
|
||||
* \param begin An input iterator for the first curve in the range.
|
||||
* \param end A input past-the-end iterator for the range.
|
||||
* \param points Output: An output iterator for the subcurve.
|
||||
|
|
@ -158,32 +152,31 @@ OutputIterator compute_intersection_points (CurveInputIterator curves_begin,
|
|||
* \pre The value-type of CurveInputIterator is Traits::Curve_2, and the
|
||||
* value-type of OutputIterator is Traits::X_monotone_curve_2.
|
||||
*/
|
||||
template <class CurveInputIterator, class OutputIterator, class Traits>
|
||||
template <typename CurveInputIterator, typename OutputIterator, typename Traits>
|
||||
OutputIterator compute_subcurves (CurveInputIterator curves_begin,
|
||||
CurveInputIterator curves_end,
|
||||
OutputIterator subcurves,
|
||||
bool mult_overlaps, Traits &tr)
|
||||
{
|
||||
// Define the sweep-line types:
|
||||
typedef Sweep_line_subcurves_visitor<Traits, OutputIterator> Visitor;
|
||||
typedef Sweep_line_2<Traits,
|
||||
Sweep_line_subcurves_visitor<Traits, OutputIterator> >
|
||||
Sweep_line;
|
||||
// Define the surface-sweep types:
|
||||
typedef Surface_sweep_subcurves_visitor<Traits, OutputIterator> Visitor;
|
||||
typedef Surface_sweep_2<Traits,
|
||||
Surface_sweep_subcurves_visitor<Traits, OutputIterator> >
|
||||
Surface_sweep;
|
||||
|
||||
// Perform the sweep and obtain the subcurves.
|
||||
Visitor visitor (subcurves, mult_overlaps);
|
||||
Sweep_line sweep_line (&tr, &visitor);
|
||||
Surface_sweep surface_sweep (&tr, &visitor);
|
||||
visitor.sweep(curves_begin, curves_end);
|
||||
|
||||
return (visitor.output_iterator());
|
||||
}
|
||||
|
||||
|
||||
template <class CurveInputIterator, class OutputIterator>
|
||||
OutputIterator compute_subcurves (CurveInputIterator curves_begin,
|
||||
CurveInputIterator curves_end,
|
||||
OutputIterator subcurves,
|
||||
bool mult_overlaps = false)
|
||||
template <typename CurveInputIterator, typename OutputIterator>
|
||||
OutputIterator compute_subcurves(CurveInputIterator curves_begin,
|
||||
CurveInputIterator curves_end,
|
||||
OutputIterator subcurves,
|
||||
bool mult_overlaps = false)
|
||||
{
|
||||
typedef typename std::iterator_traits<CurveInputIterator>::value_type Curve;
|
||||
typename Default_arr_traits<Curve>::Traits m_traits;
|
||||
|
|
@ -191,32 +184,30 @@ OutputIterator compute_subcurves (CurveInputIterator curves_begin,
|
|||
m_traits);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Determine if there occurs an intersection between any pair of curves in
|
||||
/*! Determine if there occurs an intersection between any pair of curves in
|
||||
* a given range.
|
||||
* \param begin An input iterator for the first curve in the range.
|
||||
* \param end A input past-the-end iterator for the range.
|
||||
* \return (true) if any pair of curves intersect; (false) otherwise.
|
||||
*/
|
||||
template <class CurveInputIterator, class Traits>
|
||||
bool do_curves_intersect (CurveInputIterator curves_begin,
|
||||
CurveInputIterator curves_end, Traits &tr)
|
||||
template <typename CurveInputIterator, typename Traits>
|
||||
bool do_curves_intersect(CurveInputIterator curves_begin,
|
||||
CurveInputIterator curves_end, Traits &tr)
|
||||
{
|
||||
// Define the sweep-line types:
|
||||
typedef Sweep_line_do_curves_x_visitor<Traits> Visitor;
|
||||
typedef Sweep_line_2<Traits, Sweep_line_do_curves_x_visitor<Traits> >
|
||||
Sweep_line;
|
||||
// Define the surface-sweep types:
|
||||
typedef Surface_sweep_do_curves_x_visitor<Traits> Visitor;
|
||||
typedef Surface_sweep_2<Traits, Surface_sweep_do_curves_x_visitor<Traits> >
|
||||
Surface_sweep;
|
||||
|
||||
// Perform the sweep and obtain the subcurves.
|
||||
Visitor visitor;
|
||||
Sweep_line sweep_line (&tr, &visitor);
|
||||
Visitor visitor;
|
||||
Surface_sweep surface_sweep(&tr, &visitor);
|
||||
visitor.sweep(curves_begin, curves_end);
|
||||
|
||||
return (visitor.found_intersection());
|
||||
}
|
||||
|
||||
|
||||
template <class CurveInputIterator>
|
||||
template <typename CurveInputIterator>
|
||||
bool do_curves_intersect (CurveInputIterator curves_begin,
|
||||
CurveInputIterator curves_end)
|
||||
{
|
||||
|
|
@ -0,0 +1,228 @@
|
|||
// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
|
||||
|
||||
#ifndef CGAL_SURFACE_SWEEP_EMPTY_VISITOR_H
|
||||
#define CGAL_SURFACE_SWEEP_EMPTY_VISITOR_H
|
||||
|
||||
#include <CGAL/license/Surface_sweep_2.h>
|
||||
|
||||
/*! \file
|
||||
* Definition of the Surface_sweep_empty_visitor class-template.
|
||||
*/
|
||||
|
||||
#include <CGAL/No_intersection_surface_sweep_2.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_event.h>
|
||||
#include <CGAL/Surface_sweep_2/Surface_sweep_subcurve.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
/*! \class
|
||||
* An empty surface-sweep visitor that does nothing. It is used as a base-class
|
||||
* for other concrete visitors that produce some output.
|
||||
*/
|
||||
template <typename Traits_,
|
||||
typename Subcurve_ = Surface_sweep_subcurve<Traits_>,
|
||||
typename Event_ = Surface_sweep_event<Traits_, Subcurve_>,
|
||||
typename Allocator_ = CGAL_ALLOCATOR(int)>
|
||||
class Surface_sweep_empty_visitor {
|
||||
public:
|
||||
typedef Traits_ Traits_2;
|
||||
typedef Subcurve_ Subcurve;
|
||||
typedef Event_ Event;
|
||||
typedef Allocator_ Allocator;
|
||||
|
||||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Traits_2::Point_2 Point_2;
|
||||
|
||||
typedef Surface_sweep_empty_visitor<Traits_2, Subcurve, Event, Allocator>
|
||||
Self;
|
||||
|
||||
private:
|
||||
// we want to hide the Surface_sweep type
|
||||
typedef No_intersection_surface_sweep_2<Traits_2, Self, Subcurve, Event,
|
||||
Allocator> Surface_sweep;
|
||||
|
||||
typedef typename Surface_sweep::Status_line_iterator Base_status_line_iter;
|
||||
|
||||
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_reverse_iterator
|
||||
Event_subcurve_reverse_iterator;
|
||||
|
||||
protected:
|
||||
// Data members:
|
||||
void* m_surface_sweep; // The sweep-line object.
|
||||
|
||||
public:
|
||||
/*! Constructor. */
|
||||
Surface_sweep_empty_visitor () :
|
||||
m_surface_sweep(NULL)
|
||||
{}
|
||||
|
||||
/*! Attach the a sweep-line object. */
|
||||
void attach(void* sl) { m_surface_sweep = sl; }
|
||||
|
||||
/*! Destructor */
|
||||
virtual ~Surface_sweep_empty_visitor() {}
|
||||
|
||||
/*!
|
||||
* A notification invoked before the sweep-line starts handling the given
|
||||
* event.
|
||||
*/
|
||||
void before_handle_event(Event* /* event */) {}
|
||||
|
||||
/*!
|
||||
* A notification invoked after the sweep-line finishes handling the given
|
||||
* event.
|
||||
*/
|
||||
bool after_handle_event(Event* /* event */,
|
||||
Status_line_iterator /* iter */,
|
||||
bool /* flag */)
|
||||
{ return true; }
|
||||
|
||||
/*! A notification invoked when a new subcurve is created. */
|
||||
void add_subcurve(X_monotone_curve_2 /* cv */,
|
||||
Subcurve* /* sc */)
|
||||
{}
|
||||
|
||||
/*! A notification issued before the sweep process starts. */
|
||||
void before_sweep()
|
||||
{}
|
||||
|
||||
/*! A notification issued after the sweep process ends. */
|
||||
void after_sweep()
|
||||
{}
|
||||
|
||||
/*! Update the event to be the given curve end. */
|
||||
void update_event(Event* /* e */,
|
||||
const Point_2& /* end_point */,
|
||||
const X_monotone_curve_2& /* cv */,
|
||||
Arr_curve_end /* cv_end */,
|
||||
bool /* is_new */)
|
||||
{}
|
||||
|
||||
/*! Update the event to be the given infinite curve end. */
|
||||
void update_event(Event* /* e */,
|
||||
const X_monotone_curve_2& /* cv */,
|
||||
Arr_curve_end /* cv_end */,
|
||||
bool /* is_new */)
|
||||
{}
|
||||
|
||||
/*! Update the event to be the intersection point of two subcurves. */
|
||||
void update_event(Event* /* e */,
|
||||
Subcurve* /* sc1 */,
|
||||
Subcurve* /* sc2 */,
|
||||
bool /* is_new */)
|
||||
{}
|
||||
|
||||
/*! Update the event. */
|
||||
void update_event(Event* /* e */,
|
||||
Subcurve* /* sc1 */)
|
||||
{}
|
||||
|
||||
/*! Update the event. */
|
||||
void update_event(Event* /* e */,
|
||||
const Point_2& /* pt */,
|
||||
bool /* is_new */)
|
||||
{}
|
||||
|
||||
/* Found overlap */
|
||||
void found_overlap(Subcurve* /* sc1 */,
|
||||
Subcurve* /* sc2 */,
|
||||
Subcurve* /* ov_sc */)
|
||||
{}
|
||||
|
||||
/*! Get the first subcurve in the status line. */
|
||||
Status_line_iterator status_line_begin()
|
||||
{ return (this->_surface_sweep()->status_line_begin()); }
|
||||
|
||||
/*! Get a past-the-end iterator for the subcurves in the status line. */
|
||||
Status_line_iterator status_line_end()
|
||||
{ return (this->_surface_sweep()->status_line_end()); }
|
||||
|
||||
/*! Get the position of the given subcurve in the status line. */
|
||||
Status_line_iterator status_line_position(Subcurve* sc)
|
||||
{ return (sc->hint()); }
|
||||
|
||||
/*! Get the number of subcurves in the status line. */
|
||||
unsigned status_line_size() const
|
||||
{ return (this->_surface_sweep()->status_line_size()); }
|
||||
|
||||
/*! Check if the status line is empty. */
|
||||
bool is_status_line_empty() const
|
||||
{ return (this->_surface_sweep()->is_status_line_empty()); }
|
||||
|
||||
/*! Deallocate the given event. */
|
||||
void deallocate_event(Event* e)
|
||||
{ this->_surface_sweep()->deallocate_event(e); }
|
||||
|
||||
/*! Stop the sweep-line process. */
|
||||
void stop_sweep() { this->_surface_sweep()->stop_sweep(); }
|
||||
|
||||
/*! Get the sweep-line object. */
|
||||
void* surface_sweep() { return (m_surface_sweep); }
|
||||
|
||||
/*! Get the current event. */
|
||||
Event* current_event() { return (this->_surface_sweep()->current_event()); }
|
||||
|
||||
/*! Get the geometry-traits class. */
|
||||
const Traits_2* traits() { return (this->_surface_sweep()->traits()); }
|
||||
|
||||
private:
|
||||
/*! Get the sweep-line object. */
|
||||
Surface_sweep* _surface_sweep()
|
||||
{ return (reinterpret_cast<Surface_sweep*>(m_surface_sweep)); }
|
||||
|
||||
const Surface_sweep* _surface_sweep() const
|
||||
{ return (reinterpret_cast<const Surface_sweep*>(m_surface_sweep)); }
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
This package consists of an a robust implementation of an efficient variant
|
||||
of the well-known plane-sweep algorithm. The implementation follows the Exact
|
||||
Geometric Computation paradigm and thus guarantees exact results. It handles
|
||||
all cases including degeneracies, such as isolated points, vertical segments,
|
||||
and overlapping curves. It is not limited to segments---it can handle sets of
|
||||
general x-monotone curves provided as input. The implementation provides a
|
||||
framework that can be used to implement other concrete algorithms, such as the
|
||||
overlay of two arrangements on surfaces.
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
|
||||
project( Sweep_line_2_Tests )
|
||||
project( Surface_sweep_2_Tests )
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.10)
|
||||
|
||||
|
|
@ -27,4 +27,3 @@ else()
|
|||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue