diff --git a/Arrangement_on_surface_2/archive/include/CGAL/Arr_extended_rational_arc_traits_d_1.h b/Arrangement_on_surface_2/archive/include/CGAL/Arr_extended_rational_arc_traits_d_1.h index 99b1327a371..b39676792e0 100644 --- a/Arrangement_on_surface_2/archive/include/CGAL/Arr_extended_rational_arc_traits_d_1.h +++ b/Arrangement_on_surface_2/archive/include/CGAL/Arr_extended_rational_arc_traits_d_1.h @@ -55,7 +55,7 @@ namespace CGAL { # define Min_bounded(ver) \ ( ((ver).min_parameter_space() == ARR_BOTTOM_BOUNDARY ) ? false : true ) - + template class Arr_traits_with_vertical_segments @@ -63,30 +63,30 @@ class Arr_traits_with_vertical_segments public: typedef Traits_ Traits; typedef Arr_traits_with_vertical_segments Self; - + typedef typename Traits::Algebraic_kernel_d_1 Algebraic_kernel_d_1; typedef typename Traits::Point_2 Point_2; typedef typename Traits::Multiplicity Multiplicity; typedef typename Traits::Algebraic_real_1 Algebraic_real_1; typedef typename Traits::Rat_vector Rat_vector; - typedef typename Traits::Coefficient Coefficient; + typedef typename Traits::Coefficient Coefficient; typedef typename Traits::Integer Integer; - typedef typename Traits::Rational Rational; - typedef typename Traits::Polynomial_1 Polynomial_1; + typedef typename Traits::Rational Rational; + typedef typename Traits::Polynomial_1 Polynomial_1; typedef typename Traits::Rational_function Rational_function; - + typedef typename Traits::X_monotone_curve_2 Non_vertical_x_curve_2; typedef typename Traits::Curve_2 Non_vertical_curve_2; typedef typename Traits::Vertical_segment Vertical_segment; - typedef Arr_vertical_rational_arc::Rational_arc_with_ver_d_1 + typedef Arr_vertical_rational_arc::Rational_arc_with_ver_d_1 X_monotone_curve_2; - typedef Arr_vertical_rational_arc::Rational_arc_with_ver_d_1 + typedef Arr_vertical_rational_arc::Rational_arc_with_ver_d_1 Curve_2; - + //Category tags: typedef Tag_true Has_left_category; typedef Tag_true Has_merge_category; @@ -121,17 +121,17 @@ public: Construct_point_2 (Traits& traits) :_traits(traits) {} Point_2 operator() (const Rational_function& rational_function, const Algebraic_real_1& x_coordinate) - { + { return _traits.construct_point_2_object()(rational_function,x_coordinate); } Point_2 operator() (const Rational& x,const Rational& y) - { + { return _traits.construct_point_2_object()(x,y); } Point_2 operator() (const Algebraic_real_1& x,const Rational& y) { return _traits.construct_point_2_object()(x,y); - } + } }; //Construct_point_2 Construct_point_2 construct_point_2_object() const {return Construct_point_2(_traits);} @@ -141,7 +141,7 @@ public: private: Traits& _traits; public: - Construct_vertical_x_curve_2(Traits& traits) + Construct_vertical_x_curve_2(Traits& traits) :_traits(traits) {} @@ -184,7 +184,7 @@ public: { return _traits.construct_vertical_segment_object()(p,is_directed_up); } - + }; //Construct_vertical_curve_2 Construct_vertical_curve_2 construct_vertical_curve_2_object () const @@ -194,48 +194,48 @@ public: class Construct_curve_2 { - private: + private: typedef typename Traits::Algebraic_real_1 Algebraic_real_1; Traits& _traits; public: - Construct_curve_2 (Traits& traits) + Construct_curve_2 (Traits& traits) :_traits(traits) {} template Curve_2 operator() (InputIterator begin, InputIterator end) const { - return _traits.construct_curve_2_object()(begin,end); + return _traits.construct_curve_2_object()(begin,end); } template Curve_2 operator() (InputIterator begin, InputIterator end,const Algebraic_real_1& x_s, bool dir_right) const { - return _traits.construct_curve_2_object()(begin,end,x_s,dir_right); + return _traits.construct_curve_2_object()(begin,end,x_s,dir_right); } template Curve_2 operator() (InputIterator begin, InputIterator end, const Algebraic_real_1& x_s, const Algebraic_real_1& x_t) const { - return _traits.construct_curve_2_object()(begin,end,x_s,x_t); + return _traits.construct_curve_2_object()(begin,end,x_s,x_t); } template Curve_2 operator() (InputIterator begin_numer, InputIterator end_numer, - InputIterator begin_denom, InputIterator end_denom) const + InputIterator begin_denom, InputIterator end_denom) const { - return _traits.construct_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom); + return _traits.construct_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom); } template Curve_2 operator() (InputIterator begin_numer, InputIterator end_numer, InputIterator begin_denom, InputIterator end_denom, const Algebraic_real_1& x_s, bool dir_right) const { - return _traits.construct_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom,x_s,dir_right); + return _traits.construct_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom,x_s,dir_right); } template Curve_2 operator() (InputIterator begin_numer, InputIterator end_numer, InputIterator begin_denom, InputIterator end_denom, const Algebraic_real_1& x_s, const Algebraic_real_1& x_t) const { - return _traits.construct_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom,x_s,x_t); + return _traits.construct_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom,x_s,x_t); } }; //Construct_rational_curve_2 @@ -245,7 +245,7 @@ public: } class Construct_x_monotone_curve_2 { - private: + private: typedef typename Traits::Algebraic_real_1 Algebraic_real_1; Traits& _traits; public: @@ -255,39 +255,39 @@ public: template X_monotone_curve_2 operator() (InputIterator begin, InputIterator end) const { - return _traits.construct_x_monotone_curve_2_object()(begin,end); + return _traits.construct_x_monotone_curve_2_object()(begin,end); } template X_monotone_curve_2 operator() ( InputIterator begin, InputIterator end, const Algebraic_real_1& x_s, bool dir_right) const { - return _traits.construct_x_monotone_curve_2_object()(begin,end,x_s,dir_right); + return _traits.construct_x_monotone_curve_2_object()(begin,end,x_s,dir_right); } template X_monotone_curve_2 operator() (InputIterator begin, InputIterator end, const Algebraic_real_1& x_s, const Algebraic_real_1& x_t) const { - return _traits.construct_x_monotone_curve_2_object()(begin,end,x_s,x_t); + return _traits.construct_x_monotone_curve_2_object()(begin,end,x_s,x_t); } template X_monotone_curve_2 operator() ( InputIterator begin_numer, InputIterator end_numer, - InputIterator begin_denom, InputIterator end_denom) const + InputIterator begin_denom, InputIterator end_denom) const { - return _traits.construct_x_monotone_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom); + return _traits.construct_x_monotone_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom); } template X_monotone_curve_2 operator() ( InputIterator begin_numer, InputIterator end_numer, InputIterator begin_denom, InputIterator end_denom, const Algebraic_real_1& x_s, bool dir_right) const { - return _traits.construct_x_monotone_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom,x_s,dir_right); + return _traits.construct_x_monotone_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom,x_s,dir_right); } template X_monotone_curve_2 operator() ( InputIterator begin_numer, InputIterator end_numer, InputIterator begin_denom, InputIterator end_denom, const Algebraic_real_1& x_s, const Algebraic_real_1& x_t) const { - return _traits.construct_x_monotone_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom,x_s,x_t); + return _traits.construct_x_monotone_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom,x_s,x_t); } }; //Construct_rational_x_curve_2 @@ -300,7 +300,7 @@ public: //------------------------ //--------------------------------------------------------------- - //A functor that compares the x-coordinates of two points + //A functor that compares the x-coordinates of two points class Compare_x_2 { private: @@ -348,7 +348,7 @@ public: /*! A functor that obtains the left endpoint of a curve. */ class Construct_min_vertex_2 - { + { private: Traits& _traits; public: @@ -466,7 +466,7 @@ public: class Compare_y_at_x_2 { private: - Traits& _traits; + Traits& _traits; public: Compare_y_at_x_2(Traits& traits) : _traits(traits) {} /*! @@ -497,10 +497,10 @@ public: } Comparison_result operator() (const Vertical_segment & cv) const { - CGAL_precondition(_traits.compare_x_2_object()(_p,cv.max()) == CGAL::EQUAL); + CGAL_precondition(_traits.compare_x_2_object()(_p,cv.max()) == CGAL::EQUAL); typename Traits::Compare_xy_2 compare_xy_2 = _traits.compare_xy_2_object(); - + if (Is_line(cv)) return CGAL::EQUAL; if ((Max_bounded(cv)) && (!Min_bounded(cv)) ) @@ -544,7 +544,7 @@ public: { public: typedef boost::static_visitor Base; - Compare_y_at_x_left_2_visitor(Traits& traits,const Point_2& p) + Compare_y_at_x_left_2_visitor(Traits& traits,const Point_2& p) : _traits(traits), _p(p), Base() {} Comparison_result operator() (const Non_vertical_x_curve_2 & cv1, const Non_vertical_x_curve_2 & cv2) const @@ -579,7 +579,7 @@ public: /*! A functor that compares compares the y-coordinates of two curves * immediately to the left of their intersection point. */ - + /*! A functor that checks whether two points and two curves are identical. */ class Equal_2 { @@ -610,34 +610,34 @@ public: if (&p1 == &p2) return (true); return _traits.equal_2_object() (p1,p2); - + } private: class Equal_2_visitor : public boost::static_visitor { private: - typedef boost::static_visitor Base; + typedef boost::static_visitor Base; Traits& _traits; public: Equal_2_visitor(Traits& traits) : _traits(traits), Base() {} bool operator() (const Non_vertical_x_curve_2& cv1, - const Non_vertical_x_curve_2& cv2) const + const Non_vertical_x_curve_2& cv2) const { return _traits.equal_2_object() (cv1,cv2); } bool operator() (const Non_vertical_x_curve_2& cv1, - const Vertical_segment & cv2) const + const Vertical_segment & cv2) const { - return false; + return false; } bool operator() (const Vertical_segment & cv1, - const Non_vertical_x_curve_2& cv2) const + const Non_vertical_x_curve_2& cv2) const { - return false; + return false; } bool operator() (const Vertical_segment & cv1, - const Vertical_segment & cv2) const + const Vertical_segment & cv2) const { if (&cv1 == &cv2) return (true); @@ -657,7 +657,7 @@ public: if (Min_bounded(cv1) && Min_bounded(cv2)) return (_traits.equal_2_object() (cv1.min(),cv2.min() )); - + return false; } }; //Equal_2_visitor @@ -672,12 +672,12 @@ public: /*! A functor that divides a curve into continues (x-monotone) curves. */ class Make_x_monotone_2 { - private: + private: Traits& _traits; public: Make_x_monotone_2(Traits& traits) : _traits(traits) {} template - OutputIterator operator() (const Curve_2& cv, OutputIterator oi) const + OutputIterator operator() (const Curve_2& cv, OutputIterator oi) const { Object_vector res (boost::apply_visitor(Make_x_monotone_2_visitor(_traits),cv.variant())); re_cast_object_vector(res,oi); @@ -688,17 +688,17 @@ public: : public boost::static_visitor < Object_vector > { private: - typedef boost::static_visitor Base; + typedef boost::static_visitor Base; Traits& _traits; public: Make_x_monotone_2_visitor(Traits& traits) : _traits(traits), Base() {} - Object_vector operator() (const Non_vertical_curve_2& cv) const + Object_vector operator() (const Non_vertical_curve_2& cv) const { Object_vector vec; _traits.make_x_monotone_2_object() (cv,std::back_inserter(vec)); return vec; } - Object_vector operator() (const Vertical_segment & cv) const + Object_vector operator() (const Vertical_segment & cv) const { Object_vector vec; vec.push_back(make_object (Vertical_segment(cv))); @@ -743,7 +743,7 @@ public: { public: typedef boost::static_visitor Base; - Split_2_visitor(Traits& traits,const Point_2 & p) + Split_2_visitor(Traits& traits,const Point_2 & p) : _traits(traits),_p(p), Base() {} Res_type operator() (const Non_vertical_x_curve_2& cv) const { @@ -751,9 +751,9 @@ public: _traits.split_2_object() (cv,_p,_c1,_c2); return Res_type(_c1,_c2); } - Res_type operator() (const Vertical_segment & cv) const + Res_type operator() (const Vertical_segment & cv) const { - typename Traits::Construct_vertical_segment + typename Traits::Construct_vertical_segment construct_vertical_segment = _traits.construct_vertical_segment_object(); Vertical_segment _c1,_c2; if (Is_line(cv)) @@ -794,7 +794,7 @@ public: class Intersect_2 { private: - Traits& _traits; + Traits& _traits; public: /*! * Find the intersections of the two given curves and insert them to the @@ -809,7 +809,7 @@ public: template OutputIterator operator() ( const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2, - OutputIterator oi) const + OutputIterator oi) const { Object_vector res (boost::apply_visitor(Intersect_2_visitor(_traits),cv1.variant(),cv2.variant())); re_cast_object_vector(res,oi); @@ -823,12 +823,12 @@ public: typedef boost::static_visitor Base; Traits& _traits; public: - Intersect_2_visitor(Traits& traits) + Intersect_2_visitor(Traits& traits) : _traits(traits), Base() {} //intersection of two Non_vertical_x_curve_2 Object_vector operator() (const Non_vertical_x_curve_2& cv1, - const Non_vertical_x_curve_2& cv2) const + const Non_vertical_x_curve_2& cv2) const { Object_vector vec; _traits.intersect_2_object() (cv1,cv2,std::back_inserter(vec)); @@ -836,7 +836,7 @@ public: } //intersection of a Non_vertical_x_curve_2 and a Vertical_segment Object_vector operator() (const Vertical_segment& cv1, - const Non_vertical_x_curve_2& cv2) const + const Non_vertical_x_curve_2& cv2) const { Object_vector vec; _traits.intersect_2_object() (cv2,cv1,std::back_inserter(vec)); @@ -844,7 +844,7 @@ public: } //intersection of a Non_vertical_x_curve_2 and a Vertical_segment Object_vector operator() (const Non_vertical_x_curve_2& cv1, - const Vertical_segment& cv2) const + const Vertical_segment& cv2) const { Object_vector vec; _traits.intersect_2_object() (cv1,cv2,std::back_inserter(vec)); @@ -852,7 +852,7 @@ public: } //intersection of two Vertical_segment Object_vector operator() (const Vertical_segment& cv1, - const Vertical_segment& cv2) const + const Vertical_segment& cv2) const { Object_vector vec; CGAL::Object object; @@ -862,7 +862,7 @@ public: object = make_object(Vertical_segment(cv2)); else if (Is_line(cv2)) object = make_object(Vertical_segment(cv1)); - + if (object.empty() == false) { vec.push_back(object); @@ -894,9 +894,9 @@ public: Object_vector intersect_ray_ray ( const Vertical_segment& ray1, const Vertical_segment& ray2) const { - typename Traits::Compare_xy_2 + typename Traits::Compare_xy_2 compare_xy_2 = _traits.compare_xy_2_object(); - typename Traits::Construct_vertical_segment + typename Traits::Construct_vertical_segment construct_vertical_segment = _traits.construct_vertical_segment_object(); CGAL_precondition (Is_ray(ray1)); @@ -952,10 +952,10 @@ public: { CGAL_precondition (Is_ray(ray)); CGAL_precondition (Is_segment(seg)); - - typename Traits::Compare_xy_2 + + typename Traits::Compare_xy_2 compare_xy_2 = _traits.compare_xy_2_object(); - typename Traits::Construct_vertical_segment + typename Traits::Construct_vertical_segment construct_vertical_segment = _traits.construct_vertical_segment_object(); Object_vector vec; @@ -967,7 +967,7 @@ public: Comparison_result cr = compare_xy_2 (ray.min(),seg.min()); if (cr != LARGER) object = make_object (seg); - else + else { cr = compare_xy_2 (ray.min(),seg.max()); if (cr == LARGER) @@ -984,7 +984,7 @@ public: Comparison_result cr = compare_xy_2 (ray.max(),seg.max()); if (cr != SMALLER) object = make_object (seg); - else + else { cr = compare_xy_2 (ray.max(),seg.min()); if (cr == SMALLER) @@ -1005,11 +1005,11 @@ public: CGAL_precondition (Is_segment(seg1)); CGAL_precondition (Is_segment(seg2)); - typename Traits::Compare_xy_2 + typename Traits::Compare_xy_2 compare_xy_2 = _traits.compare_xy_2_object(); - typename Traits::Construct_vertical_segment + typename Traits::Construct_vertical_segment construct_vertical_segment = _traits.construct_vertical_segment_object(); - + Object_vector vec; CGAL::Object object; @@ -1024,18 +1024,18 @@ public: Comparison_result cr1 = compare_xy_2 (seg1.min(),seg2.min()); Comparison_result cr2 = compare_xy_2 (seg1.max(),seg2.max()); - if ( (cr1 == CGAL::LARGER ) && + if ( (cr1 == CGAL::LARGER ) && (cr2 == CGAL::LARGER ) ) object = make_object (construct_vertical_segment(seg1.min(),seg2.max())); - else if ( (cr1 == CGAL::LARGER ) && + else if ( (cr1 == CGAL::LARGER ) && (cr2 == CGAL::SMALLER ) ) object = make_object (construct_vertical_segment(seg1.min(),seg1.max())); - else if ( (cr1 == CGAL::SMALLER) && + else if ( (cr1 == CGAL::SMALLER) && (cr2 == CGAL::LARGER ) ) object = make_object (construct_vertical_segment(seg2.min(),seg2.max())); else //SMALLER,SMALLER object = make_object (construct_vertical_segment(seg2.min(),seg1.max())); - + vec.push_back(object); return vec; } @@ -1072,10 +1072,10 @@ public: : public boost::static_visitor { private: - typedef boost::static_visitor Base; + typedef boost::static_visitor Base; Traits& _traits; public: - Are_mergeable_2_visitor(Traits& traits) + Are_mergeable_2_visitor(Traits& traits) : _traits(traits), Base() {} bool operator() ( const Non_vertical_x_curve_2& cv1, const Non_vertical_x_curve_2& cv2) const @@ -1108,7 +1108,7 @@ public: if (_traits.equal_2_object()(cv1.min(),cv2.min())) return true; } - //try to merge at minimum and maximum + //try to merge at minimum and maximum if ((Max_bounded(cv1)) && (Min_bounded(cv2))) { res = (_traits.equal_2_object()(cv1.max(),cv2.min())); @@ -1147,7 +1147,7 @@ public: const X_monotone_curve_2& cv2, X_monotone_curve_2& c) const { - c = boost::apply_visitor(Merge_2_visitor(_traits),cv1.variant(),cv2.variant()); + c = boost::apply_visitor(Merge_2_visitor(_traits),cv1.variant(),cv2.variant()); return; } private: @@ -1155,7 +1155,7 @@ public: : public boost::static_visitor { private: - typedef boost::static_visitor Base; + typedef boost::static_visitor Base; Traits& _traits; public: Merge_2_visitor(Traits& traits) : _traits(traits), Base() {} @@ -1178,14 +1178,14 @@ public: } X_monotone_curve_2 operator() (const Vertical_segment& cv1,const Vertical_segment& cv2) const { - typename Traits::Construct_vertical_segment + typename Traits::Construct_vertical_segment construct_vertical_segment = _traits.construct_vertical_segment_object(); - typename Traits::Compare_xy_2 + typename Traits::Compare_xy_2 compare_xy_2 = _traits.compare_xy_2_object(); Vertical_segment _c; - if ((Max_bounded(cv1)) && + if ((Max_bounded(cv1)) && (Max_bounded(cv2)) && (compare_xy_2(cv1.max() , cv2.max()) == CGAL::EQUAL)) { @@ -1198,7 +1198,7 @@ public: return _c; } - if ((Min_bounded(cv1)) && + if ((Min_bounded(cv1)) && (Min_bounded(cv2)) && (compare_xy_2(cv1.min() , cv2.min()) == CGAL::EQUAL)) { @@ -1211,7 +1211,7 @@ public: return _c; } - if ((Max_bounded(cv1)) && + if ((Max_bounded(cv1)) && (Min_bounded(cv2)) && (compare_xy_2(cv1.max() , cv2.min()) == CGAL::EQUAL)) { @@ -1270,7 +1270,7 @@ public: { return (boost::apply_visitor(Parameter_space_in_x_2_visitor(_traits,ce),xcv.variant())); } - + /*! Obtains the parameter space at a point along the x-axis. * \param p the point. * \return the parameter space at p. @@ -1285,7 +1285,7 @@ public: { public: typedef boost::static_visitor Base; - Parameter_space_in_x_2_visitor(Traits& traits,Arr_curve_end ce) + Parameter_space_in_x_2_visitor(Traits& traits,Arr_curve_end ce) :_traits(traits), _ce(ce), Base() {} Arr_parameter_space operator()(const Non_vertical_x_curve_2& xcv ) const { @@ -1304,14 +1304,14 @@ public: /*! Obtain a Parameter_space_in_x_2 function object */ Parameter_space_in_x_2 parameter_space_in_x_2_object() const - { - return Parameter_space_in_x_2(_traits); + { + return Parameter_space_in_x_2(_traits); } - + /*! A function object that obtains the parameter space of a geometric * entity along the y-axis */ - class Parameter_space_in_y_2 + class Parameter_space_in_y_2 { private: Traits& _traits; @@ -1348,14 +1348,14 @@ public: //{ // return ARR_INTERIOR; //} - + private: class Parameter_space_in_y_2_visitor : public boost::static_visitor { public: typedef boost::static_visitor Base; - Parameter_space_in_y_2_visitor(Traits& traits,Arr_curve_end ce) + Parameter_space_in_y_2_visitor(Traits& traits,Arr_curve_end ce) :_traits(traits),_ce(ce), Base() {} Arr_parameter_space operator()(const Non_vertical_x_curve_2& xcv ) const { @@ -1393,7 +1393,7 @@ public: * defined (lexicographically) to its right. * \return The relative position of cv1 with respect to cv2 immdiately to * the right of p: SMALLER, LARGER or EQUAL. - */ + */ Compare_y_at_x_right_2 (Traits& traits) : _traits(traits) {} Comparison_result operator() (const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2, @@ -1407,27 +1407,27 @@ public: { public: typedef boost::static_visitor Base; - Compare_y_at_x_right_2_visitor(Traits& traits,const Point_2& p) + Compare_y_at_x_right_2_visitor(Traits& traits,const Point_2& p) : _traits(traits), _p(p), Base() {} Comparison_result operator() (const Non_vertical_x_curve_2& cv1, - const Non_vertical_x_curve_2& cv2) const + const Non_vertical_x_curve_2& cv2) const { return _traits.compare_y_at_x_right_2_object() (cv1,cv2,_p); } Comparison_result operator() (const Non_vertical_x_curve_2& cv1, - const Vertical_segment & cv2) const + const Vertical_segment & cv2) const { return CGAL::SMALLER; } Comparison_result operator() (const Vertical_segment & cv1, - const Non_vertical_x_curve_2& cv2) const + const Non_vertical_x_curve_2& cv2) const { return CGAL::LARGER; } Comparison_result operator() (const Vertical_segment & cv1, - const Vertical_segment & cv2) const + const Vertical_segment & cv2) const { - return CGAL::EQUAL; //test bug fix + return CGAL::EQUAL; //test bug fix } private: Traits& _traits; @@ -1441,32 +1441,32 @@ public: { return Compare_y_at_x_right_2(_traits); } - class Compare_x_near_limit_2 + class Compare_x_near_boundary_2 { private: Traits& _traits; public: - Compare_x_near_limit_2 (Traits& traits) : _traits(traits) {} - Comparison_result operator()( const X_monotone_curve_2& xcv1, - const X_monotone_curve_2& xcv2, + Compare_x_near_boundary_2 (Traits& traits) : _traits(traits) {} + Comparison_result operator()( const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, Arr_curve_end ce) const { - return (boost::apply_visitor(Compare_x_near_limit_2_visitor(_traits,ce),xcv1.variant(),xcv2.variant())); + return (boost::apply_visitor(Compare_x_near_boundary_2_visitor(_traits,ce),xcv1.variant(),xcv2.variant())); } private: - class Compare_x_near_limit_2_visitor + class Compare_x_near_boundary_2_visitor : public boost::static_visitor { public: typedef boost::static_visitor Base; - Compare_x_near_limit_2_visitor(Traits& traits,Arr_curve_end ce) + Compare_x_near_boundary_2_visitor(Traits& traits,Arr_curve_end ce) :_traits(traits), _ce(ce), Base() {} Comparison_result operator()(const Non_vertical_x_curve_2& xcv1,const Non_vertical_x_curve_2& xcv2 ) const { - return _traits.compare_x_near_limit_2_object()(xcv1,xcv2,_ce); + return _traits.compare_x_near_boundary_2_object()(xcv1,xcv2,_ce); } Comparison_result operator()(const Non_vertical_x_curve_2& xcv1,const Vertical_segment& xcv2 ) const - { + { if (_ce == ARR_MIN_END) { CGAL_precondition (xcv2.min_parameter_space() == CGAL::ARR_BOTTOM_BOUNDARY); @@ -1478,7 +1478,7 @@ public: return CGAL::SMALLER; } - return _traits.compare_x_at_limit_2_object()(xcv2.max(),xcv1,_ce); + return _traits.compare_x_on_boundary_2_object()(xcv2.max(),xcv1,_ce); } Comparison_result operator()(const Vertical_segment& xcv1,const Non_vertical_x_curve_2& xcv2 ) const { @@ -1499,56 +1499,56 @@ public: CGAL_precondition (xcv1.min_parameter_space() == CGAL::ARR_BOTTOM_BOUNDARY); else //_ce1 == ARR_MAX_END CGAL_precondition (xcv1.max_parameter_space() == CGAL::ARR_TOP_BOUNDARY); - + if (_ce == ARR_MIN_END) CGAL_precondition (xcv2.min_parameter_space() == CGAL::ARR_BOTTOM_BOUNDARY); else //_ce2 == ARR_MAX_END CGAL_precondition (xcv2.max_parameter_space() == CGAL::ARR_TOP_BOUNDARY); - + return _traits.compare_x_2_object() (xcv1.min(),xcv2.min()); } private: Traits& _traits; Arr_curve_end _ce; - }; //Compare_x_near_limit_2_visitor - }; //Compare_x_near_limit_2 + }; //Compare_x_near_boundary_2_visitor + }; //Compare_x_near_boundary_2 - Compare_x_near_limit_2 compare_x_near_limit_2_object() const + Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const { - return Compare_x_near_limit_2(_traits); + return Compare_x_near_boundary_2(_traits); } - class Compare_x_at_limit_2 + class Compare_x_on_boundary_2 { private: Traits& _traits; public: - Compare_x_at_limit_2 (Traits& traits) :_traits(traits) {} + Compare_x_on_boundary_2 (Traits& traits) :_traits(traits) {} Comparison_result operator()( const Point_2 & p, const X_monotone_curve_2 & xcv, Arr_curve_end ce) const { - return (boost::apply_visitor(Compare_x_at_limit_2_visitor_1(_traits,ce,p),xcv.variant())); + return (boost::apply_visitor(Compare_x_on_boundary_2_visitor_1(_traits,ce,p),xcv.variant())); } Comparison_result operator()( const X_monotone_curve_2 & xcv1, Arr_curve_end ce1, const X_monotone_curve_2 & xcv2, Arr_curve_end ce2) const { - return (boost::apply_visitor(Compare_x_at_limit_2_visitor_2(_traits,ce1,ce2),xcv1.variant(),xcv2.variant())); + return (boost::apply_visitor(Compare_x_on_boundary_2_visitor_2(_traits,ce1,ce2),xcv1.variant(),xcv2.variant())); } private: - class Compare_x_at_limit_2_visitor_1 + class Compare_x_on_boundary_2_visitor_1 : public boost::static_visitor { public: typedef boost::static_visitor Base; - Compare_x_at_limit_2_visitor_1(Traits& traits,Arr_curve_end ce,const Point_2 & p) + Compare_x_on_boundary_2_visitor_1(Traits& traits,Arr_curve_end ce,const Point_2 & p) :_traits(traits), _ce(ce), _p(p), Base() {} Comparison_result operator()(const Non_vertical_x_curve_2& xcv ) const { - return _traits.compare_x_at_limit_2_object()(_p,xcv,_ce); + return _traits.compare_x_on_boundary_2_object()(_p,xcv,_ce); } Comparison_result operator()(const Vertical_segment& xcv) const { @@ -1562,18 +1562,18 @@ public: Traits& _traits; Point_2 _p; Arr_curve_end _ce; - }; //Compare_x_at_limit_2_visitor_1 - - class Compare_x_at_limit_2_visitor_2 + }; //Compare_x_on_boundary_2_visitor_1 + + class Compare_x_on_boundary_2_visitor_2 : public boost::static_visitor { public: typedef boost::static_visitor Base; - Compare_x_at_limit_2_visitor_2(Traits& traits,Arr_curve_end ce1,Arr_curve_end ce2) + Compare_x_on_boundary_2_visitor_2(Traits& traits,Arr_curve_end ce1,Arr_curve_end ce2) :_traits(traits), _ce1(ce1), _ce2(ce2), Base() {} Comparison_result operator()(const Non_vertical_x_curve_2& xcv1,const Non_vertical_x_curve_2& xcv2 ) const { - return _traits.compare_x_at_limit_2_object()(xcv1,_ce1,xcv2,_ce2); + return _traits.compare_x_on_boundary_2_object()(xcv1,_ce1,xcv2,_ce2); } Comparison_result operator()(const Non_vertical_x_curve_2& xcv1,const Vertical_segment& xcv2 ) const { @@ -1582,7 +1582,7 @@ public: else //_ce2 == ARR_MAX_END CGAL_precondition (xcv2.max_parameter_space() == CGAL::ARR_TOP_BOUNDARY); - return _traits.compare_x_at_limit_2_object()(xcv2.max(),xcv1,_ce1); + return _traits.compare_x_on_boundary_2_object()(xcv2.max(),xcv1,_ce1); } Comparison_result operator()(const Vertical_segment& xcv1,const Non_vertical_x_curve_2& xcv2 ) const { @@ -1591,7 +1591,7 @@ public: else //_ce1 == ARR_MAX_END CGAL_precondition (xcv1.max_parameter_space() == CGAL::ARR_TOP_BOUNDARY); - return _traits.compare_x_at_limit_2_object()(xcv1.max(),xcv2,_ce2); + return _traits.compare_x_on_boundary_2_object()(xcv1.max(),xcv2,_ce2); } Comparison_result operator()(const Vertical_segment& xcv1,const Vertical_segment& xcv2 ) const { @@ -1599,27 +1599,27 @@ public: CGAL_precondition (xcv1.min_parameter_space() == CGAL::ARR_BOTTOM_BOUNDARY); else //_ce1 == ARR_MAX_END CGAL_precondition (xcv1.max_parameter_space() == CGAL::ARR_TOP_BOUNDARY); - + if (_ce2 == ARR_MIN_END) CGAL_precondition (xcv2.min_parameter_space() == CGAL::ARR_BOTTOM_BOUNDARY); else //_ce2 == ARR_MAX_END CGAL_precondition (xcv2.max_parameter_space() == CGAL::ARR_TOP_BOUNDARY); - + return _traits.compare_x_2_object() (xcv1.min(),xcv2.min()); } private: Traits& _traits; Arr_curve_end _ce1,_ce2; - }; //Compare_x_at_limit_2_visitor_2 - }; //Compare_x_at_limit_2 + }; //Compare_x_on_boundary_2_visitor_2 + }; //Compare_x_on_boundary_2 - /*! Obtain a Compare_x_at_limit_2 function object */ - Compare_x_at_limit_2 compare_x_at_limit_2_object() const - { return Compare_x_at_limit_2(_traits); } + /*! Obtain a Compare_x_on_boundary_2 function object */ + Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const + { return Compare_x_on_boundary_2(_traits); } /*! A function object that compares the y-coordinates of arc ends near the * boundary of the parameter space. */ - class Compare_y_near_boundary_2 + class Compare_y_near_boundary_2 { private: Traits& _traits; @@ -1646,7 +1646,7 @@ public: { public: typedef boost::static_visitor Base; - Compare_y_near_boundary_2_visitor(Traits& traits,Arr_curve_end ce) + Compare_y_near_boundary_2_visitor(Traits& traits,Arr_curve_end ce) :_traits(traits), _ce(ce), Base() {} Comparison_result operator()(const Non_vertical_x_curve_2& xcv1,const Non_vertical_x_curve_2& xcv2 ) const { @@ -1680,7 +1680,7 @@ public: Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const { return Compare_y_near_boundary_2(_traits); } //@} - + /// \name Functor definitions for the Boolean set-operation traits. //@{ class Compare_endpoints_xy_2 @@ -1751,7 +1751,7 @@ public: } public: template - static void re_cast_object_vector(const Object_vector& vec,OutputIterator& oi) + static void re_cast_object_vector(const Object_vector& vec,OutputIterator& oi) { for (Object_vector::const_iterator it = vec.begin() ; it != vec.end(); ++it) { @@ -1784,7 +1784,7 @@ public: } else CGAL_precondition(false); - + ++oi; } return; @@ -1796,4 +1796,3 @@ public: #endif // CGAL_DONT_SUBMIT #endif //CGAL_ARR_RATIONAL_ARC_TRAITS_D_1_H - diff --git a/Arrangement_on_surface_2/archive/include/CGAL/Arr_rational_arc_traits_2.h b/Arrangement_on_surface_2/archive/include/CGAL/Arr_rational_arc_traits_2.h index 60539508d78..3172896ed6e 100644 --- a/Arrangement_on_surface_2/archive/include/CGAL/Arr_rational_arc_traits_2.h +++ b/Arrangement_on_surface_2/archive/include/CGAL/Arr_rational_arc_traits_2.h @@ -15,7 +15,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0+ -// +// // // Author(s) : Ron Wein @@ -27,7 +27,7 @@ #include /*! \file - * Definition of the Arr_rational_arc_traits_2 class. + * Definition of the Arr_rational_arc_traits_2 class. */ #include @@ -43,15 +43,15 @@ namespace CGAL { * A traits class for maintaining an arrangement of bounded arcs (segments) of * rational functions of arbitrary degree. * - * The class is templated with two parameters: + * The class is templated with two parameters: * Alg_kernel A geometric kernel, where Alg_kernel::FT is the number type * for the coordinates of arrangement vertices, which are algebraic * numbers (defined by Nt_traits::Algebraic). * Nt_traits A traits class for performing various operations on the integer, - * rational and algebraic types. + * rational and algebraic types. */ template -class Arr_rational_arc_traits_2 +class Arr_rational_arc_traits_2 { public: @@ -265,7 +265,7 @@ public: ); CGAL_precondition ((cv1.left_infinite_in_x() != ARR_INTERIOR || cv1.left_infinite_in_y() != ARR_INTERIOR || - ker.compare_xy_2_object() (p, + ker.compare_xy_2_object() (p, cv1.left()) == LARGER) && (cv2.left_infinite_in_x() != ARR_INTERIOR || cv2.left_infinite_in_y() != ARR_INTERIOR || @@ -275,10 +275,10 @@ public: // Compare the slopes of the two arcs. Comparison_result res; unsigned int mult; - + res = cv1.compare_slopes (cv2, p, mult); - // The comparison result is to the right of p. In case the multiplicity + // The comparison result is to the right of p. In case the multiplicity // of the intersection point p is odd, reverse this result. if (mult % 2 == 1) { @@ -329,7 +329,7 @@ public: ); CGAL_precondition((cv1.right_infinite_in_x() != ARR_INTERIOR || cv1.right_infinite_in_y() != ARR_INTERIOR || - ker.compare_xy_2_object() (p, + ker.compare_xy_2_object() (p, cv1.right()) == SMALLER) && (cv2.right_infinite_in_x() != ARR_INTERIOR || cv2.right_infinite_in_y() != ARR_INTERIOR || @@ -397,7 +397,7 @@ public: public: /*! - * Cut the given conic curve (or conic arc) into x-monotone subcurves + * Cut the given conic curve (or conic arc) into x-monotone subcurves * and insert them to the given output iterator. * \param cv The curve. * \param oi The output iterator, whose value-type is Object. The returned @@ -520,14 +520,14 @@ public: /*! The traits (in case it has state) */ const Traits* m_traits; - + /*! Constructor * \param traits the traits (in case it has state) */ Merge_2(const Traits* traits) : m_traits(traits) {} friend class Arr_rational_arc_traits_2; - + public: /*! * Merge two given x-monotone curves into a single curve (segment). @@ -595,7 +595,7 @@ public: /*! Obtain a Parameter_space_in_x_2 function object */ Parameter_space_in_x_2 parameter_space_in_x_2_object() const { return Parameter_space_in_x_2(); } - + /*! A function object that obtains the parameter space of a geometric * entity along the y-axis */ @@ -643,7 +643,7 @@ public: /*! A function object that compares the x-limits of arc ends on the * boundary of the parameter space */ - class Compare_x_at_limit_2 { + class Compare_x_on_boundary_2 { public: /*! Compare the x-coordinate of a point and the x-coordinate of the limit * of a rational arc at its specificed end at y = +/- oo. @@ -655,7 +655,7 @@ public: * \return the comparison result: * SMALLER - x(p) < x(xc, ce); * EQUAL - x(p) = x(xc, ce); - * LARGER - x(p) > x(xc, ce). + * LARGER - x(p) > x(xc, ce). * \pre p lies in the interior of the parameter space. * \pre the ce end of the curve xcv lies on a boundary, implying that xcv * is either a vertical line or a curve with a vertical asymptote. @@ -697,16 +697,16 @@ public: } }; - /*! Obtain a Compare_x_at_limit_2 function object */ - Compare_x_at_limit_2 compare_x_at_limit_2_object() const - { return Compare_x_at_limit_2(); } - + /*! Obtain a Compare_x_on_boundary_2 function object */ + Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const + { return Compare_x_on_boundary_2(); } + /*! A function object that compares the x-coordinates of arc ends near the * boundary of the parameter space */ - class Compare_x_near_limit_2 { + class Compare_x_near_boundary_2 { public: - + /*! Compare the x-coordinates of 2 arcs ends near the boundary of the * parameter space at y = +/- oo. * \param xcv1 the first arc. @@ -730,10 +730,10 @@ public: } }; - /*! Obtain a Compare_x_near_limit_2 function object */ - Compare_x_near_limit_2 compare_x_near_limit_2_object() const - { return Compare_x_near_limit_2(); } - + /*! Obtain a Compare_x_near_boundary_2 function object */ + Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const + { return Compare_x_near_boundary_2(); } + /*! A function object that compares the y-coordinates of arc ends near the * boundary of the parameter space. @@ -764,10 +764,10 @@ public: { return Compare_y_near_boundary_2(); } //@} - + /// \name Functor definitions for the Boolean set-operation traits. //@{ - + class Compare_endpoints_xy_2 { public: diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_spherical_overlay.cpp b/Arrangement_on_surface_2/archive/tests/Arrangement_on_surface_2/test_spherical_overlay.cpp similarity index 99% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_spherical_overlay.cpp rename to Arrangement_on_surface_2/archive/tests/Arrangement_on_surface_2/test_spherical_overlay.cpp index 17ad889b229..74678a9c862 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_spherical_overlay.cpp +++ b/Arrangement_on_surface_2/archive/tests/Arrangement_on_surface_2/test_spherical_overlay.cpp @@ -1,6 +1,3 @@ -// #define CGAL_IDENTIFICATION_XY 2 -// #define CGAL_SS_VERBOSE 1 - #include #include #include diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt index 719b0deceed..0fce3f5b8a1 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt @@ -6,132 +6,309 @@ namespace CGAL { \anchor chapterArrangement_on_surface_2 \cgalAutoToc -\authors Ron Wein, Eric Berberich, Efi Fogel, Dan Halperin, Michael Hemmer, Oren Salzman, and Baruch Zukerman +\authors Ron Wein, Eric Berberich, Efi Fogel, Dan Halperin, +Michael Hemmer, Oren Salzman, and Baruch Zukerman -\section arr_secintro Introduction +\section aos_sec-intro Introduction -Given a set \f$ \cal C\f$ of planar curves, the arrangement -\f$ \cal A(\cal C)\f$ is the subdivision of the plane into zero-dimensional, -one-dimensional and two-dimensional cells, called vertices, edges and faces, respectively induced by the curves in \f$ \cal C\f$. -Arrangements are ubiquitous in the computational-geometry -literature and have many applications; -see, e.g., \cgalCite{as-aa-00}, \cgalCite{cgal:h-a-04}. - -The curves in \f$ \cal C\f$ can intersect each other (a single curve may also -be self-intersecting or may be comprised of several disconnected branches) -and are not necessarily \f$ x\f$-monotone.\cgalFootnote{A continuous planar curve \f$ C\f$ is \f$ x\f$-monotone if every vertical line intersects it at most once. For example, a non-vertical line segment is always \f$ x\f$-monotone and so is the graph of any continuous function \f$ y = f(x)\f$. For convenience, we treat vertical line segments as weakly \f$ x\f$-monotone, as there exists a single vertical line that overlaps them. A circle of radius \f$ r\f$ centered at \f$ (x_0, y_0)\f$ is not \f$ x\f$-monotone, as the vertical line \f$ x = x_0\f$ intersects it at \f$ (x_0, y_0 - r)\f$ and at \f$ (x_0, y_0 + r)\f$.} -We construct a collection \f$ \cal C''\f$ of -\f$ x\f$-monotone subcurves that are pairwise disjoint in their interiors -in two steps as follows. First, we decompose each curve in \f$ \cal C\f$ -into maximal \f$ x\f$-monotone subcurves (and possibly isolated points), -obtaining the collection \f$ \cal C'\f$. Note that an \f$ x\f$-monotone curve cannot -be self-intersecting. Then, we decompose each curve in \f$ \cal C'\f$ into -maximal connected subcurves not intersecting any other -curve (or point) in \f$ \cal C'\f$. The collection \f$ \cal C''\f$ may also -contain isolated points, if the curves of \f$ \cal C\f$ contain such -points. The arrangement induced by the collection \f$ \cal C''\f$ can be -conveniently embedded as a planar graph, whose vertices are associated -with curve endpoints or with isolated points, and whose edges are -associated with subcurves. It is easy to see that -\f$ \cal A(\cal C) = \cal A(\cal C'')\f$. This graph can be represented using a -doubly-connected edge list data-structure (\sc{Dcel} for short), -which consists of containers of vertices, edges and faces and -maintains the incidence relations among these objects. - -The main idea behind the \sc{Dcel} data-structure is to represent -each edge using a pair of directed halfedges, one going from -the \f$ xy\f$-lexicographically smaller (left) endpoint of the curve toward -its the \f$ xy\f$-lexicographically larger (right) endpoint, and the other, -known as its twin halfedge, going in the opposite direction. As each -halfedge is directed, we say it has a source vertex and a target -vertex. Halfedges are used to separate faces, and to -connect vertices (with the exception of isolated vertices, which -are unconnected). - -If a vertex \f$ v\f$ is the target of a halfedge \f$ e\f$, we say that \f$ v\f$ -and \f$ e\f$ are incident to each other. The halfedges incident -to a vertex \f$ v\f$ form a circular list oriented in a clockwise order -around this vertex. (An isolated vertex has no incident halfedges.) - -Each halfedge \f$ e\f$ stores a pointer to its incident face, -which is the face lying to its left. Moreover, every halfedge is -followed by another halfedge sharing the same incident face, such -that the target vertex of the halfedge is the same as the source -vertex of the next halfedge. The halfedges are therefore connected -in circular lists, and form chains, such that all edges of a chain -are incident to the same face and wind along its boundary. We call -such a chain a connected component of the boundary (or CCB for short). - -The unique CCB of halfedges winding in a counterclockwise orientation -along a face boundary is referred to as the outer CCB of the -face. For the time being let us consider only arrangements of -bounded curves, such that exactly one unbounded face exists in every -arrangement. The unbounded face does not have an outer boundary. Any -other connected component of the boundary of the face is called a -hole (or inner CCB), and can be represented as a circular -chain of halfedges winding in a clockwise orientation around it. -Note that a hole does not necessarily correspond to a single face, -as it may have no area, or alternatively it may consist of several -connected faces. Every face can have several holes contained in its -interior (or no holes at all). In addition, every face may contain -isolated vertices in its interior. See \cgalFigureRef{arr_figseg_dcel} -for an illustration of the various \sc{Dcel} features. For more details -on the \sc{Dcel} data structure see \cgalCite{bkos-cgaa-00} Chapter 2. - -\cgalFigureBegin{arr_figseg_dcel,arr_segs.png} -An arrangement of interior-disjoint line segments with some of the \sc{Dcel} records that represent it. The unbounded face \f$ f_0\f$ has a single connected component that forms a hole inside it, and this hole is comprised if several faces. The half-edge \f$ e\f$ is directed from its source vertex \f$ v_1\f$ to its target vertex \f$ v_2\f$. This edge, together with its twin \f$ e'\f$, correspond to a line segment that connects the points associated with \f$ v_1\f$ and \f$ v_2\f$ and separates the face \f$ f_1\f$ from \f$ f_2\f$. The predecessor \f$ e_{\rm prev}\f$ and successor \f$ e_{\rm next}\f$ of \f$ e\f$ are part of the chain that form the outer boundary of the face \f$ f_2\f$. The face \f$ f_1\f$ has a more complicated structure as it contains two holes in its interior: One hole consists of two adjacent faces \f$ f_3\f$ and \f$ f_4\f$, while the other hole is comprised of two edges. \f$ f_1\f$ also contains two isolated vertices \f$ u_1\f$ and \f$ u_2\f$ in its interior. +Geometric arrangements, or arrangements for short, are subdivisions of +some space induced by geometric objects. Figure +\cgalFigureRef{aos_fig-simple_arr} shows an arrangement of two curves +\f$C_1\f$ and \f$C_2\f$ in the plane. It has three faces—two +bounded faces \f$f_1\f$ and \f$f_2\f$ (filled with diagonal-stripe +patterns) and an unbounded face. The arrangement has seven +vertices—four represent the endpoints of \f$C_1\f$ and \f$C_2\f$ +(drawn as small discs), and three represent the intersection points of +the two curves (drawn as small rings). The arrangement also has eight +edges, each of which is a maximal portion of one curve not +intersecting the other. +\cgalFigureBegin{aos_fig-simple_arr,simple_arr.png} \cgalFigureEnd -The \f$ x\f$-monotone curves of an arrangement are embedded in an -rectangular two-dimensional area called the parameter -space.\cgalFootnote{The term parameter space stems from a major extension the arrangement package is going through to support arrangements embedded on certain two-dimensional parametric surfaces in three-dimensions (or higher).} The parameter space is -defined as \f$ X \times Y\f$, where \f$ X\f$ and \f$ Y\f$ are open, half-open, or -closed intervals with endpoints in the compactified real line -\f$ \mathbb{R} \cup \{-\infty,+\infty\}\f$. Let \f$ b_l\f$, \f$ b_r\f$, \f$ b_b\f$, and -\f$ b_t\f$ denote the endpoints of \f$ X\f$ and \f$ Y\f$, respectively. We -typically refer to these values as the left, right, bottom, and top -sides of the boundary of the parameter space. If the parameter space -is, for example, the entire compactified plane, which is currently -the only option supported by the package, \f$ b_l = b_b = -\infty\f$ and -\f$ b_r = b_t = +\infty\f$. +Arrangements are not restricted to curves in the plane. There are +useful arrangements in three and higher dimensions (these are not so +easy to visualize) and they can be induced by geometric objects of any +type, such as spheres, simplices, polytopes, or Bézier +surfaces. This package provides a data structure that represents a +two-dimensional arrangement of curves embedded on an orientable +parametric surface in three dimensional space, such as a plane, a +cylinder, a sphere, a tori, or a surface homeomorphic to them. This +package also provides operations that construct and manipulate such +arrangements. Arrangements are ubiquitous in the +computational-geometry literature and have many applications; see, +e.g., \cgalCite{as-aa-00}, \cgalCite{cgal:bfhks-apsca-10}, +\cgalCite{cgal:bfhmw-apsgf-10}, and \cgalCite{cgal:h-a-04}. -The rest of this chapter is organized as follows: In -Section \ref arr_secarr_class we review in detail the interface -of the `Arrangement_2` class-template, which is the central -component in the arrangement package. In -Section \ref arr_secqueries we show how queries on an arrangement -can be issued. In Section \ref arr_secgl_funcs we -review some important free (global) functions that operate on -arrangements, the most important ones being the free -insertion-functions. Section \ref arr_sectraits contains detailed -descriptions of the various geometric traits classes included in -the arrangement package. Using these traits classes it is possible -to construct arrangements of different families of curves. In -Section \ref arr_secnotif we review the notification mechanism -that allows external classes to keep track of the changes that an -arrangement instance goes through. Section \ref arr_secex_dcel -explains how to extend the \sc{Dcel} records, to store extra data -with them, and to efficiently update this data. -In Section \ref arr_secoverlay we introduce the fundamental -operation of overlaying two arrangements. -Section \ref arr_secarr_with_hist describes the -`Arrangement_with_history_2` class-template that extends the -arrangement by storing additional history records with its curves. -Finally, in Section \ref arr_secio we review the arrangement -input/output functions. +\subsection aos_ssec-intro-sep Separation of Topology and Geometry -\section arr_secarr_class The Main Arrangement Class +The use of the generic programming paradigm enables a convenient +separation of the topology and the geometry of data +structures.\cgalFootnote{In this context, we sometimes say +combinatorics instead of topology, and say algebra or +numerics instead of geometry. We always mean the same +thing---the separation of the abstract, graph-like structure (the +topology) from the actual embedding in the plane (the geometry).} +This is a key aspect in the design of geometric software, and is put +into practice, for example, in the design of \cgal polyhedra, \cgal +triangulations, and our \cgal arrangements. This separation allows the +convenient abstraction of algorithms and data structures in +combinatorial and topological terms, regardless of the specific +geometry of the objects at hand. This abstraction is realized through +class and function templates that represent specific data structures +and algorithmic frameworks, respectively. Consider the class template -The class `Arrangement_2` is the main class in -the arrangement package. It is used to represent planar -arrangements and it provides the interface needed to construct them, -traverse them, and maintain them. An arrangement is defined by -a geometric traits class that determines the family of planar -curves that form the arrangement, and a \sc{Dcel} class, which -represents the topological structure of the planar subdivision. -It supplies a minimal set of geometric operations (predicates and -constructions) required to construct and maintain the arrangement -and to operate on it. + +template +class Arrangement_2 { ... }; + + +An instance of this template represents an arrangement embedded in the +plane. When the template is instantiated the `GeometryTraits` +parameter must be substituted with a type that defines a set of +geometric-object types, such as point and curve, and a set of +operations on objects of these types (see Section \ref +aos_sec-geom_traits); the `Dcel` parameter must be substituted with a +type that represents a doubly-connected edge list (\sc{Dcel}) data +structure. It defines topological-object types, such as vertices, +edges, and faces, and the operations required to maintain the +incidence relations among objects of these types (see Section \ref +aos_ssec-basic-dcel). + +The class template `Arrangement_2` derives from the following class +template: + + +template +class Arrangement_on_surface_2 { ... }; + + +An instance of this template represents a two-dimensional arrangement +embedded on a surface in three dimensional space. When the template is +instantiated the `GeometryTraits` parameter must be substituted as +described above; the `TopologyTraits` parameter must be substituted +with a type that deals with the topology of the surface (see Section +\ref aos_sec-topol_traits). In particular, it maintains a +representation of the arrangement planar graph using an extended +doubly-connected edge list (\sc{EDcel}) data-structure suitable for +the particular topology. + +An immediate advantage of the separation of the topology and the +geometry of data structures is that users with limited expertise in +computational geometry can employ the data structure with their own +special type of objects. They must, however, supply the relevant +traits class, which mainly involves algebraic computations. A traits +class also encapsulates the number types used to represent coordinates +of geometric objects and to carry out algebraic operations on them. It +encapsulates the type of coordinate system used (e.g., Cartesian and +homogeneous), and the geometric or algebraic computation methods +themselves. The precise set of requirements, the actual traits classes +must conform to, are organized as a hierarchy of compact concepts; see +Section \ref aos_sec-geom_traits. + +\subsection aos_ssec-intro-well_behaved Well-Behaved Curves + +What constitutes valid curves that can be handled by the +\ref PkgArrangement2Summary package is discussed in detail in Section +\ref aos_sec-geom_traits, where the models of the traits classes are +described. However, when we cite combinatorial complexity bounds or +bounds on the resources (running time, storage) required by +algorithms, we often postulate stricter assumptions on the input +curves. The prevalent term in use is that the curves are well +behaved, which may have different interpretations in different +settings. If we are concerned with combinatorial complexity bounds for +curves in the plane, then the standard assumptions are that (i) each +curve is non-self-intersecting (so-called Jordan arc) and (ii) every +pair of curves intersects in at most some constant number of +points. For algorithmic purposes we need to require more since we +assume that any operation on a small constant number of curves takes +unit time. In this sense arcs of algebraic curves of degree bounded by +a constant (namely the zero set of bivariate polynomials of constant +maximum total degree) are well behaved. Naturally, what are typically +considered well-behaved surfaces in \f$\mathbb{R}^3\f$ is even more +complicated to state. + +Remarks +
    +
  1. From the complexity-bound perspective, most of the arrangements + that we can deal with can be regarded as defined by well-behaved + curves. Even though the package allows for self-intersecting curves, + for most types each curve can be decomposed into a constant number + of well-behaved curves, thus having no effect on the asymptotic + bounds that we cite. +
  2. +
  3. One type of curves that we deal with is special in this sense: + polylines, namely concatenations of an unlimited number of + line segments. A is not considered well behaved, as it cannot be + decomposed into a constant number of constant-descriptive complexity + subcurves. Informative bounds for arrangements of polylines are + expressed by other parameters in addition to the number of + polylines, for example, the total number of segments in all the + polylines together. The same holds for the more general type + polycurve, which are piecewise curves that are not + necessarily linear. +
  4. +
+ +\subsection aos_ssec-intro-outline Outline + +In Section \ref aos_sec-basic we provide the minimum material you need +to know in order to use \cgal 2D arrangements in the plane. In Section +\ref aos_sec-curved_surfaces we provide additional material you need to know +in order use \cgal 2D arrangements embedded on curved surfaces. Most +of the succeeding material is oblivious to the type of the embedding +surface. In Section \ref arr_secqueries we show how queries on an +arrangement can be issued. In Section \ref arr_secgl_funcs we review +some important free (global) functions that operate on arrangements, +the most important ones being the free insertion-functions. In Section +\ref aos_sec-unbounded we explain how to construct and manipulate +arrangements of unbounded curves. Section \ref aos_sec-geom_traits +contains detailed descriptions of the geometric traits concept +hierarchy and the various geometric traits classes included in the +arrangement package. The different traits classes enables the +construction and manipulation of arrangements of different families of +curves. Naturally, here, the embedding surface plays a significant +role. In Section \ref arr_secnotif we review the notification +mechanism that allows external classes to keep track of the changes +that an arrangement instance goes through. Section \ref arr_secex_dcel +explains how to extend the \sc{Dcel} records, to store extra data with +them, and to efficiently update this data. In Section \ref +arr_secoverlay we introduce the fundamental operation of overlaying +two arrangements. Section \ref arr_secarr_with_hist describes a +class-template that extends the arrangement by storing additional +history records with its curves. In Section \ref aos_sec-io we review +the arrangement input/output functions. In Section \ref aos_sec-bgl we +describes how to apply the graph algorithms implemented in the Boost +Graph Library to arrangement types. Finally, in Section \ref +aos_sec-tips we provide some tips that can be applied to expedite +cmoputation. + +\section aos_sec-basic Basic Arrangements + +We start with a formal definition of two-dimensional planar +arrangements, and proceed with an introduction to the data structure +used to represent the incidence relations among features of +two-dimensional arrangements, namely, the doubly-connected edge +list, or \sc{dcel} for short. In Section \ref +aos_ssec-basic-arr_class we review in detail the interface of the +`Arrangement_2` class-template, which can be used to represent +arrangements in the plane. It is a central component in the +arrangement package. + +\subsection aos_ssec-basic-dcel Representation of Arrangements: The Dcel + +Given a set \f$\cal C\f$ of planar curves, the arrangement +\f$\cal A(\cal C)\f$ is the subdivision of the plane into +zero-dimensional, one-dimensional and two-dimensional +cells,\cgalFootnote{We use the term cell to describe the +various dimensional entities in the induced subdivision. Sometimes, +the term face is used for this purpose in the +literature. However, we use the term face to describe a +two-dimensional cell.} called vertices, +edges and faces, respectively, induced by the curves +in \f$\cal C\f$. + +The curves in \f$\cal C\f$ can intersect each other (a single curve +may also be self-intersecting or may comprise several disconnected +branches) and are not necessarily \f$x\f$-monotone.\cgalFootnote{A +continuous planar curve \f$C\f$ is \f$x\f$-monotone if every +vertical line intersects it at most once. For example, a non-vertical +line segment is always \f$x\f$-monotone and so is the graph of any +continuous function \f$y = f(x)\f$. For convenience, we treat vertical +line segments as weakly \f$x\f$-monotone, as there exists a +single vertical line that overlaps them. A circle of radius \f$r\f$ +centered at \f$(x_0, y_0)\f$ is not \f$x\f$-monotone, as the vertical +line \f$x = x_0\f$ intersects it at \f$(x_0, y_0 - r)\f$ and at +\f$(x_0, y_0 + r)\f$.} We construct a collection \f$\cal C''\f$ of +\f$x\f$-monotone subcurves that are pairwise disjoint in their +interiors in two steps as follows. First, we decompose each curve in +\f$\cal C\f$ into maximal \f$x\f$-monotone subcurves (and possibly +isolated points), obtaining the collection \f$\cal C'\f$. Note that an +\f$x\f$-monotone curve cannot be self-intersecting. Then, we decompose +each curve in \f$\cal C'\f$ into maximal connected subcurves not +intersecting any other curve (or point) in \f$\cal C'\f$. The +collection \f$\cal C''\f$ may also contain isolated points, if the +curves of \f$\cal C\f$ contain such points. The arrangement induced by +the collection \f$\cal C''\f$ can be conveniently embedded as a planar +graph, whose vertices are associated with curve endpoints or with +isolated points, and whose edges are associated with subcurves. It is +easy to see that \f$\cal A(\cal C) = \cal A(\cal C'')\f$. This graph +can be represented using a doubly-connected edge list +data-structure (\sc{Dcel} for short), which consists of containers of +vertices, edges and faces and maintains the incidence relations among +these cells. + +The \sc{Dcel} data-structure represents each edge using a pair of +directed halfedges, one going from the +\f$xy\f$-lexicographically smaller (left) endpoint of the curve +towards the \f$xy\f$-lexicographically larger (right) endpoint, and +the other, known as its twin halfedge, going in the opposite +direction. As each halfedge is directed, it has a source +vertex and a target vertex. Halfedges are used to separate +faces, and to connect vertices, with the exception of isolated +vertices (representing isolated points), which are unconnected. +If a vertex \f$v\f$ is the target of a halfedge \f$ e\f$, we say that +\f$v\f$ and \f$e\f$ are incident to each other. The halfedges +incident to a vertex \f$v\f$ form a circular list oriented in a +clockwise order around this vertex. (An isolated vertex has no +incident halfedges.) + +An edge of an arrangement is a maximal portion of a curve +between two vertices of the arrangement. Each edge is represented in +the \sc{Dcel} by a pair of twin halfedges. Each halfedge \f$e\f$ +stores a pointer to its incident face, which is the face lying +to its left. Moreover, every halfedge is followed by another halfedge +sharing the same incident face, such that the target vertex of the +halfedge is the same as the source vertex of the next halfedge. The +halfedges around faces form circular chains, such that all halfedges +of a chain are incident to the same face and wind along its boundary. +We call such a chain a connected component of the boundary or +CCB for short. + +The unique CCB of halfedges winding in a counterclockwise orientation +along a face boundary is referred to as the outer CCB of the +face. For the time being let us consider only arrangements of bounded +curves, such that exactly one unbounded face exists in every +arrangement. The unbounded face does not have an outer boundary. Any +other connected component of the boundary of the face is called a +hole (or inner CCB), and can be represented as a +circular chain of halfedges winding in a clockwise orientation around +it. Note that a hole does not necessarily correspond to a face at all, +as it may have no area, or alternatively it may contain several faces. +Every face can have several holes in its interior, or may contain no +holes at all. In addition, every face may contain isolated vertices in +its interior. See \cgalFigureRef{arr_figseg_dcel} for an illustration +of the various \sc{Dcel} features. For more details on the \sc{Dcel} +data structure see \cgalCite{bkos-cgaa-00} Chapter 2. + +\cgalFigureBegin{arr_figseg_dcel,arr_segs.png} +An arrangement of interior-disjoint line segments with some of the +\sc{Dcel} records that represent it. The unbounded face \f$f_0\f$ has +a single connected component that forms a hole inside it, and this +hole is comprised if several faces. The half-edge \f$e\f$ is directed +from its source vertex \f$v_1\f$ to its target vertex \f$v_2\f$. This +edge, together with its twin \f$e'\f$, correspond to a line segment +that connects the points associated with \f$v_1\f$ and \f$v_2\f$ and +separates the face \f$f_1\f$ from \f$f_2\f$. The predecessor \f$e_{\rm +prev}\f$ and successor \f$e_{\rm next}\f$ of \f$e\f$ are part of the +chain that form the outer boundary of the face \f$f_2\f$. The face +\f$f_1\f$ has a more complicated structure as it contains two holes in +its interior: One hole consists of two adjacent faces \f$f_3\f$ and +\f$f_4\f$, while the other hole is comprised of two edges. \f$f_1\f$ +also contains two isolated vertices \f$u_1\f$ and \f$u_2\f$ in its +interior. +\cgalFigureEnd + +\subsection aos_ssec-basic-arr_class The Arrangement Class Template + +The class template `Arrangement_2` can be used to represent +a planar arrangement; it provides the interface needed to construct +planar arrangements, traverse them, and maintain them. An arrangement +is defined by a geometric traits class that determines the +family of planar curves that form the arrangement, and a \sc{Dcel} +class. The traits class supplies a minimal set of geometric operations +(predicates and constructions) required to construct and maintain the +arrangement and to operate on it. The \sc{Dcel} class represents the +topological structure of the planar subdivision. The design of the arrangement package is guided by the need to separate between the representation of the arrangements and the @@ -139,13 +316,14 @@ various geometric algorithms that operate on them, and by the need to separate between the topological and geometric aspects of the planar subdivision. The separation is exhibited by the two template parameters of the `Arrangement_2` template: +
  • The `Traits` template-parameter should be instantiated with a - model of the `ArrangementBasicTraits_2` concept and optionally - additional geometry traits concepts. A model of the - `ArrangementBasicTraits_2` concept defines the types of \f$ - x\f$-monotone curves and two-dimensional points, namely + model of the `ArrangementBasicTraits_2` concept or optionally a + concept that refines the `ArrangementBasicTraits_2` concept. A model + of the `ArrangementBasicTraits_2` concept defines the types of + \f$x\f$-monotone curves and two-dimensional points, namely `X_monotone_curve_2` and `Point_2`, respectively, and supports basic geometric predicates on them. @@ -155,7 +333,7 @@ parameters of the `Arrangement_2` template: contains several other traits classes that can handle other types of curves, such as polylines (continuous piecewise-linear curves), conic arcs, and arcs of rational functions. We exemplify the usage - of these traits classes in Section \ref arr_sectraits. + of these traits classes in Section \ref aos_sec-geom_traits.
  • The `Dcel` template-parameter should be instantiated with a class that is a model of the `ArrangementDcel` concept. The value of this parameter is `Arr_default_dcel` by default. However, in @@ -170,13 +348,13 @@ parameters of the `Arrangement_2` template: \image latex triangle.png The simple program listed below constructs a planar map of three line -segments forming a triangle. The constructed arrangement is instantiated -with the `Arr_segment_traits_2` traits class to handle segments only. -The resulting arrangement consists of two faces, a bounded triangular face -and the unbounded face. -The program is not very useful as it is, since it ends immediately -after the arrangement is constructed. We give more enhanced examples -in the rest of this chapter. +segments forming a triangle. The constructed arrangement is +instantiated with the `Arr_segment_traits_2` traits class to handle +segments only. The resulting arrangement consists of two faces, a +bounded triangular face and the unbounded face. The program is not +very useful as it is, since it ends immediately after the arrangement +is constructed. We give more enhanced examples in the rest of this +chapter. \code{.cpp} #include @@ -209,21 +387,20 @@ int main() \subsection arr_ssectraverse Traversing the Arrangement The simplest and most fundamental arrangement operations are the -various traversal methods, which allow users to systematically go -over the relevant features of the arrangement at hand. +various traversal methods, which allow users to systematically go over +the relevant features of the arrangement at hand. As mentioned above, the arrangement is represented as a \sc{Dcel}, which stores three containers of vertices, halfedges and faces. Thus, -the `Arrangement_2` class supplies iterators for these -containers. For example, the methods `vertices_begin()` and -`vertices_end()` return `Arrangement_2::Vertex_iterator` -objects that define the valid range of arrangement vertices. The value -type of this iterator is `Arrangement_2::Vertex`. Moreover, the -vertex-iterator type is equivalent to -`Arrangement_2::Vertex_handle`, which serves as a pointer to a -vertex. As we show next, all functions related to arrangement features -accept handle types as input parameters and return handle types as -their output. +the `Arrangement_2` class supplies iterators for these containers. For +example, the methods `vertices_begin()` and `vertices_end()` return +`Arrangement_2::Vertex_iterator` objects that define the valid range +of arrangement vertices. The value type of this iterator is +`Arrangement_2::Vertex`. Moreover, the vertex-iterator type is +equivalent to `Arrangement_2::Vertex_handle`, which serves as a +pointer to a vertex. As we show next, all functions related to +arrangement features accept handle types as input parameters and +return handle types as their output. In addition to the iterators for arrangement vertices, halfedges and faces, the arrangement class also provides `edges_begin()` @@ -233,23 +410,24 @@ arrangement edges. Note that the value type of this iterator is `Arrangement_2::Halfedge`, representing one of the twin halfedges that represent the edge. -All iterator, circulator\cgalFootnote{A circulator is used to traverse a circular list, such as the list of halfedges incident to a vertex - see below.} and handle types also have non-mutable -(const) counterparts. These non-mutable iterators are useful -to traverse an arrangement without changing it. For example, -the arrangement has a -non-constant member function called `vertices_begin()` that -returns a `Vertex_iterator` object and another const member -function that returns a `Vertex_const_iterator` object. In fact, -all methods listed in this section that return an iterator, a -circulator or a handle have non-mutable counterparts. It should be -noted that, for example, `Vertex_handle` can be readily converted -into a `Vertex_const_handle`, but not vice-verse. +All iterator, circulator\cgalFootnote{A circulator is used to +traverse a circular list, such as the list of halfedges incident to a +vertex - see below.} and handle types also have non-mutable +(const) counterparts. These non-mutable iterators are useful to +traverse an arrangement without changing it. For example, the +arrangement has a non-constant member function called +`vertices_begin()` that returns a `Vertex_iterator` object and another +const member function that returns a `Vertex_const_iterator` +object. In fact, all methods listed in this section that return an +iterator, a circulator or a handle have non-mutable counterparts. It +should be noted that, for example, `Vertex_handle` can be readily +converted into a `Vertex_const_handle`, but not vice-verse. -Conversion of a non-mutable handle to a corresponding mutable -handle are nevertheless possible, and can be performed using the -static function `Arrangement_2::non_const_handle()` (see, e.g., -Section \ref arr_ssecpl). There are -three variant of this function, one for each type of handle. +Conversion of a non-mutable handle to a corresponding mutable handle +are nevertheless possible, and can be performed using the static +function `Arrangement_2::non_const_handle()` (see, e.g., Section \ref +arr_ssecpl). There are three variant of this function, one for each +type of handle. \subsection arr_sssectr_vertex Traversal Methods for an Arrangement Vertex @@ -263,9 +441,6 @@ right scope to get the right link in the manual. So we could write: an `Arrangement_2::Point_2` object, which can be obtained by the `Arrangement_2::Vertex::point()` method.\" - - - The `is_isolated()` method determines whether a vertex is isolated or not. Recall that the halfedges incident to a non-isolated vertex, namely the halfedges that share a common target vertex, form a circular @@ -324,7 +499,7 @@ method. From the definition of halfedges, it follows that if Every halfedge has an incident face that lies to its left, which can be obtained by the `face()` method. Recall that a halfedge is always one link in a connected chain of halfedges that -share the same incident face, known as a CCB. The +share the same incident face, known as a CCB. The `prev()` and `next()` methods return handles to the previous and next halfedges in the CCB respectively. @@ -333,7 +508,7 @@ traverse it using a circulator. The `ccb()` method returns a `Arrangement_2::Ccb_halfedge_circulator` object for the halfedges along the CCB. -The function `print_ccb()` listed below prints all \f$ x\f$-monotone +The function `print_ccb()` listed below prints all \f$x\f$-monotone curves along a given CCB (assuming that the `Point_2` and the `X_monotone_curve_2` types can be inserted into the standard output using the `<<` operator). @@ -356,7 +531,7 @@ void print_ccb (Arrangement_2::Ccb_halfedge_const_circulator circ) An arrangement of bounded curves always has a single unbounded face. The function `unbounded_face()` returns a handle to this face. -(Note that an empty arrangement contains nothing but the +(Note that an empty arrangement contains nothing but the unbounded face.) Given a `Face` object, we can use the `is_unbounded()` @@ -414,11 +589,17 @@ void print_face (Arrangement_2::Face_const_handle f) } \endcode -\subsection arr_sssectr_ex Additional Example +\subsection aos_ssec-tr_ex Additional Example The function listed below prints the current setting of a given arrangement. This concludes the preview of the various traversal -methods.\cgalFootnote{The file `arr_print.h`, which can be found under the examples folder, includes this function and the rest of the functions listed in this section. Over there they are written in a more generic fashion, where the arrangement type serves as a template parameter for these functions, so different instantiations of the `Arrangement_2` template can be provided to the same function templates.} +methods.\cgalFootnote{The file `arr_print.h`, which can be found under +the examples folder, includes this function and the rest of the +functions listed in this section. Over there they are written in a +more generic fashion, where the arrangement type serves as a template +parameter for these functions, so different instantiations of the +`Arrangement_2` template can be provided to the same +function templates.} \code void print_arrangement (const Arrangement_2& arr) @@ -465,7 +646,7 @@ construct an arrangement using the free (global) insertion-functions. The most important functions that allow users to modify the arrangement, and perhaps the most frequently used ones, are the -specialized insertion functions of \f$ x\f$-monotone curves whose +specialized insertion functions of \f$x\f$-monotone curves whose interior is disjoint from any other curve in the existing arrangement and do not contain any vertex of the arrangement. In addition, these function require that the location of the curve in the @@ -474,7 +655,7 @@ arrangement is known. The motivation behind these rather harsh restrictions on the nature of the inserted curves is the decoupling of the topological arrangement representation from the various algorithms that operate on it. While -the insertion of an \f$ x\f$-monotone curve whose interior is disjoint +the insertion of an \f$x\f$-monotone curve whose interior is disjoint from all existing arrangement features is quite straightforward (as we show next), inserting curves that intersect with the curves already inserted into the arrangement is much more complicated and requires @@ -486,14 +667,27 @@ for more details and examples. \cgalFigureBegin{arr_figex_1,insert.png} - The various specialized insertion procedures. The inserted \f$ x\f$-monotone curve is drawn with a light dashed line, surrounded by two solid arrows that represent the pair of twin half-edges added to the \sc{Dcel}. Existing vertices are shown as black dots while new vertices are shown as light dots. Existing half-edges that are affected by the insertion operations are drawn as dashed arrows. (a) Inserting a curve as a new hole inside the face \f$ f\f$. (b) Inserting a curve from an existing vertex \f$ u\f$ that corresponds to one of its endpoints. (c) Inserting an \f$ x\f$-monotone curve whose endpoints are the already existing vertices \f$ u_1\f$ and \f$ u_2\f$. In our case, the new pair of half-edges close a new face \f$ f'\f$, where the hole \f$ h_1\f$, which used to belong to \f$ f\f$, now becomes an enclave in this new face. + +The various specialized insertion procedures. The inserted +\f$x\f$-monotone curve is drawn with a light dashed line, surrounded +by two solid arrows that represent the pair of twin half-edges added +to the \sc{Dcel}. Existing vertices are shown as black dots while +new vertices are shown as light dots. Existing half-edges that are +affected by the insertion operations are drawn as dashed arrows. +(a) Inserting a curve as a new hole inside the face \f$f\f$. +(b) Inserting a curve from an existing vertex \f$u\f$ that +corresponds to one of its endpoints. +(c) Inserting an \f$x\f$-monotone curve whose endpoints are the +already existing vertices \f$u_1\f$ and \f$u_2\f$. In our case, the +new pair of half-edges close a new face \f$f'\f$, where the hole +\f$h_1\f$, which used to belong to \f$f\f$, now becomes an enclave +in this new face. \cgalFigureEnd - -When an \f$ x\f$-monotone curve is inserted into an existing arrangement, such -that the interior of this curve is disjoint from any arrangement feature, -only the following three scenarios are possible, depending on the status -of the endpoints of the inserted subcurve: +When an \f$x\f$-monotone curve is inserted into an existing +arrangement, such that the interior of this curve is disjoint from any +arrangement feature, only the following three scenarios are possible, +depending on the status of the endpoints of the inserted subcurve:
    1. In case both curve endpoints do not correspond to any existing @@ -533,41 +727,46 @@ figure to the left).
    2. The `Arrangement_2` class offers insertion functions named `insert_in_face_interior()`, `insert_from_left_vertex()`, -`insert_from_right_vertex()` and `insert_at_vertices()` -that perform the special insertion procedures listed above. The -first function accepts an \f$ x\f$-monotone curve \f$ c\f$ and an arrangement -face \f$ f\f$ that contains this curve in its interior. The other -functions accept an \f$ x\f$-monotone curve \f$ c\f$ and handles to the existing +`insert_from_right_vertex()` and `insert_at_vertices()` that perform +the special insertion procedures listed above. The first function +accepts an \f$x\f$-monotone curve \f$C\f$ and an arrangement face +\f$f\f$ that contains this curve in its interior. The other functions +accept an \f$x\f$-monotone curve \f$C\f$ and handles to the existing vertices that correspond to the curve endpoint(s). Each of the four -functions returns a handle to one of the twin halfedges that have -been created, where: +functions returns a handle to one of the twin halfedges that have been +created, where: +
        -
      • `insert_in_face_interior(c, f)` returns a halfedge directed -from the vertex corresponding to the left endpoint of `c` +
      • `insert_in_face_interior(C, f)` returns a halfedge directed +from the vertex corresponding to the left endpoint of `C` toward the vertex corresponding to its right endpoint. -
      • `insert_from_left_vertex(c, v)` and -`insert_from_right_vertex(c, v)` returns a halfedge whose -source is the vertex \f$ v\f$ that and whose target is the new vertex +
      • `insert_from_left_vertex(C, v)` and +`insert_from_right_vertex(C, v)` returns a halfedge whose +source is the vertex \f$v\f$ that and whose target is the new vertex that has just been created. -
      • `insert_at_vertices(c, v1, v2)` returns a halfedge directed -from \f$ v_1\f$ to \f$ v_2\f$. +
      • `insert_at_vertices(C, v1, v2)` returns a halfedge directed +from \f$v_1\f$ to \f$v_2\f$.
      \cgalFigureBegin{arr_figex_2,ex_1.png} -The arrangement of the line segments \f$ s_1, \ldots, s_5\f$ constructed in `edge_insertion.cpp`. The arrows mark the direction of the halfedges returned from the various insertion functions. +The arrangement of the line segments \f$s_1, \ldots, s_5\f$ +constructed in `edge_insertion.cpp`. The arrows mark the direction of +the halfedges returned from the various insertion functions. \cgalFigureEnd The following program demonstrates the usage of the four insertion functions. It creates an arrangement of five line segments, as -depicted in \cgalFigureRef{arr_figex_1}.\cgalFootnote{Notice that in all figures in the rest of this chapter the coordinate axes are drawn only for illustrative purposes and are not part of the arrangement.} As the arrangement is very -simple, we use the simple Cartesian kernel of \cgal with integer -coordinates for the segment endpoints. We also use the -`Arr_segment_traits_2` class that enables the efficient -maintenance of arrangements of line segments; see more details on -this traits class in Section \ref arr_sectraits. This example, as -many others in this chapter, uses some print-utility functions from -the file `print_arr.h`; these functions are also listed in -Section \ref arr_ssectraverse. +depicted in \cgalFigureRef{arr_figex_1}.\cgalFootnote{Notice that in +all figures in the rest of this chapter the coordinate axes are drawn +only for illustrative purposes and are not part of the +arrangement.} As the arrangement is very simple, we use the simple +Cartesian kernel of \cgal with integer coordinates for the segment +endpoints. We also use the `Arr_segment_traits_2` class that enables +the efficient maintenance of arrangements of line segments; see more +details on this traits class in Section \ref aos_sec-geom_traits. This +example, as many others in this chapter, uses some print-utility +functions from the file `print_arr.h`; these functions are also listed +in Section \ref arr_ssectraverse. \cgalExample{Arrangement_on_surface_2/edge_insertion.cpp} @@ -583,32 +782,33 @@ Isolated points are in general simpler geometric entities than curves and indeed the member functions that manipulate them are easier to understand. -The function `insert_in_face_interior(p, f)` inserts an -isolated point \f$ p\f$, located in the interior of a given face \f$ f\f$, -into the arrangement and returns a handle to the arrangement -vertex it has created and associated with \f$ p\f$. Naturally, this -function has a precondition that \f$ p\f$ is really an isolated point, -namely it does not coincide with any existing arrangement vertex -and does not lie on any edge. As mentioned in -Section \ref arr_ssectraverse, it is possible to obtain the face -containing an isolated vertex handle \f$ v\f$ by calling `v->face()`. +The function `insert_in_face_interior(p, f)` inserts an isolated point +\f$p\f$, located in the interior of a given face \f$ f\f$, into the +arrangement and returns a handle to the arrangement vertex it has +created and associated with \f$p\f$. Naturally, this function has a +precondition that \f$p\f$ is really an isolated point, namely it does +not coincide with any existing arrangement vertex and does not lie on +any edge. As mentioned in Section \ref arr_ssectraverse, it is +possible to obtain the face containing an isolated vertex handle +\f$v\f$ by calling `v->face()`. -The function `remove_isolated_vertex(v)` receives a handle to -an isolated vertex and removes it from the arrangement. +The function `remove_isolated_vertex(v)` receives a handle to an +isolated vertex and removes it from the arrangement. \cgalFigureBegin{arr_figex_3,ex_2.png} -An arrangement of line segments containing three isolated vertices, as constructed in `isolated_vertices.cpp`. The vertices \f$ u_2\f$ and \f$ u_3\f$ are eventually removed from the arrangement. +An arrangement of line segments containing three isolated vertices, +as constructed in `isolated_vertices.cpp`. The vertices \f$u_2\f$ +and \f$u_3\f$ are eventually removed from the arrangement. \cgalFigureEnd - The following program demonstrates the usage of the arrangement -member-functions for manipulating isolated vertices. It first -inserts three isolated vertices located inside the unbounded face, then -it inserts four line segments that form a rectangular hole inside the +member-functions for manipulating isolated vertices. It first inserts +three isolated vertices located inside the unbounded face, then it +inserts four line segments that form a rectangular hole inside the unbounded face (see \cgalFigureRef{arr_figex_2} for an illustration). Finally, it traverses the vertices and removes those isolated vertices that are still contained in the unbounded face -(\f$ u_2\f$ and \f$ u_3\f$ in this case): +(\f$u_2\f$ and \f$u_3\f$ in this case): \cgalExample{Arrangement_on_surface_2/isolated_vertices.cpp} @@ -617,90 +817,98 @@ isolated vertices that are still contained in the unbounded face In the previous subsection we showed how to introduce new isolated vertices in the arrangement. But how does one create a vertex that lies on an existing arrangement edge (more precisely, on an -\f$ x\f$-monotone curve that is associated with an arrangement edge)? +\f$x\f$-monotone curve that is associated with an arrangement edge)? -It should be noted that such an operation involves the splitting -of a curve at a given point in its interior, while the traits -class used by `Arrangement_2` does not necessarily have the -ability to perform such a split operation. However, if users have -the ability to split an \f$ x\f$-monotone curve into two at a given point -\f$ p\f$ (this is usually the case when employing a more sophisticated -traits class; see Section \ref arr_sectraits for more details) -they can use the `split_edge(e, c1, c2)` function, were -\f$ c_1\f$ and \f$ c_2\f$ are the two subcurves resulting from splitting the -\f$ x\f$-monotone curve associated with the halfedge \f$ e\f$ at some point -(call it \f$ p\f$) in its interior. The function splits the halfedge pair into two -pairs, both incident to a new vertex \f$ v\f$ associated with \f$ p\f$, and -returns a handle to a halfedge whose source equals \f$ e\f$'s source -vertex and whose target is the new vertex \f$ v\f$. +It should be noted that such an operation involves the splitting of a +curve at a given point in its interior, while the traits class used by +`Arrangement_2` does not necessarily have the ability to perform such +a split operation. However, if users have the ability to split an +\f$x\f$-monotone curve into two at a given point \f$ p\f$ (this is +usually the case when employing a more sophisticated traits class; see +Section \ref aos_sec-geom_traits for more details) they can use the +`split_edge(e, C1, C2)` function, were \f$C_1\f$ and \f$C_2\f$ are the +two subcurves resulting from splitting the \f$x\f$-monotone curve +associated with the halfedge \f$e\f$ at some point (call it \f$p\f$) +in its interior. The function splits the halfedge pair into two pairs, +both incident to a new vertex \f$v\f$ associated with \f$p\f$, and +returns a handle to a halfedge whose source equals \f$e\f$'s source +vertex and whose target is the new vertex \f$v\f$. -The reverse operation is also possible. Suppose that we have a -vertex \f$ v\f$ of degree \f$ 2\f$, whose two incident halfedges, \f$ e_1\f$ and -\f$ e_2\f$, are associated with the curves \f$ c_1\f$ and \f$ c_2\f$. Suppose -further that it is possible to merge these two curves into a single -continuous \f$ x\f$-monotone curve \f$ c\f$. Calling `merge_edge(e1, e2, c)` -will merge the two edges into a single edge associated with the curve -\f$ c\f$, essentially removing the vertex \f$ v\f$ from the arrangement. +The reverse operation is also possible. Suppose that we have a vertex +\f$v\f$ of degree \f$2\f$, whose two incident halfedges, \f$e_1\f$ and +\f$e_2\f$, are associated with the curves \f$C_1\f$ and +\f$C_2\f$. Suppose further that it is possible to merge these two +curves into a single continuous \f$x\f$-monotone curve +\f$C\f$. Calling `merge_edge(e1, e2, C)` will merge the two edges into +a single edge associated with the curve \f$C\f$, essentially removing +the vertex \f$v\f$ from the arrangement. -Finally, the function `remove_edge(e)` removes the edge \f$ e\f$ -from the arrangement. Note that this operation is the reverse of -an insertion operation, so it may cause a connected -component to split into two, or two faces to merge into one, or a -hole to disappear. By default, if the removal of `e` causes one -of its end-vertices to become isolated, we remove this vertex as well. -However, users can control this behavior and choose to keep the -isolated vertices by supplying additional Boolean flags to -`remove_edge()` indicating whether the source and the target vertices -are to be removed should they become isolated. +Finally, the function `remove_edge(e)` removes the edge \f$e\f$ from +the arrangement. Note that this operation is the reverse of an +insertion operation, so it may cause a connected component to split +into two, or two faces to merge into one, or a hole to disappear. By +default, if the removal of `e` causes one of its end-vertices to +become isolated, we remove this vertex as well. However, users can +control this behavior and choose to keep the isolated vertices by +supplying additional Boolean flags to `remove_edge()` indicating +whether the source and the target vertices are to be removed should +they become isolated. \cgalFigureBegin{arr_figex_4,ex_3.png} -An arrangement of line segments as constructed in `edge_manipulation.cpp`. Note that the edges \f$ e_7\f$ and \f$ e_8\f$ and the vertices \f$ w_1\f$ and \f$ w_2\f$, introduced in step (b) are eventually removed in step (c). +An arrangement of line segments as constructed in +`edge_manipulation.cpp`. Note that the edges \f$e_7\f$ and \f$e_8\f$ +and the vertices \f$w_1\f$ and \f$w_2\f$, introduced in step (b) are +eventually removed in step (c). \cgalFigureEnd In the following example program we show how the edge-manipulation -functions can be used. The program works in three -steps, as demonstrated in \cgalFigureRef{arr_figex_3}. Note that -here we still stick to integer coordinates, but as we work on a -larger scale we use an unbounded integer number-type (in this -case, the `Gmpz` type taken from the Gmp library) -instead of the built-in `int` type.\cgalFootnote{As a rule of thumb, one can use a bounded integer type for representing line segments whose coordinates are bounded by \f$ \lfloor\sqrt[3]{M}\rfloor\f$, where \f$ M\f$ is the maximal representable integer value. This guarantees that no overflows occur in the computations carried out by the traits class, hence all traits-class predicates always return correct results.} -In case the Gmp library is not installed (as indicated by -the `CGAL_USE_GMP` flag defined in `CGAL/basic.h`), we -use `MP_Float`, a number-type included in \cgal's support -library that is capable of storing floating-point numbers with -unbounded mantissa. We also use the standard Cartesian -kernel of \cgal as our kernel. This is recommended when the -kernel is instantiated with a more complex number type, as we -demonstrate in other examples in this chapter. +functions can be used. The program works in three steps, as +demonstrated in \cgalFigureRef{arr_figex_3}. Note that here we still +stick to integer coordinates, but as we work on a larger scale we use +an unbounded integer number-type (in this case, the `Gmpz` type taken +from the Gmp library) instead of the +built-in `int` type.\cgalFootnote{As a rule of thumb, one can use a +bounded integer type for representing line segments whose coordinates +are bounded by \f$\lfloor\sqrt[3]{M}\rfloor\f$, where \f$M\f$ is the +maximal representable integer value. This guarantees that no overflows +occur in the computations carried out by the traits class, hence all +traits-class predicates always return correct results.} In case the +Gmp library is not installed (as indicated +by the `CGAL_USE_GMP` flag defined in `CGAL/basic.h`), we use +`MP_Float`, a number-type included in \cgal's support library that is +capable of storing floating-point numbers with unbounded mantissa. We +also use the standard Cartesian kernel of \cgal as our kernel. This is +recommended when the kernel is instantiated with a more complex number +type, as we demonstrate in other examples in this chapter. \cgalExample{Arrangement_on_surface_2/edge_manipulation.cpp} -Note how we use the halfedge handles returned from -`split_edge()` and `merge_edge()`. Also note the insertion -of the isolated vertex \f$ v_6\f$ located inside the triangular face (the -incident face of \f$ e_7\f$). This vertex seizes from being isolated, as it -is gets connected to other vertices. +Note how we use the halfedge handles returned from `split_edge()` and +`merge_edge()`. Also note the insertion of the isolated vertex +\f$v_6\f$ located inside the triangular face (the incident face of +\f$e_7\f$). This vertex seizes from being isolated, as it is gets +connected to other vertices. In this context, we should mention the two member functions -`modify_vertex(v, p)`, which sets \f$ p\f$ to be the point -associated with the vertex \f$ v\f$, and `modify_edge(e, c)`, which -sets \f$ c\f$ to be the \f$ x\f$-monotone curve associated with the halfedge -\f$ e\f$. These functions have preconditions that \f$ p\f$ is -geometrically equivalent to `v->point()` and \f$ c\f$ is equivalent -to `e->curve()` (i.e., the two curves have the same graph), -respectively, to avoid the invalidation of the geometric structure of -the arrangement. At a first glance it may seen as these two functions -are of little use. However, we should keep in mind that there may be +`modify_vertex(v, p)`, which sets \f$p\f$ to be the point associated +with the vertex \f$v\f$, and `modify_edge(e, c)`, which sets \f$C\f$ +to be the \f$x\f$-monotone curve associated with the halfedge +\f$e\f$. These functions have preconditions that \f$p\f$ is +geometrically equivalent to `v->point()` and \f$C\f$ is equivalent to +`e->curve()` (i.e., the two curves have the same graph), respectively, +to avoid the invalidation of the geometric structure of the +arrangement. At a first glance it may seen as these two functions are +of little use. However, we should keep in mind that there may be extraneous data (probably non-geometric) associated with the point -objects or with the curve objects, as defined by the traits class. With -these two functions we can modify this data; see more details in -Section \ref arr_sectraits. +objects or with the curve objects, as defined by the traits +class. With these two functions we can modify this data; see more +details in Section \ref aos_sec-geom_traits. -In addition, we can use these functions to replace a geometric -object (a point or a curve) with an equivalent object that has a -more compact representation. For example, we can replace the point -\f$ (\frac{20}{40}, \frac{99}{33})\f$ associated with some vertex \f$ v\f$, -by \f$ (\frac{1}{2}, 3)\f$. +In addition, we can use these functions to replace a geometric object +(a point or a curve) with an equivalent object that has a more compact +representation. For example, we can replace the point +\f$(\frac{20}{40}, \frac{99}{33})\f$ associated with some vertex +\f$v\f$, by \f$(\frac{1}{2}, 3)\f$. \subsection arr_sssecadv_insert Advanced Insertion Functions @@ -708,43 +916,44 @@ by \f$ (\frac{1}{2}, 3)\f$. \image latex pred_around_vertex.png \cgalAdvancedBegin + Assume that the specialized insertion function -`insert_from_left_vertex(c,v)` is invoked for a curve \f$ c\f$, -whose left endpoint is already associated with a non-isolated -vertex \f$ v\f$. Namely, \f$ v\f$ has already several incident halfedges. It -is necessary in this case to locate the exact place for the -new halfedge mapped to the inserted new curve \f$ c\f$ in the circular -list of halfedges incident to \f$ v\f$. More precisely, it is sufficient -to locate one of the halfedges `pred` directed toward \f$ v\f$ such -that \f$ c\f$ is located between `pred` and `pred->next()` in -clockwise order around \f$ v\f$, in order to complete the insertion -(see \cgalFigureRef{arr_figex_1} for an illustration). This may -take \f$ O(d)\f$ time where \f$ d\f$ is the degree of the vertex. However, -if the halfedge `pred` is known in advance, the insertion can -be carried out in constant time. +`insert_from_left_vertex(C, v)` is invoked for a curve \f$C\f$, whose +left endpoint is already associated with a non-isolated vertex +\f$v\f$. Namely, \f$v\f$ has already several incident halfedges. It is +necessary in this case to locate the exact place for the new halfedge +mapped to the inserted new curve \f$C\f$ in the circular list of +halfedges incident to \f$v\f$. More precisely, it is sufficient to +locate one of the halfedges `pred` directed toward \f$v\f$ such that +\f$C\f$ is located between `pred` and `pred->next()` in clockwise +order around \f$v\f$, in order to complete the insertion (see +\cgalFigureRef{arr_figex_1} for an illustration). This may take +\f$O(d)\f$ time where \f$d\f$ is the degree of the vertex. However, if +the halfedge `pred` is known in advance, the insertion can be carried +out in constant time. -The `Arrangement_2` class provides the advanced versions of -the specialized insertion functions for a curve \f$ c\f$ - namely we have -`insert_from_left_vertex(c,pred)` and -`insert_from_right_vertex(c,pred)` that accept a halfedge `pred` -as specified above, instead of a vertex \f$ v\f$. These functions are -more efficient, as they take constant time and do not perform any -geometric operations. Thus, they should be used when the halfedge -`pred` is known. In case that the vertex \f$ v\f$ is isolated or -that the predecessor halfedge for the new inserted curve is not -known, the simpler versions of these insertion functions should be -used. - -Similarly, there exist two overrides of the -`insert_at_vertices()` function: One that accept the two -predecessor halfedges around the two vertices \f$ v_1\f$ and \f$ v_2\f$ that -correspond to the curve endpoints, and one that accepts a handle -for one vertex and a predecessor halfedge around the other -vertex. +The `Arrangement_2` class provides the advanced versions of the +specialized insertion functions for a curve \f$C\f$ - namely we have +`insert_from_left_vertex(C, pred)` and +`insert_from_right_vertex(C, pred)` that accept a halfedge `pred` as +specified above, instead of a vertex \f$v\f$. These functions are more +efficient, as they take constant time and do not perform any geometric +operations. Thus, they should be used when the halfedge `pred` is +known. In case that the vertex \f$v\f$ is isolated or that the +predecessor halfedge for the new inserted curve is not known, the +simpler versions of these insertion functions should be used. +Similarly, there exist two overrides of the `insert_at_vertices()` +function: One that accept the two predecessor halfedges around the two +vertices \f$v_1\f$ and \f$v_2\f$ that correspond to the curve +endpoints, and one that accepts a handle for one vertex and a +predecessor halfedge around the other vertex. \cgalFigureBegin{arr_figex_5,ex_4.png} -An arrangement of line segments, as constructed in `special_edge_insertion.cpp`. Note that \f$ p_0\f$ is initially inserted as an isolated point and later on connected to the other four vertices. +An arrangement of line segments, as constructed in +`special_edge_insertion.cpp`. Note that \f$p_0\f$ is initially +inserted as an isolated point and later on connected to the other four +vertices. \cgalFigureEnd The following program shows how to construct the arrangement @@ -765,7 +974,7 @@ arrangement operations - see more details in the Reference Manual. \section arr_secqueries Issuing Queries on an Arrangement One of the most important query types defined on arrangements is -the point-location query: Given a point, find the arrangement +the point-location query: Given a point, find the arrangement cell that contains it. Typically, the result of a point-location query is one of the arrangement faces, but in degenerate situations the query point can be located on an edge or it may coincide with a @@ -781,11 +990,11 @@ ability to answer such queries effectively. The `Arrangement_2` class template does not support point-location queries directly, as the arrangement representation is decoupled from -the geometric algorithms that operate on it. The 2D Arrangements +the geometric algorithms that operate on it. The 2D Arrangements package includes a set of classe templates that are capable of answering such queries; all are models of the concept `ArrangementPointLocation_2`. Each model employs a different -algorithm or strategy for answering queries. A model of this +algorithm or strategy for answering queries. A model of this concept must define the `locate()` member function, which accepts an input query-point and returns an object that represents the arrangement cell that contains this point. This object is is type @@ -793,7 +1002,7 @@ arrangement cell that contains this point. This object is is type union container of the bounded types `Vertex_const_handle`, `Halfedge_const_handle`, or `Face_const_handle`. Depending on whether the query point is located inside a face, on an edge, or on a -vertex, the appropriate handle can be obtained with value retrieval +vertex, the appropriate handle can be obtained with value retrieval by `boost::get` as demonstrated in the example below. Note that the handles returned by the `locate()` functions are @@ -873,27 +1082,27 @@ print_point_location \subsection arr_sssecpl_strat Choosing a Point-Location Strategy Each of the various point-location class templates employs a different -algorithm or strategy\cgalFootnote{The term strategy +algorithm or strategy\cgalFootnote{The term strategy is borrowed from the design-pattern taxonomy \cgalCite{cgal:ghjv-dpero-95}, -Chapter 5. A strategy provides the means to define a family of +Chapter 5. A strategy provides the means to define a family of algorithms, each implemented by a separate class. All classes that implement the various algorithms are made interchangeable, letting the algorithm in use vary according to the user choice.} for answering queries:
      • `Arr_naive_point_location` employs the - naive strategy. It locates the query point naively, + naive strategy. It locates the query point naively, exhaustively scanning all arrangement cells.
      • `Arr_walk_along_line_point_location` employs - the walk-along-a-line (or walk for short) strategy. + the walk-along-a-line (or walk for short) strategy. It simulates a traversal, in reverse order, along an imaginary vertical ray emanating from the query point. It starts from the unbounded face of the arrangement and moves downward toward the query point until it locates the arrangement cell containing it.
      • `Arr_landmarks_point_location` - uses a set of landmark points, the location of which in the - arrangement is known. It employs the landmark strategy. Given a + uses a set of landmark points, the location of which in the + arrangement is known. It employs the landmark strategy. Given a query point, it uses a nearest-neighbor search-structure (a Kd-tree is used by default) to find the nearest landmark, and then traverses the straight-line segment @@ -914,8 +1123,8 @@ vary according to the user choice.} for answering queries: a geometry-traits class that models the `ArrangementLandmarkTraits_2` concept, which refines the basic `ArrangementBasicTraits_2` concept; see - Section \ref arr_sssectr_lanmarks_concept for details. Most traits - classes included in the 2D Arrangement package are models of + Section \ref aos_sssec-tr_lanmarks_concept for details. Most traits + classes included in the 2D Arrangement package are models of this refined concept.
      • `Arr_trapezoid_ric_point_location` implements an @@ -923,7 +1132,7 @@ vary according to the user choice.} for answering queries: \cgalCite{m-fppa-90}; see also \cgalCite{bkos-cgaa-00}, Chapter 6. The (expected) query-time is logarithmic. The arrangement faces are decomposed into simpler cells each of constant complexity, known - as pseudo-trapezoids, and a search structure (a directed acyclic + as pseudo-trapezoids, and a search structure (a directed acyclic graph) is constructed on top of these cells, facilitating the search of the pseudo trapezoid (hence the arrangement cell) containing a query point in expected logarithmic time. The trapezoidal map and @@ -946,39 +1155,41 @@ structure are more frequent than point-location queries). On the other hand, the landmarks and the trapezoid RIC strategies require auxiliary data structures on top of the arrangement, which -they need to construct once they are attached to an arrangement -object and need to keep up-to-date as this arrangement changes. -The data structure needed by the landmarks strategy can be constructed -in \f$ O(N \log N) \f$ time, where \f$ N \f$ is the overall number of edges in -the arrangement, but the constant hidden in the \f$ O() \f$ notation for the -trapezoidal map RIC strategy is much larger. Thus, construction needed -by the landmark algorithm is in practice significantly faster than the -construction needed by the trapezoidal map RIC strategy. In addition, -although both resulting data structures are asymptotically linear in -size, using a Kd-tree as the nearest-neighbor search-structure that -the landmark algorithm stores significantly reduces memory consumption. -The trapezoidal map RIC algorithm has expected logarithmic query time, -while the query time for the landmark strategy may be as large as -linear. In practice however, the query times of both strategies are -competitive. For a detailed experimental comparison -see \cgalCite{cgal:hh-eplca-05}. +they need to construct once they are attached to an arrangement object +and need to keep up-to-date as this arrangement changes. The data +structure needed by the landmarks strategy can be constructed in +\f$O(N \log N)\f$ time, where \f$N\f$ is the overall number of edges +in the arrangement, but the constant hidden in the \f$O()\f$ notation +for the trapezoidal map RIC strategy is much larger. Thus, +construction needed by the landmark algorithm is in practice +significantly faster than the construction needed by the trapezoidal +map RIC strategy. In addition, although both resulting data structures +are asymptotically linear in size, using a Kd-tree as the nearest-neighbor search-structure +that the landmark algorithm stores significantly reduces memory +consumption. The trapezoidal map RIC algorithm has expected +logarithmic query time, while the query time for the landmark strategy +may be as large as linear. In practice however, the query times of +both strategies are competitive. For a detailed experimental +comparison see \cgalCite{cgal:hh-eplca-05}. Updating the auxiliary data structures of the trapezoidal map RIC algorithm is done very efficiently. On the other hand, updating the -nearest-neighbor search-structure of the landmark algorithm may consume -more time when the arrangement changes frequently, especially when -a Kd-tree is used, as it must be rebuilt each time the arrangement -changes. It is therefore recommended that the -`Arr_landmarks_point_location` class template be used when the -application frequently issues point-location queries on an arrangement -that only seldom changes. If the arrangement is more dynamic and is -frequently going through changes, the `Arr_trapezoid_ric_point_location` -class template should be the selected point-location strategy. +nearest-neighbor search-structure of the landmark algorithm may +consume more time when the arrangement changes frequently, especially +when a Kd-tree is used, as it must be +rebuilt each time the arrangement changes. It is therefore recommended +that the `Arr_landmarks_point_location` class template be used when +the application frequently issues point-location queries on an +arrangement that only seldom changes. If the arrangement is more +dynamic and is frequently going through changes, the +`Arr_trapezoid_ric_point_location` class template should be the +selected point-location strategy. \subsection arr_sssecpl_ex An Example \cgalFigureBegin{arr_figex_8,ex_5.png} -The arrangement of line segments, as constructed in `point_location_example.cpp`, `vertical_ray_shooting.cpp`, and `batched_point_location.cpp`. The arrangement vertices are drawn as small discs, while the query points \f$ q_1, \ldots, q_6\f$ are marked with crosses. +The arrangement of line segments, as constructed in `point_location_example.cpp`, `vertical_ray_shooting.cpp`, and `batched_point_location.cpp`. The arrangement vertices are drawn as small discs, while the query points \f$q_1, \ldots, q_6\f$ are marked with crosses. \cgalFigureEnd The program listed below constructs a simple arrangement of five line @@ -1076,16 +1287,16 @@ number. \subsection arr_ssecbatched_pl Batched Point-Location Suppose that at a given moment our application has to issue a -relatively large number \f$ m\f$ of point-location queries on a -specific arrangement object. Naturally, It is possible to define -a point-location object and use it to issue separate queries on -the arrangement. However, as explained in Section \ref arr_ssecpl -choosing a simple point-location strategy (either the naive or -the walk strategy) means inefficient queries, while the more -sophisticated strategies need to construct auxiliary structures -that incur considerable overhead in running time. +relatively large number \f$m\f$ of point-location queries on a +specific arrangement object. Naturally, It is possible to define a +point-location object and use it to issue separate queries on the +arrangement. However, as explained in Section \ref arr_ssecpl choosing +a simple point-location strategy (either the naive or the walk +strategy) means inefficient queries, while the more sophisticated +strategies need to construct auxiliary structures that incur +considerable overhead in running time. -Alternatively, the 2D Arrangement package includes a free +Alternatively, the 2D Arrangement package includes a free `locate()` function that accepts an arrangement and a range of query points as its input and sweeps through the arrangement to locate all query points in one pass. The function outputs the query @@ -1096,17 +1307,17 @@ pairs are sorted in increasing $xy$-lexicographical order of the query point. The batched point-location operation is carried out by sweeping the -arrangement. Thus, it takes \f$ O((m+N)\log{(m+N)}) \f$ time, where \f$ N \f$ -is the number of edges in the arrangement. Issuing separate queries -exploiting a point-location strategy with logarithmic query time -per query, such as the trapezoidal map RIC strategy (see -Section \ref arr_sssecpl_strat), is asymptotically more -efficient. However, experiments show that when the number \f$ m \f$ of -point-location queries is of the same order of magnitude as \f$ N\f$, -the batched point-location operation is more efficient in practice. -One of the reasons for the inferior performance of the alternative -(asymptotically faster) procedures is the necessity to construct -and maintain complex additional data structures. +arrangement. Thus, it takes \f$O((m+N)\log{(m+N)})\f$ time, where +\f$N\f$ is the number of edges in the arrangement. Issuing separate +queries exploiting a point-location strategy with logarithmic query +time per query, such as the trapezoidal map RIC strategy (see Section +\ref arr_sssecpl_strat), is asymptotically more efficient. However, +experiments show that when the number \f$m\f$ of point-location +queries is of the same order of magnitude as \f$N\f$, the batched +point-location operation is more efficient in practice. One of the +reasons for the inferior performance of the alternative +(asymptotically faster) procedures is the necessity to construct and +maintain complex additional data structures. The program below issues a batched point-location query, which is essentially equivalent to the six separate queries performed in @@ -1116,48 +1327,52 @@ is essentially equivalent to the six separate queries performed in \section arr_secgl_funcs Free Functions in the Arrangement Package -In Section \ref arr_secarr_class we reviewed in details the -`Arrangement_2` class, which represents two-dimensional -subdivisions induced by planar curves, and mentioned that its -interface is minimal in the sense that the member functions hardly -perform any geometric algorithms and are mainly used for -maintaining the topological structure of the subdivision. In this -section we explain how to utilize the free (global) functions that operate -on arrangements. The implementation of these operations typically require -non-trivial geometric algorithms or load some extra requirements on -the traits class. +In Section \ref aos_ssec-basic-arr_class we reviewed in details the +`Arrangement_2` class, which represents two-dimensional subdivisions +induced by planar curves, and mentioned that its interface is minimal +in the sense that the member functions hardly perform any geometric +algorithms and are mainly used for maintaining the topological +structure of the subdivision. In this section we explain how to +utilize the free (global) functions that operate on arrangements. The +implementation of these operations typically require non-trivial +geometric algorithms or load some extra requirements on the traits +class. \subsection arr_ssecinc_insert Incremental Insertion Functions \subsection arr_sssecinsert_non_x Inserting Non-Intersecting Curves -In Section \ref arr_secarr_class we explained how to construct -arrangements of \f$ x\f$-monotone curves that are pairwise disjoint in +In Section \ref aos_ssec-basic-arr_class we explained how to construct +arrangements of \f$x\f$-monotone curves that are pairwise disjoint in their interior, when the location of the segment endpoints in the arrangement is known. Here we relax this constraint, and allow the -location of the inserted \f$ x\f$-monotone curve endpoints to be arbitrary, +location of the inserted \f$x\f$-monotone curve endpoints to be arbitrary, as it may be unknown at the time of insertion. We retain, for the moment, the requirement that the interior of the inserted curve is disjoint from all existing arrangement edges and vertices. -The free function `insert_non_intersecting_curve(arr, c, pl)` -inserts the \f$ x\f$-monotone curve \f$ c\f$ into the arrangement `arr`, -with the precondition that the interior of \f$ c\f$ is disjoint from -all `arr`'s existing edges and vertices. The third argument -`pl` is a point-location object attached to the arrangement, -which is used for performing the insertion. It locates both curve -endpoints in the arrangement, where each endpoint is expected to -either coincide with an existing vertex or lie inside a face. -It is possible to invoke one of the specialized insertion functions -(see Section \ref arr_secarr_class), based on the query results, and -insert \f$ c\f$ at its proper position.\cgalFootnote{The `insert_non_intersecting_curve()` function, as all other functions reviewed in this section, is a function template, parameterized by an arrangement class and a point-location class (a model of the `ArrangementPointLocation_2` concept).} The insertion operation -thus hardly requires any geometric operations on top on the ones -needed to answer the point-location queries. Moreover, it is -sufficient that the arrangement class is instantiated with a -traits class that models the `ArrangementBasicTraits_2` -concept (or the `ArrangementLandmarkTraits_2` concept, if the -landmark point-location strategy is used), which does not have to -support the computation of intersection points between curves. +The free function `insert_non_intersecting_curve(arr, C, pl)` inserts +the \f$x\f$-monotone curve \f$C\f$ into the arrangement `arr`, with +the precondition that the interior of \f$C\f$ is disjoint from all +`arr`'s existing edges and vertices. The third argument `pl` is a +point-location object attached to the arrangement, which is used for +performing the insertion. It locates both curve endpoints in the +arrangement, where each endpoint is expected to either coincide with +an existing vertex or lie inside a face. It is possible to invoke one +of the specialized insertion functions (see Section \ref +aos_ssec-basic-arr_class), based on the query results, and insert +\f$C\f$ at its proper position.\cgalFootnote{The +`insert_non_intersecting_curve()` function, as all other functions +reviewed in this section, is a function template, parameterized by an +arrangement class and a point-location class (a model of the +`ArrangementPointLocation_2` concept).} The insertion operation thus +hardly requires any geometric operations on top on the ones needed to +answer the point-location queries. Moreover, it is sufficient that the +arrangement class is instantiated with a traits class that models the +`ArrangementBasicTraits_2` concept (or the +`ArrangementLandmarkTraits_2` concept, if the landmark point-location +strategy is used), which does not have to support the computation of +intersection points between curves. The variant `insert_non_intersecting_curve(arr, c)` is also available. Instead of accepting a user-defined point-location @@ -1166,74 +1381,73 @@ class and uses it to insert the curve. \subsection arr_sssecinsert_x_mon Inserting x-Monotone Curves -The `insert_non_intersecting_curve()` function is very -efficient, but its preconditions on the input curves are still -rather restricting. Let us assume that the arrangement is -instantiated with a traits class that models the refined -`ArrangementXMonotoneTraits_2` concept and supports -intersection computations (see Section \ref arr_sectraits for -the exact details). Given an \f$ x\f$-monotone curve, it is sufficient -to locate its left endpoint in the arrangement and to trace its -zone, namely the set of arrangement features crossing the curve, -until the right endpoint is reached. Each time the new curve \f$ c\f$ -crosses an existing vertex or an edge, the curve is split into -subcurves (in the latter case, we have to split the curve -associated with the existing halfedge as well) and associate new -edges with the resulting subcurves. Recall that an edge is represented -by a pair of twin halfedges, so we split it into two halfedge pairs. +The `insert_non_intersecting_curve()` function is very efficient, but +its preconditions on the input curves are still rather +restricting. Let us assume that the arrangement is instantiated with a +traits class that models the refined `ArrangementXMonotoneTraits_2` +concept and supports intersection computations (see Section \ref +aos_sec-geom_traits for the exact details). Given an \f$x\f$-monotone +curve, it is sufficient to locate its left endpoint in the arrangement +and to trace its zone, namely the set of arrangement features +crossing the curve, until the right endpoint is reached. Each time the +new curve \f$C\f$ crosses an existing vertex or an edge, the curve is +split into subcurves (in the latter case, we have to split the curve +associated with the existing halfedge as well) and associate new edges +with the resulting subcurves. Recall that an edge is represented by a +pair of twin halfedges, so we split it into two halfedge pairs. -The free function `insert(arr, c, pl)` performs -this insertion operation. It accepts an \f$ x\f$-monotone curve \f$ c\f$, -which may intersect some of the curves already in the arrangement -`arr`, and inserts it into the arrangement by computing its zone. -Users may supply a point-location object `pl`, or use the default -walk point-location strategy (namely, the variant -`insert(arr, c)` is also available). The -running-time of this insertion function is proportional to the -complexity of the zone of the curve \f$ c\f$. +The free function `insert(arr, C, pl)` performs this insertion +operation. It accepts an \f$x\f$-monotone curve \f$C\f$, which may +intersect some of the curves already in the arrangement `arr`, and +inserts it into the arrangement by computing its zone. Users may +supply a point-location object `pl`, or use the default walk +point-location strategy (namely, the variant `insert(arr, C)` is also +available). The running-time of this insertion function is +proportional to the complexity of the zone of the curve \f$C\f$. \cgalAdvancedBegin In some cases users may have a prior knowledge of the location of the -left endpoint of the \f$ x\f$-monotone curve `c` they wish to insert, +left endpoint of the \f$x\f$-monotone curve `c` they wish to insert, so they can perform the insertion without issuing any point-location -queries. This can be done by calling -`insert(arr, c, obj)`, where `obj` is an -object represents the location of `c`'s left endpoint in the -arrangement - namely it wraps a `Vertex_const_handle`, a -`Halfedge_const_handle` or a `Face_const_handle` (see -also Section \ref arr_ssecpl). +queries. This can be done by calling `insert(arr, C, obj)`, where +`obj` is an object represents the location of `c`'s left endpoint in +the arrangement - namely it wraps a `Vertex_const_handle`, a +`Halfedge_const_handle` or a `Face_const_handle` (see also Section +\ref arr_ssecpl). \cgalAdvancedEnd -\subsection arr_sssecinsert_gen Inserting General Curves +\subsection aos_ssec-insert_gen Inserting General Curves -So far all our examples were of arrangements of line segments, -where the `Arrangement_2` template was instantiated with the -`Arr_segment_traits_2` class. In this case, the fact that -`insert()` accepts an \f$ x\f$-monotone curve does not -seem to be a restriction, as all line segments are \f$ x\f$-monotone -(note that we consider vertical line segments to be weakly -\f$ x\f$-monotone). +So far all our examples were of arrangements of line segments, where +the `Arrangement_2` template was instantiated with the +`Arr_segment_traits_2` class. In this case, the fact that `insert()` +accepts an \f$x\f$-monotone curve does not seem to be a restriction, +as all line segments are \f$x\f$-monotone (note that we consider +vertical line segments to be weakly \f$x\f$-monotone). Suppose that we construct an arrangement of circles. A circle is -obviously not \f$ x\f$-monotone, so we cannot insert it in the same way we -inserted \f$ x\f$-monotone curves. \cgalFootnote{Note that a key operation performed by `insert()` is to locate the left endpoint of the curve in the arrangement. A circle, however, does not have any endpoints!} However, it is possible to subdivide each circle -into two \f$ x\f$-monotone circular arcs (its upper half and its lower -half) and to insert each \f$ x\f$-monotone arc separately. +obviously not \f$x\f$-monotone, so we cannot insert it in the same way +we inserted \f$x\f$-monotone curves. \cgalFootnote{Note that a key +operation performed by `insert()` is to locate the left endpoint of +the curve in the arrangement. A circle, however, does not have any +endpoints!} However, it is possible to subdivide each circle into two +\f$x\f$-monotone circular arcs (its upper half and its lower half) and +to insert each \f$x\f$-monotone arc separately. -The free function `insert()` also supports general curve and -not necessarily \f$ x\f$-monotone curves. In this case it requires that the +The free function `insert()` also supports general curve and not +necessarily \f$x\f$-monotone curves. In this case it requires that the traits class used by the arrangement `arr` to be a model of the concept `ArrangementTraits_2`, which refines the -`ArrangementXMonotoneTraits_2` concept. It has to define an -additional `Curve_2` type (which may differ from the -`X_monotone_curve_2` type), and support the subdivision of curves -of this new type into \f$ x\f$-monotone curves (see the exact details in -Section \ref arr_sectraits). The `insert(arr, c, pl)` -function performs the insertion of the curve \f$ c\f$, which does not need -to be \f$ x\f$-monotone, into the arrangement by subdividing it (if needed) -into \f$ x\f$-monotone subcurves and inserting each one separately. Users -may supply a point-location object `pl`, or use the default walk -point-location strategy by calling `insert(arr, c)`. +`ArrangementXMonotoneTraits_2` concept. It has to define an additional +`Curve_2` type (which may differ from the `X_monotone_curve_2` type), +and support the subdivision of curves of this new type into +\f$x\f$-monotone curves (see the exact details in Section \ref +aos_sec-geom_traits). The `insert(arr, C, pl)` function performs the +insertion of the curve \f$C\f$, which does not need to be +\f$x\f$-monotone, into the arrangement by subdividing it (if needed) +into \f$x\f$-monotone subcurves and inserting each one +separately. Users may supply a point-location object `pl`, or use the +default walk point-location strategy by calling `insert(arr, C)`. \subsection arr_sssecinsert_point Inserting Points @@ -1262,25 +1476,28 @@ insertion operation may involve splitting curves. \subsection arr_sssecinsert_ex An Example \cgalFigureBegin{arr_figex_10,ex_8.png} -An arrangement of five intersecting line segments, as constructed in `incremental_insertion.cpp` and `aggregated_insertion.cpp`. The segment endpoints are marked by black disks and the arrangement vertices that correspond to intersection points are marked by circles. The query point \f$ q\f$ is marked with a cross and the face that contains it is shaded. +An arrangement of five intersecting line segments, as constructed in +`incremental_insertion.cpp` and `aggregated_insertion.cpp`. The +segment endpoints are marked by black disks and the arrangement +vertices that correspond to intersection points are marked by +circles. The query point \f$q\f$ is marked with a cross and the face +that contains it is shaded. \cgalFigureEnd - The program below constructs an arrangement of intersecting -line-segments. We know that \f$ s_1\f$ and \f$ s_2\f$ do not intersect, so -we use `insert_non_intersecting_curve()` to insert them into the +line-segments. We know that \f$s_1\f$ and \f$s_2\f$ do not intersect, +so we use `insert_non_intersecting_curve()` to insert them into the empty arrangement. The rest of the segments are inserted using -`insert()`. The resulting arrangement consists -of \f$ 13\f$ vertices, \f$ 16\f$ edges, and \f$ 5\f$ faces, as can be seen in +`insert()`. The resulting arrangement consists of \f$13\f$ vertices, +\f$16\f$ edges, and \f$5\f$ faces, as can be seen in \cgalFigureRef{arr_figex_8}. In the earlier examples, all arrangement vertices corresponded to segment endpoints. In this example we have additional vertices that correspond to intersection points between two segments. The -coordinates of these intersection points are rational numbers, if -the input coordinates are rational (or integer). Therefore, -the `Quotient` number type is used to represent the -coordinates: +coordinates of these intersection points are rational numbers, if the +input coordinates are rational (or integer). Therefore, the +`Quotient` number type is used to represent the coordinates: \cgalExample{Arrangement_on_surface_2/incremental_insertion.cpp} @@ -1292,69 +1509,70 @@ functions that don't insert curves or points to an arrangement nor do they change the arrangement, but they are closely related to the incremental insertion functions as they also use the zone algorithm. -The free function `do_intersect()` checks if a given curve or \f$ x\f$-monotone -curve intersects an existing arrangement's edges or vertices. -If the give curve is not an \f$ x\f$-monotone curve then the function -subdivides the given curve into \f$ x\f$-monotone subcurves and isolated -vertices . Each subcurve is in turn checked for intersection. -The function uses the zone algorithm to check if the curve intersects -the arrangement. First, the curve's left endpoint is located. Then, -its zone is computed starting from its left endpoint location. The -zone computation terminates when an intersection with an arrangement's -edge/vertex is found or when the right endpoint is reached. -A given point-location object is used for locating the left endpoint -of the given curve in the existing arrangement. By default, the function -uses the "walk along line" point-location strategy - namely an -instance of the class -`Arr_walk_along_line_point_location`. -If the given curve is \f$ x\f$-monotone then the traits -class must model the `ArrangementXMonotoneTraits_2` concept. If -the curve is not \f$ x\f$-monotone curve then the traits class must -model the `ArrangementTraits_2` concept. +The free function `do_intersect()` checks if a given curve or +\f$x\f$-monotone curve intersects an existing arrangement's edges or +vertices. If the give curve is not an \f$x\f$-monotone curve then the +function subdivides the given curve into \f$x\f$-monotone subcurves +and isolated vertices . Each subcurve is in turn checked for +intersection. The function uses the zone algorithm to check if the +curve intersects the arrangement. First, the curve's left endpoint is +located. Then, its zone is computed starting from its left endpoint +location. The zone computation terminates when an intersection with an +arrangement's edge/vertex is found or when the right endpoint is +reached. A given point-location object is used for locating the left +endpoint of the given curve in the existing arrangement. By default, +the function uses the "walk along line" point-location strategy - +namely an instance of the class `Arr_walk_along_line_point_location`. +If the given curve is \f$ x\f$-monotone then the traits class must +model the `ArrangementXMonotoneTraits_2` concept. If the curve is not +\f$x\f$-monotone curve then the traits class must model the +`ArrangementTraits_2` concept. -The `zone()` function computes the zone of a given \f$ x\f$-monotone -curve in a given arrangement. Meaning, it outputs all the arrangement's -elements (vertices, edges and faces) that the \f$ x\f$-monotone curve -intersects in the order that they are -discovered when traversing the \f$ x\f$-monotone curve from left to right. -The function uses a given point-location object to locate the left -endpoint of the given \f$ x\f$-monotone curve. By default, the function -uses the "walk along line" point-location strategy. -The function requires that the traits class will model the +The `zone()` function computes the zone of a given \f$x\f$-monotone +curve in a given arrangement. Meaning, it outputs all the +arrangement's elements (vertices, edges and faces) that the +\f$x\f$-monotone curve intersects in the order that they are +discovered when traversing the \f$x\f$-monotone curve from left to +right. The function uses a given point-location object to locate the +left endpoint of the given \f$x\f$-monotone curve. By default, the +function uses the "walk along line" point-location strategy. The +function requires that the traits class will model the `ArrangementXMonotoneTraits_2` concept. \subsection arr_ssecagg_insert Aggregated Insertion Functions -Let us assume that we have to insert a set of \f$ m\f$ input curves into an -arrangement. It is possible to do this incrementally, +Let us assume that we have to insert a set of \f$m\f$ input curves +into an arrangement. It is possible to do this incrementally, inserting the curves one by one, as shown in the previous section. However, the arrangement package provides three free functions that aggregately insert a range of curves into an arrangement: +
          -
        • `insert_non_intersecting_curves(arr, begin, end)` inserts -a range of \f$ x\f$-monotone curves given by the input iterators -`[begin, end)` into an arrangement `arr`. The \f$ x\f$-monotone -curves should be pairwise disjoint in their interior and also -interior-disjoint from all existing edges and vertices of `arr`. -
        • `insert(arr, begin, end)` inserts a range of general -(not necessarily \f$ x\f$-monotone) curves of type `Curve_2` or -`X_monotone_curve_2` that may intersect one another, given by -the input iterators `[begin, end)`, into the arrangement -`arr`. + +
        • `insert_non_intersecting_curves(arr, begin, end)` inserts a range +of \f$ x\f$-monotone curves given by the input iterators `[begin, +end)` into an arrangement `arr`. The \f$x\f$-monotone curves should +be pairwise disjoint in their interior and also interior-disjoint from +all existing edges and vertices of `arr`.
        • `insert(arr, begin, +end)` inserts a range of general (not necessarily \f$x\f$-monotone) +curves of type `Curve_2` or `X_monotone_curve_2` that may intersect +one another, given by the input iterators `[begin, end)`, into the +arrangement `arr`.
        -We distinguish between two cases: (i) The given arrangement -`arr` is empty (has only an unbounded face), so we have to -construct it from scratch. (ii) We have to insert \f$ m\f$ input curves -to a non-empty arrangement `arr`. +We distinguish between two cases: +(i) The given arrangement `arr` is empty (has only an unbounded face), +so we have to construct it from scratch. +(ii) We have to insert \f$m\f$ input curves to a non-empty arrangement +`arr`. In the first case, we sweep over the input curves, compute their intersection points and construct the \sc{Dcel} that represents their planar arrangement. This process is performed in -\f$ O\left((m + k)\log m\right)\f$ time, where \f$ k\f$ is the total number +\f$O\left((m + k)\log m\right)\f$ time, where \f$k\f$ is the total number of intersection points. The running time is asymptotically better than the time needed for incremental insertion, if the arrangement -is relatively sparse (when \f$ k\f$ is bounded by \f$ \frac{m^2}{\log +is relatively sparse (when \f$k\f$ is bounded by \f$\frac{m^2}{\log m}\f$), but in practice it is recommended to use this aggregated construction process even for dense arrangements, since the sweep-line algorithm needs less geometric operations compared to @@ -1380,26 +1598,31 @@ arrangement: \cgalExample{Arrangement_on_surface_2/aggregated_insertion.cpp} -In case we have to insert a set of \f$ m\f$ curves into an existing -arrangement, where we denote the number of edges in the arrangement by \f$ N\f$. -As a rule of thumb, if \f$ m = o(\sqrt{N})\f$, we insert the curves one by -one. For larger input sets, we use the aggregated insertion procedures. +In case we have to insert a set of \f$m\f$ curves into an existing +arrangement, where we denote the number of edges in the arrangement by +\f$N\f$. As a rule of thumb, if \f$m = o(\sqrt{N})\f$, we insert the +curves one by one. For larger input sets, we use the aggregated +insertion procedures. \cgalFigureBegin{arr_figex_unb1,ex_10.png} -An arrangement of intersecting line segments, as constructed in `global_insertion.cpp`. The segments of \f$ {\mathcal S}_1\f$ are drawn in solid lines and the segments of \f$ {\mathcal S}_2\f$ are drawn in dark dashed lines. Note that the segment \f$ s\f$ (light dashed line) overlaps one of the segments in \f$ {\mathcal S}_1\f$. +An arrangement of intersecting line segments, as constructed in +`global_insertion.cpp`. The segments of \f${\mathcal S}_1\f$ are +drawn in solid lines and the segments of \f${\mathcal S}_2\f$ are +drawn in dark dashed lines. Note that the segment \f$ s\f$ (light +dashed line) overlaps one of the segments in \f${\mathcal S}_1\f$. \cgalFigureEnd In the example below we aggregately construct an arrangement of a set -\f$ {\mathcal S}_1\f$ containing five line segments. Then we insert a single -segment using the incremental insertion function. Finally, we add a set -\f$ {\mathcal S}_2\f$ with five more line segments in an aggregated fashion. -Notice that the line segments of \f$ {\mathcal S}_1\f$ are pairwise -interior-disjoint, so we use `insert_non_intersecting_curves()`. -\f$ {\mathcal S}_2\f$ also contain pairwise interior-disjoint segments, -but as they intersect the existing arrangement, we have to use -`insert()` to insert them. Also note that the -single segment \f$ s\f$ we insert incrementally overlaps an existing -arrangement edge: +\f${\mathcal S}_1\f$ containing five line segments. Then we insert a +single segment using the incremental insertion function. Finally, we +add a set \f${\mathcal S}_2\f$ with five more line segments in an +aggregated fashion. Notice that the line segments of \f${\mathcal +S}_1\f$ are pairwise interior-disjoint, so we use +`insert_non_intersecting_curves()`. \f${\mathcal S}_2\f$ also contain +pairwise interior-disjoint segments, but as they intersect the +existing arrangement, we have to use `insert()` to insert them. Also +note that the single segment \f$s\f$ we insert incrementally overlaps +an existing arrangement edge: \cgalExample{Arrangement_on_surface_2/global_insertion.cpp} @@ -1419,15 +1642,15 @@ template having the same name is that they allow the merger of two curves associated with adjacent edges to form a single edge. Thus, they require that the traits class that instantiates the arrangement instance is a model of the refined `ArrangementXMonotoneTraits_2` concept (see -Section \ref arr_sectraits). +Section \ref aos_sec-geom_traits). -The function `remove_vertex(arr, v)` removes the vertex -`v` from the given arrangement `arr`, where `v` is -either an isolated vertex or is a redundant vertex - -namely, it has exactly two incident edges that are associated with -two curves that can be merged to form a single \f$ x\f$-monotone curve. -If neither of the two cases apply, the function returns an -indication that it has failed to remove the vertex. +The function `remove_vertex(arr, v)` removes the vertex `v` from the +given arrangement `arr`, where `v` is either an isolated vertex or is +a redundant vertex - namely, it has exactly two incident +edges that are associated with two curves that can be merged to form a +single \f$x\f$-monotone curve. If neither of the two cases apply, the +function returns an indication that it has failed to remove the +vertex. The function `remove_edge(arr, e)` removes the edge `e` from the arrangement by simply calling `arr.remove_edge(e)` @@ -1447,7 +1670,7 @@ vertical line segments: \cgalExample{Arrangement_on_surface_2/global_removal.cpp} -\section arr_secunbounded Arrangements of Unbounded Curves +\section aos_sec-unbounded Arrangements of Unbounded Curves Previous sections dealt only with arrangements of line segments, namely of bounded curves. Such arrangements always have one unbounded @@ -1457,19 +1680,20 @@ lines and rays. \subsection arr_ssecunb_basic Basic Manipulation and Traversal Methods -Consider the arrangement induced by the two lines \f$ y = x\f$ and -\f$ y = -x\f$. These two lines intersect at the origin, such that the -arrangement contains a single vertex \f$ v = (0,0)\f$, with four infinite -rays emanating from it. Each ray corresponds to an arrangement edge, -and these edges subdivide the plane into four unbounded faces. -Consider a halfedge pair that represents one of the edges. The source -vertex of one of these halfedges is \f$ v\f$ and its target is at infinity, -while the other has its source at infinity and \f$ v\f$ is its target. +Consider the arrangement induced by the two lines \f$y = x\f$ and \f$y += -x\f$. These two lines intersect at the origin, such that the +arrangement contains a single vertex \f$v = (0,0)\f$, with four +infinite rays emanating from it. Each ray corresponds to an +arrangement edge, and these edges subdivide the plane into four +unbounded faces. Consider a halfedge pair that represents one of the +edges. The source vertex of one of these halfedges is \f$v\f$ and its +target is at infinity, while the other has its source at infinity and +\f$v\f$ is its target. If `e` is an object of the nested type `Arrangement_2::Halfedge`, then the predicates `e.source_at_infinity()` and `e.target_at_infinity()` indicate -whether the halfedge represents a curve with an infinite end. +whether the halfedge represents a curve with an end at infinity. In general there is no need to access the source (or the target) of a halfedge if it lies at infinity, since this vertex is not associated with any valid point. Similarly, calling `arr.number_of_vertices()` @@ -1490,43 +1714,43 @@ The functions `arr.unbounded_faces_begin()` and of unbounded faces. Naturally, the value-type of this iterator is `Arrangement_2::Face`. -The specialized insertion functions listed in -Section \ref arr_sssecmf_insert_cv can also be used for inserting -\f$ x\f$-monotone unbounded curves, provided that they are interior-disjoint -from any subcurve that already exists in the arrangement. For example, -if you wish to insert a ray \f$ r\f$ emanating from \f$ (0,0)\f$ in the direction -of \f$ (1,0)\f$, to the arrangement of \f$ y = -x\f$ and \f$ y = x\f$, you can use -the function `arr.insert_from_left_vertex()`, as the left -endpoint of \f$ r\f$ is already associated with an arrangement vertex. -Other edge-manipulation functions can also be applied on edges -associated with unbounded curves. +The specialized insertion functions listed in Section \ref +arr_sssecmf_insert_cv can also be used for inserting \f$x\f$-monotone +unbounded curves, provided that they are interior-disjoint from any +subcurve that already exists in the arrangement. For example, if you +wish to insert a ray \f$r\f$ emanating from \f$(0,0)\f$ in the +direction of \f$(1,0)\f$, to the arrangement of \f$y = -x\f$ and \f$y += x\f$, you can use the function `arr.insert_from_left_vertex()`, as +the left endpoint of \f$r\f$ is already associated with an arrangement +vertex. Other edge-manipulation functions can also be applied on +edges associated with unbounded curves. \cgalFigureBegin{arr_figunb_dcel,ex_unb1.png} An arrangement of unbounded linear objects, as constructed in unbounded_non_intersecting.cpp. \cgalFigureEnd The following example demonstrates the use of the insertion function -for pairwise interior-disjoint unbounded curves. In this example -we use the traits class `Arr_linear_traits_2` to -instantiate the `Arrangement_2` template. This traits class is -capable of representing line segments as well as unbounded linear -curves (namely lines and rays). Observe that objects of the type -`X_monotone_curve_2` defined by this traits class are -constructible from `Line_2`, `Ray_2`, and `Segment_2` -objects, as defined in the instantiated kernel. +for pairwise interior-disjoint unbounded curves. In this example we +use the traits class `Arr_linear_traits_2` to instantiate the +`Arrangement_2` template. This traits class is capable of representing +line segments as well as unbounded linear curves (namely lines and +rays). Observe that objects of the type `X_monotone_curve_2` defined +by this traits class are constructible from `Line_2`, `Ray_2`, and +`Segment_2` objects, as defined in the instantiated kernel. The first three curves are inserted using the special insertion -functions for \f$ x\f$-monotone curves whose location in the arrangement -is known. Notice that inserting an unbounded curve in the interior -of an unbounded face, or from an existing vertex that represents the -bounded end of the curve, may cause an unbounded face to split (this -is never the case when inserting a bounded curve - compare with -Section \ref arr_sssecmf_insert_cv). Then, three additional rays are -inserted incrementally, using the insertion function for \f$ x\f$-monotone -curves whose interior is disjoint from all arrangement features. -Finally, the program prints the size of the arrangement (compare to -the illustration in \cgalFigureRef{arr_figex_unb1}) and the outer -boundaries of its six unbounded faces: +functions for \f$ x\f$-monotone curves whose location in the +arrangement is known. Notice that inserting an unbounded curve in the +interior of an unbounded face, or from an existing vertex that +represents the bounded end of the curve, may cause an unbounded face +to split (this is never the case when inserting a bounded curve - +compare with Section \ref arr_sssecmf_insert_cv). Then, three +additional rays are inserted incrementally, using the insertion +function for \f$ x\f$-monotone curves whose interior is disjoint from +all arrangement features. Finally, the program prints the size of the +arrangement (compare to the illustration in +\cgalFigureRef{arr_figex_unb1}) and the outer boundaries of its six +unbounded faces: \cgalExample{Arrangement_on_surface_2/unbounded_non_intersecting.cpp} @@ -1537,116 +1761,131 @@ of bounded curves can also be applied to arrangements of unbounded curves. For example, it is possible to issue point-location and vertical ray-shooting queries (see also Section \ref arr_secqueries) on arrangements of lines, where the only restriction is that the query -point has finite coordinates.\cgalFootnote{Currently, all point-location strategies except the trapezoidal RIC point-location strategy are capable of handling arrangements of unbounded curves.} +point has finite coordinates.\cgalFootnote{Currently, all +point-location strategies except the trapezoidal RIC point-location +strategy are capable of handling arrangements of unbounded curves.} In the following example we show how an arrangement of unbounded lines -is utilized to solve the following problem: Given a set of points, does -the set contain at least three collinear points? In this example a set -of input points is read from a file. The file `points.dat` is -used by default. It contains definitions of \f$ 100\f$ points randomly -selected on the grid \f$ [-10000,10000]\times[-10000,10000]\f$. We -construct an arrangement of the dual lines, where the line \f$ p^{*}\f$ -dual to the point \f$ p = (p_x, p_y)\f$ is given by the equation -\f$ y = p_x*x - p_y\f$, and check whether three (or more) of the dual lines +is utilized to solve the following problem: Given a set of points, +does the set contain at least three collinear points? In this example +a set of input points is read from a file. The file `points.dat` is +used by default. It contains definitions of \f$100\f$ points randomly +selected on the grid \f$[-10000,10000]\times[-10000,10000]\f$. We +construct an arrangement of the dual lines, where the line \f$p^{*}\f$ +dual to the point \f$p = (p_x, p_y)\f$ is given by the equation \f$y = +p_x*x - p_y\f$, and check whether three (or more) of the dual lines intersect at a common point, by searching for a (dual) vertex, whose -degree is greater than \f$ 4\f$. If such a vertex exists, then there are at -least three dual lines that intersect at a common point, which implies -that there are at least three collinear points. +degree is greater than \f$4\f$. If such a vertex exists, then there +are at least three dual lines that intersect at a common point, which +implies that there are at least three collinear points. \cgalExample{Arrangement_on_surface_2/dual_lines.cpp} Note that there are no three collinear points among the points defined -in the input file `points.dat`. In the second part of the example -the existence of collinearity is forced and verified as follows. A line +in the input file `points.dat`. In the second part of the example the +existence of collinearity is forced and verified as follows. A line dual to the midpoint of two randomly selected points is introduced, and inserted into the arrangement. This operation is followed by a -test that verifies that a vertex of degree greater than \f$ 4\f$ -exists. This implied that collinearity indeed exists as explained above. +test that verifies that a vertex of degree greater than \f$4\f$ +exists. This implied that collinearity indeed exists as explained +above. \subsection arr_ssecunb_rep Representation of Unbounded Arrangements \cgalAdvancedBegin \cgalFigureBegin{typenormal,unb_dcel.png} -A \sc{Dcel} representing an arrangement of four lines. Halfedges are drawn as thin arrows. The vertices \f$ v_1, \ldots, v_8\f$ lie at infinity, and are not associated with valid points. The halfedges that connect them are fictitious, and are not associated with concrete curves. The face denoted \f$ f_0\f$ (lightly shaded) is the fictitious "unbounded face" which lies outside the bounding rectangle (dashed) that bounds the actual arrangement. The four fictitious vertices \f$ v_{\rm bl}, v_{\rm tl}, v_{\rm br}\f$ and \f$ v_{\rm tr}\f$ represent the four corners of the bounding rectangle. +A \sc{Dcel} representing an arrangement of four lines. Halfedges are +drawn as thin arrows. The vertices \f$v_1, \ldots, v_8\f$ lie at +infinity, and are not associated with valid points. The halfedges that +connect them are fictitious, and are not associated with concrete +curves. The face denoted \f$f_0\f$ (lightly shaded) is the fictitious +"unbounded face" which lies outside the bounding rectangle (dashed) +that bounds the actual arrangement. The four fictitious vertices +\f$v_{\rm bl}, v_{\rm tl}, v_{\rm br}\f$ and \f$v_{\rm tr}\f$ +represent the four corners of the bounding rectangle. \cgalFigureEnd - -Given a set \f$ \cal C\f$ of unbounded curves, a simple approach for -representing the arrangement induced by \f$ \cal C\f$ would be to clip the -unbounded curves using an axis-parallel rectangle that contains all -finite curve endpoints and intersection points between curves in -\f$ \cal C\f$. This process would result in a set \f$ \cal C\f$ of bounded curves -(line segments if \f$ \cal C\f$ contains lines and rays), and it would be -straightforward to compute the arrangement induced by this set. -However, we would like to operate directly on the unbounded curves -without having to preprocess them. Therefore, we use an implicit -bounding rectangle embedded in the \sc{Dcel} structure. -\cgalFigureRef{arr_figunb_dcel} shows the arrangement of four lines -that subdivide the plane into eight unbounded faces and two bounded -ones. Notice that in this case the unbounded faces have outer +Given a set \f$\cal C\f$ of unbounded curves, a simple approach for +representing the arrangement induced by \f$\cal C\f$ would be to clip +the unbounded curves using an axis-parallel rectangle that contains +all finite curve endpoints and intersection points between curves in +\f$\cal C\f$. This process would result in a set \f$\cal C\f$ of +bounded curves (line segments if \f$\cal C\f$ contains lines and +rays), and it would be straightforward to compute the arrangement +induced by this set. However, we would like to operate directly on +the unbounded curves without having to preprocess them. Therefore, we +use an implicit bounding rectangle embedded in the \sc{Dcel} +structure. \cgalFigureRef{arr_figunb_dcel} shows the arrangement of +four lines that subdivide the plane into eight unbounded faces and two +bounded ones. Notice that in this case the unbounded faces have outer boundaries, and the halfedges along these outer CCBs are drawn as arrows. The bounding rectangle is drawn with a dashed line. The -vertices \f$ v_1,v_2,\ldots,v_8\f$, which represent the unbounded ends of -the four lines, and lie on the bounding rectangle, actually exist at -infinity, and the halfedges connecting them are fictitious, and -represent portions of the bounding rectangle. Note that the outer CCBs -of the unbounded faces contain fictitious halfedges. The twins of these -halfedges form together one connected component that corresponds to -the entire bounding rectangle, which forms a single hole in a face -\f$ f_0\f$. We say that \f$ f_0\f$ is fictitious, as it does +vertices \f$v_1,v_2,\ldots,v_8\f$, which represent the unbounded ends +of the four lines, and lie on the bounding rectangle, actually exist +at infinity, and the halfedges connecting them are fictitious, +and represent portions of the bounding rectangle. Note that the outer +CCBs of the unbounded faces contain fictitious halfedges. The twins of +these halfedges form together one connected component that corresponds +to the entire bounding rectangle, which forms a single hole in a face +\f$f_0\f$. We say that \f$f_0\f$ is fictitious, as it does not correspond to a real two-dimensional cell of the arrangement. Observe that there are four extra vertices at infinity that do not lie -on any curve; they are denoted as \f$ v_{\rm bl}, v_{\rm tl}, -v_{\rm br}\f$, and \f$ v_{\rm tr}\f$, and represent the bottom-left, top-left, +on any curve; they are denoted as \f$v_{\rm bl}, v_{\rm tl}, v_{\rm +br}\f$, and \f$v_{\rm tr}\f$, and represent the bottom-left, top-left, bottom-right, and top-right corners of the bounding rectangle, respectively. Similarly, there are fictitious halfedges that lie on the top, the bottom, the left, or the right edge of the bounding -rectangle. When the arrangement is empty, there are exactly -four pairs of fictitious halfedges, that divide the plane into two -faces, namely a fictitious face lying outside of the bounding -rectangle and a single unbounded face bounded by the bounding rectangle. +rectangle. When the arrangement is empty, there are exactly four pairs +of fictitious halfedges, that divide the plane into two faces, namely +a fictitious face lying outside of the bounding rectangle and a single +unbounded face bounded by the bounding rectangle. Summarizing the above, there are four types of arrangement vertices, which differ from one another by their location with respect to the bounding bounding rectangle:
          -
        1. A vertex, associated with a point in \f$ \mathbb{R}^2\f$ whose +
        2. A vertex, associated with a point in \f$\mathbb{R}^2\f$ whose coordinates are bounded. Such a vertex always lies inside the bounding rectangle. -
        3. \anchor typeunbounded A vertex that represents an unbounded end of an \f$ x\f$-monotone curve -that is defined at \f$ x = -\infty\f$ or at \f$ x = \infty\f$. In case of -a horizontal line or a curve with a horizontal asymptote, the -\f$ y\f$-coordinate of the curve end may be finite (see for example the -vertices \f$ v_2\f$ and \f$ v_7\f$ in \cgalFigureRef{arr_figunb_dcel}), but in -general the curve end also goes to \f$ y = \pm\infty\f$ (see for instance -the vertices \f$ v_1\f$, \f$ v_3\f$, \f$ v_6\f$ and \f$ v_8\f$ in + +
        4. \anchor typeunbounded A vertex that represents an unbounded end +of an \f$x\f$-monotone curve that is defined at \f$x = -\infty\f$ or +at \f$x = \infty\f$. In case of a horizontal line or a curve with a +horizontal asymptote, the \f$y\f$-coordinate of the curve end may be +finite (see for example the vertices \f$v_2\f$ and \f$v_7\f$ in +\cgalFigureRef{arr_figunb_dcel}), but in general the curve end also +goes to \f$y = \pm\infty\f$ (see for instance the vertices \f$v_1\f$, +\f$v_3\f$, \f$v_6\f$ and \f$v_8\f$ in \cgalFigureRef{arr_figunb_dcel}). For our convenience, we will always take a "tall" enough bounding rectangle and treat such vertices as lying on either the left or right rectangle edges (that is, if a curve -is defined at \f$ x = -\infty\f$, its left end will be represented by -a vertex on the left edge of the bounding rectangle, and if it is -defined at \f$ x = \infty\f$, its right end will be represented by a +is defined at \f$x = -\infty\f$, its left end will be represented by a +vertex on the left edge of the bounding rectangle, and if it is +defined at \f$x = \infty\f$, its right end will be represented by a vertex of the right edge). -
        5. A \anchor typeunboundedvertical vertex that represent the unbounded end of a vertical line or of a -curve with a vertical asymptote (finite \f$ x\f$-coordinate and an -unbounded \f$ y\f$-coordinate). Such a vertex always lies on one of the -horizontal edges of the bounding rectangle (either the bottom one if -\f$ y = -\infty\f$, or the top one if \f$ y = \infty\f$). The vertices \f$ v_4\f$ -and \f$ v_5\f$ in \cgalFigureRef{arr_figunb_dcel} are of this type. -
        6. The \anchor typefictitious fictitious vertices that represent the four corners of the -bounding bounding rectangle. -
        -A vertex (at infinity) of Type \ref typeunbounded or -Type \ref typeunboundedvertical above always has -three incident edges: one concrete edge that is associated with an -unbounded portion of an \f$ x\f$-monotone curve, and two fictitious edges -connecting the vertex to its neighboring vertices at infinity. -Fictitious vertices (of type 4 above) have exactly two incident edges. -See Section \ref arr_sectraits on how the traits-class interface -helps imposing the fact that we never have more than one curve -incident to any true vertex at infinity. +
      • \anchor typeunboundedvertical A vertex that represent the +unbounded end of a vertical line or of a curve with a vertical +asymptote (finite \f$x\f$-coordinate and an unbounded +\f$y\f$-coordinate). Such a vertex always lies on one of the +horizontal edges of the bounding rectangle (either the bottom one if +\f$y = -\infty\f$, or the top one if \f$y = \infty\f$). The vertices +\f$v_4\f$ and \f$v_5\f$ in \cgalFigureRef{arr_figunb_dcel} are of this +type. + +
      • \anchor typefictitious The fictitious vertices that +represent the four corners of the bounding bounding rectangle.
    + +A vertex (at infinity) of Type \ref typeunbounded or Type \ref +typeunboundedvertical above always has three incident edges: one +concrete edge that is associated with an unbounded portion of an +\f$x\f$-monotone curve, and two fictitious edges connecting the vertex +to its neighboring vertices at infinity. Fictitious vertices (of type +4 above) have exactly two incident edges. See Section \ref +aos_sec-geom_traits on how the traits-class interface helps imposing +the fact that we never have more than one curve incident to any true +vertex at infinity. The nested types defined in the `Arrangement_2` class support the following methods, in addition to the ones listed in @@ -1661,18 +1900,18 @@ parameter space. In particular, the former returns `ARR_BOTTOM_BOUNDARY`, `ARR_INTERIOR`, or `ARR_TOP_BOUNDARY`. As the package currently supports only the case where the parameter space is the compactified plane, the former -returns `ARR_INTERIOR` if the \f$ x\f$-coordinate associated with the -vertex is finite, `ARR_LEFT_BOUNDARY` if it is \f$ -\infty\f$, and -`ARR_RIGHT_BOUNDARY` if it is \f$ \infty\f$. The latter returns -`ARR_INTERIOR` if the \f$ y\f$-coordinate associated with the vertex -is finite, `ARR_BOTTOM_BOUNDARY` if it is \f$ -\infty\f$, and -`ARR_TOP_BOUNDARY` if it is \f$ \infty\f$. The Boolean predicate +returns `ARR_INTERIOR` if the \f$x\f$-coordinate associated with the +vertex is finite, `ARR_LEFT_BOUNDARY` if it is \f$-\infty\f$, and +`ARR_RIGHT_BOUNDARY` if it is \f$\infty\f$. The latter returns +`ARR_INTERIOR` if the \f$y\f$-coordinate associated with the vertex +is finite, `ARR_BOTTOM_BOUNDARY` if it is \f$-\infty\f$, and +`ARR_TOP_BOUNDARY` if it is \f$\infty\f$. The Boolean predicate `is_at_open_boundary()` is also provided. You can access the point associated with a vertex only if it is not a vertex at an open boundary (recall that a vertex at an open boundary is not associated with a `Point_2` object).
  • The nested `Halfedge` class provides the Boolean predicate -`is_fictitious()`. The \f$ x\f$-monotone curve associated with +`is_fictitious()`. The \f$x\f$-monotone curve associated with a halfedge can be accessed by the `curve()` method only if the halfedge is not fictitious.
  • The nested `Face` class provides the Boolean predicate @@ -1724,84 +1963,465 @@ using the following procedure: \endcode \cgalAdvancedEnd -\section arr_sectraits Traits Classes +\section aos_sec-curved_surfaces Arrangements on Curved Surfaces -As mentioned in the introduction of this chapter, the traits class -encapsulates the definitions of the geometric entities and -implements the geometric predicates and constructions needed by -the `Arrangement_2` class and by its peripheral algorithms. We also -mention throughout the chapter that there are different levels of -requirements from the traits class, namely the traits class can model +We are given a surface \f$S\f$ in \f$\mathbb{R}^3\f$ and a set \f$\cal +C \f$ of curves embedded on this surface. The curves subdivide \f$S\f$ +into cells of dimension 0 (vertices), 1 (edges), and +2 (faces). This subdivision is the arrangement +\f$\cal A(\cal C) \f$ induced by \f$\cal C\f$ on \f$S\f$. Arrangements +embedded on curved surfaces in \f$\mathbb{R}^3\f$ are generalizations +of arrangements embedded in the plane. In this section we explain how +to construct, maintain, and manipulate two-dimensional arrangements +embedded on orientable parametric surfaces in three dimensions, such +as planes, cylinders, spheres, and tori, and surfaces homeomorphic to +them; see Figure \cgalFigureRef{aos_fig-surfaces}. Such arrangements +have many theoretical and practical applications; see, e.g., +\cgalCite{as-aa-00}, \cgalCite{cgal:bfhks-apsca-10}, +\cgalCite{cgal:bfhmw-apsgf-10}, \cgalCite{cgal:fhktww-a-07}, and +\cgalCite{cgal:h-a-04}. + +\cgalFigureAnchor{aos_fig-surfaces} +
    + + + + + + + + + + + + + + + + +
    \image html sphere.png\image html cylinder.png\image html cone.png\image html ellipsoid.png\image html torus.png\image html paraboloid.png
    (a) Sphere(b) Cylinder(c) Cone(d) Ellipsoid(e) Torus(f) Paraboloid
    +
    +\cgalFigureCaptionBegin{aos_fig-surfaces} +Various two-dimensional parametric surfaces, arrangements on which +are supported by the framework. +\cgalFigureCaptionEnd + +\subsection aos_ssec-curved_surfaces-parameteric Parametric Surfaces + +We use \f$\overline{\mathbb{R}}\f$ to denote the compactified real line +\f$\mathbb{R} \cup \{-\infty,+\infty\}\f$. The mapping +\f$x \mapsto x/(1 - x^2)\f$ is a homeomorphism between +\f$(-1,+1)\f$ and \f$\mathbb{R}\f$ and between \f$[-1,+1]\f$ and +\f$\overline{\mathbb{R}}\f$. So you may also think of finite intervals +instead of the (compactified) real line in what follows. + +A parametric surface \f$S\f$ is given by a continuous function +\f$\phi_S: \Phi \rightarrow \mathbb{R}^3\f$, where the domain \f$\Phi += X \times Y\f$ is a rectangular two-dimensional parameter space; \f$S += \phi_S(\Phi)\f$. \f$X\f$ and \f$Y\f$ are open, half-open, or closed +intervals with endpoints in \f$\overline{\mathbb{R}}\f$. We use +\f$x_{\rm min}\f$, \f$x_{\rm max}\f$, \f$y_{\rm min}\f$, and \f$y_{\rm +max}\f$ to denote the endpoints of \f$X\f$ and \f$Y\f$, respectively. + +
      + +
    • The left side of the boundary of \f$\Phi\f$ consists of the points +\f$(x_{\rm min},y)\f$ with \f$y \in {\rm closure}(Y)\f$. It is +open, if \f$x_{\rm min} \not\in X\f$ or \f$y\not\in Y\f$, and +closed, otherwise. The right side is defined analogously. +The bottom side consists of the points \f$(x, y_{\rm min})\f$ with +\f$x \in (x_{\rm min},x_{\rm max})\f$; the top side is defined +analogously. Bottom and top side can also be open. Note that the +"corners" of the parameter space belong to the vertical sides; this +asymmetry corresponds to the fact, that we sweep \f$x\f$-monotone +curves, and not \f$y\f$-monotone curves. The four sides together form +the boundary \f$\partial \Phi\f$.
    • + +
    • A point \f$p \in S\f$ is regular if it has only one +pre-image. All pre-images of a non-regular point lie in the boundary +of \f$\Phi\f$. In particular, \f$\phi_S\f$ is bijective on +\f$(x_{\rm min},x_{\rm max})\times(y_{\rm min},y_{\rm max})\f$. +More precisely, a non-regular point has either exactly two pre-images +that lie on opposite sides of the domain, or all points of exactly one +side of the domain.
    • + +
    + +A side of the domain is contracted, if \f$\phi_S\f$ is constant on it. +The image of the side is called a contraction point. + +The bottom and top sides of the domain (similarly for the left and +right sides) are identified, if +\f$\phi_S(x,y_{\rm min}) = \phi_S(x,y_{\rm max})\f$ for all +\f$x \in X \f$. The curve \f$x \mapsto \phi_S(x,y_{\rm min})\f$ is +called an identification curve. + +Rectangles, strips, quadrants, half-planes, and planes can be modeled +with \f$\phi_S \f$ being the identity mapping. For example, +\f$\Phi_S(x, y) = (x, y, 0)\f$ with \f$X = Y =(-\infty, +\infty)\f$ +parameterizes the plane. Surfaces such as paraboloids can be +modeled through continuous and bijective parameterizations, for +example, \f$\phi_S(x,y) = (x,y,x^2 + y^2)\f$, where +\f$U = V =(-\infty, +\infty)\f$, defines a paraboloid of revolution. +Cylinders, tori, spheres, and surfaces homeomorphic to them, require +more general parameterizations. For example, the unit sphere is +commonly parameterized as +\f$\phi_S(x, y) = (\cos x \cos y, \sin x \cos y, \sin y)\f$, where +\f$\Phi = [-\pi, \pi] \times [-\frac{\pi}{2}, \frac{\pi}{2}]\f$. With +respect to this parameterization, the north and the south pole and +all points on the opposite Prime (Greenwich) Meridian are +non-regular. The north pole \f$(0,0,1)\f$ has infinitely many +pre-images \f$(x, \pi/2)\f$ with \f$-\pi < x < \pi\f$ and so does the +south pole \f$(0,0,-1)\f$. The points on the opposite Prime Meridian +have two pre-images each, namely \f$(-\pi,y)\f$ and \f$(\pi,y)\f$ +with \f$-\pi/2 \leq y \leq \pi/2\f$. We say that the upper and lower +side of the domain are contracted and the left and right sides +are identified. These are exactly the kinds of non-injectivity +that we allow. + +We give more examples. A triangle with corners +\f$(a_1, b_1), (a_2, b_2)\f$, and \f$(a_3, b_3)\f$ can be +parameterized via \f$\Phi = [0,1] \times [0,1]\f$ with +\f$\phi_S(x,y) = (a_1 + x(a_2 - a_1) + xy(a_3-a_2), b_1 + +x(b_2 - b_1) + xy(b_3-b_2), 0)\f$. The left side of the rectangular +domain contracts to a point. An open or closed cylinder is +modelled by identifying the vertical sides and having \f$Y\f$ open or +closed, respectively. A torus is modelled by identifying the +vertical sides and the horizontal sides. A paraboloid or +half-cone may be modelled by identifying the vertical sides +and contracting one of the horizontal sides to a point. More elegantly, +they are modelled by a bijective parameterization as given above. A +sphere is modelled by identifying the vertical sides and +contracting both horizontal sides. A croissant, a torus with +one pinch point, is modelled by identifying the vertical and +identifying the horizontal sides and, in addition, contracting one of +the pairs. However, the croissant is excluded by our definitions. All +surfaces supported by our framework are locally homeomorphic to a +disk, and hence an \sc{EDcel} data-structure suffices for representing +arrangements on these surfaces. The croissant is, at the pinch point, +not locally homeomorphic to a disk, and hence a more general +cell-tuple data structure than an \sc{EDcel} would be needed. + +A curve \f$\gamma\f$ is a continuous function \f$\gamma: I \rightarrow +\Phi\f$, where \f$I\f$ is an open, half-open, or closed interval with +endpoints 0 and 1, and \f$\gamma\f$ is injective except for at a +finite number of points. If \f$0 \not\in I\f$, \f$\lim_{t \rightarrow +0+} \gamma(t)\f$ exists (in the closure of \f$\Phi\f$) and lies in an +open side of the boundary. Similarly, if \f$1 \not\in I\f$, \f$\lim_{t +\rightarrow 1-} \gamma(t)\f$ exists and lies in an open side of the +boundary. A curve \f$C\f$ in \f$S\f$ is the image of a curve +\f$\gamma\f$ in the domain. + +A curve is closed in the domain if \f$\gamma(0) = +\gamma(1)\f$; in particular, \f$0 \in I\f$ and \f$1 \in I\f$. A curve +is closed in the surface \f$S\f$ (or simply closed) if +\f$\phi_S(\gamma(0)) = \phi_S(\gamma(1))\f$. A curve \f$\gamma\f$ has +two ends, the 0-end \f$\langle \gamma,0 \rangle\f$ and the +1-end \f$\langle \gamma,1 \rangle\f$. If \f$d \in I\f$, the +\f$d\f$-end has a geometric interpretation. It is a point in +\f$\Phi\f$. If \f$d \not\in I\f$, the \f$d\f$-end has no geometric +interpretation. You may think of it as a point on an open side of the +domain or an initial or terminal segment of \f$\gamma\f$. If \f$d +\not\in I\f$, we say that the \f$d\f$-end of the curve is open. The +equator curve on the sphere in standard parameterization is given by +\f$\gamma(t) = (\pi(2t - 1),0)\f$ for \f$t \in [0,1]\f$. The +\f$0\f$-end of \f$\gamma\f$ is the point \f$(-\pi,0)\f$ in \f$\Phi\f$ +and a point on the equator of the sphere. It is closed on the sphere, +but non-closed in \f$\Phi\f$. The diagonal \f$(u,u)\f$ in the plane +is, for example, given by \f$\gamma(t) = (x(t),y(t))\f$ and \f$x(t) = +y(t) = (t - 1/2)/(t(1-t))\f$. Both ends of this curve are open. The +\f$d\f$-end of a curve \f$\gamma\f$ is incident to the left side if +either \f$d \in I\f$ and \f$\gamma(d)\f$ lies on the left side or \f$d +\not\in I\f$ and \f$\lim_{t \rightarrow d} \gamma(t)\f$ lies on the +left side, which is then an open side. Similarly for the other sides. + +A strongly \f$x\f$-monotone curve is the image of a curve +\f$\gamma\f$, such that if \f$t_1 < t_2\f$, then \f$x(t_1) < +x(t_2)\f$. A vertical curve is the image of a curve +\f$\gamma\f$, such that \f$x(t) = C\f$ for all \f$t \in I\f$ and some +\f$C \in X\f$ and \f$y(t_1) < y(t_2)\f$ for \f$t_1 < t_2\f$. For +instance, every Meridian curve of a sphere parameterized as above is +vertical. A \f$x\f$-monotone curve is either vertical or +strongly \f$x\f$-monotone. + +\subsection aos_ssec-curved_surfaces-aos_class The Arrangement on Surface Class Template + +The class template `Arrangement_on_surface_2` +can be used to represent a 2D arrangement embedded in a 3D +surface. The template is parameterized by template parameters +geometry traits and topology traits. The +topology-traits type deals with the topology of the parametric +surface. As explained in the previous section, a parametric surface +\f$S \f$ is given by a continuous function \f$\phi_S: \Phi \rightarrow +\mathbb{R}^3\f$, where the domain \f$\Phi = X \times Y\f$ is a +rectangular two-dimensional parameter space; \f$S = +\phi_S(\Phi)\f$. \f$X\f$ and \f$Y\f$ are open, half-open, or closed +intervals with endpoints in \f$\overline{\R} \f$. + +The geometry-traits type introduces the type names of the basic +geometric objects (i.e., point, curve, and \f$u \f$-monotone curve) +and the set of operations on objects of these types required to +construct and maintain the arrangement and to operate on it. The +traits-concept hierarchy described in Section \ref aos_sec-geom_traits +accurately define the requirements imposed on an instantiated geometry +traits class. Recall that requirements apply to the parameter space +\f$\Phi = X \times Y\f$; thus, they are defined in terms of \f$x\f$ +and \f$y\f$ coordinates. Most requirements apply to all type of +arrangements regadless of the embedding surface. However, several +refined concepts apply only to arrangements on surfaces that are not +the plane, that is, modeled with \f$\phi_S\f$ not being the identity +mapping. They differ according to the type of the side boundaries of +the parameter space being open, closed, constracted, or identified. + +At this point only one type of arrangements on non planar surfaces is +supported, namely, arrangements embedded on the sphere and induced by +arcs of great circles, aka geodesic arcs. Figure +\cgalFigureRef{aos_fig-voronoi} shows various Voronoi diagrams the +bisectors of which are geodesic arcs. They are represented as +arrangements induced by geodesic arcs embedded on the sphere. + +\cgalFigureAnchor{aos_fig-voronoi} +
    + + + + + + + + + + + + +
    \image html voronoi.jpg\image html degenerate_voronoi.jpg\image html power_diagram.jpg\image html degenerate_power_diagram.jpg
    (a)(b)(c)(d)
    +
    +\cgalFigureCaptionBegin{aos_fig-voronoi} +Voronoi diagrams on the sphere. +All diagram edges are geodesic arcs. +Sites are drawn in red and Voronoi edges are drawn in blue. +(a) The Voronoi diagram of 32 random points. +(b) A highly degenerate case of Voronoi diagram of 30 point sites on the sphere. +(c) The power diagram of 10 random circles. +(d) A degenerate power diagram of 14 sites on the sphere. +\cgalFigureCaptionEnd + +\section aos_sec-geom_traits The Geometry Traits + +A traits class encapsulates the definitions of the geometric entities +and implements the geometric predicates and constructions needed by +instances of the `Arrangement_on_surface_2` class template and by the +peripheral algorithms that operate on objects of such +instances. Observe that that there are different levels of +requirements from the traits class; namely, the traits class can model different concept refinement-levels. -\subsection arr_sssectr_concepts The Hierarchy of Traits-Class Concepts +This section is divided into three parts. The first part desribes the +refinement hierarchy of the arrangement-traits conepts. The seond part +reviews various models of these conepts. These are traits classes, +which handle different curve families, such as line segments, +polylines, conic arcs, Bézier curves, algebraic curves, and +geodesic arcs on the sphere. The last part introduces decorators for +geometric traits classes. A decorator of a traits class attaches +auxiliary data to the geometric objects handled by the original traits +class, thereby extending it. -\subsection arr_sssectr_basic_concept The Basic Concept +\subsection aos_ssec-geom_traits-concepts The Hierarchy of the Geometry Traits Concepts + +\subsubsection aos_sssec-geom_traits-concepts_main The Main Concepts + +A rather large direted acyclic graph is required to capture the entire +hierarchy of the geometry traits-class conepts. In the following +sections we review individual clusters of the graph and desribe the +relations between them. Figure +\cgalFigureRef{aos_fig-central_concept_cluster} depicts the central +cluster. + +\cgalFigureBegin{aos_fig-central_concept_cluster,central_concept_cluster.png} +The hierarchy of the main geometry traits concepts. +\cgalFigureEnd + +\paragraph aos_par-geom_traits-concepts_basic The Basic Concept + +A model of the basic concept, `ArrangementBasicTraits_2`, needs to +define the types `%Point_2` and `%X_monotone_curve_2`, where objects +of the first type are the geometric mapping of arrangement vertices, +and objects of the latter type are the geometric mapping of edges. In +addition, it has to support the the set of predicates listed +below. This basic set of predicates is sufficient for constructing +arrangements of bounded \f$x\f$-monotone curves that are pairwise +disjoint in their interiors and points that do not lie in the interior +of the curves. The basic set of predicates is also sufficient for +answering vertical ray-shooting queries and point-location queries +with a small exception: Locating a point using the landmark strategy +requires a traits class that models the concept +`ArrangementLandmarkTraits_2`; see Section \ref +aos_sssec-tr_lanmarks_concept. -A model of the basic concept, `ArrangementBasicTraits_2`, -needs to define the types `Point_2` and -`X_monotone_curve_2`, where objects of the first type are -the geometric mapping of arrangement vertices, and objects of the -latter type are the geometric mapping of edges. Such a model has to -support in addition the following set of operations:
    -
    `Compare_x_2`:
    Compares the \f$ x\f$-coordinates of two points. -
    `Compare_xy_2`:
    Compares two points lexicographically, by -their \f$ x\f$-coordinates and then (in case of equality) by their -\f$ y\f$-coordinates. +
    `Compare_x_2`:
    Compares the \f$x\f$-coordinates of two points. +
    `Compare_xy_2`:
    Compares two points lexicographically, first by + their \f$x\f$-coordinates, and if they are equal, by their + \f$y\f$-coordinates. +
    `Equal_2`:
    There are two overloaded Boolean operators that + test equality. One returns true iff two given points represent the same + geometric point in the plane, and the second returns true iff the graphs + of two given \f$x\f$-monotone curves are the same.\cgalFootnote{The + predicate that tests equality between graphs of two \f$x\f$-monotone + curves is used only for testing as part of the test suite.}
    `Construct_min_vertex_2`,`Construct_max_vertex_2`:
    -Returns the left endpoint (similarly, the right endpoint) of -an \f$ x\f$-monotone curve. -
    `Compare_y_at_x_2`:
    Given an \f$ x\f$-monotone curve \f$ c\f$ and a -point \f$ p\f$ that lies in its \f$ x\f$-range, this predicate determines -whether \f$ p\f$ lies below, above or on \f$ c\f$. -
    `Compare_y_at_x_right_2`:
    -Given two \f$ x\f$-monotone curves \f$ c_1\f$ and \f$ c_2\f$ that share a common -left endpoint \f$ p\f$, this predicate determines whether \f$ c_1\f$ lies -above or under \f$ c_2\f$ immediately to the right of \f$ p\f$, or whether the -two curves coincide there. -
    `Equal_2`:
    Checks two points and two curves for equality -(two curves are equal if their graph is the same). -
    `Is_vertical_2`:
    -Determines whether an \f$ x\f$-monotone curve is vertical. + Returns the lexicographically smaller or left (resp. larger or right) + endpoint of an $x$-monotone curve. +
    `Is_vertical_2`:
    Determines whether an \f$x\f$-monotone curve + is vertical. +
    `Compare_y_at_x_2`:
    Given an \f$x\f$-monotone curve \f$C\f$ + and a point \f$p\f$ that lies in the \f$x\f$-range of \f$C\f$, determines + whether \f$p\f$ lies below, above or on \f$C\f$. +
    `Compare_y_at_x_right_2`:
    Given two \f$x\f$-monotone curves + \f$C_1\f$ and \f$C_2\f$ that share a common minimal (left) endpoint + \f$p\f$, determines whether \f$C_1\f$ lies above or under \f$C_2\f$ + immediately to the right of \f$p\f$, or whether the two curves overlap + there.
    Each model of the concept `ArrangementBasicTraits_2` needs to define a tag named `Has_left_category`. It determines whether the traits class supports the following predicate:
    -
    `Compare_y_at_x_left_2`:
    -Given two \f$ x\f$-monotone curves \f$ c_1\f$ and \f$ c_2\f$ that share a common -right endpoint \f$ p\f$, this predicate determines whether \f$ c_1\f$ lies -above or under \f$ c_2\f$ immediately to the left of \f$ p\f$, or whether the -two curves coincide there. +
    `Compare_y_at_x_left_2`:
    Given two \f$x\f$-monotone curves + \f$C_1\f$ and \f$C_2\f$ that share a common maximal (right) endpoint + \f$p\f$, determines whether \f$C_1\f$ lies above or under \f$C_2\f$ + immediately to the left of \f$p\f$, or whether the two curves overlap + there.
    -This predicate is optional, as it can be answered using the -other traits-class primitives, and we wish to alleviate the -need to implement an extra method that is not absolutely -necessary. However, as implementing the predicate directly -may prove to be more efficient, the traits-class -implementer may choose to provide it. +If the `Has_left_category` type nested in a model of the basic concept +is defined as `Tag_true`\cgalFootnote{In principle, the category type may +only be convertible to the tag type, but in practice the category is +typically explicitly defined as the tag.} the model must support the +predicate. If the type is defined as `Tag_false`, we resort to an internal +version, which is based just on the reduced set of provided operations. +The internal version might be less efficient, but it exempts the traits +developer from the potentially non-trivial task of providing an +(efficient) implementation of this predicate. The basic set of predicates is sufficient for constructing -arrangements of \f$ x\f$-monotone curves that do not reach or approach the -boundary of the parameter space. The nature of the input curves, i.e., -whether some of them are expected to reach or approach the left, right, +arrangements of \f$x\f$-monotone curves that do not reach or approach +the boundary of the parameter space. The nature of the input curves, +whether they are expected to reach or approach the left, right, bottom, or top side of the boundary of the parameter space, must be conveyed by the traits class. This is done through the definition of four additional nested types, namely `Left_side_category`, `Right_side_category`, `Bottom_side_category`, and -`Top_side_category`. Each of those types must be convertible to -the type `Arr_oblivious_side_tag` for the class to be a model of -the concept `ArrangementBasicTraits_2`. +`Top_side_category`. Each of those types must be convertible to the +type `Arr_oblivious_side_tag` for the class to be a model of the +concept `ArrangementBasicTraits_2`. -\subsection arr_sssectr_lanmarks_concept The Landmarks Concept +\paragraph aos_par-geom_traits-concepts_intersecting Intersecting x-Monotone Curves} + +Constructing an arrangement induced by \f$x\f$-monotone curves that +may intersect in their interior requires operations that are not +listed by the `ArrangementBasicTraits_2` concept. The additional +operations are listed by the concept `ArrangementXMonotoneTraits_2`, +which refines the basic arrangement-traits concept described above. +While models of the `ArrangementXMonotoneTraits_2` concept still +handle only \f$x\f$-monotone curves, the curves are not restricted to +be disjoint in their interiors. Such a model must be capable of +computing points of intersection between \f$x\f$-monotone curves, +splitting curves at these intersection points to obtain pairs of +interior-disjoint subcurves, and optionally merging pairs of +subcurves. A point of intersection between two curves is also +represented by the `%Point_2` type. A model of the refined concept must +define an additional type called `Multiplicity`. An object of this +type indicates the multiplicity of the intersection point of two +curves, also referred to as the intersection +number.\cgalFootnote{See, +e.g., http://en.wikipedia.org/wiki/Intersection_number for more +information about intersection numbers.} Loosely speaking, if two +curves intersect at a point \f$p\f$ but have different tangents (first +derivatives) at \f$p\f$, \f$p\f$ is of multiplicity 1. If the curve +tangents are equal but their curvatures (second derivatives) are not, +\f$p\f$ is of multiplicity 2, and so on. The multiplicity of points of +intersection between line segments is always 1, and the multiplicity +of a point of intersection between two polylines is 1 if the +intersection point is interior to the corresponding two line segments +of the polylines, and undefined (coded as 0) otherwise. A model of the +refined concept thus has to support the following additional +operations: + +
    +
    `Split_2`:
    Splits an \f$x\f$-monotone curve \f$C\f$ at a + given point \f$p\f$, which lies in the interior of \f$C\f$, into two + subcurves. +
    `Are_mergeable_2`:
    Determines whether two \f$ x\f$-monotone + curves \f$C_1\f$ and \f$C_2\f$ that share a common endpoint can be + merged into a single continuous \f$x\f$-monotone curve representable by + the traits class.\cgalFootnote{On the face of it this seems a difficult + predicate to implement. In practice we use very simple tests to decide + whether two curves are mergeable: We check whether their underlying + curves are identical and whether they do not bend to form a + non-\f$x\f$-monotone curve.} +
    `Merge_2`:
    Merges two mergeable \f$x\f$-monotone curves + into a single curve. +
    `Intersection_2`:
    Computes all intersection points and + overlapping sections of two given \f$x\f$-monotone curves. If possible, + computes also the multiplicity of each intersection point. Providing + the multiplicity of an intersection point is not required, but it can + expedite the arrangement construction. Typically, the multiplicity is + a byproduct of the intersection computation. However, if it is not + available, undefined multiplicity (coded as 0) is assumed. Having the + multiplicity of intersection points while constructing arrangements + enables the exploitation of the geometric knowledge intersection points + may have. +
    +Using a model of the `ArrangementXMonotoneTraits_2` it is +possible to construct arrangements of sets of \f$x\f$-monotone curves +(and points) that may intersect one another. The two operations +listed above, regarding the merging of curves, are optional, and should +be provided only if the type `Has_merge_category` nested in a model of +the `ArrangementXMonotoneTraits_2` concept is defined as `Tag_true`. +Otherwise, it is not possible to merge \f$x\f$-monotone curve and +redundant vertices may be left in the arrangement due to the removal of +edges. + +\paragraph aos_par-geom_traits-concepts_arbitrary Arbitrary Curves + +The concept `ArrangementTraits_2` refines the +`ArrangementXMonotoneTraits_2` concept. A model of the refined concept +must define an additional type that is used to represent general, not +necessarily \f$x\f$-monotone and not necessarily connected, curves, +named `Curve_2`. It also has to support the subdivision of a curve of +that type into a set of continuous \f$x\f$-monotone curves and +isolated points. For example, the curve \f$C:\ (x^2 + y^2)(x^2 + y^2 - +1) = 0\f$ comprises the unit circle (the locus of all points for which +\f$x^2 + y^2 = 1\f$) and the origin \f$(0,0)\f$. \f$C\f$ should +therefore be subdivided into two circular arcs, the upper part and the +lower part of the unit circle, and a single isolated point. In +particular a model of the refined concept has to support the following +additional operation: + +
    +
    `Make_x_monotone_2`:
    Divides a given general curve of type + `Curve_2` into continuous weakly \f$x\f$-monotone curves and isolated points. +
    + +Note that the a model of the refined concept `ArrangementTraits_2` is +required only when using the free `insert()` functions (see Section \ref +arr_secgl_funcs), which accept an object of type `Curve_2` or a range +of objects of that type. In all other cases it is sufficient to use a +model of the `ArrangementXMonotoneTraits_2` concept. + +\subsubsection aos_sssec-tr_lanmarks_concept The Landmarks Concept + +\cgalFigureBegin{aos_fig-landmark_concept_cluster,landmark_concept_cluster.png} +The traits-concept hierarchy for arrangements associated with the landmark +point-location strategy. +\cgalFigureEnd The type of an arrangement associated with the landmark point-location strategy (see Section \ref arr_ssecpl) must be an instance of the -`Arrangement_2` class template, where the `Traits` -parameter is substituted with a model of the concept -`ArrangementLandmarkTraits_2`. (Naturally, it can also model +`Arrangement_on_surface_2` class template, +where the `GeomTraits` parameter is substituted with a model of the +concept `ArrangementLandmarkTraits_2`. (Naturally, it can also model either the `ArrangementXMonotoneTraits_2` concept or the `ArrangementTraits_2` concept.) The `ArrangementLandmarkTraits_2` concept refines the two concepts `ArrangementApproximateTraits_2` and @@ -1810,249 +2430,390 @@ concepts, in turn, refines the concept `ArrangementBasicTraits_2`. A model of the `ArrangementApproximateTraits_2` concept must define a fixed precision number type (typically the double-precision -floating-point `double`) and support the additional below (in addition +floating-point `double`) and support the operation below (in addition to fulfilling the requirements listed by the `ArrangementBasicTraits_2` concept).
    `Approximate_2`: -
    Given a point `p`, approximate the \f$ x\f$ and \f$ y\f$-coordinates of -`p` using the fixed precision number type. We use this operation for -approximate computations---there are certain operations in the search -for the location of the point that need not be exact and we can -perform them faster than other operations. +
    Given a point `p`, approximate the \f$x\f$ and +\f$y\f$-coordinates of `p` using a not necessarily multi-precision +number type. We use this operation for approximate +computations---there are certain operations performed during the +search for the location of the point that need not be exact, and that +can be performed faster when carried out, for example, using a +fixed-precision number type.
    - A model of the `ArrangementConstructXMonotoneCurveTraits_2` concept -support the operation below (in addition to fulfilling the requirements -listed by the `ArrangementBasicTraits_2` concept). +must support the operation below (in addition to fulfilling the +requirements listed by the `ArrangementBasicTraits_2` concept).
    `Construct_x_monotone_curve_2`: -
    Given two points \f$ p_1\f$ and \f$ p_2\f$, this predicate constructs an -\f$ x\f$-monotone curve connecting \f$ p_1\f$ and \f$ p_2\f$. +
    Given two points \f$p_1\f$ and \f$p_2\f$, construct +an \f$x\f$-monotone curve connecting \f$p_1\f$ and \f$p_2\f$.
    -\subsection arr_sssectr_xmon_concept Supporting Intersecting x-Monotone Curves +Most traits classes model the `ArrangementTraits_2` concept, and some +also model the `ArrangementLandmarkTraits_2` concept. + +\subsubsection aos_ssec-traits-curved Unbounded or Curved Surface Concepts + +We descend to the bottom level of the hierarchy. The refinements +described in this section provide the requirements imposed on traits +classes used with arrangements that support unbounded curves and +arrangements embedded on curved surfaces. In particular, these +requirements list additional operations that handle boundary +conditions of curves that either reach the boundary of the parameter +space (the pre-image of their endpoints lie on the boundary) or +approach it (the pre-image of their endpoints approach the +boundary). For each side of the parameter space there are four +available concepts, models of which can be used to handle open, +closed, contracted, and identified side, +respectively. \cgalFootnote{Note that we explicitly distinguish +closed-only, contracted, and identified sides, although the latter two +are closed in \f$\Phi\f$ as well.} Theoretically, this makes for a +total of \f$4^4 = 256\f$ combinations. However, only a subset of them +is meaningful. If a side is identified, the opposite side must also be +identified. In addition, a contracted side must be adjacent to two +identified sides. This narrows down the number of valid combinations +to 35. + +The types `Left_side_category`, `Right_side_category`, +`Bottom_side_category`, and `Top_side_category` nested in every model +of the `ArrangementBasicTraits_2` concept indicate whether the +corresponding boundary side is open, closed, contracted, or +identified, respectively, or whether the type of the boundary side is +irrelevant, as curves inserted into the arrangement are never expected +to reach the boundary side. In particular, these types nested in +models of the concepts `ArrangementOpenLeftTraits_2`, +`ArrangementOpenRightTraits_2`, `ArrangementOpenBottomTraits_2`, and +`ArrangementOpenTopTraits_2`, respectively, must be convertible to +`Arr_open_side_tag`. Similarly, these types must be convertible to +`Arr_closed_side_tag`, `Arr_constracter_side_tag`, or +`Arr_identified_side_tag` when nested in models of the corresponding +concepts. For example, the `Arr_rational_function_traits_2` +traits-model supports unbounded curves; see Section \ref +arr_ssectr_ratfunc. Thus, all four nested types are defined as +`Arr_open_side_tag`. Adversely, all four types nested in the +`Arr_segment_traits_2` traits-model (see Section \ref arr_ssectr_segs) +are defined as `Arr_oblivious_side_tag`, as segments are always +bounded. + +\cgalFigureBegin{aos_fig-open_concept_hierarchy,open_concept_hierarchy.png} +Bottom portion of the refinement hierarchy of the geometry-traits +concepts for curves embedded on an open surface, for instance, the +entire plane. +\cgalFigureEnd + +Several predicates are required to handle \f$x\f$-monotone curves that +approach the boundary of the parameter space. These predicates are +sufficient to handle not only curves embedded in an unbounded +parameter space, but also curves embedded in a bounded parameter space +with open boundaries. The arrangement type instantiated with a traits +class that models the combined concept +`ArrangementOpenBoundaryTraits_2` shown in Figure +\cgalFigureRef{aos_fig-open_concept_hierarchy} can handle curves that +are open in any direction. Recall that an arrangement that supports +unbounded \f$x\f$-monotone curves maintains an implicit bounding +rectangle in the \sc{Dcel} structure; see Section \ref +arr_ssecunb_rep. If some curves inserted into an arrangement object +are expected to be unbounded; namely, there exists \f$d \in \{0,1\}\f$ +such that \f$\lim_{t \rightarrow d}x(t) = \pm\infty\f$ or \f$\lim_{t +\rightarrow d}y(t) = \pm\infty\f$ holds for at least one input curve +\f$C(t) = (x(t),y(t))\f$, the arrangement template must be +instantiated with a model of the `ArrangementOpenBoundaryTraits_2` +concept.\cgalFootnote{A curve that reaches the boundary of the +parameter space in this case is open and unbounded.} + +\cgalFigureBegin{aos_fig-spherical_concept_hierarchy,spherical_concept_hierarchy.png} +Bottom portion of the refinement hierarchy of the geometry-traits +concepts for curves embedded on a spherical-like parameterized surface +\cgalFigureEnd + +A suitable geometry-traits component for arrangements embedded on +surfaces homeomorphic to a sphere is a model of the combined +concept `ArrangementSphericalTraits_2` shown in Figure +\cgalFigureRef{aos_fig-spherical_concept_hierarchy}. + +\cgalFigureBegin{aos_fig-left_side_cluster,left_side_cluster.png} +Top portion of the refinement hierarchy of the geometry-traits +concepts for curves that either reach the left side of the boundary +of the parameter space or approach it. A similar hierarchy also +exists for the left, bottom, and top sides. +\cgalFigureEnd + +The shared requirements for the four options of a side are collected +in abstract layers called `ArrangementLeftSideTraits_2`, +`ArrangementRightSideTraits_2`, `ArrangementBottomSideTraits_2`, and +`ArrangementTopSideTraits_2`; see, e.g., Figure +\cgalFigureRef{aos_fig-left_side_cluster}. + +\cgalFigureBegin{aos_fig-side_clusters,side_clusters.png} +Top portion of the refinement hierarchy of the geometry-traits +concepts for curves that either reach the vertical sides of the +boundary of the parameter space or approach it, and similarly for +curves that either reach or approach horizontal sides. +\cgalFigureEnd + +The shared requirements for the options of opposite sides are +collected in two additional abstract layers called +`ArrangementVerticalSideTraits_2` and `ArrangementHorizontalSideTraits_2`; see +Figure \cgalFigureRef{aos_fig-side_clusters}. + +The abstract concept `ArrangementHorizontalSideTraits_2` requires the +following predicate: -A traits class that models the `ArrangementXMonotoneTraits_2` -concept, which refines the `ArrangementBasicTraits_2` -concept, has to support the following functions:
    -
    `Intersection_2`:
    -Computes all intersection points and overlapping sections of -two given \f$ x\f$-monotone curves. If possible, computes also the -multiplicity of each intersection point.\cgalFootnote{If the two curves intersect at a point \f$ p\f$ but have different tangents, \f$ p\f$ is of multiplicity 1. If the tangents are also equal but the their curvatures are not the same, \f$ p\f$ is of multiplicity 2, etc.} -Knowing the multiplicity of an intersection point is not required, -but it can speed up the arrangement construction. -
    `Split_2`:
    Splits an \f$ x\f$-monotone curve \f$ c\f$ into two subcurves -at a point \f$ p\f$ lying in the interior of \f$ c\f$. -
    `Are_mergeable_2`:
    Given two \f$ x\f$-monotone curve \f$ c_1\f$ and -\f$ c_2\f$ that share a common endpoint, this predicate determines -whether \f$ c_1\f$ and \f$ c_2\f$ are mergeable, that is, whether they -can be merged to form a single continuous \f$ x\f$-monotone curve of the -type supported by the traits class. -
    `Merge_2`:
    Merges two mergeable \f$ x\f$-monotone curves. + +
    `Parameter_space_in_x_2`: + +
    This predicate is overloaded with two versions. We distinguish +between identified and non-identified sides as explained below. + +(i) Given a curve \f$C = (x(t), y(t))\f$ and an enumerator that +specify either the minimum end or the maximum end of the curve, and +thus map to a parameter value \f$d \in \{0,1\}\f$, determine the +location of the \f$d\f$-end of \f$C\f$ with respect to the +\f$x\f$-axis. More precisely, if \f$C\f$ is open at its \f$d\f$-end +end, determine whether \f$\lim_{t \rightarrow d} x(t)\f$ is equal to +\f$x_{\rm min}\f$, equal to \f$x_{\rm max}\f$, or falls in between. If +\f$C\f$ is not open at its \f$d\f$-end end, determine whether +\f$x(d)\f$ is equal to \f$x_{\rm min}\f$, equal to \f$x_{\rm max}\f$, +or falls in between. + +(ii) Given a point \f$p\f$, determine the location of the point with +respect to the \f$x\f$-axis. More precisely, determine whether +\f$x_p\f$ is equal to \f$x_{\rm min}\f$, equal to \f$x_{\rm max}\f$, +or falls in between. If \f$p\f$ is on a vertical boundary; that is, +\f$x_p \in \{x_{\rm min},x_{\rm max}\}\f$, then the boundary side +containing \f$p\f$ cannot be open and must not be identified. In other +words, this overloaded version is required only for the concepts +`ArrangementClosedLeftTraits_2`, `ArrangementClosedRightTraits_2`, +`ArrangementContractedLeftTraits_2` and +`ArrangementContractedRightTraits_2` concepts. +
    -Using a model of the `ArrangementXMonotoneTraits_2`, it is -possible to construct arrangements of sets of \f$ x\f$-monotone curves -(and points) that may intersect one another. -\subsection arr_sssectr_full_concept Supporting Arbitrary Curves - -The concept `ArrangementTraits_2` refines the -`ArrangementXMonotoneTraits_2` concept by adding the notion -of a general, not necessarily \f$ x\f$-monotone (and not necessarily -continuous) curve. A model of this concept must define the -`Curve_2` type and support the subdivision of a curve into a -set of continuous \f$ x\f$-monotone curves and isolated points using -the predicate `Make_x_monotone_2`. For example, the curve -\f$ C:\ (x^2 + y^2)(x^2 + y^2 - 1) = 0\f$ is the unit circle (the loci -of all points for which \f$ x^2 + y^2 = 1\f$) with the origin \f$ (0,0)\f$ -as a singular point in its interior. \f$ C\f$ should therefore be -divided into two circular arcs (the upper part and the lower part -of the unit circle) and a single isolated point. - -Note that the refined model `ArrangementTraits_2` is required -only when using the free `insert()` functions (see -Section \ref arr_secgl_funcs), which accept a `Curve_2` object -in the incremental version, or a range of `Curve_2` objects in the -aggregated version. In all other cases it is sufficient to use a model -of the `ArrangementXMonotoneTraits_2` concept. - -\subsection Arrangement_on_surface_2SupportingUnbounded Supporting Unbounded Curves - -An arrangement that supports unbounded \f$ x\f$-monotone curves maintains -an implicit bounding rectangle in the \sc{Dcel} structure; see -Section \ref arr_ssecunb_rep. The unbounded ends of vertical rays, -vertical lines, and curves with vertical asymptotes are represented -by vertices that lie on the bottom or top sides of this bounding -rectangle. These vertices are not associated with points, but are -associated with (finite) \f$ x\f$-coordinates. The unbounded ends of all -other curves are represented by vertices that lie on the left or -right sides of this bounding rectangle. These vertices are not -associated with points either. Edges connect these vertices and the -four vertices that represents the corners of this bounding rectangle -to form the rectangle. - -Several predicates are required to handle \f$ x\f$-monotone curves that -approach infinity and thus approach the boundary of the parameter -space. These predicates are sufficient to handle not only curves -embedded in an unbounded parameter space, but also curves embedded -in a bounded parameter space with open boundaries. Let \f$ b_l\f$ and -\f$ b_r\f$ denote the \f$ x\f$-coordinates of the left and right boundaries of -the parameter space, respectively. Let \f$ b_b\f$ and \f$ b_t\f$ denote the -\f$ y\f$-coordinates of the bottom and top boundaries of the parameter -space, respectively. Recall that currently the general code of the -arrangement only supports the case where the parameter space is the -entire compactified plane, thus \f$ b_l = b_b = -\infty\f$ and -\f$ b_r = b_t = +\infty\f$. Nonetheless, when the parameter space is -bounded, it is the exact geometric embedding of the implicit bounding -rectangle. In the following we assume that an \f$ x\f$ monotone -curve \f$ C\f$ can be considered as a parametric curve \f$ C(t) = (X(t),Y(t))\f$ -defined over a closed, open, or half open interval with endpoints \f$ 0\f$ -and \f$ 1\f$. - -Models of the concept `ArrangementOpenBoundaryTraits_2` handle -curves that approach the boundary of the parameter space. This concept -refines the concept `ArrangementBasicTraits_2`. The arrangement -template instantiated with a traits class that models this concept -can handle curves that are unbounded in any direction. If some curves -inserted into an arrangement object are expected to be unbounded, namely, -there exists \f$ d \in \{0,1\}\f$ such that -\f$ \lim_{t \rightarrow d}X(t) = \pm\infty\f$ or -\f$ \lim_{t \rightarrow d}y(t) = \pm\infty\f$ -holds for at least one input curve \f$ C(t) = (X(t),Y(t))\f$, the arrangement -template must be instantiated with a model of the -`ArrangementOpenBoundaryTraits` concept.\cgalFootnote{We intend to enhance the arrangement template to handle curves confined to a bounded yet open parameter space. A curve that reaches the boundary of the parameter space in this case is bounded and open.} - -All the four types `Left_side_category`, -`Right_side_category`, `Bottom_side_category`, and -`Top_side_category` nested in a model of the concept -`ArrangementOpenBoundaryTraits` must be convertible to -`Arr_open_side_tag`.\cgalFootnote{The tags `Arr_oblivious_side_tag` and `Arr_open_side_tag` are only two out of a larger number of options for the side categories included in major extension the code is going through.} -For example, the `Arr_rational_function_traits_2` traits-model supports -unbounded curves; see Section \ref arr_ssectr_ratfunc. Thus, all -four nested types are defined as `Arr_open_side_tag`. -Adversely, all four types nested in the `Arr_segment_traits_2` -traits-model (see Section \ref arr_ssectr_segs) are defined as -`Arr_oblivious_side_tag`, as segments are always -bounded.\cgalFootnote{We intend to introduce more concepts that require only a subset of the categories to be convertible to `Arr_open_side_tag`.} - -A model of the concept `ArrangementOpenBoundaryTraits_2` must provide -the additional predicates listed below. -\f$ x\f$-coordinates and \f$ y\f$-coordinates are differently handled. This -asymmetry is brought on by the various algorithms applied to -arrangements, the input and output arguments of which are \f$ x\f$-monotone -curves. Indeed, all curves maintained by any arrangement are -continuous weakly \f$ x\f$-monotone curves. A non \f$ x\f$-monotone curve is -divided into \f$ x\f$-monotone sub curves (and perhaps points) before it -is inserted into an arrangement. This asymmetry is also reflected in -the additional predicates listed below. +The abstract concept `ArrangementVerticalSideTraits_2` requires the +following predicate:
    -
    `Parameter_space_in_x_2`:
    -Given a parametric \f$ x\f$-monotone curve \f$ C(t) = (X(t),Y(t))\f$ and an -enumerator that specifies either the minimum end or the maximum end -of the curve, and thus maps to a parameter value \f$ d \in \{0,1\}\f$, -this predicate determines the location of the curve end along the -\f$ x\f$-dimension. Formally, the predicate determines whether -\f$ \lim_{t \rightarrow d} X(t)\f$ evaluates to \f$ b_l\f$, \f$ b_r\f$, or a value -in between. -
    `Compare_y_near_boundary_2`:
    -Given two \f$ x\f$-monotone curves \f$ C_1\f$ and \f$ C_2\f$ and an enumerator \f$ i\f$ -that specifies either the minimum ends or the maximum ends of the -two curves, this predicate compares the \f$ y\f$-coordinates of the -curves near their respective ends. That is, the predicate compares -the \f$ y\f$-coordinates of the vertical projection of a point \f$ p\f$ onto -\f$ C_1\f$ and onto \f$ C_2\f$. If the enumerator \f$ i\f$ specifies the minimum -ends, the curves must approach the left boundary-side. In this case -\f$ p\f$ is located far to the left, such that the result is invariant -under a translation of \f$ p\f$ farther to the left. If \f$ i\f$ specifies the -maximum ends, the curves must approach the right boundary-side. In -that case \f$ p\f$ is located far to the right in a similar manner. -
    `Parameter_space_in_y_2`:
    -Given a parametric \f$ x\f$-monotone curve \f$ C(t) = (X(t),Y(t))\f$ and an -enumerator that specifies either the minimum end or the maximum end -of the curve, and thus maps to a parameter value \f$ d \in \{0,1\}\f$, -this predicate determines the location of the curve end along the -\f$ y\f$-dimension. Formally, the predicate determines whether -\f$ \lim_{t \rightarrow d} Y(t)\f$ evaluates to \f$ b_b\f$, \f$ b_t\f$, or a value -in between. -
    `Compare_x_at_limit_2`:
    -Two versions of this predicate are provided: -(i) Given a point \f$ p\f$, a parametric \f$ x\f$-monotone curve -\f$ C(t) = (X(t),Y(t))\f$, and an enumerator that specifies either the -minimum end or the maximum end of the curve, and thus maps to a -parameter value \f$ d \in \{0,1\}\f$, this predicate compares the -\f$ x\f$-coordinate of \f$ p\f$ and \f$ \lim_{t \rightarrow d} X(t)\f$. If the -parameter space is unbounded, a precondition assures that \f$ C\f$ -has a vertical asymptote at its \f$ d\f$-end; that is -\f$ \lim_{t \rightarrow d} X(t)\f$ is finite. -(ii) Given two parametric \f$ x\f$-monotone curves -\f$ C_1(t) = (X_1(t),Y_1(t))\f$ and \f$ C_2(t) = (X_2(t),Y_2(t))\f$ and two -enumerators that specify either the minimum end or the maximum -end of each curve, and thus map to parameter values -\f$ d_1\in \{0,1\}\f$ and \f$ d_2 \in \{0,1\}\f$ for \f$ C_1\f$ and for \f$ C_2\f$, -respectively, this predicate compares -\f$ \lim_{t \rightarrow d_1} X_1(t)\f$ and \f$ \lim_{t \rightarrow d_2} X_2(t)\f$. -If the parameter space is unbounded, a precondition assures that -\f$ C_1\f$ and \f$ C_2\f$ have vertical asymptote at their respective ends; -that is \f$ \lim_{t \rightarrow d_1} X_1(t)\f$ and -\f$ \lim_{t \rightarrow d_2} X_2(t)\f$ are finite. -
    `Compare_x_near_limit_2`:
    -Given two \f$ x\f$-monotone curves \f$ C_1\f$ and \f$ C_2\f$ and an enumerator \f$ i\f$ -that specifies either the minimum ends or the maximum ends of the -two curves, this predicate compares the \f$ x\f$-coordinates of the -curves near their respective ends. That is, the predicate compares -the \f$ x\f$-coordinates of the horizontal projection of a point \f$ p\f$ -onto \f$ C_1\f$ and onto \f$ C_2\f$. If the parameter space is unbounded, a -precondition assures that \f$ C_1\f$ and \f$ C_2\f$ have vertical asymptote -at their respective ends. Furthermore, both curves approach the -same boundary-side, either the bottom or the top, at their + +
    `Parameter_space_in_y_2`: + +
    This predicate is overloaded with two versions. We distinguish +between identified and non-identified sides as explained below. + +(i) Given a curve \f$C\f$ and an enumerator that specify either the +minimum end or the maximum end of the curve, and thus map to a +parameter value \f$d \in \{0,1\}\f$, determine the location of the +\f$d\f$-end of \f$C\f$ with respect to the \f$y\f$-axis. More +precisely, if \f$C\f$ is open at its \f$d\f$-end end, determine +whether \f$\lim_{t \rightarrow d} y(t)\f$ is equal to \f$y_{\rm +min}\f$, equal to \f$y_{\rm max}\f$, or falls in between. If \f$C\f$ +is not open at its \f$d\f$-end end, determine whether \f$y(d)\f$ is +equal to \f$y_{\rm min}\f$, equal to \f$y_{\rm max}\f$, or falls in +between. + +(ii) Given a point \f$p\f$, determine the location of the point with +respect to the \f$y\f$-axis. More precisely, determine whether +\f$y_p\f$ is equal to \f$y_{\rm min}\f$, equal to \f$y_{\rm max}\f$, +or falls in between. If \f$p\f$ is on a horizontal boundary; that is, +\f$y_p \in \{y_{\rm min},y_{\rm max}\}\f$, then the boundary side +containing \f$p\f$ cannot be open and must not be identified. In other +words, this overloaded version is required only for the concepts +`ArrangementClosedBottomTraits_2`, `ArrangementClosedTopTraits_2`, +`ArrangementContractedBottomTraits_2` and +`ArrangementContractedTopTraits_2` concepts. + +
    + +The two symmetric predicates above determine the location of a +curve-end in the parameter space. However, in general, +\f$x\f$-coordinates and \f$y\f$-coordinates are differently +handled. This asymmetry is brought on by the various algorithms +applied to arrangements, the input and output arguments of which are +\f$x\f$-monotone curves. Indeed, all curves maintained by any +arrangement are continuous weakly \f$x\f$-monotone curves. A non +\f$x\f$-monotone curve is divided into \f$x\f$-monotone sub curves +(and perhaps points) before it is inserted into an arrangement. This +asymmetry is also reflected in the predicates listed below. They help +determining the order of curve-ends lying on the boundary of the +parameter space with respect to regular points and among each other. + +The concept `ArrangementHorizontalSideTraits_2` requires two additional +predicates: + +
    +
    `Compare_x_on_boundary_2`: + +
    This predicate is overloaded with three versions. +We distinguish between open and non-open sides as explained below. + +(i) Given a regular point \f$p\f$, an \f$x\f$-monotone curve \f$C = +(x(t),y(t))\f$, and an enumerator that specifies either the minimum +end or the maximum end of the curve, and thus maps to a parameter +value \f$d \in \{0,1\}\f$, compare the \f$x\f$-coordinate of \f$p\f$ +and the \f$x\f$-coordinate of \f$C\f$ at its respective limit or end +depending on whether it is open or non-open. More precisely, if +\f$C\f$ is open at its \f$d\f$-end end, compare the values \f$x_p\f$ +and \f$\lim_{t \rightarrow d} x(t)\f$. A precondition assures that +\f$C\f$ has a vertical asymptote at its \f$d\f$-end; that is +\f$\lim_{t \rightarrow d} x(t)\f$ is a real value. If \f$C\f$ is not +open, compare the values \f$x_p\f$ and \f$x(d)\f$. + +(ii) Given two curves \f$C_1 = (x_1(t),y_1(t))\f$ and \f$C_2 = +(x_2(t),x_2(t))\f$ and enumerators that specify either the minimum end +or the maximum end of each curve, and thus map to parameter values +\f$d_1, d_2 \in \{0,1\}\f$, compare the \f$x\f$-coordinates of the +curves at their respective limits or ends. More precisely, if +\f$C_1\f$ (resp. \f$C_2\f$) is open at its \f$d_1\f$-end +(resp. \f$d_2\f$-end), use the value \f$\lim_{t \rightarrow d_1} +x_1(t)\f$ (resp. \f$\lim_{t \rightarrow d_2} x_2(t)\f$) for the +comparison. A precondition assures that \f$C_1\f$ (resp. \f$C_2\f$) +has a vertical asymptote at its \f$d_1\f$-end (resp. \f$d_2\f$-end); +that is \f$\lim_{t \rightarrow d_1} x_1(t)\f$ is (resp. \f$\lim_{t +\rightarrow d_2} x_2(t)\f$) a real value. If \f$C_1\f$ +(resp. \f$C_2\f$) is not open at its \f$d_1\f$-end +(resp. \f$d_2\f$-end), use the value \f$x_1(d_1)\f$ +(resp. \f$x_2(d_2)\f$) for the comparison. + +(iii) Given two points \f$p_1\f$ and \f$p_2\f$, such that at least one +of them lies on a horizontal boundary side, compare the +\f$x\f$-coordinates of the points. That is, compare \f$x_{p_1}\f$ and +\f$x_{p_2}\f$. If \f$p_1\f$ (resp. \f$p_2\f$) is on the boundary; that +is, \f$y_{p_1} \in \{y_{\rm min},y_{\rm max}\}\f$ (resp. \f$y_{p_2} +\in \{y_{\rm min},y_{\rm max}\}\f$), then the boundary side containing +\f$p_1\f$ (resp. \f$p_2\f$) must be either closed or identified. In +other words, this overloaded version is required only for the concepts +`ArrangementClosedBottomTraits_2`, `ArrangementClosedTopTraits_2`, +`ArrangementIdentifiedBottomTraits_2` and +`ArrangementIdentifiedTopTraits_2` concepts. + +
    `Compare_x_near_boundary_2`: + +
    Given two \f$x\f$-monotone curves \f$C_1\f$ and \f$C_2\f$ and an +enumerator \f$i\f$ that specifies either the minimum ends or the +maximum ends of the two curves, and thus map to parameter values +\f$d_1, d_2 \in \{0,1\}\f$, respectively, compare the +\f$x\f$-coordinate of the curves near their respective limits or +ends. That is, compare the \f$x\f$-coordinates of the horizontal +projection of a point \f$p\f$ onto \f$C_1\f$ and onto \f$C_2\f$. A +precondition assures that \f$C_1\f$ and \f$C_2\f$ have vertical +asymptotes at their respective ends. Furthermore, both curves approach +the same boundary-side, either the bottom or the top, at their respective ends. If both curves approach the bottom boundary-side, -\f$ p\f$ is located far to the bottom, such that the result is invariant -under a translation of \f$ p\f$ farther to the bottom. If both curves -approach the top boundary-side, \f$ p\f$ is located far to the top in a -similar manner. Another precondition assures that the -\f$ x\f$-coordinates of the limits of the curves at their respective -ends are equal. That is, the predicate `Compare_x_at_limit_2` -applied to \f$ C_1\f$, \f$ C_2\f$, and \f$ i\f$ evaluates to `EQUAL`. +\f$p\f$ is located far to the bottom, such that the result is +invariant under a translation of \f$p\f$ farther to the bottom. If +both curves approach the top boundary-side, \f$p\f$ is located far to +the top in a similar manner. Another precondition assures that the +\f$x\f$-coordinates of the limits of the curves at their respective +ends are equal. That is, the predicate `Compare_x_on_boundary_2` +applied to \f$C_1\f$, \f$C_2\f$, and \f$i\f$ evaluates to `EQUAL`.
    -In the rest of this section we review the traits classes -included in the public distribution of \cgal, that handle line -segments, polylines, conic arcs, rational functions, and arcs of -Bézier and algebraic curves. -The last subsection overviews -decorators for geometric traits classes distributed with \cgal, -which extend other geometric traits-class by attaching auxiliary -data with the geometric objects. +The concept `ArrangementVerticalSideTraits_2` requires two +additional predicates: -\subsection arr_ssectr_segs Traits Classes for Line Segments and Linear Objects +
    +
    `Compare_y_on_boundary_2`: -The `Arr_segment_traits_2` class used so far in most -example programs in this chapter is a model of the concepts -`ArrangementTraits_2`, `ArrangementLandmarkTraits_2`, -and `ArrangementDirectionalXMonotoneTraits_2`; the later -enables Boolean set operations. It is parameterized by a -geometric kernel and uses the `Kernel::Point_2` type as it -point type. However, neither the `Curve_2` nor the -`X_monotone_curve_2` types are identical to the -`Kernel::Segment_2` type. A kernel segment is typically -represented by its two endpoints, and these may have a large bit-size -representation, if the segment is intersected and split several -times (in comparison with the representation of its original -endpoints). The large representation may significantly slow down the -various traits-class operations involving such a segment. In contrast, -the `Arr_segment_traits_2` represents a segment using -its supporting line and the two endpoints, such that most computations -are performed on the supporting line, which never changes as the -segment is split. It also caches some additional information with -the segment to speed up various predicates. -An `X_monotone_curve_2` object can still be constructed from two -endpoints or from a kernel segment. Moreover, an +
    Given two points \f$p_1\f$ and \f$p_2\f$, such that at least one +of them lies on a vertical boundary side, compare the +\f$y\f$-coordinates of the points. That is, compare \f$y_{p_1}\f$ and +\f$y_{p_2}\f$. If \f$p_1\f$ (resp. \f$p_2\f$) is on the boundary; that +is, \f$x_{p_1} \in \{x_{\rm min},x_{\rm max}\}\f$ (resp. \f$x_{p_2} +\in \{x_{\rm min},x_{\rm max}\}\f$), then the vertical boundary side +containing \f$p_1\f$ (resp. \f$p_2\f$) must be either closed or +identified. In other words, this overloaded version is required only +for the concepts `ArrangementClosedLeftTraits_2`, +`ArrangementClosedRightTraits_2`, `ArrangementIdentifiedLeftTraits_2` +and `ArrangementIdentifiedRightTraits_2` concepts. + +
    `Compare_y_near_boundary_2`: + +
    Given two \f$x\f$-monotone curves \f$C_1\f$ and \f$C_2\f$, and an +enumerator \f$i\f$ that specifies either the minimum ends or the +maximum ends of the two curves, and thus maps to parameter values \f$d +\in \{0,1\}\f$, compare the \f$y\f$-coordinates of the curves near +their respective ends. More precisely, compares the +\f$y\f$-coordinates of the vertical projection of a point \f$p\f$ onto +\f$C_1\f$ and onto \f$C_2\f$. If the enumerator \f$i\f$ specifies the +minimum ends, the curves must approach the left boundary-side. In this +case \f$p\f$ is located far to the left, such that the result is +invariant under a translation of \f$p\f$ farther to the left. If +\f$i\f$ specifies the maximum ends, the curves must approach the right +boundary-side. In that case \f$p\f$ is located far to the right in a +similar manner.
    + +The concepts `ArrangementIdentifiedLeftTraits_2` and +`ArrangementIdentifiedRightTraits_2` introduces the following requirement: + +
    +
    `Is_on_y_identification_2`: + +
    This predicate is overloaded with two versions. + +(i) Given a point \f$p\f$, determine whether \f$p\f$ lies in the image +of the vertical and identified sides of the boundary. More precisely, +determine whether \f$x_p \in \{x_{\rm min},x_{\rm max}\}\f$ for all +pre-images of \f$p\f$. + +(ii) Given a curve \f$C\f$, determine whether the entire curve \f$C\f$ +lies in the image of the vertical and identified sides of the +boundary. +
    + +Similarly, the concepts `ArrangementIdentifiedBottomTraits_2` and +`ArrangementIdentifiedTopTraits_2` introduces the following requirement: +
    +
    `Is_on_x_identification_2`: + +
    This predicate is overloaded with two versions. + +(i) Given a point \f$p\f$, determine whether \f$p\f$ lies in the image +of the horizontal and identified sides of the boundary. More precisely, +determine whether \f$y_p \in \{y_{\rm min},y_{\rm max}\}\f$ for all +pre-images of \f$p\f$. + +(ii) Given a curve \f$C\f$, determine whether the entire curve \f$C\f$ +lies in the image of the horizontal and identified sides of the +boundary. + +
    + +\subsection aos_ssec-geom_traits-models Models of the Geometry Traits Concepts + +In this section we review the traits classes included in the public +distribution of \cgal, that handle line segments, polylines, conic +arcs, rational functions, and arcs of Bézier and algebraic +curves. The last subsection overviews decorators for geometric traits +classes distributed with \cgal, which extend other geometric +traits-class by attaching auxiliary data with the geometric objects. + +\subsubsection arr_ssectr_segs Traits Classes for Line Segments and Linear Objects + +The `Arr_segment_traits_2` class used so far in most example +programs in this chapter is a model of the concepts +`ArrangementTraits_2`, `ArrangementLandmarkTraits_2`, and +`ArrangementDirectionalXMonotoneTraits_2`; the later enables Boolean +set operations. It is parameterized by a geometric kernel and uses the +`Kernel::Point_2` type as it point type. However, neither the +`Curve_2` nor the `X_monotone_curve_2` types are identical to the +`Kernel::Segment_2` type. A kernel segment is typically represented by +its two endpoints, and these may have a large bit-size representation, +if the segment is intersected and split several times (in comparison +with the representation of its original endpoints). The large +representation may significantly slow down the various traits-class +operations involving such a segment. In contrast, the +`Arr_segment_traits_2` represents a segment using its supporting line +and the two endpoints, such that most computations are performed on +the supporting line, which never changes as the segment is split. It +also caches some additional information with the segment to speed up +various predicates. An `X_monotone_curve_2` object can still be +constructed from two endpoints or from a kernel segment. Moreover, an `X_monotone_curve_2` instance can also be casted or assigned to a -`Kernel::Segment_2` object. The two types are thus fully -convertible to one another. +`Kernel::Segment_2` object. The two types are thus fully convertible +to one another. The `Arr_segment_traits_2` class is very efficient for maintaining arrangements of a large number of intersecting line @@ -2067,62 +2828,61 @@ defines a type named `Number_type` as either `Gmpq` or `Quotient`, depending on whether Gmp is installed or not.} -An instance of the `Arr_segment_traits_2` class -template can be very efficient for constructing arrangements induced -by line segments with a large number of intersections. Efficiency is -affected by the substituted geometric kernel. Using -`Cartesian` as the kernel type is in general not a -bad choice; the coordinates of the segment endpoints are represented -as multi-precision rational-numbers, and this ensures the correctness -of all computations regardless of the input. Computations on -multi-precision number types, such as `Gmpq`, typically -take longer than computations on machine-precision +An instance of the `Arr_segment_traits_2` class template can +be very efficient for constructing arrangements induced by line +segments with a large number of intersections. Efficiency is affected +by the substituted geometric kernel. Using `Cartesian` as the +kernel type is in general not a bad choice; the coordinates of the +segment endpoints are represented as multi-precision rational-numbers, +and this ensures the correctness of all computations regardless of the +input. Computations on multi-precision number types, such as `Gmpq`, +typically take longer than computations on machine-precision floating-point. However, in almost all cases it is possible to -expedite the computation using numerical filtering; see -`Kernel_2` and `Kernel_3`. If the input set of line segments do -not have degeneracies; namely, no two segments in the set share a -common endpoint, and no three segments intersect at a common point, or -at least, degeneracies exist but their number is relatively small, -then filtered computation incurs only negligible overhead compared to +expedite the computation using numerical filtering; see `Kernel_2` and +`Kernel_3`. If the input set of line segments do not have +degeneracies; namely, no two segments in the set share a common +endpoint, and no three segments intersect at a common point, or at +least, degeneracies exist but their number is relatively small, then +filtered computation incurs only negligible overhead compared to floating-point arithmetic, which is error-prone. Indeed, in almost all examples and applications given in this manual, a predefined filtered kernel is used to instantiate the line-segment traits class, namely -`Exact_predicates_exact_constructions_kernel`. Furthermore, this kernel -is used as a default kernel in case the user did not provide one. +`Exact_predicates_exact_constructions_kernel`. Furthermore, this +kernel is used as a default kernel in case the user did not provide +one. \cgalFigureBegin{arr_figpredef_kernels,fan_grids.png,Europe.png} -(a) An arrangement of \f$ 104\f$ line segments from the input file `fan_grids.dat`. (b) An arrangement of more than \f$ 3000\f$ interior disjoint line segments, defined in the input file `Europe.dat`. +(a) An arrangement of \f$104\f$ line segments from the input file `fan_grids.dat`. (b) An arrangement of more than \f$3000\f$ interior disjoint line segments, defined in the input file `Europe.dat`. \cgalFigureEnd In the following example we use the predefined `Exact_predicates_exact_constructions_kernel` for instantiating our -segment-traits class. This kernel use interval arithmetic to filter the -exact computations. The program reads a set of line segments with integer -coordinates from a file and computes their arrangement. By default it -opens the `fan_grids.dat` input-file, located in the examples folder, -which contains \f$ 104\f$ line segments that form four "fan-like" grids and -induce a dense arrangement, as illustrated in -\cgalFigureRef{arr_figpredef_kernels} (a): +segment-traits class. This kernel use interval arithmetic to filter +the exact computations. The program reads a set of line segments with +integer coordinates from a file and computes their arrangement. By +default it opens the `fan_grids.dat` input-file, located in the +examples folder, which contains \f$104\f$ line segments that form +four "fan-like" grids and induce a dense arrangement, as illustrated +in \cgalFigureRef{arr_figpredef_kernels} (a): \cgalExample{Arrangement_on_surface_2/predefined_kernel.cpp} The arrangement package also offers a simpler alternative segment-traits class. The traits class -`Arr_non_caching_segment_basic_traits_2` models -the `ArrangementBasicTraits_2` concept. It uses -`Kernel::Point_2` as its point type and -`Kernel::Segment_2` as its \f$ x\f$-monotone curve type. As this -traits class does not support intersecting and splitting segments, -the kernel representation is sufficient. It is still less -efficient than `Arr_segment_traits_2` for constructing -arrangements of pairwise disjoint line segments in many cases, as -it performs no caching at all, but using this traits class may be -preferable as it reduces the memory consumption a bit, since no extra -data is stored with the line segments. +`Arr_non_caching_segment_basic_traits_2` models the +`ArrangementBasicTraits_2` concept. It uses `Kernel::Point_2` as its +point type and `Kernel::Segment_2` as its \f$x\f$-monotone curve +type. As this traits class does not support intersecting and splitting +segments, the kernel representation is sufficient. It is still less +efficient than `Arr_segment_traits_2` for constructing arrangements of +pairwise disjoint line segments in many cases, as it performs no +caching at all, but using this traits class may be preferable as it +reduces the memory consumption a bit, since no extra data is stored +with the line segments. -The class `Arr_non_caching_segment_traits_2` inherits -from `Arr_non_caching_segment_basic_traits_2` and -extends it to be a model of the concepts `ArrangementTraits_2`, +The class `Arr_non_caching_segment_traits_2` inherits from +`Arr_non_caching_segment_basic_traits_2` and extends it to be +a model of the concepts `ArrangementTraits_2`, `ArrangementLandmarkTraits_2`,and `ArrangementDirectionalXMonotoneTraits_2`. It may thus be used to construct arrangement of intersecting line segments, but as explained @@ -2135,28 +2895,28 @@ line segments that are pairwise disjoint in their interior. As the segments do not intersect, no new points are constructed and we can instantiate the `Arr_non_caching_segment_traits_basic_2` class-template with the predefined -`Exact_predicates_inexact_constructions_kernel`. Note that we use -the `insert_non_intersecting_curves()` function to construct the -arrangement. -By default, the example opens the `Europe.dat` input-file, -located in the examples folder, which contains more than \f$ 3000\f$ line segments -with floating-point coordinates that form the map of Europe, as depicted in +`Exact_predicates_inexact_constructions_kernel`. Note that we use the +`insert_non_intersecting_curves()` function to construct the +arrangement. By default, the example opens the `Europe.dat` +input-file, located in the examples folder, which contains more than +\f$3000\f$ line segments with floating-point coordinates that form +the map of Europe, as depicted in \cgalFigureRef{arr_figpredef_kernels} (b): \cgalExample{Arrangement_on_surface_2/predefined_kernel_non_intersecting.cpp} The `Arr_linear_traits_2` class used for demonstrating the -construction of arrangements of unbounded curves is capable of handling -bounded and unbounded linear objects, namely lines, rays and line -segments. It is parameterized by a geometric kernel and such that +construction of arrangements of unbounded curves is capable of +handling bounded and unbounded linear objects, namely lines, rays and +line segments. It is parameterized by a geometric kernel and such that its nested `Point_2` type is the same as the kernel point. The -`Curve_2` (and `X_monotone_curve_2`) type it defines is -constructible from a `Kernel::Line_2`, a `Kernel::Ray_2` or -from a `Kernel::Segment_2` object. Just like the default -segment-traits class, the linear-traits class also use caching -techniques to speed up its predicates and constructions. +`Curve_2` (and `X_monotone_curve_2`) type it defines is constructible +from a `Kernel::Line_2`, a `Kernel::Ray_2` or from a +`Kernel::Segment_2` object. Just like the default segment-traits +class, the linear-traits class also use caching techniques to speed up +its predicates and constructions. -\subsection arr_ssectr_polylines The Polyline and Polycurve Traits Classes +\subsubsection arr_ssectr_polylines The Polyline and Polycurve Traits Classes Polylines are continuous piecewise linear curves. Polylines are of particular interest, as they can be used to approximate more complex @@ -2177,20 +2937,20 @@ geometry-traits class that models the following concepts: - `ArrangementConstructXMonotoneCurveTraits_2`. We refer to the type that substitutes the template parameter -`SubcurveTraits_2` as the subcurve traits hereafter. -If, in addition, the subcurve traits also models the concept +`SubcurveTraits_2` as the subcurve traits hereafter. If, in +addition, the subcurve traits also models the concept `ArrangementApproximateTraits_2` then the instantiated `Arr_polyline_traits_2` type models the concept `ArrangementApproximateTraits_2` as well. (By definition, modeling the concepts `ArrangementApproximateTraits_2` and `ArrangementConstructXMonotoneCurveTraits_2` implies modeling the concept `ArrangementLandmarkTraits_2`.) The same holds for the -`ArrangementOpenBoundaryTraits_2` concept as well. -Modeling the `ArrangementConstructXMonotoneCurveTraits_2` concept -implies that the subcurve traits must support the construction of a -unique (\f$x\f$-monotone) segment given two input points. Roughly -speaking, it means that each operation defined by the subcurve traits -must handle linear curves. +`ArrangementOpenBoundaryTraits_2` concept as well. Modeling the +`ArrangementConstructXMonotoneCurveTraits_2` concept implies that the +subcurve traits must support the construction of a unique +(\f$x\f$-monotone) segment given two input points. Roughly speaking, +it means that each operation defined by the subcurve traits must +handle linear curves. An instance of the polyline traits class-template inherits its nested point type, i.e., `Point_2`, from the subcurve traits, and defines the @@ -2237,23 +2997,21 @@ can be represented by one of the following two \image latex well-oriented-polyline.pdf Also, note, that a single polyline can be split into several -\f$ x\f$-monotone polylines, and that the number of intersection +\f$x\f$-monotone polylines, and that the number of intersection points (or overlapping sections) between two polylines can also be large. \cgalAdvancedBegin - Technically speaking, it is possible to construct a general polyline that is neither well-oriented nor continuous. However, it is impossible to use such polylines for the purpose of computing an arrangement. - \cgalAdvancedEnd You can traverse over the range of defining segments of a given polyline. The \a first and \a past-the-end iterators can be obtained through the access functions of the polyline `begin_segments()` and -`end_segments()`, respectively. The vertices of an \f$ x\f$-monotone +`end_segments()`, respectively. The vertices of an \f$x\f$-monotone curve are always stored in a strongly monotonic lexicographical order. In other words, \f$x\f$-monotone polylines can be directed \a either left-to-right \a or right-to-left. If the macro @@ -2282,15 +3040,15 @@ data objects with the different segments that compose a polyline. \cgalFigureBegin{arr_figex_12,ex_12.png} An arrangement of three polylines, as constructed in `polylines.cpp`. Disks mark vertices associated with polyline endpoints, while circles mark vertices that -correspond to intersection points. Note that \f$ \pi_2\f$ is split -into three \f$ x\f$-monotone polylines, and that \f$ \pi_1\f$ and \f$ -\pi_3\f$ have two overlapping sections. \cgalFigureEnd +correspond to intersection points. Note that \f$\pi_2\f$ is split into +three \f$ x\f$-monotone polylines, and that \f$\pi_1\f$ and +\f$\pi_3\f$ have two overlapping sections. \cgalFigureEnd The following example program constructs an arrangement of three polylines, as depicted in \cgalFigureRef{arr_figex_12}. Note that most points defining the polylines are not associated with arrangement vertices. The arrangement vertices are either the endpoints of -each \f$ x\f$-monotone polyline or the intersection points between two +each \f$x\f$-monotone polyline or the intersection points between two polylines: \cgalExample{Arrangement_on_surface_2/polylines.cpp} @@ -2311,90 +3069,101 @@ it does not support the operations that (i) construct a polycurve from a sequence of point, and (ii) push a point at the back or at the front of a non-empty polycurve. -\subsection arr_ssectr_circ_seg A Traits Class for Circular Arcs and Line Segments +\subsubsection arr_ssectr_circ_seg A Traits Class for Circular Arcs and Line Segments Circles and circular arcs are the simplest form of non-linear curves. We handle circles whose centers have rational coordinates and whose -squared radii is also rational. If we denote the circle center by \f$ (x_0,y_0)\f$ -and its radius by \f$ r\f$, then the equation of the circle - that is, -\f$ (x - x_0)^2 + (y - y_0)^2 = r^2\f$ - has rational coefficients. -The intersection points of two such circles are therefore solutions -of a quadratic equation with rational coefficients, or algebraic numbers -of degree \f$ 2\f$. The same applies for intersection points between such a -rational circle and a line, or a line segment, with rational coefficients -(a line whose equation is \f$ ax + by + c = 0\f$, where \f$ a\f$, \f$ b\f$ and \f$ c\f$ are -rational). Such numbers can be expressed as \f$ \alpha + \beta\sqrt{\gamma}\f$, -where \f$ \alpha\f$, \f$ \beta\f$ and \f$ \gamma\f$ are all rational numbers. +squared radii is also rational. If we denote the circle center by +\f$(x_0,y_0)\f$ and its radius by \f$r\f$, then the equation of the +circle - that is, \f$(x - x_0)^2 + (y - y_0)^2 = r^2\f$ - has rational +coefficients. The intersection points of two such circles are +therefore solutions of a quadratic equation with rational +coefficients, or algebraic numbers of degree \f$2\f$. The same applies +for intersection points between such a rational circle and a line, or +a line segment, with rational coefficients (a line whose equation is +\f$ax + by + c = 0\f$, where \f$a\f$, \f$b\f$ and \f$c\f$ are +rational). Such numbers can be expressed as \f$\alpha + +\beta\sqrt{\gamma}\f$, where \f$\alpha\f$, \f$\beta\f$ and +\f$\gamma\f$ are all rational numbers. -Arrangement of circular arcs and of line segment are very useful, as they -occur in many applications. For example, when dilating a polygon by some -radius we obtain a shape whose boundary is comprised of line segments, -which correspond to dilated polygon edges, and circular arcs, which -result from dilated polygon vertices. Using the arrangement of the -boundary curves it is possible, for example, to compute the union of a set -of dilated polygons. +Arrangement of circular arcs and of line segment are very useful, as +they occur in many applications. For example, when dilating a polygon +by some radius we obtain a shape whose boundary is comprised of line +segments, which correspond to dilated polygon edges, and circular +arcs, which result from dilated polygon vertices. Using the +arrangement of the boundary curves it is possible, for example, to +compute the union of a set of dilated polygons. The `Arr_circle_segment_traits_2` class-template is designed -for efficient handling of arrangements of circular arcs and line segments. -It is a model of the concepts `ArrangementTraits_2` and -`ArrangementDirectionalXMonotoneTraits_2`; the later enables -Boolean set operations. Note that it is not a model of -`ArrangementLandmarkTraits_2` concept, so it is impossible to -use the landmark point-location strategy. The traits class template -is parameterized by a geometric kernel, and can handle arrangements of -segments of `Kernel::Circle_2` objects (full circles are also supported) -or of `Kernel::Line_2` objects - namely circular arcs and line segments. -It is important to observe that the nested `Point_2` type defined by the -traits class, whose coordinates are typically algebraic numbers of degree 2, -is not the same as the `Kernel::Point_2` type, which is capable of -representing a point with rational coordinates. The coordinates of a -point are represented using the nested `CoordNT` number-type. +for efficient handling of arrangements of circular arcs and line +segments. It is a model of the concepts `ArrangementTraits_2` and +`ArrangementDirectionalXMonotoneTraits_2`; the later enables Boolean +set operations. Note that it is not a model of +`ArrangementLandmarkTraits_2` concept, so it is impossible to use the +landmark point-location strategy. The traits class template is +parameterized by a geometric kernel, and can handle arrangements of +segments of `Kernel::Circle_2` objects (full circles are also +supported) or of `Kernel::Line_2` objects - namely circular arcs and +line segments. It is important to observe that the nested `Point_2` +type defined by the traits class, whose coordinates are typically +algebraic numbers of degree 2, is not the same as the +`Kernel::Point_2` type, which is capable of representing a point with +rational coordinates. The coordinates of a point are represented using +the nested `CoordNT` number-type. \cgalFigureBegin{arr_figex_13,ex_13.png} -An arrangement of three circles constructed in `circles.cpp`. Each circle is split into two \f$ x\f$-monotone circular arcs, whose endpoints are drawn as disks. Circles mark vertices that correspond to intersection points. The vertex \f$ v_{\rm max}\f$ is a common intersection point of all three circles. +An arrangement of three circles constructed in `circles.cpp`. Each +circle is split into two \f$x\f$-monotone circular arcs, whose +endpoints are drawn as disks. Circles mark vertices that correspond to +intersection points. The vertex \f$y_{\rm max}\f$ is a common +intersection point of all three circles. \cgalFigureEnd In the following example an arrangement of three full circles is -constructed, as shown in \cgalFigureRef{arr_figex_13}. Then, the vertex -of maximal degree is searched for. The geometric mapping of this -vertex is the point \f$ (4,3)\f$, as all three circles intersect at this point -and the associated vertex has six incident edges: +constructed, as shown in \cgalFigureRef{arr_figex_13}. Then, the +vertex of maximal degree is searched for. The geometric mapping of +this vertex is the point \f$(4,3)\f$, as all three circles intersect +at this point and the associated vertex has six incident edges: \cgalExample{Arrangement_on_surface_2/circles.cpp} -The `Curve_2` type nested in `Arr_circle_segment_traits_2` can be -used to represent circles, circular arcs, or line segments. Curve objects +The `Curve_2` type nested in `Arr_circle_segment_traits_2` can be used +to represent circles, circular arcs, or line segments. Curve objects can therefore be constructed from a `Kernel::Circle_2` object or from -a `Kernel::Segment_2` object. A circular arc is typically defined by -a supporting circle and two endpoints, where the endpoints are instances +a `Kernel::Segment_2` object. A circular arc is typically defined by a +supporting circle and two endpoints, where the endpoints are instances of the `Point_2` type, with rational or irrational coordinates. The -orientation of the arc is determined by the orientation of the supporting -circle. Similarly, we also support the construction of lines segments given -their supporting line (of type `Kernel::Line_2`) and two endpoints, which -may have irrational coordinates (unlike the `Kernel::Segment_2` type). +orientation of the arc is determined by the orientation of the +supporting circle. Similarly, we also support the construction of +lines segments given their supporting line (of type `Kernel::Line_2`) +and two endpoints, which may have irrational coordinates (unlike the +`Kernel::Segment_2` type). Note that the `Kernel::Circle_2` type represents a circle whose -squared radius is rational, where the radius itself may be irrational. -However, if the radius is known to be rational, it is advisable to use it, -for efficiency reasons. It is therefore also possible to construct a circle, -or a circular arc specifying the circle center (a `Kernel::Point_2`), its -rational radius, and its orientation. Finally, we also support the construction -of a circular arcs that is defined by two endpoints and an arbitrary midpoint -that lies on the arc in between its endpoint. In this case, all three points -are required to have rational coordinates (to be kernel points). +squared radius is rational, where the radius itself may be +irrational. However, if the radius is known to be rational, it is +advisable to use it, for efficiency reasons. It is therefore also +possible to construct a circle, or a circular arc specifying the +circle center (a `Kernel::Point_2`), its rational radius, and its +orientation. Finally, we also support the construction of a circular +arcs that is defined by two endpoints and an arbitrary midpoint that +lies on the arc in between its endpoint. In this case, all three +points are required to have rational coordinates (to be kernel +points). -The following example demonstrates the usage of the various construction -methods for circular arcs and line segments. Note the usage of the constructor -of `CoordNT (alpha, beta, gamma)`, which creates a degree-\f$ 2\f$ algebraic -number whose value is \f$ \alpha + \beta\sqrt{\gamma}\f$. +The following example demonstrates the usage of the various +construction methods for circular arcs and line segments. Note the +usage of the constructor of `CoordNT (alpha, beta, gamma)`, which +creates a degree-\f$2\f$ algebraic number whose value is \f$\alpha + +\beta\sqrt{\gamma}\f$. \cgalExample{Arrangement_on_surface_2/circular_arcs.cpp} -It is also possible to construct \f$ x\f$-monotone curve objects, which represent -\f$ x\f$-monotone circular arcs or line segments, using similar constructors. -Construction from a full circle is obviously not supported. See the Reference -Manual for more details. +It is also possible to construct \f$x\f$-monotone curve objects, which +represent \f$x\f$-monotone circular arcs or line segments, using +similar constructors. Construction from a full circle is obviously +not supported. See the Reference Manual for more details. The traits class-template `Arr_circular_line_arc_traits_2` offered by the @@ -2405,105 +3174,109 @@ purposes, are based on different concepts, and posses different characteristics. You are encouraged to experiment with both, compare their performance, and use the most suitable for your case. -\subsection arr_ssectr_conic A Traits Class for Conic Arcs +\subsubsection arr_ssectr_conic A Traits Class for Conic Arcs + +A conic curve is an algebraic curve of degree 2. Namely, it +is the locus of all points \f$(x,y)\f$ satisfying the equation \f$C:\ +r x^2 + s y^2 + t xy + u x + v y + w = 0\f$, where the six +coefficients \f$\langle r, s, t, u, v, w \rangle\f$ completely +characterize the curve. The sign of the expression \f$\Delta_{C} = 4 r +s - t^2\f$ determines the type of curve: -A conic curve is an algebraic curve of degree 2. Namely, it -is the locus of all points \f$ (x,y)\f$ satisfying the equation \f$ C:\ r -x^2 + s y^2 + t xy + u x + v y + w = 0\f$, where the six -coefficients \f$ \langle r, s, t, u, v, w \rangle\f$ completely -characterize the curve. The sign of the expression \f$ \Delta_{C} = 4 -r s - t^2\f$ determines the type of curve:
      -
    • If \f$ \Delta_{C} > 0\f$ the curve is an ellipse. A circle is a -special case of an ellipse, where \f$ r = s\f$ and \f$ t = 0\f$. -
    • If \f$ \Delta_{C} = 0\f$ the curve is a parabola - an unbounded -conic curve with a single connected branch. When \f$ r = s = t = 0\f$ + +
    • If \f$\Delta_{C} > 0\f$ the curve is an ellipse. A circle is a +special case of an ellipse, where \f$r = s\f$ and \f$t = 0\f$. +
    • If \f$\Delta_{C} = 0\f$ the curve is a parabola - an unbounded +conic curve with a single connected branch. When \f$r = s = t = 0\f$ we have a line, which can be considered as a degenerate parabola. -
    • If \f$ \Delta_{C} < 0\f$ the curve is a hyperbola. That is, it +
    • If \f$\Delta_{C} < 0\f$ the curve is a hyperbola. That is, it is comprised of two disconnected unbounded branches.
    -As the arrangement package is suitable for bounded curves, we -consider bounded segments of conic curves, referred to as conic arcs. A conic arc \f$ a\f$ may be either (i) a full ellipse, or -(ii) defined by the tuple \f$ \langle C, p_s, p_t, o \rangle\f$, where -\f$ C\f$ is a conic curve and \f$ p_s\f$ and \f$ p_t\f$ are two points on \f$ C\f$ -(namely \f$ C(p_s) = C(p_t) = 0\f$) that define the source and -target of the arc, respectively. The arc is formed by -traversing \f$ C\f$ from the source to the target going in the -orientation specified by \f$ o\f$, which is typically clockwise or -counterclockwise orientation (but may also be collinear in case of +As the arrangement package is suitable for bounded curves, we consider +bounded segments of conic curves, referred to as conic +arcs. A conic arc \f$a\f$ may be either (i) a full ellipse, or +(ii) defined by the tuple \f$\langle C, p_s, p_t, o \rangle\f$, where +\f$C\f$ is a conic curve and \f$p_s\f$ and \f$p_t\f$ are two points +on \f$C\f$ (namely \f$C(p_s) = C(p_t) = 0\f$) that define the +source and target of the arc, respectively. The arc +is formed by traversing \f$C\f$ from the source to the target going +in the orientation specified by \f$ o\f$, which is typically clockwise +or counterclockwise orientation (but may also be collinear in case of degenerate conic curves). -We always assume that the conic coefficients \f$ \langle r, s, -t, u, v, w \rangle\f$ are rational. When dealing with linear curves -(line segments and polylines), similar assumptions guarantee that -all intersection points also have rational coordinates, such that -the arrangement of such curves can be constructed and maintained -using only rational arithmetic. Unfortunately, this does not hold -for conic curves, as the coordinates of intersection points of two -conic curves with rational coefficients are in general algebraic -numbers of degree \f$ 4\f$.\cgalFootnote{Namely, they are roots of polynomials with integer coefficients of degree \f$ 4\f$. However, in some special cases, for example when handling only circles and circular arcs, the coordinates of the intersection points are only of degree \f$ 2\f$, namely they are solutions of quadratic equations.} -In addition, conic arcs may not necessarily be \f$ x\f$-monotone, and -must be split at points where the tangent to the arc is vertical. -In the general case, such points typically have coordinates that -are algebraic numbers of degree \f$ 2\f$. -It is therefore clear that we have to use different number types -to represent the conic coefficients and the point coordinates. -Note that as arrangement vertices induced by intersection points -and points with vertical tangents are likely to have algebraic -coordinates, we also allow the original endpoints of the input arcs -\f$ p_s\f$ and \f$ p_t\f$ to have algebraic coordinates. +We always assume that the conic coefficients \f$\langle r, s, t, u, v, +w \rangle\f$ are rational. When dealing with linear curves (line +segments and polylines), similar assumptions guarantee that all +intersection points also have rational coordinates, such that the +arrangement of such curves can be constructed and maintained using +only rational arithmetic. Unfortunately, this does not hold for conic +curves, as the coordinates of intersection points of two conic curves +with rational coefficients are in general algebraic numbers of degree +\f$4\f$.\cgalFootnote{Namely, they are roots of polynomials with +integer coefficients of degree \f$4\f$. However, in some special +cases, for example when handling only circles and circular arcs, the +coordinates of the intersection points are only of degree \f$ 2\f$, +namely they are solutions of quadratic equations.} In addition, conic +arcs may not necessarily be \f$x\f$-monotone, and must be split at +points where the tangent to the arc is vertical. In the general case, +such points typically have coordinates that are algebraic numbers of +degree \f$2\f$. It is therefore clear that we have to use different +number types to represent the conic coefficients and the point +coordinates. Note that as arrangement vertices induced by +intersection points and points with vertical tangents are likely to +have algebraic coordinates, we also allow the original endpoints of +the input arcs \f$p_s\f$ and \f$p_t\f$ to have algebraic coordinates. The `Arr_conic_traits_2` class template is designed for efficient handling of arrangements of bounded conic arcs. The template has three parameters, defined as follows:
      -
    • The `RatKernel` class is a geometric kernel, whose field -type is an exact rational type. It is used to define basic -geometric entities (e.g., a line segment or a circle) with rational + +
    • The `RatKernel` class is a geometric kernel, whose field type is +an exact rational type. It is used to define basic geometric entities +(e.g., a line segment or a circle) with rational coefficients. Typically we use one of the standard \cgal kernels, -instantiated with the number type `NtTraits::Rational` (see -below). -
    • The `AlgKernel` class is a geometric kernel whose field -type is an exact algebraic type. It is used to define points with -algebraic coordinates. Typically we use one of the standard -\cgal kernels, instantiated with the number type -`NtTraits::Algebraic` (see below). -
    • The `NtTraits` class (the number-type traits class) -encapsulates all the numeric operations needed for performing the -geometric computation carried out by the geometric traits class. -It defines the `Integer`, `Rational` and `Algebraic` -number-types, and supports several operations on these types, such -as conversion between number types, solving quadratic equations -and extracting the real roots of a polynomial with integer -coefficients. It is highly recommended to use the -`CORE_algebraic_number_traits` class, which is included in the -arrangement package. It relies on the exact number types -implemented in the Core library and performs exact +instantiated with the number type `NtTraits::Rational` (see below). + +
    • The `AlgKernel` class is a geometric kernel whose field type is an +exact algebraic type. It is used to define points with algebraic +coordinates. Typically we use one of the standard \cgal kernels, +instantiated with the number type `NtTraits::Algebraic` (see below). + +
    • The `NtTraits` class (the number-type traits class) encapsulates +all the numeric operations needed for performing the geometric +computation carried out by the geometric traits class. It defines the +`Integer`, `Rational` and `Algebraic` number-types, and supports +several operations on these types, such as conversion between number +types, solving quadratic equations and extracting the real roots of a +polynomial with integer coefficients. It is highly recommended to use +the `CORE_algebraic_number_traits` class, which is included in the +arrangement package. It relies on the exact number types implemented +in the Core library and performs exact computations on the number types it defines.
    The `Arr_conic_traits_2` models the `ArrangementTraits_2` and -`ArrangementLandmarkTraits_2` concepts. (It supports -the landmark point-location strategy). Its `Point_2` type is -derived from `AlgKernel::Point_2`, while the `Curve_2` -type represents a bounded, not necessarily \f$ x\f$-monotone, conic arc. -The `X_monotone_curve_2` type is derived from `Curve_2`, -but its constructors are to be used only by the traits class. -You should therefore construct only `Curve_2` objects and -insert them into the arrangement using the `insert()` -or `insert()` functions. +`ArrangementLandmarkTraits_2` concepts. (It supports the landmark +point-location strategy). Its `Point_2` type is derived from +`AlgKernel::Point_2`, while the `Curve_2` type represents a bounded, +not necessarily \f$x\f$-monotone, conic arc. The +`X_monotone_curve_2` type is derived from `Curve_2`, but its +constructors are to be used only by the traits class. You should +therefore construct only `Curve_2` objects and insert them into the +arrangement using the `insert()` or `insert()` functions. -Conic arcs can be constructed from full ellipses or by specifying -a supporting curve, two endpoints and an orientation. However, -several constructors of `Curve_2` are available to allow for some -special cases, such as circular arcs or line segments. The -`Curve_2` (and the derived `X_monotone_curve_2`) classes -also support basic access functions such as `source()`, -`target()` and `orientation()`. +Conic arcs can be constructed from full ellipses or by specifying a +supporting curve, two endpoints and an orientation. However, several +constructors of `Curve_2` are available to allow for some special +cases, such as circular arcs or line segments. The `Curve_2` (and the +derived `X_monotone_curve_2`) classes also support basic access +functions such as `source()`, `target()` and `orientation()`. -\subsection Arrangement_on_surface_2ExamplesforArrangements Examples for Arrangements of Conics +\subsubsection Arrangement_on_surface_2ExamplesforArrangements Examples for Arrangements of Conics \cgalFigureBegin{arr_figex_14,ex_14.png} An arrangement of mixed conic arcs, as constructed in conics.cpp @@ -2511,142 +3284,142 @@ An arrangement of mixed conic arcs, as constructed in conics.cpp The following example demonstrates the usage of the various -constructors for conic arcs. The resulting arrangement is depicted -in \cgalFigureRef{arr_figex_14}. Especially noteworthy are the +constructors for conic arcs. The resulting arrangement is depicted in +\cgalFigureRef{arr_figex_14}. Especially noteworthy are the constructor of a circular arc that accepts three points and the constructor that allows specifying approximate endpoints, where the -exact endpoints are given explicitly as intersections of -the supporting conic with two other conic curves. Also note that as the +exact endpoints are given explicitly as intersections of the +supporting conic with two other conic curves. Also note that as the preconditions required by some of these constructors are rather -complicated (see the Reference Manual for the details), a -precondition violation does not cause the program to terminate - -instead, an invalid arc is created. We can verify the validity -of an arc by using the `is_valid()` method. Needless to say, inserting -invalid arcs into an arrangement is not allowed. +complicated (see the Reference Manual for the details), a precondition +violation does not cause the program to terminate - instead, an +invalid arc is created. We can verify the validity of an arc +by using the `is_valid()` method. Needless to say, inserting invalid +arcs into an arrangement is not allowed. \cgalExample{Arrangement_on_surface_2/conics.cpp} The last example in this section demonstrates how the conic-traits -class can handle intersection points with multiplicity. The -supporting curves of the two arcs, a circle centered at -\f$ (0,\frac{1}{2})\f$ with radius \f$ \frac{1}{2}\f$, and the hyperbola \f$ y -= \frac{x^2}{1-x}\f$,\cgalFootnote{This curve can also be written as \f$ C: x^2 + xy - y = 0\f$. It is a hyperbola since \f$ \Delta_{C} = -1\f$.} -intersect at the origin such that the intersection point has -multiplicity \f$ 3\f$ (note that they both have the same horizontal -tangent at \f$ (0,0)\f$ and the same curvature \f$ 1\f$). In addition, they -have another intersection point at \f$ (\frac{1}{2},\frac{1}{2})\f$ of -multiplicity \f$ 1\f$: +class can handle intersection points with multiplicity. The supporting +curves of the two arcs, a circle centered at \f$(0,\frac{1}{2})\f$ +with radius \f$\frac{1}{2}\f$, and the hyperbola \f$y = +\frac{x^2}{1-x}\f$,\cgalFootnote{This curve can also be written as +\f$C: x^2 + xy - y = 0\f$. It is a hyperbola since \f$\Delta_{C} = +-1\f$.} intersect at the origin such that the intersection point has +multiplicity \f$3\f$ (note that they both have the same horizontal +tangent at \f$(0,0)\f$ and the same curvature \f$1\f$). In addition, +they have another intersection point at +\f$(\frac{1}{2},\frac{1}{2})\f$ of multiplicity \f$1\f$: \cgalExample{Arrangement_on_surface_2/conic_multiplicities.cpp} -\subsection arr_ssectr_ratfunc A Traits Class for Arcs of Rational Functions +\subsubsection arr_ssectr_ratfunc A Traits Class for Arcs of Rational Functions -The traits class -`Arr_rational_function_traits_2` handles -bounded and unbounded arcs of rational functions, referred to as -rational arcs (in particular, such an arc may correspond to the -entire graph of a rational function), and enables the construction and -maintenance of arrangements of such arcs. Rational functions, and -polynomial functions in particular, are not only interesting in their -own right, they are also very useful for approximating or -interpolating more complicated curves; see, -e.g., [\cgalCite{cgal:ptvf-nrcpp-02} Chapter 3. +The traits class `Arr_rational_function_traits_2` +handles bounded and unbounded arcs of rational functions, referred to +as rational arcs (in particular, such an arc may correspond +to the entire graph of a rational function), and enables the +construction and maintenance of arrangements of such arcs. Rational +functions, and polynomial functions in particular, are not only +interesting in their own right, they are also very useful for +approximating or interpolating more complicated curves; see, e.g., +[\cgalCite{cgal:ptvf-nrcpp-02} Chapter 3. -`Arr_rational_function_traits_2` is a model -of the concepts `ArrangementTraits_2`, -`ArrangementOpenBoundaryTraits_2`, and -`ArrangementDirectionalXMonotoneTraits_2`; the later enables +`Arr_rational_function_traits_2` is a model of +the concepts `ArrangementTraits_2`, `ArrangementOpenBoundaryTraits_2`, +and `ArrangementDirectionalXMonotoneTraits_2`; the later enables Boolean set operations. Note that it is not a model of -`ArrangementLandmarkTraits_2` concept, so it is impossible to use -the landmark point-location strategy with this traits class. +`ArrangementLandmarkTraits_2` concept, so it is impossible to use the +landmark point-location strategy with this traits class. -A rational function \f$ y = \frac{P(x)}{Q(x)}\f$ is defined by two -polynomials \f$ P\f$ and \f$ Q\f$ of arbitrary degrees. If \f$ Q(x) = 1\f$ then -the function is a simple polynomial function. Usually the domain is -\f$ \mathbb{R}\f$ but the function may also be restricted to a bounded interval -\f$ [x_{\rm min}, x_{\rm max}]\f$ or defined over a ray -\f$ (-\infty, x_{\rm max}]\f$ or \f$ [x_{\rm min}, \infty)\f$. Rational -functions are represented by the nested type `Curve_2`. -A rational arc is always \f$ x\f$-monotone in the mathematical -sense. However, it is not necessarily continuous, as it may have -singularities. An arc that has singularities must -be split into continuous portions before being inserted into the +A rational function \f$y = \frac{P(x)}{Q(x)}\f$ is defined by two +polynomials \f$P\f$ and \f$ Q\f$ of arbitrary degrees. If \f$ Q(x) = +1\f$ then the function is a simple polynomial function. Usually the +domain is \f$\mathbb{R}\f$ but the function may also be restricted to +a bounded interval \f$[x_{\rm min}, x_{\rm max}]\f$ or defined over a +ray \f$ (-\infty, x_{\rm max}]\f$ or \f$[x_{\rm min}, +\infty)\f$. Rational functions are represented by the nested type +`Curve_2`. A rational arc is always \f$x\f$-monotone in the +mathematical sense. However, it is not necessarily continuous, as it +may have singularities. An arc that has singularities must be split +into continuous portions before being inserted into the arrangement. Arbitrary rational functions are represented by the -nested type `Curve_2` and continuous portions of rational -functions are represented by the nested type -`X_monotone_curve_2`. Constructors for both types are provided by -the traits. A `Curve_2` may be split up into several -`X_monotone_curve_2` using `Make_x_monotone_2`. +nested type `Curve_2` and continuous portions of rational functions +are represented by the nested type `X_monotone_curve_2`. Constructors +for both types are provided by the traits. A `Curve_2` may be split up +into several `X_monotone_curve_2` using `Make_x_monotone_2`. -Using the `Arr_rational_function_traits_2` -class template it is possible to construct and maintain arrangement -of rational arcs. The template parameter of the traits must be a model -of the concept `AlgebraicKernel_d_1`. A rational function is -represented as the quotient of two polynomials \f$ P\f$ and \f$ Q\f$ of type -`AlgebraicKernel_d_1::Polynomial_1` and an \f$ x\f$-interval over which -the polynomials are defined. The type of the polynomial coefficients, -namely `AlgebraicKernel_d_1::Coefficient`, cannot be algebraic. -Moreover, it is recommended that this type is not made rational either, -since using rational, as opposed to integral, coefficients does not -extend the range of the rational arcs and is typically less efficient. -The type of the interval bounds, namely +Using the `Arr_rational_function_traits_2` class +template it is possible to construct and maintain arrangement of +rational arcs. The template parameter of the traits must be a model of +the concept `AlgebraicKernel_d_1`. A rational function is represented +as the quotient of two polynomials \f$P\f$ and \f$Q\f$ of type +`AlgebraicKernel_d_1::Polynomial_1` and an \f$x\f$-interval over +which the polynomials are defined. The type of the polynomial +coefficients, namely `AlgebraicKernel_d_1::Coefficient`, cannot be +algebraic. Moreover, it is recommended that this type is not made +rational either, since using rational, as opposed to integral, +coefficients does not extend the range of the rational arcs and is +typically less efficient. The type of the interval bounds, namely `AlgebraicKernel_d_1::Bound`, however, can be algebraic. A point is -represented by a rational function and its \f$ x\f$-coordinate, which is of -type `AlgebraicKernel_d_1::Algebraic_real_1`. Note that an explicit -representation of the \f$ y\f$-coordinate is only computed upon request, as -it can be a rather costly operation. +represented by a rational function and its \f$x\f$-coordinate, which +is of type `AlgebraicKernel_d_1::Algebraic_real_1`. Note that an +explicit representation of the \f$y\f$-coordinate is only computed +upon request, as it can be a rather costly operation. The constructed rational functions are cached by the traits class. The cache is local to each traits class object. It is therefore necessary to construct curves using only the constructor objects provided by -member functions of the traits class. -Moreover, a curve must only be used by the traits class object that -was used to construct it. The cache is automatically cleaned up from -time to time. The amortized clean up costs are constant. In addition, -there is also a separate member function that cleans up the cache on -demand. +member functions of the traits class. Moreover, a curve must only be +used by the traits class object that was used to construct it. The +cache is automatically cleaned up from time to time. The amortized +clean up costs are constant. In addition, there is also a separate +member function that cleans up the cache on demand. The curve constructors have an additional advantage. They conveniently enable the provision of two polynomials that define a rational arc -using rational coefficients. For example, let \f$ P\f$ and \f$ Q\f$ denote two -polynomials with integral coefficients that define a rational arc at -interest, and let \f$ P'\f$ and \f$ Q'\f$ denote two polynomials with rational -coefficients that define the same rational arc; that is, the quotients -\f$ P/Q\f$ and \f$ P'/Q'\f$ are identical. You can construct the rational arc -providing the coefficients of \f$ P'\f$ and \f$ Q'\f$ to the constructor. In this -case the constructor normalizes the coefficients and stores the desired -polynomials \f$ P\f$ and \f$ Q\f$. +using rational coefficients. For example, let \f$P\f$ and \f$Q\f$ +denote two polynomials with integral coefficients that define a +rational arc at interest, and let \f$P'\f$ and \f$Q'\f$ denote two +polynomials with rational coefficients that define the same rational +arc; that is, the quotients \f$P/Q\f$ and \f$P'/Q'\f$ are +identical. You can construct the rational arc providing the +coefficients of \f$P'\f$ and \f$Q'\f$ to the constructor. In this +case the constructor normalizes the coefficients and stores the +desired polynomials \f$P\f$ and \f$Q\f$. \cgalFigureBegin{arr_figex_16,ex_16.png} An arrangement of four arcs of rational functions, as constructed in rational_functions.cpp. \cgalFigureEnd -The following example demonstrates the construction of an -arrangement of rational arcs depicted in -\cgalFigureRef{arr_figex_16}. Note the usage of the two -constructors, for polynomial arcs and for rational arcs: +The following example demonstrates the construction of an arrangement +of rational arcs depicted in \cgalFigureRef{arr_figex_16}. Note the +usage of the two constructors, for polynomial arcs and for rational +arcs: \cgalExample{Arrangement_on_surface_2/rational_functions.cpp} -\cgalFigureBegin{arr_figex_unb_rat,ex_unb_rat.png} -An arrangement of six arcs of rational functions, as constructed in unbounded_rational_functions.cpp +\cgalFigureBegin{arr_figex_unb_rat,ex_unb_rat.png} An arrangement of +six arcs of rational functions, as constructed in +unbounded_rational_functions.cpp \cgalFigureEnd -The following example demonstrates the construction of an -arrangement of six rational arcs - four unbounded arcs and two -bounded ones - as depicted in \cgalFigureRef{arr_figex_unb_rat}. Note -the usage of the constructors of an entire rational function and of -an infinite "ray" of such a function. Also observe that the hyperbolas -\f$ y = \pm\frac{1}{x}\f$ and \f$ y = \pm\frac{1}{2x}\f$ never intersect, although -they have common vertical and horizontal asymptotes, so very "thin" -unbounded faces are created between them: +The following example demonstrates the construction of an arrangement +of six rational arcs - four unbounded arcs and two bounded ones - as +depicted in \cgalFigureRef{arr_figex_unb_rat}. Note the usage of the +constructors of an entire rational function and of an infinite "ray" +of such a function. Also observe that the hyperbolas \f$y = +\pm\frac{1}{x}\f$ and \f$y = \pm\frac{1}{2x}\f$ never intersect, +although they have common vertical and horizontal asymptotes, so very +"thin" unbounded faces are created between them: \cgalExample{Arrangement_on_surface_2/unbounded_rational_functions.cpp} -\subsection arr_ssectr_bez A Traits Class for Planar Bézier Curves +\subsubsection arr_ssectr_bez A Traits Class for Planar Bézier Curves -A planar Bézier curve \f$ B\f$ is a parametric curve defined by a sequence -of control points \f$ p_0, \ldots, p_n\f$ as follows: +A planar Bézier curve \f$B\f$ is a parametric curve +defined by a sequence of control points \f$p_0, \ldots, +p_n\f$ as follows: \f{eqnarray*}{ B(t) = \left(X(t), Y(t)\right) @@ -2654,74 +3427,77 @@ B(t) = \left(X(t), Y(t)\right) t^k (1-t)^{n-k}}\ . \f} -where \f$ t \in [0, 1]\f$. The degree of the curve is therefore \f$ n\f$ - -namely, \f$ X(t)\f$ and \f$ Y(t)\f$ are polynomials of degree \f$ n\f$. Bézier curves -have numerous applications in computer graphics and solid modelling. They -are used, for example, in free-form sketches and for defining the true-type -fonts. +where \f$t \in [0, 1]\f$. The degree of the curve is therefore \f$n\f$ +- namely, \f$ X(t)\f$ and \f$ Y(t)\f$ are polynomials of degree +\f$n\f$. Bézier curves have numerous applications in computer +graphics and solid modelling. They are used, for example, in free-form +sketches and for defining the true-type fonts. Using the `Arr_Bezier_curve_traits_2` -class template it is possible to construct and maintain arrangements of -Bézier curves that are given by rational control points (a sequence -of objects of the `RatKernel::Point_2` type). We can handle curves -of arbitrary degree (in general, a sequence of \f$ n+1\f$ control points define a -Bézier curve of degree \f$ n\f$). The template parameters are the same ones -used by the `Arr_conic_traits_2` class template, and here it is also -recommended to use the `CORE_algebraic_number_traits` class, with -Cartesian kernels instantiated with the `Rational` and `Algebraic` -number-types defined by this class. +class template it is possible to construct and maintain arrangements +of Bézier curves that are given by rational control points (a +sequence of objects of the `RatKernel::Point_2` type). We can handle +curves of arbitrary degree (in general, a sequence of \f$n+1\f$ +control points define a Bézier curve of degree \f$n\f$). The +template parameters are the same ones used by the `Arr_conic_traits_2` +class template, and here it is also recommended to use the +`CORE_algebraic_number_traits` class, with Cartesian kernels +instantiated with the `Rational` and `Algebraic` number-types defined +by this class. As mentioned above, we assume that the coordinates of all control -points that define a Bézier curve are rational numbers, so both \f$ X(t)\f$ -and \f$ Y(t)\f$ are polynomials with rational coefficients. The intersection -points between curves are however algebraic numbers, and their exact -computation is time-consuming. The traits class therefore contains a layer -of geometric filtering that performs all computation in an approximate -manner whenever possible. Thus, it resorts to exact computations only when -the approximate computation fails to produce an unambiguous result. -Note that most arrangement vertices are therefore associated with approximated -points. You cannot access the coordinates of such points and obtain them as -algebraic numbers, and only access to the approximate coordinates in possible. -See the Reference Manual for the exact interface of the `Point_2`, -`Curve_2` and `X_monotone_curve_2` defined by the traits class. +points that define a Bézier curve are rational numbers, so both +\f$X(t)\f$ and \f$Y(t)\f$ are polynomials with rational +coefficients. The intersection points between curves are however +algebraic numbers, and their exact computation is time-consuming. The +traits class therefore contains a layer of geometric filtering that +performs all computation in an approximate manner whenever +possible. Thus, it resorts to exact computations only when the +approximate computation fails to produce an unambiguous result. Note +that most arrangement vertices are therefore associated with +approximated points. You cannot access the coordinates of such points +and obtain them as algebraic numbers, and only access to the +approximate coordinates in possible. See the Reference Manual for the +exact interface of the `Point_2`, `Curve_2` and `X_monotone_curve_2` +defined by the traits class. The `Arr_Bezier_curve_traits_2` is a model of the `ArrangementTraits_2` concept (but not of the -`ArrangementLandmarkTraits_2` concept, so it is impossible -to use the landmark point-location strategy for arrangements of -rational arcs). +`ArrangementLandmarkTraits_2` concept, so it is impossible to use the +landmark point-location strategy for arrangements of rational arcs). \cgalFigureBegin{arr_figex_bez,Bezier_arr.png} -An arrangement of ten Bézier curves of degree \f$ 5\f$, as constructed in `Bezier_curves.cpp`. +An arrangement of ten Bézier curves of degree \f$5\f$, as +constructed in `Bezier_curves.cpp`. \cgalFigureEnd -The following example reads a set of Bézier curves from an input -file, where each file is specified by an integer stating its number -of control points, followed by the sequence of control points, given -in integer or rational coordinates. By default, the program uses -the `Bezier.dat` file, which contains ten curves of degree \f$ 5\f$ +The following example reads a set of Bézier curves from an +input file, where each file is specified by an integer stating its +number of control points, followed by the sequence of control points, +given in integer or rational coordinates. By default, the program uses +the `Bezier.dat` file, which contains ten curves of degree \f$5\f$ each; their resulting arrangement is depicted in \cgalFigureRef{arr_figex_bez}. \cgalExample{Arrangement_on_surface_2/Bezier_curves.cpp} -\subsection arr_ssectr_alg A Traits Class for Planar Algebraic Curves of Arbitrary Degree +\subsubsection arr_ssectr_alg A Traits Class for Planar Algebraic Curves of Arbitrary Degree -An algebraic curve \f$ C\f$ in the plane is defined as the (real) zero locus -of a polynomial \f$ f(x,y)\f$ in two variables. The curve is uniquely defined -by \f$ f\f$ (although several polynomials might define the same curve). -We call \f$ f\f$ a defining polynomial of \f$ C\f$. +An algebraic curve \f$C\f$ in the plane is defined as the (real) zero +locus of a polynomial \f$f(x,y)\f$ in two variables. The curve is +uniquely defined by \f$f\f$ (although several polynomials might define +the same curve). We call \f$f\f$ a defining polynomial of +\f$C\f$. -We consider arrangements induced by algebraic curves -or by (weakly) \f$ x\f$-monotone segments for algebraic curves -(Such a segment is not necessarily the maximal possible -(weakly) x-monotone segment; see below.) -When talking about algebraic curves, -we use the term "segment" for a continuous, possibly non-linear subset -of an algebraic curve - see the definition below. -There are no restrictions on the algebraic curve, that means, -we support unbounded curves, vertical curves or segments, and isolated points. +We consider arrangements induced by algebraic curves or by (weakly) +\f$x\f$-monotone segments for algebraic curves (Such a segment is not +necessarily the maximal possible (weakly) x-monotone segment; see +below.) When talking about algebraic curves, we use the term +"segment" for a continuous, possibly non-linear subset of an algebraic +curve - see the definition below. There are no restrictions on the +algebraic curve, that means, we support unbounded curves, vertical +curves or segments, and isolated points. The `Arr_algebraic_segment_traits_2` class template is a model of the `ArrangementTraits_2` concept (but not of the @@ -2741,8 +3517,9 @@ This polynomial type is also available by the traits class and constitutes a valid model of the concept `Polynomial_d` with two variables (see ??). -\cgalFigureBegin{arr_figex_alg_curves,algebraic_curves.png} -An arrangement of algebraic curves of degrees \f$ 1\f$, \f$ 2\f$, \f$ 3\f$, and \f$ 6\f$, as constructed in `algebraic_curves.cpp`. +\cgalFigureBegin{arr_figex_alg_curves,algebraic_curves.png} An +arrangement of algebraic curves of degrees \f$1\f$, \f$ 2\f$, \f$3\f$, +and \f$6\f$, as constructed in `algebraic_curves.cpp`. \cgalFigureEnd The following examples computes the arrangement induced by the four curves @@ -2750,82 +3527,87 @@ in \cgalFigureRef{arr_figex_alg_curves} \cgalExample{Arrangement_on_surface_2/algebraic_curves.cpp} -We first give a precise definition of segments of algebraic curves. -A point \f$ p\f$ on a curve \f$ C_f\subset\mathbb{R}^2\f$ -(with \f$ f\f$ its defining equation) is called -semi-regular, if locally around \f$ p\f$, \f$ C_f\f$ can be written as -a function graph of some continuous function in \f$ x\f$ or in \f$ y\f$ -(we also say that \f$ p\f$ is parameterizable in \f$ x\f$ or \f$ y\f$, respectively). -The only two cases of non-semi-regular points are isolated points, and -self-intersections. -A segment of a curve is a closed and continuous point set -such that each interior point is semi-regular. -It follows that a weakly \f$ x\f$-monotone segment is either a completely vertical -segment, or a segment whose interior points are all parameterizable in \f$ x\f$. +We first give a precise definition of segments of algebraic curves. A +point \f$p\f$ on a curve \f$C_f\subset\mathbb{R}^2\f$ (with \f$f\f$ +its defining equation) is called semi-regular, if locally +around \f$p\f$, \f$ C_f\f$ can be written as a function graph of some +continuous function in \f$x\f$ or in \f$ y\f$ (we also say that \f$ +p\f$ is parameterizable in \f$x\f$ or \f$y\f$, respectively). The +only two cases of non-semi-regular points are isolated points, and +self-intersections. A segment of a curve is a closed and +continuous point set such that each interior point is semi-regular. +It follows that a weakly \f$ x\f$-monotone segment is either a +completely vertical segment, or a segment whose interior points are +all parameterizable in \f$x\f$. -The traits class allows to construct weakly \f$ x\f$-monotone segments of a curve -using the `Construct_x_monotone_segment_2` functor. -The `X_monotone_curve_2` type of the traits class represents -weakly \f$ x\f$-monotone segments of a curve; however, -segments may need to be further subdivided into several (sub-)segments, -for technical reasons. Therefore, `Construct_x_monotone_segment_2` -constructs a sequence of `X_monotone_curve_2` objects, whose union -represents the weakly \f$ x\f$-monotone segment that was queried. -We call a segment terminal if it can be represented -by the type `X_monotone_curve_2`. +The traits class allows to construct weakly \f$x\f$-monotone segments +of a curve using the `Construct_x_monotone_segment_2` functor. The +`X_monotone_curve_2` type of the traits class represents weakly +\f$x\f$-monotone segments of a curve; however, segments may need to be +further subdivided into several (sub-)segments, for technical +reasons. Therefore, `Construct_x_monotone_segment_2` constructs a +sequence of `X_monotone_curve_2` objects, whose union represents the +weakly \f$x\f$-monotone segment that was queried. We call a segment +terminal if it can be represented by the type +`X_monotone_curve_2`. \cgalAdvancedBegin + The subdivision of segments is due to the internal representation of -\f$ x\f$-monotone segments, which is based on a vertical decomposition. -We assume the defining polynomial \f$ f\f$ of the curve \f$ C\f$ -to be square-free, that means, it contains no divisor \f$ g^2\f$ of total -degree greater than zero. We define a (complex) critical point -\f$ p\in\mathbb{C}^2\f$ by -\f[ f(p)=0=\frac{\partial f}{\partial y}(p). \f] -An \f$ x\f$-coordinate \f$ \alpha\in\mathbb{R}\f$ is critical -if either some critical point has \f$ x\f$-coordinate \f$ \alpha\f$, -or if the leading coefficient of \f$ f\f$, considered as a polynomial in \f$ y\f$, -vanishes. In particular, vertical lines of and isolated point of \f$ C\f$ -can only take place at critical \f$ x\f$-coordinates. -Between two consecutive critical \f$ x\f$-coordinates, the curve decomposes -into a finite number of \f$ x\f$-monotone segments (the same is true on the left -of the leftmost, and on the right of the rightmost critical \f$ x\f$-coordinate). -The type `X_monotone_curve_2` is only able to represent such segments -(and sub-segments of them). See \cgalFigureRef{arr_figcylindrical_decomposition} -for an example of a decomposition into terminal segments. Formally, -a terminal segment is a weakly \f$ x\f$-monotone segment that is either vertical, or -its \f$ x\f$-range contains no critical point in its interior. +\f$x\f$-monotone segments, which is based on a vertical decomposition. +We assume the defining polynomial \f$f\f$ of the curve \f$C\f$ to be +square-free, that means, it contains no divisor \f$g^2\f$ of +total degree greater than zero. We define a (complex) critical +point \f$p\in\mathbb{C}^2\f$ by \f[ f(p)=0=\frac{\partial +f}{\partial y}(p). \f] An \f$x\f$-coordinate \f$\alpha\in\mathbb{R}\f$ +is critical if either some critical point has +\f$x\f$-coordinate \f$\alpha\f$, or if the leading coefficient of +\f$f\f$, considered as a polynomial in \f$y\f$, vanishes. In +particular, vertical lines of and isolated point of \f$C\f$ can only +take place at critical \f$x\f$-coordinates. Between two consecutive +critical \f$x\f$-coordinates, the curve decomposes into a finite +number of \f$x\f$-monotone segments (the same is true on the left of +the leftmost, and on the right of the rightmost critical +\f$x\f$-coordinate). The type `X_monotone_curve_2` is only able to +represent such segments (and sub-segments of them). See +\cgalFigureRef{arr_figcylindrical_decomposition} for an example of a +decomposition into terminal segments. Formally, a terminal segment is +a weakly \f$x\f$-monotone segment that is either vertical, or its +\f$x\f$-range contains no critical point in its interior. \cgalAdvancedEnd \cgalFigureBegin{arr_figcylindrical_decomposition,cylindrical_decomposition.png} -The critical \f$ x\f$-coordinates of an algebraic curve (dashed lines), and its decomposition into terminal segments (in different colors). The segment from \f$ p\f$ to \f$ q\f$ consists of the union of three terminal segments. +The critical \f$x\f$-coordinates of an algebraic curve (dashed +lines), and its decomposition into terminal segments (in different +colors). The segment from \f$p\f$ to \f$q\f$ consists of the union +of three terminal segments. \cgalFigureEnd - Coordinates of points are represented by the type `Algebraic_real_1`, -which is defined in the traits class. -This type is taken from a model of the `AlgebraicKernel_1` concept, -which is also available by the type `Algebraic_kernel_1`. -One can use this model to create algebraic numbers as roots of univariate -polynomials, and process them, for instance, -compare them, or approximate them to any precision. See the documentation -of `AlgebraicKernel_1` for more information. -One can construct an object of type `Point_2` by a triple -(\f$ x_0\f$,cv,i), which means that the \f$ i\f$-th point (counted from below) -in the fiber of cv at the \f$ x\f$-coordinate \f$ x_0\f$ is constructed. -This is also how points are presented internally. -In the example displayed in \cgalFigureRef{arr_figcylindrical_decomposition}, -if \f$ x_1\f$ denotes the \f$ x\f$-coordinate of \f$ p\f$, and \f$ cv\f$ represents the algebraic -curve, then \f$ p\f$ could be represented by \f$ (x_1,cv,3)\f$. If \f$ x_2\f$ -is the \f$ x\f$-coordinate of \f$ q\f$, -then \f$ (x_2,cv,1)\f$ is a valid representation of \f$ q\f$. -Although the \f$ y\f$-coordinate of an object of type `Point_2` can be queried, -we recommend to be careful with that option, since computing an explicit -representation of the \f$ y\f$-coordinate as an `Algebraic_real_1` object -can become rather expensive. +which is defined in the traits class. This type is taken from a model +of the `AlgebraicKernel_1` concept, which is also available by the +type `Algebraic_kernel_1`. One can use this model to create algebraic +numbers as roots of univariate polynomials, and process them, for +instance, compare them, or approximate them to any precision. See the +documentation of `AlgebraicKernel_1` for more information. One can +construct an object of type `Point_2` by a triple \f$(x_0,C,i)\f$, +which means that the \f$i\f$-th point (counted from below) in the +fiber of \f$C\f$ at the \f$x\f$-coordinate \f$x_0\f$ is constructed. +This is also how points are presented internally. In the example +displayed in \cgalFigureRef{arr_figcylindrical_decomposition}, if +\f$x_1\f$ denotes the \f$x\f$-coordinate of \f$p\f$, and \f$C\f$ +represents the algebraic curve, then \f$p\f$ could be represented by +\f$(x_1,C,3)\f$. If \f$x_2\f$ is the \f$x\f$-coordinate of \f$q\f$, +then \f$(x_2,C,1)\f$ is a valid representation of \f$q\f$. Although +the \f$y\f$-coordinate of an object of type `Point_2` can be queried, +we recommend to be careful with that option, since computing an +explicit representation of the \f$y\f$-coordinate as an +`Algebraic_real_1` object can become rather expensive. -\cgalFigureBegin{arr_figex_alg_segments,algebraic_segments.png} -An arrangement of algebraic segments (solid lines), as constructed in `algebraic_segments.cpp`. The supporting curves are drawn in dashed lines. +\cgalFigureBegin{arr_figex_alg_segments,algebraic_segments.png} An +arrangement of algebraic segments (solid lines), as constructed in +`algebraic_segments.cpp`. The supporting curves are drawn in dashed +lines. \cgalFigureEnd The following code exemplifies various methods to construct @@ -2836,87 +3618,98 @@ algebraic segments. The computed arrangement is displayed in \subsection arr_ssecmeta_tr Traits-Class Decorators -Geometric traits-class decorators allow you to attach auxiliary -data to curves and to points. The data is automatically manipulated -by the decorators and distributed to the constructed geometric entities. -Note that additional information can alternatively be maintained by extending -the vertex, halfedge, or face types provided by the \sc{Dcel} class used -by the arrangement; see the details in Section \ref arr_secex_dcel. +Geometric traits-class decorators allow you to attach auxiliary data +to curves and to points. The data is automatically manipulated by the +decorators and distributed to the constructed geometric entities. +Note that additional information can alternatively be maintained by +extending the vertex, halfedge, or face types provided by the +\sc{Dcel} class used by the arrangement; see the details in Section +\ref arr_secex_dcel. The arrangement package includes a generic traits-class decorator -template named -`Arr_curve_data_traits_2`. -This decorator is used to attach a data field to curves and to -\f$ x\f$-monotone curves. It is parameterized by a base-traits class, which is -one of the geometric traits classes described in the previous subsections, or -a user-defined traits class. The curve-data decorator derives itself from the -base-traits class, and in particular inherits its `Point_2` type. -In addition: +template named `Arr_curve_data_traits_2`. This decorator is +used to attach a data field to curves and to \f$x\f$-monotone +curves. It is parameterized by a base-traits class, which is one of +the geometric traits classes described in the previous subsections, or +a user-defined traits class. The curve-data decorator derives itself +from the base-traits class, and in particular inherits its `Point_2` +type. In addition: +
    • `Curve_2` is derived from the basic `BaseTraits::Curve_2` class, extending it by an extra field of type `CurveData`. -
    • `X_monotone_curve_2` is derived from the basic -`BaseTraits::X_monotone_curve_2` class, extending it by an extra field of -type `XMonotoneCurveData`. -
    -Note that the `Curve_2` and `X_monotone_curve_2` are not -the same, even if the `BaseTraits::Curve_2` and -`BaseTraits::X_monotone_curve_2` are (as in the case of the -segment-traits class for example). The extended curve types support the -additional methods `data()` and `set_data()` for -accessing and modifying the data field. -You can create an extended curve (or an extended \f$ x\f$-monotone curve) +
  • `X_monotone_curve_2` is derived from the basic +`BaseTraits::X_monotone_curve_2` class, extending it by an extra field +of type `XMonotoneCurveData`. + +
+Note that the `Curve_2` and `X_monotone_curve_2` are not the same, +even if the `BaseTraits::Curve_2` and `BaseTraits::X_monotone_curve_2` +are (as in the case of the segment-traits class for example). The +extended curve types support the additional methods `data()` and +`set_data()` for accessing and modifying the data field. + +You can create an extended curve (or an extended \f$x\f$-monotone curve) from a basic curve and a curve-data object. When curves are inserted into an arrangement, they may be split, and the decorator handles their data fields automatically:
    -
  • When a curve is subdivided into \f$ x\f$-monotone subcurves, its + +
  • When a curve is subdivided into \f$x\f$-monotone subcurves, its data field of type `CurveData` is converted to an `XMonotoneCurveData` -object \f$ d\f$ using the `Convert` functor. The object \f$ d\f$ is automatically -associated with each of the resulting \f$ x\f$-monotone subcurves. +object \f$d\f$ using the `Convert` functor. The object \f$d\f$ is +automatically associated with each of the resulting \f$x\f$-monotone +subcurves. Note that by default, the `CurveData` type is identical to the -`XMonotoneCurveData` type (and the conversion functor `Convert` -is trivially defined). Thus, the data field associated with the original -curve is just duplicated and stored with the \f$ x\f$-monotone subcurves. -
  • When an \f$ x\f$-monotone curve is split into two, the decorator +`XMonotoneCurveData` type (and the conversion functor `Convert` is +trivially defined). Thus, the data field associated with the original +curve is just duplicated and stored with the \f$x\f$-monotone +subcurves. + +
  • When an \f$x\f$-monotone curve is split into two, the decorator class automatically copies its data field to both resulting subcurves. -
  • When intersecting two \f$ x\f$-monotone curves \f$ c_1\f$ and \f$ c_2\f$, the -result may include overlapping sections, represented as -\f$ x\f$-monotone curves. In this case the data fields of \f$ c_1\f$ and \f$ c_2\f$ -are merged into a single `XMonotoneCurveData` object, -using the `Merge` functor, which is supplied as a -parameter to the traits class-template. The resulting object is -assigned to the data field of the overlapping subcurves. -
  • Merging two \f$ x\f$-monotone curves is allowed only when (i) the two -curves are geometrically mergeable - that is, the base-traits class -allows to merge them - and (ii) the two curves store the same data field. + +
  • When intersecting two \f$x\f$-monotone curves \f$C_1\f$ and +\f$C_2\f$, the result may include overlapping sections, represented as +\f$x\f$-monotone curves. In this case the data fields of \f$C_1\f$ +and \f$C_2\f$ are merged into a single `XMonotoneCurveData` object, +using the `Merge` functor, which is supplied as a parameter to the +traits class-template. The resulting object is assigned to the data +field of the overlapping subcurves. + +
  • Merging two \f$x\f$-monotone curves is allowed only when (i) the +two curves are geometrically mergeable - that is, the base-traits +class allows to merge them - and (ii) the two curves store the same +data field.
The `Arr_consolidated_curve_data_traits_2` decorator specializes the generic curve-data decorator. It extends the basic `BaseTraits::Curve_2` by a single `Data` field, and the basic -`BaseTraits::X_monotone_curve_2` with a set of (distinct) data -objects. The `Data` type is required to support the equality operator, -used to ensure that each set contains only distinct data objects with no -duplicates. -When a curve with a data field \f$ d\f$ is subdivided into \f$ x\f$-monotone subcurves, -each subcurve is associated with a set \f$ S = \{ d \}\f$. In case of an overlap -between two \f$ x\f$-monotone curves \f$ c_1\f$ and \f$ c_2\f$ with associated data sets -\f$ S_1\f$ and \f$ S_2\f$, respectively, the overlapping subcurve is associated with -the consolidated set \f$ S_1 \cup S_2\f$. +`BaseTraits::X_monotone_curve_2` with a set of (distinct) +data objects. The `Data` type is required to support the equality +operator, used to ensure that each set contains only distinct data +objects with no duplicates. When a curve with a data field \f$d\f$ +is subdivided into \f$x\f$-monotone subcurves, each subcurve is +associated with a set \f$S = \{ d \}\f$. In case of an overlap +between two \f$x\f$-monotone curves \f$C_1\f$ and \f$C_2\f$ with +associated data sets \f$S_1\f$ and \f$S_2\f$, respectively, the +overlapping subcurve is associated with the consolidated set \f$S_1 +\cup S_2\f$. -\subsection Arrangement_on_surface_2Examples Examples +\subsubsection Arrangement_on_surface_2Examples Examples \cgalFigureBegin{arr_figex_17,ex_17.png} An arrangement of six red and blue segments, as constructed in `consolidated_curve_data.cpp`. Disks correspond to red-blue intersection points, while circles mark the endpoints of red-blue overlaps. \cgalFigureEnd In the following example, we use `Arr_segment_traits_2` as our -base-traits class, attaching an additional color field to +base-traits class, attaching an additional color field to the segments using the consolidated curve-data traits class. A -color may be either blue or red. Having constructed +color may be either blue or red. Having constructed the arrangement of colored segments, as depicted in \cgalFigureRef{arr_figex_17}, we detect the vertices that have incident edges mapped to both blue and red segments. Thus, they correspond @@ -2929,32 +3722,43 @@ corresponds to overlaps between red and blue line segments: An arrangement of four polylines, named A-D, as constructed in `generic_curve_data.cpp`. \cgalFigureEnd -In the following example, we use `Arr_polyline_traits_2` as -our base-traits class, attaching an additional name field to -each polyline using the generic curve-data traits class. In case of +In the following example, we use `Arr_polyline_traits_2` as our +base-traits class, attaching an additional name field to each +polyline using the generic curve-data traits class. In case of overlaps, we simply concatenate the names of the overlapping -polylines. Also notice how we replace the curve associated with -the edges that correspond to overlapping polylines with -geometrically equivalent curves, but with a different data fields: +polylines. Also notice how we replace the curve associated with the +edges that correspond to overlapping polylines with geometrically +equivalent curves, but with a different data fields: \cgalExample{Arrangement_on_surface_2/generic_curve_data.cpp} The third example we give in this section is based on `dual_lines.cpp` -given in Section \ref arr_ssecunb_global. It constructs the arrangement -of the dual lines for a set of point given in an input file (by default we -use `coll_points.dat`, which contains \f$ 50\f$ points randomly selected -on the grid \f$ [-100,100]\times[-100,100]\f$; the file contains two distinct -triplets of collinear points). Here we use the generic curve-data -decorator to attach the index of the primal point to each of the lines. -Doing so, we can go over the incident edges of each vertex whose degree is -greater than \f$ 4\f$ and report the subsets collinear points (if we have a vertex -of degree \f$ d\f$, we actually need to go over \f$ \frac{d}{2}\f$ edges, as each -incident line contributes exactly \f$ 2\f$ edges). Note that in this case the -dual line cannot overlap, so we use a dummy merge functor to instantiate -the curve-data traits: +given in Section \ref arr_ssecunb_global. It constructs the +arrangement of the dual lines for a set of point given in an input +file (by default we use `coll_points.dat`, which contains \f$50\f$ +points randomly selected on the grid \f$[-100,100]\times[-100,100]\f$; +the file contains two distinct triplets of collinear points). Here we +use the generic curve-data decorator to attach the index of the primal +point to each of the lines. Doing so, we can go over the incident +edges of each vertex whose degree is greater than \f$4\f$ and report +the subsets collinear points (if we have a vertex of degree \f$d\f$, +we actually need to go over \f$\frac{d}{2}\f$ edges, as each incident +line contributes exactly \f$2\f$ edges). Note that in this case the +dual line cannot overlap, so we use a dummy merge functor to +instantiate the curve-data traits: \cgalExample{Arrangement_on_surface_2/dual_with_data.cpp} +\section aos_sec-topol_traits The Topology Traits + +At this point we do not expose the topology traits concept. The +package contains one topology traits, namely, +`Arr_spherical_topology_traits_2`. It can be served as a topology +traits for an arrangement embeded on a sphere. More precisely, for an +arrangement embeded on a sphere defined over a parameter space the +left and right boundary sides of which are identified and the top and +bottom boundary sides are contracted. + \section arr_secnotif The Notification Mechanism For some applications it is essential to know exactly what @@ -2965,15 +3769,15 @@ Other important examples are the point-location strategies that require auxiliary data-structures (see Section \ref arr_ssecpl), which must be notified on various local changes in the arrangement, in order to keep their data structures up-to-date. The arrangement -package offers a mechanism that uses observers +package offers a mechanism that uses observers (see \cgalCite{cgal:ghjv-dpero-95}) that can be attached to an arrangement instance and receive notifications about the changes this arrangement goes through. The `Arr_observer` class-template is parameterized with an arrangement class. It stores a pointer to an -arrangement object, and is capable of receiving notifications just before a structural change occurs in the arrangement and -immediately after such a change takes place. +arrangement object, and is capable of receiving notifications just before a structural change occurs in the arrangement and +immediately after such a change takes place. `Arr_observer` serves as a base class for other observer classes and defines a set of virtual notification functions, with default empty implementations. @@ -2994,8 +3798,11 @@ topological structure. Most notifier functions belong to this category. The relevant local changes include:
  • A new vertex is constructed and associated with a point. -
  • An edge\cgalFootnote{The term "edge" refers here to a pair of twin half-edges.} is constructed and associated with an \f$ x\f$-monotone + +
  • An edge\cgalFootnote{The term "edge" refers here to a pair of twin +half-edges.} is constructed and associated with an \f$x\f$-monotone curve. +
  • An edge is split into two edges.
  • An existing face is split into two faces, as a consequence of the insertion of a new edge. @@ -3028,10 +3835,10 @@ notification functions. Each arrangement object stores a (possibly empty) list of pointers to `Arr_observer` objects, and whenever one of the structural changes listed in the first two categories above is about to take -place, the arrangement object performs a forward traversal +place, the arrangement object performs a forward traversal on this list and invokes the appropriate function of each observer. After the change takes place the observer list is -traversed in a backward manner (from tail to head), and the +traversed in a backward manner (from tail to head), and the appropriate notification function is invoked for each observer. This allows the nesting of observer objects. @@ -3053,7 +3860,10 @@ the relevant notification functions, as required by their applications. \cgalFigureBegin{arr_figex_19,ex_19.png} -An arrangement of five line segments, as constructed in `observer.cpp`. The halfedge \f$ e_v\f$ (dashed) is eventually removed, so that the final arrangement consists of four faces (one unbounded and three bounded ones). +An arrangement of five line segments, as constructed in `observer.cpp`. +The halfedge \f$e_v\f$ (dashed) is eventually removed, so that the +final arrangement consists of four faces (one unbounded and three +bounded ones). \cgalFigureEnd The following example shows how to define and use an observer @@ -3087,30 +3897,31 @@ of fact, it is possible to conveniently extend all \sc{Dcel} records (namely vertices, halfedges and faces), which can also be advantageous for some applications. -All examples presented so far use the default `Arr_default_dcel`. -This is done implicitly, as this class serves as a default parameter for -the `Arrangement_2` template. The default \sc{Dcel} class just associates -points with vertices and \f$ x\f$-monotone curves with halfedge, but nothing more. -In this section we show how to use alternative \sc{Dcel} types to extend the +All examples presented so far use the default +`Arr_default_dcel`. This is done implicitly, as this class +serves as a default parameter for the `Arrangement_2` template. The +default \sc{Dcel} class just associates points with vertices and +\f$x\f$-monotone curves with halfedge, but nothing more. In this +section we show how to use alternative \sc{Dcel} types to extend the desired \sc{Dcel} records. \subsection arr_ssecex_dcel_face Extending the DCEL Faces -The `Arr_face_extended_dcel` class-template -is used to associate auxiliary data field of type `FaceData` to -each face record in the \sc{Dcel}. +The `Arr_face_extended_dcel` class-template is used +to associate auxiliary data field of type `FaceData` to each face +record in the \sc{Dcel}. -When an `Arrangement_2` object is parameterized by this -\sc{Dcel} class, its nested `Face` type is extended with the access function +When an `Arrangement_2` object is parameterized by this \sc{Dcel} +class, its nested `Face` type is extended with the access function `data()` and with the modifier `set_data()`. Using these extra functions it is straightforward to access and maintain the auxiliary face-data field. Note that the extra data fields must be maintained by the application -programmers. They may choose to construct their arrangement, and -only then go over the faces and attach the appropriate data fields to -the arrangement faces. However, in some cases the face data can only -be computed when the face is created (split from another face, or merged +programmers. They may choose to construct their arrangement, and only +then go over the faces and attach the appropriate data fields to the +arrangement faces. However, in some cases the face data can only be +computed when the face is created (split from another face, or merged with another face). In such cases one can use an arrangement observer tailored for this task, which receives updates whenever a face is modified and sets its data field accordingly. @@ -3121,12 +3932,16 @@ An arrangement of six line segments, as constructed in `face_extension.cpp` and The next example constructs an arrangement that contains seven bounded -faces induced by six line segments (see \cgalFigureRef{arr_figex_20}). An -observer gets notified each time a new face \f$ f\f$ is created and it associates -\f$ f\f$ with a running index, (where the index of the unbounded face -is 0). As a result, the faces are numbered according to their creation -order, as one can easily verify by examining the insertion order of the -segments:\cgalFootnote{For simplicity, the particular observer used must be attached to an empty arrangement. It is not difficult however to modify the program to handle the general case of attaching a similar observer to a non-empty arrangement.} +faces induced by six line segments (see +\cgalFigureRef{arr_figex_20}). An observer gets notified each time a +new face \f$f\f$ is created and it associates \f$f\f$ with a running +index, (where the index of the unbounded face is 0). As a result, the +faces are numbered according to their creation order, as one can +easily verify by examining the insertion order of the +segments:\cgalFootnote{For simplicity, the particular observer used +must be attached to an empty arrangement. It is not difficult however +to modify the program to handle the general case of attaching a +similar observer to a non-empty arrangement.} \cgalExample{Arrangement_on_surface_2/face_extension.cpp} @@ -3152,11 +3967,11 @@ direction of its associated segment (in this example segments are treated as directed objects). Each face is also extended to store the size of its outer boundary. -The constructed arrangement, depicted in \cgalFigureRef{arr_figex_20}, is -similar to the arrangement constructed in the previous example. -Note that all auxiliary data fields are set during the construction phase. -Also note that the data fields are properly maintained when the arrangement -is copied to another arrangement instance: +The constructed arrangement, depicted in \cgalFigureRef{arr_figex_20}, +is similar to the arrangement constructed in the previous example. +Note that all auxiliary data fields are set during the construction +phase. Also note that the data fields are properly maintained when +the arrangement is copied to another arrangement instance: \cgalExample{Arrangement_on_surface_2/dcel_extension.cpp} @@ -3181,48 +3996,48 @@ locate, for example, the regions where there is a pine forest and the annual precipitation is between 1000mm and 1500mm. Computing the overlay of two planar arrangement is also useful for -supporting Boolean set operations on polygons (or generalized polygons, -see, e.g., \cgalCite{cgal:behhms-cbcab-02}). +supporting Boolean set operations on polygons (or generalized +polygons, see, e.g., \cgalCite{cgal:behhms-cbcab-02}). -The function `overlay (arr_a, arr_b, ovl_arr, ovl_traits)` accepts -two input arrangement instances `arr_a` and `arr_b`, and constructs -their overlay instance `ovl_arr`. All three arrangements must use the -same geometric primitives. More precisely, let `arr_a` be of -type `Arrangement_2`, `arr_b` be of type -`Arrangement_2` and the resulting `ovl_arr` be of type -`Arrangement_2`. All types nested in geometry -traits `Traits_A`, e.g., `Point_2` and -`X_monotone_curve_2`, must be convertible to the corresponding -types nested in geometry traits `Traits_R`. The same holds for all -types nested in geometry traits `Traits_B`. -The `ovl_traits` parameter is -an instance of an overlay traits-class, which enables the creation of -`Dcel_R` records in the overlaid arrangement from the \sc{Dcel} features -of `arr_a` and `arr_b` that they correspond to. +The function `overlay (arr_a, arr_b, ovl_arr, ovl_traits)` accepts two +input arrangement instances `arr_a` and `arr_b`, and constructs their +overlay instance `ovl_arr`. All three arrangements must use the same +geometric primitives. More precisely, let `arr_a` be of type +`Arrangement_2`, `arr_b` be of type +`Arrangement_2` and the resulting `ovl_arr` be of +type `Arrangement_2`. All types nested in geometry +traits `Traits_A`, e.g., `Point_2` and `X_monotone_curve_2`, must be +convertible to the corresponding types nested in geometry traits +`Traits_R`. The same holds for all types nested in geometry traits +`Traits_B`. The `ovl_traits` parameter is an instance of an +overlay traits-class, which enables the creation of `Dcel_R` +records in the overlaid arrangement from the \sc{Dcel} features of +`arr_a` and `arr_b` that they correspond to. In principle, we distinguish between three levels of overlay:
    -
    Simple overlay:
    -An overlay of two arrangements that store no additional data -with their \sc{Dcel} records. That is, they are defined using the default +
    Simple overlay: + +
    An overlay of two arrangements that store no additional data with +their \sc{Dcel} records. That is, they are defined using the default \sc{Dcel} class `Arr_default_dcel`. Typically, the overlaid -arrangement in this case stores no extra data with its \sc{Dcel} records as -well (or if it does, the additional data fields cannot be computed by -the overlay operation), so by overlaying the two arrangement we just -compute the arrangement of all curves that induce `arr_a` and `arr_b`. -Note that the same result can be obtained using the standard insertion -operations, but users may choose to use overlay computation in order to -achieve better running times. +arrangement in this case stores no extra data with its \sc{Dcel} +records as well (or if it does, the additional data fields cannot be +computed by the overlay operation), so by overlaying the two +arrangement we just compute the arrangement of all curves that induce +`arr_a` and `arr_b`. Note that the same result can be obtained using +the standard insertion operations, but users may choose to use overlay +computation in order to achieve better running times. The `Arr_default_overlay_traits` class should be used as an overlay traits-class for such simple overlay operations. -
    Face overlay:
    -An overlay of two arrangements that store additional data -fields with their faces (e.g., the geographic-map example -given in the beginning of this section). The resulting overlaid arrangement +
    Face overlay: +
    An overlay of two arrangements that store additional +data fields with their faces (e.g., the geographic-map example given +in the beginning of this section). The resulting overlaid arrangement typically also stores extraneous data fields with its faces, where the -data field that is attached to an overlaid face can be computed from the -data fields of the two faces (in `arr_a` and `arr_b`) that induce +data field that is attached to an overlaid face can be computed from +the data fields of the two faces (in `arr_a` and `arr_b`) that induce the overlaid face. The `Arr_face_overlay_traits` class should be used as an overlay @@ -3234,13 +4049,14 @@ face-data fields of types `Dcel_A::Face_data` and `Dcel_B::Face_data`, and computing the output `Dcel_R::Face_data` object. The overlay traits-class uses this functor to properly construct the overlaid faces. -
    Full overlay:
    -An overlay of two arrangements that store additional data -fields with all their \sc{Dcel} records. That is, their \sc{Dcel} classes -are instantiations of the `Arr_extended_dcel` class-template (see -Section \ref arr_ssecex_dcel_all), where the resulting arrangement -also extends it \sc{Dcel} records with data fields computed on the basis -of the overlapping \sc{Dcel} features of the two input arrangements. + +
    Full overlay: +
    An overlay of two arrangements that store additional data fields +with all their \sc{Dcel} records. That is, their \sc{Dcel} classes are +instantiations of the `Arr_extended_dcel` class-template (see Section +\ref arr_ssecex_dcel_all), where the resulting arrangement also +extends it \sc{Dcel} records with data fields computed on the basis of +the overlapping \sc{Dcel} features of the two input arrangements.
    In the following subsections we give some examples for the simple and the @@ -3252,7 +4068,11 @@ concept. The details of this concept are given in the Reference Manual. \subsection arr_ssecsimp_ovl Example for a Simple Overlay \cgalFigureBegin{arr_figex_22,ex_22.png} -Overlaying two simple arrangements of line segments, as done in `overlay.cpp` and `ex_face_extension_overlay.cpp`. In `face_extension_overlay.cpp` the two bounded faces are considered as marked, and the octagonal face which is the intersection of the two marked faces is denoted by \f$ f_0\f$. +Overlaying two simple arrangements of line segments, as done in +`overlay.cpp` and `ex_face_extension_overlay.cpp`. In +`face_extension_overlay.cpp` the two bounded faces are considered as +marked, and the octagonal face which is the intersection of +the two marked faces is denoted by \f$f_0\f$. \cgalFigureEnd The next program constructs two simple arrangements, as depicted in @@ -3262,62 +4082,68 @@ The next program constructs two simple arrangements, as depicted in \subsection arr_ssecface_ovl Examples for a Face Overlay -The following example shows how to compute the intersection of two polygons -using the `overlay()` function. It uses a face-extended \sc{Dcel} class -to define our arrangement class. The \sc{Dcel} extends each face with a Boolean -flag. A polygon is represented as a marked arrangement face, (whose -flag is set). The example uses a face-overlay traits class, instantiated with -a functor that simply performs a logical and operations on Boolean flags. +The following example shows how to compute the intersection of two +polygons using the `overlay()` function. It uses a face-extended +\sc{Dcel} class to define our arrangement class. The \sc{Dcel} extends +each face with a Boolean flag. A polygon is represented as a +marked arrangement face, (whose flag is set). The example +uses a face-overlay traits class, instantiated with a functor that +simply performs a logical and operations on Boolean flags. As a result, a face in the overlaid arrangement is marked only when it corresponds to an overlapping region of two marked cells in the input -arrangements. Namely, it is part of the intersection of the two polygons. +arrangements. Namely, it is part of the intersection of the two +polygons. -The example computes the intersection between a square and a rhombus, (which is -actually also a square). The resulting polygon is an octagon, denoted -by \f$ f_0\f$ in \cgalFigureRef{arr_figex_22} : +The example computes the intersection between a square and a rhombus, +(which is actually also a square). The resulting polygon is an +octagon, denoted by \f$f_0\f$ in \cgalFigureRef{arr_figex_22} : \cgalExample{Arrangement_on_surface_2/face_extension_overlay.cpp} -The next example demonstrates the face overlay of two arrangements that -have unbounded faces as well. The first arrangement is formed by the two lines -\f$ y = x\f$ and \f$ y = -x\f$, that subdivide the plane into four unbounded faces, -denoted \f$ A\f$, \f$ B\f$, \f$ C\f$ and \f$ D\f$. The second arrangement comprises four line -segments that form a square-shaped face. When we overlay the two arrangements, -each of the four faces \f$ A\f$, \f$ B\f$, \f$ C\f$ and \f$ D\f$ is split into an unbounded -face (indexed 1) and a bounded face (indexed 2): +The next example demonstrates the face overlay of two arrangements +that have unbounded faces as well. The first arrangement is formed by +the two lines \f$y = x\f$ and \f$y = -x\f$, that subdivide the plane +into four unbounded faces, denoted \f$A\f$, \f$B\f$, \f$C\f$ and +\f$D\f$. The second arrangement comprises four line segments that +form a square-shaped face. When we overlay the two arrangements, each +of the four faces \f$A\f$, \f$B\f$, \f$C\f$ and \f$D\f$ is split +into an unbounded face (indexed 1) and a bounded face (indexed 2): \cgalExample{Arrangement_on_surface_2/overlay_unbounded.cpp} \section arr_secarr_with_hist Storing the Curve History -As stated at the beginning of this chapter (Section \ref arr_secintro), -when one constructs an arrangement induced by a set \f$ \cal C\f$ of arbitrary -planar curves, she or he constructs a collection \f$ \cal C''\f$ of \f$ x\f$-monotone -subcurves of \f$ \cal C\f$ that are pairwise disjoint in their interior, and these -subcurves are associated with the arrangement edges (more precisely, with the -\sc{Dcel} halfedges). Doing so, the connection between the originating input -curves and the arrangement edges is lost. This loss might be acceptable for -some applications. However, in many practical cases it is important to -determine the input curves that give rise to the final subcurves. +As stated at the beginning of this chapter (Section \ref +aos_sec-intro), when one constructs an arrangement induced by a set +\f$\cal C\f$ of arbitrary planar curves, she or he constructs a +collection \f$\cal C''\f$ of \f$x\f$-monotone subcurves of \f$\cal +C\f$ that are pairwise disjoint in their interior, and these subcurves +are associated with the arrangement edges (more precisely, with the +\sc{Dcel} halfedges). Doing so, the connection between the originating +input curves and the arrangement edges is lost. This loss might be +acceptable for some applications. However, in many practical cases it +is important to determine the input curves that give rise to the final +subcurves. The `Arrangement_with_history_2` class-template extends the `Arrangement_2` class by keeping an additional container of input -curves representing \f$ \cal C\f$, and by maintaining a cross-mapping between these -curves and the arrangement edges they induce. The traits class that is -used for instantiating the template should be a model of the -`ArrangementTraits_2` concept (see Section \ref arr_sssecinsert_gen). -That is, it should define the `Curve_2` type (and not just the -`X_monotone_curve_2` type). The `Dcel` parameter should model the -`ArrangementDcel` concept. Users can use the default \sc{Dcel} class or -an extended \sc{Dcel} class according to their needs. +curves representing \f$\cal C\f$, and by maintaining a cross-mapping +between these curves and the arrangement edges they induce. The traits +class that is used for instantiating the template should be a model of +the `ArrangementTraits_2` concept (see Section \ref +aos_ssec-insert_gen). That is, it should define the `Curve_2` type +(and not just the `X_monotone_curve_2` type). The `Dcel` parameter +should model the `ArrangementDcel` concept. Users can use the default +\sc{Dcel} class or an extended \sc{Dcel} class according to their +needs. \subsection arr_ssecarrwh_traverse Traversing an Arrangement with History The `Arrangement_with_history_2` class extends the `Arrangement_2` -class, thus all the iterator and circulator types that are defined by the -arrangement class are also available in `Arrangement_with_history_2`. -The reader is referred to Section \ref arr_ssectraverse for a comprehensive -review of these functions. +class, thus all the iterator and circulator types that are defined by +the arrangement class are also available in +`Arrangement_with_history_2`. The reader is referred to Section \ref +arr_ssectraverse for a comprehensive review of these functions. As mentioned above, the `Arrangement_with_history_2` class maintains a container of input curves, which can be accessed using curve handles. @@ -3370,54 +4196,56 @@ to maintain any type of auxiliary data stored with the \sc{Dcel} features As the `Arrangement_with_history_2` class extends the `Arrangement_2` class, it inherits the fundamental modification operations, such as `assign()` and `clear()`, from it. The vertex-manipulation functions -are also inherited and supported (see Sections \ref arr_sssecmf_iso_verts -and \ref arr_sssecinsert_point for the details). However, there are some -fundamental differences between the interfaces of the two classes, which we -highlight in this subsection. +are also inherited and supported (see Sections \ref +arr_sssecmf_iso_verts and \ref arr_sssecinsert_point for the +details). However, there are some fundamental differences between the +interfaces of the two classes, which we highlight in this subsection. -The most significant difference between the arrangement-with-history class -and the basic arrangement class is the way they handle their input curves. -`Arrangement_with_history_2` always stores the `Curve_2` objects -that induce it, thus it is impossible to insert \f$ x\f$-monotone curves into -an arrangement with history. The free `insert_non_intersecting_curve()` -and `insert()` that receives \f$ x\f$-monotone curve (as well as -their aggregated versions) are therefore not available for -arrangement-with-history instances and only the free -`insert()` and `insert()` functions that receive +The most significant difference between the arrangement-with-history +class and the basic arrangement class is the way they handle their +input curves. `Arrangement_with_history_2` always stores the +`Curve_2` objects that induce it, thus it is impossible to insert +\f$x\f$-monotone curves into an arrangement with history. The free +`insert_non_intersecting_curve()` and `insert()` that receives +\f$x\f$-monotone curve (as well as their aggregated versions) are +therefore not available for arrangement-with-history instances and +only the free `insert()` and `insert()` functions that receive `Curve_2` (the incremental insertion function and the aggregated -insertion function) are supported - see also -Section \ref arr_sssecinsert_gen. Notice however that while the -incremental insertion function `insert(arr,c)` for an -`Arrangement_2` object `arr` does not have a return value, the -corresponding arrangement-with-history function returns a -`Curve_handle` to the inserted curve. +insertion function) are supported - see also Section \ref +aos_ssec-insert_gen. Notice however that while the incremental +insertion function `insert(arr,c)` for an `Arrangement_2` object `arr` +does not have a return value, the corresponding +arrangement-with-history function returns a `Curve_handle` to the +inserted curve. -As we are able to keep track of all edges induced by an input curve, we also -provide a free function that removes a curve from an arrangement. By calling -`remove(arr,ch)`, where `ch` is a valid curve handle, the given curve -is deleted from the curve container, and all edges induced solely by -this curve (i.e., excluding overlapping edges) are removed from the -arrangement. The function returns the number of edges that have been removed. +As we are able to keep track of all edges induced by an input curve, +we also provide a free function that removes a curve from an +arrangement. By calling `remove(arr,ch)`, where `ch` is a valid curve +handle, the given curve is deleted from the curve container, and all +edges induced solely by this curve (i.e., excluding overlapping edges) +are removed from the arrangement. The function returns the number of +edges that have been removed. -In some cases, users may need to operate directly on the arrangement edges. -We first mention that the specialized insertion functions (see +In some cases, users may need to operate directly on the arrangement +edges. We first mention that the specialized insertion functions (see Section \ref arr_sssecmf_insert_cv) are not supported, as they accept -\f$ x\f$-monotone curves. Insertion can only be performed via the free -insertion-functions. The other edge-manipulation functions -(see Section \ref arr_sssecmf_halfedges) are however available, but have -a different interface that does not use \f$ x\f$-monotone curves: +\f$x\f$-monotone curves. Insertion can only be performed via the free +insertion-functions. The other edge-manipulation functions (see +Section \ref arr_sssecmf_halfedges) are however available, but have a +different interface that does not use \f$x\f$-monotone curves: +
      +
    • Invoking `split_edge(e,p)` splits the edge `e` at a given point -`p` that lies in its interior. -
    • Invoking `merge_edge(e1,e2)` merges the two given edges. There is -a precondition that `e1` and `e2` shared a common end-vertex of degree -2, and that the \f$ x\f$-monotone subcurves associated with these edges are -mergeable. -
    • It is possible to remove an edge by simply invoking -`remove_edge(e)`. +`p` that lies in its interior.
    • Invoking `merge_edge(e1,e2)` +merges the two given edges. There is a precondition that `e1` and `e2` +shared a common end-vertex of degree 2, and that the \f$x\f$-monotone +subcurves associated with these edges are mergeable.
    • It is +possible to remove an edge by simply invoking `remove_edge(e)`.
    -In all cases, the maintenance of cross-pointers for the appropriate input -curves will be done automatically. + +In all cases, the maintenance of cross-pointers for the appropriate +input curves will be done automatically. It should be noted that it is possible to attach observers to an arrangement-with-history instance in order to get detailed notifications of @@ -3427,33 +4255,34 @@ the details). \subsection arr_ssecarr_hist_ex Examples \cgalFigureBegin{arr_figex_24,ex_24.png} -An arrangement with history as constructed in `curve_history.cpp`. Note that \f$ s_1\f$ and \f$ s_3\f$ overlap over two edges. The point-location query points are drawn as lightly shaded dots. +An arrangement with history as constructed in `curve_history.cpp`. Note that \f$s_1\f$ and \f$s_3\f$ overlap over two edges. The point-location query points are drawn as lightly shaded dots. \cgalFigureEnd In the following example we construct a simple arrangement of six line -segments, as depicted in \cgalFigureRef{arr_figex_24}, while maintaining -the curve history. The example demonstrates the usage of the special -traversal functions. It also shows how to issue point-location queries -on the resulting arrangement, using the auxiliary function -`locate_point()` defined in the header file +segments, as depicted in \cgalFigureRef{arr_figex_24}, while +maintaining the curve history. The example demonstrates the usage of +the special traversal functions. It also shows how to issue +point-location queries on the resulting arrangement, using the +auxiliary function `locate_point()` defined in the header file `point_location_utils.h`; see also Section \ref arr_ssecpl. \cgalExample{Arrangement_on_surface_2/curve_history.cpp} \cgalFigureBegin{arr_figex_25,ex_25.png} -An arrangement with history of nine circle as constructed in `edge_manipulation_curve_history.cpp`. Note the vertical tangency points of \f$ C_0\f$, marked as dark dots, which subdivide this circle into an upper half and a lower half, each consists of 9 edges. The large circle \f$ C_0\f$ is eventually removed from the arrangement, with all 18 edges it induces. +An arrangement with history of nine circle as constructed in `edge_manipulation_curve_history.cpp`. Note the vertical tangency points of \f$C_0\f$, marked as dark dots, which subdivide this circle into an upper half and a lower half, each consists of 9 edges. The large circle \f$C_0\f$ is eventually removed from the arrangement, with all 18 edges it induces. \cgalFigureEnd The following example demonstrates the usage of the free `remove()` -function. We construct an arrangement of nine circles, while keeping a handle -to each inserted circle. We then remove the large circle \f$ C_0\f$, which induces -\f$ 18\f$ edges, as depicted in \cgalFigureRef{arr_figex_25}. The example also shows -how to use the `split_edge()` and `merge_edge()` functions when -operating on an arrangement-with-history instance: +function. We construct an arrangement of nine circles, while keeping a +handle to each inserted circle. We then remove the large circle +\f$C_0\f$, which induces \f$18\f$ edges, as depicted in +\cgalFigureRef{arr_figex_25}. The example also shows how to use the +`split_edge()` and `merge_edge()` functions when operating on an +arrangement-with-history instance: \cgalExample{Arrangement_on_surface_2/edge_manipulation_curve_history.cpp} -\section arr_secio Input/Output Streams +\section aos_sec-io Input/Output Streams In some cases, one would like to save an arrangement object constructed by some application, so that later on it can be @@ -3461,7 +4290,7 @@ restored. In other cases one would like to create nice drawings that represent arrangements constructed by some application. These drawings can be hard printed or displayed on a computer screen. -\subsection arr_ssecio_stream Input/Output Stream +\subsection aos_ssec-io-stream Input/Output Stream Consider an arrangement that represents a very complicated geographical map, and assume that there are various applications that need to answer @@ -3471,23 +4300,23 @@ to construct the arrangement from scratch each time you need to reuse it. A more efficient solution is to write the arrangement to a file in a format that other applications can read. -This package provides an inserter (the `<<` operator) and an -extractor (the `>>` operator) for the +This package provides an inserter (the `<<` operator) and an +extractor (the `>>` operator) for the `Arrangement_2` class that inserts and an arrangement -object into an output stream and extracts an arrangement object from an -input stream respectively. The arrangement is written using a simple -predefined ASCII format that encodes the arrangement topology, as well -as all geometric entities associated with vertices and edges. +object into an output stream and extracts an arrangement object from +an input stream respectively. The arrangement is written using a +simple predefined ASCII format that encodes the arrangement topology, +as well as all geometric entities associated with vertices and edges. The ability to use the input/output operators, requires that the -`Point_2` type and the `X_monotone_curve_2` type defined by the -traits class both support the `<<` and `>>` operators. The +`Point_2` type and the `X_monotone_curve_2` type defined by the traits +class both support the `<<` and `>>` operators. The `Arr_conic_traits_2` class (see Section \ref arr_ssectr_conic), the -`Arr_rational_function_traits_2` class (see Section \ref arr_ssectr_ratfunc), -and the `Arr_linear_traits_2` class (see Section \ref arr_ssectr_segs) -currently do not provide these operators for the geometric types they define. -Thus, only arrangements of line segments or of polylines can be written or -read. +`Arr_rational_function_traits_2` class (see Section \ref +arr_ssectr_ratfunc), and the `Arr_linear_traits_2` class (see Section +\ref arr_ssectr_segs) currently do not provide these operators for the +geometric types they define. Thus, only arrangements of line segments +or of polylines can be written or read. The following example constructs the arrangement depicted in \cgalFigureRef{arr_figex_5} and writes it to an output file. It also @@ -3534,11 +4363,10 @@ and faces, provided that the `VertexData`, `HalfedgeData` and `FaceData` classed all have inserters and extractors.
-The following example constructs the same arrangement as the -example `dcel_extension` does -(see Section \ref arr_ssecex_dcel_all), depicted in -\cgalFigureRef{arr_figex_20}, and writes it to an output file. It also -demonstrates how to re-read the arrangement from a file: +The following example constructs the same arrangement as the example +`dcel_extension` does (see Section \ref arr_ssecex_dcel_all), depicted +in \cgalFigureRef{arr_figex_20}, and writes it to an output file. It +also demonstrates how to re-read the arrangement from a file: \cgalExample{Arrangement_on_surface_2/dcel_extension_io.cpp} @@ -3564,8 +4392,8 @@ The arrangement package supplies an inserter and an extractor for the represented using a simple predefined ASCII format. An object of the `Arrangement_with_history_2` type can be saved and restored, as long as the `Curve_2` type defined by the traits -class - as well as the `Point_2` type and the `X_monotone_curve_2` -types - support the `<<` and`>>` operators. +class---as well as the `Point_2` type and the `X_monotone_curve_2` +types---support the `<<` and`>>` operators. The following example constructs the same arrangement as example `curve_history` does @@ -3586,7 +4414,7 @@ an arrangement formatter class (see Section \ref arr_ssecarr_io_aux_data) and defines a simple textual input/output format. \cgalAdvancedEnd -\section arr_secbgl Adapting to Boost Graphs +\section aos_sec-bgl Adapting to Boost Graphs Boost\cgalFootnote{See also Boost's homepage at: www.boost.org.} is a collection of portable \cpp libraries that extend the Standard Template Library (Stl). The Boost Graph Library (bgl), which one of the libraries in the collection, offers an @@ -3596,135 +4424,149 @@ natural to extend the underlying data structure with the interface that the bgl expects, and gain the ability to perform the operations that the bgl supports, such as shortest-path computation. This section describes how apply the graph algorithms implemented in the bgl to `Arrangement_2` instances. -An instance of `Arrangement_2` is adapted to a Boost graph through the -provision of a set of free functions that operate on the arrangement features -and conform with the relevant BGL concepts. Besides the straightforward -adaptation, which associates a vertex with each \sc{Dcel} vertex and an edge -with each \sc{Dcel} halfedge, the package also offer a dual adaptor, which -associates a graph vertex with each \sc{Dcel} face, such that two vertices are -connected, iff there is a \sc{Dcel} halfedge that connects the two corresponding -faces. +An instance of `Arrangement_2` is adapted to a Boost graph through the provision of a set of +free functions that operate on the arrangement features and conform +with the relevant BGL concepts. Besides the straightforward +adaptation, which associates a vertex with each \sc{Dcel} vertex and +an edge with each \sc{Dcel} halfedge, the package also offer a +dual adaptor, which associates a graph vertex with each +\sc{Dcel} face, such that two vertices are connected, iff there is a +\sc{Dcel} halfedge that connects the two corresponding faces. \subsection arr_ssecbgl_primal The Primal Arrangement Representation -Arrangement instances are adapted to Boost graphs by specializing the -\link BGLArgtGT `boost:graph_traits` \endlink template for `Arrangement_2` instances. The -graph-traits states the graph concepts that the arrangement class models -(see below) and defines the types required by these concepts. +Arrangement instances are adapted to Boost +graphs by specializing the \link BGLArgtGT `boost:graph_traits` +\endlink template for `Arrangement_2` instances. The graph-traits +states the graph concepts that the arrangement class models (see +below) and defines the types required by these concepts. In this specialization the `Arrangement_2` vertices correspond to the -graph vertices, where two vertices are adjacent if there is at least one -halfedge connecting them. More precisely, `Arrangement_2::Vertex_handle` -is the graph-vertex type, while `Arrangement_2::Halfedge_handle` is the -graph-edge type. As halfedges are directed, we consider the graph to be -directed as well. Moreover, as several interior-disjoint \f$ x\f$-monotone curves -(say circular arcs) may share two common endpoints, inducing an arrangement -with two vertices that are connected with several edges, we allow parallel +graph vertices, where two vertices are adjacent if there is at least +one halfedge connecting them. More precisely, +`Arrangement_2::Vertex_handle` is the graph-vertex type, while +`Arrangement_2::Halfedge_handle` is the graph-edge type. As halfedges +are directed, we consider the graph to be directed as well. Moreover, +as several interior-disjoint \f$x\f$-monotone curves (say circular +arcs) may share two common endpoints, inducing an arrangement with two +vertices that are connected with several edges, we allow parallel edges in our Boost graph. Given an `Arrangement_2` instance, we can efficiently traverse its -vertices and halfedges. Thus, the arrangement graph is a model of the concepts -`VertexListGraph` and `EdgeListGraph` introduced by the bgl. -At the same time, we use an iterator adapter of the circulator over the -halfedges incident to a vertex (`Halfedge_around_vertex_circulator` - see -Section \ref arr_sssectr_vertex), so it is possible to go over the ingoing -and outgoing edges of a vertex in linear time. Thus, our arrangement graph +vertices and halfedges. Thus, the arrangement graph is a model of the +concepts `VertexListGraph` and `EdgeListGraph` introduced by the bgl. At the same time, we use an iterator +adapter of the circulator over the halfedges incident to a vertex +(`Halfedge_around_vertex_circulator` - see Section \ref +arr_sssectr_vertex), so it is possible to go over the ingoing and +outgoing edges of a vertex in linear time. Thus, our arrangement graph is a model of the concept `BidirectionalGraph` (this concept refines -`IncidenceGraph`, which requires only the traversal of outgoing edges). +`IncidenceGraph`, which requires only the traversal of outgoing +edges). It is important to notice that the vertex descriptors we use are -`Vertex_handle` objects and not vertex indices. However, in order -to gain more efficiency in most bgl algorithm, it is better to have them -indexed \f$ 0, 1, \ldots, (n-1)\f$, where \f$ n\f$ is the number of vertices. We -therefore introduce the `Arr_vertex_index_map` class-template, -which maintains a mapping of vertex handles to indices, as required by the -bgl. An instance of this class must be attached to a valid arrangement -vertex when it is created. It uses the notification mechanism (see -Section \ref arr_secnotif) to automatically maintain the mapping of vertices -to indices, even when new vertices are inserted into the arrangement or -existing vertices are removed. +`Vertex_handle` objects and not vertex indices. However, in +order to gain more efficiency in most bgl +algorithms, it is better to have them indexed \f$0, 1, \ldots, +(n-1)\f$, where \f$n\f$ is the number of vertices. We therefore +introduce the `Arr_vertex_index_map` class-template, +which maintains a mapping of vertex handles to indices, as required by +the bgl. An instance of this class must be +attached to a valid arrangement vertex when it is created. It uses the +notification mechanism (see Section \ref arr_secnotif) to +automatically maintain the mapping of vertices to indices, even when +new vertices are inserted into the arrangement or existing vertices +are removed. -In most algorithm provided by the bgl, the output is given by -property maps, such that each map entry corresponds to a vertex. -For example, when we compute the shortest paths from a given source vertex -\f$ s\f$ to all other vertices we can obtain a map of distances and a map of -predecessors - namely for each \f$ v\f$ vertex we have its distance from \f$ s\f$ -and a descriptor of the vertex that precedes \f$ v\f$ in the shortest path from \f$ s\f$. +In most algorithm provided by the bgl, the +output is given by property maps, such that each map entry +corresponds to a vertex. For example, when we compute the shortest +paths from a given source vertex \f$s\f$ to all other vertices we can +obtain a map of distances and a map of predecessors - namely for each +\f$v\f$ vertex we have its distance from \f$s\f$ and a descriptor of +the vertex that precedes \f$v\f$ in the shortest path from \f$s\f$. If the vertex descriptors are simply indices, boost supplies tools to easily represent property maps using vectors. -`Arr_vertex_index_map` class allows create such -indices, and together with `boost::vector_property_map` -allows for an efficient mapping of `Vertex_handle` objects to -properties of type `Type`. Note however that unlike the -`Arr_vertex_index_map` class, the vertex property-map class is not -kept synchronized with the number of vertices in the arrangement, so it -should not be reused in calls to bgl functions in case the arrangement -is modified in between these calls. +`Arr_vertex_index_map` class allows create such indices, +and together with `boost::vector_property_map` allows +for an efficient mapping of `Vertex_handle` objects to properties of +type `Type`. Note however that unlike the `Arr_vertex_index_map` +class, the vertex property-map class is not kept synchronized with the +number of vertices in the arrangement, so it should not be reused in +calls to bgl functions in case the +arrangement is modified in between these calls. \cgalFigureBegin{arr_figex_bgl,ex_bgl.png} -An arrangement of 7 line segments, as constructed by `bgl_primal_adapter.cpp` and `bgl_dual_adapter.cpp`. The breadth-first visit times for the arrangement faces, starting from the unbounded face \f$ f_0\f$, are shown is brackets. +An arrangement of 7 line segments, as constructed by +`bgl_primal_adapter.cpp` and `bgl_dual_adapter.cpp`. The +breadth-first visit times for the arrangement faces, starting from +the unbounded face \f$f_0\f$, are shown is brackets. \cgalFigureEnd -In the following example we construct an arrangement of 7 line segments, -as shown in \cgalFigureRef{arr_figex_bgl}, -then use Dijkstra's shortest-paths algorithm from the bgl to compute -the graph distance of all vertices from the leftmost vertex in the -arrangement \f$ v_0\f$. Note the usage of the `boost::vector_property_map` and -the `Arr_vertex_property_map` classes. The latter one, instantiated by -the type `double` is used to map vertices to their distances from \f$ v_0\f$. +In the following example we construct an arrangement of 7 line +segments, as shown in \cgalFigureRef{arr_figex_bgl}, then use +Dijkstra's shortest-paths algorithm from the bgl to compute the graph distance of all +vertices from the leftmost vertex in the arrangement \f$v_0\f$. Note +the usage of the `boost::vector_property_map` and the +`Arr_vertex_property_map` classes. The latter one, instantiated by the +type `double` is used to map vertices to their distances from +\f$v_0\f$. \cgalExample{Arrangement_on_surface_2/bgl_primal_adapter.cpp} \subsection arr_ssecbgl_dual The Dual Arrangement Representation -It is possible to give a dual graph representation for an arrangement instance, -such that each arrangement face corresponds to a graph vertex and two vertices -are adjacent iff the corresponding faces share a common edge on their -boundaries. This is done by specializing the +It is possible to give a dual graph representation for an arrangement +instance, such that each arrangement face corresponds to a graph +vertex and two vertices are adjacent iff the corresponding faces share +a common edge on their boundaries. This is done by specializing the `boost:graph_traits` template for `Dual` instances, where `Dual` is a template specialization that gives a dual interpretation to an arrangement instance. -In dual representation, `Arrangement_2::Face_handle` -is the graph-vertex type, while `Arrangement_2::Halfedge_handle` is the -graph-edge type. We treat the graph edges as directed, such that a halfedge -`e` is directed from \f$ f_1\f$, which is its incident face, to \f$ f_2\f$, which -is the incident face of its twin halfedge. As two arrangement faces may -share more than a single edge on their boundary, we allow parallel -edges in our Boost graph. As is the case in the primal graph, the dual -arrangement graph is also a model of the concepts `VertexListGraph`, -`EdgeListGraph` and `BidirectionalGraph` (thus also of -`IncidenceGraph`). +In dual representation, `Arrangement_2::Face_handle` is the +graph-vertex type, while `Arrangement_2::Halfedge_handle` is the +graph-edge type. We treat the graph edges as directed, such that a +halfedge `e` is directed from \f$f_1\f$, which is its incident face, +to \f$f_2\f$, which is the incident face of its twin halfedge. As two +arrangement faces may share more than a single edge on their boundary, +we allow parallel edges in our Boost +graph. As is the case in the primal graph, the dual arrangement graph +is also a model of the concepts `VertexListGraph`, `EdgeListGraph` and +`BidirectionalGraph` (thus also of `IncidenceGraph`). -Since we use `Face_handle` objects as the vertex descriptors, we define -the `Arr_face_index_map` class-template, which maintains an -efficient mapping of face handles to indices. -Like vertices, `boost::vector_property_map` can be -used for associating arbitrary data with the arrangement faces. +Since we use `Face_handle` objects as the vertex descriptors, we +define the `Arr_face_index_map` class-template, which +maintains an efficient mapping of face handles to indices. Like +vertices, `boost::vector_property_map` can be used for +associating arbitrary data with the arrangement faces. In the following example we construct the same arrangement as in example `bgl_primal_adapter.cpp` (see \cgalFigureRef{arr_figex_bgl}), and perform breadth-first search on the graph faces, starting from the -unbounded face. We extend the \sc{Dcel} faces -with an unsigned integer, marking the discover time of the face -using `boost` visitors and a property-map class that directly accesses -the extended data of the faces: +unbounded face. We extend the \sc{Dcel} faces with an unsigned +integer, marking the discover time of the face using `boost` visitors +and a property-map class that directly accesses the extended data of +the faces: \cgalExample{Arrangement_on_surface_2/bgl_dual_adapter.cpp} -\section arr_sectips How To Speed Up Your Computation +\section aos_sec-tips How To Speed Up Your Computation Before the specific tips, we remind you that compiling programs with debug flags disabled and with optimization flags enabled significantly reduces the running time.
    -
  1. When the curves to be inserted into an arrangement are \f$ x\f$-monotone -and pairwise disjoint in their interior to start with, then it is more -efficient (in running time) and less demanding (in traits-class -functionality) to use the non-intersection insertion-functions instead -of the general ones; e.g., `insert()`. + +
  2. When the curves to be inserted into an arrangement are +\f$x\f$-monotone and pairwise disjoint in their interior to start +with, then it is more efficient (in running time) and less demanding +(in traits-class functionality) to use the non-intersection +insertion-functions instead of the general ones; e.g., `insert()`.
  3. When the curves to be inserted into an arrangement are segments that are pairwise disjoint in their interior, it is more efficient to use @@ -3737,36 +4579,36 @@ number type `Quotient`. On rare occasions the traits class `Arr_non_caching_segment_traits_2` exhibits slightly better performance than the default one -(`Arr_segment_traits_2` -even when the segments intersect each other, due to the small overhead -of the latter (optimized) traits class. (For example, when the so -called Leda rational kernel is used). +(`Arr_segment_traits_2` even when the segments intersect each other, +due to the small overhead of the latter (optimized) traits class. (For +example, when the so called Leda rational +kernel is used). -
  4. Prior knowledge of the combinatorial structure of the arrangement can -be used to accelerate operations that insert \f$ x\f$-monotone curves, -whose interior is disjoint from existing edges and vertices of the -arrangement. The specialized insertion functions, i.e., +
  5. Prior knowledge of the combinatorial structure of the arrangement +can be used to accelerate operations that insert \f$x\f$-monotone +curves, whose interior is disjoint from existing edges and vertices of +the arrangement. The specialized insertion functions, i.e., `insert_in_face_interior()`, `insert_from_left_vertex()`, -`insert_from_right_vertex()`, and `insert_at_vertices()` -can be used according to the available information. These functions -hardly involve any geometric operations, if at all. They accept -topologically related parameters, and use them to operate directly on -the \sc{Dcel} records, thus saving algebraic operations, which are -especially expensive when high-degree curves are involved. +`insert_from_right_vertex()`, and `insert_at_vertices()` can be used +according to the available information. These functions hardly involve +any geometric operations, if at all. They accept topologically related +parameters, and use them to operate directly on the \sc{Dcel} records, +thus saving algebraic operations, which are especially expensive when +high-degree curves are involved. A polygon, represented by a list of segments along its boundary, can be inserted into an empty arrangement as follows. First, one segment is inserted using `insert_in_face_interior()` into the unbounded face. Then, a segment with a common end point is inserted using either -`insert_from_left_vertex()` or `insert_from_right_vertex()`, -and so on with the rest of the segments except for the last, which is -inserted using `insert_at_vertices()`, as both endpoints of which -are the mapping of known vertices. +`insert_from_left_vertex()` or `insert_from_right_vertex()`, and so on +with the rest of the segments except for the last, which is inserted +using `insert_at_vertices()`, as both endpoints of which are the +mapping of known vertices. -
  6. The main trade-off among point-location strategies, is between time -and storage. Using the naive or walk strategies, for example, takes -more query time but does not require preprocessing or maintenance of -auxiliary structures and saves storage space. +
  7. The main trade-off among point-location strategies, is between +time and storage. Using the naive or walk strategies, for example, +takes more query time but does not require preprocessing or +maintenance of auxiliary structures and saves storage space.
  8. If point-location queries are not performed frequently, but other modifying functions, such as removing, splitting, or merging edges @@ -3774,23 +4616,23 @@ are, then using a point-location strategy that does not require the maintenance of auxiliary structures, such as the naive or walk strategies, is preferable. -
  9. There is a trade-off between two modes of the trapezoidal RIC strategy -that enables the user to choose whether preprocessing should be -performed or not. If preprocessing is not used, the creation of the +
  10. There is a trade-off between two modes of the trapezoidal RIC +strategy that enables the user to choose whether preprocessing should +be performed or not. If preprocessing is not used, the creation of the structure is faster. However, for some input sequences the structure might be unbalanced and therefore queries and updates might take longer, especially, if many removal and split operations are performed. -
  11. When the curves to be inserted into an arrangement are available in -advance (as opposed to supplied on-line), it is advised to use the +
  12. When the curves to be inserted into an arrangement are available +in advance (as opposed to supplied on-line), it is advised to use the more efficient aggregate (sweep-based) insertion over the incremental insertion; e.g., `insert()`. -
  13. The various traits classes should be instantiated with an exact number -type to ensure robustness, when the input of the operations to be -carried out might be degenerate, although inexact number types could -be used at the user's own risk. +
  14. The various traits classes should be instantiated with an exact +number type to ensure robustness, when the input of the operations to +be carried out might be degenerate, although inexact number types +could be used at the user's own risk.
  15. Maintaining short bit-lengths of coordinate representations may drastically decrease the time consumption of arithmetic operations on @@ -3809,7 +4651,7 @@ be avoided by storing the results obtained by the first call, and reusing them when needed.
-\section Arrangement_on_surface_2Design Design and Implementation History +\section aos_sec-design Design and Implementation History The code of this package is the result of a long development process. Initially (and until version 3.1), the code was spread among several @@ -3821,7 +4663,7 @@ Sigal Raab, Ron Wein, Baruch Zukerman, and Tali Zvi. In version 3.2, as part of the ACS project, the packages have gone through a major re-design, resulting in an improved and unified -2D Arrangements package. +2D Arrangements package. The code of the new package was restructured and developed by Efi Fogel, Idit Haran, Ron Wein, and Baruch Zukerman. This version included for the first time a new geometry-traits diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h new file mode 100644 index 00000000000..126eedf4c75 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h @@ -0,0 +1,381 @@ +namespace CGAL { + + /*! \ingroup PkgArrangement2TraitsClasses + * + * The traits class `Arr_geodesic_arc_on_sphere_traits_2` is a model of the + * `ArrangementTraits_2` concept. It enables the construction and + * maintenance of arrangements of arcs of great circles (also known as + * geodesic arcs) embedded on the sphere (centered at the origin). Almost + * all operations on arrangements require a kernel that supports exact + * predicates. Most operations also require the kernel to support exact + * constructions. However, all operations on such arrangements can be + * computed efficiently, since all calculations are performed with + * rational arithmetic. + * + * There is an analogy between this class of arrangements and the class of + * planar arrangements induced by linear curves (i.e., segments, rays, and + * lines), as properties of linear curves in the plane often, but not always, + * hold for geodesic arcs on the sphere. For example, given any two + * non-antipodal points on the sphere there exists a unique great circle + * connecting the two points. + * + * We use the following parameterization of the unit sphere \f$S = + * \phi_S(\Phi)\f$: \f$\Phi = [\alpha, 2\pi + \alpha] \times [-\frac{\pi}{2}, + * \frac{\pi}{2}]\f$, \f$\phi_S(x, y) = (\cos y \cos x, \sin y \cos x, \sin + * x)\f$, where \f$\alpha = atan2(X, Y)\f$. By deafult, \f$X = -1, Y = 0\f$, + * which implies \f$\alpha = \pi\f$, and a default parameterization \f$\Phi = + * [-\pi, \pi] \times [-\frac{\pi}{2}, \frac{\pi}{2}]\f$. The equator curve, + * for example, is given by \f$\gamma(t) = (\pi(2t - 1) + \alpha, 0)\f$, for + * \f$t \in [0,1]\f$. This parameterization induces two contraction points + * \f$p_s = (0, 0, -1) = \phi_S(y,-\frac{\pi}{2})\f$ and \f$p_n = (0, 0, 1) = + * \phi_S(y,\frac{\pi}{2})\f$, referred to as the south and north poles, + * respectively, and an identification curve \f$\{\phi_S(\pi + + * \alpha,x)\,|\,-\frac{\pi}{2} \leq v \leq \frac{\pi}{2}\}\f$, as + * \f$\phi_S(-\pi + \alpha,v) = \phi_S(+\pi + \alpha,v)\f$ for all \f$x\f$ + * (which coincides with the opposite Prime (Greenwich) Meridian when + * \f$\alpha = \pi\f$). + + * \cgalModels `ArrangementTraits_2` + * \cgalModels `ArrangementLandmarkTraits_2` + * \cgalModels `ArrangementSphericalBoundaryTraits_2` + */ + + template + class Arr_geodesic_arc_on_sphere_traits_2 { + public: + /*! The `Point_2` class nested within the traits is used to represent a + * point on a sphere centered at the origin. The point is in fact a + * not-necessarily normalized 3D direction extended with information that + * specifies the location of the point pre-image in the parameter space. + * + * \cgalModels `Assignable` + * \cgalModels `DefaultConstructible` + * \cgalModels `CopyConstructible` + */ + class Point_2 { + public: + /// \name Enumeration types + /// @{ + + /*! The location type indicates a location in the parameter space. + */ + enum Location_type { + /// Internal to the parameter space. + NO_BOUNDARY_LOC = 0, + + /// The bottom side boundary of the parameter space (the south pole). + MIN_BOUNDARY_LOC, + + /// The identified left and right side boundaries of the parameter space. + MID_BOUNDARY_LOC, + + /// The top side boundary of the parameter space (the north pole). + MAX_BOUNDARY_LOC + }; + /// @} + + /// \name Types + /// @{ + typedef Kernel::Direction_3 Direction_3; + /// @} + + /// \name Creation + /// @{ + + /*! Constructs a point from a direction and a location. + * \param[in] dir the direction. + * \param[in] location indicates the location of the point pre-image + * in the parameter space. + */ + Point_2(const Direction_3& dir, Location_type location); + + /// @} + + /// \name Operations + /// @{ + + /*! Set the location of the point pre-image in the parameter space. + * \param[in] location the updated location of the point pre-image in + * the parameter space. + */ + void set_location(Location_type location); + + /*! Obtain the location of the point. + * \return the location of the point pre-image in the parameter space. + */ + Location_type location() const; + + /// @} + }; + + /*! The `X_monotone_curve_2` class nested within the traits is used to + * represent an \f$x\f$-monotone geodesic arc on the a sphere centered at + * the origin. The pre-image of an \f$x\f$-monotone geodesic arc does not + * intersect the identified left and right sides of the boundary of the + * parameter space. + * + * \cgalModels `Assignable` + * \cgalModels `DefaultConstructible` + * \cgalModels `CopyConstructible` + */ + class X_monotone_curve_2 { + public: + /// \name Types + /// @{ + typedef Arr_geodesic_arc_on_sphere_traits_2::Point_2 Point_2; + /// @} + + /// \name Creation + /// @{ + + /*! Constructs an \f$x\f$-monotone geodesic arc. + * \param[in] source the source point of the arc. + * \param[in] target the target point of the arc. + * \param[in] normal the normal of the plane that contains the arc. + * \param[in] is_vertical is the arc vertical ? + * \param[in] is_directed_right is the arc directed from left to right? + * \param[in] is_full is the arc a full great circle? + * \param[in] is_degenerate is the arc degenerate (single point)? + * \param[in] is_empty is the arc empty? + * \pre Both endpoint lie on the given plane. + */ + X_monotone_curve_2(const Point_2& source, + const Point_2& target, + const Direction_3& normal, + bool is_vertical, + bool is_directed_right, + bool is_full = false, + bool is_degenerate = false, + bool is_empty = false); + + /*! Construct an \f$x\f$-monotone geodesic arc. + * \param[in] normal the normal of the plane containing the arc. + * \param[in] source the source-point direction. + * \param[in] target the target-point direction. + * \pre Both endpoint lie on the given plane. + */ + X_monotone_curve_2(const Point_2& source, + const Point_2& target, + const Direction_3& normal); + + /*! Construct a full great-circle. + * \param[in] point the endpoint of the full great-circle. + * \param[in] normal the normal of the plane containing the arc. + * \pre the point lies on the given plane. + * \pre the point pre-image lies on the identified left and right sides + * of the boundary of the parameter space. + */ + X_monotone_curve_2(const Point_2& point, + const Direction_3& normal); + + /// @} + + /// \name Operations + /// @{ + + /*! Sets the source endpoint. + * \param[in] source the updated source endpoint. + */ + void set_source(const Point_2& source); + + /*! Sets the target endpoint. + * \param[in] target the updated target endpoint. + */ + void set_target(const Point_2& target); + + /*! Sets the normal of the underlying plane. + * \param[in] normal the updated normal of the underlying plane. + */ + void set_normal(const Direction_3& normal); + + /*! Sets the flag that indicates whether the arc is vertical. + * \param[in] flag indicates whether the arc pre-image in the parameter + * space is vertical. + */ + void set_is_vertical(bool flag); + + /*! Sets the flag that indicates whether the direction of the arc + * pre-image in the parameter space is from left to right. + * \param flag indicates whether the arc pre-image in the parameter + * space is from left to right. + */ + void set_is_directed_right(bool flag); + + /*! Sets the flag that indicates whether the arc is a full great circle. + * \param[in] flag indicates whether the arc is a full great circle. + */ + void set_is_full(bool flag); + + /*! Sets the flag that indicates whether the arc degenerates to a point. + * \param[in] flag indicates whether the arc degenerates to a point. + */ + void set_is_degenerate(bool flag); + + /*! Sets the flag that indicates whether the arc is empty. + * \param[in] flag indicates whether the arc is empty. + */ + void set_is_empty(bool flag); + + /*! Obtains the source point. + */ + const Point_2& source() const; + + /*! Obtains the target point. + */ + const Point_2& target() const; + + /*! Obtains the normal to the containing plane. + */ + const Direction_3& normal() const; + + /*! Obtains the (lexicographically) left endpoint direction. + */ + const Point_2& left() const; + + /*! Obtains the (lexicographically) right endpoint. + */ + const Point_2& right() const; + + /*! Determines whether the arc is vertical. + */ + bool is_vertical() const; + + /*! Determines whether the arc is directed lexicographically from left to + * right. + */ + bool is_directed_right() const; + + /*! Determines whether the arc is a great circle. + */ + bool is_full() const; + + /*! Determines whether the arc is degenerate. + */ + bool is_degenerate() const; + + /*! Determines whether the arc is empty. */ + bool is_empty() const; + + /*! Determines whether the arc is a meridian. + */ + bool is_meridian() const; + + /// @} + }; + + /*! + */ + class Curve_2 { + public: + /// \name Types + /// @{ + typedef Arr_geodesic_arc_on_sphere_traits_2::Point_2 Point_2; + /// @} + + /// \name Creation + /// @{ + /// @} + + /// \name Operations + /// @{ + /// @} + }; + + /*! + */ + class Construct_point_2 { + public: + /// \name Types + /// @{ + /// @} + + /// \name Operations + /// @{ + /// @} + }; + + /*! Construction functor of \f$x\f$-monotone geodesic arcs. + * + * \cgalModels `Assignable` + * \cgalModels `CopyConstructible` + * \cgalModels `AdaptableUnaryFunction` + * \cgalModels `AdaptableBinaryFunction` + * \cgalModels `AdaptableTernaryFunction` + */ + class Construct_x_monotone_curve_2 { + public: + /// \name Types + /// @{ + typedef Arr_geodesic_arc_on_sphere_traits_2::Point_2 Point_2; + typedef Arr_geodesic_arc_on_sphere_traits_2::X_monotone_curve_2 result_type; + typedef Kernel::Direction_3 Direction_3; + typedef Direction_3 argument_type; + typedef Point_2 first_argument_type; + typedef Point_2 second_argument_type; + typedef Direction_3 third_argument_type; + /// @} + + /// \name Operations + /// @{ + + /*! Construct the minor geodesic arc from two endpoints. The minor arc + * is the one with the smaller angle among the two geodesic arcs with + * the given endpoints. + * 1. Find out whether the arc is x-monotone. + * 2. If it is x-monotone, + * 2.1 Find out whether it is vertical, and + * 2.2 whether the target is larger than the source (directed right). + * The arc is vertical, iff + * 1. one of its endpoint direction pierces a pole, or + * 2. the projections onto the xy-plane coincide. + * \param[in] p the first endpoint. + * \param[in] q the second endpoint. + * \pre p and q must not coincide. + * \pre p and q cannot be antipodal. + */ + X_monotone_curve_2 operator()(const Point_2& p, const Point_2& q); + + /*! Construct a full great circle from a normal to a plane. + * \param normal the normal to the plane containing the great circle. + * \pre the plane is not vertical. + */ + X_monotone_curve_2 operator()(const Direction_3& normal); + + /*! Construct a geodesic arc from two endpoints contained + * in a plane. + * \param[in] p the first endpoint. + * \param[in] q the second endpoint. + * \param[in] normal the normal to the plane containing the arc. + * \pre Both endpoint lie on the given plane. + * \pre Both endpoint lie on the given plane. + */ + X_monotone_curve_2 operator()(const Point_2& p, const Point_2& q, + const Direction_3& normal) + /// @} /* end of operations */ + }; + + class Construct_Curve_2 { + public: + /// \name Types + /// @{ + /// @} + + /// \name Operations + /// @{ + /// @} + }; + + /*! Returns an instance of `Construct_point_2`. + */ + Construct_point_2 construct_point_2_object() const; + + /*! Returns an instance of `Construct_x_monotone_curve_2`. + */ + Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object() const; + + /*! Returns an instance of `Construct_curve_2`. + */ + Construct_curve_2 construct_curve_2_object() const; + }; + +} /* end namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_linear_traits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_linear_traits_2.h index b996a3cd03b..83dd16da4ec 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_linear_traits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arr_linear_traits_2.h @@ -70,7 +70,7 @@ public: /// @{ /*! - constructs an line segment. + constructs a line segment. */ Curve_2 (const Segment_2& seg); @@ -147,15 +147,15 @@ public: Class Trim_2{ public: -/// \name Creation +/// \name Creation /// @{ /*! Trims the given x-monotone curve to an from src to tgt. -\ pre `src` and `tgt` lies on the curve -*/ +\ pre `src` and `tgt` lies on the curve +*/ -X_monotone_curve_2(const X_monotone_curve_2& xcv, +X_monotone_curve_2(const X_monotone_curve_2& xcv, const Point_2& src, const Point_2& tgt)const }/* end Arr_linear_traits_2::Trim_2 */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_2.h new file mode 100644 index 00000000000..4ed6bc204e8 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_2.h @@ -0,0 +1,1171 @@ +namespace CGAL { + +/*! + * \ingroup PkgArrangement2 + * + * \anchor arr_refaos + * + * An object `aos` of the class `Arrangement_on_surface_2` represents the + * subdivision induced by a set of \f$ x\f$-monotone curves and isolated points + * into maximally connected cells. The arrangement is represented as a + * doubly-connected edge-list (Dcel) such that each + * Dcel vertex is associated with a point of the + * plane and each edge is associated with an \f$ x\f$-monotone curve whose + * interior is disjoint from all other edges and vertices. Recall that an + * arrangement edge is always comprised of a pair of twin Dcel halfedges. + + * The `Arrangement_on_surface_2` template has two parameters:
  • The + * `Traits` template-parameter should be instantiated with a model of the + * `ArrangementBasicTraits_2` concept. The traits class defines the types of \f$ + * x\f$-monotone curves and two-dimensional points, namely + * `ArrangementBasicTraits_2::X_monotone_curve_2` and + * `ArrangementBasicTraits_2::Point_2`, respectively, and supports basic + * geometric predicates on them.
  • The `Dcel` template-parameter should be + * instantiated with a class that is a model of the `ArrangementDcel` + * concept. The value of this parameter is by default + * `Arr_default_dcel`.
The available traits classes and Dcel classes are described below. + + * \sa `ArrangementDcel` + * \sa `Arr_default_dcel` + * \sa `ArrangementBasicTraits_2` + * \sa `CGAL::overlay()` + * \sa `CGAL::is_valid()` + + * Insertion Functions + + * \sa `PkgArrangement2Insert` + * \sa `CGAL::insert_non_intersecting_curve()` + * \sa `CGAL::insert_non_intersecting_curves()` + * \sa `CGAL::insert_point()` + + * Removal functions + + * \sa `CGAL::remove_edge()` + * \sa `CGAL::remove_vertex()` + + * Input/output functions + + * \sa `PkgArrangement2Read` + * \sa `PkgArrangement2Write` + */ +template +class Arrangement_on_surface_2 { +public: + /// \name Types + /// @{ + + /*! the geometry traits class in use. */ + typedef GeometryTraits_2 Geometry_traits_2; + + /*! the topology traits class in use. */ + typedef TopologyTraits_2 Topology_traits_2; + + /*! a private type used as an abbreviation of the + * `Arrangement_on_surface_2` type hereafter. + */ + typedef Arrangement_on_surface_2 Self; + + /*! the Dcel maintains the incidence + * relations between the cells of of the arrangement. + */ + typedef typename Topology_traits::Dcel Dcel; + + /*! the point type, as defined by the traits class. */ + typedef typename Traits_2::Point_2 Point_2; + + /*! the \f$ x\f$-monotone curve type, as defined by the traits class. */ + typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2; + + /*! the size type (equivalent to `size_t`). */ + typedef typename Dcel::Size Size; + + /*! \ingroup PkgArrangement2DCEL + * An object \f$ v\f$ of the class `Vertex` represents an arrangement vertex, + * that is a \f$ 0\f$-dimensional cell, associated with a point on the + * ambient surface. + */ + class Vertex : public Dcel::Vertex { + public: + /// \name Creation + /// @{ + + /*! default constructor. */ + Vertex(); + + /// @} + + /// \name Access Functions + /// All non-const methods listed below also have `const` counterparts + /// that return constant handles, iterators or circulators: + /// @{ + + /*! checks whether the vertex lies at infinity and not associated with + * a point with bounded coordinates. + */ + bool is_at_open_boundary() const; + + /*! checks whether the vertex is isolated (i.e., has no incident edges). + */ + bool is_isolated() const; + + /*! obtains the number of edges incident to `v`. + */ + Size degree() const; + + /*! obtains a circulator circulator that allows going over the halfedges + * incident to `v` (that have `v` as their target). + * The edges are traversed in a clockwise direction around `v`. + * \pre `v` is not an isolated vertex. + */ + Halfedge_around_vertex_circulator incident_halfedges(); + + /*! obtains a handle to the face that contains `v` in its interior. + * \pre `v` is an isolated vertex. + */ + Face_handle face(); + + /*! obtains the point associated with the vertex. + * \pre `v` is not a vertex at infinity. + */ + const typename Traits::Point_2& point() const; + + /*! obtains the placement of the \f$ x\f$-coordinate in the parameter space, + * that is, either the left boundary-side, the interior, or the right + * boundary-side. + */ + Arr_parameter_space parameter_space_in_x() const; + + /*! obtains the placement of the \f$ y\f$-coordinate in the parameter space, + * that is, either the bottom boundary-side, the interior, or the top + * boundary-side. + */ + Arr_parameter_space parameter_space_in_y() const; + + /// @} + + }; /* end Vertex */ + + /*! \ingroup PkgArrangement2DCEL + * An object \f$ e\f$ of the class `Halfedge` represents a halfedge in the + * arrangement. A halfedge is directed from its source vertex + * to its target vertex, and has an incident face lying to + * its left. Each halfedge has a twin halfedge directed in the + * opposite direction, where the pair of twin halfedges form together + * an arrangement edge, that is - a \f$ 1\f$-dimensional cell, associated + * with planar \f$ x\f$-monotone curve. + * + * Halfedges are stored in doubly-connected lists and form chains. These + * chains define the inner and outer boundaries of connected components. + */ + class Halfedge : public Dcel::Halfedge { + public: + /// \name Creation + /// @{ + + /*! default constructor. */ + Halfedge(); + + /// @} + + /// \name Access Functions + /// All non-const methods listed below also have `const` counterparts + /// that return constant handles, iterators or circulators: + /// @{ + + /*! determines whether the halfedge is fictitious (i.e., connects two + * vertices at infinity and is not associated with a valid curve). + */ + bool is_fictitious() const; + + /*! obtains a handle for the source vertex of `e`. */ + Vertex_handle source(); + + /*! obtains a handle for the target vertex of `e`. */ + Vertex_handle target(); + + /*! obtains the direction of the halfedge: `ARR_LEFT_TO_RIGHT` if + * `e`'s source vertex is lexicographically smaller than it + * target (so the halfedge is directed from left to right), and + * `ARR_RIGHT_TO_LEFT` if it is lexicographically larger than + * the target (so the halfedge is directed from right to left). + */ + Arr_halfedge_direction direction() const; + + /*! obtains the face that `e` is incident to (The face lies to + * the left of `e`). + */ + Face_handle face(); + + /*! obtains the twin halfedge. */ + Halfedge_handle twin(); + + /*! obtains `e`'s predecessor in the connected component it belongs to. */ + Halfedge_handle prev(); + + /*! obtains `e`'s successor in the connected component it belongs to. */ + Halfedge_handle next(); + + /*! obtains a circulator that allows traversing the halfedges of the + * connected component boundary (CCB) that contains `e`. + * The circulator is initialized to point to `e`. + */ + Ccb_halfedge_circulator ccb(); + + /*! obtains the \f$ x\f$-monotone curve associated with `e`. + * \pre `e` is not a fictitious halfedge. + */ + const typename Traits::X_monotone_curve_2& curve() const; + + /// @} + }; /* end Halfedge */ + + /*! \ingroup PkgArrangement2DCEL + * + * An object of the class `Face` represents an arrangement face, namely, a \f$ + * 2\f$-dimensional arrangement cell. An arrangement that supports only + * bounded curves contains exactly one unbounded face, and a number of + * bounded faces. An arrangement that supports also unbounded curves has one + * or more unbounded faces. Such an arrangement has also exactly one + * fictitious face, which does not correspond to a real two-dimensional cell + * of the arrangement (and thus it is ignored in counting the number of faces + * of the arrangement.) Each bounded face has an outer boundary comprising a + * halfedge chain winding in counterclockwise orientation around it. Each + * unbounded face of an arrangement that has a fictitious face also has a + * boundary comprising a counterclockwise halfedge-chain. The edges on the + * boundary of a face incident to the fictitious face are fictitious, as they + * do not correspond to real curves. A face may also contain holes, which are + * defined by clockwise-oriented halfedge chains, and isolated vertices. + */ + class Face : public Dcel::Face { + public: + /// \name Creation + /// @{ + + /*! default constructor. */ + Face(); + + /// @} + + /// \name Access Functions + /// All non-const methods listed below also have `const` counterparts + /// that return constant handles, iterators or circulators: + /// @{ + + /*! obtains a Boolean indicating whether this is the fictitious face, + * which contain the entire arrangement (and does not have an outer CCB). + * An arrangement that supports only bounded curves does not have a + * fictitious face at all. + */ + bool is_fictitious() const; + + /*! + obtains a Boolean indicating whether the face is unbounded. + */ + bool is_unbounded() const; + + /*! obtains a Boolean indicating whether the face has an outer CCB. + * (The fictitious face and the unbounded face of an arrangement that + * does not have a fictitious face do not have outer CCBs.) + */ + bool has_outer_ccb() const; + + /*! obtains a circulator that enables traversing the outer boundary of + * `f`. The edges along the CCB are traversed in a counterclockwise + * direction. + * \pre The face `f` has an outer CCB. + */ + Ccb_halfedge_circulator outer_ccb(); + + /*! obtains an iterator for traversing all the holes (inner CCBs) of `f`. */ + Hole_iterator holes_begin(); + + /*! obtains a past-the-end iterator for the holes of `f`. */ + Hole_iterator holes_end(); + + /*! obtains an iterator for traversing all the isolated vertices + * contained in the interior of `f`. + */ + Isolated_vertex_iterator isolated_vertices_begin(); + + /*! obtains a past-the-end iterator for the isolated vertices + * contained inside `f`. + */ + Isolated_vertex_iterator isolated_vertices_end(); + + /// @} + }; /* end Face */ + + /// @} + + /*! \name + * + * The following handles, iterators, and circulators all have respective + * constant counterparts (for example, in addition to `Vertex_iterator` the + * type `Vertex_const_iterator` is also defined). See + * \cgalCite{cgal:ms-strg-96} for a discussion of constant versus mutable + * iterator types. The mutable types are assignable to their constant + * counterparts. `Vertex_iterator`, `Halfedge_iterator`, and `Face_iterator` + * are equivalent to the respective handle types (namely, `Vertex_handle`, + * `Halfedge_handle`, and `Face_handle`). Thus, wherever the handles appear in + * function parameter lists, the respective iterators can be passed as well. + * + * All handles are model of `LessThanComparable` and `Hashable`, that is they + * can be used as keys in containers such as `std::map` and + * `boost::unordered_map`. + */ + + /// @{ + + /*! a handle to an arrangement vertex. */ + typedef unspecified_type Vertex_handle; + + /*! a handle to a halfedge. + * The halfedge and its twin form together an arrangement edge. + */ + typedef unspecified_type Halfedge_handle; + + /*! a handle to an arrangement face. */ + typedef unspecified_type Face_handle; + + /*! a bidirectional iterator over the + * vertices of the arrangement. Its value-type is `Vertex`. + */ + typedef unspecified_type Vertex_iterator; + + /*! a bidirectional iterator over the + * halfedges of the arrangement. Its value-type is `Halfedge`. + */ + typedef unspecified_type Halfedge_iterator; + + /*! a bidirectional iterator over the + * edges of the arrangement. (That is, it skips every other halfedge.) + * Its value-type is `Halfedge`. + */ + typedef unspecified_type Edge_iterator; + + /*! a bidirectional iterator over the + * faces of arrangement. Its value-type is `Face`. + */ + typedef unspecified_type Face_iterator; + + /*! a bidirectional iterator over the + * unbounded faces of arrangement. Its value-type is `Face`. + */ + typedef unspecified_type Unbounded_face_iterator; + + /*! a bidirectional circulator + * over the halfedges that have a given vertex as their target. + * Its value-type is `Halfedge`. + */ + typedef unspecified_type Halfedge_around_vertex_circulator; + + /*! a bidirectional circulator over the + * halfedges of a CCB (connected component of the boundary). + * Its value-type is `Halfedge`. Each + * bounded face has a single CCB representing it outer boundary, and may + * have several inner CCBs representing its holes. + */ + typedef unspecified_type Ccb_halfedge_circulator; + + /*! a bidirectional iterator over the holes + * (i.e., inner CCBs) contained inside a given face. + * Its value type is `Ccb_halfedge_circulator`. + */ + typedef unspecified_type Hole_iterator; + + /*! a bidirectional iterator over the + * isolated vertices contained inside a given face. + * Its value type is `Vertex`. + */ + typedef unspecified_type Isolated_vertex_iterator; + + /// @} + + /// \name Creation + /// @{ + + /*! constructs an empty arrangement containing one unbounded face, + * which corresponds to the entire plane. + */ + Arrangement_on_surface_2(); + + /*! copy constructor. */ + Arrangement_on_surface_2(const Self& other); + + /*! constructs an empty arrangement that uses the given `traits` + *instance for performing the geometric predicates. + */ + Arrangement_on_surface_2(const Traits_2 *traits); + + /// @} + + /// \name Assignment Methods + /// @{ + + /*! assignment operator. */ + Self& operator=(other); + + /*! assigns the contents of another arrangement. */ + void assign(const Self& other); + + /*! clears the arrangement. */ + void clear(); + + /// @} + + /// \name Access Functions + /// @{ + + /*! obtains the traits object used by the arrangement instance. + * A `const` version is also available. + */ + Traits_2* get_traits(); + + /*! determines whether the arrangement is empty (contains only the unbounded + * face, with no vertices or edges). + */ + bool is_empty() const; + + /// @} + + /*! \name Accessing the Arrangement Vertices + * + * All `_begin()` and `_end()` methods listed below also have `const` + * counterparts, returning constant iterators instead of mutable ones. + */ + + /// @{ + + /*! obtains the number of vertices in the arrangement. */ + Size number_of_vertices() const; + + /*! obtains the total number of isolated vertices in the arrangement. */ + Size number_of_isolated_vertices() const; + + /*! obtains the begin-iterator of the vertices in the arrangement. */ + Vertex_iterator vertices_begin(); + + /*! obtains the past-the-end iterator of the vertices in the arrangement. */ + Vertex_iterator vertices_end(); + + /*! obtains the number of arrangement vertices that lie at infinity and + * are not associated with valid points. Such vertices are not considered + * to be regular arrangement vertices and `arr.number_of_vertices()` + * does not count them. + */ + Size number_of_vertices_at_infinity() const; + + /// @} + + /*! \name Accessing the Arrangement Halfedges + * + * All `_begin()` and `_end()` methods listed below also have `const` + * counterparts, returning constant iterators instead of mutable ones. + */ + + /// @{ + + /*! obtains the number of halfedges in the arrangement. */ + Size number_of_halfedges() const; + + /*! obtains the begin-iterator of the halfedges in the arrangement. */ + Halfedge_iterator halfedges_begin(); + + /*! obtains the past-the-end iterator of the halfedges in the arrangement. */ + Halfedge_iterator halfedges_end(); + + /*! obtains the number of edges in the arrangement (equivalent to + * `arr.number_of_halfedges() / 2`). + */ + Size number_of_edges() const; + + /*! obtains the begin-iterator of the edges in the arrangement. */ + Edge_iterator edges_begin(); + + /*! obtains the past-the-end iterator of the edges in the arrangement. */ + Edge_iterator edges_end(); + + /// @} + + /*! \name Accessing the Arrangement Faces + * + * All `_begin()` and `_end()` methods listed below also have `const` + * counterparts, returning constant iterators instead of mutable ones. + */ + + /// @{ + + /*! obtains a handle for an unbounded face of the arrangement. + * In case the arrangement comprises only bounded curves, there is a single + * unbounded face and the function returns a handle to it. Otherwise, a + * handle to an arbitrary unbounded face is returned. + */ + Face_handle unbounded_face(); + + /*! obtains the number of faces in the arrangement. */ + Size number_of_faces() const; + + /*! obtains the begin-iterator of the faces in the arrangement. */ + Face_iterator faces_begin(); + + /*! obtains the past-the-end iterator of the faces in the arrangement. */ + Face_iterator faces_end(); + + /*! obtains the number of unbounded faces in the arrangement. Note + * `arr.number_of_faces()` also counts the unbounded faces of the arrangement. + */ + Size number_of_unbounded_faces() const; + + /*! obtains the begin-iterator of the unbounded faces in the arrangement. */ + Unbounded_face_iterator unbounded_faces_begin(); + + /*! obtains the past-the-end iterator of the unbounded faces in the + * arrangement. + */ + Unbounded_face_iterator unbounded_faces_end(); + + /*! obtains a handle to the fictitious face of the arrangement. + * If the arrangement is not unbounded, there is no fictitious face. In this + * case the result is not deterministic. A const version is also available. + */ + Face_handle fictitious_face(); + + /// @} + + /*! \name Casting Away Constness + * + * It is sometimes necessary to convert a constant (non-mutable) handle to a + * mutable handle. For example, the result of a point-location query is a + * non-mutable handle for the arrangement cell containing the query + * point. Assume that the query point lies on an edge, so we obtain a + * `Halfedge_const_handle`; if we wish to use this handle and remove the edge, + * we first need to cast away its "constness". + */ + + /// @{ + + /*! casts the given constant vertex handle to an equivalent mutable handle. */ + Vertex_handle non_const_handle(Vertex_const_handle v); + + /*! casts the given constant halfedge handle to an equivalent mutable handle. + */ + Halfedge_handle non_const_handle(Halfedge_const_handle e); + + /*! casts the given constant face handle to an equivalent mutable handle. */ + Face_handle non_const_handle(Face_const_handle f); + + /// @} + + /// \name Specialized Insertion Methods + /// @{ + + /*! inserts the point `p` into the arrangement as an isolated vertex in + * the interior of the face `f` and returns a handle for the newly + * created vertex. + * \pre `p` lies in the interior of the face `f`. + */ + Vertex_handle insert_in_face_interior(const Point_2& p, + Face_handle f); + + /*! inserts the curve `c` that is entirely contained in the interior + * of a given face `f`. If `c` is a bounded curve two new vertices that + * correspond to `c`'s endpoints are created and connected with a newly + * created halfedge pair, which forms a new hole (inner component) in the face + * `f`. If `c` is unbounded, at least one of the two vertices that represents + * its end lies at infinity, and its creation modifies the outer boundary of + * `f`. The function returns a handle for one of the new halfedges + * corresponding to the inserted curve, directed in lexicographic increasing + * order (from left to right). + * \pre `c` lies entirely in the interior of the face `f` and is disjoint + * from all existing arrangement vertices and edges (in particular, both its + * endpoints are not already associated with existing arrangement vertices). + * \pre In case `c` is an unbounded curve, `f` must be an unbounded face. + */ + Halfedge_handle insert_in_face_interior(const X_monotone_curve_2& c, + Face_handle f); + + /*! inserts the curve `c` into the arrangement, such that its left endpoint + * corresponds to a given arrangement vertex. As a result, a new vertex that + * correspond to `c`'s right endpoint is created and connected to `v` with a + * newly created halfedge pair. If `c` has an unbounded right end, the new + * vertex lies at infinity and the unbounded face that contains the interior + * of the curve is split. The function returns a handle for one of the new + * halfedges corresponding to the inserted curve, directed towards the newly + * created vertex - that is, directed in lexicographic increasing order (from + * left to right). + * + * \pre The interior of `c` is disjoint from all existing arrangement vertices + * and edges. + * \pre `v` is associated with the left endpoint of `c`. + * \pre The right endpoint of `c` is not already associated with an existing + * arrangement vertex. + */ + Halfedge_handle insert_from_left_vertex(const X_monotone_curve_2& c, + Vertex_handle v); + + /*! inserts the curve `c` into the arrangement, such that its right + * endpoint corresponds to a given arrangement vertex. As a result, a new + * vertex that correspond to `c`'s left endpoint is created and + * connected to `v` with a newly created halfedge pair. If `c` has + * an unbounded left end, the new vertex lies at infinity and the + * unbounded face that contains the interior of the curve is split. + * The function returns a handle for one of the new halfedges corresponding + * to the inserted curve, directed to the newly created vertex - + * that is, directed in lexicographic decreasing order (from right to left). + * \pre The interior of `c` is disjoint from all existing arrangement + * vertices and edges. + * \pre `v` is associated with the right endpoint of `c`. + * \pre The left endpoint of `c` is not already associated with an existing + * arrangement vertex. + */ + Halfedge_handle insert_from_right_vertex(const X_monotone_curve_2& c, + Vertex_handle v); + + /*! inserts the curve `c` into the arrangement, such that both `c`'s + * endpoints correspond to existing arrangement vertices, given by `v1` + * and `v2`. The function creates a new halfedge pair that connects the + * two vertices, and returns a handle for the halfedge directed from `v1` + * to `v2`. + * \pre The interior of `c` is disjoint from all existing arrangement + * vertices and edges. + * \pre `c` must not be an unbounded curve. + * \pre `v1` and `v2` are associated with `c`'s endpoints. + * \pre If `v1` and `v2` are already connected by an edge, this edge + * represents an \f$ x\f$-monotone curve that is interior-disjoint from `c`). + */ + Halfedge_handle insert_at_vertices(const X_monotone_curve_2& c, + Vertex_handle v1, + Vertex_handle v2); + + /*! inserts an unbounded curve `c` into the arrangement, such that `c` + * is entirely contained within a single unbounded face of the arrangement. + * `fict_pred1` specifies the fictitious halfedge that should contain the + * vertex at infinity that corresponds to the unbounded end of `c`. If + * both ends of `c` are unbounded, `fict_pred1` indicated the place + * for its left end and `fict_pred2` indicated a place for its right end. + * The function returns a handle for one of the new halfedges directed + * (lexicographically) from left to right. + * \pre `c` is an unbounded curve disjoint from all existing arrangement + * vertices and edges. + * \pre `fict_pred1` (and `fict_pred2`) are fictitious halfedges that + * contains the unbounded end(s) of `c`. If both halfedges are given they + * must be both incident to the same unbounded face. + */ + Halfedge_handle insert_in_face_interior(const X_monotone_curve_2& c, + Halfedge_handle fict_pred1, + Halfedge_handle fict_pred2 = + Halfedge_handle()); + + /*! inserts the curve `c` into the arrangement, such that its left + * endpoint corresponds to a given arrangement vertex. This vertex is the + * target vertex of the halfedge `pred`, such that `c` is inserted + * to the circular list of halfedges around `pred->target()` right + * between `pred` and its successor. The function returns a handle for + * one of the new halfedges directed (lexicographically) from left to right. + * \pre The interior of `c` is disjoint from all existing arrangement + * vertices and edges. + * \pre `pred->target()` is associated with the left endpoint of `c`, and `c` + * should be inserted after `pred` in a clockwise order around this vertex. + * \pre The right endpoint of `c` is not already associated with an existing + * arrangement vertex. + */ + Halfedge_handle insert_from_left_vertex(const X_monotone_curve_2& c, + Halfedge_handle pred); + + /*! inserts an unbounded curve `c` into the arrangement, such that its left + * endpoint is bounded and corresponds to a given arrangement vertex. This + * vertex is the target vertex of the halfedge `pred`, such that `c` is + * inserted to the circular list of halfedges around `pred->target()` right + * between `pred` and its successor. Similarly, `fict_pred` specifies the + * fictitious halfedge that should contain the vertex at infinity that + * corresponds to the unbounded right end of `c`. The function returns a + * handle for one of the new halfedges directed (lexicographically) from left + * to right. + * \pre The interior of `c` is disjoint from all existing arrangement + * vertices and edges. `c` must have a bounded left endpoint and an + * unbounded right end. + * \pre `pred->target()` is associated with the left endpoint of `c`, and `c` + * should be inserted after `pred` in a clockwise order around this vertex. + * \pre `fict_pred` is a fictitious halfedge that contains the unbounded + * right end of `c`. + */ + Halfedge_handle insert_from_left_vertex(const X_monotone_curve_2& c, + Halfedge_handle pred, + Halfedge_handle fict_pred); + + /*! inserts the curve `c` into the arrangement, such that its right + * endpoint corresponds to a given arrangement vertex. This vertex is the + * target vertex of the halfedge `pred`, such that `c` is inserted to the + * circular list of halfedges around `pred->target()` right between `pred` and + * its successor. The function returns a handle for one of the new halfedges + * directed (lexicographically) from right to left. + * \pre The interior of `c` is disjoint from all existing arrangement + * vertices and edges. + * \pre `pred->target()` is associated with the right endpoint of `c`, and + * `c` should be inserted after `pred` in a clockwise order around this + * vertex. + * \pre The left endpoint of `c` is not already associated with an existing + * arrangement vertex. + */ + Halfedge_handle insert_from_right_vertex(const X_monotone_curve_2& c, + Halfedge_handle pred); + + /*! inserts an unbounded curve `c` into the arrangement, such that its right + * endpoint is bounded and corresponds to a given arrangement vertex. This + * vertex is the target vertex of the halfedge `pred`, such that `c` is + * inserted to the circular list of halfedges around `pred->target()` right + * between `pred` and its successor. Similarly, `fict_pred` specifies the + * fictitious halfedge that should contain the vertex at infinity that + * corresponds to the unbounded left end of `c`. The function returns a + * handle for one of the new halfedges directed (lexicographically) from right + * to left. \pre The interior of `c` is disjoint from all existing + * arrangement vertices and edges. `c` must have a bounded right endpoint and + * an unbounded left end. \pre `pred->target()` is associated with the right + * endpoint of `c`, and `c` should be inserted after `pred` in a clockwise + * order around this vertex. \pre `fict_pred` is a fictitious halfedge that + * contains the unbounded left end of `c`. + */ + Halfedge_handle insert_from_right_vertex(const X_monotone_curve_2& c, + Halfedge_handle pred, + Halfedge_handle fict_pred); + + /*! inserts the curve `c` into the arrangement, such that both `c`'s + * endpoints correspond to existing arrangement vertices, given by + * `pred1->target()` and `v2`. The function creates a new halfedge pair that + * connects the two vertices (where the corresponding halfedge is inserted + * right between `pred1` and its successor around `pred1`'s target vertex) and + * returns a handle for the halfedge directed from `pred1->target()` to `v2`. + * \pre The interior of `c` is disjoint from all existing arrangement + * vertices and edges. + * \pre `pred1->target()` and `v2` are associated with `c`'s endpoints. + * \pre If `pred1->target` and `v2` are already connected by an edge, this + * edge represents an \f$ x\f$-monotone curve that is interior-disjoint from + * `c`). + */ + Halfedge_handle insert_at_vertices(const X_monotone_curve_2& c, + Halfedge_handle pred1, + Vertex_handle v2); + + /*! inserts the curve `c` into the arrangement, such that both `c`'s + * endpoints correspond to existing arrangement vertices, given by + * `pred1->target()` and `pred2->target()`. The function creates a new + * halfedge pair that connects the two vertices (with `pred1` and `pred2` + * indicate the exact place for these halfedges around the two target + * vertices) and returns a handle for the halfedge directed from + * `pred1->target()` to `pred2->target()`. + * \pre The interior of `c` is disjoint from all existing arrangement + * vertices and edges. + * \pre `pred1->target()` and `pred2->target()` are associated with `c`'s + * endpoints. + * \pre If `pred1->target` and `pred2->target()` are already connected by an + * edge, this edge represents an \f$ x\f$-monotone curve that is + * interior-disjoint from `c`). + */ + Halfedge_handle insert_at_vertices(const X_monotone_curve_2& c, + Halfedge_handle pred1, + Halfedge_handle pred2); + + + /// @} + + /// \name Modifying Vertices and Edges + /// @{ + + /*! sets `p` to be the point associated with the vertex `v`. + * The function returns a handle for the modified vertex (same as `v`). + * \pre `v` is not a vertex at infinity and `p` is geometrically equivalent + * to the point currently associated with `v`. + */ + Vertex_handle modify_vertex(Vertex_handle v, const Point_2& p); + + /*! removes the isolated vertex `v` from the arrangement. The function + * obtains the face `f` that used to contain the isolated vertex. + * \pre `v` is an isolated vertex (has no incident edges). + */ + Face_handle remove_isolated_vertex(Vertex_handle v); + + /*! sets `c` to be the \f$ x\f$-monotone curve associated with the edge `e`. + * The function obtains a handle for the modified edge (same as `e`). + * \pre `c` is geometrically equivalent to the curve currently associated + * with `e`. + */ + Halfedge_handle modify_edge(Halfedge_handle e, + const X_monotone_curve_2& c); + + /*! splits the edge `e` into two edges (more precisely, into two halfedge + * pairs), associated with the given subcurves `c1` and `c2`, and + * creates a vertex that corresponds to the split point. + * The function obtains a handle for the halfedge, whose source is the same + * as `e->source()` and whose target vertex is the split point. + * \pre Either `c1`'s left endpoint and `c2`'s right endpoint correspond to + * `e`'s end-vertices such that `c1`'s right endpoint and `c2`'s left + * endpoint are equal and define the split point - or vice-versa (with change + * of roles between `c1` and `c2`). + */ + Halfedge_handle split_edge(Halfedge_handle e, + const X_monotone_curve_2& c1, + const X_monotone_curve_2& c2); + + /*! merges the edges represented by `e1` and `e2` into + * a single edge, associated with the given merged curve `c`. Denote `e1`'s + * end-vertices as \f$ u_1\f$ and \f$ v\f$, while `e2`'s end-vertices are + * denoted \f$ u_2\f$ and \f$ v\f$. The function removes the common vertex \f$ + * v\f$ returns a handle for one of the merged halfedges, directed from \f$ + * u_1\f$ to \f$ u_2\f$. + * \pre `e1` and `e2` share a common end-vertex, such that the two other + * end-vertices of the two edges are associated with `c`'s endpoints. + */ + Halfedge_handle merge_edge(Halfedge_handle e1, + Halfedge_handle e2, + const X_monotone_curve_2& c); + + /*! removes the edge `e` from the arrangement. Since the `e` may + * be the only edge incident to its source vertex (or its target vertex), this + * vertex can be removed as well. The flags `remove_source` and + * `remove_target` indicate whether the endpoints of `e` should be removed, or + * whether they should be left as isolated vertices in the arrangement. + * If the operation causes two faces to merge, the merged face is returned. + * Otherwise, the face to which the edge was incident is returned. + */ + Face_handle remove_edge(Halfedge_handle e, + bool remove_source = true, + bool remove_target = true); + + /// @} + + /// \name Miscellaneous + /// @{ + + /*! obtains `true` if `arr` represents a valid instance of + * `Arrangement_on_surface_2`. In particular, the functions checks the + * topological structure of the arrangement and assures that it is valid. In + * addition, the function performs several simple geometric tests to ensure + * the validity of some of the geometric properties of the arrangement. + * Namely, it checks that all arrangement vertices are associated with + * distinct points, and that the halfedges around every vertex are ordered + * clockwise. + */ + bool is_valid() const; + + /// @} + +}; /* end Arrangement_on_surface_2 */ +} /* end namespace CGAL */ + +namespace CGAL { + +/*! \ingroup PkgArrangement2Insert insert + * The function `%insert` inserts one or more curves or \f$ x\f$-monotone + * curves into a given arrangement, where no restrictions are imposed on the + * inserted curves. If an inserted curve is not \f$ x\f$-monotone curve, it is + * subdivided into \f$ x\f$-monotone subcurves (and perhaps isolated points), + * which are inserted into the arrangement. + * + * \cgalHeading{Requirements} + * + *
    + *
  • If the curve is \f$ x\f$-monotone curve then The instantiated + * `Traits` class must model the `ArrangementXMonotoneTraits_2` + * concept. In case that the curve is not \f$ x\f$-monotone then the + * instantiated `Traits` class must model the + * `ArrangementTraits_2` concept. That is, it should define the + * `Curve_2` type, and support its subdivision into \f$ x\f$-monotone + * subcurves (and perhaps isolated points). + *
  • The point-location object `pl`, must model the + * `ArrangementPointLocation_2` concept. + *
+ */ + +/// @{ + +/*! Inserts the given curve `c` into the arrangement `arr`. `c` is subdivided + * into \f$ x\f$-monotone subcurves (and perhaps isolated points). Each subcurve + * is in turn inserted into the arrangement by locating its left endpoint and + * computing its zone until reaching the right endpoint. + * + * The given point-location object `pl` is used to locate the left endpoints of + * the \f$ x\f$-monotone curves. By default, the function uses the "walk along + * line" point-location strategy - namely an instance of the class + * `Arr_walk_along_line_point_location >`. + * + * \pre If provided, `pl` must be attached to the given arrangement `arr`. + */ +template +void insert(Arrangement_on_surface_2& arr, + const Curve& c, + const PointLocation& pl = walk_pl); + +/*! Inserts the\f$ x\f$-monotone (only) curve `xc` into the arrangement + * `arr`. The object `obj`, which either wraps a `Vertex_const_handle`, a + * `Halfedge_const_handle`, or a `Face_const_handle`, represents the location of + * `xc`'s left endpoint in the arrangement. The zone of `xc` is computed + * starting from the feature represented by `obj`. As in the case above, the + * zone computation terminates, when the right endpoint is reached. Thus, + * point-location is not required. +*/ +template +void insert(Arrangement_on_surface_2& arr, + const typename Traits::X_monotone_curve_2& xc, + const Object& obj); + + +/*! Aggregately inserts the curves or \f$ x\f$-monotone curves in the range + * `[first,last)` into the arrangement `arr` using the sweep-line framework. + */ +template +void insert(Arrangement_on_surface_2& arr, + InputIterator first, + InputIterator last); + +/// @} + +/*! \ingroup PkgArrangement2Funcs + * + * Checks if a given curve or \f$ x\f$-monotone curve intersects an existing + * arrangement's edges or vertices. + * + * If the give curve is not an \f$ x\f$-monotone curve then the function + * subdivides the given curve into \f$ x\f$-monotone subcurves and isolated + * vertices . Each subcurve is in turn checked for intersection. The function + * uses the zone algorithm to check if the curve intersects the + * arrangement. First, the curve's left endpoint is located. Then, its zone is + * computed starting from its left endpoint location. The zone computation + * terminates when an intersection with an arrangement's edge/vertex is found or + * when the right endpoint is reached. + * + * A given point-location object is used for locating the left endpoint of the + * given curve in the existing arrangement. By default, the function uses the + * "walk along line" point-location strategy - namely an instance of the class + * `Arr_walk_along_line_point_location >`. + * + * Checks if the given curve or \f$ x\f$-monotone curve `c` intersects + * edges or vertices of the existing arrangement `arr`. + * \pre If provided, `pl` must be attached to the given arrangement `arr`. + * + * \cgalHeading{Requirements} + * + *
    + *
  • If `c` is \f$ x\f$-monotone then the instantiated `GeometryTraits_2` + * class must model the `ArrangementXMonotoneTraits_2` concept. If + * `c` is a curve then the instantiated `GeometryTraits_2` class must + * model the `ArrangementTraits_2` concept. That is, it should + * define the `Curve_2` type, and support its subdivision into + * \f$ x\f$-monotone subcurves (and perhaps isolated points). + *
  • The point-location object `pl`, must model the + * `ArrangementPointLocation_2` concept. + *
+ */ +template +bool do_intersect +(Arrangement_on_surface_2& arr, + const Curve& c, + const PointLocation& pl); + +/*! \ingroup PkgArrangement2Funcs + * + * Inserts a given \f$ x\f$-monotone curve into a given arrangement, where the + * interior of the given curve is disjoint from all existing arrangement + * vertices and edges. Under this assumption, it is possible to locate the + * endpoints of the given curve in the arrangement, and use one of the + * specialized insertion member-functions of the arrangement according to the + * results. The insertion operations creates a single new edge, that is, two + * twin halfedges, and the function returns a handle for the one directed + * lexicographically in increasing order (from left to right). + * + * A given point-location object is used for answering the two point-location + * queries on the given curve endpoints. By default, the function uses the "walk + * along line" point-location strategy - namely, an instance of the class + * `Arr_walk_along_line_point_location >`. + * + * \pre If provided, `pl` must be attached to the given arrangement `arr`. + * + * \cgalHeading{Requirements} + * + *
    + *
  • The instantiated `Traits` class must model the restricted + * `ArrangementBasicTraits_2` concept, as no intersections are computed. + *
  • The point-location object `pl` must model the + * `ArrangementPointLocation_2` concept. + *
+ */ +template +typename Arrangement_on_surface_2::Halfedge_handle +insert_non_intersecting_curve +(Arrangement_on_surface_2& arr, + const typename Traits::X_monotone_curve_2& xc, + const PointLocation& pl = walk_pl); + +/*! \ingroup PkgArrangement2Funcs + * + * Inserts a set of \f$ x\f$-monotone curves in a given range into a given + * arrangement. The insertion is performed in an aggregated manner, using the + * sweep-line algorithm. The input curves should be pairwise disjoint in their + * interior and pairwise interior-disjoint from all existing arrangement + * vertices and edges. + * + * \cgalHeading{Requirements} + * + *
    + *
  • The instantiated `Traits` class must model the + * `ArrangementBasicTraits_2` concept, as no intersections are computed. + *
  • `InputIterator::value_type` must be `Traits::X_monotone_curve_2` + *
+ */ +template +void insert_non_intersecting_curves +(Arrangement_on_surface_2& arr, + InputIterator first, InputIterator last); + +/*! \ingroup PkgArrangement2Funcs + * + * Inserts a given point into a given arrangement. It uses a given + * point-location object to locate the given point in the given arrangement. If + * the point conincides with an existing vertex, there is nothing left to do; if + * it lies on an edge, the edge is split at the point. Otherwise, the point is + * contained inside a face, and is inserted as an isolated vertex inside this + * face. By default, the function uses the "walk along line" point-location + * strategy - namely, an instance of the class + * `Arr_walk_along_line_point_location >`. In either case, the function returns a handle for the + * vertex associated with the point. + * + * \pre If provided, `pl` must be attached to the given arrangement `arr`. + * + * \cgalHeading{Requirements} + * + *
    + *
  • The instantiated `Traits` class must model the + * `ArrangementXMonotoneTraits_2` concept. Not all expressions listed + * by this concept are required. In fact the traits class must model the + * `ArrangementBasicTraits_2` concept, and support the splitting + * functionality. + *
  • The point-location object `pl`, must model the + * `ArrangementPointLocation_2` concept. + *
+ */ +template +typename Arrangement_on_surface_2::Vertex_handle +insert_point(Arrangement_on_surface_2& arr, + const typename Traits::Point_2& p, + const PointLocation& pl = walk_pl); + +/*! \ingroup PkgArrangement2Funcs + * + * Checks the validity of a given arrangement. + * + * Invokes the member function `arr.is_valid()` to verify the topological + * correctness of the arrangement. Then it performs additional validity + * tests. It checks that all \f$ x\f$-monotone curves associated with + * arrangement edges are pairwise disjoint in their interior. Then it makes sure + * that all holes and all isolated vertices are located within the proper + * arrangement faces. Note that the test carried out by this function may take a + * considerable amount of time; it is recommended to be used only for debugging + * purposes. + * + * \cgalHeading{Requirements} + * + * The instantiated traits class must model the concept + * `ArranagmentXMonotoneTraits_2`. + */ +template +bool is_valid +(const Arrangement_on_surface_2& arr); + +/*! \ingroup PkgArrangement2Funcs + * + * Removes an edge given by one of the twin halfedges that forms it, from a + * given arrangement. Once the edge is removed, if the vertices associated with + * its endpoints become isolated, they are removed as well. The call + * `remove_edge(arr, e)` is equivalent to the call `arr.remove_edge (e, true, + * true)`. However, this free function requires that `Traits` be a model of the + * refined concept `ArrangementXMonotoneTraits_2`, which requires merge + * operations on \f$ x\f$-monotone curves. If one of the end-vertices of the + * given edge becomes redundant after the edge is removed (see `remove_vertex()` + * for the definition of a redundant vertex), it is removed, and its incident + * edges are merged. If the edge-removal operation causes two faces to merge, + * the merged face is returned. Otherwise, the face to which the edge was + * incident before the removal is returned. + * + * \cgalHeading{Requirements} + * + *
    + *
  • The instantiated traits class must model the concept + * `ArrangementXMonotoneTraits_2`. + *
+ */ +template +typename Arrangement_on_surface_2::Face_handle +remove_edge +(Arrangement_on_surface_2& arr, + typename Arrangement_on_surface_2::Halfedge_handle e); + +/*! \ingroup PkgArrangement2Funcs + * + * Attempts to removed a given vertex from a given arrangement. The vertex can + * be removed if it is either an isolated vertex, (and has no incident edge,) or + * if it is a redundant vertex. That is, it has exactly two incident + * edges, whose associated curves can be merged to form a single \f$ + * x\f$-monotone curve. The function returns a boolean value that indicates + * whether it succeeded removing the vertex from the arrangement. + * + * \cgalHeading{Requirements} + * + *
    + *
  • The instantiated `Traits` class must model the + * `ArrangementXMonotoneTraits_2` concept. Not all expressions listed + * by this concept are required. In fact the traits class must model the + * `ArrangementBasicTraits_2` concept and support the merging + * functionality. + *
+ */ +template +bool remove_vertex +(Arrangement_on_surface_2& arr, + typename Arrangement_on_surface_2::Vertex_handle v); + +/*! \ingroup PkgArrangement2Funcs + * + * Compute the zone of the given \f$ x\f$-monotone curve in the existing + * arrangement. Meaning, it output the arrangement's vertices, edges and faces + * that the \f$ x\f$-monotone curve intersects. The order of the objects is the + * order that they are discovered when traversing the \f$ x\f$-monotone curve + * from left to right. + * + * A given point-location object is used for answering point-location queries + * during the insertion process. By default, the function uses the "walk along + * line" point-location strategy - namely an instance of the class + * `Arr_walk_along_line_point_location >`. + * + * Compute the zone of the given \f$ x\f$-monotone curve `c` in the arrangement + * `arr`. \pre If provided, `pl` must be attached to the given arrangement + * `arr`. + * + * \cgalHeading{Requirements} + * + *
    + *
  • The instantiated `GeometryTraits_2` class must model the + * `ArrangementXMonotoneTraits_2` concept. + *
  • The point-location object `pl`, must model the + * `ArrangementPointLocation_2` concept. + *
+ */ +template +OutputIterator zone +(Arrangement_on_surface_2& arr, + const typename GeometryTraits_2::X_monotone_curve_2& c, + OutputIterator oi, + const PointLocation& pl); + +} /* namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_with_history_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_with_history_2.h new file mode 100644 index 00000000000..bca9c31b850 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_on_surface_with_history_2.h @@ -0,0 +1,293 @@ +namespace CGAL { + +/*! +\ingroup PkgArrangement2 + +\anchor arr_refaos_with_hist + +An object `arr` of the class `Arrangement_on_surface_with_history_2` represents the +planar subdivision induced by a set of input curves \f$ \cal C\f$. +The arrangement is represented as a doubly-connected edge-list (Dcel). +As is the case for the `Arrangement_2`, each Dcel +vertex is associated with a point and each edge is associated with an +\f$ x\f$-monotone curve whose interior is disjoint from all other edges and +vertices. Each such \f$ x\f$-monotone curve is a subcurve of some +\f$ C \in \cal C\f$ - or may represent an overlap among several curves +in \f$ \cal C\f$. + +The `Arrangement_on_surface_with_history_2` class-template extends the `Arrangement_2` +class-template by keeping an additional container of input curves +representing \f$ \cal C\f$, and by maintaining a cross-mapping between these +curves and the arrangement edges they induce. This way it is possible +to determine the inducing curve(s) of each arrangement edge. This mapping +also allows the traversal of input curves, and the traversal of edges +induced by each curve. + +The `Arrangement_on_surface_with_history_2` template has two parameters: +
    +
  • The `Traits` template-parameter should be instantiated with +a model of the `ArrangementGeometry_traits_2` concept. The traits +class defines the `Curve_2` type, which represents an input curve. +It also defines the types of \f$ x\f$-monotone curves and two-dimensional +points, namely `ArrangementGeometry_traits_2::X_monotone_curve_2` and `ArrangementGeometry_traits_2::Point_2`, +respectively, and supports basic geometric predicates on them. +
  • The `Dcel` template-parameter should be instantiated with +a class that is a model of the `ArrangementDcelWithRebind` concept. The +value of this parameter is by default +`Arr_default_dcel`. +
+ +\sa `ArrangementDcel` +\sa `Arr_default_dcel` +\sa `ArrangementGeometry_traits_2` +\sa `Arrangement_2` +\sa `insertion functions` +\sa `removal functions` +\sa `overlaying arrangements` + +*/ +template +class Arrangement_on_surface_with_history_2 : public Arrangement_on_surface_2 { +public: + /// \name Types + /// @{ + + /*! a private type used as an abbreviation of the + * `Arrangement_on_surface_with_history_2` type hereafter. + */ + typedef Arrangement_on_surface_with_history_2 Self; + + //! the geometry traits class in use. + typedef Geometry_traits_2 Geometry_traits_2; + + //! the topology traits class in use. + typedef Geometry_traits_2 Topology_traits; + + //! the Dcel representation of the arrangement. + typedef typename Topology_traits::Dcel Dcel; + + //! the point type, as defined by the traits class. + typedef typename Geometry_traits_2::Point_2 Point_2; + + //! the \f$ x\f$-monotone curve type, as defined by the traits class. + typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2; + + //! the curve type, as defined by the traits class. + typedef typename Geometry_traits_2::Curve_2 Curve_2; + + /// @} + + /*! \name + * In addition, the nested types `Vertex`, `Halfedge` and `Face` are defined, + * as well as all handle, iterator and circulator types, as defined by the + * `Arrangement_2` class-template. + */ + /// @{ + + //! a handle for an input curve. + typedef unspecified_type Curve_handle; + + /*! a bidirectional iterator over the curves that induce the arrangement. + * Its value-type is `Curve_2`. + */ + typedef unspecified_type Curve_iterator; + + /*! an iterator over the edges induced by an input curve. Its value type is + * `Halfedge_handle`. + */ + typedef unspecified_type Induced_edge_iterator; + + /*! an iterator for the curves that originate a given arrangement edge. + * Its value type is `Curve_handle`. + */ + typedef unspecified_type Originating_curve_iterator; + + /// @} + + /// \name Creation + /// @{ + + /*! constructs an empty arrangement containing one unbounded face, which + * corresponds to the whole plane. + */ + Arrangement_on_surface_with_history_2(); + + //! copy constructor. + Arrangement_on_surface_with_history_2(const Self& other); + + /*! constructs an empty arrangement that uses the given `traits` instance + * for performing the geometric predicates. + */ + Arrangement_on_surface_with_history_2(Geometry_traits_2 *traits); + + /// @} + + /// \name Assignment Methods + /// @{ + + //! assignment operator. + Self& operator=(other); + + //! assigns the contents of another arrangement. + void assign(const Self& other); + + //! clears the arrangement. + void clear (); + + /// @} + + /*! \name Access Functions for Input Curves + * See the `Arrangement_2` reference pages for the full list. + */ + + /// @{ + + //! returns the number of input curves that induce the arrangement. + Size number_of_curves() const; + + //! returns the begin-iterator of the curves inducing the arrangement. + Curve_iterator curves_begin(); + + //! returns the past-the-end iterator of the curves inducing the arrangement. + Curve_iterator curves_end(); + + //! returns the number of arrangement edges induced by the curve `ch`. + Size number_of_induced_edges(Curve_handle ch) const; + + //! returns the begin-iterator of the edges induced by the curve `ch`. + Induced_edge_iterator induced_edges_begin(Curve_handle ch) const; + + //! returns the past-the-end iterator of the edges induced by the curve `ch`. + Induced_edge_iterator induced_edges_end(Curve_handle ch) const; + + //! returns the number of input curves that originate the edge `e`. + Size number_of_originating_curves(Halfedge_handle e) const; + + //! returns the begin-iterator of the curves originating the edge `e`. + Originating_curve_iterator originating_curves_begin(Halfedge_handle e) const; + + //! returns the past-the-end iterator of the curves originating the edge `e`. + Originating_curve_iterator originating_curves_end(Halfedge_handle e) const; + + /// @} + + /*! \name Modifying Arrangement Edges + * The following functions override their counterparts in the + * `Arrangement_2` class, as they also maintain the cross-relationships + * between the input curves and the edges they induce. + * + * See the `Arrangement_2` reference pages for the full list of functions + * for modifying arrangement vertices + */ + + /// @{ + + /*! splits the edge `e` into two edges (more precisely, into two halfedge + * pairs), at a given split point `p`. The function returns a handle for the + * halfedge whose source is the same as `e->source()` and whose target vertex + * is the split point. + * \pre `p` lies in the interior of the curve associated with `e`. + */ + Halfedge_handle split_edge(Halfedge_handle e, const Point_2& p); + + /*! merges the edges represented by `e1` and `e2` into a single edge. The + * function returns a handle for one of the merged halfedges. + * \pre `e1` and `e2` share a common end-vertex, of degree \f$ 2\f$, and the + * \f$ x\f$-monotone curves associated with `e1` and `e2` are mergeable + * into a single \f$ x\f$-monotone curves. + */ + Halfedge_handle merge_edge(Halfedge_handle e1, Halfedge_handle e2); + + /*! removes the edge `e` from the arrangement. Since the `e` may be the only + * edge incident to its source vertex (or its target vertex), this vertex can + * be removed as well. The flags `remove_source` and `remove_target` indicate + * whether the endpoints of `e` should be removed, or whether they should be + * left as isolated vertices in the arrangement. If the operation causes two + * faces to merge, the merged face is returned. Otherwise, the face to which + * the edge was incident is returned. + */ + Face_handle remove_edge(Halfedge_handle e, bool remove_source = true, + bool remove_target = true); + + /// @} + +}; /* end Arrangement_on_surface_with_history_2 */ + +/*! \ingroup PkgArrangement2Insert + * + * Inserts the given curve `c` into the arrangement with history `arr`, and + * returns a handle to the inserted curve. `c` is subdivided into \f$ + * x\f$-monotone subcurves (and perhaps isolated points). Each subcurve is in + * turn inserted into the arrangement by locating its left endpoint and + * computing its zone until reaching the right endpoint. + * + * The given point-location object `pl` is used to locate the left endpoints of + * the \f$ x\f$-monotone curves. By default, the function uses the "walk along + * line" point-location strategy - namely an instance of the class + * `Arr_walk_along_line_point_location >`. + * + * \pre If provided, `pl` is attached to the given arrangement `arr`. + */ +template +typename Arrangement_on_surface_with_history_2::Curve_handle +insert (Arrangement_on_surface_with_history_2& arr, + const typename Traits::Curve_2& c, + const PointLocation& pl = walk_pl); + +/*! \ingroup PkgArrangement2Insert + * Aggregately inserts the curves in the range `[first,last)` into the + * arrangement with history `arr` using the sweep-line framework. + */ +template +void insert(Arrangement_on_surface_with_history_2& arr, + InputIterator first, InputIterator last); + +/*! \ingroup PkgArrangement2Funcs + * + * Removes a given curve from a given arrangement. + * + * The curve is specified by its handle `ch`, from the arrangement `arr`, by + * deleting all the edges it induces. The function returns the number of + * deleted edges. + */ +template +Size remove_curve(Arrangement_on_surface_with_history_2& arr, + typename Arrangement_on_surface_with_history_2::Curve_handle ch); + + +/*! \addtogroup PkgArrangement2Overlay + * + * Computes the overlay of two arrangements with history `arr1` and `arr2`, and + * sets the output arrangement with history `res` to represent the overlaid + * arrangement. The function also constructs a consolidated set of curves that + * induce `res`. \pre `res` does not refer to either `arr1` or `arr2` (that is, + * "self overlay" is not supported). + */ +template +void overlay(const Arrangement_on_surface_with_history_2& arr1, + const Arrangement_on_surface_with_history_2& arr2, + Arrangement_on_surface_with_history_2& res, + OverlayTraits& ovl_tr); + + +/*! +\addtogroup PkgArrangement2Overlay + +Computes the (simple) overlay of two arrangements with history `arr1` +and `arr2`, and sets the output arrangement with history `res` to +represent the overlaid arrangement. The function also constructs a +consolidated set of curves that induce `res`. It employs the default +overlay-traits, which practically does nothing. +\pre `res` does not refer to either `arr1` or `arr2` (that is, "self overlay" is not supported). +*/ +template +void overlay(const Arrangement_on_surface_with_history_2& arr1, + const Arrangement_on_surface_with_history_2& arr2, + Arrangement_on_surface_with_history_2& res); + +} /* namespace CGAL */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_with_history_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_with_history_2.h index 7afef234acc..8ec6ee73c66 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_with_history_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/Arrangement_with_history_2.h @@ -1,90 +1,88 @@ - namespace CGAL { /*! \ingroup PkgArrangement2 -\anchor arr_refarr_with_hist +\anchor arr_refarr_with_hist -An object `arr` of the class `Arrangement_with_history_2` represents the -planar subdivision induced by a set of input curves \f$ \cal C\f$. -The arrangement is represented as a doubly-connected edge-list (Dcel). -As is the case for the `Arrangement_2`, each Dcel -vertex is associated with a point and each edge is associated with an -\f$ x\f$-monotone curve whose interior is disjoint from all other edges and -vertices. Each such \f$ x\f$-monotone curve is a subcurve of some -\f$ C \in \cal C\f$ - or may represent an overlap among several curves -in \f$ \cal C\f$. +An object `arr` of the class `Arrangement_with_history_2` represents the +planar subdivision induced by a set of input curves \f$ \cal C\f$. +The arrangement is represented as a doubly-connected edge-list (Dcel). +As is the case for the `Arrangement_2`, each Dcel +vertex is associated with a point and each edge is associated with an +\f$ x\f$-monotone curve whose interior is disjoint from all other edges and +vertices. Each such \f$ x\f$-monotone curve is a subcurve of some +\f$ C \in \cal C\f$ - or may represent an overlap among several curves +in \f$ \cal C\f$. -The `Arrangement_with_history_2` class-template extends the `Arrangement_2` -class-template by keeping an additional container of input curves -representing \f$ \cal C\f$, and by maintaining a cross-mapping between these -curves and the arrangement edges they induce. This way it is possible -to determine the inducing curve(s) of each arrangement edge. This mapping -also allows the traversal of input curves, and the traversal of edges -induced by each curve. +The `Arrangement_with_history_2` class-template extends the `Arrangement_2` +class-template by keeping an additional container of input curves +representing \f$ \cal C\f$, and by maintaining a cross-mapping between these +curves and the arrangement edges they induce. This way it is possible +to determine the inducing curve(s) of each arrangement edge. This mapping +also allows the traversal of input curves, and the traversal of edges +induced by each curve. -The `Arrangement_with_history_2` template has two parameters: -
    -
  • The `Traits` template-parameter should be instantiated with -a model of the `ArrangementTraits_2` concept. The traits -class defines the `Curve_2` type, which represents an input curve. -It also defines the types of \f$ x\f$-monotone curves and two-dimensional -points, namely `ArrangementTraits_2::X_monotone_curve_2` and `ArrangementTraits_2::Point_2`, -respectively, and supports basic geometric predicates on them. -
  • The `Dcel` template-parameter should be instantiated with -a class that is a model of the `ArrangementDcelWithRebind` concept. The -value of this parameter is by default -`Arr_default_dcel`. -
+The `Arrangement_with_history_2` template has two parameters: +
    +
  • The `Traits` template-parameter should be instantiated with +a model of the `ArrangementTraits_2` concept. The traits +class defines the `Curve_2` type, which represents an input curve. +It also defines the types of \f$ x\f$-monotone curves and two-dimensional +points, namely `ArrangementTraits_2::X_monotone_curve_2` and `ArrangementTraits_2::Point_2`, +respectively, and supports basic geometric predicates on them. +
  • The `Dcel` template-parameter should be instantiated with +a class that is a model of the `ArrangementDcelWithRebind` concept. The +value of this parameter is by default +`Arr_default_dcel`. +
-\sa `ArrangementDcel` -\sa `Arr_default_dcel` -\sa `ArrangementTraits_2` -\sa `Arrangement_2` -\sa `insertion functions` -\sa `removal functions` -\sa `overlaying arrangements` +\sa `ArrangementDcel` +\sa `Arr_default_dcel` +\sa `ArrangementTraits_2` +\sa `Arrangement_2` +\sa `insertion functions` +\sa `removal functions` +\sa `overlaying arrangements` */ -template< typename Traits, typename Dcel > -class Arrangement_with_history_2 : public Arrangement_2 { +template +class Arrangement_with_history_2 : public Arrangement_2 { public: -/// \name Types +/// \name Types /// @{ /*! -a private type used as an abbreviation of the `Arrangement_with_history_2` type hereafter. -*/ -typedef Arrangement_with_history_2 Self; +a private type used as an abbreviation of the `Arrangement_with_history_2` type hereafter. +*/ +typedef Arrangement_with_history_2 Self; /*! -the traits class in use. -*/ -typedef unspecified_type Traits_2; +the traits class in use. +*/ +typedef unspecified_type Traits_2; /*! -the Dcel representation of the arrangement. -*/ -typedef unspecified_type Dcel; +the Dcel representation of the arrangement. +*/ +typedef unspecified_type Dcel; /*! -the point type, as defined by the traits class. -*/ -typedef typename Traits_2::Point_2 Point_2; +the point type, as defined by the traits class. +*/ +typedef typename Traits_2::Point_2 Point_2; /*! -the \f$ x\f$-monotone curve type, as defined by the traits class. -*/ -typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2; +the \f$ x\f$-monotone curve type, as defined by the traits class. +*/ +typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2; /*! -the curve type, as defined by the traits class. -*/ -typedef typename Traits_2::Curve_2 Curve_2; - +the curve type, as defined by the traits class. +*/ +typedef typename Traits_2::Curve_2 Curve_2; /// @} @@ -97,73 +95,73 @@ In addition, the nested types `Vertex`, `Halfedge` and `Face` are defined, as we /*! -a handle for an input curve. -*/ -typedef unspecified_type Curve_handle; +a handle for an input curve. +*/ +typedef unspecified_type Curve_handle; /*! -a bidirectional iterator over the -curves that induce the arrangement. Its value-type is -`Curve_2`. -*/ -typedef unspecified_type Curve_iterator; +a bidirectional iterator over the +curves that induce the arrangement. Its value-type is +`Curve_2`. +*/ +typedef unspecified_type Curve_iterator; /*! -an iterator over the edges induced by an input curve. -Its value type is `Halfedge_handle`. -*/ -typedef unspecified_type Induced_edge_iterator; +an iterator over the edges induced by an input curve. +Its value type is `Halfedge_handle`. +*/ +typedef unspecified_type Induced_edge_iterator; /*! -an iterator for the curves that originate a given arrangement edge. -Its value type is `Curve_handle`. -*/ -typedef unspecified_type Originating_curve_iterator; +an iterator for the curves that originate a given arrangement edge. +Its value type is `Curve_handle`. +*/ +typedef unspecified_type Originating_curve_iterator; -/// @} +/// @} -/// \name Creation +/// \name Creation /// @{ /*! -constructs an empty arrangement containing one unbounded face, -which corresponds to the -whole plane. -*/ -Arrangement_with_history_2(); +constructs an empty arrangement containing one unbounded face, +which corresponds to the +whole plane. +*/ +Arrangement_with_history_2(); /*! -copy constructor. -*/ -Arrangement_with_history_2(const Self& other); +copy constructor. +*/ +Arrangement_with_history_2(const Self& other); /*! -constructs an empty arrangement that uses the given `traits` -instance for performing the geometric predicates. -*/ -Arrangement_with_history_2(Traits_2 *traits); +constructs an empty arrangement that uses the given `traits` +instance for performing the geometric predicates. +*/ +Arrangement_with_history_2(Traits_2 *traits); -/// @} +/// @} -/// \name Assignment Methods +/// \name Assignment Methods /// @{ /*! -assignment operator. -*/ -Self& operator= (other); +assignment operator. +*/ +Self& operator= (other); /*! -assigns the contents of another arrangement. -*/ -void assign (const Self& other); +assigns the contents of another arrangement. +*/ +void assign (const Self& other); /*! -clears the arrangement. -*/ -void clear (); +clears the arrangement. +*/ +void clear (); -/// @} +/// @} /*! \name Access Functions for Input Curves @@ -173,58 +171,58 @@ See the `Arrangement_2` reference pages for the full list. /// @{ /*! -returns the number of input curves that induce the arrangement. -*/ -Size number_of_curves() const; +returns the number of input curves that induce the arrangement. +*/ +Size number_of_curves() const; /*! -returns the begin-iterator of the curves inducing the arrangement. -*/ -Curve_iterator curves_begin(); +returns the begin-iterator of the curves inducing the arrangement. +*/ +Curve_iterator curves_begin(); /*! -returns the past-the-end iterator of the curves inducing the arrangement. -*/ -Curve_iterator curves_end(); +returns the past-the-end iterator of the curves inducing the arrangement. +*/ +Curve_iterator curves_end(); /*! -returns the number of arrangement edges induced by the curve `ch`. -*/ -Size number_of_induced_edges (Curve_handle ch) const; +returns the number of arrangement edges induced by the curve `ch`. +*/ +Size number_of_induced_edges (Curve_handle ch) const; /*! -returns the begin-iterator of the edges induced by the curve `ch`. -*/ -Induced_edge_iterator -induced_edges_begin (Curve_handle ch) const; +returns the begin-iterator of the edges induced by the curve `ch`. +*/ +Induced_edge_iterator +induced_edges_begin (Curve_handle ch) const; /*! -returns the past-the-end iterator of the edges induced by the curve `ch`. -*/ -Induced_edge_iterator -induced_edges_end (Curve_handle ch) const; +returns the past-the-end iterator of the edges induced by the curve `ch`. +*/ +Induced_edge_iterator +induced_edges_end (Curve_handle ch) const; /*! -returns the number of input curves that originate the edge `e`. -*/ -Size number_of_originating_curves (Halfedge_handle e) const; +returns the number of input curves that originate the edge `e`. +*/ +Size number_of_originating_curves (Halfedge_handle e) const; /*! -returns the begin-iterator of the curves originating the edge `e`. -*/ -Originating_curve_iterator -originating_curves_begin (Halfedge_handle e) const; +returns the begin-iterator of the curves originating the edge `e`. +*/ +Originating_curve_iterator +originating_curves_begin (Halfedge_handle e) const; /*! -returns the past-the-end iterator of the curves originating the edge -`e`. -*/ -Originating_curve_iterator -originating_curves_end (Halfedge_handle e) const; +returns the past-the-end iterator of the curves originating the edge +`e`. +*/ +Originating_curve_iterator +originating_curves_end (Halfedge_handle e) const; -/// @} +/// @} -/*! \name Modifying Arrangement Edges +/*! \name Modifying Arrangement Edges The following functions override their counterparts in the `Arrangement_2` class, as they also maintain the cross-relationships @@ -237,37 +235,37 @@ for modifying arrangement vertices /// @{ /*! -splits the edge `e` into two edges (more precisely, into two halfedge -pairs), at a given split point `p`. -The function returns a handle for the halfedge whose source is the same -as `e->source()` and whose target vertex is the split point. -\pre `p` lies in the interior of the curve associated with `e`. -*/ -Halfedge_handle split_edge (Halfedge_handle e, -const Point_2& p); +splits the edge `e` into two edges (more precisely, into two halfedge +pairs), at a given split point `p`. +The function returns a handle for the halfedge whose source is the same +as `e->source()` and whose target vertex is the split point. +\pre `p` lies in the interior of the curve associated with `e`. +*/ +Halfedge_handle split_edge (Halfedge_handle e, +const Point_2& p); /*! -merges the edges represented by `e1` and `e2` into -a single edge. -The function returns a handle for one of the merged halfedges. -\pre `e1` and `e2` share a common end-vertex, of degree \f$ 2\f$, and the \f$ x\f$-monotone curves associated with `e1` and `e2` are mergeable into a single \f$ x\f$-monotone curves. -*/ -Halfedge_handle merge_edge (Halfedge_handle e1, -Halfedge_handle e2); +merges the edges represented by `e1` and `e2` into +a single edge. +The function returns a handle for one of the merged halfedges. +\pre `e1` and `e2` share a common end-vertex, of degree \f$ 2\f$, and the \f$ x\f$-monotone curves associated with `e1` and `e2` are mergeable into a single \f$ x\f$-monotone curves. +*/ +Halfedge_handle merge_edge (Halfedge_handle e1, +Halfedge_handle e2); /*! -removes the edge `e` from the arrangement. Since the `e` may -be the only edge incident to its source vertex (or its target vertex), -this vertex can be removed as well. The flags `remove_source` and -`remove_target` indicate whether the endpoints of `e` should be -removed, or whether they should be left as isolated vertices in the -arrangement. -If the operation causes two faces to merge, the merged face is returned. -Otherwise, the face to which the edge was incident is returned. -*/ -Face_handle remove_edge(Halfedge_handle e, -bool remove_source = true, -bool remove_target = true); +removes the edge `e` from the arrangement. Since the `e` may +be the only edge incident to its source vertex (or its target vertex), +this vertex can be removed as well. The flags `remove_source` and +`remove_target` indicate whether the endpoints of `e` should be +removed, or whether they should be left as isolated vertices in the +arrangement. +If the operation causes two faces to merge, the merged face is returned. +Otherwise, the face to which the edge was incident is returned. +*/ +Face_handle remove_edge(Halfedge_handle e, +bool remove_source = true, +bool remove_target = true); /// @} @@ -310,11 +308,11 @@ void insert(Arrangement_with_history_2& arr, /*! \ingroup PkgArrangement2Funcs -Removes a given curve from a given arrangement. +Removes a given curve from a given arrangement. -The curve is specified by its handle `ch`, from -the arrangement `arr`, by deleting all the edges it induces. The -function returns the number of deleted edges. +The curve is specified by its handle `ch`, from +the arrangement `arr`, by deleting all the edges it induces. The +function returns the number of deleted edges. */ template @@ -356,4 +354,3 @@ template& res); } /* namespace CGAL */ - diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXAtLimit_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXAtLimit_2.h deleted file mode 100644 index b5c727aee88..00000000000 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXAtLimit_2.h +++ /dev/null @@ -1,69 +0,0 @@ -namespace ArrTraits { -/*! -\ingroup PkgArrangement2ConceptsFunctionObjects -\cgalConcept - -\cgalRefines AdaptableFunctor - -\cgalHasModel ArrangementOpenBoundaryTraits_2::Compare_x_at_limit_2 - -*/ - -class CompareXAtLimit_2 { -public: - -/// \name Operations -/// A model of this concept must provide: -/// @{ - -/*! -Given a point `p`, an \f$ x\f$-monotone curve `xcv`, and an -enumeration `ce` that specifies either the minimum or the -maximum end of the curve where the curve has a vertical asymptote, -compares the \f$ x\f$-coordinate of `p` and the \f$ x\f$-coordinate of the -limit of the curve at its specificed end. The variable `xcv` -identifies the parametric curve \f$ C(t) = (X(t),Y(t))\f$ defined over an -open or half-open interval with endpoints \f$ 0\f$ and \f$ 1\f$. The -enumeration `ce` identifies an open end \f$ d \in\{0,1\}\f$ of \f$ C\f$. -Formally, compares the \f$ x\f$-coordinate of `p` and -\f$ \lim_{t \rightarrow d} X(t)\f$. Returns `SMALLER`, `EQUAL`, or -`LARGER` accordingly. -\pre `parameter_space_in_y_2`(`xcv`, `ce`) \f$ \neq\f$ `ARR_INTERIOR`. -\pre If the parameter space is unbounded, \f$ C\f$ has a vertical asymptote at its \f$ d\f$-end; that is, `parameter_space_in_x_2`(`xcv`, `ce`) = `ARR_INTERIOR`. -*/ -Comparison_result operator()(const ArrTraits::Point_2& p, -const ArrTraits::X_monotone_curve_2& xcv, -Arr_curve_end ce); - -/*! -Given two \f$ x\f$-monotone curves `xcv1` and `xcv2` and two -indices `ce1` and `ce2` that specify either the minimum -or the maximum ends of `xcv1` and `xcv2`, respectively, -where the curves have vertical asymptotes, compares the -\f$ x\f$-coordinates of the limits of the curves at their specificed -ends. The variables `xcv1` and `xcv2` identify the -parametric curves \f$ C_1(t) = (X_1(t),Y_1(t))\f$ and -\f$ C_2(t) = (X_2(t),Y_2(t))\f$, respectively, defined over open or -half-open intervals with endpoints \f$ 0\f$ and \f$ 1\f$. The indices -`ce1` and `ce2` identify open ends \f$ d_1 \in\{0,1\}\f$ and -\f$ d_2 \in\{0,1\}\f$ of \f$ C_1\f$ and \f$ C_2\f$, respectively. Formally, -compares \f$ \lim_{t \rightarrow d_1} X_1(t)\f$ and -\f$ \lim_{t \rightarrow d_2} X_2(t)\f$. Returns `SMALLER`, `EQUAL`, -or `LARGER` accordingly. -\pre `parameter_space_in_y_2`(`xcv1`, `ce1`) \f$ \neq\f$ `ARR_INTERIOR`. -\pre `parameter_space_in_y_2`(`xcv2`, `ce2`) \f$ \neq\f$ `ARR_INTERIOR`. -\pre If the parameter space is unbounded, \f$ C_1\f$ has a vertical asymptote at its respective end; that is, -`parameter_space_in_x_2`(`xcv1`, `ce1`) = `ARR_INTERIOR`. -\pre If the parameter space is unbounded, \f$ C_2\f$ has a vertical asymptote at its respective end; that is, -`parameter_space_in_x_2`(`xcv2`, `ce2`) = `ARR_INTERIOR`. -*/ -Comparison_result operator()(const ArrTraits::X_monotone_curve_2& xcv1, -Arr_curve_end ce1, -const ArrTraits::X_monotone_curve_2& xcv2, -Arr_curve_end ce2); - -/// @} - -}; /* end ArrTraits::CompareXAtLimit_2 */ - -} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXNearLimit_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXNearBoundary_2.h similarity index 52% rename from Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXNearLimit_2.h rename to Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXNearBoundary_2.h index e3c56fbeadb..d31d40570e1 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXNearLimit_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXNearBoundary_2.h @@ -3,13 +3,13 @@ namespace ArrTraits { \ingroup PkgArrangement2ConceptsFunctionObjects \cgalConcept -\cgalRefines AdaptableTernaryFunction +\cgalRefines AdaptableTernaryFunction -\cgalHasModel ArrangementOpenBoundaryTraits_2::Compare_x_near_limit_2 +\cgalHasModel ArrangementOpenBoundaryTraits_2::Compare_x_near_boundary_2 */ -class CompareXNearLimit_2 { +class CompareXNearBoundary_2 { public: /// \name Operations @@ -17,29 +17,29 @@ public: /// @{ /*! -Given two \f$ x\f$-monotone curves `xcv1` and `xcv2` and an -enumeration `ce` that specifies either the minimum ends or the -maximum ends of the curves where the curves have a vertical -asymptote, compares the \f$ x\f$-coordinate of the curves near their -respective ends. Returns `SMALLER`, `EQUAL`, or `LARGER` -accordingly. More precisely, compares the \f$ x\f$-coordinates of the -horizontal projection of a point \f$ p\f$ onto `xcv1` and `xcv2`. -If `xcv1` and `xcv2` approach the bottom boundary-side, \f$ p\f$ -is located far to the bottom, such that the result is invariant -under a translation of \f$ p\f$ farther to the bottom. If `xcv1` -and `xcv2` approach the top boundary-side, \f$ p\f$ is located far -to the top in a similar manner. -\pre The \f$ x\f$-coordinates of the limits of the curves at their respective ends are equal. That is, -`compare_x_at_limit_2`(`xcv1`, `xcv2`, `ce`) = `EQUAL`. -\pre `parameter_space_in_y_2`(`xcv1`, `ce`) = `parameter_space_in_y_2`(`xcv2`, `ce`). -\pre `parameter_space_in_y_2`(`xcv1`, `ce`) \f$ \neq\f$ `ARR_INTERIOR`. -*/ -Comparison_result operator()(const ArrTraits::X_monotone_curve_2& xcv1, -const ArrTraits::X_monotone_curve_2& xcv2, -Arr_curve_end ce); +Given two \f$ x\f$-monotone curves `xcv1` and `xcv2` and an +enumeration `ce` that specifies either the minimum ends or the +maximum ends of the curves where the curves have a vertical +asymptote, compares the \f$ x\f$-coordinate of the curves near their +respective ends. Returns `SMALLER`, `EQUAL`, or `LARGER` +accordingly. More precisely, compares the \f$ x\f$-coordinates of the +horizontal projection of a point \f$ p\f$ onto `xcv1` and `xcv2`. +If `xcv1` and `xcv2` approach the bottom boundary-side, \f$ p\f$ +is located far to the bottom, such that the result is invariant +under a translation of \f$ p\f$ farther to the bottom. If `xcv1` +and `xcv2` approach the top boundary-side, \f$ p\f$ is located far +to the top in a similar manner. +\pre The \f$ x\f$-coordinates of the limits of the curves at their respective ends are equal. That is, +`compare_x_at_limit_2`(`xcv1`, `xcv2`, `ce`) = `EQUAL`. +\pre `parameter_space_in_y_2`(`xcv1`, `ce`) = `parameter_space_in_y_2`(`xcv2`, `ce`). +\pre `parameter_space_in_y_2`(`xcv1`, `ce`) \f$ \neq\f$ `ARR_INTERIOR`. +*/ +Comparison_result operator()(const ArrTraits::X_monotone_curve_2& xcv1, +const ArrTraits::X_monotone_curve_2& xcv2, +Arr_curve_end ce); /// @} -}; /* end ArrTraits::CompareXNearLimit_2 */ +}; /* end ArrTraits::CompareXNearBoundary_2 */ } diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXOnBoundary_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXOnBoundary_2.h new file mode 100644 index 00000000000..a5044a05f1e --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--CompareXOnBoundary_2.h @@ -0,0 +1,69 @@ +namespace ArrTraits { +/*! +\ingroup PkgArrangement2ConceptsFunctionObjects +\cgalConcept + +\cgalRefines AdaptableFunctor + +\cgalHasModel ArrangementOpenBoundaryTraits_2::Compare_x_on_boundary_2 + +*/ + +class CompareXOnBoundary_2 { +public: + +/// \name Operations +/// A model of this concept must provide: +/// @{ + +/*! +Given a point `p`, an \f$ x\f$-monotone curve `xcv`, and an +enumeration `ce` that specifies either the minimum or the +maximum end of the curve where the curve has a vertical asymptote, +compares the \f$ x\f$-coordinate of `p` and the \f$ x\f$-coordinate of the +limit of the curve at its specificed end. The variable `xcv` +identifies the parametric curve \f$ C(t) = (X(t),Y(t))\f$ defined over an +open or half-open interval with endpoints \f$ 0\f$ and \f$ 1\f$. The +enumeration `ce` identifies an open end \f$ d \in\{0,1\}\f$ of \f$ C\f$. +Formally, compares the \f$ x\f$-coordinate of `p` and +\f$ \lim_{t \rightarrow d} X(t)\f$. Returns `SMALLER`, `EQUAL`, or +`LARGER` accordingly. +\pre `parameter_space_in_y_2`(`xcv`, `ce`) \f$ \neq\f$ `ARR_INTERIOR`. +\pre If the parameter space is unbounded, \f$ C\f$ has a vertical asymptote at its \f$ d\f$-end; that is, `parameter_space_in_x_2`(`xcv`, `ce`) = `ARR_INTERIOR`. +*/ +Comparison_result operator()(const ArrTraits::Point_2& p, +const ArrTraits::X_monotone_curve_2& xcv, +Arr_curve_end ce); + +/*! +Given two \f$ x\f$-monotone curves `xcv1` and `xcv2` and two +indices `ce1` and `ce2` that specify either the minimum +or the maximum ends of `xcv1` and `xcv2`, respectively, +where the curves have vertical asymptotes, compares the +\f$ x\f$-coordinates of the limits of the curves at their specificed +ends. The variables `xcv1` and `xcv2` identify the +parametric curves \f$ C_1(t) = (X_1(t),Y_1(t))\f$ and +\f$ C_2(t) = (X_2(t),Y_2(t))\f$, respectively, defined over open or +half-open intervals with endpoints \f$ 0\f$ and \f$ 1\f$. The indices +`ce1` and `ce2` identify open ends \f$ d_1 \in\{0,1\}\f$ and +\f$ d_2 \in\{0,1\}\f$ of \f$ C_1\f$ and \f$ C_2\f$, respectively. Formally, +compares \f$ \lim_{t \rightarrow d_1} X_1(t)\f$ and +\f$ \lim_{t \rightarrow d_2} X_2(t)\f$. Returns `SMALLER`, `EQUAL`, +or `LARGER` accordingly. +\pre `parameter_space_in_y_2`(`xcv1`, `ce1`) \f$ \neq\f$ `ARR_INTERIOR`. +\pre `parameter_space_in_y_2`(`xcv2`, `ce2`) \f$ \neq\f$ `ARR_INTERIOR`. +\pre If the parameter space is unbounded, \f$ C_1\f$ has a vertical asymptote at its respective end; that is, +`parameter_space_in_x_2`(`xcv1`, `ce1`) = `ARR_INTERIOR`. +\pre If the parameter space is unbounded, \f$ C_2\f$ has a vertical asymptote at its respective end; that is, +`parameter_space_in_x_2`(`xcv2`, `ce2`) = `ARR_INTERIOR`. +*/ +Comparison_result operator()(const ArrTraits::X_monotone_curve_2& xcv1, +Arr_curve_end ce1, +const ArrTraits::X_monotone_curve_2& xcv2, +Arr_curve_end ce2); + +/// @} + +}; /* end ArrTraits::CompareXOnBoundary_2 */ + +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Intersect_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Intersect_2.h index f97f43d645b..d8991f8fb05 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Intersect_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrTraits--Intersect_2.h @@ -3,9 +3,9 @@ namespace ArrTraits { \ingroup PkgArrangement2ConceptsFunctionObjects \cgalConcept -\cgalRefines Functor +\cgalRefines Functor -\cgalHasModel ArrangementXMonotoneTraits_2::Intersect_2 +\cgalHasModel ArrangementXMonotoneTraits_2::Intersect_2 */ @@ -16,21 +16,30 @@ public: /// A model of this concept must provide: /// @{ -/*! -computes the intersections of `xc1` and `xc2` and -inserts them in an ascending lexicographic \f$ xy\f$-order into the -output iterator `oi`. The value-type of `Output_iterator` is -`CGAL::Object`, where each `Object` wraps either a -`pair` object, which -represents an intersection point with its multiplicity (in case the -multiplicity is undefined or unknown, it should be set to \f$ 0\f$) or an -`ArrTraits::X_monotone_curve_2` object, representing an -overlapping subcurve of `xc1` and `xc2`. The operator -returns a past-the-end iterator for the output sequence. -*/ -Output_iterator operator()(ArrTraits::X_monotone_curve_2 xc1, -ArrTraits::X_monotone_curve_2 xc2, -Output_iterator& oi); +/*! computes the intersections of `xc1` and `xc2` and writes them in an + * ascending lexicographic \f$ xy\f$-order into the output iterator + * `oi`. The type of a value written into `oi` must be convertible to + * `CGAL::Object`. The value itself wraps either a value of type + * `pair` or a value of type + * `ArrTraits::X_monotone_curve_2`. A value of of the former type represents an + * intersection point with its multiplicity; in case the multiplicity is + * undefined or unknown, it should be set to \f$ 0\f$). A value of the latter + * type representing an overlapping subcurve of `xc1` and `xc2`. The operator + * returns a past-the-end iterator for the output sequence. + * + * A special case may occur when the parameter space of the surface, the + * arrangement is embedded on, is identified on the left and right sides of the + * boundary. An intersection point that lies on the identification curve, + * between two \f$X\f$-monotone curves that intersect at their left and right + * ends must be ignored. Consider two \f$X\f$-monotone curves that intersect at + * their left and right ends, respectively, at a point \f$p\f$ that lies on the + * identification curve. If, for example, the number of intersections between + * these two curves is greater than 1, the order of intersections is + * non-deterministic. + */ +Output_iterator operator()(ArrTraits::X_monotone_curve_2 xc1, +ArrTraits::X_monotone_curve_2 xc2, +Output_iterator& oi); /// @} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementApproximateTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementApproximateTraits_2.h index 589bc03c6f7..567792d67bc 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementApproximateTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementApproximateTraits_2.h @@ -17,8 +17,8 @@ point. \cgalHasModel `CGAL::Arr_polyline_traits_2` \cgalHasModel `CGAL::Arr_rational_function_traits_2` -\sa ArrangementConstructXMonotoneCurveTraits_2`, - ArrangementXMonotoneTraits_2`, and +\sa `ArrangementConstructXMonotoneCurveTraits_2`, + `ArrangementXMonotoneTraits_2`, and `ArrangementTraits_2` */ class ArrangementApproximateTraits_2 { diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementBottomSideTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementBottomSideTraits_2.h new file mode 100644 index 00000000000..408fd394965 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementBottomSideTraits_2.h @@ -0,0 +1,32 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * `ArrangementBottomSideTraits_2` is an abstract concept. It generalizes all + * concepts that handle curves that either reach or approach the bottom boundary + * side of the parameter space. + * + * \cgalRefines `ArrangementHorizontalSideTraits_2` + * + * \sa `ArrangementLeftSideTraits_2`, + * `ArrangementRightSideTraits_2`, and + * `ArrangementTopSideTraits_2` + */ + +class ArrangementBottomSideTraits_2 { +public: + /// \name Categories + /// @{ + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedBottomTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedBottomTraits_2.h new file mode 100644 index 00000000000..cb588f729e5 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedBottomTraits_2.h @@ -0,0 +1,40 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * A model of the concept `ArrangementClosedBottomTraits_2` must be used when + * the parameter space of the surface, the arrangement is embedded on, is closed + * on the left side and curves inserted into the arrangement are expected to + * reach this boundary side. A model of this concept can handle curves that + * reach the left boundary side when it is closed. + * + * \cgalRefines `ArrangementBottomSideTraits_2` + * + * \sa `ArrangementClosedLeftTraits_2`, + * `ArrangementClosedRightTraits_2`, + * `ArrangementClosedTopTraits_2`, + * `ArrangementOpenBottomTraits_2`, + * `ArrangementContractedBottomTraits_2`, and + * `ArrangementIdentifiedBottomTraits_2` + */ + +class ArrangementClosedBottomTraits_2 { +public: + /// \name Categories + /// @{ + + //! Must be convertible to `Arr_closed_side_tag`. + typedef unspecified_type Bottom_side_category; + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedLeftTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedLeftTraits_2.h new file mode 100644 index 00000000000..01ffa0afab4 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedLeftTraits_2.h @@ -0,0 +1,41 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * A model of the concept `ArrangementClosedLeftTraits_2` must be used when the + * parameter space of the surface, the arrangement is embedded on, is closed on + * the left side and curves inserted into the arrangement are expected to reach + * this boundary side. A model of this concept can handle curves that reach the + * left boundary side when it is closed. + + * \cgalRefines `ArrangementLeftSideTraits_2` + +\sa `ArrangementClosedRightTraits_2`, + `ArrangementClosedBottomTraits_2`, + `ArrangementClosedTopTraits_2`, + `ArrangementOpenLeftTraits_2`, + `ArrangementContractedLeftTraits_2`, and + `ArrangementIdentifiedLeftTraits_2`, +*/ + +class ArrangementClosedLeftTraits_2 { +public: + /// \name Categories + /// @{ + + /*! Must be convertible to `Arr_closed_side_tag`. + */ + typedef unspecified_type Left_side_category; + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedRightTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedRightTraits_2.h new file mode 100644 index 00000000000..2673eca162c --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedRightTraits_2.h @@ -0,0 +1,40 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * A model of the concept `ArrangementClosedRightTraits_2` must be used when the + * parameter space of the surface, the arrangement is embedded on, is closed on + * the right side and curves inserted into the arrangement are expected to reach + * this boundary side. A model of this concept can handle curves that reach the + * right boundary side when it is closed. + * + * \cgalRefines `ArrangementRightSideTraits_2` + * + * \sa `ArrangementClosedLeftTraits_2`, + * `ArrangementClosedBottomTraits_2`, + * `ArrangementClosedTopTraits_2`, + * `ArrangementOpenRightTraits_2`, + * `ArrangementContractedRightTraits_2`, and + * `ArrangementIdentifiedRightTraits_2`, + */ + +class ArrangementClosedRightTraits_2 { +public: + /// \name Categories + /// @{ + + //! Must be convertible to `Arr_closed_side_tag`. + typedef unspecified_type Right_side_category; + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedTopTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedTopTraits_2.h new file mode 100644 index 00000000000..e0e8cda7c6a --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementClosedTopTraits_2.h @@ -0,0 +1,40 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * A model of the concept `ArrangementClosedTopTraits_2` must be used when the + * parameter space of the surface, the arrangement is embedded on, is closed on + * the top side and curves inserted into the arrangement are expected to reach + * this boundary side. A model of this concept can handle curves that reach the + * top boundary side when it is closed. + * + * \cgalRefines `ArrangementTopSideTraits_2` + * + * \sa `ArrangementClosedLeftTraits_2`, + * `ArrangementClosedRightTraits_2`, + * `ArrangementClosedBottomTraits_2`, + * `ArrangementOpenTopTraits_2`, + * `ArrangementContractedTopTraits_2`, and + * `ArrangementIdentifiedTopTraits_2` + */ + +class ArrangementClosedTopTraits_2 { +public: + /// \name Categories + /// @{ + + //! Must be convertible to `Arr_closed_side_tag`. + typedef unspecified_type Top_side_category; + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedBottomTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedBottomTraits_2.h new file mode 100644 index 00000000000..ac486e2ab84 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedBottomTraits_2.h @@ -0,0 +1,40 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * A model of the concept `ArrangementContractedBottomTraits_2` must be used + * when the parameter space of the surface, the arrangement is embedded on, is + * contracted on the bottom side and curves inserted into the arrangement are + * expected to reach this boundary side. A model of this concept can handle + * curves that reach the bottom boundary side when it is contracted. + * + * \cgalRefines `ArrangementBottomSideTraits_2` + * + * \sa `ArrangementContractedLeftTraits_2`, + * `ArrangementContractedRightTraits_2`, + * `ArrangementContractedTopTraits_2`, + * `ArrangementClosedBottomTraits_2`, + * `ArrangementContractedBottomTraits_2`, and + * `ArrangementIdentifiedBottomTraits_2` + */ + +class ArrangementContractedBottomTraits_2 { +public: + /// \name Categories + /// @{ + + //! Must be convertible to `Arr_contracted_side_tag`. + typedef unspecified_type Bottom_side_category; + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedLeftTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedLeftTraits_2.h new file mode 100644 index 00000000000..3916a8e0b90 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedLeftTraits_2.h @@ -0,0 +1,40 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * A model of the concept `ArrangementContractedLeftTraits_2` must be used when + * the parameter space of the surface, the arrangement is embedded on, is + * contracted on the left side and curves inserted into the arrangement are + * expected to reach this boundary side. A model of this concept can handle + * curves that reach the left boundary side when it is contracted. + * + * \cgalRefines `ArrangementLeftSideTraits_2` + * + * \sa `ArrangementContractedRightTraits_2`, + * `ArrangementContractedBottomTraits_2`, + * `ArrangementContractedTopTraits_2`, + * `ArrangementOpenLeftTraits_2`, + * `ArrangementClosedLeftTraits_2`, and + * `ArrangementIdentifiedLeftTraits_2` + */ + +class ArrangementContractedLeftTraits_2 { +public: + /// \name Categories + /// @{ + + //! Must be convertible to `Arr_contracted_side_tag`. + typedef unspecified_type Left_side_category; + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedRightTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedRightTraits_2.h new file mode 100644 index 00000000000..15b23c50a1f --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedRightTraits_2.h @@ -0,0 +1,40 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * A model of the concept `ArrangementContractedRightTraits_2` must be used when + * the parameter space of the surface, the arrangement is embedded on, is + * contracted on the right side and curves inserted into the arrangement are + * expected to reach this boundary side. A model of this concept can handle + * curves that reach the right boundary side when it is contracted. + * + * \cgalRefines `ArrangementRightSideTraits_2` + * + * \sa `ArrangementContractedLeftTraits_2`, + * `ArrangementContractedBottomTraits_2`, + * `ArrangementContractedTopTraits_2`, + * `ArrangementOpenRightTraits_2`, + * `ArrangementClosedRightTraits_2`, and + * `ArrangementIdentifiedRightTraits_2` + */ + +class ArrangementContractedRightTraits_2 { +public: + /// \name Categories + /// @{ + + //! Must be convertible to `Arr_contracted_side_tag`. + typedef unspecified_type Right_side_category; + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedTopTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedTopTraits_2.h new file mode 100644 index 00000000000..2e2b3bc54f1 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementContractedTopTraits_2.h @@ -0,0 +1,40 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * A model of the concept `ArrangementContractedTopTraits_2` must be used when + * the parameter space of the surface, the arrangement is embedded on, is + * contracted on the top side and curves inserted into the arrangement are + * expected to reach this boundary side. A model of this concept can handle + * curves that reach the top boundary side when it is contracted. + * + * \cgalRefines `ArrangementTopSideTraits_2` + * + * \sa `ArrangementContractedLeftTraits_2`, + * `ArrangementContractedRightTraits_2`, + * `ArrangementContractedBottomTraits_2`, + * `ArrangementOpenTopTraits_2`, + * `ArrangementSlosedTopTraits_2`, and + * `ArrangementIdentifiedTopTraits_2` + */ + +class ArrangementContractedTopTraits_2 { +public: + /// \name Categories + /// @{ + + //! Must be convertible to `Arr_contracted_side_tag`. + typedef unspecified_type Top_side_category; + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementHorizontalSideTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementHorizontalSideTraits_2.h new file mode 100644 index 00000000000..8e30acb9f0d --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementHorizontalSideTraits_2.h @@ -0,0 +1,47 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * `ArrangementHorizontalSideTraits_2` is an abstract concept. It generalizes all + * concepts that handle curves that either reach or approach either the bottom + * or top sizeds of the boundary of the parameter space. + * + * \cgalRefines `ArrangementBasicTraits_2` + * + * \cgalHasModel `CGAL::Arr_geodesic_arc_on_sphere_traits_2` + * + * \sa `ArrangementVerticalSideTraits_2` + */ + +class ArrangementHorizontalSideTraits_2 { +public: + + /// \name Categories + /// @{ + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// models the concept `ArrTraits::ParameterSpaceInX_2`. + typedef unspecified_type Parameter_space_in_x_2; + + /// models the concept `ArrTraits::CompareXOnBoundary_2`. + typedef unspecified_type Compare_x_on_boundary_2; + + /// models the concept `ArrTraits::CompareXNearBoundary_2`. + typedef unspecified_type Compare_x_near_boundary_2; + /// @} + + /// \name Accessing Functor Objects + /// @{ + Parameter_space_in_x_2 parameter_space_in_x_2_object() const; + Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const; + Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const; + /// @} + +}; /* end ArrangementHorizontalSideTraits_2 */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedBottomTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedBottomTraits_2.h new file mode 100644 index 00000000000..01fc5d8fc77 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedBottomTraits_2.h @@ -0,0 +1,40 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * A model of the concept `ArrangementIdentifiedBottomTraits_2` must be used + * when the parameter space of the surface, the arrangement is embedded on, is + * identified on the bottom side and curves inserted into the arrangement are + * expected to reach this boundary side. A model of this concept can handle + * curves that reach the bottom boundary side when it is identified. + * + * \cgalRefines `ArrangementBottomSideTraits_2` + * + * \sa `ArrangementIdentifiedRightTraits_2`, + * `ArrangementIdentifiedBottomTraits_2`, + * `ArrangementIdentifiedTopTraits_2`, + * `ArrangementOpenBottomTraits_2`, + * `ArrangementClosedBottomTraits_2`, and + * `ArrangementConstractedBottomTraits_2` + */ + +class ArrangementIdentifiedBottomTraits_2 { +public: + /// \name Categories + /// @{ + + //! Must be convertible to `Arr_identified_side_tag`. + typedef unspecified_type Bottom_side_category; + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedLeftTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedLeftTraits_2.h new file mode 100644 index 00000000000..7b3d2a83442 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedLeftTraits_2.h @@ -0,0 +1,40 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * A model of the concept `ArrangementIdentifiedLeftTraits_2` must be used when + * the parameter space of the surface, the arrangement is embedded on, is + * identified on the left side and curves inserted into the arrangement are + * expected to reach this boundary side. A model of this concept can handle + * curves that reach the left boundary side when it is identified. + * + * \cgalRefines `ArrangementLeftSideTraits_2` + * + * \sa `ArrangementIdentifiedRightTraits_2`, + * `ArrangementIdentifiedBottomTraits_2`, + * `ArrangementIdentifiedTopTraits_2`, + * `ArrangementOpenLeftTraits_2`, + * `ArrangementClosedLeftTraits_2`, and + * `ArrangementConstractedLeftTraits_2` + */ + +class ArrangementIdentifiedLeftTraits_2 { +public: + /// \name Categories + /// @{ + + //! Must be convertible to `Arr_identified_side_tag`. + typedef unspecified_type Left_side_category; + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedRightTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedRightTraits_2.h new file mode 100644 index 00000000000..f71531c9fe2 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedRightTraits_2.h @@ -0,0 +1,40 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * A model of the concept `ArrangementIdentifiedRightTraits_2` must be used when + * the parameter space of the surface, the arrangement is embedded on, is + * identified on the right side and curves inserted into the arrangement are + * expected to reach this boundary side. A model of this concept can handle + * curves that reach the right boundary side when it is identified. + * + * \cgalRefines `ArrangementRightSideTraits_2` + * + * \sa `ArrangementIdentifiedLeftTraits_2`, + * `ArrangementIdentifiedBottomTraits_2`, + * `ArrangementIdentifiedTopTraits_2`, + * `ArrangementOpenRightTraits_2`, + * `ArrangementClosedRightTraits_2`, and + * `ArrangementConstractedRightTraits_2` + */ + +class ArrangementIdentifiedRightTraits_2 { +public: + /// \name Categories + /// @{ + + //! Must be convertible to `Arr_identified_side_tag`. + typedef unspecified_type Right_side_category; + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedTopTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedTopTraits_2.h new file mode 100644 index 00000000000..e3fab6ee30f --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementIdentifiedTopTraits_2.h @@ -0,0 +1,40 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * A model of the concept `ArrangementIdentifiedTopTraits_2` must be used when + * the parameter space of the surface, the arrangement is embedded on, is + * identified on the top side and curves inserted into the arrangement are + * expected to reach this boundary side. A model of this concept can handle + * curves that reach the top boundary side when it is identified. + * + * \cgalRefines `ArrangementTopSideTraits_2` + * + * \sa `ArrangementIdentifiedLeftTraits_2`, + * `ArrangementIdentifiedRightTraits_2`, + * `ArrangementIdentifiedBottomTraits_2`, + * `ArrangementOpenTopTraits_2`, + * `ArrangementClosedTopTraits_2`, and + * `ArrangementConstractedTopTraits_2` + */ + +class ArrangementIdentifiedTopTraits_2 { +public: + /// \name Categories + /// @{ + + //! Must be convertible to `Arr_identified_side_tag`. + typedef unspecified_type Top_side_category; + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementLeftSideTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementLeftSideTraits_2.h new file mode 100644 index 00000000000..6014e6adaef --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementLeftSideTraits_2.h @@ -0,0 +1,32 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * `ArrangementLeftSideTraits_2` is an abstract concept. It generalizes all + * concepts that handle curves that either reach or approach the left boundary + * side of the parameter space. + * + * \cgalRefines `ArrangementVerticalSideTraits_2` + * + * \sa `ArrangementRightSideTraits_2`, + * `ArrangementBottomSideTraits_2`, and + * `ArrangementTopSideTraits_2` + */ + +class ArrangementLeftSideTraits_2 { +public: + /// \name Categories + /// @{ + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenBottomTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenBottomTraits_2.h new file mode 100644 index 00000000000..58bac91ff7b --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenBottomTraits_2.h @@ -0,0 +1,40 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * A model of the concept `ArrangementOpenBottomTraits_2` must be used when the + * parameter space of the surface, the arrangement is embedded on, is open on + * the bottom side and curves inserted into the arrangement are expected to + * reach this boundary side. A model of this concept can handle curves that + * reach the bottom boundary side when it is open. + * + * \cgalRefines `ArrangementBottomSideTraits_2` + * + * \sa `ArrangementOpenLeftTraits_2`, + * `ArrangementOpenRightTraits_2`, + * `ArrangementOpenTopTraits_2`, + * `ArrangementClosedBottomTraits_2`, + * `ArrangementContractedBottomTraits_2`, and + * `ArrangementIdentifiedBottomTraits_2` + */ + +class ArrangementOpenBottomTraits_2 { +public: + /// \name Categories + /// @{ + + //! Must be convertible to `Arr_open_side_tag`. + typedef unspecified_type Bottom_side_category; + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenBoundaryTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenBoundaryTraits_2.h index cfe6553ece6..987c853da19 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenBoundaryTraits_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenBoundaryTraits_2.h @@ -1,167 +1,163 @@ - /*! -\ingroup PkgArrangement2ConceptsTraits -\cgalConcept - -Several predicates are required to handle \f$ x\f$-monotone curves that -approach infinity and thus approach the boundary of the parameter -space. These predicates are sufficient to handle not only curves -embedded in an unbounded parameter space, but also curves embedded -in a bounded parameter space with open boundaries. Models of the -concept `ArrangementOpenBoundaryTraits_2` handle curves that approach the boundary of a -parameter space. This concept refines the concept -`ArrangementBasicTraits_2`. The arrangement template -instantiated with a traits class that models this concept can handle -\f$ x\f$-monotone curves that are unbounded in any direction. The concept -`ArrangementOpenBoundaryTraits_2`, nontheless, also supports planar \f$ x\f$-monotone curves -that reach the boundary of an open yet bounded parameter space. - -An \f$ x\f$-monotone curve may be closed, in which case its endpoints -are representable as `Point_2` objects, or open at the -boundary of the parameter space. It can have one open end and one -closed end (e.g., a ray). The nature of the \f$ x\f$-monotone curves, -whether they are expected to be closed or not at any one of the four -boundary-sides, is conveyed through the definition of the four nested -types `Left_side_category`, `Right_side_category`, -`Bottom_side_category`, and `Top_side_category`. If some curves -handled by a model of the concept `ArrangementOpenBoundaryTraits_2` are expected to be open -on the left, the nested type `Left_side_category` must be convertible -to `CGAL::Arr_open_side_tag`. Similarly, if some curves handled by the -concept are expected to be open on the right, open at the bottom, or -open at the top, the corresponding nested type must be convertible to -`CGAL::Arr_open_side_tag`. A model of the concept `ArrangementOpenBoundaryTraits_2` must have -all the four categories convertible to -`CGAL::Arr_open_side_tag`.\cgalFootnote{We intend to introduce more concepts that require only a subset of the categories to be convertible to `Arr_open_side_tag`.} In this case the Dcel of the arrangement -instantiated with the model is initialized with an implicit bounding -rectangle. When the parameter space is bounded, it is the exact -geometric embedding of the implicit bounding rectangle. - -\cgalRefines `ArrangementBasicTraits_2` - -\cgalHasModel `CGAL::Arr_linear_traits_2` -\cgalHasModel `CGAL::Arr_rational_function_traits_2` -\cgalHasModel `CGAL::Arr_algebraic_segment_traits_2` -\cgalHasModel `CGAL::Arr_curve_data_traits_2` -\cgalHasModel `CGAL::Arr_consolidated_curve_data_traits_2` - -\sa `ArrangementBasicTraits_2` -\sa `ArrangementXMonotoneTraits_2` -\sa `ArrangementLandmarkTraits_2` -\sa `ArrangementTraits_2` - -*/ + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * Several predicates are required to handle \f$ x\f$-monotone curves that + * approach infinity and thus approach the boundary of the parameter + * space. These predicates are sufficient to handle not only curves embedded in + * an unbounded parameter space, but also curves embedded in a bounded parameter + * space with open boundaries. Models of the concept + * `ArrangementOpenBoundaryTraits_2` handle curves that approach the boundary of + * a parameter space. This concept refines the concept + * `ArrangementBasicTraits_2`. The arrangement template instantiated with a + * traits class that models this concept can handle \f$ x\f$-monotone curves + * that are unbounded in any direction. The concept + * `ArrangementOpenBoundaryTraits_2`, nontheless, also supports planar \f$ + * x\f$-monotone curves that reach the boundary of an open yet bounded parameter + * space. + * + * An \f$ x\f$-monotone curve may be closed, in which case its endpoints + * are representable as `Point_2` objects, or open at the boundary of the + * parameter space. It can have one open end and one closed end (e.g., a + * ray). The nature of the \f$ x\f$-monotone curves, whether they are expected + * to be closed or not at any one of the four boundary-sides, is conveyed + * through the definition of the four nested types `Left_side_category`, + * `Right_side_category`, `Bottom_side_category`, and `Top_side_category`. If + * some curves handled by a model of the concept + * `ArrangementOpenBoundaryTraits_2` are expected to be open on the left, the + * nested type `Left_side_category` must be convertible to + * `Arr_open_side_tag`. Similarly, if some curves handled by the concept are + * expected to be open on the right, open at the bottom, or open at the top, the + * corresponding nested type must be convertible to `Arr_open_side_tag`. A model + * of the concept `ArrangementOpenBoundaryTraits_2` must have all the four + * categories convertible to `Arr_open_side_tag`.\cgalFootnote{We intend to + * introduce more concepts that require only a subset of the categories to be + * convertible to `Arr_open_side_tag`.} In this case the Dcel of the arrangement instantiated with the model is + * initialized with an implicit bounding rectangle. When the parameter space is + * bounded, it is the exact geometric embedding of the implicit bounding + * rectangle. + * + * \cgalRefines `ArrangementBasicTraits_2` + * + * \cgalHasModel `CGAL::Arr_linear_traits_2` + * \cgalHasModel `CGAL::Arr_rational_function_traits_2` + * \cgalHasModel `CGAL::Arr_algebraic_segment_traits_2` + * \cgalHasModel `CGAL::Arr_curve_data_traits_2` + * \cgalHasModel `CGAL::Arr_consolidated_curve_data_traits_2` + * + * \sa `ArrangementBasicTraits_2` + * \sa `ArrangementXMonotoneTraits_2` + * \sa `ArrangementLandmarkTraits_2` + * \sa `ArrangementTraits_2` + */ class ArrangementOpenBoundaryTraits_2 { public: -/// \name Categories +/// \name Categories /// @{ /*! -Must be convertible to either `CGAL::Arr_oblivious_side_tag` or -`CGAL::Arr_open_side_tag`. -*/ -typedef unspecified_type Left_side_category; +Must be convertible to either `CGAL::Arr_oblivious_side_tag` or +`CGAL::Arr_open_side_tag`. +*/ +typedef unspecified_type Left_side_category; /*! -Must be convertible to either `CGAL::Arr_oblivious_side_tag` or -`CGAL::Arr_open_side_tag`. -*/ -typedef unspecified_type Bottom_side_category; +Must be convertible to either `CGAL::Arr_oblivious_side_tag` or +`CGAL::Arr_open_side_tag`. +*/ +typedef unspecified_type Bottom_side_category; /*! -Must be convertible to either `CGAL::Arr_oblivious_side_tag` or -`CGAL::Arr_open_side_tag`. -*/ -typedef unspecified_type Top_side_category; +Must be convertible to either `CGAL::Arr_oblivious_side_tag` or +`CGAL::Arr_open_side_tag`. +*/ +typedef unspecified_type Top_side_category; /*! -Must be convertible to either `CGAL::Arr_oblivious_side_tag` or -`CGAL::Arr_open_side_tag`. -*/ -typedef unspecified_type Right_side_category; - -/// @} - -/// \name Functor Types -/// @{ - -/*! -models the concept `ArrTraits::ParameterSpaceInX_2`. -Required only if the traits class supports unbounded curves that -approach the left or the right sides (the `Left_side_category` -or the `Right_side_category` categories are convertible to -`CGAL::Arr_open_side_tag`). -*/ -typedef unspecified_type Parameter_space_in_x_2; - -/*! -models the concept `ArrTraits::CompareYNearBoundary_2`. -Required only if the traits class supports unbounded curves that -approach the left or the right sides (the `Left_side_category` -or the `Right_side_category` categories are convertible to -`CGAL::Arr_open_side_tag`). -*/ -typedef unspecified_type Compare_y_near_boundary_2; - -/*! -models the concept `ArrTraits::ParameterSpaceInY_2`. -Required only if the traits class supports unbounded curves that -approach the bottom or the top sides (the `Bottom_side_category` -or the `Top_side_category` categories are convertible to -`CGAL::Arr_open_side_tag`). -*/ -typedef unspecified_type Parameter_space_in_y_2; - -/*! -models the concept `ArrTraits::CompareXAtLimit_2`. -Required only if the traits class supports unbounded curves that -approach the bottom or the top sides (the `Bottom_side_category` -or the `Top_side_category` categories are convertible to -`CGAL::Arr_open_side_tag`). -*/ -typedef unspecified_type Compare_x_at_limit_2; - -/*! -models the concept `ArrTraits::CompareXNearLimit_2`. -Required only if the traits class supports unbounded curves that -approach the bottom or the top sides (the `Bottom_side_category` -or the `Top_side_category` categories are convertible to -`CGAL::Arr_open_side_tag`). -*/ -typedef unspecified_type Compare_x_near_limit_2; - -/// @} - -/// \name Accessing Functor Objects -/// @{ - -/*! - -*/ -Parameter_space_in_x_2 parameter_space_in_x_2_object() const; - -/*! - -*/ -Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const; - -/*! - -*/ -Parameter_space_in_y_2 parameter_space_in_y_2_object() const; - -/*! - -*/ -Compare_x_at_limit_2 compare_x_at_limit_2_object() const; - -/*! - -*/ -Compare_x_near_limit_2 compare_x_near_limit_2_object() const; +Must be convertible to either `CGAL::Arr_oblivious_side_tag` or +`CGAL::Arr_open_side_tag`. +*/ +typedef unspecified_type Right_side_category; /// @} -}; /* end ArrangementOpenBoundaryTraits_2 */ +/// \name Functor Types +/// @{ +/*! +models the concept `ArrTraits::ParameterSpaceInX_2`. +Required only if the traits class supports unbounded curves that +approach the left or the right sides (the `Left_side_category` +or the `Right_side_category` categories are convertible to +`CGAL::Arr_open_side_tag`). +*/ +typedef unspecified_type Parameter_space_in_x_2; + +/*! +models the concept `ArrTraits::CompareYNearBoundary_2`. +Required only if the traits class supports unbounded curves that +approach the left or the right sides (the `Left_side_category` +or the `Right_side_category` categories are convertible to +`CGAL::Arr_open_side_tag`). +*/ +typedef unspecified_type Compare_y_near_boundary_2; + +/*! +models the concept `ArrTraits::ParameterSpaceInY_2`. +Required only if the traits class supports unbounded curves that +approach the bottom or the top sides (the `Bottom_side_category` +or the `Top_side_category` categories are convertible to +`CGAL::Arr_open_side_tag`). +*/ +typedef unspecified_type Parameter_space_in_y_2; + +/*! +models the concept `ArrTraits::CompareXAtLimit_2`. +Required only if the traits class supports unbounded curves that +approach the bottom or the top sides (the `Bottom_side_category` +or the `Top_side_category` categories are convertible to +`CGAL::Arr_open_side_tag`). +*/ +typedef unspecified_type Compare_x_at_limit_2; + +/*! +models the concept `ArrTraits::CompareXNearLimit_2`. +Required only if the traits class supports unbounded curves that +approach the bottom or the top sides (the `Bottom_side_category` +or the `Top_side_category` categories are convertible to +`CGAL::Arr_open_side_tag`). +*/ +typedef unspecified_type Compare_x_near_limit_2; + +/// @} + +/// \name Accessing Functor Objects +/// @{ + +/*! + +*/ +Parameter_space_in_x_2 parameter_space_in_x_2_object() const; + +/*! + +*/ +Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const; + +/*! + +*/ +Parameter_space_in_y_2 parameter_space_in_y_2_object() const; + + /// \name Functor Types + /// @{ + /// @} + + /// \name Accessing Functor Objects + /// @{ + /// @} + +}; /* end ArrangementOpenBoundaryTraits_2 */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenLeftTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenLeftTraits_2.h new file mode 100644 index 00000000000..117993af002 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenLeftTraits_2.h @@ -0,0 +1,40 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * A model of the concept `ArrangementOpenLeftTraits_2` must be used when the + * parameter space of the surface, the arrangement is embedded on, is open on + * the left side and curves inserted into the arrangement are expected to reach + * this boundary side. A model of this concept can handle curves that reach the + * left boundary side when it is open. + * + * \cgalRefines `ArrangementLeftSideTraits_2` + * + * \sa `ArrangementOpenRightTraits_2`, + * `ArrangementOpenBottomTraits_2`, + * `ArrangementOpenTopTraits_2`, + * `ArrangementClosedLeftTraits_2`, + * `ArrangementContractedLeftTraits_2`, and + * `ArrangementIdentifiedLeftTraits_2` + */ + +class ArrangementOpenLeftTraits_2 { +public: + /// \name Categories + /// @{ + + //! Must be convertible to `Arr_open_side_tag`. + typedef unspecified_type Left_side_category; + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenRightTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenRightTraits_2.h new file mode 100644 index 00000000000..238dcbe4596 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenRightTraits_2.h @@ -0,0 +1,40 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * A model of the concept `ArrangementOpenRightTraits_2` must be used when the + * parameter space of the surface, the arrangement is embedded on, is open on + * the right side and curves inserted into the arrangement are expected to reach + * this boundary side. A model of this concept can handle curves that reach the + * right boundary side when it is open. + * + * \cgalRefines `ArrangementRightSideTraits_2` + * + * \sa `ArrangementOpenLeftTraits_2`, + * `ArrangementOpenBottomTraits_2`, + * `ArrangementOpenTopTraits_2`, + * `ArrangementClosedRightTraits_2`, + * `ArrangementContractedRightTraits_2`, and + * `ArrangementIdentifiedRightTraits_2` + */ + +class ArrangementOpenRightTraits_2 { +public: + /// \name Categories + /// @{ + + //! Must be convertible to `Arr_open_side_tag`. + typedef unspecified_type Right_side_category; + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenTopTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenTopTraits_2.h new file mode 100644 index 00000000000..6ab66d4499c --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementOpenTopTraits_2.h @@ -0,0 +1,40 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * A model of the concept `ArrangementOpenTopTraits_2` must be used when the + * parameter space of the surface, the arrangement is embedded on, is open on + * the top side and curves inserted into the arrangement are expected to reach + * this boundary side. A model of this concept can handle curves that reach the + * top boundary side when it is open. + * + * \cgalRefines `ArrangementTopSideTraits_2` + * + * \sa `ArrangementOpenLeftTraits_2`, + * `ArrangementOpenRightTraits_2`, + * `ArrangementOpenBottomTraits_2`, + * `ArrangementClosedTopTraits_2`, + * `ArrangementContractedTopTraits_2`, and + * `ArrangementIdentifiedTopTraits_2` + */ + +class ArrangementOpenTopTraits_2 { +public: + /// \name Categories + /// @{ + + //! Must be convertible to `Arr_open_side_tag`. + typedef unspecified_type Top_side_category; + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementRightSideTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementRightSideTraits_2.h new file mode 100644 index 00000000000..9931658a3fb --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementRightSideTraits_2.h @@ -0,0 +1,32 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * `ArrangementRightSideTraits_2` is an abstract concept. It generalizes all + * concepts that handle curves that either reach or approach the right boundary + * side of the parameter space. + * + * \cgalRefines `ArrangementVerticalSideTraits_2` + * + * \sa `ArrangementLeftSideTraits_2`, + * `ArrangementBottomSideTraits_2`, and + * `ArrangementTopSideTraits_2` + */ + +class ArrangementRightSideTraits_2 { +public: + /// \name Categories + /// @{ + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementSphericalBoundaryTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementSphericalBoundaryTraits_2.h new file mode 100644 index 00000000000..1354c69aeb9 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementSphericalBoundaryTraits_2.h @@ -0,0 +1,41 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * Models of the concept `ArrangementSphericalBoundaryTraits_2` handle curves on + * a sphere or a surface that is topological equivalent to a sphere. The sphere + * is oriented in such a way that the boundary of the rectangular parameter + * space, the sphere is the mapping of which, is identified on the left and + * right sides and contracted at the top and bottom sides. In other words, + * + * \cgalRefines `ArrangementBasicTraits_2` + * \cgalRefines `ArrangementIdentifiedLeftTraits_2` + * \cgalRefines `ArrangementIdentifiedRightTraits_2` + * \cgalRefines `ArrangementContractedBottomTraits_2` + * \cgalRefines `ArrangementContractedTopTraits_2` + * \cgalRefines + * + * \cgalHasModel `CGAL::Arr_geodesic_arc_on_sphere_traits_2` + * + * \sa `ArrangementOpenBoundaryTraits_2` + * \sa `ArrangementBasicTraits_2` + * \sa `ArrangementIdentifiedLeftTraits_2` + * \sa `ArrangementIdentifiedRightTraits_2` + * \sa `ArrangementContractedBottomTraits_2` + * \sa `ArrangementContractedTopTraits_2` + * \sa `ArrangementHorizontalSideTraits_2` + * \sa `ArrangementVerticalSideTraits_2` + */ + +class ArrangementSphericalBoundaryTraits_2 { +public: + + /// \name Categories + /// @{ + /// @} + + /// \name Functor Types + /// @{ + /// @} + +}; /* end ArrangementSphericalBoundaryTraits_2 */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementTopSideTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementTopSideTraits_2.h new file mode 100644 index 00000000000..d2390ab2634 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementTopSideTraits_2.h @@ -0,0 +1,32 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * `ArrangementTopSideTraits_2` is an abstract concept. It generalizes all + * concepts that handle curves that either reach or approach the top boundary + * side of the parameter space. + * + * \cgalRefines `ArrangementHorizontalSideTraits_2` + * + * \sa `ArrangementLeftSideTraits_2`, + * `ArrangementRightSideTraits_2`, and + * `ArrangementBottomSideTraits_2` + */ + +class ArrangementTopSideTraits_2 { +public: + /// \name Categories + /// @{ + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// \name Accessing Functor Objects + /// @{ + /// @} +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementVerticalSideTraits_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementVerticalSideTraits_2.h new file mode 100644 index 00000000000..f3f530b64f6 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Concepts/ArrangementVerticalSideTraits_2.h @@ -0,0 +1,47 @@ +/*! + * \ingroup PkgArrangement2ConceptsTraits + * \cgalConcept + * + * `ArrangementVerticalSideTraits_2` is an abstract concept. It generalizes all + * concepts that handle curves that either reach or approach either the left + * or right sizeds of the boundary of the parameter space. + * + * \cgalRefines `ArrangementBasicTraits_2` + * + * \cgalHasModel `CGAL::Arr_geodesic_arc_on_sphere_traits_2` + * + * \sa `ArrangementVerticalSideTraits_2` + */ + +class ArrangementVerticalSideTraits_2 { +public: + + /// \name Categories + /// @{ + /// @} + + /// \name Types + /// @{ + /// @} + + /// \name Functor Types + /// @{ + + /// models the concept `ArrTraits::ParameterSpaceInX_2`. + typedef unspecified_type Parameter_space_in_y_2; + + /// models the concept `ArrTraits::CompareXOnBoundary_2`. + typedef unspecified_type Compare_y_on_boundary_2; + + /// models the concept `ArrTraits::CompareXNearBoundary_2`. + typedef unspecified_type Compare_y_near_boundary_2; + /// @} + + /// \name Accessing Functor Objects + /// @{ + Parameter_space_in_y_2 parameter_space_in_y_2_object() const; + Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const; + Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const; + /// @} + +}; /* end ArrangementHorizontalSideTraits_2 */ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt index 844048f8e23..6d3e1f37b3e 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/PackageDescription.txt @@ -111,13 +111,36 @@ implemented as peripheral classes or as free (global) functions. - `ArrangementLandmarkTraits_2` - `ArrangementXMonotoneTraits_2` - `ArrangementTraits_2` +- `ArrangementHorizontalSideTraits_2` +- `ArrangementVerticalSideTraits_2` - `ArrangementOpenBoundaryTraits_2` +- `ArrangementSphericalBoundaryTraits_2` - `ArrangementInputFormatter` - `ArrangementOutputFormatter` - `ArrangementWithHistoryInputFormatter` - `ArrangementWithHistoryOutputFormatter` - `ArrangementPointLocation_2` - `ArrangementVerticalRayShoot_2` +- `ArrangementOpenLeftTraits_2` +- `ArrangementOpenRightTraits_2` +- `ArrangementOpenBottomTraits_2` +- `ArrangementOpenTopTraits_2` +- `ArrangementClosedLeftTraits_2` +- `ArrangementClosedRightTraits_2` +- `ArrangementClosedBottomTraits_2` +- `ArrangementClosedTopTraits_2` +- `ArrangementContractedLeftTraits_2` +- `ArrangementContractedRightTraits_2` +- `ArrangementContractedBottomTraits_2` +- `ArrangementContractedTopTraits_2` +- `ArrangementIdentifiedLeftTraits_2` +- `ArrangementIdentifiedRightTraits_2` +- `ArrangementIdentifiedBottomTraits_2` +- `ArrangementIdentifiedTopTraits_2` +- `ArrangementLeftSideTraits_2` +- `ArrangementRightSideTraits_2` +- `ArrangementBottomSideTraits_2` +- `ArrangementTopSideTraits_2` ## Geometric Object Concepts ## @@ -138,8 +161,8 @@ implemented as peripheral classes or as free (global) functions. - `ArrTraits::Equal_2` - `ArrTraits::ParameterSpaceInX_2` - `ArrTraits::ParameterSpaceInY_2` -- `ArrTraits::CompareXAtLimit_2` -- `ArrTraits::CompareXNearLimit_2` +- `ArrTraits::CompareXOnBoundary_2` +- `ArrTraits::CompareXNearBoundary_2` - `ArrTraits::CompareYNearBoundary_2` - `ArrTraits::Intersect_2` - `ArrTraits::Split_2` @@ -151,10 +174,13 @@ implemented as peripheral classes or as free (global) functions. ## Classes ## + +- `CGAL::Arrangement_on_surface_2` +- `CGAL::Arrangement_on_surface_with_history_2` - `CGAL::Arrangement_2` +- `CGAL::Arrangement_with_history_2` - `CGAL::Arr_accessor` - `CGAL::Arr_observer` -- `CGAL::Arrangement_with_history_2` - `CGAL::Arrangement_2::Vertex` - `CGAL::Arrangement_2::Halfedge` - `CGAL::Arrangement_2::Face` @@ -174,6 +200,7 @@ implemented as peripheral classes or as free (global) functions. - `CGAL::Arr_rational_function_traits_2` - `CGAL::Arr_Bezier_curve_traits_2` - `CGAL::Arr_algebraic_segment_traits_2` +- `CGAL::Arr_geodesic_arc_on_sphere_traits_2` - `CGAL::Arr_curve_data_traits_2` - `CGAL::Arr_consolidated_curve_data_traits_2` - `CGAL::Arr_text_formatter` diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/algebraic_curves.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/algebraic_curves.png index a087f8d0f0f..3043b98e23f 100644 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/algebraic_curves.png and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/algebraic_curves.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/algebraic_segments.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/algebraic_segments.png index f91eb65befd..b25f5523460 100644 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/algebraic_segments.png and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/algebraic_segments.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/arr_segs.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/arr_segs.png index f750229247d..c4081195c43 100644 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/arr_segs.png and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/arr_segs.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/central_concept_cluster.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/central_concept_cluster.png new file mode 100644 index 00000000000..8f47fe2dde1 Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/central_concept_cluster.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/cone.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/cone.png new file mode 100644 index 00000000000..3dc267efb5f Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/cone.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/cylinder.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/cylinder.png new file mode 100644 index 00000000000..e760d56bf8d Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/cylinder.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/degenerate_power_diagram.jpg b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/degenerate_power_diagram.jpg new file mode 100644 index 00000000000..54730089dc0 Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/degenerate_power_diagram.jpg differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/degenerate_voronoi.jpg b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/degenerate_voronoi.jpg new file mode 100644 index 00000000000..4bdad865a62 Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/degenerate_voronoi.jpg differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/ellipsoid.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/ellipsoid.png new file mode 100644 index 00000000000..be97f83984a Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/ellipsoid.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/ex_17.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/ex_17.png deleted file mode 100644 index 2497a8a0249..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/ex_17.png and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/ex_18.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/ex_18.png deleted file mode 100644 index 2edbf5beacf..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/ex_18.png and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/generic-polyline.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/generic-polyline.pdf deleted file mode 100644 index d588e4bf216..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/generic-polyline.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/generic-polyline.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/generic-polyline.png index 92816573d86..7849c361e2c 100644 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/generic-polyline.png and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/generic-polyline.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/insert.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/insert.png index b5ea9889f01..c48dcdcfe58 100644 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/insert.png and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/insert.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/landmark_concept_cluster.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/landmark_concept_cluster.png new file mode 100644 index 00000000000..4230f21bd2f Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/landmark_concept_cluster.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/left_side_cluster.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/left_side_cluster.png new file mode 100644 index 00000000000..aef6892be92 Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/left_side_cluster.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/open_concept_hierarchy.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/open_concept_hierarchy.png new file mode 100644 index 00000000000..a3e45b74265 Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/open_concept_hierarchy.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/paraboloid.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/paraboloid.png new file mode 100644 index 00000000000..47381736a3b Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/paraboloid.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/power_diagram.jpg b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/power_diagram.jpg new file mode 100644 index 00000000000..cda9ec090db Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/power_diagram.jpg differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/pred_around_vertex.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/pred_around_vertex.png index eb2c5ea1304..2e1ff5bfdac 100644 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/pred_around_vertex.png and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/pred_around_vertex.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/side_clusters.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/side_clusters.png new file mode 100644 index 00000000000..d82390981b5 Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/side_clusters.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/simple_arr.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/simple_arr.png new file mode 100644 index 00000000000..e77ff536d71 Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/simple_arr.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/sphere.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/sphere.png new file mode 100644 index 00000000000..c4745a4bbeb Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/sphere.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/spherical_concept_hierarchy.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/spherical_concept_hierarchy.png new file mode 100644 index 00000000000..2f2fa8cfe7a Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/spherical_concept_hierarchy.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/torus.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/torus.png new file mode 100644 index 00000000000..cc1a1707bcd Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/torus.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/triangle.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/triangle.png index ba848e10c31..607bf96c646 100644 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/triangle.png and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/triangle.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/unb_dcel.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/unb_dcel.png index 11478fea05d..516d3acf107 100644 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/unb_dcel.png and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/unb_dcel.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/voronoi.jpg b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/voronoi.jpg new file mode 100644 index 00000000000..6ee4ab125b6 Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/voronoi.jpg differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/well-oriented-polyline.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/well-oriented-polyline.pdf deleted file mode 100644 index bc9b0c78735..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/well-oriented-polyline.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/well-oriented-polyline.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/well-oriented-polyline.png deleted file mode 100644 index 1c353625023..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig/well-oriented-polyline.png and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/arr_segs.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/arr_segs.pdf deleted file mode 100644 index b33363ba921..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/arr_segs.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/central_concept_cluster.tex b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/central_concept_cluster.tex new file mode 100644 index 00000000000..f496814a17c --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/central_concept_cluster.tex @@ -0,0 +1,16 @@ +\documentclass[12pt]{standalone} +\input{header} +\pagestyle{empty} +\begin{document} + \psset{treevshift=0,unit=1em,xunit=2em,yunit=1em,everytree={}, + etcratio=.75,triratio=.5} + \jtree[everylabel=\sl,xunit=70pt,arrows=->] + \! = {\psframebox{\concept{ArrangementBasicTraits\_2}}} + [scaleby=0 1.6]{\psframebox{\concept{ArrangementXMonotoneTraits\_2}}}@axmt !axmt + . + \!axmt = [scaleby=0 1.6]{\psframebox{\concept{ArrangementTraits\_2}}}@at !at + . + \endjtree + \psset{treevshift=0,unit=1cm,xunit=1cm,yunit=1cm,everytree={}, + etcratio=.75,triratio=.5} +\end{document} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_1.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_1.pdf deleted file mode 100644 index 1088a18bbed..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_1.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_17.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_17.pdf deleted file mode 100644 index 54cd71a9cc3..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_17.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_18.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_18.pdf deleted file mode 100644 index 44bc7ef8e7d..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_18.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_2.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_2.pdf deleted file mode 100644 index b6d24bde094..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_2.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_3a.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_3a.pdf deleted file mode 100644 index f461630c828..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_3a.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_3b.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_3b.pdf deleted file mode 100644 index 200a75a8efa..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_3b.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_3c.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_3c.pdf deleted file mode 100644 index 8522821b8b4..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_3c.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_4.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_4.pdf deleted file mode 100644 index e77a502f4fe..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_4.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_5.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_5.pdf deleted file mode 100644 index 3585e591877..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_5.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_8.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_8.pdf deleted file mode 100644 index b82be04c7bd..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/ex_8.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/header.tex b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/header.tex new file mode 100644 index 00000000000..493f677cfcc --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/header.tex @@ -0,0 +1,652 @@ +% ======== Font =============================================================== +\usepackage[T1]{fontenc} +\usepackage{lmodern} +\usepackage{slantsc} +\usepackage{amssymb} +\usepackage{amsfonts} +\usepackage[english]{babel} +\usepackage[latin1]{inputenc} +\usepackage{pifont} + +% ======== Math =============================================================== +\usepackage{amsmath,amscd,amsthm} +\usepackage{empheq} + +% ======== pdf, url and hyperlink ============================================= +% \usepackage{url} +\usepackage{hyperref} +\usepackage[hyphenbreaks]{breakurl} + +% ======== Tables ============================================================= +\usepackage{multirow} +\usepackage{multicol} +\usepackage{tabularx} + +% ======== Listings =========================================================== +\usepackage{alltt} +\usepackage{listings} +\usepackage{mdwlist} + +% ======== Graphics =========================================================== +\usepackage{graphicx} +\usepackage{etex} +% \usepackage{pst-all} +\usepackage{pstricks,pst-node,pst-tree,pst-text,pst-3d,pst-plot,pst-eucl} +\usepackage{pst-xkey,pst-jtree} +\usepackage{pst-lens} +\usepackage{colordvi} +% The tikz package loads the graphicx package, so no need to load it again. +% Trying to load it with different options will cause the "Option +% clash" error. Use \PassOptionsToPackage{}{graphicx} before +% loading tikz to pass any additional options to the internally loaded +% graphicx. +\usepackage{tikz} +\usepackage{pgfplots} +\usepackage{mathptmx} +\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings,matrix,fit,decorations.pathreplacing,arrows,automata,positioning,shapes,chains,spy} +%\usetikzlibrary{quotes,angles,graph} +\usetikzlibrary{intersections,through,backgrounds} +\usepackage{tikz-3dplot} +\tikzset{% + invisible/.style={opacity=0}, + only/.code args={<#1>#2}{\only<#1>{\pgfkeysalso{#2}}}, + alt/.code args={<#1>#2#3}{\alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}}, + temporal/.code args={<#1>#2#3#4}{% + \temporal<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}{\pgfkeysalso{#4}}}, + point/.style={circle,inner sep=1.5pt,minimum size=1.5pt,draw,fill=#1}, + point/.default=red +} +\makeatletter +\def\nodesDef{\@ifnextchar[{\@nodesDefWith}{\@nodesDefWithout}} +\def\@nodesDefWith[#1]#2{\foreach \c in #2 { \node[point=#1] (n\c) at (\c) {}; }} +\def\@nodesDefWithout#1{\foreach \c in #1 { \node[point] (n\c) at (\c) {}; }} +\makeatother +% #1 --- list of points +% #2 --- list of segments +% #3 --- first point +% #4 --- draw color +% #5 --- fill color +\newcommand{\directedPolygon}[5]{ + \fill[#4] (#3) \foreach \pa/\pb in #2 {-- (\pb)}; + \nodesDef{#1} + \foreach \pa/\pb in #2 { + \draw[thick,#5,->,>=stealth] (n\pa) -- (n\pb); + }; +} +% +% ======== Miscellaneous ====================================================== +\usepackage{fancybox} +\usepackage{calc} +\usepackage{xspace} +% \usepackage{picins} +\usepackage[absolute,overlay]{textpos} +\usepackage{ifthen} +\usepackage{etoolbox} +% + +%\usepackage{pgfpages} +%\pgfpagesuselayout{4 on 1}[letterpaper,border shrink=5mm,landscape] +%\pgfpagesuselayout{4 on 1}[a4paper,landscape] + +% ======== DO NOT MOVE - Reset awkward values changed by pst-jtree ============ +\psset{treevshift=0,unit=1cm,xunit=1cm,yunit=1cm,everytree={}, + etcratio=.75,triratio=.5} +% +% ======== Figures ============================================================ +\DeclareGraphicsExtensions{.png} +\DeclareGraphicsExtensions{.jpg} +% \DeclareGraphicsRule{.png}{eps}{.bb}{`convert -compress JPEG #1 eps2:-} +\DeclareGraphicsRule{.png}{eps}{.bb}{`convert #1 eps2:-} +\DeclareGraphicsRule{.jpg}{eps}{.bb}{`convert #1 eps2:-} +% +% ======== Bibliography ======================================================= +\newcommand{\etalchar}[1]{$^{#1}$} +% +% ======== colors ============================================================= +\definecolor{lightred}{rgb}{1,0.8,0.8} +\definecolor{lightblue}{rgb}{0.8,0.8,1} +\definecolor{mediumred}{rgb}{1,0.5,0.5} +\definecolor{mediumblue}{rgb}{0.5,0.5,1} +\definecolor{darkred}{rgb}{0.5,0,0} +\definecolor{darkblue}{rgb}{0,0,0.5} +\definecolor{darkcyan}{rgb}{0,0.5,0.5} +\definecolor{lightcyan}{rgb}{0.5,1,1} +\definecolor{lightyellow}{rgb}{0.9,0.9,0.7} +\definecolor{olivegreen}{rgb}{.42,.55,.14} +\definecolor{seagreen}{rgb}{.18,.54,.34} + +\newrgbcolor{lessthan}{1 0.2 0.2} +\newrgbcolor{equal}{1 1 0.2} +\newrgbcolor{greaterthan}{0.2 0.2 1} + +\newrgbcolor{pcolor}{0.7 0.3 0.1} +\newrgbcolor{qcolor}{0 0 1} +\newrgbcolor{mscolor}{0.5 0.5 0} +% +\definecolor{polyALightColor}{rgb}{0.75,0.75,1} +\definecolor{polyBLightColor}{rgb}{1,0.8,0.3} +\definecolor{polyCLightColor}{rgb}{1,1,0.25} +\definecolor{polyDLightColor}{rgb}{1,1,0.75} + +\definecolor{polyAColor}{rgb}{0.5,0.7,1} +\definecolor{polyBColor}{rgb}{1,0.72,0.225} +\definecolor{polyCColor}{rgb}{0.8,0.9,0.2} +\definecolor{polyDColor}{rgb}{0.8,0.8,0.6} + +\definecolor{polyADarkColor}{rgb}{0.2,0.4,0.67} +\definecolor{polyBDarkColor}{rgb}{0.67,0.4,0.12} +\definecolor{polyCDarkColor}{rgb}{0.53,0.6,0.13} +\definecolor{polyDDarkColor}{rgb}{0.53,0.53,0.4} + +\definecolor{polyABDarkColor}{rgb}{0.5,0.35,0.4} + +\definecolor{crossColor}{rgb}{1,0,0.5} + +\newrgbcolor{hot_color}{1 0 0} +\newrgbcolor{nonactive_color}{0.7 0.7 0.7} +\newrgbcolor{discovered}{0 0 0} +\newrgbcolor{active_color}{0 0 1} + +\definecolor{obstacle}{rgb}{0.9,0.2,0.1} +\definecolor{robot1}{rgb}{0.1,0.4,0.9} +\definecolor{robot2}{rgb}{0.4,0.1,0.9} +\definecolor{minksum0}{rgb}{0.8,0.9,0.2} + +\newrgbcolor{annulus-color}{0.000 0.690 0.000} +\newrgbcolor{in-color}{0.9 0 0} %% {0.000 0.490 0.000} +\newrgbcolor{out-color}{0 0 0.9} % {0.690 0.000 0.690} +\newrgbcolor{inout-color}{0.000 0.490 0.000} +\newrgbcolor{circles-color}{0.690 0.000 0.69} +% +% ======== Theorems =========================================================== +%% \newtheorem{observation}[theorem]{Observation} +%% \newtheorem{proposition}[theorem]{Proposition} +%% \newtheorem{application}[theorem]{Application} +% +% ======== general macros ===================================================== +\def\gf{\textsc{Geometry Factory}} +\def\inria{\textsc{INRIA}} +\def\mpi{\textsc{MPII}} +\newcommand{\bez}{B{\'e}zier} +\newcommand{\unitsphere}{\ensuremath{{\mathbb S}^2}} +\newcommand{\Rtwo}{\ensuremath{\reals \rule{0.3mm}{0mm}^2}\xspace} % R^2 +\newcommand{\Rthree}{\ensuremath{\reals \rule{0.3mm}{0mm}^3}\xspace} % R^3 +\newcommand{\Rd}{\ensuremath{\reals \rule{0.3mm}{0mm}^d}\xspace} % R^d +\newcommand{\Rx}[1]{\ensuremath{\reals \rule{0.3mm}{0mm} ^ {#1}}\xspace} % R^x +\newcommand{\SOd}[1]{\ensuremath{{\mathbb S} \rule{0.3mm}{0mm} ^ {#1}}} +\newcommand{\SOtwo}{\SOd{2}\xspace} +\newcommand{\R}{\ensuremath{\mathbb{R}}} % +\newcommand{\Z}{\ensuremath{\mathbb{Z}}} % +\newcommand{\Expect}{{\rm I\kern-.3em E}} + +\def\eps{{\epsilon}} +\newcommand{\mindia}[1]{\ensuremath{{\mathcal M}(#1)}} +\newcommand{\distance}[2]{\ensuremath{\rho(#1, #2)}} +\newcommand{\distancesqr}[2]{\ensuremath{\rho^2(#1, #2)}} +\newcommand{\bisector}[2]{\ensuremath{B(#1, #2)}} +\newcommand{\cpp}{{C}{\tt ++}} +\newcommand{\windows}{\textsc{Windows}} +\newcommand{\unix}{\textsc{Unix}} +\newcommand{\linux}{\textsc{Linux}} +\newcommand{\cygwin}{\textsc{Cygwin}} +\newcommand{\stl}{\textsc{Stl}} +\newcommand{\cgal}{\textsc{Cgal}} +\newcommand{\cmake}{\textsc{CMake}} +\newcommand{\gmp}{\textsc{Gmp}} +\newcommand{\gnu}{\textsc{Gnu}} +\newcommand{\mpfr}{\textsc{Mpfr}} +\newcommand{\core}{\textsc{Core}} +\newcommand{\boost}{\textsc{Boost}} +\newcommand{\qt}{\textsc{Qt}} +\newcommand{\leda}{\textsc{Leda}} +\newcommand{\vlsi}{\textsc{Vlsi}} +\newcommand{\dcel}{\textsc{Dcel}} +\newcommand{\ccb}{\textsc{Ccb}} +\newcommand{\parms}{{\rm I\!\hspace{-0.025em} P}} +\newcommand{\reals}{{\rm I\!\hspace{-0.025em} R}} +\newcommand{\redpart}{{\sc \textcolor{red}{$R$}}} +\newcommand{\greenpart}{{\sc \textcolor{green}{$G$}}} +\newcommand{\bluepart}{{\sc \textcolor{blue}{$B$}}} +\newcommand{\purplepart}{{\sc \textcolor{magenta}{$P$}}} +\newcommand{\yellowpart}{{\sc \textcolor{orange}{$Y$}}} +\newcommand{\turquoisepart}{{\sc \textcolor{cyan}{$T$}}} +\newcommand{\kdtree}{\textsc{Kd}-tree} +\newcommand{\kdtrees}{\textsc{Kd}-trees} +\newcommand{\bgl}{\textsc{Bgl}} + +\newcommand{\sgmo}{{\bf SGM}} +\newcommand{\cgmo}{{\bf CGM}} +\newcommand{\ngmo}{{\bf NGM}} +\newcommand{\ch}{{\bf CH}} +\newcommand{\Fuku}{{\bf Fuk}} + +\def\concept#1{\textsf{\it #1}} + +\def\calA{{\cal A}} +\def\calC{{\cal C}} +\def\calG{{\cal G}} +\def\calI{{\cal I}} +\def\calJ{{\cal J}} +\def\calK{{\cal K}} +\def\calL{{\cal L}} +\def\calM{{\cal M}} +\def\calP{{\cal P}} +\def\calS{{\cal S}} +\def\calT{{\cal T}} +\def\calU{{\cal U}} + +% ======== Macros for Voronoi ================================================= +\newcommand{\distsym}{\ensuremath{\rho}\xspace} +\newcommand{\mobius}{M\"o\-bi\-us\xspace} +\newcommand{\region}{\ensuremath{{Reg}}} +\newcommand{\vor}[1]{\ensuremath{Vor_\distsym(#1)}} +\newcommand{\FPFS}{Far\-thest-Point Far\-thest-Site} +% +% ======== Macros for English ================================================= +\newcommand{\ie}{i.\,e.,\xspace} +\newcommand{\eg}{e.\,g.,\xspace} +\newcommand{\etal}{{et~al}.\xspace} +\newcommand{\Wlog}{w.\,l.\,o.\,g.\xspace} +\newcommand{\apriori}{{\it a~priori}} +% +% ======== Listings =========================================================== +\newlength{\ccBaseWidth}\setlength{\ccBaseWidth}{\textwidth/72} +\lstset{% + language=C++,% +% basewidth=\ccBaseWidth, + keywordstyle=\color{blue},commentstyle=\color{red}% +} +\def\myLstinline#1{\lstinline[columns=fixed]{#1}} +% +% ======== html =============================================================== +\newrgbcolor{hrefcolor}{0.2 0.2 0.6} +\def\hrefc#1#2{\href{#1}{\textcolor{hrefcolor}{#2}}} +% +% ======== PS Tricks ========================================================== +\SpecialCoor +% +\def\myxunit{1} +\def\myyunit{1} +\def\arrset#1{\psset{unit=#1cm}\def\myxunit{#1}\def\myyunit{#1}} +\def\vertexradius{2pt} +\def\crossradius{0.15} +% +\def\arrCross(#1,#2){ + \psline[linewidth=0.75pt,linecolor=crossColor] + (!#1 \crossradius\space \myxunit\space div sub #2) + (!#1 \crossradius\space \myxunit\space div add #2) + \psline[linewidth=0.75pt,linecolor=crossColor] + (!#1 #2 \crossradius\space \myyunit\space div sub) + (!#1 #2 \crossradius\space \myyunit\space div add) +} +\def\arrCrossVertex(#1)#2{ + \arrCross(#1) + \pnode(#1){#2} +} +\def\arrEmptyVertex(#1)#2{ + \pscircle*[linecolor=white](#1){\vertexradius} + \cnode[linewidth=0.5pt](#1){\vertexradius}{#2} +} +\def\arrColorVertex(#1)#2#3{ + \pscircle*[linecolor=#3](#1){\vertexradius} + \cnode[linewidth=0.5pt](#1){\vertexradius}{#2} +} +\def\arrRedVertex(#1)#2{\arrColorVertex(#1){#2}{red}} +\def\arrCyanVertex(#1)#2{\arrColorVertex(#1){#2}{cyan}} +\def\arrGreenVertex(#1)#2{\arrColorVertex(#1){#2}{green}} +\def\arrOliveGreenVertex(#1)#2{\arrColorVertex(#1){#2}{olivegreen}} +\def\arrBlueVertex(#1)#2{\arrColorVertex(#1){#2}{blue}} +\def\arrGrayVertex(#1)#2{\arrColorVertex(#1){#2}{gray}} +\def\arrPurpleVertex(#1)#2{\arrColorVertex(#1){#2}{purple}} + +\def\arrMainVertex(#1)#2{\arrRedVertex(#1){#2}} +\def\arrMinorVertex(#1)#2{\arrCyanVertex(#1){#2}} + +\def\arrlvertex[#1](#2)#3#4{ + \arrMainVertex(#2){#3} + \uput[#1]{0}(#2){#4} +} +\def\arrLabeledColorVertex[#1](#2)#3#4#5{ + \arrColorVertex(#2){#3}{#4} + \uput[#1]{0}(#2){#5} +} +\def\arrp[#1](#2)#3{\arrlvertex[#1](#2){#3}{$p_{#3}$}} +\def\arrv[#1](#2)#3{\arrlvertex[#1](#2){#3}{$v_{#3}$}} +\def\arru[#1](#2)#3{\arrlvertex[#1](#2){#3}{$u_{#3}$}} +\def\nsarraxes(#1)(#2)(#3){\psaxes*[linecolor=black,linewidth=0.25pt,labels=none]{->}(#1)(#2)(#3)} +\def\arraxes(#1)(#2)(#3){\hspace{-3pt}\nsarraxes(#1)(#2)(#3)} +\def\arrIntersect{ + /arrDict 10 dict def + arrDict begin + /arrIntersect { + /arrIntersectDict 14 dict def + arrIntersectDict begin + /x1 exch def + /y1 exch def + /x2 exch def + /y2 exch def + /x3 exch def + /y3 exch def + /x4 exch def + /y4 exch def + /dx43 x4 x3 sub def + /dy43 y4 y3 sub def + /dx13 x1 x3 sub def + /dy13 y1 y3 sub def + /dx21 x2 x1 sub def + /dy21 y2 y1 sub def + dx43 dy13 mul dy43 dx13 mul sub + dy43 dx21 mul dx43 dy21 mul sub + div dup dx21 mul x1 add exch dy21 mul y1 add + end + } bind def + end +} +\def\arrColorIntersectionVertex(#1,#2)(#3,#4)(#5,#6)(#7,#8){ + \def\ArgI{{#1}}% + \def\ArgII{{#2}}% + \def\ArgIII{{#3}}% + \def\ArgIV{{#4}}% + \def\ArgV{{#5}}% + \def\ArgVI{{#6}}% + \def\ArgVII{{#7}}% + \def\ArgVIII{{#8}}% + \arrColorIntersectionVertexRelay +} +\def\arrColorIntersectionVertexRelay#1#2{ + \arrColorVertex(!\arrIntersect\space + arrDict begin \ArgVIII \ArgVII \ArgVI \ArgV \ArgIV \ArgIII \ArgII \ArgI arrIntersect end + ){#1}{#2} +} +\def\arrEmptyIntersectionVertex(#1,#2)(#3,#4)(#5,#6)(#7,#8)#9{ + \arrEmptyVertex(!\arrIntersect\space + arrDict begin #8 #7 #6 #5 #4 #3 #2 #1 arrIntersect end + ){#9} +} +\def\arrMainIntersectionVertex(#1,#2)(#3,#4)(#5,#6)(#7,#8)#9{ + \arrMainVertex(!\arrIntersect\space + arrDict begin #8 #7 #6 #5 #4 #3 #2 #1 arrIntersect end + ){#9} +} +\def\arrCrossIntersectionVertex(#1,#2)(#3,#4)(#5,#6)(#7,#8)#9{ + \psline[linewidth=0.75pt,linecolor=crossColor](!\arrIntersect\space + arrDict begin #8 #7 #6 #5 #4 #3 #2 #1 arrIntersect end + \crossradius\space \myyunit\space div sub + )(!\arrIntersect\space + arrDict begin #8 #7 #6 #5 #4 #3 #2 #1 arrIntersect end + \crossradius\space \myyunit\space div add + ) + \psline[linewidth=0.75pt,linecolor=crossColor](!\arrIntersect\space + arrDict begin #8 #7 #6 #5 #4 #3 #2 #1 arrIntersect end + exch \crossradius\space \myxunit\space div sub exch + )(!\arrIntersect\space + arrDict begin #8 #7 #6 #5 #4 #3 #2 #1 arrIntersect end + exch \crossradius\space \myxunit\space div add exch + ) + \pnode(!\arrIntersect\space + arrDict begin #8 #7 #6 #5 #4 #3 #2 #1 arrIntersect end + ){#2} +} +\def\arrTriangle(#1,#2)(#3,#4)(#5,#6)(#7,#8){ + \def\ArgI{{#1}}% + \def\ArgII{{#2}}% + \def\ArgIII{{#3}}% + \def\ArgIV{{#4}}% + \def\ArgV{{#5}}% + \def\ArgVI{{#6}}% + \def\ArgVII{{#7}}% + \def\ArgVIII{{#8}}% + \arrTriangleRelayA +} +\def\arrTriangleRelayA(#1,#2)(#3,#4)#5{ + \def\ArgIX{{#1}}% + \def\ArgX{{#2}}% + \def\ArgXI{{#3}}% + \def\ArgXII{{#4}}% + \pspolygon*[linecolor=#5] + (!\arrIntersect\space + arrDict begin + \ArgVIII \ArgVII \ArgVI \ArgV \ArgIV \ArgIII \ArgII \ArgI arrIntersect + end + ) + (!\arrIntersect\space + arrDict begin + \ArgXII \ArgXI \ArgX \ArgIX \ArgVIII \ArgVII \ArgVI \ArgV arrIntersect + end + ) + (!\arrIntersect\space + arrDict begin + \ArgIV \ArgIII \ArgII \ArgI \ArgXII \ArgXI \ArgX \ArgIX arrIntersect + end + ) +} +\def\arrPolygon(#1,#2)(#3,#4)(#5,#6)(#7,#8){ + \def\ArgI{{#1}}% + \def\ArgII{{#2}}% + \def\ArgIII{{#3}}% + \def\ArgIV{{#4}}% + \def\ArgV{{#5}}% + \def\ArgVI{{#6}}% + \def\ArgVII{{#7}}% + \def\ArgVIII{{#8}}% + \arrpolygonRelayA +} +\def\arrpolygonRelayA(#1,#2)(#3,#4)(#5,#6)(#7,#8){ + \def\ArgIX{{#1}}% + \def\ArgX{{#2}}% + \def\ArgXI{{#3}}% + \def\ArgXII{{#4}}% + \def\ArgXIII{{#5}}% + \def\ArgXIV{{#6}}% + \def\ArgXV{{#7}}% + \def\ArgXVI{{#8}}% + \arrpolygonRelayB +} +\def\arrpolygonRelayB#1{ + \pspolygon*[linecolor=#1] + (!\arrIntersect\space + arrDict begin + \ArgVIII \ArgVII \ArgVI \ArgV \ArgIV \ArgIII \ArgII \ArgI arrIntersect + end + ) + (!\arrIntersect\space + arrDict begin + \ArgXII \ArgXI \ArgX \ArgIX \ArgVIII \ArgVII \ArgVI \ArgV arrIntersect + end + ) + (!\arrIntersect\space + arrDict begin + \ArgXVI \ArgXV \ArgXIV \ArgXIII \ArgXII \ArgXI \ArgX \ArgIX arrIntersect + end + ) + (!\arrIntersect\space + arrDict begin + \ArgIV \ArgIII \ArgII \ArgI \ArgXVI \ArgXV \ArgXIV \ArgXIII arrIntersect + end + ) +} +\def\arrPentagon(#1,#2)(#3,#4)(#5,#6)(#7,#8){ + \def\ArgI{{#1}}% + \def\ArgII{{#2}}% + \def\ArgIII{{#3}}% + \def\ArgIV{{#4}}% + \def\ArgV{{#5}}% + \def\ArgVI{{#6}}% + \def\ArgVII{{#7}}% + \def\ArgVIII{{#8}}% + \arrPentagonRelayA +} +\def\arrPentagonRelayA(#1,#2)(#3,#4)(#5,#6)(#7,#8){ + \def\ArgIX{{#1}}% + \def\ArgX{{#2}}% + \def\ArgXI{{#3}}% + \def\ArgXII{{#4}}% + \def\ArgXIII{{#5}}% + \def\ArgXIV{{#6}}% + \def\ArgXV{{#7}}% + \def\ArgXVI{{#8}}% + \arrPentagonRelayB +} +\def\arrPentagonRelayB(#1,#2)(#3,#4)#5{ + \def\ArgXVII{{#1}}% + \def\ArgXVIII{{#2}}% + \def\ArgXIX{{#3}}% + \def\ArgXX{{#4}}% + \pspolygon*[linecolor=#5] + (!\arrIntersect\space + arrDict begin + \ArgVIII \ArgVII \ArgVI \ArgV \ArgIV \ArgIII \ArgII \ArgI arrIntersect + end + ) + (!\arrIntersect\space + arrDict begin + \ArgXII \ArgXI \ArgX \ArgIX \ArgVIII \ArgVII \ArgVI \ArgV arrIntersect + end + ) + (!\arrIntersect\space + arrDict begin + \ArgXVI \ArgXV \ArgXIV \ArgXIII \ArgXII \ArgXI \ArgX \ArgIX arrIntersect + end + ) + (!\arrIntersect\space + arrDict begin + \ArgXX \ArgXIX \ArgXVIII \ArgXVII \ArgXVI \ArgXV \ArgXIV \ArgXIII arrIntersect + end + ) + (!\arrIntersect\space + arrDict begin + \ArgIV \ArgIII \ArgII \ArgI \ArgXX \ArgXIX \ArgXVIII \ArgXVII arrIntersect + end + ) +} +\def\arredge#1#2{ + \ncline[linewidth=0.5pt,linecolor=blue]{#1}{#2} + \ncline[linewidth=0.25pt,offset=3pt]{->}{#1}{#2} + \ncline[linewidth=0.25pt,offset=3pt]{->}{#2}{#1} +} +% +\def\smallfilledsquare{\pspolygon*[linecolor=white](0,0)(0.1,0)(0.1,0.1)(0,0.1)} +\def\smallsquare{\pspolygon(0,0)(0.1,0)(0.1,0.1)(0,0.1)} +% +% ======== macros for package names =========================================== +\newcommand{\cgalPackage}[1]{{\emph{#1}}} +\newcommand{\iiDArrangementsPackage}{\cgalPackage{2D Arrangements}} +\newcommand{\iiDIntersectionofCurvesPackage}{\cgalPackage{2D Intersection of Curves}} +\newcommand{\iiDSnapRoundingPackage}{\cgalPackage{2D Snap Rounding}} +\newcommand{\EnvelopesofCurvesiniiDPackage}{\cgalPackage{Envelopes of Curves in 2D}} +\newcommand{\EnvelopesofSurfacesiniiiDPackage}{\cgalPackage{Envelopes of Surfaces in 3D}} +\newcommand{\iiDMinkowskiSumsPackage}{\cgalPackage{2D Minkowski Sums}} +\newcommand{\iiDRegularizedBooleanSetOperationsPackage}{\cgalPackage{2D Regularized Boolean Set-Operations}} +\newcommand{\iiDPolygonsPackage}{\cgalPackage{2D Polygons}} +\newcommand{\iiDBooleanOperationsonNefPolygonsPackage}{\cgalPackage{2D Boolean Operations on Nef Polygons}} +\newcommand{\iiDBooleanOperationsonNefPolygonsEmbeddedontheSpherePackage}{\cgalPackage{2D Boolean Operations on Nef Polygons Embedded on the Sphere}} +\newcommand{\iiiDBooleanOperationsonNefPolyhedraPackage}{\cgalPackage{3D Boolean Operations on Nef Polyhedra}} +% +% ============================================================================= +% +\newenvironment{FramedVerb}% + {\VerbatimEnvironment + \begin{Sbox}\begin{minipage}{\textwidth}\begin{Verbatim}}% + {\end{Verbatim}\end{minipage}\end{Sbox} + \setlength{\fboxsep}{8pt}\fbox{\TheSbox}} + +\newenvironment{fminipage}% + {\begin{Sbox}\begin{minipage}}% + {\end{minipage}\end{Sbox}\fbox{\TheSbox}} + +\newrgbcolor{c1}{0.1 0.1 0.5} +\newrgbcolor{c2}{0.2 0.0 0.5} +\newrgbcolor{c3}{0.0 0.2 0.5} +\newrgbcolor{xpcolor}{1 0.5 0} % intersection point color +\newrgbcolor{epcolor}{0 0 0.8} % endpoint color +\newrgbcolor{fpcolor}{0 0.8 0} % ficticious point color +\newrgbcolor{fccolor}{0 0.5 0} % ficticious curve color + +\newenvironment{packed-enum}{ +\begin{enumerate} + %\setlength{\topsep}{0pt} + %\setlength{\partopsep}{0pt} + \setlength{\itemsep}{0pt} + %\setlength{\parsep}{0pt} + \setlength{\rightmargin}{0pt} + %\setlength{\listparindent}{0pt} + %\setlength{\itemindent}{0pt} + %\setlength{\labelsep}{0pt} + %\setlength{\labelwidth}{0pt} + %%\makelabel{label} + \setlength{\leftmargin}{\labelwidth+\labelsep} +}{\end{enumerate}} +% +% ======= acolumns ============================================================ +\usepackage{environ}% Required for \NewEnviron, i.e. to read the whole body of the environment +\makeatletter +\newcounter{acolumn}% Number of current column +\newlength{\acolumnmaxheight}% Maximum column height + +% `column` replacement to measure height +\newenvironment{@acolumn}[1]{% + \stepcounter{acolumn}% + \begin{lrbox}{\@tempboxa}% + \begin{minipage}{#1}% +}{% + \end{minipage} + \end{lrbox} + \@tempdimc=\dimexpr\ht\@tempboxa+\dp\@tempboxa\relax + % Save height of this column: + \expandafter\xdef\csname acolumn@height@\roman{acolumn}\endcsname{\the\@tempdimc}% + % Save maximum height + \ifdim\@tempdimc>\acolumnmaxheight + \global\acolumnmaxheight=\@tempdimc + \fi +} + +% `column` wrapper which sets the height beforehand +\newenvironment{@@acolumn}[1]{% + \stepcounter{acolumn}% + % The \autoheight macro contains a \vspace macro with the maximum height minus the natural column height + \edef\autoheight{\noexpand\vspace*{\dimexpr\acolumnmaxheight-\csname acolumn@height@\roman{acolumn}\endcsname\relax}}% + % Call original `column`: + \orig@column{#1}% +}{% + \endorig@column +} + +% Save orignal `column` environment away +\let\orig@column\column +\let\endorig@column\endcolumn + +% `columns` variant with automatic height adjustment +\NewEnviron{acolumns}[1][]{% + % Init vars: + \setcounter{acolumn}{0}% + \setlength{\acolumnmaxheight}{0pt}% + \def\autoheight{\vspace*{0pt}}% + % Set `column` environment to special measuring environment + \let\column\@acolumn + \let\endcolumn\end@acolumn + \BODY% measure heights + % Reset counter for second processing round + \setcounter{acolumn}{0}% + % Set `column` environment to wrapper + \let\column\@@acolumn + \let\endcolumn\end@@acolumn + % Finally process columns now for real + \begin{columns}[#1]% + \BODY + \end{columns}% +} +\makeatother +% +% ======== Tikz museful macros================================================== +% Usage \arcThroughThoPoints[options]{center}{p}{q}; +\newcommand{\arcThroughThoPoints}[4][]{ +\coordinate (center) at (#2); +\draw[#1] + let \p1=($(#3)-(center)$), + \p2=($(#4)-(center)$), + \n0={veclen(\p1)}, % Radius + \n1={atan2(\x1,\y1)}, % angles + \n2={atan2(\x2,\y2)}, + \n3={\n2>\n1?\n2:\n2+360} + in (#3) arc(\n1:\n3:\n0); +} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/insert_at_vertices.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/insert_at_vertices.pdf deleted file mode 100644 index 9f670c6b7cb..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/insert_at_vertices.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/insert_from_vertex.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/insert_from_vertex.pdf deleted file mode 100644 index 0334e50e65e..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/insert_from_vertex.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/insert_in_face.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/insert_in_face.pdf deleted file mode 100644 index 83da1deea05..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/insert_in_face.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/landmark_concept_cluster.tex b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/landmark_concept_cluster.tex new file mode 100644 index 00000000000..38f649a5ee4 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/landmark_concept_cluster.tex @@ -0,0 +1,18 @@ +\documentclass[12pt]{standalone} +\input{header} +\pagestyle{empty} +\begin{document} + \psset{treevshift=0,unit=1em,xunit=2em,yunit=1em,everytree={}, + etcratio=.75,triratio=.5} + \jtree[everylabel=\sl,xunit=70pt,arrows=->] + \! = {\psframebox{\concept{ArrangementBasicTraits\_2}}} + [scaleby=1.2 1.6]{\psframebox{\concept{ArrangementApproximateTraits\_2}}}@aat !aat + ^[scaleby=1.8 1.6]{\psframebox{\concept{ArrangementConstructXMonotoneCurveTraits\_2}}}@acxmct !acxmct + . + \!aat = [scaleby=1.2 1.6]{\psframebox{\concept{ArrangementLandmarkTraits\_2}}}@alt !alt + . + \ncline{acxmct:b}{alt:t} + \endjtree + \psset{treevshift=0,unit=1cm,xunit=1cm,yunit=1cm,everytree={}, + etcratio=.75,triratio=.5} +\end{document} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/left_side_cluster.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/left_side_cluster.png new file mode 100644 index 00000000000..6908e84c4e9 Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/left_side_cluster.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/left_side_cluster.tex b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/left_side_cluster.tex new file mode 100644 index 00000000000..be2d14272cf --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/left_side_cluster.tex @@ -0,0 +1,16 @@ +\documentclass[12pt]{standalone} +\input{header} +\pagestyle{empty} +\begin{document} + \psset{treevshift=0,unit=1em,xunit=2em,yunit=1em,everytree={},etcratio=.75,triratio=.5} + \jtree[everylabel=\sl,xunit=70pt,arrows=->] + \! = {\psframebox{\concept{ArrangementLeftSideTraits\_2}}} + <4wideleft>[scaleby=2.44 1]{\psframebox{\concept{ArrangementOpenLeftTraits\_2}}}@ult !ult + ^[scaleby=1.37 1]{\psframebox{\concept{ArrangemenClosedLeftTraits\_2}}}@urt !urt + ^[scaleby=1.11 1]{\psframebox{\concept{ArrangemenContractedLeftTraits\_2}}}@ubt !ubt + ^<4wideright>[scaleby=2.44 1]{\psframebox{\concept{ArrangemenIdentifiedLeftTraits\_2}}}@utt !utt + . + \endjtree + \psset{treevshift=0,unit=1cm,xunit=1cm,yunit=1cm,everytree={}, + etcratio=.75,triratio=.5} +\end{document} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/makefile b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/makefile new file mode 100644 index 00000000000..6af2c6edfae --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/makefile @@ -0,0 +1,26 @@ +# latex ws.tex +# dvips -E ws.dvi -o +# epstool --bbox --copy ws.ps ws.eps +# ps2pdf -dEPSCrop ws.eps ws.pdf + +TARGETS = simple_arr.pdf + +.DEFAULT_GOAL = all +.PHONY: all clean + +all: $(TARGETS) + +%.dvi: %.tex + latex $< + +%.ps: %.dvi + dvips -E $< -o + +%.eps: %.ps + epstool --bbox --copy $< $@ + +%.pdf: %.eps + ps2pdf -dEPSCrop $< $@ + +clean: + rm -f $(DOCUMENTS) diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/open_concept_hierarchy.tex b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/open_concept_hierarchy.tex new file mode 100644 index 00000000000..c44d6ebe93e --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/open_concept_hierarchy.tex @@ -0,0 +1,21 @@ +\documentclass[12pt]{standalone} +\input{header} +\pagestyle{empty} +\begin{document} + \psset{treevshift=0,unit=1em,xunit=2em,yunit=1em,everytree={},etcratio=.75,triratio=.5} + \jtree[everylabel=\sl,xunit=70pt,arrows=->] + \! = {} + <4wideleft>[scaleby=2.35 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangementOpenLeftTraits\_2}}}@ult !ult + ^[scaleby=1.21 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangemenOpenRightTraits\_2}}}@urt !urt + ^[scaleby=1.18 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangemenOpenBottomTraits\_2}}}@ubt !ubt + ^<4wideright>[scaleby=2.35 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangemenOpenTopTraits\_2}}}@utt !utt + . + \!ult = <4wideright>[scaleby=2.10 1]{\psframebox{\concept{ArrangementOpenBoundaryTraits\_2}}}@ut !ut + . + \ncline{urt:b}{ut:t} + \ncline{ubt:b}{ut:t} + \ncline{utt:b}{ut:t} + \endjtree + \psset{treevshift=0,unit=1cm,xunit=1cm,yunit=1cm,everytree={}, + etcratio=.75,triratio=.5} +\end{document} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/pred_around_vertex.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/pred_around_vertex.pdf deleted file mode 100644 index 1a933d12d20..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/pred_around_vertex.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/side_clusters.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/side_clusters.png new file mode 100644 index 00000000000..d82390981b5 Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/side_clusters.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/side_clusters.tex b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/side_clusters.tex new file mode 100644 index 00000000000..141b2c2ed33 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/side_clusters.tex @@ -0,0 +1,20 @@ +\documentclass[12pt]{standalone} +\input{header} +\pagestyle{empty} +\begin{document} + \psset{treevshift=0,unit=1em,xunit=2em,yunit=1em,everytree={},etcratio=.75,triratio=.5} + \jtree[everylabel=\sl,xunit=70pt,arrows=->] + \! = {} + [scaleby=2.31 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangementVerticalSideTraits\_2}}}@vst !vst + ^[scaleby=2.31 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangemenHorizontalSideTraits\_2}}}@hst !hst + . + \!hst = [scaleby=1.15 1]{\psframebox{\concept{ArrangementBottomSideTraits\_2}}}@bst !bst + ^[scaleby=1.15 1]{\psframebox{\concept{ArrangementTopSideTraits\_2}}}@tst !tst + . + \!vst = [scaleby=1.12 1]{\psframebox{\concept{ArrangementLeftSideTraits\_2}}}@lst !lst + ^[scaleby=1.12 1]{\psframebox{\concept{ArrangementRightSideTraits\_2}}}@rst !rst + . + \endjtree + \psset{treevshift=0,unit=1cm,xunit=1cm,yunit=1cm,everytree={}, + etcratio=.75,triratio=.5} +\end{document} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/simple_arr.tex b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/simple_arr.tex new file mode 100644 index 00000000000..21103ecd3f6 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/simple_arr.tex @@ -0,0 +1,33 @@ +\documentclass[11pt]{article} +\input{header} +\pagestyle{empty} +\begin{document} +\arrset{1}% +\pspicture[](-3.1,-0.725)(3.1,1.709) +% +\pscustom[linecolor=blue,linewidth=0pt,fillstyle=hlines,hatchcolor=orange,hatchsep=2pt,hatchwidth=1pt]{% + \psplot{-2}{0}{0 x x mul x mul add x x mul add x 4 mul sub 1 add 8 div} + \psplot{0}{-2}{0 x x mul x mul sub x x mul add x 4 mul add 1 add 8 div} +} +% +\pscustom[linecolor=blue,linewidth=0pt,fillstyle=vlines,hatchcolor=orange,hatchsep=2pt,hatchwidth=1pt]{ + \psplot{0}{2}{0 x x mul x mul add x x mul add x 4 mul sub 1 add 8 div} + \psplot{2}{0}{0 x x mul x mul sub x x mul add x 4 mul add 1 add 8 div} +} +% +\psplot[linecolor=blue]{-2.5}{3}{0 x x mul x mul sub x x mul add x 4 mul add 1 add 8 div} +\psplot[linecolor=blue]{-3}{2.5}{0 x x mul x mul add x x mul add x 4 mul sub 1 add 8 div} +% +\arrMainVertex(-3,-0.625){1} +\arrMainVertex( 3,-0.625){2} +\arrMainVertex(-2.5,1.609){3} +\arrMainVertex( 2.5,1.609){4} +\arrEmptyVertex(-2,0.625){x1} +\arrEmptyVertex( 2,0.625){x2} +\arrEmptyVertex(0,0.125){x3} +\rput(-2.5,1){\textcolor{blue}{$C_1$}} +\rput(-2.9,0.15){\textcolor{blue}{$C_2$}} +\rput(-1,0.3){\boldmath{$f_1$}} +\rput(1,0.3){\boldmath{$f_2$}} +\endpspicture +\end{document} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/spherical_concept_hierarchy.png b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/spherical_concept_hierarchy.png new file mode 100644 index 00000000000..5ceae1dc6f1 Binary files /dev/null and b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/spherical_concept_hierarchy.png differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/spherical_concept_hierarchy.tex b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/spherical_concept_hierarchy.tex new file mode 100644 index 00000000000..295fdab7577 --- /dev/null +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/spherical_concept_hierarchy.tex @@ -0,0 +1,21 @@ +\documentclass[12pt]{standalone} +\input{header} +\pagestyle{empty} +\begin{document} + \psset{treevshift=0,unit=1em,xunit=2em,yunit=1em,everytree={},etcratio=.75,triratio=.5} + \jtree[everylabel=\sl,xunit=70pt,arrows=->] + \! = {} + <4wideleft>[scaleby=2.73 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangementIdentifiedLeftTraits\_2}}}@ult !ult + ^[scaleby=1.47 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangementIdentifiedRightTraits\_2}}}@urt !urt + ^[scaleby=1.31 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangementContractedBottomTraits\_2}}}@ubt !ubt + ^<4wideright>[scaleby=2.73 0,arrows=-,linestyle=none]{\psframebox{\concept{ArrangementContractedTopTraits\_2}}}@utt !utt + . + \!ult = <4wideright>[scaleby=2.4 1]{\psframebox{\concept{ArrangementSphericalBoundaryTraits\_2}}}@ut !ut + . + \ncline{urt:b}{ut:t} + \ncline{ubt:b}{ut:t} + \ncline{utt:b}{ut:t} + \endjtree + \psset{treevshift=0,unit=1cm,xunit=1cm,yunit=1cm,everytree={}, + etcratio=.75,triratio=.5} +\end{document} diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/triangle.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/triangle.pdf deleted file mode 100644 index c2ec9afe41a..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/triangle.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/unb_dcel.pdf b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/unb_dcel.pdf deleted file mode 100644 index bfc3d1d6c30..00000000000 Binary files a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/fig_src/unb_dcel.pdf and /dev/null differ diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/CMakeLists.txt b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/CMakeLists.txt index ff47bd7b67b..f6109e0c258 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/CMakeLists.txt +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/CMakeLists.txt @@ -22,9 +22,11 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "${cppfile}" ) endforeach() + if (CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-std=c++11) + endif() else() - - message(STATUS "This program requires the CGAL library, and will not be compiled.") - -endif() + message(STATUS "This program requires the CGAL library, and will not be compiled.") + +endif() diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_geodesic.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_geodesic.cpp index 6d5bfd64715..d5f9d63a49c 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_geodesic.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_geodesic.cpp @@ -1,8 +1,6 @@ //! \file examples/Arrangement_on_surface_2/polycurve_geodesic.cpp // Constructing an arrangement of polygeodesics. -#define CGAL_IDENTIFICATION_XY 2 - #include #include @@ -33,18 +31,23 @@ typedef CGAL::Arrangement_on_surface_2 int main() { - Point_2 p1(0, 1, -1); - Point_2 p2(-11, 7, -7); - Point_2 p3(-1, 0, 0); - Point_2 p4(-11, 7, 7); - Point_2 p5(-1, 1, 1); - Segment_traits_2 seg_traits; + Segment_traits_2::Construct_point_2 ctr_p = + seg_traits.construct_point_2_object(); + Segment_traits_2::Construct_x_monotone_curve_2 ctr_seg = + seg_traits.construct_x_monotone_curve_2_object(); + + Point_2 p1 = ctr_p(0, 1, -1); + Point_2 p2 = ctr_p(-11, 7, -7); + Point_2 p3 = ctr_p(-1, 0, 0); + Point_2 p4 = ctr_p(-11, 7, 7); + Point_2 p5 = ctr_p(-1, 1, 1); + Segment_arr seg_arr(&seg_traits); - X_seg_curve_2 seg_cv1(p1, p2); - X_seg_curve_2 seg_cv2(p2, p3); - X_seg_curve_2 seg_cv3(p3, p4); - X_seg_curve_2 seg_cv4(p4, p5); + X_seg_curve_2 seg_cv1 = ctr_seg(p1, p2); + X_seg_curve_2 seg_cv2 = ctr_seg(p2, p3); + X_seg_curve_2 seg_cv3 = ctr_seg(p3, p4); + X_seg_curve_2 seg_cv4 = ctr_seg(p4, p5); insert(seg_arr, seg_cv1); insert(seg_arr, seg_cv2); diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/sgm_point_location.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/sgm_point_location.cpp new file mode 100644 index 00000000000..819fdb4d433 --- /dev/null +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/sgm_point_location.cpp @@ -0,0 +1,119 @@ +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "point_location_utils.h" + +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; +typedef Kernel::Point_3 Point_3; +typedef Kernel::Direction_3 Direction_3; + +#if 0 +typedef CGAL::Arr_polyhedral_sgm_traits Gm_traits; +#elif 0 +typedef CGAL::Arr_polyhedral_sgm_traits Gm_traits; +#else +typedef CGAL::Arr_polyhedral_sgm_traits Gm_traits; +#endif + +typedef CGAL::Arr_polyhedral_sgm Gm; +typedef CGAL::Arr_polyhedral_sgm_polyhedron_3 Gm_polyhedron; +typedef CGAL::Arr_polyhedral_sgm_initializer Gm_initializer; + +typedef CGAL::Arr_naive_point_location Naive_pl; +typedef CGAL::Arr_walk_along_line_point_location Walk_pl; +typedef CGAL::Arr_landmarks_point_location Landmarks_pl; +typedef CGAL::Arr_trapezoid_ric_point_location Trap_pl; + +typedef Gm::Geometry_traits_2 Geom_traits; +typedef Geom_traits::Point_2 Point_2; + +typedef CGAL::Arr_point_location_result Point_location_result; +typedef std::pair Query_result; + +typedef Gm::Vertex_const_handle Vertex_const_handle; +typedef Gm::Halfedge_const_handle Halfedge_const_handle; +typedef Gm::Face_const_handle Face_const_handle; + +int main() +{ + Gm_polyhedron p; + p.make_tetrahedron(Point_3(1.0, 0.0, 0.0), Point_3(0.0, 1.0, 0.0), + Point_3(0.0, 0.0, 1.0), Point_3(0.0, 0.0, 0.0)); + Gm gm; + + Naive_pl naive_pl(gm); + // Landmarks_pl landmarks_pl(gm); + Walk_pl walk_pl(gm); + // Trap_pl trap_pl(gm); + /* Need to add the code below to both Arr_spherical_gaussian_map_3 and + * Arr_polyhedral_sgm, and then work on the trap point location code... + +private: + friend class Arr_observer; + friend class Arr_accessor; + +protected: + typedef Arr_observer Observer; + + void _register_observer(Observer *p_obs) + { Base::_register_observer((typename Base::Observer*)p_obs); } + + bool _unregister_observer(Observer *p_obs) + { return (Base::_unregister_observer ((typename Base::Observer*)p_obs)); } + */ + + Gm_traits traits; + Gm_initializer gm_initializer(gm); + gm_initializer(p); + if (! gm.is_valid()) return -1; + + Geom_traits::Construct_point_2 ctr_point = traits.construct_point_2_object(); + Point_2 points[] = { + ctr_point(-1, 0, 0), + ctr_point(0, -1, 0), + ctr_point(0, 0, -1) + }; + + point_location_query(naive_pl, points[0]); + point_location_query(naive_pl, points[1]); + point_location_query(naive_pl, points[2]); + + // point_location_query(trap_pl, points[0]); + + //////// + std::list results; + // The following cause an assertion failure. + // CGAL::locate(gm, &points[0], &points[3], std::back_inserter(results)); + + // Print the results. + std::list::const_iterator it; + for (it = results.begin(); it != results.end(); ++it) { + std::cout << "The point (" << it->first << ") is located "; + if (const Face_const_handle* f = + boost::get(&(it->second))) // inside a face + std::cout << "inside " + << (((*f)->is_unbounded()) ? "the unbounded" : "a bounded") + << " face." << std::endl; + else if (const Halfedge_const_handle* e = + boost::get(&(it->second))) // on an edge + std::cout << "on an edge: " << (*e)->curve() << std::endl; + else if (const Vertex_const_handle* v = + boost::get(&(it->second))) // on a vertex + std::cout << "on " + << (((*v)->is_isolated()) ? "an isolated" : "a") + << " vertex: " << (*v)->point() << std::endl; + } + + return 0; +} diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_insert1.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_insert1.cpp new file mode 100644 index 00000000000..94beca826d3 --- /dev/null +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_insert1.cpp @@ -0,0 +1,76 @@ +//! \file examples/Arrangement_on_surface_2/aggregated_insertion.cpp +// Using the global aggregated insertion functions. + +#include + +#include +#include +#include +#include +#include +#include + +typedef CGAL::Exact_rational Number_type; +typedef CGAL::Cartesian Kernel; +typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 Geom_traits_2; +typedef Geom_traits_2::Point_2 Point_2; +typedef Geom_traits_2::X_monotone_curve_2 X_monotone_curve_2; +typedef CGAL::Arr_spherical_topology_traits_2 Topol_traits_2; +typedef CGAL::Arrangement_on_surface_2 + Arrangement_2; +typedef Arrangement_2::Vertex_handle Vertex_handle; + +int main() +{ + Geom_traits_2 traits; + Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object(); + Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv = + traits.construct_x_monotone_curve_2_object(); + + Arrangement_2 arr(&traits); + Point_2 sp = ctr_p(0, 0, -1); + Point_2 np = ctr_p(0, 0, 1); + Vertex_handle spv = arr.insert_in_face_interior(sp, arr.reference_face()); + Vertex_handle npv = arr.insert_in_face_interior(np, arr.reference_face()); + +#if 1 + Point_2 p1 = ctr_p(-1, 0, 0); +#else + Point_2 p1 = ctr_p(-1, -1, 0); +#endif + Point_2 p2 = ctr_p( 0, -1, 0); + Point_2 p3 = ctr_p( 1, 0, 0); + + Vertex_handle v1 = arr.insert_in_face_interior(p1, arr.reference_face()); + Vertex_handle v2 = arr.insert_in_face_interior(p2, arr.reference_face()); + Vertex_handle v3 = arr.insert_in_face_interior(p3, arr.reference_face()); + + X_monotone_curve_2 xcv_sp1 = ctr_xcv(sp, p1); + X_monotone_curve_2 xcv_sp2 = ctr_xcv(sp, p2); + X_monotone_curve_2 xcv_sp3 = ctr_xcv(sp, p3); + arr.insert_at_vertices(xcv_sp1, spv, v1); + arr.insert_at_vertices(xcv_sp2, spv, v2); + arr.insert_at_vertices(xcv_sp3, spv, v3); + + X_monotone_curve_2 xcv_np1 = ctr_xcv(np, p1); + X_monotone_curve_2 xcv_np2 = ctr_xcv(np, p2); + X_monotone_curve_2 xcv_np3 = ctr_xcv(np, p3); + arr.insert_at_vertices(xcv_np1, npv, v1); + arr.insert_at_vertices(xcv_np2, npv, v2); + arr.insert_at_vertices(xcv_np3, npv, v3); + + X_monotone_curve_2 xcv_12 = ctr_xcv(p1, p2); + X_monotone_curve_2 xcv_23 = ctr_xcv(p2, p3); + arr.insert_at_vertices(xcv_12, v1, v2); + arr.insert_at_vertices(xcv_23, v2, v3); + + // Print the size of the arrangement. + std::cout << "The arrangement size:" << std::endl + << " V = " << arr.number_of_vertices() + << ", E = " << arr.number_of_edges() + << ", F = " << arr.number_of_faces() << std::endl; + + // std::cout << "arr: " << arr << std::endl; + + return 0; +} diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_insert2.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_insert2.cpp new file mode 100644 index 00000000000..214b93d02c1 --- /dev/null +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_insert2.cpp @@ -0,0 +1,66 @@ +//! \file examples/Arrangement_on_surface_2/aggregated_insertion.cpp +// Using the global aggregated insertion functions. + +// #define CGAL_IDENTIFICATION_XY CGAL_X_MINUS_11_Y_7 +// #define CGAL_ARRANGEMENT_ON_SURFACE_INSERT_VERBOSE 1 + +#include + +#include +#include +#include +#include +#include +#include + +typedef CGAL::Exact_rational Number_type; +typedef CGAL::Cartesian Kernel; +typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 Geom_traits_2; +typedef Geom_traits_2::Point_2 Point_2; +typedef Geom_traits_2::X_monotone_curve_2 X_monotone_curve_2; +typedef CGAL::Arr_spherical_topology_traits_2 Topol_traits_2; +typedef CGAL::Arrangement_on_surface_2 + Arrangement_2; +typedef Arrangement_2::Vertex_handle Vertex_handle; + +int main() +{ + Geom_traits_2 traits; + Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object(); + Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv = + traits.construct_x_monotone_curve_2_object(); + Arrangement_2 arr(&traits); + Point_2 sp = ctr_p(0, 0, -1); + Point_2 np = ctr_p(0, 0, 1); + + Point_2 p1 = ctr_p(-1, 0, -1); + Point_2 p2 = ctr_p(-1, 0, 1); + X_monotone_curve_2 xcv_sp_p2 = ctr_xcv(sp, p2); + X_monotone_curve_2 xcv_np_p1 = ctr_xcv(np, p1); + // std::cout << "Inserting " << xcv_sp_p2 << std::endl; + insert(arr, xcv_sp_p2); + // std::cout << "Inserting " << xcv_np_p1 << std::endl; + insert(arr, xcv_np_p1); + + Point_2 q1 = ctr_p(-1, -1, -1); + Point_2 q2 = ctr_p(-1, -1, 1); + X_monotone_curve_2 xcv_sp_q2 = ctr_xcv(sp, q2); + X_monotone_curve_2 xcv_np_q1 = ctr_xcv(np, q1); + insert(arr, xcv_sp_q2); + insert(arr, xcv_np_q1); + + X_monotone_curve_2 xcv_p1_q1 = ctr_xcv(p1, q1); + X_monotone_curve_2 xcv_p2_q2 = ctr_xcv(p2, q2); + insert(arr, xcv_p1_q1); + insert(arr, xcv_p2_q2); + + // Print the size of the arrangement. + std::cout << "The arrangement size:" << std::endl + << " V = " << arr.number_of_vertices() + << ", E = " << arr.number_of_edges() + << ", F = " << arr.number_of_faces() << std::endl; + + // std::cout << "arr: " << arr << std::endl; + + return 0; +} diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_sweep.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_sweep.cpp new file mode 100644 index 00000000000..223f937c37a --- /dev/null +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_sweep.cpp @@ -0,0 +1,139 @@ +//! \file examples/Arrangement_on_surface_2/spherical_degenerate_sweep.cpp +// Using the global aggregated insertion function. + +// #define CGAL_SL_VERBOSE 0 +// #define CGAL_ARRANGEMENT_ON_SURFACE_INSERT_VERBOSE 1 +// #define CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE 1 + +#include + +#include +#include +#include +#include +#include +#include + +typedef CGAL::Exact_rational Number_type; +typedef CGAL::Cartesian Kernel; + +#if 0 +typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 Geom_traits_2; +#elif 0 +typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 Geom_traits_2; +#else +typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 Geom_traits_2; +#endif + +typedef Geom_traits_2::Point_2 Point_2; +typedef Geom_traits_2::X_monotone_curve_2 X_monotone_curve_2; +typedef CGAL::Arr_spherical_topology_traits_2 Topol_traits_2; +typedef CGAL::Arrangement_on_surface_2 + Arrangement_2; +typedef Arrangement_2::Vertex_handle Vertex_handle; + +int main() +{ + Geom_traits_2 traits; + Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object(); + Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv = + traits.construct_x_monotone_curve_2_object(); + + std::vector< Point_2 > points; + std::vector< X_monotone_curve_2 > xcvs; + + CGAL::set_pretty_mode(std::cout); + + Point_2 sp = ctr_p(0, 0, -1); + Point_2 np = ctr_p(0, 0, 1); + points.push_back(sp); + points.push_back(np); + + Point_2 p1 = ctr_p(-1, 0, 0); + Point_2 p2 = ctr_p( 0, -1, 0); + Point_2 p3 = ctr_p( 1, 0, 0); + points.push_back(p1); + points.push_back(p2); + points.push_back(p3); + + X_monotone_curve_2 xcv_sp1 = ctr_xcv(sp, p1); + X_monotone_curve_2 xcv_sp2 = ctr_xcv(sp, p2); + X_monotone_curve_2 xcv_sp3 = ctr_xcv(sp, p3); + CGAL_assertion(xcv_sp1.is_vertical()); + CGAL_assertion(xcv_sp2.is_vertical()); + CGAL_assertion(xcv_sp3.is_vertical()); + xcvs.push_back(xcv_sp1); // 0 + xcvs.push_back(xcv_sp2); // 1 + xcvs.push_back(xcv_sp3); // 2 + + X_monotone_curve_2 xcv_12 = ctr_xcv(p1, p2); + X_monotone_curve_2 xcv_23 = ctr_xcv(p2, p3); + CGAL_assertion(!xcv_12.is_vertical()); + CGAL_assertion(!xcv_23.is_vertical()); + xcvs.push_back(xcv_12); // 3 + xcvs.push_back(xcv_23); // 4 + + X_monotone_curve_2 xcv_np1 = ctr_xcv(np, p1); + X_monotone_curve_2 xcv_np2 = ctr_xcv(np, p2); + X_monotone_curve_2 xcv_np3 = ctr_xcv(np, p3); + CGAL_assertion(xcv_np1.is_vertical()); + CGAL_assertion(xcv_np2.is_vertical()); + CGAL_assertion(xcv_np3.is_vertical()); + xcvs.push_back(xcv_np1); // 5 + xcvs.push_back(xcv_np2); // 6 + xcvs.push_back(xcv_np3); // 7 + + unsigned subsetsp = (1 << points.size()); + std::cout << "#subsets points: " << subsetsp << std::endl; + + unsigned subsets = (1 << xcvs.size()); + std::cout << "#subsets curves: " << subsets << std::endl; + + std::cout << "total combinations: " << (subsetsp)*(subsets) << std::endl<< std::endl;; + + for (unsigned up = 0; up < subsetsp; up++) { + std::vector< Point_2 > points_sub; + for (unsigned ep = 0; ep <= points.size(); ep++) { + if (up & (1 << ep)) { + std::cout << "take pt: " << ep << std::endl; + points_sub.push_back(points[ep]); + } + } + + for (unsigned u = 0; u < subsets; u++) { + std::vector< X_monotone_curve_2 > xcvs_sub; + for (unsigned e = 0; e <= xcvs.size(); e++) { + if (u & (1 << e)) { + std::cout << "take xcv: " << e << std::endl; + xcvs_sub.push_back(xcvs[e]); + } + } + + std::cout << "subsetpoints #" << up << " has size: " << points_sub.size() << std::endl; + std::cout << "subsetcurves #" << u << " has size: " << xcvs_sub.size() << std::endl; + +#if 1 + Arrangement_2 arr; + std::cout << "inserting " + << xcvs_sub.size() << " x-monotone curves and " + << points_sub.size() << " isolated points." + << std::endl; + + // TODO why is this signature not available as "insert(...)" + CGAL::insert_empty(arr, xcvs_sub.begin(), xcvs_sub.end(), points_sub.begin(), points_sub.end()); + + // Print the size of the arrangement. + std::cout << "The arrangement size:" << std::endl + << " V = " << arr.number_of_vertices() + << ", E = " << arr.number_of_edges() + << ", F = " << arr.number_of_faces() << std::endl; + + std::cout << "=======================================================" << std::endl << std::endl << std::endl; +#endif + //std::cout << "arr: " << arr << std::endl; + std::cout << std::endl; + } + } + + return 0; +} diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_insert.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_insert.cpp index 607ba79f2b8..21605ed8465 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_insert.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_insert.cpp @@ -1,41 +1,51 @@ //! \file examples/Arrangement_on_surface_2/aggregated_insertion.cpp // Using the global aggregated insertion functions. -#include -#include +#include #include #include #include #include -typedef CGAL::Exact_rational Number_type; -typedef CGAL::Cartesian Kernel; -typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 Geom_traits_2; +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; +#if 0 +typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 +#else +typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 +#endif + Geom_traits_2; typedef Geom_traits_2::Point_2 Point_2; typedef Geom_traits_2::X_monotone_curve_2 X_monotone_curve_2; typedef CGAL::Arr_spherical_topology_traits_2 Topol_traits_2; typedef CGAL::Arrangement_on_surface_2 Arrangement_2; -int main () +int main() { // Construct the arrangement of five intersecting segments. - Arrangement_2 arr; - + Geom_traits_2 traits; + Arrangement_2 arr(&traits); + std::list arcs; - arcs.push_back(X_monotone_curve_2(Point_2(1, 0, 0), Point_2(0, 1, 0))); - arcs.push_back(X_monotone_curve_2(Point_2(0, 1, 0), Point_2(0, 0, 1))); - arcs.push_back(X_monotone_curve_2(Point_2(0, 0, 1), Point_2(1, 0, 0))); - arcs.push_back(X_monotone_curve_2(Point_2(0, -1, 0), Point_2(0, 0, -1))); - arcs.push_back(X_monotone_curve_2(Point_2(0, -1, 0), Point_2(0, 0, 1))); - arcs.push_back(X_monotone_curve_2(Point_2(0, -1, 0), Point_2(1, 0, 0))); - arcs.push_back(X_monotone_curve_2(Point_2(0, 1, 0), Point_2(-1, 0, 0))); - arcs.push_back(X_monotone_curve_2(Point_2(-1, 0, 0), Point_2(0, -1, 0))); - arcs.push_back(X_monotone_curve_2(Point_2(0, 0, -1), Point_2(1, 0, 0))); - arcs.push_back(X_monotone_curve_2(Point_2(0, 1, 0), Point_2(0, 0, -1))); - -#if 0 + Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object(); + Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv = + traits.construct_x_monotone_curve_2_object(); + + arcs.push_back(ctr_xcv(ctr_p(1, 0, 0), ctr_p(0, 1, 0))); + arcs.push_back(ctr_xcv(ctr_p(0, 1, 0), ctr_p(0, 0, 1))); + arcs.push_back(ctr_xcv(ctr_p(0, 0, 1), ctr_p(1, 0, 0))); + arcs.push_back(ctr_xcv(ctr_p(0, -1, 0), ctr_p(0, 0, -1))); + arcs.push_back(ctr_xcv(ctr_p(0, -1, 0), ctr_p(0, 0, 1))); + arcs.push_back(ctr_xcv(ctr_p(0, -1, 0), ctr_p(1, 0, 0))); + arcs.push_back(ctr_xcv(ctr_p(0, 1, 0), ctr_p(-1, 0, 0))); + arcs.push_back(ctr_xcv(ctr_p(-1, 0, 0), ctr_p(0, -1, 0))); + arcs.push_back(ctr_xcv(ctr_p(0, 0, -1), ctr_p(1, 0, 0))); + arcs.push_back(ctr_xcv(ctr_p(0, 1, 0), ctr_p(0, 0, -1))); + arcs.push_back(ctr_xcv(ctr_p(-1, 0, 0), ctr_p(0, 0, 1))); + arcs.push_back(ctr_xcv(ctr_p(-1, 0, 0), ctr_p(0, 0, -1))); + +#if 1 // insert_non_intersecting_curves (arr, arcs.begin(), arcs.end()); // insert_x_monotone_curves (arr, arcs.begin(), arcs.end()); CGAL::insert(arr, arcs.begin(), arcs.end()); @@ -50,7 +60,7 @@ int main () // Print the size of the arrangement. std::cout << "The arrangement size:" << std::endl << " V = " << arr.number_of_vertices() - << ", E = " << arr.number_of_edges() + << ", E = " << arr.number_of_edges() << ", F = " << arr.number_of_faces() << std::endl; return 0; diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.cpp new file mode 100644 index 00000000000..08b58129b33 --- /dev/null +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.cpp @@ -0,0 +1,52 @@ +//! \file examples/Arrangement_on_surface_2/spherical_overlay.cpp +// Overlay of two arrangements embedded on the sphere. + +#include +#include +#include +#include +#include +#include + +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; +typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 Geom_traits_2; +typedef Geom_traits_2::Point_2 Point_2; +typedef Geom_traits_2::X_monotone_curve_2 X_monotone_curve_2; +typedef CGAL::Arr_spherical_topology_traits_2 Topol_traits_2; +typedef CGAL::Arrangement_on_surface_2 + Arrangement_2; +typedef CGAL::Arr_default_overlay_traits Overlay_traits; + +int main() +{ + Geom_traits_2 traits; + Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object(); + Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv = + traits.construct_x_monotone_curve_2_object(); + + Kernel::Direction_3 dir1(0, 0, 1); + X_monotone_curve_2 g11 = ctr_xcv(ctr_p(-1, 0, 0), ctr_p(0, -1, 0), dir1); + X_monotone_curve_2 g12 = ctr_xcv(ctr_p(0, -1, 0), ctr_p(-1, 0, 0), dir1); + + Arrangement_2 arr1(&traits); + CGAL::insert(arr1, g11); + CGAL::insert(arr1, g12); + std::cout << "No. of vertices: " << arr1.number_of_vertices() << std::endl; + + Kernel::Direction_3 dir2(0, 0, -1); + X_monotone_curve_2 g21 = ctr_xcv(ctr_p(-1, 0, 0), ctr_p(0, 1, 0), dir2); + X_monotone_curve_2 g22 = ctr_xcv(ctr_p(0, 1, 0), ctr_p(-1, 0, 0), dir2); + + Arrangement_2 arr2(&traits); + CGAL::insert(arr2, g21); + CGAL::insert(arr2, g22); + std::cout << "No. of vertices: " << arr2.number_of_vertices() << std::endl; + + Arrangement_2 overlay_arr; + Overlay_traits overlay_traits; + overlay(arr1, arr2, overlay_arr, overlay_traits); + std::cout << "No. of vertices: " << overlay_arr.number_of_vertices() + << std::endl; + + return 0; +} diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.jpg b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.jpg new file mode 100644 index 00000000000..85341c36d84 Binary files /dev/null and b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.jpg differ diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.wrl b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.wrl new file mode 100644 index 00000000000..2f9d155c3a2 --- /dev/null +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.wrl @@ -0,0 +1,339 @@ +#VRML V2.0 utf8 +Configuration { + accumulation Accumulation { enabled TRUE } + stencilBits 8 +} +ColorBackground { + color 1 1 1 1 + clearStencil TRUE +} +NavigationInfo { type [ "EXAMINE" "ANY" ] } +Viewpoint { + type "ORTHOGONAL" + fieldOfView 2.96 + # radiusScale 0.7 +} + +DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] } + +DEF DRAW_OPAQUE_KEY SingleKeySensor { key "o" } +DEF DRAW_HALOED_KEY SingleKeySensor { key "l" state TRUE } +DEF DRAW_SURFACE_KEY SingleKeySensor { key "b" state TRUE } +DEF EXPORT_KEY SingleKeySensor { key "O" } +DEF SNAP_KEY SingleKeySensor { key "S" } + +DEF VERTEX_SHAPE_KEY SingleKeySensor { + key "v" + boolean FALSE + numberOfStates 5 + intState 2 # disc +} + +DEF EDGE_SHAPE_KEY SingleKeySensor { + key "e" + boolean FALSE + numberOfStates 4 + intState 2 # strip +} + +DEF HIDE_SINGULARITIES_KEY SingleKeySensor { + boolean FALSE + key "s" +} + +DEF HIDE_DISCONTINUITY_KEY SingleKeySensor { + boolean FALSE + key "d" +} + +DEF SNAP Snapshot { + image Image { } + fileFormat "jpg" + sequence FALSE + dirName "." + fileName "spherical_overlay" +} + +Transform { + rotation 1 0 0 -1.5708 + bboxCenter 0 0 0 + bboxSize 1.5 1.5 1.5 + children [ + Shape { + drawDepth FALSE + appearance Appearance { + material Material { + diffuseColor 0.5 0.5 0.5 + ambientIntensity 0.7 + specularColor 0.5 0.5 0.5 + } + } + geometry Sphere { + slices 32 + stacks 32 + } + } + Switch { + whichChoice -1 + children [ + Shape { + appearance Appearance { + material Material { + transparency 0.0001 + } + } + geometry DEF GEOM1 ArrangementOnSphereMarked { + drawSurface FALSE + # drawOpaque TRUE + drawHaloed TRUE + aosEdgeStyle "strip" + aosEdgeRadius 0.03 + aosEdgeColor 0 0 1 + aosEdgeLineWidth 3 + aosVertexStyle "disc" + aosVertexRadius 0.1 + aosVertexPointSize 6 + aosIsolatedVertexStyle "disc" + # insertionStrategy "increment" + aosMarkedEdgeIndex 100 + aosMarkedVertexIndex 0 + aosMarkedVertexStyle "none" + coord DEF COORD EpecCoordinate { + exactPoint [-1 0 0, 0 -1 0] + } + normal EpecNormal { + exactVector [0 0 1] + } + curveIndex [0 1 1 0] + normalIndex[0 0] + } + } + ] + } + Switch { + whichChoice -1 + children [ + Shape { + appearance Appearance { + material Material { + transparency 0.0001 + } + } + geometry DEF GEOM2 ArrangementOnSphereMarked { + drawSurface FALSE + # drawOpaque TRUE + drawHaloed TRUE + aosEdgeStyle "strip" + aosEdgeRadius 0.03 + aosEdgeColor 0 1 0 + aosEdgeLineWidth 3 + aosVertexStyle "disc" + aosVertexRadius 0.1 + aosVertexPointSize 6 + aosIsolatedVertexStyle "disc" + # insertionStrategy "increment" + aosMarkedEdgeIndex 100 + aosMarkedVertexIndex 0 + aosMarkedVertexStyle "none" + coord DEF COORD2 EpecCoordinate { + exactPoint [-1 0 0, 0 1 0] + } + normal EpecNormal { + exactVector [0 0 -1] + } + curveIndex [0 1 1 0] + normalIndex[0 0] + } + } + ] + } + + Switch { + whichChoice 0 + children [ + Shape { + appearance Appearance { + material Material { + transparency 0.0001 + } + } + geometry ArrangementOnSphereMarked { + drawSurface FALSE + # drawOpaque TRUE + drawHaloed TRUE + aosEdgeStyle "strip" + aosEdgeColor 0 0.5 0.5 + aosEdgeRadius 0.03 + aosEdgeLineWidth 3 + aosVertexStyle "disc" + aosVertexRadius 0.1 + aosVertexPointSize 6 + aosIsolatedVertexStyle "disc" + aosVertexColor 0.6 0.6 0 + aosBoundaryVertexColor 0.5 0 0 + # insertionStrategy "increment" + aosMarkedVertexIndex 0 + aosMarkedVertexStyle "none" + overlay [USE GEOM1 + USE GEOM2 + ] + } + } + ] + } + + # The singularity points: + DEF SINGULARITIES_SWITCH Switch { + whichChoice 0 + children [ + Group { + children [ + Shape { + appearance DEF BOUNDARY_APP Appearance { + material Material { + # ambientIntensity 1 + diffuseColor 0.4 0.4 0.4 + # specularColor 0.8 0.8 0.8 + # transparency 0.0001 + } + } + geometry Sphere { + center 0 0 1 + radius 0.05 + } + } + Shape { + appearance DEF AXES_APP Appearance { + material Material { + # ambientIntensity 1 + diffuseColor 0.4 0.4 0.4 + # specularColor 0.3 0.3 0.3 + # transparency 0.0001 + } + } + geometry Sphere { + center 0 0 -1 + radius 0.05 + } + } + ] + } + ] + } + + # The discontinuity arc: + DEF DISCONTINUITY_SWITCH Switch { + whichChoice 0 + children [ + Shape { + appearance USE BOUNDARY_APP + geometry Extrusion { + creaseAngle 2.0 + beginCap TRUE + endCap TRUE + loop FALSE + crossSectionRadius 0.01 + spine [ + 0 0 1, + -0.0980171 0 0.995185, + -0.19509 0 0.980785, + -0.290285 0 0.95694, + -0.382683 0 0.92388, + -0.471397 0 0.881921, + -0.55557 0 0.83147, + -0.634393 0 0.77301, + -0.707107 0 0.707107, + -0.77301 0 0.634393, + -0.83147 0 0.55557, + -0.881921 0 0.471397, + -0.92388 0 0.382683, + -0.95694 0 0.290285, + -0.980785 0 0.19509, + -0.995185 0 0.0980171, + -1 0 0, + -0.995185 0 -0.0980171, + -0.980785 0 -0.19509, + -0.95694 0 -0.290285, + -0.92388 0 -0.382683, + -0.881921 0 -0.471397, + -0.83147 0 -0.55557, + -0.77301 0 -0.634393, + -0.707107 0 -0.707107, + -0.634393 0 -0.77301, + -0.55557 0 -0.83147, + -0.471397 0 -0.881921, + -0.382683 0 -0.92388, + -0.290285 0 -0.95694, + -0.19509 0 -0.980785, + -0.0980171 0 -0.995185, + 0 0 -1, + ] + } + } + ] + } + + # The axes: + DEF AXES Transform { + scale 0.1 0.1 0.1 + children [ + Shape { + appearance USE AXES_APP + geometry Sphere { radius 0.1 } + } + DEF CS_AXIS Transform { + translation 0 1.5 0 + children [ + Shape { + appearance USE AXES_APP + geometry Cylinder { + radius 0.1 + height 3 + set_is_bottom_visible FALSE + set_is_top_visible FALSE + } + } + Transform { + translation 0 1.7 0 + children [ + Shape { + appearance USE AXES_APP + geometry Cone { + bottomRadius 0.2 + height 0.4 + } + } + ] + } + ] + } + Transform { + rotation 0 0 -1 1.57 + children [ USE CS_AXIS ] + } + Transform { + rotation 1 0 0 1.57 + children [ USE CS_AXIS ] + } + ] + } +# Transform { +# translation 2 0 0 +# children [ +# USE ARRANGMENT +# ] +# } + ] +} + +ROUTE DRAW_OPAQUE_KEY.state TO GEOM1.drawOpaque +ROUTE DRAW_HALOED_KEY.state TO GEOM1.drawHaloed + +ROUTE VERTEX_SHAPE_KEY.intState TO GEOM1.aosVertexStyleId +ROUTE EDGE_SHAPE_KEY.intState TO GEOM1.aosEdgeStyleId + +ROUTE SNAP_KEY.state TO SNAP.trigger +# ROUTE EXPORT_KEY.press TO GEOM.export + +ROUTE HIDE_DISCONTINUITY_KEY.intState TO DISCONTINUITY_SWITCH.whichChoice +ROUTE HIDE_SINGULARITIES_KEY.intState TO SINGULARITIES_SWITCH.whichChoice diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h b/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h index 376219eb76e..a583508d0c9 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h @@ -15,7 +15,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0+ -// +// // // Author(s) : Ron Wein // Efi Fogel @@ -153,7 +153,7 @@ public: Arr_traits_basic_adaptor_2 Traits_adaptor_2; - const Traits_adaptor_2* m_traits = + const Traits_adaptor_2* m_traits = static_cast (p_arr->geometry_traits()); Arr_curve_end ind = ARR_MIN_END; @@ -206,8 +206,8 @@ public: * Compute the distance (in halfedges) between two halfedges. * \param e1 A handle for the source halfedge. * \param e2 A handle for the destination halfedge. - * \return In case e1 and e2 belong to the same connected component, the - * function returns number of boundary halfedges between the two + * \return In case e1 and e2 belong to the same connected component, the + * function returns number of boundary halfedges between the two * halfedges. Otherwise, it returns (-1). */ int halfedge_distance(Halfedge_const_handle e1, @@ -216,7 +216,7 @@ public: // If the two halfedges do not belong to the same component, return (-1). const DHalfedge* he1 = p_arr->_halfedge(e1); const DHalfedge* he2 = p_arr->_halfedge(e2); - + if (he1 == he2) return (0); const DInner_ccb* ic1 = (he1->is_on_inner_ccb()) ? he1->inner_ccb() : NULL; @@ -308,16 +308,44 @@ public: CGAL_assertion(v != NULL); return (p_arr->_handle_for (v)); } - + + /*! + * Create a new boundary vertex. + * \param pt the point + * \param ps_x The parameter space in x. + * \param ps_y The parameter space in y. + * \param notify Should we send a notification to the topology traits + * on the creation of the vertex (true by default). + * \pre One of ps_x or ps_y does not equal ARR_INTERIOR. + * \return A handle for the newly created vertex. + */ + Vertex_handle create_boundary_vertex(const Point_2& pt, + Arr_parameter_space ps_x, + Arr_parameter_space ps_y, + bool notify = true) + { + CGAL_precondition(ps_x != ARR_INTERIOR || ps_y != ARR_INTERIOR); + + DVertex* v = p_arr->_create_boundary_vertex (pt, ps_x, ps_y); + + CGAL_assertion(v != NULL); + + // Notify the topology traits on the creation of the boundary vertex. + if (notify) + p_arr->topology_traits()->notify_on_boundary_vertex_creation(v, pt, + ps_x, ps_y); + return (p_arr->_handle_for(v)); + } + /*! * Create a new boundary vertex. * \param cv The curve incident to the boundary. * \param ind The relevant curve-end. - * \param ps_x The boundary condition in x. - * \param by The boundary condition in y. + * \param ps_x The parameter space in x. + * \param ps_y The parameter space in y. * \param notify Should we send a notification to the topology traits * on the creation of the vertex (true by default). - * \pre Either ps_x or by does not equal ARR_INTERIOR. + * \pre One of ps_x or ps_y does not equal ARR_INTERIOR. * \return A handle for the newly created vertex. */ Vertex_handle create_boundary_vertex(const X_monotone_curve_2& cv, @@ -326,6 +354,8 @@ public: Arr_parameter_space ps_y, bool notify = true) { + CGAL_precondition(ps_x != ARR_INTERIOR || ps_y != ARR_INTERIOR); + DVertex* v = p_arr->_create_boundary_vertex (cv, ind, ps_x, ps_y); CGAL_assertion(v != NULL); @@ -387,7 +417,7 @@ public: * In case a new face has been created, it is given as the incident * face of this halfedge. */ - Halfedge_handle insert_at_vertices_ex(Halfedge_handle he_to, + Halfedge_handle insert_at_vertices_ex(Halfedge_handle he_to, const X_monotone_curve_2& cv, Arr_halfedge_direction cv_dir, Halfedge_handle he_away, @@ -421,7 +451,7 @@ public: */ Halfedge_handle insert_from_vertex_ex(Halfedge_handle he_to, const X_monotone_curve_2& cv, - Arr_halfedge_direction cv_dir, + Arr_halfedge_direction cv_dir, Vertex_handle v) { DVertex* p_v = p_arr->_vertex(v); @@ -457,7 +487,7 @@ public: */ Halfedge_handle insert_in_face_interior_ex(Face_handle f, const X_monotone_curve_2& cv, - Arr_halfedge_direction cv_dir, + Arr_halfedge_direction cv_dir, Vertex_handle v1, Vertex_handle v2) { @@ -487,7 +517,7 @@ public: CGAL_assertion(he != NULL); return (p_arr->_handle_for (he)); - + } /*! @@ -497,7 +527,7 @@ public: */ void insert_isolated_vertex(Face_handle f, Vertex_handle v) { p_arr->_insert_isolated_vertex(p_arr->_face (f), p_arr->_vertex(v)); } - + /*! * Relocate all holes and isolated vertices to their proper position, * immediately after a face has split due to the insertion of a new halfedge. @@ -543,7 +573,7 @@ public: p_arr->_move_inner_ccb(p_arr->_face(from_face), p_arr->_face(to_face), p_arr->_halfedge(ccb)); } - + /*! * Move an isolated vertex from one face to another. * \param from_face The source face. @@ -580,7 +610,7 @@ public: p_arr->_modify_vertex(p_arr->_vertex(v), p); return v; } - + /*! * Modify the x-monotone curve associated with a given edge. The curve may be * geometrically different than the one currently associated with the edge. @@ -594,7 +624,7 @@ public: p_arr->_modify_edge(p_arr->_halfedge (e), cv); return e; } - + /*! * Split a given edge into two at a given point, and associate the given * x-monotone curves with the split edges. @@ -608,7 +638,7 @@ public: * source of e, and whose target is the split point. */ Halfedge_handle split_edge_ex(Halfedge_handle e, const Point_2& p, - const X_monotone_curve_2& cv1, + const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2) { DHalfedge* he = p_arr->_split_edge (p_arr->_halfedge(e), p, cv1, cv2); @@ -650,7 +680,7 @@ public: Halfedge_handle split_fictitious_edge(Halfedge_handle e, Vertex_handle v) { CGAL_precondition(e->is_fictitious()); - DHalfedge* he = + DHalfedge* he = p_arr->topology_traits()->split_fictitious_edge(p_arr->_halfedge(e), p_arr->_vertex(v)); return (p_arr->_handle_for(he)); @@ -663,7 +693,7 @@ public: * becomes isolated (true by default). * \param remove_target Should the target vertex of e be removed if it * becomes isolated (true by default). - * \pre In case the removal causes the creation of a new hole, e should + * \pre In case the removal causes the creation of a new hole, e should * point at this hole. * \return A handle for the remaining face. */ @@ -722,20 +752,20 @@ public: /*! Get an iterator for the first valid arrangement vertex. */ Valid_vertex_iterator valid_vertices_begin() - { + { return (Valid_vertex_iterator (p_arr->topology_traits()->dcel().vertices_begin(), p_arr->topology_traits()->dcel().vertices_end(), - Is_valid_vertex (p_arr->topology_traits()))); + Is_valid_vertex (p_arr->topology_traits()))); } /*! Get a past-the-end iterator for the valid arrangement vertices. */ Valid_vertex_iterator valid_vertices_end() - { + { return (Valid_vertex_iterator (p_arr->topology_traits()->dcel().vertices_end(), p_arr->topology_traits()->dcel().vertices_end(), - Is_valid_vertex (p_arr->topology_traits()))); + Is_valid_vertex (p_arr->topology_traits()))); } /*! Get the number of valid arrangement vertices. */ diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h index 95f52e13f2d..19c29418cd9 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h @@ -15,7 +15,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0+ -// +// // // Author(s) : Michael Kerber // @@ -37,26 +37,26 @@ namespace CGAL { -template< class Coefficient_ > +template< class Coefficient_ > class Arr_algebraic_segment_traits_2 { - + public: enum Site_of_point { POINT_IN_INTERIOR = 0, MIN_ENDPOINT = -1, MAX_ENDPOINT = 1 }; - + // Template argument - + typedef Coefficient_ Coefficient; - + // 'derivation' typedef CGAL::Algebraic_kernel_d_1< Coefficient > Algebraic_kernel_d_1; - typedef CGAL::Algebraic_curve_kernel_2< Algebraic_kernel_d_1 > + typedef CGAL::Algebraic_curve_kernel_2< Algebraic_kernel_d_1 > Algebraic_kernel_d_2; - + typedef CGAL::Curved_kernel_via_analysis_2< Algebraic_kernel_d_2 > CKvA_2; typedef CGAL::Arr_algebraic_segment_traits_2 Self; @@ -71,18 +71,18 @@ public: // Assignement operator const Self& operator= (const Self& s) {return s;} - + // public types - + typedef typename Algebraic_kernel_d_2::Algebraic_real_1 Algebraic_real_1; typedef typename Algebraic_kernel_d_2::Bound Bound; typedef typename Algebraic_kernel_d_2::Polynomial_2 Polynomial_2; /// public types for ArrangementTraits_2 - + typedef typename Algebraic_kernel_d_2::Curve_analysis_2 Curve_2; - + typedef typename CKvA_2::Arc_2 X_monotone_curve_2; typedef typename CKvA_2::Point_2 Point_2; @@ -90,7 +90,7 @@ public: typedef typename CKvA_2::Has_left_category Has_left_category; typedef typename CKvA_2::Has_merge_category Has_merge_category; - typedef typename CKvA_2::Has_do_intersect_category + typedef typename CKvA_2::Has_do_intersect_category Has_do_intersect_category; typedef typename CKvA_2::Left_side_category Left_side_category; @@ -125,7 +125,7 @@ public: return CKvA_2::instance().parameter_space_in_y_2_object(); } - typedef typename CKvA_2::Compare_y_near_boundary_2 + typedef typename CKvA_2::Compare_y_near_boundary_2 Compare_y_near_boundary_2; Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const { return CKvA_2::instance().compare_y_near_boundary_2_object(); @@ -136,14 +136,14 @@ public: return CKvA_2::instance().parameter_space_in_x_2_object(); } - typedef typename CKvA_2::Compare_x_at_limit_2 Compare_x_at_limit_2; - Compare_x_at_limit_2 compare_x_at_limit_2_object() const { - return CKvA_2::instance().compare_x_at_limit_2_object(); + typedef typename CKvA_2::Compare_x_on_boundary_2 Compare_x_on_boundary_2; + Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const { + return CKvA_2::instance().compare_x_on_boundary_2_object(); } - typedef typename CKvA_2::Compare_x_near_limit_2 Compare_x_near_limit_2; - Compare_x_near_limit_2 compare_x_near_limit_2_object() const { - return CKvA_2::instance().compare_x_near_limit_2_object(); + typedef typename CKvA_2::Compare_x_near_boundary_2 Compare_x_near_boundary_2; + Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const { + return CKvA_2::instance().compare_x_near_boundary_2_object(); } typedef typename CKvA_2::Construct_min_vertex_2 Construct_min_vertex_2; @@ -160,7 +160,7 @@ public: Construct_opposite_2 construct_opposite_2_object() const { return CKvA_2::instance().construct_opposite_2_object(); } - + typedef typename CKvA_2::Is_vertical_2 Is_vertical_2; Is_vertical_2 is_vertical_2_object() const { return CKvA_2::instance().is_vertical_2_object(); @@ -180,7 +180,7 @@ public: Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const { return CKvA_2::instance().compare_y_at_x_right_2_object(); } - + typedef typename CKvA_2::Intersect_2 Intersect_2; Intersect_2 intersect_2_object() const { return CKvA_2::instance().intersect_2_object(); @@ -218,11 +218,11 @@ public: return Construct_point_2(&CKvA_2::instance()); } - - class Construct_x_monotone_segment_2 : public + + class Construct_x_monotone_segment_2 : public CGAL::internal::Curved_kernel_via_analysis_2_Functors:: Curved_kernel_via_analysis_2_functor_base< CKvA_2 > { - + public: typedef CGAL::internal::Curved_kernel_via_analysis_2_Functors:: @@ -239,7 +239,7 @@ public: branch_numbers_and_vertical(Curve_2 cv, Point_2 p) const { Equal_2 equal = this->_ckva()->equal_2_object(); - + Algebraic_real_1 x = p.x(); int no; bool is_event; @@ -264,7 +264,7 @@ public: // abbrevation for convenience bool is_one_one(Curve_2 cv, Point_2 p) const { - std::pair,bool> branches + std::pair,bool> branches = branch_numbers_and_vertical(cv,p); return branches.first.first==1 && branches.first.second==1 && !branches.second; @@ -272,28 +272,28 @@ public: } template OutputIterator - x_monotone_segment (Curve_2 cv, - Point_2 p, + x_monotone_segment (Curve_2 cv, + Point_2 p, boost::optional start, boost::optional end, OutputIterator out) const { - + //CGAL_assertion(is_one_one(cv,p)); std::list segs; - Is_on_2 on_arc + Is_on_2 on_arc = this->_ckva()->is_on_2_object(); - Construct_min_vertex_2 left + Construct_min_vertex_2 left = this->_ckva()->construct_min_vertex_2_object(); - Construct_max_vertex_2 right + Construct_max_vertex_2 right = this->_ckva()->construct_max_vertex_2_object(); Equal_2 equal = this->_ckva()->equal_2_object(); std::vector arcs; - this->_ckva()->make_x_monotone_2_object() + this->_ckva()->make_x_monotone_2_object() (cv,std::back_inserter(arcs)); - typename std::vector::const_iterator + typename std::vector::const_iterator it = arcs.begin(),helper; X_monotone_curve_2 it_seg; CGAL::assign(it_seg,*it); @@ -305,10 +305,10 @@ public: it++; CGAL::assign(it_seg,*it); } - + bool left_on_arc = start && on_arc(start.get(),it_seg); bool right_on_arc = end && on_arc(end.get(),it_seg); - + if( left_on_arc && right_on_arc ) { segs.push_back(it_seg.trim(start.get(),end.get())); } @@ -335,14 +335,14 @@ public: segs.push_back(split1); } } - } + } if( (!left_on_arc) && (!right_on_arc)) { segs.push_back(it_seg); } helper=it; // for later usage - + if(! left_on_arc) { - + Point_2 point_it; while(true) { if(it_seg.is_finite(CGAL::ARR_MIN_END) && @@ -397,16 +397,16 @@ public: } } } - + std::copy(segs.begin(),segs.end(),out); return out; - + } public: - + template OutputIterator - operator() (Curve_2 cv, + operator() (Curve_2 cv, Point_2 p, Site_of_point site_of_p, OutputIterator out) const { @@ -415,7 +415,7 @@ public: } else if(site_of_p==MIN_ENDPOINT) { return x_monotone_segment(cv, p, - boost::optional(p), + boost::optional(p), boost::none, out); } @@ -423,18 +423,18 @@ public: return x_monotone_segment(cv, p, boost::none, - boost::optional(p), + boost::optional(p), out); } template OutputIterator - operator() (Curve_2 cv, + operator() (Curve_2 cv, Point_2 end_left, Point_2 end_right, OutputIterator out) const { - - + + CGAL_assertion((branch_numbers_and_vertical(cv,end_left). first.second==1 && @@ -456,19 +456,19 @@ public: (branch_numbers_and_vertical(cv,end_right). first.first==0 && branch_numbers_and_vertical(cv,end_right).second)) { - Compare_x_2 equal_x + Compare_x_2 equal_x = this->_ckva()->compare_x_2_object(); ) CGAL_assertion(equal_x(end_left,end_right)==CGAL::EQUAL); CGAL_assertion_code(}); - - + + if( (branch_numbers_and_vertical(cv,end_left). first.second==0 && branch_numbers_and_vertical(cv,end_left).second) || (branch_numbers_and_vertical(cv,end_left). first.second==1 && !branch_numbers_and_vertical(cv,end_left).second)) { - + return x_monotone_segment (cv, end_left, @@ -491,15 +491,15 @@ public: if(same_x) { Algebraic_real_1 x = p.x(); Polynomial_2 f = Polynomial_2(x.polynomial()); - Curve_2 cv + Curve_2 cv = this->_ckva()->kernel().construct_curve_2_object() (f); *out++=typename CKvA_2::Arc_2(p,q,cv); return out; } Algebraic_real_1 px =this->_ckva()->kernel().compute_x_2_object()(p.xy()), - py=this->_ckva()->kernel().compute_y_2_object()(p.xy()), - qx=this->_ckva()->kernel().compute_x_2_object()(q.xy()), + py=this->_ckva()->kernel().compute_y_2_object()(p.xy()), + qx=this->_ckva()->kernel().compute_x_2_object()(q.xy()), qy=this->_ckva()->kernel().compute_y_2_object()(q.xy()); bool p_rat=px.is_rational() && py.is_rational(); bool q_rat=qx.is_rational() && qy.is_rational(); @@ -530,7 +530,7 @@ public: Polynomial_1(term_at_y_int)); Curve_2 curve=this->_ckva()->kernel().construct_curve_2_object() (pol); - + CGAL_assertion(this->_ckva()->is_on_2_object()(p,curve)); CGAL_assertion(this->_ckva()->is_on_2_object()(q,curve)); return this->operator()(curve,p,q,out); @@ -539,18 +539,18 @@ public: return out; } }; - - Construct_x_monotone_segment_2 construct_x_monotone_segment_2_object() + + Construct_x_monotone_segment_2 construct_x_monotone_segment_2_object() const { return Construct_x_monotone_segment_2(&CKvA_2::instance()); } /* - - class Construct_vertical_segment_2 : public + + class Construct_vertical_segment_2 : public CGAL::internal::Curved_kernel_via_analysis_2_Functors:: Curved_kernel_via_analysis_2_functor_base< CKvA_2 > { - + public: typedef CGAL::internal::Curved_kernel_via_analysis_2_Functors:: @@ -564,12 +564,12 @@ public: X_monotone_curve_2 operator() (Point_2 p, Point_2 q) { Algebraic_real_1 x = p.x(); Polynomial_2 f = Polynomial_2(x.polynomial()); - Curve_2 cv + Curve_2 cv = this->_ckva()->kernel().construct_curve_2_object() (f); return typename CKvA_2::Arc_2(p,q,cv); } - + template OutputIterator operator() (Point_2 p, Site_of_point site_of_p) const { @@ -584,17 +584,17 @@ public: } CGAL_assertion(site_of_p==MAX_ENDPOINT); return typename CKvA_2::Arc_2(p,ARR_MAX_END,cv); - + } }; Construct_vertical_segment_2 construct_vertical_segment_2_object() const { return Construct_vertical_segment_2(&CKvA_2::instance()); } - -*/ - class Construct_curve_2 : public +*/ + + class Construct_curve_2 : public CGAL::internal::Curved_kernel_via_analysis_2_Functors:: Curved_kernel_via_analysis_2_functor_base< CKvA_2 > { @@ -615,44 +615,44 @@ public: } - - + + /* // additional functionality (for not introducing a "general" arc) class Connect_points_2 { - + template< class OutputIterator > - OutputIterator operator() (Curve_2, Point_2, Point_2, ..., + OutputIterator operator() (Curve_2, Point_2, Point_2, ..., OutputIterator) { - + while (false || true) { *oi++ = X_monotone_curve_2(...); } - + return oi; } template< class OutputIterator > OutputIterator operator() (Curve_2, Point_2, Point_2, int, ..., OutputIterator) { - - + + while (false || true) { *oi++ = X_monotone_curve_2(...); } - + return oi; } }; */ - + }; } //namespace CGAL diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h index 39a7d71acc2..b0a15a4aa31 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h @@ -42,10 +42,10 @@ namespace CGAL { -/*! \class +/*! \class * A model of the ArrangementTraits_2 concept that counts the methods invoked. */ -template +template class Arr_counting_traits_2 : public Base_traits { public: enum Operation_id { @@ -80,14 +80,11 @@ public: PARAMETER_SPACE_IN_Y_CURVE_OP, IS_ON_Y_IDENTIFICATION_POINT_OP, IS_ON_Y_IDENTIFICATION_CURVE_OP, - COMPARE_X_AT_LIMIT_POINT_CURVE_END_OP, - COMPARE_X_AT_LIMIT_CURVE_ENDS_OP, - COMPARE_X_NEAR_LIMIT_OP, COMPARE_X_ON_BOUNDARY_POINTS_OP, COMPARE_X_ON_BOUNDARY_POINT_CURVE_END_OP, COMPARE_X_ON_BOUNDARY_CURVE_ENDS_OP, COMPARE_X_NEAR_BOUNDARY_OP, - + NUMBER_OF_OPERATIONS }; @@ -107,64 +104,64 @@ public: clear_counters(); increment(); } - + /*! Obtain the counter of the given operation */ unsigned int count(Operation_id id) const { return m_counters[id]; } unsigned int count_compare_x() const { return m_counters[COMPARE_X_OP]; } - + unsigned int count_compare_xy() const { return m_counters[COMPARE_XY_OP]; } unsigned int count_construct_min_vertex() const { return m_counters[CONSTRUCT_MIN_VERTEX_OP]; } - + unsigned int count_construct_max_vertex() const { return m_counters[CONSTRUCT_MAX_VERTEX_OP]; } unsigned int count_is_vertical() const { return m_counters[IS_VERTICAL_OP]; } - + unsigned int count_compare_y_at_x() const { return m_counters[COMPARE_Y_AT_X_OP]; } - + unsigned int count_equal_points() const { return m_counters[EQUAL_POINTS_OP]; } - + unsigned int count_equal_curves() const { return m_counters[EQUAL_CURVES_OP]; } - + unsigned int count_compare_y_at_x_left() const { return m_counters[COMPARE_Y_AT_X_LEFT_OP]; } - + unsigned int count_compare_y_at_x_right() const { return m_counters[COMPARE_Y_AT_X_RIGHT_OP]; } - + unsigned int count_make_x_monotone() const { return m_counters[MAKE_X_MONOTONE_OP]; } - + unsigned int count_split() const { return m_counters[SPLIT_OP]; } - + unsigned int count_intersect() const { return m_counters[INTERSECT_OP]; } - + unsigned int count_are_mergeable() const { return m_counters[ARE_MERGEABLE_OP]; } - + unsigned int count_merge() const { return m_counters[MERGE_OP]; } - + unsigned int count_construct_opposite() const { return m_counters[CONSTRUCT_OPPOSITE_OP]; } - + unsigned int count_compare_endpoints_xy() const { return m_counters[COMPARE_ENDPOINTS_XY_OP]; } // left-right - + unsigned int count_parameter_space_in_x_curve_end() const { return m_counters[PARAMETER_SPACE_IN_X_CURVE_END_OP]; } @@ -173,7 +170,7 @@ public: unsigned int count_parameter_space_in_x_point() const { return m_counters[PARAMETER_SPACE_IN_X_POINT_OP]; } - + unsigned int count_is_on_x_identification_point() const { return m_counters[IS_ON_X_IDENTIFICATION_POINT_OP]; } @@ -204,15 +201,6 @@ public: unsigned int count_is_on_y_identification_curve() const { return m_counters[IS_ON_Y_IDENTIFICATION_CURVE_OP]; } - unsigned int count_compare_x_at_limit_point_curve_end() const - { return m_counters[COMPARE_X_AT_LIMIT_POINT_CURVE_END_OP]; } - - unsigned int count_compare_x_at_limit_curve_ends() const - { return m_counters[COMPARE_X_AT_LIMIT_CURVE_ENDS_OP]; } - - unsigned int count_compare_x_near_limit() const - { return m_counters[COMPARE_X_NEAR_LIMIT_OP]; } - unsigned int count_compare_x_on_boundary_points() const { return m_counters[COMPARE_X_ON_BOUNDARY_POINTS_OP]; } @@ -241,7 +229,7 @@ public: Top_side_category; typedef typename internal::Arr_complete_right_side_category< Base >::Category Right_side_category; - + typedef typename Base::Point_2 Point_2; typedef typename Base::X_monotone_curve_2 X_monotone_curve_2; typedef typename Base::Curve_2 Curve_2; @@ -309,7 +297,7 @@ public: const Point_2 operator()(const X_monotone_curve_2& xc) const { ++m_counter; return m_object(xc); } }; - + /*! A functor that checks whether a given x-monotone curve is vertical. */ class Is_vertical_2 { private: @@ -325,7 +313,7 @@ public: bool operator()(const X_monotone_curve_2& xc) const { ++m_counter; return m_object(xc); } }; - + /*! A functor that compares the y-coordinates of a point and an * x-monotone curve at the point x-coordinate. */ @@ -344,7 +332,7 @@ public: const X_monotone_curve_2& xc) const { ++m_counter; return m_object(p, xc); } }; - + /*! A functor that checks whether two points and two x-monotone curves are * identical. */ @@ -368,7 +356,7 @@ public: /*! Operate */ bool operator()(const Point_2& p1, const Point_2& p2) const - { ++m_counter2; return m_object(p1, p2); } + { ++m_counter2; return m_object(p1, p2); } }; /*! A functor that compares compares the y-coordinates of two x-monotone @@ -410,7 +398,7 @@ public: const Point_2& p) const { ++m_counter; return m_object(xc1, xc2, p); } }; - + /*! A functor that divides a curve into x-monotone curves. */ class Make_x_monotone_2 { private: @@ -423,7 +411,7 @@ public: m_object(base->make_x_monotone_2_object()), m_counter(counter) {} /*! Operate */ - template + template OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const { ++m_counter; return m_object(cv, oi); } }; @@ -457,7 +445,7 @@ public: m_object(base->intersect_2_object()), m_counter(counter) {} /*! Operate */ - template + template OutputIterator operator()(const X_monotone_curve_2& xc1, const X_monotone_curve_2& xc2, OutputIterator oi) const @@ -549,10 +537,11 @@ public: /*! Construct */ Parameter_space_in_x_2(const Base* base, unsigned int& counter1, unsigned int& counter2, unsigned int& counter3) : - m_object(base->parameter_space_in_x_2_object()), + m_object(base->parameter_space_in_x_2_object()), m_counter1(counter1), m_counter2(counter2), - m_counter3(counter3) {} + m_counter3(counter3) + {} /*! Operate */ Arr_parameter_space operator()(const X_monotone_curve_2& xc, @@ -564,11 +553,9 @@ public: Arr_parameter_space operator()(const Point_2& p) const { ++m_counter2; return m_object(p); } - /*! Operate */ Arr_parameter_space operator()(const X_monotone_curve_2& xc) const { ++m_counter3; return m_object(xc); } - }; /*! A functor that determines whether a point or a curve lies on an @@ -582,21 +569,20 @@ public: public: /*! Construct */ - Is_on_x_identification_2(const Base* base, + Is_on_x_identification_2(const Base* base, unsigned int& counter1, unsigned int& counter2) : - m_object(base->is_on_x_identificiation_2_object()), + m_object(base->is_on_x_identificiation_2_object()), m_counter1(counter1), - m_counter2(counter2) {} + m_counter2(counter2) + {} /*! Operate */ Arr_parameter_space operator()(const Point_2& p) const { ++m_counter1; return m_object(p); } - /*! Operate */ Arr_parameter_space operator()(const X_monotone_curve_2& xc) const { ++m_counter2; return m_object(xc); } - }; /*! A functor that compares the y-coordinate of two given points @@ -618,7 +604,7 @@ public: Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { ++m_counter; return m_object(p1, p2); } }; - + /*! A functor that compares the y-coordinates of curve ends near the * boundary of the parameter space. */ @@ -634,7 +620,7 @@ public: /*! Operate */ Comparison_result operator()(const X_monotone_curve_2& xc1, - const X_monotone_curve_2& xc2, + const X_monotone_curve_2& xc2, Arr_curve_end ce) const { ++m_counter; return m_object(xc1, xc2, ce); } }; @@ -655,10 +641,11 @@ public: /*! Construct */ Parameter_space_in_y_2(const Base* base, unsigned int& counter1, unsigned int& counter2, unsigned int& counter3) : - m_object(base->parameter_space_in_y_2_object()), + m_object(base->parameter_space_in_y_2_object()), m_counter1(counter1), m_counter2(counter2), - m_counter3(counter3) {} + m_counter3(counter3) + {} /*! Operate */ Arr_parameter_space operator()(const X_monotone_curve_2& xc, @@ -672,7 +659,6 @@ public: /*! Operate */ Arr_parameter_space operator()(const X_monotone_curve_2& xc) const { ++m_counter3; return m_object(xc); } - }; /*! A functor that determines whether a point or a curve lies on an @@ -686,11 +672,12 @@ public: public: /*! Construct */ - Is_on_y_identification_2(const Base* base, + Is_on_y_identification_2(const Base* base, unsigned int& counter1, unsigned int& counter2) : - m_object(base->is_on_y_identificiation_2_object()), + m_object(base->is_on_y_identificiation_2_object()), m_counter1(counter1), - m_counter2(counter2) {} + m_counter2(counter2) + {} /*! Operate */ Arr_parameter_space operator()(const Point_2& p) const @@ -700,61 +687,6 @@ public: /*! Operate */ Arr_parameter_space operator()(const X_monotone_curve_2& xc) const { ++m_counter2; return m_object(xc); } - - }; - - /*! A functor that compares the x-limits of curve ends on the - * boundary of the parameter space. - */ - class Compare_x_at_limit_2 { - private: - typename Base::Compare_x_at_limit_2 m_object; - unsigned int& m_counter1; - unsigned int& m_counter2; - - public: - /*! Construct */ - Compare_x_at_limit_2(const Base* base, - unsigned int& counter1, unsigned int& counter2) : - m_object(base->compare_x_at_limit_2_object()), - m_counter1(counter1), - m_counter2(counter2) {} - - /*! Operate */ - Comparison_result operator()(const Point_2& p, - const X_monotone_curve_2& xc, - Arr_curve_end ce) const - { ++m_counter1; return m_object(p, xc, ce); } - - /*! Operate */ - Comparison_result operator()(const X_monotone_curve_2& xc1, - Arr_curve_end ce1, - const X_monotone_curve_2& xc2, - Arr_curve_end ce2) const - { ++m_counter2; return m_object(xc1, ce1, xc2, ce2); } - }; - - - /*! A functor that compares the x-coordinates of curve ends near the - * boundary of the parameter space. - */ - class Compare_x_near_limit_2 { - private: - typename Base::Compare_x_near_limit_2 m_object; - unsigned int& m_counter; - - public: - /*! Construct */ - Compare_x_near_limit_2(const Base* base, unsigned int& counter) : - m_object(base->compare_x_near_limit_2_object()), - m_counter(counter) {} - - - /*! Operate */ - Comparison_result operator()(const X_monotone_curve_2& xc1, - const X_monotone_curve_2& xc2, - Arr_curve_end ce) const - { ++m_counter; return m_object(xc1, xc2, ce); } }; /*! A functor that compares the x-coordinate of two given points @@ -793,7 +725,6 @@ public: const X_monotone_curve_2& xcv2, Arr_curve_end ce2) const { ++m_counter3; return m_object(xcv1, ce1, xcv2, ce2); } - }; /*! A functor that compares the x-coordinates of curve ends near the @@ -803,14 +734,13 @@ public: private: typename Base::Compare_x_near_boundary_2 m_object; unsigned int& m_counter; - + public: /*! Construct */ - Compare_x_near_boundary_2(const Base* base, - unsigned int& counter) : - m_object(base->compare_x_near_boundary_2_object()), - m_counter(counter) {} - + Compare_x_near_boundary_2(const Base* base, unsigned int& counter) : + m_object(base->compare_x_near_boundary_2_object()), + m_counter(counter) + {} /*! Operate */ Comparison_result operator()(const X_monotone_curve_2& xc1, @@ -828,7 +758,7 @@ public: Compare_x_2 compare_x_2_object() const { return Compare_x_2(this, m_counters[COMPARE_X_OP]); } - + Compare_xy_2 compare_xy_2_object() const { return Compare_xy_2(this, m_counters[COMPARE_XY_OP]); } @@ -837,13 +767,13 @@ public: Construct_max_vertex_2 construct_max_vertex_2_object() const { return Construct_max_vertex_2(this, m_counters[CONSTRUCT_MAX_VERTEX_OP]); } - + Is_vertical_2 is_vertical_2_object() const { return Is_vertical_2(this, m_counters[IS_VERTICAL_OP]); } - + Compare_y_at_x_2 compare_y_at_x_2_object() const { return Compare_y_at_x_2(this, m_counters[COMPARE_Y_AT_X_OP]); } - + Equal_2 equal_2_object() const { return Equal_2(this, m_counters[EQUAL_POINTS_OP], @@ -855,7 +785,7 @@ public: Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const { return Compare_y_at_x_right_2(this, m_counters[COMPARE_Y_AT_X_RIGHT_OP]); } - + Make_x_monotone_2 make_x_monotone_2_object() const { return Make_x_monotone_2(this, m_counters[MAKE_X_MONOTONE_OP]); } @@ -880,16 +810,16 @@ public: // left-right Parameter_space_in_x_2 parameter_space_in_x_2_object() const { return Parameter_space_in_x_2( - this, + this, m_counters[PARAMETER_SPACE_IN_X_CURVE_END_OP], m_counters[PARAMETER_SPACE_IN_X_POINT_OP], m_counters[PARAMETER_SPACE_IN_X_CURVE_OP] - ); + ); } - + Is_on_x_identification_2 is_on_x_identification_2_object() const { - return Is_on_x_identification_2(this, + return Is_on_x_identification_2(this, m_counters[IS_ON_X_IDENTIFICATION_POINT_OP], m_counters[IS_ON_X_IDENTIFICATION_CURVE_OP]); } @@ -906,41 +836,30 @@ public: // bottom-top Parameter_space_in_y_2 parameter_space_in_y_2_object() const { return Parameter_space_in_y_2( - this, + this, m_counters[PARAMETER_SPACE_IN_Y_CURVE_END_OP], m_counters[PARAMETER_SPACE_IN_Y_POINT_OP], m_counters[PARAMETER_SPACE_IN_Y_CURVE_OP] - ); + ); } Is_on_y_identification_2 is_on_y_identification_2_object() const { return Is_on_y_identification_2( - this, + this, m_counters[IS_ON_Y_IDENTIFICATION_POINT_OP], m_counters[IS_ON_Y_IDENTIFICATION_CURVE_OP] - ); + ); } - Compare_x_at_limit_2 compare_x_at_limit_2_object() const - { - return - Compare_x_at_limit_2(this, - m_counters[COMPARE_X_AT_LIMIT_POINT_CURVE_END_OP], - m_counters[COMPARE_X_AT_LIMIT_CURVE_ENDS_OP]); - } - - Compare_x_near_limit_2 compare_x_near_limit_2_object() const - { return Compare_x_near_limit_2(this, m_counters[COMPARE_X_NEAR_LIMIT_OP]); } - Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const { return - Compare_x_on_boundary_2(this, + Compare_x_on_boundary_2(this, m_counters[COMPARE_X_ON_BOUNDARY_POINTS_OP], m_counters[COMPARE_X_ON_BOUNDARY_POINT_CURVE_END_OP], m_counters[COMPARE_X_ON_BOUNDARY_CURVE_ENDS_OP]); } - + Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const { return Compare_x_near_boundary_2(this, @@ -973,7 +892,7 @@ private: mutable unsigned int m_counters[NUMBER_OF_OPERATIONS]; }; -template +template inline Out_stream& operator<<(Out_stream& os, const Arr_counting_traits_2& traits) @@ -1043,12 +962,6 @@ Out_stream& operator<<(Out_stream& os, << traits.count_is_on_y_identification_point() << std::endl << "# of IS_ON_Y_IDENTIFICATION curve operation = " << traits.count_is_on_y_identification_curve() << std::endl - << "# of COMPARE_X_AT_LIMIT point/curve-end operation = " - << traits.count_compare_x_at_limit_point_curve_end() << std::endl - << "# of COMPARE_X_AT_LIMIT curve-ends operation = " - << traits.count_compare_x_at_limit_curve_ends() << std::endl - << "# of COMPARE_X_NEAR_LIMIT operation = " - << traits.count_compare_x_near_limit() << std::endl << "# of COMPARE_X_ON_BOUNDARY points operation = " << traits.count_compare_x_on_boundary_points() << std::endl << "# of COMPARE_X_ON_BOUNDARY point/curve-end operation = " diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h index 6587512b759..da4ab1fa984 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011,2014 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org). @@ -17,6 +17,7 @@ // SPDX-License-Identifier: GPL-3.0+ // // Author(s) : Efi Fogel +// Eric Berberich #ifndef CGAL_ARR_GEODESIC_ARC_ON_SPHERE_TRAITS_2_H #define CGAL_ARR_GEODESIC_ARC_ON_SPHERE_TRAITS_2_H @@ -41,14 +42,6 @@ namespace CGAL { -#define CGAL_X_MINUS_1_Y_0 0 -#define CGAL_X_MINUS_8_Y_6 1 -#define CGAL_X_MINUS_11_Y_7 2 - -#ifndef CGAL_IDENTIFICATION_XY -#define CGAL_IDENTIFICATION_XY CGAL_X_MINUS_1_Y_0 -#endif - template class Arr_x_monotone_geodesic_arc_on_sphere_3; template class Arr_geodesic_arc_on_sphere_3; template class Arr_extended_direction_3; @@ -57,14 +50,14 @@ template class Arr_extended_direction_3; * circles embedded on spheres. It is parameterized from a (linear) geometry * kernel, which it also derives from */ -template -class Arr_geodesic_arc_on_sphere_traits_2 : public T_Kernel { - friend class Arr_x_monotone_geodesic_arc_on_sphere_3; - friend class Arr_geodesic_arc_on_sphere_3; - friend class Arr_extended_direction_3; +template +class Arr_geodesic_arc_on_sphere_traits_2 : public Kernel_ { + friend class Arr_x_monotone_geodesic_arc_on_sphere_3; + friend class Arr_geodesic_arc_on_sphere_3; + friend class Arr_extended_direction_3; public: - typedef T_Kernel Kernel; + typedef Kernel_ Kernel; // Category tags: typedef Tag_true Has_left_category; @@ -76,8 +69,16 @@ public: typedef Arr_contracted_side_tag Top_side_category; typedef Arr_identified_side_tag Right_side_category; + typedef boost::integral_constant Zero_atan_y; + + // Traits objects + typedef Arr_extended_direction_3 Point_2; + typedef Arr_x_monotone_geodesic_arc_on_sphere_3 X_monotone_curve_2; + typedef Arr_geodesic_arc_on_sphere_3 Curve_2; + typedef unsigned int Multiplicity; + /*! Default constructor */ - Arr_geodesic_arc_on_sphere_traits_2(){} + Arr_geodesic_arc_on_sphere_traits_2() {} protected: typedef typename Kernel::FT FT; @@ -87,24 +88,6 @@ protected: typedef typename Kernel::Direction_2 Direction_2; typedef typename Kernel::Vector_2 Vector_2; - /*! Obtain the possitive (north) pole - * \return the possitive (north) pole - */ - inline static const Direction_3& pos_pole() - { - static const Direction_3 d(0, 0, 1); - return d; - } - - /*! Obtain the negative (south) pole - * \return the negative (south) pole - */ - inline static const Direction_3& neg_pole() - { - static const Direction_3 d(0, 0, -1); - return d; - } - /*! Obtain the intersection of the identification arc and the xy plane. * By default, it is the vector directed along the negative x axis * (x = -infinity). @@ -112,15 +95,7 @@ protected: */ inline static const Direction_2& identification_xy() { -#if (CGAL_IDENTIFICATION_XY == CGAL_X_MINUS_1_Y_0) - static const Direction_2 d(-1, 0); -#elif (CGAL_IDENTIFICATION_XY == CGAL_X_MINUS_8_Y_6) - static const Direction_2 d(-8, 6); -#elif (CGAL_IDENTIFICATION_XY == CGAL_X_MINUS_11_Y_7) - static const Direction_2 d(-11, 7); -#else -#error CGAL_IDENTIFICATION_XY is not defined -#endif + static const Direction_2 d(atan_x, atan_y); return d; } @@ -131,15 +106,7 @@ protected: */ inline static const Direction_3& identification_normal() { -#if (CGAL_IDENTIFICATION_XY == CGAL_X_MINUS_1_Y_0) - static const Direction_3 d(0, 1, 0); -#elif (CGAL_IDENTIFICATION_XY == CGAL_X_MINUS_8_Y_6) - static const Direction_3 d(6, 8, 0); -#elif (CGAL_IDENTIFICATION_XY == CGAL_X_MINUS_11_Y_7) - static const Direction_3 d(7, 11, 0); -#else -#error CGAL_IDENTIFICATION_XY is not defined -#endif + static const Direction_3 d(atan_y, -atan_x, 0); return d; } @@ -233,13 +200,26 @@ protected: * \param d2 the second direction. * \return the relative orientation of d1 and d2. */ - static inline Orientation orientation(const Direction_2& d1, - const Direction_2& d2) + inline Orientation orientation(const Direction_2& d1, const Direction_2& d2) + const { - Kernel kernel; + const Kernel& kernel(*this); return kernel.orientation_2_object()(d1.vector(), d2.vector()); } + /*! Constructs a plane that contains two directions. + * \param d1 the first direction. + * \param d2 the second direction. + */ + inline Direction_3 construct_normal_3(const Direction_3& d1, + const Direction_3& d2) const + { + const Kernel& kernel(*this); + Vector_3 v = kernel.construct_cross_product_vector_3_object()(d1.vector(), + d2.vector()); + return v.direction(); + } + /*! Determined whether a direction is contained in a plane given by its * normal * \param normal the direction of the 3D plane. @@ -299,10 +279,10 @@ public: inline Comparison_result compare_x(const Direction_2& d1, const Direction_2& d2) const { - const Kernel* kernel = this; - if (kernel->equal_2_object()(d1, d2)) return EQUAL; + const Kernel& kernel = *this; + if (kernel.equal_2_object()(d1, d2)) return EQUAL; const Direction_2& d = identification_xy(); - return (kernel->counterclockwise_in_between_2_object()(d, d1, d2)) ? + return (kernel.counterclockwise_in_between_2_object()(d, d1, d2)) ? LARGER : SMALLER; } @@ -343,31 +323,643 @@ public: return res; } -public: - // Traits objects - typedef Arr_extended_direction_3 Point_2; - typedef Arr_x_monotone_geodesic_arc_on_sphere_3 X_monotone_curve_2; - typedef Arr_geodesic_arc_on_sphere_3 Curve_2; - typedef unsigned int Multiplicity; + /*! Determine whether the given point is in the x-range of the + * spherical_arc. + * \param point the query point direction. + * \return true if point is in the x-range of the (closed) spherical_arc and + * false otherwise. + * \pre point does not coincide with one of the poles + */ + bool is_in_x_range(const X_monotone_curve_2& xcv, const Point_2& point) const + { + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + + CGAL_precondition(!point.is_min_boundary()); + CGAL_precondition(!point.is_max_boundary()); + + Direction_2 p = project_xy(point); + if (xcv.is_vertical()) { + const Direction_3& normal = xcv.normal(); + Direction_2 q = (xcv.is_directed_right()) ? + Direction_2(-(normal.dy()), normal.dx()) : + Direction_2(normal.dy(), -(normal.dx())); + const Kernel& kernel = *this; + return kernel.equal_2_object()(p, q); + } + + // The curve is not vertical: + Direction_2 r = project_xy(xcv.right()); + const Kernel& kernel = *this; + if (kernel.equal_2_object()(p, r)) return true; + Direction_2 l = Traits::project_xy(xcv.left()); + if (kernel.equal_2_object()(p, l)) return true; + return kernel.counterclockwise_in_between_2_object()(p, l, r); + } + + /*! Compute the intersection of a curve and the identification curve. + * \param[in] cv the curve + */ + void intersection_with_identification(const X_monotone_curve_2& xcv, + Direction_3& dp, + boost::true_type) const + { + const Direction_3& normal = xcv.normal(); + dp = (CGAL::sign(normal.dz()) == POSITIVE) ? + Direction_3(-(normal.dz()), 0, normal.dx()) : + Direction_3(normal.dz(), 0, -(normal.dx())); + } + + /*! Compute the intersection of a curve and the identification curve. + * \param[in] cv the curve + */ + void intersection_with_identification(const X_monotone_curve_2& xcv, + Direction_3& dp, + boost::false_type) const + { + const Direction_3& normal = xcv.normal(); + FT z((atan_x * normal.dx() + atan_y * normal.dy()) / + -(normal.dz())); + dp = Direction_3(atan_x, atan_y, z); + } + + /*! Compute the intersection of a curve and the identification curve. + * \param[in] cv the curve + */ + bool overlap_with_identification(const X_monotone_curve_2& xcv, + boost::true_type) const + { + const Direction_3& normal = xcv.normal(); + return ((x_sign(normal) == ZERO) && + (((y_sign(normal) == NEGATIVE) && !xcv.is_directed_right()) || + ((y_sign(normal) == POSITIVE) && xcv.is_directed_right()))); + } + + /*! Compute the intersection of a curve and the identification curve. + * \param[in] cv the curve + */ + bool overlap_with_identification(const X_monotone_curve_2& xcv, + boost::false_type) const + { + const Direction_3& normal = xcv.normal(); + const Direction_3& iden_normal = identification_normal(); + const Direction_2 iden_normal_xy = project_xy(iden_normal); + Direction_2 normal_xy = project_xy(normal); + Kernel kernel; + if (xcv.is_directed_right()) { + return kernel.equal_2_object()(normal_xy, iden_normal_xy); + } + Direction_2 opposite_normal_xy = + kernel.construct_opposite_direction_2_object()(normal_xy); + return kernel.equal_2_object()(opposite_normal_xy, iden_normal_xy); + } public: /// \name Basic functor definitions //@{ - /*! A functor that compares the x-coordinates of two directional points */ - class Compare_x_2 { + /*! A functor that constructs a point on the sphere. */ + class Construct_point_2 { protected: - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits* m_traits; + const Traits& m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Compare_x_2(const Traits* traits) : m_traits(traits) {} + Construct_point_2(const Traits& traits) : m_traits(traits) {} - friend class Arr_geodesic_arc_on_sphere_traits_2; + friend class Arr_geodesic_arc_on_sphere_traits_2; + + public: + /*! Construct a point on the sphere from three coordinates, which define + * a (not necessarily normalized) direction. + * \param[in] x the x coordinate + * \param[in] y the y coordinate + * \param[in] z the z coordinate + */ + Point_2 operator()(const FT& x, const FT& y, const FT& z) + { + Point_2 p; + Direction_3& d(p); + d = Direction_3(x, y, z); + init(p, boost::integral_constant()); + return p; + } + + /*! Construct a point on the sphere from a (not necessarily normalized) + * direction. + * \param other the other direction + */ + Point_2 operator()(const Direction_3& other) + { + Point_2 p; + Direction_3& d(p); + d = Direction_3(other); + init(p, boost::integral_constant()); + return p; + } + + /*! Initialize a point on the sphere, + * \param[in] p the point to initialize. + */ + void init(Point_2& p, boost::true_type) const + { + const Direction_3& dir = p; + if (y_sign(dir) != ZERO) { + p.set_location(Point_2::NO_BOUNDARY_LOC); + return; + } + CGAL::Sign signx = x_sign(dir); + typename Point_2::Location_type location = + (signx == POSITIVE) ? Point_2::NO_BOUNDARY_LOC : + ((signx == NEGATIVE) ? Point_2::MID_BOUNDARY_LOC : + ((z_sign(dir) == NEGATIVE) ? + Point_2::MIN_BOUNDARY_LOC : Point_2::MAX_BOUNDARY_LOC)); + p.set_location(location); + } + + /*! Initialize a point on the sphere, + * \param[in] p the point to initialize. + */ + void init(Point_2& p, boost::false_type) const + { + const Direction_3& dir = p; + if ((x_sign(dir) == ZERO) && (y_sign(dir) == ZERO)) { + typename Point_2::Location_type location = (z_sign(dir) == NEGATIVE) ? + Point_2::MIN_BOUNDARY_LOC : Point_2::MAX_BOUNDARY_LOC; + p.set_location(location); + return; + } + + Direction_2 dir_xy = Traits::project_xy(dir); + const Kernel& kernel = m_traits; + typename Kernel::Equal_2 equal_2 = kernel.equal_2_object(); + const Direction_2& xy = Traits::identification_xy(); + typename Point_2::Location_type location = equal_2(dir_xy, xy) ? + Point_2::MID_BOUNDARY_LOC : Point_2::NO_BOUNDARY_LOC; + p.set_location(location); + } + }; + + /*! Obtain an x-monotone geodesic arc construction functor. + */ + Construct_point_2 construct_point_2_object() const + { return Construct_point_2(*this); } + + /*! A functor that constructs an x-monotone geodesic arc on the sphere. */ + class Construct_x_monotone_curve_2 { + protected: + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits& m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Construct_x_monotone_curve_2(const Traits& traits) : m_traits(traits) {} + + friend class Arr_geodesic_arc_on_sphere_traits_2; + + public: + /*! Construct the minor arc from two endpoint directions. The minor arc + * is the one with the smaller angle among the two geodesic arcs with + * the given endpoints. + * 1. Find out whether the arc is x-monotone. + * 2. If it is x-monotone, + * 2.1 Find out whether it is vertical, and + * 2.2 whether the target is larger than the source (directed right). + * The arc is vertical, iff + * 1. one of its endpoint direction pierces a pole, or + * 2. the projections onto the xy-plane coincide. + * \param[in] source the source point. + * \param[in] target the target point. + * \pre the source and target must not coincide. + * \pre the source and target cannot be antipodal. + */ + X_monotone_curve_2 operator()(const Point_2& source, const Point_2& target) + const + { + X_monotone_curve_2 xcv; + + xcv.set_source(source); + xcv.set_target(target); + xcv.set_is_full(false); + xcv.set_is_degenerate(false); + xcv.set_is_empty(false); + + CGAL_precondition_code(const Kernel& kernel = m_traits); + CGAL_precondition(!kernel.equal_3_object() + (kernel.construct_opposite_direction_3_object()(source), + (const typename Kernel::Direction_3&)(target))); + Direction_3 normal = m_traits.construct_normal_3(source, target); + xcv.set_normal(normal); + init(xcv); + return xcv; + } + + /*! Construct a full spherical_arc from a plane + * \param plane the containing plane. + * \pre the plane is not vertical + */ + X_monotone_curve_2 operator()(const Direction_3& normal) const + { + X_monotone_curve_2 xcv; + + xcv.set_normal(normal); + xcv.set_is_vertical(false); + xcv.set_is_directed_right(z_sign(normal) == POSITIVE); + xcv.set_is_full(true); + xcv.set_is_degenerate(false); + xcv.set_is_empty(false); + + CGAL_precondition(z_sign(normal) != ZERO); + + Direction_3 d; + m_traits.intersection_with_identification(xcv, d, Zero_atan_y()); + Point_2 p(d, Point_2::MID_BOUNDARY_LOC); + xcv.set_source(p); + xcv.set_target(p); + } + + /*! Construct a spherical_arc from two endpoints directions contained + * in a plane. + * \param[in] plane the containing plane. + * \param[in] source the source-point direction. + * \param[in] target the target-point direction. + * \pre Both endpoint lie on the given plane. + * \pre Both endpoint lie on the given plane. + */ + X_monotone_curve_2 operator()(const Point_2& source, const Point_2& target, + const Direction_3& normal) const + { return X_monotone_curve_2(source, target, normal); } + + private: + /*! Initialize a spherical_arc given that the two endpoint directions + * have been set. It is assumed that the arc is the one with the smaller + * angle among the two. + * 1. Find out whether the arc is x-monotone. + * 2. If it is x-monotone, + * 2.1 Find out whether it is vertical, and + * 2.2 whether the target is larger than the source (directed right). + * The arc is vertical, iff + * 1. one of its endpoint direction pierces a pole, or + * 2. the projections onto the xy-plane coincide. + * \param source the source point. + * \param target the target point. + * \pre the source and target cannot be equal. + */ + void init(X_monotone_curve_2& xcv) const + { + const Point_2& source = xcv.source(); + const Point_2& target = xcv.target(); + + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + + const Kernel& kernel(m_traits); + CGAL_precondition(!kernel.equal_3_object()(Direction_3(source), + Direction_3(target))); + + // Check whether any one of the endpoint coincide with a pole: + if (source.is_max_boundary()) { + xcv.set_is_vertical(true); + xcv.set_is_directed_right(false); + return; + } + if (source.is_min_boundary()) { + xcv.set_is_vertical(true); + xcv.set_is_directed_right(true); + return; + } + if (target.is_max_boundary()) { + xcv.set_is_vertical(true); + xcv.set_is_directed_right(true); + return; + } + if (target.is_min_boundary()) { + xcv.set_is_vertical(true); + xcv.set_is_directed_right(false); + return; + } + + // None of the enpoints coincide with a pole: + Direction_2 s = Traits::project_xy(source); + Direction_2 t = Traits::project_xy(target); + + Orientation orient = m_traits.orientation(s, t); + if (orient == COLLINEAR) { + xcv.set_is_vertical(true); + const Direction_2& nx = Traits::neg_x_2(); + if (m_traits.orientation(nx, s) == COLLINEAR) { + // Project onto xz plane: + s = Traits::project_xz(source); + t = Traits::project_xz(target); + const Direction_2& ny = Traits::neg_y_2(); + Orientation orient1 = m_traits.orientation(ny, s); + CGAL_assertion_code(Orientation orient2 = m_traits.orientation(ny, t)); + CGAL_assertion(orient1 == orient2); + orient = m_traits.orientation(s, t); + CGAL_assertion(orient != COLLINEAR); + if (orient1 == LEFT_TURN) { + xcv.set_is_directed_right(orient == LEFT_TURN); + return; + } + xcv.set_is_directed_right(orient == RIGHT_TURN); + return; + } + // Project onto yz plane: + s = Traits::project_yz(source); + t = Traits::project_yz(target); + const Direction_2& ny = Traits::neg_y_2(); + Orientation orient1 = m_traits.orientation(ny, s); + CGAL_assertion_code(Orientation orient2 = m_traits.orientation(ny, t)); + CGAL_assertion(orient1 == orient2); + if (orient1 == LEFT_TURN) { + orient = m_traits.orientation(s, t); + CGAL_assertion(orient != COLLINEAR); + xcv.set_is_directed_right(orient == LEFT_TURN); + return; + } + orient = m_traits.orientation(s, t); + CGAL_assertion(orient != COLLINEAR); + xcv.set_is_directed_right(orient == RIGHT_TURN); + return; + } + + // The arc is not vertical! + xcv.set_is_vertical(false); + xcv.set_is_directed_right(orient == LEFT_TURN); + xcv.set_is_full(kernel.equal_3_object()(Direction_3(source), + Direction_3(target))); + } + }; + + /*! Obtain an x-monotone geodesic arc construction functor. + */ + Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object() const + { return Construct_x_monotone_curve_2(*this); } + + /*! A functor that constructs a geodesic arc on the sphere. */ + class Construct_curve_2 { + protected: + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits& m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Construct_curve_2(const Traits& traits) : m_traits(traits) {} + + friend class Arr_geodesic_arc_on_sphere_traits_2; + + public: + /*! Construct a spherical_arc from two endpoint directions. It is assumed + * that the arc is the one with the smaller angle among the two. + * 1. Find out whether the arc is x-monotone. + * 2. If it is x-monotone, + * 2.1 Find out whether it is vertical, and + * 2.2 whether the target is larger than the source (directed right). + * The arc is vertical, iff + * 1. one of its endpoint direction pierces a pole, or + * 2. the projections onto the xy-plane coincide. + * \param source the source point. + * \param target the target point. + * \pre the source and target cannot be equal. + * \pre the source and target cannot be the opoosite of each other. + */ + Curve_2 operator()(const Point_2& source, const Point_2& target) + { + Curve_2 cv; + cv.set_source(source); + cv.set_target(target); + Direction_3 normal = m_traits.construct_normal_3(source, target); + cv.set_normal(normal); + cv.set_is_full(false); + cv.set_is_degenerate(false); + cv.set_is_empty(false); + + if (source.is_max_boundary()) { + cv.set_is_vertical(true); + cv.set_is_directed_right(false); + cv.set_is_x_monotone(true); + return cv; + } + if (source.is_min_boundary()) { + cv.set_is_vertical(true); + cv.set_is_directed_right(true); + cv.set_is_x_monotone(true); + return cv; + } + if (target.is_max_boundary()) { + cv.set_is_vertical(true); + cv.set_is_directed_right(true); + cv.set_is_x_monotone(true); + return cv; + } + if (target.is_min_boundary()) { + cv.set_is_vertical(true); + cv.set_is_directed_right(false); + cv.set_is_x_monotone(true); + return cv; + } + + // None of the enpoints coincide with a pole: + if (z_sign(normal) == ZERO) { + // The arc is vertical + cv.set_is_vertical(true); + bool s_is_positive, t_is_positive, plane_is_positive; + CGAL::Sign xsign = x_sign(normal); + if (xsign == ZERO) { + s_is_positive = x_sign(source) == POSITIVE; + t_is_positive = x_sign(target) == POSITIVE; + plane_is_positive = y_sign(normal) == NEGATIVE; + } + else { + s_is_positive = y_sign(source) == POSITIVE; + t_is_positive = y_sign(target) == POSITIVE; + plane_is_positive = xsign == POSITIVE; + } + cv.set_is_x_monotone(s_is_positive == t_is_positive); + bool ccw = ((plane_is_positive && s_is_positive) || + (!plane_is_positive && !s_is_positive)); + cv.set_is_directed_right(ccw); + return cv; + } + + // The arc is not vertical! + cv.set_is_vertical(false); + Direction_2 s = Traits::project_xy(source); + Direction_2 t = Traits::project_xy(target); + Orientation orient = m_traits.orientation(s, t); + + const Kernel& kernel = m_traits; + typename Kernel::Counterclockwise_in_between_2 cc_in_between = + kernel.counterclockwise_in_between_2_object(); + + const Direction_2& d = Traits::identification_xy(); + if (orient == LEFT_TURN) { + cv.set_is_directed_right(true); + cv.set_is_x_monotone(!cc_in_between(d, s, t)); + return cv; + } + + // (orient == RIGHT_TURN) + cv.set_is_directed_right(false); + cv.set_is_x_monotone(!cc_in_between(d, t, s)); + return cv; + } + + /*! Construct a spherical_arc from two endpoint directions contained + * in a plane. + * \param[in] source the source-point direction. + * \param[in] target the target-point direction. + * \param[in] normal the normal to the plane containing the arc + * \pre plane contain the origin + * \pre Both endpoints lie on the given plane. + */ + Curve_2 operator()(const Point_2& source, const Point_2& target, + const Direction_3& normal) + { + Curve_2 cv; + + cv.set_source(source); + cv.set_target(target); + cv.set_normal(normal); + cv.set_is_degenerate(false); + cv.set_is_empty(false); + + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + + CGAL_precondition(m_traits.has_on(normal, source)); + CGAL_precondition(m_traits.has_on(normal, target)); + + const Kernel& kernel = m_traits; + + if (z_sign(normal) == ZERO) { + cv.set_is_vertical(true); + + // Check whether both endpoint coincide with the poles: + if (source.is_min_boundary() && target.is_max_boundary()) { + // Both endpoints coincide with the 2 poles respectively. + cv.set_is_directed_right(true); + cv.set_is_full(false); + cv.set_is_x_monotone(true); + return cv; + } + + if (source.is_max_boundary() && target.is_min_boundary()) { + // Both endpoints coincide with the 2 poles respectively. + cv.set_is_directed_right(false); + cv.set_is_full(false); + cv.set_is_x_monotone(true); + return cv; + } + + CGAL::Sign xsign = x_sign(normal); + bool xz_plane = xsign == ZERO; + bool s_is_positive, t_is_positive, plane_is_positive; + if (xz_plane) { + s_is_positive = x_sign(source) == POSITIVE; + t_is_positive = x_sign(target) == POSITIVE; + plane_is_positive = y_sign(normal) == NEGATIVE; + } + else { + s_is_positive = y_sign(source) == POSITIVE; + t_is_positive = y_sign(target) == POSITIVE; + plane_is_positive = xsign == POSITIVE; + } + + // Process degenerate cases: + if (source.is_min_boundary()) { + cv.set_is_directed_right(true); + cv.set_is_x_monotone((plane_is_positive && t_is_positive) || + (!plane_is_positive && !t_is_positive)); + return cv; + } + if (source.is_max_boundary()) { + cv.set_is_directed_right(false); + cv.set_is_x_monotone((plane_is_positive && !t_is_positive) || + (!plane_is_positive && t_is_positive)); + return cv; + } + if (target.is_min_boundary()) { + cv.set_is_directed_right(false); + cv.set_is_x_monotone((plane_is_positive && !s_is_positive) || + (!plane_is_positive && s_is_positive)); + return cv; + } + if (target.is_max_boundary()) { + cv.set_is_directed_right(true); + cv.set_is_x_monotone((plane_is_positive && s_is_positive) || + (!plane_is_positive && !s_is_positive)); + return cv; + } + if (s_is_positive != t_is_positive) { + cv.set_is_x_monotone(false); + return cv; + } + + /* None of the endpoints coincide with a pole. + * The projections of both endpoints lie on the same hemi-circle. + * Thus, either the arc is x-monotone, or it includes both poles. + * This means that it is sufficient to check whether one pole lies + * on the arc in order to determine x-monotonicity + */ + + typename Traits::Project project = + (xz_plane) ? Traits::project_xz : Traits::project_yz; + Direction_2 s = project(source); + Direction_2 t = project(target); + const Direction_2& ny = Traits::neg_y_2(); + typename Kernel::Counterclockwise_in_between_2 ccib = + kernel.counterclockwise_in_between_2_object(); + cv.set_is_x_monotone((plane_is_positive && !ccib(ny, s, t)) || + (!plane_is_positive && !ccib(ny, t, s))); + + bool ccw = ((plane_is_positive && s_is_positive) || + (!plane_is_positive && !s_is_positive)); + cv.set_is_directed_right(ccw); + return cv; + } + + // The arc is not vertical! + cv.set_is_vertical(false); + cv.set_is_directed_right(z_sign(normal) == POSITIVE); + const Direction_2& d = Traits::identification_xy(); + Direction_2 s = Traits::project_xy(source); + Direction_2 t = Traits::project_xy(target); + typename Kernel::Counterclockwise_in_between_2 ccib = + kernel.counterclockwise_in_between_2_object(); + bool plane_is_positive = (z_sign(normal) == POSITIVE); + cv.set_is_x_monotone((plane_is_positive && !ccib(d, s, t)) || + (!plane_is_positive && !ccib(d, t, s))); + return cv; + } + }; + + /*! Obtain a geodesic arc construction functor. + */ + Construct_curve_2 construct_curve_2_object() const + { return Construct_curve_2(*this); } + + /*! A functor that compares the x-coordinates of two directional points */ + class Compare_x_2 { + protected: + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits& m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Compare_x_2(const Traits& traits) : m_traits(traits) {} + + friend class Arr_geodesic_arc_on_sphere_traits_2; public: /*! Compare the x-coordinates of two directional points. @@ -378,35 +970,55 @@ public: * LARGER - x(p1) > x(p2). * \pre p1 does not lie on the boundary. * \pre p2 does not lie on the boundary. - */ + */ Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { CGAL_precondition(p1.is_no_boundary()); CGAL_precondition(p2.is_no_boundary()); - return m_traits->compare_x(p1, p2); + return m_traits.compare_x(p1, p2); } }; +protected: + /*! Obtain the possitive (north) pole + * \return the possitive (north) pole + */ + inline static const Point_2& pos_pole() + { + static const Point_2 p(Direction_3(0, 0, 1), Point_2::MIN_BOUNDARY_LOC); + return p; + } + + /*! Obtain the negative (south) pole + * \return the negative (south) pole + */ + inline static const Point_2& neg_pole() + { + static const Point_2 p(Direction_3(0, 0, -1), Point_2::MIN_BOUNDARY_LOC); + return p; + } + +public: /*! Obtain a Compare_x_2 function object */ - Compare_x_2 compare_x_2_object() const { return Compare_x_2(this); } + Compare_x_2 compare_x_2_object() const { return Compare_x_2(*this); } /*! A functor that compares two directional points lexigoraphically: * by x, then by y. */ class Compare_xy_2 { protected: - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits* m_traits; + const Traits& m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Compare_xy_2(const Traits* traits) : m_traits(traits) {} + Compare_xy_2(const Traits& traits) : m_traits(traits) {} - friend class Arr_geodesic_arc_on_sphere_traits_2; + friend class Arr_geodesic_arc_on_sphere_traits_2; public: /*! Compare two directional points lexigoraphically: by x, then by y. @@ -425,12 +1037,12 @@ public: CGAL_precondition(p1.is_no_boundary()); CGAL_precondition(p2.is_no_boundary()); - return m_traits->compare_xy(p1, p2); + return m_traits.compare_xy(p1, p2); } }; /*! Obtain a Compare_xy_2 function object */ - Compare_xy_2 compare_xy_2_object() const { return Compare_xy_2(this); } + Compare_xy_2 compare_xy_2_object() const { return Compare_xy_2(*this); } /*! A functor that obtain the left endpoint of an x-monotone arc */ class Construct_min_vertex_2 { @@ -485,17 +1097,17 @@ public: */ class Compare_y_at_x_2 { protected: - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits* m_traits; + const Traits& m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Compare_y_at_x_2(const Traits* traits) : m_traits(traits) {} + Compare_y_at_x_2(const Traits& traits) : m_traits(traits) {} - friend class Arr_geodesic_arc_on_sphere_traits_2; + friend class Arr_geodesic_arc_on_sphere_traits_2; public: /*! Return the location of the given point with respect to the input arc. @@ -511,7 +1123,7 @@ public: const X_monotone_curve_2& xc) const { CGAL_precondition(!p.is_min_boundary() && !p.is_max_boundary()); - CGAL_precondition(xc.is_in_x_range(p)); + CGAL_precondition(m_traits.is_in_x_range(xc, p)); if (xc.is_vertical()) { // Compare the point with the left endpoint. If smaller, return SMALLER. @@ -519,16 +1131,16 @@ public: // Otherwise, compare with the right endpoint. If larger, return LARGER. // Otherwise, return EQUAL: if (!xc.left().is_min_boundary()) { - Comparison_result cr = m_traits->compare_y(p, xc.left()); + Comparison_result cr = m_traits.compare_y(p, xc.left()); if (cr != LARGER) return cr; } if (xc.right().is_max_boundary()) return EQUAL; - Comparison_result cr = m_traits->compare_y(p, xc.right()); + Comparison_result cr = m_traits.compare_y(p, xc.right()); return (cr == LARGER) ? LARGER : EQUAL; } // Compare the point to the underlying plane of xc: - Oriented_side os = m_traits->oriented_side(xc.normal(), p); + Oriented_side os = m_traits.oriented_side(xc.normal(), p); return (os == ON_ORIENTED_BOUNDARY) ? EQUAL : (xc.is_directed_right()) ? ((os == ON_NEGATIVE_SIDE) ? SMALLER : LARGER) : @@ -538,24 +1150,24 @@ public: /*! Obtain a Compare_y_at_x_2 function object */ Compare_y_at_x_2 compare_y_at_x_2_object() const - { return Compare_y_at_x_2(this); } + { return Compare_y_at_x_2(*this); } /*! A functor that compares the y-coordinates of two x-monotone arcs * immediately to the left of their intersection directional point. */ class Compare_y_at_x_left_2 { protected: - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits* m_traits; + const Traits& m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Compare_y_at_x_left_2(const Traits* traits) : m_traits(traits) {} + Compare_y_at_x_left_2(const Traits& traits) : m_traits(traits) {} - friend class Arr_geodesic_arc_on_sphere_traits_2; + friend class Arr_geodesic_arc_on_sphere_traits_2; public: /*! Compare the y value of two x-monotone curves immediately to the left @@ -591,7 +1203,7 @@ public: const Point_2& l2 = xc2.left(); if (!l1.is_no_boundary()) { // use l2 and xc1: - Oriented_side os = m_traits->oriented_side(xc1.normal(), l2); + Oriented_side os = m_traits.oriented_side(xc1.normal(), l2); return (os == ON_ORIENTED_BOUNDARY) ? EQUAL : (xc1.is_directed_right()) ? ((os == ON_NEGATIVE_SIDE) ? LARGER : SMALLER) : @@ -599,23 +1211,23 @@ public: } if (!l2.is_no_boundary()) { // use l1 and xc2: - Oriented_side os = m_traits->oriented_side(xc2.normal(), l1); + Oriented_side os = m_traits.oriented_side(xc2.normal(), l1); return (os == ON_ORIENTED_BOUNDARY) ? EQUAL : (xc2.is_directed_right()) ? ((os == ON_NEGATIVE_SIDE) ? SMALLER : LARGER) : ((os == ON_NEGATIVE_SIDE) ? LARGER : SMALLER); } - if (m_traits->compare_xy(l1, l2) == SMALLER) { + if (m_traits.compare_xy(l1, l2) == SMALLER) { // use l2 and xc1: - Oriented_side os = m_traits->oriented_side(xc1.normal(), l2); + Oriented_side os = m_traits.oriented_side(xc1.normal(), l2); return (os == ON_ORIENTED_BOUNDARY) ? EQUAL : (xc1.is_directed_right()) ? ((os == ON_NEGATIVE_SIDE) ? LARGER : SMALLER) : ((os == ON_NEGATIVE_SIDE) ? SMALLER : LARGER); } // use l1 and xc2: - Oriented_side os = m_traits->oriented_side(xc2.normal(), l1); + Oriented_side os = m_traits.oriented_side(xc2.normal(), l1); return (os == ON_ORIENTED_BOUNDARY) ? EQUAL : (xc2.is_directed_right()) ? ((os == ON_NEGATIVE_SIDE) ? SMALLER : LARGER) : @@ -625,24 +1237,24 @@ public: /*! Obtain a Compare_y_at_x_left_2 function object */ Compare_y_at_x_left_2 compare_y_at_x_left_2_object() const - { return Compare_y_at_x_left_2(this); } + { return Compare_y_at_x_left_2(*this); } /*! A functor that compares the y-coordinates of two x-monotone arcs * immediately to the right of their intersection directional point. */ class Compare_y_at_x_right_2 { protected: - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits* m_traits; + const Traits& m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Compare_y_at_x_right_2(const Traits* traits) : m_traits(traits) {} + Compare_y_at_x_right_2(const Traits& traits) : m_traits(traits) {} - friend class Arr_geodesic_arc_on_sphere_traits_2; + friend class Arr_geodesic_arc_on_sphere_traits_2; public: /*! Compare the y value of two x-monotone curves immediately to the right @@ -678,7 +1290,7 @@ public: const Point_2& r2 = xc2.right(); if (!r1.is_no_boundary()) { // use r2 and xc1: - Oriented_side os = m_traits->oriented_side(xc1.normal(), r2); + Oriented_side os = m_traits.oriented_side(xc1.normal(), r2); return (os == ON_ORIENTED_BOUNDARY) ? EQUAL : (xc1.is_directed_right()) ? ((os == ON_NEGATIVE_SIDE) ? LARGER : SMALLER) : @@ -686,16 +1298,16 @@ public: } if (!r2.is_no_boundary()) { // use r1 and xc2: - Oriented_side os = m_traits->oriented_side(xc2.normal(), r1); + Oriented_side os = m_traits.oriented_side(xc2.normal(), r1); return (os == ON_ORIENTED_BOUNDARY) ? EQUAL : (xc2.is_directed_right()) ? ((os == ON_NEGATIVE_SIDE) ? SMALLER : LARGER) : ((os == ON_NEGATIVE_SIDE) ? LARGER : SMALLER); } - Comparison_result res = m_traits->compare_xy(r1, r2); + Comparison_result res = m_traits.compare_xy(r1, r2); if (res == LARGER) { // use r2 and xc1: - Oriented_side os = m_traits->oriented_side(xc1.normal(), r2); + Oriented_side os = m_traits.oriented_side(xc1.normal(), r2); return (os == ON_ORIENTED_BOUNDARY) ? EQUAL : (xc1.is_directed_right()) ? ((os == ON_NEGATIVE_SIDE) ? LARGER : SMALLER) : @@ -703,7 +1315,7 @@ public: } if (res == SMALLER) { // use r1 and xc2: - Oriented_side os = m_traits->oriented_side(xc2.normal(), r1); + Oriented_side os = m_traits.oriented_side(xc2.normal(), r1); return (os == ON_ORIENTED_BOUNDARY) ? EQUAL : (xc2.is_directed_right()) ? ((os == ON_NEGATIVE_SIDE) ? SMALLER : LARGER) : @@ -711,11 +1323,13 @@ public: } // res == equal // if p and r1 are antipodal, compare the plane normals - const Kernel* kernel = m_traits; + const Kernel& kernel = m_traits; typename Kernel::Construct_opposite_direction_3 opposite_3 = - kernel->construct_opposite_direction_3_object(); - Point_2 tmp1 = opposite_3(p); // pacify msvc 10 - if (!kernel->equal_3_object()(Direction_3(tmp1), Direction_3(r1))) + kernel.construct_opposite_direction_3_object(); + // VC 10 does not like the following: + // if (!kernel.equal_3_object()(opposite_3(p), r1)) return EQUAL; + Direction_3 tmp1 = opposite_3(p); // pacify msvc 10 + if (!kernel.equal_3_object()(tmp1, Direction_3(r1))) return EQUAL; Sign xsign = Traits::x_sign(p); @@ -727,36 +1341,36 @@ public: Direction_2 n1 = project(xc1.normal()); Direction_2 n2 = project(xc2.normal()); typename Kernel::Construct_opposite_direction_2 opposite_2 = - kernel->construct_opposite_direction_2_object(); + kernel.construct_opposite_direction_2_object(); if (!xc1.is_directed_right()) n1 = opposite_2(n1); if (!xc2.is_directed_right()) n2 = opposite_2(n2); - if (kernel->equal_2_object()(n1, n2)) return EQUAL; + if (kernel.equal_2_object()(n1, n2)) return EQUAL; const Direction_2 d(1, 0); - return (kernel->counterclockwise_in_between_2_object()(n1, d, n2)) ? + return (kernel.counterclockwise_in_between_2_object()(n1, d, n2)) ? SMALLER : LARGER; } }; /*! Obtain a Compare_y_at_x_right_2 function object */ Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const - { return Compare_y_at_x_right_2(this); } + { return Compare_y_at_x_right_2(*this); } /*! A functor that checks whether two directional points and two x-monotone * arcs are identical. */ class Equal_2 { protected: - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits* m_traits; + const Traits& m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Equal_2(const Traits* traits) : m_traits(traits) {} + Equal_2(const Traits& traits) : m_traits(traits) {} - friend class Arr_geodesic_arc_on_sphere_traits_2; + friend class Arr_geodesic_arc_on_sphere_traits_2; public: /*! Determines whether the two x-monotone curves are the same (have the @@ -768,12 +1382,12 @@ public: bool operator()(const X_monotone_curve_2& xc1, const X_monotone_curve_2& xc2) const { - const Kernel* kernel = m_traits; - typename Kernel::Equal_3 equal_3 = kernel->equal_3_object(); + const Kernel& kernel = m_traits; + typename Kernel::Equal_3 equal_3 = kernel.equal_3_object(); if (xc1.is_full() || xc2.is_full()) { if (!xc1.is_full() || !xc2.is_full()) return false; typename Kernel::Construct_opposite_direction_3 opposite_3 = - kernel->construct_opposite_direction_3_object(); + kernel.construct_opposite_direction_3_object(); return (equal_3(xc1.normal(), xc2.normal()) || equal_3(opposite_3(xc1.normal()), xc2.normal())); } @@ -794,13 +1408,13 @@ public: */ bool operator()(const Point_2& p1, const Point_2& p2) const { - const Kernel* kernel = m_traits; - return kernel->equal_3_object()(Direction_3(p1), Direction_3(p2)); + const Kernel& kernel = m_traits; + return kernel.equal_3_object()(Direction_3(p1), Direction_3(p2)); } }; /*! Obtain an Equal_2 function object */ - Equal_2 equal_2_object() const { return Equal_2(this); } + Equal_2 equal_2_object() const { return Equal_2(*this); } //@} /// \name Functor definitions to handle boundaries @@ -810,32 +1424,44 @@ public: * entity along the x-axis */ class Parameter_space_in_x_2 { + protected: + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits& m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Parameter_space_in_x_2(const Traits& traits) : m_traits(traits) {} + + friend class Arr_geodesic_arc_on_sphere_traits_2; + public: - /*! Obtains the parameter space at the end of an arc along the x-axis . - * Note that if the arc end coincides with a pole, then unless the arc - * coincides with the identification arc, the arc end is considered to - * be approaching the boundary, but not on the boundary. - * If the arc coincides with the identification arc, it is assumed to - * be smaller than any other object. + /*! Obtains the parameter space at the end of an arc along the x-axis. + * Only called for arcs whose interior lie in the interior of the + * parameter space, that is, the arc does not coincide with the + * identification. Thus, it returns ARR_LEFT_BOUNDARY or ARR_RIGHT_BOUNDARY + * for non-vertical arcs and ARR_INTERIOR for (vertical) arcs whose end + * might even reach one of the poles. * \param xcv the arc * \param ce the arc end indicator: * ARR_MIN_END - the minimal end of xc or * ARR_MAX_END - the maximal end of xc * \return the parameter space at the ce end of the arc xcv. * ARR_LEFT_BOUNDARY - the arc approaches the identification arc from - * the right at the arc left end. - * ARR_INTERIOR - the arc does not approache the identification arc. + * the right at the minimal arc end. + * ARR_INTERIOR - the arc does not approach the identification arc. * ARR_RIGHT_BOUNDARY - the arc approaches the identification arc from - * the left at the arc right end. - * \pre xcv does not coincide with the vertical identification arc. + * the left at the maximal arc end. + * \pre xcv does not coincide with the identification */ Arr_parameter_space operator()(const X_monotone_curve_2& xcv, Arr_curve_end ce) const { - if (xcv.is_vertical()) { - CGAL_precondition(!xcv.is_on_boundary()); - return ARR_INTERIOR; - } + CGAL_precondition(!m_traits.is_on_y_identification_2_object()(xcv)); + // vertical, but not on identification! + if (xcv.is_vertical()) return ARR_INTERIOR; return (ce == ARR_MIN_END) ? ((xcv.left().is_no_boundary()) ? ARR_INTERIOR : ARR_LEFT_BOUNDARY) : @@ -843,47 +1469,44 @@ public: } /*! Obtains the parameter space at a point along the x-axis. + * Every non-interior point is assumed to lie on the left-right + * identification. + * Points at the poles additionally lie on the bottom or top boundary. * \param p the point. * \return the parameter space at p. - * \pre p does not lie on the vertical identification curve. */ - Arr_parameter_space operator()(const Point_2 p) const + Arr_parameter_space operator()(const Point_2& p) const { - /*! \todo For now the precondition is not applied. Instead, and as - * a convention, if the point lies on the vertical identification - * curve it is assumed to be smaller than anything else. Thus, - * ARR_LEFT_BOUNDARY is returned. - */ - return (p.is_mid_boundary()) ? ARR_LEFT_BOUNDARY : ARR_INTERIOR; + CGAL_precondition(p.is_no_boundary()); + return ARR_INTERIOR; } }; /*! Obtain a Parameter_space_in_x_2 function object */ Parameter_space_in_x_2 parameter_space_in_x_2_object() const - { return Parameter_space_in_x_2(); } + { return Parameter_space_in_x_2(*this); } /*! A function object that obtains the parameter space of a geometric * entity along the y-axis */ class Parameter_space_in_y_2 { public: - /*! Obtains the parameter space at the end of an arc along the y-axis . - * Note that if the arc end coincides with a pole, then unless the arc - * coincides with the identification arc, the arc end is considered to - * be approaching the boundary, but not on the boundary. - * If the arc coincides with the identification arc, it is assumed to - * be smaller than any other object. + /*! Obtains the parameter space at the end of an arc along the y-axis. + * Only called for arcs whose interior lie in the interior of the + * parameter space, that is, the arc does not coincide with the + * identification. Thus, it returns ARR_BOTTOM_BOUNDARY or ARR_TOP_BOUNDARY + * for arcs ends that reach the poles (such arc are vertical) and + * ARR_INTERIOR for all other arc ends. * \param xcv the arc * \param ce the arc end indicator: * ARR_MIN_END - the minimal end of xc or * ARR_MAX_END - the maximal end of xc * \return the parameter space at the ce end of the arc xcv. * ARR_BOTTOM_BOUNDARY - the arc approaches the south pole at the arc - * left end. + * minimal end. * ARR_INTERIOR - the arc does not approache a contraction point. * ARR_TOP_BOUNDARY - the arc approaches the north pole at the arc - * right end. - * There are no horizontal identification arcs! + * maximal end. */ Arr_parameter_space operator()(const X_monotone_curve_2& xcv, Arr_curve_end ce) const @@ -893,13 +1516,14 @@ public: ((xcv.right().is_max_boundary()) ? ARR_TOP_BOUNDARY : ARR_INTERIOR); } - /*! Obtains the parameter space at a point along the y-axis. + /*! Obtains the parameter space of a point along the y-axis. + * That is, ARR_BOTTOM_BOUNDARY is returned if p coincides with the + * south pole and ARR_TOP_BOUNDARY if p coincides with the north pole. + * Otherwise ARR_INTERIOR is returned. * \param p the point. * \return the parameter space at p. - * \pre p does not lie on the horizontal identification curve. - * There are no horizontal identification arcs! */ - Arr_parameter_space operator()(const Point_2 p) const + Arr_parameter_space operator()(const Point_2& p) const { return (p.is_min_boundary()) ? ARR_BOTTOM_BOUNDARY : @@ -917,21 +1541,21 @@ public: */ class Compare_x_on_boundary_2 { protected: - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits* m_traits; + const Traits& m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Compare_x_on_boundary_2(const Traits* traits) : m_traits(traits) {} + Compare_x_on_boundary_2(const Traits& traits) : m_traits(traits) {} - friend class Arr_geodesic_arc_on_sphere_traits_2; + friend class Arr_geodesic_arc_on_sphere_traits_2; public: - /*! Compare the x-limit of a direction with the x-coordinate of an - * arc end on the boundary. + /*! Compare the x-coordinate of a direction with the x-coordinate of an + * arc end projected onto the boundary. * \param point the point direction. * \param xcv the arc, the endpoint of which is compared. * \param ce the arc-end indicator - @@ -955,7 +1579,7 @@ public: CGAL_precondition(!p2.is_no_boundary()); CGAL_precondition(xcv.is_vertical()); - CGAL_precondition(!xcv.is_on_boundary()); + CGAL_precondition(!m_traits.is_on_y_identification_2_object()(xcv)); // xcv is vertical, but does not coincide with the discontinuity arc. // Obtain the direction contained in the underlying plane, which is @@ -965,11 +1589,11 @@ public: Direction_2(-(normal.dy()), normal.dx()) : Direction_2(normal.dy(), -(normal.dx())); Direction_2 p = Traits::project_xy(point); - return m_traits->compare_x(p, q); + return m_traits.compare_x(p, q); } - /*! Compare the x-coordinates of 2 arc ends near the boundary of the - * parameter space. + /*! Compare the x-coordinates of two arc ends projected onto the boundary + * of the parameter space. * \param xcv1 the first arc. * \param ce1 the first arc end indicator - * ARR_MIN_END - the minimal end of xcv1 or @@ -978,16 +1602,17 @@ public: * \param ce2 the second arc end indicator - * ARR_MIN_END - the minimal end of xcv2 or * ARR_MAX_END - the maximal end of xcv2. - * \return the second comparison result: + * The respective closed endpoint may coincide with a pole. + * \return the comparison result: * SMALLER - x(xcv1, ce1) < x(xcv2, ce2); * EQUAL - x(xcv1, ce1) = x(xcv2, ce2); * LARGER - x(xcv1, ce1) > x(xcv2, ce2). + * \pre xcv1 does not coincide with the vertical identification curve. + * \pre xcv2 does not coincide with the vertical identification curve. * \pre the ce1 end of the arc xcv1 lies on a pole (implying ce1 is * vertical). * \pre the ce2 end of the arc xcv2 lies on a pole (implying ce2 is * vertical). - * \pre xcv1 does not coincide with the vertical identification curve. - * \pre xcv2 does not coincide with the vertical identification curve. */ Comparison_result operator()(const X_monotone_curve_2& xcv1, Arr_curve_end CGAL_precondition_code(ce1), @@ -1004,10 +1629,10 @@ public: CGAL_precondition(xcv1.is_vertical()); CGAL_precondition(xcv2.is_vertical()); - CGAL_precondition(!xcv1.is_on_boundary()); - CGAL_precondition(!xcv2.is_on_boundary()); + CGAL_precondition(!m_traits.is_on_y_identification_2_object()(xcv1)); + CGAL_precondition(!m_traits.is_on_y_identification_2_object()(xcv2)); - // Non of the arcs coincide with the discontinuity arc: + // Non of the arcs coincide with the identification arc: // Obtain the directions contained in the underlying planes, which are // also on the xy-plane: Direction_3 normal1 = xcv1.normal(); @@ -1018,43 +1643,41 @@ public: Direction_2 q = (xcv2.is_directed_right()) ? Direction_2(-(normal2.dy()), normal2.dx()) : Direction_2(normal2.dy(), -(normal2.dx())); - return m_traits->compare_x(p, q); + return m_traits.compare_x(p, q); } - /*! Compare the x-coordinate of two given points that lie on the - * horizontal identification arc. - * \param p1 the first point. - * \param p2 the second point. - * There is no horizontal identification arc! + /*! \todo This operator should be removed! The general code should never + * call this operator for this traits! + * Once we do a better dispatching of the functors (LR-ident + TB-contraction), + * an implementation of this signature becomes obsolete. */ - Comparison_result operator()(const Point_2&, const Point_2&) const + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { - CGAL_error_msg("There is no horizontal identification arc!"); - return SMALLER; + CGAL_error(); return EQUAL; } }; - /*! Obtain a Compare_x_on_boundary_2 function object */ + /*! Obtain a Compare_x_on_boundary_2 function object. + */ Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const - { return Compare_x_on_boundary_2(this); } - + { return Compare_x_on_boundary_2(*this); } /*! A functor that compares the x-coordinates of arc ends near the * boundary of the parameter space. */ class Compare_x_near_boundary_2 { protected: - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits* m_traits; + const Traits& m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Compare_x_near_boundary_2(const Traits* traits) : m_traits(traits) {} + Compare_x_near_boundary_2(const Traits& traits) : m_traits(traits) {} - friend class Arr_geodesic_arc_on_sphere_traits_2; + friend class Arr_geodesic_arc_on_sphere_traits_2; public: @@ -1077,9 +1700,9 @@ public: * \pre xcv2 does not coincide with the vertical identification curve. */ Comparison_result operator()(const X_monotone_curve_2& - CGAL_precondition_code(xcv1), + CGAL_precondition_code(xcv1), const X_monotone_curve_2& - CGAL_precondition_code(xcv2), + CGAL_precondition_code(xcv2), Arr_curve_end CGAL_precondition_code(ce)) const { CGAL_precondition_code @@ -1091,8 +1714,8 @@ public: CGAL_precondition(xcv1.is_vertical()); CGAL_precondition(xcv2.is_vertical()); - CGAL_precondition(!xcv1.is_on_boundary()); - CGAL_precondition(!xcv2.is_on_boundary()); + CGAL_precondition(!m_traits.is_on_y_identification_2_object()(xcv1)); + CGAL_precondition(!m_traits.is_on_y_identification_2_object()(xcv2)); return EQUAL; } @@ -1100,7 +1723,7 @@ public: /*! Obtain a Compare_x_near_boundary_2 function object */ Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const - { return Compare_x_near_boundary_2(this); } + { return Compare_x_near_boundary_2(*this); } /*! A functor that compares the y-coordinates of arc ends near the @@ -1108,17 +1731,17 @@ public: */ class Compare_y_near_boundary_2 { protected: - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits* m_traits; + const Traits& m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Compare_y_near_boundary_2(const Traits* traits) : m_traits(traits) {} + Compare_y_near_boundary_2(const Traits& traits) : m_traits(traits) {} - friend class Arr_geodesic_arc_on_sphere_traits_2; + friend class Arr_geodesic_arc_on_sphere_traits_2; public: /*! Compare the y-coordinates of 2 curves at their ends near the boundary @@ -1163,7 +1786,7 @@ public: if (l2.is_min_boundary()) return LARGER; // None of xcv1 and xcv2 endpoints coincide with a pole: - Comparison_result cr = m_traits->compare_y(l1, l2); + Comparison_result cr = m_traits.compare_y(l1, l2); if (cr != EQUAL) return cr; // If Both arcs are vertical, they overlap: @@ -1177,17 +1800,17 @@ public: CGAL_assertion(r1.is_no_boundary()); CGAL_assertion(r2.is_no_boundary()); - if (m_traits->compare_xy(r1, r2) == LARGER) { + if (m_traits.compare_xy(r1, r2) == LARGER) { // use r2 and xcv1: Oriented_side os = - m_traits->oriented_side(xcv1.normal(), r2); + m_traits.oriented_side(xcv1.normal(), r2); return (os == ON_ORIENTED_BOUNDARY) ? EQUAL : (xcv1.is_directed_right()) ? ((os == ON_NEGATIVE_SIDE) ? LARGER : SMALLER) : ((os == ON_NEGATIVE_SIDE) ? SMALLER : LARGER); } // use r1 and xcv2: - Oriented_side os = m_traits->oriented_side(xcv2.normal(), r1); + Oriented_side os = m_traits.oriented_side(xcv2.normal(), r1); return (os == ON_ORIENTED_BOUNDARY) ? EQUAL : (xcv2.is_directed_right()) ? ((os == ON_NEGATIVE_SIDE) ? SMALLER : LARGER) : @@ -1202,7 +1825,7 @@ public: // None of xcv1 and xcv2 endpoints coincide with a pole: Direction_2 r1_xy = Traits::project_xy(r1); - Comparison_result cr = m_traits->compare_y(r1, r2); + Comparison_result cr = m_traits.compare_y(r1, r2); if (cr != EQUAL) return cr; // If Both arcs are vertical, they overlap: @@ -1212,7 +1835,7 @@ public: // Compare to the left: Direction_2 p_r1 = Traits::project_xy(r1); - cr = m_traits->compare_y(r1, r2); + cr = m_traits.compare_y(r1, r2); if (cr != EQUAL) return cr; // Non of the arcs is verticel. Thus, non of the endpoints coincide with @@ -1221,16 +1844,16 @@ public: CGAL_assertion(l1.is_no_boundary()); CGAL_assertion(l2.is_no_boundary()); - if (m_traits->compare_xy(l1, l2) == SMALLER) { + if (m_traits.compare_xy(l1, l2) == SMALLER) { // use l2 and xcv1: - Oriented_side os = m_traits->oriented_side(xcv1.normal(), l2); + Oriented_side os = m_traits.oriented_side(xcv1.normal(), l2); return (os == ON_ORIENTED_BOUNDARY) ? EQUAL : (xcv1.is_directed_right()) ? ((os == ON_NEGATIVE_SIDE) ? LARGER : SMALLER) : ((os == ON_NEGATIVE_SIDE) ? SMALLER : LARGER); } // use l1 and xcv2: - Oriented_side os = m_traits->oriented_side(xcv2.normal(), l1); + Oriented_side os = m_traits.oriented_side(xcv2.normal(), l1); return (os == ON_ORIENTED_BOUNDARY) ? EQUAL : (xcv2.is_directed_right()) ? ((os == ON_NEGATIVE_SIDE) ? SMALLER : LARGER) : @@ -1240,68 +1863,32 @@ public: /*! Obtain a Compare_y_near_boundary_2 function object */ Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const - { return Compare_y_near_boundary_2(this); } - - /*! A functor that indicates whether a geometric object lies on the - * horizontal identification arc. In this setup there is no such entity. - */ - class Is_on_x_identification_2 { - protected: - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; - - public: - /*! Determine whether a point lies on the horizontal identification arc. - * \param p the point. - * \return a Boolean indicating whether p lies on the horizontal - * identification arc. - */ - bool operator()(const Point_2&) const - { - CGAL_error_msg("There is no horizontal identification arc!"); - return false; - } - - /*! Determine whether an arc coincides with the horizontal identification - * arc. - * \param xcv the arc. - * \return a Boolean indicating whether xcv coincides with the horizontal - * identification arc. - */ - bool operator()(const X_monotone_curve_2&) const - { - CGAL_error_msg("There is no horizontal identification arc!"); - return false; - } - }; - - /*! Obtain a Is_on_x_identification_2 function object */ - Is_on_x_identification_2 is_on_x_identification_2_object() const - { return Is_on_x_identification_2(); } + { return Compare_y_near_boundary_2(*this); } /*! A functor that indicates whether a geometric object lies on the * vertical identification arc. */ class Is_on_y_identification_2 { protected: - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits* m_traits; + const Traits& m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Is_on_y_identification_2(const Traits* traits) : m_traits(traits) {} + Is_on_y_identification_2(const Traits& traits) : m_traits(traits) {} - friend class Arr_geodesic_arc_on_sphere_traits_2; + friend class Arr_geodesic_arc_on_sphere_traits_2; public: /*! Determine whether a point lies on the vertical identification arc. * \param p the point. * \return a Boolean indicating whether p lies on the vertical - * identification arc. + * identification arc (including the poles) */ - bool operator()(const Point_2& p) const { return p.is_mid_boundary(); } + bool operator()(const Point_2& p) const { return !p.is_no_boundary(); } /*! Determine whether an arc coincides with the vertical identification * arc. @@ -1310,52 +1897,89 @@ public: * identification arc. */ bool operator()(const X_monotone_curve_2& xcv) const - { return xcv.is_on_boundary(); } + { + /* If the curve is not vertical and non of its endpoints lie on the + * boundary, the arc itself cannot lie on the identification arc. + */ + const Point_2& source = xcv.source(); + const Point_2& target = xcv.target(); + if (source.is_no_boundary() || target.is_no_boundary() || + !xcv.is_vertical()) + return false; + + /*! The curve is vertical. If at least one endpoint lies on the open + * identification arc, it entirely lies on it. + */ + if (source.is_mid_boundary() || target.is_mid_boundary()) return true; + + /* Both endpoints lie on opposite poles respectively. If the normal + * coincides with the normal of the plane that contains the identification + * arc, the arc lies on the identification arc. + */ + return m_traits.overlap_with_identification(xcv, Zero_atan_y()); + } }; /*! Obtain a Is_on_y_identification_2 function object */ Is_on_y_identification_2 is_on_y_identification_2_object() const - { return Is_on_y_identification_2(this); } + { return Is_on_y_identification_2(*this); } /*! A functor that compares the y-coordinate of two given points * that lie on the vertical identification arc. */ class Compare_y_on_boundary_2 { protected: - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits* m_traits; + const Traits& m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Compare_y_on_boundary_2(const Traits* traits) : m_traits(traits) {} + Compare_y_on_boundary_2(const Traits& traits) : m_traits(traits) {} - friend class Arr_geodesic_arc_on_sphere_traits_2; + friend class Arr_geodesic_arc_on_sphere_traits_2; public: /*! Compare the y-coordinate of two given points that lie on the vertical * identification curve. * \param p1 the first point. * \param p2 the second point. - * \return SMALLER - p1 is lexicographically smaller than p2; + * \return SMALLER - p1 is smaller than p2; * EQUAL - p1 and p2 coincides; - * LARGER - p1 is lexicographically larger than p2; - * \pre p1 lies on the vertical identification arc. - * \pre p2 lies on the vertical identification arc. + * LARGER - p1 is larger than p2; + * \pre p1 lies on the vertical identification arc including the poles! + * \pre p2 lies on the vertical identification arc including the poles! */ Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { - CGAL_precondition(!p1.is_no_boundary()); - CGAL_precondition(!p2.is_no_boundary()); - return m_traits->compare_y(p1, p2); + // first deal with the 'degenerate' case of poles! + if (p1.is_min_boundary()) { + if (p2.is_min_boundary()) return EQUAL; + else return SMALLER; + } + else if (p1.is_max_boundary()) { + if (p2.is_max_boundary()) return EQUAL; + else return LARGER; + } + else if (p2.is_min_boundary()) return LARGER; + else if (p2.is_max_boundary()) return SMALLER; + + // this is the default for points on the identification arc + CGAL_assertion(!p1.is_no_boundary()); + CGAL_assertion(!p2.is_no_boundary()); + return m_traits.compare_y(p1, p2); } + + // THERE ARE NO OTHER SIGNATURES AS WE HAVE IT FOR COMPARE_X_ON_BOUNDARY, + // namely (ce1,pt2) and (ce1, ce2) + }; /*! Obtain a Compare_y_on_boundary_2 function object */ Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const - { return Compare_y_on_boundary_2(this); } + { return Compare_y_on_boundary_2(*this); } //@} /// \name Functor definitions for supporting intersections. @@ -1366,17 +1990,17 @@ public: */ class Make_x_monotone_2 { protected: - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits* m_traits; + const Traits& m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Make_x_monotone_2(const Traits* traits) : m_traits(traits) {} + Make_x_monotone_2(const Traits& traits) : m_traits(traits) {} - friend class Arr_geodesic_arc_on_sphere_traits_2; + friend class Arr_geodesic_arc_on_sphere_traits_2; public: /*! Cut the given curve into x-monotone subcurves and insert them into the @@ -1409,8 +2033,8 @@ public: // The spherical arc is full if (c.is_vertical()) { // The arc is vertical => divide it into 2 meridians; - const Direction_3& np = m_traits->neg_pole(); - const Direction_3& pp = m_traits->pos_pole(); + const Point_2& np = m_traits.neg_pole(); + const Point_2& pp = m_traits.pos_pole(); X_monotone_curve_2 xc1(np, pp, c.normal(), true, true); X_monotone_curve_2 xc2(pp, np, c.normal(), true, false); *oi++ = make_object(xc1); @@ -1427,10 +2051,12 @@ public: // discontinuity arc: Direction_3 normal = c.normal(); bool directed_right = Traits::x_sign(normal) == POSITIVE; - Direction_3 d1(-(normal.dz()), 0, normal.dx()); - Direction_3 d2(normal.dz(), 0, -(normal.dx())); - X_monotone_curve_2 xc1(d1, d2, normal, false, directed_right); - X_monotone_curve_2 xc2(d2, d1, normal, false, directed_right); + typename Traits::Construct_point_2 ctr_p = + m_traits.construct_point_2_object(); + Point_2 p1 = ctr_p(Direction_3(-(normal.dz()), 0, normal.dx())); + Point_2 p2 = ctr_p(Direction_3(normal.dz(), 0, -(normal.dx()))); + X_monotone_curve_2 xc1(p1, p2, normal, false, directed_right); + X_monotone_curve_2 xc2(p2, p1, normal, false, directed_right); *oi++ = make_object(xc1); *oi++ = make_object(xc2); #endif @@ -1445,8 +2071,8 @@ public: /* If one of the endpoints coincide with a pole, divide the arc at * the opposite pole: */ - const Direction_3& np = m_traits->neg_pole(); - const Direction_3& pp = m_traits->pos_pole(); + const Point_2& np = m_traits.neg_pole(); + const Point_2& pp = m_traits.pos_pole(); if (source.is_min_boundary() || target.is_min_boundary()) { X_monotone_curve_2 xc1(source, pp, normal, true, true); X_monotone_curve_2 xc2(pp, target, normal, true, false); @@ -1496,24 +2122,15 @@ public: } // The curve is not vertical, (none of the enpoints coincide with a pole) -#if (CGAL_IDENTIFICATION_XY == CGAL_X_MINUS_1_Y_0) - Direction_3 dp = (CGAL::sign(normal.dz()) == POSITIVE) ? - Direction_3(-(normal.dz()), 0, normal.dx()) : - Direction_3(normal.dz(), 0, -(normal.dx())); -#else - const Direction_2& xy = Traits::identification_xy(); - FT x = xy.dx(); - FT y = xy.dy(); - FT z((xy.dx() * normal.dx() + xy.dy() * normal.dy()) / -(normal.dz())); - Direction_3 dp(x, y, z); -#endif + Direction_3 dp; + m_traits.intersection_with_identification(c, dp, Zero_atan_y()); Point_2 p(dp, Point_2::MID_BOUNDARY_LOC); Direction_2 s = Traits::project_xy(source); Direction_2 t = Traits::project_xy(target); const Direction_2& d = Traits::identification_xy(); - const Kernel* kernel = m_traits; + const Kernel& kernel = m_traits; bool directed_right = - kernel->counterclockwise_in_between_2_object()(d, s, t); + kernel.counterclockwise_in_between_2_object()(d, s, t); X_monotone_curve_2 xc1(source, p, normal, false, directed_right); X_monotone_curve_2 xc2(p, target, normal, false, directed_right); @@ -1525,22 +2142,22 @@ public: /*! Obtain a Make_x_monotone_2 function object */ Make_x_monotone_2 make_x_monotone_2_object() const - { return Make_x_monotone_2(this); } + { return Make_x_monotone_2(*this); } /*! A functor that splits an x-monotone arc at a directional point. */ class Split_2 { protected: - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits* m_traits; + const Traits& m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Split_2(const Traits* traits) : m_traits(traits) {} + Split_2(const Traits& traits) : m_traits(traits) {} - friend class Arr_geodesic_arc_on_sphere_traits_2; + friend class Arr_geodesic_arc_on_sphere_traits_2; public: /*! Split a given x-monotone curve at a given point into two sub-curves. @@ -1559,9 +2176,9 @@ public: CGAL_precondition(!xc.is_degenerate()); const Point_2& source = xc.source(); const Point_2& target = xc.target(); - CGAL_precondition_code(const Kernel* kernel = m_traits); + CGAL_precondition_code(const Kernel& kernel = m_traits); CGAL_precondition_code - (typename Kernel::Equal_3 equal_3 = kernel->equal_3_object()); + (typename Kernel::Equal_3 equal_3 = kernel.equal_3_object()); CGAL_precondition(!equal_3(Direction_3(p), Direction_3(source))); CGAL_precondition(!equal_3(Direction_3(p), Direction_3(target))); @@ -1581,7 +2198,8 @@ public: xc2.set_source(p); xc2.set_target(target); xc2.set_is_directed_right(true); - } else { + } + else { xc1.set_source(p); xc1.set_target(target); xc1.set_is_directed_right(false); @@ -1593,35 +2211,35 @@ public: }; /*! Obtain a Split_2 function object */ - Split_2 split_2_object() const { return Split_2(this); } + Split_2 split_2_object() const { return Split_2(*this); } /*! The clockwise-in-between function object */ class Clockwise_in_between_2 { protected: - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits* m_traits; + const Traits& m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Clockwise_in_between_2(const Traits* traits) : m_traits(traits) {} + Clockwise_in_between_2(const Traits& traits) : m_traits(traits) {} - friend class Arr_geodesic_arc_on_sphere_traits_2; + friend class Arr_geodesic_arc_on_sphere_traits_2; public: bool operator()(const Direction_2& d, const Direction_2& d1, const Direction_2& d2) const { - const Kernel* kernel = m_traits; - return kernel->counterclockwise_in_between_2_object()(d, d2, d1); + const Kernel& kernel = m_traits; + return kernel.counterclockwise_in_between_2_object()(d, d2, d1); } }; /*! Obtain a Clockwise_in_between function object */ Clockwise_in_between_2 clockwise_in_between_2_object() const - { return Clockwise_in_between_2(this); } + { return Clockwise_in_between_2(*this); } /*! A functor that computes intersections between x-monotone arcs. */ class Intersect_2 { @@ -1633,11 +2251,11 @@ public: * \param l2_3 * \param r2_3 * \param normal - the normal of the common plane - * \param vertical - is the plane vertical - * \param start - the start 2d vertex - * \param in_between - the in_between operator - * \param project - the projection function - * \param oi - the output iterator + * \param vertical - are the curves vertical + * \param start - the start 2d vertex + * \param in_between - the in_between operator + * \param project - the projection function + * \param oi - the output iterator */ template OutputIterator compute_intersection(const Point_2& l1_3, @@ -1646,55 +2264,163 @@ public: const Point_2 r2_3, const Direction_3& normal, bool vertical, - const Direction_2& start, const In_between& in_between, Project project, OutputIterator oi) const { typedef std::pair Point_2_pair; - const Kernel* kernel = m_traits; - typename Kernel::Equal_2 equal = kernel->equal_2_object(); + const Kernel& kernel = m_traits; + typename Kernel::Equal_2 equal = kernel.equal_2_object(); Direction_2 l1 = project(l1_3); Direction_2 r1 = project(r1_3); Direction_2 l2 = project(l2_3); Direction_2 r2 = project(r2_3); + // std::cout << "l1: " << l1 << ", r1: " << r1 << std::endl + // << "l2: " << l2 << ", r2: " << r2 << std::endl; - if (equal(l1, l2)) { - const Point_2& trg = (in_between(r1, l2, r2)) ? r1_3 : r2_3; - X_monotone_curve_2 xc(l1_3, trg, normal, vertical, true); + // Handle full circles first + if (equal(l1, r1)) { + bool is_full = equal(l2, r2); + X_monotone_curve_2 xc(l2_3, r2_3, normal, vertical, true, is_full); *oi++ = make_object(xc); return oi; } - bool l1_eq_start = equal(l1, start); - bool l2_eq_start = equal(l2, start); + if (equal(l2, r2)) { + CGAL_assertion(! equal(l1, r1)); // already handled above + X_monotone_curve_2 xc(l1_3, r1_3, normal, vertical, true); + *oi++ = make_object(xc); + return oi; + } - if (l1_eq_start || (!l2_eq_start && in_between(l1, start, l2))) { - // The following applies only to full circles: - if (l1_eq_start && equal(r2, start)) - *oi++ = make_object(Point_2_pair(r2_3, 1)); - if (in_between(r1, l1, l2)) return oi; // no intersection - if (equal(r1, l2)) { - *oi++ = make_object(Point_2_pair(r1_3, 1)); + // Handle coincidences + // First source and second target coincide + if (equal(l1, r2)) { + // 1. l1 = r2 < r1 < l2 < l1 | One intersection + // 2. l1 = r2 < r1 = l2 < l1 | Two intersections + // 3. l1 = r2 < l2 < r1 < l1 | One intersection and one overlap + // 4. l1 = r2 < l2 < r1 = l1 | One overlap (handled above) + if (in_between(r1, r2, l2)) { + // If the intersection point lies on the identification curve, this + // intersection point should be ignored (see below). However, it + // cannot occur. + *oi++ = make_object(Point_2_pair(l1_3, 1)); return oi; } - const Point_2& trg = (in_between(r1, l2, r2)) ? r1_3 : r2_3; - X_monotone_curve_2 xc(l2_3, trg, normal, vertical, true); + if (equal(r1, l2)) { + // Case 2. This can happen only if one of the intersection points + // lies on the identification curve, and this points should be + // ignored. + if (! m_traits.is_on_y_identification_2_object()(l1_3)) { + *oi++ = make_object(Point_2_pair(l1_3, 1)); + return oi; + } + CGAL_assertion(! m_traits.is_on_y_identification_2_object()(l2_3)); + *oi++ = make_object(Point_2_pair(l2_3, 1)); + return oi; + } + CGAL_assertion(in_between(r1, l2, r2)); + // Case 3. This can happen only the intersection point lies on the + // identification curve; in this case this point should be ignored. + CGAL_assertion(m_traits.is_on_y_identification_2_object()(l1_3)); + X_monotone_curve_2 xc(l2_3, r1_3, normal, vertical, true); *oi++ = make_object(xc); return oi; } - CGAL_assertion(l2_eq_start || in_between(l2, start, l1)); - // The following applies only to full circles: - if (l2_eq_start && equal(r1, start)) - *oi++ = make_object(Point_2_pair(r1_3, 1)); - if (in_between(r2, l2, l1)) return oi; // no intersection - if (equal(r2, l1)) { - *oi++ = make_object(Point_2_pair(r2_3, 1)); + + // Second source and first target coincide + if (equal(r1, l2)) { + // 1. l1 < r1 = l2 < r2 < l1 | One intersection + // 2. l1 < r1 = l2 < r2 = l1 | Two intersections (handled above) + // 3. l1 < r2 < r1 = l2 < l1 | One intersection and one overlap + // 4. l1 < r2 = r1 = l2 < l1 | One overlap (handled above) + if (in_between(r2, r1, l1)) { + // If the intersection point lies on the identification curve, this + // intersection point should be ignored (see below). However, it + // cannot occur. + *oi++ = make_object(Point_2_pair(l2_3, 1)); + return oi; + } + // Case 3. This can happen only the intersection point lies on the + // identification curve; in this case this point should be ignored. + CGAL_assertion(in_between(r2, l1, r1)); + CGAL_assertion(m_traits.is_on_y_identification_2_object()(l2_3)); + X_monotone_curve_2 xc(l1_3, r2_3, normal, vertical, true); + *oi++ = make_object(xc); return oi; } - const Point_2& trg = (in_between(r1, l2, r2)) ? r1_3 : r2_3; - X_monotone_curve_2 xc(l1_3, trg, normal, vertical, true); + + // First source and second source + if (equal(l1, l2)) { + // 1. l1 == l2 < r1 < r2 + // 2. l1 == l2 < r1 = r2 + // 3. l1 == l2 < r2 < r1 + if (in_between(r1, l2, r2) || equal(r1, r2)) { + // Cases 1 & 2 + X_monotone_curve_2 xc(l1_3, r1_3, normal, vertical, true); + *oi++ = make_object(xc); + return oi; + } + // Case 3 + CGAL_assertion(in_between(r2, l2, r1)); + X_monotone_curve_2 xc(l2_3, r2_3, normal, vertical, true); + *oi++ = make_object(xc); + return oi; + } + + // First target and second target + if (equal(r1, r2)) { + // 1. r1 == r2 < l1 < l2 + // 2. r1 == r2 < l1 = l2 (handled above) + // 3. r1 == r2 < l2 < l1 + if (in_between(l1, r2, l2)) { + // Cases 1 + X_monotone_curve_2 xc(l2_3, r2_3, normal, vertical, true); + *oi++ = make_object(xc); + return oi; + } + // Case 3 + CGAL_assertion(in_between(l1, l2, l2)); + X_monotone_curve_2 xc(l1_3, r1_3, normal, vertical, true); + *oi++ = make_object(xc); + return oi; + } + + // Handle no-coincidences. 6 cases are left: + // 1. l1 < r1 < l2 < r2 | No overlaps + // 2. l1 < r1 < r2 < l2 | One overlap (entire l1,r1) + // 3. l1 < l2 < r1 < r2 | One overlap (l2,r1) + // 4. l1 < l2 < r2 < r1 | One overlap (entire l2,r2) + // 5. l1 < r2 < r1 < l2 | One overlap (l1,r2) + // 6. l1 < r2 < l2 < r1 | Two overlaps (l1,r2)(l2,r1) impossible! + + if (in_between(l1, r2, r1)) { + // Handle case 1, 2, and 3 + if (in_between(l2, r1, r2)) return oi; // case 1 + if (in_between(l2, r2, l1)) { + // Case 2 + X_monotone_curve_2 xc(l1_3, r1_3, normal, vertical, true); + *oi++ = make_object(xc); + return oi; + } + // Case 3 + X_monotone_curve_2 xc(l2_3, r1_3, normal, vertical, true); + *oi++ = make_object(xc); + return oi; + } + + // Case 6 cannot occur. Two x-monotone curves cannot overlap twice. + CGAL_assertion(! in_between(l2, r2, r1)); + + // Case 4 + if (in_between(l1, r1, l2)) { + X_monotone_curve_2 xc(l2_3, r2_3, normal, vertical, true); + *oi++ = make_object(xc); + return oi; + } + // Case 5 + X_monotone_curve_2 xc(l1_3, r2_3, normal, vertical, true); *oi++ = make_object(xc); return oi; } @@ -1708,8 +2434,8 @@ public: bool is_in_between(const Point_2& point, const X_monotone_curve_2& xc) const { - const Kernel* kernel = m_traits; - CGAL_precondition(m_traits->has_on(xc.normal(), point)); + const Kernel& kernel = m_traits; + CGAL_precondition(m_traits.has_on(xc.normal(), point)); const Point_2& left = xc.left(); const Point_2& right = xc.right(); @@ -1740,33 +2466,33 @@ public: // Compare the y-coords: return (((left.is_min_boundary()) || - (m_traits->compare_y(point, left) != SMALLER)) && + (m_traits.compare_y(point, left) != SMALLER)) && ((right.is_max_boundary()) || - (m_traits->compare_y(point, right) != LARGER))); + (m_traits.compare_y(point, right) != LARGER))); } // The arc is not vertical. Compare the projections onto the xy-plane: - typename Kernel::Equal_2 equal_2 = kernel->equal_2_object(); + typename Kernel::Equal_2 equal_2 = kernel.equal_2_object(); Direction_2 p = Traits::project_xy(point); Direction_2 r = Traits::project_xy(right); if (equal_2(p, r)) return true; Direction_2 l = Traits::project_xy(left); if (equal_2(p, l)) return true; - return kernel->counterclockwise_in_between_2_object()(p, l, r); + return kernel.counterclockwise_in_between_2_object()(p, l, r); } protected: - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits* m_traits; + const Traits& m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Intersect_2(const Traits* traits) : m_traits(traits) {} + Intersect_2(const Traits& traits) : m_traits(traits) {} - friend class Arr_geodesic_arc_on_sphere_traits_2; + friend class Arr_geodesic_arc_on_sphere_traits_2; public: /*! Find the intersections of the two given curves and insert them into the @@ -1783,34 +2509,35 @@ public: const X_monotone_curve_2& xc2, OutputIterator oi) const { + // std::cout << "xc1: " << xc1 << std::endl + // << "xc2: " << xc2 << std::endl; CGAL_precondition(!xc1.is_degenerate()); CGAL_precondition(!xc2.is_degenerate()); - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; typedef typename Kernel::Counterclockwise_in_between_2 Counterclockwise_in_between_2; typedef typename Kernel::Equal_3 Equal_3; typedef std::pair Point_2_pair; - const Kernel* kernel = m_traits; + const Kernel& kernel = m_traits; - Equal_3 equal_3 = kernel->equal_3_object(); + Equal_3 equal_3 = kernel.equal_3_object(); const Direction_3& normal1 = xc1.normal(); const Direction_3& normal2 = xc2.normal(); Direction_3 opposite_normal1 = - kernel->construct_opposite_direction_3_object()(normal1); + kernel.construct_opposite_direction_3_object()(normal1); if (equal_3(normal1, normal2) || equal_3(opposite_normal1, normal2)) { // The underlying planes are the same Counterclockwise_in_between_2 ccib = - kernel->counterclockwise_in_between_2_object(); + kernel.counterclockwise_in_between_2_object(); typename Traits::Clockwise_in_between_2 cib = - m_traits->clockwise_in_between_2_object(); + m_traits.clockwise_in_between_2_object(); if (xc1.is_vertical()) { // Both arcs are vertical - bool res = kernel->equal_3_object()(normal1, normal2); + bool res = kernel.equal_3_object()(normal1, normal2); if ((!res && (xc1.is_directed_right() == xc2.is_directed_right())) || (res && (xc1.is_directed_right() != xc2.is_directed_right()))) { @@ -1854,14 +2581,12 @@ public: // The endpoints reside in the positive x-halfspace: return compute_intersection(xc1.left(), xc1.right(), xc2.left(), xc2.right(), - normal, true, Traits::neg_y_2(), - ccib, project, oi); + normal, true, ccib, project, oi); } // The endpoints reside in the negative x-halfspace: return compute_intersection(xc1.left(), xc1.right(), xc2.left(), xc2.right(), - normal, true, Traits::neg_y_2(), - cib, project, oi); + normal, true, cib, project, oi); } // The arcs are not vertical: @@ -1870,24 +2595,22 @@ public: (plane_is_positive) ? normal1 : opposite_normal1; return compute_intersection(xc1.left(), xc1.right(), xc2.left(), xc2.right(), - normal, false, Traits::identification_xy(), - ccib, Traits::project_xy, oi); + normal, false, ccib, Traits::project_xy, oi); } Vector_3 v = - kernel-> - construct_cross_product_vector_3_object()(xc1.normal().vector(), - xc2.normal().vector()); + kernel.construct_cross_product_vector_3_object()(xc1.normal().vector(), + xc2.normal().vector()); // Determine which one of the two directions: - Point_2 ed(v.direction()); + Point_2 ed = m_traits.construct_point_2_object()(v.direction()); if (is_in_between(ed, xc1) && is_in_between(ed, xc2)) { *oi++ = make_object(Point_2_pair(ed, 1)); return oi; } - Vector_3 vo(kernel->construct_opposite_vector_3_object()(v)); - Point_2 edo(vo.direction()); + Vector_3 vo(kernel.construct_opposite_vector_3_object()(v)); + Point_2 edo = m_traits.construct_point_2_object()(vo.direction()); if (is_in_between(edo, xc1) && is_in_between(edo, xc2)) { *oi++ = make_object(Point_2_pair(edo, 1)); return oi; @@ -1897,21 +2620,21 @@ public: }; /*! Obtain an Intersect_2 function object */ - Intersect_2 intersect_2_object() const { return Intersect_2(this); } + Intersect_2 intersect_2_object() const { return Intersect_2(*this); } /*! A functor that tests whether two x-monotone arcs can be merged. */ class Are_mergeable_2 { - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits* m_traits; + const Traits& m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Are_mergeable_2(const Traits* traits) : m_traits(traits) {} + Are_mergeable_2(const Traits& traits) : m_traits(traits) {} - friend class Arr_geodesic_arc_on_sphere_traits_2; + friend class Arr_geodesic_arc_on_sphere_traits_2; public: /*! Check whether it is possible to merge two given x-monotone curves. @@ -1929,8 +2652,8 @@ public: if ((xc1.is_full() || xc1.is_meridian()) && (xc2.is_full() || xc2.is_meridian())) return false; - const Kernel* kernel = m_traits; - typename Kernel::Equal_3 equal = kernel->equal_3_object(); + const Kernel& kernel = m_traits; + typename Kernel::Equal_3 equal = kernel.equal_3_object(); if (xc1.is_degenerate() && xc2.is_degenerate()) return equal(xc1.left(), xc2.left()); @@ -1942,7 +2665,7 @@ public: const Direction_3& normal1 = xc1.normal(); const Direction_3& normal2 = xc2.normal(); Direction_3 opposite_normal1 = - kernel->construct_opposite_direction_3_object()(normal1); + kernel.construct_opposite_direction_3_object()(normal1); if (!equal(normal1, normal2) && !equal(opposite_normal1, normal2)) return false; @@ -1963,22 +2686,22 @@ public: /*! Obtain an Are_mergeable_2 function object */ Are_mergeable_2 are_mergeable_2_object() const - { return Are_mergeable_2(this); } + { return Are_mergeable_2(*this); } /*! A functor that merges two x-monotone arcs into one */ class Merge_2 { protected: - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits* m_traits; + const Traits& m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Merge_2(const Traits* traits) : m_traits(traits) {} + Merge_2(const Traits& traits) : m_traits(traits) {} - friend class Arr_geodesic_arc_on_sphere_traits_2; + friend class Arr_geodesic_arc_on_sphere_traits_2; public: /*! Merge two given x-monotone curves into a single curve (spherical_arc). @@ -1991,7 +2714,7 @@ public: const X_monotone_curve_2& xc2, X_monotone_curve_2& xc) const { - CGAL_precondition (m_traits->are_mergeable_2_object()(xc1, xc2) == true); + CGAL_precondition (m_traits.are_mergeable_2_object()(xc1, xc2) == true); if (xc1.is_degenerate() || xc1.is_empty()) { xc = xc2; @@ -2003,8 +2726,8 @@ public: return; } - const Kernel* kernel = m_traits; - typename Kernel::Equal_3 equal = kernel->equal_3_object(); + const Kernel& kernel = m_traits; + typename Kernel::Equal_3 equal = kernel.equal_3_object(); xc.set_is_degenerate(false); xc.set_is_empty(false); @@ -2053,7 +2776,7 @@ public: }; /*! Obtain a Merge_2 function object */ - Merge_2 merge_2_object() const { return Merge_2(this); } + Merge_2 merge_2_object() const { return Merge_2(*this); } //@} /// \name Functor definitions for the landmarks point-location strategy. @@ -2080,25 +2803,8 @@ public: /*! Obtain an Approximate_2 function object */ Approximate_2 approximate_2_object() const { return Approximate_2(); } - class Construct_x_monotone_curve_2 { - public: - - /*! Return an x-monotone curve connecting the two given endpoints. - * \param p the first point. - * \param q the second point. - * \pre p and q must not be the same. - * \return a spherical_arc connecting p and q. - */ - X_monotone_curve_2 operator()(const Point_2& p, const Point_2& q) const - { return X_monotone_curve_2(p, q); } - }; - - /*! Obtain a Construct_x_monotone_curve_2 function object */ - Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object() const - { return Construct_x_monotone_curve_2(); } //@} - /// \name Functor definitions for the Boolean set-operation traits. //@{ @@ -2179,7 +2885,7 @@ public: /*! Enumeration of discontinuity type */ enum Location_type { - NO_BOUNDARY_LOC, + NO_BOUNDARY_LOC = 0, MIN_BOUNDARY_LOC, MID_BOUNDARY_LOC, MAX_BOUNDARY_LOC @@ -2210,71 +2916,31 @@ public: m_location(location) {} - /*! Constructor - * \param x the x coordinate - * \param y the y coordinate - * \param z the z coordinate - */ - Arr_extended_direction_3(const FT& x, const FT& y, const FT& z) : - Direction_3(x, y, z) - { init(); } - - /*! Constructor from a direction - * \param dir the direction - */ - Arr_extended_direction_3(const Direction_3& dir) : Direction_3(dir) - { init(); } - - /*! Initialize from a direction - * \param dir the direction - */ - void init() - { - const Direction_3& dir = *this; -#if (CGAL_IDENTIFICATION_XY == CGAL_X_MINUS_1_Y_0) - if (y_sign(dir) != ZERO) { - m_location = NO_BOUNDARY_LOC; - return; - } - CGAL::Sign signx = x_sign(dir); - m_location = - (signx == POSITIVE) ? NO_BOUNDARY_LOC : - ((signx == NEGATIVE) ? MID_BOUNDARY_LOC : - ((z_sign(dir) == NEGATIVE) ? MIN_BOUNDARY_LOC : MAX_BOUNDARY_LOC)); -#else - if ((x_sign(dir) == ZERO) && (y_sign(dir) == ZERO)) { - m_location = - (z_sign(dir) == NEGATIVE) ? MIN_BOUNDARY_LOC : MAX_BOUNDARY_LOC; - return; - } - - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; - Direction_2 dir_xy = Traits::project_xy(dir); - Kernel kernel; - typename Kernel::Equal_2 equal_2 = kernel.equal_2_object(); - const Direction_2& xy = Traits::identification_xy(); - m_location = equal_2(dir_xy, xy) ? MID_BOUNDARY_LOC : NO_BOUNDARY_LOC; -#endif - } - /*! Copy constructor */ - Arr_extended_direction_3(const Arr_extended_direction_3& ed) : - Direction_3(static_cast(ed)) - { - m_location = ed.discontinuity_type(); - } + Arr_extended_direction_3(const Arr_extended_direction_3& other) : + Direction_3(static_cast(other)) + { m_location = other.discontinuity_type(); } /*! Assignment operator */ - Arr_extended_direction_3& operator=(const Arr_extended_direction_3& ed) + Arr_extended_direction_3& operator=(const Arr_extended_direction_3& other) { - *(static_cast(this)) = static_cast(ed); - m_location = ed.discontinuity_type(); + *(static_cast(this)) = static_cast(other); + m_location = other.discontinuity_type(); return (*this); } - /*! Obtain the discontinuity type of the point */ - Location_type discontinuity_type() const - { return m_location; } + /*! Set the location of the point. + */ + void set_location(Location_type location) { m_location = location; } + + /*! Obtain the location of the point. + */ + Location_type location() const { return m_location; } + + /*! Obtain the discontinuity type of the point. + * \todo deprecate this one; use the above instead. + */ + Location_type discontinuity_type() const { return m_location; } bool is_no_boundary() const { return (m_location == NO_BOUNDARY_LOC); } @@ -2293,10 +2959,10 @@ public: * \todo At this point such an arc cannot have an angle of 180 degrees. * \todo It is always directed from its source to its target. */ -template +template class Arr_x_monotone_geodesic_arc_on_sphere_3 { public: - typedef T_Kernel Kernel; + typedef Kernel_ Kernel; typedef typename Kernel::Direction_3 Direction_3; typedef typename Kernel::Plane_3 Plane_3; typedef typename Kernel::Vector_3 Vector_3; @@ -2306,28 +2972,28 @@ protected: // For some reason compilation under Windows fails without the qualifier typedef CGAL::Arr_extended_direction_3 Arr_extended_direction_3; - /*! The source point of the arc */ + /*! The source point of the arc. */ Arr_extended_direction_3 m_source; - /*! The target point of the arc */ + /*! The target point of the arc. */ Arr_extended_direction_3 m_target; - /*! The direction of the plane that contains the arc */ + /*! The direction of the plane that contains the arc. */ Direction_3 m_normal; - /*! The arc is vertical */ + /*! The arc is vertical. */ bool m_is_vertical; - /*! Target (lexicographically) larger than source */ + /*! Target (lexicographically) larger than source. */ bool m_is_directed_right; - /*! The arc is a full circle */ + /*! The arc is a full circle. */ bool m_is_full; - /* The arc is degenerate - it consists of a single point */ + /* The arc is degenerate - it consists of a single point. */ bool m_is_degenerate; - /*! The arc is empty */ + /*! The arc is empty. */ bool m_is_empty; inline Sign x_sign(Direction_3 d) const { return CGAL::sign(d.dx()); } @@ -2336,19 +3002,6 @@ protected: inline Sign z_sign(Direction_3 d) const { return CGAL::sign(d.dz()); } - /*! Constructs a plane that contains two directions. - * \param d1 the first direction. - * \param d2 the second direction. - */ - inline Direction_3 construct_normal_3(const Direction_3& d1, - const Direction_3& d2) const - { - Kernel kernel; - Vector_3 v = kernel.construct_cross_product_vector_3_object()(d1.vector(), - d2.vector()); - return v.direction(); - } - public: /*! Default constructor - constructs an empty arc */ Arr_x_monotone_geodesic_arc_on_sphere_3() : @@ -2367,6 +3020,7 @@ public: * \param is_directed_right is the arc directed from left to right? * \param is_full is the arc a full circle? * \param is_degenerate is the arc degenerate (single point)? + * \pre Both endpoint lie on the given plane. */ Arr_x_monotone_geodesic_arc_on_sphere_3 (const Arr_extended_direction_3& src, @@ -2581,9 +3235,8 @@ public: * \pre the point lies on the plane * \pre the point lies on the open discontinuity arc */ - Arr_x_monotone_geodesic_arc_on_sphere_3 - (const Arr_extended_direction_3& point, - const Direction_3& normal) : + Arr_x_monotone_geodesic_arc_on_sphere_3(const Arr_extended_direction_3& point, + const Direction_3& normal) : m_source(point), m_target(point), m_normal(normal), @@ -2651,7 +3304,8 @@ public: if (xsign == ZERO) { s_is_positive = x_sign(source) == POSITIVE; plane_is_positive = y_sign(normal) == NEGATIVE; - } else { + } + else { s_is_positive = y_sign(source) == POSITIVE; plane_is_positive = xsign == POSITIVE; } @@ -2669,12 +3323,12 @@ public: /*! Set the source endpoint direction. * \param p the endpoint to set. */ - void set_source(const Direction_3& p) { m_source = p; } + void set_source(const Arr_extended_direction_3& p) { m_source = p; } /*! Set the target endpoint direction. * \param p the endpoint to set. */ - void set_target(const Direction_3& p) { m_target = p; } + void set_target(const Arr_extended_direction_3& p) { m_target = p; } /*! Set the direction of the underlying plane. * \param normal the plane direction. @@ -2721,79 +3375,6 @@ public: /*! Determines whether the curve is degenerate */ bool is_empty() const { return m_is_empty; } - /*! Determine whether the curve lie on the identification arc */ - bool is_on_boundary() const - { - /* If the curve is not vertical and non of its endpoints lie on the - * boundary, the arc itself cannot lie on the identification arc. - */ - if (m_source.is_no_boundary() || m_target.is_no_boundary() || - !is_vertical()) - return false; - - /*! The curve is vertical. If at least one endpoint lies on the open - * identification arc, it entirely lies on it. - */ - if (m_source.is_mid_boundary() || m_target.is_mid_boundary()) - return true; - - /* Both endpoints lie on opposite poles respectively. If the normal - * coincides with the normal of the plane that contains the identification - * arc, the arc lies on the identification arc. - */ -#if (CGAL_IDENTIFICATION_XY == CGAL_X_MINUS_1_Y_0) - return ((x_sign(m_normal) == ZERO) && - (((y_sign(m_normal) == NEGATIVE) && !is_directed_right()) || - ((y_sign(m_normal) == POSITIVE) && is_directed_right()))); -#else - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; - - const Direction_3& iden_normal = Traits::identification_normal(); - const Direction_2 iden_normal_xy = Traits::project_xy(iden_normal); - Direction_2 normal_xy = Traits::project_xy(m_normal); - Kernel kernel; - if (is_directed_right()) { - return kernel.equal_2_object()(normal_xy, iden_normal_xy); - } else { - Direction_2 opposite_normal_xy = - kernel.construct_opposite_direction_2_object()(normal_xy); - return kernel.equal_2_object()(opposite_normal_xy, iden_normal_xy); - } -#endif - } - - /*! Determine whether the given point is in the x-range of the - * spherical_arc. - * \param point the query point direction. - * \return true if point is in the x-range of the (closed) spherical_arc and - * false otherwise. - * \pre point does not coincide with one of the poles - */ - bool is_in_x_range(const Arr_extended_direction_3& point) const - { - typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; - - CGAL_precondition(!point.is_min_boundary()); - CGAL_precondition(!point.is_max_boundary()); - - Direction_2 p = Traits::project_xy(point); - if (is_vertical()) { - Direction_2 q = (is_directed_right()) ? - Direction_2(-(m_normal.dy()), m_normal.dx()) : - Direction_2(m_normal.dy(), -(m_normal.dx())); - Kernel kernel; - return kernel.equal_2_object()(p, q); - } - - // The curve is not vertical: - Direction_2 r = Traits::project_xy(right()); - Kernel kernel; - if (kernel.equal_2_object()(p, r)) return true; - Direction_2 l = Traits::project_xy(left()); - if (kernel.equal_2_object()(p, l)) return true; - return kernel.counterclockwise_in_between_2_object()(p, l, r); - } - /*! Determines whether the curve is a meridian */ bool is_meridian() const { return left().is_min_boundary() && right().is_max_boundary(); } @@ -2845,11 +3426,11 @@ public: * target t on the plane p in counterclockwise direction along the circle * defined by s and t. */ -template +template class Arr_geodesic_arc_on_sphere_3 : - public Arr_x_monotone_geodesic_arc_on_sphere_3 { + public Arr_x_monotone_geodesic_arc_on_sphere_3 { public: - typedef T_Kernel Kernel; + typedef Kernel_ Kernel; protected: typedef Arr_x_monotone_geodesic_arc_on_sphere_3 Base; @@ -2879,9 +3460,7 @@ public: */ Arr_geodesic_arc_on_sphere_3 (const Arr_geodesic_arc_on_sphere_3& other) : Base(other) - { - m_is_x_monotone = other.m_is_x_monotone; - } + { m_is_x_monotone = other.m_is_x_monotone; } /*! Constructor * \param src the source point of the arc @@ -2904,8 +3483,8 @@ public: bool is_full = false, bool is_degenerate = false, bool is_empty = false) : - Base(src, trg, normal, - is_vertical, is_directed_right, is_full, is_degenerate, is_empty), + Base(src, trg, normal, is_vertical, is_directed_right, + is_full, is_degenerate, is_empty), m_is_x_monotone(is_x_monotone) { CGAL_precondition(this->has_on(src)); @@ -3184,8 +3763,7 @@ OutputStream& operator<<(OutputStream& os, // << static_cast(todouble(ed.dy())) << ", " // << static_cast(todouble(ed.dz())); #endif - const typename Kernel::Direction_3* dir = &ed; - os << *dir; + os << ed.dx() << " " << ed.dy() << " " << ed.dz() << " " << ed.location(); return os; } @@ -3204,52 +3782,55 @@ operator<<(OutputStream& os, << ", " << (arc.is_directed_right() ? "=>" : "<=") << ", " << (arc.is_full() ? "o" : "/"); #else - os << arc.source() << " " << arc.target() << " "; - if (!arc.is_meridian()) os << "0"; - else os << "1 " << arc.normal(); + os << arc.source() << " " << arc.target() << " " << arc.normal() << " " + << arc.is_directed_right() << " " << arc.is_vertical() << " " + << arc.is_full(); #endif return os; } /*! Extractor for the spherical-arc point class used by the traits-class */ -template +template InputStream& -operator>>(InputStream& is, Arr_extended_direction_3& point) +operator>>(InputStream& is, Arr_extended_direction_3& point) { - typename Kernel::Direction_3* dir = &point; - is >> *dir; - point.init(); + typedef Kernel_ Kernel; + typedef Arr_extended_direction_3 Point; + // CGAL_error_msg("Importing a geodesic point is not supported!"); + typename Kernel::Direction_3 d; + is >> d; + size_t location; + is >> location; + point = Point(d, static_cast(location)); return is; } /*! Extractor for the spherical_arc class used by the traits-class */ -template +template InputStream& operator>>(InputStream& is, - Arr_x_monotone_geodesic_arc_on_sphere_3& arc) + Arr_x_monotone_geodesic_arc_on_sphere_3& arc) { - Arr_extended_direction_3 source, target; + typedef Kernel_ Kernel; + typedef Arr_extended_direction_3 Point; + + // CGAL_error_msg("Importing a geodesic arc is not supported!\n"); + + Point source, target; is >> source >> target; arc.set_source(source); arc.set_target(target); - unsigned int flag; - is >> flag; - if (flag == 1) { - typename Kernel::Direction_3 normal; - is >> normal; - arc.set_normal(normal); - } - else { - Kernel kernel; - CGAL_precondition(!kernel.equal_3_object() - (kernel.construct_opposite_direction_3_object()(source), - target)); - typename Kernel::Vector_3 v = - kernel.construct_cross_product_vector_3_object()(source.vector(), - target.vector()); - arc.set_normal(v.direction()); - } - arc.init(); + typename Kernel::Direction_3 normal; + is >> normal; + arc.set_normal(normal); + bool is_directed_right, is_vertical, is_full; + is >> is_directed_right >> is_vertical >> is_full; + arc.set_is_directed_right(is_directed_right); + arc.set_is_vertical(is_vertical); + arc.set_is_full(is_full); + arc.set_is_full(false); + arc.set_is_degenerate(false); + arc.set_is_empty(false); return is; } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h index ea1e037c97d..7076df8d811 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h @@ -81,14 +81,12 @@ public: class _Linear_object_cached_2 { public: - typedef typename Kernel::Line_2 Line_2; typedef typename Kernel::Ray_2 Ray_2; typedef typename Kernel::Segment_2 Segment_2; typedef typename Kernel::Point_2 Point_2; protected: - Line_2 l; // The supporting line. Point_2 ps; // The source point (if exists). Point_2 pt; // The target point (if exists). @@ -108,38 +106,35 @@ public: public: - /*! - * Default constructor. - */ - _Linear_object_cached_2 () : - has_source (true), - has_target (true), - is_vert (false), - is_horiz (false), - has_pos_slope (false), - is_degen (true) + /*! Default constructor. */ + _Linear_object_cached_2() : + has_source(true), + has_target(true), + is_vert(false), + is_horiz(false), + has_pos_slope(false), + is_degen(true) {} - /*! - * Constructor for segment from two points. + /*! Constructor for segment from two points. * \param p1 source point. * \param p2 target point. * \pre The two points must not be equal. */ _Linear_object_cached_2(const Point_2& source, const Point_2& target) : - ps (source), - pt (target), - has_source (true), - has_target (true) + ps(source), + pt(target), + has_source(true), + has_target(true) { - Kernel kernel; + Kernel kernel; Comparison_result res = kernel.compare_xy_2_object()(source, target); is_degen = (res == EQUAL); is_right = (res == SMALLER); - CGAL_precondition_msg (! is_degen, - "Cannot construct a degenerate segment."); + CGAL_precondition_msg(! is_degen, + "Cannot construct a degenerate segment."); l = kernel.construct_line_2_object()(source, target); is_vert = kernel.is_vertical_2_object()(l); @@ -147,17 +142,16 @@ public: has_pos_slope = _has_positive_slope(); } - /*! - * Constructor from a segment. + /*! Constructor from a segment. * \param seg The segment. * \pre The segment is not degenerate. */ - _Linear_object_cached_2 (const Segment_2& seg) + _Linear_object_cached_2(const Segment_2& seg) { - Kernel kernel; + Kernel kernel; - CGAL_assertion_msg (! kernel.is_degenerate_2_object() (seg), - "Cannot construct a degenerate segment."); + CGAL_assertion_msg(! kernel.is_degenerate_2_object() (seg), + "Cannot construct a degenerate segment."); typename Kernel_::Construct_vertex_2 construct_vertex = kernel.construct_vertex_2_object(); @@ -169,7 +163,7 @@ public: Comparison_result res = kernel.compare_xy_2_object()(ps, pt); - CGAL_assertion (res != EQUAL); + CGAL_assertion(res != EQUAL); is_degen = false; is_right = (res == SMALLER); @@ -184,12 +178,12 @@ public: * \param ray The ray. * \pre The ray is not degenerate. */ - _Linear_object_cached_2 (const Ray_2& ray) + _Linear_object_cached_2(const Ray_2& ray) { - Kernel kernel; + Kernel kernel; - CGAL_assertion_msg (! kernel.is_degenerate_2_object() (ray), - "Cannot construct a degenerate ray."); + CGAL_assertion_msg(! kernel.is_degenerate_2_object()(ray), + "Cannot construct a degenerate ray."); typename Kernel_::Construct_point_on_2 construct_vertex = kernel.construct_point_on_2_object(); @@ -200,7 +194,7 @@ public: has_target = false; Comparison_result res = kernel.compare_xy_2_object()(ps, pt); - CGAL_assertion (res != EQUAL); + CGAL_assertion(res != EQUAL); is_degen = false; is_right = (res == SMALLER); @@ -210,20 +204,19 @@ public: has_pos_slope = _has_positive_slope(); } - /*! - * Constructor from a line. + /*! Constructor from a line. * \param ln The line. * \pre The line is not degenerate. */ - _Linear_object_cached_2 (const Line_2& ln) : - l (ln), - has_source (false), - has_target (false) + _Linear_object_cached_2(const Line_2& ln) : + l(ln), + has_source(false), + has_target(false) { - Kernel kernel; + Kernel kernel; - CGAL_assertion_msg (! kernel.is_degenerate_2_object() (ln), - "Cannot construct a degenerate line."); + CGAL_assertion_msg(! kernel.is_degenerate_2_object()(ln), + "Cannot construct a degenerate line."); typename Kernel_::Construct_point_on_2 construct_vertex = kernel.construct_point_on_2_object(); @@ -234,7 +227,7 @@ public: has_target = false; Comparison_result res = kernel.compare_xy_2_object()(ps, pt); - CGAL_assertion (res != EQUAL); + CGAL_assertion(res != EQUAL); is_degen = false; is_right = (res == SMALLER); @@ -243,31 +236,27 @@ public: has_pos_slope = _has_positive_slope(); } - /*! - * Check whether the x-coordinate of the left point is infinite. + /*! Check whether the x-coordinate of the left point is infinite. * \return ARR_LEFT_BOUNDARY if the left point is near the boundary; * ARR_INTERIOR if the x-coordinate is finite. */ - Arr_parameter_space left_infinite_in_x () const + Arr_parameter_space left_infinite_in_x() const { - if (is_vert || is_degen) - return (ARR_INTERIOR); + if (is_vert || is_degen) return (ARR_INTERIOR); return (is_right) ? (has_source ? ARR_INTERIOR : ARR_LEFT_BOUNDARY) : (has_target ? ARR_INTERIOR : ARR_LEFT_BOUNDARY); } - /*! - * Check whether the y-coordinate of the left point is infinite. + /*! Check whether the y-coordinate of the left point is infinite. * \return ARR_BOTTOM_BOUNDARY if the left point is at y = -oo; * ARR_INTERIOR if the y-coordinate is finite. * ARR_TOP_BOUNDARY if the left point is at y = +oo; */ - Arr_parameter_space left_infinite_in_y () const + Arr_parameter_space left_infinite_in_y() const { - if (is_horiz || is_degen) - return ARR_INTERIOR; + if (is_horiz || is_degen) return ARR_INTERIOR; if (is_vert) { return (is_right) ? @@ -281,95 +270,81 @@ public: return (has_pos_slope ? ARR_BOTTOM_BOUNDARY : ARR_TOP_BOUNDARY); } - /*! - * Check whether the left point is finite. + /*! Check whether the left point is finite. */ - bool has_left () const + bool has_left() const { - if (is_right) - return (has_source); - else - return (has_target); + if (is_right) return (has_source); + else return (has_target); } - /*! - * Obtain the (lexicographically) left endpoint. + /*! Obtain the (lexicographically) left endpoint. * \pre The left point is finite. */ - const Point_2& left () const + const Point_2& left() const { - CGAL_precondition (has_left()); + CGAL_precondition(has_left()); return (is_right ? ps : pt); } - /*! - * Set the (lexicographically) left endpoint. + /*! Set the (lexicographically) left endpoint. * \param p The point to set. * \pre p lies on the supporting line to the left of the right endpoint. */ - void set_left (const Point_2& p, bool CGAL_assertion_code(check_validity) = true) + void set_left(const Point_2& p, + bool CGAL_assertion_code(check_validity) = true) { - CGAL_precondition (! is_degen); + CGAL_precondition(! is_degen); - CGAL_precondition_code ( + CGAL_precondition_code( Kernel kernel; ); CGAL_precondition - (Segment_assertions::_assert_is_point_on (p, l, - Has_exact_division()) && + (Segment_assertions::_assert_is_point_on(p, l, Has_exact_division()) && (! check_validity || ! has_right() || - kernel.compare_xy_2_object() (p, right()) == SMALLER)); + kernel.compare_xy_2_object()(p, right()) == SMALLER)); - if (is_right) - { + if (is_right) { ps = p; has_source = true; } - else - { + else { pt = p; has_target = true; } } - /*! - * Set the (lexicographically) left endpoint as infinite. + /*! Set the (lexicographically) left endpoint as infinite. */ - void set_left () + void set_left() { - CGAL_precondition (! is_degen); + CGAL_precondition(! is_degen); - if (is_right) - has_source = false; - else - has_target = false; + if (is_right) has_source = false; + else has_target = false; } - /*! - * Check whether the x-coordinate of the right point is infinite. + /*! Check whether the x-coordinate of the right point is infinite. * \return ARR_RIGHT_BOUNDARY if the right point is near the boundary; * ARR_INTERIOR if the x-coordinate is finite. */ - Arr_parameter_space right_infinite_in_x () const + Arr_parameter_space right_infinite_in_x() const { - if (is_vert || is_degen) - return ARR_INTERIOR; + if (is_vert || is_degen) return ARR_INTERIOR; return (is_right) ? (has_target ? ARR_INTERIOR : ARR_RIGHT_BOUNDARY) : (has_source ? ARR_INTERIOR : ARR_RIGHT_BOUNDARY); } - /*! - * Check whether the y-coordinate of the right point is infinite. + /*! Check whether the y-coordinate of the right point is infinite. * \return ARR_BOTTOM_BOUNDARY if the right point is at y = -oo; * ARR_INTERIOR if the y-coordinate is finite. * ARR_TOP_BOUNDARY if the right point is at y = +oo; */ - Arr_parameter_space right_infinite_in_y () const + Arr_parameter_space right_infinite_in_y() const { - if (is_horiz || is_degen) - return ARR_INTERIOR; + if (is_horiz || is_degen) return ARR_INTERIOR; if (is_vert) { return (is_right) ? @@ -383,145 +358,112 @@ public: return (has_pos_slope ? ARR_TOP_BOUNDARY : ARR_BOTTOM_BOUNDARY); } - /*! - * Check whether the right point is finite. + /*! Check whether the right point is finite. */ - bool has_right () const + bool has_right() const { - if (is_right) - return (has_target); - else - return (has_source); + if (is_right) return (has_target); + else return (has_source); } - /*! - * Obtain the (lexicographically) right endpoint. + /*! Obtain the (lexicographically) right endpoint. * \pre The right endpoint is finite. */ - const Point_2& right () const + const Point_2& right() const { - CGAL_precondition (has_right()); + CGAL_precondition(has_right()); return (is_right ? pt : ps); } - /*! - * Set the (lexicographically) right endpoint. + /*! Set the (lexicographically) right endpoint. * \param p The point to set. * \pre p lies on the supporting line to the right of the left endpoint. */ - void set_right (const Point_2& p, bool CGAL_assertion_code(check_validity) = true) + void set_right(const Point_2& p, + bool CGAL_assertion_code(check_validity) = true) { - CGAL_precondition (! is_degen); - CGAL_precondition_code ( - Kernel kernel; - ); + CGAL_precondition(! is_degen); + CGAL_precondition_code(Kernel kernel;); CGAL_precondition - (Segment_assertions::_assert_is_point_on (p, l, - Has_exact_division()) && + (Segment_assertions::_assert_is_point_on(p, l, Has_exact_division()) && (! check_validity || ! has_left() || kernel.compare_xy_2_object() (p, left()) == LARGER)); - if (is_right) - { + if (is_right) { pt = p; has_target = true; } - else - { + else { ps = p; has_source = true; } } - /*! - * Set the (lexicographically) right endpoint as infinite. + /*! Set the (lexicographically) right endpoint as infinite. */ - void set_right () + void set_right() { - CGAL_precondition (! is_degen); + CGAL_precondition(! is_degen); - if (is_right) - has_target = false; - else - has_source = false; + if (is_right) has_target = false; + else has_source = false; } - /*! - * Obtain the supporting line. + /*! Obtain the supporting line. */ - const Line_2& supp_line () const + const Line_2& supp_line() const { - CGAL_precondition (! is_degen); + CGAL_precondition(! is_degen); return (l); } - /*! - * Check whether the curve is vertical. + /*! Check whether the curve is vertical. */ - bool is_vertical () const + bool is_vertical() const { - CGAL_precondition (! is_degen); + CGAL_precondition(! is_degen); return (is_vert); } - /*! - * Check whether the curve is degenerate. + /*! Check whether the curve is degenerate. */ - bool is_degenerate () const - { - return (is_degen); - } + bool is_degenerate() const { return (is_degen); } - /*! - * Check whether the curve is directed lexicographic from left to right + /*! Check whether the curve is directed lexicographic from left to right */ - bool is_directed_right () const - { - return (is_right); - } + bool is_directed_right() const { return (is_right); } - /*! - * Check whether the given point is in the x-range of the object. + /*! Check whether the given point is in the x-range of the object. * \param p The query point. * \return (true) is in the x-range of the segment; (false) if it is not. */ - bool is_in_x_range (const Point_2& p) const + bool is_in_x_range(const Point_2& p) const { Kernel kernel; typename Kernel_::Compare_x_2 compare_x = kernel.compare_x_2_object(); Comparison_result res1; - if (left_infinite_in_x() == ARR_INTERIOR) - { - if (left_infinite_in_y() != ARR_INTERIOR) - // Compare with some point on the curve. - res1 = compare_x (p, ps); - else - res1 = compare_x (p, left()); + if (left_infinite_in_x() == ARR_INTERIOR) { + // Compare with some point on the curve. + if (left_infinite_in_y() != ARR_INTERIOR) res1 = compare_x(p, ps); + else res1 = compare_x(p, left()); } - else - { + else { // p is obviously to the right. res1 = LARGER; } - if (res1 == SMALLER) - return (false); - else if (res1 == EQUAL) - return (true); + if (res1 == SMALLER) return (false); + else if (res1 == EQUAL) return (true); Comparison_result res2; - if (right_infinite_in_x() == ARR_INTERIOR) - { - if (right_infinite_in_y() != ARR_INTERIOR) - // Compare with some point on the curve. - res2 = compare_x (p, ps); - else - res2 = compare_x (p, right()); + if (right_infinite_in_x() == ARR_INTERIOR) { + // Compare with some point on the curve. + if (right_infinite_in_y() != ARR_INTERIOR) res2 = compare_x(p, ps); + else res2 = compare_x(p, right()); } - else - { + else { // p is obviously to the right. res2 = SMALLER; } @@ -535,62 +477,50 @@ public: * \pre The object is vertical. * \return (true) is in the y-range of the segment; (false) if it is not. */ - bool is_in_y_range (const Point_2& p) const + bool is_in_y_range(const Point_2& p) const { - CGAL_precondition (is_vertical()); + CGAL_precondition(is_vertical()); Kernel kernel; typename Kernel_::Compare_y_2 compare_y = kernel.compare_y_2_object(); Arr_parameter_space inf = left_infinite_in_y(); Comparison_result res1; - CGAL_assertion (inf != ARR_TOP_BOUNDARY); - if (inf == ARR_INTERIOR) - res1 = compare_y (p, left()); - else - res1 = LARGER; // p is obviously above. + CGAL_assertion(inf != ARR_TOP_BOUNDARY); + if (inf == ARR_INTERIOR) res1 = compare_y(p, left()); + else res1 = LARGER; // p is obviously above. - if (res1 == SMALLER) - return (false); - else if (res1 == EQUAL) - return (true); + if (res1 == SMALLER) return (false); + else if (res1 == EQUAL) return (true); Comparison_result res2; inf = right_infinite_in_y(); CGAL_assertion (inf != ARR_BOTTOM_BOUNDARY); - if (inf == ARR_INTERIOR) - res2 = compare_y (p, right()); - else - res2 = SMALLER; // p is obviously below. + if (inf == ARR_INTERIOR) res2 = compare_y(p, right()); + else res2 = SMALLER; // p is obviously below. return (res2 != LARGER); } private: - - /*! - * Determine if the supporting line has a positive slope. + /*! Determine if the supporting line has a positive slope. */ - bool _has_positive_slope () const + bool _has_positive_slope() const { - if (is_vert) - return (true); - - if (is_horiz) - return (false); + if (is_vert) return (true); + if (is_horiz) return (false); // Construct a horizontal line and compare its slope the that of l. - Kernel kernel; - Line_2 l_horiz = kernel.construct_line_2_object() (Point_2 (0, 0), - Point_2 (1, 0)); + Kernel kernel; + Line_2 l_horiz = kernel.construct_line_2_object()(Point_2(0, 0), + Point_2(1, 0)); - return (kernel.compare_slope_2_object() (l, l_horiz) == LARGER); + return (kernel.compare_slope_2_object()(l, l_horiz) == LARGER); } }; public: - // Traits objects typedef typename Kernel::Point_2 Point_2; typedef Arr_linear_object_2 X_monotone_curve_2; @@ -598,12 +528,8 @@ public: typedef unsigned int Multiplicity; public: - - /*! - * Default constructor. - */ - Arr_linear_traits_2 () - {} + /*! Default constructor. */ + Arr_linear_traits_2() {} /// \name Basic functor definitions. //@{ @@ -614,7 +540,7 @@ public: typedef Arr_linear_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) @@ -628,15 +554,14 @@ public: friend class Arr_linear_traits_2; public: - /*! - * Compare the x-coordinates of two points. + /*! Compare the x-coordinates of two points. * \param p1 The first point. * \param p2 The second point. * \return LARGER if x(p1) > x(p2); * SMALLER if x(p1) < x(p2); * EQUAL if x(p1) = x(p2). */ - Comparison_result operator() (const Point_2& p1, const Point_2& p2) const + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { const Kernel * kernel = m_traits; return (kernel->compare_x_2_object()(p1, p2)); @@ -644,10 +569,7 @@ public: }; /*! Obtain a Compare_x_2 functor. */ - Compare_x_2 compare_x_2_object () const - { - return Compare_x_2(this); - } + Compare_x_2 compare_x_2_object() const { return Compare_x_2(this); } /*! A functor that compares the he endpoints of an $x$-monotone curve. */ class Compare_endpoints_xy_2{ @@ -784,15 +706,14 @@ public: /*! A functor that compares the x-coordinates of two points */ class Compare_xy_2 { public: - /*! - * Compare two points lexigoraphically: by x, then by y. + /*! Compare two points lexigoraphically: by x, then by y. * \param p1 The first point. * \param p2 The second point. * \return LARGER if x(p1) > x(p2), or if x(p1) = x(p2) and y(p1) > y(p2); * SMALLER if x(p1) < x(p2), or if x(p1) = x(p2) and y(p1) < y(p2); * EQUAL if the two points are equal. */ - Comparison_result operator() (const Point_2& p1, const Point_2& p2) const + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { Kernel kernel; return (kernel.compare_xy_2_object()(p1, p2)); @@ -800,82 +721,65 @@ public: }; /*! Obtain a Compare_xy_2 functor object. */ - Compare_xy_2 compare_xy_2_object () const - { - return Compare_xy_2(); - } + Compare_xy_2 compare_xy_2_object() const { return Compare_xy_2(); } /*! A functor that obtains the left endpoint of a segment or a ray. */ - class Construct_min_vertex_2 - { + class Construct_min_vertex_2 { public: - /*! - * Get the left endpoint of the x-monotone curve (segment). + /*! Get the left endpoint of the x-monotone curve (segment). * \param cv The curve. * \pre The left end of cv is a valid (bounded) point. * \return The left endpoint. */ - const Point_2& operator() (const X_monotone_curve_2& cv) const + const Point_2& operator()(const X_monotone_curve_2& cv) const { - CGAL_precondition (! cv.is_degenerate()); - CGAL_precondition (cv.has_left()); + CGAL_precondition(! cv.is_degenerate()); + CGAL_precondition(cv.has_left()); return (cv.left()); } }; /*! Obtain a Construct_min_vertex_2 functor object. */ - Construct_min_vertex_2 construct_min_vertex_2_object () const - { - return Construct_min_vertex_2(); - } + Construct_min_vertex_2 construct_min_vertex_2_object() const + { return Construct_min_vertex_2(); } /*! A functor that obtains the right endpoint of a segment or a ray. */ - class Construct_max_vertex_2 - { + class Construct_max_vertex_2 { public: - /*! - * Get the right endpoint of the x-monotone curve (segment). + /*! Get the right endpoint of the x-monotone curve (segment). * \param cv The curve. * \pre The right end of cv is a valid (bounded) point. * \return The right endpoint. */ - const Point_2& operator() (const X_monotone_curve_2& cv) const + const Point_2& operator()(const X_monotone_curve_2& cv) const { - CGAL_precondition (! cv.is_degenerate()); - CGAL_precondition (cv.has_right()); - + CGAL_precondition(! cv.is_degenerate()); + CGAL_precondition(cv.has_right()); return (cv.right()); } }; /*! Obtain a Construct_max_vertex_2 functor object. */ - Construct_max_vertex_2 construct_max_vertex_2_object () const - { - return Construct_max_vertex_2(); - } + Construct_max_vertex_2 construct_max_vertex_2_object() const + { return Construct_max_vertex_2(); } /*! A functor that checks whether a given linear curve is vertical. */ - class Is_vertical_2 - { + class Is_vertical_2 { public: - /*! - * Check whether the given x-monotone curve is a vertical segment. + /*! Check whether the given x-monotone curve is a vertical segment. * \param cv The curve. * \return (true) if the curve is a vertical segment; (false) otherwise. */ - bool operator() (const X_monotone_curve_2& cv) const + bool operator()(const X_monotone_curve_2& cv) const { - CGAL_precondition (! cv.is_degenerate()); + CGAL_precondition(! cv.is_degenerate()); return (cv.is_vertical()); } }; /*! Obtain an Is_vertical_2 functor object. */ - Is_vertical_2 is_vertical_2_object () const - { - return Is_vertical_2(); - } + Is_vertical_2 is_vertical_2_object() const { return Is_vertical_2(); } /*! A functor that compares the y-coordinates of a point and a line at * the point x-coordinate @@ -899,8 +803,7 @@ public: friend class Arr_linear_traits_2; public: - /*! - * Return the location of the given point with respect to the input curve. + /*! Return the location of the given point with respect to the input curve. * \param cv The curve. * \param p The point. * \pre p is in the x-range of cv. @@ -911,36 +814,33 @@ public: Comparison_result operator() (const Point_2& p, const X_monotone_curve_2& cv) const { - CGAL_precondition (! cv.is_degenerate()); - CGAL_precondition (cv.is_in_x_range (p)); + CGAL_precondition(! cv.is_degenerate()); + CGAL_precondition(cv.is_in_x_range (p)); - const Kernel * kernel = m_traits; + const Kernel* kernel = m_traits; if (! cv.is_vertical()) // Compare p with the segment's supporting line. return (kernel->compare_y_at_x_2_object()(p, cv.supp_line())); // Compare with the vertical segment's end-points. - typename Kernel::Compare_y_2 compare_y = kernel->compare_y_2_object(); + typename Kernel::Compare_y_2 compare_y = kernel->compare_y_2_object(); const Comparison_result res1 = - cv.has_left() ? compare_y (p, cv.left()) : LARGER; + cv.has_left() ? compare_y(p, cv.left()) : LARGER; const Comparison_result res2 = - cv.has_right() ? compare_y (p, cv.right()) : SMALLER; + cv.has_right() ? compare_y(p, cv.right()) : SMALLER; return (res1 == res2) ? res1 : EQUAL; } }; /*! Obtain a Compare_y_at_x_2 functor object. */ - Compare_y_at_x_2 compare_y_at_x_2_object () const - { - return Compare_y_at_x_2(this); - } + Compare_y_at_x_2 compare_y_at_x_2_object() const + { return Compare_y_at_x_2(this); } /*! A functor that compares compares the y-coordinates of two linear * curves immediately to the left of their intersection point. */ - class Compare_y_at_x_left_2 - { + class Compare_y_at_x_left_2 { public: /*! * Compare the y value of two x-monotone curves immediately to the left @@ -953,12 +853,12 @@ public: * \return The relative position of cv1 with respect to cv2 immdiately to * the left of p: SMALLER, LARGER or EQUAL. */ - Comparison_result operator() (const X_monotone_curve_2& cv1, - const X_monotone_curve_2& cv2, - const Point_2& CGAL_precondition_code(p)) const + Comparison_result operator()(const X_monotone_curve_2& cv1, + const X_monotone_curve_2& cv2, + const Point_2& CGAL_precondition_code(p)) const { - CGAL_precondition (! cv1.is_degenerate()); - CGAL_precondition (! cv2.is_degenerate()); + CGAL_precondition(! cv1.is_degenerate()); + CGAL_precondition(! cv2.is_degenerate()); Kernel kernel; @@ -969,36 +869,33 @@ public: ); CGAL_precondition - (Segment_assertions::_assert_is_point_on (p, cv1, - Has_exact_division()) && - Segment_assertions::_assert_is_point_on (p, cv2, - Has_exact_division())); + (Segment_assertions::_assert_is_point_on(p, cv1, + Has_exact_division()) && + Segment_assertions::_assert_is_point_on(p, cv2, Has_exact_division())); - CGAL_precondition ((! cv1.has_left() || - compare_xy(cv1.left(), p) == SMALLER) && - (! cv2.has_left() || - compare_xy(cv2.left(), p) == SMALLER)); + CGAL_precondition((! cv1.has_left() || + compare_xy(cv1.left(), p) == SMALLER) && + (! cv2.has_left() || + compare_xy(cv2.left(), p) == SMALLER)); // Compare the slopes of the two segments to determine thir relative // position immediately to the left of q. // Notice we use the supporting lines in order to compare the slopes, // and that we swap the order of the curves in order to obtain the // correct result to the left of p. - return (kernel.compare_slope_2_object()(cv2.supp_line(), cv1.supp_line())); + return (kernel.compare_slope_2_object()(cv2.supp_line(), + cv1.supp_line())); } }; /*! Obtain a Compare_y_at_x_left_2 functor object. */ - Compare_y_at_x_left_2 compare_y_at_x_left_2_object () const - { - return Compare_y_at_x_left_2(); - } + Compare_y_at_x_left_2 compare_y_at_x_left_2_object() const + { return Compare_y_at_x_left_2(); } /*! A functor that compares compares the y-coordinates of two linear * curves immediately to the right of their intersection point. */ - class Compare_y_at_x_right_2 - { + class Compare_y_at_x_right_2 { public: /*! * Compare the y value of two x-monotone curves immediately to the right @@ -1011,12 +908,12 @@ public: * \return The relative position of cv1 with respect to cv2 immdiately to * the right of p: SMALLER, LARGER or EQUAL. */ - Comparison_result operator() (const X_monotone_curve_2& cv1, - const X_monotone_curve_2& cv2, - const Point_2& CGAL_precondition_code(p)) const + Comparison_result operator()(const X_monotone_curve_2& cv1, + const X_monotone_curve_2& cv2, + const Point_2& CGAL_precondition_code(p)) const { - CGAL_precondition (! cv1.is_degenerate()); - CGAL_precondition (! cv2.is_degenerate()); + CGAL_precondition(! cv1.is_degenerate()); + CGAL_precondition(! cv2.is_degenerate()); Kernel kernel; @@ -1032,7 +929,7 @@ public: Segment_assertions::_assert_is_point_on (p, cv2, Has_exact_division())); - CGAL_precondition ((! cv1.has_right() || + CGAL_precondition((! cv1.has_right() || compare_xy(cv1.right(), p) == LARGER) && (! cv2.has_right() || compare_xy(cv2.right(), p) == LARGER)); @@ -1046,16 +943,13 @@ public: }; /*! Obtain a Compare_y_at_x_right_2 functor object. */ - Compare_y_at_x_right_2 compare_y_at_x_right_2_object () const - { - return Compare_y_at_x_right_2(); - } + Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const + { return Compare_y_at_x_right_2(); } /*! A functor that checks whether two points and two linear curves are * identical. */ - class Equal_2 - { + class Equal_2 { public: /*! * Check whether the two x-monotone curves are the same (have the same @@ -1064,30 +958,26 @@ public: * \param cv2 The second curve. * \return (true) if the two curves are the same; (false) otherwise. */ - bool operator() (const X_monotone_curve_2& cv1, - const X_monotone_curve_2& cv2) const + bool operator()(const X_monotone_curve_2& cv1, + const X_monotone_curve_2& cv2) const { - CGAL_precondition (! cv1.is_degenerate()); - CGAL_precondition (! cv2.is_degenerate()); + CGAL_precondition(! cv1.is_degenerate()); + CGAL_precondition(! cv2.is_degenerate()); Kernel kernel; typename Kernel::Equal_2 equal = kernel.equal_2_object(); // Check that the two supporting lines are the same. - if (! equal (cv1.supp_line(), cv2.supp_line()) && - ! equal (cv1.supp_line(), - kernel.construct_opposite_line_2_object()(cv2.supp_line()))) - { - return (false); - } + if (! equal(cv1.supp_line(), cv2.supp_line()) && + ! equal(cv1.supp_line(), + kernel.construct_opposite_line_2_object()(cv2.supp_line()))) + { return (false); } // Check that either the two left endpoints are at infinity, or they // are bounded and equal. if ((cv1.has_left() != cv2.has_left()) || (cv1.has_left() && ! equal (cv1.left(), cv2.left()))) - { - return (false); - } + { return (false); } // Check that either the two right endpoints are at infinity, or they // are bounded and equal. @@ -1101,7 +991,7 @@ public: * \param p2 The second point. * \return (true) if the two point are the same; (false) otherwise. */ - bool operator() (const Point_2& p1, const Point_2& p2) const + bool operator()(const Point_2& p1, const Point_2& p2) const { Kernel kernel; return (kernel.equal_2_object()(p1, p2)); @@ -1109,10 +999,7 @@ public: }; /*! Obtain an Equal_2 functor object. */ - Equal_2 equal_2_object () const - { - return Equal_2(); - } + Equal_2 equal_2_object() const { return Equal_2(); } //@} /// \name Functor definitions to handle boundaries @@ -1138,7 +1025,7 @@ public: Arr_parameter_space operator()(const X_monotone_curve_2 & xcv, Arr_curve_end ce) const { - CGAL_precondition (! xcv.is_degenerate()); + CGAL_precondition(! xcv.is_degenerate()); return (ce == ARR_MIN_END) ? xcv.left_infinite_in_x() : xcv.right_infinite_in_x(); } @@ -1148,9 +1035,7 @@ public: * \return the parameter space at p. */ Arr_parameter_space operator()(const Point_2 ) const - { - return ARR_INTERIOR; - } + { return ARR_INTERIOR; } }; /*! Obtain a Parameter_space_in_x_2 function object */ @@ -1182,7 +1067,7 @@ public: Arr_parameter_space operator()(const X_monotone_curve_2 & xcv, Arr_curve_end ce) const { - CGAL_precondition (! xcv.is_degenerate()); + CGAL_precondition(! xcv.is_degenerate()); return (ce == ARR_MIN_END) ? xcv.left_infinite_in_y() : xcv.right_infinite_in_y(); @@ -1192,10 +1077,8 @@ public: * \param p the point. * \return the parameter space at p. */ - Arr_parameter_space operator()(const Point_2 ) const - { - return ARR_INTERIOR; - } + Arr_parameter_space operator()(const Point_2 /* p */) const + { return ARR_INTERIOR; } }; /*! Obtain a Parameter_space_in_y_2 function object */ @@ -1205,7 +1088,7 @@ public: /*! A function object that compares the x-limits of arc ends on the * boundary of the parameter space */ - class Compare_x_at_limit_2 { + class Compare_x_on_boundary_2 { protected: typedef Arr_linear_traits_2 Traits; @@ -1218,7 +1101,7 @@ public: * obtaining function, which is a member of the nesting class, * constructing it. */ - Compare_x_at_limit_2(const Traits* traits) : m_traits(traits) {} + Compare_x_on_boundary_2(const Traits* traits) : m_traits(traits) {} //! Allow its functor obtaining function calling the private constructor. friend class Arr_linear_traits_2; @@ -1286,14 +1169,14 @@ public: } }; - /*! Obtain a Compare_x_at_limit_2 function object */ - Compare_x_at_limit_2 compare_x_at_limit_2_object() const - { return Compare_x_at_limit_2(this); } + /*! Obtain a Compare_x_on_boundary_2 function object */ + Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const + { return Compare_x_on_boundary_2(this); } /*! A function object that compares the x-coordinates of arc ends near the * boundary of the parameter space */ - class Compare_x_near_limit_2 { + class Compare_x_near_boundary_2 { public: /*! Compare the x-coordinates of 2 arcs ends near the boundary of the @@ -1330,10 +1213,9 @@ public: } }; - /*! Obtain a Compare_x_near_limit_2 function object */ - Compare_x_near_limit_2 compare_x_near_limit_2_object() const - { return Compare_x_near_limit_2(); } - + /*! Obtain a Compare_x_near_boundary_2 function object */ + Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const + { return Compare_x_near_boundary_2(); } /*! A function object that compares the y-limits of arc ends on the * boundary of the parameter space. @@ -1409,8 +1291,7 @@ public: /// \name Functor definitions for supporting intersections. //@{ - class Make_x_monotone_2 - { + class Make_x_monotone_2 { public: /*! * Cut the given curve into x-monotone subcurves and insert them into the @@ -1422,25 +1303,20 @@ public: * essentially the same as the input curve. * \return The past-the-end iterator. */ - template - OutputIterator operator() (const Curve_2& cv, OutputIterator oi) const + template + OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const { // Wrap the curve with an object. - *oi = make_object (cv); - ++oi; - + *oi++ = make_object(cv); return (oi); } }; /*! Obtain a Make_x_monotone_2 functor object. */ - Make_x_monotone_2 make_x_monotone_2_object () const - { - return Make_x_monotone_2(); - } + Make_x_monotone_2 make_x_monotone_2_object() const + { return Make_x_monotone_2(); } - class Split_2 - { + class Split_2 { public: /*! * Split a given x-monotone curve at a given point into two sub-curves. @@ -1453,7 +1329,7 @@ public: void operator() (const X_monotone_curve_2& cv, const Point_2& p, X_monotone_curve_2& c1, X_monotone_curve_2& c2) const { - CGAL_precondition (! cv.is_degenerate()); + CGAL_precondition(! cv.is_degenerate()); // Make sure that p lies on the interior of the curve. CGAL_precondition_code ( @@ -1479,13 +1355,9 @@ public: }; /*! Obtain a Split_2 functor object. */ - Split_2 split_2_object () const - { - return Split_2(); - } + Split_2 split_2_object() const { return Split_2(); } - class Intersect_2 - { + class Intersect_2 { public: /*! * Find the intersections of the two given curves and insert them into the @@ -1501,41 +1373,36 @@ public: const X_monotone_curve_2& cv2, OutputIterator oi) const { - CGAL_precondition (! cv1.is_degenerate()); - CGAL_precondition (! cv2.is_degenerate()); + CGAL_precondition(! cv1.is_degenerate()); + CGAL_precondition(! cv2.is_degenerate()); // Intersect the two supporting lines. Kernel kernel; CGAL::Object obj = kernel.intersect_2_object()(cv1.supp_line(), cv2.supp_line()); - if (obj.is_empty()) - { + if (obj.is_empty()) { // The supporting line are parallel lines and do not intersect: return (oi); } // Check whether we have a single intersection point. - const Point_2 *ip = object_cast (&obj); + const Point_2* ip = object_cast (&obj); - if (ip != NULL) - { + if (ip != NULL) { // Check whether the intersection point ip lies on both segments. const bool ip_on_cv1 = cv1.is_vertical() ? cv1.is_in_y_range(*ip) : cv1.is_in_x_range(*ip); - if (ip_on_cv1) - { + if (ip_on_cv1) { const bool ip_on_cv2 = cv2.is_vertical() ? cv2.is_in_y_range(*ip) : cv2.is_in_x_range(*ip); - if (ip_on_cv2) - { + if (ip_on_cv2) { // Create a pair representing the point with its multiplicity, // which is always 1 for line segments. - std::pair ip_mult (*ip, 1); - *oi = make_object (ip_mult); - oi++; + std::pair ip_mult(*ip, 1); + *oi++ = make_object(ip_mult); } } return (oi); @@ -1547,33 +1414,27 @@ public: typename Kernel::Compare_xy_2 compare_xy = kernel.compare_xy_2_object(); X_monotone_curve_2 ovlp = cv1; - if (cv2.has_left()) - { + if (cv2.has_left()) { // If the left endpoint of cv2 is to the right of cv1's left endpoint, // clip the overlapping subcurve. - if (! cv1.has_left()) - { + if (! cv1.has_left()) { ovlp.set_left (cv2.left(), false); } - else - { + else { if (compare_xy (cv1.left(), cv2.left()) == SMALLER) ovlp.set_left (cv2.left(), false); } } - if (cv2.has_right()) - { + if (cv2.has_right()) { // If the right endpoint of cv2 is to the left of cv1's right endpoint, // clip the overlapping subcurve. - if (! cv1.has_right()) - { - ovlp.set_right (cv2.right(), false); + if (! cv1.has_right()) { + ovlp.set_right(cv2.right(), false); } - else - { + else { if (compare_xy (cv1.right(), cv2.right()) == LARGER) - ovlp.set_right (cv2.right(), false); + ovlp.set_right(cv2.right(), false); } } @@ -1583,20 +1444,16 @@ public: if (ovlp.has_left() && ovlp.has_right()) res = compare_xy (ovlp.left(), ovlp.right()); - if (res == SMALLER) - { + if (res == SMALLER) { // We have discovered a true overlapping subcurve: - *oi = make_object (ovlp); - oi++; + *oi++ = make_object(ovlp); } - else if (res == EQUAL) - { + else if (res == EQUAL) { // The two objects have the same supporting line, but they just share // a common endpoint. Thus we have an intersection point, but we leave // the multiplicity of this point undefined. std::pair ip_mult (ovlp.left(), 0); - *oi = make_object (ip_mult); - oi++; + *oi++ = make_object(ip_mult); } return (oi); @@ -1604,13 +1461,9 @@ public: }; /*! Obtain an Intersect_2 functor object. */ - Intersect_2 intersect_2_object () const - { - return Intersect_2(); - } + Intersect_2 intersect_2_object() const { return Intersect_2(); } - class Are_mergeable_2 - { + class Are_mergeable_2 { public: /*! * Check whether it is possible to merge two given x-monotone curves. @@ -1622,8 +1475,8 @@ public: bool operator() (const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2) const { - CGAL_precondition (! cv1.is_degenerate()); - CGAL_precondition (! cv2.is_degenerate()); + CGAL_precondition(! cv1.is_degenerate()); + CGAL_precondition(! cv2.is_degenerate()); Kernel kernel; typename Kernel::Equal_2 equal = kernel.equal_2_object(); @@ -1644,16 +1497,12 @@ public: }; /*! Obtain an Are_mergeable_2 functor object. */ - Are_mergeable_2 are_mergeable_2_object () const - { - return Are_mergeable_2(); - } + Are_mergeable_2 are_mergeable_2_object() const { return Are_mergeable_2(); } /*! \class Merge_2 * A functor that merges two x-monotone arcs into one. */ - class Merge_2 - { + class Merge_2 { protected: typedef Arr_linear_traits_2 Traits; @@ -1714,15 +1563,14 @@ public: }; /*! Obtain a Merge_2 functor object. */ - Merge_2 merge_2_object () const { return Merge_2(this); } + Merge_2 merge_2_object() const { return Merge_2(this); } //@} /// \name Functor definitions for the landmarks point-location strategy. //@{ typedef double Approximate_number_type; - class Approximate_2 - { + class Approximate_2 { public: /*! @@ -1736,7 +1584,7 @@ public: Approximate_number_type operator() (const Point_2& p, int i) const { - CGAL_precondition (i == 0 || i == 1); + CGAL_precondition(i == 0 || i == 1); if (i == 0) return (CGAL::to_double(p.x())); @@ -1746,15 +1594,10 @@ public: }; /*! Obtain an Approximate_2 functor object. */ - Approximate_2 approximate_2_object () const - { - return Approximate_2(); - } + Approximate_2 approximate_2_object() const { return Approximate_2(); } - class Construct_x_monotone_curve_2 - { + class Construct_x_monotone_curve_2 { public: - /*! * Return an x-monotone curve connecting the two given endpoints. * \param p The first point. @@ -1762,38 +1605,32 @@ public: * \pre p and q must not be the same. * \return A segment connecting p and q. */ - X_monotone_curve_2 operator() (const Point_2& p, - const Point_2& q) const + X_monotone_curve_2 operator()(const Point_2& p, const Point_2& q) const { - Kernel kernel; - Segment_2 seg = kernel.construct_segment_2_object() (p, q); - - return (X_monotone_curve_2 (seg)); + Kernel kernel; + Segment_2 seg = kernel.construct_segment_2_object() (p, q); + return (X_monotone_curve_2(seg)); } }; /*! Obtain a Construct_x_monotone_curve_2 functor object. */ - Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object () const - { - return Construct_x_monotone_curve_2(); - } + Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object() const + { return Construct_x_monotone_curve_2(); } //@} - }; /*! * \class A representation of a segment, as used by the Arr_segment_traits_2 * traits-class. */ -template +template class Arr_linear_object_2 : public Arr_linear_traits_2::_Linear_object_cached_2 { typedef typename Arr_linear_traits_2::_Linear_object_cached_2 - Base; + Base; public: - typedef Kernel_ Kernel; typedef typename Kernel::Point_2 Point_2; @@ -1802,87 +1639,62 @@ public: typedef typename Kernel::Line_2 Line_2; public: + /*! Default constructor. */ + Arr_linear_object_2() : Base() {} - /*! - * Default constructor. - */ - Arr_linear_object_2 () : - Base() - {} - - /*! - * Constructor from two points. + /*! Constructor from two points. * \param s The source point. * \param t The target point. * \pre The two points must not be the same. */ - Arr_linear_object_2(const Point_2& s, const Point_2& t): - Base(s, t) - {} + Arr_linear_object_2(const Point_2& s, const Point_2& t) : Base(s, t) {} - /*! - * Constructor from a segment. + /*! Constructor from a segment. * \param seg The segment. * \pre The segment is not degenerate. */ - Arr_linear_object_2 (const Segment_2& seg) : - Base (seg) - {} + Arr_linear_object_2(const Segment_2& seg) : Base(seg) {} - /*! - * Constructor from a ray. + /*! Constructor from a ray. * \param ray The segment. * \pre The ray is not degenerate. */ - Arr_linear_object_2 (const Ray_2& ray) : - Base (ray) - {} + Arr_linear_object_2(const Ray_2& ray) : Base(ray) {} - /*! - * Constructor from a line. + /*! Constructor from a line. * \param line The line. * \pre The line is not degenerate. */ - Arr_linear_object_2 (const Line_2& line) : - Base (line) - {} + Arr_linear_object_2(const Line_2& line) : Base(line) {} - /*! - * Check whether the object is actually a segment. + /*! Check whether the object is actually a segment. */ - bool is_segment () const - { - return (! this->is_degen && this->has_source && this->has_target); - } + bool is_segment() const + { return (! this->is_degen && this->has_source && this->has_target); } - /*! - * Cast to a segment. + /*! Cast to a segment. * \pre The linear object is really a segment. */ - Segment_2 segment () const + Segment_2 segment() const { - CGAL_precondition (is_segment()); + CGAL_precondition(is_segment()); Kernel kernel; Segment_2 seg = kernel.construct_segment_2_object() (this->ps, this->pt); return seg; } - /*! - * Check whether the object is actually a ray. + /*! Check whether the object is actually a ray. */ - bool is_ray () const - { - return (! this->is_degen && (this->has_source != this->has_target)); - } + bool is_ray() const + { return (! this->is_degen && (this->has_source != this->has_target)); } - /*! - * Cast to a ray. + /*! Cast to a ray. * \pre The linear object is really a ray. */ - Ray_2 ray () const + Ray_2 ray() const { - CGAL_precondition (is_ray()); + CGAL_precondition(is_ray()); Kernel kernel; Ray_2 ray = (this->has_source) ? @@ -1892,70 +1704,59 @@ public: return ray; } - /*! - * Check whether the object is actually a line. + /*! Check whether the object is actually a line. */ - bool is_line () const - { - return (! this->is_degen && ! this->has_source && ! this->has_target); - } + bool is_line() const + { return (! this->is_degen && ! this->has_source && ! this->has_target); } - /*! - * Cast to a line. + /*! Cast to a line. * \pre The linear object is really a line. */ - Line_2 line () const + Line_2 line() const { - CGAL_precondition (is_line()); + CGAL_precondition(is_line()); return (this->l); } - /*! - * Get the supporting line. + /*! Get the supporting line. * \pre The object is not a point. */ - const Line_2& supporting_line () const + const Line_2& supporting_line() const { - CGAL_precondition (! this->is_degen); + CGAL_precondition(! this->is_degen); return (this->l); } - /*! - * Get the source point. + /*! Get the source point. * \pre The object is a point, a segment or a ray. */ const Point_2& source() const { - CGAL_precondition (! is_line()); + CGAL_precondition(! is_line()); if (this->is_degen) return (this->ps); // For a point. - if (this->has_source) - return (this->ps); // For a segment or a ray. - else - return (this->pt); // For a "flipped" ray. + if (this->has_source) return (this->ps); // For a segment or a ray. + else return (this->pt); // For a "flipped" ray. } - /*! - * Get the target point. + /*! Get the target point. * \pre The object is a point or a segment. */ const Point_2& target() const { - CGAL_precondition (! is_line() && ! is_ray()); - + CGAL_precondition(! is_line() && ! is_ray()); return (this->pt); } - /*! - * Create a bounding box for the linear object. + /*! Create a bounding box for the linear object. */ Bbox_2 bbox() const { CGAL_precondition(this->is_segment()); - Kernel kernel; - Segment_2 seg = kernel.construct_segment_2_object() (this->ps, this->pt); + Kernel kernel; + Segment_2 seg = kernel.construct_segment_2_object() (this->ps, this->pt); return (kernel.construct_bbox_2_object() (seg)); } @@ -1967,12 +1768,11 @@ public: // compiler will have 3 equivalent options to choose from. }; -/*! - * Exporter for the segment class used by the traits-class. +/*! Exporter for the segment class used by the traits-class. */ -template -OutputStream& operator<< (OutputStream& os, - const Arr_linear_object_2& lobj) +template +OutputStream& operator<<(OutputStream& os, + const Arr_linear_object_2& lobj) { // Print a letter identifying the object type, then the object itself. if (lobj.is_segment()) @@ -1985,38 +1785,32 @@ OutputStream& operator<< (OutputStream& os, return (os); } -/*! - * Importer for the segment class used by the traits-class. +/*! Importer for the segment class used by the traits-class. */ -template -InputStream& operator>> (InputStream& is, Arr_linear_object_2& lobj) +template +InputStream& operator>>(InputStream& is, Arr_linear_object_2& lobj) { // Read the object type. - char c; - - do - { + char c; + do { is >> c; } while ((c != 'S' && c != 's') && (c != 'R' && c != 'r') && (c != 'L' && c != 'l')); // Read the object accordingly. - if (c == 'S' || c == 's') - { - typename Kernel::Segment_2 seg; + if (c == 'S' || c == 's') { + typename Kernel::Segment_2 seg; is >> seg; lobj = seg; } - else if (c == 'R' || c == 'r') - { - typename Kernel::Ray_2 ray; + else if (c == 'R' || c == 'r') { + typename Kernel::Ray_2 ray; is >> ray; lobj = ray; } - else - { - typename Kernel::Line_2 line; + else { + typename Kernel::Line_2 line; is >> line; lobj = line; } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_observer.h b/Arrangement_on_surface_2/include/CGAL/Arr_observer.h index 4ed7287903b..a09a2d58223 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_observer.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_observer.h @@ -15,9 +15,10 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0+ -// +// // // Author(s) : Ron Wein +// Efi Fogel #ifndef CGAL_ARR_OBSERVER_H #define CGAL_ARR_OBSERVER_H @@ -37,11 +38,10 @@ namespace CGAL { * A base class for arrangement observers. * The Arrangement parameter corresponds to an arrangement instantiation. */ -template +template class Arr_observer { public: - typedef Arrangement_ Arrangement_2; typedef Arr_observer Self; @@ -51,43 +51,38 @@ public: typedef typename Arrangement_2::Vertex_handle Vertex_handle; typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; typedef typename Arrangement_2::Face_handle Face_handle; - typedef typename Arrangement_2::Ccb_halfedge_circulator + typedef typename Arrangement_2::Ccb_halfedge_circulator Ccb_halfedge_circulator; private: - - Arrangement_2 *p_arr; // The associated arrangement. + Arrangement_2* p_arr; // The associated arrangement. /*! Copy constructor - not supported. */ - Arr_observer (const Self& ); + Arr_observer(const Self&); /*! Assignment operator - not supported. */ - Self& operator= (const Self& ); + Self& operator=(const Self&); public: - /// \name Construction and destruction functions. //@{ /*! Default constructor. */ - Arr_observer () : - p_arr (NULL) - {} + Arr_observer() : p_arr(NULL) {} /*! Constructor with an associated arrangement. */ - Arr_observer (Arrangement_2& arr) : - p_arr (&arr) + Arr_observer(Arrangement_2& arr) : p_arr(&arr) { // Register the observer object in the arrangement. - p_arr->_register_observer (this); + p_arr->_register_observer(this); } /*! Destructor. */ - virtual ~Arr_observer () + virtual ~Arr_observer() { // Unregister the observer object from the arrangement. if (p_arr != NULL) - p_arr->_unregister_observer (this); + p_arr->_unregister_observer(this); } //@} @@ -95,132 +90,96 @@ public: //@{ /*! Get the associated arrangement (non-const version). */ - const Arrangement_2* arrangement () const - { - return (p_arr); - } + const Arrangement_2* arrangement() const { return (p_arr); } /*! Get the associated arrangement (non-const version). */ - Arrangement_2* arrangement () - { - return (p_arr); - } + Arrangement_2* arrangement() { return (p_arr); } - /*! - * Attach the observer to an arrangement. + /*! Attach the observer to an arrangement. * \pre The observer is not already attached to an arrangement. */ - void attach (Arrangement_2& arr) + void attach(Arrangement_2& arr) { // Do nothing if the associated arrangement is not changed. - if (p_arr == &arr) - return; + if (p_arr == &arr) return; // The observer is not already attached to an arrangement. - CGAL_precondition (p_arr == NULL); + CGAL_precondition(p_arr == NULL); - if (p_arr != NULL) - return; + if (p_arr != NULL) return; // Notify the concrete oberver (the sub-class) about the attachment. - before_attach (arr); + before_attach(arr); // Register the observer object in the new arrangement. p_arr = &arr; - p_arr->_register_observer (this); + p_arr->_register_observer(this); // Notify the concrete oberver that the attachment took place. after_attach(); - - return; } /*! Detach the observer from the arrangement. */ - void detach () + void detach() { - if (p_arr == NULL) - return; + if (p_arr == NULL) return; // Notify the concrete oberver (the sub-class) about the detachment. before_detach (); // Unregister the observer object from the current arrangement, and mark // that the oberver is not attached to an arrangement. - p_arr->_unregister_observer (this); + p_arr->_unregister_observer(this); p_arr = NULL; - + // Notify the concrete oberver that the detachment took place. after_detach(); - - return; } //@} /// \name Notification functions on global arrangement operations. //@{ - /*! - * Notification before the arrangement is assigned with another + /*! Notification before the arrangement is assigned with another * arrangement. * \param arr The arrangement to be copied. */ - virtual void before_assign (const Arrangement_2& /* arr */) - {} + virtual void before_assign(const Arrangement_2& /* arr */) {} - /*! - * Notification after the arrangement has been assigned with another + /*! Notification after the arrangement has been assigned with another * arrangement. */ - virtual void after_assign () - {} + virtual void after_assign() {} /*! Notification before the arrangement is cleared. */ - virtual void before_clear () - {} + virtual void before_clear() {} - /*! - * Notification after the arrangement is cleared. - */ - virtual void after_clear () - {} + /*! Notification after the arrangement is cleared. */ + virtual void after_clear() {} /*! Notification before a global operation modifies the arrangement. */ - virtual void before_global_change () - {} + virtual void before_global_change() {} /*! Notification after a global operation is completed. */ - virtual void after_global_change () - {} + virtual void after_global_change() {} //@} /// \name Notification functions on observer attachment or detachment. //@{ - /*! - * Notification before the observer is attached to an arrangement. + /*! Notification before the observer is attached to an arrangement. * \param arr The arrangement we are about to attach the observer to. */ - virtual void before_attach (const Arrangement_2& /* arr */) - {} + virtual void before_attach(const Arrangement_2& /* arr */) {} - /*! - * Notification after the observer has been attached to an arrangement. - */ - virtual void after_attach () - {} + /*! Notification after the observer has been attached to an arrangement. */ + virtual void after_attach() {} - /*! - * Notification before the observer is detached from the arrangement. - */ - virtual void before_detach () - {} + /*! Notification before the observer is detached from the arrangement. */ + virtual void before_detach() {} - /*! - * Notification after the observer has been detached to the arrangement. - */ - virtual void after_detach () - - {} + /*! Notification after the observer has been detached to the arrangement. */ + virtual void after_detach() {} //@} /// \name Notification functions on local changes in the arrangement. @@ -231,449 +190,388 @@ public: * \param p The point to be associated with the vertex. * This point cannot lies on the surface boundaries. */ - virtual void before_create_vertex (const Point_2& /* p */) - {} + virtual void before_create_vertex(const Point_2& /* p */) {} - /*! - * Notification after the creation of a new vertex. + /*! Notification after the creation of a new vertex. * \param v A handle to the created vertex. */ - virtual void after_create_vertex (Vertex_handle /* v */) + virtual void after_create_vertex(Vertex_handle /* v */) {} - /*! - * Notification before the creation of a new boundary vertex. + /*! Notification before the creation of a new boundary vertex. + * \param p The on the surface boundary. + * \param ps_x The boundary condition of the vertex in x. + * \param ps_y The boundary condition of the vertex in y. + */ + virtual void before_create_boundary_vertex(const Point_2& /* p */, + Arr_parameter_space /* ps_x */, + Arr_parameter_space /* ps_y */) + {} + + /*! Notification before the creation of a new boundary vertex. * \param cv The curve incident to the surface boundary. * \param ind The relevant curve-end. * \param ps_x The boundary condition of the vertex in x. * \param ps_y The boundary condition of the vertex in y. */ - virtual void before_create_boundary_vertex (const X_monotone_curve_2& /*cv*/, - Arr_curve_end /* ind */, - Arr_parameter_space /* ps_x */, - Arr_parameter_space /* ps_y */) + virtual void before_create_boundary_vertex(const X_monotone_curve_2& /* cv */, + Arr_curve_end /* ind */, + Arr_parameter_space /* ps_x */, + Arr_parameter_space /* ps_y */) {} - /*! - * Notification after the creation of a new vertex at infinity. + /*! Notification after the creation of a new vertex at infinity. * \param v A handle to the created vertex. */ - virtual void after_create_boundary_vertex (Vertex_handle /* v */) - {} + virtual void after_create_boundary_vertex(Vertex_handle /* v */) {} - /*! - * Notification before the creation of a new edge. + /*! Notification before the creation of a new edge. * \param c The x-monotone curve to be associated with the edge. * \param v1 A handle to the first end-vertex of the edge. * \param v2 A handle to the second end-vertex of the edge. */ - virtual void before_create_edge (const X_monotone_curve_2& /* c */, - Vertex_handle /* v1 */, - Vertex_handle /* v2 */) + virtual void before_create_edge(const X_monotone_curve_2& /* c */, + Vertex_handle /* v1 */, + Vertex_handle /* v2 */) {} - /*! - * Notification after the creation of a new edge. + /*! Notification after the creation of a new edge. * \param e A handle to one of the twin halfedges that were created. */ - virtual void after_create_edge (Halfedge_handle /* e */) - {} + virtual void after_create_edge(Halfedge_handle /* e */) {} - /*! - * Notification before the modification of an existing vertex. + /*! Notification before the modification of an existing vertex. * \param v A handle to the vertex to be updated. * \param p The point to be associated with the vertex. */ - virtual void before_modify_vertex (Vertex_handle /* v */, - const Point_2& /* p */) + virtual void before_modify_vertex(Vertex_handle /* v */, + const Point_2& /* p */) {} - /*! - * Notification after a vertex was modified. + /*! Notification after a vertex was modified. * \param v A handle to the updated vertex. */ - virtual void after_modify_vertex (Vertex_handle /* v */) - {} + virtual void after_modify_vertex(Vertex_handle /* v */) {} - /*! - * Notification before the modification of an existing edge. + /*! Notification before the modification of an existing edge. * \param e A handle to one of the twin halfedges to be updated. * \param c The x-monotone curve to be associated with the edge. */ - virtual void before_modify_edge (Halfedge_handle /* e */, - const X_monotone_curve_2& /* c */) + virtual void before_modify_edge(Halfedge_handle /* e */, + const X_monotone_curve_2& /* c */) {} - /*! - * Notification after an edge was modified. + /*! Notification after an edge was modified. * \param e A handle to one of the twin halfedges that were updated. */ - virtual void after_modify_edge (Halfedge_handle /* e */) - {} + virtual void after_modify_edge(Halfedge_handle /* e */) {} - /*! - * Notification before the splitting of an edge into two. + /*! Notification before the splitting of an edge into two. * \param e A handle to one of the existing halfedges. * \param v A vertex representing the split point. * \param c1 The x-monotone curve to be associated with the first edge. * \param c2 The x-monotone curve to be associated with the second edge. */ - virtual void before_split_edge (Halfedge_handle /* e */, - Vertex_handle /* v */, - const X_monotone_curve_2& /* c1 */, - const X_monotone_curve_2& /* c2 */) + virtual void before_split_edge(Halfedge_handle /* e */, + Vertex_handle /* v */, + const X_monotone_curve_2& /* c1 */, + const X_monotone_curve_2& /* c2 */) {} - /*! - * Notification after an edge was split. + /*! Notification after an edge was split. * \param e1 A handle to one of the twin halfedges forming the first edge. * \param e2 A handle to one of the twin halfedges forming the second edge. */ - virtual void after_split_edge (Halfedge_handle /* e1 */, - Halfedge_handle /* e2 */) + virtual void after_split_edge(Halfedge_handle /* e1 */, + Halfedge_handle /* e2 */) {} - /*! - * Notification before the splitting of a fictitious edge into two. + /*! Notification before the splitting of a fictitious edge into two. * \param e A handle to one of the existing halfedges. * \param v A vertex representing the unbounded split point. */ - virtual void before_split_fictitious_edge (Halfedge_handle /* e */, - Vertex_handle /* v */) + virtual void before_split_fictitious_edge(Halfedge_handle /* e */, + Vertex_handle /* v */) {} - /*! - * Notification after a fictitious edge was split. + /*! Notification after a fictitious edge was split. * \param e1 A handle to one of the twin halfedges forming the first edge. * \param e2 A handle to one of the twin halfedges forming the second edge. */ - virtual void after_split_fictitious_edge (Halfedge_handle /* e1 */, - Halfedge_handle /* e2 */) + virtual void after_split_fictitious_edge(Halfedge_handle /* e1 */, + Halfedge_handle /* e2 */) {} - /*! - * Notification before the splitting of a face into two. + /*! Notification before the splitting of a face into two. * \param f A handle to the existing face. * \param e The new edge whose insertion causes the face to split. */ - virtual void before_split_face (Face_handle /* f */, - Halfedge_handle /* e */) + virtual void before_split_face(Face_handle /* f */, + Halfedge_handle /* e */) {} - /*! - * Notification after a face was split. + /*! Notification after a face was split. * \param f A handle to the face we have just split. * \param new_f A handle to the new face that has been created. * \param is_hole Whether the new face forms a hole inside f. */ - virtual void after_split_face (Face_handle /* f */, - Face_handle /* new_f */, + virtual void after_split_face(Face_handle /* f */, + Face_handle /* new_f */, bool /* is_hole */) {} - /*! - * Notification before the splitting of an outer CCB into two. + /*! Notification before the splitting of an outer CCB into two. * \param f A handle to the face that owns the outer CCB. * \param h A circulator representing the component boundary. * \param e The new edge whose removal causes the outer CCB to split. */ - virtual void before_split_outer_ccb (Face_handle /* f */, - Ccb_halfedge_circulator /* h */, - Halfedge_handle /* e */) + virtual void before_split_outer_ccb(Face_handle /* f */, + Ccb_halfedge_circulator /* h */, + Halfedge_handle /* e */) {} - /*! - * Notification after an outer CCB was split. + /*! Notification after an outer CCB was split. * \param f A handle to the face that owns the outer CCBs. * \param h1 A circulator representing the boundary of the first component. * \param h2 A circulator representing the boundary of the second component. */ - virtual void after_split_outer_ccb (Face_handle /* f */, - Ccb_halfedge_circulator /* h1 */, - Ccb_halfedge_circulator /* h2 */) + virtual void after_split_outer_ccb(Face_handle /* f */, + Ccb_halfedge_circulator /* h1 */, + Ccb_halfedge_circulator /* h2 */) {} - /*! - * Notification before the splitting of an inner CCB into two. + /*! Notification before the splitting of an inner CCB into two. * \param f A handle to the face containing the inner CCB. * \param h A circulator representing the component boundary. * \param e The new edge whose removal causes the inner CCB to split. */ - virtual void before_split_inner_ccb (Face_handle /* f */, - Ccb_halfedge_circulator /* h */, - Halfedge_handle /* e */) + virtual void before_split_inner_ccb(Face_handle /* f */, + Ccb_halfedge_circulator /* h */, + Halfedge_handle /* e */) {} - /*! - * Notification after an inner CCB was split. + /*! Notification after an inner CCB was split. * \param f A handle to the face containing the inner CCBs. * \param h1 A circulator representing the boundary of the first component. * \param h2 A circulator representing the boundary of the second component. */ - virtual void after_split_inner_ccb (Face_handle /* f */, - Ccb_halfedge_circulator /* h1 */, - Ccb_halfedge_circulator /* h2 */) + virtual void after_split_inner_ccb(Face_handle /* f */, + Ccb_halfedge_circulator /* h1 */, + Ccb_halfedge_circulator /* h2 */) {} - /*! - * Notification before the creation of a new outer CCB of a face. + /*! Notification before the creation of a new outer CCB of a face. * \param f A handle to the face that owns the outer CCB. * \param e A halfedge along the new outer CCB. */ - virtual void before_add_outer_ccb (Face_handle /* f */, - Halfedge_handle /* e */) + virtual void before_add_outer_ccb(Face_handle /* f */, + Halfedge_handle /* e */) {} - /*! - * Notification after an outer CCB was added to a face. + /*! Notification after an outer CCB was added to a face. * \param h A circulator representing the boundary of the new outer CCB. */ - virtual void after_add_outer_ccb (Ccb_halfedge_circulator /* h */) - {} + virtual void after_add_outer_ccb(Ccb_halfedge_circulator /* h */) {} - /*! - * Notification before the creation of a new inner CCB inside a face. + /*! Notification before the creation of a new inner CCB inside a face. * \param f A handle to the face containing the inner CCB. * \param e The new halfedge that forms the new inner CCB. */ - virtual void before_add_inner_ccb (Face_handle /* f */, - Halfedge_handle /* e */) + virtual void before_add_inner_ccb(Face_handle /* f */, + Halfedge_handle /* e */) {} - /*! - * Notification after an inner CCB was created inside a face. + /*! Notification after an inner CCB was created inside a face. * \param h A circulator representing the boundary of the new inner CCB. */ - virtual void after_add_inner_ccb (Ccb_halfedge_circulator /* h */) - {} + virtual void after_add_inner_ccb(Ccb_halfedge_circulator /* h */) {} - /*! - * Notification before the creation of a new isolated vertex inside a face. + /*! Notification before the creation of a new isolated vertex inside a face. * \param f A handle to the face containing the isolated vertex. * \param v The isolated vertex. */ - virtual void before_add_isolated_vertex (Face_handle /* f */, - Vertex_handle /* v */) + virtual void before_add_isolated_vertex(Face_handle /* f */, + Vertex_handle /* v */) {} - /*! - * Notification after an isolated vertex was created inside a face. + /*! Notification after an isolated vertex was created inside a face. * \param v The isolated vertex. */ - virtual void after_add_isolated_vertex (Vertex_handle /* v */) - {} + virtual void after_add_isolated_vertex(Vertex_handle /* v */) {} - /*! - * Notification before the merging of two edges. + /*! Notification before the merging of two edges. * \param e1 A handle to one of the halfedges forming the first edge. * \param e2 A handle to one of the halfedges forming the second edge. * \param c The x-monotone curve to be associated with the merged edge. */ - virtual void before_merge_edge (Halfedge_handle /* e1 */, - Halfedge_handle /* e2 */, - const X_monotone_curve_2& /* c */) + virtual void before_merge_edge(Halfedge_handle /* e1 */, + Halfedge_handle /* e2 */, + const X_monotone_curve_2& /* c */) {} - /*! - * Notification after an edge was merged. + /*! Notification after an edge was merged. * \param e A handle to one of the twin halfedges forming the merged edge. */ - virtual void after_merge_edge (Halfedge_handle /* e */) - {} + virtual void after_merge_edge(Halfedge_handle /* e */) {} - /*! - * Notification before the merging of two fictitious edges. + /*! Notification before the merging of two fictitious edges. * \param e1 A handle to one of the halfedges forming the first edge. * \param e2 A handle to one of the halfedges forming the second edge. */ - virtual void before_merge_fictitious_edge (Halfedge_handle /* e1 */, - Halfedge_handle /* e2 */) + virtual void before_merge_fictitious_edge(Halfedge_handle /* e1 */, + Halfedge_handle /* e2 */) {} - /*! - * Notification after a fictitious edge was merged. + /*! Notification after a fictitious edge was merged. * \param e A handle to one of the twin halfedges forming the merged edge. */ - virtual void after_merge_fictitious_edge (Halfedge_handle /* e */) - {} + virtual void after_merge_fictitious_edge(Halfedge_handle /* e */) {} - /*! - * Notification before the merging of two faces. + /*! Notification before the merging of two faces. * \param f1 A handle to the first face. * \param f2 A handle to the second face. * \param e The edge whose removal causes the faces to merge. */ - virtual void before_merge_face (Face_handle /* f1 */, - Face_handle /* f2 */, - Halfedge_handle /* e */) + virtual void before_merge_face(Face_handle /* f1 */, + Face_handle /* f2 */, + Halfedge_handle /* e */) {} - /*! - * Notification after a face was merged. + /*! Notification after a face was merged. * \param f A handle to the merged face. */ - virtual void after_merge_face (Face_handle /* f */) - {} + virtual void after_merge_face(Face_handle /* f */) {} - /*! - * Notification before the merging of two outer CCBs. + /*! Notification before the merging of two outer CCBs. * \param f A handle to the face that owns the outer CCBs. * \param h1 A circulator representing the boundary of the first component. * \param h2 A circulator representing the boundary of the second component. * \param e The edge whose insertion or removal causes the CCBs to merge. */ - virtual void before_merge_outer_ccb (Face_handle /* f */, - Ccb_halfedge_circulator /* h1 */, - Ccb_halfedge_circulator /* h2 */, - Halfedge_handle /* e */) + virtual void before_merge_outer_ccb(Face_handle /* f */, + Ccb_halfedge_circulator /* h1 */, + Ccb_halfedge_circulator /* h2 */, + Halfedge_handle /* e */) {} - /*! - * Notification after an outer CCB was merged. + /*! Notification after an outer CCB was merged. * \param f A handle to the face that owns the outer CCBs. * \param h A circulator representing the boundary of the merged component. */ - virtual void after_merge_outer_ccb (Face_handle /* f */, - Ccb_halfedge_circulator /* h */) + virtual void after_merge_outer_ccb(Face_handle /* f */, + Ccb_halfedge_circulator /* h */) {} - /*! - * Notification before the merging of two inner CCBs (holes). + /*! Notification before the merging of two inner CCBs (holes). * \param f A handle to the face that contains the inner CCBs. * \param h1 A circulator representing the boundary of the first component. * \param h2 A circulator representing the boundary of the second component. * \param e The edge whose insertion causes the inner CCBs to merge. */ - virtual void before_merge_inner_ccb (Face_handle /* f */, - Ccb_halfedge_circulator /* h1 */, - Ccb_halfedge_circulator /* h2 */, - Halfedge_handle /* e */) + virtual void before_merge_inner_ccb(Face_handle /* f */, + Ccb_halfedge_circulator /* h1 */, + Ccb_halfedge_circulator /* h2 */, + Halfedge_handle /* e */) {} - /*! - * Notification after an inner CCB was merged. + /*! Notification after an inner CCB was merged. * \param f A handle to the face that contains the inner CCBs. * \param h A circulator representing the boundary of the merged component. */ - virtual void after_merge_inner_ccb (Face_handle /* f */, - Ccb_halfedge_circulator /* h */) + virtual void after_merge_inner_ccb(Face_handle /* f */, + Ccb_halfedge_circulator /* h */) {} - /*! - * Notification before an outer CCB is moved from one face to another. + /*! Notification before an outer CCB is moved from one face to another. * \param from_f A handle to the face that currently owns the outer CCB. * \param to_f A handle to the face that should own the outer CCB. * \param h A circulator representing the boundary of the component. */ - virtual void before_move_outer_ccb (Face_handle /* from_f */, - Face_handle /* to_f */, - Ccb_halfedge_circulator /* h */) + virtual void before_move_outer_ccb(Face_handle /* from_f */, + Face_handle /* to_f */, + Ccb_halfedge_circulator /* h */) {} - /*! - * Notification after an outer CCB is moved from one face to another. + /*! Notification after an outer CCB is moved from one face to another. * \param h A circulator representing the boundary of the component. */ - virtual void after_move_outer_ccb (Ccb_halfedge_circulator /* h */) - {} + virtual void after_move_outer_ccb(Ccb_halfedge_circulator /* h */) {} - /*! - * Notification before an inner CCB is moved from one face to another. + /*! Notification before an inner CCB is moved from one face to another. * \param from_f A handle to the face currently containing the inner CCB. * \param to_f A handle to the face that should contain the inner CCB. * \param h A circulator representing the boundary of the component. */ - virtual void before_move_inner_ccb (Face_handle /* from_f */, - Face_handle /* to_f */, - Ccb_halfedge_circulator /* h */) + virtual void before_move_inner_ccb(Face_handle /* from_f */, + Face_handle /* to_f */, + Ccb_halfedge_circulator /* h */) {} /*! * Notification after an inner CCB is moved from one face to another. * \param h A circulator representing the boundary of the component. */ - virtual void after_move_inner_ccb (Ccb_halfedge_circulator /* h */) - {} + virtual void after_move_inner_ccb(Ccb_halfedge_circulator /* h */) {} - /*! - * Notification before an isolated vertex is moved from one face to another. + /*! Notification before an isolated vertex is moved from one face to another. * \param from_f A handle to the face currently containing the vertex. * \param to_f A handle to the face that should contain the vertex. * \param v The isolated vertex. */ - virtual void before_move_isolated_vertex (Face_handle /* from_f */, - Face_handle /* to_f */, - Vertex_handle /* v */) + virtual void before_move_isolated_vertex(Face_handle /* from_f */, + Face_handle /* to_f */, + Vertex_handle /* v */) {} - /*! - * Notification after an isolated vertex is moved from one face to another. + /*! Notification after an isolated vertex is moved from one face to another. * \param v The isolated vertex. */ - virtual void after_move_isolated_vertex (Vertex_handle /* v */) - {} + virtual void after_move_isolated_vertex(Vertex_handle /* v */) {} - /*! - * Notificaion before the removal of a vertex. + /*! Notificaion before the removal of a vertex. * \param v A handle to the vertex to be deleted. */ - virtual void before_remove_vertex (Vertex_handle /* v */) - {} + virtual void before_remove_vertex(Vertex_handle /* v */) {} - /*! - * Notificaion after the removal of a vertex. - */ - virtual void after_remove_vertex () - {} + /*! Notificaion after the removal of a vertex. */ + virtual void after_remove_vertex() {} - /*! - * Notification before the removal of an edge. + /*! Notification before the removal of an edge. * \param e A handle to one of the twin halfedges to be deleted. */ - virtual void before_remove_edge (Halfedge_handle /* e */) - {} + virtual void before_remove_edge(Halfedge_handle /* e */) {} - /*! - * Notificaion after the removal of an edge. - */ - virtual void after_remove_edge () - {} + /*! Notificaion after the removal of an edge. */ + virtual void after_remove_edge() {} - /*! - * Notification before the removal of an outer CCB. + /*! Notification before the removal of an outer CCB. * \param f The face that owns the outer CCB. * \param h A circulator representing the boundary of the component. */ - virtual void before_remove_outer_ccb (Face_handle /* f */, - Ccb_halfedge_circulator /* h */) + virtual void before_remove_outer_ccb(Face_handle /* f */, + Ccb_halfedge_circulator /* h */) {} - /*! - * Notificaion after the removal of an outer CCB. + /*! Notificaion after the removal of an outer CCB. * \param f The face that used to own the outer CCB. */ - virtual void after_remove_outer_ccb (Face_handle /* f */) - {} + virtual void after_remove_outer_ccb(Face_handle /* f */) {} - /*! - * Notification before the removal of an inner CCB. + /*! Notification before the removal of an inner CCB. * \param f The face containing the inner CCB. * \param h A circulator representing the boundary of the component. */ - virtual void before_remove_inner_ccb (Face_handle /* f */, - Ccb_halfedge_circulator /* h */) + virtual void before_remove_inner_ccb(Face_handle /* f */, + Ccb_halfedge_circulator /* h */) {} - /*! - * Notificaion after the removal of an inner CCB. + /*! Notificaion after the removal of an inner CCB. * \param f The face that used to contain the inner CCB. */ - virtual void after_remove_inner_ccb (Face_handle /* f */) - {} + virtual void after_remove_inner_ccb(Face_handle /* f */) {} //@} - }; } //namespace CGAL 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 6ccc00ce76b..393b767968d 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 @@ -39,10 +39,8 @@ namespace CGAL { * A traits-class decorator for the use of the batched point-location process. */ template -class Arr_batched_point_location_traits_2 -{ +class Arr_batched_point_location_traits_2 { public: - typedef Arrangement_ Arrangement_2; typedef typename Arrangement_2::Geometry_traits_2 Base_traits_2; @@ -67,13 +65,13 @@ public: typedef typename Base_traits_2::Has_do_intersect_category Has_do_intersect_category; - typedef typename internal::Arr_complete_left_side_category< Base_traits_2 >::Category + typedef typename internal::Arr_complete_left_side_category::Category Left_side_category; - typedef typename internal::Arr_complete_bottom_side_category< Base_traits_2 >::Category + typedef typename internal::Arr_complete_bottom_side_category::Category Bottom_side_category; - typedef typename internal::Arr_complete_top_side_category< Base_traits_2 >::Category + typedef typename internal::Arr_complete_top_side_category::Category Top_side_category; - typedef typename internal::Arr_complete_right_side_category< Base_traits_2 >::Category + typedef typename internal::Arr_complete_right_side_category::Category Right_side_category; /* Overlay is implemented as sweep-line visitor. The sweep-line algorithm @@ -84,147 +82,105 @@ public: typedef Tag_false Has_merge_category; protected: - - const Base_traits_2* m_base_traits; + const Base_traits_2* m_base_traits; public: - /*! Constructor. */ - Arr_batched_point_location_traits_2 (const Base_traits_2& tr) : - m_base_traits (&tr) + Arr_batched_point_location_traits_2(const Base_traits_2& tr) : + m_base_traits(&tr) {} /*! \class * Nested extension of the x-monotone curve type. */ - class Ex_x_monotone_curve_2 - { + class Ex_x_monotone_curve_2 { public: - typedef Base_x_monotone_curve_2 Base; protected: - Base_x_monotone_curve_2 m_base_xcv; // The base x-monotone curve. Halfedge_const_handle m_he; // The corresponding arrangement edge. public: - - Ex_x_monotone_curve_2 (): + Ex_x_monotone_curve_2(): m_base_xcv(), m_he() {} - Ex_x_monotone_curve_2 (const Base& xcv): + Ex_x_monotone_curve_2(const Base& xcv): m_base_xcv(xcv), m_he() {} - Ex_x_monotone_curve_2 (const Base& xcv, Halfedge_const_handle he) : + Ex_x_monotone_curve_2(const Base& xcv, Halfedge_const_handle he) : m_base_xcv(xcv), m_he(he) { - CGAL_precondition (he->direction() == ARR_RIGHT_TO_LEFT); + CGAL_precondition(he->direction() == ARR_RIGHT_TO_LEFT); } - Halfedge_const_handle halfedge_handle() const - { - return (m_he); - } + Halfedge_const_handle halfedge_handle() const { return (m_he); } - const Base& base () const - { - return (m_base_xcv); - } + const Base& base() const { return (m_base_xcv); } - Base& base () - { - return (m_base_xcv); - } + Base& base() { return (m_base_xcv); } - operator const Base&() const - { - return (m_base_xcv); - } - - operator Base&() - { - return (m_base_xcv); - } + operator const Base&() const { return (m_base_xcv); } + operator Base&() { return (m_base_xcv); } }; /*! \class * Nested extension of the point type. */ - class Ex_point_2 - { + class Ex_point_2 { public: - typedef Base_point_2 Base; protected: - Base m_base_pt; // The base point. Vertex_const_handle m_v; // The corresponding arrangement vertex. public: - - Ex_point_2 (): + Ex_point_2() : m_base_pt(), m_v() {} - Ex_point_2 (const Base& pt): - m_base_pt (pt), + Ex_point_2(const Base& pt) : + m_base_pt(pt), m_v() {} - Ex_point_2 (const Base& pt, Vertex_const_handle v): - m_base_pt (pt), - m_v (v) + Ex_point_2(const Base& pt, Vertex_const_handle v) : + m_base_pt(pt), + m_v(v) {} - const Base& base() const - { - return (m_base_pt); - } + const Base& base() const { return (m_base_pt); } - Base& base() - { - return (m_base_pt); - } + Base& base() { return (m_base_pt); } - operator const Base&() const - { - return (m_base_pt); - } + operator const Base&() const { return (m_base_pt); } - operator Base&() - { - return (m_base_pt); - } + operator Base&() { return (m_base_pt); } - Vertex_const_handle vertex_handle() const - { - return m_v; - } + Vertex_const_handle vertex_handle() const { return m_v; } }; typedef Ex_x_monotone_curve_2 X_monotone_curve_2; typedef Ex_point_2 Point_2; // For debugging purposes: - friend std::ostream& operator<< (std::ostream& os, - const X_monotone_curve_2& xcv) + friend std::ostream& operator<<(std::ostream& os, + const X_monotone_curve_2& xcv) { os << xcv.base(); return (os); } // For debugging purposes: - friend std::ostream& operator<< (std::ostream& os, - const Point_2& pt) + friend std::ostream& operator<<(std::ostream& os, const Point_2& pt) { os << pt.base(); return (os); @@ -241,7 +197,7 @@ public: * obtaining function, which is a member of the nesting class, * constructing it. */ - Construct_min_vertex_2 (const Base_construct_min_vertex_2& base): + Construct_min_vertex_2(const Base_construct_min_vertex_2& base): m_base_min_v(base) {} @@ -254,20 +210,20 @@ public: * \param xcv The curve. * \return The left endpoint. */ - Point_2 operator() (const X_monotone_curve_2 & xcv) + Point_2 operator()(const X_monotone_curve_2& xcv) { // Note that the halfedge associated with the curve is always directed // from right to left, so its target is the leftmost vertex. Vertex_const_handle vh = xcv.halfedge_handle()->target(); - return (Point_2 (m_base_min_v (xcv.base()), vh)); + return (Point_2(m_base_min_v(xcv.base()), vh)); } }; /*! Obtain a Construct_min_vertex_2 functor object. */ - Construct_min_vertex_2 construct_min_vertex_2_object () const + Construct_min_vertex_2 construct_min_vertex_2_object() const { return - Construct_min_vertex_2 (m_base_traits->construct_min_vertex_2_object()); + Construct_min_vertex_2(m_base_traits->construct_min_vertex_2_object()); } /*! A functor that obtains the right endpoint of an x-monotone curve. */ @@ -281,7 +237,7 @@ public: * obtaining function, which is a member of the nesting class, * constructing it. */ - Construct_max_vertex_2 (const Base_construct_max_vertex_2& base): + Construct_max_vertex_2(const Base_construct_max_vertex_2& base) : m_base_max_v(base) {} @@ -294,29 +250,29 @@ public: * \param xcv The curve. * \return The right endpoint. */ - Point_2 operator() (const X_monotone_curve_2 & xcv) + Point_2 operator()(const X_monotone_curve_2& xcv) { // Note that the halfedge associated with the curve is always directed // from right to left, so its source is the rightmost vertex. Vertex_const_handle vh = xcv.halfedge_handle()->source(); - return (Point_2 (m_base_max_v (xcv.base()), vh)); + return (Point_2(m_base_max_v (xcv.base()), vh)); } }; /*! Obtain a Construct_min_vertex_2 functor object. */ - Construct_max_vertex_2 construct_max_vertex_2_object () const + Construct_max_vertex_2 construct_max_vertex_2_object() const { return - Construct_max_vertex_2 (m_base_traits->construct_max_vertex_2_object()); + Construct_max_vertex_2(m_base_traits->construct_max_vertex_2_object()); } /*! A functor that compares two points lexigoraphically: by x, then by y. */ class Compare_xy_2 { protected: //! The base operator. - Base_compare_xy_2 m_base_cmp_xy; + Base_compare_xy_2 m_base_cmp_xy; - Vertex_const_handle invalid_v; + Vertex_const_handle invalid_v; /*! Constructor. * The constructor is declared private to allow only the functor @@ -337,21 +293,19 @@ public: * \param xcv The curve. * \return The left endpoint. */ - Comparison_result operator() (const Point_2& p1, const Point_2& p2) const + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { if (p1.vertex_handle() == p2.vertex_handle() && p1.vertex_handle() != invalid_v) return (EQUAL); - return (m_base_cmp_xy (p1.base(), p2.base())); + return (m_base_cmp_xy(p1.base(), p2.base())); } }; /*! Obtain a Construct_min_vertex_2 functor object. */ - Compare_xy_2 compare_xy_2_object () const - { - return Compare_xy_2(m_base_traits->compare_xy_2_object()); - } + Compare_xy_2 compare_xy_2_object() const + { return Compare_xy_2(m_base_traits->compare_xy_2_object()); } /*! A functor that compares the y-coordinates of a point and an * x-monotone curve at the point x-coordinate. @@ -374,18 +328,14 @@ public: friend class Arr_batched_point_location_traits_2; public: - Comparison_result operator() (const Point_2& p, - const X_monotone_curve_2& xcv) const - { - return (m_base_cmp_y_at_x (p.base(), xcv.base())); - } + Comparison_result operator()(const Point_2& p, + const X_monotone_curve_2& xcv) const + { return (m_base_cmp_y_at_x(p.base(), xcv.base())); } }; /*! Obtain a Compare_y_at_x_2 function object. */ - Compare_y_at_x_2 compare_y_at_x_2_object () const - { - return (Compare_y_at_x_2 (m_base_traits->compare_y_at_x_2_object())); - } + Compare_y_at_x_2 compare_y_at_x_2_object() const + { return (Compare_y_at_x_2(m_base_traits->compare_y_at_x_2_object())); } /*! A functor that compares compares the y-coordinates of two x-monotone * curves immediately to the right of their intersection point. @@ -408,16 +358,14 @@ public: friend class Arr_batched_point_location_traits_2; public: - Comparison_result operator() (const X_monotone_curve_2& xcv1, - 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())); - } + Comparison_result operator()(const X_monotone_curve_2& xcv1, + 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())); } }; /*! Obtain a Compare_y_at_x_right_2 function object. */ - Compare_y_at_x_right_2 compare_y_at_x_right_2_object () const + Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const { return (Compare_y_at_x_right_2 (m_base_traits->compare_y_at_x_right_2_object())); @@ -450,8 +398,8 @@ public: public: /*! Check if two curves are the same. */ - bool operator() (const X_monotone_curve_2& xcv1, - const X_monotone_curve_2& xcv2) const + bool operator()(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2) const { if (xcv1.halfedge_handle() == xcv2.halfedge_handle() && xcv1.halfedge_handle() != invalid_he) @@ -461,7 +409,7 @@ public: } /*! Check if the two points are the same. */ - bool operator() (const Point_2& p1, const Point_2& p2) const + bool operator()(const Point_2& p1, const Point_2& p2) const { if (p1.vertex_handle() == p2.vertex_handle() && p1.vertex_handle() != invalid_v) @@ -472,10 +420,8 @@ public: }; /*! Obtain a Equal_2 function object. */ - Equal_2 equal_2_object () const - { - return (Equal_2 (m_base_traits->equal_2_object())); - } + Equal_2 equal_2_object() const + { return (Equal_2(m_base_traits->equal_2_object())); } /*! A functor that compares the x-coordinates of two points */ class Compare_x_2 { @@ -494,17 +440,13 @@ public: friend class Arr_batched_point_location_traits_2; public: - Comparison_result operator() (const Point_2& p1, const Point_2& p2) const - { - return (m_base_cmp_x(p1.base(), p2.base())); - } + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const + { return (m_base_cmp_x(p1.base(), p2.base())); } }; /*! Obtain a Compare_x_2 function object. */ - Compare_x_2 compare_x_2_object () const - { - return (Compare_x_2 (m_base_traits->compare_x_2_object())); - } + Compare_x_2 compare_x_2_object() const + { return (Compare_x_2(m_base_traits->compare_x_2_object())); } /*! A functor that checks whether a given x-monotone curve is vertical. */ class Is_vertical_2 { @@ -523,17 +465,13 @@ public: friend class Arr_batched_point_location_traits_2; public: - bool operator() (const X_monotone_curve_2& xcv) const - { - return (m_base_is_vert(xcv.base())); - } + bool operator()(const X_monotone_curve_2& xcv) const + { return (m_base_is_vert(xcv.base())); } }; /*! Obtain a Is_vertical_2 function object. */ Is_vertical_2 is_vertical_2_object() const - { - return (Is_vertical_2(m_base_traits->is_vertical_2_object())); - } + { return (Is_vertical_2(m_base_traits->is_vertical_2_object())); } // left-right @@ -544,42 +482,33 @@ public: class Parameter_space_in_x_2 { protected: //! The base traits. - const Base_traits_2 *m_base; + const Base_traits_2* m_base; /*! Constructor. * The constructor is declared private to allow only the functor * obtaining function, which is a member of the nesting class, * constructing it. */ - Parameter_space_in_x_2 (const Base_traits_2 *tr) : m_base (tr) {} + Parameter_space_in_x_2(const Base_traits_2* tr) : m_base(tr) {} //! Allow its functor obtaining function calling the private constructor. friend class Arr_batched_point_location_traits_2; public: - Arr_parameter_space operator() (const X_monotone_curve_2& xcv, - Arr_curve_end ce) const - { - return m_base->parameter_space_in_x_2_object() (xcv.base(), ce); - } + Arr_parameter_space operator()(const X_monotone_curve_2& xcv, + Arr_curve_end ce) const + { return m_base->parameter_space_in_x_2_object() (xcv.base(), ce); } - Arr_parameter_space operator() (const Point_2 & p) const - { - return m_base->parameter_space_in_x_2_object() (p.base()); - } + Arr_parameter_space operator()(const Point_2& p) const + { return m_base->parameter_space_in_x_2_object() (p.base()); } - Arr_parameter_space operator() (const X_monotone_curve_2 & xcv) const - { - return m_base->parameter_space_in_x_2_object() (xcv.base()); - } + Arr_parameter_space operator()(const X_monotone_curve_2& xcv) const + { return m_base->parameter_space_in_x_2_object() (xcv.base()); } }; /*! Obtain a Parameter_space_in_x_2 function object */ - Parameter_space_in_x_2 parameter_space_in_x_2_object () const - { - return Parameter_space_in_x_2 (m_base_traits); - } - + Parameter_space_in_x_2 parameter_space_in_x_2_object() const + { return Parameter_space_in_x_2(m_base_traits); } /*! A function object that determines whether an x-monotone curve or a * point coincide with the vertical identification curve. @@ -587,35 +516,29 @@ public: class Is_on_x_identification_2 { protected: //! The base traits. - const Base_traits_2 *m_base; + const Base_traits_2* m_base; /*! Constructor. * The constructor is declared private to allow only the functor * obtaining function, which is a member of the nesting class, * constructing it. */ - Is_on_x_identification_2 (const Base_traits_2* tr) : m_base (tr) {} + Is_on_x_identification_2(const Base_traits_2* tr) : m_base(tr) {} //! Allow its functor obtaining function calling the private constructor. friend class Arr_batched_point_location_traits_2; public: - bool operator() (const Point_2 & p) const - { - return m_base->is_on_x_identification_2_object() (p.base()); - } + bool operator()(const Point_2& p) const + { return m_base->is_on_x_identification_2_object()(p.base()); } - bool operator() (const X_monotone_curve_2 & xcv) const - { - return m_base->is_on_x_identification_2_object() (xcv.base()); - } + bool operator()(const X_monotone_curve_2& xcv) const + { return m_base->is_on_x_identification_2_object()(xcv.base()); } }; /*! Obtain a Is_on_x_identification_2 function object */ - Is_on_x_identification_2 is_on_x_identification_2_object () const - { - return Is_on_x_identification_2 (m_base_traits); - } + Is_on_x_identification_2 is_on_x_identification_2_object() const + { return Is_on_x_identification_2(m_base_traits); } /*! A functor that compares the y-coordinate of two given points * that lie on the vertical identification curve. @@ -623,7 +546,7 @@ public: class Compare_y_on_boundary_2 { protected: //! The base traits. - const Base_traits_2 * m_base; + const Base_traits_2* m_base; /*! Constructor. * \param tr The base traits class. It must be passed, to handle @@ -632,33 +555,36 @@ public: * obtaining function, which is a member of the nesting class, * constructing it. */ - Compare_y_on_boundary_2(const Base_traits_2 * tr) : m_base(tr) {} + Compare_y_on_boundary_2(const Base_traits_2* tr) : m_base(tr) {} //! Allow its functor obtaining function calling the private constructor. friend class Arr_batched_point_location_traits_2; public: - Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const + { return m_base->compare_y_on_boundary_2_object()(p1.base(), p2.base()); } + + Comparison_result operator()(const Point_2& pt, + const X_monotone_curve_2& xcv, + Arr_curve_end ce) const { - return m_base->compare_y_on_boundary_2_object()(p1.base(), p2.base()); + return m_base->compare_y_on_boundary_2_object()(pt.base(), xcv.base(), + ce); } - Comparison_result operator() (const Point_2 & pt, - const X_monotone_curve_2& xcv, Arr_curve_end ce) const + + Comparison_result operator()(const X_monotone_curve_2& xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2& xcv2, + Arr_curve_end ce2) const { - return m_base->compare_y_on_boundary_2_object()(pt.base(), xcv.base(), ce); - } - Comparison_result operator() (const X_monotone_curve_2& xcv1, Arr_curve_end ce1, - const X_monotone_curve_2& xcv2, Arr_curve_end ce2) const - { - return m_base->compare_y_on_boundary_2_object()(xcv1.base(), ce1, xcv2.base(), ce2); + return m_base->compare_y_on_boundary_2_object()(xcv1.base(), ce1, + xcv2.base(), ce2); } }; /*! Obtain a Compare_y_on_boundary_2 functor object. */ - Compare_y_on_boundary_2 compare_y_on_boundary_2_object () const - { - return Compare_y_on_boundary_2(m_base_traits); - } + Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const + { return Compare_y_on_boundary_2(m_base_traits); } /*! A function object that compares the y-coordinates of curve ends near the * boundary of the parameter space @@ -666,7 +592,7 @@ public: class Compare_y_near_boundary_2 { protected: //! The base traits. - const Base_traits_2 * m_base; + const Base_traits_2* m_base; /*! Constructor. * \param tr The base traits class. It must be passed, to handle @@ -675,14 +601,14 @@ public: * obtaining function, which is a member of the nesting class, * constructing it. */ - Compare_y_near_boundary_2(const Base_traits_2 * tr) : m_base(tr) {} + Compare_y_near_boundary_2(const Base_traits_2* tr) : m_base(tr) {} //! Allow its functor obtaining function calling the private constructor. friend class Arr_batched_point_location_traits_2; public: - Comparison_result operator()(const X_monotone_curve_2 & xcv1, - const X_monotone_curve_2 & xcv2, + Comparison_result operator()(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, Arr_curve_end ce) const { // If the traits class does not support open curves, we just @@ -693,10 +619,8 @@ public: }; /*! Obtain a Compare_y_near_boundary_2 functor object. */ - Compare_y_near_boundary_2 compare_y_near_boundary_2_object () const - { - return Compare_y_near_boundary_2(m_base_traits); - } + Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const + { return Compare_y_near_boundary_2(m_base_traits); } // bottom-top @@ -706,42 +630,33 @@ public: class Parameter_space_in_y_2 { protected: //! The base traits. - const Base_traits_2 *m_base; + const Base_traits_2* m_base; /*! Constructor. * The constructor is declared private to allow only the functor * obtaining function, which is a member of the nesting class, * constructing it. */ - Parameter_space_in_y_2(const Base_traits_2 *tr) : m_base (tr) {} + Parameter_space_in_y_2(const Base_traits_2* tr) : m_base(tr) {} //! Allow its functor obtaining function calling the private constructor. friend class Arr_batched_point_location_traits_2; public: - Arr_parameter_space operator() (const X_monotone_curve_2& xcv, + Arr_parameter_space operator()(const X_monotone_curve_2& xcv, Arr_curve_end ce) const - { - return m_base->parameter_space_in_y_2_object() (xcv.base(), ce); - } + { return m_base->parameter_space_in_y_2_object()(xcv.base(), ce); } - Arr_parameter_space operator() (const Point_2 & p) const - { - return m_base->parameter_space_in_y_2_object()(p.base()); - } - - Arr_parameter_space operator() (const X_monotone_curve_2 & xcv) const - { - return m_base->parameter_space_in_y_2_object()(xcv.base()); - } + Arr_parameter_space operator()(const Point_2& p) const + { return m_base->parameter_space_in_y_2_object()(p.base()); } + Arr_parameter_space operator()(const X_monotone_curve_2& xcv) const + { return m_base->parameter_space_in_y_2_object()(xcv.base()); } }; /*! Obtain a Parameter_space_in_y_2 function object */ - Parameter_space_in_y_2 parameter_space_in_y_2_object () const - { - return Parameter_space_in_y_2 (m_base_traits); - } + Parameter_space_in_y_2 parameter_space_in_y_2_object() const + { return Parameter_space_in_y_2(m_base_traits); } /*! A function object that determines whether an x-monotone curve or a * point coincide with the horizontal identification curve. @@ -749,117 +664,29 @@ public: class Is_on_y_identification_2 { protected: //! The base traits. - const Base_traits_2 *m_base; + const Base_traits_2* m_base; /*! Constructor. * The constructor is declared private to allow only the functor * obtaining function, which is a member of the nesting class, * constructing it. */ - Is_on_y_identification_2 (const Base_traits_2* tr) : m_base (tr) {} + Is_on_y_identification_2(const Base_traits_2* tr) : m_base(tr) {} //! Allow its functor obtaining function calling the private constructor. friend class Arr_batched_point_location_traits_2; public: - bool operator() (const Point_2 & p) const - { - return m_base->is_on_y_identification_2_object() (p.base()); - } + bool operator()(const Point_2& p) const + { return m_base->is_on_y_identification_2_object()(p.base()); } - bool operator() (const X_monotone_curve_2 & xcv) const - { - return m_base->is_on_y_identification_2_object() (xcv.base()); - } + bool operator()(const X_monotone_curve_2& xcv) const + { return m_base->is_on_y_identification_2_object()(xcv.base()); } }; /*! Obtain a Is_on_y_identification_2 function object */ - Is_on_y_identification_2 is_on_y_identification_2_object () const - { - return Is_on_y_identification_2 (m_base_traits); - } - - /*! A functor that compares the x-limits of curve ends on the - * boundary of the parameter space. - */ - class Compare_x_at_limit_2 { - protected: - //! The base traits. - const Base_traits_2 * m_base; - - /*! Constructor. - * \param tr The base traits class. It must be passed, to handle - * non stateless traits (e.g., it stores data). - * The constructor is declared private to allow only the functor - * obtaining function, which is a member of the nesting class, - * constructing it. - */ - Compare_x_at_limit_2(const Base_traits_2 * tr) : m_base(tr) {} - - //! Allow its functor obtaining function calling the private constructor. - friend class Arr_batched_point_location_traits_2; - - public: - Comparison_result operator() (const Point_2& p, - const X_monotone_curve_2 & xcv, - Arr_curve_end ce) const - { - return m_base->compare_x_at_limit_2_object()(p.base(), - xcv.base(), ce); - } - - Comparison_result operator()(const X_monotone_curve_2 & xcv1, - Arr_curve_end ce1, - const X_monotone_curve_2 & xcv2, - Arr_curve_end ce2) const - { - return m_base->compare_x_at_limit_2_object()(xcv1.base(), ce1, - xcv2.base(), ce2); - } - }; - - /*! Obtain a Compare_x_at_limit_2 function object. */ - Compare_x_at_limit_2 compare_x_at_limit_2_object () const - { - return Compare_x_at_limit_2(m_base_traits); - } - - /*! A functor that compares the x-coordinates of curve ends near the - * boundary of the parameter space. - */ - class Compare_x_near_limit_2 { - protected: - //! The base traits. - const Base_traits_2 * m_base; - - /*! Constructor. - * \param tr The base traits class. It must be passed, to handle - * non stateless traits (e.g., it stores data). - * The constructor is declared private to allow only the functor - * obtaining function, which is a member of the nesting class, - * constructing it. - */ - Compare_x_near_limit_2(const Base_traits_2 * tr) : m_base(tr) {} - - //! Allow its functor obtaining function calling the private constructor. - friend class Arr_batched_point_location_traits_2; - - public: - Comparison_result operator()(const X_monotone_curve_2 & xcv1, - const X_monotone_curve_2 & xcv2, - Arr_curve_end ce) const - { - return m_base->compare_x_near_limit_2_object()(xcv1.base(), - xcv2.base(), - ce); - } - }; - - /*! Obtain a Compare_x_near_limit_2 function object. */ - Compare_x_near_limit_2 compare_x_near_limit_2_object () const - { - return Compare_x_near_limit_2(m_base_traits); - } + Is_on_y_identification_2 is_on_y_identification_2_object() const + { return Is_on_y_identification_2(m_base_traits); } /*! A functor that compares the x-coordinate of two given points * that lie on the horizontal identification curve. @@ -867,7 +694,7 @@ public: class Compare_x_on_boundary_2 { protected: //! The base traits. - const Base_traits_2 * m_base; + const Base_traits_2* m_base; /*! Constructor. * \param tr The base traits class. It must be passed, to handle @@ -876,34 +703,36 @@ public: * obtaining function, which is a member of the nesting class, * constructing it. */ - Compare_x_on_boundary_2(const Base_traits_2 * tr) : m_base(tr) {} + Compare_x_on_boundary_2(const Base_traits_2* tr) : m_base(tr) {} //! Allow its functor obtaining function calling the private constructor. friend class Arr_batched_point_location_traits_2; public: - Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const + { return m_base->compare_x_on_boundary_2_object()(p1.base(), p2.base()); } + + Comparison_result operator()(const Point_2& p1, + const X_monotone_curve_2& xcv, + Arr_curve_end ce) const { - return m_base->compare_x_on_boundary_2_object()(p1.base(), p2.base()); + return m_base->compare_x_on_boundary_2_object()(p1.base(), xcv.base(), + ce); } - Comparison_result operator()(const Point_2 & p1, const X_monotone_curve_2& xcv, Arr_curve_end ce) const + Comparison_result operator()(const X_monotone_curve_2& xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2& xcv2, + Arr_curve_end ce2) const { - return m_base->compare_x_on_boundary_2_object()(p1.base(), xcv.base(), ce); - } - - Comparison_result operator()( const X_monotone_curve_2& xcv1, Arr_curve_end ce1, - const X_monotone_curve_2& xcv2, Arr_curve_end ce2) const - { - return m_base->compare_x_on_boundary_2_object()(xcv1.base(), ce1, xcv2.base(), ce2); + return m_base->compare_x_on_boundary_2_object()(xcv1.base(), ce1, + xcv2.base(), ce2); } }; /*! Obtain a Compare_x_on_boundary_2 functor object. */ - Compare_x_on_boundary_2 compare_x_on_boundary_2_object () const - { - return Compare_x_on_boundary_2(m_base_traits); - } + Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const + { return Compare_x_on_boundary_2(m_base_traits); } /*! A functor that compares the x-coordinates of curve ends near the * boundary of the parameter space. @@ -911,7 +740,7 @@ public: class Compare_x_near_boundary_2 { protected: //! The base traits. - const Base_traits_2 * m_base; + const Base_traits_2* m_base; /*! Constructor. * \param tr The base traits class. It must be passed, to handle @@ -920,14 +749,14 @@ public: * obtaining function, which is a member of the nesting class, * constructing it. */ - Compare_x_near_boundary_2(const Base_traits_2 * tr) : m_base(tr) {} + Compare_x_near_boundary_2(const Base_traits_2* tr) : m_base(tr) {} //! Allow its functor obtaining function calling the private constructor. friend class Arr_batched_point_location_traits_2; public: - Comparison_result operator()(const X_monotone_curve_2 & xcv1, - const X_monotone_curve_2 & xcv2, + Comparison_result operator()(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, Arr_curve_end ce) const { return m_base->compare_x_near_boundary_2_object()(xcv1.base(), @@ -937,11 +766,8 @@ public: }; /*! Obtain a Compare_x_near_boundary_2 function object. */ - Compare_x_near_boundary_2 compare_x_near_boundary_2_object () const - { - return Compare_x_near_boundary_2(m_base_traits); - } - + Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const + { return Compare_x_near_boundary_2(m_base_traits); } }; } //namespace CGAL diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_naive_point_location_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_naive_point_location_impl.h index fb12b853287..a516669aa1e 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_naive_point_location_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_naive_point_location_impl.h @@ -15,7 +15,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0+ -// +// // // Author(s) : Ron Wein // (based on old version by Eyal Flato) @@ -37,48 +37,43 @@ namespace CGAL { //----------------------------------------------------------------------------- // Locate the arrangement feature containing the given point. // -template +template typename Arr_naive_point_location::Result_type Arr_naive_point_location::locate(const Point_2& p) const { // Go over the arrangement vertices and check whether one of them equals // the query point. - typename Traits_adaptor_2::Equal_2 equal = geom_traits->equal_2_object(); - typename Arrangement_2::Vertex_const_iterator vit; - Vertex_const_handle vh; + typename Traits_adaptor_2::Equal_2 equal = geom_traits->equal_2_object(); + typename Arrangement_2::Vertex_const_iterator vit; for (vit = p_arr->vertices_begin(); vit != p_arr->vertices_end(); ++vit) { - vh = vit; - if (equal(p, vh->point())) - return make_result(vh); + Vertex_const_handle vh = vit; + if (equal(p, vh->point())) return make_result(vh); } // Go over arrangement halfedges and check whether one of them contains // the query point in its interior. - typename Traits_adaptor_2::Is_in_x_range_2 is_in_x_range = + typename Traits_adaptor_2::Is_in_x_range_2 is_in_x_range = geom_traits->is_in_x_range_2_object(); - typename Traits_adaptor_2::Compare_y_at_x_2 compare_y_at_x = + typename Traits_adaptor_2::Compare_y_at_x_2 compare_y_at_x = geom_traits->compare_y_at_x_2_object(); - typename Arrangement_2::Edge_const_iterator eit; - Halfedge_const_handle hh; + typename Arrangement_2::Edge_const_iterator eit; for (eit = p_arr->edges_begin(); eit != p_arr->edges_end(); ++eit) { - hh = eit; - + Halfedge_const_handle hh = eit; if (is_in_x_range(hh->curve(), p) && compare_y_at_x(p, hh->curve()) == EQUAL) return make_result(hh); } // Go over all faces an locate the innermost one that contains the query // point in its interior. - typename Arrangement_2::Face_const_iterator fit; - Face_const_handle fh; - Face_const_handle f_inner; - const Face_const_handle invalid_f; - + Face_const_handle f_inner; + const Face_const_handle invalid_f; + + typename Arrangement_2::Face_const_iterator fit; for (fit = p_arr->faces_begin(); fit != p_arr->faces_end(); ++fit) { - fh = fit; - + Face_const_handle fh = fit; + if (top_traits->is_in_face(&(*fh), p, NULL)) { // The current face contains p in its interior. if (f_inner == invalid_f || @@ -88,8 +83,7 @@ Arr_naive_point_location::locate(const Point_2& p) const // This is the first face that contains p we encounter: f_inner = fh; } - else if (! fh->is_unbounded() && fh->number_of_outer_ccbs() > 0) - { + else if (! fh->is_unbounded() && fh->number_of_outer_ccbs() > 0) { // As we have already some other containing face, one face must be // contained inside the other. Two check that, we select a // representative vertex of inner_f and check whether it is contained @@ -100,10 +94,9 @@ Arr_naive_point_location::locate(const Point_2& p) const // source() of its value_type is accessed. typename Arrangement_2::Outer_ccb_const_iterator it = fh->outer_ccbs_begin(); - Vertex_const_handle v = (*it)->source(); + Vertex_const_handle v = (*it)->source(); - if (top_traits->is_in_face(&(*f_inner), v->point(), NULL)) - f_inner = fh; + if (top_traits->is_in_face(&(*f_inner), v->point(), NULL)) f_inner = fh; } } } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits.h index 3d7d706e655..a87a86b6cee 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits.h @@ -15,9 +15,10 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0+ -// +// // // Author(s) : Oren Nechushtan + #ifndef CGAL_TD_TRAITS_H #define CGAL_TD_TRAITS_H @@ -35,13 +36,13 @@ namespace CGAL { -template +template class Td_traits : public Pm_traits_ { public: //type of td map items type - enum Type + enum Type { NIL = 0, TD_ACTIVE_TRAPEZOID, @@ -55,15 +56,15 @@ public: }; //! type of base class - typedef Pm_traits_ Traits_base; - - //! type of X_monotone_curve_2 - typedef typename Traits_base::X_monotone_curve_2 - X_monotone_curve_2; - + typedef Pm_traits_ Traits_base; + + //! type of X_monotone_curve_2 + typedef typename Traits_base::X_monotone_curve_2 + X_monotone_curve_2; + //! type of Arrangement_on_surface_2 typedef Arrangement_ Arrangement_on_surface_2; - + //!type of Halfedge_handle typedef typename Arrangement_on_surface_2::Halfedge_handle Halfedge_handle; @@ -74,21 +75,21 @@ public: typedef typename Arrangement_on_surface_2::Vertex_const_handle Vertex_const_handle; //!type of Halfedge_around_vertex_const_circulator - typedef typename + typedef typename Arrangement_on_surface_2::Halfedge_around_vertex_const_circulator Halfedge_around_vertex_const_circulator; //!type of side tags - typedef typename Arrangement_on_surface_2::Left_side_category + typedef typename Arrangement_on_surface_2::Left_side_category Left_side_category; - typedef typename Arrangement_on_surface_2::Bottom_side_category + typedef typename Arrangement_on_surface_2::Bottom_side_category Bottom_side_category; - typedef typename Arrangement_on_surface_2::Top_side_category + typedef typename Arrangement_on_surface_2::Top_side_category Top_side_category; - typedef typename Arrangement_on_surface_2::Right_side_category + typedef typename Arrangement_on_surface_2::Right_side_category Right_side_category; //! myself - typedef Td_traits + typedef Td_traits Self; //! type of point typedef typename Traits_base::Point_2 Point; @@ -98,7 +99,7 @@ public: //! type of Td_inactive_trapezoid typedef CGAL::Td_inactive_trapezoid Td_inactive_trapezoid; - + typedef int Td_nothing; //! type of Td_active_edge @@ -111,14 +112,14 @@ public: typedef CGAL::Td_active_vertex Td_active_vertex; //! type of Td_active_fictitious_vertex - typedef CGAL::Td_active_fictitious_vertex + typedef CGAL::Td_active_fictitious_vertex Td_active_fictitious_vertex; //! type of Td_inactive_vertex typedef CGAL::Td_inactive_vertex Td_inactive_vertex; //! type of Td_inactive_fictitious_vertex - typedef CGAL::Td_inactive_fictitious_vertex + typedef CGAL::Td_inactive_fictitious_vertex Td_inactive_fictitious_vertex; //! type of td map item (Td_halfedge, Td_vertex or Td_trapezoid) @@ -131,37 +132,37 @@ public: //! type of Curve end pair typedef std::pair Curve_end_pair; - - //!Curve_end class represents an X_monotone_curve_2 end + + //!Curve_end class represents an X_monotone_curve_2 end // (could be a point or an unbounded curve end) // holds a pointer to the X_monotone_curve_2 and an indicator for the end (min/max) class Curve_end { protected: - + //! pair of pointer to the X_monotone_curve_2 and an indicator - // for ARR_MIN_END or ARR_MAX_END + // for ARR_MIN_END or ARR_MAX_END Curve_end_pair m_pair; - + public: - //Constructor based on a Curve_end_pair - Curve_end(Curve_end_pair pr) : m_pair(pr) + //Constructor based on a Curve_end_pair + Curve_end(Curve_end_pair pr) : m_pair(pr) { } //Constructor based on a Curve & a Curve-end - //Curve_end(const X_monotone_curve_2& cv, Arr_curve_end ce) : m_cv(cv), m_ce(ce) - Curve_end(const X_monotone_curve_2& cv, Arr_curve_end ce) - : m_pair(std::make_pair(&cv,ce)) + //Curve_end(const X_monotone_curve_2& cv, Arr_curve_end ce) : m_cv(cv), m_ce(ce) + Curve_end(const X_monotone_curve_2& cv, Arr_curve_end ce) + : m_pair(std::make_pair(&cv,ce)) { } //Constructor based on a Halfedge & a Curve-end - //Curve_end(Halfedge_const_handle he, Arr_curve_end ce) : m_cv(he->curve()), m_ce(ce) - Curve_end(Halfedge_const_handle he, Arr_curve_end ce) - : m_pair(std::make_pair(&(he->curve()),ce)) + //Curve_end(Halfedge_const_handle he, Arr_curve_end ce) : m_cv(he->curve()), m_ce(ce) + Curve_end(Halfedge_const_handle he, Arr_curve_end ce) + : m_pair(std::make_pair(&(he->curve()),ce)) { } - + //access the X-monotone curve const X_monotone_curve_2& cv() const { return *(m_pair.first); } @@ -190,13 +191,13 @@ public: //! Allow its functor obtaining function calling the private constructor. friend class Td_traits; - + public: - + /*! * Compare the x-coordinates of two edge ends. - * \param ee1 The first edge end - * \param ee2 The second edge end + * \param ee1 The first edge end + * \param ee2 The second edge end * \return LARGER if x(ee1) > x(ee2); * SMALLER if x(ee1) < x(ee2); * EQUAL if x(ee1) = x(ee2). @@ -204,13 +205,13 @@ public: Comparison_result operator() (const Curve_end& ce1, const Curve_end& ce2) const { - Arr_parameter_space ce1_x_prm_spc = + Arr_parameter_space ce1_x_prm_spc = m_traits->parameter_space_in_x_2_object()(ce1.cv(),ce1.ce()); - Arr_parameter_space ce1_y_prm_spc = + Arr_parameter_space ce1_y_prm_spc = m_traits->parameter_space_in_y_2_object()(ce1.cv(),ce1.ce()); - Arr_parameter_space ce2_x_prm_spc = + Arr_parameter_space ce2_x_prm_spc = m_traits->parameter_space_in_x_2_object()(ce2.cv(),ce2.ce()); - Arr_parameter_space ce2_y_prm_spc = + Arr_parameter_space ce2_y_prm_spc = m_traits->parameter_space_in_y_2_object()(ce2.cv(),ce2.ce()); bool is_ce1_interior = (( ce1_x_prm_spc == ARR_INTERIOR) && @@ -237,7 +238,7 @@ public: m_traits->construct_min_vertex_2_object()(ce1.cv()) : m_traits->construct_max_vertex_2_object()(ce1.cv()) ), ce2); - + //if only ce2 is interior if (is_ce2_interior) return operator() @@ -245,21 +246,21 @@ public: ((ce2.ce() == ARR_MIN_END) ? m_traits->construct_min_vertex_2_object()(ce2.cv()) : m_traits->construct_max_vertex_2_object()(ce2.cv()) )); - + //both are not interior: - //if both are x-interior + //if both are x-interior // (then both are NOT y-interior, since both are not interior) if ( (ce1_x_prm_spc == ARR_INTERIOR) && (ce2_x_prm_spc == ARR_INTERIOR) ) { //both ce1 and ce2 are not y prm spc interior - Comparison_result res = m_traits->compare_x_at_limit_2_object() - (ce1.cv(),ce1.ce(), + Comparison_result res = m_traits->compare_x_on_boundary_2_object() + (ce1.cv(),ce1.ce(), ce2.cv(),ce2.ce()); if (res != EQUAL) return res; - //if equal need to compare near limit + //if equal need to compare near boundary //if param space in y is not the same (one is top and one is bottom) // the bottom is smaller than the top @@ -267,17 +268,17 @@ public: return (ce1_y_prm_spc == ARR_BOTTOM_BOUNDARY) ? SMALLER : LARGER; //if the Curve end is not the same the one with the MAX is smaller - if (ce1.ce() != ce2.ce()) - return (ce1.ce() == ARR_MIN_END) ? LARGER : SMALLER; + if (ce1.ce() != ce2.ce()) + return (ce1.ce() == ARR_MIN_END) ? LARGER : SMALLER; //both have the same Curve end - return (m_traits->compare_x_near_limit_2_object() + return (m_traits->compare_x_near_boundary_2_object() (ce1.cv(),ce2.cv(),ce2.ce())); } //not both are x-interior - //set ind value according to the location : + //set ind value according to the location : // left-bndry = -1 // interior = 0 // right-bndry = 1 @@ -290,7 +291,7 @@ public: int ind2 = (ce2_x_prm_spc == ARR_INTERIOR)? 0 : ((ce2_x_prm_spc == ARR_LEFT_BOUNDARY) ? -1 : 1 ); - + int res = ind1 - ind2; if (res == 0) return EQUAL; @@ -308,8 +309,8 @@ public: Comparison_result operator() (const Point& p, const Curve_end& ce) const { - bool is_ce_interior = - ((m_traits->parameter_space_in_x_2_object() + bool is_ce_interior = + ((m_traits->parameter_space_in_x_2_object() (ce.cv(),ce.ce()) == ARR_INTERIOR) && (m_traits->parameter_space_in_y_2_object() (ce.cv(),ce.ce()) == ARR_INTERIOR)); @@ -324,15 +325,15 @@ public: m_traits->construct_max_vertex_2_object()(ce.cv()) )); } - //if curve end is x-interior but not y-interior + //if curve end is x-interior but not y-interior if (m_traits->parameter_space_in_x_2_object() - (ce.cv(),ce.ce()) == ARR_INTERIOR) + (ce.cv(),ce.ce()) == ARR_INTERIOR) { //if curve end y prm space is not interior - return (m_traits->compare_x_at_limit_2_object() + return (m_traits->compare_x_on_boundary_2_object() (p,ce.cv(),ce.ce())); } - + //if curve end is on the left or right boundaries if (m_traits->parameter_space_in_x_2_object() (ce.cv(),ce.ce()) == ARR_LEFT_BOUNDARY) @@ -358,7 +359,7 @@ public: return res; return (res == LARGER) ? SMALLER : LARGER; } - + }; /*! Obtain a Compare_y_at_x_2 functor object. */ @@ -377,7 +378,7 @@ public: { protected: - + typedef Td_traits Traits; /*! The traits (in case it has state) */ @@ -393,11 +394,11 @@ public: //! Allow its functor obtaining function calling the private constructor. friend class Td_traits; - + public: - + /*! - * Return the location of the given curve end with respect to the input + * Return the location of the given curve end with respect to the input * Halfedge_const_handle. * \param ce1 The curve end. * \param he The Halfedge_const_handle. @@ -433,25 +434,25 @@ public: && (m_traits->compare_curve_end_x_2_object() (ce1, Curve_end(cv2, ARR_MAX_END)) != LARGER)); - + //get the curve end parameter space in x & y - Arr_parameter_space ce1_x_prm_spc = + Arr_parameter_space ce1_x_prm_spc = m_traits->parameter_space_in_x_2_object()(ce1.cv(), ce1.ce()); - Arr_parameter_space ce1_y_prm_spc = + Arr_parameter_space ce1_y_prm_spc = m_traits->parameter_space_in_y_2_object()(ce1.cv(), ce1.ce()); if (ce1_x_prm_spc != ARR_INTERIOR) { - //assuming that the edge end is on the same boundary according to + //assuming that the edge end is on the same boundary according to // the precondition. - //comparing the curve that contains the given + //comparing the curve that contains the given // edge end and the curve cv2 return m_traits->compare_y_near_boundary_2_object() (ce1.cv(), cv2, ce1.ce()); } - + //if ce1_x_prm_spc == ARR_INTERIOR if (ce1_y_prm_spc == ARR_INTERIOR) { @@ -462,9 +463,9 @@ public: m_traits->construct_max_vertex_2_object()(ce1.cv()) ), cv2); } - + //ce1 is an end point of a curve with a vertical asymptote. - + //if the other curve is also vertical or has a vertical asymptote // at the x value of ep @@ -480,17 +481,17 @@ public: (cv2, ARR_MAX_END) == ce1_y_prm_spc) && (m_traits->compare_curve_end_x_2_object() (ce1, Curve_end(cv2, ARR_MAX_END)) == EQUAL)) ) - { + { return EQUAL; } if (ce1_y_prm_spc == ARR_TOP_BOUNDARY) return LARGER; else //if ce1_y_prm_spc == ARR_BOTTOM_BOUNDARY return SMALLER; - - + + } - + }; /*! Obtain a Compare_y_at_x_2 functor object. */ @@ -501,11 +502,11 @@ public: - class Equal_curve_end_2 + class Equal_curve_end_2 { protected: typedef Td_traits Traits; - + /*! The traits (in case it has state) */ const Traits* m_traits; const Traits_base* m_traits_base; //MICHAL: rational-upd @@ -523,19 +524,19 @@ public: friend class Td_traits; public: - + bool operator() (const Curve_end& ce1, const Curve_end& ce2) const { //Kernel kernel; //MICHAL: rational-upd - bool is_ce1_interior = - ((m_traits->parameter_space_in_x_2_object()(ce1.cv(),ce1.ce()) + bool is_ce1_interior = + ((m_traits->parameter_space_in_x_2_object()(ce1.cv(),ce1.ce()) == ARR_INTERIOR) && (m_traits->parameter_space_in_y_2_object()(ce1.cv(),ce1.ce()) == ARR_INTERIOR)); - bool is_ce2_interior = - ((m_traits->parameter_space_in_x_2_object()(ce2.cv(),ce2.ce()) + bool is_ce2_interior = + ((m_traits->parameter_space_in_x_2_object()(ce2.cv(),ce2.ce()) == ARR_INTERIOR) && (m_traits->parameter_space_in_y_2_object()(ce2.cv(),ce2.ce()) == ARR_INTERIOR)); @@ -550,10 +551,10 @@ public: m_traits->construct_min_vertex_2_object()(ce2.cv()) : m_traits->construct_max_vertex_2_object()(ce2.cv()) )); } - - + + //at least one of the edge ends is on the parameter space boundaries - + //if not both are on the boundaries return false if (is_ce1_interior || is_ce2_interior) return false; @@ -561,7 +562,7 @@ public: //both are on the boundaries - so compare the edge ends return ( m_traits->compare_curve_end_xy_2_object()(ce1,ce2) == EQUAL); } - + bool operator() (const Point& p1, const Point& p2) const { @@ -573,21 +574,21 @@ public: { return operator()(p, ce); } - + bool operator() (const Point& p, const Curve_end& ce) const { - bool is_ce_interior = - ((m_traits->parameter_space_in_x_2_object()(ce.cv(),ce.ce()) + bool is_ce_interior = + ((m_traits->parameter_space_in_x_2_object()(ce.cv(),ce.ce()) == ARR_INTERIOR) && (m_traits->parameter_space_in_y_2_object()(ce.cv(),ce.ce()) == ARR_INTERIOR)); //if ce is on the parameter space boundaries - return false // since p is interior - if (!is_ce_interior) + if (!is_ce_interior) return false; - + //else - if ce is interior return m_traits_base->equal_2_object() ( p, @@ -595,7 +596,7 @@ public: m_traits->construct_min_vertex_2_object()(ce.cv()) : m_traits->construct_max_vertex_2_object()(ce.cv()) )); } - + }; /*! Obtain an Equal_curve_end_2 functor object. */ @@ -605,7 +606,7 @@ public: } /*! A functor that compares the coordinates of two edge ends */ - class Compare_curve_end_xy_2 + class Compare_curve_end_xy_2 { protected: typedef Td_traits Traits; @@ -629,40 +630,40 @@ public: * Compare two edge ends lexigoraphically: by x, then by y. * \param cv1, cv1_end The first cv end. * \param cv2, cv2_end The second cv end. - * \return LARGER if x(cv1-end) > x(cv2-end), + * \return LARGER if x(cv1-end) > x(cv2-end), * or if x(cv1-end) = x(cv2-end) and y(cv1-end) > y(cv2-end); - * SMALLER if x(cv1-end) < x(cv2-end), + * SMALLER if x(cv1-end) < x(cv2-end), * or if x(cv1-end) = x(cv2-end) and y(cv1-end) < y(cv2-end); * EQUAL if the two cv ends are equal. */ Comparison_result operator() (const Curve_end& ce1, const Curve_end& ce2) const { - Comparison_result res; - - bool is_ce1_interior = - ((m_traits->parameter_space_in_x_2_object()(ce1.cv(),ce1.ce()) + Comparison_result res; + + bool is_ce1_interior = + ((m_traits->parameter_space_in_x_2_object()(ce1.cv(),ce1.ce()) == ARR_INTERIOR) && (m_traits->parameter_space_in_y_2_object()(ce1.cv(),ce1.ce()) == ARR_INTERIOR)); - bool is_ce2_interior = - ((m_traits->parameter_space_in_x_2_object()(ce2.cv(),ce2.ce()) + bool is_ce2_interior = + ((m_traits->parameter_space_in_x_2_object()(ce2.cv(),ce2.ce()) == ARR_INTERIOR) && (m_traits->parameter_space_in_y_2_object()(ce2.cv(),ce2.ce()) == ARR_INTERIOR)); - - bool is_ce1_vertical = - ((m_traits->parameter_space_in_x_2_object()(ce1.cv(),ce1.ce()) + + bool is_ce1_vertical = + ((m_traits->parameter_space_in_x_2_object()(ce1.cv(),ce1.ce()) == ARR_INTERIOR) && (m_traits->parameter_space_in_y_2_object()(ce1.cv(),ce1.ce()) != ARR_INTERIOR)); - bool is_ce2_vertical = - ((m_traits->parameter_space_in_x_2_object()(ce2.cv(),ce2.ce()) + bool is_ce2_vertical = + ((m_traits->parameter_space_in_x_2_object()(ce2.cv(),ce2.ce()) == ARR_INTERIOR) && (m_traits->parameter_space_in_y_2_object()(ce2.cv(),ce2.ce()) != ARR_INTERIOR)); - //if the edge ends are parameter space interior on both x & y + //if the edge ends are parameter space interior on both x & y if ( is_ce1_interior && is_ce2_interior ) { return m_traits->compare_xy_2_object() @@ -673,19 +674,19 @@ public: m_traits->construct_min_vertex_2_object()(ce2.cv()) : m_traits->construct_max_vertex_2_object()(ce2.cv()) )); } - + //at least one curve end is on the parameter space boundaries: - + //if the first curve end is interior if ( is_ce1_interior ) { - + //if the second curve end is of a curve with a vertical asymptote: // x prm spc is interior, y prm spc is not interior if ( is_ce2_vertical) { //res = m_traits->compare_x_near_boundary_2_object() - res = m_traits->compare_x_at_limit_2_object() + res = m_traits->compare_x_on_boundary_2_object() (((ce1.ce() == ARR_MIN_END) ? m_traits->construct_min_vertex_2_object()(ce1.cv()) : m_traits->construct_max_vertex_2_object()(ce1.cv()) ), @@ -693,7 +694,7 @@ public: if (res != EQUAL) return res; - else + else return (m_traits->parameter_space_in_y_2_object() (ce2.cv(),ce2.ce()) == ARR_TOP_BOUNDARY) ? SMALLER : LARGER; } @@ -714,16 +715,16 @@ public: if ( is_ce1_vertical ) { //res = m_traits->compare_x_near_boundary_2_object() - res = m_traits->compare_x_at_limit_2_object() + res = m_traits->compare_x_on_boundary_2_object() ((( ce2.ce() == ARR_MIN_END) ? m_traits->construct_min_vertex_2_object()( ce2.cv()) : m_traits->construct_max_vertex_2_object()( ce2.cv()) ), ce1.cv(), ce1.ce()); - //need to return the opposite because the function recieved - // the curve ends in a reverse order + //need to return the opposite because the function recieved + // the curve ends in a reverse order if (res != EQUAL) return (res == SMALLER) ? LARGER : SMALLER; - else + else return (m_traits->parameter_space_in_y_2_object() (ce1.cv(),ce1.ce()) == ARR_TOP_BOUNDARY) ? LARGER : SMALLER; } @@ -733,7 +734,7 @@ public: // boundaries. the comparison is simply by the x-coord return (ce1.ce() == ARR_MIN_END) ? SMALLER : LARGER; } - + } //both curve ends are not interior @@ -741,19 +742,19 @@ public: //if both curve ends are of unbounded curves with a vertical asymptote if ( is_ce1_vertical && is_ce2_vertical ) { - Comparison_result res = m_traits->compare_x_at_limit_2_object() - (ce1.cv(),ce1.ce(), + Comparison_result res = m_traits->compare_x_on_boundary_2_object() + (ce1.cv(),ce1.ce(), ce2.cv(),ce2.ce()); if (res != EQUAL) return res; //res == EQUAL - //if equal - need to compare near limit + //if equal - need to compare near boundary - Arr_parameter_space ce1_y_prm_spc = + Arr_parameter_space ce1_y_prm_spc = m_traits->parameter_space_in_y_2_object()(ce1.cv(),ce1.ce()) ; - Arr_parameter_space ce2_y_prm_spc = + Arr_parameter_space ce2_y_prm_spc = m_traits->parameter_space_in_y_2_object()(ce2.cv(),ce2.ce()) ; //if param space in y is not the same (one is top and one is bottom) @@ -762,21 +763,21 @@ public: return (ce1_y_prm_spc == ARR_BOTTOM_BOUNDARY) ? SMALLER : LARGER; //if the Curve end is not the same, the one with the MAX is smaller - if (ce1.ce() != ce2.ce()) + if (ce1.ce() != ce2.ce()) return (ce1.ce() == ARR_MIN_END) ? LARGER : SMALLER; //both have the same Curve end - return (m_traits->compare_x_near_limit_2_object() - (ce1.cv(),ce2.cv(),ce2.ce())); + return (m_traits->compare_x_near_boundary_2_object() + (ce1.cv(),ce2.cv(),ce2.ce())); } //if only the first curve end is of a curve with a vertical asymptote - if ( is_ce1_vertical ) + if ( is_ce1_vertical ) { return (ce2.ce() == ARR_MIN_END) ? LARGER : SMALLER; } //if only the second curve end is of a curve with a vertical asymptote - if ( is_ce2_vertical ) + if ( is_ce2_vertical ) { return (ce1.ce() == ARR_MIN_END) ? SMALLER : LARGER; } @@ -784,45 +785,45 @@ public: //both curve ends are not of curves with a vertical asymptote: //if not both on left or both on right boundaries - if (ce1.ce() != ce2.ce()) + if (ce1.ce() != ce2.ce()) { return (ce1.ce() == ARR_MIN_END) ? SMALLER : LARGER; } - + //both on the same boundary, need to compare the y near the boundary // (ce1.ce() == ce2.ce()) return m_traits->compare_y_near_boundary_2_object() - (ce1.cv(), ce2.cv(), ce1.ce()); + (ce1.cv(), ce2.cv(), ce1.ce()); } /*! * Compare a point and a curve end lexigoraphically: by x, then by y. * \param cv1, cv1_end The first cv end. * \param cv2, cv2_end The second cv end. - * \return LARGER if x(p) > x(cv2-end), + * \return LARGER if x(p) > x(cv2-end), * or if x(p) = x(cv2-end) and y(p) > y(cv2-end); - * SMALLER if x(p) < x(cv2-end), + * SMALLER if x(p) < x(cv2-end), * or if x(p) = x(cv2-end) and y(p) < y(cv2-end); * EQUAL if the point and the cv end are equal. */ Comparison_result operator() (const Point& p, const Curve_end& ce) const { - Comparison_result res; - - bool is_ce_interior = - ((m_traits->parameter_space_in_x_2_object()(ce.cv(),ce.ce()) + Comparison_result res; + + bool is_ce_interior = + ((m_traits->parameter_space_in_x_2_object()(ce.cv(),ce.ce()) == ARR_INTERIOR) && (m_traits->parameter_space_in_y_2_object()(ce.cv(),ce.ce()) == ARR_INTERIOR)); - - bool is_ce_vertical = - ((m_traits->parameter_space_in_x_2_object()(ce.cv(),ce.ce()) + + bool is_ce_vertical = + ((m_traits->parameter_space_in_x_2_object()(ce.cv(),ce.ce()) == ARR_INTERIOR) && (m_traits->parameter_space_in_y_2_object()(ce.cv(),ce.ce()) != ARR_INTERIOR)); - //if the edge end is parameter space interior on both x & y + //if the edge end is parameter space interior on both x & y if ( is_ce_interior) { return m_traits->compare_xy_2_object() @@ -831,19 +832,19 @@ public: m_traits->construct_min_vertex_2_object()(ce.cv()) : m_traits->construct_max_vertex_2_object()(ce.cv()) )); } - + // edge end is on the parameter space boundaries: - + //if edge end is of a vertical line: // x prm spc is interior, y prm spc is not interior if ( is_ce_vertical) { - res = m_traits->compare_x_at_limit_2_object() + res = m_traits->compare_x_on_boundary_2_object() (p, ce.cv(), ce.ce()); if (res != EQUAL) return res; - else + else return (m_traits->parameter_space_in_y_2_object() (ce.cv(), ce.ce()) == ARR_TOP_BOUNDARY) ? SMALLER : LARGER; } @@ -854,7 +855,7 @@ public: return (ce.ce() == ARR_MIN_END) ? LARGER : SMALLER; } } - + Comparison_result operator() (const Curve_end& ce, const Point& p) const { @@ -864,7 +865,7 @@ public: return (res == SMALLER) ? LARGER : SMALLER; } - + Comparison_result operator() (const Point& p1, const Point& p2) const { @@ -882,17 +883,17 @@ public: // Td_traits class ctors and dtor - + Td_traits(const Traits_base& t) : Traits_base(t) { } - Td_traits() + Td_traits() { } ~Td_traits(void) { } - + public: /* note: @@ -906,18 +907,18 @@ public: { CGAL_precondition(is_active(left_item) && is_active(right_item)); CGAL_precondition(is_td_trapezoid(left_item) && is_td_trapezoid(right_item)); - + Td_active_trapezoid left (boost::get(left_item)); Td_active_trapezoid right(boost::get(right_item)); if (left.is_on_bottom_boundary()) return (right.is_on_bottom_boundary()); - - if (right.is_on_bottom_boundary()) + + if (right.is_on_bottom_boundary()) return (false); - - return (left.bottom() == right.bottom() || - left.bottom()->twin() == right.bottom()); + + return (left.bottom() == right.bottom() || + left.bottom()->twin() == right.bottom()); } /* returns true if top halfedges of input are the same */ @@ -926,47 +927,47 @@ public: { CGAL_precondition(is_active(left_item) && is_active(right_item)); CGAL_precondition(is_td_trapezoid(left_item) && is_td_trapezoid(right_item)); - + Td_active_trapezoid left (boost::get(left_item)); Td_active_trapezoid right(boost::get(right_item)); - if (left.is_on_top_boundary()) + if (left.is_on_top_boundary()) return (right.is_on_top_boundary()); - - if (right.is_on_top_boundary()) + + if (right.is_on_top_boundary()) return (false); - - return (left.top() == right.top() || left.top()->twin() == right.top()); + + return (left.top() == right.top() || left.top()->twin() == right.top()); } /* returns true if bottom halfedges of input are the same */ inline bool is_trapezoids_bottom_equal(const Td_active_trapezoid& left, - const Td_active_trapezoid& right) const + const Td_active_trapezoid& right) const { if (left.is_on_bottom_boundary()) return (right.is_on_bottom_boundary()); - - if (right.is_on_bottom_boundary()) + + if (right.is_on_bottom_boundary()) return (false); - - return (left.bottom() == right.bottom() || - left.bottom()->twin() == right.bottom()); + + return (left.bottom() == right.bottom() || + left.bottom()->twin() == right.bottom()); } /* returns true if top halfedges of input are the same */ inline bool is_trapezoids_top_equal(const Td_active_trapezoid& left, - const Td_active_trapezoid& right) const + const Td_active_trapezoid& right) const { - if (left.is_on_top_boundary()) + if (left.is_on_top_boundary()) return (right.is_on_top_boundary()); - - if (right.is_on_top_boundary()) + + if (right.is_on_top_boundary()) return (false); - - return (left.top() == right.top() || left.top()->twin() == right.top()); + + return (left.top() == right.top() || left.top()->twin() == right.top()); } - //returns true if the trapezoid is a curve + //returns true if the trapezoid is a curve bool is_empty_item(const Td_map_item& tr) const { return (tr.which() == 0); @@ -983,7 +984,7 @@ public: default: return false; } - } + } //returns true if the map item is a vertex bool is_td_vertex(const Td_map_item& tr) const @@ -1000,7 +1001,7 @@ public: } } - //returns true if the map item is an edge + //returns true if the map item is an edge bool is_td_edge(const Td_map_item& tr) const { switch (tr.which()) @@ -1013,7 +1014,7 @@ public: } } - //returns true if the map item is an edge + //returns true if the map item is an edge bool is_td_trapezoid(const Td_map_item& tr) const { switch (tr.which()) @@ -1026,7 +1027,7 @@ public: } } - //returns true if the trapezoid is a curve + //returns true if the trapezoid is a curve bool is_fictitious_vertex(const Td_map_item& tr) const { switch (tr.which()) @@ -1039,7 +1040,7 @@ public: } } - //returns true if the trapezoid is a curve + //returns true if the trapezoid is a curve bool is_active(const Td_map_item& tr) const { switch (tr.which()) @@ -1054,7 +1055,7 @@ public: } } - //returns true if the trapezoid is vertical + //returns true if the trapezoid is vertical bool is_vertical(Td_map_item& item) const { CGAL_precondition(is_td_edge(item)); @@ -1066,16 +1067,16 @@ public: return (this->compare_curve_end_x_2_object() (Curve_end(he,ARR_MIN_END), Curve_end(he,ARR_MAX_END))== EQUAL); } - - /* returns whether given edge end is inside the given trapezoid using + + /* returns whether given edge end is inside the given trapezoid using lexicographic order */ bool is_inside (Td_map_item& item, const Curve_end& ce) const { CGAL_precondition( is_active(item) ); CGAL_precondition( is_td_trapezoid(item) ); Td_active_trapezoid tr (boost::get(item)); - - return + + return ( tr.is_on_left_boundary() || (compare_curve_end_xy_2_object() (vtx_to_ce(tr.left()),ce) == SMALLER) ) && @@ -1088,7 +1089,7 @@ public: (compare_curve_end_y_at_x_2_object()(ce, tr.top()) == SMALLER) ); } - /*! returns true if the end point is inside the closure of the trapezoid + /*! returns true if the end point is inside the closure of the trapezoid (inlcude all boundaries) */ bool is_in_closure (const Td_active_trapezoid& tr, const Curve_end& ce ) const { @@ -1101,24 +1102,24 @@ public: (ce,vtx_to_ce(tr.right())) != LARGER)) ) { // test bottom side - if (!tr.is_on_bottom_boundary() && - compare_curve_end_y_at_x_2_object()(ce,tr.bottom()) == SMALLER ) + if (!tr.is_on_bottom_boundary() && + compare_curve_end_y_at_x_2_object()(ce,tr.bottom()) == SMALLER ) { return false; } - + // test top side - if (!tr.is_on_top_boundary() && + if (!tr.is_on_top_boundary() && compare_curve_end_y_at_x_2_object()(ce,tr.top()) == LARGER) { return false; } - + return true; } return false; - } - /*! returns true if the end point is inside the closure of the trapezoid + } + /*! returns true if the end point is inside the closure of the trapezoid (inlcude all boundaries) */ bool is_in_closure (const Td_active_edge& e, const Curve_end& ce ) const { @@ -1134,7 +1135,7 @@ public: Curve_end vtx_to_ce(Vertex_const_handle v) const { //the circulator is of incoming halfedges - Halfedge_around_vertex_const_circulator he = v->incident_halfedges(); + Halfedge_around_vertex_const_circulator he = v->incident_halfedges(); //if the vertex is associated with a point on the bounded coords, // we can take any incident halfedge. o/w if the vertex lies at infinity, // it has 2 fictitious incident halfedges @@ -1142,10 +1143,10 @@ public: if (v->is_at_open_boundary() && he->source()->is_at_open_boundary()) ++he; return Curve_end(he->curve(), - (he->direction() == ARR_RIGHT_TO_LEFT)? + (he->direction() == ARR_RIGHT_TO_LEFT)? ARR_MIN_END : ARR_MAX_END); } - + public: static Vertex_const_handle empty_vtx_handle() { diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h index b56f3e38d90..c0cecfbde8d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h @@ -69,6 +69,10 @@ public: Right_side_category>::result Are_all_sides_oblivious_tag; + typedef typename Arr_two_sides_category::result + Bottom_or_top_sides_category; + typedef typename Subcurve_traits_2::Point_2 Point_2; typedef typename Subcurve_traits_2::X_monotone_curve_2 X_monotone_subcurve_2; @@ -1495,7 +1499,7 @@ public: m_poly_traits(traits) {} - /*! Compare the x-limit of a point with the x-coordinate of an + /*! Compare the x-coordinates of a point with the x-coordinate of an * x-curve-end on the boundary. * \param point the point. * \param xcv the x-curve, the endpoint of which is compared. @@ -1513,19 +1517,9 @@ public: Comparison_result operator()(const Point_2& point, const X_monotone_curve_2& xcv, Arr_curve_end ce) const - { - const Subcurve_traits_2* geom_traits = - m_poly_traits.subcurve_traits_2(); - Comparison_result direction = - geom_traits->compare_endpoints_xy_2_object()(xcv[0]); - const X_monotone_subcurve_2& xs = - (((direction == SMALLER) && (ce == ARR_MAX_END)) || - ((direction == LARGER) && (ce == ARR_MIN_END))) ? - xcv[0] : xcv[xcv.number_of_subcurves()-1]; - return geom_traits->compare_x_on_boundary_2_object()(point, xs, ce); - } + { return operator()(point, xcv, ce, Bottom_or_top_sides_category()); } - /*! Compare the x-coordinates of 2 curve-ends near the boundary of the + /*! Compare the x-coordinates of 2 curve-ends on the boundary of the * parameter space. * \param xcv1 the first curve. * \param ce1 the first curve-end indicator: @@ -1550,6 +1544,35 @@ public: Arr_curve_end ce1, const X_monotone_curve_2& xcv2, Arr_curve_end ce2) const + { return operator()(xcv1, ce1, xcv2, ce2, Bottom_or_top_sides_category()); } + + private: + /*! \brief compares the x-coordinates of a point with the x-coordinate of + * an x-curve-end on the boundary. + */ + Comparison_result operator()(const Point_2& point, + const X_monotone_curve_2& xcv, + Arr_curve_end ce, + Arr_boundary_cond_tag) const + { + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); + Comparison_result direction = + geom_traits->compare_endpoints_xy_2_object()(xcv[0]); + const X_monotone_subcurve_2& xs = + (((direction == SMALLER) && (ce == ARR_MAX_END)) || + ((direction == LARGER) && (ce == ARR_MIN_END))) ? + xcv[0] : xcv[xcv.number_of_subcurves()-1]; + return geom_traits->compare_x_on_boundary_2_object()(point, xs, ce); + } + + /*! \brief compares the x-coordinates of 2 curve-ends on the boundary of + * the parameter space. + */ + Comparison_result operator()(const X_monotone_curve_2& xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2& xcv2, + Arr_curve_end ce2, + Arr_boundary_cond_tag) const { const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); Comparison_result direction1 = @@ -1566,27 +1589,9 @@ public: xcv2[0] : xcv2[xcv2.number_of_subcurves()-1]; return geom_traits->compare_x_on_boundary_2_object()(xs1, ce1, xs2, ce2); } - }; - /*! Obtain a Compare_x_on_boundary_2 function object. */ - Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const - { return Compare_x_on_boundary_2(*this); } - - class Compare_x_at_limit_2{ - protected: - typedef Arr_polycurve_basic_traits_2 - Polycurve_basic_traits_2; - - /*! The polycurve traits (in case it has state). */ - const Polycurve_basic_traits_2& m_poly_traits; - - public: - Compare_x_at_limit_2(const Polycurve_basic_traits_2& traits) : - m_poly_traits(traits) - {} - - unsigned int get_curve_index (const X_monotone_curve_2& xcv, - const Arr_curve_end ce) const + size_type get_curve_index(const X_monotone_curve_2& xcv, + const Arr_curve_end ce) const { //waqar:: dont know why it is opposite in Parameter_space_in_x... // I think this is because of the way the subcurves are stored in the @@ -1599,31 +1604,48 @@ public: return (ce == ARR_MIN_END) ? 0 : xcv.number_of_subcurves() - 1; } + /*! Given a point p, an x-monotone curve C(t) = (X(t),Y(t)), + * and an enumerator that specifies either the minimum end or the + * maximum end of the curve, and thus maps to a parameter value + * d in {0,1}, compare x_p and limit{t => d} X(t). + * If the parameter space is unbounded, a precondition ensures that C has + * a vertical asymptote at its d-end; that is limit{t => d} X(t) is finite. + */ Comparison_result operator()(const Point_2& p, const X_monotone_curve_2& xcv, - Arr_curve_end ce) const + Arr_curve_end ce, + Arr_has_open_side_tag) const { const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); - typename Subcurve_traits_2::Compare_x_at_limit_2 compare_x_at_limit = - geom_traits->compare_x_at_limit_2_object(); + typename Subcurve_traits_2::Compare_x_on_boundary_2 + compare_x_on_boundary = geom_traits->compare_x_on_boundary_2_object(); - unsigned int index = this->get_curve_index(xcv, ce); - return compare_x_at_limit(p, xcv[index], ce ); + size_type index = this->get_curve_index(xcv, ce); + return compare_x_on_boundary(p, xcv[index], ce ); } + /*! Given two x-monotone curves C1(t) = (X1(t),Y1(t)) and + * C2(t) = (X2(t),Y2(t)) and two enumerators that specify either the + * minimum ends or the maximum ends of the curves, and thus map to + * parameter values d1 in {0,1} and d2 in {0,1} for C1 and for C2, + * respectively, compare limit{t => d1} X1(t) and limit{t => d2} X2(t). + * If the parameter space is unbounded, a precondition ensures that + * C1 and C2 have vertical asymptotes at their respective ends; + * that is, limit{t => d1} X1(t) and limit{t =? d2} X2(t) are finite. + */ Comparison_result operator()(const X_monotone_curve_2& xcv1, Arr_curve_end ce1/* for xcv1 */, const X_monotone_curve_2 & xcv2, - Arr_curve_end ce2/*! for xcv2 */) const + Arr_curve_end ce2/*! for xcv2 */, + Arr_has_open_side_tag) const { const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); - typename Subcurve_traits_2::Compare_x_at_limit_2 compare_x_at_limit = - geom_traits->compare_x_at_limit_2_object(); + typename Subcurve_traits_2::Compare_x_at_on_boundary + compare_x_on_boundary = geom_traits->compare_x_on_boundary_2_object(); - unsigned int index_1 = this->get_curve_index(xcv1, ce1); - unsigned int index_2 = this->get_curve_index(xcv2, ce2); - - return compare_x_at_limit(xcv1[index_1], ce1, xcv2[index_2], ce2); + size_type index_1 = this->get_curve_index(xcv1, ce1); + size_type index_2 = this->get_curve_index(xcv2, ce2); + return compare_x_on_boundary(xcv1[index_1], ce1, xcv2[index_2], ce2); } Comparison_result operator()(const X_monotone_curve_2& xcv, @@ -1632,19 +1654,19 @@ public: Arr_curve_end ce2/*! for xseg */) const { const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); - typename Subcurve_traits_2::Compare_x_at_limit_2 - compare_x_at_limit = geom_traits->compare_x_at_limit_2_object(); + typename Subcurve_traits_2::Compare_x_on_boundary_2 + compare_x_on_boundary = geom_traits->compare_x_on_boundary_2_object(); - unsigned int index = this->get_curve_index(xcv, ce1 ); - - return compare_x_at_limit(xcv[index], ce1, xseg, ce2 ); + size_type index = this->get_curve_index(xcv, ce1 ); + return compare_x_on_boundary(xcv[index], ce1, xseg, ce2); } }; - Compare_x_at_limit_2 compare_x_at_limit_2_object() const - { return Compare_x_at_limit_2(*this); } + /*! Obtain a Compare_x_on_boundary_2 function object. */ + Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const + { return Compare_x_on_boundary_2(*this); } - class Compare_x_near_limit_2{ + class Compare_x_near_boundary_2{ protected: typedef Arr_polycurve_basic_traits_2 Polycurve_basic_traits_2; @@ -1653,7 +1675,7 @@ public: const Polycurve_basic_traits_2& m_poly_traits; public: - Compare_x_near_limit_2(const Polycurve_basic_traits_2& traits) : + Compare_x_near_boundary_2(const Polycurve_basic_traits_2& traits) : m_poly_traits(traits) {} @@ -1678,18 +1700,18 @@ public: Arr_curve_end ce) const { const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); - typename Subcurve_traits_2::Compare_x_near_limit_2 - cmp_x_near_limit = geom_traits->compare_x_near_limit_2_object(); + typename Subcurve_traits_2::Compare_x_near_boundary_2 + cmp_x_near_boundary = geom_traits->compare_x_near_boundary_2_object(); unsigned int index_1 = this->get_curve_index(xcv1, ce); unsigned int index_2 = this->get_curve_index(xcv2, ce); - return cmp_x_near_limit(xcv1[index_1], xcv2[index_2], ce); + return cmp_x_near_boundary(xcv1[index_1], xcv2[index_2], ce); } }; - Compare_x_near_limit_2 compare_x_near_limit_2_object() const - { return Compare_x_near_limit_2(*this); } + Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const + { return Compare_x_near_boundary_2(*this); } /*! A functor that compares the y-coordinate of two given points * that lie on the vertical identification curve. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h index 95773584a4e..b2415a64387 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h @@ -95,8 +95,7 @@ public: typedef typename Base::Parameter_space_in_x_2 Parameter_space_in_x_2; typedef typename Base::Parameter_space_in_y_2 Parameter_space_in_y_2; typedef typename Base::Compare_x_on_boundary_2 Compare_x_on_boundary_2; - typedef typename Base::Compare_x_at_limit_2 Compare_x_at_limit_2; - typedef typename Base::Compare_x_near_limit_2 Compare_x_near_limit_2; + typedef typename Base::Compare_x_near_boundary_2 Compare_x_near_boundary_2; typedef typename Base::Compare_y_on_boundary_2 Compare_y_on_boundary_2; typedef typename Base::Compare_y_near_boundary_2 Compare_y_near_boundary_2; typedef typename Base::Is_on_y_identification_2 Is_on_y_identification_2; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h index e366f2a44cc..2be86d4c770 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h @@ -104,8 +104,7 @@ public: typedef typename Base::Parameter_space_in_x_2 Parameter_space_in_x_2; typedef typename Base::Parameter_space_in_y_2 Parameter_space_in_y_2; typedef typename Base::Compare_x_on_boundary_2 Compare_x_on_boundary_2; - typedef typename Base::Compare_x_at_limit_2 Compare_x_at_limit_2; - typedef typename Base::Compare_x_near_limit_2 Compare_x_near_limit_2; + typedef typename Base::Compare_x_near_boundary_2 Compare_x_near_boundary_2; typedef typename Base::Compare_y_on_boundary_2 Compare_y_on_boundary_2; typedef typename Base::Compare_y_near_boundary_2 Compare_y_near_boundary_2; typedef typename Base::Is_on_y_identification_2 Is_on_y_identification_2; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h index d91cffb7aed..c347a05cb7d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h @@ -57,11 +57,11 @@ namespace Arr_rational_arc { // Denominator(x) // // where Numerator and Denominator are polynomial with integer (or rational) coefficients. -// The class is templated with two parameters: +// The class is templated with two parameters: // Algebraic_kernel: An algebraic kernel for the intersection points of the curves // // This class serves as the base for the classes: -// Rational_arc_d_1 (a general, not necessarily continuous arc) +// Rational_arc_d_1 (a general, not necessarily continuous arc) // Continuous_rational_arc_d_1 (a continuous portion of a rational function). //--------------------------------------------------------------------------// @@ -88,13 +88,13 @@ public: typedef typename Base_rational_arc_ds_1::Coefficient Coefficient; typedef typename Base_rational_arc_ds_1::Arithmetic_kernel Arithmetic_kernel; - typedef typename Base_rational_arc_ds_1::Rational Rational; + typedef typename Base_rational_arc_ds_1::Rational Rational; typedef typename Base_rational_arc_ds_1::Integer Integer; typedef typename Base_rational_arc_ds_1::Algebraic_real_1 Algebraic_real_1; typedef typename Base_rational_arc_ds_1::Algebraic_vector Algebraic_vector; typedef typename Base_rational_arc_ds_1::Multiplicity_vector Multiplicity_vector; - + typedef std::vector Rat_vector; typedef Polynomial_traits_d Polynomial_traits_1; @@ -102,13 +102,13 @@ public: typedef typename Base_rational_arc_ds_1::Solve_1 Solve_1; typedef typename Algebraic_kernel::Bound Bound; typedef Algebraic_structure_traits AT_poly; - + typedef Polynomial Poly_rat_1; typedef Polynomial_traits_d PT_rat_1; typedef Fraction_traits FT_poly_rat_1; typedef Algebraic_point_2 Point_2; - + CGAL_static_assertion((boost::is_same::value)); CGAL_static_assertion((boost::is_same::value)); @@ -125,7 +125,7 @@ public: { return cache.get_rational_function(rat); } - const Rational_function_pair get_rational_pair(const Rational_function& f, + const Rational_function_pair get_rational_pair(const Rational_function& f, const Rational_function& g, const Cache& cache) const { @@ -159,11 +159,11 @@ public: IS_CONTINUOUS = 512, IS_VALID = 1024 }; - - Rational_function _f; // The rational function + + Rational_function _f; // The rational function Algebraic_point_2 _ps; // The source point. Algebraic_point_2 _pt; // The target point. - int _info; // A set of Boolean flags. + int _info; // A set of Boolean flags. public: //------------ @@ -175,11 +175,11 @@ public: Base_rational_arc_d_1() : _info(0) {} - + //--------------------------------------------------------------------------- // Constructor of a whole polynomial curve defined by pcoeffs - the rational // coefficients of the polynomial p(x). - + Base_rational_arc_d_1(const Polynomial_1& P, const Cache& cache) : _info(0) { @@ -195,14 +195,14 @@ public: pcoeffs.end())); Integer denom_int; typename FT_poly_rat_1::Decompose()(num_rat, _numer, denom_int); - + _init(_numer,denom_int,cache); } void _init(const Polynomial_1& P,const Integer& Q_int,const Cache& cache) { CGAL_precondition(!CGAL::is_zero(Q_int)); - //set rational function + //set rational function Polynomial_1 Q= typename Polynomial_traits_1::Construct_polynomial()(Q_int); _f = get_rational_function(P, Q, cache); @@ -216,18 +216,18 @@ public: const int deg_num(CGAL::degree(P)); Integer lead_coeff(CGAL::leading_coefficient(Q)); CGAL::Sign lead_sign(CGAL::sign(lead_coeff)); - + if (deg_num > 0) { // Check if the degree is even or odd and check the sign of the leading // coefficient of the polynomial. - + CGAL_assertion(lead_sign != CGAL::ZERO); if (deg_num % 2 == 0) { // Polynomial of an even degree. - if (lead_sign == CGAL::NEGATIVE) + if (lead_sign == CGAL::NEGATIVE) _info = (_info | SRC_AT_Y_MINUS_INFTY | TRG_AT_Y_MINUS_INFTY); else _info = (_info | SRC_AT_Y_PLUS_INFTY | TRG_AT_Y_PLUS_INFTY); @@ -255,10 +255,10 @@ public: _info = (_info | IS_CONTINUOUS); _info = (_info | IS_VALID); - } + } //--------------------------------------------------------------------------- - //Constructor of a polynomial ray, defined by y = p(x), + //Constructor of a polynomial ray, defined by y = p(x), //for x_s <= x if the ray is directed to the right, or //for x_s >= x if it is directed to the left. //param pcoeffs The rational coefficients of the polynomial p(x). @@ -283,7 +283,7 @@ public: pcoeffs.end())); Integer denom_int; typename FT_poly_rat_1::Decompose()(num_rat, _numer, denom_int); - + _init(_numer, denom_int, x_s, dir_right, cache); } @@ -291,7 +291,7 @@ public: const Algebraic_real_1& x_s, bool dir_right,const Cache& cache) { CGAL_precondition(!CGAL::is_zero(Q_int)); - //set rational function + //set rational function Polynomial_1 Q = typename Polynomial_traits_1::Construct_polynomial()(Q_int); _f = get_rational_function(P,Q,cache); @@ -343,7 +343,7 @@ public: // In the case of a constant polynomial it is possible to set a finite // y-coordinate for the target point. // x coordinate is 0 although in practice is +-oo - _pt = Algebraic_point_2(get_rational_function(P, Q, cache), + _pt = Algebraic_point_2(get_rational_function(P, Q, cache), Algebraic_real_1()); } @@ -371,23 +371,23 @@ public: const Algebraic_real_1& x_s,const Algebraic_real_1& x_t, const Cache& cache): _info(0) - { + { // Set the numerator & denominator polynomials. Polynomial_1 _numer; Poly_rat_1 num_rat(typename PT_rat_1::Construct_polynomial()(pcoeffs.begin(), pcoeffs.end())); Integer denom_int; typename FT_poly_rat_1::Decompose()(num_rat, _numer, denom_int); - + _init(_numer, denom_int, x_s, x_t, cache); - } + } void _init(const Polynomial_1& P,const Integer& Q_int, const Algebraic_real_1& x_s,const Algebraic_real_1& x_t, const Cache& cache) { CGAL_precondition(!CGAL::is_zero(Q_int)); - //set rational function + //set rational function Polynomial_1 Q = typename Polynomial_traits_1::Construct_polynomial()(Q_int); _f = get_rational_function(P, Q, cache); @@ -402,7 +402,7 @@ public: // Set the endpoints. _ps=Algebraic_point_2(_f,x_s); _pt=Algebraic_point_2(_f,x_t); - + // Mark that the arc is continuous and valid. _info = (_info | IS_CONTINUOUS); _info = (_info | IS_VALID); @@ -440,16 +440,16 @@ public: _init(_numer,_denom,cache); } - void _init(const Polynomial_1& P_, const Polynomial_1& Q_, const Cache& cache) + void _init(const Polynomial_1& P_, const Polynomial_1& Q_, const Cache& cache) { CGAL_precondition(!CGAL::is_zero(Q_)); - //set rational function + //set rational function // Set the numerator & denominator polynomials. Polynomial_1 P; Polynomial_1 Q; _canonicalize(P_, Q_, P, Q); - + _f = get_rational_function(P, Q, cache); // Mark that the endpoints of the rational functions are unbounded (the @@ -458,7 +458,7 @@ public: _info = (_info | TRG_AT_X_PLUS_INFTY); _info = (_info | IS_DIRECTED_RIGHT); - + // Analyze the bahaviour of the rational function at x = -oo (the source). Algebraic_real_1 y0; const Arr_parameter_space inf_s = _analyze_at_minus_infinity(P, Q, y0); @@ -487,7 +487,7 @@ public: //--------------------------------------------------------------------------- //Constructor of a ray of a rational function, defined by y = p(x)/q(x), - //for x_s <= x if the ray is directed to the right, or + //for x_s <= x if the ray is directed to the right, or //for x_s >= x if the ray is directed to the left. //param pcoeffs The rational coefficients of the polynomial p(x). //param qcoeffs The rational coefficients of the polynomial q(x). @@ -526,10 +526,10 @@ public: void _init(const Polynomial_1& P_, const Polynomial_1& Q_, const Algebraic_real_1& x_s, bool dir_right, - const Cache& cache) + const Cache& cache) { CGAL_precondition(!CGAL::is_zero(Q_)); - //set rational function + //set rational function Polynomial_1 P; Polynomial_1 Q; _canonicalize(P_,Q_,P,Q); @@ -547,7 +547,7 @@ public: } - //The source point has a bounded x-coordinate. + //The source point has a bounded x-coordinate. _ps = Algebraic_point_2(_f, x_s); //check if the source point lies next to a pole. if (typename Algebraic_kernel::Sign_at_1()(Q, x_s) != CGAL::ZERO) @@ -578,8 +578,8 @@ public: // The target point is at x = -oo. inf_t =_analyze_at_minus_infinity(P, Q, y0); } - - if (inf_t == ARR_BOTTOM_BOUNDARY) + + if (inf_t == ARR_BOTTOM_BOUNDARY) _info = (_info | TRG_AT_Y_MINUS_INFTY); else if (inf_t == ARR_TOP_BOUNDARY) _info = (_info | TRG_AT_Y_PLUS_INFTY); @@ -634,7 +634,7 @@ public: const Cache& cache) { CGAL_precondition(!CGAL::is_zero(Q_)); - //set rational function + //set rational function Polynomial_1 P; Polynomial_1 Q; _canonicalize(P_, Q_, P, Q); @@ -662,7 +662,7 @@ public: std::pair signs = _analyze_near_pole(x_s); const CGAL::Sign sign_s = ((_info & IS_DIRECTED_RIGHT) != 0) ? signs.second : signs.first; - + if (sign_s == CGAL::NEGATIVE) _info = (_info | SRC_AT_Y_MINUS_INFTY); else @@ -701,7 +701,7 @@ public: //----------------------------- // Accessing the arc properties //----------------------------- - + //----------------------------------------------------------------- //Get the numerator polynomial of the underlying rational function. const Polynomial_1& numerator() const @@ -759,9 +759,9 @@ public: //Get the source point const Algebraic_point_2& source() const { - CGAL_precondition((_info & IS_VALID) != 0 && - source_parameter_space_in_x() == ARR_INTERIOR && - source_parameter_space_in_y() == ARR_INTERIOR); + CGAL_precondition((_info & IS_VALID) != 0); + CGAL_precondition(source_parameter_space_in_x() == ARR_INTERIOR); + CGAL_precondition(source_parameter_space_in_y() == ARR_INTERIOR); return (_ps); } @@ -769,8 +769,8 @@ public: //Get the x-coordinate of the source point Algebraic_real_1 source_x() const { - CGAL_precondition((_info & IS_VALID) != 0 && - source_parameter_space_in_x() == ARR_INTERIOR); + CGAL_precondition((_info & IS_VALID) != 0); + CGAL_precondition(source_parameter_space_in_x() == ARR_INTERIOR); return (_ps.x()); } @@ -788,9 +788,9 @@ public: //Get the target point const Algebraic_point_2& target() const { - CGAL_precondition((_info & IS_VALID) != 0 && - target_boundary_in_x() == ARR_INTERIOR && - target_boundary_in_y() == ARR_INTERIOR); + CGAL_precondition((_info & IS_VALID) != 0); + CGAL_precondition(target_boundary_in_x() == ARR_INTERIOR); + CGAL_precondition(target_boundary_in_y() == ARR_INTERIOR); return (_pt); } @@ -798,8 +798,8 @@ public: //Get the x-coordinate of the target point Algebraic_real_1 target_x() const { - CGAL_precondition((_info & IS_VALID) != 0 && - target_boundary_in_x() == ARR_INTERIOR); + CGAL_precondition((_info & IS_VALID) != 0); + CGAL_precondition(target_boundary_in_x() == ARR_INTERIOR); return (_pt.x()); } @@ -856,16 +856,16 @@ public: //Get the x_value of the right endpoint const Algebraic_real_1& right_x() const { - CGAL_precondition((_info & IS_VALID) != 0 && - right_parameter_space_in_x() == ARR_INTERIOR ); + CGAL_precondition((_info & IS_VALID) != 0); + CGAL_precondition(right_parameter_space_in_x() == ARR_INTERIOR ); return ((_info & IS_DIRECTED_RIGHT) ? _pt.x() : _ps.x()); } //--------------------- //Get the left endpoint const Algebraic_point_2& left() const { - CGAL_precondition(left_parameter_space_in_x() == ARR_INTERIOR && - left_parameter_space_in_y() == ARR_INTERIOR); + CGAL_precondition(left_parameter_space_in_x() == ARR_INTERIOR); + CGAL_precondition(left_parameter_space_in_y() == ARR_INTERIOR); return ((_info & IS_DIRECTED_RIGHT) ? _ps : _pt); } @@ -873,8 +873,8 @@ public: //Get the right endpoint const Algebraic_point_2& right() const { - CGAL_precondition(right_parameter_space_in_x() == ARR_INTERIOR && - right_parameter_space_in_y() == ARR_INTERIOR); + CGAL_precondition(right_parameter_space_in_x() == ARR_INTERIOR); + CGAL_precondition(right_parameter_space_in_y() == ARR_INTERIOR); return ((_info & IS_DIRECTED_RIGHT) ? _pt : _ps); } @@ -927,7 +927,7 @@ public: // ARR_INTERIOR; // Algebraic_real_1 left,right; // if (left_parameter_space == ARR_INTERIOR) -// left = +// left = // (left_parameter_space_in_x()!= ARR_INTERIOR) ? arc.left_x(): // (arc.left_parameter_space_in_x()!= ARR_INTERIOR) ? left_x() : // (arc.left_x() < left_x()) ? left_x() : @@ -939,7 +939,7 @@ public: // arc.right_x(); // if (left > right) // return false; - + // //check if the base functions are equal // if (_has_same_base (arc)) // return true; @@ -947,15 +947,15 @@ public: // get_rational_function(arc._numer,arc._denom)); // return rat_pair.is_intersecting_in_range(left_parameter_space,left,right_parameter_space,right); // } - + //-------------------------------------------------------- - //Split the arc into two at a given pole. - //The function returns the sub-arc to the left of the pole + //Split the arc into two at a given pole. + //The function returns the sub-arc to the left of the pole //and sets (*this) to be the right sub-arc. //param x0 The x-coordinate of the pole. //precondition x0 lies in the interior of the arc. //return The sub-arc to the left of the pole. - + Self split_at_pole(const Algebraic_real_1& x0) { // Analyze the behaviour of the function near the given pole. @@ -995,7 +995,7 @@ public: c1._info = (c1._info | SRC_AT_Y_MINUS_INFTY); else c1._info = (c1._info | SRC_AT_Y_PLUS_INFTY); - + this->_pt = p0; this->_info = (this->_info & ~TRG_INFO_BITS); if (sign_right == CGAL::NEGATIVE) @@ -1009,11 +1009,11 @@ public: return (c1); } - + //--------------- //name Predicates //--------------- - + //--------------------------------------------------------------------------- //Get the relative position of the point with respect to the rational arc. @@ -1037,7 +1037,7 @@ public: return rat_pair.compare_f_g_at(p.x()); } //--------------------------------------------------------------------------- - //Compare the x-coordinate of a vertical asymptote of the arc + //Compare the x-coordinate of a vertical asymptote of the arc //(one of its ends) and the given point. Comparison_result compare_end(Arr_curve_end ce, const Algebraic_point_2& p) const @@ -1045,8 +1045,8 @@ public: Algebraic_real_1 x0; if (ce == ARR_MIN_END) { - CGAL_assertion(left_parameter_space_in_x() == ARR_INTERIOR && - left_parameter_space_in_y() != ARR_INTERIOR); + CGAL_assertion(left_parameter_space_in_x() == ARR_INTERIOR); + CGAL_assertion(left_parameter_space_in_y() != ARR_INTERIOR); if ((_info & IS_DIRECTED_RIGHT) != 0) x0 = _ps.x(); else @@ -1054,8 +1054,8 @@ public: } else { - CGAL_assertion(right_parameter_space_in_x() == ARR_INTERIOR && - right_parameter_space_in_y() != ARR_INTERIOR); + CGAL_assertion(right_parameter_space_in_x() == ARR_INTERIOR); + CGAL_assertion(right_parameter_space_in_y() != ARR_INTERIOR); if ((_info & IS_DIRECTED_RIGHT) != 0) x0 = _pt.x(); else @@ -1070,7 +1070,7 @@ public: return ((ce == ARR_MIN_END) ? LARGER : SMALLER); } - + //------------------------------------------------------------------ //Compare the x-coordinate of a vertical asymptotes of the two arcs. //approaching from the same direction @@ -1104,7 +1104,7 @@ public: if (_has_same_base(arc)) return CGAL::EQUAL; Rational_function_pair rat_pair = get_rational_pair(_f,arc._f,cache); - + CGAL::Comparison_result comp_f_g_y = rat_pair.compare_f_g_at(x,ce == ARR_MAX_END ? CGAL::NEGATIVE : CGAL::POSITIVE); @@ -1121,8 +1121,8 @@ public: } //------------------------------------------------------------------ - //Compare the x-coordinate of a vertical asymptotes of the two arcs. - Comparison_result compare_ends(Arr_curve_end ind1,const Self& arc, + //Compare the x-coordinate of a vertical asymptotes of the two arcs. + Comparison_result compare_ends(Arr_curve_end ind1,const Self& arc, Arr_curve_end ind2, const Cache& cache) const { // Get the x-coordinates of the first vertical asymptote. @@ -1130,8 +1130,8 @@ public: if (ind1 == ARR_MIN_END) { - CGAL_assertion(left_parameter_space_in_x() == ARR_INTERIOR && - left_parameter_space_in_y() != ARR_INTERIOR); + CGAL_assertion(left_parameter_space_in_x() == ARR_INTERIOR); + CGAL_assertion(left_parameter_space_in_y() != ARR_INTERIOR); if ((_info & IS_DIRECTED_RIGHT) != 0) x1 = _ps.x(); else @@ -1139,8 +1139,8 @@ public: } else { - CGAL_assertion(right_parameter_space_in_x() == ARR_INTERIOR && - right_parameter_space_in_y() != ARR_INTERIOR); + CGAL_assertion(right_parameter_space_in_x() == ARR_INTERIOR); + CGAL_assertion(right_parameter_space_in_y() != ARR_INTERIOR); if ((_info & IS_DIRECTED_RIGHT) != 0) x1 = _pt.x(); else @@ -1152,8 +1152,8 @@ public: if (ind2 == ARR_MIN_END) { - CGAL_assertion(arc.left_parameter_space_in_x() == ARR_INTERIOR && - arc.left_parameter_space_in_y() != ARR_INTERIOR); + CGAL_assertion(arc.left_parameter_space_in_x() == ARR_INTERIOR); + CGAL_assertion(arc.left_parameter_space_in_y() != ARR_INTERIOR); if ((arc._info & IS_DIRECTED_RIGHT) != 0) x2 = arc._ps.x(); else @@ -1161,8 +1161,8 @@ public: } else { - CGAL_assertion(arc.right_parameter_space_in_x() == ARR_INTERIOR && - arc.right_parameter_space_in_y() != ARR_INTERIOR); + CGAL_assertion(arc.right_parameter_space_in_x() == ARR_INTERIOR); + CGAL_assertion(arc.right_parameter_space_in_y() != ARR_INTERIOR); if ((arc._info & IS_DIRECTED_RIGHT) != 0) x2 = arc._pt.x(); else @@ -1188,13 +1188,13 @@ public: if (_has_same_base(arc)) return CGAL::EQUAL; Rational_function_pair rat_pair = get_rational_pair(_f,arc._f,cache); - + CGAL::Comparison_result comp_f_g_y = rat_pair.compare_f_g_at(x1, ind1 == ARR_MAX_END ? CGAL::NEGATIVE : CGAL::POSITIVE); if( ind1 == ARR_MAX_END) { - CGAL_postcondition(ind2 == ARR_MAX_END); + CGAL_postcondition(ind2 == ARR_MAX_END); CGAL_postcondition(right_parameter_space_in_y() == arc.right_parameter_space_in_y()); return (right_parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) ? @@ -1202,7 +1202,7 @@ public: } else { - CGAL_postcondition(ind2 == ARR_MIN_END); + CGAL_postcondition(ind2 == ARR_MIN_END); CGAL_postcondition(left_parameter_space_in_y() == arc.left_parameter_space_in_y()); return (left_parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) ? @@ -1211,7 +1211,7 @@ public: } //------------------------------------------------------------------ - // Compare the slopes of the arc with another given arc + // Compare the slopes of the arc with another given arc // at their given intersection point. // param cv The given arc. // param p The intersection point. @@ -1224,7 +1224,7 @@ public: // deleted!!! //------------------------------------------------------------------ - // Compare the two arcs at a given intersection point + // Compare the two arcs at a given intersection point // param arc The given arc // param p The intersection point // param to_left to check to the left or to the right of intersection point @@ -1237,8 +1237,8 @@ public: const Algebraic_point_2& p, bool to_left, const Cache& cache) const { - CGAL_precondition(this->point_position(p,cache) == CGAL::EQUAL && - arc.point_position(p,cache) == CGAL::EQUAL); + CGAL_precondition(this->point_position(p,cache) == CGAL::EQUAL); + CGAL_precondition(arc.point_position(p,cache) == CGAL::EQUAL); //check if the base functions are equal if (_has_same_base(arc)) @@ -1260,8 +1260,8 @@ public: Comparison_result compare_at_minus_infinity(const Self& arc, const Cache& cache) const { - CGAL_precondition(left_parameter_space_in_x() == ARR_LEFT_BOUNDARY && - arc.left_parameter_space_in_x() == ARR_LEFT_BOUNDARY); + CGAL_precondition(left_parameter_space_in_x() == ARR_LEFT_BOUNDARY); + CGAL_precondition(arc.left_parameter_space_in_x() == ARR_LEFT_BOUNDARY); //check if the base functions are equal if (_has_same_base(arc)) @@ -1283,8 +1283,8 @@ public: Comparison_result compare_at_plus_infinity(const Self& arc, const Cache& cache) const { - CGAL_precondition(right_parameter_space_in_x() == ARR_RIGHT_BOUNDARY && - arc.right_parameter_space_in_x() == ARR_RIGHT_BOUNDARY); + CGAL_precondition(right_parameter_space_in_x() == ARR_RIGHT_BOUNDARY); + CGAL_precondition(arc.right_parameter_space_in_x() == ARR_RIGHT_BOUNDARY); //check if the base functions are equal if (_has_same_base(arc)) @@ -1379,8 +1379,8 @@ public: left_parameter_space_in_y() == ARR_INTERIOR && arc.right_parameter_space_in_x() == ARR_INTERIOR && arc.right_parameter_space_in_y() == ARR_INTERIOR && - //CGAL::equal(left_x(), arc.right_x()))); - (left_x() == arc.right_x()))); + //CGAL::equal(left_x(), arc.right_x()))); + (left_x() == arc.right_x()))); } //------------------------------------ //Constructions of points and curves @@ -1410,16 +1410,16 @@ public: if ((_info & IS_CONTINUOUS) != 0) arc._info = (arc._info | IS_CONTINUOUS); - + return (arc); } //------------------------ // Print the rational arc. std::ostream& print(std::ostream& os) const - { + { // Print y as a rational function of x. - os << "y = ("; + os << "y = ("; Base_rational_arc_ds_1::print_polynomial(os, this->numerator(), 'x'); os << ") / ("; Base_rational_arc_ds_1::print_polynomial(os, this->denominator(), 'x'); @@ -1427,7 +1427,7 @@ public: // Print the definition range. Arr_parameter_space inf_x = source_parameter_space_in_x(); - if (inf_x == ARR_LEFT_BOUNDARY) + if (inf_x == ARR_LEFT_BOUNDARY) os << "(-oo"; else if (inf_x == ARR_RIGHT_BOUNDARY) os << "(+oo"; @@ -1439,7 +1439,7 @@ public: os << ", "; inf_x = target_boundary_in_x(); - if (inf_x == ARR_LEFT_BOUNDARY) + if (inf_x == ARR_LEFT_BOUNDARY) os << "-oo)"; else if (inf_x == ARR_RIGHT_BOUNDARY) os << "+oo)"; @@ -1453,7 +1453,7 @@ public: protected: - + //------------------------------- //Auxiliary (protected) functions. //------------------------------- @@ -1484,7 +1484,7 @@ protected: } return; } - + //-------------------------------------------------------------------------- // Check if the given x-value is in the x-range of the arc. // param x The x-value. @@ -1492,7 +1492,7 @@ protected: // source point. // param eq_trg Output: Is this value equal to the x-coordinate of the // target point. - + bool _is_in_x_range(const Algebraic_real_1& x, bool& eq_src, bool& eq_trg) const { @@ -1512,29 +1512,29 @@ protected: if (res1 == SMALLER) return false; - + if (res1 == EQUAL) { eq_src = true; return true; } } - + // Compare to the right endpoint (the target in this case). if ((_info & TRG_AT_X_PLUS_INFTY) != 0) return true; const Comparison_result res2 = CGAL::compare(x, _pt.x()); - + if (res2 == LARGER) return false; - + if (res2 == EQUAL) eq_trg = true; return true; } - + // Compare to the left endpoint (the target in this case). if ((_info & TRG_AT_X_MINUS_INFTY) != 0) { @@ -1546,31 +1546,31 @@ protected: if (res1 == SMALLER) return false; - + if (res1 == EQUAL) { eq_trg = true; return true; } } - + // Compare to the right endpoint (the source in this case). if ((_info & SRC_AT_X_PLUS_INFTY) != 0) return true; const Comparison_result res2 = CGAL::compare(x, _ps.x()); - + if (res2 == LARGER) return false; - + if (res2 == EQUAL) eq_src = true; - + return true; } //---------------------------------------------------------- - // Check if the given x-value is in the x-range of the arc, + // Check if the given x-value is in the x-range of the arc, // excluding its open ends. bool _is_in_true_x_range(const Algebraic_real_1& x) const { @@ -1591,12 +1591,12 @@ protected: // If we reached here, the value is in the true x-range of the arc. return true; } - + //------------------------------------------------------------------------ // Check if the underlying rational function is the same in the given arc. // param arc The given arc. // return true if arc's underlying rational function is the same - // as of *this; + // as of *this; // false otherwise. bool _has_same_base(const Self& arc) const @@ -1611,10 +1611,10 @@ protected: // { // bool same_source(true); // bool same_target(true); - // if ( (this->source_parameter_space_in_x () == ARR_INTERIOR) && + // if ( (this->source_parameter_space_in_x () == ARR_INTERIOR) && // (this->source_parameter_space_in_y () == ARR_INTERIOR) ) // same_source = (this->source() == arc.source()); - // if ( (this->target_boundary_in_x () == ARR_INTERIOR) && + // if ( (this->target_boundary_in_x () == ARR_INTERIOR) && // (this->target_boundary_in_y () == ARR_INTERIOR) ) // same_target = (this->target() == arc.target()); // return (same_source && same_target); @@ -1683,7 +1683,7 @@ protected: // Get the leading coefficients. Integer p_lead(CGAL::leading_coefficient(P)); Integer q_lead(CGAL::leading_coefficient(Q)); - + if (deg_p == deg_q) { // We have a horizontal asymptote. @@ -1714,11 +1714,11 @@ protected: bool eq_src, eq_trg; typename std::list::const_iterator x_iter; - //solve for roots without caring for multiplicity + //solve for roots without caring for multiplicity //hence the usage of the bool var std::copy(_f.poles().begin(),_f.poles().end(),std::back_inserter (q_roots)); - + // Go over the roots and check whether they lie in the x-range of the arc. for (x_iter = q_roots.begin(); x_iter != q_roots.end(); ++x_iter) { @@ -1744,7 +1744,7 @@ protected: } //--------------------------------------------------------------------- - // Check whether the arc is continuous. + // Check whether the arc is continuous. bool _is_continuous() { // Compute the roots of the denominator polynomial, and make sure @@ -1780,7 +1780,7 @@ protected: //{ // // Get the degree. // const int deg = CGAL::degree(poly); - // + // // Integer coeff; // CGAL::Sign sgn; // int k; @@ -1792,7 +1792,7 @@ protected: // } // for (k = deg; k >= 0; k--) - // { + // { // //coeff = pt::Get_coefficient()(poly, k); // coeff = CGAL::get_coefficient(poly, k); // @@ -1804,7 +1804,7 @@ protected: // os << " - " << -coeff; // else // continue; - // + // // if (k > 1) // os << '*' << var << '^' << k; // else if (k == 1) @@ -1819,7 +1819,7 @@ protected: //------------------------------- //! Exporter for rational arcs. template -std::ostream& operator<<(std::ostream& os, +std::ostream& operator<<(std::ostream& os, const Base_rational_arc_d_1 & arc) { return (arc.print(os)); @@ -1838,12 +1838,12 @@ public: public: typedef Algebraic_kernel_ Algebraic_kernel; - + typedef Continuous_rational_arc_d_1 Self; typedef Base_rational_arc_d_1 Base; typedef typename Base::Integer Integer; - typedef typename Base::Rational Rational; + typedef typename Base::Rational Rational; typedef typename Base::Algebraic_real_1 Algebraic_real_1; typedef typename Base::Algebraic_point_2 Algebraic_point_2; typedef typename Base::Polynomial_1 Polynomial_1; @@ -1902,13 +1902,13 @@ public: * or to the left (to -oo). */ Continuous_rational_arc_d_1(const Polynomial_1& P, - const Algebraic_real_1& x_s, + const Algebraic_real_1& x_s, bool dir_right, const Cache& cache) : Base(P, x_s, dir_right,cache) {} Continuous_rational_arc_d_1(const Rat_vector& pcoeffs, - const Algebraic_real_1& x_s, + const Algebraic_real_1& x_s, bool dir_right, const Cache& cache) : Base(pcoeffs, x_s, dir_right,cache) {} @@ -1999,7 +1999,7 @@ public: } /*! - * Constructor of a bounded rational arc, defined by y = p(x)/q(x), + * Constructor of a bounded rational arc, defined by y = p(x)/q(x), * where: x_min <= x <= x_max. * \param pcoeffs The rational coefficients of the polynomial p(x). * \param qcoeffs The rational coefficients of the polynomial q(x). @@ -2037,7 +2037,7 @@ public: /// \name Constructions of points and curves. //@{ - + /*! * Compute the intersections with the given arc. * \param arc The given intersecting arc. @@ -2048,8 +2048,10 @@ public: OutputIterator intersect(const Self& arc, OutputIterator oi, const Cache& cache) const { - CGAL_precondition(this->is_valid() && this->is_continuous()); - CGAL_precondition(arc.is_valid() && arc.is_continuous()); + CGAL_precondition(this->is_valid()); + CGAL_precondition(this->is_continuous()); + CGAL_precondition(arc.is_valid()); + CGAL_precondition(arc.is_continuous()); if (this->equals(arc)) { @@ -2059,12 +2061,12 @@ public: } if (this->_has_same_base(arc)) - { + { // Get the left and right endpoints of (*this) and their information // bits. - const Algebraic_point_2& left1 = (this->is_directed_right() ? + const Algebraic_point_2& left1 = (this->is_directed_right() ? this->_ps : this->_pt); - const Algebraic_point_2& right1 = (this->is_directed_right() ? + const Algebraic_point_2& right1 = (this->is_directed_right() ? this->_pt : this->_ps); int info_left1, info_right1; @@ -2144,7 +2146,7 @@ public: Arr_parameter_space inf_r2 = arc.right_parameter_space_in_x(); Algebraic_point_2 p_right; int info_right; - + if (inf_r1 == ARR_INTERIOR && inf_r2 == ARR_INTERIOR) { // Let p_right be the rightmost of the two right endpoints. @@ -2191,9 +2193,9 @@ public: { // We have a single overlapping point. Just make sure this point // is not at y = -/+ oo. - if (info_left && + if (info_left && (this->SRC_AT_Y_MINUS_INFTY | this->SRC_AT_Y_PLUS_INFTY) == 0 && - info_right && + info_right && (this->SRC_AT_Y_MINUS_INFTY | this->SRC_AT_Y_PLUS_INFTY) == 0) { Intersection_point_2 ip(p_left, 0); @@ -2214,13 +2216,13 @@ public: overlap_arc._pt = p_right; overlap_arc._info = ((info_left) | (info_right << 4) | - this->IS_DIRECTED_RIGHT | this->IS_CONTINUOUS | + this->IS_DIRECTED_RIGHT | this->IS_CONTINUOUS | this->IS_VALID); *oi++ = make_object(overlap_arc); return (oi); } - + // We wish to find the intersection points between: // // y = p1(x)/q1(x) and y = p2(x)/q2(x) @@ -2230,7 +2232,7 @@ public: Rational_function_pair rat_pair = this->get_rational_pair(this->_f, arc._f, cache); - + typename Algebraic_vector::const_iterator x_iter; typename Multiplicity_vector::const_iterator m_iter; @@ -2256,7 +2258,7 @@ public: return (oi); } - + /*! * Split the arc into two at a given split point. * \param p The split point. @@ -2266,7 +2268,8 @@ public: */ void split(const Algebraic_point_2& p, Self& c1, Self& c2, const Cache& CGAL_assertion_code(cache)) const { - CGAL_precondition(this->is_valid() && this->is_continuous()); + CGAL_precondition(this->is_valid()); + CGAL_precondition(this->is_continuous()); // Make sure that p lies on the interior of the arc. CGAL_precondition(this->point_position(p,cache) == EQUAL && @@ -2305,8 +2308,10 @@ public: */ void merge(const Self& arc) { - CGAL_precondition(this->is_valid() && this->is_continuous()); - CGAL_precondition(arc.is_valid() && arc.is_continuous()); + CGAL_precondition(this->is_valid()); + CGAL_precondition(this->is_continuous()); + CGAL_precondition(arc.is_valid()); + CGAL_precondition(arc.is_continuous()); CGAL_precondition(this->can_merge_with(arc)); // Check if we should extend the arc to the left or to the right. @@ -2330,7 +2335,7 @@ public: this->_info = (this->_info | this->TRG_AT_X_MINUS_INFTY); else if (arc.right_parameter_space_in_x() == ARR_RIGHT_BOUNDARY) this->_info = (this->_info | this->TRG_AT_X_PLUS_INFTY); - + if (arc.right_parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) this->_info = (this->_info | this->TRG_AT_Y_MINUS_INFTY); else if (arc.right_parameter_space_in_y() == ARR_TOP_BOUNDARY) @@ -2364,11 +2369,11 @@ public: } else { - CGAL_precondition(this->left_parameter_space_in_x() == ARR_INTERIOR && - this->left_parameter_space_in_y() == ARR_INTERIOR && - arc.right_parameter_space_in_x() == ARR_INTERIOR && - arc.right_parameter_space_in_y() == ARR_INTERIOR && - (this->left().x() == arc.right().x())); + CGAL_precondition(this->left_parameter_space_in_x() == ARR_INTERIOR); + CGAL_precondition(this->left_parameter_space_in_y() == ARR_INTERIOR); + CGAL_precondition(arc.right_parameter_space_in_x() == ARR_INTERIOR); + CGAL_precondition(arc.right_parameter_space_in_y() == ARR_INTERIOR); + CGAL_precondition(this->left().x() == arc.right().x()); // Extend the arc to the left. if ((this->_info & this->IS_DIRECTED_RIGHT) != 0) @@ -2419,7 +2424,7 @@ public: } //@} - + }; //*! \class Rational_arc_2 @@ -2431,19 +2436,19 @@ class Rational_arc_d_1 : public Base_rational_arc_d_1 { public: typedef Algebraic_kernel_ Algebraic_kernel; - + typedef Rational_arc_d_1 Self; typedef Base_rational_arc_d_1 Base; typedef Continuous_rational_arc_d_1 Continuous_arc; typedef typename Base::Integer Integer; - typedef typename Base::Rational Rational; + typedef typename Base::Rational Rational; typedef typename Base::Algebraic_real_1 Algebraic_real_1; typedef typename Base::Algebraic_point_2 Algebraic_point_2; typedef typename Base::Polynomial_1 Polynomial_1; - + typedef typename Base::Rat_vector Rat_vector; - + typedef typename Base::Cache Cache; /// \name Constrcution methods. @@ -2477,12 +2482,12 @@ public: * \param dir_right Is the ray directed to the right (to +oo) * or to the left (to -oo). */ - Rational_arc_d_1(const Polynomial_1& P, const Algebraic_real_1& x_s, + Rational_arc_d_1(const Polynomial_1& P, const Algebraic_real_1& x_s, bool dir_right, const Cache& cache) : Base(P, x_s, dir_right,cache) {} - Rational_arc_d_1(const Rat_vector& pcoeffs, const Algebraic_real_1& x_s, + Rational_arc_d_1(const Rat_vector& pcoeffs, const Algebraic_real_1& x_s, bool dir_right, const Cache& cache) : Base(pcoeffs, x_s, dir_right,cache) {} @@ -2495,12 +2500,12 @@ public: * \param x_t The x-coordinate of the target point. * \pre The two x-coordinates must not be equal. */ - Rational_arc_d_1(const Polynomial_1& P, const Algebraic_real_1& x_s, + Rational_arc_d_1(const Polynomial_1& P, const Algebraic_real_1& x_s, const Algebraic_real_1& x_t, const Cache& cache) : Base(P, x_s, x_t, cache) {} - Rational_arc_d_1(const Rat_vector& pcoeffs, const Algebraic_real_1& x_s, + Rational_arc_d_1(const Rat_vector& pcoeffs, const Algebraic_real_1& x_s, const Algebraic_real_1& x_t,const Cache& cache) : Base(pcoeffs, x_s, x_t, cache) {} @@ -2538,9 +2543,9 @@ public: const Algebraic_real_1& x_s, bool dir_right, const Cache& cache) : Base(pcoeffs, qcoeffs, x_s, dir_right, cache) {} - + /*! - * Constructor of a bounded rational arc, defined by y = p(x)/q(x), + * Constructor of a bounded rational arc, defined by y = p(x)/q(x), * where: x_min <= x <= x_max. * \param pcoeffs The rational coefficients of the polynomial p(x). * \param qcoeffs The rational coefficients of the polynomial q(x). @@ -2607,4 +2612,3 @@ public: } //namespace CGAL { #endif //CGAL_RATIONAL_ARC_D_1_H - diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rational_function_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_rational_function_traits_2.h index 4edc8804d8e..5f252daa221 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_rational_function_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rational_function_traits_2.h @@ -42,20 +42,20 @@ namespace CGAL { * A traits class for maintaining an arrangement of bounded arcs (segments) of * rational functions of arbitrary degree. * - * The class is templated with two parameters: + * The class is templated with two parameters: * Alg_kernel A geometric kernel, where Alg_kernel::FT is the number type * for the coordinates of arrangement vertices, which are algebraic * numbers (defined by Nt_traits::Algebraic). * Nt_traits A traits class for performing various operations on the integer, - * rational and algebraic types. + * rational and algebraic types. */ - + template class Arr_rational_function_traits_2 { public: typedef AlgebraicKernel_d_1 Algebraic_kernel_d_1; - + typedef Arr_rational_function_traits_2 Self; typedef Arr_rational_arc::Base_rational_arc_ds_1 @@ -76,18 +76,18 @@ public: typedef typename Base_curve_2::Rat_vector Rat_vector; typedef typename Base_rational_arc_ds_1::Integer Integer; - typedef typename Base_rational_arc_ds_1::Rational Rational; - typedef typename Base_rational_arc_ds_1::Polynomial_1 Polynomial_1; - typedef typename Base_rational_arc_ds_1::Coefficient Coefficient; + typedef typename Base_rational_arc_ds_1::Rational Rational; + typedef typename Base_rational_arc_ds_1::Polynomial_1 Polynomial_1; + typedef typename Base_rational_arc_ds_1::Coefficient Coefficient; - typedef typename Base_rational_arc_ds_1::FT_rat_1 FT_rat_1; + typedef typename Base_rational_arc_ds_1::FT_rat_1 FT_rat_1; typedef typename Base_rational_arc_ds_1::Polynomial_traits_1 Polynomial_traits_1; - - typedef typename Algebraic_kernel_d_1::Bound Bound; + + typedef typename Algebraic_kernel_d_1::Bound Bound; typedef Bound - Approximate_number_type; - + Approximate_number_type; + typedef CGAL::Arr_rational_arc::Rational_function Rational_function; typedef CGAL::Arr_rational_arc::Cache Cache; @@ -115,7 +115,7 @@ public: bool delete_ak_internal_flag() const { return delete_ak; - } + } // Algebraic_kernel_d_1& algebraic_kernel_d_1() {return _ak;} public: @@ -147,7 +147,7 @@ public: if (delete_ak) _ak_ptr = new Algebraic_kernel_d_1(*other.algebraic_kernel_d_1()); else - _ak_ptr = other.algebraic_kernel_d_1(); + _ak_ptr = other.algebraic_kernel_d_1(); //copy cache _cache.initialize(other.cache(), _ak_ptr); @@ -175,9 +175,9 @@ public: Construct_x_monotone_curve_2(const Traits* traits) : _traits(traits) {} friend class Arr_rational_function_traits_2; - + public: - typedef typename Base_rational_arc_ds_1::Polynomial_1 Polynomial_1; + typedef typename Base_rational_arc_ds_1::Polynomial_1 Polynomial_1; typedef typename Base_rational_arc_ds_1::Algebraic_real_1 Algebraic_real_1; typedef Arr_rational_arc::Continuous_rational_arc_d_1 @@ -186,7 +186,7 @@ public: typedef Polynomial_1 first_argument_type; typedef Polynomial_1 second_argument_type; typedef X_monotone_curve_2 result_type; - + X_monotone_curve_2 operator()( const Polynomial_1& P) const { return X_monotone_curve_2(P, _traits->cache()); @@ -232,7 +232,7 @@ public: } X_monotone_curve_2 operator()(const Polynomial_1& P, - const Polynomial_1& Q) const + const Polynomial_1& Q) const { return X_monotone_curve_2(P, Q, _traits->cache()); } @@ -241,7 +241,7 @@ public: X_monotone_curve_2 operator()(InputIterator begin_numer, InputIterator end_numer, InputIterator begin_denom, - InputIterator end_denom) const + InputIterator end_denom) const { Rat_vector rat_vec_numer(begin_numer,end_numer); Rat_vector rat_vec_denom(begin_denom,end_denom); @@ -313,9 +313,9 @@ public: Construct_curve_2(const Traits* traits) : _traits(traits) {} friend class Arr_rational_function_traits_2; - + public: - typedef typename Base_rational_arc_ds_1::Polynomial_1 Polynomial_1; + typedef typename Base_rational_arc_ds_1::Polynomial_1 Polynomial_1; typedef typename Base_rational_arc_ds_1::Algebraic_real_1 Algebraic_real_1; typedef Arr_rational_arc::Rational_arc_d_1 @@ -324,7 +324,7 @@ public: typedef Polynomial_1 first_argument_type; typedef Polynomial_1 second_argument_type; typedef Curve_2 result_type; - + Curve_2 operator()(const Polynomial_1& P) const { return Curve_2(P, _traits->cache()); @@ -367,14 +367,14 @@ public: return Curve_2(rat_vec, x_s, x_t, _traits->cache()); } - Curve_2 operator()(const Polynomial_1& P, const Polynomial_1& Q) const + Curve_2 operator()(const Polynomial_1& P, const Polynomial_1& Q) const { return Curve_2(P, Q, _traits->cache()); } template Curve_2 operator()(InputIterator begin_numer, InputIterator end_numer, - InputIterator begin_denom, InputIterator end_denom) const + InputIterator begin_denom, InputIterator end_denom) const { Rat_vector rat_vec_numer(begin_numer, end_numer); Rat_vector rat_vec_denom(begin_denom, end_denom); @@ -438,26 +438,26 @@ public: Construct_point_2(const Traits* traits) : _traits(traits) {} friend class Arr_rational_function_traits_2; - + public: Point_2 operator()(const Rational_function& rational_function, const Algebraic_real_1& x_coordinate) - { + { return Point_2(rational_function, x_coordinate); } Point_2 operator()(const Rational& x, const Rational& y) - { + { Integer y_numer,y_denom; typename FT_rat_1::Decompose()(y,y_numer,y_denom); - + return Point_2(_traits->cache().get_rational_function(Rational(y_numer, y_denom)), _traits->algebraic_kernel_d_1()-> construct_algebraic_real_1_object()(x)); } Point_2 operator()(const Algebraic_real_1& x, const Rational& y) - { + { Integer y_numer; Integer y_denom; typename FT_rat_1::Decompose()(y, y_numer, y_denom); @@ -481,17 +481,17 @@ public: // Construct_vertical_segment(Cache& cache) : _cache(cache) {} // Vertical_segment operator()(const Point_2& p) const -// { +// { // return Vertical_segment(p); // } // Vertical_segment operator()(const Point_2& p, bool is_directed_up) const -// { +// { // return Vertical_segment(p, is_directed_up); // } // Vertical_segment operator()(const Point_2& p1,const Point_2& p2) const -// { +// { // return Vertical_segment(p1, p2, _cache); // } // }; //Construct_vertical_segment @@ -506,7 +506,7 @@ public: //------------------------ //--------------------------------------------------------------- - //A functor that compares the x-coordinates of two points + //A functor that compares the x-coordinates of two points class Compare_x_2 { public: @@ -557,7 +557,7 @@ public: * SMALLER if x(p1) < x(p2), or if x(p1) = x(p2) and y(p1) < y(p2); * EQUAL if the two points are equal. */ - Comparison_result operator()(const Point_2& p1, const Point_2& p2) const + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { return p1.compare_xy_2(p2, _traits->cache()); } @@ -749,7 +749,7 @@ public: cv2.right_parameter_space_in_y() != ARR_INTERIOR || (p.x() < cv2.right().x()))); - + // Compare the two arcs. return cv1.compare_at_intersection (cv2,p,false,_cache); } @@ -776,7 +776,7 @@ public: Equal_2(const Traits* traits) : _traits(traits) {} friend class Arr_rational_function_traits_2; - + public: /*! * Check if the two x-monotone curves are the same (have the same graph). @@ -822,7 +822,7 @@ public: public: /*! - * Cut the given conic curve (or conic arc) into x-monotone subcurves + * Cut the given conic curve (or conic arc) into x-monotone subcurves * and insert them to the given output iterator. * \param cv The curve. * \param oi The output iterator, whose value-type is Object. The returned @@ -830,7 +830,7 @@ public: * \return The past-the-end iterator. */ template - OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const + OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const { // Make the rational arc continuous. std::list arcs; @@ -950,7 +950,7 @@ public: /*! The traits (in case it has state) */ const Traits* m_traits; - + /*! Constructor * \param traits the traits (in case it has state) */ @@ -1025,7 +1025,7 @@ public: /*! Obtain a Parameter_space_in_x_2 function object */ Parameter_space_in_x_2 parameter_space_in_x_2_object() const { return Parameter_space_in_x_2(); } - + /*! A function object that obtains the parameter space of a geometric * entity along the y-axis */ @@ -1069,6 +1069,7 @@ public: Parameter_space_in_y_2 parameter_space_in_y_2_object() const { return Parameter_space_in_y_2(); } +#if 0 /*! A function object that compares the x-coordinates of arc ends near the * boundary of the parameter space */ @@ -1084,7 +1085,7 @@ public: * \return the comparison result: * SMALLER - x(p) < x(xc, ce); * EQUAL - x(p) = x(xc, ce); - * LARGER - x(p) > x(xc, ce). + * LARGER - x(p) > x(xc, ce). * \pre p lies in the interior of the parameter space. * \pre the ce end of the line xcv lies on a boundary. */ @@ -1093,9 +1094,9 @@ public: Arr_curve_end ce) const { Comparison_result r = xcv.compare_end(ce, p); - if (r == EQUAL) - return EQUAL; - return (r == NEGATIVE) ? POSITIVE : NEGATIVE ; + if (r == EQUAL) + return EQUAL; + return (r == NEGATIVE) ? POSITIVE : NEGATIVE ; } /*! Compare the x-coordinates of 2 arcs ends near the boundary of the @@ -1127,12 +1128,12 @@ public: /*! Obtain a Compare_x_near_boundary_2 function object */ Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const { return Compare_x_near_boundary_2(); } - +#endif /*! A function object that compares the y-coordinates of arc ends near the * boundary of the parameter space. */ - class Compare_y_near_boundary_2 + class Compare_y_near_boundary_2 { private: Cache& _cache; @@ -1162,19 +1163,19 @@ public: Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const { return Compare_y_near_boundary_2(_cache); } - + /*! A function object that compares at limit */ //new functor - class Compare_x_at_limit_2 + class Compare_x_on_boundary_2 { public: /*! Compares the x coordinate of p with the curve end - * of xcv that is defined by ce at its limit. + * of xcv that is defined by ce at its limit. * Returns SMALLER, EQUAL, or LARGER accordingly. */ Comparison_result operator()(const Point_2& p, - const X_monotone_curve_2& xcv, + const X_monotone_curve_2& xcv, Arr_curve_end ce) { CGAL_precondition(Parameter_space_in_x_2()(xcv,ce) == ARR_INTERIOR); @@ -1182,14 +1183,14 @@ public: return CGAL::compare(p.x(), (ce == ARR_MIN_END) ? xcv.left_x() : xcv.right_x()); } - /*! Compares the curve end of xcv1 that is defined by ce1 + /*! Compares the curve end of xcv1 that is defined by ce1 * with the curve end of xcv2 that is defined by ce2 - * at their limits in x. + * at their limits in x. * Returns SMALLER, EQUAL, or LARGER accordingly. */ - Comparison_result operator()(const X_monotone_curve_2& xcv1, + Comparison_result operator()(const X_monotone_curve_2& xcv1, Arr_curve_end ce1, - const X_monotone_curve_2& xcv2, + const X_monotone_curve_2& xcv2, Arr_curve_end ce2) { CGAL_precondition(Parameter_space_in_x_2()(xcv1,ce1) == ARR_INTERIOR); @@ -1201,40 +1202,40 @@ public: (ce2 == ARR_MIN_END) ? xcv2.left_x() : xcv2.right_x()); } - }; //Compare_x_at_limit_2 + }; //Compare_x_on_boundary_2 - /*! Obtain a Compare_x_at_limit_2 function object */ - Compare_x_at_limit_2 compare_x_at_limit_2_object() const - { return Compare_x_at_limit_2(); } + /*! Obtain a Compare_x_on_boundary_2 function object */ + Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const + { return Compare_x_on_boundary_2(); } //@} - + /// \name Functor definitions for the Boolean set-operation traits. //@{ - + //new functor - class Compare_x_near_limit_2 + class Compare_x_near_boundary_2 { private: Cache& _cache; public: - Compare_x_near_limit_2(Cache& cache) : _cache(cache) {} - /*! Compares the curve end of xcv1 that is defined by ce1 + Compare_x_near_boundary_2(Cache& cache) : _cache(cache) {} + /*! Compares the curve end of xcv1 that is defined by ce1 * with the curve end of xcv2 that is defined by ce2 - * at their limits in x. + * at their limits in x. * Returns SMALLER, EQUAL, or LARGER accordingly. */ - Comparison_result operator()( const X_monotone_curve_2& xcv1, - const X_monotone_curve_2& xcv2, + Comparison_result operator()( const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, Arr_curve_end ce) const { return xcv1.compare_near_end(xcv2,ce,_cache); } - }; //Compare_x_near_limit_2 + }; //Compare_x_near_boundary_2 - /*! Obtain a Compare_x_near_limit_2 function object */ - Compare_x_near_limit_2 compare_x_near_limit_2_object() const - { return Compare_x_near_limit_2(_cache); } + /*! Obtain a Compare_x_near_boundary_2 function object */ + Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const + { return Compare_x_near_boundary_2(_cache); } class Compare_endpoints_xy_2 { @@ -1288,23 +1289,23 @@ public: class Approximate_2{ Approximate_number_type approx_x(const Point_2& p){ return Approximate_number_type(p.x().lower()); - } + } Approximate_number_type approx_y(const Point_2& p){ typedef typename Algebraic_kernel_d_1::Polynomial_1 Polynomial_1; - typename CGAL::Coercion_traits::Cast cast; + typename CGAL::Coercion_traits::Cast cast; return cast(p.rational_function().numer()).evaluate(p.x().lower())/ cast(p.rational_function().denom()).evaluate(p.x().lower()); } public: Approximate_number_type operator()(const Point_2& p, int i){ - if(i==0) return approx_x(p); + if(i==0) return approx_x(p); if(i==1) return approx_y(p); CGAL_assertion(false); return Approximate_number_type(0); } }; - + Approximate_2 approximate_2_object() const { return Approximate_2(); } void cleanup_cache() const diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h index a711d75ba59..3628b1b337b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h @@ -204,9 +204,6 @@ private: /*! The number of facest */ size_type m_num_facets; - /*! The type of the facets. */ - size_type m_num_vertices_per_facet; - /*! The index of the marked vertex */ size_type m_marked_vertex_index; @@ -223,13 +220,11 @@ private: size_type num_points, const CoordIndexIter& indices_begin, const CoordIndexIter& indices_end, - size_type num_facets, - size_type num_vertices_per_facet = 0) : + size_type num_facets) : m_points_begin(points_begin), m_points_end(points_end), m_num_points(num_points), m_indices_begin(indices_begin), m_indices_end(indices_end), m_num_facets(num_facets), - m_num_vertices_per_facet(num_vertices_per_facet), m_marked_vertex_index(0), m_marked_edge_index(0), m_marked_facet_index(0) @@ -264,51 +259,12 @@ private: // Add the facets: counter = 0; - switch (m_num_vertices_per_facet) { - case 0: // '0' indicates variant number of vertices per facet - { - CoordIndexIter ii = m_indices_begin; - while (ii != m_indices_end) { - Polyhedron_facet_handle fh = B.begin_facet(); - if (counter == m_marked_facet_index) fh->set_marked(true); - int index = *ii++; - while (index != -1) { - B.add_vertex_to_facet(index); - index = *ii++; - } - B.end_facet(); - ++counter; - } - } - break; - - case 3: - // Unfold for to improve preformance: - for (CoordIndexIter ii = m_indices_begin; ii != m_indices_end; - ii += m_num_vertices_per_facet) - { - Polyhedron_facet_handle fh = B.begin_facet(); - if (counter == m_marked_facet_index) fh->set_marked(true); - B.add_vertex_to_facet(*ii); - B.add_vertex_to_facet(*(ii+1)); - B.add_vertex_to_facet(*(ii+2)); - B.end_facet(); - ++counter; - } - break; - - default: - for (CoordIndexIter ii = m_indices_begin; ii != m_indices_end; - ii += m_num_vertices_per_facet) - { - Polyhedron_facet_handle fh = B.begin_facet(); - if (counter == m_marked_facet_index) fh->set_marked(true); - for (size_type i = 0; i < m_num_vertices_per_facet; ++i) - B.add_vertex_to_facet(*(ii + i)); - B.end_facet(); - ++counter; - } - break; + for (auto it = m_indices_begin; it != m_indices_end; ++it) { + Polyhedron_facet_handle fh = B.begin_facet(); + if (counter == m_marked_facet_index) fh->set_marked(true); + for (auto index: *it) B.add_vertex_to_facet(index); + B.end_facet(); + ++counter; } B.end_surface(); } @@ -366,13 +322,12 @@ private: size_type num_points, const CoordIndexIter indices_begin, const CoordIndexIter indices_end, - size_type num_facets, - size_type num_vertices_per_facet = 0) + size_type num_facets) { /*! The builder */ Build_surface surface(points_begin, points_end, num_points, - indices_begin, indices_end, num_facets, num_vertices_per_facet); + indices_begin, indices_end, num_facets); surface.set_marked_vertex_index(m_marked_vertex_index); surface.set_marked_edge_index(m_marked_edge_index); surface.set_marked_facet_index(m_marked_facet_index); @@ -604,15 +559,13 @@ public: const CoordIndexIter indices_begin, const CoordIndexIter indices_end, size_type num_facets, - size_type num_vertices_per_facet = 0, Visitor* visitor = NULL) { m_visitor = visitor; Polyhedron polyhedron; update_polyhedron(polyhedron, points_begin, points_end, num_points, - indices_begin, indices_end, num_facets, - num_vertices_per_facet); + indices_begin, indices_end, num_facets); #if 0 std::copy(polyhedron.points_begin(), polyhedron.points_end(), diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_traits.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_traits.h index 9ac38fc4b8c..ec0ae8fff86 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_traits.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_traits.h @@ -15,7 +15,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0+ -// +// // // Author(s) : Efi Fogel @@ -52,30 +52,32 @@ namespace CGAL { * in turn, represents a Gaussian map, which is a unique dual representation * of a polytope. */ -template +template class Arr_polyhedral_sgm_traits : #if defined(CGAL_ARR_TRACING_TRAITS) - public Arr_tracing_traits_2 > + public Arr_tracing_traits_2< + Arr_geodesic_arc_on_sphere_traits_2 > #elif defined(CGAL_ARR_COUNTING_TRAITS) - public Arr_counting_traits_2 > + public Arr_counting_traits_2< + Arr_geodesic_arc_on_sphere_traits_2 > #else - public Arr_geodesic_arc_on_sphere_traits_2 + public Arr_geodesic_arc_on_sphere_traits_2 #endif { public: - typedef T_Kernel Kernel; - typedef typename Kernel::Point_3 Point_3; - typedef typename Kernel::Vector_3 Vector_3; + typedef Kernel_ Kernel; + typedef typename Kernel::Point_3 Point_3; + typedef typename Kernel::Vector_3 Vector_3; protected: #if defined(CGAL_ARR_TRACING_TRAITS) - typedef Arr_tracing_traits_2 > - Base; + typedef Arr_tracing_traits_2< + Arr_geodesic_arc_on_sphere_traits_2 > Base; #elif defined(CGAL_ARR_COUNTING_TRAITS) - typedef Arr_counting_traits_2 > - Base; + typedef Arr_counting_traits_2< + Arr_geodesic_arc_on_sphere_traits_2 > Base; #else - typedef Arr_geodesic_arc_on_sphere_traits_2 Base; + typedef Arr_geodesic_arc_on_sphere_traits_2 Base; #endif public: diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h index a4dff80ca96..3567f3219e7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h @@ -15,7 +15,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0+ -// +// // Author(s): Efi Fogel // Naama mayer @@ -69,7 +69,7 @@ public: /*! Normalize the coordinates of the given point, but in fact does * nothing. * \param p the point which coordinates are to be normalized - */ + */ void operator()(Point_2 &) {} }; @@ -122,7 +122,7 @@ public: /*! Destructor */ virtual ~Arr_sgm_initializer() {} - + /*! Insert a great arc whose angle is less than Pi and is represented by two * normals into the SGM. Each normal defines an end point of the greate arc. * \param normal1 represents the source normal. @@ -142,12 +142,16 @@ public: const Vector_3 & normal2, OutputIterator oi) { - Curve_2 cv(normal1.direction(), normal2.direction()); - const Geometry_traits_2 * traits = this->m_sgm.geometry_traits(); - oi = traits->make_x_monotone_2_object()(cv, oi); + const Geometry_traits_2* traits = this->m_sgm.geometry_traits(); + typename Traits::Construct_point_2 ctr_point = + traits->construct_point_2_object(); + Curve_2 cv = + traits->construct_curve_2_object()(ctr_point(normal1.direction()), + ctr_point(normal2.direction())); + *oi++ = traits->make_x_monotone_2_object()(cv, oi); return oi; } - + /*! Insert a great arc whose angle is less than Pi and is represented by two * normals into the SGM. Each normal defines an end point of the greate arc. * \param normal1 represents the source normal. @@ -181,7 +185,7 @@ public: std::cout << "1.b. insert_from_vertex(" << *xc << ")" << std::endl; #endif *oi++ = (xc->is_directed_right()) ? - m_sgm.insert_from_left_vertex(*xc, he->target()) : + m_sgm.insert_from_left_vertex(*xc, he->target()) : m_sgm.insert_from_right_vertex(*xc, he->target()); return oi; } @@ -236,7 +240,7 @@ public: * represented by normal1 toward the endpoint represented by normal2 */ template - OutputIterator insert(const Vector_3 & normal1, + OutputIterator insert(const Vector_3 & normal1, const Vector_3 & normal2, Vertex_handle vertex2, OutputIterator oi) { @@ -342,12 +346,12 @@ class Arr_spherical_gaussian_map_3 : { private: typedef Arr_spherical_gaussian_map_3 Self; - + public: typedef T_Traits Traits; typedef Traits Geometry_traits_2; - - typedef Arrangement_on_surface_2 > > Base; @@ -371,7 +375,7 @@ public: { CGAL_error_msg( "Not implemented yet!"); } - + /*! returns true if the representation is empty */ bool is_empty() const { @@ -389,7 +393,7 @@ public: return vh->degree(); } #endif - + /*! Print statistics */ void print_stat() { 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 98829dd0fa3..f7b89ece55d 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 @@ -18,6 +18,7 @@ // // Author(s) : Efi Fogel // Eric Berberich +// Efi Fogel #ifndef CGAL_ARR_SPHERICAL_TOPOLOGY_TRAITS_2_H #define CGAL_ARR_SPHERICAL_TOPOLOGY_TRAITS_2_H @@ -242,13 +243,13 @@ public: * \param v the vertex. * \todo why is this needed, and where used? */ - bool is_valid_vertex (const Vertex* /* v */) const { return true; } + bool is_valid_vertex(const Vertex* /* v */) const { return true; } /*! Obtain the number of valid vertices. */ Size number_of_valid_vertices() const { return (m_dcel.size_of_vertices()); } /*! Determine whether the given halfedge is valid. */ - bool is_valid_halfedge (const Halfedge* /* he */) const { return true; } + bool is_valid_halfedge(const Halfedge* /* he */) const { return true; } /*! Obtain the number of valid halfedges. */ Size number_of_valid_halfedges() const @@ -294,10 +295,20 @@ public: /*! Obtain the north pole (non-const version). */ Vertex* north_pole() { return m_north_pole; } + /*! Obtain a vertex on the line of discontinuity that corresponds to + * the given point (or return NULL if no such vertex exists). + */ + Vertex* discontinuity_vertex(const Point_2& pt) + { + typename Vertex_map::iterator it = m_boundary_vertices.find(pt); + return (it != m_boundary_vertices.end()) ? it->second : NULL; + } + + // TODO remove if all occurences have been replaced with the new signature that queries for a point /*! Obtain a vertex on the line of discontinuity that corresponds to * the given curve-end (or return NULL if no such vertex exists). */ - Vertex* discontinuity_vertex(const X_monotone_curve_2 xc, Arr_curve_end ind) + Vertex* discontinuity_vertex(const X_monotone_curve_2& xc, Arr_curve_end ind) { Point_2 key = (ind == ARR_MIN_END) ? m_geom_traits->construct_min_vertex_2_object()(xc) : @@ -451,7 +462,19 @@ public: //@{ /*! Receive a notification on the creation of a new boundary vertex that - * corresponds to the given curve end. + * corresponds to a point. + * \param v The new boundary vertex. + * \param p The point. + * \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 Point_2& p, + Arr_parameter_space ps_x, + Arr_parameter_space ps_y); + + /*! Receive a notification on the creation of a new boundary vertex that + * corresponds to a given curve end. * \param v The new boundary vertex. * \param xc The x-monotone curve. * \param ind The curve end. @@ -474,8 +497,8 @@ public: * \param swap_predecessors Output swap predeccesors or not; * set correctly only if true is returned */ - bool let_me_decide_the_outer_ccb(std::pair< CGAL::Sign, CGAL::Sign> signs1, - std::pair< CGAL::Sign, CGAL::Sign> signs2, + bool let_me_decide_the_outer_ccb(std::pair signs1, + std::pair signs2, bool& swap_predecessors) const; @@ -488,10 +511,10 @@ public: * will form a hole in the original face. */ std::pair - face_split_after_edge_insertion(std::pair< CGAL::Sign, - CGAL::Sign > /* signs1 */, - std::pair< CGAL::Sign, - CGAL::Sign > /* signs2 */) const + face_split_after_edge_insertion(std::pair /* signs1 */, + std::pair /* signs2 */) const { // In case of a spherical topology, connecting two vertices on the same // inner CCB closes a new face that becomes a hole in the original face: @@ -620,10 +643,9 @@ public: //! reference_face (non-const version). /*! The function returns a reference face of the arrangement. - All reference faces of arrangements of the same type have a common - point. - \return A pointer to the reference face. - */ + * All reference faces of arrangements of the same type have a common point. + * \return A pointer to the reference face. + */ Face* reference_face() { return spherical_face(); } //@} @@ -660,7 +682,6 @@ protected: * on the line of discontinuity. */ Face* _face_below_vertex_on_discontinuity(Vertex* v) const; - //@} }; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h index e255c02a6b9..790659ae99d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h @@ -15,7 +15,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0+ -// +// // // Author(s): Efi Fogel // Eric Berberich @@ -44,10 +44,11 @@ namespace CGAL { struct Arr_boundary_side_tag {}; struct Arr_oblivious_side_tag : public virtual Arr_boundary_side_tag {}; -struct Arr_open_side_tag : public virtual Arr_oblivious_side_tag {}; -struct Arr_closed_side_tag : public virtual Arr_oblivious_side_tag {}; -struct Arr_contracted_side_tag : public virtual Arr_oblivious_side_tag {}; -struct Arr_identified_side_tag : public virtual Arr_oblivious_side_tag {}; +struct Arr_non_oblivious_side_tag : public virtual Arr_boundary_side_tag {}; +struct Arr_open_side_tag : public virtual Arr_non_oblivious_side_tag {}; +struct Arr_closed_side_tag : public virtual Arr_non_oblivious_side_tag {}; +struct Arr_contracted_side_tag : public virtual Arr_non_oblivious_side_tag {}; +struct Arr_identified_side_tag : public virtual Arr_non_oblivious_side_tag {}; BOOST_MPL_HAS_XXX_TRAIT_DEF(Left_side_category) BOOST_MPL_HAS_XXX_TRAIT_DEF(Bottom_side_category) @@ -79,7 +80,7 @@ public: Get_left_side_category< Traits, has_Left_side_category< Traits >::value >::Category Category; }; -template < class GeometryTraits_2, bool b > +template < class GeometryTraits_2, bool b > struct Validate_left_side_category {}; template < class GeometryTraits_2 > @@ -92,16 +93,16 @@ template < class GeometryTraits_2 > struct Validate_left_side_category< GeometryTraits_2, false > { template void missing__Left_side_category() - { + { T - missing__Left_side_category__assuming__Arr_oblivious_side_tag__instead; + missing__Left_side_category__assuming__Arr_oblivious_side_tag__instead; } }; //! type to provide bottom side tag (is oblivious if not existing) template < class Traits_, bool B > -struct Get_bottom_side_category { +struct Get_bottom_side_category { }; template < class Traits_ > @@ -122,11 +123,11 @@ public: typedef Traits_ Traits; typedef typename - Get_bottom_side_category< Traits, has_Bottom_side_category< Traits >::value >::Category + Get_bottom_side_category< Traits, has_Bottom_side_category< Traits >::value >::Category Category; }; -template < class GeometryTraits_2, bool b > +template < class GeometryTraits_2, bool b > struct Validate_bottom_side_category {}; template < class GeometryTraits_2 > @@ -139,16 +140,16 @@ template < class GeometryTraits_2 > struct Validate_bottom_side_category< GeometryTraits_2, false > { template void missing__Bottom_side_category() - { + { T - missing__Bottom_side_category__assuming__Arr_oblivious_side_tag__instead; + missing__Bottom_side_category__assuming__Arr_oblivious_side_tag__instead; } }; //! type to provide top side tag (is oblivious if not existing) template < class Traits_, bool B > -struct Get_top_side_category { +struct Get_top_side_category { }; template < class Traits_ > @@ -172,7 +173,7 @@ public: Get_top_side_category< Traits, has_Top_side_category< Traits >::value >::Category Category; }; -template < class GeometryTraits_2, bool b > +template < class GeometryTraits_2, bool b > struct Validate_top_side_category {}; template < class GeometryTraits_2 > @@ -185,15 +186,15 @@ template < class GeometryTraits_2 > struct Validate_top_side_category< GeometryTraits_2, false > { template void missing__Top_side_category() - { - T missing__Top_side_category__assuming__Arr_oblivious_side_tag__instead; + { + T missing__Top_side_category__assuming__Arr_oblivious_side_tag__instead; } }; //! type to provide right side tag (is oblivious if not existing) template < class Traits_, bool B > -struct Get_right_side_category { +struct Get_right_side_category { }; template < class Traits_ > @@ -214,11 +215,11 @@ public: typedef Traits_ Traits; typedef typename - Get_right_side_category< Traits, has_Right_side_category< Traits >::value >::Category + Get_right_side_category< Traits, has_Right_side_category< Traits >::value >::Category Category; }; -template < class GeometryTraits_2, bool b > +template < class GeometryTraits_2, bool b > struct Validate_right_side_category {}; template < class GeometryTraits_2 > @@ -231,9 +232,9 @@ template < class GeometryTraits_2 > struct Validate_right_side_category< GeometryTraits_2, false > { template void missing__Right_side_category() - { + { T - missing__Right_side_category__assuming__Arr_oblivious_side_tag__instead; + missing__Right_side_category__assuming__Arr_oblivious_side_tag__instead; } }; @@ -259,7 +260,7 @@ struct Arr_not_all_sides_non_open_tag {}; /*!\brief Struct to determine whether all side tags are "oblivious" */ -template < class ArrLeftSideCategory, class ArrBottomSideCategory, +template < class ArrLeftSideCategory, class ArrBottomSideCategory, class ArrTopSideCategory, class ArrRightSideCategory > struct Arr_are_all_sides_oblivious_tag { @@ -267,49 +268,49 @@ public: //! This instance's first template parameter typedef ArrLeftSideCategory Left_side_category; - + //! This instance's second template parameter typedef ArrBottomSideCategory Bottom_side_category; - + //! This instance's third template parameter typedef ArrTopSideCategory Top_side_category; - + //! This instance's fourth template parameter typedef ArrRightSideCategory Right_side_category; - + private: - + typedef boost::mpl::bool_< true > true_; typedef boost::mpl::bool_< false > false_; - - typedef boost::mpl::if_< + + typedef boost::mpl::if_< boost::is_same< Left_side_category, Arr_oblivious_side_tag >, - true_, false_ > + true_, false_ > Left_oblivious; - typedef boost::mpl::if_< + typedef boost::mpl::if_< boost::is_same< Bottom_side_category, Arr_oblivious_side_tag >, - true_, false_ > + true_, false_ > Bottom_oblivious; - typedef boost::mpl::if_< + typedef boost::mpl::if_< boost::is_same< Top_side_category, Arr_oblivious_side_tag >, - true_, false_ > + true_, false_ > Top_oblivious; - typedef boost::mpl::if_< + typedef boost::mpl::if_< boost::is_same< Right_side_category, Arr_oblivious_side_tag >, - true_, false_ > + true_, false_ > Right_oblivious; - + public: - + /*!\brief - * boolean tag that is Arr_all_sides_oblivious_tag if all sides are + * boolean tag that is Arr_all_sides_oblivious_tag if all sides are * oblivious, otherwise Arr_not_all_sides_oblivious_tag */ - typedef typename boost::mpl::if_< - boost::mpl::and_< Left_oblivious, Bottom_oblivious, + typedef typename boost::mpl::if_< + boost::mpl::and_< Left_oblivious, Bottom_oblivious, Top_oblivious, Right_oblivious >, Arr_all_sides_oblivious_tag, Arr_not_all_sides_oblivious_tag >::type result; @@ -318,7 +319,7 @@ public: /*!\brief Struct to determine whether all side tags are "non-open" */ -template < class ArrLeftSideCategory, class ArrBottomSideCategory, +template < class ArrLeftSideCategory, class ArrBottomSideCategory, class ArrTopSideCategory, class ArrRightSideCategory > struct Arr_are_all_sides_non_open_tag { @@ -326,51 +327,51 @@ public: //! This instance's first template parameter typedef ArrLeftSideCategory Left_side_category; - + //! This instance's second template parameter typedef ArrBottomSideCategory Bottom_side_category; - + //! This instance's third template parameter typedef ArrTopSideCategory Top_side_category; - + //! This instance's fourth template parameter typedef ArrRightSideCategory Right_side_category; - + private: - + typedef boost::mpl::bool_< true > true_; typedef boost::mpl::bool_< false > false_; - - typedef boost::mpl::if_< + + typedef boost::mpl::if_< boost::is_same< Left_side_category, Arr_open_side_tag >, - true_, false_ > + true_, false_ > Left_open; - typedef boost::mpl::if_< + typedef boost::mpl::if_< boost::is_same< Bottom_side_category, Arr_open_side_tag >, - true_, false_ > + true_, false_ > Bottom_open; - typedef boost::mpl::if_< + typedef boost::mpl::if_< boost::is_same< Top_side_category, Arr_open_side_tag >, - true_, false_ > + true_, false_ > Top_open; - typedef boost::mpl::if_< + typedef boost::mpl::if_< boost::is_same< Right_side_category, Arr_open_side_tag >, - true_, false_ > + true_, false_ > Right_open; - + public: - + /*!\brief - * boolean tag that is Arr_all_sides_non_open_tag if all sides are non-open, + * boolean tag that is Arr_all_sides_non_open_tag if all sides are non-open, * otherwise Arr_not_all_sides_non_open_tag */ typedef typename boost::mpl::if_< - boost::mpl::and_< boost::mpl::not_< Left_open >, - boost::mpl::not_< Bottom_open >, - boost::mpl::not_< Top_open >, + boost::mpl::and_< boost::mpl::not_< Left_open >, + boost::mpl::not_< Bottom_open >, + boost::mpl::not_< Top_open >, boost::mpl::not_< Right_open > >, Arr_all_sides_non_open_tag, Arr_not_all_sides_non_open_tag >::type result; @@ -379,47 +380,47 @@ public: /*!\brief Struct to check consistent tagging of identifications */ -template < class ArrLeftSideCategory, class ArrBottomSideCategory, +template < class ArrLeftSideCategory, class ArrBottomSideCategory, class ArrTopSideCategory, class ArrRightSideCategory > struct Arr_sane_identified_tagging { public: - + //! This instance's first template parameter typedef ArrLeftSideCategory Left_side_category; - + //! This instance's second template parameter typedef ArrBottomSideCategory Bottom_side_category; - + //! This instance's third template parameter typedef ArrTopSideCategory Top_side_category; - + //! This instance's fourth template parameter typedef ArrRightSideCategory Right_side_category; - + private: - + typedef boost::mpl::bool_< true > true_; typedef boost::mpl::bool_< false > false_; - - typedef boost::mpl::if_< + + typedef boost::mpl::if_< boost::is_same< Left_side_category, Arr_identified_side_tag >, - true_, false_ > + true_, false_ > Left_identified; typedef boost::mpl::if_< boost::is_same< Bottom_side_category, Arr_identified_side_tag >, - true_, false_ > + true_, false_ > Bottom_identified; - typedef boost::mpl::if_< + typedef boost::mpl::if_< boost::is_same< Top_side_category, Arr_identified_side_tag >, - true_, false_ > + true_, false_ > Top_identified; - - typedef boost::mpl::if_< + + typedef boost::mpl::if_< boost::is_same< Right_side_category, Arr_identified_side_tag >, - true_, false_ > + true_, false_ > Right_identified; typedef boost::mpl::and_< Left_identified, Right_identified > LR_identified; @@ -430,17 +431,17 @@ private: boost::mpl::not_< Right_identified > > LR_non_identified; - typedef boost::mpl::and_< boost::mpl::not_< Bottom_identified >, - boost::mpl::not_< Top_identified > > + typedef boost::mpl::and_< boost::mpl::not_< Bottom_identified >, + boost::mpl::not_< Top_identified > > BT_non_identified; - + typedef boost::mpl::or_< LR_identified, LR_non_identified > LR_ok; typedef boost::mpl::or_< BT_identified, BT_non_identified > BT_ok; - + public: - + /*!\brief - * boolean tag that is bool_ if opposite sides are either + * boolean tag that is bool_ if opposite sides are either * both identified or both non-identified, * otherwise bool_ */ @@ -456,29 +457,29 @@ public: * (ii) When Arr_has_identified_sides is used to check whether two non-opposite * sides are identified, the check applies to all four sides. */ -template +template struct Arr_has_identified_sides { public: //! This instance's first template parameter typedef ArrSideOneCategory Side_one_category; - + //! This instance's second template parameter typedef ArrSideTwoCategory Side_two_category; - + private: typedef boost::mpl::bool_ true_; typedef boost::mpl::bool_ false_; - - typedef boost::mpl::if_< + + typedef boost::mpl::if_< boost::is_same, true_, false_> Side_one_identified; typedef boost::mpl::if_< boost::is_same, - true_, false_> + true_, false_> Side_two_identified; - + public: /*!\brief * boolean tag that is bool_ if one side is identified, @@ -487,31 +488,31 @@ public: typedef boost::mpl::or_ result; }; -/*! Checks whether one of two boundary sides are contracted +/*! Checks whether one of two boundary sides are contracted */ -template +template struct Arr_has_contracted_sides_two { public: //! This instance's first template parameter typedef ArrSideOneCategory Side_one_category; - + //! This instance's second template parameter typedef ArrSideTwoCategory Side_two_category; - + private: typedef boost::mpl::bool_ true_; typedef boost::mpl::bool_ false_; - - typedef boost::mpl::if_< + + typedef boost::mpl::if_< boost::is_same, - true_, false_> + true_, false_> Side_one_contracted; typedef boost::mpl::if_< boost::is_same, - true_, false_> + true_, false_> Side_two_contracted; - + public: /*!\brief * boolean tag that is bool_ if one side is identified, @@ -520,31 +521,31 @@ public: typedef boost::mpl::or_ result; }; -/*! Checks whether one of two boundary sides are closed +/*! Checks whether one of two boundary sides are closed */ -template +template struct Arr_has_closed_sides_two { public: //! This instance's first template parameter typedef ArrSideOneCategory Side_one_category; - + //! This instance's second template parameter typedef ArrSideTwoCategory Side_two_category; - + private: typedef boost::mpl::bool_ true_; typedef boost::mpl::bool_ false_; - - typedef boost::mpl::if_< + + typedef boost::mpl::if_< boost::is_same, - true_, false_> + true_, false_> Side_one_closed; typedef boost::mpl::if_< boost::is_same, - true_, false_> + true_, false_> Side_two_closed; - + public: /*!\brief * boolean tag that is bool_ if one side is identified, @@ -553,31 +554,31 @@ public: typedef boost::mpl::or_ result; }; -/*! Checks whether one of two boundary sides are open +/*! Checks whether one of two boundary sides are open */ -template +template struct Arr_has_open_sides_two { public: //! This instance's first template parameter typedef ArrSideOneCategory Side_one_category; - + //! This instance's second template parameter typedef ArrSideTwoCategory Side_two_category; - + private: typedef boost::mpl::bool_ true_; typedef boost::mpl::bool_ false_; - - typedef boost::mpl::if_< + + typedef boost::mpl::if_< boost::is_same, - true_, false_> + true_, false_> Side_one_open; typedef boost::mpl::if_< boost::is_same, - true_, false_> + true_, false_> Side_two_open; - + public: /*!\brief * boolean tag that is bool_ if one side is identified, @@ -589,25 +590,25 @@ public: /*! Categorizes two boundary sides: * If one side is identified => Arr_has_identified_side_tag * Otherwise if one side is contracted => Arr_has_contracted_side_tag - * Otherwise if one side is closed => Arr_has_closed_side_tag + * Otherwise if one side is closed => Arr_has_closed_side_tag * Otherwise if one side is open => Arr_has_open_side_tag * Otherwise => Arr_all_sides_oblivious_tag */ -template < class ArrSideOneCategory, class ArrSideTwoCategory> +template < class ArrSideOneCategory, class ArrSideTwoCategory> struct Arr_two_sides_category { public: //! This instance's first template parameter typedef ArrSideOneCategory Side_one_category; - + //! This instance's second template parameter typedef ArrSideTwoCategory Side_two_category; - + private: // One of the two sides is identified typedef typename Arr_has_identified_sides::result Is_identified; - + // One of the two sides is contracted typedef typename Arr_has_contracted_sides_two::result @@ -622,7 +623,7 @@ private: typedef typename Arr_has_open_sides_two::result Is_open; - + public: typedef typename boost::mpl::if_ Arr_has_open_side_tag * Otherwise (all sides oblivious) => Arr_all_sides_oblivious_tag */ -template < class ArrSideOneCategory, class ArrSideTwoCategory> +template < class ArrSideOneCategory, class ArrSideTwoCategory> struct Arr_all_sides_category { public: }; @@ -647,4 +648,3 @@ public: } // namespace CGAL #endif - diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_inc_insertion_zone_visitor.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_inc_insertion_zone_visitor.h index 7125850b128..84413d364ae 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_inc_insertion_zone_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_inc_insertion_zone_visitor.h @@ -15,7 +15,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0+ -// +// // // Author(s) : Ron Wein // Efi Fogel @@ -36,17 +36,15 @@ namespace CGAL { /*! \class - * A visitor class for Arrangement_zone_2, which performs incremental + * A visitor class for Arrangement_zone_2, which performs incremental * insertion of an x-monotone curve into an arrangement. * The class should be templated by an Arrangement_2 class (that is, an * Arrangement_on_surface_2 class, with the TopTraits * being a planar topology-traits class. */ -template -class Arr_inc_insertion_zone_visitor -{ +template +class Arr_inc_insertion_zone_visitor { public: - typedef Arrangement_ Arrangement_2; typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2; @@ -60,41 +58,37 @@ public: typedef std::pair Result; protected: - typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; private: - - Arrangement_2 *p_arr; // The arrangement into which we + Arrangement_2* p_arr; // The arrangement into which we // insert the curves. - Traits_adaptor_2 *geom_traits; // The arrangement geometry-traits. + Traits_adaptor_2* m_geom_traits; // The arrangement geometry-traits. - const Vertex_handle invalid_v; // An invalid vertex handle. - const Halfedge_handle invalid_he; // An invalid halfedge handle. + const Vertex_handle invalid_v; // An invalid vertex handle. + const Halfedge_handle invalid_he; // An invalid halfedge handle. - X_monotone_curve_2 sub_cv1; // Auxiliary varibale (for splitting). - X_monotone_curve_2 sub_cv2; // Auxiliary varibale (for splitting). + X_monotone_curve_2 m_sub_cv1; // Auxiliary varibale (for splitting). + X_monotone_curve_2 m_sub_cv2; // Auxiliary varibale (for splitting). public: - /*! Constructor. */ - Arr_inc_insertion_zone_visitor () : - p_arr (NULL), - geom_traits (NULL), - invalid_v (), - invalid_he () + Arr_inc_insertion_zone_visitor() : + p_arr(NULL), + m_geom_traits(NULL), + invalid_v(), + invalid_he() {} /*! Initialize the visitor with an arrangement object. */ - void init (Arrangement_2 *arr) + void init(Arrangement_2* arr) { p_arr = arr; - geom_traits = const_cast - (static_cast (p_arr->geometry_traits())); + m_geom_traits = const_cast + (static_cast(p_arr->geometry_traits())); } - /*! - * Handle the a subcurve located in the interior of a given face. + /*! Handle the a subcurve located in the interior of a given face. * \param cv The subcurve. * \param face The face containing cv's interior. * \param left_v The vertex that corresponds to the left endpoint of cv @@ -108,12 +102,11 @@ public: * \return A handle to the halfedge obtained from the insertion of the * subcurve into the arrangement. */ - Result found_subcurve (const X_monotone_curve_2& cv, Face_handle face, - Vertex_handle left_v, Halfedge_handle left_he, - Vertex_handle right_v, Halfedge_handle right_he); + Result found_subcurve(const X_monotone_curve_2& cv, Face_handle face, + Vertex_handle left_v, Halfedge_handle left_he, + Vertex_handle right_v, Halfedge_handle right_he); - /*! - * Handle the a subcurve that overlaps a given edge. + /*! Handle the a subcurve that overlaps a given edge. * \param cv The overlapping subcurve. * \param he The overlapped halfedge (directed from left to right). * \param left_v The vertex that corresponds to the left endpoint of cv @@ -123,20 +116,17 @@ public: * \return A handle to the halfedge obtained from the insertion of the * overlapping subcurve into the arrangement. */ - Result found_overlap (const X_monotone_curve_2& cv, Halfedge_handle he, - Vertex_handle left_v, Vertex_handle right_v); + Result found_overlap(const X_monotone_curve_2& cv, Halfedge_handle he, + Vertex_handle left_v, Vertex_handle right_v); private: - - /*! - * Split an arrangement edge. + /*! plit an arrangement edge. * \param he The edge to split (one of the twin halfedges). * \param p The split point. * \param arr_access An arrangement accessor. */ - void _split_edge (Halfedge_handle he, const Point_2& p, - Arr_accessor& arr_access); - + void _split_edge(Halfedge_handle he, const Point_2& p, + Arr_accessor& arr_access); }; //----------------------------------------------------------------------------- @@ -146,32 +136,32 @@ private: //----------------------------------------------------------------------------- // Handle the a subcurve located in the interior of a given face. // -template +template typename Arr_inc_insertion_zone_visitor::Result Arr_inc_insertion_zone_visitor:: -found_subcurve (const X_monotone_curve_2& cv, Face_handle face, - Vertex_handle left_v, Halfedge_handle left_he, - Vertex_handle right_v, Halfedge_handle right_he) +found_subcurve(const X_monotone_curve_2& cv, Face_handle face, + Vertex_handle left_v, Halfedge_handle left_he, + Vertex_handle right_v, Halfedge_handle right_he) { typename Traits_adaptor_2::Construct_min_vertex_2 min_vertex = - geom_traits->construct_min_vertex_2_object(); + m_geom_traits->construct_min_vertex_2_object(); typename Traits_adaptor_2::Construct_max_vertex_2 max_vertex = - geom_traits->construct_max_vertex_2_object(); + m_geom_traits->construct_max_vertex_2_object(); typename Traits_adaptor_2::Parameter_space_in_x_2 ps_in_x = - geom_traits->parameter_space_in_x_2_object(); + m_geom_traits->parameter_space_in_x_2_object(); typename Traits_adaptor_2::Parameter_space_in_y_2 ps_in_y = - geom_traits->parameter_space_in_y_2_object(); - - // Create an arrangement accessor. - Arr_accessor arr_access (*p_arr); - - // Get the boundary conditions of the curve ends. - const Arr_parameter_space bx_l = ps_in_x (cv, ARR_MIN_END); - const Arr_parameter_space by_l = ps_in_y (cv, ARR_MIN_END); + m_geom_traits->parameter_space_in_y_2_object(); - const Arr_parameter_space bx_r = ps_in_x (cv, ARR_MAX_END); - const Arr_parameter_space by_r = ps_in_y (cv, ARR_MAX_END); + // Create an arrangement accessor. + Arr_accessor arr_access(*p_arr); + + // Get the boundary conditions of the curve ends. + const Arr_parameter_space bx_l = ps_in_x(cv, ARR_MIN_END); + const Arr_parameter_space by_l = ps_in_y(cv, ARR_MIN_END); + + const Arr_parameter_space bx_r = ps_in_x(cv, ARR_MAX_END); + const Arr_parameter_space by_r = ps_in_y(cv, ARR_MAX_END); // Check if the left and the right endpoints of cv should be associated // with arrangement vertices. @@ -190,12 +180,12 @@ found_subcurve (const X_monotone_curve_2& cv, Face_handle face, if (left_he != invalid_he) prev_he_left = left_he; else if (! left_v->is_isolated()) - prev_he_left = arr_access.locate_around_vertex (left_v, cv); + prev_he_left = arr_access.locate_around_vertex(left_v, cv); // In case the vertex does not exist, split left_he at cv's left endpoint // and create the vertex. if (left_v == invalid_v) { - _split_edge (left_he, min_vertex (cv), arr_access); + _split_edge (left_he, min_vertex(cv), arr_access); // Check whether we have just split the halfedge that right_he refers // to, and if this halfedge is directed from left to right. @@ -211,7 +201,7 @@ found_subcurve (const X_monotone_curve_2& cv, Face_handle face, // Use the arrangement accessor and obtain a vertex associated with // the unbounded left end (possibly with a predecessor halfedge). std::pair pos = - arr_access.place_and_set_curve_end (face, cv, ARR_MIN_END, bx_l, by_l); + arr_access.place_and_set_curve_end(face, cv, ARR_MIN_END, bx_l, by_l); if (pos.second != invalid_he) { // Use the predecessor halfedge, if possible: @@ -228,7 +218,8 @@ found_subcurve (const X_monotone_curve_2& cv, Face_handle face, * (prev_he_left->direction() == ARR_LEFT_TO_RIGHT)) * right_he = right_he->next(); */ - } else + } + else // Use just the isolated vertex: left_v = pos.first; } @@ -237,30 +228,28 @@ found_subcurve (const X_monotone_curve_2& cv, Face_handle face, if (vertex_for_right) { // If we are given the previous halfedge, use it. Otherwise, we are given // the vertex and we should locate cv around it. - if (right_he != invalid_he) - prev_he_right = right_he; + if (right_he != invalid_he) prev_he_right = right_he; else if (! right_v->is_isolated()) - prev_he_right = arr_access.locate_around_vertex (right_v, cv); - + prev_he_right = arr_access.locate_around_vertex(right_v, cv); + // In case the vertex does not exist, split right_he at cv's right // endpoint and create the vertex. if (right_v == invalid_v) { - _split_edge (right_he, max_vertex (cv), arr_access); - + _split_edge(right_he, max_vertex(cv), arr_access); + // Check whether we have just split the halfedge that left_he refers to. // If so, prev_he_right's target is now the new vertex, and we have to // proceed to the next halfedge (whose target is right_v). - if (right_he == prev_he_left) - prev_he_left = prev_he_left->next(); + if (right_he == prev_he_left) prev_he_left = prev_he_left->next(); } } else { - // Check whether the right end of cv is bounded or not. + // Check whether the right end of cv is bounded or not. if ((bx_r == ARR_RIGHT_BOUNDARY) || (by_r != ARR_INTERIOR)) { // Use the arrangement accessor and obtain a vertex associated with // the unbounded right end (possibly with a predecessor halfedge). std::pair pos = - arr_access.place_and_set_curve_end (face, cv, ARR_MAX_END, bx_r, by_r); + arr_access.place_and_set_curve_end(face, cv, ARR_MAX_END, bx_r, by_r); if (pos.second != invalid_he) { // Use the predecessor halfedge, if possible: @@ -278,7 +267,7 @@ found_subcurve (const X_monotone_curve_2& cv, Face_handle face, } // Insert the curve into the arrangement. - Halfedge_handle inserted_he; + Halfedge_handle inserted_he; if (prev_he_left == invalid_he) { // The left endpoint is associated with an isolated vertex, or is not @@ -286,8 +275,8 @@ found_subcurve (const X_monotone_curve_2& cv, Face_handle face, // now. if (left_v == invalid_v) { left_v = ((bx_l == ARR_INTERIOR) && (by_l == ARR_INTERIOR)) ? - arr_access.create_vertex (min_vertex (cv)) : - arr_access.create_boundary_vertex (cv, ARR_MIN_END, bx_l, by_l); + arr_access.create_vertex(min_vertex(cv)) : + arr_access.create_boundary_vertex(cv, ARR_MIN_END, bx_l, by_l); } if (prev_he_right == invalid_he) { @@ -296,19 +285,21 @@ found_subcurve (const X_monotone_curve_2& cv, Face_handle face, // vertex now. if (right_v == invalid_v) { right_v = ((bx_r == ARR_INTERIOR) && (by_r == ARR_INTERIOR)) ? - arr_access.create_vertex (max_vertex (cv)) : - arr_access.create_boundary_vertex (cv, ARR_MAX_END, bx_r, by_r); + arr_access.create_vertex(max_vertex(cv)) : + arr_access.create_boundary_vertex(cv, ARR_MAX_END, bx_r, by_r); } - + // We should insert the curve in the interior of the face. - inserted_he = arr_access.insert_in_face_interior_ex (face, cv, ARR_LEFT_TO_RIGHT, - left_v, right_v); + inserted_he = + arr_access.insert_in_face_interior_ex(face, cv, ARR_LEFT_TO_RIGHT, + left_v, right_v); } else { // The right endpoint is associated with an arrangement vertex, and // we have the predecessor halfedge for the insertion. - inserted_he = arr_access.insert_from_vertex_ex (prev_he_right, cv, ARR_RIGHT_TO_LEFT, - left_v); + inserted_he = + arr_access.insert_from_vertex_ex(prev_he_right, cv, ARR_RIGHT_TO_LEFT, + left_v); // The returned halfedge is directed to the newly created vertex // (the left one), so we take its twin. @@ -324,129 +315,122 @@ found_subcurve (const X_monotone_curve_2& cv, Face_handle face, // vertex now. if (right_v == invalid_v) { right_v = ((bx_r == ARR_INTERIOR) && (by_r == ARR_INTERIOR)) ? - arr_access.create_vertex (max_vertex (cv)) : - arr_access.create_boundary_vertex (cv, ARR_MAX_END, bx_r, by_r); + arr_access.create_vertex(max_vertex(cv)) : + arr_access.create_boundary_vertex(cv, ARR_MAX_END, bx_r, by_r); } - + // Use the left predecessor for the insertion. - inserted_he = arr_access.insert_from_vertex_ex (prev_he_left, cv, ARR_LEFT_TO_RIGHT, - right_v); + inserted_he = + arr_access.insert_from_vertex_ex(prev_he_left, cv, ARR_LEFT_TO_RIGHT, + right_v); } else { // The right endpoint is associated with an arrangement vertex, and // we have the predecessor halfedge for the insertion. - CGAL_assertion (prev_he_right != invalid_he); + CGAL_assertion(prev_he_right != invalid_he); // Perform the insertion using the predecessor halfedges. - inserted_he = p_arr->insert_at_vertices (cv, prev_he_left, prev_he_right); + inserted_he = p_arr->insert_at_vertices(cv, prev_he_left, prev_he_right); } } // Return the inserted halfedge, and indicate we should not halt the // zone-computation process. - return Result (inserted_he, false); + return Result(inserted_he, false); } //----------------------------------------------------------------------------- // Handle the a subcurve located in the interior of a given face. // -template +template typename Arr_inc_insertion_zone_visitor::Result Arr_inc_insertion_zone_visitor:: -found_overlap (const X_monotone_curve_2& cv, Halfedge_handle he, - Vertex_handle left_v, Vertex_handle right_v) +found_overlap(const X_monotone_curve_2& cv, Halfedge_handle he, + Vertex_handle left_v, Vertex_handle right_v) { - // Get the boundary conditions of the curve ends. - const Arr_parameter_space bx_l = - geom_traits->parameter_space_in_x_2_object()(cv, ARR_MIN_END); - const Arr_parameter_space by_l = - geom_traits->parameter_space_in_y_2_object()(cv, ARR_MIN_END); - + // Get the boundary conditions of the curve end. const Arr_parameter_space bx_r = - geom_traits->parameter_space_in_x_2_object()(cv, ARR_MAX_END); + m_geom_traits->parameter_space_in_x_2_object()(cv, ARR_MAX_END); const Arr_parameter_space by_r = - geom_traits->parameter_space_in_y_2_object()(cv, ARR_MAX_END); + m_geom_traits->parameter_space_in_y_2_object()(cv, ARR_MAX_END); // Modify (perhaps split) the overlapping arrangement edge. - Halfedge_handle updated_he; + Halfedge_handle updated_he; - if (left_v == invalid_v && - ! ((bx_l == ARR_LEFT_BOUNDARY) || (by_l != ARR_INTERIOR))) - { + if (left_v == invalid_v) { // Split the curve associated with he at the left endpoint of cv. - geom_traits->split_2_object() + m_geom_traits->split_2_object() (he->curve(), - geom_traits->construct_min_vertex_2_object() (cv), sub_cv1, sub_cv2); + m_geom_traits->construct_min_vertex_2_object()(cv), + m_sub_cv1, m_sub_cv2); - if (right_v == invalid_v && + if ((right_v == invalid_v) && ! ((bx_r == ARR_RIGHT_BOUNDARY) || (by_r != ARR_INTERIOR))) { // The overlapping curve is contained strictly in the interior of he: // Split he as an intermediate step. - updated_he = p_arr->split_edge (he, sub_cv1, sub_cv2); + updated_he = p_arr->split_edge(he, m_sub_cv1, m_sub_cv2); updated_he = updated_he->next(); // Split the left subcurve at the right endpoint of cv. - geom_traits->split_2_object() + m_geom_traits->split_2_object() (updated_he->curve(), - geom_traits->construct_max_vertex_2_object() (cv), sub_cv1, sub_cv2); + m_geom_traits->construct_max_vertex_2_object()(cv), + m_sub_cv1, m_sub_cv2); // Split updated_he once again, so that the left portion corresponds // to the overlapping curve and the right portion corresponds to - // sub_cv2. - updated_he = p_arr->split_edge (updated_he, cv, sub_cv2); + // m_sub_cv2. + updated_he = p_arr->split_edge(updated_he, cv, m_sub_cv2); } else { - // Split he, such that the left portion corresponds to sub_cv1 and the + // Split he, such that the left portion corresponds to m_sub_cv1 and the // right portion corresponds to the overlapping curve. - updated_he = p_arr->split_edge (he, sub_cv1, cv); + updated_he = p_arr->split_edge(he, m_sub_cv1, cv); updated_he = updated_he->next(); } } - else { - if (right_v == invalid_v && - ! ((bx_r == ARR_RIGHT_BOUNDARY) || (by_r != ARR_INTERIOR))) - { - // Split the curve associated with he at the right endpoint of cv. - geom_traits->split_2_object() - (he->curve(), - geom_traits->construct_max_vertex_2_object() (cv), sub_cv1, sub_cv2); + else if (right_v == invalid_v) { + // Split the curve associated with he at the right endpoint of cv. + m_geom_traits->split_2_object() + (he->curve(), + m_geom_traits->construct_max_vertex_2_object()(cv), + m_sub_cv1, m_sub_cv2); - // Split he, such that the left portion corresponds to the overlapping - // curve and the right portion corresponds to sub_cv2. - updated_he = p_arr->split_edge (he, cv, sub_cv2); - } - else { - // The entire edge is overlapped: Modify the curve associated with cv - // to be the overlapping curve. - updated_he = p_arr->modify_edge (he, cv); - } + // Split he, such that the left portion corresponds to the overlapping + // curve and the right portion corresponds to m_sub_cv2. + updated_he = p_arr->split_edge(he, cv, m_sub_cv2); + } + else { + // The entire edge is overlapped: Modify the curve associated with cv + // to be the overlapping curve. + updated_he = p_arr->modify_edge(he, cv); } // Return the updated halfedge, and indicate we should not halt the // zone-computation process. - return Result (updated_he, false); + return Result(updated_he, false); } //----------------------------------------------------------------------------- // Split an arrangement edge. // -template +template void Arr_inc_insertion_zone_visitor:: -_split_edge (Halfedge_handle he, const Point_2& p, - Arr_accessor& arr_access) +_split_edge(Halfedge_handle he, const Point_2& p, + Arr_accessor& arr_access) { // Split the curve at the split point. - geom_traits->split_2_object() (he->curve(), p, sub_cv1, sub_cv2); + m_geom_traits->split_2_object()(he->curve(), p, m_sub_cv1, m_sub_cv2); - // sub_cv1 is always to the left of the split point p and sub_cv2 lies to + // m_sub_cv1 is always to the left of the split point p and m_sub_cv2 lies to // its right. Thus, if the split edge is directed from left to right then - // left end of sub_cv1 equals he's source, and if the edge is directed from + // left end of m_sub_cv1 equals he's source, and if the edge is directed from // right to left, we have to reverse the subcurve order. if (he->direction() == ARR_LEFT_TO_RIGHT) - arr_access.split_edge_ex (he, p, sub_cv1, sub_cv2); + arr_access.split_edge_ex(he, p, m_sub_cv1, m_sub_cv2); else - arr_access.split_edge_ex (he, p, sub_cv2, sub_cv1); + arr_access.split_edge_ex(he, p, m_sub_cv2, m_sub_cv1); } } //namespace CGAL diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h index 59e3db12daa..a5cdced9aeb 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 @@ -115,6 +115,7 @@ public: m_geom_traits = NULL; } } + //@} ///! \name Common topology-traits methods. @@ -126,6 +127,22 @@ public: /*! Get the DCEL (non-const version). */ Dcel& dcel() { return (m_dcel); } + /*! Receive a notification on the creation of a new boundary vertex that + * corresponds to a given point. + * \param v The new boundary vertex. + * \param p The point. + * \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 Point_2& , + Arr_parameter_space /* ps_x */, + Arr_parameter_space /* ps_y */) + { + // In the planar-topology traits this function should never be invoked: + return; + } + /*! Receive a notification on the creation of a new boundary vertex that * corresponds to the given curve end. * \param v The new boundary vertex. @@ -163,7 +180,6 @@ public: return false; } - /*! Given signs of two ccbs that show up when splitting upon insertion of * curve into two, determine what happens to the face(s). * \param signs1 signs in x and y of the first implied ccb @@ -191,6 +207,7 @@ public: * \return Whether p is contained in f's interior. */ bool is_in_face(const Face* f, const Point_2& p, const Vertex* v) const; + //@} /// \name Additional accessors, specialized for this topology-traits class. 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 edab3a79727..61933ccc136 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 @@ -1,4 +1,4 @@ -// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel). +// Copyright (c) 2007,2009,2010,2011,2014 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org). @@ -19,6 +19,7 @@ // // Author(s) : Ron Wein // Efi Fogel +// Eric Berberich #ifndef CGAL_ARR_SPHERICAL_CONSTRUCTION_HELPER_H #define CGAL_ARR_SPHERICAL_CONSTRUCTION_HELPER_H @@ -160,6 +161,7 @@ public: { // If we insert an edge whose right end lies on the north pole, we have // to flip the order of predecessor halfegdes. + // TODO what about the corner? return (event->parameter_space_in_x() == ARR_INTERIOR && event->parameter_space_in_y() == ARR_TOP_BOUNDARY); } @@ -190,35 +192,34 @@ before_handle_event(Event* event) Arr_parameter_space ps_y = event->parameter_space_in_y(); if ((ps_x == ARR_INTERIOR) && (ps_y == ARR_INTERIOR)) return; - if (ps_y == ARR_BOTTOM_BOUNDARY) { - // Process bootom contraction boundary: - // The event has only one right curve, as there is exactly one curve - // incident to an event with boundary conditions. - CGAL_assertion((event->number_of_left_curves() == 0) && - (event->number_of_right_curves() == 1)); - const X_monotone_curve_2& xc = - (*(event->right_curves_begin()))->last_curve(); + if (event->is_isolated()) return; + + // Comment: In the sweep-line event order the events of poles belong to the left and right + // boundary. However, here the vertices of the poles are identified by the + // event's trais to belong to the bottom and top boundary. + + if (ps_y == ARR_BOTTOM_BOUNDARY /* subsumes LEFT-BOTTOM and RIGHT-BOTTOM corner */) { + // Process a non-isolated event on the bottom contracted boundary. // If a vertex on the south pole does not exists, create one. DVertex* dv = m_top_traits->south_pole(); - Vertex_handle v = (dv) ? Vertex_handle(dv) : - m_arr_access.create_boundary_vertex(xc, ARR_MIN_END, ps_x, ps_y); + Vertex_handle v = + (dv) ? Vertex_handle(dv) : m_arr_access.create_boundary_vertex(event->point(), ps_x, ps_y); event->set_vertex_handle(v); return; } - if (ps_y == ARR_TOP_BOUNDARY) { - // Process top contraction boundary: - // The event has only one left curve, as there is exactly one curve - // incident to an event with boundary conditions. - CGAL_assertion((event->number_of_left_curves() == 1) && - (event->number_of_right_curves() == 0)); - const X_monotone_curve_2& xc = - (*(event->left_curves_begin()))->last_curve(); + if (ps_y == ARR_TOP_BOUNDARY /* subsumes LEFT-TOP and RIGHT-TOP corner */) { + // Process a non-isolated event on the top contracted boundary. + // The process is more complicated than for the bottom boundary, + // as the touching the top boundary influences the list of + // halfedges seen in the reference face DVertex* dv = m_top_traits->north_pole(); if (dv) { event->set_vertex_handle(Vertex_handle(dv)); + const X_monotone_curve_2& xc = + (*(event->left_curves_begin()))->last_curve(); DHalfedge* dprev = m_top_traits->locate_around_boundary_vertex(m_top_traits->north_pole(), xc, ARR_MAX_END, @@ -237,11 +238,11 @@ before_handle_event(Event* event) splice_indices_list(prev->next()); return; } + // else - // We do not have a vertex that corresponds to the north pole. - // Create one. + // If a vertex on the north pole does not exists, create one. Vertex_handle v = - m_arr_access.create_boundary_vertex(xc, ARR_MAX_END, ps_x, ps_y); + m_arr_access.create_boundary_vertex(event->point(), ps_x, ps_y); event->set_vertex_handle(v); // Since this is the first event corresponding to the north pole, @@ -256,36 +257,29 @@ before_handle_event(Event* event) } if (ps_x == ARR_LEFT_BOUNDARY) { - // The event has only right curves, as there is exactly one curve - // incident to an event with boundary conditions. - CGAL_assertion((event->number_of_left_curves() == 0) && - (event->number_of_right_curves() >= 1)); - const X_monotone_curve_2& xc = - (*(event->right_curves_begin()))->last_curve(); + // Process a non-isolated event on the left identified boundary. + // It might be the end of a vertical curve. - // If a vertex on the line of discontinuity does not exists. create one. - DVertex* dv = m_top_traits->discontinuity_vertex(xc, ARR_MIN_END); - Vertex_handle v = (dv) ? Vertex_handle(dv) : - m_arr_access.create_boundary_vertex(xc, ARR_MIN_END, ps_x, ps_y); + // If a vertex on the line of discontinuity does not exists, create one. + DVertex* dv = m_top_traits->discontinuity_vertex(event->point()); + Vertex_handle v = + (dv) ? Vertex_handle(dv) : m_arr_access.create_boundary_vertex(event->point(), ps_x, ps_y); event->set_vertex_handle(v); return; } if (ps_x == ARR_RIGHT_BOUNDARY) { - // The event has only left curves, as there is exactly one curve - // incident to an event with boundary conditions. - CGAL_assertion((event->number_of_left_curves() >= 1) && - (event->number_of_right_curves() == 0)); - const X_monotone_curve_2& xc = - (*(event->left_curves_begin()))->last_curve(); + // Process a non-isolated event on the right identified boundary. + // Note: cannnot be vertical, only curves approaching the right side are possible. - // If a vertex on the line of discontinuity does not exists. create one. - DVertex* dv = m_top_traits->discontinuity_vertex(xc, ARR_MAX_END); - Vertex_handle v = (dv) ? Vertex_handle(dv) : - m_arr_access.create_boundary_vertex(xc, ARR_MAX_END, ps_x, ps_y); + // If a vertex on the line of discontinuity does not exists, create one. + DVertex* dv = m_top_traits->discontinuity_vertex(event->point()); + Vertex_handle v = + (dv) ? Vertex_handle(dv) : m_arr_access.create_boundary_vertex(event->point(), ps_x, ps_y); event->set_vertex_handle(v); return; } + } } // namespace CGAL 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 f8f1678fa86..785e97be0b3 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 @@ -120,6 +120,8 @@ before_handle_event(Event* event) const Arr_parameter_space ps_y = event->parameter_space_in_y(); if ((ps_x == ARR_INTERIOR) && (ps_y == ARR_INTERIOR)) return; + if (event->is_isolated()) return; + if (ps_y == ARR_BOTTOM_BOUNDARY) { // Process bootom contraction boundary: // The event has only one right curve, as there is exactly one curve 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 3fbba7dd92b..93b7464c560 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 @@ -32,7 +32,7 @@ namespace CGAL { -/*! \brief constructs default */ + //! \brief constructs default. template Arr_spherical_topology_traits_2:: Arr_spherical_topology_traits_2() : @@ -45,7 +45,7 @@ Arr_spherical_topology_traits_2() : m_boundary_vertices = Vertex_map(Vertex_key_comparer(m_geom_traits)); } -/*! \brief constructs from a geometry-traits object. */ +//! \brief constructs from a geometry-traits object. template Arr_spherical_topology_traits_2:: Arr_spherical_topology_traits_2(const Geometry_traits_2* traits) : @@ -58,7 +58,7 @@ Arr_spherical_topology_traits_2(const Geometry_traits_2* traits) : m_boundary_vertices = Vertex_map(Vertex_key_comparer(m_geom_traits)); } -/*! \brief destructs */ +//! \brief destructs. template Arr_spherical_topology_traits_2:: ~Arr_spherical_topology_traits_2() @@ -72,10 +72,9 @@ Arr_spherical_topology_traits_2:: } } -/*! \brief assigns the contents of another topology-traits class */ +//! \brief assigns the contents of another topology-traits class. template -void Arr_spherical_topology_traits_2:: -assign(const Self& other) +void Arr_spherical_topology_traits_2::assign(const Self& other) { // Clear the current DCEL and duplicate the other DCEL. m_dcel.delete_all(); @@ -100,7 +99,7 @@ assign(const Self& other) dcel_updated(); } -/*! \brief initializes an empty DCEL structure. */ +//! \brief initializes an empty DCEL structure. template void Arr_spherical_topology_traits_2::dcel_updated() { @@ -134,7 +133,6 @@ void Arr_spherical_topology_traits_2::dcel_updated() for (; fit != this->m_dcel.faces_end(); ++fit) { if (fit->number_of_outer_ccbs() == 0) { CGAL_assertion(m_spherical_face == NULL); - m_spherical_face = &(*fit); break; } @@ -142,7 +140,7 @@ void Arr_spherical_topology_traits_2::dcel_updated() CGAL_assertion(m_spherical_face != NULL); } -/*! \brief initializes an empty DCEL structure. */ +//! \brief initializes an empty DCEL structure. template void Arr_spherical_topology_traits_2::init_dcel() { @@ -160,7 +158,7 @@ void Arr_spherical_topology_traits_2::init_dcel() m_south_pole = NULL; } -/*! \brief determines whether a point lies in the interior of a given face. */ +//! \brief determines whether a point lies in the interior of a given face. template bool Arr_spherical_topology_traits_2:: is_in_face(const Face* f, const Point_2& p, const Vertex* v) const @@ -422,7 +420,7 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const return (num_intersections& 0x1); } -/*! \brief compares the relative y-position of a point and a halfedge */ +//! \brief compares the relative y-position of a point and a halfedge. template Comparison_result Arr_spherical_topology_traits_2:: @@ -432,7 +430,7 @@ compare_y_at_x(const Point_2& p, const Halfedge* he) const return m_geom_traits->compare_y_at_x_2_object()(p, he->curve()); } -/*! \brief determine whether a vertex is associated with a curve end */ +//! \brief determine whether a vertex is associated with a curve end. template bool Arr_spherical_topology_traits_2:: are_equal(const Vertex* v, @@ -469,7 +467,29 @@ are_equal(const Vertex* v, return (m_geom_traits->compare_y_on_boundary_2_object()(p1, p2) == EQUAL); } -/*! \brief receives a notification on the creation of a new boundary vertex */ +//! \brief receives a notification on the creation of a new boundary vertex. +template +void +Arr_spherical_topology_traits_2:: +notify_on_boundary_vertex_creation(Vertex* v, + const Point_2& p, + Arr_parameter_space + CGAL_assertion_code(ps_x), + Arr_parameter_space ps_y) +{ + if (ps_y == ARR_BOTTOM_BOUNDARY) { + m_south_pole = v; + return; + } + if (ps_y == ARR_TOP_BOUNDARY) { + m_north_pole = v; + return; + } + CGAL_assertion(ps_x != ARR_INTERIOR); + m_boundary_vertices.insert(Vertex_value(p, v)); +} + +//! \brief receives a notification on the creation of a new boundary vertex. template void Arr_spherical_topology_traits_2:: @@ -480,7 +500,6 @@ notify_on_boundary_vertex_creation(Vertex* v, CGAL_assertion_code(ps_x), Arr_parameter_space ps_y) { - // std::cout << "notify_on_boundary_vertex_creation()" << std::endl; if (ps_y == ARR_BOTTOM_BOUNDARY) { m_south_pole = v; return; @@ -521,7 +540,8 @@ let_me_decide_the_outer_ccb(std::pair< CGAL::Sign, CGAL::Sign> signs1, /*! \brief given a curve end with boundary conditions and a face that contains * the interior of the curve, find a place for a boundary vertex that will - * represent the curve end along the face boundary */ + * represent the curve end along the face boundary. + */ template CGAL::Object Arr_spherical_topology_traits_2:: @@ -562,7 +582,8 @@ place_boundary_vertex(Face* /* f */, } /*! \brief locate the predecessor halfedge for the given curve around a given - * vertex with boundary conditions. */ + * vertex with boundary conditions. + */ template typename Arr_spherical_topology_traits_2::Halfedge* Arr_spherical_topology_traits_2:: @@ -576,7 +597,6 @@ locate_around_boundary_vertex(Vertex* v, , Arr_parameter_space ps_y) const { - // std::cout << "locate_around_boundary_vertex()" << std::endl; if (ps_y == ARR_BOTTOM_BOUNDARY) { CGAL_assertion(v == m_south_pole); return (_locate_around_pole(m_south_pole, xc, ind)); @@ -612,52 +632,67 @@ locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind, return CGAL::make_object(m_spherical_face); } - typename Vertex_map::iterator it; - Vertex* v = NULL; - 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. if (m_south_pole != NULL) return CGAL::make_object(m_south_pole); - it = m_boundary_vertices.begin(); - } - else { - 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 - // vertex above it. - const Point_2& key = (ind == ARR_MIN_END) ? - m_geom_traits->construct_min_vertex_2_object()(xc) : - m_geom_traits->construct_max_vertex_2_object()(xc); - it = m_boundary_vertices.find(key); - if (it != m_boundary_vertices.end()) { - v = it->second; - return CGAL::make_object(v); - } + // If there are no vertices on the identification curve return the spherical + // face. + if (m_boundary_vertices.empty()) return CGAL::make_object(m_spherical_face); - it = m_boundary_vertices.lower_bound(key); + Vertex* v = m_boundary_vertices.begin()->second; + return CGAL::make_object(_face_below_vertex_on_discontinuity(v)); } - // At this point, the iterator it points to a vertex on the line of - // discontinuity that is strictly above the curve end. If there is none, - // we know the curve end is contained in the spherical face. Otherwise, - // we return the face that lies below the vertex v. + 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 + // vertex above it. + const Point_2& key = (ind == ARR_MIN_END) ? + m_geom_traits->construct_min_vertex_2_object()(xc) : + m_geom_traits->construct_max_vertex_2_object()(xc); + + // Find the element the key of which is equal to or greater than 'key' + typename Vertex_map::iterator it = m_boundary_vertices.lower_bound(key); + + // If an element with the same key or a larger key does not exist, an edge + // associated with a vertical curve that lies on the boundary and contains + // the query point cannot exist either. Return the spherical face. if (it == m_boundary_vertices.end()) return CGAL::make_object(m_spherical_face); - v = it->second; + Vertex* v = it->second; + + // If the key is equal, return the vertex. + if (m_geom_traits->compare_y_on_boundary_2_object()(key, v->point()) == EQUAL) + return CGAL::make_object(v); + + // The vertex v lies on the identification curve and is strictly above the + // curve end. Search for an edge incident to v and is associated with a + // vertical curve that lies on the boundary. + Halfedge* start = v->halfedge(); + Halfedge* he = start; + do { + const X_monotone_curve_2& curve = he->curve(); + if ((ARR_LEFT_TO_RIGHT == he->direction()) && + (m_geom_traits->is_vertical_2_object()(curve))) + return CGAL::make_object(he); + he = he->next()->opposite(); + } while (he != start); + + // Return the face that lies below the vertex v. return CGAL::make_object(_face_below_vertex_on_discontinuity(v)); } -/*! \brief determines whether a given boundary vertex is redundant */ +//! \brief determines whether a given boundary vertex is redundant. template bool Arr_spherical_topology_traits_2:: -is_redundant(const Vertex* v) const -{ return (v->halfedge() == NULL); } +is_redundant(const Vertex* v) const { return (v->halfedge() == NULL); } -/* \brief erases a given redundant vertex */ +//! \brief erases a given redundant vertex. template typename Arr_spherical_topology_traits_2::Halfedge* Arr_spherical_topology_traits_2:: @@ -776,19 +811,40 @@ _locate_around_pole(Vertex* v, // pole with the query curve xc. typename Gt_adaptor_2::Compare_x_curve_ends_2 cmp_x_curve_ends = m_geom_traits->compare_x_curve_ends_2_object(); - Arr_curve_end curr_end, next_end; - Comparison_result curr_res, next_res; - Comparison_result curr_next_res; + typename Gt_adaptor_2::Parameter_space_in_x_2 ps_x_op = + m_geom_traits->parameter_space_in_x_2_object(); - curr_end = + Arr_curve_end curr_end = (curr->direction() == ARR_RIGHT_TO_LEFT) ? ARR_MIN_END : ARR_MAX_END; - curr_res = cmp_x_curve_ends(xc, ind, curr->curve(), curr_end); + Arr_parameter_space ps_x = ps_x_op(xc, ind); + Arr_parameter_space curr_ps_x = ps_x_op(curr->curve(), curr_end); + + Comparison_result curr_res = (ps_x != curr_ps_x) ? + ((ps_x == ARR_LEFT_BOUNDARY) ? SMALLER : + ((ps_x == ARR_RIGHT_BOUNDARY) ? LARGER : + ((curr_ps_x == ARR_LEFT_BOUNDARY) ? LARGER : SMALLER))) : + ((ps_x != ARR_INTERIOR) ? EQUAL : + cmp_x_curve_ends(xc, ind, curr->curve(), curr_end)); + do { - next_end = + Arr_curve_end next_end = (next->direction() == ARR_RIGHT_TO_LEFT) ? ARR_MIN_END : ARR_MAX_END; - next_res = cmp_x_curve_ends(xc, ind, next->curve(), next_end); - curr_next_res = - cmp_x_curve_ends(curr->curve(), curr_end, next->curve(), next_end); + Arr_parameter_space next_ps_x = ps_x_op(next->curve(), next_end); + + Comparison_result next_res = (ps_x != next_ps_x) ? + ((ps_x == ARR_LEFT_BOUNDARY) ? SMALLER : + ((ps_x == ARR_RIGHT_BOUNDARY) ? LARGER : + ((next_ps_x == ARR_LEFT_BOUNDARY) ? LARGER : SMALLER))) : + ((ps_x != ARR_INTERIOR) ? EQUAL : + cmp_x_curve_ends(xc, ind, next->curve(), next_end)); + + Comparison_result curr_next_res = (curr_ps_x != next_ps_x) ? + ((curr_ps_x == ARR_LEFT_BOUNDARY) ? SMALLER : + ((curr_ps_x == ARR_RIGHT_BOUNDARY) ? LARGER : + ((next_ps_x == ARR_LEFT_BOUNDARY) ? LARGER : SMALLER))) : + ((curr_ps_x != ARR_INTERIOR) ? EQUAL : + cmp_x_curve_ends(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: @@ -804,6 +860,7 @@ _locate_around_pole(Vertex* v, curr = next; curr_end = next_end; curr_res = next_res; + curr_ps_x = next_ps_x; next = curr->next()->opposite(); } while (curr != first); @@ -861,7 +918,7 @@ _face_below_vertex_on_discontinuity(Vertex* v) const else { // The curve associated with the current halfedge is defined to the right // of v. - if (top_right == NULL || + if ((top_right == NULL) || cmp_y_at_x_op_right(curr->curve(), top_right->curve(), v->point()) == LARGER) { diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h index 0e39819d2dd..a3ed3baf947 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h @@ -171,9 +171,11 @@ before_handle_event(Event* event) { if (event->is_closed()) return; - // In case the event lies at inifinity, check whether its incident curve + // In case the event lies at infinity, check whether its incident curve // is already in the arrangement. - if (event->curve().halfedge_handle() == Halfedge_handle()) { + Arr_curve_end ce; + if (event->boundary_touching_curve(ce).halfedge_handle() == Halfedge_handle()) + { // The curve is not in the arrangement, use the base construction helper // to handle the event: Base::before_handle_event (event); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_overlay_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_overlay_helper.h index 5ba852715d0..39a3b39fb51 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_overlay_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_overlay_helper.h @@ -135,7 +135,7 @@ before_sweep() // vertices in both red and blue arrangements. If there are no vertices // at x = -oo, we take the halfedge incident to the top-left vertex that // lies on the top edge of the fictitious face. - Vertex_handle_red v_red_bl = + Vertex_handle_red v_red_bl = Vertex_handle_red(m_red_top_traits->bottom_left_vertex()); m_red_th = v_red_bl->incident_halfedges(); @@ -145,7 +145,7 @@ before_sweep() if (m_red_th->source() == v_red_tl) m_red_th = m_red_th->prev(); - Vertex_handle_blue v_blue_bl = + Vertex_handle_blue v_blue_bl = Vertex_handle_blue(m_blue_top_traits->bottom_left_vertex()); m_blue_th = v_blue_bl->incident_halfedges(); @@ -174,7 +174,8 @@ before_handle_event(Event* e) (e->parameter_space_in_x() == ARR_INTERIOR && e->parameter_space_in_y() == ARR_TOP_BOUNDARY)) { - switch (e->curve().color()) { + Arr_curve_end ce; + switch (e->boundary_touching_curve(ce).color()) { case (Gt2::RED) : // Update the red top fictitious halfedge. m_red_th = m_red_th->twin()->next()->twin(); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_tracing_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_tracing_traits_2.h index afc4d0b3abe..5d9a5b073c6 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_tracing_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_tracing_traits_2.h @@ -40,7 +40,7 @@ namespace CGAL { -/*! \class +/*! \class * A model of the ArrangementTraits_2 concept that counts the methods invoked. */ template @@ -69,17 +69,15 @@ public: COMPARE_ENDPOINTS_XY_OP, PARAMETER_SPACE_IN_X_OP, - IS_ON_X_IDENTIFICATION_OP, + IS_ON_X_IDENTIFICATION_OP, COMPARE_Y_ON_BOUNDARY_OP, COMPARE_Y_NEAR_BOUNDARY_OP, - + PARAMETER_SPACE_IN_Y_OP, IS_ON_Y_IDENTIFICATION_OP, - COMPARE_X_AT_LIMIT_OP, - COMPARE_X_NEAR_LIMIT_OP, COMPARE_X_ON_BOUNDARY_OP, COMPARE_X_NEAR_BOUNDARY_OP, - + NUMBER_OF_OPERATIONS }; @@ -89,55 +87,55 @@ private: /*! A set of bits that indicate whether operations should be traced */ unsigned int m_flags; - + bool compare_x_op() const { return (0 != (m_flags & (0x1 << COMPARE_X_OP))); } bool compare_xy_op() const { return (0 != (m_flags & (0x1 << COMPARE_XY_OP))); } - + bool construct_min_vertex_op() const { return (0 != (m_flags & (0x1 << CONSTRUCT_MIN_VERTEX_OP))); } - + bool construct_max_vertex_op() const { return (0 != (m_flags & (0x1 << CONSTRUCT_MAX_VERTEX_OP))); } - + bool is_vertical_op() const { return (0 != (m_flags & (0x1 << IS_VERTICAL_OP))); } - + bool compare_y_at_x_op() const { return (0 != (m_flags & (0x1 << COMPARE_Y_AT_X_OP))); } - + bool equal_points_op() const { return (0 != (m_flags & (0x1 << EQUAL_POINTS_OP))); } - + bool equal_curves_op() const { return (0 != (m_flags & (0x1 << EQUAL_CURVES_OP))); } - + bool compare_y_at_x_left_op() const { return (0 != (m_flags & (0x1 << COMPARE_Y_AT_X_LEFT_OP))); } - + bool compare_y_at_x_right_op() const { return (0 != (m_flags & (0x1 << COMPARE_Y_AT_X_RIGHT_OP))); } - + bool make_x_monotone_op() const { return (0 != (m_flags & (0x1 << MAKE_X_MONOTONE_OP))); } - + bool split_op() const { return (0 != (m_flags & (0x1 << SPLIT_OP))); } - + bool intersect_op() const { return (0 != (m_flags & (0x1 << INTERSECT_OP))); } - + bool are_mergeable_op() const { return (0 != (m_flags & (0x1 << ARE_MERGEABLE_OP))); } - + bool merge_op() const { return (0 != (m_flags & (0x1 << MERGE_OP))); } - + bool construct_opposite_op() const { return (0 != (m_flags & (0x1 << CONSTRUCT_OPPOSITE_OP))); } - + bool compare_endpoints_xy_op() const { return (0 != (m_flags & (0x1 << COMPARE_ENDPOINTS_XY_OP))); } @@ -145,12 +143,12 @@ private: bool parameter_space_in_x_op() const { return (0 != (m_flags & (0x1 << PARAMETER_SPACE_IN_X_OP))); } - - bool is_on_x_identification_op() const - { return m_flags & (0x1 << IS_ON_X_IDENTIFICATION_OP); } + + bool is_on_x_identification_op() const + { return m_flags & (0x1 << IS_ON_X_IDENTIFICATION_OP); } bool compare_y_on_boundary_op() const - { return (0 != (m_flags & (0x1 << COMPARE_Y_ON_BOUNDARY_OP))); } + { return (0 != (m_flags & (0x1 << COMPARE_Y_ON_BOUNDARY_OP))); } bool compare_y_near_boundary_op() const { return m_flags & (0x1 << COMPARE_Y_NEAR_BOUNDARY_OP); } @@ -160,21 +158,15 @@ private: bool parameter_space_in_y_op() const { return (0 != (m_flags & (0x1 << PARAMETER_SPACE_IN_Y_OP))); } - bool is_on_y_identification_op() const - { return m_flags & (0x1 << IS_ON_Y_IDENTIFICATION_OP); } - - bool compare_x_at_limit_op() const - { return m_flags & (0x1 << COMPARE_X_AT_LIMIT_OP); } - - bool compare_x_near_limit_op() const - { return m_flags & (0x1 << COMPARE_X_NEAR_LIMIT_OP); } + bool is_on_y_identification_op() const + { return m_flags & (0x1 << IS_ON_Y_IDENTIFICATION_OP); } bool compare_x_on_boundary_op() const - { return (0 != (m_flags & (0x1 << COMPARE_X_ON_BOUNDARY_OP))); } + { return (0 != (m_flags & (0x1 << COMPARE_X_ON_BOUNDARY_OP))); } bool compare_x_near_boundary_op() const { return m_flags & (0x1 << COMPARE_X_NEAR_BOUNDARY_OP); } - + public: /*! Default constructor */ Arr_tracing_traits_2() : @@ -192,7 +184,7 @@ public: * \param id the operation identifier */ void enable_all_traces() { m_flags = 0xffffffff; } - + /*! Disable the trace of a traits operation * \param id the operation identifier */ @@ -202,7 +194,7 @@ public: * \param id the operation identifier */ void disable_all_traces() { m_flags = 0x0; } - + /// \name Types and functors inherited from the base //@{ @@ -219,7 +211,7 @@ public: Top_side_category; typedef typename internal::Arr_complete_right_side_category< Base >::Category Right_side_category; - + typedef typename Base::Point_2 Point_2; typedef typename Base::X_monotone_curve_2 X_monotone_curve_2; typedef typename Base::Curve_2 Curve_2; @@ -230,10 +222,10 @@ public: private: typename Base::Compare_x_2 m_object; bool m_enabled; - + public: /*! Construct */ - Compare_x_2(const Base * base, bool enabled = true) : + Compare_x_2(const Base* base, bool enabled = true) : m_object(base->compare_x_2_object()), m_enabled(enabled) {} /*! Operate @@ -241,7 +233,7 @@ public: * \param p2 second point * \return the comparison result */ - Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { if (!m_enabled) return m_object(p1, p2); std::cout << "compare_x" << std::endl @@ -261,7 +253,7 @@ public: public: /*! Construct */ - Compare_xy_2(const Base * base, bool enabled = true) : + Compare_xy_2(const Base* base, bool enabled = true) : m_object(base->compare_xy_2_object()), m_enabled(enabled) {} /*! Operate @@ -269,7 +261,7 @@ public: * \param p2 the second point * \return the comparison result */ - Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { if (!m_enabled) return m_object(p1, p2); std::cout << "compare_xy" << std::endl @@ -289,14 +281,14 @@ public: public: /*! Construct */ - Construct_min_vertex_2(const Base * base, bool enabled = true) : + Construct_min_vertex_2(const Base* base, bool enabled = true) : m_object(base->construct_min_vertex_2_object()), m_enabled(enabled) {} /*! Operate * \param xcv the curev the left endpoint of which is obtained * \return the left endpoint */ - const Point_2 operator()(const X_monotone_curve_2 & xcv) const + const Point_2 operator()(const X_monotone_curve_2& xcv) const { if (!m_enabled) return m_object(xcv); std::cout << "construct_min_vertex" << std::endl @@ -315,24 +307,24 @@ public: public: /*! Construct */ - Construct_max_vertex_2(const Base * base, bool enabled = true) : + Construct_max_vertex_2(const Base* base, bool enabled = true) : m_object(base->construct_max_vertex_2_object()), m_enabled(enabled) {} /*! Operate * \param xcv the curev the right endpoint of which is obtained * \return the right endpoint */ - const Point_2 operator()(const X_monotone_curve_2 & xcv) const + const Point_2 operator()(const X_monotone_curve_2& xcv) const { if (!m_enabled) return m_object(xcv); std::cout << "construct_max_vertex" << std::endl << " xcv: " << xcv << std::endl; Point_2 p = m_object(xcv); - std::cout << " result: " << p << std::endl; + std::cout << " result: " << p << std::endl; return p; } }; - + /*! A functor that checks whether a given x-monotone curve is vertical. */ class Is_vertical_2 { private: @@ -341,14 +333,14 @@ public: public: /*! Construct */ - Is_vertical_2(const Base * base, bool enabled = true) : + Is_vertical_2(const Base* base, bool enabled = true) : m_object(base->is_vertical_2_object()), m_enabled(enabled) {} - + /*! Operate * \param xcv the curve * \return a Boolean that indicates whether the curve is vertical or not */ - bool operator()(const X_monotone_curve_2 & xcv) const + bool operator()(const X_monotone_curve_2& xcv) const { if (!m_enabled) return m_object(xcv); std::cout << "is_vertical" << std::endl @@ -358,7 +350,7 @@ public: return is_vertical; } }; - + /*! A functor that compares the y-coordinates of a point and an * x-monotone curve at the point x-coordinate. */ @@ -369,7 +361,7 @@ public: public: /*! Construct */ - Compare_y_at_x_2(const Base * base, bool enabled = true) : + Compare_y_at_x_2(const Base* base, bool enabled = true) : m_object(base->compare_y_at_x_2_object()), m_enabled(enabled) {} /*! Operate @@ -377,8 +369,8 @@ public: * \param xcv the curve * \return the comparison result */ - Comparison_result operator()(const Point_2 & p, - const X_monotone_curve_2 & xcv) const + Comparison_result operator()(const Point_2& p, + const X_monotone_curve_2& xcv) const { if (!m_enabled) return m_object(p, xcv); std::cout << "compare_y_at_x" << std::endl @@ -389,7 +381,7 @@ public: return cr; } }; - + /*! A functor that checks whether two points and two x-monotone curves are * identical. */ @@ -401,7 +393,7 @@ public: public: /*! Construct */ - Equal_2(const Base * base, + Equal_2(const Base* base, bool enabled_point = true, bool enabled_curve = true) : m_object(base->equal_2_object()), m_enabled_point(enabled_point), @@ -413,8 +405,8 @@ public: * \param xcv2 the second curve * \return true if the x-monotone curves are equal and false otherwise */ - bool operator()(const X_monotone_curve_2 & xcv1, - const X_monotone_curve_2 & xcv2) const + bool operator()(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2) const { if (!m_enabled_curve) return m_object(xcv1, xcv2); std::cout << "equal 1" << std::endl @@ -430,7 +422,7 @@ public: * \param p2 the second point * \return true if the points are equal and false otherwise */ - bool operator()(const Point_2 & p1, const Point_2 & p2) const + bool operator()(const Point_2& p1, const Point_2& p2) const { if (!m_enabled_point) return m_object(p1, p2); std::cout << "equal 2" << std::endl @@ -439,7 +431,7 @@ public: bool equal = m_object(p1, p2); std::cout << " result: " << equal << std::endl; return equal; - } + } }; /*! A functor that compares compares the y-coordinates of two x-monotone @@ -452,18 +444,18 @@ public: public: /*! Construct */ - Compare_y_at_x_left_2(const Base * base, bool enabled = true) : + Compare_y_at_x_left_2(const Base* base, bool enabled = true) : m_object(base->compare_y_at_x_left_2_object()), m_enabled(enabled) {} /*! Operate * \param xcv1 the first curve - * \param xcv2 the second curve + * \param xcv2 the second curve * \param p the reference point * \return the comparison result */ - Comparison_result operator()(const X_monotone_curve_2 & xcv1, - const X_monotone_curve_2 & xcv2, - const Point_2 & p) const + Comparison_result operator()(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, + const Point_2& p) const { if (!m_enabled) return m_object(xcv1, xcv2, p); std::cout << "compare_y_at_x_left" << std::endl @@ -486,7 +478,7 @@ public: public: /*! Construct */ - Compare_y_at_x_right_2(const Base * base, bool enabled = true) : + Compare_y_at_x_right_2(const Base* base, bool enabled = true) : m_object(base->compare_y_at_x_right_2_object()), m_enabled(enabled) {} /*! Operate @@ -495,9 +487,9 @@ public: * \param p the reference point * \return the comparison result */ - Comparison_result operator()(const X_monotone_curve_2 & xcv1, - const X_monotone_curve_2 & xcv2, - const Point_2 & p) const + Comparison_result operator()(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, + const Point_2& p) const { if (!m_enabled) return m_object(xcv1, xcv2, p); std::cout << "compare_y_at_x_right" << std::endl @@ -509,7 +501,7 @@ public: return cr; } }; - + /*! A functor that divides a curve into x-monotone curves. */ class Make_x_monotone_2 { private: @@ -518,7 +510,7 @@ public: public: /*! Construct */ - Make_x_monotone_2(const Base * base, bool enabled = true) : + Make_x_monotone_2(const Base* base, bool enabled = true) : m_object(base->make_x_monotone_2_object()), m_enabled(enabled) {} /*! Operate @@ -528,11 +520,11 @@ public: * \return the output iterator */ template - OutputIterator operator()(const Curve_2 & cv, OutputIterator oi) const + OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const { if (!m_enabled) return m_object(cv, oi); std::cout << "make_x_monotone" << std::endl - << " cv: " << cv << std::endl; + << " cv: " << cv << std::endl; std::list container; m_object(cv, std::back_inserter(container)); if (container.empty()) return oi; @@ -552,7 +544,7 @@ public: continue; } } - + for (it = container.begin(); it != container.end(); ++it) *oi++ = *it; container.clear(); return oi; @@ -567,7 +559,7 @@ public: public: /*! Construct */ - Split_2(const Base * base, bool enabled = true) : + Split_2(const Base* base, bool enabled = true) : m_object(base->split_2_object()), m_enabled(enabled) {} /*! Operate @@ -576,8 +568,8 @@ public: * \param xcv1 * \param xcv2 */ - void operator()(const X_monotone_curve_2 & xcv, const Point_2 & p, - X_monotone_curve_2 & xcv1, X_monotone_curve_2 & xcv2) const + void operator()(const X_monotone_curve_2& xcv, const Point_2& p, + X_monotone_curve_2& xcv1, X_monotone_curve_2& xcv2) const { if (!m_enabled) { m_object(xcv, p, xcv1, xcv2); @@ -600,7 +592,7 @@ public: public: /*! Construct */ - Intersect_2(const Base * base, bool enabled = true) : + Intersect_2(const Base* base, bool enabled = true) : m_object(base->intersect_2_object()), m_enabled(enabled) {} /*! Operate @@ -612,9 +604,9 @@ public: * multiplicity * \return the output iterator */ - template - OutputIterator operator()(const X_monotone_curve_2 & xcv1, - const X_monotone_curve_2 & xcv2, + template + OutputIterator operator()(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, OutputIterator oi) const { if (!m_enabled) return m_object(xcv1, xcv2, oi); @@ -641,7 +633,7 @@ public: continue; } } - + for (it = container.begin(); it != container.end(); ++it) *oi++ = *it; container.clear(); return oi; @@ -656,7 +648,7 @@ public: public: /*! Construct */ - Are_mergeable_2(const Base * base, bool enabled = true) : + Are_mergeable_2(const Base* base, bool enabled = true) : m_object(base->are_mergeable_2_object()), m_enabled(enabled) {} /*! Operate @@ -666,8 +658,8 @@ public: * Two curves are mergeable if they have the same underlying theoretical * curve */ - bool operator()(const X_monotone_curve_2 & xcv1, - const X_monotone_curve_2 & xcv2) const + bool operator()(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2) const { if (!m_enabled) return m_object(xcv1, xcv2); std::cout << "are_mergeable" << std::endl @@ -687,7 +679,7 @@ public: public: /*! Construct */ - Merge_2(const Base * base, bool enabled = true) : + Merge_2(const Base* base, bool enabled = true) : m_object(base->merge_2_object()), m_enabled(enabled) {} /*! Operate @@ -695,9 +687,9 @@ public: * \param xcv2 the second curve * \param xcv the merged curve */ - void operator()(const X_monotone_curve_2 & xcv1, - const X_monotone_curve_2 & xcv2, - X_monotone_curve_2 & xcv) const + void operator()(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, + X_monotone_curve_2& xcv) const { std::cout << "merge" << std::endl << " xcv1: " << xcv1 << std::endl @@ -715,14 +707,14 @@ public: public: /*! Construct */ - Construct_opposite_2(const Base * base, bool enabled = true) : + Construct_opposite_2(const Base* base, bool enabled = true) : m_object(base->construct_opposite_2_object()), m_enabled(enabled) {} /*! Operate * \param xcv the curve * \return the opposite curve */ - X_monotone_curve_2 operator()(const X_monotone_curve_2 & xcv) + X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv) { if (!m_enabled) return m_object(xcv); std::cout << "construct_opposite" << std::endl @@ -743,14 +735,14 @@ public: public: /*! Construct */ - Compare_endpoints_xy_2(const Base * base, bool enabled = true) : + Compare_endpoints_xy_2(const Base* base, bool enabled = true) : m_object(base->compare_endpoints_xy_2_object()), m_enabled(enabled) {} /*! Operate * \param xcv the curve * \return the comparison result */ - Comparison_result operator()(const X_monotone_curve_2 & xcv) + Comparison_result operator()(const X_monotone_curve_2& xcv) { if (!m_enabled) return m_object(xcv); std::cout << "compare_endpoints_xy" << std::endl @@ -773,17 +765,17 @@ public: public: /*! Construct */ - Parameter_space_in_x_2(const Base * base, bool enabled = true) : + Parameter_space_in_x_2(const Base* base, bool enabled = true) : m_object(base->parameter_space_in_x_2_object()), m_enabled(enabled) {} - + /*! Operate * \param xcv the curve the end of which is tested * \param ce the curve-end identifier * \return the boundary type */ - Arr_parameter_space operator()(const X_monotone_curve_2 & xcv, - Arr_curve_end ce) const + Arr_parameter_space operator()(const X_monotone_curve_2& xcv, + Arr_curve_end ce) const { if (!m_enabled) return m_object(xcv, ce); std::cout << "parameter_space_in_x" << std::endl @@ -792,29 +784,46 @@ public: std::cout << " result: " << bt << std::endl; return bt; } + + /*! A functor that obtains the parameter space at a point along the x-axis. + * Every non-interior point is assumed to lie on the left-right + * identification. + * Points at the poles additionally lie on the bottom or top boundary. + * \param p the point. + * \return the parameter space at p. + */ + Arr_parameter_space operator()(const Point_2& p) const + { + if (!m_enabled) return m_object(p); + std::cout << "parameter_space_in_x" << std::endl + << " p: " << p << std::endl; + Arr_parameter_space bt = m_object(p); + std::cout << " result: " << bt << std::endl; + return bt; + } }; - /*! A functor that determines whether a point or curve is on + /*! A functor that determines whether a point or curve is on * x-identification. */ class Is_on_x_identification_2 { private: typename Base::Is_on_x_identification_2 m_object; bool m_enabled; - + public: /*! Construct */ - Is_on_x_identification_2(const Base * base, bool enabled = true) : + Is_on_x_identification_2(const Base* base, bool enabled = true) : m_object(base->is_on_x_identification_2_object()), m_enabled(enabled) {} /*! Operate * \param p1 the point. */ - Comparison_result operator()(const Point_2 & p) const + bool operator()(const Point_2& p) const { if (!m_enabled) return m_object(p); std::cout << "is_on_x_identification" << std::endl << " p: " << p << std::endl; - Comparison_result cr = m_object(p); + bool cr = m_object(p); std::cout << " result: " << cr << std::endl; return cr; } @@ -822,12 +831,12 @@ public: /*! Operate * \param xcv1 the curve */ - Comparison_result operator()(const X_monotone_curve_2 & xcv) const + bool operator()(const X_monotone_curve_2& xcv) const { if (!m_enabled) return m_object(xcv); std::cout << "is_on_x_identification" << std::endl << " xcv: " << xcv << std::endl; - Comparison_result cr = m_object(xcv); + bool cr = m_object(xcv); std::cout << " result: " << cr << std::endl; return cr; } @@ -840,10 +849,10 @@ public: private: typename Base::Compare_y_on_boundary_2 m_object; bool m_enabled; - + public: /*! Construct */ - Compare_y_on_boundary_2(const Base * base, bool enabled = true) : + Compare_y_on_boundary_2(const Base* base, bool enabled = true) : m_object(base->compare_y_on_boundary_2_object()), m_enabled(enabled) {} @@ -852,7 +861,7 @@ public: * \param p1 the first point. * \param p2 the second point. */ - Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { if (!m_enabled) return m_object(p1, p2); std::cout << "compare_y_on_boundary" << std::endl @@ -871,10 +880,10 @@ public: private: typename Base::Compare_y_near_boundary_2 m_object; bool m_enabled; - + public: /*! Construct */ - Compare_y_near_boundary_2(const Base * base, bool enabled = true) : + Compare_y_near_boundary_2(const Base* base, bool enabled = true) : m_object(base->compare_y_near_boundary_2_object()), m_enabled(enabled) {} /*! Operate @@ -883,8 +892,8 @@ public: * \param ce the curve-end identifier * \return the comparison result */ - Comparison_result operator()(const X_monotone_curve_2 & xcv1, - const X_monotone_curve_2 & xcv2, + Comparison_result operator()(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, Arr_curve_end ce) const { if (!m_enabled) return m_object(xcv1, xcv2, ce); @@ -910,15 +919,15 @@ public: public: /*! Construct */ - Parameter_space_in_y_2(const Base * base, bool enabled = true) : + Parameter_space_in_y_2(const Base* base, bool enabled = true) : m_object(base->parameter_space_in_y_2_object()), m_enabled(enabled) {} - + /*! Operate * \param xcv the curve the end of which is tested * \param ce the curve-end identifier * \return the boundary type */ - Arr_parameter_space operator()(const X_monotone_curve_2 & xcv, + Arr_parameter_space operator()(const X_monotone_curve_2& xcv, Arr_curve_end ce) const { if (!m_enabled) return m_object(xcv, ce); @@ -933,7 +942,7 @@ public: * \param p the point * \return the boundary type */ - Arr_parameter_space operator()(const Point_2 & p) const + Arr_parameter_space operator()(const Point_2& p) const { if (!m_enabled) return m_object(p); std::cout << "parameter_space_in_y" << std::endl @@ -944,27 +953,27 @@ public: } }; - /*! A functor that determines whether a point or curve is on + /*! A functor that determines whether a point or curve is on * y-identification. */ class Is_on_y_identification_2 { private: typename Base::Is_on_y_identification_2 m_object; bool m_enabled; - + public: /*! Construct */ - Is_on_y_identification_2(const Base * base, bool enabled = true) : + Is_on_y_identification_2(const Base* base, bool enabled = true) : m_object(base->is_on_y_identification_2_object()), m_enabled(enabled) {} /*! Operate * \param p1 the point. */ - Comparison_result operator()(const Point_2 & p) const + bool operator()(const Point_2& p) const { if (!m_enabled) return m_object(p); std::cout << "is_on_y_identification" << std::endl << " p: " << p << std::endl; - Comparison_result cr = m_object(p); + bool cr = m_object(p); std::cout << " result: " << cr << std::endl; return cr; } @@ -972,102 +981,12 @@ public: /*! Operate * \param xcv1 the curve */ - Comparison_result operator()(const X_monotone_curve_2 & xcv) const + bool operator()(const X_monotone_curve_2& xcv) const { if (!m_enabled) return m_object(xcv); std::cout << "is_on_y_identification" << std::endl << " xcv: " << xcv << std::endl; - Comparison_result cr = m_object(xcv); - std::cout << " result: " << cr << std::endl; - return cr; - } - }; - - /*! A functor that compares the x-limits of curve ends on the - * boundary of the parameter space. - */ - class Compare_x_at_limit_2 { - private: - typename Base::Compare_x_at_limit_2 m_object; - bool m_enabled; - - public: - /*! Construct */ - Compare_x_at_limit_2(const Base * base, bool enabled = true) : - m_object(base->compare_x_at_limit_2_object()), m_enabled(enabled) {} - - /*! Operate - * \param p the first point - * \param xcv the curve the end of which is to be compared - * \param ce the curve-end identifier - * \return the comparison result - */ - Comparison_result operator()(const Point_2 & p, - const X_monotone_curve_2 & xcv, - Arr_curve_end ce) const - { - if (!m_enabled) return m_object(p, xcv, ce); - std::cout << "compare_x_at_limit 1" << std::endl - << " p: " << p << std::endl - << " ce: " << ce << ", xcv: " << xcv << std::endl; - Comparison_result cr = m_object(p, xcv, ce); - std::cout << " result: " << std::endl; - return cr; - } - - /*! Operate - * \param xcv1 the first curve the end of which is to be compared - * \param ce1 the identifier of the end of the first curve - * \param xcv2 the second curve the end of which is to be compared - * \param ce2 the identifier of the end of the second curve - * \return the comparison result - */ - Comparison_result operator()(const X_monotone_curve_2 & xcv1, - Arr_curve_end ce1, - const X_monotone_curve_2 & xcv2, - Arr_curve_end ce2) const - { - if (!m_enabled) return m_object(xcv1, ce1, xcv2, ce2); - std::cout << "compare_x_at_limit 2" << std::endl - << " ce1: " << ce1 << ", xcv1: " << xcv1 << std::endl - << " ce2: " << ce2 << ", xcv2: " << xcv2 << std::endl; - Comparison_result cr = m_object(xcv1, ce1, xcv2, ce2); - std::cout << " result: " << cr << std::endl; - return cr; - } - }; - - - /*! A functor that compares the x-coordinates of curve ends near the - * boundary of the parameter space. - */ - class Compare_x_near_limit_2 { - private: - typename Base::Compare_x_near_limit_2 m_object; - bool m_enabled; - - public: - /*! Construct */ - Compare_x_near_limit_2(const Base * base, bool enabled = true) : - m_object(base->compare_x_near_limit_2_object()), m_enabled(enabled) {} - - /*! Operate - * \param xcv1 the first curve the end of which is to be compared - * \param ce1 the identifier of the end of the first curve - * \param xcv2 the second curve the end of which is to be compared - * \param ce2 the identifier of the end of the second curve - * \return the comparison result - */ - Comparison_result operator()(const X_monotone_curve_2 & xcv1, - const X_monotone_curve_2 & xcv2, - Arr_curve_end ce) const - { - if (!m_enabled) return m_object(xcv1, xcv2, ce); - std::cout << "compare_x_near_limit 2" << std::endl - << " xcv1: " << xcv1 << std::endl - << " xcv2: " << xcv2 << std::endl - << " ce: " << ce << std::endl; - Comparison_result cr = m_object(xcv1, xcv2, ce); + bool cr = m_object(xcv); std::cout << " result: " << cr << std::endl; return cr; } @@ -1080,16 +999,16 @@ public: private: typename Base::Compare_x_on_boundary_2 m_object; bool m_enabled; - + public: /*! Construct */ - Compare_x_on_boundary_2(const Base * base, bool enabled = true) : + Compare_x_on_boundary_2(const Base* base, bool enabled = true) : m_object(base->compare_x_on_boundary_2_object()), m_enabled(enabled) {} /*! Operate * \param p1 the first point. * \param p2 the second point. */ - Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { if (!m_enabled) return m_object(p1, p2); std::cout << "compare_x_on_boundary" << std::endl @@ -1105,8 +1024,9 @@ public: * \param xcv the curve. * \param ce the curve-end */ - Comparison_result operator()(const Point_2 & pt, - const X_monotone_curve_2 & xcv, Arr_curve_end ce) const + Comparison_result operator()(const Point_2& pt, + const X_monotone_curve_2& xcv, + Arr_curve_end ce) const { if (!m_enabled) return m_object(pt, xcv, ce); std::cout << "compare_x_on_boundary" << std::endl @@ -1124,8 +1044,10 @@ public: * \param xcv2 the second curve. * \param ce2 the second curve-end */ - Comparison_result operator()(const X_monotone_curve_2 & xcv1, Arr_curve_end ce1, - const X_monotone_curve_2 & xcv2, Arr_curve_end ce2) const + Comparison_result operator()(const X_monotone_curve_2& xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2& xcv2, + Arr_curve_end ce2) const { if (!m_enabled) return m_object(xcv2, ce1, xcv2, ce2); std::cout << "compare_x_on_boundary" << std::endl @@ -1137,9 +1059,8 @@ public: std::cout << " result: " << cr << std::endl; return cr; } - }; - + /*! A functor that compares the x-coordinates of curve ends near the * boundary of the parameter space. */ @@ -1147,10 +1068,10 @@ public: private: typename Base::Compare_x_near_boundary_2 m_object; bool m_enabled; - + public: /*! Construct */ - Compare_x_near_boundary_2(const Base * base, bool enabled = true) : + Compare_x_near_boundary_2(const Base* base, bool enabled = true) : m_object(base->compare_x_near_boundary_2_object()), m_enabled(enabled) {} /*! Operate @@ -1160,15 +1081,15 @@ public: * \param ce2 the identifier of the end of the second curve * \return the comparison result */ - Comparison_result operator()(const X_monotone_curve_2 & xcv1, - const X_monotone_curve_2 & xcv2, + Comparison_result operator()(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, Arr_curve_end ce) const { if (!m_enabled) return m_object(xcv1, xcv2, ce); std::cout << "compare_x_near_boundary 2" << std::endl << " xcv1: " << xcv1 << std::endl << " xcv2: " << xcv2 << std::endl - << " ce: " << ce << std::endl; + << " ce: " << ce << std::endl; Comparison_result cr = m_object(xcv1, xcv2, ce); std::cout << " result: " << cr << std::endl; return cr; @@ -1182,7 +1103,7 @@ public: Compare_x_2 compare_x_2_object() const { return Compare_x_2(this, compare_x_op()); } - + Compare_xy_2 compare_xy_2_object() const { return Compare_xy_2(this, compare_xy_op()); } @@ -1194,10 +1115,10 @@ public: Is_vertical_2 is_vertical_2_object() const { return Is_vertical_2(this, is_vertical_op()); } - + Compare_y_at_x_2 compare_y_at_x_2_object() const { return Compare_y_at_x_2(this, compare_y_at_x_op()); } - + Equal_2 equal_2_object() const { return Equal_2(this, equal_points_op(), equal_curves_op()); } @@ -1206,7 +1127,7 @@ public: Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const { return Compare_y_at_x_right_2(this, compare_y_at_x_right_op()); } - + Make_x_monotone_2 make_x_monotone_2_object() const { return Make_x_monotone_2(this, make_x_monotone_op()); } @@ -1233,9 +1154,9 @@ public: Parameter_space_in_x_2 parameter_space_in_x_2_object() const { return Parameter_space_in_x_2(this, parameter_space_in_x_op()); } - Is_on_x_identification_2 is_on_x_identification_2_object() const + Is_on_x_identification_2 is_on_x_identification_2_object() const { return Is_on_x_identification_2(this, is_on_x_identification_op()); } - + Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const { return Compare_y_on_boundary_2(this, compare_y_on_boundary_op()); } @@ -1243,19 +1164,13 @@ public: { return Compare_y_near_boundary_2(this, compare_y_near_boundary_op()); } // bottom-top - + Parameter_space_in_y_2 parameter_space_in_y_2_object() const { return Parameter_space_in_y_2(this, parameter_space_in_y_op()); } - - Is_on_y_identification_2 is_on_y_identification_2_object() const + + Is_on_y_identification_2 is_on_y_identification_2_object() const { return Is_on_y_identification_2(this, is_on_y_identification_op()); } - Compare_x_at_limit_2 compare_x_at_limit_2_object() const - { return Compare_x_at_limit_2(this, compare_x_at_limit_op()); } - - Compare_x_near_limit_2 compare_x_near_limit_2_object() const - { return Compare_x_near_limit_2(this, compare_x_near_limit_op()); } - Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const { return Compare_x_on_boundary_2(this, compare_x_on_boundary_op()); } @@ -1265,8 +1180,8 @@ public: //@} }; -template -OutputStream & operator<<(OutputStream & os, Comparison_result cr) +template +OutputStream& operator<<(OutputStream& os, Comparison_result cr) { os << ((cr == SMALLER) ? "SMALLER" : (cr == EQUAL) ? "EQUAL" : "LARGER"); return os; 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 4b5abbee86a..e523357fde7 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 @@ -1,4 +1,4 @@ -// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011,2014 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org). @@ -20,13 +20,14 @@ // // Author(s) : Ron Wein s // Efi Fogel -// Eric Berberich +// Eric Berberich // (based on old version by Iddo Hanniel // Eyal Flato // Oren Nechushtan // Efi Fogel // Ron Wein // Idit Haran) + #ifndef CGAL_ARR_TRAITS_ADAPTOR_2_H #define CGAL_ARR_TRAITS_ADAPTOR_2_H @@ -73,15 +74,10 @@ public: Right_side_category; protected: - // left-right dispatch typedef CGAL::internal::Arr_left_right_implementation_dispatch< Left_side_category, Right_side_category > LR; - typedef typename LR::Parameter_space_in_x_2_curve_end_tag - Psx_2_curve_end_tag; - typedef typename LR::Parameter_space_in_x_2_curve_tag Psx_2_curve_tag; - typedef typename LR::Parameter_space_in_x_2_point_tag Psx_2_point_tag; typedef typename LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve_tag; typedef typename LR::Is_on_y_identification_2_point_tag Ioyi_2_point_tag; typedef typename LR::Compare_y_on_boundary_2_points_tag @@ -93,31 +89,26 @@ protected: typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< Bottom_side_category, Top_side_category > BT; - typedef typename BT::Parameter_space_in_y_2_curve_end_tag - Psy_2_curve_end_tag; - typedef typename BT::Parameter_space_in_y_2_curve_tag Psy_2_curve_tag; - typedef typename BT::Parameter_space_in_y_2_point_tag Psy_2_point_tag; typedef typename BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve_tag; typedef typename BT::Is_on_x_identification_2_point_tag Ioxi_2_point_tag; - typedef typename BT::Compare_x_at_limit_2_point_curve_end_tag - Cmp_x_al_2_point_curve_end_tag; - typedef typename BT::Compare_x_at_limit_2_curve_ends_tag - Cmp_x_al_2_curve_ends_tag; - typedef typename BT::Compare_x_near_limit_2_curve_ends_tag - Cmp_x_nl_2_curve_ends_tag; - - typedef typename BT::Compare_x_on_boundary_2_points_tag - Cmp_x_ob_2_points_tag; - typedef typename BT::Compare_x_on_boundary_2_point_curve_end_tag - Cmp_x_ob_2_point_curve_end_tag; - typedef typename BT::Compare_x_on_boundary_2_curve_ends_tag - Cmp_x_ob_2_curve_ends_tag; typedef typename BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends_tag; -public: + // Used by: + // 1. parameter_space_in_x + typedef typename Arr_two_sides_category::result + Left_or_right_sides_category; + // Used by: + // 1. parameter_space_in_y + // 2. compare_x_on_boundary + typedef typename Arr_two_sides_category::result + Bottom_or_top_sides_category; + +public: /// \name Construction. //@{ /*! Default constructor. */ @@ -333,7 +324,6 @@ public: //@} - /// \name Overriden functors for boundaries. //@{ @@ -344,38 +334,22 @@ public: */ class Parameter_space_in_x_2 { public: - - /*! - * Obtain the location of the given curve end in x. + /*! Obtain the location of the given curve end in x. * \param xcv The curve. * \param ind ARR_MIN_END if we refer to xcv's minimal end, * ARR_MAX_END if we refer to its maximal end. * \return The location of the curve end. */ Arr_parameter_space operator()(const X_monotone_curve_2& xcv, - Arr_curve_end ind) const + Arr_curve_end ind) const { // The function is implemented based on the tag dispatching // If the traits class does not support special boundaries, we just // return ARR_INTERIOR. - return parameter_space_in_x(xcv, ind, Psx_2_curve_end_tag()); + return parameter_space_in_x(xcv, ind, Left_or_right_sides_category()); } - /*! - * Obtain the location of the given curve end in x. - * \param xcv The curve. - * \return The location of the curve end in x direction. - */ - Arr_parameter_space operator()(const X_monotone_curve_2& xcv) const - { - // The function is implemented based on the tag dispatching. - // If the traits class does not support special boundaries, we just - // return ARR_INTERIOR. - return parameter_space_in_x(xcv, Psx_2_curve_tag()); - } - - /*! - * Obtain the location of the given point end in x. + /*! Obtain the location of the given point end in x. * \param p The point. * \return The location of the point end in x direction. */ @@ -384,10 +358,9 @@ public: // The function is implemented based on the tag dispatching // If the traits class does not support special boundaries, we just // return ARR_INTERIOR. - return parameter_space_in_x(p, Psx_2_point_tag()); + return parameter_space_in_x(p, Left_or_right_sides_category()); } - protected: //! The base traits. const Base* m_base; @@ -404,56 +377,67 @@ public: //! Allow its functor obtaining function calling the private constructor. friend class Arr_traits_basic_adaptor_2; - /*! - * Implementation of the operator() in case the base should be used. - */ + /*! Implementation of the operator() in case the base should be used. */ Arr_parameter_space parameter_space_in_x(const X_monotone_curve_2& xcv, Arr_curve_end ind, - Arr_use_traits_tag) const + /* Left and Right */ Arr_has_identified_side_tag) const + { + // If the curve completely lies on the left-right identification, return + // ARR_LEFT_BOUNDARY as an arbitrary but consistent choice. + if (m_base->is_on_y_identification_2_object()(xcv)) + return ARR_LEFT_BOUNDARY; + return (m_base->parameter_space_in_x_2_object()(xcv, ind)); + } + + /*! Implementation of the operator() in case the base should be used. */ + Arr_parameter_space parameter_space_in_x(const X_monotone_curve_2& xcv, + Arr_curve_end ind, + /* Left or Right */ Arr_boundary_cond_tag) const { return (m_base->parameter_space_in_x_2_object()(xcv, ind)); } - /*! - * Implementation of the operator() in case the dummy should be used. - */ + /*! Implementation of the operator() in case the dummy should be used. */ Arr_parameter_space parameter_space_in_x(const X_monotone_curve_2&, Arr_curve_end, - Arr_use_dummy_tag) const - { return ARR_INTERIOR; } + /* Left or Right */ Arr_all_sides_oblivious_tag) const + { + /*! \todo ideally we should call CGAL_error() here and avoid invocation + * of the functor for traits classes that have oblivious boundary + * conditions + */ + return ARR_INTERIOR; + } - /*! - * Implementation of the operator() in case the base should be used. - */ - Arr_parameter_space parameter_space_in_x(const X_monotone_curve_2& xcv, - Arr_use_traits_tag) const - { return (m_base->parameter_space_in_x_2_object()(xcv)); } - - /*! - * Implementation of the operator() in case the dummy should be used. - */ - Arr_parameter_space parameter_space_in_x(const X_monotone_curve_2&, - Arr_use_dummy_tag) const - { return ARR_INTERIOR; } - - /*! - * Implementation of the operator() in case the base should be used. - */ + /*! Implementation of the operator() in case the base should be used. */ Arr_parameter_space parameter_space_in_x(const Point_2& p, - Arr_use_traits_tag) const + /* Left and Right */ Arr_has_identified_side_tag) const + { + // if the point lies on the left-right identification, return + // ARR_LEFT_BOUNDARY as an arbitrary but consistent choice + if (m_base->is_on_y_identification_2_object()(p)) + return ARR_LEFT_BOUNDARY; + return m_base->parameter_space_in_x_2_object()(p); + } + + /*! Implementation of the operator() in case the base should be used. */ + Arr_parameter_space parameter_space_in_x(const Point_2& p, + /* Left or Right */ Arr_boundary_cond_tag) const { return m_base->parameter_space_in_x_2_object()(p); } - /*! - * Implementation of the operator() in case the dummy should be used. - */ + /*! Implementation of the operator() in case the dummy should be used. */ Arr_parameter_space parameter_space_in_x(const Point_2&, - Arr_use_dummy_tag) const - { return ARR_INTERIOR; } + /* Left or Right */ Arr_all_sides_oblivious_tag) const + { + /*! \todo ideally we should call CGAL_error() here and avoid invocation + * of the functor for traits classes that have oblivious boundary + * conditions + */ + return ARR_INTERIOR; + } }; /*! Obtain an Parameter_space_in_x_2 function object. */ Parameter_space_in_x_2 parameter_space_in_x_2_object() const - { - return Parameter_space_in_x_2(this); - } + { return Parameter_space_in_x_2(this); } /*! A function object that determines whether an x-monotone curve or a * point coincide with the vertical identification curve. @@ -476,7 +460,7 @@ public: friend class Arr_traits_basic_adaptor_2; public: - /*! Determones whether a point lies on the vertical identification curve + /*! Determines whether a point lies on the vertical identification curve * \param p the point. * \return true if p lies on the vertical identification curve, and * false otherwise. @@ -484,7 +468,7 @@ public: bool operator()(const Point_2& p) const { return is_on_y_idn(p, Ioyi_2_point_tag()); } - /*! Determones whether an x-monotone curve coicide with the vertical + /*! Determines whether an x-monotone curve coicide with the vertical * identification curve * \param xcv the point. * \return true if xcv coincides with an identification curve, @@ -498,19 +482,13 @@ public: { return m_base->is_on_y_identification_2_object()(p); } bool is_on_y_idn(const Point_2&, Arr_use_dummy_tag) const - { - CGAL_error(); - return SMALLER; - } + { CGAL_error(); return false; } bool is_on_y_idn(const X_monotone_curve_2& xcv, Arr_use_traits_tag) const { return m_base->is_on_y_identification_2_object()(xcv); } bool is_on_y_idn(const X_monotone_curve_2&, Arr_use_dummy_tag) const - { - CGAL_error(); - return SMALLER; - } + { CGAL_error(); return false; } }; /*! Obtain a Is_on_y_identification_2 function object. */ @@ -554,10 +532,7 @@ public: Comparison_result comp_y_near_bnd(const X_monotone_curve_2&, const X_monotone_curve_2&, Arr_curve_end, Arr_use_dummy_tag) const - { - CGAL_error(); - return EQUAL; - } + { CGAL_error(); return EQUAL; } public: /*! @@ -617,10 +592,7 @@ public: */ Comparison_result comp_y_on_bnd(const Point_2&, const Point_2&, Arr_use_dummy_tag) const - { - CGAL_error(); - return SMALLER; - } + { CGAL_error(); return SMALLER; } public: /*! Compare the relative y-positions of two points. @@ -651,8 +623,7 @@ public: */ class Parameter_space_in_y_2 { public: - /*! - * Obtain the location of the given curve end in y. + /*! Obtain the location of the given curve end in y. * \param xcv The curve. * \param ind ARR_MIN_END if we refer to xcv's minimal end, * ARR_MAX_END if we refer to its maximal end. @@ -664,29 +635,15 @@ public: // The function is implemented based on the tag dispatching. // If the traits class does not support special boundaries, we just // return ARR_INTERIOR. - return parameter_space_in_y(xcv, ind, Psy_2_curve_end_tag()); + return parameter_space_in_y(xcv, ind, Bottom_or_top_sides_category()); } - /*! - * Obtain the location of the given curve end in y. - * \param xcv The curve. - * \return The location of the curve end in y direction. - */ - Arr_parameter_space operator()(const X_monotone_curve_2& xcv) const - { - // The function is implemented based on the tag dispatching. - // If the traits class does not support special boundaries, we just - // return ARR_INTERIOR. - return parameter_space_in_y(xcv, Psy_2_curve_tag()); - } - - /*! - * Obtain the location of the given point end in y. + /*! Obtain the location of the given point end in y. * \param p The point. * \return The location of the point end in y direction. */ Arr_parameter_space operator()(const Point_2& p) const - { return parameter_space_in_y(p, Psy_2_point_tag()); } + { return parameter_space_in_y(p, Bottom_or_top_sides_category()); } protected: //! The base traits. @@ -704,49 +661,65 @@ public: //! Allow its functor obtaining function calling the private constructor. friend class Arr_traits_basic_adaptor_2; - /*! - * Implementation of the operator() in case the base should be used. - */ + /*! Implementation of the operator() in case the base should be used. */ Arr_parameter_space parameter_space_in_y(const X_monotone_curve_2& xcv, Arr_curve_end ind, - Arr_use_traits_tag) const - { return m_base->parameter_space_in_y_2_object()(xcv, ind); } + /* Bottom and Top */ Arr_has_identified_side_tag) const + { + // If the curve completely lies on the bottom-top identification, return + // ARR_BOTTOM_BOUNDARY as an arbitrary but consistent choice. + if (m_base->is_on_x_identification_2_object()(xcv)) { + return ARR_BOTTOM_BOUNDARY; + } + return m_base->parameter_space_in_y_2_object()(xcv, ind); + } - /*! - * Implementation of the operator() in case the dummy should be used. - */ + /*! Implementation of the operator() in case the base should be used. */ + Arr_parameter_space parameter_space_in_y(const X_monotone_curve_2& xcv, + Arr_curve_end ind, + /* Bottom or Top */ Arr_boundary_cond_tag) const + { + return m_base->parameter_space_in_y_2_object()(xcv, ind); + } + /*! Implementation of the operator() in case the dummy should be used. */ Arr_parameter_space parameter_space_in_y(const X_monotone_curve_2&, Arr_curve_end, - Arr_use_dummy_tag) const - { return ARR_INTERIOR; } + Arr_all_sides_oblivious_tag) const + { + /*! \todo ideally we should call CGAL_error() here and avoid invocation + * of the functor for traits classes that have oblivious boundary + * conditions + */ + return ARR_INTERIOR; + } - /*! - * Implementation of the operator() in case the base should be used. - */ - Arr_parameter_space parameter_space_in_y(const X_monotone_curve_2& xcv, - Arr_use_traits_tag) const - { return (m_base->parameter_space_in_x_2_object()(xcv)); } - - /*! - * Implementation of the operator() in case the dummy should be used. - */ - Arr_parameter_space parameter_space_in_y(const X_monotone_curve_2&, - Arr_use_dummy_tag) const - { return ARR_INTERIOR; } - - /*! - * Implementation of the operator() in case the base should be used. - */ + /*! Implementation of the operator() in case the base should be used. */ Arr_parameter_space parameter_space_in_y(const Point_2& p, - Arr_use_traits_tag) const + /* Bottom and Top */ Arr_has_identified_side_tag) const + { + // if the point lies on the bottom-top identification, return + // ARR_BOTTOM_BOUNDARY as an arbitrary but consistent choice + if (m_base->is_on_x_identification_2_object()(p)) { + return ARR_BOTTOM_BOUNDARY; + } + return m_base->parameter_space_in_x_2_object()(p); + } + + /*! Implementation of the operator() in case the base should be used. */ + Arr_parameter_space parameter_space_in_y(const Point_2& p, + /* Bottom or Top */ Arr_boundary_cond_tag) const { return m_base->parameter_space_in_y_2_object()(p); } - /*! - * Implementation of the operator() in case the dummy should be used. - */ + /*! Implementation of the operator() in case the dummy should be used. */ Arr_parameter_space parameter_space_in_y(const Point_2&, - Arr_use_dummy_tag) const - { return ARR_INTERIOR; } + Arr_all_sides_oblivious_tag) const + { + /*! \todo ideally we should call CGAL_error() here and avoid invocation + * of the functor for traits classes that have oblivious boundary + * conditions + */ + return ARR_INTERIOR; + } }; /*! Obtain an Parameter_space_in_y_2 function object. */ @@ -774,7 +747,7 @@ public: friend class Arr_traits_basic_adaptor_2; public: - /*! Determones whether a point lies on the horizontal identification curve + /*! Determines whether a point lies on the horizontal identification curve * \param p the point. * \return true if p lies on the vertical identification curve, and * false otherwise. @@ -782,7 +755,7 @@ public: bool operator()(const Point_2& p) const { return is_on_idn(p, Ioxi_2_point_tag()); } - /*! Determones whether an x-monotone curve coicide with the horizontal + /*! Determines whether an x-monotone curve coicide with the horizontal * identification curve * \param xcv the point. * \return true if xcv coincides with an identification curve, @@ -796,195 +769,19 @@ public: { return m_base->is_on_x_identification_2_object()(p); } bool is_on_x_idn(const Point_2&, Arr_use_dummy_tag) const - { - CGAL_error(); - return SMALLER; - } + { CGAL_error(); return SMALLER; } bool is_on_x_idn(const X_monotone_curve_2& xcv, Arr_use_traits_tag) const { return m_base->is_on_x_identification_2_object()(xcv); } bool is_on_x_idn(const X_monotone_curve_2&, Arr_use_dummy_tag) const - { - CGAL_error(); - return SMALLER; - } + { CGAL_error(); return SMALLER; } }; /*! Obtain a Is_on_x_identification_2 function object. */ Is_on_x_identification_2 is_on_x_identification_2_object() const { return Is_on_x_identification_2(this); } - /*! A functor that compares the x-limits of curve ends near the - * boundary of the parameter space - */ - class Compare_x_at_limit_2 { - protected: - //! The base traits. - const Base * 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. - */ - Compare_x_at_limit_2(const Base * base) : m_base(base) {} - - //! Allow its functor obtaining function calling the private constructor. - friend class Arr_traits_basic_adaptor_2; - - /*! - * Implementation of the operator() in case the base should be used. - */ - Comparison_result _compare_point_curve(const Point_2& p, - const X_monotone_curve_2& xcv, - Arr_curve_end ce, - Arr_use_traits_tag) const - { return (m_base->compare_x_at_limit_2_object()(p, xcv, ce)); } - - /*! - * Implementation of the operator() in case the dummy should be used. - */ - Comparison_result _compare_point_curve(const Point_2&, - const X_monotone_curve_2&, - Arr_curve_end, - Arr_use_dummy_tag) const - { - CGAL_error(); - return EQUAL; - } - - /*! - * Implementation of the operator() in case the base should be used. - */ - Comparison_result _compare_curves(const X_monotone_curve_2& xcv1, - Arr_curve_end ce1, - const X_monotone_curve_2& xcv2, - Arr_curve_end ce2, - Arr_use_traits_tag) const - { return m_base->compare_x_at_limit_2_object()(xcv1, ce1, xcv2, ce2); } - - /*! - * Implementation of the operator() in case the dummy should be used. - */ - Comparison_result _compare_curves(const X_monotone_curve_2&, - Arr_curve_end, - const X_monotone_curve_2&, - Arr_curve_end, - Arr_use_dummy_tag) const - { - CGAL_error(); - return EQUAL; - } - - public: - /*! Compare the x-limits of a vertical curve and another given - * curve end. - * \param p A reference point; we refer to a vertical line incident to p. - * \param xcv The compared curve. - * \param ind ARR_MIN_END if we refer to xcv's minimal end; - * ARR_MAX_END if we refer to its maximal end. - * \pre xcv's relevant end has a special boundary in y. - * \return SMALLER if p lies to the left of xcv; - * LARGER if p lies to the right xcv; - * EQUAL in case of an overlap. - */ - Comparison_result operator()(const Point_2& p, - const X_monotone_curve_2& xcv, - Arr_curve_end ce) const - { - return _compare_point_curve(p, xcv, ce, Cmp_x_al_2_point_curve_end_tag()); - } - - /*! Compare the x-limits of two curve ends on the boundary. - * \param xcv1 The first curve. - * \param ind1 ARR_MIN_END if we refer to xcv1's minimal end; - * ARR_MAX_END if we refer to its maximal end. - * \param xcv2 The second curve. - * \param ind2 ARR_MIN_END if we refer to xcv2's minimal end; - * ARR_MAX_END if we refer to its maximal end. - * \pre Both curve ends have a special boundary in y. - * \return SMALLER if xcv1 lies to the left of xcv2; - * LARGER if xcv1 lies to the right xcv2; - * EQUAL in case of an overlap. - */ - Comparison_result operator()(const X_monotone_curve_2& xcv1, - Arr_curve_end ce1, - const X_monotone_curve_2& xcv2, - Arr_curve_end ce2) const - { - return _compare_curves(xcv1, ce1, xcv2, ce2, Cmp_x_al_2_curve_ends_tag()); - } - }; - - /*! Obtain a Compare_x_at_limit_2 function object. */ - Compare_x_at_limit_2 compare_x_at_limit_2_object() const - { return Compare_x_at_limit_2(this); } - - /*! A functor that compares the x-coordinates of curve ends near the - * boundary of the parameter space - */ - class Compare_x_near_limit_2 { - protected: - //! The base traits. - const Base* 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. - */ - Compare_x_near_limit_2(const Base* base) : m_base(base) {} - - //! Allow its functor obtaining function calling the private constructor. - friend class Arr_traits_basic_adaptor_2; - - /*! - * Implementation of the operator() in case the base should be used. - */ - Comparison_result _compare_curves(const X_monotone_curve_2& xcv1, - const X_monotone_curve_2& xcv2, - Arr_curve_end ce, - Arr_use_traits_tag) const - { return m_base->compare_x_near_limit_2_object()(xcv1, xcv2, ce); } - - /*! - * Implementation of the operator() in case the dummy should be used. - */ - Comparison_result _compare_curves(const X_monotone_curve_2&, - const X_monotone_curve_2&, - Arr_curve_end, - Arr_use_dummy_tag) const - { - CGAL_error(); - return EQUAL; - } - - public: - /*! Compare the relative x-positions of two curve ends. - * \param xcv1 The first curve. - * \param xcv2 The second curve. - * \param ce ARR_MIN_END if we refer to the curves' minimal end; - * ARR_MAX_END if we refer to the curves' maximal end. - * \pre Both curve ends have a special boundary in y. - * \return SMALLER if xcv1 lies to the left of xcv2; - * LARGER if xcv1 lies to the right xcv2; - * EQUAL in case of an overlap. - */ - Comparison_result operator()(const X_monotone_curve_2& xcv1, - const X_monotone_curve_2& xcv2, - Arr_curve_end ce) const - { return _compare_curves(xcv1, xcv2, ce, Cmp_x_nl_2_curve_ends_tag()); } - }; - - /*! Obtain a Compare_x_near_limit_2 function object. */ - Compare_x_near_limit_2 compare_x_near_limit_2_object() const - { return Compare_x_near_limit_2(this); } - /*! A function object that compares the x-coordinate of two given points * that lie on horizontal boundaries. */ @@ -1012,7 +809,9 @@ public: * \param p2 the second point. */ Comparison_result operator()(const Point_2& p1, const Point_2& p2) const - { return comp_x_on_bnd(p1, p2, Cmp_x_ob_2_points_tag()); } + { + return comp_x_on_bnd(p1, p2, Bottom_side_category(), Top_side_category()); + } /*! Compare the x-coordinate of a point and a curve-end projected onto the * horizontal boundaries @@ -1023,7 +822,7 @@ public: Comparison_result operator()(const Point_2& pt, const X_monotone_curve_2& xcv, Arr_curve_end ce) const - { return comp_x_on_bnd(pt, xcv, ce, Cmp_x_ob_2_point_curve_end_tag()); } + { return comp_x_on_bnd(pt, xcv, ce, Bottom_or_top_sides_category()); } /*! Compare the x-coordinates of two curve-ends projected onto the horizontal * boundaries @@ -1036,52 +835,70 @@ public: Arr_curve_end ce1, const X_monotone_curve_2& xcv2, Arr_curve_end ce2) const - { return comp_x_on_bnd(xcv1, ce1, xcv2, ce2, Cmp_x_ob_2_curve_ends_tag()); } - - private: - Comparison_result comp_x_on_bnd(const Point_2& p1, const Point_2& p2, - Arr_use_traits_tag) const - { return m_base->compare_x_on_boundary_2_object()(p1, p2); } - - Comparison_result comp_x_on_bnd(const Point_2&, const Point_2&, - Arr_use_dummy_tag) const { - CGAL_error(); - return SMALLER; + return comp_x_on_bnd(xcv1, ce1, xcv2, ce2, + Bottom_or_top_sides_category()); } + private: + + // There are three cases that need the functor (where at least one side is + // closed) + + /*! Implementation for identificatied sides calls the base. */ + Comparison_result comp_x_on_bnd(const Point_2& p1, const Point_2& p2, + Arr_identified_side_tag, + Arr_identified_side_tag) const + { return m_base->compare_x_on_boundary_2_object()(p1, p2); } + + /*! Implementation for closed top side calls the base. */ + Comparison_result comp_x_on_bnd(const Point_2& p1, const Point_2& p2, + Arr_boundary_side_tag, Arr_closed_side_tag) + const + { return m_base->compare_x_on_boundary_2_object()(p1, p2); } + + /*! Implementation for closed bottom side calls the base. */ + Comparison_result comp_x_on_bnd(const Point_2& p1, const Point_2& p2, + Arr_closed_side_tag, Arr_boundary_side_tag) + const + { return m_base->compare_x_on_boundary_2_object()(p1, p2); } + + // for all other cases an error is generated + /*! Implementation for the cases no base is called. */ + Comparison_result comp_x_on_bnd(const Point_2& p1, const Point_2& p2, + Arr_boundary_side_tag, + Arr_boundary_side_tag) const + { CGAL_error(); return SMALLER; } + + /*! Implementation for the case the the base should be used. */ Comparison_result comp_x_on_bnd(const Point_2& pt, const X_monotone_curve_2& xcv, Arr_curve_end ce, - Arr_use_traits_tag) const + Arr_boundary_cond_tag) const { return m_base->compare_x_on_boundary_2_object()(pt, xcv, ce); } + /*! Implementation of the case the dummy should be used. */ Comparison_result comp_x_on_bnd(const Point_2&, const X_monotone_curve_2& /* xcv */, Arr_curve_end /* ce */, - Arr_use_dummy_tag) const - { - CGAL_error(); - return SMALLER; - } - + Arr_all_sides_oblivious_tag) const + { CGAL_error(); return SMALLER; } + /*! Implementation for the case the the base should be used. */ Comparison_result comp_x_on_bnd(const X_monotone_curve_2& xcv1, Arr_curve_end ce1, const X_monotone_curve_2& xcv2, Arr_curve_end ce2, - Arr_use_traits_tag) const + Arr_boundary_cond_tag) const { return m_base->compare_x_on_boundary_2_object()(xcv1, ce1, xcv2, ce2); } + /*! Implementation of the case the dummy should be used. */ Comparison_result comp_x_on_bnd(const X_monotone_curve_2& /* xcv1 */, Arr_curve_end /* ce1 */, const X_monotone_curve_2& /* xcv2 */, Arr_curve_end /* ce2 */, - Arr_use_dummy_tag) const - { - CGAL_error(); - return SMALLER; - } + Arr_all_sides_oblivious_tag) const + { CGAL_error(); return SMALLER; } }; /*! Obtain a Compare_x_on_boundary_2 function object. */ @@ -1108,29 +925,21 @@ public: //! Allow its functor obtaining function calling the private constructor. friend class Arr_traits_basic_adaptor_2; - /*! - * Implementation of the operator() in case the base should be used. - */ + /*! Implementation of the operator() in case the base should be used. */ Comparison_result _compare_curves(const X_monotone_curve_2& xcv1, const X_monotone_curve_2& xcv2, Arr_curve_end ce, Arr_use_traits_tag) const { return m_base->compare_x_near_boundary_2_object()(xcv1, xcv2, ce); } - /*! - * Implementation of the operator() in case the dummy should be used. - */ + /*! Implementation of the operator() in case the dummy should be used. */ Comparison_result _compare_curves(const X_monotone_curve_2&, const X_monotone_curve_2&, Arr_curve_end, Arr_use_dummy_tag) const - { - CGAL_error(); - return EQUAL; - } + { CGAL_error(); return EQUAL; } public: - /*! Compare the relative x-positions of two curve ends. * \param xcv1 The first curve. * \param xcv2 The second curve. @@ -1187,11 +996,11 @@ public: return res; } - // for non-open + // for closed and identified Comparison_result _compare_curve_ends(const X_monotone_curve_2& xcv1, const X_monotone_curve_2& xcv2, Arr_curve_end ce, - Arr_oblivious_side_tag) const + Arr_non_oblivious_side_tag) const { Comparison_result res = m_self->compare_y_on_boundary_2_object()( @@ -1201,6 +1010,13 @@ public: return res; } + // for oblivious and contracted + Comparison_result _compare_curve_ends(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, + Arr_curve_end ce, + Arr_boundary_side_tag) const + { CGAL_error(); return EQUAL; } + public: /*! Compare the relative y-positions of two curve ends. * \param xcv1 The first curve. @@ -1276,8 +1092,17 @@ public: Arr_curve_end ce, Arr_open_side_tag) const { + // pt must be interior + // xcv,ce must be bottom or top + CGAL_precondition + (m_self->parameter_space_in_y_2_object()(pt) == ARR_INTERIOR); + CGAL_precondition_code(Arr_parameter_space ps_y2 = + m_self->parameter_space_in_y_2_object()(xcv,ce)); + CGAL_precondition((ps_y2 == ARR_BOTTOM_BOUNDARY) || + (ps_y2 == ARR_TOP_BOUNDARY)); + Comparison_result res = - m_self->compare_x_at_limit_2_object()(pt, xcv, ce); + m_self->compare_x_on_boundary_2_object()(pt, xcv, ce); if ((res != EQUAL) || m_self->is_vertical_2_object()(xcv)) return res; // look at the side from which the @@ -1380,49 +1205,81 @@ public: const X_monotone_curve_2& xcv2, Arr_curve_end ce2) const { - CGAL::Comparison_result res = CGAL::EQUAL; + //CGAL::Comparison_result res = CGAL::EQUAL; - CGAL::Arr_parameter_space loc1 = + CGAL::Arr_parameter_space ps_y1 = m_self->parameter_space_in_y_2_object()(xcv1, ce1); - CGAL::Arr_parameter_space loc2 = + CGAL::Arr_parameter_space ps_y2 = m_self->parameter_space_in_y_2_object()(xcv2, ce2); bool vert1 = m_self->is_vertical_2_object()(xcv1); bool vert2 = m_self->is_vertical_2_object()(xcv2); // now we are in the open case: ARR_MIN_END > vertical > ARR_MAX_END if (vert1) { - if (!vert2) { - res = ((ce2 == CGAL::ARR_MIN_END) ? CGAL::SMALLER : CGAL::LARGER); - return res; - } - // both are vertical - if (loc1 == loc2) { // both ends converge to the same infinity - res = CGAL::EQUAL; - return res; - } - res = (loc1 == CGAL::ARR_BOTTOM_BOUNDARY ? - CGAL::SMALLER : CGAL::LARGER); - return res; + if (!vert2) { + Comparison_result res = ((ce2 == CGAL::ARR_MIN_END) ? CGAL::SMALLER : CGAL::LARGER); + return res; + } + // both are vertical + if (ps_y1 == ps_y2) { // both ends converge to the same infinity + //std::cout << "resBB1 EQUAL" << std::endl; + Comparison_result res = CGAL::EQUAL; + return res; + } + if (ps_y1 == CGAL::ARR_BOTTOM_BOUNDARY) { + return SMALLER; + } + if (ps_y1 == CGAL::ARR_TOP_BOUNDARY) { + return LARGER; + } + if (ps_y2 == CGAL::ARR_BOTTOM_BOUNDARY) { + return LARGER; + } + if (ps_y2 == CGAL::ARR_TOP_BOUNDARY) { + return SMALLER; + } } if (vert2) { - res = ((ce1 == CGAL::ARR_MIN_END) ? CGAL::LARGER : CGAL::SMALLER); - return res; + Comparison_result res = ((ce1 == CGAL::ARR_MIN_END) ? CGAL::LARGER : CGAL::SMALLER); + return res; } // otherwise: both ends have asymptotic behaviour - if (ce1 == ce2) { // both ends approach asymptote from one side - if (loc1 == loc2) { // need special y-comparison - res = m_self->compare_x_near_limit_2_object()(xcv1, xcv2, ce2); - return res; - } - // else: order can be determined without y-comparison - res = CGAL::EQUAL; - return res; + if (ps_y1 == ps_y2) { // need special y-comparison + if (ce1 == ce2) { // both ends approach asymptote from one side + Comparison_result res = m_self->compare_x_near_boundary_2_object()(xcv1, xcv2, ce2); + return res; + } else { + // same x, same boundary side, one is max, the other is min + //_compare_curve_ends_same_x_different_ends(ce1, ce2); + // TODO + Comparison_result res = ((ce1 == CGAL::ARR_MIN_END) ? CGAL::LARGER : CGAL::SMALLER); + //std::cout << "resBBB: " << res << std::endl; + return res; + } } - // curve ends approach vertical asymptote (or singularity) from - // different sides => no comparisons required - res = ((ce1 == CGAL::ARR_MIN_END) ? CGAL::LARGER : CGAL::SMALLER); + if (ce1 == ce2) { + // curve ends approach same vertical asymptote (or singularity) from + // same sides but towards different sides + if (ps_y1 == CGAL::ARR_BOTTOM_BOUNDARY) { + return SMALLER; + } + if (ps_y1 == CGAL::ARR_TOP_BOUNDARY) { + return LARGER; + } + if (ps_y2 == CGAL::ARR_BOTTOM_BOUNDARY) { + return LARGER; + } + if (ps_y2 == CGAL::ARR_TOP_BOUNDARY) { + return SMALLER; + } + } + + // curve ends approach same vertical asymptote (or singularity) from + // different sides + // TODO + Comparison_result res = ((ce1 == CGAL::ARR_MIN_END) ? CGAL::LARGER : CGAL::SMALLER); return res; } @@ -1434,8 +1291,12 @@ public: Arr_open_side_tag) const { Comparison_result res = - m_self->compare_x_at_limit_2_object()(xcv1, ce1, xcv2, ce2); - if (res == EQUAL) res = _compare_curve_ends_same_x(xcv1, ce1, xcv2, ce2); + m_self->compare_x_on_boundary_2_object()(xcv1, ce1, xcv2, ce2); + if (res == EQUAL) { + //std::cout << "resAA: " << res << std::endl; + res = _compare_curve_ends_same_x(xcv1, ce1, xcv2, ce2); + } + //std::cout << "resAB: " << res << std::endl; return res; } @@ -1448,16 +1309,18 @@ public: Comparison_result res = m_self->compare_x_on_boundary_2_object()(xcv1, ce1, xcv2, ce2); - if (res == EQUAL) res = _compare_curve_ends_same_x(xcv1, ce1, xcv2, ce2); + if (res == EQUAL) { + res = _compare_curve_ends_same_x(xcv1, ce1, xcv2, ce2); + } return res; } - // for others + // for closed and identified Comparison_result _compare_curve_ends(const X_monotone_curve_2& xcv1, Arr_curve_end ce1, const X_monotone_curve_2& xcv2, Arr_curve_end ce2, - Arr_oblivious_side_tag) const + Arr_non_oblivious_side_tag) const { Comparison_result res = m_self->compare_x_on_boundary_2_object() @@ -1466,6 +1329,14 @@ public: return res; } + // dummy + Comparison_result _compare_curve_ends(const X_monotone_curve_2& xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2& xcv2, + Arr_curve_end ce2, + Arr_oblivious_side_tag) const + { CGAL_error(); return CGAL::EQUAL; } + public: /*! Compare the relative x-positions of two curve ends. * \param xcv1 The first curve. @@ -1562,7 +1433,7 @@ public: //! Allow its functor obtaining function calling the private constructor. friend class Arr_traits_basic_adaptor_2; - inline bool _is_closed(Arr_oblivious_side_tag) const { return true; } + inline bool _is_closed(Arr_boundary_side_tag) const { return true; } inline bool _is_closed(Arr_open_side_tag) const { return false; } @@ -1603,8 +1474,8 @@ public: //@{ class Is_in_x_range_2 { public: - /*! - * Check whether the given point is in the x-range of the given x-monotone + public: + /*! Check whether a given point is in the x-range of the given x-monotone * curve. * \param xcv The x-monotone curve. * \param p The point. @@ -1612,49 +1483,12 @@ public: */ bool operator()(const X_monotone_curve_2& xcv, const Point_2& p) const { - Parameter_space_in_x_2 ps_x = m_self->parameter_space_in_x_2_object(); - Parameter_space_in_y_2 ps_y = m_self->parameter_space_in_y_2_object(); - Compare_x_2 compare_x = m_self->compare_x_2_object(); - Compare_x_point_curve_end_2 - compare_x_point_curve_end = m_self->compare_x_point_curve_end_2_object(); - - // Compare p to the position of the left end of the curve. - // Note that if the left end of xcv lies at x boundary, p is obviously to - // its right. - Arr_parameter_space bx = ps_x(xcv, ARR_MIN_END); - if (bx == ARR_INTERIOR) { - Arr_parameter_space by = ps_y(xcv, ARR_MIN_END); - - Comparison_result res = (by == ARR_INTERIOR) ? - // The left endpoint of xcv is a normal point. - compare_x(p, m_self->construct_min_vertex_2_object()(xcv)) : - // The left end of xcv lies at y boundary. - compare_x_point_curve_end(p, xcv, ARR_MIN_END); - - // If p is to the left of the x-range return false. - // If p is equal, return true. - if (res == SMALLER) return false; - else if (res == EQUAL) return true; - } - - // If necessary, compare p to the right end of the curve. - // Note that if this end lies at x boundary, p is obviously to its left. - bx = ps_x(xcv, ARR_MAX_END); - if (bx != ARR_INTERIOR) return true; - - Arr_parameter_space by = ps_y(xcv, ARR_MAX_END); - - Comparison_result res = (by == ARR_INTERIOR) ? - // The right endpoint of xcv is a normal point. - compare_x(p, m_self->construct_max_vertex_2_object()(xcv)) : - // The right end of xcv lies at y boundary: - compare_x_point_curve_end(p, xcv, ARR_MAX_END); - - return (res != LARGER); + return is_in_x_range(xcv, p, + Left_or_right_sides_category(), + Bottom_or_top_sides_category()); } - /*! - * Check whether the x-ranges of the given x-monotone curves overlap. + /*! Check whether the x-ranges of the given x-monotone curves overlap. * \param xcv1 The first x-monotone curve. * \param xcv2 The second x-monotone curve. * \return (true) if there is an overlap in the x-ranges of the given @@ -1663,40 +1497,220 @@ public: bool operator()(const X_monotone_curve_2& xcv1, const X_monotone_curve_2& xcv2) const { - Parameter_space_in_x_2 ps_x = m_self->parameter_space_in_x_2_object(); - Parameter_space_in_y_2 ps_y = m_self->parameter_space_in_y_2_object(); - Compare_x_2 compare_x = m_self->compare_x_2_object(); - Construct_min_vertex_2 min_vertex = + return is_in_x_range(xcv1, xcv2, + Left_or_right_sides_category(), + Bottom_or_top_sides_category()); + } + + protected: + //! The base traits. + const Self* m_self; + + /*! 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_in_x_range_2(const Self* self) : m_self(self) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_traits_basic_adaptor_2; + + /// \name point - curve-end. + //@{ + /*! Implementation in the case of oblivious boundaries. */ + bool is_in_x_range(const X_monotone_curve_2& xcv, const Point_2& p, + Arr_all_sides_oblivious_tag, + Arr_all_sides_oblivious_tag) const + { + Compare_x_2 compare_x = m_self->compare_x_2_object(); + Comparison_result min_res = + compare_x(p, m_self->construct_min_vertex_2_object()(xcv)); + if (min_res == SMALLER) return false; // p is to the left of the x-range + else if (min_res == EQUAL) return true; // p coinsides with the left end + + Comparison_result max_res = + compare_x(p, m_self->construct_max_vertex_2_object()(xcv)); + return (max_res != LARGER); + } + + /*! Implementation in the case of oblivious left and right boundaries + * non-oblivious bottom and top boundaries. + * \todo implement is_in_x_range(xcv, p, oblivious, not-oblivious) + */ + bool is_in_x_range(const X_monotone_curve_2& xcv, const Point_2& p, + Arr_all_sides_oblivious_tag, Arr_boundary_cond_tag) const + { + return is_in_x_range(xcv, p, + Arr_boundary_cond_tag(), Arr_boundary_cond_tag()); + } + + /*! Implementation in the case of non-oblivious left and right boundaries. + * oblivious bottom and top boundaries. + * \todo implement is_in_x_range(xcv, p, not-oblivious, oblivious) + */ + bool is_in_x_range(const X_monotone_curve_2& xcv, const Point_2& p, + Arr_boundary_cond_tag, Arr_all_sides_oblivious_tag) const + { + return is_in_x_range(xcv, p, + Arr_boundary_cond_tag(), Arr_boundary_cond_tag()); + } + + /*! Implementation in the case of all non-oblivious boundaries. */ + bool is_in_x_range(const X_monotone_curve_2& xcv, const Point_2& p, + Arr_boundary_cond_tag, Arr_boundary_cond_tag) const + { + Parameter_space_in_x_2 ps_x = m_self->parameter_space_in_x_2_object(); + Parameter_space_in_y_2 ps_y = m_self->parameter_space_in_y_2_object(); + Compare_x_2 compare_x = m_self->compare_x_2_object(); + Compare_x_point_curve_end_2 compare_x_point_curve_end = + m_self->compare_x_point_curve_end_2_object(); + Construct_min_vertex_2 min_vertex = m_self->construct_min_vertex_2_object(); - Construct_max_vertex_2 max_vertex = + Construct_max_vertex_2 max_vertex = + m_self->construct_max_vertex_2_object(); + + // Compare p to the left end of the curve. + Arr_parameter_space bx = ps_x(p); + + Arr_parameter_space min_bx = ps_x(xcv, ARR_MIN_END); + if (ARR_LEFT_BOUNDARY == bx) { + return (ARR_LEFT_BOUNDARY == min_bx) ? true : false; + } + + Arr_parameter_space max_bx = ps_x(xcv, ARR_MAX_END); + if (ARR_RIGHT_BOUNDARY == bx) { + return (ARR_RIGHT_BOUNDARY == max_bx) ? true : false; + } + + CGAL_assertion(ARR_INTERIOR == bx); + if (ARR_RIGHT_BOUNDARY == min_bx) return false; + if (ARR_LEFT_BOUNDARY == max_bx) return false; + + if (ARR_INTERIOR == min_bx) { + Arr_parameter_space by = ps_y(p); + Arr_parameter_space min_by = ps_y(xcv, ARR_MIN_END); + Comparison_result res_min = + (ARR_INTERIOR == min_by) ? + ((ARR_INTERIOR == by) ? + compare_x(p, min_vertex(xcv)) : + compare_x(p, min_vertex(xcv))) : //! \todo Is compare_x() correct? + ((ARR_INTERIOR == by) ? + compare_x_point_curve_end(p, xcv, ARR_MIN_END) : + compare_x_point_curve_end(p, xcv, ARR_MIN_END)); + if (res_min == SMALLER) return false; + if (res_min == EQUAL) return true; + } + + if (ARR_INTERIOR == max_bx) { + Arr_parameter_space by = ps_y(p); + Arr_parameter_space max_by = ps_y(xcv, ARR_MAX_END); + Comparison_result res_max = + (ARR_INTERIOR == max_by) ? + ((ARR_INTERIOR == by) ? + compare_x(p, max_vertex(xcv)) : + compare_x(p, max_vertex(xcv))) : //! \todo Is compare_x() correct? + ((ARR_INTERIOR == by) ? + compare_x_point_curve_end(p, xcv, ARR_MAX_END) : + compare_x_point_curve_end(p, xcv, ARR_MAX_END)); + return (LARGER != res_max); + } + return true; + } + //@} + + /// \name curve-end - curve-end. + //@{ + /*! Implementation in the case of all oblivious boundaries. */ + bool is_in_x_range(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, + Arr_all_sides_oblivious_tag, + Arr_all_sides_oblivious_tag) const + { + Compare_x_2 compare_x = m_self->compare_x_2_object(); + + // Compare the x-coordinates of the two left ends. + Construct_min_vertex_2 min_vertex = + m_self->construct_min_vertex_2_object(); + Comparison_result res_min = compare_x(min_vertex(xcv1), min_vertex(xcv2)); + const X_monotone_curve_2& xcv_left = (res_min == LARGER) ? xcv1 : xcv2; + + // Compare the x-coordinates of the two right ends. + Construct_max_vertex_2 max_vertex = + m_self->construct_max_vertex_2_object(); + Comparison_result res_max = compare_x(max_vertex(xcv1), max_vertex(xcv2)); + const X_monotone_curve_2& xcv_right = (res_max == SMALLER) ? xcv1 : xcv2; + + // Compare the x-coordiates of the left end of xcv_left and the right end + // of xcv_right. + Comparison_result res = + compare_x(min_vertex(xcv_left), max_vertex(xcv_right)); + return (LARGER != res); + } + + /*! Implementation in the case of oblivious left and right boundaries + * non-oblivious bottom and top boundaries. + * \todo implement is_in_x_range(xcv1, xcv2, oblivious, not-oblivious) + */ + bool is_in_x_range(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, + Arr_all_sides_oblivious_tag, Arr_boundary_cond_tag) const + { + return is_in_x_range(xcv1, xcv2, + Arr_boundary_cond_tag(), Arr_boundary_cond_tag()); + } + + /*! Implementation in the case of non-oblivious left and right boundaries + * oblivious bottom and top boundaries. + * \todo implement is_in_x_range(xcv1, xcv2, not-oblivious, oblivious) + */ + bool is_in_x_range(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, + Arr_boundary_cond_tag, Arr_all_sides_oblivious_tag) const + { + return is_in_x_range(xcv1, xcv2, + Arr_boundary_cond_tag(), Arr_boundary_cond_tag()); + } + + /*! Implementation in the case of all non-oblivious boundaries. */ + bool is_in_x_range(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, + Arr_boundary_cond_tag, + Arr_boundary_cond_tag) const + { + Parameter_space_in_x_2 ps_x = m_self->parameter_space_in_x_2_object(); + Parameter_space_in_y_2 ps_y = m_self->parameter_space_in_y_2_object(); + Compare_x_2 compare_x = m_self->compare_x_2_object(); + Construct_min_vertex_2 min_vertex = + m_self->construct_min_vertex_2_object(); + Construct_max_vertex_2 max_vertex = m_self->construct_max_vertex_2_object(); Compare_x_point_curve_end_2 compare_x_point_curve_end = m_self->compare_x_point_curve_end_2_object(); Compare_x_curve_ends_2 compare_x_curve_ends = m_self->compare_x_curve_ends_2_object(); + const X_monotone_curve_2* xcv_left; + Arr_parameter_space by_left; + // Locate the rightmost of the two left endpoints of the two curves. // Note that we guard for curve ends with special boundary. - Arr_parameter_space ps_x1, ps_y1; - Arr_parameter_space ps_x2, ps_y2; - const X_monotone_curve_2* xcv_left; - Arr_parameter_space by_left; - Comparison_result res; + Arr_parameter_space ps_x_min1 = ps_x(xcv1, ARR_MIN_END); + Arr_parameter_space ps_x_min2 = ps_x(xcv2, ARR_MIN_END); - ps_x1 = ps_x(xcv1, ARR_MIN_END); - ps_x2 = ps_x(xcv2, ARR_MIN_END); - - if (ps_x1 != ARR_INTERIOR) { + if (ps_x_min1 != ARR_INTERIOR) { // If both curves are defined at x boundary, they obviously overlap in // their x-ranges. - if (ps_x2 != ARR_INTERIOR) return true; + if (ps_x_min2 != ARR_INTERIOR) return true; // As xcv2 is not defined at x boundary, take its left end as the // rightmost of the two left curve ends. xcv_left = &xcv2; by_left = ps_y(xcv2, ARR_MIN_END); } - else if (ps_x2 != ARR_INTERIOR) { + else if (ps_x_min2 != ARR_INTERIOR) { // As xcv1 is not defined at x boundary, take its left end as the // rightmost of the two left curve ends. xcv_left = &xcv1; @@ -1705,20 +1719,16 @@ public: else { // Compare the (finite) x-coordinates of the two left ends. // We take special care of the case of boundaries in y. - ps_y1 = ps_y(xcv1, ARR_MIN_END); - ps_y2 = ps_y(xcv2, ARR_MIN_END); - - if (ps_y1 == ARR_INTERIOR) { - res = (ps_y2 == ARR_INTERIOR) ? - compare_x(min_vertex(xcv1), min_vertex(xcv2)) : - compare_x_point_curve_end(min_vertex(xcv1), xcv2, ARR_MIN_END); - } - else { - res = (ps_y2 == ARR_INTERIOR) ? - opposite(compare_x_point_curve_end(min_vertex(xcv2), xcv1, - ARR_MIN_END)): - compare_x_curve_ends(xcv1, ARR_MIN_END, xcv2, ARR_MIN_END); - } + Arr_parameter_space ps_y1 = ps_y(xcv1, ARR_MIN_END); + Arr_parameter_space ps_y2 = ps_y(xcv2, ARR_MIN_END); + Comparison_result res = (ps_y1 == ARR_INTERIOR) ? + ((ps_y2 == ARR_INTERIOR) ? + compare_x(min_vertex(xcv1), min_vertex(xcv2)) : + compare_x_point_curve_end(min_vertex(xcv1), xcv2, ARR_MIN_END)) : + ((ps_y2 == ARR_INTERIOR) ? + opposite(compare_x_point_curve_end(min_vertex(xcv2), xcv1, + ARR_MIN_END)): + compare_x_curve_ends(xcv1, ARR_MIN_END, xcv2, ARR_MIN_END)); if (res == LARGER) { xcv_left = &xcv1; @@ -1733,22 +1743,22 @@ public: // Locate the leftmost of the two right endpoints of the two curves. // Note that we guard for curve ends with special boundary. const X_monotone_curve_2* xcv_right; - Arr_parameter_space by_right; + Arr_parameter_space by_right; - ps_x1 = ps_x(xcv1, ARR_MAX_END); - ps_x2 = ps_x(xcv2, ARR_MAX_END); + Arr_parameter_space ps_x_max1 = ps_x(xcv1, ARR_MAX_END); + Arr_parameter_space ps_x_max2 = ps_x(xcv2, ARR_MAX_END); - if (ps_x1 != ARR_INTERIOR) { + if (ps_x_max1 != ARR_INTERIOR) { // If both curves are defined at x boundary, they obviously overlap in // their x-ranges. - if (ps_x2 != ARR_INTERIOR) return true; + if (ps_x_max2 != ARR_INTERIOR) return true; // As xcv2 is not defined at x boundary, take its right end as the // leftmost of the two right curve ends. xcv_right = &xcv2; by_right = ps_y(xcv2, ARR_MAX_END); } - else if (ps_x2 != ARR_INTERIOR) { + else if (ps_x_max2 != ARR_INTERIOR) { // As xcv1 is not defined at x boundary, take its right end as the // leftmost of the two right curve ends. xcv_right = &xcv1; @@ -1757,20 +1767,17 @@ public: else { // Compare the (finite) x-coordinates of the two right ends. // We take special care of the case of boundaries in y. - ps_y1 = ps_y(xcv1, ARR_MAX_END); - ps_y2 = ps_y(xcv2, ARR_MAX_END); + Arr_parameter_space ps_y1 = ps_y(xcv1, ARR_MAX_END); + Arr_parameter_space ps_y2 = ps_y(xcv2, ARR_MAX_END); - if (ps_y1 == ARR_INTERIOR) { - res = (ps_y2 == ARR_INTERIOR) ? - compare_x(max_vertex(xcv1), max_vertex(xcv2)) : - compare_x_point_curve_end(max_vertex(xcv1), xcv2, ARR_MAX_END); - } - else { - res = (ps_y2 == ARR_INTERIOR) ? - opposite(compare_x_point_curve_end(max_vertex(xcv2), xcv1, - ARR_MAX_END)): - compare_x_curve_ends(xcv1, ARR_MAX_END, xcv2, ARR_MAX_END); - } + Comparison_result res = (ps_y1 == ARR_INTERIOR) ? + ((ps_y2 == ARR_INTERIOR) ? + compare_x(max_vertex(xcv1), max_vertex(xcv2)) : + compare_x_point_curve_end(max_vertex(xcv1), xcv2, ARR_MAX_END)) : + ((ps_y2 == ARR_INTERIOR) ? + opposite(compare_x_point_curve_end(max_vertex(xcv2), xcv1, + ARR_MAX_END)): + compare_x_curve_ends(xcv1, ARR_MAX_END, xcv2, ARR_MAX_END)); if (res == SMALLER) { xcv_right = &xcv1; @@ -1784,39 +1791,22 @@ public: // Now compare the (finite) x-coordiates of the left end of xcv_left and // the right end of xcv_right. - if (by_left == ARR_INTERIOR) { - res = (by_right == ARR_INTERIOR) ? - compare_x(min_vertex(*xcv_left), max_vertex(*xcv_right)) : - compare_x_point_curve_end(min_vertex(*xcv_left), *xcv_right, - ARR_MAX_END); - } - else { - res = (by_right == ARR_INTERIOR) ? - opposite(compare_x_point_curve_end(max_vertex(*xcv_right), - *xcv_left, ARR_MIN_END)) : - compare_x_curve_ends(*xcv_left, ARR_MIN_END, *xcv_right, ARR_MAX_END); - } + Comparison_result res = + (by_left == ARR_INTERIOR) ? + ((by_right == ARR_INTERIOR) ? + compare_x(min_vertex(*xcv_left), max_vertex(*xcv_right)) : + compare_x_point_curve_end(min_vertex(*xcv_left), *xcv_right, + ARR_MAX_END)) : + ((by_right == ARR_INTERIOR) ? + opposite(compare_x_point_curve_end(max_vertex(*xcv_right), + *xcv_left, ARR_MIN_END)) : + compare_x_curve_ends(*xcv_left, ARR_MIN_END, *xcv_right, ARR_MAX_END)); // The two curves overlap in their x-range if and only if the left end // of xcv_left is not to the right if the right end of xcv_right. return (res != LARGER); } - - protected: - //! The traits itself. - const Self* m_self; - - /*! Constructor. - * \param self The traits class itself. 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_in_x_range_2(const Self* self) : m_self(self) {} - - //! Allow its functor obtaining function calling the private constructor. - friend class Arr_traits_basic_adaptor_2; + //@} }; /*! Obtain an Is_in_x_range_2 function object. */ @@ -2048,9 +2038,9 @@ public: bool& xcv_equal_xcv1, bool& xcv_equal_xcv2) const { - Compare_y_at_x_left_2 compare_y_at_x_left = + Compare_y_at_x_left_2 compare_y_at_x_left = m_self->compare_y_at_x_left_2_object(); - Compare_y_at_x_right_2 compare_y_at_x_right = + Compare_y_at_x_right_2 compare_y_at_x_right = m_self->compare_y_at_x_right_2_object(); // Initialize output flags. @@ -2058,8 +2048,8 @@ public: xcv_equal_xcv2 = false; // Take care of the general 4 cases: - Comparison_result l_res, r_res; - Comparison_result res1, res2; + Comparison_result l_res, r_res; + Comparison_result res1, res2; if (!xcv1_to_right && !xcv2_to_right) { // Case 1: Both xcv1 and xcv2 are defined to the left of p. @@ -2265,12 +2255,11 @@ public: /*! \class * A traits-class adaptor that extends the basic traits-class interface. */ -template +template class Arr_traits_adaptor_2 : public Arr_traits_basic_adaptor_2 { public: - // Traits-class geometric types. typedef ArrangementTraits_ Base_traits_2; typedef Arr_traits_basic_adaptor_2 Base; @@ -2350,16 +2339,12 @@ public: //! Allow its functor obtaining function calling the private constructor. friend class Arr_traits_adaptor_2; - /*! - * Implementation of the operator() in case the Has_merge tag is true. - */ + /*! Implementation of the operator() in case the Has_merge tag is true. */ bool _are_mergeable_imp(const X_monotone_curve_2& xcv1, const X_monotone_curve_2& xcv2, Tag_true) const { return (m_base->are_mergeable_2_object()(xcv1, xcv2)); } - /*! - * Implementation of the operator() in case the Has_merge tag is false. - */ + /*! Implementation of the operator() in case the Has_merge tag is false. */ bool _are_mergeable_imp(const X_monotone_curve_2&, const X_monotone_curve_2&, Tag_false) const { @@ -2407,17 +2392,13 @@ public: //! Allow its functor obtaining function calling the private constructor. friend class Arr_traits_adaptor_2; - /*! - * Implementation of the operator() in case the HasMerge tag is true. - */ + /*! Implementation of the operator() in case the HasMerge tag is true. */ void _merge_imp(const X_monotone_curve_2& xcv1, const X_monotone_curve_2& xcv2, X_monotone_curve_2& c, Tag_true) const { return (m_base->merge_2_object()(xcv1, xcv2, c)); } - /*! - * Implementation of the operator() in case the HasMerge tag is false. - */ + /*! Implementation of the operator() in case the HasMerge tag is false. */ void _merge_imp(const X_monotone_curve_2&, const X_monotone_curve_2&, X_monotone_curve_2&, Tag_false) const { diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h index b40695a4abb..f8d9842b7f0 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h @@ -15,7 +15,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0+ -// +// // // Author(s): Eric Berberich @@ -56,26 +56,26 @@ namespace internal { //! struct to combine results in "or"-fashion template < class ArrSmallerImplementationTag, class ArrLargerImplementationTag > struct Or_traits { - + public: - + //! This instance's first template parameter typedef ArrSmallerImplementationTag Arr_smaller_implementation_tag; - + //! This instance's second template parameter typedef ArrLargerImplementationTag Arr_larger_implementation_tag; - - + + private: - + typedef boost::mpl::bool_< true > true_; typedef boost::mpl::bool_< false > false_; - - typedef boost::mpl::if_< + + typedef boost::mpl::if_< boost::is_same< Arr_smaller_implementation_tag, Arr_use_traits_tag >, true_, false_ > Smaller_traits; - typedef boost::mpl::if_< + typedef boost::mpl::if_< boost::is_same< Arr_larger_implementation_tag, Arr_use_traits_tag >, true_, false_ > Larger_traits; @@ -103,27 +103,27 @@ namespace Parameter_space_in_x_2 { struct Curve_end { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve_end< Arr_oblivious_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve_end< Arr_open_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Curve_end< Arr_closed_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Curve_end< Arr_contracted_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Curve_end< Arr_identified_side_tag > { typedef Arr_use_traits_tag type; @@ -135,27 +135,27 @@ namespace Parameter_space_in_x_2 { struct Curve { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_oblivious_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_open_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_closed_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Curve< Arr_contracted_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_identified_side_tag > { typedef Arr_use_dummy_tag type; @@ -172,27 +172,27 @@ namespace Parameter_space_in_x_2 { struct Point< Arr_oblivious_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Point< Arr_open_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Point< Arr_closed_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Point< Arr_contracted_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Point< Arr_identified_side_tag > { typedef Arr_use_dummy_tag type; }; - + } // namespace Parameter_space_in_x_2 @@ -204,27 +204,27 @@ namespace Is_on_y_identification_2 { struct Curve { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_oblivious_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_open_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_closed_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_contracted_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_identified_side_tag > { typedef Arr_use_traits_tag type; @@ -241,27 +241,27 @@ namespace Is_on_y_identification_2 { struct Point< Arr_oblivious_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Point< Arr_open_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Point< Arr_closed_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Point< Arr_contracted_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Point< Arr_identified_side_tag > { typedef Arr_use_traits_tag type; }; - + } // namespace Is_on_y_identification_2 @@ -277,59 +277,58 @@ namespace Compare_y_on_boundary_2 { struct Points< Arr_oblivious_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Points< Arr_open_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Points< Arr_closed_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Points< Arr_contracted_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Points< Arr_identified_side_tag > { typedef Arr_use_traits_tag type; }; - } // namespace Compare_y_on_boundary_2 namespace Compare_y_near_boundary_2 { -// Curve-ends + // Curve-ends template < class ArrSideTag > struct Curve_ends { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve_ends< Arr_oblivious_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve_ends< Arr_open_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Curve_ends< Arr_closed_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Curve_ends< Arr_contracted_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Curve_ends< Arr_identified_side_tag > { typedef Arr_use_traits_tag type; @@ -338,38 +337,37 @@ namespace Compare_y_near_boundary_2 { } // Compare_y_near_boundary_2 - template < class ArrLeftSideTag, class ArrRightSideTag > struct Arr_left_right_implementation_dispatch { public: - + //! This instance's first template parameter typedef ArrLeftSideTag Left_side_category; - + //! This instance's second template parameter typedef ArrRightSideTag Right_side_category; - + public: - + //! tag type for Parameter_space_in_x_2 (curve-end signature) typedef typename internal::Or_traits< - typename + typename internal::Parameter_space_in_x_2::Curve_end< Left_side_category >::type, - typename - internal::Parameter_space_in_x_2::Curve_end< Right_side_category >::type + typename + internal::Parameter_space_in_x_2::Curve_end< Right_side_category >::type >::type Parameter_space_in_x_2_curve_end_tag; //! tag type for Parameter_space_in_x_2 (curve signature) typedef typename internal::Or_traits< - typename + typename internal::Parameter_space_in_x_2::Curve< Left_side_category >::type, - typename - internal::Parameter_space_in_x_2::Curve< Right_side_category >::type + typename + internal::Parameter_space_in_x_2::Curve< Right_side_category >::type >::type Parameter_space_in_x_2_curve_tag; - + //! tag type for Parameter_space_in_x_2 (point signature) typedef typename internal::Or_traits< typename @@ -380,37 +378,37 @@ public: //! tag type for Is_on_y_identification_2 (curve signature) typedef typename internal::Or_traits< - typename + typename internal::Is_on_y_identification_2::Curve< Left_side_category >::type, - typename - internal::Is_on_y_identification_2::Curve< Right_side_category >::type + typename + internal::Is_on_y_identification_2::Curve< Right_side_category >::type >::type Is_on_y_identification_2_curve_tag; //! tag type for Is_on_y_identification_2 (point signature) typedef typename internal::Or_traits< - typename + typename internal::Is_on_y_identification_2::Point< Left_side_category >::type, - typename - internal::Is_on_y_identification_2::Point< Right_side_category >::type + typename + internal::Is_on_y_identification_2::Point< Right_side_category >::type >::type Is_on_y_identification_2_point_tag; //! tag type for Compare_y_on_boundary_2 (points signature) typedef typename internal::Or_traits< - typename + typename internal::Compare_y_on_boundary_2::Points< Left_side_category >::type, - typename - internal::Compare_y_on_boundary_2::Points< Right_side_category >::type + typename + internal::Compare_y_on_boundary_2::Points< Right_side_category >::type >::type Compare_y_on_boundary_2_points_tag; //! tag type for Compare_y_near_boundary_2 (curve-ends signature) typedef typename internal::Or_traits< - typename + typename internal::Compare_y_near_boundary_2::Curve_ends< Left_side_category >::type, - typename - internal::Compare_y_near_boundary_2::Curve_ends< Right_side_category >::type + typename + internal::Compare_y_near_boundary_2::Curve_ends< Right_side_category >::type >::type Compare_y_near_boundary_2_curve_ends_tag; @@ -429,27 +427,27 @@ namespace Parameter_space_in_y_2 { struct Curve_end { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve_end< Arr_oblivious_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve_end< Arr_open_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Curve_end< Arr_closed_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Curve_end< Arr_contracted_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Curve_end< Arr_identified_side_tag > { typedef Arr_use_traits_tag type; @@ -461,27 +459,27 @@ namespace Parameter_space_in_y_2 { struct Curve { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_oblivious_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_open_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_closed_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Curve< Arr_contracted_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_identified_side_tag > { typedef Arr_use_dummy_tag type; @@ -498,27 +496,27 @@ namespace Parameter_space_in_y_2 { struct Point< Arr_oblivious_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Point< Arr_open_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Point< Arr_closed_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Point< Arr_contracted_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Point< Arr_identified_side_tag > { typedef Arr_use_dummy_tag type; }; - + } // namespace Parameter_space_in_y_2 @@ -530,27 +528,27 @@ namespace Is_on_x_identification_2 { struct Curve { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_oblivious_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_open_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_closed_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_contracted_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve< Arr_identified_side_tag > { typedef Arr_use_traits_tag type; @@ -567,135 +565,29 @@ namespace Is_on_x_identification_2 { struct Point< Arr_oblivious_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Point< Arr_open_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Point< Arr_closed_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Point< Arr_contracted_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Point< Arr_identified_side_tag > { typedef Arr_use_traits_tag type; }; - + } // namespace Is_on_x_identification_2 - -namespace Compare_x_at_limit_2 { - - // Point_curve-end - - template < class ArrSideTag > - struct Point_curve_end { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point_curve_end< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point_curve_end< Arr_open_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Point_curve_end< Arr_closed_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point_curve_end< Arr_contracted_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point_curve_end< Arr_identified_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - // Curve-ends - - template < class ArrSideTag > - struct Curve_ends { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve_ends< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve_ends< Arr_open_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Curve_ends< Arr_closed_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve_ends< Arr_contracted_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve_ends< Arr_identified_side_tag > { - typedef Arr_use_dummy_tag type; - }; - -} // Compare_x_at_limit_2 - -namespace Compare_x_near_limit_2 { - - // Curve-ends - - template < class ArrSideTag > - struct Curve_ends { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve_ends< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve_ends< Arr_open_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Curve_ends< Arr_closed_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve_ends< Arr_contracted_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve_ends< Arr_identified_side_tag > { - typedef Arr_use_dummy_tag type; - }; - -} // Compare_x_near_limit_2 - - namespace Compare_x_on_boundary_2 { // Points @@ -708,22 +600,22 @@ namespace Compare_x_on_boundary_2 { struct Points< Arr_oblivious_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Points< Arr_open_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Points< Arr_closed_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Points< Arr_contracted_side_tag > { - typedef Arr_use_dummy_tag type; + typedef Arr_use_traits_tag type; }; - + template <> struct Points< Arr_identified_side_tag > { typedef Arr_use_traits_tag type; @@ -735,27 +627,27 @@ namespace Compare_x_on_boundary_2 { struct Point_curve_end { typedef Arr_use_dummy_tag type; }; - + template <> struct Point_curve_end< Arr_oblivious_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Point_curve_end< Arr_open_side_tag > { - typedef Arr_use_dummy_tag type; + typedef Arr_use_traits_tag type; }; - + template <> struct Point_curve_end< Arr_closed_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Point_curve_end< Arr_contracted_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Point_curve_end< Arr_identified_side_tag > { typedef Arr_use_dummy_tag type; @@ -767,7 +659,7 @@ namespace Compare_x_on_boundary_2 { struct Curve_ends { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve_ends< Arr_oblivious_side_tag > { typedef Arr_use_dummy_tag type; @@ -775,24 +667,24 @@ namespace Compare_x_on_boundary_2 { template <> struct Curve_ends< Arr_open_side_tag > { - typedef Arr_use_dummy_tag type; + typedef Arr_use_traits_tag type; }; - + template <> struct Curve_ends< Arr_closed_side_tag > { - typedef Arr_use_dummy_tag type; + typedef Arr_use_traits_tag type; }; - + template <> struct Curve_ends< Arr_contracted_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Curve_ends< Arr_identified_side_tag > { typedef Arr_use_dummy_tag type; }; - + } // namespace Compare_x_on_boundary_2 @@ -804,27 +696,27 @@ namespace Compare_x_near_boundary_2 { struct Curve_ends { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve_ends< Arr_oblivious_side_tag > { typedef Arr_use_dummy_tag type; }; - + template <> struct Curve_ends< Arr_open_side_tag > { - typedef Arr_use_dummy_tag type; + typedef Arr_use_traits_tag type; }; - + template <> struct Curve_ends< Arr_closed_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Curve_ends< Arr_contracted_side_tag > { typedef Arr_use_traits_tag type; }; - + template <> struct Curve_ends< Arr_identified_side_tag > { typedef Arr_use_traits_tag type; @@ -838,33 +730,33 @@ template < class ArrBottomSideTag, class ArrTopSideTag > struct Arr_bottom_top_implementation_dispatch { public: - + //! This instance's first template parameter typedef ArrBottomSideTag Bottom_side_category; - + //! This instance's second template parameter typedef ArrTopSideTag Top_side_category; - + public: //! tag type for Parameter_space_in_y_2 (curve-end signature) typedef typename internal::Or_traits< - typename + typename internal::Parameter_space_in_y_2::Curve_end< Bottom_side_category >::type, - typename - internal::Parameter_space_in_y_2::Curve_end< Top_side_category >::type + typename + internal::Parameter_space_in_y_2::Curve_end< Top_side_category >::type >::type Parameter_space_in_y_2_curve_end_tag; //! tag type for Parameter_space_in_y_2 (curve signature) typedef typename internal::Or_traits< - typename + typename internal::Parameter_space_in_y_2::Curve< Bottom_side_category >::type, - typename - internal::Parameter_space_in_y_2::Curve< Top_side_category >::type + typename + internal::Parameter_space_in_y_2::Curve< Top_side_category >::type >::type Parameter_space_in_y_2_curve_tag; - + //! tag type for Parameter_space_in_y_2 (point signature) typedef typename internal::Or_traits< typename @@ -872,87 +764,58 @@ public: typename internal::Parameter_space_in_y_2::Point< Top_side_category >::type >::type Parameter_space_in_y_2_point_tag; - + //! tag type for Is_on_x_identification_2 (curve signature) typedef typename internal::Or_traits< - typename + typename internal::Is_on_x_identification_2::Curve< Bottom_side_category >::type, - typename - internal::Is_on_x_identification_2::Curve< Top_side_category >::type + typename + internal::Is_on_x_identification_2::Curve< Top_side_category >::type >::type Is_on_x_identification_2_curve_tag; //! tag type for Is_on_x_identification_2 (point signature) typedef typename internal::Or_traits< - typename + typename internal::Is_on_x_identification_2::Point< Bottom_side_category >::type, - typename - internal::Is_on_x_identification_2::Point< Top_side_category >::type + typename + internal::Is_on_x_identification_2::Point< Top_side_category >::type >::type Is_on_x_identification_2_point_tag; - //! tag type for Compare_x_at_limit_2 (point-curve-end signature) - typedef typename internal::Or_traits< - typename - internal::Compare_x_at_limit_2::Point_curve_end< Bottom_side_category > - ::type, - typename - internal::Compare_x_at_limit_2::Point_curve_end< Top_side_category >::type - >::type - Compare_x_at_limit_2_point_curve_end_tag; - - //! tag type for Compare_x_at_limit_2 (curve-ends signature) - typedef typename internal::Or_traits< - typename - internal::Compare_x_at_limit_2::Curve_ends< Bottom_side_category >::type, - typename - internal::Compare_x_at_limit_2::Curve_ends< Top_side_category >::type - >::type - Compare_x_at_limit_2_curve_ends_tag; - - //! tag type for Compare_x_near_limit_boundary_2 (curve-ends signature) - typedef typename internal::Or_traits< - typename - internal::Compare_x_near_limit_2::Curve_ends< Bottom_side_category > - ::type, - typename - internal::Compare_x_near_limit_2::Curve_ends< Top_side_category >::type - >::type - Compare_x_near_limit_2_curve_ends_tag; - //! tag type for Compare_x_on_boundary_2 (points signature) typedef typename internal::Or_traits< - typename + typename internal::Compare_x_on_boundary_2::Points< Bottom_side_category >::type, - typename - internal::Compare_x_on_boundary_2::Points< Top_side_category >::type + typename + internal::Compare_x_on_boundary_2::Points< Top_side_category >::type >::type Compare_x_on_boundary_2_points_tag; //! tag type for Compare_x_on_boundary_2 (point_curve-end signature) typedef typename internal::Or_traits< - typename + typename internal::Compare_x_on_boundary_2::Point_curve_end< Bottom_side_category >::type, - typename - internal::Compare_x_on_boundary_2::Point_curve_end< Top_side_category >::type + typename + internal::Compare_x_on_boundary_2::Point_curve_end< Top_side_category >::type >::type Compare_x_on_boundary_2_point_curve_end_tag; //! tag type for Compare_x_on_boundary_2 (curve-ends signature) typedef typename internal::Or_traits< - typename + typename internal::Compare_x_on_boundary_2::Curve_ends< Bottom_side_category >::type, - typename - internal::Compare_x_on_boundary_2::Curve_ends< Top_side_category >::type + typename + internal::Compare_x_on_boundary_2::Curve_ends< Top_side_category >::type >::type Compare_x_on_boundary_2_curve_ends_tag; - + //! tag type for Compare_x_near_boundary_2 (curve-ends signature) typedef typename internal::Or_traits< - typename + typename internal::Compare_x_near_boundary_2::Curve_ends< Bottom_side_category >::type, - typename - internal::Compare_x_near_boundary_2::Curve_ends< Top_side_category >::type + typename + internal::Compare_x_near_boundary_2::Curve_ends< Top_side_category >::type >::type Compare_x_near_boundary_2_curve_ends_tag; 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 c624e260824..92d8343f57f 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 @@ -30,12 +30,12 @@ * Global insertion functions for the Arrangement_2 class. */ +#include #include #include #include #include -#include #include #include #include @@ -195,7 +195,7 @@ void insert(Arrangement_on_surface_2& arr, typedef GeometryTraits_2 Gt2; typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; typedef typename boost::is_same::type - Is_x_monotone; + Is_x_monotone; insert(arr, c, pl, visitor, Is_x_monotone()); } @@ -801,7 +801,7 @@ insert_non_intersecting_curve "The curve intersects the interior of existing edges."); if ((fh1 != NULL) && (fh2 != NULL) && (*fh1 == *fh2)) { - new_he = arr.insert_in_face_interior(c, arr.non_const_handle (*fh1)); + new_he = arr.insert_in_face_interior(c, arr.non_const_handle(*fh1)); } } } @@ -1094,7 +1094,7 @@ remove_edge(Arrangement_on_surface_2& arr, (v_ends[1]->is_at_open_boundary() || (v_ends[1]->degree() == 1)); // Remove the edge from the arrangement. - typename Arr::Face_handle face = arr.remove_edge (e); + typename Arr::Face_handle face = arr.remove_edge(e); // Examine the end-vertices: If a vertex has now two incident edges, and the // curves associated with these edges can be merged, merge the two edges and @@ -1167,7 +1167,7 @@ insert_point(Arrangement_on_surface_2& arr, if ((fh = object_cast(&obj)) != NULL) { // p lies inside a face: Insert it as an isolated vertex it the interior of // this face. - vh_for_p = arr.insert_in_face_interior(p, arr.non_const_handle (*fh)); + vh_for_p = arr.insert_in_face_interior(p, arr.non_const_handle(*fh)); } else if ((hh = object_cast(&obj)) != NULL) @@ -1175,12 +1175,12 @@ insert_point(Arrangement_on_surface_2& arr, // p lies in the interior of an edge: Split this edge to create a new // vertex associated with p. typename Gt2::X_monotone_curve_2 sub_cv1, sub_cv2; - typename Arr::Halfedge_handle split_he; arr.geometry_traits()->split_2_object()((*hh)->curve(), p, sub_cv1, sub_cv2); - split_he = arr.split_edge(arr.non_const_handle(*hh), sub_cv1, sub_cv2); + typename Arr::Halfedge_handle split_he = + arr.split_edge(arr.non_const_handle(*hh), sub_cv1, sub_cv2); // The new vertex is the target of the returned halfedge. vh_for_p = split_he->target(); @@ -1189,9 +1189,9 @@ insert_point(Arrangement_on_surface_2& arr, // In this case p lies on an existing vertex, so we just update this // vertex. vh = object_cast(&obj); - CGAL_assertion (vh != NULL); + CGAL_assertion(vh != NULL); - vh_for_p = arr.modify_vertex (arr.non_const_handle (*vh), p); + vh_for_p = arr.modify_vertex(arr.non_const_handle(*vh), p); } // Notify the arrangement observers that the global operation has been @@ -1246,7 +1246,7 @@ bool remove_vertex(Arrangement_on_surface_2& if (v->is_isolated()) { // In case v is an isolated vertex, simply remove it. - arr.remove_isolated_vertex (v); + arr.remove_isolated_vertex(v); removed = true; } else if (v->degree() == 2) { @@ -1316,7 +1316,7 @@ is_valid(const Arrangement_on_surface_2& arr) typedef Ss2::Surface_sweep_2 Surface_sweep_2; // First use the internal validity check. - if (!arr.is_valid()) return (false); + if (!arr.is_valid()) return false; // Perform a sweep over all subcurves associated with arrangement edges. std::vector curves_vec(arr.number_of_edges()); @@ -1361,8 +1361,7 @@ is_valid(const Arrangement_on_surface_2& arr) is_first = true; do { - if (ccb->face() != fit) - return (false); + if (ccb->face() != fit) return false; if (is_first || compare_xy (ccb->target()->point(), left_v->point()) == SMALLER) @@ -1375,16 +1374,16 @@ is_valid(const Arrangement_on_surface_2& arr) } while (ccb != *ic_it); - vf_list.push_back (std::make_pair (left_v, fh)); + vf_list.push_back (std::make_pair(left_v, fh)); } // Check all isolated vertices in the current face. for (iv_it = fh->isolated_vertices_begin(); iv_it != fh->isolated_vertices_end(); ++iv_it) { - if (iv_it->face() != fit) return (false); + if (iv_it->face() != fit) return false; - vf_list.push_back (std::make_pair (Vertex_const_handle(iv_it), fh)); + vf_list.push_back(std::make_pair(Vertex_const_handle(iv_it), fh)); } } @@ -1450,7 +1449,7 @@ is_valid(const Arrangement_on_surface_2& arr) he_left = he_left->next()->twin(); he_left = he_left->twin()->prev(); - CGAL_assertion (he_left->direction() == ARR_LEFT_TO_RIGHT); + CGAL_assertion(he_left->direction() == ARR_LEFT_TO_RIGHT); in_face = he_left->face(); } else if (he_left != invalid_he) { @@ -1469,14 +1468,12 @@ is_valid(const Arrangement_on_surface_2& arr) else { Comparison_result res; Halfedge_const_handle he_curr = he_right; - - do // as long as we have he_right halfedge which is below - { + do { + // as long as we have he_right halfedge which is below he_right = he_curr; he_curr = he_right->next()->twin(); - res = comp_y_at_x_right (he_curr->curve(), - he_right->curve(), - v_below->point()); + res = comp_y_at_x_right(he_curr->curve(), he_right->curve(), + v_below->point()); } while(res == SMALLER); in_face = he_right->face(); } @@ -1485,14 +1482,13 @@ is_valid(const Arrangement_on_surface_2& arr) else { // Hit nothing (an unbounded face is returned). assign_ok = CGAL::assign(in_face, obj); - - CGAL_assertion (assign_ok && in_face->is_unbounded()); + CGAL_assertion(assign_ok && in_face->is_unbounded()); if (! assign_ok) return false; } if (vf_iter->second != in_face) { - CGAL_warning_msg (false, + CGAL_warning_msg(false, "An inner component is located in the wrong face."); return false; } @@ -1507,7 +1503,7 @@ is_valid(const Arrangement_on_surface_2& arr) // Meaning, it output the arrangment's vertices, edges and faces that the // x-monotone curve intersects. template + typename OutputIterator, typename PointLocation> OutputIterator zone(Arrangement_on_surface_2& arr, const typename GeometryTraits_2::X_monotone_curve_2& c, @@ -1636,8 +1632,7 @@ do_intersect(Arrangement_on_surface_2& arr, x_curve = object_cast(&(*obj_iter)); if (x_curve != NULL) { // Check if the x-monotone subcurve intersects the arrangement. - if (do_intersect(arr, *x_curve, pl) == true) - return true; + if (do_intersect(arr, *x_curve, pl) == true) return true; } else { iso_p = object_cast(&(*obj_iter)); @@ -1645,7 +1640,7 @@ do_intersect(Arrangement_on_surface_2& arr, // Check whether the isolated point lies inside a face (otherwise, // it conincides with a vertex or an edge). - CGAL::Object obj = pl.locate (*iso_p); + CGAL::Object obj = pl.locate(*iso_p); return (object_cast(&obj) != NULL); } diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h index 3378c6a183d..c260623a3b3 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h @@ -98,9 +98,7 @@ Arrangement_on_surface_2:: Arrangement_on_surface_2(const Self& arr) : m_geom_traits(NULL), m_own_traits(false) -{ - assign(arr); -} +{ assign(arr); } //----------------------------------------------------------------------------- // Constructor given a traits object. @@ -175,16 +173,13 @@ void Arrangement_on_surface_2::assign(const Self& arr) m_topol_traits.assign(arr.m_topol_traits); // Go over the vertices and create duplicates of the stored points. - Point_2* dup_p; - DVertex* p_v; - typename Dcel::Vertex_iterator vit; for (vit = _dcel().vertices_begin(); vit != _dcel().vertices_end(); ++vit) { - p_v = &(*vit); + DVertex* p_v = &(*vit); if (! p_v->has_null_point()) { // Create the duplicate point and store it in the points container. - dup_p = _new_point(p_v->point()); + Point_2* dup_p = _new_point(p_v->point()); // Associate the vertex with the duplicated point. p_v->set_point(dup_p); @@ -298,15 +293,29 @@ insert_in_face_interior(const Point_2& p, Face_handle f) std::cout << "face : " << &(*f) << std::endl; #endif + // Obtain the boundary conditions: + const Arr_parameter_space ps_x = + m_geom_traits->parameter_space_in_x_2_object()(p); + const Arr_parameter_space ps_y = + m_geom_traits->parameter_space_in_y_2_object()(p); + // Create a new vertex associated with the given point. - // We assume the point has no boundary conditions. - DVertex* v = _create_vertex(p); - Vertex_handle vh(v); + // The point is either the interior of the parameter space or on the boundary. + DVertex* v(NULL); + if ((ps_x == ARR_INTERIOR) && (ps_y == ARR_INTERIOR)) + v = _create_vertex(p); + else { + v = _create_boundary_vertex(p, ps_x, ps_y); + + // Notify the topology traits on the creation of the boundary vertex. + m_topol_traits.notify_on_boundary_vertex_creation(v, p, ps_x, ps_y); + } // Insert v as an isolated vertex inside the given face. _insert_isolated_vertex(p_f, v); // Return a handle to the new isolated vertex. + Vertex_handle vh(v); return vh; } @@ -986,9 +995,9 @@ insert_at_vertices(const X_monotone_curve_2& cv, "One of the input vertices should be the left curve end."); } else { - Arr_parameter_space ps_x1 = + Arr_parameter_space ps_x1 = m_geom_traits->parameter_space_in_x_2_object()(cv, ARR_MIN_END); - Arr_parameter_space ps_y1 = + Arr_parameter_space ps_y1 = m_geom_traits->parameter_space_in_y_2_object()(cv, ARR_MIN_END); // Check which vertex should be associated with the minimal curve-end @@ -1302,8 +1311,7 @@ template typename Arrangement_on_surface_2::Halfedge_handle Arrangement_on_surface_2:: insert_at_vertices(const X_monotone_curve_2& cv, - Halfedge_handle prev1, - Halfedge_handle prev2) + Halfedge_handle prev1, Halfedge_handle prev2) { #if CGAL_ARRANGEMENT_ON_SURFACE_INSERT_VERBOSE std::cout << "Aos_2: insert_at_vertices (interface)" << std::endl; @@ -1329,7 +1337,7 @@ insert_at_vertices(const X_monotone_curve_2& cv, Comparison_result res; if (! at_obnd1) { - CGAL_precondition_code(Vertex_handle v_right); + CGAL_precondition_code(Vertex_handle v_right); if (! prev1->target()->is_at_open_boundary() && m_geom_traits->equal_2_object() @@ -1542,91 +1550,58 @@ split_edge(Halfedge_handle e, { CGAL_precondition_msg(! e->is_fictitious(), "The edge must be a valid one."); - // Get the split halfedge and its twin, its source and target. + // Find the point where we split the halfedge, and determine which curve + // should be associated with which pair of split halfedges. DHalfedge* he1 = _halfedge(e); DHalfedge* he2 = he1->opposite(); DVertex* source = he2->vertex(); - CGAL_precondition_code(DVertex* target = he1->vertex()); - // Determine the point where we split the halfedge. We also determine which - // curve should be associated with he1 (and he2), which is the curve who - // has an endpoint that equals e's source, and which should be associated - // with the new pair of halfedges we are about to split (the one who has - // an endpoint which equals e's target). - if ((m_geom_traits->parameter_space_in_x_2_object()(cv1, ARR_MAX_END) == - ARR_INTERIOR) && - (m_geom_traits->parameter_space_in_y_2_object()(cv1, ARR_MAX_END) == - ARR_INTERIOR)) - { - const Point_2 & cv1_right = - m_geom_traits->construct_max_vertex_2_object()(cv1); + /* The halfedge we return and e must have a common source vertex. + * There are 4 cases: + */ - if ((m_geom_traits->parameter_space_in_x_2_object()(cv2, ARR_MIN_END) == - ARR_INTERIOR) && - (m_geom_traits->parameter_space_in_y_2_object()(cv2, ARR_MIN_END) == - ARR_INTERIOR) && - m_geom_traits->equal_2_object()(m_geom_traits-> - construct_min_vertex_2_object()(cv2), - cv1_right)) - { - // cv1's right endpoint and cv2's left endpoint are equal, so this should - // be the split point. Now we check whether cv1 is incident to e's source - // and cv2 to its target, or vice versa. - if (_are_equal(source, cv1, ARR_MIN_END)) { - CGAL_precondition_msg - (_are_equal(target, cv2, ARR_MAX_END), - "The subcurve endpoints must match e's end vertices."); - - return (Halfedge_handle(_split_edge(he1, cv1_right, cv1, cv2))); - } - - CGAL_precondition_msg - (_are_equal(source, cv2, ARR_MAX_END) && - _are_equal(target, cv1, ARR_MIN_END), - "The subcurve endpoints must match e's end vertices."); - - return (Halfedge_handle(_split_edge(he1, cv1_right, cv2, cv1))); - } + // 1. o---cv1---o---cv2---o + // o---------e-------->o + if (_are_equal(source, cv1, ARR_MIN_END)) { + const Point_2& p = m_geom_traits->construct_max_vertex_2_object()(cv1); + CGAL_postcondition_code + (const Point_2& q = m_geom_traits->construct_min_vertex_2_object()(cv2)); + CGAL_precondition(m_geom_traits->equal_2_object()(p, q)); + CGAL_precondition(_are_equal(he1->vertex(), cv2, ARR_MAX_END)); + return (Halfedge_handle(_split_edge(he1, p, cv1, cv2))); } - if ((m_geom_traits->parameter_space_in_x_2_object()(cv1, ARR_MIN_END) == - ARR_INTERIOR) && - (m_geom_traits->parameter_space_in_y_2_object()(cv1, ARR_MIN_END) == - ARR_INTERIOR)) - { - const Point_2 & cv1_left = - m_geom_traits->construct_min_vertex_2_object()(cv1); - - if ((m_geom_traits->parameter_space_in_x_2_object()(cv2, ARR_MAX_END) == - ARR_INTERIOR) && - (m_geom_traits->parameter_space_in_y_2_object()(cv2, ARR_MAX_END) == - ARR_INTERIOR) && - m_geom_traits->equal_2_object()(m_geom_traits-> - construct_max_vertex_2_object()(cv2), - cv1_left)) - { - // cv1's left endpoint and cv2's right endpoint are equal, so this should - // be the split point. Now we check whether cv1 is incident to e's source - // and cv2 to its target, or vice versa. - if (_are_equal(source, cv2, ARR_MIN_END)) { - CGAL_precondition_msg - (_are_equal(target, cv1, ARR_MAX_END), - "The subcurve endpoints must match e's end vertices."); - - return (Halfedge_handle(_split_edge(he1, cv1_left, cv2, cv1))); - } - - CGAL_precondition_msg - (_are_equal(source, cv1, ARR_MAX_END) && - _are_equal(target, cv2, ARR_MIN_END), - "The subcurve endpoints must match e's end vertices."); - - return (Halfedge_handle(_split_edge(he1, cv1_left, cv1, cv2))); - } + // 2. o---cv2---o---cv1---o + // o<--------e---------o + if (_are_equal(source, cv1, ARR_MAX_END)) { + const Point_2& p = m_geom_traits->construct_min_vertex_2_object()(cv1); + CGAL_postcondition_code + (const Point_2& q = m_geom_traits->construct_max_vertex_2_object()(cv2)); + CGAL_precondition(m_geom_traits->equal_2_object()(p, q)); + CGAL_precondition(_are_equal(he1->vertex(), cv2, ARR_MIN_END)); + return (Halfedge_handle(_split_edge(he1, p, cv1, cv2))); } - CGAL_error_msg("The two subcurves must have a common endpoint."); - return Halfedge_handle(); + // 3. o---cv2---o---cv1---o + // o---------e-------->o + if (_are_equal(source, cv2, ARR_MIN_END)) { + const Point_2& p = m_geom_traits->construct_max_vertex_2_object()(cv2); + CGAL_postcondition_code + (const Point_2& q = m_geom_traits->construct_min_vertex_2_object()(cv1)); + CGAL_precondition(m_geom_traits->equal_2_object()(p, q)); + CGAL_precondition(_are_equal(he1->vertex(), cv1, ARR_MAX_END)); + return (Halfedge_handle(_split_edge(he1, p, cv2, cv1))); + } + + // 4. o---cv1---o---cv2---o + // o<--------e---------o + CGAL_precondition(_are_equal(source, cv2, ARR_MAX_END)); + const Point_2& p = m_geom_traits->construct_min_vertex_2_object()(cv2); + CGAL_postcondition_code + (const Point_2& q = m_geom_traits->construct_max_vertex_2_object()(cv1)); + CGAL_precondition(m_geom_traits->equal_2_object()(p, q)); + CGAL_precondition(_are_equal(he1->vertex(), cv1, ARR_MIN_END)); + return (Halfedge_handle(_split_edge(he1, p, cv2, cv1))); } //----------------------------------------------------------------------------- @@ -2150,6 +2125,30 @@ _create_vertex(const Point_2& p) return v; } +// Create a new vertex on boundary +// +template +typename Arrangement_on_surface_2::DVertex* +Arrangement_on_surface_2:: +_create_boundary_vertex(const Point_2& p, + Arr_parameter_space ps_x, Arr_parameter_space ps_y) +{ + CGAL_precondition((ps_x != ARR_INTERIOR) || (ps_y != ARR_INTERIOR)); + + // Notify the observers that we are about to create a new boundary vertex. + _notify_before_create_boundary_vertex(p, ps_x, ps_y); + + // Create a new vertex and set its boundary conditions. + DVertex* v = _dcel().new_vertex(); + v->set_boundary(ps_x, ps_y); + v->set_point(_new_point(p)); + + // Notify the observers that we have just created a new boundary vertex. + _notify_after_create_boundary_vertex(Vertex_handle(v)); + + return v; +} + //----------------------------------------------------------------------------- // Create a new vertex on boundary // @@ -2184,12 +2183,58 @@ _create_boundary_vertex(const X_monotone_curve_2& cv, Arr_curve_end ind, } // Notify the observers that we have just created a new boundary vertex. - Vertex_handle vh(v); - _notify_after_create_boundary_vertex(vh); + _notify_after_create_boundary_vertex(Vertex_handle(v)); return v; } +//----------------------------------------------------------------------------- +// Locate the DCEL features that will be used for inserting the given point, +// which has a boundary condition, and set a proper vertex there. +// +template +typename Arrangement_on_surface_2::DVertex* +Arrangement_on_surface_2:: +_place_and_set_point(DFace* f, const Point_2& p, + Arr_parameter_space ps_x, Arr_parameter_space ps_y) +{ + // Use the topology traits to locate the DCEL feature that contains the + // given point. + CGAL::Object obj = m_topol_traits.place_boundary_vertex(f, p, ps_x, ps_y); + DVertex* v; + + // Act according to the result type. + DHalfedge* fict_he; + if (CGAL::assign(fict_he, obj)) { + // The point is located on a fictitious edge. + // Create a new vertex that corresponds to the point. + v = _create_boundary_vertex(p, ps_x, ps_y); + + // Split the fictitious halfedge at the newly created vertex. + // The returned halfedge is the predecessor for the insertion of the curve + // end around v. + _notify_before_split_fictitious_edge(Halfedge_handle(fict_he), + Vertex_handle(v)); + DHalfedge* p_pred = m_topol_traits.split_fictitious_edge(fict_he, v); + _notify_after_split_fictitious_edge(Halfedge_handle(p_pred), + Halfedge_handle((*p_pred)->next())); + } + else if (obj.is_empty()) { + // Create a new vertex that reprsents the given point. + v = _create_boundary_vertex(p, ps_x, ps_y); + + // Notify the topology traits on the creation of the boundary vertex. + m_topol_traits.notify_on_boundary_vertex_creation(v, p, ps_x, ps_y); + } + else { + CGAL_assertion(CGAL::assign(v, obj)); + // The vertex coincides with an existing vertex that represents the point. + // Do nothing. + } + + return v; // return the vertex that represents the point. +} + //----------------------------------------------------------------------------- // Locate the DCEL features that will be used for inserting the given curve // end, which has a boundary condition, and set the proper vertex there. @@ -3194,6 +3239,9 @@ template void Arrangement_on_surface_2:: _relocate_isolated_vertices_in_new_face(DHalfedge* new_he) { +#if CGAL_ARRANGEMENT_ON_SURFACE_INSERT_VERBOSE + std::cout << "Aos_2: _relocate_isolated_vertices_in_new_face" << std::endl; +#endif // The given halfedge points to the new face, while its twin points to the // old face (the one that has just been split). DFace* new_face = (new_he->is_on_inner_ccb()) ? @@ -3237,6 +3285,11 @@ template void Arrangement_on_surface_2:: _relocate_in_new_face(DHalfedge* new_he) { +#if CGAL_ARRANGEMENT_ON_SURFACE_INSERT_VERBOSE + std::cout << "Aos_2 _relocate_in_new_face" << std::endl; + std::cout << "HeCv: " << new_he->curve() << std::endl; + std::cout << "HeDi: " << new_he->direction() << std::endl; +#endif _relocate_inner_ccbs_in_new_face(new_he); _relocate_isolated_vertices_in_new_face(new_he); } @@ -3317,8 +3370,20 @@ _split_edge(DHalfedge* e, const Point_2& p, const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2) { // Allocate a new vertex and associate it with the split point. - // Note that this point must not have any boundary conditions. - DVertex* v = _create_vertex(p); + // Obtain the boundary conditions: + const Arr_parameter_space ps_x = + m_geom_traits->parameter_space_in_x_2_object()(p); + const Arr_parameter_space ps_y = + m_geom_traits->parameter_space_in_y_2_object()(p); + + DVertex* v(NULL); + if ((ps_x == ARR_INTERIOR) && (ps_y == ARR_INTERIOR)) v = _create_vertex(p); + else { + v = _create_boundary_vertex(p, ps_x, ps_y); + + // Notify the topology traits on the creation of the boundary vertex. + m_topol_traits.notify_on_boundary_vertex_creation(v, p, ps_x, ps_y); + } // Split the edge from the given vertex. return (_split_edge(e, v, cv1, cv2)); @@ -4011,6 +4076,7 @@ _defines_outer_ccb_of_new_face(const DHalfedge* he_to, InputIterator lm_begin, InputIterator lm_end) const { + // std::cout << "_defines_outer_ccb_of_new_face" << std::endl; // Search for the leftmost vertex among the local minima typename Traits_adaptor_2::Parameter_space_in_x_2 parameter_space_in_x = m_geom_traits->parameter_space_in_x_2_object(); @@ -4134,7 +4200,7 @@ _is_above(const X_monotone_curve_2& xcv1, const X_monotone_curve_2& xcv2, // Both current and next curves are incident to the identification curve. // As v_min is the leftmost vertex, we know that their left ends must have // a boundary condition of type identification in y. - Arr_parameter_space ps_y2 = + Arr_parameter_space ps_y2 = m_geom_traits->parameter_space_in_y_2_object()(xcv2, ARR_MIN_END); // Check if the curves lie on opposite sides of the identification curve. @@ -4175,9 +4241,19 @@ _is_above(const X_monotone_curve_2& xcv1, const X_monotone_curve_2& xcv2, { // Compare the horizontal position of the two curve-ends at the point // of contraction. - Comparison_result x_res = - m_geom_traits->compare_x_curve_ends_2_object()(xcv1, ARR_MIN_END, - xcv2, ARR_MIN_END); + typename Traits_adaptor_2::Compare_x_curve_ends_2 cmp_x_curve_ends = + m_geom_traits->compare_x_curve_ends_2_object(); + typename Traits_adaptor_2::Parameter_space_in_x_2 ps_x_op = + m_geom_traits->parameter_space_in_x_2_object(); + + Arr_parameter_space ps_x1 = ps_x_op(xcv1, ARR_MIN_END); + Arr_parameter_space ps_x2 = ps_x_op(xcv2, ARR_MIN_END); + Comparison_result x_res = (ps_x1 != ps_x2) ? + ((ps_x1 == ARR_LEFT_BOUNDARY) ? SMALLER : + ((ps_x1 == ARR_RIGHT_BOUNDARY) ? LARGER : + ((ps_x2 == ARR_LEFT_BOUNDARY) ? LARGER : SMALLER))) : + ((ps_x1 != ARR_INTERIOR) ? EQUAL : + cmp_x_curve_ends(xcv1, ARR_MIN_END, xcv2, ARR_MIN_END)); // Observe that if x_res == EQUAL the given subsequence is always exterior. return (((ps_y1 == ARR_BOTTOM_BOUNDARY) && (x_res == SMALLER)) || diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h index 61dabb00b1f..9bf1442cd30 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h @@ -15,7 +15,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0+ -// +// // // Author(s) : Ron Wein // Efi Fogel @@ -37,256 +37,224 @@ namespace CGAL { // Initialize the zone-computation process with a given curve and an object // that wraps the location of the curve's left end. // -template -void Arrangement_zone_2:: -init_with_hint(const X_monotone_curve_2& _cv, const Object& _obj) +template +void Arrangement_zone_2:: +init_with_hint(const X_monotone_curve_2& cv, const Object& obj) { // Set the curve and check whether its ends are bounded, therefore // associated with valid endpoints. - cv = _cv; - - if (m_geom_traits->is_closed_2_object()(cv, ARR_MIN_END)) - { - // The left endpoint is valid. - const Arr_parameter_space ps_x1 = - m_geom_traits->parameter_space_in_x_2_object()(cv, ARR_MIN_END); - const Arr_parameter_space ps_y1 = - m_geom_traits->parameter_space_in_y_2_object()(cv, ARR_MIN_END); - has_left_pt = true; - left_on_boundary = (ps_x1 != ARR_INTERIOR || ps_y1 != ARR_INTERIOR); - left_pt = m_geom_traits->construct_min_vertex_2_object() (cv); - } - else - { - // The left end of the curve lies on open boundary. - has_left_pt = false; - left_on_boundary = true; - } - - if (m_geom_traits->is_closed_2_object()(cv, ARR_MAX_END)) - { - // The right endpoint is valid. - const Arr_parameter_space ps_x2 = - m_geom_traits->parameter_space_in_x_2_object()(cv, ARR_MAX_END); - const Arr_parameter_space ps_y2 = - m_geom_traits->parameter_space_in_y_2_object()(cv, ARR_MAX_END); - has_right_pt = true; - right_on_boundary = (ps_x2 != ARR_INTERIOR || ps_y2 != ARR_INTERIOR); - right_pt = m_geom_traits->construct_max_vertex_2_object() (cv); - } - else - { - // The right end of the curve lies on open boundary. - has_right_pt = false; - right_on_boundary = true; - } - - // Set the object that represents the location of the left end of the curve - // in the arrangement. - obj = _obj; + m_cv = cv; + typename Traits_adaptor_2::Parameter_space_in_x_2 ps_x_op = + m_geom_traits->parameter_space_in_x_2_object(); + typename Traits_adaptor_2::Parameter_space_in_y_2 ps_y_op = + m_geom_traits->parameter_space_in_y_2_object(); - return; + if (m_geom_traits->is_closed_2_object()(m_cv, ARR_MIN_END)) { + // The left endpoint is valid. + const Arr_parameter_space ps_x1 = ps_x_op(m_cv, ARR_MIN_END); + const Arr_parameter_space ps_y1 = ps_y_op(m_cv, ARR_MIN_END); + m_has_left_pt = true; + m_left_on_boundary = ((ps_x1 != ARR_INTERIOR) || (ps_y1 != ARR_INTERIOR)); + m_left_pt = m_geom_traits->construct_min_vertex_2_object()(m_cv); + } + else { + // The left end of the curve lies on open boundary. + m_has_left_pt = false; + m_left_on_boundary = true; + } + + if (m_geom_traits->is_closed_2_object()(m_cv, ARR_MAX_END)) { + // The right endpoint is valid. + const Arr_parameter_space ps_x2 = ps_x_op(m_cv, ARR_MAX_END); + const Arr_parameter_space ps_y2 = ps_y_op(m_cv, ARR_MAX_END); + m_has_right_pt = true; + m_right_on_boundary = (ps_x2 != ARR_INTERIOR || ps_y2 != ARR_INTERIOR); + m_right_pt = m_geom_traits->construct_max_vertex_2_object()(m_cv); + } + else { + // The right end of the curve lies on open boundary. + m_has_right_pt = false; + m_right_on_boundary = true; + } + + // Set the object that represents the location of the left end of the curve + // in the arrangement. + m_obj = obj; } //----------------------------------------------------------------------------- // Compute the zone of the given curve and issue the apporpriate // notifications for the visitor. // -template -void Arrangement_zone_2::compute_zone () +template +void Arrangement_zone_2::compute_zone() { // Initialize flags and set all handles to be invalid. - bool done = false; + bool done = false; - found_intersect = false; - found_overlap = false; - found_iso_vert = false; + m_found_intersect = false; + m_found_overlap = false; + m_found_iso_vert = false; - left_v = invalid_v; - left_he = invalid_he; - right_v = invalid_v; - right_he = invalid_he; + m_left_v = invalid_v; + m_left_he = invalid_he; + m_right_v = invalid_v; + m_right_he = invalid_he; // Locate the arrangement feature containing the left endpoint of the // curve (currently obj stores the object containing it). - const Vertex_const_handle *vh; - const Halfedge_const_handle *hh; - const Face_const_handle *fh; + const Vertex_const_handle* vh; + const Halfedge_const_handle* hh; + const Face_const_handle* fh; - if ((vh = object_cast(&obj)) != NULL) - { - CGAL_assertion (has_left_pt); + if ((vh = object_cast(&m_obj)) != NULL) { + CGAL_assertion(m_has_left_pt); // The left endpoint coincides with an existing vertex: - left_v = arr.non_const_handle (*vh); + m_left_v = m_arr.non_const_handle(*vh); - if (left_on_boundary) - { + if (m_left_on_boundary) { // Use the accessor to locate the predecessor edge, in case the left // endpoint has boundary conditions. - const Arr_parameter_space ps_x = - m_geom_traits->parameter_space_in_x_2_object()(cv, ARR_MIN_END); - const Arr_parameter_space ps_y = - m_geom_traits->parameter_space_in_y_2_object()(cv, ARR_MIN_END); + const Arr_parameter_space ps_x = + m_geom_traits->parameter_space_in_x_2_object()(m_cv, ARR_MIN_END); + const Arr_parameter_space ps_y = + m_geom_traits->parameter_space_in_y_2_object()(m_cv, ARR_MIN_END); - left_he = arr_access.locate_around_boundary_vertex (left_v, - cv, ARR_MIN_END, - ps_x, ps_y); + m_left_he = + m_arr_access.locate_around_boundary_vertex(m_left_v, m_cv, ARR_MIN_END, + ps_x, ps_y); } } - else if ((hh = object_cast(&obj)) != NULL) - { - if (has_left_pt) - { + else if ((hh = object_cast(&m_obj)) != NULL) { + if (m_has_left_pt) { // Obtain the right halfedge from the halfedge-pair containing left_pt // in their interior. - left_he = _direct_intersecting_edge_to_right (cv, left_pt, - arr.non_const_handle(*hh)); + m_left_he = + _direct_intersecting_edge_to_right(m_cv, m_left_pt, + m_arr.non_const_handle(*hh)); // Handle overlaps. - if (found_overlap) - { - // In this case cv overlaps the curve associated with intersect_he. + if (m_found_overlap) { + // In this case cv overlaps the curve associated with m_intersect_he. // Compute the overlapping subcurve. - bool dummy; - obj = _compute_next_intersection (intersect_he, false, dummy); - - overlap_cv = object_cast (obj); - + bool dummy; + m_obj = _compute_next_intersection(m_intersect_he, false, dummy); + m_overlap_cv = object_cast(m_obj); + // Remove the overlap from the map. - _remove_next_intersection (intersect_he); - + _remove_next_intersection(m_intersect_he); + // Compute the overlap zone. - done = _zone_in_overlap (); + done = _zone_in_overlap(); } } - else - { + else { // In case the unbounded left end conicides with an edge, then our curve // overlaps the curve associated with this edge. - intersect_he = arr.non_const_handle (*hh); + m_intersect_he = m_arr.non_const_handle(*hh); bool dummy; - obj = _compute_next_intersection (intersect_he, false, dummy); - - overlap_cv = object_cast (obj); - + m_obj = _compute_next_intersection(m_intersect_he, false, dummy); + m_overlap_cv = object_cast(m_obj); + // Remove the overlap from the map. - _remove_next_intersection (intersect_he); - + _remove_next_intersection(m_intersect_he); + // Compute the overlap zone. - done = _zone_in_overlap (); + done = _zone_in_overlap(); } } - else - { + else { // The left endpoint lies inside a face. - fh = object_cast(&obj); + fh = object_cast(&m_obj); CGAL_assertion_msg(fh != NULL, "Invalid object returned by the point-location query."); // Compute the zone of the curve at the interior of the face. - done = _zone_in_face (arr.non_const_handle(*fh), - false); // left_pt is not on the face boundary. + // left_pt is not on the face boundary. + done = _zone_in_face(m_arr.non_const_handle(*fh), false); // In case we have just discovered an overlap, compute the overlapping // zone as well. - if (! done && found_overlap) - { - done = _zone_in_overlap (); - } + if (! done && m_found_overlap) done = _zone_in_overlap(); } // Compute the zone of the curve (or what is remaining of it) in the // arrangement, starting from the current position we have computed. - while (! done) - { + while (! done) { // Check if we know the face the curve is going to penetrate now. - if (left_he == invalid_he) - { - if (left_v != invalid_v) - { + if (m_left_he == invalid_he) { + if (m_left_v != invalid_v) { // We know the vertex that coincides with the left endpoint of cv. - if (! left_v->is_isolated()) - { - // Locate the curve around the left_v vertex - that is, find a - // halfedge left_he such that cv should be placed between left_he + if (! m_left_v->is_isolated()) { + // Locate the curve around the m_left_v vertex - that is, find a + // halfedge m_left_he such that cv should be placed between m_left_he // and its current successor around the vertex, going in a clockwise // order. - found_overlap = _find_prev_around_vertex (left_v, left_he); + m_found_overlap = _find_prev_around_vertex(m_left_v, m_left_he); } - else - { - // left_v is an isolated vertex. - found_iso_vert = true; + else { + // m_left_v is an isolated vertex. + m_found_iso_vert = true; } } - else - { - CGAL_assertion (right_he != invalid_he); + else { + CGAL_assertion(m_right_he != invalid_he); - // In this case right_he is the halfedge that the left portion of cv - // intersected, and we obtain left_he by comparing the remaining + // In this case m_right_he is the halfedge that the left portion of cv + // intersected, and we obtain m_left_he by comparing the remaining // portion of cv with the curve associated with this edge. - left_he = _direct_intersecting_edge_to_right (cv, left_pt, right_he); + m_left_he = + _direct_intersecting_edge_to_right(m_cv, m_left_pt, m_right_he); } - if (found_overlap) - { - // In this case cv overlaps the curve associated with intersect_he. + if (m_found_overlap) { + // In this case cv overlaps the curve associated with m_intersect_he. // Compute the overlapping subcurve to the right of curr_v. bool dummy; - obj = _compute_next_intersection (intersect_he, false, dummy); + m_obj = _compute_next_intersection(m_intersect_he, false, dummy); - overlap_cv = object_cast (obj); + m_overlap_cv = object_cast(m_obj); // Remove the overlap from the map. - _remove_next_intersection (intersect_he); + _remove_next_intersection(m_intersect_he); // Compute the overlap zone and continue to the end of the loop. - done = _zone_in_overlap (); + done = _zone_in_overlap(); continue; } } - if (left_v == invalid_v || ! left_v->is_isolated()) - { - // At this point we can compute the zone of cv starting from the left_he - // inside its incident face. - done = _zone_in_face (left_he->face(), true); - // left_pt is on the face boundary. + if ((m_left_v == invalid_v) || ! m_left_v->is_isolated()) { + // Compute the zone of cv starting from m_left_he inside its incident face. + done = _zone_in_face(m_left_he->face(), true); + // m_left_pt is on the face boundary. } - else - { + else { // Compute the zone of cv starting from the face that contains the - // isolated vertex left_v. - done = _zone_in_face (left_v->face(), false); - // left_pt is not on the face boundary. + // isolated vertex m_left_v. + done = _zone_in_face(m_left_v->face(), false); + // m_left_pt is not on the face boundary. } // In case we have just discovered an overlap, compute the overlapping // zone as well. - if (! done && found_overlap) - { - done = _zone_in_overlap(); - } + if (! done && m_found_overlap) done = _zone_in_overlap(); } // Clear the intersections map. - inter_map.clear(); - - return; + m_inter_map.clear(); } //----------------------------------------------------------------------------- // Find a face containing the query curve cv around the given vertex. -// In case an overlap occurs, sets intersect_he to be the overlapping edge. +// In case an overlap occurs, sets m_intersect_he to be the overlapping edge. // -template -bool Arrangement_zone_2::_find_prev_around_vertex - (Vertex_handle v, - Halfedge_handle& he) +template +bool Arrangement_zone_2:: +_find_prev_around_vertex(Vertex_handle v, Halfedge_handle& he) { // Go over the incident halfedges of v, going in a clockwise order. typename Arrangement_2::Halfedge_around_vertex_circulator he_first; @@ -301,8 +269,7 @@ bool Arrangement_zone_2::_find_prev_around_vertex he_next = he_curr; ++he_next; - if (he_curr == he_next) - { + if (he_curr == he_next) { // In case there is just a single incident halfedge around v, // we should insert cv right after this halfedge. he = he_curr; @@ -311,11 +278,11 @@ bool Arrangement_zone_2::_find_prev_around_vertex // halfedge also extends to the right of v (its source is to // the right), check if an overlap occurs. if (he->direction() == ARR_RIGHT_TO_LEFT && - (m_geom_traits->compare_y_at_x_right_2_object() (he->curve(), cv, - v->point()) == EQUAL)) + (m_geom_traits->compare_y_at_x_right_2_object()(he->curve(), m_cv, + v->point()) == EQUAL)) { // Mark that an overlap occurs: - intersect_he = he_curr; + m_intersect_he = he_curr; return (true); } @@ -324,37 +291,33 @@ bool Arrangement_zone_2::_find_prev_around_vertex } // Find the face containing cv around the vertex. - typename Traits_adaptor_2::Is_between_cw_2 is_between_cw = + typename Traits_adaptor_2::Is_between_cw_2 is_between_cw = m_geom_traits->is_between_cw_2_object(); - do - { + do { // Check if it is possible to insert cv in between the current curve // and the next curve, going in a clockwise direction around v. - is_between = is_between_cw (cv, true, - he_curr->curve(), - (he_curr->direction() == ARR_RIGHT_TO_LEFT), - he_next->curve(), - (he_next->direction() == ARR_RIGHT_TO_LEFT), - v->point(), - cv_equals_curr, cv_equals_next); + is_between = is_between_cw(m_cv, true, + he_curr->curve(), + (he_curr->direction() == ARR_RIGHT_TO_LEFT), + he_next->curve(), + (he_next->direction() == ARR_RIGHT_TO_LEFT), + v->point(), + cv_equals_curr, cv_equals_next); // Check the case of overlaps: - if (cv_equals_curr) - { + if (cv_equals_curr) { // cv overlaps with the curve of he_curr: - intersect_he = he_curr; + m_intersect_he = he_curr; return (true); } - else if (cv_equals_next) - { + else if (cv_equals_next) { // cv overlaps with the curve of he_next: - intersect_he = he_next; + m_intersect_he = he_next; return (true); } - if (is_between) - { + if (is_between) { // We can conclude that cv should be placed between he_curr and // he_next (in a clockwise order), and no overlap occurs. he = he_curr; @@ -377,50 +340,44 @@ bool Arrangement_zone_2::_find_prev_around_vertex // point that occurs in the interior of a given edge, when the subcurve lies // to the right of the split point. // -template -typename Arrangement_zone_2::Halfedge_handle -Arrangement_zone_2::_direct_intersecting_edge_to_right - (const X_monotone_curve_2& cv_ins, - const Point_2& cv_left_pt, - Halfedge_handle query_he) +template +typename Arrangement_zone_2::Halfedge_handle +Arrangement_zone_2:: +_direct_intersecting_edge_to_right(const X_monotone_curve_2& cv_ins, + const Point_2& cv_left_pt, + Halfedge_handle query_he) { // Make sure that the left endpoint of cv_ins lies on query_he. - CGAL_exactness_assertion (m_geom_traits->compare_y_at_x_2_object() - (cv_left_pt, query_he->curve()) == EQUAL); + CGAL_exactness_assertion(m_geom_traits->compare_y_at_x_2_object() + (cv_left_pt, query_he->curve()) == EQUAL); // Check whether the given halfedge is directed to the right. - const bool query_he_directed_right = - (query_he->direction() == ARR_LEFT_TO_RIGHT); + const bool query_he_directed_right = + (query_he->direction() == ARR_LEFT_TO_RIGHT); // Check whether the curve lies above of below the edge immediately to // the right of its left endpoint. const Comparison_result pos_res = - m_geom_traits->compare_y_at_x_right_2_object() (cv_ins, query_he->curve(), - cv_left_pt); + m_geom_traits->compare_y_at_x_right_2_object()(cv_ins, query_he->curve(), + cv_left_pt); - if (pos_res == SMALLER) - { + if (pos_res == SMALLER) { // If cv below the curve associated with query_he, the relevant halfedge // is the one directed from right to left. - if (query_he_directed_right) - return (query_he->twin()); - else - return (query_he); + if (query_he_directed_right) return (query_he->twin()); + else return (query_he); } - else if (pos_res == LARGER) - { + else if (pos_res == LARGER) { // If cv below the curve associated with hh, the relevant halfedge // is the one directed from left to right. - if (query_he_directed_right) - return (query_he); - else - return (query_he->twin()); + if (query_he_directed_right) return (query_he); + else return (query_he->twin()); } // The two curves are equal to the right of the left endpoint, so we have // an overlap. - found_overlap = true; - intersect_he = query_he; + m_found_overlap = true; + m_intersect_he = query_he; return (query_he); } @@ -430,11 +387,11 @@ Arrangement_zone_2::_direct_intersecting_edge_to_right // point that occurs in the interior of a given edge, when the subcurve lies // to the left of the split point. // -template -typename Arrangement_zone_2::Halfedge_handle +template +typename Arrangement_zone_2::Halfedge_handle Arrangement_zone_2:: -_direct_intersecting_edge_to_left (const X_monotone_curve_2& cv_ins, - Halfedge_handle query_he) +_direct_intersecting_edge_to_left(const X_monotone_curve_2& cv_ins, + Halfedge_handle query_he) { // Make sure that the right endpoint of cv_ins lies on query_he. CGAL_exactness_assertion @@ -443,17 +400,16 @@ _direct_intersecting_edge_to_left (const X_monotone_curve_2& cv_ins, query_he->curve()) == EQUAL); // Check whether the given halfedge is directed to the right. - const bool query_he_directed_right = + const bool query_he_directed_right = (query_he->direction() == ARR_LEFT_TO_RIGHT); // Check whether the curve lies above of below the edge (we use the curve // position predicate, as we know they cruves do not overlap and intersect // only at the split point). - Comparison_result pos_res = - m_geom_traits->compare_y_position_2_object() (cv_ins, query_he->curve()); + Comparison_result pos_res = + m_geom_traits->compare_y_position_2_object()(cv_ins, query_he->curve()); - if (pos_res == EQUAL) - { + if (pos_res == EQUAL) { // This can happen only when both endpoints of cv_ins lie on query_he, // for example (the ^-shaped polyline is associated with query_he and // the horizontal segment is cv_ins): @@ -469,119 +425,104 @@ _direct_intersecting_edge_to_left (const X_monotone_curve_2& cv_ins, // of cv_ins' left endpoint. pos_res = m_geom_traits->compare_y_at_x_right_2_object() (cv_ins, query_he->curve(), - m_geom_traits->construct_min_vertex_2_object() (cv_ins)); + m_geom_traits->construct_min_vertex_2_object()(cv_ins)); } - if (pos_res == SMALLER) - { + if (pos_res == SMALLER) { // If cv_ins lies below the curve associated with query_he, we should // take the halfedge directed from right to left, so if query_he is // directed to the right, we return it twin. - if (query_he_directed_right) - return (query_he->twin()); - else - return (query_he); + if (query_he_directed_right) return (query_he->twin()); + else return (query_he); } - else - { - CGAL_assertion (pos_res != EQUAL); + else { + CGAL_assertion(pos_res != EQUAL); // If cv_ins lies above the curve associated with query_he, we should // take the halfedge directed from left to right, so if query_he is // directed to the left, we return it twin. - if (! query_he_directed_right) - return (query_he->twin()); - else - return (query_he); + if (! query_he_directed_right) return (query_he->twin()); + else return (query_he); } } //----------------------------------------------------------------------------- // Get the next intersection of cv with the given halfedge. // -template +template CGAL::Object -Arrangement_zone_2:: -_compute_next_intersection (Halfedge_handle he, - bool skip_first_point, - bool& intersection_on_right_boundary) +Arrangement_zone_2:: +_compute_next_intersection(Halfedge_handle he, + bool skip_first_point, + bool& intersection_on_right_boundary) { // Get a pointer to the curve associated with the halfedge. const X_monotone_curve_2 *p_curve = &(he->curve()); // Try to locate the intersections with this curve in the intersections map. - Intersect_map_iterator iter = inter_map.find (p_curve); - const Intersect_point_2 *ip; - const X_monotone_curve_2 *icv; - bool valid_intersection; + Intersect_map_iterator iter = m_inter_map.find(p_curve); + const Intersect_point_2* ip; + const X_monotone_curve_2* icv; + bool valid_intersection; intersection_on_right_boundary = false; - if (iter != inter_map.end()) - { + if (iter != m_inter_map.end()) { // The intersections with the curve have already been computed. // Retrieve the intersections list from the map. - Intersect_list& inter_list = iter->second; + Intersect_list& inter_list = iter->second; - if (inter_list.empty()) - return CGAL::Object(); + if (inter_list.empty()) return CGAL::Object(); - // Locate the first intersection that lies to the right of left_pt + // Locate the first intersection that lies to the right of m_left_pt // (if the left point exists). - while (! inter_list.empty()) - { - // Compare that current object with left_pt (if exists). - ip = object_cast (&(inter_list.front())); + while (! inter_list.empty()) { + // Compare that current object with m_left_pt (if exists). + ip = object_cast(&(inter_list.front())); - if (left_on_boundary) - { + if (m_left_on_boundary) { // The left end lie on the left boundary, so all intersections are // valid, as they lie to its right. valid_intersection = true; } - else if (ip != NULL) - { - if (has_right_pt && right_on_boundary && - m_geom_traits->equal_2_object() (ip->first, right_pt)) + else if (ip != NULL) { + if (m_has_right_pt && m_right_on_boundary && + m_geom_traits->equal_2_object()(ip->first, m_right_pt)) { valid_intersection = true; intersection_on_right_boundary = true; } - else - { + else { // We have a simple intersection point - make sure it lies to the - // right of left_pt. + // right of m_left_pt. valid_intersection = - (m_geom_traits->compare_xy_2_object() (ip->first, left_pt) == + (m_geom_traits->compare_xy_2_object()(ip->first, m_left_pt) == LARGER); } } - else - { + else { // We have an overlapping subcurve. - icv = object_cast (&(inter_list.front())); + icv = object_cast(&(inter_list.front())); CGAL_assertion (icv != NULL); - if (m_geom_traits->is_closed_2_object()(*icv, ARR_MIN_END)) - { + if (m_geom_traits->is_closed_2_object()(*icv, ARR_MIN_END)) { // The curve has a valid left point - make sure it lies to the - // right of left_pt. + // right of m_left_pt. valid_intersection = (m_geom_traits->compare_xy_2_object() - (m_geom_traits->construct_min_vertex_2_object()(*icv), left_pt) != + (m_geom_traits->construct_min_vertex_2_object()(*icv), m_left_pt) != SMALLER); } - else - { + else { // In this case the overlap is not valid. valid_intersection = false; } } if (valid_intersection) - // Found an intersection to left_pt's right. + // Found an intersection to m_left_pt's right. return (inter_list.front()); - // Discard the current intersection, which lies to left_pt's left. + // Discard the current intersection, which lies to m_left_pt's left. inter_list.pop_front(); } @@ -595,222 +536,220 @@ _compute_next_intersection (Halfedge_handle he, // curve is the one we insert. Even though the order seems unimportant, we // exploit this fact in some of the traits classes in order to optimize // computations. - Intersect_list inter_list; - bool is_first = true; + Intersect_list inter_list; + bool is_first = true; + m_geom_traits->intersect_2_object()(he->curve(), m_cv, + std::back_inserter(inter_list)); - m_geom_traits->intersect_2_object() (he->curve(), cv, - std::back_inserter(inter_list)); + // Discard all intersection lying to the left of m_left_pt (if exists). + while (! inter_list.empty()) { + // Compare that current object with m_left_pt (if exists). + ip = object_cast(&(inter_list.front())); - // Discard all intersection lying to the left of left_pt (if exists). - while (! inter_list.empty()) - { - // Compare that current object with left_pt (if exists). - ip = object_cast (&(inter_list.front())); - - if (ip != NULL) - { + if (ip != NULL) { // We have a simple intersection point - if we don't have to skip it, - // make sure it lies to the right of left_pt (if left_pt is on the left + // make sure it lies to the right of m_left_pt (if m_left_pt is on the left // boundary, all points lie to it right). - if (is_first && skip_first_point) - { - valid_intersection = false; - } - else if (left_on_boundary) - { - valid_intersection = true; - } - else if (has_right_pt && right_on_boundary && - m_geom_traits->equal_2_object() (ip->first, right_pt)) + if (is_first && skip_first_point) valid_intersection = false; + else if (m_left_on_boundary) valid_intersection = true; + else if (m_has_right_pt && m_right_on_boundary && + m_geom_traits->equal_2_object()(ip->first, m_right_pt)) { valid_intersection = true; intersection_on_right_boundary = true; } - else - { + else { valid_intersection = - (m_geom_traits->compare_xy_2_object() (ip->first, left_pt) == LARGER); + (m_geom_traits->compare_xy_2_object()(ip->first, m_left_pt) == LARGER); } } - else if (left_on_boundary) - { + else if (m_left_on_boundary) { // The left end is on the boundary, so all overlapping curves are valid, // as they lie to its right. valid_intersection = true; } - else - { + else { // We have an overlapping subcurve. - icv = object_cast (&(inter_list.front())); - CGAL_assertion (icv != NULL); + icv = object_cast(&(inter_list.front())); + CGAL_assertion(icv != NULL); - if (m_geom_traits->is_closed_2_object() (*icv, ARR_MIN_END)) - { + if (m_geom_traits->is_closed_2_object()(*icv, ARR_MIN_END)) { // The curve has a valid left point - make sure it lies to the - // right of left_pt. + // right of m_left_pt. valid_intersection = (m_geom_traits->compare_xy_2_object() (m_geom_traits->construct_min_vertex_2_object()(*icv), - left_pt) != SMALLER); + m_left_pt) != SMALLER); } - else - { + else { // In this case the overlap is not valid. valid_intersection = false; } } is_first = false; - if (valid_intersection) - // Found an intersection to left_pt's right. - break; + // Found an intersection to m_left_pt's right. + if (valid_intersection) break; - // Discard the current intersection, which lies to left_pt's left. + // Discard the current intersection, which lies to m_left_pt's left. inter_list.pop_front(); } // Insert the list of valid intersections into the map. - inter_map[p_curve] = inter_list; + m_inter_map[p_curve] = inter_list; // Return the first intersection object computed (may be empty). - if (inter_list.empty()) - return CGAL::Object(); - else - return (inter_list.front()); + if (inter_list.empty()) return CGAL::Object(); + else return (inter_list.front()); } //----------------------------------------------------------------------------- // Remove the next intersection of cv with the given halfedge from the map. // -template -void Arrangement_zone_2:: -_remove_next_intersection (Halfedge_handle he) +template +void Arrangement_zone_2:: +_remove_next_intersection(Halfedge_handle he) { // Get a pointer to the curve associated with the halfedge. - const X_monotone_curve_2 *p_curve = &(he->curve()); + const X_monotone_curve_2* p_curve = &(he->curve()); // Locate the intersections with this curve in the intersections map. - Intersect_map_iterator iter = inter_map.find (p_curve); + Intersect_map_iterator iter = m_inter_map.find(p_curve); - CGAL_assertion (iter != inter_map.end()); - CGAL_assertion (! iter->second.empty()); + CGAL_assertion(iter != m_inter_map.end()); + CGAL_assertion(! iter->second.empty()); // Remove the first object in the list of intersections. iter->second.pop_front(); - return; } //----------------------------------------------------------------------------- // Check if the given point lies completely to the left of the given egde. // -template -bool Arrangement_zone_2:: +template +bool Arrangement_zone_2:: _is_to_left_impl(const Point_2& p, Halfedge_handle he, Arr_not_all_sides_oblivious_tag) const { // Check the boundary conditions of the minimal end of the curve associated // with the given halfedge. - const Arr_parameter_space ps_x = - m_geom_traits->parameter_space_in_x_2_object() (he->curve(), ARR_MIN_END); + const Arr_parameter_space ps_x = + m_geom_traits->parameter_space_in_x_2_object()(he->curve(), ARR_MIN_END); - if (ps_x == ARR_LEFT_BOUNDARY) - // The minimal end of the curve is to the left of any other point: - return (false); + // The minimal end of the curve is to the left of any other point: + if (ps_x == ARR_LEFT_BOUNDARY) return (false); - const Arr_parameter_space ps_y = - m_geom_traits->parameter_space_in_y_2_object() (he->curve(), ARR_MIN_END); + const Arr_parameter_space ps_y = + m_geom_traits->parameter_space_in_y_2_object()(he->curve(), ARR_MIN_END); if (ps_y != ARR_INTERIOR) { // Check if p is to the left of the minimal curve-end: - const Comparison_result res = - m_geom_traits->compare_x_point_curve_end_2_object() (p, he->curve(), - ARR_MIN_END); + const Comparison_result res = + m_geom_traits->compare_x_point_curve_end_2_object()(p, he->curve(), + ARR_MIN_END); return ((res == SMALLER) || (res == EQUAL && ps_y == ARR_TOP_BOUNDARY)); } // In case the minimal curve-end does not have boundary conditions, simply // compare p with the left endpoint of the curve. - Vertex_const_handle v_left = + Vertex_const_handle v_left = (he->direction() == ARR_LEFT_TO_RIGHT) ? he->source() : he->target(); - return (m_geom_traits->compare_xy_2_object() (p, v_left->point()) == SMALLER); + return (m_geom_traits->compare_xy_2_object()(p, v_left->point()) == SMALLER); } //----------------------------------------------------------------------------- -// Check if the given point lies completely to the right of the given egde. +// Determine whether a given point lies completely to the right of a given egde. // -template -bool Arrangement_zone_2:: +template +bool Arrangement_zone_2:: +_is_to_right_impl(const Point_2& p, Halfedge_handle he, + Arr_all_sides_oblivious_tag) const +{ + return ((he->direction() == ARR_LEFT_TO_RIGHT && + m_geom_traits->compare_xy_2_object() + (p, he->target()->point()) == LARGER) || + (he->direction() == ARR_RIGHT_TO_LEFT && + m_geom_traits->compare_xy_2_object() + (p, he->source()->point()) == LARGER)); +} + +//----------------------------------------------------------------------------- +// Determine whether a given point lies completely to the right of a given egde. +// +template +bool Arrangement_zone_2:: _is_to_right_impl(const Point_2& p, Halfedge_handle he, Arr_not_all_sides_oblivious_tag) const { - // Check the boundary conditions of the maximal end of the curve associated + // Check the boundary conditions of the maximal end of the curve associated // with the given halfedge. - const Arr_parameter_space ps_x = - m_geom_traits->parameter_space_in_x_2_object() (he->curve(), ARR_MAX_END); + const Arr_parameter_space ps_x = + m_geom_traits->parameter_space_in_x_2_object()(he->curve(), ARR_MAX_END); - if (ps_x == ARR_RIGHT_BOUNDARY) - // The maximal end of the curve is to the right of any other point: - return (false); + // The maximal end of the curve is to the right of any other point: + if (ps_x == ARR_RIGHT_BOUNDARY) return false; - const Arr_parameter_space ps_y = - m_geom_traits->parameter_space_in_y_2_object() (he->curve(), ARR_MAX_END); + // p is to the right of any curve that lies on the left boundary. + if (ps_x == ARR_LEFT_BOUNDARY) return true; + + const Arr_parameter_space ps_y = + m_geom_traits->parameter_space_in_y_2_object()(he->curve(), ARR_MAX_END); if (ps_y != ARR_INTERIOR) { // Check if p is to the right of the maximal curve-end: - const Comparison_result res = - m_geom_traits->compare_x_point_curve_end_2_object() (p, he->curve(), - ARR_MAX_END); - - return ((res == LARGER) || (res == EQUAL && ps_y == ARR_BOTTOM_BOUNDARY)); + const Comparison_result res = + m_geom_traits->compare_x_point_curve_end_2_object()(p, he->curve(), + ARR_MAX_END); + return ((res == LARGER) || + ((res == EQUAL) && (ps_y == ARR_BOTTOM_BOUNDARY))); } // In case the maximal curve-end does not have boundary conditions, simply // compare p with the right endpoint of the curve. - Vertex_const_handle v_right = + Vertex_const_handle v_right = (he->direction() == ARR_LEFT_TO_RIGHT) ? he->target() : he->source(); - return (m_geom_traits->compare_xy_2_object() (p, v_right->point()) == LARGER); + return (m_geom_traits->compare_xy_2_object()(p, v_right->point()) == LARGER); } //----------------------------------------------------------------------------- // Compute the (lexicographically) leftmost intersection of the query // curve with the boundary of a given face in the arrangement. // -template -void Arrangement_zone_2:: - _leftmost_intersection_with_face_boundary (Face_handle face, - bool on_boundary) +template +void Arrangement_zone_2:: +_leftmost_intersection_with_face_boundary(Face_handle face, bool on_boundary) { // Mark that we have not found any intersection (or overlap) yet. - found_intersect = false; - found_overlap = false; - found_iso_vert = false; + m_found_intersect = false; + m_found_overlap = false; + m_found_iso_vert = false; // Obtain some geometry-traits functors. - typename Traits_adaptor_2::Compare_xy_2 compare_xy = + typename Traits_adaptor_2::Compare_xy_2 compare_xy = m_geom_traits->compare_xy_2_object(); - typename Traits_adaptor_2::Is_in_x_range_2 is_in_x_range = + typename Traits_adaptor_2::Is_in_x_range_2 is_in_x_range = m_geom_traits->is_in_x_range_2_object(); - typename Traits_adaptor_2::Construct_min_vertex_2 min_vertex = + typename Traits_adaptor_2::Construct_min_vertex_2 min_vertex = m_geom_traits->construct_min_vertex_2_object(); - typename Traits_adaptor_2::Compare_y_at_x_2 compare_y_at_x = + typename Traits_adaptor_2::Compare_y_at_x_2 compare_y_at_x = m_geom_traits->compare_y_at_x_2_object(); // Traverse the outer boundary of the face by going over all outer CCBs of // the face. - typename Arrangement_2::Outer_ccb_iterator occb_it; - typename Arrangement_2::Ccb_halfedge_circulator he_first; - typename Arrangement_2::Ccb_halfedge_circulator he_curr; + typename Arrangement_2::Outer_ccb_iterator occb_it; + typename Arrangement_2::Ccb_halfedge_circulator he_first; + typename Arrangement_2::Ccb_halfedge_circulator he_curr; - CGAL::Object iobj; - const Intersect_point_2 *int_p; - const X_monotone_curve_2 *icv; - Point_2 ip; - bool left_equals_curr_endpoint; - bool intersection_on_right_boundary; - bool leftmost_on_right_boundary = false; + CGAL::Object iobj; + const Intersect_point_2* int_p; + const X_monotone_curve_2* icv; + Point_2 ip; + bool left_equals_curr_endpoint; + bool intersection_on_right_boundary; + bool leftmost_on_right_boundary = false; for (occb_it = face->outer_ccbs_begin(); occb_it != face->outer_ccbs_end(); ++occb_it) @@ -819,28 +758,25 @@ void Arrangement_zone_2:: he_first = *occb_it; he_curr = he_first; - do - { + do { // If this edge is fictitious, skip it. - if (he_curr->is_fictitious()) - { + if (he_curr->is_fictitious()) { ++he_curr; continue; } - + // If we have already found an intersection with the twin halfedge, // we do not have to compute intersections with the current halfedge. - if (found_intersect && intersect_he == he_curr->twin()) - { + if (m_found_intersect && m_intersect_he == he_curr->twin()) { ++he_curr; continue; } - + // If we already have an intersection point, compare it to the // endpoints of the curve associated with the current halfedge, // in order to filter unnecessary intersection computations. - if (found_intersect && ! leftmost_on_right_boundary && - _is_to_left (intersect_p, he_curr)) + if (m_found_intersect && ! leftmost_on_right_boundary && + _is_to_left(m_intersect_p, he_curr)) { // The current x-monotone curve lies entirely to the right of // ip_left, so its intersection with cv (if any) cannot lie to @@ -849,43 +785,37 @@ void Arrangement_zone_2:: ++he_curr; continue; } - + left_equals_curr_endpoint = false; - if (on_boundary) - { + if (on_boundary) { // Check if the left endpoint of the inserted curve (which is located // on the boundary of our face) equals one of the endpoints of the // current halfedge. If it equals the right endpoint of the current // halfedge, we can skip this edge, as there is no true overlap in - // the x-range. Otherwise, we keep track of the fact that left_v is + // the x-range. Otherwise, we keep track of the fact that m_left_v is // the left end-vertex of the current halfedge. - if (he_curr->target() == left_v) - { + if (he_curr->target() == m_left_v) { left_equals_curr_endpoint = true; - - if (he_curr->direction() == ARR_LEFT_TO_RIGHT) - { + + if (he_curr->direction() == ARR_LEFT_TO_RIGHT) { ++he_curr; continue; } } - else if (he_curr->source() == left_v) - { + else if (he_curr->source() == m_left_v) { left_equals_curr_endpoint = true; - - if (he_curr->direction() == ARR_RIGHT_TO_LEFT) - { + if (he_curr->direction() == ARR_RIGHT_TO_LEFT) { ++he_curr; continue; } } } - + // Check whether the two curves overlap in their x-range (in order // to avoid unnecessary intersection computations). if (! left_equals_curr_endpoint && - ((! left_on_boundary && _is_to_right (left_pt, he_curr)) || - ! is_in_x_range (cv, he_curr->curve()))) + ((! m_left_on_boundary && _is_to_right(m_left_pt, he_curr)) || + ! is_in_x_range(m_cv, he_curr->curve()))) { // In case there is no overlap, the two x-monotone curves obviously // do not intersect. @@ -894,72 +824,66 @@ void Arrangement_zone_2:: } // Compute the next intersection of cv and the current halfedge. - iobj = _compute_next_intersection (he_curr, - left_equals_curr_endpoint, - intersection_on_right_boundary); + iobj = _compute_next_intersection(he_curr, + left_equals_curr_endpoint, + intersection_on_right_boundary); - if (! iobj.is_empty()) - { + if (! iobj.is_empty()) { // We have found an intersection (either a simple point or an // overlapping x-monotone curve). - int_p = object_cast (&iobj); - if (int_p != NULL) - { + int_p = object_cast(&iobj); + if (int_p != NULL) { ip = int_p->first; // Found a simple intersection point. Check if it is the leftmost // intersection point so far. - if (! found_intersect || + if (! m_found_intersect || (! intersection_on_right_boundary && (leftmost_on_right_boundary || - compare_xy (ip, intersect_p) == SMALLER))) + compare_xy(ip, m_intersect_p) == SMALLER))) { // Store the leftmost intersection point and the halfedge handle. - intersect_p = ip; - ip_mult = int_p->second; - intersect_he = he_curr; - found_overlap = false; + m_intersect_p = ip; + m_ip_mult = int_p->second; + m_intersect_he = he_curr; + m_found_overlap = false; leftmost_on_right_boundary = intersection_on_right_boundary; } } - else - { + else { // We have located an overlapping curve. Assign ip as its left // endpoint. - icv = object_cast (&iobj); - CGAL_assertion (icv != NULL); + icv = object_cast(&iobj); + CGAL_assertion(icv != NULL); - ip = min_vertex (*icv); + ip = min_vertex(*icv); // Check if this endpoint it is the leftmost intersection point so // far. - if (! found_intersect || - compare_xy (ip, intersect_p) == SMALLER) - { + if (! m_found_intersect || compare_xy(ip, m_intersect_p) == SMALLER) { // Store the leftmost intersection point and the halfedge handle. - intersect_p = ip; - ip_mult = 0; - overlap_cv = *icv; - intersect_he = he_curr; - found_overlap = true; + m_intersect_p = ip; + m_ip_mult = 0; + m_overlap_cv = *icv; + m_intersect_he = he_curr; + m_found_overlap = true; } } - + // Mark that we found an intersection. - found_intersect = true; + m_found_intersect = true; } - + // Move to the next edge along the outer boundary, ++he_curr; - + } while (he_curr != he_first); // End loop on the current outer CCB. } // End: traversal of the outer CCBs of the face. // Traverse the inner boundary of the face by going over all inner CCBs // (the holes) of the face. - typename Arrangement_2::Inner_ccb_iterator iccb_it; - + typename Arrangement_2::Inner_ccb_iterator iccb_it; for (iccb_it = face->inner_ccbs_begin(); iccb_it != face->inner_ccbs_end(); ++iccb_it) { @@ -967,12 +891,10 @@ void Arrangement_zone_2:: he_first = *iccb_it; he_curr = he_first; - do - { + do { // If we have already found an intersection with the twin halfedge, // we do not have to compute intersections with the current halfedge. - if (found_intersect && intersect_he == he_curr->twin()) - { + if (m_found_intersect && m_intersect_he == he_curr->twin()) { ++he_curr; continue; } @@ -980,8 +902,8 @@ void Arrangement_zone_2:: // If we already have an intersection point, compare it to the // endpoints of the curve associated with the current halfedge, // in order to filter unnecessary intersection computations. - if (found_intersect && ! leftmost_on_right_boundary && - _is_to_left (intersect_p, he_curr)) + if (m_found_intersect && ! leftmost_on_right_boundary && + _is_to_left(m_intersect_p, he_curr)) { // The current x-monotone curve lies entirely to the right of // ip_left, so its intersection with cv (if any) cannot lie to @@ -992,41 +914,35 @@ void Arrangement_zone_2:: } left_equals_curr_endpoint = false; - if (on_boundary) - { + if (on_boundary) { // Check if the left endpoint of the inserted curve (which is located // on the boundary of our face) equals one of the endpoints of the // current halfedge. If it equals the right endpoint of the current // halfedge, we can skip this edge, as there is no true overlap in - // the x-range. Otherwise, we keep track of the fact that left_v is + // the x-range. Otherwise, we keep track of the fact that m_left_v is // the left end-vertex of the current halfedge. - if (he_curr->target() == left_v) - { + if (he_curr->target() == m_left_v) { left_equals_curr_endpoint = true; - if (he_curr->direction() == ARR_LEFT_TO_RIGHT) - { + if (he_curr->direction() == ARR_LEFT_TO_RIGHT) { ++he_curr; continue; } } - else if (he_curr->source() == left_v) - { + else if (he_curr->source() == m_left_v) { left_equals_curr_endpoint = true; - if (he_curr->direction() == ARR_RIGHT_TO_LEFT) - { + if (he_curr->direction() == ARR_RIGHT_TO_LEFT) { ++he_curr; continue; } } } - // Check whether the two curves overlap in their x-range (in order // to avoid unnecessary intersection computations). if (! left_equals_curr_endpoint && - ((! left_on_boundary && _is_to_right (left_pt, he_curr)) || - ! is_in_x_range (cv, he_curr->curve()))) + ((! m_left_on_boundary && _is_to_right(m_left_pt, he_curr)) || + ! is_in_x_range(m_cv, he_curr->curve()))) { // In case there is no overlap, the two x-monotone curves obviously // do not intersect. @@ -1039,57 +955,52 @@ void Arrangement_zone_2:: left_equals_curr_endpoint, intersection_on_right_boundary); - if (! iobj.is_empty()) - { + if (! iobj.is_empty()) { // We have found an intersection (either a simple point or an // overlapping x-monotone curve). - int_p = object_cast (&iobj); - if (int_p != NULL) - { + int_p = object_cast(&iobj); + if (int_p != NULL) { ip = int_p->first; // Found a simple intersection point. Check if it is the leftmost // intersection point so far. - if (! found_intersect || + if (! m_found_intersect || (! intersection_on_right_boundary && (leftmost_on_right_boundary || - compare_xy (ip, intersect_p) == SMALLER))) + compare_xy(ip, m_intersect_p) == SMALLER))) { // Store the leftmost intersection point and the halfedge // handle. - intersect_p = ip; - ip_mult = int_p->second; - intersect_he = he_curr; - found_overlap = false; + m_intersect_p = ip; + m_ip_mult = int_p->second; + m_intersect_he = he_curr; + m_found_overlap = false; leftmost_on_right_boundary = intersection_on_right_boundary; } } - else - { + else { // We have located an overlapping curve. Assign ip as its left // endpoint. - icv = object_cast (&iobj); - CGAL_assertion (icv != NULL); + icv = object_cast(&iobj); + CGAL_assertion(icv != NULL); - ip = min_vertex (*icv); + ip = min_vertex(*icv); // Check if this endpoint it is the leftmost intersection point // so far. - if (! found_intersect || - compare_xy (ip, intersect_p) == SMALLER) - { + if (! m_found_intersect || compare_xy(ip, m_intersect_p) == SMALLER) { // Store the leftmost intersection point and the halfedge // handle. - intersect_p = ip; - ip_mult = 0; - overlap_cv = *icv; - intersect_he = he_curr; - found_overlap = true; + m_intersect_p = ip; + m_ip_mult = 0; + m_overlap_cv = *icv; + m_intersect_he = he_curr; + m_found_overlap = true; } } // Mark that we found an intersection. - found_intersect = true; + m_found_intersect = true; } // Move to the next edge along the outer boundary, @@ -1107,38 +1018,33 @@ void Arrangement_zone_2:: iv_it != face->isolated_vertices_end(); ++iv_it) { // If the isolated vertex is not in the x-range of our curve, disregard it. - if (! is_in_x_range (cv, iv_it->point())) + if (! is_in_x_range(m_cv, iv_it->point())) continue; // If we already have an intersection point, compare it to the current // isolated vertex, in order to filter unnecessary computations. - if (found_intersect && - compare_xy (iv_it->point(), intersect_p) == LARGER) - { + if (m_found_intersect && compare_xy(iv_it->point(), m_intersect_p) == + LARGER) continue; - } // In case the isolated vertex lies on the curve, update the intersection // point accordingly. - if (compare_y_at_x (iv_it->point(), cv) == EQUAL && - (! has_left_pt || - compare_xy (iv_it->point(), left_pt) == LARGER)) + if (compare_y_at_x(iv_it->point(), m_cv) == EQUAL && + (! m_has_left_pt || compare_xy(iv_it->point(), m_left_pt) == LARGER)) { - intersect_v = iv_it; - intersect_p = intersect_v->point(); - ip_mult = 0; - found_intersect = true; - found_iso_vert = true; + m_intersect_v = iv_it; + m_intersect_p = m_intersect_v->point(); + m_ip_mult = 0; + m_found_intersect = true; + m_found_iso_vert = true; } } // End:: traversal of the isolated vertices inside the face. - // Remove the next intersection associated with intersect_he, as we have + // Remove the next intersection associated with m_intersect_he, as we have // now reported it and do not want to encounter it again. - if (found_intersect && !found_iso_vert) - _remove_next_intersection (intersect_he); - - return; + if (m_found_intersect && !m_found_iso_vert) + _remove_next_intersection(m_intersect_he); } //----------------------------------------------------------------------------- @@ -1146,141 +1052,131 @@ void Arrangement_zone_2:: // The left endpoint of the curve either lies in the face interior or on // the boundary of the face. // -template -bool Arrangement_zone_2:: -_zone_in_face (Face_handle face, bool on_boundary) +template +bool Arrangement_zone_2:: +_zone_in_face(Face_handle face, bool on_boundary) { - CGAL_precondition ((! on_boundary && - ((left_v == invalid_v && left_he == invalid_he) || - left_v->is_isolated())) || - (on_boundary && left_he != invalid_he)); + CGAL_precondition((! on_boundary && + (((m_left_v == invalid_v) && (m_left_he == invalid_he)) || + m_left_v->is_isolated())) || + (on_boundary && (m_left_he != invalid_he))); // Find the first intersection of the curve with the face boundary. - _leftmost_intersection_with_face_boundary (face, on_boundary); + _leftmost_intersection_with_face_boundary(face, on_boundary); - if (! found_intersect) - { + if (! m_found_intersect) { // Notify the visitor that the entire curve lies within the given face, // such that its right endpoint is not incident to any arrangement feature. - visitor->found_subcurve (cv, face, left_v, left_he, invalid_v, invalid_he); + m_visitor->found_subcurve(m_cv, face, m_left_v, m_left_he, + invalid_v, invalid_he); // Inidicate that we are done with the zone-computation process. return (true); } - // In this case found_intersect is true and intersect_he is the edge that - // cv next intersects (or overlaps). If found_overlap is also true, - // then overlap_cv is set and intersect_p is the left endpoint of the - // overlapping subcurve. Otherwise, intersect_p is a simple intersection + // In this case m_found_intersect is true and m_intersect_he is the edge that + // cv next intersects (or overlaps). If m_found_overlap is also true, + // then m_overlap_cv is set and m_intersect_p is the left endpoint of the + // overlapping subcurve. Otherwise, m_intersect_p is a simple intersection // point. - // Alternatively, if found_iso_vert is true, then the next intersection point - // intersect_p lies on the isolated vertex intersect_v. - bool done = false; - - if (has_right_pt && - m_geom_traits->equal_2_object() (intersect_p, right_pt)) + // Alternatively, if m_found_iso_vert is true, then the next intersection point + // m_intersect_p lies on the isolated vertex m_intersect_v. + bool done = false; + if (m_has_right_pt && + m_geom_traits->equal_2_object()(m_intersect_p, m_right_pt)) { // If the intersection point is cv's right endpoint, the interior of cv // does not intersect any existing halfedge. In this case, we only have // to insert cv to the arrangement and we are done. - sub_cv1 = cv; + m_sub_cv1 = m_cv; done = true; } - else - { + else { // Split cv at the intersection point. - m_geom_traits->split_2_object() (cv, intersect_p, sub_cv1, sub_cv2); + m_geom_traits->split_2_object()(m_cv, m_intersect_p, m_sub_cv1, m_sub_cv2); // Set cv to be the remaining portion. - has_left_pt = true; - left_on_boundary = false; - left_pt = intersect_p; - cv = sub_cv2; + m_has_left_pt = true; + m_left_on_boundary = false; + m_left_pt = m_intersect_p; + m_cv = m_sub_cv2; } - const X_monotone_curve_2 *p_orig_curve = NULL; + const X_monotone_curve_2* p_orig_curve = NULL; - if (! found_iso_vert) - { - // Check whether intersect_p coincides with one of the end-vertices of the + if (! m_found_iso_vert) { + // Check whether m_intersect_p coincides with one of the end-vertices of the // halfedge that cv intersects. - if (! intersect_he->source()->is_at_open_boundary() && - m_geom_traits->equal_2_object() (intersect_p, - intersect_he->source()->point())) + if (! m_intersect_he->source()->is_at_open_boundary() && + m_geom_traits->equal_2_object()(m_intersect_p, + m_intersect_he->source()->point())) { - // We know that the right endpoint of sub_cv1 lies on the source vertex: - right_v = intersect_he->source(); - right_he = invalid_he; + // We know that the right endpoint of m_sub_cv1 lies on the source vertex: + m_right_v = m_intersect_he->source(); + m_right_he = invalid_he; } - else if (! intersect_he->target()->is_at_open_boundary() && - m_geom_traits->equal_2_object() (intersect_p, - intersect_he->target()->point())) + else if (! m_intersect_he->target()->is_at_open_boundary() && + m_geom_traits->equal_2_object()(m_intersect_p, + m_intersect_he->target()->point())) { - // We know that the right endpoint of sub_cv1 lies on the target vertex: - right_v = intersect_he->target(); - right_he = invalid_he; + // We know that the right endpoint of m_sub_cv1 lies on the target vertex: + m_right_v = m_intersect_he->target(); + m_right_he = invalid_he; } - else - { - // The right endpoint of sub_cv1 lies on the interior of intersect_he: + else { + // The right endpoint of m_sub_cv1 lies on the interior of m_intersect_he: // Obtain the halfedge with the correct direction (which should be the - // predecessor of sub_cv1 if we split the edge around this vertex). - right_v = invalid_v; - right_he = _direct_intersecting_edge_to_left (sub_cv1, intersect_he); + // predecessor of m_sub_cv1 if we split the edge around this vertex). + m_right_v = invalid_v; + m_right_he = _direct_intersecting_edge_to_left(m_sub_cv1, m_intersect_he); } // Store the curve currently associated with the intersecting halfedge. - p_orig_curve = &(intersect_he->curve()); + p_orig_curve = &(m_intersect_he->curve()); } - else - { + else { // The right endpoint of the subcurve coincides with an isolated vertex: - right_v = intersect_v; - right_he = invalid_he; + m_right_v = m_intersect_v; + m_right_he = invalid_he; } // Notify the visitor that the left endpoint of the first subcurve is // located within the current face and both its endpoint are located // on its boundary. - Visitor_result visitor_res = visitor->found_subcurve (sub_cv1, face, - left_v, left_he, - right_v, right_he); + Visitor_result visitor_res = + m_visitor->found_subcurve(m_sub_cv1, face, m_left_v, m_left_he, + m_right_v, m_right_he); // Check if we are done (either we have no remaining curve or if the // visitor has indicated we should end the process). - if (done || visitor_res.second) - return (true); + if (done || visitor_res.second) return (true); // Move to the remaining portion of the curve, whose left endpoint is the - // same as the right endpoint of sub_cv1. Note that we check if the visitor + // same as the right endpoint of m_sub_cv1. Note that we check if the visitor // has inserted the subcurve (in which case it should return a handle to // the resulting halfedge). Halfedge_handle inserted_he = visitor_res.first; - if (inserted_he != invalid_he) - { - if (right_v == invalid_v) - { + if (inserted_he != invalid_he) { + if (m_right_v == invalid_v) { // If the right endpoint of the subcurve we have just detected was // not associated with an existing vertex, the inserted halfedge is - // now targeted toward a newly created vertex that splits intersect_he + // now targeted toward a newly created vertex that splits m_intersect_he // into two halfedges: (a) the next halfedge after inserted_he and (b) // the previous halfedge before inserted_he's twin. // The two halfedges (a) and (b) are now associated with the two - // subcurves that result from splitting intersect_he->curve() at the + // subcurves that result from splitting m_intersect_he->curve() at the // intersection point we have just detected, one extends to the left // and one to the right of this split point. - const X_monotone_curve_2 *p_left_subcurve = NULL; - const X_monotone_curve_2 *p_right_subcurve = NULL; + const X_monotone_curve_2* p_left_subcurve = NULL; + const X_monotone_curve_2* p_right_subcurve = NULL; - if (inserted_he->next()->direction() == ARR_LEFT_TO_RIGHT) - { + if (inserted_he->next()->direction() == ARR_LEFT_TO_RIGHT) { // The next halfedge extends to the right of the split point: p_left_subcurve = &(inserted_he->twin()->prev()->curve()); p_right_subcurve = &(inserted_he->next()->curve()); } - else - { + else { // The next halfedge extends to the left of the split point: p_right_subcurve = &(inserted_he->twin()->prev()->curve()); p_left_subcurve = &(inserted_he->next()->curve()); @@ -1289,115 +1185,93 @@ _zone_in_face (Face_handle face, bool on_boundary) // Associate the intersection list of the original curve with the // right subcurve, while we can associate an empty list with the // left subcurve, as we are now done with it. - Intersect_map_iterator iter = inter_map.find (p_orig_curve); - Intersect_list empty_inter_list; + Intersect_map_iterator iter = m_inter_map.find(p_orig_curve); + Intersect_list empty_inter_list; - inter_map[p_right_subcurve] = iter->second; - inter_map[p_left_subcurve] = empty_inter_list; + m_inter_map[p_right_subcurve] = iter->second; + m_inter_map[p_left_subcurve] = empty_inter_list; // If necessary, erase the original curve from the intersection map. if (p_orig_curve != p_right_subcurve && p_orig_curve !=p_left_subcurve) - inter_map.erase (p_orig_curve); + m_inter_map.erase(p_orig_curve); } - if (found_overlap && right_v == invalid_v) - { - // In case we have split the overlapping intersect_he, it now refers + if (m_found_overlap && m_right_v == invalid_v) { + // In case we have split the overlapping m_intersect_he, it now refers // to the wrong halfedge. the overlapping edge is either the successor // of the inserted halfedge or the predecessor of its twin, depending // on which one of these halfedges lies to the right of the split point. - if (inserted_he->next()->direction() == ARR_LEFT_TO_RIGHT) - { + if (inserted_he->next()->direction() == ARR_LEFT_TO_RIGHT) { // The successor is directed to the right: - intersect_he = inserted_he->next(); + m_intersect_he = inserted_he->next(); } - else - { + else { // The predecessor is directed to the left: - CGAL_assertion (inserted_he->twin()->prev()->direction() == - ARR_RIGHT_TO_LEFT); + CGAL_assertion(inserted_he->twin()->prev()->direction() == + ARR_RIGHT_TO_LEFT); - intersect_he = inserted_he->twin()->prev(); + m_intersect_he = inserted_he->twin()->prev(); } } - // The visitor has created an edge that corresponds to sub_cv1 and inserted - // it into the arrangement. In this case, left_pt should be associated + // The visitor has created an edge that corresponds to m_sub_cv1 and inserted + // it into the arrangement. In this case, m_left_pt should be associated // with the target vertex of the new halfedge. CGAL_assertion - (m_geom_traits->equal_2_object() (left_pt, - inserted_he->target()->point())); + (m_geom_traits->equal_2_object()(m_left_pt, + inserted_he->target()->point())); - left_v = inserted_he->target(); + m_left_v = inserted_he->target(); - // If right_he is known, it is possible to set left_he according to the + // If m_right_he is known, it is possible to set m_left_he according to the // geometric information we have. - if (right_he != invalid_he) - { - if ((ip_mult % 2) == 1) - { - // cv crosses right_he (which is now split into two), so the remaining + if (m_right_he != invalid_he) { + if ((m_ip_mult % 2) == 1) { + // cv crosses m_right_he (which is now split into two), so the remaining // portion must be inserted after the next halfedge going clockwise - // around left_v: + // around m_left_v: // // \ . . // \ . remaining portion of cv . // x . // inserted_he / \ . // / \ . - left_he = inserted_he->next()->twin(); + m_left_he = inserted_he->next()->twin(); } - else if (ip_mult != 0) - { - // We have a tangency point. If right_he is directed from left to - // right, we take the inserted halfedge to be left_he, otherwise - // right_he itself becomes left_he: - if (right_he->direction() == ARR_LEFT_TO_RIGHT) - left_he = inserted_he; - else - left_he = right_he; - } - else - { - // Mutliplicity is unkown: - left_he = invalid_he; + else if (m_ip_mult != 0) { + // We have a tangency point. If m_right_he is directed from left to + // right, we take the inserted halfedge to be m_left_he, otherwise + // m_right_he itself becomes m_left_he: + if (m_right_he->direction() == ARR_LEFT_TO_RIGHT) + m_left_he = inserted_he; + else m_left_he = m_right_he; } + else m_left_he = invalid_he; // mutliplicity is unkown } - else - { - // In case left_v used to be an isolated vertex, we know that the + else { + // In case m_left_v used to be an isolated vertex, we know that the // inserted halfedge is its only incident halfedge and we can use it. - // Otherwise, we do not know the identity of left_he. - if (found_iso_vert) - left_he = inserted_he; - else - left_he = invalid_he; + // Otherwise, we do not know the identity of m_left_he. + if (m_found_iso_vert) m_left_he = inserted_he; + else m_left_he = invalid_he; } } - else - { + else { // The visitor has not created a new edge. We proceed using the previously // computed arrangement features. - left_v = right_v; + m_left_v = m_right_v; - if (right_he != invalid_he) - { - // In case cv crosses the interior of the right_he halfedge (the + if (m_right_he != invalid_he) { + // In case cv crosses the interior of the m_right_he halfedge (the // multiplicity of the intersection is odd), we know that the ramaining // portion of the curve lies in the face incident to the twin halfedge. // If the multiplicity is known and is even, we stay with the same // halfedge. - if ((ip_mult % 2) == 1) - left_he = right_he->twin(); - else if (ip_mult != 0) - left_he = right_he; - else - left_he = invalid_he; - } - else - { - left_he = invalid_he; + if ((m_ip_mult % 2) == 1) m_left_he = m_right_he->twin(); + else if (m_ip_mult != 0) m_left_he = m_right_he; + else m_left_he = invalid_he; } + else m_left_he = invalid_he; } // We are not done with the zone-computation process yet: @@ -1405,109 +1279,110 @@ _zone_in_face (Face_handle face, bool on_boundary) } //----------------------------------------------------------------------------- -// Compute the zone of an overlapping subcurve overlap_cv of cv and the -// curve currently associated with intersect_he. +// Compute the zone of an overlapping subcurve m_overlap_cv of cv and the +// curve currently associated with m_intersect_he. // -template -bool Arrangement_zone_2::_zone_in_overlap () +template +bool Arrangement_zone_2::_zone_in_overlap() { - // Check if the right end of overlap_cv is bounded. If so, compute its + // Check if the right end of m_overlap_cv is bounded. If so, compute its // right endpoint. - const bool cv_has_right_pt = - m_geom_traits->is_closed_2_object() (overlap_cv, ARR_MAX_END); - - Point_2 cv_right_pt; + const bool cv_has_right_pt = + m_geom_traits->is_closed_2_object()(m_overlap_cv, ARR_MAX_END); + Point_2 cv_right_pt; if (cv_has_right_pt) - cv_right_pt = m_geom_traits->construct_max_vertex_2_object() (overlap_cv); + cv_right_pt = m_geom_traits->construct_max_vertex_2_object()(m_overlap_cv); - // Get right end-vertex of the overlapping halfedge intersect_he. Also make + // Get right end-vertex of the overlapping halfedge m_intersect_he. Also make // sure that the overlapping halfedge is always directed to the right. - Vertex_handle he_right_v; + Vertex_handle he_right_v; - if (intersect_he->direction() == ARR_LEFT_TO_RIGHT) - { - he_right_v = intersect_he->target(); - } - else - { - he_right_v = intersect_he->source(); - intersect_he = intersect_he->twin(); + if (m_intersect_he->direction() == ARR_LEFT_TO_RIGHT) + he_right_v = m_intersect_he->target(); + else { + he_right_v = m_intersect_he->source(); + m_intersect_he = m_intersect_he->twin(); } - // Compare the two right endpoints. Note that overlap_cv cannot extend to + // Compare the two right endpoints. Note that m_overlap_cv cannot extend to // the right longer than the halfedge it overlaps. Thus, if the curve is - // not bounded, the right vertex of intersect_he must lie on open boundary as - // well. - if (! cv_has_right_pt) - { + // not bounded, the right vertex of m_intersect_he must lie on open boundary + // as well. + if (! cv_has_right_pt) { CGAL_assertion_code - (const Arr_parameter_space cv_ps_x = - m_geom_traits->parameter_space_in_x_2_object() (overlap_cv, ARR_MAX_END); - const Arr_parameter_space cv_ps_y = - m_geom_traits->parameter_space_in_y_2_object() (overlap_cv, ARR_MAX_END); + (const Arr_parameter_space cv_ps_x = + m_geom_traits->parameter_space_in_x_2_object()(m_overlap_cv, ARR_MAX_END); + const Arr_parameter_space cv_ps_y = + m_geom_traits->parameter_space_in_y_2_object()(m_overlap_cv, ARR_MAX_END); ); - CGAL_assertion (he_right_v->parameter_space_in_x() == cv_ps_x && - he_right_v->parameter_space_in_y() == cv_ps_y); + CGAL_assertion(he_right_v->parameter_space_in_x() == cv_ps_x && + he_right_v->parameter_space_in_y() == cv_ps_y); - right_v = he_right_v; + m_right_v = he_right_v; } - else - { - // In this case overlap_cv has a finite right endpoint. In this case, - // if the right vertex of intersect_he is associated with a finite point, + else { + // In this case m_overlap_cv has a finite right endpoint. If the right + // vertex of m_intersect_he is associated with a finite point, // we check whether it is equal to cv_right_pt. Otherwise, we know that - // intersect_he extends to the the right of overlap_cv, and there is no - // vertex currently associated with overlap_cv's right endpoint. + // m_intersect_he extends to the the right of m_overlap_cv, and there is no + // vertex currently associated with m_overlap_cv's right endpoint. if (! he_right_v->is_at_open_boundary() && - m_geom_traits->equal_2_object() (cv_right_pt, he_right_v->point())) + m_geom_traits->equal_2_object()(cv_right_pt, he_right_v->point())) { // The overlap is with the entire halfedge. In this case we set the // right end-vertex of the overlapping zone. - right_v = he_right_v; + m_right_v = he_right_v; } - else - { - // In this case intersect_he overlaps just a portion of prev_he. + else { + // In this case m_intersect_he overlaps just a portion of prev_he. // The right end-vertex of the overlapping zone is not known. - right_v = invalid_v; + m_right_v = invalid_v; } } // Store the curve currently associated with the overlapping halfedge. - const X_monotone_curve_2 *p_orig_curve = &(intersect_he->curve()); + const X_monotone_curve_2* p_orig_curve = &(m_intersect_he->curve()); // Notify the visitor on the overlapping zone. - Visitor_result visitor_res = visitor->found_overlap (overlap_cv, - intersect_he, - left_v, right_v); + Visitor_result visitor_res = + m_visitor->found_overlap(m_overlap_cv, m_intersect_he, m_left_v, m_right_v); // If the visitor has indicated we should halt the process, or it the right // endpoint of the overlapping curve is the right endpoint of cv then we are // done (or both extend to an open boundary). if (visitor_res.second || - (cv_has_right_pt && has_right_pt && - m_geom_traits->equal_2_object() (cv_right_pt, right_pt)) || - (! cv_has_right_pt && ! has_right_pt)) - { - return (true); - } + (cv_has_right_pt && m_has_right_pt && + m_geom_traits->equal_2_object()(cv_right_pt, m_right_pt)) || + (! cv_has_right_pt && ! m_has_right_pt)) + { return (true); } // Erase the original curve from the intersection map, so we will have to // recompute intersections with it in the future. - inter_map.erase (p_orig_curve); + m_inter_map.erase(p_orig_curve); // Mark that we have dealt with the overlap. - found_overlap = false; + m_found_overlap = false; // Split cv at right endpoint of the overlapping curve. - m_geom_traits->split_2_object() (cv, cv_right_pt, sub_cv1, sub_cv2); + m_geom_traits->split_2_object()(m_cv, cv_right_pt, m_sub_cv1, m_sub_cv2); // Set cv to be the remaining portion. - has_left_pt = true; - left_on_boundary = false; - left_pt = cv_right_pt; - cv = sub_cv2; + m_has_left_pt = true; + m_left_pt = cv_right_pt; + + // Check whether the m_left_pt is on the boundary. Recall that m_left_pt + // is the right point of cv. Thus, m_left_pt is on the boundary only if + // cv lies entirely on the boundary. + typename Traits_adaptor_2::Parameter_space_in_x_2 ps_x_op = + m_geom_traits->parameter_space_in_x_2_object(); + typename Traits_adaptor_2::Parameter_space_in_y_2 ps_y_op = + m_geom_traits->parameter_space_in_y_2_object(); + const Arr_parameter_space ps_x1 = ps_x_op(m_left_pt); + const Arr_parameter_space ps_y1 = ps_y_op(m_left_pt); + m_left_on_boundary = ((ps_x1 != ARR_INTERIOR) || (ps_y1 != ARR_INTERIOR)); + + m_cv = m_sub_cv2; // Move to the remaining portion of the curve, whose left endpoint is the // same as the right endpoint of the overlapping curve. Note that we check @@ -1515,21 +1390,17 @@ bool Arrangement_zone_2::_zone_in_overlap () // a handle to the resulting halfedge). Halfedge_handle updated_he = visitor_res.first; - if (updated_he != invalid_he) - { - // In this case, left_pt should be associated with the target vertex of + if (updated_he != invalid_he) { + // In this case, m_left_pt should be associated with the target vertex of // the updated halfedge. CGAL_assertion - (m_geom_traits->equal_2_object() (left_pt, updated_he->target()->point())); - - left_v = updated_he->target(); - } - else - { - left_v = right_v; - } + (m_geom_traits->equal_2_object()(m_left_pt, + updated_he->target()->point())); - left_he = invalid_he; + m_left_v = updated_he->target(); + } + else m_left_v = m_right_v; + m_left_he = invalid_he; // We are not done with the zone-computation process yet: return (false); diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_2.h index 357d4bc9064..e01c9dd57eb 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_2.h @@ -26,6 +26,7 @@ // Ester Ezra, // Shai Hirsch, // and Eugene Lipovetsky) + #ifndef CGAL_ARRANGEMENT_ON_SURFACE_2_H #define CGAL_ARRANGEMENT_ON_SURFACE_2_H @@ -93,7 +94,7 @@ public: public: typedef Arrangement_on_surface_2 - Self; + Self; typedef typename Geometry_traits_2::Point_2 Point_2; typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2; @@ -1994,6 +1995,18 @@ protected: */ DVertex* _create_vertex(const Point_2& p); + /*! + * Create a new boundary vertex. + * \param p The point on the boundary. + * \param bx The boundary condition in x. + * \param by The boundary condition in y. + * \pre Either bx or by does not equal ARR_INTERIOR. + * \return A pointer to the newly created vertex. + */ + DVertex* _create_boundary_vertex(const Point_2& p, + Arr_parameter_space bx, + Arr_parameter_space by); + /*! * Create a new boundary vertex. * \param cv The curve incident to the boundary. @@ -2008,6 +2021,20 @@ protected: Arr_parameter_space bx, Arr_parameter_space by); + /*! + * Locate the DCEL features that will be used for inserting the given point, + * which has a boundary condition, and set a proper vertex there. + * \param f The face that contains the point. + * \param p The point. + * \param bx The boundary condition at the point x-coordinate. + * \param by The boundary condition at the point y-coordinate. + * \return The vertex that corresponds to the point. + */ + DVertex* _place_and_set_point(DFace* f, + const Point_2& p, + Arr_parameter_space bx, + Arr_parameter_space by); + /*! * Locate the DCEL features that will be used for inserting the given curve * end, which has a boundary condition, and set a proper vertex there. @@ -2346,6 +2373,17 @@ protected: (*iter)->after_create_vertex(v); } + void _notify_before_create_boundary_vertex(const Point_2& p, + Arr_parameter_space bx, + Arr_parameter_space by) + { + Observers_iterator iter; + Observers_iterator end = m_observers.end(); + + for (iter = m_observers.begin(); iter != end; ++iter) + (*iter)->before_create_boundary_vertex(p, bx, by); + } + void _notify_before_create_boundary_vertex(const X_monotone_curve_2& cv, Arr_curve_end ind, Arr_parameter_space bx, 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 aea27c8a9fa..1b067563631 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h @@ -15,7 +15,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0+ -// +// // // Author(s) : Ron Wein // Efi Fogel @@ -59,17 +59,14 @@ namespace CGAL { * by the visitor (if valid), and the Boolean value indicates whether we * should halt the zone-computation process. */ -template -class Arrangement_zone_2 -{ +template +class Arrangement_zone_2 { public: - typedef Arrangement_ Arrangement_2; typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2; typedef typename Arrangement_2::Topology_traits Topology_traits; protected: - typedef Arr_traits_adaptor_2 Traits_adaptor_2; typedef typename Traits_adaptor_2::Left_side_category Left_side_category; @@ -78,13 +75,12 @@ protected: typedef typename Traits_adaptor_2::Right_side_category Right_side_category; BOOST_MPL_ASSERT( - (typename - Arr_sane_identified_tagging< Left_side_category, Bottom_side_category, + (typename + Arr_sane_identified_tagging< Left_side_category, Bottom_side_category, Top_side_category, Right_side_category >::result) ); public: - typedef ZoneVisitor_ Visitor; typedef typename Arrangement_2::Vertex_handle Vertex_handle; @@ -98,191 +94,174 @@ public: typedef typename Geometry_traits_2::Multiplicity Multiplicity; protected: - - typedef typename Arr_are_all_sides_oblivious_tag< - Left_side_category, Bottom_side_category, - Top_side_category, Right_side_category >::result + typedef typename Arr_are_all_sides_oblivious_tag::result Are_all_sides_oblivious_category; - - typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; - typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; - typedef typename Arrangement_2::Face_const_handle Face_const_handle; + + typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; + typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; + typedef typename Arrangement_2::Face_const_handle Face_const_handle; // Types used for caching intersection points: - typedef std::pair Intersect_point_2; - typedef std::list Intersect_list; - typedef std::map Intersect_map; - typedef typename Intersect_map::iterator Intersect_map_iterator; + typedef std::pair Intersect_point_2; + typedef std::list Intersect_list; + typedef std::map + Intersect_map; + typedef typename Intersect_map::iterator Intersect_map_iterator; - typedef std::set Curves_set; - typedef typename Curves_set::iterator Curves_set_iterator; + typedef std::set Curves_set; + typedef typename Curves_set::iterator Curves_set_iterator; // Data members: - Arrangement_2& arr; // The associated arrangement. - const Traits_adaptor_2 * m_geom_traits; // Its associated geometry traits. - Arr_accessor arr_access; // An accessor for the arrangement. - - Visitor *visitor; // The zone visitor. + Arrangement_2& m_arr; // the associated arrangement. + const Traits_adaptor_2* m_geom_traits; // its associated geometry traits. + Arr_accessor m_arr_access; // an accessor for the arrangement. + Visitor* m_visitor; // the zone visitor. + Intersect_map m_inter_map; // stores all computed intersections. - Intersect_map inter_map; // Stores all computed intersections. + //! remove this! + const Vertex_handle invalid_v; // an invalid vertex handle. + const Halfedge_handle invalid_he; // an invalid halfedge handle. - const Vertex_handle invalid_v; // An invalid vertex handle. - const Halfedge_handle invalid_he; // An invalid halfedge handle. + X_monotone_curve_2 m_cv; // the current portion of the inserted + // curve. + CGAL::Object m_obj; // the location of the left endpoint. + bool m_has_left_pt; // is the left end of the curve bounded. + bool m_left_on_boundary; // is the left point on the boundary. + Point_2 m_left_pt; // its current left endpoint. + bool m_has_right_pt; // is the right end of the curve bounded. + bool m_right_on_boundary; // is the right point on the boundary. + Point_2 m_right_pt; // its right endpoint (if bounded). - X_monotone_curve_2 cv; // The current portion of the - // inserted curve. - CGAL::Object obj; // The location of the left endpoint. - bool has_left_pt; // Is the left end of the curve - // bounded. - bool left_on_boundary; // Is the left point on the boundary. - Point_2 left_pt; // Its current left endpoint. - bool has_right_pt; // Is the right end of the curve - // bounded. - bool right_on_boundary;// Is the right point on the boundary. - Point_2 right_pt; // Its right endpoint (if bounded). + Vertex_handle m_left_v; // the arrangement vertex associated + // with the current left_pt (if any). + Halfedge_handle m_left_he; // if left_v is valid, left_he is the + // predecessor for cv around this + // vertex. Otherwise, if it is valid, + // it is the halfedge that contains + // the left endpoint it its interior. - Vertex_handle left_v; // The arrangement vertex associated - // with the current left_pt (if any). - Halfedge_handle left_he; // If left_v is valid, left_he is the - // predecessor for cv around this - // vertex. Otherwise, if it is valid, - // it is the halfedge that contains - // the left endpoint it its interior. + Vertex_handle m_right_v; // the arrangement vertex associated + // with the current m_right_pt (if any). + Halfedge_handle m_right_he; // If m_right_v is valid, left_he is the + // predecessor for cv around this + // vertex. Otherwise, if it is valid, + // it is the halfedge that contains + // the right endpoint it its interior. - Vertex_handle right_v; // The arrangement vertex associated - // with the current right_pt (if any). - Halfedge_handle right_he; // If right_v is valid, left_he is the - // predecessor for cv around this - // vertex. Otherwise, if it is valid, - // it is the halfedge that contains - // the right endpoint it its interior. + Point_2 m_intersect_p; // the next intersection point. + Multiplicity m_ip_mult; // its multiplicity + // (0 in case of an overlap). + bool m_found_intersect; // Have we found an intersection + // (or an overlap). + X_monotone_curve_2 m_overlap_cv; // the currently discovered overlap. + bool m_found_overlap; // Have we found an overlap. + bool m_found_iso_vert; // Check if an isolated vertex induces + // the next intersection. + Vertex_handle m_intersect_v; // The vertex that intersects cv. + Halfedge_handle m_intersect_he; // The halfedge that intersects cv + // (or overlaps it). - Point_2 intersect_p; // The next intersection point. - unsigned int ip_mult; // Its multiplicity - // (0 in case of an overlap). - bool found_intersect; // Have we found an intersection - // (or an overlap). - X_monotone_curve_2 overlap_cv; // The currently discovered overlap. - bool found_overlap; // Have we found an overlap. - bool found_iso_vert; // Check if an isolated vertex induces - // the next intersection. - Vertex_handle intersect_v; // The vertex that intersects cv. - Halfedge_handle intersect_he; // The halfedge that intersects cv - // (or overlaps it). - - X_monotone_curve_2 sub_cv1; // Auxiliary variable (for curve split). - X_monotone_curve_2 sub_cv2; // Auxiliary variable (for curve split). + X_monotone_curve_2 m_sub_cv1; // Auxiliary variable (for curve split). + X_monotone_curve_2 m_sub_cv2; // Auxiliary variable (for curve split). public: - - /*! - * Constructor. + /*! Constructor. * \param _arr The arrangement for which we compute the zone. * \param _visitor A pointer to a zone-visitor object. */ - Arrangement_zone_2 (Arrangement_2& _arr, Visitor *_visitor) : - arr (_arr), - arr_access (_arr), - visitor (_visitor), - invalid_v (), - invalid_he () + Arrangement_zone_2(Arrangement_2& arr, Visitor* visitor) : + m_arr(arr), + m_arr_access(arr), + m_visitor(visitor), + invalid_v(), + invalid_he() { - m_geom_traits = static_cast (arr.geometry_traits()); - - CGAL_assertion (visitor != NULL); - - // Initialize the visitor. - visitor->init (&arr); + m_geom_traits = static_cast(arr.geometry_traits()); + CGAL_assertion(visitor != NULL); + visitor->init(&arr); // initialize the visitor. } - /*! - * Initialize the zone-computation process with a given curve. + /*! Initialize the zone-computation process with a given curve. * \param _cv The query curve. * \param pl A point-location object associated with the arrangement. */ - template - void init (const X_monotone_curve_2& _cv, const PointLocation& pl) + template + void init(const X_monotone_curve_2& cv, const PointLocation& pl) { // Set the curve and check whether its left end has boundary conditions. - cv = _cv; + m_cv = cv; - const Arr_parameter_space bx1 = - m_geom_traits->parameter_space_in_x_2_object()(cv, ARR_MIN_END); - const Arr_parameter_space by1 = - m_geom_traits->parameter_space_in_y_2_object()(cv, ARR_MIN_END); + const Arr_parameter_space bx1 = + m_geom_traits->parameter_space_in_x_2_object()(m_cv, ARR_MIN_END); + const Arr_parameter_space by1 = + m_geom_traits->parameter_space_in_y_2_object()(m_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; - left_on_boundary = (bx1 != ARR_INTERIOR || by1 != ARR_INTERIOR); - left_pt = m_geom_traits->construct_min_vertex_2_object() (cv); - - obj = pl.locate (left_pt); + m_has_left_pt = true; + m_left_on_boundary = (bx1 != ARR_INTERIOR || by1 != ARR_INTERIOR); + m_left_pt = m_geom_traits->construct_min_vertex_2_object()(m_cv); + m_obj = pl.locate(m_left_pt); } 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. - // Note that if the curve-end is unbounded, left_pt does not exist. - has_left_pt = m_geom_traits->is_closed_2_object()(cv, ARR_MIN_END); - left_on_boundary = true; - if (has_left_pt) - left_pt = m_geom_traits->construct_min_vertex_2_object() (cv); - obj = arr_access.locate_curve_end (cv, ARR_MIN_END, bx1, by1); + // Note that if the curve-end is unbounded, m_left_pt does not exist. + m_has_left_pt = m_geom_traits->is_closed_2_object()(m_cv, ARR_MIN_END); + m_left_on_boundary = true; + if (m_has_left_pt) + m_left_pt = m_geom_traits->construct_min_vertex_2_object()(m_cv); + m_obj = m_arr_access.locate_curve_end(m_cv, ARR_MIN_END, bx1, by1); } // Check the boundary conditions of th right curve end. - if (m_geom_traits->is_closed_2_object()(cv, ARR_MAX_END)) { - const Arr_parameter_space bx2 = - m_geom_traits->parameter_space_in_x_2_object()(cv, ARR_MAX_END); - const Arr_parameter_space by2 = - m_geom_traits->parameter_space_in_y_2_object()(cv, ARR_MAX_END); + if (m_geom_traits->is_closed_2_object()(m_cv, ARR_MAX_END)) { + const Arr_parameter_space bx2 = + m_geom_traits->parameter_space_in_x_2_object()(m_cv, ARR_MAX_END); + const Arr_parameter_space by2 = + m_geom_traits->parameter_space_in_y_2_object()(m_cv, ARR_MAX_END); // The right endpoint is valid. - has_right_pt = true; - right_pt = m_geom_traits->construct_max_vertex_2_object() (cv); - right_on_boundary = (bx2 != ARR_INTERIOR) || (by2 != ARR_INTERIOR); + m_has_right_pt = true; + m_right_pt = m_geom_traits->construct_max_vertex_2_object()(m_cv); + m_right_on_boundary = (bx2 != ARR_INTERIOR) || (by2 != ARR_INTERIOR); } else { // The right end of the curve lies at infinity. - has_right_pt = false; - right_on_boundary = true; + m_has_right_pt = false; + m_right_on_boundary = true; } - - return; } - /*! - * Initialize the zone-computation process with a given curve and an object + /*! Initialize the zone-computation process with a given curve and an object * that wraps the location of the curve's left end. * \param _cv The query curve. * \param _obj An object that represents the location of the left end * of the curve. */ - void init_with_hint (const X_monotone_curve_2& _cv, const Object& _obj); + void init_with_hint(const X_monotone_curve_2& cv, const Object& obj); /*! * Compute the zone of the given curve and issue the apporpriate * notifications for the visitor. */ - void compute_zone (); + void compute_zone(); private: - - /*! - * Find a face containing the query curve cv around the given vertex. + /*! Find a face containing the query curve cv around the given vertex. * In case an overlap occurs, sets intersect_he to be the overlapping edge. * \param v The query vertex. * \param he Output: The predecessor of cv around the vertex. * \return (true) if cv overlaps with the curve associated with he; * (false) if there is no overlap. */ - bool _find_prev_around_vertex (Vertex_handle v, Halfedge_handle& he); + bool _find_prev_around_vertex(Vertex_handle v, Halfedge_handle& he); - /*! - * Direct the halfedge for the location of the given subcurve around a split + /*! Direct the halfedge for the location of the given subcurve around a split * point that occurs in the interior of a given edge, when the subcurve lies * to the right of the split point. * In case of overlaps, it sets also found_overlap and intersect_he. @@ -300,8 +279,7 @@ private: const Point_2& cv_left_pt, Halfedge_handle query_he); - /*! - * Direct the halfedge for the location of the given subcurve around a split + /*! Direct the halfedge for the location of the given subcurve around a split * point that occurs in the interior of a given edge, when the subcurve lies * to the left of the split point. * \param cv_ins The curve to be inserted, whose right endpoint coincides @@ -316,8 +294,7 @@ private: _direct_intersecting_edge_to_left(const X_monotone_curve_2& cv_ins, Halfedge_handle query_he); - /*! - * Get the next intersection of cv with the given halfedge. + /*! Get the next intersection of cv with the given halfedge. * \param he A handle to the halfedge. * \param skip_first_point Should we skip the first intersection point. * \param intersect_on_right_boundary Output: If an intersetion point is @@ -330,17 +307,16 @@ private: * case of an overlap, and an empty object if there is no * intersection. */ - CGAL::Object _compute_next_intersection (Halfedge_handle he, - bool skip_first_point, - bool& intersect_on_right_boundary); + CGAL::Object _compute_next_intersection(Halfedge_handle he, + bool skip_first_point, + bool& intersect_on_right_boundary); - /*! - * Remove the next intersection of cv with the given halfedge from the map. + /*! Remove the next intersection of cv with the given halfedge from the map. * \param he A handle to the halfedge. * \pre The list of intersections with the curve of he has already been * computed, and it is not empty. */ - void _remove_next_intersection (Halfedge_handle he); + void _remove_next_intersection(Halfedge_handle he); /*! * Check if the given point lies completely to the left of the given egde. @@ -350,92 +326,76 @@ private: * \return Whether p lies entirely to the left of the edge. */ bool _is_to_left(const Point_2& p, Halfedge_handle he) const - { - return (_is_to_left_impl(p, he, Are_all_sides_oblivious_category())); - } + { return (_is_to_left_impl(p, he, Are_all_sides_oblivious_category())); } bool _is_to_left_impl(const Point_2& p, Halfedge_handle he, Arr_all_sides_oblivious_tag) const { return ((he->direction() == ARR_LEFT_TO_RIGHT && - m_geom_traits->compare_xy_2_object() + m_geom_traits->compare_xy_2_object() (p, he->source()->point()) == SMALLER) || (he->direction() == ARR_RIGHT_TO_LEFT && - m_geom_traits->compare_xy_2_object() + m_geom_traits->compare_xy_2_object() (p, he->target()->point()) == SMALLER)); } bool _is_to_left_impl(const Point_2& p, Halfedge_handle he, Arr_not_all_sides_oblivious_tag) const; - - /*! - * Check if the given point lies completely to the right of the given egde. + + /*! Determine whether a given point lies completely to the right of a given + * egde. * \param p The point. * \param he The halfedge. * \pre he is not a fictitious edge. - * \return Whether p lies entirely to the right of the edge. + * \return if p entirely lies to the right of the edge true; otherwise false. */ bool _is_to_right(const Point_2& p, Halfedge_handle he) const - { - return (_is_to_right_impl(p, he, Are_all_sides_oblivious_category())); - } + { return (_is_to_right_impl(p, he, Are_all_sides_oblivious_category())); } bool _is_to_right_impl(const Point_2& p, Halfedge_handle he, - Arr_all_sides_oblivious_tag) const - { - return ((he->direction() == ARR_LEFT_TO_RIGHT && - m_geom_traits->compare_xy_2_object() - (p, he->target()->point()) == LARGER) || - (he->direction() == ARR_RIGHT_TO_LEFT && - m_geom_traits->compare_xy_2_object() - (p, he->source()->point()) == LARGER)); - } + Arr_all_sides_oblivious_tag) const; bool _is_to_right_impl(const Point_2& p, Halfedge_handle he, Arr_not_all_sides_oblivious_tag) const; - /*! - * Compute the (lexicographically) leftmost intersection of the query + /*! Compute the (lexicographically) leftmost intersection of the query * curve with the boundary of a given face in the arrangement. - * The function computes sets intersect_p, intersect_he (or alternatively + * The function computes sets m_intersect_p, intersect_he (or alternatively * overlap_cv and intersect_he) and set the flags found_intersect and * found_overlap accordingly. * \param face A handle to the face. * \param on_boundary Specifies whether the left endpoint of the curve lies * on the face boundary. */ - void _leftmost_intersection_with_face_boundary (Face_handle face, - bool on_boundary); + void _leftmost_intersection_with_face_boundary(Face_handle face, + bool on_boundary); - /*! - * Compute the zone of an x-monotone curve in a given arrangement face. + /*! Compute the zone of an x-monotone curve in a given arrangement face. * The left endpoint of the curve either lies in the face interior or on * the boundary of the face. - * This function updates cv and its left endpoint and also sets left_v + * This function updates cv and its left endpoint and also sets m_left_v * and left_he for the remaining portion of the curve. * In case of overlaps, it sets also overlap_cv and intersect_he. * \param face The given face. * \param on_boundary Specifies whether the left endpoint of the curve lies * on the face boundary. * \pre If on_boundary is (true) then left_he must be valid; if it is (false) - * then both left_v anf left_he must be invalid. + * then both m_left_v anf left_he must be invalid. * \return (true) if we are done with the zone-computation process; * (false) if we still have a remaining portion of cv to continue * with. */ - bool _zone_in_face (Face_handle face, - bool on_boundary); + bool _zone_in_face(Face_handle face, bool on_boundary); - /*! - * Compute the zone of an overlapping subcurve overlap_cv of cv and the + /*! Compute the zone of an overlapping subcurve overlap_cv of cv and the * curve currently associated with intersect_he. - * This function updates cv and its left endpoint and also sets left_v + * This function updates cv and its left endpoint and also sets m_left_v * and left_he for the remaining portion of the curve. * \return (true) if we are done with the zone-computation process; * (false) if we still have a remaining portion of cv to continue * with. */ - bool _zone_in_overlap (); + bool _zone_in_overlap(); }; } //namespace CGAL diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h index 406a6c7bd6c..7eb4febb84b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h @@ -952,17 +952,17 @@ public: * * \pre the arc's relevant end is on bottom or top boundary */ - CGAL::Comparison_result compare_x_at_limit( + CGAL::Comparison_result compare_x_on_boundary( CGAL::Arr_curve_end ce, const Point_2& p ) const { - CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_x_at_limit_2, - compare_x_at_limit_2) + CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_x_on_boundary_2, + compare_x_on_boundary_2) // compare with NULL, in order to avoid a performance warning with VC++ CGAL_precondition(Kernel_arc_2_equals_Arc_2 || dynamic_cast< const Kernel_arc_2* >(this) != NULL); - return compare_x_at_limit_2( + return compare_x_on_boundary_2( p, *dynamic_cast< const Kernel_arc_2* >(this), ce ); } @@ -982,15 +982,15 @@ public: * * \pre the curve ends lie on the bottom or top boundary */ - CGAL::Comparison_result compare_x_at_limit( + CGAL::Comparison_result compare_x_on_boundary( CGAL::Arr_curve_end ce1, const Kernel_arc_2& cv2, CGAL::Arr_curve_end ce2) const { - CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_x_at_limit_2, - compare_x_at_limit_2) CGAL_precondition(Kernel_arc_2_equals_Arc_2 || dynamic_cast< const Kernel_arc_2* >(this) != NULL); - return compare_x_at_limit_2( + CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_x_on_boundary_2, + compare_x_on_boundary_2) + return compare_x_on_boundary_2( *dynamic_cast< const Kernel_arc_2* >(this), ce1, cv2, ce2 ); } @@ -1008,16 +1008,16 @@ public: * * \pre the arc's relevant end is on bottom or top boundary */ - CGAL::Comparison_result compare_x_near_limit( + CGAL::Comparison_result compare_x_near_boundary( CGAL::Arr_curve_end ce, const Point_2& p ) const { - CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_x_near_limit_2, - compare_x_near_limit_2) + CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_x_near_boundary_2, + compare_x_near_boundary_2) CGAL_precondition(Kernel_arc_2_equals_Arc_2 || dynamic_cast< const Kernel_arc_2* >(this) != NULL); - return compare_x_near_limit_2( + return compare_x_near_boundary_2( p, *dynamic_cast< const Kernel_arc_2* >(this), ce ); } @@ -1036,14 +1036,14 @@ public: * * \pre the curve ends lie on the bottom or top boundary */ - CGAL::Comparison_result compare_x_near_limit(const Kernel_arc_2& cv2, + CGAL::Comparison_result compare_x_near_boundary(const Kernel_arc_2& cv2, CGAL::Arr_curve_end ce) const { - CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_x_near_limit_2, - compare_x_near_limit_2) + CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_x_near_boundary_2, + compare_x_near_boundary_2) CGAL_precondition(Kernel_arc_2_equals_Arc_2 || dynamic_cast< const Kernel_arc_2* >(this) != NULL); - return compare_x_near_limit_2(*dynamic_cast< const Kernel_arc_2* >(this), cv2, ce); + return compare_x_near_boundary_2(*dynamic_cast< const Kernel_arc_2* >(this), cv2, ce); } /*!\brief @@ -3312,8 +3312,8 @@ public: CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_y_near_boundary_2); CGAL_BEFRIEND_CKvA_2_FUNCTOR(Parameter_space_in_y_2); - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_x_at_limit_2); - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_x_near_limit_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_x_on_boundary_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_x_near_boundary_2); #undef CGAL_BEFRIEND_CKvA_2_FUNCTOR diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_functors.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_functors.h index bac3b6d6af7..4f87996a941 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_functors.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_functors.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007,2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany), +// Copyright (c) 2007,2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or @@ -51,16 +51,16 @@ namespace Curved_kernel_via_analysis_2_Functors { /*!\brief * Base functor class for inheritance */ -template < class CurvedKernelViaAnalysis_2 > +template < class CurvedKernelViaAnalysis_2 > class Curved_kernel_via_analysis_2_functor_base { public: //!\name Public types //!@{ - + //! this instance's template parameter typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; - + //! the point type typedef typename Curved_kernel_via_analysis_2::Point_2 Point_2; @@ -68,12 +68,12 @@ public: typedef typename Curved_kernel_via_analysis_2::Arc_2 Arc_2; //! type of curve kernel - typedef typename Curved_kernel_via_analysis_2::Curve_kernel_2 + typedef typename Curved_kernel_via_analysis_2::Curve_kernel_2 Curve_kernel_2; //! type of curve analaysis typedef typename Curve_kernel_2::Curve_analysis_2 Curve_analysis_2; - + //! the x-coordinate type typedef typename Point_2::Coordinate_1 Coordinate_1; //typedef typename Point_2::Y_coordinate_1 Y_coordinate_1; @@ -84,7 +84,7 @@ public: public: //!\name Constructors //!@{ - + /*!\brief * Constructs base functor * @@ -101,8 +101,8 @@ public: protected: //!\name Access members //!@{ - - /*!\brief + + /*!\brief * Return pointer to curved kernel * \return Pointer to stored kernel */ @@ -111,14 +111,14 @@ protected: } //!@} - + protected: //!\name Data members //!@{ - + //! stores pointer to \c Curved_kernel_via_analysis_2 Curved_kernel_via_analysis_2 *_m_curved_kernel; - + //!@} }; @@ -129,11 +129,11 @@ protected: typedef typename Base::Coordinate_1 Coordinate_1; \ //typedef typename Base::Y_coordinate_1 Y_coordinate_1; -/*!\brief +/*!\brief * Functor to construct a point on a curve */ template < class CurvedKernelViaAnalysis_2 > -class Construct_point_2 : public +class Construct_point_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -141,16 +141,16 @@ public: typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; - + CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef Point_2 result_type; - /*!\brief + /*!\brief * Standard constructor * * \param kernel The kernel @@ -160,33 +160,33 @@ public: } /*!\brief - * Constructs an interior point - * + * Constructs an interior point + * * \param x x-coordinate * \param c The supporting curve * \param arcno Arcnumber on curve * \return The constructed point */ - Point_2 operator()(const Coordinate_1& x, - const Curve_analysis_2& c, + Point_2 operator()(const Coordinate_1& x, + const Curve_analysis_2& c, int arcno) { Point_2 pt(x, c, arcno); return pt; } - Point_2 operator()(const Coordinate_1& x, + Point_2 operator()(const Coordinate_1& x, const Arc_2& a) { CGAL_precondition(a.is_in_x_range(x)); Point_2 pt(x, a.curve(), a.arcno(x)); return pt; } - + template Point_2 operator() (const T& x, const T& y) { Point_2 pt(x,y); - return pt; + return pt; } @@ -197,7 +197,7 @@ public: * Functor to construct point on an arc */ template < class CurvedKernelViaAnalysis_2 > -class Construct_point_on_arc_2 : public +class Construct_point_on_arc_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -205,16 +205,16 @@ public: typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; - + CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef Point_2 result_type; - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -222,10 +222,10 @@ public: Construct_point_on_arc_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { } - + /*!\brief * Constructs point on an arc - * + * * \param x x-coordinate of point * \param c The supporting curve * \param arcno Arcnumber on curve @@ -239,7 +239,7 @@ public: // avoid compiler warning (void)arc; - + //CGAL::set_pretty_mode(std::cerr); CERR("Construct_pt_on_arc: " << CGAL::to_double(x) << ", " << arcno << ", " << c.id() << "\narc = " << arc << "\n"); @@ -248,8 +248,8 @@ public: //CGAL_assertion(arcno == arc.arcno(x)); Point_2 pt = Base::_ckva()->construct_point_2_object()(x, c, arcno); - - // here we can modify the point wrt "data stored in arc", + + // here we can modify the point wrt "data stored in arc", // if we want to return pt; } @@ -257,10 +257,10 @@ public: /*!\brief - * Functor to construct an x-monotone arc + * Functor to construct an x-monotone arc */ template < class CurvedKernelViaAnalysis_2 > -class Construct_arc_2 : public +class Construct_arc_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -268,16 +268,16 @@ public: typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; - + CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef Arc_2 result_type; - /*!\brief + /*!\brief * Standard constructor * * \param kernel The kernel @@ -288,10 +288,10 @@ public: //!\name Constructing non-vertical arcs //!@{ - - /*!\brief + + /*!\brief * Constructs a non-vertical arc with two interior end-points (segment). - * + * * \param p first endpoint * \param q second endpoint * \param c The supporting curve @@ -299,20 +299,20 @@ public: * \param arcno_p The arcnumber wrt \c c of the arc at \c p * \param arcno_q The arcnumber wrt \c c of the arc at \c q * \returns The constructed segment - * + * * \pre p.x() != q.x() * */ - Arc_2 operator()(const Point_2& p, const Point_2& q, + Arc_2 operator()(const Point_2& p, const Point_2& q, const Curve_analysis_2& c, int arcno, int arcno_p, int arcno_q) { Arc_2 arc(p, q, c, arcno, arcno_p, arcno_q); return arc; } - + /*!\brief * Constructs a non-vertical arc with one interior end-point and whose - * other end approaches the left or right boundary of the parameter space + * other end approaches the left or right boundary of the parameter space * (ray I) * * \param origin The interior end-point of the ray @@ -320,17 +320,17 @@ public: * boundary * \param c The supporting curve * \param arcno The arcnumber wrt \c c in the interior of the arc - * \param arcno_o The arcnumber wrt \c c of the arc at \c origin + * \param arcno_o The arcnumber wrt \c c of the arc at \c origin * \return The constructed ray */ - Arc_2 operator()(const Point_2& origin, CGAL::Arr_curve_end inf_end, + Arc_2 operator()(const Point_2& origin, CGAL::Arr_curve_end inf_end, const Curve_analysis_2& c, int arcno, int arcno_o) { Arc_2 arc(origin, inf_end, c, arcno, arcno_o); return arc; } /*!\brief - * Constructs a non-vertical arc with one interior end-point and whose + * Constructs a non-vertical arc with one interior end-point and whose * other end approaches a vertical asymptote (ray II) * * \param origin The interior end-point @@ -338,21 +338,21 @@ public: * \param inf_end Arc is approaching the bottom or top boundary * \param c The supporting curve * \param arcno The arcnumber wrt \c c in the interior of the arc - * \param arcno_o The arcnumber wrt \c c of the arc at \c origin + * \param arcno_o The arcnumber wrt \c c of the arc at \c origin * \return The constructed ray * * \pre origin.x() != asympt_x */ - Arc_2 operator()(const Point_2& origin, const Coordinate_1& asympt_x, - CGAL::Arr_curve_end inf_end, - const Curve_analysis_2& c, int arcno, + Arc_2 operator()(const Point_2& origin, const Coordinate_1& asympt_x, + CGAL::Arr_curve_end inf_end, + const Curve_analysis_2& c, int arcno, int arcno_o) { Arc_2 arc(origin, asympt_x, inf_end, c, arcno, arcno_o); return arc; } /*!\brief - * Constructs a non-vertical arc with two non-interior ends at + * Constructs a non-vertical arc with two non-interior ends at * the left and right boundary (branch I) * * \param c The supporting curve @@ -363,32 +363,32 @@ public: Arc_2 arc(c, arcno); return arc; } - + /*!\brief * Constructs a non-vertical arc with two ends approaching vertical * asymptotes (branch II). * * \param asympt_x1 The x-coordinate of the first asymptote - * \param inf_end1 Arc is approaching the bottom or top boundary at + * \param inf_end1 Arc is approaching the bottom or top boundary at * \c asympt_x1 * \param asympt_x2 The x-coordinate of the second asymptote - * \param inf_end2 Arc is approaching the bottom or top boundary at + * \param inf_end2 Arc is approaching the bottom or top boundary at * \c asympt_x2 * \return The constructed branch * * \pre asympt_x1 != asympt_x2 */ - Arc_2 operator()(const Coordinate_1& asympt_x1, + Arc_2 operator()(const Coordinate_1& asympt_x1, CGAL::Arr_curve_end inf_end1, - const Coordinate_1& asympt_x2, + const Coordinate_1& asympt_x2, CGAL::Arr_curve_end inf_end2, const Curve_analysis_2& c, int arcno) { Arc_2 arc(asympt_x1, inf_end1, asympt_x2, inf_end2, c, arcno); return arc; } - + /*!\brief - * Construct a non-vertical arc with one left- or right-boundary end + * Construct a non-vertical arc with one left- or right-boundary end * and one end that approaches a vertical asymptote (branch III) * * \param inf_endx Defining whether the arc emanates from the left or right @@ -398,38 +398,38 @@ public: * asympt_x * \return The constructed branch */ - Arc_2 operator()(CGAL::Arr_curve_end inf_endx, + Arc_2 operator()(CGAL::Arr_curve_end inf_endx, const Coordinate_1& asympt_x, - CGAL::Arr_curve_end inf_endy, + CGAL::Arr_curve_end inf_endy, const Curve_analysis_2& c, int arcno) { Arc_2 arc(inf_endx, asympt_x, inf_endy, c, arcno); return arc; } - + //!@} //!\name Constructing vertical arcs //!@{ - - /*!\brief - * Constructs a vertical arc with two interior end-points + + /*!\brief + * Constructs a vertical arc with two interior end-points * (vertical segment) * * \param p The first end-point * \param q The second end-point * \param c The supporting curve * \return The constructed arc - * + * * \pre p != q && p.x() == q.x() * \pre c must have a vertical component at this x */ - Arc_2 operator()(const Point_2& p, const Point_2& q, + Arc_2 operator()(const Point_2& p, const Point_2& q, const Curve_analysis_2& c) { Arc_2 arc(p,q,c); return arc; } - + /*!\brief - * Constructs a vertical arc with one interior end-point and + * Constructs a vertical arc with one interior end-point and * one that reaches the bottom or top boundary (vertical ray) * * \param origin The interior end-point @@ -440,18 +440,18 @@ public: */ Arc_2 operator()(const Point_2& origin, CGAL::Arr_curve_end inf_end, const Curve_analysis_2& c) { - + Arc_2 arc(origin, inf_end, c); return arc; } - + /*!\brief * Constructs a vertical arc that connects bottom with top boundary * (vertical branch) * * \param x The x-coordinate of the branch * \return The constructed branch - * + * * \pre c must have a vertical line component at this x */ Arc_2 operator()(const Coordinate_1& x, const Curve_analysis_2& c) { @@ -464,7 +464,7 @@ public: * Functor that checks whether a given arc is vertical */ template < class CurvedKernelViaAnalysis_2 > -class Is_vertical_2 : public +class Is_vertical_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -472,18 +472,18 @@ public: typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; - + CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES //! the result type typedef bool result_type; - + //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -507,26 +507,26 @@ public: * Functor constructing minimum point of an arc (if interior) */ template < class CurvedKernelViaAnalysis_2 > -class Construct_min_vertex_2 : public +class Construct_min_vertex_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { - + public: //! this instance' first template parameter typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; - + CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef Point_2 result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -544,7 +544,7 @@ public: * \pre minimum end-point is interior */ result_type operator()(const Arc_2& cv) const { - + return cv.curve_end(CGAL::ARR_MIN_END); } }; @@ -553,26 +553,26 @@ public: * Functor constructing maximum point of an arc (if interior) */ template < class CurvedKernelViaAnalysis_2 > -class Construct_max_vertex_2 : public +class Construct_max_vertex_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { - + public: //! this instance' first template parameter typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; - + CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef Point_2 result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -590,7 +590,7 @@ public: * \pre maximum end-point is interior */ result_type operator()(const Arc_2& cv) const { - + return cv.curve_end(CGAL::ARR_MAX_END); } }; @@ -599,24 +599,24 @@ public: * Functor constructing an interior point of on an arc. */ template < class CurvedKernelViaAnalysis_2 > -class Construct_interior_vertex_2 : public +class Construct_interior_vertex_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { - + public: //! this instance' first template parameter typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; - + CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef Point_2 result_type; - /*!\brief + /*!\brief * Standard constructor * * \param kernel The kernel @@ -634,27 +634,27 @@ public: result_type operator()(const Arc_2& arc) const { Point_2 p = compute_interior_vertex(arc); CGAL_postcondition(this->_ckva()->is_on_2_object()(p,arc)); - return p; + return p; } - + private: - + result_type compute_interior_vertex(const Arc_2& arc) const { - + typedef typename Curved_kernel_via_analysis_2::Curve_2 Curve_analysis_2; - - typedef typename Curved_kernel_via_analysis_2::Curve_kernel_2 + + typedef typename Curved_kernel_via_analysis_2::Curve_kernel_2 Algebraic_curve_kernel_2; typedef typename Algebraic_curve_kernel_2::Bound Bound; typedef typename Algebraic_curve_kernel_2::Coordinate_1 Coordinate_1; - + typedef CGAL::Polynomial< Bound > Poly_rat_1; typedef CGAL::Polynomial< Poly_rat_1 > Poly_rat_2; - + typedef CGAL::Polynomial_traits_d< Poly_rat_1 > PT_rat_1; typedef CGAL::Polynomial_traits_d< Poly_rat_2 > PT_rat_2; - + typedef CGAL::Fraction_traits< Poly_rat_2 > FT_2; if (!arc.is_vertical()) @@ -662,13 +662,13 @@ public: Bound x_coord = arc.boundary_in_x_range_interior(); int arcno = arc.arcno(); const Curve_analysis_2& ca = arc.curve(); - + Point_2 p = Curved_kernel_via_analysis_2::instance(). - construct_point_on_arc_2_object() + construct_point_on_arc_2_object() (Coordinate_1(x_coord), ca, arcno, arc); return p; } - + Bound y_coord = 0; if (arc.is_finite(ARR_MIN_END)) { @@ -682,37 +682,37 @@ public: } else { - std::pair approx_pair = + std::pair approx_pair = Curved_kernel_via_analysis_2::instance().kernel(). - approximate_relative_y_2_object() + approximate_relative_y_2_object() (arc.curve_end(ARR_MIN_END).xy(),4); y_coord = approx_pair.second + Bound(1); - + } } else { if (arc.is_finite(ARR_MAX_END)) { - std::pair approx_pair = + std::pair approx_pair = Curved_kernel_via_analysis_2::instance().kernel(). - approximate_relative_y_2_object() + approximate_relative_y_2_object() (arc.curve_end(ARR_MAX_END).xy(),4); y_coord = approx_pair.first-Bound(1); } } - + /*! \todo Try to remove this polynomial stuff */ typename PT_rat_1::Construct_polynomial cp1; - Poly_rat_2 poly2 = typename PT_rat_2::Construct_polynomial() + Poly_rat_2 poly2 = typename PT_rat_2::Construct_polynomial() (cp1(-y_coord), cp1(Bound(1))); - + typename FT_2::Denominator_type dummy; typename FT_2::Numerator_type curve_poly; typename FT_2::Decompose() (poly2, curve_poly, dummy); - + Curve_analysis_2 curve = Curved_kernel_via_analysis_2::instance(). - kernel().construct_curve_2_object()(curve_poly); + kernel().construct_curve_2_object()(curve_poly); Point_2 p = Curved_kernel_via_analysis_2::instance(). construct_point_on_arc_2_object()(arc.x(), curve, 0, arc); return p; @@ -724,26 +724,26 @@ public: * Functor that compares x-coordinates of two interior points */ template < class CurvedKernelViaAnalysis_2 > -class Compare_x_2 : public +class Compare_x_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { - + public: //! this instance' first template parameter typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef CGAL::Comparison_result result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -751,7 +751,7 @@ public: Compare_x_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { } - + /*!\brief * Compare the x-coordinates of two points. * @@ -772,7 +772,7 @@ public: * Functor that compares coordinates of two interior points lexicographically */ template < class CurvedKernelViaAnalysis_2 > -class Compare_xy_2 : public +class Compare_xy_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -780,18 +780,18 @@ public: typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef CGAL::Comparison_result result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -800,13 +800,13 @@ public: Base(kernel) { } - /*!\brief + /*!\brief * Compares two points lexigoraphically: by x, then by y. * \param p1 The first point. * \param p2 The second point. - * \return CGAL::LARGER if x(p1) > x(p2), + * \return CGAL::LARGER if x(p1) > x(p2), * or if x(p1) = x(p2) and y(p1) > y(p2); - * CGAL::SMALLER if x(p1) \< x(p2), + * CGAL::SMALLER if x(p1) \< x(p2), * or if x(p1) = x(p2) and y(p1) \< y(p2); * CGAL::EQUAL if the two points are equal. */ @@ -814,7 +814,7 @@ public: bool equal_x = false) const { // TODO add CGAL_precondition(p1.location() == CGAL::ARR_INTERIOR); // TODO add CGAL_precondition(p2.location() == CGAL::ARR_INTERIOR); - + CERR("\ncompare_xy; p1: " << p1 << ";\n p2:" << p2 << ""); @@ -836,30 +836,30 @@ public: }; /*!\brief - * Functor that computes relative vertical alignment of an interior point and + * Functor that computes relative vertical alignment of an interior point and * an arc */ template < class CurvedKernelViaAnalysis_2 > -class Compare_y_at_x_2 : public +class Compare_y_at_x_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { - + public: //! this instance' first template parameter typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef CGAL::Comparison_result result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -870,10 +870,10 @@ public: /*!\brief * Return the relative vertical alignment of a point with an arc - * + * * \param p The point * \param cv The arc - * \return CGAL::SMALLER if y(p) \< cv(x(p)), i.e., + * \return CGAL::SMALLER if y(p) \< cv(x(p)), i.e., * the point is below the arc; * CGAL::LARGER if y(p) > cv(x(p)), i.e., * the point is above the arc; @@ -883,9 +883,9 @@ public: * */ result_type operator()(const Point_2& p, const Arc_2& cv) const { - + CGAL_precondition(p.is_finite()); - + CERR("\ncompare_y_at_x; p: " << p << ";\n cv:" << cv << "\n"); bool eq_min, eq_max; @@ -912,7 +912,7 @@ public: } if (cv.is_finite(CGAL::ARR_MAX_END)) { - if (cmp_xy(p.xy(), cv._maxpoint().xy(), true) == + if (cmp_xy(p.xy(), cv._maxpoint().xy(), true) == CGAL::LARGER) { CERR("cmp result: " << CGAL::LARGER << "\n"); return CGAL::LARGER; @@ -922,12 +922,12 @@ public: return CGAL::EQUAL; // p lies on a vertical arc } CGAL::Comparison_result res; - if (eq_min) { + if (eq_min) { if(cv._minpoint().is_finite()){ res = cmp_xy(p.xy(), cv._minpoint().xy(), true); }else{ res = (cv.location(CGAL::ARR_MIN_END)==ARR_TOP_BOUNDARY)? - CGAL::SMALLER : CGAL::LARGER; + CGAL::SMALLER : CGAL::LARGER; } } else if (eq_max) { CGAL_precondition(p.is_finite()); @@ -935,13 +935,13 @@ public: res = cmp_xy(p.xy(), cv._maxpoint().xy(), true); }else{ res = (cv.location(CGAL::ARR_MAX_END)==ARR_TOP_BOUNDARY)? - CGAL::SMALLER : CGAL::LARGER; + CGAL::SMALLER : CGAL::LARGER; } } else { Point_2 point_on_s = Base::_ckva()->construct_point_on_arc_2_object() (p.x(), cv.curve(), cv.arcno(), cv ); - + CGAL_precondition(p.is_finite()); CGAL_precondition(point_on_s.is_finite()); res = cmp_xy(p.xy(), point_on_s.xy(), true); @@ -956,26 +956,26 @@ public: * of a point */ template < class CurvedKernelViaAnalysis_2 > -class Compare_y_at_x_left_2 : public +class Compare_y_at_x_left_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { - + public: //! this instance' first template parameter typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef CGAL::Comparison_result result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -983,19 +983,19 @@ public: Compare_y_at_x_left_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { } - + /*!\brief - * Compares the relative vertical alignment of two arcs - * immediately to the left of one of their intersection points. - * - * If one of the arcs is vertical (emanating downward from p), it is + * Compares the relative vertical alignment of two arcs + * immediately to the left of one of their intersection points. + * + * If one of the arcs is vertical (emanating downward from p), it is * always considered to be below the other curve. * * \param cv1 The first arc * \param cv2 The second arc * \param p The intersection point. - * \return The relative vertical alignment of cv1 with respect to cv2 - * immediately to the left of p: CGAL::SMALLER, CGAL::LARGER or + * \return The relative vertical alignment of cv1 with respect to cv2 + * immediately to the left of p: CGAL::SMALLER, CGAL::LARGER or CGAL::EQUAL. * * \pre The point p lies on both curves, and both of them must be also be @@ -1007,20 +1007,20 @@ public: CERR("\ncompare_y_at_x_left(cv2); cv1: " << cv1 << "; cv2: " << cv2 << "; p: " << p << "\n"); - // ensure that p lies on both arcs + // ensure that p lies on both arcs CGAL_precondition(cv1.compare_y_at_x(p) == CGAL::EQUAL); CGAL_precondition(cv2.compare_y_at_x(p) == CGAL::EQUAL); - + // check whether both arcs indeed lie to the left of p CGAL_precondition( - (cv1.is_vertical() && - cv1.location(CGAL::ARR_MIN_END) == + (cv1.is_vertical() && + cv1.location(CGAL::ARR_MIN_END) == CGAL::ARR_BOTTOM_BOUNDARY) || cv1._same_arc_compare_xy(cv1._minpoint(), p) == CGAL::SMALLER ); CGAL_precondition( (cv2.is_vertical() && - cv2.location(CGAL::ARR_MIN_END) == CGAL::ARR_BOTTOM_BOUNDARY) + cv2.location(CGAL::ARR_MIN_END) == CGAL::ARR_BOTTOM_BOUNDARY) || cv2._same_arc_compare_xy(cv2._minpoint(), p) == CGAL::SMALLER ); @@ -1032,29 +1032,29 @@ public: // a vertical arc is always smaller than the arc extending to the // left return CGAL::SMALLER; - } + } // a vertical arc is always smaller than the arc extending to the left; // due to the order, we have to return the opposite if (cv2.is_vertical()) { return CGAL::LARGER; } - + if (cv1.is_singular()) {// singularity in y CGAL_error_msg("Handling singularity in y is not yet implemented"); } - + // vertical line immediately to the left of p: if p lies on boundary // get the vertical line over the last interval; otherwise // obtain the interval w.r.t. point's x-coordinate (this also valid // for discontinuity in y) - /*if(bndp_x == CGAL::BEFORE_SINGULARITY || + /*if(bndp_x == CGAL::BEFORE_SINGULARITY || bndp_x == CGAL::BEFORE_DISCONTINUITY) return _compare_arc_numbers(cv2, bndp_x); else*/ - CGAL::Comparison_result res = + CGAL::Comparison_result res = cv1._compare_arc_numbers(cv2, - CGAL::ARR_INTERIOR, + CGAL::ARR_INTERIOR, p.x(), CGAL::NEGATIVE); CERR("result: " << res << "\n"); return res; @@ -1067,26 +1067,26 @@ public: * of a point */ template < class CurvedKernelViaAnalysis_2 > -class Compare_y_at_x_right_2 : public +class Compare_y_at_x_right_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { - + public: //! this instance' first template parameter typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef CGAL::Comparison_result result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -1096,17 +1096,17 @@ public: } /*!\brief - * Compares the relative vertical alignment of two arcs - * immediately to the right of one of their intersection points. - * - * If one of the arcs is vertical (emanating downward from p), it is + * Compares the relative vertical alignment of two arcs + * immediately to the right of one of their intersection points. + * + * If one of the arcs is vertical (emanating downward from p), it is * always considered to be below the other curve. * * \param cv1 The first arc * \param cv2 The second arc * \param p The intersection point. - * \return The relative vertical alignment of cv1 with respect to cv2 - * immediately to the right of p: CGAL::SMALLER, CGAL::LARGER or + * \return The relative vertical alignment of cv1 with respect to cv2 + * immediately to the right of p: CGAL::SMALLER, CGAL::LARGER or CGAL::EQUAL. * * \pre The point p lies on both curves, and both of them must be also be @@ -1117,15 +1117,15 @@ public: CERR("\ncompare_y_at_x_right; cv1: " << cv1 << "; cv2: " << cv2 << "; p: " << p << "\n"); - + // ensure that p lies on both arcs and doesn't lie on the positive // boundary CGAL_precondition(cv1.compare_y_at_x(p) == CGAL::EQUAL); CGAL_precondition(cv2.compare_y_at_x(p) == CGAL::EQUAL); - - // check whether both arcs indeed lie to the left of p + + // check whether both arcs indeed lie to the left of p CGAL_precondition( - (cv1.is_vertical() && + (cv1.is_vertical() && cv1.location(CGAL::ARR_MAX_END) == CGAL::ARR_TOP_BOUNDARY) || cv1._same_arc_compare_xy(p, cv1._maxpoint()) == CGAL::SMALLER ); @@ -1134,7 +1134,7 @@ public: cv2.location(CGAL::ARR_MAX_END) == CGAL::ARR_TOP_BOUNDARY) || cv2._same_arc_compare_xy(p, cv2._maxpoint()) == CGAL::SMALLER ); - + if (cv1.is_vertical()) { // if both are vertical (they overlap), we return EQUAL if (cv2.is_vertical()) { @@ -1143,30 +1143,30 @@ public: // a vertical arc is always LARGER than arc extending to the // right return CGAL::LARGER; - } - // a vertical arc is always LARGER than arc extending to the right; + } + // a vertical arc is always LARGER than arc extending to the right; // due to the order, we have to return the opposite if (cv2.is_vertical()) { return CGAL::SMALLER; } - + if (cv1.is_singular()) {// singularity in y CGAL_error_msg("Handling singularity in y is not yet \ implemented"); } - + // vertical line immediately to the right of p: if p lies on boundary // get the vertical line over the first interval; otherwise // obtain the interval w.r.t. point's x-coordinate (this also valid - // for discontinuity in y) - /*if(bndp_x == CGAL::AFTER_SINGULARITY || + // for discontinuity in y) + /*if(bndp_x == CGAL::AFTER_SINGULARITY || bndp_x == CGAL::AFTER_DISCONTINUITY) return _compare_arc_numbers(cv2, bndp_x); else*/ - CGAL::Comparison_result res = + CGAL::Comparison_result res = cv1._compare_arc_numbers(cv2, - CGAL::ARR_INTERIOR, - p.x(), + CGAL::ARR_INTERIOR, + p.x(), CGAL::POSITIVE); CERR("result: " << res << "\n"); return res; @@ -1177,26 +1177,26 @@ public: * Functor that checks whether a point is in the x-range of an arc */ template < class CurvedKernelViaAnalysis_2 > -class Is_in_x_range_2 : public +class Is_in_x_range_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { - + public: //! this instance' first template parameter typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef bool result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -1204,10 +1204,10 @@ public: Is_in_x_range_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { } - + /*!\brief * Check whether a given point lies within the curve's x-range - * + * * \param cv The arc * \param p the point * \return \c true if p lies in arc's x-range; \c false otherwise. @@ -1221,7 +1221,7 @@ public: * Tests two objects, whether they are equal */ template < class CurvedKernelViaAnalysis_2 > -class Equal_2 : public +class Equal_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -1229,18 +1229,18 @@ public: typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef bool result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -1248,7 +1248,7 @@ public: Equal_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { } - + /*!\brief * Check if the two points are the same * @@ -1258,13 +1258,13 @@ public: */ result_type operator()(const Point_2& p1, const Point_2& p2) const { return (Curved_kernel_via_analysis_2::instance(). - compare_xy_2_object()(p1, p2) == + compare_xy_2_object()(p1, p2) == CGAL::EQUAL); } - - /*!\brief - * Check if the two arcs are the same - * + + /*!\brief + * Check if the two arcs are the same + * * \param cv1 The first arc * \param cv2 The second arc * \return \c true if the two curves are the same; \c false otherwise. @@ -1278,27 +1278,27 @@ public: if (cv1.is_vertical() != cv2.is_vertical()) { return false; } - + Arc_2::simplify(cv1,cv2); // distinct supporting curves implies inequality, provided the // coprimality condition is satisfied if (!cv1.curve().is_identical(cv2.curve())) { return false; } - + // here either both or none of the arcs are vertical, check for arcnos // equality if (!cv1.is_vertical() && cv1.arcno() != cv2.arcno()) { return false; } - // otherwise compare respective curve ends: supporting curves and + // otherwise compare respective curve ends: supporting curves and // arcnos are equal => the curve ends belong to the same arc return ((cv1._same_arc_compare_xy(cv1._minpoint(), cv2._minpoint()) == CGAL::EQUAL && cv1._same_arc_compare_xy(cv1._maxpoint(), cv2._maxpoint()) == CGAL::EQUAL)); } - + }; @@ -1306,26 +1306,26 @@ public: * Functor that checks whether two arcs overlap */ template < class CurvedKernelViaAnalysis_2 > -class Do_overlap_2 : public +class Do_overlap_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { - + public: //! this instance' first template parameter typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef bool result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -1333,7 +1333,7 @@ public: Do_overlap_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { } - + /*!\brief * Check whether two given arcs overlap, i.e., they have infinitely * many intersection points @@ -1343,18 +1343,18 @@ public: * \return \c true if the curves overlap; \c false otherwise */ bool operator()(const Arc_2& cv1, const Arc_2& cv2) const { - + CERR("\ndo_overlap\n"); if (cv1.is_identical(cv2)) { return true; } - + Arc_2::simplify(cv1, cv2); - // arcs with coprime support do not overlap + // arcs with coprime support do not overlap if (!cv1.curve().is_identical(cv2.curve())) { return false; } - + if (cv1.is_vertical() != cv2.is_vertical()) { return false; // only one arc is vertical => can't overlap } @@ -1371,16 +1371,16 @@ public: cv1._minpoint(), cv2._minpoint(), true) ) { case CGAL::EQUAL: // this->source == cv2->source => overlap ! - return true; + return true; case CGAL::SMALLER: // this->source < cv2->source // check whether this->target > cv2->source return (cv1._same_arc_compare_xy( - cv1._maxpoint(), cv2._minpoint(), + cv1._maxpoint(), cv2._minpoint(), true) == CGAL::LARGER); case CGAL::LARGER: // this->source > cv2->source // check whether this->source < cv2->target return (cv1._same_arc_compare_xy( - cv1._minpoint(), cv2._maxpoint(), + cv1._minpoint(), cv2._maxpoint(), true) == CGAL::SMALLER); } } @@ -1395,16 +1395,16 @@ public: cv1._minpoint(), cv2._minpoint(), false, true) ) { case CGAL::EQUAL: // this->source == cv2->source => overlap ! - return true; + return true; case CGAL::SMALLER: // this->source < cv2->source // check whether this->target > cv2->source return (cv1._same_arc_compare_xy( - cv1._maxpoint(), cv2._minpoint(), false, + cv1._maxpoint(), cv2._minpoint(), false, true) == CGAL::LARGER); case CGAL::LARGER: // this->source > cv2->source // check whether this->source < cv2->target return (cv1._same_arc_compare_xy( - cv1._minpoint(), cv2._maxpoint(), false, + cv1._minpoint(), cv2._maxpoint(), false, true) == CGAL::SMALLER); } CGAL_error_msg("bogus comparison result"); @@ -1417,7 +1417,7 @@ public: * Functor that computes the intersections of two arcs */ template < class CurvedKernelViaAnalysis_2 > -class Intersect_2 : public +class Intersect_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -1425,19 +1425,19 @@ public: typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type - typedef std::iterator< std::output_iterator_tag, CGAL::Object > + typedef std::iterator< std::output_iterator_tag, CGAL::Object > result_type; - + //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -1445,15 +1445,15 @@ public: Intersect_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { } - + // TODO add operators for non-x-monotone arcs + curves (i.e., all combis) - + /*!\brief - * Find all intersections of the two given arcs and insert them to the - * output iterator. + * Find all intersections of the two given arcs and insert them to the + * output iterator. * - * Type of output iterator is \c CGAL::Object - * containing either an \c Arc_2 object (overlap) or a \c + * Type of output iterator is \c CGAL::Object + * containing either an \c Arc_2 object (overlap) or a \c * std::pair< Point_2, unsigned int >, where the unsigned int denotes * the multiplicity of the zero-dimensional intersection (0 if unknown) * @@ -1465,10 +1465,10 @@ public: template < class OutputIterator > OutputIterator operator()(const Arc_2& cv1, const Arc_2& cv2, OutputIterator oi) const { - - CERR("\nintersect; cv1: " << cv1 + + CERR("\nintersect; cv1: " << cv1 << ";\n cv2:" << cv2 << ""); - + // if arcs overlap, just store their common part, otherwise compute // point-wise intersections std::vector< Arc_2 > common_arcs; @@ -1477,9 +1477,9 @@ public: for(it = common_arcs.begin(); it < common_arcs.end(); it++) { *oi++ = CGAL::make_object(*it); } - return oi; + return oi; } - // process non-ov erlapping case + // process non-ov erlapping case typedef std::pair< Point_2, unsigned int > Point_and_mult; typedef std::vector< Point_and_mult > Point_vector; Point_vector vec; @@ -1499,26 +1499,26 @@ public: * Functors that trims an arc */ template < class CurvedKernelViaAnalysis_2 > -class Trim_2 : public +class Trim_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { - + public: //! this instance' first template parameter typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef Arc_2 result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -1526,10 +1526,10 @@ public: Trim_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { } - + /*!\brief * Returns a trimmed version of an arc - * + * * \param cv The arc * \param p the new first endpoint * \param q the new second endpoint @@ -1539,15 +1539,15 @@ public: * \pre both points must be interior and must lie on \c cv */ Arc_2 operator()(const Arc_2& cv, const Point_2& p, const Point_2& q) { - + CERR("trim\n"); CGAL_precondition(p.location() == CGAL::ARR_INTERIOR); CGAL_precondition(q.location() == CGAL::ARR_INTERIOR); - + CGAL_precondition(!Base::_ckva()->equal_2_object()(p, q)); CGAL_precondition(cv.compare_y_at_x(p) == CGAL::EQUAL); - CGAL_precondition(cv.compare_y_at_x(q) == CGAL::EQUAL); + CGAL_precondition(cv.compare_y_at_x(q) == CGAL::EQUAL); return cv._trim(p, q); } @@ -1558,26 +1558,26 @@ public: * Functor that splits a arc at an interior point */ template < class CurvedKernelViaAnalysis_2 > -class Split_2 : public +class Split_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { - + public: //! this instance' first template parameter typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef void result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -1585,25 +1585,25 @@ public: Split_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { } - + /*!\brief * Split a given arc at a given point into two sub-arcs - * + * * \param cv The arc to split * \param p The split point * \param c1 Output: The left resulting subcurve (p is its right endpoint) * \param c2 Output: The right resulting subcurve (p is its left endpoint) - * + * * \pre p lies on cv but is not one of its end-points. */ void operator()(const Arc_2& cv, const Point_2 & p, Arc_2& c1, Arc_2& c2) const { - + CGAL_precondition(cv.compare_y_at_x(p) == CGAL::EQUAL); // check that p is not an end-point of the arc CGAL_precondition(cv._same_arc_compare_xy(cv._minpoint(), p) != CGAL::EQUAL); CGAL_precondition(cv._same_arc_compare_xy(cv._maxpoint(), p) != CGAL::EQUAL); - + CERR("\nsplit\n"); c1 = cv._replace_endpoints( cv._minpoint(), p, -1, (cv.is_vertical() ? -1 : cv.arcno()) @@ -1618,26 +1618,26 @@ public: * Functor that computes whether two arcs are mergeable */ template < class CurvedKernelViaAnalysis_2 > -class Are_mergeable_2 : public +class Are_mergeable_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { - + public: //! this instance' first template parameter typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef bool result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -1645,7 +1645,7 @@ public: Are_mergeable_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { } - + /*!\brief * Check whether two given arcs are mergeable * @@ -1655,59 +1655,59 @@ public: * by the same curve and share a common endpoint; \c false otherwise. */ bool operator()(const Arc_2& cv1, const Arc_2& cv2) const { - + CERR("\nare_mergeable\n"); - + if (cv1.do_overlap(cv2)) {// if arcs overlap they are not mergeable return false; // this also call simplify } - + // touch in at most one point now and supporting curves are simplified // both arcs must be either vertical or not - if (!cv1.curve().is_identical(cv2.curve()) || + if (!cv1.curve().is_identical(cv2.curve()) || cv1.is_vertical() != cv2.is_vertical()) { return false; } // if both arcs are non-vertical => they must have equal arcnos - // to be mergeable + // to be mergeable if (!cv1.is_vertical() && cv1.arcno() != cv2.arcno()) { return false; } // for non-vertical arcs arc numbers are equal => can use same_arc_cmp - bool max_min = - (cv1._same_arc_compare_xy(cv1._maxpoint(), cv2._minpoint()) == + bool max_min = + (cv1._same_arc_compare_xy(cv1._maxpoint(), cv2._minpoint()) == CGAL::EQUAL), min_max = false; if (!max_min) { // both cases cannot happen simultaneously - min_max = - (cv1._same_arc_compare_xy(cv1._minpoint(), cv2._maxpoint()) == + min_max = + (cv1._same_arc_compare_xy(cv1._minpoint(), cv2._maxpoint()) == CGAL::EQUAL); if (!min_max) { // arcs have no common end-point => not mergeable return false; } } // check that the common point is not an event point - if (cv1.is_vertical()) { // both arcs are vertical + if (cv1.is_vertical()) { // both arcs are vertical Point_2 common = (max_min ? cv1._maxpoint() : cv1._minpoint()); // a common end must be a finite point CGAL_precondition(cv1.is_interior(common.location())); - // check that there are no other non-vertical branches coming + // check that there are no other non-vertical branches coming // through this point - + Curve_analysis_2 ca_2(cv1.curve()); - typename Curve_analysis_2::Status_line_1 cv_line = + typename Curve_analysis_2::Status_line_1 cv_line = ca_2.status_line_for_x(common.x()); CGAL_assertion(cv_line.is_event()); // ?? // we are not allowed to use number_of_incident_branches() - // since the common point might be supported by different curve, + // since the common point might be supported by different curve, // and therefore its arcno might be not valid for *this arc for (int k = 0; k < cv_line.number_of_events(); k++) { // use a temporary object for comparison predicate typename Point_2::Coordinate_2 tmp(common.x(), cv1.curve(), k); if (Curved_kernel_via_analysis_2::instance(). kernel().compare_xy_2_object()( - common.xy(), tmp) == + common.xy(), tmp) == CGAL::EQUAL) { return false; } @@ -1715,7 +1715,7 @@ public: } else if (cv1.interval_id() != cv2.interval_id()) { return false; // non-vertical case } - + return true; } }; @@ -1724,26 +1724,26 @@ public: * Functor that merges two arcs */ template < class CurvedKernelViaAnalysis_2 > -class Merge_2 : public +class Merge_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { - + public: //! this instance' first template parameter typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef void result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -1758,26 +1758,26 @@ public: * \param cv1 The first arc * \param cv2 The second arc * \param c Output: The resulting arc - * + * * \pre The two arcs are mergeable, that is they are supported by the * same curve and share a common endpoint. - */ + */ void operator()(const Arc_2& cv1, const Arc_2& cv2, Arc_2& c) const { - + CERR("merge\n"); CGAL_precondition(cv1.are_mergeable(cv2)); Arc_2::simplify(cv1, cv2); - + Point_2 src, tgt; int arcno_s = -1, arcno_t = -1; bool replace_src; // true if cv2 < *this otherwise *this arc < cv2 arc // arcs are mergeable => they have one common finite end-point - replace_src = - (cv1._same_arc_compare_xy(cv1._minpoint(), cv2._maxpoint()) == + replace_src = + (cv1._same_arc_compare_xy(cv1._minpoint(), cv2._maxpoint()) == CGAL::EQUAL); src = (replace_src ? cv2._minpoint() : cv1._minpoint()); tgt = (replace_src ? cv1._maxpoint() : cv2._maxpoint()); - + if (!cv1.is_vertical()) { arcno_s = (replace_src ? cv2.arcno(CGAL::ARR_MIN_END) : cv1.arcno(CGAL::ARR_MIN_END)); @@ -1787,7 +1787,7 @@ public: Arc_2 arc = cv1._replace_endpoints(src, tgt, arcno_s, arcno_t).first; // arc.set_boundaries_after_merge(*this, s); - no need to, since // boundaries are stored in Point_2 type and will be copied implicitly - + c = arc; } }; @@ -1797,7 +1797,7 @@ public: * Functor that computes whether a point lies on a supporting curve */ template < class CurvedKernelViaAnalysis_2 > -class Is_on_2 : public +class Is_on_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -1805,18 +1805,18 @@ public: typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef bool result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -1824,16 +1824,16 @@ public: Is_on_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { } - + /*!\brief - * Checks whether \c p lies on \c c - * + * Checks whether \c p lies on \c c + * * \param p The point to test * \param c The curve * \return \c true if the \c p lies on \c c, \c false otherwise */ result_type operator()(const Point_2& p, const Curve_analysis_2& c) const { - result_type res = + result_type res = (Curved_kernel_via_analysis_2::instance(). kernel().sign_at_2_object()(c, p.xy()) == CGAL::ZERO); @@ -1841,24 +1841,24 @@ public: } /*!\brief - * Checks whether \c p lies on \c cv - * + * Checks whether \c p lies on \c cv + * * \param p The point to test * \param c The curve arc * \return \c true if the \c p lies on \c cv, \c false otherwise */ result_type operator()(const Point_2& p, const Arc_2& cv) const { - // fix by Michael Hemmer: + // fix by Michael Hemmer: if(cv.is_in_x_range(p.x())){ return cv.compare_y_at_x(p) == CGAL::EQUAL; } - return false; - + return false; + // This is the old code that seems to interpret the arc as open - // In particular, it returns false for vertical arcs. + // In particular, it returns false for vertical arcs. // (Michael Hemmer) // bool is_left, is_right; -// result_type res = +// result_type res = // (cv.is_in_x_range(p.x(),&is_left,&is_right)) && // !(is_left) && // !(is_right) && @@ -1869,11 +1869,11 @@ public: }; -/*!\brief +/*!\brief * Functor that decomposes curve into x-monotone arcs and isolated points */ template < class CurvedKernelViaAnalysis_2 > -class Make_x_monotone_2 : public +class Make_x_monotone_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -1881,32 +1881,32 @@ public: typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type - typedef std::iterator< std::output_iterator_tag, CGAL::Object > + typedef std::iterator< std::output_iterator_tag, CGAL::Object > result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel */ Make_x_monotone_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { - } + } /*!\brief - * Decomposes a given arc into list of x-monotone arcs - * (subcurves) and insert them to the output iterator. Since \c Arc_2 - * is by definition x-monotone, an input arc is passed to the - * output iterator directly. + * Decomposes a given arc into list of x-monotone arcs + * (subcurves) and insert them to the output iterator. Since \c Arc_2 + * is by definition x-monotone, an input arc is passed to the + * output iterator directly. * * \param cv The arc * \param oi The output iterator, whose value-type is Object @@ -1915,15 +1915,15 @@ public: */ template < class OutputIterator > OutputIterator operator()(const Arc_2& cv, OutputIterator oi) const { - + *oi++ = CGAL::make_object(cv); return oi; } - - /*!\brief + + /*!\brief * Decomposes a given curve into list of x-monotone arcs - * (subcurves) and isolated points and insert them to the output iterator. - * + * (subcurves) and isolated points and insert them to the output iterator. + * * \param cv The curve * \param oi The output iterator, whose value-type is Object. * The returned objects either wrapper Arc_2 or Point_2 objects @@ -1932,7 +1932,7 @@ public: template < class OutputIterator > OutputIterator operator()(const Curve_analysis_2& cv, OutputIterator oi) const { - + CGAL::internal::Make_x_monotone_2< Curved_kernel_via_analysis_2 > make_x_monotone(Base::_ckva()); @@ -1956,7 +1956,7 @@ public: Curve_analysis_2 curve; Non_x_monotone_arc_2 nxarc; - if(CGAL::assign(curve, obj)) + if(CGAL::assign(curve, obj)) oi = (*this)(curve, oi); else if(CGAL::assign(nxarc, obj)) std::cerr << "AU BACKE" << std::endl; @@ -1975,7 +1975,7 @@ public: * Functor computing parameter space in x for arc */ template < class CurvedKernelViaAnalysis_2 > -class Parameter_space_in_x_2 : public +class Parameter_space_in_x_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -1983,18 +1983,18 @@ public: typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; - + CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef CGAL::Arr_parameter_space result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -2002,7 +2002,7 @@ public: Parameter_space_in_x_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { } - + /*! Obtains the parameter space in x at the end of an arc. * * \param cv The arc @@ -2010,7 +2010,7 @@ public: * ARR_MIN_END - the minimal end of cv * ARR_MAX_END - the maximal end of cv * \return the parameter space at the \c ce end of \c cv - * ARR_LEFT_BOUNDARY - the arc approaches the left boundary of the + * ARR_LEFT_BOUNDARY - the arc approaches the left boundary of the * parameter space * ARR_INTERIOR - the arc does not approach a boundary of the * parameter space @@ -2035,7 +2035,7 @@ public: * Functor that compares ends of arcs near left or right boundary */ template < class CurvedKernelViaAnalysis_2 > -class Compare_y_near_boundary_2 : public +class Compare_y_near_boundary_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -2043,18 +2043,18 @@ public: typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef CGAL::Comparison_result result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -2066,7 +2066,7 @@ public: /*!\brief * Compare the y-coordinates of 2 arcs at their ends near the left * or right boundary of the parameter space - * + * * \param cv1 the first arc. * \param cv2 the second arc. * \param ce the arc end indicator. @@ -2080,13 +2080,13 @@ public: */ result_type operator()(const Arc_2& cv1, const Arc_2& cv2, CGAL::Arr_curve_end ce) const { - + CERR("\ncompare_y_near_boundary; cv1: " << cv1 << "; cv2: " << cv2 << "; end: " << ce << "\n"); - - + + CGAL::Comparison_result res = CGAL::EQUAL; - + CGAL::Arr_parameter_space loc1 = cv1.location(ce); CGAL_precondition(cv1.is_on_left_right(loc1)); CGAL_precondition(loc1 == cv2.location(ce)); @@ -2094,19 +2094,19 @@ public: if (cv1.id() == cv2.id()) { CERR("result: " << res << "\n"); // EQUAL return res; - } - + } + // both points lie on the left-right-identification, i.e., equalx // TODO this interface is NOT official - CGAL::Object obj1 = + CGAL::Object obj1 = cv1.curve().asymptotic_value_of_arc(loc1, cv1.arcno()); - CGAL::Object obj2 = + CGAL::Object obj2 = cv2.curve().asymptotic_value_of_arc(loc1, cv2.arcno()); - + typename Point_2::Curved_kernel_via_analysis_2::Curve_kernel_2:: Algebraic_real_1 y1, y2; CGAL::Arr_parameter_space ps1, ps2; - + if (CGAL::assign(ps1, obj1)) { if (CGAL::assign(ps2, obj2)) { res = CGAL::EQUAL; @@ -2126,17 +2126,17 @@ public: CGAL_assertion_code(bool check = ) CGAL::assign(y2, obj2); CGAL_assertion(check); - + // Remark: Is filtered res = Base::_ckva()->kernel().compare_1_object()(y1, y2); } } - + if (res != EQUAL) { CERR("result: " << res << "\n"); return res; } - + CGAL_precondition(cv1.is_on_left_right(loc1)); CGAL_precondition(loc1 == cv2.location(ce)); // comparing ids is the same as calling is_identical() ?? @@ -2144,8 +2144,8 @@ public: CGAL::Comparison_result res = CGAL::EQUAL; CERR("result: " << res << "\n"); return res; - } - + } + // in this setting same handling as for +/-oo ? res = cv1._compare_arc_numbers(cv2, loc1); CERR("result: " << res << "\n"); @@ -2156,26 +2156,26 @@ public: // bottom-top template < class CurvedKernelViaAnalysis_2 > -class Parameter_space_in_y_2 : public +class Parameter_space_in_y_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { - + public: //! this instance' first template parameter typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; - + CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef CGAL::Arr_parameter_space result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel @@ -2185,13 +2185,13 @@ public: } /*! Obtains the parameter space in y at the end of an arc. - * + * * \param cv The arc * \param ce the arc end indicator: * ARR_MIN_END - the minimal end of cv * ARR_MAX_END - the maximal end of cv * \return the parameter space at the \c ce end of \c cv - * ARR_BOTTOM_BOUNDARY- the arc approaches the bottom boundary of the + * ARR_BOTTOM_BOUNDARY- the arc approaches the bottom boundary of the * parameter space * ARR_INTERIOR - the arc does not approach a boundary of the * parameter space @@ -2199,7 +2199,7 @@ public: * parameter space */ result_type operator()(const Arc_2& cv, CGAL::Arr_curve_end ce) const { - + CGAL::Arr_parameter_space loc = cv.location(ce); if(loc == CGAL::ARR_BOTTOM_BOUNDARY || loc == CGAL::ARR_TOP_BOUNDARY) return loc; @@ -2217,7 +2217,7 @@ public: * Functor that compares x-limits at the top or bottom boundary */ template < class CurvedKernelViaAnalysis_2 > -class Compare_x_at_limit_2 : public +class Compare_x_on_boundary_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -2225,24 +2225,24 @@ public: typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef CGAL::Comparison_result result_type; //! the arity of the functor - Compare_x_at_limit_2(Curved_kernel_via_analysis_2 *kernel) : + Compare_x_on_boundary_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { } /*!\brief Compare the x-limit of a vertical with the x-limit of * an arc end near the boundary at bottom or top boundary - * + * * \param p the point direction. * \param cv the arc, the endpoint of which is compared. * \param ce the arc-end indicator - @@ -2260,15 +2260,15 @@ public: CGAL::Arr_curve_end ce) const { - CERR("\ncompare_x_at_limit: p: " << p << "\n cv: " << + CERR("\ncompare_x_on_boundary: p: " << p << "\n cv: " << cv << "; curve_end: " << ce << "\n"); - + // this curve end has boundary only in y CGAL_precondition(cv.is_on_bottom_top(cv.location(ce))); if (cv.is_singular()) // the curve end goes to contraction => x-order - return CGAL::EQUAL; // doesn't matter + return CGAL::EQUAL; // doesn't matter - CGAL::Comparison_result res = + CGAL::Comparison_result res = Curved_kernel_via_analysis_2::instance(). kernel().compare_1_object()( p.x(), cv.curve_end_x(ce) @@ -2277,7 +2277,7 @@ public: return res; } - /*! Compare the x-limits of 2 arcs ends near the top or bottom + /*! Compare the x-limits of 2 arcs ends near the top or bottom * boundary of the parameter space * \param cv1 the first arc. * \param ce1 the first arc end indicator - @@ -2298,21 +2298,21 @@ public: result_type operator()(const Arc_2& cv1, CGAL::Arr_curve_end ce1, const Arc_2& cv2, CGAL::Arr_curve_end ce2) const { - CERR("\ncompare_x_at_limit: cv1: " << cv1 << "\n cv2: " << + CERR("\ncompare_x_on_boundary: cv1: " << cv1 << "\n cv2: " << cv2 << "; end1: " << ce1 << "; end2: " << ce2 << "\n"); - /*CGAL::Arr_boundary_type bnd1 = boundary(end1), + /*CGAL::Arr_boundary_type bnd1 = boundary(end1), bnd2 = cv2.boundary(ce2);*/ CGAL_precondition_code(CGAL::Arr_parameter_space loc1 = cv1.location(ce1)); CGAL_precondition_code(CGAL::Arr_parameter_space loc2 = cv2.location(ce2)); CGAL_precondition(cv1.is_on_bottom_top(loc1)); CGAL_precondition(cv1.is_on_bottom_top(loc2)); - + if (cv1.is_singular() != cv1.is_singular()) { // only one curve end lies at singularity (another at +/-oo) CGAL_error_msg("SINGULARITY + INF comparison is not yet \ implemented"); } - + CGAL::Comparison_result res = Curved_kernel_via_analysis_2::instance(). kernel().compare_1_object()( cv1.curve_end_x(ce1), @@ -2328,7 +2328,7 @@ public: * Functor that compares x-coordinates near the top or bottom boundary */ template < class CurvedKernelViaAnalysis_2 > -class Compare_x_near_limit_2 : public +class Compare_x_near_boundary_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -2336,22 +2336,22 @@ public: typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef CGAL::Comparison_result result_type; //! the arity of the functor - Compare_x_near_limit_2(Curved_kernel_via_analysis_2 *kernel) : + Compare_x_near_boundary_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { } - /*! Compare the x-coordinates of 2 arcs ends near the top or bottom + /*! Compare the x-coordinates of 2 arcs ends near the top or bottom * boundary of the parameter space * \param cv1 the first arc. * \param cv2 the second arc. @@ -2370,7 +2370,7 @@ public: result_type operator()(const Arc_2& cv1, const Arc_2& cv2, CGAL::Arr_curve_end ce) const { - CERR("\ncompare_x_near_limit: cv1: " << cv1 << "\n cv2: " << + CERR("\ncompare_x_near_boundary: cv1: " << cv1 << "\n cv2: " << cv2 << "; ce: " << ce << "\n"); CGAL::Arr_parameter_space loc1 = cv1.location(ce); @@ -2378,14 +2378,14 @@ public: cv2.location(ce)); CGAL_precondition(cv1.is_on_bottom_top(loc1)); CGAL_precondition(cv1.is_on_bottom_top(loc2)); - CGAL_precondition(cv1.compare_x_at_limit(ce, cv2, ce) == CGAL::EQUAL); + CGAL_precondition(cv1.compare_x_on_boundary(ce, cv2, ce) == CGAL::EQUAL); CGAL_precondition(loc1 == loc2); Coordinate_1 x0(cv1.curve_end_x(ce)); CGAL::Comparison_result res = cv1._compare_arc_numbers( - cv2, CGAL::ARR_INTERIOR, x0, - (ce == CGAL::ARR_MIN_END ? + cv2, CGAL::ARR_INTERIOR, x0, + (ce == CGAL::ARR_MIN_END ? CGAL::POSITIVE : CGAL::NEGATIVE) ); if ((ce == CGAL::ARR_MAX_END && @@ -2400,11 +2400,11 @@ public: }; -/*!\brief +/*!\brief * Functor to construct a point on a curve */ template < class CurvedKernelViaAnalysis_2 > -class Compare_endpoints_xy_2 : public +class Compare_endpoints_xy_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -2412,16 +2412,16 @@ public: typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; - + CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef CGAL::Comparison_result result_type; - /*!\brief + /*!\brief * Standard constructor * * \param kernel The kernel @@ -2432,8 +2432,8 @@ public: /*!\brief * Compares endpoints of arc lexicographically - * - * \param arc the arc + * + * \param arc the arc * \return The order of endpoints */ CGAL::Comparison_result operator()(const Arc_2& xcv) { @@ -2447,11 +2447,11 @@ public: }; -/*!\brief +/*!\brief * Functor to construct a point on a curve */ template < class CurvedKernelViaAnalysis_2 > -class Construct_opposite_2 : public +class Construct_opposite_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -2459,16 +2459,16 @@ public: typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; - + CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES - + //! the result type typedef Arc_2 result_type; - /*!\brief + /*!\brief * Standard constructor * * \param kernel The kernel @@ -2479,7 +2479,7 @@ public: /*!\brief * Construct an arc of opposite direction - * + * * \param arc the arc to be reversed * \return The reversed arc */ @@ -2490,11 +2490,11 @@ public: -/*!\brief +/*!\brief * Functor that computes the x-extreme points of a curve */ template < class CurvedKernelViaAnalysis_2 > -class X_extreme_points_2 : public +class X_extreme_points_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -2502,33 +2502,33 @@ public: typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES typedef typename Curve_analysis_2::Coordinate_2 Coordinate_2; - + //! the result type typedef std::iterator< std::output_iterator_tag, Coordinate_2 > result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel */ X_extreme_points_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { - } + } /*!\brief */ template < class OutputIterator > - OutputIterator operator()(const Curve_analysis_2& ca, + OutputIterator operator()(const Curve_analysis_2& ca, OutputIterator oi) const { typedef typename Curve_analysis_2::Status_line_1 Status_line_1; @@ -2536,9 +2536,9 @@ public: int events = ca.number_of_status_lines_with_event(); for ( int i = 0; i < events; i++ ) { - + Status_line_1 status_line = ca.status_line_at_event(i); - + int lifts = status_line.number_of_events(); for( int j = 0; j < lifts; j++ ) { @@ -2546,20 +2546,20 @@ public: std::pair arcs = status_line.number_of_incident_branches(j); - if (arcs.first == 0 || arcs.second == 0) + if (arcs.first == 0 || arcs.second == 0) *oi++ = status_line.algebraic_real_2(j); } } return oi; } - + }; -/*!\brief +/*!\brief * Functor that computes the y-extreme points of a curve */ template < class CurvedKernelViaAnalysis_2 > -class Y_extreme_points_2 : public +class Y_extreme_points_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -2567,61 +2567,61 @@ public: typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //! the base type - typedef + typedef Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > Base; CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES typedef typename Curve_analysis_2::Coordinate_2 Coordinate_2; - + //! the result type typedef std::iterator< std::output_iterator_tag, Coordinate_2 > result_type; //! the arity of the functor - - /*!\brief + + /*!\brief * Standard constructor * * \param kernel The kernel */ Y_extreme_points_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { - } + } /*!\brief */ template < class OutputIterator > - OutputIterator operator()(const Curve_analysis_2& ca, + OutputIterator operator()(const Curve_analysis_2& ca, OutputIterator oi) const { typedef typename Curve_analysis_2::Status_line_1 Status_line_1; typename Base::Curve_kernel_2 curve_kernel = Base::_ckva()->kernel(); - - Curve_analysis_2 ca_yx + + Curve_analysis_2 ca_yx = curve_kernel.swap_x_and_y_2_object() (ca); - + std::vector y_critical_points; Base::_ckva()->x_extreme_points_2_object()(ca_yx, std::back_inserter(y_critical_points)); - for( typename std::vector::iterator it + for( typename std::vector::iterator it = y_critical_points.begin(); it != y_critical_points.end(); it++ ) { - + Coordinate_1 curr_x = curve_kernel.get_y_2_object()( *it ); Status_line_1 status_line = ca.status_line_at_exact_x(curr_x); - + int lifts = status_line.number_of_events(); - + for( int i = 0; i < lifts; i++ ) { Coordinate_2 lift_xy = status_line.algebraic_real_2(i); - + bool y_coordinate_found; while(true) { @@ -2636,23 +2636,23 @@ public: y_coordinate_found = true; break; } - + curve_kernel.refine_x_2_object() (*it); } - + if(y_coordinate_found) { *oi++ = Coordinate_2(curr_x, ca, i); break; - } + } } } return oi; } - + }; -#undef CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES +#undef CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES } // namespace Curved_kernel_via_analysis_2_Functors @@ -2665,13 +2665,13 @@ class Curved_kernel_via_analysis_2_functors { public: //!\name Public types //!@{ - + //! this instance's first template parameter typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; // typedef Curved_kernel_via_analysis_2_functors< // CurvedKernelViaAnalysis_2 > Functor_base; - + // declares curved kernel functors, for each functor defines a member function // returning an instance of this functor #define CGAL_CKvA_2_functor_pred(Y, Z) \ @@ -2682,9 +2682,9 @@ public: #define CGAL_CKvA_2_functor_cons(Y, Z) CGAL_CKvA_2_functor_pred(Y, Z) - CGAL_CKvA_2_functor_pred(Compare_x_2, compare_x_2_object); + CGAL_CKvA_2_functor_pred(Compare_x_2, compare_x_2_object); CGAL_CKvA_2_functor_pred(Compare_xy_2, compare_xy_2_object); - CGAL_CKvA_2_functor_pred(Is_vertical_2, is_vertical_2_object); + CGAL_CKvA_2_functor_pred(Is_vertical_2, is_vertical_2_object); CGAL_CKvA_2_functor_cons(Construct_min_vertex_2, construct_min_vertex_2_object); @@ -2693,54 +2693,54 @@ public: CGAL_CKvA_2_functor_cons(Construct_interior_vertex_2, construct_interior_vertex_2_object); - CGAL_CKvA_2_functor_pred(Compare_y_at_x_2, compare_y_at_x_2_object); + CGAL_CKvA_2_functor_pred(Compare_y_at_x_2, compare_y_at_x_2_object); CGAL_CKvA_2_functor_pred(Compare_y_at_x_left_2, compare_y_at_x_left_2_object); CGAL_CKvA_2_functor_pred(Compare_y_at_x_right_2, compare_y_at_x_right_2_object); - CGAL_CKvA_2_functor_pred(Equal_2, equal_2_object); + CGAL_CKvA_2_functor_pred(Equal_2, equal_2_object); CGAL_CKvA_2_functor_pred(Is_in_x_range_2, is_in_x_range_2_object); CGAL_CKvA_2_functor_pred(Do_overlap_2, do_overlap_2_object); CGAL_CKvA_2_functor_cons(Intersect_2, intersect_2_object); CGAL_CKvA_2_functor_cons(Trim_2, trim_2_object); - CGAL_CKvA_2_functor_cons(Split_2, split_2_object); - CGAL_CKvA_2_functor_pred(Are_mergeable_2, are_mergeable_2_object); - CGAL_CKvA_2_functor_cons(Merge_2, merge_2_object); + CGAL_CKvA_2_functor_cons(Split_2, split_2_object); + CGAL_CKvA_2_functor_pred(Are_mergeable_2, are_mergeable_2_object); + CGAL_CKvA_2_functor_cons(Merge_2, merge_2_object); - CGAL_CKvA_2_functor_pred(Is_on_2, is_on_2_object); + CGAL_CKvA_2_functor_pred(Is_on_2, is_on_2_object); CGAL_CKvA_2_functor_cons(Make_x_monotone_2, make_x_monotone_2_object); - + // left-right - CGAL_CKvA_2_functor_pred(Parameter_space_in_x_2, + CGAL_CKvA_2_functor_pred(Parameter_space_in_x_2, parameter_space_in_x_2_object); CGAL_CKvA_2_functor_pred(Compare_y_near_boundary_2, compare_y_near_boundary_2_object); // bottom-top - CGAL_CKvA_2_functor_pred(Parameter_space_in_y_2, + CGAL_CKvA_2_functor_pred(Parameter_space_in_y_2, parameter_space_in_y_2_object); - CGAL_CKvA_2_functor_pred(Compare_x_at_limit_2, - compare_x_at_limit_2_object); - CGAL_CKvA_2_functor_pred(Compare_x_near_limit_2, - compare_x_near_limit_2_object); + CGAL_CKvA_2_functor_pred(Compare_x_on_boundary_2, + compare_x_on_boundary_2_object); + CGAL_CKvA_2_functor_pred(Compare_x_near_boundary_2, + compare_x_near_boundary_2_object); CGAL_CKvA_2_functor_cons(X_extreme_points_2, x_extreme_points_2_object); CGAL_CKvA_2_functor_cons(Y_extreme_points_2, y_extreme_points_2_object); - CGAL_CKvA_2_functor_cons(Construct_point_2, + CGAL_CKvA_2_functor_cons(Construct_point_2, construct_point_2_object); - CGAL_CKvA_2_functor_cons(Construct_point_on_arc_2, + CGAL_CKvA_2_functor_cons(Construct_point_on_arc_2, construct_point_on_arc_2_object); - - CGAL_CKvA_2_functor_cons(Construct_arc_2, + + CGAL_CKvA_2_functor_cons(Construct_arc_2, construct_arc_2_object); - - CGAL_CKvA_2_functor_pred(Compare_endpoints_xy_2, + + CGAL_CKvA_2_functor_pred(Compare_endpoints_xy_2, compare_endpoints_xy_2_object); - CGAL_CKvA_2_functor_cons(Construct_opposite_2, + CGAL_CKvA_2_functor_cons(Construct_opposite_2, construct_opposite_2_object); #undef CGAL_CKvA_2_functor_pred diff --git a/Arrangement_on_surface_2/include/CGAL/IO/Arr_text_formatter.h b/Arrangement_on_surface_2/include/CGAL/IO/Arr_text_formatter.h index e12efb4987a..0165add258d 100644 --- a/Arrangement_on_surface_2/include/CGAL/IO/Arr_text_formatter.h +++ b/Arrangement_on_surface_2/include/CGAL/IO/Arr_text_formatter.h @@ -15,7 +15,7 @@ // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0+ -// +// // // Author(s) : Ron Wein // (based on old version by Michal Meyerovitch and Ester Ezra) @@ -59,20 +59,20 @@ public: typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; typedef typename Arrangement_2::Face_const_handle Face_const_handle; - + protected: typedef typename Dcel::Vertex DVertex; typedef typename Dcel::Halfedge DHalfedge; typedef typename Dcel::Face DFace; - + // Data members: std::ostream* m_out; IO::Mode m_old_out_mode; std::istream* m_in; IO::Mode m_old_in_mode; -public: +public: /*! Default constructor.*/ Arr_text_formatter(): @@ -143,7 +143,7 @@ public: /*! Write a labeled size value. */ void write_size(const char *label, Size size) - { + { _write_comment(label); out() << size << '\n'; } @@ -194,7 +194,7 @@ public: { out() << std::endl; } - + virtual void write_point(const Point_2& p) { out() << p; @@ -259,7 +259,7 @@ public: void write_ccb_halfedges_begin() {} - + void write_ccb_halfedges_end() { out() << std::endl; @@ -283,7 +283,7 @@ public: //@{ /*! Start reading an arrangement. */ - void read_arrangement_begin() + void read_arrangement_begin() { CGAL_assertion(m_in != NULL); m_old_in_mode = get_mode(*m_in); @@ -292,7 +292,7 @@ public: } /*! Read the arrangement edge. */ - void read_arrangement_end() + void read_arrangement_end() { _skip_comments(); set_mode(*m_in, m_old_in_mode); @@ -348,11 +348,11 @@ public: //@{ void read_vertex_begin() {} - + void read_vertex_end() {} - virtual void read_point(Point_2& p) + virtual void read_point(Point_2& p) { in() >> p; _skip_until_EOL(); @@ -366,18 +366,18 @@ public: //@{ void read_edge_begin() {} - + void read_edge_end() {} - - int read_vertex_index() + + int read_vertex_index() { int val = 0; in() >> val; return (val); } - virtual void read_x_monotone_curve(X_monotone_curve_2& cv) + virtual void read_x_monotone_curve(X_monotone_curve_2& cv) { in() >> cv; _skip_until_EOL(); @@ -385,14 +385,14 @@ public: virtual void read_halfedge_data(Halfedge_handle) {} - + /// \name Reading a face. //@{ void read_face_begin() { _skip_comments(); } - + void read_face_end() { _skip_comments(); @@ -400,12 +400,12 @@ public: void read_outer_ccbs_begin() {} - + void read_outer_ccbs_end() {} int read_halfedge_index() - { + { int val = 0; in() >> val; return (val); @@ -413,22 +413,22 @@ public: void read_inner_ccbs_begin() {} - + void read_inner_ccbs_end() {} void read_ccb_halfedges_begin() {} - - void read_ccb_halfedges_end() + + void read_ccb_halfedges_end() { _skip_until_EOL(); } void read_isolated_vertices_begin() {} - - void read_isolated_vertices_end() + + void read_isolated_vertices_end() { _skip_until_EOL(); } @@ -446,38 +446,25 @@ protected: } /*! Skip until end of line. */ - void _skip_until_EOL() + void _skip_until_EOL() { CGAL_assertion(m_in != NULL); - int c; + int c; while ((c = m_in->get()) != EOF && c != '\n') {}; } - + /*! Skip comment lines. */ - void _skip_comments() + void _skip_comments() { CGAL_assertion(m_in != NULL); - int c = m_in->get(); - if (c == ' ') - { - // Skip blanks until EOL. - while ((c = m_in->get()) != EOF && c == ' ') {}; - if (c != '\n') - { - m_in->putback(c); - return; - } - else - { - c = m_in->get(); - } - } + // Skip blanks until EOL. + int c; + while (((c = m_in->get()) != EOF) && ((c == ' ') || (c == '\n'))) {}; // Skip comment lines that begin with a '#' character. - while (c != EOF && c == '#') - { + while (c != EOF && c == '#') { _skip_until_EOL(); c = m_in->get(); } @@ -533,7 +520,7 @@ public: { this->out() << f->data() << '\n'; } - + /*! Read a face-data object and attach it to the given face. */ virtual void read_face_data(Face_handle f) { @@ -589,7 +576,7 @@ public: { this->out() << '\n' << v->data(); } - + /*! Read a vertex-data object and attach it to the given vertex. */ virtual void read_vertex_data(Vertex_handle v) { @@ -602,7 +589,7 @@ public: { this->out() << '\n' << he->data(); } - + /*! Read a halfedge-data object and attach it to the given halfedge. */ virtual void read_halfedge_data(Halfedge_handle he) { @@ -615,7 +602,7 @@ public: { this->out() << f->data() << '\n'; } - + /*! Read a face-data object and attach it to the given face. */ virtual void read_face_data(Face_handle f) { diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h index 3390e14ca61..d1e8008fa3c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_basic_insertion_traits_2.h @@ -113,7 +113,6 @@ public: // of two other curves. public: - Ex_x_monotone_curve_2(): m_base_xcv(), m_he_handle(), @@ -637,7 +636,6 @@ public: return m_base->compare_y_near_boundary_2_object()(xcv1.base(), xcv2.base(), ce); } - }; /*! Obtain a Compare_y_near_boundary_2 object @@ -677,7 +675,6 @@ public: Arr_parameter_space operator()(const X_monotone_curve_2& xcv) const { return m_base->parameter_space_in_y_2_object()(xcv.base()); } - }; /*! Obtain a Parameter_space_in_y_2 function object */ @@ -716,98 +713,10 @@ public: Is_on_y_identification_2 is_on_y_identification_2_object() const { return Is_on_y_identification_2(m_base_traits); } - /*! A functor that compares the x-limits of curve ends on the + /*! A functor that compares the x-coordinates of curve ends and points on the * boundary of the parameter space. */ - class Compare_x_at_limit_2 { - protected: - //! The base traits. - const Gt2* 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. - */ - Compare_x_at_limit_2(const Gt2* base) : m_base(base) {} - - //! Allow its functor obtaining function calling the private constructor. - friend class Arr_basic_insertion_traits_2; - - public: - /*! Use tag dispatching to avoid compilation errors in case the functor - * is not defined - */ - Comparison_result operator()(const Point_2& p, - const X_monotone_curve_2& xcv, - Arr_curve_end ce) const - { return m_base->compare_x_at_limit_2_object()(p.base(), xcv.base(), ce); } - - /*! Use tag dispatching to avoid compilation errors in case the functor - * is not defined - */ - Comparison_result operator()(const X_monotone_curve_2& xcv1, - Arr_curve_end ce1, - const X_monotone_curve_2& xcv2, - Arr_curve_end ce2) const - { - return m_base->compare_x_at_limit_2_object()(xcv1.base(), ce1, - xcv2.base(), ce2); - } - }; - - /*! Obtain a Compare_x_at_limit_2 object - */ - Compare_x_at_limit_2 compare_x_at_limit_2_object() const - { return Compare_x_at_limit_2(m_base_traits); } - - - /*! A functor that compares the x-coordinates of curve ends near the - * boundary of the parameter space. - */ - class Compare_x_near_limit_2 { - protected: - //! The base traits. - const Gt2* 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. - */ - Compare_x_near_limit_2(const Gt2* base) : m_base(base) {} - - //! Allow its functor obtaining function calling the private constructor. - friend class Arr_basic_insertion_traits_2; - - public: - /*! Use tag dispatching to avoid compilation errors in case the functor - * is not defined - */ - Comparison_result operator()(const X_monotone_curve_2& xcv1, - const X_monotone_curve_2& xcv2, - Arr_curve_end ce) const - { - return m_base->compare_x_near_limit_2_object()(xcv1.base(), xcv2.base(), - ce); - } - - }; - - /*! Obtain a Compare_x_near_limit_2 object - */ - Compare_x_near_limit_2 compare_x_near_limit_2_object() const - { return Compare_x_near_limit_2(m_base_traits); } - - /*! A functor that compares the x-coordinates of two points on vertical - * boundaries. - */ - class Compare_x_on_boundary_2 - { + class Compare_x_on_boundary_2 { protected: //! The base traits. const Gt2* m_base; @@ -834,11 +743,11 @@ public: /*! Use tag dispatching to avoid compilation errors in case the functor * is not defined */ - Comparison_result operator()(const Point_2 & pt, + Comparison_result operator()(const Point_2& p, const X_monotone_curve_2& xcv, Arr_curve_end ce) const { - return m_base->compare_x_on_boundary_2_object()(pt.base(), xcv.base(), ce); + return m_base->compare_x_on_boundary_2_object()(p.base(), xcv.base(), ce); } /*! Use tag dispatching to avoid compilation errors in case the functor diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_construction_ss_visitor.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_construction_ss_visitor.h index 4905b7fee34..9ec8ccbf925 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_construction_ss_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_construction_ss_visitor.h @@ -314,6 +314,7 @@ after_handle_event(Event* event, Status_line_iterator iter, bool /* flag */) ++m_sc_counter; m_iso_verts_map[m_sc_counter] = v; + _map_new_halfedge(m_sc_counter, Halfedge_handle()); if (iter != this->status_line_end()) { @@ -336,10 +337,13 @@ after_handle_event(Event* event, Status_line_iterator iter, bool /* flag */) } // TODO EBEB 2012-10-16 compile only when non-oblivious - if (event->parameter_space_in_x() == CGAL::ARR_LEFT_BOUNDARY) { + if (event->parameter_space_in_x() == CGAL::ARR_LEFT_BOUNDARY && + event->parameter_space_in_y() != CGAL::ARR_TOP_BOUNDARY) { + // for an event on the left non-top-corner boundary + // move entries for halfedge incidences list to the top if (!this->is_status_line_empty()) { Status_line_iterator prev = iter; - for (size_t i = 0; i < event->number_of_right_curves(); ++i) --prev; + for (size_t i = 0; i < event->number_of_right_curves(); ++i) --prev; // move items from top face to last inserted curve Indices_list& list_ref = (*prev)->halfedge_indices_list(); list_ref.clear(); @@ -882,7 +886,13 @@ relocate_in_new_face(Halfedge_handle he) // isolated vertex. Move this vertex to the new face, if necessary. Vertex_handle v = m_iso_verts_map[*itr]; CGAL_assertion(v != m_invalid_vertex); - if (v->face() != new_face) { + // There are cases where the vertex is not isolated. For example, consider an + // arrangement embedded on a sphere. When inserting the north pole as an isolated + // vertex and at the same time some arcs incident to the north pole, the isolated + // vertex and the curve-ends that end at the north pole generate different events. + // The insertion of the isolated vertex generates an event that is processed before + // other events, and the associated vertex is recorder in the iso vertex map. + if (v->is_isolated() && (v->face() != new_face)) { m_arr_access.move_isolated_vertex(v->face(), new_face, v); } } @@ -915,8 +925,10 @@ void Arr_construction_ss_visitor:: _map_new_halfedge(unsigned int i, Halfedge_handle he) { #if CGAL_ARR_CONSTRUCTION_SS_VISITOR_VERBOSE - std::cout << "map " << i << " to " << he->curve() << " " - << he->direction() << std::endl; + std::cout << "map " << i << " to "; + if (he == Halfedge_handle()) std::cout << "null halfedge"; + else std::cout << he->curve() << " " << he->direction(); + std::cout << std::endl; #endif CGAL_assertion(i != 0); // Resize the index table if needed. diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h index fc688892496..638fdee8eda 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h @@ -194,11 +194,11 @@ public: Arr_curve_end cv_end, bool is_new); - void update_event(Event* /* e */, - const X_monotone_curve_2& /* cv */, - Arr_curve_end /* cv_end */, - bool /* is_new */) - {} + void update_event(Event* /* e */, + const X_monotone_curve_2& /* cv */, + Arr_curve_end /* cv_end */, + bool /* is_new */) + {} /*! Update an event that corresponds to an intersection between curves. */ void update_event(Event* /* e */, diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_traits_2.h index 1ef10dcf3c9..e854b62f7ca 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_traits_2.h @@ -95,6 +95,12 @@ public: typedef typename internal::Arr_complete_right_side_category::Category Right_side_category; + // Used by: + // 1. parameter_space_in_x + typedef typename Arr_two_sides_category::result + Left_or_right_sides_category; + /* Overlay is implemented as sweep-line visitor. The sweep-line algorithm * never uses Compare_y_at_x_left_2, and it never performs merging of curves. * Thus, AreMergeable_2 and Merge_2 are not needed either. @@ -498,7 +504,7 @@ public: class Split_2 { protected: //! The base operator. - Base_split_2 m_base_split; + Base_split_2 m_base_split; /*! Constructor. * The constructor is declared protected to allow only the functor @@ -812,7 +818,7 @@ public: class Compare_y_at_x_right_2 { protected: //! The base operator. - Base_compare_y_at_x_right_2 m_base_cmp_y_at_x_right; + Base_compare_y_at_x_right_2 m_base_cmp_y_at_x_right; /*! Constructor. * The constructor is declared protected to allow only the functor @@ -863,13 +869,81 @@ public: public: Arr_parameter_space operator()(const X_monotone_curve_2& xcv, Arr_curve_end ce) const - { return m_base->parameter_space_in_x_2_object()(xcv.base(), ce); } + { + // The function is implemented based on the tag dispatching + // If the traits class does not support special boundaries, we just + // return ARR_INTERIOR. + return parameter_space_in_x(xcv, ce, Left_or_right_sides_category()); + } Arr_parameter_space operator()(const Point_2& p) const - { return m_base->parameter_space_in_x_2_object()(p.base()); } + { + // The function is implemented based on the tag dispatching + // If the traits class does not support special boundaries, we just + // return ARR_INTERIOR. + return parameter_space_in_x(p, Left_or_right_sides_category()); + } Arr_parameter_space operator()(const X_monotone_curve_2& xcv) const { return m_base->parameter_space_in_x_2_object()(xcv.base()); } + + private: + /*! Implementation of the operator() in case the base should be used. */ + Arr_parameter_space parameter_space_in_x(const X_monotone_curve_2& xcv, + Arr_curve_end ind, + Arr_has_identified_side_tag) const + { + // If the curve completely lies on the left-right identification, return + // ARR_LEFT_BOUNDARY as an arbitrary but consistent choice. + if (m_base->is_on_y_identification_2_object()(xcv)) + return ARR_LEFT_BOUNDARY; + return (m_base->parameter_space_in_x_2_object()(xcv, ind)); + } + + /*! Implementation of the operator() in case the base should be used. */ + Arr_parameter_space parameter_space_in_x(const X_monotone_curve_2& xcv, + Arr_curve_end ind, + Arr_boundary_cond_tag) const + { return (m_base->parameter_space_in_x_2_object()(xcv, ind)); } + + /*! Implementation of the operator() in case the dummy should be used. */ + Arr_parameter_space parameter_space_in_x(const X_monotone_curve_2&, + Arr_curve_end, + Arr_all_sides_oblivious_tag) const + { + /*! \todo ideally we should call CGAL_error() here and avoid invocation + * of the functor for traits classes that have oblivious boundary + * conditions + */ + return ARR_INTERIOR; + } + + /*! Implementation of the operator() in case the base should be used. */ + Arr_parameter_space parameter_space_in_x(const Point_2& p, + Arr_has_identified_side_tag) const + { + // if the point lies on the left-right identification, return + // ARR_LEFT_BOUNDARY as an arbitrary but consistent choice + if (m_base->is_on_y_identification_2_object()(p)) + return ARR_LEFT_BOUNDARY; + return m_base->parameter_space_in_x_2_object()(p); + } + + /*! Implementation of the operator() in case the base should be used. */ + Arr_parameter_space parameter_space_in_x(const Point_2& p, + Arr_boundary_cond_tag) const + { return m_base->parameter_space_in_x_2_object()(p); } + + /*! Implementation of the operator() in case the dummy should be used. */ + Arr_parameter_space parameter_space_in_x(const Point_2&, + Arr_all_sides_oblivious_tag) const + { + /*! \todo ideally we should call CGAL_error() here and avoid invocation + * of the functor for traits classes that have oblivious boundary + * conditions + */ + return ARR_INTERIOR; + } }; /*! Obtain an Parameter_space_in_x_2 functor object. */ @@ -895,10 +969,10 @@ public: friend class Arr_overlay_traits_2; public: - Arr_parameter_space operator()(const Point_2& p) const + bool operator()(const Point_2& p) const { return m_base->is_on_x_identification_2_object()(p.base()); } - Arr_parameter_space operator()(const X_monotone_curve_2& xcv) const + bool operator()(const X_monotone_curve_2& xcv) const { return m_base->is_on_x_identification_2_object()(xcv.base()); } }; @@ -1027,10 +1101,10 @@ public: friend class Arr_overlay_traits_2; public: - Arr_parameter_space operator()(const Point_2& p) const + bool operator()(const Point_2& p) const { return m_base->is_on_y_identification_2_object()(p.base()); } - Arr_parameter_space operator()(const X_monotone_curve_2& xcv) const + bool operator()(const X_monotone_curve_2& xcv) const { return m_base->is_on_y_identification_2_object()(xcv.base()); } }; @@ -1038,80 +1112,6 @@ public: Is_on_y_identification_2 is_on_y_identification_2_object() const { return Is_on_y_identification_2(m_base_traits); } - /*! A functor that compares the x-limits of curve ends on the - * boundary of the parameter space. - */ - class Compare_x_at_limit_2 { - protected: - //! The base traits. - const Gt2* m_base; - - /*! Constructor. - * \param base The base traits class. It must be passed, to handle the - * case it is not stateless (e.g., it stores data). - * The constructor is declared protected to allow only the functor - * obtaining function, which is a member of the nesting class, - * constructing it. - */ - Compare_x_at_limit_2(const Gt2* base) : m_base(base) {} - - //! Allow its functor obtaining function calling the protected constructor. - friend class Arr_overlay_traits_2; - - public: - Comparison_result operator()(const Point_2& p, - const X_monotone_curve_2& xcv, - Arr_curve_end ce) const - { return m_base->compare_x_at_limit_2_object()(p.base(), xcv.base(), ce); } - - Comparison_result operator()(const X_monotone_curve_2& xcv1, - Arr_curve_end ce1, - const X_monotone_curve_2& xcv2, - Arr_curve_end ce2) const - { - return m_base->compare_x_at_limit_2_object()(xcv1.base(), ce1, - xcv2.base(), ce2); - } - }; - - /*! Obtain a Compare_x_at_limit_2 functor. */ - Compare_x_at_limit_2 compare_x_at_limit_2_object() const - { return Compare_x_at_limit_2(m_base_traits); } - - /*! A functor that compares the x-coordinates of curve ends near the - * boundary of the parameter space. - */ - class Compare_x_near_limit_2 { - protected: - //! The base traits. - const Gt2* m_base; - - /*! Constructor. - * \param base The base traits class. It must be passed, to handle the - * case it is not stateless (e.g., it stores data). - * The constructor is declared protected to allow only the functor - * obtaining function, which is a member of the nesting class, - * constructing it. - */ - Compare_x_near_limit_2(const Gt2* base) : m_base(base) {} - - //! Allow its functor obtaining function calling the protected constructor. - friend class Arr_overlay_traits_2; - - public: - Comparison_result operator()(const X_monotone_curve_2& xcv1, - const X_monotone_curve_2& xcv2, - Arr_curve_end ce) const - { - return m_base->compare_x_near_limit_2_object()(xcv1.base(), xcv2.base(), - ce); - } - }; - - /*! Obtain a Compare_x_near_limit_2 functor. */ - Compare_x_near_limit_2 compare_x_near_limit_2_object() const - { return Compare_x_near_limit_2(m_base_traits); } - /*! A functor that compares the y-values of pointss on the * boundary of the parameter space. */ diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt index 14fc5649284..c8148a15910 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt @@ -8,6 +8,16 @@ enable_testing() cmake_minimum_required(VERSION 2.8.10) +list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_generalized_initializers has_cpp11) +if (has_cpp11 LESS 0) + message(STATUS "NOTICE: These examples requires a C++11 compiler and will not be compiled.") + return() +endif() + +# Use C++11 for this directory and its sub-directories. +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED TRUE) + find_package(CGAL QUIET COMPONENTS Core) if ( CGAL_FOUND ) @@ -33,8 +43,7 @@ if ( CGAL_FOUND ) endif() else() - - message(STATUS "This program requires the CGAL library, and will not be compiled.") - -endif() + message(STATUS "This program requires the CGAL library, and will not be compiled.") + +endif() diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_base_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_base_test.h index 7607747636b..3e71c7d0bd2 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_base_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_base_test.h @@ -1671,7 +1671,7 @@ bool IO_base_test::read_point(InputStream_& is, Point_2& p) { Basic_number_type x, y, z; is >> x >> y >> z; - p = Point_2(x, y, z); + p = m_geom_traits.construct_point_2_object()(x, y, z); return true; } @@ -1691,10 +1691,10 @@ bool IO_base_test::read_xcurve(InputStream_& is, if (flag == 1) { X_monotone_curve_2::Direction_3 normal; is >> normal; - xcv = X_monotone_curve_2(p1, p2, normal); + xcv = m_geom_traits.construct_x_monotone_curve_2_object()(p1, p2, normal); } else - xcv = X_monotone_curve_2(p1, p2); + xcv = m_geom_traits.construct_x_monotone_curve_2_object()(p1, p2); return true; } @@ -1712,10 +1712,10 @@ bool IO_base_test::read_curve(InputStream_& is, Curve_2& cv) if (flag == 1) { X_monotone_curve_2::Direction_3 normal; is >> normal; - cv = Curve_2(p1, p2, normal); + cv = m_geom_traits.construct_curve_2_object()(p1, p2, normal); } else - cv = Curve_2(p1, p2); + cv = m_geom_traits.construct_curve_2_object()(p1, p2); return true; } diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_test.h index 6b1941d3134..dc70c6bef5b 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_test.h @@ -213,22 +213,6 @@ private: bool parameter_space_in_y_wrapper_imp(std::istringstream&, CGAL::Arr_use_traits_tag); - /*! Test Compare_x_near_limit_2 - */ - bool compare_x_near_limit_wrapper(std::istringstream&); - bool compare_x_near_limit_wrapper_imp(std::istringstream&, - CGAL::Arr_use_dummy_tag); - bool compare_x_near_limit_wrapper_imp(std::istringstream&, - CGAL::Arr_use_traits_tag); - - /*! Test Compare_x_at_limit_2 - */ - bool compare_x_at_limit_wrapper(std::istringstream&); - bool compare_x_at_limit_wrapper_imp(std::istringstream&, - CGAL::Arr_use_dummy_tag); - bool compare_x_at_limit_wrapper_imp(std::istringstream&, - CGAL::Arr_use_traits_tag); - /*! Test Compare_x_near_boundary_2 */ bool compare_x_near_boundary_wrapper(std::istringstream&); @@ -330,10 +314,6 @@ Base(traits) m_wrappers[std::string("parameter_space_y")] = &Traits_test::parameter_space_in_y_wrapper; - m_wrappers[std::string("compare_x_near_limit")] = - &Traits_test::compare_x_near_limit_wrapper; - m_wrappers[std::string("compare_x_at_limit")] = - &Traits_test::compare_x_at_limit_wrapper; m_wrappers[std::string("compare_x_near_boundary")] = &Traits_test::compare_x_near_boundary_wrapper; @@ -1360,152 +1340,6 @@ parameter_space_in_y_wrapper_imp(std::istringstream& str_stream, return this->compare(exp_answer, real_answer); } -/* Compare_x_near_limit_2 - */ -template -bool Traits_test:: -compare_x_near_limit_wrapper(std::istringstream& str_stream) -{ - typedef typename - CGAL::internal::Arr_complete_bottom_side_category::Category - Bottom_side_category; - typedef typename - CGAL::internal::Arr_complete_top_side_category::Category - Top_side_category; - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch - BT; - typedef typename BT::Compare_x_near_limit_2_curve_ends_tag Cmp_tag; - return compare_x_near_limit_wrapper_imp(str_stream, Cmp_tag()); -} - -template -bool Traits_test:: -compare_x_near_limit_wrapper_imp(std::istringstream&, CGAL::Arr_use_dummy_tag) -{ - CGAL_error(); - return false; -} - -template -bool Traits_test:: -compare_x_near_limit_wrapper_imp(std::istringstream& str_stream, - CGAL::Arr_use_traits_tag) -{ - std::cout << "Test: compare_x_near_limit( "; - - unsigned int id1, id2; - // xcurve xcurve curve-end - str_stream >> id1 >> id2; - std::pair next_input = - this->get_next_input(str_stream); - assert(next_input.first == Base::CURVE_END); - CGAL::Arr_curve_end cv_end = - static_cast(next_input.second); - - std::cout << this->m_xcurves[id1] << ", " - << this->m_xcurves[id2] << " , " - << this->curve_end_str(cv_end) << " ) ? "; - - next_input = this->get_next_input(str_stream); - assert(next_input.first == Base::SIGN); - CGAL::Comparison_result exp_answer = - static_cast(next_input.second); - std::cout << (exp_answer == CGAL::SMALLER ? "SMALLER": - (exp_answer == CGAL::LARGER ? "LARGER":"EQUAL")) << " "; - - CGAL::Comparison_result real_answer = - this->m_geom_traits.compare_x_near_limit_2_object() - (this->m_xcurves[id1], this->m_xcurves[id2], cv_end); - return this->compare(exp_answer, real_answer); -} - -/* Compare_x_at_limit - */ -template -bool Traits_test:: -compare_x_at_limit_wrapper(std::istringstream& str_stream) -{ - typedef typename - CGAL::internal::Arr_complete_bottom_side_category::Category - Bottom_side_category; - typedef typename - CGAL::internal::Arr_complete_top_side_category::Category - Top_side_category; - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch - BT; - typedef typename BT::Compare_x_at_limit_2_curve_ends_tag Cmp_tag1; - typedef typename BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_tag2; - typedef typename CGAL::internal::Or_traits::type Cmp_tag; - return compare_x_at_limit_wrapper_imp(str_stream, Cmp_tag()); -} - -template -bool Traits_test:: -compare_x_at_limit_wrapper_imp(std::istringstream&, - CGAL::Arr_use_dummy_tag) -{ - CGAL_error(); - return false; -} - -template -bool Traits_test:: -compare_x_at_limit_wrapper_imp(std::istringstream& str_stream, - CGAL::Arr_use_traits_tag) -{ - std::cout << "Test: compare_x_at_limit( "; - - CGAL::Comparison_result real_answer; - unsigned int id1, id2; - // first argument must be a number (either a point or a xcurve) - str_stream >> id1; - std::pair next_input = - this->get_next_input(str_stream); - // second argument can be number or text (either xcurve or curve_end) - bool curves_op = next_input.first == Base::NUMBER; - CGAL::Arr_curve_end cv_end1 = CGAL::ARR_MIN_END, cv_end2 = CGAL::ARR_MIN_END; - - if (curves_op) { - id2 = static_cast(next_input.second); - next_input = this->get_next_input(str_stream); - assert(next_input.first == Base::CURVE_END); - cv_end1 = static_cast(next_input.second); - - std::cout << this->m_points[id1] << " , " - << this->m_xcurves[id2]<< " , " - << this->curve_end_str(cv_end1) << " ) ? "; - } - else if (next_input.first == Base::CURVE_END) { - cv_end1 = static_cast(next_input.second); - next_input = this->get_next_input(str_stream); - assert(next_input.first == Base::NUMBER); - id2 = static_cast(next_input.second); - next_input = this->get_next_input(str_stream); - assert(next_input.first == Base::CURVE_END); - cv_end2 = static_cast(next_input.second); - - std::cout << this->m_xcurves[id1] << ", " - << this->curve_end_str(cv_end1) << ", " - << this->m_xcurves[id2] << " , " - << this->curve_end_str(cv_end2) << " ) ? "; - } - else CGAL_error(); - - next_input = this->get_next_input(str_stream); - assert(next_input.first == Base::SIGN); - CGAL::Comparison_result exp_answer = - static_cast(next_input.second); - std::cout << (exp_answer == CGAL::SMALLER ? "SMALLER": - (exp_answer == CGAL::LARGER ? "LARGER":"EQUAL")) << " "; - - real_answer = (curves_op) ? - this->m_geom_traits.compare_x_at_limit_2_object() - (this->m_points[id1], this->m_xcurves[id2], cv_end1) : - this->m_geom_traits.compare_x_at_limit_2_object() - (this->m_xcurves[id1], cv_end1,this->m_xcurves[id2], cv_end2); - return this->compare(exp_answer, real_answer); -} - /* Compare_x_near_boundary_2 */ template diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake index 3d1c81422e4..256fc8860cf 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake @@ -93,8 +93,6 @@ set(ARE_MERGEABLE 10) set(MERGE 11) set(ASSERTIONS 12) set(CONSTRUCTOR 13) -set(COMPARE_X_AT_LIMIT 14) -set(COMPARE_X_NEAR_LIMIT 15) set(COMPARE_X_ON_BOUNDARY 16) set(COMPARE_X_NEAR_BOUNDARY 17) set(COMPARE_Y_NEAR_BOUNDARY 18) @@ -335,8 +333,6 @@ function(execute_commands_new_structure data_dir traits_type_name) set(commands_indicator_COMPARE 0) set(commands_indicator_VERTEX 0) set(commands_indicator_IS_VERTICAL 0) - set(commands_indicator_COMPARE_X_AT_LIMIT 0) - set(commands_indicator_COMPARE_X_NEAR_LIMIT 0) set(commands_indicator_COMPARE_X_ON_BOUNDARY 0) set(commands_indicator_COMPARE_X_NEAR_BOUNDARY 0) set(commands_indicator_COMPARE_Y_NEAR_BOUNDARY 0) @@ -374,14 +370,6 @@ function(execute_commands_new_structure data_dir traits_type_name) run_trapped_test(test_traits data/${data_dir}/points data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/is_vertical ${traits_type_name}) endif() - if(commands_indicator_COMPARE_X_AT_LIMIT) - run_trapped_test(test_traits data/${data_dir}/points - data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/compare_x_at_limit ${traits_type_name}) - endif() - if(commands_indicator_COMPARE_X_NEAR_LIMIT) - run_trapped_test(test_traits data/${data_dir}/points - data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/compare_x_near_limit ${traits_type_name}) - endif() if(commands_indicator_COMPARE_X_ON_BOUNDARY) run_trapped_test(test_traits data/${data_dir}/points data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/compare_x_on_boundary ${traits_type_name}) @@ -479,8 +467,6 @@ function(execute_commands_traits_adaptor data_dir traits_type_name) set(commands_indicator_PARAMETER_SPACE_X 0) set(commands_indicator_PARAMETER_SPACE_Y 0) - set(commands_indicator_COMPARE_X_AT_LIMIT 0) - set(commands_indicator_COMPARE_X_NEAR_LIMIT 0) set(commands_indicator_COMPARE_X_ON_BOUNDARY 0) set(commands_indicator_COMPARE_X_NEAR_BOUNDARY 0) set(commands_indicator_COMPARE_Y_NEAR_BOUNDARY 0) @@ -508,16 +494,6 @@ function(execute_commands_traits_adaptor data_dir traits_type_name) data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves data/test_adaptor/${data_dir}/parameter_space_y ${traits_type_name}) endif() - if(commands_indicator_COMPARE_X_AT_LIMIT) - run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points - data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves - data/test_adaptor/${data_dir}/compare_x_at_limit ${traits_type_name}) - endif() - if(commands_indicator_COMPARE_X_NEAR_LIMIT) - run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points - data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves - data/test_adaptor/${data_dir}/compare_x_near_limit ${traits_type_name}) - endif() if(commands_indicator_COMPARE_X_ON_BOUNDARY) run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points @@ -1075,7 +1051,7 @@ function(test_linear_traits) IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT INTERSECT SPLIT MERGE PARAMETER_SPACE_X PARAMETER_SPACE_Y - COMPARE_X_AT_LIMIT COMPARE_X_NEAR_LIMIT COMPARE_Y_NEAR_BOUNDARY) + COMPARE_X_ON_BOUNDARY COMPARE_X_NEAR_BOUNDARY COMPARE_Y_NEAR_BOUNDARY) endfunction() #---------------------------------------------------------------------# @@ -1277,7 +1253,7 @@ function(test_rational_arc_traits) execute_commands_new_structure(rational_arcs rational_arc_traits VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT SPLIT MERGE - COMPARE_X_AT_LIMIT COMPARE_X_NEAR_LIMIT COMPARE_Y_NEAR_BOUNDARY) + COMPARE_X_ON_BOUNDARY COMPARE_X_NEAR_BOUNDARY COMPARE_Y_NEAR_BOUNDARY) endfunction() #---------------------------------------------------------------------# diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base index bfd9c7c30b6..8c4673eee4f 100755 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base @@ -100,8 +100,6 @@ ARE_MERGEABLE=10 MERGE=11 ASSERTIONS=12 CONSTRUCTOR=13 -COMPARE_X_AT_LIMIT=14 -COMPARE_X_NEAR_LIMIT=15 COMPARE_X_ON_BOUNDARY=16 COMPARE_X_NEAR_BOUNDARY=17 COMPARE_Y_NEAR_BOUNDARY=18 @@ -485,8 +483,6 @@ execute_commands_new_structure() commands_indicator[COMPARE]=0 commands_indicator[VERTEX]=0 commands_indicator[IS_VERTICAL]=0 - commands_indicator[COMPARE_X_AT_LIMIT]=0 - commands_indicator[COMPARE_X_NEAR_LIMIT]=0 commands_indicator[COMPARE_X_ON_BOUNDARY]=0 commands_indicator[COMPARE_X_NEAR_BOUNDARY]=0 commands_indicator[COMPARE_Y_NEAR_BOUNDARY]=0 @@ -530,14 +526,6 @@ execute_commands_new_structure() run_trapped_test test_traits data/$1/points \ data/$1/xcurves data/$1/curves data/$1/is_vertical $2 fi - if [ ${commands_indicator[$COMPARE_X_AT_LIMIT]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/compare_x_at_limit $2 - fi - if [ ${commands_indicator[$COMPARE_X_NEAR_LIMIT]} -ne 0 ] ; then - run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/compare_x_near_limit $2 - fi if [ ${commands_indicator[$COMPARE_X_ON_BOUNDARY]} -ne 0 ] ; then run_trapped_test test_traits data/$1/points \ data/$1/xcurves data/$1/curves data/$1/compare_x_on_boundary $2 @@ -636,8 +624,6 @@ execute_commands_traits_adaptor() commands_indicator[PARAMETER_SPACE_X]=0 commands_indicator[PARAMETER_SPACE_Y]=0 - commands_indicator[COMPARE_X_AT_LIMIT]=0 - commands_indicator[COMPARE_X_NEAR_LIMIT]=0 commands_indicator[COMPARE_X_ON_BOUNDARY]=0 commands_indicator[COMPARE_X_NEAR_BOUNDARY]=0 commands_indicator[COMPARE_Y_NEAR_BOUNDARY]=0 @@ -672,17 +658,6 @@ execute_commands_traits_adaptor() data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ data/test_adaptor/$1/parameter_space_y $2 fi - if [ ${commands_indicator[$COMPARE_X_AT_LIMIT]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/compare_x_at_limit $2 - fi - if [ ${commands_indicator[$COMPARE_X_NEAR_LIMIT]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/compare_x_near_limit $2 - fi - if [ ${commands_indicator[$COMPARE_X_ON_BOUNDARY]} -ne 0 ] ; then run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ @@ -1314,7 +1289,7 @@ test_linear_traits() IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT INTERSECT \ SPLIT MERGE \ PARAMETER_SPACE_X PARAMETER_SPACE_Y \ - COMPARE_X_AT_LIMIT COMPARE_X_NEAR_LIMIT COMPARE_Y_NEAR_BOUNDARY + COMPARE_X_ON_BOUNDARY COMPARE_X_NEAR_BOUNDARY COMPARE_Y_NEAR_BOUNDARY else echo " ERROR: not executed test_traits linear_traits" >> $ERRORFILE fi @@ -1556,7 +1531,7 @@ test_rational_arc_traits() execute_commands_new_structure rational_arcs rational_arc_traits \ VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT SPLIT MERGE \ - COMPARE_X_AT_LIMIT COMPARE_X_NEAR_LIMIT COMPARE_Y_NEAR_BOUNDARY + COMPARE_X_ON_BOUNDARY COMPARE_X_NEAR_BOUNDARY COMPARE_Y_NEAR_BOUNDARY else echo " ERROR: not executed test_traits rational_arc_traits" >> $ERRORFILE fi diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_at_limit b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_at_limit deleted file mode 100644 index 4b78577d195..00000000000 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_at_limit +++ /dev/null @@ -1,80 +0,0 @@ -# a point and a vertical line -compare_x_at_limit 4 1 MIN_END EQUAL -compare_x_at_limit 4 1 MAX_END EQUAL -compare_x_at_limit 1 1 MIN_END SMALLER -compare_x_at_limit 1 1 MAX_END SMALLER -compare_x_at_limit 7 1 MIN_END LARGER -compare_x_at_limit 7 1 MAX_END LARGER -# -compare_x_at_limit 1 5 MIN_END EQUAL -compare_x_at_limit 1 5 MAX_END EQUAL -compare_x_at_limit 4 5 MIN_END LARGER -compare_x_at_limit 4 5 MAX_END LARGER -# a point and a vertical ray -compare_x_at_limit 4 15 MIN_END EQUAL -compare_x_at_limit 1 15 MIN_END SMALLER -compare_x_at_limit 7 15 MIN_END LARGER -compare_x_at_limit 4 13 MAX_END EQUAL -compare_x_at_limit 1 13 MAX_END SMALLER -compare_x_at_limit 7 13 MAX_END LARGER -# a vertical line and a vertical line -compare_x_at_limit 1 MIN_END 1 MIN_END EQUAL -compare_x_at_limit 5 MIN_END 5 MIN_END EQUAL -compare_x_at_limit 7 MIN_END 7 MIN_END EQUAL -compare_x_at_limit 5 MIN_END 1 MIN_END SMALLER -compare_x_at_limit 5 MIN_END 7 MIN_END SMALLER -compare_x_at_limit 1 MIN_END 7 MIN_END SMALLER -compare_x_at_limit 1 MIN_END 5 MIN_END LARGER -compare_x_at_limit 7 MIN_END 5 MIN_END LARGER -compare_x_at_limit 7 MIN_END 1 MIN_END LARGER -# -compare_x_at_limit 1 MAX_END 1 MAX_END EQUAL -compare_x_at_limit 5 MAX_END 5 MAX_END EQUAL -compare_x_at_limit 7 MAX_END 7 MAX_END EQUAL -compare_x_at_limit 5 MAX_END 1 MAX_END SMALLER -compare_x_at_limit 5 MAX_END 7 MAX_END SMALLER -compare_x_at_limit 1 MAX_END 7 MAX_END SMALLER -compare_x_at_limit 1 MAX_END 5 MAX_END LARGER -compare_x_at_limit 7 MAX_END 5 MAX_END LARGER -compare_x_at_limit 7 MAX_END 1 MAX_END LARGER -# -compare_x_at_limit 1 MAX_END 1 MIN_END EQUAL -compare_x_at_limit 5 MAX_END 5 MIN_END EQUAL -compare_x_at_limit 7 MAX_END 7 MIN_END EQUAL -compare_x_at_limit 5 MAX_END 1 MIN_END SMALLER -compare_x_at_limit 5 MAX_END 7 MIN_END SMALLER -compare_x_at_limit 1 MAX_END 7 MIN_END SMALLER -compare_x_at_limit 1 MAX_END 5 MIN_END LARGER -compare_x_at_limit 7 MAX_END 5 MIN_END LARGER -compare_x_at_limit 7 MAX_END 1 MIN_END LARGER -# -compare_x_at_limit 1 MIN_END 1 MAX_END EQUAL -compare_x_at_limit 5 MIN_END 5 MAX_END EQUAL -compare_x_at_limit 7 MIN_END 7 MAX_END EQUAL -compare_x_at_limit 5 MIN_END 1 MAX_END SMALLER -compare_x_at_limit 5 MIN_END 7 MAX_END SMALLER -compare_x_at_limit 1 MIN_END 7 MAX_END SMALLER -compare_x_at_limit 1 MIN_END 5 MAX_END LARGER -compare_x_at_limit 7 MIN_END 5 MAX_END LARGER -compare_x_at_limit 7 MIN_END 1 MAX_END LARGER -# -compare_x_at_limit 1 MIN_END 1 MAX_END EQUAL -compare_x_at_limit 5 MIN_END 5 MAX_END EQUAL -compare_x_at_limit 7 MIN_END 7 MAX_END EQUAL -compare_x_at_limit 5 MIN_END 1 MAX_END SMALLER -compare_x_at_limit 5 MIN_END 7 MAX_END SMALLER -compare_x_at_limit 1 MIN_END 7 MAX_END SMALLER -compare_x_at_limit 1 MIN_END 5 MAX_END LARGER -compare_x_at_limit 7 MIN_END 5 MAX_END LARGER -compare_x_at_limit 7 MIN_END 1 MAX_END LARGER -# -compare_x_at_limit 1 MAX_END 1 MIN_END EQUAL -compare_x_at_limit 5 MAX_END 5 MIN_END EQUAL -compare_x_at_limit 7 MAX_END 7 MIN_END EQUAL -compare_x_at_limit 5 MAX_END 1 MIN_END SMALLER -compare_x_at_limit 5 MAX_END 7 MIN_END SMALLER -compare_x_at_limit 1 MAX_END 7 MIN_END SMALLER -compare_x_at_limit 1 MAX_END 5 MIN_END LARGER -compare_x_at_limit 7 MAX_END 5 MIN_END LARGER -compare_x_at_limit 7 MAX_END 1 MIN_END LARGER -# diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_near_boundary b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_near_boundary new file mode 100644 index 00000000000..874d92ca545 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_near_boundary @@ -0,0 +1 @@ +compare_x_near_boundary 1 1 MIN_END EQUAL diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_near_limit b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_near_limit deleted file mode 100644 index f7cb2ea70da..00000000000 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_near_limit +++ /dev/null @@ -1 +0,0 @@ -compare_x_near_limit 1 1 MIN_END EQUAL diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_on_boundary b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_on_boundary new file mode 100644 index 00000000000..836cc9b2a02 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_on_boundary @@ -0,0 +1,80 @@ +# a point and a vertical line +compare_x_on_boundary 4 1 MIN_END EQUAL +compare_x_on_boundary 4 1 MAX_END EQUAL +compare_x_on_boundary 1 1 MIN_END SMALLER +compare_x_on_boundary 1 1 MAX_END SMALLER +compare_x_on_boundary 7 1 MIN_END LARGER +compare_x_on_boundary 7 1 MAX_END LARGER +# +compare_x_on_boundary 1 5 MIN_END EQUAL +compare_x_on_boundary 1 5 MAX_END EQUAL +compare_x_on_boundary 4 5 MIN_END LARGER +compare_x_on_boundary 4 5 MAX_END LARGER +# a point and a vertical ray +compare_x_on_boundary 4 15 MIN_END EQUAL +compare_x_on_boundary 1 15 MIN_END SMALLER +compare_x_on_boundary 7 15 MIN_END LARGER +compare_x_on_boundary 4 13 MAX_END EQUAL +compare_x_on_boundary 1 13 MAX_END SMALLER +compare_x_on_boundary 7 13 MAX_END LARGER +# a vertical line and a vertical line +compare_x_on_boundary 1 MIN_END 1 MIN_END EQUAL +compare_x_on_boundary 5 MIN_END 5 MIN_END EQUAL +compare_x_on_boundary 7 MIN_END 7 MIN_END EQUAL +compare_x_on_boundary 5 MIN_END 1 MIN_END SMALLER +compare_x_on_boundary 5 MIN_END 7 MIN_END SMALLER +compare_x_on_boundary 1 MIN_END 7 MIN_END SMALLER +compare_x_on_boundary 1 MIN_END 5 MIN_END LARGER +compare_x_on_boundary 7 MIN_END 5 MIN_END LARGER +compare_x_on_boundary 7 MIN_END 1 MIN_END LARGER +# +compare_x_on_boundary 1 MAX_END 1 MAX_END EQUAL +compare_x_on_boundary 5 MAX_END 5 MAX_END EQUAL +compare_x_on_boundary 7 MAX_END 7 MAX_END EQUAL +compare_x_on_boundary 5 MAX_END 1 MAX_END SMALLER +compare_x_on_boundary 5 MAX_END 7 MAX_END SMALLER +compare_x_on_boundary 1 MAX_END 7 MAX_END SMALLER +compare_x_on_boundary 1 MAX_END 5 MAX_END LARGER +compare_x_on_boundary 7 MAX_END 5 MAX_END LARGER +compare_x_on_boundary 7 MAX_END 1 MAX_END LARGER +# +compare_x_on_boundary 1 MAX_END 1 MIN_END EQUAL +compare_x_on_boundary 5 MAX_END 5 MIN_END EQUAL +compare_x_on_boundary 7 MAX_END 7 MIN_END EQUAL +compare_x_on_boundary 5 MAX_END 1 MIN_END SMALLER +compare_x_on_boundary 5 MAX_END 7 MIN_END SMALLER +compare_x_on_boundary 1 MAX_END 7 MIN_END SMALLER +compare_x_on_boundary 1 MAX_END 5 MIN_END LARGER +compare_x_on_boundary 7 MAX_END 5 MIN_END LARGER +compare_x_on_boundary 7 MAX_END 1 MIN_END LARGER +# +compare_x_on_boundary 1 MIN_END 1 MAX_END EQUAL +compare_x_on_boundary 5 MIN_END 5 MAX_END EQUAL +compare_x_on_boundary 7 MIN_END 7 MAX_END EQUAL +compare_x_on_boundary 5 MIN_END 1 MAX_END SMALLER +compare_x_on_boundary 5 MIN_END 7 MAX_END SMALLER +compare_x_on_boundary 1 MIN_END 7 MAX_END SMALLER +compare_x_on_boundary 1 MIN_END 5 MAX_END LARGER +compare_x_on_boundary 7 MIN_END 5 MAX_END LARGER +compare_x_on_boundary 7 MIN_END 1 MAX_END LARGER +# +compare_x_on_boundary 1 MIN_END 1 MAX_END EQUAL +compare_x_on_boundary 5 MIN_END 5 MAX_END EQUAL +compare_x_on_boundary 7 MIN_END 7 MAX_END EQUAL +compare_x_on_boundary 5 MIN_END 1 MAX_END SMALLER +compare_x_on_boundary 5 MIN_END 7 MAX_END SMALLER +compare_x_on_boundary 1 MIN_END 7 MAX_END SMALLER +compare_x_on_boundary 1 MIN_END 5 MAX_END LARGER +compare_x_on_boundary 7 MIN_END 5 MAX_END LARGER +compare_x_on_boundary 7 MIN_END 1 MAX_END LARGER +# +compare_x_on_boundary 1 MAX_END 1 MIN_END EQUAL +compare_x_on_boundary 5 MAX_END 5 MIN_END EQUAL +compare_x_on_boundary 7 MAX_END 7 MIN_END EQUAL +compare_x_on_boundary 5 MAX_END 1 MIN_END SMALLER +compare_x_on_boundary 5 MAX_END 7 MIN_END SMALLER +compare_x_on_boundary 1 MAX_END 7 MIN_END SMALLER +compare_x_on_boundary 1 MAX_END 5 MIN_END LARGER +compare_x_on_boundary 7 MAX_END 5 MIN_END LARGER +compare_x_on_boundary 7 MAX_END 1 MIN_END LARGER +# diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_at_limit b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_at_limit deleted file mode 100644 index e67ef1ebcc4..00000000000 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_at_limit +++ /dev/null @@ -1,36 +0,0 @@ -# a point and a vertical asymptote -compare_x_at_limit 1 16 MIN_END SMALLER -compare_x_at_limit 1 17 MAX_END SMALLER -compare_x_at_limit 1 18 MIN_END SMALLER -compare_x_at_limit 1 19 MAX_END SMALLER -# -compare_x_at_limit 7 16 MIN_END LARGER -compare_x_at_limit 7 17 MAX_END LARGER -compare_x_at_limit 7 18 MIN_END LARGER -compare_x_at_limit 7 19 MAX_END LARGER -# -compare_x_at_limit 4 16 MIN_END EQUAL -compare_x_at_limit 4 17 MAX_END EQUAL -compare_x_at_limit 4 18 MIN_END EQUAL -compare_x_at_limit 4 19 MAX_END EQUAL -# a vertical asymptote and a vertical asymptote -compare_x_at_limit 16 MIN_END 24 MIN_END SMALLER -compare_x_at_limit 17 MAX_END 25 MAX_END SMALLER -compare_x_at_limit 18 MIN_END 26 MIN_END SMALLER -compare_x_at_limit 19 MAX_END 27 MAX_END SMALLER -compare_x_at_limit 16 MIN_END 32 MIN_END LARGER -compare_x_at_limit 17 MAX_END 33 MAX_END LARGER -compare_x_at_limit 18 MIN_END 34 MIN_END LARGER -compare_x_at_limit 19 MAX_END 35 MAX_END LARGER -# -compare_x_at_limit 16 MIN_END 17 MAX_END EQUAL -compare_x_at_limit 16 MIN_END 18 MIN_END EQUAL -compare_x_at_limit 16 MIN_END 19 MAX_END EQUAL -compare_x_at_limit 17 MAX_END 18 MIN_END EQUAL -compare_x_at_limit 17 MAX_END 19 MAX_END EQUAL -compare_x_at_limit 18 MIN_END 19 MAX_END EQUAL -# -compare_x_at_limit 16 MIN_END 20 MIN_END EQUAL -compare_x_at_limit 17 MAX_END 21 MAX_END EQUAL -compare_x_at_limit 18 MIN_END 22 MIN_END EQUAL -compare_x_at_limit 19 MAX_END 23 MAX_END EQUAL diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_near_boundary b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_near_boundary new file mode 100644 index 00000000000..3da65462ae2 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_near_boundary @@ -0,0 +1,4 @@ +compare_x_near_boundary 16 20 MIN_END SMALLER +compare_x_near_boundary 18 22 MIN_END SMALLER +compare_x_near_boundary 20 16 MIN_END LARGER +compare_x_near_boundary 20 20 MIN_END EQUAL diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_near_limit b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_near_limit deleted file mode 100644 index 74eaf8c9f1d..00000000000 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_near_limit +++ /dev/null @@ -1,4 +0,0 @@ -compare_x_near_limit 16 20 MIN_END SMALLER -compare_x_near_limit 18 22 MIN_END SMALLER -compare_x_near_limit 20 16 MIN_END LARGER -compare_x_near_limit 20 20 MIN_END EQUAL diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_on_boundary b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_on_boundary new file mode 100644 index 00000000000..3afc6c34729 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_on_boundary @@ -0,0 +1,36 @@ +# a point and a vertical asymptote +compare_x_on_boundary 1 16 MIN_END SMALLER +compare_x_on_boundary 1 17 MAX_END SMALLER +compare_x_on_boundary 1 18 MIN_END SMALLER +compare_x_on_boundary 1 19 MAX_END SMALLER +# +compare_x_on_boundary 7 16 MIN_END LARGER +compare_x_on_boundary 7 17 MAX_END LARGER +compare_x_on_boundary 7 18 MIN_END LARGER +compare_x_on_boundary 7 19 MAX_END LARGER +# +compare_x_on_boundary 4 16 MIN_END EQUAL +compare_x_on_boundary 4 17 MAX_END EQUAL +compare_x_on_boundary 4 18 MIN_END EQUAL +compare_x_on_boundary 4 19 MAX_END EQUAL +# a vertical asymptote and a vertical asymptote +compare_x_on_boundary 16 MIN_END 24 MIN_END SMALLER +compare_x_on_boundary 17 MAX_END 25 MAX_END SMALLER +compare_x_on_boundary 18 MIN_END 26 MIN_END SMALLER +compare_x_on_boundary 19 MAX_END 27 MAX_END SMALLER +compare_x_on_boundary 16 MIN_END 32 MIN_END LARGER +compare_x_on_boundary 17 MAX_END 33 MAX_END LARGER +compare_x_on_boundary 18 MIN_END 34 MIN_END LARGER +compare_x_on_boundary 19 MAX_END 35 MAX_END LARGER +# +compare_x_on_boundary 16 MIN_END 17 MAX_END EQUAL +compare_x_on_boundary 16 MIN_END 18 MIN_END EQUAL +compare_x_on_boundary 16 MIN_END 19 MAX_END EQUAL +compare_x_on_boundary 17 MAX_END 18 MIN_END EQUAL +compare_x_on_boundary 17 MAX_END 19 MAX_END EQUAL +compare_x_on_boundary 18 MIN_END 19 MAX_END EQUAL +# +compare_x_on_boundary 16 MIN_END 20 MIN_END EQUAL +compare_x_on_boundary 17 MAX_END 21 MAX_END EQUAL +compare_x_on_boundary 18 MIN_END 22 MIN_END EQUAL +compare_x_on_boundary 19 MAX_END 23 MAX_END EQUAL diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test02.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test02.wrl index dc2e1d212d5..961c167ab9d 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test02.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test02.wrl @@ -97,24 +97,22 @@ Transform { # insertionStrategy "increment" aosMarkedEdgeIndex 100 coord DEF COORD ExactCoordinate { - ratPoint [ - 0 0 1 - 1 -2 0 - 1 -1 1 - 2 1 0 - 1 0 1 - 1 1 0 - ] + exactPoint [0 0 1, + 1 -2 0, + 1 -1 1, + 2 1 0, + 1 0 1, + 1 1 0 + ] } # Pointindex [6 7] - curveIndex [ - 0 1 - 3 1 - 2 0 - 4 0 - 2 3 - 4 3 - 5 3 + curveIndex [0 1, + 3 1, + 2 0, + 4 0, + 2 3, + 4 3, + 5 3, 0 5 ] } @@ -207,7 +205,7 @@ Transform { } ] } - + # The axes: DEF AXES Transform { scale 0.1 0.1 0.1 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test03.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test03.wrl index e454612c276..8e9c6bf69bb 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test03.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test03.wrl @@ -99,12 +99,12 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 0 coord DEF COORD ExactCoordinate { - ratPoint [-1 0 -1, - -1 -1 0, - 0 0 1, - -1 2 0, - -1 1 0 - ] + exactPoint [-1 0 -1, + -1 -1 0, + 0 0 1, + -1 2 0, + -1 1 0 + ] } # Pointindex [6 7] curveIndex [0 1 1 2 2 3 3 0 4 2] @@ -198,7 +198,7 @@ Transform { } ] } - + # The axes: DEF AXES Transform { scale 0.1 0.1 0.1 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test04.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test04.wrl index a443773bb47..309108f4f5c 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test04.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test04.wrl @@ -99,12 +99,12 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 0 coord DEF COORD ExactCoordinate { - ratPoint [-1 -1 0 - 1 -1 0, - 0 0 1, - -1 -2 1, - 1 -2 1 - ] + exactPoint [-1 -1 0 + 1 -1 0, + 0 0 1, + -1 -2 1, + 1 -2 1 + ] } # Pointindex [6 7] curveIndex [0 1 1 2 2 0 3 4] @@ -198,7 +198,7 @@ Transform { } ] } - + # The axes: DEF AXES Transform { scale 0.1 0.1 0.1 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test05.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test05.wrl index f95dd63c57e..08115c99ac9 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test05.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test05.wrl @@ -99,11 +99,11 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 0 coord DEF COORD ExactCoordinate { - ratPoint [-1 -1 0 - 1 -1 0, - 0 0 1, - 0 -1 1 - ] + exactPoint [-1 -1 0 + 1 -1 0, + 0 0 1, + 0 -1 1 + ] } # Pointindex [6 7] curveIndex [0 1 1 2 2 0 2 3] @@ -197,7 +197,7 @@ Transform { } ] } - + # The axes: DEF AXES Transform { scale 0.1 0.1 0.1 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test06.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test06.wrl index 5248aa896ae..19f02f21789 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test06.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test06.wrl @@ -99,13 +99,13 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 0 1 coord DEF COORD ExactCoordinate { - ratPoint [-1 0 -1, - -1 -1 0, - 0 0 1, - -1 2 0, - -1 1 0 - -1 0 0 - ] + exactPoint [-1 0 -1, + -1 -1 0, + 0 0 1, + -1 2 0, + -1 1 0 + -1 0 0 + ] } # Pointindex [6 7] curveIndex [0 1 1 2 2 3 3 0 4 5] @@ -199,7 +199,7 @@ Transform { } ] } - + # The axes: DEF AXES Transform { scale 0.1 0.1 0.1 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test07.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test07.wrl index 6bdf7a0060e..e49876eacc1 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test07.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test07.wrl @@ -99,13 +99,13 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 0 coord DEF COORD ExactCoordinate { - ratPoint [-1 0 -1, - -2 -1 0, - 0 0 1, - -2 1 0, - 0 1 0 - -1 1 0 - ] + exactPoint [-1 0 -1, + -2 -1 0, + 0 0 1, + -2 1 0, + 0 1 0 + -1 1 0 + ] } # Pointindex [6 7] curveIndex [0 1 1 2 2 3 3 0 4 5] @@ -199,7 +199,7 @@ Transform { } ] } - + # The axes: DEF AXES Transform { scale 0.1 0.1 0.1 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test01.txt index ef70000e20e..fa7bfdb05eb 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test01.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test01.txt @@ -14,55 +14,55 @@ # number_of_faces 2 # BEGIN VERTICES -4 3 1 0 0 1 +4 3 1 0 0 1 3 5 -4 4 1 0 -1 0 +4 4 1 0 -1 0 0 7 -4 4 1 1 -2 -1 +4 4 1 1 -2 -1 0 7 -4 4 1 2 -1 -1 +4 4 1 2 -1 -1 0 6 -4 4 1 1 0 0 +4 4 1 1 0 0 0 6 # END VERTICES # BEGIN EDGES -0 1 1 1 0 0 1 0 -1 0 0 +0 1 1 1 0 0 1 3 0 -1 0 0 1 0 0 0 1 0 5 5 -3 2 1 1 1 -2 -1 2 -1 -1 0 +3 2 1 1 1 -2 -1 0 2 -1 -1 0 1 -1 3 1 0 0 7 7 -4 1 1 1 0 -1 0 1 0 0 0 +4 1 1 1 0 -1 0 0 1 0 0 0 0 0 1 1 0 0 5 5 -0 4 1 1 1 0 0 0 0 1 0 +0 4 1 1 1 0 0 0 0 0 1 3 0 -1 0 1 1 0 5 5 # END EDGES # BEGIN FACES # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 0 # number_of_inner_ccbs 2 # halfedges_on_inner_ccb 3 -1 6 4 +1 6 4 # halfedges_on_inner_ccb 2 -3 2 +3 2 # number_of_isolated_vertices 0 8 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -7 0 5 +7 0 5 # number_of_inner_ccbs 0 # number_of_isolated_vertices diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test01.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test01.wrl index 7dec283cf8e..987662dc6f2 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test01.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test01.wrl @@ -97,13 +97,11 @@ Transform { aosIsolatedVertexStyle "disc" # insertionStrategy "increment" aosMarkedEdgeIndex 1 - coord DEF COORD ExactCoordinate { - ratPoint [0 0 1, 0 -1 0, 1 0 0, - 1 -2 -1, 2 -1 -1] + coord DEF COORD EpecCoordinate { + exactPoint [0 0 1, 0 -1 0, 1 0 0, 1 -2 -1, 2 -1 -1] } # pointIndex [6 7] - curveIndex [0 1, 1 2, 2 0, - 3 4] + curveIndex [0 1, 1 2, 2 0, 3 4] } } ] @@ -132,7 +130,14 @@ Transform { } } Shape { - appearance USE AXES_APP + appearance DEF AXES_APP Appearance { + material Material { + # ambientIntensity 1 + diffuseColor 0.4 0.4 0.4 + # specularColor 0.3 0.3 0.3 + # transparency 0.0001 + } + } geometry Sphere { center 0 0 -1 radius 0.05 @@ -194,20 +199,13 @@ Transform { } ] } - + # The axes: DEF AXES Transform { scale 0.1 0.1 0.1 children [ Shape { - appearance DEF AXES_APP Appearance { - material Material { - # ambientIntensity 1 - diffuseColor 0.4 0.4 0.4 - # specularColor 0.3 0.3 0.3 - # transparency 0.0001 - } - } + appearance USE AXES_APP geometry Sphere { radius 0.1 } } DEF CS_AXIS Transform { diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test02.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test02.txt index c6d40189236..31e116045e9 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test02.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test02.txt @@ -36,127 +36,127 @@ # number_of_faces 16 # BEGIN VERTICES -0 4 1 -1 0 0 +0 4 1 -1 0 0 2 6 -4 2 1 0 0 -1 +4 2 1 0 0 -1 1 16 -4 4 1 -2 -1 0 +4 4 1 -2 -1 0 0 8 -4 3 1 0 0 1 +4 3 1 0 0 1 3 8 -4 4 1 -1 -1 0 +4 4 1 -1 -1 0 0 8 -4 4 1 1 -2 0 +4 4 1 1 -2 0 0 8 -4 4 1 1 -1 0 +4 4 1 1 -1 0 0 8 -4 4 1 2 1 0 +4 4 1 2 1 0 0 8 -4 4 1 1 1 0 +4 4 1 1 1 0 0 8 -4 4 1 -1 2 0 +4 4 1 -1 2 0 0 8 -4 4 1 -1 1 0 +4 4 1 -1 1 0 0 8 # END VERTICES # BEGIN EDGES -2 1 1 1 0 0 -1 -2 -1 0 0 +2 1 1 1 0 0 -1 1 -2 -1 0 0 -1 2 0 1 1 0 16 16 -0 2 0 1 -1 0 0 -2 -1 0 0 +0 2 0 1 -1 0 0 2 -2 -1 0 0 0 0 1 1 0 0 4 4 -3 2 1 1 -2 -1 0 0 0 1 0 +3 2 1 1 -2 -1 0 0 0 0 1 3 -1 2 0 1 1 0 7 7 -4 1 1 1 -1 -1 0 0 0 -1 0 +4 1 1 1 -1 -1 0 0 0 0 -1 1 1 -1 0 0 1 0 12 12 -2 4 0 1 -2 -1 0 -1 -1 0 0 +2 4 0 1 -2 -1 0 0 -1 -1 0 0 0 0 1 1 0 0 4 4 -3 4 1 1 -1 -1 0 0 0 1 0 +3 4 1 1 -1 -1 0 0 0 0 1 3 -1 1 0 1 1 0 10 10 -5 1 1 1 1 -2 0 0 0 -1 0 +5 1 1 1 1 -2 0 0 0 0 -1 1 2 1 0 0 1 0 12 12 -4 5 0 1 -1 -1 0 1 -2 0 0 +4 5 0 1 -1 -1 0 0 1 -2 0 0 0 0 3 1 0 0 4 4 -3 5 1 1 1 -2 0 0 0 1 0 +3 5 1 1 1 -2 0 0 0 0 1 3 -2 -1 0 1 1 0 10 10 -6 1 1 1 1 -1 0 0 0 -1 0 +6 1 1 1 1 -1 0 0 0 0 -1 1 1 1 0 0 1 0 12 12 -5 6 0 1 1 -2 0 1 -1 0 0 +5 6 0 1 1 -2 0 0 1 -1 0 0 0 0 1 1 0 0 4 4 -3 6 1 1 0 0 1 1 -1 0 0 +3 6 1 1 0 0 1 3 1 -1 0 0 1 1 0 0 1 0 10 10 -7 1 1 1 0 0 -1 2 1 0 0 +7 1 1 1 0 0 -1 1 2 1 0 0 1 -2 0 1 1 0 12 12 -6 7 0 1 1 -1 0 2 1 0 0 +6 7 0 1 1 -1 0 0 2 1 0 0 0 0 3 1 0 0 4 4 -3 7 1 1 0 0 1 2 1 0 0 +3 7 1 1 0 0 1 3 2 1 0 0 -1 2 0 0 1 0 10 10 -8 1 1 1 1 1 0 0 0 -1 0 +8 1 1 1 1 1 0 0 0 0 -1 1 -1 1 0 0 1 0 12 12 -7 8 0 1 2 1 0 1 1 0 0 +7 8 0 1 2 1 0 0 1 1 0 0 0 0 1 1 0 0 4 4 -3 8 1 1 0 0 1 1 1 0 0 +3 8 1 1 0 0 1 3 1 1 0 0 -1 1 0 0 1 0 10 10 -9 1 1 1 0 0 -1 -1 2 0 0 +9 1 1 1 0 0 -1 1 -1 2 0 0 2 1 0 1 1 0 12 12 -8 9 0 1 1 1 0 -1 2 0 0 +8 9 0 1 1 1 0 0 -1 2 0 0 0 0 3 1 0 0 4 4 -3 9 1 1 -1 2 0 0 0 1 0 +3 9 1 1 -1 2 0 0 0 0 1 3 2 1 0 1 1 0 10 10 -10 1 1 1 -1 1 0 0 0 -1 0 +10 1 1 1 -1 1 0 0 0 0 -1 1 -1 -1 0 0 1 0 16 16 -9 10 0 1 -1 2 0 -1 1 0 0 +9 10 0 1 -1 2 0 0 -1 1 0 0 0 0 1 1 0 0 4 4 -3 10 1 1 0 0 1 -1 1 0 0 +3 10 1 1 0 0 1 3 -1 1 0 0 -1 -1 0 0 1 0 7 7 -10 0 0 1 -1 1 0 -1 0 0 0 +10 0 0 1 -1 1 0 0 -1 0 0 2 0 0 1 1 0 0 4 4 # END EDGES # BEGIN FACES # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 0 # number_of_inner_ccbs 1 # halfedges_on_inner_ccb 4 -48 2 5 46 +48 2 5 46 # number_of_isolated_vertices 0 10 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -9 0 7 +9 0 7 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -164,12 +164,12 @@ 24 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -11 4 8 +11 4 8 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -177,12 +177,12 @@ 13 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -15 6 13 +15 6 13 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -190,12 +190,12 @@ 20 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -17 10 14 +17 10 14 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -203,12 +203,12 @@ 16 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -21 12 19 +21 12 19 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -216,12 +216,12 @@ 20 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -23 16 20 +23 16 20 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -229,12 +229,12 @@ 16 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -27 18 25 +27 18 25 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -242,12 +242,12 @@ 20 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -29 22 26 +29 22 26 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -255,12 +255,12 @@ 16 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -33 24 31 +33 24 31 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -268,12 +268,12 @@ 20 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -35 28 32 +35 28 32 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -281,12 +281,12 @@ 16 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -39 30 37 +39 30 37 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -294,12 +294,12 @@ 20 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -41 34 38 +41 34 38 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -307,12 +307,12 @@ 16 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -45 36 43 +45 36 43 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -320,12 +320,12 @@ 24 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -47 40 44 +47 40 44 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -333,12 +333,12 @@ 13 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 4 -49 42 1 3 +49 42 1 3 # number_of_inner_ccbs 0 # number_of_isolated_vertices diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test02.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test02.wrl index b1b1ec78b17..750b87ac600 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test02.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test02.wrl @@ -100,9 +100,9 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 0 aosMarkedVertexStyle "none" - coord DEF COORD ExactCoordinate { - ratPoint [0 0 -1, 1 1 0, -1 1 0, -1 0 0 - -1 -1 0, 1 -1 0, 0 0 1] + coord DEF COORD EpecCoordinate { + exactPoint [0 0 -1, 1 1 0, -1 1 0, -1 0 0 + -1 -1 0, 1 -1 0, 0 0 1] } # pointIndex [6 7] curveIndex [1 0, 2 1, 2 0, 3 2, 4 3, 4 0, 5 4, @@ -132,16 +132,16 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 0 aosMarkedVertexStyle "none" - coord DEF COORD2 ExactCoordinate { - ratPoint [2 1 0, 0 0 1, -1 2 0, 0 0 -1 - 1 -2 0, -2 -1 0, -1 0 0] + coord DEF COORD2 EpecCoordinate { + exactPoint [2 1 0, 0 0 1, -1 2 0, 0 0 -1 + 1 -2 0, -2 -1 0, -1 0 0] } # pointIndex [6 7] curveIndex [1 0, 2 1, 2 0, 3 2, 3 0, 4 3 4 0, 4 1, 5 4, 5 1, 3 5, 6 2, 6 5] } } - + ] } ] @@ -168,7 +168,14 @@ Transform { } } Shape { - appearance USE AXES_APP + appearance DEF AXES_APP Appearance { + material Material { + # ambientIntensity 1 + diffuseColor 0.4 0.4 0.4 + # specularColor 0.3 0.3 0.3 + # transparency 0.0001 + } + } geometry Sphere { center 0 0 -1 radius 0.05 @@ -230,20 +237,13 @@ Transform { } ] } - + # The axes: DEF AXES Transform { scale 0.1 0.1 0.1 children [ Shape { - appearance DEF AXES_APP Appearance { - material Material { - # ambientIntensity 1 - diffuseColor 0.4 0.4 0.4 - # specularColor 0.3 0.3 0.3 - # transparency 0.0001 - } - } + appearance USE AXES_APP geometry Sphere { radius 0.1 } } DEF CS_AXIS Transform { diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test03.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test03.txt index 0322ffd0859..518493c4dfd 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test03.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test03.txt @@ -17,63 +17,63 @@ # number_of_faces 3 # BEGIN VERTICES -0 4 1 -1 0 0 +0 4 1 -1 0 0 2 8 -4 4 1 -1 -1 0 +4 4 1 -1 -1 0 0 8 -4 3 1 0 0 1 +4 3 1 0 0 1 3 4 -4 4 1 0 -1 0 +4 4 1 0 -1 0 0 18 -4 4 1 1 0 0 +4 4 1 1 0 0 0 17 -4 4 1 -1 1 0 +4 4 1 -1 1 0 0 9 # END VERTICES # BEGIN EDGES -1 0 1 1 -1 0 0 -1 -1 0 0 +1 0 1 1 -1 0 0 2 -1 -1 0 0 0 0 1 1 0 0 7 7 -2 1 1 1 -1 -1 0 0 0 1 0 +2 1 1 1 -1 -1 0 0 0 0 1 3 -1 1 0 1 1 0 7 7 -3 2 0 1 0 0 1 0 -1 0 0 +3 2 0 1 0 0 1 3 0 -1 0 0 1 0 0 0 1 0 16 16 -4 3 1 1 0 -1 0 1 0 0 0 +4 3 1 1 0 -1 0 0 1 0 0 0 0 0 1 1 0 0 16 16 -2 4 1 1 1 0 0 0 0 1 0 +2 4 1 1 1 0 0 0 0 0 1 3 0 -1 0 1 1 0 16 16 -5 2 0 1 0 0 1 -1 1 0 0 +5 2 0 1 0 0 1 3 -1 1 0 0 -1 -1 0 0 1 0 7 7 -5 0 0 1 -1 1 0 -1 0 0 0 +5 0 0 1 -1 1 0 0 -1 0 0 2 0 0 1 1 0 0 7 7 # END EDGES # BEGIN FACES # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 0 # number_of_inner_ccbs 1 # halfedges_on_inner_ccb 4 -1 3 11 12 +1 3 11 12 # number_of_isolated_vertices 0 10 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -9 5 7 +9 5 7 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -81,12 +81,12 @@ 22 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 7 -13 10 8 6 4 2 0 +13 10 8 6 4 2 0 # number_of_inner_ccbs 0 # number_of_isolated_vertices diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test03.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test03.wrl index 362a80d07be..9b3315c42f9 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test03.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test03.wrl @@ -98,8 +98,8 @@ Transform { aosIsolatedVertexStyle "disc" # insertionStrategy "increment" aosMarkedEdgeIndex 10 - coord DEF COORD ExactCoordinate { - ratPoint [0 0 1, 0 -1 0, 1 0 0] + coord DEF COORD EpecCoordinate { + exactPoint [0 0 1, 0 -1 0, 1 0 0] } # pointIndex [6 7] curveIndex [0 1, 1 2, 2 0] @@ -128,14 +128,14 @@ Transform { aosMarkedEdgeIndex 10 aosMarkedVertexStyle "none" aosMarkedVertexIndex 0 - coord DEF COORD2 ExactCoordinate { - ratPoint [0 0 1, -1 1 0, -1 0 0, -1 -1 0] + coord DEF COORD2 EpecCoordinate { + exactPoint [0 0 1, -1 1 0, -1 0 0, -1 -1 0] } # pointIndex [6 7] curveIndex [0 1, 1 2, 2 3, 3 0] } } - + ] } ] @@ -162,7 +162,14 @@ Transform { } } Shape { - appearance USE AXES_APP + appearance DEF AXES_APP Appearance { + material Material { + # ambientIntensity 1 + diffuseColor 0.4 0.4 0.4 + # specularColor 0.3 0.3 0.3 + # transparency 0.0001 + } + } geometry Sphere { center 0 0 -1 radius 0.05 @@ -224,20 +231,13 @@ Transform { } ] } - + # The axes: DEF AXES Transform { scale 0.1 0.1 0.1 children [ Shape { - appearance DEF AXES_APP Appearance { - material Material { - # ambientIntensity 1 - diffuseColor 0.4 0.4 0.4 - # specularColor 0.3 0.3 0.3 - # transparency 0.0001 - } - } + appearance USE AXES_APP geometry Sphere { radius 0.1 } } DEF CS_AXIS Transform { diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test04.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test04.txt index d739162c732..005ad5209a3 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test04.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test04.txt @@ -19,71 +19,71 @@ # number_of_faces 4 # BEGIN VERTICES -0 4 1 -1 0 -1 +0 4 1 -1 0 -1 2 10 -0 4 1 -1 0 0 +0 4 1 -1 0 0 2 15 -0 4 1 -1 0 1 +0 4 1 -1 0 1 2 6 -4 4 1 -2 -1 0 +4 4 1 -2 -1 0 0 14 -4 4 1 -1 -1 0 +4 4 1 -1 -1 0 0 9 -4 4 1 -1 1 0 +4 4 1 -1 1 0 0 8 -4 4 1 -2 1 2 +4 4 1 -2 1 2 0 9 # END VERTICES # BEGIN EDGES -3 1 1 1 -1 0 0 -2 -1 0 0 +3 1 1 1 -1 0 0 2 -2 -1 0 0 0 0 1 1 0 0 14 14 -2 3 0 1 -2 -1 0 -1 0 1 0 +2 3 0 1 -2 -1 0 0 -1 0 1 2 -1 2 -1 0 0 0 14 14 -4 0 1 1 -1 0 -1 -1 -1 0 0 +4 0 1 1 -1 0 -1 2 -1 -1 0 0 -1 1 1 1 0 0 9 9 -2 4 0 1 -1 -1 0 -1 0 1 0 +2 4 0 1 -1 -1 0 0 -1 0 1 2 -1 1 -1 0 0 0 9 9 -6 5 1 1 -2 1 2 -1 1 0 0 +6 5 1 1 -2 1 2 0 -1 1 0 0 -2 -2 -1 0 0 0 8 8 -5 0 0 1 -1 1 0 -1 0 -1 0 +5 0 0 1 -1 1 0 0 -1 0 -1 2 -1 -1 1 1 0 0 9 9 -5 1 0 1 -1 1 0 -1 0 0 0 +5 1 0 1 -1 1 0 0 -1 0 0 2 0 0 1 1 0 0 14 14 -5 2 0 1 -1 0 1 -1 1 0 0 +5 2 0 1 -1 0 1 2 -1 1 0 0 -1 -1 -1 0 0 0 18 18 -6 2 0 1 -1 0 1 -2 1 2 0 +6 2 0 1 -1 0 1 2 -2 1 2 0 -1 0 -1 0 0 0 8 8 # END EDGES # BEGIN FACES # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 0 # number_of_inner_ccbs 1 # halfedges_on_inner_ccb 5 -16 6 4 11 9 +16 6 4 11 9 # number_of_isolated_vertices 0 13 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 6 -13 10 5 7 2 0 +13 10 5 7 2 0 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -91,12 +91,12 @@ 19 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 4 -15 12 1 3 +15 12 1 3 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -104,12 +104,12 @@ 28 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -17 8 14 +17 8 14 # number_of_inner_ccbs 0 # number_of_isolated_vertices diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test04.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test04.wrl index 66a852a2b57..9d00423f0c2 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test04.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test04.wrl @@ -100,8 +100,8 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 0 1 aosMarkedVertexStyle "none" - coord DEF COORD ExactCoordinate { - ratPoint [-1 1 0, -1 0 -1, -1 -1 0, -1 0 1] + coord DEF COORD EpecCoordinate { + exactPoint [-1 1 0, -1 0 -1, -1 -1 0, -1 0 1] } # pointIndex [6 7] curveIndex [0 1, 1 2, 2 3, 3 0] @@ -129,8 +129,8 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 1 aosMarkedVertexStyle "none" - coord DEF COORD ExactCoordinate { - ratPoint [-1 1 0, -1 0 0, -2 -1 0, -1 0 1, -2 1 2] + coord DEF COORD EpecCoordinate { + exactPoint [-1 1 0, -1 0 0, -2 -1 0, -1 0 1, -2 1 2] } # pointIndex [6 7] curveIndex [0 1, 1 2, 2 3, 3 4, 4 0] @@ -163,7 +163,14 @@ Transform { } } Shape { - appearance USE AXES_APP + appearance DEF AXES_APP Appearance { + material Material { + # ambientIntensity 1 + diffuseColor 0.4 0.4 0.4 + # specularColor 0.3 0.3 0.3 + # transparency 0.0001 + } + } geometry Sphere { center 0 0 -1 radius 0.05 @@ -225,20 +232,13 @@ Transform { } ] } - + # The axes: DEF AXES Transform { scale 0.1 0.1 0.1 children [ Shape { - appearance DEF AXES_APP Appearance { - material Material { - # ambientIntensity 1 - diffuseColor 0.4 0.4 0.4 - # specularColor 0.3 0.3 0.3 - # transparency 0.0001 - } - } + appearance USE AXES_APP geometry Sphere { radius 0.1 } } DEF CS_AXIS Transform { diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test05.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test05.txt index d437e6070cc..7ae62116eab 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test05.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test05.txt @@ -23,89 +23,89 @@ # number_of_faces 5 # BEGIN VERTICES -4 3 1 0 0 1 +4 3 1 0 0 1 3 4 -4 4 1 -1 -1 -1 +4 4 1 -1 -1 -1 0 13 -4 4 1 1 -3 1 +4 4 1 1 -3 1 0 12 -4 4 1 2 -2 0 +4 4 1 2 -2 0 0 6 -4 4 1 3 -1 -1 +4 4 1 3 -1 -1 0 6 -4 4 1 1 0 0 +4 4 1 1 0 0 0 15 -4 4 1 3 1 -1 +4 4 1 3 1 -1 0 6 -4 4 1 2 2 0 +4 4 1 2 2 0 0 5 -4 4 1 1 3 1 +4 4 1 1 3 1 0 12 -4 4 1 -1 1 -1 +4 4 1 -1 1 -1 0 12 # END VERTICES # BEGIN EDGES -0 1 1 1 0 0 1 -1 -1 -1 0 +0 1 1 1 0 0 1 3 -1 -1 -1 0 1 -1 0 0 1 0 11 11 -2 1 1 1 1 -3 1 -1 -1 -1 0 +2 1 1 1 1 -3 1 0 -1 -1 -1 0 4 0 -4 0 0 0 11 11 -3 2 1 1 2 -2 0 1 -3 1 0 +3 2 1 1 2 -2 0 0 1 -3 1 0 -2 -2 -4 0 0 0 11 11 -0 3 1 1 2 -2 0 0 0 2 0 +0 3 1 1 2 -2 0 0 0 0 2 3 -4 -4 0 1 1 0 20 20 -4 3 1 1 2 -2 0 3 -1 -1 0 +4 3 1 1 2 -2 0 0 3 -1 -1 0 2 2 4 1 0 0 4 4 -5 4 1 1 1 0 0 3 -1 -1 0 +5 4 1 1 1 0 0 0 3 -1 -1 0 0 1 -1 0 0 0 14 14 -6 4 1 1 3 1 -1 3 -1 -1 0 +6 4 1 1 3 1 -1 0 3 -1 -1 0 -2 0 -6 0 0 0 17 17 -5 6 0 1 3 1 -1 1 0 0 0 +5 6 0 1 3 1 -1 0 1 0 0 0 0 -1 -1 0 0 0 14 14 -7 6 1 1 3 1 -1 2 2 0 0 +7 6 1 1 3 1 -1 0 2 2 0 0 2 -2 4 1 0 0 4 4 -0 7 1 1 0 0 2 2 2 0 0 +0 7 1 1 0 0 2 3 2 2 0 0 -4 4 0 0 1 0 20 20 -8 7 1 1 1 3 1 2 2 0 0 +8 7 1 1 1 3 1 0 2 2 0 0 -2 2 -4 0 0 0 11 11 -9 8 1 1 -1 1 -1 1 3 1 0 +9 8 1 1 -1 1 -1 0 1 3 1 0 4 0 -4 0 0 0 11 11 -0 9 1 1 0 0 1 -1 1 -1 0 +0 9 1 1 0 0 1 3 -1 1 -1 0 -1 -1 0 0 1 0 11 11 # END EDGES # BEGIN FACES # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 0 # number_of_inner_ccbs 1 # halfedges_on_inner_ccb 9 -1 24 22 20 16 12 8 4 2 +1 24 22 20 16 12 8 4 2 # number_of_isolated_vertices 0 24 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 4 -7 0 3 5 +7 0 3 5 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -113,12 +113,12 @@ 27 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -15 10 13 +15 10 13 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -126,12 +126,12 @@ 27 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 6 -19 6 9 11 14 17 +19 6 9 11 14 17 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -139,12 +139,12 @@ 30 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 4 -25 18 21 23 +25 18 21 23 # number_of_inner_ccbs 0 # number_of_isolated_vertices diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test05.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test05.wrl index 86b910fd140..409e5eb57d2 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test05.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test05.wrl @@ -100,30 +100,20 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 100 aosMarkedVertexStyle "none" - coord DEF COORD ExactCoordinate { - ratPoint [ - 0, 0, 1 # 0 - -1, -1, -1 # 1 - 1, -3, 1 # 2 - 3, -1, -1 # 3 - 1, 0, 0 # 4 - 2, 0, 2 # 5 - 3, 1, -1 # 6 - 1, 3, 1 # 7 - -1, 1, -1 # 8 - ] + coord DEF COORD EpecCoordinate { + exactPoint [ 0, 0, 1 # 0 + -1, -1, -1 # 1 + 1, -3, 1 # 2 + 3, -1, -1 # 3 + 1, 0, 0 # 4 + 2, 0, 2 # 5 + 3, 1, -1 # 6 + 1, 3, 1 # 7 + -1, 1, -1 # 8 + ] } # pointIndex [6 7] - curveIndex [ - 0 1 - 2 1 - 3 2 - 4 3 - 6 4 - 7 6 - 8 7 - 0 8 - ] + curveIndex [0 1 2 1 3 2 4 3 6 4 7 6 8 7 0 8] } } @@ -149,26 +139,14 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 100 aosMarkedVertexStyle "none" - coord DEF COORD2 ExactCoordinate { - ratPoint [ - 3, -1, -1 - 3, 1, -1 - 2, 2, 0 - 0, 0, 2 - 2, -2, 0 - ] + coord DEF COORD2 EpecCoordinate { + exactPoint [3, -1, -1 3, 1, -1 2, 2, 0 0, 0, 2 2, -2, 0] } # pointIndex [6 7] - curveIndex [ - 1 0 - 2 1 - 3 2 - 4 3 - 0 4 - ] + curveIndex [1 0 2 1 3 2 4 3 0 4] } } - + ] } ] @@ -195,7 +173,14 @@ Transform { } } Shape { - appearance USE AXES_APP + appearance DEF AXES_APP Appearance { + material Material { + # ambientIntensity 1 + diffuseColor 0.4 0.4 0.4 + # specularColor 0.3 0.3 0.3 + # transparency 0.0001 + } + } geometry Sphere { center 0 0 -1 radius 0.05 @@ -257,20 +242,13 @@ Transform { } ] } - + # The axes: DEF AXES Transform { scale 0.1 0.1 0.1 children [ Shape { - appearance DEF AXES_APP Appearance { - material Material { - # ambientIntensity 1 - diffuseColor 0.4 0.4 0.4 - # specularColor 0.3 0.3 0.3 - # transparency 0.0001 - } - } + appearance USE AXES_APP geometry Sphere { radius 0.1 } } DEF CS_AXIS Transform { diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test06.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test06.txt index dab8d0287f2..6257f32e042 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test06.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test06.txt @@ -12,31 +12,31 @@ # number_of_faces 1 # BEGIN VERTICES -0 4 1 -1 0 0 +0 4 1 -1 0 0 2 3 -4 4 1 0 -1 0 +4 4 1 0 -1 0 0 4 -4 4 1 0 1 0 +4 4 1 0 1 0 0 5 # END VERTICES # BEGIN EDGES -1 0 1 1 -1 0 0 0 -1 0 0 +1 0 1 1 -1 0 0 2 0 -1 0 0 0 0 1 1 0 0 5 5 -2 0 0 1 -1 0 0 0 1 0 0 +2 0 0 1 -1 0 0 2 0 1 0 0 0 0 -1 0 0 0 5 5 # END EDGES # BEGIN FACES # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 0 # number_of_inner_ccbs 1 # halfedges_on_inner_ccb 4 -1 0 3 2 +1 0 3 2 # number_of_isolated_vertices 0 6 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test06.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test06.wrl index 558ba6becbf..f7a30511718 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test06.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test06.wrl @@ -100,8 +100,8 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 100 aosMarkedVertexStyle "none" - coord DEF COORD ExactCoordinate { - ratPoint [-1 0 0, 0 -1 0] + coord DEF COORD EpecCoordinate { + exactPoint [-1 0 0, 0 -1 0] } # pointIndex [6 7] curveIndex [0 1] @@ -130,14 +130,14 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 0 aosMarkedVertexStyle "none" - coord DEF COORD2 ExactCoordinate { - ratPoint [-1 0 0, 0 1 0] + coord DEF COORD2 EpecCoordinate { + exactPoint [-1 0 0, 0 1 0] } # pointIndex [6 7] curveIndex [0 1] } } - + ] } ] @@ -164,7 +164,14 @@ Transform { } } Shape { - appearance USE AXES_APP + appearance DEF AXES_APP Appearance { + material Material { + # ambientIntensity 1 + diffuseColor 0.4 0.4 0.4 + # specularColor 0.3 0.3 0.3 + # transparency 0.0001 + } + } geometry Sphere { center 0 0 -1 radius 0.05 @@ -187,8 +194,7 @@ Transform { endCap TRUE loop FALSE crossSectionRadius 0.01 - spine [ - 0 0 1, + spine [0 0 1, -0.0980171 0 0.995185, -0.19509 0 0.980785, -0.290285 0 0.95694, @@ -226,20 +232,13 @@ Transform { } ] } - + # The axes: DEF AXES Transform { scale 0.1 0.1 0.1 children [ Shape { - appearance DEF AXES_APP Appearance { - material Material { - # ambientIntensity 1 - diffuseColor 0.4 0.4 0.4 - # specularColor 0.3 0.3 0.3 - # transparency 0.0001 - } - } + appearance USE AXES_APP geometry Sphere { radius 0.1 } } DEF CS_AXIS Transform { diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test07.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test07.txt index c1354d334db..382eaf1c675 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test07.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test07.txt @@ -14,46 +14,46 @@ # number_of_faces 4 # BEGIN VERTICES -4 2 1 0 0 -1 +4 2 1 0 0 -1 1 8 -4 3 1 0 0 1 +4 3 1 0 0 1 3 4 # END VERTICES # BEGIN EDGES -1 0 1 1 0 0 -1 0 0 1 1 -1 0 0 +1 0 1 1 0 0 -1 1 0 0 1 3 -1 0 0 1 1 0 5 5 -1 0 1 1 0 0 -1 0 0 1 1 -2 -1 0 +1 0 1 1 0 0 -1 1 0 0 1 3 -2 -1 0 1 1 0 8 8 -1 0 1 1 0 0 -1 0 0 1 1 2 -1 0 +1 0 1 1 0 0 -1 1 0 0 1 3 2 -1 0 1 1 0 8 8 -1 0 1 1 0 0 -1 0 0 1 1 1 0 0 +1 0 1 1 0 0 -1 1 0 0 1 3 1 0 0 1 1 0 5 5 # END EDGES # BEGIN FACES # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 0 # number_of_inner_ccbs 1 # halfedges_on_inner_ccb 2 -1 6 +1 6 # number_of_isolated_vertices 0 6 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 2 -3 0 +3 0 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -61,12 +61,12 @@ 9 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 2 -5 2 +5 2 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -74,12 +74,12 @@ 12 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 2 -7 4 +7 4 # number_of_inner_ccbs 0 # number_of_isolated_vertices diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test07.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test07.wrl index 18537ed8cab..315b09eace8 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test07.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test07.wrl @@ -99,11 +99,11 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 100 aosMarkedVertexStyle "none" - coord ExactCoordinate { - ratPoint [0 0 -1 0 0 1] + coord EpecCoordinate { + exactPoint [0 0 -1 0 0 1] } - normal ExactNormal { - ratVector [2 -1 0, -1 0 0] + normal EpecNormal { + exactVector [2 -1 0, -1 0 0] } # pointIndex [6 7] curveIndex [0 1 0 1] @@ -133,18 +133,18 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 100 aosMarkedVertexStyle "none" - coord ExactCoordinate { - ratPoint [0 0 -1 0 0 1] + coord EpecCoordinate { + exactPoint [0 0 -1 0 0 1] } - normal ExactNormal { - ratVector [-2 -1 0, 1 0 0] + normal EpecNormal { + exactVector [-2 -1 0, 1 0 0] } # pointIndex [6 7] curveIndex [0 1 0 1] normalIndex[0 1] } } - + ] } ] @@ -171,7 +171,14 @@ Transform { } } Shape { - appearance USE AXES_APP + appearance DEF AXES_APP Appearance { + material Material { + # ambientIntensity 1 + diffuseColor 0.4 0.4 0.4 + # specularColor 0.3 0.3 0.3 + # transparency 0.0001 + } + } geometry Sphere { center 0 0 -1 radius 0.05 @@ -194,8 +201,7 @@ Transform { endCap TRUE loop FALSE crossSectionRadius 0.01 - spine [ - 0 0 1, + spine [0 0 1, -0.0980171 0 0.995185, -0.19509 0 0.980785, -0.290285 0 0.95694, @@ -233,20 +239,13 @@ Transform { } ] } - + # The axes: DEF AXES Transform { scale 0.1 0.1 0.1 children [ Shape { - appearance DEF AXES_APP Appearance { - material Material { - # ambientIntensity 1 - diffuseColor 0.4 0.4 0.4 - # specularColor 0.3 0.3 0.3 - # transparency 0.0001 - } - } + appearance USE AXES_APP geometry Sphere { radius 0.1 } } DEF CS_AXIS Transform { diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test08.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test08.txt index 4530191c7a6..290c4cf9ffb 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test08.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test08.txt @@ -18,76 +18,76 @@ # number_of_faces 4 # BEGIN VERTICES -4 2 1 0/1 0/1 -1/1 +4 2 1 0 0 -1 1 8 -4 4 1 -1/1 -1/1 -1/1 +4 4 1 -1 -1 -1 0 7 -4 3 1 0/1 0/1 1/1 +4 3 1 0 0 1 3 6 -4 4 1 -1/1 -1/1 1/1 +4 4 1 -1 -1 1 0 8 -4 4 1 -1/1 -3/1 -1/1 +4 4 1 -1 -3 -1 0 6 -4 4 1 -1/1 -3/1 1/1 +4 4 1 -1 -3 1 0 5 -4 4 1 0/1 -1/1 0/1 +4 4 1 0 -1 0 0 12 -4 4 1 1/1 -1/1 0/1 +4 4 1 1 -1 0 0 18 # END VERTICES # BEGIN EDGES -1 0 1 1 -1/1 -1/1 -1/1 0/1 0/1 -1/1 0 +1 0 1 1 -1 -1 -1 0 0 0 -1 1 1 -1 0 0 1 0 6 6 -2 3 1 1 0/1 0/1 1/1 -1/1 -1/1 1/1 0 +2 3 1 1 0 0 1 3 -1 -1 1 0 1 -1 0 0 1 0 6 6 -4 1 1 1 -1/1 -3/1 -1/1 -1/1 -1/1 -1/1 0 +4 1 1 1 -1 -3 -1 0 -1 -1 -1 0 2 0 -2 0 0 0 6 6 -5 4 1 1 -1/1 -3/1 1/1 -1/1 -3/1 -1/1 0 +5 4 1 1 -1 -3 1 0 -1 -3 -1 0 6 -2 0 0 1 0 9 9 -3 5 0 1 -1/1 -1/1 1/1 -1/1 -3/1 1/1 0 +3 5 0 1 -1 -1 1 0 -1 -3 1 0 2 0 2 1 0 0 6 6 -6 4 1 1 0/1 -1/1 0/1 -1/1 -3/1 -1/1 0 +6 4 1 1 0 -1 0 0 -1 -3 -1 0 1 0 -1 0 0 0 12 12 -5 6 0 1 -1/1 -3/1 1/1 0/1 -1/1 0/1 0 +5 6 0 1 -1 -3 1 0 0 -1 0 0 1 0 1 1 0 0 12 12 -7 4 1 1 -1/1 -3/1 -1/1 1/1 -1/1 0/1 0 +7 4 1 1 -1 -3 -1 0 1 -1 0 0 -1 -1 4 1 0 0 18 18 -5 7 0 1 1/1 -1/1 0/1 -1/1 -3/1 1/1 0 +5 7 0 1 1 -1 0 0 -1 -3 1 0 -1 -1 -4 0 0 0 18 18 -2 0 1 1 0/1 0/1 -1/1 0/1 0/1 1/1 1 1/1 1/1 0/1 +2 0 1 1 0 0 -1 1 0 0 1 3 1 1 0 1 1 0 6 6 # END EDGES # BEGIN FACES # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 0 # number_of_inner_ccbs 1 # halfedges_on_inner_ccb 6 -1 5 7 9 3 18 +1 5 7 9 3 18 # number_of_isolated_vertices 0 11 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 3 -13 6 11 +13 6 11 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -95,12 +95,12 @@ 17 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 4 -17 12 10 15 +17 12 10 15 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -108,12 +108,12 @@ 26 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 7 -19 2 8 16 14 4 0 +19 2 8 16 14 4 0 # number_of_inner_ccbs 0 # number_of_isolated_vertices diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test08.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test08.wrl index cfcfff464c9..f1666558bde 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test08.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test08.wrl @@ -99,23 +99,19 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 100 aosMarkedVertexStyle "none" - coord DEF COORD ExactCoordinate { - ratPoint [ - 0 0 -1 0 0 1 - -1 -1 -1 0 0 -1, - 0 0 1 -1 -1 1, - 0 -1 0 -1 -1 -1, - -1 -1 1 0 -1 0, - ] + coord DEF COORD EpecCoordinate { + exactPoint [0 0 -1 0 0 1 + -1 -1 -1 0 0 -1, + 0 0 1 -1 -1 1, + 0 -1 0 -1 -1 -1, + -1 -1 1 0 -1 0, + ] } - normal ExactNormal { - ratVector [1 1 0 - 1 0 0, 1 0 0, 1 0 0, 1 0 0, # ignored - ] + normal EpecNormal { + exactVector [1 1 0 1 0 0, 1 0 0, 1 0 0, 1 0 0] } # pointIndex [6 7] - curveIndex [0 1 2 3 4 5 6 7 8 9 - ] + curveIndex [0 1 2 3 4 5 6 7 8 9] normalIndex[0 -1 -1 -1 -1] } } @@ -142,18 +138,14 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 100 aosMarkedVertexStyle "none" - coord DEF COORD2 ExactCoordinate { - ratPoint [ - -1 -3 1 -1 -3 -1 - 1 -1 0 -1 -3 1 - -1 -3 -1 1 -1 0 - ] + coord DEF COORD2 EpecCoordinate { + exactPoint [-1 -3 1 -1 -3 -1 1 -1 0 -1 -3 1 -1 -3 -1 1 -1 0] } # pointIndex [6 7] curveIndex [0 1 2 3 4 5] } } - + ] } ] @@ -180,7 +172,14 @@ Transform { } } Shape { - appearance USE AXES_APP + appearance DEF AXES_APP Appearance { + material Material { + # ambientIntensity 1 + diffuseColor 0.4 0.4 0.4 + # specularColor 0.3 0.3 0.3 + # transparency 0.0001 + } + } geometry Sphere { center 0 0 -1 radius 0.05 @@ -242,20 +241,13 @@ Transform { } ] } - + # The axes: DEF AXES Transform { scale 0.1 0.1 0.1 children [ Shape { - appearance DEF AXES_APP Appearance { - material Material { - # ambientIntensity 1 - diffuseColor 0.4 0.4 0.4 - # specularColor 0.3 0.3 0.3 - # transparency 0.0001 - } - } + appearance USE AXES_APP geometry Sphere { radius 0.1 } } DEF CS_AXIS Transform { diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test09.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test09.txt index 30a4de66a7d..944d369b14e 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test09.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test09.txt @@ -12,31 +12,31 @@ # number_of_faces 1 # BEGIN VERTICES -0 4 1 -1 0 0 +0 4 1 -1 0 0 2 3 -4 4 1 0 -1 0 +4 4 1 0 -1 0 0 4 -4 4 1 0 1 0 +4 4 1 0 1 0 0 5 # END VERTICES # BEGIN EDGES -1 0 1 1 -1 0 0 0 -1 0 0 +1 0 1 1 -1 0 0 2 0 -1 0 0 0 0 1 1 0 0 5 5 -2 0 0 1 -1 0 0 0 1 0 0 +2 0 0 1 -1 0 0 2 0 1 0 0 0 0 -1 0 0 0 5 5 # END EDGES # BEGIN FACES # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 0 # number_of_inner_ccbs 1 # halfedges_on_inner_ccb 4 -1 0 3 2 +1 0 3 2 # number_of_isolated_vertices 0 6 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test09.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test09.wrl index 49198122836..67357e9b9ed 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test09.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test09.wrl @@ -99,8 +99,8 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 0 aosMarkedVertexStyle "none" - coord DEF COORD ExactCoordinate { - ratPoint [-1 0 0 0 1 0] + coord DEF COORD EpecCoordinate { + exactPoint [-1 0 0 0 1 0] } # pointIndex [6 7] curveIndex [0 1] @@ -129,14 +129,14 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 0 aosMarkedVertexStyle "none" - coord DEF COORD2 ExactCoordinate { - ratPoint [-1 0 0 0 -1 0] + coord DEF COORD2 EpecCoordinate { + exactPoint [-1 0 0 0 -1 0] } # pointIndex [6 7] curveIndex [0 1] } } - + ] } ] @@ -163,7 +163,14 @@ Transform { } } Shape { - appearance USE AXES_APP + appearance DEF AXES_APP Appearance { + material Material { + # ambientIntensity 1 + diffuseColor 0.4 0.4 0.4 + # specularColor 0.3 0.3 0.3 + # transparency 0.0001 + } + } geometry Sphere { center 0 0 -1 radius 0.05 @@ -225,20 +232,13 @@ Transform { } ] } - + # The axes: DEF AXES Transform { scale 0.1 0.1 0.1 children [ Shape { - appearance DEF AXES_APP Appearance { - material Material { - # ambientIntensity 1 - diffuseColor 0.4 0.4 0.4 - # specularColor 0.3 0.3 0.3 - # transparency 0.0001 - } - } + appearance USE AXES_APP geometry Sphere { radius 0.1 } } DEF CS_AXIS Transform { diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test10.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test10.txt index 99acdda6f23..dc41fbefe41 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test10.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test10.txt @@ -17,63 +17,63 @@ # number_of_faces 3 # BEGIN VERTICES -0 4 1 -1/1 0/1 -1/1 +0 4 1 -1 0 -1 2 17 -0 4 1 -1/1 0/1 0/1 +0 4 1 -1 0 0 2 12 -4 4 1 -1/1 -1/1 0/1 +4 4 1 -1 -1 0 0 4 -4 3 1 0/1 0/1 1/1 +4 3 1 0 0 1 3 3 -4 4 1 -1/1 2/1 0/1 +4 4 1 -1 2 0 0 18 -4 4 1 -1/1 1/1 0/1 +4 4 1 -1 1 0 0 13 # END VERTICES # BEGIN EDGES -2 0 1 1 -1/1 0/1 -1/1 -1/1 -1/1 0/1 0 +2 0 1 1 -1 0 -1 2 -1 -1 0 0 -1 1 1 1 0 0 16 16 -1 2 0 1 -1/1 0/1 0/1 -1/1 -1/1 0/1 0 +1 2 0 1 -1 0 0 2 -1 -1 0 0 0 0 1 1 0 0 11 11 -3 2 1 1 -1/1 -1/1 0/1 0/1 0/1 1/1 0 +3 2 1 1 -1 -1 0 0 0 0 1 3 -1 1 0 1 1 0 11 11 -4 3 0 1 0/1 0/1 1/1 -1/1 2/1 0/1 0 +4 3 0 1 0 0 1 3 -1 2 0 0 -2 -1 0 0 1 0 16 16 -5 3 0 1 0/1 0/1 1/1 -1/1 1/1 0/1 0 +5 3 0 1 0 0 1 3 -1 1 0 0 -1 -1 0 0 1 0 11 11 -4 0 0 1 -1/1 2/1 0/1 -1/1 0/1 -1/1 0 +4 0 0 1 -1 2 0 0 -1 0 -1 2 -2 -1 2 1 0 0 16 16 -5 1 0 1 -1/1 1/1 0/1 -1/1 0/1 0/1 0 +5 1 0 1 -1 1 0 0 -1 0 0 2 0 0 1 1 0 0 11 11 # END EDGES # BEGIN FACES # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 0 # number_of_inner_ccbs 1 # halfedges_on_inner_ccb 4 -12 2 5 9 +12 2 5 9 # number_of_isolated_vertices 0 14 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 4 -11 6 4 0 +11 6 4 0 # number_of_inner_ccbs 0 # number_of_isolated_vertices @@ -81,12 +81,12 @@ 23 # END FACE # BEGIN FACE -0 1 +0 1 # number_of_outer_ccbs 1 # halfedges_on_outer_ccb 6 -13 8 7 10 1 3 +13 8 7 10 1 3 # number_of_inner_ccbs 0 # number_of_isolated_vertices diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test10.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test10.wrl index 81aab5888dc..bd1f146f9e8 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test10.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/geodesic_arcs_on_sphere/test10.wrl @@ -99,13 +99,12 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 0 aosMarkedVertexStyle "none" - coord DEF COORD ExactCoordinate { - ratPoint [ - 0 0 1 # 0 - -1 2 0 # 1 - -1 0 -1 # 2 - -1 -1 0 # 3 - ] + coord DEF COORD EpecCoordinate { + exactPoint [0 0 1 # 0 + -1 2 0 # 1 + -1 0 -1 # 2 + -1 -1 0 # 3 + ] } # pointIndex [6 7] curveIndex [0 1, 1 2, 2 3] @@ -134,19 +133,17 @@ Transform { aosMarkedEdgeIndex 100 aosMarkedVertexIndex 0 aosMarkedVertexStyle "none" - coord DEF COORD2 ExactCoordinate { - ratPoint [ - -1 1 0 # 0 - -1 0 0 # 1 - -1 -1 0 # 2 - 0 0 1 # 3 - ] + coord DEF COORD2 EpecCoordinate { + exactPoint [-1 1 0 # 0 + -1 0 0 # 1 + -1 -1 0 # 2 + 0 0 1 # 3 + ] } # pointIndex [6 7] curveIndex [0 1, 1 2, 2 3, 3 0] } } - ] } ] @@ -173,7 +170,14 @@ Transform { } } Shape { - appearance USE AXES_APP + appearance DEF AXES_APP Appearance { + material Material { + # ambientIntensity 1 + diffuseColor 0.4 0.4 0.4 + # specularColor 0.3 0.3 0.3 + # transparency 0.0001 + } + } geometry Sphere { center 0 0 -1 radius 0.05 @@ -235,20 +239,13 @@ Transform { } ] } - + # The axes: DEF AXES Transform { scale 0.1 0.1 0.1 children [ Shape { - appearance DEF AXES_APP Appearance { - material Material { - # ambientIntensity 1 - diffuseColor 0.4 0.4 0.4 - # specularColor 0.3 0.3 0.3 - # transparency 0.0001 - } - } + appearance USE AXES_APP geometry Sphere { radius 0.1 } } DEF CS_AXIS Transform { diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_configuration.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_configuration.h index c34a49a2473..dfd25a01536 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_configuration.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_configuration.h @@ -44,7 +44,7 @@ #define GEODESIC_ARC_ON_SPHERE_GEOM_TRAITS 11 #define RATIONAL_ARC_GEOM_TRAITS 12 #define ALGEBRAIC_GEOM_TRAITS 13 -#define POLYCURVE_CONIC_GEOM_TRAITS 14 +#define POLYCURVE_CONIC_GEOM_TRAITS 14 #define POLYCURVE_CIRCULAR_ARC_GEOM_TRAITS 15 #define POLYCURVE_BEZIER_GEOM_TRAITS 16 #define FLAT_TORUS_GEOM_TRAITS 17 @@ -55,7 +55,7 @@ // Default value based on dependencies: #if (TEST_GEOM_TRAITS == CORE_CONIC_GEOM_TRAITS) || \ - (TEST_GEOM_TRAITS == POLYCURVE_CONIC_GEOM_TRAITS) + (TEST_GEOM_TRAITS == POLYCURVE_CONIC_GEOM_TRAITS) #if !defined(TEST_NT) #define TEST_NT CORE_EXPR_NT #endif @@ -88,7 +88,7 @@ // Illegal combinations: #if (TEST_GEOM_TRAITS == CORE_CONIC_GEOM_TRAITS) || (TEST_GEOM_TRAITS == POLYCURVE_CONIC_GEOM_TRAITS) #if(TEST_NT != CORE_EXPR_NT) - #error "Core conic traits implies Core Expr number type!" + #error "Core conic traits implies Core Expr number type!" #endif #endif diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_construction.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_construction.cpp index 94bdea197ff..7aea53ea9c2 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_construction.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_construction.cpp @@ -40,7 +40,6 @@ int main() int main() { - // bool UNTESTED_TRAITS_AS_GMP_OR_MPFI_IS_NOT_INSTALLED; std::cout << std::endl << "NOTE: GMP and/or MPFI are not installed, " @@ -72,7 +71,7 @@ int main() // Define Geom_traits to be the curve-data-traits of the base geom traits. typedef CGAL::Arr_curve_data_traits_2 > + std::plus > Geom_traits; typedef Geom_traits::Point_2 Point_2; typedef Geom_traits::Curve_2 Curve_2; @@ -115,7 +114,7 @@ int main(int argc, char* argv[]) i += 2; } } - + int success = 0; for (; i < argc; ++i) { const char* filename = argv[i]; @@ -125,7 +124,7 @@ int main(int argc, char* argv[]) success = -1; } } - + return success; } diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_rational_function_traits_2.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_rational_function_traits_2.cpp index 45e19e2b1f1..8fb1b9da6f0 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_rational_function_traits_2.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_rational_function_traits_2.cpp @@ -65,8 +65,8 @@ int main() typedef Traits_2::Equal_2 Equal_2; typedef Traits_2::Parameter_space_in_x_2 Parameter_space_in_x_2; typedef Traits_2::Parameter_space_in_y_2 Parameter_space_in_y_2; - typedef Traits_2::Compare_x_at_limit_2 Compare_x_at_limit_2; - typedef Traits_2::Compare_x_near_limit_2 Compare_x_near_limit_2; + typedef Traits_2::Compare_x_on_boundary_2 Compare_x_on_boundary_2; + typedef Traits_2::Compare_x_near_boundary_2 Compare_x_near_boundary_2; typedef Traits_2::Compare_y_near_boundary_2 Compare_y_near_boundary_2; typedef Traits_2::Intersect_2 Intersect_2; typedef Traits_2::Split_2 Split_2; @@ -89,8 +89,8 @@ int main() CGAL_USE_TYPE(Equal_2); CGAL_USE_TYPE(Parameter_space_in_x_2); CGAL_USE_TYPE(Parameter_space_in_y_2); - CGAL_USE_TYPE(Compare_x_at_limit_2); - CGAL_USE_TYPE(Compare_x_near_limit_2); + CGAL_USE_TYPE(Compare_x_on_boundary_2); + CGAL_USE_TYPE(Compare_x_near_boundary_2); CGAL_USE_TYPE(Compare_y_near_boundary_2); CGAL_USE_TYPE(Intersect_2); CGAL_USE_TYPE(Split_2); diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_sgm.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_sgm.cpp index 073606dacf2..863aa347ed5 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_sgm.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_sgm.cpp @@ -1,4 +1,4 @@ -#define CGAL_IDENTIFICATION_XY 2 +#define CGAL_SL_VERBOSE 1 // Testing the spherical gaussian map #include @@ -10,7 +10,15 @@ typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; typedef Kernel::Point_3 Point_3; -typedef CGAL::Arr_polyhedral_sgm_traits Gm_traits; + +#if 0 +typedef CGAL::Arr_polyhedral_sgm_traits Gm_traits; +#elif 0 +typedef CGAL::Arr_polyhedral_sgm_traits Gm_traits; +#else +typedef CGAL::Arr_polyhedral_sgm_traits Gm_traits; +#endif + typedef CGAL::Arr_polyhedral_sgm Gm; typedef CGAL::Arr_polyhedral_sgm_polyhedron_3 Gm_polyhedron; typedef CGAL::Arr_polyhedral_sgm_initializer Gm_initializer; @@ -26,6 +34,7 @@ int main() }; Gm_polyhedron P1; P1.make_tetrahedron(points[0], points[1], points[2], points[3]); + std::cout << P1 << std::endl; Gm gm1; Gm_initializer gm_initializer1(gm1); gm_initializer1(P1); diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_spherical_removal.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_spherical_removal.cpp index 8019eff7ae0..ff833c6f865 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_spherical_removal.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_spherical_removal.cpp @@ -13,6 +13,7 @@ typedef CGAL::Exact_rational Number_type; typedef CGAL::Cartesian Kernel; +typedef Kernel::Direction_3 Direction_3; typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 Geom_traits_2; typedef Geom_traits_2::Point_2 Point_2; typedef Geom_traits_2::Curve_2 Curve_2; @@ -26,14 +27,23 @@ typedef Arrangement_2::Halfedge_iterator Halfedge_iterator; bool test_one_file(std::ifstream& in_file, bool /* verbose */) { + Geom_traits_2 geom_traits; + Geom_traits_2::Construct_point_2 ctr_point = + geom_traits.construct_point_2_object(); + Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv = + geom_traits.construct_x_monotone_curve_2_object(); + unsigned int i; // Read the points: unsigned int num_of_points; in_file >> num_of_points; std::vector points(num_of_points); - for (i = 0; i < num_of_points; ++i) - in_file >> points[i]; + for (i = 0; i < num_of_points; ++i) { + Direction_3 d; + in_file >> d; + points[i] = ctr_point(d); + } // Read the curves: unsigned int num_of_curves; @@ -60,7 +70,7 @@ bool test_one_file(std::ifstream& in_file, bool /* verbose */) Arrangement_2::Size num_vertices_left, num_edges_left, num_faces_left; in_file >> num_vertices_left >> num_edges_left >> num_faces_left; - Arrangement_2 arr; + Arrangement_2 arr(&geom_traits);; std::vector halfedges; std::vector >::const_iterator cit; @@ -78,7 +88,7 @@ bool test_one_file(std::ifstream& in_file, bool /* verbose */) // Insert the curves aggregately. std::list xcurves; for (cit = curves.begin(); cit != curves.end(); ++cit) { - X_monotone_curve_2 xcv(points[cit->first], points[cit->second]); + X_monotone_curve_2 xcv = ctr_xcv(points[cit->first], points[cit->second]); xcurves.push_back(xcv); } std::cout << "inserting " << " ... "; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_dispatching.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_dispatching.cpp index 94595c96a80..46a6c9ac7e5 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_dispatching.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_dispatching.cpp @@ -26,12 +26,12 @@ int main () // oblivious-open // oblivious-contracted // oblivious-closed - + // Arr_left_right_implementation_dispatch oblivious-oblivious { - typedef CGAL::internal::Arr_left_right_implementation_dispatch< + typedef CGAL::internal::Arr_left_right_implementation_dispatch< CGAL::Arr_oblivious_side_tag, CGAL::Arr_oblivious_side_tag > LR; - + typedef LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end; assert(dispatch(Psx_2_curve_end()) == 0); typedef LR::Parameter_space_in_x_2_curve_tag Psx_2_curve; @@ -52,7 +52,7 @@ int main () } { // Arr_left_right_implementation_dispatch oblivious-open - typedef CGAL::internal::Arr_left_right_implementation_dispatch< + typedef CGAL::internal::Arr_left_right_implementation_dispatch< CGAL::Arr_oblivious_side_tag, CGAL::Arr_open_side_tag > LR; typedef LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end; @@ -75,7 +75,7 @@ int main () } { // Arr_left_right_implementation_dispatch oblivious-contracted - typedef CGAL::internal::Arr_left_right_implementation_dispatch< + typedef CGAL::internal::Arr_left_right_implementation_dispatch< CGAL::Arr_oblivious_side_tag, CGAL::Arr_contracted_side_tag > LR; typedef LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end; @@ -98,7 +98,7 @@ int main () } { // Arr_left_right_implementation_dispatch oblivious-closed - typedef CGAL::internal::Arr_left_right_implementation_dispatch< + typedef CGAL::internal::Arr_left_right_implementation_dispatch< CGAL::Arr_oblivious_side_tag, CGAL::Arr_closed_side_tag > LR; typedef LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end; @@ -119,17 +119,17 @@ int main () typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); } - + // open-oblivious // open-open // open-contracted // open-closed - + // Arr_left_right_implementation_dispatch open-oblivious { - typedef CGAL::internal::Arr_left_right_implementation_dispatch< + typedef CGAL::internal::Arr_left_right_implementation_dispatch< CGAL::Arr_open_side_tag, CGAL::Arr_oblivious_side_tag > LR; - + typedef LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end; assert(dispatch(Psx_2_curve_end()) == 1); typedef LR::Parameter_space_in_x_2_curve_tag Psx_2_curve; @@ -150,7 +150,7 @@ int main () } { // Arr_left_right_implementation_dispatch open-open - typedef CGAL::internal::Arr_left_right_implementation_dispatch< + typedef CGAL::internal::Arr_left_right_implementation_dispatch< CGAL::Arr_open_side_tag, CGAL::Arr_open_side_tag > LR; typedef LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end; @@ -173,7 +173,7 @@ int main () } { // Arr_left_right_implementation_dispatch open-contracted - typedef CGAL::internal::Arr_left_right_implementation_dispatch< + typedef CGAL::internal::Arr_left_right_implementation_dispatch< CGAL::Arr_open_side_tag, CGAL::Arr_contracted_side_tag > LR; typedef LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end; @@ -196,7 +196,7 @@ int main () } { // Arr_left_right_implementation_dispatch open-closed - typedef CGAL::internal::Arr_left_right_implementation_dispatch< + typedef CGAL::internal::Arr_left_right_implementation_dispatch< CGAL::Arr_open_side_tag, CGAL::Arr_closed_side_tag > LR; typedef LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end; @@ -224,9 +224,9 @@ int main () // contracted-closed // Arr_left_right_implementation_dispatch contracted-oblivious { - typedef CGAL::internal::Arr_left_right_implementation_dispatch< + typedef CGAL::internal::Arr_left_right_implementation_dispatch< CGAL::Arr_contracted_side_tag, CGAL::Arr_oblivious_side_tag > LR; - + typedef LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end; assert(dispatch(Psx_2_curve_end()) == 1); typedef LR::Parameter_space_in_x_2_curve_tag Psx_2_curve; @@ -247,7 +247,7 @@ int main () } { // Arr_left_right_implementation_dispatch contracted-open - typedef CGAL::internal::Arr_left_right_implementation_dispatch< + typedef CGAL::internal::Arr_left_right_implementation_dispatch< CGAL::Arr_contracted_side_tag, CGAL::Arr_open_side_tag > LR; typedef LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end; @@ -270,7 +270,7 @@ int main () } { // Arr_left_right_implementation_dispatch contracted-contracted - typedef CGAL::internal::Arr_left_right_implementation_dispatch< + typedef CGAL::internal::Arr_left_right_implementation_dispatch< CGAL::Arr_contracted_side_tag, CGAL::Arr_contracted_side_tag > LR; typedef LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end; @@ -293,7 +293,7 @@ int main () } { // Arr_left_right_implementation_dispatch contracted-closed - typedef CGAL::internal::Arr_left_right_implementation_dispatch< + typedef CGAL::internal::Arr_left_right_implementation_dispatch< CGAL::Arr_contracted_side_tag, CGAL::Arr_closed_side_tag > LR; typedef LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end; @@ -321,9 +321,9 @@ int main () // closed-closed // Arr_left_right_implementation_dispatch closed-oblivious { - typedef CGAL::internal::Arr_left_right_implementation_dispatch< + typedef CGAL::internal::Arr_left_right_implementation_dispatch< CGAL::Arr_closed_side_tag, CGAL::Arr_oblivious_side_tag > LR; - + typedef LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end; assert(dispatch(Psx_2_curve_end()) == 1); typedef LR::Parameter_space_in_x_2_curve_tag Psx_2_curve; @@ -344,7 +344,7 @@ int main () } { // Arr_left_right_implementation_dispatch closed-open - typedef CGAL::internal::Arr_left_right_implementation_dispatch< + typedef CGAL::internal::Arr_left_right_implementation_dispatch< CGAL::Arr_closed_side_tag, CGAL::Arr_open_side_tag > LR; typedef LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end; @@ -367,7 +367,7 @@ int main () } { // Arr_left_right_implementation_dispatch closed-contracted - typedef CGAL::internal::Arr_left_right_implementation_dispatch< + typedef CGAL::internal::Arr_left_right_implementation_dispatch< CGAL::Arr_closed_side_tag, CGAL::Arr_contracted_side_tag > LR; typedef LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end; @@ -390,7 +390,7 @@ int main () } { // Arr_left_right_implementation_dispatch closed-closed - typedef CGAL::internal::Arr_left_right_implementation_dispatch< + typedef CGAL::internal::Arr_left_right_implementation_dispatch< CGAL::Arr_closed_side_tag, CGAL::Arr_closed_side_tag > LR; typedef LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end; @@ -411,12 +411,12 @@ int main () typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); } - + // identified-identified { // Arr_left_right_implementation_dispatch identified-identified - typedef CGAL::internal::Arr_left_right_implementation_dispatch< + typedef CGAL::internal::Arr_left_right_implementation_dispatch< CGAL::Arr_oblivious_side_tag, CGAL::Arr_identified_side_tag > LR; typedef LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end; @@ -448,9 +448,9 @@ int main () // oblivious-closed { // Arr_bottom_top_implementation_dispatch oblivious-oblivious - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_oblivious_side_tag, CGAL::Arr_oblivious_side_tag > BT; - + typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; assert(dispatch(Psy_2_curve_end()) == 0); typedef BT::Parameter_space_in_y_2_curve_tag Psy_2_curve; @@ -463,13 +463,6 @@ int main () typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); - typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; - assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); - typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; - assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); - typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; - assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; assert(dispatch(Cmp_x_ob_2_points()) == 0); typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; @@ -481,9 +474,9 @@ int main () } { // Arr_bottom_top_implementation_dispatch oblivious-open - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_oblivious_side_tag, CGAL::Arr_open_side_tag > BT; - + typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; assert(dispatch(Psy_2_curve_end()) == 1); typedef BT::Parameter_space_in_y_2_curve_tag Psy_2_curve; @@ -496,13 +489,6 @@ int main () typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); - typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; - assert(dispatch(Cmp_x_al_2_point_curve_end()) == 1); - typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; - assert(dispatch(Cmp_x_al_2_curve_ends()) == 1); - typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; - assert(dispatch(Cmp_x_nl_2_curve_ends()) == 1); - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; assert(dispatch(Cmp_x_ob_2_points()) == 0); typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; @@ -514,9 +500,9 @@ int main () } { // Arr_bottom_top_implementation_dispatch oblivious-contracted - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_oblivious_side_tag, CGAL::Arr_contracted_side_tag > BT; - + typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; assert(dispatch(Psy_2_curve_end()) == 1); typedef BT::Parameter_space_in_y_2_curve_tag Psy_2_curve; @@ -529,13 +515,6 @@ int main () typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); - typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; - assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); - typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; - assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); - typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; - assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; assert(dispatch(Cmp_x_ob_2_points()) == 0); typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; @@ -547,9 +526,9 @@ int main () } { // Arr_bottom_top_implementation_dispatch oblivious-closed - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_oblivious_side_tag, CGAL::Arr_closed_side_tag > BT; - + typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; assert(dispatch(Psy_2_curve_end()) == 1); typedef BT::Parameter_space_in_y_2_curve_tag Psy_2_curve; @@ -562,13 +541,6 @@ int main () typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); - typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; - assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); - typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; - assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); - typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; - assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; assert(dispatch(Cmp_x_ob_2_points()) == 1); typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; @@ -578,14 +550,14 @@ int main () typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); } - + // open-oblivious // open-open // open-contracted // open-closed { // Arr_bottom_top_implementation_dispatch open-oblivious - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_open_side_tag, CGAL::Arr_oblivious_side_tag > BT; typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; @@ -600,13 +572,6 @@ int main () typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); - typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; - assert(dispatch(Cmp_x_al_2_point_curve_end()) == 1); - typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; - assert(dispatch(Cmp_x_al_2_curve_ends()) == 1); - typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; - assert(dispatch(Cmp_x_nl_2_curve_ends()) == 1); - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; assert(dispatch(Cmp_x_ob_2_points()) == 0); typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; @@ -618,9 +583,9 @@ int main () } { // Arr_bottom_top_implementation_dispatch open-open - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_open_side_tag, CGAL::Arr_open_side_tag > BT; - + typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; assert(dispatch(Psy_2_curve_end()) == 1); typedef BT::Parameter_space_in_y_2_curve_tag Psy_2_curve; @@ -633,13 +598,6 @@ int main () typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); - typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; - assert(dispatch(Cmp_x_al_2_point_curve_end()) == 1); - typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; - assert(dispatch(Cmp_x_al_2_curve_ends()) == 1); - typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; - assert(dispatch(Cmp_x_nl_2_curve_ends()) == 1); - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; assert(dispatch(Cmp_x_ob_2_points()) == 0); typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; @@ -651,7 +609,7 @@ int main () } { // Arr_bottom_top_implementation_dispatch open-contracted - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_open_side_tag, CGAL::Arr_contracted_side_tag > BT; typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; @@ -666,13 +624,6 @@ int main () typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); - typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; - assert(dispatch(Cmp_x_al_2_point_curve_end()) == 1); - typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; - assert(dispatch(Cmp_x_al_2_curve_ends()) == 1); - typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; - assert(dispatch(Cmp_x_nl_2_curve_ends()) == 1); - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; assert(dispatch(Cmp_x_ob_2_points()) == 0); typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; @@ -684,9 +635,9 @@ int main () } { // Arr_bottom_top_implementation_dispatch open-closed - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_open_side_tag, CGAL::Arr_closed_side_tag > BT; - + typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; assert(dispatch(Psy_2_curve_end()) == 1); typedef BT::Parameter_space_in_y_2_curve_tag Psy_2_curve; @@ -699,13 +650,6 @@ int main () typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); - typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; - assert(dispatch(Cmp_x_al_2_point_curve_end()) == 1); - typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; - assert(dispatch(Cmp_x_al_2_curve_ends()) == 1); - typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; - assert(dispatch(Cmp_x_nl_2_curve_ends()) == 1); - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; assert(dispatch(Cmp_x_ob_2_points()) == 1); typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; @@ -722,9 +666,9 @@ int main () // contracted-closed { // Arr_bottom_top_implementation_dispatch contracted-oblivious - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_contracted_side_tag, CGAL::Arr_oblivious_side_tag > BT; - + typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; assert(dispatch(Psy_2_curve_end()) == 1); typedef BT::Parameter_space_in_y_2_curve_tag Psy_2_curve; @@ -737,13 +681,6 @@ int main () typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); - typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; - assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); - typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; - assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); - typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; - assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; assert(dispatch(Cmp_x_ob_2_points()) == 0); typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; @@ -755,9 +692,9 @@ int main () } { // Arr_bottom_top_implementation_dispatch contracted-open - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_contracted_side_tag, CGAL::Arr_open_side_tag > BT; - + typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; assert(dispatch(Psy_2_curve_end()) == 1); typedef BT::Parameter_space_in_y_2_curve_tag Psy_2_curve; @@ -770,13 +707,6 @@ int main () typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); - typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; - assert(dispatch(Cmp_x_al_2_point_curve_end()) == 1); - typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; - assert(dispatch(Cmp_x_al_2_curve_ends()) == 1); - typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; - assert(dispatch(Cmp_x_nl_2_curve_ends()) == 1); - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; assert(dispatch(Cmp_x_ob_2_points()) == 0); typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; @@ -788,9 +718,9 @@ int main () } { // Arr_bottom_top_implementation_dispatch contracted-contracted - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_contracted_side_tag, CGAL::Arr_contracted_side_tag > BT; - + typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; assert(dispatch(Psy_2_curve_end()) == 1); typedef BT::Parameter_space_in_y_2_curve_tag Psy_2_curve; @@ -803,13 +733,6 @@ int main () typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); - typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; - assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); - typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; - assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); - typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; - assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; assert(dispatch(Cmp_x_ob_2_points()) == 0); typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; @@ -821,9 +744,9 @@ int main () } { // Arr_bottom_top_implementation_dispatch contracted-closed - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_contracted_side_tag, CGAL::Arr_closed_side_tag > BT; - + typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; assert(dispatch(Psy_2_curve_end()) == 1); typedef BT::Parameter_space_in_y_2_curve_tag Psy_2_curve; @@ -836,13 +759,6 @@ int main () typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); - typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; - assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); - typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; - assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); - typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; - assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; assert(dispatch(Cmp_x_ob_2_points()) == 1); typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; @@ -859,9 +775,9 @@ int main () // closed-closed { // Arr_bottom_top_implementation_dispatch closed-oblivious - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_closed_side_tag, CGAL::Arr_oblivious_side_tag > BT; - + typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; assert(dispatch(Psy_2_curve_end()) == 1); typedef BT::Parameter_space_in_y_2_curve_tag Psy_2_curve; @@ -874,13 +790,6 @@ int main () typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); - typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; - assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); - typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; - assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); - typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; - assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; assert(dispatch(Cmp_x_ob_2_points()) == 1); typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; @@ -892,9 +801,9 @@ int main () } { // Arr_bottom_top_implementation_dispatch closed-open - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_closed_side_tag, CGAL::Arr_open_side_tag > BT; - + typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; assert(dispatch(Psy_2_curve_end()) == 1); typedef BT::Parameter_space_in_y_2_curve_tag Psy_2_curve; @@ -907,13 +816,6 @@ int main () typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); - typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; - assert(dispatch(Cmp_x_al_2_point_curve_end()) == 1); - typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; - assert(dispatch(Cmp_x_al_2_curve_ends()) == 1); - typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; - assert(dispatch(Cmp_x_nl_2_curve_ends()) == 1); - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; assert(dispatch(Cmp_x_ob_2_points()) == 1); typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; @@ -925,9 +827,9 @@ int main () } { // Arr_bottom_top_implementation_dispatch closed-contracted - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_closed_side_tag, CGAL::Arr_contracted_side_tag > BT; - + typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; assert(dispatch(Psy_2_curve_end()) == 1); typedef BT::Parameter_space_in_y_2_curve_tag Psy_2_curve; @@ -940,13 +842,6 @@ int main () typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); - typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; - assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); - typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; - assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); - typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; - assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; assert(dispatch(Cmp_x_ob_2_points()) == 1); typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; @@ -958,9 +853,9 @@ int main () } { // Arr_bottom_top_implementation_dispatch closed-closed - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_closed_side_tag, CGAL::Arr_closed_side_tag > BT; - + typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; assert(dispatch(Psy_2_curve_end()) == 1); typedef BT::Parameter_space_in_y_2_curve_tag Psy_2_curve; @@ -973,13 +868,6 @@ int main () typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); - typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; - assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); - typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; - assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); - typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; - assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; assert(dispatch(Cmp_x_ob_2_points()) == 1); typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; @@ -993,9 +881,9 @@ int main () // identified-identified { // Arr_bottom_top_implementation_dispatch identified-identified - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_identified_side_tag, CGAL::Arr_identified_side_tag > BT; - + typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; assert(dispatch(Psy_2_curve_end()) == 1); typedef BT::Parameter_space_in_y_2_curve_tag Psy_2_curve; @@ -1008,13 +896,6 @@ int main () typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 1); - typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; - assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); - typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; - assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); - typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; - assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; assert(dispatch(Cmp_x_ob_2_points()) == 1); typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/utils.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/utils.h index 16120183fa6..39ad3f35104 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/utils.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/utils.h @@ -77,8 +77,12 @@ private: // Compare in x boundaries: CGAL::Arr_parameter_space ps_x1 = + (m_traits.is_on_y_identification_2_object()(p1)) ? + CGAL::ARR_LEFT_BOUNDARY : m_traits.parameter_space_in_x_2_object()(p1); CGAL::Arr_parameter_space ps_x2 = + (m_traits.is_on_y_identification_2_object()(p2)) ? + CGAL::ARR_LEFT_BOUNDARY : m_traits.parameter_space_in_x_2_object()(p2); if (ps_x1 == CGAL::ARR_LEFT_BOUNDARY) { if (ps_x2 == CGAL::ARR_LEFT_BOUNDARY) diff --git a/Documentation/doc/biblio/cgal_manual.bib b/Documentation/doc/biblio/cgal_manual.bib index 0beb61629ed..4221926691c 100644 --- a/Documentation/doc/biblio/cgal_manual.bib +++ b/Documentation/doc/biblio/cgal_manual.bib @@ -239,6 +239,37 @@ Boissonnat} } +@article{cgal:bfhks-apsca-10, + author = {Eric Berberich and Efi Fogel and Dan Halperin and + Michael Kerber and Ophir Setter}, + title = {Arrangements on Parametric Surfaces {II}: Concretizations + and Applications}, + journal = {Mathematics in Computer Science}, + publisher = {Birkh\"{a}user Basel}, + issn = {1661-8270}, + keyword = {Mathematics}, + pages = {67--91}, + volume = {4}, + issue = {1}, + url = {http://dx.doi.org/10.1007/s11786-010-0043-4}, + year = {2010} +} + +@article{cgal:bfhmw-apsgf-10, + author = {Eric Berberich and Efi Fogel and Dan Halperin and + Kurt Mehlhorn and Ron Wein}, + title = {Arrangements on Parametric Surfaces {I}: General Framework + and Infrastructure}, + journal = {Mathematics in Computer Science}, + publisher = {Birkh\"{a}user Basel}, + issn = {1661-8270}, + pages = {45--66}, + volume = {4}, + issue = {1}, + url = {http://dx.doi.org/10.1007/s11786-010-0042-5}, + year = {2010} +} + @TechReport{cgal:bhkt-risak-07, author = {Berberich, Eric and Hemmer, Michael and Karavelas, Menelaos I. and Teillaud, Monique}, @@ -2225,6 +2256,18 @@ url = "http://wscg.zcu.cz/wscg2003/Papers_2003/G67.pdf" address = {Delphi, Greece}, } +@incollection{cgal:fhktww-a-07, + author = {Efi Fogel and Dan Halperin and Lutz Kettner and + Monique Teillaud and Ron Wein and Nicola Wolpert}, + title = {Arrangements}, + chapter = {1}, + editor = {J.-D. Boissonnat and M. Teillaud}, + booktitle = {Effective Computational Geometry for Curves and Surfaces}, + publisher = PUB-SV, + year = {2007}, + pages = {1--66} +} + @techreport{cgal:f-ecsca-04, author = "E. Fogel et al.", title = "An empirical comparison of software for constructing arrangements of curved arcs", diff --git a/Documentation/doc/biblio/geom.bib b/Documentation/doc/biblio/geom.bib index 801a459f83e..dbd7541f5a5 100644 --- a/Documentation/doc/biblio/geom.bib +++ b/Documentation/doc/biblio/geom.bib @@ -2505,17 +2505,17 @@ cell neighborhood in $O(m)$ time." , update = "98.03 mitchell, 97.11 bibrelex, 97.07 agarwal, 96.05 agarwal, 95.05 korneenko, 94.01 matousek" } -@incollection{as-aa-00 -, author = "Pankaj K. Agarwal and Micha Sharir" -, title = "Arrangements and Their Applications" -, editor = "J{\"o}rg-R{\"u}diger Sack and Jorge Urrutia" -, booktitle = "Handbook of Computational Geometry" -, publisher = "Elsevier Science Publishers B.V. North-Holland" -, address = "Amsterdam" -, year = 2000 -, pages = "49--119" -, update = "00.03 bibrelex, 99.03 bibrelex, 98.11 bibrelex, 98.07 mitchell" -, annote = "Chapter 2 of su-hcg-00" +@incollection{as-aa-00, + author = {Pankaj K. Agarwal and Micha Sharir}, + title = {Arrangements and Their Applications}, + editor = {J{\"o}rg-R{\"u}diger Sack and Jorge Urrutia}, + booktitle = {Handbook of Computational Geometry}, + publisher = {Elsevier Science Publishers B.V. North-Holland}, + address = {Amsterdam}, + year = {2000} + pages = {49--119}, + update = {00.03 bibrelex, 99.03 bibrelex, 98.11 bibrelex, 98.07 mitchell}, + annote = {Chapter 2 of su-hcg-00} } @techreport{as-cssp-90 diff --git a/Envelope_3/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h b/Envelope_3/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h index a06d8a56c57..a3e40e90467 100644 --- a/Envelope_3/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h +++ b/Envelope_3/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h @@ -47,7 +47,7 @@ #ifdef CGAL_ENVELOPE_USE_BFS_FACE_ORDER #include #include -#include +#include #endif // this base divide & conquer algorithm splits the input into 2 groups, @@ -92,7 +92,7 @@ namespace CGAL { // the envelope between 2 surfaces over a feature // of the arrangement // 4. Overlay_2 - overlay of 2 MinimizationDiagram_2 -template , @@ -138,9 +138,9 @@ protected: Ccb_halfedge_circulator; typedef typename Minimization_diagram_2::Halfedge_around_vertex_circulator Halfedge_around_vertex_circulator; - typedef typename Minimization_diagram_2::Outer_ccb_iterator + typedef typename Minimization_diagram_2::Outer_ccb_iterator Outer_ccb_iterator; - typedef typename Minimization_diagram_2::Inner_ccb_iterator + typedef typename Minimization_diagram_2::Inner_ccb_iterator Inner_ccb_iterator; typedef Arr_observer Md_observer; @@ -155,7 +155,7 @@ protected: public: // c'tor Envelope_divide_and_conquer_3(Envelope_type type = ENVELOPE_LOWER) - { + { // Allocate the traits. m_geom_traits = new Traits; m_own_traits = true; @@ -178,7 +178,7 @@ public: m_is_lower = ((type == ENVELOPE_LOWER) ? true : false); } - + // virtual destructor. virtual ~Envelope_divide_and_conquer_3() { @@ -199,11 +199,11 @@ public: Envelope_3::Arbitrary_dividor dividor; construct_lu_envelope(begin, end, result, dividor); } - + // compute the envelope of surfaces in 3D using the given set dividor template - void construct_lu_envelope(SurfaceIterator begin, SurfaceIterator end, + void construct_lu_envelope(SurfaceIterator begin, SurfaceIterator end, Minimization_diagram_2& result, SetDividor& dividor) { @@ -211,7 +211,7 @@ public: { return; // result is empty } - + // make the general surfaces xy-monotone std::list xy_monotones; for (; begin != end; ++begin) @@ -220,10 +220,10 @@ public: std::back_inserter(xy_monotones)); // recursively construct the envelope of the xy-monotone parts - construct_lu_envelope_xy_monotones(xy_monotones.begin(), + construct_lu_envelope_xy_monotones(xy_monotones.begin(), xy_monotones.end(), result, dividor); - CGAL_assertion(is_envelope_valid(result)); + CGAL_assertion(is_envelope_valid(result)); } // compute the envelope of xy-monotone surfaces in 3D, @@ -266,7 +266,7 @@ public: protected: - // compute the envelope of xy-monotone surfaces in 3D + // compute the envelope of xy-monotone surfaces in 3D template void construct_lu_envelope_xy_monotones(SurfaceIterator begin, SurfaceIterator end, @@ -284,25 +284,25 @@ protected: { // only one surface is in the collection. insert it the result Xy_monotone_surface_3& surf = *first; - + deal_with_one_surface(surf, result); - return; + return; } - + // divide the surfaces into 2 groups (insert surface to each group // alternately) // Efi: this copy is redundant. It is sufficient to determine the range std::list group1, group2; dividor(first, end, std::back_inserter(group1), std::back_inserter(group2)); - + // recursively calculate the LU_envelope of the 2 groups Minimization_diagram_2 result1(m_geom_traits), result2(m_geom_traits); construct_lu_envelope_xy_monotones(group1.begin(), group1.end(), result1, dividor); construct_lu_envelope_xy_monotones(group2.begin(), group2.end(), result2, dividor); - + // merge the results: merge_envelopes(result1, result2, result); @@ -323,7 +323,7 @@ protected: m_geom_traits-> construct_projected_boundary_2_object()(surf, std::back_inserter(boundary)); - + if (boundary.empty()) { //one infinite surface @@ -344,13 +344,13 @@ protected: Oriented_side side = boundary_cv.second; Halfedge_handle he = insert_non_intersecting_curve(result, boundary_cv.first); - + if (side == ON_ORIENTED_BOUNDARY) { // vertical xy-surface he->face()->set_no_data(); he->twin()->face()->set_no_data(); - + continue; } @@ -374,41 +374,41 @@ protected: he->twin()->face()->set_no_data(); } - // init auxiliary data for f and its boundarys. + // init auxiliary data for f and its boundarys. for(Outer_ccb_iterator ocit = f->outer_ccbs_begin(); ocit != f->outer_ccbs_end(); ocit++){ Ccb_halfedge_circulator face_hec = *ocit; Ccb_halfedge_circulator face_hec_begin = face_hec; - do + do { face_hec->set_is_equal_data_in_face(true); face_hec->set_has_equal_data_in_face(true); face_hec->set_has_equal_data_in_target_and_face(true); - + face_hec->twin()->set_is_equal_data_in_face(false); face_hec->twin()->set_has_equal_data_in_face(false); face_hec->twin()->set_has_equal_data_in_target_and_face(false); - + ++face_hec; - } + } while(face_hec != face_hec_begin); } for(Outer_ccb_iterator icit = f->inner_ccbs_begin(); icit != f->inner_ccbs_end(); icit++){ Ccb_halfedge_circulator face_hec = *icit; Ccb_halfedge_circulator face_hec_begin = face_hec; - do + do { face_hec->set_is_equal_data_in_face(true); face_hec->set_has_equal_data_in_face(true); face_hec->set_has_equal_data_in_target_and_face(true); - + face_hec->twin()->set_is_equal_data_in_face(false); face_hec->twin()->set_has_equal_data_in_face(false); face_hec->twin()->set_has_equal_data_in_target_and_face(false); - + ++face_hec; - } + } while(face_hec != face_hec_begin); } } @@ -449,7 +449,7 @@ protected: } } } - + public: void merge_envelopes(Minimization_diagram_2& result1, @@ -457,20 +457,20 @@ public: Minimization_diagram_2& result) { // overlay the 2 arrangements - + Overlay_2 overlay; overlay(result1, result2, result); - + CGAL_expensive_assertion_msg(is_valid(result), "after overlay result is not valid"); - + // make sure the aux flags are correctly set by the overlay //CGAL_assertion(verify_aux_flags(result)); // for each face, edge and vertex in the result, should calculate // which surfaces are on the envelope // a face can be cut, or faces can be merged. - + // now the minimization diagram might change - we need to keep data in the // edges, when they're split Keep_edge_data_observer edge_observer(result, this); @@ -523,13 +523,13 @@ public: for (li = edges_to_resolve.begin(); li != edges_to_resolve.end(); ++li) { resolver->resolve(*li, result); - + } edges_to_resolve.clear(); - + // decompose the result, to have faces without holes /* decompose(result); - CGAL_expensive_assertion_msg(result.is_valid(), + CGAL_expensive_assertion_msg(result.is_valid(), "after decomposition result is not valid");*/ // compute the surface on the envelope for each face, @@ -559,7 +559,7 @@ public: visitor(bfs_visitor)); index_map.detach(); #else - // traverse the faces in arbitrary order + // traverse the faces in arbitrary order Face_iterator fi = result.faces_begin(); for (; fi != result.faces_end(); ++fi) { @@ -600,7 +600,7 @@ public: // resolver->resolve(hi, result); // } // #endif - + // detach the edge_observer from result, since no need for it anymore edge_observer.detach(); @@ -627,7 +627,7 @@ public: continue; } resolver->resolve(vh); - + } CGAL_expensive_assertion_msg(result.is_valid(), @@ -636,21 +636,21 @@ public: // make sure that aux_source and decision are set at all features // after all resolvings CGAL_assertion(check_resolve_was_ok(result)); - + // make sure the aux flags are correctly after all resolvings //CGAL_assertion(verify_aux_flags(result)); // finally, remove unneccessary edges, between faces with the same surface // (and which are not degenerate) - + remove_unneccessary_edges(result); - CGAL_expensive_assertion_msg(result.is_valid(), + CGAL_expensive_assertion_msg(result.is_valid(), "after remove edges result is not valid"); // also remove unneccessary vertices (that were created in the process of // vertical decomposition but the vertical edge was removed) remove_unneccessary_vertices(result); - CGAL_expensive_assertion_msg(result.is_valid(), + CGAL_expensive_assertion_msg(result.is_valid(), "after remove vertices result is not valid"); // update is_equal_data and has_equal_data of halfedge->face and @@ -661,7 +661,7 @@ public: // update the envelope surfaces according to the decision and the aux // surfaces in aux source update_envelope_surfaces_by_decision(result); - + // make sure that all the flags are correctly set on the envelope result //CGAL_assertion(verify_flags(result)); CGAL_expensive_assertion_msg(is_valid(result), @@ -670,7 +670,7 @@ public: protected: - + void deal_with_faces_to_split(std::list& faces_to_split, Minimization_diagram_2& result) { @@ -741,7 +741,7 @@ protected: if (can_remove_edge(hh)) edges.push_back(hh); } - + for (typename std::list::iterator ci = edges.begin(); ci != edges.end(); ++ci) { @@ -847,7 +847,7 @@ protected: end = v->end_data(); } } - + // check if we can remove the edge from the envelope // this can be done if the envelope surfaces on the edge are the same as // the envelope surfaces on both sides of the edge @@ -855,7 +855,7 @@ protected: bool can_remove_edge(Halfedge_handle hh) { Face_handle f1 = hh->face(), f2 = hh->twin()->face(); - + // we check if the decision done on the edge is equal to the decision // done on the faces. if not, then the envelope surfaces must differ CGAL_assertion(hh->is_decision_set() && f1->is_decision_set() && @@ -875,10 +875,10 @@ protected: if (decision == DAC_DECISION_FIRST) return equal_first; - + if (decision == DAC_DECISION_SECOND) return equal_second; - + return (equal_first && equal_second); } @@ -895,7 +895,7 @@ protected: When I tried to use the following code I got a Segmentation Fault when trying to compute power diagram: - + if ((v->parameter_space_in_x() != ARR_INTERIOR) || (v->parameter_space_in_y() != ARR_INTERIOR)) return false; @@ -908,7 +908,7 @@ protected: /*if (v->get_is_fake() && !v->is_decision_set()) return true; - + if (h->get_is_fake() && !h->is_decision_set()) { @@ -931,13 +931,13 @@ protected: if (decision == DAC_DECISION_FIRST) return equal_first; - + if (decision == DAC_DECISION_SECOND) return equal_second; - + return (equal_first && equal_second); } - + // check if we can remove an isolated vertex from the envelope // this can be done if the envelope surfaces on the vertex are the same as // the envelope surfaces on its incident face @@ -958,10 +958,10 @@ protected: if (decision == DAC_DECISION_FIRST) return equal_first; - + if (decision == DAC_DECISION_SECOND) return equal_second; - + return (equal_first && equal_second); } @@ -977,13 +977,13 @@ protected: Halfedge_handle he1 = hec1, he2 = hec2; CGAL_assertion(he1 != he2); CGAL_assertion(he1->is_decision_set() && he2->is_decision_set()); - + /* if (vh->get_is_fake()) { * CGAL_assertion(he1->get_decision() == he2->get_decision()); * return true; * } */ - + CGAL_assertion(vh->is_decision_set()); // if the decision done on the vertex and its incident halfedges are // different, the envelope differs too. @@ -1001,14 +1001,14 @@ protected: if (decision == DAC_DECISION_FIRST) return equal_first; - + if (decision == DAC_DECISION_SECOND) return equal_second; return (equal_first && equal_second); } - - // Remove unneccessary vertices, which have degree 2, and the 2 curves + + // Remove unneccessary vertices, which have degree 2, and the 2 curves // can be merged // (and which are not degenerate) void remove_unneccessary_vertices(Minimization_diagram_2& result) @@ -1016,14 +1016,14 @@ protected: // we have 2 types of unneccessary vertices: those with degree 2 (that // satisfy all the conditions below), and isolated vertices that have the // same envelope information as the face they're contained in. - + // all the vertices that don't have their data set, are those vertices // on vertical edges, created in the decomposition process, // and are not neccessary - // also those vertices with degree 2, that can merge their 2 edges and + // also those vertices with degree 2, that can merge their 2 edges and // with same data as both these edges, can be removed - + // collect all vertices candidate to remove in this list, // and remove the correct ones at the end // (thus, not destroying the iterator) @@ -1041,28 +1041,28 @@ protected: } typename Traits::Merge_2 curves_merge = m_geom_traits->merge_2_object(); - typename Traits::Are_mergeable_2 curves_can_merge = + typename Traits::Are_mergeable_2 curves_can_merge = m_geom_traits->are_mergeable_2_object(); // check the candidates and remove if necessary typename std::list::iterator ci; - for (ci = candidates_to_remove.begin(); + for (ci = candidates_to_remove.begin(); ci != candidates_to_remove.end(); ++ci) { Vertex_handle vh = *ci; CGAL_assertion(vh->degree() == 2); - - // we can remove this vertex only if the data on its halfedges is the + + // we can remove this vertex only if the data on its halfedges is the // same if (!combinatorically_can_remove_vertex(vh)) continue; - + // merge the edges, if geometrically possible (if data on vertex is not // set, then it must be geometrically possible) Halfedge_around_vertex_circulator hec1 = vh->incident_halfedges(); Halfedge_around_vertex_circulator hec2 = hec1++; Halfedge_handle he1 = hec1, he2 = hec2; - + const X_monotone_curve_2& a = he1->curve(), b = he2->curve(); CGAL_assertion(vh->is_decision_set() || curves_can_merge(a,b)); @@ -1072,7 +1072,7 @@ protected: X_monotone_curve_2 c; curves_merge(a,b,c); - // the decisions on he1 and he2 were the same, so the decision on + // the decisions on he1 and he2 were the same, so the decision on // the edge that will be left after the merge will be ok // but we need to take care of the bool flags of the target relation // of the edge that will be left @@ -1115,7 +1115,7 @@ protected: result.merge_edge(he1, he2 ,c); CGAL_assertion(new_edge->is_decision_set()); - CGAL_expensive_assertion_msg(result.is_valid(), + CGAL_expensive_assertion_msg(result.is_valid(), "after remove vertex result is not valid"); } @@ -1157,7 +1157,7 @@ protected: fh->set_data(begin, end); else fh->add_data(begin, end); - } + } } // foreach feature of result, update the envelope surfaces, according @@ -1168,12 +1168,12 @@ protected: Vertex_iterator vi = result.vertices_begin(); for (; vi != result.vertices_end(); ++vi) update_envelope_surfaces_by_decision(vi); - + // edges Halfedge_iterator hi = result.halfedges_begin(); for (; hi != result.halfedges_end(); ++hi) update_envelope_surfaces_by_decision(hi); - + // faces Face_iterator fi = result.faces_begin(); for (; fi != result.faces_end(); ++fi) @@ -1218,7 +1218,7 @@ protected: has_equal &= has_equal_first; else if (decision == DAC_DECISION_SECOND) has_equal &= has_equal_second; - else + else has_equal &= (has_equal_first & has_equal_second); } @@ -1264,7 +1264,7 @@ protected: else if (decision == DAC_DECISION_SECOND) has_equal &= has_equal_second; - else + else has_equal &= (has_equal_first & has_equal_second); } h->set_is_equal_data_in_target(is_equal); @@ -1297,7 +1297,7 @@ protected: else if (decision == DAC_DECISION_SECOND) has_equal &= has_equal_second; - else + else has_equal &= (has_equal_first & has_equal_second); } h->set_has_equal_data_in_target_and_face(has_equal); @@ -1340,7 +1340,7 @@ protected: has_equal &= has_equal_first; else if (decision == DAC_DECISION_SECOND) has_equal &= has_equal_second; - else + else has_equal &= (has_equal_first & has_equal_second); } v->set_is_equal_data_in_face(is_equal); @@ -1348,7 +1348,7 @@ protected: } void update_flags(Minimization_diagram_2& result) - { + { // edges Halfedge_iterator hi = result.halfedges_begin(); for (; hi != result.halfedges_end(); ++hi) @@ -1371,7 +1371,7 @@ protected: { return fh->get_aux_is_set(id); } - + template bool aux_has_no_data(FeatureHandle fh, unsigned int id) { @@ -1379,7 +1379,7 @@ protected: Halfedge_handle h; Vertex_handle v; Face_handle f; - + // aux source of a face must be a face! // aux source of a halfedge can be face or halfedge // aux source of a vertex can be face, halfedge or vertex @@ -1497,9 +1497,9 @@ protected: } } } - - // confirm that aux source and decision are set over all minimization + + // confirm that aux source and decision are set over all minimization // diagram features bool check_resolve_was_ok(Minimization_diagram_2& result) { @@ -1559,12 +1559,12 @@ protected: for (; vi != result.vertices_end(); ++vi) { Vertex_handle vh = vi; - + all_ok &= (vh->get_is_set()); CGAL_assertion_msg(all_ok, "data not set over vertex"); all_ok &= (!vh->has_no_data()); - CGAL_assertion_msg(all_ok, "data empty over vertex"); + CGAL_assertion_msg(all_ok, "data empty over vertex"); /* all_ok &= (!vh->get_is_fake());*/ CGAL_assertion_msg(all_ok, "fake vertex in envelope"); } @@ -1572,7 +1572,7 @@ protected: for (; hi != result.halfedges_end(); ++hi) { Halfedge_handle hh = hi; - + all_ok &= (hh->get_is_set()); if (!all_ok) std::cerr << "edge: " << hh->curve() << std::endl; @@ -1594,14 +1594,14 @@ protected: } return all_ok; } - + // observer for the minimization diagram // keeps the relevant data in the new faces class Keep_face_data_observer : public Md_observer { public: typedef typename Minimization_diagram_2::Face_handle Face_handle; - + Keep_face_data_observer(Minimization_diagram_2& arr) : Md_observer(arr) {} @@ -1619,7 +1619,7 @@ protected: new_f->set_decision(org_f->get_decision()); } }; - + // observer for the minimization diagram // keeps the relevant data in the new edges & vertices @@ -1628,12 +1628,12 @@ protected: public: typedef typename Minimization_diagram_2::Halfedge_handle Halfedge_handle; typedef typename Minimization_diagram_2::Vertex_handle Vertex_handle; - typedef typename Minimization_diagram_2::X_monotone_curve_2 + typedef typename Minimization_diagram_2::X_monotone_curve_2 X_monotone_curve_2; - typedef typename Envelope_divide_and_conquer_3::Self Self; Keep_edge_data_observer(Minimization_diagram_2& arr, Self* b) : @@ -1651,7 +1651,7 @@ protected: virtual void after_split_edge(Halfedge_handle he1, Halfedge_handle he2) { - // update data of the new vertex, which is the common vertex of he1 and + // update data of the new vertex, which is the common vertex of he1 and // he2, and of the new edge according to the data in the original edge CGAL_assertion(he2->source() == he1->target()); @@ -1669,19 +1669,19 @@ protected: // find the halfedge with the additional information, to be copied into // the second halfedge Halfedge_handle org_he = he1, new_he = he2; - + if (org_he->is_decision_set()) { new_he->set_decision(org_he->get_decision()); new_he->twin()->set_decision(org_he->get_decision()); new_vertex->set_decision(org_he->get_decision()); - } + } if (org_he->get_aux_is_set(0)) { new_vertex->set_aux_source(0, org_he->get_aux_source(0)); new_he->set_aux_source(0, org_he->get_aux_source(0)); new_he->twin()->set_aux_source(0, org_he->twin()->get_aux_source(0)); - } + } if (org_he->get_aux_is_set(1)) { new_vertex->set_aux_source(1, org_he->get_aux_source(1)); @@ -1812,11 +1812,11 @@ protected: } }; #endif - + protected: Envelope_resolver* resolver; const Traits* m_geom_traits; - bool m_own_traits; + bool m_own_traits; bool m_is_lower; }; diff --git a/STL_Extension/include/CGAL/Multiset.h b/STL_Extension/include/CGAL/Multiset.h index e5efc93e473..49070fb6470 100644 --- a/STL_Extension/include/CGAL/Multiset.h +++ b/STL_Extension/include/CGAL/Multiset.h @@ -337,7 +337,8 @@ public: */ reference operator* () const { - CGAL_multiset_precondition (nodeP != NULL && nodeP->is_valid()); + CGAL_multiset_precondition (nodeP != NULL); + CGAL_multiset_precondition (nodeP->is_valid()); return (nodeP->object); } @@ -347,7 +348,8 @@ public: */ pointer operator-> () const { - CGAL_multiset_precondition (nodeP != NULL && nodeP->is_valid()); + CGAL_multiset_precondition (nodeP != NULL); + CGAL_multiset_precondition (nodeP->is_valid()); return (&(nodeP->object)); } @@ -452,7 +454,8 @@ public: */ reference operator* () const { - CGAL_multiset_precondition (nodeP != NULL && nodeP->is_valid()); + CGAL_multiset_precondition (nodeP != NULL); + CGAL_multiset_precondition (nodeP->is_valid()); return (nodeP->object); } @@ -462,7 +465,8 @@ public: */ pointer operator-> () const { - CGAL_multiset_precondition (nodeP != NULL && nodeP->is_valid()); + CGAL_multiset_precondition (nodeP != NULL); + CGAL_multiset_precondition (nodeP->is_valid()); return (&(nodeP->object)); } diff --git a/Surface_sweep_2/include/CGAL/No_intersection_surface_sweep_2.h b/Surface_sweep_2/include/CGAL/No_intersection_surface_sweep_2.h index 27ec5acf874..2a86f1192e4 100644 --- a/Surface_sweep_2/include/CGAL/No_intersection_surface_sweep_2.h +++ b/Surface_sweep_2/include/CGAL/No_intersection_surface_sweep_2.h @@ -267,8 +267,8 @@ public: * \param curves_begin An iterator for the first x-monotone curve in the * range. * \param curves_end A past-the-end iterator for this range. - * \param points_begin An iterator for the first point in the range. - * \param points_end A past-the-end iterator for this range. + * \param action_points_begin An iterator for the first point in the range. + * \param action_points_end A past-the-end iterator for this range. * \pre The value-type of XCurveInputIterator is the traits-class * X_monotone_curve_2, and the value-type of PointInputIterator is the * traits-class Point_2. @@ -295,20 +295,22 @@ public: * \param curves_begin An iterator for the first x-monotone curve in the * range. * \param curves_end A past-the-end iterator for this range. - * \param points_begin An iterator for the first point in the range. - * \param points_end A past-the-end iterator for this range. + * \param action_points_begin An iterator for the first point in the range. + * \param action_points_end A past-the-end iterator for this range. + * \param query_points_begin An iterator for the first point in the range. + * \param query_points_end A past-the-end iterator for this range. * \pre The value-type of XCurveInputIterator is the traits-class - * X_monotone_curve_2, and the value-type of PointInputIterator is the - * traits-class Point_2. + * X_monotone_curve_2, and the value-type of ActionPointIterator + * and QueryPointIterator is the traits-class Point_2. */ - template + template void sweep(CurveInputIterator curves_begin, CurveInputIterator curves_end, - ActionPointItr action_points_begin, - ActionPointItr action_points_end, - QueryPointItr query_points_begin, - QueryPointItr query_points_end) + ActionPointIterator action_points_begin, + ActionPointIterator action_points_end, + QueryPointIterator query_points_begin, + QueryPointIterator query_points_end) { m_visitor->before_sweep(); _init_sweep(curves_begin, curves_end); diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Event_comparer.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Event_comparer.h index 03b1e9e1d88..d582f67e7d5 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Event_comparer.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Event_comparer.h @@ -66,205 +66,444 @@ private: // Data members: const Gt2* m_traits; // The geometric-traits object. - Arr_parameter_space m_ps_in_x; // Storing curve information when - Arr_parameter_space m_ps_in_y; // comparing a curve end with + Arr_parameter_space m_ps_x; // Storing curve information when + Arr_parameter_space m_ps_y; // comparing a curve end with Arr_curve_end m_index; // boundary conditions. public: /*! Cosntruct. */ Event_comparer(const Gt2* traits) : m_traits(traits) {} + //!\name Function call operators + //!@{ + /*! Compare two existing events. * This operator is called by the multiset assertions only in * debug mode (to verify that event was inserted at the right place). */ Comparison_result operator()(const Event* e1, const Event* e2) const { - const bool on_boundary1 = e1->is_on_boundary(); - const bool on_boundary2 = e2->is_on_boundary(); +#if 0 + CGAL::set_pretty_mode(std::cout); + std::cout << "\n FUNCTOR e1-e2" << std::endl; + std::cout << "e1: " << e1 << std::endl; + std::cout << "ps_x1: " << e1->parameter_space_in_x() << std::endl; + std::cout << "ps_y1: " << e1->parameter_space_in_y() << std::endl; + std::cout << "e2: " << e2 << std::endl; + std::cout << "ps_x2: " << e2->parameter_space_in_x() << std::endl; + std::cout << "ps_y2: " << e2->parameter_space_in_y() << std::endl; +#endif - if (! on_boundary1 && ! on_boundary2) { - // Both events do not have boundary conditions - just compare the points. - return m_traits->compare_xy_2_object()(e1->point(), e2->point()); + const bool is_isolated1 = e1->is_isolated(); + const bool is_isolated2 = e2->is_isolated(); + const bool is_closed_interior1 = e1->is_closed() && !e1->is_on_boundary(); + const bool is_closed_interior2 = e2->is_closed() && !e2->is_on_boundary(); + + if (is_isolated1 || is_closed_interior1) { + const Point_2& pt1 = e1->point(); + Arr_parameter_space ps_x1 = e1->parameter_space_in_x(); + Arr_parameter_space ps_y1 = e1->parameter_space_in_y(); + if (is_isolated2 || is_closed_interior2) { + const Point_2& pt2 = e2->point(); + Arr_parameter_space ps_x2 = e2->parameter_space_in_x(); + Arr_parameter_space ps_y2 = e2->parameter_space_in_y(); + return _compare_points(pt1, ps_x1, ps_y1, pt2, ps_x2, ps_y2); + } + else { + Arr_curve_end ind2; + const X_monotone_curve_2& cv2 = e2->boundary_touching_curve(ind2); + Arr_parameter_space ps_x2 = e2->parameter_space_in_x(); + Arr_parameter_space ps_y2 = e2->parameter_space_in_y(); + return _compare_point_curve_end(pt1, ps_x1, ps_y1, + cv2, ind2, ps_x2, ps_y2); + } } - - if (! on_boundary1) { - // Compare the point associated with the first event with the second - // boundary event. - return this->operator()(e1->point(), e2); + else { + Arr_curve_end ind1; + const X_monotone_curve_2& cv1 = e1->boundary_touching_curve(ind1); + Arr_parameter_space ps_x1 = e1->parameter_space_in_x(); + Arr_parameter_space ps_y1 = e1->parameter_space_in_y(); + if (is_isolated2 || is_closed_interior2) { + const Point_2& pt2 = e2->point(); + Arr_parameter_space ps_x2 = e2->parameter_space_in_x(); + Arr_parameter_space ps_y2 = e2->parameter_space_in_y(); + return CGAL::opposite(_compare_point_curve_end(pt2, ps_x2, ps_y2, + cv1, ind1, ps_x1, ps_y1)); + } + else { + Arr_curve_end ind2; + const X_monotone_curve_2& cv2 = e2->boundary_touching_curve(ind2); + Arr_parameter_space ps_x2 = e2->parameter_space_in_x(); + Arr_parameter_space ps_y2 = e2->parameter_space_in_y(); + return _compare_curve_ends(cv1, ind1, ps_x1, ps_y1, + cv2, ind2, ps_x2, ps_y2); + } } - - if (! on_boundary2) { - // Compare the point associated with the second event with the first - // boundary event. - return CGAL::opposite(this->operator()(e2->point(), e1)); - } - - return _compare_curve_end_with_event(e1->curve(), _curve_end(e1), - e1->parameter_space_in_x(), - e1->parameter_space_in_y(), - e2); } - /*! Compare a point, which should be inserted into the event queue, - * with an existing event point. + /*! Compare an isolated point, which should be inserted into the event queue, + * with an existing event (which might lie on the boundary). + * Note that its boundary conditions must be set beforehand + * using set_parameter_space_in_x/y(). */ - Comparison_result operator()(const Point_2& pt, const Event* e2) const + Comparison_result operator()(const Point_2& pt1, const Event* e2) const { - const bool on_boundary2 = e2->is_on_boundary(); - - if (! on_boundary2) { - // If e2 is a normal event, just compare pt and the event point. - return m_traits->compare_xy_2_object() (pt, e2->point()); - } - - // Get the sign of the event's boundary condition in x. Note that a valid - // point is always larger than any negative boundary event and smaller - // than any positive boundary event. + // REMARK: use m_ps_x and m_ps_y as set from outside! + // do not rely on pt here anymore + Arr_parameter_space ps_x1 = m_ps_x; + Arr_parameter_space ps_y1 = m_ps_y; Arr_parameter_space ps_x2 = e2->parameter_space_in_x(); - - if (ps_x2 == ARR_LEFT_BOUNDARY) return LARGER; - else if (ps_x2 == ARR_RIGHT_BOUNDARY) return SMALLER; - - // Get the curve end that e2 represents, and compare the x-position of the - // given point and this curve end. - Arr_curve_end ind = _curve_end(e2); - Comparison_result res = - m_traits->compare_x_point_curve_end_2_object()(pt, e2->curve(), ind); - - if (res != EQUAL) return res; - - // The event and the point has the same x-position. Get the sign of the - // event's boundary condition in y. Note that a valid point is always - // larger than any negative boundary event and smaller than any positive - // boundary event. Arr_parameter_space ps_y2 = e2->parameter_space_in_y(); - CGAL_assertion (ps_y2 != ARR_INTERIOR); - return (ps_y2 == ARR_BOTTOM_BOUNDARY) ? LARGER : SMALLER; + const bool is_isolated2 = e2->is_isolated(); + const bool is_closed_interior2 = e2->is_closed() && !e2->is_on_boundary(); + if (is_isolated2 || is_closed_interior2) { + const Point_2& pt2 = e2->point(); + return _compare_points(pt1, ps_x1, ps_y1, pt2, ps_x2, ps_y2); + } + + // else + Arr_curve_end ind2; + const X_monotone_curve_2& cv2 = e2->boundary_touching_curve(ind2); + return _compare_point_curve_end(pt1, ps_x1, ps_y1, cv2, ind2, ps_x2, ps_y2); } /*! Compare a curve end, which should be inserted into the event queue, - * with an existing event point. - * Note that the index of the curve end as well as its boundary conditions - * must be set beforehand using set_index() and set_parameter_space_in_x/y(). + * with an existing event (which might lie on the boundary). + * Note that the ind of the curve end as well as its boundary conditions + * must be set beforehand using set_ind() and set_parameter_space_in_x/y(). */ - Comparison_result operator()(const X_monotone_curve_2& cv, - const Event* e2) const + Comparison_result operator() (const X_monotone_curve_2& cv1, + const Event* e2) const { - return _compare_curve_end_with_event(cv, m_index, m_ps_in_x, m_ps_in_y, e2); + // REMARK: use m_index, m_ps_x and m_ps_y as set from outside! + // do not rely on cv here anymore + Arr_curve_end ind1 = m_index; + Arr_parameter_space ps_x1 = m_ps_x; + Arr_parameter_space ps_y1 = m_ps_y; + Arr_parameter_space ps_x2 = e2->parameter_space_in_x(); + Arr_parameter_space ps_y2 = e2->parameter_space_in_y(); + + const bool is_isolated2 = e2->is_isolated(); + const bool is_closed_interior2 = e2->is_closed() && !e2->is_on_boundary(); + if (is_isolated2 || is_closed_interior2) { + const Point_2& pt2 = e2->point(); + return CGAL::opposite(_compare_point_curve_end(pt2, ps_x2, ps_y2, + cv1, ind1, ps_x1, ps_y1)); + } + + // else + Arr_curve_end ind2; + const X_monotone_curve_2& cv2 = e2->boundary_touching_curve(ind2); + return _compare_curve_ends(cv1, ind1, ps_x1, ps_y1, cv2, ind2, ps_x2, ps_y2); } + //!@} + /// \name Set the boundary conditions of a curve end we are about to compare. //@{ - void set_parameter_space_in_x(Arr_parameter_space bx) { m_ps_in_x = bx; } + void set_parameter_space_in_x(Arr_parameter_space bx) { m_ps_x = bx; } - void set_parameter_space_in_y(Arr_parameter_space by) { m_ps_in_y = by; } + void set_parameter_space_in_y(Arr_parameter_space by) { m_ps_y = by; } - void set_index(Arr_curve_end ind) { m_index = ind; } + void set_index(Arr_curve_end index) { m_index = index; } //@} private: - /*! Compare a given curve end with an event. - * \param cv The curve. - * \param ind The curve end. - * \param ps_x The boundary condition of the curve end in x. - * \param ps_y The boundary condition of the curve end in y. - * \param e2 The event, which may have boundary conditions. - * \return The comparison result of the curve end with the event. - */ + // The following three functions basically adapt the case distincting of this table + // (in particular for the 'easy cases' that consists only of a single word and for which the + // following common comparison can be used: + + // e1 left e2 left if a point exists (pt in signature, or vertical case): compare_y_on_boundary(pt1, pt2) REMARK: obviously points on the left boundary are allowed, otherwise: compare_y_curve_ends(ce1, ce2, ind) + // e1 left e2 bottom SMALLER + // e1 left e2 interior SMALLER + // e1 left e2 top SMALLER + // e1 left e2 right SMALLER + + // e1 bottom e2 left LARGER + // e1 bottom e2 bottom one of the three signatures of compare_x_on_boundary + // e1 bottom e2 interior one of the three signatures of compare_x_on_boundary + // e1 bottom e2 top one of the three signatures of compare_x_on_boundary + // e1 bottom e2 right SMALLER + + // e1 interior e2 left LARGER + // e1 interior e2 bottom one of the three signatures of compare_x_on_boundary + // e1 interior e2 interior compare_xy(pt, pt) + // e1 interior e2 top one of the three signatures of compare_x_on_boundary + // e1 interior e2 right SMALLER + + // e1 top e2 left LARGER + // e1 top e2 bottom one of the three signatures of compare_x_on_boundary + // e1 top e2 interior one of the three signatures of compare_x_on_boundary + // e1 top e2 top one of the three signatures of compare_x_on_boundary + // e1 top e2 right SMALLER + + // e1 right e2 left LARGER + // e1 right e2 bottom LARGER + // e1 right e2 interior LARGER + // e1 right e2 top LARGER + // e1 right e2 right if a point exists (pt in signature, or vertical case): compare_y_on_boundary(pt1, pt2) REMARK: obviously points on the left boundary are allowed, otherwise: compare_y_curve_ends(ce1, ce2, ind) + + //! called when no further geometric predicate is needed + //! \pre ps_x1 != ps_x2 Comparison_result - _compare_curve_end_with_event(const X_monotone_curve_2& cv, - Arr_curve_end ind, - Arr_parameter_space ps_x, - Arr_parameter_space ps_y, - const Event* e2) const + _compare_sides(Arr_parameter_space ps_x1, + Arr_parameter_space ps_y1, + Arr_parameter_space ps_x2, + Arr_parameter_space ps_y2) const { - // Check if the curve end has a boundary condition in x. - if (ps_x == ARR_LEFT_BOUNDARY) { - if (e2->parameter_space_in_x() == ARR_LEFT_BOUNDARY) { - // Both defined on the left boundary - compare them there. - CGAL_assertion (ind == ARR_MIN_END); - - return m_traits->compare_y_curve_ends_2_object() (cv, e2->curve(), ind); - } - - // The curve end is obviously smaller. + // only the 14 simple ps_x different cases remain: + // 1L2B, 1L2I, 1L2T, 1L2R, + // 1B2L, 1B2R, + // 1I2L, 1I2R, + // 1T2L, 1T2R + // 1R2L, 1R2B, 1R2I, 1R2T + if (ps_x1 == ARR_LEFT_BOUNDARY) { + //std::cout << "res4 SMALLER" << std::endl; return SMALLER; } - - if (ps_x == ARR_RIGHT_BOUNDARY) { - if (e2->parameter_space_in_x() == ARR_RIGHT_BOUNDARY) { - // Both defined on the right boundary - compare them there. - CGAL_assertion (ind == ARR_MAX_END); - - return m_traits->compare_y_curve_ends_2_object()(cv, e2->curve(), ind); - } - - // The curve end is obviously larger. + if (ps_x1 == ARR_RIGHT_BOUNDARY) { + //std::cout << "res5 LARGER" << std::endl; return LARGER; } - - // Check if the event has a boundary condition in x. Note that if it - // has a negative boundary condition, the curve end is larger than it, - // and if it has a positive boundary condition, the curve end is smaller. - if (e2->parameter_space_in_x() == ARR_LEFT_BOUNDARY) return (LARGER); - if (e2->parameter_space_in_x() == ARR_RIGHT_BOUNDARY) return (SMALLER); - - CGAL_assertion(ps_y != ARR_INTERIOR); - Comparison_result res; - - Arr_curve_end ind2 = _curve_end(e2); - - // Act according to the boundary sign of the event. - if (e2->parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) { - - // Compare the x-positions of the two entities. - res = m_traits->compare_x_curve_ends_2_object()(cv, ind, - e2->curve(), ind2); - if (res != EQUAL) return res; - - // In case of equal x-positions, the curve end is larger than the event, - // which lies on the bottom boundary (unless it also lies on the bottom - // boundary). - if (ps_y == ARR_BOTTOM_BOUNDARY) return EQUAL; - - return (LARGER); + // ps_x1 == ARR_INTERIOR != ps_x2 + if (ps_x2 == ARR_LEFT_BOUNDARY) { + //std::cout << "res6 LARGER" << std::endl; + return LARGER; } - - if (e2->parameter_space_in_y() == ARR_TOP_BOUNDARY) { - // Compare the x-positions of the two entities. - res = - m_traits->compare_x_curve_ends_2_object()(cv, ind, e2->curve(), ind2); - if (res != EQUAL) return res; - - // In case of equal x-positions, the curve end is smaller than the event, - // which lies on the top boundary (unless it also lies on the top - // boundary). - if (ps_y == ARR_TOP_BOUNDARY) return EQUAL; - + if (ps_x2 == ARR_RIGHT_BOUNDARY) { + //std::cout << "res7 SMALLER" << std::endl; return SMALLER; } - // If we reached here, e2 is not a boundary event and is associated with - // a valid point. We compare the x-position of this point with the curve - // end. - res = m_traits->compare_x_point_curve_end_2_object()(e2->point(), cv, ind); + // at this point objects have same interior x-coordinates, and at least one lies + // on a bottom/top boundary + CGAL_assertion(ps_x1 == ARR_INTERIOR); + CGAL_assertion(ps_x2 == ARR_INTERIOR); + CGAL_assertion(ps_y1 != ARR_INTERIOR || ps_y2 != ARR_INTERIOR); - if (res != EQUAL) return CGAL::opposite(res); - - // In case of equal x-positions, is the curve end has a negative boundary - // sign, then it lies on the bottom boundary below the event. Otherwise, - // it lies on the top aboundary above the event e2. - return (ps_y == ARR_BOTTOM_BOUNDARY) ? SMALLER : LARGER; + // else same x, compare y + if (ps_y1 == ps_y2) { + //std::cout << "res8 EQUAL" << std::endl; + return EQUAL; + } + if (ps_y1 == ARR_BOTTOM_BOUNDARY) { + //std::cout << "res9 SMALLER" << std::endl; + return SMALLER; + } + if (ps_y1 == ARR_TOP_BOUNDARY) { + //std::cout << "res10 LARGER" << std::endl; + return LARGER; + } + if (ps_y2 == ARR_BOTTOM_BOUNDARY) { + //std::cout << "res11 LARGER" << std::endl; + return LARGER; + } + if (ps_y2 == ARR_TOP_BOUNDARY) { + //std::cout << "res12 SMALLER" << std::endl; + return SMALLER; + } + CGAL_error(); return EQUAL; /* should not reach here */ } - /*! Detemine if the given event represents a left or a right curve end. */ - inline Arr_curve_end _curve_end(const Event* e) const + /*! Compare two given isolated points. + * + * \param pt1 The first point. + * \param ps_x1 The boundary condition of the first point in x. + * \param ps_y1 The boundary condition of the first point in y. + * \param pt2 The second point. + * \param ps_x2 The boundary condition of the second point in x. + * \param ps_y2 The boundary condition of the second point in y. + * \return The comparison result of the two points. + */ + Comparison_result + _compare_points(const Point_2& pt1, + Arr_parameter_space ps_x1, + Arr_parameter_space ps_y1, + const Point_2& pt2, + Arr_parameter_space ps_x2, + Arr_parameter_space ps_y2) const { +#if 0 + CGAL::set_pretty_mode(std::cout); + std::cout << std::endl << "FUNCTOR pt-pt" << std::endl; + std::cout << "pt1 : " << pt1 << std::endl; + std::cout << "ps_x1: " << ps_x1 << std::endl; + std::cout << "ps_y1: " << ps_y1 << std::endl; + std::cout << "pt2 : " << pt2 << std::endl; + std::cout << "ps_x2: " << ps_x2 << std::endl; + std::cout << "ps_y2: " << ps_y2 << std::endl; +#endif + + if (ps_x1 == ps_x2) { + // same x-partition + if (ps_x1 != ARR_INTERIOR) { + // 1L2L, 1R2R + // e2->point() is accessible, as pt is a point on the SAME left/right side + Comparison_result res = m_traits->compare_y_on_boundary_2_object()(pt1, pt2); + //std::cout << "res1 " << res << std::endl; + return res; + } + // else both are x-interior + if ((ps_y1 == ARR_INTERIOR) && (ps_y2 == ARR_INTERIOR)) { + // both are y-interior, too 1I2I: + Comparison_result res = m_traits->compare_xy_2_object()(pt1, pt2); + // std::cout << "res2 " << res << std::endl; + return res; + } + else { + // at least one of pt1 or pt22 lies on a boundary + Comparison_result res = m_traits->compare_x_on_boundary_2_object()(pt1, pt2); + if (res != EQUAL) { + //std::cout << "res3 " << res << std::endl; + return res; + } + } + } + + return _compare_sides(ps_x1, ps_y1, ps_x2, ps_y2); + } + + + /*! Compares a given isolated point with a curve-end. + * + * \param pt1 The point. + * \param ps_x1 The boundary condition of the point in x. + * \param ps_y1 The boundary condition of the point in y. + * \param cv2 The curve. + * \param ind2 The curve end. + * \param ps_x2 The boundary condition of the curve end in x. + * \param ps_y2 The boundary condition of the curve end in y. + * \return The comparison result of the point with the curve end. + */ + Comparison_result + _compare_point_curve_end(const Point_2& pt1, + Arr_parameter_space ps_x1, + Arr_parameter_space ps_y1, + const X_monotone_curve_2& cv2, + Arr_curve_end ind2, + Arr_parameter_space ps_x2, + Arr_parameter_space ps_y2) const { + +#if 0 + CGAL::set_pretty_mode(std::cout); + std::cout << std::endl << "FUNCTOR pt1-cv2" << std::endl; + std::cout << "pt1 : " << pt1 << std::endl; + std::cout << "ps_x1: " << ps_x1 << std::endl; + std::cout << "ps_y1: " << ps_y1 << std::endl; + std::cout << "cv2 " << (m_traits->is_vertical_2_object()(cv2) ? "|" : " ") << ": " << cv2 << ", " << ind2 << std::endl; + std::cout << "ps_x2: " << ps_x2 << std::endl; + std::cout << "ps_y2: " << ps_y2 << std::endl; +#endif + + if (ps_x1 == ps_x2) { + // same x-partition + if (ps_x1 != ARR_INTERIOR) { + // 1L2L, 1R2R + // second point must be accessible, as pt1 is an isolated point on the + // SAME left/right side + const Point_2& pt2 = + m_traits->construct_vertex_at_curve_end_2_object()(cv2, ind2); + Comparison_result res = + m_traits->compare_y_on_boundary_2_object() (pt1, pt2); + //std::cout << "res1 " << res << std::endl; + return res; + } + // else both are x-interior + if ((ps_y1 == ARR_INTERIOR) && (ps_y2 == ARR_INTERIOR)) { + // both are y-interior, too 1I2I: + // second point must be accessible, as curve-end is INTERIOR + const Point_2& pt2 = + m_traits->construct_vertex_at_curve_end_2_object()(cv2, ind2); + Comparison_result res = m_traits->compare_xy_2_object()(pt1, pt2); + //std::cout << "res2 " << res << std::endl; + return res; + } + else { + // at least one of pt1 or cv2 lies on a boundary + Comparison_result res = + m_traits->compare_x_point_curve_end_2_object()(pt1, cv2, ind2); + if (res != EQUAL) { + //std::cout << "res3 " << res << std::endl; + return res; + } + } + } + + Comparison_result res = _compare_sides(ps_x1, ps_y1, ps_x2, ps_y2); + return res; + } + + /*! Compares two given curve-ends. + * \param cv1 The first curve. + * \param ind1 The first curve end. + * \param ps_x1 The boundary condition of the first curve end in x. + * \param ps_y1 The boundary condition of the first curve end in y. + * \param cv2 The second curve. + * \param ind2 The second curve end. + * \param ps_x2 The boundary condition of the second curve end in x. + * \param ps_y2 The boundary condition of the second curve end in y. + * \return The comparison result of the two curve ends. + */ + Comparison_result + _compare_curve_ends(const X_monotone_curve_2& cv1, + Arr_curve_end ind1, + Arr_parameter_space ps_x1, + Arr_parameter_space ps_y1, + const X_monotone_curve_2& cv2, + Arr_curve_end ind2, + Arr_parameter_space ps_x2, + Arr_parameter_space ps_y2) const { - return (e->has_left_curves()) ? - ((e->is_right_end()) ? ARR_MAX_END : ARR_MIN_END) : - ((e->is_left_end()) ? ARR_MIN_END : ARR_MAX_END); +#if 0 + CGAL::set_pretty_mode(std::cout); + std::cout << std::endl << "FUNCTOR cv1-cv2"<< std::endl; + std::cout << "cv1 " << (m_traits->is_vertical_2_object()(cv1) ? "|" : " ") << ": " << cv1 << ", " << ind1 << std::endl; + std::cout << "ps_x1: " << ps_x1 << std::endl; + std::cout << "ps_y1: " << ps_y1 << std::endl; + std::cout << "cv2 " << (m_traits->is_vertical_2_object()(cv2) ? "|" : " ") << ": " << cv2 << ", " << ind2 << std::endl; + std::cout << "ps_x2: " << ps_x2 << std::endl; + std::cout << "ps_y2: " << ps_y2 << std::endl; +#endif + + if (ps_x1 == ps_x2) { + // same x-partition + // second point must be accessible, as pt1 is an isolated point on the SAME left/right side or INTERIOR + if (ps_x1 != ARR_INTERIOR) { + // 1L2L, 1R2R + if (m_traits->is_vertical_2_object()(cv1) || m_traits->is_vertical_2_object()(cv2)) { + const Point_2& pt1 = m_traits->construct_vertex_at_curve_end_2_object()(cv1, ind1); + const Point_2& pt2 = m_traits->construct_vertex_at_curve_end_2_object()(cv2, ind2); + Comparison_result res = m_traits->compare_y_on_boundary_2_object() (pt1, pt2); + //std::cout << "res1V: " << res << std::endl; + return res; + } + CGAL_assertion(ind1 == ind2); + Comparison_result res = m_traits->compare_y_curve_ends_2_object() (cv1, cv2, ind1); + //std::cout << "res1 " << res << std::endl; + return res; + } + // else both are x-interior + if ((ps_y1 == ARR_INTERIOR) && (ps_y2 == ARR_INTERIOR)) { + // both are y-interior, too 1I2I: + const Point_2& pt1 = m_traits->construct_vertex_at_curve_end_2_object()(cv1, ind1); + const Point_2& pt2 = m_traits->construct_vertex_at_curve_end_2_object()(cv2, ind2); + Comparison_result res = m_traits->compare_xy_2_object()(pt1, pt2); + //std::cout << "res2 " << res << std::endl; + return res; + } + else { + // at least one of pt1 or cv2 lies on a boundary + Comparison_result res = m_traits->compare_x_curve_ends_2_object() (cv1, ind1, cv2, ind2); + //std::cout << "res3 " << res << std::endl; + if (res != EQUAL) { + //std::cout << "res3 " << res << std::endl; + return res; + } + } + } + + Comparison_result res = _compare_sides(ps_x1, ps_y1, ps_x2, ps_y2); + return res; } }; diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_intersection_surface_sweep_2_impl.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_intersection_surface_sweep_2_impl.h index 99afb69afcb..c519b3895ad 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_intersection_surface_sweep_2_impl.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_intersection_surface_sweep_2_impl.h @@ -18,7 +18,7 @@ // // Author(s) : Baruch Zukerman // Efi Fogel -// Eric Berberich +// Eric Berberich // (based on old version by Tali Zvi) #ifndef CGAL_NO_INTERSECTION_SURFACE_SWEEP_2_IMPL_H @@ -241,9 +241,16 @@ void No_intersection_surface_sweep_2::_init_point(const Point_2& pt, Attribute type) { // Create the event, or obtain an existing event in the queue. - // Note that an isolated point does not have any boundary conditions. + Arr_parameter_space ps_x = m_traits->parameter_space_in_x_2_object()(pt); + Arr_parameter_space ps_y = m_traits->parameter_space_in_y_2_object()(pt); +#if 0 + CGAL::set_pretty_mode(std::cout); + std::cout << "init pt ps_x: " << ps_x << std::endl; + std::cout << "init pt ps_y: " << ps_y << std::endl; +#endif + const std::pair& pair_res = - _push_event(pt, type, ARR_INTERIOR, ARR_INTERIOR); + _push_event(pt, type, ps_x, ps_y); bool is_new = pair_res.second; m_visitor->update_event(pair_res.first, pt, is_new); @@ -273,13 +280,12 @@ template void No_intersection_surface_sweep_2:: _init_curve_end(const X_monotone_curve_2& cv, Arr_curve_end ind, Subcurve* sc) { - // Get the boundary conditions of the curve end. const Attribute end_attr = (ind == ARR_MIN_END) ? Event::LEFT_END : Event::RIGHT_END; + // Get the parameter space of the curve end. Arr_parameter_space ps_x = m_traits->parameter_space_in_x_2_object()(cv, ind); Arr_parameter_space ps_y = m_traits->parameter_space_in_y_2_object()(cv, ind); - // Create the corresponding event and push it into the event queue. std::pair pair_res; @@ -305,7 +311,7 @@ _init_curve_end(const X_monotone_curve_2& cv, Arr_curve_end ind, Subcurve* sc) // Inform the visitor in case we updated an existing event. Event* e = pair_res.first; CGAL_assertion(! e->is_closed()); - _update_event_at_open_boundary(e, cv, ind, pair_res.second); + m_visitor->update_event(e, cv, ind, pair_res.second); } } @@ -327,20 +333,7 @@ void No_intersection_surface_sweep_2::_handle_left_curves() // update the m_status_line_insert_hint and m_is_event_on_above members). // We also notify the visitor on the new event we are about to handle. _handle_event_without_left_curves(); - - if (m_currentEvent->is_closed()) { - if (m_is_event_on_above) { - // The current event is on the interior of existing curve on the - // status line. Since the basic sweep does not allow intersections, - // this is possible only if the event is an isolated query point. - CGAL_assertion(! m_currentEvent->has_right_curves() && - m_currentEvent->is_query()); - - m_visitor->before_handle_event(m_currentEvent); - } - else m_visitor->before_handle_event(m_currentEvent); - } - else m_visitor->before_handle_event(m_currentEvent); + m_visitor->before_handle_event(m_currentEvent); // Nothing else to do (no left curves). CGAL_SS_PRINT_END_EOL("handling left curves"); @@ -412,6 +405,8 @@ void No_intersection_surface_sweep_2::_handle_event_without_left_curves() // We are still sweeping the left boundary, so by the way we have ordered // the events in the queue, we know that the new event should be placed // above all other subcurves in the status line. + // \todo EF, now that we allow curves to overlap with the identification + // curve, the above does not hold any longer. m_status_line_insert_hint = m_statusLine.end(); } else { @@ -643,7 +638,7 @@ No_intersection_surface_sweep_2::_push_event(const Point_2& pt, const std::pair& pair_res = m_queue->find_lower(pt, m_queueEventLess); const bool exist = pair_res.second; - if (! exist) { + if (!exist) { // The point is not found in the event queue - create a new event and // insert it into the queue. e = _allocate_event(pt, type, ps_x, ps_y); @@ -656,6 +651,8 @@ No_intersection_surface_sweep_2::_push_event(const Point_2& pt, e->set_attribute(type); } + CGAL_assertion(e->parameter_space_in_x() == ps_x); + CGAL_assertion(e->parameter_space_in_y() == ps_y); // If we are given a subcurve that the event represents one of its // endpoints, update the event and the subcurve records accordingly. @@ -725,8 +722,14 @@ No_intersection_surface_sweep_2::_push_event(const X_monotone_curve_2& cv, // The event associated with the given curve end already exists in the // queue, so we just have to update it. e = *(pair_res.first); - CGAL_assertion((e->parameter_space_in_x() == ps_x) && - (e->parameter_space_in_y() == ps_y)); +#if 0 + std::cout << "ps_x: " << ps_x << std::endl; + std::cout << "ps_y: " << ps_y << std::endl; + std::cout << "es_x: " << e->parameter_space_in_x() << std::endl; + std::cout << "es_y: " << e->parameter_space_in_y() << std::endl; +#endif + CGAL_assertion(e->parameter_space_in_x() == ps_x); + CGAL_assertion(e->parameter_space_in_y() == ps_y); e->set_attribute(type); } diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_overlap_event_base.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_overlap_event_base.h index ef2a717c128..376399d8abe 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_overlap_event_base.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/No_overlap_event_base.h @@ -284,10 +284,10 @@ public: { return m_left_curves.rend(); } /*! Return the number of curves defined to the left of the event. */ - size_t number_of_left_curves() { return m_left_curves.size(); } + size_t number_of_left_curves() const { return m_left_curves.size(); } /*! Return the number of curves defined to the right of the event. */ - size_t number_of_right_curves() { return (m_right_curves.size()); } + size_t number_of_right_curves() const { return (m_right_curves.size()); } /*! Check whether at least one curve is defined to the left of the event. */ bool has_left_curves() const { return (! m_left_curves.empty()); } @@ -295,6 +295,9 @@ public: /*! Checks if at least one curve is defined to the right of the event. */ bool has_right_curves() const { return (! m_right_curves.empty()); } + /*! Returns whether an event has no incident curves */ + bool is_isolated() const { return m_left_curves.empty() && m_right_curves.empty(); } + /*! Obtain the actual event point (const version). * \pre The event is associated with a valid point. */ @@ -314,16 +317,40 @@ public: } /*! Obtain a curve associated with the event (const version). - * \pre The event has incident curves. + * + * \pre The event does not lie on the boundary. + * \pre The event is not isolated. */ const X_monotone_curve_2& curve() const { + CGAL_precondition(!this->is_on_boundary()); + CGAL_precondition(!this->is_isolated()); if (has_left_curves()) return (m_left_curves.front()->last_curve()); CGAL_assertion(has_right_curves()); return (m_right_curves.front()->last_curve()); } + /*! + * Get a curve associated with the event and writes as side-effect the respective end to \param ce + * (const version). + * \param ce reference to a curve-end that is written as side-effect. + * \pre The event lies on the boundary. + * \pre The event is not isolated. + */ + const X_monotone_curve_2& boundary_touching_curve(Arr_curve_end& ce) const { + CGAL_precondition(this->is_on_boundary()); + CGAL_precondition(!this->is_isolated()); + if (has_left_curves()) { + ce = ARR_MAX_END; + return m_left_curves.front()->last_curve(); + } + + CGAL_assertion(has_right_curves()); + ce = ARR_MIN_END; + return m_right_curves.front()->last_curve(); + } + /*! Set the event point. */ void set_point(const Point_2& pt) { m_point = pt; } @@ -415,7 +442,7 @@ public: } #ifdef CGAL_SS_VERBOSE - void Print(); + void Print() const; #endif }; diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_debug.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_debug.h index 303a31f9bce..735141af2a7 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_debug.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_debug.h @@ -141,19 +141,7 @@ template void No_intersection_surface_sweep_2:: PrintOpenBoundaryType(Arr_parameter_space ps_x, Arr_parameter_space ps_y) { - switch (ps_x) { - case ARR_LEFT_BOUNDARY: std::cout << "left boundary"; return; - case ARR_RIGHT_BOUNDARY: std::cout << "right boundary"; return; - case ARR_INTERIOR: - default: break; - } - - switch (ps_y) { - case ARR_BOTTOM_BOUNDARY: std::cout << "bottom boundary"; return; - case ARR_TOP_BOUNDARY: std::cout << "top boundary"; return; - case ARR_INTERIOR: - default: CGAL_error(); - } + std::cout << "[" << ps_x << "," << ps_y << "]"; } template diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h index 10208b45bbb..ed073723667 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h @@ -94,13 +94,10 @@ void Surface_sweep_2::_handle_left_curves() CGAL_SS_PRINT_EOL(); this->_handle_event_without_left_curves(); - // Status_line_iterator sl_pos = this->m_status_line_insert_hint; - if (this->m_is_event_on_above) { CGAL_SS_PRINT_TEXT("The event is on a curve in the status line"); CGAL_SS_PRINT_EOL(); - // Obtain the subcurve that contains the current event Subcurve* sc = *(this->m_status_line_insert_hint); @@ -124,8 +121,7 @@ void Surface_sweep_2::_handle_left_curves() this->m_currentEvent->add_curve_to_left(sc); this->m_currentEvent->push_back_curve_to_right(sc); } - else - { + else { this->m_currentEvent->push_back_curve_to_left(sc); this->m_currentEvent->set_weak_intersection(); this->m_visitor->update_event(this->m_currentEvent, sc); @@ -171,7 +167,7 @@ void Surface_sweep_2::_handle_left_curves() while (left_iter != this->m_currentEvent->left_curves_end()) { Subcurve* leftCurve = *left_iter; - if ((Event*)leftCurve->right_event() == this->m_currentEvent) { + if (leftCurve->right_event() == this->m_currentEvent) { // we are done with that subcurve (current event point is his right // end point) so we remove it from the status line for good. remove_for_good = true; @@ -218,12 +214,12 @@ void Surface_sweep_2::_handle_right_curves() // SL_SAYS: we should be able to do something better without geometric test // (like having an additional boolean in subcurve that we can set in // _handle_left_curves() after a split) - for( Event_subcurve_iterator cit = this->m_currentEvent->right_curves_begin(), - cit_end = this->m_currentEvent->right_curves_end(); - cit!=cit_end; ++cit) + for (Event_subcurve_iterator cit = this->m_currentEvent->right_curves_begin(), + cit_end = this->m_currentEvent->right_curves_end(); + cit != cit_end; ++cit) { - if ( (*cit)->originating_subcurve1()!=NULL && - (Event*)(*cit)->left_event()!=this->m_currentEvent ) + if (((*cit)->originating_subcurve1() != NULL) && + ((*cit)->left_event() != this->m_currentEvent)) { // split the subcurve. const X_monotone_curve_2& lastCurve = (*cit)->last_curve(); @@ -232,8 +228,9 @@ void Surface_sweep_2::_handle_right_curves() this->m_traits->construct_min_vertex_2_object()(lastCurve), this->m_currentEvent->point())) { - this->m_traits->split_2_object()(lastCurve, this->m_currentEvent->point(), - sub_cv1, sub_cv2); + this->m_traits->split_2_object()(lastCurve, + this->m_currentEvent->point(), + sub_cv1, sub_cv2); (*cit)->set_last_curve(sub_cv2); } } @@ -338,9 +335,7 @@ bool Surface_sweep_2::_add_curve_to_right(Event* event, Subcurve* curve) } // a new overlap needs to be computed - _intersect(static_cast(curve), - static_cast(*(pair_res.second)), - event); + _intersect(curve, *(pair_res.second), event); // SL_SAYS: we need to be sure that the overlapping curve generated by // `curve` and `*(pair_res.second)` has not yet been computed or // that the overlapping curve will be added to the right of @@ -401,8 +396,8 @@ void Surface_sweep_2::_remove_curve_from_status_line(Subcurve* leftCurve, // Compute intersections between the two given curves. // template - void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2, - Event* event_for_overlap) +void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2, + Event* event_for_overlap) { CGAL_SS_PRINT_START("computing intersection of "); CGAL_SS_PRINT_CURVE(c1); @@ -423,18 +418,19 @@ template float load_factor = static_cast(m_curves_pair_set.size()) / m_curves_pair_set.bucket_count(); - // after lot of benchemarks, keeping load_factor<=6 is optimal + // after lot of benchmarks, keeping load_factor<=6 is optimal if (load_factor > 6.0f) m_curves_pair_set.resize(m_curves_pair_set.size() * 6); // handle overlapping curves with common ancesters Subcurve_vector all_leaves_diff; - Subcurve* first_parent=NULL; - if (c1->originating_subcurve1()!=NULL || c2->originating_subcurve2()!=NULL) + Subcurve* first_parent = NULL; + if ((c1->originating_subcurve1() != NULL) || + (c2->originating_subcurve2() != NULL)) { - // get the subcurve leaves of c1 and of c2. Then extract from the smallest set - // the subcurves leaves that are not in the other one. If empty, it means that - // a subcurves is completely contained in another one. + // get the subcurve leaves of c1 and of c2. Then extract from the smallest + // set the subcurves leaves that are not in the other one. If empty, it + // means that a subcurves is completely contained in another one. first_parent = c1; Subcurve* second_parent = c2; @@ -460,13 +456,12 @@ template if (all_leaves_second.size()==all_leaves_diff.size()) all_leaves_diff.clear(); // clear so that it is not used by _create_overlapping_curve() else - if (all_leaves_diff.empty()) - { + if (all_leaves_diff.empty()) { CGAL_SS_PRINT_TEXT("One overlapping curve entirely contains the other one"); CGAL_SS_PRINT_EOL(); - Event* left_event = (Event*) first_parent->left_event(); - Event* right_event = (Event*) first_parent->right_event(); + Event* left_event = first_parent->left_event(); + Event* right_event = first_parent->right_event(); if (!second_parent->is_start_point(left_event)) left_event->add_curve_to_left(second_parent); @@ -498,7 +493,7 @@ template CGAL_SS_PRINT_END_EOL("computing intersection"); return; } - else{ + else { CGAL_SS_PRINT_TEXT("Overlap with common ancestors"); CGAL_SS_PRINT_EOL(); @@ -510,20 +505,19 @@ template // (Arr_curve_data_traits_2 is used in the testsuite to sum up // the overlapping degree of a curve) X_monotone_curve_2 xc = first_parent->last_curve(); - for (typename Subcurve_vector::iterator sc_it=all_leaves_diff.begin(); - sc_it!=all_leaves_diff.end(); ++sc_it) + for (typename Subcurve_vector::iterator sc_it = all_leaves_diff.begin(); + sc_it != all_leaves_diff.end(); ++sc_it) { std::vector inter_res; - ; - this->m_traits->intersect_2_object()(xc, (*sc_it)->last_curve(), vector_inserter(inter_res)); CGAL_assertion(inter_res.size()==1); - CGAL_assertion( CGAL::object_cast< X_monotone_curve_2 >(&inter_res.front())!=NULL ); - xc = *CGAL::object_cast< X_monotone_curve_2 >(&inter_res.front()); + CGAL_assertion(CGAL::object_cast(&inter_res.front()) != NULL); + xc = *CGAL::object_cast(&inter_res.front()); } - _create_overlapping_curve(xc, c1 , c2, all_leaves_diff, first_parent, event_for_overlap); + _create_overlapping_curve(xc, c1 , c2, all_leaves_diff, first_parent, + event_for_overlap); CGAL_SS_PRINT_END_EOL("computing intersection (overlap with common ancestors)"); return; } @@ -532,7 +526,6 @@ template // do compute the intersection of the two curves vector_inserter vi(m_x_objects) ; vector_inserter vi_end(m_x_objects); - vi_end = this->m_traits->intersect_2_object()(c1->last_curve(), c2->last_curve(), vi); @@ -562,8 +555,8 @@ template this->m_traits->is_closed_2_object()(c1->last_curve(), ARR_MIN_END) && this->m_traits->is_closed_2_object()(c2->last_curve(), ARR_MIN_END)) { - if ( object_cast >(&(*vi)) != NULL - && this->m_traits->equal_2_object() + if ((object_cast >(&(*vi)) != NULL) && + this->m_traits->equal_2_object() (this->m_traits->construct_min_vertex_2_object()(c1->last_curve()), this->m_traits->construct_min_vertex_2_object()(c2->last_curve()))) { @@ -632,8 +625,12 @@ template if (vi != vi_end) { xp_point = object_cast >(&(*vi)); if (xp_point != NULL) { - // Skip the intersection point if it is not larger than the current - // event. + // Skip the intersection point if it is not larger than the current event. + // To correctly do so, we have to set the ps_x and ps_y for xp_point->first + // in the comparison functor to ARR_INTERIOR (a non-boundary intersection + // must be interior!) + this->m_queueEventLess.set_parameter_space_in_x(ARR_INTERIOR); + this->m_queueEventLess.set_parameter_space_in_y(ARR_INTERIOR); if (this->m_queueEventLess(xp_point->first, this->m_currentEvent) != LARGER) { @@ -659,7 +656,8 @@ template CGAL_assertion(icv != NULL); CGAL_SS_PRINT_TEXT("Found an overlap"); CGAL_SS_PRINT_EOL(); - _create_overlapping_curve(*icv, c1 , c2, all_leaves_diff, first_parent, event_for_overlap); + _create_overlapping_curve(*icv, c1 , c2, all_leaves_diff, + first_parent, event_for_overlap); } } @@ -728,6 +726,10 @@ void Surface_sweep_2::_create_intersection_point(const Point_2& xp, CGAL_SS_PRINT(xp); CGAL_SS_PRINT_TEXT(")"); CGAL_SS_PRINT_EOL(); + if (e == this->m_currentEvent) { + // This can happen when c1 starts at the interior of c2 (or vice versa). + return; + } if (!c1->is_start_point(e)) e->add_curve_to_left(c1); if (!c2->is_start_point(e)) e->add_curve_to_left(c2); @@ -738,13 +740,11 @@ void Surface_sweep_2::_create_intersection_point(const Point_2& xp, e->set_intersection(); this->m_visitor->update_event(e, c1, c2, false); - if (multiplicity==0) - { + if (multiplicity == 0) { if (e->is_right_curve_bigger(c1, c2, this->m_traits)) std::swap(c1, c2); } - else - { - if (multiplicity%2==1) std::swap(c1, c2); + else { + if (multiplicity%2 == 1) std::swap(c1, c2); } } else { @@ -787,7 +787,7 @@ void Surface_sweep_2::_fix_overlap_subcurves() // we check if the subcurve store overlap and current event is its // right end point. - if ((Event*)leftCurve->right_event() == this->m_currentEvent) { + if (leftCurve->right_event() == this->m_currentEvent) { if (leftCurve->originating_subcurve1() != NULL) { Subcurve* orig_sc_1 = leftCurve->originating_subcurve1(); Subcurve* orig_sc_2 = leftCurve->originating_subcurve2(); @@ -802,6 +802,8 @@ void Surface_sweep_2::_fix_overlap_subcurves() CGAL_SS_PRINT_END_EOL("Fixing overlap subcurves"); } +/*! + */ template void Surface_sweep_2:: _create_overlapping_curve(const X_monotone_curve_2& overlap_cv, @@ -821,11 +823,13 @@ _create_overlapping_curve(const X_monotone_curve_2& overlap_cv, this->m_traits->parameter_space_in_y_2_object()(overlap_cv, ARR_MIN_END); if ((ps_x_l != ARR_INTERIOR) || (ps_y_l != ARR_INTERIOR)) { CGAL_assertion(c1->left_event() == c2->left_event()); - left_event=(Event*)(c1->left_event()); + left_event = c1->left_event(); } - else{ - Point_2 left_end = this->m_traits->construct_min_vertex_2_object()(overlap_cv); - left_event = this->_push_event(left_end, Event::DEFAULT, ARR_INTERIOR, ARR_INTERIOR).first; + else { + Point_2 left_end = + this->m_traits->construct_min_vertex_2_object()(overlap_cv); + left_event = this->_push_event(left_end, Event::DEFAULT, ARR_INTERIOR, + ARR_INTERIOR).first; } // Get the right end of overlap_cv. @@ -836,15 +840,16 @@ _create_overlapping_curve(const X_monotone_curve_2& overlap_cv, this->m_traits->parameter_space_in_y_2_object()(overlap_cv, ARR_MAX_END); if ((ps_x_r != ARR_INTERIOR) || (ps_y_r != ARR_INTERIOR)) { CGAL_assertion(c1->right_event() == c2->right_event()); - right_event = (Event*)(c1->right_event()); + right_event = c1->right_event(); } else { - Point_2 right_end = this->m_traits->construct_max_vertex_2_object()(overlap_cv); - right_event = this->_push_event(right_end, Event::DEFAULT, ARR_INTERIOR, ARR_INTERIOR).first; + Point_2 right_end = + this->m_traits->construct_max_vertex_2_object()(overlap_cv); + right_event = this->_push_event(right_end, Event::DEFAULT, ARR_INTERIOR, + ARR_INTERIOR).first; } - if (!c1->is_start_point(left_event)) - { + if (!c1->is_start_point(left_event)) { // here we do not add a curve on the left if there wasn't a curve before // it might happen that a curve will be added on the left while // it should have been an overlapping curve (that will be detected @@ -866,14 +871,12 @@ _create_overlapping_curve(const X_monotone_curve_2& overlap_cv, // Allocate the new Subcurve for the overlap Subcurve* overlap_sc=NULL; - if (all_leaves_diff.empty()) - { + if (all_leaves_diff.empty()) { // first check that an equivalent curve is not already in left_event - for (Subcurve_iterator iter = left_event->right_curves_begin(); iter != left_event->right_curves_end(); - ++iter) + for (Subcurve_iterator iter = left_event->right_curves_begin(); + iter != left_event->right_curves_end(); ++iter) { - if ( (*iter)->has_same_leaves(c1, c2) ) - { + if ((*iter)->has_same_leaves(c1, c2)) { CGAL_SS_PRINT_TEXT("Reuse overlapping curve "); CGAL_SS_PRINT_CURVE(*iter); CGAL_SS_PRINT_EOL(); @@ -882,8 +885,7 @@ _create_overlapping_curve(const X_monotone_curve_2& overlap_cv, } } - if (overlap_sc==NULL) - { + if (overlap_sc == NULL) { CGAL_SS_PRINT_TEXT("Allocate a new subcurve for the overlap (no common subcurves)"); CGAL_SS_PRINT_EOL(); // no duplicate only one curve is needed @@ -899,14 +901,14 @@ _create_overlapping_curve(const X_monotone_curve_2& overlap_cv, overlap_sc->set_originating_subcurve2(c2); } } - else{ + else { CGAL_SS_PRINT_TEXT("Allocate new subcurves for the overlap (common subcurves)"); CGAL_SS_PRINT_EOL(); // create an overlapping curve per subcurve in second_parent that is not in first_parent - for (typename std::vector::const_iterator sc_it=all_leaves_diff.begin(); - sc_it!=all_leaves_diff.end(); - ++sc_it) + for (typename std::vector::const_iterator sc_it = all_leaves_diff.begin(); + sc_it != all_leaves_diff.end(); + ++sc_it) { overlap_sc = this->m_subCurveAlloc.allocate(1); this->m_subCurveAlloc.construct(overlap_sc, this->m_masterSubcurve); @@ -986,7 +988,7 @@ void Surface_sweep_2::_fix_finished_overlap_subcurve(Subcurve* sc) CGAL_assertion(sc != NULL); // split 'sc' if necessary and update to event as weak intersection - if ((Event*)sc->right_event() != this->m_currentEvent) { + if (sc->right_event() != this->m_currentEvent) { this->m_traits->split_2_object()(sc->last_curve(), this->m_currentEvent->point(), sub_cv1, sub_cv2);