diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h index de200ba3e4b9..47d45e0e113c 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h @@ -130,12 +130,12 @@ class CircleC3 { 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 +155,7 @@ class CircleC3 { 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(); } diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h index 3dee104e4c65..d5f0768f30cf 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h @@ -163,6 +163,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 +173,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 3a197adecf87..8560ea4b8151 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/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index 737a52dfc143..b26a9bcfc457 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; + 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; + 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,23 +2928,8 @@ 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; - }; + public: Rep // Point_2 operator()(Return_base_tag, Origin o) const { return Rep(o); } @@ -3109,7 +2964,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(); } @@ -3168,7 +3023,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(); } @@ -3193,9 +3048,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); } @@ -3236,9 +3090,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); } @@ -3278,9 +3131,8 @@ namespace CartesianKernelFunctors { { typedef typename K::Point_2 Point_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 { @@ -3362,10 +3214,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 @@ -3388,10 +3237,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 @@ -3415,9 +3261,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 { @@ -3430,9 +3275,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 { @@ -3445,9 +3289,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 { @@ -3460,9 +3303,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 { @@ -3475,9 +3317,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 { @@ -3498,9 +3339,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 { @@ -3528,9 +3368,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()); } @@ -3626,9 +3465,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 { @@ -3728,22 +3566,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 & + public: + 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); } @@ -3766,6 +3595,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; @@ -3773,9 +3603,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_) @@ -3783,7 +3612,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(), @@ -3791,7 +3620,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 { @@ -3814,16 +3643,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_, @@ -3832,7 +3661,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 { @@ -3852,11 +3681,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() ); @@ -3866,11 +3695,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(); } }; @@ -3878,11 +3707,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(); } }; @@ -3890,11 +3719,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(); } }; @@ -3902,11 +3731,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(); } }; @@ -3914,11 +3743,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(); } }; @@ -3926,6 +3755,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; @@ -3936,30 +3766,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(); @@ -3973,19 +3802,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); } @@ -3995,11 +3824,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(), @@ -4011,11 +3840,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(), @@ -4028,13 +3857,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 { @@ -4046,7 +3875,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(), @@ -4058,13 +3887,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(), @@ -4072,7 +3901,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 { @@ -4089,16 +3918,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; + 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; } }; @@ -4106,16 +3936,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; + 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; } }; @@ -4123,16 +3954,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; + 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; } }; @@ -4140,11 +3972,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(); } }; @@ -4152,11 +3984,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(); } }; @@ -4164,11 +3996,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(), @@ -4179,11 +4011,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(); } }; @@ -4191,11 +4023,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(); } }; @@ -4203,11 +4035,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(); } }; @@ -4215,24 +4047,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(); @@ -4242,14 +4075,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 { @@ -4259,7 +4092,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(), @@ -4267,7 +4100,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 { @@ -4276,13 +4109,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(); @@ -4293,10 +4126,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, @@ -4345,24 +4176,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 @@ -4376,7 +4207,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))) || @@ -4384,11 +4216,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; @@ -4416,11 +4247,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(), @@ -4428,7 +4259,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 { @@ -4440,11 +4271,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(), @@ -4452,7 +4283,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 { @@ -4462,7 +4293,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 { @@ -4477,11 +4308,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 { @@ -4495,11 +4326,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/predicates/kernel_ftC2.h b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h index 56903c2c921f..1f1d912e0d21 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 5d210da549dc..297a29487c2f 100644 --- a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h +++ b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h @@ -141,6 +141,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)); } @@ -151,6 +152,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))); @@ -164,6 +166,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))); @@ -218,6 +221,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 @@ -371,6 +376,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, @@ -390,6 +396,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)) ); @@ -418,9 +425,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; @@ -713,6 +720,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; @@ -763,6 +772,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 eba947c1d374..8efde8736eee 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 a1890928e7dd..1454b4f9cff6 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; - public: - typedef typename Base_functor::result_type result_type; + typedef typename CK::Circle_2 Circle_2; + typedef typename CK::Circular_arc_2 Circular_arc_2; - using Base_functor::operator(); + typedef typename CK::Linear_kernel::Construct_circle_2 Linear_Construct_circle_2; + + public: + // using Linear_Construct_circle_2::operator(); - typedef typename CK::Circular_arc_2 Circular_arc_2; + template + decltype(auto) + operator()(const Args&... args) const + { return Linear_Construct_circle_2()(args...); } - 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 fba7f0f1d74a..8209e845a92d 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 09696e5069c3..6c3b686dcab0 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 { - - 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; - - 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);} - - }; +#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); }\ + };\ + + CGAL_CIRCULAR_KERNEL_MACRO_FUNCTOR_COMPARE_(x) + CGAL_CIRCULAR_KERNEL_MACRO_FUNCTOR_COMPARE_(y) + CGAL_CIRCULAR_KERNEL_MACRO_FUNCTOR_COMPARE_(xy) + +#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; + + public: + // using CK::Linear_kernel::Equal_2::operator(); - typedef typename CK::Linear_kernel::Equal_2::result_type result_type; - using CK::Linear_kernel::Equal_2::operator(); + template + Boolean + operator()(const A& a, const B& b) const { + return Linear_Equal_2()(a, b); + } - result_type + 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; - public: + typedef typename CK::Linear_kernel::Is_vertical_2 Linear_Is_vertical_2; - typedef typename CK::Linear_kernel::Is_vertical_2::result_type result_type; + public: + // using CK::Linear_kernel::Is_vertical_2::operator(); - using CK::Linear_kernel::Is_vertical_2::operator(); + template + Boolean + operator()(const A& a) const + { return Linear_Is_vertical_2()(a); } - 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; + + typedef typename CK::Linear_kernel::Construct_center_2 Linear_Construct_center_2; + public: - typedef typename CK::Linear_kernel::Construct_center_2::result_type result_type; - using CK::Linear_kernel::Construct_center_2::operator(); + // using CK::Linear_kernel::Construct_center_2::operator(); + + template + decltype(auto) + operator()(const A& a) const + { return Linear_Construct_center_2()(a); } - result_type + 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 9a3ca3b1a89b..ae9453be1c00 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 90fbdc385342..53b554c95b8f 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 @@ class Compare_x_2 : public BK::Circular_kernel:: template Base< BK >::Type::Comp 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 +public: + Comparison_result operator() (const Point_2 &p0, const Point_2 &p1) const { @@ -83,7 +80,7 @@ class Compare_y_2 : public BK::Circular_kernel:: template Base< BK >::Type::Comp 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 @@ class In_x_range_2 : public BK::Circular_kernel:: template Base< BK >::Type::In_ } 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 @@ class Compare_y_at_x_2 : public BK::Circular_kernel:: template Base< BK >::Type: } 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 @@ class Has_on_2 : public BK::Circular_kernel:: template Base< BK >::Type::Has_on_ } 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 @@ class Equal_2 } public: - - result_type + Boolean operator()( const Circular_arc_point_2 &a , const Circular_arc_point_2 &b) const { @@ -361,14 +337,15 @@ class Equal_2 /* 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 @@ class Equal_2 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 @@ class Do_overlap_2 : public BK::Circular_kernel:: template Base< BK >::Type::Do_ 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 @@ class Do_overlap_2 : public BK::Circular_kernel:: template Base< BK >::Type::Do_ 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 @@ class Intersect_2 : public BK::Circular_kernel:: template Base< BK >::Type::Inte 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 937d438332f3..5f5ca1dc107e 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 bc945e6454c4..47c71fadee2c 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 bfb44edf9245..35dc8b46908c 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 @@ class Circular_arc_point_3 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 9d10940f0aaf..d726f22b1fd7 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 ff7119586a5b..dcd32713207b 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; - public: + typedef typename SK::Linear_kernel::Equal_3 Linear_equal_3; - typedef typename SK::Linear_kernel::Equal_3::result_type result_type; + public: + // using SK::Linear_kernel::Equal_3::operator(); - using SK::Linear_kernel::Equal_3::operator(); + template + Boolean + operator()(const A& a, const B& b) const + { return Linear_equal_3()(a, b); } - 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 dont 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 dont 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; + typedef typename SK::Linear_kernel::Do_intersect_3 Linear_Do_intersect_3; + public: - typedef typename SK::Linear_kernel::Do_intersect_3::result_type result_type; + // using SK::Linear_kernel::Do_intersect_3::operator(); - 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; - public: + typedef typename SK::Linear_kernel::Construct_bbox_3 Linear_Construct_bbox_3; - typedef typename SK::Linear_kernel::Construct_bbox_3::result_type result_type; + public: + // using SK::Linear_kernel::Construct_bbox_3::operator(); - using SK::Linear_kernel::Construct_bbox_3::operator(); + template + decltype(auto) + operator()(const A& a) const + { return Linear_Construct_bbox_3()(a); } - 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; - public: + typedef typename SK::Linear_kernel::Compute_approximate_angle_3 Linear_Compute_approximate_angle_3; - typedef double result_type; + public: + // using SK::Linear_kernel::Compute_approximate_angle_3::operator(); - using SK::Linear_kernel::Compute_approximate_angle_3::operator(); + template + decltype(auto) // the linear kernel has "FT" as return type... + operator()(const Args&... args) const + { return Linear_Compute_approximate_angle_3()(args...); } - 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 c93094bd1d2e..b8c3d212bf79 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 9360c96d18f9..a587d87cea48 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 428866204fbc..b6d2882b141d 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/include/CGAL/EPIC_predicate_if_convertible.h b/Filtered_kernel/include/CGAL/EPIC_predicate_if_convertible.h new file mode 100644 index 000000000000..37c47e7edb5b --- /dev/null +++ b/Filtered_kernel/include/CGAL/EPIC_predicate_if_convertible.h @@ -0,0 +1,57 @@ +// 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...)) + { + CGAL::Epic_converter converter; + + std::tuple converted_args; + + auto convert = [&](auto index, const auto& arg) + { + auto converted = converter(approx(arg)); + if(converted.second) + std::get(converted_args) = converted; + return converted.second; + }; + + bool success = [&](std::index_sequence) { + return (... && convert(std::integral_constant{}, args)); + }(std::index_sequence_for{}); + + if(!success) // failed to convert all arguments, call the base predicate + return fp(args...); + + return [&](std::index_sequence) { + return epicp(std::get(converted_args).first...); + }(std::index_sequence_for{}); + } +}; + +} // CGAL + +#endif // CGAL_EPIC_PREDICATE_IF_CONVERTIBLE_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 e9428fd2917e..f54f028d47d8 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 @@ class Angle_3 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 9279f60c3d28..4dd64070b5c3 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; -public: + typedef typename K_base::Collinear_3 Base; - typedef typename Base::result_type result_type; - result_type +public: + 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 f3880b3f0e2e..4589aa9aa815 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 8e0683677aad..aecee9d36180 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::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: - typedef typename Base::result_type result_type; + 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 41b9f1b9e77c..3a8afc92ba3c 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::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: - typedef typename Base::result_type result_type; + 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 29c6d2910515..3478f5249837 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; -public: - - typedef typename Base::result_type result_type; + typedef typename K_base::Compare_x_2 Base; +public: 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 da9b97215a85..043a174ce999 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; -public: - - typedef typename Base::result_type result_type; + typedef typename K_base::Compare_y_2 Base; +public: 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 5de1af9d7b2d..8c9204f718f0 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; -public: + 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 fedf31fcba9e..38c4384769ca 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 212dddec6cf5..255f95c1ab7e 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/Do_intersect_2.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_2.h index a5533c253faa..088648b9d72b 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 @@ class Do_intersect_2 // 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 2b0ef97d7fcd..1d19ce5a4690 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 @@ class Do_intersect_3 // 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 @@ class Do_intersect_3 { 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 @@ class Do_intersect_3 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 @@ class Do_intersect_3 { 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 @@ class Do_intersect_3 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 @@ class Do_intersect_3 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 60b2360a939b..79832da25356 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 @@ class Equal_2 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 10c44051ae29..5d04c892d7f7 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 @@ class Equal_3 } - 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 @@ class Equal_3 } - 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 a4af481f7e16..6b43f6291263 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 cbb4494e7cd2..11cd803458a5 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 2fdffde6fdae..f7d126dfaf08 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_sphere_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Power_side_of_oriented_power_sphere_3.h index d4621b756a54..fe2057ca243d 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); @@ -410,7 +410,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); } int int_tmp_result_k60Ocge; double RT_tmp_result_3SPBwDj = CGAL::determinant( dpx, dpz, dpt, dqx, dqz, dqt, drx, drz, drt ); @@ -498,7 +498,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { } } } - return static_cast(cmp * int_tmp_result_k3Lzf6g); + return static_cast(cmp * int_tmp_result_k3Lzf6g); } int int_tmp_result_AvrrXBP; double RT_tmp_result_feLwnHn = CGAL::determinant( dpy, dpz, dpt, dqy, dqz, dqt, dry, drz, drt ); @@ -581,15 +581,15 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { } } } - return static_cast(cmp * int_tmp_result_agX3WsT); + return static_cast(cmp * int_tmp_result_agX3WsT); } 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); @@ -679,7 +679,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) ) @@ -722,7 +722,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; @@ -765,7 +765,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 3b59fed08dbe..0762a4948f45 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 41a54d330125..90b128c5eee6 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 acfe6892a7c3..99be87fecf1e 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 @@ class Filtered_predicate {} 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 @@ class Filtered_predicate { 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 @@ class Filtered_predicate 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 @@ class Filtered_predicate_RT_FT 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 @@ class Filtered_predicate_RT_FT { 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 @@ class Filtered_predicate_RT_FT 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 c0b2e2179caf..d29cd3b9b9db 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 boost::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/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 5d7b22ec37b8..78a9742a96d0 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(){} @@ -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 utilisation, 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< BOOST_VARIANT_ENUM_PARAMS(typename U) > - const T2& - operator()(const boost::optional< boost::variant< BOOST_VARIANT_ENUM_PARAMS(U) > >& o) const - { - const std::vector* ptr = (boost::get >(&(*o))); - return (*ptr)[i]; - } - - template< BOOST_VARIANT_ENUM_PARAMS(typename U) > - const T2& - operator()(const boost::variant< BOOST_VARIANT_ENUM_PARAMS(U) >& o) const - { - const std::vector* ptr = (boost::get >(&o)); - return (*ptr)[i]; - } -}; - template struct Lazy_cartesian_const_iterator_2 { @@ -1524,181 +1209,6 @@ struct Lazy_cartesian_const_iterator_3 }; - -// 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 @@ struct Lazy_construction_object #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,237 +1401,201 @@ struct Fill_lazy_variant_visitor_0 : boost::static_visitor<> { } // internal -template -struct Lazy_construction_variant { +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 +struct Lazy_construction +{ static const bool Protection = true; typedef typename LK::Approximate_kernel AK; typedef typename LK::Exact_kernel EK; - typedef typename LK::E2A E2A; + typedef typename Default::Get::type E2A; + CGAL_NO_UNIQUE_ADDRESS AC ac; + CGAL_NO_UNIQUE_ADDRESS EC ec; - template - struct result { - // this does not default, if you want to make a lazy lazy-kernel, - // you are on your own - }; + // to detect the return type of Intersection_[23]'s functors + template + struct is_optional_variant : std::false_type { }; - template - struct result - { - typedef typename Type_mapper()(std::declval::type>()...)),AK,LK>::type type; - }; + template + struct is_optional_variant > > : std::true_type { }; - template + 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; + 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; - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + // ----------------------- FT ----------------------- + if constexpr (std::is_same_v) { - Protect_FPU_rounding P; + typedef Lazy_exact_nt> result_type; - try { - Lazy lazy(new Lazy_rep_n(AC(), EC(), l1, l2)); + 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 CGAL::Object result_type; + typedef Lazy Lazy_object; - // the approximate result requires the trait with types from the AK - AT approx_v = lazy.approx(); - // the result we build - result_type res; + 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)); \ + } - if(!approx_v) { - // empty - return res; - } +# 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); \ + }\ + } - // 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); - boost::apply_visitor(visitor, *approx_v); + CGAL_Kernel_obj(Point_2) + CGAL_Kernel_obj(Point_3) +# undef CGAL_Kernel_obj - 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; + 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; - if(!exact_v) { - return res; + 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(l)...); + return make_lazy(eto); } + // boost::optional > (Intersection_23 result types) + else if constexpr (is_optional_variant::value) + { + typedef typename Type_mapper()(std::declval::type>()...)),AK,LK>::type result_type; - internal::Fill_lazy_variant_visitor_0 visitor(res); - boost::apply_visitor(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; + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + { + Protect_FPU_rounding P; - 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; + try { + Lazy lazy(new Lazy_rep_n(AC(), EC(), l...)); - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - { - Protect_FPU_rounding P; + // the approximate result requires the trait with types from the AK + AT approx_v = lazy.approx(); + // the result we build + result_type res; - try { - Lazy lazy(new Lazy_rep_n(AC(), EC(), l1, l2, l3)); + if(!approx_v) { + // empty + return res; + } - // the approximate result requires the trait with types from the AK - AT approx_v = lazy.approx(); - // the result we build - result_type 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); + boost::apply_visitor(visitor, *approx_v); - 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); - boost::apply_visitor(visitor, *approx_v); + } 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; - } 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) { + internal::Fill_lazy_variant_visitor_0 visitor(res); + boost::apply_visitor(visitor, *exact_v); return res; } - - internal::Fill_lazy_variant_visitor_0< result_type, AK, LK, EK> visitor(res); - boost::apply_visitor(visitor, *exact_v); - return res; - } -}; - -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 typename boost::remove_cv< - typename boost::remove_reference < typename AC::result_type >::type >::type AT; - typedef typename boost::remove_cv< - typename boost::remove_reference < typename EC::result_type >::type >::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); + // ----------------------- GENERIC ----------------------- + else { - 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() ); - } - -}; + typedef typename Type_mapper()(std::declval::type>()...)),AK,LK>::type result_type; + static const bool noprune = Disable_lazy_pruning::value; -template -struct Lazy_construction -{ - static const bool Protection = true; - - typedef typename LK::Approximate_kernel AK; - 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; - }; - - 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); - { - Protect_FPU_rounding P; - try { - return result_type(Handle(new Lazy_rep_n (ac, ec, l...))); - } catch (Uncertain_conversion_exception&) {} + 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 diff --git a/Filtered_kernel/include/CGAL/Lazy_kernel.h b/Filtered_kernel/include/CGAL/Lazy_kernel.h index 08a6ebb41a0a..f96f40377ffa 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 @@ -39,62 +39,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 - : boost::integral_constant< bool, - Has_result_type_helper< typename boost::remove_cv::type>::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: @@ -129,9 +81,18 @@ class Lazy_kernel_generic_base : protected internal::Enum_holder 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; @@ -170,124 +131,31 @@ class Lazy_kernel_generic_base : protected internal::Enum_holder 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 == boost::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< typename boost::remove_cv< - typename boost::remove_reference< - typename internal::Lazy_result_type::type - >::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< boost::mpl::or_< - std::is_same< typename internal::Lazy_result_type::type, CGAL::Bbox_2 >, - std::is_same< 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 }; - - - - template < typename EK_, typename AK_, typename E2A_, typename Kernel_ > class Lazy_kernel_base : public Lazy_kernel_generic_base @@ -304,18 +172,16 @@ class Lazy_kernel_base 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 { @@ -548,7 +414,6 @@ class Lazy_kernel_base }; - struct Less_xyz_3 : public BaseClass::Less_xyz_3 { typedef typename Kernel_::Point_3 Point_3; @@ -589,14 +454,6 @@ class Lazy_kernel_base 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(); } @@ -613,6 +470,10 @@ class Lazy_kernel_base 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 9ff3aea5d1ce..000000000000 --- 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/function_objects.h b/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h index 3028950d7aff..c7aefef81978 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; + 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; + 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; + 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; + 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; + 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; - }; + public: 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 & + public: + 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; + 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; + 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; + 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/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 16e863753e2e..63bb0c0c47f2 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/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h index bdd0dff34731..48eb6acf4426 100644 --- a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h +++ b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h @@ -7562,7 +7562,7 @@ class DoIntersect_3 { 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 962bdd887425..8e9407486d38 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 ffe5c09c7d89..52abcdaf9d6b 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 921a30d2206f..ee46465e8ae9 100644 --- a/Kernel_23/include/CGAL/Circle_2.h +++ b/Kernel_23/include/CGAL/Circle_2.h @@ -102,7 +102,8 @@ class Circle_2 : public R_::Kernel_base::Circle_2 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. diff --git a/Kernel_23/include/CGAL/Circle_3.h b/Kernel_23/include/CGAL/Circle_3.h index 3030977c225c..2d63de741cf8 100644 --- a/Kernel_23/include/CGAL/Circle_3.h +++ b/Kernel_23/include/CGAL/Circle_3.h @@ -101,14 +101,14 @@ template 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 @@ template 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); } 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 4f23fa9c4e3d..000000000000 --- 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/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 85b62a46adab..c85b8f51aa93 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -45,9 +45,7 @@ namespace CommonKernelFunctors { typedef typename K::Vector_3 Vector_3; public: - typedef int result_type; - - result_type operator()(const Vector_3& vec) const + int operator()(const Vector_3& vec) const { if(certainly_not(is_zero(vec.hx()))){ return 0; @@ -73,6 +71,7 @@ namespace CommonKernelFunctors { template class Are_ordered_along_line_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Collinear_2 Collinear_2; typedef typename K::Collinear_are_ordered_along_line_2 @@ -80,16 +79,15 @@ namespace CommonKernelFunctors { Collinear_2 c; Collinear_are_ordered_along_line_2 cao; - public: - typedef typename K::Boolean result_type; + public: Are_ordered_along_line_2() {} Are_ordered_along_line_2(const Collinear_2& c_, const Collinear_are_ordered_along_line_2& cao_) : c(c_), cao(cao_) {} - result_type + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { return c(p, q, r) && cao(p, q, r); } }; @@ -97,6 +95,7 @@ namespace CommonKernelFunctors { template class Are_ordered_along_line_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Collinear_3 Collinear_3; typedef typename K::Collinear_are_ordered_along_line_3 @@ -104,16 +103,15 @@ namespace CommonKernelFunctors { Collinear_3 c; Collinear_are_ordered_along_line_3 cao; - public: - typedef typename K::Boolean result_type; + public: Are_ordered_along_line_3() {} Are_ordered_along_line_3(const Collinear_3& c_, const Collinear_are_ordered_along_line_3& cao_) : c(c_), cao(cao_) {} - result_type + Boolean operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { return c(p, q, r) && cao(p, q, r); } }; @@ -121,6 +119,7 @@ namespace CommonKernelFunctors { template class Are_strictly_ordered_along_line_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Collinear_2 Collinear_2; typedef typename K::Collinear_are_strictly_ordered_along_line_2 @@ -128,9 +127,8 @@ namespace CommonKernelFunctors { Collinear_2 c; Collinear_are_strictly_ordered_along_line_2 cao; - public: - typedef typename K::Boolean result_type; + public: Are_strictly_ordered_along_line_2() {} Are_strictly_ordered_along_line_2( const Collinear_2& c_, @@ -138,7 +136,7 @@ namespace CommonKernelFunctors { : c(c_), cao(cao_) {} - result_type + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { return c(p, q, r) && cao(p, q, r); } }; @@ -146,6 +144,7 @@ namespace CommonKernelFunctors { template class Are_strictly_ordered_along_line_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Collinear_3 Collinear_3; typedef typename K::Collinear_are_strictly_ordered_along_line_3 @@ -153,31 +152,27 @@ namespace CommonKernelFunctors { Collinear_3 c; Collinear_are_strictly_ordered_along_line_3 cao; - public: - typedef typename K::Boolean result_type; + public: Are_strictly_ordered_along_line_3() {} - Are_strictly_ordered_along_line_3( - const Collinear_3& c_, + Are_strictly_ordered_along_line_3(const Collinear_3& c_, const Collinear_are_strictly_ordered_along_line_3& cao_) : c(c_), cao(cao_) {} - result_type + Boolean operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { return c(p, q, r) && cao(p, q, r); } - }; + };; template class Assign_2 { typedef typename K::Object_2 Object_2; - public: - //typedef typename K::Boolean result_type; - typedef bool result_type; + public: template - result_type + bool operator()(T& t, const Object_2& o) const { return assign(t, o); } }; @@ -186,12 +181,10 @@ namespace CommonKernelFunctors { class Assign_3 { typedef typename K::Object_3 Object_3; - public: - //typedef typename K::Boolean result_type; - typedef bool result_type; + public: template - result_type + bool operator()(T& t, const Object_3& o) const { return assign(t, o); } }; @@ -199,13 +192,13 @@ namespace CommonKernelFunctors { template class Compare_angle_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::FT FT; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Point_3& a, const Point_3& b, const Point_3& c, const FT& cosine) const { @@ -242,13 +235,13 @@ namespace CommonKernelFunctors { template class Compare_dihedral_angle_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::FT FT; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Point_3& a1, const Point_3& b1, const Point_3& c1, const Point_3& d1, const Point_3& a2, const Point_3& b2, @@ -264,7 +257,7 @@ namespace CommonKernelFunctors { return this->operator()(ab1, ac1, ad1, ab2, ac2, ad2); } - result_type + Comparison_result operator()(const Point_3& a1, const Point_3& b1, const Point_3& c1, const Point_3& d1, const FT& cosine) const @@ -276,10 +269,9 @@ namespace CommonKernelFunctors { return this->operator()(ab1, ac1, ad1, cosine); } - result_type + Comparison_result operator()(const Vector_3& ab1, const Vector_3& ac1, const Vector_3& ad1, - const FT& cosine) - const + const FT& cosine) const { typedef typename K::FT FT; typedef typename K::Construct_cross_product_vector_3 Cross_product; @@ -318,7 +310,7 @@ namespace CommonKernelFunctors { } } - result_type + Comparison_result operator()(const Vector_3& ab1, const Vector_3& ac1, const Vector_3& ad1, const Vector_3& ab2, const Vector_3& ac2, const Vector_3& ad2) const @@ -378,8 +370,6 @@ namespace CommonKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Comparison_result Comparison_result; - typedef Comparison_result result_type; - Comparison_result operator()(const Point_3 & p, const Weighted_point_3 & q, const Weighted_point_3 & r) const @@ -398,8 +388,6 @@ namespace CommonKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::FT FT; - typedef Point_3 result_type; - Point_3 operator()(const Weighted_point_3 & p, const Weighted_point_3 & q, const Weighted_point_3 & r, @@ -440,10 +428,10 @@ namespace CommonKernelFunctors { template < class K > class Power_side_of_bounded_power_circle_2 { - public: + typedef typename K::Bounded_side Bounded_side; typedef typename K::Weighted_point_2 Weighted_point_2; - typedef Bounded_side result_type; + public: Bounded_side operator()(const Weighted_point_2& p, const Weighted_point_2& q, const Weighted_point_2& r, @@ -454,10 +442,11 @@ namespace CommonKernelFunctors { typename K::Construct_point_2 wp2p = traits.construct_point_2_object(); typename K::Power_side_of_oriented_power_circle_2 power_test = traits.power_side_of_oriented_power_circle_2_object(); + typename K::Orientation o = orientation(wp2p(p),wp2p(q),wp2p(r)); typename K::Oriented_side os = power_test(p,q,r,t); - CGAL_assertion(o != COPLANAR); + return enum_cast(o * os); } @@ -487,11 +476,10 @@ namespace CommonKernelFunctors { class Power_side_of_bounded_power_sphere_3 { public: + typedef typename K::Bounded_side Bounded_side; typedef typename K::Weighted_point_3 Weighted_point_3; typedef typename K::Sign Sign; - typedef Bounded_side result_type; - Bounded_side operator()(const Weighted_point_3 & p, const Weighted_point_3 & q, const Weighted_point_3 & r, @@ -548,10 +536,8 @@ namespace CommonKernelFunctors { class Power_side_of_oriented_power_sphere_3 { public: - typedef typename K::Weighted_point_3 Weighted_point_3; typedef typename K::Oriented_side Oriented_side; - - typedef Oriented_side result_type; + typedef typename K::Weighted_point_3 Weighted_point_3; Oriented_side operator()(const Weighted_point_3 & p, const Weighted_point_3 & q, @@ -613,11 +599,9 @@ namespace CommonKernelFunctors { { public: typedef typename K::Weighted_point_2 Weighted_point_2; - typedef typename K::FT Weight; - - typedef const Weight& result_type; - const Weight& operator()(const Weighted_point_2 & p) const + decltype(auto) + operator()(const Weighted_point_2 & p) const { return p.rep().weight(); } @@ -628,11 +612,9 @@ namespace CommonKernelFunctors { { public: typedef typename K::Weighted_point_3 Weighted_point_3; - typedef typename K::FT Weight; - typedef const Weight& result_type; - - const Weight& operator()(const Weighted_point_3 & p) const + decltype(auto) + operator()(const Weighted_point_3 & p) const { return p.rep().weight(); } @@ -645,8 +627,6 @@ namespace CommonKernelFunctors { typedef typename K::Weighted_point_2 Weighted_point_2; typedef typename K::FT FT; - typedef FT result_type; - FT operator()(const Weighted_point_2 & p, const Weighted_point_2 & q) const { @@ -662,8 +642,6 @@ namespace CommonKernelFunctors { typedef typename K::Weighted_point_3 Weighted_point_3; typedef typename K::FT FT; - typedef FT result_type; - FT operator()(const Weighted_point_3 & p, const Weighted_point_3 & q) const { @@ -679,8 +657,6 @@ namespace CommonKernelFunctors { typedef typename K::Weighted_point_2 Weighted_point_2; typedef typename K::FT FT; - typedef FT result_type; - FT operator()(const Weighted_point_2& p, const Weighted_point_2& q, const Weighted_point_2& r) const @@ -710,8 +686,6 @@ namespace CommonKernelFunctors { typedef typename K::Weighted_point_3 Weighted_point_3; typedef typename K::FT FT; - typedef FT result_type; - FT operator()(const Weighted_point_3 & p, const Weighted_point_3 & q, const Weighted_point_3 & r, @@ -754,13 +728,11 @@ namespace CommonKernelFunctors { typedef typename K::Weighted_point_3 Weighted_point_3; typedef typename K::FT FT; - typedef FT result_type; - - 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 + FT 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 { return power_distance_to_power_sphereC3 (p.x(),p.y(),p.z(),FT(p.weight()), q.x(),q.y(),q.z(),FT(q.weight()), @@ -778,9 +750,7 @@ namespace CommonKernelFunctors { typedef typename K::Comparison_result Comparison_result; typedef typename K::FT FT; - typedef Comparison_result result_type; - - Needs_FT + Needs_FT operator()(const Weighted_point_3 & p, const Weighted_point_3 & q, const Weighted_point_3 & r, @@ -795,7 +765,7 @@ namespace CommonKernelFunctors { w); } - Needs_FT + Needs_FT operator()(const Weighted_point_3 & p, const Weighted_point_3 & q, const Weighted_point_3 & r, @@ -808,7 +778,7 @@ namespace CommonKernelFunctors { w); } - Needs_FT + Needs_FT operator()(const Weighted_point_3 & p, const Weighted_point_3 & q, const FT& w) const @@ -819,8 +789,8 @@ namespace CommonKernelFunctors { w); } - result_type operator()(const Weighted_point_3 & p, - const FT& w) const + Comparison_result operator()(const Weighted_point_3 & p, + const FT& w) const { return CGAL::compare(-p.weight(), w); } @@ -829,12 +799,12 @@ namespace CommonKernelFunctors { template class Compare_slope_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::FT FT; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const + public: + Comparison_result operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { Comparison_result sign_pq = CGAL::compare(q.z(),p.z()); Comparison_result sign_rs = CGAL::compare(s.z(),r.z()); @@ -859,19 +829,19 @@ namespace CommonKernelFunctors { template class Compare_squared_distance_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::FT FT; - public: - typedef typename K::Comparison_result result_type; + public: template - Needs_FT + Needs_FT operator()(const T1& p, const T2& q, const FT& d2) const { return CGAL::compare(internal::squared_distance(p, q, K()), d2); } template - Needs_FT + Needs_FT operator()(const T1& p, const T2& q, const T3& r, const T4& s) const { return CGAL::compare(internal::squared_distance(p, q, K()), @@ -882,19 +852,19 @@ namespace CommonKernelFunctors { template class Compare_squared_distance_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::FT FT; - public: - typedef typename K::Comparison_result result_type; + public: template - Needs_FT + Needs_FT operator()(const T1& p, const T2& q, const FT& d2) const { return CGAL::compare(internal::squared_distance(p, q, K()), d2); } template - Needs_FT + Needs_FT operator()(const T1& p, const T2& q, const T3& r, const T4& s) const { return CGAL::compare(internal::squared_distance(p, q, K()), @@ -905,14 +875,12 @@ namespace CommonKernelFunctors { template class Compute_approximate_angle_3 { + typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef typename K::FT result_type; - - result_type - operator()(const Vector_3& u, const Vector_3& v) const + FT operator()(const Vector_3& u, const Vector_3& v) const { K k; typename K::Compute_scalar_product_3 scalar_product = @@ -938,7 +906,7 @@ namespace CommonKernelFunctors { } - result_type + FT operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { K k; @@ -954,11 +922,11 @@ namespace CommonKernelFunctors { template class Compute_approximate_dihedral_angle_3 { + typedef typename K::FT FT; typedef typename K::Point_3 Point_3; - public: - typedef typename K::FT result_type; - result_type + public: + FT operator()(const Point_3& a, const Point_3& b, const Point_3& c, const Point_3& d) const { K k; @@ -1024,8 +992,6 @@ namespace CommonKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Triangle_3 Triangle_3; public: - typedef FT result_type; - FT operator()( const Triangle_3& t ) const { @@ -1043,10 +1009,8 @@ namespace CommonKernelFunctors { class Compute_squared_distance_2 { typedef typename K::FT FT; - public: - typedef FT result_type; - // There are 25 combinaisons, we use a template. + public: template FT operator()( const T1& t1, const T2& t2) const @@ -1058,9 +1022,8 @@ namespace CommonKernelFunctors { { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; - public: - typedef FT result_type; + public: // There are 25 combinaisons, we use a template. template FT @@ -1083,8 +1046,6 @@ namespace CommonKernelFunctors { typedef typename K::Segment_2 Segment_2; typedef typename K::Vector_2 Vector_2; public: - typedef FT result_type; - FT operator()( const Vector_2& v) const { return CGAL_NTS square(K().compute_x_2_object()(v)) + @@ -1102,8 +1063,6 @@ namespace CommonKernelFunctors { typedef typename K::Segment_3 Segment_3; typedef typename K::Vector_3 Vector_3; public: - typedef FT result_type; - FT operator()( const Vector_3& v) const { return v.rep().squared_length(); } @@ -1116,13 +1075,10 @@ namespace CommonKernelFunctors { template class Compute_a_2 { - typedef typename K::RT RT; typedef typename K::Line_2 Line_2; public: - typedef RT result_type; - - const RT& + decltype(auto) operator()(const Line_2& l) const { return l.rep().a(); @@ -1132,13 +1088,10 @@ namespace CommonKernelFunctors { template class Compute_a_3 { - typedef typename K::RT RT; typedef typename K::Plane_3 Plane_3; public: - typedef RT result_type; - - const RT& + decltype(auto) operator()(const Plane_3& l) const { return l.rep().a(); @@ -1149,13 +1102,10 @@ namespace CommonKernelFunctors { template class Compute_b_2 { - typedef typename K::RT RT; typedef typename K::Line_2 Line_2; public: - typedef RT result_type; - - const RT& + decltype(auto) operator()(const Line_2& l) const { return l.rep().b(); @@ -1165,13 +1115,10 @@ namespace CommonKernelFunctors { template class Compute_b_3 { - typedef typename K::RT RT; typedef typename K::Plane_3 Plane_3; public: - typedef RT result_type; - - const RT& + decltype(auto) operator()(const Plane_3& l) const { return l.rep().b(); @@ -1182,13 +1129,10 @@ namespace CommonKernelFunctors { template class Compute_c_2 { - typedef typename K::RT RT; typedef typename K::Line_2 Line_2; public: - typedef RT result_type; - - const RT& + decltype(auto) operator()(const Line_2& l) const { return l.rep().c(); @@ -1198,13 +1142,10 @@ namespace CommonKernelFunctors { template class Compute_c_3 { - typedef typename K::RT RT; typedef typename K::Plane_3 Plane_3; public: - typedef RT result_type; - - const RT& + decltype(auto) operator()(const Plane_3& l) const { return l.rep().c(); @@ -1214,13 +1155,10 @@ namespace CommonKernelFunctors { template class Compute_d_3 { - typedef typename K::RT RT; typedef typename K::Plane_3 Plane_3; public: - typedef RT result_type; - - const RT& + decltype(auto) operator()(const Plane_3& l) const { return l.rep().d(); @@ -1235,8 +1173,6 @@ namespace CommonKernelFunctors { typedef typename K::Line_2 Line_2; public: - typedef FT result_type; - FT operator()(const Line_2& l, const FT& y) const { @@ -1253,8 +1189,6 @@ namespace CommonKernelFunctors { typedef typename K::Line_2 Line_2; public: - typedef FT result_type; - FT operator()(const Line_2& l, const FT& x) const { @@ -1273,8 +1207,6 @@ namespace CommonKernelFunctors { //typedef typename K::Cartesian_coordinate_type Cartesian_coordinate_type; public: - typedef FT result_type; - Cartesian_coordinate_type operator()(const Iso_rectangle_2& r) const { @@ -1291,8 +1223,6 @@ namespace CommonKernelFunctors { //typedef typename K::Cartesian_coordinate_type Cartesian_coordinate_type; public: - typedef FT result_type; - Cartesian_coordinate_type operator()(const Iso_cuboid_3& r) const { @@ -1309,8 +1239,6 @@ namespace CommonKernelFunctors { //typedef typename K::Cartesian_coordinate_type Cartesian_coordinate_type; public: - typedef FT result_type; - Cartesian_coordinate_type operator()(const Iso_rectangle_2& r) const { @@ -1327,8 +1255,6 @@ namespace CommonKernelFunctors { //typedef typename K::Cartesian_coordinate_type Cartesian_coordinate_type; public: - typedef FT result_type; - Cartesian_coordinate_type operator()(const Iso_cuboid_3& r) const { @@ -1345,8 +1271,6 @@ namespace CommonKernelFunctors { //typedef typename K::Cartesian_coordinate_type Cartesian_coordinate_type; public: - typedef FT result_type; - Cartesian_coordinate_type operator()(const Iso_rectangle_2& r) const { @@ -1363,8 +1287,6 @@ namespace CommonKernelFunctors { //typedef typename K::Cartesian_coordinate_type Cartesian_coordinate_type; public: - typedef FT result_type; - Cartesian_coordinate_type operator()(const Iso_cuboid_3& r) const { @@ -1381,8 +1303,6 @@ namespace CommonKernelFunctors { //typedef typename K::Cartesian_coordinate_type Cartesian_coordinate_type; public: - typedef FT result_type; - Cartesian_coordinate_type operator()(const Iso_rectangle_2& r) const { @@ -1399,8 +1319,6 @@ namespace CommonKernelFunctors { //typedef typename K::Cartesian_coordinate_type Cartesian_coordinate_type; public: - typedef FT result_type; - Cartesian_coordinate_type operator()(const Iso_cuboid_3& r) const { @@ -1417,8 +1335,6 @@ namespace CommonKernelFunctors { //typedef typename K::Cartesian_coordinate_type Cartesian_coordinate_type; public: - typedef FT result_type; - Cartesian_coordinate_type operator()(const Iso_cuboid_3& r) const { @@ -1435,8 +1351,6 @@ namespace CommonKernelFunctors { //typedef typename K::Cartesian_coordinate_type Cartesian_coordinate_type; public: - typedef FT result_type; - Cartesian_coordinate_type operator()(const Iso_cuboid_3& r) const { @@ -1451,9 +1365,7 @@ namespace CommonKernelFunctors { typedef typename K::Point_2 Point_2; public: - typedef FT result_type; - - result_type + FT operator()(const Point_2& p, const Point_2& q) const { @@ -1469,9 +1381,7 @@ namespace CommonKernelFunctors { typedef typename K::Point_3 Point_3; public: - typedef FT result_type; - - result_type + FT operator()(const Point_3& p, const Point_3& q) const { @@ -1486,10 +1396,9 @@ namespace CommonKernelFunctors { { typedef typename K::Point_2 Point_2; typedef typename K::Circle_2 Circle_2; - public: - typedef const Point_2& result_type; - result_type + public: + decltype(auto) operator()(const Circle_2& c) const { return c.rep().center(); } }; @@ -1500,14 +1409,13 @@ namespace CommonKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Sphere_3 Sphere_3; typedef typename K::Circle_3 Circle_3; - public: - typedef const Point_3& result_type; - result_type + public: + decltype(auto) operator()(const Sphere_3& s) const { return s.rep().center(); } - result_type + decltype(auto) operator()(const Circle_3& c) const { return c.rep().center(); } @@ -1520,9 +1428,8 @@ namespace CommonKernelFunctors { typedef typename K::Point_2 Point_2; typedef typename K::Circle_2 Circle_2; typedef typename Circle_2::Rep Rep; - public: - typedef Circle_2 result_type; + public: Rep // Circle_2 operator()( Return_base_tag, const Point_2& center, const FT& squared_radius, @@ -1640,8 +1547,6 @@ namespace CommonKernelFunctors { typedef typename Circle_3::Rep Rep; public: - typedef Circle_3 result_type; - Rep operator() (Return_base_tag, const Point_3& p, const FT& sr, const Plane_3& plane) const @@ -1724,9 +1629,8 @@ namespace CommonKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Iso_cuboid_3 Iso_cuboid_3; typedef typename Iso_cuboid_3::Rep Rep; - public: - typedef Iso_cuboid_3 result_type; + public: Rep // Iso_cuboid_3 operator()(Return_base_tag, const Point_3& p, const Point_3& q, int) const { return Rep(p, q, 0); } @@ -1785,9 +1689,8 @@ namespace CommonKernelFunctors { typedef typename K::Line_3 Line; typedef typename K::Point_3 Point; typename K::Construct_line_3 construct_line; - public: - typedef Point result_type; + public: Point operator()(const Point& l11, const Point& l12, const Point& l21, const Point& l22) const @@ -1806,17 +1709,15 @@ namespace CommonKernelFunctors { template class Construct_max_vertex_2 { - typedef typename K::Point_2 Point_2; typedef typename K::Segment_2 Segment_2; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; - public: - typedef const Point_2& result_type; - result_type + public: + decltype(auto) operator()(const Iso_rectangle_2& r) const { return (r.rep().max)(); } - result_type + decltype(auto) operator()(const Segment_2& s) const { return (s.max)(); } }; @@ -1825,37 +1726,31 @@ namespace CommonKernelFunctors { template class Construct_min_vertex_2 { - typedef typename K::Point_2 Point_2; typedef typename K::Segment_2 Segment_2; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; - public: - typedef const Point_2& result_type; - result_type + public: + decltype(auto) operator()(const Iso_rectangle_2& r) const { return (r.rep().min)(); } - result_type + decltype(auto) operator()(const Segment_2& s) const { return (s.min)(); } }; - - template class Construct_max_vertex_3 { - typedef typename K::Point_3 Point_3; typedef typename K::Segment_3 Segment_3; typedef typename K::Iso_cuboid_3 Iso_cuboid_3; - public: - typedef const Point_3& result_type; - result_type + public: + decltype(auto) operator()(const Iso_cuboid_3& r) const { return (r.rep().max)(); } - result_type + decltype(auto) operator()(const Segment_3& s) const { return (s.rep().max)(); } }; @@ -1863,17 +1758,15 @@ namespace CommonKernelFunctors { template class Construct_min_vertex_3 { - typedef typename K::Point_3 Point_3; typedef typename K::Segment_3 Segment_3; typedef typename K::Iso_cuboid_3 Iso_cuboid_3; - public: - typedef const Point_3& result_type; - result_type + public: + decltype(auto) operator()(const Iso_cuboid_3& r) const { return (r.rep().min)(); } - result_type + decltype(auto) operator()(const Segment_3& s) const { return (s.rep().min)(); } }; @@ -1883,9 +1776,8 @@ namespace CommonKernelFunctors { { typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()(const Point_3& p,const Point_3& q, const Point_3& r) const { @@ -1899,9 +1791,8 @@ namespace CommonKernelFunctors { class Construct_object_2 { typedef typename K::Object_2 Object_2; - public: - typedef Object_2 result_type; + public: template Object_2 operator()( const Cls& c) const @@ -1912,9 +1803,8 @@ namespace CommonKernelFunctors { class Construct_object_3 { typedef typename K::Object_3 Object_3; - public: - typedef Object_3 result_type; + public: template Object_3 operator()( const Cls& c) const @@ -1925,9 +1815,8 @@ namespace CommonKernelFunctors { class Construct_opposite_circle_2 { typedef typename K::Circle_2 Circle_2; - public: - typedef Circle_2 result_type; + public: Circle_2 operator()( const Circle_2& c) const { return c.opposite(); } @@ -1938,9 +1827,8 @@ namespace CommonKernelFunctors { { typedef typename K::Direction_2 Direction_2; typedef typename Direction_2::Rep Rep; - public: - typedef Direction_2 result_type; + public: Direction_2 operator()( const Direction_2& d) const { return Rep(-d.dx(), -d.dy()); } @@ -1951,9 +1839,8 @@ namespace CommonKernelFunctors { { typedef typename K::Direction_3 Direction_3; typedef typename Direction_3::Rep Rep; - public: - typedef Direction_3 result_type; + public: Direction_3 operator()( const Direction_3& d) const { return Rep(-d.dx(), -d.dy(), -d.dz()); } @@ -1963,9 +1850,8 @@ namespace CommonKernelFunctors { class Construct_opposite_line_2 { typedef typename K::Line_2 Line_2; - public: - typedef Line_2 result_type; + public: Line_2 operator()( const Line_2& l) const { return Line_2( -l.a(), -l.b(), -l.c()); } @@ -1975,9 +1861,8 @@ namespace CommonKernelFunctors { class Construct_opposite_line_3 { typedef typename K::Line_3 Line_3; - public: - typedef Line_3 result_type; + public: Line_3 operator()( const Line_3& l) const { return l.rep().opposite(); } @@ -1987,9 +1872,8 @@ namespace CommonKernelFunctors { class Construct_opposite_plane_3 { typedef typename K::Plane_3 Plane_3; - public: - typedef Plane_3 result_type; + public: Plane_3 operator()( const Plane_3& p) const { return p.rep().opposite(); } @@ -1999,9 +1883,8 @@ namespace CommonKernelFunctors { class Construct_opposite_ray_2 { typedef typename K::Ray_2 Ray_2; - public: - typedef Ray_2 result_type; + public: Ray_2 operator()( const Ray_2& r) const { return r.opposite(); } @@ -2011,9 +1894,8 @@ namespace CommonKernelFunctors { class Construct_opposite_ray_3 { typedef typename K::Ray_3 Ray_3; - public: - typedef Ray_3 result_type; + public: Ray_3 operator()( const Ray_3& r) const { return r.opposite(); } @@ -2023,9 +1905,8 @@ namespace CommonKernelFunctors { class Construct_opposite_segment_2 { typedef typename K::Segment_2 Segment_2; - public: - typedef Segment_2 result_type; + public: Segment_2 operator()( const Segment_2& s) const { return Segment_2(s.target(), s.source()); } @@ -2035,9 +1916,8 @@ namespace CommonKernelFunctors { class Construct_opposite_segment_3 { typedef typename K::Segment_3 Segment_3; - public: - typedef Segment_3 result_type; + public: Segment_3 operator()( const Segment_3& s) const { return s.rep().opposite(); } @@ -2047,9 +1927,8 @@ namespace CommonKernelFunctors { class Construct_opposite_sphere_3 { typedef typename K::Sphere_3 Sphere_3; - public: - typedef Sphere_3 result_type; + public: Sphere_3 operator()( const Sphere_3& s) const { return s.rep().opposite(); } @@ -2059,9 +1938,8 @@ namespace CommonKernelFunctors { class Construct_opposite_triangle_2 { typedef typename K::Triangle_2 Triangle_2; - public: - typedef Triangle_2 result_type; + public: Triangle_2 operator()( const Triangle_2& t) const { return Triangle_2(t.vertex(0), t.vertex(2), t.vertex(1));} @@ -2073,9 +1951,8 @@ namespace CommonKernelFunctors { typedef typename K::Line_3 Line_3; typedef typename K::Point_3 Point_3; typedef typename K::Plane_3 Plane_3; - public: - typedef Line_3 result_type; + public: Line_3 operator()( const Plane_3& pl, const Point_3& p) const { return pl.rep().perpendicular_line(p); } @@ -2087,9 +1964,8 @@ namespace CommonKernelFunctors { typedef typename K::Line_3 Line_3; 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 Line_3& l, const Point_3& p) const { return l.rep().perpendicular_plane(p); } @@ -2108,9 +1984,8 @@ namespace CommonKernelFunctors { typedef typename K::Plane_3 Plane_3; typedef typename K::Circle_3 Circle_3; typedef typename Plane_3::Rep Rep; - public: - typedef Plane_3 result_type; + public: Rep // Plane_3 operator()(Return_base_tag, const RT& a, const RT& b, const RT& c, const RT& d) const { return Rep(a, b, c, d); } @@ -2147,7 +2022,7 @@ namespace CommonKernelFunctors { operator()(Return_base_tag, const Segment_3& s, const Point_3& p) const { return Rep(s, p); } - Rep // Plane_3 + decltype(auto) operator()(Return_base_tag, const Circle_3 & c) const { return c.rep().supporting_plane(); } @@ -2179,10 +2054,9 @@ namespace CommonKernelFunctors { operator()(const Segment_3& s, const Point_3& p) const { return this->operator()(Return_base_tag(), s, p); } - Plane_3 + decltype(auto) operator()(const Circle_3 & c) const { return this->operator()(Return_base_tag(), c); } - }; template @@ -2193,9 +2067,8 @@ namespace CommonKernelFunctors { typedef typename K::Point_3 Point; typename K::Construct_plane_3 construct_plane; typename K::Construct_line_3 construct_line; - public: - typedef Point result_type; + public: Point operator()(const Point& p1, const Point& p2, const Point& p3, const Point& l1, const Point& l2) const @@ -2232,9 +2105,8 @@ namespace CommonKernelFunctors { typedef typename K::Segment_2 Segment_2; typedef typename K::Line_2 Line_2; typedef typename K::Ray_2 Ray_2; - public: - typedef Point_2 result_type; + public: Point_2 operator()( const Line_2& l, const FT i) const { return l.point(i); } @@ -2257,10 +2129,9 @@ namespace CommonKernelFunctors { typedef typename K::Line_3 Line_3; typedef typename K::Ray_3 Ray_3; typedef typename K::Plane_3 Plane_3; - public: - typedef Point_3 result_type; - const Point_3& + public: + decltype(auto) operator()( const Line_3& l) const { return l.rep().point(); } @@ -2276,7 +2147,7 @@ namespace CommonKernelFunctors { operator()( const Ray_3& r, const FT i) const { return r.rep().point(i); } - Point_3 + decltype(auto) operator()( const Plane_3& p) const { return p.rep().point(); } }; @@ -2287,9 +2158,8 @@ namespace CommonKernelFunctors { typedef typename K::Point_2 Point_2; typedef typename K::Point_3 Point_3; typedef typename K::Plane_3 Plane_3; - public: - typedef Point_2 result_type; + public: Point_2 operator()( const Plane_3& h, const Point_3& p) const { return h.rep().to_2d(p); } @@ -2304,9 +2174,8 @@ namespace CommonKernelFunctors { typedef typename K::Line_2 Line_2; typedef typename K::Ray_2 Ray_2; typedef typename Ray_2::Rep Rep; - public: - typedef Ray_2 result_type; + public: Rep // Ray_2 operator()(Return_base_tag, const Point_2& p, const Point_2& q) const { return Rep(p, q); } @@ -2350,9 +2219,8 @@ namespace CommonKernelFunctors { typedef typename K::Line_3 Line_3; typedef typename K::Ray_3 Ray_3; typedef typename Ray_3::Rep Rep; - public: - typedef Ray_3 result_type; + public: Rep // Ray_3 operator()(Return_base_tag, const Point_3& p, const Point_3& q) const { return Rep(p, q); } @@ -2393,9 +2261,8 @@ namespace CommonKernelFunctors { typedef typename K::Segment_2 Segment_2; typedef typename Segment_2::Rep Rep; typedef typename K::Point_2 Point_2; - public: - typedef Segment_2 result_type; + public: Rep // Segment_2 operator()(Return_base_tag, const Point_2& p, const Point_2& q) const { return Rep(p, q); } @@ -2411,9 +2278,8 @@ namespace CommonKernelFunctors { typedef typename K::Segment_3 Segment_3; typedef typename K::Point_3 Point_3; typedef typename Segment_3::Rep Rep; - public: - typedef Segment_3 result_type; + public: Rep // Segment_3 operator()(Return_base_tag, const Point_3& p, const Point_3& q) const { return Rep(p, q); } @@ -2423,23 +2289,18 @@ namespace CommonKernelFunctors { { return this->operator()(Return_base_tag(), p, q); } }; - - - template class Construct_source_2 { typedef typename K::Segment_2 Segment_2; typedef typename K::Ray_2 Ray_2; - typedef typename K::Point_2 Point_2; - public: - typedef const Point_2& result_type; - result_type + public: + decltype(auto) operator()(const Segment_2& s) const { return s.rep().source(); } - result_type + decltype(auto) operator()(const Ray_2& r) const { return r.rep().source(); } }; @@ -2449,15 +2310,13 @@ namespace CommonKernelFunctors { { typedef typename K::Segment_3 Segment_3; typedef typename K::Ray_3 Ray_3; - typedef typename K::Point_3 Point_3; - public: - typedef const Point_3& result_type; - result_type + public: + decltype(auto) operator()(const Segment_3& s) const { return s.rep().source(); } - result_type + decltype(auto) operator()(const Ray_3& r) const { return r.rep().source(); } }; @@ -2467,11 +2326,9 @@ namespace CommonKernelFunctors { class Construct_target_2 { typedef typename K::Segment_2 Segment_2; - typedef typename K::Point_2 Point_2; - public: - typedef const Point_2& result_type; - result_type + public: + decltype(auto) operator()(const Segment_2& s) const { return s.rep().target(); } }; @@ -2480,11 +2337,9 @@ namespace CommonKernelFunctors { class Construct_target_3 { typedef typename K::Segment_3 Segment_3; - typedef typename K::Point_3 Point_3; - public: - typedef const Point_3& result_type; - result_type + public: + decltype(auto) operator()(const Segment_3& s) const { return s.rep().target(); } }; @@ -2493,11 +2348,9 @@ namespace CommonKernelFunctors { class Construct_second_point_2 { typedef typename K::Ray_2 Ray_2; - typedef typename K::Point_2 Point_2; - public: - typedef const Point_2& result_type; - result_type + public: + decltype(auto) operator()(const Ray_2& r) const { return r.rep().second_point(); } }; @@ -2506,11 +2359,9 @@ namespace CommonKernelFunctors { class Construct_second_point_3 { typedef typename K::Ray_3 Ray_3; - typedef typename K::Point_3 Point_3; - public: - typedef Point_3 result_type; - result_type // const result_type& // Homogeneous... + public: + decltype(auto) operator()(const Ray_3& r) const { return r.rep().second_point(); } }; @@ -2523,9 +2374,8 @@ namespace CommonKernelFunctors { typedef typename K::Sphere_3 Sphere_3; typedef typename K::Circle_3 Circle_3; typedef typename Sphere_3::Rep Rep; - public: - typedef Sphere_3 result_type; + public: Rep // Sphere_3 operator()(Return_base_tag, const Point_3& center, const FT& squared_radius, Orientation orientation = COUNTERCLOCKWISE) const @@ -2551,7 +2401,7 @@ namespace CommonKernelFunctors { Orientation orientation = COUNTERCLOCKWISE) const { return Rep(center, orientation); } - Rep + decltype(auto) operator() (Return_base_tag, const Circle_3 & c) const { return c.rep().diametral_sphere(); } @@ -2580,10 +2430,9 @@ namespace CommonKernelFunctors { Orientation orientation = COUNTERCLOCKWISE) const { return this->operator()(Return_base_tag(), center, orientation); } - Sphere_3 + decltype(auto) operator() (const Circle_3 & c) const { return this->operator()(Return_base_tag(), c); } - }; template @@ -2591,10 +2440,9 @@ namespace CommonKernelFunctors { { typedef typename K::Triangle_3 Triangle_3; typedef typename K::Plane_3 Plane_3; - public: - typedef Plane_3 result_type; - Plane_3 + public: + decltype(auto) operator()( const Triangle_3& t) const { return t.rep().supporting_plane(); } @@ -2606,9 +2454,8 @@ namespace CommonKernelFunctors { typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Point_3 Point_3; typedef typename Tetrahedron_3::Rep Rep; - public: - typedef Tetrahedron_3 result_type; + public: Rep // Tetrahedron_3 operator()(Return_base_tag, const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const @@ -2626,9 +2473,8 @@ namespace CommonKernelFunctors { typedef typename K::Triangle_2 Triangle_2; typedef typename Triangle_2::Rep Rep; typedef typename K::Point_2 Point_2; - public: - typedef Triangle_2 result_type; + public: Rep // Triangle_2 operator()(Return_base_tag, const Point_2& p, const Point_2& q, const Point_2& r) const { return Rep(p, q, r); } @@ -2644,9 +2490,8 @@ namespace CommonKernelFunctors { typedef typename K::Triangle_3 Triangle_3; typedef typename K::Point_3 Point_3; typedef typename Triangle_3::Rep Rep; - public: - typedef Triangle_3 result_type; + public: Rep // Triangle_3 operator()(Return_base_tag, const Point_3& p, const Point_3& q, const Point_3& r) const { return Rep(p, q, r); } @@ -2661,9 +2506,8 @@ namespace CommonKernelFunctors { { typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()(const Point_3& p,const Point_3& q, const Point_3& r) const { @@ -2682,21 +2526,21 @@ namespace CommonKernelFunctors { typedef typename K::Iso_cuboid_3 Iso_cuboid_3; typedef typename K::Triangle_3 Triangle_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; - public: - const Point_3& + public: + decltype(auto) operator()( const Segment_3& s, int i) const { return s.rep().vertex(i); } - const Point_3& + decltype(auto) operator()( const Triangle_3& t, int i) const { return t.rep().vertex(i); } - Point_3 + decltype(auto) operator()( const Iso_cuboid_3& r, int i) const { return r.rep().vertex(i); } - const Point_3& + decltype(auto) operator()( const Tetrahedron_3& t, int i) const { return t.rep().vertex(i); } }; @@ -2710,8 +2554,6 @@ namespace CommonKernelFunctors { Cartesian_const_iterator_2; public: - typedef Cartesian_const_iterator_2 result_type; - Cartesian_const_iterator_2 operator()( const Point_2& p) const { @@ -2746,8 +2588,6 @@ namespace CommonKernelFunctors { Cartesian_const_iterator_3; public: - typedef Cartesian_const_iterator_3 result_type; - Cartesian_const_iterator_3 operator()( const Point_3& p) const { @@ -3065,16 +2905,17 @@ namespace CommonKernelFunctors { template class Coplanar_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Orientation_3 Orientation_3; + Orientation_3 o; - public: - typedef typename K::Boolean result_type; + public: Coplanar_3() {} Coplanar_3(const Orientation_3& o_) : o(o_) {} - result_type + Boolean operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { @@ -3085,11 +2926,11 @@ namespace CommonKernelFunctors { template class Counterclockwise_in_between_2 { + typedef typename K::Boolean Boolean; typedef typename K::Direction_2 Direction_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Direction_2& p, const Direction_2& q, const Direction_2& r) const { @@ -3103,12 +2944,12 @@ namespace CommonKernelFunctors { template class Do_intersect_2 { - public: - typedef typename K::Boolean result_type; + typedef typename K::Boolean Boolean; + public: // Needs_FT because Line/Line (and variations) as well as Circle_2/X compute intersections template - Needs_FT + Needs_FT operator()(const T1& t1, const T2& t2) const { return { Intersections::internal::do_intersect(t1, t2, K())}; } }; @@ -3116,17 +2957,18 @@ namespace CommonKernelFunctors { template class Do_intersect_3 { - public: - typedef typename K::Boolean result_type; + typedef typename K::Boolean Boolean; + public: template - result_type + Boolean operator()(const T1& t1, const T2& t2) const { return Intersections::internal::do_intersect(t1, t2, K()); } - result_type operator()(const typename K::Plane_3& pl1, - const typename K::Plane_3& pl2, - const typename K::Plane_3& pl3) const + Boolean + operator()(const typename K::Plane_3& pl1, + const typename K::Plane_3& pl2, + const typename K::Plane_3& pl3) const { return Intersections::internal::do_intersect(pl1, pl2, pl3, K()); } @@ -3135,6 +2977,7 @@ namespace CommonKernelFunctors { template class Equal_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; typedef typename K::Direction_2 Direction_2; @@ -3146,51 +2989,49 @@ namespace CommonKernelFunctors { typedef typename K::Circle_2 Circle_2; public: - typedef typename K::Boolean result_type; - - result_type + Boolean operator()(const Point_2 &p, const Point_2 &q) const { return p.rep() == q.rep(); } - result_type + Boolean operator()(const Vector_2 &v1, const Vector_2 &v2) const { return v1.rep() == v2.rep(); } - result_type + Boolean operator()(const Vector_2 &v, const Null_vector &n) const { return v.rep() == n; } - result_type + Boolean operator()(const Direction_2 &d1, const Direction_2 &d2) const { return d1.rep() == d2.rep(); } - result_type + Boolean operator()(const Segment_2 &s1, const Segment_2 &s2) const { return s1.source() == s2.source() && s1.target() == s2.target(); } - result_type + Boolean operator()(const Line_2 &l1, const Line_2 &l2) const { return l1.rep() == l2.rep(); } - result_type + Boolean operator()(const Ray_2& r1, const Ray_2& r2) const { return r1.source() == r2.source() && r1.direction() == r2.direction(); } - result_type + Boolean operator()(const Circle_2& c1, const Circle_2& c2) const { return c1.center() == c2.center() && @@ -3198,7 +3039,7 @@ namespace CommonKernelFunctors { c1.orientation() == c2.orientation(); } - result_type + Boolean operator()(const Triangle_2& t1, const Triangle_2& t2) const { int i; @@ -3210,7 +3051,7 @@ namespace CommonKernelFunctors { && t1.vertex(2) == t2.vertex(i+2); } - result_type + Boolean operator()(const Iso_rectangle_2& i1, const Iso_rectangle_2& i2) const { return CGAL_AND((i1.min)() == (i2.min)(), (i1.max)() == (i2.max)()); @@ -3220,6 +3061,7 @@ namespace CommonKernelFunctors { template class Equal_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::Direction_3 Direction_3; @@ -3234,82 +3076,81 @@ namespace CommonKernelFunctors { typedef typename K::Circle_3 Circle_3; public: - typedef typename K::Boolean result_type; // Point_3 is special case since the global operator== would recurse. - result_type + Boolean operator()(const Point_3 &p, const Point_3 &q) const { return CGAL_AND_3(p.x() == q.x(), p.y() == q.y(), p.z() == q.z()); } - result_type + Boolean operator()(const Plane_3 &v1, const Plane_3 &v2) const { return v1.rep() == v2.rep(); } - result_type + Boolean operator()(const Iso_cuboid_3 &v1, const Iso_cuboid_3 &v2) const { return v1.rep() == v2.rep(); } - result_type + Boolean operator()(const Sphere_3 &v1, const Sphere_3 &v2) const { return v1.rep() == v2.rep(); } - result_type + Boolean operator()(const Tetrahedron_3 &v1, const Tetrahedron_3 &v2) const { return v1.rep() == v2.rep(); } - result_type + Boolean operator()(const Triangle_3 &v1, const Triangle_3 &v2) const { return v1.rep() == v2.rep(); } - result_type + Boolean operator()(const Ray_3 &v1, const Ray_3 &v2) const { return v1.rep() == v2.rep(); } - result_type + Boolean operator()(const Line_3 &v1, const Line_3 &v2) const { return v1.rep() == v2.rep(); } - result_type + Boolean operator()(const Direction_3 &v1, const Direction_3 &v2) const { return v1.rep() == v2.rep(); } - result_type + Boolean operator()(const Segment_3 &v1, const Segment_3 &v2) const { return v1.rep() == v2.rep(); } - result_type + Boolean operator()(const Vector_3 &v1, const Vector_3 &v2) const { return v1.rep() == v2.rep(); } - result_type + Boolean operator()(const Vector_3 &v, const Null_vector &n) const { return v.rep() == n; } - result_type + Boolean operator()(const Circle_3 &v1, const Circle_3 &v2) const { return v1.rep() == v2.rep(); @@ -3319,22 +3160,22 @@ namespace CommonKernelFunctors { template class Has_on_boundary_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; typedef typename K::Circle_2 Circle_2; typedef typename K::Triangle_2 Triangle_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Circle_2& c, const Point_2& p) const { return c.has_on_boundary(p); } - result_type + Boolean operator()( const Triangle_2& t, const Point_2& p) const { return t.has_on_boundary(p); } - result_type + Boolean operator()( const Iso_rectangle_2& r, const Point_2& p) const { return K().bounded_side_2_object()(r,p) == ON_BOUNDARY; } }; @@ -3342,23 +3183,23 @@ namespace CommonKernelFunctors { template class Has_on_boundary_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Iso_cuboid_3 Iso_cuboid_3; typedef typename K::Sphere_3 Sphere_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Plane_3 Plane_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Sphere_3& s, const Point_3& p) const { return s.rep().has_on_boundary(p); } - result_type + Boolean operator()( const Tetrahedron_3& t, const Point_3& p) const { return t.rep().has_on_boundary(p); } - result_type + Boolean operator()( const Iso_cuboid_3& c, const Point_3& p) const { return c.rep().has_on_boundary(p); } @@ -3367,22 +3208,22 @@ namespace CommonKernelFunctors { template class Has_on_bounded_side_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; typedef typename K::Circle_2 Circle_2; typedef typename K::Triangle_2 Triangle_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Circle_2& c, const Point_2& p) const { return c.has_on_bounded_side(p); } - result_type + Boolean operator()( const Triangle_2& t, const Point_2& p) const { return t.has_on_bounded_side(p); } - result_type + Boolean operator()( const Iso_rectangle_2& r, const Point_2& p) const { return K().bounded_side_2_object()(r,p) == ON_BOUNDED_SIDE; } }; @@ -3390,27 +3231,27 @@ namespace CommonKernelFunctors { template class Has_on_bounded_side_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Iso_cuboid_3 Iso_cuboid_3; typedef typename K::Sphere_3 Sphere_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Circle_3 Circle_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Sphere_3& s, const Point_3& p) const { return s.has_on_bounded_side(p); } - result_type + Boolean operator()( const Tetrahedron_3& t, const Point_3& p) const { return t.rep().has_on_bounded_side(p); } - result_type + Boolean operator()( const Iso_cuboid_3& c, const Point_3& p) const { return c.rep().has_on_bounded_side(p); } - result_type + Boolean operator()(const Circle_3& c, const Point_3& p) const { CGAL_kernel_precondition( @@ -3420,7 +3261,7 @@ namespace CommonKernelFunctors { } // returns true iff the line segment ab is inside the union of the bounded sides of s1 and s2. - Needs_FT + Needs_FT operator()(const Sphere_3& s1, const Sphere_3& s2, const Point_3& a, const Point_3& b) const { @@ -3459,22 +3300,22 @@ namespace CommonKernelFunctors { template class Has_on_negative_side_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; typedef typename K::Circle_2 Circle_2; typedef typename K::Triangle_2 Triangle_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Circle_2& c, const Point_2& p) const { return c.has_on_negative_side(p); } - result_type + Boolean operator()( const Triangle_2& t, const Point_2& p) const { return t.has_on_negative_side(p); } - result_type + Boolean operator()( const Line_2& l, const Point_2& p) const { return l.has_on_negative_side(p); } }; @@ -3482,22 +3323,22 @@ namespace CommonKernelFunctors { template class Has_on_negative_side_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Plane_3 Plane_3; typedef typename K::Sphere_3 Sphere_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Sphere_3& s, const Point_3& p) const { return s.has_on_negative_side(p); } - result_type + Boolean operator()( const Tetrahedron_3& t, const Point_3& p) const { return t.rep().has_on_negative_side(p); } - result_type + Boolean operator()( const Plane_3& pl, const Point_3& p) const { return pl.rep().has_on_negative_side(p); } }; @@ -3505,22 +3346,22 @@ namespace CommonKernelFunctors { template class Has_on_positive_side_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; typedef typename K::Circle_2 Circle_2; typedef typename K::Triangle_2 Triangle_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Circle_2& c, const Point_2& p) const { return c.has_on_positive_side(p); } - result_type + Boolean operator()( const Triangle_2& t, const Point_2& p) const { return t.has_on_positive_side(p); } - result_type + Boolean operator()( const Line_2& l, const Point_2& p) const { return l.has_on_positive_side(p); } }; @@ -3528,22 +3369,22 @@ namespace CommonKernelFunctors { template class Has_on_positive_side_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Plane_3 Plane_3; typedef typename K::Sphere_3 Sphere_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Sphere_3& s, const Point_3& p) const { return s.has_on_positive_side(p); } - result_type + Boolean operator()( const Tetrahedron_3& t, const Point_3& p) const { return t.rep().has_on_positive_side(p); } - result_type + Boolean operator()( const Plane_3& pl, const Point_3& p) const { return pl.rep().has_on_positive_side(p); } }; @@ -3551,22 +3392,22 @@ namespace CommonKernelFunctors { template class Has_on_unbounded_side_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; typedef typename K::Circle_2 Circle_2; typedef typename K::Triangle_2 Triangle_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Circle_2& c, const Point_2& p) const { return c.has_on_unbounded_side(p); } - result_type + Boolean operator()( const Triangle_2& t, const Point_2& p) const { return t.has_on_unbounded_side(p); } - result_type + Boolean operator()( const Iso_rectangle_2& r, const Point_2& p) const { return K().bounded_side_2_object()(r,p)== ON_UNBOUNDED_SIDE; @@ -3577,27 +3418,27 @@ namespace CommonKernelFunctors { template class Has_on_unbounded_side_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Iso_cuboid_3 Iso_cuboid_3; typedef typename K::Sphere_3 Sphere_3; typedef typename K::Circle_3 Circle_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Sphere_3& s, const Point_3& p) const { return s.has_on_unbounded_side(p); } - result_type + Boolean operator()( const Tetrahedron_3& t, const Point_3& p) const { return t.rep().has_on_unbounded_side(p); } - result_type + Boolean operator()( const Iso_cuboid_3& c, const Point_3& p) const { return c.rep().has_on_unbounded_side(p); } - result_type + Boolean operator()(const Circle_3& c, const Point_3& p) const { CGAL_kernel_precondition( @@ -3610,22 +3451,22 @@ namespace CommonKernelFunctors { template class Has_on_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_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 Line_2& l, const Point_2& p) const { return l.has_on(p); } - result_type + Boolean operator()( const Ray_2& r, const Point_2& p) const { return r.has_on(p); } - result_type + Boolean operator()( const Segment_2& s, const Point_2& p) const { return s.has_on(p); } }; @@ -3634,8 +3475,6 @@ namespace CommonKernelFunctors { class Intersect_2 { public: - - // 25 possibilities, so I keep the template. template typename CGAL::Intersection_traits::result_type operator()(const T1& t1, const T2& t2) const @@ -3646,9 +3485,8 @@ namespace CommonKernelFunctors { class Intersect_3 { typedef typename K::Plane_3 Plane_3; - public: - // n possibilities, so I keep the template. + public: template typename CGAL::Intersection_traits::result_type operator()(const T1& t1, const T2& t2) const @@ -3690,6 +3528,7 @@ namespace CommonKernelFunctors { template class Is_degenerate_2 { + typedef typename K::Boolean Boolean; typedef typename K::Circle_2 Circle_2; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; typedef typename K::Line_2 Line_2; @@ -3697,34 +3536,33 @@ namespace CommonKernelFunctors { typedef typename K::Segment_2 Segment_2; typedef typename K::Triangle_2 Triangle_2; typedef typename K::Circle_3 Circle_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Circle_2& c) const { return c.is_degenerate(); } - result_type + Boolean operator()( const Iso_rectangle_2& r) const { return (r.xmin() == r.xmax()) || (r.ymin() == r.ymax()); } - result_type + Boolean operator()( const Line_2& l) const { return CGAL_NTS is_zero(l.a()) && CGAL_NTS is_zero(l.b()); } - result_type + Boolean operator()( const Ray_2& r) const { return r.rep().is_degenerate(); } - result_type + Boolean operator()( const Segment_2& s) const { return s.source() == s.target(); } - result_type + Boolean operator()( const Triangle_2& t) const { return t.is_degenerate(); } - result_type + Boolean operator()( const Circle_3& c) const { return c.rep().is_degenerate(); } }; @@ -3732,6 +3570,7 @@ namespace CommonKernelFunctors { template class Is_degenerate_3 { + typedef typename K::Boolean Boolean; typedef typename K::Iso_cuboid_3 Iso_cuboid_3; typedef typename K::Line_3 Line_3; typedef typename K::Circle_3 Circle_3; @@ -3741,42 +3580,41 @@ namespace CommonKernelFunctors { typedef typename K::Sphere_3 Sphere_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 Iso_cuboid_3& c) const { return c.rep().is_degenerate(); } - result_type + Boolean operator()( const Line_3& l) const { return l.rep().is_degenerate(); } - result_type + Boolean operator()( const Plane_3& pl) const { return pl.rep().is_degenerate(); } - result_type + Boolean operator()( const Ray_3& r) const { return r.rep().is_degenerate(); } - result_type + Boolean operator()( const Segment_3& s) const { return s.rep().is_degenerate(); } - result_type + Boolean operator()( const Sphere_3& s) const { return s.rep().is_degenerate(); } - result_type + Boolean operator()( const Triangle_3& t) const { return t.rep().is_degenerate(); } - result_type + Boolean operator()( const Tetrahedron_3& t) const { return t.rep().is_degenerate(); } - result_type + Boolean operator()( const Circle_3& t) const { return t.rep().is_degenerate(); } @@ -3785,21 +3623,21 @@ namespace CommonKernelFunctors { template class Is_horizontal_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 + public: + Boolean operator()( const Line_2& l) const { return CGAL_NTS is_zero(l.a()); } - result_type + Boolean operator()( const Segment_2& s) const { return s.is_horizontal(); } - result_type + Boolean operator()( const Ray_2& r) const { return r.is_horizontal(); } }; @@ -3807,21 +3645,21 @@ namespace CommonKernelFunctors { template class Is_vertical_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 + public: + Boolean operator()( const Line_2& l) const { return CGAL_NTS is_zero(l.b()); } - result_type + Boolean operator()( const Segment_2& s) const { return s.is_vertical(); } - result_type + Boolean operator()( const Ray_2& r) const { return r.is_vertical(); } }; @@ -3829,16 +3667,17 @@ namespace CommonKernelFunctors { template class Left_turn_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; + public: Left_turn_2() {} Left_turn_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) == LEFT_TURN; } }; @@ -3846,22 +3685,23 @@ namespace CommonKernelFunctors { template class Less_rotate_ccw_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Orientation_2 Orientation_2; typedef typename K::Collinear_are_ordered_along_line_2 + Collinear_are_ordered_along_line_2; Orientation_2 o; Collinear_are_ordered_along_line_2 co; - public: - typedef typename K::Boolean result_type; + public: Less_rotate_ccw_2() {} Less_rotate_ccw_2(const Orientation_2& o_, const Collinear_are_ordered_along_line_2& co_) : o(o_), co(co_) {} - result_type + Boolean operator()(const Point_2& r, const Point_2& p, const Point_2& q) const { typename K::Orientation ori = o(r, p, q); @@ -3888,23 +3728,23 @@ namespace CommonKernelFunctors { typedef typename K::Plane_3 Plane_3; typedef typename K::Sphere_3 Sphere_3; public: - typedef typename K::Oriented_side result_type; + typedef typename K::Oriented_side Oriented_side; - result_type + Oriented_side operator()( const Sphere_3& s, const Point_3& p) const { return s.rep().oriented_side(p); } - result_type + Oriented_side operator()( const Plane_3& pl, const Point_3& p) const { return pl.rep().oriented_side(p); } - result_type + Oriented_side operator()( const Point_3& plane_pt, const Vector_3& plane_normal, const Point_3& query) const { return typename K::Construct_plane_3()(plane_pt, plane_normal).rep().oriented_side(query); } - result_type + Oriented_side operator()( const Tetrahedron_3& t, const Point_3& p) const { return t.rep().oriented_side(p); } }; @@ -3918,9 +3758,7 @@ class Construct_weighted_circumcenter_2 typedef typename K::Point_2 Point_2; typedef typename K::FT FT; - typedef Point_2 result_type; - - result_type operator() (const Weighted_point_2 & p, + Point_2 operator() (const Weighted_point_2 & p, const Weighted_point_2 & q, const Weighted_point_2 & r) const { diff --git a/Kernel_23/include/CGAL/Kernel/global_functions_2.h b/Kernel_23/include/CGAL/Kernel/global_functions_2.h index e974eae730dc..41f61a47f2cb 100644 --- a/Kernel_23/include/CGAL/Kernel/global_functions_2.h +++ b/Kernel_23/include/CGAL/Kernel/global_functions_2.h @@ -44,7 +44,7 @@ operator!=(const Point_2 &p, const Origin& o) template < class K > inline -Angle +typename K::Angle angle(const Vector_2 &u, const Vector_2 &v) { @@ -53,7 +53,7 @@ angle(const Vector_2 &u, template < class K > inline -Angle +typename K::Angle angle(const Point_2 &p, const Point_2 &q, const Point_2 &r) @@ -63,7 +63,7 @@ angle(const Point_2 &p, template < class K > inline -Angle +typename K::Angle angle(const Point_2 &p, const Point_2 &q, const Point_2 &r, @@ -764,7 +764,9 @@ midpoint(const Point_2 &p, const Point_2 &q) } template < class K > -inline typename K::Point_2 midpoint(const Segment_2 &s) +inline +typename K::Point_2 +midpoint(const Segment_2 &s) { return internal::midpoint(s, K()); } diff --git a/Kernel_23/include/CGAL/Kernel/global_functions_3.h b/Kernel_23/include/CGAL/Kernel/global_functions_3.h index e17211e184be..ac6a2f3f2757 100644 --- a/Kernel_23/include/CGAL/Kernel/global_functions_3.h +++ b/Kernel_23/include/CGAL/Kernel/global_functions_3.h @@ -28,7 +28,7 @@ namespace CGAL { template inline -Angle +typename K::Angle angle(const Vector_3 &u, const Vector_3 &v) { return internal::angle(u, v, K()); @@ -36,7 +36,7 @@ angle(const Vector_3 &u, const Vector_3 &v) template inline -Angle +typename K::Angle angle(const Point_3 &p, const Point_3 &q, const Point_3 &r) { return internal::angle(p, q, r, K()); @@ -44,7 +44,7 @@ angle(const Point_3 &p, const Point_3 &q, const Point_3 &r) template inline -Angle +typename K::Angle angle(const Point_3 &p, const Point_3 &q, const Point_3 &r, const Point_3 &s) { @@ -53,7 +53,7 @@ angle(const Point_3 &p, const Point_3 &q, template inline -Angle +typename K::Angle angle(const Point_3 &p, const Point_3 &q, const Point_3 &r, const Vector_3 &v) { @@ -206,7 +206,7 @@ bisector(const Plane_3 &h1, const Plane_3 &h2) template < class K > inline -Point_3 +typename K::Point_3 centroid(const Point_3 &p, const Point_3 &q, const Point_3 &r, const Point_3 &s) { @@ -215,7 +215,7 @@ centroid(const Point_3 &p, const Point_3 &q, template < class K > inline -Point_3 +typename K::Point_3 centroid(const Point_3 &p, const Point_3 &q, const Point_3 &r) { return internal::centroid(p, q, r, K()); @@ -223,7 +223,7 @@ centroid(const Point_3 &p, const Point_3 &q, const Point_3 &r) template < class K > inline -Point_3 +typename K::Point_3 centroid(const Tetrahedron_3 &t) { return internal::centroid(t, K()); @@ -231,7 +231,7 @@ centroid(const Tetrahedron_3 &t) template < class K > inline -Point_3 +typename K::Point_3 centroid(const Triangle_3 &t) { return internal::centroid(t, K()); diff --git a/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_3.h b/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_3.h index 9f9896ac7eb3..6339a1c14123 100644 --- a/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_3.h +++ b/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_3.h @@ -90,9 +90,11 @@ template class Construct_bbox_projected_2 { public: typedef typename R::Point_3 Point; - typedef Bbox_2 result_type; - Bbox_2 operator()(const Point& p) const { typename R::Construct_bbox_3 bb; return Projector::bbox(bb(p)); } + Bbox_2 operator()(const Point& p) const { + typename R::Construct_bbox_3 bb; + return Projector::bbox(bb(p)); + } }; template @@ -254,22 +256,23 @@ template class Compare_signed_distance_to_line_projected_3 { public: + typedef typename R::Comparison_result Comparison_result; typedef typename R::Point_3 Point_3; typedef typename R::Point_2 Point_2; typedef typename R::FT RT; + typename R::FT x(const Point_3 &p) const { return Projector::x(p); } typename R::FT y(const Point_3 &p) const { return Projector::y(p); } - typedef typename R::Comparison_result result_type; Point_2 project(const Point_3& p) const { return Point_2(x(p),y(p)); } - result_type operator()(const Point_3& p, - const Point_3& q, - const Point_3& r, - const Point_3& s) const + Comparison_result operator()(const Point_3& p, + const Point_3& q, + const Point_3& r, + const Point_3& s) const { return typename R::Compare_signed_distance_to_line_2() ( project(p), project(q), project(r), project(s) ); @@ -280,22 +283,23 @@ template class Less_signed_distance_to_line_projected_3 { public: + typedef typename R::Boolean Boolean; typedef typename R::Point_3 Point_3; typedef typename R::Point_2 Point_2; typedef typename R::FT RT; + typename R::FT x(const Point_3 &p) const { return Projector::x(p); } typename R::FT y(const Point_3 &p) const { return Projector::y(p); } - typedef typename R::Boolean result_type; Point_2 project(const Point_3& p) const { return Point_2(x(p),y(p)); } - result_type operator()(const Point_3& p, - const Point_3& q, - const Point_3& r, - const Point_3& s) const + Boolean operator()(const Point_3& p, + const Point_3& q, + const Point_3& r, + const Point_3& s) const { return typename R::Less_signed_distance_to_line_2() ( project(p), project(q), project(r), project(s) ); @@ -313,6 +317,7 @@ class Squared_distance_projected_3 typedef typename R::Segment_3 Segment_3; typedef typename R::Segment_2 Segment_2; typedef typename R::FT RT; + typename R::FT x(const Point_3 &p) const { return Projector::x(p); } typename R::FT y(const Point_3 &p) const { return Projector::y(p); } @@ -597,8 +602,6 @@ class Compute_squared_length_projected_3 typedef typename R::Vector_3 Vector_3; typedef typename R::FT FT; - typedef FT result_type; - FT x(const Vector_3 &v) const { return Projector::x(v); } FT y(const Vector_3 &v) const { return Projector::y(v); } @@ -972,8 +975,8 @@ class Projection_traits_3 struct Less_xy_2 { - typedef typename R::Boolean result_type; - bool operator()(const Point_2& p, const Point_2& q) const + typedef typename R::Boolean Boolean; + Boolean operator()(const Point_2& p, const Point_2& q) const { Compare_x_2 cx; Comparison_result crx = cx(p,q); @@ -986,8 +989,8 @@ class Projection_traits_3 struct Less_yx_2 { - typedef typename R::Boolean result_type; - bool operator()(const Point_2& p, const Point_2& q) const + typedef typename R::Boolean Boolean; + Boolean operator()(const Point_2& p, const Point_2& q) const { Compare_y_2 cy; Comparison_result cry = cy(p,q); @@ -999,8 +1002,8 @@ class Projection_traits_3 }; struct Equal_2 { - typedef typename R::Boolean result_type; - bool operator()(const Point_2& p, const Point_2& q) const + typedef typename R::Boolean Boolean; + Boolean operator()(const Point_2& p, const Point_2& q) const { Equal_x_2 eqx; @@ -1010,8 +1013,8 @@ class Projection_traits_3 }; struct Left_turn_2 { - typedef typename R::Boolean result_type; - bool operator()(const Point_2& p, const Point_2& q, const Point_2& r) const + typedef typename R::Boolean Boolean; + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { Orientation_2 ori; @@ -1020,7 +1023,7 @@ class Projection_traits_3 }; struct Collinear_2 { - typedef typename R::Boolean result_type; + typedef typename R::Boolean Boolean; bool operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { Orientation_2 ori; diff --git a/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_base_3.h b/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_base_3.h index 42c3bc318592..385d036f34e5 100644 --- a/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_base_3.h +++ b/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_base_3.h @@ -34,7 +34,6 @@ class Projected_orientation_with_normal_3 typedef typename Traits::Vector_3 Vector_3; public: typedef typename K::Orientation Orientation; - typedef Orientation result_type; Projected_orientation_with_normal_3(const Vector_3& normal_) : normal(normal_) @@ -69,7 +68,6 @@ class Projected_side_of_oriented_circle_with_normal_3 public: typedef typename K::Oriented_side Oriented_side; - typedef Oriented_side result_type; Projected_side_of_oriented_circle_with_normal_3(const Vector_3& normal_) : normal(normal_) @@ -307,6 +305,7 @@ template class Less_along_axis { // private members + typedef typename Traits::Boolean Boolean; typedef typename Traits::Vector_3 Vector_3; typedef typename Traits::Point_2 Point; Vector_3 base; @@ -317,9 +316,7 @@ class Less_along_axis CGAL_TIME_PROFILER("Construct Less_along_axis") } - typedef bool result_type; - - bool operator() (const Point &p, const Point &q) const { + Boolean operator() (const Point &p, const Point &q) const { return base * (p - q) < 0; } }; // end class Less_along_axis @@ -328,6 +325,7 @@ template class Compare_along_axis { // private members + typedef typename Traits::Comparison_result Comparison_result; typedef typename Traits::Vector_3 Vector_3; typedef typename Traits::Point_2 Point; Vector_3 base; @@ -338,8 +336,6 @@ class Compare_along_axis CGAL_TIME_PROFILER("Construct Compare_along_axis") } - typedef Comparison_result result_type; - Comparison_result operator() (const Point &p, const Point &q) const { return compare(base * (p - q), 0); } @@ -349,6 +345,7 @@ template class Less_xy_along_axis { // private members + typedef typename Traits::Boolean Boolean; typedef typename Traits::Vector_3 Vector_3; typedef typename Traits::Point_2 Point; Vector_3 base1, base2; @@ -359,9 +356,7 @@ class Less_xy_along_axis CGAL_TIME_PROFILER("Construct Less_xy_along_axis") } - typedef bool result_type; - - bool operator() (const Point &p, const Point &q) const { + Boolean operator() (const Point &p, const Point &q) const { Compare_along_axis cx(base1); Comparison_result crx = cx(p, q); diff --git a/Kernel_23/include/CGAL/Sphere_3.h b/Kernel_23/include/CGAL/Sphere_3.h index 310303fed645..bfa06651322c 100644 --- a/Kernel_23/include/CGAL/Sphere_3.h +++ b/Kernel_23/include/CGAL/Sphere_3.h @@ -96,7 +96,7 @@ class Sphere_3 : public R_::Kernel_base::Sphere_3 return R().construct_center_3_object()(*this); } - FT + decltype(auto) squared_radius() const { return R().compute_squared_radius_3_object()(*this); diff --git a/Kernel_23/include/CGAL/enum.h b/Kernel_23/include/CGAL/enum.h index a27ff99662d0..679759041e16 100644 --- a/Kernel_23/include/CGAL/enum.h +++ b/Kernel_23/include/CGAL/enum.h @@ -21,8 +21,6 @@ #include #include -// If you add/change one type here, please update Is_a_predicate.h as well. - namespace CGAL { enum Sign diff --git a/Kernel_23/include/CGAL/predicates/sign_of_determinant.h b/Kernel_23/include/CGAL/predicates/sign_of_determinant.h index bdb7fd1425aa..5543772cfb3a 100644 --- a/Kernel_23/include/CGAL/predicates/sign_of_determinant.h +++ b/Kernel_23/include/CGAL/predicates/sign_of_determinant.h @@ -30,6 +30,7 @@ typename Sgn::result_type sign_of_determinant( const RT& a00, const RT& a01, const RT& a10, const RT& a11) { + typedef typename Sgn::result_type Sign; return enum_cast(CGAL_NTS compare( a00*a11, a10*a01)); } diff --git a/Kernel_23/test/Kernel_23/Exact_predicates_exact_constructions_kernel.cpp b/Kernel_23/test/Kernel_23/Exact_predicates_exact_constructions_kernel.cpp index b3ed4921e7a2..7f197eb54a20 100644 --- a/Kernel_23/test/Kernel_23/Exact_predicates_exact_constructions_kernel.cpp +++ b/Kernel_23/test/Kernel_23/Exact_predicates_exact_constructions_kernel.cpp @@ -7,18 +7,76 @@ #endif #include -int main(){ +#include "CGAL/_test_cls_kernel.h" +#define TEST_FILENAME "Test-Cartesian-IO.out" +#include "CGAL/_test_io.h" +#include "CGAL/_test_2.h" +#include "CGAL/_test_3.h" - typedef CGAL::Exact_predicates_exact_constructions_kernel EPEK; - CGAL_USE_TYPE(EPEK); +#include "CGAL/_test_new_2.h" +#include "CGAL/_test_new_3.h" + +#include "CGAL/_test_fct_points_implicit_sphere.h" +#include "CGAL/_test_orientation_and_bounded_side.h" +#include "CGAL/_test_fct_constructions_2.h" +#include "CGAL/_test_fct_constructions_3.h" +#include "CGAL/_test_fct_point_3.h" +#include "CGAL/_test_fct_coplanar_3.h" +#include "CGAL/_test_cls_iso_cuboid_3.h" +#include "CGAL/_test_angle.h" +#include "CGAL/_test_cls_circle_3.h" + +#include "CGAL/_test_mf_plane_3_to_2d.h" + +template +void test() +{ + CGAL_USE_TYPE(K); + + std::cout << "Testing nested types with:" << typeid(K).name() << std::endl; + _test_kernel( K() ); + + std::cout << "Testing IO with:" << typeid(K).name() << std::endl; + _test_io( K() ); + + std::cout << "Testing 2d with:" << typeid(K).name() << std::endl; + _test_2( K() ); + + std::cout << "Testing 3d with:" << typeid(K).name() << std::endl; + _test_3( K() ); + _test_cls_circle_3( K() ); + + std::cout << "Testing new 2d with:" << typeid(K).name() << std::endl; + test_new_2( K() ); + _test_cls_new_2( K() ); + + std::cout << "Testing new 3d with:" << typeid(K).name() << std::endl; + test_new_3( K() ); + + std::cout << "Testing new parts with:" << typeid(K).name() << std::endl; + _test_orientation_and_bounded_side( K() ); + _test_fct_points_implicit_sphere( K() ); + _test_fct_constructions_2( K() ); + _test_fct_constructions_3( K() ); + _test_fct_point_3( K() ); + _test_fct_coplanar_3( K() ); + _test_cls_iso_cuboid_3( K() ); + _test_angle( K() ); + + std::cout << "Testing 3d-2d with:" << typeid(K).name() << std::endl; + _test_mf_plane_3_to_2d( K() ); + + std::cout << "All tests done" << std::endl; +} + +int main() +{ + test(); #if defined(CGAL_USE_CORE) || defined(CGAL_USE_LEDA) - typedef CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt EPEKS; - typedef CGAL::Exact_predicates_exact_constructions_kernel_with_kth_root EPEKK; - typedef CGAL::Exact_predicates_exact_constructions_kernel_with_root_of EPEKR; - CGAL_USE_TYPE(EPEKS); - CGAL_USE_TYPE(EPEKK); - CGAL_USE_TYPE(EPEKR); + test(); + test(); + test(); #endif return 0; diff --git a/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp b/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp index 4ba639640509..0315ea3ea2fc 100644 --- a/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp +++ b/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp @@ -47,6 +47,7 @@ #include "CGAL/_test_fct_coplanar_3.h" #include "CGAL/_test_cls_iso_cuboid_3.h" #include "CGAL/_test_angle.h" +#include "CGAL/_test_cls_circle_3.h" #include "CGAL/_test_mf_plane_3_to_2d.h" @@ -59,6 +60,9 @@ main() typedef CGAL::Cartesian Clsdb; typedef CGAL::Filtered_kernel Clsd; + std::cout << "Testing IO with F_k>:" << std::endl; + _test_io( Clsd() ); + // typedef CGAL::Cartesian > Clsb; // typedef CGAL::Cartesian > Clsb; // typedef CGAL::Filtered_kernel Cls; @@ -69,11 +73,11 @@ main() // "Testing with Filtered_kernel>>:" "Testing with Exact_predicates_exact_constructions_kernel:" << std::endl; - std::cout << "Testing IO with F_k>:" << std::endl; - _test_io( Clsd() ); + std::cout << "Testing with Epeck:\n"; test(); + std::cout << "Testing with Double_precision_epick:\n"; test(); @@ -81,8 +85,10 @@ main() # pragma warning(push) # pragma warning(disable: 4244) # endif + std::cout << "Testing with Simple_precision_epick:\n"; test(); + # if defined(BOOST_MSVC) # pragma warning(pop) # endif @@ -92,6 +98,9 @@ main() template void test() { + std::cout << "Testing IO :" << std::endl; + _test_io( Cls() ); + std::cout << "Testing 2d :"; std::cout << std::endl; _test_2( Cls() ); @@ -99,14 +108,17 @@ void test() { std::cout << "Testing 3d :"; std::cout << std::endl; _test_3( Cls() ); + _test_cls_circle_3( Cls() ); std::cout << "Testing new 2d :"; std::cout << std::endl; test_new_2( Cls() ); + _test_cls_new_2( Cls() ); std::cout << "Testing new 3d :"; std::cout << std::endl; test_new_3( Cls() ); + _test_cls_circle_3( Cls() ); std::cout << "Testing new parts :"; std::cout << std::endl; @@ -122,4 +134,6 @@ void test() { std::cout << "Testing 3d-2d :"; std::cout << std::endl; _test_mf_plane_3_to_2d( Cls() ); + + std::cout << "Done Testing " << typeid(Cls).name() << std::endl; } diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_approx_equal.h b/Kernel_23/test/Kernel_23/include/CGAL/_approx_equal.h index 3cae842a0cd5..ee29e1fc07da 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_approx_equal.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_approx_equal.h @@ -1,5 +1,6 @@ #ifndef CGAL_TESTSUITE_APPROX_EQUAL_H #define CGAL_TESTSUITE_APPROX_EQUAL_H + #include namespace CGAL { diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_circle_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_circle_3.h index 8ba7b49a9819..7fa489cde5f3 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_circle_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_circle_3.h @@ -17,8 +17,11 @@ #ifndef CGAL__TEST_CLS_CIRCLE_3_H #define CGAL__TEST_CLS_CIRCLE_3_H +#include "_approx_equal.h" + #include #include + #include // Some predicates and constructions tests related to the class Circle_3 are done here @@ -33,9 +36,11 @@ void _test_bounding_box_construct(const K &k) typedef typename K::Plane_3 Plane_3; typedef typename K::Sphere_3 Sphere_3; typedef typename K::Circle_3 Circle_3; + typedef typename K::Construct_bbox_3 Construct_bbox_3; typedef typename K::Construct_circle_3 Construct_circle_3; typedef CGAL::Bbox_3 Bbox_3; + Construct_bbox_3 bbox = k.construct_bbox_3_object(); Construct_circle_3 theConstruct_circle_3 = k.construct_circle_3_object(); std::cout << "Testing the bbox of Circle_3..." << std::endl; @@ -44,7 +49,7 @@ void _test_bounding_box_construct(const K &k) Circle_3 c; c = theConstruct_circle_3(Point_3(0,0,0), 1, Plane_3(1, 0, 0, 0)); - b = c.bbox(); + b = bbox(c); assert(b.xmin() <= 0.001); assert(b.xmax() >= -0.001); assert(b.ymin() <= -0.999); @@ -53,7 +58,7 @@ void _test_bounding_box_construct(const K &k) assert(b.zmax() >= 0.999); c = theConstruct_circle_3(Sphere_3(Point_3(0,0,0), 1), Plane_3(1, 0, 0, -FT(1)/FT(2))); - b = c.bbox(); + b = bbox(c); assert(b.xmin() <= 0.501); assert(b.xmax() >= 0.499); assert(b.ymin() <= (-std::sqrt(0.5)+0.001)); @@ -72,10 +77,14 @@ void _test_circle_construct(const K &k) { typedef typename K::Sphere_3 Sphere_3; typedef typename K::Equal_3 Equal_3; typedef typename K::Construct_circle_3 Construct_circle_3; + typedef typename K::Construct_center_3 Construct_center_3; typedef typename K::Compute_squared_distance_3 Compute_squared_distance_3; + const bool nonexact = std::is_floating_point::value; + Equal_3 theEqual_3 = k.equal_3_object(); Construct_circle_3 theConstruct_circle_3 = k.construct_circle_3_object(); + Construct_center_3 center = k.construct_center_3_object(); Compute_squared_distance_3 squared_distance = k.compute_squared_distance_3_object(); CGAL::Random generatorOfgenerator; @@ -117,48 +126,53 @@ void _test_circle_construct(const K &k) { const FT sqr = FT(r); const Point_3 p = Point_3(x,y,z); Circle_3 circle = theConstruct_circle_3(p,sqr,plane); - assert(circle.supporting_plane().a() == a); assert(circle.supporting_plane().b() == b); assert(circle.supporting_plane().c() == c); assert(circle.supporting_plane().d() == d); - assert(circle.center().x() == x); - assert(circle.center().y() == y); - assert(circle.center().z() == z); + const Point_3 ctr = center(circle); + assert(ctr.x() == x); + assert(ctr.y() == y); + assert(ctr.z() == z); assert(circle.squared_radius() == sqr); Circle_3 circle2 = theConstruct_circle_3(p,sqr,plane2); Circle_3 circle3 = theConstruct_circle_3(p,sqr,Vector_3(a,b,c)); assert(theEqual_3(circle,circle2)); - assert(theEqual_3(circle,circle3)); - Plane_3 pus(circle2); - Sphere_3 sus(circle3); - assert(pus == circle2.supporting_plane()); - assert(sus == circle3.diametral_sphere()); + if(CGAL::is_zero(a*x+b*y*c*z+d)) { // for EPICK + assert(theEqual_3(circle,circle3)); + } + + Plane_3 pus(circle2); + Sphere_3 sus(circle3); + assert(pus == circle2.supporting_plane()); + assert(sus == circle3.diametral_sphere()); } Point_3 p1, p2, p3; p1 = Point_3(1,0,0); p2 = Point_3(0,1,0); p3 = Point_3(0,0,1); - Circle_3 c = theConstruct_circle_3(p1, p2, p3); - FT r1 = squared_distance(c.center(), p1); - FT r2 = squared_distance(c.center(), p2); - FT r3 = squared_distance(c.center(), p3); - assert(r1 == r2); - assert(r2 == r3); - assert(r3 == c.squared_radius()); - - p1 = Point_3(1.3,0.2,0.1); - p2 = Point_3(0.57,1.23,3.0); - p3 = Point_3(9,1.2,1.3); - c = theConstruct_circle_3(p1, p2, p3); - r1 = squared_distance(c.center(), p1); - r2 = squared_distance(c.center(), p2); - r3 = squared_distance(c.center(), p3); - assert(r1 == r2); - assert(r2 == r3); - assert(r3 == c.squared_radius()); + Circle_3 c = theConstruct_circle_3(p1, p2, p3); + FT r1 = squared_distance(center(c), p1); + FT r2 = squared_distance(center(c), p2); + FT r3 = squared_distance(center(c), p3); + assert(r1 == r2); + assert(r2 == r3); + assert(r3 == c.squared_radius()); + + if (!nonexact) { + p1 = Point_3(1.3,0.2,0.1); + p2 = Point_3(0.57,1.23,3.0); + p3 = Point_3(9,1.2,1.3); + c = theConstruct_circle_3(p1, p2, p3); + r1 = squared_distance(center(c), p1); + r2 = squared_distance(center(c), p2); + r3 = squared_distance(center(c), p3); + assert(CGAL::testsuite::approx_equal(r1,r2)); + assert(CGAL::testsuite::approx_equal(r2,r3)); + assert(CGAL::testsuite::approx_equal(r3,c.squared_radius())); + } // No need to test the constructors based on intersection // _test_intersect_construct will test it @@ -176,6 +190,8 @@ void _test_construct_radical_plane(const K &k) { typedef typename K::Construct_sphere_3 Construct_sphere_3; typedef typename K::Construct_radical_plane_3 Construct_radical_plane_3; + const bool nonexact = std::is_floating_point::value; + Intersect_3 theIntersect_3 = k.intersect_3_object(); Construct_sphere_3 theConstruct_sphere_3 = k.construct_sphere_3_object(); Construct_radical_plane_3 theConstruct_radical_plane_3 = k.construct_radical_plane_3_object(); @@ -212,13 +228,18 @@ void _test_construct_radical_plane(const K &k) { else if((d2 == (r+1)*(r+1)) || (d2 == (r-1)*(r-1))) { Point_3 interp; assert(assign(interp, intersection_1)); - assert(theHas_on_3(p, interp)); + + if(!nonexact) { + assert(theHas_on_3(p, interp)); + } } // 1 Intersection Circle else { Circle_3 circle1; assert(assign(circle1, intersection_1)); - assert(theHas_on_3(p, circle1)); + if(!nonexact) { + assert(theHas_on_3(p, circle1)); + } } } } diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_circle_new_2.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_circle_new_2.h index 1ffde6486f2b..6e0ff29f6487 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_circle_new_2.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_circle_new_2.h @@ -20,7 +20,7 @@ template bool -_test_cls_circle_new_2(const R& ) +_test_cls_circle_new_2(const R& r) { std::cout << "Testing class Circle_2"; @@ -33,9 +33,11 @@ _test_cls_circle_new_2(const R& ) typedef typename R::Circle_2 Circle_2; typedef typename R::Aff_transformation_2 Aff_transformation_2; - typename R::Construct_vector_2 construct_vector; - typename R::Construct_point_2 construct_point; - typename R::Construct_translated_point_2 construct_translated_point; + const bool nonexact = std::is_floating_point::value; + + typename R::Construct_vector_2 construct_vector = r.construct_vector_2_object(); + typename R::Construct_point_2 construct_point = r.construct_point_2_object(); + typename R::Construct_translated_point_2 construct_translated_point = r.construct_translated_point_2_object(); typename R::Circle_2 ic; Circle_2 c0; // af: CGAL::Circle_2 c0; @@ -130,6 +132,11 @@ _test_cls_circle_new_2(const R& ) std::cout << '.'; + if(nonexact) { + std::cout << "done" << std::endl; + return true; + } + Aff_transformation_2 rotate1(CGAL::ROTATION,Direction_2(n11,n13),-n2,n12), rotate2(CGAL::ROTATION,Direction_2(-n8, n9),-n2,n12), diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_fct_weighted_point_2.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_fct_weighted_point_2.h index f43e41ce597a..2b53241f0f89 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_fct_weighted_point_2.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_fct_weighted_point_2.h @@ -152,8 +152,6 @@ _test_fct_weighted_point_2(const R& ) assert( CGAL::squared_radius_smallest_orthogonal_circle(wp3, wp8) == RT(1) ); assert( CGAL::squared_radius_smallest_orthogonal_circle(wp1_b, wp3_b) == RT(-3)); - std::cout << CGAL::weighted_circumcenter(wp_00, wp_10, wp_01) << std::endl; - using CGAL::testsuite::approx_equal; assert( approx_equal(CGAL::squared_radius_smallest_orthogonal_circle(wp1, wp3, wp5), CGAL::squared_radius(p1, p3, p5)) ); diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h index 5c3a64287d28..f8540555c82e 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h @@ -22,6 +22,8 @@ namespace CGAL { namespace SFA { // static filter adapter // Note that this would be quite a bit simpler without stateful kernels template struct Adapter_2 { + typedef typename Get_type::type Orientation; + typedef typename Get_type::type Oriented_side; typedef typename Get_type::type Point; typedef typename Get_functor::type CC; typedef typename Get_functor::type Orientation_base; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Types/Weighted_point.h b/NewKernel_d/include/CGAL/NewKernel_d/Types/Weighted_point.h index 6e970a5f13ae..9d0516468712 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Types/Weighted_point.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Types/Weighted_point.h @@ -272,7 +272,7 @@ template struct Power_side_of_bounded_power_circumsphere : private Sto typename Get_functor::type pd(this->kernel()); // ON_UNBOUNDED_SIDE = -1 - return enum_cast(-CGAL::sign(pd(pc(f, e), p0))); + return enum_cast(-CGAL::sign(pd(pc(f, e), p0))); } }; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h b/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h index 1cfaaa4893b2..2e6277190601 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h @@ -787,7 +787,7 @@ template struct Side_of_bounded_circumsphere : private Store_kernel::type cc(this->kernel()); typename Get_functor::type cd(this->kernel()); - return enum_cast(cd(cc(f, e), *f, p0)); + return enum_cast(cd(cc(f, e), *f, p0)); } }; } diff --git a/STL_Extension/doc/STL_Extension/CGAL/Uncertain.h b/STL_Extension/doc/STL_Extension/CGAL/Uncertain.h index bc3f39d92b5a..0dfa921bdb0a 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/Uncertain.h +++ b/STL_Extension/doc/STL_Extension/CGAL/Uncertain.h @@ -500,7 +500,7 @@ Uncertain operator-(Uncertain u); returns the extension of the `enum_cast` function over `u`. */ template -Uncertain enum_cast(Uncertain u); +T enum_cast(Uncertain u); /// @} diff --git a/STL_Extension/include/CGAL/Uncertain.h b/STL_Extension/include/CGAL/Uncertain.h index 5e5003a5d5bb..348a65f0f7da 100644 --- a/STL_Extension/include/CGAL/Uncertain.h +++ b/STL_Extension/include/CGAL/Uncertain.h @@ -624,13 +624,22 @@ Uncertain operator*(Uncertain a, T b) return a * Uncertain(b); } +// SFINAE helper to check if a type is Uncertain +template +struct Is_Uncertain : std::false_type {}; + +template +struct Is_Uncertain > : std::true_type {}; + // enum_cast overload template < typename T, typename U > inline -Uncertain enum_cast(Uncertain u) +T enum_cast(Uncertain u) { - return Uncertain(static_cast(u.inf()), static_cast(u.sup())); + static_assert(CGAL::Is_Uncertain::value, "T must be an Uncertain type"); + typedef typename T::value_type Tv; + return { enum_cast(u.inf()), enum_cast(u.sup()) }; } } //namespace CGAL diff --git a/STL_Extension/test/STL_Extension/test_Uncertain.cpp b/STL_Extension/test/STL_Extension/test_Uncertain.cpp index c8ab98676338..138210b2879a 100644 --- a/STL_Extension/test/STL_Extension/test_Uncertain.cpp +++ b/STL_Extension/test/STL_Extension/test_Uncertain.cpp @@ -348,10 +348,10 @@ void test_enum_cast() typedef CGAL::Uncertain Ua; Us s; - Ub b = CGAL::enum_cast(s); - Ua a = CGAL::enum_cast(s); + Ub b = CGAL::enum_cast(s); + Ua a = CGAL::enum_cast(s); CGAL_USE(a); - s = CGAL::enum_cast(b); + s = CGAL::enum_cast(b); } int main()