diff --git a/.travis.yml b/.travis.yml index 7f319eec64b..f994f2fbcd2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/.travis/packages.txt b/.travis/packages.txt index 7998c048b3b..b89307a1919 100644 --- a/.travis/packages.txt +++ b/.travis/packages.txt @@ -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 diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/batched_point_location.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/batched_point_location.cpp index 0da49fe117b..09905656857 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/batched_point_location.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/batched_point_location.cpp @@ -1,8 +1,7 @@ //! \file examples/Arrangement_on_surface_2/batched_point_location.cpp // Answering a batched point-location query. -#include -#include +#include #include #include #include @@ -10,46 +9,48 @@ #include "point_location_utils.h" -typedef CGAL::MP_Float Number_type; -typedef CGAL::Cartesian Kernel; -typedef CGAL::Arr_segment_traits_2 Traits_2; -typedef Traits_2::Point_2 Point_2; -typedef CGAL::Arrangement_2 Arrangement_2; -typedef CGAL::Arr_point_location_result Point_location_result; -typedef std::pair Query_result; +typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; +typedef CGAL::Arr_segment_traits_2 Traits; +typedef Traits::Point_2 Point; +typedef CGAL::Arrangement_2 Arrangement; +typedef CGAL::Arr_point_location_result Point_location_result; +typedef std::pair 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 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 results; + std::list 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 results; locate(arr, points.begin(), points.end(), std::back_inserter(results)); // Print the results. std::list::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(&(it->second))) // inside a face + if (const Face_const_handle* f = + boost::get(&(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(&(it->second))) // on an edge + else if (const Halfedge_const_handle* e = + boost::get(&(it->second))) // on an edge std::cout << "on an edge: " << (*e)->curve() << std::endl; - else if (const Vertex_const_handle* v = boost::get(&(it->second))) // on a vertex + else if (const Vertex_const_handle* v = + boost::get(&(it->second))) // on a vertex std::cout << "on " << (((*v)->is_isolated()) ? "an isolated" : "a") << " vertex: " << (*v)->point() << std::endl; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h index 20fbe17e7e0..1ec0ea82ea5 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h @@ -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 // Ron Wein // Efi Fogel @@ -24,9 +21,8 @@ #include - #include -#include +#include #include #include @@ -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, + * and the value-type of OutputIterator is is pair, * where Result is either * (i) Object or * (ii) boost::optional + typename PointsIterator, typename OutputIterator> OutputIterator locate(const Arrangement_on_surface_2& arr, PointsIterator points_begin, PointsIterator points_end, @@ -60,25 +55,25 @@ locate(const Arrangement_on_surface_2& arr, // Arrangement types: typedef Arrangement_on_surface_2 Arr; typedef typename TopTraits::template - Sweep_line_batched_point_location_visitor - Bpl_visitor; + Surface_sweep_batched_point_location_visitor + 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 xcurves_vec(arr.number_of_edges()); - Edge_const_iterator eit; - unsigned int i = 0; + std::vector 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& arr, // Go over all isolated vertices and collect their points. To each point // we attach its vertex handle. - std::vector iso_pts_vec(arr.number_of_isolated_vertices()); - Vertex_const_iterator vit; + std::vector 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& arr, iso_pts_vec[i++] = Bpl_point_2(vit->point(), iso_v); } } - + // Obtain a extended traits-class object. GeomTraits* geom_traits = const_cast(arr.geometry_traits()); @@ -110,7 +105,7 @@ locate(const Arrangement_on_surface_2& 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& arr, ex_traits(*geom_traits); // Define the sweep-line visitor and perform the sweep. - Bpl_visitor visitor(&arr, oi); - Basic_sweep_line_2 - 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 + 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; } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h index de1c5246aa4..51c8efe5a63 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h @@ -12,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 // Efi Fogel // Eric Berberich @@ -25,7 +21,6 @@ #include - /*! \file * Definition of the Arr_bounded_planar_topology_traits_2 class. */ @@ -39,6 +34,7 @@ #include #include #include + namespace CGAL { // Forward declaration: @@ -264,19 +260,19 @@ public: //@{ typedef Arr_construction_sl_visitor - Sweep_line_construction_visitor; + Surface_sweep_construction_visitor; typedef Arr_insertion_sl_visitor - 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 - Sweep_line_non_intersecting_insertion_visitor; + Surface_sweep_non_intersecting_insertion_visitor; template - struct Sweep_line_batched_point_location_visitor : + struct Surface_sweep_batched_point_location_visitor : public Arr_batched_pl_sl_visitor { 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 - struct Sweep_line_vertical_decomposition_visitor : + struct Surface_sweep_vertical_decomposition_visitor : public Arr_vert_decomp_sl_visitor { 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 - 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, @@ -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) {} }; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_default_overlay_traits.h b/Arrangement_on_surface_2/include/CGAL/Arr_default_overlay_traits.h index 02d3174be6d..da126784658 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_default_overlay_traits.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_default_overlay_traits.h @@ -12,10 +12,6 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s) : Ron Wein // Baruch Zukerman @@ -31,7 +27,7 @@ #include #include -#include +#include namespace CGAL { @@ -65,7 +61,7 @@ template + ArrangementR> { public: diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h index 4f5be927851..6082c4f0b7a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h @@ -12,10 +12,6 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s) : Baruch Zukerman // Efi Fogel @@ -32,8 +28,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -92,7 +88,7 @@ void overlay(const Arrangement_on_surface_2& arr1, typename GeomTraitsRes::X_monotone_curve_2>::value)); typedef typename TopTraitsRes::template - Sweep_line_overlay_visitor + Surface_sweep_overlay_visitor Ovl_visitor; typedef typename Ovl_visitor::Traits_2 Ovl_traits_2; @@ -156,7 +152,7 @@ void overlay(const Arrangement_on_surface_2& arr1, ex_traits(*traits_adaptor); Ovl_visitor visitor(&arr1, &arr2, &arr_res, &ovl_tr); - Sweep_line_2 sweep_line(&ex_traits, &visitor); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h index ddc6d40d05f..962056e6b3f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h @@ -12,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 // Eric Berberich @@ -34,18 +31,18 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -387,19 +384,19 @@ public: //@{ typedef Arr_construction_sl_visitor - Sweep_line_construction_visitor; + Surface_sweep_construction_visitor; typedef Arr_insertion_sl_visitor - 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 - Sweep_line_non_intersecting_insertion_visitor; + Surface_sweep_non_intersecting_insertion_visitor; template - struct Sweep_line_batched_point_location_visitor : + struct Surface_sweep_batched_point_location_visitor : public Arr_batched_pl_sl_visitor { 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 - struct Sweep_line_vertical_decomposition_visitor : + struct Surface_sweep_vertical_decomposition_visitor : public Arr_vert_decomp_sl_visitor { 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 - struct Sweep_line_overlay_visitor : + struct Surface_sweep_overlay_visitor : public Arr_overlay_sl_visitor <_Overlay_helper, @@ -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) {} }; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_batched_pl_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_batched_pl_helper.h index be5010b6cea..ade911399c6 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_batched_pl_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_batched_pl_helper.h @@ -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 // Ron Wein @@ -24,77 +20,64 @@ #include - /*! * Definition of the Arr_bounded_planar_batched_pl_helper class-template. */ namespace CGAL { -#include +#include /*! \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 Arr_bounded_planar_batched_pl_helper -{ +template +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 Base_visitor; + typedef Surface_sweep_empty_visitor 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 diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h index f0aa40b4079..9328f419bc1 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h @@ -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 // Ron Wein @@ -24,12 +20,11 @@ #include - /*! * Definition of the Arr_bounded_planar_construction_helper class-template. */ -#include +#include #include 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 Arr_bounded_planar_construction_helper -{ +template +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 Base_visitor; + typedef Surface_sweep_empty_visitor + 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_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 diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_insertion_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_insertion_helper.h index 03e71540337..0dd01a52fe8 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_insertion_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_insertion_helper.h @@ -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 // Ron Wein @@ -29,7 +25,7 @@ * Definition of the Arr_bounded_planar_insertion_helper class-template. */ -#include +#include #include 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 +template class Arr_bounded_planar_insertion_helper : public Arr_bounded_planar_construction_helper { public: - typedef Traits_ Traits_2; - typedef Arrangement_ Arrangement_2; - typedef Event_ Event; - typedef Subcurve_ Subcurve; + typedef Traits_ Traits_2; + typedef Arrangement_ Arrangement_2; + typedef Event_ Event; + typedef Subcurve_ Subcurve; - typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2; - typedef typename Traits_2::Point_2 Point_2; + typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2; + typedef typename Traits_2::Point_2 Point_2; - typedef Arr_bounded_planar_construction_helper Base; + typedef Arr_bounded_planar_construction_helper + Base; - typedef Sweep_line_empty_visitor Base_visitor; + typedef Surface_sweep_empty_visitor + Base_visitor; - typedef Arr_bounded_planar_insertion_helper Self; + typedef Arr_bounded_planar_insertion_helper Self; - typedef Arr_construction_sl_visitor Parent_visitor; + typedef Arr_construction_sl_visitor 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) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h index 07c7f0ece66..8e253029f38 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h @@ -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 #ifndef CGAL_ARR_BOUNDED_PLANAR_VERT_DEOCMP_HELPER_H @@ -23,86 +19,75 @@ #include - /*! \file * Definition of the Arr_bounded_planar_vert_decomp_helper class-template. */ namespace CGAL { -#include +#include /*! \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 Arr_bounded_planar_vert_decomp_helper -{ +template +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 Base_visitor; + typedef Surface_sweep_empty_visitor 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 diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h index b1ffb296dc3..e93bb0b076d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h @@ -12,10 +12,6 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s) : Ron Wein // Efi Fogel @@ -33,18 +29,18 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include namespace CGAL { diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h index e731b0be8bd..e296310c210 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h @@ -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 // Ron Wein // Efi Fogel @@ -32,30 +29,27 @@ namespace CGAL { -#include +#include /*! \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 Arr_spherical_batched_pl_helper -{ +template +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 Base_visitor; + typedef Surface_sweep_empty_visitor 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(); } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h index 331bffd7f48..df421ae218a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h @@ -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 // Efi Fogel @@ -29,7 +25,7 @@ * Definition of the Arr_spherical_construction_helper class-template. */ -#include +#include #include 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 + typedef Surface_sweep_empty_visitor Base_visitor; typedef typename Arrangement_2::Vertex_handle Vertex_handle; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h index 833b697c85f..5983e080c43 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h @@ -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 // Efi Fogel @@ -29,7 +25,7 @@ * Definition of the Arr_spherical_insertion_helper class-template. */ -#include +#include #include namespace CGAL { @@ -57,7 +53,7 @@ public: typedef Arr_spherical_construction_helper Base; - typedef Sweep_line_empty_visitor + typedef Surface_sweep_empty_visitor Base_visitor; typedef Arr_spherical_insertion_helper // Efi Fogel // @@ -24,25 +21,22 @@ #include - /*! \file * Definition of the Arr_spherical_vert_decomp_helper class-template. */ namespace CGAL { -#include +#include /*! \class Arr_spherical_vert_decomp_helper * A helper class for the vertical decomposition sweep-line visitor, suitable * for an Arrangement_on_surface_2 instantiated with a topology-traits class * for bounded curves in the plane. */ -template -class Arr_spherical_vert_decomp_helper -{ +template +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 Base_visitor; + typedef Surface_sweep_empty_visitor 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 +template void Arr_spherical_vert_decomp_helper::before_sweep() { // Get the north pole and the face that intially contains it. @@ -132,13 +124,12 @@ void Arr_spherical_vert_decomp_helper::before_sweep() // A notification invoked after the sweep-line finishes handling the given // event. /// -template +template void Arr_spherical_vert_decomp_helper::after_handle_event (Event *event) { // Ignore events that are not incident to the poles. - if (event->parameter_space_in_y() == ARR_INTERIOR) - return; + 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::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 diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h index 718b17110c9..8f39a2f4b3f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h @@ -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 // Ron Wein // Efi Fogel @@ -25,72 +21,63 @@ #include - /*! * Definition of the Arr_unb_planar_batched_pl_helper class-template. */ namespace CGAL { -#include +#include /*! \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 Arr_unb_planar_batched_pl_helper -{ +template +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 Base_visitor; + typedef Surface_sweep_empty_visitor 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 -void Arr_unb_planar_batched_pl_helper::before_sweep () +template +void Arr_unb_planar_batched_pl_helper::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 +template void Arr_unb_planar_batched_pl_helper:: -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 diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h index ea700974a52..693f6c9bdeb 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h @@ -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 // Ron Wein // Efi Fogel @@ -30,7 +26,7 @@ * Definition of the Arr_unb_planar_construction_helper class-template. */ -#include +#include #include 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 Arr_unb_planar_construction_helper -{ +template +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 + typedef Surface_sweep_empty_visitor 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_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 - m_arr_access; // An arrangement accessor. + Topology_traits* m_top_traits; // The topology-traits class. + Arr_accessor 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 +template void Arr_unb_planar_construction_helper::before_sweep() { // Obtain the four fictitious vertices that form the "corners" of the @@ -191,7 +175,7 @@ void Arr_unb_planar_construction_helper::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::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::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::before_sweep() // A notification invoked before the sweep-line starts handling the given // event. // -template +template void Arr_unb_planar_construction_helper:: 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()); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h index 60678cf29c1..79ad51ab549 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h @@ -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 // Ron Wein // Efi Fogel @@ -30,7 +26,7 @@ * Definition of the Arr_unb_planar_insertion_helper class-template. */ -#include +#include #include 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 +template class Arr_unb_planar_insertion_helper : public Arr_unb_planar_construction_helper { public: - typedef Traits_ Traits_2; typedef Arrangement_ Arrangement_2; typedef Event_ Event; @@ -59,7 +54,7 @@ public: typedef Arr_unb_planar_construction_helper Base; - typedef Sweep_line_empty_visitor + typedef Surface_sweep_empty_visitor Base_visitor; typedef Arr_unb_planar_insertion_helper +template void Arr_unb_planar_insertion_helper::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::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::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::before_sweep () // A notification invoked before the sweep-line starts handling the given // event. // -template +template void Arr_unb_planar_insertion_helper:: 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; } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h index de43c54c720..7989475a2f9 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h @@ -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 // Efi Fogel @@ -24,53 +20,48 @@ #include - /*! \file * Definition of the Arr_unb_planar_vert_decomp_helper class-template. */ namespace CGAL { -#include +#include /*! \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 Arr_unb_planar_vert_decomp_helper -{ +template +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 Base_visitor; + typedef Surface_sweep_empty_visitor 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 -void Arr_unb_planar_vert_decomp_helper::before_sweep () +template +void Arr_unb_planar_vert_decomp_helper::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::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::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 +template void Arr_unb_planar_vert_decomp_helper:: -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 diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h index 4d1c3506556..ccf71d1577d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h @@ -12,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 // Efi Fogel @@ -24,7 +20,6 @@ #include - /*! \file * Definition of the Arr_unb_planar_topology_traits_2 class. */ @@ -292,19 +287,19 @@ public: //@{ typedef Arr_construction_sl_visitor - Sweep_line_construction_visitor; + Surface_sweep_construction_visitor; typedef Arr_insertion_sl_visitor - 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 - Sweep_line_non_intersecting_insertion_visitor; + Surface_sweep_non_intersecting_insertion_visitor; template - struct Sweep_line_batched_point_location_visitor : + struct Surface_sweep_batched_point_location_visitor : public Arr_batched_pl_sl_visitor { 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 - struct Sweep_line_vertical_decomposition_visitor : + struct Surface_sweep_vertical_decomposition_visitor : public Arr_vert_decomp_sl_visitor { 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 - struct Sweep_line_overlay_visitor : + struct Surface_sweep_overlay_visitor : public Arr_overlay_sl_visitor <_Overlay_helper #ifndef CGAL_ARR_VERTICAL_DECOMPOSITION_2_H @@ -22,9 +19,8 @@ #include - #include -#include +#include #include #include @@ -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 >, where * the Object represents a handle to an arrangement feature. */ -template +template OutputIterator decompose(const Arrangement_on_surface_2& arr, OutputIterator oi) @@ -54,7 +49,7 @@ decompose(const Arrangement_on_surface_2& arr, // Arrangement types: typedef Arrangement_on_surface_2 Arrangement_2; typedef typename TopTraits::template - Sweep_line_vertical_decomposition_visitor + Surface_sweep_vertical_decomposition_visitor Vd_visitor; typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator; @@ -70,49 +65,40 @@ decompose(const Arrangement_on_surface_2& 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 xcurves_vec (arr.number_of_edges()); - Edge_const_iterator eit; - Halfedge_const_handle he; - unsigned int i = 0; + std::vector 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 iso_pts_vec (arr.number_of_isolated_vertices()); - Vertex_const_iterator vit; - Vertex_const_handle iso_v; - + std::vector 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& 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& arr, ex_traits(*geom_traits); // Define the sweep-line visitor and perform the sweep. - Vd_visitor visitor (&arr, &oi); - Basic_sweep_line_2 - sweep_line (&ex_traits, &visitor); + Vd_visitor visitor(&arr, &oi); + No_intersection_surface_sweep_2 + 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 diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h index 4007b29c3f0..ea06e977884 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h @@ -12,46 +12,38 @@ // 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 // Baruch Zukerman // Efi Fogel // + #ifndef CGAL_ARRANGEMENT_ON_SURFACE_2_GLOBAL_H #define CGAL_ARRANGEMENT_ON_SURFACE_2_GLOBAL_H -#include - - /*! \file * Global insertion functions for the Arrangement_2 class. */ #include #include +#include +#include +#include #include #include -#include -#include +#include +#include #include #include #include #include -#include -#include +#include +#include #include #include - #include -#include - -#include - namespace CGAL { //----------------------------------------------------------------------------- @@ -68,44 +60,42 @@ namespace CGAL { // const Arr_segment_2&, const Arr_walk_along_line_point_location<>&, // mpl_::bool_< true>)' // -template -void insert (Arrangement_on_surface_2& arr, - const typename GeomTraits::Curve_2& c, - const PointLocation& pl, ZoneVisitor &visitor, - boost::is_same::type) +template +void insert(Arrangement_on_surface_2& arr, + const typename GeomTraits::Curve_2& c, + const PointLocation& pl, ZoneVisitor &visitor, + boost::is_same::type) { typedef Arrangement_on_surface_2 Arr; typedef ZoneVisitor Zone_visitor; // Obtain an arrangement accessor. - Arr_accessor arr_access (arr); + Arr_accessor arr_access(arr); // Initialize a zone-computation object an a visitor that performs the // incremental insertion. - Arrangement_zone_2 arr_zone (arr, &visitor); + Arrangement_zone_2 arr_zone(arr, &visitor); // Break the input curve into x-monotone subcurves and isolated points. - std::list x_objects; - std::list::const_iterator obj_iter; - const typename GeomTraits::X_monotone_curve_2 *x_curve; - const typename GeomTraits::Point_2 *iso_p; + std::list x_objects; + std::list::const_iterator obj_iter; + const typename GeomTraits::X_monotone_curve_2* x_curve; + const typename GeomTraits::Point_2* iso_p; arr.geometry_traits()->make_x_monotone_2_object() - (c, std::back_inserter (x_objects)); + (c, std::back_inserter(x_objects)); // Insert each x-monotone curve into the arrangement. - for (obj_iter = x_objects.begin(); obj_iter != x_objects.end(); ++obj_iter) - { + for (obj_iter = x_objects.begin(); obj_iter != x_objects.end(); ++obj_iter) { // Act according to the type of the current object. x_curve = - object_cast (&(*obj_iter)); + object_cast(&(*obj_iter)); - if (x_curve != NULL) - { + if (x_curve != NULL) { // Inserting an x-monotone curve: // Initialize the zone-computation object with the given curve. - arr_zone.init (*x_curve, pl); + arr_zone.init(*x_curve, pl); // Notify the arrangement observers that a global operation is about to // take place. @@ -118,13 +108,12 @@ void insert (Arrangement_on_surface_2& arr, // completed. arr_access.notify_after_global_change(); } - else - { - iso_p = object_cast (&(*obj_iter)); - CGAL_assertion (iso_p != NULL); + else { + iso_p = object_cast(&(*obj_iter)); + CGAL_assertion(iso_p != NULL); // Inserting a point into the arrangement: - insert_point (arr, *iso_p, pl); + insert_point(arr, *iso_p, pl); } } } @@ -143,8 +132,8 @@ void insert (Arrangement_on_surface_2& arr, // mpl_::bool_< true>)' // // -template +template void insert(Arrangement_on_surface_2& arr, const typename GeomTraits::X_monotone_curve_2& c, const PointLocation& pl, ZoneVisitor &visitor, @@ -154,11 +143,11 @@ void insert(Arrangement_on_surface_2& arr, typedef ZoneVisitor Zone_visitor; // Obtain an arrangement accessor. - Arr_accessor arr_access (arr); + Arr_accessor arr_access(arr); // Initialize a zone-computation object an a visitor that performs the // incremental insertion. - Arrangement_zone_2 arr_zone (arr, &visitor); + Arrangement_zone_2 arr_zone(arr, &visitor); // Initialize the zone-computation object with the given curve. @@ -182,7 +171,7 @@ void insert(Arrangement_on_surface_2& arr, std::cout << "xxxxxxxxxxxx" << std::endl; } */ - arr_zone.init (c, pl); + arr_zone.init(c, pl); // Notify the arrangement observers that a global operation is about to // take place. @@ -198,10 +187,10 @@ void insert(Arrangement_on_surface_2& arr, //----------------------------------------------------------------------------- // Common interface for the insert of the Curve_2 and X_monotone_curve_2 -template -void insert (Arrangement_on_surface_2& arr, - const Curve& c, const PointLocation& pl, ZoneVisitor &visitor) +template +void insert(Arrangement_on_surface_2& arr, + const Curve& c, const PointLocation& pl, ZoneVisitor &visitor) { typedef typename GeomTraits::X_monotone_curve_2 X_monotone_curve_2; @@ -216,15 +205,15 @@ void insert (Arrangement_on_surface_2& arr, // For now the solution is to add a dummy variable at the end (referring // to point-location). Maybe the proper solution is to use boost::enable_if // together with appropriate tag. -template -void insert (Arrangement_on_surface_2& arr, - const Curve& c, const PointLocation& pl, - typename PointLocation::Point_2*) +template +void insert(Arrangement_on_surface_2& arr, + const Curve& c, const PointLocation& pl, + typename PointLocation::Point_2*) { typedef typename TopTraits::Zone_insertion_visitor Zone_visitor; Zone_visitor visitor; - insert (arr, c, pl, visitor); + insert(arr, c, pl, visitor); } //----------------------------------------------------------------------------- @@ -234,14 +223,14 @@ void insert (Arrangement_on_surface_2& arr, // Overloaded version with no point location object - using the default point // location. // -template +template void insert(Arrangement_on_surface_2& arr, const Curve& c) { // Create a default point-location object and use it to insert the curve. typename TopTraits::Default_point_location_strategy def_pl (arr); - insert (arr, c, def_pl); + insert(arr, c, def_pl); } /*! Insert a range of x-monotone curves into an empty arrangement @@ -253,7 +242,7 @@ template void insert_empty(Arrangement_on_surface_2& arr, InputIterator begin_xcurves, InputIterator end_xcurves) { - typedef typename TopTraits::Sweep_line_construction_visitor + typedef typename TopTraits::Surface_sweep_construction_visitor Construct_visitor; typedef typename Construct_visitor::Traits_2 Construct_traits; @@ -277,11 +266,11 @@ void insert_empty(Arrangement_on_surface_2& arr, traits(*geom_traits); // Define a sweep-line instance and perform the sweep: - Sweep_line_2 - sweep_line(&traits, &visitor); - sweep_line.sweep(begin_xcurves, end_xcurves); + Surface_sweep_2 + surface_sweep(&traits, &visitor); + surface_sweep.sweep(begin_xcurves, end_xcurves); } /*! Insert a range of x-monotone curves and a range of isolated points into @@ -298,11 +287,11 @@ void insert_empty(Arrangement_on_surface_2& arr, XcInputIterator begin_xcurves, XcInputIterator end_xcurves, PInputIterator begin_points, PInputIterator end_points) { - typedef typename TopTraits::Sweep_line_construction_visitor + typedef typename TopTraits::Surface_sweep_construction_visitor Construct_visitor; typedef typename Construct_visitor::Traits_2 Construct_traits; - const GeomTraits * geom_traits = arr.geometry_traits(); + const GeomTraits* geom_traits = arr.geometry_traits(); Construct_visitor visitor(&arr); /* We would like to avoid copy construction of the geometry traits class. @@ -322,11 +311,11 @@ void insert_empty(Arrangement_on_surface_2& arr, traits(*geom_traits); // Define a sweep-line instance and perform the sweep. - Sweep_line_2 - sweep_line(&traits, &visitor); - sweep_line.sweep(begin_xcurves, end_xcurves, begin_points, end_points); + Surface_sweep_2 + surface_sweep(&traits, &visitor); + surface_sweep.sweep(begin_xcurves, end_xcurves, begin_points, end_points); } /*! Insert a range of x-monotone curves into a non-empty arrangement @@ -341,7 +330,7 @@ void insert_non_empty(Arrangement_on_surface_2& arr, XcInputIterator end_xcurves, PInputIterator begin_points, PInputIterator end_points) { - typedef typename TopTraits::Sweep_line_insertion_visitor + typedef typename TopTraits::Surface_sweep_insertion_visitor Insert_visitor; typedef typename Insert_visitor::Traits_2 Insert_traits; typedef typename Insert_visitor::Traits_2::X_monotone_curve_2 @@ -379,11 +368,11 @@ void insert_non_empty(Arrangement_on_surface_2& arr, &traits); // Define a basic sweep-line instance and perform the sweep. - Sweep_line_2 - sweep_line(&traits, &visitor); - sweep_line.sweep(ex_cvs.begin(), ex_cvs.end(),ex_pts.begin(), ex_pts.end()); + Surface_sweep_2 + surface_sweep(&traits, &visitor); + surface_sweep.sweep(ex_cvs.begin(), ex_cvs.end(),ex_pts.begin(), ex_pts.end()); } //----------------------------------------------------------------------------- @@ -401,17 +390,17 @@ void insert_non_empty(Arrangement_on_surface_2& arr, // const Arr_segment_2&, const Arr_walk_along_line_point_location<>&, // mpl_::bool_< true>)' // -template -void insert (Arrangement_on_surface_2& arr, - InputIterator begin, InputIterator end, - boost::is_same::type) +template +void insert(Arrangement_on_surface_2& arr, + InputIterator begin, InputIterator end, + boost::is_same::type) { typedef Arrangement_on_surface_2 Arr; typedef typename GeomTraits::Point_2 Point_2; typedef typename GeomTraits::X_monotone_curve_2 X_monotone_curve_2; // Obtain an arrangement accessor. - Arr_accessor arr_access (arr); + Arr_accessor arr_access(arr); // Notify the arrangement observers that a global operation is about to // take place. @@ -419,8 +408,8 @@ void insert (Arrangement_on_surface_2& arr, // Subdivide the input curves into x-monotone subcurves and isolated points. const GeomTraits * geom_traits = arr.geometry_traits(); - std::list xcurves; - std::list iso_points; + std::list xcurves; + std::list iso_points; make_x_monotone(begin, end, std::back_inserter(xcurves), std::back_inserter(iso_points), @@ -452,7 +441,7 @@ void insert (Arrangement_on_surface_2& arr, // const Arr_segment_2&, const Arr_walk_along_line_point_location<>&, // mpl_::bool_< true>)' // -template +template void insert(Arrangement_on_surface_2& arr, InputIterator begin, InputIterator end, boost::is_same::type) @@ -460,7 +449,7 @@ void insert(Arrangement_on_surface_2& arr, typedef Arrangement_on_surface_2 Arr; // Obtain an arrangement accessor. - Arr_accessor arr_access (arr); + Arr_accessor arr_access(arr); // Notify the arrangement observers that a global operation is about to // take place. @@ -469,8 +458,7 @@ void insert(Arrangement_on_surface_2& arr, // Choose the operation depending on whether the input arrangement is // empty (then we construct it from scratch), or not (where we just insert // the new curves). - if (arr.is_empty()) - insert_empty(arr, begin, end); + if (arr.is_empty()) insert_empty(arr, begin, end); else { // The arrangement is not empty: use the insertion visitor. std::list empty; @@ -484,9 +472,9 @@ void insert(Arrangement_on_surface_2& arr, //----------------------------------------------------------------------------- // Common interface for the inserts of the Curve_2 and X_monotone_curve_2 -template -void insert (Arrangement_on_surface_2& arr, - InputIterator begin, InputIterator end) +template +void insert(Arrangement_on_surface_2& arr, + InputIterator begin, InputIterator end) { typedef typename GeomTraits::X_monotone_curve_2 X_monotone_curve_2; typedef typename std::iterator_traits::value_type @@ -504,24 +492,24 @@ void insert (Arrangement_on_surface_2& arr, // given as an isertion hint. // The inserted x-monotone curve may intersect the existing arrangement. // -template -void insert (Arrangement_on_surface_2& arr, - const typename GeomTraits::X_monotone_curve_2& c, - const Object& obj) +template +void insert(Arrangement_on_surface_2& arr, + const typename GeomTraits::X_monotone_curve_2& c, + const Object& obj) { typedef Arrangement_on_surface_2 Arr; typedef typename TopTraits::Zone_insertion_visitor Zone_visitor; // Obtain an arrangement accessor. - Arr_accessor arr_access (arr); + Arr_accessor arr_access(arr); // Define a zone-computation object an a visitor that performs the // incremental insertion. - Zone_visitor visitor; - Arrangement_zone_2 arr_zone (arr, &visitor); + Zone_visitor visitor; + Arrangement_zone_2 arr_zone(arr, &visitor); // Initialize the zone-computation object with the given curve. - arr_zone.init_with_hint (c, obj); + arr_zone.init_with_hint(c, obj); // Notify the arrangement observers that a global operation is about to // take place. @@ -538,7 +526,7 @@ void insert (Arrangement_on_surface_2& arr, // ---------------------------------------------------------------------------- // backward compatibility functions. /* DEPRECATED use insert() instead */ -template +template CGAL_DEPRECATED void insert_x_monotone_curve (Arrangement_on_surface_2& arr, const typename GeomTraits::X_monotone_curve_2& c, @@ -548,7 +536,7 @@ CGAL_DEPRECATED void insert_x_monotone_curve } /* DEPRECATED use insert() instead */ -template +template CGAL_DEPRECATED void insert_x_monotone_curve (Arrangement_on_surface_2& arr, const typename GeomTraits::X_monotone_curve_2& c) @@ -557,7 +545,7 @@ CGAL_DEPRECATED void insert_x_monotone_curve } /* DEPRECATED use insert() instead */ -template +template CGAL_DEPRECATED void insert_x_monotone_curves (Arrangement_on_surface_2& arr, InputIterator begin, InputIterator end) @@ -566,7 +554,7 @@ CGAL_DEPRECATED void insert_x_monotone_curves } /* DEPRECATED use insert() instead */ -template +template CGAL_DEPRECATED void insert_x_monotone_curve (Arrangement_on_surface_2& arr, const typename GeomTraits::X_monotone_curve_2& c, @@ -576,7 +564,7 @@ CGAL_DEPRECATED void insert_x_monotone_curve } /* DEPRECATED use insert() instead */ -template +template CGAL_DEPRECATED void insert_curve(Arrangement_on_surface_2& arr, const typename GeomTraits::Curve_2& c, @@ -586,7 +574,7 @@ void insert_curve(Arrangement_on_surface_2& arr, } /* DEPRECATED use insert() instead */ -template +template CGAL_DEPRECATED void insert_curve(Arrangement_on_surface_2& arr, const typename GeomTraits::Curve_2& c) @@ -595,10 +583,10 @@ void insert_curve(Arrangement_on_surface_2& arr, } /* DEPRECATED use insert() instead */ -template +template CGAL_DEPRECATED -void insert_curves (Arrangement_on_surface_2& arr, - InputIterator begin, InputIterator end) +void insert_curves(Arrangement_on_surface_2& arr, + InputIterator begin, InputIterator end) { insert(arr, begin, end); } @@ -608,7 +596,7 @@ void insert_curves (Arrangement_on_surface_2& arr, // interior does not intersect with any existing edge or vertex in the // arragement (incremental insertion). // -template +template typename Arrangement_on_surface_2::Halfedge_handle insert_non_intersecting_curve (Arrangement_on_surface_2& arr, @@ -624,14 +612,14 @@ insert_non_intersecting_curve CGAL_USE_TYPE(Halfedge_const_handle); const Traits_adaptor_2* geom_traits = - static_cast (arr.geometry_traits()); + static_cast(arr.geometry_traits()); Arr_accessor arr_access(arr); // Check whether the left end has boundary conditions, and locate it in the // arrangement accordingly. - const Arr_parameter_space bx1 = + const Arr_parameter_space bx1 = geom_traits->parameter_space_in_x_2_object()(c, ARR_MIN_END); - const Arr_parameter_space by1 = + const Arr_parameter_space by1 = geom_traits->parameter_space_in_y_2_object()(c, ARR_MIN_END); CGAL::Object obj1; const Vertex_const_handle* vh1 = NULL; @@ -774,16 +762,16 @@ insert_non_intersecting_curve // arragement (incremental insertion). // Overloaded version with no point location object. // -template +template typename Arrangement_on_surface_2::Halfedge_handle insert_non_intersecting_curve (Arrangement_on_surface_2& arr, const typename GeomTraits::X_monotone_curve_2& c) { // Create a default point-location object and use it to insert the curve. - typename TopTraits::Default_point_location_strategy def_pl (arr); + typename TopTraits::Default_point_location_strategy def_pl(arr); - return (insert_non_intersecting_curve (arr, c, def_pl)); + return (insert_non_intersecting_curve(arr, c, def_pl)); } /*! Insert a range of x-monotone curves into an empty arrangement @@ -797,19 +785,20 @@ void non_intersecting_insert_empty(Arrangement_on_surface_2 - sweep_line(&traits, &visitor); - sweep_line.sweep(begin_xcurves, end_xcurves); + No_intersection_surface_sweep_2 + surface_sweep(&traits, &visitor); + surface_sweep.sweep(begin_xcurves, end_xcurves); } /*! Insert a range of x-monotone curves into an empty arrangement @@ -826,7 +815,7 @@ void non_intersecting_insert_empty(Arrangement_on_surface_2 - sweep_line(&traits, &visitor); - sweep_line.sweep(begin_xcurves, end_xcurves, begin_points, end_points); + No_intersection_surface_sweep_2 + surface_sweep(&traits, &visitor); + surface_sweep.sweep(begin_xcurves, end_xcurves, begin_points, end_points); } /*! Insert a range of x-monotone curves into a non-empty arrangement @@ -872,7 +862,7 @@ void non_intersecting_insert_non_empty(Arrangement_on_surface_2 - sweep_line(&traits, &visitor); - sweep_line.sweep(ex_cvs.begin(), ex_cvs.end(), ex_pts.begin(), ex_pts.end()); + No_intersection_surface_sweep_2 + surface_sweep(&traits, &visitor); + surface_sweep.sweep(ex_cvs.begin(), ex_cvs.end(), ex_pts.begin(), ex_pts.end()); } //----------------------------------------------------------------------------- @@ -922,7 +913,7 @@ void non_intersecting_insert_non_empty(Arrangement_on_surface_2 +template void insert_non_intersecting_curves (Arrangement_on_surface_2& arr, InputIterator begin, InputIterator end) @@ -930,7 +921,7 @@ void insert_non_intersecting_curves typedef Arrangement_on_surface_2 Arr; // Obtain an arrangement accessor. - Arr_accessor arr_access (arr); + Arr_accessor arr_access(arr); // Notify the arrangement observers that a global operation is about to // take place. @@ -957,7 +948,7 @@ void insert_non_intersecting_curves // the edges incident to the end-vertices of the removed edge after its // deletion, the function performs these merges as well. // -template +template typename Arrangement_on_surface_2::Face_handle remove_edge (Arrangement_on_surface_2& arr, @@ -968,20 +959,20 @@ remove_edge // Notify the arrangement observers that a global operation is about to // take place. - Arr_accessor arr_access (arr); + Arr_accessor arr_access(arr); arr_access.notify_before_global_change(); // Keep track of the end-vertices of the edge we are about to remove. - typename Arr::Vertex_handle v_ends[2]; - bool is_removed[2]; + typename Arr::Vertex_handle v_ends[2]; + bool is_removed[2]; v_ends[0] = e->source(); is_removed[0] = - (v_ends[0]->is_at_open_boundary() || v_ends[0]->degree() == 1); + (v_ends[0]->is_at_open_boundary() || v_ends[0]->degree() == 1); v_ends[1] = e->target(); is_removed[1] = - (v_ends[1]->is_at_open_boundary() || v_ends[1]->degree() == 1); + (v_ends[1]->is_at_open_boundary() || v_ends[1]->degree() == 1); // Remove the edge from the arrangement. typename Arr::Face_handle face = arr.remove_edge (e); @@ -990,17 +981,13 @@ remove_edge // curves associated with these edges can be merged, merge the two edges and // remove the vertex. - const Traits_adaptor_2 * traits = + const Traits_adaptor_2* traits = static_cast (arr.geometry_traits()); - typename Arr::Halfedge_around_vertex_circulator circ; - typename Arr::Halfedge_handle e1, e2; - int i; - - for (i = 0; i < 2; i++) - { - if (! is_removed[i] && v_ends[i]->degree() == 2) - { + typename Arr::Halfedge_around_vertex_circulator circ; + typename Arr::Halfedge_handle e1, e2; + for (size_t i = 0; i < 2; i++) { + if (! is_removed[i] && v_ends[i]->degree() == 2) { // Get the two edges incident to the end-vertex. circ = v_ends[i]->incident_halfedges(); e1 = circ; @@ -1008,15 +995,13 @@ remove_edge e2 = circ; // Check if it is possible to merge the two edges. - if (traits->are_mergeable_2_object() (e1->curve(), e2->curve())) - { + if (traits->are_mergeable_2_object() (e1->curve(), e2->curve())) { // Merge the two curves. typename GeomTraits::X_monotone_curve_2 cv; - traits->merge_2_object() (e1->curve(), e2->curve(), - cv); + traits->merge_2_object()(e1->curve(), e2->curve(), cv); // Merge the two edges in the arrangement. - arr.merge_edge (e1, e2, cv); + arr.merge_edge(e1, e2, cv); } } } @@ -1033,38 +1018,36 @@ remove_edge // Insert a vertex that corresponds to a given point into the arrangement. // The inserted point may lie on any existing arrangement feature. // -template +template typename Arrangement_on_surface_2::Vertex_handle -insert_point (Arrangement_on_surface_2& arr, - const typename GeomTraits::Point_2& p, - const PointLocation& pl) +insert_point(Arrangement_on_surface_2& arr, + const typename GeomTraits::Point_2& p, + const PointLocation& pl) { typedef Arrangement_on_surface_2 Arr; // Act according to the type of arrangement feature that contains the point. - const typename Arr::Face_const_handle *fh; - const typename Arr::Halfedge_const_handle *hh; - const typename Arr::Vertex_const_handle *vh; - typename Arr::Vertex_handle vh_for_p; + const typename Arr::Face_const_handle* fh; + const typename Arr::Halfedge_const_handle* hh; + const typename Arr::Vertex_const_handle* vh; + typename Arr::Vertex_handle vh_for_p; // Locate the given point in the arrangement. - CGAL::Object obj = pl.locate (p); + CGAL::Object obj = pl.locate (p); // Notify the arrangement observers that a global operation is about to // take place. - Arr_accessor arr_access (arr); + Arr_accessor arr_access (arr); arr_access.notify_before_global_change(); - if ((fh = object_cast(&obj)) != NULL) - { + if ((fh = object_cast(&obj)) != NULL) { // p lies inside a face: Insert it as an isolated vertex it the interior of // this face. - vh_for_p = arr.insert_in_face_interior (p, - arr.non_const_handle (*fh)); + vh_for_p = arr.insert_in_face_interior(p, arr.non_const_handle (*fh)); } - else if ((hh = - object_cast(&obj)) != NULL) + else if ((hh = object_cast(&obj)) != + NULL) { // p lies in the interior of an edge: Split this edge to create a new // vertex associated with p. @@ -1080,8 +1063,7 @@ insert_point (Arrangement_on_surface_2& arr, // The new vertex is the target of the returned halfedge. vh_for_p = split_he->target(); } - else - { + else { // In this case p lies on an existing vertex, so we just update this // vertex. vh = object_cast(&obj); @@ -1102,67 +1084,63 @@ insert_point (Arrangement_on_surface_2& arr, // Insert a vertex that corresponds to a given point into the arrangement. // The inserted point may lie on any existing arrangement feature. // -template +template typename Arrangement_on_surface_2::Vertex_handle -insert_point (Arrangement_on_surface_2& arr, - const typename GeomTraits::Point_2& p) +insert_point(Arrangement_on_surface_2& arr, + const typename GeomTraits::Point_2& p) { // Create a default point-location object and use it to insert the point. - typename TopTraits::Default_point_location_strategy def_pl (arr); + typename TopTraits::Default_point_location_strategy def_pl(arr); - return (insert_point (arr, p, def_pl)); + return (insert_point(arr, p, def_pl)); } //----------------------------------------------------------------------------- // Remove a vertex from the arrangement. // -template -bool remove_vertex - (Arrangement_on_surface_2& arr, - typename Arrangement_on_surface_2::Vertex_handle v) +template +bool remove_vertex(Arrangement_on_surface_2& arr, + typename Arrangement_on_surface_2:: + Vertex_handle v) { typedef Arrangement_on_surface_2 Arr; typedef Arr_traits_adaptor_2 Traits_adaptor_2; // Notify the arrangement observers that a global operation is about to // take place. - Arr_accessor arr_access (arr); + Arr_accessor arr_access(arr); arr_access.notify_before_global_change(); // Act according to the number of edges incident to v. - bool removed = false; + bool removed = false; - if (v->is_isolated()) - { + if (v->is_isolated()) { // In case v is an isolated vertex, simply remove it. arr.remove_isolated_vertex (v); removed = true; } - else if (v->degree() == 2) - { + else if (v->degree() == 2) { // If the vertex has now two incident edges, and the curves associated // with these edges can be merged, merge the two edges and remove the // vertex. - const Traits_adaptor_2 * traits = + const Traits_adaptor_2* traits = static_cast(arr.geometry_traits()); - typename Arr::Halfedge_around_vertex_circulator circ; - typename Arr::Halfedge_handle e1, e2; + typename Arr::Halfedge_around_vertex_circulator circ; + typename Arr::Halfedge_handle e1, e2; circ = v->incident_halfedges(); e1 = circ; ++circ; e2 = circ; - if (traits->are_mergeable_2_object() (e1->curve(), e2->curve())) - { + if (traits->are_mergeable_2_object() (e1->curve(), e2->curve())) { // Merge the two curves. typename GeomTraits::X_monotone_curve_2 cv; - traits->merge_2_object() (e1->curve(), e2->curve(), - cv); + traits->merge_2_object()(e1->curve(), e2->curve(), cv); // Merge the two edges in the arrangement. - arr.merge_edge (e1, e2, cv); + arr.merge_edge(e1, e2, cv); removed = true; } } @@ -1180,20 +1158,19 @@ bool remove_vertex // edegs are disjoint-interior, and the holes are located in their proper // position. // -template -bool is_valid (const Arrangement_on_surface_2& arr) +template +bool is_valid(const Arrangement_on_surface_2& arr) { // First use the internal validity check. - if(!arr.is_valid()) - return (false); + if (!arr.is_valid()) return (false); typedef Arrangement_on_surface_2 Arr; typedef GeomTraits Geometry_traits_2; typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2; // Define the sweep-line types: - typedef Sweep_line_do_curves_x_visitor Visitor; - typedef Sweep_line_2 Sweep_line_2; + typedef Surface_sweep_do_curves_x_visitor Visitor; + typedef Surface_sweep_2 Surface_sweep_2; // Define the arrangement iterator and circulator types: typedef typename Arr::Edge_const_iterator Edge_const_iterator; @@ -1203,60 +1180,56 @@ bool is_valid (const Arrangement_on_surface_2& arr) typedef typename Arr::Face_const_handle Face_const_handle; typedef typename Arr::Vertex_const_handle Vertex_const_handle; typedef typename Arr::Isolated_vertex_const_iterator - Isolated_vertex_const_iterator; + Isolated_vertex_const_iterator; typedef typename Arr::Halfedge_around_vertex_const_circulator - Halfedge_around_vertex_const_circulator; + Halfedge_around_vertex_const_circulator; // Perform a sweep over all subcurves associated with arrangement edges. - std::vector curves_vec (arr.number_of_edges()); - Edge_const_iterator eit; - unsigned int i = 0; + std::vector curves_vec(arr.number_of_edges()); + unsigned int i = 0; + Edge_const_iterator eit; for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit, i++) curves_vec[i] = eit->curve(); - Visitor visitor; - const Geometry_traits_2 *traits = arr.geometry_traits(); - Sweep_line_2 sweep_line (traits, &visitor); + Visitor visitor; + const Geometry_traits_2* traits = arr.geometry_traits(); + Surface_sweep_2 surface_sweep(traits, &visitor); - visitor.sweep_xcurves (curves_vec.begin(), curves_vec.end()); + visitor.sweep_xcurves(curves_vec.begin(), curves_vec.end()); - bool are_edges_disjoint = (! visitor.found_intersection()); + bool are_edges_disjoint = (! visitor.found_intersection()); - if (!are_edges_disjoint) - { + if (!are_edges_disjoint) { CGAL_warning_msg (are_edges_disjoint, "Arrangement edges are not disjoint in their interior."); - return (false); + return false; } // Check that the holes and isolated vertices are located where they should. // At the same time, we prepare a vector that consists of all isolated // vertices and all leftmost vertices from every hole. - std::list > vf_list; + std::list > vf_list; - typename Geometry_traits_2::Compare_xy_2 compare_xy = + typename Geometry_traits_2::Compare_xy_2 compare_xy = traits->compare_xy_2_object(); - Face_const_iterator fit; - Face_const_handle fh; - Inner_ccb_const_iterator ic_it; - Halfedge_const_handle ccb; - Isolated_vertex_const_iterator iv_it; - Vertex_const_handle left_v; - bool is_first; + Face_const_iterator fit; + Face_const_handle fh; + Inner_ccb_const_iterator ic_it; + Halfedge_const_handle ccb; + Isolated_vertex_const_iterator iv_it; + Vertex_const_handle left_v; + bool is_first; - for (fit = arr.faces_begin(); fit != arr.faces_end(); ++fit) - { + for (fit = arr.faces_begin(); fit != arr.faces_end(); ++fit) { // Check all holes in the current face. fh = fit; - for (ic_it = fh->inner_ccbs_begin(); - ic_it != fh->inner_ccbs_end(); ++ic_it) + for (ic_it = fh->inner_ccbs_begin(); ic_it != fh->inner_ccbs_end(); ++ic_it) { ccb = *ic_it; is_first = true; - do - { + do { if (ccb->face() != fit) return (false); @@ -1278,8 +1251,7 @@ bool is_valid (const Arrangement_on_surface_2& arr) for (iv_it = fh->isolated_vertices_begin(); iv_it != fh->isolated_vertices_end(); ++iv_it) { - if (iv_it->face() != fit) - return (false); + if (iv_it->face() != fit) return (false); vf_list.push_back (std::make_pair (Vertex_const_handle(iv_it), fh)); } @@ -1294,24 +1266,22 @@ bool is_valid (const Arrangement_on_surface_2& arr) typename std::list >::iterator vf_iter; - typename TopTraits::Default_point_location_strategy def_pl (arr); - Vertex_const_handle curr_v; - Object obj; - Halfedge_const_handle he_below; - Vertex_const_handle v_below; - Face_const_handle in_face; - Halfedge_around_vertex_const_circulator first, circ; - bool assign_ok; - const Halfedge_const_handle invalid_he; + typename TopTraits::Default_point_location_strategy def_pl(arr); + Vertex_const_handle curr_v; + Object obj; + Halfedge_const_handle he_below; + Vertex_const_handle v_below; + Face_const_handle in_face; + Halfedge_around_vertex_const_circulator first, circ; + bool assign_ok; + const Halfedge_const_handle invalid_he; - for (vf_iter = vf_list.begin(); vf_iter != vf_list.end(); ++vf_iter) - { + for (vf_iter = vf_list.begin(); vf_iter != vf_list.end(); ++vf_iter) { // Perform ray-shooting from the current vertex. curr_v = vf_iter->first; obj = def_pl.ray_shoot_down(curr_v->point()); - if (CGAL::assign(he_below, obj)) - { + if (CGAL::assign(he_below, obj)) { // Hit an edge - take the incident face of the halfedge directed to the // right. if (he_below->direction() == ARR_RIGHT_TO_LEFT) @@ -1319,29 +1289,21 @@ bool is_valid (const Arrangement_on_surface_2& arr) in_face = he_below->face(); } - else if (CGAL::assign(v_below, obj)) - { + else if (CGAL::assign(v_below, obj)) { // Hit a vertex. - if(v_below->is_isolated()) - { - in_face = v_below->face(); - } - else - { + if (v_below->is_isolated()) in_face = v_below->face(); + else { // Get the first halfedge around v_below that is directed from left to // right and the first halfedge that is directed from right to left. first = circ = v_below->incident_halfedges(); Halfedge_const_handle he_left; // A halfedge to the left of v_below. Halfedge_const_handle he_right; // A halfedge to the right of v_below. - do - { - if (circ->direction() == ARR_LEFT_TO_RIGHT) - { + do { + if (circ->direction() == ARR_LEFT_TO_RIGHT) { he_left = circ; } - else - { + else { he_right = circ; if (he_left != invalid_he && he_right != invalid_he) break; @@ -1352,8 +1314,7 @@ bool is_valid (const Arrangement_on_surface_2& arr) CGAL_assertion (he_left != invalid_he || he_right != invalid_he); - if (he_left != invalid_he && he_right != invalid_he) - { + if (he_left != invalid_he && he_right != invalid_he) { while (he_left->direction() == ARR_LEFT_TO_RIGHT) he_left = he_left->next()->twin(); @@ -1361,24 +1322,21 @@ bool is_valid (const Arrangement_on_surface_2& arr) CGAL_assertion (he_left->direction() == ARR_LEFT_TO_RIGHT); in_face = he_left->face(); } - else if (he_left != invalid_he) - { - Comparison_result res; + else if (he_left != invalid_he) { + Comparison_result res; Halfedge_const_handle he_curr = he_left; - do // as long as we have next he_left halfedge which is above - { + // as long as we have next he_left halfedge which is above + do { he_left = he_curr; he_curr = he_left->next()->twin(); - res = comp_y_at_x_left (he_curr->curve(), - he_left->curve(), - v_below->point()); + res = comp_y_at_x_left(he_curr->curve(), he_left->curve(), + v_below->point()); } while(res == LARGER); in_face = he_left->face(); } - else - { - Comparison_result res; + else { + Comparison_result res; Halfedge_const_handle he_curr = he_right; do // as long as we have he_right halfedge which is below @@ -1393,39 +1351,36 @@ bool is_valid (const Arrangement_on_surface_2& arr) } } } - else - { + else { // Hit nothing (an unbounded face is returned). assign_ok = CGAL::assign(in_face, obj); CGAL_assertion (assign_ok && in_face->is_unbounded()); - if (! assign_ok) - return (false); + if (! assign_ok) return false; } - if (vf_iter->second != in_face) - { + if (vf_iter->second != in_face) { CGAL_warning_msg (false, "An inner component is located in the wrong face."); - return (false); + return false; } } // If we reached here, the arrangement is valid: - return (true); + return true; } //----------------------------------------------------------------------------- // Compute the zone of the given x-monotone curve in the existing arrangement. // Meaning, it output the arrangment's vertices, edges and faces that the // x-monotone curve intersects. -template -OutputIterator zone (Arrangement_on_surface_2& arr, - const typename GeomTraits::X_monotone_curve_2& c, - OutputIterator oi, - const PointLocation& pl) +template +OutputIterator zone(Arrangement_on_surface_2& arr, + const typename GeomTraits::X_monotone_curve_2& c, + OutputIterator oi, + const PointLocation& pl) { // Obtain an arrangement accessor. typedef Arrangement_on_surface_2 @@ -1436,9 +1391,9 @@ OutputIterator zone (Arrangement_on_surface_2& arr, typedef Arr_compute_zone_visitor Zone_visitor; - Zone_visitor visitor (oi); + Zone_visitor visitor(oi); Arrangement_zone_2 - arr_zone (arr, &visitor); + arr_zone(arr, &visitor); arr_zone.init (c, pl); arr_zone.compute_zone(); @@ -1451,13 +1406,13 @@ OutputIterator zone (Arrangement_on_surface_2& arr, // Overloaded version with no point location object - the walk point-location // strategy is used as default. // -template -OutputIterator zone (Arrangement_on_surface_2& arr, - const typename GeomTraits::X_monotone_curve_2& c, - OutputIterator oi) +template +OutputIterator zone(Arrangement_on_surface_2& arr, + const typename GeomTraits::X_monotone_curve_2& c, + OutputIterator oi) { // Create a default point-location object and use it to insert the curve. - typename TopTraits::Default_point_location_strategy def_pl (arr); + typename TopTraits::Default_point_location_strategy def_pl(arr); //insert the curve using the walk point location zone (arr, c, oi, def_pl); @@ -1475,10 +1430,10 @@ OutputIterator zone (Arrangement_on_surface_2& arr, // error: no matching function for call to `do_intersect(Arrangement_on_surface_2<>&, // const Arr_segment_2&, const Arr_walk_along_line_point_location<>&, mpl_::bool_< true>)' // -template -bool do_intersect (Arrangement_on_surface_2& arr, - const typename GeomTraits::X_monotone_curve_2& c, - const PointLocation& pl, boost::is_same::type) +template +bool do_intersect(Arrangement_on_surface_2& arr, + const typename GeomTraits::X_monotone_curve_2& c, + const PointLocation& pl, boost::is_same::type) { // Obtain an arrangement accessor. typedef Arrangement_on_surface_2 @@ -1488,11 +1443,11 @@ bool do_intersect (Arrangement_on_surface_2& arr, // intersection check. typedef Arr_do_intersect_zone_visitor Zone_visitor; - Zone_visitor visitor; + Zone_visitor visitor; Arrangement_zone_2 - arr_zone (arr, &visitor); + arr_zone(arr, &visitor); - arr_zone.init (c, pl); + arr_zone.init(c, pl); arr_zone.compute_zone(); return (visitor.do_intersect()); @@ -1506,48 +1461,44 @@ bool do_intersect (Arrangement_on_surface_2& arr, // The last parameter should be boost::false_type but we used a // workaround since it didn't compile in FC3_g++-3.4.4 with the error of: // -// error: no matching function for call to `do_intersect(Arrangement_on_surface_2<>&, +// error: no matching function for call to +// `do_intersect(Arrangement_on_surface_2<>&, // const Arr_segment_2&, const Arr_walk_along_line_point_location<>&, mpl_::bool_< true>)' // -template -bool do_intersect (Arrangement_on_surface_2& arr, - const typename GeomTraits::X_monotone_curve_2& c, - const PointLocation& pl, boost::is_same::type) +template +bool do_intersect(Arrangement_on_surface_2& arr, + const typename GeomTraits::X_monotone_curve_2& c, + const PointLocation& pl, boost::is_same::type) { // Obtain an arrangement accessor. - typedef Arrangement_on_surface_2 + typedef Arrangement_on_surface_2 Arrangement_on_surface_2; // Break the input curve into x-monotone subcurves and isolated points. typedef Arr_traits_adaptor_2 Traits_adaptor_2; - const Traits_adaptor_2 * traits = + const Traits_adaptor_2* traits = static_cast (arr.geometry_traits()); - std::list x_objects; - std::list::const_iterator obj_iter; - const typename GeomTraits::X_monotone_curve_2 *x_curve; - const typename GeomTraits::Point_2 *iso_p; + std::list x_objects; + std::list::const_iterator obj_iter; + const typename GeomTraits::X_monotone_curve_2* x_curve; + const typename GeomTraits::Point_2* iso_p; - traits->make_x_monotone_2_object() (c, - std::back_inserter (x_objects)); + traits->make_x_monotone_2_object()(c, std::back_inserter(x_objects)); // Insert each x-monotone curve into the arrangement. - for (obj_iter = x_objects.begin(); obj_iter != x_objects.end(); ++obj_iter) - { + for (obj_iter = x_objects.begin(); obj_iter != x_objects.end(); ++obj_iter) { // Act according to the type of the current object. - x_curve = object_cast - (&(*obj_iter)); - if (x_curve != NULL) - { + x_curve = object_cast(&(*obj_iter)); + if (x_curve != NULL) { // Check if the x-monotone subcurve intersects the arrangement. if (do_intersect(arr, *x_curve, pl) == true) return true; } - else - { - iso_p = object_cast (&(*obj_iter)); - CGAL_assertion (iso_p != NULL); + else { + iso_p = object_cast(&(*obj_iter)); + CGAL_assertion(iso_p != NULL); // Check whether the isolated point lies inside a face (otherwise, // it conincides with a vertex or an edge). @@ -1559,19 +1510,20 @@ bool do_intersect (Arrangement_on_surface_2& arr, } // If we reached here, the curve does not intersect the arrangement. - return (false); + return false; } //----------------------------------------------------------------------------- // Common interface for the do_intersect of the Curve_2 and X_monotone_curve_2 -template +template bool do_intersect (Arrangement_on_surface_2& arr, const Curve& c, const PointLocation& pl) { typedef typename GeomTraits::X_monotone_curve_2 X_monotone_curve_2; typedef typename boost::is_same::type - Is_x_monotone; + Is_x_monotone; return do_intersect(arr, c, pl, Is_x_monotone()); } @@ -1580,19 +1532,18 @@ bool do_intersect (Arrangement_on_surface_2& arr, // Checks if the given curve intersects the existing arrangement. // Overloaded version with no point location object - the walk point-location // strategy is used as default. -template -bool do_intersect (Arrangement_on_surface_2& arr, - const Curve& c) +template +bool do_intersect(Arrangement_on_surface_2& arr, + const Curve& c) { // Create a default point-location object and use it to insert the curve. - typename TopTraits::Default_point_location_strategy def_pl (arr); + typename TopTraits::Default_point_location_strategy def_pl(arr); // check if the curve intersects the arrangement using the walk point // location. - return do_intersect (arr, c, def_pl); + return do_intersect(arr, c, def_pl); } - } //namespace CGAL #endif diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_rational_function_traits_2.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_rational_function_traits_2.cpp index c0f74174fb4..45e19e2b1f1 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_rational_function_traits_2.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_rational_function_traits_2.cpp @@ -18,7 +18,7 @@ int main() #include //Algebraic Kernel #include //Traits #include //Arrangement -#include +#include #include typedef CGAL::CORE_arithmetic_kernel::Integer Number_type; diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op.h index eb503c95bb6..23e198c9a24 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op.h @@ -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 // Ophir Setter @@ -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 #include -#include -#include +#include +#include #include #include //#include -#include +#include #include -#include +#include namespace CGAL { template -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 *> Arr_entry; - typedef Arr_construction_subcurve Subcurve; + typedef Arr_construction_subcurve Subcurve; typedef Arr_construction_event Sweep_line_2; + Event> Surface_sweep_2; - typedef Unique_hash_map Edges_hash; - typedef Unique_hash_map Faces_hash; typedef Bfs_visitor_ Bfs_visitor; typedef Gps_bfs_scanner 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 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); diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_sweep.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_sweep.h index 430697ded32..cecd2456936 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_sweep.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_sweep.h @@ -12,10 +12,6 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ $Date$ -// -// // Author(s) : Baruch Zukerman // Ron Wein @@ -25,42 +21,35 @@ #include -#include +#include #include namespace CGAL { -template class Gps_agg_op_sweep_line_2 : - public Sweep_line_2 + public Surface_sweep_2 { 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 *> Arr_entry; + std::vector *> Arr_entry; - typedef Sweep_line_2 Base; + typedef Surface_sweep_2 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 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 - void sweep (CurveInputIterator curves_begin, - CurveInputIterator curves_end, - unsigned int lower, - unsigned int upper, - unsigned int jump, - std::vector& arr_vec) + void sweep(CurveInputIterator curves_begin, + CurveInputIterator curves_end, + unsigned int lower, + unsigned int upper, + unsigned int jump, + std::vector& arr_vec) { - CGAL_assertion (this->m_queue->empty() && + CGAL_assertion (this->m_queue->empty() && this->m_statusLine.size() == 0); typedef Unique_hash_map 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(std::distance (curves_begin, curves_end)); + this->m_num_of_subCurves = + static_cast(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. diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h index 14839cd93b1..78be5b8ca14 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h @@ -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 // Ron Wein @@ -24,9 +20,8 @@ #include - -#include -#include +#include +#include #include #include #include @@ -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, Arr_unb_planar_construction_helper + 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, Arr_unb_planar_construction_helper + Subcurve> >::type Construction_helper; typedef Arr_construction_sl_visitor 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 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 Gps_agg_op_visitor : +class Gps_agg_op_visitor : public Gps_agg_op_base_visitor { 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)); diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_polygon_simplifier.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_polygon_simplifier.h index c62f4c077f2..f7fedc39fd2 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_polygon_simplifier.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_polygon_simplifier.h @@ -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 #ifndef CGAL_GPS_POLYGON_SIMPILFIER_H @@ -25,9 +21,9 @@ #include -#include -#include -#include +#include +#include +#include #include #include @@ -39,9 +35,8 @@ namespace CGAL { -template -class Gps_polygon_simplifier -{ +template +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 Sweep_line_2; + Event> Surface_sweep_2; typedef Unique_hash_map 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. */ diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_polygon_validation.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_polygon_validation.h index 337fb75abf4..4e1915c2a1f 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_polygon_validation.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_polygon_validation.h @@ -12,10 +12,6 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s): Baruch Zukerman // Ron Wein // Boris Kozorovitzky @@ -32,10 +28,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -44,7 +40,6 @@ #include #include - 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 Gps_polygon_validation_visitor : - public Sweep_line_empty_visitor + public Surface_sweep_empty_visitor { 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 Base; + typedef Surface_sweep_empty_visitor Base; typedef typename Base::Event Event; typedef typename Base::Subcurve Subcurve; typedef typename Base::Status_line_iterator SL_iterator; - typedef Basic_sweep_line_2 Sweep_line; + typedef Basic_sweep_line_2 Surface_sweep; public: enum Error_code { @@ -131,7 +127,7 @@ public: void sweep(XCurveIterator begin, XCurveIterator end) { //Perform the sweep - reinterpret_cast(this->m_sweep_line)->sweep(begin, end); + reinterpret_cast(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(this->m_sweep_line)->stop_sweep(); + reinterpret_cast(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(this->m_sweep_line)->stop_sweep(); + reinterpret_cast(this->m_sweep_line)->stop_sweep(); } else if (event->is_overlap()) { m_error_code = ERROR_EDGE_OVERLAP; m_is_valid = false; - reinterpret_cast(this->m_sweep_line)->stop_sweep(); + reinterpret_cast(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(this->m_sweep_line)->stop_sweep(); + reinterpret_cast(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 Visitor; - typedef Sweep_line_2 Sweep_line; + typedef Surface_sweep_2 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 Visitor; - typedef Sweep_line_2 Sweep_line; + typedef Surface_sweep_2 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 Visitor; - typedef Sweep_line_2 Sweep_line ; + typedef Surface_sweep_2 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; diff --git a/CGAL_ipelets/demo/CGAL_ipelets/arrangement.cpp b/CGAL_ipelets/demo/CGAL_ipelets/arrangement.cpp index 373571cbcd8..af096b872ea 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/arrangement.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/arrangement.cpp @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Sebastien Loriot, Sylvain Pion @@ -28,9 +28,9 @@ #endif #include #include -#include +#include #include -#include +#include namespace CGAL_argt{ @@ -43,7 +43,7 @@ typedef std::list Curve_list; typedef std::list 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{ 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 sg_list; std::list cir_list; std::list pol_list; std::list arc_list; - + read_active_objects( CGAL::dispatch_or_drop_output( std::back_inserter(pol_list), @@ -86,13 +86,13 @@ void ArrPolyIpelet::protected_run(int fn){ for (std::list::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::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::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::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())); diff --git a/Documentation/doc/Customizations.txt b/Documentation/doc/Customizations.txt index f348d3da698..7523551114f 100644 --- a/Documentation/doc/Customizations.txt +++ b/Documentation/doc/Customizations.txt @@ -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. - diff --git a/Documentation/doc/Documentation/dependencies b/Documentation/doc/Documentation/dependencies index 80888fecaa6..396a745bc44 100644 --- a/Documentation/doc/Documentation/dependencies +++ b/Documentation/doc/Documentation/dependencies @@ -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 - - - diff --git a/Documentation/doc/Documentation/packages.txt b/Documentation/doc/Documentation/packages.txt index dbca0235571..ed9ba303e74 100644 --- a/Documentation/doc/Documentation/packages.txt +++ b/Documentation/doc/Documentation/packages.txt @@ -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} diff --git a/Installation/cmake/modules/list_of_documented_headers.cmake b/Installation/cmake/modules/list_of_documented_headers.cmake index 260f173447c..177e9ac37a5 100644 --- a/Installation/cmake/modules/list_of_documented_headers.cmake +++ b/Installation/cmake/modules/list_of_documented_headers.cmake @@ -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 diff --git a/Installation/include/CGAL/license/Sweep_line_2.h b/Installation/include/CGAL/license/Surface_sweep_2.h similarity index 100% rename from Installation/include/CGAL/license/Sweep_line_2.h rename to Installation/include/CGAL/license/Surface_sweep_2.h diff --git a/Installation/include/CGAL/license/gpl_package_list.txt b/Installation/include/CGAL/license/gpl_package_list.txt index 550b4f3aad8..17be22ad793 100644 --- a/Installation/include/CGAL/license/gpl_package_list.txt +++ b/Installation/include/CGAL/license/gpl_package_list.txt @@ -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 diff --git a/Snap_rounding_2/doc/Snap_rounding_2/dependencies b/Snap_rounding_2/doc/Snap_rounding_2/dependencies index 1602b748d84..bf4cf65a566 100644 --- a/Snap_rounding_2/doc/Snap_rounding_2/dependencies +++ b/Snap_rounding_2/doc/Snap_rounding_2/dependencies @@ -5,5 +5,5 @@ Algebraic_foundations Circulator Stream_support Arrangement_on_surface_2 -Sweep_line_2 +Surface_sweep_2 Spatial_searching diff --git a/Snap_rounding_2/include/CGAL/Snap_rounding_2.h b/Snap_rounding_2/include/CGAL/Snap_rounding_2.h index 259e0477929..158b73b9676 100644 --- a/Snap_rounding_2/include/CGAL/Snap_rounding_2.h +++ b/Snap_rounding_2/include/CGAL/Snap_rounding_2.h @@ -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 + #ifndef CGAL_SNAP_ROUNDING_2_H #define CGAL_SNAP_ROUNDING_2_H @@ -28,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -77,7 +74,7 @@ private: typedef typename Traits::Segment_2 Segment_2; typedef typename Traits::Point_2 Point_2; typedef CGAL::Segment_data Segment_data; - + private: // p is the center of the hot pixel Point_2 p; @@ -155,7 +152,7 @@ private: typedef std::list Segment_data_list; typedef CGAL::Hot_pixel_dir_cmp Hot_pixel_dir_cmp; typedef std::set Hot_pixel_set; - + public: // friend class Segment_data; // friend class Hot_pixel; @@ -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::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::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::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::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::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::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::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::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::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 bool Hot_pixel_dir_cmp::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::iterator Segment_data_iter; typedef std::list Segment_list; typedef typename std::list::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::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_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::iterator Hot_pixel_iter; typedef typename std::list::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 Segment_data; typedef CGAL::Multiple_kd_tree Multiple_kd_tree; typedef std::list Segment_data_list; - + Segment_data_list seg_list; Multiple_kd_tree * mul_kd_tree = NULL; diff --git a/Sweep_line_2/doc/Sweep_line_2/CGAL/Sweep_line_2_algorithms.h b/Surface_sweep_2/doc/Surface_sweep_2/CGAL/Sweep_line_2_algorithms.h similarity index 100% rename from Sweep_line_2/doc/Sweep_line_2/CGAL/Sweep_line_2_algorithms.h rename to Surface_sweep_2/doc/Surface_sweep_2/CGAL/Sweep_line_2_algorithms.h diff --git a/Sweep_line_2/doc/Sweep_line_2/Doxyfile.in b/Surface_sweep_2/doc/Surface_sweep_2/Doxyfile.in similarity index 100% rename from Sweep_line_2/doc/Sweep_line_2/Doxyfile.in rename to Surface_sweep_2/doc/Surface_sweep_2/Doxyfile.in diff --git a/Sweep_line_2/doc/Sweep_line_2/PackageDescription.txt b/Surface_sweep_2/doc/Surface_sweep_2/PackageDescription.txt similarity index 100% rename from Sweep_line_2/doc/Sweep_line_2/PackageDescription.txt rename to Surface_sweep_2/doc/Surface_sweep_2/PackageDescription.txt diff --git a/Surface_sweep_2/doc/Surface_sweep_2/Surface_sweep_2.txt b/Surface_sweep_2/doc/Surface_sweep_2/Surface_sweep_2.txt new file mode 100644 index 00000000000..05eba3e9757 --- /dev/null +++ b/Surface_sweep_2/doc/Surface_sweep_2/Surface_sweep_2.txt @@ -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 event +points, such that we only have to calculate the intersection +points between two curves when they become contiguous. For more +details on the surface-sweep algorithm 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 */ diff --git a/Sweep_line_2/doc/Sweep_line_2/dependencies b/Surface_sweep_2/doc/Surface_sweep_2/dependencies similarity index 100% rename from Sweep_line_2/doc/Sweep_line_2/dependencies rename to Surface_sweep_2/doc/Surface_sweep_2/dependencies diff --git a/Surface_sweep_2/doc/Surface_sweep_2/examples.txt b/Surface_sweep_2/doc/Surface_sweep_2/examples.txt new file mode 100644 index 00000000000..50ffcc88b40 --- /dev/null +++ b/Surface_sweep_2/doc/Surface_sweep_2/examples.txt @@ -0,0 +1,3 @@ +/*! +\example Surface_sweep_2/plane_sweep.cpp +*/ diff --git a/Sweep_line_2/doc/Sweep_line_2/fig/Curve_intersections_2.png b/Surface_sweep_2/doc/Surface_sweep_2/fig/Curve_intersections_2.png similarity index 100% rename from Sweep_line_2/doc/Sweep_line_2/fig/Curve_intersections_2.png rename to Surface_sweep_2/doc/Surface_sweep_2/fig/Curve_intersections_2.png diff --git a/Sweep_line_2/doc/Sweep_line_2/fig/sl_simple.png b/Surface_sweep_2/doc/Surface_sweep_2/fig/sl_simple.png similarity index 100% rename from Sweep_line_2/doc/Sweep_line_2/fig/sl_simple.png rename to Surface_sweep_2/doc/Surface_sweep_2/fig/sl_simple.png diff --git a/Sweep_line_2/examples/Sweep_line_2/CMakeLists.txt b/Surface_sweep_2/examples/Surface_sweep_2/CMakeLists.txt similarity index 88% rename from Sweep_line_2/examples/Sweep_line_2/CMakeLists.txt rename to Surface_sweep_2/examples/Surface_sweep_2/CMakeLists.txt index f714e059cbd..24d70f04c08 100644 --- a/Sweep_line_2/examples/Sweep_line_2/CMakeLists.txt +++ b/Surface_sweep_2/examples/Surface_sweep_2/CMakeLists.txt @@ -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" ) diff --git a/Sweep_line_2/examples/Sweep_line_2/sweep_line.cpp b/Surface_sweep_2/examples/Surface_sweep_2/plane_sweep.cpp similarity index 55% rename from Sweep_line_2/examples/Sweep_line_2/sweep_line.cpp rename to Surface_sweep_2/examples/Surface_sweep_2/plane_sweep.cpp index 0ac42c7a646..f05246c2a31 100644 --- a/Sweep_line_2/examples/Sweep_line_2/sweep_line.cpp +++ b/Surface_sweep_2/examples/Surface_sweep_2/plane_sweep.cpp @@ -1,18 +1,16 @@ -//! \file examples/Arrangement_on_surface_2/sweep_line.cpp +//! \file examples/Arrangement_on_surface_2/plane_sweep.cpp // Computing intersection points among curves using the sweep line. -#include -#include -#include -#include -#include #include -typedef CGAL::Quotient NT; -typedef CGAL::Cartesian Kernel; -typedef Kernel::Point_2 Point_2; -typedef CGAL::Arr_segment_traits_2 Traits_2; -typedef Traits_2::Curve_2 Segment_2; +#include +#include +#include + +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; +typedef Kernel::Point_2 Point_2; +typedef CGAL::Arr_segment_traits_2 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 pts; - CGAL::compute_intersection_points (segments, segments + 4, - std::back_inserter (pts)); - + // Compute all intersection points. + std::list 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(std::cout, "\n")); // Compute the non-intersecting sub-segments induced by the input segments. - std::list sub_segs; + std::list 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; } diff --git a/Arrangement_on_surface_2/include/CGAL/Basic_sweep_line_2.h b/Surface_sweep_2/include/CGAL/No_intersection_surface_sweep_2.h similarity index 95% rename from Arrangement_on_surface_2/include/CGAL/Basic_sweep_line_2.h rename to Surface_sweep_2/include/CGAL/No_intersection_surface_sweep_2.h index e3653b882f7..9e80e70ee8d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Basic_sweep_line_2.h +++ b/Surface_sweep_2/include/CGAL/No_intersection_surface_sweep_2.h @@ -19,20 +19,18 @@ #ifndef CGAL_BASIC_SWEEP_LINE_2_H #define CGAL_BASIC_SWEEP_LINE_2_H -#include - - /*! \file - * Definition of the Basic_sweep_line_2 class. + * Definition of the No_intersection_surface_sweep_2 class. */ -// #include + #include +#include #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -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 Event_ = Sweep_line_event, + typename Subcurve_ = Surface_sweep_subcurve, + typename Event_ = Surface_sweep_event, 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 Base_event; + typedef Surface_sweep_event Base_event; typedef typename Base_event::Attribute Attribute; - typedef Sweep_line_subcurve Base_subcurve; + typedef Surface_sweep_subcurve Base_subcurve; typedef class Curve_comparer Compare_curves; typedef Multiset + #include #endif } //namespace CGAL -#include +#include #endif diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2.h similarity index 82% rename from Sweep_line_2/include/CGAL/Sweep_line_2.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2.h index 2408d387768..644c3e9965f 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2.h @@ -16,26 +16,27 @@ // Efi Fogel // (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 +#include /*! \file - * Definition of the Sweep_line_2 class. + * Definition of the Surface_sweep_2 class. */ #include + #include -#include -#include +#include +#include #include 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 Event_ = Sweep_line_event, + typename Subcurve_ = Surface_sweep_subcurve, + typename Event_ = Surface_sweep_event, typename Allocator_ = CGAL_ALLOCATOR(int) > -class Sweep_line_2 : - public Basic_sweep_line_2 +class Surface_sweep_2 : + public No_intersection_surface_sweep_2 { 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 - Base; + typedef No_intersection_surface_sweep_2 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 +#include #endif diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_sl_visitor.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_sl_visitor.h similarity index 98% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_sl_visitor.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_sl_visitor.h index f7b87273f64..0c63cf64c8f 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_sl_visitor.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_sl_visitor.h @@ -12,10 +12,6 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s) : Baruch Zukerman // Ron Wein // Efi Fogel @@ -23,7 +19,7 @@ #ifndef CGAL_ARR_BASIC_INSERTION_SL_VISITOR_H #define CGAL_ARR_BASIC_INSERTION_SL_VISITOR_H -#include +#include /*! @@ -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 +template 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 +template void Arr_basic_insertion_sl_visitor::before_sweep() { this->m_helper.before_sweep(); } @@ -226,7 +222,7 @@ void Arr_basic_insertion_sl_visitor::before_sweep() // A notification invoked before the sweep-line starts handling the given // event. // -template +template void Arr_basic_insertion_sl_visitor::before_handle_event(Event* event) { // First we notify the helper class on the event. @@ -248,7 +244,7 @@ void Arr_basic_insertion_sl_visitor::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::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::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((*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::before_handle_event(Event* event) //----------------------------------------------------------------------------- // A notification invoked when a new subcurve is created. // -template +template void Arr_basic_insertion_sl_visitor:: 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(); diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h similarity index 98% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h index 404e19f3e96..38aeab1ca34 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h @@ -12,10 +12,6 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s) : Baruch Zukerman // Ron Wein // Efi Fogel @@ -24,7 +20,7 @@ #ifndef CGAL_ARR_BASIC_INSERTION_TRAITS_2_H #define CGAL_ARR_BASIC_INSERTION_TRAITS_2_H -#include +#include /*! @@ -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 -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; - + 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; 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); diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_batched_pl_sl_visitor.h similarity index 89% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_batched_pl_sl_visitor.h index 0e01ddc3bd2..4657f46676d 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_batched_pl_sl_visitor.h @@ -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 // Ron Wein #ifndef CGAL_ARR_BATCHED_PL_SL_VISITOR_H #define CGAL_ARR_BATCHED_PL_SL_VISITOR_H -#include - +#include /*! * 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 +template 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 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 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::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 @@ -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; } diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_construction_event.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_construction_event.h similarity index 76% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Arr_construction_event.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_construction_event.h index ac025cee5f9..0c71f2e7c3d 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_construction_event.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_construction_event.h @@ -12,10 +12,6 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s) : Tali Zvi // Baruch Zukerman // Efi Fogel @@ -23,14 +19,14 @@ #ifndef CGAL_ARR_CONSTRUCTION_EVENT_H #define CGAL_ARR_CONSTRUCTION_EVENT_H -#include +#include /*! \file * Definition of the Arr_construction_event class-template. */ -#include +#include #include #include @@ -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 Arr_construction_event : - public Sweep_line_event + public Surface_sweep_event { 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 Base; + typedef Surface_sweep_event Base; - typedef Arr_construction_event Self; + typedef Arr_construction_event + 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 m_isCurveInArr; // Stores for each incident + std::vector 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 - add_curve_to_right (Subcurve *curve, - const Traits_2 * tr) + add_curve_to_right(Subcurve* curve, const Traits_2* tr) { std::pair 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 - 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 diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_construction_sl_visitor.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h similarity index 99% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Arr_construction_sl_visitor.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h index 935c6bb9476..eca90d732b2 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_construction_sl_visitor.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_construction_sl_visitor.h @@ -12,10 +12,6 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s) : Baruch Zukerman // Ron Wein // Efi Fogel @@ -23,7 +19,7 @@ #ifndef CGAL_ARR_CONSTRUCTION_SL_VISITOR_H #define CGAL_ARR_CONSTRUCTION_SL_VISITOR_H -#include +#include #ifndef CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_construction_subcurve.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_construction_subcurve.h similarity index 90% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Arr_construction_subcurve.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_construction_subcurve.h index aca9f3a5277..0cc3966349b 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_construction_subcurve.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_construction_subcurve.h @@ -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 // Baruch Zukerman #ifndef CGAL_ARR_CONSTRUCTION_SUBCURVE_H #define CGAL_ARR_CONSTRUCTION_SUBCURVE_H -#include +#include /*! \file * Definition of the Arr_construction_subcurve class-template. */ -#include +#include 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 -class Arr_construction_subcurve : public Sweep_line_subcurve +class Arr_construction_subcurve : public 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 Base; + typedef Surface_sweep_subcurve Base; typedef Arr_construction_subcurve Self; typedef typename Base::Status_line_iterator Status_line_iterator; @@ -136,4 +132,4 @@ public: } //namespace CGAL -#endif +#endif diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_default_overlay_traits_base.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_default_overlay_traits_base.h similarity index 98% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Arr_default_overlay_traits_base.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_default_overlay_traits_base.h index 644cb78bd26..3ca1f4d1b07 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_default_overlay_traits_base.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_default_overlay_traits_base.h @@ -12,10 +12,6 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s) : Ron Wein // Baruch Zukerman @@ -26,8 +22,7 @@ #ifndef CGAL_ARR_DEFAULT_OVERLAY_TRAITS_BASE_H #define CGAL_ARR_DEFAULT_OVERLAY_TRAITS_BASE_H -#include - +#include 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. */ diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_insertion_sl_visitor.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_insertion_sl_visitor.h similarity index 91% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Arr_insertion_sl_visitor.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_insertion_sl_visitor.h index 74fb9ebd3b9..3186fb6ed9f 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_insertion_sl_visitor.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_insertion_sl_visitor.h @@ -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 // Ron Wein // Efi Fogel @@ -22,14 +19,14 @@ #ifndef CGAL_ARR_INSERTION_SL_VISITOR_H #define CGAL_ARR_INSERTION_SL_VISITOR_H -#include +#include /*! * Definition of the Arr_insertion_sl_visitor class-template. */ -#include +#include 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 -class Arr_insertion_sl_visitor : +template +class Arr_insertion_sl_visitor : public Arr_basic_insertion_sl_visitor { public: typedef Helper_ Helper; - + typedef Arr_basic_insertion_sl_visitor 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 +template bool Arr_insertion_sl_visitor::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(sc->left_event()) != + return (reinterpret_cast(sc->left_event()) != this->current_event()); } return (this->is_split_event - (reinterpret_cast(sc->originating_subcurve1()), event) || + (reinterpret_cast(sc->originating_subcurve1()), event) || this->is_split_event (reinterpret_cast(sc->originating_subcurve2()), event)); } @@ -120,12 +117,12 @@ Arr_insertion_sl_visitor::split_edge(Halfedge_handle he, Subcurve* sc, const Point_2& pt) { // Make sure that the halfedge associated with sc is the directed from - // right to left, since we always "look" above , and the incident face + // 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(sc->last_event()); diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_insertion_traits_2.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_insertion_traits_2.h similarity index 75% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Arr_insertion_traits_2.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_insertion_traits_2.h index e8b16b382a0..8d496211097 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_insertion_traits_2.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_insertion_traits_2.h @@ -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 // Efi Fogel #ifndef CGAL_ARR_INSERTION_TRAITS_2_H #define CGAL_ARR_INSERTION_TRAITS_2_H -#include +#include /*! * Defintion of the Arr_insertion_traits_2 class. */ -#include +#include namespace CGAL { @@ -39,11 +35,10 @@ namespace CGAL { * speed up the aggregated insertion process. */ template -class Arr_insertion_traits_2 : +class Arr_insertion_traits_2 : public Arr_basic_insertion_traits_2 { public: - typedef Traits_ Traits_2; typedef Arr_basic_insertion_traits_2 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; - + public: template - 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 *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* 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 (&(*oi)); - if (base_overlap_cv != NULL) - { + // X_monotone_curve_2 + for(; oi != oi_end; ++oi) { + base_overlap_cv = object_cast(&(*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 > (&(*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; - + 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 diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_overlay_sl_visitor.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_overlay_sl_visitor.h similarity index 99% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Arr_overlay_sl_visitor.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_overlay_sl_visitor.h index 54c052bb04d..bdda3e22d2d 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_overlay_sl_visitor.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_overlay_sl_visitor.h @@ -12,10 +12,6 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s) : Baruch Zukerman // Ron Wein // Efi Fogel @@ -23,7 +19,7 @@ #ifndef CGAL_ARR_OVERLAY_SL_VISITOR_H #define CGAL_ARR_OVERLAY_SL_VISITOR_H -#include +#include /*! \file @@ -36,7 +32,7 @@ #include #include -#include +#include #include namespace CGAL { diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_overlay_subcurve.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_overlay_subcurve.h similarity index 95% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Arr_overlay_subcurve.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_overlay_subcurve.h index fb68459d574..5e76243e6ce 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_overlay_subcurve.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_overlay_subcurve.h @@ -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 // Ron Wein #ifndef CGAL_OVERLAY_SUBCURVE_H #define CGAL_OVERLAY_SUBCURVE_H -#include +#include /*! \file * Definition of the Arr_overlay_subcurve class-template. */ -#include +#include 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 Event; + typedef Surface_sweep_event 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 diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_overlay_traits_2.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_overlay_traits_2.h similarity index 97% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Arr_overlay_traits_2.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_overlay_traits_2.h index f1a2eef2570..c1a8a0ffccb 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_overlay_traits_2.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_overlay_traits_2.h @@ -12,10 +12,6 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s) : Baruch Zukerman // Ron Wein // Efi Fogel @@ -23,7 +19,7 @@ #ifndef CGAL_ARR_OVERLAY_TRAITS_2_H #define CGAL_ARR_OVERLAY_TRAITS_2_H -#include +#include /*! @@ -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 Cell_handle_blue; typedef boost::optional Optional_cell_blue; - + template 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 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; - + public: template 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 >(&(*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; - + 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; - + 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; - + 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; - + 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; - + 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; - + 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; - + 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; - + 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; - + 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; - + 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; - + 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; - + 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; - + 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; - + 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; - + 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; - + 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; - + 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; - + 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; - + public: Comparison_result operator()(const X_monotone_curve_2& xcv1, const X_monotone_curve_2& xcv2, diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_vert_decomp_sl_visitor.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_vert_decomp_sl_visitor.h similarity index 75% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Arr_vert_decomp_sl_visitor.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_vert_decomp_sl_visitor.h index 419b1cfb2fa..4ff29d17ad6 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Arr_vert_decomp_sl_visitor.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Arr_vert_decomp_sl_visitor.h @@ -12,16 +12,12 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s) : Ron Wein #ifndef CGAL_ARR_VERT_DECOMP_SL_VISITOR_H #define CGAL_ARR_VERT_DECOMP_SL_VISITOR_H -#include +#include /*! @@ -36,12 +32,9 @@ namespace CGAL { * A sweep-line visitor for performing vertical decomposition on an * arrangement embedded on a surface. */ -template -class Arr_vert_decomp_sl_visitor : - public Helper_::Base_visitor -{ +template +class Arr_vert_decomp_sl_visitor : public Helper_::Base_visitor { public: - typedef Helper_ Helper; typedef OutputIterator_ OutputIterator; @@ -57,7 +50,6 @@ public: typedef std::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 -void Arr_vert_decomp_sl_visitor::before_sweep () +template +void Arr_vert_decomp_sl_visitor::before_sweep() { // Notify the helper that the sweep process now starts. m_helper.before_sweep(); // Set an invalid previous vertex. m_prev_vh = Vertex_const_handle(); - - return; } //----------------------------------------------------------------------------- @@ -139,31 +128,28 @@ void Arr_vert_decomp_sl_visitor::before_sweep () // event. // template -bool Arr_vert_decomp_sl_visitor::after_handle_event - (Event* event, - Status_line_iterator above, bool /* on_above */) +bool Arr_vert_decomp_sl_visitor:: +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::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::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::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::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::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 -void Arr_vert_decomp_sl_visitor::after_sweep () +template +void Arr_vert_decomp_sl_visitor::after_sweep() { // Create an entry for the last vertex (the xy-largest one). - if (m_prev_vh != invalid_vh) - { + 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 diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_intersection_surface_sweep_2_impl.h similarity index 92% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/No_intersection_surface_sweep_2_impl.h index 7e9b92520f2..ff85580c297 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_intersection_surface_sweep_2_impl.h @@ -17,14 +17,13 @@ // Eric Berberich // (based on old version by Tali Zvi) -#ifndef CGAL_BASIC_SWEEP_LINE_2_IMPL_H -#define CGAL_BASIC_SWEEP_LINE_2_IMPL_H - -#include +#ifndef CGAL_NO_INTERSECTION_SURFACE_SWEEP_2_IMPL_H +#define CGAL_NO_INTERSECTION_SURFACE_SWEEP_2_IMPL_H +#include /*! \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 -Basic_sweep_line_2:: -Basic_sweep_line_2(Visitor* visitor) : +No_intersection_surface_sweep_2:: +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 -Basic_sweep_line_2:: -Basic_sweep_line_2(const Traits_2* traits, Visitor* visitor) : +No_intersection_surface_sweep_2:: +No_intersection_surface_sweep_2(const Traits_2* traits, Visitor* visitor) : m_traits(static_cast(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 -Basic_sweep_line_2::~Basic_sweep_line_2() +No_intersection_surface_sweep_2::~No_intersection_surface_sweep_2() { // Free the traits-class object, if we own it. if (m_traitsOwner) delete m_traits; @@ -101,7 +100,7 @@ Basic_sweep_line_2::~Basic_sweep_line_2() // template -void Basic_sweep_line_2::stop_sweep() +void No_intersection_surface_sweep_2::stop_sweep() { // Clear the event queue, deallocating all events but the current one // (the first event in the queue). @@ -131,7 +130,7 @@ void Basic_sweep_line_2::stop_sweep() // template -void Basic_sweep_line_2:: +void No_intersection_surface_sweep_2:: deallocate_event(Event* event) { // Remove the event from the set of allocated events. @@ -147,7 +146,7 @@ deallocate_event(Event* event) // template -void Basic_sweep_line_2::_sweep() +void No_intersection_surface_sweep_2::_sweep() { CGAL_SL_PRINT_TEXT("Ordered sequence of "); CGAL_SL_PRINT(m_queue->size()); @@ -208,7 +207,7 @@ void Basic_sweep_line_2::_sweep() // template -void Basic_sweep_line_2::_init_structures() +void No_intersection_surface_sweep_2::_init_structures() { CGAL_assertion(m_queue->empty()); CGAL_assertion((m_statusLine.size() == 0)); @@ -224,7 +223,7 @@ void Basic_sweep_line_2::_init_structures() // template -void Basic_sweep_line_2::_complete_sweep() +void No_intersection_surface_sweep_2::_complete_sweep() { CGAL_assertion(m_queue->empty()); CGAL_assertion((m_statusLine.size() == 0)); @@ -242,7 +241,7 @@ void Basic_sweep_line_2::_complete_sweep() // template -void Basic_sweep_line_2:: +void No_intersection_surface_sweep_2:: _init_point(const Point_2& pt, Attribute type) { // Create the event, or obtain an existing event in the queue. @@ -259,7 +258,7 @@ _init_point(const Point_2& pt, Attribute type) // template -void Basic_sweep_line_2:: +void No_intersection_surface_sweep_2:: _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 -void Basic_sweep_line_2:: +void No_intersection_surface_sweep_2:: _init_curve_end(const X_monotone_curve_2& cv, Arr_curve_end ind, Subcurve* sc) { // Get the boundary conditions of the curve end. @@ -321,7 +320,7 @@ _init_curve_end(const X_monotone_curve_2& cv, Arr_curve_end ind, Subcurve* sc) // template -void Basic_sweep_line_2::_handle_left_curves() +void No_intersection_surface_sweep_2::_handle_left_curves() { CGAL_SL_PRINT_START_EOL("handling left curves at ("); CGAL_SL_DEBUG(PrintEvent(m_currentEvent)); @@ -398,7 +397,7 @@ void Basic_sweep_line_2::_handle_left_curves() // template -void Basic_sweep_line_2:: +void No_intersection_surface_sweep_2:: _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 -void Basic_sweep_line_2::_sort_left_curves() +void No_intersection_surface_sweep_2::_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::_sort_left_curves() // template -void Basic_sweep_line_2::_handle_right_curves() +void No_intersection_surface_sweep_2::_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::_handle_right_curves() // template -bool Basic_sweep_line_2:: +bool No_intersection_surface_sweep_2:: _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 -void Basic_sweep_line_2:: +void No_intersection_surface_sweep_2:: _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 Basic_sweep_line_2::Event* -Basic_sweep_line_2:: +typename No_intersection_surface_sweep_2::Event* +No_intersection_surface_sweep_2:: _allocate_event(const Point_2& pt, Attribute type, Arr_parameter_space ps_x, Arr_parameter_space ps_y) { @@ -621,8 +620,8 @@ _allocate_event(const Point_2& pt, Attribute type, // template -typename Basic_sweep_line_2::Event* -Basic_sweep_line_2:: +typename No_intersection_surface_sweep_2::Event* +No_intersection_surface_sweep_2:: _allocate_event_at_open_boundary(Attribute type, Arr_parameter_space ps_x, Arr_parameter_space ps_y) @@ -640,9 +639,9 @@ _allocate_event_at_open_boundary(Attribute type, // template -std::pair::Event*, +std::pair::Event*, bool> -Basic_sweep_line_2:: +No_intersection_surface_sweep_2:: _push_event(const Point_2& pt, Attribute type, Arr_parameter_space ps_x, Arr_parameter_space ps_y, Subcurve* sc) { @@ -704,9 +703,9 @@ _push_event(const Point_2& pt, Attribute type, // template -std::pair::Event*, +std::pair::Event*, bool> -Basic_sweep_line_2:: +No_intersection_surface_sweep_2:: _push_event(const X_monotone_curve_2& cv, Arr_curve_end ind, Attribute type, Arr_parameter_space ps_x, Arr_parameter_space ps_y, Subcurve* sc) { diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_2_debug.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_debug.h similarity index 81% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_2_debug.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_debug.h index e6db77b0d7a..cee72ac7792 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_2_debug.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_debug.h @@ -15,13 +15,12 @@ // Author(s) : Baruch Zukerman // Efi Fogel -#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 +#include - -#include +#include //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// @@ -30,7 +29,7 @@ //////////////////////////////////////////////////////////////////////////// template -void Basic_sweep_line_2:: +void No_intersection_surface_sweep_2:: 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 -void Basic_sweep_line_2::print_eol() +void No_intersection_surface_sweep_2::print_eol() { std::cout << std::endl; m_need_indent = true; @@ -50,17 +49,19 @@ void Basic_sweep_line_2::print_eol() template -void Basic_sweep_line_2::increase_indent() +void No_intersection_surface_sweep_2:: +increase_indent() { m_indent_size += 2; } template -void Basic_sweep_line_2::decrease_indent() +void No_intersection_surface_sweep_2:: +decrease_indent() { m_indent_size -= 2; } template -void Basic_sweep_line_2:: +void No_intersection_surface_sweep_2:: print_start(const char* name, bool do_eol) { print_text("Start "); @@ -71,7 +72,7 @@ print_start(const char* name, bool do_eol) template -void Basic_sweep_line_2:: +void No_intersection_surface_sweep_2:: print_end(const char* name, bool do_eol) { decrease_indent(); @@ -82,7 +83,7 @@ print_end(const char* name, bool do_eol) template -void Basic_sweep_line_2:: +void No_intersection_surface_sweep_2:: print_curve(const Base_subcurve* sc) { if (m_need_indent) @@ -93,7 +94,8 @@ print_curve(const Base_subcurve* sc) template -void Basic_sweep_line_2::PrintEventQueue() +void No_intersection_surface_sweep_2:: +PrintEventQueue() { print_text("Event queue: ", true); Event_queue_iterator iter = m_queue->begin(); @@ -106,7 +108,8 @@ void Basic_sweep_line_2::PrintEventQueue() template -void Basic_sweep_line_2::PrintSubCurves() +void No_intersection_surface_sweep_2:: +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::PrintSubCurves() template -void Basic_sweep_line_2::PrintStatusLine() +void No_intersection_surface_sweep_2:: +PrintStatusLine() { if (m_statusLine.size() == 0) { print_text("Status line: empty", true); @@ -144,8 +148,8 @@ void Basic_sweep_line_2::PrintStatusLine() template -void Basic_sweep_line_2:: -PrintOpenBoundaryType (Arr_parameter_space ps_x, Arr_parameter_space ps_y) +void No_intersection_surface_sweep_2:: +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 -void Basic_sweep_line_2:: +void No_intersection_surface_sweep_2:: PrintEvent(const Event* e) { if (e->is_closed()) std::cout << e->point(); @@ -178,7 +182,7 @@ PrintEvent(const Event* e) template -void Basic_sweep_line_2:: +void No_intersection_surface_sweep_2:: print_event_info(const Event* e) { print_text("Event Info: "); diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h similarity index 97% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h index 460316a29f8..c016b504391 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h @@ -16,14 +16,14 @@ // Efi Fogel // (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 +#include /*! \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 -void Sweep_line_2::_init_structures() +void Surface_sweep_2::_init_structures() { // Initailize the structures maintained by the base sweep-line class. Base::_init_structures(); @@ -47,7 +47,7 @@ void Sweep_line_2::_init_structures() // template -void Sweep_line_2::_complete_sweep() +void Surface_sweep_2::_complete_sweep() { CGAL_SL_PRINT_START_EOL("completing the sweep"); @@ -76,7 +76,7 @@ void Sweep_line_2::_complete_sweep() // template -void Sweep_line_2::_handle_left_curves() +void Surface_sweep_2::_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::_handle_left_curves() // template -void Sweep_line_2::_handle_right_curves() +void Surface_sweep_2::_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::_handle_right_curves() // template -bool Sweep_line_2:: +bool Surface_sweep_2:: _add_curve_to_right(Event* event, Subcurve* curve, bool overlap_exist) { CGAL_SL_PRINT_START("adding a Curve to the right of ("); @@ -365,7 +365,7 @@ _add_curve_to_right(Event* event, Subcurve* curve, bool overlap_exist) // template -void Sweep_line_2:: +void Surface_sweep_2:: _remove_curve_from_status_line(Subcurve* leftCurve, bool remove_for_good) { CGAL_SL_PRINT_START("removing a curve from the status line, "); @@ -412,7 +412,7 @@ _remove_curve_from_status_line(Subcurve* leftCurve, bool remove_for_good) // template -void Sweep_line_2::_intersect(Subcurve* c1, +void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2) { CGAL_SL_PRINT_START("computing intersection of "); @@ -585,7 +585,7 @@ void Sweep_line_2::_intersect(Subcurve* c1, // template -void Sweep_line_2:: +void Surface_sweep_2:: _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 -void Sweep_line_2::_fix_overlap_subcurves() +void Surface_sweep_2::_fix_overlap_subcurves() { CGAL_SL_PRINT_START_EOL("fixing overlap subcurves"); @@ -729,7 +729,7 @@ void Sweep_line_2::_fix_overlap_subcurves() */ template -void Sweep_line_2:: +void Surface_sweep_2:: _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 -void Sweep_line_2:: +void Surface_sweep_2:: _fix_finished_overlap_subcurve(Subcurve* sc) { CGAL_SL_PRINT_START("fixing finished overlap subcurve "); diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_2_utils.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_utils.h similarity index 91% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_2_utils.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_utils.h index 9a72e6954b7..af004cb9430 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_2_utils.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_utils.h @@ -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 // Ron Wein // Efi Fogel -#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 +#include /*! \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 +template 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 (&(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 +template 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(); diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_2_visitors.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_visitors.h similarity index 70% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_2_visitors.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_visitors.h index 228be5480df..075a6f6e981 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_2_visitors.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_visitors.h @@ -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 // Ron Wein -#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 +#include /*! \file @@ -30,10 +26,10 @@ * sweep-line functions. */ -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -44,49 +40,50 @@ namespace CGAL { * set of input curves. */ template -class Sweep_line_points_visitor : - public Sweep_line_empty_visitor +class Surface_sweep_points_visitor : + public Surface_sweep_empty_visitor { - typedef Traits_ Traits_2; - typedef OutputIerator_ Output_ierator; - typedef Sweep_line_points_visitor Self; + typedef Traits_ Traits_2; + typedef OutputIerator_ Output_ierator; + typedef Surface_sweep_points_visitor Self; - typedef Sweep_line_empty_visitor Base; + typedef Surface_sweep_empty_visitor 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 Sweep_line_2; + typedef CGAL::Surface_sweep_2 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 + template void sweep(CurveIterator begin, CurveIterator end) { std::vector curves_vec; - std::vector points_vec; + std::vector 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(this->sweep_line()); + Surface_sweep_2* sl = + reinterpret_cast(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 Sweep_line_subcurves_visitor : - public Sweep_line_empty_visitor +template +class Surface_sweep_subcurves_visitor : + public Surface_sweep_empty_visitor { - typedef Traits_ Traits_2; - typedef OutputIerator_ Output_ierator; - typedef Sweep_line_subcurves_visitor Self; + typedef Traits_ Traits_2; + typedef OutputIerator_ Output_ierator; + typedef Surface_sweep_subcurves_visitor 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 Base; + typedef Surface_sweep_empty_visitor 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 Sweep_line_2; + typedef CGAL::Surface_sweep_2 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 + template void sweep(CurveIterator begin, CurveIterator end) { - std::vector curves_vec; - std::vector points_vec; + std::vector curves_vec; + std::vector 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(this->sweep_line()); + Surface_sweep_2* sl = + reinterpret_cast(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 Sweep_line_do_curves_x_visitor : - public Sweep_line_empty_visitor +template +class Surface_sweep_do_curves_x_visitor : + public Surface_sweep_empty_visitor { typedef Traits_ Traits_2; - typedef Sweep_line_do_curves_x_visitor Self; + typedef Surface_sweep_do_curves_x_visitor 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 Base; + typedef Surface_sweep_empty_visitor 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 Sweep_line_2; + typedef CGAL::Surface_sweep_2 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 + template void sweep(CurveIterator begin, CurveIterator end) { std::vector 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(this->sweep_line()); + Surface_sweep_2* sl = + reinterpret_cast(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 + template void sweep_xcurves(XCurveIterator begin, XCurveIterator end) { // Perform the sweep. - Sweep_line_2* sl = reinterpret_cast(this->sweep_line()); + Surface_sweep_2* sl = + reinterpret_cast(this->surface_sweep()); sl->sweep(begin, end); } @@ -275,7 +273,8 @@ public: bool /* flag */) { if (m_found_x) { - Sweep_line_2* sl = reinterpret_cast(this->sweep_line()); + Surface_sweep_2* sl = + reinterpret_cast(this->surface_sweep()); sl->stop_sweep(); } return true; diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_curve_pair.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_curve_pair.h similarity index 61% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_curve_pair.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_curve_pair.h index a3442a78ddf..ef66f24443a 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_curve_pair.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_curve_pair.h @@ -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 // Ron Wein -#ifndef CGAL_SWEEP_LINE_CURVE_PAIR_H -#define CGAL_SWEEP_LINE_CURVE_PAIR_H - -#include +#ifndef CGAL_SURFACE_SWEEP_CURVE_PAIR_H +#define CGAL_SURFACE_SWEEP_CURVE_PAIR_H +#include /*! \file * Definition of the Curve_pair class and related functors. @@ -34,63 +29,47 @@ namespace CGAL { /*! \class * A pair of subcurves. */ -template -class Curve_pair -{ +template +class Curve_pair { public: - - typedef Subcurve_ Subcurve; + typedef Subcurve_ Subcurve; private: - // Data members: - std::pair m_pair; + std::pair 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 -struct Less_curve_pair -{ +template +struct Less_curve_pair { typedef Subcurve_ Subcurve; - typedef class Curve_pair Curve_pair; + typedef class Curve_pair 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 -struct Curve_pair_hasher -{ - typedef Subcurve_ Subcurve; - typedef class Curve_pair Curve_pair; +template +struct Curve_pair_hasher { + typedef Subcurve_ Subcurve; + typedef class Curve_pair 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 (pair.first()); - const size_t val2 = reinterpret_cast (pair.second()); + const size_t half_n_bits = sizeof(size_t) * 8 / 2; + const size_t val1 = reinterpret_cast (pair.first()); + const size_t val2 = reinterpret_cast (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 -struct Equal_curve_pair -{ +template +struct Equal_curve_pair { typedef Subcurve_ Subcurve; - typedef class Curve_pair Curve_pair; + typedef class Curve_pair 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 random_access_input_iterator -{ +template +class random_access_input_iterator { public: - typedef Container_ Container; typedef typename Container::value_type value_type; typedef random_access_input_iterator 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); diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_event.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_event.h similarity index 92% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_event.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_event.h index eaaa1fbc085..2a07f99d2d1 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_event.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_event.h @@ -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 , +// Author(s) : Tali Zvi , // Baruch Zukerman -// Ron Wein -// Efi Fogel - -#ifndef CGAL_SWEEP_LINE_EVENT_H -#define CGAL_SWEEP_LINE_EVENT_H - -#include +// Ron Wein +// Efi Fogel +#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 + #include -#include - 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 -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::Category Left_side_category; typedef typename internal::Arr_complete_bottom_side_category::Category @@ -107,7 +103,7 @@ protected: public: /*! Default constructor. */ - Sweep_line_event() : + Surface_sweep_event() : m_type(0), m_ps_x(static_cast(ARR_INTERIOR)), m_ps_y(static_cast(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 - void Sweep_line_event::Print() + void Surface_sweep_event::Print() { std::cout << "\tEvent info: " << "\n" ; if (this->is_closed()) diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_functors.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_functors.h similarity index 70% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_functors.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_functors.h index 4c7f6599237..bd5ac48ad10 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_functors.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_functors.h @@ -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 // Baruch Zukerman // Ron Wein // Efi Fogel -#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 +#include /*! \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 Compare_events -{ +template +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 Sweep_line_event; +template 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 Curve_comparer -{ +template +class Curve_comparer { public: - typedef Traits_ Traits_2; typedef Subcurve_ Subcurve; typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; typedef typename Traits_adaptor_2::Point_2 Point_2; typedef typename Traits_adaptor_2::X_monotone_curve_2 X_monotone_curve_2; - typedef Sweep_line_event Event; + typedef Surface_sweep_event 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 - Curve_comparer (const Traits_adaptor_2 * t, Sweep_event** e_ptr) : + template + Curve_comparer (const Traits_adaptor_2* t, Sweep_event** e_ptr) : m_traits(t), m_curr_event(reinterpret_cast(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())); } }; diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_subcurve.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_subcurve.h similarity index 92% rename from Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_subcurve.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_subcurve.h index dd31aa4636e..2e0bcbfa6ed 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2/Sweep_line_subcurve.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_subcurve.h @@ -17,24 +17,23 @@ // Ron Wein // Efi Fogel -#ifndef CGAL_SWEEP_LINE_SUBCURVE_H -#define CGAL_SWEEP_LINE_SUBCURVE_H - -#include +#ifndef CGAL_SURFACE_SWEEP_SUBCURVE_H +#define CGAL_SURFACE_SWEEP_SUBCURVE_H +#include /*! \file - * Defintion of the Sweep_line_subcurve class. + * Defintion of the Surface_sweep_subcurve class. */ -#include -#include +#include +#include #include #include 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 -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 Self; + typedef Surface_sweep_subcurve Self; typedef Curve_comparer Compare_curves; typedef Multiset Status_line; typedef typename Status_line::iterator Status_line_iterator; - typedef Sweep_line_event Event; + typedef Surface_sweep_event 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 my_leaves; std::list other_leaves; @@ -257,7 +256,7 @@ public: #ifdef CGAL_SL_VERBOSE template - void Sweep_line_subcurve::Print() const + void Surface_sweep_subcurve::Print() const { std::cout << "Curve " << this << " (" << m_lastCurve << ") " diff --git a/Sweep_line_2/include/CGAL/Sweep_line_2_algorithms.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2_algorithms.h similarity index 69% rename from Sweep_line_2/include/CGAL/Sweep_line_2_algorithms.h rename to Surface_sweep_2/include/CGAL/Surface_sweep_2_algorithms.h index 337dcc188be..04c08135f82 100644 --- a/Sweep_line_2/include/CGAL/Sweep_line_2_algorithms.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2_algorithms.h @@ -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 // Efi Fogel // (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 +#include /*! - * \file Definition of the sweep-line related functions. + * \file Definition of the surface-sweep related functions. */ -#include -#include +#include +#include #include #include @@ -99,9 +95,8 @@ struct Default_arr_traits > typedef CGAL::Arr_linear_traits_2 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 > * \pre The value-type of CurveInputIterator is Traits::Curve_2, and the * value-type of OutputIterator is Traits::Point_2. */ -template -OutputIterator compute_intersection_points (CurveInputIterator curves_begin, - CurveInputIterator curves_end, - OutputIterator points, - bool report_endpoints, - Traits &tr) +template +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 Visitor; - typedef Sweep_line_2< Traits, - Sweep_line_points_visitor > - Sweep_line; + // Define the surface-sweep types: + typedef Surface_sweep_points_visitor Visitor; + typedef Surface_sweep_2< Traits, + Surface_sweep_points_visitor > + 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 +template 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 +template 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 Visitor; - typedef Sweep_line_2 > - Sweep_line; + // Define the surface-sweep types: + typedef Surface_sweep_subcurves_visitor Visitor; + typedef Surface_sweep_2 > + 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 -OutputIterator compute_subcurves (CurveInputIterator curves_begin, - CurveInputIterator curves_end, - OutputIterator subcurves, - bool mult_overlaps = false) +template +OutputIterator compute_subcurves(CurveInputIterator curves_begin, + CurveInputIterator curves_end, + OutputIterator subcurves, + bool mult_overlaps = false) { typedef typename std::iterator_traits::value_type Curve; typename Default_arr_traits::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 -bool do_curves_intersect (CurveInputIterator curves_begin, - CurveInputIterator curves_end, Traits &tr) +template +bool do_curves_intersect(CurveInputIterator curves_begin, + CurveInputIterator curves_end, Traits &tr) { - // Define the sweep-line types: - typedef Sweep_line_do_curves_x_visitor Visitor; - typedef Sweep_line_2 > - Sweep_line; + // Define the surface-sweep types: + typedef Surface_sweep_do_curves_x_visitor Visitor; + typedef Surface_sweep_2 > + 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 +template bool do_curves_intersect (CurveInputIterator curves_begin, CurveInputIterator curves_end) { diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_empty_visitor.h b/Surface_sweep_2/include/CGAL/Surface_sweep_empty_visitor.h new file mode 100644 index 00000000000..6992d366055 --- /dev/null +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_empty_visitor.h @@ -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 + +#ifndef CGAL_SURFACE_SWEEP_EMPTY_VISITOR_H +#define CGAL_SURFACE_SWEEP_EMPTY_VISITOR_H + +#include + +/*! \file + * Definition of the Surface_sweep_empty_visitor class-template. + */ + +#include +#include +#include + +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 Event_ = Surface_sweep_event, + 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 + Self; + +private: + // we want to hide the Surface_sweep type + typedef No_intersection_surface_sweep_2 Surface_sweep; + + typedef typename Surface_sweep::Status_line_iterator Base_status_line_iter; + +public: + /*! \class + * A wrapper for the base status-line iterator. + */ + class Status_line_iterator : public Base_status_line_iter { + public: + typedef Subcurve* value_type; + typedef value_type& reference; + typedef value_type* pointer; + typedef typename Base_status_line_iter::difference_type difference_type; + typedef typename Base_status_line_iter::iterator_category + iterator_category; + /*! Constructor. */ + Status_line_iterator() {} + + /*! Constructor from a base iterator. */ + Status_line_iterator(Base_status_line_iter iter) : + Base_status_line_iter(iter) + {} + + // Overriden operator* + reference operator*() + { + return (reinterpret_cast + (((Base_status_line_iter*)this)->operator*())); + } + + // Overriden operator-> + pointer operator->() + { + return (reinterpret_cast(Base_status_line_iter::operator->())); + } + }; + + typedef typename Event::Subcurve_iterator Event_subcurve_iterator; + typedef typename Event::Subcurve_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(m_surface_sweep)); } + + const Surface_sweep* _surface_sweep() const + { return (reinterpret_cast(m_surface_sweep)); } +}; + +} //namespace CGAL + +#endif diff --git a/Sweep_line_2/package_info/Sweep_line_2/copyright b/Surface_sweep_2/package_info/Surface_sweep_2/copyright similarity index 100% rename from Sweep_line_2/package_info/Sweep_line_2/copyright rename to Surface_sweep_2/package_info/Surface_sweep_2/copyright diff --git a/Sweep_line_2/package_info/Sweep_line_2/description.txt b/Surface_sweep_2/package_info/Surface_sweep_2/description.txt similarity index 100% rename from Sweep_line_2/package_info/Sweep_line_2/description.txt rename to Surface_sweep_2/package_info/Surface_sweep_2/description.txt diff --git a/Sweep_line_2/package_info/Sweep_line_2/license.txt b/Surface_sweep_2/package_info/Surface_sweep_2/license.txt similarity index 100% rename from Sweep_line_2/package_info/Sweep_line_2/license.txt rename to Surface_sweep_2/package_info/Surface_sweep_2/license.txt diff --git a/Surface_sweep_2/package_info/Surface_sweep_2/long_description.txt b/Surface_sweep_2/package_info/Surface_sweep_2/long_description.txt new file mode 100644 index 00000000000..4cd1b445bcd --- /dev/null +++ b/Surface_sweep_2/package_info/Surface_sweep_2/long_description.txt @@ -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. diff --git a/Sweep_line_2/package_info/Sweep_line_2/maintainer b/Surface_sweep_2/package_info/Surface_sweep_2/maintainer similarity index 100% rename from Sweep_line_2/package_info/Sweep_line_2/maintainer rename to Surface_sweep_2/package_info/Surface_sweep_2/maintainer diff --git a/Sweep_line_2/test/Sweep_line_2/CMakeLists.txt b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt similarity index 94% rename from Sweep_line_2/test/Sweep_line_2/CMakeLists.txt rename to Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt index 206e6717f2f..7da374e7491 100644 --- a/Sweep_line_2/test/Sweep_line_2/CMakeLists.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt @@ -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() diff --git a/Sweep_line_2/test/Sweep_line_2/CompareCurveList.h b/Surface_sweep_2/test/Surface_sweep_2/CompareCurveList.h similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/CompareCurveList.h rename to Surface_sweep_2/test/Surface_sweep_2/CompareCurveList.h diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/conics/con01.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con01.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/conics/con01.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con01.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/conics/con02.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con02.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/conics/con02.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con02.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/conics/con03.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con03.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/conics/con03.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con03.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/conics/con04.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con04.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/conics/con04.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con04.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/conics/con05.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con05.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/conics/con05.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con05.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/conics/con06.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con06.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/conics/con06.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con06.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/conics/con07.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con07.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/conics/con07.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con07.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/conics/con08.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con08.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/conics/con08.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con08.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/conics/con09.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con09.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/conics/con09.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con09.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/conics/con10.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con10.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/conics/con10.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con10.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/polylines/big_overlap b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/big_overlap similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/polylines/big_overlap rename to Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/big_overlap diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/polylines/big_overlap2 b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/big_overlap2 similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/polylines/big_overlap2 rename to Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/big_overlap2 diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/polylines/closed_polyline b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/closed_polyline similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/polylines/closed_polyline rename to Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/closed_polyline diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/polylines/collinears b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/collinears similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/polylines/collinears rename to Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/collinears diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/polylines/edge_vertex_intersection b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/edge_vertex_intersection similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/polylines/edge_vertex_intersection rename to Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/edge_vertex_intersection diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/polylines/endpoint_intersection b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/endpoint_intersection similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/polylines/endpoint_intersection rename to Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/endpoint_intersection diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/polylines/partial_overlap b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/partial_overlap similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/polylines/partial_overlap rename to Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/partial_overlap diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/polylines/partial_overlap2 b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/partial_overlap2 similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/polylines/partial_overlap2 rename to Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/partial_overlap2 diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/polylines/segment_overlap b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/segment_overlap similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/polylines/segment_overlap rename to Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/segment_overlap diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/polylines/self_cut b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/self_cut similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/polylines/self_cut rename to Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/self_cut diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/polylines/simple_intersection b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/simple_intersection similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/polylines/simple_intersection rename to Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/simple_intersection diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/polylines/total_overlap b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/total_overlap similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/polylines/total_overlap rename to Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/total_overlap diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/polylines/triangle b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/triangle similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/polylines/triangle rename to Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/triangle diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/polylines/two_segments b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/two_segments similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/polylines/two_segments rename to Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/two_segments diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/polylines/vertex_intersection b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/vertex_intersection similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/polylines/vertex_intersection rename to Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/vertex_intersection diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/polylines/vertical_segment b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/vertical_segment similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/polylines/vertical_segment rename to Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/vertical_segment diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segment_circles/edge_vertex_intersection b/Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/edge_vertex_intersection similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segment_circles/edge_vertex_intersection rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/edge_vertex_intersection diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segment_circles/segs_and_circles b/Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/segs_and_circles similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segment_circles/segs_and_circles rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/segs_and_circles diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segment_circles/simple_intersection b/Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/simple_intersection similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segment_circles/simple_intersection rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/simple_intersection diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segment_circles/triangle b/Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/triangle similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segment_circles/triangle rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/triangle diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segment_circles/two_segments b/Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/two_segments similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segment_circles/two_segments rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/two_segments diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segment_circles/vertex_intersection b/Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/vertex_intersection similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segment_circles/vertex_intersection rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/vertex_intersection diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segment_circles/vertical_segment b/Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/vertical_segment similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segment_circles/vertical_segment rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/vertical_segment diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments/H_degeneracy b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments/H_degeneracy similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments/H_degeneracy rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments/H_degeneracy diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments/edge_vertex_intersection b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments/edge_vertex_intersection similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments/edge_vertex_intersection rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments/edge_vertex_intersection diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments/simple_intersection b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments/simple_intersection similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments/simple_intersection rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments/simple_intersection diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments/star_4 b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments/star_4 similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments/star_4 rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments/star_4 diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments/triangle b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments/triangle similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments/triangle rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments/triangle diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments/two_segments b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments/two_segments similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments/two_segments rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments/two_segments diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments/vertex_intersection b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments/vertex_intersection similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments/vertex_intersection rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments/vertex_intersection diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments/vertical_segment b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments/vertical_segment similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments/vertical_segment rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments/vertical_segment diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test00.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test00.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test00.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test00.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test01.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test01.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test01.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test01.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test02.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test02.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test02.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test02.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test03.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test03.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test03.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test03.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test04.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test04.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test04.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test04.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test05.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test05.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test05.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test05.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test06.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test06.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test06.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test06.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test07.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test07.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test07.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test07.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test08.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test08.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test08.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test08.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test09.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test09.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test09.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test09.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test10.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test10.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test10.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test10.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test11.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test11.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test11.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test11.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test12.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test12.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test12.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test12.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test13.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test13.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test13.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test13.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test14.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test14.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test14.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test14.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test15.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test15.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test15.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test15.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test16.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test16.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test16.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test16.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test17.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test17.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test17.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test17.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test18.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test18.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test18.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test18.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test19.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test19.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test19.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test19.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test20.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test20.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test20.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test20.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test21.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test21.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test21.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test21.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test22.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test22.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test22.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test22.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test23.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test23.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test23.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test23.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test24.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test24.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test24.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test24.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test25.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test25.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test25.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test25.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test26.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test26.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test26.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test26.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test27.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test27.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test27.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test27.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test28.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test28.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test28.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test28.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test29.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test29.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test29.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test29.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test30.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test30.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test30.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test30.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test31.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test31.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test31.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test31.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test32.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test32.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test32.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test32.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test33.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test33.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test33.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test33.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test34.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test34.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test34.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test34.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test35.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test35.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test35.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test35.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test36.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test36.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test36.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test36.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test37.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test37.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test37.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test37.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test40.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test40.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test40.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test40.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test41.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test41.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test41.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test41.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test42.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test42.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test42.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test42.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test43.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test43.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test43.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test43.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test44.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test44.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test44.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test44.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test45.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test45.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test45.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test45.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test46.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test46.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test46.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test46.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test47.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test47.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test47.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test47.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test48.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test48.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test48.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test48.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test49.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test49.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test49.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test49.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test50.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test50.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test50.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test50.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test51.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test51.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test51.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test51.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test52.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test52.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test52.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test52.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test53.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test53.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test53.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test53.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test54.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test54.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test54.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test54.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test55.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test55.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test55.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test55.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test56.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test56.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test56.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test56.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test60.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test60.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test60.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test60.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test61.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test61.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test61.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test61.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test62.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test62.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test62.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test62.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test63.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test63.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test63.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test63.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test64.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test64.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test64.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test64.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test65.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test65.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test65.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test65.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test66.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test66.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test66.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test66.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test67.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test67.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test67.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test67.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test68.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test68.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test68.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test68.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test69.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test69.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test69.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test69.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test70.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test70.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test70.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test70.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test71.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test71.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test71.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test71.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test72.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test72.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test72.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test72.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test73.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test73.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test73.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test73.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test74.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test74.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test74.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test74.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test75.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test75.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test75.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test75.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test76.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test76.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test76.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test76.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test77.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test77.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test77.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test77.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test78.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test78.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test78.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test78.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test79.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test79.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test79.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test79.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test80.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test80.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test80.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test80.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test81.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test81.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test81.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test81.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test82.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test82.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test82.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test82.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test83.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test83.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test83.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test83.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test84.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test84.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test84.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test84.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test85.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test85.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test85.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test85.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test86.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test86.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test86.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test86.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test87.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test87.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test87.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test87.txt diff --git a/Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test88.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test88.txt similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/DATA/segments_tight/test88.txt rename to Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test88.txt diff --git a/Sweep_line_2/test/Sweep_line_2/cgal_test b/Surface_sweep_2/test/Surface_sweep_2/cgal_test similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/cgal_test rename to Surface_sweep_2/test/Surface_sweep_2/cgal_test diff --git a/Sweep_line_2/test/Sweep_line_2/cgal_test_base b/Surface_sweep_2/test/Surface_sweep_2/cgal_test_base similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/cgal_test_base rename to Surface_sweep_2/test/Surface_sweep_2/cgal_test_base diff --git a/Sweep_line_2/test/Sweep_line_2/cgal_test_with_cmake b/Surface_sweep_2/test/Surface_sweep_2/cgal_test_with_cmake similarity index 100% rename from Sweep_line_2/test/Sweep_line_2/cgal_test_with_cmake rename to Surface_sweep_2/test/Surface_sweep_2/cgal_test_with_cmake diff --git a/Sweep_line_2/test/Sweep_line_2/test_sweep.cpp b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp similarity index 93% rename from Sweep_line_2/test/Sweep_line_2/test_sweep.cpp rename to Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp index 2c3a5c4cc18..14084a04191 100644 --- a/Sweep_line_2/test/Sweep_line_2/test_sweep.cpp +++ b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp @@ -13,7 +13,7 @@ #define CGAL_POLYLINE_TRAITS 11 #define CGAL_CONIC_TRAITS 21 -// Picking a default Traits class (this, with the +// Picking a default Traits class (this, with the // PL flag enables the running of the test independently of cgal_make.) #ifndef CGAL_ARR_TEST_TRAITS #define CGAL_ARR_TEST_TRAITS CGAL_SEGMENT_TRAITS @@ -52,7 +52,7 @@ int main() // Choose traits -#if CGAL_ARR_TEST_TRAITS==CGAL_SEGMENT_TRAITS +#if CGAL_ARR_TEST_TRAITS==CGAL_SEGMENT_TRAITS #include #include #include @@ -78,10 +78,10 @@ int main() #include #include -#include +#include #include "CompareCurveList.h" -#if CGAL_ARR_TEST_TRAITS==CGAL_SEGMENT_TRAITS +#if CGAL_ARR_TEST_TRAITS==CGAL_SEGMENT_TRAITS typedef CGAL::Gmpq NT; typedef CGAL::Cartesian Kernel; typedef CGAL::Arr_segment_traits_2 Traits; @@ -132,10 +132,10 @@ int main(int argc, char * argv[]) std::cerr << "Cannot open file " << argv[1] << "!" << std::endl; return -1; } - + CurveList curves; ReadCurveList(inp, curves); - + Traits tr; // get subcurves w/o overlapping @@ -168,7 +168,7 @@ int main(int argc, char * argv[]) // get intersection points (with endpoints) PointList points_with_ends_list_out; CGAL::compute_intersection_points(curves.begin(), - curves.end(), + curves.end(), std::back_inserter(points_with_ends_list_out), true); @@ -176,14 +176,14 @@ int main(int argc, char * argv[]) // get intersection points w/o end points PointList points_without_ends_list_out; CGAL::compute_intersection_points(curves.begin(), - curves.end(), + curves.end(), std::back_inserter(points_without_ends_list_out), false); std::cout << points_without_ends_list_out.size() << " points_without_ends_list_out(size)\n"; // check the do_curves_intersecting method - bool do_intersect_out = + bool do_intersect_out = CGAL::do_curves_intersect(curves.begin(), curves.end()); @@ -203,28 +203,28 @@ int main(int argc, char * argv[]) CurveList curves_with_overlap_list; ReadCurveListRational(inp, curves_with_overlap_list); - if ( !compare_lists(curves_no_overlap_list_out, + if ( !compare_lists(curves_no_overlap_list_out, curves_no_overlap_list, tr) ) return -1; - if ( !compare_lists(curves_with_overlap_list_out, + if ( !compare_lists(curves_with_overlap_list_out, curves_with_overlap_list, tr) ) return -1; - if ( !compare_lists(points_with_ends_list_out, + if ( !compare_lists(points_with_ends_list_out, points_with_ends_list, tr)) return -1; - if ( !compare_lists(points_without_ends_list_out, + if ( !compare_lists(points_without_ends_list_out, points_without_ends_list, tr)) return -1; bool do_intersect = false; - if((points_without_ends_list.size() != 0) || + if((points_without_ends_list.size() != 0) || (curves_no_overlap_list_out.size() != curves_with_overlap_list_out.size())) do_intersect = true; - + if (do_intersect_out != do_intersect) return -1; diff --git a/Sweep_line_2/test/Sweep_line_2/test_sweep_conic.cpp b/Surface_sweep_2/test/Surface_sweep_2/test_sweep_conic.cpp similarity index 80% rename from Sweep_line_2/test/Sweep_line_2/test_sweep_conic.cpp rename to Surface_sweep_2/test/Surface_sweep_2/test_sweep_conic.cpp index b911e335022..f01da3d395c 100644 --- a/Sweep_line_2/test/Sweep_line_2/test_sweep_conic.cpp +++ b/Surface_sweep_2/test/Surface_sweep_2/test_sweep_conic.cpp @@ -10,8 +10,7 @@ int main() #else #include - -#include +#include #include #include @@ -22,36 +21,31 @@ int main() #include #include +typedef CGAL::CORE_algebraic_number_traits Nt_traits; +typedef Nt_traits::Rational Rational; +typedef Nt_traits::Algebraic Algebraic; +typedef CGAL::Cartesian Rat_kernel; +typedef Rat_kernel::Point_2 Rat_point_2; +typedef Rat_kernel::Segment_2 Rat_segment_2; +typedef Rat_kernel::Circle_2 Rat_circle_2; +typedef CGAL::Cartesian Alg_kernel; +typedef CGAL::Arr_conic_traits_2 + Traits_2; -typedef CGAL::CORE_algebraic_number_traits Nt_traits; -typedef Nt_traits::Rational Rational; -typedef Nt_traits::Algebraic Algebraic; -typedef CGAL::Cartesian Rat_kernel; -typedef Rat_kernel::Point_2 Rat_point_2; -typedef Rat_kernel::Segment_2 Rat_segment_2; -typedef Rat_kernel::Circle_2 Rat_circle_2; -typedef CGAL::Cartesian Alg_kernel; -typedef CGAL::Arr_conic_traits_2 Traits_2; +typedef Traits_2::Curve_2 Curve_2; +typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2; +typedef Traits_2::Point_2 Point_2; +typedef std::list CurveList; -typedef Traits_2::Curve_2 Curve_2; -typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2; -typedef Traits_2::Point_2 Point_2; -typedef std::list CurveList; - -typedef std::list PointList; -typedef PointList::iterator PointListIter; +typedef std::list PointList; +typedef PointList::iterator PointListIter; /*! Conic reader */ -template -class Conic_reader -{ +template +class Conic_reader { public: - - int ReadData(const char * filename, CurveList & curves, - CGAL::Bbox_2 & bbox) + int ReadData(const char* filename, CurveList& curves, CGAL::Bbox_2& bbox) { Curve_2 cv; char dummy[256]; @@ -69,21 +63,21 @@ public: curves.push_back(cv); CGAL::Bbox_2 curve_bbox = cv.bbox(); if (i == 0) bbox = curve_bbox; - else bbox = bbox + curve_bbox; + else bbox = bbox + curve_bbox; } inp.close(); return 0; } - + void ReadCurve(std::ifstream & is, Curve_2 & cv) { // Read a line from the input file. char one_line[128]; - + skip_comments (is, one_line); std::string stringvalues(one_line); std::istringstream str_line (stringvalues, std::istringstream::in); - + // Get the arc type. // Supported types are: 'f' - Full ellipse (or circle). // 'e' - Elliptic arc (or circular arc). @@ -92,12 +86,12 @@ public: bool is_circle = false; // Is this a circle. Rat_circle_2 circle; Rational r, s, t, u, v, w; // The conic coefficients. - + str_line >> type; - + // An ellipse (full ellipse or a partial ellipse): if (type == 'f' || type == 'F' || type == 'e' || type == 'E') - { + { // Read the ellipse (using the format "a b x0 y0"): // // x - x0 2 y - y0 2 @@ -105,12 +99,12 @@ public: // a b // int a, b, x0, y0; - + str_line >> a >> b >> x0 >> y0; - + Rational a_sq = Rational(a*a); Rational b_sq = Rational(b*b); - + if (a == b) { is_circle = true; @@ -126,7 +120,7 @@ public: v = Rational(-2*y0*a_sq); w = Rational(x0*x0*b_sq + y0*y0*a_sq - a_sq*b_sq); } - + if (type == 'f' || type == 'F') { // Create a full ellipse (or circle). @@ -139,7 +133,7 @@ public: { // Read the endpointd of the arc. int x1, y1, x2, y2; - + str_line >> x1 >> y1 >> x2 >> y2; Point_2 source = Point_2 (Algebraic(x1), Algebraic(y1)); @@ -154,25 +148,25 @@ public: cv = Curve_2 (r, s, t, u, v, w, CGAL::CLOCKWISE, source, target); - } + } } else if (type == 's' || type == 'S') { // Read a segment, given by its endpoints (x1,y1) and (x2,y2); int x1, y1, x2, y2; - + str_line >> x1 >> y1 >> x2 >> y2; - + // Create the segment. Rat_point_2 source = Rat_point_2 (Rational(x1), Rational(y1)); Rat_point_2 target = Rat_point_2 (Rational(x2), Rational(y2)); - + cv = Curve_2(Rat_segment_2 (source, target)); } - + return; } - + void skip_comments( std::ifstream& is, char* one_line ) { while( !is.eof() ){ @@ -180,7 +174,7 @@ public: if( one_line[0] != '#' ){ break; } - } + } } }; @@ -192,7 +186,7 @@ int main (int argc, char** argv) bool verbose = false; // Define a test objects to read the conic arcs from it. - if (argc<2) + if (argc<2) { std::cerr << "Usage: Conic_traits_test " << std::endl; exit(1); @@ -207,15 +201,15 @@ int main (int argc, char** argv) // run the sweep std::list mylist; - CGAL::compute_subcurves(curves.begin(), curves.end(), + CGAL::compute_subcurves(curves.begin(), curves.end(), std::back_inserter(mylist), false); - - + + PointList point_list_with_ends; - CGAL::compute_intersection_points(curves.begin(), curves.end(), + CGAL::compute_intersection_points(curves.begin(), curves.end(), std::back_inserter(point_list_with_ends), true); int point_count_with_ends_calculated = point_list_with_ends.size(); - + // generate the string for the output std::stringstream out1; for ( std::list::iterator iter = mylist.begin() ; @@ -223,12 +217,12 @@ int main (int argc, char** argv) { out1 << *iter << "\n"; } - + // read the output from the file std::stringstream out2; char buf[1024]; int count = 0; - + std::ifstream in_file(argv[1]); in_file >> count; in_file.getline(buf, 1024); // to get rid of the new line @@ -244,7 +238,7 @@ int main (int argc, char** argv) int point_count_with_ends_from_file = 0; in_file >> point_count_with_ends_from_file; in_file.close(); - + if ( verbose ) { std::cout << "Result: \n" << mylist.size() << "\n"; @@ -254,15 +248,15 @@ int main (int argc, char** argv) std::cout << *i << "\n"; } } - + std::string calculated = out1.str(); std::string infile = out2.str(); - + if ( infile == calculated ) { - if ( point_count_with_ends_from_file != + if ( point_count_with_ends_from_file != point_count_with_ends_calculated ) { - std::cout << "number of intersection points (with ends):" - << point_count_with_ends_calculated << ". Should be " + std::cout << "number of intersection points (with ends):" + << point_count_with_ends_calculated << ". Should be " << point_count_with_ends_from_file << "\n"; std::cout << argv[1] << " Error\n"; return -1; @@ -278,8 +272,8 @@ int main (int argc, char** argv) std::cout << "--" << std::endl; return -1; } - - return 0; + + return 0; } #endif diff --git a/Sweep_line_2/doc/Sweep_line_2/Sweep_line_2.txt b/Sweep_line_2/doc/Sweep_line_2/Sweep_line_2.txt deleted file mode 100644 index 086bf757cff..00000000000 --- a/Sweep_line_2/doc/Sweep_line_2/Sweep_line_2.txt +++ /dev/null @@ -1,60 +0,0 @@ -namespace CGAL { -/*! - -\mainpage User Manual -\anchor Chapter_2D_Intersection_of_Curves -\anchor I1_ChapterSweepLine - -\cgalAutoToc -\authors Baruch Zukerman, Ron Wein, and Efi Fogel - -\section Sweep_line_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 event points, such that -we only have to calculate the intersection points -between two curves when they become contiguous. For more details on the -sweep-line algorithm see, for example, \cgalCite{bkos-cgaa-00}, Chapter 2. - -This chapter describes three functions implemented using the sweep-line -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 sweep-line 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 Sweep_line_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{Sweep_line_2/sweep_line.cpp} - -\section Sweep_line_2Design Design and Implementation History - -The current version of the sweep-line algorithm was written by -Baruch Zukerman, based on previous implementations by Ester Ezra and -Tali Zvi. - -*/ -} /* namespace CGAL */ - diff --git a/Sweep_line_2/doc/Sweep_line_2/examples.txt b/Sweep_line_2/doc/Sweep_line_2/examples.txt deleted file mode 100644 index ccafc547dab..00000000000 --- a/Sweep_line_2/doc/Sweep_line_2/examples.txt +++ /dev/null @@ -1,3 +0,0 @@ -/*! -\example Sweep_line_2/sweep_line.cpp -*/ diff --git a/Sweep_line_2/include/CGAL/Sweep_line_empty_visitor.h b/Sweep_line_2/include/CGAL/Sweep_line_empty_visitor.h deleted file mode 100644 index ad5bbd48d3b..00000000000 --- a/Sweep_line_2/include/CGAL/Sweep_line_empty_visitor.h +++ /dev/null @@ -1,285 +0,0 @@ -// 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. -// -// $URL$ -// $Id$ -// -// -// Author(s) : Baruch Zukerman - -#ifndef CGAL_SWEEP_LINE_EMPTY_VISITOR_H -#define CGAL_SWEEP_LINE_EMPTY_VISITOR_H - -#include - - -/*! \file - * Definition of the Sweep_line_empty_visitor class-template. - */ - -#include -#include -#include - -namespace CGAL { - -/*! \class - * An empty sweep-line visitor that does nothing. It is used as a base-class - * for other concrete visitors that produce some output. - */ -template , - typename Event_ = Sweep_line_event, - class Allocator_ = CGAL_ALLOCATOR(int)> -class Sweep_line_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 Sweep_line_empty_visitor Self; - -private: - - // we want to hide the Sweep_line type - typedef Basic_sweep_line_2 Sweep_line; - - typedef typename Sweep_line::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 - (((Base_status_line_iter*)this)->operator*())); - } - - // Overriden operator-> - pointer operator-> () - { - return (reinterpret_cast - (Base_status_line_iter::operator->())); - } - }; - - - typedef typename Event::Subcurve_iterator Event_subcurve_iterator; - typedef typename Event::Subcurve_reverse_iterator - Event_subcurve_reverse_iterator; - -protected: - - // Data members: - void* m_sweep_line; // The sweep-line object. - -public: - - /*! Constructor. */ - Sweep_line_empty_visitor () : - m_sweep_line (NULL) - {} - - /*! Attach the a sweep-line object. */ - void attach (void* sl) - { - m_sweep_line = sl; - } - - /*! Destructor */ - virtual ~Sweep_line_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->_sweep_line()->status_line_begin()); - } - - /*! Get a past-the-end iterator for the subcurves in the status line. */ - Status_line_iterator status_line_end() - { - return (this->_sweep_line()->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->_sweep_line()->status_line_size()); - } - - /*! Check if the status line is empty. */ - bool is_status_line_empty() const - { - return (this->_sweep_line()->is_status_line_empty()); - } - - /*! Deallocate the given event. */ - void deallocate_event (Event* e) - { - this->_sweep_line()->deallocate_event(e); - } - - /*! Stop the sweep-line process. */ - void stop_sweep() - { - this->_sweep_line()->stop_sweep(); - } - - /*! Get the sweep-line object. */ - void* sweep_line () - { - return (m_sweep_line); - } - - /*! Get the current event. */ - Event* current_event() - { - return (this->_sweep_line()->current_event()); - } - - /*! Get the geometry-traits class. */ - const Traits_2 * traits () - { - return (this->_sweep_line()->traits()); - } - -private: - - /*! Get the sweep-line object. */ - Sweep_line* _sweep_line () - { - return (reinterpret_cast(m_sweep_line)); - } - - const Sweep_line* _sweep_line () const - { - return (reinterpret_cast(m_sweep_line)); - } -}; - -} //namespace CGAL - -#endif diff --git a/Sweep_line_2/package_info/Sweep_line_2/long_description.txt b/Sweep_line_2/package_info/Sweep_line_2/long_description.txt deleted file mode 100644 index e906f7b29d5..00000000000 --- a/Sweep_line_2/package_info/Sweep_line_2/long_description.txt +++ /dev/null @@ -1,42 +0,0 @@ -Given a set C of planar curves, the arrangement A(C) is the -subdivision of the plane into zero-dimensional, one-dimensional and -two-dimensional cells, called vertices, edges and faces, respectively, -induced by the curves in C. Arrangements are ubiquitous in the -computational-geometry literature and have many applications -in fields like motion planning, computer-aided design, geographical -information systems, etc. - -The curves in C can intersect each other (a single curve may also -be self-intersecting or may be comprised of several disconnected -branches) and are not necessarily x-monotone. We construct a -collection C'' of x-monotone subcurves that are pairwise disjoint in -their interiors. We do it in two steps as follows. First, we decompose -each curve in C into maximal x-monotone subcurves (and possibly -isolated points), obtaining the collection C'. Note that an x-monotone -curve cannot be self-intersecting. Then, we decompose each curve in -C' into maximal connected subcurves not intersecting any other curve -(or point) in C'. The collection C'' may also contain isolated points, -if the curves of C contain such points. The arrangement induced by the -collection C'' can be conveniently embedded as a planar graph, whose -vertices are associated with curve endpoints or with isolated points, -and whose edges are associated with subcurves. It is easy to see that -A(C) = A(C''). This graph can be represented using a doubly-connected -edge list data-structure (DCEL for short), which consists of -containers of vertices, edges, and faces and maintains the incidence -relations among these objects. - -This package can be used to construct, maintain, alter, and display -arrangements in the plane. Once an arrangement is constructed, the -package can be used to obtain results of various queries on the -arrangement, such as point location. The package also includes generic -implementations of two algorithmic frameworks, that are, computing the -zone of an arrangement, and line-sweeping the plane, the arrangements -is embedded on. These frameworks are used in turn in the -implementations of other operations on arrangements. Computing the -overlay of two arrangements, for example, is based on the sweep-line -framework. - -Arrangements and arrangement components can also be extended to store -additional data. An important extension stores the construction -history of the arrangement, such that it is possible to obtain the -originating curve of an arrangement subcurve.