From 1d738d4d87425c8b52e285fd8632b56c4fdab40d Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Fri, 7 Dec 2007 14:25:32 +0000 Subject: [PATCH] API change --- .../Arr_bounded_planar_topology_traits_2.h | 40 +-- .../include/CGAL/Arr_dcel_base.h | 6 +- ...rr_great_circular_arc_on_sphere_traits_2.h | 48 +--- .../Arr_batched_point_location_traits_2.h | 92 +++++-- .../include/CGAL/Arr_qdx_topology_traits_2.h | 38 +-- .../CGAL/Arr_spherical_topology_traits_2.h | 48 ++-- .../include/CGAL/Arr_tags.h | 2 - .../Arr_planar_topology_traits_base_2.h | 8 +- .../Arr_qdx_construction_helper.h | 30 +-- .../Arr_qdx_insertion_helper.h | 10 +- .../Arr_qdx_topology_traits_2_impl.h | 108 ++++---- .../Arr_spherical_construction_helper.h | 39 ++- .../Arr_spherical_insertion_helper.h | 26 +- .../Arr_spherical_overlay_helper.h | 6 +- .../Arr_spherical_topology_traits_2_impl.h | 188 +++++++------- .../Arr_spherical_vert_decomp_helper.h | 28 +-- .../Arr_torus_construction_helper.h | 74 +++--- .../Arr_torus_insertion_helper.h | 10 +- .../Arr_torus_overlay_helper.h | 4 +- .../Arr_torus_topology_traits_2_impl.h | 235 +++++++++--------- .../CGAL/Arr_torus_topology_traits_2.h | 54 ++-- .../CGAL/Arr_unb_planar_topology_traits_2.h | 39 ++- .../CGAL/Arrangement_2/Arr_traits_adaptor_2.h | 15 +- .../Arrangement_on_surface_2_global.h | 3 + .../include/CGAL/Arrangement_zone_2.h | 15 +- .../Arr_basic_insertion_traits_2.h | 58 ++++- .../CGAL/Sweep_line_2/Arr_overlay_traits_2.h | 2 +- 27 files changed, 639 insertions(+), 587 deletions(-) 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 2a3a27c25e0..7f84da3e19f 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 @@ -374,17 +374,16 @@ public: * \param v The vertex. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve has a boundary condition in either x or y. * \return Whether v represents the given curve end. */ bool are_equal (const Vertex *v, const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y) const + Arr_parameter_space ps_x, Arr_parameter_space ps_y) const { - CGAL_assertion (bound_x == ARR_INTERIOR && bound_y == ARR_INTERIOR); + CGAL_assertion (ps_x == ARR_INTERIOR && ps_y == ARR_INTERIOR); if (ind == ARR_MIN_END) { @@ -409,16 +408,16 @@ public: * \param f The face. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve has a boundary condition in either x or y. * \return An object that contains the curve end. */ CGAL::Object place_boundary_vertex (Face *, const X_monotone_curve_2&, Arr_curve_end, - Arr_parameter_space, - Arr_parameter_space) + Arr_parameter_space /* ps_x */, + Arr_parameter_space /* ps_y */) { // This function should never be called: CGAL_error(); @@ -431,17 +430,18 @@ public: * \param v The vertex. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve has a boundary condition in either x or y, and should be * incident to the vertex v. * \return An object that contains the curve end. */ - Halfedge* locate_around_boundary_vertex (Vertex *, - const X_monotone_curve_2&, - Arr_curve_end, - Arr_parameter_space, - Arr_parameter_space ) const + Halfedge* + locate_around_boundary_vertex (Vertex *, + const X_monotone_curve_2&, + Arr_curve_end, + Arr_parameter_space /* ps_x */, + Arr_parameter_space /* ps_y */) const { CGAL_error(); return (NULL); @@ -451,15 +451,15 @@ public: * Locate a DCEL feature that contains the given curve end. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve end is incident to the boundary. * \return An object that contains the curve end. */ CGAL::Object locate_curve_end (const X_monotone_curve_2&, Arr_curve_end, - Arr_parameter_space, - Arr_parameter_space) + Arr_parameter_space /* ps_x */, + Arr_parameter_space /* ps_y */) { // This function should never be called: CGAL_error(); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h b/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h index 8625505d0a3..baf8ad6d0b8 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h @@ -141,10 +141,10 @@ public: } /*! Set the boundary conditions of the vertex. */ - void set_boundary (Arr_parameter_space bound_x, Arr_parameter_space bound_y) + void set_boundary (Arr_parameter_space ps_x, Arr_parameter_space ps_y) { - pss[0] = static_cast (bound_x); - pss[1] = static_cast (bound_y); + pss[0] = static_cast (ps_x); + pss[1] = static_cast (ps_y); return; } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_great_circular_arc_on_sphere_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_great_circular_arc_on_sphere_traits_2.h index c0ecd71a0f1..a2ad8650912 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_great_circular_arc_on_sphere_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_great_circular_arc_on_sphere_traits_2.h @@ -1544,9 +1544,9 @@ public: */ template OutputIterator compute_intersection(const Point_2 & l1_3, - const Point_2 & r1_3, + const Point_2 r1_3, const Point_2 & l2_3, - const Point_2 & r2_3, + const Point_2 r2_3, const Plane_3 & plane, bool vertical, const Direction_2 & start, @@ -1714,14 +1714,6 @@ public: m_traits->clockwise_in_between_2_object(); if (xc1.is_vertical()) { - std::cout << "source1: " << xc1.source() << std::endl - << "target1: " << xc1.target() << std::endl - << "normal1: " << xc1.plane().orthogonal_direction() << std::endl; - - std::cout << "source2: " << xc2.source() << std::endl - << "target2: " << xc2.target() << std::endl - << "normal2: " << xc2.plane().orthogonal_direction() << std::endl; - // Both arcs are vertical const Plane_3 & plane1 = xc1.plane(); const Plane_3 & plane2 = xc2.plane(); @@ -1765,30 +1757,20 @@ public: Project project = (xz_plane) ? Traits::project_xz : Traits::project_yz; - Plane_3 plane = - (( xz_plane && (ysign == NEGATIVE)) || - (!xz_plane && (xsign == POSITIVE))) ? - (xc1.is_directed_right() ? xc1.plane() : xc1.plane().opposite()) : - (xc1.is_directed_right() ? xc1.plane().opposite() : xc1.plane()); + Plane_3 plane = (xz_plane) ? + ((xsign == POSITIVE) ? xc1.plane() : xc1.plane().opposite()) : + ((ysign == NEGATIVE) ? xc1.plane() : xc1.plane().opposite()); - std::cout << ((( xz_plane && (ysign == NEGATIVE)) || - (!xz_plane && (xsign == POSITIVE))) ? - (xc1.is_directed_right() ? "straight" : "opposite") : - (xc1.is_directed_right() ? "opposite" : "straight")) - << std::endl; - bool p_x_is_positive = Traits::x_sign(point) == POSITIVE; bool p_y_is_positive = Traits::y_sign(point) == POSITIVE; if ((xz_plane && p_x_is_positive) || (!xz_plane && p_y_is_positive)) { - std::cout << "1" << std::endl; // The endpoints reside in the positive x-halfspace: return compute_intersection(xc1.left(), xc1.right(), xc2.left(), xc2.right(), plane, true, Traits::neg_y_2(), ccib, project, oi); } - std::cout << "2" << std::endl; // The endpoints reside in the negative x-halfspace: return compute_intersection(xc1.left(), xc1.right(), xc2.left(), xc2.right(), @@ -1799,9 +1781,8 @@ public: // The arcs are not vertical: Direction_3 normal = xc1.plane().orthogonal_direction(); bool plane_is_positive = (Traits::z_sign(normal) == POSITIVE); - Plane_3 plane = (plane_is_positive) ? - (xc1.is_directed_right() ? xc1.plane() : xc1.plane().opposite()) : - (xc1.is_directed_right() ? xc1.plane().opposite() : xc1.plane()); + Plane_3 plane = + (plane_is_positive) ? xc1.plane() : xc1.plane().opposite(); return compute_intersection(xc1.left(), xc1.right(), xc2.left(), xc2.right(), plane, false, Traits::neg_x_2(), @@ -1858,9 +1839,6 @@ public: bool operator()(const X_monotone_curve_2 & xc1, const X_monotone_curve_2 & xc2) const { - //! Temporary - // return false; - if (xc1.is_empty() || xc2.is_empty()) return true; if (xc1.is_full() && xc2.is_full()) return false; @@ -2119,7 +2097,7 @@ public: /*! Enumeration of discontinuity type */ enum Location_type { - ARR_INTERIOR_LOC, + NO_BOUNDARY_LOC, MIN_BOUNDARY_LOC, MID_BOUNDARY_LOC, MAX_BOUNDARY_LOC @@ -2154,8 +2132,8 @@ public: Direction_3(x, y, z) { m_location = - (CGAL::sign(y) != ZERO) ? ARR_INTERIOR_LOC : - ((CGAL::sign(x) == POSITIVE) ? ARR_INTERIOR_LOC : + (CGAL::sign(y) != ZERO) ? NO_BOUNDARY_LOC : + ((CGAL::sign(x) == POSITIVE) ? NO_BOUNDARY_LOC : ((CGAL::sign(x) == NEGATIVE) ? MID_BOUNDARY_LOC : ((CGAL::sign(z) == NEGATIVE) ? MIN_BOUNDARY_LOC : MAX_BOUNDARY_LOC))); } @@ -2177,7 +2155,7 @@ public: Direction_2 dir_xy = Traits::project_xy(dir); typename Kernel::Equal_2 equal_2 = kernel.equal_2_object(); const Direction_2 & nx = Traits::neg_x_2(); - m_location = equal_2(dir_xy, nx) ? MID_BOUNDARY_LOC : ARR_INTERIOR_LOC; + m_location = equal_2(dir_xy, nx) ? MID_BOUNDARY_LOC : NO_BOUNDARY_LOC; } } @@ -2200,7 +2178,7 @@ public: Location_type discontinuity_type() const { return m_location; } - bool is_no_boundary() const { return (m_location == ARR_INTERIOR_LOC); } + bool is_no_boundary() const { return (m_location == NO_BOUNDARY_LOC); } bool is_min_boundary() const { return (m_location == MIN_BOUNDARY_LOC); } @@ -2391,7 +2369,7 @@ public: (kernel.construct_opposite_direction_3_object()(source), target)); m_plane = construct_plane_3(source, target); - + // Check whether any one of the endpoint coincide with a pole: if (source.is_max_boundary()) { set_is_vertical(true); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h index d5458d0e3e6..75c225004b2 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h @@ -64,8 +64,8 @@ public: typedef typename Base_traits_2::Boundary_category Base_boundary_category; typedef Tag_true Has_boundary_category; - typedef Arr_bounded_boundary_tag Boundary_category; typedef Tag_false Has_left_category; + typedef Base_boundary_category Boundary_category; protected: @@ -199,6 +199,56 @@ public: typedef Ex_point_2 Point_2; + /*! A function object that determines whether a curve end is bounded. */ + class Is_bounded_2 { + protected: + //! The base traits. + const Base_traits_2 * m_base; + + /*! Constructor. + * \param base The base traits class. It must be passed, to handle non + * stateless traits objects, (which stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Is_bounded_2(const Base_traits_2 * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_batched_point_location_traits_2; + + bool is_bounded(const X_monotone_curve_2 & xcv, Arr_curve_end ce, + Arr_no_boundary_tag) + { return true; } + + bool is_bounded(const X_monotone_curve_2 & xcv, Arr_curve_end ce, + Arr_has_boundary_tag) + { return true; } + + bool is_bounded(const X_monotone_curve_2 & xcv, Arr_curve_end ce, + Arr_unbounded_boundary_tag) + { + return m_base->is_bounded_2_object()(xcv, ce); + } + + public: + /*! Is the end of an x-monotone curve bounded? + * \param xcv The x-monotone curve. + * \param ce The end of xcv identifier. + * \return true is the curve end is bounded, and false otherwise + */ + bool operator() (const X_monotone_curve_2 & xcv, Arr_curve_end ce) + { + return is_bounded(xcv, ce, Boundary_category()); + } + }; + + /*! Obtain a Is_bounded_2 function object. */ + Is_bounded_2 is_bounded_2_object() const + { + return Is_bounded_2(m_base_traits); + } + /*! A functor that determines whether an endpoint of an x-monotone curve lies * on a boundary of the parameter space along the x axis. */ @@ -219,23 +269,23 @@ public: public: Arr_parameter_space operator() (const X_monotone_curve_2& xcv, - Arr_curve_end ce) const + Arr_curve_end ce) const { - return _parameter_space_in_x_imp (xcv, ce, Base_has_boundary_category()); + return parameter_space_in_x (xcv, ce, Base_has_boundary_category()); } private: - Arr_parameter_space _parameter_space_in_x_imp (const X_monotone_curve_2& xcv, - Arr_curve_end ce, - Tag_true) const + Arr_parameter_space parameter_space_in_x (const X_monotone_curve_2& xcv, + Arr_curve_end ce, Tag_true) const { return (m_base->parameter_space_in_x_2_object() (xcv.base(), ce)); } - Arr_parameter_space _parameter_space_in_x_imp (const X_monotone_curve_2& , Arr_curve_end , - Tag_false) const + Arr_parameter_space parameter_space_in_x (const X_monotone_curve_2 &, + Arr_curve_end, + Tag_false) const { - return (ARR_INTERIOR); + return ARR_INTERIOR; } }; @@ -265,7 +315,7 @@ public: public: Arr_parameter_space operator()(const X_monotone_curve_2& xcv, - Arr_curve_end ce) const + Arr_curve_end ce) const { return parameter_space_in_y(xcv, ce, Base_has_boundary_category()); } @@ -277,13 +327,14 @@ public: private: Arr_parameter_space parameter_space_in_y(const X_monotone_curve_2& xcv, - Arr_curve_end ce, Tag_true) const + Arr_curve_end ce, Tag_true) const { return m_base->parameter_space_in_y_2_object()(xcv.base(), ce); } - Arr_parameter_space parameter_space_in_y(const X_monotone_curve_2 &, Arr_curve_end, - Tag_false) const + Arr_parameter_space parameter_space_in_y(const X_monotone_curve_2 &, + Arr_curve_end, + Tag_false) const { return ARR_INTERIOR; } @@ -476,7 +527,7 @@ public: * constructing it. */ Compare_y_at_x_right_2(const Base_compare_y_at_x_right_2& base) : - m_base_cmp_y_at_x_right(base) + m_base_cmp_y_at_x_right(base) {} //! Allow its functor obtaining function calling the private constructor. @@ -487,9 +538,7 @@ public: const X_monotone_curve_2& xcv2, const Point_2& p) const { - return (m_base_cmp_y_at_x_right(xcv1.base(), - xcv2.base(), - p.base())); + return (m_base_cmp_y_at_x_right(xcv1.base(), xcv2.base(), p.base())); } }; @@ -643,8 +692,7 @@ public: Comparison_result compare_point_curve(const Point_2 &, const X_monotone_curve_2 &, - Arr_curve_end, - Tag_false) const + Arr_curve_end, Tag_false) const { CGAL_error(); return EQUAL; @@ -660,10 +708,8 @@ public: xcv2.base(), ce2); } - Comparison_result compare_curves(const X_monotone_curve_2 &, - Arr_curve_end, - const X_monotone_curve_2 &, - Arr_curve_end, + Comparison_result compare_curves(const X_monotone_curve_2 &, Arr_curve_end, + const X_monotone_curve_2 &, Arr_curve_end, Tag_false) const { CGAL_error(); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_qdx_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_qdx_topology_traits_2.h index 244049a4796..bb1dc07833f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_qdx_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_qdx_topology_traits_2.h @@ -664,14 +664,14 @@ public: * \param v The vertex. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve has a boundary condition in either x or y. * \return Whether v represents the given curve end. */ bool are_equal (const Vertex *v, const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, Arr_parameter_space bound_y) const; + Arr_parameter_space ps_x, Arr_parameter_space ps_y) const; /*! * Given a curve end with boundary conditions and a face that contains the @@ -680,8 +680,8 @@ public: * \param f The face. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve has a boundary condition in either x or y. * \return An object that contains the curve end. * In our case this object is either empty, or it may wrap a @@ -690,8 +690,8 @@ public: CGAL::Object place_boundary_vertex (Face *f, const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y); + Arr_parameter_space ps_x, + Arr_parameter_space ps_y); /*! * Locate the predecessor halfedge for the given curve around a given @@ -699,8 +699,8 @@ public: * \param v The vertex. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve has a boundary condition in either x or y, and should be * incident to the vertex v. * \return An object that contains the curve end. @@ -708,8 +708,8 @@ public: Halfedge* locate_around_boundary_vertex (Vertex *v, const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y) const; + Arr_parameter_space ps_x, + Arr_parameter_space ps_y) const; /*! * Receive a notification on the creation of a new boundary vertex that @@ -717,21 +717,21 @@ public: * \param v The new boundary vertex. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. */ void notify_on_boundary_vertex_creation (Vertex *v, const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y) const; + Arr_parameter_space ps_x, + Arr_parameter_space ps_y) const; /*! * Locate a DCEL feature that contains the given curve end. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve end is incident to the boundary. * \return An object that contains the curve end. * In our case this object may either wrap an unbounded face, @@ -740,8 +740,8 @@ public: */ CGAL::Object locate_curve_end (const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y); + Arr_parameter_space ps_x, + Arr_parameter_space ps_y); /*! * Given two predecessor halfedges that belong to the same inner CCB of 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 73e5c766d23..23189f397fc 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 @@ -480,11 +480,9 @@ public: {} }; - typedef Arr_inc_insertion_zone_visitor - Zone_insertion_visitor; + typedef Arr_inc_insertion_zone_visitor Zone_insertion_visitor; - typedef Arr_naive_point_location - Default_point_location_strategy; + typedef Arr_naive_point_location Default_point_location_strategy; //@} ///! \name Topology-traits methods. @@ -495,14 +493,14 @@ public: * \param v The new boundary vertex. * \param xc The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. */ void notify_on_boundary_vertex_creation(Vertex * v, const X_monotone_curve_2 & xc, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y); + Arr_parameter_space ps_x, + Arr_parameter_space ps_y); /*! Given two predecessor halfedges that belong to the same inner CCB of * a face, determine what happens when we insert an edge connecting the @@ -612,14 +610,14 @@ public: * \param v The vertex. * \param xc The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve has a boundary condition in either x or y. * \return Whether v represents the given curve end. */ bool are_equal(const Vertex * v, const X_monotone_curve_2 & xc, Arr_curve_end ind, - Arr_parameter_space bound_x, Arr_parameter_space bound_y) const; + Arr_parameter_space ps_x, Arr_parameter_space ps_y) const; /*! Given a curve end with boundary conditions and a face that contains the * interior of the curve, find a place for a boundary vertex that will @@ -627,16 +625,16 @@ public: * \param f The face. * \param xc The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve has a boundary condition in either x or y. * \return An object that contains the curve end. */ CGAL::Object place_boundary_vertex(Face * f, const X_monotone_curve_2 & xc, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y); + Arr_parameter_space ps_x, + Arr_parameter_space ps_y); /*! * Locate the predecessor halfedge for the given curve around a given @@ -644,8 +642,8 @@ public: * \param v The vertex. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve has a boundary condition in either x or y, and should be * incident to the vertex v. * \return An object that contains the curve end. @@ -653,19 +651,20 @@ public: Halfedge * locate_around_boundary_vertex(Vertex * v, const X_monotone_curve_2 & cv, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y) const; + Arr_parameter_space ps_x, + Arr_parameter_space ps_y) const; /*! Locate a DCEL feature that contains the given curve end. * \param xc The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve end is incident to the boundary. * \return An object that contains the curve end. */ - CGAL::Object locate_curve_end(const X_monotone_curve_2 & xc, Arr_curve_end ind, - Arr_parameter_space bound_x, Arr_parameter_space bound_y); + CGAL::Object locate_curve_end(const X_monotone_curve_2 & xc, Arr_curve_end ce, + Arr_parameter_space ps_x, + Arr_parameter_space ps_y); /*! Split a fictitious edge using the given vertex. * \param e The edge to split (one of the pair of halfedges). @@ -718,7 +717,8 @@ protected: * \pre v is a valid boundary. * \return The curve that induces v. */ - const X_monotone_curve_2 & _curve(const Vertex * v, Arr_curve_end & ind) const; + const X_monotone_curve_2 & _curve(const Vertex * v, + Arr_curve_end & ind) const; /*! Return the halfedge, the target vertex of which is given, that is * the predecessor of a halfedge, the curve of which is given, that is about diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h index 20bdf30e582..3c17f59cdae 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h @@ -30,8 +30,6 @@ struct Arr_no_boundary_tag {}; struct Arr_has_boundary_tag {}; struct Arr_bounded_boundary_tag : public Arr_has_boundary_tag {}; struct Arr_unbounded_boundary_tag : public Arr_has_boundary_tag {}; -struct Arr_all_boundary_tag : public Arr_bounded_boundary_tag, - public Arr_unbounded_boundary_tag {}; CGAL_END_NAMESPACE 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 ef167b11f63..a42705b4d07 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 @@ -146,14 +146,14 @@ public: * \param v The new boundary vertex. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. */ void notify_on_boundary_vertex_creation (Vertex *, const X_monotone_curve_2& , Arr_curve_end, - Arr_parameter_space, - Arr_parameter_space) + Arr_parameter_space /* ps_x */, + Arr_parameter_space /* ps_y */) { // In the planar-topology traits this function should never be invoked: return; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_qdx_construction_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_qdx_construction_helper.h index c83e6d7d555..74a46c591d6 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_qdx_construction_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_qdx_construction_helper.h @@ -109,11 +109,11 @@ public: */ virtual void before_handle_event(Event * event) { - const Arr_parameter_space bound_x = event->parameter_space_in_x(); - const Arr_parameter_space bound_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(); - if (bound_x < 0) { - CGAL_assertion(bound_y == CGAL::ARR_INTERIOR); + if (ps_x < 0) { + CGAL_assertion(ps_y == CGAL::ARR_INTERIOR); // The event has only one right curve. CGAL_assertion((event->number_of_left_curves() == 0) && (event->number_of_right_curves() == 1)); @@ -124,7 +124,7 @@ public: if (m_top_traits->leftmost_vertex() == NULL) { m_arr_access.create_boundary_vertex (xc, CGAL::ARR_MIN_END, - bound_x, bound_y); + ps_x, ps_y); } event->set_vertex_handle( @@ -133,8 +133,8 @@ public: return; } - if (bound_x > 0) { - CGAL_assertion(bound_y == CGAL::ARR_INTERIOR); + if (ps_x > 0) { + CGAL_assertion(ps_y == CGAL::ARR_INTERIOR); // The event has only one left curve. CGAL_assertion((event->number_of_left_curves() == 1) && (event->number_of_right_curves() == 0)); @@ -145,7 +145,7 @@ public: if (m_top_traits->rightmost_vertex() == NULL) { m_arr_access.create_boundary_vertex (xc, CGAL::ARR_MAX_END, - bound_x, bound_y); + ps_x, ps_y); } event->set_vertex_handle( @@ -154,15 +154,15 @@ public: return; } - if (bound_y != CGAL::ARR_INTERIOR) { - CGAL_assertion(bound_y == CGAL::BEFORE_DISCONTINUITY || - bound_y == CGAL::AFTER_DISCONTINUITY); - CGAL_assertion(bound_x == CGAL::ARR_INTERIOR); + if (ps_y != CGAL::ARR_INTERIOR) { + CGAL_assertion(ps_y == CGAL::BEFORE_DISCONTINUITY || + ps_y == CGAL::AFTER_DISCONTINUITY); + CGAL_assertion(ps_x == CGAL::ARR_INTERIOR); // there is exactly one event CGAL_assertion(event->number_of_left_curves() + event->number_of_right_curves() >= 1); const X_monotone_curve_2 & xc = - (bound_y == CGAL::AFTER_DISCONTINUITY ? + (ps_y == CGAL::AFTER_DISCONTINUITY ? // AFTER DISCONTINUITY (event->number_of_right_curves() > 0 ? (*(event->right_curves_begin()))->last_curve() : @@ -174,7 +174,7 @@ public: ); CGAL::Arr_curve_end ind = - (bound_y == CGAL::AFTER_DISCONTINUITY ? + (ps_y == CGAL::AFTER_DISCONTINUITY ? (event->number_of_right_curves() > 0 ? CGAL::ARR_MIN_END : CGAL::ARR_MAX_END) : (event->number_of_left_curves() > 0 ? @@ -187,7 +187,7 @@ public: if (v == NULL) { m_arr_access.create_boundary_vertex (xc, ind, - bound_x, bound_y); + ps_x, ps_y); } event->set_vertex_handle(vh); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_qdx_insertion_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_qdx_insertion_helper.h index 6fb7b4eb74d..de8771ee6b1 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_qdx_insertion_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_qdx_insertion_helper.h @@ -127,10 +127,10 @@ void Arr_qdx_insertion_helper::before_handle_event (Event* event) { // Ignore events that do not have boundary conditions. - const Arr_parameter_space bound_x = event->parameter_space_in_x(); - const Arr_parameter_space bound_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(); - if (bound_x == ARR_INTERIOR && bound_y == ARR_INTERIOR) { + if (ps_x == ARR_INTERIOR && ps_y == ARR_INTERIOR) { return; } @@ -162,11 +162,11 @@ void Arr_qdx_insertion_helper::before_handle_event // In case we encounter an existing curve incident to the left or // top face, we have to update the current top face - if (bound_x < 0) { + if (ps_x < 0) { // left side CGAL_assertion (ind == ARR_MIN_END); this->m_top_face = he->twin()->face(); - } else if (bound_y == BEFORE_DISCONTINUITY) { + } else if (ps_y == BEFORE_DISCONTINUITY) { // top side (taken from torus) if (ind == CGAL::ARR_MIN_END) { diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_qdx_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_qdx_topology_traits_2_impl.h index ebbb3136bf0..1967ee04881 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_qdx_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_qdx_topology_traits_2_impl.h @@ -232,27 +232,27 @@ template bool Arr_qdx_topology_traits_2::are_equal (const Vertex *v, const X_monotone_curve_2& cv, Arr_curve_end ind, - CGAL::Arr_parameter_space bound_x, CGAL::Arr_parameter_space bound_y) const + CGAL::Arr_parameter_space ps_x, CGAL::Arr_parameter_space ps_y) const { - CGAL_precondition (bound_x == m_left || - bound_x == m_right || - bound_y == CGAL::AFTER_DISCONTINUITY || - bound_y == CGAL::BEFORE_DISCONTINUITY + CGAL_precondition (ps_x == m_left || + ps_x == m_right || + ps_y == CGAL::AFTER_DISCONTINUITY || + ps_y == CGAL::BEFORE_DISCONTINUITY ); // In case the given boundary conditions do not match those of the given // vertex, v cannot represent the curve end. - if (bound_x != v->parameter_space_in_x()) { + if (ps_x != v->parameter_space_in_x()) { return false; } - if (bound_x != CGAL::ARR_INTERIOR) { - return (bound_x == v->parameter_space_in_x()); + if (ps_x != CGAL::ARR_INTERIOR) { + return (ps_x == v->parameter_space_in_x()); } else { - CGAL_assertion (bound_y != CGAL::ARR_INTERIOR); + CGAL_assertion (ps_y != CGAL::ARR_INTERIOR); // check wether the two concrete points are equal return (this->m_traits->compare_xy_2_object() ( - // since bound_x == CGAL::ARR_INTERIOR we immediately have + // since ps_x == CGAL::ARR_INTERIOR we immediately have // a valid vertex v (with point) v->point(), (ind == CGAL::ARR_MIN_END ? @@ -273,22 +273,22 @@ CGAL::Object Arr_qdx_topology_traits_2::place_boundary_vertex // done (Face *f, const X_monotone_curve_2& cv, CGAL::Arr_curve_end ind, - Arr_parameter_space bound_x, Arr_parameter_space bound_y) + Arr_parameter_space ps_x, Arr_parameter_space ps_y) { //std::cout << "Arr_qdx_topology_traits_2 place_boundary_vertex" // << std::endl; CGAL_precondition( - (bound_x == CGAL::ARR_INTERIOR && - (bound_y == CGAL::ARR_INTERIOR || - bound_y == CGAL::AFTER_DISCONTINUITY || - bound_y == CGAL::BEFORE_DISCONTINUITY)) + (ps_x == CGAL::ARR_INTERIOR && + (ps_y == CGAL::ARR_INTERIOR || + ps_y == CGAL::AFTER_DISCONTINUITY || + ps_y == CGAL::BEFORE_DISCONTINUITY)) || - ((bound_x == CGAL::MINUS_INFINITY || - bound_x == CGAL::PLUS_INFINITY || - bound_x == CGAL::AFTER_SINGULARITY || - bound_x == CGAL::BEFORE_SINGULARITY) && - bound_y == CGAL::ARR_INTERIOR) + ((ps_x == CGAL::MINUS_INFINITY || + ps_x == CGAL::PLUS_INFINITY || + ps_x == CGAL::AFTER_SINGULARITY || + ps_x == CGAL::BEFORE_SINGULARITY) && + ps_y == CGAL::ARR_INTERIOR) ); // this topology return either an empty object or a DCEL vertex, @@ -296,12 +296,12 @@ Arr_qdx_topology_traits_2::place_boundary_vertex // done Vertex *v = NULL; - if (bound_x != CGAL::ARR_INTERIOR) { + if (ps_x != CGAL::ARR_INTERIOR) { // for points at infinity/singularity // curve-end goes to v_left or to v_right - v = (bound_x < CGAL::ARR_INTERIOR ? this->v_left : this->v_right); + v = (ps_x < CGAL::ARR_INTERIOR ? this->v_left : this->v_right); } else { - CGAL_assertion(bound_y != CGAL::ARR_INTERIOR); + CGAL_assertion(ps_y != CGAL::ARR_INTERIOR); // locate curve-end (here a concrete point) // in local structure of for points on // line of discontiuity! @@ -326,8 +326,8 @@ Arr_qdx_topology_traits_2::place_boundary_vertex // done } // else we return the vertex we have located. - CGAL_assertion(v->parameter_space_in_x() == bound_x && - v->parameter_space_in_y() == bound_y); + CGAL_assertion(v->parameter_space_in_x() == ps_x && + v->parameter_space_in_y() == ps_y); CGAL_assertion(!v->has_null_point() || v->parameter_space_in_x() == CGAL::AFTER_SINGULARITY || @@ -345,16 +345,16 @@ typename Arr_qdx_topology_traits_2::Halfedge* Arr_qdx_topology_traits_2::locate_around_boundary_vertex (Vertex *v, const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, Arr_parameter_space bound_y) const + Arr_parameter_space ps_x, Arr_parameter_space ps_y) const { CGAL_precondition( - (bound_x == CGAL::ARR_INTERIOR || bound_y == CGAL::ARR_INTERIOR) && - !(bound_x != CGAL::ARR_INTERIOR && bound_y != CGAL::ARR_INTERIOR) + (ps_x == CGAL::ARR_INTERIOR || ps_y == CGAL::ARR_INTERIOR) && + !(ps_x != CGAL::ARR_INTERIOR && ps_y != CGAL::ARR_INTERIOR) ); // std::cout << "locate_around_boundary_vertex()" << std::endl; - if (bound_x == m_left && ind == CGAL::ARR_MIN_END) { - CGAL_assertion(bound_y == CGAL::ARR_INTERIOR); + if (ps_x == m_left && ind == CGAL::ARR_MIN_END) { + CGAL_assertion(ps_y == CGAL::ARR_INTERIOR); CGAL_assertion(v == v_left); bool dummy; return (_locate_around_vertex_with_boundary_at_x( @@ -362,8 +362,8 @@ Arr_qdx_topology_traits_2::locate_around_boundary_vertex ) ); } - if (bound_x == m_right && ind == CGAL::ARR_MAX_END) { - CGAL_assertion(bound_y == CGAL::ARR_INTERIOR); + if (ps_x == m_right && ind == CGAL::ARR_MAX_END) { + CGAL_assertion(ps_y == CGAL::ARR_INTERIOR); CGAL_assertion(v == v_right); bool dummy; return (_locate_around_vertex_with_boundary_at_x( @@ -372,9 +372,9 @@ Arr_qdx_topology_traits_2::locate_around_boundary_vertex ); } - CGAL_assertion(bound_x == CGAL::ARR_INTERIOR && - (bound_y == CGAL::AFTER_DISCONTINUITY) || - (bound_y == CGAL::BEFORE_DISCONTINUITY)); + CGAL_assertion(ps_x == CGAL::ARR_INTERIOR && + (ps_y == CGAL::AFTER_DISCONTINUITY) || + (ps_y == CGAL::BEFORE_DISCONTINUITY)); return (_locate_around_vertex_on_discontinuity (v, cv, ind)); } @@ -555,25 +555,25 @@ Arr_qdx_topology_traits_2::notify_on_boundary_vertex_creation (Vertex *v, const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y) const + Arr_parameter_space ps_x, + Arr_parameter_space ps_y) const { // In the planar-topology traits this function should never be invoked: //std::cout << "Arr_qdx_topology_traits_2::" // << "notify_on_boundary_vertex_creation" // << std::endl; - CGAL_assertion(v->parameter_space_in_x() == bound_x); - CGAL_assertion(v->parameter_space_in_y() == bound_y); + CGAL_assertion(v->parameter_space_in_x() == ps_x); + CGAL_assertion(v->parameter_space_in_y() == ps_y); // update locate structures - if (bound_x < CGAL::ARR_INTERIOR) { + if (ps_x < CGAL::ARR_INTERIOR) { //std::cout << "LEFT vertex created" << std::endl; this->v_left = v; CGAL_assertion(this->v_left->parameter_space_in_x() == m_left); return; } - if (bound_x > CGAL::ARR_INTERIOR) { + if (ps_x > CGAL::ARR_INTERIOR) { //std::cout << "RIGHT vertex created" << std::endl; this->v_right = v; CGAL_assertion(this->v_right->parameter_space_in_x() == m_right); @@ -581,7 +581,7 @@ Arr_qdx_topology_traits_2::notify_on_boundary_vertex_creation } // else: boundary in y - CGAL_assertion(bound_y != ARR_INTERIOR); + CGAL_assertion(ps_y != ARR_INTERIOR); CGAL_assertion(!v->has_null_point()); CGAL_assertion_code( @@ -623,13 +623,13 @@ Arr_qdx_topology_traits_2::notify_on_boundary_vertex_creation template CGAL::Object Arr_qdx_topology_traits_2:: // open locate_curve_end (const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, Arr_parameter_space bound_y) + Arr_parameter_space ps_x, Arr_parameter_space ps_y) { // NEEDED for incremental insertion std::cout << "Arr_qdx_topology_traits_2 locate_curve_end" << std::endl; - CGAL_precondition(bound_x != CGAL::ARR_INTERIOR || - bound_y != CGAL::ARR_INTERIOR); + CGAL_precondition(ps_x != CGAL::ARR_INTERIOR || + ps_y != CGAL::ARR_INTERIOR); Vertex* v = NULL; typename Line_of_discontinuity::iterator it; @@ -639,9 +639,9 @@ locate_curve_end (const X_monotone_curve_2& cv, Arr_curve_end ind, bool search_face = false; ); - if (bound_x != CGAL::ARR_INTERIOR) { + if (ps_x != CGAL::ARR_INTERIOR) { bool contraction = false; - switch (bound_x) { + switch (ps_x) { case AFTER_SINGULARITY: contraction = true; case MINUS_INFINITY: { @@ -680,7 +680,7 @@ locate_curve_end (const X_monotone_curve_2& cv, Arr_curve_end ind, } } - if (bound_y != CGAL::ARR_INTERIOR) { + if (ps_y != CGAL::ARR_INTERIOR) { Point_2 key = (ind == CGAL::ARR_MIN_END ? this->m_traits->construct_min_vertex_2_object()(cv) : this->m_traits->construct_max_vertex_2_object()(cv)); @@ -1044,10 +1044,10 @@ bool Arr_qdx_topology_traits_2::is_in_face // open return (false); } - CGAL::Arr_parameter_space bound_x = curr->opposite()->vertex()->parameter_space_in_x(); - if (bound_x < 0) { + CGAL::Arr_parameter_space ps_x = curr->opposite()->vertex()->parameter_space_in_x(); + if (ps_x < 0) { res_source = CGAL::LARGER; - } else if (bound_x > 0) { + } else if (ps_x > 0) { res_source = CGAL::SMALLER; } else { res_source = this->m_traits->compare_xy_2_object() ( @@ -1087,10 +1087,10 @@ bool Arr_qdx_topology_traits_2::is_in_face // open return (false); } - bound_x = curr->vertex()->parameter_space_in_x(); - if (bound_x < 0) { + ps_x = curr->vertex()->parameter_space_in_x(); + if (ps_x < 0) { res_target = CGAL::LARGER; - } else if (bound_x > 0) { + } else if (ps_x > 0) { res_target = CGAL::SMALLER; } else { res_target = this->m_traits->compare_xy_2_object() 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 4c57e3a7637..61da9880420 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 @@ -66,9 +66,10 @@ protected: // Data members: //! The topology-traits class - Topology_traits * m_top_traits; - Arr_accessor - m_arr_access; // An arrangement accessor. + Topology_traits * m_top_traits; + + //! An arrangement accessor + Arr_accessor m_arr_access; //! The unbounded arrangement face Face_handle m_spherical_face; @@ -107,11 +108,11 @@ public: virtual void before_handle_event(Event * event) { // Act according to the boundary type: - const Arr_parameter_space bound_x = event->parameter_space_in_x(); - const Arr_parameter_space bound_y = event->parameter_space_in_y(); + Arr_parameter_space ps_x = event->parameter_space_in_x(); + Arr_parameter_space ps_y = event->parameter_space_in_y(); - if (bound_y == AFTER_SINGULARITY) - { + if (ps_y == ARR_BOTTOM_BOUNDARY) { + // Bootom contraction boundary: // The event has only one (right or left) curve. CGAL_assertion(((event->number_of_left_curves() == 0) && (event->number_of_right_curves() == 1)) || @@ -129,7 +130,7 @@ public: if (m_top_traits->south_pole() == NULL) { Vertex_handle v = - m_arr_access.create_boundary_vertex (xc, ind, bound_x, bound_y); + m_arr_access.create_boundary_vertex (xc, ind, ps_x, ps_y); event->set_vertex_handle(v); } else @@ -139,8 +140,8 @@ public: return; } - if (bound_y == BEFORE_SINGULARITY) - { + if (ps_y == ARR_TOP_BOUNDARY) { + // Top contraction boundary: // The event has only one (right or left) curve. CGAL_assertion(((event->number_of_left_curves() == 0) && (event->number_of_right_curves() == 1)) || @@ -159,7 +160,7 @@ public: if (m_top_traits->north_pole() == NULL) { Vertex_handle v = - m_arr_access.create_boundary_vertex (xc, ind, bound_x, bound_y); + m_arr_access.create_boundary_vertex (xc, ind, ps_x, ps_y); event->set_vertex_handle(v); // Since this is the first event corresponding to the north pole, @@ -178,7 +179,7 @@ public: DHalfedge * dprev = m_top_traits->locate_around_boundary_vertex(m_top_traits-> north_pole(), xc, ind, - bound_x, bound_y); + ps_x, ps_y); if (dprev != NULL) { @@ -203,8 +204,7 @@ public: return; } - if (bound_x == AFTER_DISCONTINUITY) - { + if (ps_x == ARR_LEFT_BOUNDARY) { // The event has only right curves. CGAL_assertion(event->number_of_left_curves() == 0 && event->number_of_right_curves() == 1); @@ -217,8 +217,7 @@ public: if (v == NULL) { Vertex_handle vh = - m_arr_access.create_boundary_vertex (xc, ARR_MIN_END, - bound_x, bound_y); + m_arr_access.create_boundary_vertex (xc, ARR_MIN_END, ps_x, ps_y); event->set_vertex_handle(vh); } else @@ -228,8 +227,7 @@ public: return; } - if (bound_x == BEFORE_DISCONTINUITY) - { + if (ps_x == ARR_RIGHT_BOUNDARY) { // The event has only left curves. CGAL_assertion(event->number_of_left_curves() == 1 && event->number_of_right_curves() == 0); @@ -242,8 +240,7 @@ public: if (v == NULL) { Vertex_handle vh = - m_arr_access.create_boundary_vertex (xc, ARR_MAX_END, - bound_x, bound_y); + m_arr_access.create_boundary_vertex (xc, ARR_MAX_END, ps_x, ps_y); event->set_vertex_handle(vh); } else @@ -286,7 +283,7 @@ public: // If we insert an edge whose right end lies on the north pole, we have // to flip the order of predecessor halfegdes. return (event->parameter_space_in_x() == ARR_INTERIOR && - event->parameter_space_in_y() == BEFORE_SINGULARITY); + event->parameter_space_in_y() == ARR_TOP_BOUNDARY); } /*! Get the current top face. */ 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 e2a4bf93f6a..68719d8304f 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 @@ -109,10 +109,10 @@ void Arr_spherical_insertion_helper::before_handle_event (Event* event) { // Ignore events that do not have boundary conditions. - const Arr_parameter_space bound_x = event->parameter_space_in_x(); - const Arr_parameter_space bound_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(); - if (bound_x == ARR_INTERIOR && bound_y == ARR_INTERIOR) + if (ps_x == ARR_INTERIOR && ps_y == ARR_INTERIOR) return; // The is exactly one curve incident to an event with boundary conditions. @@ -122,12 +122,12 @@ void Arr_spherical_insertion_helper::before_handle_event ((event->number_of_left_curves() == 1) && (event->number_of_right_curves() == 0))); - const Arr_curve_end ind = (event->number_of_left_curves() == 0 && - event->number_of_right_curves() == 1) ? ARR_MIN_END : - ARR_MAX_END; + 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(); + (*(event->right_curves_begin()))->last_curve() : + (*(event->left_curves_begin()))->last_curve(); if (xc.halfedge_handle() == Halfedge_handle()) { @@ -140,14 +140,12 @@ void Arr_spherical_insertion_helper::before_handle_event // In case we encounter an existing curve incident to the curve of // discontinuity (and exteding to its right) or to the north pole, // we have to update the current top face (the spherical face). - if (bound_y == BEFORE_SINGULARITY) + if (ps_y == ARR_TOP_BOUNDARY) { - if (ind == ARR_MIN_END) - this->m_spherical_face = xc.halfedge_handle()->twin()->face(); - else - this->m_spherical_face = xc.halfedge_handle()->face(); + this->m_spherical_face = (ind == ARR_MIN_END) ? + xc.halfedge_handle()->twin()->face() : xc.halfedge_handle()->face(); } - else if (bound_x == AFTER_DISCONTINUITY) + else if (ps_x == ARR_LEFT_BOUNDARY) { CGAL_assertion (ind == ARR_MIN_END); this->m_spherical_face = xc.halfedge_handle()->twin()->face(); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_overlay_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_overlay_helper.h index 30280a2b129..5877c0d46c0 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_overlay_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_overlay_helper.h @@ -104,8 +104,8 @@ public: */ void before_handle_event(Event * event) { - if (event->parameter_space_in_y() != BEFORE_SINGULARITY && - event->parameter_space_in_x() != AFTER_DISCONTINUITY) + if (event->parameter_space_in_y() != ARR_TOP_BOUNDARY && + event->parameter_space_in_x() != ARR_LEFT_BOUNDARY) return; Arr_curve_end ind = (event->number_of_left_curves() == 0 && @@ -116,7 +116,7 @@ public: (*(event->right_curves_begin())) : (*(event->left_curves_begin())); - if (event->parameter_space_in_y() == BEFORE_SINGULARITY) + if (event->parameter_space_in_y() == ARR_TOP_BOUNDARY) { // The curve is incident to the north pole. switch (sc->color()) { diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h index 977df1e300e..c775af241d6 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h @@ -92,9 +92,9 @@ void Arr_spherical_topology_traits_2::dcel_updated() // Go over the DCEL vertices and locate the south and north pole (if any) // and any other vertex on the line of discontinuity. typename Dcel::Vertex_iterator vit; - Arr_parameter_space bx, by; + Arr_parameter_space bx, by; Halfedge *he; - Arr_curve_end ind; + Arr_curve_end ind; m_north_pole = NULL; m_south_pole = NULL; @@ -106,8 +106,8 @@ void Arr_spherical_topology_traits_2::dcel_updated() bx = vit->parameter_space_in_x(); by = vit->parameter_space_in_y(); - if (by == AFTER_SINGULARITY) m_south_pole = &(*vit); - else if (by == BEFORE_SINGULARITY) m_north_pole = &(*vit); + if (by == ARR_BOTTOM_BOUNDARY) m_south_pole = &(*vit); + else if (by == ARR_TOP_BOUNDARY) m_north_pole = &(*vit); else if (bx != ARR_INTERIOR) { const Point_2 & key = vit->point(); m_boundary_vertices.insert(Vertex_value(key, &(*vit))); @@ -119,8 +119,7 @@ void Arr_spherical_topology_traits_2::dcel_updated() typename Dcel::Face_iterator fit; m_spherical_face = NULL; - for (fit = this->m_dcel.faces_begin(); - fit != this->m_dcel.faces_end(); ++fit) + for (fit = this->m_dcel.faces_begin(); fit != this->m_dcel.faces_end(); ++fit) { if (fit->number_of_outer_ccbs() == 0) { @@ -175,25 +174,25 @@ is_in_face(const Face * f, const Point_2 & p, const Vertex * v) const << std::endl; #endif if (f->number_of_outer_ccbs() == 0) return true; - if (((v != NULL) && (v->parameter_space_in_y() == BEFORE_SINGULARITY)) || - (m_traits->parameter_space_in_y_2_object()(p) == BEFORE_SINGULARITY)) + if (((v != NULL) && (v->parameter_space_in_y() == ARR_TOP_BOUNDARY)) || + (m_traits->parameter_space_in_y_2_object()(p) == ARR_TOP_BOUNDARY)) return false; /*! \todo a temporary test - * if (((v != NULL) && (v->parameter_space_in_y() == AFTER_SINGULARITY)) || + * if (((v != NULL) && (v->parameter_space_in_y() == ARR_BOTTOM_BOUNDARY)) || * (p.is_min_boundary())) * return false; */ - typename Traits_adaptor_2::Parameter_space_in_x_2 parameter_space_in_x = + typename Traits_adaptor_2::Parameter_space_in_x_2 ps_x_op = m_traits->parameter_space_in_x_2_object(); - typename Traits_adaptor_2::Parameter_space_in_y_2 parameter_space_in_y = + typename Traits_adaptor_2::Parameter_space_in_y_2 ps_y_op = m_traits->parameter_space_in_y_2_object(); - typename Traits_adaptor_2::Compare_x_2 compare_x = + typename Traits_adaptor_2::Compare_x_2 cmp_x_op = m_traits->compare_x_2_object(); - typename Traits_adaptor_2::Compare_y_at_x_2 compare_y_at_x = + typename Traits_adaptor_2::Compare_y_at_x_2 cmp_y_at_x_op = m_traits->compare_y_at_x_2_object(); - typename Traits_adaptor_2::Compare_x_near_boundary_2 compare_x_near_bnd = + typename Traits_adaptor_2::Compare_x_near_boundary_2 cmp_x_near_bnd = m_traits->compare_x_near_boundary_2_object(); /* Maintain a counter of the number of x-monotone curves that intersect an @@ -266,14 +265,14 @@ is_in_face(const Face * f, const Point_2 & p, const Vertex * v) const * lies horizontaly between the two vertical curves that meet at * the north pole, increase the intersection counter */ - Arr_parameter_space bnd1 = parameter_space_in_y(curr->curve(), ARR_MAX_END); - Arr_parameter_space bnd2 = parameter_space_in_y(curr->next()->curve(), ARR_MAX_END); - if ((bnd1 == BEFORE_SINGULARITY) && (bnd2 == BEFORE_SINGULARITY)) { + Arr_parameter_space bnd1 = ps_y_op(curr->curve(), ARR_MAX_END); + Arr_parameter_space bnd2 = ps_y_op(curr->next()->curve(), ARR_MAX_END); + if ((bnd1 == ARR_TOP_BOUNDARY) && (bnd2 == ARR_TOP_BOUNDARY)) { // Compare the x-coordinates: Comparison_result rc1 = - compare_x_near_bnd(p, curr->curve(), ARR_MAX_END); + cmp_x_near_bnd(p, curr->curve(), ARR_MAX_END); Comparison_result rc2 = - compare_x_near_bnd(p, curr->next()->curve(), ARR_MAX_END); + cmp_x_near_bnd(p, curr->next()->curve(), ARR_MAX_END); if (rc1 == opposite(rc2)) ++num_intersections; } curr = curr->next(); @@ -304,8 +303,8 @@ is_in_face(const Face * f, const Point_2 & p, const Vertex * v) const ind_target = ARR_MIN_END; } - bnd_source = parameter_space_in_x(curr->curve(), ind_source); - bnd_target = parameter_space_in_x(curr->curve(), ind_target); + bnd_source = ps_x_op(curr->curve(), ind_source); + bnd_target = ps_x_op(curr->curve(), ind_target); if (bnd_p != ARR_INTERIOR) { if (bnd_source == bnd_target) { @@ -315,21 +314,21 @@ is_in_face(const Face * f, const Point_2 & p, const Vertex * v) const if (bnd_target != ARR_INTERIOR) { change_pending = true; - bnd_pending = (bnd_target == AFTER_DISCONTINUITY) ? - BEFORE_DISCONTINUITY : AFTER_DISCONTINUITY; + bnd_pending = (bnd_target == ARR_LEFT_BOUNDARY) ? + ARR_RIGHT_BOUNDARY : ARR_LEFT_BOUNDARY; } if (bnd_source != ARR_INTERIOR) { if (change_pending) { change_pending = false; if (bnd_pending == bnd_source) { - Comparison_result res_y_at_x = compare_y_at_x(p, curr->curve()); + Comparison_result res_y_at_x = cmp_y_at_x_op(p, curr->curve()); if (res_y_at_x == EQUAL) return false; if (res_y_at_x == SMALLER) num_intersections++; } } else { // This must be the first curve. Remember to check the last curve - bnd_last = (bnd_source == AFTER_DISCONTINUITY) ? - BEFORE_DISCONTINUITY : AFTER_DISCONTINUITY; + bnd_last = (bnd_source == ARR_LEFT_BOUNDARY) ? + ARR_RIGHT_BOUNDARY : ARR_LEFT_BOUNDARY; last_pending = true; } } @@ -338,12 +337,12 @@ is_in_face(const Face * f, const Point_2 & p, const Vertex * v) const } res_source = (bnd_source == ARR_INTERIOR) ? - compare_x(p, curr->opposite()->vertex()->point()) : - compare_x_near_bnd(p, curr->curve(), ind_source); + cmp_x_op(p, curr->opposite()->vertex()->point()) : + cmp_x_near_bnd(p, curr->curve(), ind_source); res_target = (bnd_target == ARR_INTERIOR) ? - compare_x(p, curr->vertex()->point()) : - compare_x_near_bnd(p, curr->curve(), ind_target); + cmp_x_op(p, curr->vertex()->point()) : + cmp_x_near_bnd(p, curr->curve(), ind_target); /* If a vertical ray is shot from p upward, the x-monotone curve * associated with curr is hit once. @@ -361,7 +360,7 @@ is_in_face(const Face * f, const Point_2 & p, const Vertex * v) const if (change_pending) { change_pending = false; if (res_pending == res_target) { - Comparison_result res_y_at_x = compare_y_at_x(p, curr->curve()); + Comparison_result res_y_at_x = cmp_y_at_x_op(p, curr->curve()); if (res_y_at_x == EQUAL) return false; if (res_y_at_x == SMALLER) num_intersections++; } @@ -381,7 +380,7 @@ is_in_face(const Face * f, const Point_2 & p, const Vertex * v) const if (last_pending) { if (bnd_p != ARR_INTERIOR) { if (bnd_last == bnd_target) { - Comparison_result res_y_at_x = compare_y_at_x(p, curr->curve()); + Comparison_result res_y_at_x = cmp_y_at_x_op(p, curr->curve()); if (res_y_at_x == EQUAL) return false; if (res_y_at_x == SMALLER) num_intersections++; } @@ -389,7 +388,7 @@ is_in_face(const Face * f, const Point_2 & p, const Vertex * v) const } if (res_last == res_source) { - Comparison_result res_y_at_x = compare_y_at_x(p, curr->curve()); + Comparison_result res_y_at_x = cmp_y_at_x_op(p, curr->curve()); if (res_y_at_x == EQUAL) return false; if (res_y_at_x == SMALLER) num_intersections++; } @@ -419,7 +418,7 @@ template bool Arr_spherical_topology_traits_2:: are_equal(const Vertex * v, const X_monotone_curve_2 & xc, Arr_curve_end ind, - Arr_parameter_space bound_x, Arr_parameter_space bound_y) const + Arr_parameter_space ps_x, Arr_parameter_space ps_y) const { #if 0 std::cout << "are_equal" @@ -427,22 +426,20 @@ are_equal(const Vertex * v, << ", xc: " << xc << ", " << ind << std::endl; #endif - CGAL_precondition (bound_x == AFTER_DISCONTINUITY || - bound_x == BEFORE_DISCONTINUITY || - bound_y == AFTER_SINGULARITY || - bound_y == BEFORE_SINGULARITY); + CGAL_precondition (ps_x == ARR_LEFT_BOUNDARY || ps_x == ARR_RIGHT_BOUNDARY || + ps_y == ARR_BOTTOM_BOUNDARY || ps_y == ARR_TOP_BOUNDARY); // If the given boundary conditions do not match those of the given // vertex, v cannot represent the curve end. - if (bound_y != v->parameter_space_in_y()) return false; + if (ps_y != v->parameter_space_in_y()) return false; - if (bound_y != ARR_INTERIOR) return (bound_y == v->parameter_space_in_y()); + if (ps_y != ARR_INTERIOR) return (ps_y == v->parameter_space_in_y()); - if (((bound_x == ARR_INTERIOR) && (v->parameter_space_in_x() != ARR_INTERIOR)) || - ((bound_x != ARR_INTERIOR) && (v->parameter_space_in_x() == ARR_INTERIOR))) + if (((ps_x == ARR_INTERIOR) && (v->parameter_space_in_x() != ARR_INTERIOR)) || + ((ps_x != ARR_INTERIOR) && (v->parameter_space_in_x() == ARR_INTERIOR))) return false; - CGAL_assertion(bound_x != ARR_INTERIOR); + CGAL_assertion(ps_x != ARR_INTERIOR); /* Both vertices have the same x boundary conditions => * comapare their y-position. */ @@ -460,19 +457,20 @@ Arr_spherical_topology_traits_2:: notify_on_boundary_vertex_creation(Vertex * v, const X_monotone_curve_2 & xc, Arr_curve_end ind, - Arr_parameter_space CGAL_assertion_code(bound_x), - Arr_parameter_space bound_y) + Arr_parameter_space + CGAL_assertion_code(ps_x), + Arr_parameter_space ps_y) { // std::cout << "notify_on_boundary_vertex_creation()" << std::endl; - if (bound_y == AFTER_SINGULARITY) { + if (ps_y == ARR_BOTTOM_BOUNDARY) { m_south_pole = v; return; } - if (bound_y == BEFORE_SINGULARITY) { + if (ps_y == ARR_TOP_BOUNDARY) { m_north_pole = v; return; } - CGAL_assertion(bound_x != ARR_INTERIOR); + CGAL_assertion(ps_x != ARR_INTERIOR); const Point_2 & key = (ind == ARR_MIN_END) ? m_traits->construct_min_vertex_2_object()(xc) : m_traits->construct_max_vertex_2_object()(xc); @@ -487,21 +485,20 @@ CGAL::Object Arr_spherical_topology_traits_2:: place_boundary_vertex(Face * /* f */, const X_monotone_curve_2 & xc, Arr_curve_end ind, - Arr_parameter_space bound_x, Arr_parameter_space bound_y) + Arr_parameter_space ps_x, Arr_parameter_space ps_y) { // std::cout << "place_boundary_vertex()" << std::endl; - if (bound_y == AFTER_SINGULARITY) { + if (ps_y == ARR_BOTTOM_BOUNDARY) { if (m_south_pole == NULL) return Object(); return CGAL::make_object(m_south_pole); } - if (bound_y == BEFORE_SINGULARITY) { + if (ps_y == ARR_TOP_BOUNDARY) { if (m_north_pole == NULL) return Object(); return CGAL::make_object(m_north_pole); } - CGAL_assertion((bound_x == AFTER_DISCONTINUITY) || - (bound_x == BEFORE_DISCONTINUITY)); + CGAL_assertion((ps_x == ARR_LEFT_BOUNDARY) || (ps_x == ARR_RIGHT_BOUNDARY)); const Point_2 & key = (ind == ARR_MIN_END) ? m_traits->construct_min_vertex_2_object()(xc) : @@ -525,22 +522,21 @@ Arr_spherical_topology_traits_2:: locate_around_boundary_vertex(Vertex * v, const X_monotone_curve_2 & xc, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y) const + Arr_parameter_space ps_x, + Arr_parameter_space ps_y) const { // std::cout << "locate_around_boundary_vertex()" << std::endl; - if (bound_y == AFTER_SINGULARITY) { + if (ps_y == ARR_BOTTOM_BOUNDARY) { CGAL_assertion(v == m_south_pole); return (_locate_around_pole(m_south_pole, xc, ind)); } - if (bound_y == BEFORE_SINGULARITY) { + if (ps_y == ARR_TOP_BOUNDARY) { CGAL_assertion(v == m_north_pole); return (_locate_around_pole(m_north_pole, xc, ind)); } - CGAL_assertion((bound_x == AFTER_DISCONTINUITY) || - (bound_x == BEFORE_DISCONTINUITY)); + CGAL_assertion((ps_x == ARR_LEFT_BOUNDARY) || (ps_x == ARR_RIGHT_BOUNDARY)); return (_locate_around_vertex_on_discontinuity(v, xc, ind)); } @@ -549,10 +545,10 @@ locate_around_boundary_vertex(Vertex * v, template CGAL::Object Arr_spherical_topology_traits_2:: locate_curve_end(const X_monotone_curve_2 & xc, Arr_curve_end ind, - Arr_parameter_space bound_x, Arr_parameter_space bound_y) + Arr_parameter_space ps_x, Arr_parameter_space ps_y) { // Act according to the boundary conditions. - if (bound_y == BEFORE_SINGULARITY) { + if (ps_y == ARR_TOP_BOUNDARY) { // In case the curve end coincides with the north pole, return the vertex // representing the north pole, if one exists. Otherwise, return the face // containing this pole (the spherical face). @@ -563,7 +559,7 @@ locate_curve_end(const X_monotone_curve_2 & xc, Arr_curve_end ind, typename Vertex_map::iterator it; Vertex *v = NULL; - if (bound_y == AFTER_SINGULARITY) { + if (ps_y == ARR_BOTTOM_BOUNDARY) { // In case the curve end coincides with the south pole, return the vertex // representing the south pole, if one exists. Otherwise, search for the // face containing this pole. @@ -571,8 +567,8 @@ locate_curve_end(const X_monotone_curve_2 & xc, Arr_curve_end ind, it = m_boundary_vertices.begin(); } else { - CGAL_assertion((bound_x == AFTER_DISCONTINUITY) || - (bound_x == BEFORE_DISCONTINUITY)); + CGAL_assertion((ps_x == ARR_LEFT_BOUNDARY) || + (ps_x == ARR_RIGHT_BOUNDARY)); // Check if the given curve end is incident to a vertex on the line of // discontinuity. If so, return this vertex. Otherwise, locate the first @@ -615,17 +611,17 @@ typename Arr_spherical_topology_traits_2::Halfedge * Arr_spherical_topology_traits_2:: erase_redundant_vertex(Vertex * v) { - const Arr_parameter_space bound_y = v->parameter_space_in_y(); - if (bound_y == AFTER_SINGULARITY) { + const Arr_parameter_space ps_y = v->parameter_space_in_y(); + if (ps_y == ARR_BOTTOM_BOUNDARY) { m_south_pole = NULL; return NULL; } - if (bound_y == BEFORE_SINGULARITY) { + if (ps_y == ARR_TOP_BOUNDARY) { m_north_pole = NULL; return NULL; } - CGAL_assertion_code(const Arr_parameter_space bound_x = v->parameter_space_in_x();); - CGAL_assertion(bound_x != ARR_INTERIOR); + CGAL_assertion_code(Arr_parameter_space ps_x = v->parameter_space_in_x()); + CGAL_assertion(ps_x != ARR_INTERIOR); m_boundary_vertices.erase(v->point()); return NULL; } @@ -674,7 +670,8 @@ _locate_around_vertex_on_discontinuity(Vertex * v, bool eq_curr, eq_next; while (!is_between_cw(xc, (ind == ARR_MIN_END), curr->curve(), - (curr->direction() == ARR_RIGHT_TO_LEFT), next->curve(), + (curr->direction() == ARR_RIGHT_TO_LEFT), + next->curve(), (next->direction() == ARR_RIGHT_TO_LEFT), v->point(), eq_curr, eq_next)) { @@ -727,7 +724,7 @@ _locate_around_pole(Vertex * v, // Traverse all other halfedges, and compare their x-positions next to the // pole with the query curve xc. - typename Traits_adaptor_2::Compare_x_near_boundary_2 cmp_x = + typename Traits_adaptor_2::Compare_x_near_boundary_2 cmp_x_near_bnd = m_traits->compare_x_near_boundary_2_object(); Arr_curve_end curr_end, next_end; Comparison_result curr_res, next_res; @@ -735,12 +732,13 @@ _locate_around_pole(Vertex * v, curr_end = (curr->direction() == ARR_RIGHT_TO_LEFT) ? ARR_MIN_END : ARR_MAX_END; - curr_res = cmp_x(xc, ind, curr->curve(), curr_end); + curr_res = cmp_x_near_bnd(xc, ind, curr->curve(), curr_end); do { next_end = (next->direction() == ARR_RIGHT_TO_LEFT) ? ARR_MIN_END : ARR_MAX_END; - next_res = cmp_x(xc, ind, next->curve(), next_end); - curr_next_res = cmp_x(curr->curve(), curr_end, next->curve(), next_end); + next_res = cmp_x_near_bnd(xc, ind, next->curve(), next_end); + curr_next_res = + cmp_x_near_bnd(curr->curve(), curr_end, next->curve(), next_end); if (curr_next_res == cross_res) { // The line of discontinuity must lie between curr and next, so the // comparison result of xc with the two curves should be equal: @@ -795,10 +793,10 @@ _face_below_vertex_on_discontinuity(Vertex * v) const // Otherwise, we traverse the halfedges around v and locate the first // halfedge we encounter if we go from "6 o'clock" clockwise. // First locate the lower left and the top right halfedges around v. - typename Traits_adaptor_2::Compare_y_at_x_right_2 compare_y_at_x_right = - m_traits->compare_y_at_x_right_2_object(); - typename Traits_adaptor_2::Compare_y_at_x_left_2 compare_y_at_x_left = - m_traits->compare_y_at_x_left_2_object(); + typename Traits_adaptor_2::Compare_y_at_x_right_2 cmp_y_at_x_op_right = + m_traits->compare_y_at_x_right_2_object(); + typename Traits_adaptor_2::Compare_y_at_x_left_2 cmp_y_at_x_op_left = + m_traits->compare_y_at_x_left_2_object(); Halfedge *lowest_left = NULL; Halfedge *top_right = NULL; @@ -811,7 +809,7 @@ _face_below_vertex_on_discontinuity(Vertex * v) const // The curve associated with the current halfedge is defined to the left // of v. if (lowest_left == NULL || - compare_y_at_x_left(curr->curve(), lowest_left->curve(), v->point()) + cmp_y_at_x_op_left(curr->curve(), lowest_left->curve(), v->point()) == SMALLER) { lowest_left = curr; @@ -822,7 +820,7 @@ _face_below_vertex_on_discontinuity(Vertex * v) const // The curve associated with the current halfedge is defined to the right // of v. if (top_right == NULL || - compare_y_at_x_right(curr->curve(), top_right->curve(), v->point()) + cmp_y_at_x_op_right(curr->curve(), top_right->curve(), v->point()) == LARGER) { top_right = curr; @@ -868,7 +866,7 @@ is_on_new_perimetric_face_boundary(const Halfedge * prev1, * contains everythin is incident to the north pole. * We count the number of times that path from prev1 to prev2 crosses the * discontinuity arc from left and from right, that is from - * AFTER_DISCONTINUITY to BEFORE_DISCONTINUITY, and the number of times it + * ARR_LEFT_BOUNDARY to ARR_RIGHT_BOUNDARY, and the number of times it * crosses the other way around. */ #if 1 @@ -881,7 +879,7 @@ is_on_new_perimetric_face_boundary(const Halfedge * prev1, << prev2->vertex()->point() << std::endl; #endif int counter = 0; - typename Traits_adaptor_2::Parameter_space_in_x_2 parameter_space_in_x = + typename Traits_adaptor_2::Parameter_space_in_x_2 ps_x_op = m_traits->parameter_space_in_x_2_object(); // Start with the next of prev1: @@ -896,8 +894,8 @@ is_on_new_perimetric_face_boundary(const Halfedge * prev1, curr_src_ind = ARR_MAX_END; curr_trg_ind = ARR_MIN_END; } - Arr_parameter_space first_src_bc = parameter_space_in_x(curr->curve(), curr_src_ind); - Arr_parameter_space curr_trg_bc = parameter_space_in_x(curr->curve(), curr_trg_ind); + Arr_parameter_space first_src_ps = ps_x_op(curr->curve(), curr_src_ind); + Arr_parameter_space curr_trg_ps = ps_x_op(curr->curve(), curr_trg_ind); while (curr != prev2) { const Halfedge * next = curr->next(); Arr_curve_end next_src_ind; @@ -909,21 +907,21 @@ is_on_new_perimetric_face_boundary(const Halfedge * prev1, next_src_ind = ARR_MAX_END; next_trg_ind = ARR_MIN_END; } - Arr_parameter_space next_src_bc = parameter_space_in_x(next->curve(), next_src_ind); - Arr_parameter_space next_trg_bc = parameter_space_in_x(next->curve(), next_trg_ind); - if (curr_trg_bc != next_src_bc) { - if (curr_trg_bc == BEFORE_DISCONTINUITY) ++counter; + Arr_parameter_space next_src_ps = ps_x_op(next->curve(), next_src_ind); + Arr_parameter_space next_trg_ps = ps_x_op(next->curve(), next_trg_ind); + if (curr_trg_ps != next_src_ps) { + if (curr_trg_ps == ARR_RIGHT_BOUNDARY) ++counter; else --counter; } curr = next; - curr_trg_bc = next_trg_bc; + curr_trg_ps = next_trg_ps; } - Arr_parameter_space last_trg_bc = curr_trg_bc; - if (last_trg_bc != first_src_bc) { - if (last_trg_bc == BEFORE_DISCONTINUITY) ++counter; - else if (last_trg_bc == AFTER_DISCONTINUITY) --counter; - else if (first_src_bc == AFTER_DISCONTINUITY) ++counter; - else if (first_src_bc == BEFORE_DISCONTINUITY) --counter; + Arr_parameter_space last_trg_ps = curr_trg_ps; + if (last_trg_ps != first_src_ps) { + if (last_trg_ps == ARR_RIGHT_BOUNDARY) ++counter; + else if (last_trg_ps == ARR_LEFT_BOUNDARY) --counter; + else if (first_src_ps == ARR_LEFT_BOUNDARY) ++counter; + else if (first_src_ps == ARR_RIGHT_BOUNDARY) --counter; } // a temporary fix in case that if we traverse from prev1 to prev2 then diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h index 6740527a60e..44c96b11ff8 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h @@ -87,19 +87,15 @@ public: /*! Get the current top object. */ CGAL::Object top_object () const { - if (m_valid_north_pole) - return (CGAL::make_object (m_north_pole)); - else - return (CGAL::make_object (m_north_face)); + return (m_valid_north_pole) ? + CGAL::make_object (m_north_pole) : CGAL::make_object (m_north_face); } /*! Get the current bottom object. */ CGAL::Object bottom_object () const { - if (m_valid_south_pole) - return (CGAL::make_object (m_south_pole)); - else - return (CGAL::make_object (m_south_face)); + return (m_valid_south_pole) ? + CGAL::make_object(m_south_pole) : CGAL::make_object(m_south_face); } }; @@ -126,8 +122,6 @@ void Arr_spherical_vert_decomp_helper::before_sweep() m_south_pole = Vertex_const_handle (m_top_traits->south_pole()); m_south_face = Face_const_handle (m_top_traits->south_face()); - - return; } //----------------------------------------------------------------------------- @@ -149,14 +143,14 @@ 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 = (event->number_of_left_curves() == 0 && - event->number_of_right_curves() == 1) ? ARR_MIN_END : - ARR_MAX_END; + 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(); + (*(event->right_curves_begin()))->last_curve() : + (*(event->left_curves_begin()))->last_curve(); - if (event->parameter_space_in_y() == BEFORE_SINGULARITY) + 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) @@ -164,7 +158,7 @@ Arr_spherical_vert_decomp_helper::after_handle_event (Event *event) else m_north_face = xc.halfedge_handle()->face(); } - else if (event->parameter_space_in_y() == AFTER_SINGULARITY) + 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) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_torus_construction_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_torus_construction_helper.h index 0ea4b43c10f..20d551475d8 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_torus_construction_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_torus_construction_helper.h @@ -109,23 +109,23 @@ public: */ virtual void before_handle_event(Event * event) { - const Arr_parameter_space bound_x = event->parameter_space_in_x(); - const Arr_parameter_space bound_y = event->parameter_space_in_y(); + Arr_parameter_space ps_x = event->parameter_space_in_x(); + Arr_parameter_space ps_y = event->parameter_space_in_y(); //std::cout << "HELPER: event: " << event->point() << std::endl; - if (bound_x != CGAL::ARR_INTERIOR) { - //std::cout << "HELPER: before x " << bound_x << std::endl; - CGAL_assertion(bound_x == CGAL::BEFORE_DISCONTINUITY || - bound_x == CGAL::AFTER_DISCONTINUITY); - CGAL_assertion(bound_y == CGAL::ARR_INTERIOR); + if (ps_x != ARR_INTERIOR) { + //std::cout << "HELPER: before x " << ps_x << std::endl; + CGAL_assertion(ps_x == ARR_RIGHT_BOUNDARY || + ps_x == ARR_LEFT_BOUNDARY); + CGAL_assertion(ps_y == ARR_INTERIOR); CGAL_assertion(event->number_of_left_curves() + event->number_of_right_curves() >= 1); // TODO isolated point // added for hole-location - if (bound_x == CGAL::AFTER_DISCONTINUITY && + if (ps_x == ARR_LEFT_BOUNDARY && m_top_traits->is_identification_WE_empty()) { // The list m_subcurves_at_tf contains all subcurves // whose left endpoint lies between the curve of @@ -140,18 +140,18 @@ public: } const X_monotone_curve_2 & xc = - (bound_x == CGAL::AFTER_DISCONTINUITY ? + (ps_x == ARR_LEFT_BOUNDARY ? // AFTER DISCONTINUITY (*(event->right_curves_begin()))->last_curve() : // BEFORE_DISCONTINUITY (*(event->left_curves_rbegin()))->last_curve() ); - CGAL::Arr_curve_end ind = (bound_x == CGAL::AFTER_DISCONTINUITY ? - CGAL::ARR_MIN_END : CGAL::ARR_MAX_END); + Arr_curve_end ind = (ps_x == ARR_LEFT_BOUNDARY ? + ARR_MIN_END : ARR_MAX_END); const Point_2& key = - (ind == CGAL::ARR_MIN_END ? + (ind == ARR_MIN_END ? this->m_top_traits->geometry_traits()-> construct_min_vertex_2_object()(xc) : this->m_top_traits->geometry_traits()-> @@ -164,7 +164,7 @@ public: if (v == NULL) { vh = m_arr_access.create_boundary_vertex( xc, ind, - bound_x, bound_y + ps_x, ps_y ); } @@ -173,18 +173,18 @@ public: return; } - if (bound_y != CGAL::ARR_INTERIOR) { - //std::cout << "HELPER: before y " << bound_y << std::endl; - CGAL_assertion(bound_y == CGAL::BEFORE_DISCONTINUITY || - bound_y == CGAL::AFTER_DISCONTINUITY); - CGAL_assertion(bound_x == CGAL::ARR_INTERIOR); + if (ps_y != ARR_INTERIOR) { + //std::cout << "HELPER: before y " << ps_y << std::endl; + CGAL_assertion(ps_y == ARR_TOP_BOUNDARY || + ps_y == ARR_BOTTOM_BOUNDARY); + CGAL_assertion(ps_x == ARR_INTERIOR); CGAL_assertion(event->number_of_left_curves() + event->number_of_right_curves() >= 1); // TODO isolated point // added for hole-location - if (bound_y == CGAL::BEFORE_DISCONTINUITY && + if (ps_y == ARR_TOP_BOUNDARY && m_top_traits->is_identification_NS_empty()) { // The list m_subcurves_at_tf contains all subcurves // whose left endpoint lies between the curve of @@ -199,7 +199,7 @@ public: } const X_monotone_curve_2 & xc = - (bound_y == CGAL::AFTER_DISCONTINUITY ? + (ps_y == ARR_BOTTOM_BOUNDARY ? // AFTER DISCONTINUITY (event->number_of_right_curves() > 0 ? (*(event->right_curves_begin()))->last_curve() : @@ -210,16 +210,16 @@ public: (*(event->right_curves_begin()))->last_curve()) ); - CGAL::Arr_curve_end ind = - (bound_y == CGAL::AFTER_DISCONTINUITY ? + Arr_curve_end ind = + (ps_y == ARR_BOTTOM_BOUNDARY ? (event->number_of_right_curves() > 0 ? - CGAL::ARR_MIN_END : CGAL::ARR_MAX_END) : + ARR_MIN_END : ARR_MAX_END) : (event->number_of_left_curves() > 0 ? - CGAL::ARR_MAX_END : CGAL::ARR_MIN_END) + ARR_MAX_END : ARR_MIN_END) ); const Point_2& key = - (ind == CGAL::ARR_MIN_END ? + (ind == ARR_MIN_END ? this->m_top_traits->geometry_traits()-> construct_min_vertex_2_object()(xc) : this->m_top_traits->geometry_traits()-> @@ -231,9 +231,7 @@ public: if (v == NULL) { //std::cout << "HELPER: new y" << std::endl; - vh = m_arr_access.create_boundary_vertex( - xc, ind, - bound_x, bound_y); + vh = m_arr_access.create_boundary_vertex(xc, ind, ps_x, ps_y); } event->set_vertex_handle(vh); @@ -249,19 +247,19 @@ public: // Check whether the halfedge (or its twin) lie on the top face. Halfedge_handle he_on_top_face; - CGAL::Arr_parameter_space bnd_y_min = + Arr_parameter_space bnd_y_min = this->m_top_traits->geometry_traits()-> - parameter_space_in_y_2_object()(he->curve(), CGAL::ARR_MIN_END); - CGAL::Arr_parameter_space bnd_y_max = + parameter_space_in_y_2_object()(he->curve(), ARR_MIN_END); + Arr_parameter_space bnd_y_max = this->m_top_traits->geometry_traits()-> - parameter_space_in_y_2_object()(he->curve(), CGAL::ARR_MAX_END); + parameter_space_in_y_2_object()(he->curve(), ARR_MAX_END); - if (bnd_y_min == CGAL::BEFORE_DISCONTINUITY) { + if (bnd_y_min == ARR_TOP_BOUNDARY) { he_on_top_face = - (he->direction() == CGAL::ARR_RIGHT_TO_LEFT ? he : he->twin()); - } else if (bnd_y_max == CGAL::BEFORE_DISCONTINUITY) { + (he->direction() == ARR_RIGHT_TO_LEFT ? he : he->twin()); + } else if (bnd_y_max == ARR_TOP_BOUNDARY) { he_on_top_face = - (he->direction() == CGAL::ARR_LEFT_TO_RIGHT ? he : he->twin()); + (he->direction() == ARR_LEFT_TO_RIGHT ? he : he->twin()); } else { return; } @@ -277,7 +275,7 @@ public: std::cout << "move sc " << *itr << " from tf to " << he_on_top_face->curve() << (he_on_top_face->direction() == - CGAL::ARR_LEFT_TO_RIGHT ? "L2R" : "R2L") + ARR_LEFT_TO_RIGHT ? "L2R" : "R2L") << std::endl; } #endif @@ -323,7 +321,7 @@ public: { return (event->parameter_space_in_x() == ARR_INTERIOR && - event->parameter_space_in_y() == BEFORE_DISCONTINUITY); + event->parameter_space_in_y() == ARR_TOP_BOUNDARY); } /*! Get the current top face. */ diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_torus_insertion_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_torus_insertion_helper.h index 61512ac3ae7..1b81622f170 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_torus_insertion_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_torus_insertion_helper.h @@ -126,10 +126,10 @@ void Arr_torus_insertion_helper::before_handle_event (Event* event) { // Ignore events that do not have boundary conditions. - const Arr_parameter_space bound_x = event->parameter_space_in_x(); - const Arr_parameter_space bound_y = event->parameter_space_in_y(); + Arr_parameter_space ps_x = event->parameter_space_in_x(); + Arr_parameter_space ps_y = event->parameter_space_in_y(); - if (bound_x == ARR_INTERIOR && bound_y == ARR_INTERIOR) { + if (ps_x == ARR_INTERIOR && ps_y == ARR_INTERIOR) { return; } @@ -161,11 +161,11 @@ void Arr_torus_insertion_helper::before_handle_event // In case we encounter an existing curve incident to the left or // top face, we have to update the current top face - if (bound_x == AFTER_DISCONTINUITY) { + if (ps_x == ARR_LEFT_BOUNDARY) { // left side CGAL_assertion (ind == ARR_MIN_END); this->m_top_face = he->twin()->face(); - } else if (bound_y == BEFORE_DISCONTINUITY) { + } else if (ps_y == ARR_TOP_BOUNDARY) { // top side if (ind == CGAL::ARR_MIN_END) { diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_torus_overlay_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_torus_overlay_helper.h index 606dd49c086..a3e9b2ee64f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_torus_overlay_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_torus_overlay_helper.h @@ -115,7 +115,7 @@ public: (*(e->right_curves_begin())) : (*(e->left_curves_begin())); - if (e->parameter_space_in_x() == AFTER_DISCONTINUITY) { + if (e->parameter_space_in_x() == ARR_LEFT_BOUNDARY) { // left side switch (xc->color()) { case Traits_2::RED : @@ -133,7 +133,7 @@ public: } } else { - if (e->parameter_space_in_y() == BEFORE_DISCONTINUITY) { + if (e->parameter_space_in_y() == ARR_TOP_BOUNDARY) { Halfedge_handle_red red_he = xc->red_halfedge_handle(); Halfedge_handle_blue blue_he = xc->blue_halfedge_handle(); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_torus_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_torus_topology_traits_2_impl.h index a57b2bc3a5b..65a40940895 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_torus_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_torus_topology_traits_2_impl.h @@ -64,8 +64,7 @@ Arr_torus_topology_traits_2 (Geometry_traits_2 *tr) : // Assign the contents of another topology-traits class. // template -void Arr_torus_topology_traits_2::assign - (const Self& other) +void Arr_torus_topology_traits_2::assign (const Self& other) { // status: correct //std::cout << "Arr_torus_topology_traits_2 assign" << std::endl; @@ -107,7 +106,7 @@ void Arr_torus_topology_traits_2::dcel_updated () vit != this->_m_dcel.vertices_end(); ++vit) { // First check whether the vertex has a boundary condition in x. bx = vit->parameter_space_in_x(); - if (bx != CGAL::ARR_INTERIOR) { + if (bx != ARR_INTERIOR) { std::pair< typename Identification_WE::iterator, bool > res = _m_identification_WE.insert (std::make_pair(vit->point(), @@ -120,7 +119,7 @@ void Arr_torus_topology_traits_2::dcel_updated () // First check whether the vertex has a boundary condition in y. by = vit->parameter_space_in_y(); - if (by != CGAL::ARR_INTERIOR) { + if (by != ARR_INTERIOR) { std::pair< typename Identification_NS::iterator, bool > res = _m_identification_NS.insert (std::make_pair(vit->point(), @@ -278,8 +277,8 @@ void Arr_torus_topology_traits_2::init_dcel () // template Comparison_result -Arr_torus_topology_traits_2::compare_y_at_x -(const Point_2& p, const Halfedge* he) const +Arr_torus_topology_traits_2:: +compare_y_at_x (const Point_2& p, const Halfedge* he) const { // status: correct //std::cout << "Arr_torus_topology_traits_2 compare_y_at_x" @@ -293,50 +292,50 @@ Arr_torus_topology_traits_2::compare_y_at_x // Check if the given vertex is associated with the given curve end. // template -bool Arr_torus_topology_traits_2::are_equal -(const Vertex *v, - const X_monotone_curve_2& cv, Arr_curve_end ind, - CGAL::Arr_parameter_space bound_x, CGAL::Arr_parameter_space bound_y) const +bool Arr_torus_topology_traits_2:: +are_equal (const Vertex *v, + const X_monotone_curve_2& cv, Arr_curve_end ind, + Arr_parameter_space ps_x, Arr_parameter_space ps_y) const { // status: correct //std::cout << "Arr_torus_topology_traits_2 are_equal" // << std::endl; - CGAL_precondition(_valid(bound_x, bound_y)); + CGAL_precondition(_valid(ps_x, ps_y)); - if (bound_x == CGAL::ARR_INTERIOR || - bound_y == CGAL::ARR_INTERIOR) { + if (ps_x == ARR_INTERIOR || + ps_y == ARR_INTERIOR) { return false; // as v is on boundary } // check wether the two concrete points are equal - if (v->parameter_space_in_x() != CGAL::ARR_INTERIOR) { - if (bound_x == CGAL::ARR_INTERIOR) { + if (v->parameter_space_in_x() != ARR_INTERIOR) { + if (ps_x == ARR_INTERIOR) { return false; } // else curve-end lies on NS bool res = (this->_m_traits->compare_y_on_identification_2_object() ( v->point(), - (ind == CGAL::ARR_MIN_END ? + (ind == ARR_MIN_END ? this->_m_traits->construct_min_vertex_2_object()(cv) : this->_m_traits->construct_max_vertex_2_object()(cv))) == CGAL::EQUAL ); return res; } - CGAL_assertion(v->parameter_space_in_y() != CGAL::ARR_INTERIOR); - if (bound_y == CGAL::ARR_INTERIOR) { + CGAL_assertion(v->parameter_space_in_y() != ARR_INTERIOR); + if (ps_y == ARR_INTERIOR) { return false; } // else curve-end lies on WE bool res = (this->_m_traits->compare_x_on_identification_2_object() ( v->point(), - (ind == CGAL::ARR_MIN_END ? + (ind == ARR_MIN_END ? this->_m_traits->construct_min_vertex_2_object()(cv) : this->_m_traits->construct_max_vertex_2_object()(cv))) - == CGAL::EQUAL + == EQUAL ); return res; } @@ -348,16 +347,16 @@ bool Arr_torus_topology_traits_2::are_equal // template CGAL::Object -Arr_torus_topology_traits_2::place_boundary_vertex - (Face *f, - const X_monotone_curve_2& cv, CGAL::Arr_curve_end ind, - Arr_parameter_space bound_x, Arr_parameter_space bound_y) +Arr_torus_topology_traits_2:: +place_boundary_vertex (Face *f, + const X_monotone_curve_2& cv, Arr_curve_end ind, + Arr_parameter_space ps_x, Arr_parameter_space ps_y) { // status: correct //std::cout << "Arr_torus_topology_traits_2 place_boundary_vertex" // << std::endl; - CGAL_precondition(_valid(bound_x, bound_y)); + CGAL_precondition(_valid(ps_x, ps_y)); // this topology return either an empty object or a DCEL vertex, // but never a fictious edge!!! @@ -365,16 +364,16 @@ Arr_torus_topology_traits_2::place_boundary_vertex Vertex *v = NULL; const Point_2& key = - (ind == CGAL::ARR_MIN_END ? + (ind == ARR_MIN_END ? this->_m_traits->construct_min_vertex_2_object()(cv) : this->_m_traits->construct_max_vertex_2_object()(cv)); - if (bound_x != CGAL::ARR_INTERIOR) { + if (ps_x != ARR_INTERIOR) { // locate curve-end (here a concrete point) // in local structure of for points on identification_WE v = vertex_WE(key); } else { - CGAL_assertion(bound_y != CGAL::ARR_INTERIOR); + CGAL_assertion(ps_y != ARR_INTERIOR); // locate curve-end (here a concrete point) // in local structure of for points on // identification_NS @@ -387,8 +386,8 @@ Arr_torus_topology_traits_2::place_boundary_vertex } // else we return the vertex we have located. - CGAL_assertion(v->parameter_space_in_x() == bound_x && - v->parameter_space_in_y() == bound_y); + CGAL_assertion(v->parameter_space_in_x() == ps_x && + v->parameter_space_in_y() == ps_y); CGAL_assertion(!v->has_null_point()); return (CGAL::make_object (v)); @@ -400,16 +399,17 @@ Arr_torus_topology_traits_2::place_boundary_vertex // template typename Arr_torus_topology_traits_2::Halfedge* -Arr_torus_topology_traits_2::locate_around_boundary_vertex - (Vertex *v, - const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, Arr_parameter_space bound_y) const +Arr_torus_topology_traits_2:: +locate_around_boundary_vertex (Vertex *v, + const X_monotone_curve_2& cv, Arr_curve_end ind, + Arr_parameter_space ps_x, + Arr_parameter_space ps_y) const { // status: correct //std::cout << "Arr_torus_topology_traits_2 locate_around_boundary_vertex" // << std::endl; - CGAL_precondition(_valid(bound_x, bound_y)); + CGAL_precondition(_valid(ps_x, ps_y)); // If the vertex is isolated, there is no predecssor halfedge. if (v->is_isolated()) { @@ -477,31 +477,30 @@ Arr_torus_topology_traits_2::locate_around_boundary_vertex template void Arr_torus_topology_traits_2:: -notify_on_boundary_vertex_creation -(Vertex *v, - const X_monotone_curve_2& cv, - Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y) const +notify_on_boundary_vertex_creation (Vertex *v, + const X_monotone_curve_2& cv, + Arr_curve_end ind, + Arr_parameter_space ps_x, + Arr_parameter_space ps_y) const { // status: correct //std::cout << "Arr_torus_topology_traits_2::" // << "notify_on_boundary_vertex_creation" // << std::endl; - CGAL_precondition(_valid(bound_x, bound_y)); + CGAL_precondition(_valid(ps_x, ps_y)); - CGAL_assertion(v->parameter_space_in_x() == bound_x); - CGAL_assertion(v->parameter_space_in_y() == bound_y); + CGAL_assertion(v->parameter_space_in_x() == ps_x); + CGAL_assertion(v->parameter_space_in_y() == ps_y); CGAL_assertion(!v->has_null_point()); const Point_2& key = - (ind == CGAL::ARR_MIN_END ? + (ind == ARR_MIN_END ? this->_m_traits->construct_min_vertex_2_object()(cv) : this->_m_traits->construct_max_vertex_2_object()(cv)); - if (bound_x != CGAL::ARR_INTERIOR) { + if (ps_x != ARR_INTERIOR) { CGAL_assertion_code( int lod_size = @@ -542,7 +541,7 @@ notify_on_boundary_vertex_creation } // else - CGAL_assertion(bound_y != CGAL::ARR_INTERIOR); + CGAL_assertion(ps_y != ARR_INTERIOR); CGAL_assertion_code( int lod_size = static_cast< int >(this->_m_identification_NS.size()) @@ -587,16 +586,14 @@ notify_on_boundary_vertex_creation // Locate curve end with respect to dcel template CGAL::Object -Arr_torus_topology_traits_2::locate_curve_end( - const X_monotone_curve_2& cv, - Arr_curve_end ind, - CGAL::Arr_parameter_space bound_x, - CGAL::Arr_parameter_space bound_y) const +Arr_torus_topology_traits_2:: +locate_curve_end (const X_monotone_curve_2& cv, Arr_curve_end ind, + Arr_parameter_space ps_x, Arr_parameter_space ps_y) const { // status: to implement //std::cout << "Arr_torus_topology_traits_2 locate_curve_end" // << std::endl; - CGAL_precondition(_valid(bound_x, bound_y)); + CGAL_precondition(_valid(ps_x, ps_y)); // torus does not contain unbounded curves @@ -604,11 +601,11 @@ Arr_torus_topology_traits_2::locate_curve_end( typename Identification_NS::iterator ns_it; typename Identification_WE::iterator we_it; - Point_2 key = (ind == CGAL::ARR_MIN_END ? + Point_2 key = (ind == ARR_MIN_END ? this->m_traits->construct_min_vertex_2_object()(cv) : this->m_traits->construct_max_vertex_2_object()(cv)); - if (bound_x != CGAL::ARR_INTERIOR) { + if (ps_x != ARR_INTERIOR) { we_it = _m_identification_WE.find (key); if (we_it != _m_identification_WE.end()) { @@ -623,9 +620,9 @@ Arr_torus_topology_traits_2::locate_curve_end( } // TODO return top face? - } else if (v == NULL || bound_y != CGAL::ARR_INTERIOR) { + } else if (v == NULL || ps_y != ARR_INTERIOR) { - if (bound_x == CGAL::ARR_INTERIOR) { + if (ps_x == ARR_INTERIOR) { ns_it = _m_identification_NS.find (key); if (ns_it != _m_identification_NS.end()) { v = ns_it->second; @@ -655,10 +652,10 @@ Arr_torus_topology_traits_2::locate_curve_end( // template std::pair -Arr_torus_topology_traits_2::face_split_after_edge_insertion - (const Halfedge *prev1, - const Halfedge *prev2, - const X_monotone_curve_2& cv) const +Arr_torus_topology_traits_2:: +face_split_after_edge_insertion (const Halfedge *prev1, + const Halfedge *prev2, + const X_monotone_curve_2& cv) const { // status: correct //std::cout << "Arr_torus_topology_traits_2 face_split" << std::endl; @@ -705,8 +702,8 @@ Arr_torus_topology_traits_2::face_split_after_edge_insertion // template bool -Arr_torus_topology_traits_2::hole_creation_after_edge_removal -(const Halfedge *he) const +Arr_torus_topology_traits_2:: +hole_creation_after_edge_removal (const Halfedge *he) const { // status: to implement std::cout << "Arr_torus_topology_traits_2 hole_creation" << std::endl; @@ -776,10 +773,9 @@ Arr_torus_topology_traits_2::hole_creation_after_edge_removal template bool Arr_torus_topology_traits_2:: -is_on_new_perimetric_face_boundary -(const Halfedge *prev1, - const Halfedge *prev2, - const X_monotone_curve_2& cv) const +is_on_new_perimetric_face_boundary (const Halfedge *prev1, + const Halfedge *prev2, + const X_monotone_curve_2& cv) const { // status: correct //std::cout << "Arr_torus_topology_traits_2::" @@ -806,9 +802,8 @@ is_on_new_perimetric_face_boundary // template bool -Arr_torus_topology_traits_2::boundaries_of_same_face -(const Halfedge *e1, - const Halfedge *e2) const { +Arr_torus_topology_traits_2:: +boundaries_of_same_face (const Halfedge *e1, const Halfedge *e2) const { // status: correct //std::cout << " Arr_torus_topology_traits_2::boundaries_of_same_face" @@ -841,8 +836,8 @@ Arr_torus_topology_traits_2::boundaries_of_same_face // Determine whether the given vertex lies in the interior of the given face. // template -bool Arr_torus_topology_traits_2::is_in_face -(const Face *f, const Point_2& p, const Vertex *v) const +bool Arr_torus_topology_traits_2:: +is_in_face (const Face *f, const Point_2& p, const Vertex *v) const { // status: not implemented std::cout << "TODO: Arr_torus_topology_traits_2::is_in_face" @@ -875,8 +870,8 @@ bool Arr_torus_topology_traits_2::is_redundant // template typename Arr_torus_topology_traits_2::Halfedge* -Arr_torus_topology_traits_2::erase_redundant_vertex -(Vertex *v) +Arr_torus_topology_traits_2:: +erase_redundant_vertex (Vertex *v) { // status: correct @@ -886,7 +881,7 @@ Arr_torus_topology_traits_2::erase_redundant_vertex // no incident curve-end can give us the key // -> but we stored something else useful: find iterator - if (v->parameter_space_in_x() != CGAL::ARR_INTERIOR) { + if (v->parameter_space_in_x() != ARR_INTERIOR) { typename Vertices_on_identification_WE::iterator vit = _m_vertices_on_identification_WE.find(v); @@ -896,7 +891,7 @@ Arr_torus_topology_traits_2::erase_redundant_vertex _m_vertices_on_identification_WE.erase(vit); } else { - CGAL_assertion(v->parameter_space_in_y() != CGAL::ARR_INTERIOR); + CGAL_assertion(v->parameter_space_in_y() != ARR_INTERIOR); typename Vertices_on_identification_NS::iterator vit = _m_vertices_on_identification_NS.find(v); @@ -919,8 +914,7 @@ Arr_torus_topology_traits_2::erase_redundant_vertex template CGAL::Sign Arr_torus_topology_traits_2:: -_sign_of_path( - const Halfedge* he1, const Halfedge* he2) const { +_sign_of_path(const Halfedge* he1, const Halfedge* he2) const { // status: move to arr @@ -952,10 +946,14 @@ _sign_of_path( curr_trg_ind = ARR_MIN_END; } CGAL_assertion(!curr->has_null_curve()); - Arr_parameter_space first_src_bcx = parameter_space_in_x(curr->curve(), curr_src_ind); - Arr_parameter_space curr_trg_bcx = parameter_space_in_x(curr->curve(), curr_trg_ind); - Arr_parameter_space first_src_bcy = parameter_space_in_y(curr->curve(), curr_src_ind); - Arr_parameter_space curr_trg_bcy = parameter_space_in_y(curr->curve(), curr_trg_ind); + Arr_parameter_space first_src_bcx = + parameter_space_in_x(curr->curve(), curr_src_ind); + Arr_parameter_space curr_trg_bcx = + parameter_space_in_x(curr->curve(), curr_trg_ind); + Arr_parameter_space first_src_bcy = + parameter_space_in_y(curr->curve(), curr_src_ind); + Arr_parameter_space curr_trg_bcy = + parameter_space_in_y(curr->curve(), curr_trg_ind); while (curr != he2) { const Halfedge * next = curr->next(); @@ -978,18 +976,18 @@ _sign_of_path( parameter_space_in_y(next->curve(), next_trg_ind); if (curr_trg_bcx != next_src_bcx) { - CGAL_assertion(curr_trg_bcx != CGAL::ARR_INTERIOR); - CGAL_assertion(next_src_bcx != CGAL::ARR_INTERIOR); - if (curr_trg_bcx == BEFORE_DISCONTINUITY) { + CGAL_assertion(curr_trg_bcx != ARR_INTERIOR); + CGAL_assertion(next_src_bcx != ARR_INTERIOR); + if (curr_trg_bcx == ARR_RIGHT_BOUNDARY) { ++x_counter; } else { --x_counter; } } if (curr_trg_bcy != next_src_bcy) { - CGAL_assertion(curr_trg_bcy != CGAL::ARR_INTERIOR); - CGAL_assertion(next_src_bcy != CGAL::ARR_INTERIOR); - if (curr_trg_bcy == BEFORE_DISCONTINUITY) { + CGAL_assertion(curr_trg_bcy != ARR_INTERIOR); + CGAL_assertion(next_src_bcy != ARR_INTERIOR); + if (curr_trg_bcy == ARR_TOP_BOUNDARY) { ++y_counter; } else { --y_counter; @@ -1003,7 +1001,7 @@ _sign_of_path( if (he1 == he2) { Arr_parameter_space last_trg_bcx = curr_trg_bcx; if (last_trg_bcx != first_src_bcx) { - if (last_trg_bcx == BEFORE_DISCONTINUITY) { + if (last_trg_bcx == ARR_RIGHT_BOUNDARY) { ++x_counter; } else { --x_counter; @@ -1011,7 +1009,7 @@ _sign_of_path( } Arr_parameter_space last_trg_bcy = curr_trg_bcy; if (last_trg_bcy != first_src_bcy) { - if (last_trg_bcy == BEFORE_DISCONTINUITY) { + if (last_trg_bcy == ARR_TOP_BOUNDARY) { ++y_counter; } else { --y_counter; @@ -1028,9 +1026,8 @@ _sign_of_path( template CGAL::Sign Arr_torus_topology_traits_2:: -_sign_of_path( - const Halfedge* he1, const Halfedge* he2, - const X_monotone_curve_2& cv) const { +_sign_of_path (const Halfedge* he1, const Halfedge* he2, + const X_monotone_curve_2& cv) const { // status: move to arr @@ -1050,11 +1047,11 @@ _sign_of_path( // check whether cv can influence the counters - CGAL::Arr_parameter_space bcv1x = parameter_space_in_x(cv, ARR_MIN_END); - CGAL::Arr_parameter_space bcv1y = parameter_space_in_y(cv, ARR_MIN_END); + Arr_parameter_space bcv1x = parameter_space_in_x(cv, ARR_MIN_END); + Arr_parameter_space bcv1y = parameter_space_in_y(cv, ARR_MIN_END); - CGAL::Arr_parameter_space bcv2x = parameter_space_in_x(cv, ARR_MAX_END); - CGAL::Arr_parameter_space bcv2y = parameter_space_in_y(cv, ARR_MAX_END); + Arr_parameter_space bcv2x = parameter_space_in_x(cv, ARR_MAX_END); + Arr_parameter_space bcv2y = parameter_space_in_y(cv, ARR_MAX_END); if (bcv1x != ARR_INTERIOR || bcv1y != ARR_INTERIOR || bcv2x != ARR_INTERIOR || bcv2y != ARR_INTERIOR) { @@ -1064,22 +1061,22 @@ _sign_of_path( bool equal = false; Point_2 minp = this->_m_traits->construct_min_vertex_2_object()(cv); - CGAL::Arr_parameter_space bound_x = - this->_m_traits->parameter_space_in_x_2_object()(cv, CGAL::ARR_MIN_END); - CGAL::Arr_parameter_space bound_y = - this->_m_traits->parameter_space_in_y_2_object()(cv, CGAL::ARR_MIN_END); + Arr_parameter_space ps_x = + this->_m_traits->parameter_space_in_x_2_object()(cv, ARR_MIN_END); + Arr_parameter_space ps_y = + this->_m_traits->parameter_space_in_y_2_object()(cv, ARR_MIN_END); bool v1_on_boundary = (prev1->vertex()->parameter_space_in_x() != ARR_INTERIOR || prev1->vertex()->parameter_space_in_y() != ARR_INTERIOR); bool min_on_boundary = - (bound_x != ARR_INTERIOR || bound_y != ARR_INTERIOR); + (ps_x != ARR_INTERIOR || ps_y != ARR_INTERIOR); if (v1_on_boundary == min_on_boundary) { if (v1_on_boundary) { // compare at boundary - equal = this->are_equal(prev1->vertex(), cv, CGAL::ARR_MIN_END, - bound_x, bound_y); + equal = this->are_equal(prev1->vertex(), cv, ARR_MIN_END, + ps_x, ps_y); } else { equal = (this->_m_traits->compare_xy_2_object()( prev1->vertex()->point(), minp @@ -1111,7 +1108,7 @@ _sign_of_path( parameter_space_in_y(prev1->curve(), prev1_trg_ind); if (prev1_trg_bcx != bcv1x) { - if (prev1_trg_bcx == BEFORE_DISCONTINUITY) { + if (prev1_trg_bcx == ARR_RIGHT_BOUNDARY) { s = (s + 1) % 2; } else { s = (s - 1) % 2; @@ -1119,7 +1116,7 @@ _sign_of_path( } if (prev1_trg_bcy != bcv1y) { - if (prev1_trg_bcy == BEFORE_DISCONTINUITY) { + if (prev1_trg_bcy == ARR_TOP_BOUNDARY) { s = (s + 1) % 2; } else { s = (s - 1) % 2; @@ -1144,7 +1141,7 @@ _sign_of_path( parameter_space_in_y(prev2->curve(), prev2_trg_ind); if (prev2_trg_bcx != bcv2x) { - if (prev2_trg_bcx == BEFORE_DISCONTINUITY) { + if (prev2_trg_bcx == ARR_RIGHT_BOUNDARY) { s = (s + 1) % 2; } else { s = (s - 1) % 2; @@ -1152,7 +1149,7 @@ _sign_of_path( } if (prev2_trg_bcy != bcv2y) { - if (prev2_trg_bcy == BEFORE_DISCONTINUITY) { + if (prev2_trg_bcy == ARR_TOP_BOUNDARY) { s = (s + 1) % 2; } else { s = (s - 1) % 2; @@ -1195,7 +1192,7 @@ _face_before_vertex_on_identifications (Vertex * v) const { } } - if (v->parameter_space_in_x() != CGAL::ARR_INTERIOR) { + if (v->parameter_space_in_x() != ARR_INTERIOR) { // Otherwise, we traverse the halfedges around v and locate the first // halfedge we encounter if we go from "6 o'clock" clockwise. @@ -1248,7 +1245,7 @@ _face_before_vertex_on_identifications (Vertex * v) const { } } else { - CGAL_assertion(v->parameter_space_in_y() != CGAL::ARR_INTERIOR); + CGAL_assertion(v->parameter_space_in_y() != ARR_INTERIOR); // Otherwise, we traverse the halfedges around v and locate the first // halfedge we encounter if we go from "3 o'clock" clockwise. @@ -1256,9 +1253,9 @@ _face_before_vertex_on_identifications (Vertex * v) const { typename Traits_adaptor_2::Compare_x_2 compare_x = _m_traits->compare_x_2_object(); - CGAL::Arr_curve_end leftmost_top_end = CGAL::ARR_MIN_END; + CGAL::Arr_curve_end leftmost_top_end = ARR_MIN_END; Halfedge *leftmost_top = NULL; - CGAL::Arr_curve_end rightmost_bottom_end = CGAL::ARR_MIN_END; + CGAL::Arr_curve_end rightmost_bottom_end = ARR_MIN_END; Halfedge *rightmost_bottom = NULL; do { @@ -1267,14 +1264,14 @@ _face_before_vertex_on_identifications (Vertex * v) const { typename Traits_adaptor_2::Parameter_space_in_y_2 parameter_space_in_y = _m_traits->parameter_space_in_y_2_object(); - CGAL::Arr_curve_end ind = CGAL::ARR_MIN_END; + CGAL::Arr_curve_end ind = ARR_MIN_END; - CGAL::Arr_parameter_space bd_x = - parameter_space_in_x(curr->curve(), CGAL::ARR_MAX_END); - CGAL::Arr_parameter_space bd_y = - parameter_space_in_y(curr->curve(), CGAL::ARR_MAX_END); - if (are_equal(v, curr->curve(), CGAL::ARR_MAX_END, bd_x, bd_y)) { - ind = CGAL::ARR_MAX_END; + Arr_parameter_space bd_x = + parameter_space_in_x(curr->curve(), ARR_MAX_END); + Arr_parameter_space bd_y = + parameter_space_in_y(curr->curve(), ARR_MAX_END); + if (are_equal(v, curr->curve(), ARR_MAX_END, bd_x, bd_y)) { + ind = ARR_MAX_END; } if (parameter_space_in_y(curr->curve(),ind) < 0) { diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_torus_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_torus_topology_traits_2.h index b43e6d2fd60..f64665e8969 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_torus_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_torus_topology_traits_2.h @@ -513,14 +513,14 @@ public: * \param v The vertex. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve has a boundary condition in either x or y. * \return Whether v represents the given curve end. */ bool are_equal (const Vertex *v, const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, Arr_parameter_space bound_y) const; + Arr_parameter_space ps_x, Arr_parameter_space ps_y) const; /*! * Given a curve end with boundary conditions and a face that contains the @@ -529,8 +529,8 @@ public: * \param f The face. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve has a boundary condition in either x or y. * \return An object that contains the curve end. * In our case this object is either empty, or it may wrap a @@ -539,8 +539,8 @@ public: CGAL::Object place_boundary_vertex (Face *f, const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y); + Arr_parameter_space ps_x, + Arr_parameter_space ps_y); /*! * Locate the predecessor halfedge for the given curve around a given @@ -548,8 +548,8 @@ public: * \param v The vertex. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve has a boundary condition in either x or y, and should be * incident to the vertex v. * \return An object that contains the curve end. @@ -557,8 +557,8 @@ public: Halfedge* locate_around_boundary_vertex (Vertex *v, const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y) const; + Arr_parameter_space ps_x, + Arr_parameter_space ps_y) const; /*! * Receive a notification on the creation of a new boundary vertex that @@ -566,29 +566,29 @@ public: * \param v The new boundary vertex. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. */ void notify_on_boundary_vertex_creation (Vertex *v, const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y) const; + Arr_parameter_space ps_x, + Arr_parameter_space ps_y) const; /*! * Locate a DCEL feature that contains the given curve end. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve end is incident to the boundary. * \return An object that contains the curve end. * In our case this object wraps a end-vertex */ CGAL::Object locate_curve_end (const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y) const; + Arr_parameter_space ps_x, + Arr_parameter_space ps_y) const; /*! * Given two predecessor halfedges that belong to the same inner CCB of @@ -864,20 +864,18 @@ protected: * checks whether boundary condition in x and y is valid */ inline - bool _valid(CGAL::Arr_parameter_space bound_x, CGAL::Arr_parameter_space bound_y) + bool _valid(CGAL::Arr_parameter_space ps_x, CGAL::Arr_parameter_space ps_y) const { bool res = - ((bound_x == CGAL::AFTER_DISCONTINUITY || - bound_x == CGAL::BEFORE_DISCONTINUITY) && - bound_y == CGAL::ARR_INTERIOR) + ((ps_x == ARR_LEFT_BOUNDARY || ps_x == ARR_TIGHT_BOUNDARY) && + ps_y == ARR_INTERIOR) || - ((bound_y == CGAL::AFTER_DISCONTINUITY || - bound_y == CGAL::BEFORE_DISCONTINUITY) && - bound_x == CGAL::ARR_INTERIOR); + ((ps_y == ARR_BOTTOM_BOUNDARY || ps_y == ARR_TOP_BOUNDARY) && + ps_x == ARR_INTERIOR); #if !NDEBUG if (!res) { - std::cerr << "Not valid: bd_x = " << bound_x - << " bd_y = " << bound_y << std::endl; + std::cerr << "Not valid: bd_x = " << ps_x + << " bd_y = " << ps_y << std::endl; } #endif return res; 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 e3e06a7e6ff..9170d5a50b5 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 @@ -396,15 +396,14 @@ public: * \param v The vertex. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve has a boundary condition in either x or y. * \return Whether v represents the given curve end. */ bool are_equal (const Vertex *v, const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y) const; + Arr_parameter_space ps_x, Arr_parameter_space ps_y) const; /*! * Given a curve end with boundary conditions and a face that contains the @@ -413,8 +412,8 @@ public: * \param f The face. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve has a boundary condition in either x or y. * \return An object that contains the curve end. * In our case this object always wraps a fictitious edge. @@ -422,8 +421,8 @@ public: CGAL::Object place_boundary_vertex (Face *f, const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y); + Arr_parameter_space ps_x, + Arr_parameter_space ps_y); /*! * Locate the predecessor halfedge for the given curve around a given @@ -431,8 +430,8 @@ public: * \param v The vertex. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve has a boundary condition in either x or y, and should be * incident to the vertex v. * \return An object that contains the curve end. @@ -441,8 +440,8 @@ public: locate_around_boundary_vertex (Vertex* /* v */, const X_monotone_curve_2& /* cv */, Arr_curve_end /* ind */, - Arr_parameter_space /* bound_x */, - Arr_parameter_space /* bound_y */) const + Arr_parameter_space /* ps_x */, + Arr_parameter_space /* ps_y */) const { CGAL_error(); return (NULL); @@ -452,8 +451,8 @@ public: * Locate a DCEL feature that contains the given unbounded curve end. * \param cv The x-monotone curve. * \param ind The curve end. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \pre The curve end is unbounded in either x or y. * \return An object that contains the curve end. * In our case this object may either wrap an unbounded face, @@ -461,8 +460,8 @@ public: */ CGAL::Object locate_curve_end (const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y); + Arr_parameter_space ps_x, + Arr_parameter_space ps_y); /*! * Split a fictitious edge using the given vertex. @@ -621,16 +620,16 @@ protected: * halfedge. * \param cv The curve. * \param ind Whether we refer to the minimal or maximal end of cv. - * \param bound_x The boundary condition of the curve end in x. - * \param bound_y The boundary condition of the curve end in y. + * \param ps_x The boundary condition of the curve end in x. + * \param ps_y The boundary condition of the curve end in y. * \param he The fictitious halfedge. * \param eq_source Output: Whether the curve coincides with he's source. * \param eq_target Output: Whether the curve coincides with he's target. * \return Whether the curve end lies on the fictitious halfedge. */ bool _is_on_fictitious_edge (const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space bound_x, - Arr_parameter_space bound_y, + Arr_parameter_space ps_x, + Arr_parameter_space ps_y, const Halfedge *he, bool& eq_source, bool& eq_target); //@} diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h index d45dd3e965a..e287f936fb2 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h @@ -221,6 +221,11 @@ public: return Compare_y_at_x_left_2(this); } + //@} + + /// \name Overriden functors for unbounded boundaries. + //@{ + /*! A functor that determines whether an endpoint of an x-monotone curve lies * on a boundary of the parameter space along the x axis. */ @@ -665,14 +670,8 @@ public: { return Compare_y_on_identification_2(this); } - //@} - /// \name Overriden functors for unbounded boundaries. - //@{ - - - /*! A function object that determines whether a curve end is bounded. - */ + /*! A function object that determines whether a curve end is bounded. */ class Is_bounded_2 { protected: //! The base traits. @@ -695,7 +694,7 @@ public: { return true; } bool is_bounded(const X_monotone_curve_2 & xcv, Arr_curve_end ce, - Arr_bounded_boundary_tag) + Arr_has_boundary_tag) { return true; } bool is_bounded(const X_monotone_curve_2 & xcv, Arr_curve_end ce, 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 d9c3be96fcc..31dfd849372 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 @@ -533,6 +533,7 @@ CGAL_DEPRECATED void insert_x_monotone_curve { insert(arr, c, pl); } + /* DEPRECATED use insert() instead */ template CGAL_DEPRECATED void insert_x_monotone_curve @@ -541,6 +542,7 @@ CGAL_DEPRECATED void insert_x_monotone_curve { insert(arr, c); } + /* DEPRECATED use insert() instead */ template CGAL_DEPRECATED void insert_x_monotone_curves @@ -549,6 +551,7 @@ CGAL_DEPRECATED void insert_x_monotone_curves { insert(arr, begin, end); } + /* DEPRECATED use insert() instead */ template CGAL_DEPRECATED void insert_x_monotone_curve diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h index d4fd8fc1a82..9228500863c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h @@ -187,8 +187,7 @@ public: const Arr_parameter_space by1 = geom_traits->parameter_space_in_y_2_object()(cv, ARR_MIN_END); - if (bx1 == ARR_INTERIOR && by1 == ARR_INTERIOR) - { + if (bx1 == ARR_INTERIOR && by1 == ARR_INTERIOR) { // The curve has a finite left endpoint with no boundary conditions: // locate it in the arrangement. has_left_pt = true; @@ -197,14 +196,15 @@ public: obj = pl.locate (left_pt); } - else - { + else { // The left end of the curve has boundary conditions: use the topology // traits use the arrangement accessor to locate it. // Note that if the curve-end is unbounded, left_pt does not exist. - if (geom_traits->is_bounded_2_object()(cv, ARR_MIN_END)) + // Note that if the curve-end is unbounded, left_pt does not exist. + has_left_pt = geom_traits->is_bounded_2_object()(cv, ARR_MIN_END); + left_on_boundary = true; + if (has_left_pt) left_pt = geom_traits->construct_min_vertex_2_object() (cv); - obj = arr_access.locate_curve_end (cv, ARR_MIN_END, bx1, by1); } @@ -220,8 +220,7 @@ public: right_pt = geom_traits->construct_max_vertex_2_object() (cv); right_on_boundary = (bx2 != ARR_INTERIOR) || (by2 != ARR_INTERIOR); } - else - { + else { // The right end of the curve lies at infinity. has_right_pt = false; right_on_boundary = true; diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h index 5be635d508d..b3de8740123 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h @@ -63,8 +63,8 @@ public: typedef typename Traits_2::Boundary_category Base_boundary_category; typedef Tag_true Has_boundary_category; - typedef Arr_bounded_boundary_tag Boundary_category; typedef Tag_false Has_left_category; + typedef Base_boundary_category Boundary_category; protected: @@ -820,9 +820,9 @@ public: } -/*! A functor that compares the y-coordinates of two points on the - * identification curve. - */ + /*! A functor that compares the y-coordinates of two points on the + * identification curve. + */ class Compare_y_on_identification_2 { protected: @@ -876,6 +876,56 @@ public: { return Compare_y_on_identification_2(m_base_traits); } + + /*! A function object that determines whether a curve end is bounded. */ + class Is_bounded_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). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Is_bounded_2(const Traits_2 * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_basic_insertion_traits_2; + + bool is_bounded(const X_monotone_curve_2 & xcv, Arr_curve_end ce, + Arr_no_boundary_tag) + { return true; } + + bool is_bounded(const X_monotone_curve_2 & xcv, Arr_curve_end ce, + Arr_has_boundary_tag) + { return true; } + + bool is_bounded(const X_monotone_curve_2 & xcv, Arr_curve_end ce, + Arr_unbounded_boundary_tag) + { + return m_base->is_bounded_2_object()(xcv, ce); + } + + public: + /*! Is the end of an x-monotone curve bounded? + * \param xcv The x-monotone curve. + * \param ce The end of xcv identifier. + * \return true is the curve end is bounded, and false otherwise + */ + bool operator() (const X_monotone_curve_2 & xcv, Arr_curve_end ce) + { + return is_bounded(xcv, ce, Boundary_category()); + } + }; + + /*! Obtain a Is_bounded_2 function object. */ + Is_bounded_2 is_bounded_2_object() const + { + return Is_bounded_2(m_base_traits); + } }; CGAL_END_NAMESPACE diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_overlay_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_overlay_traits_2.h index bad0dad3fef..e697540cf5d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_overlay_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_overlay_traits_2.h @@ -858,7 +858,7 @@ public: { return true; } bool is_bounded(const X_monotone_curve_2 & xcv, Arr_curve_end ce, - Arr_bounded_boundary_tag) + Arr_has_boundary_tag) { return true; } bool is_bounded(const X_monotone_curve_2 & xcv, Arr_curve_end ce,