diff --git a/.gitattributes b/.gitattributes index 00376e67d0c..d05ba2c01d5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1276,7 +1276,6 @@ Circular_kernel_2/demo/Circular_kernel_2/help/trash.jpeg -text svneol=unset#imag Circular_kernel_2/doc_tex/Circular_kernel_2/fig/Boolean_operation.png -text Circular_kernel_2/doc_tex/Circular_kernel_2/fig/Boolean_operation_detail.png -text Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h -text -Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_intersections.h -text Circular_kernel_3/demo/Circular_kernel_3/images/button_axis.gif -text svneol=unset#image/gif Circular_kernel_3/demo/Circular_kernel_3/images/button_light.gif -text svneol=unset#image/gif Circular_kernel_3/demo/Circular_kernel_3/images/button_line.gif -text svneol=unset#image/gif diff --git a/Circular_kernel_2/examples/Circular_kernel_2/intersecting_arcs.cpp b/Circular_kernel_2/examples/Circular_kernel_2/intersecting_arcs.cpp index e9beb36aea7..2c68c41e11c 100644 --- a/Circular_kernel_2/examples/Circular_kernel_2/intersecting_arcs.cpp +++ b/Circular_kernel_2/examples/Circular_kernel_2/intersecting_arcs.cpp @@ -1,18 +1,7 @@ -#include -#include - -#include -#include -#include - -#include - +#include #include -typedef CGAL::Quotient NT; -typedef CGAL::Cartesian Linear_k; -typedef CGAL::Algebraic_kernel_for_circles_2_2 Algebraic_k; -typedef CGAL::Circular_kernel_2 Circular_k; +typedef CGAL::Exact_circular_kernel_2 Circular_k; typedef CGAL::Point_2 Point_2; typedef CGAL::Circle_2 Circle_2; diff --git a/Circular_kernel_2/include/CGAL/Circular_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_arc_2.h index 890ed26f3c8..d986dca398e 100644 --- a/Circular_kernel_2/include/CGAL/Circular_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_arc_2.h @@ -25,7 +25,7 @@ #ifndef CGAL_CIRCULAR_ARC_2_H #define CGAL_CIRCULAR_ARC_2_H -namespace CGAL { +CGAL_BEGIN_NAMESPACE template class Circular_arc_2 @@ -183,6 +183,24 @@ public: }; + template < typename CircularKernel > + inline + bool + operator==(const Circular_arc_2 &p, + const Circular_arc_2 &q) + { + return CircularKernel().equal_2_object()(p, q); + } + + template < typename CircularKernel > + inline + bool + operator!=(const Circular_arc_2 &p, + const Circular_arc_2 &q) + { + return ! (p == q); + } + template < typename CK > std::ostream & operator<<(std::ostream & os, const Circular_arc_2 &a) @@ -211,6 +229,153 @@ public: return is; } -} // namespace CGAL +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 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 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; + typedef CK R; + +public: + + ///////////Construction///////////// + + Circular_arc_2(){} + + 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), 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); + } + + const Circle_2& supporting_circle() const + { return P_arc.supporting_circle();} + + const Point_2& center() const + { return P_arc.center();} + + const 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);} + + private: + + Rcircular_arc_2 P_arc; + mutable Bbox_2 *bb; + + +}; + + + +CGAL_END_NAMESPACE #endif // CGAL_CIRCULAR_ARC_2_H 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 197f0cee077..0d9cbf0c16e 100644 --- a/Circular_kernel_2/include/CGAL/Circular_arc_point_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_arc_point_2.h @@ -25,7 +25,7 @@ #ifndef CGAL_CIRCULAR_ARC_POINT_2_H #define CGAL_CIRCULAR_ARC_POINT_2_H -namespace CGAL { +CGAL_BEGIN_NAMESPACE template < typename CircularKernel > class Circular_arc_point_2 @@ -133,7 +133,77 @@ 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 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_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 CK R; + + ////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 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), 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//// -} // namespace CGAL +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: + + Rcircular_arc_point_2 P_point; + mutable Bbox_2 *bb; + +}; + +CGAL_END_NAMESPACE #endif // CGAL_CIRCULAR_ARC_POINT_2_H diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2.h index 7c3c40ba84d..48816190558 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2.h @@ -40,20 +40,33 @@ #include -namespace CGAL { +CGAL_BEGIN_NAMESPACE + namespace CGALi { -template < class CircularKernel, class LinearKernelBase > +template < class CircularKernel, class LinearKernelBase, class AlgebraicKernel > struct Circular_kernel_base_ref_count: public LinearKernelBase { typedef CGALi::Circular_arc_2 Circular_arc_2; typedef CGALi::Circular_arc_point_2 Circular_arc_point_2; typedef CGALi::Line_arc_2 Line_arc_2; + typedef LinearKernelBase Linear_kernel; + typedef AlgebraicKernel Algebraic_kernel; + typedef typename Algebraic_kernel::Root_of_2 Root_of_2; + typedef typename Algebraic_kernel::Root_for_circles_2_2 Root_for_circles_2_2; + typedef typename Algebraic_kernel::Polynomial_for_circles_2_2 + Polynomial_for_circles_2_2; + typedef typename Algebraic_kernel::Polynomial_1_2 Polynomial_1_2; + typedef typename Linear_kernel::RT RT; + typedef typename Linear_kernel::FT FT; // The mecanism that allows to specify reference-counting or not. template < typename T > struct Handle { typedef Handle_for type; }; - + + template < typename Kernel2 > + struct Base { typedef Circular_kernel_base_ref_count Type; }; + #define CGAL_Circular_Kernel_pred(Y,Z) \ typedef CircularFunctors::Y Y; \ Y Z() const { return Y(); } @@ -71,37 +84,13 @@ struct Circular_kernel_2 CGALi::Circular_kernel_base_ref_count < Circular_kernel_2, typename LinearKernel:: template - Base >::Type + Base >::Type, + AlgebraicKernel >, - Circular_kernel_2 + Circular_kernel_2 > -{ - typedef Circular_kernel_2 Self; +{}; - typedef typename LinearKernel::template - Base >::Type Linear_kernel; - typedef AlgebraicKernel Algebraic_kernel; - - // for Lazy hexagons/bbox kernels - // Please remove this if you consider it to be sloppy - struct Circular_tag{}; - typedef Circular_tag Definition_tag; - // - - typedef typename LinearKernel::RT RT; - typedef typename LinearKernel::FT FT; - - typedef typename Algebraic_kernel::Root_of_2 Root_of_2; - typedef typename Algebraic_kernel::Root_for_circles_2_2 Root_for_circles_2_2; - typedef typename Algebraic_kernel::Polynomial_for_circles_2_2 - Polynomial_for_circles_2_2; - typedef typename Algebraic_kernel::Polynomial_1_2 Polynomial_1_2; - -// typedef CGAL::Object Object_2; -// typedef CGAL::Object Object_3; - -}; - -} // namespace CGAL +CGAL_END_NAMESPACE #endif // CGAL_CIRCULAR_KERNEL_2_H diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h index 9aee997edcc..f5cab4c314f 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h @@ -573,6 +573,18 @@ template < class CK > operator()(const Circle & c1, const Circle & c2, OutputIterator res) const { return CircularFunctors::intersect_2 (c1,c2,res); } + template < class OutputIterator > + OutputIterator + operator()(const Circle & c1, const Circular_arc & c2, + OutputIterator res) const + { return CircularFunctors::intersect_2 (Circular_arc(c1),c2,res); } + + template < class OutputIterator > + OutputIterator + operator()(const Circular_arc & c1, const Circle & c2, + OutputIterator res) const + { return CircularFunctors::intersect_2 (c1,Circular_arc(c2),res); } + template < class OutputIterator > OutputIterator operator()(const Circular_arc & c1, const Circular_arc & c2, @@ -1165,29 +1177,6 @@ template < class CK > }; - template - class Collinear_2 - : public CK::Linear_kernel::Collinear_2 - { - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - - public: - typedef typename CK::Linear_kernel::Collinear_2::result_type result_type; - - using CK::Linear_kernel::Collinear_2::operator(); - - // PRE CONDITION: - // The coordinates of P, Q, R have to have the same - // delta or (beta == 0 || delta == 0) - // We cannot code this pre condition because - // if Root_of_2 is interval_nt "beta", "delta" mean nothing - result_type - operator()(const Circular_arc_point_2& p, - const Circular_arc_point_2& q, - const Circular_arc_point_2& r) const - { return orientation(p,q,r) == COLLINEAR; } - }; - } // namespace CircularFunctors } // namespace CGAL diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/interface_macros.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/interface_macros.h index 4b7ddd00baf..32d8e17828e 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/interface_macros.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/interface_macros.h @@ -98,7 +98,6 @@ CGAL_Circular_Kernel_pred(Has_on_bounded_side_2, has_on_bounded_side_2_object) CGAL_Circular_Kernel_pred(Has_on_unbounded_side_2, has_on_unbounded_side_2_object) CGAL_Circular_Kernel_pred(Bounded_side_2, bounded_side_2_object) - CGAL_Circular_Kernel_pred(Collinear_2, collinear_2_object) CGAL_Circular_Kernel_pred(Do_intersect_2, do_intersect_2_object) CGAL_Circular_Kernel_cons(Construct_supporting_circle_2, diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h b/Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h index 1b24ec62d22..819215f6d47 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h @@ -73,6 +73,8 @@ CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Circular_arc_2, Circula CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Line_arc_2, Line_arc_2) CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Line_arc_2, Circle_2) CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Circle_2, Line_arc_2) +CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Circular_arc_2, Circle_2) +CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Circle_2, Circular_arc_2) CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Line_arc_2, Circular_arc_2) CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Circular_arc_2, Line_arc_2) CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_(Line_2, Circular_arc_2) 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 ce4d7d8fd56..396a2ad8459 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 @@ -25,147 +25,75 @@ #ifndef CGAL_FILTERED_BBOX_CIRCULAR_KERNEL_2_H #define CGAL_FILTERED_BBOX_CIRCULAR_KERNEL_2_H -#include -#include -#include +#include +#include +#include #include CGAL_BEGIN_NAMESPACE -template - class Filtered_bbox_circular_kernel_2 : public CK { +namespace CGALi { - public: - - typedef Filtered_bbox_circular_kernel_2 Self; - typedef Circular_arc_with_bbox_2 Circular_arc_2; - typedef Line_arc_with_bbox_2 Line_arc_2; - typedef Circular_arc_point_with_bbox_2 Circular_arc_point_2; - typedef CK Circular_kernel; - typedef typename CK::Algebraic_kernel Algebraic_kernel; - typedef typename CK::RT RT; - typedef typename CK::FT FT; - typedef typename CK::Root_of_2 Root_of_2; - typedef typename CK::Root_for_circles_2_2 Root_for_circles_2_2; -// typedef typename CK::Polynomial_for_circles_2_2 Polynomial_for_circles_2_2; -// typedef typename CK::Polynomial_1_2 Polynomial_1_2; - typedef typename CK::Line_2 Line_2; - typedef typename CK::Circle_2 Circle_2; - typedef typename CK::Conic_2 Conic_2; - typedef typename CK::Point_2 Point_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 CK::Construct_circle_2 Construct_circle_2; - typedef typename CK::Get_equation Get_equation; - typedef typename CK::Compute_Circular_x_2 Compute_Circular_x_2; - typedef typename CK::Compute_Circular_y_2 Compute_Circular_y_2; - - - typedef Bbox_functors::Construct_line_arc_2 Construct_line_arc_2; - typedef Bbox_functors::Construct_circular_arc_2 Construct_circular_arc_2; - - typedef Bbox_functors::Construct_circular_source_vertex_2 Construct_circular_source_vertex_2; - typedef Bbox_functors::Construct_circular_target_vertex_2 Construct_circular_target_vertex_2; - typedef Bbox_functors::Compare_x_2 Compare_x_2; - typedef Bbox_functors::Compare_y_2 Compare_y_2; - typedef Bbox_functors::Compare_xy_2 Compare_xy_2; - typedef Bbox_functors::Has_on_2 Has_on_2; - typedef Bbox_functors::Construct_circular_min_vertex_2 Construct_circular_min_vertex_2; - typedef Bbox_functors::Construct_circular_max_vertex_2 Construct_circular_max_vertex_2; - typedef Bbox_functors::Compare_y_at_x_2 Compare_y_at_x_2; - typedef Bbox_functors::Compare_y_to_right_2 Compare_y_to_right_2; - typedef Bbox_functors::Do_overlap_2 Do_overlap_2; - typedef Bbox_functors::Equal_2 Equal_2; - typedef Bbox_functors::In_x_range_2 In_x_range_2; - typedef Bbox_functors::Make_x_monotone_2 Make_x_monotone_2; - typedef Bbox_functors::Do_intersect_2 Do_intersect_2; - typedef Bbox_functors::Intersect_2 Intersect_2; - typedef Bbox_functors::Split_2 Split_2; - typedef Bbox_functors::Is_vertical_2 Is_vertical_2; - - - - Get_equation - get_equation_object() const - { return CK().get_equation_object(); } - - Construct_circle_2 - construct_circle_2_object() const - { return CK().construct_circle_2_object(); } - - Compare_x_2 - compare_x_2_object() const - { return Compare_x_2(); } - - Compare_y_2 - compare_y_2_object() const - { return Compare_y_2(); } - - Compare_xy_2 - compare_xy_2_object() const - { return Compare_xy_2(); } - - Has_on_2 - has_on_2_object() const - { return Has_on_2(); } - - Construct_circular_source_vertex_2 - construct_circular_source_vertex_2_object() const - { return Construct_circular_source_vertex_2(); } - - Construct_circular_target_vertex_2 - construct_circular_target_vertex_2_object() const - { return Construct_circular_target_vertex_2(); } - - Construct_circular_min_vertex_2 - construct_circular_min_vertex_2_object() const - { return Construct_circular_min_vertex_2(); } - - Construct_circular_max_vertex_2 - construct_circular_max_vertex_2_object() const - { return Construct_circular_max_vertex_2(); } - - Compare_y_at_x_2 - compare_y_at_x_2_object() const - { return Compare_y_at_x_2(); } - - Compare_y_to_right_2 - compare_y_to_right_2_object() const - { return Compare_y_to_right_2(); } - - Do_overlap_2 - do_overlap_2_object() const - { return Do_overlap_2(); } - - Equal_2 - equal_2_object() const - { return Equal_2(); } - - In_x_range_2 - in_x_range_2_object() const - { return In_x_range_2(); } - - Make_x_monotone_2 - make_x_monotone_2_object() const - { return Make_x_monotone_2(); } - - Intersect_2 - intersect_2_object() const - { return Intersect_2(); } - - - Split_2 - split_2_object() const - { return Split_2(); } - - Is_vertical_2 - is_vertical_2_object() const - { return Is_vertical_2(); } +template < class FilteredBboxKernel, class CircularKernel > +struct Filtered_bbox_circular_kernel_base_ref_count : public CircularKernel +{ - Do_intersect_2 - do_intersect_2_object() const - { return Do_intersect_2(); } + 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; + + // The mecanism that allows to specify reference-counting or not. + template < typename T > + struct Handle { typedef Handle_for type; }; + + template < typename Kernel2 > + struct Base { typedef Filtered_bbox_circular_kernel_base_ref_count Type; }; + + template < typename T > + struct Ambient_dimension { + typedef typename T::Ambient_dimension type; + }; + + template < typename T > + struct Feature_dimension { + typedef typename T::Feature_dimension type; + }; + + #define CGAL_Filtered_Bbox_Circular_Kernel_pred(Y,Z) \ + typedef Bbox_functors::Y< FilteredBboxKernel > Y; \ + Y Z() const { return Y(); } + #define CGAL_Filtered_Bbox_Circular_Kernel_cons(Y,Z) CGAL_Filtered_Bbox_Circular_Kernel_pred(Y,Z) + + #include + +}; + +} // namespace CGALi + +template < typename K_base, typename Kernel > +struct Filtered_bbox_circular_kernel_type_equality_wrapper + : public Type_equality_wrapper +{ + typedef K_base Kernel_base; + 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; +}; + +template < class CircularKernel > +struct Filtered_bbox_circular_kernel_2 + : public Filtered_bbox_circular_kernel_type_equality_wrapper +< + CGALi::Filtered_bbox_circular_kernel_base_ref_count + < Filtered_bbox_circular_kernel_2< CircularKernel >, + typename CircularKernel:: template + Base >::Type + >, + Filtered_bbox_circular_kernel_2< CircularKernel > +> +{ + typedef CircularKernel Circular_kernel; + typedef Filtered_bbox_circular_kernel_2< CircularKernel > Self; }; CGAL_END_NAMESPACE diff --git a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/Circular_arc_endpoint_with_bbox_2.h b/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/Circular_arc_endpoint_with_bbox_2.h deleted file mode 100644 index 0370e6e5369..00000000000 --- a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/Circular_arc_endpoint_with_bbox_2.h +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// Author(s) : Monique Teillaud, Sylvain Pion, Constantinos Tsirogiannis , Pedro Machado - -// Partially supported by the IST Programme of the EU as a Shared-cost -// RTD (FET Open) Project under Contract No IST-2000-26473 -// (ECG - Effective Computational Geometry for Curves and Surfaces) -// and a STREP (FET Open) Project under Contract No IST-006413 -// (ACS -- Algorithms for Complex Shapes) - -#ifndef CGAL_CIRCULAR_ARC_POINT_WITH_BBOX_H -#define CGAL_CIRCULAR_ARC_POINT_WITH_BBOX_H - -#include - -CGAL_BEGIN_NAMESPACE - -template < class BK> -class Circular_arc_point_with_bbox_2 { - - typedef typename BK::Circular_kernel CK; - 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_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 CK R; - - - - ////Construction///// - Circular_arc_point_with_bbox_2() - : P_point(),bb(NULL) - {} - - Circular_arc_point_with_bbox_2(const Root_for_circles_2_2 & np) - : P_point(np),bb(NULL) - {} - - Circular_arc_point_with_bbox_2(const RCircular_arc_point_2 & p) - : P_point(p),bb(NULL) - {} - - // This avoids Memory Leaks, but may decrease the performance - // probably not the best solution - Circular_arc_point_with_bbox_2(const Circular_arc_point_with_bbox_2 &c) : P_point(c.P_point), bb(NULL) { } - ~Circular_arc_point_with_bbox_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; - } - - -private: - - RCircular_arc_point_2 P_point; - mutable Bbox_2 *bb; - -}; - -template < typename BboxKernel > -inline -bool -operator==(const Circular_arc_point_with_bbox_2 &p, - const Circular_arc_point_with_bbox_2 &q) -{ - return BboxKernel().equal_2_object()(p, q); -} - -template < typename BboxKernel > -inline -bool -operator!=(const Circular_arc_point_with_bbox_2 &p, - const Circular_arc_point_with_bbox_2 &q) -{ - return ! (p == q); -} - - template < typename BK > - std::istream & - operator>>(std::istream & is, Circular_arc_point_with_bbox_2 &p) - { - typedef typename BK::CK CK; - typedef typename CK::Root_of_2 Root_of_2; - typedef typename CK::Root_for_circles_2_2 Root_for_circles_2_2; - - Root_for_circles_2_2 r; - is >> r; - if(is) - p = Circular_arc_point_with_bbox_2(r); - return is; - } - -template < class BK > -std::ostream& -operator<<(std::ostream &os, const Circular_arc_point_with_bbox_2 &p) -{ - //I can make it because I know the output format of Root_for_circle - return os << p.x() << " " << p.y() << " "; -} - -CGAL_END_NAMESPACE - -#endif // CGAL_CIRCULAR_ARC_POINT_WITH_BBOX_H diff --git a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/Circular_arc_with_bbox_2.h b/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/Circular_arc_with_bbox_2.h deleted file mode 100644 index d41f612e364..00000000000 --- a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/Circular_arc_with_bbox_2.h +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// Author(s) : Monique Teillaud, Sylvain Pion, Constantinos Tsirogiannis , Pedro Machado - -// Partially supported by the IST Programme of the EU as a Shared-cost -// RTD (FET Open) Project under Contract No IST-2000-26473 -// (ECG - Effective Computational Geometry for Curves and Surfaces) -// and a STREP (FET Open) Project under Contract No IST-006413 -// (ACS -- Algorithms for Complex Shapes) - -#ifndef CGAL_CIRCULAR_ARC_WITH_BBOX_2_H -#define CGAL_CIRCULAR_ARC_WITH_BBOX_2_H - -#include -#include - -CGAL_BEGIN_NAMESPACE - -template < class BK > -class Circular_arc_with_bbox_2 { - - typedef typename BK::Circular_kernel CK; - 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 BK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef Circular_arc_with_bbox_2 Self; - typedef typename CK::Root_of_2 Root_of_2; - typedef CK R; - - -public: - - - - - ///////////Construction///////////// - - Circular_arc_with_bbox_2(){} - - Circular_arc_with_bbox_2(const Circle_2 &c) - : P_arc(c),bb(NULL) - {} - - Circular_arc_with_bbox_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_with_bbox_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_with_bbox_2(const Circular_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_with_bbox_2(const Point_2 &start, - const Point_2 &middle, - const Point_2 &end) - : P_arc(start, middle, end),bb(NULL) - {} - - Circular_arc_with_bbox_2(const Point_2 &begin, - const Point_2 &end, - const FT &bulge) - : P_arc(begin, end, bulge),bb(NULL) - {} - - Circular_arc_with_bbox_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_with_bbox_2(const Circular_arc_2 &a) - : P_arc(a),bb(NULL) - {} - - // This avoids Memory Leaks, but may decrease the performance - // probably not the best solution - Circular_arc_with_bbox_2(const Circular_arc_with_bbox_2 &c) : P_arc(c.P_arc), bb(NULL) { } - ~Circular_arc_with_bbox_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 Circular_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); - } - - const Circle_2 & supporting_circle() const - { return P_arc.supporting_circle();} - - const Point_2 & center() const - { return P_arc.center();} - - const 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);} - - private: - - Circular_arc_2 P_arc; - mutable Bbox_2 *bb; - - -}; // Circular_arc_with_bbox_2 - - - - template < typename CK > - std::ostream & - operator<<(std::ostream & os, const Circular_arc_with_bbox_2 &a) - { - // The output format is : - // - supporting circle - // - circle c1 - // - bool b1 - // - circle c2 - // - bool b2 - return os << a.arc() << " "; - } - - template < typename CK > - std::istream & - operator>>(std::istream & is, Circular_arc_with_bbox_2 &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_with_bbox_2(s, p1, p2); - return is; - } - - template < typename CK > - std::ostream & - print(std::ostream & os, const Circular_arc_with_bbox_2 &a) - { - return os << "Circular_arc_2( " << std::endl - << "left : " << a.arc().left() << " , " << std::endl - << "right : " << a.arc().right() << " , " << std::endl - << "upper part : " << a.arc().on_upper_part() << std::endl - << " [[ approximate circle is (x,y,r) : " - << to_double(a.arc().supporting_circle().center().x()) << " " - << to_double(a.arc().supporting_circle().center().y()) << " " - << std::sqrt(to_double(a.arc().supporting_circle() - .squared_radius())) - << " ]]" << std::endl; - } - -CGAL_END_NAMESPACE - -#endif // CGAL_CIRCULAR_ARC_WITH_BBOX_2_H diff --git a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/Line_arc_with_bbox_2.h b/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/Line_arc_with_bbox_2.h deleted file mode 100644 index bab375c077a..00000000000 --- a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/Line_arc_with_bbox_2.h +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// Author(s) : Monique Teillaud, Sylvain Pion, Constantinos Tsirogiannis , Pedro Machado - -// Partially supported by the IST Programme of the EU as a Shared-cost -// RTD (FET Open) Project under Contract No IST-2000-26473 -// (ECG - Effective Computational Geometry for Curves and Surfaces) -// and a STREP (FET Open) Project under Contract No IST-006413 -// (ACS -- Algorithms for Complex Shapes) - -#ifndef CGAL_LINE_ARC_BBOX_HEXAGON_2_H -#define CGAL_LINE_ARC_BBOX_HEXAGON_2_H - -#include -#include -#include - -CGAL_BEGIN_NAMESPACE - -template < class BK > -class Line_arc_with_bbox_2 { - - typedef typename BK::Circular_kernel CK; - 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::Segment_2 Segment_2; - typedef typename CK::Circle_2 Circle_2; - typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; - typedef Line_arc_with_bbox_2 Self; - typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK::Root_of_2 Root_of_2; - typedef CK R; - - -public: - - ///////////Construction///////////// - - Line_arc_with_bbox_2(){} - - Line_arc_with_bbox_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_with_bbox_2(const Line_2 &support, - const Line_2 &l1, - const Line_2 &l2) - : P_arc(support,l1,l2), bb(NULL) - {} - - Line_arc_with_bbox_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_with_bbox_2(const Segment_2 &s) - : P_arc(s) , bb(NULL) - {} - - - Line_arc_with_bbox_2(const Point_2 &p1, - const Point_2 &p2) - : P_arc(p1,p2) , bb(NULL) - {} - - - Line_arc_with_bbox_2(const Line_arc_2 &a) - : P_arc(a) , bb(NULL) - {} - - // This avoids Memory Leaks, but may decrease the performance - // probably not the best solution - Line_arc_with_bbox_2(const Line_arc_with_bbox_2 &c) : P_arc(c.P_arc), bb(NULL) { } - ~Line_arc_with_bbox_2() { if(bb) delete bb; } - - - //////////Predicates////////// - - bool is_vertical() const - { return P_arc.is_vertical();} - - //////////Accessors/////////// - - const Line_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);} - - const 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);} - - - private: - - Line_arc_2 P_arc; - mutable Bbox_2 *bb; - - -}; // Line_arc_with_hexagon_2 - - - - template < typename CK > - std::ostream & - operator<<(std::ostream & os, const Line_arc_with_bbox_2 &a) - { - // The output format is : - // Supporting line - // Source endpoint - // Target endpoint - return os << a.arc() << " "; - } - - template < typename CK > - std::istream & - operator>>(std::istream & is, Line_arc_with_bbox_2 &a) - { - typename CK::Line_2 s; - typename CK::Circular_arc_point_2 p1; - typename CK::Circular_arc_point_2 p2; - is >> s >> p1 >> p2 ; - if (is) - a = Line_arc_with_bbox_2(s, p1, p2); - return is; - } - -CGAL_END_NAMESPACE - -#endif // CGAL_LINE_ARC_WITH_BBOX_2_H diff --git a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_intersections.h b/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_intersections.h deleted file mode 100644 index 21d6286c009..00000000000 --- a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_intersections.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// Author(s) : Monique Teillaud, Sylvain Pion, Pedro Machado - -// Partially supported by the IST Programme of the EU as a Shared-cost -// RTD (FET Open) Project under Contract No IST-2000-26473 -// (ECG - Effective Computational Geometry for Curves and Surfaces) -// and a STREP (FET Open) Project under Contract No IST-006413 -// (ACS -- Algorithms for Complex Shapes) - -#ifndef CGAL_CIRCULAR_KERNEL_BBOX_FILTERED_INTERSECTIONS_2_H -#define CGAL_CIRCULAR_KERNEL_BBOX_FILTERED_INTERSECTIONS_2_H - -#include -#include -#include -#include -#include - -CGAL_BEGIN_NAMESPACE - -#define CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_FBBOX(A,B) \ -template < class OutputIterator, class K > \ -OutputIterator \ -intersection(const A &c1, const B &c2, OutputIterator res) \ -{ \ - return typename K::Intersect_2()(c1, c2, res); \ -} \ -namespace CGALi { \ - template \ - inline \ - bool \ - do_intersect(const typename K::A &c1, const typename K::B &c2, const K&) \ - { \ - std::vector< Object > res; \ - typename K::Intersect_2()(c1,c2,std::back_inserter(res)); \ - return res.size() != 0; \ - } \ -} \ -template \ -inline \ -bool \ -do_intersect(const A &c1, const B &c2) \ -{ \ - return typename K::Do_intersect_2()(c1, c2); \ -} - -CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_FBBOX(Circular_arc_with_bbox_2, Circular_arc_with_bbox_2) -CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_FBBOX(Line_arc_with_bbox_2, Line_arc_with_bbox_2) -CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_FBBOX(Line_arc_with_bbox_2, Circular_arc_with_bbox_2) -CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_FBBOX(Circular_arc_with_bbox_2, Line_arc_with_bbox_2) -CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_FBBOX(Line_2, Circular_arc_with_bbox_2) -CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_FBBOX(Line_2, Line_arc_with_bbox_2) -CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_FBBOX(Circular_arc_with_bbox_2, Line_2) -CGAL_CIRCULAR_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_FBBOX(Line_arc_with_bbox_2, Line_2) - -CGAL_END_NAMESPACE - -#endif // CGAL_CIRCULAR_KERNEL_BBOX_FILTERED_INTERSECTIONS_2_H 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 32d9fce139c..3c167304b01 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 @@ -26,7 +26,6 @@ #ifndef CGAL_BBOX_FILTERED_PREDICATES_H #define CGAL_BBOX_FILTERED_PREDICATES_H -#include #include #include #include @@ -37,17 +36,18 @@ CGAL_BEGIN_NAMESPACE namespace Bbox_functors { template -class Compare_x_2 +class Compare_x_2 : public BK::Circular_kernel::Compare_x_2 { - typedef typename BK::Circular_kernel CK; + typedef typename BK::Circular_kernel CK; typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; public: - typedef Comparison_result result_type; + typedef typename CK::Compare_x_2::result_type result_type; + using CK::Compare_x_2::operator(); public: - + result_type operator()( const Circular_arc_point_2 &a, const Circular_arc_point_2 &b) const { @@ -66,14 +66,15 @@ class Compare_x_2 template -class Compare_y_2 +class Compare_y_2 : public BK::Circular_kernel::Compare_y_2 { - typedef typename BK::Circular_kernel CK; + typedef typename BK::Circular_kernel CK; typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; public: - typedef Comparison_result result_type; + typedef typename CK::Compare_y_2::result_type result_type; + using CK::Compare_y_2::operator(); public: @@ -95,14 +96,15 @@ class Compare_y_2 }; template -class Compare_xy_2 +class Compare_xy_2 : public BK::Circular_kernel::Compare_xy_2 { - typedef typename BK::Circular_kernel CK; + typedef typename BK::Circular_kernel CK; typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; public: - typedef Comparison_result result_type; + typedef typename CK::Compare_xy_2::result_type result_type; + using CK::Compare_xy_2::operator(); public: @@ -123,16 +125,17 @@ class Compare_xy_2 template -class In_x_range_2 +class In_x_range_2 : public BK::Circular_kernel::In_x_range_2 { - typedef typename BK::Circular_kernel CK; + 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 bool result_type; + typedef typename CK::In_x_range_2::result_type result_type; + using CK::In_x_range_2::operator(); private: @@ -219,12 +222,6 @@ template < class BK > const Circular_arc_point_2 &p2) const { return Line_arc_2(support,p1,p2); } -// result_type -// operator()(const Line_2 &support, -// const Point_2 &p1, -// const Point_2 &p2) const -// { return Line_arc_2(support,p1,p2); } - result_type operator()(const Segment_2 &s) const { return Line_arc_2(s); } @@ -299,8 +296,30 @@ template < class BK > }; + 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 @@ -380,15 +399,16 @@ class Construct_circular_max_vertex_2 }; template -class Is_vertical_2 +class Is_vertical_2 : public BK::Circular_kernel::Is_vertical_2 { - typedef typename BK::Circular_kernel CK; + 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; public: - typedef bool result_type; + typedef typename CK::Is_vertical_2::result_type result_type; + using CK::Is_vertical_2::operator(); template result_type @@ -400,16 +420,17 @@ class Is_vertical_2 template -class Compare_y_at_x_2 +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_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 Comparison_result result_type; + typedef typename CK::Compare_y_at_x_2::result_type result_type; + using CK::Compare_y_at_x_2::operator(); private: @@ -448,16 +469,17 @@ class Compare_y_at_x_2 template -class Has_on_2 +class Has_on_2 : public BK::Circular_kernel::Has_on_2 { - typedef typename BK::Circular_kernel CK; + 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 bool result_type; + typedef typename CK::Has_on_2::result_type result_type; + using CK::Has_on_2::operator(); private: @@ -490,16 +512,17 @@ class Has_on_2 template -class Equal_2 +class Equal_2 : public BK::Circular_kernel::Equal_2 { - typedef typename BK::Circular_kernel CK; + 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 bool result_type; + typedef typename CK::Equal_2::result_type result_type; + using CK::Equal_2::operator(); private: @@ -568,15 +591,16 @@ class Equal_2 template -class Do_overlap_2 +class Do_overlap_2 : public BK::Circular_kernel::Do_overlap_2 { - typedef typename BK::Circular_kernel CK; + typedef typename BK::Circular_kernel CK; typedef typename BK::Circular_arc_2 Circular_arc_2; typedef typename BK::Line_arc_2 Line_arc_2; public: - typedef bool result_type; + typedef typename CK::Do_overlap_2::result_type result_type; + using CK::Do_overlap_2::operator(); private: @@ -624,14 +648,15 @@ class Do_overlap_2 // This predicate cannot be filtered template < class BK > - class Compare_y_to_right_2 + class Compare_y_to_right_2 : public BK::Circular_kernel::Compare_y_to_right_2 { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Circular_arc_2 Circular_arc_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; public: - typedef Comparison_result result_type; + typedef typename CK::Compare_y_to_right_2::result_type result_type; + using CK::Compare_y_to_right_2::operator(); template result_type @@ -644,15 +669,16 @@ class Do_overlap_2 template < class BK > - class Make_x_monotone_2 + class Make_x_monotone_2 : public BK::Circular_kernel::Make_x_monotone_2 { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Rcirc_arc_2 Rcirc_arc_2; + 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; public: - // typedef OutputIterator result_type; + typedef typename CK::Make_x_monotone_2::result_type result_type; + using CK::Make_x_monotone_2::operator(); template < class OutputIterator > OutputIterator @@ -683,10 +709,12 @@ class Do_overlap_2 }; template < class BK > - class Do_intersect_2 + class Do_intersect_2 : public BK::Circular_kernel::Do_intersect_2 { public: - typedef typename BK::Boolean result_type; + typedef typename BK::Circular_kernel CK; + typedef typename CK::Do_intersect_2::result_type result_type; + using CK::Do_intersect_2::operator(); template result_type operator()(const T1& t1, const T2& t2) const @@ -694,7 +722,7 @@ class Do_overlap_2 }; template < class BK > - class Intersect_2 + class Intersect_2 : public BK::Circular_kernel::Intersect_2 { public: @@ -702,12 +730,15 @@ class Do_overlap_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::Rcirc_arc_2 Rcirc_arc_2; - typedef typename BK::Rline_arc_2 Rline_arc_2; - typedef typename BK::Rcirc_arc_point_2 Rcirc_arc_point_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; + typedef typename CK::Intersect_2::result_type result_type; + using CK::Intersect_2::operator(); + template < class OutputIterator > OutputIterator operator()(const Circle & c1, const Circle & c2, OutputIterator res) @@ -733,6 +764,20 @@ class Do_overlap_2 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, @@ -874,18 +919,19 @@ class Do_overlap_2 template < class BK > - class Split_2 + class Split_2 : public BK::Circular_kernel::Split_2 { - typedef typename BK::Circular_kernel CK; - typedef typename BK::Rcirc_arc_2 Rcirc_arc_2; - typedef typename BK::Rline_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_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 void result_type; + typedef typename CK::Split_2::result_type result_type; + using CK::Split_2::operator(); result_type operator()(const Circular_arc_2 &A, @@ -915,6 +961,36 @@ class Do_overlap_2 }; +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::Line_arc_2 Line_arc_2; + + public: + + typedef typename CK::Construct_bbox_2::result_type result_type; + using CK::Construct_bbox_2::operator(); + + 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/Line_arc_2.h b/Circular_kernel_2/include/CGAL/Line_arc_2.h index 5e790f83848..37c8ec08153 100644 --- a/Circular_kernel_2/include/CGAL/Line_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Line_arc_2.h @@ -25,7 +25,7 @@ #ifndef CGAL_LINE_ARC_2_H #define CGAL_LINE_ARC_2_H -namespace CGAL { +CGAL_BEGIN_NAMESPACE template class Line_arc_2 @@ -185,7 +185,126 @@ operator!=(const Line_arc_2 &p, return is; } -} // namespace CGAL +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 CK::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; + typedef CK R; + + +public: + + ///////////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), 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);} + + const 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);} + + + private: + + Rline_arc_2 P_arc; + mutable Bbox_2 *bb; + + +}; + +CGAL_END_NAMESPACE #endif // CGAL_LINE_ARC_2_H diff --git a/Circular_kernel_2/include/CGAL/Simple_circular_kernel_2.h b/Circular_kernel_2/include/CGAL/Simple_circular_kernel_2.h index 31926fbf8e8..a07f29315d3 100644 --- a/Circular_kernel_2/include/CGAL/Simple_circular_kernel_2.h +++ b/Circular_kernel_2/include/CGAL/Simple_circular_kernel_2.h @@ -40,20 +40,33 @@ #include -namespace CGAL { +CGAL_BEGIN_NAMESPACE + namespace CGALi { -template < class CircularKernel, class LinearKernelBase > -struct Circular_kernel_base_no_ref_count: public LinearKernelBase +template < class CircularKernel, class LinearKernelBase, class AlgebraicKernel > +struct Circular_kernel_base_ref_count: public LinearKernelBase { typedef CGALi::Circular_arc_2 Circular_arc_2; typedef CGALi::Circular_arc_point_2 Circular_arc_point_2; typedef CGALi::Line_arc_2 Line_arc_2; + typedef LinearKernelBase Linear_kernel; + typedef AlgebraicKernel Algebraic_kernel; + typedef typename Algebraic_kernel::Root_of_2 Root_of_2; + typedef typename Algebraic_kernel::Root_for_circles_2_2 Root_for_circles_2_2; + typedef typename Algebraic_kernel::Polynomial_for_circles_2_2 + Polynomial_for_circles_2_2; + typedef typename Algebraic_kernel::Polynomial_1_2 Polynomial_1_2; + typedef typename Linear_kernel::RT RT; + typedef typename Linear_kernel::FT FT; // The mecanism that allows to specify reference-counting or not. template < typename T > struct Handle { typedef T type; }; - + + template < typename Kernel2 > + struct Base { typedef Circular_kernel_base_ref_count Type; }; + #define CGAL_Circular_Kernel_pred(Y,Z) \ typedef CircularFunctors::Y Y; \ Y Z() const { return Y(); } @@ -68,40 +81,16 @@ template < class LinearKernel, class AlgebraicKernel > struct Circular_kernel_2 : public Circular_kernel_type_equality_wrapper < - CGALi::Circular_kernel_base_no_ref_count + CGALi::Circular_kernel_base_ref_count < Circular_kernel_2, typename LinearKernel:: template - Base >::Type + Base >::Type, + AlgebraicKernel >, - Circular_kernel_2 + Circular_kernel_2 > -{ - typedef Circular_kernel_2 Self; +{}; - typedef typename LinearKernel::template - Base >::Type Linear_kernel; - typedef AlgebraicKernel Algebraic_kernel; - - // for Lazy hexagons/bbox kernels - // Please remove this if you consider it to be sloppy - struct Circular_tag{}; - typedef Circular_tag Definition_tag; - // - - typedef typename LinearKernel::RT RT; - typedef typename LinearKernel::FT FT; - - typedef typename Algebraic_kernel::Root_of_2 Root_of_2; - typedef typename Algebraic_kernel::Root_for_circles_2_2 Root_for_circles_2_2; - typedef typename Algebraic_kernel::Polynomial_for_circles_2_2 - Polynomial_for_circles_2_2; - typedef typename Algebraic_kernel::Polynomial_1_2 Polynomial_1_2; - -// typedef CGAL::Object Object_2; -// typedef CGAL::Object Object_3; - -}; - -} // namespace CGAL +CGAL_END_NAMESPACE #endif // CGAL_SIMPLE_CIRCULAR_KERNEL_2_H diff --git a/Circular_kernel_2/include/CGAL/global_functions_on_circle_2.h b/Circular_kernel_2/include/CGAL/global_functions_on_circle_2.h index 9da514146f6..a221cfe15fa 100644 --- a/Circular_kernel_2/include/CGAL/global_functions_on_circle_2.h +++ b/Circular_kernel_2/include/CGAL/global_functions_on_circle_2.h @@ -25,7 +25,7 @@ #ifndef CGAL_CIRCULAR_KERNEL_GLOBAL_FUNCTIONS_ON_CIRCLE_2_H #define CGAL_CIRCULAR_KERNEL_GLOBAL_FUNCTIONS_ON_CIRCLE_2_H -namespace CGAL { +CGAL_BEGIN_NAMESPACE template< class CK > inline @@ -61,6 +61,6 @@ has_on_2(const typename CK::Circle_2 &c, const typename CK::Circular_arc_point_2 return CK().has_on_2_object()(c, p); } -} // namespace CGAL +CGAL_END_NAMESPACE #endif // CGAL_CIRCULAR_KERNEL_GLOBAL_FUNCTIONS_ON_CIRCLE_2_H diff --git a/Circular_kernel_2/include/CGAL/global_functions_on_circular_arcs_2.h b/Circular_kernel_2/include/CGAL/global_functions_on_circular_arcs_2.h index ad96ad4898f..983c3867deb 100644 --- a/Circular_kernel_2/include/CGAL/global_functions_on_circular_arcs_2.h +++ b/Circular_kernel_2/include/CGAL/global_functions_on_circular_arcs_2.h @@ -30,7 +30,7 @@ #include #include -namespace CGAL { +CGAL_BEGIN_NAMESPACE // TODO : Add the other ones... @@ -151,6 +151,6 @@ make_x_monotone(const Circular_arc_2 &A, OutputIterator it) return CK().make_x_monotone_2_object()(A, it); } -} // namespace CGAL +CGAL_END_NAMESPACE #endif // CGAL_CIRCULAR_KERNEL_GLOBAL_FUNCTIONS_ON_CIRCULAR_ARCS_2_H diff --git a/Circular_kernel_2/include/CGAL/global_functions_on_line_2.h b/Circular_kernel_2/include/CGAL/global_functions_on_line_2.h index 38c89e2222f..e8451ddd980 100644 --- a/Circular_kernel_2/include/CGAL/global_functions_on_line_2.h +++ b/Circular_kernel_2/include/CGAL/global_functions_on_line_2.h @@ -25,7 +25,7 @@ #ifndef CGAL_CIRCULAR_KERNEL_GLOBAL_FUNCTIONS_ON_LINE_2_H #define CGAL_CIRCULAR_KERNEL_GLOBAL_FUNCTIONS_ON_LINE_2_H -namespace CGAL { +CGAL_BEGIN_NAMESPACE template< class CK > inline @@ -54,5 +54,6 @@ intersect_2( const typename CK::Line_2 & l, } -} // namespace CGAL +CGAL_END_NAMESPACE + #endif // CGAL_CIRCULAR_KERNEL_GLOBAL_FUNCTIONS_ON_LINE_2_H diff --git a/Circular_kernel_2/include/CGAL/global_functions_on_line_arcs_2.h b/Circular_kernel_2/include/CGAL/global_functions_on_line_arcs_2.h index 836efd13ba0..42d55529f80 100644 --- a/Circular_kernel_2/include/CGAL/global_functions_on_line_arcs_2.h +++ b/Circular_kernel_2/include/CGAL/global_functions_on_line_arcs_2.h @@ -32,7 +32,7 @@ #include #include -namespace CGAL { +CGAL_BEGIN_NAMESPACE // TODO : Add the other ones... @@ -103,6 +103,6 @@ make_x_monotone(const Line_arc_2 &A, OutputIterator it) return CK().make_x_monotone_2_object()(A, it); } -} // namespace CGAL +CGAL_END_NAMESPACE #endif // CGAL_CIRCULAR_KERNEL_GLOBAL_FUNCTIONS_ON_LINE_ARCS_2_H diff --git a/Circular_kernel_2/test/Circular_kernel_2/include/CGAL/_test_circles_constructions.h b/Circular_kernel_2/test/Circular_kernel_2/include/CGAL/_test_circles_constructions.h index fde34cf7f4d..a4c802533f2 100644 --- a/Circular_kernel_2/test/Circular_kernel_2/include/CGAL/_test_circles_constructions.h +++ b/Circular_kernel_2/test/Circular_kernel_2/include/CGAL/_test_circles_constructions.h @@ -29,8 +29,6 @@ template void _test_circle_construct(CK ck) { -//typedef CK2 CK; -#if 1 typedef typename CK::Circle_2 Circle_2; typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::RT RT; @@ -43,25 +41,8 @@ void _test_circle_construct(CK ck) typedef typename CK::Make_x_monotone_2 Make_x_monotone_2; typedef typename CK::Split_2 Split_2; typedef typename CK::Get_equation Get_equation; - //typedef typename CK::Polynomial_for_circles_2_2 Polynomial_for_circles_2_2; typedef typename CK::Compare_xy_2 Compare_xy_2; typedef typename CK::Do_intersect_2 Do_intersect_2; -#else - typedef CK::Circle_2 Circle_2; - typedef CK::Circular_arc_2 Circular_arc_2; - typedef CK::RT RT; - typedef CK::FT FT; - typedef CK::Point_2 Point_2; - typedef CK::Line_2 Line_2; - typedef CK::Circular_arc_point_2 Circular_arc_point_2; - typedef CK::Construct_circle_2 Construct_circle_2; - typedef CK::Intersect_2 Intersect_2; - typedef CK::Make_x_monotone_2 Make_x_monotone_2; - typedef CK::Split_2 Split_2; - typedef CK::Get_equation Get_equation; - //typedef typename CK::Polynomial_for_circles_2_2 Polynomial_for_circles_2_2; - typedef CK::Compare_xy_2 Compare_xy_2; -#endif CGAL::Random generatorOfgenerator; int random_seed = generatorOfgenerator.get_int(0, 123456); @@ -80,26 +61,6 @@ void _test_circle_construct(CK ck) Circle_2 circ_equation(center_circ_equation, r_equation); std::cout << "the circle used by the equation :" << circ_equation << std::endl; -// Get_equation theEquation = ck.get_equation_object(); - //Polynomial_for_circles_2_2 theResult_equation = theEquation(circ_equation); - //std::cout << "a= " << theResult_equation.a() << ", b= " << - // theResult_equation.b() << ", r_sq= " << - // theResult_equation.r_sq() <