From ee451ed4690882cd95459515562f8f6d5ff03dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sat, 2 Nov 2024 22:13:50 +0100 Subject: [PATCH 01/68] Fix dangling reference in Construct_center_3(Circle_3) This fixes the issue, but it could still be broken e.g. by a kernel that is based on a CGAL kernel, but redefines the Sphere_3 and with Sphere_3-functor that would not return a const& (or in that case the custom kernel needs to define the appropriate functors too...) But so much breaks into this configuration, that it's out of scope for this fix. --- Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h | 2 +- Kernel_23/include/CGAL/Circle_3.h | 6 +++--- Kernel_23/include/CGAL/Kernel/function_objects.h | 8 +++----- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h index de200ba3e4b..acec780f6ce 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h @@ -130,7 +130,7 @@ public: return diametral_sphere(); } - Point_3 center() const + decltype(auto) center() const { return diametral_sphere().center(); } diff --git a/Kernel_23/include/CGAL/Circle_3.h b/Kernel_23/include/CGAL/Circle_3.h index 3030977c225..3f57d4c3973 100644 --- a/Kernel_23/include/CGAL/Circle_3.h +++ b/Kernel_23/include/CGAL/Circle_3.h @@ -101,14 +101,14 @@ public: return typename R::Construct_sphere_3()(*this); } - Point_3 center() const + decltype(auto) center() const { - return typename R::Construct_sphere_3()(*this).center(); + return diametral_sphere().center(); } FT squared_radius() const { - return typename R::Construct_sphere_3()(*this).squared_radius(); + return diametral_sphere().squared_radius(); } decltype(auto) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 85b62a46ada..4aaef448227 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -2523,9 +2523,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 +2550,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 +2579,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 From dd2fca2780bcf378c6442eb6cfe818333fa6b878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sun, 3 Nov 2024 18:15:51 +0100 Subject: [PATCH 02/68] Actually test the full EPECK family --- ..._predicates_exact_constructions_kernel.cpp | 76 ++++++++++++++++--- 1 file changed, 67 insertions(+), 9 deletions(-) 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 b3ed4921e7a..7f197eb54a2 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; From 425fe50276bee3121039f9d5cde77b6210ac3cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sun, 3 Nov 2024 20:53:06 +0100 Subject: [PATCH 03/68] Add missing tests for filtered Cartesian kernels --- .../test/Kernel_23/Filtered_cartesian.cpp | 18 ++- .../Kernel_23/include/CGAL/_approx_equal.h | 1 + .../include/CGAL/_test_cls_circle_3.h | 108 +++++++++++------- .../include/CGAL/_test_cls_circle_new_2.h | 15 ++- 4 files changed, 93 insertions(+), 49 deletions(-) diff --git a/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp b/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp index 4ba63964050..0315ea3ea2f 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 3cae842a0cd..ee29e1fc07d 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 8ba7b49a981..b6881c86d1e 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; @@ -99,66 +108,72 @@ void _test_circle_construct(const K &k) { do { r = theRandom.get_int(random_min,random_max); } while(r <= 0); - if(a != 0) { - x = FT(-(b*u + c*v + d))/FT(a); - y = FT(u); - z = FT(v); - } else if(b != 0) { - x = FT(u); - y = FT(-(a*u + c*v + d))/FT(b); - z = FT(v); - } else { - x = FT(u); - y = FT(v); - z = FT(-(a*u + b*v + d))/FT(c); - } + CGAL::point_on_planeC3(a, b, c, d, x, y, z); + // if(a != 0) { + // x = FT(-(b*u + c*v + d))/FT(a); + // y = FT(u); + // z = FT(v); + // } else if(b != 0) { + // x = FT(u); + // y = FT(-(a*u + c*v + d))/FT(b); + // z = FT(v); + // } else { + // x = FT(u); + // y = FT(v); + // z = FT(-(a*u + b*v + d))/FT(c); + // } const Plane_3 plane = Plane_3(a,b,c,d); const Plane_3 plane2 = Plane_3(2*a,2*b,2*c,2*d); 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()); + 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()); - 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()); + 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 +191,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 +229,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 1ffde6486f2..6e0ff29f648 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), From 69c9abafe0a3cca57309cc4ea82521063ea15063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sun, 3 Nov 2024 20:53:24 +0100 Subject: [PATCH 04/68] Remove obsolete debug cout --- .../test/Kernel_23/include/CGAL/_test_fct_weighted_point_2.h | 2 -- 1 file changed, 2 deletions(-) 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 f43e41ce597..2b53241f0f8 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)) ); From b32491ad5993357ccc3b6969e22e4a66e9ba3386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sun, 3 Nov 2024 21:06:31 +0100 Subject: [PATCH 05/68] Revert sidechange --- .../include/CGAL/_test_cls_circle_3.h | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) 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 b6881c86d1e..7fa489cde5f 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 @@ -108,20 +108,19 @@ void _test_circle_construct(const K &k) { do { r = theRandom.get_int(random_min,random_max); } while(r <= 0); - CGAL::point_on_planeC3(a, b, c, d, x, y, z); - // if(a != 0) { - // x = FT(-(b*u + c*v + d))/FT(a); - // y = FT(u); - // z = FT(v); - // } else if(b != 0) { - // x = FT(u); - // y = FT(-(a*u + c*v + d))/FT(b); - // z = FT(v); - // } else { - // x = FT(u); - // y = FT(v); - // z = FT(-(a*u + b*v + d))/FT(c); - // } + if(a != 0) { + x = FT(-(b*u + c*v + d))/FT(a); + y = FT(u); + z = FT(v); + } else if(b != 0) { + x = FT(u); + y = FT(-(a*u + c*v + d))/FT(b); + z = FT(v); + } else { + x = FT(u); + y = FT(v); + z = FT(-(a*u + b*v + d))/FT(c); + } const Plane_3 plane = Plane_3(a,b,c,d); const Plane_3 plane2 = Plane_3(2*a,2*b,2*c,2*d); const FT sqr = FT(r); From 181ccd2275de208d0f9cd86a047b44e568a7c644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 6 Nov 2024 11:25:47 +0100 Subject: [PATCH 06/68] More instances of result_type --> dcltype(auto) --- .../include/CGAL/Cartesian/Circle_3.h | 4 +-- .../include/CGAL/Cartesian/function_objects.h | 35 +++++++------------ Kernel_23/include/CGAL/Circle_3.h | 4 +-- .../include/CGAL/Kernel/function_objects.h | 22 +++++------- Kernel_23/include/CGAL/Sphere_3.h | 2 +- 5 files changed, 27 insertions(+), 40 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h index acec780f6ce..47d45e0e113 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h @@ -135,7 +135,7 @@ public: return diametral_sphere().center(); } - FT squared_radius() const + decltype(auto) squared_radius() const { return diametral_sphere().squared_radius(); } @@ -155,7 +155,7 @@ public: return CGAL_PI * CGAL_PI * 4.0 * to_double(squared_radius()); } - FT area_divided_by_pi() const + decltype(auto) area_divided_by_pi() const { return squared_radius(); } diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index 737a52dfc14..ab740590345 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -1053,13 +1053,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(); } @@ -1189,31 +1185,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 +1215,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 +1239,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 +1250,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 { diff --git a/Kernel_23/include/CGAL/Circle_3.h b/Kernel_23/include/CGAL/Circle_3.h index 3f57d4c3973..2d63de741cf 100644 --- a/Kernel_23/include/CGAL/Circle_3.h +++ b/Kernel_23/include/CGAL/Circle_3.h @@ -106,7 +106,7 @@ public: return diametral_sphere().center(); } - FT squared_radius() const + decltype(auto) squared_radius() const { return diametral_sphere().squared_radius(); } @@ -122,7 +122,7 @@ public: return typename R::Construct_bbox_3()(*this); } - FT area_divided_by_pi() const + decltype(auto) area_divided_by_pi() const { return typename R::Compute_area_divided_by_pi_3()(*this); } diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 4aaef448227..3ac11a476ec 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -1486,10 +1486,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 +1499,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(); } @@ -2108,9 +2106,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 +2144,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,7 +2176,7 @@ 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); } @@ -2257,9 +2254,8 @@ 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; + public: const Point_3& operator()( const Line_3& l) const { return l.rep().point(); } diff --git a/Kernel_23/include/CGAL/Sphere_3.h b/Kernel_23/include/CGAL/Sphere_3.h index 310303fed64..bfa06651322 100644 --- a/Kernel_23/include/CGAL/Sphere_3.h +++ b/Kernel_23/include/CGAL/Sphere_3.h @@ -96,7 +96,7 @@ public: return R().construct_center_3_object()(*this); } - FT + decltype(auto) squared_radius() const { return R().compute_squared_radius_3_object()(*this); From b02776b504fd8cacac787ff7f002b840156967fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 6 Nov 2024 11:26:50 +0100 Subject: [PATCH 07/68] Remove wrong result_type (WIP: does not compile anymore) --- Kernel_23/include/CGAL/Kernel/function_objects.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 3ac11a476ec..89c15f606eb 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -1120,8 +1120,6 @@ namespace CommonKernelFunctors { typedef typename K::Line_2 Line_2; public: - typedef RT result_type; - const RT& operator()(const Line_2& l) const { @@ -1136,8 +1134,6 @@ namespace CommonKernelFunctors { typedef typename K::Plane_3 Plane_3; public: - typedef RT result_type; - const RT& operator()(const Plane_3& l) const { @@ -1153,8 +1149,6 @@ namespace CommonKernelFunctors { typedef typename K::Line_2 Line_2; public: - typedef RT result_type; - const RT& operator()(const Line_2& l) const { @@ -1169,8 +1163,6 @@ namespace CommonKernelFunctors { typedef typename K::Plane_3 Plane_3; public: - typedef RT result_type; - const RT& operator()(const Plane_3& l) const { @@ -1186,8 +1178,6 @@ namespace CommonKernelFunctors { typedef typename K::Line_2 Line_2; public: - typedef RT result_type; - const RT& operator()(const Line_2& l) const { @@ -1202,8 +1192,6 @@ namespace CommonKernelFunctors { typedef typename K::Plane_3 Plane_3; public: - typedef RT result_type; - const RT& operator()(const Plane_3& l) const { @@ -1218,8 +1206,6 @@ namespace CommonKernelFunctors { typedef typename K::Plane_3 Plane_3; public: - typedef RT result_type; - const RT& operator()(const Plane_3& l) const { From 0d452b7cbd18123bb8a364a814799fac2c8a9f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 12 Nov 2024 14:52:52 +0100 Subject: [PATCH 08/68] Remove extra parenthesis --- Circular_kernel_3/doc/Circular_kernel_3/Circular_kernel_3.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Circular_kernel_3/doc/Circular_kernel_3/Circular_kernel_3.txt b/Circular_kernel_3/doc/Circular_kernel_3/Circular_kernel_3.txt index 937d438332f..5f5ca1dc107 100644 --- a/Circular_kernel_3/doc/Circular_kernel_3/Circular_kernel_3.txt +++ b/Circular_kernel_3/doc/Circular_kernel_3/Circular_kernel_3.txt @@ -24,7 +24,7 @@ for which we refer the user to the \ref chapterkernel23 "2D and 3D Linear Kernel \section sectionSKobjects Spherical Kernel Objects New main geometric objects are introduced by `Spherical_kernel_3`: -circular arcs ((model of `SphericalKernel::CircularArc_3`), points +circular arcs (model of `SphericalKernel::CircularArc_3`), points of circular arcs (model of `SphericalKernel::CircularArcPoint_3`), and line segments (model of `SphericalKernel::LineArc_3`) whose endpoints are points of this new type. From dcb38f3151a512a998077e5e68121aaa54f25695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 12 Nov 2024 14:53:03 +0100 Subject: [PATCH 09/68] Fix broken doc link --- Circular_kernel_3/doc/Circular_kernel_3/dependencies | 1 + 1 file changed, 1 insertion(+) diff --git a/Circular_kernel_3/doc/Circular_kernel_3/dependencies b/Circular_kernel_3/doc/Circular_kernel_3/dependencies index bc945e6454c..47c71fadee2 100644 --- a/Circular_kernel_3/doc/Circular_kernel_3/dependencies +++ b/Circular_kernel_3/doc/Circular_kernel_3/dependencies @@ -1,3 +1,4 @@ +Algebraic_foundations Circular_kernel_2 Kernel_23 Number_types From a052572103af84853774db0d46971ba9cded37fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 12 Dec 2024 17:14:44 +0100 Subject: [PATCH 10/68] Remove unused functor Last used in: a214d62 (2012-12-06) --- Filtered_kernel/include/CGAL/Lazy.h | 64 ----------------------------- 1 file changed, 64 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 5d7b22ec37b..8b13a0d98f3 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -1635,70 +1635,6 @@ public: } }; - -// 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 { From ea9c2a3a6cd75b43e31b0ce103a3231431d70993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 12 Dec 2024 17:20:49 +0100 Subject: [PATCH 11/68] Remove unused functors last used: 369498d (2011-07-06) --- Filtered_kernel/include/CGAL/Lazy.h | 111 ---------------------------- 1 file changed, 111 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 8b13a0d98f3..53207a20287 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -1524,117 +1524,6 @@ public: }; - -// This is the magic functor for functors that write their result in a reference argument -// In a first version we assume that the references are of type Lazy, -// and that the result type is void - -template -struct Lazy_functor_2_1 -{ - static const bool Protection = true; - typedef void result_type; - - CGAL_NO_UNIQUE_ADDRESS AC ac; - CGAL_NO_UNIQUE_ADDRESS EC ec; - -public: - - template - void - operator()(const L1& l1, const L2& l2, R1& r1) const - { - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - { - Protect_FPU_rounding P; - try { - // we suppose that R1 is a Lazy - r1 = R1(new Lazy_rep_2_1(ac, ec, l1, l2)); - return; - } catch (Uncertain_conversion_exception&) {} - } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - typename R1::ET et; - ec(CGAL::exact(l1), CGAL::exact(l2), et); - r1 = R1(new Lazy_rep_0(et)); - } -}; - - -template -struct First -{ - typedef typename T::first_type result_type; - - const typename T::first_type& - operator()(const T& p) const - { - return p.first; - } - }; - -template -struct Second -{ - typedef typename T::second_type result_type; - - const typename T::second_type& - operator()(const T& p) const - { - return p.second; - } -}; - -// This is the magic functor for functors that write their result in a reference argument -// In a first version we assume that the references are of type Lazy, -// and that the result type is void - -//template -template -struct Lazy_functor_2_2 -{ - static const bool Protection = true; - - typedef void result_type; - typedef typename LK::Approximate_kernel AK; - typedef typename LK::Exact_kernel EK; - typedef typename LK::E2A E2A; - - CGAL_NO_UNIQUE_ADDRESS AC ac; - CGAL_NO_UNIQUE_ADDRESS EC ec; - -public: - - template - void - operator()(const L1& l1, const L2& l2, R1& r1, R2& r2) const - { - typedef Lazy Handle_1; - typedef Lazy Handle_2; - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - { - Protect_FPU_rounding P; - try { - typedef Lazy, std::pair, E2A> Lazy_pair; - Lazy_pair lv(new Lazy_rep_2_2(ac, ec, l1, l2)); - // lv->approx() is a std::pair; - r1 = R1(Handle_1(new Lazy_rep_n >, First >, E2A, false, Lazy_pair>(First >(), First >(), lv))); - r2 = R2(Handle_2(new Lazy_rep_n >, Second >, E2A, false, Lazy_pair>(Second >(), Second >(), lv))); - return; - } catch (Uncertain_conversion_exception&) {} - } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - typename R1::ET et1, et2; - ec(CGAL::exact(l1), CGAL::exact(l2), et1, et2); - r1 = R1(Handle_1(new Lazy_rep_0(et1))); - r2 = R2(Handle_2(new Lazy_rep_0(et2))); - } -}; - template struct Object_cast { From 8524c6a3cf740a328615e880cda2f89f0e0b1866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 12 Dec 2024 17:22:09 +0100 Subject: [PATCH 12/68] Remove unused functors See commit a052572 --- Filtered_kernel/include/CGAL/Lazy.h | 44 ----------------------------- 1 file changed, 44 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 53207a20287..e1eb20dcefd 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -1378,50 +1378,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 { From abc4fe6bf83dcad4e8da375429dd6cd8e4a14043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 17 Dec 2024 15:48:23 +0100 Subject: [PATCH 13/68] Remove unused Lazy_rep objects --- Filtered_kernel/include/CGAL/Lazy.h | 211 ---------------------------- 1 file changed, 211 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index e1eb20dcefd..88f5bbd3a3c 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 From db1fa6dfac5e8f6576fd8af308999bc509032ef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 17 Dec 2024 15:49:29 +0100 Subject: [PATCH 14/68] Factorize Lazy_construction_object into a single operator() --- Filtered_kernel/include/CGAL/Lazy.h | 106 ++++------------------------ 1 file changed, 15 insertions(+), 91 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 88f5bbd3a3c..f1ba7fc9277 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -1284,9 +1284,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 { @@ -1305,16 +1302,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(); @@ -1328,112 +1324,40 @@ public: #include - std::cerr << "object_cast inside Lazy_construction_rep::operator() failed. It needs more else if's (#1)" << std::endl; - std::cerr << "dynamic type of the Object : " << lo.approx().type().name() << std::endl; - - return Object(); - } catch (Uncertain_conversion_exception&) {} - } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - ET eto = ec(CGAL::exact(l1)); - return make_lazy(eto); - } - - template - decltype(auto) - operator()(const L1& l1, const L2& l2) const - { - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - { - Protect_FPU_rounding P; - try { - Lazy_object lo(new Lazy_rep_n(ac, ec, l1, l2)); - - if(lo.approx().is_empty()) - return Object(); - - #define CGAL_Kernel_obj(X) \ - if (object_cast(& (lo.approx()))) { \ - typedef Lazy_rep_n, Object_cast, E2A, false, Lazy_object> Lcr; \ - Lcr * lcr = new Lcr(Object_cast(), Object_cast(), lo); \ - return make_object(typename LK::X(lcr)); \ - } - - #include - // We now check vector - - #define CGAL_Kernel_obj(X) \ - { \ - const std::vector* v_ptr;\ +#define CGAL_Kernel_obj(X) \ + { \ + const std::vector* v_ptr; \ if ( (v_ptr = object_cast >(& (lo.approx()))) ) { \ - std::vector V;\ - V.resize(v_ptr->size()); \ - for (unsigned int i = 0; i < v_ptr->size(); i++) { \ + std::vector V; \ + V.resize(v_ptr->size()); \ + for (unsigned int i = 0; i < v_ptr->size(); i++) { \ V[i] = typename LK::X(new Lazy_rep_n, \ Ith_for_intersection, E2A, false, Lazy_object> \ (Ith_for_intersection(i), Ith_for_intersection(i), lo)); \ - } \ - return make_object(V); \ + } \ + return make_object(V); \ }\ } - CGAL_Kernel_obj(Point_2) - CGAL_Kernel_obj(Point_3) - #undef CGAL_Kernel_obj +CGAL_Kernel_obj(Point_2) +CGAL_Kernel_obj(Point_3) +#undef CGAL_Kernel_obj std::cerr << "object_cast inside Lazy_construction_rep::operator() failed. It needs more else if's (#1)" << std::endl; std::cerr << "dynamic type of the Object : " << lo.approx().type().name() << std::endl; - } catch (Uncertain_conversion_exception&) {} - return Object(); - } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - ET eto = ec(CGAL::exact(l1), CGAL::exact(l2)); - return make_lazy(eto); - } - - template - decltype(auto) - operator()(const L1& l1, const L2& l2, const L3& l3) const - { - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - { - Protect_FPU_rounding P; - try { - Lazy_object lo(new Lazy_rep_n(ac, ec, l1, l2, l3)); - - if(lo.approx().is_empty()) - return Object(); - - #define CGAL_Kernel_obj(X) \ - if (object_cast(& (lo.approx()))) { \ - typedef Lazy_rep_n, Object_cast, E2A, false, Lazy_object> Lcr; \ - Lcr * lcr = new Lcr(Object_cast(), Object_cast(), lo); \ - return make_object(typename LK::X(lcr)); \ - } - - #include - - std::cerr << "object_cast inside Lazy_construction_rep::operator() failed. It needs more else if's (#1)" << std::endl; - std::cerr << "dynamic type of the Object : " << lo.approx().type().name() << std::endl; return Object(); } catch (Uncertain_conversion_exception&) {} } CGAL_BRANCH_PROFILER_BRANCH(tmp); Protect_FPU_rounding P2(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - ET eto = ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3)); + ET eto = ec(CGAL::exact(l)...); return make_lazy(eto); } }; - - //____________________________________________________________ // The magic functor that has Lazy as result type. // Two versions are distinguished: one that needs to fiddle From 7f1e16d8da70115c446eacb063385d17dc202eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 17 Dec 2024 22:07:35 +0100 Subject: [PATCH 15/68] Factorize operator()s of Lazy_construction_variant --- Filtered_kernel/include/CGAL/Lazy.h | 69 ++++------------------------- 1 file changed, 8 insertions(+), 61 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index f1ba7fc9277..ab56f1f1c50 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -1484,26 +1484,27 @@ struct Lazy_construction_variant { typedef typename Type_mapper()(std::declval::type>()...)),AK,LK>::type type; }; - template + template decltype(auto) - operator()(const L1& l1, const L2& l2) const { + operator()(const L&... l) const + { + typedef typename result::type result_type; - 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; + typedef decltype(std::declval()(CGAL::approx(l)...)) AT; + typedef decltype(std::declval()( CGAL::exact(l)...)) ET; CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); { Protect_FPU_rounding P; try { - Lazy lazy(new Lazy_rep_n(AC(), EC(), l1, l2)); + Lazy lazy(new Lazy_rep_n(AC(), EC(), l...)); // the approximate result requires the trait with types from the AK AT approx_v = lazy.approx(); @@ -1525,7 +1526,7 @@ struct Lazy_construction_variant { 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)); + ET exact_v = EC()(CGAL::exact(l)...); result_type res; if(!exact_v) { @@ -1536,60 +1537,6 @@ struct Lazy_construction_variant { 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; - - typedef decltype(std::declval()(CGAL::approx(l1), CGAL::approx(l2), CGAL::approx(l3))) AT; - typedef decltype(std::declval()( CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3))) ET; - - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - { - Protect_FPU_rounding P; - - try { - Lazy lazy(new Lazy_rep_n(AC(), EC(), l1, l2, l3)); - - // the approximate result requires the trait with types from the AK - AT approx_v = lazy.approx(); - // the result we build - result_type res; - - if(!approx_v) { - // empty - return res; - } - - // the static visitor fills the result_type with the correct unwrapped type - internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy > visitor(res, lazy); - boost::apply_visitor(visitor, *approx_v); - - return res; - } catch (Uncertain_conversion_exception&) {} - } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - ET exact_v = EC()(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3)); - result_type res; - - if(!exact_v) { - return res; - } - - internal::Fill_lazy_variant_visitor_0< result_type, AK, LK, EK> visitor(res); - boost::apply_visitor(visitor, *exact_v); - return res; - } }; template Date: Tue, 17 Dec 2024 22:32:28 +0100 Subject: [PATCH 16/68] Remove unused functor --- Filtered_kernel/include/CGAL/Lazy.h | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index ab56f1f1c50..7570d0c706f 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -1185,33 +1185,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 { From 9188e8adc4c81a29913ccca91155fecc7927c73e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 17 Dec 2024 22:47:13 +0100 Subject: [PATCH 17/68] Fix name: polygonal_envelope > polyhedral_envelope --- Filtered_kernel/include/CGAL/Lazy.h | 2 +- Filtered_kernel/include/CGAL/Lazy_kernel.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 7570d0c706f..071a6f57241 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -1004,7 +1004,7 @@ struct Lazy_construction_bbox 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; diff --git a/Filtered_kernel/include/CGAL/Lazy_kernel.h b/Filtered_kernel/include/CGAL/Lazy_kernel.h index 08a6ebb41a0..0cf7f4f2596 100644 --- a/Filtered_kernel/include/CGAL/Lazy_kernel.h +++ b/Filtered_kernel/include/CGAL/Lazy_kernel.h @@ -258,7 +258,7 @@ private: template struct Select_wrapper_impl { template - struct apply { typedef Lazy_construction_optional_for_polygonal_envelope type; }; + struct apply { typedef Lazy_construction_optional_for_polyhedral_envelope type; }; }; template From 9d10860b27d64e5002cd2d929b718d6a1241d562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 18 Dec 2024 12:01:04 +0100 Subject: [PATCH 18/68] Use a single Lazy_construction class Within the operator(), we do mostly what was done in separate functors before, but can now be done in the same function because even though the return type (deduced by decltype(auto)) is not the same for each 'if' block, the C++17 constexpr allows different return types in the different blocks. Not only we factorize code, but we do not have to use result_types anymore, and we can get the true result_type thanks to decltype() on the actual functor + parameters call. --- Filtered_kernel/include/CGAL/Lazy.h | 335 +++++++++++---------- Filtered_kernel/include/CGAL/Lazy_kernel.h | 21 +- 2 files changed, 194 insertions(+), 162 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 071a6f57241..8e5b22c3fa2 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -1333,8 +1333,6 @@ CGAL_Kernel_obj(Point_3) //____________________________________________________________ // 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) @@ -1436,142 +1434,24 @@ struct Fill_lazy_variant_visitor_0 : boost::static_visitor<> { } // internal -template -struct Lazy_construction_variant { - static const bool Protection = true; - - typedef typename LK::Approximate_kernel AK; - typedef typename LK::Exact_kernel EK; - typedef typename LK::E2A E2A; - - - template - struct result { - // this does not default, if you want to make a lazy lazy-kernel, - // you are on your own - }; - - template - struct result - { - typedef typename Type_mapper()(std::declval::type>()...)),AK,LK>::type type; - }; - - template - decltype(auto) - operator()(const L&... l) 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(l)...)) AT; - typedef decltype(std::declval()( CGAL::exact(l)...)) ET; - - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - { - Protect_FPU_rounding P; - - try { - Lazy lazy(new Lazy_rep_n(AC(), EC(), l...)); - - // the approximate result requires the trait with types from the AK - AT approx_v = lazy.approx(); - // the result we build - result_type res; - - if(!approx_v) { - // empty - return res; - } - - // the static visitor fills the result_type with the correct unwrapped type - internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy > visitor(res, lazy); - boost::apply_visitor(visitor, *approx_v); - - return res; - } catch (Uncertain_conversion_exception&) {} - } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - ET exact_v = EC()(CGAL::exact(l)...); - result_type res; - - if(!exact_v) { - return res; - } - - internal::Fill_lazy_variant_visitor_0 visitor(res); - boost::apply_visitor(visitor, *exact_v); - return res; - } +template +struct Disable_lazy_pruning +{ + static const bool value = false; +}; +template +struct Disable_lazy_pruning +{ + static const bool value = true; +}; +template +struct Disable_lazy_pruning +{ + static const bool value = true; }; -template::value && internal::has_result_type::value > -struct Lazy_construction; - -template struct Disable_lazy_pruning { static const bool value = false; }; -template struct Disable_lazy_pruning { static const bool value = true; }; -template struct Disable_lazy_pruning { static const bool value = true; }; - -// we have a result type, low effort -template -struct Lazy_construction { - static const bool Protection = true; - - typedef typename LK::Approximate_kernel AK; - typedef typename LK::Exact_kernel EK; - typedef 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); - { - Protect_FPU_rounding P; - try { - return result_type(Handle(new Lazy_rep_n< AT, ET, AC, EC, E2A, noprune, L...>(ac, ec, l...))); - } catch (Uncertain_conversion_exception&) {} - } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - return result_type(Handle(new Lazy_rep_0< AT, ET, E2A >(ec(CGAL::exact(l)...)))); - } - - - // nullary - decltype(auto) - operator()() const - { - typedef Lazy Handle; - return result_type( Handle() ); - } - -}; - - -template -struct Lazy_construction +template +struct Lazy_construction { static const bool Protection = true; @@ -1579,41 +1459,194 @@ struct Lazy_construction typedef typename LK::Exact_kernel EK; typedef typename Default::Get::type E2A; + CGAL_NO_UNIQUE_ADDRESS AC ac; + CGAL_NO_UNIQUE_ADDRESS EC ec; + + // to detect the return type of Intersection_[23]'s functors + template + struct is_optional_variant : std::false_type { }; + + template + struct is_optional_variant > > : std::true_type { }; + template 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 { + // @todo why the Type_mapper, just for a std::decay? typedef typename Type_mapper()(std::declval::type>()...)),AK,LK>::type type; }; template decltype(auto) operator()(const L&... l) const { + // @todo why the Type_mapper, just for a std::decay? 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); + + // ----------------------- FT ----------------------- + if constexpr (std::is_same_v) { - Protect_FPU_rounding P; - try { - return result_type(Handle(new Lazy_rep_n (ac, ec, l...))); - } catch (Uncertain_conversion_exception&) {} + typedef Lazy_exact_nt>> result_type; + + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + { + Protect_FPU_rounding P; + try { + return result_type(new Lazy_rep_n, false, L... >(ac, ec, l...)); + } catch (Uncertain_conversion_exception&) {} + } + CGAL_BRANCH_PROFILER_BRANCH(tmp); + Protect_FPU_rounding P2(CGAL_FE_TONEAREST); + CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); + return result_type(new Lazy_rep_0 >(ec( CGAL::exact(l)... ))); + } + // ----------------------- Bounding boxes ----------------------- + else if constexpr (std::disjunction_v, + std::is_same >) + { + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + { + // Protection is outside the try block as VC8 has the CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG + Protect_FPU_rounding P; + try { + return ac(CGAL::approx(l...)); + } catch (Uncertain_conversion_exception&) {} + } + CGAL_BRANCH_PROFILER_BRANCH(tmp); + Protect_FPU_rounding P2(CGAL_FE_TONEAREST); + CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); + return ec(CGAL::exact(l...)); + } + // ----------------------- CGAL::Object ----------------------- + else if constexpr (std::is_same_v) + { + typedef CGAL::Object result_type; + typedef Lazy Lazy_object; + + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + { + Protect_FPU_rounding P; + try { + Lazy_object lo(new Lazy_rep_n(ac, ec, l...)); + + if(lo.approx().is_empty()) + return Object(); + +# define CGAL_Kernel_obj(X) \ + if (object_cast(& (lo.approx()))) { \ + typedef Lazy_rep_n< typename AK::X, typename EK::X, Object_cast, Object_cast, E2A, false, Lazy_object> Lcr; \ + Lcr * lcr = new Lcr(Object_cast(), Object_cast(), lo); \ + return make_object(typename LK::X(lcr)); \ + } + +# include + + // We now check vector +# define CGAL_Kernel_obj(X) \ + { \ + const std::vector* v_ptr; \ + if ( (v_ptr = object_cast >(& (lo.approx()))) ) { \ + std::vector V; \ + V.resize(v_ptr->size()); \ + for (unsigned int i = 0; i < v_ptr->size(); i++) { \ + V[i] = typename LK::X(new Lazy_rep_n, \ + Ith_for_intersection, E2A, false, Lazy_object> \ + (Ith_for_intersection(i), Ith_for_intersection(i), lo)); \ + } \ + return make_object(V); \ + }\ + } + + CGAL_Kernel_obj(Point_2) + CGAL_Kernel_obj(Point_3) +# undef CGAL_Kernel_obj + + std::cerr << "object_cast inside Lazy_construction_rep::operator() failed. It needs more else if's (#1)" << std::endl; + std::cerr << "dynamic type of the Object : " << lo.approx().type().name() << std::endl; + + return Object(); + } catch (Uncertain_conversion_exception&) {} + } + CGAL_BRANCH_PROFILER_BRANCH(tmp); + Protect_FPU_rounding P2(CGAL_FE_TONEAREST); + CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); + 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 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; + + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + { + Protect_FPU_rounding P; + + try { + Lazy lazy(new Lazy_rep_n(AC(), EC(), l...)); + + // the approximate result requires the trait with types from the AK + AT approx_v = lazy.approx(); + // the result we build + result_type res; + + if(!approx_v) { + // empty + return res; + } + + // the static visitor fills the result_type with the correct unwrapped type + internal::Fill_lazy_variant_visitor_2< result_type, AK, LK, EK, Lazy > visitor(res, lazy); + boost::apply_visitor(visitor, *approx_v); + + return res; + } catch (Uncertain_conversion_exception&) {} + } + CGAL_BRANCH_PROFILER_BRANCH(tmp); + Protect_FPU_rounding P2(CGAL_FE_TONEAREST); + CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); + ET exact_v = EC()(CGAL::exact(l)...); + result_type res; + + if(!exact_v) { + return res; + } + + internal::Fill_lazy_variant_visitor_0 visitor(res); + boost::apply_visitor(visitor, *exact_v); + return res; + } + // ----------------------- GENERIC ----------------------- + else + { + typedef typename result::type result_type; + + static const bool noprune = Disable_lazy_pruning::value; + + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + { + Protect_FPU_rounding P; + try { + return result_type(Handle(new Lazy_rep_n(ac, ec, l...))); + } catch (Uncertain_conversion_exception&) {} + } + CGAL_BRANCH_PROFILER_BRANCH(tmp); + Protect_FPU_rounding P2(CGAL_FE_TONEAREST); + CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); + return result_type(Handle(new Lazy_rep_0 (ec(CGAL::exact(l)...)))); } - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P2(CGAL_FE_TONEAREST); - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - return result_type(Handle(new Lazy_rep_0 (ec(CGAL::exact(l)...)))); } // nullary diff --git a/Filtered_kernel/include/CGAL/Lazy_kernel.h b/Filtered_kernel/include/CGAL/Lazy_kernel.h index 0cf7f4f2596..b4383a1e1c4 100644 --- a/Filtered_kernel/include/CGAL/Lazy_kernel.h +++ b/Filtered_kernel/include/CGAL/Lazy_kernel.h @@ -278,7 +278,7 @@ public: #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 @@ -304,14 +304,17 @@ public: typedef CommonKernelFunctors::Assign_2 Assign_2; typedef CommonKernelFunctors::Assign_3 Assign_3; - typedef Lazy_construction_bbox Construct_bbox_2; - typedef Lazy_construction_bbox Construct_bbox_3; typedef Lazy_cartesian_const_iterator_2 Construct_cartesian_const_iterator_2; typedef Lazy_cartesian_const_iterator_3 Construct_cartesian_const_iterator_3; typedef CGAL::CartesianKernelFunctors::Compute_approximate_squared_length_3 Compute_approximate_squared_length_3; typedef CGAL::CartesianKernelFunctors::Compute_approximate_area_3 Compute_approximate_area_3; + typedef 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; + // typedef void Compute_z_3; // to detect where .z() is called // typedef void Construct_point_3; // to detect where the ctor is called @@ -589,14 +592,6 @@ public: assign_3_object() const { return Assign_3(); } - Construct_bbox_2 - construct_bbox_2_object() const - { return Construct_bbox_2(); } - - Construct_bbox_3 - construct_bbox_3_object() const - { return Construct_bbox_3(); } - Construct_cartesian_const_iterator_2 construct_cartesian_const_iterator_2_object() const { return Construct_cartesian_const_iterator_2(); } @@ -613,6 +608,10 @@ public: compute_approximate_area_3_object() const { return Compute_approximate_area_3(); } + Intersect_point_3_for_polyhedral_envelope + intersect_point_3_for_polyhedral_envelope_object() const + { return Intersect_point_3_for_polyhedral_envelope(); } + Less_xyz_3 less_xyz_3_object() const { return Less_xyz_3(); } From 7b6755f6669f7572489d399bfb8682c04bfe78a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 18 Dec 2024 12:04:12 +0100 Subject: [PATCH 19/68] Remove code that was used to filter between different lazy constructions --- Filtered_kernel/include/CGAL/Lazy.h | 33 ----- Filtered_kernel/include/CGAL/Lazy_kernel.h | 149 +-------------------- 2 files changed, 1 insertion(+), 181 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 8e5b22c3fa2..08bb4378220 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -970,39 +970,6 @@ 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_polyhedral_envelope { diff --git a/Filtered_kernel/include/CGAL/Lazy_kernel.h b/Filtered_kernel/include/CGAL/Lazy_kernel.h index b4383a1e1c4..93f8c0fa393 100644 --- a/Filtered_kernel/include/CGAL/Lazy_kernel.h +++ b/Filtered_kernel/include/CGAL/Lazy_kernel.h @@ -39,60 +39,13 @@ 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. 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 { @@ -170,103 +123,7 @@ public: typedef CGAL::Aff_transformationC2 Aff_transformation_2; typedef CGAL::Aff_transformationC3 Aff_transformation_3; -private: - // We use a combination of partial and logic to extract the right - // construction. Constructions without a result_type always have to - // be done through specializations. - // - // The case distinction goes as follows: - // result_type == FT => NT - // result_type == Object => Object - // result_type == 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_polyhedral_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; \ @@ -284,10 +141,6 @@ public: #include }; - - - - template < typename EK_, typename AK_, typename E2A_, typename Kernel_ > class Lazy_kernel_base : public Lazy_kernel_generic_base From 778ae1b9c8e0ea4ac607112b810587d57beb3135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 20 Dec 2024 15:25:03 +0100 Subject: [PATCH 20/68] Remove unused class --- Kernel_23/include/CGAL/Is_a_predicate.h | 66 ------------------------- Kernel_23/include/CGAL/enum.h | 2 - 2 files changed, 68 deletions(-) delete mode 100644 Kernel_23/include/CGAL/Is_a_predicate.h diff --git a/Kernel_23/include/CGAL/Is_a_predicate.h b/Kernel_23/include/CGAL/Is_a_predicate.h deleted file mode 100644 index 4f23fa9c4e3..00000000000 --- a/Kernel_23/include/CGAL/Is_a_predicate.h +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2002 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. -// -// This file is part of CGAL (www.cgal.org) -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Sylvain Pion - -#ifndef CGAL_IS_A_PREDICATE_H -#define CGAL_IS_A_PREDICATE_H - -// How to determine if a kernel functor is a predicate or a construction. - -#include -#include - -namespace CGAL { - -namespace internal { - -// By default it's a construction -template -struct Return_type_of_predicate { - typedef CGAL::Tag_false type; -}; - -// Specializations for predicates -template <> -struct Return_type_of_predicate { - typedef CGAL::Tag_true type; -}; - -template <> -struct Return_type_of_predicate { - typedef CGAL::Tag_true type; -}; - -template <> -struct Return_type_of_predicate { - typedef CGAL::Tag_true type; -}; - -template <> -struct Return_type_of_predicate { - typedef CGAL::Tag_true type; -}; - -} // namespace internal - -template -struct Is_a_predicate { - typedef typename internal::Return_type_of_predicate< - typename Functor::result_type>::type type; -}; - -} //namespace CGAL - -#endif // CGAL_IS_A_PREDICATE_H diff --git a/Kernel_23/include/CGAL/enum.h b/Kernel_23/include/CGAL/enum.h index a27ff99662d..679759041e1 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 From 9c9892c18ecefd6c5397a86b6961966b9c2b1d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 20 Dec 2024 15:34:54 +0100 Subject: [PATCH 21/68] Use variadic functions in Static_filtered_predicate --- .../include/CGAL/Static_filtered_predicate.h | 223 ++---------------- 1 file changed, 21 insertions(+), 202 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Static_filtered_predicate.h b/Filtered_kernel/include/CGAL/Static_filtered_predicate.h index 9ff3aea5d1c..9353ce9b5b3 100644 --- a/Filtered_kernel/include/CGAL/Static_filtered_predicate.h +++ b/Filtered_kernel/include/CGAL/Static_filtered_predicate.h @@ -21,215 +21,34 @@ 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 + template + auto + operator()(const Args&... args) const + -> decltype(fp(args...)) { - CGAL::Epic_converter convert; - auto aa1 = convert(approx(a1)); - if(! aa1.second){ - return fp(a1); - } + CGAL::Epic_converter converter; - return epicp(aa1.first); - } + 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; + }; - 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); - } + 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...); - 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); + return [&](std::index_sequence) { + return epicp(std::get(converted_args).first...); + }(std::index_sequence_for{}); } }; From 6b1e666866f9395fae04a13590547504ea9b948f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 20 Dec 2024 15:36:09 +0100 Subject: [PATCH 22/68] Remove superfluous code in Lazy_construction --- Filtered_kernel/include/CGAL/Lazy.h | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 08bb4378220..bff1ad6a64a 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -1436,23 +1436,10 @@ struct Lazy_construction template struct is_optional_variant > > : std::true_type { }; - template - struct result { - // this does not default, if you want to make a lazy lazy-kernel, - // you are on your own - }; - - template - struct result - { - // @todo why the Type_mapper, just for a std::decay? - typedef typename Type_mapper()(std::declval::type>()...)),AK,LK>::type type; - }; - template decltype(auto) - operator()(const L&... l) const { - // @todo why the Type_mapper, just for a std::decay? + 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; @@ -1460,7 +1447,7 @@ struct Lazy_construction // ----------------------- FT ----------------------- if constexpr (std::is_same_v) { - typedef Lazy_exact_nt>> result_type; + typedef Lazy_exact_nt> result_type; CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); { @@ -1550,12 +1537,7 @@ struct Lazy_construction // boost::optional > (Intersection_23 result types) else if constexpr (is_optional_variant::value) { - 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 typename Type_mapper()(std::declval::type>()...)),AK,LK>::type result_type; CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); { @@ -1598,7 +1580,7 @@ struct Lazy_construction // ----------------------- GENERIC ----------------------- else { - typedef typename result::type result_type; + typedef typename Type_mapper()(std::declval::type>()...)),AK,LK>::type result_type; static const bool noprune = Disable_lazy_pruning::value; From e534750bbe3241226609e6fc6ba51077385f7be6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 20 Dec 2024 15:36:49 +0100 Subject: [PATCH 23/68] Fix but don't fix broken Has_static_filters for EPECK Tracked in #8671 --- Filtered_kernel/include/CGAL/Lazy_kernel.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Filtered_kernel/include/CGAL/Lazy_kernel.h b/Filtered_kernel/include/CGAL/Lazy_kernel.h index 93f8c0fa393..513d00675cc 100644 --- a/Filtered_kernel/include/CGAL/Lazy_kernel.h +++ b/Filtered_kernel/include/CGAL/Lazy_kernel.h @@ -82,9 +82,18 @@ public: typedef typename Exact_kernel::Rep_tag Rep_tag; enum { Has_filtered_predicates = true }; - enum { Has_static_filters = false }; typedef Boolean_tag Has_filtered_predicates_tag; +#ifdef CGAL_NO_STATIC_FILTERS_FOR_LAZY_KERNEL + enum { Has_static_filters = false }; +#else + // @fixme, this should be 'true' but it's broken because Conditional_EPIC_predicate + // 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; From a88642084163721b8b80e4f20eaba377706f9261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 20 Dec 2024 15:47:07 +0100 Subject: [PATCH 24/68] Misc cleaning --- Filtered_kernel/include/CGAL/Lazy_kernel.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy_kernel.h b/Filtered_kernel/include/CGAL/Lazy_kernel.h index 513d00675cc..e8da43f432f 100644 --- a/Filtered_kernel/include/CGAL/Lazy_kernel.h +++ b/Filtered_kernel/include/CGAL/Lazy_kernel.h @@ -42,12 +42,11 @@ namespace CGAL { // 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 // : public Filtered_kernel_base - // TODO : Static_filters_base too ? Check performance { public: @@ -177,11 +176,6 @@ public: typename Approximate_kernel::Intersect_point_3_for_polyhedral_envelope, typename Exact_kernel::Intersect_point_3_for_polyhedral_envelope> Intersect_point_3_for_polyhedral_envelope; - // typedef void Compute_z_3; // to detect where .z() is called - // typedef void Construct_point_3; // to detect where the ctor is called - - - struct Compute_weight_2 : public BaseClass::Compute_weight_2 { typedef typename Kernel_::FT FT; @@ -413,7 +407,6 @@ public: }; - struct Less_xyz_3 : public BaseClass::Less_xyz_3 { typedef typename Kernel_::Point_3 Point_3; From 468dde773d18bbff990fecf12f327d06ae2be186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 20 Dec 2024 16:00:20 +0100 Subject: [PATCH 25/68] Use a clearer name than "Static_filtered_predicate" for EPECK static filters --- ..._predicate.h => EPIC_predicate_if_convertible.h} | 8 ++++---- Filtered_kernel/include/CGAL/Lazy_kernel.h | 13 ++++++++++--- 2 files changed, 14 insertions(+), 7 deletions(-) rename Filtered_kernel/include/CGAL/{Static_filtered_predicate.h => EPIC_predicate_if_convertible.h} (88%) diff --git a/Filtered_kernel/include/CGAL/Static_filtered_predicate.h b/Filtered_kernel/include/CGAL/EPIC_predicate_if_convertible.h similarity index 88% rename from Filtered_kernel/include/CGAL/Static_filtered_predicate.h rename to Filtered_kernel/include/CGAL/EPIC_predicate_if_convertible.h index 9353ce9b5b3..37c47e7edb5 100644 --- a/Filtered_kernel/include/CGAL/Static_filtered_predicate.h +++ b/Filtered_kernel/include/CGAL/EPIC_predicate_if_convertible.h @@ -9,15 +9,15 @@ // // Author(s) : Andreas Fabri, Laurent Rineau -#ifndef CGAL_STATIC_FILTERED_PREDICATE_H -#define CGAL_STATIC_FILTERED_PREDICATE_H +#ifndef CGAL_EPIC_PREDICATE_IF_CONVERTIBLE_H +#define CGAL_EPIC_PREDICATE_IF_CONVERTIBLE_H #include namespace CGAL { template -class Static_filtered_predicate { +class EPIC_predicate_if_convertible { public: FP fp; EpicP epicp; @@ -54,4 +54,4 @@ public: } // CGAL -#endif // CGAL_STATIC_FILTERED_PREDICATE_H +#endif // CGAL_EPIC_PREDICATE_IF_CONVERTIBLE_H diff --git a/Filtered_kernel/include/CGAL/Lazy_kernel.h b/Filtered_kernel/include/CGAL/Lazy_kernel.h index e8da43f432f..8f94a5301e6 100644 --- a/Filtered_kernel/include/CGAL/Lazy_kernel.h +++ b/Filtered_kernel/include/CGAL/Lazy_kernel.h @@ -86,7 +86,7 @@ public: #ifdef CGAL_NO_STATIC_FILTERS_FOR_LAZY_KERNEL enum { Has_static_filters = false }; #else - // @fixme, this should be 'true' but it's broken because Conditional_EPIC_predicate + // @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*) @@ -137,8 +137,15 @@ public: 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 From 4d4549cad67f6aa24f431a9b3c20a34857f13373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 20 Dec 2024 16:12:56 +0100 Subject: [PATCH 26/68] Get rid of result_type in Kernels + fix some bad return types (wip) --- .../include/CGAL/Cartesian/function_objects.h | 958 ++++++++---------- .../function_objects_polynomial_sphere.h | 213 ++-- .../internal/Static_filters/Angle_3.h | 9 +- .../internal/Static_filters/Collinear_3.h | 8 +- .../Static_filters/Compare_distance_3.h | 11 +- .../Static_filters/Compare_squared_radius_3.h | 19 +- .../Compare_weighted_squared_radius_3.h | 17 +- .../internal/Static_filters/Compare_x_2.h | 13 +- .../internal/Static_filters/Compare_y_2.h | 13 +- .../Static_filters/Compare_y_at_x_2.h | 11 +- .../internal/Static_filters/Coplanar_3.h | 11 +- .../Static_filters/Coplanar_orientation_3.h | 4 +- .../internal/Static_filters/Do_intersect_2.h | 13 +- .../internal/Static_filters/Do_intersect_3.h | 37 +- .../internal/Static_filters/Equal_2.h | 9 +- .../internal/Static_filters/Equal_3.h | 11 +- .../internal/Static_filters/Is_degenerate_3.h | 11 +- .../internal/Static_filters/Orientation_2.h | 6 +- .../internal/Static_filters/Orientation_3.h | 6 +- .../Power_side_of_oriented_power_sphere_3.h | 42 +- .../Side_of_oriented_circle_2.h | 2 +- .../Side_of_oriented_sphere_3.h | 2 +- .../CGAL/Homogeneous/function_objects.h | 839 ++++++--------- ...elaunay_triangulation_traits_2_functions.h | 8 +- .../examples/Kernel_23/MyConstruct_point_2.h | 3 +- .../Kernel_23/intersection_visitor.cpp | 2 - .../include/CGAL/Kernel/function_objects.h | 722 ++++++------- .../Kernel_23/internal/Projection_traits_3.h | 42 +- .../internal/Projection_traits_base_3.h | 15 +- 29 files changed, 1264 insertions(+), 1793 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index ab740590345..d5e6aab5919 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -36,20 +36,20 @@ namespace CartesianKernelFunctors { template class Angle_2 { + typedef typename K::Angle Angle; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; - public: - typedef typename K::Angle result_type; - result_type + public: + Angle operator()(const Vector_2& u, const Vector_2& v) const { return angleC2(u.x(), u.y(), v.x(), v.y()); } - result_type + Angle operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { return angleC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y()); } - result_type + Angle operator()(const Point_2& p, const Point_2& q, const Point_2& r, const Point_2& s) const { @@ -63,18 +63,19 @@ namespace CartesianKernelFunctors { template class Angle_3 { + typedef typename K::Angle Angle; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; - public: - typedef typename K::Angle result_type; - result_type + public: + Angle operator()(const Vector_3& u, const Vector_3& v) const { return angleC3(u.x(), u.y(), u.z(), v.x(), v.y(), v.z()); } - result_type + + Angle operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { return angleC3(p.x(), p.y(), p.z(), @@ -82,7 +83,7 @@ namespace CartesianKernelFunctors { r.x(), r.y(), r.z()); } - result_type + Angle operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { @@ -92,7 +93,7 @@ namespace CartesianKernelFunctors { s.x(), s.y(), s.z()); } - result_type + Angle operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Vector_3& n) const { @@ -103,18 +104,17 @@ namespace CartesianKernelFunctors { template class Are_parallel_2 { + typedef typename K::Boolean Boolean; typedef typename K::Line_2 Line_2; typedef typename K::Segment_2 Segment_2; typedef typename K::Ray_2 Ray_2; public: - typedef typename K::Boolean result_type; - - result_type + Boolean operator()(const Line_2& l1, const Line_2& l2) const { return parallelC2(l1.a(), l1.b(), l2.a(), l2.b()); } - result_type + Boolean operator()(const Segment_2& s1, const Segment_2& s2) const { return parallelC2(s1.source().x(), s1.source().y(), s1.target().x(), s1.target().y(), @@ -122,7 +122,7 @@ namespace CartesianKernelFunctors { s2.target().x(), s2.target().y()); } - result_type + Boolean operator()(const Ray_2& r1, const Ray_2& r2) const { return parallelC2(r1.source().x(), r1.source().y(), r1.second_point().x(), r1.second_point().y(), @@ -134,28 +134,27 @@ namespace CartesianKernelFunctors { template class Are_parallel_3 { + typedef typename K::Boolean Boolean; typedef typename K::Line_3 Line_3; typedef typename K::Segment_3 Segment_3; typedef typename K::Ray_3 Ray_3; typedef typename K::Plane_3 Plane_3; public: - typedef typename K::Boolean result_type; - - result_type + Boolean operator()(const Line_3& l1, const Line_3& l2) const { return parallelC3( l1.to_vector().x(), l1.to_vector().y(), l1.to_vector().z(), l2.to_vector().x(), l2.to_vector().y(), l2.to_vector().z()); } - result_type + Boolean operator()(const Plane_3& h1, const Plane_3& h2) const { return parallelC3(h1.a(), h1.b(), h1.c(), h2.a(), h2.b(), h2.c()); } - result_type + Boolean operator()(const Segment_3& s1, const Segment_3& s2) const { return parallelC3(s1.source().x(), s1.source().y(), s1.source().z(), s1.target().x(), s1.target().y(), s1.target().z(), @@ -163,7 +162,7 @@ namespace CartesianKernelFunctors { s2.target().x(), s2.target().y(), s2.target().z()); } - result_type + Boolean operator()(const Ray_3& r1, const Ray_3& r2) const { return parallelC3(r1.source().x(), r1.source().y(), r1.source().z(), r1.second_point().x(), r1.second_point().y(), r1.second_point().z(), @@ -175,14 +174,14 @@ namespace CartesianKernelFunctors { template class Bounded_side_2 { + typedef typename K::Bounded_side Bounded_side; typedef typename K::Point_2 Point_2; typedef typename K::Circle_2 Circle_2; typedef typename K::Triangle_2 Triangle_2; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; - public: - typedef typename K::Bounded_side result_type; - result_type + public: + Bounded_side operator()( const Circle_2& c, const Point_2& p) const { typename K::Compute_squared_distance_2 squared_distance; @@ -190,7 +189,7 @@ namespace CartesianKernelFunctors { squared_distance(c.center(),p))); } - result_type + Bounded_side operator()( const Triangle_2& t, const Point_2& p) const { typename K::Collinear_are_ordered_along_line_2 @@ -213,7 +212,7 @@ namespace CartesianKernelFunctors { : ON_UNBOUNDED_SIDE; } - result_type + Bounded_side operator()( const Iso_rectangle_2& r, const Point_2& p) const { bool x_incr = (r.xmin() < p.x()) && (p.x() < r.xmax()), @@ -236,24 +235,24 @@ namespace CartesianKernelFunctors { template class Bounded_side_3 { + typedef typename K::Bounded_side Bounded_side; typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Sphere_3 Sphere_3; typedef typename K::Circle_3 Circle_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Iso_cuboid_3 Iso_cuboid_3; - public: - typedef typename K::Bounded_side result_type; - result_type + public: + Bounded_side operator()( const Sphere_3& s, const Point_3& p) const { return s.rep().bounded_side(p); } - result_type + Bounded_side operator()( const Circle_3& s, const Point_3& p) const { return s.rep().bounded_side(p); } - result_type + Bounded_side operator()( const Tetrahedron_3& t, const Point_3& p) const { FT alpha, beta, gamma, denom; @@ -273,7 +272,7 @@ namespace CartesianKernelFunctors { return ON_BOUNDED_SIDE; } - result_type + Bounded_side operator()( const Iso_cuboid_3& c, const Point_3& p) const { return c.rep().bounded_side(p); @@ -284,11 +283,11 @@ namespace CartesianKernelFunctors { template class Collinear_are_ordered_along_line_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { CGAL_kernel_exactness_precondition( collinear(p, q, r) ); @@ -300,11 +299,11 @@ namespace CartesianKernelFunctors { template class Collinear_are_ordered_along_line_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { CGAL_kernel_exactness_precondition( collinear(p, q, r) ); @@ -317,11 +316,11 @@ namespace CartesianKernelFunctors { template class Collinear_are_strictly_ordered_along_line_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { CGAL_kernel_exactness_precondition( collinear(p, q, r) ); @@ -333,11 +332,11 @@ namespace CartesianKernelFunctors { template class Collinear_are_strictly_ordered_along_line_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { CGAL_kernel_exactness_precondition( collinear(p, q, r) ); @@ -350,13 +349,13 @@ namespace CartesianKernelFunctors { template class Collinear_has_on_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Ray_2 Ray_2; typedef typename K::Segment_2 Segment_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Ray_2& r, const Point_2& p) const { const Point_2 & source = r.source(); @@ -378,7 +377,7 @@ namespace CartesianKernelFunctors { } // switch } - result_type + Boolean operator()( const Segment_2& s, const Point_2& p) const { return collinear_are_ordered_along_line(s.source(), p, s.target()); @@ -388,16 +387,17 @@ namespace CartesianKernelFunctors { template class Collinear_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Orientation_2 Orientation_2; - Orientation_2 o; - public: - typedef typename K::Boolean result_type; + Orientation_2 o; + + public: Collinear_2() {} Collinear_2(const Orientation_2 o_) : o(o_) {} - result_type + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { return o(p, q, r) == COLLINEAR; } }; @@ -405,11 +405,11 @@ namespace CartesianKernelFunctors { template class Collinear_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { return collinearC3(p.x(), p.y(), p.z(), @@ -421,11 +421,11 @@ namespace CartesianKernelFunctors { template class Compare_angle_with_x_axis_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Direction_2 Direction_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Direction_2& d1, const Direction_2& d2) const { return compare_angle_with_x_axisC2(d1.dx(), d1.dy(), d2.dx(), d2.dy()); @@ -435,25 +435,25 @@ namespace CartesianKernelFunctors { template class Compare_distance_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { return cmp_dist_to_pointC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y()); } template - Needs_FT + Needs_FT operator()(const T1& p, const T2& q, const T3& r) const { return CGAL::compare(squared_distance(p, q), squared_distance(p, r)); } template - Needs_FT + Needs_FT operator()(const T1& p, const T2& q, const T3& r, const T4& s) const { return CGAL::compare(squared_distance(p, q), squared_distance(r, s)); @@ -560,12 +560,12 @@ namespace CartesianKernelFunctors { template class Compare_distance_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; typedef typename K::Segment_3 Segment_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { return cmp_dist_to_pointC3(p.x(), p.y(), p.z(), @@ -573,33 +573,33 @@ namespace CartesianKernelFunctors { r.x(), r.y(), r.z()); } - result_type + Comparison_result operator()(const Point_3& p1, const Segment_3& s1, const Segment_3& s2) const { return internal::compare_distance_pssC3(p1,s1,s2, K()); } - result_type + Comparison_result operator()(const Point_3& p1, const Point_3& p2, const Segment_3& s2) const { return internal::compare_distance_ppsC3(p1,p2,s2, K()); } - result_type + Comparison_result operator()(const Point_3& p1, const Segment_3& s2, const Point_3& p2) const { return opposite(internal::compare_distance_ppsC3(p1,p2,s2, K())); } template - Needs_FT + Needs_FT operator()(const T1& p, const T2& q, const T3& r) const { return CGAL::compare(squared_distance(p, q), squared_distance(p, r)); } template - Needs_FT + Needs_FT operator()(const T1& p, const T2& q, const T3& r, const T4& s) const { return CGAL::compare(squared_distance(p, q), squared_distance(r, s)); @@ -614,8 +614,7 @@ namespace CartesianKernelFunctors { typedef typename K::Point_2 Point_2; typedef typename K::Comparison_result Comparison_result; - typedef Comparison_result result_type; - +public: Comparison_result operator()(const Point_2& r, const Weighted_point_2& p, const Weighted_point_2& q) const @@ -629,14 +628,13 @@ namespace CartesianKernelFunctors { template class Compare_signed_distance_to_line_2 { - typedef typename K::Point_2 Point_2; - typedef typename K::Line_2 Line_2; - typedef typename K::Equal_2 Equal_2; + typedef typename K::Comparison_result Comparison_result; + typedef typename K::Point_2 Point_2; + typedef typename K::Line_2 Line_2; + typedef typename K::Equal_2 Equal_2; public: - typedef typename K::Comparison_result result_type; - - result_type + Comparison_result operator()(const Point_2& a, const Point_2& b, const Point_2& c, const Point_2& d) const { @@ -649,7 +647,7 @@ namespace CartesianKernelFunctors { d.x(), d.y()); } - result_type + Comparison_result operator()(const Line_2& l, const Point_2& p, const Point_2& q) const { return cmp_signed_dist_to_directionC2(l.a(), l.b(), @@ -661,12 +659,12 @@ namespace CartesianKernelFunctors { template class Compare_squared_radius_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; typedef typename K::FT FT; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s, const FT& ft) const { FT num, den; @@ -678,7 +676,7 @@ namespace CartesianKernelFunctors { return CGAL::compare(num, den * ft); } - result_type + Comparison_result operator()(const Point_3& p, const Point_3& q, const Point_3& r, const FT& ft) const { FT num, den; @@ -689,7 +687,7 @@ namespace CartesianKernelFunctors { return CGAL::compare(num, den * ft); } - result_type + Comparison_result operator()(const Point_3& p, const Point_3& q, const FT& ft) const { FT num, den; @@ -699,7 +697,7 @@ namespace CartesianKernelFunctors { return CGAL::compare(num, den * ft); } - result_type + Comparison_result operator()(const Point_3&, const FT& ft) const { return - CGAL_NTS sign(ft); @@ -707,23 +705,22 @@ namespace CartesianKernelFunctors { }; - template class Compare_slope_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; typedef typename K::Segment_2 Segment_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Line_2& l1, const Line_2& l2) const { return compare_slopesC2(l1.a(), l1.b(), l2.a(), l2.b()); } - result_type + Comparison_result operator()(const Segment_2& s1, const Segment_2& s2) const { return compare_slopesC2(s1.source().x(), s1.source().y(), @@ -732,7 +729,7 @@ namespace CartesianKernelFunctors { s2.target().x(), s2.target().y()); } - result_type + Comparison_result operator()(const Point_2& s1s, const Point_2& s1t, const Point_2& s2s, const Point_2& s2t) const { return compare_slopesC2(s1s.x(), s1s.y(), @@ -745,30 +742,30 @@ namespace CartesianKernelFunctors { template class Compare_x_at_y_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Line_2& h) const { return compare_y_at_xC2(p.y(), p.x(), h.b(), h.a(), h.c()); } - result_type + Comparison_result operator()( const Point_2& p, const Line_2& h1, const Line_2& h2) const { return compare_y_at_xC2(p.y(), h1.b(), h1.a(), h1.c(), h2.b(), h2.a(), h2.c()); } - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h) const { return compare_y_at_xC2(l1.b(), l1.a(), l1.c(), l2.b(), l2.a(), l2.c(), h.b(), h.a(), h.c()); } - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h1, const Line_2& h2) const { @@ -780,11 +777,11 @@ namespace CartesianKernelFunctors { template class Compare_xyz_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { return compare_lexicographically_xyzC3(p.x(), p.y(), p.z(), @@ -795,11 +792,11 @@ namespace CartesianKernelFunctors { template class Compare_xy_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Point_2& q) const { return compare_lexicographically_xyC2(p.x(), p.y(), q.x(), q.y()); } }; @@ -807,11 +804,11 @@ namespace CartesianKernelFunctors { template class Compare_xy_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { return compare_lexicographically_xyC2(p.x(), p.y(), q.x(), q.y()); } }; @@ -819,27 +816,27 @@ namespace CartesianKernelFunctors { template class Compare_x_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Point_2& q) const { return CGAL::compare(p.x(), q.x()); } - result_type + Comparison_result operator()( const Point_2& p, const Line_2& l, const Line_2& h) const { return compare_xC2(p.x(), l.a(), l.b(), l.c(), h.a(), h.b(), h.c()); } - result_type + Comparison_result operator()( const Line_2& l, const Line_2& h1, const Line_2& h2) const { return compare_xC2(l.a(), l.b(), l.c(), h1.a(), h1.b(), h1.c(), h2.a(), h2.b(), h2.c()); } - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h1, const Line_2& h2) const { @@ -851,11 +848,11 @@ namespace CartesianKernelFunctors { template class Compare_x_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { return CGAL::compare(p.x(), q.x()); } }; @@ -863,11 +860,11 @@ namespace CartesianKernelFunctors { template class Compare_yx_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Point_2& q) const { return compare_lexicographically_xyC2(p.y(), p.x(), q.y(), q.x()); } }; @@ -875,31 +872,31 @@ namespace CartesianKernelFunctors { template class Compare_y_at_x_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; typedef typename K::Segment_2 Segment_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Line_2& h) const { return compare_y_at_xC2(p.x(), p.y(), h.a(), h.b(), h.c()); } - result_type + Comparison_result operator()( const Point_2& p, const Line_2& h1, const Line_2& h2) const { return compare_y_at_xC2(p.x(), h1.a(), h1.b(), h1.c(), h2.a(), h2.b(), h2.c()); } - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h) const { return compare_y_at_xC2(l1.a(), l1.b(), l1.c(), l2.a(), l2.b(), l2.c(), h.a(), h.b(), h.c()); } - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h1, const Line_2& h2) const { @@ -907,7 +904,7 @@ namespace CartesianKernelFunctors { h1.a(), h1.b(), h1.c(), h2.a(), h2.b(), h2.c()); } - result_type + Comparison_result operator()( const Point_2& p, const Segment_2& s) const { return compare_y_at_xC2(p.x(), p.y(), @@ -915,7 +912,7 @@ namespace CartesianKernelFunctors { s.target().x(), s.target().y()); } - result_type + Comparison_result operator()( const Point_2& p, const Segment_2& s1, const Segment_2& s2) const { @@ -930,16 +927,16 @@ namespace CartesianKernelFunctors { template class Compare_y_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Point_2& q) const { return CGAL::compare(p.y(), q.y()); } - result_type + Comparison_result operator()( const Point_2& p, const Line_2& l1, const Line_2& l2) const { return compare_xC2(p.y(), @@ -947,14 +944,14 @@ namespace CartesianKernelFunctors { l2.b(), l2.a(), l2.c()); } - result_type + Comparison_result operator()( const Line_2& l, const Line_2& h1, const Line_2& h2) const { return compare_xC2(l.b(), l.a(), l.c(), h1.b(), h1.a(), h1.c(), l.b(), l.a(), l.c(), h2.b(), h2.a(), h2.c()); } - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h1, const Line_2& h2) const { @@ -966,11 +963,11 @@ namespace CartesianKernelFunctors { template class Compare_y_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { return CGAL::compare(p.y(), q.y()); } }; @@ -978,11 +975,11 @@ namespace CartesianKernelFunctors { template class Compare_z_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { return CGAL::compare(p.z(), q.z()); } }; @@ -994,10 +991,7 @@ namespace CartesianKernelFunctors { typedef typename K::FT FT; public: - - typedef double result_type; - - result_type + double operator() (const Circle_3 & c) const // { return c.rep().approximate_area(); } { return CGAL_PI * to_double(c.squared_radius()); } @@ -1010,10 +1004,7 @@ namespace CartesianKernelFunctors { typedef typename K::FT FT; public: - - typedef double result_type; - - result_type + double operator() (const Circle_3 & c) const // { return c.rep().approximate_squared_length(); } { return CGAL_PI * CGAL_PI * 4.0 * to_double(c.squared_radius()); } @@ -1027,10 +1018,9 @@ namespace CartesianKernelFunctors { typedef typename K::Iso_rectangle_2 Iso_rectangle_2; typedef typename K::Triangle_2 Triangle_2; typedef typename K::Point_2 Point_2; - public: - typedef FT result_type; - result_type + public: + FT operator()( const Point_2& p, const Point_2& q, const Point_2& r ) const { FT v1x = q.x() - p.x(); @@ -1040,11 +1030,11 @@ namespace CartesianKernelFunctors { return determinant(v1x, v1y, v2x, v2y)/2; } - result_type + FT operator()( const Iso_rectangle_2& r ) const { return (r.xmax()-r.xmin()) * (r.ymax()-r.ymin()); } - result_type + FT operator()( const Triangle_2& t ) const { return t.area(); } }; @@ -1066,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()); @@ -1081,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(), @@ -1098,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(); @@ -1113,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(); @@ -1129,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(), @@ -1153,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()); @@ -1166,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(); } @@ -1271,10 +1252,9 @@ public: 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 { @@ -1283,14 +1263,14 @@ public: 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(); } }; @@ -1299,20 +1279,17 @@ public: 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(); @@ -1322,20 +1299,17 @@ public: 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(); @@ -1346,20 +1320,17 @@ public: 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(); @@ -1370,20 +1341,17 @@ public: 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(); @@ -1393,38 +1361,30 @@ public: 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(); @@ -1434,13 +1394,10 @@ public: 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(); @@ -1450,13 +1407,10 @@ public: 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(); @@ -1466,13 +1420,10 @@ public: 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(); @@ -1482,13 +1433,10 @@ public: 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(); @@ -1498,20 +1446,17 @@ public: 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(); @@ -1521,20 +1466,17 @@ public: 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(); @@ -1544,20 +1486,17 @@ public: 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(); @@ -1567,20 +1506,17 @@ public: 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(); @@ -1590,20 +1526,17 @@ public: 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(); @@ -1613,20 +1546,17 @@ public: 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(); @@ -1636,20 +1566,17 @@ public: 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(); @@ -1660,13 +1587,10 @@ public: 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(); @@ -1676,13 +1600,10 @@ public: 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(); @@ -1692,13 +1613,10 @@ public: 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(); @@ -1708,29 +1626,24 @@ public: 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; @@ -1739,7 +1652,7 @@ public: 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; @@ -1748,7 +1661,7 @@ public: 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 { @@ -1758,7 +1671,7 @@ public: 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 { @@ -1768,7 +1681,7 @@ public: 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 { @@ -1778,7 +1691,7 @@ public: 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 { @@ -1795,10 +1708,9 @@ public: { 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; @@ -1807,7 +1719,7 @@ public: 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; @@ -1816,7 +1728,7 @@ public: 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 { @@ -1826,7 +1738,7 @@ public: 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 { @@ -1837,7 +1749,7 @@ public: 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 { @@ -1848,7 +1760,7 @@ public: 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 { @@ -1873,16 +1785,15 @@ public: 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) { @@ -1924,10 +1835,9 @@ public: 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()); @@ -1935,11 +1845,11 @@ public: 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)); @@ -1959,14 +1869,14 @@ public: */ } - 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; @@ -1997,9 +1907,8 @@ public: 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 { @@ -2061,7 +1970,7 @@ public: maxx.sup(), maxy.sup(), maxz.sup()); } - Bbox_3 + decltype(auto) operator()(const Circle_3& c) const { return c.rep().bbox(); } @@ -2074,10 +1983,9 @@ public: 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; @@ -2085,7 +1993,7 @@ public: return Line_2(a, b, c); } - result_type + Line_2 operator()(const Line_2& p, const Line_2& q) const { FT a, b, c; @@ -2102,10 +2010,9 @@ public: 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; @@ -2115,7 +2022,7 @@ public: 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; @@ -2132,10 +2039,9 @@ public: 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; @@ -2144,13 +2050,13 @@ public: 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 { @@ -2168,10 +2074,9 @@ public: 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; @@ -2183,7 +2088,7 @@ public: 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 { @@ -2197,13 +2102,13 @@ public: 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), @@ -2216,9 +2121,8 @@ public: { 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 { @@ -2226,7 +2130,7 @@ public: 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; @@ -2236,7 +2140,7 @@ public: 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)); @@ -2250,9 +2154,8 @@ public: 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 { @@ -2304,9 +2207,8 @@ public: 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 { @@ -2325,15 +2227,14 @@ public: 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_, @@ -2362,8 +2263,6 @@ public: 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); } @@ -2438,9 +2337,8 @@ public: 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); } @@ -2491,9 +2389,8 @@ public: 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 { @@ -2543,7 +2440,6 @@ public: FT z = s.z() + num_z*inv; return Rep(Point_3(x, y, z), Vector_3(rsx, rsy, rsz)); } - }; template @@ -2556,8 +2452,6 @@ public: 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 { @@ -2661,10 +2555,10 @@ public: typedef typename K::Line_2 Line_2; typedef typename Line_2::Rep Rep; typedef typename K::Construct_point_on_2 Construct_point_on_2; - Construct_point_on_2 c; - public: - typedef Line_2 result_type; + Construct_point_on_2 c; + + public: Construct_line_2() {} Construct_line_2(const Construct_point_on_2& c_) : c(c_) {} @@ -2740,9 +2634,8 @@ public: 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)); } @@ -2791,9 +2684,8 @@ public: 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 { @@ -2821,9 +2713,8 @@ public: 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 { @@ -2849,9 +2740,8 @@ public: 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()); } @@ -2861,9 +2751,8 @@ public: 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()); } @@ -2873,9 +2762,8 @@ public: 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()); } @@ -2889,8 +2777,6 @@ public: 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 { @@ -2908,9 +2794,8 @@ public: 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()); } @@ -2920,9 +2805,8 @@ public: 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()); } @@ -2932,9 +2816,8 @@ public: 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()); } @@ -2947,9 +2830,8 @@ public: 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()); } @@ -2989,9 +2871,8 @@ public: 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 { @@ -3007,9 +2888,8 @@ public: 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 { @@ -3027,9 +2907,8 @@ public: { 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 { @@ -3049,23 +2928,8 @@ public: 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; - }; - Rep // Point_2 operator()(Return_base_tag, Origin o) const { return Rep(o); } @@ -3100,7 +2964,7 @@ public: operator()(const Point_2 & p) const { return p; } - const Point_2& + decltype(auto) operator()(const Weighted_point_2 & p) const { return p.rep().point(); } @@ -3159,7 +3023,7 @@ public: operator()(const Point_3 & p) const { return p; } - const Point_3& + decltype(auto) operator()(const Weighted_point_3 & p) const { return p.rep().point(); } @@ -3184,9 +3048,8 @@ public: 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); } @@ -3227,9 +3090,8 @@ public: 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); } @@ -3269,9 +3131,8 @@ public: { 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 { @@ -3353,10 +3214,7 @@ public: 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 @@ -3379,10 +3237,7 @@ public: 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 @@ -3406,9 +3261,8 @@ public: { 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 { @@ -3421,9 +3275,8 @@ public: { 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 { @@ -3436,9 +3289,8 @@ public: { 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 { @@ -3451,9 +3303,8 @@ public: { 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 { @@ -3466,9 +3317,8 @@ public: { 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 { @@ -3489,9 +3339,8 @@ public: { 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 { @@ -3519,9 +3368,8 @@ public: 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()); } @@ -3617,9 +3465,8 @@ public: 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 { @@ -3719,22 +3566,13 @@ public: typedef typename K::Segment_2 Segment_2; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; typedef typename K::Triangle_2 Triangle_2; + public: - template - struct result { - typedef const Point_2& type; - }; - - template - struct result { - typedef Point_2 type; - }; - - const Point_2 & + decltype(auto) operator()( const Segment_2& s, int i) const { return s.vertex(i); } - const Point_2 & + decltype(auto) operator()( const Triangle_2& t, int i) const { return t.rep().vertex(i); } @@ -3757,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; @@ -3764,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_) @@ -3774,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(), @@ -3782,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 { @@ -3805,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_, @@ -3823,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 { @@ -3843,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() ); @@ -3857,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(); } }; @@ -3869,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(); } }; @@ -3881,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(); } }; @@ -3893,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(); } }; @@ -3905,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(); } }; @@ -3917,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; @@ -3927,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(); @@ -3964,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); } @@ -3986,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(), @@ -4002,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(), @@ -4019,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 { @@ -4037,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(), @@ -4049,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(), @@ -4063,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 { @@ -4080,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; + Compare_xyz_3 c; + + public: Less_xyz_3() {} Less_xyz_3(const Compare_xyz_3& c_) : c(c_) {} - result_type + Boolean operator()( const Point_3& p, const Point_3& q) const { return c(p, q) == SMALLER; } }; @@ -4097,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; + Compare_xy_2 c; + + public: Less_xy_2() {} Less_xy_2(const Compare_xy_2& c_) : c(c_) {} - result_type + Boolean operator()( const Point_2& p, const Point_2& q) const { return c(p, q) == SMALLER; } }; @@ -4114,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; + Compare_xy_3 c; + + public: Less_xy_3() {} Less_xy_3(const Compare_xy_3& c_) : c(c_) {} - result_type + Boolean operator()( const Point_3& p, const Point_3& q) const { return c(p, q) == SMALLER; } }; @@ -4131,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(); } }; @@ -4143,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(); } }; @@ -4155,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(), @@ -4170,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(); } }; @@ -4182,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(); } }; @@ -4194,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(); } }; @@ -4206,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(); @@ -4233,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 { @@ -4250,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(), @@ -4258,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 { @@ -4267,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(); @@ -4284,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, @@ -4336,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 @@ -4379,7 +4219,7 @@ namespace CartesianKernelFunctors { : opposite(ot); } - result_type + Oriented_side operator()(const Segment_2& s, const Triangle_2& t) const { typename K::Construct_source_2 source; @@ -4407,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(), @@ -4419,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 { @@ -4431,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(), @@ -4443,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 { @@ -4453,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 { @@ -4468,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 { @@ -4486,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/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 ff7119586a5..d4cea361700 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 @@ -72,13 +72,10 @@ template < class SK > \ 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 +83,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,13 +94,10 @@ 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()); } }; @@ -309,83 +300,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,93 +380,89 @@ 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(); } }; @@ -498,54 +480,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 +535,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 +543,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 > @@ -1297,18 +1276,15 @@ template < class SK > \ typedef typename SK::Line_arc_3 Line_arc_3; public: - - typedef typename SK::Linear_kernel::Construct_bbox_3::result_type result_type; - using SK::Linear_kernel::Construct_bbox_3::operator(); - result_type operator() (const Circular_arc_point_3 & c) const + decltype(auto) operator() (const Circular_arc_point_3 & c) const { return c.rep().bbox(); } - result_type operator() (const Line_arc_3 & l) const + decltype(auto) operator() (const Line_arc_3 & l) const { return l.rep().bbox(); } - result_type operator() (const Circular_arc_3 & c) const + decltype(auto) operator() (const Circular_arc_3 & c) const { return c.rep().bbox(); } }; @@ -1322,8 +1298,8 @@ template < class SK > \ typedef typename SK::FT FT; public: - typedef double result_type; + using SK::Linear_kernel::Compute_approximate_squared_length_3::operator(); result_type operator() (const Circular_arc_3 & c) const @@ -1341,7 +1317,6 @@ template < class SK > \ typedef typename SK::FT FT; public: - typedef double result_type; using SK::Linear_kernel::Compute_approximate_angle_3::operator(); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Angle_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Angle_3.h index e9428fd2917..f54f028d47d 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Angle_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Angle_3.h @@ -34,13 +34,12 @@ template < typename K_base > class Angle_3 : public K_base::Angle_3 { - typedef typename K_base::Point_3 Point_3; + typedef typename K_base::Angle Angle; + typedef typename K_base::Point_3 Point_3; + typedef typename K_base::Angle_3 Base; public: - - typedef typename Base::result_type result_type; - using Base::operator(); Sign sign_with_error(const double x, const double error) const { @@ -49,7 +48,7 @@ public: else return ZERO; } - result_type operator()(const Point_3 &p, const Point_3& q, const Point_3& r) const + Angle operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Angle_3", tmp); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Collinear_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Collinear_3.h index 9279f60c3d2..4dd64070b5c 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Collinear_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Collinear_3.h @@ -24,16 +24,16 @@ template < typename K_base > class Collinear_3 : public K_base::Collinear_3 { + typedef typename K_base::Boolean Boolean; typedef typename K_base::Point_3 Point_3; typedef typename K_base::Vector_3 Vector_3; typedef typename K_base::Sphere_3 Sphere_3; typedef typename K_base::Tetrahedron_3 Tetrahedron_3; - typedef typename K_base::Collinear_3 Base; + + typedef typename K_base::Collinear_3 Base; public: - - typedef typename Base::result_type result_type; - result_type + Boolean operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r) const { CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Collinear_3", tmp); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_distance_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_distance_3.h index f3880b3f0e2..4589aa9aa81 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_distance_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_distance_3.h @@ -30,17 +30,16 @@ template < typename K_base > class Compare_distance_3 : public K_base::Compare_distance_3 { - typedef typename K_base::Point_3 Point_3; - typedef typename K_base::Vector_3 Vector_3; + typedef typename K_base::Comparison_result Comparison_result; + typedef typename K_base::Point_3 Point_3; + typedef typename K_base::Vector_3 Vector_3; + typedef typename K_base::Compare_distance_3 Base; public: - - typedef typename Base::result_type result_type; - using Base::operator(); - result_type operator()(const Point_3 &p, const Point_3& q, const Point_3& r) const + Comparison_result operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_squared_radius_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_squared_radius_3.h index 8e0683677aa..aecee9d3618 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_squared_radius_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_squared_radius_3.h @@ -24,15 +24,16 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { class Compare_squared_radius_3 : public K_base::Compare_squared_radius_3 { - typedef typename K_base::Point_3 Point_3; - typedef typename K_base::FT FT; - typedef typename K_base::Compare_squared_radius_3 Base; - public: - typedef typename Base::result_type result_type; + typedef typename K_base::Comparison_result Comparison_result; + typedef typename K_base::Point_3 Point_3; + typedef typename K_base::FT FT; + typedef typename K_base::Compare_squared_radius_3 Base; + + public: using Base::operator(); - result_type operator() ( + Comparison_result operator() ( const Point_3& p, const Point_3& q, const Point_3& r, @@ -185,7 +186,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { return Base::operator()(p,q,r,s,w); } - result_type operator() ( + Comparison_result operator() ( const Point_3& p, const Point_3& q, const Point_3& s, @@ -312,14 +313,14 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { } } } - return static_cast(int_tmp_result); + return static_cast(int_tmp_result); } else return Base::operator()(p,q,s,w); } - result_type operator() ( + Comparison_result operator() ( const Point_3& p, const Point_3& q, const FT& w diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_weighted_squared_radius_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_weighted_squared_radius_3.h index 41b9f1b9e77..3a8afc92ba3 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_weighted_squared_radius_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_weighted_squared_radius_3.h @@ -27,15 +27,16 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { class Compare_weighted_squared_radius_3: public K_base::Compare_weighted_squared_radius_3 { - typedef typename K_base::Weighted_point_3 Weighted_point_3; - typedef typename K_base::FT FT; - typedef typename K_base::Compare_weighted_squared_radius_3 Base; - public: - typedef typename Base::result_type result_type; + typedef typename K_base::Comparison_result Comparison_result; + typedef typename K_base::Weighted_point_3 Weighted_point_3; + typedef typename K_base::FT FT; + typedef typename K_base::Compare_weighted_squared_radius_3 Base; + + public: using Base::operator(); - result_type operator() ( + Comparison_result operator() ( const Weighted_point_3& p, const Weighted_point_3& q, const Weighted_point_3& r, @@ -175,7 +176,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { return Base::operator()(p,q,r,s,w); } - result_type + Comparison_result operator() ( const Weighted_point_3& p, const Weighted_point_3& q , @@ -292,7 +293,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { return Base::operator()(p,q,r,w); } - result_type + Comparison_result operator() ( const Weighted_point_3& p, const Weighted_point_3& q, diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_x_2.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_x_2.h index 29c6d291051..3478f524983 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_x_2.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_x_2.h @@ -31,17 +31,16 @@ template < typename K_base > class Compare_x_2 : public K_base::Compare_x_2 { - typedef typename K_base::Point_2 Point_2; - typedef typename K_base::Line_2 Line_2; - typedef typename K_base::Compare_x_2 Base; + typedef typename K_base::Comparison_result Comparison_result; + typedef typename K_base::Point_2 Point_2; + typedef typename K_base::Line_2 Line_2; + + typedef typename K_base::Compare_x_2 Base; public: - - typedef typename Base::result_type result_type; - using Base::operator(); - result_type operator()(const Point_2 &p, const Point_2& q) const + Comparison_result operator()(const Point_2& p, const Point_2& q) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_y_2.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_y_2.h index da9b97215a8..043a174ce99 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_y_2.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_y_2.h @@ -31,17 +31,16 @@ template < typename K_base > class Compare_y_2 : public K_base::Compare_y_2 { - typedef typename K_base::Point_2 Point_2; - typedef typename K_base::Line_2 Line_2; - typedef typename K_base::Compare_y_2 Base; + typedef typename K_base::Comparison_result Comparison_result; + typedef typename K_base::Point_2 Point_2; + typedef typename K_base::Line_2 Line_2; + + typedef typename K_base::Compare_y_2 Base; public: - - typedef typename Base::result_type result_type; - using Base::operator(); - result_type operator()(const Point_2 &p, const Point_2& q) const + Comparison_result operator()(const Point_2 &p, const Point_2& q) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_y_at_x_2.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_y_at_x_2.h index 5de1af9d7b2..8c9204f718f 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_y_at_x_2.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Compare_y_at_x_2.h @@ -22,13 +22,14 @@ template < typename K_base, typename Kernel > class Compare_y_at_x_2 : public K_base::Compare_y_at_x_2 { - typedef typename K_base::Point_2 Point_2; - typedef typename K_base::Segment_2 Segment_2; - typedef typename K_base::FT FT; - typedef typename K_base::Compare_y_at_x_2 Base; + typedef typename K_base::Comparison_result Comparison_result; + typedef typename K_base::Point_2 Point_2; + typedef typename K_base::Segment_2 Segment_2; + typedef typename K_base::FT FT; + + typedef typename K_base::Compare_y_at_x_2 Base; public: - using Base::operator(); Comparison_result diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_3.h index fedf31fcba9..38c4384769c 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_3.h @@ -25,17 +25,14 @@ template < typename K_base, typename SFK > class Coplanar_3 : public K_base::Coplanar_3 { - typedef typename K_base::Point_3 Point_3; + typedef typename K_base::Boolean Boolean; + typedef typename K_base::Point_3 Point_3; + typedef typename K_base::Coplanar_3 Base; typedef typename SFK::Orientation_3 Orientation_3; public: - - typedef typename Base::result_type result_type; - - - - result_type + Boolean operator()(const Point_3& p,const Point_3& q, const Point_3& r, const Point_3& s) const { return Orientation_3()(p,q,r,s) == COPLANAR; diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_orientation_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_orientation_3.h index 212dddec6cf..255f95c1ab7 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_orientation_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_orientation_3.h @@ -40,12 +40,12 @@ template < typename Kernel > class Coplanar_orientation_3 : public Kernel::Coplanar_orientation_3 { + typedef typename Kernel::Orientation Orientation; typedef typename Kernel::Point_3 Point_3; + typedef typename Kernel::Coplanar_orientation_3 Base; public: - typedef Orientation result_type; - Orientation operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r) const { return opti_coplanar_orientationC3( diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_2.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_2.h index a5533c253fa..088648b9d72 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_2.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_2.h @@ -28,16 +28,13 @@ template < typename K_base, typename SFK > class Do_intersect_2 : public K_base::Do_intersect_2 { + typedef typename K_base::Boolean Boolean; typedef typename K_base::Point_2 Point_2; typedef typename K_base::Segment_2 Segment_2; + typedef typename K_base::Do_intersect_2 Base; - typedef K_base TA1; - typedef SFK TA2; public: - - typedef typename Base::result_type result_type; - using Base::operator(); // The internal::do_intersect(..) function @@ -47,19 +44,19 @@ public: // the statically filtered kernel we avoid // that doubles are put into Interval_nt // to get taken out again with fit_in_double - result_type + Boolean operator()(const Segment_2 &s, const Segment_2& t) const { return Intersections::internal::do_intersect(s,t, SFK()); } - result_type + Boolean operator()(const Point_2 &p, const Segment_2& t) const { return Intersections::internal::do_intersect(p,t, SFK()); } - result_type + Boolean operator()(const Segment_2& t, const Point_2 &p) const { return Intersections::internal::do_intersect(p,t, SFK()); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_3.h index 2b0ef97d7fc..1d19ce5a469 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_3.h @@ -39,18 +39,17 @@ template < typename K_base, typename SFK > class Do_intersect_3 : public K_base::Do_intersect_3 { + typedef typename K_base::Boolean Boolean; typedef typename K_base::Point_3 Point_3; typedef typename K_base::Ray_3 Ray_3; typedef typename K_base::Segment_3 Segment_3; typedef typename K_base::Triangle_3 Triangle_3; typedef typename K_base::Tetrahedron_3 Tetrahedron_3; typedef typename K_base::Sphere_3 Sphere_3; + typedef typename K_base::Do_intersect_3 Base; public: - - typedef typename Base::result_type result_type; - using Base::operator(); Sign sign_with_error(const double x, const double error) const { @@ -67,32 +66,31 @@ public: // the statically filtered kernel we avoid // that doubles are put into Interval_nt // to get taken out again with fit_in_double - result_type + Boolean operator()(const Segment_3 &s, const Triangle_3& t) const { return Intersections::internal::do_intersect(t,s, SFK()); } - result_type + Boolean operator()(const Triangle_3& t, const Segment_3 &s) const { return Intersections::internal::do_intersect(t,s, SFK()); } - result_type + Boolean operator()(const Triangle_3 &t0, const Triangle_3& t1) const { return Intersections::internal::do_intersect(t0,t1, SFK()); } - - result_type + Boolean operator()(const Bbox_3& b, const Segment_3 &s) const { return this->operator()(s, b); } - result_type + Boolean operator()(const Segment_3 &s, const Bbox_3& b) const { CGAL_BRANCH_PROFILER_3(std::string("semi-static failures/attempts/calls to : ") + @@ -111,7 +109,7 @@ public: { CGAL_BRANCH_PROFILER_BRANCH_1(tmp); - const Uncertain ub = + const Uncertain ub = Intersections::internal::do_intersect_bbox_segment_aux operator()(t, b); } - result_type + Boolean operator()(const Tetrahedron_3 &t, const Bbox_3& b) const { CGAL_BRANCH_PROFILER_3(std::string("semi-static failures/attempts/calls to : ") + @@ -168,13 +166,13 @@ public: return Base::operator()(t,b); } - result_type + Boolean operator()(const Bbox_3& b, const Ray_3 &r) const { return this->operator()(r, b); } - result_type + Boolean operator()(const Ray_3 &r, const Bbox_3& b) const { CGAL_BRANCH_PROFILER_3(std::string("semi-static failures/attempts/calls to : ") + @@ -193,7 +191,7 @@ public: { CGAL_BRANCH_PROFILER_BRANCH_1(tmp); - const Uncertain ub = + const Uncertain ub = Intersections::internal::do_intersect_bbox_segment_aux operator()(t, b); @@ -487,7 +484,7 @@ public: return false; }; - result_type + Boolean operator()(const Triangle_3 &t, const Bbox_3& b) const { CGAL_BRANCH_PROFILER_3(std::string("semi-static failures/attempts/calls to : ") + @@ -616,14 +613,14 @@ public: return Base::operator()(t,b); } - result_type + Boolean operator()(const Bbox_3& b, const Sphere_3 &s) const { return this->operator()(s, b); } // The parameter overestimate is used to avoid a filter failure in AABB_tree::closest_point() - result_type + Boolean operator()(const Sphere_3 &s, const Bbox_3& b, bool overestimate = false) const { CGAL_BRANCH_PROFILER_3(std::string("semi-static failures/attempts/calls to : ") + diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Equal_2.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Equal_2.h index 60b2360a939..79832da2535 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Equal_2.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Equal_2.h @@ -31,18 +31,16 @@ template < typename K_base > class Equal_2 : public K_base::Equal_2 { + typedef typename K_base::Boolean Boolean; typedef typename K_base::FT FT; typedef typename K_base::Point_2 Point_2; typedef typename K_base::Vector_2 Vector_2; typedef typename K_base::Equal_2 Base; public: - - typedef typename Base::result_type result_type; - using Base::operator(); - result_type operator()(const Point_2 &p, const Point_2& q) const + Boolean operator()(const Point_2& p, const Point_2& q) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); @@ -61,8 +59,7 @@ public: return Base::operator()(p, q); } - - result_type operator()(const Vector_2 &p, const Vector_2& q) const + Boolean operator()(const Vector_2& p, const Vector_2& q) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Equal_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Equal_3.h index 10c44051ae2..5d04c892d7f 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Equal_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Equal_3.h @@ -31,17 +31,16 @@ template < typename K_base > class Equal_3 : public K_base::Equal_3 { + typedef typename K_base::Boolean Boolean; typedef typename K_base::Point_3 Point_3; typedef typename K_base::Vector_3 Vector_3; + typedef typename K_base::Equal_3 Base; public: - - typedef typename Base::result_type result_type; - using Base::operator(); - result_type operator()(const Point_3 &p, const Point_3& q) const + Boolean operator()(const Point_3& p, const Point_3& q) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); @@ -62,7 +61,7 @@ public: } - result_type operator()(const Vector_3 &p, const Vector_3& q) const + Boolean operator()(const Vector_3& p, const Vector_3& q) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); @@ -83,7 +82,7 @@ public: } - result_type operator()(const Vector_3 &p, const Null_vector &q) const + Boolean operator()(const Vector_3& p, const Null_vector& q) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Is_degenerate_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Is_degenerate_3.h index a4af481f7e1..6b43f629126 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Is_degenerate_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Is_degenerate_3.h @@ -25,6 +25,7 @@ template < typename K_base, typename SFK > class Is_degenerate_3 : public K_base::Is_degenerate_3 { + typedef typename K_base::Boolean Boolean; typedef typename K_base::Ray_3 Ray_3; typedef typename K_base::Segment_3 Segment_3; typedef typename K_base::Plane_3 Plane_3; @@ -35,25 +36,21 @@ class Is_degenerate_3 typedef typename SFK::Equal_3 Equal_3; public: - - typedef typename Base::result_type result_type; - using Base::operator(); - result_type + Boolean operator()(const Segment_3& s) const { return Equal_3()(Construct_source_3()(s), Construct_target_3()(s)); } - - result_type + Boolean operator()(const Ray_3& r) const { return Equal_3()(Construct_source_3()(r), Construct_second_point_3()(r)); } - result_type + Boolean operator()(const Plane_3& p) const { CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Orientation_2.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Orientation_2.h index cbb4494e7cd..11cd803458a 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Orientation_2.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Orientation_2.h @@ -25,16 +25,14 @@ template < typename K_base > class Orientation_2 : public K_base::Orientation_2 { + typedef typename K_base::Orientation Orientation; typedef typename K_base::Point_2 Point_2; typedef typename K_base::Vector_2 Vector_2; - typedef typename K_base::Circle_2 Circle_2; + typedef typename K_base::Circle_2 Circle_2; typedef typename K_base::Orientation_2 Base; public: - - typedef typename Base::result_type result_type; - using Base::operator(); Orientation diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Orientation_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Orientation_3.h index 2fdffde6fda..f7d126dfaf0 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Orientation_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Orientation_3.h @@ -27,18 +27,18 @@ template < typename K_base > class Orientation_3 : public K_base::Orientation_3 { + typedef typename K_base::Orientation Orientation; typedef typename K_base::Point_3 Point_3; typedef typename K_base::Vector_3 Vector_3; typedef typename K_base::Sphere_3 Sphere_3; typedef typename K_base::Tetrahedron_3 Tetrahedron_3; + typedef typename K_base::Orientation_3 Base; public: - typedef typename Base::result_type result_type; - using Base::operator(); - result_type + Orientation operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r, const Point_3 &s) const { diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Power_side_of_oriented_power_sphere_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Power_side_of_oriented_power_sphere_3.h index d4621b756a5..fe2057ca243 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 3b59fed08db..0762a4948f4 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_circle_2.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_circle_2.h @@ -23,11 +23,11 @@ template < typename K_base > class Side_of_oriented_circle_2 : public K_base::Side_of_oriented_circle_2 { + typedef typename K_base::Oriented_side Oriented_side; typedef typename K_base::Point_2 Point_2; typedef typename K_base::Side_of_oriented_circle_2 Base; public: - Oriented_side operator()(const Point_2 &p, const Point_2 &q, const Point_2 &r, const Point_2 &t) const { diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_sphere_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_sphere_3.h index 41a54d33012..90b128c5eee 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_sphere_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_sphere_3.h @@ -22,11 +22,11 @@ template < typename K_base > class Side_of_oriented_sphere_3 : public K_base::Side_of_oriented_sphere_3 { + typedef typename K_base::Oriented_side Oriented_side; typedef typename K_base::Point_3 Point_3; typedef typename K_base::Side_of_oriented_sphere_3 Base; public: - Oriented_side operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r, const Point_3 &s, const Point_3 &t) const diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h b/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h index 3028950d7af..c7aefef8197 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h @@ -49,26 +49,27 @@ namespace HomogeneousKernelFunctors { template class Angle_2 { + typedef typename K::Angle Angle; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; typedef typename K::Construct_vector_2 Construct_vector_2; - Construct_vector_2 c; - public: - typedef typename K::Angle result_type; + Construct_vector_2 c; + + public: Angle_2() {} Angle_2(const Construct_vector_2& c_) : c(c_) {} - result_type + Angle operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { return operator()(c(q,p), c(q,r)); } - result_type + Angle operator()(const Point_2& p, const Point_2& q, const Point_2& r, const Point_2& s) const { return operator()(c(q,p), c(s,r)); } - result_type + Angle operator()(const Vector_2& u, const Vector_2& v) const { return enum_cast(CGAL_NTS sign(u * v)); } @@ -78,33 +79,34 @@ namespace HomogeneousKernelFunctors { template class Angle_3 { + typedef typename K::Angle Angle; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::Construct_vector_3 Construct_vector_3; - Construct_vector_3 c; - public: - typedef typename K::Angle result_type; + Construct_vector_3 c; + + public: Angle_3() {} Angle_3(const Construct_vector_3& c_) : c(c_) {} - result_type + Angle operator()(const Vector_3& u, const Vector_3& v) const { return enum_cast(CGAL_NTS sign(u * v)); } // FIXME: scalar product - result_type + Angle operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { return enum_cast(CGAL_NTS sign(c(q,p) * c(q,r))); } // FIXME: scalar product - result_type + Angle operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { return enum_cast(CGAL_NTS sign(c(q,p) * c(s,r))); } // FIXME: scalar product - result_type + Angle operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Vector_3& n) const { @@ -116,14 +118,14 @@ namespace HomogeneousKernelFunctors { template class Bounded_side_2 { + typedef typename K::Bounded_side Bounded_side; typedef typename K::Point_2 Point_2; typedef typename K::Circle_2 Circle_2; typedef typename K::Triangle_2 Triangle_2; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; - public: - typedef typename K::Bounded_side result_type; - result_type + public: + Bounded_side operator()( const Circle_2& c, const Point_2& p) const { typename K::Compute_squared_distance_2 squared_distance; @@ -131,7 +133,7 @@ namespace HomogeneousKernelFunctors { squared_distance(c.center(),p))); } - result_type + Bounded_side operator()( const Triangle_2& t, const Point_2& p) const { typename K::Collinear_are_ordered_along_line_2 @@ -154,7 +156,7 @@ namespace HomogeneousKernelFunctors { : ON_UNBOUNDED_SIDE; } - result_type + Bounded_side operator()( const Iso_rectangle_2& r, const Point_2& p) const { return r.rep().bounded_side(p); @@ -164,20 +166,20 @@ namespace HomogeneousKernelFunctors { template class Bounded_side_3 { + typedef typename K::Bounded_side Bounded_side; typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::Sphere_3 Sphere_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Iso_cuboid_3 Iso_cuboid_3; - public: - typedef typename K::Bounded_side result_type; - result_type + public: + Bounded_side operator()( const Sphere_3& s, const Point_3& p) const { return s.rep().bounded_side(p); } - result_type + Bounded_side operator()( const Tetrahedron_3& t, const Point_3& p) const { Vector_3 v1 = t.vertex(1)-t.vertex(0); @@ -250,7 +252,7 @@ namespace HomogeneousKernelFunctors { return (t5 && t6) ? ON_BOUNDED_SIDE : ON_BOUNDARY; } - result_type + Bounded_side operator()( const Iso_cuboid_3& c, const Point_3& p) const { return c.rep().bounded_side(p); } }; @@ -258,21 +260,21 @@ namespace HomogeneousKernelFunctors { template class Collinear_are_ordered_along_line_2 { + typedef typename K::Boolean Boolean; typedef typename K::RT RT; typedef typename K::Point_2 Point_2; #ifdef CGAL_kernel_exactness_preconditions typedef typename K::Collinear_2 Collinear_2; Collinear_2 c; #endif // CGAL_kernel_exactness_preconditions - public: - typedef typename K::Boolean result_type; + public: #ifdef CGAL_kernel_exactness_preconditions Collinear_are_ordered_along_line_2() {} Collinear_are_ordered_along_line_2(const Collinear_2& c_) : c(c_) {} #endif // CGAL_kernel_exactness_preconditions - result_type + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { CGAL_kernel_exactness_precondition( c(p, q, r) ); @@ -309,20 +311,20 @@ namespace HomogeneousKernelFunctors { template class Collinear_are_ordered_along_line_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; #ifdef CGAL_kernel_exactness_preconditions typedef typename K::Collinear_3 Collinear_3; Collinear_3 c; #endif // CGAL_kernel_exactness_preconditions - public: - typedef typename K::Boolean result_type; + public: #ifdef CGAL_kernel_exactness_preconditions Collinear_are_ordered_along_line_3() {} Collinear_are_ordered_along_line_3(const Collinear_3& c_) : c(c_) {} #endif // CGAL_kernel_exactness_preconditions - result_type + Boolean operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { CGAL_kernel_exactness_precondition( c(p, q, r) ); @@ -390,21 +392,21 @@ namespace HomogeneousKernelFunctors { template class Collinear_are_strictly_ordered_along_line_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; #ifdef CGAL_kernel_exactness_preconditions typedef typename K::Collinear_2 Collinear_2; Collinear_2 c; #endif // CGAL_kernel_exactness_preconditions - public: - typedef typename K::Boolean result_type; + public: #ifdef CGAL_kernel_exactness_preconditions Collinear_are_strictly_ordered_along_line_2() {} Collinear_are_strictly_ordered_along_line_2(const Collinear_2& c_) : c(c_) {} #endif // CGAL_kernel_exactness_preconditions - result_type + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { CGAL_kernel_exactness_precondition( c(p, q, r) ); @@ -440,22 +442,22 @@ namespace HomogeneousKernelFunctors { template class Collinear_are_strictly_ordered_along_line_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Direction_3 Direction_3; #ifdef CGAL_kernel_exactness_preconditions typedef typename K::Collinear_3 Collinear_3; Collinear_3 c; #endif // CGAL_kernel_exactness_preconditions - public: - typedef typename K::Boolean result_type; + public: #ifdef CGAL_kernel_exactness_preconditions Collinear_are_strictly_ordered_along_line_3() {} Collinear_are_strictly_ordered_along_line_3(const Collinear_3& c_) : c(c_) {} #endif // CGAL_kernel_exactness_preconditions - result_type + Boolean operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { CGAL_kernel_exactness_precondition( c(p, q, r) ); @@ -469,6 +471,7 @@ namespace HomogeneousKernelFunctors { template class Collinear_has_on_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Direction_2 Direction_2; typedef typename K::Ray_2 Ray_2; @@ -480,23 +483,22 @@ namespace HomogeneousKernelFunctors { Collinear_are_ordered_along_line_2 co; Construct_point_on_2 cp; Compare_xy_2 cxy; - public: - typedef typename K::Boolean result_type; + public: Collinear_has_on_2() {} Collinear_has_on_2(const Construct_point_on_2& cp_, const Compare_xy_2& cxy_) : cp(cp_), cxy(cxy_) {} - result_type + Boolean operator()( const Ray_2& r, const Point_2& p) const { const Point_2 & source = cp(r,0); return p == source || Direction_2(p - source) == r.direction(); } // FIXME - result_type + Boolean operator()( const Segment_2& s, const Point_2& p) const { return co(cp(s,0), p, cp(s,1)); @@ -506,16 +508,17 @@ namespace HomogeneousKernelFunctors { template class Collinear_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Orientation_2 Orientation_2; - Orientation_2 o; - public: - typedef typename K::Boolean result_type; + Orientation_2 o; + + public: Collinear_2() {} Collinear_2(const Orientation_2 o_) : o(o_) {} - result_type + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { typedef typename K::RT RT; @@ -558,13 +561,13 @@ namespace HomogeneousKernelFunctors { template class Compare_angle_with_x_axis_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; typedef typename K::Direction_2 Direction_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Direction_2& d1, const Direction_2& d2) const { typedef typename K::RT RT; @@ -625,11 +628,11 @@ namespace HomogeneousKernelFunctors { template class Compare_distance_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { typedef typename K::RT RT; @@ -673,14 +676,14 @@ namespace HomogeneousKernelFunctors { } template - result_type + Comparison_result operator()(const T1& p, const T2& q, const T3& r) const { return CGAL::compare(squared_distance(p, q), squared_distance(p, r)); } template - result_type + Comparison_result operator()(const T1& p, const T2& q, const T3& r, const T4& s) const { return CGAL::compare(squared_distance(p, q), squared_distance(r, s)); @@ -690,11 +693,11 @@ namespace HomogeneousKernelFunctors { template class Compare_distance_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { typedef typename K::RT RT; @@ -724,16 +727,15 @@ namespace HomogeneousKernelFunctors { return CGAL_NTS sign(dosd); } - template - result_type + Comparison_result operator()(const T1& p, const T2& q, const T3& r) const { return CGAL::compare(squared_distance(p, q), squared_distance(p, r)); } template - result_type + Comparison_result operator()(const T1& p, const T2& q, const T3& r, const T4& s) const { return CGAL::compare(squared_distance(p, q), squared_distance(r, s)); @@ -743,13 +745,11 @@ namespace HomogeneousKernelFunctors { template < typename K > class Compare_power_distance_2 { - public: + typedef typename K::Comparison_result Comparison_result; typedef typename K::Weighted_point_2 Weighted_point_2; typedef typename K::Point_2 Point_2; - typedef typename K::Comparison_result Comparison_result; - - typedef Comparison_result result_type; + public: Comparison_result operator()(const Point_2& r, const Weighted_point_2& p, const Weighted_point_2& q) const @@ -763,14 +763,13 @@ namespace HomogeneousKernelFunctors { template class Compare_signed_distance_to_line_2 { - typedef typename K::Point_2 Point_2; - typedef typename K::Line_2 Line_2; + typedef typename K::Comparison_result Comparison_result; + typedef typename K::Point_2 Point_2; + typedef typename K::Line_2 Line_2; typedef typename K::Less_signed_distance_to_line_2 Less_signed_distance_to_line_2; public: - typedef Comparison_result result_type; - - result_type + Comparison_result operator()(const Point_2& p, const Point_2& q, const Point_2& r, const Point_2& s) const { @@ -796,7 +795,7 @@ namespace HomogeneousKernelFunctors { return compare(scaled_dist_r_minus_scaled_dist_s, 0); } - result_type + Comparison_result operator()(const Line_2& l, const Point_2& p, const Point_2& q) const { Less_signed_distance_to_line_2 less = K().less_signed_distance_to_line_2_object(); @@ -809,13 +808,13 @@ namespace HomogeneousKernelFunctors { template class Compare_slope_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; typedef typename K::Segment_2 Segment_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()(const Line_2& l1, const Line_2& l2) const { if (l1.is_horizontal()) @@ -840,22 +839,22 @@ namespace HomogeneousKernelFunctors { CGAL::abs(l1.a() * l2.b()) ); } // FIXME - result_type + Comparison_result operator()(const Segment_2& s1, const Segment_2& s2) const { return (*this)(s1.source(), s1.target(), s2.source(), s2.target()); } - result_type + Comparison_result operator()(const Point_2& s1s, const Point_2& s1t, const Point_2& s2s, const Point_2& s2t) const { typedef typename K::FT FT; - typename K::Comparison_result cmp_y1 = compare_y(s1s, s1t); + Comparison_result cmp_y1 = compare_y(s1s, s1t); if (cmp_y1 == EQUAL) // horizontal { - typename K::Comparison_result cmp_x2 = compare_x(s2s, s2t); + Comparison_result cmp_x2 = compare_x(s2s, s2t); if (cmp_x2 == EQUAL) return SMALLER; FT s_hw = s2s.hw(); @@ -864,10 +863,10 @@ namespace HomogeneousKernelFunctors { CGAL_NTS sign(s2s.hx()*t_hw - s2t.hx()*s_hw); } - typename K::Comparison_result cmp_y2 = compare_y(s2s, s2t); + Comparison_result cmp_y2 = compare_y(s2s, s2t); if (cmp_y2 == EQUAL) { - typename K::Comparison_result cmp_x1 = compare_x(s1s, s1t); + Comparison_result cmp_x1 = compare_x(s1s, s1t); if (cmp_x1 == EQUAL) return LARGER; FT s_hw = s1s.hw(); @@ -876,8 +875,8 @@ namespace HomogeneousKernelFunctors { CGAL_NTS sign(s1s.hx()*t_hw - s1t.hx()*s_hw); } - typename K::Comparison_result cmp_x1 = compare_x(s1s, s1t); - typename K::Comparison_result cmp_x2 = compare_x(s2s, s2t); + Comparison_result cmp_x1 = compare_x(s1s, s1t); + Comparison_result cmp_x2 = compare_x(s2s, s2t); if (cmp_x1 == EQUAL) return cmp_x2 == EQUAL ? EQUAL : LARGER; @@ -909,12 +908,12 @@ namespace HomogeneousKernelFunctors { template class Compare_x_at_y_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Line_2& h) const { typedef typename K::RT RT; @@ -927,17 +926,17 @@ namespace HomogeneousKernelFunctors { return ( ors == ON_NEGATIVE_SIDE ) ? SMALLER : EQUAL; } // FIXME - result_type + Comparison_result operator()( const Point_2& p, const Line_2& h1, const Line_2& h2) const { return CGAL::compare(h1.x_at_y( p.y() ), h2.x_at_y( p.y() )); } // FIXME - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h) const { return compare_x_at_y( gp_linear_intersection( l1, l2 ), h); } // FIXME - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h1, const Line_2& h2) const { return compare_x_at_y( gp_linear_intersection( l1, l2 ), h1, h2 ); } @@ -947,11 +946,11 @@ namespace HomogeneousKernelFunctors { template class Compare_xyz_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { typedef typename K::RT RT; @@ -986,11 +985,11 @@ namespace HomogeneousKernelFunctors { template class Compare_xy_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Point_2& q) const { typedef typename K::RT RT; @@ -1016,11 +1015,11 @@ namespace HomogeneousKernelFunctors { template class Compare_yx_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Point_2& q) const { typedef typename K::RT RT; @@ -1046,11 +1045,11 @@ namespace HomogeneousKernelFunctors { template class Compare_xy_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { typedef typename K::RT RT; @@ -1074,31 +1073,31 @@ namespace HomogeneousKernelFunctors { template class Compare_x_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Point_2& q) const { return CGAL::compare(p.hx()*q.hw(), q.hx()*p.hw()); } - result_type + Comparison_result operator()( const Point_2& p, const Line_2& l1, const Line_2& l2) const { Point_2 ip = gp_linear_intersection( l1, l2 ); return this->operator()(p, ip); } // FIXME - result_type + Comparison_result operator()( const Line_2& l, const Line_2& h1, const Line_2& h2) const { return this->operator()(l, h1, l, h2); } // FIXME - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h1, const Line_2& h2) const { @@ -1111,11 +1110,11 @@ namespace HomogeneousKernelFunctors { template class Compare_x_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { return CGAL::compare(p.hx() * q.hw(), q.hx() * p.hw() ); } }; @@ -1123,13 +1122,13 @@ namespace HomogeneousKernelFunctors { template class Compare_y_at_x_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; typedef typename K::Segment_2 Segment_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Line_2& h) const { CGAL_kernel_precondition( ! h.is_vertical() ); @@ -1139,23 +1138,23 @@ namespace HomogeneousKernelFunctors { return ors; } // FIXME - result_type + Comparison_result operator()( const Point_2& p, const Line_2& h1, const Line_2& h2) const { return CGAL::compare(h1.y_at_x( p.x() ), h2.y_at_x( p.x() )); } // FIXME - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h) const { return compare_y_at_x( gp_linear_intersection( l1, l2 ), h); } // FIXME - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h1, const Line_2& h2) const { return compare_y_at_x( gp_linear_intersection( l1, l2 ), h1, h2 ); } // FIXME - result_type + Comparison_result operator()( const Point_2& p, const Segment_2& s) const { // compares the y-coordinates of p and the vertical projection of p on s. @@ -1183,7 +1182,7 @@ namespace HomogeneousKernelFunctors { } } // FIXME - result_type + Comparison_result operator()( const Point_2& p, const Segment_2& s1, const Segment_2& s2) const { @@ -1243,12 +1242,12 @@ namespace HomogeneousKernelFunctors { template class Compare_y_2 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_2& p, const Point_2& q) const { typedef typename K::RT RT; @@ -1260,20 +1259,20 @@ namespace HomogeneousKernelFunctors { return CGAL::compare(phy * qhw, qhy * phw); } - result_type + Comparison_result operator()( const Point_2& p, const Line_2& l1, const Line_2& l2) const { Point_2 ip = gp_linear_intersection( l1, l2 ); return compare_y( p, ip ); } // FIXME - result_type + Comparison_result operator()( const Line_2& l, const Line_2& h1, const Line_2& h2) const { return this->operator()(l, h1, l, h2); } - result_type + Comparison_result operator()( const Line_2& l1, const Line_2& l2, const Line_2& h1, const Line_2& h2) const { @@ -1286,11 +1285,11 @@ namespace HomogeneousKernelFunctors { template class Compare_y_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { return CGAL::compare(p.hy() * q.hw(), q.hy() * p.hw() ); } }; @@ -1298,11 +1297,11 @@ namespace HomogeneousKernelFunctors { template class Compare_z_3 { + typedef typename K::Comparison_result Comparison_result; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Comparison_result result_type; - result_type + public: + Comparison_result operator()( const Point_3& p, const Point_3& q) const { return CGAL::compare(p.hz() * q.hw(), q.hz() * p.hw() ); } }; @@ -1317,10 +1316,10 @@ namespace HomogeneousKernelFunctors { typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; typedef typename K::Construct_vector_2 Construct_vector_2; - Construct_vector_2 co; - public: - typedef FT result_type; + Construct_vector_2 co; + + public: FT operator()( const Point_2& p, const Point_2& q, const Point_2& r ) const { @@ -1346,10 +1345,9 @@ namespace HomogeneousKernelFunctors { { typedef typename K::FT FT; typedef typename K::Vector_2 Vector_2; - public: - typedef FT result_type; - result_type + public: + FT operator()(const Vector_2& v, const Vector_2& w) const { return determinant(v.hx(), v.hy(), @@ -1362,10 +1360,9 @@ namespace HomogeneousKernelFunctors { { typedef typename K::FT FT; typedef typename K::Vector_3 Vector_3; - public: - typedef FT result_type; - result_type + public: + FT operator()(const Vector_3& v, const Vector_3& w, const Vector_3& t) const { return determinant(v.hx(), v.hy(), v.hz(), @@ -1381,9 +1378,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::RT RT; typedef typename K::FT FT; typedef typename K::Vector_2 Vector_2; - public: - typedef FT result_type; + public: FT operator()(const Vector_2& v, const Vector_2& w) const { @@ -1398,9 +1394,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::RT RT; typedef typename K::FT FT; typedef typename K::Vector_3 Vector_3; - public: - typedef FT result_type; + public: FT operator()(const Vector_3& v, const Vector_3& w) const { @@ -1416,10 +1411,9 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Circle_2 Circle_2; - public: - typedef FT result_type; - FT + public: + decltype(auto) operator()( const Circle_2& c) const { return c.rep().squared_radius(); } @@ -1446,10 +1440,9 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Sphere_3 Sphere_3; - public: - typedef FT result_type; - FT + public: + decltype(auto) operator()( const Sphere_3& s) const { return s.rep().squared_radius(); } @@ -1486,9 +1479,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Vector_3 Vector_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Iso_cuboid_3 Iso_cuboid_3; - public: - typedef FT result_type; + public: FT operator()(const Point_3& p0, const Point_3& p1, const Point_3& p2, const Point_3& p3) const @@ -1531,20 +1523,17 @@ namespace HomogeneousKernelFunctors { template class Compute_x_2 { - typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: - typedef FT result_type; - - FT + decltype(auto) operator()(const Point_2& p) const { return p.rep().x(); } - FT + decltype(auto) operator()(const Vector_2& v) const { return v.rep().x(); @@ -1554,20 +1543,17 @@ namespace HomogeneousKernelFunctors { template class Compute_x_3 { - typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef FT result_type; - - FT + decltype(auto) operator()(const Point_3& p) const { return p.rep().x(); } - FT + decltype(auto) operator()(const Vector_3& v) const { return v.rep().x(); @@ -1577,20 +1563,17 @@ namespace HomogeneousKernelFunctors { template class Compute_y_2 { - typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: - typedef FT result_type; - - FT + decltype(auto) operator()(const Point_2& p) const { return p.rep().y(); } - FT + decltype(auto) operator()(const Vector_2& v) const { return v.rep().y(); @@ -1600,20 +1583,17 @@ namespace HomogeneousKernelFunctors { template class Compute_y_3 { - typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef FT result_type; - - FT + decltype(auto) operator()(const Point_3& p) const { return p.rep().y(); } - FT + decltype(auto) operator()(const Vector_3& v) const { return v.rep().y(); @@ -1623,20 +1603,17 @@ namespace HomogeneousKernelFunctors { template class Compute_z_3 { - typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef FT result_type; - - FT + decltype(auto) operator()(const Point_3& p) const { return p.rep().z(); } - FT + decltype(auto) operator()(const Vector_3& v) const { return v.rep().z(); @@ -1646,13 +1623,10 @@ namespace HomogeneousKernelFunctors { template class Compute_dx_2 { - typedef typename K::RT RT; typedef typename K::Direction_2 Direction_2; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Direction_2& d) const { return d.rep().dx(); @@ -1662,13 +1636,10 @@ namespace HomogeneousKernelFunctors { template class Compute_dx_3 { - typedef typename K::RT RT; typedef typename K::Direction_3 Direction_3; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Direction_3& d) const { return d.rep().dx(); @@ -1678,13 +1649,10 @@ namespace HomogeneousKernelFunctors { template class Compute_dy_2 { - typedef typename K::RT RT; typedef typename K::Direction_2 Direction_2; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Direction_2& d) const { return d.rep().dy(); @@ -1694,13 +1662,10 @@ namespace HomogeneousKernelFunctors { template class Compute_dy_3 { - typedef typename K::RT RT; typedef typename K::Direction_3 Direction_3; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Direction_3& d) const { return d.rep().dy(); @@ -1710,13 +1675,10 @@ namespace HomogeneousKernelFunctors { template class Compute_dz_3 { - typedef typename K::RT RT; typedef typename K::Direction_3 Direction_3; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Direction_3& d) const { return d.rep().dz(); @@ -1726,21 +1688,17 @@ namespace HomogeneousKernelFunctors { template class Compute_hx_2 { - typedef typename K::FT FT; - typedef typename K::RT RT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Point_2& p) const { return p.rep().hx(); } - result_type + decltype(auto) operator()(const Vector_2& v) const { return v.rep().hx(); @@ -1750,21 +1708,17 @@ namespace HomogeneousKernelFunctors { template class Compute_hx_3 { - typedef typename K::FT FT; - typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Point_3& p) const { return p.rep().hx(); } - result_type + decltype(auto) operator()(const Vector_3& v) const { return v.rep().hx(); @@ -1774,21 +1728,17 @@ namespace HomogeneousKernelFunctors { template class Compute_hy_2 { - typedef typename K::FT FT; - typedef typename K::RT RT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Point_2& p) const { return p.rep().hy(); } - result_type + decltype(auto) operator()(const Vector_2& v) const { return v.rep().hy(); @@ -1798,21 +1748,17 @@ namespace HomogeneousKernelFunctors { template class Compute_hy_3 { - typedef typename K::FT FT; - typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef const RT & result_type; - - result_type + decltype(auto) operator()(const Point_3& p) const { return p.rep().hy(); } - result_type + decltype(auto) operator()(const Vector_3& v) const { return v.rep().hy(); @@ -1822,21 +1768,17 @@ namespace HomogeneousKernelFunctors { template class Compute_hz_3 { - typedef typename K::FT FT; - typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Point_3& p) const { return p.rep().hz(); } - result_type + decltype(auto) operator()(const Vector_3& v) const { return v.rep().hz(); @@ -1846,21 +1788,17 @@ namespace HomogeneousKernelFunctors { template class Compute_hw_2 { - typedef typename K::FT FT; - typedef typename K::RT RT; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Point_2& p) const { return p.rep().hw(); } - result_type + decltype(auto) operator()(const Vector_2& v) const { return v.rep().hw(); @@ -1870,21 +1808,17 @@ namespace HomogeneousKernelFunctors { template class Compute_hw_3 { - typedef typename K::FT FT; - typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; public: - typedef const RT& result_type; - - result_type + decltype(auto) operator()(const Point_3& p) const { return p.rep().hw(); } - result_type + decltype(auto) operator()(const Vector_3& v) const { return v.rep().hw(); @@ -1898,11 +1832,11 @@ namespace HomogeneousKernelFunctors { typedef typename K::Plane_3 Plane_3; typedef typename K::RT RT; typedef typename K::Construct_orthogonal_vector_3 + Construct_orthogonal_vector_3; Construct_orthogonal_vector_3 co; - public: - typedef Vector_3 result_type; + public: Construct_base_vector_3() {} Construct_base_vector_3(const Construct_orthogonal_vector_3& co_) : co(co_) @@ -1951,9 +1885,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Iso_rectangle_2 Iso_rectangle_2; typedef typename K::Triangle_2 Triangle_2; typedef typename K::Circle_2 Circle_2; - public: - typedef Bbox_2 result_type; + public: Bbox_2 operator()( const Point_2& p) const { @@ -2016,9 +1949,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Iso_cuboid_3 Iso_cuboid_3; typedef typename K::Sphere_3 Sphere_3; - public: - typedef Bbox_3 result_type; + public: Bbox_3 operator()(const Point_3& p) const { @@ -2091,12 +2023,10 @@ namespace HomogeneousKernelFunctors { class Construct_bisector_2 { typedef typename K::RT RT; - typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; - public: - typedef Line_2 result_type; + public: Line_2 operator()(const Point_2& p, const Point_2& q) const { @@ -2134,12 +2064,10 @@ namespace HomogeneousKernelFunctors { class Construct_bisector_3 { typedef typename K::RT RT; - typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Plane_3 Plane_3; - public: - typedef Plane_3 result_type; + public: Plane_3 operator()(const Point_3& p, const Point_3& q) const { @@ -2180,16 +2108,14 @@ namespace HomogeneousKernelFunctors { template class Construct_centroid_2 { - typedef typename K::FT FT; + typedef typename K::RT RT; typedef typename K::Point_2 Point_2; typedef typename K::Triangle_2 Triangle_2; - public: - typedef Point_2 result_type; + public: Point_2 operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { - typedef typename K::RT RT; const RT phw(p.hw()); const RT qhw(q.hw()); const RT rhw(r.hw()); @@ -2230,9 +2156,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Triangle_3 Triangle_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; - public: - typedef Point_3 result_type; + public: Point_3 operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { @@ -2281,12 +2206,11 @@ namespace HomogeneousKernelFunctors { template class Construct_circumcenter_2 { - typedef typename K::FT FT; + typedef typename K::RT RT; typedef typename K::Point_2 Point_2; typedef typename K::Triangle_2 Triangle_2; - public: - typedef Point_2 result_type; + public: Point_2 operator()(const Point_2& p, const Point_2& q) const { @@ -2297,7 +2221,6 @@ namespace HomogeneousKernelFunctors { Point_2 operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { - typedef typename K::RT RT; const RT & phx = p.hx(); const RT & phy = p.hy(); const RT & phw = p.hw(); @@ -2361,14 +2284,13 @@ namespace HomogeneousKernelFunctors { template class Construct_circumcenter_3 { - typedef typename K::FT FT; + typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Triangle_3 Triangle_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Plane_3 Plane_3; - public: - typedef Point_3 result_type; + public: Point_3 operator()(const Point_3& p, const Point_3& q) const { @@ -2394,8 +2316,6 @@ namespace HomogeneousKernelFunctors { operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { - typedef typename K::RT RT; - RT phw( p.hw() ); RT qhw( q.hw() ); RT rhw( r.hw() ); @@ -2468,9 +2388,8 @@ namespace HomogeneousKernelFunctors { class Construct_cross_product_vector_3 { typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()(const Vector_3& a, const Vector_3& b) const { @@ -2485,9 +2404,8 @@ namespace HomogeneousKernelFunctors { class Construct_difference_of_vectors_2 { typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()(const Vector_2& v, const Vector_2& w) const { @@ -2501,9 +2419,8 @@ namespace HomogeneousKernelFunctors { class Construct_difference_of_vectors_3 { typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()(const Vector_3& v, const Vector_3& w) const { @@ -2528,8 +2445,6 @@ namespace HomogeneousKernelFunctors { typedef typename K::RT RT; public: - typedef Direction_2 result_type; - Rep // Direction_2 operator()(Return_base_tag, const RT& x, const RT& y) const { return Rep(x, y); } @@ -2595,9 +2510,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Segment_3 Segment_3; typedef typename K::RT RT; typedef typename Direction_3::Rep Rep; - public: - typedef Direction_3 result_type; + public: Rep // Direction_3 operator()(Return_base_tag, const RT& x, const RT& y, const RT& z) const { return Rep(x, y, z); } @@ -2646,9 +2560,8 @@ namespace HomogeneousKernelFunctors { class Construct_sum_of_vectors_2 { typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()(const Vector_2& v, const Vector_2& w) const { @@ -2662,9 +2575,8 @@ namespace HomogeneousKernelFunctors { class Construct_sum_of_vectors_3 { typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()(const Vector_3& v, const Vector_3& w) const { @@ -2681,9 +2593,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; typedef typename K::RT RT; typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()(const Vector_2& v, const FT& f ) const { @@ -2704,9 +2615,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; typedef typename K::RT RT; typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()(const Vector_3& v, const FT& f ) const { @@ -2732,8 +2642,6 @@ namespace HomogeneousKernelFunctors { typedef typename Iso_rectangle_2::Rep Rep; public: - typedef Iso_rectangle_2 result_type; - Rep // Iso_rectangle_2 operator()(Return_base_tag, const Point_2& p, const Point_2& q, int) const { @@ -2851,9 +2759,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Point_2 Point_2; typedef typename K::Point_3 Point_3; typedef typename K::Plane_3 Plane_3; - public: - typedef Point_3 result_type; + public: Point_3 operator()(const Plane_3& h, const Point_2& p) const { @@ -2875,10 +2782,10 @@ namespace HomogeneousKernelFunctors { typedef typename K::Line_2 Line_2; typedef typename Line_2::Rep Rep; typedef typename K::Construct_point_on_2 Construct_point_on_2; - Construct_point_on_2 cp; - public: - typedef Line_2 result_type; + Construct_point_on_2 cp; + + public: Construct_line_2() {} Construct_line_2(const Construct_point_on_2& cp_) : cp(cp_) {} @@ -2958,9 +2865,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; typedef typename K::Point_2 Point_2; typedef typename K::Segment_2 Segment_2; - public: - typedef Point_2 result_type; + public: Point_2 operator()(const Point_2& p, const Point_2& q) const { @@ -2992,9 +2898,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; typedef typename K::Segment_3 Segment_3; - public: - typedef Point_3 result_type; + public: Point_3 operator()(const Point_3& p, const Point_3& q) const { @@ -3027,9 +2932,8 @@ namespace HomogeneousKernelFunctors { class Construct_opposite_vector_2 { typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()( const Vector_2& v) const { return Vector_2(-v.hx(), -v.hy(), v.hw()); } @@ -3039,9 +2943,8 @@ namespace HomogeneousKernelFunctors { class Construct_opposite_vector_3 { typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()( const Vector_3& v) const { return Vector_3(-v.hx(), -v.hy(), -v.hz(), v.hw()); } @@ -3053,9 +2956,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::Plane_3 Plane_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()( const Plane_3& p ) const { return p.rep().orthogonal_vector(); } @@ -3071,9 +2973,8 @@ namespace HomogeneousKernelFunctors { class Construct_perpendicular_vector_2 { typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()( const Vector_2& v, Orientation o) const { @@ -3089,9 +2990,8 @@ namespace HomogeneousKernelFunctors { class Construct_perpendicular_direction_2 { typedef typename K::Direction_2 Direction_2; - public: - typedef Direction_2 result_type; + public: Direction_2 operator()( const Direction_2& d, Orientation o) const { @@ -3110,9 +3010,8 @@ namespace HomogeneousKernelFunctors { { typedef typename K::Line_2 Line_2; typedef typename K::Point_2 Point_2; - public: - typedef Line_2 result_type; + public: Line_2 operator()( const Line_2& l, const Point_2& p) const { return typename K::Line_2( -l.b()*p.hw(), l.a()*p.hw(), l.b()*p.hx() - l.a()*p.hy()); } @@ -3128,23 +3027,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Vector_2 Vector_2; typedef typename K::Line_2 Line_2; typedef typename Point_2::Rep Rep; + public: - - template - struct result { - typedef Point_2 type; - }; - - template - struct result { - typedef const Point_2& type; - }; - - template - struct result { - typedef const Point_2& type; - }; - Rep // Point_2 operator()(Return_base_tag, Origin o) const { return Rep(o); } @@ -3193,7 +3077,7 @@ namespace HomogeneousKernelFunctors { operator()(const Point_2 & p) const { return p; } - const Point_2& + decltype(auto) operator()(const Weighted_point_2 & p) const { return p.rep().point(); } @@ -3221,22 +3105,6 @@ namespace HomogeneousKernelFunctors { typedef typename Point_3::Rep Rep; public: - - template - struct result { - typedef Point_3 type; - }; - - template - struct result { - typedef const Point_3& type; - }; - - template - struct result { - typedef const Point_3& type; - }; - Rep // Point_3 operator()(Return_base_tag, Origin o) const { return Rep(o); } @@ -3258,7 +3126,7 @@ namespace HomogeneousKernelFunctors { operator()(const Point_3 & p) const { return p; } - const Point_3& + decltype(auto) operator()(const Weighted_point_3 & p) const { return p.rep().point(); } @@ -3288,9 +3156,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Point_2 Point_2; typedef typename K::Weighted_point_2 Weighted_point_2; typedef typename Weighted_point_2::Rep Rep; - public: - typedef Weighted_point_2 result_type; + public: Rep operator()(Return_base_tag, Origin o) const { return Rep(o); } @@ -3331,9 +3198,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Point_3 Point_3; typedef typename K::Weighted_point_3 Weighted_point_3; typedef typename Weighted_point_3::Rep Rep; - public: - typedef Weighted_point_3 result_type; + public: Rep operator()(Return_base_tag, Origin o) const { return Rep(o); } @@ -3373,9 +3239,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Point_2 Point_2; typedef typename K::Direction_2 Direction_2; typedef typename K::Line_2 Line_2; - public: - typedef Point_2 result_type; + public: Point_2 operator()( const Line_2& l, const Point_2& p ) const { @@ -3400,16 +3265,6 @@ namespace HomogeneousKernelFunctors { typedef typename K::Ray_3 Ray_3; public: - template - struct result { - typedef const Point_3 type; - }; - - template - struct result { - typedef const Point_3& type; - }; - Point_3 operator()( const Line_3& l, const Point_3& p ) const { @@ -3432,7 +3287,7 @@ namespace HomogeneousKernelFunctors { return l.point() + ( (lambda_num * dir)/lambda_den ); } - Point_3 + decltype(auto) operator()( const Plane_3& h, const Point_3& p ) const { return h.rep().projection(p); } @@ -3462,10 +3317,7 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; public: - - typedef Line_2 result_type; - - result_type + Line_2 operator() (const Circle_2 & c1, const Circle_2 & c2) const { // Concentric Circles don't have radical line @@ -3494,10 +3346,7 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; public: - - typedef Plane_3 result_type; - - result_type + Plane_3 operator() (const Sphere_3 & s1, const Sphere_3 & s2) const { // Concentric Spheres don't have radical plane @@ -3527,9 +3376,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::RT RT; typedef typename K::FT FT; typedef typename K::Vector_2 Vector_2; - public: - typedef Vector_2 result_type; + public: Vector_2 operator()( const Vector_2& v, const RT& c) const { @@ -3549,9 +3397,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::RT RT; typedef typename K::FT FT; typedef typename K::Vector_3 Vector_3; - public: - typedef Vector_3 result_type; + public: Vector_3 operator()( const Vector_3& v, const RT& c) const { @@ -3570,9 +3417,8 @@ namespace HomogeneousKernelFunctors { { typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; - public: - typedef Point_2 result_type; + public: Point_2 operator()( const Point_2& p, const Vector_2& v) const { @@ -3593,9 +3439,8 @@ namespace HomogeneousKernelFunctors { { typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; - public: - typedef Point_3 result_type; + public: Point_3 operator()( const Point_3& p, const Vector_3& v) const { @@ -3624,9 +3469,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Point_2 Point_2; typedef typename K::Direction_2 Direction_2; typedef typename Vector_2::Rep Rep; - public: - typedef Vector_2 result_type; + public: Rep // Vector_2 operator()(Return_base_tag, const Point_2& p, const Point_2& q) const { @@ -3731,9 +3575,8 @@ namespace HomogeneousKernelFunctors { typedef typename K::Vector_3 Vector_3; typedef typename K::Point_3 Point_3; typedef typename Vector_3::Rep Rep; - public: - typedef Vector_3 result_type; + public: Rep // Vector_3 operator()(Return_base_tag, const Point_3& p, const Point_3& q) const { @@ -3835,22 +3678,13 @@ namespace HomogeneousKernelFunctors { typedef typename K::Segment_2 Segment_2; typedef typename K::Iso_rectangle_2 Iso_rectangle_2; typedef typename K::Triangle_2 Triangle_2; + public: - template - struct result { - typedef const Point_2& type; - }; - - template - struct result { - typedef Point_2 type; - }; - - const Point_2 & + decltype(auto) operator()( const Segment_2& s, int i) const { return s.vertex(i); } - const Point_2 & + decltype(auto) operator()( const Triangle_2& t, int i) const { return t.rep().vertex(i); } @@ -3871,14 +3705,10 @@ namespace HomogeneousKernelFunctors { } }; -} //namespace HomogeneousKernelFunctors - - -namespace HomogeneousKernelFunctors { - template class Coplanar_orientation_3 { + typedef typename K::Orientation Orientation; typedef typename K::Point_3 Point_3; #ifdef CGAL_kernel_exactness_preconditions typedef typename K::Coplanar_3 Coplanar_3; @@ -3887,7 +3717,6 @@ namespace HomogeneousKernelFunctors { Collinear_3 cl; #endif // CGAL_kernel_exactness_preconditions public: - typedef typename K::Orientation result_type; #ifdef CGAL_kernel_exactness_preconditions Coplanar_orientation_3() {} @@ -3895,7 +3724,7 @@ namespace HomogeneousKernelFunctors { : cp(cp_), cl(cl_) {} #endif // CGAL_kernel_exactness_preconditions - result_type + Orientation operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { Orientation oxy_pqr = sign_of_determinant(p.hx(), p.hy(), p.hw(), @@ -3915,7 +3744,7 @@ namespace HomogeneousKernelFunctors { r.hx(), r.hz(), r.hw()); } - result_type + Orientation operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { @@ -3960,6 +3789,7 @@ namespace HomogeneousKernelFunctors { template class Coplanar_side_of_bounded_circle_3 { + typedef typename K::Bounded_side Bounded_side; typedef typename K::Point_3 Point_3; #ifdef CGAL_kernel_exactness_preconditions typedef typename K::Coplanar_3 Coplanar_3; @@ -3968,7 +3798,6 @@ namespace HomogeneousKernelFunctors { Collinear_3 cl; #endif // CGAL_kernel_exactness_preconditions public: - typedef typename K::Bounded_side result_type; #ifdef CGAL_kernel_exactness_preconditions Coplanar_side_of_bounded_circle_3() {} @@ -3977,7 +3806,7 @@ namespace HomogeneousKernelFunctors { : cp(cp_), cl(cl_) {} #endif // CGAL_kernel_exactness_preconditions - result_type + Bounded_side operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& t) const { @@ -3995,11 +3824,11 @@ namespace HomogeneousKernelFunctors { template class Equal_xy_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return (p.hx() * q.hw() == q.hx() * p.hw() ) @@ -4010,11 +3839,11 @@ namespace HomogeneousKernelFunctors { template class Equal_x_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_2& p, const Point_2& q) const { return p.hx()*q.hw() == q.hx()*p.hw(); } }; @@ -4022,11 +3851,11 @@ namespace HomogeneousKernelFunctors { template class Equal_x_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return p.hx()*q.hw() == q.hx()*p.hw(); } }; @@ -4034,11 +3863,11 @@ namespace HomogeneousKernelFunctors { template class Equal_y_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_2& p, const Point_2& q) const { return p.hy()*q.hw() == q.hy()*p.hw(); } }; @@ -4046,11 +3875,11 @@ namespace HomogeneousKernelFunctors { template class Equal_y_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return p.hy()*q.hw() == q.hy()*p.hw(); } }; @@ -4058,11 +3887,11 @@ namespace HomogeneousKernelFunctors { template class Equal_z_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return p.hz()*q.hw() == q.hz()*p.hw(); } }; @@ -4070,6 +3899,7 @@ namespace HomogeneousKernelFunctors { template class Has_on_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Line_3 Line_3; typedef typename K::Ray_3 Ray_3; @@ -4077,30 +3907,29 @@ namespace HomogeneousKernelFunctors { typedef typename K::Plane_3 Plane_3; typedef typename K::Triangle_3 Triangle_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Line_3& l, const Point_3& p) const { return l.rep().has_on(p); } - result_type + Boolean operator()( const Ray_3& r, const Point_3& p) const { return r.rep().has_on(p); } - result_type + Boolean operator()( const Segment_3& s, const Point_3& p) const { return s.rep().has_on(p); } - result_type + Boolean operator()( const Plane_3& pl, const Point_3& p) const { return pl.rep().has_on(p); } - result_type + Boolean operator()( const Plane_3& pl, const Line_3& l) const { return pl.rep().has_on(l); } - result_type + Boolean operator()( const Triangle_3& t, const Point_3& p) const { if (!t.is_degenerate() ) @@ -4143,11 +3972,11 @@ namespace HomogeneousKernelFunctors { template class Less_distance_to_point_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { typedef typename K::RT RT; @@ -4195,11 +4024,11 @@ namespace HomogeneousKernelFunctors { template class Less_distance_to_point_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { typedef typename K::RT RT; @@ -4232,19 +4061,19 @@ namespace HomogeneousKernelFunctors { template class Less_signed_distance_to_line_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()(const Point_2& p, const Point_2& q, const Point_2& r, const Point_2& s) const { return Compare_signed_distance_to_line_2().operator()(p, q, r, s) == SMALLER; } - result_type + Boolean operator()(const Line_2& l, const Point_2& p, const Point_2& q) const { @@ -4270,14 +4099,14 @@ namespace HomogeneousKernelFunctors { template class Less_signed_distance_to_plane_3 { + typedef typename K::Boolean Boolean; typedef typename K::RT RT; typedef typename K::Point_3 Point_3; typedef typename K::Plane_3 Plane_3; typedef typename K::Construct_plane_3 Construct_plane_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Plane_3& pl, const Point_3& p, const Point_3& q) const { const RT & pla = pl.a(); @@ -4300,7 +4129,7 @@ namespace HomogeneousKernelFunctors { return scaled_dist_p_minus_scaled_dist_q < 0; } - result_type + Boolean operator()(const Point_3& plp, const Point_3& plq, const Point_3& plr, const Point_3& p, const Point_3& q) const { @@ -4312,16 +4141,17 @@ namespace HomogeneousKernelFunctors { template class Less_xyz_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Compare_xyz_3 Compare_xyz_3; - Compare_xyz_3 c; - public: - typedef typename K::Boolean result_type; + Compare_xyz_3 c; + + public: Less_xyz_3() {} Less_xyz_3(const Compare_xyz_3& c_) : c(c_) {} - result_type + Boolean operator()( const Point_3& p, const Point_3& q) const { return c(p, q) == SMALLER; } }; @@ -4329,16 +4159,17 @@ namespace HomogeneousKernelFunctors { template class Less_xy_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; typedef typename K::Compare_xy_2 Compare_xy_2; - Compare_xy_2 c; - public: - typedef typename K::Boolean result_type; + Compare_xy_2 c; + + public: Less_xy_2() {} Less_xy_2(const Compare_xy_2& c_) : c(c_) {} - result_type + Boolean operator()( const Point_2& p, const Point_2& q) const { return c(p, q) == SMALLER; } }; @@ -4346,16 +4177,17 @@ namespace HomogeneousKernelFunctors { template class Less_xy_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; typedef typename K::Compare_xy_3 Compare_xy_3; - Compare_xy_3 c; - public: - typedef typename K::Boolean result_type; + Compare_xy_3 c; + + public: Less_xy_3() {} Less_xy_3(const Compare_xy_3& c_) : c(c_) {} - result_type + Boolean operator()( const Point_3& p, const Point_3& q) const { return c(p, q) == SMALLER; } }; @@ -4363,11 +4195,11 @@ namespace HomogeneousKernelFunctors { template class Less_x_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_2& p, const Point_2& q) const { return ( p.hx()*q.hw() < q.hx()*p.hw() ); } }; @@ -4375,11 +4207,11 @@ namespace HomogeneousKernelFunctors { template class Less_x_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return ( p.hx()*q.hw() < q.hx()*p.hw() ); } }; @@ -4387,11 +4219,11 @@ namespace HomogeneousKernelFunctors { template class Less_yx_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_2& p, const Point_2& q) const { typedef typename K::RT RT; @@ -4422,11 +4254,11 @@ namespace HomogeneousKernelFunctors { template class Less_y_2 { + typedef typename K::Boolean Boolean; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_2& p, const Point_2& q) const { return ( p.hy()*q.hw() < q.hy()*p.hw() ); } }; @@ -4434,11 +4266,11 @@ namespace HomogeneousKernelFunctors { template class Less_y_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return ( p.hy()*q.hw() < q.hy()*p.hw() ); } }; @@ -4446,11 +4278,11 @@ namespace HomogeneousKernelFunctors { template class Less_z_3 { + typedef typename K::Boolean Boolean; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Boolean result_type; - result_type + public: + Boolean operator()( const Point_3& p, const Point_3& q) const { return (p.hz() * q.hw() < q.hz() * p.hw() ); } }; @@ -4458,13 +4290,13 @@ namespace HomogeneousKernelFunctors { template class Orientation_2 { + typedef typename K::Orientation Orientation; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; typedef typename K::Circle_2 Circle_2; - public: - typedef typename K::Orientation result_type; - result_type + public: + Orientation operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { typedef typename K::RT RT; @@ -4490,14 +4322,14 @@ namespace HomogeneousKernelFunctors { return CGAL::compare(A*D, B*C); } - result_type + Orientation operator()(const Vector_2& u, const Vector_2& v) const { return sign_of_determinant(u.hx(), u.hy(), v.hx(), v.hy()); } - result_type + Orientation operator()(const Circle_2& c) const { return c.rep().orientation(); @@ -4507,14 +4339,14 @@ namespace HomogeneousKernelFunctors { template class Orientation_3 { + typedef typename K::Orientation Orientation; typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Sphere_3 Sphere_3; - public: - typedef typename K::Orientation result_type; - result_type + public: + Orientation operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { @@ -4525,7 +4357,7 @@ namespace HomogeneousKernelFunctors { s.hx(), s.hy(), s.hz(), s.hw()); } - result_type + Orientation operator()( const Vector_3& u, const Vector_3& v, const Vector_3& w) const { return sign_of_determinant( u.hx(), u.hy(), u.hz(), @@ -4533,13 +4365,13 @@ namespace HomogeneousKernelFunctors { w.hx(), w.hy(), w.hz()); } - result_type + Orientation operator()( const Tetrahedron_3& t) const { return t.rep().orientation(); } - result_type + Orientation operator()(const Sphere_3& s) const { return s.rep().orientation(); @@ -4561,7 +4393,7 @@ namespace HomogeneousKernelFunctors { typedef typename K::FT FT; typedef typename K::Weighted_point_3 Weighted_point_3; typedef typename K::Oriented_side Oriented_side; - typedef Oriented_side result_type; + typedef typename K::Oriented_side Orientation; Oriented_side operator() ( const Weighted_point_3 & p, const Weighted_point_3 & q, @@ -4625,12 +4457,10 @@ namespace HomogeneousKernelFunctors { template < typename K > class Power_side_of_oriented_power_circle_2 { - public: - typedef typename K::Weighted_point_2 Weighted_point_2; typedef typename K::Oriented_side Oriented_side; + typedef typename K::Weighted_point_2 Weighted_point_2; - typedef Oriented_side result_type; - + public: Oriented_side operator()(const Weighted_point_2& p, const Weighted_point_2& q, const Weighted_point_2& r, @@ -4678,20 +4508,20 @@ namespace HomogeneousKernelFunctors { template class Oriented_side_2 { + typedef typename K::Oriented_side Oriented_side; typedef typename K::RT RT; typedef typename K::Point_2 Point_2; typedef typename K::Circle_2 Circle_2; typedef typename K::Line_2 Line_2; typedef typename K::Triangle_2 Triangle_2; typedef typename K::Segment_2 Segment_2; - public: - typedef typename K::Oriented_side result_type; - result_type + public: + Oriented_side operator()( const Circle_2& c, const Point_2& p) const { return Oriented_side(static_cast(c.bounded_side(p)) * static_cast(c.orientation())); } - result_type + Oriented_side operator()( const Line_2& l, const Point_2& p) const { CGAL_kernel_precondition( ! l.is_degenerate() ); @@ -4699,7 +4529,7 @@ namespace HomogeneousKernelFunctors { return CGAL_NTS sign(v); } - result_type + Oriented_side operator()( const Triangle_2& t, const Point_2& p) const { typename K::Collinear_are_ordered_along_line_2 @@ -4724,7 +4554,7 @@ namespace HomogeneousKernelFunctors { : -ot; } - result_type + Oriented_side operator()(const Segment_2& s, const Triangle_2& t) const { typename K::Construct_source_2 source; @@ -4764,11 +4594,11 @@ namespace HomogeneousKernelFunctors { template class Side_of_bounded_circle_2 { + typedef typename K::Bounded_side Bounded_side; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Bounded_side result_type; - result_type + public: + Bounded_side operator()( const Point_2& p, const Point_2& q, const Point_2& t) const { typedef typename K::RT RT; @@ -4783,12 +4613,11 @@ namespace HomogeneousKernelFunctors { const RT& thy = t.hy(); const RT& thw = t.hw(); - return enum_cast( - CGAL::compare((thx*phw-phx*thw)*(qhx*thw-thx*qhw), + return enum_cast(CGAL::compare((thx*phw-phx*thw)*(qhx*thw-thx*qhw), (thy*phw-phy*thw)*(thy*qhw-qhy*thw)) ); } - result_type + Bounded_side operator()( const Point_2& q, const Point_2& r, const Point_2& s, const Point_2& t) const { @@ -4854,11 +4683,11 @@ namespace HomogeneousKernelFunctors { template class Side_of_bounded_sphere_3 { + typedef typename K::Bounded_side Bounded_side; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Bounded_side result_type; - result_type + public: + Bounded_side operator()( const Point_3& p, const Point_3& q, const Point_3& t) const { typedef typename K::RT RT; @@ -4882,7 +4711,7 @@ namespace HomogeneousKernelFunctors { + (thz*phw-phz*thw)*(qhz*thw-thz*qhw))); } - result_type + Bounded_side operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& t) const { @@ -4890,7 +4719,7 @@ namespace HomogeneousKernelFunctors { return enum_cast( compare_distance_to_point(center, p, t) ); } // FIXME - result_type + Bounded_side operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s, const Point_3& test) const { @@ -4920,11 +4749,11 @@ namespace HomogeneousKernelFunctors { template class Side_of_oriented_circle_2 { + typedef typename K::Oriented_side Oriented_side; typedef typename K::Point_2 Point_2; - public: - typedef typename K::Oriented_side result_type; - result_type + public: + Oriented_side operator()( const Point_2& q, const Point_2& r, const Point_2& s, const Point_2& t) const { @@ -4981,11 +4810,11 @@ namespace HomogeneousKernelFunctors { template class Side_of_oriented_sphere_3 { + typedef typename K::Oriented_side Oriented_side; typedef typename K::Point_3 Point_3; - public: - typedef typename K::Oriented_side result_type; - result_type + public: + Oriented_side operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s, const Point_3& t) const { @@ -5034,13 +4863,11 @@ namespace HomogeneousKernelFunctors { template < typename K > class Construct_radical_axis_2 { - public: typedef typename K::Weighted_point_2 Weighted_point_2; typedef typename K::Line_2 Line_2; typedef typename K::RT RT; - typedef Line_2 result_type; - + public: Line_2 operator()(const Weighted_point_2 & p, const Weighted_point_2 & q) const { diff --git a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_triangulation_2/internal/Hyperbolic_Delaunay_triangulation_traits_2_functions.h b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_triangulation_2/internal/Hyperbolic_Delaunay_triangulation_traits_2_functions.h index 16e863753e2..63bb0c0c47f 100644 --- a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_triangulation_2/internal/Hyperbolic_Delaunay_triangulation_traits_2_functions.h +++ b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_triangulation_2/internal/Hyperbolic_Delaunay_triangulation_traits_2_functions.h @@ -225,13 +225,11 @@ class Side_of_oriented_hyperbolic_segment_2 typedef typename Traits::Construct_weighted_circumcenter_2 Construct_weighted_circumcenter_2; public: - typedef Oriented_side result_type; - Side_of_oriented_hyperbolic_segment_2(const Traits& gt = Traits()) : _gt(gt) {} - result_type operator()(const Hyperbolic_point_2& p, - const Hyperbolic_point_2& q, - const Hyperbolic_point_2& query) const + Oriented_side operator()(const Hyperbolic_point_2& p, + const Hyperbolic_point_2& q, + const Hyperbolic_point_2& query) const { // Check first if the points are collinear with the origin Circle_2 poincare(Hyperbolic_point_2(FT(0),FT(0)), FT(1)); diff --git a/Kernel_23/examples/Kernel_23/MyConstruct_point_2.h b/Kernel_23/examples/Kernel_23/MyConstruct_point_2.h index 962bdd88742..8e9407486d3 100644 --- a/Kernel_23/examples/Kernel_23/MyConstruct_point_2.h +++ b/Kernel_23/examples/Kernel_23/MyConstruct_point_2.h @@ -8,9 +8,8 @@ class MyConstruct_point_2 typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; typedef typename Point_2::Rep Rep; -public: - typedef Point_2 result_type; +public: // Note : the CGAL::Return_base_tag is really internal CGAL stuff. // Unfortunately it is needed for optimizing away copy-constructions, // due to current lack of delegating constructors in the C++ standard. diff --git a/Kernel_23/examples/Kernel_23/intersection_visitor.cpp b/Kernel_23/examples/Kernel_23/intersection_visitor.cpp index ffe5c09c7d8..52abcdaf9d6 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/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 89c15f606eb..c85b8f51aa9 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,11 +1075,10 @@ namespace CommonKernelFunctors { template class Compute_a_2 { - typedef typename K::RT RT; typedef typename K::Line_2 Line_2; public: - const RT& + decltype(auto) operator()(const Line_2& l) const { return l.rep().a(); @@ -1130,11 +1088,10 @@ namespace CommonKernelFunctors { template class Compute_a_3 { - typedef typename K::RT RT; typedef typename K::Plane_3 Plane_3; public: - const RT& + decltype(auto) operator()(const Plane_3& l) const { return l.rep().a(); @@ -1145,11 +1102,10 @@ namespace CommonKernelFunctors { template class Compute_b_2 { - typedef typename K::RT RT; typedef typename K::Line_2 Line_2; public: - const RT& + decltype(auto) operator()(const Line_2& l) const { return l.rep().b(); @@ -1159,11 +1115,10 @@ namespace CommonKernelFunctors { template class Compute_b_3 { - typedef typename K::RT RT; typedef typename K::Plane_3 Plane_3; public: - const RT& + decltype(auto) operator()(const Plane_3& l) const { return l.rep().b(); @@ -1174,11 +1129,10 @@ namespace CommonKernelFunctors { template class Compute_c_2 { - typedef typename K::RT RT; typedef typename K::Line_2 Line_2; public: - const RT& + decltype(auto) operator()(const Line_2& l) const { return l.rep().c(); @@ -1188,11 +1142,10 @@ namespace CommonKernelFunctors { template class Compute_c_3 { - typedef typename K::RT RT; typedef typename K::Plane_3 Plane_3; public: - const RT& + decltype(auto) operator()(const Plane_3& l) const { return l.rep().c(); @@ -1202,11 +1155,10 @@ namespace CommonKernelFunctors { template class Compute_d_3 { - typedef typename K::RT RT; typedef typename K::Plane_3 Plane_3; public: - const RT& + decltype(auto) operator()(const Plane_3& l) const { return l.rep().d(); @@ -1221,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 { @@ -1239,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 { @@ -1259,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 { @@ -1277,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 { @@ -1295,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 { @@ -1313,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 { @@ -1331,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 { @@ -1349,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 { @@ -1367,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 { @@ -1385,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 { @@ -1403,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 { @@ -1421,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 { @@ -1437,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 { @@ -1455,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 { @@ -1504,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, @@ -1624,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 @@ -1708,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); } @@ -1769,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 @@ -1790,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)(); } }; @@ -1809,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)(); } }; @@ -1847,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)(); } }; @@ -1867,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 { @@ -1883,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 @@ -1896,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 @@ -1909,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(); } @@ -1922,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()); } @@ -1935,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()); } @@ -1947,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()); } @@ -1959,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(); } @@ -1971,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(); } @@ -1983,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(); } @@ -1995,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(); } @@ -2007,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()); } @@ -2019,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(); } @@ -2031,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(); } @@ -2043,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));} @@ -2057,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); } @@ -2071,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); } @@ -2165,7 +2057,6 @@ namespace CommonKernelFunctors { decltype(auto) operator()(const Circle_3 & c) const { return this->operator()(Return_base_tag(), c); } - }; template @@ -2176,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 @@ -2215,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); } @@ -2242,7 +2131,7 @@ namespace CommonKernelFunctors { typedef typename K::Plane_3 Plane_3; public: - const Point_3& + decltype(auto) operator()( const Line_3& l) const { return l.rep().point(); } @@ -2258,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(); } }; @@ -2269,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); } @@ -2286,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); } @@ -2332,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); } @@ -2375,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); } @@ -2393,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); } @@ -2405,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(); } }; @@ -2431,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(); } }; @@ -2449,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(); } }; @@ -2462,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(); } }; @@ -2475,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(); } }; @@ -2488,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(); } }; @@ -2571,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(); } @@ -2586,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 @@ -2606,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); } @@ -2624,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); } @@ -2641,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 { @@ -2662,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); } }; @@ -2690,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 { @@ -2726,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 { @@ -3045,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; + Orientation_3 o; + + 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 { @@ -3065,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 { @@ -3083,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())}; } }; @@ -3096,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()); } @@ -3115,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; @@ -3126,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() && @@ -3178,7 +3039,7 @@ namespace CommonKernelFunctors { c1.orientation() == c2.orientation(); } - result_type + Boolean operator()(const Triangle_2& t1, const Triangle_2& t2) const { int i; @@ -3190,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)()); @@ -3200,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; @@ -3214,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(); @@ -3299,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; } }; @@ -3322,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); } @@ -3347,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; } }; @@ -3370,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( @@ -3400,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 { @@ -3439,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); } }; @@ -3462,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); } }; @@ -3485,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); } }; @@ -3508,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); } }; @@ -3531,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; @@ -3557,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( @@ -3590,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); } }; @@ -3614,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 @@ -3626,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 @@ -3670,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; @@ -3677,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(); } }; @@ -3712,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; @@ -3721,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(); } @@ -3765,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(); } }; @@ -3787,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(); } }; @@ -3809,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; + Orientation_2 o; + + 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; } }; @@ -3826,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); @@ -3868,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); } }; @@ -3898,9 +3758,7 @@ public: 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_23/internal/Projection_traits_3.h b/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_3.h index 9f9896ac7eb..ff2483b75b5 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 @@ -254,22 +254,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 +281,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) ); @@ -597,8 +599,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 +972,8 @@ public: 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 +986,8 @@ public: 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 +999,8 @@ public: }; 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 +1010,8 @@ public: }; 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 +1020,7 @@ public: }; 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 42c3bc31859..385d036f34e 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 @@ public: 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 @@ public: 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 @@ public: 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); From 9c517a47a2438e626feb423224e862e77354bd46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 20 Dec 2024 16:14:40 +0100 Subject: [PATCH 27/68] Fix bad return types --- .../include/CGAL/predicates/kernel_ftC2.h | 10 +++++----- Kernel_23/include/CGAL/Circle_2.h | 3 ++- .../include/CGAL/Kernel/global_functions_2.h | 10 ++++++---- .../include/CGAL/Kernel/global_functions_3.h | 16 ++++++++-------- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h index 56903c2c921..f168510c2c9 100644 --- a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h +++ b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h @@ -630,7 +630,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,7 +643,7 @@ 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) @@ -660,7 +660,7 @@ power_side_of_bounded_power_circleC2(const FT &px, const FT &py, const FT &pw, } 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 +685,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 +709,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/Kernel_23/include/CGAL/Circle_2.h b/Kernel_23/include/CGAL/Circle_2.h index 921a30d2206..ee46465e8ae 100644 --- a/Kernel_23/include/CGAL/Circle_2.h +++ b/Kernel_23/include/CGAL/Circle_2.h @@ -102,7 +102,8 @@ public: return R().compute_squared_radius_2_object()(*this); } - Orientation orientation() const + typename R::Orientation + orientation() const { // This make_certain(), the uncertain orientation of circles, the orientation // of circles, are all yucky. diff --git a/Kernel_23/include/CGAL/Kernel/global_functions_2.h b/Kernel_23/include/CGAL/Kernel/global_functions_2.h index e974eae730d..41f61a47f2c 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 e17211e184b..ac6a2f3f275 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()); From c22fadaa32bfa039a5a47c871330f48bbae51e9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 20 Dec 2024 16:15:12 +0100 Subject: [PATCH 28/68] Do not rely on the predicate providing result_type in Filtered_predicate --- .../include/CGAL/Filtered_predicate.h | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Filtered_predicate.h b/Filtered_kernel/include/CGAL/Filtered_predicate.h index acfe6892a7c..99be87fecf1 100644 --- a/Filtered_kernel/include/CGAL/Filtered_predicate.h +++ b/Filtered_kernel/include/CGAL/Filtered_predicate.h @@ -28,7 +28,7 @@ namespace CGAL { // TODO : // - each predicate in the default kernel should define a tag that says if it -// wants to be filtered or not (=> all homogeneous predicate define this +// wants to be filtered or not (=> all homogeneous predicates define this // tag). We could even test-suite that automatically. It makes a strong // new requirement on the kernel though... // Could be done with a traits mechanism ? @@ -52,18 +52,13 @@ class Filtered_predicate EP ep; AP ap; - typedef typename AP::result_type Ares; - public: - + // AP's result type must be convertible to EP's result type. typedef AP Approximate_predicate; typedef EP Exact_predicate; typedef C2E To_exact_converter; typedef C2A To_approximate_converter; - typedef typename EP::result_type result_type; - // AP::result_type must be convertible to EP::result_type. - Filtered_predicate() {} @@ -85,11 +80,14 @@ public: {} template - result_type + auto operator()(const Args&... args) const { + typedef typename Remove_needs_FT >::Type result_type; #ifndef CGAL_EPICK_NO_INTERVALS + typedef typename Remove_needs_FT >::Type Ares; + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); // Protection is outside the try block as VC8 has the CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG { @@ -98,7 +96,7 @@ public: { Ares res = ap(c2a(args)...); if (is_certain(res)) - return get_certain(res); + return result_type(get_certain(res)); } catch (Uncertain_conversion_exception&) {} } @@ -106,7 +104,7 @@ public: Protect_FPU_rounding p(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); #endif // CGAL_EPICK_NO_INTERVALS - return ep(c2e(args)...); + return result_type(ep(c2e(args)...)); } }; @@ -120,27 +118,28 @@ class Filtered_predicate_RT_FT EP_FT ep_ft; AP ap; - using Ares = typename Remove_needs_FT::Type; - -public: - using result_type = typename Remove_needs_FT::Type; - private: + // Detect if the predicate's result type has been wrapped with the `Needs_FT` class template struct Call_operator_needs_FT { - using Actual_approx_res = decltype(ap(c2a(std::declval())...)); - using Approx_res = std::remove_cv_t >; - enum { value = std::is_same >::value }; + template + struct is_Needs_FT : std::false_type { }; + template + struct is_Needs_FT > : std::true_type { }; + + typedef CGAL::cpp20::remove_cvref_t())...))> Actual_approx_res; + enum { value = is_Needs_FT::value }; }; + // If there is no `Needs_FT` in the result, then we can use an RT-based exact predicate template ::value>* = nullptr> - result_type call(const Args&... args) const { return ep_ft(c2e_ft(args)...); } + decltype(auto) exact_call(const Args&... args) const { return ep_ft(c2e_ft(args)...); } template ::value>* = nullptr> - result_type call(const Args&... args) const { return ep_rt(c2e_rt(args)...); } + decltype(auto) exact_call(const Args&... args) const { return ep_rt(c2e_rt(args)...); } public: // ## Important note @@ -154,10 +153,14 @@ public: bool needs_FT(const Args&...) const { return Call_operator_needs_FT::value; } template - result_type + auto operator()(const Args&... args) const { + typedef typename Remove_needs_FT >::Type result_type; + #ifndef CGAL_EPICK_NO_INTERVALS + typedef typename Remove_needs_FT >::Type Ares; + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); // Protection is outside the try block as VC8 has the CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG { @@ -166,7 +169,7 @@ public: { Ares res = ap(c2a(args)...); if (is_certain(res)) - return get_certain(res); + return result_type(get_certain(res)); } catch (Uncertain_conversion_exception&) {} } @@ -174,7 +177,7 @@ public: Protect_FPU_rounding p(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); #endif // CGAL_EPICK_NO_INTERVALS - return call(args...); + return result_type(exact_call(args...)); } }; From 7b6886ed178736cce3aa2965a62677496a936706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 20 Dec 2024 16:16:26 +0100 Subject: [PATCH 29/68] Misc cleaning --- Filtered_kernel/include/CGAL/Lazy.h | 2 +- .../include/CGAL/Kernel_23/internal/Projection_traits_3.h | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index bff1ad6a64a..78a9742a96d 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -1057,7 +1057,7 @@ struct Lazy_construction_optional_for_polyhedral_envelope } }; - +// used in Newkernel_d template struct Lazy_construction_nt { Lazy_construction_nt(){} 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 ff2483b75b5..6339a1c1412 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 @@ -315,6 +317,7 @@ public: 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); } From 7b160e34e33aa61c68bc8a8f3c6c21cf131924de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sun, 29 Dec 2024 23:17:58 +0100 Subject: [PATCH 30/68] Template the Uncertain enum_cast overload with Uncertain, not base enum Templating by the base CGAL enum is just a way to have unintended loss of uncertainty. --- STL_Extension/include/CGAL/Uncertain.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/STL_Extension/include/CGAL/Uncertain.h b/STL_Extension/include/CGAL/Uncertain.h index 5e5003a5d5b..348a65f0f7d 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 From c85b3884fa7da546049d0badbd60d31974c25533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sun, 29 Dec 2024 23:37:47 +0100 Subject: [PATCH 31/68] Update test for enum_cast --- STL_Extension/test/STL_Extension/test_Uncertain.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/STL_Extension/test/STL_Extension/test_Uncertain.cpp b/STL_Extension/test/STL_Extension/test_Uncertain.cpp index c8ab9867633..138210b2879 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() From 040f96557c2322760bcd6a0c49e69cb7b69939b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sun, 29 Dec 2024 23:38:36 +0100 Subject: [PATCH 32/68] Fix include filename --- Filtered_kernel/include/CGAL/Lazy_kernel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Filtered_kernel/include/CGAL/Lazy_kernel.h b/Filtered_kernel/include/CGAL/Lazy_kernel.h index 8f94a5301e6..f96f40377ff 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 From f26f41cff1a1b6f04f24e386756105233072ea35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sun, 29 Dec 2024 23:39:21 +0100 Subject: [PATCH 33/68] Minor CH3 test improvement --- Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp b/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp index 428866204fb..b6d2882b141 100644 --- a/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp +++ b/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp @@ -20,7 +20,7 @@ typedef K::Segment_3 Segment_3; typedef CGAL::Creator_uniform_3 Creator; typedef CGAL::Random_points_in_sphere_3 Generator; -const unsigned int num = 40; +const unsigned int num = 400000; template void compute_plane_equation(Facet_handle f) @@ -135,9 +135,9 @@ int main() std::cerr << "Testing coplanar hull" << std::endl; test_coplanar_hull(); - std::cerr << "Testing 500 random points" << std::endl; + std::cerr << "Testing " << num << " random points" << std::endl; std::vector points; - Generator g(500); + Generator g(1); std::copy_n( g, num, std::back_inserter(points)); assert(points.size() == num); From b7de40afce3fd8489b3eea945e6d3694c019e96f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 8 Jan 2025 17:17:55 +0100 Subject: [PATCH 34/68] Update enum_cast calls to new API --- Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h | 2 ++ .../include/CGAL/Cartesian/Tetrahedron_3.h | 2 +- .../include/CGAL/Cartesian/function_objects.h | 3 ++- .../include/CGAL/predicates/kernel_ftC2.h | 13 +++++++++---- .../include/CGAL/predicates/kernel_ftC3.h | 13 ++++++++++++- .../include/CGAL/predicates/sign_of_determinant.h | 1 + .../include/CGAL/NewKernel_d/Types/Weighted_point.h | 2 +- .../CGAL/NewKernel_d/function_objects_cartesian.h | 2 +- STL_Extension/doc/STL_Extension/CGAL/Uncertain.h | 2 +- 9 files changed, 30 insertions(+), 10 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h index 3dee104e4c6..d5f0768f30c 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 3a197adecf8..8560ea4b815 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 d5e6aab5919..e96013ef4f8 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -4207,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))) || diff --git a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h index f168510c2c9..1f1d912e0d2 100644 --- a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h +++ b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h @@ -421,6 +421,7 @@ typename Same_uncertainty_nt::type angleC2(const FT &ux, const FT &uy, const FT &vx, const FT &vy) { + typedef typename Same_uncertainty_nt::type Angle; return enum_cast(CGAL_NTS sign(ux*vx + uy*vy)); } @@ -431,6 +432,7 @@ angleC2(const FT &px, const FT &py, const FT &qx, const FT &qy, const FT &rx, const FT &ry) { + typedef typename Same_uncertainty_nt::type Angle; return enum_cast(CGAL_NTS sign((px-qx)*(rx-qx)+(py-qy)*(ry-qy))); } @@ -442,6 +444,7 @@ angleC2(const FT &px, const FT &py, const FT &rx, const FT &ry, const FT &sx, const FT &sy) { + typedef typename Same_uncertainty_nt::type Angle; return enum_cast(CGAL_NTS sign((px-qx)*(rx-sx)+(py-qy)*(ry-sy))); } @@ -508,6 +511,7 @@ side_of_bounded_circleC2(const FT &px, const FT &py, const FT &rx, const FT &ry, const FT &tx, const FT &ty) { + typedef typename Same_uncertainty_nt::type Bounded_side; return enum_cast( side_of_oriented_circleC2(px,py,qx,qy,rx,ry,tx,ty) * orientationC2(px,py,qx,qy,rx,ry) ); } @@ -520,8 +524,8 @@ side_of_bounded_circleC2(const FT &px, const FT &py, const FT &tx, const FT &ty) { // Returns whether T lies inside or outside the circle which diameter is PQ. - return enum_cast( - CGAL_NTS compare((tx-px)*(qx-tx), (ty-py)*(ty-qy)) ); + typedef typename Same_uncertainty_nt::type Bounded_side; + return enum_cast(CGAL_NTS compare((tx-px)*(qx-tx), (ty-py)*(ty-qy)) ); } template < class FT > @@ -648,14 +652,15 @@ 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))); } diff --git a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h index 5d210da549d..297a29487c2 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/Kernel_23/include/CGAL/predicates/sign_of_determinant.h b/Kernel_23/include/CGAL/predicates/sign_of_determinant.h index bdb7fd1425a..5543772cfb3 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/NewKernel_d/include/CGAL/NewKernel_d/Types/Weighted_point.h b/NewKernel_d/include/CGAL/NewKernel_d/Types/Weighted_point.h index 6e970a5f13a..9d051646871 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 1cfaaa4893b..2e627719060 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 bc3f39d92b5..0dfa921bdb0 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); /// @} From b8830caa24470c914dd5a73abf6dfc3f4a1646fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 8 Jan 2025 17:20:20 +0100 Subject: [PATCH 35/68] Remove superfluous precision --- Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h index bdd0dff3473..48eb6acf442 100644 --- a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h +++ b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h @@ -7562,7 +7562,7 @@ public: and also for `Type1` and `Type2` of respective types - `Kernel::Triangle_3` and `Kernel::Tetrahedron_3` - - `Kernel::Plane_3` and `Kernel::Sphere_3` (or the contrary) + - `Kernel::Plane_3` and `Kernel::Sphere_3` - `Kernel::Sphere_3` and `Kernel::Sphere_3`. */ From 8c95fcca9cb0229a3fccd833f1001049ff9200c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 8 Jan 2025 17:20:44 +0100 Subject: [PATCH 36/68] Update Filtered_predicate_with_state not to rely on a 'result_type' typedef --- .../CGAL/Filtered_predicate_with_state.h | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Filtered_predicate_with_state.h b/Filtered_kernel/include/CGAL/Filtered_predicate_with_state.h index c0b2e2179ca..d29cd3b9b9d 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 From d02e817bc14f669a53c814a61ab2b23f26c7b3d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 8 Jan 2025 17:25:20 +0100 Subject: [PATCH 37/68] Get rid of result types in function objects of Circular_kernel_23 --- .../include/CGAL/Cartesian/function_objects.h | 3 +- .../function_objects_on_circle_2.h | 24 +- .../function_objects_on_line_2.h | 28 +- .../function_objects_polynomial_circular.h | 447 ++++++++---------- .../CGAL/Circular_kernel_intersections.h | 2 +- .../bbox_filtered_predicates.h | 112 ++--- .../function_objects_polynomial_sphere.h | 392 ++++++++------- .../internal_functions_on_sphere_3.h | 4 +- .../CGAL/Spherical_kernel_intersections.h | 4 +- .../NewKernel_d/Cartesian_static_filters.h | 2 + 10 files changed, 484 insertions(+), 534 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index e96013ef4f8..b26a9bcfc45 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -4216,8 +4216,7 @@ 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); } Oriented_side diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_on_circle_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_on_circle_2.h index a1890928e7d..1454b4f9cff 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_on_circle_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_on_circle_2.h @@ -31,25 +31,29 @@ namespace CGAL { namespace CircularFunctors { template < class CK > - class Construct_circle_2 : public CK::Linear_kernel::Construct_circle_2 + class Construct_circle_2 + // : public CK::Linear_kernel::Construct_circle_2 { - typedef typename CK::Linear_kernel::Construct_circle_2 Base_functor; - typedef typename CK::FT FT; - typedef typename CK::Linear_kernel::Point_2 Point_2; + typedef typename CK::Circle_2 Circle_2; + typedef typename CK::Circular_arc_2 Circular_arc_2; + + typedef typename CK::Linear_kernel::Construct_circle_2 Linear_Construct_circle_2; + public: - typedef typename Base_functor::result_type result_type; + // using Linear_Construct_circle_2::operator(); - using Base_functor::operator(); + template + decltype(auto) + operator()(const Args&... args) const + { return Linear_Construct_circle_2()(args...); } - typedef typename CK::Circular_arc_2 Circular_arc_2; - - result_type + Circle_2 operator() ( const typename CK::Polynomial_for_circles_2_2 &eq ) { return construct_circle_2(eq); } - result_type + decltype(auto) operator() (const Circular_arc_2 & a) const { return (a.rep().supporting_circle()); } diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_on_line_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_on_line_2.h index fba7f0f1d74..8209e845a92 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_on_line_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_on_line_2.h @@ -30,26 +30,32 @@ namespace CGAL { namespace LinearFunctors { template < class CK > - class Construct_line_2 : public CK::Linear_kernel::Construct_line_2 + class Construct_line_2 + // : public CK::Linear_kernel::Construct_line_2 { - typedef typename CK::Line_arc_2 Line_arc_2; + typedef typename CK::Line_arc_2 Line_arc_2; typedef typename CK::Line_2 Line_2; - public: - typedef typename CK::Linear_kernel::Construct_line_2::result_type - result_type; - using CK::Linear_kernel::Construct_line_2::operator(); + typedef typename CK::Linear_kernel::Construct_line_2 Linear_Construct_circle_2; - result_type operator() (const Line_arc_2 & a) const + public: + // using CK::Linear_kernel::Construct_line_2::operator(); + + template + decltype(auto) + operator()(const Args&... args) const + { return Linear_Construct_circle_2()(args...); } + + decltype(auto) operator() (const Line_arc_2 & a) const { return (a.rep().supporting_line()); } - result_type + Line_2 operator() ( const typename CK::Polynomial_1_2 &eq ) - { - return construct_line_2(eq); - } + { + return construct_line_2(eq); + } }; } // namespace LinearFunctors diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h index 09696e5069c..6c3b686dcab 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h @@ -30,148 +30,115 @@ namespace CGAL { namespace CircularFunctors { +#define CGAL_CIRCULAR_KERNEL_MACRO_FUNCTOR_COMPARE_(V)\ +template < class CK > \ + class Compare_ ##V## _2 {\ + /*: public CK::Linear_kernel::Compare_ ##V## _2{*/\ + typedef typename CK::Comparison_result Comparison_result;\ + typedef typename CK::Circular_arc_point_2 Circular_arc_point_2;\ + typedef typename CK::Linear_kernel::Compare_ ##V## _2 Linear_Compare_ ##V## _2;\ + public:\ + template \ + Comparison_result\ + operator()(const Args&... args) const\ + { return Linear_Compare_ ##V## _2()(args...); }\ + /*using CK::Linear_kernel::Compare_ ##V## _2::operator();*/\ + Comparison_result\ + operator() (const Circular_arc_point_2 &p0,\ + const Circular_arc_point_2 &p1) const\ + { return CircularFunctors::compare_ ##V (p0, p1); }\ + };\ - template < class CK > - class Compare_x_2 - : public CK::Linear_kernel::Compare_x_2 - { - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Point_2 Point_2; + CGAL_CIRCULAR_KERNEL_MACRO_FUNCTOR_COMPARE_(x) + CGAL_CIRCULAR_KERNEL_MACRO_FUNCTOR_COMPARE_(y) + CGAL_CIRCULAR_KERNEL_MACRO_FUNCTOR_COMPARE_(xy) - public: - - typedef typename CK::Linear_kernel::Compare_x_2::result_type result_type; - using CK::Linear_kernel::Compare_x_2::operator(); - - result_type - operator() (const Circular_arc_point_2 &p0, - const Circular_arc_point_2 &p1) const - { return CircularFunctors::compare_x(p0, p1);} - - }; - - - template < class CK > - class Compare_y_2 - : public CK::Linear_kernel::Compare_y_2 - { - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Point_2 Point_2; - - public: - - typedef typename CK::Linear_kernel::Compare_y_2::result_type result_type; - using CK::Linear_kernel::Compare_y_2::operator(); - - result_type - operator() (const Circular_arc_point_2 &p0, - const Circular_arc_point_2 &p1) const - {return CircularFunctors::compare_y(p0, p1);} - - }; - - template < class CK > - class Compare_xy_2 - : public CK::Linear_kernel::Compare_xy_2 - { - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Point_2 Point_2; - - public: - - typedef typename CK::Linear_kernel::Compare_xy_2::result_type result_type; - using CK::Linear_kernel::Compare_xy_2::operator(); - - result_type - operator() (const Circular_arc_point_2 &p0, - const Circular_arc_point_2 &p1) const - { return CircularFunctors::compare_xy(p0, p1);} - - }; +#undef CGAL_CIRCULAR_KERNEL_MACRO_FUNCTOR_COMPARE_ template < class CK > class In_x_range_2 { + typedef typename CK::Boolean Boolean; typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Line_arc_2 Line_arc_2; public: - typedef bool result_type; - - result_type + Boolean operator()(const Circular_arc_2 &a, const Circular_arc_point_2 &p) const { return CircularFunctors::point_in_x_range(a, p); } - result_type + Boolean operator()(const Line_arc_2 &a, const Circular_arc_point_2 &p) const { return CircularFunctors::point_in_x_range(a, p); } - }; - template < class CK > class Has_on_2 - : public CK::Linear_kernel::Has_on_2 + // : public CK::Linear_kernel::Has_on_2 { + typedef typename CK::Boolean Boolean; typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Line_arc_2 Line_arc_2; typedef typename CK::Circle_2 Circle_2; typedef typename CK::Line_2 Line_2; + typedef typename CK::Linear_kernel::Has_on_2 Linear_Has_on_2; + public: - typedef typename CK::Linear_kernel::Has_on_2::result_type result_type; + // using CK::Linear_kernel::Has_on_2::operator(); - using CK::Linear_kernel::Has_on_2::operator(); + template + Boolean + operator()(const A& a, const B& b) const + { return Linear_Has_on_2()(a, b); } - result_type + Boolean operator()(const Circle_2 &a, const Circular_arc_point_2 &p) const { return CircularFunctors::has_on(a, p); } - result_type + Boolean operator()(const Line_2 &a, const Circular_arc_point_2 &p) const { return LinearFunctors::has_on(a, p); } - result_type + Boolean operator()(const Circular_arc_2 &a, const Circular_arc_point_2 &p) const { return CircularFunctors::has_on(a, p); } - result_type + Boolean operator()(const Line_arc_2 &a, const Circular_arc_point_2 &p) const { return CircularFunctors::has_on(a, p); } - }; template < class CK > class Compare_y_to_right_2 { + typedef typename CK::Comparison_result Comparison_result; typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Line_arc_2 Line_arc_2; public: - typedef CGAL::Comparison_result result_type; - - result_type + Comparison_result operator()(const Circular_arc_2 &a1, const Circular_arc_2 &a2, const Circular_arc_point_2 &p) const { return CircularFunctors::compare_y_to_right(a1, a2, p); } - result_type + Comparison_result operator()(const Line_arc_2 &a1, const Line_arc_2 &a2, const Circular_arc_point_2 &p) const { return CircularFunctors::compare_y_to_right(a1, a2, p); } - result_type + Comparison_result operator()(const Line_arc_2 &a1, const Circular_arc_2 &a2, const Circular_arc_point_2 &p) const { return CircularFunctors::compare_y_to_right(a1, a2, p); } - result_type + Comparison_result operator()(const Circular_arc_2 &a1, const Line_arc_2 &a2, const Circular_arc_point_2 &p) const @@ -179,21 +146,16 @@ namespace CircularFunctors { return CGAL::SMALLER; return CGAL::LARGER; } - }; template < class CK > class Equal_2 - : public CK::Linear_kernel::Equal_2 + // : public CK::Linear_kernel::Equal_2 { - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Boolean Boolean; + typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; - - public: - typedef typename CK::Linear_kernel LK; - typedef typename LK::Equal_2 LK_Equal_2; - typedef typename CK::Point_2 Point_2; typedef typename CK::Vector_2 Vector_2; typedef typename CK::Direction_2 Direction_2; @@ -204,69 +166,78 @@ namespace CircularFunctors { typedef typename CK::Iso_rectangle_2 Iso_rectangle_2; typedef typename CK::Circle_2 Circle_2; + typedef typename CK::Linear_kernel::Equal_2 Linear_Equal_2; - typedef typename CK::Linear_kernel::Equal_2::result_type result_type; - using CK::Linear_kernel::Equal_2::operator(); + public: + // using CK::Linear_kernel::Equal_2::operator(); - result_type + template + Boolean + operator()(const A& a, const B& b) const { + return Linear_Equal_2()(a, b); + } + + Boolean operator() (const Circular_arc_point_2 &p0, const Circular_arc_point_2 &p1) const { return CircularFunctors::equal(p0, p1); } - result_type + Boolean operator() (const Circular_arc_2 &a0, const Circular_arc_2 &a1) const { return CircularFunctors::equal(a0, a1); } - result_type + Boolean operator() (const Line_arc_2 &a0, const Line_arc_2 &a1) const { return CircularFunctors::equal(a0, a1); } - }; template < class CK > - class Compare_y_at_x_2 : public CK::Linear_kernel::Compare_y_at_x_2 + class Compare_y_at_x_2 + // : public CK::Linear_kernel::Compare_y_at_x_2 { + typedef typename CK::Comparison_result Comparison_result; typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Line_arc_2 Line_arc_2; + typedef typename CK::Linear_kernel::Compare_y_at_x_2 Linear_Compare_y_at_x_2; + public: - typedef typename CK::Linear_kernel::Compare_y_at_x_2::result_type result_type; + // using CK::Linear_kernel::Compare_y_at_x_2::operator(); - using CK::Linear_kernel::Compare_y_at_x_2::operator(); + template + Comparison_result + operator()(const Args&... args) const + { return Linear_Compare_y_at_x_2()(args...); } - result_type + Comparison_result operator() (const Circular_arc_point_2 &p, const Circular_arc_2 &A1) const { return CircularFunctors::compare_y_at_x(p, A1); } - result_type + Comparison_result operator() (const Circular_arc_point_2 &p, const Line_arc_2 &A1) const { return CircularFunctors::compare_y_at_x(p, A1); } - }; template < class CK > class Do_overlap_2 { + typedef typename CK::Boolean Boolean; typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; public: - typedef bool result_type; - - result_type + Boolean operator() (const Circular_arc_2 &A1, const Circular_arc_2 &A2) const { return CircularFunctors::do_overlap(A1, A2); } - result_type + Boolean operator() (const Line_arc_2 &A1, const Line_arc_2 &A2) const { return CircularFunctors::do_overlap(A1, A2); } - }; - template < class CK > class Make_x_monotone_2 { @@ -274,9 +245,6 @@ namespace CircularFunctors { typedef typename CK::Line_arc_2 Line_arc_2; public: - - typedef void result_type; //!!! - template < class OutputIterator > OutputIterator operator()(const Circular_arc_2 &A, OutputIterator res) const @@ -290,7 +258,6 @@ namespace CircularFunctors { { return CircularFunctors::make_x_monotone(A,res); } - }; template < class CK > @@ -300,9 +267,6 @@ namespace CircularFunctors { typedef typename CK::Line_arc_2 Line_arc_2; public: - - typedef void result_type; //!!! - template < class OutputIterator > OutputIterator operator()(const Circular_arc_2 &A, OutputIterator res) const @@ -326,19 +290,21 @@ namespace CircularFunctors { { *res++ = make_object(A); return res; } - }; template < class CK > class Do_intersect_2 - : public CK::Linear_kernel::Do_intersect_2 + // : public CK::Linear_kernel::Do_intersect_2 { + typedef typename CK::Boolean Boolean; + + typedef typename CK::Linear_kernel::Do_intersect_2 Linear_Do_intersect_2; + public: - typedef typename CK::Linear_kernel::Do_intersect_2::result_type result_type; - template - result_type - operator()(const T1& t1, const T2& t2) const - { return Intersections::internal::do_intersect(t1, t2, CK()); } + template + Boolean + operator()(const A& a, const B& b) const + { return Intersections::internal::do_intersect(a, b, CK()); } }; template < class CK > @@ -347,14 +313,12 @@ namespace CircularFunctors { //using the Lazy_kernel as linear kernel. //: public CK::Linear_kernel::Intersect_2 { - typedef typename CK::Circle_2 Circle; typedef typename CK::Circular_arc_2 Circular_arc; typedef typename CK::Line_arc_2 Line_arc; typedef typename CK::Line_2 Line; public: - //using CK::Linear_kernel::Intersect_2::operator(); template @@ -460,7 +424,6 @@ namespace CircularFunctors { *res++=typename CK::Linear_kernel::Intersect_2()(l1, l2); return res; } - }; template < class CK > @@ -470,61 +433,61 @@ namespace CircularFunctors { typename CK::Polynomial_1_2 operator() ( const typename CK::Line_2 & l ) - { - return LinearFunctors::get_equation(l); - } + { + return LinearFunctors::get_equation(l); + } typename CK::Polynomial_for_circles_2_2 operator() ( const typename CK::Circle_2 & c ) - { - return CircularFunctors::get_equation(c); - } + { + return CircularFunctors::get_equation(c); + } }; template < class CK > class Split_2 { typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Line_arc_2 Line_arc_2; public: - - typedef void result_type; - - result_type + void operator()(const Circular_arc_2 &A, const Circular_arc_point_2 &p, Circular_arc_2 &ca1, Circular_arc_2 &ca2) const { return CircularFunctors::split(A, p, ca1, ca2); } - - result_type + void operator()(const Line_arc_2 &A, const Circular_arc_point_2 &p, Line_arc_2 &ca1, Line_arc_2 &ca2) const { return CircularFunctors::split(A, p, ca1, ca2); } - }; template < class CK > class Is_vertical_2 - : public CK::Linear_kernel::Is_vertical_2 + // : public CK::Linear_kernel::Is_vertical_2 { + typedef typename CK::Boolean Boolean; typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; + typedef typename CK::Linear_kernel::Is_vertical_2 Linear_Is_vertical_2; + public: + // using CK::Linear_kernel::Is_vertical_2::operator(); - typedef typename CK::Linear_kernel::Is_vertical_2::result_type result_type; + template + Boolean + operator()(const A& a) const + { return Linear_Is_vertical_2()(a); } - using CK::Linear_kernel::Is_vertical_2::operator(); - - result_type + Boolean operator()(const Circular_arc_2 &A) const { return CircularFunctors::is_vertical(A); } - result_type + Boolean operator()(const Line_arc_2 &A) const { return CircularFunctors::is_vertical(A); } @@ -533,56 +496,51 @@ namespace CircularFunctors { template < class CK > class Construct_circular_arc_2 { - typedef typename CK::FT FT; - typedef typename CK::RT RT; typedef typename CK::Point_2 Point_2; typedef typename CK::Line_2 Line_2; typedef typename CK::Circle_2 Circle_2; typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Kernel_base::Circular_arc_2 RCircular_arc_2; typedef typename Circular_arc_2::Rep Rep; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; public: - typedef Circular_arc_2 result_type; - - result_type + Circular_arc_2 operator()(void) { return Rep(); } - result_type + Circular_arc_2 operator()(const Circle_2 &c) const { return Rep(c); } - result_type + Circular_arc_2 operator()(const Circle_2 &support, const Circular_arc_point_2 &source, const Circular_arc_point_2 &target) const { return Rep(support,source,target); } // Not Documented - result_type + Circular_arc_2 operator()(const Circle_2 &support, const Line_2 &l1, bool b1, const Line_2 &l2, bool b2) const { return Rep(support,l1,b1,l2,b2); } // Not Documented - result_type + Circular_arc_2 operator()(const Circle_2 &c, const Circle_2 &c1, bool b_1, const Circle_2 &c2, bool b_2) const { return Rep(c,c1,b_1,c2,b_2); } - result_type + Circular_arc_2 operator()(const Point_2 &begin, const Point_2 &middle, const Point_2 &end) const { return Rep(begin,middle,end); } // Not Documented - result_type + Circular_arc_2 operator()(const Point_2 &begin, const Point_2 &end, const FT& bulge) const @@ -600,47 +558,44 @@ namespace CircularFunctors { typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Segment_2 Segment_2; typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK::Kernel_base::Line_arc_2 RLine_arc_2; typedef typename Line_arc_2::Rep Rep; public: - typedef Line_arc_2 result_type; - - result_type + Line_arc_2 operator()(void) { return Rep(); } // Not Documented - result_type + Line_arc_2 operator()(const Line_2 &support, const Circle_2 &c1,const bool b1, const Circle_2 &c2,const bool b2) const { return Rep(support,c1,b1,c2,b2); } // Not Documented - result_type + Line_arc_2 operator()(const Line_2 &support, const Line_2 &l1, const Line_2 &l2) const { return Rep(support,l1,l2); } - result_type + Line_arc_2 operator()(const Line_2 &support, const Circular_arc_point_2 &p1, const Circular_arc_point_2 &p2) const { return Rep(support,p1,p2); } -// result_type +// Line_arc_2 // operator()(const Line_2 &support, // const Point_2 &p1, // const Point_2 &p2) const // { return Rep(support,p1,p2); } - result_type + Line_arc_2 operator()(const Segment_2 &s) const { return Rep(s); } - result_type + Line_arc_2 operator()(const Point_2 &p1, const Point_2 &p2) const { return Rep(p1,p2); } @@ -652,40 +607,32 @@ namespace CircularFunctors { { typedef typename CK::Point_2 Point_2; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Kernel_base::Circular_arc_point_2 - RCircular_arc_point_2; typedef typename Circular_arc_point_2::Rep Rep; typedef typename Circular_arc_point_2::Root_for_circles_2_2 Root_for_circles_2_2; public: - typedef Circular_arc_point_2 result_type; - - result_type + Circular_arc_point_2 operator()(void) { return Rep(); } - result_type + Circular_arc_point_2 operator()(const Root_for_circles_2_2 & np) const { return Rep(np); } - result_type + Circular_arc_point_2 operator()(const Point_2 & p) const { return Rep(p); } }; - template class Compute_circular_x_2 { typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Root_of_2 Root_of_2; public: - typedef const Root_of_2& result_type; - - result_type operator() (const Circular_arc_point_2 & a) const + decltype(auto) operator() (const Circular_arc_point_2 & a) const { return (a.rep().x()); } @@ -696,13 +643,9 @@ namespace CircularFunctors { class Compute_circular_y_2 { typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Root_of_2 Root_of_2; public: - - typedef const Root_of_2& result_type; - - result_type operator() (const Circular_arc_point_2 & a) const + decltype(auto) operator() (const Circular_arc_point_2 & a) const { return (a.rep().y()); } @@ -714,17 +657,14 @@ namespace CircularFunctors { { typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; public: - typedef const Circular_arc_point_2 & result_type; - - result_type operator() (const Circular_arc_2 & a) const + decltype(auto) operator() (const Circular_arc_2& a) const { return (a.rep().left()); } - result_type operator() (const Line_arc_2 & a) const + decltype(auto) operator() (const Line_arc_2& a) const { return (a.rep().left()); } @@ -736,18 +676,14 @@ namespace CircularFunctors { { typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; public: - - typedef const Circular_arc_point_2& result_type; - - result_type operator() (const Circular_arc_2 & a) const + decltype(auto) operator() (const Circular_arc_2& a) const { return (a.rep().right()); } - result_type operator() (const Line_arc_2 & a) const + decltype(auto) operator() (const Line_arc_2& a) const { return (a.rep().right()); } @@ -759,16 +695,12 @@ namespace CircularFunctors { { typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; public: - - typedef const Circular_arc_point_2& result_type; - - result_type operator() (const Circular_arc_2 & a) const + decltype(auto) operator() (const Circular_arc_2& a) const { return a.rep().source(); } - result_type operator() (const Line_arc_2 & a) const + decltype(auto) operator() (const Line_arc_2& a) const { return a.rep().source();} }; @@ -779,16 +711,12 @@ namespace CircularFunctors { { typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; public: - - typedef const Circular_arc_point_2& result_type; - - result_type operator() (const Circular_arc_2 & a) const + decltype(auto) operator() (const Circular_arc_2& a) const { return a.rep().target();} - result_type operator() (const Line_arc_2 & a) const + decltype(auto) operator() (const Line_arc_2& a) const { return a.rep().target();} }; @@ -796,19 +724,17 @@ namespace CircularFunctors { template class Is_x_monotone_2 { + typedef typename CK::Boolean Boolean; typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; public: - - typedef bool result_type; - - result_type operator() (const Circular_arc_2 & a) const + Boolean operator() (const Circular_arc_2 & a) const { return (a.rep().is_x_monotone()); } - result_type operator() (const Line_arc_2 & a) const + Boolean operator() (const Line_arc_2 & a) const { return (a.rep().is_x_monotone()); } @@ -818,19 +744,17 @@ namespace CircularFunctors { template class Is_y_monotone_2 { + typedef typename CK::Boolean Boolean; typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_arc_2 Line_arc_2; public: - - typedef bool result_type; - - result_type operator() (const Circular_arc_2 & a) const + Boolean operator() (const Circular_arc_2& a) const { return (a.rep().is_y_monotone()); } - result_type operator() (const Line_arc_2 & a) const + Boolean operator() (const Line_arc_2& a) const { return (a.rep().is_y_monotone()); } @@ -839,48 +763,58 @@ namespace CircularFunctors { template class Construct_bbox_2 - : public CK::Linear_kernel::Construct_bbox_2 + // : public CK::Linear_kernel::Construct_bbox_2 { typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Line_arc_2 Line_arc_2; typedef typename CK::Circle_2 Circle_2; + typedef typename CK::Linear_kernel::Construct_bbox_2 Linear_Construct_bbox_2; + public: + // using CK::Linear_kernel::Construct_bbox_2::operator(); - typedef typename CK::Linear_kernel::Construct_bbox_2::result_type result_type; - using CK::Linear_kernel::Construct_bbox_2::operator(); + template + decltype(auto) + operator()(const A& a) const + { return Linear_Construct_bbox_2()(a); } - result_type operator() (const Circular_arc_point_2 & a) const + decltype(auto) operator() (const Circular_arc_point_2& a) const { return a.rep().bbox(); } - result_type operator() (const Circular_arc_2 & a) const + decltype(auto) operator() (const Circular_arc_2& a) const { return a.rep().bbox(); } - result_type operator() (const Line_arc_2 & a) const + decltype(auto) operator() (const Line_arc_2& a) const { return a.rep().bbox(); } - }; template class Bounded_side_2 - : public CK::Linear_kernel::Bounded_side_2 + // : public CK::Linear_kernel::Bounded_side_2 { + typedef typename CK::Bounded_side Bounded_side; typedef typename CK::Circle_2 Circle_2; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Linear_kernel::Bounded_side_2 Linear_Bounded_side_2; + public: - typedef typename CK::Linear_kernel::Bounded_side_2::result_type result_type; + // using CK::Linear_kernel::Bounded_side_2::operator(); - using CK::Linear_kernel::Bounded_side_2::operator(); + template + Bounded_side + operator()(const A& a, const B& b) const + { return Linear_Bounded_side_2()(a, b); } - result_type + Bounded_side operator()(const Circle_2& c, const Circular_arc_point_2& p) const { return CircularFunctors::bounded_side(c,p); } @@ -888,17 +822,23 @@ namespace CircularFunctors { template class Has_on_bounded_side_2 - : public CK::Linear_kernel::Has_on_bounded_side_2 + // : public CK::Linear_kernel::Has_on_bounded_side_2 { + typedef typename CK::Boolean Boolean; typedef typename CK::Circle_2 Circle_2; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Linear_kernel::Has_on_bounded_side_2 Linear_Has_on_bounded_side_2; + public: - typedef typename CK::Linear_kernel::Has_on_bounded_side_2::result_type result_type; + // using CK::Linear_kernel::Has_on_bounded_side_2::operator(); - using CK::Linear_kernel::Has_on_bounded_side_2::operator(); + template + Boolean + operator()(const A& a, const B& b) const + { return Linear_Has_on_bounded_side_2()(a, b); } - result_type + Boolean operator()(const Circle_2& c, const Circular_arc_point_2& p) const { return CK().bounded_side_2_object()(c,p) == ON_BOUNDED_SIDE; } @@ -906,20 +846,25 @@ namespace CircularFunctors { template class Has_on_unbounded_side_2 - : public CK::Linear_kernel::Has_on_unbounded_side_2 + // : public CK::Linear_kernel::Has_on_unbounded_side_2 { + typedef typename CK::Boolean Boolean; typedef typename CK::Circle_2 Circle_2; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Linear_kernel::Has_on_unbounded_side_2 Linear_Has_on_unbounded_side_2; + public: - typedef typename CK::Linear_kernel::Has_on_unbounded_side_2::result_type result_type; + // using CK::Linear_kernel::Has_on_unbounded_side_2::operator(); - using CK::Linear_kernel::Has_on_unbounded_side_2::operator(); + template + Boolean + operator()(const A& a, const B& b) const + { return Linear_Has_on_unbounded_side_2()(a, b); } - result_type + Boolean operator()(const Circle_2& c, const Circular_arc_point_2& p) const { return CK().bounded_side_2_object()(c,p) == ON_UNBOUNDED_SIDE; } - }; #ifndef CGAL_NO_DEPRECATED_CODE @@ -927,31 +872,21 @@ namespace CircularFunctors { class Construct_supporting_circle_2 { typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Circle_2 Circle_2; public: - - typedef Circle_2 result_type; - - CGAL_DEPRECATED result_type operator() (const Circular_arc_2 & a) const + CGAL_DEPRECATED decltype(auto) operator() (const Circular_arc_2 & a) const { return a.rep().supporting_circle(); } }; - template class Construct_supporting_line_2 { typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK::Line_2 Line_2; - typedef typename CK::Circle_2 Circle_2; public: - - typedef Line_2 result_type; - - CGAL_DEPRECATED result_type operator() (const Line_arc_2 & a) const + CGAL_DEPRECATED decltype(auto) operator() (const Line_arc_2 & a) const { return a.rep().supporting_line(); } @@ -960,24 +895,28 @@ namespace CircularFunctors { template class Construct_center_2 - : public CK::Linear_kernel::Construct_center_2 + // : public CK::Linear_kernel::Construct_center_2 { typedef typename CK::Circular_arc_2 Circular_arc_2; - public: - typedef typename CK::Linear_kernel::Construct_center_2::result_type result_type; - using CK::Linear_kernel::Construct_center_2::operator(); - result_type + typedef typename CK::Linear_kernel::Construct_center_2 Linear_Construct_center_2; + + public: + // using CK::Linear_kernel::Construct_center_2::operator(); + + template + decltype(auto) + operator()(const A& a) const + { return Linear_Construct_center_2()(a); } + + decltype(auto) operator()(const Circular_arc_2& c) const { return c.rep().center(); } - }; template class Compute_squared_radius_2 { - - private: typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Linear_kernel LK; typedef typename LK::Compute_squared_radius_2 LK_Compute_squared_radius_2; diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h b/Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h index 9a3ca3b1a89..ae9453be1c0 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h @@ -54,7 +54,7 @@ namespace Intersections { \ } \ template \ inline \ -bool \ +typename K::Boolean \ do_intersect(const A &c1, const B &c2) \ { \ return typename K::Do_intersect_2()(c1, c2); \ diff --git a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_predicates.h b/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_predicates.h index 90fbdc38534..53b554c95b8 100644 --- a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_predicates.h +++ b/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2/bbox_filtered_predicates.h @@ -33,6 +33,7 @@ namespace Bbox_functors { template class Compare_x_2 : public BK::Circular_kernel:: template Base< BK >::Type::Compare_x_2 { + typedef typename BK::Comparison_result Comparison_result; typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; typedef typename BK::Point_2 Point_2; typedef typename BK::Circular_kernel:: @@ -40,12 +41,9 @@ class Compare_x_2 : public BK::Circular_kernel:: template Base< BK >::Type::Comp typedef CK_Compare_x_2 Base; public: - - typedef typename CK_Compare_x_2::result_type result_type; - using Base::operator(); - result_type + Comparison_result operator()( const Circular_arc_point_2 &a, const Circular_arc_point_2 &b) const { Bbox_2 bb1=a.bbox(),bb2=b.bbox(); @@ -65,16 +63,15 @@ public: template class Compare_y_2 : public BK::Circular_kernel:: template Base< BK >::Type::Compare_y_2 { + typedef typename BK::Comparison_result Comparison_result; typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; typedef typename BK::Point_2 Point_2; typedef typename BK::Circular_kernel:: template Base< BK >::Type::Compare_y_2 CK_Compare_y_2; typedef CK_Compare_y_2 Base; + public: - - typedef typename CK_Compare_y_2::result_type result_type; - - result_type + Comparison_result operator() (const Point_2 &p0, const Point_2 &p1) const { @@ -83,7 +80,7 @@ public: using Base::operator(); - result_type + Comparison_result operator()( const Circular_arc_point_2 &a, const Circular_arc_point_2 &b) const { Bbox_2 bb1=a.bbox(),bb2=b.bbox(); @@ -105,17 +102,15 @@ class Compare_xy_2 : public BK::Circular_kernel:: template Base< BK >::Type::Com typedef typename BK::Circular_kernel:: template Base< BK >::Type::Compare_xy_2 CK_Compare_xy_2; typedef CK_Compare_xy_2 Base; + + typedef typename BK::Comparison_result Comparison_result; typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; typedef typename BK::Point_2 Point_2; public: - - typedef typename Base::result_type result_type; - using Base::operator(); -public: - result_type + Comparison_result operator()( const Circular_arc_point_2 &a, const Circular_arc_point_2 &b) const { typename BK::Compare_x_2 compx; @@ -137,20 +132,18 @@ class In_x_range_2 : public BK::Circular_kernel:: template Base< BK >::Type::In_ typedef typename BK::Circular_kernel:: template Base< BK >::Type::In_x_range_2 CK_In_x_range_2; typedef CK_In_x_range_2 Base; + + typedef typename BK::Boolean Boolean; typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; typedef typename BK::Circular_arc_2 Circular_arc_2; typedef typename BK::Line_arc_2 Line_arc_2; public: - - typedef typename CK_In_x_range_2::result_type result_type; - using Base::operator(); private: - template - result_type + Boolean _in_x_range_2(const Arc_2 &a, const Circular_arc_point_2 &p) const { @@ -179,42 +172,36 @@ private: } public: - - result_type + Boolean operator()( const Circular_arc_2 &a, const Circular_arc_point_2 &p) const { CGAL_precondition( a.is_x_monotone()); return _in_x_range_2(a,p); } - result_type + Boolean operator()( const Line_arc_2 &a, const Circular_arc_point_2 &p) const { return _in_x_range_2(a,p);} - - }; - template class Compare_y_at_x_2 : public BK::Circular_kernel:: template Base< BK >::Type::Compare_y_at_x_2 { typedef typename BK::Circular_kernel:: template Base< BK >::Type::Compare_y_at_x_2 CK_Compare_y_at_x_2; typedef CK_Compare_y_at_x_2 Base; + + typedef typename BK::Comparison_result Comparison_result; typedef typename BK::Circular_arc_2 Circular_arc_2; typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; typedef typename BK::Line_arc_2 Line_arc_2; public: - - typedef typename CK_Compare_y_at_x_2::result_type result_type; - using Base::operator(); private: - template - result_type + Comparison_result _compare_y_at_x_2(const Circular_arc_point_2 &p,const Arc_2 &a) const { CGAL_precondition_code(bool tmp=In_x_range_2()(a,p)); @@ -232,41 +219,36 @@ private: } public: - - result_type + Comparison_result operator()( const Circular_arc_point_2 &p,const Circular_arc_2 &a ) const { CGAL_precondition( a.is_x_monotone()); return _compare_y_at_x_2(p,a); } - result_type + Comparison_result operator()( const Circular_arc_point_2 &p,const Line_arc_2 &a ) const {return _compare_y_at_x_2(p,a);} - }; - template class Has_on_2 : public BK::Circular_kernel:: template Base< BK >::Type::Has_on_2 { typedef typename BK::Circular_kernel:: template Base< BK >::Type::Has_on_2 CK_Has_on_2; typedef CK_Has_on_2 Base; + + typedef typename BK::Boolean Boolean; typedef typename BK::Circular_arc_2 Circular_arc_2; typedef typename BK::Circular_arc_point_2 Circular_arc_point_2; typedef typename BK::Line_arc_2 Line_arc_2; public: - - typedef typename CK_Has_on_2::result_type result_type; - using Base::operator(); private: - template - result_type + Boolean _has_on_2(const Arc_2 &a, const Circular_arc_point_2 &p) const { Bbox_2 bb1=a.bbox(),bb2=p.bbox(); @@ -278,27 +260,26 @@ private: } public: - - result_type + Boolean operator()( const Circular_arc_2 &a,const Circular_arc_point_2 &p ) const { CGAL_precondition( a.is_x_monotone()); return _has_on_2(a,p); } - result_type + Boolean operator()( const Line_arc_2 &a, const Circular_arc_point_2 &p ) const {return _has_on_2(a,p);} - }; - template class Equal_2 : public BK::Circular_kernel:: template Base< BK >::Type::Equal_2 { typedef typename BK::Circular_kernel:: template Base< BK >::Type::Equal_2 CK_Equal_2; + + typedef typename BK::Boolean Boolean; typedef typename BK::Circular_arc_2 Circular_arc_2; typedef typename BK::Point_2 Point_2; typedef typename BK::Direction_2 Direction_2; @@ -315,15 +296,11 @@ class Equal_2 typedef CK_Equal_2 Base; public: - - typedef typename CK_Equal_2::result_type result_type; - using Base::operator(); private: - template - result_type + Boolean _equal_2(const Arc_2 &a,const Arc_2 &b) const { Bbox_2 bb11=a.source().bbox(), @@ -346,8 +323,7 @@ private: } public: - - result_type + Boolean operator()( const Circular_arc_point_2 &a , const Circular_arc_point_2 &b) const { @@ -361,14 +337,15 @@ public: /* WAS THAT HERE FOR OTHER COMPILERS THAN VC* ??? // redefine to solve ambiguous call error - result_type + Boolean operator()( const Point_2 &a , const Point_2 &b) const { return CK_Equal_2()( a, b); } */ - result_type + + Boolean operator()( const Circular_arc_2 &a , const Circular_arc_2 &b ) const { CGAL_precondition( a.is_x_monotone()); @@ -377,17 +354,17 @@ public: return _equal_2(a,b); } - result_type + Boolean operator()( const Line_arc_2 &a , const Line_arc_2 &b ) const { return _equal_2(a,b);} - result_type + Boolean operator()( const Circular_arc_2 & , const Line_arc_2 & ) const { return false;} - result_type + Boolean operator()( const Line_arc_2 & , const Circular_arc_2 & ) const { return false;} @@ -401,19 +378,17 @@ class Do_overlap_2 : public BK::Circular_kernel:: template Base< BK >::Type::Do_ typedef typename BK::Circular_kernel:: template Base< BK >::Type::Do_overlap_2 CK_Do_overlap_2; typedef CK_Do_overlap_2 Base; + + typedef typename BK::Boolean Boolean; typedef typename BK::Circular_arc_2 Circular_arc_2; typedef typename BK::Line_arc_2 Line_arc_2; public: - - typedef typename CK_Do_overlap_2::result_type result_type; - using Base::operator(); private: - template - result_type + Boolean _do_overlap_2(const Arc_2 &a, const Arc_2 &b) const { Bbox_2 bb1=a.bbox(),bb2=b.bbox(); @@ -424,10 +399,8 @@ private: return false; } - public: - - result_type + Boolean operator()( const Circular_arc_2 &a , const Circular_arc_2 &b ) const { CGAL_precondition( a.is_x_monotone()); @@ -435,28 +408,26 @@ public: return _do_overlap_2(a,b); } - result_type + Boolean operator()( const Line_arc_2 &a , const Line_arc_2 &b ) const { return _do_overlap_2(a,b);} - result_type + Boolean operator()( const Circular_arc_2 & , const Line_arc_2 & ) const { return false;} - result_type + Boolean operator()( const Line_arc_2 & , const Circular_arc_2 & ) const { return false;} }; - template < class BK > class Intersect_2 : public BK::Circular_kernel:: template Base< BK >::Type::Intersect_2 { -public: typedef typename BK::Circular_kernel:: template Base< BK >::Type::Intersect_2 CK_Intersect_2; @@ -466,6 +437,7 @@ public: typedef typename BK::Circle_2 Circle; typedef typename BK::Line_2 Line_2; +public: using CK_Intersect_2::operator(); template < class OutputIterator > diff --git a/Circular_kernel_3/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 d4cea361700..dcd32713207 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,6 +74,8 @@ 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 { @@ -103,11 +111,9 @@ template < class SK > \ 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; @@ -125,35 +131,39 @@ template < class SK > \ typedef typename SK::Line_arc_3 Line_arc_3; typedef typename SK::Circular_arc_3 Circular_arc_3; + typedef typename SK::Linear_kernel::Equal_3 Linear_equal_3; + public: + // using SK::Linear_kernel::Equal_3::operator(); - typedef typename SK::Linear_kernel::Equal_3::result_type result_type; + template + Boolean + operator()(const A& a, const B& b) const + { return Linear_equal_3()(a, b); } - using SK::Linear_kernel::Equal_3::operator(); - - result_type + Boolean operator() (const Circular_arc_point_3 &c0, const Circular_arc_point_3 &c1) const { return SphericalFunctors::equal(c0, c1); } - result_type + Boolean operator() (const Circular_arc_point_3 &c0, const Point_3 &c1) const { return SphericalFunctors::equal(c0, Circular_arc_point_3(c1)); } - result_type + Boolean operator() (const Point_3 &c0, const Circular_arc_point_3 &c1) const { return SphericalFunctors::equal(Circular_arc_point_3(c0), c1); } // Our Line_arc_3 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); } @@ -175,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, @@ -205,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, @@ -213,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, @@ -221,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, @@ -229,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, @@ -237,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, @@ -245,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, @@ -253,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 @@ -466,8 +473,6 @@ template < class SK > \ { return c.rep().supporting_plane(); } }; - - template class Construct_line_3 { @@ -611,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 @@ -655,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 @@ -663,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 @@ -694,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 @@ -755,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()); } }; @@ -770,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()); } }; @@ -786,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()); } }; @@ -804,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; @@ -835,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); } @@ -905,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; @@ -916,20 +907,25 @@ template < class SK > \ typedef typename SK::Circle_3 Circle_3; typedef typename SK::Circle_3 Circular_arc_point_3; - public: - typedef typename SK::Linear_kernel::Do_intersect_3::result_type result_type; + typedef typename SK::Linear_kernel::Do_intersect_3 Linear_Do_intersect_3; - using SK::Linear_kernel::Do_intersect_3::operator(); + public: + // using SK::Linear_kernel::Do_intersect_3::operator(); + + template + Boolean + operator()(const A& a, const B& b) const + { return Linear_Do_intersect_3()(a, b); } #define CGAL_SPHERICAL_KERNEL_MACRO_DO_INTERSECTION_3_2(A,B) \ - result_type \ + Boolean \ operator()(const A & c1, const B & c2) const \ { std::vector< typename SK3_Intersection_traits::type > res; \ typename SK::Intersect_3()(c1,c2,std::back_inserter(res)); \ return !res.empty(); } #define CGAL_SPHERICAL_KERNEL_MACRO_DO_INTERSECTION_3_3(A,B,C) \ - result_type \ + Boolean \ operator()(const A & c1, const B & c2, const C & c3) const \ { std::vector< typename SK3_Intersection_traits::type > res; \ typename SK::Intersect_3()(c1,c2,c3,std::back_inserter(res)); \ @@ -987,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 > @@ -1217,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); } @@ -1243,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 @@ -1262,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; @@ -1275,8 +1266,15 @@ template < class SK > \ typedef typename SK::Iso_cuboid_3 Iso_cuboid_3; typedef typename SK::Line_arc_3 Line_arc_3; + typedef typename SK::Linear_kernel::Construct_bbox_3 Linear_Construct_bbox_3; + public: - using SK::Linear_kernel::Construct_bbox_3::operator(); + // using SK::Linear_kernel::Construct_bbox_3::operator(); + + template + decltype(auto) + operator()(const A& a) const + { return Linear_Construct_bbox_3()(a); } decltype(auto) operator() (const Circular_arc_point_3 & c) const { return c.rep().bbox(); } @@ -1291,60 +1289,73 @@ template < class SK > \ 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: - typedef double result_type; + // using SK::Linear_kernel::Compute_approximate_squared_length_3::operator(); - using SK::Linear_kernel::Compute_approximate_squared_length_3::operator(); + template + double + operator()(const A& a) const + { return Linear_Compute_approximate_squared_length_3()(a); } - result_type operator() (const Circular_arc_3 & c) const + double operator() (const Circular_arc_3 & c) const { return c.rep().approximate_squared_length(); } }; template class Compute_approximate_angle_3 - : public SK::Linear_kernel::Compute_approximate_angle_3 + // : public SK::Linear_kernel::Compute_approximate_angle_3 { - typedef typename SK::Point_3 Point_3; - typedef typename SK::Vector_3 Vector_3; typedef typename SK::Circular_arc_3 Circular_arc_3; - typedef typename SK::FT FT; + + typedef typename SK::Linear_kernel::Compute_approximate_angle_3 Linear_Compute_approximate_angle_3; public: - typedef double result_type; + // 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); } @@ -1354,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; } @@ -1380,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); } @@ -1468,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: @@ -1487,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)); @@ -1519,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 @@ -1534,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 c93094bd1d2..b8c3d212bf7 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h @@ -85,7 +85,7 @@ namespace CGAL { template < class SK > inline - typename SK::Linear_kernel::Bounded_side_3::result_type + typename SK::Bounded_side bounded_side(const typename SK::Sphere_3 &s, const typename SK::Circular_arc_point_3 &p) { typedef typename SK::Algebraic_kernel Algebraic_kernel; @@ -99,7 +99,7 @@ namespace CGAL { template < class SK > inline - typename SK::Linear_kernel::Bounded_side + typename SK::Bounded_side bounded_side(const typename SK::Circle_3 &c, const typename SK::Circular_arc_point_3 &p) { typedef typename SK::Algebraic_kernel Algebraic_kernel; diff --git a/Circular_kernel_3/include/CGAL/Spherical_kernel_intersections.h b/Circular_kernel_3/include/CGAL/Spherical_kernel_intersections.h index 9360c96d18f..a587d87cea4 100644 --- a/Circular_kernel_3/include/CGAL/Spherical_kernel_intersections.h +++ b/Circular_kernel_3/include/CGAL/Spherical_kernel_intersections.h @@ -46,7 +46,7 @@ intersection(const A &c1, const B &c2, OutputIterator res) \ } \ template \ inline \ -bool \ +typename K::Boolean \ do_intersect(const A &c1, const B &c2) \ { \ return typename K::Do_intersect_3()(c1, c2); \ @@ -61,7 +61,7 @@ intersection(const A &c1, const B &c2, const C &c3, OutputIterator r } \ template \ inline \ -bool \ +typename K::Boolean \ do_intersect(const A &c1, const B &c2, const C &c3) \ { \ return typename K::Do_intersect_3()(c1, c2, c3); \ diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h index 5c3a64287d2..f8540555c82 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; From 981e68c0e9a448dec132f455381e68b65cae6fc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 8 Jan 2025 17:25:48 +0100 Subject: [PATCH 38/68] Fix using non-existant has_on_2 API --- .../examples/Circular_kernel_2/functor_has_on_2.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Circular_kernel_2/examples/Circular_kernel_2/functor_has_on_2.cpp b/Circular_kernel_2/examples/Circular_kernel_2/functor_has_on_2.cpp index eba947c1d37..8efde8736ee 100644 --- a/Circular_kernel_2/examples/Circular_kernel_2/functor_has_on_2.cpp +++ b/Circular_kernel_2/examples/Circular_kernel_2/functor_has_on_2.cpp @@ -5,6 +5,7 @@ typedef CGAL::Exact_circular_kernel_2 Circular_k; typedef CGAL::Point_2 Point_2; typedef CGAL::Circular_arc_2 Circular_arc_2; +typedef CGAL::Circular_arc_point_2 Circular_arc_point_2; int main() { @@ -13,8 +14,8 @@ int main() for(int i = 0; i <= 10; i++) { for(int j = 0; j <= 10; j++) { - Point_2 p = Point_2(i, j); - if(Circular_k().has_on_2_object()(c,p)) { + Circular_arc_point_2 cap(Point_2(i, j)); + if(Circular_k().has_on_2_object()(c,cap)) { n++; std::cout << "(" << i << "," << j << ")" << std::endl; } From 30064c18db89e19ecf645a1cecdb789f9f194f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 8 Jan 2025 17:26:04 +0100 Subject: [PATCH 39/68] Do not return const values --- .../include/CGAL/Circular_kernel_3/Circular_arc_point_3.h | 2 +- Circular_kernel_3/include/CGAL/Circular_kernel_3/Line_arc_3.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 bfb44edf924..35dc8b46908 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/Circular_arc_point_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/Circular_arc_point_3.h @@ -211,7 +211,7 @@ public: const Root_for_spheres_2_3 & coordinates() const { return get_pointee_or_identity(base); } - const CGAL::Bbox_3 bbox() const { + CGAL::Bbox_3 bbox() const { return get_pointee_or_identity(base).bbox(); } diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/Line_arc_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/Line_arc_3.h index 9d10940f0aa..d726f22b1fd 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(); } From 2f825080d5b5aa1915004f1b83fd180d153c58cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 16 Jan 2025 10:37:21 +0100 Subject: [PATCH 40/68] Use the kernel's Boolean and enums --- .../include/CGAL/Cartesian/Circle_2.h | 5 +- .../include/CGAL/Cartesian/Circle_3.h | 29 +++++----- .../include/CGAL/Cartesian/Direction_2.h | 10 ++-- .../include/CGAL/Cartesian/Iso_cuboid_3.h | 18 +++--- .../include/CGAL/Cartesian/Line_3.h | 17 +++--- .../include/CGAL/Cartesian/Segment_3.h | 21 +++---- .../include/CGAL/Cartesian/Sphere_3.h | 18 +++--- .../include/CGAL/Cartesian/Triangle_3.h | 17 +++--- .../include/CGAL/Cartesian/Vector_2.h | 12 ++-- .../include/CGAL/Cartesian/Vector_3.h | 12 ++-- .../CGAL/Cartesian/predicates_on_points_2.h | 6 +- .../CGAL/Cartesian/predicates_on_points_3.h | 16 +++--- .../include/CGAL/predicates/kernel_ftC3.h | 2 +- .../include/CGAL/Homogeneous/CircleH2.h | 48 ++++++++-------- .../include/CGAL/Homogeneous/DirectionH2.h | 9 ++- .../include/CGAL/Homogeneous/DirectionH3.h | 12 ++-- .../include/CGAL/Homogeneous/Iso_cuboidH3.h | 36 ++++++------ .../CGAL/Homogeneous/Iso_rectangleH2.h | 4 +- .../include/CGAL/Homogeneous/LineH2.h | 8 +-- .../include/CGAL/Homogeneous/PlaneH3.h | 32 +++++------ .../include/CGAL/Homogeneous/PointH2.h | 8 +-- .../include/CGAL/Homogeneous/PointH3.h | 8 +-- .../include/CGAL/Homogeneous/RayH3.h | 20 +++---- .../include/CGAL/Homogeneous/SphereH3.h | 32 +++++------ .../include/CGAL/Homogeneous/VectorH2.h | 16 +++--- .../include/CGAL/Homogeneous/VectorH3.h | 8 +-- .../CGAL/Homogeneous/distance_predicatesH2.h | 14 ++--- .../CGAL/Homogeneous/distance_predicatesH3.h | 36 ++++++------ .../CGAL/Homogeneous/predicates_on_pointsH2.h | 12 ++-- .../CGAL/Homogeneous/predicates_on_pointsH3.h | 19 ++++--- Kernel_23/include/CGAL/Circle_3.h | 2 +- Kernel_23/include/CGAL/Iso_cuboid_3.h | 12 ++-- Kernel_23/include/CGAL/Iso_rectangle_2.h | 14 ++--- .../include/CGAL/Kernel/global_functions.h | 6 +- .../Kernel_23/internal/Projection_traits_3.h | 56 +++++++++++-------- .../internal/Projection_traits_base_3.h | 3 + Kernel_23/include/CGAL/Line_3.h | 6 +- Kernel_23/include/CGAL/Plane_3.h | 19 ++++--- Kernel_23/include/CGAL/Ray_2.h | 13 ++--- Kernel_23/include/CGAL/Ray_3.h | 9 +-- Kernel_23/include/CGAL/Segment_2.h | 26 ++++----- Kernel_23/include/CGAL/Segment_3.h | 5 +- Kernel_23/include/CGAL/Tetrahedron_3.h | 19 ++++--- Kernel_23/include/CGAL/Triangle_3.h | 6 +- 44 files changed, 359 insertions(+), 342 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h index a1a50a6fb9f..55874513258 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h @@ -25,6 +25,7 @@ namespace CGAL { template class CircleC2 { + typedef typename R_::Boolean Boolean; typedef typename R_::FT FT; typedef typename R_::RT RT; typedef typename R_::Circle_2 Circle_2; @@ -49,8 +50,8 @@ public: base = Rep(center, squared_radius, orient); } - bool operator==(const CircleC2 &s) const; - bool operator!=(const CircleC2 &s) const; + Boolean operator==(const CircleC2& s) const; + Boolean operator!=(const CircleC2& s) const; const Point_2 & center() const { diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h index 47d45e0e113..8f2a2fadc8c 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h @@ -23,6 +23,8 @@ namespace CGAL { template class CircleC3 { + typedef typename R_::Boolean Boolean; + typedef typename R_::Bounded_side Bounded_side; typedef typename R_::Sphere_3 Sphere_3; typedef typename R_::Plane_3 Plane_3; typedef typename R_::Point_3 Point_3; @@ -200,15 +202,15 @@ public: (x+mx).sup(),(y+my).sup(),(z+mz).sup()); } - bool operator==(const CircleC3 &) const; - bool operator!=(const CircleC3 &) const; + Boolean operator==(const CircleC3 &) const; + Boolean operator!=(const CircleC3 &) const; - bool has_on(const Point_3 &p) const; - bool has_on_bounded_side(const Point_3 &p) const; - bool has_on_unbounded_side(const Point_3 &p) const; + Boolean has_on(const Point_3 &p) const; + Boolean has_on_bounded_side(const Point_3 &p) const; + Boolean has_on_unbounded_side(const Point_3 &p) const; Bounded_side bounded_side(const Point_3 &p) const; - bool is_degenerate() const + Boolean is_degenerate() const { return diametral_sphere().is_degenerate(); } @@ -217,7 +219,7 @@ public: template < class R > inline -bool +typename R::Boolean CircleC3:: has_on(const typename CircleC3::Point_3 &p) const { @@ -227,7 +229,7 @@ has_on(const typename CircleC3::Point_3 &p) const template < class R > inline -bool +typename R::Boolean CircleC3:: has_on_bounded_side(const typename CircleC3::Point_3 &p) const { @@ -237,7 +239,7 @@ has_on_bounded_side(const typename CircleC3::Point_3 &p) const template < class R > inline -bool +typename R::Boolean CircleC3:: has_on_unbounded_side(const typename CircleC3::Point_3 &p) const { @@ -246,8 +248,7 @@ has_on_unbounded_side(const typename CircleC3::Point_3 &p) const } template < class R > -CGAL_KERNEL_INLINE -Bounded_side +typename R::Bounded_side CircleC3:: bounded_side(const typename CircleC3::Point_3 &p) const { @@ -256,8 +257,7 @@ bounded_side(const typename CircleC3::Point_3 &p) const } template < class R > -CGAL_KERNEL_INLINE -bool +typename R::Boolean CircleC3::operator==(const CircleC3 &t) const { if (CGAL::identical(base, t.base)) @@ -283,8 +283,7 @@ CircleC3::operator==(const CircleC3 &t) const } template < class R > -CGAL_KERNEL_INLINE -bool +typename R::Boolean CircleC3::operator!=(const CircleC3 &t) const { return !(*this == t); diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Direction_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Direction_2.h index 4d27652873c..10b8fdb3ca7 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Direction_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Direction_2.h @@ -26,6 +26,8 @@ template < class R_ > class DirectionC2 { typedef DirectionC2 Self; + + typedef typename R_::Boolean Boolean; typedef typename R_::FT FT; typedef FT RT; typedef typename R_::Point_2 Point_2; @@ -49,8 +51,8 @@ public: DirectionC2(const FT &x, const FT &y) : base(CGAL::make_array(x, y)) {} - bool operator==(const DirectionC2 &d) const; - bool operator!=(const DirectionC2 &d) const; + Boolean operator==(const DirectionC2 &d) const; + Boolean operator!=(const DirectionC2 &d) const; Vector_2 to_vector() const; @@ -66,7 +68,7 @@ public: template < class R > inline -bool +typename R::Boolean DirectionC2::operator==(const DirectionC2 &d) const { if (CGAL::identical(base, d.base)) @@ -76,7 +78,7 @@ DirectionC2::operator==(const DirectionC2 &d) const template < class R > inline -bool +typename R::Boolean DirectionC2::operator!=(const DirectionC2 &d) const { return !( *this == d ); diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h index 2e22a69b77d..bb3b69bad24 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h @@ -26,6 +26,8 @@ namespace CGAL { template < class R_ > class Iso_cuboidC3 { + typedef typename R_::Boolean Boolean; + typedef typename R_::Bounded_side Bounded_side; typedef typename R_::FT FT; typedef typename R_::Iso_cuboid_3 Iso_cuboid_3; typedef typename R_::Point_3 Point_3; @@ -98,8 +100,8 @@ public: Construct_point_3()(max_hx/hw, max_hy/hw, max_hz/hw))); } - typename R::Boolean operator==(const Iso_cuboidC3& s) const; - typename R::Boolean operator!=(const Iso_cuboidC3& s) const; + Boolean operator==(const Iso_cuboidC3& s) const; + Boolean operator!=(const Iso_cuboidC3& s) const; const Point_3 & min BOOST_PREVENT_MACRO_SUBSTITUTION () const { @@ -118,11 +120,11 @@ public: } Bounded_side bounded_side(const Point_3& p) const; - typename R::Boolean has_on(const Point_3& p) const; - typename R::Boolean has_on_boundary(const Point_3& p) const; - typename R::Boolean has_on_bounded_side(const Point_3& p) const; - typename R::Boolean has_on_unbounded_side(const Point_3& p) const; - typename R::Boolean is_degenerate() const; + Boolean has_on(const Point_3& p) const; + Boolean has_on_boundary(const Point_3& p) const; + Boolean has_on_bounded_side(const Point_3& p) const; + Boolean has_on_unbounded_side(const Point_3& p) const; + Boolean is_degenerate() const; const FT & xmin() const; const FT & ymin() const; const FT & zmin() const; @@ -267,7 +269,7 @@ Iso_cuboidC3::volume() const template < class R > CGAL_KERNEL_MEDIUM_INLINE -Bounded_side +typename R::Bounded_side Iso_cuboidC3:: bounded_side(const typename Iso_cuboidC3::Point_3& p) const { diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Line_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Line_3.h index 4a04a70bcbb..a3798844fe0 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Line_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Line_3.h @@ -24,6 +24,7 @@ namespace CGAL { template < class R_ > class LineC3 { + typedef typename R_::Boolean Boolean; typedef typename R_::FT FT; typedef typename R_::Point_3 Point_3; typedef typename R_::Vector_3 Vector_3; @@ -65,8 +66,8 @@ public: LineC3(const Point_3 &p, const Direction_3 &d) { *this = R().construct_line_3_object()(p, d); } - bool operator==(const LineC3 &l) const; - bool operator!=(const LineC3 &l) const; + typename R::Boolean operator==(const LineC3 &l) const; + typename R::Boolean operator!=(const LineC3 &l) const; Plane_3 perpendicular_plane(const Point_3 &p) const; Line_3 opposite() const; @@ -88,13 +89,13 @@ public: Point_3 point(const FT i) const; - bool has_on(const Point_3 &p) const; - bool is_degenerate() const; + Boolean has_on(const Point_3 &p) const; + Boolean is_degenerate() const; }; template < class R > inline -bool +typename R::Boolean LineC3::operator==(const LineC3 &l) const { if (CGAL::identical(base, l.base)) @@ -104,7 +105,7 @@ LineC3::operator==(const LineC3 &l) const template < class R > inline -bool +typename R::Boolean LineC3::operator!=(const LineC3 &l) const { return !(*this == l); @@ -135,7 +136,7 @@ LineC3::opposite() const template < class R > inline -bool +typename R::Boolean LineC3:: has_on(const typename LineC3::Point_3 &p) const { @@ -144,7 +145,7 @@ has_on(const typename LineC3::Point_3 &p) const template < class R > inline -bool +typename R::Boolean LineC3::is_degenerate() const { return to_vector() == NULL_VECTOR; diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h index 122626550f4..4abf77e46c4 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h @@ -25,6 +25,7 @@ namespace CGAL { template < class R_ > class SegmentC3 { + typedef typename R_::Boolean Boolean; typedef typename R_::Point_3 Point_3; typedef typename R_::Direction_3 Direction_3; typedef typename R_::Vector_3 Vector_3; @@ -44,11 +45,11 @@ public: SegmentC3(const Point_3 &sp, const Point_3 &ep) : base(CGAL::make_array(sp, ep)) {} - bool has_on(const Point_3 &p) const; - bool collinear_has_on(const Point_3 &p) const; + Boolean has_on(const Point_3 &p) const; + Boolean collinear_has_on(const Point_3 &p) const; - bool operator==(const SegmentC3 &s) const; - bool operator!=(const SegmentC3 &s) const; + Boolean operator==(const SegmentC3 &s) const; + Boolean operator!=(const SegmentC3 &s) const; const Point_3 & source() const { @@ -73,12 +74,12 @@ public: Line_3 supporting_line() const; Segment_3 opposite() const; - bool is_degenerate() const; + Boolean is_degenerate() const; }; template < class R > inline -bool +typename R::Boolean SegmentC3::operator==(const SegmentC3 &s) const { if (CGAL::identical(base, s.base)) @@ -88,7 +89,7 @@ SegmentC3::operator==(const SegmentC3 &s) const template < class R > inline -bool +typename R::Boolean SegmentC3::operator!=(const SegmentC3 &s) const { return !(*this == s); @@ -184,7 +185,7 @@ SegmentC3::opposite() const template < class R > inline -bool +typename R::Boolean SegmentC3::is_degenerate() const { return source() == target(); @@ -192,7 +193,7 @@ SegmentC3::is_degenerate() const template < class R > inline -bool +typename R::Boolean SegmentC3:: has_on(const typename SegmentC3::Point_3 &p) const { @@ -201,7 +202,7 @@ has_on(const typename SegmentC3::Point_3 &p) const template < class R > inline -bool +typename R::Boolean SegmentC3:: collinear_has_on(const typename SegmentC3::Point_3 &p) const { diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h index d5f0768f30c..d9b733a666d 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h @@ -27,6 +27,8 @@ namespace CGAL { template class SphereC3 { + typedef typename R_::Boolean Boolean; + typedef typename R_::Bounded_side Bounded_side; typedef typename R_::FT FT; // https://doc.cgal.org/latest/Manual/devman_code_format.html#secprogramming_conventions typedef typename R_::Point_3 Point_3_; @@ -124,17 +126,17 @@ public: //! precond: ! x.is_degenerate() (when available) // Returns R::ON_POSITIVE_SIDE, R::ON_ORIENTED_BOUNDARY or // R::ON_NEGATIVE_SIDE - typename R::Boolean has_on(const Circle_3 &p) const; - typename R::Boolean has_on(const Point_3_ &p) const; - typename R::Boolean has_on_boundary(const Point_3_ &p) const; - typename R::Boolean has_on_positive_side(const Point_3_ &p) const; - typename R::Boolean has_on_negative_side(const Point_3_ &p) const; + Boolean has_on(const Circle_3 &p) const; + Boolean has_on(const Point_3_ &p) const; + Boolean has_on_boundary(const Point_3_ &p) const; + Boolean has_on_positive_side(const Point_3_ &p) const; + Boolean has_on_negative_side(const Point_3_ &p) const; - typename R_::Bounded_side bounded_side(const Point_3_ &p) const; + Bounded_side bounded_side(const Point_3_ &p) const; //! precond: ! x.is_degenerate() (when available) // Returns R::ON_BOUNDED_SIDE, R::ON_BOUNDARY or R::ON_UNBOUNDED_SIDE - typename R::Boolean has_on_bounded_side(const Point_3_ &p) const; - typename R::Boolean has_on_unbounded_side(const Point_3_ &p) const; + Boolean has_on_bounded_side(const Point_3_ &p) const; + Boolean has_on_unbounded_side(const Point_3_ &p) const; }; template < class R > diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Triangle_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Triangle_3.h index 1fa2525ae10..f6b605412b1 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Triangle_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Triangle_3.h @@ -25,6 +25,7 @@ namespace CGAL { template class TriangleC3 { + typedef typename R_::Boolean Boolean; typedef typename R_::FT FT; typedef typename R_::Point_3 Point_3; typedef typename R_::Vector_3 Vector_3; @@ -44,13 +45,13 @@ public: TriangleC3(const Point_3 &p, const Point_3 &q, const Point_3 &r) : base(CGAL::make_array(p, q, r)) {} - bool operator==(const TriangleC3 &t) const; - bool operator!=(const TriangleC3 &t) const; + Boolean operator==(const TriangleC3 &t) const; + Boolean operator!=(const TriangleC3 &t) const; Plane_3 supporting_plane() const; - bool has_on(const Point_3 &p) const; - bool is_degenerate() const; + Boolean has_on(const Point_3 &p) const; + Boolean is_degenerate() const; const Point_3 & vertex(int i) const; const Point_3 & operator[](int i) const; @@ -59,7 +60,7 @@ public: }; template < class R > -bool +typename R::Boolean TriangleC3::operator==(const TriangleC3 &t) const { if (CGAL::identical(base, t.base)) @@ -75,7 +76,7 @@ TriangleC3::operator==(const TriangleC3 &t) const template < class R > inline -bool +typename R::Boolean TriangleC3::operator!=(const TriangleC3 &t) const { return !(*this == t); @@ -118,7 +119,7 @@ TriangleC3::supporting_plane() const template < class R > inline -bool +typename R::Boolean TriangleC3:: has_on(const typename TriangleC3::Point_3 &p) const { @@ -127,7 +128,7 @@ has_on(const typename TriangleC3::Point_3 &p) const } template < class R > -bool +typename R::Boolean TriangleC3::is_degenerate() const { return collinear(vertex(0),vertex(1),vertex(2)); diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h index 575df5d0728..2d6f75d78a8 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h @@ -104,7 +104,7 @@ public: template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean operator==(const VectorC2 &v, const VectorC2 &w) { return w.x() == v.x() && w.y() == v.y(); @@ -112,7 +112,7 @@ operator==(const VectorC2 &v, const VectorC2 &w) template < class R > inline -bool +typename R::Boolean operator!=(const VectorC2 &v, const VectorC2 &w) { return !(v == w); @@ -120,7 +120,7 @@ operator!=(const VectorC2 &v, const VectorC2 &w) template < class R > inline -bool +typename R::Boolean operator==(const VectorC2 &v, const Null_vector &) { return CGAL_NTS is_zero(v.x()) && CGAL_NTS is_zero(v.y()); @@ -128,7 +128,7 @@ operator==(const VectorC2 &v, const Null_vector &) template < class R > inline -bool +typename R::Boolean operator==(const Null_vector &n, const VectorC2 &v) { return v == n; @@ -136,7 +136,7 @@ operator==(const Null_vector &n, const VectorC2 &v) template < class R > inline -bool +typename R::Boolean operator!=(const VectorC2 &v, const Null_vector &n) { return !(v == n); @@ -144,7 +144,7 @@ operator!=(const VectorC2 &v, const Null_vector &n) template < class R > inline -bool +typename R::Boolean operator!=(const Null_vector &n, const VectorC2 &v) { return !(v == n); diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h index 5b03e8d0fb3..034ca73fe1d 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h @@ -139,7 +139,7 @@ public: template < class R > inline -bool +typename R::Boolean operator==(const VectorC3 &v, const VectorC3 &w) { return w.x() == v.x() && w.y() == v.y() && w.z() == v.z(); @@ -147,7 +147,7 @@ operator==(const VectorC3 &v, const VectorC3 &w) template < class R > inline -bool +typename R::Boolean operator!=(const VectorC3 &v, const VectorC3 &w) { return !(v == w); @@ -155,7 +155,7 @@ operator!=(const VectorC3 &v, const VectorC3 &w) template < class R > inline -bool +typename R::Boolean operator==(const VectorC3 &v, const Null_vector &) { return CGAL_NTS is_zero(v.x()) && CGAL_NTS is_zero(v.y()) && @@ -164,7 +164,7 @@ operator==(const VectorC3 &v, const Null_vector &) template < class R > inline -bool +typename R::Boolean operator==(const Null_vector &n, const VectorC3 &v) { return v == n; @@ -172,7 +172,7 @@ operator==(const Null_vector &n, const VectorC3 &v) template < class R > inline -bool +typename R::Boolean operator!=(const VectorC3 &v, const Null_vector &n) { return !(v == n); @@ -180,7 +180,7 @@ operator!=(const VectorC3 &v, const Null_vector &n) template < class R > inline -bool +typename R::Boolean operator!=(const Null_vector &n, const VectorC3 &v) { return !(v == n); diff --git a/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_2.h b/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_2.h index 659b17f995f..3941d1b0fdf 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_2.h @@ -24,7 +24,7 @@ namespace CGAL { template < class K > inline -bool +typename K::Boolean equal_xy(const PointC2 &p, const PointC2 &q) { return CGAL_AND( p.x() == q.x() , p.y() == q.y() ); @@ -34,7 +34,7 @@ equal_xy(const PointC2 &p, const PointC2 &q) // Unused, undocumented, un-functorized. template < class K > inline -Comparison_result +typename K::Comparison_result compare_deltax_deltay(const PointC2& p, const PointC2& q, const PointC2& r, @@ -46,7 +46,7 @@ compare_deltax_deltay(const PointC2& p, template < class K > inline -Comparison_result +typename K::Comparison_result compare_lexicographically_yx(const PointC2 &p, const PointC2 &q) { diff --git a/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_3.h b/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_3.h index c3a7d37aabf..35c2e3a2c32 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_3.h @@ -24,7 +24,7 @@ namespace CGAL { template < class K > inline -bool +typename K::Boolean equal_xy(const PointC3 &p, const PointC3 &q) { return K().equal_xy_3_object()(p, q); @@ -32,7 +32,7 @@ equal_xy(const PointC3 &p, const PointC3 &q) template < class K > inline -bool +typename K::Boolean equal_xyz(const PointC3 &p, const PointC3 &q) { return p.x() == q.x() && p.y() == q.y() && p.z() == q.z(); @@ -40,7 +40,7 @@ equal_xyz(const PointC3 &p, const PointC3 &q) template < class K > inline -Comparison_result +typename K::Comparison_result compare_xy(const PointC3 &p, const PointC3 &q) { return K().compare_xy_3_object()(p, q); @@ -48,7 +48,7 @@ compare_xy(const PointC3 &p, const PointC3 &q) template < class K > inline -Comparison_result +typename K::Comparison_result compare_lexicographically_xy(const PointC3 &p, const PointC3 &q) { return K().compare_xy_3_object()(p, q); @@ -56,7 +56,7 @@ compare_lexicographically_xy(const PointC3 &p, const PointC3 &q) template < class K > inline -bool +typename K::Boolean lexicographically_xy_smaller_or_equal(const PointC3 &p, const PointC3 &q) { @@ -65,7 +65,7 @@ lexicographically_xy_smaller_or_equal(const PointC3 &p, template < class K > inline -bool +typename K::Boolean lexicographically_xy_smaller(const PointC3 &p, const PointC3 &q) { @@ -74,7 +74,7 @@ lexicographically_xy_smaller(const PointC3 &p, template < class K > inline -bool +typename K::Boolean strict_dominance(const PointC3 &p, const PointC3 &q) { @@ -84,7 +84,7 @@ strict_dominance(const PointC3 &p, template < class K > inline -bool +typename K::Boolean dominance(const PointC3 &p, const PointC3 &q) { diff --git a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h index 297a29487c2..158c19272b5 100644 --- a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h +++ b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h @@ -693,7 +693,7 @@ power_side_of_oriented_power_sphereC3(const FT &pwt, const FT &qwt) } template < class FT > -Comparison_result +typename Compare::result_type compare_power_distanceC3(const FT &px, const FT &py, const FT &pz, const FT &qx, const FT &qy, const FT &qz, const FT &qw, const FT &rx, const FT &ry, const FT &rz, const FT &rw) diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/CircleH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/CircleH2.h index f2414a459e4..c4d0baf21d5 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/CircleH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/CircleH2.h @@ -84,20 +84,20 @@ public: CircleH2 opposite() const; - Oriented_side + typename R_::Oriented_side oriented_side(const Point_2& ) const; - Bounded_side + typename R_::Bounded_side bounded_side(const Point_2& ) const; bool operator==( const CircleH2& ) const; bool operator!=( const CircleH2& ) const; - bool has_on_positive_side(const Point_2& ) const; - bool has_on_negative_side(const Point_2& ) const; - bool has_on_boundary( const Point_2& ) const; - bool has_on_bounded_side( const Point_2& ) const; - bool has_on_unbounded_side(const Point_2&) const; - bool is_degenerate() const; + typename R_::Boolean has_on_positive_side(const Point_2& ) const; + typename R_::Boolean has_on_negative_side(const Point_2& ) const; + typename R_::Boolean has_on_boundary( const Point_2& ) const; + typename R_::Boolean has_on_bounded_side( const Point_2& ) const; + typename R_::Boolean has_on_unbounded_side(const Point_2&) const; + typename R_::Boolean is_degenerate() const; // bool oriented_equal( const CircleH2& ) const; // bool unoriented_equal( const CircleH2& ) const; @@ -133,17 +133,15 @@ CircleH2::orientation() const template CGAL_KERNEL_INLINE -Oriented_side +typename R::Oriented_side CircleH2::oriented_side( const typename CircleH2::Point_2& p) const { FT sq_dist = squared_distance( p, center() ); FT sq_rad = squared_radius(); - Comparison_result vgl = CGAL_NTS compare( sq_dist, sq_rad ); - Oriented_side rel_pos = (vgl == LARGER ) ? - ON_NEGATIVE_SIDE : - ( (vgl == SMALLER ) ? - ON_POSITIVE_SIDE : - ON_ORIENTED_BOUNDARY); + typename R::Comparison_result vgl = CGAL_NTS compare( sq_dist, sq_rad ); + typename R::Oriented_side rel_pos = (vgl == LARGER ) ? ON_NEGATIVE_SIDE + : ((vgl == SMALLER) ? ON_POSITIVE_SIDE + : ON_ORIENTED_BOUNDARY); if (orientation() == POSITIVE) { return rel_pos; } else // NEGATIVE @@ -152,7 +150,7 @@ CircleH2::oriented_side( const typename CircleH2::Point_2& p) const template CGAL_KERNEL_INLINE -bool +typename R::Boolean CircleH2::has_on_positive_side(const typename CircleH2::Point_2& p) const { if ( orientation() == POSITIVE ) @@ -163,7 +161,7 @@ CircleH2::has_on_positive_side(const typename CircleH2::Point_2& p) const template CGAL_KERNEL_INLINE -bool +typename R::Boolean CircleH2::has_on_boundary(const typename CircleH2::Point_2& p) const { FT sq_dist = squared_distance( p, center() ); @@ -173,7 +171,7 @@ CircleH2::has_on_boundary(const typename CircleH2::Point_2& p) const template CGAL_KERNEL_INLINE -bool +typename R::Boolean CircleH2::has_on_negative_side( const typename CircleH2::Point_2&p) const { if ( orientation() == NEGATIVE ) @@ -188,12 +186,12 @@ CircleH2::has_on_negative_side( const typename CircleH2::Point_2&p) const template CGAL_KERNEL_INLINE -Bounded_side +typename R::Bounded_side CircleH2::bounded_side(const typename CircleH2::Point_2& p) const { FT sq_dist = squared_distance( p, center() ); FT sq_rad = squared_radius(); - Comparison_result vgl = CGAL_NTS compare( sq_dist, sq_rad ); + typename R::Comparison_result vgl = CGAL_NTS compare( sq_dist, sq_rad ); return (vgl == LARGER ) ? ON_UNBOUNDED_SIDE : ( (vgl == SMALLER ) ? ON_BOUNDED_SIDE : @@ -202,7 +200,7 @@ CircleH2::bounded_side(const typename CircleH2::Point_2& p) const template CGAL_KERNEL_INLINE -bool +typename R::Boolean CircleH2::has_on_bounded_side(const typename CircleH2::Point_2& p) const { FT sq_dist = squared_distance( p, center() ); @@ -212,7 +210,7 @@ CircleH2::has_on_bounded_side(const typename CircleH2::Point_2& p) const template CGAL_KERNEL_INLINE -bool +typename R::Boolean CircleH2::has_on_unbounded_side(const typename CircleH2::Point_2&p) const { FT sq_dist = squared_distance( p, center() ); @@ -222,13 +220,13 @@ CircleH2::has_on_unbounded_side(const typename CircleH2::Point_2&p) const template inline -bool +typename R::Boolean CircleH2::is_degenerate() const { return ( squared_radius() == FT(0) ); } template CGAL_KERNEL_INLINE -bool +typename R::Boolean CircleH2::operator==(const CircleH2& c) const { return ( center() == c.center() ) @@ -238,7 +236,7 @@ CircleH2::operator==(const CircleH2& c) const template inline -bool +typename R::Boolean CircleH2::operator!=(const CircleH2& c) const { return !(*this == c); } diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/DirectionH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/DirectionH2.h index a86847f9e87..8bb6c4008a7 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/DirectionH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/DirectionH2.h @@ -64,9 +64,8 @@ public: : base( w > RT(0) ? CGAL::make_array(x, y, w) : CGAL::make_array(-x, -y, -w) ) {} - bool operator==( const DirectionH2& d) const; - bool operator!=( const DirectionH2& d) const; - + typename R_::Boolean operator==( const DirectionH2& d) const; + typename R_::Boolean operator!=( const DirectionH2& d) const; Vector_2 to_vector() const; @@ -81,7 +80,7 @@ public: template CGAL_KERNEL_INLINE -bool +typename R::Boolean DirectionH2::operator==( const DirectionH2& d) const { return ( ( x() * d.y() == y() * d.x() ) @@ -91,7 +90,7 @@ DirectionH2::operator==( const DirectionH2& d) const template inline -bool +typename R::Boolean DirectionH2::operator!=( const DirectionH2& d) const { return !(*this == d); } diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/DirectionH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/DirectionH3.h index a4098d72848..4faa0dc180a 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/DirectionH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/DirectionH3.h @@ -66,10 +66,10 @@ public: : base( w >= RT(0) ? CGAL::make_array(x, y, z, w) : CGAL::make_array(-x, -y, -z, -w) ) {} - bool is_degenerate() const; + typename R::Boolean is_degenerate() const; - bool operator==( const DirectionH3& d) const; - bool operator!=( const DirectionH3& d) const; + typename R::Boolean operator==( const DirectionH3& d) const; + typename R::Boolean operator!=( const DirectionH3& d) const; Vector_3 to_vector() const; Vector_3 vector() const { return to_vector(); } @@ -87,7 +87,7 @@ public: template CGAL_KERNEL_INLINE -bool +typename R::Boolean DirectionH3::operator==( const DirectionH3& d) const { return ( ( hx()*d.hy() == hy()*d.hx() ) @@ -100,13 +100,13 @@ DirectionH3::operator==( const DirectionH3& d) const template inline -bool +typename R::Boolean DirectionH3::operator!=( const DirectionH3& d) const { return !operator==(d); } template CGAL_KERNEL_INLINE -bool +typename R::Boolean DirectionH3::is_degenerate() const { return ((hx() == RT(0)) && (hy() == RT(0)) && (hz() == RT(0))); } diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_cuboidH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_cuboidH3.h index 0119260a3c1..975dd91b4a5 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_cuboidH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_cuboidH3.h @@ -63,23 +63,21 @@ public: Iso_cuboidH3(const RT& min_hx, const RT& min_hy, const RT& min_hz, const RT& max_hx, const RT& max_hy, const RT& max_hz); - bool operator==(const Iso_cuboidH3& s) const; - bool operator!=(const Iso_cuboidH3& s) const; + typename R::Boolean operator==(const Iso_cuboidH3& s) const; + typename R::Boolean operator!=(const Iso_cuboidH3& s) const; const Point_3 & min BOOST_PREVENT_MACRO_SUBSTITUTION () const; const Point_3 & max BOOST_PREVENT_MACRO_SUBSTITUTION () const; Point_3 vertex(int i) const; Point_3 operator[](int i) const; - Iso_cuboidH3 - transform(const Aff_transformation_3& t) const; - Bounded_side - bounded_side(const Point_3& p) const; - bool has_on(const Point_3& p) const; - bool has_on_boundary(const Point_3& p) const; - bool has_on_bounded_side(const Point_3& p) const; - bool has_on_unbounded_side(const Point_3& p) const; - bool is_degenerate() const; + Iso_cuboidH3 transform(const Aff_transformation_3& t) const; + typename R::Bounded_side bounded_side(const Point_3& p) const; + typename R::Boolean has_on(const Point_3& p) const; + typename R::Boolean has_on_boundary(const Point_3& p) const; + typename R::Boolean has_on_bounded_side(const Point_3& p) const; + typename R::Boolean has_on_unbounded_side(const Point_3& p) const; + typename R::Boolean is_degenerate() const; FT xmin() const; FT ymin() const; FT zmin() const; @@ -189,14 +187,14 @@ Iso_cuboidH3(const RT& min_hx, const RT& min_hy, const RT& min_hz, template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean Iso_cuboidH3:: operator==(const Iso_cuboidH3& r) const { return ((this->min)() == (r.min)()) && ((this->max)() == (r.max)()); } template < class R > inline -bool +typename R::Boolean Iso_cuboidH3:: operator!=(const Iso_cuboidH3& r) const { return !(*this == r); } @@ -313,7 +311,7 @@ Iso_cuboidH3::operator[](int i) const template < class R > CGAL_KERNEL_MEDIUM_INLINE -Bounded_side +typename R::Bounded_side Iso_cuboidH3:: bounded_side(const typename Iso_cuboidH3::Point_3& p) const { @@ -337,34 +335,34 @@ bounded_side(const typename Iso_cuboidH3::Point_3& p) const template < class R > inline -bool +typename R::Boolean Iso_cuboidH3:: has_on_boundary(const typename Iso_cuboidH3::Point_3& p) const { return ( bounded_side(p) == ON_BOUNDARY ); } template < class R > inline -bool +typename R::Boolean Iso_cuboidH3::has_on(const typename Iso_cuboidH3::Point_3& p) const { return ( bounded_side(p) == ON_BOUNDARY ); } template < class R > inline -bool +typename R::Boolean Iso_cuboidH3:: has_on_bounded_side(const typename Iso_cuboidH3::Point_3& p) const { return ( bounded_side(p) == ON_BOUNDED_SIDE ); } template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean Iso_cuboidH3:: has_on_unbounded_side(const typename Iso_cuboidH3::Point_3& p) const { return ( bounded_side(p) == ON_UNBOUNDED_SIDE ); } template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean Iso_cuboidH3::is_degenerate() const { return ( ( (this->min)().hx() == (this->max)().hx() ) diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_rectangleH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_rectangleH2.h index 5c3f1ba9d32..2f53d8c957e 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_rectangleH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Iso_rectangleH2.h @@ -52,7 +52,7 @@ public: const Point_2 & min BOOST_PREVENT_MACRO_SUBSTITUTION () const; const Point_2 & max BOOST_PREVENT_MACRO_SUBSTITUTION () const; - Bounded_side bounded_side(const Point_2& p) const; + typename R_::Bounded_side bounded_side(const Point_2& p) const; }; @@ -71,7 +71,7 @@ Iso_rectangleH2::max BOOST_PREVENT_MACRO_SUBSTITUTION () const template < class R > CGAL_KERNEL_INLINE -Bounded_side +typename R::Bounded_side Iso_rectangleH2:: bounded_side(const typename Iso_rectangleH2::Point_2& p) const { diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/LineH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/LineH2.h index 5f37cfee985..8767e63d2e0 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/LineH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/LineH2.h @@ -47,8 +47,8 @@ public: LineH2(const RT& a, const RT& b, const RT& c) : base(CGAL::make_array(a, b, c)) {} - bool operator==(const LineH2& l) const; - bool operator!=(const LineH2& l) const; + typename R_::Boolean operator==(const LineH2& l) const; + typename R_::Boolean operator!=(const LineH2& l) const; const RT & a() const { return get_pointee_or_identity(base)[0]; } const RT & b() const { return get_pointee_or_identity(base)[1]; } @@ -58,7 +58,7 @@ public: template < class R > CGAL_KERNEL_MEDIUM_INLINE -bool +typename R::Boolean LineH2::operator==(const LineH2& l) const { if ( (a() * l.c() != l.a() * c() ) @@ -83,7 +83,7 @@ LineH2::operator==(const LineH2& l) const template < class R > inline -bool +typename R::Boolean LineH2::operator!=(const LineH2& l) const { return !(*this == l); } diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/PlaneH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/PlaneH3.h index 6b05951a064..5e7ae6ac99c 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/PlaneH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/PlaneH3.h @@ -67,8 +67,8 @@ public: const RT & c() const; const RT & d() const; - bool operator==( const PlaneH3& ) const; - bool operator!=( const PlaneH3& ) const; + typename R::Boolean operator==( const PlaneH3& ) const; + typename R::Boolean operator!=( const PlaneH3& ) const; Line_3 perpendicular_line(const Point_3& ) const; Plane_3 opposite() const; // plane with opposite orientation @@ -78,13 +78,13 @@ public: Direction_3 orthogonal_direction() const; Vector_3 orthogonal_vector() const; - Oriented_side oriented_side(const Point_3 &p) const; - bool has_on(const Point_3 &p) const; - bool has_on(const Line_3 &p) const; - bool has_on_positive_side(const Point_3&l) const; - bool has_on_negative_side(const Point_3&l) const; + typename R::Oriented_side oriented_side(const Point_3& p) const; + typename R::Boolean has_on(const Point_3& p) const; + typename R::Boolean has_on(const Line_3& p) const; + typename R::Boolean has_on_positive_side(const Point_3& l) const; + typename R::Boolean has_on_negative_side(const Point_3& l) const; - bool is_degenerate() const; + typename R::Boolean is_degenerate() const; Aff_transformation_3 transform_to_2d() const; Point_2 to_2d(const Point_3& ) const; @@ -163,7 +163,7 @@ PlaneH3::new_rep(const RT &a, const RT &b, const RT &c, const RT &d) template < class R > inline -bool +typename R::Boolean PlaneH3::operator!=(const PlaneH3& l) const { return !(*this == l); @@ -397,7 +397,7 @@ PlaneH3::orthogonal_vector() const { return Vector_3(a(), b(), c() ); } template < class R > -bool +typename R::Boolean PlaneH3::is_degenerate() const { const RT RT0(0); @@ -405,14 +405,14 @@ PlaneH3::is_degenerate() const } template < class R > -bool +typename R::Boolean PlaneH3::has_on_positive_side( const typename PlaneH3::Point_3& p) const { return (a()*p.hx() + b()*p.hy() + c()*p.hz() + d()*p.hw() > RT(0) ); } template < class R > -bool +typename R::Boolean PlaneH3::has_on_negative_side( const typename PlaneH3::Point_3& p) const { return (a()*p.hx() + b()*p.hy() + c()*p.hz() + d()*p.hw() < RT(0) ); @@ -420,14 +420,14 @@ PlaneH3::has_on_negative_side( const typename PlaneH3::Point_3& p) const template < class R > -bool +typename R::Boolean PlaneH3::has_on( const typename PlaneH3::Point_3& p) const { return (a()*p.hx() + b()*p.hy() + c()*p.hz() + d()*p.hw() == RT(0) ); } template < class R > -bool +typename R::Boolean PlaneH3::has_on( const typename PlaneH3::Line_3& l) const { Point_3 p = l.point(); @@ -439,7 +439,7 @@ PlaneH3::has_on( const typename PlaneH3::Line_3& l) const } template < class R > -Oriented_side +typename R::Oriented_side PlaneH3::oriented_side( const typename PlaneH3::Point_3& p) const { return CGAL_NTS sign( a()*p.hx() + b()*p.hy() + c()*p.hz() + d()*p.hw() ); @@ -447,7 +447,7 @@ PlaneH3::oriented_side( const typename PlaneH3::Point_3& p) const template < class R > -bool +typename R::Boolean PlaneH3::operator==(const PlaneH3& l) const { if ( (a() * l.d() != l.a() * d() ) diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH2.h index 1c7340d4e60..600f84f36f2 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH2.h @@ -64,8 +64,8 @@ public: PointH2(const RT& hx, const RT& hy, const RT& hw) : base(hx, hy, hw) {} - bool operator==( const PointH2& p) const; - bool operator!=( const PointH2& p) const; + typename R::Boolean operator==( const PointH2& p) const; + typename R::Boolean operator!=( const PointH2& p) const; const RT & hx() const { return base.hx(); } const RT & hy() const { return base.hy(); } @@ -95,7 +95,7 @@ public: template < class R > inline -bool +typename R::Boolean PointH2::operator==( const PointH2& p) const { return base == p.base; @@ -103,7 +103,7 @@ PointH2::operator==( const PointH2& p) const template < class R > inline -bool +typename R::Boolean PointH2::operator!=( const PointH2& p) const { return !(*this == p); } diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h index 8f6cb17a535..5f9fa794032 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h @@ -90,8 +90,8 @@ public: Direction_3 direction() const; Point_3 transform( const Aff_transformation_3 & t) const; - bool operator==( const PointH3& p) const; - bool operator!=( const PointH3& p) const; + typename R::Boolean operator==( const PointH3& p) const; + typename R::Boolean operator!=( const PointH3& p) const; }; @@ -175,7 +175,7 @@ PointH3::direction() const template < class R > inline -bool +typename R::Boolean PointH3::operator==( const PointH3 & p) const { return base == p.base; @@ -183,7 +183,7 @@ PointH3::operator==( const PointH3 & p) const template < class R > inline -bool +typename R::Boolean PointH3::operator!=( const PointH3 & p) const { return !(*this == p); } diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/RayH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/RayH3.h index 8a48ffd52bf..3a3999d459b 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/RayH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/RayH3.h @@ -63,12 +63,12 @@ public: const Vector_3 & to_vector() const; Line_3 supporting_line() const; RayH3 opposite() const; - bool has_on(const Point_3& p) const; - bool collinear_has_on(const Point_3 &p) const; - bool is_degenerate() const; + typename R::Boolean has_on(const Point_3& p) const; + typename R::Boolean collinear_has_on(const Point_3 &p) const; + typename R::Boolean is_degenerate() const; - bool operator==(const RayH3& r) const; - bool operator!=(const RayH3& r) const; + typename R::Boolean operator==(const RayH3& r) const; + typename R::Boolean operator!=(const RayH3& r) const; }; template < class R > @@ -133,7 +133,7 @@ RayH3::opposite() const template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean RayH3::has_on(const typename RayH3::Point_3 &p) const { return ( ( p == start() ) @@ -142,25 +142,25 @@ RayH3::has_on(const typename RayH3::Point_3 &p) const template < class R > inline /* XXX */ -bool +typename R::Boolean RayH3::collinear_has_on(const typename RayH3::Point_3 &p) const { return has_on(p); } template < class R > inline -bool +typename R::Boolean RayH3::is_degenerate() const { return to_vector() == NULL_VECTOR; } template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean RayH3::operator==(const RayH3& r) const { return ( (start() == r.start() )&&( direction() == r.direction() ) ); } template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean RayH3::operator!=( const RayH3& r) const { return !operator==(r); } diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/SphereH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/SphereH3.h index a00ec51b275..1615004c68b 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/SphereH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/SphereH3.h @@ -57,10 +57,10 @@ public: SphereH3(const Point_3& p, const Orientation& o = COUNTERCLOCKWISE); - bool + typename R::Boolean operator==(const SphereH3&) const; - bool + typename R::Boolean operator!=(const SphereH3& s) const { return !(*this == s); } @@ -70,32 +70,32 @@ public: Orientation orientation() const; - bool is_degenerate() const; + typename R::Boolean is_degenerate() const; SphereH3 opposite() const; - Oriented_side oriented_side(const Point_3& p) const; + typename R::Oriented_side oriented_side(const Point_3& p) const; - bool + typename R::Boolean has_on_boundary(const Point_3& p) const { return oriented_side(p)==ON_ORIENTED_BOUNDARY; } - bool + typename R::Boolean has_on_positive_side(const Point_3& p) const { return oriented_side(p)==ON_POSITIVE_SIDE; } - bool + typename R::Boolean has_on_negative_side(const Point_3& p) const { return oriented_side(p)==ON_NEGATIVE_SIDE; } - Bounded_side + typename R::Bounded_side bounded_side(const Point_3& p) const; - bool + typename R::Boolean has_on_bounded_side(const Point_3& p) const { return bounded_side(p)==ON_BOUNDED_SIDE; } - bool + typename R::Boolean has_on_unbounded_side(const Point_3& p) const { return bounded_side(p)==ON_UNBOUNDED_SIDE; } }; @@ -162,7 +162,7 @@ SphereH3::SphereH3(const typename SphereH3::Point_3& p, template CGAL_KERNEL_INLINE -bool +typename R::Boolean SphereH3::operator==(const SphereH3& s) const { return ( orientation() == s.orientation()) @@ -190,23 +190,23 @@ SphereH3::orientation() const template inline -bool +typename R::Boolean SphereH3::is_degenerate() const { return squared_radius() <= FT(0) ; } template CGAL_KERNEL_MEDIUM_INLINE -Oriented_side +typename R::Oriented_side SphereH3::oriented_side(const typename SphereH3::Point_3& p) const { return Oriented_side(static_cast(bounded_side(p)) * static_cast(orientation())); } template CGAL_KERNEL_INLINE -Bounded_side +typename R::Bounded_side SphereH3::bounded_side(const typename SphereH3::Point_3& p) const { - return Bounded_side(CGAL_NTS compare(squared_radius(), - squared_distance(center(),p))); + return enum_cast(CGAL_NTS compare(squared_radius(), + squared_distance(center(),p))); } template diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH2.h index 5460f21e7ce..7f7f8c5ca3b 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH2.h @@ -82,10 +82,10 @@ public: return static_cast(*this); } - bool operator==( const VectorH2& v) const; - bool operator!=( const VectorH2& v) const; - bool operator==( const Null_vector&) const; - bool operator!=( const Null_vector& v) const; + typename R::Boolean operator==( const VectorH2& v) const; + typename R::Boolean operator!=( const VectorH2& v) const; + typename R::Boolean operator==( const Null_vector&) const; + typename R::Boolean operator!=( const Null_vector& v) const; const RT & hx() const { return CGAL::get_pointee_or_identity(base)[0]; }; const RT & hy() const { return CGAL::get_pointee_or_identity(base)[1]; }; @@ -131,19 +131,19 @@ public: template < class R > inline -bool +typename R::Boolean VectorH2::operator==( const Null_vector&) const { return (hx() == RT(0)) && (hy() == RT(0)); } template < class R > inline -bool +typename R::Boolean VectorH2::operator!=( const Null_vector& v) const { return !(*this == v); } template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean VectorH2::operator==( const VectorH2& v) const { return ( (hx() * v.hw() == v.hx() * hw() ) @@ -152,7 +152,7 @@ VectorH2::operator==( const VectorH2& v) const template < class R > inline -bool +typename R::Boolean VectorH2::operator!=( const VectorH2& v) const { return !(*this == v); } /* XXX */ diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH3.h index 544ffa96493..dfe1d969439 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH3.h @@ -131,8 +131,8 @@ public: Vector_3 operator-() const; - bool operator==( const VectorH3& v) const; - bool operator!=( const VectorH3& v) const; + typename R::Boolean operator==( const VectorH3& v) const; + typename R::Boolean operator!=( const VectorH3& v) const; Vector_3 operator+( const VectorH3 &v) const; Vector_3 operator-( const VectorH3 &v) const; @@ -173,7 +173,7 @@ VectorH3::direction() const template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean VectorH3::operator==( const VectorH3& v) const { return ( (hx() * v.hw() == v.hx() * hw() ) @@ -183,7 +183,7 @@ VectorH3::operator==( const VectorH3& v) const template < class R > inline -bool +typename R::Boolean VectorH3::operator!=( const VectorH3& v) const { return !(*this == v); } diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/distance_predicatesH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/distance_predicatesH2.h index 680c6dccc02..ccac644485b 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/distance_predicatesH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/distance_predicatesH2.h @@ -24,7 +24,7 @@ namespace CGAL { template < class R> CGAL_KERNEL_MEDIUM_INLINE -bool +typename R::Boolean has_larger_distance_to_point(const PointH2& p, const PointH2& q, const PointH2& r) @@ -74,7 +74,7 @@ has_larger_distance_to_point(const PointH2& p, template < class R> CGAL_KERNEL_INLINE -Comparison_result +typename R::Comparison_result compare_signed_distance_to_line(const LineH2& l, const PointH2& p, const PointH2& q) @@ -111,7 +111,7 @@ compare_signed_distance_to_line(const LineH2& l, template < class R> CGAL_KERNEL_INLINE -bool +typename R::Boolean has_larger_signed_distance_to_line(const LineH2& l, const PointH2& p, const PointH2& q) @@ -140,7 +140,7 @@ has_larger_signed_distance_to_line(const LineH2& l, template < class R> CGAL_KERNEL_INLINE -bool +typename R::Boolean has_smaller_signed_distance_to_line(const LineH2& l, const PointH2& p, const PointH2& q) @@ -167,7 +167,7 @@ has_smaller_signed_distance_to_line(const LineH2& l, template < class R> CGAL_KERNEL_MEDIUM_INLINE -Comparison_result +typename R::Comparison_result compare_signed_distance_to_line(const PointH2& p, const PointH2& q, const PointH2& r, @@ -208,7 +208,7 @@ compare_signed_distance_to_line(const PointH2& p, template < class R> CGAL_KERNEL_MEDIUM_INLINE -bool +typename R::Boolean has_smaller_signed_distance_to_line(const PointH2& p, const PointH2& q, const PointH2& r, @@ -241,7 +241,7 @@ has_smaller_signed_distance_to_line(const PointH2& p, template < class R> CGAL_KERNEL_MEDIUM_INLINE -bool +typename R::Boolean has_larger_signed_distance_to_line(const PointH2& p, const PointH2& q, const PointH2& r, diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/distance_predicatesH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/distance_predicatesH3.h index ede98c97698..aacad83beb0 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/distance_predicatesH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/distance_predicatesH3.h @@ -21,43 +21,43 @@ namespace CGAL { template -Comparison_result +typename R::Comparison_result compare_distance_to_point(const PointH3& , const PointH3& , const PointH3& ); template -bool +typename R::Boolean has_larger_distance_to_point(const PointH3& , const PointH3& , const PointH3& ); template -bool +typename R::Boolean has_smaller_distance_to_point(const PointH3& , const PointH3& , const PointH3& ); template -Comparison_result +typename R::Comparison_result compare_signed_distance_to_plane(const PlaneH3& , const PointH3& , const PointH3& ); template -bool +typename R::Boolean has_larger_signed_distance_to_plane(const PlaneH3& , const PointH3& , const PointH3& ); template -bool +typename R::Boolean has_smaller_signed_distance_to_plane(const PlaneH3&, const PointH3& , const PointH3& ); template -Comparison_result +typename R::Comparison_result compare_signed_distance_to_plane(const PointH3& , const PointH3& , const PointH3& , @@ -65,7 +65,7 @@ compare_signed_distance_to_plane(const PointH3& , const PointH3& ); template -bool +typename R::Boolean has_larger_signed_distance_to_plane(const PointH3& , const PointH3& , const PointH3& , @@ -73,7 +73,7 @@ has_larger_signed_distance_to_plane(const PointH3& , const PointH3& ); template -bool +typename R::Boolean has_smaller_signed_distance_to_plane(const PointH3& , const PointH3& , const PointH3& , @@ -82,7 +82,7 @@ has_smaller_signed_distance_to_plane(const PointH3& , template CGAL_KERNEL_MEDIUM_INLINE -Comparison_result +typename R::Comparison_result compare_distance_to_point(const PointH3& p, const PointH3& q, const PointH3& r) @@ -121,7 +121,7 @@ compare_distance_to_point(const PointH3& p, template < class R> CGAL_KERNEL_MEDIUM_INLINE -bool +typename R::Boolean has_larger_distance_to_point(const PointH3& p, const PointH3& q, const PointH3& r) @@ -157,7 +157,7 @@ has_larger_distance_to_point(const PointH3& p, template < class R> CGAL_KERNEL_MEDIUM_INLINE -bool +typename R::Boolean has_smaller_distance_to_point(const PointH3& p, const PointH3& q, const PointH3& r) @@ -193,7 +193,7 @@ has_smaller_distance_to_point(const PointH3& p, template < class R> CGAL_KERNEL_INLINE -Comparison_result +typename R::Comparison_result compare_signed_distance_to_plane(const PlaneH3& pl, const PointH3& p, const PointH3& q) @@ -227,7 +227,7 @@ compare_signed_distance_to_plane(const PlaneH3& pl, } template -bool +typename R::Boolean has_larger_signed_distance_to_plane(const PlaneH3& pl, const PointH3& p, const PointH3& q ) @@ -257,7 +257,7 @@ has_larger_signed_distance_to_plane(const PlaneH3& pl, } template -bool +typename R::Boolean has_smaller_signed_distance_to_plane(const PlaneH3& pl, const PointH3& p, const PointH3& q ) @@ -288,7 +288,7 @@ has_smaller_signed_distance_to_plane(const PlaneH3& pl, template inline -Comparison_result +typename R::Comparison_result compare_signed_distance_to_plane(const PointH3& p, const PointH3& q, const PointH3& r, @@ -302,7 +302,7 @@ compare_signed_distance_to_plane(const PointH3& p, template inline -bool +typename R::Boolean has_larger_signed_distance_to_plane(const PointH3& p, const PointH3& q, const PointH3& r, @@ -313,7 +313,7 @@ has_larger_signed_distance_to_plane(const PointH3& p, template inline -bool +typename R::Boolean has_smaller_signed_distance_to_plane(const PointH3& p, const PointH3& q, const PointH3& r, diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/predicates_on_pointsH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/predicates_on_pointsH2.h index 6c2177c916e..f51d9f61f3c 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/predicates_on_pointsH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/predicates_on_pointsH2.h @@ -24,7 +24,7 @@ namespace CGAL { template < class R> CGAL_KERNEL_INLINE -bool +typename R::Boolean equal_xy(const PointH2& p, const PointH2& q) { @@ -39,7 +39,7 @@ equal_xy(const PointH2& p, template CGAL_KERNEL_MEDIUM_INLINE -Oriented_side +typename R::Oriented_side _where_wrt_L_wedge( const PointH2& p, const PointH2& q ) { Sign xs = CGAL_NTS sign( q.hx()*p.hw() - p.hx()*q.hw() ); // sign( qx - px ) @@ -53,7 +53,7 @@ _where_wrt_L_wedge( const PointH2& p, const PointH2& q ) } template -Comparison_result +typename Compare::result_type compare_power_distanceH2(const RT& phx, const RT& phy, const RT& phw, const Quotient& pwt, const RT& qhx, const RT& qhy, const RT& qhw, @@ -82,7 +82,7 @@ compare_power_distanceH2(const RT& phx, const RT& phy, const RT& phw, template -Oriented_side +typename Same_uncertainty_nt::type power_testH2( const RT &phx, const RT &phy, const RT &phw, const Quotient &pwt, const RT &qhx, const RT &qhy, const RT &qhw, const Quotient &qwt, const RT &rhx, const RT &rhy, const RT &rhw, const Quotient &rwt, @@ -129,7 +129,7 @@ power_testH2( const RT &phx, const RT &phy, const RT &phw, const Quotient &p template -Oriented_side +typename Same_uncertainty_nt::type power_testH2( const RT &phx, const RT &phy, const RT &phw, const Quotient &pwt, const RT &qhx, const RT &qhy, const RT &qhw, const Quotient &qwt, const RT &thx, const RT &thy, const RT &thw, const Quotient &twt) @@ -180,7 +180,7 @@ power_testH2( const RT &phx, const RT &phy, const RT &phw, const Quotient &p // Unused, undocumented, un-functorized. template < class R > CGAL_KERNEL_MEDIUM_INLINE -Comparison_result +typename R::Comparison_result compare_deltax_deltay(const PointH2& p, const PointH2& q, const PointH2& r, diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/predicates_on_pointsH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/predicates_on_pointsH3.h index e734ac9493d..c1956fddb63 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/predicates_on_pointsH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/predicates_on_pointsH3.h @@ -25,8 +25,9 @@ namespace CGAL { template < class R > CGAL_KERNEL_MEDIUM_INLINE -bool lexicographically_xy_smaller(const PointH3 &p, - const PointH3 &q) +typename R::Boolean +lexicographically_xy_smaller(const PointH3 &p, + const PointH3 &q) { typedef typename R::RT RT; RT pV = p.hx()*q.hw(); @@ -51,7 +52,7 @@ bool lexicographically_xy_smaller(const PointH3 &p, template < class R> CGAL_KERNEL_MEDIUM_INLINE -Comparison_result +typename R::Comparison_result compare_xy(const PointH3& p, const PointH3& q) { typedef typename R::RT RT; @@ -82,7 +83,7 @@ compare_xy(const PointH3& p, const PointH3& q) template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean equal_xy(const PointH3 &p, const PointH3 &q) { return (p.hx() * q.hw() == q.hx() * p.hw() ) @@ -91,7 +92,7 @@ equal_xy(const PointH3 &p, const PointH3 &q) template < class R > // ??? -> == CGAL_KERNEL_INLINE -bool +typename R::Boolean equal_xyz(const PointH3 &p, const PointH3 &q) { return (p.hx() * q.hw() == q.hx() * p.hw() ) @@ -101,27 +102,27 @@ equal_xyz(const PointH3 &p, const PointH3 &q) template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean less_x(const PointH3 &p, const PointH3 &q) { return (p.hx() * q.hw() < q.hx() * p.hw() ); } template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean less_y(const PointH3 &p, const PointH3 &q) { return (p.hy() * q.hw() < q.hy() * p.hw() ); } template < class R > CGAL_KERNEL_INLINE -bool +typename R::Boolean less_z(const PointH3 &p, const PointH3 &q) { return (p.hz() * q.hw() < q.hz() * p.hw() ); } template -Oriented_side +typename Same_uncertainty_nt::type power_side_of_oriented_power_sphereH3( const RT &phx, const RT &phy, const RT &phz, const RT &phw, const Quotient &pwt, const RT &qhx, const RT &qhy, const RT &qhz, const RT &qhw, const Quotient &qwt, diff --git a/Kernel_23/include/CGAL/Circle_3.h b/Kernel_23/include/CGAL/Circle_3.h index 2d63de741cf..5f1838bacbe 100644 --- a/Kernel_23/include/CGAL/Circle_3.h +++ b/Kernel_23/include/CGAL/Circle_3.h @@ -161,7 +161,7 @@ operator==(const Circle_3 &p, template < typename R > inline -bool +typename R::Boolean operator!=(const Circle_3 &p, const Circle_3 &q) { diff --git a/Kernel_23/include/CGAL/Iso_cuboid_3.h b/Kernel_23/include/CGAL/Iso_cuboid_3.h index 057c6519ecd..97b2f0c1fbc 100644 --- a/Kernel_23/include/CGAL/Iso_cuboid_3.h +++ b/Kernel_23/include/CGAL/Iso_cuboid_3.h @@ -29,6 +29,8 @@ namespace CGAL { template class Iso_cuboid_3 : public R_::Kernel_base::Iso_cuboid_3 { + typedef typename R_::Boolean Boolean; + typedef typename R_::Bounded_side Bounded_side; typedef typename R_::RT RT; typedef typename R_::FT FT; typedef typename R_::Point_3 Point_3; @@ -173,25 +175,25 @@ public: return zmax(); } - bool + typename R::Boolean has_on_bounded_side(const Point_3 &p) const { return R().has_on_bounded_side_3_object()(*this,p); } - bool + Boolean has_on_unbounded_side(const Point_3 &p) const { return R().has_on_unbounded_side_3_object()(*this,p); } - bool + Boolean has_on_boundary(const Point_3 &p) const { return R().has_on_boundary_3_object()(*this,p); } - bool + Boolean has_on(const Point_3 &p) const { return has_on_boundary(p); @@ -203,7 +205,7 @@ public: return R().bounded_side_3_object()(*this,p); } - bool + Boolean is_degenerate() const { return R().is_degenerate_3_object()(*this); diff --git a/Kernel_23/include/CGAL/Iso_rectangle_2.h b/Kernel_23/include/CGAL/Iso_rectangle_2.h index 1d27f73f4e2..d16a01c6462 100644 --- a/Kernel_23/include/CGAL/Iso_rectangle_2.h +++ b/Kernel_23/include/CGAL/Iso_rectangle_2.h @@ -27,6 +27,8 @@ namespace CGAL { template class Iso_rectangle_2 : public R_::Kernel_base::Iso_rectangle_2 { + typedef typename R_::Boolean Boolean; + typedef typename R_::Bounded_side Bounded_side; typedef typename R_::RT RT; typedef typename R_::FT FT; typedef typename R_::Point_2 Point_2; @@ -169,22 +171,19 @@ public: return R().compute_area_2_object()(*this); } - - bool + Boolean has_on_boundary(const Point_2 &p) const { return R().has_on_boundary_2_object()(*this,p); } - - bool + Boolean has_on_bounded_side(const Point_2 &p) const { return R().has_on_bounded_side_2_object()(*this,p); } - - bool + Boolean has_on_unbounded_side(const Point_2 &p) const { return R().has_on_unbounded_side_2_object()(*this,p); @@ -196,8 +195,7 @@ public: return R().bounded_side_2_object()(*this,p); } - - bool + Boolean is_degenerate() const { return R().is_degenerate_2_object()(*this); diff --git a/Kernel_23/include/CGAL/Kernel/global_functions.h b/Kernel_23/include/CGAL/Kernel/global_functions.h index 560ad35ccb5..017c935be56 100644 --- a/Kernel_23/include/CGAL/Kernel/global_functions.h +++ b/Kernel_23/include/CGAL/Kernel/global_functions.h @@ -28,7 +28,7 @@ namespace CGAL { template inline -Comparison_result +typename Kernel_traits::Kernel::Comparison_result compare_distance(const T1 &o1, const T2 &o2, const T3 &o3) @@ -39,7 +39,7 @@ compare_distance(const T1 &o1, template inline -Comparison_result +typename Kernel_traits::Kernel::Comparison_result compare_distance(const T1 &o1, const T2 &o2, const T3 &o3, @@ -51,7 +51,7 @@ compare_distance(const T1 &o1, template inline -bool +typename Kernel_traits::Kernel::Boolean parallel(const O &o1, const O &o2) { typedef typename Kernel_traits::Kernel 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 6339a1c1412..b96991d2687 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 @@ -178,39 +178,43 @@ public: template class Side_of_bounded_circle_projected_3 { + typedef typename R::Bounded_side Bounded_side; + typedef typename R::Point_3 Point; + public: - typedef typename R::Point_3 Point; typename R::FT x(const Point &p) const { return Projector::x(p); } typename R::FT y(const Point &p) const { return Projector::y(p); } - typename R::Point_2 project(const Point& p) const { return typename R::Point_2(x(p),y(p)); } - CGAL::Bounded_side operator() (const Point &p, - const Point &q, - const Point &r, - const Point &s) const - { - return CGAL::side_of_bounded_circle(project(p),project(q),project(r),project(s) ); - } - CGAL::Bounded_side operator() (const Point &p, - const Point &q, - const Point &r) const - { - return CGAL::side_of_bounded_circle(project(p),project(q),project(r)); - } + Bounded_side operator()(const Point &p, + const Point &q, + const Point &r, + const Point &s) const + { + return CGAL::side_of_bounded_circle(project(p),project(q),project(r),project(s) ); + } + + Bounded_side operator()(const Point &p, + const Point &q, + const Point &r) const + { + return CGAL::side_of_bounded_circle(project(p),project(q),project(r)); + } }; template class Compare_distance_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); } @@ -636,6 +640,7 @@ template class Compare_power_distance_projected_3 { public: + typedef typename R::Comparison_result Comparison_result; typedef typename R::Point_2 Point_2; typedef typename R::Weighted_point_2 Weighted_point_2; typedef typename R::Point_3 Point_3; @@ -817,6 +822,7 @@ template class Power_side_of_bounded_power_circle_projected_3 { public: + typedef typename R::Bounded_side Bounded_side; typedef typename R::Point_2 Point_2; typedef typename R::Weighted_point_2 Weighted_point_2; typedef typename R::Point_3 Point_3; @@ -832,24 +838,24 @@ public: return Weighted_point_2(Point_2(x(p), y(p)), wp.weight()); } - CGAL::Bounded_side operator()(const Weighted_point_3 &wp, - const Weighted_point_3 &wq, - const Weighted_point_3 &wr, - const Weighted_point_3 &ws) const + Bounded_side operator()(const Weighted_point_3 &wp, + const Weighted_point_3 &wq, + const Weighted_point_3 &wr, + const Weighted_point_3 &ws) const { return CGAL::power_side_of_bounded_power_circle(project(wp), project(wq), project(wr), project(ws)); } - CGAL::Bounded_side operator()(const Weighted_point_3 &wp, - const Weighted_point_3 &wq, - const Weighted_point_3 &wr) const + Bounded_side operator()(const Weighted_point_3 &wp, + const Weighted_point_3 &wq, + const Weighted_point_3 &wr) const { return CGAL::power_side_of_bounded_power_circle(project(wp), project(wq), project(wr)); } - CGAL::Bounded_side operator()(const Weighted_point_3 &wp, - const Weighted_point_3 &wq) const + Bounded_side operator()(const Weighted_point_3 &wp, + const Weighted_point_3 &wq) const { return CGAL::power_side_of_bounded_power_circle(project(wp), project(wq)); } @@ -975,7 +981,9 @@ public: struct Less_xy_2 { + typedef typename R::Comparison_result Comparison_result; typedef typename R::Boolean Boolean; + Boolean operator()(const Point_2& p, const Point_2& q) const { Compare_x_2 cx; 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 385d036f34e..72720d87fd8 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 @@ -345,10 +345,13 @@ template class Less_xy_along_axis { // private members + typedef typename R::Comparison_result Comparison_result; typedef typename Traits::Boolean Boolean; typedef typename Traits::Vector_3 Vector_3; typedef typename Traits::Point_2 Point; + Vector_3 base1, base2; + public: Less_xy_along_axis(const Vector_3& base1, const Vector_3& base2) : base1(base1), base2(base2) { diff --git a/Kernel_23/include/CGAL/Line_3.h b/Kernel_23/include/CGAL/Line_3.h index 53f902c2104..ada48c0f7ee 100644 --- a/Kernel_23/include/CGAL/Line_3.h +++ b/Kernel_23/include/CGAL/Line_3.h @@ -28,6 +28,7 @@ namespace CGAL { template class Line_3 : public R_::Kernel_base::Line_3 { + typedef typename R_::Boolean Boolean; typedef typename R_::FT FT; typedef typename R_::Point_3 Point_3; typedef typename R_::Ray_3 Ray_3; @@ -98,7 +99,7 @@ public: return R().construct_direction_3_object()(*this); } - bool has_on(const Point_3 &p) const + Boolean has_on(const Point_3 &p) const { return R().has_on_3_object()(*this, p); //return has_on_boundary(p); @@ -129,11 +130,10 @@ public: return R().construct_projected_point_3_object()(*this, p); } - bool is_degenerate() const + Boolean is_degenerate() const { return R().is_degenerate_3_object()(*this); } - }; template < class R > diff --git a/Kernel_23/include/CGAL/Plane_3.h b/Kernel_23/include/CGAL/Plane_3.h index 104191a5d64..09ebd6237cc 100644 --- a/Kernel_23/include/CGAL/Plane_3.h +++ b/Kernel_23/include/CGAL/Plane_3.h @@ -29,6 +29,8 @@ namespace CGAL { template class Plane_3 : public R_::Kernel_base::Plane_3 { + typedef typename R_::Boolean Boolean; + typedef typename R_::Oriented_side Oriented_side; typedef typename R_::RT RT; typedef typename R_::Point_2 Point_2; typedef typename R_::Point_3 Point_3; @@ -140,17 +142,17 @@ public: return R().compute_d_3_object()(*this); } - bool has_on(const Point_3 &p) const + Boolean has_on(const Point_3 &p) const { return R().has_on_3_object()(*this, p); } - bool has_on(const Circle_3 &c) const + Boolean has_on(const Circle_3 &c) const { return R().has_on_3_object()(*this, c); } - bool has_on(const Line_3 &l) const + Boolean has_on(const Line_3 &l) const { return R().has_on_3_object()(*this, l); } @@ -204,33 +206,32 @@ public: return R().oriented_side_3_object()(*this, p); } - bool has_on_positive_side(const Point_3 &p) const + Boolean has_on_positive_side(const Point_3 &p) const { return R().has_on_positive_side_3_object()(*this, p); } - bool has_on_negative_side(const Point_3 &p) const + Boolean has_on_negative_side(const Point_3 &p) const { return R().has_on_negative_side_3_object()(*this, p); } /* - bool has_on(const Point_3 &p) const + Boolean has_on(const Point_3 &p) const { return oriented_side(p) == ON_ORIENTED_BOUNDARY; } - bool has_on(const Line_3 &l) const + Boolean has_on(const Line_3 &l) const { return has_on(l.point()) && has_on(l.point() + l.direction().to_vector()); } */ - bool is_degenerate() const + Boolean is_degenerate() const { return R().is_degenerate_3_object()(*this); } - }; diff --git a/Kernel_23/include/CGAL/Ray_2.h b/Kernel_23/include/CGAL/Ray_2.h index d9dae50482e..6ca9c9a0869 100644 --- a/Kernel_23/include/CGAL/Ray_2.h +++ b/Kernel_23/include/CGAL/Ray_2.h @@ -31,6 +31,7 @@ namespace CGAL { template class Ray_2 : public R_::Kernel_base::Ray_2 { + typedef typename R_::Boolean Boolean; typedef typename R_::RT RT; typedef typename R_::FT FT; typedef typename R_::Point_2 Point_2; @@ -117,17 +118,17 @@ public: return source(); } - bool is_horizontal() const + Boolean is_horizontal() const { return R().equal_y_2_object()(source(), second_point()); } - bool is_vertical() const + Boolean is_vertical() const { return R().equal_x_2_object()(source(), second_point()); } - bool is_degenerate() const + Boolean is_degenerate() const { return R().is_degenerate_2_object()(*this); } @@ -148,7 +149,7 @@ public: return construct_vector(source(), second_point()); } - bool + Boolean has_on(const Point_2 &p) const { typename R::Construct_vector_2 construct_vector; @@ -157,9 +158,7 @@ public: Direction_2(construct_vector( source(), p)) == direction() ); } - - - bool + Boolean collinear_has_on(const Point_2 &p) const { return R().collinear_has_on_2_object()(*this, p); diff --git a/Kernel_23/include/CGAL/Ray_3.h b/Kernel_23/include/CGAL/Ray_3.h index b35ae5e78a9..5bb86fc2dc9 100644 --- a/Kernel_23/include/CGAL/Ray_3.h +++ b/Kernel_23/include/CGAL/Ray_3.h @@ -28,6 +28,7 @@ namespace CGAL { template class Ray_3 : public R_::Kernel_base::Ray_3 { + typedef typename R_::Boolean Boolean; typedef typename R_::FT FT; typedef typename R_::Point_3 Point_3; typedef typename R_::Direction_3 Direction_3; @@ -96,8 +97,8 @@ public: Line_3 supporting_line() const; Ray_3 opposite() const; - bool is_degenerate() const; - bool collinear_has_on(const Point_3 &p) const; + Boolean is_degenerate() const; + Boolean collinear_has_on(const Point_3 &p) const; */ decltype(auto) @@ -124,7 +125,7 @@ public: return source(); } - bool has_on(const Point_3 &p) const + Boolean has_on(const Point_3 &p) const { return R().has_on_3_object()(*this, p); } @@ -156,7 +157,7 @@ public: return R().construct_line_3_object()(source(), second_point()); } - bool is_degenerate() const + Boolean is_degenerate() const { return R().is_degenerate_3_object()(*this); } diff --git a/Kernel_23/include/CGAL/Segment_2.h b/Kernel_23/include/CGAL/Segment_2.h index 6209c3a8139..6283dc10fff 100644 --- a/Kernel_23/include/CGAL/Segment_2.h +++ b/Kernel_23/include/CGAL/Segment_2.h @@ -30,6 +30,7 @@ namespace CGAL { template class Segment_2 : public R_::Kernel_base::Segment_2 { + typedef typename R_::Boolean Boolean; typedef typename R_::RT RT; typedef typename R_::FT FT; typedef typename R_::Point_2 Point_2; @@ -121,13 +122,13 @@ public: operator[](int i) const { return vertex(i); } - bool is_horizontal() const; - bool is_vertical() const; - bool has_on(const Point_2 &p) const; - bool collinear_has_on(const Point_2 &p) const; + Boolean is_horizontal() const; + Boolean is_vertical() const; + Boolean has_on(const Point_2 &p) const; + Boolean collinear_has_on(const Point_2 &p) const; FT squared_length() const; - bool is_degenerate() const; + Boolean is_degenerate() const; Bbox_2 bbox() const { @@ -184,7 +185,7 @@ public: template < class R_ > CGAL_KERNEL_INLINE -bool +typename R_::Boolean Segment_2::is_horizontal() const { return R_().equal_y_2_object()(source(), target()); @@ -193,7 +194,7 @@ Segment_2::is_horizontal() const template < class R_ > CGAL_KERNEL_INLINE -bool +typename R_::Boolean Segment_2::is_vertical() const { return R_().equal_x_2_object()(source(), target()); @@ -202,7 +203,7 @@ Segment_2::is_vertical() const template < class R_ > CGAL_KERNEL_INLINE -bool +typename R_::Boolean Segment_2:: has_on(const typename R_::Point_2 &p) const { @@ -211,10 +212,9 @@ has_on(const typename R_::Point_2 &p) const target()); } - template < class R_ > inline -bool +typename R_::Boolean Segment_2:: collinear_has_on(const typename R_::Point_2 &p) const { @@ -222,7 +222,6 @@ collinear_has_on(const typename R_::Point_2 &p) const (*this, p); } - template < class R_ > CGAL_KERNEL_INLINE typename Segment_2::FT @@ -231,17 +230,14 @@ Segment_2::squared_length() const return R_().compute_squared_length_2_object()(*this); } - template < class R_ > inline -bool +typename R_::Boolean Segment_2::is_degenerate() const { return R().is_degenerate_2_object()(*this); } - - template < class R > std::ostream & operator<<(std::ostream &os, const Segment_2 &s) diff --git a/Kernel_23/include/CGAL/Segment_3.h b/Kernel_23/include/CGAL/Segment_3.h index 7023f5fe3fe..530c06f8d48 100644 --- a/Kernel_23/include/CGAL/Segment_3.h +++ b/Kernel_23/include/CGAL/Segment_3.h @@ -29,6 +29,7 @@ namespace CGAL { template class Segment_3 : public R_::Kernel_base::Segment_3 { + typedef typename R_::Boolean Boolean; typedef typename R_::RT RT; typedef typename R_::FT FT; typedef typename R_::Point_3 Point_3; @@ -134,7 +135,7 @@ public: return R().construct_vector_3_object()(*this); } - bool has_on(const Point_3 &p) const + Boolean has_on(const Point_3 &p) const { return R().has_on_3_object()(*this, p); } @@ -149,7 +150,7 @@ public: return R().construct_direction_3_object()(*this); } - bool is_degenerate() const + Boolean is_degenerate() const { return R().is_degenerate_3_object()(*this); } diff --git a/Kernel_23/include/CGAL/Tetrahedron_3.h b/Kernel_23/include/CGAL/Tetrahedron_3.h index a8768746f58..28606886fed 100644 --- a/Kernel_23/include/CGAL/Tetrahedron_3.h +++ b/Kernel_23/include/CGAL/Tetrahedron_3.h @@ -29,7 +29,11 @@ namespace CGAL { template class Tetrahedron_3 : public R_::Kernel_base::Tetrahedron_3 { - typedef typename R_::Point_3 Point_3; + typedef typename R_::Boolean Boolean; + typedef typename R_::Bounded_side Bounded_side; + typedef typename R_::Orientation Orientation; + typedef typename R_::Oriented_side Oriented_side; + typedef typename R_::Point_3 Point_3; typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Tetrahedron_3 Self; @@ -86,8 +90,7 @@ public: return vertex(i); } - bool - is_degenerate() const + Boolean is_degenerate() const { return R().is_degenerate_3_object()(*this); } @@ -107,27 +110,27 @@ public: return R().oriented_side_3_object()(*this, p); } - bool has_on_positive_side(const Point_3 &p) const + Boolean has_on_positive_side(const Point_3 &p) const { return R().has_on_positive_side_3_object()(*this, p); } - bool has_on_negative_side(const Point_3 &p) const + Boolean has_on_negative_side(const Point_3 &p) const { return R().has_on_negative_side_3_object()(*this, p); } - bool has_on_boundary(const Point_3 &p) const + Boolean has_on_boundary(const Point_3 &p) const { return R().has_on_boundary_3_object()(*this, p); } - bool has_on_bounded_side(const Point_3 &p) const + Boolean has_on_bounded_side(const Point_3 &p) const { return R().has_on_bounded_side_3_object()(*this, p); } - bool has_on_unbounded_side(const Point_3 &p) const + Boolean has_on_unbounded_side(const Point_3 &p) const { return R().has_on_unbounded_side_3_object()(*this, p); } diff --git a/Kernel_23/include/CGAL/Triangle_3.h b/Kernel_23/include/CGAL/Triangle_3.h index 92adba1fb86..caf48f639dd 100644 --- a/Kernel_23/include/CGAL/Triangle_3.h +++ b/Kernel_23/include/CGAL/Triangle_3.h @@ -29,6 +29,7 @@ namespace CGAL { template class Triangle_3 : public R_::Kernel_base::Triangle_3 { + typedef typename R_::Boolean Boolean; typedef typename R_::RT RT; typedef typename R_::FT FT; typedef typename R_::Point_3 Point_3; @@ -77,12 +78,11 @@ public: return R().construct_supporting_plane_3_object()(*this); } - bool has_on(const Point_3 &p) const + Boolean has_on(const Point_3 &p) const { return R().has_on_3_object()(*this, p); } - decltype(auto) vertex(int i) const { @@ -95,7 +95,7 @@ public: return vertex(i); } - bool is_degenerate() const + Boolean is_degenerate() const { return R().is_degenerate_3_object()(*this); } From 604103d0359d63bc746ce92ecd302a5119386b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 16 Jan 2025 10:39:21 +0100 Subject: [PATCH 41/68] Regroup definitions of operator<=> for kernel objects + add missing --- .../include/CGAL/Cartesian/Circle_2.h | 19 ++ .../include/CGAL/Cartesian/Point_3.h | 9 + Kernel_23/include/CGAL/Circle_2.h | 12 - Kernel_23/include/CGAL/Circle_3.h | 9 - Kernel_23/include/CGAL/Direction_2.h | 12 - Kernel_23/include/CGAL/Iso_rectangle_2.h | 13 - .../include/CGAL/Kernel/global_functions_2.h | 302 +++++++++++++++--- .../include/CGAL/Kernel/global_functions_3.h | 90 +++++- Kernel_23/include/CGAL/Line_2.h | 13 - Kernel_23/include/CGAL/Point_3.h | 13 - Kernel_23/include/CGAL/Ray_2.h | 12 - Kernel_23/include/CGAL/Segment_2.h | 13 - Kernel_23/include/CGAL/Triangle_2.h | 12 - Kernel_23/include/CGAL/Vector_2.h | 35 -- Kernel_23/include/CGAL/Weighted_point_2.h | 57 ---- Kernel_23/include/CGAL/Weighted_point_3.h | 56 ---- 16 files changed, 374 insertions(+), 303 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h index 55874513258..318aa6af4c4 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h @@ -70,6 +70,25 @@ public: }; +template < class R > +typename R::Boolean +CircleC2::operator==(const CircleC2 &t) const +{ + if (CGAL::identical(base, t.base)) + return true; + + return center() == t.center() && + squared_radius() == t.squared_radius() && + orientation() == t.orientation(); +} + +template < class R > +typename R::Boolean +CircleC2::operator!=(const CircleC2 &t) const +{ + return !(*this == t); +} + } //namespace CGAL #endif // CGAL_CARTESIAN_CIRCLE_2_H diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h index 1bd80cdb016..f638604b7f5 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h @@ -101,6 +101,15 @@ public: return base.cartesian_end(); } + typename R_::Boolean operator==(const PointC3 &p) const + { + return base == p.base; + } + typename R_::Boolean operator!=(const PointC3 &p) const + { + return !(*this == p); + } + int dimension() const { return base.dimension(); diff --git a/Kernel_23/include/CGAL/Circle_2.h b/Kernel_23/include/CGAL/Circle_2.h index ee46465e8ae..7112b8da657 100644 --- a/Kernel_23/include/CGAL/Circle_2.h +++ b/Kernel_23/include/CGAL/Circle_2.h @@ -178,18 +178,6 @@ public: return R().construct_bbox_2_object()(*this); } - typename R::Boolean - operator==(const Circle_2 &c) const - { - return R().equal_2_object()(*this, c); - } - - typename R::Boolean - operator!=(const Circle_2 &c) const - { - return !(*this == c); - } - Circle_2 transform(const Aff_transformation_2 &t) const { return t.transform(*this); diff --git a/Kernel_23/include/CGAL/Circle_3.h b/Kernel_23/include/CGAL/Circle_3.h index 5f1838bacbe..5f7e7ac15f3 100644 --- a/Kernel_23/include/CGAL/Circle_3.h +++ b/Kernel_23/include/CGAL/Circle_3.h @@ -150,15 +150,6 @@ public: }; -template < typename R > -inline -bool -operator==(const Circle_3 &p, - const Circle_3 &q) -{ - return R().equal_3_object()(p, q); -} - template < typename R > inline typename R::Boolean diff --git a/Kernel_23/include/CGAL/Direction_2.h b/Kernel_23/include/CGAL/Direction_2.h index e3478708354..bc6a6654fb4 100644 --- a/Kernel_23/include/CGAL/Direction_2.h +++ b/Kernel_23/include/CGAL/Direction_2.h @@ -156,18 +156,6 @@ public: return this->vector(); } - typename R::Boolean - operator==(const Direction_2& d) const - { - return R().equal_2_object()(*this, d); - } - - typename R::Boolean - operator!=(const Direction_2& d) const - { - return !(*this == d); - } - Direction_2 transform(const Aff_transformation_2 &t) const { return t.transform(*this); diff --git a/Kernel_23/include/CGAL/Iso_rectangle_2.h b/Kernel_23/include/CGAL/Iso_rectangle_2.h index d16a01c6462..3c7f124e1c1 100644 --- a/Kernel_23/include/CGAL/Iso_rectangle_2.h +++ b/Kernel_23/include/CGAL/Iso_rectangle_2.h @@ -96,19 +96,6 @@ public: return R().construct_max_vertex_2_object()(*this); } - bool - operator==(const Iso_rectangle_2 &i) const - { - return R().equal_2_object()(*this, i); - } - - bool - operator!=(const Iso_rectangle_2 &i) const - { - return ! (*this == i); - } - - decltype(auto) vertex(int i) const { diff --git a/Kernel_23/include/CGAL/Kernel/global_functions_2.h b/Kernel_23/include/CGAL/Kernel/global_functions_2.h index 41f61a47f2c..0ac84f4e0d0 100644 --- a/Kernel_23/include/CGAL/Kernel/global_functions_2.h +++ b/Kernel_23/include/CGAL/Kernel/global_functions_2.h @@ -28,20 +28,6 @@ namespace CGAL { -template < class K > -typename K::Boolean -operator==(const Point_2 &p, const Origin& o) -{ - return p == Point_2(o); -} - -template < class K > -typename K::Boolean -operator!=(const Point_2 &p, const Origin& o) -{ - return p != Point_2(o); -} - template < class K > inline typename K::Angle @@ -789,6 +775,264 @@ min_vertex(const Iso_rectangle_2 &ir) // FIXME TODO : What do we do with the operators ? // They have no counter part with the kernel argument... +template < class K > +inline +typename K::Boolean +operator==(const Point_2& p, const Point_2& q) +{ return K().equal_2_object()(p, q); } + +template < class K > +inline +typename K::Boolean +operator!=(const Point_2& p, const Point_2& q) +{ return ! (p == q); } + +template < class K > +typename K::Boolean +operator==(const Point_2 &p, const Origin& o) +{ + return p == Point_2(o); +} + +template < class K > +typename K::Boolean +operator==(const Origin& o, const Point_2 &p) +{ + return (p == o); +} + +template < class K > +typename K::Boolean +operator!=(const Point_2 &p, const Origin& o) +{ + return ! (p == o); +} + +template < class K > +typename K::Boolean +operator!=(const Origin& o, const Point_2 &p) +{ + return ! (p == o); +} + +template < class K > +inline +typename K::Boolean +operator==(const Origin& o, const Weighted_point_2& p) +{ return p == o; } + +template < class K > +inline +typename K::Boolean +operator!=(const Origin& o, const Weighted_point_2& p) +{ return p != o; } + + +template < class K > +inline +typename K::Boolean +operator==(const Point_2& bp, const Weighted_point_2& p) +{ return bp == p.point(); } + +template < class K > +inline +typename K::Boolean +operator!=(const Point_2& bp, const Weighted_point_2& p) +{ return bp != p.point(); } + +template < class K > +inline +typename K::Boolean +operator==(const Weighted_point_2& p, const Point_2& bp) +{ return bp == p.point(); } + +template < class K > +inline +typename K::Boolean +operator!=(const Weighted_point_2& p, const Point_2& bp) +{ return bp != p.point(); } + +template < class K > +inline +typename K::Boolean +operator==(const Weighted_point_2& p, const Weighted_point_2& p2) +{ return p.point() == p2.point(); } + +template < class K > +inline +typename K::Boolean +operator!=(const Weighted_point_2& p, const Weighted_point_2& p2) +{ return p.point() != p2.point(); } + +template < class K > +inline +typename K::Boolean +operator==(const Vector_2& v, const Vector_2& w) +{ return K().equal_2_object()(v, w); } + +template < class K > +inline +typename K::Boolean +operator!=(const Vector_2& v, const Vector_2& w) +{ return ! (v == w); } + +template < class K > +inline +typename K::Boolean +operator==(const Vector_2& v, const Null_vector& n) +{ + return K().equal_2_object()(v, n); +} + +template < class K > +inline +typename K::Boolean +operator==(const Null_vector& n, const Vector_2& v) +{ + return v == n; +} + +template < class K > +inline +typename K::Boolean +operator!=(const Vector_2& v, const Null_vector& n) +{ + return ! (v == n); +} + +template < class K > +inline +typename K::Boolean +operator!=(const Null_vector& n, const Vector_2& v) +{ + return ! (v == n); +} + +template < class K > +inline +typename K::Boolean +operator==(const Circle_2& p, const Circle_2& q) +{ + return K().equal_2_object()(p, q); +} + +template < class K > +inline +typename K::Boolean +operator!=(const Circle_2& p, const Circle_2& q) +{ + return ! (p == q); +} + +template < class K > +inline +typename K::Boolean +operator==(const Direction_2& p, const Direction_2& q) +{ + return K().equal_2_object()(p, q); +} + +template < class K > +inline +typename K::Boolean +operator!=(const Direction_2& p, const Direction_2& q) +{ + return ! (p == q); +} + +template < class K > +inline +typename K::Boolean +operator==(const Iso_rectangle_2& p, const Iso_rectangle_2& q) +{ + return K().equal_2_object()(p, q); +} + +template < class K > +inline +typename K::Boolean +operator!=(const Iso_rectangle_2& p, const Iso_rectangle_2& q) +{ + return ! (p == q); +} + +template < class K > +inline +typename K::Boolean +operator==(const Line_2& p, const Line_2& q) +{ + return K().equal_2_object()(p, q); +} + +template < class K > +inline +typename K::Boolean +operator!=(const Line_2& p, const Line_2& q) +{ + return ! (p == q); +} + +template < class K > +inline +typename K::Boolean +operator==(const Ray_2& p, const Ray_2& q) +{ + return K().equal_2_object()(p, q); +} + +template < class K > +inline +typename K::Boolean +operator!=(const Ray_2& p, const Ray_2& q) +{ + return ! (p == q); +} + +template < class K > +inline +typename K::Boolean +operator==(const Segment_2& p, const Segment_2& q) +{ + return K().equal_2_object()(p, q); +} + +template < class K > +inline +typename K::Boolean +operator!=(const Segment_2& p, const Segment_2& q) +{ + return ! (p == q); +} + +template < class K > +inline +typename K::Boolean +operator==(const Triangle_2& p, const Triangle_2& q) +{ + return K().equal_2_object()(p, q); +} + +template < class K > +inline +typename K::Boolean +operator!=(const Triangle_2& p, const Triangle_2& q) +{ + return ! (p == q); +} + + +template < class K > +inline +typename K::Boolean +operator<(const Point_2& p, const Point_2& q) +{ return K().less_xy_2_object()(p, q); } + +template < class K > +inline +typename K::Boolean +operator<(const Weighted_point_2& p, const Weighted_point_2& q) +{ return p.point() < q.point(); } + template < class K > inline typename K::Boolean @@ -813,24 +1057,6 @@ typename K::Boolean operator<=(const Direction_2& d1, const Direction_2& d2) { return compare_angle_with_x_axis(d1, d2) != LARGER; } -template < class K > -inline -typename K::Boolean -operator==(const Point_2& p, const Point_2& q) -{ return K().equal_2_object()(p, q); } - -template < class K > -inline -typename K::Boolean -operator!=(const Point_2& p, const Point_2& q) -{ return ! (p == q); } - -template < class K > -inline -typename K::Boolean -operator<(const Point_2& p, const Point_2& q) -{ return K().less_xy_2_object()(p, q); } - template < class K > inline typename K::Boolean @@ -849,18 +1075,6 @@ typename K::Boolean operator>=(const Point_2& p, const Point_2& q) { return ! K().less_xy_2_object()(p, q); } -template < class K > -inline -typename K::Boolean -operator==(const Vector_2& v, const Vector_2& w) -{ return K().equal_2_object()(v, w); } - -template < class K > -inline -typename K::Boolean -operator!=(const Vector_2& v, const Vector_2& w) -{ return ! (v == w); } - template < class K > inline typename K::Vector_2 diff --git a/Kernel_23/include/CGAL/Kernel/global_functions_3.h b/Kernel_23/include/CGAL/Kernel/global_functions_3.h index ac6a2f3f275..dfccab1d58c 100644 --- a/Kernel_23/include/CGAL/Kernel/global_functions_3.h +++ b/Kernel_23/include/CGAL/Kernel/global_functions_3.h @@ -796,12 +796,80 @@ typename K::Boolean operator==(const Point_3& p, const Origin& o) { return K().equal_3_object()(p, Point_3(o)); } +template < class K > +inline +typename K::Boolean +operator==(const Origin& o, const Point_3& p) +{ return p == o; } + template < class K > inline typename K::Boolean operator!=(const Point_3& p, const Origin& o) { return ! (p == o); } +template < class K > +inline +typename K::Boolean +operator!=(const Origin& o, const Point_3& p) +{ return ! (p == o); } + +template < class K > +inline +typename K::Boolean +operator==(const Origin& o, const Weighted_point_3& p) +{ return p == o; } + +template < class K > +inline +typename K::Boolean +operator!=(const Origin& o, const Weighted_point_3& p) +{ return p != o; } + +template < class K > +inline +typename K::Boolean +operator==(const Point_3& bp, const Weighted_point_3& p) +{ return bp == p.point(); } + +template < class K > +inline +typename K::Boolean +operator!=(const Point_3& bp, const Weighted_point_3& p) +{ return bp != p.point(); } + +template < class K > +inline +typename K::Boolean +operator==(const Weighted_point_3& p, const Point_3& bp) +{ return bp == p.point(); } + +template < class K > +inline +typename K::Boolean +operator!=(const Weighted_point_3& p, const Point_3& bp) +{ return bp != p.point(); } + +template < class K > +inline +typename K::Boolean +operator==(const Weighted_point_3& p, const Weighted_point_3& p2) +{ return p.point() == p2.point(); } + +template < class K > +inline +typename K::Boolean +operator!=(const Weighted_point_3& p, const Weighted_point_3& p2) +{ return p.point() != p2.point(); } + +template < class K > +inline +typename K::Boolean +operator==(const Circle_3& p, const Circle_3& q) +{ + return K().equal_3_object()(p, q); +} + template < class K > inline typename K::Boolean @@ -931,8 +999,20 @@ operator==(const Vector_3& p, const Null_vector& o) template < class K > inline typename K::Boolean -operator!=(const Vector_3& p, const Null_vector& o) -{ return ! (p == o); } +operator==(const Null_vector& o, const Vector_3& v) +{ return (v == o); } + +template < class K > +inline +typename K::Boolean +operator!=(const Vector_3& v, const Null_vector& o) +{ return ! (v == o); } + +template < class K > +inline +typename K::Boolean +operator!=(const Null_vector& o, const Vector_3& v) +{ return ! (v == o); } template < class K > @@ -959,6 +1039,12 @@ typename K::Boolean operator>=(const Point_3& p, const Point_3& q) { return ! K().less_xyz_3_object()(p, q); } +template < class K > +inline +typename K::Boolean +operator<(const Weighted_point_3& p, const Weighted_point_3& q) +{ return p.point() < q.point(); } + template < class K > inline typename K::Vector_3 diff --git a/Kernel_23/include/CGAL/Line_2.h b/Kernel_23/include/CGAL/Line_2.h index 3f757981eb2..6f484c12c3e 100644 --- a/Kernel_23/include/CGAL/Line_2.h +++ b/Kernel_23/include/CGAL/Line_2.h @@ -223,19 +223,6 @@ public: { return R().construct_point_2_object()(*this,i); } - - typename R::Boolean - operator==(const Line_2 &l) const - { - return R().equal_2_object()(*this, l); - } - - typename R::Boolean - operator!=(const Line_2 &l) const - { - return !(*this == l); - } - }; diff --git a/Kernel_23/include/CGAL/Point_3.h b/Kernel_23/include/CGAL/Point_3.h index 03d00f78f3f..d63cb357463 100644 --- a/Kernel_23/include/CGAL/Point_3.h +++ b/Kernel_23/include/CGAL/Point_3.h @@ -201,19 +201,6 @@ public: }; -template -inline -bool -operator==(const Origin& o, const Point_3& p) -{ return p == o; } - -template -inline -bool -operator!=(const Origin& o, const Point_3& p) -{ return p != o; } - - template std::ostream& insert(std::ostream& os, const Point_3& p,const Cartesian_tag&) diff --git a/Kernel_23/include/CGAL/Ray_2.h b/Kernel_23/include/CGAL/Ray_2.h index 6ca9c9a0869..3d5a814b0a0 100644 --- a/Kernel_23/include/CGAL/Ray_2.h +++ b/Kernel_23/include/CGAL/Ray_2.h @@ -176,18 +176,6 @@ public: return R().construct_line_2_object()(source(), second_point()); } - bool - operator==(const Ray_2& r) const - { - return R().equal_2_object()(*this, r); - } - - bool - operator!=(const Ray_2& r) const - { - return !(*this == r); - } - Ray_2 transform(const Aff_transformation_2 &t) const { diff --git a/Kernel_23/include/CGAL/Segment_2.h b/Kernel_23/include/CGAL/Segment_2.h index 6283dc10fff..198857e0f7a 100644 --- a/Kernel_23/include/CGAL/Segment_2.h +++ b/Kernel_23/include/CGAL/Segment_2.h @@ -135,19 +135,6 @@ public: return R().construct_bbox_2_object()(*this); } - bool - operator==(const Segment_2 &s) const - { - return R().equal_2_object()(*this, s); - } - - bool - operator!=(const Segment_2 &s) const - { - return !(*this == s); - } - - Direction_2 direction() const { diff --git a/Kernel_23/include/CGAL/Triangle_2.h b/Kernel_23/include/CGAL/Triangle_2.h index cf35524a6a4..4439ed5e564 100644 --- a/Kernel_23/include/CGAL/Triangle_2.h +++ b/Kernel_23/include/CGAL/Triangle_2.h @@ -89,18 +89,6 @@ public: return R().oriented_side_2_object()(*this,p); } - typename R::Boolean - operator==(const Triangle_2 &t) const - { - return R().equal_2_object()(*this,t); - } - - typename R::Boolean - operator!=(const Triangle_2 &t) const - { - return !(*this == t); - } - decltype(auto) vertex(int i) const { diff --git a/Kernel_23/include/CGAL/Vector_2.h b/Kernel_23/include/CGAL/Vector_2.h index 6e62f77fa5d..8fd91c5e803 100644 --- a/Kernel_23/include/CGAL/Vector_2.h +++ b/Kernel_23/include/CGAL/Vector_2.h @@ -251,43 +251,8 @@ public: { return t.transform(*this); } - }; - -template < class R > -inline -bool -operator==(const Vector_2 &v, const Null_vector &n) -{ - return R().equal_2_object()(v, n); -} - -template < class R > -inline -bool -operator==(const Null_vector &n, const Vector_2 &v) -{ - return v == n; -} - -template < class R > -inline -bool -operator!=(const Vector_2 &v, const Null_vector &n) -{ - return !(v == n); -} - -template < class R > -inline -bool -operator!=(const Null_vector &n, const Vector_2 &v) -{ - return !(v == n); -} - - template std::ostream& insert(std::ostream& os, const Vector_2& v, const Cartesian_tag&) diff --git a/Kernel_23/include/CGAL/Weighted_point_2.h b/Kernel_23/include/CGAL/Weighted_point_2.h index ea4364644a8..a980b605ccc 100644 --- a/Kernel_23/include/CGAL/Weighted_point_2.h +++ b/Kernel_23/include/CGAL/Weighted_point_2.h @@ -177,63 +177,6 @@ public: }; -template -inline -bool -operator==(const Origin& o, const Weighted_point_2& p) -{ return p == o; } - -template -inline -bool -operator!=(const Origin& o, const Weighted_point_2& p) -{ return p != o; } - - -template -inline -bool -operator==(const Point_2& bp, const Weighted_point_2& p) -{ return bp == p.point(); } - -template -inline -bool -operator!=(const Point_2& bp, const Weighted_point_2& p) -{ return bp != p.point(); } - -template -inline -bool -operator==(const Weighted_point_2& p, const Point_2& bp) -{ return bp == p.point(); } - -template -inline -bool -operator!=(const Weighted_point_2& p, const Point_2& bp) -{ return bp != p.point(); } - -template -inline -bool -operator==(const Weighted_point_2& p, const Weighted_point_2& p2) -{ return p.point() == p2.point(); } - -template -inline -bool -operator!=(const Weighted_point_2& p, const Weighted_point_2& p2) -{ return p.point() != p2.point(); } - - -template -inline -bool -operator<(const Weighted_point_2& p, const Weighted_point_2& q) -{ return p.point() < q.point(); } - - template std::ostream& insert(std::ostream& os, const Weighted_point_2& p,const Cartesian_tag&) diff --git a/Kernel_23/include/CGAL/Weighted_point_3.h b/Kernel_23/include/CGAL/Weighted_point_3.h index c57467fb17a..1ed079f8e47 100644 --- a/Kernel_23/include/CGAL/Weighted_point_3.h +++ b/Kernel_23/include/CGAL/Weighted_point_3.h @@ -193,62 +193,6 @@ public: }; -template -inline -bool -operator==(const Origin& o, const Weighted_point_3& p) -{ return p == o; } - -template -inline -bool -operator!=(const Origin& o, const Weighted_point_3& p) -{ return p != o; } - -template -inline -bool -operator==(const Point_3& bp, const Weighted_point_3& p) -{ return bp == p.point(); } - -template -inline -bool -operator!=(const Point_3& bp, const Weighted_point_3& p) -{ return bp != p.point(); } - -template -inline -bool -operator==(const Weighted_point_3& p, const Point_3& bp) -{ return bp == p.point(); } - -template -inline -bool -operator!=(const Weighted_point_3& p, const Point_3& bp) -{ return bp != p.point(); } - -template -inline -bool -operator==(const Weighted_point_3& p, const Weighted_point_3& p2) -{ return p.point() == p2.point(); } - -template -inline -bool -operator!=(const Weighted_point_3& p, const Weighted_point_3& p2) -{ return p.point() != p2.point(); } - - -template -inline -bool -operator<(const Weighted_point_3& p, const Weighted_point_3& q) -{ return p.point() < q.point(); } - - template std::ostream& insert(std::ostream& os, const Weighted_point_3& p,const Cartesian_tag&) From e4c0bf1ae5dbcfae9800b70a2e1fc58faa920ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 16 Jan 2025 10:40:51 +0100 Subject: [PATCH 42/68] Use const& for data member --- Homogeneous_kernel/include/CGAL/Homogeneous/CircleH2.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/CircleH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/CircleH2.h index c4d0baf21d5..e46139d0cd6 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/CircleH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/CircleH2.h @@ -137,7 +137,7 @@ typename R::Oriented_side CircleH2::oriented_side( const typename CircleH2::Point_2& p) const { FT sq_dist = squared_distance( p, center() ); - FT sq_rad = squared_radius(); + const FT& sq_rad = squared_radius(); typename R::Comparison_result vgl = CGAL_NTS compare( sq_dist, sq_rad ); typename R::Oriented_side rel_pos = (vgl == LARGER ) ? ON_NEGATIVE_SIDE : ((vgl == SMALLER) ? ON_POSITIVE_SIDE @@ -190,7 +190,7 @@ typename R::Bounded_side CircleH2::bounded_side(const typename CircleH2::Point_2& p) const { FT sq_dist = squared_distance( p, center() ); - FT sq_rad = squared_radius(); + const FT& sq_rad = squared_radius(); typename R::Comparison_result vgl = CGAL_NTS compare( sq_dist, sq_rad ); return (vgl == LARGER ) ? ON_UNBOUNDED_SIDE : ( (vgl == SMALLER ) ? @@ -204,7 +204,7 @@ typename R::Boolean CircleH2::has_on_bounded_side(const typename CircleH2::Point_2& p) const { FT sq_dist = squared_distance( p, center() ); - FT sq_rad = squared_radius(); + const FT& sq_rad = squared_radius(); return ( sq_dist < sq_rad ); } @@ -214,7 +214,7 @@ typename R::Boolean CircleH2::has_on_unbounded_side(const typename CircleH2::Point_2&p) const { FT sq_dist = squared_distance( p, center() ); - FT sq_rad = squared_radius(); + const FT& sq_rad = squared_radius(); return ( sq_rad < sq_dist ); } From 98201c6ecc6ff1659011cda17c36fbb5354679a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 16 Jan 2025 10:41:16 +0100 Subject: [PATCH 43/68] Point_3 is no different from other kernel objects --- Kernel_23/include/CGAL/Kernel/function_objects.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index c85b8f51aa9..0a16d897542 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -3076,12 +3076,10 @@ namespace CommonKernelFunctors { typedef typename K::Circle_3 Circle_3; public: - - // Point_3 is special case since the global operator== would recurse. 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()); + return p.rep() == q.rep(); } Boolean From 1e46c44142aa5e3ee672971712a34f6df6963ef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 16 Jan 2025 10:41:47 +0100 Subject: [PATCH 44/68] Enable some disabled tests: operator==(Origin, Point_x) now exists --- Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_2.h | 3 --- Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_3.h | 3 --- 2 files changed, 6 deletions(-) diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_2.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_2.h index 6ea80be2a41..ca80bb3440a 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_2.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_2.h @@ -88,11 +88,8 @@ _test_cls_point_2(const R& ) assert( p0 == CGAL::ORIGIN); assert( p1 != CGAL::ORIGIN ); - // Doesn't work; Point_2::operator== can't be used :( -#ifdef ENHANCED assert( CGAL::ORIGIN == p0 ); assert( CGAL::ORIGIN != p1 ); -#endif assert( p3.hx() == n1 ); // don't replace p3 assert( p3.hy() == n2 ); diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_3.h index b09c11e47a7..698f29b737d 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_3.h @@ -86,11 +86,8 @@ _test_cls_point_3(const R& ) assert( p0 == CGAL::ORIGIN); assert( p1 != CGAL::ORIGIN); - // Doesn't work; Point_2::operator== can't be used :( -#ifdef ENHANCED assert( CGAL::ORIGIN == p0 ); assert( CGAL::ORIGIN != p1 ); -#endif // ENHANCED assert( p3.hx() == n1 ); // don't replace p3 assert( p3.hy() == n2 ); From d2f6836a608d79ffbe8e7b3e1dd1de9c23a674ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 16 Jan 2025 10:42:21 +0100 Subject: [PATCH 45/68] Use CGAL_AND --- Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h index 034ca73fe1d..444ffe0ac3a 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h @@ -142,7 +142,7 @@ inline typename R::Boolean operator==(const VectorC3 &v, const VectorC3 &w) { - return w.x() == v.x() && w.y() == v.y() && w.z() == v.z(); + return CGAL_AND_3(w.x() == v.x(), w.y() == v.y(), w.z() == v.z()); } template < class R > @@ -158,8 +158,7 @@ inline typename R::Boolean operator==(const VectorC3 &v, const Null_vector &) { - return CGAL_NTS is_zero(v.x()) && CGAL_NTS is_zero(v.y()) && - CGAL_NTS is_zero(v.z()); + return CGAL_AND_3(CGAL_NTS is_zero(v.x()), CGAL_NTS is_zero(v.y()), CGAL_NTS is_zero(v.z())); } template < class R > From 06f862eee7bf8df397a93bb898c54c9ab63a433b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 17 Jan 2025 12:27:21 +0100 Subject: [PATCH 46/68] Misc post-merge fixes --- .../Filtered_kernel/Filtered_predicate.cpp | 4 ++-- .../Coplanar_side_of_bounded_circle_3.h | 2 -- .../Power_side_of_oriented_power_circle_2.h | 18 +++++++++--------- Filtered_kernel/include/CGAL/Kernel_profiler.h | 4 +--- .../Line_3_Tetrahedron_3_intersection.h | 1 - .../include/CGAL/Kernel/function_objects.h | 17 +++++++++-------- .../NewKernel_d/Cartesian_static_filters.h | 2 ++ 7 files changed, 23 insertions(+), 25 deletions(-) diff --git a/Filtered_kernel/examples/Filtered_kernel/Filtered_predicate.cpp b/Filtered_kernel/examples/Filtered_kernel/Filtered_predicate.cpp index c69d93421e7..dd6e63907c0 100644 --- a/Filtered_kernel/examples/Filtered_kernel/Filtered_predicate.cpp +++ b/Filtered_kernel/examples/Filtered_kernel/Filtered_predicate.cpp @@ -16,9 +16,9 @@ struct My_orientation_2 typedef typename K::RT RT; typedef typename K::Point_2 Point_2; - typedef typename K::Orientation result_type; + typedef typename K::Orientation Orientation; - result_type + Orientation operator()(const Point_2 &p, const Point_2 &q, const Point_2 &r) const { RT prx = p.x() - r.x(); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h index 48c96ec886c..ae9c2e36229 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h @@ -44,8 +44,6 @@ class Side_of_bounded_circle_3 } public: - typedef Bounded_side result_type; - Bounded_side operator()(const Point &p, const Point &q, const Point &r, const Point &t) const { diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Power_side_of_oriented_power_circle_2.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Power_side_of_oriented_power_circle_2.h index f9097923bab..e7f1c195da8 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Power_side_of_oriented_power_circle_2.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Power_side_of_oriented_power_circle_2.h @@ -26,15 +26,15 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { class Power_side_of_oriented_power_circle_2: public K_base::Power_side_of_oriented_power_circle_2 { + typedef typename K_base::Oriented_side Oriented_side; typedef typename K_base::Weighted_point_2 Weighted_point_2; typedef typename K_base::FT FT; typedef typename K_base::Power_side_of_oriented_power_circle_2 Base; - public: - typedef typename Base::result_type result_type; + public: using Base::operator(); - result_type operator() ( const Weighted_point_2 & p, + Oriented_side operator()(const Weighted_point_2 & p, const Weighted_point_2 & q, const Weighted_point_2 & r, const Weighted_point_2 & t) const @@ -64,7 +64,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { double drx = (rx - tx); double dry = (ry - ty); double drz = (((square( drx ) + square( dry )) - rwt) + twt); - result_type int_tmp_result; + Oriented_side int_tmp_result; double RT_tmp_result; double eps; RT_tmp_result = CGAL::determinant( dpx, dpy, dpz, dqx, dqy, dqz, drx, dry, drz ); @@ -162,7 +162,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { } - result_type operator() ( const Weighted_point_2 & p, + Oriented_side operator()(const Weighted_point_2 & p, const Weighted_point_2 & q, const Weighted_point_2 & t) const { @@ -219,7 +219,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { double upper_bound_1; if( (cmpx != 0) ) { - result_type int_tmp_result; + Oriented_side int_tmp_result; double RT_tmp_result; RT_tmp_result = CGAL::determinant( dpx, dpz, dqx, dqz ); lower_bound_1 = max2; @@ -265,11 +265,11 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { } } } - return static_cast(cmpx * int_tmp_result); + return static_cast(cmpx * int_tmp_result); } int cmpy; cmpy = ((py > qy) ? 1 : ((py < qy) ? -1 : 0)); - result_type int_tmp_result_FFWKCAA; + Oriented_side int_tmp_result_FFWKCAA; double RT_tmp_result_k60Ocge = CGAL::determinant( dpy, dpz, dqy, dqz ); lower_bound_1 = max4; upper_bound_1 = max4; @@ -314,7 +314,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { } } } - return static_cast(cmpy * int_tmp_result_FFWKCAA); + return static_cast(cmpy * int_tmp_result_FFWKCAA); } else diff --git a/Filtered_kernel/include/CGAL/Kernel_profiler.h b/Filtered_kernel/include/CGAL/Kernel_profiler.h index 20611510e94..aaaa310afce 100644 --- a/Filtered_kernel/include/CGAL/Kernel_profiler.h +++ b/Filtered_kernel/include/CGAL/Kernel_profiler.h @@ -25,8 +25,6 @@ template < typename P > struct Primitive_profiler : public P { - typedef typename P::result_type result_type; - // #define CGAL_KERNEL_PROFILER CGAL_PROFILER(CGAL_PRETTY_FUNCTION); #define CGAL_KERNEL_PROFILER \ CGAL_PROFILER(typeid(static_cast(*this)).name()) @@ -35,7 +33,7 @@ struct Primitive_profiler : P(p) {} template - result_type + decltype(auto) operator()(A&& ... a) const { CGAL_KERNEL_PROFILER; diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Tetrahedron_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Tetrahedron_3_intersection.h index f1d8bdff1fd..706ceea7488 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Tetrahedron_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Tetrahedron_3_intersection.h @@ -26,7 +26,6 @@ struct Tetrahedron_Line_intersection_3 : public Tetrahedron_lines_intersection_3_base > { typedef Tetrahedron_lines_intersection_3_base > Base; - typedef typename Base::Result_type Result_type; Tetrahedron_Line_intersection_3(const typename K::Tetrahedron_3& tet, const typename K::Line_3& l) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index c456062d8c5..65baa5cd544 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -2148,10 +2148,10 @@ namespace CommonKernelFunctors { { typedef typename K::Plane_3 Plane; typedef typename K::Point_3 Point; - typename K::Construct_plane_3 construct_plane; - public: - typedef Point result_type; + typename K::Construct_plane_3 construct_plane; + + public: Point operator()(const Point& p1, const Point& q1, const Point& r1, const Point& p2, const Point& q2, const Point& r2, @@ -2184,10 +2184,10 @@ namespace CommonKernelFunctors { { typedef typename K::Segment_3 Segment; typedef typename K::Point_3 Point; - typename K::Construct_segment_3 construct_segment; - public: - typedef Point result_type; + typename K::Construct_segment_3 construct_segment; + + public: Point operator()(const Point& p1, const Point& q1, const Point& p2, const Point& q2) const @@ -2216,11 +2216,12 @@ namespace CommonKernelFunctors { template class Compute_alpha_for_coplanar_triangle_intersection_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 + FT operator()(const Point_3& p1, const Point_3& p2, // segment 1 const Point_3& p3, const Point_3& p4) const // segment 2 { 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 8dba5e40912..cd870c938e6 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h @@ -86,6 +86,8 @@ template struct Side_of_oriented_sphere_2 : private Store }; template struct Adapter_3 { + 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; From 2f84ba4aea5ca9801b94790af419b18743be426f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 17 Jan 2025 13:41:44 +0100 Subject: [PATCH 47/68] Fix compilation --- .../Kernel_23/internal/Projection_traits_base_3.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 002bbc0d79b..0ca6fde86d4 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 @@ -345,7 +345,7 @@ template class Less_xy_along_axis { // private members - typedef typename R::Comparison_result Comparison_result; + typedef typename Traits::Comparison_result Comparison_result; typedef typename Traits::Boolean Boolean; typedef typename Traits::Vector_3 Vector_3; typedef typename Traits::Point_2 Point; @@ -416,6 +416,15 @@ public: } typedef Kernel K; + + typedef typename K::Boolean Boolean; + typedef typename K::Sign Sign; + typedef typename K::Comparison_result Comparison_result; + typedef typename K::Orientation Orientation; + typedef typename K::Oriented_side Oriented_side; + typedef typename K::Bounded_side Bounded_side; + typedef typename K::Angle Angle; + typedef typename K::FT FT; typedef typename K::Point_3 Point_2; typedef typename K::Segment_3 Segment_2; From 96524bdf2b56c8174114eb819134b347fb5d7f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sat, 15 Mar 2025 22:13:43 +0100 Subject: [PATCH 48/68] Use std::invoke, CGAL::cpp20, ... --- Filtered_kernel/include/CGAL/Lazy.h | 30 ++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index ce31b355bf2..29076772270 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -1074,10 +1074,10 @@ struct Lazy_construction_nt { template auto operator()(L const&...l) const -> - Lazy_exact_nt>> + Lazy_exact_nt> { - typedef std::remove_cv_t> ET; - typedef std::remove_cv_t> AT; + typedef CGAL::cpp20::remove_cvref_t ET; + typedef CGAL::cpp20::remove_cvref_t AT; CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); { Protect_FPU_rounding P; @@ -1440,13 +1440,13 @@ struct Lazy_construction 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 Type_mapper::type...>, AK, AK>::type AT; // ----------------------- FT ----------------------- if constexpr (std::is_same_v) { + typedef typename Type_mapper::type...>,EK,EK>::type ET; + typedef Lazy_exact_nt> result_type; CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); @@ -1481,14 +1481,13 @@ struct Lazy_construction // ----------------------- CGAL::Object ----------------------- else if constexpr (std::is_same_v) { - typedef CGAL::Object result_type; typedef Lazy Lazy_object; CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); { Protect_FPU_rounding P; try { - Lazy_object lo(new Lazy_rep_n(ac, ec, l...)); + Lazy_object lo(new Lazy_rep_n(ac, ec, l...)); if(lo.approx().is_empty()) return Object(); @@ -1531,13 +1530,15 @@ struct Lazy_construction 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)...); + CGAL::Object eto = ec(CGAL::exact(l)...); return make_lazy(eto); } // std::optional > (Intersection_23 result types) else if constexpr (is_optional_variant::value) { - typedef typename Type_mapper()(std::declval::type>()...)),AK,LK>::type result_type; + typedef typename Type_mapper::type...>,EK,EK>::type ET; + + typedef typename Type_mapper::type...>, AK, LK>::type result_type; CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); { @@ -1580,7 +1581,10 @@ struct Lazy_construction // ----------------------- GENERIC ----------------------- else { - typedef typename Type_mapper()(std::declval::type>()...)),AK,LK>::type result_type; + typedef typename Type_mapper::type...>,EK,EK>::type ET; + + typedef Lazy Handle; + typedef typename Type_mapper::type...>, AK, LK>::type result_type; static const bool noprune = Disable_lazy_pruning::value; @@ -1602,8 +1606,8 @@ struct Lazy_construction decltype(auto) operator()() const { - typedef decltype(std::declval()()) AT; - typedef decltype(std::declval()()) ET; + typedef std::invoke_result_t AT; + typedef std::invoke_result_t ET; typedef Lazy Handle; typedef typename Type_mapper::type result_type; From 13842b219f6298eea4007ede5b7d80e4546617d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sun, 16 Mar 2025 13:26:31 +0100 Subject: [PATCH 49/68] Fix periodic predicates relying on a result_type typedef --- .../Functor_with_offset_points_adaptor_2.h | 25 +++++++++--------- .../Static_filters/Periodic_2_orientation_2.h | 8 +++--- .../Periodic_2_side_of_oriented_circle_2.h | 2 -- .../Functor_with_offset_points_adaptor_3.h | 26 +++++++++---------- .../Static_filters/Periodic_3_orientation_3.h | 8 +++--- .../Periodic_3_side_of_oriented_sphere_3.h | 3 --- 6 files changed, 32 insertions(+), 40 deletions(-) diff --git a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2/internal/Functor_with_offset_points_adaptor_2.h b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2/internal/Functor_with_offset_points_adaptor_2.h index 7cff0fd5f76..d14518d7da4 100644 --- a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2/internal/Functor_with_offset_points_adaptor_2.h +++ b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2/internal/Functor_with_offset_points_adaptor_2.h @@ -29,7 +29,6 @@ class Functor_with_offset_points_adaptor_2 typedef typename Kernel::Construct_point_2 Construct_point_2; public: - typedef typename Functor::result_type result_type; Functor_with_offset_points_adaptor_2(const Functor& functor, const Construct_point_2& cp) @@ -39,24 +38,24 @@ public: // gives access to function calls without offset using Functor::operator(); - result_type operator()(const Point& p0, const Point& p1, - const Offset& o0, const Offset& o1) const { + decltype(auto) operator()(const Point& p0, const Point& p1, + const Offset& o0, const Offset& o1) const { return operator()(cp(p0,o0), cp(p1,o1)); } - result_type operator()(const Point& p0, const Point& p1, const Point& p2, - const Offset& o0, const Offset& o1, const Offset& o2) const { + decltype(auto) operator()(const Point& p0, const Point& p1, const Point& p2, + const Offset& o0, const Offset& o1, const Offset& o2) const { return operator()(cp(p0,o0), cp(p1,o1), cp(p2,o2)); } - result_type operator()(const Point& p0, const Point& p1, - const Point& p2, const Point& p3, - const Offset& o0, const Offset& o1, - const Offset& o2, const Offset& o3) const { + decltype(auto) operator()(const Point& p0, const Point& p1, + const Point& p2, const Point& p3, + const Offset& o0, const Offset& o1, + const Offset& o2, const Offset& o3) const { return operator()(cp(p0,o0), cp(p1,o1), cp(p2,o2), cp(p3,o3)); } - result_type operator()(const Point& p0, const Point& p1, - const Point& p2, const Point& p3, const Point& p4, - const Offset& o0, const Offset& o1, const Offset& o2, - const Offset& o3, const Offset& o4) const { + decltype(auto) operator()(const Point& p0, const Point& p1, + const Point& p2, const Point& p3, const Point& p4, + const Offset& o0, const Offset& o1, const Offset& o2, + const Offset& o3, const Offset& o4) const { return operator()(cp(p0,o0), cp(p1,o1), cp(p2,o2), cp(p3,o3), cp(p4,o4)); } diff --git a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2/internal/Static_filters/Periodic_2_orientation_2.h b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2/internal/Static_filters/Periodic_2_orientation_2.h index 255f72b4e63..75fdaf59853 100644 --- a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2/internal/Static_filters/Periodic_2_orientation_2.h +++ b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2/internal/Static_filters/Periodic_2_orientation_2.h @@ -92,12 +92,12 @@ public: typedef typename Kernel::Iso_rectangle_2 Iso_rectangle_2; typedef typename Kernel::Periodic_2_offset_2 Offset_2; + typedef typename Kernel:: Orientation Orientation; + public: const Iso_rectangle_2 * const _dom; public: - typedef typename Base::result_type result_type; - Periodic_2_orientation_2(const Iso_rectangle_2 * const dom, const Base& o2b) : Base(o2b), _dom(dom) @@ -106,7 +106,7 @@ public: using Base::operator(); /// Normal static orientation test, copied from Orientation_2 - result_type operator()(const Point_2 &p, const Point_2 &q, const Point_2 &r) const + Orientation operator()(const Point_2 &p, const Point_2 &q, const Point_2 &r) const { CGAL_PROFILER("Periodic_2_orientation_2 calls"); @@ -161,7 +161,7 @@ public: /// Static orientation test with offsets - result_type operator()(const Point_2 &p, const Point_2 &q, const Point_2 &r, + Orientation operator()(const Point_2 &p, const Point_2 &q, const Point_2 &r, const Offset_2 &o_p, const Offset_2 &o_q, const Offset_2 &o_r) const { diff --git a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2/internal/Static_filters/Periodic_2_side_of_oriented_circle_2.h b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2/internal/Static_filters/Periodic_2_side_of_oriented_circle_2.h index 996db9f975a..8484871d9e3 100644 --- a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2/internal/Static_filters/Periodic_2_side_of_oriented_circle_2.h +++ b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2/internal/Static_filters/Periodic_2_side_of_oriented_circle_2.h @@ -45,8 +45,6 @@ private: const Iso_rectangle_2 * _dom; public: - typedef typename Base::result_type result_type; - Periodic_2_side_of_oriented_circle_2(const Iso_rectangle_2 * dom, const Base& socb) : Base(socb), _dom(dom) diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Functor_with_offset_points_adaptor_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Functor_with_offset_points_adaptor_3.h index 0edd5d23426..f813e6e7345 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Functor_with_offset_points_adaptor_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Functor_with_offset_points_adaptor_3.h @@ -34,8 +34,6 @@ class Functor_with_offset_points_adaptor_3 typedef typename Kernel::Construct_point_3 Construct_point_3; public: - typedef typename Functor::result_type result_type; - Functor_with_offset_points_adaptor_3(const Functor& functor, const Construct_point_3& cp) : Functor_(functor), cp(cp) @@ -44,24 +42,24 @@ public: // gives access to function calls without offset using Functor::operator(); - result_type operator()(const Point& p0, const Point& p1, - const Offset& o0, const Offset& o1) const { + decltype(auto) operator()(const Point& p0, const Point& p1, + const Offset& o0, const Offset& o1) const { return operator()(cp(p0,o0), cp(p1,o1)); } - result_type operator()(const Point& p0, const Point& p1, const Point& p2, - const Offset& o0, const Offset& o1, const Offset& o2) const { + decltype(auto) operator()(const Point& p0, const Point& p1, const Point& p2, + const Offset& o0, const Offset& o1, const Offset& o2) const { return operator()(cp(p0,o0), cp(p1,o1), cp(p2,o2)); } - result_type operator()(const Point& p0, const Point& p1, - const Point& p2, const Point& p3, - const Offset& o0, const Offset& o1, - const Offset& o2, const Offset& o3) const { + decltype(auto) operator()(const Point& p0, const Point& p1, + const Point& p2, const Point& p3, + const Offset& o0, const Offset& o1, + const Offset& o2, const Offset& o3) const { return operator()(cp(p0,o0), cp(p1,o1), cp(p2,o2), cp(p3,o3)); } - result_type operator()(const Point& p0, const Point& p1, - const Point& p2, const Point& p3, const Point& p4, - const Offset& o0, const Offset& o1, const Offset& o2, - const Offset& o3, const Offset& o4) const { + decltype(auto) operator()(const Point& p0, const Point& p1, + const Point& p2, const Point& p3, const Point& p4, + const Offset& o0, const Offset& o1, const Offset& o2, + const Offset& o3, const Offset& o4) const { return operator()(cp(p0,o0), cp(p1,o1), cp(p2,o2), cp(p3,o3), cp(p4,o4)); } diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Static_filters/Periodic_3_orientation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Static_filters/Periodic_3_orientation_3.h index 9b19c03f511..f858558c45f 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Static_filters/Periodic_3_orientation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Static_filters/Periodic_3_orientation_3.h @@ -42,12 +42,12 @@ public: typedef typename K::Sphere_3 Sphere_3; typedef typename K::Periodic_3_offset_3 Offset; + typedef typename K::Orientation Orientation; + public: const Iso_cuboid_3 * const _dom; public: - typedef typename Base::result_type result_type; - Periodic_3_orientation_3(const Iso_cuboid_3 * const dom, const Orientation_3_base& o3b) : Base(o3b), _dom(dom) @@ -55,7 +55,7 @@ public: using Base::operator(); - result_type + Orientation operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r, const Point_3 &s) const { @@ -157,7 +157,7 @@ public: return Base::operator()(p, q, r, s); } - result_type + Orientation operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r, const Point_3 &s, const Offset &o_p, const Offset &o_q, diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Static_filters/Periodic_3_side_of_oriented_sphere_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Static_filters/Periodic_3_side_of_oriented_sphere_3.h index 992e60d1ee0..9c0eae4b8de 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Static_filters/Periodic_3_side_of_oriented_sphere_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Static_filters/Periodic_3_side_of_oriented_sphere_3.h @@ -42,9 +42,6 @@ public: typedef typename K::Iso_cuboid_3 Iso_cuboid_3; typedef typename K::Periodic_3_offset_3 Offset; -public: - typedef typename Base::result_type result_type; - private: const Iso_cuboid_3 * _dom; From a06a6a35b9c57375ff6f6504758edce513c6fd39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sun, 16 Mar 2025 13:27:07 +0100 Subject: [PATCH 50/68] Use std::invoke_result and not result_type to get the return type --- Spatial_searching/include/CGAL/Fuzzy_iso_box.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Spatial_searching/include/CGAL/Fuzzy_iso_box.h b/Spatial_searching/include/CGAL/Fuzzy_iso_box.h index 08cc1da0063..6d499b9617d 100644 --- a/Spatial_searching/include/CGAL/Fuzzy_iso_box.h +++ b/Spatial_searching/include/CGAL/Fuzzy_iso_box.h @@ -59,9 +59,8 @@ namespace CGAL { private: - std::remove_cv_t< - std::remove_reference_t< typename Construct_min_vertex_d::result_type > - > min, max; + CGAL::cpp20::remove_cvref_t > min; + CGAL::cpp20::remove_cvref_t > max; Cartesian_const_iterator_d min_begin, max_begin; FT eps; unsigned int dim; From ed50e36c6861e317ec068806aba30c6cce76d0de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sun, 16 Mar 2025 13:31:16 +0100 Subject: [PATCH 51/68] Fix typo in typedef making the type be K::Bounded_side instead of CGAL::Bounded_side --- .../CGAL/Apollonius_graph_2/Bounded_side_of_ccw_circle_C2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Bounded_side_of_ccw_circle_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Bounded_side_of_ccw_circle_C2.h index bbef2be6ac0..a6590cde787 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Bounded_side_of_ccw_circle_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Bounded_side_of_ccw_circle_C2.h @@ -77,7 +77,7 @@ private: public: typedef Voronoi_radius_2 Voronoi_radius; - typedef typename K::Bounded_side Bounded_dide; + typedef typename K::Bounded_side Bounded_side; public: template From a98d5149dec99d09caddea8ad825bbe5053495bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sun, 16 Mar 2025 13:33:44 +0100 Subject: [PATCH 52/68] Remove useless header includes --- Kernel_23/include/CGAL/Kernel/function_objects.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 721ffe96827..bbe6179eb88 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -22,8 +22,6 @@ #include #include -#include -#include #include #include #include From 8e0b7a5827618873d11cbbc4106ee7a75847e658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sun, 16 Mar 2025 14:24:18 +0100 Subject: [PATCH 53/68] Fix compilation in Partition_2 --- Partition_2/include/CGAL/Partition_traits_2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Partition_2/include/CGAL/Partition_traits_2.h b/Partition_2/include/CGAL/Partition_traits_2.h index 6baf74e8b4a..389e64bcf33 100644 --- a/Partition_2/include/CGAL/Partition_traits_2.h +++ b/Partition_2/include/CGAL/Partition_traits_2.h @@ -74,11 +74,11 @@ public: const PointPropertyMap& ppmap; - typename BaseFct::result_type operator()(const Arg_type& p, const Arg_type& q) const { + decltype(auto) operator()(const Arg_type& p, const Arg_type& q) const { return static_cast(this)->operator()(get(ppmap,p),get(ppmap,q)); } - typename BaseFct::result_type operator()(const Arg_type& p, const Arg_type& q, const Arg_type& r) const { + decltype(auto) operator()(const Arg_type& p, const Arg_type& q, const Arg_type& r) const { return static_cast(this)->operator()(get(ppmap,p),get(ppmap,q),get(ppmap,r)); } }; From c5d51c490978c7bb859bf725373d46bc8d38f1d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sun, 16 Mar 2025 14:25:04 +0100 Subject: [PATCH 54/68] Fix compilation in periodic triangulations --- ...or_with_offset_weighted_points_adaptor_3.h | 82 +++++++++---------- ...3_Delaunay_triangulation_remove_traits_3.h | 24 ++---- ..._3_regular_triangulation_remove_traits_3.h | 44 ++++------ ...perbolic_Delaunay_triangulation_traits_2.h | 43 ++++------ 4 files changed, 82 insertions(+), 111 deletions(-) diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Functor_with_offset_weighted_points_adaptor_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Functor_with_offset_weighted_points_adaptor_3.h index 19b9e657f48..91838f0f4b6 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Functor_with_offset_weighted_points_adaptor_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Functor_with_offset_weighted_points_adaptor_3.h @@ -42,8 +42,6 @@ class Functor_with_offset_weighted_points_adaptor_3 typedef typename Kernel::Construct_weighted_point_3 Construct_weighted_point_3; public: - typedef typename Functor::result_type result_type; - Functor_with_offset_weighted_points_adaptor_3(const Functor_& functor, const Construct_point_3& cp, const Construct_weighted_point_3& wp) @@ -53,76 +51,76 @@ public: // gives access to calls with Point_3 arguments and without offset using Base::operator(); - result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, - const Offset& o0, const Offset& o1) const { + decltype(auto) operator()(const Weighted_point_3& p0, const Weighted_point_3& p1, + const Offset& o0, const Offset& o1) const { return operator()(wp(p0, o0), wp(p1, o1)); } - result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, - const Weighted_point_3& p2, - const Offset& o0, const Offset& o1, - const Offset& o2) const { + decltype(auto) operator()(const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, + const Offset& o0, const Offset& o1, + const Offset& o2) const { return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2)); } - result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, - const Weighted_point_3& p2, const Weighted_point_3& p3, - const Offset& o0, const Offset& o1, - const Offset& o2, const Offset& o3) const { + decltype(auto) operator()(const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, const Weighted_point_3& p3, + const Offset& o0, const Offset& o1, + const Offset& o2, const Offset& o3) const { return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2), wp(p3, o3)); } - result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, - const Weighted_point_3& p2, const Weighted_point_3& p3, - const Weighted_point_3& p4, - const Offset& o0, const Offset& o1, - const Offset& o2, const Offset& o3, - const Offset& o4) const { + decltype(auto) operator()(const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, const Weighted_point_3& p3, + const Weighted_point_3& p4, + const Offset& o0, const Offset& o1, + const Offset& o2, const Offset& o3, + const Offset& o4) const { return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2), wp(p3, o3), wp(p4, o4)); } // for `Compare_power_distance_3` - result_type operator() (const Point_3& p0, const Weighted_point_3& p1, - const Weighted_point_3& p2, - const Offset& o0, const Offset& o1, - const Offset& o2) const { + decltype(auto) operator()(const Point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, + const Offset& o0, const Offset& o1, + const Offset& o2) const { return operator()(this->cp(p0, o0), wp(p1, o1), wp(p2, o2)); } // for `Compare_weighted_squared_radius_3` - result_type operator() (const Weighted_point_3& p0, const Offset& o0, - const FT w) const { + decltype(auto) operator()(const Weighted_point_3& p0, const Offset& o0, + const FT w) const { return operator()(wp(p0, o0), w); } - result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, - const Offset& o0, const Offset& o1, - const FT w) const { + decltype(auto) operator()(const Weighted_point_3& p0, const Weighted_point_3& p1, + const Offset& o0, const Offset& o1, + const FT w) const { return operator()(wp(p0, o0), wp(p1, o1), w); } - result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, - const Weighted_point_3& p2, - const Offset& o0, const Offset& o1, - const Offset& o2, - const FT w) const { + decltype(auto) operator()(const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, + const Offset& o0, const Offset& o1, + const Offset& o2, + const FT w) const { return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2), w); } - result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, - const Weighted_point_3& p2, const Weighted_point_3& p3, - const Offset& o0, const Offset& o1, - const Offset& o2, const Offset& o3, - const FT w) const { + decltype(auto) operator()(const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, const Weighted_point_3& p3, + const Offset& o0, const Offset& o1, + const Offset& o2, const Offset& o3, + const FT w) const { return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2), wp(p3, o3), w); } // for robust circumcenter_3 - result_type operator()(const Weighted_point_3& p0, const Weighted_point_3& p1, - const Weighted_point_3& p2, const Weighted_point_3& p3, - const Offset& o0, const Offset& o1, - const Offset& o2, const Offset& o3, - bool b) const { + decltype(auto) operator()(const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, const Weighted_point_3& p3, + const Offset& o0, const Offset& o1, + const Offset& o2, const Offset& o3, + bool b) const { return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2), wp(p3, o3), b); } diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h index 128cb4038d0..667ae76bc43 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h @@ -39,14 +39,6 @@ public: using Base::operator(); - template - struct result : Base::template result {}; - - template - struct result { - typedef const Point_3& type; - }; - const Point_3& operator()(const Point_3& p) const { return p; } }; @@ -61,29 +53,27 @@ class Functor_with_point_offset_pair_adaptor typedef typename Traits::Point_3 Point; public: - typedef typename Functor::result_type result_type; - Functor_with_point_offset_pair_adaptor(const Functor & functor) : Functor_(functor) { } public: using Functor::operator(); - result_type operator()(const Point& p0, const Point& p1) const { + decltype(auto) operator()(const Point& p0, const Point& p1) const { return operator()(p0.first, p1.first, p0.second, p1.second); } - result_type operator()(const Point& p0, const Point& p1, - const Point& p2) const { + decltype(auto) operator()(const Point& p0, const Point& p1, + const Point& p2) const { return operator()(p0.first, p1.first, p2.first, p0.second, p1.second, p2.second); } - result_type operator()(const Point& p0, const Point& p1, - const Point& p2, const Point& p3) const { + decltype(auto) operator()(const Point& p0, const Point& p1, + const Point& p2, const Point& p3) const { return operator()(p0.first, p1.first, p2.first, p3.first, p0.second, p1.second, p2.second, p3.second); } - result_type operator()(const Point& p0, const Point& p1, - const Point& p2, const Point& p3, const Point& p4) const { + decltype(auto) operator()(const Point& p0, const Point& p1, + const Point& p2, const Point& p3, const Point& p4) const { return operator()(p0.first, p1.first, p2.first, p3.first, p4.first, p0.second, p1.second, p2.second, p3.second, p4.second); } diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Periodic_3_regular_triangulation_remove_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Periodic_3_regular_triangulation_remove_traits_3.h index 41fdaa532c0..daaf6425672 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Periodic_3_regular_triangulation_remove_traits_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Periodic_3_regular_triangulation_remove_traits_3.h @@ -49,14 +49,6 @@ public: using Base::operator(); // for K::Weighted_point_3 to Point_3 - template - struct result : Base::template result {}; - - template - struct result { - typedef Point_3 type; - }; - Point_3 operator()(const Weighted_point_3& wp) const { return std::make_pair(operator()(wp.first), wp.second /* offset */); } @@ -75,8 +67,6 @@ class Functor_with_weighted_point_offset_pair_adaptor typedef typename Traits::Weighted_point_3 Weighted_point_3; public: - typedef typename Functor::result_type result_type; - Functor_with_weighted_point_offset_pair_adaptor (const Functor & functor) : Functor_(functor) { } @@ -84,54 +74,54 @@ public: public: using Functor::operator(); - result_type operator() (const Point_3& p0, const Weighted_point_3& p1, - const Weighted_point_3& p2) const + decltype(auto) operator()(const Point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2) const { return operator()(p0.first, p1.first, p2.first, p0.second, p1.second, p2.second); } // bare points - result_type operator()(const Point_3& p0, const Point_3& p1) const { + decltype(auto) operator()(const Point_3& p0, const Point_3& p1) const { return operator()(p0.first, p1.first, p0.second, p1.second); } - result_type operator()(const Point_3& p0, const Point_3& p1, - const Point_3& p2) const { + decltype(auto) operator()(const Point_3& p0, const Point_3& p1, + const Point_3& p2) const { return operator()(p0.first, p1.first, p2.first, p0.second, p1.second, p2.second); } - result_type operator()(const Point_3& p0, const Point_3& p1, - const Point_3& p2, const Point_3& p3) const { + decltype(auto) operator()(const Point_3& p0, const Point_3& p1, + const Point_3& p2, const Point_3& p3) const { return operator()(p0.first, p1.first, p2.first, p3.first, p0.second, p1.second, p2.second, p3.second); } - result_type operator()(const Point_3& p0, const Point_3& p1, - const Point_3& p2, const Point_3& p3, const Point_3& p4) const { + decltype(auto) operator()(const Point_3& p0, const Point_3& p1, + const Point_3& p2, const Point_3& p3, const Point_3& p4) const { return operator()(p0.first, p1.first, p2.first, p3.first, p4.first, p0.second, p1.second, p2.second, p3.second, p4.second); } // weighted points - result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1) const + decltype(auto) operator()(const Weighted_point_3& p0, const Weighted_point_3& p1) const { return operator()(p0.first, p1.first, p0.second, p1.second); } - result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, - const Weighted_point_3& p2) const + decltype(auto) operator()(const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2) const { return operator()(p0.first, p1.first, p2.first, p0.second, p1.second, p2.second); } - result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, - const Weighted_point_3& p2, const Weighted_point_3& p3) const + decltype(auto) operator()(const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, const Weighted_point_3& p3) const { return operator()(p0.first, p1.first, p2.first, p3.first, p0.second, p1.second, p2.second, p3.second); } - result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, - const Weighted_point_3& p2, const Weighted_point_3& p3, - const Weighted_point_3& p4) const + decltype(auto) operator()(const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, const Weighted_point_3& p3, + const Weighted_point_3& p4) const { return operator()(p0.first, p1.first, p2.first, p3.first, p4.first, p0.second, p1.second, p2.second, p3.second, p4.second); diff --git a/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h b/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h index 9c89cc574d0..0abb4fbabb5 100644 --- a/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h +++ b/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_traits_2.h @@ -48,45 +48,43 @@ class Hyperbolic_traits_with_translations_2_adaptor typedef typename Kernel::Construct_hyperbolic_point_2 Construct_hyperbolic_point_2; public: - typedef typename Predicate::result_type result_type; - using Predicate::operator(); Hyperbolic_traits_with_translations_2_adaptor(const Predicate_ pred = Predicate_()) : Predicate_(pred) {} - result_type operator()(const Point& p0, const Point& p1, - const Hyperbolic_translation& o0, const Hyperbolic_translation& o1) const + decltype(auto) operator()(const Point& p0, const Point& p1, + const Hyperbolic_translation& o0, const Hyperbolic_translation& o1) const { return operator()(pp(p0, o0), pp(p1, o1)); } - result_type operator()(const Point& p0, const Point& p1, const Point& p2, - const Hyperbolic_translation& o0, const Hyperbolic_translation& o1, const Hyperbolic_translation& o2) const + decltype(auto) operator()(const Point& p0, const Point& p1, const Point& p2, + const Hyperbolic_translation& o0, const Hyperbolic_translation& o1, const Hyperbolic_translation& o2) const { return operator()(pp(p0, o0), pp(p1, o1), pp(p2, o2)); } - result_type operator()(const Point& p0, const Point& p1, - const Point& p2, const Point& p3, - const Hyperbolic_translation& o0, const Hyperbolic_translation& o1, - const Hyperbolic_translation& o2, const Hyperbolic_translation& o3) const + decltype(auto) operator()(const Point& p0, const Point& p1, + const Point& p2, const Point& p3, + const Hyperbolic_translation& o0, const Hyperbolic_translation& o1, + const Hyperbolic_translation& o2, const Hyperbolic_translation& o3) const { return operator()(pp(p0, o0), pp(p1, o1), pp(p2, o2), pp(p3, o3)); } // Added for Side_of_hyperbolic_triangle_2 template - result_type operator()(const Point& p0, const Point& p1, - const Point& p2, const Point& p3, T& t) const + decltype(auto) operator()(const Point& p0, const Point& p1, + const Point& p2, const Point& p3, T& t) const { return operator()(p0, p1, p2, p3, t); } template - result_type operator()(const Point& p0, const Point& p1, - const Point& p2, const Point& p3, - const Hyperbolic_translation& o0, const Hyperbolic_translation& o1, - const Hyperbolic_translation& o2, const Hyperbolic_translation& o3, T& t) const + decltype(auto) operator()(const Point& p0, const Point& p1, + const Point& p2, const Point& p3, + const Hyperbolic_translation& o0, const Hyperbolic_translation& o1, + const Hyperbolic_translation& o2, const Hyperbolic_translation& o3, T& t) const { return operator()(pp(p0, o0), pp(p1, o1), pp(p2, o2), pp(p3, o3), t); } @@ -109,8 +107,6 @@ private: typedef typename Kernel::Hyperbolic_translation Hyperbolic_translation; public: - typedef Point result_type; - using Construct_point_base::operator(); Periodic_4_construct_hyperbolic_point_2() { } @@ -165,14 +161,13 @@ class Compute_approximate_hyperbolic_diameter typedef typename Traits:: Euclidean_line_2 Euclidean_line_2; typedef typename Traits::Circle_2 Circle_2; typedef typename Traits::Hyperbolic_point_2 Hyperbolic_point_2; - public: - typedef double result_type; + public: Compute_approximate_hyperbolic_diameter(const Traits& gt = Traits()) : _gt(gt) {} - result_type operator()(const Hyperbolic_point_2& p1, - const Hyperbolic_point_2& p2, - const Hyperbolic_point_2& p3) + double operator()(const Hyperbolic_point_2& p1, + const Hyperbolic_point_2& p2, + const Hyperbolic_point_2& p3) { Circle_2 c = _gt.construct_circle_2_object()(p1, p2, p3); @@ -443,8 +438,6 @@ class Compute_approximate_hyperbolic_diameter public: Construct_inexact_hyperbolic_circumcenter_2(const Traits& gt = Traits()) : _gt(gt) {} - typedef Hyperbolic_Voronoi_point_2 result_type; - Hyperbolic_Voronoi_point_2 operator()(const Hyperbolic_point_2& p, const Hyperbolic_point_2& q, const Hyperbolic_point_2& r) From e4f30b79fabf7b98a1db31cd875ad73ebc7cbbdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sun, 16 Mar 2025 14:25:48 +0100 Subject: [PATCH 55/68] Fix & clean SDG_2 --- .../include/CGAL/Segment_Delaunay_graph_2.h | 4 - .../Are_parallel_C2.h | 6 +- .../Are_same_points_C2.h | 5 +- .../Are_same_segments_C2.h | 5 +- .../Arrangement_type_C2.h | 35 +++--- .../Arrangement_type_non_intersecting_C2.h | 10 +- .../Segment_Delaunay_graph_2/Compare_x_2.h | 7 +- .../Segment_Delaunay_graph_2/Compare_y_2.h | 7 +- .../Construct_storage_site_2.h | 108 +++++++++--------- .../Construct_storage_site_with_info_2.h | 16 ++- .../Constructions_C2.h | 25 ++-- .../Finite_edge_interior_conflict_C2.h | 7 +- .../Infinite_edge_interior_conflict_C2.h | 7 +- .../Is_degenerate_edge_C2.h | 7 +- .../Segment_Delaunay_graph_2/Orientation_C2.h | 3 - .../Oriented_side_C2.h | 2 - .../Oriented_side_of_bisector_C2.h | 4 - .../Segment_Delaunay_graph_2_impl.h | 2 - .../Vertex_conflict_C2.h | 4 - .../include/Multi_info.h | 2 - 20 files changed, 107 insertions(+), 159 deletions(-) diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2.h index 05a199a5bff..bf7f90187c8 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2.h @@ -96,9 +96,7 @@ namespace Internal { template < class Node > struct Project_site_2 { - typedef Node argument_type; typedef typename Node::Site_2 Site; - typedef Site result_type; Site operator()(const Node& x) const { return x.site(); @@ -108,9 +106,7 @@ namespace Internal { template < class Node, class Site_t > struct Project_input_to_site_2 { - typedef Node argument_type; typedef Site_t Site; - typedef Site result_type; Site operator()(const Node& x) const { if ( boost::tuples::get<2>(x) /*x.third*/ ) { // it is a point diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Are_parallel_C2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Are_parallel_C2.h index a0a1e4f9bfd..19f5ddb5fbc 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Are_parallel_C2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Are_parallel_C2.h @@ -34,15 +34,13 @@ class Are_parallel_C2 public: typedef typename K::Site_2 Site_2; typedef typename K::Boolean Boolean; - typedef Boolean result_type; - typedef Site_2 argument_type; private: typedef typename K::Segment_2 Segment_2; typedef typename K::FT FT; private: - Boolean predicate(const Site_2& p, const Site_2& q) const { + Boolean predicate(const Site_2& p, const Site_2& q) const { CGAL_precondition( p.is_segment() && q.is_segment() ); Segment_2 s1 = p.segment(); @@ -64,7 +62,7 @@ private: } public: - result_type operator()(const Site_2& p, const Site_2& q) const + Boolean operator()(const Site_2& p, const Site_2& q) const { return predicate(p, q); } diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Are_same_points_C2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Are_same_points_C2.h index a60b7551604..a3187245161 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Are_same_points_C2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Are_same_points_C2.h @@ -75,10 +75,7 @@ private: } public: - typedef Boolean result_type; - typedef Site_2 argument_type; - - Boolean operator()(const Site_2& p, const Site_2& q) const + Boolean operator()(const Site_2& p, const Site_2& q) const { CGAL_precondition( p.is_point() && q.is_point() ); diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Are_same_segments_C2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Are_same_segments_C2.h index 35ce0565ef9..33b97d4dfe8 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Are_same_segments_C2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Are_same_segments_C2.h @@ -34,10 +34,9 @@ private: public: typedef typename K::Site_2 Site_2; - typedef bool result_type; - typedef Site_2 argument_type; + typedef typename K::Boolean Boolean; - bool operator()(const Site_2& p, const Site_2& q) const + Boolean operator()(const Site_2& p, const Site_2& q) const { CGAL_precondition( p.is_segment() && q.is_segment() ); diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Arrangement_type_C2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Arrangement_type_C2.h index 409200b379c..f5bd1d55dc0 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Arrangement_type_C2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Arrangement_type_C2.h @@ -70,13 +70,13 @@ private: Are_same_points_2 same_points; public: - typedef typename Enum::Arrangement_type result_type; + typedef typename Enum::Arrangement_type Arrangement_type; private: - result_type compute_type_C2(const RT& x1, const RT& y1, - const RT& x2, const RT& y2, - const RT& x3, const RT& y3, - const RT& x4, const RT& y4) const + Arrangement_type compute_type_C2(const RT& x1, const RT& y1, + const RT& x2, const RT& y2, + const RT& x3, const RT& y3, + const RT& x4, const RT& y4) const { RT delta = -determinant(x2 - x1, x4 - x3, y2 - y1, y4 - y3); @@ -88,7 +88,7 @@ private: } } - result_type + Arrangement_type non_parallel_C2(const RT& x1, const RT& y1, const RT& x2, const RT& y2, const RT& x3, const RT& y3, const RT& x4, const RT& y4, const RT& D) const @@ -159,7 +159,7 @@ private: } - result_type + Arrangement_type parallel_C2(const RT& x1, const RT& y1, const RT& x2, const RT& y2, const RT& x3, const RT& y3, const RT& x4, const RT& y4) const { @@ -326,7 +326,7 @@ private: //------------------------------------------------------------------------ - result_type + Arrangement_type arrangement_type_same_point(const Site_2& p, const Site_2& q, unsigned int ip, unsigned int iq) const { @@ -368,7 +368,7 @@ private: } } - result_type + Arrangement_type arrangement_type_ss(const Site_2& p, const Site_2& q) const { bool same_p1q1 = same_points(p.source_site(), q.source_site()); @@ -393,17 +393,17 @@ private: Segment_2 s1 = p.segment(); Segment_2 s2 = q.segment(); - result_type res = compute_type_C2( s1.source().x(), s1.source().y(), - s1.target().x(), s1.target().y(), - s2.source().x(), s2.source().y(), - s2.target().x(), s2.target().y() ); + Arrangement_type res = compute_type_C2(s1.source().x(), s1.source().y(), + s1.target().x(), s1.target().y(), + s2.source().x(), s2.source().y(), + s2.target().x(), s2.target().y() ); return res; } //-------------------------------------------------------------------- - result_type + Arrangement_type arrangement_type_ps(const Site_2& p, const Site_2& q) const { if ( same_points(p, q.source_site()) ) { @@ -419,7 +419,7 @@ private: //-------------------------------------------------------------------- - result_type + Arrangement_type arrangement_type_pp(const Site_2& p, const Site_2& q) const { if ( same_points(p, q) ) { @@ -432,10 +432,7 @@ private: //-------------------------------------------------------------------- public: - typedef Site_2 argument_type; - - - result_type + Arrangement_type operator()(const Site_2& p, const Site_2& q) const { CGAL_precondition( p.is_defined() && q.is_defined() ); diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Arrangement_type_non_intersecting_C2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Arrangement_type_non_intersecting_C2.h index b235fb7b01a..3b74da58079 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Arrangement_type_non_intersecting_C2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Arrangement_type_non_intersecting_C2.h @@ -65,13 +65,13 @@ private: Are_same_points_2 same_points; public: - typedef typename Enum::Arrangement_type result_type; + typedef typename Enum::Arrangement_type Arrangement_type; private: //-------------------------------------------------------------------- - result_type + Arrangement_type arrangement_type_ss(const Site_2& p, const Site_2& q) const { bool same_p1q1 = same_points(p.source_site(), q.source_site()); @@ -98,7 +98,7 @@ private: //-------------------------------------------------------------------- - result_type + Arrangement_type arrangement_type_ps(const Site_2& p, const Site_2& q) const { if ( same_points(p, q.source_site()) ) { @@ -112,7 +112,7 @@ private: //-------------------------------------------------------------------- - result_type + Arrangement_type arrangement_type_pp(const Site_2& p, const Site_2& q) const { if ( same_points(p, q) ) { @@ -128,7 +128,7 @@ public: typedef Site_2 argument_type; - result_type + Arrangement_type operator()(const Site_2& p, const Site_2& q) const { CGAL_precondition( p.is_defined() && q.is_defined() ); diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Compare_x_2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Compare_x_2.h index 75e5df58c14..08cb071fea6 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Compare_x_2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Compare_x_2.h @@ -33,8 +33,7 @@ class Compare_x_2 public: typedef typename K::Site_2 Site_2; typedef typename K::Point_2 Point_2; - - typedef typename K::Comparison_result result_type; + typedef typename K::Comparison_result Comparison_result; private: typedef typename K::Compare_x_2 Kernel_compare_x_2; @@ -42,13 +41,13 @@ private: public: inline - result_type operator()(const Point_2& p, const Point_2& q) const + Comparison_result operator()(const Point_2& p, const Point_2& q) const { return Kernel_compare_x_2()( p, q ); } inline - result_type operator()(const Site_2& p, const Site_2& q) const + Comparison_result operator()(const Site_2& p, const Site_2& q) const { CGAL_precondition( p.is_point() && q.is_point() ); return Kernel_compare_x_2()( p.point(), q.point() ); diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Compare_y_2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Compare_y_2.h index e2b686b9819..83eb5e50afd 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Compare_y_2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Compare_y_2.h @@ -34,21 +34,20 @@ class Compare_y_2 public: typedef typename K::Site_2 Site_2; typedef typename K::Point_2 Point_2; - typedef typename K::Comparison_result result_type; + typedef typename K::Comparison_result Comparison_result; private: typedef typename K::Compare_y_2 Kernel_compare_y_2; public: - inline - result_type operator()(const Point_2& p, const Point_2& q) const + Comparison_result operator()(const Point_2& p, const Point_2& q) const { return Kernel_compare_y_2()( p, q ); } inline - result_type operator()(const Site_2& p, const Site_2& q) const + Comparison_result operator()(const Site_2& p, const Site_2& q) const { CGAL_precondition( p.is_point() && q.is_point() ); return Kernel_compare_y_2()( p.point(), q.point() ); diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Construct_storage_site_2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Construct_storage_site_2.h index ed7fc2b2b04..2f90b35379b 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Construct_storage_site_2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Construct_storage_site_2.h @@ -32,111 +32,109 @@ public: typedef typename Storage_traits::Point_handle Point_handle; typedef typename Storage_traits::Geom_traits Geom_traits; - typedef Storage_site_2 result_type; - protected: typedef typename Geom_traits::Intersections_tag ITag; - result_type construct(const Point_handle& h1, - const Point_handle& h2, - const Point_handle& h3, - const Point_handle& h4, const Tag_true&) const { + Storage_site_2 construct(const Point_handle& h1, + const Point_handle& h2, + const Point_handle& h3, + const Point_handle& h4, const Tag_true&) const { return Storage_site_2::construct_storage_site_2(h1, h2, h3, h4); } inline - result_type construct(const Point_handle& h1, - const Point_handle& h2, - const Point_handle& h3, - const Point_handle& h4, - const Point_handle& h5, - const Point_handle& h6, const Tag_true&) const { + Storage_site_2 construct(const Point_handle& h1, + const Point_handle& h2, + const Point_handle& h3, + const Point_handle& h4, + const Point_handle& h5, + const Point_handle& h6, const Tag_true&) const { return Storage_site_2::construct_storage_site_2(h1, h2, h3, h4, h5, h6); } inline - result_type construct(const Point_handle& h1, - const Point_handle& h2, - const Point_handle& h3, - const Point_handle& h4, - bool is_first_exact, const Tag_true&) const { + Storage_site_2 construct(const Point_handle& h1, + const Point_handle& h2, + const Point_handle& h3, + const Point_handle& h4, + bool is_first_exact, const Tag_true&) const { return Storage_site_2::construct_storage_site_2(h1, h2, h3, h4, is_first_exact); } - result_type construct(const Point_handle&, - const Point_handle&, - const Point_handle&, - const Point_handle&, const Tag_false&) const { + Storage_site_2 construct(const Point_handle&, + const Point_handle&, + const Point_handle&, + const Point_handle&, const Tag_false&) const { CGAL_error(); return Storage_site_2(); } inline - result_type construct(const Point_handle&, - const Point_handle&, - const Point_handle&, - const Point_handle&, - const Point_handle&, - const Point_handle&, const Tag_false&) const { + Storage_site_2 construct(const Point_handle&, + const Point_handle&, + const Point_handle&, + const Point_handle&, + const Point_handle&, + const Point_handle&, const Tag_false&) const { CGAL_error(); return Storage_site_2(); } inline - result_type construct(const Point_handle&, - const Point_handle&, - const Point_handle&, - const Point_handle&, - bool /* is_first_exact */, const Tag_false&) const { + Storage_site_2 construct(const Point_handle&, + const Point_handle&, + const Point_handle&, + const Point_handle&, + bool /* is_first_exact */, const Tag_false&) const { CGAL_error(); return Storage_site_2(); } public: inline - result_type operator()(const Point_handle& h) const { + Storage_site_2 operator()(const Point_handle& h) const { return Storage_site_2::construct_storage_site_2(h); } inline - result_type operator()(const Point_handle& h1, - const Point_handle& h2) const { + Storage_site_2 operator()(const Point_handle& h1, + const Point_handle& h2) const { return Storage_site_2::construct_storage_site_2(h1, h2); } inline - result_type operator()(const Point_handle& h1, - const Point_handle& h2, - const Point_handle& h3, - const Point_handle& h4) const { + Storage_site_2 operator()(const Point_handle& h1, + const Point_handle& h2, + const Point_handle& h3, + const Point_handle& h4) const { return construct(h1, h2, h3, h4, ITag()); } inline - result_type operator()(const Point_handle& h1, - const Point_handle& h2, - const Point_handle& h3, - const Point_handle& h4, - const Point_handle& h5, - const Point_handle& h6) const { + Storage_site_2 operator()(const Point_handle& h1, + const Point_handle& h2, + const Point_handle& h3, + const Point_handle& h4, + const Point_handle& h5, + const Point_handle& h6) const { return construct(h1, h2, h3, h4, h5, h6, ITag()); } inline - result_type operator()(const Point_handle& h1, - const Point_handle& h2, - const Point_handle& h3, - const Point_handle& h4, - bool is_first_exact) const { + Storage_site_2 operator()(const Point_handle& h1, + const Point_handle& h2, + const Point_handle& h3, + const Point_handle& h4, + bool is_first_exact) const { return construct(h1, h2, h3, h4, is_first_exact, ITag()); } // constructs the point of intersection inline - result_type operator()(const Storage_site_2& ss0, - const Storage_site_2& ss1) const { + Storage_site_2 operator()(const Storage_site_2& ss0, + const Storage_site_2& ss1) const { CGAL_precondition( ss0.is_segment() && ss1.is_segment() ); return Storage_site_2::construct_storage_site_2 ( ss0.source_of_supporting_site(), @@ -329,9 +327,9 @@ public: // endpoints the point of intersection of ss1 and ss0; the boolean // determines if the first or segment subsegment is constructed inline - result_type operator()(const Storage_site_2& ss0, - const Storage_site_2& ss1, - bool first) const { + Storage_site_2 operator()(const Storage_site_2& ss0, + const Storage_site_2& ss1, + bool first) const { // CGAL_precondition( ss0.is_segment() && ss1.is_segment() ); CGAL_precondition( ss0.is_segment() ); if ( ss1.is_point() ) { diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Construct_storage_site_with_info_2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Construct_storage_site_with_info_2.h index 1171067633b..cca67b237af 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Construct_storage_site_with_info_2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Construct_storage_site_with_info_2.h @@ -33,8 +33,6 @@ public: typedef typename Storage_traits::Storage_site_2 Storage_site_2; typedef typename Storage_traits::Point_handle Point_handle; - typedef Storage_site_2 result_type; - protected: typedef Construct_storage_site_2 Base; typedef typename Storage_traits::Info Info; @@ -42,10 +40,12 @@ protected: typedef typename Storage_traits::Merge_info Merge_info; public: + using Base::operator(); + // constructs the point of intersection inline - result_type operator()(const Storage_site_2& ss0, - const Storage_site_2& ss1) const { + Storage_site_2 operator()(const Storage_site_2& ss0, + const Storage_site_2& ss1) const { Storage_site_2 ssx = Base::operator()(ss0, ss1); Info infox = Merge_info()(ss0.info(), ss1.info()); ssx.set_info(infox); @@ -56,16 +56,14 @@ public: // endpoints the point of intersection of ss1 and ss0; the boolean // determines if the first or segment subsegment is constructed inline - result_type operator()(const Storage_site_2& ss0, - const Storage_site_2& ss1, - bool first) const { + Storage_site_2 operator()(const Storage_site_2& ss0, + const Storage_site_2& ss1, + bool first) const { Storage_site_2 s = Base::operator()(ss0, ss1, first); Info is = Convert_info()(ss0.info(), ss1.info(), first); s.set_info(is); return s; } - - using Base::operator(); }; diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Constructions_C2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Constructions_C2.h index e4a88c83bdd..58794333774 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Constructions_C2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Constructions_C2.h @@ -48,29 +48,28 @@ class Construct_sdg_site_2 public: typedef Site Site_2; typedef typename Site_2::Point_2 Point_2; - typedef Site_2 result_type; public: - result_type operator()(const Point_2& p) const { + Site_2 operator()(const Point_2& p) const { return Site_2(p); } - result_type operator()(const Point_2& p0, const Point_2& p1) const { + Site_2 operator()(const Point_2& p0, const Point_2& p1) const { return Site_2(p0, p1); } - result_type operator()(const Point_2& p0, const Point_2& p1, + Site_2 operator()(const Point_2& p0, const Point_2& p1, const Point_2& q0, const Point_2& q1) const { return Site_2(p0, p1, q0, q1); } - result_type operator()(const Point_2& p0, const Point_2& p1, + Site_2 operator()(const Point_2& p0, const Point_2& p1, const Point_2& q0, const Point_2& q1, bool b) const { return Site_2(p0, p1, q0, q1, b); } - result_type operator()(const Point_2& p0, const Point_2& p1, + Site_2 operator()(const Point_2& p0, const Point_2& p1, const Point_2& q0, const Point_2& q1, const Point_2& r0, const Point_2& r1) const { return Site_2(p0, p1, q0, q1, r0, r1); @@ -84,14 +83,13 @@ class Construct_sdg_site_2 public: typedef Site Site_2; typedef typename Site_2::Point_2 Point_2; - typedef Site_2 result_type; public: - result_type operator()(const Point_2& p) const { + Site_2 operator()(const Point_2& p) const { return Site_2(p); } - result_type operator()(const Point_2& p0, const Point_2& p1) const { + Site_2 operator()(const Point_2& p0, const Point_2& p1) const { return Site_2(p0, p1); } }; @@ -110,7 +108,6 @@ public: typedef typename K::Site_2 Site_2; typedef Voronoi_vertex_C2 Voronoi_vertex_2; typedef typename K::Point_2 Point_2; - typedef Point_2 result_type; public: Point_2 operator()(const Site_2& s1, const Site_2& s2, @@ -134,7 +131,6 @@ public: typedef typename Gt::Site_2 Site_2; typedef Voronoi_vertex_C2 Voronoi_vertex_2; typedef typename Gt::Circle_2 Circle_2; - typedef Circle_2 result_type; public: Circle_2 operator() (const Site_2& s1, const Site_2& s2, @@ -159,7 +155,6 @@ public: typedef typename Gt::Site_2 Site_2; typedef typename Gt::Point_2 Point_2; typedef typename Gt::Line_2 Line_2; - typedef Line_2 result_type; private: static @@ -217,7 +212,6 @@ public: typedef typename Gt::Ray_2 Ray_2; typedef typename Gt::Construct_svd_vertex_2 Construct_svd_vertex_2; typedef typename Gt::Equal_2 Equal_2; - typedef Ray_2 result_type; Ray_2 operator()(const Site_2& p, const Site_2& q, const Site_2& r) const @@ -268,10 +262,9 @@ public: typedef typename Gt::Equal_2 Equal_2; typedef CGAL::Object Object_2; - typedef Object_2 result_type; - result_type operator()(const Site_2& p, const Site_2& q, - const Site_2& r, const Site_2& s) const + Object_2 operator()(const Site_2& p, const Site_2& q, + const Site_2& r, const Site_2& s) const { Construct_svd_vertex_2 circumcenter; Point_2 vpqr = circumcenter(p, q, r); diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Finite_edge_interior_conflict_C2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Finite_edge_interior_conflict_C2.h index 3a11600e232..26486b216cf 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Finite_edge_interior_conflict_C2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Finite_edge_interior_conflict_C2.h @@ -662,11 +662,8 @@ private: //------------------------------------------------------------------------ public: - typedef Boolean result_type; - typedef Site_2 argument_type; - - Boolean operator()(const Site_2& p, const Site_2& q, const Site_2& r, - const Site_2& s, const Site_2& t, Sign sgn) const + Boolean operator()(const Site_2& p, const Site_2& q, const Site_2& r, + const Site_2& s, const Site_2& t, Sign sgn) const { if ( sgn == POSITIVE ) { return is_interior_in_conflict_none(p, q, r, s, t, Method_tag()); diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Infinite_edge_interior_conflict_C2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Infinite_edge_interior_conflict_C2.h index a70381e27b7..f81915a9742 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Infinite_edge_interior_conflict_C2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Infinite_edge_interior_conflict_C2.h @@ -37,16 +37,13 @@ public: typedef Are_same_points_C2 Are_same_points_2; typedef Are_same_segments_C2 Are_same_segments_2; - typedef Boolean result_type; - struct argument_type {}; - private: Are_same_points_2 same_points; Are_same_segments_2 same_segments; public: - Boolean operator()(const Site_2& q, const Site_2& s, const Site_2& r, - const Site_2& t, Sign sgn) const + Boolean operator()(const Site_2& q, const Site_2& s, const Site_2& r, + const Site_2& t, Sign sgn) const { if ( t.is_segment() ) { return false; diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Is_degenerate_edge_C2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Is_degenerate_edge_C2.h index 441b94f01ff..d6509777a2f 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Is_degenerate_edge_C2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Is_degenerate_edge_C2.h @@ -46,11 +46,8 @@ private: } public: - typedef Boolean result_type; - typedef Site_2 argument_type; - - Boolean operator()(const Site_2& p, const Site_2& q, - const Site_2& r, const Site_2& s) const + Boolean operator()(const Site_2& p, const Site_2& q, + const Site_2& r, const Site_2& s) const { Voronoi_vertex_2 vpqr(p, q, r); if ( vpqr.incircle_no_easy(s) == POSITIVE ) { return false; } diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Orientation_C2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Orientation_C2.h index c3c4581229b..80477b4b0bc 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Orientation_C2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Orientation_C2.h @@ -163,9 +163,6 @@ private: } public: - typedef Orientation result_type; - typedef Site_2 argument_type; - Orientation operator()(const Site_2& p, const Site_2& q, const Site_2& r) const { diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_C2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_C2.h index e867c86453b..a26a7aabeca 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_C2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_C2.h @@ -52,8 +52,6 @@ private: public: typedef typename Base::Oriented_side Oriented_side; - typedef Oriented_side result_type; - typedef Site_2 argument_type; // computes the oriented side of the Voronoi vertex of s1, s2, inf // wrt the line that passes through the point p and its direction diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_of_bisector_C2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_of_bisector_C2.h index f070318e694..b56b1e23e1c 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_of_bisector_C2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Oriented_side_of_bisector_C2.h @@ -301,10 +301,6 @@ private: } public: - typedef Oriented_side result_type; - typedef Site_2 argument_type; - - Oriented_side operator()(const Site_2& t1, const Site_2& t2, const Site_2& q) const { diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h index d09313c5d6b..52fb6603ff2 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Segment_Delaunay_graph_2_impl.h @@ -2545,8 +2545,6 @@ Segment_Delaunay_graph_2:: arrangement_type(const Site_2& p, const Site_2& q) const { typedef typename Geom_traits::Arrangement_type_2 AT2; - typedef typename AT2::result_type Arrangement_type; - Arrangement_type res = geom_traits().arrangement_type_2_object()(p, q); // The values that have to be treated are the following: diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Vertex_conflict_C2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Vertex_conflict_C2.h index 5b6b43ad161..3d4d266a808 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Vertex_conflict_C2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Vertex_conflict_C2.h @@ -443,10 +443,6 @@ private: public: - typedef Site_2 argument_type; - typedef Sign result_type; - - Sign operator()(const Site_2& p, const Site_2& q, const Site_2& r, const Site_2& t) const { diff --git a/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/include/Multi_info.h b/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/include/Multi_info.h index 5c9945e6b70..cf266555c6c 100644 --- a/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/include/Multi_info.h +++ b/Segment_Delaunay_graph_2/test/Segment_Delaunay_graph_2/include/Multi_info.h @@ -68,7 +68,6 @@ template struct Multi_info_convert_info { typedef Info_t Info; - typedef Multi_info result_type; inline Multi_info operator()(const Multi_info& minfo0, bool) const @@ -88,7 +87,6 @@ template struct Multi_info_merge_info { typedef Info_t Info; - typedef Multi_info result_type; inline Multi_info operator()(const Multi_info& minfo0, From 42c7a3627d12182352b6e1ea0711dbdaf921b725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sun, 16 Mar 2025 21:37:37 +0100 Subject: [PATCH 56/68] Modernize Filtered_construction --- .../include/CGAL/Filtered_construction.h | 53 ++++++++----------- .../Straight_skeleton_builder_traits_2_aux.h | 16 +++--- 2 files changed, 29 insertions(+), 40 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Filtered_construction.h b/Filtered_kernel/include/CGAL/Filtered_construction.h index 51910605980..7bdfc916a34 100644 --- a/Filtered_kernel/include/CGAL/Filtered_construction.h +++ b/Filtered_kernel/include/CGAL/Filtered_construction.h @@ -16,6 +16,8 @@ #include #include +#include + namespace CGAL { template - result_type - operator()(const A1 &a1) const + auto operator()(const A1 &a1) const + -> typename std::invoke_result::type { { - // Protection is outside the try block as VC8 has the CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG Protect_FPU_rounding P1; try { - return From_Filtered( Filter_construction(To_Filtered(a1)) ); + return From_Filtered(Filter_construction(To_Filtered(a1))); } catch (Uncertain_conversion_exception&) {} } Protect_FPU_rounding P(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - return From_Exact( Exact_construction(To_Exact(a1)) ); + return From_Exact(Exact_construction(To_Exact(a1))); } + template - result_type - operator()(const A1 &a1, const A2 &a2) const + auto operator()(const A1 &a1, const A2 &a2) const + -> typename std::invoke_result::type { { Protect_FPU_rounding P1; try { - return From_Filtered( Filter_construction(To_Filtered(a1), - To_Filtered(a2)) ); + return From_Filtered(Filter_construction(To_Filtered(a1), + To_Filtered(a2))); } catch (Uncertain_conversion_exception&) {} } Protect_FPU_rounding P(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - return From_Exact( Exact_construction(To_Exact(a1), - To_Exact(a2)) ); + return From_Exact(Exact_construction(To_Exact(a1), + To_Exact(a2))); } template - result_type - operator()(const A1 &a1, const A2 &a2, const A3 &a3) const + auto operator()(const A1 &a1, const A2 &a2, const A3 &a3) const + -> typename std::invoke_result::type { { Protect_FPU_rounding P1; try { - return From_Filtered( Filter_construction(To_Filtered(a1), - To_Filtered(a2), - To_Filtered(a3)) ); + return From_Filtered(Filter_construction(To_Filtered(a1), + To_Filtered(a2), + To_Filtered(a3))); } catch (Uncertain_conversion_exception&) {} } Protect_FPU_rounding P(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - return From_Exact( Exact_construction(To_Exact(a1), - To_Exact(a2), - To_Exact(a3)) ); + return From_Exact(Exact_construction(To_Exact(a1), + To_Exact(a2), + To_Exact(a3))); } - }; - - -} //namespace CGAL - +} // namespace CGAL #endif // CGAL_FILTERED_CONSTRUCTION_H diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h index 93048c58c45..d7204199842 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h @@ -101,9 +101,6 @@ private: E2C From_Exact; F2C From_Filtered; - typedef typename AC::result_type AC_result_type; - typedef typename FC::result_type FC_result_type; - typedef typename EC::result_type EC_result_type; typedef typename C2F::Target_kernel FK; bool has_enough_precision(const typename FK::Point_2& point, double precision) const @@ -140,22 +137,21 @@ public: , Filter_construction(Filter_construction) {} - typedef AC_result_type result_type; - template - result_type - operator()(A&& ... a) const + auto operator()(A&& ... a) const + -> typename std::invoke_result::type { { Protect_FPU_rounding P; try { + using FC_result_type = typename std::invoke_result(a)))...>::type; FC_result_type fr = Filter_construction(To_Filtered(std::forward(a))...); const double precision = Lazy_exact_nt::get_relative_precision_of_to_double(); - if ( fr && has_enough_precision(*fr, precision) ) + if (fr && has_enough_precision(*fr, precision)) return From_Filtered(fr); } catch (Uncertain_conversion_exception&) {} @@ -163,7 +159,9 @@ public: Protect_FPU_rounding P(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - EC_result_type er = Exact_construction(To_Exact(std::forward(a))...) ; + + using EC_result_type = typename std::invoke_result(a)))...>::type; + EC_result_type er = Exact_construction(To_Exact(std::forward(a))...); return From_Exact(er); } }; From 1ae7960a438d8393c7d3491a728425af606fb323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sun, 16 Mar 2025 21:45:23 +0100 Subject: [PATCH 57/68] Simplify and enhance Type_mapper There is also a stronger need because now we really need to map types whereas before it could rely on result_type's to avoid some tricky cases like CGAL::Sphere_point --- Kernel_23/include/CGAL/Kernel/Type_mapper.h | 83 +++++++-------------- 1 file changed, 27 insertions(+), 56 deletions(-) diff --git a/Kernel_23/include/CGAL/Kernel/Type_mapper.h b/Kernel_23/include/CGAL/Kernel/Type_mapper.h index bdb2785889e..377447a4ddb 100644 --- a/Kernel_23/include/CGAL/Kernel/Type_mapper.h +++ b/Kernel_23/include/CGAL/Kernel/Type_mapper.h @@ -19,62 +19,25 @@ #include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - namespace CGAL { +template < typename T, typename K1, typename K2 > +struct Type_mapper; + namespace internal { -// the default implementation is required to catch the odd one-out -// object like Bbox -template +template < typename T, typename K1, typename K2, typename = void > struct Type_mapper_impl { typedef T type; }; -template < typename T, typename K1, typename K2 > -struct Type_mapper_impl, K1, K2 > { - typedef std::vector< typename Type_mapper_impl::type > type; +template < typename K1, typename K2> +struct Type_mapper_impl { + typedef K2 type; }; -template < typename T, typename K1, typename K2 > -struct Type_mapper_impl, K1, K2 > { - typedef std::optional< typename Type_mapper_impl::type > type; -}; - - -/// The following code is equivalent to the one commented in CODE_TAG -/// except that with this one, the variant is really variant and not -/// a internal obfuscated type -#define CGAL_TYPEMAP_TYPEDEFS(z, n, t) typedef typename Type_mapper_impl< t##n, K1, K2 >::type A##n; - -#define CGAL_VARIANT_TYPEMAP(z, n, d) \ -template< typename K1, typename K2, BOOST_PP_ENUM_PARAMS(n, class T) > \ -struct Type_mapper_impl, K1, K2> { \ - BOOST_PP_REPEAT(n, CGAL_TYPEMAP_TYPEDEFS, T) \ - typedef std::variant type; \ -}; - -BOOST_PP_REPEAT_FROM_TO(1, 10, CGAL_VARIANT_TYPEMAP, _) - -#undef CGAL_TYPEMAP_TYPEDEFS -#undef CGAL_VARIANT_TYPEMAP - -// Then we specialize for all kernel objects. -// More details on why it is like that are here: https://github.com/CGAL/cgal/pull/4878#discussion_r459986501 +// 'Rep' gets a weird partial specialization because of Return_base_tag shenanigans. +// See https://github.com/CGAL/cgal/issues/3035#issuecomment-428721414 #define CGAL_Kernel_obj(X) \ template < typename K1, typename K2 > \ struct Type_mapper_impl < typename K1::X, K1, K2 > \ @@ -89,20 +52,28 @@ template < typename K1, typename K2 > struct Type_mapper_impl < typename K1::FT, K1, K2 > { typedef typename K2::FT type; }; +// This matches about anything and recursively calls Type_mapper on the template parameters +// until reaching the other cases (kernel objects, K1, FT) +template