Renamed sweep-line to surface-sweep and cleaned up

This commit is contained in:
Efi Fogel 2017-05-27 12:30:41 +03:00
parent 7e651b6b78
commit 3e6de6b439
216 changed files with 2131 additions and 2770 deletions

View File

@ -1,92 +1,92 @@
language: cpp
dist: trusty
sudo: required
env:
matrix:
- PACKAGE='CHECK'
- PACKAGE='AABB_tree Advancing_front_surface_reconstruction Algebraic_foundations '
- PACKAGE='Algebraic_kernel_d Algebraic_kernel_for_circles Algebraic_kernel_for_spheres '
- PACKAGE='Alpha_shapes_2 Alpha_shapes_3 Apollonius_graph_2 '
- PACKAGE='Arithmetic_kernel Arrangement_on_surface_2 Barycentric_coordinates_2 '
- PACKAGE='BGL Boolean_set_operations_2 Bounding_volumes '
- PACKAGE='Box_intersection_d CGAL_ImageIO CGAL_ipelets '
- PACKAGE='Circular_kernel_2 Circular_kernel_3 Circulator '
- PACKAGE='Combinatorial_map Cone_spanners_2 Convex_decomposition_3 '
- PACKAGE='Convex_hull_2 Convex_hull_3 Convex_hull_d '
- PACKAGE='Distance_2 Distance_3 Envelope_2 '
- PACKAGE='Envelope_3 Filtered_kernel Generalized_map '
- PACKAGE='Generator Geomview GraphicsView '
- PACKAGE='HalfedgeDS Hash_map Inscribed_areas '
- PACKAGE='Installation Interpolation Intersections_2 '
- PACKAGE='Intersections_3 Interval_skip_list Interval_support '
- PACKAGE='Inventor Jet_fitting_3 Kernel_23 '
- PACKAGE='Kernel_d Kinetic_data_structures Kinetic_framework '
- PACKAGE='Linear_cell_complex Matrix_search Mesh_2 '
- PACKAGE='Mesh_3 Minkowski_sum_2 Minkowski_sum_3 '
- PACKAGE='Modifier Modular_arithmetic Nef_2 '
- PACKAGE='Nef_3 Nef_S2 NewKernel_d '
- PACKAGE='Number_types Optimal_transportation_reconstruction_2 Partition_2 '
- PACKAGE='Periodic_2_triangulation_2 Periodic_3_triangulation_3 Point_set_2 '
- PACKAGE='Point_set_3 Point_set_processing_3 Point_set_shape_detection_3 '
- PACKAGE='Poisson_surface_reconstruction_3 Polygon Polygon_mesh_processing '
- PACKAGE='Polyhedron Polyhedron_IO Polyline_simplification_2 '
- PACKAGE='Polynomial Polytope_distance_d Principal_component_analysis '
- PACKAGE='Profiling_tools QP_solver Random_numbers '
- PACKAGE='Ridges_3 Scale_space_reconstruction_3 Segment_Delaunay_graph_2 '
- PACKAGE='Segment_Delaunay_graph_Linf_2 Skin_surface_3 Snap_rounding_2 '
- PACKAGE='Solver_interface Spatial_searching Spatial_sorting '
- PACKAGE='STL_Extension Straight_skeleton_2 Stream_lines_2 '
- 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='TDS_3 Three Triangulation '
- PACKAGE='Triangulation_2 Triangulation_3 Union_find '
- PACKAGE='Visibility_2 Voronoi_diagram_2 '
- PACKAGE='Polyhedron_demo'
install:
before_script:
- mkdir -p build
- cd build
- cmake -DCGAL_HEADER_ONLY=ON -DWITH_demos:BOOL=TRUE -DWITH_examples:BOOL=true -DWITH_tests:BOOL=TRUE -DCMAKE_CXX_FLAGS_RELEASE=-DCGAL_NDEBUG ..
- make
- cd ..
script:
language: cpp
dist: trusty
sudo: required
env:
matrix:
- PACKAGE='CHECK'
- PACKAGE='AABB_tree Advancing_front_surface_reconstruction Algebraic_foundations '
- PACKAGE='Algebraic_kernel_d Algebraic_kernel_for_circles Algebraic_kernel_for_spheres '
- PACKAGE='Alpha_shapes_2 Alpha_shapes_3 Apollonius_graph_2 '
- PACKAGE='Arithmetic_kernel Arrangement_on_surface_2 Barycentric_coordinates_2 '
- PACKAGE='BGL Boolean_set_operations_2 Bounding_volumes '
- PACKAGE='Box_intersection_d CGAL_ImageIO CGAL_ipelets '
- PACKAGE='Circular_kernel_2 Circular_kernel_3 Circulator '
- PACKAGE='Combinatorial_map Cone_spanners_2 Convex_decomposition_3 '
- PACKAGE='Convex_hull_2 Convex_hull_3 Convex_hull_d '
- PACKAGE='Distance_2 Distance_3 Envelope_2 '
- PACKAGE='Envelope_3 Filtered_kernel Generalized_map '
- PACKAGE='Generator Geomview GraphicsView '
- PACKAGE='HalfedgeDS Hash_map Inscribed_areas '
- PACKAGE='Installation Interpolation Intersections_2 '
- PACKAGE='Intersections_3 Interval_skip_list Interval_support '
- PACKAGE='Inventor Jet_fitting_3 Kernel_23 '
- PACKAGE='Kernel_d Kinetic_data_structures Kinetic_framework '
- PACKAGE='Linear_cell_complex Matrix_search Mesh_2 '
- PACKAGE='Mesh_3 Minkowski_sum_2 Minkowski_sum_3 '
- PACKAGE='Modifier Modular_arithmetic Nef_2 '
- PACKAGE='Nef_3 Nef_S2 NewKernel_d '
- PACKAGE='Number_types Optimal_transportation_reconstruction_2 Partition_2 '
- PACKAGE='Periodic_2_triangulation_2 Periodic_3_triangulation_3 Point_set_2 '
- PACKAGE='Point_set_3 Point_set_processing_3 Point_set_shape_detection_3 '
- PACKAGE='Poisson_surface_reconstruction_3 Polygon Polygon_mesh_processing '
- PACKAGE='Polyhedron Polyhedron_IO Polyline_simplification_2 '
- PACKAGE='Polynomial Polytope_distance_d Principal_component_analysis '
- PACKAGE='Profiling_tools QP_solver Random_numbers '
- PACKAGE='Ridges_3 Scale_space_reconstruction_3 Segment_Delaunay_graph_2 '
- PACKAGE='Segment_Delaunay_graph_Linf_2 Skin_surface_3 Snap_rounding_2 '
- PACKAGE='Solver_interface Spatial_searching Spatial_sorting '
- PACKAGE='STL_Extension Straight_skeleton_2 Stream_lines_2 '
- 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 Surface_sweep_2 TDS_2 '
- PACKAGE='TDS_3 Three Triangulation '
- PACKAGE='Triangulation_2 Triangulation_3 Union_find '
- PACKAGE='Visibility_2 Voronoi_diagram_2 '
- PACKAGE='Polyhedron_demo'
install:
before_script:
- mkdir -p build
- cd build
- cmake -DCGAL_HEADER_ONLY=ON -DWITH_demos:BOOL=TRUE -DWITH_examples:BOOL=true -DWITH_tests:BOOL=TRUE -DCMAKE_CXX_FLAGS_RELEASE=-DCGAL_NDEBUG ..
- make
- cd ..
script:
- cd ./.travis
- bash -x -e ./build_package.sh $PACKAGE
compiler:
- clang
- gcc
addons:
compiler:
- clang
- gcc
addons:
apt:
sources:
- sourceline: 'ppa:ppsspp/cmake'
packages:
packages:
- zsh
- cmake
- libboost1.55-dev
- libboost-system1.55-dev
- libboost-program-options1.55-dev
- libboost-thread1.55-dev
- libgmp-dev
- libmpfr-dev
- zlib1g-dev
- libeigen3-dev # too old
- qtbase5-dev
- qtscript5-dev
- libqt5svg5-dev
- qttools5-dev
- qttools5-dev-tools
- libqt5opengl5-dev
- cmake
- libboost1.55-dev
- libboost-system1.55-dev
- libboost-program-options1.55-dev
- libboost-thread1.55-dev
- libgmp-dev
- libmpfr-dev
- zlib1g-dev
- libeigen3-dev # too old
- qtbase5-dev
- qtscript5-dev
- libqt5svg5-dev
- qttools5-dev
- qttools5-dev-tools
- libqt5opengl5-dev
- libqt5gui5
- libqt5widgets5
- libqt5xml5
- qt5-qmake
# Not allowed (yet)
# - geomview
# - libglew1.5-dev
# - libipe-dev
# - libmpfi-dev
# Not allowed (yet)
# - geomview
# - libglew1.5-dev
# - libipe-dev
# - libmpfi-dev
notifications:
email:
on_success: change # default: always

View File

@ -1,116 +1,116 @@
AABB_tree
Advancing_front_surface_reconstruction
Algebraic_foundations
Algebraic_kernel_d
Algebraic_kernel_for_circles
Algebraic_kernel_for_spheres
Alpha_shapes_2
Alpha_shapes_3
Apollonius_graph_2
Arithmetic_kernel
Arrangement_on_surface_2
Barycentric_coordinates_2
BGL
Boolean_set_operations_2
Bounding_volumes
Box_intersection_d
CGAL_ImageIO
CGAL_ipelets
Circular_kernel_2
Circular_kernel_3
Circulator
Combinatorial_map
Cone_spanners_2
Convex_decomposition_3
Convex_hull_2
Convex_hull_3
Convex_hull_d
Distance_2
Distance_3
Envelope_2
Envelope_3
Filtered_kernel
Generalized_map
Generator
Geomview
GraphicsView
HalfedgeDS
Hash_map
Inscribed_areas
Installation
Interpolation
Intersections_2
Intersections_3
Interval_skip_list
Interval_support
Inventor
Jet_fitting_3
Kernel_23
Kernel_d
Kinetic_data_structures
Kinetic_framework
Linear_cell_complex
Matrix_search
Mesh_2
Mesh_3
Minkowski_sum_2
Minkowski_sum_3
Modifier
Modular_arithmetic
Nef_2
Nef_3
Nef_S2
NewKernel_d
Number_types
Optimal_transportation_reconstruction_2
Partition_2
Periodic_2_triangulation_2
Periodic_3_triangulation_3
Point_set_2
Point_set_3
Point_set_processing_3
Point_set_shape_detection_3
Poisson_surface_reconstruction_3
Polygon
Polygon_mesh_processing
Polyhedron
Polyhedron_IO
Polyline_simplification_2
Polynomial
Polytope_distance_d
Principal_component_analysis
Profiling_tools
QP_solver
Random_numbers
Ridges_3
Scale_space_reconstruction_3
Segment_Delaunay_graph_2
Segment_Delaunay_graph_Linf_2
Skin_surface_3
Snap_rounding_2
Solver_interface
Spatial_searching
Spatial_sorting
STL_Extension
Straight_skeleton_2
Stream_lines_2
Stream_support
Subdivision_method_3
Surface_mesh
Surface_mesh_deformation
Surface_mesher
Surface_mesh_parameterization
Surface_mesh_segmentation
Surface_mesh_shortest_path
Surface_mesh_simplification
Surface_mesh_skeletonization
Sweep_line_2
TDS_2
TDS_3
Three
Triangulation
Triangulation_2
Triangulation_3
Union_find
Visibility_2
Voronoi_diagram_2
AABB_tree
Advancing_front_surface_reconstruction
Algebraic_foundations
Algebraic_kernel_d
Algebraic_kernel_for_circles
Algebraic_kernel_for_spheres
Alpha_shapes_2
Alpha_shapes_3
Apollonius_graph_2
Arithmetic_kernel
Arrangement_on_surface_2
Barycentric_coordinates_2
BGL
Boolean_set_operations_2
Bounding_volumes
Box_intersection_d
CGAL_ImageIO
CGAL_ipelets
Circular_kernel_2
Circular_kernel_3
Circulator
Combinatorial_map
Cone_spanners_2
Convex_decomposition_3
Convex_hull_2
Convex_hull_3
Convex_hull_d
Distance_2
Distance_3
Envelope_2
Envelope_3
Filtered_kernel
Generalized_map
Generator
Geomview
GraphicsView
HalfedgeDS
Hash_map
Inscribed_areas
Installation
Interpolation
Intersections_2
Intersections_3
Interval_skip_list
Interval_support
Inventor
Jet_fitting_3
Kernel_23
Kernel_d
Kinetic_data_structures
Kinetic_framework
Linear_cell_complex
Matrix_search
Mesh_2
Mesh_3
Minkowski_sum_2
Minkowski_sum_3
Modifier
Modular_arithmetic
Nef_2
Nef_3
Nef_S2
NewKernel_d
Number_types
Optimal_transportation_reconstruction_2
Partition_2
Periodic_2_triangulation_2
Periodic_3_triangulation_3
Point_set_2
Point_set_3
Point_set_processing_3
Point_set_shape_detection_3
Poisson_surface_reconstruction_3
Polygon
Polygon_mesh_processing
Polyhedron
Polyhedron_IO
Polyline_simplification_2
Polynomial
Polytope_distance_d
Principal_component_analysis
Profiling_tools
QP_solver
Random_numbers
Ridges_3
Scale_space_reconstruction_3
Segment_Delaunay_graph_2
Segment_Delaunay_graph_Linf_2
Skin_surface_3
Snap_rounding_2
Solver_interface
Spatial_searching
Spatial_sorting
STL_Extension
Straight_skeleton_2
Stream_lines_2
Stream_support
Subdivision_method_3
Surface_mesh
Surface_mesh_deformation
Surface_mesher
Surface_mesh_parameterization
Surface_mesh_segmentation
Surface_mesh_shortest_path
Surface_mesh_simplification
Surface_mesh_skeletonization
Surface_sweep_2
TDS_2
TDS_3
Three
Triangulation
Triangulation_2
Triangulation_3
Union_find
Visibility_2
Voronoi_diagram_2

View File

@ -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;

View File

@ -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,15 +30,14 @@
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.
* \param points_end A past-the-end iterator for the range of query points.
* \param oi Output: An output iterator for the query results.
* \pre The value-type of PointsIterator is Arrangement::Point_2,
* and the value-type of OutputIterator is is pair<Point_2, Result>,
* and the value-type of OutputIterator is is pair<Point_2, Result>,
* where Result is either
* (i) Object or
* (ii) boost::optional<boost::variant<Vertex_const_handle,
@ -51,7 +46,7 @@ namespace CGAL {
* It represents the arrangement feature containing the point.
*/
template<typename GeomTraits, typename TopTraits,
typename PointsIterator, typename OutputIterator>
typename PointsIterator, typename OutputIterator>
OutputIterator
locate(const Arrangement_on_surface_2<GeomTraits, TopTraits>& arr,
PointsIterator points_begin, PointsIterator points_end,
@ -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()) {
@ -98,7 +93,7 @@ locate(const Arrangement_on_surface_2<GeomTraits, TopTraits>& arr,
iso_pts_vec[i++] = Bpl_point_2(vit->point(), iso_v);
}
}
// Obtain a extended traits-class object.
GeomTraits* geom_traits = const_cast<GeomTraits*>(arr.geometry_traits());
@ -110,7 +105,7 @@ locate(const Arrangement_on_surface_2<GeomTraits, TopTraits>& arr,
* GeomTraits, use a reference to GeomTraits to avoid constructing a new one.
* Otherwise, instantiate a local variable of the former and provide
* the later as a single parameter to the constructor.
*
*
* Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has
* only an implicit constructor, (which takes *b as a parameter).
*/
@ -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;
}

View File

@ -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)
{}
};

View File

@ -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 {
@ -65,7 +61,7 @@ template <class ArrangementA, class ArrangementB, class ArrangementR,
class Arr_face_overlay_traits :
public _Arr_default_overlay_traits_base<ArrangementA,
ArrangementB,
ArrangementR>
ArrangementR>
{
public:

View File

@ -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);

View File

@ -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)
{}
};

View File

@ -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

View File

@ -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,32 +46,29 @@ 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;
typedef typename Subcurve::Halfedge_indices_list Indices_list;
typedef Unique_hash_map<Halfedge_handle,
typedef Unique_hash_map<Halfedge_handle,
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;
}
//@}
/*!
* Set the map that maps each halfedge to the list of subcurve indices
void before_deallocate_event(Event* /* event */) { return; }
//@}
/*! 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

View File

@ -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 {
@ -39,44 +35,40 @@ 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_>
template <class Traits_, class Arrangement_, class Event_, class Subcurve_>
class Arr_bounded_planar_insertion_helper :
public Arr_bounded_planar_construction_helper<Traits_, Arrangement_,
Event_, Subcurve_>
{
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:
/*! Constructor. */
Arr_bounded_planar_insertion_helper (Arrangement_2 *arr) :
Base (arr)

View File

@ -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

View File

@ -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 {

View File

@ -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();
}

View File

@ -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;

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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,46 +49,43 @@ 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;
typedef typename Arrangement_2::Face_handle Face_handle;
typedef typename Subcurve::Halfedge_indices_list Indices_list;
typedef Unique_hash_map<Halfedge_handle,
typedef Unique_hash_map<Halfedge_handle,
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. */
@ -143,16 +131,14 @@ public:
if (event == m_prev_plus_inf_y_event)
m_prev_plus_inf_y_event = NULL;
}
//@}
//@}
/*!
* 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)
{
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()); }
};
//-----------------------------------------------------------------------------
@ -181,7 +165,7 @@ public:
//-----------------------------------------------------------------------------
// A notification issued before the sweep process starts.
//
template <class Tr, class Arr, class Evnt, class Sbcv>
template <class Tr, class Arr, class Evnt, class Sbcv>
void Arr_unb_planar_construction_helper<Tr,Arr,Evnt,Sbcv>::before_sweep()
{
// Obtain the four fictitious vertices that form the "corners" of the
@ -191,7 +175,7 @@ void Arr_unb_planar_construction_helper<Tr,Arr,Evnt,Sbcv>::before_sweep()
CGAL_assertion_code
(Vertex_handle v_br = Vertex_handle(m_top_traits->bottom_right_vertex());
Vertex_handle v_tr = Vertex_handle(m_top_traits->top_right_vertex()));
// Get the fictitous halfedges incident to these vertices, representing
// the left, right, top and bottom edges of the fictitious face.
//
@ -205,7 +189,7 @@ void Arr_unb_planar_construction_helper<Tr,Arr,Evnt,Sbcv>::before_sweep()
//
m_lh = v_tl->incident_halfedges();
m_lh = (m_lh->source() != v_bl) ? m_lh->next() : m_lh->twin();
m_bh = m_lh->next();
m_rh = m_bh->next();
m_th = m_rh->next();
@ -215,15 +199,15 @@ void Arr_unb_planar_construction_helper<Tr,Arr,Evnt,Sbcv>::before_sweep()
CGAL_assertion(m_lh->direction() == ARR_RIGHT_TO_LEFT);
CGAL_assertion(m_lh->face() != fict_face);
CGAL_assertion(m_lh->source() == v_tl && m_lh->target() == v_bl);
CGAL_assertion(m_bh->direction() == ARR_LEFT_TO_RIGHT);
CGAL_assertion(m_bh->face() != fict_face);
CGAL_assertion(m_bh->source() == v_bl && m_bh->target() == v_br);
CGAL_assertion(m_rh->direction() == ARR_LEFT_TO_RIGHT);
CGAL_assertion(m_rh->face() != fict_face);
CGAL_assertion(m_rh->source() == v_br && m_rh->target() == v_tr);
CGAL_assertion(m_th->direction() == ARR_RIGHT_TO_LEFT);
CGAL_assertion(m_th->face() != fict_face);
CGAL_assertion(m_th->source() == v_tr && m_th->target() == v_tl);
@ -233,7 +217,7 @@ void Arr_unb_planar_construction_helper<Tr,Arr,Evnt,Sbcv>::before_sweep()
// A notification invoked before the sweep-line starts handling the given
// event.
//
template <class Tr, class Arr, class Evnt, class Sbcv>
template <class Tr, class Arr, class Evnt, class Sbcv>
void Arr_unb_planar_construction_helper<Tr, Arr, Evnt, Sbcv>::
before_handle_event(Event* event)
{
@ -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());

View File

@ -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 {
@ -40,13 +36,12 @@ 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_>
template <class Traits_, class Arrangement_, class Event_, class Subcurve_>
class Arr_unb_planar_insertion_helper :
public Arr_unb_planar_construction_helper<Traits_, Arrangement_,
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,
@ -77,9 +72,9 @@ protected:
typedef typename Base::Topology_traits Topology_traits;
typedef typename Base::Vertex_handle Vertex_handle;
typedef typename Base::Halfedge_handle Halfedge_handle;
public:
/*! Constructor. */
Arr_unb_planar_insertion_helper (Arrangement_2 *arr) :
Base (arr)
@ -109,16 +104,16 @@ public:
//-----------------------------------------------------------------------------
// A notification issued before the sweep process starts.
//
template <class Tr, class Arr, class Evnt, class Sbcv>
template <class Tr, class Arr, class Evnt, class Sbcv>
void Arr_unb_planar_insertion_helper<Tr,Arr,Evnt,Sbcv>::before_sweep ()
{
// Obtain the four fictitious vertices that form the "corners" of the
// fictitious face in the DCEL.
Vertex_handle v_bl =
Vertex_handle (this->m_top_traits->bottom_left_vertex());
Vertex_handle v_tl =
Vertex_handle v_tl =
Vertex_handle (this->m_top_traits->top_left_vertex());
Vertex_handle v_br =
Vertex_handle v_br =
Vertex_handle (this->m_top_traits->bottom_right_vertex());
// Get the fictitous halfedges incident to these vertices, and lying on
@ -129,7 +124,7 @@ void Arr_unb_planar_insertion_helper<Tr,Arr,Evnt,Sbcv>::before_sweep ()
// ^
// x | m_rh
// m_lh | x
// v
// v
// v_bl (.)----->x (.) v_br
// m_bh
//
@ -137,9 +132,9 @@ void Arr_unb_planar_insertion_helper<Tr,Arr,Evnt,Sbcv>::before_sweep ()
if (this->m_lh->source()->parameter_space_in_x() != ARR_LEFT_BOUNDARY)
this->m_lh = this->m_lh->next()->twin();
this->m_bh = this->m_lh->next();
this->m_th = v_tl->incident_halfedges();
if (this->m_th->source()->parameter_space_in_x() == ARR_LEFT_BOUNDARY)
this->m_th = this->m_th->next()->twin();
@ -174,7 +169,7 @@ void Arr_unb_planar_insertion_helper<Tr,Arr,Evnt,Sbcv>::before_sweep ()
// A notification invoked before the sweep-line starts handling the given
// event.
//
template <class Tr, class Arr, class Evnt, class Sbcv>
template <class Tr, class Arr, class Evnt, class Sbcv>
void Arr_unb_planar_insertion_helper<Tr,Arr,Evnt,Sbcv>::
before_handle_event (Event* event)
{
@ -194,7 +189,7 @@ before_handle_event (Event* event)
// The curve is already in the arrangement, but has an infinite end,
// so we have to update the fictitious halfedges.
const Arr_parameter_space ps_x = event->parameter_space_in_x();
if (ps_x == ARR_LEFT_BOUNDARY)
{
// The event lies on the left fictitious halfedge.
@ -209,7 +204,7 @@ before_handle_event (Event* event)
else
{
const Arr_parameter_space ps_y = event->parameter_space_in_y();
if (ps_y == ARR_BOTTOM_BOUNDARY)
{
// The event lies on the bottom fictitious halfedge.
@ -223,7 +218,7 @@ before_handle_event (Event* event)
this->m_prev_plus_inf_y_event = NULL;
}
}
return;
}

View File

@ -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,21 +100,21 @@ 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
// incident to the top-left vertex and directed from right to left.
Vertex_const_handle v_tl =
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 v_tr =
Vertex_const_handle (m_top_traits->top_right_vertex());
);
CGAL_assertion
@ -134,7 +125,7 @@ void Arr_unb_planar_vert_decomp_helper<Tr, Arr>::before_sweep ()
// Initialize the fictitious halfedge lying on the bottom edge of the
// bounding rectangle. We start from the leftmost halfedge, which is
// incident to the bottom-left vertex and whose source is not at -oo.
Vertex_const_handle v_bl =
Vertex_const_handle v_bl =
Vertex_const_handle (m_top_traits->bottom_left_vertex());
m_bottom_fict = v_bl->incident_halfedges();
@ -142,24 +133,22 @@ void Arr_unb_planar_vert_decomp_helper<Tr, Arr>::before_sweep ()
m_bottom_fict = m_bottom_fict->next()->twin();
CGAL_assertion_code (
Vertex_const_handle v_br =
Vertex_const_handle v_br =
Vertex_const_handle (m_top_traits->bottom_right_vertex());
);
CGAL_assertion
((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

View File

@ -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.

View File

@ -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
// 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
@ -122,7 +108,7 @@ decompose(const Arrangement_on_surface_2<GeomTraits, TopTraits>& arr,
* GeomTraits, use a reference to GeomTraits to avoid constructing a new one.
* Otherwise, instantiate a local variable of the former and provide
* the later as a single parameter to the constructor.
*
*
* Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has
* only an implicit constructor, (which takes *b as a parameter).
*/
@ -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

View File

@ -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;

View File

@ -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>
@ -27,10 +23,10 @@
/*!
\file Gps_agg_op.h
\brief The class Gps_agg_op is responsible for aggregated Boolean set
\brief The class Gps_agg_op is responsible for aggregated Boolean set
operations depending on a visitor template parameter.
It uses the sweep-line algorithm from the arrangement packages
to overlay all the polygon sets, and then it uses a BFS that
to overlay all the polygon sets, and then it uses a BFS that
determines which of the faces is contained in the result using
the visitor.
*/
@ -38,21 +34,20 @@
#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>
//#include <CGAL/Boolean_set_operations_2/Gps_insertion_meta_traits.h>
#include <CGAL/Unique_hash_map.h>
#include <CGAL/Unique_hash_map.h>
#include <CGAL/Arr_accessor.h>
#include <CGAL/iterator.h>
#include <CGAL/iterator.h>
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;
@ -64,15 +59,15 @@ class Gps_agg_op
typedef typename Arrangement_2::Face_handle Face_handle;
typedef typename Arrangement_2::Edge_iterator Edge_iterator;
typedef typename Arrangement_2::Vertex_handle Vertex_handle;
typedef typename Arrangement_2::Ccb_halfedge_const_circulator
typedef typename Arrangement_2::Ccb_halfedge_const_circulator
Ccb_halfedge_const_circulator;
typedef typename Arrangement_2::Ccb_halfedge_circulator
typedef typename Arrangement_2::Ccb_halfedge_circulator
Ccb_halfedge_circulator;
typedef std::pair<Arrangement_2 *,
std::vector<Vertex_handle> *> Arr_entry;
typedef Arr_construction_subcurve<Meta_traits> Subcurve;
typedef Arr_construction_subcurve<Meta_traits> Subcurve;
typedef Arr_construction_event<Meta_traits,
Subcurve,
@ -90,24 +85,24 @@ class Gps_agg_op
Meta_traits,
Visitor,
Subcurve,
Event> Sweep_line_2;
Event> Surface_sweep_2;
typedef Unique_hash_map<Halfedge_handle,
typedef Unique_hash_map<Halfedge_handle,
unsigned int> Edges_hash;
typedef Unique_hash_map<Face_handle,
typedef Unique_hash_map<Face_handle,
unsigned int> Faces_hash;
typedef Bfs_visitor_ Bfs_visitor;
typedef Gps_bfs_scanner<Arrangement_2, Bfs_visitor> Bfs_scanner;
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)
public:
/*! Constructor. */
@ -126,7 +121,7 @@ public:
{
std::list<Meta_X_monotone_curve_2> curves_list;
unsigned int n_inf_pgn = 0; // number of infinte polygons (arrangement
unsigned int n_inf_pgn = 0; // number of infinte polygons (arrangement
// with a contained unbounded face
unsigned int n_pgn = 0; // number of polygons (arrangements)
unsigned int i;
@ -142,7 +137,7 @@ public:
Edge_iterator itr = arr->edges_begin();
for(; itr != arr->edges_end(); ++itr)
{
// take only relevant edges (which seperate between contained and
// take only relevant edges (which seperate between contained and
// non-contained faces.
Halfedge_iterator he = itr;
if(he->face()->contained() == he->twin()->face()->contained())
@ -159,7 +154,7 @@ public:
lower, upper, jump,
arr_vec);
m_faces_hash[m_arr->reference_face()] = n_inf_pgn;
m_faces_hash[m_arr->reference_face()] = n_inf_pgn;
Bfs_visitor visitor(&m_edges_hash, &m_faces_hash, n_pgn);
visitor.visit_ubf(m_arr->faces_begin(), n_inf_pgn);
Bfs_scanner scanner(visitor);

View File

@ -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;
@ -72,22 +61,21 @@ public:
typedef typename Base_event::Attribute Attribute;
typedef typename Base::Base_subcurve Base_subcurve;
typedef CurveWrap Subcurve;
typedef std::list<Subcurve*> SubCurveList;
typedef typename SubCurveList::iterator SubCurveListIter;
typedef typename SubCurveList::iterator SubCurveListIter;
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,20 +84,20 @@ 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() &&
CGAL_assertion (this->m_queue->empty() &&
this->m_statusLine.size() == 0);
typedef Unique_hash_map<Vertex_handle, Event *> Vertices_map;
@ -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);
@ -154,7 +143,7 @@ public:
#ifndef CGAL_ARRANGEMENT_ON_SURFACE_2_H
event->set_finite();
#endif
if (! first)
{
q_iter = this->m_queue->insert_after (q_iter, event);
@ -198,7 +187,7 @@ public:
ARR_INTERIOR, ARR_INTERIOR);
// \todo When the boolean set operations are exteneded to support
// unbounded curves, we will need here a special treatment.
#ifndef CGAL_ARRANGEMENT_ON_SURFACE_2_H
event->set_finite();
#endif
@ -250,8 +239,8 @@ public:
(this->m_subCurves + index)->init (*iter);
(this->m_subCurves + index)->set_left_event(e_left);
(this->m_subCurves + index)->set_right_event(e_right);
e_right->add_curve_to_left (this->m_subCurves + index);
e_right->add_curve_to_left (this->m_subCurves + index);
this->_add_curve_to_right (e_left, this->m_subCurves + index);
}
@ -262,9 +251,8 @@ public:
return;
}
private:
/*!
* Check if the given vertex is an endpoint of an edge we are going
* to use in the sweep.

View File

@ -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/Unique_hash_map.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>
@ -40,21 +35,21 @@ class Gps_agg_op_base_visitor :
public
Arr_construction_sl_visitor<
// TODO derive (helper) from topology traits class
typename boost::mpl::if_<
boost::is_same< typename Arr_are_all_sides_oblivious_tag<
typename Traits::Left_side_category,
typename Traits::Bottom_side_category,
typename Traits::Top_side_category,
typename Traits::Right_side_category
typename boost::mpl::if_<
boost::is_same< typename Arr_are_all_sides_oblivious_tag<
typename Traits::Left_side_category,
typename Traits::Bottom_side_category,
typename Traits::Top_side_category,
typename Traits::Right_side_category
>::result, Arr_all_sides_oblivious_tag >,
Arr_bounded_planar_construction_helper<Traits,
Arr_bounded_planar_construction_helper<Traits,
Arrangement_,
Event,
Subcurve>,
Arr_unb_planar_construction_helper<Traits,
Arrangement_,
Event,
Subcurve>
Subcurve>
>::type
>
{
@ -62,22 +57,22 @@ class Gps_agg_op_base_visitor :
typedef Arrangement_ Arrangement;
typedef typename boost::mpl::if_<
boost::is_same< typename Arr_are_all_sides_oblivious_tag<
typename Traits::Left_side_category,
typename Traits::Bottom_side_category,
typename Traits::Top_side_category,
typename Traits::Right_side_category
typedef typename boost::mpl::if_<
boost::is_same< typename Arr_are_all_sides_oblivious_tag<
typename Traits::Left_side_category,
typename Traits::Bottom_side_category,
typename Traits::Top_side_category,
typename Traits::Right_side_category
>::result, Arr_all_sides_oblivious_tag >,
Arr_bounded_planar_construction_helper<Traits,
Arr_bounded_planar_construction_helper<Traits,
Arrangement,
Event,
Subcurve>,
Arr_unb_planar_construction_helper<Traits,
Arrangement,
Event,
Subcurve>
Subcurve>
>::type Construction_helper;
typedef Arr_construction_sl_visitor<Construction_helper> Base;
@ -88,7 +83,7 @@ class Gps_agg_op_base_visitor :
typedef typename Base::Event_subcurve_reverse_iterator SubCurveRevIter;
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Traits::Point_2 Point_2;
typedef Unique_hash_map<Halfedge_handle, unsigned int> Edges_hash;
protected:
@ -109,7 +104,7 @@ public:
virtual Halfedge_handle insert_in_face_interior(const X_monotone_curve_2& cv,
Subcurve* sc)
{
Halfedge_handle he =
Halfedge_handle he =
Base::insert_in_face_interior(cv, sc);
insert_edge_to_hash(he, cv);
return (he);
@ -132,7 +127,7 @@ public:
Halfedge_handle he,
Subcurve* sc)
{
Halfedge_handle res_he =
Halfedge_handle res_he =
Base::insert_from_right_vertex(cv, he, sc);
insert_edge_to_hash(res_he, cv);
return (res_he);
@ -143,7 +138,7 @@ public:
Halfedge_handle he,
Subcurve* sc)
{
Halfedge_handle res_he =
Halfedge_handle res_he =
Base::insert_from_left_vertex(cv, he, sc);
insert_edge_to_hash(res_he, cv);
return (res_he);
@ -155,7 +150,7 @@ private:
void insert_edge_to_hash(Halfedge_handle he, const X_monotone_curve_2& cv)
{
const Comparison_result he_dir =
const Comparison_result he_dir =
((Arr_halfedge_direction)he->direction() == ARR_LEFT_TO_RIGHT) ? SMALLER : LARGER;
const Comparison_result cv_dir =
@ -173,7 +168,7 @@ private:
(*m_edges_hash)[he->twin()] = cv.data().bc();
}
}
};
@ -204,7 +199,7 @@ public:
};
template<class Traits, class Arrangement_, class Event, class Subcurve>
class Gps_agg_op_visitor :
class Gps_agg_op_visitor :
public Gps_agg_op_base_visitor<Traits, Arrangement_, Event, Subcurve>
{
protected:
@ -223,7 +218,7 @@ protected:
typedef typename Base::SubCurveRevIter SubCurveRevIter;
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Traits::Point_2 Point_2;
protected:
unsigned int m_event_count; // The number of events so far.
@ -248,7 +243,7 @@ public:
return;
}
virtual Halfedge_handle
virtual Halfedge_handle
insert_in_face_interior (const X_monotone_curve_2& cv,
Subcurve* sc)
{
@ -305,7 +300,7 @@ private:
Vertex_handle v)
{
const unsigned int index = event->index();
if (index >= m_vertices_vec->size())
m_vertices_vec->resize (2 * (index + 1));

View File

@ -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. */

View File

@ -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;

View File

@ -14,7 +14,7 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Sebastien Loriot, Sylvain Pion
@ -28,9 +28,9 @@
#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>
#include <CGAL/CGAL_Ipelet_base.h>
namespace CGAL_argt{
@ -43,7 +43,7 @@ typedef std::list<Curve_2> Curve_list;
typedef std::list<X_monotone_curve_2> X_monotone_list;
const std::string sublabel[] = {
"Segmentation","Help"
"Segmentation","Help"
};
const std::string helpmsg[] = {
@ -51,7 +51,7 @@ const std::string helpmsg[] = {
};
class ArrPolyIpelet
class ArrPolyIpelet
: public CGAL::Ipelet_base<Kernel,2>{
public:
ArrPolyIpelet()
@ -67,12 +67,12 @@ void ArrPolyIpelet::protected_run(int fn){
X_monotone_list output_curves;
Curve_list input_curves;
//Argt
//Argt
std::list<Segment_2> sg_list;
std::list<Circle_2> cir_list;
std::list<Polygon_2> pol_list;
std::list<Circular_arc_2> arc_list;
read_active_objects(
CGAL::dispatch_or_drop_output<Polygon_2,Circle_2,Segment_2,Circular_arc_2>(
std::back_inserter(pol_list),
@ -86,13 +86,13 @@ void ArrPolyIpelet::protected_run(int fn){
for (std::list<Polygon_2>::iterator it=pol_list.begin();it!=pol_list.end();++it)
for(Polygon_2::Edge_const_iterator edge_it=it->edges_begin();edge_it!=it->edges_end();++edge_it)
input_curves.push_back(Curve_2(edge_it->point(0),edge_it->point(1)));
for (std::list<Segment_2>::iterator it=sg_list.begin();it!=sg_list.end();++it)
input_curves.push_back(Curve_2(it->point(0),it->point(1)));
for (std::list<Circle_2>::iterator it=cir_list.begin();it!=cir_list.end();++it)
input_curves.push_back(Curve_2(it->center(),sqrt(CGAL::to_double(it->squared_radius()))));
for (std::list<Circular_arc_2>::iterator it=arc_list.begin();it!=arc_list.end();++it)
input_curves.push_back(
Curve_2( CGAL::cpp11::get<0>(*it).center(),
@ -105,10 +105,10 @@ void ArrPolyIpelet::protected_run(int fn){
Traits T;
CGAL::compute_subcurves(input_curves.begin(),input_curves.end(),std::back_inserter(output_curves),false,T);
for (X_monotone_list::iterator it=output_curves.begin();it!=output_curves.end();++it){
Point_2 S(CGAL::to_double(it->source().x()),CGAL::to_double(it->source().y()));
Point_2 T(CGAL::to_double(it->target().x()),CGAL::to_double(it->target().y()));

View File

@ -17,14 +17,14 @@ The package overview is build by having a special command that is
filtered by the python script pkglist_filter.py.
A command has to be of the form \package_listing{PKG_NAME}, where
PKG_NAME cannot contain a closing }.
PKG_NAME cannot contain a closing }.
The command is replaced by the text between the two delimiters
PkgDescBegin and PkgDescEnd in the file ../PKG_NAME/doc/PKG_NAME/PackageDescription.txt
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 ###
@ -65,7 +65,7 @@ All of it is in `header.html` and `hacks.js`.
# Things that would be nice to have #
## Search ##
The search function could be better:
The search function could be better:
- member functions could be removed
- global functions could be searchable
- package codenames could be supported
@ -83,4 +83,3 @@ try.
## Package Overview ##
Build the Package Overview with the help of the Build System.

View File

@ -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
@ -67,7 +67,7 @@ Three
Triangulation_3
Triangulation
Ridges_3
Point_set_3
Point_set_3
Point_set_processing_3
Point_set_shape_detection_3
Polyline_simplification_2
@ -97,6 +97,3 @@ Barycentric_coordinates_2
Surface_mesh
Surface_mesh_shortest_path
Polygon_mesh_processing

View File

@ -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}

View File

@ -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

View File

@ -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

View File

@ -5,5 +5,5 @@ Algebraic_foundations
Circulator
Stream_support
Arrangement_on_surface_2
Sweep_line_2
Surface_sweep_2
Spatial_searching

View File

@ -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>
@ -77,7 +74,7 @@ private:
typedef typename Traits::Segment_2 Segment_2;
typedef typename Traits::Point_2 Point_2;
typedef CGAL::Segment_data<Traits> Segment_data;
private:
// p is the center of the hot pixel
Point_2 p;
@ -155,7 +152,7 @@ private:
typedef std::list<Segment_data> Segment_data_list;
typedef CGAL::Hot_pixel_dir_cmp<Traits> Hot_pixel_dir_cmp;
typedef std::set<Hot_pixel *, Hot_pixel_dir_cmp> Hot_pixel_set;
public:
// friend class Segment_data<Traits>;
// friend class Hot_pixel<Traits>;
@ -174,7 +171,7 @@ public:
NT pixel_size, bool int_output, bool do_isr,
Segment_data_list & seg_list,
Multiple_kd_tree * mul_kd_tree);
private:
Traits m_gt;
@ -244,7 +241,7 @@ void Segment_data<Traits_>::determine_direction(SEG_Direction & seg_dir)
Compare_x_2 compare_x = m_gt.compare_x_2_object();
Compare_y_2 compare_y = m_gt.compare_y_2_object();
Comparison_result cx = compare_x(p, q);
Comparison_result cy = compare_y(p, q);
@ -331,7 +328,7 @@ bool Hot_pixel<Traits_>::intersect_left(const Segment_2 & seg,
{
typedef typename Traits_::Compare_y_2 Compare_y_2;
typedef typename Traits_::Construct_vertex_2 Construct_vertex_2;
Object result;
Point_2 p;
Segment_2 s;
@ -341,7 +338,7 @@ bool Hot_pixel<Traits_>::intersect_left(const Segment_2 & seg,
if (assign(p, result)) {
Compare_y_2 compare_y = m_gt.compare_y_2_object();
Construct_vertex_2 construct_vertex = m_gt.construct_vertex_2_object();
Comparison_result c_p = compare_y(p, p_up);
Comparison_result c_target = compare_y(construct_vertex(seg, 1), p_up);
Comparison_result c_source = compare_y(construct_vertex(seg, 0), p_up);
@ -363,17 +360,17 @@ bool Hot_pixel<Traits_>::intersect_right(const Segment_2 & seg,
typedef typename Traits_::Compare_x_2 Compare_x_2;
typedef typename Traits_::Construct_vertex_2 Construct_vertex_2;
Object result;
Object result;
Point_2 p;
Segment_2 s;
result = intersection(seg, *right_seg);
if (assign(p,result)) {
// bottom right point was checked in intersect_bot
Compare_y_2 compare_y = m_gt.compare_y_2_object();
Construct_vertex_2 construct_vertex = m_gt.construct_vertex_2_object();
Comparison_result c1 = compare_y(p, p_up);
Comparison_result c2 = compare_y(p, p_down);
@ -391,7 +388,7 @@ bool Hot_pixel<Traits_>::intersect_right(const Segment_2 & seg,
Compare_x_2 compare_x = m_gt.compare_x_2_object();
Comparison_result c_target = compare_x(p_right, trg);
Comparison_result c_source = compare_x(p_right, src);
return (((seg_dir == SEG_LEFT || seg_dir == SEG_DOWN_LEFT ||
seg_dir == SEG_UP_LEFT) && c_target != EQUAL) ||
((seg_dir == SEG_RIGHT || seg_dir == SEG_DOWN_RIGHT ||
@ -407,7 +404,7 @@ bool Hot_pixel<Traits_>::intersect_bot(const Segment_2 & seg,
{
typedef typename Traits_::Compare_x_2 Compare_x_2;
typedef typename Traits_::Construct_vertex_2 Construct_vertex_2;
Object result;
Point_2 p;
Segment_2 s;
@ -417,12 +414,12 @@ bool Hot_pixel<Traits_>::intersect_bot(const Segment_2 & seg,
if (assign(p,result)) {
Compare_x_2 compare_x = m_gt.compare_x_2_object();
Construct_vertex_2 construct_vertex = m_gt.construct_vertex_2_object();
Comparison_result c_p = compare_x(p, p_right);
Comparison_result c_target = compare_x(construct_vertex(seg, 1), p_right);
Comparison_result c_source = compare_x(construct_vertex(seg, 0), p_right);
return(c_p != EQUAL || (seg_dir == SEG_UP_LEFT && c_target != EQUAL) ||
return(c_p != EQUAL || (seg_dir == SEG_UP_LEFT && c_target != EQUAL) ||
(seg_dir == SEG_DOWN_RIGHT && c_source != EQUAL));
} else if (assign(s,result))
return(true);
@ -438,14 +435,14 @@ bool Hot_pixel<Traits_>::intersect_top(const Segment_2 & seg,
typedef typename Traits_::Compare_x_2 Compare_x_2;
typedef typename Traits_::Compare_y_2 Compare_y_2;
typedef typename Traits_::Construct_vertex_2 Construct_vertex_2;
Object result;
Point_2 p;
Segment_2 s;
result = intersection(seg, *top_seg);
if (assign(p,result))
if (assign(p,result))
{
Compare_x_2 compare_x = m_gt.compare_x_2_object();
Compare_y_2 compare_y = m_gt.compare_y_2_object();
@ -464,7 +461,7 @@ bool Hot_pixel<Traits_>::intersect_top(const Segment_2 & seg,
seg_dir == SEG_DOWN_RIGHT) && c3 != EQUAL) ||
((seg_dir == SEG_UP || seg_dir == SEG_UP_LEFT ||
seg_dir == SEG_UP_RIGHT) && c4 != EQUAL));
}
}
return(false);
}
@ -489,7 +486,7 @@ operator()(const Hot_pixel * h1, const Hot_pixel * h2) const
Compare_x_2 compare_x = m_gt.compare_x_2_object();
Compare_y_2 compare_y = m_gt.compare_y_2_object();
Comparison_result cx = compare_x(h1->get_center(), h2->get_center());
Comparison_result cy = compare_y(h1->get_center(), h2->get_center());
@ -500,30 +497,30 @@ operator()(const Hot_pixel * h1, const Hot_pixel * h2) const
// segment intersect
template<class Traits_>
bool Hot_pixel_dir_cmp<Traits_>::operator ()(const Hot_pixel * h1,
const Hot_pixel * h2)
const Hot_pixel * h2)
{
typedef typename Traits_::Compare_x_2 Compare_x_2;
typedef typename Traits_::Compare_y_2 Compare_y_2;
Compare_x_2 compare_x = m_gt.compare_x_2_object();
Compare_y_2 compare_y = m_gt.compare_y_2_object();
Comparison_result cx = compare_x(h1->get_center(), h2->get_center());
Comparison_result cy = compare_y(h1->get_center(), h2->get_center());
SEG_Direction seg_dir = h1->get_direction();
// Point segment intersects only one pixel, thus ignored
return((seg_dir == SEG_UP_RIGHT && (cx == SMALLER || (cx == EQUAL &&
cy == SMALLER))) ||
(seg_dir == SEG_UP_LEFT && (cx == LARGER || (cx == EQUAL &&
cy == SMALLER))) ||
(seg_dir == SEG_DOWN_RIGHT && (cx == SMALLER || (cx == EQUAL &&
cy == SMALLER))) ||
(seg_dir == SEG_UP_LEFT && (cx == LARGER || (cx == EQUAL &&
cy == SMALLER))) ||
(seg_dir == SEG_DOWN_RIGHT && (cx == SMALLER || (cx == EQUAL &&
cy == LARGER))) ||
(seg_dir == SEG_DOWN_LEFT && (cx == LARGER || (cx == EQUAL &&
cy == LARGER))) ||
cy == LARGER))) ||
(seg_dir == SEG_UP && cy == SMALLER) ||
(seg_dir == SEG_DOWN && cy == LARGER) ||
(seg_dir == SEG_LEFT && cx == LARGER) ||
(seg_dir == SEG_DOWN && cy == LARGER) ||
(seg_dir == SEG_LEFT && cx == LARGER) ||
(seg_dir == SEG_RIGHT && cx == SMALLER));
}
@ -539,7 +536,7 @@ find_hot_pixels_and_create_kd_trees(NT pixel_size,
typedef typename std::list<Segment_data>::iterator Segment_data_iter;
typedef std::list<Segment_2> Segment_list;
typedef typename std::list<Point_2>::const_iterator Point_const_iter;
typedef typename Traits::Construct_segment_2 Construct_segment_2;
Construct_segment_2 construct_seg = m_gt.construct_segment_2_object();
@ -576,7 +573,7 @@ find_hot_pixels_and_create_kd_trees(NT pixel_size,
++iter)
{
simple_seg_list.push_back(construct_seg(iter->source(), iter->target()));
}
}
*mul_kd_tree = new Multiple_kd_tree(hot_pixels_list, number_of_kd_trees,
simple_seg_list);
}
@ -592,7 +589,7 @@ find_intersected_hot_pixels(Segment_data & seg,
Multiple_kd_tree * mul_kd_tree)
{
typedef typename std::list<Hot_pixel *>::iterator Hot_pixel_iter;
Hot_pixel_iter iter;
SEG_Direction seg_dir;
@ -600,10 +597,10 @@ find_intersected_hot_pixels(Segment_data & seg,
seg.determine_direction(seg_dir);
number_of_intersections = 0;
std::list<Hot_pixel *> hot_pixels_list;
mul_kd_tree->get_intersecting_points(hot_pixels_list,
Segment_2(seg.segment()), pixel_size);
for (iter = hot_pixels_list.begin();iter != hot_pixels_list.end();++iter) {
if ((*iter)->intersect(seg,seg_dir)) {
(*iter)->set_direction(seg_dir);
@ -702,14 +699,14 @@ iterate(OutputContainer & output_container,
typedef typename std::set<Hot_pixel *, Hot_pixel_dir_cmp>::iterator
Hot_pixel_iter;
typedef typename std::list<Segment_data>::iterator Segment_data_iter;
Polyline_type seg_output;
Hot_pixel_set hot_pixels_intersected_set;
Hot_pixel_iter hot_pixel_iter;
int number_of_intersections;
Hot_pixel * hp;
SEG_Direction seg_dir;
for (Segment_data_iter iter = seg_list.begin(); iter != seg_list.end();
++iter)
{
@ -741,7 +738,7 @@ iterate(OutputContainer & output_container,
}
output_container.push_back(seg_output);
}
}
}
/*! */
@ -762,7 +759,7 @@ void snap_rounding_2(InputIterator begin,
typedef CGAL::Segment_data<Traits> Segment_data;
typedef CGAL::Multiple_kd_tree<Traits,Hot_pixel *> Multiple_kd_tree;
typedef std::list<Segment_data> Segment_data_list;
Segment_data_list seg_list;
Multiple_kd_tree * mul_kd_tree = NULL;

View File

@ -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 */

View File

@ -0,0 +1,3 @@
/*!
\example Surface_sweep_2/plane_sweep.cpp
*/

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -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)
@ -15,7 +15,7 @@ endif()
if ( COMMAND cmake_policy )
cmake_policy( SET CMP0003 NEW )
cmake_policy( SET CMP0003 NEW )
endif()
@ -25,7 +25,7 @@ find_package( CGAL QUIET COMPONENTS )
if ( NOT CGAL_FOUND )
message(STATUS "This project requires the CGAL library, and will not be compiled.")
return()
return()
endif()
@ -40,7 +40,7 @@ if ( NOT Boost_FOUND )
message(STATUS "This project requires the Boost library, and will not be compiled.")
return()
return()
endif()
@ -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" )

View File

@ -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()
{
@ -21,27 +19,27 @@ int main()
Segment_2 (Point_2 (1, 1), Point_2 (8, 8)),
Segment_2 (Point_2 (3, 1), Point_2 (3, 8)),
Segment_2 (Point_2 (8, 5), Point_2 (8, 8))};
// Compute all intersection points.
std::list<Point_2> pts;
CGAL::compute_intersection_points (segments, segments + 4,
std::back_inserter (pts));
// Compute all intersection points.
std::list<Point_2> pts;
CGAL::compute_intersection_points(segments, segments + 4,
std::back_inserter(pts));
// Print the result.
std::cout << "Found " << pts.size() << " intersection points: " << std::endl;
std::cout << "Found " << pts.size() << " intersection points: " << std::endl;
std::copy (pts.begin(), pts.end(),
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;
}

View File

@ -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

View File

@ -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

View File

@ -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>
/*!
@ -37,7 +33,7 @@ namespace CGAL {
* embedded on a surface, where these curves are interior-disjoint from all
* existing arrangement edges and vertices (so no intersections occur).
*/
template <typename Helper_>
template <typename Helper_>
class Arr_basic_insertion_sl_visitor : public Helper_::Parent_visitor {
public:
typedef Helper_ Helper;
@ -47,7 +43,7 @@ public:
typedef typename Helper::Parent_visitor Base;
typedef typename Helper::Event Event;
typedef typename Helper::Subcurve Subcurve;
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Traits_2::Point_2 Point_2;
@ -59,7 +55,7 @@ protected:
typedef typename Base::Event_subcurve_iterator Event_subcurve_iterator;
typedef typename Base::Event_subcurve_reverse_iterator
Event_subcurve_reverse_iterator;
public:
/*! Constructor. */
Arr_basic_insertion_sl_visitor(Arrangement_2* arr) : Base(arr) {}
@ -178,7 +174,7 @@ public:
virtual Halfedge_handle split_edge(Halfedge_handle /*he*/,
Subcurve* /*sc*/,
const Point_2& /*pt*/)
{ return Halfedge_handle(); }
{ return Halfedge_handle(); }
//@}
protected:
@ -218,7 +214,7 @@ protected:
//-----------------------------------------------------------------------------
// A notification issued before the sweep process starts.
// Notifies the helper that the sweep process now starts.
template <typename Hlpr>
template <typename Hlpr>
void Arr_basic_insertion_sl_visitor<Hlpr>::before_sweep()
{ this->m_helper.before_sweep(); }
@ -226,7 +222,7 @@ void Arr_basic_insertion_sl_visitor<Hlpr>::before_sweep()
// A notification invoked before the sweep-line starts handling the given
// event.
//
template <typename Hlpr>
template <typename Hlpr>
void Arr_basic_insertion_sl_visitor<Hlpr>::before_handle_event(Event* event)
{
// First we notify the helper class on the event.
@ -248,7 +244,7 @@ void Arr_basic_insertion_sl_visitor<Hlpr>::before_handle_event(Event* event)
}
}
}
if (! event->has_left_curves()) {
// Indicates if there's halfedge to the right of the event.
Event_subcurve_reverse_iterator right_it;
@ -271,7 +267,7 @@ void Arr_basic_insertion_sl_visitor<Hlpr>::before_handle_event(Event* event)
// The event has left and right curves.
Event_subcurve_reverse_iterator iter;
Halfedge_handle he;
bool exist_right_halfedge = false;
bool exist_right_halfedge = false;
int i = 0;
for (iter = event->right_curves_rbegin();
iter != event->right_curves_rend(); ++iter, ++i)
@ -281,29 +277,29 @@ void Arr_basic_insertion_sl_visitor<Hlpr>::before_handle_event(Event* event)
exist_right_halfedge = true;
event->set_subcurve_in_arrangement(i, true);
if (!is_split_event(*iter, event)) {
// halfedge will not be split.
// halfedge will not be split.
event->set_halfedge_handle(he);
}
else {
he = split_edge((*iter)->last_curve().halfedge_handle(), (*iter),
event->point());
// 'he' has the same source as the split halfedge.
event->set_halfedge_handle(he);
X_monotone_curve_2& last_curve =
const_cast<X_monotone_curve_2&>((*iter)->last_curve());
last_curve.set_halfedge_handle(he);
//there cannot be another existing halfedge that need to be split
// because they are disjoint
return;
}
}
}
if (exist_right_halfedge) return;
// if we have reached here, there are no halfedges to the right of
// if we have reached here, there are no halfedges to the right of
// the event, but still can be on the left of the event
for (iter = event->left_curves_rbegin();
iter != event->left_curves_rend(); ++iter)
@ -319,7 +315,7 @@ void Arr_basic_insertion_sl_visitor<Hlpr>::before_handle_event(Event* event)
//-----------------------------------------------------------------------------
// A notification invoked when a new subcurve is created.
//
template <typename Hlpr>
template <typename Hlpr>
void Arr_basic_insertion_sl_visitor<Hlpr>::
add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc)
{
@ -336,7 +332,7 @@ add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc)
(this->current_event()->halfedge_handle()->next()->twin(), cv.base());
}
Halfedge_handle next_ccw_he =
Halfedge_handle next_ccw_he =
this->current_event()->halfedge_handle()->next()->twin();
this->current_event()->set_halfedge_handle(next_ccw_he);
}
@ -420,7 +416,7 @@ insert_isolated_vertex(const Point_2& pt, Status_line_iterator iter)
{
// If the isolated vertex is already at the arrangement, return:
if (pt.vertex_handle() != Vertex_handle()) return Vertex_handle();
// Look up and insert the isolated vertex in the incident face of the
// halfedge we see.
Face_handle f = _ray_shoot_up(iter);
@ -608,7 +604,7 @@ _insert_at_vertices(const X_monotone_curve_2& cv,
// existing face (pointed by the twin halfedge) and move the relevant
// holes and isolated vertices into the new face.
if (new_face_created) this->m_arr_access.relocate_in_new_face(new_he);
// Return a handle to the new halfedge directed from prev1's target to
// prev2's target. Note that this may be the twin halfedge of the one
// returned by _insert_at_vertices();

View File

@ -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>
/*!
@ -39,13 +35,13 @@
namespace CGAL {
/*!
/*!
* A basic meta-traits class that stores a halfedge handle with every
* x-monotone curve, and a vertex handle with each point. This information is
* x-monotone curve, and a vertex handle with each point. This information is
* used to speed up the aggregated insertion process.
*/
template <typename Traits_, typename Arrangement_>
class Arr_basic_insertion_traits_2
class Arr_basic_insertion_traits_2
{
public:
@ -70,7 +66,7 @@ public:
typedef typename Traits_2::Has_do_intersect_category
Has_do_intersect_category;
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
@ -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;
@ -97,10 +93,10 @@ public:
m_base_traits (&tr)
{}
/*!
/*!
* Nested extension of the x-monotone curve type.
*/
class Ex_x_monotone_curve_2
class Ex_x_monotone_curve_2
{
public:
@ -191,11 +187,11 @@ public:
os << xcv.base();
return (os);
}
/*!
/*!
* Nested extension of the point type.
*/
class Ex_point_2
class Ex_point_2
{
public:
@ -228,7 +224,7 @@ public:
{
return (m_base_pt);
}
operator const Base& () const
{
return (m_base_pt);
@ -276,9 +272,9 @@ public:
//! Allow its functor obtaining function calling the private constructor.
friend class Arr_basic_insertion_traits_2<Traits_, Arrangement_>;
public:
Point_2 operator() (const X_monotone_curve_2 & xcv)
Point_2 operator() (const X_monotone_curve_2 & xcv)
{
// If there is not halfedge associated with the curve, just return
// a point with invalid halfedge handle.
@ -338,7 +334,7 @@ public:
friend class Arr_basic_insertion_traits_2<Traits_, Arrangement_>;
public:
Point_2 operator() (const X_monotone_curve_2 & xcv)
Point_2 operator() (const X_monotone_curve_2 & xcv)
{
// If there is not halfedge associated with the curve, just return
// a point with invalid halfedge handle.
@ -608,7 +604,7 @@ public:
{
return m_base->parameter_space_in_x_2_object() (xcv.base());
}
};
/*! Obtain a Parameter_space_in_x_2 function object */
@ -616,7 +612,7 @@ public:
{
return Parameter_space_in_x_2 (m_base_traits);
}
/*! A function object that determines whether an x-monotone curve or a
* point coincide with the vertical identification curve.
*/
@ -647,7 +643,7 @@ public:
{
return m_base->is_on_x_identification_2_object() (xcv.base());
}
};
/*! Obtain a Is_on_x_identification_2 function object */
@ -659,12 +655,12 @@ public:
/*! A functor that compares the y-coordinates of two points on vertical
* boundaries.
*/
class Compare_y_on_boundary_2
class Compare_y_on_boundary_2
{
protected:
//! The base traits.
const Traits_2 * m_base;
/*! Constructor.
* \param base The base traits class. It must be passed, to handle non
* stateless traits objects, (which stores data).
@ -690,7 +686,7 @@ public:
};
/*! Obtain a Compare_y_on_boundary_2 object
*/
*/
Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const
{
return Compare_y_on_boundary_2(m_base_traits);
@ -721,7 +717,7 @@ public:
* is not defined
*/
Comparison_result operator() (const X_monotone_curve_2 & xcv1,
const X_monotone_curve_2 & xcv2,
const X_monotone_curve_2 & xcv2,
Arr_curve_end ce) const
{
return m_base->compare_y_near_boundary_2_object() (xcv1.base(),
@ -731,13 +727,13 @@ public:
};
/*! Obtain a Compare_y_near_boundary_2 object
*/
*/
Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const
{
return Compare_y_near_boundary_2 (m_base_traits);
}
// bottom-top
@ -816,7 +812,7 @@ public:
{
return m_base->is_on_y_identification_2_object() (xcv.base());
}
};
/*! Obtain a Is_on_y_identification_2 function object */
@ -871,9 +867,9 @@ public:
}
};
/*! Obtain a Compare_x_at_limit_2 object
*/
*/
Compare_x_at_limit_2 compare_x_at_limit_2_object() const
{
return Compare_x_at_limit_2(m_base_traits);
@ -914,9 +910,9 @@ public:
}
};
/*! Obtain a Compare_x_near_limit_2 object
*/
*/
Compare_x_near_limit_2 compare_x_near_limit_2_object() const
{
return Compare_x_near_limit_2(m_base_traits);
@ -925,12 +921,12 @@ public:
/*! A functor that compares the x-coordinates of two points on vertical
* boundaries.
*/
class Compare_x_on_boundary_2
class Compare_x_on_boundary_2
{
protected:
//! The base traits.
const Traits_2 * m_base;
/*! Constructor.
* \param base The base traits class. It must be passed, to handle non
* stateless traits objects, (which stores data).
@ -974,7 +970,7 @@ public:
};
/*! Obtain a Compare_x_on_boundary_2 object
*/
*/
Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const
{
return Compare_x_on_boundary_2(m_base_traits);
@ -1014,9 +1010,9 @@ public:
}
};
/*! Obtain a Compare_x_near_boundary_2 object
*/
*/
Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const
{
return Compare_x_near_boundary_2(m_base_traits);

View File

@ -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;
@ -59,21 +54,20 @@ public:
protected:
typedef typename Helper::Base_visitor Base;
typedef typename Base::Status_line_iterator Status_line_iterator;
typedef Arr_point_location_result<Arrangement_2> Pl_result;
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.
*/
@ -81,15 +75,14 @@ public:
m_helper(arr),
m_out(oi)
{}
/* 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;
}

View File

@ -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

View File

@ -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

View File

@ -12,49 +12,45 @@
// 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 {
/*! \class Arr_construction_subcurve
*
* a class that holds information about a curve that is added to
/*! \class Arr_construction_subcurve
*
* 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,
* when an arrangement is constructed, a pointer to the last handled event
* 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;
@ -136,4 +132,4 @@ public:
} //namespace CGAL
#endif
#endif

View File

@ -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 {
@ -50,7 +45,7 @@ public:
typedef typename ArrangementB::Vertex_const_handle Vertex_handle_B;
typedef typename ArrangementB::Halfedge_const_handle Halfedge_handle_B;
typedef typename ArrangementB::Face_const_handle Face_handle_B;
typedef typename ArrangementR::Vertex_handle Vertex_handle_R;
typedef typename ArrangementR::Halfedge_handle Halfedge_handle_R;
typedef typename ArrangementR::Face_handle Face_handle_R;
@ -58,7 +53,7 @@ public:
/*! Destructor. */
virtual ~_Arr_default_overlay_traits_base ()
{}
/*!
* Create a vertex v that corresponds to the coinciding vertices v1 and v2.
*/

View File

@ -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 {
@ -37,20 +34,20 @@ namespace CGAL {
* A sweep-line visitor for inserting new curves into an existing arrangement
* embedded on a surface.
*/
template <typename Helper_>
class Arr_insertion_sl_visitor :
template <typename Helper_>
class Arr_insertion_sl_visitor :
public Arr_basic_insertion_sl_visitor<Helper_>
{
public:
typedef Helper_ Helper;
typedef Arr_basic_insertion_sl_visitor<Helper> Base;
typedef typename Base::Traits_2 Traits_2;
typedef typename Base::Arrangement_2 Arrangement_2;
typedef typename Base::Event Event;
typedef typename Base::Subcurve Subcurve;
typedef typename Base::Halfedge_handle Halfedge_handle;
typedef typename Base::X_monotone_curve_2 X_monotone_curve_2;
typedef typename Base::Point_2 Point_2;
@ -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).
//@{
@ -83,7 +80,7 @@ public:
*/
virtual Halfedge_handle split_edge(Halfedge_handle he, Subcurve* sc,
const Point_2& pt);
//@}
//@}
};
//-----------------------------------------------------------------------------
@ -94,19 +91,19 @@ public:
// Check if the halfedge associated with the given subcurve will be split
// at the given event.
//
template <typename Hlpr>
template <typename Hlpr>
bool Arr_insertion_sl_visitor<Hlpr>::is_split_event(Subcurve* sc, Event* event)
{
if (sc->last_curve().halfedge_handle() == Halfedge_handle(NULL))
return false;
if (! sc->originating_subcurve1()) {
return (reinterpret_cast<Event*>(sc->left_event()) !=
return (reinterpret_cast<Event*>(sc->left_event()) !=
this->current_event());
}
return
(this->is_split_event
(reinterpret_cast<Subcurve*>(sc->originating_subcurve1()), event) ||
(reinterpret_cast<Subcurve*>(sc->originating_subcurve1()), event) ||
this->is_split_event
(reinterpret_cast<Subcurve*>(sc->originating_subcurve2()), event));
}
@ -120,12 +117,12 @@ Arr_insertion_sl_visitor<Hlpr>::split_edge(Halfedge_handle he, Subcurve* sc,
const Point_2& pt)
{
// Make sure that the halfedge associated with sc is the directed from
// right to left, since we always "look" above , and the incident face
// right to left, since we always "look" above , and the incident face
// is on the left of the halfedge
CGAL_assertion (he->direction() == ARR_RIGHT_TO_LEFT);
this->traits()->split_2_object()(he->curve(), pt, sub_cv2, sub_cv1);
Halfedge_handle new_he =
Halfedge_handle new_he =
this->m_arr_access.split_edge_ex(he, pt.base(),
sub_cv1.base(), sub_cv2.base());
Event* last_event_on_sc = reinterpret_cast<Event*>(sc->last_event());

View File

@ -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 {
@ -39,11 +35,10 @@ namespace CGAL {
* speed up the aggregated insertion process.
*/
template <typename Traits_, typename Arrangement_>
class Arr_insertion_traits_2 :
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;
@ -70,7 +65,7 @@ public:
* Merge_2 are not needed either.
*/
typedef Tag_false Has_merge_category;
public:
/*! Constructor with a traits class. */
@ -92,62 +87,57 @@ 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()
{}
//! Allow its functor obtaining function calling the private constructor.
friend class Arr_insertion_traits_2<Traits_2, Arrangement_>;
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)
{
// 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) {
// 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
{
intersect_p =
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 {
@ -177,10 +165,10 @@ public:
//! Allow its functor obtaining function calling the private constructor.
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

View File

@ -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 {

View File

@ -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:
@ -77,7 +73,7 @@ protected:
} m_top_face; // If m_above is NULL, points the top face in
// the arrangement of the opposite color that
// contains the subcurve.
public:
/*! Constructor. */
Arr_overlay_subcurve() :
@ -134,13 +130,13 @@ public:
void set_top_face(const Self* sc)
{
CGAL_precondition(sc->m_above == NULL);
// Mark there is no curve above and copy the face pointer.
m_above = NULL;
m_top_face.red = sc->m_top_face.red;
}
};
} //namespace CGAL
#endif

View File

@ -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>
/*!
@ -52,24 +48,24 @@ public:
typedef ArrangementRed_ Arrangement_red_2;
typedef ArrangementBlue_ Arrangement_blue_2;
typedef typename Arrangement_red_2::Face_const_handle
typedef typename Arrangement_red_2::Face_const_handle
Face_handle_red;
typedef typename Arrangement_blue_2::Face_const_handle
Face_handle_blue;
typedef typename Arrangement_red_2::Halfedge_const_handle
typedef typename Arrangement_red_2::Halfedge_const_handle
Halfedge_handle_red;
typedef typename Arrangement_blue_2::Halfedge_const_handle
Halfedge_handle_blue;
typedef typename Arrangement_red_2::Vertex_const_handle
typedef typename Arrangement_red_2::Vertex_const_handle
Vertex_handle_red;
typedef typename Arrangement_blue_2::Vertex_const_handle
Vertex_handle_blue;
typedef typename Traits_2::X_monotone_curve_2 Base_x_monotone_curve_2;
typedef typename Traits_2::Point_2 Base_point_2;
typedef typename Traits_2::Multiplicity Multiplicity;
typedef typename Traits_2::Multiplicity Multiplicity;
typedef typename Traits_2::Compare_x_2 Base_compare_x_2;
typedef typename Traits_2::Compare_xy_2 Base_compare_xy_2;
@ -100,7 +96,7 @@ public:
*/
typedef Tag_false Has_left_category;
typedef Tag_false Has_merge_category;
// The color of a feature.
enum Color {
RED, // From the "red" arrangement.
@ -115,7 +111,7 @@ public:
typedef boost::variant<Halfedge_handle_blue, Vertex_handle_blue,
Face_handle_blue> Cell_handle_blue;
typedef boost::optional<Cell_handle_blue> Optional_cell_blue;
template <typename Handle_red>
Optional_cell_red make_optional_cell_red(Handle_red handle_red)
{ return boost::make_optional(Cell_handle_red(handle_red)); }
@ -123,7 +119,7 @@ public:
template <typename Handle_blue>
Optional_cell_red make_optional_cell_blue(Handle_blue handle_blue)
{ return boost::make_optional(Cell_handle_blue(handle_blue)); }
private:
const Traits_2* m_base_traits; // The base traits object.
@ -150,7 +146,7 @@ public:
public:
/*! Default constructor. */
Ex_x_monotone_curve_2() :
Ex_x_monotone_curve_2() :
m_base_xcv(),
m_red_halfedge_handle(),
m_blue_halfedge_handle()
@ -192,7 +188,7 @@ public:
/*! Get the red halfedge handle. */
Halfedge_handle_red red_halfedge_handle() const
{ return m_red_halfedge_handle; }
/*! Get the blue halfedge handle. */
Halfedge_handle_blue blue_halfedge_handle() const
{ return m_blue_halfedge_handle; }
@ -228,14 +224,14 @@ public:
if ((m_blue_halfedge_handle != null_blue_he) &&
(m_red_halfedge_handle == null_red_he))
return BLUE;
// Overlap, return the RB_OVERLAP color:
CGAL_assertion((m_red_halfedge_handle != null_red_he) &&
CGAL_assertion((m_red_halfedge_handle != null_red_he) &&
(m_blue_halfedge_handle != null_blue_he));
return RB_OVERLAP;
}
}; // nested class Ex_x_monotone_curve_2 - END
typedef Ex_x_monotone_curve_2 X_monotone_curve_2;
// For debugging purposes:
@ -245,7 +241,7 @@ public:
os << xcv.base();
return os;
}
/*! \class
* Nested extension of the point type.
*/
@ -320,7 +316,7 @@ public:
/*! Obtain the blue cell handle or NULL if it doesn't exist. */
const Cell_handle_blue* blue_cell_handle() const
{ return m_blue_cell ? &(*m_blue_cell) : NULL; }
/*! Obtain the red vertex handle or NULL if it doesn't exist. */
const Vertex_handle_red* red_vertex_handle() const
{
@ -362,7 +358,7 @@ public:
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
template<class OutputIterator>
OutputIterator operator()(const X_monotone_curve_2& xcv1,
@ -372,7 +368,7 @@ public:
// In case the curves originate from the same arrangement, they are
// obviously interior-disjoint.
if (xcv1.color() == xcv2.color()) return oi;
if ((xcv1.color() == RB_OVERLAP) || (xcv2.color() == RB_OVERLAP))
return oi;
@ -430,7 +426,7 @@ public:
m_base_tr->intersect_2_object()(xcv2.base(), xcv1.base(), oi);
// Convert objects that are associated with Base_x_monotone_curve_2 to
// the exteneded X_monotone_curve_2.
// the exteneded X_monotone_curve_2.
while (oi != oi_end) {
base_ipt = object_cast<std::pair<Base_point_2, unsigned int> >(&(*oi));
@ -466,10 +462,10 @@ public:
// We have a red-blue overlap, so we mark the curve accordingly.
Halfedge_handle_red red_he;
Halfedge_handle_blue blue_he;
if (xcv1.color() == RED) {
red_he = xcv1.red_halfedge_handle();
// Overlap can occur only between curves from a different color.
CGAL_assertion(xcv2.color() == BLUE);
blue_he = xcv2.blue_halfedge_handle();
@ -480,7 +476,7 @@ public:
red_he = xcv2.red_halfedge_handle();
blue_he = xcv1.blue_halfedge_handle();
}
*oi++ = CGAL::make_object(X_monotone_curve_2(*overlap_xcv,
red_he, blue_he));
}
@ -510,7 +506,7 @@ public:
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
void operator()(const X_monotone_curve_2& xcv, const Point_2& p,
X_monotone_curve_2& c1, X_monotone_curve_2& c2)
@ -552,9 +548,9 @@ public:
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
Point_2 operator()(const X_monotone_curve_2& xcv)
Point_2 operator()(const X_monotone_curve_2& xcv)
{
// Create the objects that wrap the arrangement vertex.
// Note that the halfedges associated with the curves are always
@ -584,11 +580,11 @@ public:
/*! Obtain a Construct_min_vertex_2 functor object. */
Construct_min_vertex_2 construct_min_vertex_2_object() const
{
return
return
Construct_min_vertex_2(m_base_traits->construct_min_vertex_2_object(),
m_base_traits->equal_2_object());
}
/*! A functor that obtains the right endpoint of an x-monotone curve. */
class Construct_max_vertex_2 {
protected:
@ -610,7 +606,7 @@ public:
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
Point_2 operator()(const X_monotone_curve_2& xcv) const
{
@ -622,14 +618,14 @@ public:
Optional_cell_blue blue_cell;
if ((xcv.color() == RED) || (xcv.color() == RB_OVERLAP))
red_cell =
red_cell =
(! xcv.red_halfedge_handle()->source()->is_at_open_boundary() &&
m_base_equal(base_p, xcv.red_halfedge_handle()->source()->point())) ?
boost::make_optional(Cell_handle_red(xcv.red_halfedge_handle()->source())) :
boost::make_optional(Cell_handle_red(xcv.red_halfedge_handle()));
if ((xcv.color() == BLUE) || (xcv.color() == RB_OVERLAP))
blue_cell =
blue_cell =
(! xcv.blue_halfedge_handle()->source()->is_at_open_boundary() &&
m_base_equal(base_p, xcv.blue_halfedge_handle()->source()->point())) ?
boost::make_optional(Cell_handle_blue(xcv.blue_halfedge_handle()->source())) :
@ -663,7 +659,7 @@ public:
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
bool operator()(const X_monotone_curve_2& xcv) const
{ return m_base_is_vert(xcv.base()); }
@ -691,7 +687,7 @@ public:
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
bool operator()(const Point_2& p1, const Point_2& p2) const
{ return m_base_equal(p1.base(), p2.base()); }
@ -704,7 +700,7 @@ public:
/*! Obtain a Equal_2 functor object. */
Equal_2 equal_2_object() const
{ return Equal_2(m_base_traits->equal_2_object()); }
/*! A functor that compares the x-coordinates of two points */
class Compare_x_2 {
protected:
@ -721,7 +717,7 @@ public:
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
Comparison_result operator()(const Point_2& p1, const Point_2& p2) const
{ return m_base_cmp_x(p1.base(), p2.base()); }
@ -747,7 +743,7 @@ public:
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
Comparison_result operator()(const Point_2& p1, const Point_2& p2) const
{
@ -765,7 +761,7 @@ public:
// - the points are not equal if the corresponding handles are not equal.
// - if the corresponding handles are equal, the points must be equal
// but this holds for any two points.
if ((vr1 && vb1) || (vr2 && vb2))
// In case of an overlapping vertex, just perform the comparison.
return (m_base_cmp_xy(p1.base(), p2.base()));
@ -803,7 +799,7 @@ public:
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
Comparison_result operator()(const Point_2& p,
const X_monotone_curve_2& xcv) const
@ -834,7 +830,7 @@ public:
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
Comparison_result operator()(const X_monotone_curve_2& xcv1,
const X_monotone_curve_2& xcv2,
@ -845,7 +841,7 @@ public:
/*! Obtain a Construct_min_vertex_2 functor object. */
Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const
{
return
return
Compare_y_at_x_right_2(m_base_traits->compare_y_at_x_right_2_object());
}
@ -865,11 +861,11 @@ public:
* constructing it.
*/
Parameter_space_in_x_2(const Traits_2* tr) : m_base(tr) {}
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
Arr_parameter_space operator()(const X_monotone_curve_2& xcv,
Arr_curve_end ce) const
@ -884,8 +880,8 @@ public:
/*! Obtain an Parameter_space_in_x_2 functor object. */
Parameter_space_in_x_2 parameter_space_in_x_2_object() const
{ return Parameter_space_in_x_2(m_base_traits); }
{ return Parameter_space_in_x_2(m_base_traits); }
/*! A function object that determines whether an x-monotone curve or a
* point coincide with the vertical identification curve.
*/
@ -900,11 +896,11 @@ public:
* constructing it.
*/
Is_on_x_identification_2(const Traits_2* tr) : m_base(tr) {}
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
Arr_parameter_space operator()(const Point_2& p) const
{ return m_base->is_on_x_identification_2_object()(p.base()); }
@ -915,7 +911,7 @@ public:
/*! Obtain an Is_on_x_identification_2 functor object. */
Is_on_x_identification_2 is_on_x_identification_2_object() const
{ return Is_on_x_identification_2(m_base_traits); }
{ return Is_on_x_identification_2(m_base_traits); }
/*! A functor that compares the y-values of pointss on the
* boundary of the parameter space.
@ -937,12 +933,12 @@ public:
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
Comparison_result operator()(const Point_2& pt1, const Point_2& pt2) const
{ return m_base->compare_y_on_boundary_2_object()(pt1.base(), pt2.base()); }
};
/*! Obtain a Compare_y_on_boundary_2 functor. */
Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const
{ return Compare_y_on_boundary_2(m_base_traits); }
@ -967,10 +963,10 @@ public:
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
Comparison_result operator()(const X_monotone_curve_2& xcv1,
const X_monotone_curve_2& xcv2,
const X_monotone_curve_2& xcv2,
Arr_curve_end ce) const
{
// If the traits class does not support open curves, we just
@ -979,14 +975,14 @@ public:
xcv2.base(), ce);
}
};
/*! Obtain a Compare_y_near_boundary_2 functor. */
Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const
{ return Compare_y_near_boundary_2(m_base_traits); }
// bottom-top
/*! A functor that determines whether an endpoint of an x-monotone arc lies
* on a boundary of the parameter space along the y axis.
*/
@ -1001,11 +997,11 @@ public:
* constructing it.
*/
Parameter_space_in_y_2(const Traits_2* tr) : m_base(tr) {}
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
Arr_parameter_space operator()(const X_monotone_curve_2& xcv,
Arr_curve_end ce) const
@ -1020,7 +1016,7 @@ public:
/*! Obtain an Parameter_space_in_y_2 functor object. */
Parameter_space_in_y_2 parameter_space_in_y_2_object() const
{ return Parameter_space_in_y_2(m_base_traits); }
{ return Parameter_space_in_y_2(m_base_traits); }
/*! A function object that determines whether an x-monotone curve or a
* point coincide with the vertical identification curve.
@ -1036,11 +1032,11 @@ public:
* constructing it.
*/
Is_on_y_identification_2(const Traits_2* tr) : m_base(tr) {}
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
Arr_parameter_space operator()(const Point_2& p) const
{ return m_base->is_on_y_identification_2_object()(p.base()); }
@ -1051,7 +1047,7 @@ public:
/*! Obtain an Is_on_y_identification_2 functor object. */
Is_on_y_identification_2 is_on_y_identification_2_object() const
{ return Is_on_y_identification_2(m_base_traits); }
{ return Is_on_y_identification_2(m_base_traits); }
/*! A functor that compares the x-limits of curve ends on the
* boundary of the parameter space.
@ -1073,7 +1069,7 @@ public:
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
Comparison_result operator()(const Point_2& p,
const X_monotone_curve_2& xcv,
@ -1114,7 +1110,7 @@ public:
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
Comparison_result operator()(const X_monotone_curve_2& xcv1,
const X_monotone_curve_2& xcv2,
@ -1149,7 +1145,7 @@ public:
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
Comparison_result operator()(const Point_2& pt1, const Point_2& pt2) const
{ return m_base->compare_x_on_boundary_2_object()(pt1.base(), pt2.base()); }
@ -1171,7 +1167,7 @@ public:
xcv2.base(), ce2);
}
};
/*! Obtain a Compare_x_on_boundary_2 functor. */
Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const
{ return Compare_x_on_boundary_2(m_base_traits); }
@ -1196,7 +1192,7 @@ public:
//! Allow its functor obtaining function calling the protected constructor.
friend class Arr_overlay_traits_2<Traits_2,
Arrangement_red_2, Arrangement_blue_2>;
public:
Comparison_result operator()(const X_monotone_curve_2& xcv1,
const X_monotone_curve_2& xcv2,

View File

@ -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

View File

@ -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)
{

View File

@ -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: ");

View File

@ -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 ");

View File

@ -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,
@ -93,7 +89,7 @@ void make_x_monotone (CurveInputIter begin, CurveInputIter end,
// The object is an isolated point.
pt = object_cast<Point_2> (&(object_vec[i]));
CGAL_assertion (pt != NULL);
*iso_points = *pt;
++iso_points;
}
@ -116,18 +112,18 @@ void make_x_monotone (CurveInputIter begin, CurveInputIter end,
* \param pts_end A past-the-end iterator for the isolated input points.
* \param x_curves Output: The extended x-monotone subcurves
* (of type ExTraits::X_monotone_curve_2).
* \param iso_points Output: The extended isolated points
* \param iso_points Output: The extended isolated points
* (of type ExTraits::Point_2).
* \param ex_tr An extended geometry-traits class.
* 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,
@ -142,7 +138,7 @@ void prepare_for_sweep (Arrangement& arr,
typedef typename ExTraits::X_monotone_curve_2 Ex_x_monotone_curve_2;
typedef typename ExTraits::Point_2 Ex_point_2;
// Go over the input objects and copy them to the output iterators.
XCurveInputIter xcv_it;
PointInputIter pt_it;
@ -158,14 +154,14 @@ void prepare_for_sweep (Arrangement& arr,
*iso_points = Ex_point_2 (*pt_it);
++iso_points;
}
// Go over the arrangement edges and insert their associated x-monotone
// curves into the output iterator. To each curve we attach a handle to the
// halfedge that goes from right to left.
Edge_iterator eit;
Halfedge_handle he;
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit)
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit)
{
if (eit->direction() == ARR_LEFT_TO_RIGHT)
he = eit->twin();

View File

@ -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,49 +40,50 @@ 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;
typedef typename Base::Status_line_iterator Status_line_iterator;
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,
std::back_inserter(curves_vec),
std::back_inserter(points_vec),
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,54 +110,55 @@ 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,
std::back_inserter(curves_vec),
std::back_inserter(points_vec),
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());
}
void add_subcurve(const X_monotone_curve_2& cv, Subcurve *sc)
{
if (!m_overlapping) {
@ -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;
@ -221,9 +217,10 @@ public:
std::back_inserter(curves_vec),
std::back_inserter(points_vec),
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;

View File

@ -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);
// 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);
}
/*! 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,42 +110,36 @@ 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;
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);

View File

@ -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())

View File

@ -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.
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.
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.
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,14 +101,13 @@ 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
{
const bool on_boundary2 = e2->is_on_boundary();
if (! on_boundary2)
{
// If e2 is a normal event, just compare pt and the event point.
@ -135,7 +123,7 @@ public:
return (LARGER);
else if (ps_x2 == ARR_RIGHT_BOUNDARY)
return (SMALLER);
// Get the curve end that e2 represents, and compare the x-position of the
// given point and this curve end.
Arr_curve_end ind = _curve_end(e2);
@ -159,36 +147,25 @@ public:
* Compare a curve end, which should be inserted into the event queue,
* with an existing event point.
* 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().
* 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.
@ -196,22 +173,20 @@ private:
* \param e2 The event, which may have boundary conditions.
* \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
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
{
// 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);
return
return
m_traits->compare_y_curve_ends_2_object() (cv, e2->curve(), ind);
}
@ -219,67 +194,56 @@ 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.
return (LARGER);
}
// 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;
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,14 +304,14 @@ 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.
if (std::find((*m_curr_event)->right_curves_begin(),
if (std::find((*m_curr_event)->right_curves_begin(),
(*m_curr_event)->right_curves_end(),
c1) != (*m_curr_event)->right_curves_end() &&
std::find((*m_curr_event)->right_curves_begin(),
std::find((*m_curr_event)->right_curves_begin(),
(*m_curr_event)->right_curves_end(),
c2) != (*m_curr_event)->right_curves_end())
{
@ -362,15 +319,15 @@ public:
(c1->last_curve(), c2->last_curve(), (*m_curr_event)->point()));
}
Arr_parameter_space ps_x1 =
Arr_parameter_space ps_x1 =
m_traits->parameter_space_in_x_2_object()(c1->last_curve(), ARR_MIN_END);
Arr_parameter_space ps_y1 =
Arr_parameter_space ps_y1 =
m_traits->parameter_space_in_y_2_object()(c1->last_curve(), ARR_MIN_END);
if ((ps_x1 == ARR_INTERIOR) && (ps_y1 == ARR_INTERIOR))
{
// The first curve has a valid left endpoint. Compare the y-position
// of this endpoint to the second subcurve.
// of this endpoint to the second subcurve.
return m_traits->compare_y_at_x_2_object()
(m_traits->construct_min_vertex_2_object()(c1->last_curve()),
c2->last_curve());
@ -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())); }
};

View File

@ -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 << ") "

View File

@ -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)
{

View File

@ -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

View File

@ -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.

View File

@ -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)
@ -23,8 +23,7 @@ if ( CGAL_FOUND )
endforeach()
else()
message(STATUS "This program requires the CGAL library, and will not be compiled.")
endif()
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