diff --git a/Circular_kernel_2/include/CGAL/Circular_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_arc_2.h index 08eed2e63d0..fa28a24cfbc 100644 --- a/Circular_kernel_2/include/CGAL/Circular_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_arc_2.h @@ -226,204 +226,6 @@ public: return is; } -template < class CK > -struct Filtered_bbox_circular_kernel_2; - -template < typename CK > -class Circular_arc_2 < Filtered_bbox_circular_kernel_2 < CK > > { - - typedef Filtered_bbox_circular_kernel_2 < CK > BK; - typedef Circular_arc_2< BK > Self; - typedef typename BK::FT FT; - typedef typename BK::RT RT; - typedef typename BK::Point_2 Point_2; - typedef typename BK::Line_2 Line_2; - typedef typename BK::Circle_2 Circle_2; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Circular_arc_2 Rcircular_arc_2; - typedef typename CK::Root_of_2 Root_of_2; - -public: - typedef BK R; - typedef Circular_arc_2 Rep; - - const Rep& rep() const - { - return *this; - } - - Rep& rep() - { - return *this; - } - - ///////////Construction///////////// - - Circular_arc_2(){} - - // otherwise it will lead to ambiguos definitions - explicit Circular_arc_2(const Circle_2 &c) - : P_arc(c),bb(NULL) - {} - - Circular_arc_2(const Circle_2 &support, - const Line_2 &l1, const bool b_l1, - const Line_2 &l2, const bool b_l2) - : P_arc(support,l1,b_l1,l2,b_l2),bb(NULL) - {} - - - Circular_arc_2(const Circle_2 &c, - const Circle_2 &c1, const bool b_1, - const Circle_2 &c2, const bool b_2) - : P_arc(c,c1,b_1,c2,b_2),bb(NULL) - {} - - - Circular_arc_2(const Rcircular_arc_2 &A, const bool b, - const Circle_2 &ccut, const bool b_cut) - : P_arc(A, b, ccut, b_cut),bb(NULL) - {} - - - Circular_arc_2(const Point_2 &start, - const Point_2 &middle, - const Point_2 &end) - : P_arc(start, middle, end),bb(NULL) - {} - - Circular_arc_2(const Point_2 &begin, - const Point_2 &end, - const FT &bulge) - : P_arc(begin, end, bulge),bb(NULL) - {} - - Circular_arc_2(const Circle_2 &support, - const Circular_arc_point_2 &begin, - const Circular_arc_point_2 &end) - : P_arc(support, begin.point(), end.point()),bb(NULL) - {} - - Circular_arc_2(const Rcircular_arc_2 &a) - : P_arc(a),bb(NULL) - {} - - Circular_arc_2(const Circular_arc_2 &c) : P_arc(c.P_arc) - { - if(c.bb) bb = new Bbox_2(*(c.bb)); - else bb = NULL; - } - - ~Circular_arc_2() { if(bb) delete bb; } - - - //////////Predicates////////// - - bool is_x_monotone() const - { return P_arc.is_x_monotone();} - - bool is_y_monotone() const - { return P_arc.is_y_monotone();} - - bool on_upper_part() const - { return P_arc.on_upper_part();} - - - //////////Accessors/////////// - - const Rcircular_arc_2& arc () const - { return P_arc ;} - - ///Interface of the inner arc/// - - typename Qualified_result_of::type - source() const - { return typename BK::Construct_circular_source_vertex_2()(*this);} - - typename Qualified_result_of::type - target() const - { return typename BK::Construct_circular_target_vertex_2()(*this);} - - typename Qualified_result_of::type - left() const - { - return typename BK::Construct_circular_min_vertex_2()(*this); - } - - typename Qualified_result_of::type - right() const - { - return typename BK::Construct_circular_max_vertex_2()(*this); - } - - Circle_2 supporting_circle() const - { return P_arc.supporting_circle();} - - Point_2 center() const - { return P_arc.center();} - - FT squared_radius() const - { return P_arc.squared_radius();} - - Bbox_2 bbox() const - { - if(bb==NULL) - bb=new Bbox_2(P_arc.bbox()); - return *bb; - } - - - ///Specific check used for bbox construction/// - - bool has_no_bbox() const - { return (bb==NULL);} - - bool equal_ref(const Circular_arc_2 &c) const - { - return CGAL::identical(P_arc, c.P_arc); - } - - bool is_full() const { - return P_arc.is_full(); - } - - bool is_complementary_x_monotone() const { - return P_arc.is_complementary_x_monotone(); - } - - bool is_complementary_y_monotone() const { - return P_arc.is_complementary_y_monotone(); - } - - bool two_end_points_on_upper_part() const { - return P_arc.two_end_points_on_upper_part(); - } - - bool complementary_on_upper_part() const { - return P_arc.complementary_on_upper_part(); - } - - bool two_end_points_on_left_part() const { - return P_arc.two_end_points_on_left_part(); - } - - bool on_left_part() const { - return P_arc.on_left_part(); - } - - bool complementary_on_left_part() const { - return P_arc.complementary_on_left_part(); - } - - private: - - Rcircular_arc_2 P_arc; - mutable Bbox_2 *bb; - - -}; - - } //namespace CGAL diff --git a/Circular_kernel_2/include/CGAL/Circular_arc_point_2.h b/Circular_kernel_2/include/CGAL/Circular_arc_point_2.h index d90badb8540..b6ec210fa71 100644 --- a/Circular_kernel_2/include/CGAL/Circular_arc_point_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_arc_point_2.h @@ -172,103 +172,6 @@ public: return os << p.x() << " " << p.y() << " "; } -template < class CK > -struct Filtered_bbox_circular_kernel_2; - -template < typename CK > -class Circular_arc_point_2 < Filtered_bbox_circular_kernel_2 < CK > > { - - typedef Filtered_bbox_circular_kernel_2 < CK > BK; - typedef typename CK::FT FT; - typedef typename CK::RT RT; - typedef typename BK::Point_2 Point_2; - typedef typename CK::Line_2 Line_2; - typedef typename CK::Circle_2 Circle_2; - typedef typename CK::Circular_arc_point_2 Rcircular_arc_point_2; - typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Root_of_2 Root_of_2; - -public: - typedef typename Rcircular_arc_point_2::Root_for_circles_2_2 - Root_for_circles_2_2; - typedef BK R; - typedef Circular_arc_point_2 Rep; - - const Rep& rep() const - { - return *this; - } - - Rep& rep() - { - return *this; - } - - ////Construction///// - Circular_arc_point_2() - : P_point(),bb(NULL) - {} - - Circular_arc_point_2(const Root_for_circles_2_2 & np) - : P_point(np), bb(NULL) - {} - - Circular_arc_point_2(const Point_2 & p) - : P_point(p), bb(NULL) - {} - - Circular_arc_point_2(const Rcircular_arc_point_2 & p) - : P_point(p),bb(NULL) - {} - - Circular_arc_point_2(const Circular_arc_point_2 &c) : P_point(c.P_point) - { - if(c.bb) bb = new Bbox_2(*(c.bb)); - else bb = NULL; - } - - ~Circular_arc_point_2() { if(bb) delete bb; } - - ////Accesors//// - const Rcircular_arc_point_2& point() const - {return P_point;} - - typename Qualified_result_of::type - x() const - { return P_point.x();} - - typename Qualified_result_of::type - y() const - { return P_point.y();} - - - ////Bbox related accessors//// - -bool has_no_bbox() const - { return (bb==NULL);} - - Bbox_2 bbox() const - { - if(this->has_no_bbox()) - bb= new Bbox_2(P_point.bbox()); - - return *bb; - } - - const Root_for_circles_2_2 & coordinates() const - { return P_point.coordinates(); } - - bool equal_ref(const Circular_arc_point_2 &p) const - { - return CGAL::identical(P_point, p.P_point); - } - -private: - - Rcircular_arc_point_2 P_point; - mutable Bbox_2 *bb; - -}; } //namespace CGAL diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2.h index eaebb6f9114..571828329d7 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2.h @@ -48,9 +48,9 @@ namespace internal { template < class CircularKernel, class LinearKernelBase, class AlgebraicKernel > struct Circular_kernel_base_ref_count: public LinearKernelBase { - typedef internal::Circular_arc_2 Circular_arc_2; - typedef internal::Circular_arc_point_2 Circular_arc_point_2; - typedef internal::Line_arc_2 Line_arc_2; + typedef internal::Circular_arc_2_base Circular_arc_2; + typedef internal::Circular_arc_point_2_base Circular_arc_point_2; + typedef internal::Line_arc_2_base Line_arc_2; typedef LinearKernelBase Linear_kernel; typedef AlgebraicKernel Algebraic_kernel; typedef typename Algebraic_kernel::Root_of_2 Root_of_2; @@ -66,7 +66,12 @@ struct Circular_kernel_base_ref_count: public LinearKernelBase struct Handle { typedef Handle_for type; }; template < typename Kernel2 > - struct Base { typedef Circular_kernel_base_ref_count Type; }; + struct Base { + typedef typename LinearKernelBase::template Base::Type ReboundLK; + typedef Circular_kernel_base_ref_count Type; + }; #define CGAL_Circular_Kernel_pred(Y,Z) \ typedef CircularFunctors::Y Y; \ diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_2.h index c8ead080833..13b27276ee1 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_2.h @@ -44,9 +44,11 @@ namespace CGAL { namespace internal { - template - class Circular_arc_2 + template + class Circular_arc_2_base { + public: + typedef CK_ CK; typedef typename CK::FT FT; typedef typename CK::RT RT; typedef typename CK::Point_2 Point_2; @@ -54,6 +56,8 @@ namespace internal { typedef typename CK::Circle_2 Circle_2; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Root_of_2 Root_of_2; + + private: typedef struct bit_field { unsigned short int is_full:2; unsigned short int is_x_monotonic:2; @@ -87,7 +91,7 @@ namespace internal { public: - Circular_arc_2() + Circular_arc_2_base() #ifdef CGAL_INTERSECTION_MAP_FOR_SUPPORTING_CIRCLES : id_of_my_supporting_circle(0) #endif @@ -100,7 +104,7 @@ namespace internal { } - Circular_arc_2(const Circle_2 &c) + Circular_arc_2_base(const Circle_2 &c) : _support(c) #ifdef CGAL_INTERSECTION_MAP_FOR_SUPPORTING_CIRCLES , id_of_my_supporting_circle(0) @@ -117,7 +121,7 @@ namespace internal { CircularFunctors::x_extremal_point(supporting_circle(),true); } - Circular_arc_2(const Circle_2 &support, + Circular_arc_2_base(const Circle_2 &support, const Line_2 &l1, bool b1, const Line_2 &l2, bool b2) { @@ -143,14 +147,14 @@ namespace internal { Circle_2 c2 (center2, sqr2); - *this = Circular_arc_2(support, c1, b1, c2, b2); + *this = Circular_arc_2_base(support, c1, b1, c2, b2); CGAL_kernel_assertion(do_intersect(support, c1)); CGAL_kernel_assertion(do_intersect(support, c2)); } - Circular_arc_2(const Circle_2 &c, + Circular_arc_2_base(const Circle_2 &c, const Circle_2 &c1, const bool b_1, const Circle_2 &c2, const bool b_2) : _support(c) @@ -208,7 +212,7 @@ namespace internal { // having same (b) endpoint as A (true == _begin, false == _end) // but whose (!b) endpoint is the intersection of A with ccut given // by b_cut - Circular_arc_2(const Circular_arc_2 &A, const bool b, + Circular_arc_2_base(const Circular_arc_2_base &A, const bool b, const Circle_2 &ccut, const bool b_cut) : _support(A.supporting_circle()) #ifdef CGAL_INTERSECTION_MAP_FOR_SUPPORTING_CIRCLES @@ -244,7 +248,7 @@ namespace internal { // Constructs an arc supported by Circle_2(begin, middle, end), // with _begin == begin, _end == end. // (middle is not necessarily on the arc) - Circular_arc_2(const Point_2 &begin, + Circular_arc_2_base(const Point_2 &begin, const Point_2 &middle, const Point_2 &end) : _begin(begin), _end(end) @@ -264,14 +268,14 @@ namespace internal { * Circle_2 c = Circle_2(begin, middle, end); * Line_2 l1 (begin, middle); Line_2 l2 (middle, end); - *this = Circular_arc_2(c, + *this = Circular_arc_2_base(c, l1, compare_xy(begin, middle) < 0, l2, compare_xy(end, middle) < 0);*/ //std::cout << source() << std::endl; //std::cout << target() << std::endl; } - Circular_arc_2(const Circle_2 &support, + Circular_arc_2_base(const Circle_2 &support, const Circular_arc_point_2 &source, const Circular_arc_point_2 &target) : _begin(source), _end(target), _support(support) @@ -293,7 +297,7 @@ namespace internal { // CGAL_kernel_exactness_precondition(CK().has_on_2_object()(support, target)); } - Circular_arc_2(const Point_2 &begin, + Circular_arc_2_base(const Point_2 &begin, const Point_2 &end, const FT &bulge) : _begin(begin), _end(end) @@ -337,15 +341,15 @@ namespace internal { #ifdef CGAL_INTERSECTION_MAP_FOR_XMONOTONIC_ARC_WITH_SAME_SUPPORTING_CIRCLE template < class T > - static bool find_intersection(const Circular_arc_2& c1, - const Circular_arc_2& c2, + static bool find_intersection(const Circular_arc_2_base& c1, + const Circular_arc_2_base& c2, T& res) { return table.find(c1.my_id, c2.my_id, res); } template < class T > - static void put_intersection(const Circular_arc_2& c1, - const Circular_arc_2& c2, + static void put_intersection(const Circular_arc_2_base& c1, + const Circular_arc_2_base& c2, const T& res) { table.put(c1.my_id, c2.my_id, res); } @@ -357,8 +361,8 @@ namespace internal { template < class T > static bool find_intersection_circle_circle( - const Circular_arc_2& c1, - const Circular_arc_2& c2, + const Circular_arc_2_base& c1, + const Circular_arc_2_base& c2, T& res) { if(c1.id_of_my_supporting_circle == 0) return false; if(c2.id_of_my_supporting_circle == 0) return false; @@ -368,8 +372,8 @@ namespace internal { } template < class T > - static void put_intersection_circle_circle(const Circular_arc_2& c1, - const Circular_arc_2& c2, + static void put_intersection_circle_circle(const Circular_arc_2_base& c1, + const Circular_arc_2_base& c2, const T& res) { circle_table.put(c1.circle_number(), c2.circle_number(), @@ -653,23 +657,23 @@ public: flags.is_complementary_x_monotone = v_is_complementary_x_monotone; } - }; + }; // end class Circular_arc_2_base #ifdef CGAL_INTERSECTION_MAP_FOR_XMONOTONIC_ARC_WITH_SAME_SUPPORTING_CIRCLE template < typename CK > - internal::Intersection_line_2_circle_2_map Circular_arc_2< CK >::table = + internal::Intersection_line_2_circle_2_map Circular_arc_2_base< CK >::table = internal::Intersection_line_2_circle_2_map(); #endif #ifdef CGAL_INTERSECTION_MAP_FOR_SUPPORTING_CIRCLES template < typename CK > - internal::Intersection_line_2_circle_2_map Circular_arc_2< CK >::circle_table = + internal::Intersection_line_2_circle_2_map Circular_arc_2_base< CK >::circle_table = internal::Intersection_line_2_circle_2_map(); #endif template < typename CK > std::ostream & - operator<<(std::ostream & os, const Circular_arc_2 &a) + operator<<(std::ostream & os, const Circular_arc_2_base &a) { // The output format is : // - supporting circle @@ -684,23 +688,23 @@ public: template < typename CK > std::istream & - operator>>(std::istream & is, Circular_arc_2 &a) + operator>>(std::istream & is, Circular_arc_2_base &a) { typename CK::Circle_2 s; typename CK::Circular_arc_point_2 p1; typename CK::Circular_arc_point_2 p2; is >> s >> p1 >> p2 ; if (is) - a = Circular_arc_2(s, p1, p2); + a = Circular_arc_2_base(s, p1, p2); return is; } template < typename CK > std::ostream & - print(std::ostream & os, const Circular_arc_2 &a) + print(std::ostream & os, const Circular_arc_2_base &a) { if(a.is_x_monotone()) { - return os << "Circular_arc_2( " << std::endl + return os << "Circular_arc_2_base( " << std::endl << "left : " << a.left() << " , " << std::endl << "right : " << a.right() << " , " << std::endl << "upper part : " << a.on_upper_part() << std::endl @@ -710,7 +714,7 @@ public: << std::sqrt(CGAL::to_double(a.supporting_circle().squared_radius())) << " ]])" << std::endl; } else { - return os << "Circular_arc_2( " << std::endl + return os << "Circular_arc_2_base( " << std::endl << " [[ approximate circle is (x,y,r) : " << CGAL::to_double(a.supporting_circle().center().x()) << "" << CGAL::to_double(a.supporting_circle().center().y()) << "" @@ -719,6 +723,96 @@ public: } } + +template < typename CK > +class Filtered_bbox_circular_arc_2_base : public Circular_arc_2_base +{ + typedef Filtered_bbox_circular_arc_2_base Self; + typedef Circular_arc_2_base P_arc; + typedef typename CK::FT FT; + typedef typename CK::Point_2 Point_2; + typedef typename CK::Line_2 Line_2; + typedef typename CK::Circle_2 Circle_2; + typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Root_of_2 Root_of_2; + +public: + ///////////Construction///////////// + + Filtered_bbox_circular_arc_2_base() : P_arc(), bb(NULL) {} + + // otherwise it will lead to ambiguos definitions + explicit Filtered_bbox_circular_arc_2_base(const Circle_2 &c) + : P_arc(c),bb(NULL) + {} + + Filtered_bbox_circular_arc_2_base(const Circle_2 &support, + const Line_2 &l1, const bool b_l1, + const Line_2 &l2, const bool b_l2) + : P_arc(support,l1,b_l1,l2,b_l2),bb(NULL) + {} + + + Filtered_bbox_circular_arc_2_base(const Circle_2 &c, + const Circle_2 &c1, const bool b_1, + const Circle_2 &c2, const bool b_2) + : P_arc(c,c1,b_1,c2,b_2),bb(NULL) + {} + + + Filtered_bbox_circular_arc_2_base(const Point_2 &start, + const Point_2 &middle, + const Point_2 &end) + : P_arc(start, middle, end),bb(NULL) + {} + + Filtered_bbox_circular_arc_2_base(const Point_2 &begin, + const Point_2 &end, + const FT &bulge) + : P_arc(begin, end, bulge),bb(NULL) + {} + + Filtered_bbox_circular_arc_2_base(const Circle_2 &support, + const Circular_arc_point_2 &begin, + const Circular_arc_point_2 &end) + : P_arc(support, begin, end),bb(NULL) + {} + + Filtered_bbox_circular_arc_2_base(const Self &c) + : P_arc(c), bb(c.bb ? new Bbox_2(*(c.bb)) : NULL) + {} + + Filtered_bbox_circular_arc_2_base& operator=(const Self& c) + { + if(this != &c) + { + this->P_arc::operator=(c); + bb = c.bb ? new Bbox_2(*(c.bb)) : NULL; + } + return *this; + } + + ~Filtered_bbox_circular_arc_2_base() { if(bb) delete bb; } + + Bbox_2 bbox() const + { + if(bb==NULL) + bb=new Bbox_2(CGAL::CircularFunctors::circular_arc_bbox(*this)); + return *bb; + } + + + ///Specific check used for bbox construction/// + bool has_no_bbox() const + { return (bb==NULL);} + +private: + mutable Bbox_2 *bb; +}; // end class Filtered_bbox_circular_arc_2_base + + + + } // namespace internal } // namespace CGAL diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_point_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_point_2.h index 19892728e15..1d49d6fff16 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_point_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_point_2.h @@ -34,7 +34,7 @@ namespace CGAL { namespace internal { template - class Circular_arc_point_2 + class Circular_arc_point_2_base { typedef typename CK::FT FT; typedef typename CK::Root_of_2 Root_of_2; @@ -44,14 +44,14 @@ namespace internal { typedef typename CK::Root_for_circles_2_2 Root_for_circles_2_2; typedef typename CK::template Handle::type Base; - Circular_arc_point_2() + Circular_arc_point_2_base() {} - Circular_arc_point_2(const Root_for_circles_2_2 & np) + Circular_arc_point_2_base(const Root_for_circles_2_2 & np) : _p(np) {} - Circular_arc_point_2(const Point_2 & p) + Circular_arc_point_2_base(const Point_2 & p) : _p(p.x(),p.y()/*,1,1,-p.x()-p.y()*/) {} @@ -69,7 +69,7 @@ namespace internal { const Root_for_circles_2_2 & coordinates() const { return get(_p); } - bool equal_ref(const Circular_arc_point_2 &p) const + bool equal_ref(const Circular_arc_point_2_base &p) const { return CGAL::identical(_p, p._p); } @@ -80,12 +80,84 @@ namespace internal { template < typename CK > std::ostream & - print(std::ostream & os, const Circular_arc_point_2 &p) + print(std::ostream & os, const Circular_arc_point_2_base &p) { return os << "CirclArcEndPoint_2(" << std::endl << p.x() << ", " << p.y() << ')'; } +template < typename BK > +class Filtered_bbox_circular_arc_point_2_base + : public Circular_arc_point_2_base +{ +public: + typedef Filtered_bbox_circular_arc_point_2_base Self; + typedef Circular_arc_point_2_base P_point; + + typedef typename BK::Point_2 Point_2; + typedef typename BK::Root_for_circles_2_2 Root_for_circles_2_2; + + void trace_bb() const { + std::cerr << "Creation bb = " << (void*)(bb); + if(bb) { + std::cerr << " (" << *bb << ")"; + } + std::cerr << "\n"; + } + + ////Construction///// + Filtered_bbox_circular_arc_point_2_base() + : P_point(), bb(NULL) + {} + + explicit Filtered_bbox_circular_arc_point_2_base(const Root_for_circles_2_2 & np) + : P_point(np), bb(NULL) + {trace_bb();} + + explicit Filtered_bbox_circular_arc_point_2_base(const Point_2 & p) + : P_point(p), bb(NULL) + {trace_bb();} + + Filtered_bbox_circular_arc_point_2_base(const Self &c) + : P_point(c), bb(c.bb ? new Bbox_2(*(c.bb)) : NULL) + {trace_bb();} + + Filtered_bbox_circular_arc_point_2_base& + operator=(const Self& c) { + if(this != &c) + { + this->P_point::operator=(c); + bb = c.bb ? new Bbox_2(*(c.bb)) : NULL; + } + return *this; + } + + ~Filtered_bbox_circular_arc_point_2_base() { + std::cerr << "Destruction, bb = " << (void*)(bb) << std::endl; + if(bb) { + delete bb; + bb = 0; + } + } + + ////Bbox related accessors//// + + bool has_no_bbox() const + { return (bb==NULL);} + + Bbox_2 bbox() const + { + if(this->has_no_bbox()) + bb= new Bbox_2(P_point::bbox()); + + return *bb; + } + +private: + mutable Bbox_2 *bb; +}; // end class Filtered_bbox_circular_arc_point_2_base + + } // namespace internal } // namespace CGAL diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/Line_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/Line_arc_2.h index bd3b4c5acdc..5dcb03410d4 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/Line_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/Line_arc_2.h @@ -36,238 +36,318 @@ namespace CGAL { namespace internal { - template - class Line_arc_2 +template +class Line_arc_2_base +{ +public: + typedef typename CK::FT FT; + typedef typename CK::RT RT; + typedef typename CK::Point_2 Point_2; + typedef typename CK::Line_2 Line_2; + typedef typename CK::Circle_2 Circle_2; + typedef typename CK::Circular_arc_2 Circular_arc_2; + typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Root_of_2 Root_of_2; + typedef typename CK::Segment_2 Segment_2; + +private: + typedef struct bit_field { + unsigned char begin_less_xy_than_end:2; + } bit_field; + + // set flags to 0 + // when 1 bit -> 0 = false, 1 = true + // when 2 bits -> 0 = don_know, 1 = false + // 2 = true + void reset_flags() const { + flags.begin_less_xy_than_end = 0; + } + +public: + //typedef typename CGAL::Simple_cartesian::Point_2 + // Numeric_point_2; + typedef typename CK::Root_for_circles_2_2 + Root_for_circles_2_2; + + static + Circular_arc_point_2 + intersect(const Line_2 & l, const Circle_2 & c, const bool b) { - typedef typename CK::FT FT; - typedef typename CK::RT RT; - typedef typename CK::Point_2 Point_2; - typedef typename CK::Line_2 Line_2; - typedef typename CK::Circle_2 Circle_2; - typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Root_of_2 Root_of_2; - typedef typename CK::Segment_2 Segment_2; - typedef struct bit_field { - unsigned char begin_less_xy_than_end:2; - } bit_field; - - private: - // set flags to 0 - // when 1 bit -> 0 = false, 1 = true - // when 2 bits -> 0 = don_know, 1 = false - // 2 = true - void reset_flags() const { - flags.begin_less_xy_than_end = 0; - } - - public: - //typedef typename CGAL::Simple_cartesian::Point_2 - // Numeric_point_2; - typedef typename CK::Root_for_circles_2_2 - Root_for_circles_2_2; - - static - Circular_arc_point_2 - intersect(const Line_2 & l, const Circle_2 & c, const bool b) - { - typedef std::vector - solutions_container; + typedef std::vector + solutions_container; - solutions_container solutions; - CGAL::CircularFunctors::intersect_2 - ( l, c, std::back_inserter(solutions) ); - typename solutions_container::iterator it = solutions.begin(); + solutions_container solutions; + CGAL::CircularFunctors::intersect_2 + ( l, c, std::back_inserter(solutions) ); + typename solutions_container::iterator it = solutions.begin(); - CGAL_kernel_precondition( it != solutions.end() ); - // the circles intersect + CGAL_kernel_precondition( it != solutions.end() ); + // the circles intersect - const std::pair *result; - result = CGAL::object_cast< - std::pair >(&(*it)); - if ( result->second == 2 ) // double solution - return result->first; - if (b) return result->first; - ++it; - result = CGAL::object_cast< - std::pair >(&(*it)); + const std::pair *result; + result = CGAL::object_cast< + std::pair >(&(*it)); + if ( result->second == 2 ) // double solution return result->first; - } + if (b) return result->first; + ++it; + result = CGAL::object_cast< + std::pair >(&(*it)); + return result->first; + } - public: - Line_arc_2() +public: + Line_arc_2_base() #ifdef CGAL_INTERSECTION_MAP_FOR_SUPPORTING_CIRCLES : id_of_my_supporting_line(Circular_arc_2::circle_table.get_new_id()) #endif - {} + {} - Line_arc_2(const Line_2 &support, - const Circle_2 &c1,const bool b1, - const Circle_2 &c2,const bool b2) - :_support(support) + Line_arc_2_base(const Line_2 &support, + const Circle_2 &c1,const bool b1, + const Circle_2 &c2,const bool b2) + :_support(support) #ifdef CGAL_INTERSECTION_MAP_FOR_SUPPORTING_CIRCLES ,id_of_my_supporting_line(Circular_arc_2::circle_table.get_new_id()) #endif - { - _begin = intersect(support, c1, b1); - _end = intersect(support, c2, b2); - reset_flags(); - } + { + _begin = intersect(support, c1, b1); + _end = intersect(support, c2, b2); + reset_flags(); + } - Line_arc_2(const Line_2 &support, - const Line_2 &l1, - const Line_2 &l2) - :_support(support) + Line_arc_2_base(const Line_2 &support, + const Line_2 &l1, + const Line_2 &l2) + :_support(support) #ifdef CGAL_INTERSECTION_MAP_FOR_SUPPORTING_CIRCLES ,id_of_my_supporting_line(Circular_arc_2::circle_table.get_new_id()) #endif - { - CGAL_kernel_precondition(do_intersect(support, l1)); - CGAL_kernel_precondition(do_intersect(support, l2)); - //typedef typename Root_of_2::RT RT_2; - //Voir pour mettre une assertion au assign - Object obj = intersection(support, l1); - const Point_2 *pt = CGAL::object_cast(&obj); - _begin = Circular_arc_point_2(*pt); - obj = intersection(support, l2); - const Point_2 *pt2 = CGAL::object_cast(&obj); - _end = Circular_arc_point_2(*pt2); - reset_flags(); - } + { + CGAL_kernel_precondition(do_intersect(support, l1)); + CGAL_kernel_precondition(do_intersect(support, l2)); + //typedef typename Root_of_2::RT RT_2; + //Voir pour mettre une assertion au assign + Object obj = intersection(support, l1); + const Point_2 *pt = CGAL::object_cast(&obj); + _begin = Circular_arc_point_2(*pt); + obj = intersection(support, l2); + const Point_2 *pt2 = CGAL::object_cast(&obj); + _end = Circular_arc_point_2(*pt2); + reset_flags(); + } - Line_arc_2(const Line_2 &support, - const Circular_arc_point_2 &p1, - const Circular_arc_point_2 &p2) - :_support(support) + Line_arc_2_base(const Line_2 &support, + const Circular_arc_point_2 &p1, + const Circular_arc_point_2 &p2) + :_support(support) #ifdef CGAL_INTERSECTION_MAP_FOR_SUPPORTING_CIRCLES ,id_of_my_supporting_line(Circular_arc_2::circle_table.get_new_id()) #endif - { - //Verifier si p1 et p2 sont sur la line - _begin = p1; - _end = p2; - reset_flags(); - } + { + //Verifier si p1 et p2 sont sur la line + _begin = p1; + _end = p2; + reset_flags(); + } - Line_arc_2(const Segment_2 &s) - :_support(s.supporting_line()) + Line_arc_2_base(const Segment_2 &s) + :_support(s.supporting_line()) #ifdef CGAL_INTERSECTION_MAP_FOR_SUPPORTING_CIRCLES ,id_of_my_supporting_line(Circular_arc_2::circle_table.get_new_id()) #endif - { - _begin = Circular_arc_point_2(s.source()); - _end = Circular_arc_point_2(s.target()); - reset_flags(); - } + { + _begin = Circular_arc_point_2(s.source()); + _end = Circular_arc_point_2(s.target()); + reset_flags(); + } - Line_arc_2(const Point_2 &p1, - const Point_2 &p2) + Line_arc_2_base(const Point_2 &p1, + const Point_2 &p2) #ifdef CGAL_INTERSECTION_MAP_FOR_SUPPORTING_CIRCLES : id_of_my_supporting_line(Circular_arc_2::circle_table.get_new_id()) #endif - { - _support = Line_2(p1, p2); - _begin = Circular_arc_point_2(p1); - _end = Circular_arc_point_2(p2); - reset_flags(); - } + { + _support = Line_2(p1, p2); + _begin = Circular_arc_point_2(p1); + _end = Circular_arc_point_2(p2); + reset_flags(); + } - private: +private: - Line_2 _support; - Circular_arc_point_2 _begin, _end; - mutable bit_field flags; + Line_2 _support; + Circular_arc_point_2 _begin, _end; + mutable bit_field flags; #ifdef CGAL_INTERSECTION_MAP_FOR_SUPPORTING_CIRCLES - mutable unsigned int id_of_my_supporting_line; + mutable unsigned int id_of_my_supporting_line; - unsigned int line_number() const { - return id_of_my_supporting_line; - } + unsigned int line_number() const { + return id_of_my_supporting_line; + } - void set_line_number(unsigned int i) const { - id_of_my_supporting_line = i; - } + void set_line_number(unsigned int i) const { + id_of_my_supporting_line = i; + } #endif - private: //(some useful functions) +private: //(some useful functions) - bool begin_less_xy_than_end() const { - if(flags.begin_less_xy_than_end == 0) { - if(compare_xy(_begin, _end) < 0) - flags.begin_less_xy_than_end = 2; - else flags.begin_less_xy_than_end = 1; - } return flags.begin_less_xy_than_end == 2; - } + bool begin_less_xy_than_end() const { + if(flags.begin_less_xy_than_end == 0) { + if(compare_xy(_begin, _end) < 0) + flags.begin_less_xy_than_end = 2; + else flags.begin_less_xy_than_end = 1; + } return flags.begin_less_xy_than_end == 2; + } - public : +public : #ifdef CGAL_INTERSECTION_MAP_FOR_SUPPORTING_CIRCLES - template < class T > - static bool find_intersection_circle_line( - const Circular_arc_2& c, - const Line_arc_2& l, - T& res) { - if(c.id_of_my_supporting_circle == 0) return false; - return Circular_arc_2::circle_table.template find(c.id_of_my_supporting_circle, - l.id_of_my_supporting_line, - res); - } + template < class T > + static bool find_intersection_circle_line( + const Circular_arc_2& c, + const Line_arc_2_base& l, + T& res) { + if(c.id_of_my_supporting_circle == 0) return false; + return Circular_arc_2::circle_table.template find(c.id_of_my_supporting_circle, + l.id_of_my_supporting_line, + res); + } - template < class T > - static void put_intersection_circle_line(const Circular_arc_2& c, - const Line_arc_2& l, - const T& res) { - Circular_arc_2::circle_table.template put(c.circle_number(), - l.line_number(), - res); - } + template < class T > + static void put_intersection_circle_line(const Circular_arc_2& c, + const Line_arc_2_base& l, + const T& res) { + Circular_arc_2::circle_table.template put(c.circle_number(), + l.line_number(), + res); + } #endif - const Line_2 & supporting_line() const - { - return _support; - } + const Line_2 & supporting_line() const + { + return _support; + } - const Circular_arc_point_2 & left() const - { - return begin_less_xy_than_end() ? _begin : _end; - } + const Circular_arc_point_2 & left() const + { + return begin_less_xy_than_end() ? _begin : _end; + } - const Circular_arc_point_2 & right() const - { - return begin_less_xy_than_end() ? _end : _begin; - } + const Circular_arc_point_2 & right() const + { + return begin_less_xy_than_end() ? _end : _begin; + } - const Circular_arc_point_2 & source() const - { - return _begin; - } + const Circular_arc_point_2 & source() const + { + return _begin; + } - const Circular_arc_point_2 & target() const - { - return _end; - } + const Circular_arc_point_2 & target() const + { + return _end; + } - bool is_vertical() const - { - return supporting_line().is_vertical(); - } + bool is_vertical() const + { + return supporting_line().is_vertical(); + } - CGAL::Bbox_2 bbox() const - { - return _begin.bbox() + _end.bbox(); - } + CGAL::Bbox_2 bbox() const + { + return _begin.bbox() + _end.bbox(); + } + +}; // end class Line_arc_2_base + +template +class Filtered_bbox_line_arc_2_base : public Line_arc_2_base { + typedef Filtered_bbox_line_arc_2_base Self; + typedef Line_arc_2_base P_arc; + +public: + + typedef typename P_arc::Point_2 Point_2; + typedef typename P_arc::Line_2 Line_2; + typedef typename P_arc::Segment_2 Segment_2; + typedef typename P_arc::Circle_2 Circle_2; + typedef typename P_arc::Circular_arc_point_2 Circular_arc_point_2; + + Filtered_bbox_line_arc_2_base() : P_arc(), bb(NULL) {} + + Filtered_bbox_line_arc_2_base(const Line_2 &support, + const Circle_2 &l1, const bool b_l1, + const Circle_2 &l2, const bool b_l2) + : P_arc(support,l1,b_l1,l2,b_l2), bb(NULL) + {} + + + Filtered_bbox_line_arc_2_base(const Line_2 &support, + const Line_2 &l1, + const Line_2 &l2) + : P_arc(support,l1,l2), bb(NULL) + {} + + Filtered_bbox_line_arc_2_base(const Line_2 &support, + const Circular_arc_point_2 &begin, + const Circular_arc_point_2 &end) + : P_arc(support, begin, end) , bb(NULL) + {} + + + Filtered_bbox_line_arc_2_base(const Segment_2 &s) + : P_arc(s) , bb(NULL) + {} + + + Filtered_bbox_line_arc_2_base(const Point_2 &p1, + const Point_2 &p2) + : P_arc(p1,p2) , bb(NULL) + {} - }; - /* template < typename CK > */ + Filtered_bbox_line_arc_2_base(const Filtered_bbox_line_arc_2_base &c) + : P_arc(c), bb(c.bb ? new Bbox_2(*(c.bb)) : NULL) + {} + + Filtered_bbox_line_arc_2_base& operator=(const Self& c) + { + if(this != &c) + { + this->P_arc::operator=(c); + bb = c.bb ? new Bbox_2(*(c.bb)) : NULL; + } + return *this; + } + + ~Filtered_bbox_line_arc_2_base() { if(bb) delete bb; } + + Bbox_2 bbox() const + { + if(bb==NULL) + bb=new Bbox_2(P_arc::bbox()); + return *bb; + } + + bool has_no_bbox() const + { return (bb==NULL);} + +private: + + mutable Bbox_2 *bb; + +}; // end class Filtered_bbox_line_arc_2_base + +/* template < typename CK > */ /* std::ostream & */ -/* operator<<(std::ostream & os, const Line_arc_2 &a) */ +/* operator<<(std::ostream & os, const Line_arc_2_base &a) */ /* { */ /* return os << a.supporting_line() << " " */ @@ -277,19 +357,19 @@ namespace internal { /* template < typename CK > */ /* std::istream & */ -/* operator>>(std::istream & is, Line_arc_2 &a) */ +/* operator>>(std::istream & is, Line_arc_2_base &a) */ /* { */ /* typename CK::Line_2 l; */ /* typename CK::Circular_arc_point_2 p1; */ /* typename CK::Circular_arc_point_2 p2; */ /* is >> l >> p1 >> p2 ; */ /* if (is) */ -/* a = Line_arc_2(l, p1, p2); */ +/* a = Line_arc_2_base(l, p1, p2); */ /* return is; */ /* } */ - } // namespace internal +} // namespace internal } // namespace CGAL #endif // CGAL_CIRCULAR_KERNEL_LINE_ARC_2_H diff --git a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2.h b/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2.h index 98f72703228..a5895c7bd2b 100644 --- a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2.h +++ b/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2.h @@ -38,10 +38,10 @@ template < class FilteredBboxKernel, class CircularKernel > struct Filtered_bbox_circular_kernel_base_ref_count : public CircularKernel { - typedef CGAL::Circular_arc_2 Circular_arc_2; - typedef CGAL::Line_arc_2 Line_arc_2; - typedef CGAL::Circular_arc_point_2 Circular_arc_point_2; - + typedef internal::Filtered_bbox_circular_arc_2_base Circular_arc_2; + typedef internal::Filtered_bbox_line_arc_2_base Line_arc_2; + typedef internal::Filtered_bbox_circular_arc_point_2_base Circular_arc_point_2; + // The mechanism that allows to specify reference-counting or not. template < typename T > struct Handle { typedef Handle_for type; }; diff --git a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_predicates.h b/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_predicates.h index 8860041b362..56a160671b0 100644 --- a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_predicates.h +++ b/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_predicates.h @@ -36,577 +36,323 @@ namespace CGAL { namespace Bbox_functors { template -class Compare_x_2 : public BK::Circular_kernel::Compare_x_2 +class Compare_x_2 : public CircularFunctors::Compare_x_2 +{ + typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename BK::Point_2 Point_2; + typedef CircularFunctors::Compare_x_2 CK_Compare_x_2; + +public: + + typedef typename CK_Compare_x_2::result_type result_type; + + result_type + operator() (const Point_2 &p0, + const Point_2 &p1) const { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename BK::Point_2 Point_2; - typedef typename CK::Compare_x_2 CK_Compare_x_2; - - public: - - typedef typename CK::Compare_x_2::result_type result_type; - - result_type - operator() (const Point_2 &p0, - const Point_2 &p1) const - { - return CK_Compare_x_2()(p0, p1); - } + return CK_Compare_x_2()(p0, p1); + } #ifndef CGAL_CFG_MATCHING_BUG_6 - using CK::Compare_x_2::operator(); + using CK_Compare_x_2::operator(); #else - typedef typename CK::Line_2 Line_2; + typedef typename BK::Line_2 Line_2; - result_type - operator() (const Point_2 &p0, - const Line_2 &p1, - const Line_2 &p2) const - { - return CK_Compare_x_2()(p0, p1,p2); - } + result_type + operator() (const Point_2 &p0, + const Line_2 &p1, + const Line_2 &p2) const + { + return CK_Compare_x_2()(p0, p1,p2); + } - result_type - operator() (const Line_2 &p0, - const Line_2 &p1, - const Line_2 &p2) const - { - return CK_Compare_x_2()(p0, p1,p2); - } + result_type + operator() (const Line_2 &p0, + const Line_2 &p1, + const Line_2 &p2) const + { + return CK_Compare_x_2()(p0, p1,p2); + } - result_type - operator() (const Line_2 &p0, - const Line_2 &p1, - const Line_2 &p2, - const Line_2 &p3) const - { - return CK_Compare_x_2()(p0, p1,p2,p3); - } + result_type + operator() (const Line_2 &p0, + const Line_2 &p1, + const Line_2 &p2, + const Line_2 &p3) const + { + return CK_Compare_x_2()(p0, p1,p2,p3); + } #endif - result_type - operator()( const Circular_arc_point_2 &a, const Circular_arc_point_2 &b) const - { - Bbox_2 bb1=a.bbox(),bb2=b.bbox(); - - if( bb1.xmin()>bb2.xmax() ) - return LARGER; - - if( bb1.xmax() -class Compare_y_2 : public BK::Circular_kernel::Compare_y_2 + result_type + operator()( const Circular_arc_point_2 &a, const Circular_arc_point_2 &b) const { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename BK::Point_2 Point_2; - typedef typename CK::Compare_y_2 CK_Compare_y_2; + Bbox_2 bb1=a.bbox(),bb2=b.bbox(); - public: + if( bb1.xmin()>bb2.xmax() ) + return LARGER; - typedef typename CK::Compare_y_2::result_type result_type; + if( bb1.xmax()bb2.ymax() ) - return LARGER; - - if( bb1.ymax() -class Compare_xy_2 : public BK::Circular_kernel::Compare_xy_2 - { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename BK::Point_2 Point_2; - - public: - - typedef typename CK::Compare_xy_2::result_type result_type; - using CK::Compare_xy_2::operator(); - - public: - - result_type - operator()( const Point_2 &a, const Point_2 &b) const - { - return CK().compare_xy_2_object()(a,b); - } - - result_type - operator()( const Circular_arc_point_2 &a, const Circular_arc_point_2 &b) const - { - typename BK::Compare_x_2 compx; - typename BK::Compare_y_2 compy; - Comparison_result tmp; - - if( (tmp=compx(a,b))!=EQUAL) - return tmp; - - return compy(a,b); - } - - }; - - -template -class In_x_range_2 : public BK::Circular_kernel::In_x_range_2 - { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename BK::Circular_arc_2 Circular_arc_2; - typedef typename BK::Line_arc_2 Line_arc_2; - - public: - - typedef typename CK::In_x_range_2::result_type result_type; - using CK::In_x_range_2::operator(); - - private: - - template - result_type - _in_x_range_2(const Arc_2 &a, const Circular_arc_point_2 &p) const - { - - Bbox_2 bb11 = a.source().bbox(), - bb12 = a.target().bbox(), - bb2=p.bbox(); - if(bb11.xmin() > bb12.xmax()) { - if(bb2.xmax() < bb12.xmin()) return false; - else if(bb2.xmin() > bb11.xmax()) return false; - else if(bb12.xmax() < bb2.xmin() && - bb2.xmax() < bb11.xmin()) return true; - } else if(bb11.xmax() < bb12.xmin()) { - if(bb2.xmax() < bb11.xmin()) return false; - else if(bb2.xmin() > bb12.xmax()) return false; - else if(bb11.xmax() < bb2.xmin() && - bb2.xmax() < bb12.xmin()) return true; - } else { - if(bb2.xmin() > (std::max)(bb11.xmax(),bb12.xmax())) return false; - if(bb2.xmax() < (std::min)(bb11.xmin(),bb12.xmin())) return false; - } - - typename CK::In_x_range_2 Range; - - return Range(a.arc(),p.point()); - - } - - public: - - result_type - operator()( const Circular_arc_2 &a, const Circular_arc_point_2 &p) const - { - CGAL_precondition( a.arc().is_x_monotone()); - return _in_x_range_2(a,p); - } - - result_type - operator()( const Line_arc_2 &a, const Circular_arc_point_2 &p) const - { return _in_x_range_2(a,p);} - - - }; - - - -template < class BK > - class Construct_line_arc_2 - { - - typedef typename BK::Point_2 Point_2; - typedef typename BK::Line_2 Line_2; - typedef typename BK::Circle_2 Circle_2; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename BK::Segment_2 Segment_2; - typedef typename BK::Line_arc_2 Line_arc_2; - - public: - typedef Line_arc_2 result_type; - - result_type - operator()(void) - { return Line_arc_2(); } - - result_type - operator()(const Line_2 &support, - const Circle_2 &c1,const bool b1, - const Circle_2 &c2,const bool b2) const - { return Line_arc_2(support,c1,b1,c2,b2); } - - result_type - operator()(const Line_2 &support, - const Line_2 &l1, - const Line_2 &l2) const - { return Line_arc_2(support,l1,l2); } - - result_type - operator()(const Line_2 &support, - const Circular_arc_point_2 &p1, - const Circular_arc_point_2 &p2) const - { return Line_arc_2(support,p1,p2); } - - result_type - operator()(const Segment_2 &s) const - { return Line_arc_2(s); } - - result_type - operator()(const Point_2 &p1, - const Point_2 &p2) const - { return Line_arc_2(p1,p2); } - - }; - - - - template < class BK > - class Construct_circular_arc_2 - { - - typedef typename BK::FT FT; - typedef typename BK::RT RT; - typedef typename BK::Point_2 Point_2; - typedef typename BK::Line_2 Line_2; - typedef typename BK::Circle_2 Circle_2; - typedef typename BK::Circular_arc_2 Circular_arc_2; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - - public: - typedef Circular_arc_2 result_type; - - result_type - operator()(void) - { return Circular_arc_2(); } - - result_type - operator()(const Circle_2 &c) const - { return Circular_arc_2(c); } - - result_type - operator()(const Circle_2 &support, - const Circular_arc_point_2 &source, - const Circular_arc_point_2 &target) const - { return Circular_arc_2(support,source,target); } - - result_type - operator()(const Circle_2 &support, - const Line_2 &l1, bool b1, - const Line_2 &l2, bool b2) const - { return Circular_arc_2(support,l1,b1,l2,b2); } - - result_type - operator()(const Circle_2 &c, - const Circle_2 &c1, bool b_1, - const Circle_2 &c2, bool b_2) const - { return Circular_arc_2(c,c1,b_1,c2,b_2); } - - result_type - operator()(const Circular_arc_2 &A, - bool b, - const Circle_2 &ccut, bool b_cut) const - { return Circular_arc_2(A,b,ccut,b_cut); } - - result_type - operator()(const Point_2 &begin, - const Point_2 &middle, - const Point_2 &end) const - { return Circular_arc_2(begin,middle,end); } - - result_type - operator()(const Point_2 &begin, - const Point_2 &end, - const FT& bulge) const - { return Circular_arc_2(begin,end,bulge); } - - }; - - template < class BK > - class Construct_circular_arc_point_2 - { - typedef typename BK::Point_2 Point_2; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename Circular_arc_point_2::Root_for_circles_2_2 - Root_for_circles_2_2; - - public: - typedef Circular_arc_point_2 result_type; - - result_type - operator()(void) - { return Circular_arc_point_2(); } - - result_type - operator()(const Root_for_circles_2_2 & np) const - { return Circular_arc_point_2(np); } - - result_type - operator()(const Point_2 & p) const - { return Circular_arc_point_2(p); } - - }; - -template -class Construct_circular_source_vertex_2 - { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename BK::Circular_arc_2 Circular_arc_2; - typedef typename BK::Line_arc_2 Line_arc_2; - - public: - - typedef Circular_arc_point_2 result_type; - typedef const result_type & qualified_result_type; - - result_type - operator()(const Circular_arc_2& a) const - { return CK().construct_circular_source_vertex_2_object()(a.arc()); } - - result_type - operator()(const Line_arc_2& a) const - { return CK().construct_circular_source_vertex_2_object()(a.arc()); } - - }; - - -template -class Construct_circular_target_vertex_2 - { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename BK::Circular_arc_2 Circular_arc_2; - typedef typename BK::Line_arc_2 Line_arc_2; - - public: - - typedef Circular_arc_point_2 result_type; - typedef const result_type & qualified_result_type; - - result_type - operator()(const Circular_arc_2& a) const - { return CK().construct_circular_target_vertex_2_object()(a.arc()); } - - result_type - operator()(const Line_arc_2& a) const - { return CK().construct_circular_target_vertex_2_object()(a.arc()); } - - }; - - - -template -class Construct_circular_min_vertex_2 - { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename BK::Circular_arc_2 Circular_arc_2; - typedef typename BK::Line_arc_2 Line_arc_2; - - public: - - typedef Circular_arc_point_2 result_type; - - result_type - operator()(const Circular_arc_2& a) const - { return CK().construct_circular_min_vertex_2_object()(a.arc()); } - - result_type - operator()(const Line_arc_2& a) const - { return CK().construct_circular_min_vertex_2_object()(a.arc()); } - - }; - -template -class Construct_circular_max_vertex_2 - { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename BK::Circular_arc_2 Circular_arc_2; - typedef typename BK::Line_arc_2 Line_arc_2; - - public: - - typedef Circular_arc_point_2 result_type; - - result_type - operator()(const Circular_arc_2& a) const - { return CK().construct_circular_max_vertex_2_object()(a.arc()); } - - result_type - operator()(const Line_arc_2& a) const - { return CK().construct_circular_max_vertex_2_object()(a.arc()); } - - }; - -template -class Is_vertical_2 : public BK::Circular_kernel::Is_vertical_2 - { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename BK::Circular_arc_2 Circular_arc_2; - typedef typename BK::Line_arc_2 Line_arc_2; - - public: - - typedef typename CK::Is_vertical_2::result_type result_type; - using CK::Is_vertical_2::operator(); - - result_type - operator()(const Circular_arc_2& a) const - { return CK().is_vertical_2_object()(a.arc()); } - - result_type - operator()(const Line_arc_2& a) const - { return CK().is_vertical_2_object()(a.arc()); } - - }; - -template -class Compare_y_at_x_2 : public BK::Circular_kernel::Compare_y_at_x_2 - { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_2 Circular_arc_2; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename BK::Line_arc_2 Line_arc_2; - - public: - - typedef typename CK::Compare_y_at_x_2::result_type result_type; - using CK::Compare_y_at_x_2::operator(); - - private: - - template - result_type - _compare_y_at_x_2(const Circular_arc_point_2 &p,const Arc_2 &a) const - { - CGAL_precondition_code(bool tmp=In_x_range_2()(a,p)); - CGAL_precondition(tmp ); - - Bbox_2 bb1=a.bbox(),bb2=p.bbox(); - - if(bb1.ymin()>bb2.ymax()) - return SMALLER; - else if(bb1.ymax() -class Has_on_2 : public BK::Circular_kernel::Has_on_2 +class Compare_y_2 : public CircularFunctors::Compare_y_2 +{ + typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename BK::Point_2 Point_2; + typedef CircularFunctors::Compare_y_2 CK_Compare_y_2; + +public: + + typedef typename CK_Compare_y_2::result_type result_type; + + result_type + operator() (const Point_2 &p0, + const Point_2 &p1) const { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_2 Circular_arc_2; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename BK::Line_arc_2 Line_arc_2; + return CK_Compare_y_2()(p0, p1); + } - public: +#ifndef CGAL_CFG_MATCHING_BUG_6 + using CK_Compare_y_2::operator(); +#else + typedef typename BK::Line_2 Line_2; - typedef typename CK::Has_on_2::result_type result_type; - using CK::Has_on_2::operator(); + result_type + operator() (const Point_2 &p0, + const Line_2 &p1, + const Line_2 &p2) const + { + return CK_Compare_y_2()(p0, p1,p2); + } - private: + result_type + operator() (const Line_2 &p0, + const Line_2 &p1, + const Line_2 &p2) const + { + return CK_Compare_y_2()(p0, p1,p2); + } - template - result_type - _has_on_2(const Arc_2 &a, const Circular_arc_point_2 &p) const - { - Bbox_2 bb1=a.bbox(),bb2=p.bbox(); + result_type + operator() (const Line_2 &p0, + const Line_2 &p1, + const Line_2 &p2, + const Line_2 &p3) const + { + return CK_Compare_y_2()(p0, p1,p2,p3); + } +#endif + + result_type + operator()( const Circular_arc_point_2 &a, const Circular_arc_point_2 &b) const + { + Bbox_2 bb1=a.bbox(),bb2=b.bbox(); - if(do_overlap(bb1,bb2)) - return CK().has_on_2_object()(a.arc(),p.point()); - return false; + if( bb1.ymin()>bb2.ymax() ) + return LARGER; + + if( bb1.ymax() +class Compare_xy_2 : public CircularFunctors::Compare_xy_2 +{ + typedef CircularFunctors::Compare_xy_2 CK_Compare_xy_2; + typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename BK::Point_2 Point_2; + +public: + + typedef typename CK_Compare_xy_2::result_type result_type; + using CK_Compare_xy_2::operator(); + +public: + + result_type + operator()( const Point_2 &a, const Point_2 &b) const + { + return CK_Compare_xy_2()(a,b); + } + + result_type + operator()( const Circular_arc_point_2 &a, const Circular_arc_point_2 &b) const + { + typename BK::Compare_x_2 compx; + typename BK::Compare_y_2 compy; + Comparison_result tmp; + + if( (tmp=compx(a,b))!=EQUAL) + return tmp; + + return compy(a,b); + } + +}; + + +template +class In_x_range_2 : public CircularFunctors::In_x_range_2 +{ + typedef CircularFunctors::In_x_range_2 CK_In_x_range_2; + typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename BK::Circular_arc_2 Circular_arc_2; + typedef typename BK::Line_arc_2 Line_arc_2; + +public: + + typedef typename CK_In_x_range_2::result_type result_type; + using CK_In_x_range_2::operator(); + +private: + + template + result_type + _in_x_range_2(const Arc_2 &a, const Circular_arc_point_2 &p) const + { + + Bbox_2 bb11 = a.source().bbox(), + bb12 = a.target().bbox(), + bb2=p.bbox(); + if(bb11.xmin() > bb12.xmax()) { + if(bb2.xmax() < bb12.xmin()) return false; + else if(bb2.xmin() > bb11.xmax()) return false; + else if(bb12.xmax() < bb2.xmin() && + bb2.xmax() < bb11.xmin()) return true; + } else if(bb11.xmax() < bb12.xmin()) { + if(bb2.xmax() < bb11.xmin()) return false; + else if(bb2.xmin() > bb12.xmax()) return false; + else if(bb11.xmax() < bb2.xmin() && + bb2.xmax() < bb12.xmin()) return true; + } else { + if(bb2.xmin() > (std::max)(bb11.xmax(),bb12.xmax())) return false; + if(bb2.xmax() < (std::min)(bb11.xmin(),bb12.xmin())) return false; } + + CK_In_x_range_2 Range; - public: + return Range(a,p); - result_type - operator()( const Circular_arc_2 &a,const Circular_arc_point_2 &p ) const - { - CGAL_precondition( a.arc().is_x_monotone()); - return _has_on_2(a,p); - } + } - result_type - operator()( const Line_arc_2 &a, const Circular_arc_point_2 &p ) const - {return _has_on_2(a,p);} +public: + + result_type + operator()( const Circular_arc_2 &a, const Circular_arc_point_2 &p) const + { + CGAL_precondition( a.is_x_monotone()); + return _in_x_range_2(a,p); + } + + result_type + operator()( const Line_arc_2 &a, const Circular_arc_point_2 &p) const + { return _in_x_range_2(a,p);} + + +}; + + +template +class Compare_y_at_x_2 : public CircularFunctors::Compare_y_at_x_2 +{ + typedef CircularFunctors::Compare_y_at_x_2 CK_Compare_y_at_x_2; + typedef typename BK::Circular_arc_2 Circular_arc_2; + typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename BK::Line_arc_2 Line_arc_2; + +public: + + typedef typename CK_Compare_y_at_x_2::result_type result_type; + using CK_Compare_y_at_x_2::operator(); + +private: + + template + result_type + _compare_y_at_x_2(const Circular_arc_point_2 &p,const Arc_2 &a) const + { + CGAL_precondition_code(bool tmp=In_x_range_2()(a,p)); + CGAL_precondition(tmp ); + + Bbox_2 bb1=a.bbox(),bb2=p.bbox(); + + if(bb1.ymin()>bb2.ymax()) + return SMALLER; + else if(bb1.ymax() +class Has_on_2 : public CircularFunctors::Has_on_2 +{ + typedef CircularFunctors::Has_on_2 CK_Has_on_2; + typedef typename BK::Circular_arc_2 Circular_arc_2; + typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename BK::Line_arc_2 Line_arc_2; + +public: + + typedef typename CK_Has_on_2::result_type result_type; + using CK_Has_on_2::operator(); + +private: + + template + result_type + _has_on_2(const Arc_2 &a, const Circular_arc_point_2 &p) const + { + Bbox_2 bb1=a.bbox(),bb2=p.bbox(); + + if(do_overlap(bb1,bb2)) + return CK_Has_on_2()(a,p); + + return false; + } + +public: + + result_type + operator()( const Circular_arc_2 &a,const Circular_arc_point_2 &p ) const + { + CGAL_precondition( a.is_x_monotone()); + return _has_on_2(a,p); + } + + result_type + operator()( const Line_arc_2 &a, const Circular_arc_point_2 &p ) const + {return _has_on_2(a,p);} }; @@ -614,769 +360,368 @@ class Has_on_2 : public BK::Circular_kernel::Has_on_2 template class Equal_2 #ifndef CGAL_CFG_MATCHING_BUG_6 - : public BK::Circular_kernel::Equal_2 + : public CircularFunctors::Equal_2 #endif - { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_2 Circular_arc_2; - typedef typename BK::Point_2 Point_2; - typedef typename BK::Direction_2 Direction_2; - typedef typename BK::Vector_2 Vector_2; - typedef typename BK::Segment_2 Segment_2 ; - typedef typename BK::Ray_2 Ray_2; - typedef typename BK::Line_2 Line_2; - typedef typename BK::Circle_2 Circle_2; - typedef typename BK::Triangle_2 Triangle_2; - typedef typename BK::Iso_rectangle_2 Iso_rectangle_2; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename BK::Line_arc_2 Line_arc_2; +{ + typedef CircularFunctors::Equal_2 CK_Equal_2; + typedef typename BK::Circular_arc_2 Circular_arc_2; + typedef typename BK::Point_2 Point_2; + typedef typename BK::Direction_2 Direction_2; + typedef typename BK::Vector_2 Vector_2; + typedef typename BK::Segment_2 Segment_2 ; + typedef typename BK::Ray_2 Ray_2; + typedef typename BK::Line_2 Line_2; + typedef typename BK::Circle_2 Circle_2; + typedef typename BK::Triangle_2 Triangle_2; + typedef typename BK::Iso_rectangle_2 Iso_rectangle_2; + typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename BK::Line_arc_2 Line_arc_2; - public: +public: - typedef typename CK::Equal_2::result_type result_type; + typedef typename CK_Equal_2::result_type result_type; - typedef typename CK::Equal_2 CK_Equal_2; - result_type - operator() (const Point_2 &p0, - const Point_2 &p1) const - { return CK_Equal_2()(p0,p1); } + result_type + operator() (const Point_2 &p0, + const Point_2 &p1) const + { return CK_Equal_2()(p0,p1); } #ifndef CGAL_CFG_MATCHING_BUG_6 - using CK::Equal_2::operator(); + using CK_Equal_2::operator(); #else - result_type - operator() (const Vector_2 &p0, - const Vector_2 &p1) const - { return CK_Equal_2()(p0,p1); } + result_type + operator() (const Vector_2 &p0, + const Vector_2 &p1) const + { return CK_Equal_2()(p0,p1); } - result_type - operator() (const Vector_2 &p0, - const Null_vector &p1) const - { return CK_Equal_2()(p0,p1); } + result_type + operator() (const Vector_2 &p0, + const Null_vector &p1) const + { return CK_Equal_2()(p0,p1); } - result_type - operator() (const Null_vector &p0, - const Vector_2 &p1) const - { return CK_Equal_2()(p0,p1); } + result_type + operator() (const Null_vector &p0, + const Vector_2 &p1) const + { return CK_Equal_2()(p0,p1); } - result_type - operator() (const Direction_2 &p0, - const Direction_2 &p1) const - { return CK_Equal_2()(p0,p1); } + result_type + operator() (const Direction_2 &p0, + const Direction_2 &p1) const + { return CK_Equal_2()(p0,p1); } - result_type - operator() (const Segment_2 &p0, - const Segment_2 &p1) const - { return CK_Equal_2()(p0,p1); } + result_type + operator() (const Segment_2 &p0, + const Segment_2 &p1) const + { return CK_Equal_2()(p0,p1); } - result_type - operator() (const Ray_2 &p0, - const Ray_2 &p1) const - { return CK_Equal_2()(p0,p1); } + result_type + operator() (const Ray_2 &p0, + const Ray_2 &p1) const + { return CK_Equal_2()(p0,p1); } - result_type - operator() (const Line_2 &p0, - const Line_2 &p1) const - { return CK_Equal_2()(p0,p1); } + result_type + operator() (const Line_2 &p0, + const Line_2 &p1) const + { return CK_Equal_2()(p0,p1); } - result_type - operator() (const Triangle_2 &p0, - const Triangle_2 &p1) const - { return CK_Equal_2()(p0,p1); } + result_type + operator() (const Triangle_2 &p0, + const Triangle_2 &p1) const + { return CK_Equal_2()(p0,p1); } - result_type - operator() (const Iso_rectangle_2 &p0, - const Iso_rectangle_2 &p1) const - { return CK_Equal_2()(p0,p1); } + result_type + operator() (const Iso_rectangle_2 &p0, + const Iso_rectangle_2 &p1) const + { return CK_Equal_2()(p0,p1); } - result_type - operator() (const Circle_2 &p0, - const Circle_2 &p1) const - { return CK_Equal_2()(p0,p1); } + result_type + operator() (const Circle_2 &p0, + const Circle_2 &p1) const + { return CK_Equal_2()(p0,p1); } #endif - private: +private: - template - result_type - _equal_2(const Arc_2 &a,const Arc_2 &b) const - { - Bbox_2 bb11=a.source().bbox(), - bb12=a.target().bbox(), - bb21=b.source().bbox(), - bb22=b.target().bbox(); + template + result_type + _equal_2(const Arc_2 &a,const Arc_2 &b) const + { + Bbox_2 bb11=a.source().bbox(), + bb12=a.target().bbox(), + bb21=b.source().bbox(), + bb22=b.target().bbox(); - if(bb11.xmin() > bb21.xmax()) return false; - if(bb11.xmax() < bb21.xmin()) return false; - if(bb11.ymin() > bb21.ymax()) return false; - if(bb11.ymax() < bb21.ymin()) return false; + if(bb11.xmin() > bb21.xmax()) return false; + if(bb11.xmax() < bb21.xmin()) return false; + if(bb11.ymin() > bb21.ymax()) return false; + if(bb11.ymax() < bb21.ymin()) return false; - if(bb12.xmin() > bb22.xmax()) return false; - if(bb12.xmax() < bb22.xmin()) return false; - if(bb12.ymin() > bb22.ymax()) return false; - if(bb12.ymax() < bb22.ymin()) return false; + if(bb12.xmin() > bb22.xmax()) return false; + if(bb12.xmax() < bb22.xmin()) return false; + if(bb12.ymin() > bb22.ymax()) return false; + if(bb12.ymax() < bb22.ymin()) return false; - return CK().equal_2_object()( a.arc(),b.arc() ); + return CK_Equal_2()( a,b ); - } + } - public: +public: - result_type - operator()( const Circular_arc_point_2 &a , - const Circular_arc_point_2 &b) const - { - Bbox_2 bb1=a.bbox(),bb2=b.bbox(); - if(bb1.xmin() > bb2.xmax()) return false; - if(bb1.xmax() < bb2.xmin()) return false; - if(bb1.ymin() > bb2.ymax()) return false; - if(bb1.ymax() < bb2.ymin()) return false; - return CK().equal_2_object()( a.point(),b.point() ); - } + result_type + operator()( const Circular_arc_point_2 &a , + const Circular_arc_point_2 &b) const + { + Bbox_2 bb1=a.bbox(),bb2=b.bbox(); + if(bb1.xmin() > bb2.xmax()) return false; + if(bb1.xmax() < bb2.xmin()) return false; + if(bb1.ymin() > bb2.ymax()) return false; + if(bb1.ymax() < bb2.ymin()) return false; + return CK_Equal_2()( a,b ); + } - /* WAS THAT HERE FOR OTHER COMPILERS THAN VC* ??? - // redefine to solve ambiguous call error - result_type - operator()( const Point_2 &a , - const Point_2 &b) const - { - return CK().equal_2_object()( a, b); - } - */ - result_type - operator()( const Circular_arc_2 &a , const Circular_arc_2 &b ) const - { - CGAL_precondition( a.arc().is_x_monotone()); - CGAL_precondition( b.arc().is_x_monotone()); + /* WAS THAT HERE FOR OTHER COMPILERS THAN VC* ??? + // redefine to solve ambiguous call error + result_type + operator()( const Point_2 &a , + const Point_2 &b) const + { + return CK_Equal_2()( a, b); + } + */ + result_type + operator()( const Circular_arc_2 &a , const Circular_arc_2 &b ) const + { + CGAL_precondition( a.is_x_monotone()); + CGAL_precondition( b.is_x_monotone()); - return _equal_2(a,b); - } + return _equal_2(a,b); + } - result_type - operator()( const Line_arc_2 &a , - const Line_arc_2 &b ) const - { return _equal_2(a,b);} + result_type + operator()( const Line_arc_2 &a , + const Line_arc_2 &b ) const + { return _equal_2(a,b);} - result_type - operator()( const Circular_arc_2 &a , - const Line_arc_2 &b ) const - { return false;} + result_type + operator()( const Circular_arc_2 &a , + const Line_arc_2 &b ) const + { return false;} - result_type - operator()( const Line_arc_2 &a , - const Circular_arc_2 &b ) const - { return false;} + result_type + operator()( const Line_arc_2 &a , + const Circular_arc_2 &b ) const + { return false;} }; template -class Do_overlap_2 : public BK::Circular_kernel::Do_overlap_2 +class Do_overlap_2 : public CircularFunctors::Do_overlap_2 +{ + typedef CircularFunctors::Do_overlap_2 CK_Do_overlap_2; + typedef typename BK::Circular_arc_2 Circular_arc_2; + typedef typename BK::Line_arc_2 Line_arc_2; + +public: + + typedef typename CK_Do_overlap_2::result_type result_type; + using CK_Do_overlap_2::operator(); + +private: + + template + result_type + _do_overlap_2(const Arc_2 &a, const Arc_2 &b) const { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_2 Circular_arc_2; - typedef typename BK::Line_arc_2 Line_arc_2; + Bbox_2 bb1=a.bbox(),bb2=b.bbox(); - public: - - typedef typename CK::Do_overlap_2::result_type result_type; - using CK::Do_overlap_2::operator(); - - private: - - template - result_type - _do_overlap_2(const Arc_2 &a, const Arc_2 &b) const - { - Bbox_2 bb1=a.bbox(),bb2=b.bbox(); - - if(do_overlap(bb1,bb2)) - return CK().do_overlap_2_object()(a.arc(),b.arc()); + if(do_overlap(bb1,bb2)) + return CK_Do_overlap_2()(a,b); - return false; - } + return false; + } - public: +public: - result_type - operator()( const Circular_arc_2 &a , const Circular_arc_2 &b ) const - { - CGAL_precondition( a.arc().is_x_monotone()); - CGAL_precondition( b.arc().is_x_monotone()); - return _do_overlap_2(a,b); - } + result_type + operator()( const Circular_arc_2 &a , const Circular_arc_2 &b ) const + { + CGAL_precondition( a.is_x_monotone()); + CGAL_precondition( b.is_x_monotone()); + return _do_overlap_2(a,b); + } - result_type - operator()( const Line_arc_2 &a , - const Line_arc_2 &b ) const - { return _do_overlap_2(a,b);} + result_type + operator()( const Line_arc_2 &a , + const Line_arc_2 &b ) const + { return _do_overlap_2(a,b);} - result_type - operator()( const Circular_arc_2 &a , - const Line_arc_2 &b ) const - { return false;} + result_type + operator()( const Circular_arc_2 &a , + const Line_arc_2 &b ) const + { return false;} - result_type - operator()( const Line_arc_2 &a , - const Circular_arc_2 &b ) const - { return false;} + result_type + operator()( const Line_arc_2 &a , + const Circular_arc_2 &b ) const + { return false;} }; -// This predicate cannot be filtered +template < class BK > +class Intersect_2 : public CircularFunctors::Intersect_2 +{ +public: + typedef CircularFunctors::Intersect_2 CK_Intersect_2; - template < class BK > - class Compare_y_to_right_2 : public BK::Circular_kernel::Compare_y_to_right_2 + typedef typename BK::Circular_arc_2 Circular_arc_2; + typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename BK::Line_arc_2 Line_arc_2; + typedef typename BK::Circle_2 Circle; + typedef typename BK::Line_2 Line_2; + + typedef typename CK_Intersect_2::result_type result_type; + using CK_Intersect_2::operator(); + + template < class OutputIterator > + OutputIterator + operator()(const Line_2 & c1, const Circle & c2, OutputIterator res) { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_2 Circular_arc_2; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - - public: - typedef typename CK::Compare_y_to_right_2::result_type result_type; - using CK::Compare_y_to_right_2::operator(); - - template - result_type - operator()(const T1 &a1, - const T2 &a2, - const Circular_arc_point_2 &p) const - { return CK().compare_y_to_right_2_object()(a1.arc(), a2.arc(), p.point()); } - - }; - - - template < class BK > - class Make_x_monotone_2 : public BK::Circular_kernel::Make_x_monotone_2 + return CK_Intersect_2()(c1,c2,res); + } + + template < class OutputIterator > + OutputIterator + operator()(const Circle & c1, const Line_2 & c2, OutputIterator res) { - typedef typename BK::Circular_kernel CK; - typedef typename CK::Circular_arc_2 Rcirc_arc_2; - typedef typename BK::Circular_arc_2 Circular_arc_2; - typedef typename BK::Line_arc_2 Line_arc_2; + return CK_Intersect_2()(c1,c2,res); + } - public: - typedef typename CK::Make_x_monotone_2::result_type result_type; - using CK::Make_x_monotone_2::operator(); - - template < class OutputIterator > - OutputIterator - operator()(const Circular_arc_2 &A, OutputIterator res) - { - std::vector vec; - - CK().make_x_monotone_2_object()(A.arc(), std::back_inserter(vec) ); - - for(unsigned i=0; i(&vec.at(i)); - CGAL_assertion(tmp_arc!=NULL); - *res++ = make_object( Circular_arc_2(*tmp_arc) ); - } - - return res; - } - - template < class OutputIterator > - OutputIterator - operator()(const Line_arc_2 &A, OutputIterator res) - { - *res++ = make_object(A); - return res; - } - }; - - template < class BK > - class Do_intersect_2 : public BK::Circular_kernel::Do_intersect_2 + template < class OutputIterator > + OutputIterator + operator()(const Line_arc_2 & c1, const Circle & c2, OutputIterator res) { - public: - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_2 Circular_arc_2; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename BK::Line_arc_2 Line_arc_2; - typedef typename CK::Circular_arc_2 Rcirc_arc_2; - typedef typename CK::Line_arc_2 Rline_arc_2; - typedef typename CK::Circular_arc_point_2 Rcirc_arc_point_2; - typedef typename BK::Circle_2 Circle_2; - typedef typename BK::Line_2 Line_2; + if(!do_overlap(c1.bbox(),c2.bbox())) + return res; - typedef typename CK::Do_intersect_2::result_type result_type; - using CK::Do_intersect_2::operator(); + return CK_Intersect_2()(c1,c2,res); + } - result_type - operator()(const Circular_arc_2 & c1, const Circular_arc_2 & c2) { - return CK().do_intersect_2_object()(c1.arc(), c2.arc()); - } - - result_type - operator()(const Line_arc_2 & c1, const Line_arc_2 & c2) { - return CK().do_intersect_2_object()(c1.arc(), c2.arc()); - } - - result_type - operator()(const Line_arc_2 & c1, const Circle_2 & c2) { - return CK().do_intersect_2_object()(c1.arc(), c2); - } - - result_type - operator()(const Circle_2 & c1, const Line_arc_2 & c2) { - return CK().do_intersect_2_object()(c1, c2.arc()); - } - - result_type - operator()(const Circular_arc_2 & c1, const Circle_2 & c2) { - return CK().do_intersect_2_object()(c1.arc(), c2); - } - - result_type - operator()(const Circle_2 & c1, const Circular_arc_2 & c2) { - return CK().do_intersect_2_object()(c1, c2.arc()); - } - - result_type - operator()(const Line_arc_2 & c1, const Circular_arc_2 & c2) { - return CK().do_intersect_2_object()(c1.arc(), c2.arc()); - } - - result_type - operator()(const Circular_arc_2 & c1, const Line_arc_2 & c2) { - return CK().do_intersect_2_object()(c1.arc(), c2.arc()); - } - - result_type - operator()(const Line_2 & c1, const Line_arc_2 & c2) { - return CK().do_intersect_2_object()(c1, c2.arc()); - } - - result_type - operator()(const Line_arc_2 & c1, const Line_2 & c2) { - return CK().do_intersect_2_object()(c1.arc(), c2); - } - - result_type - operator()(const Line_2 & c1, const Circular_arc_2 & c2) { - return CK().do_intersect_2_object()(c1, c2.arc()); - } - - result_type - operator()(const Circular_arc_2 & c1, const Line_2 & c2) { - return CK().do_intersect_2_object()(c1.arc(), c2); - } - - result_type - operator()(const Line_2 & c1, const Circle_2 & c2) { - return CK().do_intersect_2_object()(c1, c2); - } - - result_type - operator()(const Circle_2 & c1, const Line_2 & c2) { - return CK().do_intersect_2_object()(c1, c2); - } - - }; - - template < class BK > - class Intersect_2 : public BK::Circular_kernel::Intersect_2 + template < class OutputIterator > + OutputIterator + operator()(const Circle & c1, const Line_arc_2 & c2, OutputIterator res) { - public: + if(!do_overlap(c1.bbox(),c2.bbox())) + return res; + return CK_Intersect_2()(c1,c2,res); + } - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_2 Circular_arc_2; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename BK::Line_arc_2 Line_arc_2; - typedef typename CK::Circular_arc_2 Rcirc_arc_2; - typedef typename CK::Line_arc_2 Rline_arc_2; - typedef typename CK::Circular_arc_point_2 Rcirc_arc_point_2; - typedef typename BK::Circle_2 Circle; - typedef typename BK::Line_2 Line_2; + template < class OutputIterator > + OutputIterator + operator()(const Line_2 & c1, const Circular_arc_2 & c2, + OutputIterator res) + { + return CK_Intersect_2()(c1,c2,res); + } - typedef typename CK::Intersect_2::result_type result_type; - using CK::Intersect_2::operator(); + template < class OutputIterator > + OutputIterator + operator()(const Line_2 & c1, const Line_arc_2 & c2, + OutputIterator res) + { + return CK_Intersect_2()(c1,c2,res); + } - template < class OutputIterator > - OutputIterator - operator()(const Line_2 & c1, const Circle & c2, OutputIterator res) - { - std::vector vec; - - CK().intersect_2_object()(c1,c2,std::back_inserter(vec)); + template < class OutputIterator > + OutputIterator + operator()(const Circle & c1, const Circle & c2, OutputIterator res) + { + if(!do_overlap(c1.bbox(),c2.bbox())) + return res; - for(unsigned i=0; i *tmp_point; + return CK_Intersect_2()(c1,c2,res); + } - if ( (tmp_point=object_cast >(&vec.at(i)))!=NULL ) - *res++ = make_object( std::make_pair(Circular_arc_point_2(tmp_point->first),tmp_point->second)); - else - *res++=vec.at(i); - } + template < class OutputIterator > + OutputIterator + operator()(const Circle & c1, const Circular_arc_2 & c2, OutputIterator res) + { + return operator()(Circular_arc(c1),c2,res); + } - return res; - } + template < class OutputIterator > + OutputIterator + operator()(const Circular_arc_2 & c1, const Circle & c2, OutputIterator res) + { + return operator()(c1,Circular_arc_2(c2),res); + } + + template < class OutputIterator > + OutputIterator + operator()(const Circular_arc_2 & c1, const Circular_arc_2 & c2, + OutputIterator res) + { + Bbox_2 bb1=c1.bbox(),bb2=c2.bbox(); + + if(!do_overlap(bb1,bb2 )) + return res; - template < class OutputIterator > - OutputIterator - operator()(const Circle & c1, const Line_2 & c2, OutputIterator res) - { - std::vector vec; - - CK().intersect_2_object()(c1,c2,std::back_inserter(vec)); + return CK_Intersect_2()(c1,c2,res); + } - for(unsigned i=0; i *tmp_point; + template < class OutputIterator > + OutputIterator + operator()(const Line_arc_2 & c1, const Line_arc_2 & c2, + OutputIterator res) + { + Bbox_2 bb1=c1.bbox(),bb2=c2.bbox(); - if ( (tmp_point=object_cast >(&vec.at(i)))!=NULL ) - *res++ = make_object( std::make_pair(Circular_arc_point_2(tmp_point->first),tmp_point->second)); - else - *res++=vec.at(i); - } + if(!do_overlap(bb1,bb2 )) + return res; - return res; - } + return CK_Intersect_2()(c1,c2,res); + } - template < class OutputIterator > - OutputIterator - operator()(const Line_arc_2 & c1, const Circle & c2, OutputIterator res) - { - if(!do_overlap(c1.bbox(),c2.bbox())) - return res; + template < class OutputIterator > + OutputIterator + operator()(const Circular_arc_2 & c1, const Line_arc_2 & c2, + OutputIterator res) + { + Bbox_2 bb1=c1.bbox(),bb2=c2.bbox(); - std::vector vec; - - CK().intersect_2_object()(c1.arc(),c2,std::back_inserter(vec)); + if(!do_overlap(bb1,bb2 )) + return res; - for(unsigned i=0; i *tmp_point; + return CK_Intersect_2()(c1,c2,res); + } - if ( (tmp_point=object_cast >(&vec.at(i)))!=NULL ) - *res++ = make_object( std::make_pair(Circular_arc_point_2(tmp_point->first),tmp_point->second)); - else - *res++=vec.at(i); - } + template < class OutputIterator > + OutputIterator + operator()(const Line_arc_2 & c1, const Circular_arc_2 & c2, + OutputIterator res) + { return operator()(c2,c1,res);} - return res; - } + template < class OutputIterator > + OutputIterator + operator()(const Circular_arc_2 & c1, const Line_2 & c2, + OutputIterator res) + { return operator()(c2,c1,res);} - template < class OutputIterator > - OutputIterator - operator()(const Circle & c1, const Line_arc_2 & c2, OutputIterator res) - { - if(!do_overlap(c1.bbox(),c2.bbox())) - return res; - - std::vector vec; - - CK().intersect_2_object()(c1,c2.arc(),std::back_inserter(vec)); - - for(unsigned i=0; i *tmp_point; - - if ( (tmp_point=object_cast >(&vec.at(i)))!=NULL ) - *res++ = make_object( std::make_pair(Circular_arc_point_2(tmp_point->first),tmp_point->second)); - else - *res++=vec.at(i); - } - - return res; - } - - template < class OutputIterator > - OutputIterator - operator()(const Line_2 & c1, const Circular_arc_2 & c2, - OutputIterator res) - { - std::vector vec; - - CK().intersect_2_object()(c1,c2.arc(),std::back_inserter(vec)); - - for(unsigned i=0; i *tmp_point; - - if ( (tmp_point=object_cast >(&vec.at(i)))!=NULL ) - *res++ = make_object( std::make_pair(Circular_arc_point_2(tmp_point->first),tmp_point->second)); - else - *res++=vec.at(i); - } - - return res; - } - - template < class OutputIterator > - OutputIterator - operator()(const Line_2 & c1, const Line_arc_2 & c2, - OutputIterator res) - { - std::vector vec; - - CK().intersect_2_object()(c1,c2,std::back_inserter(vec)); - - for(unsigned i=0; i *tmp_point; - - if ( (tmp_point=object_cast >(&vec.at(i)))!=NULL ) - *res++ = make_object( std::make_pair(Circular_arc_point_2(tmp_point->first),tmp_point->second)); - else - *res++=vec.at(i); - } - - return res; - } - - template < class OutputIterator > - OutputIterator - operator()(const Circle & c1, const Circle & c2, OutputIterator res) - { - if(!do_overlap(c1.bbox(),c2.bbox())) - return res; - - std::vector vec; - - CK().intersect_2_object()(c1,c2,std::back_inserter(vec)); - - for(unsigned i=0; i *tmp_point; - - if ( (tmp_point=object_cast >(&vec.at(i)))!=NULL ) - *res++ = make_object( std::make_pair(Circular_arc_point_2(tmp_point->first),tmp_point->second)); - else - *res++=vec.at(i); - } - - return res; - } - - template < class OutputIterator > - OutputIterator - operator()(const Circle & c1, const Circular_arc_2 & c2, OutputIterator res) - { - return operator()(Circular_arc(c1),c2,res); - } - - template < class OutputIterator > - OutputIterator - operator()(const Circular_arc_2 & c1, const Circle & c2, OutputIterator res) - { - return operator()(c1,Circular_arc_2(c2),res); - } - - template < class OutputIterator > - OutputIterator - operator()(const Circular_arc_2 & c1, const Circular_arc_2 & c2, - OutputIterator res) - { - Bbox_2 bb1=c1.bbox(),bb2=c2.bbox(); - - if(!do_overlap(bb1,bb2 )) - return res; - - std::vector vec; - - CK().intersect_2_object()(c1.arc(),c2.arc(),std::back_inserter(vec)); - - for(unsigned i=0; i(&vec.at(i)) )!=NULL ) - *res++ = make_object( Circular_arc_2(*tmp_arc) ); - else - { - const std::pair *tmp_point; - tmp_point=object_cast >(&vec.at(i)); - CGAL_assertion(tmp_point!=NULL); - *res++ = make_object( std::make_pair(Circular_arc_point_2(tmp_point->first),tmp_point->second)); - } - - } - - return res; - - - } - - template < class OutputIterator > - OutputIterator - operator()(const Line_arc_2 & c1, const Line_arc_2 & c2, - OutputIterator res) - { - Bbox_2 bb1=c1.bbox(),bb2=c2.bbox(); - - if(!do_overlap(bb1,bb2 )) - return res; - - std::vector vec; - - CK().intersect_2_object()(c1.arc(),c2.arc(),std::back_inserter(vec)); - - for(unsigned i=0; i(&vec.at(i)) )!=NULL ) - *res++ = make_object( Line_arc_2(*tmp_arc) ); - else - { - const std::pair *tmp_point; - tmp_point=object_cast >(&vec.at(i)); - CGAL_assertion(tmp_point!=NULL); - *res++ = make_object( std::make_pair(Circular_arc_point_2(tmp_point->first),tmp_point->second)); - } - } - return res; - } - - template < class OutputIterator > - OutputIterator - operator()(const Circular_arc_2 & c1, const Line_arc_2 & c2, - OutputIterator res) - { - Bbox_2 bb1=c1.bbox(),bb2=c2.bbox(); - - if(!do_overlap(bb1,bb2 )) - return res; - - std::vector vec; - - CK().intersect_2_object()(c1.arc(),c2.arc(),std::back_inserter(vec)); - - for(unsigned i=0; i(&vec.at(i)) )!=NULL ) // Can this happen? - *res++ = make_object( Circular_arc_2(*tmp_arc) ); - else if ( (tmp_line=object_cast(&vec.at(i)) )!=NULL ) //Can this happen? - *res++ = make_object( Line_arc_2(*tmp_line) ); - else - { - const std::pair *tmp_point; - tmp_point=object_cast >(&vec.at(i)); - CGAL_assertion(tmp_point!=NULL); - *res++ = make_object( std::make_pair(Circular_arc_point_2(tmp_point->first),tmp_point->second)); - } - - } - - return res; - - } - - template < class OutputIterator > - OutputIterator - operator()(const Line_arc_2 & c1, const Circular_arc_2 & c2, - OutputIterator res) - { return operator()(c2,c1,res);} - - template < class OutputIterator > - OutputIterator - operator()(const Circular_arc_2 & c1, const Line_2 & c2, - OutputIterator res) - { return operator()(c2,c1,res);} - - template < class OutputIterator > - OutputIterator - operator()(const Line_arc_2 & c1, const Line_2 & c2, - OutputIterator res) - { return operator()(c2,c1,res);} + template < class OutputIterator > + OutputIterator + operator()(const Line_arc_2 & c1, const Line_2 & c2, + OutputIterator res) + { return operator()(c2,c1,res);} - }; - - - template < class BK > - class Split_2 : public BK::Circular_kernel::Split_2 - { - - typedef typename BK::Circular_kernel CK; - typedef typename CK::Circular_arc_2 Rcirc_arc_2; - typedef typename CK::Line_arc_2 Rline_arc_2; - typedef typename BK::Circular_arc_2 Circular_arc_2; - typedef typename BK::Line_arc_2 Line_arc_2; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - - public: - typedef typename CK::Split_2::result_type result_type; - using CK::Split_2::operator(); - - result_type - operator()(const Circular_arc_2 &A, - const Circular_arc_point_2 &p, - Circular_arc_2 &ha1, Circular_arc_2 &ha2) const - { - Rcirc_arc_2 ca1 , ca2; - - CK().split_2_object()(A.arc(), p.point(), ca1, ca2); - - ha1=Circular_arc_2(ca1); - ha2=Circular_arc_2(ca2); - } - - result_type - operator()(const Line_arc_2 &A, - const Circular_arc_point_2 &p, - Line_arc_2 &ha1, Line_arc_2 &ha2) const - { - Rline_arc_2 ca1 , ca2; - - CK().split_2_object()(A.arc(), p.point(), ca1, ca2); - - ha1=Line_arc_2(ca1); - ha2=Line_arc_2(ca2); - } - - }; - -template -class Construct_bbox_2 : public BK::Circular_kernel::Construct_bbox_2 - { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_2 Circular_arc_2; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename BK::Point_2 Point_2; - typedef typename BK::Line_arc_2 Line_arc_2; - - public: - - typedef typename CK::Construct_bbox_2::result_type result_type; - using CK::Construct_bbox_2::operator(); - - // redefine to avoid ambiguity - result_type operator() (const Point_2 & a) const - { - return CK().construct_bbox_2_object()(a); - } - - result_type operator() (const Circular_arc_point_2 & a) const - { - return a.rep().bbox(); - } - - result_type operator() (const Circular_arc_2 & a) const - { - return a.rep().bbox(); - } - - result_type operator() (const Line_arc_2 & a) const - { - return a.rep().bbox(); - } - - }; - +}; } //Bbox_functors diff --git a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/interface_macros.h b/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/interface_macros.h index 2c87c9f3926..e75a66efece 100644 --- a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/interface_macros.h +++ b/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/interface_macros.h @@ -37,35 +37,12 @@ CGAL_Filtered_Bbox_Circular_Kernel_pred(Compare_xy_2, compare_xy_2_object) CGAL_Filtered_Bbox_Circular_Kernel_pred(Has_on_2, has_on_2_object) CGAL_Filtered_Bbox_Circular_Kernel_pred(Compare_y_at_x_2, compare_y_at_x_2_object) - CGAL_Filtered_Bbox_Circular_Kernel_pred(Compare_y_to_right_2, compare_y_to_right_2_object) CGAL_Filtered_Bbox_Circular_Kernel_pred(Do_overlap_2, do_overlap_2_object) CGAL_Filtered_Bbox_Circular_Kernel_pred(Equal_2, equal_2_object) CGAL_Filtered_Bbox_Circular_Kernel_pred(In_x_range_2, in_x_range_2_object) - CGAL_Filtered_Bbox_Circular_Kernel_pred(Do_intersect_2, do_intersect_2_object) - CGAL_Filtered_Bbox_Circular_Kernel_pred(Is_vertical_2, is_vertical_2_object) - CGAL_Filtered_Bbox_Circular_Kernel_cons(Construct_line_arc_2, - construct_line_arc_2_object_object) - CGAL_Filtered_Bbox_Circular_Kernel_cons(Construct_circular_arc_2, - construct_circular_arc_2_object_object) - CGAL_Filtered_Bbox_Circular_Kernel_cons(Construct_circular_source_vertex_2, - construct_circular_source_vertex_2_object) - CGAL_Filtered_Bbox_Circular_Kernel_cons(Construct_circular_target_vertex_2, - construct_circular_target_vertex_2_object) - CGAL_Filtered_Bbox_Circular_Kernel_cons(Construct_circular_min_vertex_2, - construct_circular_min_vertex_2_object) - CGAL_Filtered_Bbox_Circular_Kernel_cons(Construct_circular_max_vertex_2, - construct_circular_max_vertex_2_object) - CGAL_Filtered_Bbox_Circular_Kernel_cons(Make_x_monotone_2, - make_x_monotone_2_object) CGAL_Filtered_Bbox_Circular_Kernel_cons(Intersect_2, intersect_2_object) - CGAL_Filtered_Bbox_Circular_Kernel_cons(Split_2, - split_2_object) - CGAL_Filtered_Bbox_Circular_Kernel_cons(Construct_bbox_2, - construct_bbox_2_object) - CGAL_Filtered_Bbox_Circular_Kernel_cons(Construct_circular_arc_point_2, - construct_circular_arc_point_2_object) #undef CGAL_Filtered_Bbox_Circular_Kernel_pred #undef CGAL_Filtered_Bbox_Circular_Kernel_cons diff --git a/Circular_kernel_2/include/CGAL/Line_arc_2.h b/Circular_kernel_2/include/CGAL/Line_arc_2.h index 15969dcf6ec..61695eeb745 100644 --- a/Circular_kernel_2/include/CGAL/Line_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Line_arc_2.h @@ -185,143 +185,6 @@ operator!=(const Line_arc_2 &p, return is; } -template < class CK > -struct Filtered_bbox_circular_kernel_2; - -template < typename CK > -class Line_arc_2 < Filtered_bbox_circular_kernel_2 < CK > > { - - typedef Filtered_bbox_circular_kernel_2 < CK > BK; - typedef Line_arc_2< BK > Self; - typedef typename CK::FT FT; - typedef typename CK::RT RT; - typedef typename CK::Point_2 Point_2; - typedef typename BK::Line_2 Line_2; - typedef typename CK::Segment_2 Segment_2; - typedef typename CK::Circle_2 Circle_2; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Line_arc_2 Rline_arc_2; - typedef typename CK::Root_of_2 Root_of_2; - - -public: - typedef BK R; - typedef Line_arc_2 Rep; - - const Rep& rep() const - { - return *this; - } - - Rep& rep() - { - return *this; - } - - ///////////Construction///////////// - - Line_arc_2(){} - - Line_arc_2(const Line_2 &support, - const Circle_2 &l1, const bool b_l1, - const Circle_2 &l2, const bool b_l2) - : P_arc(support,l1,b_l1,l2,b_l2), bb(NULL) - {} - - - Line_arc_2(const Line_2 &support, - const Line_2 &l1, - const Line_2 &l2) - : P_arc(support,l1,l2), bb(NULL) - {} - - Line_arc_2(const Line_2 &support, - const Circular_arc_point_2 &begin, - const Circular_arc_point_2 &end) - : P_arc(support, begin.point(), end.point()) , bb(NULL) - {} - - - Line_arc_2(const Segment_2 &s) - : P_arc(s) , bb(NULL) - {} - - - Line_arc_2(const Point_2 &p1, - const Point_2 &p2) - : P_arc(p1,p2) , bb(NULL) - {} - - - Line_arc_2(const Rline_arc_2 &a) - : P_arc(a) , bb(NULL) - {} - - Line_arc_2(const Line_arc_2 &c) : P_arc(c.P_arc) - { - if(c.bb) bb = new Bbox_2(*(c.bb)); - else bb = NULL; - } - - ~Line_arc_2() { if(bb) delete bb; } - - - //////////Predicates////////// - - bool is_vertical() const - { return P_arc.is_vertical();} - - //////////Accessors/////////// - - const Rline_arc_2& arc () const - { return P_arc ;} - - ///Interface of the inner arc/// - - typename Qualified_result_of::type - left() const - {return typename BK::Construct_circular_min_vertex_2()(*this);} - - typename Qualified_result_of::type - right() const - {return typename BK::Construct_circular_max_vertex_2()(*this);} - - typename Qualified_result_of::type - source() const - {return typename BK::Construct_circular_source_vertex_2()(*this);} - - typename Qualified_result_of::type - target() const - {return typename BK::Construct_circular_target_vertex_2()(*this);} - - Line_2 - supporting_line() const - { return P_arc.supporting_line();} - - Bbox_2 bbox() const - { - if(bb==NULL) - bb=new Bbox_2(P_arc.bbox()); - return *bb; - } - - - ///Specific check used for bbox construction/// - - bool has_no_bbox() const - { return (bb==NULL);} - - bool equal_ref(const Line_arc_2 &c) const - { - return CGAL::identical(P_arc, c.P_arc); - } - - private: - - Rline_arc_2 P_arc; - mutable Bbox_2 *bb; - -}; } //namespace CGAL