diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Bounded_side_of_ccw_circle_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Bounded_side_of_ccw_circle_C2.h index bbef2be6ac0..a6590cde787 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Bounded_side_of_ccw_circle_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Bounded_side_of_ccw_circle_C2.h @@ -77,7 +77,7 @@ private: public: typedef Voronoi_radius_2 Voronoi_radius; - typedef typename K::Bounded_side Bounded_dide; + typedef typename K::Bounded_side Bounded_side; public: template diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h index a1a50a6fb9f..318aa6af4c4 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h @@ -25,6 +25,7 @@ namespace CGAL { template class CircleC2 { + typedef typename R_::Boolean Boolean; typedef typename R_::FT FT; typedef typename R_::RT RT; typedef typename R_::Circle_2 Circle_2; @@ -49,8 +50,8 @@ public: base = Rep(center, squared_radius, orient); } - bool operator==(const CircleC2 &s) const; - bool operator!=(const CircleC2 &s) const; + Boolean operator==(const CircleC2& s) const; + Boolean operator!=(const CircleC2& s) const; const Point_2 & center() const { @@ -69,6 +70,25 @@ public: }; +template < class R > +typename R::Boolean +CircleC2::operator==(const CircleC2 &t) const +{ + if (CGAL::identical(base, t.base)) + return true; + + return center() == t.center() && + squared_radius() == t.squared_radius() && + orientation() == t.orientation(); +} + +template < class R > +typename R::Boolean +CircleC2::operator!=(const CircleC2 &t) const +{ + return !(*this == t); +} + } //namespace CGAL #endif // CGAL_CARTESIAN_CIRCLE_2_H diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h index de200ba3e4b..8f2a2fadc8c 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h @@ -23,6 +23,8 @@ namespace CGAL { template class CircleC3 { + typedef typename R_::Boolean Boolean; + typedef typename R_::Bounded_side Bounded_side; typedef typename R_::Sphere_3 Sphere_3; typedef typename R_::Plane_3 Plane_3; typedef typename R_::Point_3 Point_3; @@ -130,12 +132,12 @@ public: return diametral_sphere(); } - Point_3 center() const + decltype(auto) center() const { return diametral_sphere().center(); } - FT squared_radius() const + decltype(auto) squared_radius() const { return diametral_sphere().squared_radius(); } @@ -155,7 +157,7 @@ public: return CGAL_PI * CGAL_PI * 4.0 * to_double(squared_radius()); } - FT area_divided_by_pi() const + decltype(auto) area_divided_by_pi() const { return squared_radius(); } @@ -200,15 +202,15 @@ public: (x+mx).sup(),(y+my).sup(),(z+mz).sup()); } - bool operator==(const CircleC3 &) const; - bool operator!=(const CircleC3 &) const; + Boolean operator==(const CircleC3 &) const; + Boolean operator!=(const CircleC3 &) const; - bool has_on(const Point_3 &p) const; - bool has_on_bounded_side(const Point_3 &p) const; - bool has_on_unbounded_side(const Point_3 &p) const; + Boolean has_on(const Point_3 &p) const; + Boolean has_on_bounded_side(const Point_3 &p) const; + Boolean has_on_unbounded_side(const Point_3 &p) const; Bounded_side bounded_side(const Point_3 &p) const; - bool is_degenerate() const + Boolean is_degenerate() const { return diametral_sphere().is_degenerate(); } @@ -217,7 +219,7 @@ public: template < class R > inline -bool +typename R::Boolean CircleC3:: has_on(const typename CircleC3::Point_3 &p) const { @@ -227,7 +229,7 @@ has_on(const typename CircleC3::Point_3 &p) const template < class R > inline -bool +typename R::Boolean CircleC3:: has_on_bounded_side(const typename CircleC3::Point_3 &p) const { @@ -237,7 +239,7 @@ has_on_bounded_side(const typename CircleC3::Point_3 &p) const template < class R > inline -bool +typename R::Boolean CircleC3:: has_on_unbounded_side(const typename CircleC3::Point_3 &p) const { @@ -246,8 +248,7 @@ has_on_unbounded_side(const typename CircleC3::Point_3 &p) const } template < class R > -CGAL_KERNEL_INLINE -Bounded_side +typename R::Bounded_side CircleC3:: bounded_side(const typename CircleC3::Point_3 &p) const { @@ -256,8 +257,7 @@ bounded_side(const typename CircleC3::Point_3 &p) const } template < class R > -CGAL_KERNEL_INLINE -bool +typename R::Boolean CircleC3::operator==(const CircleC3 &t) const { if (CGAL::identical(base, t.base)) @@ -283,8 +283,7 @@ CircleC3::operator==(const CircleC3 &t) const } template < class R > -CGAL_KERNEL_INLINE -bool +typename R::Boolean CircleC3::operator!=(const CircleC3 &t) const { return !(*this == t); diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Direction_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Direction_2.h index 302299d0898..b618d8fa459 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Direction_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Direction_2.h @@ -26,6 +26,8 @@ template < class R_ > class DirectionC2 { typedef DirectionC2 Self; + + typedef typename R_::Boolean Boolean; typedef typename R_::FT FT; typedef FT RT; typedef typename R_::Point_2 Point_2; @@ -49,8 +51,8 @@ public: DirectionC2(const FT &x, const FT &y) : base{x, y} {} - bool operator==(const DirectionC2 &d) const; - bool operator!=(const DirectionC2 &d) const; + Boolean operator==(const DirectionC2 &d) const; + Boolean operator!=(const DirectionC2 &d) const; Vector_2 to_vector() const; @@ -66,7 +68,7 @@ public: template < class R > inline -bool +typename R::Boolean DirectionC2::operator==(const DirectionC2 &d) const { if (CGAL::identical(base, d.base)) @@ -76,7 +78,7 @@ DirectionC2::operator==(const DirectionC2 &d) const template < class R > inline -bool +typename R::Boolean DirectionC2::operator!=(const DirectionC2 &d) const { return !( *this == d ); diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h index 82f319261a0..28b65b121dd 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h @@ -26,6 +26,8 @@ namespace CGAL { template < class R_ > class Iso_cuboidC3 { + typedef typename R_::Boolean Boolean; + typedef typename R_::Bounded_side Bounded_side; typedef typename R_::FT FT; typedef typename R_::Iso_cuboid_3 Iso_cuboid_3; typedef typename R_::Point_3 Point_3; @@ -98,8 +100,8 @@ public: Construct_point_3()(max_hx/hw, max_hy/hw, max_hz/hw))); } - typename R::Boolean operator==(const Iso_cuboidC3& s) const; - typename R::Boolean operator!=(const Iso_cuboidC3& s) const; + Boolean operator==(const Iso_cuboidC3& s) const; + Boolean operator!=(const Iso_cuboidC3& s) const; const Point_3 & min BOOST_PREVENT_MACRO_SUBSTITUTION () const { @@ -118,11 +120,11 @@ public: } Bounded_side bounded_side(const Point_3& p) const; - typename R::Boolean has_on(const Point_3& p) const; - typename R::Boolean has_on_boundary(const Point_3& p) const; - typename R::Boolean has_on_bounded_side(const Point_3& p) const; - typename R::Boolean has_on_unbounded_side(const Point_3& p) const; - typename R::Boolean is_degenerate() const; + Boolean has_on(const Point_3& p) const; + Boolean has_on_boundary(const Point_3& p) const; + Boolean has_on_bounded_side(const Point_3& p) const; + Boolean has_on_unbounded_side(const Point_3& p) const; + Boolean is_degenerate() const; const FT & xmin() const; const FT & ymin() const; const FT & zmin() const; @@ -267,7 +269,7 @@ Iso_cuboidC3::volume() const template < class R > CGAL_KERNEL_MEDIUM_INLINE -Bounded_side +typename R::Bounded_side Iso_cuboidC3:: bounded_side(const typename Iso_cuboidC3::Point_3& p) const { diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Line_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Line_3.h index 4a04a70bcbb..a3798844fe0 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Line_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Line_3.h @@ -24,6 +24,7 @@ namespace CGAL { template < class R_ > class LineC3 { + typedef typename R_::Boolean Boolean; typedef typename R_::FT FT; typedef typename R_::Point_3 Point_3; typedef typename R_::Vector_3 Vector_3; @@ -65,8 +66,8 @@ public: LineC3(const Point_3 &p, const Direction_3 &d) { *this = R().construct_line_3_object()(p, d); } - bool operator==(const LineC3 &l) const; - bool operator!=(const LineC3 &l) const; + typename R::Boolean operator==(const LineC3 &l) const; + typename R::Boolean operator!=(const LineC3 &l) const; Plane_3 perpendicular_plane(const Point_3 &p) const; Line_3 opposite() const; @@ -88,13 +89,13 @@ public: Point_3 point(const FT i) const; - bool has_on(const Point_3 &p) const; - bool is_degenerate() const; + Boolean has_on(const Point_3 &p) const; + Boolean is_degenerate() const; }; template < class R > inline -bool +typename R::Boolean LineC3::operator==(const LineC3 &l) const { if (CGAL::identical(base, l.base)) @@ -104,7 +105,7 @@ LineC3::operator==(const LineC3 &l) const template < class R > inline -bool +typename R::Boolean LineC3::operator!=(const LineC3 &l) const { return !(*this == l); @@ -135,7 +136,7 @@ LineC3::opposite() const template < class R > inline -bool +typename R::Boolean LineC3:: has_on(const typename LineC3::Point_3 &p) const { @@ -144,7 +145,7 @@ has_on(const typename LineC3::Point_3 &p) const template < class R > inline -bool +typename R::Boolean LineC3::is_degenerate() const { return to_vector() == NULL_VECTOR; diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h index e4dcd3357d8..5a107cf969d 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h @@ -107,6 +107,15 @@ public: return base.cartesian_end(); } + typename R_::Boolean operator==(const PointC3 &p) const + { + return base == p.base; + } + typename R_::Boolean operator!=(const PointC3 &p) const + { + return !(*this == p); + } + int dimension() const { return base.dimension(); diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h index 8ab1d082d6f..9ce93eba11c 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h @@ -25,6 +25,7 @@ namespace CGAL { template < class R_ > class SegmentC3 { + typedef typename R_::Boolean Boolean; typedef typename R_::Point_3 Point_3; typedef typename R_::Direction_3 Direction_3; typedef typename R_::Vector_3 Vector_3; @@ -44,11 +45,11 @@ public: SegmentC3(const Point_3 &sp, const Point_3 &ep) : base{sp, ep} {} - bool has_on(const Point_3 &p) const; - bool collinear_has_on(const Point_3 &p) const; + Boolean has_on(const Point_3 &p) const; + Boolean collinear_has_on(const Point_3 &p) const; - bool operator==(const SegmentC3 &s) const; - bool operator!=(const SegmentC3 &s) const; + Boolean operator==(const SegmentC3 &s) const; + Boolean operator!=(const SegmentC3 &s) const; const Point_3 & source() const { @@ -73,12 +74,12 @@ public: Line_3 supporting_line() const; Segment_3 opposite() const; - bool is_degenerate() const; + Boolean is_degenerate() const; }; template < class R > inline -bool +typename R::Boolean SegmentC3::operator==(const SegmentC3 &s) const { if (CGAL::identical(base, s.base)) @@ -88,7 +89,7 @@ SegmentC3::operator==(const SegmentC3 &s) const template < class R > inline -bool +typename R::Boolean SegmentC3::operator!=(const SegmentC3 &s) const { return !(*this == s); @@ -184,7 +185,7 @@ SegmentC3::opposite() const template < class R > inline -bool +typename R::Boolean SegmentC3::is_degenerate() const { return source() == target(); @@ -192,7 +193,7 @@ SegmentC3::is_degenerate() const template < class R > inline -bool +typename R::Boolean SegmentC3:: has_on(const typename SegmentC3::Point_3 &p) const { @@ -201,7 +202,7 @@ has_on(const typename SegmentC3::Point_3 &p) const template < class R > inline -bool +typename R::Boolean SegmentC3:: collinear_has_on(const typename SegmentC3::Point_3 &p) const { diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h index 3dee104e4c6..d9b733a666d 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h @@ -27,6 +27,8 @@ namespace CGAL { template class SphereC3 { + typedef typename R_::Boolean Boolean; + typedef typename R_::Bounded_side Bounded_side; typedef typename R_::FT FT; // https://doc.cgal.org/latest/Manual/devman_code_format.html#secprogramming_conventions typedef typename R_::Point_3 Point_3_; @@ -124,17 +126,17 @@ public: //! precond: ! x.is_degenerate() (when available) // Returns R::ON_POSITIVE_SIDE, R::ON_ORIENTED_BOUNDARY or // R::ON_NEGATIVE_SIDE - typename R::Boolean has_on(const Circle_3 &p) const; - typename R::Boolean has_on(const Point_3_ &p) const; - typename R::Boolean has_on_boundary(const Point_3_ &p) const; - typename R::Boolean has_on_positive_side(const Point_3_ &p) const; - typename R::Boolean has_on_negative_side(const Point_3_ &p) const; + Boolean has_on(const Circle_3 &p) const; + Boolean has_on(const Point_3_ &p) const; + Boolean has_on_boundary(const Point_3_ &p) const; + Boolean has_on_positive_side(const Point_3_ &p) const; + Boolean has_on_negative_side(const Point_3_ &p) const; - typename R_::Bounded_side bounded_side(const Point_3_ &p) const; + Bounded_side bounded_side(const Point_3_ &p) const; //! precond: ! x.is_degenerate() (when available) // Returns R::ON_BOUNDED_SIDE, R::ON_BOUNDARY or R::ON_UNBOUNDED_SIDE - typename R::Boolean has_on_bounded_side(const Point_3_ &p) const; - typename R::Boolean has_on_unbounded_side(const Point_3_ &p) const; + Boolean has_on_bounded_side(const Point_3_ &p) const; + Boolean has_on_unbounded_side(const Point_3_ &p) const; }; template < class R > @@ -163,6 +165,7 @@ typename R::Oriented_side SphereC3:: oriented_side(const typename SphereC3::Point_3_ &p) const { + typedef typename R::Oriented_side Oriented_side; return enum_cast(bounded_side(p)) * orientation(); } @@ -172,6 +175,7 @@ typename R::Bounded_side SphereC3:: bounded_side(const typename SphereC3::Point_3_ &p) const { + typedef typename R::Bounded_side Bounded_side; return enum_cast(compare(squared_radius(), squared_distance(center(), p))); } diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Tetrahedron_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Tetrahedron_3.h index c20733313af..ef543fcc308 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Tetrahedron_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Tetrahedron_3.h @@ -143,7 +143,7 @@ oriented_side(const typename TetrahedronC3::Point_3 &p) const { typename R::Orientation o = orientation(); if (o != ZERO) - return enum_cast(bounded_side(p)) * o; + return enum_cast(bounded_side(p)) * o; CGAL_kernel_assertion (!is_degenerate()); return ON_ORIENTED_BOUNDARY; diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Triangle_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Triangle_3.h index 7e61db2dee2..40cae8796e0 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Triangle_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Triangle_3.h @@ -25,6 +25,7 @@ namespace CGAL { template class TriangleC3 { + typedef typename R_::Boolean Boolean; typedef typename R_::FT FT; typedef typename R_::Point_3 Point_3; typedef typename R_::Vector_3 Vector_3; @@ -44,13 +45,13 @@ public: TriangleC3(const Point_3 &p, const Point_3 &q, const Point_3 &r) : base{p, q, r} {} - bool operator==(const TriangleC3 &t) const; - bool operator!=(const TriangleC3 &t) const; + Boolean operator==(const TriangleC3 &t) const; + Boolean operator!=(const TriangleC3 &t) const; Plane_3 supporting_plane() const; - bool has_on(const Point_3 &p) const; - bool is_degenerate() const; + Boolean has_on(const Point_3 &p) const; + Boolean is_degenerate() const; const Point_3 & vertex(int i) const; const Point_3 & operator[](int i) const; @@ -59,7 +60,7 @@ public: }; template < class R > -bool +typename R::Boolean TriangleC3::operator==(const TriangleC3 &t) const { if (CGAL::identical(base, t.base)) @@ -75,7 +76,7 @@ TriangleC3::operator==(const TriangleC3 &t) const template < class R > inline -bool +typename R::Boolean TriangleC3::operator!=(const TriangleC3 &t) const { return !(*this == t); @@ -118,7 +119,7 @@ TriangleC3::supporting_plane() const template < class R > inline -bool +typename R::Boolean TriangleC3:: has_on(const typename TriangleC3::Point_3 &p) const { @@ -127,7 +128,7 @@ has_on(const typename TriangleC3::Point_3 &p) const } template < class R > -bool +typename R::Boolean TriangleC3::is_degenerate() const { return collinear(vertex(0),vertex(1),vertex(2)); diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h index 1ff9d12ee7b..b762bddb36b 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h @@ -107,7 +107,7 @@ public: template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean operator==(const VectorC2 &v, const VectorC2 &w) { return w.x() == v.x() && w.y() == v.y(); @@ -115,7 +115,7 @@ operator==(const VectorC2 &v, const VectorC2 &w) template < class R > inline -bool +typename R::Boolean operator!=(const VectorC2 &v, const VectorC2 &w) { return !(v == w); @@ -123,7 +123,7 @@ operator!=(const VectorC2 &v, const VectorC2 &w) template < class R > inline -bool +typename R::Boolean operator==(const VectorC2 &v, const Null_vector &) { return CGAL_NTS is_zero(v.x()) && CGAL_NTS is_zero(v.y()); @@ -131,7 +131,7 @@ operator==(const VectorC2 &v, const Null_vector &) template < class R > inline -bool +typename R::Boolean operator==(const Null_vector &n, const VectorC2 &v) { return v == n; @@ -139,7 +139,7 @@ operator==(const Null_vector &n, const VectorC2 &v) template < class R > inline -bool +typename R::Boolean operator!=(const VectorC2 &v, const Null_vector &n) { return !(v == n); @@ -147,7 +147,7 @@ operator!=(const VectorC2 &v, const Null_vector &n) template < class R > inline -bool +typename R::Boolean operator!=(const Null_vector &n, const VectorC2 &v) { return !(v == n); diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h index 89540fd9b0d..19543f9dcf4 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h @@ -142,15 +142,15 @@ public: template < class R > inline -bool +typename R::Boolean operator==(const VectorC3 &v, const VectorC3 &w) { - return w.x() == v.x() && w.y() == v.y() && w.z() == v.z(); + return CGAL_AND_3(w.x() == v.x(), w.y() == v.y(), w.z() == v.z()); } template < class R > inline -bool +typename R::Boolean operator!=(const VectorC3 &v, const VectorC3 &w) { return !(v == w); @@ -158,16 +158,15 @@ operator!=(const VectorC3 &v, const VectorC3 &w) template < class R > inline -bool +typename R::Boolean operator==(const VectorC3 &v, const Null_vector &) { - return CGAL_NTS is_zero(v.x()) && CGAL_NTS is_zero(v.y()) && - CGAL_NTS is_zero(v.z()); + return CGAL_AND_3(CGAL_NTS is_zero(v.x()), CGAL_NTS is_zero(v.y()), CGAL_NTS is_zero(v.z())); } template < class R > inline -bool +typename R::Boolean operator==(const Null_vector &n, const VectorC3 &v) { return v == n; @@ -175,7 +174,7 @@ operator==(const Null_vector &n, const VectorC3 &v) template < class R > inline -bool +typename R::Boolean operator!=(const VectorC3 &v, const Null_vector &n) { return !(v == n); @@ -183,7 +182,7 @@ operator!=(const VectorC3 &v, const Null_vector &n) template < class R > inline -bool +typename R::Boolean operator!=(const Null_vector &n, const VectorC3 &v) { return !(v == n); diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index ffb1056f147..937bcbe6e23 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -36,20 +36,20 @@ namespace CartesianKernelFunctors { template class Angle_2 { + typedef typename K::Angle Angle; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; - public: - typedef typename K::Angle result_type; - result_type + public: + Angle operator()(const Vector_2& u, const Vector_2& v) const { return angleC2(u.x(), u.y(), v.x(), v.y()); } - result_type + Angle operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { return angleC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y()); } - result_type + Angle operator()(const Point_2& p, const Point_2& q, const Point_2& r, const Point_2& s) const { @@ -63,18 +63,19 @@ namespace CartesianKernelFunctors { template class Angle_3 { + typedef typename K::Angle Angle; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; - public: - typedef typename K::Angle result_type; - result_type + public: + Angle operator()(const Vector_3& u, const Vector_3& v) const { return angleC3(u.x(), u.y(), u.z(), v.x(), v.y(), v.z()); } - result_type + + Angle operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { return angleC3(p.x(), p.y(), p.z(), @@ -82,7 +83,7 @@ namespace CartesianKernelFunctors { r.x(), r.y(), r.z()); } - result_type + Angle operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { @@ -92,7 +93,7 @@ namespace CartesianKernelFunctors { s.x(), s.y(), s.z()); } - result_type + Angle operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Vector_3& n) const { @@ -103,18 +104,17 @@ namespace CartesianKernelFunctors { template class Are_parallel_2 { + typedef typename K::Boolean Boolean; typedef typename K::Line_2 Line_2; typedef typename K::Segment_2 Segment_2; typedef typename K::Ray_2 Ray_2; public: - typedef typename K::Boolean result_type; - - result_type + Boolean operator()(const Line_2& l1, const Line_2& l2) const { return parallelC2(l1.a(), l1.b(), l2.a(), l2.b()); } - result_type + Boolean operator()(const Segment_2& s1, const Segment_2& s2) const { return parallelC2(s1.source().x(), s1.source().y(), s1.target().x(), s1.target().y(), @@ -122,7 +122,7 @@ namespace CartesianKernelFunctors { s2.target().x(), s2.target().y()); } - result_type + Boolean operator()(const Ray_2& r1, const Ray_2& r2) const { return parallelC2(r1.source().x(), r1.source().y(), r1.second_point().x(), r1.second_point().y(), @@ -134,28 +134,27 @@ namespace CartesianKernelFunctors { template class Are_parallel_3 { + typedef typename K::Boolean Boolean; typedef typename K::Line_3 Line_3; typedef typename K::Segment_3 Segment_3; typedef typename K::Ray_3 Ray_3; typedef typename K::Plane_3 Plane_3; public: - typedef typename K::Boolean result_type; - - result_type + Boolean operator()(const Line_3& l1, const Line_3& l2) const { return parallelC3( l1.to_vector().x(), l1.to_vector().y(), l1.to_vector().z(), l2.to_vector().x(), l2.to_vector().y(), l2.to_vector().z()); } - result_type + Boolean operator()(const Plane_3& h1, const Plane_3& h2) const { return parallelC3(h1.a(), h1.b(), h1.c(), h2.a(), h2.b(), h2.c()); } - result_type + Boolean operator()(const Segment_3& s1, const Segment_3& s2) const { return parallelC3(s1.source().x(), s1.source().y(), s1.source().z(), s1.target().x(), s1.target().y(), s1.target().z(), @@ -163,7 +162,7 @@ namespace CartesianKernelFunctors { s2.target().x(), s2.target().y(), s2.target().z()); } - result_type + Boolean operator()(const Ray_3& r1, const Ray_3& r2) const { return parallelC3(r1.source().x(), r1.source().y(), r1.source().z(), r1.second_point().x(), r1.second_point().y(), r1.second_point().z(), @@ -175,14 +174,14 @@ namespace CartesianKernelFunctors { template class Bounded_side_2 { + typedef typename K::Bounded_side Bounded_side; typedef typename K::Point_2 Point_2; typedef typename K::Circle_2 Circle_2; typedef typename K::Triangle_2 Triangle_2; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; - public: - typedef typename K::Bounded_side result_type; - result_type + public: + Bounded_side operator()( const Circle_2& c, const Point_2& p) const { typename K::Compute_squared_distance_2 squared_distance; @@ -190,7 +189,7 @@ namespace CartesianKernelFunctors { squared_distance(c.center(),p))); } - result_type + Bounded_side operator()( const Triangle_2& t, const Point_2& p) const { typename K::Collinear_are_ordered_along_line_2 @@ -213,7 +212,7 @@ namespace CartesianKernelFunctors { : ON_UNBOUNDED_SIDE; } - result_type + Bounded_side operator()( const Iso_rectangle_2& r, const Point_2& p) const { bool x_incr = (r.xmin() < p.x()) && (p.x() < r.xmax()), @@ -236,24 +235,24 @@ namespace CartesianKernelFunctors { template class Bounded_side_3 { + typedef typename K::Bounded_side Bounded_side; typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Sphere_3 Sphere_3; typedef typename K::Circle_3 Circle_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Iso_cuboid_3 Iso_cuboid_3; - public: - typedef typename K::Bounded_side result_type; - result_type + public: + Bounded_side operator()( const Sphere_3& s, const Point_3& p) const { return s.rep().bounded_side(p); } - result_type + Bounded_side operator()( const Circle_3& s, const Point_3& p) const { return s.rep().bounded_side(p); } - result_type + Bounded_side operator()( const Tetrahedron_3& t, const Point_3& p) const { FT alpha, beta, gamma, denom; @@ -273,7 +272,7 @@ namespace CartesianKernelFunctors { return ON_BOUNDED_SIDE; } - result_type + Bounded_side operator()( const Iso_cuboid_3& c, const Point_3& p) const { return c.rep().bounded_side(p); @@ -284,11 +283,11 @@ namespace CartesianKernelFunctors { template class Collinear_are_ordered_along_line_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { CGAL_kernel_exactness_precondition( collinear(p, q, r) ); @@ -300,11 +299,11 @@ namespace CartesianKernelFunctors { template class Collinear_are_ordered_along_line_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { CGAL_kernel_exactness_precondition( collinear(p, q, r) ); @@ -317,11 +316,11 @@ namespace CartesianKernelFunctors { template class Collinear_are_strictly_ordered_along_line_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { CGAL_kernel_exactness_precondition( collinear(p, q, r) ); @@ -333,11 +332,11 @@ namespace CartesianKernelFunctors { template class Collinear_are_strictly_ordered_along_line_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { CGAL_kernel_exactness_precondition( collinear(p, q, r) ); @@ -350,13 +349,13 @@ namespace CartesianKernelFunctors { template class Collinear_has_on_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Ray_2 Ray_2; typedef typename K::Segment_2 Segment_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Ray_2& r, const Point_2& p) const { const Point_2 & source = r.source(); @@ -378,7 +377,7 @@ namespace CartesianKernelFunctors { } // switch } - result_type + Boolean operator()( const Segment_2& s, const Point_2& p) const { return collinear_are_ordered_along_line(s.source(), p, s.target()); @@ -388,16 +387,17 @@ namespace CartesianKernelFunctors { template class Collinear_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Orientation_2 Orientation_2; - Orientation_2 o; - public: - typedef typename K::Boolean result_type; + Orientation_2 o; + + public: Collinear_2() {} Collinear_2(const Orientation_2 o_) : o(o_) {} - result_type + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { return o(p, q, r) == COLLINEAR; } }; @@ -405,11 +405,11 @@ namespace CartesianKernelFunctors { template class Collinear_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { return collinearC3(p.x(), p.y(), p.z(), @@ -421,11 +421,11 @@ namespace CartesianKernelFunctors { template class Compare_angle_with_x_axis_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Direction_2 Direction_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Direction_2& d1, const Direction_2& d2) const { return compare_angle_with_x_axisC2(d1.dx(), d1.dy(), d2.dx(), d2.dy()); @@ -435,25 +435,25 @@ namespace CartesianKernelFunctors { template class Compare_distance_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { return cmp_dist_to_pointC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y()); } template - Needs_FT + Needs_FT operator()(const T1& p, const T2& q, const T3& r) const { return CGAL::compare(squared_distance(p, q), squared_distance(p, r)); } template - Needs_FT + Needs_FT operator()(const T1& p, const T2& q, const T3& r, const T4& s) const { return CGAL::compare(squared_distance(p, q), squared_distance(r, s)); @@ -560,12 +560,12 @@ namespace CartesianKernelFunctors { template class Compare_distance_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; typedef typename K::Segment_3 Segment_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { return cmp_dist_to_pointC3(p.x(), p.y(), p.z(), @@ -573,33 +573,33 @@ namespace CartesianKernelFunctors { r.x(), r.y(), r.z()); } - result_type + Comparison_result operator()(const Point_3& p1, const Segment_3& s1, const Segment_3& s2) const { return internal::compare_distance_pssC3(p1,s1,s2, K()); } - result_type + Comparison_result operator()(const Point_3& p1, const Point_3& p2, const Segment_3& s2) const { return internal::compare_distance_ppsC3(p1,p2,s2, K()); } - result_type + Comparison_result operator()(const Point_3& p1, const Segment_3& s2, const Point_3& p2) const { return opposite(internal::compare_distance_ppsC3(p1,p2,s2, K())); } template - Needs_FT + Needs_FT operator()(const T1& p, const T2& q, const T3& r) const { return CGAL::compare(squared_distance(p, q), squared_distance(p, r)); } template - Needs_FT + Needs_FT operator()(const T1& p, const T2& q, const T3& r, const T4& s) const { return CGAL::compare(squared_distance(p, q), squared_distance(r, s)); @@ -614,8 +614,7 @@ namespace CartesianKernelFunctors { typedef typename K::Point_2 Point_2; typedef typename K::Comparison_result Comparison_result; - typedef Comparison_result result_type; - +public: Comparison_result operator()(const Point_2& r, const Weighted_point_2& p, const Weighted_point_2& q) const @@ -629,14 +628,13 @@ namespace CartesianKernelFunctors { template class Compare_signed_distance_to_line_2 { - typedef typename K::Point_2 Point_2; - typedef typename K::Line_2 Line_2; - typedef typename K::Equal_2 Equal_2; + typedef typename K::Comparison_result Comparison_result; + typedef typename K::Point_2 Point_2; + typedef typename K::Line_2 Line_2; + typedef typename K::Equal_2 Equal_2; public: - typedef typename K::Comparison_result result_type; - - result_type + Comparison_result operator()(const Point_2& a, const Point_2& b, const Point_2& c, const Point_2& d) const { @@ -649,7 +647,7 @@ namespace CartesianKernelFunctors { d.x(), d.y()); } - result_type + Comparison_result operator()(const Line_2& l, const Point_2& p, const Point_2& q) const { return cmp_signed_dist_to_directionC2(l.a(), l.b(), @@ -661,12 +659,12 @@ namespace CartesianKernelFunctors { template class Compare_squared_radius_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; typedef typename K::FT FT; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s, const FT& ft) const { FT num, den; @@ -678,7 +676,7 @@ namespace CartesianKernelFunctors { return CGAL::compare(num, den * ft); } - result_type + Comparison_result operator()(const Point_3& p, const Point_3& q, const Point_3& r, const FT& ft) const { FT num, den; @@ -689,7 +687,7 @@ namespace CartesianKernelFunctors { return CGAL::compare(num, den * ft); } - result_type + Comparison_result operator()(const Point_3& p, const Point_3& q, const FT& ft) const { FT num, den; @@ -699,7 +697,7 @@ namespace CartesianKernelFunctors { return CGAL::compare(num, den * ft); } - result_type + Comparison_result operator()(const Point_3&, const FT& ft) const { return - CGAL_NTS sign(ft); @@ -707,23 +705,22 @@ namespace CartesianKernelFunctors { }; - template class Compare_slope_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; typedef typename K::Segment_2 Segment_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Line_2& l1, const Line_2& l2) const { return compare_slopesC2(l1.a(), l1.b(), l2.a(), l2.b()); } - result_type + Comparison_result operator()(const Segment_2& s1, const Segment_2& s2) const { return compare_slopesC2(s1.source().x(), s1.source().y(), @@ -732,7 +729,7 @@ namespace CartesianKernelFunctors { s2.target().x(), s2.target().y()); } - result_type + Comparison_result operator()(const Point_2& s1s, const Point_2& s1t, const Point_2& s2s, const Point_2& s2t) const { return compare_slopesC2(s1s.x(), s1s.y(), @@ -745,30 +742,30 @@ namespace CartesianKernelFunctors { template class Compare_x_at_y_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Line_2& h) const { return compare_y_at_xC2(p.y(), p.x(), h.b(), h.a(), h.c()); } - result_type + Comparison_result operator()( const Point_2& p, const Line_2& h1, const Line_2& h2) const { return compare_y_at_xC2(p.y(), h1.b(), h1.a(), h1.c(), h2.b(), h2.a(), h2.c()); } - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h) const { return compare_y_at_xC2(l1.b(), l1.a(), l1.c(), l2.b(), l2.a(), l2.c(), h.b(), h.a(), h.c()); } - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h1, const Line_2& h2) const { @@ -780,11 +777,11 @@ namespace CartesianKernelFunctors { template class Compare_xyz_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { return compare_lexicographically_xyzC3(p.x(), p.y(), p.z(), @@ -795,11 +792,11 @@ namespace CartesianKernelFunctors { template class Compare_xy_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Point_2& q) const { return compare_lexicographically_xyC2(p.x(), p.y(), q.x(), q.y()); } }; @@ -807,11 +804,11 @@ namespace CartesianKernelFunctors { template class Compare_xy_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { return compare_lexicographically_xyC2(p.x(), p.y(), q.x(), q.y()); } }; @@ -819,27 +816,27 @@ namespace CartesianKernelFunctors { template class Compare_x_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Point_2& q) const { return CGAL::compare(p.x(), q.x()); } - result_type + Comparison_result operator()( const Point_2& p, const Line_2& l, const Line_2& h) const { return compare_xC2(p.x(), l.a(), l.b(), l.c(), h.a(), h.b(), h.c()); } - result_type + Comparison_result operator()( const Line_2& l, const Line_2& h1, const Line_2& h2) const { return compare_xC2(l.a(), l.b(), l.c(), h1.a(), h1.b(), h1.c(), h2.a(), h2.b(), h2.c()); } - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h1, const Line_2& h2) const { @@ -851,11 +848,11 @@ namespace CartesianKernelFunctors { template class Compare_x_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { return CGAL::compare(p.x(), q.x()); } }; @@ -863,11 +860,11 @@ namespace CartesianKernelFunctors { template class Compare_yx_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Point_2& q) const { return compare_lexicographically_xyC2(p.y(), p.x(), q.y(), q.x()); } }; @@ -875,31 +872,31 @@ namespace CartesianKernelFunctors { template class Compare_y_at_x_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; typedef typename K::Segment_2 Segment_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Line_2& h) const { return compare_y_at_xC2(p.x(), p.y(), h.a(), h.b(), h.c()); } - result_type + Comparison_result operator()( const Point_2& p, const Line_2& h1, const Line_2& h2) const { return compare_y_at_xC2(p.x(), h1.a(), h1.b(), h1.c(), h2.a(), h2.b(), h2.c()); } - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h) const { return compare_y_at_xC2(l1.a(), l1.b(), l1.c(), l2.a(), l2.b(), l2.c(), h.a(), h.b(), h.c()); } - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h1, const Line_2& h2) const { @@ -907,7 +904,7 @@ namespace CartesianKernelFunctors { h1.a(), h1.b(), h1.c(), h2.a(), h2.b(), h2.c()); } - result_type + Comparison_result operator()( const Point_2& p, const Segment_2& s) const { return compare_y_at_xC2(p.x(), p.y(), @@ -915,7 +912,7 @@ namespace CartesianKernelFunctors { s.target().x(), s.target().y()); } - result_type + Comparison_result operator()( const Point_2& p, const Segment_2& s1, const Segment_2& s2) const { @@ -930,16 +927,16 @@ namespace CartesianKernelFunctors { template class Compare_y_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Point_2& q) const { return CGAL::compare(p.y(), q.y()); } - result_type + Comparison_result operator()( const Point_2& p, const Line_2& l1, const Line_2& l2) const { return compare_xC2(p.y(), @@ -947,14 +944,14 @@ namespace CartesianKernelFunctors { l2.b(), l2.a(), l2.c()); } - result_type + Comparison_result operator()( const Line_2& l, const Line_2& h1, const Line_2& h2) const { return compare_xC2(l.b(), l.a(), l.c(), h1.b(), h1.a(), h1.c(), l.b(), l.a(), l.c(), h2.b(), h2.a(), h2.c()); } - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h1, const Line_2& h2) const { @@ -966,11 +963,11 @@ namespace CartesianKernelFunctors { template class Compare_y_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { return CGAL::compare(p.y(), q.y()); } }; @@ -978,11 +975,11 @@ namespace CartesianKernelFunctors { template class Compare_z_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { return CGAL::compare(p.z(), q.z()); } }; @@ -994,10 +991,7 @@ namespace CartesianKernelFunctors { typedef typename K::FT FT; public: - - typedef double result_type; - - result_type + double operator() (const Circle_3 & c) const // { return c.rep().approximate_area(); } { return CGAL_PI * to_double(c.squared_radius()); } @@ -1010,10 +1004,7 @@ namespace CartesianKernelFunctors { typedef typename K::FT FT; public: - - typedef double result_type; - - result_type + double operator() (const Circle_3 & c) const // { return c.rep().approximate_squared_length(); } { return CGAL_PI * CGAL_PI * 4.0 * to_double(c.squared_radius()); } @@ -1027,10 +1018,9 @@ namespace CartesianKernelFunctors { typedef typename K::Iso_rectangle_2 Iso_rectangle_2; typedef typename K::Triangle_2 Triangle_2; typedef typename K::Point_2 Point_2; - public: - typedef FT result_type; - result_type + public: + FT operator()( const Point_2& p, const Point_2& q, const Point_2& r ) const { FT v1x = q.x() - p.x(); @@ -1040,11 +1030,11 @@ namespace CartesianKernelFunctors { return determinant(v1x, v1y, v2x, v2y)/2; } - result_type + FT operator()( const Iso_rectangle_2& r ) const { return (r.xmax()-r.xmin()) * (r.ymax()-r.ymin()); } - result_type + FT operator()( const Triangle_2& t ) const { return t.area(); } }; @@ -1053,13 +1043,9 @@ namespace CartesianKernelFunctors { class Compute_area_divided_by_pi_3 { typedef typename K::Circle_3 Circle_3; - typedef typename K::FT FT; public: - - typedef FT result_type; - - result_type + decltype(auto) // FT or const FT& operator()(const Circle_3 & c) const { return c.rep().area_divided_by_pi(); } @@ -1070,10 +1056,9 @@ namespace CartesianKernelFunctors { { typedef typename K::FT FT; typedef typename K::Vector_2 Vector_2; - public: - typedef FT result_type; - result_type + public: + FT operator()(const Vector_2& v, const Vector_2& w) const { return determinant(v.x(), v.y(), w.x(), w.y()); @@ -1085,10 +1070,9 @@ namespace CartesianKernelFunctors { { typedef typename K::FT FT; typedef typename K::Vector_3 Vector_3; - public: - typedef FT result_type; - result_type + public: + FT operator()(const Vector_3& v, const Vector_3& w, const Vector_3& t) const { return determinant(v.x(), v.y(), v.z(), @@ -1102,10 +1086,9 @@ namespace CartesianKernelFunctors { { typedef typename K::FT FT; typedef typename K::Vector_2 Vector_2; - public: - typedef FT result_type; - result_type + public: + FT operator()(const Vector_2& v, const Vector_2& w) const { return v.x() * w.x() + v.y() * w.y(); @@ -1117,10 +1100,9 @@ namespace CartesianKernelFunctors { { typedef typename K::FT FT; typedef typename K::Vector_3 Vector_3; - public: - typedef FT result_type; - result_type + public: + FT operator()(const Vector_3& v, const Vector_3& w) const { return v.x() * w.x() + v.y() * w.y() + v.z() * w.z(); @@ -1133,16 +1115,15 @@ namespace CartesianKernelFunctors { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Triangle_3 Triangle_3; - public: - typedef FT result_type; - result_type + public: + FT operator()( const Triangle_3& t ) const { return this->operator()(t.vertex(0), t.vertex(1), t.vertex(2)); } - result_type + FT operator()( const Point_3& p, const Point_3& q, const Point_3& r ) const { return squared_areaC3(p.x(), p.y(), p.z(), @@ -1157,10 +1138,9 @@ namespace CartesianKernelFunctors { { typedef typename K::FT FT; typedef typename K::Point_2 Point_2; - public: - typedef FT result_type; - result_type + public: + FT operator()( const Point_2& p, const Point_2& q) const { return squared_distanceC2(p.x(), p.y(), q.x(), q.y()); @@ -1170,14 +1150,11 @@ namespace CartesianKernelFunctors { template class Compute_squared_length_divided_by_pi_square_3 { - typedef typename K::Circle_3 Circle_3; typedef typename K::FT FT; + typedef typename K::Circle_3 Circle_3; public: - - typedef FT result_type; - - result_type + FT operator() (const Circle_3 & c) const { return c.rep().squared_length_divided_by_pi_square(); } @@ -1189,31 +1166,27 @@ namespace CartesianKernelFunctors { typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Circle_2 Circle_2; - public: - typedef FT result_type; - result_type + public: + decltype(auto) operator()( const Circle_2& c) const { return c.rep().squared_radius(); } - result_type + FT operator()( const Point_2& /*p*/) const { return FT(0); } - result_type + FT operator()( const Point_2& p, const Point_2& q) const { return squared_radiusC2(p.x(), p.y(), q.x(), q.y()); } - result_type + FT operator()( const Point_2& p, const Point_2& q, const Point_2& r) const { return squared_radiusC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y()); } }; } //namespace CartesianKernelFunctors -// For the non specialized template will do the right thing, -// namely return a copy of an FT - namespace CartesianKernelFunctors { template @@ -1223,22 +1196,21 @@ namespace CartesianKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Sphere_3 Sphere_3; typedef typename K::Circle_3 Circle_3; - public: - typedef FT result_type; - result_type +public: + decltype(auto) operator()( const Sphere_3& s) const { return s.rep().squared_radius(); } - result_type + decltype(auto) operator()( const Circle_3& c) const { return c.rep().squared_radius(); } - result_type + FT operator()( const Point_3& /*p*/) const { return FT(0); } - result_type + FT operator()( const Point_3& p, const Point_3& q) const { FT num, den; @@ -1248,7 +1220,7 @@ namespace CartesianKernelFunctors { return num / den; } - result_type + FT operator()( const Point_3& p, const Point_3& q, const Point_3& r) const { FT num, den; @@ -1259,7 +1231,7 @@ namespace CartesianKernelFunctors { return num / den; } - result_type + FT operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { @@ -1280,10 +1252,9 @@ namespace CartesianKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Iso_cuboid_3 Iso_cuboid_3; - public: - typedef FT result_type; - result_type + public: + FT operator()(const Point_3& p0, const Point_3& p1, const Point_3& p2, const Point_3& p3) const { @@ -1292,14 +1263,14 @@ namespace CartesianKernelFunctors { p3.x()-p0.x(), p3.y()-p0.y(), p3.z()-p0.z())/6; } - result_type + FT operator()( const Tetrahedron_3& t ) const { return this->operator()(t.vertex(0), t.vertex(1), t.vertex(2), t.vertex(3)); } - result_type + FT operator()( const Iso_cuboid_3& c ) const { return c.rep().volume(); } }; @@ -1308,20 +1279,17 @@ namespace CartesianKernelFunctors { template class Compute_x_2 { - typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Point_2& p) const { return p.rep().x(); } - result_type + decltype(auto) operator()(const Vector_2& v) const { return v.rep().x(); @@ -1331,20 +1299,17 @@ namespace CartesianKernelFunctors { template class Compute_x_3 { - typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Point_3& p) const { return p.rep().x(); } - result_type + decltype(auto) operator()(const Vector_3& v) const { return v.rep().x(); @@ -1355,20 +1320,17 @@ namespace CartesianKernelFunctors { template class Compute_y_2 { - typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Point_2& p) const { return p.rep().y(); } - result_type + decltype(auto) operator()(const Vector_2& v) const { return v.rep().y(); @@ -1379,20 +1341,17 @@ namespace CartesianKernelFunctors { template class Compute_y_3 { - typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Point_3& p) const { return p.rep().y(); } - result_type + decltype(auto) operator()(const Vector_3& v) const { return v.rep().y(); @@ -1402,38 +1361,30 @@ namespace CartesianKernelFunctors { template class Compute_z_3 { - typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Point_3& p) const { return p.rep().z(); } - result_type + decltype(auto) operator()(const Vector_3& v) const { return v.rep().z(); } }; - - template class Compute_dx_2 { - typedef typename K::FT FT; typedef typename K::Direction_2 Direction_2; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Direction_2& d) const { return d.rep().dx(); @@ -1443,13 +1394,10 @@ namespace CartesianKernelFunctors { template class Compute_dx_3 { - typedef typename K::FT FT; typedef typename K::Direction_3 Direction_3; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Direction_3& d) const { return d.rep().dx(); @@ -1459,13 +1407,10 @@ namespace CartesianKernelFunctors { template class Compute_dy_2 { - typedef typename K::FT FT; typedef typename K::Direction_2 Direction_2; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Direction_2& d) const { return d.rep().dy(); @@ -1475,13 +1420,10 @@ namespace CartesianKernelFunctors { template class Compute_dy_3 { - typedef typename K::FT FT; typedef typename K::Direction_3 Direction_3; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Direction_3& d) const { return d.rep().dy(); @@ -1491,13 +1433,10 @@ namespace CartesianKernelFunctors { template class Compute_dz_3 { - typedef typename K::FT FT; typedef typename K::Direction_3 Direction_3; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Direction_3& d) const { return d.rep().dz(); @@ -1507,20 +1446,17 @@ namespace CartesianKernelFunctors { template class Compute_hx_2 { - typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Point_2& p) const { return p.rep().hx(); } - result_type + decltype(auto) operator()(const Vector_2& v) const { return v.rep().hx(); @@ -1530,20 +1466,17 @@ namespace CartesianKernelFunctors { template class Compute_hx_3 { - typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Point_3& p) const { return p.rep().hx(); } - result_type + decltype(auto) operator()(const Vector_3& v) const { return v.rep().hx(); @@ -1553,20 +1486,17 @@ namespace CartesianKernelFunctors { template class Compute_hy_2 { - typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Point_2& p) const { return p.rep().hy(); } - result_type + decltype(auto) operator()(const Vector_2& v) const { return v.rep().hy(); @@ -1576,20 +1506,17 @@ namespace CartesianKernelFunctors { template class Compute_hy_3 { - typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Point_3& p) const { return p.rep().hy(); } - result_type + decltype(auto) operator()(const Vector_3& v) const { return v.rep().hy(); @@ -1599,20 +1526,17 @@ namespace CartesianKernelFunctors { template class Compute_hz_3 { - typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Point_3& p) const { return p.rep().hz(); } - result_type + decltype(auto) operator()(const Vector_3& v) const { return v.rep().hz(); @@ -1622,20 +1546,17 @@ namespace CartesianKernelFunctors { template class Compute_hw_2 { - typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Point_2& p) const { return p.rep().hw(); } - result_type + decltype(auto) operator()(const Vector_2& v) const { return v.rep().hw(); @@ -1645,20 +1566,17 @@ namespace CartesianKernelFunctors { template class Compute_hw_3 { - typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Point_3& p) const { return p.rep().hw(); } - result_type + decltype(auto) operator()(const Vector_3& v) const { return v.rep().hw(); @@ -1669,13 +1587,10 @@ namespace CartesianKernelFunctors { template class Compute_xmin_2 { - typedef typename K::FT FT; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Iso_rectangle_2& r) const { return (r.min)().x(); @@ -1685,13 +1600,10 @@ namespace CartesianKernelFunctors { template class Compute_xmax_2 { - typedef typename K::FT FT; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Iso_rectangle_2& r) const { return (r.max)().x(); @@ -1701,13 +1613,10 @@ namespace CartesianKernelFunctors { template class Compute_ymin_2 { - typedef typename K::FT FT; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Iso_rectangle_2& r) const { return (r.min)().y(); @@ -1717,29 +1626,24 @@ namespace CartesianKernelFunctors { template class Compute_ymax_2 { - typedef typename K::FT FT; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; public: - typedef const FT& result_type; - - result_type + decltype(auto) operator()(const Iso_rectangle_2& r) const { return (r.max)().y(); } }; - template class Construct_barycenter_2 { typedef typename K::FT FT; typedef typename K::Point_2 Point_2; - public: - typedef Point_2 result_type; - result_type + public: + Point_2 operator()(const Point_2& p1, const FT&w1, const Point_2& p2) const { typename K::Construct_point_2 construct_point_2; @@ -1748,7 +1652,7 @@ namespace CartesianKernelFunctors { return construct_point_2(x, y); } - result_type + Point_2 operator()(const Point_2& p1, const FT& w1, const Point_2& p2, const FT& w2) const { typename K::Construct_point_2 construct_point_2; @@ -1757,7 +1661,7 @@ namespace CartesianKernelFunctors { return construct_point_2(x, y); } - result_type + Point_2 operator()(const Point_2& p1, const FT& w1, const Point_2& p2, const FT& w2, const Point_2& p3) const { @@ -1767,7 +1671,7 @@ namespace CartesianKernelFunctors { return construct_point_2(x, y); } - result_type + Point_2 operator()(const Point_2& p1, const FT& w1, const Point_2& p2, const FT& w2, const Point_2& p3, const FT& w3) const { @@ -1777,7 +1681,7 @@ namespace CartesianKernelFunctors { return construct_point_2(x, y); } - result_type + Point_2 operator()(const Point_2& p1, const FT& w1, const Point_2& p2, const FT& w2, const Point_2& p3, const FT& w3, const Point_2& p4) const { @@ -1787,7 +1691,7 @@ namespace CartesianKernelFunctors { return construct_point_2(x, y); } - result_type + Point_2 operator()(const Point_2& p1, const FT& w1, const Point_2& p2, const FT& w2, const Point_2& p3, const FT& w3, const Point_2& p4, const FT& w4) const { @@ -1804,10 +1708,9 @@ namespace CartesianKernelFunctors { { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; - public: - typedef Point_3 result_type; - result_type + public: + Point_3 operator()(const Point_3& p1, const FT&w1, const Point_3& p2) const { typename K::Construct_point_3 construct_point_3; @@ -1816,7 +1719,7 @@ namespace CartesianKernelFunctors { return construct_point_3(x, y, z); } - result_type + Point_3 operator()(const Point_3& p1, const FT& w1, const Point_3& p2, const FT& w2) const { typename K::Construct_point_3 construct_point_3; @@ -1825,7 +1728,7 @@ namespace CartesianKernelFunctors { return construct_point_3(x, y, z); } - result_type + Point_3 operator()(const Point_3& p1, const FT& w1, const Point_3& p2, const FT& w2, const Point_3& p3) const { @@ -1835,7 +1738,7 @@ namespace CartesianKernelFunctors { return construct_point_3(x, y, z); } - result_type + Point_3 operator()(const Point_3& p1, const FT& w1, const Point_3& p2, const FT& w2, const Point_3& p3, const FT& w3) const { @@ -1846,7 +1749,7 @@ namespace CartesianKernelFunctors { return construct_point_3(x, y, z); } - result_type + Point_3 operator()(const Point_3& p1, const FT& w1, const Point_3& p2, const FT& w2, const Point_3& p3, const FT& w3, const Point_3& p4) const { @@ -1857,7 +1760,7 @@ namespace CartesianKernelFunctors { return construct_point_3(x, y, z); } - result_type + Point_3 operator()(const Point_3& p1, const FT& w1, const Point_3& p2, const FT& w2, const Point_3& p3, const FT& w3, const Point_3& p4, const FT& w4) const { @@ -1882,16 +1785,15 @@ namespace CartesianKernelFunctors { Construct_orthogonal_vector_3; Construct_cross_product_vector_3 cp; Construct_orthogonal_vector_3 co; - public: - typedef Vector_3 result_type; + public: Construct_base_vector_3() {} Construct_base_vector_3(const Construct_cross_product_vector_3& cp_, const Construct_orthogonal_vector_3& co_) : cp(cp_), co(co_) {} - result_type + Vector_3 operator()( const Plane_3& h, int index ) const { if (index == 1) { @@ -1933,10 +1835,9 @@ namespace CartesianKernelFunctors { typedef typename K::Iso_rectangle_2 Iso_rectangle_2; typedef typename K::Triangle_2 Triangle_2; typedef typename K::Circle_2 Circle_2; - public: - typedef Bbox_2 result_type; - result_type + public: + Bbox_2 operator()(const Point_2& p) const { std::pair xp = CGAL_NTS to_interval(p.x()); @@ -1944,11 +1845,11 @@ namespace CartesianKernelFunctors { return Bbox_2(xp.first, yp.first, xp.second, yp.second); } - result_type + Bbox_2 operator()(const Segment_2& s) const { return s.source().bbox() + s.target().bbox(); } - result_type + Bbox_2 operator()(const Triangle_2& t) const { Bbox_2 bb = this->operator()(t.vertex(0)); @@ -1968,14 +1869,14 @@ namespace CartesianKernelFunctors { */ } - result_type + Bbox_2 operator()(const Iso_rectangle_2& r) const { typename K::Construct_bbox_2 construct_bbox_2; return construct_bbox_2((r.min)()) + construct_bbox_2((r.max)()); } - result_type + Bbox_2 operator()(const Circle_2& c) const { typename K::Construct_bbox_2 construct_bbox_2; @@ -2006,9 +1907,8 @@ namespace CartesianKernelFunctors { typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Sphere_3 Sphere_3; typedef typename K::Circle_3 Circle_3; - public: - typedef Bbox_3 result_type; + public: Bbox_3 operator()(const Point_3& p) const { @@ -2070,7 +1970,7 @@ namespace CartesianKernelFunctors { maxx.sup(), maxy.sup(), maxz.sup()); } - Bbox_3 + decltype(auto) operator()(const Circle_3& c) const { return c.rep().bbox(); } @@ -2083,10 +1983,9 @@ namespace CartesianKernelFunctors { typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; - public: - typedef Line_2 result_type; - result_type + public: + Line_2 operator()(const Point_2& p, const Point_2& q) const { FT a, b, c; @@ -2094,7 +1993,7 @@ namespace CartesianKernelFunctors { return Line_2(a, b, c); } - result_type + Line_2 operator()(const Line_2& p, const Line_2& q) const { FT a, b, c; @@ -2111,10 +2010,9 @@ namespace CartesianKernelFunctors { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Plane_3 Plane_3; - public: - typedef Plane_3 result_type; - result_type + public: + Plane_3 operator()(const Point_3& p, const Point_3& q) const { FT a, b, c, d; @@ -2124,7 +2022,7 @@ namespace CartesianKernelFunctors { return Plane_3(a, b, c, d); } - result_type + Plane_3 operator()(const Plane_3& p, const Plane_3& q) const { FT a, b, c, d; @@ -2141,10 +2039,9 @@ namespace CartesianKernelFunctors { typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Triangle_2 Triangle_2; - public: - typedef Point_2 result_type; - result_type + public: + Point_2 operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { typename K::Construct_point_2 construct_point_2; @@ -2153,13 +2050,13 @@ namespace CartesianKernelFunctors { return construct_point_2(x, y); } - result_type + Point_2 operator()(const Triangle_2& t) const { return this->operator()(t.vertex(0), t.vertex(1), t.vertex(2)); } - result_type + Point_2 operator()(const Point_2& p, const Point_2& q, const Point_2& r, const Point_2& s) const { @@ -2177,10 +2074,9 @@ namespace CartesianKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Triangle_3 Triangle_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; - public: - typedef Point_3 result_type; - result_type + public: + Point_3 operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { typename K::Construct_point_3 construct_point_3; @@ -2192,7 +2088,7 @@ namespace CartesianKernelFunctors { return construct_point_3(x, y, z); } - result_type + Point_3 operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { @@ -2206,13 +2102,13 @@ namespace CartesianKernelFunctors { return construct_point_3(x, y, z); } - result_type + Point_3 operator()(const Triangle_3& t) const { return this->operator()(t.vertex(0), t.vertex(1), t.vertex(2)); } - result_type + Point_3 operator()(const Tetrahedron_3& t) const { return this->operator()(t.vertex(0), t.vertex(1), @@ -2225,9 +2121,8 @@ namespace CartesianKernelFunctors { { typedef typename K::Point_2 Point_2; typedef typename K::Triangle_2 Triangle_2; - public: - typedef Point_2 result_type; + public: Point_2 operator()(const Point_2& p, const Point_2& q) const { @@ -2235,7 +2130,7 @@ namespace CartesianKernelFunctors { return construct_midpoint_2(p, q); } - result_type + Point_2 operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { typename K::Construct_point_2 construct_point_2; @@ -2245,7 +2140,7 @@ namespace CartesianKernelFunctors { return construct_point_2(x, y); } - result_type + Point_2 operator()(const Triangle_2& t) const { return this->operator()(t.vertex(0), t.vertex(1), t.vertex(2)); @@ -2259,9 +2154,8 @@ namespace CartesianKernelFunctors { typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Triangle_3 Triangle_3; typedef typename K::Point_3 Point_3; - public: - typedef Point_3 result_type; + public: Point_3 operator()(const Point_3& p, const Point_3& q) const { @@ -2313,9 +2207,8 @@ namespace CartesianKernelFunctors { class Construct_cross_product_vector_3 { typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()(const Vector_3& v, const Vector_3& w) const { @@ -2334,15 +2227,14 @@ namespace CartesianKernelFunctors { typedef typename K::Construct_base_vector_3 Construct_base_vector_3; typedef typename K::Construct_point_on_3 Construct_point_on_3; typedef typename K::Construct_scaled_vector_3 Construct_scaled_vector_3; - typedef typename K::Construct_translated_point_3 - Construct_translated_point_3; + typedef typename K::Construct_translated_point_3 Construct_translated_point_3; + Construct_base_vector_3 cb; Construct_point_on_3 cp; Construct_scaled_vector_3 cs; Construct_translated_point_3 ct; - public: - typedef Point_3 result_type; + public: Construct_lifted_point_3() {} Construct_lifted_point_3(const Construct_base_vector_3& cb_, const Construct_point_on_3& cp_, @@ -2371,8 +2263,6 @@ namespace CartesianKernelFunctors { typedef typename K::RT RT; public: - typedef Direction_2 result_type; - Rep // Direction_2 operator()(Return_base_tag, const RT& x, const RT& y) const { return Rep(x, y); } @@ -2447,9 +2337,8 @@ namespace CartesianKernelFunctors { typedef typename K::Segment_3 Segment_3; typedef typename K::RT RT; typedef typename Direction_3::Rep Rep; - public: - typedef Direction_3 result_type; + public: Rep // Direction_3 operator()(Return_base_tag, const RT& x, const RT& y, const RT& z) const { return Rep(x, y, z); } @@ -2500,9 +2389,8 @@ namespace CartesianKernelFunctors { typedef typename K::Vector_3 Vector_3; typedef typename K::Line_3 Line_3; typedef typename Line_3::Rep Rep; - public: - typedef Line_3 result_type; + public: Line_3 operator()( const Point_3& p, const Point_3& q, const Point_3& s) const { @@ -2552,7 +2440,6 @@ namespace CartesianKernelFunctors { FT z = s.z() + num_z*inv; return Rep(Point_3(x, y, z), Vector_3(rsx, rsy, rsz)); } - }; template @@ -2565,8 +2452,6 @@ namespace CartesianKernelFunctors { typedef typename Iso_rectangle_2::Rep Rep; public: - typedef Iso_rectangle_2 result_type; - Rep // Iso_rectangle_2 operator()(Return_base_tag, const Point_2& p, const Point_2& q, int) const { @@ -2670,10 +2555,10 @@ namespace CartesianKernelFunctors { typedef typename K::Line_2 Line_2; typedef typename Line_2::Rep Rep; typedef typename K::Construct_point_on_2 Construct_point_on_2; - Construct_point_on_2 c; - public: - typedef Line_2 result_type; + Construct_point_on_2 c; + + public: Construct_line_2() {} Construct_line_2(const Construct_point_on_2& c_) : c(c_) {} @@ -2749,9 +2634,8 @@ namespace CartesianKernelFunctors { typedef typename K::Line_3 Line_3; typedef typename K::Vector_3 Vector_3; typedef typename Line_3::Rep Rep; - public: - typedef Line_3 result_type; + public: Rep // Line_3 operator()(Return_base_tag, const Point_3& p, const Point_3& q) const { return Rep(p, Vector_3(p, q)); } @@ -2800,9 +2684,8 @@ namespace CartesianKernelFunctors { typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Segment_2 Segment_2; - public: - typedef Point_2 result_type; + public: Point_2 operator()(const Point_2& p, const Point_2& q) const { @@ -2830,9 +2713,8 @@ namespace CartesianKernelFunctors { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Segment_3 Segment_3; - public: - typedef Point_3 result_type; + public: Point_3 operator()(const Point_3& p, const Point_3& q) const { @@ -2858,9 +2740,8 @@ namespace CartesianKernelFunctors { class Construct_opposite_vector_2 { typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()( const Vector_2& v) const { return Vector_2(-v.x(), -v.y()); } @@ -2870,9 +2751,8 @@ namespace CartesianKernelFunctors { class Construct_difference_of_vectors_2 { typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()( const Vector_2& v, const Vector_2& w) const { return Vector_2(v.x()-w.x(), v.y()-w.y()); } @@ -2882,9 +2762,8 @@ namespace CartesianKernelFunctors { class Construct_difference_of_vectors_3 { typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()( const Vector_3& v, const Vector_3& w) const { return Vector_3(v.x()-w.x(), v.y()-w.y(), v.z()-w.z()); } @@ -2898,8 +2777,6 @@ namespace CartesianKernelFunctors { typedef typename K::Weighted_point_2 Weighted_point_2; typedef typename K::Line_2 Line_2; - typedef Line_2 result_type; - Line_2 operator() ( const Weighted_point_2 & p, const Weighted_point_2 & q) const { @@ -2917,9 +2794,8 @@ namespace CartesianKernelFunctors { class Construct_sum_of_vectors_2 { typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()( const Vector_2& v, const Vector_2& w) const { return Vector_2(v.x()+w.x(), v.y()+w.y()); } @@ -2929,9 +2805,8 @@ namespace CartesianKernelFunctors { class Construct_sum_of_vectors_3 { typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()( const Vector_3& v, const Vector_3& w) const { return Vector_3(v.x()+w.x(), v.y()+w.y(), v.z()+w.z()); } @@ -2941,9 +2816,8 @@ namespace CartesianKernelFunctors { class Construct_opposite_vector_3 { typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()( const Vector_3& v) const { return Vector_3(-v.x(), -v.y(), -v.z()); } @@ -2956,9 +2830,8 @@ namespace CartesianKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::Plane_3 Plane_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()( const Plane_3& p ) const { return Vector_3(p.a(), p.b(), p.c()); } @@ -2998,9 +2871,8 @@ namespace CartesianKernelFunctors { class Construct_perpendicular_vector_2 { typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()( const Vector_2& v, Orientation o) const { @@ -3016,9 +2888,8 @@ namespace CartesianKernelFunctors { class Construct_perpendicular_direction_2 { typedef typename K::Direction_2 Direction_2; - public: - typedef Direction_2 result_type; + public: Direction_2 operator()( const Direction_2& d, Orientation o) const { @@ -3036,9 +2907,8 @@ namespace CartesianKernelFunctors { { typedef typename K::Line_2 Line_2; typedef typename K::Point_2 Point_2; - public: - typedef Line_2 result_type; + public: Line_2 operator()( const Line_2& l, const Point_2& p) const { @@ -3058,24 +2928,9 @@ namespace CartesianKernelFunctors { typedef typename K::Weighted_point_2 Weighted_point_2; typedef typename K::Line_2 Line_2; typedef typename Point_2::Rep Rep; + public: - - template - struct result { - typedef Point_2 type; - }; - - template - struct result { - typedef const Point_2& type; - }; - - template - struct result { - typedef const Point_2& type; - }; - - template + template Rep // Point_2 operator()(Return_base_tag, Args&& ...args) const { return Rep(std::forward(args)...); } @@ -3102,7 +2957,7 @@ namespace CartesianKernelFunctors { operator()(const Point_2 & p) const { return p; } - const Point_2& + decltype(auto) operator()(const Weighted_point_2 & p) const { return p.rep().point(); } @@ -3132,22 +2987,6 @@ namespace CartesianKernelFunctors { typedef typename Point_3::Rep Rep; public: - - template - struct result { - typedef Point_3 type; - }; - - template - struct result { - typedef const Point_3& type; - }; - - template - struct result { - typedef const Point_3& type; - }; - template Rep // Point_3 operator()(Return_base_tag, Args&& ...args) const @@ -3157,7 +2996,7 @@ namespace CartesianKernelFunctors { operator()(const Point_3 & p) const { return p; } - const Point_3& + decltype(auto) operator()(const Weighted_point_3 & p) const { return p.rep().point(); } @@ -3186,9 +3025,8 @@ namespace CartesianKernelFunctors { typedef typename K::Point_2 Point_2; typedef typename K::Weighted_point_2 Weighted_point_2; typedef typename Weighted_point_2::Rep Rep; - public: - typedef Weighted_point_2 result_type; + public: Rep operator()(Return_base_tag, Origin o) const { return Rep(o); } @@ -3229,9 +3067,8 @@ namespace CartesianKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Weighted_point_3 Weighted_point_3; typedef typename Weighted_point_3::Rep Rep; - public: - typedef Weighted_point_3 result_type; + public: Rep operator()(Return_base_tag, Origin o) const { return Rep(o); } @@ -3273,9 +3110,8 @@ namespace CartesianKernelFunctors { typedef typename K::Line_2 Line_2; typedef typename K::Segment_2 Segment_2; typedef typename K::Triangle_2 Triangle_2; - public: - typedef Point_2 result_type; + public: Point_2 operator()( const Line_2& l, const Point_2& p ) const { @@ -3307,16 +3143,6 @@ namespace CartesianKernelFunctors { typedef typename K::FT FT; public: - template - struct result { - typedef const Point_3 type; - }; - - template - struct result { - typedef const Point_3& type; - }; - Point_3 operator()( const Line_3& l, const Point_3& p ) const { @@ -3365,10 +3191,7 @@ namespace CartesianKernelFunctors { typedef typename K::FT FT; public: - - typedef Line_2 result_type; - - result_type + Line_2 operator() (const Circle_2 & c1, const Circle_2 & c2) const { // Concentric Circles don't have radical line @@ -3391,10 +3214,7 @@ namespace CartesianKernelFunctors { typedef typename K::FT FT; public: - - typedef Plane_3 result_type; - - result_type + Plane_3 operator() (const Sphere_3 & s1, const Sphere_3 & s2) const { // Concentric Spheres don't have radical plane @@ -3418,9 +3238,8 @@ namespace CartesianKernelFunctors { { typedef typename K::FT FT; typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()( const Vector_2& v, const FT& c) const { @@ -3433,9 +3252,8 @@ namespace CartesianKernelFunctors { { typedef typename K::FT FT; typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()( const Vector_2& v, const FT& c) const { @@ -3448,9 +3266,8 @@ namespace CartesianKernelFunctors { { typedef typename K::FT FT; typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()( const Vector_3& v, const FT& c) const { @@ -3463,9 +3280,8 @@ namespace CartesianKernelFunctors { { typedef typename K::FT FT; typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()( const Vector_3& w, const FT& c) const { @@ -3478,9 +3294,8 @@ namespace CartesianKernelFunctors { { typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; - public: - typedef Point_2 result_type; + public: Point_2 operator()( const Point_2& p, const Vector_2& v) const { @@ -3501,9 +3316,8 @@ namespace CartesianKernelFunctors { { typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; - public: - typedef Point_3 result_type; + public: Point_3 operator()( const Point_3& p, const Vector_3& v) const { @@ -3531,9 +3345,8 @@ namespace CartesianKernelFunctors { typedef typename K::Point_2 Point_2; typedef typename K::Direction_2 Direction_2; typedef typename Vector_2::Rep Rep; - public: - typedef Vector_2 result_type; + public: Rep // Vector_2 operator()(Return_base_tag, const Point_2& p, const Point_2& q) const { return Rep(q.x() - p.x(), q.y() - p.y()); } @@ -3635,9 +3448,8 @@ namespace CartesianKernelFunctors { typedef typename K::Vector_3 Vector_3; typedef typename K::Point_3 Point_3; typedef typename Vector_3::Rep Rep; - public: - typedef Vector_3 result_type; + public: Rep // Vector_3 operator()(Return_base_tag, const Point_3& p, const Point_3& q) const { @@ -3741,22 +3553,13 @@ namespace CartesianKernelFunctors { typedef typename K::Segment_2 Segment_2; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; typedef typename K::Triangle_2 Triangle_2; + public: - template - struct result { - typedef const Point_2& type; - }; - - template - struct result { - typedef Point_2 type; - }; - - const Point_2 & + decltype(auto) operator()( const Segment_2& s, int i) const { return s.vertex(i); } - const Point_2 & + decltype(auto) operator()( const Triangle_2& t, int i) const { return t.rep().vertex(i); } @@ -3779,6 +3582,7 @@ namespace CartesianKernelFunctors { template class Coplanar_orientation_3 { + typedef typename K::Orientation Orientation; typedef typename K::Point_3 Point_3; #ifdef CGAL_kernel_exactness_preconditions typedef typename K::Coplanar_3 Coplanar_3; @@ -3786,9 +3590,8 @@ namespace CartesianKernelFunctors { Coplanar_3 cp; Collinear_3 cl; #endif // CGAL_kernel_exactness_preconditions - public: - typedef typename K::Orientation result_type; + public: #ifdef CGAL_kernel_exactness_preconditions Coplanar_orientation_3() {} Coplanar_orientation_3(const Coplanar_3& cp_, const Collinear_3& cl_) @@ -3796,7 +3599,7 @@ namespace CartesianKernelFunctors { {} #endif // CGAL_kernel_exactness_preconditions - result_type + Orientation operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { return coplanar_orientationC3(p.x(), p.y(), p.z(), @@ -3804,7 +3607,7 @@ namespace CartesianKernelFunctors { r.x(), r.y(), r.z()); } - result_type + Orientation operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { @@ -3827,16 +3630,16 @@ namespace CartesianKernelFunctors { template class Coplanar_side_of_bounded_circle_3 { - typedef typename K::Point_3 Point_3; + typedef typename K::Bounded_side Bounded_side; + typedef typename K::Point_3 Point_3; #ifdef CGAL_kernel_exactness_preconditions typedef typename K::Coplanar_3 Coplanar_3; typedef typename K::Collinear_3 Collinear_3; Coplanar_3 cp; Collinear_3 cl; #endif // CGAL_kernel_exactness_preconditions - public: - typedef typename K::Bounded_side result_type; + public: #ifdef CGAL_kernel_exactness_preconditions Coplanar_side_of_bounded_circle_3() {} Coplanar_side_of_bounded_circle_3(const Coplanar_3& cp_, @@ -3845,7 +3648,7 @@ namespace CartesianKernelFunctors { {} #endif // CGAL_kernel_exactness_preconditions - result_type + Bounded_side operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& t) const { @@ -3865,11 +3668,11 @@ namespace CartesianKernelFunctors { template class Equal_xy_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return CGAL_AND( p.x() == q.x() , p.y() == q.y() ); @@ -3879,11 +3682,11 @@ namespace CartesianKernelFunctors { template class Equal_x_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_2& p, const Point_2& q) const { return p.x() == q.x(); } }; @@ -3891,11 +3694,11 @@ namespace CartesianKernelFunctors { template class Equal_x_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return p.x() == q.x(); } }; @@ -3903,11 +3706,11 @@ namespace CartesianKernelFunctors { template class Equal_y_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_2& p, const Point_2& q) const { return p.y() == q.y(); } }; @@ -3915,11 +3718,11 @@ namespace CartesianKernelFunctors { template class Equal_y_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return p.y() == q.y(); } }; @@ -3927,11 +3730,11 @@ namespace CartesianKernelFunctors { template class Equal_z_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return p.z() == q.z(); } }; @@ -3939,6 +3742,7 @@ namespace CartesianKernelFunctors { template class Has_on_3 { + typedef typename K::Boolean Boolean; typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; @@ -3949,30 +3753,29 @@ namespace CartesianKernelFunctors { typedef typename K::Triangle_3 Triangle_3; typedef typename K::Circle_3 Circle_3; typedef typename K::Sphere_3 Sphere_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Line_3& l, const Point_3& p) const { return l.rep().has_on(p); } - result_type + Boolean operator()( const Ray_3& r, const Point_3& p) const { return r.rep().has_on(p); } - result_type + Boolean operator()( const Segment_3& s, const Point_3& p) const { return s.rep().has_on(p); } - result_type + Boolean operator()( const Plane_3& pl, const Point_3& p) const { return pl.rep().has_on(p); } - result_type + Boolean operator()( const Plane_3& pl, const Line_3& l) const { return pl.rep().has_on(l); } - result_type + Boolean operator()( const Triangle_3& t, const Point_3& p) const { Point_3 o = t.vertex(0) + t.supporting_plane().orthogonal_vector(); @@ -3986,19 +3789,19 @@ namespace CartesianKernelFunctors { && ((alpha+beta+gamma == denum)); } - result_type + Boolean operator()(const Circle_3 &a, const Point_3 &p) const { return a.rep().has_on(p); } - Needs_FT + Needs_FT operator()(const Sphere_3 &a, const Circle_3 &p) const { return a.rep().has_on(p); } - result_type + Boolean operator()(const Sphere_3 &a, const Point_3 &p) const { return a.rep().has_on(p); } - result_type + Boolean operator()(const Plane_3 &a, const Circle_3 &p) const { return a.rep().has_on(p); } @@ -4008,11 +3811,11 @@ namespace CartesianKernelFunctors { template class Less_distance_to_point_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { return has_smaller_dist_to_pointC2(p.x(), p.y(), @@ -4024,11 +3827,11 @@ namespace CartesianKernelFunctors { template class Less_distance_to_point_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { return has_smaller_dist_to_pointC3(p.x(), p.y(), p.z(), @@ -4041,13 +3844,13 @@ namespace CartesianKernelFunctors { template class Less_signed_distance_to_line_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; typedef typename K::Equal_2 Equal_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_2& a, const Point_2& b, const Point_2& c, const Point_2& d) const { @@ -4059,7 +3862,7 @@ namespace CartesianKernelFunctors { d.x(), d.y()) == SMALLER; } - result_type + Boolean operator()(const Line_2& l, const Point_2& p, const Point_2& q) const { return has_smaller_signed_dist_to_directionC2(l.a(), l.b(), @@ -4071,13 +3874,13 @@ namespace CartesianKernelFunctors { template class Less_signed_distance_to_plane_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Plane_3 Plane_3; typedef typename K::Collinear_3 Collinear_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Plane_3& h, const Point_3& p, const Point_3& q) const { return has_smaller_signed_dist_to_directionC3(h.a(), h.b(), h.c(), @@ -4085,7 +3888,7 @@ namespace CartesianKernelFunctors { q.x(), q.y(), q.z()); } - result_type + Boolean operator()( const Point_3& hp, const Point_3& hq, const Point_3& hr, const Point_3& p, const Point_3& q) const { @@ -4102,16 +3905,17 @@ namespace CartesianKernelFunctors { template class Less_xyz_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Compare_xyz_3 Compare_xyz_3; - Compare_xyz_3 c; - public: - typedef typename K::Boolean result_type; + Compare_xyz_3 c; + + public: Less_xyz_3() {} Less_xyz_3(const Compare_xyz_3& c_) : c(c_) {} - result_type + Boolean operator()( const Point_3& p, const Point_3& q) const { return c(p, q) == SMALLER; } }; @@ -4119,16 +3923,17 @@ namespace CartesianKernelFunctors { template class Less_xy_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Compare_xy_2 Compare_xy_2; - Compare_xy_2 c; - public: - typedef typename K::Boolean result_type; + Compare_xy_2 c; + + public: Less_xy_2() {} Less_xy_2(const Compare_xy_2& c_) : c(c_) {} - result_type + Boolean operator()( const Point_2& p, const Point_2& q) const { return c(p, q) == SMALLER; } }; @@ -4136,16 +3941,17 @@ namespace CartesianKernelFunctors { template class Less_xy_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Compare_xy_3 Compare_xy_3; - Compare_xy_3 c; - public: - typedef typename K::Boolean result_type; + Compare_xy_3 c; + + public: Less_xy_3() {} Less_xy_3(const Compare_xy_3& c_) : c(c_) {} - result_type + Boolean operator()( const Point_3& p, const Point_3& q) const { return c(p, q) == SMALLER; } }; @@ -4153,11 +3959,11 @@ namespace CartesianKernelFunctors { template class Less_x_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_2& p, const Point_2& q) const { return p.x() < q.x(); } }; @@ -4165,11 +3971,11 @@ namespace CartesianKernelFunctors { template class Less_x_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return p.x() < q.x(); } }; @@ -4177,11 +3983,11 @@ namespace CartesianKernelFunctors { template class Less_yx_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_2& p, const Point_2& q) const { return compare_lexicographically_xyC2(p.y(), p.x(), @@ -4192,11 +3998,11 @@ namespace CartesianKernelFunctors { template class Less_y_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_2& p, const Point_2& q) const { return p.y() < q.y(); } }; @@ -4204,11 +4010,11 @@ namespace CartesianKernelFunctors { template class Less_y_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return p.y() < q.y(); } }; @@ -4216,11 +4022,11 @@ namespace CartesianKernelFunctors { template class Less_z_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return p.z() < q.z(); } }; @@ -4228,24 +4034,25 @@ namespace CartesianKernelFunctors { template class Orientation_2 { + typedef typename K::Orientation Orientation; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; typedef typename K::Circle_2 Circle_2; - public: - typedef typename K::Orientation result_type; - result_type operator()(const Point_2& p, const Point_2& q, const Point_2& r) const + public: + Orientation + operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { return orientationC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y()); } - result_type + Orientation operator()(const Vector_2& u, const Vector_2& v) const { return orientationC2(u.x(), u.y(), v.x(), v.y()); } - result_type + Orientation operator()(const Circle_2& c) const { return c.rep().orientation(); @@ -4255,14 +4062,14 @@ namespace CartesianKernelFunctors { template class Orientation_3 { + typedef typename K::Orientation Orientation; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Sphere_3 Sphere_3; - public: - typedef typename K::Orientation result_type; - result_type + public: + Orientation operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { @@ -4272,7 +4079,7 @@ namespace CartesianKernelFunctors { s.x(), s.y(), s.z()); } - result_type + Orientation operator()( const Vector_3& u, const Vector_3& v, const Vector_3& w) const { return orientationC3(u.x(), u.y(), u.z(), @@ -4280,7 +4087,7 @@ namespace CartesianKernelFunctors { w.x(), w.y(), w.z()); } - result_type + Orientation operator()( Origin, const Point_3& u, const Point_3& v, const Point_3& w) const { @@ -4289,13 +4096,13 @@ namespace CartesianKernelFunctors { w.x(), w.y(), w.z()); } - result_type + Orientation operator()( const Tetrahedron_3& t) const { return t.rep().orientation(); } - result_type + Orientation operator()(const Sphere_3& s) const { return s.rep().orientation(); @@ -4306,10 +4113,8 @@ namespace CartesianKernelFunctors { class Power_side_of_oriented_power_circle_2 { public: - typedef typename K::Weighted_point_2 Weighted_point_2; typedef typename K::Oriented_side Oriented_side; - - typedef Oriented_side result_type; + typedef typename K::Weighted_point_2 Weighted_point_2; Oriented_side operator()(const Weighted_point_2& p, const Weighted_point_2& q, @@ -4358,24 +4163,24 @@ namespace CartesianKernelFunctors { template class Oriented_side_2 { + typedef typename K::Oriented_side Oriented_side; typedef typename K::Point_2 Point_2; typedef typename K::Circle_2 Circle_2; typedef typename K::Line_2 Line_2; typedef typename K::Triangle_2 Triangle_2; typedef typename K::Segment_2 Segment_2; typedef typename K::FT FT; - public: - typedef typename K::Oriented_side result_type; - result_type + public: + Oriented_side operator()( const Circle_2& c, const Point_2& p) const { return enum_cast(c.bounded_side(p)) * c.orientation(); } - result_type + Oriented_side operator()( const Line_2& l, const Point_2& p) const { return side_of_oriented_lineC2(l.a(), l.b(), l.c(), p.x(), p.y()); } - result_type + Oriented_side operator()( const Triangle_2& t, const Point_2& p) const { typename K::Collinear_are_ordered_along_line_2 @@ -4389,7 +4194,8 @@ namespace CartesianKernelFunctors { ot = orientation(t.vertex(0), t.vertex(1), t.vertex(2)); if (o1 == ot && o2 == ot && o3 == ot) // ot cannot be COLLINEAR - return ot; + return enum_cast(ot); + return (o1 == COLLINEAR && collinear_are_ordered_along_line(t.vertex(0), p, t.vertex(1))) || @@ -4397,11 +4203,10 @@ namespace CartesianKernelFunctors { && collinear_are_ordered_along_line(t.vertex(1), p, t.vertex(2))) || (o3 == COLLINEAR && collinear_are_ordered_along_line(t.vertex(2), p, t.vertex(3))) - ? result_type(ON_ORIENTED_BOUNDARY) - : opposite(ot); + ? Oriented_side(ON_ORIENTED_BOUNDARY) : opposite(ot); } - result_type + Oriented_side operator()(const Segment_2& s, const Triangle_2& t) const { typename K::Construct_source_2 source; @@ -4429,11 +4234,11 @@ namespace CartesianKernelFunctors { template class Side_of_bounded_circle_2 { + typedef typename K::Bounded_side Bounded_side; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Bounded_side result_type; - result_type + public: + Bounded_side operator()( const Point_2& p, const Point_2& q, const Point_2& t) const { return side_of_bounded_circleC2(p.x(), p.y(), @@ -4441,7 +4246,7 @@ namespace CartesianKernelFunctors { t.x(), t.y()); } - result_type + Bounded_side operator()( const Point_2& p, const Point_2& q, const Point_2& r, const Point_2& t) const { @@ -4453,11 +4258,11 @@ namespace CartesianKernelFunctors { template class Side_of_bounded_sphere_3 { + typedef typename K::Bounded_side Bounded_side; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Bounded_side result_type; - result_type + public: + Bounded_side operator()( const Point_3& p, const Point_3& q, const Point_3& test) const { return side_of_bounded_sphereC3(p.x(), p.y(), p.z(), @@ -4465,7 +4270,7 @@ namespace CartesianKernelFunctors { test.x(), test.y(), test.z()); } - result_type + Bounded_side operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& test) const { @@ -4475,7 +4280,7 @@ namespace CartesianKernelFunctors { test.x(), test.y(), test.z()); } - result_type + Bounded_side operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s, const Point_3& test) const { @@ -4490,11 +4295,11 @@ namespace CartesianKernelFunctors { template class Side_of_oriented_circle_2 { + typedef typename K::Oriented_side Oriented_side; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Oriented_side result_type; - result_type + public: + Oriented_side operator()( const Point_2& p, const Point_2& q, const Point_2& r, const Point_2& t) const { @@ -4508,11 +4313,11 @@ namespace CartesianKernelFunctors { template class Side_of_oriented_sphere_3 { + typedef typename K::Oriented_side Oriented_side; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Oriented_side result_type; - result_type + public: + Oriented_side operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s, const Point_3& test) const { diff --git a/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_2.h b/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_2.h index 659b17f995f..3941d1b0fdf 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_2.h @@ -24,7 +24,7 @@ namespace CGAL { template < class K > inline -bool +typename K::Boolean equal_xy(const PointC2 &p, const PointC2 &q) { return CGAL_AND( p.x() == q.x() , p.y() == q.y() ); @@ -34,7 +34,7 @@ equal_xy(const PointC2 &p, const PointC2 &q) // Unused, undocumented, un-functorized. template < class K > inline -Comparison_result +typename K::Comparison_result compare_deltax_deltay(const PointC2& p, const PointC2& q, const PointC2& r, @@ -46,7 +46,7 @@ compare_deltax_deltay(const PointC2& p, template < class K > inline -Comparison_result +typename K::Comparison_result compare_lexicographically_yx(const PointC2 &p, const PointC2 &q) { diff --git a/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_3.h b/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_3.h index c3a7d37aabf..35c2e3a2c32 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_3.h @@ -24,7 +24,7 @@ namespace CGAL { template < class K > inline -bool +typename K::Boolean equal_xy(const PointC3 &p, const PointC3 &q) { return K().equal_xy_3_object()(p, q); @@ -32,7 +32,7 @@ equal_xy(const PointC3 &p, const PointC3 &q) template < class K > inline -bool +typename K::Boolean equal_xyz(const PointC3 &p, const PointC3 &q) { return p.x() == q.x() && p.y() == q.y() && p.z() == q.z(); @@ -40,7 +40,7 @@ equal_xyz(const PointC3 &p, const PointC3 &q) template < class K > inline -Comparison_result +typename K::Comparison_result compare_xy(const PointC3 &p, const PointC3 &q) { return K().compare_xy_3_object()(p, q); @@ -48,7 +48,7 @@ compare_xy(const PointC3 &p, const PointC3 &q) template < class K > inline -Comparison_result +typename K::Comparison_result compare_lexicographically_xy(const PointC3 &p, const PointC3 &q) { return K().compare_xy_3_object()(p, q); @@ -56,7 +56,7 @@ compare_lexicographically_xy(const PointC3 &p, const PointC3 &q) template < class K > inline -bool +typename K::Boolean lexicographically_xy_smaller_or_equal(const PointC3 &p, const PointC3 &q) { @@ -65,7 +65,7 @@ lexicographically_xy_smaller_or_equal(const PointC3 &p, template < class K > inline -bool +typename K::Boolean lexicographically_xy_smaller(const PointC3 &p, const PointC3 &q) { @@ -74,7 +74,7 @@ lexicographically_xy_smaller(const PointC3 &p, template < class K > inline -bool +typename K::Boolean strict_dominance(const PointC3 &p, const PointC3 &q) { @@ -84,7 +84,7 @@ strict_dominance(const PointC3 &p, template < class K > inline -bool +typename K::Boolean dominance(const PointC3 &p, const PointC3 &q) { diff --git a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h index 56903c2c921..1f1d912e0d2 100644 --- a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h +++ b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h @@ -421,6 +421,7 @@ typename Same_uncertainty_nt::type angleC2(const FT &ux, const FT &uy, const FT &vx, const FT &vy) { + typedef typename Same_uncertainty_nt::type Angle; return enum_cast(CGAL_NTS sign(ux*vx + uy*vy)); } @@ -431,6 +432,7 @@ angleC2(const FT &px, const FT &py, const FT &qx, const FT &qy, const FT &rx, const FT &ry) { + typedef typename Same_uncertainty_nt::type Angle; return enum_cast(CGAL_NTS sign((px-qx)*(rx-qx)+(py-qy)*(ry-qy))); } @@ -442,6 +444,7 @@ angleC2(const FT &px, const FT &py, const FT &rx, const FT &ry, const FT &sx, const FT &sy) { + typedef typename Same_uncertainty_nt::type Angle; return enum_cast(CGAL_NTS sign((px-qx)*(rx-sx)+(py-qy)*(ry-sy))); } @@ -508,6 +511,7 @@ side_of_bounded_circleC2(const FT &px, const FT &py, const FT &rx, const FT &ry, const FT &tx, const FT &ty) { + typedef typename Same_uncertainty_nt::type Bounded_side; return enum_cast( side_of_oriented_circleC2(px,py,qx,qy,rx,ry,tx,ty) * orientationC2(px,py,qx,qy,rx,ry) ); } @@ -520,8 +524,8 @@ side_of_bounded_circleC2(const FT &px, const FT &py, const FT &tx, const FT &ty) { // Returns whether T lies inside or outside the circle which diameter is PQ. - return enum_cast( - CGAL_NTS compare((tx-px)*(qx-tx), (ty-py)*(ty-qy)) ); + typedef typename Same_uncertainty_nt::type Bounded_side; + return enum_cast(CGAL_NTS compare((tx-px)*(qx-tx), (ty-py)*(ty-qy)) ); } template < class FT > @@ -630,7 +634,7 @@ side_of_oriented_lineC2(const FT &a, const FT &b, const FT &c, } template -Comparison_result +typename Compare::result_type compare_power_distanceC2(const FT& px, const FT& py, const FT& pwt, const FT& qx, const FT& qy, const FT& qwt, const FT& rx, const FT& ry) @@ -643,24 +647,25 @@ compare_power_distanceC2(const FT& px, const FT& py, const FT& pwt, template CGAL_KERNEL_MEDIUM_INLINE -Bounded_side +typename Same_uncertainty_nt::type power_side_of_bounded_power_circleC2(const FT &px, const FT &py, const FT &pw, const FT &qx, const FT &qy, const FT &qw, const FT &tx, const FT &ty, const FT &tw) { + typedef typename Same_uncertainty_nt::type Bounded_side; + FT dpx = px - qx; FT dpy = py - qy; FT dtx = tx - qx; FT dty = ty - qy; FT dpz = CGAL_NTS square(dpx) + CGAL_NTS square(dpy); - return enum_cast - (CGAL_NTS sign(-(CGAL_NTS square(dtx) + CGAL_NTS square(dty)-tw+qw)*dpz + return enum_cast(CGAL_NTS sign(-(CGAL_NTS square(dtx) + CGAL_NTS square(dty)-tw+qw)*dpz +(dpz-pw+qw)*(dpx*dtx+dpy*dty))); } template -Oriented_side +typename Same_uncertainty_nt::type power_side_of_oriented_power_circleC2(const FT &px, const FT &py, const FT &pwt, const FT &qx, const FT &qy, const FT &qwt, const FT &rx, const FT &ry, const FT &rwt, @@ -685,7 +690,7 @@ power_side_of_oriented_power_circleC2(const FT &px, const FT &py, const FT &pwt, } template -Oriented_side +typename Same_uncertainty_nt::type power_side_of_oriented_power_circleC2(const FT &px, const FT &py, const FT &pwt, const FT &qx, const FT &qy, const FT &qwt, const FT &tx, const FT &ty, const FT &twt) @@ -709,7 +714,7 @@ power_side_of_oriented_power_circleC2(const FT &px, const FT &py, const FT &pwt, } template -Oriented_side +typename Same_uncertainty_nt::type circumcenter_oriented_side_of_oriented_segmentC2(const FT& ax, const FT& ay, const FT& bx, const FT& by, const FT& p0x, const FT& p0y, diff --git a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h index 86bf5f74bd2..2d6fe0e53be 100644 --- a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h +++ b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h @@ -143,6 +143,7 @@ typename Same_uncertainty_nt::type angleC3(const FT &ux, const FT &uy, const FT &uz, const FT &vx, const FT &vy, const FT &vz) { + typedef typename Same_uncertainty_nt::type Angle; return enum_cast(CGAL_NTS sign(ux*vx + uy*vy + uz*vz)); } @@ -153,6 +154,7 @@ angleC3(const FT &px, const FT &py, const FT &pz, const FT &qx, const FT &qy, const FT &qz, const FT &rx, const FT &ry, const FT &rz) { + typedef typename Same_uncertainty_nt::type Angle; return enum_cast(CGAL_NTS sign((px-qx)*(rx-qx)+ (py-qy)*(ry-qy)+ (pz-qz)*(rz-qz))); @@ -166,6 +168,7 @@ angleC3(const FT &px, const FT &py, const FT &pz, const FT &rx, const FT &ry, const FT &rz, const FT &sx, const FT &sy, const FT &sz) { + typedef typename Same_uncertainty_nt::type Angle; return enum_cast(CGAL_NTS sign((px-qx)*(rx-sx)+ (py-qy)*(ry-sy)+ (pz-qz)*(rz-sz))); @@ -220,6 +223,8 @@ coplanar_side_of_bounded_circleC3(const FT &px, const FT &py, const FT &pz, const FT &rx, const FT &ry, const FT &rz, const FT &tx, const FT &ty, const FT &tz) { + typedef typename Same_uncertainty_nt::type Bounded_side; + // The approach is to compute side_of_bounded_sphere(p,q,r,t+v,t), // with v = pq ^ pr. // Note : since the circle defines the orientation of the plane, it can not @@ -373,6 +378,7 @@ side_of_bounded_sphereC3(const FT &px, const FT &py, const FT &pz, const FT &sx, const FT &sy, const FT &sz, const FT &tx, const FT &ty, const FT &tz) { + typedef typename Same_uncertainty_nt::type Bounded_side; return enum_cast( side_of_oriented_sphereC3(px, py, pz, qx, qy, qz, rx, ry, rz, @@ -392,6 +398,7 @@ side_of_bounded_sphereC3(const FT &px, const FT &py, const FT &pz, const FT &tx, const FT &ty, const FT &tz) { // Returns whether T lies inside or outside the sphere which diameter is PQ. + typedef typename Same_uncertainty_nt::type Bounded_side; return enum_cast( CGAL_NTS sign((tx-px)*(qx-tx) + (ty-py)*(qy-ty) + (tz-pz)*(qz-tz)) ); @@ -420,9 +427,9 @@ side_of_bounded_sphereC3(const FT &px, const FT &py, const FT &pz, { // Returns whether T lies inside or outside the sphere which equatorial // circle is PQR. + typedef typename Same_uncertainty_nt::type Bounded_side; // This code is inspired by the one of circumcenterC3(3 points). - FT psx = px-sx; FT psy = py-sy; FT psz = pz-sz; @@ -688,7 +695,7 @@ power_side_of_oriented_power_sphereC3(const FT &pwt, const FT &qwt) } template < class FT > -Comparison_result +typename Compare::result_type compare_power_distanceC3(const FT &px, const FT &py, const FT &pz, const FT &qx, const FT &qy, const FT &qz, const FT &qw, const FT &rx, const FT &ry, const FT &rz, const FT &rw) @@ -715,6 +722,8 @@ power_side_of_bounded_power_sphereC3( const FT &rx, const FT &ry, const FT &rz, const FT &rw, const FT &sx, const FT &sy, const FT &sz, const FT &sw) { + typedef typename Same_uncertainty_nt::type Bounded_side; + // Translate p to origin and compute determinants FT qpx = qx-px; FT qpy = qy-py; @@ -765,6 +774,8 @@ power_side_of_bounded_power_sphereC3( const FT &qx, const FT &qy, const FT &qz, const FT &qw, const FT &rx, const FT &ry, const FT &rz, const FT &rw) { + typedef typename Same_uncertainty_nt::type Bounded_side; + FT FT2(2); FT dpx = px - qx; FT dpy = py - qy; diff --git a/Circular_kernel_2/examples/Circular_kernel_2/functor_has_on_2.cpp b/Circular_kernel_2/examples/Circular_kernel_2/functor_has_on_2.cpp index eba947c1d37..8efde8736ee 100644 --- a/Circular_kernel_2/examples/Circular_kernel_2/functor_has_on_2.cpp +++ b/Circular_kernel_2/examples/Circular_kernel_2/functor_has_on_2.cpp @@ -5,6 +5,7 @@ typedef CGAL::Exact_circular_kernel_2 Circular_k; typedef CGAL::Point_2 Point_2; typedef CGAL::Circular_arc_2 Circular_arc_2; +typedef CGAL::Circular_arc_point_2 Circular_arc_point_2; int main() { @@ -13,8 +14,8 @@ int main() for(int i = 0; i <= 10; i++) { for(int j = 0; j <= 10; j++) { - Point_2 p = Point_2(i, j); - if(Circular_k().has_on_2_object()(c,p)) { + Circular_arc_point_2 cap(Point_2(i, j)); + if(Circular_k().has_on_2_object()(c,cap)) { n++; std::cout << "(" << i << "," << j << ")" << std::endl; } diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_on_circle_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_on_circle_2.h index a1890928e7d..1454b4f9cff 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_on_circle_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_on_circle_2.h @@ -31,25 +31,29 @@ namespace CGAL { namespace CircularFunctors { template < class CK > - class Construct_circle_2 : public CK::Linear_kernel::Construct_circle_2 + class Construct_circle_2 + // : public CK::Linear_kernel::Construct_circle_2 { - typedef typename CK::Linear_kernel::Construct_circle_2 Base_functor; - typedef typename CK::FT FT; - typedef typename CK::Linear_kernel::Point_2 Point_2; + typedef typename CK::Circle_2 Circle_2; + typedef typename CK::Circular_arc_2 Circular_arc_2; + + typedef typename CK::Linear_kernel::Construct_circle_2 Linear_Construct_circle_2; + public: - typedef typename Base_functor::result_type result_type; + // using Linear_Construct_circle_2::operator(); - using Base_functor::operator(); + template + decltype(auto) + operator()(const Args&... args) const + { return Linear_Construct_circle_2()(args...); } - typedef typename CK::Circular_arc_2 Circular_arc_2; - - result_type + Circle_2 operator() ( const typename CK::Polynomial_for_circles_2_2 &eq ) { return construct_circle_2(eq); } - result_type + decltype(auto) operator() (const Circular_arc_2 & a) const { return (a.rep().supporting_circle()); } diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_on_line_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_on_line_2.h index fba7f0f1d74..8209e845a92 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_on_line_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_on_line_2.h @@ -30,26 +30,32 @@ namespace CGAL { namespace LinearFunctors { template < class CK > - class Construct_line_2 : public CK::Linear_kernel::Construct_line_2 + class Construct_line_2 + // : public CK::Linear_kernel::Construct_line_2 { - typedef typename CK::Line_arc_2 Line_arc_2; + typedef typename CK::Line_arc_2 Line_arc_2; typedef typename CK::Line_2 Line_2; - public: - typedef typename CK::Linear_kernel::Construct_line_2::result_type - result_type; - using CK::Linear_kernel::Construct_line_2::operator(); + typedef typename CK::Linear_kernel::Construct_line_2 Linear_Construct_circle_2; - result_type operator() (const Line_arc_2 & a) const + public: + // using CK::Linear_kernel::Construct_line_2::operator(); + + template + decltype(auto) + operator()(const Args&... args) const + { return Linear_Construct_circle_2()(args...); } + + decltype(auto) operator() (const Line_arc_2 & a) const { return (a.rep().supporting_line()); } - result_type + Line_2 operator() ( const typename CK::Polynomial_1_2 &eq ) - { - return construct_line_2(eq); - } + { + return construct_line_2(eq); + } }; } // namespace LinearFunctors 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 b68746e4a3d..e1e40b9bccc 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 @@ -30,148 +30,115 @@ namespace CGAL { namespace CircularFunctors { +#define CGAL_CIRCULAR_KERNEL_MACRO_FUNCTOR_COMPARE_(V)\ +template < class CK > \ + class Compare_ ##V## _2 {\ + /*: public CK::Linear_kernel::Compare_ ##V## _2{*/\ + typedef typename CK::Comparison_result Comparison_result;\ + typedef typename CK::Circular_arc_point_2 Circular_arc_point_2;\ + typedef typename CK::Linear_kernel::Compare_ ##V## _2 Linear_Compare_ ##V## _2;\ + public:\ + template \ + Comparison_result\ + operator()(const Args&... args) const\ + { return Linear_Compare_ ##V## _2()(args...); }\ + /*using CK::Linear_kernel::Compare_ ##V## _2::operator();*/\ + Comparison_result\ + operator() (const Circular_arc_point_2 &p0,\ + const Circular_arc_point_2 &p1) const\ + { return CircularFunctors::compare_ ##V (p0, p1); }\ + };\ - template < class CK > - class Compare_x_2 - : public CK::Linear_kernel::Compare_x_2 - { - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Point_2 Point_2; + CGAL_CIRCULAR_KERNEL_MACRO_FUNCTOR_COMPARE_(x) + CGAL_CIRCULAR_KERNEL_MACRO_FUNCTOR_COMPARE_(y) + CGAL_CIRCULAR_KERNEL_MACRO_FUNCTOR_COMPARE_(xy) - public: - - typedef typename CK::Linear_kernel::Compare_x_2::result_type result_type; - using CK::Linear_kernel::Compare_x_2::operator(); - - result_type - operator() (const Circular_arc_point_2 &p0, - const Circular_arc_point_2 &p1) const - { return CircularFunctors::compare_x(p0, p1);} - - }; - - - template < class CK > - class Compare_y_2 - : public CK::Linear_kernel::Compare_y_2 - { - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Point_2 Point_2; - - public: - - typedef typename CK::Linear_kernel::Compare_y_2::result_type result_type; - using CK::Linear_kernel::Compare_y_2::operator(); - - result_type - operator() (const Circular_arc_point_2 &p0, - const Circular_arc_point_2 &p1) const - {return CircularFunctors::compare_y(p0, p1);} - - }; - - template < class CK > - class Compare_xy_2 - : public CK::Linear_kernel::Compare_xy_2 - { - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Point_2 Point_2; - - public: - - typedef typename CK::Linear_kernel::Compare_xy_2::result_type result_type; - using CK::Linear_kernel::Compare_xy_2::operator(); - - result_type - operator() (const Circular_arc_point_2 &p0, - const Circular_arc_point_2 &p1) const - { return CircularFunctors::compare_xy(p0, p1);} - - }; +#undef CGAL_CIRCULAR_KERNEL_MACRO_FUNCTOR_COMPARE_ template < class CK > class In_x_range_2 { + typedef typename CK::Boolean Boolean; typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Line_arc_2 Line_arc_2; public: - typedef bool result_type; - - result_type + Boolean operator()(const Circular_arc_2 &a, const Circular_arc_point_2 &p) const { return CircularFunctors::point_in_x_range(a, p); } - result_type + Boolean operator()(const Line_arc_2 &a, const Circular_arc_point_2 &p) const { return CircularFunctors::point_in_x_range(a, p); } - }; - template < class CK > class Has_on_2 - : public CK::Linear_kernel::Has_on_2 + // : public CK::Linear_kernel::Has_on_2 { + typedef typename CK::Boolean Boolean; typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Line_arc_2 Line_arc_2; typedef typename CK::Circle_2 Circle_2; typedef typename CK::Line_2 Line_2; + typedef typename CK::Linear_kernel::Has_on_2 Linear_Has_on_2; + public: - typedef typename CK::Linear_kernel::Has_on_2::result_type result_type; + // using CK::Linear_kernel::Has_on_2::operator(); - using CK::Linear_kernel::Has_on_2::operator(); + template + Boolean + operator()(const A& a, const B& b) const + { return Linear_Has_on_2()(a, b); } - result_type + Boolean operator()(const Circle_2 &a, const Circular_arc_point_2 &p) const { return CircularFunctors::has_on(a, p); } - result_type + Boolean operator()(const Line_2 &a, const Circular_arc_point_2 &p) const { return LinearFunctors::has_on(a, p); } - result_type + Boolean operator()(const Circular_arc_2 &a, const Circular_arc_point_2 &p) const { return CircularFunctors::has_on(a, p); } - result_type + Boolean operator()(const Line_arc_2 &a, const Circular_arc_point_2 &p) const { return CircularFunctors::has_on(a, p); } - }; template < class CK > class Compare_y_to_right_2 { + typedef typename CK::Comparison_result Comparison_result; typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Line_arc_2 Line_arc_2; public: - typedef CGAL::Comparison_result result_type; - - result_type + Comparison_result operator()(const Circular_arc_2 &a1, const Circular_arc_2 &a2, const Circular_arc_point_2 &p) const { return CircularFunctors::compare_y_to_right(a1, a2, p); } - result_type + Comparison_result operator()(const Line_arc_2 &a1, const Line_arc_2 &a2, const Circular_arc_point_2 &p) const { return CircularFunctors::compare_y_to_right(a1, a2, p); } - result_type + Comparison_result operator()(const Line_arc_2 &a1, const Circular_arc_2 &a2, const Circular_arc_point_2 &p) const { return CircularFunctors::compare_y_to_right(a1, a2, p); } - result_type + Comparison_result operator()(const Circular_arc_2 &a1, const Line_arc_2 &a2, const Circular_arc_point_2 &p) const @@ -179,21 +146,16 @@ namespace CircularFunctors { return CGAL::SMALLER; return CGAL::LARGER; } - }; template < class CK > class Equal_2 - : public CK::Linear_kernel::Equal_2 + // : public CK::Linear_kernel::Equal_2 { - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Boolean Boolean; + typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; - - public: - typedef typename CK::Linear_kernel LK; - typedef typename LK::Equal_2 LK_Equal_2; - typedef typename CK::Point_2 Point_2; typedef typename CK::Vector_2 Vector_2; typedef typename CK::Direction_2 Direction_2; @@ -204,69 +166,78 @@ namespace CircularFunctors { typedef typename CK::Iso_rectangle_2 Iso_rectangle_2; typedef typename CK::Circle_2 Circle_2; + typedef typename CK::Linear_kernel::Equal_2 Linear_Equal_2; - typedef typename CK::Linear_kernel::Equal_2::result_type result_type; - using CK::Linear_kernel::Equal_2::operator(); + public: + // using CK::Linear_kernel::Equal_2::operator(); - result_type + template + Boolean + operator()(const A& a, const B& b) const { + return Linear_Equal_2()(a, b); + } + + Boolean operator() (const Circular_arc_point_2 &p0, const Circular_arc_point_2 &p1) const { return CircularFunctors::equal(p0, p1); } - result_type + Boolean operator() (const Circular_arc_2 &a0, const Circular_arc_2 &a1) const { return CircularFunctors::equal(a0, a1); } - result_type + Boolean operator() (const Line_arc_2 &a0, const Line_arc_2 &a1) const { return CircularFunctors::equal(a0, a1); } - }; template < class CK > - class Compare_y_at_x_2 : public CK::Linear_kernel::Compare_y_at_x_2 + class Compare_y_at_x_2 + // : public CK::Linear_kernel::Compare_y_at_x_2 { + typedef typename CK::Comparison_result Comparison_result; typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Line_arc_2 Line_arc_2; + typedef typename CK::Linear_kernel::Compare_y_at_x_2 Linear_Compare_y_at_x_2; + public: - typedef typename CK::Linear_kernel::Compare_y_at_x_2::result_type result_type; + // using CK::Linear_kernel::Compare_y_at_x_2::operator(); - using CK::Linear_kernel::Compare_y_at_x_2::operator(); + template + Comparison_result + operator()(const Args&... args) const + { return Linear_Compare_y_at_x_2()(args...); } - result_type + Comparison_result operator() (const Circular_arc_point_2 &p, const Circular_arc_2 &A1) const { return CircularFunctors::compare_y_at_x(p, A1); } - result_type + Comparison_result operator() (const Circular_arc_point_2 &p, const Line_arc_2 &A1) const { return CircularFunctors::compare_y_at_x(p, A1); } - }; template < class CK > class Do_overlap_2 { + typedef typename CK::Boolean Boolean; typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; public: - typedef bool result_type; - - result_type + Boolean operator() (const Circular_arc_2 &A1, const Circular_arc_2 &A2) const { return CircularFunctors::do_overlap(A1, A2); } - result_type + Boolean operator() (const Line_arc_2 &A1, const Line_arc_2 &A2) const { return CircularFunctors::do_overlap(A1, A2); } - }; - template < class CK > class Make_x_monotone_2 { @@ -274,9 +245,6 @@ namespace CircularFunctors { typedef typename CK::Line_arc_2 Line_arc_2; public: - - typedef void result_type; //!!! - template < class OutputIterator > OutputIterator operator()(const Circular_arc_2 &A, OutputIterator res) const @@ -290,7 +258,6 @@ namespace CircularFunctors { { return CircularFunctors::make_x_monotone(A,res); } - }; template < class CK > @@ -300,9 +267,6 @@ namespace CircularFunctors { typedef typename CK::Line_arc_2 Line_arc_2; public: - - typedef void result_type; //!!! - template < class OutputIterator > OutputIterator operator()(const Circular_arc_2 &A, OutputIterator res) const @@ -326,19 +290,21 @@ namespace CircularFunctors { { *res++ = make_object(A); return res; } - }; template < class CK > class Do_intersect_2 - : public CK::Linear_kernel::Do_intersect_2 + // : public CK::Linear_kernel::Do_intersect_2 { + typedef typename CK::Boolean Boolean; + + typedef typename CK::Linear_kernel::Do_intersect_2 Linear_Do_intersect_2; + public: - typedef typename CK::Linear_kernel::Do_intersect_2::result_type result_type; - template - result_type - operator()(const T1& t1, const T2& t2) const - { return Intersections::internal::do_intersect(t1, t2, CK()); } + template + Boolean + operator()(const A& a, const B& b) const + { return Intersections::internal::do_intersect(a, b, CK()); } }; template < class CK > @@ -347,14 +313,12 @@ namespace CircularFunctors { //using the Lazy_kernel as linear kernel. //: public CK::Linear_kernel::Intersect_2 { - typedef typename CK::Circle_2 Circle; typedef typename CK::Circular_arc_2 Circular_arc; typedef typename CK::Line_arc_2 Line_arc; typedef typename CK::Line_2 Line; public: - //using CK::Linear_kernel::Intersect_2::operator(); template @@ -460,7 +424,6 @@ namespace CircularFunctors { *res++=typename CK::Linear_kernel::Intersect_2()(l1, l2); return res; } - }; template < class CK > @@ -470,61 +433,61 @@ namespace CircularFunctors { typename CK::Polynomial_1_2 operator() ( const typename CK::Line_2 & l ) - { - return LinearFunctors::get_equation(l); - } + { + return LinearFunctors::get_equation(l); + } typename CK::Polynomial_for_circles_2_2 operator() ( const typename CK::Circle_2 & c ) - { - return CircularFunctors::get_equation(c); - } + { + return CircularFunctors::get_equation(c); + } }; template < class CK > class Split_2 { typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Line_arc_2 Line_arc_2; public: - - typedef void result_type; - - result_type + void operator()(const Circular_arc_2 &A, const Circular_arc_point_2 &p, Circular_arc_2 &ca1, Circular_arc_2 &ca2) const { return CircularFunctors::split(A, p, ca1, ca2); } - - result_type + void operator()(const Line_arc_2 &A, const Circular_arc_point_2 &p, Line_arc_2 &ca1, Line_arc_2 &ca2) const { return CircularFunctors::split(A, p, ca1, ca2); } - }; template < class CK > class Is_vertical_2 - : public CK::Linear_kernel::Is_vertical_2 + // : public CK::Linear_kernel::Is_vertical_2 { + typedef typename CK::Boolean Boolean; typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; + typedef typename CK::Linear_kernel::Is_vertical_2 Linear_Is_vertical_2; + public: + // using CK::Linear_kernel::Is_vertical_2::operator(); - typedef typename CK::Linear_kernel::Is_vertical_2::result_type result_type; + template + Boolean + operator()(const A& a) const + { return Linear_Is_vertical_2()(a); } - using CK::Linear_kernel::Is_vertical_2::operator(); - - result_type + Boolean operator()(const Circular_arc_2 &A) const { return CircularFunctors::is_vertical(A); } - result_type + Boolean operator()(const Line_arc_2 &A) const { return CircularFunctors::is_vertical(A); } @@ -533,56 +496,51 @@ namespace CircularFunctors { template < class CK > class Construct_circular_arc_2 { - 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::Kernel_base::Circular_arc_2 RCircular_arc_2; typedef typename Circular_arc_2::Rep Rep; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; public: - typedef Circular_arc_2 result_type; - - result_type + Circular_arc_2 operator()(void) { return Rep(); } - result_type + Circular_arc_2 operator()(const Circle_2 &c) const { return Rep(c); } - result_type + Circular_arc_2 operator()(const Circle_2 &support, const Circular_arc_point_2 &source, const Circular_arc_point_2 &target) const { return Rep(support,source,target); } // Not Documented - result_type + Circular_arc_2 operator()(const Circle_2 &support, const Line_2 &l1, bool b1, const Line_2 &l2, bool b2) const { return Rep(support,l1,b1,l2,b2); } // Not Documented - result_type + Circular_arc_2 operator()(const Circle_2 &c, const Circle_2 &c1, bool b_1, const Circle_2 &c2, bool b_2) const { return Rep(c,c1,b_1,c2,b_2); } - result_type + Circular_arc_2 operator()(const Point_2 &begin, const Point_2 &middle, const Point_2 &end) const { return Rep(begin,middle,end); } // Not Documented - result_type + Circular_arc_2 operator()(const Point_2 &begin, const Point_2 &end, const FT& bulge) const @@ -600,47 +558,44 @@ namespace CircularFunctors { typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Segment_2 Segment_2; typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK::Kernel_base::Line_arc_2 RLine_arc_2; typedef typename Line_arc_2::Rep Rep; public: - typedef Line_arc_2 result_type; - - result_type + Line_arc_2 operator()(void) { return Rep(); } // Not Documented - result_type + Line_arc_2 operator()(const Line_2 &support, const Circle_2 &c1,const bool b1, const Circle_2 &c2,const bool b2) const { return Rep(support,c1,b1,c2,b2); } // Not Documented - result_type + Line_arc_2 operator()(const Line_2 &support, const Line_2 &l1, const Line_2 &l2) const { return Rep(support,l1,l2); } - result_type + Line_arc_2 operator()(const Line_2 &support, const Circular_arc_point_2 &p1, const Circular_arc_point_2 &p2) const { return Rep(support,p1,p2); } -// result_type +// Line_arc_2 // operator()(const Line_2 &support, // const Point_2 &p1, // const Point_2 &p2) const // { return Rep(support,p1,p2); } - result_type + Line_arc_2 operator()(const Segment_2 &s) const { return Rep(s); } - result_type + Line_arc_2 operator()(const Point_2 &p1, const Point_2 &p2) const { return Rep(p1,p2); } @@ -652,40 +607,32 @@ namespace CircularFunctors { { typedef typename CK::Point_2 Point_2; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Kernel_base::Circular_arc_point_2 - RCircular_arc_point_2; typedef typename Circular_arc_point_2::Rep Rep; 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 + Circular_arc_point_2 operator()(void) { return Rep(); } - result_type + Circular_arc_point_2 operator()(const Root_for_circles_2_2 & np) const { return Rep(np); } - result_type + Circular_arc_point_2 operator()(const Point_2 & p) const { return Rep(p); } }; - template class Compute_circular_x_2 { typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Root_of_2 Root_of_2; public: - typedef const Root_of_2& result_type; - - result_type operator() (const Circular_arc_point_2 & a) const + decltype(auto) operator() (const Circular_arc_point_2 & a) const { return (a.rep().x()); } @@ -696,13 +643,9 @@ namespace CircularFunctors { class Compute_circular_y_2 { typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Root_of_2 Root_of_2; public: - - typedef const Root_of_2& result_type; - - result_type operator() (const Circular_arc_point_2 & a) const + decltype(auto) operator() (const Circular_arc_point_2 & a) const { return (a.rep().y()); } @@ -714,17 +657,14 @@ namespace CircularFunctors { { typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; public: - typedef const Circular_arc_point_2 & result_type; - - result_type operator() (const Circular_arc_2 & a) const + decltype(auto) operator() (const Circular_arc_2& a) const { return (a.rep().left()); } - result_type operator() (const Line_arc_2 & a) const + decltype(auto) operator() (const Line_arc_2& a) const { return (a.rep().left()); } @@ -736,18 +676,14 @@ namespace CircularFunctors { { typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; public: - - typedef const Circular_arc_point_2& result_type; - - result_type operator() (const Circular_arc_2 & a) const + decltype(auto) operator() (const Circular_arc_2& a) const { return (a.rep().right()); } - result_type operator() (const Line_arc_2 & a) const + decltype(auto) operator() (const Line_arc_2& a) const { return (a.rep().right()); } @@ -759,16 +695,12 @@ namespace CircularFunctors { { typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; public: - - typedef const Circular_arc_point_2& result_type; - - result_type operator() (const Circular_arc_2 & a) const + decltype(auto) operator() (const Circular_arc_2& a) const { return a.rep().source(); } - result_type operator() (const Line_arc_2 & a) const + decltype(auto) operator() (const Line_arc_2& a) const { return a.rep().source();} }; @@ -779,16 +711,12 @@ namespace CircularFunctors { { typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; public: - - typedef const Circular_arc_point_2& result_type; - - result_type operator() (const Circular_arc_2 & a) const + decltype(auto) operator() (const Circular_arc_2& a) const { return a.rep().target();} - result_type operator() (const Line_arc_2 & a) const + decltype(auto) operator() (const Line_arc_2& a) const { return a.rep().target();} }; @@ -796,19 +724,17 @@ namespace CircularFunctors { template class Is_x_monotone_2 { + typedef typename CK::Boolean Boolean; typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; public: - - typedef bool result_type; - - result_type operator() (const Circular_arc_2 & a) const + Boolean operator() (const Circular_arc_2 & a) const { return (a.rep().is_x_monotone()); } - result_type operator() (const Line_arc_2 & a) const + Boolean operator() (const Line_arc_2 & a) const { return (a.rep().is_x_monotone()); } @@ -818,19 +744,17 @@ namespace CircularFunctors { template class Is_y_monotone_2 { + typedef typename CK::Boolean Boolean; typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; public: - - typedef bool result_type; - - result_type operator() (const Circular_arc_2 & a) const + Boolean operator() (const Circular_arc_2& a) const { return (a.rep().is_y_monotone()); } - result_type operator() (const Line_arc_2 & a) const + Boolean operator() (const Line_arc_2& a) const { return (a.rep().is_y_monotone()); } @@ -839,48 +763,58 @@ namespace CircularFunctors { template class Construct_bbox_2 - : public CK::Linear_kernel::Construct_bbox_2 + // : public CK::Linear_kernel::Construct_bbox_2 { typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Line_arc_2 Line_arc_2; typedef typename CK::Circle_2 Circle_2; + typedef typename CK::Linear_kernel::Construct_bbox_2 Linear_Construct_bbox_2; + public: + // using CK::Linear_kernel::Construct_bbox_2::operator(); - typedef typename CK::Linear_kernel::Construct_bbox_2::result_type result_type; - using CK::Linear_kernel::Construct_bbox_2::operator(); + template + decltype(auto) + operator()(const A& a) const + { return Linear_Construct_bbox_2()(a); } - result_type operator() (const Circular_arc_point_2 & a) const + decltype(auto) operator() (const Circular_arc_point_2& a) const { return a.rep().bbox(); } - result_type operator() (const Circular_arc_2 & a) const + decltype(auto) operator() (const Circular_arc_2& a) const { return a.rep().bbox(); } - result_type operator() (const Line_arc_2 & a) const + decltype(auto) operator() (const Line_arc_2& a) const { return a.rep().bbox(); } - }; template class Bounded_side_2 - : public CK::Linear_kernel::Bounded_side_2 + // : public CK::Linear_kernel::Bounded_side_2 { + typedef typename CK::Bounded_side Bounded_side; typedef typename CK::Circle_2 Circle_2; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Linear_kernel::Bounded_side_2 Linear_Bounded_side_2; + public: - typedef typename CK::Linear_kernel::Bounded_side_2::result_type result_type; + // using CK::Linear_kernel::Bounded_side_2::operator(); - using CK::Linear_kernel::Bounded_side_2::operator(); + template + Bounded_side + operator()(const A& a, const B& b) const + { return Linear_Bounded_side_2()(a, b); } - result_type + Bounded_side operator()(const Circle_2& c, const Circular_arc_point_2& p) const { return CircularFunctors::bounded_side(c,p); } @@ -888,17 +822,23 @@ namespace CircularFunctors { template class Has_on_bounded_side_2 - : public CK::Linear_kernel::Has_on_bounded_side_2 + // : public CK::Linear_kernel::Has_on_bounded_side_2 { + typedef typename CK::Boolean Boolean; typedef typename CK::Circle_2 Circle_2; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Linear_kernel::Has_on_bounded_side_2 Linear_Has_on_bounded_side_2; + public: - typedef typename CK::Linear_kernel::Has_on_bounded_side_2::result_type result_type; + // using CK::Linear_kernel::Has_on_bounded_side_2::operator(); - using CK::Linear_kernel::Has_on_bounded_side_2::operator(); + template + Boolean + operator()(const A& a, const B& b) const + { return Linear_Has_on_bounded_side_2()(a, b); } - result_type + Boolean operator()(const Circle_2& c, const Circular_arc_point_2& p) const { return CK().bounded_side_2_object()(c,p) == ON_BOUNDED_SIDE; } @@ -906,20 +846,25 @@ namespace CircularFunctors { template class Has_on_unbounded_side_2 - : public CK::Linear_kernel::Has_on_unbounded_side_2 + // : public CK::Linear_kernel::Has_on_unbounded_side_2 { + typedef typename CK::Boolean Boolean; typedef typename CK::Circle_2 Circle_2; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Linear_kernel::Has_on_unbounded_side_2 Linear_Has_on_unbounded_side_2; + public: - typedef typename CK::Linear_kernel::Has_on_unbounded_side_2::result_type result_type; + // using CK::Linear_kernel::Has_on_unbounded_side_2::operator(); - using CK::Linear_kernel::Has_on_unbounded_side_2::operator(); + template + Boolean + operator()(const A& a, const B& b) const + { return Linear_Has_on_unbounded_side_2()(a, b); } - result_type + Boolean operator()(const Circle_2& c, const Circular_arc_point_2& p) const { return CK().bounded_side_2_object()(c,p) == ON_UNBOUNDED_SIDE; } - }; #ifndef CGAL_NO_DEPRECATED_CODE @@ -927,31 +872,21 @@ namespace CircularFunctors { class Construct_supporting_circle_2 { typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Circle_2 Circle_2; public: - - typedef Circle_2 result_type; - - CGAL_DEPRECATED result_type operator() (const Circular_arc_2 & a) const + CGAL_DEPRECATED decltype(auto) operator() (const Circular_arc_2 & a) const { return a.rep().supporting_circle(); } }; - template class Construct_supporting_line_2 { typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK::Line_2 Line_2; - typedef typename CK::Circle_2 Circle_2; public: - - typedef Line_2 result_type; - - CGAL_DEPRECATED result_type operator() (const Line_arc_2 & a) const + CGAL_DEPRECATED decltype(auto) operator() (const Line_arc_2 & a) const { return a.rep().supporting_line(); } @@ -960,24 +895,28 @@ namespace CircularFunctors { template class Construct_center_2 - : public CK::Linear_kernel::Construct_center_2 + // : public CK::Linear_kernel::Construct_center_2 { typedef typename CK::Circular_arc_2 Circular_arc_2; - public: - typedef typename CK::Linear_kernel::Construct_center_2::result_type result_type; - using CK::Linear_kernel::Construct_center_2::operator(); - result_type + typedef typename CK::Linear_kernel::Construct_center_2 Linear_Construct_center_2; + + public: + // using CK::Linear_kernel::Construct_center_2::operator(); + + template + decltype(auto) + operator()(const A& a) const + { return Linear_Construct_center_2()(a); } + + decltype(auto) operator()(const Circular_arc_2& c) const { return c.rep().center(); } - }; template class Compute_squared_radius_2 { - - private: typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Linear_kernel LK; typedef typename LK::Compute_squared_radius_2 LK_Compute_squared_radius_2; diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h b/Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h index 9a3ca3b1a89..ae9453be1c0 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h @@ -54,7 +54,7 @@ namespace Intersections { \ } \ template \ inline \ -bool \ +typename K::Boolean \ do_intersect(const A &c1, const B &c2) \ { \ return typename K::Do_intersect_2()(c1, c2); \ 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 90fbdc38534..53b554c95b8 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 @@ -33,6 +33,7 @@ namespace Bbox_functors { template class Compare_x_2 : public BK::Circular_kernel:: template Base< BK >::Type::Compare_x_2 { + typedef typename BK::Comparison_result Comparison_result; typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; typedef typename BK::Point_2 Point_2; typedef typename BK::Circular_kernel:: @@ -40,12 +41,9 @@ class Compare_x_2 : public BK::Circular_kernel:: template Base< BK >::Type::Comp typedef CK_Compare_x_2 Base; public: - - typedef typename CK_Compare_x_2::result_type result_type; - using Base::operator(); - result_type + Comparison_result operator()( const Circular_arc_point_2 &a, const Circular_arc_point_2 &b) const { Bbox_2 bb1=a.bbox(),bb2=b.bbox(); @@ -65,16 +63,15 @@ public: template class Compare_y_2 : public BK::Circular_kernel:: template Base< BK >::Type::Compare_y_2 { + typedef typename BK::Comparison_result Comparison_result; typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; typedef typename BK::Point_2 Point_2; typedef typename BK::Circular_kernel:: template Base< BK >::Type::Compare_y_2 CK_Compare_y_2; typedef CK_Compare_y_2 Base; + public: - - typedef typename CK_Compare_y_2::result_type result_type; - - result_type + Comparison_result operator() (const Point_2 &p0, const Point_2 &p1) const { @@ -83,7 +80,7 @@ public: using Base::operator(); - result_type + Comparison_result operator()( const Circular_arc_point_2 &a, const Circular_arc_point_2 &b) const { Bbox_2 bb1=a.bbox(),bb2=b.bbox(); @@ -105,17 +102,15 @@ class Compare_xy_2 : public BK::Circular_kernel:: template Base< BK >::Type::Com typedef typename BK::Circular_kernel:: template Base< BK >::Type::Compare_xy_2 CK_Compare_xy_2; typedef CK_Compare_xy_2 Base; + + typedef typename BK::Comparison_result Comparison_result; typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; typedef typename BK::Point_2 Point_2; public: - - typedef typename Base::result_type result_type; - using Base::operator(); -public: - result_type + Comparison_result operator()( const Circular_arc_point_2 &a, const Circular_arc_point_2 &b) const { typename BK::Compare_x_2 compx; @@ -137,20 +132,18 @@ class In_x_range_2 : public BK::Circular_kernel:: template Base< BK >::Type::In_ typedef typename BK::Circular_kernel:: template Base< BK >::Type::In_x_range_2 CK_In_x_range_2; typedef CK_In_x_range_2 Base; + + typedef typename BK::Boolean Boolean; 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 Base::operator(); private: - template - result_type + Boolean _in_x_range_2(const Arc_2 &a, const Circular_arc_point_2 &p) const { @@ -179,42 +172,36 @@ private: } public: - - result_type + Boolean 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 + Boolean 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 BK::Circular_kernel:: template Base< BK >::Type::Compare_y_at_x_2 { typedef typename BK::Circular_kernel:: template Base< BK >::Type::Compare_y_at_x_2 CK_Compare_y_at_x_2; typedef CK_Compare_y_at_x_2 Base; + + typedef typename BK::Comparison_result Comparison_result; 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 Base::operator(); private: - template - result_type + Comparison_result _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)); @@ -232,41 +219,36 @@ private: } public: - - result_type + Comparison_result operator()( const Circular_arc_point_2 &p,const Circular_arc_2 &a ) const { CGAL_precondition( a.is_x_monotone()); return _compare_y_at_x_2(p,a); } - result_type + Comparison_result operator()( const Circular_arc_point_2 &p,const Line_arc_2 &a ) const {return _compare_y_at_x_2(p,a);} - }; - template class Has_on_2 : public BK::Circular_kernel:: template Base< BK >::Type::Has_on_2 { typedef typename BK::Circular_kernel:: template Base< BK >::Type::Has_on_2 CK_Has_on_2; typedef CK_Has_on_2 Base; + + typedef typename BK::Boolean Boolean; 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 Base::operator(); private: - template - result_type + Boolean _has_on_2(const Arc_2 &a, const Circular_arc_point_2 &p) const { Bbox_2 bb1=a.bbox(),bb2=p.bbox(); @@ -278,27 +260,26 @@ private: } public: - - result_type + Boolean 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 + Boolean operator()( const Line_arc_2 &a, const Circular_arc_point_2 &p ) const {return _has_on_2(a,p);} - }; - template class Equal_2 : public BK::Circular_kernel:: template Base< BK >::Type::Equal_2 { typedef typename BK::Circular_kernel:: template Base< BK >::Type::Equal_2 CK_Equal_2; + + typedef typename BK::Boolean Boolean; typedef typename BK::Circular_arc_2 Circular_arc_2; typedef typename BK::Point_2 Point_2; typedef typename BK::Direction_2 Direction_2; @@ -315,15 +296,11 @@ class Equal_2 typedef CK_Equal_2 Base; public: - - typedef typename CK_Equal_2::result_type result_type; - using Base::operator(); private: - template - result_type + Boolean _equal_2(const Arc_2 &a,const Arc_2 &b) const { Bbox_2 bb11=a.source().bbox(), @@ -346,8 +323,7 @@ private: } public: - - result_type + Boolean operator()( const Circular_arc_point_2 &a , const Circular_arc_point_2 &b) const { @@ -361,14 +337,15 @@ public: /* WAS THAT HERE FOR OTHER COMPILERS THAN VC* ??? // redefine to solve ambiguous call error - result_type + Boolean operator()( const Point_2 &a , const Point_2 &b) const { return CK_Equal_2()( a, b); } */ - result_type + + Boolean operator()( const Circular_arc_2 &a , const Circular_arc_2 &b ) const { CGAL_precondition( a.is_x_monotone()); @@ -377,17 +354,17 @@ public: return _equal_2(a,b); } - result_type + Boolean operator()( const Line_arc_2 &a , const Line_arc_2 &b ) const { return _equal_2(a,b);} - result_type + Boolean operator()( const Circular_arc_2 & , const Line_arc_2 & ) const { return false;} - result_type + Boolean operator()( const Line_arc_2 & , const Circular_arc_2 & ) const { return false;} @@ -401,19 +378,17 @@ class Do_overlap_2 : public BK::Circular_kernel:: template Base< BK >::Type::Do_ typedef typename BK::Circular_kernel:: template Base< BK >::Type::Do_overlap_2 CK_Do_overlap_2; typedef CK_Do_overlap_2 Base; + + typedef typename BK::Boolean Boolean; 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 Base::operator(); private: - template - result_type + Boolean _do_overlap_2(const Arc_2 &a, const Arc_2 &b) const { Bbox_2 bb1=a.bbox(),bb2=b.bbox(); @@ -424,10 +399,8 @@ private: return false; } - public: - - result_type + Boolean operator()( const Circular_arc_2 &a , const Circular_arc_2 &b ) const { CGAL_precondition( a.is_x_monotone()); @@ -435,28 +408,26 @@ public: return _do_overlap_2(a,b); } - result_type + Boolean operator()( const Line_arc_2 &a , const Line_arc_2 &b ) const { return _do_overlap_2(a,b);} - result_type + Boolean operator()( const Circular_arc_2 & , const Line_arc_2 & ) const { return false;} - result_type + Boolean operator()( const Line_arc_2 & , const Circular_arc_2 & ) const { return false;} }; - template < class BK > class Intersect_2 : public BK::Circular_kernel:: template Base< BK >::Type::Intersect_2 { -public: typedef typename BK::Circular_kernel:: template Base< BK >::Type::Intersect_2 CK_Intersect_2; @@ -466,6 +437,7 @@ public: typedef typename BK::Circle_2 Circle; typedef typename BK::Line_2 Line_2; +public: using CK_Intersect_2::operator(); template < class OutputIterator > diff --git a/Circular_kernel_3/doc/Circular_kernel_3/Circular_kernel_3.txt b/Circular_kernel_3/doc/Circular_kernel_3/Circular_kernel_3.txt index 937d438332f..5f5ca1dc107 100644 --- a/Circular_kernel_3/doc/Circular_kernel_3/Circular_kernel_3.txt +++ b/Circular_kernel_3/doc/Circular_kernel_3/Circular_kernel_3.txt @@ -24,7 +24,7 @@ for which we refer the user to the \ref chapterkernel23 "2D and 3D Linear Kernel \section sectionSKobjects Spherical Kernel Objects New main geometric objects are introduced by `Spherical_kernel_3`: -circular arcs ((model of `SphericalKernel::CircularArc_3`), points +circular arcs (model of `SphericalKernel::CircularArc_3`), points of circular arcs (model of `SphericalKernel::CircularArcPoint_3`), and line segments (model of `SphericalKernel::LineArc_3`) whose endpoints are points of this new type. diff --git a/Circular_kernel_3/doc/Circular_kernel_3/dependencies b/Circular_kernel_3/doc/Circular_kernel_3/dependencies index bc945e6454c..47c71fadee2 100644 --- a/Circular_kernel_3/doc/Circular_kernel_3/dependencies +++ b/Circular_kernel_3/doc/Circular_kernel_3/dependencies @@ -1,3 +1,4 @@ +Algebraic_foundations Circular_kernel_2 Kernel_23 Number_types diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/Circular_arc_point_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/Circular_arc_point_3.h index 99eb521e1fa..aad283a9b18 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/Circular_arc_point_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/Circular_arc_point_3.h @@ -211,7 +211,7 @@ public: const Root_for_spheres_2_3 & coordinates() const { return get_pointee_or_identity(base); } - const CGAL::Bbox_3 bbox() const { + CGAL::Bbox_3 bbox() const { return get_pointee_or_identity(base).bbox(); } diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/Line_arc_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/Line_arc_3.h index de30249490d..9bd639cce02 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/Line_arc_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/Line_arc_3.h @@ -168,7 +168,7 @@ namespace CGAL { return begin_less_xyz_than_end() ? target() : source(); } - const CGAL::Bbox_3 bbox() const { + CGAL::Bbox_3 bbox() const { return source().bbox() + target().bbox(); } diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h index 74c18740648..c2940aa42d7 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h @@ -42,21 +42,27 @@ namespace SphericalFunctors { #define CGAL_SPHERICAL_KERNEL_MACRO_FUNCTOR_COMPARE_(V)\ template < class SK > \ - class Compare_ ##V## _3: public SK::Linear_kernel::Compare_ ##V## _3{\ + class Compare_ ##V## _3 {\ + /*: public SK::Linear_kernel::Compare_ ##V## _3{*/\ + typedef typename SK::Comparison_result Comparison_result;\ typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;\ typedef typename SK::Point_3 Point_3;\ + typedef typename SK::Linear_kernel::Compare_ ##V## _3 Linear_Compare_ ##V## _3;\ public:\ - typedef typename SK::Linear_kernel::Compare_ ##V## _3::result_type result_type;\ - using SK::Linear_kernel::Compare_ ##V## _3::operator();\ - result_type\ + template \ + Comparison_result\ + operator()(const A& a, const B& b) const\ + { return Linear_Compare_ ##V## _3()(a, b); }\ + /*using SK::Linear_kernel::Compare_ ##V## _3::operator();*/\ + Comparison_result\ operator() (const Circular_arc_point_3 &p0,\ const Circular_arc_point_3 &p1) const\ { return SphericalFunctors::compare_ ##V (p0, p1); }\ - result_type\ + Comparison_result\ operator() (const Circular_arc_point_3 &p0,\ const Point_3 &p1) const\ { return SphericalFunctors::compare_ ##V (p0, p1); }\ - result_type\ + Comparison_result\ operator() (const Point_3 &p0,\ const Circular_arc_point_3 &p1) const\ { return SphericalFunctors::compare_ ##V (p0, p1); }\ @@ -68,17 +74,16 @@ template < class SK > \ CGAL_SPHERICAL_KERNEL_MACRO_FUNCTOR_COMPARE_(xy) CGAL_SPHERICAL_KERNEL_MACRO_FUNCTOR_COMPARE_(xyz) +#undef CGAL_SPHERICAL_KERNEL_MACRO_FUNCTOR_COMPARE_ + template class Compute_circular_x_3 { typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; - typedef typename SK::Root_of_2 Root_of_2; public: - - typedef const Root_of_2& result_type; - - result_type operator() (const Circular_arc_point_3 & a) const + // SK::Root_of_2 + decltype(auto) operator() (const Circular_arc_point_3 & a) const { return (a.rep().x()); } }; @@ -86,13 +91,10 @@ template < class SK > \ class Compute_circular_y_3 { typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; - typedef typename SK::Root_of_2 Root_of_2; public: - - typedef const Root_of_2& result_type; - - result_type operator() (const Circular_arc_point_3 & a) const + // SK::Root_of_2 + decltype(auto) operator() (const Circular_arc_point_3 & a) const { return (a.rep().y()); } }; @@ -100,23 +102,18 @@ template < class SK > \ class Compute_circular_z_3 { typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; - typedef typename SK::Root_of_2 Root_of_2; public: - - typedef const Root_of_2& result_type; - - result_type operator() (const Circular_arc_point_3 & a) const + // SK::Root_of_2 + decltype(auto) operator() (const Circular_arc_point_3 & a) const { return (a.rep().z()); } }; template < class SK > class Equal_3 - : public SK::Linear_kernel::Equal_3 + // : public SK::Linear_kernel::Equal_3 { - typedef typename SK::Linear_kernel LK; - typedef typename LK::Equal_3 LK_Equal_3; - + typedef typename SK::Boolean Boolean; typedef typename SK::Point_3 Point_3; typedef typename SK::Vector_3 Vector_3; typedef typename SK::Direction_3 Direction_3; @@ -134,35 +131,39 @@ template < class SK > \ typedef typename SK::Line_arc_3 Line_arc_3; typedef typename SK::Circular_arc_3 Circular_arc_3; + typedef typename SK::Linear_kernel::Equal_3 Linear_equal_3; + public: + // using SK::Linear_kernel::Equal_3::operator(); - typedef typename SK::Linear_kernel::Equal_3::result_type result_type; + template + Boolean + operator()(const A& a, const B& b) const + { return Linear_equal_3()(a, b); } - using SK::Linear_kernel::Equal_3::operator(); - - result_type + Boolean operator() (const Circular_arc_point_3 &c0, const Circular_arc_point_3 &c1) const { return SphericalFunctors::equal(c0, c1); } - result_type + Boolean operator() (const Circular_arc_point_3 &c0, const Point_3 &c1) const { return SphericalFunctors::equal(c0, Circular_arc_point_3(c1)); } - result_type + Boolean operator() (const Point_3 &c0, const Circular_arc_point_3 &c1) const { return SphericalFunctors::equal(Circular_arc_point_3(c0), c1); } // Our Line_arc_3 doesn't have orientation - result_type + Boolean operator() (const Line_arc_3 &l0, const Line_arc_3 &l1) const { return SphericalFunctors::equal(l0, l1); } // Our Circular_arc_3 doesn't have orientation (as parameter) - result_type + Boolean operator() (const Circular_arc_3 &c0, const Circular_arc_3 &c1) const { return SphericalFunctors::equal(c0, c1); } @@ -184,29 +185,26 @@ template < class SK > \ typedef typename Circular_arc_point_3::Root_for_spheres_2_3 Root_for_spheres_2_3; public: - typedef Circular_arc_point_3 result_type; - - result_type + Circular_arc_point_3 operator()(void) { return Rep(); } - result_type - operator()(const Root_of_2 & x, - const Root_of_2 & y, - const Root_of_2 & z - ) const + Circular_arc_point_3 + operator()(const Root_of_2 & x, + const Root_of_2 & y, + const Root_of_2 & z) const { return Rep(x,y,z); } - result_type + Circular_arc_point_3 operator()(const Root_for_spheres_2_3 & np) const { return Rep(np); } - result_type + Circular_arc_point_3 operator()(const Point_3 & p) const { return Rep(p); } // Not Documented - result_type + Circular_arc_point_3 operator()(const Sphere_3 & s1, const Sphere_3 & s2, const Sphere_3 & s3, @@ -214,7 +212,7 @@ template < class SK > \ { return Rep(s1,s2,s3,less_xyz); } // Not Documented - result_type + Circular_arc_point_3 operator()(const Plane_3 & p, const Sphere_3 & s1, const Sphere_3 & s2, @@ -222,7 +220,7 @@ template < class SK > \ { return Rep(p,s1,s2,less_xyz); } // Not Documented - result_type + Circular_arc_point_3 operator()(const Sphere_3 & s1, const Plane_3 & p, const Sphere_3 & s2, @@ -230,7 +228,7 @@ template < class SK > \ { return Rep(p,s1,s2,less_xyz); } // Not Documented - result_type + Circular_arc_point_3 operator()(const Sphere_3 & s1, const Sphere_3 & s2, const Plane_3 & p, @@ -238,7 +236,7 @@ template < class SK > \ { return Rep(p,s1,s2,less_xyz); } // Not Documented - result_type + Circular_arc_point_3 operator()(const Plane_3 & p1, const Plane_3 & p2, const Sphere_3 & s, @@ -246,7 +244,7 @@ template < class SK > \ { return Rep(p1,p2,s,less_xyz); } // Not Documented - result_type + Circular_arc_point_3 operator()(const Plane_3 & p1, const Sphere_3 & s, const Plane_3 & p2, @@ -254,7 +252,7 @@ template < class SK > \ { return Rep(p1,p2,s,less_xyz); } // Not Documented - result_type + Circular_arc_point_3 operator()(const Sphere_3 & s, const Plane_3 & p1, const Plane_3 & p2, @@ -262,42 +260,42 @@ template < class SK > \ { return Rep(p1,p2,s,less_xyz); } // Not Documented - result_type + Circular_arc_point_3 operator()(const Line_3 & l, const Sphere_3 & s, const bool less_xyz = true) const { return Rep(l,s,less_xyz); } // Not Documented - result_type + Circular_arc_point_3 operator()(const Sphere_3 & s, const Line_3 & l, const bool less_xyz = true) const { return Rep(l,s,less_xyz); } // Not Documented - result_type + Circular_arc_point_3 operator()(const Circle_3 & c, const Sphere_3 & s, const bool less_xyz = true) const { return Rep(c,s,less_xyz); } // Not Documented - result_type + Circular_arc_point_3 operator()(const Sphere_3 & s, const Circle_3 & c, const bool less_xyz = true) const { return Rep(c,s,less_xyz); } // Not Documented - result_type + Circular_arc_point_3 operator()(const Circle_3 & c, const Plane_3 & p, const bool less_xyz = true) const { return Rep(c,p,less_xyz); } // Not Documented - result_type + Circular_arc_point_3 operator()(const Plane_3 & p, const Circle_3 & c, const bool less_xyz = true) const @@ -309,83 +307,78 @@ template < class SK > \ class Construct_sphere_3 { typedef typename SK::Circular_arc_3 Circular_arc_3; - typedef typename SK::Linear_kernel LK; - typedef typename LK::Point_3 Point_3; - typedef typename LK::Circle_3 Circle_3; - typedef typename LK::Sphere_3 Sphere_3; + typedef typename SK::Sphere_3 Sphere_3; + typedef typename SK::Point_3 Point_3; + typedef typename SK::Circle_3 Circle_3; + typedef typename SK::FT FT; + + typedef typename SK::Linear_kernel LK; typedef typename LK::Construct_sphere_3 LK_Construct_sphere_3; - typedef typename LK::FT FT; public: - - typedef typename SK::Linear_kernel::Construct_sphere_3::result_type result_type; - - result_type + Sphere_3 operator()( Return_base_tag tag, const Point_3& center, const FT& squared_radius, Orientation orientation = COUNTERCLOCKWISE) const { return LK_Construct_sphere_3()(tag, center, squared_radius, orientation); } - result_type + Sphere_3 operator()( Return_base_tag tag, const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { return LK_Construct_sphere_3()(tag, p, q, r, s); } - result_type + Sphere_3 operator()( Return_base_tag tag, const Point_3& p, const Point_3& q, const Point_3& r, Orientation orientation = COUNTERCLOCKWISE) const { return LK_Construct_sphere_3()(tag, p, q, r, orientation); } - result_type + Sphere_3 operator()( Return_base_tag tag, const Point_3& p, const Point_3& q, Orientation orientation = COUNTERCLOCKWISE) const { return LK_Construct_sphere_3()(tag, p, q, orientation); } - result_type + Sphere_3 operator()( Return_base_tag tag, const Point_3& center, Orientation orientation = COUNTERCLOCKWISE) const { return LK_Construct_sphere_3()(tag, center, orientation); } - result_type + decltype(auto) operator() (Return_base_tag tag, const Circle_3 & c) const { return LK_Construct_sphere_3()(tag, c); } - - - - result_type + Sphere_3 operator()( const Point_3& center, const FT& squared_radius, Orientation orientation = COUNTERCLOCKWISE) const { return LK_Construct_sphere_3()(center, squared_radius, orientation); } - result_type + Sphere_3 operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { return LK_Construct_sphere_3()(p, q, r, s); } - result_type + Sphere_3 operator()( const Point_3& p, const Point_3& q, const Point_3& r, Orientation orientation = COUNTERCLOCKWISE) const { return LK_Construct_sphere_3()(p, q, r, orientation); } - result_type + Sphere_3 operator()( const Point_3& p, const Point_3& q, Orientation orientation = COUNTERCLOCKWISE) const { return LK_Construct_sphere_3()(p, q, orientation); } - result_type + Sphere_3 operator()( const Point_3& center, Orientation orientation = COUNTERCLOCKWISE) const { return LK_Construct_sphere_3()(center, orientation); } - result_type + decltype(auto) operator() (const Circle_3 & c) const { return LK_Construct_sphere_3()(c); } - result_type + Sphere_3 operator() ( const typename SK::Polynomial_for_spheres_2_3 &eq ) { return SphericalFunctors::construct_sphere_3(eq); } - result_type operator() (const Circular_arc_3 & c) const + decltype(auto) operator() (const Circular_arc_3 & c) const { return c.rep().diametral_sphere(); } }; @@ -394,98 +387,92 @@ template < class SK > \ class Construct_plane_3 { typedef typename SK::Circular_arc_3 Circular_arc_3; + typedef typename SK::RT RT; + typedef typename SK::Point_3 Point_3; + typedef typename SK::Vector_3 Vector_3; + typedef typename SK::Direction_3 Direction_3; + typedef typename SK::Line_3 Line_3; + typedef typename SK::Ray_3 Ray_3; + typedef typename SK::Segment_3 Segment_3; + typedef typename SK::Plane_3 Plane_3; + typedef typename SK::Circle_3 Circle_3; + typedef typename SK::Linear_kernel LK; typedef typename LK::Construct_plane_3 LK_Construct_plane_3; - typedef typename LK::RT RT; - typedef typename LK::Point_3 Point_3; - typedef typename LK::Vector_3 Vector_3; - typedef typename LK::Direction_3 Direction_3; - typedef typename LK::Line_3 Line_3; - typedef typename LK::Ray_3 Ray_3; - typedef typename LK::Segment_3 Segment_3; - typedef typename LK::Plane_3 Plane_3; - typedef typename LK::Circle_3 Circle_3; public: - - typedef typename SK::Linear_kernel::Construct_plane_3::result_type result_type; - - public: - - result_type + Plane_3 operator()(Return_base_tag tag, const RT& a, const RT& b, const RT& c, const RT& d) const { return LK_Construct_plane_3()(tag, a, b, c, d); } - result_type + Plane_3 operator()(Return_base_tag tag, const Point_3& p, const Point_3& q, const Point_3& r) const { return LK_Construct_plane_3()(tag, p, q, r); } - result_type + Plane_3 operator()(Return_base_tag tag, const Point_3& p, const Direction_3& d) const { return LK_Construct_plane_3()(tag, p, d); } - result_type + Plane_3 operator()(Return_base_tag tag, const Point_3& p, const Vector_3& v) const { return LK_Construct_plane_3()(tag, p, v); } - result_type + Plane_3 operator()(Return_base_tag tag, const Line_3& l, const Point_3& p) const { return LK_Construct_plane_3()(tag, l, p); } - result_type + Plane_3 operator()(Return_base_tag tag, const Ray_3& r, const Point_3& p) const { return LK_Construct_plane_3()(tag, r, p); } - result_type + Plane_3 operator()(Return_base_tag tag, const Segment_3& s, const Point_3& p) const { return LK_Construct_plane_3()(tag, s, p); } - result_type + decltype(auto) operator()(Return_base_tag tag, const Circle_3 & c) const { return LK_Construct_plane_3()(tag, c); } - result_type + Plane_3 operator()(const RT& a, const RT& b, const RT& c, const RT& d) const { return this->operator()(Return_base_tag(), a, b, c, d); } - result_type + Plane_3 operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { return this->operator()(Return_base_tag(), p, q, r); } - result_type + Plane_3 operator()(const Point_3& p, const Direction_3& d) const { return this->operator()(Return_base_tag(), p, d); } - result_type + Plane_3 operator()(const Point_3& p, const Vector_3& v) const { return this->operator()(Return_base_tag(), p, v); } - result_type + Plane_3 operator()(const Line_3& l, const Point_3& p) const { return this->operator()(Return_base_tag(), l, p); } - result_type + Plane_3 operator()(const Ray_3& r, const Point_3& p) const { return this->operator()(Return_base_tag(), r, p); } - result_type + Plane_3 operator()(const Segment_3& s, const Point_3& p) const { return this->operator()(Return_base_tag(), s, p); } - result_type + decltype(auto) operator()(const Circle_3 & c) const { return this->operator()(Return_base_tag(), c); } - result_type + Plane_3 operator() ( const typename SK::Polynomial_1_3 &eq ) { return SphericalFunctors::construct_plane_3(eq); } - result_type operator() (const Circular_arc_3 & c) const + decltype(auto) operator() (const Circular_arc_3 & c) const { return c.rep().supporting_plane(); } }; - - template class Construct_line_3 { @@ -498,54 +485,53 @@ template < class SK > \ typedef typename SK::Ray_3 Ray_3; public: typedef typename SK::Linear_kernel::Construct_line_3 LK_Construct_line_3; - typedef typename LK_Construct_line_3::result_type result_type; - result_type + Line_3 operator()(Return_base_tag, const Point_3& p, const Point_3& q) const { return LK_Construct_line_3()(p, Vector_3(p, q)); } - result_type + Line_3 operator()(Return_base_tag, const Point_3& p, const Direction_3& d) const { return operator()(Return_base_tag(), p, Vector_3(d.dx(), d.dy(), d.dz())); } - result_type + Line_3 operator()(Return_base_tag, const Point_3& p, const Vector_3& v) const { return LK_Construct_line_3()(p, v); } - result_type + Line_3 operator()(Return_base_tag, const Segment_3& s) const { return LK_Construct_line_3()(s.source(), Vector_3(s.source(), s.target())); } - result_type + Line_3 operator()(Return_base_tag, const Ray_3& r) const { return LK_Construct_line_3()(r.source(), Vector_3(r.source(), r.second_point())); } - result_type + Line_3 operator()(const Point_3& p, const Point_3& q) const { return this->operator()(Return_base_tag(), p, q); } - result_type + Line_3 operator()(const Point_3& p, const Direction_3& d) const { return this->operator()(Return_base_tag(), p, d); } - result_type + Line_3 operator()(const Point_3& p, const Vector_3& v) const { return this->operator()(Return_base_tag(), p, v); } - result_type + Line_3 operator()(const Segment_3& s) const { return this->operator()(Return_base_tag(), s); } - result_type + Line_3 operator()(const Ray_3& r) const { return this->operator()(Return_base_tag(), r); } - const result_type& + decltype(auto) operator() (const Line_arc_3 & a) const { return (a.rep().supporting_line()); } - result_type + Line_3 operator() ( const typename SK::Polynomials_for_line_3 &eq ) { return SphericalFunctors::construct_line_3(eq); } @@ -554,8 +540,6 @@ template < class SK > \ template < class SK > class Construct_circle_3 { - typedef typename SK::Linear_kernel::Construct_circle_3 Extended; - typedef typename Extended::result_type forwarded_result_type; typedef typename SK::FT FT; typedef typename SK::Point_3 Point_3; typedef typename SK::Plane_3 Plane_3; @@ -564,57 +548,57 @@ template < class SK > \ typedef typename SK::Vector_3 Vector_3; typedef typename SK::Direction_3 Direction_3; typedef typename SK::Circular_arc_3 Circular_arc_3; - typedef typename SK::Kernel_base::Circle_3 RCircle_3; typedef typename Circle_3::Rep Rep; - public: - forwarded_result_type + typedef typename SK::Linear_kernel::Construct_circle_3 LK_Construct_circle_3; + + public: + Circle_3 operator()(const Point_3& p, const FT& sr, const Plane_3& plane) const - { return Extended()(p, sr, plane); } + { return LK_Construct_circle_3()(p, sr, plane); } - forwarded_result_type + Circle_3 operator() (const Point_3& p, const FT& sr, const Vector_3& v) const - { return Extended()(p, sr, v); } + { return LK_Construct_circle_3()(p, sr, v); } - forwarded_result_type + Circle_3 operator() (const Point_3& p, const FT& sr, const Direction_3& d) const - { return Extended()(p, sr, d); } + { return LK_Construct_circle_3()(p, sr, d); } - forwarded_result_type + Circle_3 operator() (const Sphere_3& s1, const Sphere_3& s2) const - { return Extended()(s1, s2); } + { return LK_Construct_circle_3()(s1, s2); } - forwarded_result_type + Circle_3 operator() (const Plane_3& p, const Sphere_3& s) const - { return Extended()(p, s); } + { return LK_Construct_circle_3()(p, s); } - forwarded_result_type + Circle_3 operator() (const Sphere_3& s, const Plane_3& p) const - { return Extended()(p, s); } + { return LK_Construct_circle_3()(p, s); } - forwarded_result_type + Circle_3 operator() (const Plane_3& p, const Sphere_3& s, int a) const - { return Extended()(p, s, a); } + { return LK_Construct_circle_3()(p, s, a); } - forwarded_result_type + Circle_3 operator() (const Sphere_3& s, const Plane_3& p, int a) const - { return Extended()(p, s, a); } + { return LK_Construct_circle_3()(p, s, a); } - forwarded_result_type + Circle_3 operator()( const Point_3& p1, const Point_3& p2, const Point_3& p3) const - { return Extended()(p1, p2, p3); } + { return LK_Construct_circle_3()(p1, p2, p3); } - forwarded_result_type + Circle_3 operator() ( const typename SK::Polynomials_for_circle_3 &eq ) - { return Rep(construct_circle_3(eq)); } + { return construct_circle_3(eq); } - const forwarded_result_type& + decltype(auto) operator() (const Circular_arc_3 & a) const { return (a.rep().supporting_circle()); } - }; template < class SK > @@ -632,43 +616,41 @@ template < class SK > \ typedef typename Line_arc_3::Rep Rep; public: - typedef Line_arc_3 result_type; - - result_type + Line_arc_3 operator()(void) const { return Rep(); } - result_type + Line_arc_3 operator()(const Line_3 &l, const Circular_arc_point_3 &s, const Circular_arc_point_3 &t) const { return Rep(l,s,t); } - result_type + Line_arc_3 operator()(const Point_3 &s, const Point_3 &t) const { return Rep(s,t); } - result_type + Line_arc_3 operator()(const Segment_3 &s) const { return Rep(s); } // Not Documented - result_type + Line_arc_3 operator()(const Line_3 &l, const Sphere_3 &s, bool less_xyz_first = true) const { return Rep(l,s,less_xyz_first); } // Not Documented - result_type + Line_arc_3 operator()(const Sphere_3 &s, const Line_3 &l, bool less_xyz_first = true) const { return Rep(l,s,less_xyz_first); } // Not Documented - result_type + Line_arc_3 operator()(const Line_3 &l, const Sphere_3 &s1, bool less_xyz_s1, const Sphere_3 &s2, bool less_xyz_s2) const @@ -676,7 +658,7 @@ template < class SK > \ s2,less_xyz_s2); } // Not Documented - result_type + Line_arc_3 operator()(const Sphere_3 &s1, bool less_xyz_s1, const Sphere_3 &s2, bool less_xyz_s2, const Line_3 &l) const @@ -684,14 +666,14 @@ template < class SK > \ s2,less_xyz_s2); } // Not Documented - result_type + Line_arc_3 operator()(const Line_3 &l, const Plane_3 &p1, const Plane_3 &p2) const { return Rep(l,p1,p2); } // Not Documented - result_type + Line_arc_3 operator()(const Plane_3 &p1, const Plane_3 &p2, const Line_3 &l) const @@ -715,56 +697,55 @@ template < class SK > \ typedef typename SK::Circular_arc_3 Circular_arc_3; typedef typename SK::Kernel_base::Circular_arc_3 RCircular_arc_3; typedef typename Circular_arc_3::Rep Rep; - public: - typedef Circular_arc_3 result_type; - result_type + public: + Circular_arc_3 operator()(void) const { return Rep(); } - result_type + Circular_arc_3 operator()(const Circle_3 &c) const { return Rep(c); } - result_type + Circular_arc_3 operator()(const Circle_3 &c,const Circular_arc_point_3& pt) const { return Rep(c,pt); } - result_type + Circular_arc_3 operator()(const Circle_3 &l, const Circular_arc_point_3 &s, const Circular_arc_point_3 &t) const { return Rep(l,s,t); } // Not Documented - result_type + Circular_arc_3 operator()(const Circle_3 &c, const Sphere_3 &s1, bool less_xyz_s1, const Sphere_3 &s2, bool less_xyz_s2) const { return Rep(c,s1,less_xyz_s1,s2,less_xyz_s2); } // Not Documented - result_type + Circular_arc_3 operator()(const Sphere_3 &s1, bool less_xyz_s1, const Sphere_3 &s2, bool less_xyz_s2, const Circle_3 &c) const { return Rep(c,s1,less_xyz_s1,s2,less_xyz_s2); } // Not Documented - result_type + Circular_arc_3 operator()(const Circle_3 &c, const Plane_3 &p1, bool less_xyz_p1, const Plane_3 &p2, bool less_xyz_p2) const { return Rep(c,p1,less_xyz_p1,p2,less_xyz_p2); } // Not Documented - result_type + Circular_arc_3 operator()(const Plane_3 &p1, bool less_xyz_p1, const Plane_3 &p2, bool less_xyz_p2, const Circle_3 &c) const { return Rep(c,p1,less_xyz_p1,p2,less_xyz_p2); } - result_type + Circular_arc_3 operator()(const Point_3 &begin, const Point_3 &middle, const Point_3 &end) const @@ -776,13 +757,9 @@ template < class SK > \ class Construct_circular_min_vertex_3 { typedef typename SK::Line_arc_3 Line_arc_3; - typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; public: - - typedef const Circular_arc_point_3& result_type; - - result_type operator() (const Line_arc_3 & a) const + decltype(auto) operator() (const Line_arc_3& a) const { return (a.rep().lower_xyz_extremity()); } }; @@ -791,13 +768,9 @@ template < class SK > \ class Construct_circular_max_vertex_3 { typedef typename SK::Line_arc_3 Line_arc_3; - typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; public: - - typedef const Circular_arc_point_3& result_type; - - result_type operator() (const Line_arc_3 & a) const + decltype(auto) operator() (const Line_arc_3& a) const { return (a.rep().higher_xyz_extremity()); } }; @@ -807,16 +780,12 @@ template < class SK > \ { typedef typename SK::Line_arc_3 Line_arc_3; typedef typename SK::Circular_arc_3 Circular_arc_3; - typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; public: - - typedef const Circular_arc_point_3& result_type; - - result_type operator() (const Line_arc_3 & a) const + decltype(auto) operator() (const Line_arc_3& a) const { return (a.rep().source()); } - result_type operator() (const Circular_arc_3 & a) const + decltype(auto) operator() (const Circular_arc_3& a) const { return (a.rep().source()); } }; @@ -825,30 +794,27 @@ template < class SK > \ class Construct_circular_target_vertex_3 { typedef typename SK::Line_arc_3 Line_arc_3; - typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; typedef typename SK::Circular_arc_3 Circular_arc_3; public: - - typedef const Circular_arc_point_3& result_type; - - result_type operator() (const Line_arc_3 & a) const + decltype(auto) operator() (const Line_arc_3 & a) const { return (a.rep().target()); } - result_type operator() (const Circular_arc_3 & a) const + decltype(auto) operator() (const Circular_arc_3 & a) const { return (a.rep().target()); } }; template < class SK > class Has_on_3 - : public SK::Linear_kernel::Has_on_3 + // : public SK::Linear_kernel::Has_on_3 { + typedef typename SK::Boolean Boolean; typedef typename SK::Point_3 Point_3; typedef typename SK::Sphere_3 Sphere_3; typedef typename SK::Plane_3 Plane_3; typedef typename SK::Line_3 Line_3; - typedef typename SK::Segment_3 Segment_3; + typedef typename SK::Segment_3 Segment_3; typedef typename SK::Ray_3 Ray_3; typedef typename SK::Triangle_3 Triangle_3; typedef typename SK::Line_arc_3 Line_arc_3; @@ -856,69 +822,73 @@ template < class SK > \ typedef typename SK::Circular_arc_3 Circular_arc_3; typedef typename SK::Circle_3 Circle_3; + typedef typename SK::Linear_kernel::Has_on_3 Linear_Has_on_3; public: - typedef typename SK::Linear_kernel::Has_on_3::result_type result_type; + // using SK::Linear_kernel::Has_on_3::operator(); - using SK::Linear_kernel::Has_on_3::operator(); + template + Boolean + operator()(const A& a, const B& b) const + { return Linear_Has_on_3()(a, b); } - result_type + Boolean operator()(const Sphere_3 &a, const Circular_arc_point_3 &p) const { return SphericalFunctors::has_on(a, p); } - result_type + Boolean operator()(const Plane_3 &a, const Circular_arc_point_3 &p) const { return SphericalFunctors::has_on(a, p); } - result_type + Boolean operator()(const Line_3 &a, const Circular_arc_point_3 &p) const { return SphericalFunctors::has_on(a, p); } - result_type + Boolean operator()(const Circle_3 &a, const Circular_arc_point_3 &p) const { return SphericalFunctors::has_on(a, p); } - result_type + Boolean operator()(const Line_arc_3 &a, const Circular_arc_point_3 &p, const bool already_know_point_on_line = false) const { return SphericalFunctors::has_on(a, p, already_know_point_on_line); } - result_type + Boolean operator()(const Line_arc_3 &a, const Point_3 &p, const bool already_know_point_on_line = false) const { return SphericalFunctors::has_on(a, p, already_know_point_on_line); } - result_type + Boolean operator()(const Plane_3 &p, const Line_arc_3 &a) const { return SphericalFunctors::has_on(p, a); } - result_type + Boolean operator()(const Line_3 &a, const Line_arc_3 &p) const { return SphericalFunctors::has_on(a, p); } - result_type + Boolean operator()(const Circular_arc_3 &a, const Point_3 &p, const bool has_on_supporting_circle = false) const { return SphericalFunctors::has_on(a, p, has_on_supporting_circle); } - result_type + Boolean operator()(const Circular_arc_3 &a, const Circular_arc_point_3 &p, const bool has_on_supporting_circle = false) const { return SphericalFunctors::has_on(a, p, has_on_supporting_circle); } - result_type + Boolean operator()(const Sphere_3 &a, const Circular_arc_3 &p) const { return SphericalFunctors::has_on(a, p); } - result_type + Boolean operator()(const Plane_3 &a, const Circular_arc_3 &p) const { return SphericalFunctors::has_on(a, p); } - result_type + Boolean operator()(const Circle_3 &a, const Circular_arc_3 &p) const { return SphericalFunctors::has_on(a, p); } - result_type + Boolean operator()(const Circular_arc_3 &p, const Circle_3 &a) const { return SphericalFunctors::has_on(p, a); } @@ -926,9 +896,9 @@ template < class SK > \ template < class SK > class Do_intersect_3 - : public SK::Linear_kernel::Do_intersect_3 + // : public SK::Linear_kernel::Do_intersect_3 { - + typedef typename SK::Boolean Boolean; typedef typename SK::Sphere_3 Sphere_3; typedef typename SK::Line_3 Line_3; typedef typename SK::Line_arc_3 Line_arc_3; @@ -937,20 +907,25 @@ template < class SK > \ typedef typename SK::Circle_3 Circle_3; typedef typename SK::Circle_3 Circular_arc_point_3; - public: - typedef typename SK::Linear_kernel::Do_intersect_3::result_type result_type; + typedef typename SK::Linear_kernel::Do_intersect_3 Linear_Do_intersect_3; - using SK::Linear_kernel::Do_intersect_3::operator(); + public: + // using SK::Linear_kernel::Do_intersect_3::operator(); + + template + Boolean + operator()(const A& a, const B& b) const + { return Linear_Do_intersect_3()(a, b); } #define CGAL_SPHERICAL_KERNEL_MACRO_DO_INTERSECTION_3_2(A,B) \ - result_type \ + Boolean \ operator()(const A & c1, const B & c2) const \ { std::vector< typename SK3_Intersection_traits::type > res; \ typename SK::Intersect_3()(c1,c2,std::back_inserter(res)); \ return !res.empty(); } #define CGAL_SPHERICAL_KERNEL_MACRO_DO_INTERSECTION_3_3(A,B,C) \ - result_type \ + Boolean \ operator()(const A & c1, const B & c2, const C & c3) const \ { std::vector< typename SK3_Intersection_traits::type > res; \ typename SK::Intersect_3()(c1,c2,c3,std::back_inserter(res)); \ @@ -1008,22 +983,21 @@ template < class SK > \ typedef typename SK::Circle_3 Circle_3; typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; - public: + typedef typename SK::Linear_kernel::Intersect_3 Linear_Intersect_3; + public: //using SK::Linear_kernel::Intersect_3::operator(); - typedef typename SK::Linear_kernel::Intersect_3 Intersect_linear_3; - - template + template decltype(auto) operator()(const A& a, const B& b) const{ - return Intersect_linear_3()(a,b); + return Linear_Intersect_3()(a,b); } decltype(auto) operator()(const Plane_3& p, const Plane_3& q, const Plane_3& r) const { - return Intersect_linear_3()(p, q, r); + return Linear_Intersect_3()(p, q, r); } template < class OutputIterator > @@ -1238,18 +1212,17 @@ template < class SK > \ template < class SK > class Do_overlap_3 { + typedef typename SK::Boolean Boolean; typedef typename SK::Line_arc_3 Line_arc_3; typedef typename SK::Circular_arc_3 Circular_arc_3; public: - typedef bool result_type; - - result_type + Boolean operator() (const Line_arc_3 &l1, const Line_arc_3 &l2, const bool known_equal_supporting_line = false) const { return SphericalFunctors::do_overlap(l1, l2, known_equal_supporting_line); } - result_type + Boolean operator() (const Circular_arc_3 &c1, const Circular_arc_3 &c2, const bool known_equal_supporting_circle = false) const { return SphericalFunctors::do_overlap(c1, c2, known_equal_supporting_circle); } @@ -1264,16 +1237,13 @@ template < class SK > \ typedef typename SK::Circular_arc_3 Circular_arc_3; public: - - typedef void result_type; - - result_type + void operator()(const Line_arc_3 &l, const Circular_arc_point_3 &p, Line_arc_3 &ca1, Line_arc_3 &ca2) const { return SphericalFunctors::split(l, p, ca1, ca2); } - result_type + void operator()(const Circular_arc_3 &c, const Circular_arc_point_3 &p, Circular_arc_3 &ca1, Circular_arc_3 &ca2) const @@ -1283,7 +1253,7 @@ template < class SK > \ template class Construct_bbox_3 - : public SK::Linear_kernel::Construct_bbox_3 + // : public SK::Linear_kernel::Construct_bbox_3 { typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; typedef typename SK::Circular_arc_3 Circular_arc_3; @@ -1296,80 +1266,96 @@ template < class SK > \ typedef typename SK::Iso_cuboid_3 Iso_cuboid_3; typedef typename SK::Line_arc_3 Line_arc_3; + typedef typename SK::Linear_kernel::Construct_bbox_3 Linear_Construct_bbox_3; + public: + // using SK::Linear_kernel::Construct_bbox_3::operator(); - typedef typename SK::Linear_kernel::Construct_bbox_3::result_type result_type; + template + decltype(auto) + operator()(const A& a) const + { return Linear_Construct_bbox_3()(a); } - using SK::Linear_kernel::Construct_bbox_3::operator(); - - result_type operator() (const Circular_arc_point_3 & c) const + decltype(auto) operator() (const Circular_arc_point_3 & c) const { return c.rep().bbox(); } - result_type operator() (const Line_arc_3 & l) const + decltype(auto) operator() (const Line_arc_3 & l) const { return l.rep().bbox(); } - result_type operator() (const Circular_arc_3 & c) const + decltype(auto) operator() (const Circular_arc_3 & c) const { return c.rep().bbox(); } }; template class Compute_approximate_squared_length_3 - : public SK::Linear_kernel::Compute_approximate_squared_length_3 + // : public SK::Linear_kernel::Compute_approximate_squared_length_3 { typedef typename SK::Circle_3 Circle_3; typedef typename SK::Circular_arc_3 Circular_arc_3; typedef typename SK::FT FT; + typedef typename SK::Linear_kernel::Compute_approximate_squared_length_3 Linear_Compute_approximate_squared_length_3; + public: + // using SK::Linear_kernel::Compute_approximate_squared_length_3::operator(); - typedef double result_type; - using SK::Linear_kernel::Compute_approximate_squared_length_3::operator(); + template + double + operator()(const A& a) const + { return Linear_Compute_approximate_squared_length_3()(a); } - result_type operator() (const Circular_arc_3 & c) const + double operator() (const Circular_arc_3 & c) const { return c.rep().approximate_squared_length(); } }; template class Compute_approximate_angle_3 - : public SK::Linear_kernel::Compute_approximate_angle_3 + // : public SK::Linear_kernel::Compute_approximate_angle_3 { - typedef typename SK::Point_3 Point_3; - typedef typename SK::Vector_3 Vector_3; typedef typename SK::Circular_arc_3 Circular_arc_3; - typedef typename SK::FT FT; + + typedef typename SK::Linear_kernel::Compute_approximate_angle_3 Linear_Compute_approximate_angle_3; public: + // using SK::Linear_kernel::Compute_approximate_angle_3::operator(); - typedef double result_type; + template + decltype(auto) // the linear kernel has "FT" as return type... + operator()(const Args&... args) const + { return Linear_Compute_approximate_angle_3()(args...); } - using SK::Linear_kernel::Compute_approximate_angle_3::operator(); - - result_type operator() (const Circular_arc_3 & c) const + double operator() (const Circular_arc_3 & c) const { return c.rep().approximate_angle(); } }; template class Bounded_side_3 - : public SK::Linear_kernel::Bounded_side_3 + // : public SK::Linear_kernel::Bounded_side_3 { + typedef typename SK::Bounded_side Bounded_side; typedef typename SK::Sphere_3 Sphere_3; typedef typename SK::Circle_3 Circle_3; typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; typedef typename SK::Point_3 Point_3; + typedef typename SK::Linear_kernel::Bounded_side_3 Linear_Bounded_side_3; + public: - typedef typename SK::Linear_kernel::Bounded_side_3::result_type result_type; + // using SK::Linear_kernel::Bounded_side_3::operator(); - using SK::Linear_kernel::Bounded_side_3::operator(); + template + Bounded_side + operator()(const A& a, const B& b) const + { return Linear_Bounded_side_3()(a, b); } - result_type + Bounded_side operator()( const Sphere_3& s, const Circular_arc_point_3& p) const { return SphericalFunctors::bounded_side(s,p); } - result_type + Bounded_side operator()( const Circle_3& c, const Circular_arc_point_3& p) const { return SphericalFunctors::bounded_side(c,p); } @@ -1379,23 +1365,29 @@ template < class SK > \ template class Has_on_bounded_side_3 - : public SK::Linear_kernel::Has_on_bounded_side_3 + // : public SK::Linear_kernel::Has_on_bounded_side_3 { + typedef typename SK::Boolean Boolean; typedef typename SK::Sphere_3 Sphere_3; typedef typename SK::Circle_3 Circle_3; typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; typedef typename SK::Point_3 Point_3; + typedef typename SK::Linear_kernel::Has_on_bounded_side_3 Linear_Has_on_bounded_side_3; + public: - typedef typename SK::Linear_kernel::Has_on_bounded_side_3::result_type result_type; + // using SK::Linear_kernel::Has_on_bounded_side_3::operator(); - using SK::Linear_kernel::Has_on_bounded_side_3::operator(); + template + Boolean + operator()(const A& a, const B& b) const + { return Linear_Has_on_bounded_side_3()(a, b); } - result_type + Boolean operator()( const Sphere_3& s, const Circular_arc_point_3& p) const { return SK().bounded_side_3_object()(s,p) == ON_BOUNDED_SIDE; } - result_type + Boolean operator()( const Circle_3& c, const Circular_arc_point_3& p) const { return SK().bounded_side_3_object()(c,p) == ON_BOUNDED_SIDE; } @@ -1405,87 +1397,93 @@ template < class SK > \ template class Has_on_unbounded_side_3 - : public SK::Linear_kernel::Has_on_unbounded_side_3 + // : public SK::Linear_kernel::Has_on_unbounded_side_3 { + typedef typename SK::Boolean Boolean; typedef typename SK::Sphere_3 Sphere_3; typedef typename SK::Circle_3 Circle_3; typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; typedef typename SK::Point_3 Point_3; + typedef typename SK::Linear_kernel::Has_on_unbounded_side_3 Linear_Has_on_unbounded_side_3; + public: - typedef typename SK::Linear_kernel::Has_on_unbounded_side_3::result_type result_type; + // using SK::Linear_kernel::Has_on_unbounded_side_3::operator(); - using SK::Linear_kernel::Has_on_unbounded_side_3::operator(); + template + Boolean + operator()(const A& a, const B& b) const + { return Linear_Has_on_unbounded_side_3()(a, b); } - result_type + Boolean operator()( const Sphere_3& s, const Circular_arc_point_3& p) const { return SK().bounded_side_3_object()(s,p) == ON_UNBOUNDED_SIDE; } - result_type + Boolean operator()( const Circle_3& c, const Circular_arc_point_3& p) const { return SK().bounded_side_3_object()(c,p) == ON_UNBOUNDED_SIDE; } // We can maybe optimize it doing the operator() for point_3 too - }; template - class Is_theta_monotone_3{ + class Is_theta_monotone_3 + { typename SK::Sphere_3 sphere_; - public: - typedef bool result_type; + public: Is_theta_monotone_3(const typename SK::Sphere_3& sphere):sphere_(sphere){} - result_type + typename SK::Boolean operator()(const typename SK::Circular_arc_3& arc) const { return SphericalFunctors::is_theta_monotone_3(arc,sphere_); } }; template < class SK > - class Compare_theta_3{ + class Compare_theta_3 + { + typedef typename SK::Comparison_result Comparison_result; typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; - typedef typename SK::Vector_3 Vector_3; + typedef typename SK::Vector_3 Vector_3; typename SK::Sphere_3 sphere_; public: - typedef CGAL::Comparison_result result_type; - Compare_theta_3(const typename SK::Sphere_3& sphere):sphere_(sphere){} - result_type + Comparison_result operator() (const Circular_arc_point_3 &p0, const Circular_arc_point_3 &p1) const { return SphericalFunctors::compare_theta_of_pts(p0, p1,sphere_); } - result_type + Comparison_result operator() (const Circular_arc_point_3 &p, const Vector_3 &v) const { return SphericalFunctors::compare_theta_pt_vector(p,v,sphere_); } - result_type + Comparison_result operator() (const Vector_3 &m1, const Vector_3 &m2) const { return SphericalFunctors::compare_theta_vectors(m1,m2); } - result_type + Comparison_result operator() (const Vector_3 &v,const Circular_arc_point_3 &p0) const { return CGAL::opposite( SphericalFunctors::compare_theta_pt_vector(p0, v,sphere_) ); } }; template < class SK > - class Compare_theta_z_3{ + class Compare_theta_z_3 + { + typedef typename SK::Comparison_result Comparison_result; typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; + typename SK::Sphere_3 sphere_; public: - typedef CGAL::Comparison_result result_type; - Compare_theta_z_3(const typename SK::Sphere_3& sphere):sphere_(sphere){} - result_type + Comparison_result operator() (const Circular_arc_point_3 &p0, const Circular_arc_point_3 &p1,bool decreasing_z=false) const { return SphericalFunctors::compare_theta_z(p0, p1,sphere_,decreasing_z); } @@ -1493,7 +1491,8 @@ template < class SK > \ }; template < class SK > - class Make_theta_monotone_3{ + class Make_theta_monotone_3 + { typename SK::Sphere_3 sphere_; public: @@ -1512,16 +1511,18 @@ template < class SK > \ }; template - class Compare_z_to_right_3{ + class Compare_z_to_right_3 + { + typedef typename SK::Comparison_result Comparison_result; typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; typedef typename SK::Circular_arc_3 Circular_arc_3; + typename SK::Sphere_3 sphere_; public: - typedef CGAL::Comparison_result result_type; Compare_z_to_right_3(const typename SK::Sphere_3& sphere):sphere_(sphere){} - result_type + Comparison_result operator()(const Circular_arc_3& arc1,const Circular_arc_3& arc2,const Circular_arc_point_3& pt,bool do_to_the_left=false){ CGAL_kernel_precondition(SK().has_on_3_object()(sphere_,arc1)); CGAL_kernel_precondition(SK().has_on_3_object()(sphere_,arc2)); @@ -1544,14 +1545,16 @@ template < class SK > \ }; template - class Compare_z_at_theta_3{ - typename SK::Sphere_3 sphere_; + class Compare_z_at_theta_3 + { + typedef typename SK::Comparison_result Comparison_result; + + typename SK::Sphere_3 sphere_; public: - typedef CGAL::Comparison_result result_type; Compare_z_at_theta_3(const typename SK::Sphere_3& sphere):sphere_(sphere){} - result_type + Comparison_result operator()( const typename SK::Circular_arc_3& arc1, const typename SK::Circular_arc_3& arc2, const typename SK::Vector_3& m) const @@ -1559,7 +1562,7 @@ template < class SK > \ return SphericalFunctors::compare_z_at_theta_arcs(arc1,arc2,m,sphere_); } - result_type + Comparison_result operator()(const typename SK::Circular_arc_point_3& point, const typename SK::Circular_arc_3& arc) const { diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h index 41266c64bbf..f644d3e6ac1 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h @@ -85,7 +85,7 @@ namespace CGAL { template < class SK > inline - typename SK::Linear_kernel::Bounded_side_3::result_type + typename SK::Bounded_side bounded_side(const typename SK::Sphere_3 &s, const typename SK::Circular_arc_point_3 &p) { typedef typename SK::Algebraic_kernel Algebraic_kernel; @@ -99,7 +99,7 @@ namespace CGAL { template < class SK > inline - typename SK::Linear_kernel::Bounded_side + typename SK::Bounded_side bounded_side(const typename SK::Circle_3 &c, const typename SK::Circular_arc_point_3 &p) { typedef typename SK::Algebraic_kernel Algebraic_kernel; diff --git a/Circular_kernel_3/include/CGAL/Spherical_kernel_intersections.h b/Circular_kernel_3/include/CGAL/Spherical_kernel_intersections.h index 9360c96d18f..a587d87cea4 100644 --- a/Circular_kernel_3/include/CGAL/Spherical_kernel_intersections.h +++ b/Circular_kernel_3/include/CGAL/Spherical_kernel_intersections.h @@ -46,7 +46,7 @@ intersection(const A &c1, const B &c2, OutputIterator res) \ } \ template \ inline \ -bool \ +typename K::Boolean \ do_intersect(const A &c1, const B &c2) \ { \ return typename K::Do_intersect_3()(c1, c2); \ @@ -61,7 +61,7 @@ intersection(const A &c1, const B &c2, const C &c3, OutputIterator r } \ template \ inline \ -bool \ +typename K::Boolean \ do_intersect(const A &c1, const B &c2, const C &c3) \ { \ return typename K::Do_intersect_3()(c1, c2, c3); \ diff --git a/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp b/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp index 428866204fb..b6d2882b141 100644 --- a/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp +++ b/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp @@ -20,7 +20,7 @@ typedef K::Segment_3 Segment_3; typedef CGAL::Creator_uniform_3 Creator; typedef CGAL::Random_points_in_sphere_3 Generator; -const unsigned int num = 40; +const unsigned int num = 400000; template void compute_plane_equation(Facet_handle f) @@ -135,9 +135,9 @@ int main() std::cerr << "Testing coplanar hull" << std::endl; test_coplanar_hull(); - std::cerr << "Testing 500 random points" << std::endl; + std::cerr << "Testing " << num << " random points" << std::endl; std::vector points; - Generator g(500); + Generator g(1); std::copy_n( g, num, std::back_inserter(points)); assert(points.size() == num); diff --git a/Filtered_kernel/examples/Filtered_kernel/Filtered_predicate.cpp b/Filtered_kernel/examples/Filtered_kernel/Filtered_predicate.cpp index c69d93421e7..dd6e63907c0 100644 --- a/Filtered_kernel/examples/Filtered_kernel/Filtered_predicate.cpp +++ b/Filtered_kernel/examples/Filtered_kernel/Filtered_predicate.cpp @@ -16,9 +16,9 @@ struct My_orientation_2 typedef typename K::RT RT; typedef typename K::Point_2 Point_2; - typedef typename K::Orientation result_type; + typedef typename K::Orientation Orientation; - result_type + Orientation operator()(const Point_2 &p, const Point_2 &q, const Point_2 &r) const { RT prx = p.x() - r.x(); diff --git a/Filtered_kernel/include/CGAL/EPIC_predicate_if_convertible.h b/Filtered_kernel/include/CGAL/EPIC_predicate_if_convertible.h new file mode 100644 index 00000000000..615774f275e --- /dev/null +++ b/Filtered_kernel/include/CGAL/EPIC_predicate_if_convertible.h @@ -0,0 +1,69 @@ +// Copyright (c) 2017 GeometryFactory +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org) +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Andreas Fabri, Laurent Rineau + +#ifndef CGAL_EPIC_PREDICATE_IF_CONVERTIBLE_H +#define CGAL_EPIC_PREDICATE_IF_CONVERTIBLE_H + +#include + +namespace CGAL { + +template +class EPIC_predicate_if_convertible { +public: + FP fp; + EpicP epicp; + + template + auto + operator()(const Args&... args) const + -> decltype(fp(args...)) + { + const CGAL::Epic_converter converter; + + std::tuple converted_args; + + // When C++20 is available, check the blame and clean this all up with lambdas + bool success = convert_all_impl(std::index_sequence_for{}, converter, converted_args, args...); + if(!success) // failed to convert all arguments, call the base predicate + return fp(args...); + + return call_epicp_impl(std::index_sequence_for{}, converted_args); + } + +private: + template + bool convert_all_impl(std::index_sequence, + const Converter& converter, + Tuple& converted_args, + const Args&... args) const + { + auto convert = [&](auto index, const auto& arg) { + auto converted = converter(approx(arg)); + if(converted.second) + std::get(converted_args) = converted; + return converted.second; + }; + + return (... && convert(std::integral_constant{}, args)); + } + + template + auto call_epicp_impl(std::index_sequence, const Tuple& converted_args) const + -> decltype(epicp(std::get(converted_args).first...)) + { + return epicp(std::get(converted_args).first...); + } +}; + +} // CGAL + +#endif // CGAL_EPIC_PREDICATE_IF_CONVERTIBLE_H diff --git a/Filtered_kernel/include/CGAL/Filtered_construction.h b/Filtered_kernel/include/CGAL/Filtered_construction.h index 51910605980..7bdfc916a34 100644 --- a/Filtered_kernel/include/CGAL/Filtered_construction.h +++ b/Filtered_kernel/include/CGAL/Filtered_construction.h @@ -16,6 +16,8 @@ #include #include +#include + namespace CGAL { template - result_type - operator()(const A1 &a1) const + auto operator()(const A1 &a1) const + -> typename std::invoke_result::type { { - // Protection is outside the try block as VC8 has the CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG Protect_FPU_rounding P1; try { - return From_Filtered( Filter_construction(To_Filtered(a1)) ); + return From_Filtered(Filter_construction(To_Filtered(a1))); } catch (Uncertain_conversion_exception&) {} } Protect_FPU_rounding P(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - return From_Exact( Exact_construction(To_Exact(a1)) ); + return From_Exact(Exact_construction(To_Exact(a1))); } + template - result_type - operator()(const A1 &a1, const A2 &a2) const + auto operator()(const A1 &a1, const A2 &a2) const + -> typename std::invoke_result::type { { Protect_FPU_rounding P1; try { - return From_Filtered( Filter_construction(To_Filtered(a1), - To_Filtered(a2)) ); + return From_Filtered(Filter_construction(To_Filtered(a1), + To_Filtered(a2))); } catch (Uncertain_conversion_exception&) {} } Protect_FPU_rounding P(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - return From_Exact( Exact_construction(To_Exact(a1), - To_Exact(a2)) ); + return From_Exact(Exact_construction(To_Exact(a1), + To_Exact(a2))); } template - result_type - operator()(const A1 &a1, const A2 &a2, const A3 &a3) const + auto operator()(const A1 &a1, const A2 &a2, const A3 &a3) const + -> typename std::invoke_result::type { { Protect_FPU_rounding P1; try { - return From_Filtered( Filter_construction(To_Filtered(a1), - To_Filtered(a2), - To_Filtered(a3)) ); + return From_Filtered(Filter_construction(To_Filtered(a1), + To_Filtered(a2), + To_Filtered(a3))); } catch (Uncertain_conversion_exception&) {} } Protect_FPU_rounding P(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - return From_Exact( Exact_construction(To_Exact(a1), - To_Exact(a2), - To_Exact(a3)) ); + return From_Exact(Exact_construction(To_Exact(a1), + To_Exact(a2), + To_Exact(a3))); } - }; - - -} //namespace CGAL - +} // namespace CGAL #endif // CGAL_FILTERED_CONSTRUCTION_H diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Angle_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Angle_3.h index e9428fd2917..f54f028d47d 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Angle_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Angle_3.h @@ -34,13 +34,12 @@ template < typename K_base > class Angle_3 : public K_base::Angle_3 { - typedef typename K_base::Point_3 Point_3; + typedef typename K_base::Angle Angle; + typedef typename K_base::Point_3 Point_3; + typedef typename K_base::Angle_3 Base; public: - - typedef typename Base::result_type result_type; - using Base::operator(); Sign sign_with_error(const double x, const double error) const { @@ -49,7 +48,7 @@ public: else return ZERO; } - result_type operator()(const Point_3 &p, const Point_3& q, const Point_3& r) const + Angle operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Angle_3", tmp); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Collinear_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Collinear_3.h index 9279f60c3d2..4dd64070b5c 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Collinear_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Collinear_3.h @@ -24,16 +24,16 @@ template < typename K_base > class Collinear_3 : public K_base::Collinear_3 { + typedef typename K_base::Boolean Boolean; typedef typename K_base::Point_3 Point_3; typedef typename K_base::Vector_3 Vector_3; typedef typename K_base::Sphere_3 Sphere_3; typedef typename K_base::Tetrahedron_3 Tetrahedron_3; - typedef typename K_base::Collinear_3 Base; + + typedef typename K_base::Collinear_3 Base; public: - - typedef typename Base::result_type result_type; - result_type + Boolean operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r) const { CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Collinear_3", tmp); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_distance_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_distance_3.h index f3880b3f0e2..4589aa9aa81 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_distance_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_distance_3.h @@ -30,17 +30,16 @@ template < typename K_base > class Compare_distance_3 : public K_base::Compare_distance_3 { - typedef typename K_base::Point_3 Point_3; - typedef typename K_base::Vector_3 Vector_3; + typedef typename K_base::Comparison_result Comparison_result; + typedef typename K_base::Point_3 Point_3; + typedef typename K_base::Vector_3 Vector_3; + typedef typename K_base::Compare_distance_3 Base; public: - - typedef typename Base::result_type result_type; - using Base::operator(); - result_type operator()(const Point_3 &p, const Point_3& q, const Point_3& r) const + Comparison_result operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_squared_radius_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_squared_radius_3.h index 8e0683677aa..aecee9d3618 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_squared_radius_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_squared_radius_3.h @@ -24,15 +24,16 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { class Compare_squared_radius_3 : public K_base::Compare_squared_radius_3 { - typedef typename K_base::Point_3 Point_3; - typedef typename K_base::FT FT; - typedef typename K_base::Compare_squared_radius_3 Base; - public: - typedef typename Base::result_type result_type; + typedef typename K_base::Comparison_result Comparison_result; + typedef typename K_base::Point_3 Point_3; + typedef typename K_base::FT FT; + typedef typename K_base::Compare_squared_radius_3 Base; + + public: using Base::operator(); - result_type operator() ( + Comparison_result operator() ( const Point_3& p, const Point_3& q, const Point_3& r, @@ -185,7 +186,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { return Base::operator()(p,q,r,s,w); } - result_type operator() ( + Comparison_result operator() ( const Point_3& p, const Point_3& q, const Point_3& s, @@ -312,14 +313,14 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { } } } - return static_cast(int_tmp_result); + return static_cast(int_tmp_result); } else return Base::operator()(p,q,s,w); } - result_type operator() ( + Comparison_result operator() ( const Point_3& p, const Point_3& q, const FT& w diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_weighted_squared_radius_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_weighted_squared_radius_3.h index 41b9f1b9e77..3a8afc92ba3 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_weighted_squared_radius_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_weighted_squared_radius_3.h @@ -27,15 +27,16 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { class Compare_weighted_squared_radius_3: public K_base::Compare_weighted_squared_radius_3 { - typedef typename K_base::Weighted_point_3 Weighted_point_3; - typedef typename K_base::FT FT; - typedef typename K_base::Compare_weighted_squared_radius_3 Base; - public: - typedef typename Base::result_type result_type; + typedef typename K_base::Comparison_result Comparison_result; + typedef typename K_base::Weighted_point_3 Weighted_point_3; + typedef typename K_base::FT FT; + typedef typename K_base::Compare_weighted_squared_radius_3 Base; + + public: using Base::operator(); - result_type operator() ( + Comparison_result operator() ( const Weighted_point_3& p, const Weighted_point_3& q, const Weighted_point_3& r, @@ -175,7 +176,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { return Base::operator()(p,q,r,s,w); } - result_type + Comparison_result operator() ( const Weighted_point_3& p, const Weighted_point_3& q , @@ -292,7 +293,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { return Base::operator()(p,q,r,w); } - result_type + Comparison_result operator() ( const Weighted_point_3& p, const Weighted_point_3& q, diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_x_2.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_x_2.h index 29c6d291051..3478f524983 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_x_2.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_x_2.h @@ -31,17 +31,16 @@ template < typename K_base > class Compare_x_2 : public K_base::Compare_x_2 { - typedef typename K_base::Point_2 Point_2; - typedef typename K_base::Line_2 Line_2; - typedef typename K_base::Compare_x_2 Base; + typedef typename K_base::Comparison_result Comparison_result; + typedef typename K_base::Point_2 Point_2; + typedef typename K_base::Line_2 Line_2; + + typedef typename K_base::Compare_x_2 Base; public: - - typedef typename Base::result_type result_type; - using Base::operator(); - result_type operator()(const Point_2 &p, const Point_2& q) const + Comparison_result operator()(const Point_2& p, const Point_2& q) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_y_2.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_y_2.h index da9b97215a8..043a174ce99 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_y_2.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_y_2.h @@ -31,17 +31,16 @@ template < typename K_base > class Compare_y_2 : public K_base::Compare_y_2 { - typedef typename K_base::Point_2 Point_2; - typedef typename K_base::Line_2 Line_2; - typedef typename K_base::Compare_y_2 Base; + typedef typename K_base::Comparison_result Comparison_result; + typedef typename K_base::Point_2 Point_2; + typedef typename K_base::Line_2 Line_2; + + typedef typename K_base::Compare_y_2 Base; public: - - typedef typename Base::result_type result_type; - using Base::operator(); - result_type operator()(const Point_2 &p, const Point_2& q) const + Comparison_result operator()(const Point_2 &p, const Point_2& q) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_y_at_x_2.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_y_at_x_2.h index 5de1af9d7b2..8c9204f718f 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_y_at_x_2.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_y_at_x_2.h @@ -22,13 +22,14 @@ template < typename K_base, typename Kernel > class Compare_y_at_x_2 : public K_base::Compare_y_at_x_2 { - typedef typename K_base::Point_2 Point_2; - typedef typename K_base::Segment_2 Segment_2; - typedef typename K_base::FT FT; - typedef typename K_base::Compare_y_at_x_2 Base; + typedef typename K_base::Comparison_result Comparison_result; + typedef typename K_base::Point_2 Point_2; + typedef typename K_base::Segment_2 Segment_2; + typedef typename K_base::FT FT; + + typedef typename K_base::Compare_y_at_x_2 Base; public: - using Base::operator(); Comparison_result diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_3.h index fedf31fcba9..38c4384769c 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_3.h @@ -25,17 +25,14 @@ template < typename K_base, typename SFK > class Coplanar_3 : public K_base::Coplanar_3 { - typedef typename K_base::Point_3 Point_3; + typedef typename K_base::Boolean Boolean; + typedef typename K_base::Point_3 Point_3; + typedef typename K_base::Coplanar_3 Base; typedef typename SFK::Orientation_3 Orientation_3; public: - - typedef typename Base::result_type result_type; - - - - result_type + Boolean operator()(const Point_3& p,const Point_3& q, const Point_3& r, const Point_3& s) const { return Orientation_3()(p,q,r,s) == COPLANAR; diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_orientation_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_orientation_3.h index 212dddec6cf..255f95c1ab7 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_orientation_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_orientation_3.h @@ -40,12 +40,12 @@ template < typename Kernel > class Coplanar_orientation_3 : public Kernel::Coplanar_orientation_3 { + typedef typename Kernel::Orientation Orientation; typedef typename Kernel::Point_3 Point_3; + typedef typename Kernel::Coplanar_orientation_3 Base; public: - typedef Orientation result_type; - Orientation operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r) const { return opti_coplanar_orientationC3( diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h index 48c96ec886c..ae9c2e36229 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h @@ -44,8 +44,6 @@ class Side_of_bounded_circle_3 } public: - typedef Bounded_side result_type; - Bounded_side operator()(const Point &p, const Point &q, const Point &r, const Point &t) const { diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_2.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_2.h index a5533c253fa..088648b9d72 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_2.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_2.h @@ -28,16 +28,13 @@ template < typename K_base, typename SFK > class Do_intersect_2 : public K_base::Do_intersect_2 { + typedef typename K_base::Boolean Boolean; typedef typename K_base::Point_2 Point_2; typedef typename K_base::Segment_2 Segment_2; + typedef typename K_base::Do_intersect_2 Base; - typedef K_base TA1; - typedef SFK TA2; public: - - typedef typename Base::result_type result_type; - using Base::operator(); // The internal::do_intersect(..) function @@ -47,19 +44,19 @@ public: // the statically filtered kernel we avoid // that doubles are put into Interval_nt // to get taken out again with fit_in_double - result_type + Boolean operator()(const Segment_2 &s, const Segment_2& t) const { return Intersections::internal::do_intersect(s,t, SFK()); } - result_type + Boolean operator()(const Point_2 &p, const Segment_2& t) const { return Intersections::internal::do_intersect(p,t, SFK()); } - result_type + Boolean operator()(const Segment_2& t, const Point_2 &p) const { return Intersections::internal::do_intersect(p,t, SFK()); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_3.h index 2b0ef97d7fc..1d19ce5a469 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_3.h @@ -39,18 +39,17 @@ template < typename K_base, typename SFK > class Do_intersect_3 : public K_base::Do_intersect_3 { + typedef typename K_base::Boolean Boolean; typedef typename K_base::Point_3 Point_3; typedef typename K_base::Ray_3 Ray_3; typedef typename K_base::Segment_3 Segment_3; typedef typename K_base::Triangle_3 Triangle_3; typedef typename K_base::Tetrahedron_3 Tetrahedron_3; typedef typename K_base::Sphere_3 Sphere_3; + typedef typename K_base::Do_intersect_3 Base; public: - - typedef typename Base::result_type result_type; - using Base::operator(); Sign sign_with_error(const double x, const double error) const { @@ -67,32 +66,31 @@ public: // the statically filtered kernel we avoid // that doubles are put into Interval_nt // to get taken out again with fit_in_double - result_type + Boolean operator()(const Segment_3 &s, const Triangle_3& t) const { return Intersections::internal::do_intersect(t,s, SFK()); } - result_type + Boolean operator()(const Triangle_3& t, const Segment_3 &s) const { return Intersections::internal::do_intersect(t,s, SFK()); } - result_type + Boolean operator()(const Triangle_3 &t0, const Triangle_3& t1) const { return Intersections::internal::do_intersect(t0,t1, SFK()); } - - result_type + Boolean operator()(const Bbox_3& b, const Segment_3 &s) const { return this->operator()(s, b); } - result_type + Boolean operator()(const Segment_3 &s, const Bbox_3& b) const { CGAL_BRANCH_PROFILER_3(std::string("semi-static failures/attempts/calls to : ") + @@ -111,7 +109,7 @@ public: { CGAL_BRANCH_PROFILER_BRANCH_1(tmp); - const Uncertain ub = + const Uncertain ub = Intersections::internal::do_intersect_bbox_segment_aux operator()(t, b); } - result_type + Boolean operator()(const Tetrahedron_3 &t, const Bbox_3& b) const { CGAL_BRANCH_PROFILER_3(std::string("semi-static failures/attempts/calls to : ") + @@ -168,13 +166,13 @@ public: return Base::operator()(t,b); } - result_type + Boolean operator()(const Bbox_3& b, const Ray_3 &r) const { return this->operator()(r, b); } - result_type + Boolean operator()(const Ray_3 &r, const Bbox_3& b) const { CGAL_BRANCH_PROFILER_3(std::string("semi-static failures/attempts/calls to : ") + @@ -193,7 +191,7 @@ public: { CGAL_BRANCH_PROFILER_BRANCH_1(tmp); - const Uncertain ub = + const Uncertain ub = Intersections::internal::do_intersect_bbox_segment_aux operator()(t, b); @@ -487,7 +484,7 @@ public: return false; }; - result_type + Boolean operator()(const Triangle_3 &t, const Bbox_3& b) const { CGAL_BRANCH_PROFILER_3(std::string("semi-static failures/attempts/calls to : ") + @@ -616,14 +613,14 @@ public: return Base::operator()(t,b); } - result_type + Boolean operator()(const Bbox_3& b, const Sphere_3 &s) const { return this->operator()(s, b); } // The parameter overestimate is used to avoid a filter failure in AABB_tree::closest_point() - result_type + Boolean operator()(const Sphere_3 &s, const Bbox_3& b, bool overestimate = false) const { CGAL_BRANCH_PROFILER_3(std::string("semi-static failures/attempts/calls to : ") + diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Equal_2.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Equal_2.h index 60b2360a939..79832da2535 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Equal_2.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Equal_2.h @@ -31,18 +31,16 @@ template < typename K_base > class Equal_2 : public K_base::Equal_2 { + typedef typename K_base::Boolean Boolean; typedef typename K_base::FT FT; typedef typename K_base::Point_2 Point_2; typedef typename K_base::Vector_2 Vector_2; typedef typename K_base::Equal_2 Base; public: - - typedef typename Base::result_type result_type; - using Base::operator(); - result_type operator()(const Point_2 &p, const Point_2& q) const + Boolean operator()(const Point_2& p, const Point_2& q) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); @@ -61,8 +59,7 @@ public: return Base::operator()(p, q); } - - result_type operator()(const Vector_2 &p, const Vector_2& q) const + Boolean operator()(const Vector_2& p, const Vector_2& q) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Equal_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Equal_3.h index 10c44051ae2..5d04c892d7f 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Equal_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Equal_3.h @@ -31,17 +31,16 @@ template < typename K_base > class Equal_3 : public K_base::Equal_3 { + typedef typename K_base::Boolean Boolean; typedef typename K_base::Point_3 Point_3; typedef typename K_base::Vector_3 Vector_3; + typedef typename K_base::Equal_3 Base; public: - - typedef typename Base::result_type result_type; - using Base::operator(); - result_type operator()(const Point_3 &p, const Point_3& q) const + Boolean operator()(const Point_3& p, const Point_3& q) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); @@ -62,7 +61,7 @@ public: } - result_type operator()(const Vector_3 &p, const Vector_3& q) const + Boolean operator()(const Vector_3& p, const Vector_3& q) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); @@ -83,7 +82,7 @@ public: } - result_type operator()(const Vector_3 &p, const Null_vector &q) const + Boolean operator()(const Vector_3& p, const Null_vector& q) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Is_degenerate_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Is_degenerate_3.h index a4af481f7e1..6b43f629126 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Is_degenerate_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Is_degenerate_3.h @@ -25,6 +25,7 @@ template < typename K_base, typename SFK > class Is_degenerate_3 : public K_base::Is_degenerate_3 { + typedef typename K_base::Boolean Boolean; typedef typename K_base::Ray_3 Ray_3; typedef typename K_base::Segment_3 Segment_3; typedef typename K_base::Plane_3 Plane_3; @@ -35,25 +36,21 @@ class Is_degenerate_3 typedef typename SFK::Equal_3 Equal_3; public: - - typedef typename Base::result_type result_type; - using Base::operator(); - result_type + Boolean operator()(const Segment_3& s) const { return Equal_3()(Construct_source_3()(s), Construct_target_3()(s)); } - - result_type + Boolean operator()(const Ray_3& r) const { return Equal_3()(Construct_source_3()(r), Construct_second_point_3()(r)); } - result_type + Boolean operator()(const Plane_3& p) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Orientation_2.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Orientation_2.h index cbb4494e7cd..11cd803458a 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Orientation_2.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Orientation_2.h @@ -25,16 +25,14 @@ template < typename K_base > class Orientation_2 : public K_base::Orientation_2 { + typedef typename K_base::Orientation Orientation; typedef typename K_base::Point_2 Point_2; typedef typename K_base::Vector_2 Vector_2; - typedef typename K_base::Circle_2 Circle_2; + typedef typename K_base::Circle_2 Circle_2; typedef typename K_base::Orientation_2 Base; public: - - typedef typename Base::result_type result_type; - using Base::operator(); Orientation diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Orientation_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Orientation_3.h index 2fdffde6fda..f7d126dfaf0 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Orientation_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Orientation_3.h @@ -27,18 +27,18 @@ template < typename K_base > class Orientation_3 : public K_base::Orientation_3 { + typedef typename K_base::Orientation Orientation; typedef typename K_base::Point_3 Point_3; typedef typename K_base::Vector_3 Vector_3; typedef typename K_base::Sphere_3 Sphere_3; typedef typename K_base::Tetrahedron_3 Tetrahedron_3; + typedef typename K_base::Orientation_3 Base; public: - typedef typename Base::result_type result_type; - using Base::operator(); - result_type + Orientation operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r, const Point_3 &s) const { diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Power_side_of_oriented_power_circle_2.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Power_side_of_oriented_power_circle_2.h index f9097923bab..e7f1c195da8 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Power_side_of_oriented_power_circle_2.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Power_side_of_oriented_power_circle_2.h @@ -26,15 +26,15 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { class Power_side_of_oriented_power_circle_2: public K_base::Power_side_of_oriented_power_circle_2 { + typedef typename K_base::Oriented_side Oriented_side; typedef typename K_base::Weighted_point_2 Weighted_point_2; typedef typename K_base::FT FT; typedef typename K_base::Power_side_of_oriented_power_circle_2 Base; - public: - typedef typename Base::result_type result_type; + public: using Base::operator(); - result_type operator() ( const Weighted_point_2 & p, + Oriented_side operator()(const Weighted_point_2 & p, const Weighted_point_2 & q, const Weighted_point_2 & r, const Weighted_point_2 & t) const @@ -64,7 +64,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { double drx = (rx - tx); double dry = (ry - ty); double drz = (((square( drx ) + square( dry )) - rwt) + twt); - result_type int_tmp_result; + Oriented_side int_tmp_result; double RT_tmp_result; double eps; RT_tmp_result = CGAL::determinant( dpx, dpy, dpz, dqx, dqy, dqz, drx, dry, drz ); @@ -162,7 +162,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { } - result_type operator() ( const Weighted_point_2 & p, + Oriented_side operator()(const Weighted_point_2 & p, const Weighted_point_2 & q, const Weighted_point_2 & t) const { @@ -219,7 +219,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { double upper_bound_1; if( (cmpx != 0) ) { - result_type int_tmp_result; + Oriented_side int_tmp_result; double RT_tmp_result; RT_tmp_result = CGAL::determinant( dpx, dpz, dqx, dqz ); lower_bound_1 = max2; @@ -265,11 +265,11 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { } } } - return static_cast(cmpx * int_tmp_result); + return static_cast(cmpx * int_tmp_result); } int cmpy; cmpy = ((py > qy) ? 1 : ((py < qy) ? -1 : 0)); - result_type int_tmp_result_FFWKCAA; + Oriented_side int_tmp_result_FFWKCAA; double RT_tmp_result_k60Ocge = CGAL::determinant( dpy, dpz, dqy, dqz ); lower_bound_1 = max4; upper_bound_1 = max4; @@ -314,7 +314,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { } } } - return static_cast(cmpy * int_tmp_result_FFWKCAA); + return static_cast(cmpy * int_tmp_result_FFWKCAA); } else diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Power_side_of_oriented_power_sphere_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Power_side_of_oriented_power_sphere_3.h index f4adbbe18cf..c6fabbb4927 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Power_side_of_oriented_power_sphere_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Power_side_of_oriented_power_sphere_3.h @@ -26,12 +26,12 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { class Power_side_of_oriented_power_sphere_3: public K_base::Power_side_of_oriented_power_sphere_3 { + typedef typename K_base::Oriented_side Oriented_side; typedef typename K_base::Weighted_point_3 Weighted_point_3; typedef typename K_base::FT FT; typedef typename K_base::Power_side_of_oriented_power_sphere_3 Base; - public: - typedef typename Base::result_type result_type; + public: using Base::operator(); void @@ -107,11 +107,11 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { } - result_type operator() ( const Weighted_point_3 & p, - const Weighted_point_3 & q, - const Weighted_point_3 & r, - const Weighted_point_3 & s, - const Weighted_point_3 & t) const + Oriented_side operator() (const Weighted_point_3& p, + const Weighted_point_3& q, + const Weighted_point_3& r, + const Weighted_point_3& s, + const Weighted_point_3& t) const { CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Power_side_of_power_sphere_3 with 4+1 wpoints", tmp); @@ -225,7 +225,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { return Base::operator()(p,q,r,s,t); } - result_type int_tmp_result; + Oriented_side int_tmp_result; double eps = (1.67106803095990471147e-13 * (((max2 * max3) * max4) * (CGAL::max) ( max5, (max1 * max1) ))); @@ -253,10 +253,10 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { return Base::operator()(p,q,r,s,t); } - result_type operator() ( const Weighted_point_3 & p, - const Weighted_point_3 & q, - const Weighted_point_3 & r, - const Weighted_point_3 & t) const + Oriented_side operator() (const Weighted_point_3& p, + const Weighted_point_3& q, + const Weighted_point_3& r, + const Weighted_point_3& t) const { CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Power_side_of_oriented_power_sphere_3 with 3+1 wpoints", tmp); @@ -408,15 +408,15 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { } } } - return static_cast(cmp * int_tmp_result_FFWKCAA); + return static_cast(cmp * int_tmp_result_FFWKCAA); } else return Base::operator()(p,q,r,t); } - result_type operator() ( const Weighted_point_3 & p, - const Weighted_point_3 & q, - const Weighted_point_3 & t) const + Oriented_side operator() (const Weighted_point_3& p, + const Weighted_point_3& q, + const Weighted_point_3& t) const { CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Power_side_of_oriented_power_sphere_3 with 2+1 wpoints", tmp); @@ -506,7 +506,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { } } } - return static_cast(cmp * int_tmp_result); + return static_cast(cmp * int_tmp_result); } cmp = ((py > qy) ? 1 : ((py < qy) ? -1 : 0)); if( (cmp != 0) ) @@ -549,7 +549,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { } } } - return static_cast(cmp * int_tmp_result_FFWKCAA); + return static_cast(cmp * int_tmp_result_FFWKCAA); } cmp = ((pz > qz) ? 1 : ((pz < qz) ? -1 : 0)); int int_tmp_result_3SPBwDj; @@ -592,7 +592,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { } } } - return static_cast(cmp * int_tmp_result_3SPBwDj); + return static_cast(cmp * int_tmp_result_3SPBwDj); } else return Base::operator()(p,q,t); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_circle_2.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_circle_2.h index 3b59fed08db..0762a4948f4 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_circle_2.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_circle_2.h @@ -23,11 +23,11 @@ template < typename K_base > class Side_of_oriented_circle_2 : public K_base::Side_of_oriented_circle_2 { + typedef typename K_base::Oriented_side Oriented_side; typedef typename K_base::Point_2 Point_2; typedef typename K_base::Side_of_oriented_circle_2 Base; public: - Oriented_side operator()(const Point_2 &p, const Point_2 &q, const Point_2 &r, const Point_2 &t) const { diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_sphere_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_sphere_3.h index 41a54d33012..90b128c5eee 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_sphere_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_sphere_3.h @@ -22,11 +22,11 @@ template < typename K_base > class Side_of_oriented_sphere_3 : public K_base::Side_of_oriented_sphere_3 { + typedef typename K_base::Oriented_side Oriented_side; typedef typename K_base::Point_3 Point_3; typedef typename K_base::Side_of_oriented_sphere_3 Base; public: - Oriented_side operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r, const Point_3 &s, const Point_3 &t) const diff --git a/Filtered_kernel/include/CGAL/Filtered_predicate.h b/Filtered_kernel/include/CGAL/Filtered_predicate.h index acfe6892a7c..99be87fecf1 100644 --- a/Filtered_kernel/include/CGAL/Filtered_predicate.h +++ b/Filtered_kernel/include/CGAL/Filtered_predicate.h @@ -28,7 +28,7 @@ namespace CGAL { // TODO : // - each predicate in the default kernel should define a tag that says if it -// wants to be filtered or not (=> all homogeneous predicate define this +// wants to be filtered or not (=> all homogeneous predicates define this // tag). We could even test-suite that automatically. It makes a strong // new requirement on the kernel though... // Could be done with a traits mechanism ? @@ -52,18 +52,13 @@ class Filtered_predicate EP ep; AP ap; - typedef typename AP::result_type Ares; - public: - + // AP's result type must be convertible to EP's result type. typedef AP Approximate_predicate; typedef EP Exact_predicate; typedef C2E To_exact_converter; typedef C2A To_approximate_converter; - typedef typename EP::result_type result_type; - // AP::result_type must be convertible to EP::result_type. - Filtered_predicate() {} @@ -85,11 +80,14 @@ public: {} template - result_type + auto operator()(const Args&... args) const { + typedef typename Remove_needs_FT >::Type result_type; #ifndef CGAL_EPICK_NO_INTERVALS + typedef typename Remove_needs_FT >::Type Ares; + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); // Protection is outside the try block as VC8 has the CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG { @@ -98,7 +96,7 @@ public: { Ares res = ap(c2a(args)...); if (is_certain(res)) - return get_certain(res); + return result_type(get_certain(res)); } catch (Uncertain_conversion_exception&) {} } @@ -106,7 +104,7 @@ public: Protect_FPU_rounding p(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); #endif // CGAL_EPICK_NO_INTERVALS - return ep(c2e(args)...); + return result_type(ep(c2e(args)...)); } }; @@ -120,27 +118,28 @@ class Filtered_predicate_RT_FT EP_FT ep_ft; AP ap; - using Ares = typename Remove_needs_FT::Type; - -public: - using result_type = typename Remove_needs_FT::Type; - private: + // Detect if the predicate's result type has been wrapped with the `Needs_FT` class template struct Call_operator_needs_FT { - using Actual_approx_res = decltype(ap(c2a(std::declval())...)); - using Approx_res = std::remove_cv_t >; - enum { value = std::is_same >::value }; + template + struct is_Needs_FT : std::false_type { }; + template + struct is_Needs_FT > : std::true_type { }; + + typedef CGAL::cpp20::remove_cvref_t())...))> Actual_approx_res; + enum { value = is_Needs_FT::value }; }; + // If there is no `Needs_FT` in the result, then we can use an RT-based exact predicate template ::value>* = nullptr> - result_type call(const Args&... args) const { return ep_ft(c2e_ft(args)...); } + decltype(auto) exact_call(const Args&... args) const { return ep_ft(c2e_ft(args)...); } template ::value>* = nullptr> - result_type call(const Args&... args) const { return ep_rt(c2e_rt(args)...); } + decltype(auto) exact_call(const Args&... args) const { return ep_rt(c2e_rt(args)...); } public: // ## Important note @@ -154,10 +153,14 @@ public: bool needs_FT(const Args&...) const { return Call_operator_needs_FT::value; } template - result_type + auto operator()(const Args&... args) const { + typedef typename Remove_needs_FT >::Type result_type; + #ifndef CGAL_EPICK_NO_INTERVALS + typedef typename Remove_needs_FT >::Type Ares; + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); // Protection is outside the try block as VC8 has the CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG { @@ -166,7 +169,7 @@ public: { Ares res = ap(c2a(args)...); if (is_certain(res)) - return get_certain(res); + return result_type(get_certain(res)); } catch (Uncertain_conversion_exception&) {} } @@ -174,7 +177,7 @@ public: Protect_FPU_rounding p(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); #endif // CGAL_EPICK_NO_INTERVALS - return call(args...); + return result_type(exact_call(args...)); } }; diff --git a/Filtered_kernel/include/CGAL/Filtered_predicate_with_state.h b/Filtered_kernel/include/CGAL/Filtered_predicate_with_state.h index 991fe8247b5..d985227f21c 100644 --- a/Filtered_kernel/include/CGAL/Filtered_predicate_with_state.h +++ b/Filtered_kernel/include/CGAL/Filtered_predicate_with_state.h @@ -33,33 +33,27 @@ class Filtered_predicate_with_state O1 o1; mutable std::optional oep; AP ap; - typedef typename AP::result_type Ares; public: - + // AP::result_type must be convertible to EP::result_type. typedef AP Approximate_predicate; typedef EP Exact_predicate; typedef C2E To_exact_converter; typedef C2A To_approximate_converter; - typedef typename EP::result_type result_type; - // AP::result_type must be convertible to EP::result_type. - Filtered_predicate_with_state(const O1 &o1) : c2e(), c2a(), o1(o1), oep(), ap(c2a(o1)) {} template - result_type - operator()(const Args&... args) const; -}; - -template - template -typename Filtered_predicate_with_state::result_type -Filtered_predicate_with_state:: + auto operator()(const Args&... args) const -{ + { + typedef typename Remove_needs_FT >::Type result_type; + +#ifndef CGAL_EPICK_NO_INTERVALS + typedef typename Remove_needs_FT >::Type Ares; + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); // Protection is outside the try block as VC8 has the CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG { @@ -68,18 +62,22 @@ Filtered_predicate_with_state:: { Ares res = ap(c2a(args)...); if (is_certain(res)) - return get_certain(res); + return result_type(get_certain(res)); } catch (Uncertain_conversion_exception&) {} } CGAL_BRANCH_PROFILER_BRANCH(tmp); Protect_FPU_rounding p(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); +#endif if(! oep){ oep.emplace(c2e(o1)); } - return (*oep)(c2e(args)...); -} + return result_type((*oep)(c2e(args)...)); + } +}; + + } //namespace CGAL diff --git a/Filtered_kernel/include/CGAL/Kernel_profiler.h b/Filtered_kernel/include/CGAL/Kernel_profiler.h index 20611510e94..aaaa310afce 100644 --- a/Filtered_kernel/include/CGAL/Kernel_profiler.h +++ b/Filtered_kernel/include/CGAL/Kernel_profiler.h @@ -25,8 +25,6 @@ template < typename P > struct Primitive_profiler : public P { - typedef typename P::result_type result_type; - // #define CGAL_KERNEL_PROFILER CGAL_PROFILER(CGAL_PRETTY_FUNCTION); #define CGAL_KERNEL_PROFILER \ CGAL_PROFILER(typeid(static_cast(*this)).name()) @@ -35,7 +33,7 @@ struct Primitive_profiler : P(p) {} template - result_type + decltype(auto) operator()(A&& ... a) const { CGAL_KERNEL_PROFILER; diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 164653d522a..29076772270 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -867,217 +867,6 @@ struct Exact_converter { return b; } }; -//____________________________________________________________ - - - -template -class Lazy_rep_with_vector_1 final - : public Lazy_rep, std::vector, E2A> - , private EC -{ - typedef std::vector AT; - typedef std::vector ET; - typedef Lazy_rep Base; - - mutable L1 l1_; - - const EC& ec() const { return *this; } - -public: - - void - update_exact() const - { - auto* p = new typename Base::Indirect(); - // TODO : This looks really unfinished... - std::vector vec; - //this->et->reserve(this->at.size()); - ec()(CGAL::exact(l1_), std::back_inserter(p->et_)); - this->set_at(p); - this->set_ptr(p); - // Prune lazy tree - lazy_reset_member(l1_); - } - - Lazy_rep_with_vector_1(const AC& ac, const EC& /*ec*/, const L1& l1) - : l1_(l1) - { - ac(CGAL::approx(l1), std::back_inserter(this->at_orig.at_)); - } - -#ifdef CGAL_LAZY_KERNEL_DEBUG - void - print_dag(std::ostream& os, int level) const - { - this->print_at_et(os, level); - os << "A Lazy_rep_with_vector_1 of size " << this->approx().size() << std::endl; - if(this->is_lazy()){ - CGAL::msg(os, level, "DAG with one child node:"); - CGAL::print_dag(l1_, os, level+1); - - } - } -#endif -}; - - -template -class Lazy_rep_with_vector_2 final - : public Lazy_rep, std::vector, E2A> - , private EC -{ - typedef std::vector AT; - typedef std::vector ET; - typedef Lazy_rep Base; - - mutable L1 l1_; - mutable L2 l2_; - - const EC& ec() const { return *this; } - -public: - - void - update_exact() const - { - auto* p = new typename Base::Indirect(); - p->et_.reserve(this->at_orig.at().size()); - ec()(CGAL::exact(l1_), CGAL::exact(l2_), std::back_inserter(p->et_)); - this->set_at(p); - this->set_ptr(p); - // Prune lazy tree - lazy_reset_member(l1_); - lazy_reset_member(l2_); - } - - Lazy_rep_with_vector_2(const AC& ac, const EC& /*ec*/, const L1& l1, const L2& l2) - : l1_(l1), l2_(l2) - { - ac(CGAL::approx(l1), CGAL::approx(l2), std::back_inserter(this->at_orig.at_)); - } - -#ifdef CGAL_LAZY_KERNEL_DEBUG - void - print_dag(std::ostream& os, int level) const - { - this->print_at_et(os, level); - os << "A Lazy_rep_with_vector_2 of size " << this->approx().size() << std::endl; - if(this->is_lazy()){ - CGAL::msg(os, level, "DAG with two child nodes:"); - CGAL::print_dag(l1_, os, level+1); - CGAL::print_dag(l2_, os, level+1); - } - } -#endif -}; - - -template -class Lazy_rep_2_1 final - : public Lazy_rep - , private EC -{ - typedef typename R1::AT AT; - typedef typename R1::ET ET; - typedef Lazy_rep Base; - - mutable L1 l1_; - mutable L2 l2_; - - const EC& ec() const { return *this; } - -public: - - void - update_exact() const - { - auto* p = new typename Base::Indirect(); - ec()(CGAL::exact(l1_), CGAL::exact(l2_), p->et_); - this->set_at(p); - this->set_ptr(p); - // Prune lazy tree - lazy_reset_member(l1_); - lazy_reset_member(l2_); - } - - Lazy_rep_2_1(const AC& ac, const EC& /*ec*/, const L1& l1, const L2& l2) - : Lazy_rep(), l1_(l1), l2_(l2) - { - this->set_depth((std::max)(CGAL::depth(l1), CGAL::depth(l2))); - ac(CGAL::approx(l1), CGAL::approx(l2), this->at_orig.at_); - } - -#ifdef CGAL_LAZY_KERNEL_DEBUG - void - print_dag(std::ostream& os, int level) const - { - this->print_at_et(os, level); - os << "A Lazy_rep_2_1" << std::endl; - if(this->is_lazy()){ - CGAL::msg(os, level, "DAG with two child nodes:"); - CGAL::print_dag(l1_, os, level+1); - CGAL::print_dag(l2_, os, level+1); - } - } -#endif -}; - - -//____________________________________________________________________________________ -// The following rep class stores two non-const reference parameters of type R1 and R2 - -template -class Lazy_rep_2_2 final - : public Lazy_rep, std::pair, E2A> - , private EC -{ - typedef std::pair AT; - typedef std::pair ET; - typedef Lazy_rep Base; - - mutable L1 l1_; - mutable L2 l2_; - - const EC& ec() const { return *this; } - -public: - - void - update_exact() const - { - auto* p = new typename Base::Indirect(); - ec()(CGAL::exact(l1_), CGAL::exact(l2_), p->et_.first, p->et_.second ); - this->set_at(p); - this->set_ptr(p); - // Prune lazy tree - lazy_reset_member(l1_); - lazy_reset_member(l2_); - } - - Lazy_rep_2_2(const AC& ac, const EC& /*ec*/, const L1& l1, const L2& l2) - : Lazy_rep(), l1_(l1), l2_(l2) - { - this->set_depth((std::max)(CGAL::depth(l1), CGAL::depth(l2))); - ac(CGAL::approx(l1), CGAL::approx(l2), this->at_orig.at_.first, this->at_orig.at_.second); - } - -#ifdef CGAL_LAZY_KERNEL_DEBUG - void - print_dag(std::ostream& os, int level) const - { - this->print_at_et(os, level); - os << "A Lazy_rep_2_2" << std::endl; - if(this->is_lazy()){ - CGAL::msg(os, level, "DAG with two child nodes:"); - CGAL::print_dag(l1_, os, level+1); - CGAL::print_dag(l2_, os, level+1); - } - } -#endif -}; - - //____________________________________________________________ // The handle class template @@ -1181,41 +970,8 @@ public : Self_rep * ptr() const { return (Self_rep*) PTR; } }; -// The magic functor for Construct_bbox_[2,3], as there is no Lazy - template -struct Lazy_construction_bbox -{ - static const bool Protection = true; - typedef typename LK::Approximate_kernel AK; - typedef typename LK::Exact_kernel EK; - typedef typename AC::result_type result_type; - - CGAL_NO_UNIQUE_ADDRESS AC ac; - CGAL_NO_UNIQUE_ADDRESS EC ec; - - template - decltype(auto) - operator()(const L1& l1) const - { - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - { - // Protection is outside the try block as VC8 has the CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG - Protect_FPU_rounding P; - try { - return ac(CGAL::approx(l1)); - } catch (Uncertain_conversion_exception&) {} - } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - return ec(CGAL::exact(l1)); - } -}; - - -template -struct Lazy_construction_optional_for_polygonal_envelope +struct Lazy_construction_optional_for_polyhedral_envelope { static const bool Protection = true; typedef typename LK::Approximate_kernel AK; @@ -1301,7 +1057,7 @@ struct Lazy_construction_optional_for_polygonal_envelope } }; - +// used in Newkernel_d template struct Lazy_construction_nt { Lazy_construction_nt(){} @@ -1318,10 +1074,10 @@ struct Lazy_construction_nt { template auto operator()(L const&...l) const -> - Lazy_exact_nt>> + Lazy_exact_nt> { - typedef std::remove_cv_t> ET; - typedef std::remove_cv_t> AT; + typedef CGAL::cpp20::remove_cvref_t ET; + typedef CGAL::cpp20::remove_cvref_t AT; CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); { Protect_FPU_rounding P; @@ -1378,50 +1134,6 @@ CGAL_Kernel_obj(Point_3) return Object(); } - -// This functor selects the i'th element in a vector of Object's -// and casts it to what is in the Object - -template -struct Ith { - typedef T2 result_type; - - // We keep a Sign member object - // for future utilization, in case - // we have pairs of 2 T2 objects e.g. - // for a numeric_point vector returned - // from a construction of a possible - // lazy algebraic kernel - - int i; - Sign sgn; - - Ith(int i_) - : i(i_) - {sgn=NEGATIVE;} - - Ith(int i_, bool b_) - : i(i_) - { sgn= (b_) ? POSITIVE : ZERO;} - - const T2& - operator()(const std::vector& v) const - { - if(sgn==NEGATIVE) - return *object_cast(&v[i]); - - typedef std::pair Pair_type_1; - typedef std::pair > Pair_type_2; - - if(const Pair_type_1 *p1 = object_cast(&v[i])) - return p1->first; - else if(const Pair_type_2 *p2 = object_cast(&v[i])) - return p2->first; - - CGAL_error_msg( " Unexpected encapsulated type "); - } -}; - // This functor selects the i'th element in a vector of T2's template struct Ith_for_intersection { @@ -1440,33 +1152,6 @@ struct Ith_for_intersection { } }; -// This functor selects the i'th element in a vector of T2's -template -struct Ith_for_intersection_with_variant { - typedef T2 result_type; - int i; - - Ith_for_intersection_with_variant(int i_) - : i(i_) - {} - - template< typename ... U > - const T2& - operator()(const std::optional< std::variant< U ... > >& o) const - { - const std::vector* ptr = (std::get_if >(&(*o))); - return (*ptr)[i]; - } - - template< typename ... U > - const T2& - operator()(const std::variant< U ... >& o) const - { - const std::vector* ptr = (std::get_if >(&o)); - return (*ptr)[i]; - } -}; - template struct Lazy_cartesian_const_iterator_2 { @@ -1524,181 +1209,6 @@ public: }; - -// This is the magic functor for functors that write their result in a reference argument -// In a first version we assume that the references are of type Lazy, -// and that the result type is void - -template -struct Lazy_functor_2_1 -{ - static const bool Protection = true; - typedef void result_type; - - CGAL_NO_UNIQUE_ADDRESS AC ac; - CGAL_NO_UNIQUE_ADDRESS EC ec; - -public: - - template - void - operator()(const L1& l1, const L2& l2, R1& r1) const - { - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - { - Protect_FPU_rounding P; - try { - // we suppose that R1 is a Lazy - r1 = R1(new Lazy_rep_2_1(ac, ec, l1, l2)); - return; - } catch (Uncertain_conversion_exception&) {} - } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - typename R1::ET et; - ec(CGAL::exact(l1), CGAL::exact(l2), et); - r1 = R1(new Lazy_rep_0(et)); - } -}; - - -template -struct First -{ - typedef typename T::first_type result_type; - - const typename T::first_type& - operator()(const T& p) const - { - return p.first; - } - }; - -template -struct Second -{ - typedef typename T::second_type result_type; - - const typename T::second_type& - operator()(const T& p) const - { - return p.second; - } -}; - -// This is the magic functor for functors that write their result in a reference argument -// In a first version we assume that the references are of type Lazy, -// and that the result type is void - -//template -template -struct Lazy_functor_2_2 -{ - static const bool Protection = true; - - typedef void result_type; - typedef typename LK::Approximate_kernel AK; - typedef typename LK::Exact_kernel EK; - typedef typename LK::E2A E2A; - - CGAL_NO_UNIQUE_ADDRESS AC ac; - CGAL_NO_UNIQUE_ADDRESS EC ec; - -public: - - template - void - operator()(const L1& l1, const L2& l2, R1& r1, R2& r2) const - { - typedef Lazy Handle_1; - typedef Lazy Handle_2; - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - { - Protect_FPU_rounding P; - try { - typedef Lazy, std::pair, E2A> Lazy_pair; - Lazy_pair lv(new Lazy_rep_2_2(ac, ec, l1, l2)); - // lv->approx() is a std::pair; - r1 = R1(Handle_1(new Lazy_rep_n >, First >, E2A, false, Lazy_pair>(First >(), First >(), lv))); - r2 = R2(Handle_2(new Lazy_rep_n >, Second >, E2A, false, Lazy_pair>(Second >(), Second >(), lv))); - return; - } catch (Uncertain_conversion_exception&) {} - } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - typename R1::ET et1, et2; - ec(CGAL::exact(l1), CGAL::exact(l2), et1, et2); - r1 = R1(Handle_1(new Lazy_rep_0(et1))); - r2 = R2(Handle_2(new Lazy_rep_0(et2))); - } -}; - - -// This is the magic functor for functors that write their result as Objects into an output iterator - -template -struct Lazy_intersect_with_iterators -{ - static const bool Protection = true; - typedef typename LK::Approximate_kernel AK; - typedef typename LK::Exact_kernel EK; - typedef typename LK::E2A E2A; - typedef void result_type; - typedef Lazy Lazy_object; - typedef Lazy, std::vector, E2A> Lazy_vector; - - CGAL_NO_UNIQUE_ADDRESS AC ac; - CGAL_NO_UNIQUE_ADDRESS EC ec; - -public: - - // In the example we intersect two Lazys - // and write into a back_inserter(list,Lazy]) >) - template - OutputIterator - operator()(const L1& l1, const L2& l2, OutputIterator it) const - { - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - { - Protect_FPU_rounding P; - try { - Lazy_vector lv(new Lazy_rep_with_vector_2(ac, ec, l1, l2)); - // lv.approx() is a std::vector - // that is, when we get here we have constructed all approximate results - for (unsigned int i = 0; i < lv.approx().size(); i++) { - // FIXME : I'm not sure how this work... - #define CGAL_Kernel_obj(X) if (object_cast(& (lv.approx()[i]))) { \ - *it++ = make_object(typename LK::X(new Lazy_rep_n, \ - Ith, E2A, false, Lazy_vector> \ - (Ith(i), Ith(i), lv))); \ - continue; \ - } - - #include - - std::cerr << "we need more casts" << std::endl; - } - return it; - } catch (Uncertain_conversion_exception&) {} - } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - // TODO: Instead of using a vector, write an iterator adapter - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - std::vector exact_objects; - ec(CGAL::exact(l1), CGAL::exact(l2), std::back_inserter(exact_objects)); - for (std::vector::const_iterator oit = exact_objects.begin(); - oit != exact_objects.end(); - ++oit){ - *it++ = make_lazy(*oit); - } - return it; - } -}; - - template struct Object_cast { @@ -1714,9 +1224,6 @@ struct Object_cast // The following functor returns an Object with a Lazy inside // As the nested kernels return Objects of AK::Something and EK::Something // we have to unwrap them from the Object, and wrap them in a Lazy -// -// TODO: write operators for other than two arguments. For the current kernel we only need two for Intersect_2 - template struct Lazy_construction_object { @@ -1735,16 +1242,15 @@ struct Lazy_construction_object CGAL_NO_UNIQUE_ADDRESS EC ec; public: - - template + template decltype(auto) - operator()(const L1& l1) const + operator()(const L&... l) const { CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); { Protect_FPU_rounding P; try { - Lazy_object lo(new Lazy_rep_n(ac, ec, l1)); + Lazy_object lo(new Lazy_rep_n(ac, ec, l...)); if(lo.approx().is_empty()) return Object(); @@ -1758,116 +1264,42 @@ public: #include - std::cerr << "object_cast inside Lazy_construction_rep::operator() failed. It needs more else if's (#1)" << std::endl; - std::cerr << "dynamic type of the Object : " << lo.approx().type().name() << std::endl; - - return Object(); - } catch (Uncertain_conversion_exception&) {} - } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - ET eto = ec(CGAL::exact(l1)); - return make_lazy(eto); - } - - template - decltype(auto) - operator()(const L1& l1, const L2& l2) const - { - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - { - Protect_FPU_rounding P; - try { - Lazy_object lo(new Lazy_rep_n(ac, ec, l1, l2)); - - if(lo.approx().is_empty()) - return Object(); - - #define CGAL_Kernel_obj(X) \ - if (object_cast(& (lo.approx()))) { \ - typedef Lazy_rep_n, Object_cast, E2A, false, Lazy_object> Lcr; \ - Lcr * lcr = new Lcr(Object_cast(), Object_cast(), lo); \ - return make_object(typename LK::X(lcr)); \ - } - - #include - // We now check vector - - #define CGAL_Kernel_obj(X) \ - { \ - const std::vector* v_ptr;\ +#define CGAL_Kernel_obj(X) \ + { \ + const std::vector* v_ptr; \ if ( (v_ptr = object_cast >(& (lo.approx()))) ) { \ - std::vector V;\ - V.resize(v_ptr->size()); \ - for (unsigned int i = 0; i < v_ptr->size(); i++) { \ + std::vector V; \ + V.resize(v_ptr->size()); \ + for (unsigned int i = 0; i < v_ptr->size(); i++) { \ V[i] = typename LK::X(new Lazy_rep_n, \ Ith_for_intersection, E2A, false, Lazy_object> \ (Ith_for_intersection(i), Ith_for_intersection(i), lo)); \ - } \ - return make_object(V); \ + } \ + return make_object(V); \ }\ } - CGAL_Kernel_obj(Point_2) - CGAL_Kernel_obj(Point_3) - #undef CGAL_Kernel_obj +CGAL_Kernel_obj(Point_2) +CGAL_Kernel_obj(Point_3) +#undef CGAL_Kernel_obj std::cerr << "object_cast inside Lazy_construction_rep::operator() failed. It needs more else if's (#1)" << std::endl; std::cerr << "dynamic type of the Object : " << lo.approx().type().name() << std::endl; - } catch (Uncertain_conversion_exception&) {} - return Object(); - } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - ET eto = ec(CGAL::exact(l1), CGAL::exact(l2)); - return make_lazy(eto); - } - - template - decltype(auto) - operator()(const L1& l1, const L2& l2, const L3& l3) const - { - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - { - Protect_FPU_rounding P; - try { - Lazy_object lo(new Lazy_rep_n(ac, ec, l1, l2, l3)); - - if(lo.approx().is_empty()) - return Object(); - - #define CGAL_Kernel_obj(X) \ - if (object_cast(& (lo.approx()))) { \ - typedef Lazy_rep_n, Object_cast, E2A, false, Lazy_object> Lcr; \ - Lcr * lcr = new Lcr(Object_cast(), Object_cast(), lo); \ - return make_object(typename LK::X(lcr)); \ - } - - #include - - std::cerr << "object_cast inside Lazy_construction_rep::operator() failed. It needs more else if's (#1)" << std::endl; - std::cerr << "dynamic type of the Object : " << lo.approx().type().name() << std::endl; return Object(); } catch (Uncertain_conversion_exception&) {} } CGAL_BRANCH_PROFILER_BRANCH(tmp); Protect_FPU_rounding P2(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - ET eto = ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3)); + ET eto = ec(CGAL::exact(l)...); return make_lazy(eto); } }; - - //____________________________________________________________ // The magic functor that has Lazy as result type. -// Two versions are distinguished: one that needs to fiddle -// with decltype and another that can forward the result types. namespace internal { BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) @@ -1969,195 +1401,24 @@ struct Fill_lazy_variant_visitor_0 { } // internal -template -struct Lazy_construction_variant { - static const bool Protection = true; - - typedef typename LK::Approximate_kernel AK; - typedef typename LK::Exact_kernel EK; - typedef typename LK::E2A E2A; - - - template - struct result { - // this does not default, if you want to make a lazy lazy-kernel, - // you are on your own - }; - - template - struct result - { - typedef typename Type_mapper()(std::declval::type>()...)),AK,LK>::type type; - }; - - template - decltype(auto) - operator()(const L1& l1, const L2& l2) const { - - typedef typename result::type result_type; - - // typedef decltype(std::declval()(std::declval::type>(), - // std::declval::type>())) AT; - // typedef decltype(std::declval()(std::declval::type>(), - // std::declval::type>())) ET; - - typedef decltype(std::declval()(CGAL::approx(l1), CGAL::approx(l2))) AT; - typedef decltype(std::declval()( CGAL::exact(l1), CGAL::exact(l2))) ET; - - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - { - Protect_FPU_rounding P; - - try { - Lazy lazy(new Lazy_rep_n(AC(), EC(), l1, l2)); - - // the approximate result requires the trait with types from the AK - AT approx_v = lazy.approx(); - // the result we build - result_type res; - - if(!approx_v) { - // empty - return res; - } - - // the static visitor fills the result_type with the correct unwrapped type - internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy > visitor(res, lazy); - std::visit(visitor, *approx_v); - - return res; - } catch (Uncertain_conversion_exception&) {} - } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - ET exact_v = EC()(CGAL::exact(l1), CGAL::exact(l2)); - result_type res; - - if(!exact_v) { - return res; - } - - internal::Fill_lazy_variant_visitor_0 visitor(res); - std::visit(visitor, *exact_v); - return res; - } - - template - decltype(auto) - operator()(const L1& l1, const L2& l2, const L3& l3) const { - typedef typename result::type result_type; - - // typedef decltype(std::declval()(std::declval::type>(), - // std::declval::type>(), - // std::declval::type>())) AT; - // typedef decltype(std::declval()(std::declval::type>(), - // std::declval::type>(), - // std::declval::type>())) ET; - - typedef decltype(std::declval()(CGAL::approx(l1), CGAL::approx(l2), CGAL::approx(l3))) AT; - typedef decltype(std::declval()( CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3))) ET; - - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - { - Protect_FPU_rounding P; - - try { - Lazy lazy(new Lazy_rep_n(AC(), EC(), l1, l2, l3)); - - // the approximate result requires the trait with types from the AK - AT approx_v = lazy.approx(); - // the result we build - result_type res; - - if(!approx_v) { - // empty - return res; - } - - // the static visitor fills the result_type with the correct unwrapped type - internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy > visitor(res, lazy); - std::visit(visitor, *approx_v); - - return res; - } catch (Uncertain_conversion_exception&) {} - } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - ET exact_v = EC()(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3)); - result_type res; - - if(!exact_v) { - return res; - } - - internal::Fill_lazy_variant_visitor_0< result_type, AK, LK, EK> visitor(res); - std::visit(visitor, *exact_v); - return res; - } +template +struct Disable_lazy_pruning +{ + static const bool value = false; +}; +template +struct Disable_lazy_pruning +{ + static const bool value = true; +}; +template +struct Disable_lazy_pruning +{ + static const bool value = true; }; -template::value && internal::has_result_type::value > -struct Lazy_construction; - -template struct Disable_lazy_pruning { static const bool value = false; }; -template struct Disable_lazy_pruning { static const bool value = true; }; -template struct Disable_lazy_pruning { static const bool value = true; }; - -// we have a result type, low effort -template -struct Lazy_construction { - static const bool Protection = true; - - typedef typename LK::Approximate_kernel AK; - typedef typename LK::Exact_kernel EK; - typedef std::remove_cv_t< - std::remove_reference_t < typename AC::result_type > > AT; - typedef std::remove_cv_t< - std::remove_reference_t < typename EC::result_type > > ET; - - typedef typename Default::Get::type E2A; - - typedef typename Type_mapper::type result_type; - - static const bool noprune = Disable_lazy_pruning::value; - - CGAL_NO_UNIQUE_ADDRESS AC ac; - CGAL_NO_UNIQUE_ADDRESS EC ec; - - template - decltype(auto) - operator()(const L&... l) const { - typedef Lazy < AT, ET, E2A > Handle; - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - { - Protect_FPU_rounding P; - try { - return result_type(Handle(new Lazy_rep_n< AT, ET, AC, EC, E2A, noprune, L...>(ac, ec, l...))); - } catch (Uncertain_conversion_exception&) {} - } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - return result_type(Handle(new Lazy_rep_0< AT, ET, E2A >(ec(CGAL::exact(l)...)))); - } - - - // nullary - decltype(auto) - operator()() const - { - typedef Lazy Handle; - return result_type( Handle() ); - } - -}; - - -template -struct Lazy_construction +template +struct Lazy_construction { static const bool Protection = true; @@ -2165,49 +1426,188 @@ struct Lazy_construction typedef typename LK::Exact_kernel EK; typedef typename Default::Get::type E2A; - template - struct result { - // this does not default, if you want to make a lazy lazy-kernel, - // you are on your own - }; - - static const bool noprune = Disable_lazy_pruning::value; - CGAL_NO_UNIQUE_ADDRESS AC ac; CGAL_NO_UNIQUE_ADDRESS EC ec; - template - struct result - { - typedef typename Type_mapper()(std::declval::type>()...)),AK,LK>::type type; - }; + // to detect the return type of Intersection_[23]'s functors + template + struct is_optional_variant : std::false_type { }; + + template + struct is_optional_variant > > : std::true_type { }; template decltype(auto) - operator()(const L&... l) const { - typedef typename Type_mapper()(std::declval::type>()...)),EK,EK>::type ET; - typedef typename Type_mapper()(std::declval::type>()...)),AK,AK>::type AT; - typedef Lazy Handle; - typedef typename result::type result_type; - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + operator()(const L&... l) const + { + typedef typename Type_mapper::type...>, AK, AK>::type AT; + + // ----------------------- FT ----------------------- + if constexpr (std::is_same_v) { - Protect_FPU_rounding P; - try { - return result_type(Handle(new Lazy_rep_n (ac, ec, l...))); - } catch (Uncertain_conversion_exception&) {} + typedef typename Type_mapper::type...>,EK,EK>::type ET; + + typedef Lazy_exact_nt> result_type; + + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + { + Protect_FPU_rounding P; + try { + return result_type(new Lazy_rep_n, false, L... >(ac, ec, l...)); + } catch (Uncertain_conversion_exception&) {} + } + CGAL_BRANCH_PROFILER_BRANCH(tmp); + Protect_FPU_rounding P2(CGAL_FE_TONEAREST); + CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); + return result_type(new Lazy_rep_0 >(ec( CGAL::exact(l)... ))); + } + // ----------------------- Bounding boxes ----------------------- + else if constexpr (std::disjunction_v, + std::is_same >) + { + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + { + // Protection is outside the try block as VC8 has the CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG + Protect_FPU_rounding P; + try { + return ac(CGAL::approx(l...)); + } catch (Uncertain_conversion_exception&) {} + } + CGAL_BRANCH_PROFILER_BRANCH(tmp); + Protect_FPU_rounding P2(CGAL_FE_TONEAREST); + CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); + return ec(CGAL::exact(l...)); + } + // ----------------------- CGAL::Object ----------------------- + else if constexpr (std::is_same_v) + { + typedef Lazy Lazy_object; + + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + { + Protect_FPU_rounding P; + try { + Lazy_object lo(new Lazy_rep_n(ac, ec, l...)); + + if(lo.approx().is_empty()) + return Object(); + +# define CGAL_Kernel_obj(X) \ + if (object_cast(& (lo.approx()))) { \ + typedef Lazy_rep_n< typename AK::X, typename EK::X, Object_cast, Object_cast, E2A, false, Lazy_object> Lcr; \ + Lcr * lcr = new Lcr(Object_cast(), Object_cast(), lo); \ + return make_object(typename LK::X(lcr)); \ + } + +# include + + // We now check vector +# define CGAL_Kernel_obj(X) \ + { \ + const std::vector* v_ptr; \ + if ( (v_ptr = object_cast >(& (lo.approx()))) ) { \ + std::vector V; \ + V.resize(v_ptr->size()); \ + for (unsigned int i = 0; i < v_ptr->size(); i++) { \ + V[i] = typename LK::X(new Lazy_rep_n, \ + Ith_for_intersection, E2A, false, Lazy_object> \ + (Ith_for_intersection(i), Ith_for_intersection(i), lo)); \ + } \ + return make_object(V); \ + }\ + } + + CGAL_Kernel_obj(Point_2) + CGAL_Kernel_obj(Point_3) +# undef CGAL_Kernel_obj + + std::cerr << "object_cast inside Lazy_construction_rep::operator() failed. It needs more else if's (#1)" << std::endl; + std::cerr << "dynamic type of the Object : " << lo.approx().type().name() << std::endl; + + return Object(); + } catch (Uncertain_conversion_exception&) {} + } + CGAL_BRANCH_PROFILER_BRANCH(tmp); + Protect_FPU_rounding P2(CGAL_FE_TONEAREST); + CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); + CGAL::Object eto = ec(CGAL::exact(l)...); + return make_lazy(eto); + } + // std::optional > (Intersection_23 result types) + else if constexpr (is_optional_variant::value) + { + typedef typename Type_mapper::type...>,EK,EK>::type ET; + + typedef typename Type_mapper::type...>, AK, LK>::type result_type; + + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + { + Protect_FPU_rounding P; + + try { + Lazy lazy(new Lazy_rep_n(AC(), EC(), l...)); + + // the approximate result requires the trait with types from the AK + AT approx_v = lazy.approx(); + // the result we build + result_type res; + + if(!approx_v) { + // empty + return res; + } + + // the static visitor fills the result_type with the correct unwrapped type + internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy > visitor(res, lazy); + std::visit(visitor, *approx_v); + + return res; + } catch (Uncertain_conversion_exception&) {} + } + CGAL_BRANCH_PROFILER_BRANCH(tmp); + Protect_FPU_rounding P2(CGAL_FE_TONEAREST); + CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); + ET exact_v = EC()(CGAL::exact(l)...); + result_type res; + + if(!exact_v) { + return res; + } + + internal::Fill_lazy_variant_visitor_0 visitor(res); + std::visit(visitor, *exact_v); + return res; + } + // ----------------------- GENERIC ----------------------- + else + { + typedef typename Type_mapper::type...>,EK,EK>::type ET; + + typedef Lazy Handle; + typedef typename Type_mapper::type...>, AK, LK>::type result_type; + + static const bool noprune = Disable_lazy_pruning::value; + + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + { + Protect_FPU_rounding P; + try { + return result_type(Handle(new Lazy_rep_n(ac, ec, l...))); + } catch (Uncertain_conversion_exception&) {} + } + CGAL_BRANCH_PROFILER_BRANCH(tmp); + Protect_FPU_rounding P2(CGAL_FE_TONEAREST); + CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); + return result_type(Handle(new Lazy_rep_0 (ec(CGAL::exact(l)...)))); } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - return result_type(Handle(new Lazy_rep_0 (ec(CGAL::exact(l)...)))); } // nullary decltype(auto) operator()() const { - typedef decltype(std::declval()()) AT; - typedef decltype(std::declval()()) ET; + typedef std::invoke_result_t AT; + typedef std::invoke_result_t ET; typedef Lazy Handle; typedef typename Type_mapper::type result_type; diff --git a/Filtered_kernel/include/CGAL/Lazy_kernel.h b/Filtered_kernel/include/CGAL/Lazy_kernel.h index a6b2ac165ba..819ed0fa8ee 100644 --- a/Filtered_kernel/include/CGAL/Lazy_kernel.h +++ b/Filtered_kernel/include/CGAL/Lazy_kernel.h @@ -15,7 +15,7 @@ #include //#include -#include +#include #include #include #include @@ -37,62 +37,14 @@ namespace CGAL { -namespace internal { - -// SFINAE way to detect result_type typedefs. -template -class Has_result_type_helper -{ - typedef char one; - typedef struct { char arr[2]; } two; - - template - struct Wrapper {}; - - template - static one test(Wrapper*); - - template - static two test(...); - -public: - static const bool value = sizeof(test(0)) == 1; -}; - -template -struct Has_result_type - : std::integral_constant< bool, - Has_result_type_helper< std::remove_cv_t>::value> -{}; - -template -struct Get_result_type { - typedef typename T::result_type type; -}; - -template -struct Lazy_result_type - : boost::mpl::eval_if< Has_result_type, - Get_result_type, - boost::mpl::identity > -{}; - -class Enum_holder { -protected: - enum { NONE, NT, VARIANT, OBJECT, BBOX, OPTIONAL_ }; -}; - -} // internal - // Exact_kernel = exact kernel that will be made lazy // Kernel = lazy kernel -// the Generic base simply applies the generic magic functor stupidly. -// then the real base fixes up a few special cases. +// `Lazy_kernel_generic_base` applies the generic magic functor stupidly. +// `Lazy_kernel_base` fixes up a few special cases. template < typename EK_, typename AK_, typename E2A_, typename Kernel_ > -class Lazy_kernel_generic_base : protected internal::Enum_holder +class Lazy_kernel_generic_base // : public Filtered_kernel_base - // TODO : Static_filters_base too ? Check performance { public: @@ -127,9 +79,18 @@ public: typedef typename Exact_kernel::Rep_tag Rep_tag; enum { Has_filtered_predicates = true }; - enum { Has_static_filters = false }; typedef Boolean_tag Has_filtered_predicates_tag; +#ifdef CGAL_NO_STATIC_FILTERS_FOR_LAZY_KERNEL + enum { Has_static_filters = false }; +#else + // @fixme, this should be 'true' but it's broken because EPIC_predicate_if_convertible + // assumes the static filtered predicate and the (non-static) filtered predicate + // have the same signature, which is not always the case, for example in + // Do_intersect_3(Sphere_3, Bbox_3, *bool*) + enum { Has_static_filters = false }; +#endif + // Types typedef CGAL::Lazy_exact_nt FT; typedef FT RT; @@ -168,115 +129,26 @@ public: typedef CGAL::Aff_transformationC2 Aff_transformation_2; typedef CGAL::Aff_transformationC3 Aff_transformation_3; -private: - // We use a combination of partial and logic to extract the right - // construction. Constructions without a result_type always have to - // be done through specializations. - // - // The case distinction goes as follows: - // result_type == FT => NT - // result_type == Object => Object - // result_type == std::optional => OPTIONAL_ Only for Intersect_point_3_for_polyhedral_envelope which returns a handle for a singleton - // result_type == Bbox_2 || result_type == Bbox_3 => BBOX - // default => NONE - // no result_type => NONE - // - // - // we require a Dummy because we cannot have complete - // specializations inside a non-namespace scope. - // The default implementation does some default handling, - // the special cases are filtered by partial specializations. - template - struct Lazy_wrapper_traits : - boost::mpl::eval_if< internal::Has_result_type, - boost::mpl::eval_if< std::is_same< std::remove_cv_t< - std::remove_reference_t< - typename internal::Lazy_result_type::type - > >, - typename Approximate_kernel::FT>, - boost::mpl::int_, - boost::mpl::eval_if< std::is_same< typename internal::Lazy_result_type::type, - CGAL::Object >, - boost::mpl::int_, - boost::mpl::eval_if< std::bool_constant< - std::is_same_v< typename internal::Lazy_result_type::type, CGAL::Bbox_2 > || - std::is_same_v< typename internal::Lazy_result_type::type, CGAL::Bbox_3 > >, - boost::mpl::int_, - boost::mpl::int_ > > >, - boost::mpl::int_ >::type {}; - -#define CGAL_WRAPPER_TRAIT(NAME, WRAPPER) \ - template \ - struct Lazy_wrapper_traits \ - : boost::mpl::int_ {}; - - CGAL_WRAPPER_TRAIT(Intersect_2, VARIANT) - CGAL_WRAPPER_TRAIT(Intersect_3, VARIANT) - CGAL_WRAPPER_TRAIT(Intersect_point_3_for_polyhedral_envelope, OPTIONAL_) - CGAL_WRAPPER_TRAIT(Compute_squared_radius_2, NT) - CGAL_WRAPPER_TRAIT(Compute_x_3, NT) - CGAL_WRAPPER_TRAIT(Compute_y_3, NT) - CGAL_WRAPPER_TRAIT(Compute_z_3, NT) - -#undef CGAL_WRAPPER_TRAIT - - template ::value> - struct Select_wrapper_impl; - - template - struct Select_wrapper_impl { - template - struct apply { typedef Lazy_construction type; }; - }; - - template - struct Select_wrapper_impl { - template - struct apply { typedef Lazy_construction_nt type; }; - }; - - template - struct Select_wrapper_impl { - template - struct apply { typedef Lazy_construction_variant type; }; - }; - - template - struct Select_wrapper_impl { - template - struct apply { typedef Lazy_construction_object type; }; - }; - - template - struct Select_wrapper_impl { - template - struct apply { typedef Lazy_construction_bbox type; }; - }; - - template - struct Select_wrapper_impl { - template - struct apply { typedef Lazy_construction_optional_for_polygonal_envelope type; }; - }; - - template - struct Select_wrapper : Select_wrapper_impl {}; - public: - - #ifdef CGAL_NO_STATIC_FILTERS_FOR_LAZY_KERNEL #define CGAL_Kernel_pred(P, Pf) \ typedef Filtered_predicate P; \ P Pf() const { return P(); } #else -#define CGAL_Kernel_pred(P, Pf) \ - typedef Static_filtered_predicate, Exact_predicates_inexact_constructions_kernel::P> P; \ +// - the first template parameter is because either it fits in a double, or not, so +// we might as well use the approximate kernel directly rather than the complete lazy kernel +// - the second is the predicate to be called if EPICK is not usable +// - the third is the equivalent predicate in EPICK +#define CGAL_Kernel_pred(P, Pf) \ + typedef EPIC_predicate_if_convertible, \ + Exact_predicates_inexact_constructions_kernel::P> P; \ P Pf() const { return P(); } #endif #define CGAL_Kernel_cons(C, Cf) \ - typedef typename Select_wrapper::template apply::type C; \ + typedef Lazy_construction C; \ C Cf() const { return C(); } #include @@ -287,11 +159,6 @@ public: struct Handle { typedef T type; }; }; - - - - - template < typename EK_, typename AK_, typename E2A_, typename Kernel_ > class Lazy_kernel_base : public Lazy_kernel_generic_base @@ -308,18 +175,16 @@ public: typedef CommonKernelFunctors::Assign_2 Assign_2; typedef CommonKernelFunctors::Assign_3 Assign_3; - typedef Lazy_construction_bbox Construct_bbox_2; - typedef Lazy_construction_bbox Construct_bbox_3; typedef Lazy_cartesian_const_iterator_2 Construct_cartesian_const_iterator_2; typedef Lazy_cartesian_const_iterator_3 Construct_cartesian_const_iterator_3; typedef CGAL::CartesianKernelFunctors::Compute_approximate_squared_length_3 Compute_approximate_squared_length_3; typedef CGAL::CartesianKernelFunctors::Compute_approximate_area_3 Compute_approximate_area_3; - // typedef void Compute_z_3; // to detect where .z() is called - // typedef void Construct_point_3; // to detect where the ctor is called - - + typedef CGAL::Lazy_construction_optional_for_polyhedral_envelope< + Kernel, + typename Approximate_kernel::Intersect_point_3_for_polyhedral_envelope, + typename Exact_kernel::Intersect_point_3_for_polyhedral_envelope> Intersect_point_3_for_polyhedral_envelope; struct Compute_weight_2 : public BaseClass::Compute_weight_2 { @@ -552,7 +417,6 @@ public: }; - struct Less_xyz_3 : public BaseClass::Less_xyz_3 { typedef typename Kernel_::Point_3 Point_3; @@ -593,14 +457,6 @@ public: assign_3_object() const { return Assign_3(); } - Construct_bbox_2 - construct_bbox_2_object() const - { return Construct_bbox_2(); } - - Construct_bbox_3 - construct_bbox_3_object() const - { return Construct_bbox_3(); } - Construct_cartesian_const_iterator_2 construct_cartesian_const_iterator_2_object() const { return Construct_cartesian_const_iterator_2(); } @@ -617,6 +473,10 @@ public: compute_approximate_area_3_object() const { return Compute_approximate_area_3(); } + Intersect_point_3_for_polyhedral_envelope + intersect_point_3_for_polyhedral_envelope_object() const + { return Intersect_point_3_for_polyhedral_envelope(); } + Less_xyz_3 less_xyz_3_object() const { return Less_xyz_3(); } diff --git a/Filtered_kernel/include/CGAL/Static_filtered_predicate.h b/Filtered_kernel/include/CGAL/Static_filtered_predicate.h deleted file mode 100644 index 9ff3aea5d1c..00000000000 --- a/Filtered_kernel/include/CGAL/Static_filtered_predicate.h +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) 2017 GeometryFactory -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org) -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// -// Author(s) : Andreas Fabri, Laurent Rineau - -#ifndef CGAL_STATIC_FILTERED_PREDICATE_H -#define CGAL_STATIC_FILTERED_PREDICATE_H - -#include - -namespace CGAL { - -template -class Static_filtered_predicate { -public: - FP fp; - EpicP epicp; - typedef typename AK::FT IA; - typedef typename FP::result_type result_type; - - template - result_type operator()(const A1& a1) const - { - CGAL::Epic_converter convert; - auto aa1 = convert(approx(a1)); - if(! aa1.second){ - return fp(a1); - } - - return epicp(aa1.first); - } - - - template - result_type operator()(const A1& a1, const A2& a2) const - { - CGAL::Epic_converter convert; - auto aa1 = convert(approx(a1)); - if(! aa1.second){ - return fp(a1, a2); - } - auto aa2 = convert(approx(a2)); - if(! aa2.second){ - return fp(a1, a2); - } - return epicp(aa1.first, aa2.first); - } - - - template - result_type operator()(const A1& a1, const A2& a2, const A3& a3) const - { - CGAL::Epic_converter convert; - auto aa1 = convert(approx(a1)); - if(! aa1.second){ - return fp(a1, a2, a3); - } - auto aa2 = convert(approx(a2)); - if(! aa2.second){ - return fp(a1, a2, a3); - } - auto aa3 = convert(approx(a3)); - if(! aa3.second){ - return fp(a1, a2, a3); - } - return epicp(aa1.first, aa2.first, aa3.first); - } - - - template - result_type operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) const - { - CGAL::Epic_converter convert; - auto aa1 = convert(approx(a1)); - if(! aa1.second){ - return fp(a1, a2, a3, a4); - } - - auto aa2 = convert(approx(a2)); - if(! aa2.second){ - return fp(a1, a2, a3, a4); - } - - auto aa3 = convert(approx(a3)); - if(! aa3.second){ - return fp(a1, a2, a3, a4); - } - - auto aa4 = convert(approx(a4)); - if(! aa4.second){ - return fp(a1, a2, a3, a4); - } - return epicp(aa1.first, aa2.first, aa3.first, aa4.first); - } - - template - result_type operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5) const - { - CGAL::Epic_converter convert; - auto aa1 = convert(approx(a1)); - if(! aa1.second){ - return fp(a1, a2, a3, a4, a5); - } - auto aa2 = convert(approx(a2)); - if(! aa2.second){ - return fp(a1, a2, a3, a4, a5); - } - auto aa3 = convert(approx(a3)); - if(! aa3.second){ - return fp(a1, a2, a3, a4, a5); - } - auto aa4 = convert(approx(a4)); - if(! aa4.second){ - return fp(a1, a2, a3, a4, a5); - } - auto aa5 = convert(approx(a5)); - if(! aa5.second){ - return fp(a1, a2, a3, a4, a5); - } - return epicp(aa1.first, aa2.first, aa3.first, aa4.first, aa5.first); - } - - template - result_type operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6) const - { - CGAL::Epic_converter convert; - auto aa1 = convert(approx(a1)); - if(! aa1.second){ - return fp(a1, a2, a3, a4, a5, a6); - } - auto aa2 = convert(approx(a2)); - if(! aa2.second){ - return fp(a1, a2, a3, a4, a5, a6); - } - auto aa3 = convert(approx(a3)); - if(! aa3.second){ - return fp(a1, a2, a3, a4, a5, a6); - } - auto aa4 = convert(approx(a4)); - if(! aa4.second){ - return fp(a1, a2, a3, a4, a5, a6); - } - auto aa5 = convert(approx(a5)); - if(! aa5.second){ - return fp(a1, a2, a3, a4, a5, a6); - } - auto aa6 = convert(approx(a6)); - if(! aa6.second){ - return fp(a1, a2, a3, a4, a5, a6); - } - return epicp(aa1.first, aa2.first, aa3.first, aa4.first, aa5.first, aa6.first); - } - - template - result_type operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A6& a7) const - { - CGAL::Epic_converter convert; - auto aa1 = convert(approx(a1)); - if(! aa1.second){ - return fp(a1, a2, a3, a4, a5, a6, a7); - } - auto aa2 = convert(approx(a2)); - if(! aa2.second){ - return fp(a1, a2, a3, a4, a5, a6, a7); - } - auto aa3 = convert(approx(a3)); - if(! aa3.second){ - return fp(a1, a2, a3, a4, a5, a6, a7); - } - auto aa4 = convert(approx(a4)); - if(! aa4.second){ - return fp(a1, a2, a3, a4, a5, a6, a7); - } - auto aa5 = convert(approx(a5)); - if(! aa5.second){ - return fp(a1, a2, a3, a4, a5, a6, a7); - } - auto aa6 = convert(approx(a6)); - if(! aa6.second){ - return fp(a1, a2, a3, a4, a5, a6, a7); - } - auto aa7 = convert(approx(a7)); - if(! aa7.second){ - return fp(a1, a2, a3, a4, a5, a6, a7); - } - return epicp(aa1.first, aa2.first, aa3.first, aa4.first, aa5.first, aa6.first, aa7.first); - } - - - template - result_type operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8) const - { - CGAL::Epic_converter convert; - auto aa1 = convert(approx(a1)); - if(! aa1.second){ - return fp(a1, a2, a3, a4, a5, a6, a7, a8); - } - auto aa2 = convert(approx(a2)); - if(! aa2.second){ - return fp(a1, a2, a3, a4, a5, a6, a7, a8); - } - auto aa3 = convert(approx(a3)); - if(! aa3.second){ - return fp(a1, a2, a3, a4, a5, a6, a7, a8); - } - auto aa4 = convert(approx(a4)); - if(! aa4.second){ - return fp(a1, a2, a3, a4, a5, a6, a7, a8); - } - auto aa5 = convert(approx(a5)); - if(! aa5.second){ - return fp(a1, a2, a3, a4, a5, a6, a7, a8); - } - auto aa6 = convert(approx(a6)); - if(! aa6.second){ - return fp(a1, a2, a3, a5, a5, a6, a7, a8); - } - auto aa7 = convert(approx(a7)); - if(! aa7.second){ - return fp(a1, a2, a3, a5, a5, a6, a7, a8); - } - auto aa8 = convert(approx(a8)); - if(! aa8.second){ - return fp(a1, a2, a3, a4, a5, a6, a7, a8); - } - return epicp(aa1.first, aa2.first, aa3.first, aa4.first, aa5.first, aa6.first, aa7.first, aa8.first); - } -}; - -} // CGAL - -#endif // CGAL_STATIC_FILTERED_PREDICATE_H diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/CircleH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/CircleH2.h index f2414a459e4..e46139d0cd6 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/CircleH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/CircleH2.h @@ -84,20 +84,20 @@ public: CircleH2 opposite() const; - Oriented_side + typename R_::Oriented_side oriented_side(const Point_2& ) const; - Bounded_side + typename R_::Bounded_side bounded_side(const Point_2& ) const; bool operator==( const CircleH2& ) const; bool operator!=( const CircleH2& ) const; - bool has_on_positive_side(const Point_2& ) const; - bool has_on_negative_side(const Point_2& ) const; - bool has_on_boundary( const Point_2& ) const; - bool has_on_bounded_side( const Point_2& ) const; - bool has_on_unbounded_side(const Point_2&) const; - bool is_degenerate() const; + typename R_::Boolean has_on_positive_side(const Point_2& ) const; + typename R_::Boolean has_on_negative_side(const Point_2& ) const; + typename R_::Boolean has_on_boundary( const Point_2& ) const; + typename R_::Boolean has_on_bounded_side( const Point_2& ) const; + typename R_::Boolean has_on_unbounded_side(const Point_2&) const; + typename R_::Boolean is_degenerate() const; // bool oriented_equal( const CircleH2& ) const; // bool unoriented_equal( const CircleH2& ) const; @@ -133,17 +133,15 @@ CircleH2::orientation() const template CGAL_KERNEL_INLINE -Oriented_side +typename R::Oriented_side CircleH2::oriented_side( const typename CircleH2::Point_2& p) const { FT sq_dist = squared_distance( p, center() ); - FT sq_rad = squared_radius(); - Comparison_result vgl = CGAL_NTS compare( sq_dist, sq_rad ); - Oriented_side rel_pos = (vgl == LARGER ) ? - ON_NEGATIVE_SIDE : - ( (vgl == SMALLER ) ? - ON_POSITIVE_SIDE : - ON_ORIENTED_BOUNDARY); + const FT& sq_rad = squared_radius(); + typename R::Comparison_result vgl = CGAL_NTS compare( sq_dist, sq_rad ); + typename R::Oriented_side rel_pos = (vgl == LARGER ) ? ON_NEGATIVE_SIDE + : ((vgl == SMALLER) ? ON_POSITIVE_SIDE + : ON_ORIENTED_BOUNDARY); if (orientation() == POSITIVE) { return rel_pos; } else // NEGATIVE @@ -152,7 +150,7 @@ CircleH2::oriented_side( const typename CircleH2::Point_2& p) const template CGAL_KERNEL_INLINE -bool +typename R::Boolean CircleH2::has_on_positive_side(const typename CircleH2::Point_2& p) const { if ( orientation() == POSITIVE ) @@ -163,7 +161,7 @@ CircleH2::has_on_positive_side(const typename CircleH2::Point_2& p) const template CGAL_KERNEL_INLINE -bool +typename R::Boolean CircleH2::has_on_boundary(const typename CircleH2::Point_2& p) const { FT sq_dist = squared_distance( p, center() ); @@ -173,7 +171,7 @@ CircleH2::has_on_boundary(const typename CircleH2::Point_2& p) const template CGAL_KERNEL_INLINE -bool +typename R::Boolean CircleH2::has_on_negative_side( const typename CircleH2::Point_2&p) const { if ( orientation() == NEGATIVE ) @@ -188,12 +186,12 @@ CircleH2::has_on_negative_side( const typename CircleH2::Point_2&p) const template CGAL_KERNEL_INLINE -Bounded_side +typename R::Bounded_side CircleH2::bounded_side(const typename CircleH2::Point_2& p) const { FT sq_dist = squared_distance( p, center() ); - FT sq_rad = squared_radius(); - Comparison_result vgl = CGAL_NTS compare( sq_dist, sq_rad ); + const FT& sq_rad = squared_radius(); + typename R::Comparison_result vgl = CGAL_NTS compare( sq_dist, sq_rad ); return (vgl == LARGER ) ? ON_UNBOUNDED_SIDE : ( (vgl == SMALLER ) ? ON_BOUNDED_SIDE : @@ -202,33 +200,33 @@ CircleH2::bounded_side(const typename CircleH2::Point_2& p) const template CGAL_KERNEL_INLINE -bool +typename R::Boolean CircleH2::has_on_bounded_side(const typename CircleH2::Point_2& p) const { FT sq_dist = squared_distance( p, center() ); - FT sq_rad = squared_radius(); + const FT& sq_rad = squared_radius(); return ( sq_dist < sq_rad ); } template CGAL_KERNEL_INLINE -bool +typename R::Boolean CircleH2::has_on_unbounded_side(const typename CircleH2::Point_2&p) const { FT sq_dist = squared_distance( p, center() ); - FT sq_rad = squared_radius(); + const FT& sq_rad = squared_radius(); return ( sq_rad < sq_dist ); } template inline -bool +typename R::Boolean CircleH2::is_degenerate() const { return ( squared_radius() == FT(0) ); } template CGAL_KERNEL_INLINE -bool +typename R::Boolean CircleH2::operator==(const CircleH2& c) const { return ( center() == c.center() ) @@ -238,7 +236,7 @@ CircleH2::operator==(const CircleH2& c) const template inline -bool +typename R::Boolean CircleH2::operator!=(const CircleH2& c) const { return !(*this == c); } diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/DirectionH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/DirectionH2.h index b30267cf7d2..54e59877d8d 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/DirectionH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/DirectionH2.h @@ -64,9 +64,8 @@ public: : base( w > RT(0) ? CGAL::make_array(x, y, w) : CGAL::make_array(-x, -y, -w) ) {} - bool operator==( const DirectionH2& d) const; - bool operator!=( const DirectionH2& d) const; - + typename R_::Boolean operator==( const DirectionH2& d) const; + typename R_::Boolean operator!=( const DirectionH2& d) const; Vector_2 to_vector() const; @@ -81,7 +80,7 @@ public: template CGAL_KERNEL_INLINE -bool +typename R::Boolean DirectionH2::operator==( const DirectionH2& d) const { return ( ( x() * d.y() == y() * d.x() ) @@ -91,7 +90,7 @@ DirectionH2::operator==( const DirectionH2& d) const template inline -bool +typename R::Boolean DirectionH2::operator!=( const DirectionH2& d) const { return !(*this == d); } diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/DirectionH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/DirectionH3.h index a4098d72848..4faa0dc180a 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/DirectionH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/DirectionH3.h @@ -66,10 +66,10 @@ public: : base( w >= RT(0) ? CGAL::make_array(x, y, z, w) : CGAL::make_array(-x, -y, -z, -w) ) {} - bool is_degenerate() const; + typename R::Boolean is_degenerate() const; - bool operator==( const DirectionH3& d) const; - bool operator!=( const DirectionH3& d) const; + typename R::Boolean operator==( const DirectionH3& d) const; + typename R::Boolean operator!=( const DirectionH3& d) const; Vector_3 to_vector() const; Vector_3 vector() const { return to_vector(); } @@ -87,7 +87,7 @@ public: template CGAL_KERNEL_INLINE -bool +typename R::Boolean DirectionH3::operator==( const DirectionH3& d) const { return ( ( hx()*d.hy() == hy()*d.hx() ) @@ -100,13 +100,13 @@ DirectionH3::operator==( const DirectionH3& d) const template inline -bool +typename R::Boolean DirectionH3::operator!=( const DirectionH3& d) const { return !operator==(d); } template CGAL_KERNEL_INLINE -bool +typename R::Boolean DirectionH3::is_degenerate() const { return ((hx() == RT(0)) && (hy() == RT(0)) && (hz() == RT(0))); } diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_cuboidH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_cuboidH3.h index e4830033289..35f2a2a29f0 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_cuboidH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_cuboidH3.h @@ -63,23 +63,21 @@ public: Iso_cuboidH3(const RT& min_hx, const RT& min_hy, const RT& min_hz, const RT& max_hx, const RT& max_hy, const RT& max_hz); - bool operator==(const Iso_cuboidH3& s) const; - bool operator!=(const Iso_cuboidH3& s) const; + typename R::Boolean operator==(const Iso_cuboidH3& s) const; + typename R::Boolean operator!=(const Iso_cuboidH3& s) const; const Point_3 & min BOOST_PREVENT_MACRO_SUBSTITUTION () const; const Point_3 & max BOOST_PREVENT_MACRO_SUBSTITUTION () const; Point_3 vertex(int i) const; Point_3 operator[](int i) const; - Iso_cuboidH3 - transform(const Aff_transformation_3& t) const; - Bounded_side - bounded_side(const Point_3& p) const; - bool has_on(const Point_3& p) const; - bool has_on_boundary(const Point_3& p) const; - bool has_on_bounded_side(const Point_3& p) const; - bool has_on_unbounded_side(const Point_3& p) const; - bool is_degenerate() const; + Iso_cuboidH3 transform(const Aff_transformation_3& t) const; + typename R::Bounded_side bounded_side(const Point_3& p) const; + typename R::Boolean has_on(const Point_3& p) const; + typename R::Boolean has_on_boundary(const Point_3& p) const; + typename R::Boolean has_on_bounded_side(const Point_3& p) const; + typename R::Boolean has_on_unbounded_side(const Point_3& p) const; + typename R::Boolean is_degenerate() const; FT xmin() const; FT ymin() const; FT zmin() const; @@ -189,14 +187,14 @@ Iso_cuboidH3(const RT& min_hx, const RT& min_hy, const RT& min_hz, template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean Iso_cuboidH3:: operator==(const Iso_cuboidH3& r) const { return ((this->min)() == (r.min)()) && ((this->max)() == (r.max)()); } template < class R > inline -bool +typename R::Boolean Iso_cuboidH3:: operator!=(const Iso_cuboidH3& r) const { return !(*this == r); } @@ -313,7 +311,7 @@ Iso_cuboidH3::operator[](int i) const template < class R > CGAL_KERNEL_MEDIUM_INLINE -Bounded_side +typename R::Bounded_side Iso_cuboidH3:: bounded_side(const typename Iso_cuboidH3::Point_3& p) const { @@ -337,34 +335,34 @@ bounded_side(const typename Iso_cuboidH3::Point_3& p) const template < class R > inline -bool +typename R::Boolean Iso_cuboidH3:: has_on_boundary(const typename Iso_cuboidH3::Point_3& p) const { return ( bounded_side(p) == ON_BOUNDARY ); } template < class R > inline -bool +typename R::Boolean Iso_cuboidH3::has_on(const typename Iso_cuboidH3::Point_3& p) const { return ( bounded_side(p) == ON_BOUNDARY ); } template < class R > inline -bool +typename R::Boolean Iso_cuboidH3:: has_on_bounded_side(const typename Iso_cuboidH3::Point_3& p) const { return ( bounded_side(p) == ON_BOUNDED_SIDE ); } template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean Iso_cuboidH3:: has_on_unbounded_side(const typename Iso_cuboidH3::Point_3& p) const { return ( bounded_side(p) == ON_UNBOUNDED_SIDE ); } template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean Iso_cuboidH3::is_degenerate() const { return ( ( (this->min)().hx() == (this->max)().hx() ) diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_rectangleH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_rectangleH2.h index 6bdde3dec91..65f9e220174 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_rectangleH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_rectangleH2.h @@ -52,7 +52,7 @@ public: const Point_2 & min BOOST_PREVENT_MACRO_SUBSTITUTION () const; const Point_2 & max BOOST_PREVENT_MACRO_SUBSTITUTION () const; - Bounded_side bounded_side(const Point_2& p) const; + typename R_::Bounded_side bounded_side(const Point_2& p) const; }; @@ -71,7 +71,7 @@ Iso_rectangleH2::max BOOST_PREVENT_MACRO_SUBSTITUTION () const template < class R > CGAL_KERNEL_INLINE -Bounded_side +typename R::Bounded_side Iso_rectangleH2:: bounded_side(const typename Iso_rectangleH2::Point_2& p) const { diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/LineH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/LineH2.h index ab69b965f35..66d45a41a1a 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/LineH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/LineH2.h @@ -47,8 +47,8 @@ public: LineH2(const RT& a, const RT& b, const RT& c) : base{a, b, c} {} - bool operator==(const LineH2& l) const; - bool operator!=(const LineH2& l) const; + typename R_::Boolean operator==(const LineH2& l) const; + typename R_::Boolean operator!=(const LineH2& l) const; const RT & a() const { return get_pointee_or_identity(base)[0]; } const RT & b() const { return get_pointee_or_identity(base)[1]; } @@ -58,7 +58,7 @@ public: template < class R > CGAL_KERNEL_MEDIUM_INLINE -bool +typename R::Boolean LineH2::operator==(const LineH2& l) const { if ( (a() * l.c() != l.a() * c() ) @@ -83,7 +83,7 @@ LineH2::operator==(const LineH2& l) const template < class R > inline -bool +typename R::Boolean LineH2::operator!=(const LineH2& l) const { return !(*this == l); } diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/PlaneH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/PlaneH3.h index 6b05951a064..5e7ae6ac99c 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/PlaneH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/PlaneH3.h @@ -67,8 +67,8 @@ public: const RT & c() const; const RT & d() const; - bool operator==( const PlaneH3& ) const; - bool operator!=( const PlaneH3& ) const; + typename R::Boolean operator==( const PlaneH3& ) const; + typename R::Boolean operator!=( const PlaneH3& ) const; Line_3 perpendicular_line(const Point_3& ) const; Plane_3 opposite() const; // plane with opposite orientation @@ -78,13 +78,13 @@ public: Direction_3 orthogonal_direction() const; Vector_3 orthogonal_vector() const; - Oriented_side oriented_side(const Point_3 &p) const; - bool has_on(const Point_3 &p) const; - bool has_on(const Line_3 &p) const; - bool has_on_positive_side(const Point_3&l) const; - bool has_on_negative_side(const Point_3&l) const; + typename R::Oriented_side oriented_side(const Point_3& p) const; + typename R::Boolean has_on(const Point_3& p) const; + typename R::Boolean has_on(const Line_3& p) const; + typename R::Boolean has_on_positive_side(const Point_3& l) const; + typename R::Boolean has_on_negative_side(const Point_3& l) const; - bool is_degenerate() const; + typename R::Boolean is_degenerate() const; Aff_transformation_3 transform_to_2d() const; Point_2 to_2d(const Point_3& ) const; @@ -163,7 +163,7 @@ PlaneH3::new_rep(const RT &a, const RT &b, const RT &c, const RT &d) template < class R > inline -bool +typename R::Boolean PlaneH3::operator!=(const PlaneH3& l) const { return !(*this == l); @@ -397,7 +397,7 @@ PlaneH3::orthogonal_vector() const { return Vector_3(a(), b(), c() ); } template < class R > -bool +typename R::Boolean PlaneH3::is_degenerate() const { const RT RT0(0); @@ -405,14 +405,14 @@ PlaneH3::is_degenerate() const } template < class R > -bool +typename R::Boolean PlaneH3::has_on_positive_side( const typename PlaneH3::Point_3& p) const { return (a()*p.hx() + b()*p.hy() + c()*p.hz() + d()*p.hw() > RT(0) ); } template < class R > -bool +typename R::Boolean PlaneH3::has_on_negative_side( const typename PlaneH3::Point_3& p) const { return (a()*p.hx() + b()*p.hy() + c()*p.hz() + d()*p.hw() < RT(0) ); @@ -420,14 +420,14 @@ PlaneH3::has_on_negative_side( const typename PlaneH3::Point_3& p) const template < class R > -bool +typename R::Boolean PlaneH3::has_on( const typename PlaneH3::Point_3& p) const { return (a()*p.hx() + b()*p.hy() + c()*p.hz() + d()*p.hw() == RT(0) ); } template < class R > -bool +typename R::Boolean PlaneH3::has_on( const typename PlaneH3::Line_3& l) const { Point_3 p = l.point(); @@ -439,7 +439,7 @@ PlaneH3::has_on( const typename PlaneH3::Line_3& l) const } template < class R > -Oriented_side +typename R::Oriented_side PlaneH3::oriented_side( const typename PlaneH3::Point_3& p) const { return CGAL_NTS sign( a()*p.hx() + b()*p.hy() + c()*p.hz() + d()*p.hw() ); @@ -447,7 +447,7 @@ PlaneH3::oriented_side( const typename PlaneH3::Point_3& p) const template < class R > -bool +typename R::Boolean PlaneH3::operator==(const PlaneH3& l) const { if ( (a() * l.d() != l.a() * d() ) diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH2.h index 06ff55945fe..62dc1f28783 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH2.h @@ -63,8 +63,8 @@ public: PointH2(const RT& hx, const RT& hy, const RT& hw) : base(hx, hy, hw) {} - bool operator==( const PointH2& p) const; - bool operator!=( const PointH2& p) const; + typename R::Boolean operator==( const PointH2& p) const; + typename R::Boolean operator!=( const PointH2& p) const; const RT & hx() const { return base.hx(); } const RT & hy() const { return base.hy(); } @@ -94,7 +94,7 @@ public: template < class R > inline -bool +typename R::Boolean PointH2::operator==( const PointH2& p) const { return base == p.base; @@ -102,7 +102,7 @@ PointH2::operator==( const PointH2& p) const template < class R > inline -bool +typename R::Boolean PointH2::operator!=( const PointH2& p) const { return !(*this == p); } diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h index f64d5b64c9a..ead132b42d5 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h @@ -90,8 +90,8 @@ public: Direction_3 direction() const; Point_3 transform( const Aff_transformation_3 & t) const; - bool operator==( const PointH3& p) const; - bool operator!=( const PointH3& p) const; + typename R::Boolean operator==( const PointH3& p) const; + typename R::Boolean operator!=( const PointH3& p) const; }; @@ -175,7 +175,7 @@ PointH3::direction() const template < class R > inline -bool +typename R::Boolean PointH3::operator==( const PointH3 & p) const { return base == p.base; @@ -183,7 +183,7 @@ PointH3::operator==( const PointH3 & p) const template < class R > inline -bool +typename R::Boolean PointH3::operator!=( const PointH3 & p) const { return !(*this == p); } diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/RayH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/RayH3.h index 8a48ffd52bf..3a3999d459b 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/RayH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/RayH3.h @@ -63,12 +63,12 @@ public: const Vector_3 & to_vector() const; Line_3 supporting_line() const; RayH3 opposite() const; - bool has_on(const Point_3& p) const; - bool collinear_has_on(const Point_3 &p) const; - bool is_degenerate() const; + typename R::Boolean has_on(const Point_3& p) const; + typename R::Boolean collinear_has_on(const Point_3 &p) const; + typename R::Boolean is_degenerate() const; - bool operator==(const RayH3& r) const; - bool operator!=(const RayH3& r) const; + typename R::Boolean operator==(const RayH3& r) const; + typename R::Boolean operator!=(const RayH3& r) const; }; template < class R > @@ -133,7 +133,7 @@ RayH3::opposite() const template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean RayH3::has_on(const typename RayH3::Point_3 &p) const { return ( ( p == start() ) @@ -142,25 +142,25 @@ RayH3::has_on(const typename RayH3::Point_3 &p) const template < class R > inline /* XXX */ -bool +typename R::Boolean RayH3::collinear_has_on(const typename RayH3::Point_3 &p) const { return has_on(p); } template < class R > inline -bool +typename R::Boolean RayH3::is_degenerate() const { return to_vector() == NULL_VECTOR; } template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean RayH3::operator==(const RayH3& r) const { return ( (start() == r.start() )&&( direction() == r.direction() ) ); } template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean RayH3::operator!=( const RayH3& r) const { return !operator==(r); } diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/SphereH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/SphereH3.h index a00ec51b275..1615004c68b 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/SphereH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/SphereH3.h @@ -57,10 +57,10 @@ public: SphereH3(const Point_3& p, const Orientation& o = COUNTERCLOCKWISE); - bool + typename R::Boolean operator==(const SphereH3&) const; - bool + typename R::Boolean operator!=(const SphereH3& s) const { return !(*this == s); } @@ -70,32 +70,32 @@ public: Orientation orientation() const; - bool is_degenerate() const; + typename R::Boolean is_degenerate() const; SphereH3 opposite() const; - Oriented_side oriented_side(const Point_3& p) const; + typename R::Oriented_side oriented_side(const Point_3& p) const; - bool + typename R::Boolean has_on_boundary(const Point_3& p) const { return oriented_side(p)==ON_ORIENTED_BOUNDARY; } - bool + typename R::Boolean has_on_positive_side(const Point_3& p) const { return oriented_side(p)==ON_POSITIVE_SIDE; } - bool + typename R::Boolean has_on_negative_side(const Point_3& p) const { return oriented_side(p)==ON_NEGATIVE_SIDE; } - Bounded_side + typename R::Bounded_side bounded_side(const Point_3& p) const; - bool + typename R::Boolean has_on_bounded_side(const Point_3& p) const { return bounded_side(p)==ON_BOUNDED_SIDE; } - bool + typename R::Boolean has_on_unbounded_side(const Point_3& p) const { return bounded_side(p)==ON_UNBOUNDED_SIDE; } }; @@ -162,7 +162,7 @@ SphereH3::SphereH3(const typename SphereH3::Point_3& p, template CGAL_KERNEL_INLINE -bool +typename R::Boolean SphereH3::operator==(const SphereH3& s) const { return ( orientation() == s.orientation()) @@ -190,23 +190,23 @@ SphereH3::orientation() const template inline -bool +typename R::Boolean SphereH3::is_degenerate() const { return squared_radius() <= FT(0) ; } template CGAL_KERNEL_MEDIUM_INLINE -Oriented_side +typename R::Oriented_side SphereH3::oriented_side(const typename SphereH3::Point_3& p) const { return Oriented_side(static_cast(bounded_side(p)) * static_cast(orientation())); } template CGAL_KERNEL_INLINE -Bounded_side +typename R::Bounded_side SphereH3::bounded_side(const typename SphereH3::Point_3& p) const { - return Bounded_side(CGAL_NTS compare(squared_radius(), - squared_distance(center(),p))); + return enum_cast(CGAL_NTS compare(squared_radius(), + squared_distance(center(),p))); } template diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH2.h index 92afeec7941..1ae244802f1 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH2.h @@ -80,10 +80,10 @@ public: return static_cast(*this); } - bool operator==( const VectorH2& v) const; - bool operator!=( const VectorH2& v) const; - bool operator==( const Null_vector&) const; - bool operator!=( const Null_vector& v) const; + typename R::Boolean operator==( const VectorH2& v) const; + typename R::Boolean operator!=( const VectorH2& v) const; + typename R::Boolean operator==( const Null_vector&) const; + typename R::Boolean operator!=( const Null_vector& v) const; const RT & hx() const { return CGAL::get_pointee_or_identity(base)[0]; }; const RT & hy() const { return CGAL::get_pointee_or_identity(base)[1]; }; @@ -129,19 +129,19 @@ public: template < class R > inline -bool +typename R::Boolean VectorH2::operator==( const Null_vector&) const { return (hx() == RT(0)) && (hy() == RT(0)); } template < class R > inline -bool +typename R::Boolean VectorH2::operator!=( const Null_vector& v) const { return !(*this == v); } template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean VectorH2::operator==( const VectorH2& v) const { return ( (hx() * v.hw() == v.hx() * hw() ) @@ -150,7 +150,7 @@ VectorH2::operator==( const VectorH2& v) const template < class R > inline -bool +typename R::Boolean VectorH2::operator!=( const VectorH2& v) const { return !(*this == v); } /* XXX */ diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH3.h index 56a0e2b9ad8..3bf8af6e68b 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH3.h @@ -129,8 +129,8 @@ public: Vector_3 operator-() const; - bool operator==( const VectorH3& v) const; - bool operator!=( const VectorH3& v) const; + typename R::Boolean operator==( const VectorH3& v) const; + typename R::Boolean operator!=( const VectorH3& v) const; Vector_3 operator+( const VectorH3 &v) const; Vector_3 operator-( const VectorH3 &v) const; @@ -171,7 +171,7 @@ VectorH3::direction() const template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean VectorH3::operator==( const VectorH3& v) const { return ( (hx() * v.hw() == v.hx() * hw() ) @@ -181,7 +181,7 @@ VectorH3::operator==( const VectorH3& v) const template < class R > inline -bool +typename R::Boolean VectorH3::operator!=( const VectorH3& v) const { return !(*this == v); } diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/distance_predicatesH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/distance_predicatesH2.h index 680c6dccc02..ccac644485b 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/distance_predicatesH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/distance_predicatesH2.h @@ -24,7 +24,7 @@ namespace CGAL { template < class R> CGAL_KERNEL_MEDIUM_INLINE -bool +typename R::Boolean has_larger_distance_to_point(const PointH2& p, const PointH2& q, const PointH2& r) @@ -74,7 +74,7 @@ has_larger_distance_to_point(const PointH2& p, template < class R> CGAL_KERNEL_INLINE -Comparison_result +typename R::Comparison_result compare_signed_distance_to_line(const LineH2& l, const PointH2& p, const PointH2& q) @@ -111,7 +111,7 @@ compare_signed_distance_to_line(const LineH2& l, template < class R> CGAL_KERNEL_INLINE -bool +typename R::Boolean has_larger_signed_distance_to_line(const LineH2& l, const PointH2& p, const PointH2& q) @@ -140,7 +140,7 @@ has_larger_signed_distance_to_line(const LineH2& l, template < class R> CGAL_KERNEL_INLINE -bool +typename R::Boolean has_smaller_signed_distance_to_line(const LineH2& l, const PointH2& p, const PointH2& q) @@ -167,7 +167,7 @@ has_smaller_signed_distance_to_line(const LineH2& l, template < class R> CGAL_KERNEL_MEDIUM_INLINE -Comparison_result +typename R::Comparison_result compare_signed_distance_to_line(const PointH2& p, const PointH2& q, const PointH2& r, @@ -208,7 +208,7 @@ compare_signed_distance_to_line(const PointH2& p, template < class R> CGAL_KERNEL_MEDIUM_INLINE -bool +typename R::Boolean has_smaller_signed_distance_to_line(const PointH2& p, const PointH2& q, const PointH2& r, @@ -241,7 +241,7 @@ has_smaller_signed_distance_to_line(const PointH2& p, template < class R> CGAL_KERNEL_MEDIUM_INLINE -bool +typename R::Boolean has_larger_signed_distance_to_line(const PointH2& p, const PointH2& q, const PointH2& r, diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/distance_predicatesH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/distance_predicatesH3.h index ede98c97698..aacad83beb0 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/distance_predicatesH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/distance_predicatesH3.h @@ -21,43 +21,43 @@ namespace CGAL { template -Comparison_result +typename R::Comparison_result compare_distance_to_point(const PointH3& , const PointH3& , const PointH3& ); template -bool +typename R::Boolean has_larger_distance_to_point(const PointH3& , const PointH3& , const PointH3& ); template -bool +typename R::Boolean has_smaller_distance_to_point(const PointH3& , const PointH3& , const PointH3& ); template -Comparison_result +typename R::Comparison_result compare_signed_distance_to_plane(const PlaneH3& , const PointH3& , const PointH3& ); template -bool +typename R::Boolean has_larger_signed_distance_to_plane(const PlaneH3& , const PointH3& , const PointH3& ); template -bool +typename R::Boolean has_smaller_signed_distance_to_plane(const PlaneH3&, const PointH3& , const PointH3& ); template -Comparison_result +typename R::Comparison_result compare_signed_distance_to_plane(const PointH3& , const PointH3& , const PointH3& , @@ -65,7 +65,7 @@ compare_signed_distance_to_plane(const PointH3& , const PointH3& ); template -bool +typename R::Boolean has_larger_signed_distance_to_plane(const PointH3& , const PointH3& , const PointH3& , @@ -73,7 +73,7 @@ has_larger_signed_distance_to_plane(const PointH3& , const PointH3& ); template -bool +typename R::Boolean has_smaller_signed_distance_to_plane(const PointH3& , const PointH3& , const PointH3& , @@ -82,7 +82,7 @@ has_smaller_signed_distance_to_plane(const PointH3& , template CGAL_KERNEL_MEDIUM_INLINE -Comparison_result +typename R::Comparison_result compare_distance_to_point(const PointH3& p, const PointH3& q, const PointH3& r) @@ -121,7 +121,7 @@ compare_distance_to_point(const PointH3& p, template < class R> CGAL_KERNEL_MEDIUM_INLINE -bool +typename R::Boolean has_larger_distance_to_point(const PointH3& p, const PointH3& q, const PointH3& r) @@ -157,7 +157,7 @@ has_larger_distance_to_point(const PointH3& p, template < class R> CGAL_KERNEL_MEDIUM_INLINE -bool +typename R::Boolean has_smaller_distance_to_point(const PointH3& p, const PointH3& q, const PointH3& r) @@ -193,7 +193,7 @@ has_smaller_distance_to_point(const PointH3& p, template < class R> CGAL_KERNEL_INLINE -Comparison_result +typename R::Comparison_result compare_signed_distance_to_plane(const PlaneH3& pl, const PointH3& p, const PointH3& q) @@ -227,7 +227,7 @@ compare_signed_distance_to_plane(const PlaneH3& pl, } template -bool +typename R::Boolean has_larger_signed_distance_to_plane(const PlaneH3& pl, const PointH3& p, const PointH3& q ) @@ -257,7 +257,7 @@ has_larger_signed_distance_to_plane(const PlaneH3& pl, } template -bool +typename R::Boolean has_smaller_signed_distance_to_plane(const PlaneH3& pl, const PointH3& p, const PointH3& q ) @@ -288,7 +288,7 @@ has_smaller_signed_distance_to_plane(const PlaneH3& pl, template inline -Comparison_result +typename R::Comparison_result compare_signed_distance_to_plane(const PointH3& p, const PointH3& q, const PointH3& r, @@ -302,7 +302,7 @@ compare_signed_distance_to_plane(const PointH3& p, template inline -bool +typename R::Boolean has_larger_signed_distance_to_plane(const PointH3& p, const PointH3& q, const PointH3& r, @@ -313,7 +313,7 @@ has_larger_signed_distance_to_plane(const PointH3& p, template inline -bool +typename R::Boolean has_smaller_signed_distance_to_plane(const PointH3& p, const PointH3& q, const PointH3& r, diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h b/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h index b88aab964dc..00b6c05b1ad 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h @@ -49,26 +49,27 @@ namespace HomogeneousKernelFunctors { template class Angle_2 { + typedef typename K::Angle Angle; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; typedef typename K::Construct_vector_2 Construct_vector_2; - Construct_vector_2 c; - public: - typedef typename K::Angle result_type; + Construct_vector_2 c; + + public: Angle_2() {} Angle_2(const Construct_vector_2& c_) : c(c_) {} - result_type + Angle operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { return operator()(c(q,p), c(q,r)); } - result_type + Angle operator()(const Point_2& p, const Point_2& q, const Point_2& r, const Point_2& s) const { return operator()(c(q,p), c(s,r)); } - result_type + Angle operator()(const Vector_2& u, const Vector_2& v) const { return enum_cast(CGAL_NTS sign(u * v)); } @@ -78,33 +79,34 @@ namespace HomogeneousKernelFunctors { template class Angle_3 { + typedef typename K::Angle Angle; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::Construct_vector_3 Construct_vector_3; - Construct_vector_3 c; - public: - typedef typename K::Angle result_type; + Construct_vector_3 c; + + public: Angle_3() {} Angle_3(const Construct_vector_3& c_) : c(c_) {} - result_type + Angle operator()(const Vector_3& u, const Vector_3& v) const { return enum_cast(CGAL_NTS sign(u * v)); } // FIXME: scalar product - result_type + Angle operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { return enum_cast(CGAL_NTS sign(c(q,p) * c(q,r))); } // FIXME: scalar product - result_type + Angle operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { return enum_cast(CGAL_NTS sign(c(q,p) * c(s,r))); } // FIXME: scalar product - result_type + Angle operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Vector_3& n) const { @@ -116,14 +118,14 @@ namespace HomogeneousKernelFunctors { template class Bounded_side_2 { + typedef typename K::Bounded_side Bounded_side; typedef typename K::Point_2 Point_2; typedef typename K::Circle_2 Circle_2; typedef typename K::Triangle_2 Triangle_2; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; - public: - typedef typename K::Bounded_side result_type; - result_type + public: + Bounded_side operator()( const Circle_2& c, const Point_2& p) const { typename K::Compute_squared_distance_2 squared_distance; @@ -131,7 +133,7 @@ namespace HomogeneousKernelFunctors { squared_distance(c.center(),p))); } - result_type + Bounded_side operator()( const Triangle_2& t, const Point_2& p) const { typename K::Collinear_are_ordered_along_line_2 @@ -154,7 +156,7 @@ namespace HomogeneousKernelFunctors { : ON_UNBOUNDED_SIDE; } - result_type + Bounded_side operator()( const Iso_rectangle_2& r, const Point_2& p) const { return r.rep().bounded_side(p); @@ -164,20 +166,20 @@ namespace HomogeneousKernelFunctors { template class Bounded_side_3 { + typedef typename K::Bounded_side Bounded_side; typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::Sphere_3 Sphere_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Iso_cuboid_3 Iso_cuboid_3; - public: - typedef typename K::Bounded_side result_type; - result_type + public: + Bounded_side operator()( const Sphere_3& s, const Point_3& p) const { return s.rep().bounded_side(p); } - result_type + Bounded_side operator()( const Tetrahedron_3& t, const Point_3& p) const { Vector_3 v1 = t.vertex(1)-t.vertex(0); @@ -250,7 +252,7 @@ namespace HomogeneousKernelFunctors { return (t5 && t6) ? ON_BOUNDED_SIDE : ON_BOUNDARY; } - result_type + Bounded_side operator()( const Iso_cuboid_3& c, const Point_3& p) const { return c.rep().bounded_side(p); } }; @@ -258,21 +260,21 @@ namespace HomogeneousKernelFunctors { template class Collinear_are_ordered_along_line_2 { + typedef typename K::Boolean Boolean; typedef typename K::RT RT; typedef typename K::Point_2 Point_2; #ifdef CGAL_kernel_exactness_preconditions typedef typename K::Collinear_2 Collinear_2; Collinear_2 c; #endif // CGAL_kernel_exactness_preconditions - public: - typedef typename K::Boolean result_type; + public: #ifdef CGAL_kernel_exactness_preconditions Collinear_are_ordered_along_line_2() {} Collinear_are_ordered_along_line_2(const Collinear_2& c_) : c(c_) {} #endif // CGAL_kernel_exactness_preconditions - result_type + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { CGAL_kernel_exactness_precondition( c(p, q, r) ); @@ -309,20 +311,20 @@ namespace HomogeneousKernelFunctors { template class Collinear_are_ordered_along_line_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; #ifdef CGAL_kernel_exactness_preconditions typedef typename K::Collinear_3 Collinear_3; Collinear_3 c; #endif // CGAL_kernel_exactness_preconditions - public: - typedef typename K::Boolean result_type; + public: #ifdef CGAL_kernel_exactness_preconditions Collinear_are_ordered_along_line_3() {} Collinear_are_ordered_along_line_3(const Collinear_3& c_) : c(c_) {} #endif // CGAL_kernel_exactness_preconditions - result_type + Boolean operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { CGAL_kernel_exactness_precondition( c(p, q, r) ); @@ -390,21 +392,21 @@ namespace HomogeneousKernelFunctors { template class Collinear_are_strictly_ordered_along_line_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; #ifdef CGAL_kernel_exactness_preconditions typedef typename K::Collinear_2 Collinear_2; Collinear_2 c; #endif // CGAL_kernel_exactness_preconditions - public: - typedef typename K::Boolean result_type; + public: #ifdef CGAL_kernel_exactness_preconditions Collinear_are_strictly_ordered_along_line_2() {} Collinear_are_strictly_ordered_along_line_2(const Collinear_2& c_) : c(c_) {} #endif // CGAL_kernel_exactness_preconditions - result_type + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { CGAL_kernel_exactness_precondition( c(p, q, r) ); @@ -440,22 +442,22 @@ namespace HomogeneousKernelFunctors { template class Collinear_are_strictly_ordered_along_line_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Direction_3 Direction_3; #ifdef CGAL_kernel_exactness_preconditions typedef typename K::Collinear_3 Collinear_3; Collinear_3 c; #endif // CGAL_kernel_exactness_preconditions - public: - typedef typename K::Boolean result_type; + public: #ifdef CGAL_kernel_exactness_preconditions Collinear_are_strictly_ordered_along_line_3() {} Collinear_are_strictly_ordered_along_line_3(const Collinear_3& c_) : c(c_) {} #endif // CGAL_kernel_exactness_preconditions - result_type + Boolean operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { CGAL_kernel_exactness_precondition( c(p, q, r) ); @@ -469,6 +471,7 @@ namespace HomogeneousKernelFunctors { template class Collinear_has_on_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Direction_2 Direction_2; typedef typename K::Ray_2 Ray_2; @@ -480,23 +483,22 @@ namespace HomogeneousKernelFunctors { Collinear_are_ordered_along_line_2 co; Construct_point_on_2 cp; Compare_xy_2 cxy; - public: - typedef typename K::Boolean result_type; + public: Collinear_has_on_2() {} Collinear_has_on_2(const Construct_point_on_2& cp_, const Compare_xy_2& cxy_) : cp(cp_), cxy(cxy_) {} - result_type + Boolean operator()( const Ray_2& r, const Point_2& p) const { const Point_2 & source = cp(r,0); return p == source || Direction_2(p - source) == r.direction(); } // FIXME - result_type + Boolean operator()( const Segment_2& s, const Point_2& p) const { return co(cp(s,0), p, cp(s,1)); @@ -506,16 +508,17 @@ namespace HomogeneousKernelFunctors { template class Collinear_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Orientation_2 Orientation_2; - Orientation_2 o; - public: - typedef typename K::Boolean result_type; + Orientation_2 o; + + public: Collinear_2() {} Collinear_2(const Orientation_2 o_) : o(o_) {} - result_type + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { typedef typename K::RT RT; @@ -558,13 +561,13 @@ namespace HomogeneousKernelFunctors { template class Compare_angle_with_x_axis_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; typedef typename K::Direction_2 Direction_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Direction_2& d1, const Direction_2& d2) const { typedef typename K::RT RT; @@ -625,11 +628,11 @@ namespace HomogeneousKernelFunctors { template class Compare_distance_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { typedef typename K::RT RT; @@ -673,14 +676,14 @@ namespace HomogeneousKernelFunctors { } template - result_type + Comparison_result operator()(const T1& p, const T2& q, const T3& r) const { return CGAL::compare(squared_distance(p, q), squared_distance(p, r)); } template - result_type + Comparison_result operator()(const T1& p, const T2& q, const T3& r, const T4& s) const { return CGAL::compare(squared_distance(p, q), squared_distance(r, s)); @@ -690,11 +693,11 @@ namespace HomogeneousKernelFunctors { template class Compare_distance_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { typedef typename K::RT RT; @@ -724,16 +727,15 @@ namespace HomogeneousKernelFunctors { return CGAL_NTS sign(dosd); } - template - result_type + Comparison_result operator()(const T1& p, const T2& q, const T3& r) const { return CGAL::compare(squared_distance(p, q), squared_distance(p, r)); } template - result_type + Comparison_result operator()(const T1& p, const T2& q, const T3& r, const T4& s) const { return CGAL::compare(squared_distance(p, q), squared_distance(r, s)); @@ -743,13 +745,11 @@ namespace HomogeneousKernelFunctors { template < typename K > class Compare_power_distance_2 { - public: + typedef typename K::Comparison_result Comparison_result; typedef typename K::Weighted_point_2 Weighted_point_2; typedef typename K::Point_2 Point_2; - typedef typename K::Comparison_result Comparison_result; - - typedef Comparison_result result_type; + public: Comparison_result operator()(const Point_2& r, const Weighted_point_2& p, const Weighted_point_2& q) const @@ -763,14 +763,13 @@ namespace HomogeneousKernelFunctors { template class Compare_signed_distance_to_line_2 { - typedef typename K::Point_2 Point_2; - typedef typename K::Line_2 Line_2; + typedef typename K::Comparison_result Comparison_result; + typedef typename K::Point_2 Point_2; + typedef typename K::Line_2 Line_2; typedef typename K::Less_signed_distance_to_line_2 Less_signed_distance_to_line_2; public: - typedef Comparison_result result_type; - - result_type + Comparison_result operator()(const Point_2& p, const Point_2& q, const Point_2& r, const Point_2& s) const { @@ -796,7 +795,7 @@ namespace HomogeneousKernelFunctors { return compare(scaled_dist_r_minus_scaled_dist_s, 0); } - result_type + Comparison_result operator()(const Line_2& l, const Point_2& p, const Point_2& q) const { Less_signed_distance_to_line_2 less = K().less_signed_distance_to_line_2_object(); @@ -809,13 +808,13 @@ namespace HomogeneousKernelFunctors { template class Compare_slope_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; typedef typename K::Segment_2 Segment_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Line_2& l1, const Line_2& l2) const { if (l1.is_horizontal()) @@ -840,22 +839,22 @@ namespace HomogeneousKernelFunctors { CGAL::abs(l1.a() * l2.b()) ); } // FIXME - result_type + Comparison_result operator()(const Segment_2& s1, const Segment_2& s2) const { return (*this)(s1.source(), s1.target(), s2.source(), s2.target()); } - result_type + Comparison_result operator()(const Point_2& s1s, const Point_2& s1t, const Point_2& s2s, const Point_2& s2t) const { typedef typename K::FT FT; - typename K::Comparison_result cmp_y1 = compare_y(s1s, s1t); + Comparison_result cmp_y1 = compare_y(s1s, s1t); if (cmp_y1 == EQUAL) // horizontal { - typename K::Comparison_result cmp_x2 = compare_x(s2s, s2t); + Comparison_result cmp_x2 = compare_x(s2s, s2t); if (cmp_x2 == EQUAL) return SMALLER; FT s_hw = s2s.hw(); @@ -864,10 +863,10 @@ namespace HomogeneousKernelFunctors { CGAL_NTS sign(s2s.hx()*t_hw - s2t.hx()*s_hw); } - typename K::Comparison_result cmp_y2 = compare_y(s2s, s2t); + Comparison_result cmp_y2 = compare_y(s2s, s2t); if (cmp_y2 == EQUAL) { - typename K::Comparison_result cmp_x1 = compare_x(s1s, s1t); + Comparison_result cmp_x1 = compare_x(s1s, s1t); if (cmp_x1 == EQUAL) return LARGER; FT s_hw = s1s.hw(); @@ -876,8 +875,8 @@ namespace HomogeneousKernelFunctors { CGAL_NTS sign(s1s.hx()*t_hw - s1t.hx()*s_hw); } - typename K::Comparison_result cmp_x1 = compare_x(s1s, s1t); - typename K::Comparison_result cmp_x2 = compare_x(s2s, s2t); + Comparison_result cmp_x1 = compare_x(s1s, s1t); + Comparison_result cmp_x2 = compare_x(s2s, s2t); if (cmp_x1 == EQUAL) return cmp_x2 == EQUAL ? EQUAL : LARGER; @@ -909,12 +908,12 @@ namespace HomogeneousKernelFunctors { template class Compare_x_at_y_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Line_2& h) const { typedef typename K::RT RT; @@ -927,17 +926,17 @@ namespace HomogeneousKernelFunctors { return ( ors == ON_NEGATIVE_SIDE ) ? SMALLER : EQUAL; } // FIXME - result_type + Comparison_result operator()( const Point_2& p, const Line_2& h1, const Line_2& h2) const { return CGAL::compare(h1.x_at_y( p.y() ), h2.x_at_y( p.y() )); } // FIXME - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h) const { return compare_x_at_y( gp_linear_intersection( l1, l2 ), h); } // FIXME - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h1, const Line_2& h2) const { return compare_x_at_y( gp_linear_intersection( l1, l2 ), h1, h2 ); } @@ -947,11 +946,11 @@ namespace HomogeneousKernelFunctors { template class Compare_xyz_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { typedef typename K::RT RT; @@ -986,11 +985,11 @@ namespace HomogeneousKernelFunctors { template class Compare_xy_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Point_2& q) const { typedef typename K::RT RT; @@ -1016,11 +1015,11 @@ namespace HomogeneousKernelFunctors { template class Compare_yx_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Point_2& q) const { typedef typename K::RT RT; @@ -1046,11 +1045,11 @@ namespace HomogeneousKernelFunctors { template class Compare_xy_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { typedef typename K::RT RT; @@ -1074,31 +1073,31 @@ namespace HomogeneousKernelFunctors { template class Compare_x_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Point_2& q) const { return CGAL::compare(p.hx()*q.hw(), q.hx()*p.hw()); } - result_type + Comparison_result operator()( const Point_2& p, const Line_2& l1, const Line_2& l2) const { Point_2 ip = gp_linear_intersection( l1, l2 ); return this->operator()(p, ip); } // FIXME - result_type + Comparison_result operator()( const Line_2& l, const Line_2& h1, const Line_2& h2) const { return this->operator()(l, h1, l, h2); } // FIXME - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h1, const Line_2& h2) const { @@ -1111,11 +1110,11 @@ namespace HomogeneousKernelFunctors { template class Compare_x_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { return CGAL::compare(p.hx() * q.hw(), q.hx() * p.hw() ); } }; @@ -1123,13 +1122,13 @@ namespace HomogeneousKernelFunctors { template class Compare_y_at_x_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; typedef typename K::Segment_2 Segment_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Line_2& h) const { CGAL_kernel_precondition( ! h.is_vertical() ); @@ -1139,23 +1138,23 @@ namespace HomogeneousKernelFunctors { return ors; } // FIXME - result_type + Comparison_result operator()( const Point_2& p, const Line_2& h1, const Line_2& h2) const { return CGAL::compare(h1.y_at_x( p.x() ), h2.y_at_x( p.x() )); } // FIXME - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h) const { return compare_y_at_x( gp_linear_intersection( l1, l2 ), h); } // FIXME - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h1, const Line_2& h2) const { return compare_y_at_x( gp_linear_intersection( l1, l2 ), h1, h2 ); } // FIXME - result_type + Comparison_result operator()( const Point_2& p, const Segment_2& s) const { // compares the y-coordinates of p and the vertical projection of p on s. @@ -1183,7 +1182,7 @@ namespace HomogeneousKernelFunctors { } } // FIXME - result_type + Comparison_result operator()( const Point_2& p, const Segment_2& s1, const Segment_2& s2) const { @@ -1243,12 +1242,12 @@ namespace HomogeneousKernelFunctors { template class Compare_y_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Point_2& q) const { typedef typename K::RT RT; @@ -1260,20 +1259,20 @@ namespace HomogeneousKernelFunctors { return CGAL::compare(phy * qhw, qhy * phw); } - result_type + Comparison_result operator()( const Point_2& p, const Line_2& l1, const Line_2& l2) const { Point_2 ip = gp_linear_intersection( l1, l2 ); return compare_y( p, ip ); } // FIXME - result_type + Comparison_result operator()( const Line_2& l, const Line_2& h1, const Line_2& h2) const { return this->operator()(l, h1, l, h2); } - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h1, const Line_2& h2) const { @@ -1286,11 +1285,11 @@ namespace HomogeneousKernelFunctors { template class Compare_y_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { return CGAL::compare(p.hy() * q.hw(), q.hy() * p.hw() ); } }; @@ -1298,11 +1297,11 @@ namespace HomogeneousKernelFunctors { template class Compare_z_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { return CGAL::compare(p.hz() * q.hw(), q.hz() * p.hw() ); } }; @@ -1317,10 +1316,10 @@ namespace HomogeneousKernelFunctors { typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; typedef typename K::Construct_vector_2 Construct_vector_2; - Construct_vector_2 co; - public: - typedef FT result_type; + Construct_vector_2 co; + + public: FT operator()( const Point_2& p, const Point_2& q, const Point_2& r ) const { @@ -1346,10 +1345,9 @@ namespace HomogeneousKernelFunctors { { typedef typename K::FT FT; typedef typename K::Vector_2 Vector_2; - public: - typedef FT result_type; - result_type + public: + FT operator()(const Vector_2& v, const Vector_2& w) const { return determinant(v.hx(), v.hy(), @@ -1362,10 +1360,9 @@ namespace HomogeneousKernelFunctors { { typedef typename K::FT FT; typedef typename K::Vector_3 Vector_3; - public: - typedef FT result_type; - result_type + public: + FT operator()(const Vector_3& v, const Vector_3& w, const Vector_3& t) const { return determinant(v.hx(), v.hy(), v.hz(), @@ -1381,9 +1378,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::RT RT; typedef typename K::FT FT; typedef typename K::Vector_2 Vector_2; - public: - typedef FT result_type; + public: FT operator()(const Vector_2& v, const Vector_2& w) const { @@ -1398,9 +1394,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::RT RT; typedef typename K::FT FT; typedef typename K::Vector_3 Vector_3; - public: - typedef FT result_type; + public: FT operator()(const Vector_3& v, const Vector_3& w) const { @@ -1416,10 +1411,9 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Circle_2 Circle_2; - public: - typedef FT result_type; - FT + public: + decltype(auto) operator()( const Circle_2& c) const { return c.rep().squared_radius(); } @@ -1446,10 +1440,9 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Sphere_3 Sphere_3; - public: - typedef FT result_type; - FT + public: + decltype(auto) operator()( const Sphere_3& s) const { return s.rep().squared_radius(); } @@ -1486,9 +1479,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Vector_3 Vector_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Iso_cuboid_3 Iso_cuboid_3; - public: - typedef FT result_type; + public: FT operator()(const Point_3& p0, const Point_3& p1, const Point_3& p2, const Point_3& p3) const @@ -1531,20 +1523,17 @@ namespace HomogeneousKernelFunctors { template class Compute_x_2 { - typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: - typedef FT result_type; - - FT + decltype(auto) operator()(const Point_2& p) const { return p.rep().x(); } - FT + decltype(auto) operator()(const Vector_2& v) const { return v.rep().x(); @@ -1554,20 +1543,17 @@ namespace HomogeneousKernelFunctors { template class Compute_x_3 { - typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef FT result_type; - - FT + decltype(auto) operator()(const Point_3& p) const { return p.rep().x(); } - FT + decltype(auto) operator()(const Vector_3& v) const { return v.rep().x(); @@ -1577,20 +1563,17 @@ namespace HomogeneousKernelFunctors { template class Compute_y_2 { - typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: - typedef FT result_type; - - FT + decltype(auto) operator()(const Point_2& p) const { return p.rep().y(); } - FT + decltype(auto) operator()(const Vector_2& v) const { return v.rep().y(); @@ -1600,20 +1583,17 @@ namespace HomogeneousKernelFunctors { template class Compute_y_3 { - typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef FT result_type; - - FT + decltype(auto) operator()(const Point_3& p) const { return p.rep().y(); } - FT + decltype(auto) operator()(const Vector_3& v) const { return v.rep().y(); @@ -1623,20 +1603,17 @@ namespace HomogeneousKernelFunctors { template class Compute_z_3 { - typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef FT result_type; - - FT + decltype(auto) operator()(const Point_3& p) const { return p.rep().z(); } - FT + decltype(auto) operator()(const Vector_3& v) const { return v.rep().z(); @@ -1646,13 +1623,10 @@ namespace HomogeneousKernelFunctors { template class Compute_dx_2 { - typedef typename K::RT RT; typedef typename K::Direction_2 Direction_2; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Direction_2& d) const { return d.rep().dx(); @@ -1662,13 +1636,10 @@ namespace HomogeneousKernelFunctors { template class Compute_dx_3 { - typedef typename K::RT RT; typedef typename K::Direction_3 Direction_3; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Direction_3& d) const { return d.rep().dx(); @@ -1678,13 +1649,10 @@ namespace HomogeneousKernelFunctors { template class Compute_dy_2 { - typedef typename K::RT RT; typedef typename K::Direction_2 Direction_2; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Direction_2& d) const { return d.rep().dy(); @@ -1694,13 +1662,10 @@ namespace HomogeneousKernelFunctors { template class Compute_dy_3 { - typedef typename K::RT RT; typedef typename K::Direction_3 Direction_3; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Direction_3& d) const { return d.rep().dy(); @@ -1710,13 +1675,10 @@ namespace HomogeneousKernelFunctors { template class Compute_dz_3 { - typedef typename K::RT RT; typedef typename K::Direction_3 Direction_3; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Direction_3& d) const { return d.rep().dz(); @@ -1726,21 +1688,17 @@ namespace HomogeneousKernelFunctors { template class Compute_hx_2 { - typedef typename K::FT FT; - typedef typename K::RT RT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Point_2& p) const { return p.rep().hx(); } - result_type + decltype(auto) operator()(const Vector_2& v) const { return v.rep().hx(); @@ -1750,21 +1708,17 @@ namespace HomogeneousKernelFunctors { template class Compute_hx_3 { - typedef typename K::FT FT; - typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Point_3& p) const { return p.rep().hx(); } - result_type + decltype(auto) operator()(const Vector_3& v) const { return v.rep().hx(); @@ -1774,21 +1728,17 @@ namespace HomogeneousKernelFunctors { template class Compute_hy_2 { - typedef typename K::FT FT; - typedef typename K::RT RT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Point_2& p) const { return p.rep().hy(); } - result_type + decltype(auto) operator()(const Vector_2& v) const { return v.rep().hy(); @@ -1798,21 +1748,17 @@ namespace HomogeneousKernelFunctors { template class Compute_hy_3 { - typedef typename K::FT FT; - typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef const RT & result_type; - - result_type + decltype(auto) operator()(const Point_3& p) const { return p.rep().hy(); } - result_type + decltype(auto) operator()(const Vector_3& v) const { return v.rep().hy(); @@ -1822,21 +1768,17 @@ namespace HomogeneousKernelFunctors { template class Compute_hz_3 { - typedef typename K::FT FT; - typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Point_3& p) const { return p.rep().hz(); } - result_type + decltype(auto) operator()(const Vector_3& v) const { return v.rep().hz(); @@ -1846,21 +1788,17 @@ namespace HomogeneousKernelFunctors { template class Compute_hw_2 { - typedef typename K::FT FT; - typedef typename K::RT RT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Point_2& p) const { return p.rep().hw(); } - result_type + decltype(auto) operator()(const Vector_2& v) const { return v.rep().hw(); @@ -1870,21 +1808,17 @@ namespace HomogeneousKernelFunctors { template class Compute_hw_3 { - typedef typename K::FT FT; - typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Point_3& p) const { return p.rep().hw(); } - result_type + decltype(auto) operator()(const Vector_3& v) const { return v.rep().hw(); @@ -1898,11 +1832,11 @@ namespace HomogeneousKernelFunctors { typedef typename K::Plane_3 Plane_3; typedef typename K::RT RT; typedef typename K::Construct_orthogonal_vector_3 + Construct_orthogonal_vector_3; Construct_orthogonal_vector_3 co; - public: - typedef Vector_3 result_type; + public: Construct_base_vector_3() {} Construct_base_vector_3(const Construct_orthogonal_vector_3& co_) : co(co_) @@ -1951,9 +1885,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Iso_rectangle_2 Iso_rectangle_2; typedef typename K::Triangle_2 Triangle_2; typedef typename K::Circle_2 Circle_2; - public: - typedef Bbox_2 result_type; + public: Bbox_2 operator()( const Point_2& p) const { @@ -2016,9 +1949,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Iso_cuboid_3 Iso_cuboid_3; typedef typename K::Sphere_3 Sphere_3; - public: - typedef Bbox_3 result_type; + public: Bbox_3 operator()(const Point_3& p) const { @@ -2091,12 +2023,10 @@ namespace HomogeneousKernelFunctors { class Construct_bisector_2 { typedef typename K::RT RT; - typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; - public: - typedef Line_2 result_type; + public: Line_2 operator()(const Point_2& p, const Point_2& q) const { @@ -2134,12 +2064,10 @@ namespace HomogeneousKernelFunctors { class Construct_bisector_3 { typedef typename K::RT RT; - typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Plane_3 Plane_3; - public: - typedef Plane_3 result_type; + public: Plane_3 operator()(const Point_3& p, const Point_3& q) const { @@ -2180,16 +2108,14 @@ namespace HomogeneousKernelFunctors { template class Construct_centroid_2 { - typedef typename K::FT FT; + typedef typename K::RT RT; typedef typename K::Point_2 Point_2; typedef typename K::Triangle_2 Triangle_2; - public: - typedef Point_2 result_type; + public: Point_2 operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { - typedef typename K::RT RT; const RT phw(p.hw()); const RT qhw(q.hw()); const RT rhw(r.hw()); @@ -2230,9 +2156,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Triangle_3 Triangle_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; - public: - typedef Point_3 result_type; + public: Point_3 operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { @@ -2281,12 +2206,11 @@ namespace HomogeneousKernelFunctors { template class Construct_circumcenter_2 { - typedef typename K::FT FT; + typedef typename K::RT RT; typedef typename K::Point_2 Point_2; typedef typename K::Triangle_2 Triangle_2; - public: - typedef Point_2 result_type; + public: Point_2 operator()(const Point_2& p, const Point_2& q) const { @@ -2297,7 +2221,6 @@ namespace HomogeneousKernelFunctors { Point_2 operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { - typedef typename K::RT RT; const RT & phx = p.hx(); const RT & phy = p.hy(); const RT & phw = p.hw(); @@ -2361,14 +2284,13 @@ namespace HomogeneousKernelFunctors { template class Construct_circumcenter_3 { - typedef typename K::FT FT; + typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Triangle_3 Triangle_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Plane_3 Plane_3; - public: - typedef Point_3 result_type; + public: Point_3 operator()(const Point_3& p, const Point_3& q) const { @@ -2394,8 +2316,6 @@ namespace HomogeneousKernelFunctors { operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { - typedef typename K::RT RT; - RT phw( p.hw() ); RT qhw( q.hw() ); RT rhw( r.hw() ); @@ -2468,9 +2388,8 @@ namespace HomogeneousKernelFunctors { class Construct_cross_product_vector_3 { typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()(const Vector_3& a, const Vector_3& b) const { @@ -2485,9 +2404,8 @@ namespace HomogeneousKernelFunctors { class Construct_difference_of_vectors_2 { typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()(const Vector_2& v, const Vector_2& w) const { @@ -2501,9 +2419,8 @@ namespace HomogeneousKernelFunctors { class Construct_difference_of_vectors_3 { typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()(const Vector_3& v, const Vector_3& w) const { @@ -2528,8 +2445,6 @@ namespace HomogeneousKernelFunctors { typedef typename K::RT RT; public: - typedef Direction_2 result_type; - Rep // Direction_2 operator()(Return_base_tag, const RT& x, const RT& y) const { return Rep(x, y); } @@ -2595,9 +2510,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Segment_3 Segment_3; typedef typename K::RT RT; typedef typename Direction_3::Rep Rep; - public: - typedef Direction_3 result_type; + public: Rep // Direction_3 operator()(Return_base_tag, const RT& x, const RT& y, const RT& z) const { return Rep(x, y, z); } @@ -2646,9 +2560,8 @@ namespace HomogeneousKernelFunctors { class Construct_sum_of_vectors_2 { typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()(const Vector_2& v, const Vector_2& w) const { @@ -2662,9 +2575,8 @@ namespace HomogeneousKernelFunctors { class Construct_sum_of_vectors_3 { typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()(const Vector_3& v, const Vector_3& w) const { @@ -2681,9 +2593,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; typedef typename K::RT RT; typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()(const Vector_2& v, const FT& f ) const { @@ -2704,9 +2615,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; typedef typename K::RT RT; typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()(const Vector_3& v, const FT& f ) const { @@ -2732,8 +2642,6 @@ namespace HomogeneousKernelFunctors { typedef typename Iso_rectangle_2::Rep Rep; public: - typedef Iso_rectangle_2 result_type; - Rep // Iso_rectangle_2 operator()(Return_base_tag, const Point_2& p, const Point_2& q, int) const { @@ -2851,9 +2759,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Point_2 Point_2; typedef typename K::Point_3 Point_3; typedef typename K::Plane_3 Plane_3; - public: - typedef Point_3 result_type; + public: Point_3 operator()(const Plane_3& h, const Point_2& p) const { @@ -2875,10 +2782,10 @@ namespace HomogeneousKernelFunctors { typedef typename K::Line_2 Line_2; typedef typename Line_2::Rep Rep; typedef typename K::Construct_point_on_2 Construct_point_on_2; - Construct_point_on_2 cp; - public: - typedef Line_2 result_type; + Construct_point_on_2 cp; + + public: Construct_line_2() {} Construct_line_2(const Construct_point_on_2& cp_) : cp(cp_) {} @@ -2958,9 +2865,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Segment_2 Segment_2; - public: - typedef Point_2 result_type; + public: Point_2 operator()(const Point_2& p, const Point_2& q) const { @@ -2992,9 +2898,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Segment_3 Segment_3; - public: - typedef Point_3 result_type; + public: Point_3 operator()(const Point_3& p, const Point_3& q) const { @@ -3027,9 +2932,8 @@ namespace HomogeneousKernelFunctors { class Construct_opposite_vector_2 { typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()( const Vector_2& v) const { return Vector_2(-v.hx(), -v.hy(), v.hw()); } @@ -3039,9 +2943,8 @@ namespace HomogeneousKernelFunctors { class Construct_opposite_vector_3 { typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()( const Vector_3& v) const { return Vector_3(-v.hx(), -v.hy(), -v.hz(), v.hw()); } @@ -3053,9 +2956,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::Plane_3 Plane_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()( const Plane_3& p ) const { return p.rep().orthogonal_vector(); } @@ -3071,9 +2973,8 @@ namespace HomogeneousKernelFunctors { class Construct_perpendicular_vector_2 { typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()( const Vector_2& v, Orientation o) const { @@ -3089,9 +2990,8 @@ namespace HomogeneousKernelFunctors { class Construct_perpendicular_direction_2 { typedef typename K::Direction_2 Direction_2; - public: - typedef Direction_2 result_type; + public: Direction_2 operator()( const Direction_2& d, Orientation o) const { @@ -3110,9 +3010,8 @@ namespace HomogeneousKernelFunctors { { typedef typename K::Line_2 Line_2; typedef typename K::Point_2 Point_2; - public: - typedef Line_2 result_type; + public: Line_2 operator()( const Line_2& l, const Point_2& p) const { return typename K::Line_2( -l.b()*p.hw(), l.a()*p.hw(), l.b()*p.hx() - l.a()*p.hy()); } @@ -3128,23 +3027,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Vector_2 Vector_2; typedef typename K::Line_2 Line_2; typedef typename Point_2::Rep Rep; + public: - - template - struct result { - typedef Point_2 type; - }; - - template - struct result { - typedef const Point_2& type; - }; - - template - struct result { - typedef const Point_2& type; - }; - Rep // Point_2 operator()(Return_base_tag, Origin o) const { return Rep(o); } @@ -3193,7 +3077,7 @@ namespace HomogeneousKernelFunctors { operator()(const Point_2 & p) const { return p; } - const Point_2& + decltype(auto) operator()(const Weighted_point_2 & p) const { return p.rep().point(); } @@ -3221,22 +3105,6 @@ namespace HomogeneousKernelFunctors { typedef typename Point_3::Rep Rep; public: - - template - struct result { - typedef Point_3 type; - }; - - template - struct result { - typedef const Point_3& type; - }; - - template - struct result { - typedef const Point_3& type; - }; - Rep // Point_3 operator()(Return_base_tag, Origin o) const { return Rep(o); } @@ -3258,7 +3126,7 @@ namespace HomogeneousKernelFunctors { operator()(const Point_3 & p) const { return p; } - const Point_3& + decltype(auto) operator()(const Weighted_point_3 & p) const { return p.rep().point(); } @@ -3288,9 +3156,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Point_2 Point_2; typedef typename K::Weighted_point_2 Weighted_point_2; typedef typename Weighted_point_2::Rep Rep; - public: - typedef Weighted_point_2 result_type; + public: Rep operator()(Return_base_tag, Origin o) const { return Rep(o); } @@ -3331,9 +3198,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Weighted_point_3 Weighted_point_3; typedef typename Weighted_point_3::Rep Rep; - public: - typedef Weighted_point_3 result_type; + public: Rep operator()(Return_base_tag, Origin o) const { return Rep(o); } @@ -3373,9 +3239,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Point_2 Point_2; typedef typename K::Direction_2 Direction_2; typedef typename K::Line_2 Line_2; - public: - typedef Point_2 result_type; + public: Point_2 operator()( const Line_2& l, const Point_2& p ) const { @@ -3400,16 +3265,6 @@ namespace HomogeneousKernelFunctors { typedef typename K::Ray_3 Ray_3; public: - template - struct result { - typedef const Point_3 type; - }; - - template - struct result { - typedef const Point_3& type; - }; - Point_3 operator()( const Line_3& l, const Point_3& p ) const { @@ -3432,7 +3287,7 @@ namespace HomogeneousKernelFunctors { return l.point() + ( (lambda_num * dir)/lambda_den ); } - Point_3 + decltype(auto) operator()( const Plane_3& h, const Point_3& p ) const { return h.rep().projection(p); } @@ -3462,10 +3317,7 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; public: - - typedef Line_2 result_type; - - result_type + Line_2 operator() (const Circle_2 & c1, const Circle_2 & c2) const { // Concentric Circles don't have radical line @@ -3494,10 +3346,7 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; public: - - typedef Plane_3 result_type; - - result_type + Plane_3 operator() (const Sphere_3 & s1, const Sphere_3 & s2) const { // Concentric Spheres don't have radical plane @@ -3527,9 +3376,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::RT RT; typedef typename K::FT FT; typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()( const Vector_2& v, const RT& c) const { @@ -3549,9 +3397,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::RT RT; typedef typename K::FT FT; typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()( const Vector_3& v, const RT& c) const { @@ -3570,9 +3417,8 @@ namespace HomogeneousKernelFunctors { { typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; - public: - typedef Point_2 result_type; + public: Point_2 operator()( const Point_2& p, const Vector_2& v) const { @@ -3593,9 +3439,8 @@ namespace HomogeneousKernelFunctors { { typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; - public: - typedef Point_3 result_type; + public: Point_3 operator()( const Point_3& p, const Vector_3& v) const { @@ -3624,9 +3469,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Point_2 Point_2; typedef typename K::Direction_2 Direction_2; typedef typename Vector_2::Rep Rep; - public: - typedef Vector_2 result_type; + public: Rep // Vector_2 operator()(Return_base_tag, const Point_2& p, const Point_2& q) const { @@ -3731,9 +3575,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Vector_3 Vector_3; typedef typename K::Point_3 Point_3; typedef typename Vector_3::Rep Rep; - public: - typedef Vector_3 result_type; + public: Rep // Vector_3 operator()(Return_base_tag, const Point_3& p, const Point_3& q) const { @@ -3835,22 +3678,13 @@ namespace HomogeneousKernelFunctors { typedef typename K::Segment_2 Segment_2; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; typedef typename K::Triangle_2 Triangle_2; + public: - template - struct result { - typedef const Point_2& type; - }; - - template - struct result { - typedef Point_2 type; - }; - - const Point_2 & + decltype(auto) operator()( const Segment_2& s, int i) const { return s.vertex(i); } - const Point_2 & + decltype(auto) operator()( const Triangle_2& t, int i) const { return t.rep().vertex(i); } @@ -3871,14 +3705,10 @@ namespace HomogeneousKernelFunctors { } }; -} //namespace HomogeneousKernelFunctors - - -namespace HomogeneousKernelFunctors { - template class Coplanar_orientation_3 { + typedef typename K::Orientation Orientation; typedef typename K::Point_3 Point_3; #ifdef CGAL_kernel_exactness_preconditions typedef typename K::Coplanar_3 Coplanar_3; @@ -3887,7 +3717,6 @@ namespace HomogeneousKernelFunctors { Collinear_3 cl; #endif // CGAL_kernel_exactness_preconditions public: - typedef typename K::Orientation result_type; #ifdef CGAL_kernel_exactness_preconditions Coplanar_orientation_3() {} @@ -3895,7 +3724,7 @@ namespace HomogeneousKernelFunctors { : cp(cp_), cl(cl_) {} #endif // CGAL_kernel_exactness_preconditions - result_type + Orientation operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { Orientation oxy_pqr = sign_of_determinant(p.hx(), p.hy(), p.hw(), @@ -3915,7 +3744,7 @@ namespace HomogeneousKernelFunctors { r.hx(), r.hz(), r.hw()); } - result_type + Orientation operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { @@ -3960,6 +3789,7 @@ namespace HomogeneousKernelFunctors { template class Coplanar_side_of_bounded_circle_3 { + typedef typename K::Bounded_side Bounded_side; typedef typename K::Point_3 Point_3; #ifdef CGAL_kernel_exactness_preconditions typedef typename K::Coplanar_3 Coplanar_3; @@ -3968,7 +3798,6 @@ namespace HomogeneousKernelFunctors { Collinear_3 cl; #endif // CGAL_kernel_exactness_preconditions public: - typedef typename K::Bounded_side result_type; #ifdef CGAL_kernel_exactness_preconditions Coplanar_side_of_bounded_circle_3() {} @@ -3977,7 +3806,7 @@ namespace HomogeneousKernelFunctors { : cp(cp_), cl(cl_) {} #endif // CGAL_kernel_exactness_preconditions - result_type + Bounded_side operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& t) const { @@ -3995,11 +3824,11 @@ namespace HomogeneousKernelFunctors { template class Equal_xy_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return (p.hx() * q.hw() == q.hx() * p.hw() ) @@ -4010,11 +3839,11 @@ namespace HomogeneousKernelFunctors { template class Equal_x_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_2& p, const Point_2& q) const { return p.hx()*q.hw() == q.hx()*p.hw(); } }; @@ -4022,11 +3851,11 @@ namespace HomogeneousKernelFunctors { template class Equal_x_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return p.hx()*q.hw() == q.hx()*p.hw(); } }; @@ -4034,11 +3863,11 @@ namespace HomogeneousKernelFunctors { template class Equal_y_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_2& p, const Point_2& q) const { return p.hy()*q.hw() == q.hy()*p.hw(); } }; @@ -4046,11 +3875,11 @@ namespace HomogeneousKernelFunctors { template class Equal_y_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return p.hy()*q.hw() == q.hy()*p.hw(); } }; @@ -4058,11 +3887,11 @@ namespace HomogeneousKernelFunctors { template class Equal_z_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return p.hz()*q.hw() == q.hz()*p.hw(); } }; @@ -4070,6 +3899,7 @@ namespace HomogeneousKernelFunctors { template class Has_on_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Line_3 Line_3; typedef typename K::Ray_3 Ray_3; @@ -4077,30 +3907,29 @@ namespace HomogeneousKernelFunctors { typedef typename K::Plane_3 Plane_3; typedef typename K::Triangle_3 Triangle_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Line_3& l, const Point_3& p) const { return l.rep().has_on(p); } - result_type + Boolean operator()( const Ray_3& r, const Point_3& p) const { return r.rep().has_on(p); } - result_type + Boolean operator()( const Segment_3& s, const Point_3& p) const { return s.rep().has_on(p); } - result_type + Boolean operator()( const Plane_3& pl, const Point_3& p) const { return pl.rep().has_on(p); } - result_type + Boolean operator()( const Plane_3& pl, const Line_3& l) const { return pl.rep().has_on(l); } - result_type + Boolean operator()( const Triangle_3& t, const Point_3& p) const { if (!t.is_degenerate() ) @@ -4143,11 +3972,11 @@ namespace HomogeneousKernelFunctors { template class Less_distance_to_point_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { typedef typename K::RT RT; @@ -4195,11 +4024,11 @@ namespace HomogeneousKernelFunctors { template class Less_distance_to_point_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { typedef typename K::RT RT; @@ -4232,19 +4061,19 @@ namespace HomogeneousKernelFunctors { template class Less_signed_distance_to_line_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r, const Point_2& s) const { return Compare_signed_distance_to_line_2().operator()(p, q, r, s) == SMALLER; } - result_type + Boolean operator()(const Line_2& l, const Point_2& p, const Point_2& q) const { @@ -4270,14 +4099,14 @@ namespace HomogeneousKernelFunctors { template class Less_signed_distance_to_plane_3 { + typedef typename K::Boolean Boolean; typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Plane_3 Plane_3; typedef typename K::Construct_plane_3 Construct_plane_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Plane_3& pl, const Point_3& p, const Point_3& q) const { const RT & pla = pl.a(); @@ -4300,7 +4129,7 @@ namespace HomogeneousKernelFunctors { return scaled_dist_p_minus_scaled_dist_q < 0; } - result_type + Boolean operator()(const Point_3& plp, const Point_3& plq, const Point_3& plr, const Point_3& p, const Point_3& q) const { @@ -4312,16 +4141,17 @@ namespace HomogeneousKernelFunctors { template class Less_xyz_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Compare_xyz_3 Compare_xyz_3; - Compare_xyz_3 c; - public: - typedef typename K::Boolean result_type; + Compare_xyz_3 c; + + public: Less_xyz_3() {} Less_xyz_3(const Compare_xyz_3& c_) : c(c_) {} - result_type + Boolean operator()( const Point_3& p, const Point_3& q) const { return c(p, q) == SMALLER; } }; @@ -4329,16 +4159,17 @@ namespace HomogeneousKernelFunctors { template class Less_xy_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Compare_xy_2 Compare_xy_2; - Compare_xy_2 c; - public: - typedef typename K::Boolean result_type; + Compare_xy_2 c; + + public: Less_xy_2() {} Less_xy_2(const Compare_xy_2& c_) : c(c_) {} - result_type + Boolean operator()( const Point_2& p, const Point_2& q) const { return c(p, q) == SMALLER; } }; @@ -4346,16 +4177,17 @@ namespace HomogeneousKernelFunctors { template class Less_xy_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Compare_xy_3 Compare_xy_3; - Compare_xy_3 c; - public: - typedef typename K::Boolean result_type; + Compare_xy_3 c; + + public: Less_xy_3() {} Less_xy_3(const Compare_xy_3& c_) : c(c_) {} - result_type + Boolean operator()( const Point_3& p, const Point_3& q) const { return c(p, q) == SMALLER; } }; @@ -4363,11 +4195,11 @@ namespace HomogeneousKernelFunctors { template class Less_x_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_2& p, const Point_2& q) const { return ( p.hx()*q.hw() < q.hx()*p.hw() ); } }; @@ -4375,11 +4207,11 @@ namespace HomogeneousKernelFunctors { template class Less_x_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return ( p.hx()*q.hw() < q.hx()*p.hw() ); } }; @@ -4387,11 +4219,11 @@ namespace HomogeneousKernelFunctors { template class Less_yx_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_2& p, const Point_2& q) const { typedef typename K::RT RT; @@ -4422,11 +4254,11 @@ namespace HomogeneousKernelFunctors { template class Less_y_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_2& p, const Point_2& q) const { return ( p.hy()*q.hw() < q.hy()*p.hw() ); } }; @@ -4434,11 +4266,11 @@ namespace HomogeneousKernelFunctors { template class Less_y_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return ( p.hy()*q.hw() < q.hy()*p.hw() ); } }; @@ -4446,11 +4278,11 @@ namespace HomogeneousKernelFunctors { template class Less_z_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return (p.hz() * q.hw() < q.hz() * p.hw() ); } }; @@ -4458,13 +4290,13 @@ namespace HomogeneousKernelFunctors { template class Orientation_2 { + typedef typename K::Orientation Orientation; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; typedef typename K::Circle_2 Circle_2; - public: - typedef typename K::Orientation result_type; - result_type + public: + Orientation operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { typedef typename K::RT RT; @@ -4490,14 +4322,14 @@ namespace HomogeneousKernelFunctors { return CGAL::compare(A*D, B*C); } - result_type + Orientation operator()(const Vector_2& u, const Vector_2& v) const { return sign_of_determinant(u.hx(), u.hy(), v.hx(), v.hy()); } - result_type + Orientation operator()(const Circle_2& c) const { return c.rep().orientation(); @@ -4507,14 +4339,14 @@ namespace HomogeneousKernelFunctors { template class Orientation_3 { + typedef typename K::Orientation Orientation; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Sphere_3 Sphere_3; - public: - typedef typename K::Orientation result_type; - result_type + public: + Orientation operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { @@ -4525,7 +4357,7 @@ namespace HomogeneousKernelFunctors { s.hx(), s.hy(), s.hz(), s.hw()); } - result_type + Orientation operator()( const Vector_3& u, const Vector_3& v, const Vector_3& w) const { return sign_of_determinant( u.hx(), u.hy(), u.hz(), @@ -4533,13 +4365,13 @@ namespace HomogeneousKernelFunctors { w.hx(), w.hy(), w.hz()); } - result_type + Orientation operator()( const Tetrahedron_3& t) const { return t.rep().orientation(); } - result_type + Orientation operator()(const Sphere_3& s) const { return s.rep().orientation(); @@ -4561,7 +4393,7 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; typedef typename K::Weighted_point_3 Weighted_point_3; typedef typename K::Oriented_side Oriented_side; - typedef Oriented_side result_type; + typedef typename K::Oriented_side Orientation; Oriented_side operator() ( const Weighted_point_3 & p, const Weighted_point_3 & q, @@ -4625,12 +4457,10 @@ namespace HomogeneousKernelFunctors { template < typename K > class Power_side_of_oriented_power_circle_2 { - public: - typedef typename K::Weighted_point_2 Weighted_point_2; typedef typename K::Oriented_side Oriented_side; + typedef typename K::Weighted_point_2 Weighted_point_2; - typedef Oriented_side result_type; - + public: Oriented_side operator()(const Weighted_point_2& p, const Weighted_point_2& q, const Weighted_point_2& r, @@ -4678,20 +4508,20 @@ namespace HomogeneousKernelFunctors { template class Oriented_side_2 { + typedef typename K::Oriented_side Oriented_side; typedef typename K::RT RT; typedef typename K::Point_2 Point_2; typedef typename K::Circle_2 Circle_2; typedef typename K::Line_2 Line_2; typedef typename K::Triangle_2 Triangle_2; typedef typename K::Segment_2 Segment_2; - public: - typedef typename K::Oriented_side result_type; - result_type + public: + Oriented_side operator()( const Circle_2& c, const Point_2& p) const { return Oriented_side(static_cast(c.bounded_side(p)) * static_cast(c.orientation())); } - result_type + Oriented_side operator()( const Line_2& l, const Point_2& p) const { CGAL_kernel_precondition( ! l.is_degenerate() ); @@ -4699,7 +4529,7 @@ namespace HomogeneousKernelFunctors { return CGAL_NTS sign(v); } - result_type + Oriented_side operator()( const Triangle_2& t, const Point_2& p) const { typename K::Collinear_are_ordered_along_line_2 @@ -4724,7 +4554,7 @@ namespace HomogeneousKernelFunctors { : -ot; } - result_type + Oriented_side operator()(const Segment_2& s, const Triangle_2& t) const { typename K::Construct_source_2 source; @@ -4764,11 +4594,11 @@ namespace HomogeneousKernelFunctors { template class Side_of_bounded_circle_2 { + typedef typename K::Bounded_side Bounded_side; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Bounded_side result_type; - result_type + public: + Bounded_side operator()( const Point_2& p, const Point_2& q, const Point_2& t) const { typedef typename K::RT RT; @@ -4783,12 +4613,11 @@ namespace HomogeneousKernelFunctors { const RT& thy = t.hy(); const RT& thw = t.hw(); - return enum_cast( - CGAL::compare((thx*phw-phx*thw)*(qhx*thw-thx*qhw), + return enum_cast(CGAL::compare((thx*phw-phx*thw)*(qhx*thw-thx*qhw), (thy*phw-phy*thw)*(thy*qhw-qhy*thw)) ); } - result_type + Bounded_side operator()( const Point_2& q, const Point_2& r, const Point_2& s, const Point_2& t) const { @@ -4854,11 +4683,11 @@ namespace HomogeneousKernelFunctors { template class Side_of_bounded_sphere_3 { + typedef typename K::Bounded_side Bounded_side; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Bounded_side result_type; - result_type + public: + Bounded_side operator()( const Point_3& p, const Point_3& q, const Point_3& t) const { typedef typename K::RT RT; @@ -4882,7 +4711,7 @@ namespace HomogeneousKernelFunctors { + (thz*phw-phz*thw)*(qhz*thw-thz*qhw))); } - result_type + Bounded_side operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& t) const { @@ -4890,7 +4719,7 @@ namespace HomogeneousKernelFunctors { return enum_cast( compare_distance_to_point(center, p, t) ); } // FIXME - result_type + Bounded_side operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s, const Point_3& test) const { @@ -4920,11 +4749,11 @@ namespace HomogeneousKernelFunctors { template class Side_of_oriented_circle_2 { + typedef typename K::Oriented_side Oriented_side; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Oriented_side result_type; - result_type + public: + Oriented_side operator()( const Point_2& q, const Point_2& r, const Point_2& s, const Point_2& t) const { @@ -4981,11 +4810,11 @@ namespace HomogeneousKernelFunctors { template class Side_of_oriented_sphere_3 { + typedef typename K::Oriented_side Oriented_side; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Oriented_side result_type; - result_type + public: + Oriented_side operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s, const Point_3& t) const { @@ -5034,13 +4863,11 @@ namespace HomogeneousKernelFunctors { template < typename K > class Construct_radical_axis_2 { - public: typedef typename K::Weighted_point_2 Weighted_point_2; typedef typename K::Line_2 Line_2; typedef typename K::RT RT; - typedef Line_2 result_type; - + public: Line_2 operator()(const Weighted_point_2 & p, const Weighted_point_2 & q) const { diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/predicates_on_pointsH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/predicates_on_pointsH2.h index 6c2177c916e..f51d9f61f3c 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/predicates_on_pointsH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/predicates_on_pointsH2.h @@ -24,7 +24,7 @@ namespace CGAL { template < class R> CGAL_KERNEL_INLINE -bool +typename R::Boolean equal_xy(const PointH2& p, const PointH2& q) { @@ -39,7 +39,7 @@ equal_xy(const PointH2& p, template CGAL_KERNEL_MEDIUM_INLINE -Oriented_side +typename R::Oriented_side _where_wrt_L_wedge( const PointH2& p, const PointH2& q ) { Sign xs = CGAL_NTS sign( q.hx()*p.hw() - p.hx()*q.hw() ); // sign( qx - px ) @@ -53,7 +53,7 @@ _where_wrt_L_wedge( const PointH2& p, const PointH2& q ) } template -Comparison_result +typename Compare::result_type compare_power_distanceH2(const RT& phx, const RT& phy, const RT& phw, const Quotient& pwt, const RT& qhx, const RT& qhy, const RT& qhw, @@ -82,7 +82,7 @@ compare_power_distanceH2(const RT& phx, const RT& phy, const RT& phw, template -Oriented_side +typename Same_uncertainty_nt::type power_testH2( const RT &phx, const RT &phy, const RT &phw, const Quotient &pwt, const RT &qhx, const RT &qhy, const RT &qhw, const Quotient &qwt, const RT &rhx, const RT &rhy, const RT &rhw, const Quotient &rwt, @@ -129,7 +129,7 @@ power_testH2( const RT &phx, const RT &phy, const RT &phw, const Quotient &p template -Oriented_side +typename Same_uncertainty_nt::type power_testH2( const RT &phx, const RT &phy, const RT &phw, const Quotient &pwt, const RT &qhx, const RT &qhy, const RT &qhw, const Quotient &qwt, const RT &thx, const RT &thy, const RT &thw, const Quotient &twt) @@ -180,7 +180,7 @@ power_testH2( const RT &phx, const RT &phy, const RT &phw, const Quotient &p // Unused, undocumented, un-functorized. template < class R > CGAL_KERNEL_MEDIUM_INLINE -Comparison_result +typename R::Comparison_result compare_deltax_deltay(const PointH2& p, const PointH2& q, const PointH2& r, diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/predicates_on_pointsH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/predicates_on_pointsH3.h index e734ac9493d..c1956fddb63 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/predicates_on_pointsH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/predicates_on_pointsH3.h @@ -25,8 +25,9 @@ namespace CGAL { template < class R > CGAL_KERNEL_MEDIUM_INLINE -bool lexicographically_xy_smaller(const PointH3 &p, - const PointH3 &q) +typename R::Boolean +lexicographically_xy_smaller(const PointH3 &p, + const PointH3 &q) { typedef typename R::RT RT; RT pV = p.hx()*q.hw(); @@ -51,7 +52,7 @@ bool lexicographically_xy_smaller(const PointH3 &p, template < class R> CGAL_KERNEL_MEDIUM_INLINE -Comparison_result +typename R::Comparison_result compare_xy(const PointH3& p, const PointH3& q) { typedef typename R::RT RT; @@ -82,7 +83,7 @@ compare_xy(const PointH3& p, const PointH3& q) template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean equal_xy(const PointH3 &p, const PointH3 &q) { return (p.hx() * q.hw() == q.hx() * p.hw() ) @@ -91,7 +92,7 @@ equal_xy(const PointH3 &p, const PointH3 &q) template < class R > // ??? -> == CGAL_KERNEL_INLINE -bool +typename R::Boolean equal_xyz(const PointH3 &p, const PointH3 &q) { return (p.hx() * q.hw() == q.hx() * p.hw() ) @@ -101,27 +102,27 @@ equal_xyz(const PointH3 &p, const PointH3 &q) template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean less_x(const PointH3 &p, const PointH3 &q) { return (p.hx() * q.hw() < q.hx() * p.hw() ); } template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean less_y(const PointH3 &p, const PointH3 &q) { return (p.hy() * q.hw() < q.hy() * p.hw() ); } template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean less_z(const PointH3 &p, const PointH3 &q) { return (p.hz() * q.hw() < q.hz() * p.hw() ); } template -Oriented_side +typename Same_uncertainty_nt::type power_side_of_oriented_power_sphereH3( const RT &phx, const RT &phy, const RT &phz, const RT &phw, const Quotient &pwt, const RT &qhx, const RT &qhy, const RT &qhz, const RT &qhw, const Quotient &qwt, diff --git a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_triangulation_2/internal/Hyperbolic_Delaunay_triangulation_traits_2_functions.h b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_triangulation_2/internal/Hyperbolic_Delaunay_triangulation_traits_2_functions.h index 16e863753e2..63bb0c0c47f 100644 --- a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_triangulation_2/internal/Hyperbolic_Delaunay_triangulation_traits_2_functions.h +++ b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_triangulation_2/internal/Hyperbolic_Delaunay_triangulation_traits_2_functions.h @@ -225,13 +225,11 @@ class Side_of_oriented_hyperbolic_segment_2 typedef typename Traits::Construct_weighted_circumcenter_2 Construct_weighted_circumcenter_2; public: - typedef Oriented_side result_type; - Side_of_oriented_hyperbolic_segment_2(const Traits& gt = Traits()) : _gt(gt) {} - result_type operator()(const Hyperbolic_point_2& p, - const Hyperbolic_point_2& q, - const Hyperbolic_point_2& query) const + Oriented_side operator()(const Hyperbolic_point_2& p, + const Hyperbolic_point_2& q, + const Hyperbolic_point_2& query) const { // Check first if the points are collinear with the origin Circle_2 poincare(Hyperbolic_point_2(FT(0),FT(0)), FT(1)); diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Tetrahedron_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Tetrahedron_3_intersection.h index f1d8bdff1fd..706ceea7488 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Tetrahedron_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Tetrahedron_3_intersection.h @@ -26,7 +26,6 @@ struct Tetrahedron_Line_intersection_3 : public Tetrahedron_lines_intersection_3_base > { typedef Tetrahedron_lines_intersection_3_base > Base; - typedef typename Base::Result_type Result_type; Tetrahedron_Line_intersection_3(const typename K::Tetrahedron_3& tet, const typename K::Line_3& l) diff --git a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h index f367f26df4c..0f8a0658bf6 100644 --- a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h +++ b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h @@ -4338,7 +4338,7 @@ public: Kernel::Vector_3 const& n); /*! - introduces a variable of type `Kernel::Point_3`. + introduces a variable of type `Kernel::Circle_3`. It is initialized to the circle passing through the three points. \pre The three points are not collinear. */ @@ -7600,7 +7600,7 @@ public: and also for `Type1` and `Type2` of respective types - `Kernel::Triangle_3` and `Kernel::Tetrahedron_3` - - `Kernel::Plane_3` and `Kernel::Sphere_3` (or the contrary) + - `Kernel::Plane_3` and `Kernel::Sphere_3` - `Kernel::Sphere_3` and `Kernel::Sphere_3`. */ diff --git a/Kernel_23/examples/Kernel_23/MyConstruct_point_2.h b/Kernel_23/examples/Kernel_23/MyConstruct_point_2.h index 962bdd88742..8e9407486d3 100644 --- a/Kernel_23/examples/Kernel_23/MyConstruct_point_2.h +++ b/Kernel_23/examples/Kernel_23/MyConstruct_point_2.h @@ -8,9 +8,8 @@ class MyConstruct_point_2 typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; typedef typename Point_2::Rep Rep; -public: - typedef Point_2 result_type; +public: // Note : the CGAL::Return_base_tag is really internal CGAL stuff. // Unfortunately it is needed for optimizing away copy-constructions, // due to current lack of delegating constructors in the C++ standard. diff --git a/Kernel_23/examples/Kernel_23/intersection_visitor.cpp b/Kernel_23/examples/Kernel_23/intersection_visitor.cpp index 61d0dbba7e2..417363ecbdb 100644 --- a/Kernel_23/examples/Kernel_23/intersection_visitor.cpp +++ b/Kernel_23/examples/Kernel_23/intersection_visitor.cpp @@ -8,8 +8,6 @@ typedef K::Line_2 Line_2; typedef K::Intersect_2 Intersect_2; struct Intersection_visitor { - typedef void result_type; - void operator()(const Point_2& p) const { std::cout << p << std::endl; diff --git a/Kernel_23/include/CGAL/Circle_2.h b/Kernel_23/include/CGAL/Circle_2.h index b6020ff7528..e21b2ea62a6 100644 --- a/Kernel_23/include/CGAL/Circle_2.h +++ b/Kernel_23/include/CGAL/Circle_2.h @@ -102,7 +102,8 @@ public: return R().compute_squared_radius_2_object()(*this); } - Orientation orientation() const + typename R::Orientation + orientation() const { // This make_certain(), the uncertain orientation of circles, the orientation // of circles, are all yucky. @@ -177,18 +178,6 @@ public: return R().construct_bbox_2_object()(*this); } - typename R::Boolean - operator==(const Circle_2 &c) const - { - return R().equal_2_object()(*this, c); - } - - typename R::Boolean - operator!=(const Circle_2 &c) const - { - return !(*this == c); - } - Circle_2 transform(const Aff_transformation_2 &t) const { return t.transform(*this); diff --git a/Kernel_23/include/CGAL/Circle_3.h b/Kernel_23/include/CGAL/Circle_3.h index b23e651e9fc..0b103f3a864 100644 --- a/Kernel_23/include/CGAL/Circle_3.h +++ b/Kernel_23/include/CGAL/Circle_3.h @@ -101,14 +101,14 @@ public: return typename R::Construct_sphere_3()(*this); } - Point_3 center() const + decltype(auto) center() const { - return typename R::Construct_sphere_3()(*this).center(); + return diametral_sphere().center(); } - FT squared_radius() const + decltype(auto) squared_radius() const { - return typename R::Construct_sphere_3()(*this).squared_radius(); + return diametral_sphere().squared_radius(); } decltype(auto) @@ -122,7 +122,7 @@ public: return typename R::Construct_bbox_3()(*this); } - FT area_divided_by_pi() const + decltype(auto) area_divided_by_pi() const { return typename R::Compute_area_divided_by_pi_3()(*this); } @@ -152,16 +152,7 @@ public: template < typename R > inline -bool -operator==(const Circle_3 &p, - const Circle_3 &q) -{ - return R().equal_3_object()(p, q); -} - -template < typename R > -inline -bool +typename R::Boolean operator!=(const Circle_3 &p, const Circle_3 &q) { diff --git a/Kernel_23/include/CGAL/Direction_2.h b/Kernel_23/include/CGAL/Direction_2.h index 407d4e31ed1..d7be7b4d409 100644 --- a/Kernel_23/include/CGAL/Direction_2.h +++ b/Kernel_23/include/CGAL/Direction_2.h @@ -156,18 +156,6 @@ public: return this->vector(); } - typename R::Boolean - operator==(const Direction_2& d) const - { - return R().equal_2_object()(*this, d); - } - - typename R::Boolean - operator!=(const Direction_2& d) const - { - return !(*this == d); - } - Direction_2 transform(const Aff_transformation_2 &t) const { return t.transform(*this); diff --git a/Kernel_23/include/CGAL/Is_a_predicate.h b/Kernel_23/include/CGAL/Is_a_predicate.h deleted file mode 100644 index 4f23fa9c4e3..00000000000 --- a/Kernel_23/include/CGAL/Is_a_predicate.h +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2002 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. -// -// This file is part of CGAL (www.cgal.org) -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Sylvain Pion - -#ifndef CGAL_IS_A_PREDICATE_H -#define CGAL_IS_A_PREDICATE_H - -// How to determine if a kernel functor is a predicate or a construction. - -#include -#include - -namespace CGAL { - -namespace internal { - -// By default it's a construction -template -struct Return_type_of_predicate { - typedef CGAL::Tag_false type; -}; - -// Specializations for predicates -template <> -struct Return_type_of_predicate { - typedef CGAL::Tag_true type; -}; - -template <> -struct Return_type_of_predicate { - typedef CGAL::Tag_true type; -}; - -template <> -struct Return_type_of_predicate { - typedef CGAL::Tag_true type; -}; - -template <> -struct Return_type_of_predicate { - typedef CGAL::Tag_true type; -}; - -} // namespace internal - -template -struct Is_a_predicate { - typedef typename internal::Return_type_of_predicate< - typename Functor::result_type>::type type; -}; - -} //namespace CGAL - -#endif // CGAL_IS_A_PREDICATE_H diff --git a/Kernel_23/include/CGAL/Iso_cuboid_3.h b/Kernel_23/include/CGAL/Iso_cuboid_3.h index d279426727f..6fab726dccb 100644 --- a/Kernel_23/include/CGAL/Iso_cuboid_3.h +++ b/Kernel_23/include/CGAL/Iso_cuboid_3.h @@ -29,6 +29,8 @@ namespace CGAL { template class Iso_cuboid_3 : public R_::Kernel_base::Iso_cuboid_3 { + typedef typename R_::Boolean Boolean; + typedef typename R_::Bounded_side Bounded_side; typedef typename R_::RT RT; typedef typename R_::FT FT; typedef typename R_::Point_3 Point_3; @@ -173,25 +175,25 @@ public: return zmax(); } - bool + typename R::Boolean has_on_bounded_side(const Point_3 &p) const { return R().has_on_bounded_side_3_object()(*this,p); } - bool + Boolean has_on_unbounded_side(const Point_3 &p) const { return R().has_on_unbounded_side_3_object()(*this,p); } - bool + Boolean has_on_boundary(const Point_3 &p) const { return R().has_on_boundary_3_object()(*this,p); } - bool + Boolean has_on(const Point_3 &p) const { return has_on_boundary(p); @@ -203,7 +205,7 @@ public: return R().bounded_side_3_object()(*this,p); } - bool + Boolean is_degenerate() const { return R().is_degenerate_3_object()(*this); diff --git a/Kernel_23/include/CGAL/Iso_rectangle_2.h b/Kernel_23/include/CGAL/Iso_rectangle_2.h index 7d3dc5a4709..226388bd5a8 100644 --- a/Kernel_23/include/CGAL/Iso_rectangle_2.h +++ b/Kernel_23/include/CGAL/Iso_rectangle_2.h @@ -27,6 +27,8 @@ namespace CGAL { template class Iso_rectangle_2 : public R_::Kernel_base::Iso_rectangle_2 { + typedef typename R_::Boolean Boolean; + typedef typename R_::Bounded_side Bounded_side; typedef typename R_::RT RT; typedef typename R_::FT FT; typedef typename R_::Point_2 Point_2; @@ -94,19 +96,6 @@ public: return R().construct_max_vertex_2_object()(*this); } - bool - operator==(const Iso_rectangle_2 &i) const - { - return R().equal_2_object()(*this, i); - } - - bool - operator!=(const Iso_rectangle_2 &i) const - { - return ! (*this == i); - } - - decltype(auto) vertex(int i) const { @@ -169,22 +158,19 @@ public: return R().compute_area_2_object()(*this); } - - bool + Boolean has_on_boundary(const Point_2 &p) const { return R().has_on_boundary_2_object()(*this,p); } - - bool + Boolean has_on_bounded_side(const Point_2 &p) const { return R().has_on_bounded_side_2_object()(*this,p); } - - bool + Boolean has_on_unbounded_side(const Point_2 &p) const { return R().has_on_unbounded_side_2_object()(*this,p); @@ -196,8 +182,7 @@ public: return R().bounded_side_2_object()(*this,p); } - - bool + Boolean is_degenerate() const { return R().is_degenerate_2_object()(*this); diff --git a/Kernel_23/include/CGAL/Kernel/Type_mapper.h b/Kernel_23/include/CGAL/Kernel/Type_mapper.h index bdb2785889e..6be3487b3f4 100644 --- a/Kernel_23/include/CGAL/Kernel/Type_mapper.h +++ b/Kernel_23/include/CGAL/Kernel/Type_mapper.h @@ -19,62 +19,25 @@ #include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - namespace CGAL { +template < typename T, typename K1, typename K2 > +struct Type_mapper; + namespace internal { -// the default implementation is required to catch the odd one-out -// object like Bbox -template +template < typename T, typename K1, typename K2, typename = void > // last tparam is for SFINAE struct Type_mapper_impl { typedef T type; }; -template < typename T, typename K1, typename K2 > -struct Type_mapper_impl, K1, K2 > { - typedef std::vector< typename Type_mapper_impl::type > type; +template < typename K1, typename K2> +struct Type_mapper_impl { + typedef K2 type; }; -template < typename T, typename K1, typename K2 > -struct Type_mapper_impl, K1, K2 > { - typedef std::optional< typename Type_mapper_impl::type > type; -}; - - -/// The following code is equivalent to the one commented in CODE_TAG -/// except that with this one, the variant is really variant and not -/// a internal obfuscated type -#define CGAL_TYPEMAP_TYPEDEFS(z, n, t) typedef typename Type_mapper_impl< t##n, K1, K2 >::type A##n; - -#define CGAL_VARIANT_TYPEMAP(z, n, d) \ -template< typename K1, typename K2, BOOST_PP_ENUM_PARAMS(n, class T) > \ -struct Type_mapper_impl, K1, K2> { \ - BOOST_PP_REPEAT(n, CGAL_TYPEMAP_TYPEDEFS, T) \ - typedef std::variant type; \ -}; - -BOOST_PP_REPEAT_FROM_TO(1, 10, CGAL_VARIANT_TYPEMAP, _) - -#undef CGAL_TYPEMAP_TYPEDEFS -#undef CGAL_VARIANT_TYPEMAP - -// Then we specialize for all kernel objects. -// More details on why it is like that are here: https://github.com/CGAL/cgal/pull/4878#discussion_r459986501 +// 'Rep' gets a weird partial specialization because of Return_base_tag shenanigans. +// See https://github.com/CGAL/cgal/issues/3035#issuecomment-428721414 #define CGAL_Kernel_obj(X) \ template < typename K1, typename K2 > \ struct Type_mapper_impl < typename K1::X, K1, K2 > \ @@ -89,20 +52,28 @@ template < typename K1, typename K2 > struct Type_mapper_impl < typename K1::FT, K1, K2 > { typedef typename K2::FT type; }; +// This matches about anything and recursively calls Type_mapper on the template parameters +// until reaching the other cases (kernel objects, K1, FT) +template