From 7c92341be777d7c295d3fa8010c34dc8b35eab16 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 2 Sep 2022 11:31:47 +0200 Subject: [PATCH 01/39] Introduce CGAL_Kernel_pred_RT_or_FT This commit introduces a new kind of predicate in ``. In addition to - `CGAL_kernel_pred` for predicates, - `CGAL_Kernel_pred_RT` for predicates that can be implemented using a ring-type, now there is also: - `CGAL_Kernel_pred_RT_or_FT` for predicates with multiple overloads of `operator()`, some needing a field type and other needing a ring type (without the division operator). The C++ code can discriminate between the two cases with a special wrapper for the return type: `CGAL::Needs_FT`. In ``, in addition to the usual class template `Filtered_predicate`, there is now also `Filtered_predicate_RT_FT` that takes three predicates as template parameters instead of two: - the exact predicate with an ring-type, - the exact predicate with a field-type, - the approximate predicate (with `Interval_nt` as number-type). For the moment, only `Compare_distance_3` in `` is using the new `Filtered_predicate_RT_FT`. Before this commit, the file `Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h` was testing `Compare_distance_3` only with three points or for points. This commit adds: - a test with `Point_3, Point_3, Segment_3`, and - a test with `Line_3, Point_3, Point_3`, that actually needs a field type with its current implementation. In the test `Kernel_23/test/Kernel_23/Filtered_cartesian.cpp`, the macro `CGAL_NO_MPZF_DIVISION_OPERATOR` is defined, to remove the division operator from `CGAL::Mpzf`. `CGAL::Mpzf` is a ring-type, even with its `operator/` (because that `operator/` can only compute exact divisions), but with `CGAL_NO_MPZF_DIVISION_OPERATOR` defined, that is now checked by the compiler. --- .../include/CGAL/Cartesian/function_objects.h | 5 +- .../include/CGAL/Filtered_kernel.h | 9 ++++ .../include/CGAL/Filtered_predicate.h | 51 +++++++++++++++++++ .../modules/CGAL_SetupCGALDependencies.cmake | 2 +- .../include/CGAL/Kernel/interface_macros.h | 12 ++++- .../test/Kernel_23/Filtered_cartesian.cpp | 4 ++ .../test/Kernel_23/include/CGAL/_test_new_3.h | 13 +++++ STL_Extension/include/CGAL/tags.h | 17 +++++++ 8 files changed, 108 insertions(+), 5 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index a93004ad293..207aedd7053 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -17,6 +17,7 @@ #ifndef CGAL_CARTESIAN_FUNCTION_OBJECTS_H #define CGAL_CARTESIAN_FUNCTION_OBJECTS_H +#include #include #include #include @@ -591,14 +592,14 @@ namespace CartesianKernelFunctors { } template - result_type + 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 - result_type + 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)); diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel.h b/Filtered_kernel/include/CGAL/Filtered_kernel.h index 7e7c21ef79f..372295066cf 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel.h @@ -89,6 +89,15 @@ struct Filtered_kernel_base typedef Filtered_predicate P; \ P Pf() const { return P(); } +#define CGAL_Kernel_pred_RT_or_FT(P, Pf) \ + typedef Filtered_predicate_RT_FT P; \ + P Pf() const { return P(); } + // We don't touch the constructions. #define CGAL_Kernel_cons(Y,Z) diff --git a/Filtered_kernel/include/CGAL/Filtered_predicate.h b/Filtered_kernel/include/CGAL/Filtered_predicate.h index 2adad47f329..d0035916e8b 100644 --- a/Filtered_kernel/include/CGAL/Filtered_predicate.h +++ b/Filtered_kernel/include/CGAL/Filtered_predicate.h @@ -19,6 +19,8 @@ #include #include +#include + namespace CGAL { // This template class is a wrapper that implements the filtering for any @@ -111,6 +113,55 @@ Filtered_predicate:: return ep(c2e(args)...); } +template +class Filtered_predicate_RT_FT +{ + C2E_RT c2e_rt; + C2E_FT c2e_ft; + C2A c2a; + EP_RT ep_rt; + EP_FT ep_ft; + AP ap; + + using Ares = typename Remove_needs_FT::Type; + +public: + using result_type = typename Remove_needs_FT::Type; + + template + bool needs_ft(const Args&... args) const { + using Actual_approx_res = std::remove_cv_t>; + return std::is_same_v>; + } + + template + result_type + operator()(const Args&... args) 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 + { + Ares res = ap(c2a(args)...); + if (is_certain(res)) + return 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); + using Actual_approx_res = std::remove_cv_t>; + if constexpr (std::is_same_v>) + return ep_ft(c2e_ft(args)...); + else + return ep_rt(c2e_rt(args)...); + } +}; + + } //namespace CGAL #endif // CGAL_FILTERED_PREDICATE_H diff --git a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake index 790b13331b1..03dd6682c70 100644 --- a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake @@ -99,7 +99,7 @@ function(CGAL_setup_CGAL_dependencies target) # CGAL now requires C++14. `decltype(auto)` is used as a marker of # C++14. - target_compile_features(${target} INTERFACE cxx_decltype_auto) + target_compile_features(${target} INTERFACE cxx_std_17) use_CGAL_Boost_support(${target} INTERFACE) diff --git a/Kernel_23/include/CGAL/Kernel/interface_macros.h b/Kernel_23/include/CGAL/Kernel/interface_macros.h index d0ba827fa37..04b9639a91b 100644 --- a/Kernel_23/include/CGAL/Kernel/interface_macros.h +++ b/Kernel_23/include/CGAL/Kernel/interface_macros.h @@ -32,6 +32,13 @@ # define CGAL_Kernel_pred_RT(X, Y) CGAL_Kernel_pred(X, Y) #endif +// Those predicates for which Simple_cartesian maybe use division of not. +// Predicates using division must have Needs_FT as actual return +// type. +#ifndef CGAL_Kernel_pred_RT_or_FT +# define CGAL_Kernel_pred_RT_or_FT(X, Y) CGAL_Kernel_pred(X, Y) +#endif + #ifndef CGAL_Kernel_cons # define CGAL_Kernel_cons(X, Y) #endif @@ -110,8 +117,8 @@ CGAL_Kernel_pred(Compare_dihedral_angle_3, compare_dihedral_angle_3_object) CGAL_Kernel_pred(Compare_distance_2, compare_distance_2_object) -CGAL_Kernel_pred(Compare_distance_3, - compare_distance_3_object) +CGAL_Kernel_pred_RT_or_FT(Compare_distance_3, + compare_distance_3_object) CGAL_Kernel_pred_RT(Compare_power_distance_2, compare_power_distance_2_object) CGAL_Kernel_pred_RT(Compare_power_distance_3, @@ -609,6 +616,7 @@ CGAL_Kernel_pred_RT(Side_of_oriented_circle_2, CGAL_Kernel_pred_RT(Side_of_oriented_sphere_3, side_of_oriented_sphere_3_object) +#undef CGAL_Kernel_pred_RT_or_FT #undef CGAL_Kernel_pred_RT #undef CGAL_Kernel_pred #undef CGAL_Kernel_cons diff --git a/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp b/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp index d8b24523c15..0434a8f8a3c 100644 --- a/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp +++ b/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp @@ -14,6 +14,10 @@ // // Author(s) : Sylvain Pion +// This defines removes the operator/ from CGAL::Mpzf, to check that functors +// declared with CGAL_Kernel_pred_RT in interface_macros.h really only need +// a RT (ring type), without division. +#define CGAL_NO_MPZF_DIVISION_OPERATOR 1 #include #include diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h index b70b9eea4b6..993b9ce57ca 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h @@ -22,9 +22,12 @@ #include #include #include +#include #include +CGAL_GENERATE_MEMBER_DETECTOR(needs_ft); + using CGAL::internal::use; // Accessory function testing functions that require sqrt(). @@ -605,6 +608,16 @@ test_new_3(const R& rep) Comparison_result tmp34ab = compare_dist(p2,p3,p4); tmp34ab = compare_dist(p2,p3,p2,p3); tmp34ab = compare_dist(p1, p2, p3, p4); + tmp34ab = compare_dist(l2, p1, p1); + tmp34ab = compare_dist(p1, p2, s2); + if constexpr (R::Has_filtered_predicates && + has_needs_ft::value) +{ + assert(compare_dist.needs_ft(l1, p1, p1)); + assert(compare_dist.needs_ft(p2, p3, p2, p3)); + assert(!compare_dist.needs_ft(p1, p2, p3)); + assert(!compare_dist.needs_ft(p2, p2, s2)); + } (void) tmp34ab; typename R::Compare_squared_distance_3 compare_sq_dist diff --git a/STL_Extension/include/CGAL/tags.h b/STL_Extension/include/CGAL/tags.h index c1f9c8ab130..dbacc57b2d3 100644 --- a/STL_Extension/include/CGAL/tags.h +++ b/STL_Extension/include/CGAL/tags.h @@ -81,6 +81,23 @@ Assert_compile_time_tag( const Tag&, const Derived& b) x.match_compile_time_tag(b); } +template +struct Needs_FT { + T value; + Needs_FT(T v) : value(v) {} + operator T() const { return value; } +}; + +template +struct Remove_needs_FT { + using Type = T; +}; + +template +struct Remove_needs_FT> { + using Type = T; +}; + } //namespace CGAL #endif // CGAL_TAGS_H From 2923eff641b41ea6965c7effa6d51139565453dc Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 2 Sep 2022 11:33:07 +0200 Subject: [PATCH 02/39] Fix a warning `-Wnull-pointer-subtraction` https://clang.llvm.org/docs/DiagnosticsReference.html#wnull-pointer-subtraction --- STL_Extension/include/CGAL/Handle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/STL_Extension/include/CGAL/Handle.h b/STL_Extension/include/CGAL/Handle.h index 4fa3a17286b..55634481044 100644 --- a/STL_Extension/include/CGAL/Handle.h +++ b/STL_Extension/include/CGAL/Handle.h @@ -122,7 +122,7 @@ class Handle int refs() const noexcept { return PTR->count.load(std::memory_order_relaxed); } - Id_type id() const noexcept { return PTR - static_cast(0); } + Id_type id() const noexcept { return static_cast(reinterpret_cast(static_cast(PTR)) / sizeof(Rep)); } bool identical(const Handle& h) const noexcept { return PTR == h.PTR; } From b114789abf5ede7053b3fcf2f3795253504d159b Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 6 Sep 2022 13:56:31 +0200 Subject: [PATCH 03/39] Fix spelling --- Cartesian_kernel/include/CGAL/Cartesian/function_objects.h | 2 +- Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h | 2 +- Filtered_kernel/include/CGAL/Lazy_kernel.h | 2 +- .../doc/STL_Extension/CGAL/Concurrent_compact_container.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index 207aedd7053..7e831f8bd40 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -2506,7 +2506,7 @@ namespace CartesianKernelFunctors { FT rsy = psz*qsx-psx*qsz; FT rsz = psx*qsy-psy*qsx; - // The following determinants can be developped and simplified. + // The following determinants can be developed and simplified. // // FT num_x = determinant(psy,psz,ps2, // qsy,qsz,qs2, diff --git a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h index 8765d0cb587..8917cfaf36e 100644 --- a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h +++ b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h @@ -754,7 +754,7 @@ power_side_of_bounded_power_sphereC3( } // return the sign of the power test of weighted point (rx,ry,rz,rw) - // with respect to the smallest sphere orthogoanal to + // with respect to the smallest sphere orthogonal to // p,q template< class FT > typename Same_uncertainty_nt::type diff --git a/Filtered_kernel/include/CGAL/Lazy_kernel.h b/Filtered_kernel/include/CGAL/Lazy_kernel.h index c88f93e3acf..08a6ebb41a0 100644 --- a/Filtered_kernel/include/CGAL/Lazy_kernel.h +++ b/Filtered_kernel/include/CGAL/Lazy_kernel.h @@ -89,7 +89,7 @@ protected: // Exact_kernel = exact kernel that will be made lazy // Kernel = lazy kernel -// the Generic base simplies applies the generic magic functor stupidly. +// 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 diff --git a/STL_Extension/doc/STL_Extension/CGAL/Concurrent_compact_container.h b/STL_Extension/doc/STL_Extension/CGAL/Concurrent_compact_container.h index 65e853f489a..334976ab363 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/Concurrent_compact_container.h +++ b/STL_Extension/doc/STL_Extension/CGAL/Concurrent_compact_container.h @@ -293,7 +293,7 @@ complexity. No exception is thrown. /// @{ /// returns whether `pos` is in the range `[ccc.begin(), ccc.end()]` (`ccc.end()` included). bool owns(const_iterator pos); - /// returns whether `pos` is in the range `[ccc.begin(), ccc`.end())` (`ccc.end()` excluded). + /// returns whether `pos` is in the range `[ccc.begin(), ccc.end())` (`ccc.end()` excluded). bool owns_dereferencable(const_iterator pos); /// @} From 81410701f788a648dd379941536faa6ac062ba47 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 6 Sep 2022 17:25:39 +0200 Subject: [PATCH 04/39] Factorize the test "needs_ft" into a meta-function --- Filtered_kernel/include/CGAL/Filtered_predicate.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Filtered_predicate.h b/Filtered_kernel/include/CGAL/Filtered_predicate.h index d0035916e8b..3a89ad244ec 100644 --- a/Filtered_kernel/include/CGAL/Filtered_predicate.h +++ b/Filtered_kernel/include/CGAL/Filtered_predicate.h @@ -129,9 +129,15 @@ public: using result_type = typename Remove_needs_FT::Type; template - bool needs_ft(const Args&... args) const { - using Actual_approx_res = std::remove_cv_t>; - return std::is_same_v>; + 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 + bool needs_ft(const Args&...) const { + return Call_operator_needs_FT::value; } template @@ -153,8 +159,7 @@ public: CGAL_BRANCH_PROFILER_BRANCH(tmp); Protect_FPU_rounding p(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - using Actual_approx_res = std::remove_cv_t>; - if constexpr (std::is_same_v>) + if constexpr (Call_operator_needs_FT::value) return ep_ft(c2e_ft(args)...); else return ep_rt(c2e_rt(args)...); From 1e485113e8a90685519d09d5dbeece4ccb7b4e86 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 7 Sep 2022 10:30:01 +0200 Subject: [PATCH 05/39] Add an important comment --- Filtered_kernel/include/CGAL/Filtered_predicate.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Filtered_kernel/include/CGAL/Filtered_predicate.h b/Filtered_kernel/include/CGAL/Filtered_predicate.h index 3a89ad244ec..f9868b05c7a 100644 --- a/Filtered_kernel/include/CGAL/Filtered_predicate.h +++ b/Filtered_kernel/include/CGAL/Filtered_predicate.h @@ -135,6 +135,13 @@ public: enum { value = std::is_same>::value }; }; + // ## Important note + // + // If you want to remove of rename that member function template `needs_ft`, + // please also change the lines with + // `CGAL_GENERATE_MEMBER_DETECTOR(needs_ft);` + // or `has_needs_ft` in + // the file `Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h`. template bool needs_ft(const Args&...) const { return Call_operator_needs_FT::value; From 4b660d9ec9f6a2f7634ff24a0f873a0548af2248 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 7 Sep 2022 11:10:13 +0200 Subject: [PATCH 06/39] Another proposal for Filtered_predicate_RT_FT Instead of having the return type wrapped in a `Needs_FT` tag, not the call operator overloads that can be called with `RT` are "tagged" by adding a last argument of type `RT_sufficient` with a default value. --- .../include/CGAL/Cartesian/function_objects.h | 12 +++++------ .../include/CGAL/Filtered_predicate.h | 20 ++++++++++++++----- .../include/CGAL/Kernel/interface_macros.h | 5 +++-- .../test/Kernel_23/include/CGAL/_test_new_3.h | 11 +++++++--- STL_Extension/include/CGAL/tags.h | 18 ++--------------- 5 files changed, 34 insertions(+), 32 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index 7e831f8bd40..718e8f2e5e5 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -566,7 +566,7 @@ namespace CartesianKernelFunctors { typedef typename K::Comparison_result result_type; result_type - operator()(const Point_3& p, const Point_3& q, const Point_3& r) const + operator()(const Point_3& p, const Point_3& q, const Point_3& r, RT_sufficient = {}) const { return cmp_dist_to_pointC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), @@ -574,32 +574,32 @@ namespace CartesianKernelFunctors { } result_type - operator()(const Point_3& p1, const Segment_3& s1, const Segment_3& s2) const + operator()(const Point_3& p1, const Segment_3& s1, const Segment_3& s2, RT_sufficient = {}) const { return internal::compare_distance_pssC3(p1,s1,s2, K()); } result_type - operator()(const Point_3& p1, const Point_3& p2, const Segment_3& s2) const + operator()(const Point_3& p1, const Point_3& p2, const Segment_3& s2, RT_sufficient = {}) const { return internal::compare_distance_ppsC3(p1,p2,s2, K()); } result_type - operator()(const Point_3& p1, const Segment_3& s2, const Point_3& p2) const + operator()(const Point_3& p1, const Segment_3& s2, const Point_3& p2, RT_sufficient = {}) const { return opposite(internal::compare_distance_ppsC3(p1,p2,s2, K())); } template - Needs_FT + result_type 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 + std::enable_if_t< !std::is_same::value, result_type > 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)); diff --git a/Filtered_kernel/include/CGAL/Filtered_predicate.h b/Filtered_kernel/include/CGAL/Filtered_predicate.h index f9868b05c7a..9e551c23994 100644 --- a/Filtered_kernel/include/CGAL/Filtered_predicate.h +++ b/Filtered_kernel/include/CGAL/Filtered_predicate.h @@ -123,16 +123,26 @@ class Filtered_predicate_RT_FT EP_FT ep_ft; AP ap; - using Ares = typename Remove_needs_FT::Type; + using Ares = typename AP::result_type; public: - using result_type = typename Remove_needs_FT::Type; + using result_type = typename EP_FT::result_type; 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 }; + // This type traits class checks if the call operator can be called with + // `(const Args&..., RT_sufficient())`. + using ArrayOfOne = char[1]; + using ArrayOfTwo = char[2]; + + static ArrayOfOne& test(...); + + template + static auto test(const Args2 &...args) + -> decltype(ap(c2a(args)..., RT_sufficient()), + std::declval()); + + enum { value = sizeof(test(std::declval()...)) == sizeof(ArrayOfOne) }; }; // ## Important note diff --git a/Kernel_23/include/CGAL/Kernel/interface_macros.h b/Kernel_23/include/CGAL/Kernel/interface_macros.h index 04b9639a91b..d086ffb920d 100644 --- a/Kernel_23/include/CGAL/Kernel/interface_macros.h +++ b/Kernel_23/include/CGAL/Kernel/interface_macros.h @@ -33,8 +33,9 @@ #endif // Those predicates for which Simple_cartesian maybe use division of not. -// Predicates using division must have Needs_FT as actual return -// type. +// Predicates that do not require the division must have `RT_sufficient` as last +// argument, with a default. See for example `Compare_distance_3` in the file +// Cartesian_kernel/include/CGAL/Cartesian/function_objects.h #ifndef CGAL_Kernel_pred_RT_or_FT # define CGAL_Kernel_pred_RT_or_FT(X, Y) CGAL_Kernel_pred(X, Y) #endif diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h index 993b9ce57ca..d380a39d697 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h @@ -606,17 +606,22 @@ test_new_3(const R& rep) typename R::Compare_distance_3 compare_dist = rep.compare_distance_3_object(); Comparison_result tmp34ab = compare_dist(p2,p3,p4); + tmp34ab = compare_dist(p1, s2, s2); + tmp34ab = compare_dist(p1, p2, s2); + tmp34ab = compare_dist(p1, s2, p2); tmp34ab = compare_dist(p2,p3,p2,p3); tmp34ab = compare_dist(p1, p2, p3, p4); tmp34ab = compare_dist(l2, p1, p1); - tmp34ab = compare_dist(p1, p2, s2); if constexpr (R::Has_filtered_predicates && has_needs_ft::value) { + assert(!compare_dist.needs_ft(p1, p2, p3)); + assert(!compare_dist.needs_ft(p2, s2, s2)); + assert(!compare_dist.needs_ft(p2, p2, s2)); + assert(!compare_dist.needs_ft(p1, s2, p2)); assert(compare_dist.needs_ft(l1, p1, p1)); assert(compare_dist.needs_ft(p2, p3, p2, p3)); - assert(!compare_dist.needs_ft(p1, p2, p3)); - assert(!compare_dist.needs_ft(p2, p2, s2)); + assert(compare_dist.needs_ft(p2, s2, l1, s2)); } (void) tmp34ab; diff --git a/STL_Extension/include/CGAL/tags.h b/STL_Extension/include/CGAL/tags.h index dbacc57b2d3..d0dca45ac86 100644 --- a/STL_Extension/include/CGAL/tags.h +++ b/STL_Extension/include/CGAL/tags.h @@ -81,22 +81,8 @@ Assert_compile_time_tag( const Tag&, const Derived& b) x.match_compile_time_tag(b); } -template -struct Needs_FT { - T value; - Needs_FT(T v) : value(v) {} - operator T() const { return value; } -}; - -template -struct Remove_needs_FT { - using Type = T; -}; - -template -struct Remove_needs_FT> { - using Type = T; -}; +// for Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +struct RT_sufficient {}; } //namespace CGAL From dcca65b7403f7322bfb473a894f49eea549b96ed Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 7 Sep 2022 14:48:45 +0200 Subject: [PATCH 07/39] Spelling typo --- Kernel_23/include/CGAL/Kernel/interface_macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel_23/include/CGAL/Kernel/interface_macros.h b/Kernel_23/include/CGAL/Kernel/interface_macros.h index 04b9639a91b..5da0e0c0052 100644 --- a/Kernel_23/include/CGAL/Kernel/interface_macros.h +++ b/Kernel_23/include/CGAL/Kernel/interface_macros.h @@ -18,7 +18,7 @@ // It's aimed at being included from within a kernel traits class, this // way we share more code. -// It is the responsability of the including file to correctly set the 2 +// It is the responsibility of the including file to correctly set the 2 // macros CGAL_Kernel_pred, CGAL_Kernel_cons and CGAL_Kernel_obj. // And they are #undefed at the end of this file. From 8521c44c6f7ec9bb0096b3b74af4547ef41bf1c4 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 7 Sep 2022 15:10:39 +0200 Subject: [PATCH 08/39] Add a constexpr, because I can --- Filtered_kernel/include/CGAL/Filtered_predicate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Filtered_kernel/include/CGAL/Filtered_predicate.h b/Filtered_kernel/include/CGAL/Filtered_predicate.h index 9e551c23994..f7ea91355aa 100644 --- a/Filtered_kernel/include/CGAL/Filtered_predicate.h +++ b/Filtered_kernel/include/CGAL/Filtered_predicate.h @@ -153,7 +153,7 @@ public: // or `has_needs_ft` in // the file `Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h`. template - bool needs_ft(const Args&...) const { + constexpr bool needs_ft(const Args&...) const { return Call_operator_needs_FT::value; } From f52298a8c5012bdddc33a29919df0aec8fb1821e Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 8 Sep 2022 17:30:14 +0200 Subject: [PATCH 09/39] WIP: try to always use Filtered_predicate_RT_FT --- .../include/CGAL/Cartesian/function_objects.h | 66 +++++++++++-------- .../include/CGAL/Filtered_kernel.h | 14 ++-- .../include/CGAL/Kernel/function_objects.h | 56 +++++++++------- .../Kernel_23/internal/Projection_traits_3.h | 4 +- .../test/Kernel_23/test_projection_traits.cpp | 1 + 5 files changed, 84 insertions(+), 57 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index 718e8f2e5e5..6c74a59a930 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -398,7 +398,7 @@ namespace CartesianKernelFunctors { Collinear_2(const Orientation_2 o_) : o(o_) {} result_type - operator()(const Point_2& p, const Point_2& q, const Point_2& r) const + operator()(const Point_2& p, const Point_2& q, const Point_2& r, RT_sufficient = {}) const { return o(p, q, r) == COLLINEAR; } }; @@ -410,7 +410,7 @@ namespace CartesianKernelFunctors { typedef typename K::Boolean result_type; result_type - operator()(const Point_3& p, const Point_3& q, const Point_3& r) const + operator()(const Point_3& p, const Point_3& q, const Point_3& r, RT_sufficient = {}) const { return collinearC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), @@ -453,7 +453,7 @@ namespace CartesianKernelFunctors { } template - result_type + std::enable_if_t< !std::is_same::value, result_type > 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)); @@ -618,7 +618,7 @@ namespace CartesianKernelFunctors { Comparison_result operator()(const Point_2& r, const Weighted_point_2& p, - const Weighted_point_2& q) const + const Weighted_point_2& q, RT_sufficient = {}) const { return CGAL::compare_power_distanceC2(p.x(), p.y(), p.weight(), q.x(), q.y(), q.weight(), @@ -3769,7 +3769,8 @@ namespace CartesianKernelFunctors { #endif // CGAL_kernel_exactness_preconditions result_type - operator()(const Point_3& p, const Point_3& q, const Point_3& r) const + operator()(const Point_3& p, const Point_3& q, const Point_3& r, + RT_sufficient = {}) const { return coplanar_orientationC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), @@ -3778,7 +3779,8 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_3& p, const Point_3& q, - const Point_3& r, const Point_3& s) const + const Point_3& r, const Point_3& s, + RT_sufficient = {}) const { // p,q,r,s supposed to be coplanar // p,q,r supposed to be non collinear @@ -3819,7 +3821,8 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_3& p, const Point_3& q, - const Point_3& r, const Point_3& t) const + const Point_3& r, const Point_3& t, + RT_sufficient = {}) const { // p,q,r,t are supposed to be coplanar. // p,q,r determine an orientation of this plane (not collinear). @@ -4206,20 +4209,20 @@ namespace CartesianKernelFunctors { public: typedef typename K::Orientation result_type; - result_type - operator()(const Point_2& p, const Point_2& q, const Point_2& r) const + result_type operator()(const Point_2& p, const Point_2& q, const Point_2& r, + RT_sufficient = {}) const { return orientationC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y()); } result_type - operator()(const Vector_2& u, const Vector_2& v) const + operator()(const Vector_2& u, const Vector_2& v, RT_sufficient = {}) const { return orientationC2(u.x(), u.y(), v.x(), v.y()); } result_type - operator()(const Circle_2& c) const + operator()(const Circle_2& c, RT_sufficient = {}) const { return c.rep().orientation(); } @@ -4237,7 +4240,7 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_3& p, const Point_3& q, - const Point_3& r, const Point_3& s) const + const Point_3& r, const Point_3& s, RT_sufficient = {}) const { return orientationC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), @@ -4246,7 +4249,8 @@ namespace CartesianKernelFunctors { } result_type - operator()( const Vector_3& u, const Vector_3& v, const Vector_3& w) const + operator()( const Vector_3& u, const Vector_3& v, const Vector_3& w, + RT_sufficient = {}) const { return orientationC3(u.x(), u.y(), u.z(), v.x(), v.y(), v.z(), @@ -4255,7 +4259,7 @@ namespace CartesianKernelFunctors { result_type operator()( Origin, const Point_3& u, - const Point_3& v, const Point_3& w) const + const Point_3& v, const Point_3& w, RT_sufficient = {}) const { return orientationC3(u.x(), u.y(), u.z(), v.x(), v.y(), v.z(), @@ -4263,13 +4267,13 @@ namespace CartesianKernelFunctors { } result_type - operator()( const Tetrahedron_3& t) const + operator()( const Tetrahedron_3& t, RT_sufficient = {}) const { return t.rep().orientation(); } result_type - operator()(const Sphere_3& s) const + operator()(const Sphere_3& s, RT_sufficient = {}) const { return s.rep().orientation(); } @@ -4287,7 +4291,8 @@ namespace CartesianKernelFunctors { Oriented_side operator()(const Weighted_point_2& p, const Weighted_point_2& q, const Weighted_point_2& r, - const Weighted_point_2& t) const + const Weighted_point_2& t, + RT_sufficient = {}) const { //CGAL_kernel_precondition( ! collinear(p, q, r) ); return power_side_of_oriented_power_circleC2(p.x(), p.y(), p.weight(), @@ -4308,7 +4313,8 @@ namespace CartesianKernelFunctors { Oriented_side operator()(const Weighted_point_2& p, const Weighted_point_2& q, - const Weighted_point_2& t) const + const Weighted_point_2& t, + RT_sufficient = {}) const { //CGAL_kernel_precondition( collinear(p, q, r) ); //CGAL_kernel_precondition( p.point() != q.point() ); @@ -4318,7 +4324,8 @@ namespace CartesianKernelFunctors { } Oriented_side operator()(const Weighted_point_2& p, - const Weighted_point_2& t) const + const Weighted_point_2& t, + RT_sufficient = {}) const { //CGAL_kernel_precondition( p.point() == r.point() ); Comparison_result r = CGAL::compare(p.weight(), t.weight()); @@ -4407,7 +4414,8 @@ namespace CartesianKernelFunctors { typedef typename K::Bounded_side result_type; result_type - operator()( const Point_2& p, const Point_2& q, const Point_2& t) const + operator()( const Point_2& p, const Point_2& q, const Point_2& t, + RT_sufficient = {}) const { return side_of_bounded_circleC2(p.x(), p.y(), q.x(), q.y(), @@ -4416,7 +4424,8 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_2& p, const Point_2& q, - const Point_2& r, const Point_2& t) const + const Point_2& r, const Point_2& t, + RT_sufficient = {}) const { return side_of_bounded_circleC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y(), t.x(), t.y()); @@ -4431,7 +4440,8 @@ namespace CartesianKernelFunctors { typedef typename K::Bounded_side result_type; result_type - operator()( const Point_3& p, const Point_3& q, const Point_3& test) const + operator()( const Point_3& p, const Point_3& q, const Point_3& test, + RT_sufficient = {}) const { return side_of_bounded_sphereC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), @@ -4440,7 +4450,8 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_3& p, const Point_3& q, - const Point_3& r, const Point_3& test) const + const Point_3& r, const Point_3& test, + RT_sufficient = {}) const { return side_of_bounded_sphereC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), @@ -4450,7 +4461,8 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_3& p, const Point_3& q, const Point_3& r, - const Point_3& s, const Point_3& test) const + const Point_3& s, const Point_3& test, + RT_sufficient = {}) const { return side_of_bounded_sphereC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), @@ -4469,7 +4481,8 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_2& p, const Point_2& q, - const Point_2& r, const Point_2& t) const + const Point_2& r, const Point_2& t, + RT_sufficient = {}) const { return side_of_oriented_circleC2(p.x(), p.y(), q.x(), q.y(), @@ -4487,7 +4500,8 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_3& p, const Point_3& q, const Point_3& r, - const Point_3& s, const Point_3& test) const + const Point_3& s, const Point_3& test, + RT_sufficient = {}) const { return side_of_oriented_sphereC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel.h b/Filtered_kernel/include/CGAL/Filtered_kernel.h index 372295066cf..9d7493d68a3 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel.h @@ -81,13 +81,13 @@ struct Filtered_kernel_base Approximate_kernel approximate_kernel() const { return {}; } // We change the predicates. -#define CGAL_Kernel_pred(P, Pf) \ - typedef Filtered_predicate P; \ - P Pf() const { return P(); } +// #define CGAL_Kernel_pred(P, Pf) \ +// typedef Filtered_predicate P; \ +// P Pf() const { return P(); } -#define CGAL_Kernel_pred_RT(P, Pf) \ - typedef Filtered_predicate P; \ - P Pf() const { return P(); } +// #define CGAL_Kernel_pred_RT(P, Pf) \ +// typedef Filtered_predicate P; \ +// P Pf() const { return P(); } #define CGAL_Kernel_pred_RT_or_FT(P, Pf) \ typedef Filtered_predicate_RT_FT P; \ P Pf() const { return P(); } +#define CGAL_Kernel_pred_RT(P, Pf) CGAL_Kernel_pred_RT_or_FT(P, Pf) +#define CGAL_Kernel_pred(P, Pf) CGAL_Kernel_pred_RT_or_FT(P, Pf) // We don't touch the constructions. #define CGAL_Kernel_cons(Y,Z) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index ead2582c6bc..9966fad0a1f 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -20,6 +20,7 @@ #ifndef CGAL_KERNEL_FUNCTION_OBJECTS_H #define CGAL_KERNEL_FUNCTION_OBJECTS_H +#include #include #include #include @@ -30,7 +31,7 @@ #include #include - +#include // for std::is_same and std::enable_if #include // for Compute_dihedral_angle namespace CGAL { @@ -338,7 +339,8 @@ namespace CommonKernelFunctors { Comparison_result operator()(const Point_3 & p, const Weighted_point_3 & q, - const Weighted_point_3 & r) const + const Weighted_point_3 & r, + RT_sufficient = {}) const { return compare_power_distanceC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), q.weight(), @@ -513,7 +515,8 @@ namespace CommonKernelFunctors { const Weighted_point_3 & q, const Weighted_point_3 & r, const Weighted_point_3 & s, - const Weighted_point_3 & t) const + const Weighted_point_3 & t, + RT_sufficient = {}) const { return power_side_of_oriented_power_sphereC3(p.x(), p.y(), p.z(), p.weight(), q.x(), q.y(), q.z(), q.weight(), @@ -535,7 +538,8 @@ namespace CommonKernelFunctors { Oriented_side operator()(const Weighted_point_3 & p, const Weighted_point_3 & q, const Weighted_point_3 & r, - const Weighted_point_3 & s) const + const Weighted_point_3 & s, + RT_sufficient = {}) const { //CGAL_kernel_precondition( coplanar(p, q, r, s) ); //CGAL_kernel_precondition( !collinear(p, q, r) ); @@ -547,7 +551,8 @@ namespace CommonKernelFunctors { Oriented_side operator()(const Weighted_point_3 & p, const Weighted_point_3 & q, - const Weighted_point_3 & r) const + const Weighted_point_3 & r, + RT_sufficient = {}) const { //CGAL_kernel_precondition( collinear(p, q, r) ); //CGAL_kernel_precondition( p.point() != q.point() ); @@ -557,7 +562,8 @@ namespace CommonKernelFunctors { } Oriented_side operator()(const Weighted_point_3 & p, - const Weighted_point_3 & q) const + const Weighted_point_3 & q, + RT_sufficient = {}) const { //CGAL_kernel_precondition( p.point() == r.point() ); return power_side_of_oriented_power_sphereC3(p.weight(),q.weight()); @@ -824,7 +830,7 @@ namespace CommonKernelFunctors { } template - result_type + std::enable_if_t< !std::is_same::value, result_type > 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)); @@ -846,7 +852,7 @@ namespace CommonKernelFunctors { } template - result_type + std::enable_if_t< !std::is_same::value, result_type > 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)); @@ -2988,7 +2994,8 @@ namespace CommonKernelFunctors { result_type operator()( const Point_3& p, const Point_3& q, - const Point_3& r, const Point_3& s) const + const Point_3& r, const Point_3& s, + RT_sufficient = {}) const { return o(p, q, r, s) == COPLANAR; } @@ -3032,13 +3039,16 @@ namespace CommonKernelFunctors { template result_type - operator()(const T1& t1, const T2& t2) const + operator()(const T1& t1, const T2& t2, RT_sufficient = {}) 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 - { return Intersections::internal::do_intersect(pl1, pl2, pl3, K() ); } - + result_type operator()(const typename K::Plane_3& pl1, + const typename K::Plane_3& pl2, + const typename K::Plane_3& pl3, + RT_sufficient = {}) const + { + return Intersections::internal::do_intersect(pl1, pl2, pl3, K()); + } }; template @@ -3656,39 +3666,39 @@ namespace CommonKernelFunctors { typedef typename K::Boolean result_type; result_type - operator()( const Iso_cuboid_3& c) const + operator()( const Iso_cuboid_3& c, RT_sufficient = {}) const { return c.rep().is_degenerate(); } result_type - operator()( const Line_3& l) const + operator()( const Line_3& l, RT_sufficient = {}) const { return l.rep().is_degenerate(); } result_type - operator()( const Plane_3& pl) const + operator()( const Plane_3& pl, RT_sufficient = {}) const { return pl.rep().is_degenerate(); } result_type - operator()( const Ray_3& r) const + operator()( const Ray_3& r, RT_sufficient = {}) const { return r.rep().is_degenerate(); } result_type - operator()( const Segment_3& s) const + operator()( const Segment_3& s, RT_sufficient = {}) const { return s.rep().is_degenerate(); } result_type - operator()( const Sphere_3& s) const + operator()( const Sphere_3& s, RT_sufficient = {}) const { return s.rep().is_degenerate(); } result_type - operator()( const Triangle_3& t) const + operator()( const Triangle_3& t, RT_sufficient = {}) const { return t.rep().is_degenerate(); } result_type - operator()( const Tetrahedron_3& t) const + operator()( const Tetrahedron_3& t, RT_sufficient = {}) const { return t.rep().is_degenerate(); } result_type - operator()( const Circle_3& t) const + operator()( const Circle_3& t, RT_sufficient = {}) const { return t.rep().is_degenerate(); } }; 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 120fa052a85..353bcaea13d 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 @@ -13,7 +13,7 @@ #define CGAL_INTERNAL_PROJECTION_TRAITS_3_H #include - +#include #include #include #include @@ -1021,7 +1021,7 @@ public: struct Collinear_2 { typedef typename R::Boolean result_type; - bool operator()(const Point_2& p, const Point_2& q, const Point_2& r) const + bool operator()(const Point_2& p, const Point_2& q, const Point_2& r, RT_sufficient = {}) const { Orientation_2 ori; return ori(p,q,r) == COLLINEAR; diff --git a/Kernel_23/test/Kernel_23/test_projection_traits.cpp b/Kernel_23/test/Kernel_23/test_projection_traits.cpp index 50171ee754d..6929698c39d 100644 --- a/Kernel_23/test/Kernel_23/test_projection_traits.cpp +++ b/Kernel_23/test/Kernel_23/test_projection_traits.cpp @@ -1,3 +1,4 @@ +#define CGAL_NO_MPZF_DIVISION_OPERATOR 1 #include #include From 36c0a779d744f856d50ad79de6c9d289ef4b6693 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 14 Sep 2022 11:10:04 +0200 Subject: [PATCH 10/39] WIP: how to detect the arity of a predicate --- .../kernel_detect_predicates_arity.cpp | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 Kernel_23/test/Kernel_23/kernel_detect_predicates_arity.cpp diff --git a/Kernel_23/test/Kernel_23/kernel_detect_predicates_arity.cpp b/Kernel_23/test/Kernel_23/kernel_detect_predicates_arity.cpp new file mode 100644 index 00000000000..aca12aa1b2a --- /dev/null +++ b/Kernel_23/test/Kernel_23/kernel_detect_predicates_arity.cpp @@ -0,0 +1,94 @@ +#define CGAL_NO_MPZF_DIVISION_OPERATOR 1 + +#include +#include + +using SCK = CGAL::Simple_cartesian; + +struct Any { + template operator const T&(); +}; + +template +void check_pred() { + std::cerr << std::is_invocable_v; + std::cerr << std::is_invocable_v; + std::cerr << std::is_invocable_v; + std::cerr << std::is_invocable_v; + std::cerr << std::is_invocable_v; + std::cerr << std::is_invocable_v; + std::cerr << std::is_invocable_v; + std::cerr << std::is_invocable_v; + + // The following asserts that no predicate from the kernel has more than + // 8 arguments (actually the assertions are only from 9 to 12 arguments). + static_assert(!std::is_invocable_v); + static_assert(!std::is_invocable_v); + static_assert(!std::is_invocable_v); + static_assert(!std::is_invocable_v); + std::cerr << '\n'; +} + +int main() +{ +#define CGAL_Kernel_pred(P, Pf) \ + std::cerr << #P << ": "; \ + check_pred(); +#include + + // Bug with predicates with multiple overload of the call operator with the + // same number of arguments: the call with `Any` is ambiguous. + static_assert(std::is_invocable_v); + static_assert(!std::is_invocable_v); // AMBIGUOUS CALL + static_assert(!std::is_invocable_v); // AMBIGUOUS CALL + return 0; +} + + +/* + +WORK IN PROGRESS: + +In the CGAL Kernel: + - 2D: 49 predicates + - 3D: 50 predicates + + +## Try to detect all possible types of arguments of predicates, from the doc + +``` +[lrineau@fernand]~/Git/cgal-master/build-doc/doc_output/Kernel_23/xml% grep -h ' ' classKernel_1_1(^(Construct|Compute|Assign)*).xml | sed 's/]*>//; s|||; s| &|\&|' | sed 's/Kernel::/K::/'| sort | uniq -c | sort -n | grep -v _3 +``` + +3D: (14 types of arguments) + +const K::Direction_3& +const K::Triangle_3& +const K::Circle_3& +const K::Ray_3& +const K::Segment_3& +const K::Iso_cuboid_3& +const K::Line_3& +const K::Tetrahedron_3& +const K::FT& +const K::Plane_3& +const K::Sphere_3& +const K::Vector_3& +const K::Weighted_point_3& +const K::Point_3& + +2D: (10 types arguments) + +const K::Vector_2& +const K::Direction_2& +const K::Iso_rectangle_2& +const K::Ray_2& +const K::Circle_2& +const K::Triangle_2& +const K::FT& +const K::Segment_2& +const K::Weighted_point_2& +const K::Line_2& +const K::Point_2& + +*/ From a267cee598d5e757cffe7e5882d878fc172b771f Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 15 Sep 2022 16:05:35 +0200 Subject: [PATCH 11/39] Avoid one intermediate call to the global (non-internal) function --- Kernel_23/include/CGAL/Kernel/function_objects.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 9966fad0a1f..2e8530166d9 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -826,14 +826,15 @@ namespace CommonKernelFunctors { result_type operator()(const T1& p, const T2& q, const FT& d2) const { - return CGAL::compare(squared_distance(p, q), d2); + return CGAL::compare(internal::squared_distance(p, q, K()), d2); } template std::enable_if_t< !std::is_same::value, result_type > 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)); + return CGAL::compare(internal::squared_distance(p, q, K()), + internal::squared_distance(r, s, K())); } }; @@ -848,14 +849,15 @@ namespace CommonKernelFunctors { result_type operator()(const T1& p, const T2& q, const FT& d2) const { - return CGAL::compare(squared_distance(p, q), d2); + return CGAL::compare(internal::squared_distance(p, q, K()), d2); } template std::enable_if_t< !std::is_same::value, result_type > 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)); + return CGAL::compare(internal::squared_distance(p, q, K()), + internal::squared_distance(r, s, K())); } }; From 04a7b31a078caa98b9428ff4c07a88d4d4c90eef Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 15 Sep 2022 16:06:28 +0200 Subject: [PATCH 12/39] WIP: test one predicate with a set of arguments with RT --- .../test/Kernel_23/test_predicate_with_RT.cpp | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Kernel_23/test/Kernel_23/test_predicate_with_RT.cpp diff --git a/Kernel_23/test/Kernel_23/test_predicate_with_RT.cpp b/Kernel_23/test/Kernel_23/test_predicate_with_RT.cpp new file mode 100644 index 00000000000..68b833ece67 --- /dev/null +++ b/Kernel_23/test/Kernel_23/test_predicate_with_RT.cpp @@ -0,0 +1,35 @@ +#define CGAL_NO_MPZF_DIVISION_OPERATOR 1 + +#include +#include + +template +void test(const R& rep) { + using Point_3 = typename R::Point_3; + using Segment_3 = typename R::Segment_3; + using Line_3 = typename R::Line_3; + + auto construct_point = rep.construct_point_3_object(); + Point_3 p2 = construct_point(CGAL::ORIGIN); + Point_3 p3 = construct_point(1,1,1); + Point_3 p4 = construct_point(1,1,2); + Point_3 p5 = construct_point(1,2,3); + Point_3 p6 = construct_point(4,2,1); + + auto construct_segment = rep.construct_segment_3_object(); + Segment_3 s2 = construct_segment(p2,p3), s1 = s2; + + auto construct_line = rep.construct_line_3_object(); + Line_3 l2 = construct_line(p5,p6); + + auto compare_distance = rep.compare_distance_3_object(); + // compare_distance(p2, p2, p2); + compare_distance(p2, s2, p2); + // compare_distance(p2, l2, p2); +} + +int main() +{ + test(CGAL::Simple_cartesian()); + return 0; +} From 01af5bce52137c4d26127f6ab292d8dc5d8e37e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 21 Sep 2022 14:54:18 +0200 Subject: [PATCH 13/39] Add an automatic test to detect correct presence/absence of RT_sufficient --- Kernel_23/test/Kernel_23/CMakeLists.txt | 48 +- .../Kernel_23/atomic_compilation_test.cpp | 1 + .../include/atomic_RT_FT_predicate_headers.h | 25 + .../Kernel_23/test_RT_or_FT_predicates.cpp | 497 ++++++++++++++++++ 4 files changed, 560 insertions(+), 11 deletions(-) create mode 100644 Kernel_23/test/Kernel_23/atomic_compilation_test.cpp create mode 100644 Kernel_23/test/Kernel_23/include/atomic_RT_FT_predicate_headers.h create mode 100644 Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp diff --git a/Kernel_23/test/Kernel_23/CMakeLists.txt b/Kernel_23/test/Kernel_23/CMakeLists.txt index 24b2ddfc339..0d413d701ff 100644 --- a/Kernel_23/test/Kernel_23/CMakeLists.txt +++ b/Kernel_23/test/Kernel_23/CMakeLists.txt @@ -1,6 +1,3 @@ -# Created by the script cgal_create_cmake_script -# This is the CMake script for compiling a CGAL application. - cmake_minimum_required(VERSION 3.1...3.23) project(Kernel_23_Tests) @@ -8,11 +5,40 @@ find_package(CGAL REQUIRED COMPONENTS Core) include_directories(BEFORE "include") -# create a target per cppfile -file( - GLOB cppfiles - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) -foreach(cppfile ${cppfiles}) - create_single_source_cgal_program("${cppfile}") -endforeach() +create_single_source_cgal_program("Cartesian.cpp") +create_single_source_cgal_program("determinant_77.cpp") +create_single_source_cgal_program("Dimension.cpp") +create_single_source_cgal_program("Exact_predicates_exact_constructions_kernel.cpp") +create_single_source_cgal_program("Filtered_cartesian.cpp") +create_single_source_cgal_program("Filtered_homogeneous.cpp") +create_single_source_cgal_program("Homogeneous.cpp") +create_single_source_cgal_program("issue_129.cpp") +create_single_source_cgal_program("issue_3301.cpp") +create_single_source_cgal_program("Kernel_checker.cpp") +create_single_source_cgal_program("kernel_detect_predicates_arity.cpp") +create_single_source_cgal_program("Lazy_kernel.cpp") +create_single_source_cgal_program("origin_3.cpp") +create_single_source_cgal_program("overload_bug.cpp") +create_single_source_cgal_program("rank.cpp") +create_single_source_cgal_program("Simple_cartesian.cpp") +create_single_source_cgal_program("Simple_homogeneous.cpp") +create_single_source_cgal_program("test_all_linear_intersections.cpp") +create_single_source_cgal_program("test_approximate_dihedral_angle_3.cpp") +create_single_source_cgal_program("test_bbox.cpp") +create_single_source_cgal_program("test_converter.cpp") +create_single_source_cgal_program("test_Has_conversion.cpp") +create_single_source_cgal_program("test_hash_functions.cpp") +create_single_source_cgal_program("test_kernel__.cpp") +create_single_source_cgal_program("test_predicate_with_RT.cpp") +create_single_source_cgal_program("test_projection_traits.cpp") +create_single_source_cgal_program("test_Projection_traits_xy_3_Intersect_2.cpp") + +set(CGAL_KERNEL_23_TEST_RT_FT_PREDICATE_FLAGS ON) +if(CGAL_KERNEL_23_TEST_RT_FT_PREDICATE_FLAGS) + # expensive because of templated operators creating a lot of possible combinations + add_definitions(-DCGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_COMPARE_DISTANCES) + + create_single_source_cgal_program("atomic_compilation_test.cpp") + create_single_source_cgal_program("test_RT_or_FT_predicates.cpp") + target_precompile_headers(atomic_compilation_test PUBLIC [["atomic_RT_FT_predicate_headers.h"]]) +endif() diff --git a/Kernel_23/test/Kernel_23/atomic_compilation_test.cpp b/Kernel_23/test/Kernel_23/atomic_compilation_test.cpp new file mode 100644 index 00000000000..80c7b4bd8dd --- /dev/null +++ b/Kernel_23/test/Kernel_23/atomic_compilation_test.cpp @@ -0,0 +1 @@ +int main(int, char**) { } diff --git a/Kernel_23/test/Kernel_23/include/atomic_RT_FT_predicate_headers.h b/Kernel_23/test/Kernel_23/include/atomic_RT_FT_predicate_headers.h new file mode 100644 index 00000000000..f3d3b43a485 --- /dev/null +++ b/Kernel_23/test/Kernel_23/include/atomic_RT_FT_predicate_headers.h @@ -0,0 +1,25 @@ +#ifndef CGAL_KERNEL_23_TEST_ATOMIC_HEADERS_H +#define CGAL_KERNEL_23_TEST_ATOMIC_HEADERS_H + +#define CGAL_NO_MPZF_DIVISION_OPERATOR + +#include +#include +#include + +#include + +namespace CGAL { +namespace Kernel_23_tests { + +struct Any { + + template ::value>::type> + operator T(); +}; + +} // namespace Kernel_23_tests +} // namespace CGAL + +#endif // CGAL_KERNEL_23_TEST_ATOMIC_HEADERS_H diff --git a/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp new file mode 100644 index 00000000000..322c7752300 --- /dev/null +++ b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp @@ -0,0 +1,497 @@ +#include +#include + +#include +#include +#include +#include +#include +#include + +// 0, nothing +// > 0, print RT_sufficient errors and successes +// > 1, same as above + predicate being tested +// > 2, same as above + some general indications on what is going on +// > 4, same as above + even more indications on what is going on +// > 8, everything +#define CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY 8 + +std::vector predicates_types = { }; + +// @todo, technically somebody might in the future create predicates with non kernel objects (nor FT). +// In that case, they'd have to be added to these lists since there is no scrapping of the predicate +// arguments but rather try all combinations of objects from these lists. +std::vector object_types_2 = { "FT" }; +std::vector object_types_3 = { "FT" }; + +// @todo potential operator()s with more than MAX_ARITY are not tested +constexpr std::size_t MIN_ARITY = 0; +constexpr std::size_t MAX_ARITY = 12; + +const std::string kernel_name = "Simple_cartesian"; +const std::string FT_div = "double"; +const std::string RT_no_div = "CGAL::Mpzf"; + +enum Compilation_result +{ + SUCCESSFUL = 0, // if it got to linking, it is also a successful compilation + FAILED_NO_MATCH, + FAILED_AMBIGUOUS_CALL, // ambiguous calls means the arity is valid + FAILED_NO_DIVISION_OPERATOR, // used to detect if a valid compilation can be done with RT + UNKNOWN +}; + +enum class Arity_test_result +{ + EXPLORATION_REQUIRED = 0, + RT_SUFFICIENT, + FT_NECESSARY, + NO_MATCH +}; + +inline const char* get_error_message(int error_code) +{ + // Messages corresponding to Error_code list above. Must be kept in sync! + static const char* error_message[UNKNOWN+1] = + { + "Success!", + "Failed: no match!", + "Failed: ambiguous call!", + "Failed: called division operator!", + "Unexpected error!" + }; + + if(error_code > UNKNOWN || error_code < 0) + return "Doubly unexpected error!!"; + else + return error_message[error_code]; +} + +std::string kernel_with_FT(const std::string& FT_name) +{ + return "CGAL::" + kernel_name + "<" + FT_name + ">"; +} + +// convert from e.g. Point_2 to CGAL::Point_2 +std::string parameter_with_namespace(const std::string& FT_name, + const std::string& o) +{ + if(o == "Any") + return "CGAL::Kernel_23_tests::Any"; + else if(o == "RT_sufficient") + return "CGAL::RT_sufficient"; + else if(o == "FT") + return "K::FT"; + else + return "CGAL::" + o + "<" + kernel_with_FT(FT_name) + " >"; +} + +void compile() +{ +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) + std::cout << "====== Compiling atomic file... ======" << std::endl; +#endif + + std::system("make atomic_compilation_test > log.txt 2>&1"); +} + +Compilation_result parse_output(const std::string& predicate_name, + const std::string& FT_name = {}, + const std::vector& parameters = {}) +{ +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) + std::cout << "====== Parsing compilation log... ======" << std::endl; +#endif + Compilation_result res = UNKNOWN; + + std::ifstream in("log.txt"); + if(!in) + { +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 0) + std::cerr << "Error: failed to open log file" << std::endl; +#endif + return UNKNOWN; + } + +#ifdef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_COMPARE_DISTANCES + // Compare_(squared)_distance_23 have templated operator()s, which are a lot of combinations to test. + // In templated operator()s, the compare is simply a call to squared_distance()s and a CGAL::compare(). + // Below prunes some exploration branches in case the first squared_distance() call does not even compile. + bool prune_compare_distance_branches = false; + if(predicate_name == "Compare_distance_2" || predicate_name == "Compare_distance_3" || + predicate_name == "Compare_squared_distance_2" || predicate_name == "Compare_squared_distance_3") + { + prune_compare_distance_branches = true; + } +#else + CGAL_USE(predicate_name); + CGAL_USE(FT_name); + CGAL_USE(parameters); +#endif + + std::string line; + while(getline(in, line)) + { +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 8) + std::cout << line << std::endl; +#endif + + if(line.find("no match for call") != std::string::npos) { + res = FAILED_NO_MATCH; + break; + } else if(line.find("too many arguments") != std::string::npos) { // @todo what is that exact error? + res = FAILED_NO_MATCH; + break; +#ifdef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_COMPARE_DISTANCES + } else if(prune_compare_distance_branches && parameters.size() > 1 && + parameters[0] != "Any" && parameters[1] != "Any" && + line.find(std::string{"no matching function for call to ‘squared_distance(const " + + parameter_with_namespace(FT_name, parameters[0]) + "&, const " + + parameter_with_namespace(FT_name, parameters[1])}) != std::string::npos) { + res = FAILED_NO_MATCH; + break; +#endif + } else if(line.find("ambiguous") != std::string::npos) { + res = FAILED_AMBIGUOUS_CALL; + break; + } else if(line.find("candidate") != std::string::npos) { + res = FAILED_AMBIGUOUS_CALL; + break; + } else if(line.find("call to deleted") != std::string::npos) { + // @todo unused since the macro makes it so no operator is defined at all + res = FAILED_NO_DIVISION_OPERATOR; + break; + } else if(line.find("no match for ‘operator/’") != std::string::npos) { + res = FAILED_NO_DIVISION_OPERATOR; + break; + } else if(line.find("Built") != std::string::npos) { + res = SUCCESSFUL; + break; + } else if(line.find("undefined reference") != std::string::npos) { + res = SUCCESSFUL; // @todo should it be a different value? + break; + } + } + +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) + std::cout << "Result of atomic test file is: " << get_error_message(res) << std::endl; +#endif + CGAL_postcondition(res != UNKNOWN); + + return res; +} + +void generate_atomic_file(const std::string& FT_name, + const std::string& predicate_name, + const std::vector& parameters) +{ +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) + std::cout << "====== Generate atomic file... ======" << std::endl; +#endif + +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) + std::cout << predicate_name << "("; + for(std::size_t j=0, i=parameters.size(); j 2) + std::cout << "\n===== Checking potential arity " << arity << "... =====" << std::endl; +#endif + + std::vector parameters(arity, "Any"); + + generate_atomic_file(RT_no_div, predicate_name, parameters); + compile(); + Compilation_result res = parse_output(predicate_name); + + if(res == SUCCESSFUL) + return Arity_test_result::RT_SUFFICIENT; + else if(res == FAILED_NO_DIVISION_OPERATOR) + return Arity_test_result::FT_NECESSARY; + else if(res == FAILED_AMBIGUOUS_CALL) + return Arity_test_result::EXPLORATION_REQUIRED; + else // FAILED_NO_MATCH and UNKNOWN + return Arity_test_result::NO_MATCH; +} + +bool ensure_RT_sufficient_is_present(const std::string& predicate_name, + // intentional copy, don't want to pollute the parameters with `RT_sufficient` + std::vector parameters) +{ +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) + std::cout << predicate_name << "("; + for(std::size_t j=0, i=parameters.size(); j 0) + std::cout << predicate_name << "("; + for(std::size_t j=0, i=parameters.size() - 1; j 0) + std::cerr << "Error: this predicate is RT_sufficient, but the tag is missing!\n" << std::endl; +#endif + return false; + } + else + { +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 0) + std::cout << "... and the tag is properly set!\n" << std::endl; +#endif + return true; + } +} + +bool ensure_RT_sufficient_is_NOT_present(const std::string& predicate_name, + // intentional copy, don't want to pollute the parameters with `RT_sufficient` + std::vector parameters) +{ +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) + std::cout << predicate_name << "("; + for(std::size_t j=0, i=parameters.size(); j 0) + std::cout << predicate_name << "("; + for(std::size_t j=0, i=parameters.size() - 1; j 0) + std::cerr << "Error: this predicate is NOT RT_sufficient, but the tag is present!\n" << std::endl; +#endif + return false; + } + else + { +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 0) + std::cout << "... and the tag is (correctly) absent!\n" << std::endl; +#endif + return true; + } +} + +void test_predicate(const std::string& predicate_name, + const std::size_t object_pos, + const std::size_t arity, + // intentional copy, each sub-branch gets its own parameter list + std::vector parameters) +{ + const std::size_t last = arity - 1; + CGAL_precondition(object_pos <= last); + + CGAL_precondition(predicate_name.back() == '2' || predicate_name.back() == '3'); + const auto& object_types = (predicate_name.back() == '2') ? object_types_2 : object_types_3; + + for(const std::string& object_type : object_types) + { +#ifdef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_COMPARE_DISTANCES + // This pruning could be done for other predicates, but they're not as expensive so it doesn't matter + if((predicate_name == "Compare_distance_2" || predicate_name == "Compare_distance_3" || + predicate_name == "Compare_squared_distance_2" || predicate_name == "Compare_squared_distance_3") && + object_type == "FT") + { + continue; + } +#endif + + parameters[object_pos] = object_type; + generate_atomic_file(RT_no_div, predicate_name, parameters); + compile(); + Compilation_result res = parse_output(predicate_name, RT_no_div, parameters); + + // See if we can already conclude on the current parameter list + // - if that successful compiles, then it is RT_sufficient + // - call to deleted operator, this means FT_necessary + // - any other error, this combination of parameters was not a valid input for the predicate + if(res == SUCCESSFUL) + { + ensure_RT_sufficient_is_present(predicate_name, parameters); + } + else if(res == FAILED_NO_DIVISION_OPERATOR) + { + ensure_RT_sufficient_is_NOT_present(predicate_name, parameters); + } + + if(res == FAILED_AMBIGUOUS_CALL && object_pos != last) + { + // The object at the current position does not invalid the call, explore further this list + test_predicate(predicate_name, object_pos + 1, arity, parameters); + } + else + { + // The object at the current position yields a compilation error, do not explore any further + } + } +} + +void test_predicate(const std::string& predicate_name, + const std::size_t arity) +{ +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 2) + std::cout << "===== Test predicate with arity " << arity << "... =====" << std::endl; +#endif + CGAL_precondition(arity > 0); + + // Use "Any" to prune early: + // 1st try "Object_1, Any, ..., Any" (i - 1 "Any") + // -> if that doesn't compile, we're done with Object_1 and try "Object_2, Any, ..., Any" (i-1 "Any") + // -> if that compiles, try "Object_1, Object_1, Any, ..., Any" (i-2 "Any") + // etc. + + // the position of the object being changed/tested, when object_pos == arity - 1, + // then this is a call with full objects on which we can do the RT test + std::vector parameters(arity, "Any"); + std::size_t object_pos = 0; + test_predicate(predicate_name, object_pos, arity, parameters); +} + +void test_predicate(const std::string& predicate_name) +{ +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 1) + std::cout << "\n\n=== Test predicate: " << predicate_name << "... ===" << std::endl; +#endif + +#ifndef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_COMPARE_DISTANCES + if(predicate_name == "Compare_distance_2" || predicate_name == "Compare_distance_3" || + predicate_name == "Compare_squared_distance_2" || predicate_name == "Compare_squared_distance_3") + { +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 1) + std::cout << "Skipping because 'CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_COMPARE_DISTANCES' is not defined!" << std::endl; +#endif + return; + } +#endif + + for(std::size_t i=MIN_ARITY; i<=MAX_ARITY; ++i) + { + Arity_test_result res = test_arity(predicate_name, i); + if(res == Arity_test_result::RT_SUFFICIENT) + { + std::vector parameters(i, "Any"); + ensure_RT_sufficient_is_present(predicate_name, parameters); + } + else if(res == Arity_test_result::FT_NECESSARY) + { + std::vector parameters(i, "Any"); + ensure_RT_sufficient_is_NOT_present(predicate_name, parameters); + } + else if(res == Arity_test_result::EXPLORATION_REQUIRED) + { + test_predicate(predicate_name, i); + } + } +} + +int main(int , char** ) +{ + // Get the predicates + #define CGAL_Kernel_pred(X, Y) predicates_types.push_back(#X); + #define CGAL_Kernel_pred_RT(X, Y) predicates_types.push_back(#X); + #define CGAL_Kernel_pred_RT_or_FT(X, Y) predicates_types.push_back(#X); + #include + + // Get the objects + #define CGAL_Kernel_obj(X) { const std::string O = #X; \ + CGAL_precondition(O.back() == '2' || O.back() == '3'); \ + if(O.back() == ('2')) \ + object_types_2.push_back(#X); \ + else \ + object_types_3.push_back(#X); } + #include + +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 1) + std::cout << predicates_types.size() << " predicates:" << std::endl; + for(const std::string& s : predicates_types) + std::cout << s << "\n"; + std::cout << std::endl; + + std::cout << object_types_2.size() << " 2D objects:" << std::endl; + for(const std::string& o : object_types_2) + std::cout << o << "\n"; + std::cout << std::endl; + + std::cout << object_types_3.size() << " 3D objects:" << std::endl; + for(const std::string& o : object_types_3) + std::cout << o << "\n"; + std::cout << std::endl; +#endif + + // Actual tests + for(const std::string& predicate_name : predicates_types) + { + test_predicate(predicate_name); + } + + restore_atomic_file(); + + return EXIT_SUCCESS; +} From 214e072959a2f0782de8a195a2643ff8ecc3b27b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 22 Sep 2022 12:02:53 +0200 Subject: [PATCH 14/39] Switch from RT_sufficient to FT_necessary --- .../include/CGAL/Cartesian/function_objects.h | 83 +++++-------- .../include/CGAL/Filtered_predicate.h | 17 +-- .../include/CGAL/Kernel/function_objects.h | 49 ++++---- .../Kernel_23/internal/Projection_traits_3.h | 2 +- .../test/Kernel_23/Filtered_cartesian.cpp | 5 +- .../test/Kernel_23/include/CGAL/_test_new_3.h | 18 +-- .../include/atomic_RT_FT_predicate_headers.h | 2 +- .../Kernel_23/test_RT_or_FT_predicates.cpp | 116 +++++++++--------- STL_Extension/include/CGAL/tags.h | 4 +- 9 files changed, 137 insertions(+), 159 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index 6c74a59a930..46a1798d7da 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -398,7 +398,7 @@ namespace CartesianKernelFunctors { Collinear_2(const Orientation_2 o_) : o(o_) {} result_type - operator()(const Point_2& p, const Point_2& q, const Point_2& r, RT_sufficient = {}) const + operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { return o(p, q, r) == COLLINEAR; } }; @@ -410,7 +410,7 @@ namespace CartesianKernelFunctors { typedef typename K::Boolean result_type; result_type - operator()(const Point_3& p, const Point_3& q, const Point_3& r, RT_sufficient = {}) const + operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { return collinearC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), @@ -447,14 +447,14 @@ namespace CartesianKernelFunctors { template result_type - operator()(const T1& p, const T2& q, const T3& r) const + operator()(const T1& p, const T2& q, const T3& r, FT_necessary = {}) const { return CGAL::compare(squared_distance(p, q), squared_distance(p, r)); } template - std::enable_if_t< !std::is_same::value, result_type > - operator()(const T1& p, const T2& q, const T3& r, const T4& s) const + std::enable_if_t::value, result_type> + operator()(const T1& p, const T2& q, const T3& r, const T4& s, FT_necessary = {}) const { return CGAL::compare(squared_distance(p, q), squared_distance(r, s)); } @@ -566,7 +566,7 @@ namespace CartesianKernelFunctors { typedef typename K::Comparison_result result_type; result_type - operator()(const Point_3& p, const Point_3& q, const Point_3& r, RT_sufficient = {}) const + 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(), q.x(), q.y(), q.z(), @@ -574,33 +574,33 @@ namespace CartesianKernelFunctors { } result_type - operator()(const Point_3& p1, const Segment_3& s1, const Segment_3& s2, RT_sufficient = {}) const + 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 - operator()(const Point_3& p1, const Point_3& p2, const Segment_3& s2, RT_sufficient = {}) const + 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 - operator()(const Point_3& p1, const Segment_3& s2, const Point_3& p2, RT_sufficient = {}) const + 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 result_type - operator()(const T1& p, const T2& q, const T3& r) const + operator()(const T1& p, const T2& q, const T3& r, FT_necessary = {}) const { return CGAL::compare(squared_distance(p, q), squared_distance(p, r)); } template - std::enable_if_t< !std::is_same::value, result_type > - operator()(const T1& p, const T2& q, const T3& r, const T4& s) const + std::enable_if_t::value, result_type> + operator()(const T1& p, const T2& q, const T3& r, const T4& s, FT_necessary = {}) const { return CGAL::compare(squared_distance(p, q), squared_distance(r, s)); } @@ -618,7 +618,7 @@ namespace CartesianKernelFunctors { Comparison_result operator()(const Point_2& r, const Weighted_point_2& p, - const Weighted_point_2& q, RT_sufficient = {}) const + const Weighted_point_2& q) const { return CGAL::compare_power_distanceC2(p.x(), p.y(), p.weight(), q.x(), q.y(), q.weight(), @@ -3769,8 +3769,7 @@ namespace CartesianKernelFunctors { #endif // CGAL_kernel_exactness_preconditions result_type - operator()(const Point_3& p, const Point_3& q, const Point_3& r, - RT_sufficient = {}) const + operator()(const Point_3& p, const Point_3& q, const Point_3& r) const { return coplanar_orientationC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), @@ -3779,8 +3778,7 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_3& p, const Point_3& q, - const Point_3& r, const Point_3& s, - RT_sufficient = {}) const + const Point_3& r, const Point_3& s) const { // p,q,r,s supposed to be coplanar // p,q,r supposed to be non collinear @@ -3821,8 +3819,7 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_3& p, const Point_3& q, - const Point_3& r, const Point_3& t, - RT_sufficient = {}) const + const Point_3& r, const Point_3& t) const { // p,q,r,t are supposed to be coplanar. // p,q,r determine an orientation of this plane (not collinear). @@ -4209,20 +4206,19 @@ namespace CartesianKernelFunctors { public: typedef typename K::Orientation result_type; - result_type operator()(const Point_2& p, const Point_2& q, const Point_2& r, - RT_sufficient = {}) const + result_type 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 - operator()(const Vector_2& u, const Vector_2& v, RT_sufficient = {}) const + operator()(const Vector_2& u, const Vector_2& v) const { return orientationC2(u.x(), u.y(), v.x(), v.y()); } result_type - operator()(const Circle_2& c, RT_sufficient = {}) const + operator()(const Circle_2& c) const { return c.rep().orientation(); } @@ -4240,7 +4236,7 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_3& p, const Point_3& q, - const Point_3& r, const Point_3& s, RT_sufficient = {}) const + const Point_3& r, const Point_3& s) const { return orientationC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), @@ -4249,8 +4245,7 @@ namespace CartesianKernelFunctors { } result_type - operator()( const Vector_3& u, const Vector_3& v, const Vector_3& w, - RT_sufficient = {}) const + operator()( const Vector_3& u, const Vector_3& v, const Vector_3& w) const { return orientationC3(u.x(), u.y(), u.z(), v.x(), v.y(), v.z(), @@ -4259,7 +4254,7 @@ namespace CartesianKernelFunctors { result_type operator()( Origin, const Point_3& u, - const Point_3& v, const Point_3& w, RT_sufficient = {}) const + const Point_3& v, const Point_3& w) const { return orientationC3(u.x(), u.y(), u.z(), v.x(), v.y(), v.z(), @@ -4267,13 +4262,13 @@ namespace CartesianKernelFunctors { } result_type - operator()( const Tetrahedron_3& t, RT_sufficient = {}) const + operator()( const Tetrahedron_3& t) const { return t.rep().orientation(); } result_type - operator()(const Sphere_3& s, RT_sufficient = {}) const + operator()(const Sphere_3& s) const { return s.rep().orientation(); } @@ -4291,8 +4286,7 @@ namespace CartesianKernelFunctors { Oriented_side operator()(const Weighted_point_2& p, const Weighted_point_2& q, const Weighted_point_2& r, - const Weighted_point_2& t, - RT_sufficient = {}) const + const Weighted_point_2& t) const { //CGAL_kernel_precondition( ! collinear(p, q, r) ); return power_side_of_oriented_power_circleC2(p.x(), p.y(), p.weight(), @@ -4313,8 +4307,7 @@ namespace CartesianKernelFunctors { Oriented_side operator()(const Weighted_point_2& p, const Weighted_point_2& q, - const Weighted_point_2& t, - RT_sufficient = {}) const + const Weighted_point_2& t) const { //CGAL_kernel_precondition( collinear(p, q, r) ); //CGAL_kernel_precondition( p.point() != q.point() ); @@ -4324,8 +4317,7 @@ namespace CartesianKernelFunctors { } Oriented_side operator()(const Weighted_point_2& p, - const Weighted_point_2& t, - RT_sufficient = {}) const + const Weighted_point_2& t) const { //CGAL_kernel_precondition( p.point() == r.point() ); Comparison_result r = CGAL::compare(p.weight(), t.weight()); @@ -4414,8 +4406,7 @@ namespace CartesianKernelFunctors { typedef typename K::Bounded_side result_type; result_type - operator()( const Point_2& p, const Point_2& q, const Point_2& t, - RT_sufficient = {}) const + operator()( const Point_2& p, const Point_2& q, const Point_2& t) const { return side_of_bounded_circleC2(p.x(), p.y(), q.x(), q.y(), @@ -4424,8 +4415,7 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_2& p, const Point_2& q, - const Point_2& r, const Point_2& t, - RT_sufficient = {}) const + const Point_2& r, const Point_2& t) const { return side_of_bounded_circleC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y(), t.x(), t.y()); @@ -4440,8 +4430,7 @@ namespace CartesianKernelFunctors { typedef typename K::Bounded_side result_type; result_type - operator()( const Point_3& p, const Point_3& q, const Point_3& test, - RT_sufficient = {}) const + 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(), q.x(), q.y(), q.z(), @@ -4450,8 +4439,7 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_3& p, const Point_3& q, - const Point_3& r, const Point_3& test, - RT_sufficient = {}) const + const Point_3& r, const Point_3& test) const { return side_of_bounded_sphereC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), @@ -4461,8 +4449,7 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_3& p, const Point_3& q, const Point_3& r, - const Point_3& s, const Point_3& test, - RT_sufficient = {}) const + const Point_3& s, const Point_3& test) const { return side_of_bounded_sphereC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), @@ -4481,8 +4468,7 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_2& p, const Point_2& q, - const Point_2& r, const Point_2& t, - RT_sufficient = {}) const + const Point_2& r, const Point_2& t) const { return side_of_oriented_circleC2(p.x(), p.y(), q.x(), q.y(), @@ -4500,8 +4486,7 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_3& p, const Point_3& q, const Point_3& r, - const Point_3& s, const Point_3& test, - RT_sufficient = {}) const + const Point_3& s, const Point_3& test) const { return side_of_oriented_sphereC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), diff --git a/Filtered_kernel/include/CGAL/Filtered_predicate.h b/Filtered_kernel/include/CGAL/Filtered_predicate.h index f7ea91355aa..bf3cfdcf21c 100644 --- a/Filtered_kernel/include/CGAL/Filtered_predicate.h +++ b/Filtered_kernel/include/CGAL/Filtered_predicate.h @@ -129,9 +129,10 @@ public: using result_type = typename EP_FT::result_type; template - struct Call_operator_needs_FT { + struct Call_operator_needs_FT + { // This type traits class checks if the call operator can be called with - // `(const Args&..., RT_sufficient())`. + // `(const Args&..., FT_necessary())`. using ArrayOfOne = char[1]; using ArrayOfTwo = char[2]; @@ -139,21 +140,21 @@ public: template static auto test(const Args2 &...args) - -> decltype(ap(c2a(args)..., RT_sufficient()), + -> decltype(ap(c2a(args)..., FT_necessary()), std::declval()); - enum { value = sizeof(test(std::declval()...)) == sizeof(ArrayOfOne) }; + enum { value = sizeof(test(std::declval()...)) == sizeof(ArrayOfTwo) }; }; // ## Important note // - // If you want to remove of rename that member function template `needs_ft`, + // If you want to remove of rename that member function template `needs_FT`, // please also change the lines with - // `CGAL_GENERATE_MEMBER_DETECTOR(needs_ft);` - // or `has_needs_ft` in + // `CGAL_GENERATE_MEMBER_DETECTOR(needs_FT);` + // or `has_needs_FT` in // the file `Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h`. template - constexpr bool needs_ft(const Args&...) const { + constexpr bool needs_FT(const Args&...) const { return Call_operator_needs_FT::value; } diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 2e8530166d9..417bab778d8 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -339,8 +339,7 @@ namespace CommonKernelFunctors { Comparison_result operator()(const Point_3 & p, const Weighted_point_3 & q, - const Weighted_point_3 & r, - RT_sufficient = {}) const + const Weighted_point_3 & r) const { return compare_power_distanceC3(p.x(), p.y(), p.z(), q.x(), q.y(), q.z(), q.weight(), @@ -515,8 +514,7 @@ namespace CommonKernelFunctors { const Weighted_point_3 & q, const Weighted_point_3 & r, const Weighted_point_3 & s, - const Weighted_point_3 & t, - RT_sufficient = {}) const + const Weighted_point_3 & t) const { return power_side_of_oriented_power_sphereC3(p.x(), p.y(), p.z(), p.weight(), q.x(), q.y(), q.z(), q.weight(), @@ -538,8 +536,7 @@ namespace CommonKernelFunctors { Oriented_side operator()(const Weighted_point_3 & p, const Weighted_point_3 & q, const Weighted_point_3 & r, - const Weighted_point_3 & s, - RT_sufficient = {}) const + const Weighted_point_3 & s) const { //CGAL_kernel_precondition( coplanar(p, q, r, s) ); //CGAL_kernel_precondition( !collinear(p, q, r) ); @@ -551,8 +548,7 @@ namespace CommonKernelFunctors { Oriented_side operator()(const Weighted_point_3 & p, const Weighted_point_3 & q, - const Weighted_point_3 & r, - RT_sufficient = {}) const + const Weighted_point_3 & r) const { //CGAL_kernel_precondition( collinear(p, q, r) ); //CGAL_kernel_precondition( p.point() != q.point() ); @@ -562,8 +558,7 @@ namespace CommonKernelFunctors { } Oriented_side operator()(const Weighted_point_3 & p, - const Weighted_point_3 & q, - RT_sufficient = {}) const + const Weighted_point_3 & q) const { //CGAL_kernel_precondition( p.point() == r.point() ); return power_side_of_oriented_power_sphereC3(p.weight(),q.weight()); @@ -824,14 +819,14 @@ namespace CommonKernelFunctors { template result_type - operator()(const T1& p, const T2& q, const FT& d2) const + operator()(const T1& p, const T2& q, const FT& d2, FT_necessary = {}) const { return CGAL::compare(internal::squared_distance(p, q, K()), d2); } template - std::enable_if_t< !std::is_same::value, result_type > - operator()(const T1& p, const T2& q, const T3& r, const T4& s) const + std::enable_if_t::value, result_type> + operator()(const T1& p, const T2& q, const T3& r, const T4& s, FT_necessary = {}) const { return CGAL::compare(internal::squared_distance(p, q, K()), internal::squared_distance(r, s, K())); @@ -853,7 +848,7 @@ namespace CommonKernelFunctors { } template - std::enable_if_t< !std::is_same::value, result_type > + result_type operator()(const T1& p, const T2& q, const T3& r, const T4& s) const { return CGAL::compare(internal::squared_distance(p, q, K()), @@ -2996,8 +2991,7 @@ namespace CommonKernelFunctors { result_type operator()( const Point_3& p, const Point_3& q, - const Point_3& r, const Point_3& s, - RT_sufficient = {}) const + const Point_3& r, const Point_3& s) const { return o(p, q, r, s) == COPLANAR; } @@ -3041,13 +3035,12 @@ namespace CommonKernelFunctors { template result_type - operator()(const T1& t1, const T2& t2, RT_sufficient = {}) const + 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, - RT_sufficient = {}) const + const typename K::Plane_3& pl3) const { return Intersections::internal::do_intersect(pl1, pl2, pl3, K()); } @@ -3668,39 +3661,39 @@ namespace CommonKernelFunctors { typedef typename K::Boolean result_type; result_type - operator()( const Iso_cuboid_3& c, RT_sufficient = {}) const + operator()( const Iso_cuboid_3& c) const { return c.rep().is_degenerate(); } result_type - operator()( const Line_3& l, RT_sufficient = {}) const + operator()( const Line_3& l) const { return l.rep().is_degenerate(); } result_type - operator()( const Plane_3& pl, RT_sufficient = {}) const + operator()( const Plane_3& pl) const { return pl.rep().is_degenerate(); } result_type - operator()( const Ray_3& r, RT_sufficient = {}) const + operator()( const Ray_3& r) const { return r.rep().is_degenerate(); } result_type - operator()( const Segment_3& s, RT_sufficient = {}) const + operator()( const Segment_3& s) const { return s.rep().is_degenerate(); } result_type - operator()( const Sphere_3& s, RT_sufficient = {}) const + operator()( const Sphere_3& s) const { return s.rep().is_degenerate(); } result_type - operator()( const Triangle_3& t, RT_sufficient = {}) const + operator()( const Triangle_3& t) const { return t.rep().is_degenerate(); } result_type - operator()( const Tetrahedron_3& t, RT_sufficient = {}) const + operator()( const Tetrahedron_3& t) const { return t.rep().is_degenerate(); } result_type - operator()( const Circle_3& t, RT_sufficient = {}) const + operator()( const Circle_3& t) const { return t.rep().is_degenerate(); } }; 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 353bcaea13d..9f9896ac7eb 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 @@ -1021,7 +1021,7 @@ public: struct Collinear_2 { typedef typename R::Boolean result_type; - bool operator()(const Point_2& p, const Point_2& q, const Point_2& r, RT_sufficient = {}) const + bool operator()(const Point_2& p, const Point_2& q, const Point_2& r) const { Orientation_2 ori; return ori(p,q,r) == COLLINEAR; diff --git a/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp b/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp index 0434a8f8a3c..b47ac7e12e3 100644 --- a/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp +++ b/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp @@ -14,9 +14,8 @@ // // Author(s) : Sylvain Pion -// This defines removes the operator/ from CGAL::Mpzf, to check that functors -// declared with CGAL_Kernel_pred_RT in interface_macros.h really only need -// a RT (ring type), without division. +// This defines removes the operator/ from CGAL::Mpzf to check that functors not using +// the tag`FT_necessary` really only need a RT (ring type) without division. #define CGAL_NO_MPZF_DIVISION_OPERATOR 1 #include diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h index d380a39d697..4daf22f0f3d 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h @@ -26,7 +26,7 @@ #include -CGAL_GENERATE_MEMBER_DETECTOR(needs_ft); +CGAL_GENERATE_MEMBER_DETECTOR(needs_FT); using CGAL::internal::use; @@ -613,15 +613,15 @@ test_new_3(const R& rep) tmp34ab = compare_dist(p1, p2, p3, p4); tmp34ab = compare_dist(l2, p1, p1); if constexpr (R::Has_filtered_predicates && - has_needs_ft::value) + has_needs_FT::value) { - assert(!compare_dist.needs_ft(p1, p2, p3)); - assert(!compare_dist.needs_ft(p2, s2, s2)); - assert(!compare_dist.needs_ft(p2, p2, s2)); - assert(!compare_dist.needs_ft(p1, s2, p2)); - assert(compare_dist.needs_ft(l1, p1, p1)); - assert(compare_dist.needs_ft(p2, p3, p2, p3)); - assert(compare_dist.needs_ft(p2, s2, l1, s2)); + assert(!compare_dist.needs_FT(p1, p2, p3)); + assert(!compare_dist.needs_FT(p2, s2, s2)); + assert(!compare_dist.needs_FT(p2, p2, s2)); + assert(!compare_dist.needs_FT(p1, s2, p2)); + assert(compare_dist.needs_FT(l1, p1, p1)); + assert(compare_dist.needs_FT(p2, p3, p2, p3)); + assert(compare_dist.needs_FT(p2, s2, l1, s2)); } (void) tmp34ab; diff --git a/Kernel_23/test/Kernel_23/include/atomic_RT_FT_predicate_headers.h b/Kernel_23/test/Kernel_23/include/atomic_RT_FT_predicate_headers.h index f3d3b43a485..85d4dcb8c49 100644 --- a/Kernel_23/test/Kernel_23/include/atomic_RT_FT_predicate_headers.h +++ b/Kernel_23/test/Kernel_23/include/atomic_RT_FT_predicate_headers.h @@ -15,7 +15,7 @@ namespace Kernel_23_tests { struct Any { template ::value>::type> + typename = typename std::enable_if::value>::type> operator T(); }; diff --git a/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp index 322c7752300..31f76e6aa6e 100644 --- a/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp +++ b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp @@ -9,7 +9,7 @@ #include // 0, nothing -// > 0, print RT_sufficient errors and successes +// > 0, print RT_sufficient/FT_necessary errors and successes // > 1, same as above + predicate being tested // > 2, same as above + some general indications on what is going on // > 4, same as above + even more indications on what is going on @@ -78,8 +78,8 @@ std::string parameter_with_namespace(const std::string& FT_name, { if(o == "Any") return "CGAL::Kernel_23_tests::Any"; - else if(o == "RT_sufficient") - return "CGAL::RT_sufficient"; + else if(o == "FT_necessary") + return "CGAL::FT_necessary"; else if(o == "FT") return "K::FT"; else @@ -259,81 +259,81 @@ Arity_test_result test_arity(const std::string& predicate_name, return Arity_test_result::NO_MATCH; } -bool ensure_RT_sufficient_is_present(const std::string& predicate_name, - // intentional copy, don't want to pollute the parameters with `RT_sufficient` - std::vector parameters) +bool ensure_FT_necessary_is_present(const std::string& predicate_name, + // intentional copy, don't want to pollute the parameters with `FT_necessary` + std::vector parameters) { #if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) std::cout << predicate_name << "("; for(std::size_t j=0, i=parameters.size(); j 0) - std::cout << predicate_name << "("; - for(std::size_t j=0, i=parameters.size() - 1; j 0) - std::cerr << "Error: this predicate is RT_sufficient, but the tag is missing!\n" << std::endl; -#endif - return false; - } - else - { -#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 0) - std::cout << "... and the tag is properly set!\n" << std::endl; -#endif - return true; - } -} - -bool ensure_RT_sufficient_is_NOT_present(const std::string& predicate_name, - // intentional copy, don't want to pollute the parameters with `RT_sufficient` - std::vector parameters) -{ -#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) - std::cout << predicate_name << "("; - for(std::size_t j=0, i=parameters.size(); j 0) std::cout << predicate_name << "("; - for(std::size_t j=0, i=parameters.size() - 1; j 0) - std::cerr << "Error: this predicate is NOT RT_sufficient, but the tag is present!\n" << std::endl; + std::cerr << "Error: this predicate is `FT_necessary`, but the tag is missing!\n" << std::endl; #endif return false; } else { #if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 0) - std::cout << "... and the tag is (correctly) absent!\n" << std::endl; + std::cout << "... and the tag `FT_necessary` is correctly present!\n" << std::endl; +#endif + return true; + } +} + +bool ensure_FT_necessary_is_NOT_present(const std::string& predicate_name, + // intentional copy, don't want to pollute the parameters with `RT_sufficient` + std::vector parameters) +{ +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) + std::cout << predicate_name << "("; + for(std::size_t j=0, i=parameters.size(); j 0) + std::cout << predicate_name << "("; + for(std::size_t j=0, i=parameters.size() - 1; j 0) + std::cerr << "Error: this predicate is NOT 'FT_necessary', but the tag is present!\n" << std::endl; +#endif + return false; + } + else + { +#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 0) + std::cout << "... and the tag `FT_necessary` is (correctly) absent!\n" << std::endl; #endif return true; } @@ -370,15 +370,15 @@ void test_predicate(const std::string& predicate_name, // See if we can already conclude on the current parameter list // - if that successful compiles, then it is RT_sufficient - // - call to deleted operator, this means FT_necessary + // - call to deleted or missing division operator, this means FT_necessary // - any other error, this combination of parameters was not a valid input for the predicate if(res == SUCCESSFUL) { - ensure_RT_sufficient_is_present(predicate_name, parameters); + ensure_FT_necessary_is_NOT_present(predicate_name, parameters); } else if(res == FAILED_NO_DIVISION_OPERATOR) { - ensure_RT_sufficient_is_NOT_present(predicate_name, parameters); + ensure_FT_necessary_is_present(predicate_name, parameters); } if(res == FAILED_AMBIGUOUS_CALL && object_pos != last) @@ -437,12 +437,12 @@ void test_predicate(const std::string& predicate_name) if(res == Arity_test_result::RT_SUFFICIENT) { std::vector parameters(i, "Any"); - ensure_RT_sufficient_is_present(predicate_name, parameters); + ensure_FT_necessary_is_NOT_present(predicate_name, parameters); } else if(res == Arity_test_result::FT_NECESSARY) { std::vector parameters(i, "Any"); - ensure_RT_sufficient_is_NOT_present(predicate_name, parameters); + ensure_FT_necessary_is_present(predicate_name, parameters); } else if(res == Arity_test_result::EXPLORATION_REQUIRED) { diff --git a/STL_Extension/include/CGAL/tags.h b/STL_Extension/include/CGAL/tags.h index d0dca45ac86..dd13818aae9 100644 --- a/STL_Extension/include/CGAL/tags.h +++ b/STL_Extension/include/CGAL/tags.h @@ -81,8 +81,8 @@ Assert_compile_time_tag( const Tag&, const Derived& b) x.match_compile_time_tag(b); } -// for Cartesian_kernel/include/CGAL/Cartesian/function_objects.h -struct RT_sufficient {}; +// for kernel predicates, to indicate a FT providing a division operator is required +struct FT_necessary {}; } //namespace CGAL From 873cc884b50c4df92577825732dbbb560f3ec745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 22 Sep 2022 12:03:25 +0200 Subject: [PATCH 15/39] Get rid of _RT / _RT_FT kernel interface macros --- .../include/CGAL/Filtered_kernel.h | 10 +-- .../include/CGAL/Kernel/interface_macros.h | 86 ++++++++----------- .../Kernel_23/test_RT_or_FT_predicates.cpp | 2 - 3 files changed, 36 insertions(+), 62 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel.h b/Filtered_kernel/include/CGAL/Filtered_kernel.h index 9d7493d68a3..182ba3c4d99 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel.h @@ -81,14 +81,6 @@ struct Filtered_kernel_base Approximate_kernel approximate_kernel() const { return {}; } // We change the predicates. -// #define CGAL_Kernel_pred(P, Pf) \ -// typedef Filtered_predicate P; \ -// P Pf() const { return P(); } - -// #define CGAL_Kernel_pred_RT(P, Pf) \ -// typedef Filtered_predicate P; \ -// P Pf() const { return P(); } - #define CGAL_Kernel_pred_RT_or_FT(P, Pf) \ typedef Filtered_predicate_RT_FT P; \ P Pf() const { return P(); } -#define CGAL_Kernel_pred_RT(P, Pf) CGAL_Kernel_pred_RT_or_FT(P, Pf) + #define CGAL_Kernel_pred(P, Pf) CGAL_Kernel_pred_RT_or_FT(P, Pf) // We don't touch the constructions. diff --git a/Kernel_23/include/CGAL/Kernel/interface_macros.h b/Kernel_23/include/CGAL/Kernel/interface_macros.h index a6e04b7fe95..9c85643a977 100644 --- a/Kernel_23/include/CGAL/Kernel/interface_macros.h +++ b/Kernel_23/include/CGAL/Kernel/interface_macros.h @@ -26,20 +26,6 @@ # define CGAL_Kernel_pred(X, Y) #endif -// Those predicates for which Simple_cartesian is guaranteed not to use -// any division. -#ifndef CGAL_Kernel_pred_RT -# define CGAL_Kernel_pred_RT(X, Y) CGAL_Kernel_pred(X, Y) -#endif - -// Those predicates for which Simple_cartesian maybe use division of not. -// Predicates that do not require the division must have `RT_sufficient` as last -// argument, with a default. See for example `Compare_distance_3` in the file -// Cartesian_kernel/include/CGAL/Cartesian/function_objects.h -#ifndef CGAL_Kernel_pred_RT_or_FT -# define CGAL_Kernel_pred_RT_or_FT(X, Y) CGAL_Kernel_pred(X, Y) -#endif - #ifndef CGAL_Kernel_cons # define CGAL_Kernel_cons(X, Y) #endif @@ -108,22 +94,22 @@ CGAL_Kernel_pred(Collinear_are_strictly_ordered_along_line_3, collinear_are_strictly_ordered_along_line_3_object) CGAL_Kernel_pred(Collinear_has_on_2, collinear_has_on_2_object) -CGAL_Kernel_pred_RT(Collinear_2, - collinear_2_object) -CGAL_Kernel_pred_RT(Collinear_3, - collinear_3_object) +CGAL_Kernel_pred(Collinear_2, + collinear_2_object) +CGAL_Kernel_pred(Collinear_3, + collinear_3_object) CGAL_Kernel_pred(Compare_angle_with_x_axis_2, compare_angle_with_x_axis_2_object) CGAL_Kernel_pred(Compare_dihedral_angle_3, compare_dihedral_angle_3_object) CGAL_Kernel_pred(Compare_distance_2, compare_distance_2_object) -CGAL_Kernel_pred_RT_or_FT(Compare_distance_3, - compare_distance_3_object) -CGAL_Kernel_pred_RT(Compare_power_distance_2, - compare_power_distance_2_object) -CGAL_Kernel_pred_RT(Compare_power_distance_3, - compare_power_distance_3_object) +CGAL_Kernel_pred(Compare_distance_3, + compare_distance_3_object) +CGAL_Kernel_pred(Compare_power_distance_2, + compare_power_distance_2_object) +CGAL_Kernel_pred(Compare_power_distance_3, + compare_power_distance_3_object) CGAL_Kernel_pred(Compare_signed_distance_to_line_2, compare_signed_distance_to_line_2_object) CGAL_Kernel_pred(Compare_slope_2, @@ -494,18 +480,18 @@ CGAL_Kernel_cons(Construct_cartesian_const_iterator_2, construct_cartesian_const_iterator_2_object) CGAL_Kernel_cons(Construct_cartesian_const_iterator_3, construct_cartesian_const_iterator_3_object) -CGAL_Kernel_pred_RT(Coplanar_orientation_3, - coplanar_orientation_3_object) -CGAL_Kernel_pred_RT(Coplanar_side_of_bounded_circle_3, - coplanar_side_of_bounded_circle_3_object) -CGAL_Kernel_pred_RT(Coplanar_3, +CGAL_Kernel_pred(Coplanar_orientation_3, + coplanar_orientation_3_object) +CGAL_Kernel_pred(Coplanar_side_of_bounded_circle_3, + coplanar_side_of_bounded_circle_3_object) +CGAL_Kernel_pred(Coplanar_3, coplanar_3_object) CGAL_Kernel_pred(Counterclockwise_in_between_2, counterclockwise_in_between_2_object) CGAL_Kernel_pred(Do_intersect_2, do_intersect_2_object) -CGAL_Kernel_pred_RT(Do_intersect_3, - do_intersect_3_object) +CGAL_Kernel_pred(Do_intersect_3, + do_intersect_3_object) CGAL_Kernel_pred(Equal_xy_3, equal_xy_3_object) CGAL_Kernel_pred(Equal_x_2, @@ -554,8 +540,8 @@ CGAL_Kernel_cons(Intersect_point_3_for_polyhedral_envelope, intersect_point_3_for_polyhedral_envelope_object) CGAL_Kernel_pred(Is_degenerate_2, is_degenerate_2_object) -CGAL_Kernel_pred_RT(Is_degenerate_3, - is_degenerate_3_object) +CGAL_Kernel_pred(Is_degenerate_3, + is_degenerate_3_object) CGAL_Kernel_pred(Is_horizontal_2, is_horizontal_2_object) CGAL_Kernel_pred(Is_vertical_2, @@ -592,10 +578,10 @@ CGAL_Kernel_pred(Less_z_3, less_z_3_object) CGAL_Kernel_pred(Non_zero_coordinate_index_3, non_zero_coordinate_index_3_object) -CGAL_Kernel_pred_RT(Orientation_2, - orientation_2_object) -CGAL_Kernel_pred_RT(Orientation_3, - orientation_3_object) +CGAL_Kernel_pred(Orientation_2, + orientation_2_object) +CGAL_Kernel_pred(Orientation_3, + orientation_3_object) CGAL_Kernel_pred(Oriented_side_2, oriented_side_2_object) CGAL_Kernel_pred(Oriented_side_3, @@ -604,21 +590,19 @@ CGAL_Kernel_pred(Power_side_of_bounded_power_circle_2, power_side_of_bounded_power_circle_2_object) CGAL_Kernel_pred(Power_side_of_bounded_power_sphere_3, power_side_of_bounded_power_sphere_3_object) -CGAL_Kernel_pred_RT(Power_side_of_oriented_power_circle_2, - power_side_of_oriented_power_circle_2_object) -CGAL_Kernel_pred_RT(Power_side_of_oriented_power_sphere_3, - power_side_of_oriented_power_sphere_3_object) -CGAL_Kernel_pred_RT(Side_of_bounded_circle_2, - side_of_bounded_circle_2_object) -CGAL_Kernel_pred_RT(Side_of_bounded_sphere_3, - side_of_bounded_sphere_3_object) -CGAL_Kernel_pred_RT(Side_of_oriented_circle_2, - side_of_oriented_circle_2_object) -CGAL_Kernel_pred_RT(Side_of_oriented_sphere_3, - side_of_oriented_sphere_3_object) +CGAL_Kernel_pred(Power_side_of_oriented_power_circle_2, + power_side_of_oriented_power_circle_2_object) +CGAL_Kernel_pred(Power_side_of_oriented_power_sphere_3, + power_side_of_oriented_power_sphere_3_object) +CGAL_Kernel_pred(Side_of_bounded_circle_2, + side_of_bounded_circle_2_object) +CGAL_Kernel_pred(Side_of_bounded_sphere_3, + side_of_bounded_sphere_3_object) +CGAL_Kernel_pred(Side_of_oriented_circle_2, + side_of_oriented_circle_2_object) +CGAL_Kernel_pred(Side_of_oriented_sphere_3, + side_of_oriented_sphere_3_object) -#undef CGAL_Kernel_pred_RT_or_FT -#undef CGAL_Kernel_pred_RT #undef CGAL_Kernel_pred #undef CGAL_Kernel_cons #undef CGAL_Kernel_obj diff --git a/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp index 31f76e6aa6e..ed0d63f7eef 100644 --- a/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp +++ b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp @@ -455,8 +455,6 @@ int main(int , char** ) { // Get the predicates #define CGAL_Kernel_pred(X, Y) predicates_types.push_back(#X); - #define CGAL_Kernel_pred_RT(X, Y) predicates_types.push_back(#X); - #define CGAL_Kernel_pred_RT_or_FT(X, Y) predicates_types.push_back(#X); #include // Get the objects From c93e33c731d0032425dfa3e3ec6dab7115fa12f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 22 Sep 2022 12:06:09 +0200 Subject: [PATCH 16/39] Misc minor cleaning/improvements to RT|FT kernel test --- Kernel_23/test/Kernel_23/CMakeLists.txt | 4 +-- .../Kernel_23/test_RT_or_FT_predicates.cpp | 35 +++++++++++-------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/Kernel_23/test/Kernel_23/CMakeLists.txt b/Kernel_23/test/Kernel_23/CMakeLists.txt index 0d413d701ff..c194a833079 100644 --- a/Kernel_23/test/Kernel_23/CMakeLists.txt +++ b/Kernel_23/test/Kernel_23/CMakeLists.txt @@ -35,8 +35,8 @@ create_single_source_cgal_program("test_Projection_traits_xy_3_Intersect_2.cpp") set(CGAL_KERNEL_23_TEST_RT_FT_PREDICATE_FLAGS ON) if(CGAL_KERNEL_23_TEST_RT_FT_PREDICATE_FLAGS) - # expensive because of templated operators creating a lot of possible combinations - add_definitions(-DCGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_COMPARE_DISTANCES) + # templated operators create a lot of possible combinations, which is expensive to test + add_definitions(-DCGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_PREDICATES_WITH_TEMPLATED_OPERATORS) create_single_source_cgal_program("atomic_compilation_test.cpp") create_single_source_cgal_program("test_RT_or_FT_predicates.cpp") diff --git a/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp index ed0d63f7eef..d1e3eb3b585 100644 --- a/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp +++ b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp @@ -16,15 +16,15 @@ // > 8, everything #define CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY 8 -std::vector predicates_types = { }; +std::vector predicates_types = { "Angle_2" }; -// @todo, technically somebody might in the future create predicates with non kernel objects (nor FT). -// In that case, they'd have to be added to these lists since there is no scrapping of the predicate -// arguments but rather try all combinations of objects from these lists. -std::vector object_types_2 = { "FT" }; -std::vector object_types_3 = { "FT" }; +// @todo, technically somebody could create predicates with non-kernel objects (nor FT/Origin), e.g. `int`. +// In that case, these arguments would have to be added to the lists below since there is no scrapping +// of the predicate arguments, but simply trying all combinations of objects from these lists. +std::vector object_types_2 = { "FT", "Origin" }; +std::vector object_types_3 = { "FT", "Origin" }; -// @todo potential operator()s with more than MAX_ARITY are not tested +// @todo potential operator()s with fewer than MIN_ARITY and more than MAX_ARITY are not tested constexpr std::size_t MIN_ARITY = 0; constexpr std::size_t MAX_ARITY = 12; @@ -82,6 +82,8 @@ std::string parameter_with_namespace(const std::string& FT_name, return "CGAL::FT_necessary"; else if(o == "FT") return "K::FT"; + else if(o == "Origin") + return "CGAL::Origin"; else return "CGAL::" + o + "<" + kernel_with_FT(FT_name) + " >"; } @@ -113,7 +115,7 @@ Compilation_result parse_output(const std::string& predicate_name, return UNKNOWN; } -#ifdef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_COMPARE_DISTANCES +#ifdef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_PREDICATES_WITH_TEMPLATED_OPERATORS // Compare_(squared)_distance_23 have templated operator()s, which are a lot of combinations to test. // In templated operator()s, the compare is simply a call to squared_distance()s and a CGAL::compare(). // Below prunes some exploration branches in case the first squared_distance() call does not even compile. @@ -142,7 +144,7 @@ Compilation_result parse_output(const std::string& predicate_name, } else if(line.find("too many arguments") != std::string::npos) { // @todo what is that exact error? res = FAILED_NO_MATCH; break; -#ifdef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_COMPARE_DISTANCES +#ifdef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_PREDICATES_WITH_TEMPLATED_OPERATORS } else if(prune_compare_distance_branches && parameters.size() > 1 && parameters[0] != "Any" && parameters[1] != "Any" && line.find(std::string{"no matching function for call to ‘squared_distance(const " + @@ -168,7 +170,8 @@ Compilation_result parse_output(const std::string& predicate_name, res = SUCCESSFUL; break; } else if(line.find("undefined reference") != std::string::npos) { - res = SUCCESSFUL; // @todo should it be a different value? + // Can happen because the conversion Any -> kernel object is not implemented + res = SUCCESSFUL; break; } } @@ -353,10 +356,11 @@ void test_predicate(const std::string& predicate_name, for(const std::string& object_type : object_types) { -#ifdef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_COMPARE_DISTANCES +#ifdef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_PREDICATES_WITH_TEMPLATED_OPERATORS // This pruning could be done for other predicates, but they're not as expensive so it doesn't matter if((predicate_name == "Compare_distance_2" || predicate_name == "Compare_distance_3" || - predicate_name == "Compare_squared_distance_2" || predicate_name == "Compare_squared_distance_3") && + predicate_name == "Compare_squared_distance_2" || predicate_name == "Compare_squared_distance_3" || + predicate_name == "Do_intersect_2" || predicate_name == "Do_intersect_3") && object_type == "FT") { continue; @@ -420,12 +424,13 @@ void test_predicate(const std::string& predicate_name) std::cout << "\n\n=== Test predicate: " << predicate_name << "... ===" << std::endl; #endif -#ifndef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_COMPARE_DISTANCES +#ifndef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_PREDICATES_WITH_TEMPLATED_OPERATORS if(predicate_name == "Compare_distance_2" || predicate_name == "Compare_distance_3" || - predicate_name == "Compare_squared_distance_2" || predicate_name == "Compare_squared_distance_3") + predicate_name == "Compare_squared_distance_2" || predicate_name == "Compare_squared_distance_3" || + predicate_name == "Do_intersect_2" || predicate_name == "Do_intersect_3") { #if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 1) - std::cout << "Skipping because 'CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_COMPARE_DISTANCES' is not defined!" << std::endl; + std::cout << "Skipping because 'CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_PREDICATES_WITH_TEMPLATED_OPERATORS' is not defined!" << std::endl; #endif return; } From ae30bcf8190e11d60706846b6dea5fb7b2aea7a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 22 Sep 2022 12:25:25 +0200 Subject: [PATCH 17/39] Remove obsolete RT/FT tests --- Kernel_23/test/Kernel_23/CMakeLists.txt | 2 - .../kernel_detect_predicates_arity.cpp | 94 ------------------- .../test/Kernel_23/test_predicate_with_RT.cpp | 35 ------- 3 files changed, 131 deletions(-) delete mode 100644 Kernel_23/test/Kernel_23/kernel_detect_predicates_arity.cpp delete mode 100644 Kernel_23/test/Kernel_23/test_predicate_with_RT.cpp diff --git a/Kernel_23/test/Kernel_23/CMakeLists.txt b/Kernel_23/test/Kernel_23/CMakeLists.txt index c194a833079..4f1021c49c4 100644 --- a/Kernel_23/test/Kernel_23/CMakeLists.txt +++ b/Kernel_23/test/Kernel_23/CMakeLists.txt @@ -15,7 +15,6 @@ create_single_source_cgal_program("Homogeneous.cpp") create_single_source_cgal_program("issue_129.cpp") create_single_source_cgal_program("issue_3301.cpp") create_single_source_cgal_program("Kernel_checker.cpp") -create_single_source_cgal_program("kernel_detect_predicates_arity.cpp") create_single_source_cgal_program("Lazy_kernel.cpp") create_single_source_cgal_program("origin_3.cpp") create_single_source_cgal_program("overload_bug.cpp") @@ -29,7 +28,6 @@ create_single_source_cgal_program("test_converter.cpp") create_single_source_cgal_program("test_Has_conversion.cpp") create_single_source_cgal_program("test_hash_functions.cpp") create_single_source_cgal_program("test_kernel__.cpp") -create_single_source_cgal_program("test_predicate_with_RT.cpp") create_single_source_cgal_program("test_projection_traits.cpp") create_single_source_cgal_program("test_Projection_traits_xy_3_Intersect_2.cpp") diff --git a/Kernel_23/test/Kernel_23/kernel_detect_predicates_arity.cpp b/Kernel_23/test/Kernel_23/kernel_detect_predicates_arity.cpp deleted file mode 100644 index aca12aa1b2a..00000000000 --- a/Kernel_23/test/Kernel_23/kernel_detect_predicates_arity.cpp +++ /dev/null @@ -1,94 +0,0 @@ -#define CGAL_NO_MPZF_DIVISION_OPERATOR 1 - -#include -#include - -using SCK = CGAL::Simple_cartesian; - -struct Any { - template operator const T&(); -}; - -template -void check_pred() { - std::cerr << std::is_invocable_v; - std::cerr << std::is_invocable_v; - std::cerr << std::is_invocable_v; - std::cerr << std::is_invocable_v; - std::cerr << std::is_invocable_v; - std::cerr << std::is_invocable_v; - std::cerr << std::is_invocable_v; - std::cerr << std::is_invocable_v; - - // The following asserts that no predicate from the kernel has more than - // 8 arguments (actually the assertions are only from 9 to 12 arguments). - static_assert(!std::is_invocable_v); - static_assert(!std::is_invocable_v); - static_assert(!std::is_invocable_v); - static_assert(!std::is_invocable_v); - std::cerr << '\n'; -} - -int main() -{ -#define CGAL_Kernel_pred(P, Pf) \ - std::cerr << #P << ": "; \ - check_pred(); -#include - - // Bug with predicates with multiple overload of the call operator with the - // same number of arguments: the call with `Any` is ambiguous. - static_assert(std::is_invocable_v); - static_assert(!std::is_invocable_v); // AMBIGUOUS CALL - static_assert(!std::is_invocable_v); // AMBIGUOUS CALL - return 0; -} - - -/* - -WORK IN PROGRESS: - -In the CGAL Kernel: - - 2D: 49 predicates - - 3D: 50 predicates - - -## Try to detect all possible types of arguments of predicates, from the doc - -``` -[lrineau@fernand]~/Git/cgal-master/build-doc/doc_output/Kernel_23/xml% grep -h ' ' classKernel_1_1(^(Construct|Compute|Assign)*).xml | sed 's/]*>//; s|||; s| &|\&|' | sed 's/Kernel::/K::/'| sort | uniq -c | sort -n | grep -v _3 -``` - -3D: (14 types of arguments) - -const K::Direction_3& -const K::Triangle_3& -const K::Circle_3& -const K::Ray_3& -const K::Segment_3& -const K::Iso_cuboid_3& -const K::Line_3& -const K::Tetrahedron_3& -const K::FT& -const K::Plane_3& -const K::Sphere_3& -const K::Vector_3& -const K::Weighted_point_3& -const K::Point_3& - -2D: (10 types arguments) - -const K::Vector_2& -const K::Direction_2& -const K::Iso_rectangle_2& -const K::Ray_2& -const K::Circle_2& -const K::Triangle_2& -const K::FT& -const K::Segment_2& -const K::Weighted_point_2& -const K::Line_2& -const K::Point_2& - -*/ diff --git a/Kernel_23/test/Kernel_23/test_predicate_with_RT.cpp b/Kernel_23/test/Kernel_23/test_predicate_with_RT.cpp deleted file mode 100644 index 68b833ece67..00000000000 --- a/Kernel_23/test/Kernel_23/test_predicate_with_RT.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#define CGAL_NO_MPZF_DIVISION_OPERATOR 1 - -#include -#include - -template -void test(const R& rep) { - using Point_3 = typename R::Point_3; - using Segment_3 = typename R::Segment_3; - using Line_3 = typename R::Line_3; - - auto construct_point = rep.construct_point_3_object(); - Point_3 p2 = construct_point(CGAL::ORIGIN); - Point_3 p3 = construct_point(1,1,1); - Point_3 p4 = construct_point(1,1,2); - Point_3 p5 = construct_point(1,2,3); - Point_3 p6 = construct_point(4,2,1); - - auto construct_segment = rep.construct_segment_3_object(); - Segment_3 s2 = construct_segment(p2,p3), s1 = s2; - - auto construct_line = rep.construct_line_3_object(); - Line_3 l2 = construct_line(p5,p6); - - auto compare_distance = rep.compare_distance_3_object(); - // compare_distance(p2, p2, p2); - compare_distance(p2, s2, p2); - // compare_distance(p2, l2, p2); -} - -int main() -{ - test(CGAL::Simple_cartesian()); - return 0; -} From 35295887967179e5f3040b7b09dc4fe95967b73b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 22 Sep 2022 21:41:02 +0200 Subject: [PATCH 18/39] Partial revert of 7c92341be777d7c295d3fa8010c34dc8b35eab16 (no C++17) --- Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake index 03dd6682c70..cf1a3bb37d4 100644 --- a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake @@ -97,9 +97,8 @@ function(CGAL_setup_CGAL_dependencies target) target_compile_definitions(${target} INTERFACE CGAL_TEST_SUITE=1) endif() - # CGAL now requires C++14. `decltype(auto)` is used as a marker of - # C++14. - target_compile_features(${target} INTERFACE cxx_std_17) + # CGAL now requires C++14. `decltype(auto)` is used as a marker of C++14. + target_compile_features(${target} INTERFACE cxx_decltype_auto) use_CGAL_Boost_support(${target} INTERFACE) From 24067447af55fcccb1d73c798a478b23b941aac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 23 Sep 2022 11:34:49 +0200 Subject: [PATCH 19/39] Make some predicates division-free --- .../include/CGAL/Cartesian/function_objects.h | 57 +++++++++++------- .../include/CGAL/constructions/kernel_ftC3.h | 60 ++++++++++--------- .../include/CGAL/predicates/kernel_ftC3.h | 11 ++-- 3 files changed, 73 insertions(+), 55 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index 46a1798d7da..ac1b8814f88 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -669,28 +669,34 @@ namespace CartesianKernelFunctors { result_type operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s, const FT& ft) const { - return CGAL::compare(squared_radiusC3(p.x(), p.y(), p.z(), - q.x(), q.y(), q.z(), - r.x(), r.y(), r.z(), - s.x(), s.y(), s.z() ), - ft); + FT num, den; + squared_radiusC3(p.x(), p.y(), p.z(), + q.x(), q.y(), q.z(), + r.x(), r.y(), r.z(), + s.x(), s.y(), s.z(), + num, den); + return CGAL::compare(num, den * ft); } result_type operator()(const Point_3& p, const Point_3& q, const Point_3& r, const FT& ft) const { - return CGAL::compare(squared_radiusC3(p.x(), p.y(), p.z(), - q.x(), q.y(), q.z(), - r.x(), r.y(), r.z()), - ft); + FT num, den; + squared_radiusC3(p.x(), p.y(), p.z(), + q.x(), q.y(), q.z(), + r.x(), r.y(), r.z(), + num, den); + return CGAL::compare(num, den * ft); } result_type operator()(const Point_3& p, const Point_3& q, const FT& ft) const { - return CGAL::compare(squared_radiusC3(p.x(), p.y(), p.z(), - q.x(), q.y(), q.z() ), - ft); + FT num, den; + squared_radiusC3(p.x(), p.y(), p.z(), + q.x(), q.y(), q.z(), + num, den); + return CGAL::compare(num, den * ft); } result_type @@ -1235,26 +1241,35 @@ namespace CartesianKernelFunctors { result_type operator()( const Point_3& p, const Point_3& q) const { - return squared_radiusC3(p.x(), p.y(), p.z(), - q.x(), q.y(), q.z()); + FT num, den; + squared_radiusC3(p.x(), p.y(), p.z(), + q.x(), q.y(), q.z(), + num, den); + return num / den; } result_type operator()( const Point_3& p, const Point_3& q, const Point_3& r) const { - return squared_radiusC3(p.x(), p.y(), p.z(), - q.x(), q.y(), q.z(), - r.x(), r.y(), r.z()); + FT num, den; + squared_radiusC3(p.x(), p.y(), p.z(), + q.x(), q.y(), q.z(), + r.x(), r.y(), r.z(), + num, den); + return num / den; } result_type operator()( const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s) const { - return squared_radiusC3(p.x(), p.y(), p.z(), - q.x(), q.y(), q.z(), - r.x(), r.y(), r.z(), - s.x(), s.y(), s.z()); + FT num, den; + squared_radiusC3(p.x(), p.y(), p.z(), + q.x(), q.y(), q.z(), + r.x(), r.y(), r.z(), + s.x(), s.y(), s.z(), + num, den); + return num / den; } }; diff --git a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC3.h b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC3.h index 77fe5d05e7c..dbc973138c5 100644 --- a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC3.h +++ b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC3.h @@ -142,11 +142,12 @@ centroidC3( const FT &px, const FT &py, const FT &pz, template < class FT > CGAL_KERNEL_MEDIUM_INLINE -FT +void squared_radiusC3(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, - const FT &sx, const FT &sy, const FT &sz) + const FT &qx, const FT &qy, const FT &qz, + const FT &rx, const FT &ry, const FT &rz, + const FT &sx, const FT &sy, const FT &sz, + FT &num, FT &den) { // Translate p to origin to simplify the expression. FT qpx = qx-px; @@ -163,29 +164,30 @@ squared_radiusC3(const FT &px, const FT &py, const FT &pz, FT sp2 = CGAL_NTS square(spx) + CGAL_NTS square(spy) + CGAL_NTS square(spz); FT num_x = determinant(qpy,qpz,qp2, - rpy,rpz,rp2, - spy,spz,sp2); + rpy,rpz,rp2, + spy,spz,sp2); FT num_y = determinant(qpx,qpz,qp2, - rpx,rpz,rp2, - spx,spz,sp2); + rpx,rpz,rp2, + spx,spz,sp2); FT num_z = determinant(qpx,qpy,qp2, - rpx,rpy,rp2, - spx,spy,sp2); - FT den = determinant(qpx,qpy,qpz, - rpx,rpy,rpz, - spx,spy,spz); - CGAL_kernel_assertion( ! CGAL_NTS is_zero(den) ); + rpx,rpy,rp2, + spx,spy,sp2); + FT dden = determinant(qpx,qpy,qpz, + rpx,rpy,rpz, + spx,spy,spz); + CGAL_kernel_assertion( ! CGAL_NTS is_zero(dden) ); - return (CGAL_NTS square(num_x) + CGAL_NTS square(num_y) - + CGAL_NTS square(num_z)) / CGAL_NTS square(2 * den); + num = CGAL_NTS square(num_x) + CGAL_NTS square(num_y) + CGAL_NTS square(num_z); + den = CGAL_NTS square(2 * dden); } template < class FT > CGAL_KERNEL_MEDIUM_INLINE -FT +void squared_radiusC3(const FT &px, const FT &py, const FT &pz, - const FT &qx, const FT &qy, const FT &qz, - const FT &sx, const FT &sy, const FT &sz) + const FT &qx, const FT &qy, const FT &qz, + const FT &sx, const FT &sy, const FT &sz, + FT &num, FT &den) { // Translate s to origin to simplify the expression. FT psx = px-sx; @@ -207,14 +209,14 @@ squared_radiusC3(const FT &px, const FT &py, const FT &pz, FT num_z = ps2 * determinant(qsx,qsy,rsx,rsy) - qs2 * determinant(psx,psy,rsx,rsy); - FT den = determinant(psx,psy,psz, - qsx,qsy,qsz, - rsx,rsy,rsz); + FT dden = determinant(psx,psy,psz, + qsx,qsy,qsz, + rsx,rsy,rsz); - CGAL_kernel_assertion( den != 0 ); + CGAL_kernel_assertion( dden != 0 ); - return (CGAL_NTS square(num_x) + CGAL_NTS square(num_y) - + CGAL_NTS square(num_z)) / CGAL_NTS square(2 * den); + num = CGAL_NTS square(num_x) + CGAL_NTS square(num_y) + CGAL_NTS square(num_z); + den = CGAL_NTS square(2 * dden); } template @@ -305,11 +307,13 @@ squared_distanceC3( const FT &px, const FT &py, const FT &pz, template < class FT > CGAL_KERNEL_INLINE -FT +void squared_radiusC3( const FT &px, const FT &py, const FT &pz, - const FT &qx, const FT &qy, const FT &qz) + const FT &qx, const FT &qy, const FT &qz, + FT &num, FT &den) { - return squared_distanceC3(px, py, pz, qx, qy, qz) / 4; + num = squared_distanceC3(px, py, pz, qx, qy, qz); + den = FT(4); } template < class FT > diff --git a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h index 8917cfaf36e..0bb67083388 100644 --- a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h +++ b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h @@ -764,20 +764,19 @@ power_side_of_bounded_power_sphereC3( const FT &rx, const FT &ry, const FT &rz, const FT &rw) { FT FT2(2); - FT FT4(4); FT dpx = px - qx; FT dpy = py - qy; FT dpz = pz - qz; FT dpw = pw - qw; FT dp2 = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) + CGAL_NTS square(dpz); - FT drx = rx - (px + qx)/FT2; - FT dry = ry - (py + qy)/FT2; - FT drz = rz - (pz + qz)/FT2; - FT drw = rw - (pw + qw)/FT2; + FT drx = FT2 * rx - (px + qx); + FT dry = FT2 * ry - (py + qy); + FT drz = FT2 * rz - (pz + qz); + FT drw = FT2 * rw - (pw + qw); FT dr2 = CGAL_NTS square(drx) + CGAL_NTS square(dry) + CGAL_NTS square(drz); FT dpr = dpx*drx + dpy*dry +dpz*drz; return enum_cast( - - CGAL_NTS sign (dr2 - dp2/FT4 + dpr*dpw/dp2 - drw )); + - CGAL_NTS sign (dr2*dp2 - dp2*dp2 + FT2*dpr*dpw - FT2*drw*dp2 )); } } // namespace CGAL From d0fe75e908a11f8399f0c914583150adb57cff25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 23 Sep 2022 11:35:12 +0200 Subject: [PATCH 20/39] Add missing FT_necessary tags --- .../include/CGAL/Cartesian/function_objects.h | 6 +++- .../include/CGAL/Kernel/function_objects.h | 29 ++++++++++--------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index ac1b8814f88..92aa3d6b4eb 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -445,6 +445,10 @@ namespace CartesianKernelFunctors { return cmp_dist_to_pointC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y()); } + // Slightly wkward, but not to get a false positive in the `test_RT_or_FT_predicate` + // as otherwise trying to compile P2,P2,P2,FT_necessary would match the T1,T2,T3 templated operator() + result_type operator()(const Point_2& p, const Point_2& q, const Point_2& r, FT_necessary) = delete; + template result_type operator()(const T1& p, const T2& q, const T3& r, FT_necessary = {}) const @@ -3978,7 +3982,7 @@ namespace CartesianKernelFunctors { { return a.rep().has_on(p); } result_type - operator()(const Sphere_3 &a, const Circle_3 &p) const + operator()(const Sphere_3 &a, const Circle_3 &p, FT_necessary = {}) const { return a.rep().has_on(p); } result_type diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 417bab778d8..4bcec963285 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -741,7 +741,8 @@ namespace CommonKernelFunctors { const Weighted_point_3 & q, const Weighted_point_3 & r, const Weighted_point_3 & s, - const FT& w) const + const FT& w, + FT_necessary = {}) const { return CGAL::compare(squared_radius_orthogonal_sphereC3( p.x(),p.y(),p.z(),p.weight(), @@ -754,7 +755,8 @@ namespace CommonKernelFunctors { result_type operator()(const Weighted_point_3 & p, const Weighted_point_3 & q, const Weighted_point_3 & r, - const FT& w) const + const FT& w, + FT_necessary = {}) const { return CGAL::compare(squared_radius_smallest_orthogonal_sphereC3( p.x(),p.y(),p.z(),p.weight(), @@ -765,7 +767,8 @@ namespace CommonKernelFunctors { result_type operator()(const Weighted_point_3 & p, const Weighted_point_3 & q, - const FT& w) const + const FT& w, + FT_necessary = {}) const { return CGAL::compare(squared_radius_smallest_orthogonal_sphereC3( p.x(),p.y(),p.z(),p.weight(), @@ -842,14 +845,14 @@ namespace CommonKernelFunctors { template result_type - operator()(const T1& p, const T2& q, const FT& d2) const + operator()(const T1& p, const T2& q, const FT& d2, FT_necessary = {}) const { return CGAL::compare(internal::squared_distance(p, q, K()), d2); } template - result_type - operator()(const T1& p, const T2& q, const T3& r, const T4& s) const + std::enable_if_t::value, result_type> + operator()(const T1& p, const T2& q, const T3& r, const T4& s, FT_necessary = {}) const { return CGAL::compare(internal::squared_distance(p, q, K()), internal::squared_distance(r, s, K())); @@ -3023,7 +3026,7 @@ namespace CommonKernelFunctors { template result_type - operator()(const T1& t1, const T2& t2) const + operator()(const T1& t1, const T2& t2, FT_necessary = {}) const { return Intersections::internal::do_intersect(t1, t2, K()); } }; @@ -3333,8 +3336,10 @@ namespace CommonKernelFunctors { return c.rep().has_on_bounded_side(p); } + // returns true iff the line segment ab is inside the union of the bounded sides of s1 and s2. result_type operator()(const Sphere_3& s1, const Sphere_3& s2, - const Point_3& a, const Point_3& b) const + const Point_3& a, const Point_3& b, + FT_necessary = {}) const { typedef typename K::Circle_3 Circle_3; typedef typename K::Point_3 Point_3; @@ -3360,13 +3365,9 @@ namespace CommonKernelFunctors { const Circle_3 circ(s1, s2); const Plane_3& plane = circ.supporting_plane(); const auto optional = K().intersect_3_object()(plane, Segment_3(a, b)); - CGAL_kernel_assertion_msg(bool(optional) == true, - "the segment does not intersect the supporting" - " plane"); + CGAL_kernel_assertion_msg(bool(optional) == true, "the segment does not intersect the supporting plane"); const Point_3* p = boost::get(&*optional); - CGAL_kernel_assertion_msg(p != 0, - "the segment intersection with the plane is " - "not a point"); + CGAL_kernel_assertion_msg(p != 0, "the segment intersection with the plane is not a point"); return squared_distance(circ.center(), *p) < circ.squared_radius(); } From f417495a0e62695c5b898909df63c13877fc2e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 23 Sep 2022 11:35:29 +0200 Subject: [PATCH 21/39] Handle deleted functions in RT/FT test --- Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp index d1e3eb3b585..b612af490d8 100644 --- a/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp +++ b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp @@ -16,7 +16,7 @@ // > 8, everything #define CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY 8 -std::vector predicates_types = { "Angle_2" }; +std::vector predicates_types = { }; // @todo, technically somebody could create predicates with non-kernel objects (nor FT/Origin), e.g. `int`. // In that case, these arguments would have to be added to the lists below since there is no scrapping @@ -141,7 +141,7 @@ Compilation_result parse_output(const std::string& predicate_name, if(line.find("no match for call") != std::string::npos) { res = FAILED_NO_MATCH; break; - } else if(line.find("too many arguments") != std::string::npos) { // @todo what is that exact error? + } else if(line.find("use of deleted function") != std::string::npos) { res = FAILED_NO_MATCH; break; #ifdef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_PREDICATES_WITH_TEMPLATED_OPERATORS @@ -159,10 +159,6 @@ Compilation_result parse_output(const std::string& predicate_name, } else if(line.find("candidate") != std::string::npos) { res = FAILED_AMBIGUOUS_CALL; break; - } else if(line.find("call to deleted") != std::string::npos) { - // @todo unused since the macro makes it so no operator is defined at all - res = FAILED_NO_DIVISION_OPERATOR; - break; } else if(line.find("no match for ‘operator/’") != std::string::npos) { res = FAILED_NO_DIVISION_OPERATOR; break; From 9d40a225ff8365edebc6cc3fa4a4b3ebc6e4d332 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 23 Sep 2022 15:32:52 +0200 Subject: [PATCH 22/39] Update Kernel_23/test/Kernel_23/Filtered_cartesian.cpp --- Kernel_23/test/Kernel_23/Filtered_cartesian.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp b/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp index b47ac7e12e3..6a9c564882d 100644 --- a/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp +++ b/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp @@ -15,7 +15,7 @@ // Author(s) : Sylvain Pion // This defines removes the operator/ from CGAL::Mpzf to check that functors not using -// the tag`FT_necessary` really only need a RT (ring type) without division. +// the tag `FT_necessary` really only need a RT (ring type) without division. #define CGAL_NO_MPZF_DIVISION_OPERATOR 1 #include From 2c23a6d5c5d42fb08cd32fa64c144ff074a24acb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 12 Oct 2022 21:24:59 +0200 Subject: [PATCH 23/39] Revert back to wrapping result_type to distinguish FT-necessary operator()s --- .../include/CGAL/Cartesian/function_objects.h | 24 ++++---- .../include/CGAL/Filtered_predicate.h | 36 +++-------- .../include/CGAL/Kernel/function_objects.h | 59 ++++++++++--------- .../test/Kernel_23/Filtered_cartesian.cpp | 2 +- STL_Extension/include/CGAL/tags.h | 24 +++++++- 5 files changed, 71 insertions(+), 74 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index 92aa3d6b4eb..737a52dfc14 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -445,20 +445,16 @@ namespace CartesianKernelFunctors { return cmp_dist_to_pointC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y()); } - // Slightly wkward, but not to get a false positive in the `test_RT_or_FT_predicate` - // as otherwise trying to compile P2,P2,P2,FT_necessary would match the T1,T2,T3 templated operator() - result_type operator()(const Point_2& p, const Point_2& q, const Point_2& r, FT_necessary) = delete; - template - result_type - operator()(const T1& p, const T2& q, const T3& r, FT_necessary = {}) const + 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 - std::enable_if_t::value, result_type> - operator()(const T1& p, const T2& q, const T3& r, const T4& s, FT_necessary = {}) const + 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)); } @@ -596,15 +592,15 @@ namespace CartesianKernelFunctors { } template - result_type - operator()(const T1& p, const T2& q, const T3& r, FT_necessary = {}) const + 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 - std::enable_if_t::value, result_type> - operator()(const T1& p, const T2& q, const T3& r, const T4& s, FT_necessary = {}) const + 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)); } @@ -3981,8 +3977,8 @@ namespace CartesianKernelFunctors { operator()(const Circle_3 &a, const Point_3 &p) const { return a.rep().has_on(p); } - result_type - operator()(const Sphere_3 &a, const Circle_3 &p, FT_necessary = {}) const + Needs_FT + operator()(const Sphere_3 &a, const Circle_3 &p) const { return a.rep().has_on(p); } result_type diff --git a/Filtered_kernel/include/CGAL/Filtered_predicate.h b/Filtered_kernel/include/CGAL/Filtered_predicate.h index bf3cfdcf21c..90e9a554f75 100644 --- a/Filtered_kernel/include/CGAL/Filtered_predicate.h +++ b/Filtered_kernel/include/CGAL/Filtered_predicate.h @@ -86,15 +86,8 @@ public: template result_type - operator()(const Args&... args) const; -}; - -template - template -typename Filtered_predicate::result_type -Filtered_predicate:: operator()(const Args&... args) 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 { @@ -111,7 +104,8 @@ Filtered_predicate:: Protect_FPU_rounding p(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); return ep(c2e(args)...); -} + } +}; template class Filtered_predicate_RT_FT @@ -123,27 +117,17 @@ class Filtered_predicate_RT_FT EP_FT ep_ft; AP ap; - using Ares = typename AP::result_type; + using Ares = typename Remove_needs_FT::Type; public: - using result_type = typename EP_FT::result_type; + using result_type = typename Remove_needs_FT::Type; template struct Call_operator_needs_FT { - // This type traits class checks if the call operator can be called with - // `(const Args&..., FT_necessary())`. - using ArrayOfOne = char[1]; - using ArrayOfTwo = char[2]; - - static ArrayOfOne& test(...); - - template - static auto test(const Args2 &...args) - -> decltype(ap(c2a(args)..., FT_necessary()), - std::declval()); - - enum { value = sizeof(test(std::declval()...)) == sizeof(ArrayOfTwo) }; + using Actual_approx_res = decltype(ap(c2a(std::declval())...)); + using Approx_res = std::remove_cv_t >; + enum { value = std::is_same >::value }; }; // ## Important note @@ -154,9 +138,7 @@ public: // or `has_needs_FT` in // the file `Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h`. template - constexpr bool needs_FT(const Args&...) const { - return Call_operator_needs_FT::value; - } + bool needs_FT(const Args&...) const { return Call_operator_needs_FT::value; } template result_type diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 4bcec963285..1a7065e1a59 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -737,12 +737,12 @@ namespace CommonKernelFunctors { typedef Comparison_result 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 FT& w, - FT_necessary = {}) const + Needs_FT + operator()(const Weighted_point_3 & p, + const Weighted_point_3 & q, + const Weighted_point_3 & r, + const Weighted_point_3 & s, + const FT& w) const { return CGAL::compare(squared_radius_orthogonal_sphereC3( p.x(),p.y(),p.z(),p.weight(), @@ -752,11 +752,11 @@ namespace CommonKernelFunctors { w); } - result_type operator()(const Weighted_point_3 & p, - const Weighted_point_3 & q, - const Weighted_point_3 & r, - const FT& w, - FT_necessary = {}) const + Needs_FT + operator()(const Weighted_point_3 & p, + const Weighted_point_3 & q, + const Weighted_point_3 & r, + const FT& w) const { return CGAL::compare(squared_radius_smallest_orthogonal_sphereC3( p.x(),p.y(),p.z(),p.weight(), @@ -765,10 +765,10 @@ namespace CommonKernelFunctors { w); } - result_type operator()(const Weighted_point_3 & p, - const Weighted_point_3 & q, - const FT& w, - FT_necessary = {}) const + Needs_FT + operator()(const Weighted_point_3 & p, + const Weighted_point_3 & q, + const FT& w) const { return CGAL::compare(squared_radius_smallest_orthogonal_sphereC3( p.x(),p.y(),p.z(),p.weight(), @@ -821,15 +821,15 @@ namespace CommonKernelFunctors { typedef typename K::Comparison_result result_type; template - result_type - operator()(const T1& p, const T2& q, const FT& d2, FT_necessary = {}) const + Needs_FT + operator()(const T1& p, const T2& q, const FT& d2) const { return CGAL::compare(internal::squared_distance(p, q, K()), d2); } template - std::enable_if_t::value, result_type> - operator()(const T1& p, const T2& q, const T3& r, const T4& s, FT_necessary = {}) const + 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()), internal::squared_distance(r, s, K())); @@ -844,15 +844,15 @@ namespace CommonKernelFunctors { typedef typename K::Comparison_result result_type; template - result_type - operator()(const T1& p, const T2& q, const FT& d2, FT_necessary = {}) const + Needs_FT + operator()(const T1& p, const T2& q, const FT& d2) const { return CGAL::compare(internal::squared_distance(p, q, K()), d2); } template - std::enable_if_t::value, result_type> - operator()(const T1& p, const T2& q, const T3& r, const T4& s, FT_necessary = {}) const + 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()), internal::squared_distance(r, s, K())); @@ -3024,10 +3024,11 @@ namespace CommonKernelFunctors { public: typedef typename K::Boolean result_type; + // Needs FT because Line/Line (and variations) and Circle_2/X compute intersections template - result_type - operator()(const T1& t1, const T2& t2, FT_necessary = {}) const - { return Intersections::internal::do_intersect(t1, t2, K()); } + Needs_FT + operator()(const T1& t1, const T2& t2) const + { return { Intersections::internal::do_intersect(t1, t2, K())}; } }; template @@ -3337,9 +3338,9 @@ namespace CommonKernelFunctors { } // returns true iff the line segment ab is inside the union of the bounded sides of s1 and s2. - result_type operator()(const Sphere_3& s1, const Sphere_3& s2, - const Point_3& a, const Point_3& b, - FT_necessary = {}) const + Needs_FT + operator()(const Sphere_3& s1, const Sphere_3& s2, + const Point_3& a, const Point_3& b) const { typedef typename K::Circle_3 Circle_3; typedef typename K::Point_3 Point_3; diff --git a/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp b/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp index 6a9c564882d..3c56a17f44b 100644 --- a/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp +++ b/Kernel_23/test/Kernel_23/Filtered_cartesian.cpp @@ -15,7 +15,7 @@ // Author(s) : Sylvain Pion // This defines removes the operator/ from CGAL::Mpzf to check that functors not using -// the tag `FT_necessary` really only need a RT (ring type) without division. +// the tag `Needs_FT<>` really only need a RT (ring type) without division. #define CGAL_NO_MPZF_DIVISION_OPERATOR 1 #include diff --git a/STL_Extension/include/CGAL/tags.h b/STL_Extension/include/CGAL/tags.h index dd13818aae9..6aa1988e1cc 100644 --- a/STL_Extension/include/CGAL/tags.h +++ b/STL_Extension/include/CGAL/tags.h @@ -81,9 +81,27 @@ Assert_compile_time_tag( const Tag&, const Derived& b) x.match_compile_time_tag(b); } -// for kernel predicates, to indicate a FT providing a division operator is required -struct FT_necessary {}; +// To distinguish between kernel predicates for which a division-less FT is sufficient +template +struct Needs_FT +{ + T value; + Needs_FT(T v) : value(v) {} + operator T() const { return value; } +}; -} //namespace CGAL +template +struct Remove_needs_FT +{ + using Type = T; +}; + +template +struct Remove_needs_FT > +{ + using Type = T; +}; + +} // namespace CGAL #endif // CGAL_TAGS_H From 296d9e5cc0b17e1170de4602bda16294572cf0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 12 Oct 2022 21:28:40 +0200 Subject: [PATCH 24/39] Update RTFT test --- Kernel_23/test/Kernel_23/CMakeLists.txt | 7 +- .../include/atomic_RT_FT_predicate_headers.h | 12 +- .../Kernel_23/test_RT_or_FT_predicates.cpp | 257 +++++++++--------- 3 files changed, 140 insertions(+), 136 deletions(-) diff --git a/Kernel_23/test/Kernel_23/CMakeLists.txt b/Kernel_23/test/Kernel_23/CMakeLists.txt index 4f1021c49c4..fc53a665596 100644 --- a/Kernel_23/test/Kernel_23/CMakeLists.txt +++ b/Kernel_23/test/Kernel_23/CMakeLists.txt @@ -33,8 +33,11 @@ create_single_source_cgal_program("test_Projection_traits_xy_3_Intersect_2.cpp") set(CGAL_KERNEL_23_TEST_RT_FT_PREDICATE_FLAGS ON) if(CGAL_KERNEL_23_TEST_RT_FT_PREDICATE_FLAGS) - # templated operators create a lot of possible combinations, which is expensive to test - add_definitions(-DCGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_PREDICATES_WITH_TEMPLATED_OPERATORS) + # Templated operators: + # - create a lot of possible combinations, which is expensive to test + # - create issues because some combinations might be RT-sufficient whereas others will require FT + # + # add_definitions(-DCGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_PREDICATES_WITH_TEMPLATED_OPERATORS) create_single_source_cgal_program("atomic_compilation_test.cpp") create_single_source_cgal_program("test_RT_or_FT_predicates.cpp") diff --git a/Kernel_23/test/Kernel_23/include/atomic_RT_FT_predicate_headers.h b/Kernel_23/test/Kernel_23/include/atomic_RT_FT_predicate_headers.h index 85d4dcb8c49..81e656adb64 100644 --- a/Kernel_23/test/Kernel_23/include/atomic_RT_FT_predicate_headers.h +++ b/Kernel_23/test/Kernel_23/include/atomic_RT_FT_predicate_headers.h @@ -3,19 +3,21 @@ #define CGAL_NO_MPZF_DIVISION_OPERATOR +// These includes are there because this header is precompiled + #include -#include #include +#include #include +#include namespace CGAL { namespace Kernel_23_tests { -struct Any { - - template ::value>::type> +struct Any +{ + template operator T(); }; diff --git a/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp index b612af490d8..d9902dd34f7 100644 --- a/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp +++ b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp @@ -14,7 +14,7 @@ // > 2, same as above + some general indications on what is going on // > 4, same as above + even more indications on what is going on // > 8, everything -#define CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY 8 +#define CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY 4 std::vector predicates_types = { }; @@ -32,23 +32,23 @@ const std::string kernel_name = "Simple_cartesian"; const std::string FT_div = "double"; const std::string RT_no_div = "CGAL::Mpzf"; +enum Needs_FT_checks +{ + NO_CHECK = 0, + CHECK_NEEDS_FT, + CHECK_NO_NEEDS_FT +}; + enum Compilation_result { SUCCESSFUL = 0, // if it got to linking, it is also a successful compilation FAILED_NO_MATCH, FAILED_AMBIGUOUS_CALL, // ambiguous calls means the arity is valid FAILED_NO_DIVISION_OPERATOR, // used to detect if a valid compilation can be done with RT + FAILED_STATIC_ASSERTION, // used to detect failures in the result type checks UNKNOWN }; -enum class Arity_test_result -{ - EXPLORATION_REQUIRED = 0, - RT_SUFFICIENT, - FT_NECESSARY, - NO_MATCH -}; - inline const char* get_error_message(int error_code) { // Messages corresponding to Error_code list above. Must be kept in sync! @@ -58,6 +58,7 @@ inline const char* get_error_message(int error_code) "Failed: no match!", "Failed: ambiguous call!", "Failed: called division operator!", + "Failed: static assertion violated!", "Unexpected error!" }; @@ -78,8 +79,6 @@ std::string parameter_with_namespace(const std::string& FT_name, { if(o == "Any") return "CGAL::Kernel_23_tests::Any"; - else if(o == "FT_necessary") - return "CGAL::FT_necessary"; else if(o == "FT") return "K::FT"; else if(o == "Origin") @@ -162,6 +161,12 @@ Compilation_result parse_output(const std::string& predicate_name, } else if(line.find("no match for ‘operator/’") != std::string::npos) { res = FAILED_NO_DIVISION_OPERATOR; break; + } else if(line.find("no match for ‘operator/=’") != std::string::npos) { + res = FAILED_NO_DIVISION_OPERATOR; + break; + } else if(line.find("static assertion failed") != std::string::npos) { + res = FAILED_STATIC_ASSERTION; + break; } else if(line.find("Built") != std::string::npos) { res = SUCCESSFUL; break; @@ -180,16 +185,17 @@ Compilation_result parse_output(const std::string& predicate_name, return res; } -void generate_atomic_file(const std::string& FT_name, - const std::string& predicate_name, - const std::vector& parameters) +void generate_atomic_compilation_test(const std::string& FT_name, + const std::string& predicate_name, + const std::vector& parameters, + const Needs_FT_checks check = NO_CHECK) { #if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) - std::cout << "====== Generate atomic file... ======" << std::endl; + std::cout << "\n====== Generate atomic compilation test... ======" << std::endl; #endif #if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) - std::cout << predicate_name << "("; + std::cout << "\t" << predicate_name << "("; for(std::size_t j=0, i=parameters.size(); j;\n"; out << "int main(int, char**)\n"; out << "{\n"; - out << " P p;\n"; + + out << " P p{};\n"; for(std::size_t j=0, i=parameters.size(); j::value));\n"; + else if(check == CHECK_NEEDS_FT) + out << ", NFT_B>::value));\n"; + } + out << " return EXIT_SUCCESS;\n"; out << "}\n"; out.close(); } -// Just to not get a diff at the end of the test -void restore_atomic_file() -{ - std::ofstream out("../atomic_compilation_test.cpp"); - if(!out) - { - std::cerr << "Error: could not write into atomic compilation test" << std::endl; - std::exit(1); - } - - out << "int main(int, char**) { }\n"; - out.close(); -} - -Arity_test_result test_arity(const std::string& predicate_name, - const std::size_t arity) -{ -#if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 2) - std::cout << "\n===== Checking potential arity " << arity << "... =====" << std::endl; -#endif - - std::vector parameters(arity, "Any"); - - generate_atomic_file(RT_no_div, predicate_name, parameters); - compile(); - Compilation_result res = parse_output(predicate_name); - - if(res == SUCCESSFUL) - return Arity_test_result::RT_SUFFICIENT; - else if(res == FAILED_NO_DIVISION_OPERATOR) - return Arity_test_result::FT_NECESSARY; - else if(res == FAILED_AMBIGUOUS_CALL) - return Arity_test_result::EXPLORATION_REQUIRED; - else // FAILED_NO_MATCH and UNKNOWN - return Arity_test_result::NO_MATCH; -} - -bool ensure_FT_necessary_is_present(const std::string& predicate_name, - // intentional copy, don't want to pollute the parameters with `FT_necessary` - std::vector parameters) +void ensure_NO_Needs_FT(const std::string& predicate_name, + const std::vector& parameters) { #if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) std::cout << predicate_name << "("; for(std::size_t j=0, i=parameters.size(); j 0) - std::cout << predicate_name << "("; - for(std::size_t j=0, i=parameters.size() - 1; j 0) - std::cerr << "Error: this predicate is `FT_necessary`, but the tag is missing!\n" << std::endl; + std::cout << predicate_name << "("; + for(std::size_t j=0, i=parameters.size(); j 0) + std::cout << "Error: " << predicate_name << "("; + for(std::size_t j=0, i=parameters.size(); j 0) - std::cout << "... and the tag `FT_necessary` is correctly present!\n" << std::endl; + std::cerr << "Unexpected error during Needs_FT checks" << std::endl; #endif - return true; + assert(false); } } -bool ensure_FT_necessary_is_NOT_present(const std::string& predicate_name, - // intentional copy, don't want to pollute the parameters with `RT_sufficient` - std::vector parameters) +void ensure_Needs_FT(const std::string& predicate_name, + const std::vector& parameters) { #if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) std::cout << predicate_name << "("; for(std::size_t j=0, i=parameters.size(); j 0) - std::cout << predicate_name << "("; - for(std::size_t j=0, i=parameters.size() - 1; j 0) - std::cerr << "Error: this predicate is NOT 'FT_necessary', but the tag is present!\n" << std::endl; + std::cout << predicate_name << "("; + for(std::size_t j=0, i=parameters.size(); j 0) + std::cout << "Error: " << predicate_name << "("; + for(std::size_t j=0, i=parameters.size(); j 0) - std::cout << "... and the tag `FT_necessary` is (correctly) absent!\n" << std::endl; + std::cerr << "Unexpected error during Needs_FT checks" << std::endl; #endif - return true; + assert(false); } } @@ -364,31 +357,31 @@ void test_predicate(const std::string& predicate_name, #endif parameters[object_pos] = object_type; - generate_atomic_file(RT_no_div, predicate_name, parameters); + generate_atomic_compilation_test(RT_no_div, predicate_name, parameters); compile(); Compilation_result res = parse_output(predicate_name, RT_no_div, parameters); - // See if we can already conclude on the current parameter list - // - if that successful compiles, then it is RT_sufficient - // - call to deleted or missing division operator, this means FT_necessary - // - any other error, this combination of parameters was not a valid input for the predicate - if(res == SUCCESSFUL) + // See if we can already (i.e., possibly with `Any`s) conclude on the current parameter list + if(res == FAILED_NO_MATCH) { - ensure_FT_necessary_is_NOT_present(predicate_name, parameters); + // The object at the current position yields a compilation error, do not explore any further + continue; } - else if(res == FAILED_NO_DIVISION_OPERATOR) + else if(object_pos == last) { - ensure_FT_necessary_is_present(predicate_name, parameters); - } - - if(res == FAILED_AMBIGUOUS_CALL && object_pos != last) - { - // The object at the current position does not invalid the call, explore further this list - test_predicate(predicate_name, object_pos + 1, arity, parameters); + if(res == SUCCESSFUL) + { + ensure_NO_Needs_FT(predicate_name, parameters); + } + else if(res == FAILED_NO_DIVISION_OPERATOR) + { + ensure_Needs_FT(predicate_name, parameters); + } } else { - // The object at the current position yields a compilation error, do not explore any further + // The object at the current position does not invalid the call, explore further this list + test_predicate(predicate_name, object_pos + 1, arity, parameters); } } } @@ -397,9 +390,8 @@ void test_predicate(const std::string& predicate_name, const std::size_t arity) { #if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 2) - std::cout << "===== Test predicate with arity " << arity << "... =====" << std::endl; + std::cout << "\n\n==== Test predicate with arity " << arity << "... ====" << std::endl; #endif - CGAL_precondition(arity > 0); // Use "Any" to prune early: // 1st try "Object_1, Any, ..., Any" (i - 1 "Any") @@ -410,6 +402,14 @@ void test_predicate(const std::string& predicate_name, // the position of the object being changed/tested, when object_pos == arity - 1, // then this is a call with full objects on which we can do the RT test std::vector parameters(arity, "Any"); + + // Quick try to see if it even matches anything + generate_atomic_compilation_test(RT_no_div, predicate_name, parameters); + compile(); + Compilation_result res = parse_output(predicate_name); + if(res == FAILED_NO_MATCH) // No point with this current arity + return; + std::size_t object_pos = 0; test_predicate(predicate_name, object_pos, arity, parameters); } @@ -417,7 +417,7 @@ void test_predicate(const std::string& predicate_name, void test_predicate(const std::string& predicate_name) { #if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 1) - std::cout << "\n\n=== Test predicate: " << predicate_name << "... ===" << std::endl; + std::cout << "\n\n\n== Test predicate: " << predicate_name << "... ==" << std::endl; #endif #ifndef CGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_PREDICATES_WITH_TEMPLATED_OPERATORS @@ -433,26 +433,25 @@ void test_predicate(const std::string& predicate_name) #endif for(std::size_t i=MIN_ARITY; i<=MAX_ARITY; ++i) - { - Arity_test_result res = test_arity(predicate_name, i); - if(res == Arity_test_result::RT_SUFFICIENT) - { - std::vector parameters(i, "Any"); - ensure_FT_necessary_is_NOT_present(predicate_name, parameters); - } - else if(res == Arity_test_result::FT_NECESSARY) - { - std::vector parameters(i, "Any"); - ensure_FT_necessary_is_present(predicate_name, parameters); - } - else if(res == Arity_test_result::EXPLORATION_REQUIRED) - { - test_predicate(predicate_name, i); - } - } + test_predicate(predicate_name, i); } -int main(int , char** ) +// Just to not get a diff at the end of the test +void restore_atomic_file() +{ + std::ofstream out("../atomic_compilation_test.cpp"); + if(!out) + { + std::cerr << "Error: could not write into atomic compilation test" << std::endl; + std::exit(1); + } + + out << "// This executable is used by test_RT_or_FT_predicates.cpp\n"; + out << "int main(int, char**) { }\n"; + out.close(); +} + +int main(int , char**) { // Get the predicates #define CGAL_Kernel_pred(X, Y) predicates_types.push_back(#X); From 73de5e49f4f147658b1d733eee909b6ce793d631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 12 Oct 2022 21:32:30 +0200 Subject: [PATCH 25/39] Remove unnecessary include --- Kernel_23/include/CGAL/Kernel/function_objects.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 1a7065e1a59..f8f5817c522 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -31,7 +31,6 @@ #include #include -#include // for std::is_same and std::enable_if #include // for Compute_dihedral_angle namespace CGAL { From 3745073df6a71da0e43dd7190ba3d19a6add2f9c Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 13 Oct 2022 18:25:58 +0200 Subject: [PATCH 26/39] Fix a compilation error --- Kernel_23/include/CGAL/Kernel/function_objects.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index f8f5817c522..c9a7391f225 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -3351,17 +3351,17 @@ namespace CommonKernelFunctors { const bool a_in_s1 = has_on_bounded_side(s1, a); const bool a_in_s2 = has_on_bounded_side(s2, a); - if(!(a_in_s1 || a_in_s2)) return false; + if(!(a_in_s1 || a_in_s2)) return {false}; const bool b_in_s1 = has_on_bounded_side(s1, b); const bool b_in_s2 = has_on_bounded_side(s2, b); - if(!(b_in_s1 || b_in_s2)) return false; + if(!(b_in_s1 || b_in_s2)) return {false}; - if(a_in_s1 && b_in_s1) return true; - if(a_in_s2 && b_in_s2) return true; + if(a_in_s1 && b_in_s1) return {true}; + if(a_in_s2 && b_in_s2) return {true}; - if(!K().do_intersect_3_object()(s1, s2)) return false; + if(!K().do_intersect_3_object()(s1, s2)) return {false}; const Circle_3 circ(s1, s2); const Plane_3& plane = circ.supporting_plane(); const auto optional = K().intersect_3_object()(plane, Segment_3(a, b)); From f83b9704616b06253c5ad85eece7101d89e9b3fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 13 Oct 2022 21:24:05 +0200 Subject: [PATCH 27/39] Add a comment explaining the purpose of atomic_compilation_test.cpp --- Kernel_23/test/Kernel_23/atomic_compilation_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Kernel_23/test/Kernel_23/atomic_compilation_test.cpp b/Kernel_23/test/Kernel_23/atomic_compilation_test.cpp index 80c7b4bd8dd..be26c19f042 100644 --- a/Kernel_23/test/Kernel_23/atomic_compilation_test.cpp +++ b/Kernel_23/test/Kernel_23/atomic_compilation_test.cpp @@ -1 +1,2 @@ +// This executable is used by test_RT_or_FT_predicates.cpp int main(int, char**) { } From 10eb694d380fffce2914c511c5f99893dc3d0256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 13 Oct 2022 23:11:05 +0200 Subject: [PATCH 28/39] Replace if constexpr with C++14 compatible code --- .../include/CGAL/Filtered_predicate.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Filtered_predicate.h b/Filtered_kernel/include/CGAL/Filtered_predicate.h index 90e9a554f75..8cbcaa2835a 100644 --- a/Filtered_kernel/include/CGAL/Filtered_predicate.h +++ b/Filtered_kernel/include/CGAL/Filtered_predicate.h @@ -122,6 +122,7 @@ class Filtered_predicate_RT_FT public: using result_type = typename Remove_needs_FT::Type; +private: template struct Call_operator_needs_FT { @@ -130,6 +131,15 @@ public: enum { value = std::is_same >::value }; }; + template ::value>* = nullptr> + result_type 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)...); } + +public: // ## Important note // // If you want to remove of rename that member function template `needs_FT`, @@ -159,14 +169,11 @@ public: CGAL_BRANCH_PROFILER_BRANCH(tmp); Protect_FPU_rounding p(CGAL_FE_TONEAREST); CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); - if constexpr (Call_operator_needs_FT::value) - return ep_ft(c2e_ft(args)...); - else - return ep_rt(c2e_rt(args)...); + + return call(args...); } }; - -} //namespace CGAL +} // namespace CGAL #endif // CGAL_FILTERED_PREDICATE_H From a46a6db2bb4fe6bbe138ac4c0ff331be1976728c Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 14 Oct 2022 12:15:48 +0200 Subject: [PATCH 29/39] Allow to use test_RT_or_FT_predicates with ninja, and ctest --- Kernel_23/test/Kernel_23/CMakeLists.txt | 6 +++- .../Kernel_23/test_RT_or_FT_predicates.cpp | 32 ++++++++++++------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Kernel_23/test/Kernel_23/CMakeLists.txt b/Kernel_23/test/Kernel_23/CMakeLists.txt index fc53a665596..a27b9eb2978 100644 --- a/Kernel_23/test/Kernel_23/CMakeLists.txt +++ b/Kernel_23/test/Kernel_23/CMakeLists.txt @@ -40,6 +40,10 @@ if(CGAL_KERNEL_23_TEST_RT_FT_PREDICATE_FLAGS) # add_definitions(-DCGAL_KERNEL_23_TEST_RT_FT_PREDICATES_TEST_PREDICATES_WITH_TEMPLATED_OPERATORS) create_single_source_cgal_program("atomic_compilation_test.cpp") - create_single_source_cgal_program("test_RT_or_FT_predicates.cpp") target_precompile_headers(atomic_compilation_test PUBLIC [["atomic_RT_FT_predicate_headers.h"]]) + + create_single_source_cgal_program("test_RT_or_FT_predicates.cpp") + target_compile_definitions(test_RT_or_FT_predicates PRIVATE + "CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}" + "CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}") endif() diff --git a/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp index d9902dd34f7..03b2787cc0b 100644 --- a/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp +++ b/Kernel_23/test/Kernel_23/test_RT_or_FT_predicates.cpp @@ -14,7 +14,7 @@ // > 2, same as above + some general indications on what is going on // > 4, same as above + even more indications on what is going on // > 8, everything -#define CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY 4 +#define CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY 2 std::vector predicates_types = { }; @@ -87,13 +87,13 @@ std::string parameter_with_namespace(const std::string& FT_name, return "CGAL::" + o + "<" + kernel_with_FT(FT_name) + " >"; } -void compile() +int compile() { #if (CGAL_KERNEL_23_TEST_RT_FT_VERBOSITY > 4) std::cout << "====== Compiling atomic file... ======" << std::endl; #endif - std::system("make atomic_compilation_test > log.txt 2>&1"); + return std::system("cmake --build " CGAL_STRINGIZE(CMAKE_BINARY_DIR) " -t atomic_compilation_test > log.txt 2>&1"); } Compilation_result parse_output(const std::string& predicate_name, @@ -201,7 +201,7 @@ void generate_atomic_compilation_test(const std::string& FT_name, std::cout << ")" << std::endl; #endif - std::ofstream out("../atomic_compilation_test.cpp"); + std::ofstream out(CGAL_STRINGIZE(CMAKE_CURRENT_SOURCE_DIR) "/atomic_compilation_test.cpp"); if(!out) { std::cerr << "Error: could not write into atomic compilation test" << std::endl; @@ -259,8 +259,10 @@ void ensure_NO_Needs_FT(const std::string& predicate_name, // RT is sufficient, check that `Needs_FT` is not in the operator()'s return type generate_atomic_compilation_test(RT_no_div, predicate_name, parameters, CHECK_NO_NEEDS_FT); - compile(); - Compilation_result res = parse_output(predicate_name); + auto compilation_result = compile(); + Compilation_result res = compilation_result == 0 ? + SUCCESSFUL : + parse_output(predicate_name); if(res == SUCCESSFUL) { @@ -301,8 +303,10 @@ void ensure_Needs_FT(const std::string& predicate_name, // The predicate requires a FT with division, ensure that Needs_FT is present in the operator()'s return type generate_atomic_compilation_test(FT_div, predicate_name, parameters, CHECK_NEEDS_FT); - compile(); - Compilation_result res = parse_output(predicate_name); + auto compilation_result = compile(); + Compilation_result res = compilation_result == 0 ? + SUCCESSFUL : + parse_output(predicate_name); if(res == SUCCESSFUL) { @@ -358,8 +362,10 @@ void test_predicate(const std::string& predicate_name, parameters[object_pos] = object_type; generate_atomic_compilation_test(RT_no_div, predicate_name, parameters); - compile(); - Compilation_result res = parse_output(predicate_name, RT_no_div, parameters); + auto compilation_result = compile(); + Compilation_result res = compilation_result == 0 ? + SUCCESSFUL : + parse_output(predicate_name, RT_no_div, parameters); // See if we can already (i.e., possibly with `Any`s) conclude on the current parameter list if(res == FAILED_NO_MATCH) @@ -405,8 +411,10 @@ void test_predicate(const std::string& predicate_name, // Quick try to see if it even matches anything generate_atomic_compilation_test(RT_no_div, predicate_name, parameters); - compile(); - Compilation_result res = parse_output(predicate_name); + auto compilation_result = compile(); + Compilation_result res = compilation_result == 0 ? + SUCCESSFUL : + parse_output(predicate_name); if(res == FAILED_NO_MATCH) // No point with this current arity return; From 2b41ebaaaa459592ba0817c1f42b36a2a500abc4 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 7 Nov 2022 15:45:58 +0100 Subject: [PATCH 30/39] Remove last remnant of C++17 if constexpr --- .../test/Kernel_23/include/CGAL/_test_new_3.h | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h index 4daf22f0f3d..2b4b26dd388 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h @@ -78,6 +78,28 @@ _test_new_3_sqrt(const R& rep, CGAL::Tag_true) return true; } +template struct Test_needs_FT +{ + template void operator()(const T&...) const {} +}; + +template <> struct Test_needs_FT +{ + template + void operator()(const Compare_distance_3& compare_dist, + const Point_3& p1, const Point_3 p2, const Point_3& p3, + const Segment_3& s2, const Line_3& l1) const + { + assert(!compare_dist.needs_FT(p1, p2, p3)); + assert(!compare_dist.needs_FT(p2, s2, s2)); + assert(!compare_dist.needs_FT(p2, p2, s2)); + assert(!compare_dist.needs_FT(p1, s2, p2)); + assert(compare_dist.needs_FT(l1, p1, p1)); + assert(compare_dist.needs_FT(p2, p3, p2, p3)); + assert(compare_dist.needs_FT(p2, s2, l1, s2)); + } +}; template bool @@ -612,17 +634,10 @@ test_new_3(const R& rep) tmp34ab = compare_dist(p2,p3,p2,p3); tmp34ab = compare_dist(p1, p2, p3, p4); tmp34ab = compare_dist(l2, p1, p1); - if constexpr (R::Has_filtered_predicates && - has_needs_FT::value) -{ - assert(!compare_dist.needs_FT(p1, p2, p3)); - assert(!compare_dist.needs_FT(p2, s2, s2)); - assert(!compare_dist.needs_FT(p2, p2, s2)); - assert(!compare_dist.needs_FT(p1, s2, p2)); - assert(compare_dist.needs_FT(l1, p1, p1)); - assert(compare_dist.needs_FT(p2, p3, p2, p3)); - assert(compare_dist.needs_FT(p2, s2, l1, s2)); - } + + Test_needs_FT::value> test_needs_ft; + test_needs_ft(compare_dist, p1, p2, p3, s2, l1); (void) tmp34ab; typename R::Compare_squared_distance_3 compare_sq_dist From 21f60772a1b54980bb5348afc012786d70d33468 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 7 Nov 2022 15:46:13 +0100 Subject: [PATCH 31/39] Do not enable CGAL_KERNEL_23_TEST_RT_FT_PREDICATE_FLAGS by default --- Kernel_23/test/Kernel_23/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/Kernel_23/test/Kernel_23/CMakeLists.txt b/Kernel_23/test/Kernel_23/CMakeLists.txt index a27b9eb2978..1de74e0e1b0 100644 --- a/Kernel_23/test/Kernel_23/CMakeLists.txt +++ b/Kernel_23/test/Kernel_23/CMakeLists.txt @@ -31,7 +31,6 @@ create_single_source_cgal_program("test_kernel__.cpp") create_single_source_cgal_program("test_projection_traits.cpp") create_single_source_cgal_program("test_Projection_traits_xy_3_Intersect_2.cpp") -set(CGAL_KERNEL_23_TEST_RT_FT_PREDICATE_FLAGS ON) if(CGAL_KERNEL_23_TEST_RT_FT_PREDICATE_FLAGS) # Templated operators: # - create a lot of possible combinations, which is expensive to test From 3a4e230ac78d063c29f150ba68fc70665c27766a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 22 Nov 2022 12:22:42 +0100 Subject: [PATCH 32/39] Do_intersect_23 should return K::Boolean Returning bool also created an issue because compilers could not figure out how to convert from Needs_FT > to bool --- .../include/CGAL/Intersection_traits.h | 14 +++--- .../CGAL/Intersections_2/Bbox_2_Circle_2.h | 25 +++++----- .../Intersections_2/Bbox_2_Iso_rectangle_2.h | 12 +++-- .../CGAL/Intersections_2/Bbox_2_Line_2.h | 22 +++++---- .../CGAL/Intersections_2/Bbox_2_Point_2.h | 26 ++++++---- .../CGAL/Intersections_2/Bbox_2_Ray_2.h | 22 +++++---- .../CGAL/Intersections_2/Bbox_2_Segment_2.h | 18 +++---- .../CGAL/Intersections_2/Bbox_2_Triangle_2.h | 14 +++--- .../CGAL/Intersections_2/Circle_2_Circle_2.h | 6 +-- .../Circle_2_Iso_rectangle_2.h | 19 ++++---- .../CGAL/Intersections_2/Circle_2_Line_2.h | 8 ++-- .../CGAL/Intersections_2/Circle_2_Point_2.h | 13 +++-- .../CGAL/Intersections_2/Circle_2_Ray_2.h | 8 ++-- .../CGAL/Intersections_2/Circle_2_Segment_2.h | 8 ++-- .../Intersections_2/Circle_2_Triangle_2.h | 6 +-- .../Iso_rectangle_2_Iso_rectangle_2.h | 9 ++-- .../Intersections_2/Iso_rectangle_2_Line_2.h | 24 ++++++---- .../Intersections_2/Iso_rectangle_2_Point_2.h | 12 ++--- .../Intersections_2/Iso_rectangle_2_Ray_2.h | 24 ++++++---- .../Iso_rectangle_2_Segment_2.h | 40 +++++++--------- .../Iso_rectangle_2_Triangle_2.h | 17 +++---- .../CGAL/Intersections_2/Line_2_Line_2.h | 21 +++++---- .../CGAL/Intersections_2/Line_2_Point_2.h | 14 +++--- .../CGAL/Intersections_2/Line_2_Ray_2.h | 39 +++++++-------- .../CGAL/Intersections_2/Line_2_Segment_2.h | 36 +++++++------- .../CGAL/Intersections_2/Line_2_Triangle_2.h | 20 ++++---- .../CGAL/Intersections_2/Point_2_Point_2.h | 9 ++-- .../CGAL/Intersections_2/Point_2_Ray_2.h | 12 ++--- .../CGAL/Intersections_2/Point_2_Segment_2.h | 4 +- .../CGAL/Intersections_2/Point_2_Triangle_2.h | 16 ++++--- .../CGAL/Intersections_2/Ray_2_Ray_2.h | 15 +++--- .../CGAL/Intersections_2/Ray_2_Segment_2.h | 24 ++++++---- .../CGAL/Intersections_2/Ray_2_Triangle_2.h | 28 +++++------ .../Intersections_2/Segment_2_Segment_2.h | 2 +- .../Intersections_2/Segment_2_Triangle_2.h | 39 +++++++-------- .../Triangle_2_Triangle_2_do_intersect_impl.h | 47 +++++++++---------- .../CGAL/Intersections_3/Bbox_3_Bbox_3.h | 2 +- .../Intersections_3/Bbox_3_Iso_cuboid_3.h | 10 ++-- .../CGAL/Intersections_3/Bbox_3_Line_3.h | 10 ++-- .../CGAL/Intersections_3/Bbox_3_Plane_3.h | 10 ++-- .../CGAL/Intersections_3/Bbox_3_Point_3.h | 10 ++-- .../CGAL/Intersections_3/Bbox_3_Ray_3.h | 10 ++-- .../CGAL/Intersections_3/Bbox_3_Segment_3.h | 10 ++-- .../CGAL/Intersections_3/Bbox_3_Sphere_3.h | 10 ++-- .../Intersections_3/Bbox_3_Tetrahedron_3.h | 10 ++-- .../CGAL/Intersections_3/Bbox_3_Triangle_3.h | 10 ++-- .../Intersections_3/Plane_3_Plane_3_Plane_3.h | 3 +- .../Bbox_3_Iso_cuboid_3_do_intersect.h | 14 +++--- .../internal/Bbox_3_Line_3_do_intersect.h | 26 +++++----- .../internal/Bbox_3_Plane_3_do_intersect.h | 14 +++--- .../internal/Bbox_3_Ray_3_do_intersect.h | 14 +++--- .../internal/Bbox_3_Segment_3_do_intersect.h | 14 +++--- .../internal/Bbox_3_Sphere_3_do_intersect.h | 14 +++--- .../Bbox_3_Tetrahedron_3_do_intersect.h | 16 ++++--- .../internal/Bbox_3_Triangle_3_do_intersect.h | 22 +++++---- .../Iso_cuboid_3_Iso_cuboid_3_do_intersect.h | 3 +- .../Iso_cuboid_3_Line_3_do_intersect.h | 14 +++--- .../Iso_cuboid_3_Plane_3_do_intersect.h | 20 ++++---- .../Iso_cuboid_3_Point_3_do_intersect.h | 4 +- .../Iso_cuboid_3_Ray_3_do_intersect.h | 15 +++--- .../Iso_cuboid_3_Segment_3_do_intersect.h | 14 +++--- .../Iso_cuboid_3_Sphere_3_do_intersect.h | 23 +++++---- .../Iso_cuboid_3_Triangle_3_do_intersect.h | 14 +++--- .../internal/Line_3_Line_3_do_intersect.h | 2 +- .../internal/Line_3_Plane_3_do_intersect.h | 4 +- .../internal/Line_3_Point_3_do_intersect.h | 4 +- .../internal/Line_3_Ray_3_do_intersect.h | 4 +- .../internal/Line_3_Segment_3_do_intersect.h | 4 +- .../internal/Line_3_Triangle_3_do_intersect.h | 14 +++--- .../Plane_3_Plane_3_Plane_3_do_intersect.h | 2 +- .../internal/Plane_3_Plane_3_do_intersect.h | 2 +- .../internal/Plane_3_Point_3_do_intersect.h | 4 +- .../internal/Plane_3_Ray_3_do_intersect.h | 4 +- .../internal/Plane_3_Segment_3_do_intersect.h | 4 +- .../internal/Plane_3_Sphere_3_do_intersect.h | 4 +- .../Plane_3_Triangle_3_do_intersect.h | 14 +++--- .../internal/Point_3_Ray_3_do_intersect.h | 6 +-- .../internal/Point_3_Segment_3_do_intersect.h | 4 +- .../internal/Point_3_Sphere_3_do_intersect.h | 4 +- .../Point_3_Tetrahedron_3_do_intersect.h | 4 +- .../Point_3_Triangle_3_do_intersect.h | 14 +++--- .../internal/Ray_3_Ray_3_do_intersect.h | 2 +- .../internal/Ray_3_Segment_3_do_intersect.h | 4 +- .../internal/Ray_3_Triangle_3_do_intersect.h | 14 +++--- .../Segment_3_Segment_3_do_intersect.h | 2 +- .../Segment_3_Triangle_3_do_intersect.h | 14 +++--- .../internal/Sphere_3_Sphere_3_do_intersect.h | 2 +- .../Triangle_3_Triangle_3_do_intersect.h | 37 ++++++++------- 88 files changed, 640 insertions(+), 542 deletions(-) diff --git a/Intersections_2/include/CGAL/Intersection_traits.h b/Intersections_2/include/CGAL/Intersection_traits.h index 6f0f260a594..9cc25059be9 100644 --- a/Intersections_2/include/CGAL/Intersection_traits.h +++ b/Intersections_2/include/CGAL/Intersection_traits.h @@ -62,19 +62,19 @@ #define CGAL_DO_INTERSECT_FUNCTION(A, B, DIM) \ template \ - inline bool \ + inline typename K::Boolean \ do_intersect(const A& a, const B& b) { \ return BOOST_PP_CAT(K().do_intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \ } \ template \ - inline bool \ + inline typename K::Boolean \ do_intersect(const B& b, const A& a) { \ return BOOST_PP_CAT(K().do_intersect_, BOOST_PP_CAT(DIM, _object()(b, a))); \ } #define CGAL_DO_INTERSECT_FUNCTION_SELF(A, DIM) \ template \ - inline bool \ + inline typename K::Boolean \ do_intersect(const A & a, const A & b) { \ return BOOST_PP_CAT(K().do_intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \ } @@ -152,21 +152,21 @@ intersection_impl(const A& a, const B& b, Dynamic_dimension_tag) { } template -inline bool +inline auto // K::Boolean do_intersect_impl(const A& a, const B& b, CGAL::Dimension_tag<2>) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().do_intersect_2_object()(a, b); } template -inline bool +inline auto // K::Boolean do_intersect_impl(const A& a, const B& b, Dimension_tag<3>) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().do_intersect_3_object()(a, b); } template -inline bool +inline auto // K::Boolean do_intersect_impl(const A& a, const B& b, Dynamic_dimension_tag) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().do_intersect_d_object()(a, b); @@ -188,7 +188,7 @@ do_intersect_impl(const A& a, const B& b, Dynamic_dimension_tag) { // template // inline -// bool +// auto // K::Boolean // do_intersect(const A& a, const B& b) { // CGAL_static_assertion_msg((std::is_same::value), // "do_intersect with objects of different dimensions not supported"); diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Circle_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Circle_2.h index c47b04b035c..399c9ac7046 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Circle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Circle_2.h @@ -24,18 +24,19 @@ namespace Intersections { namespace internal { template -bool do_intersect(const CGAL::Bbox_2& bbox, - const typename K::Circle_2& circle, - const K&) +typename K::Boolean +do_intersect(const CGAL::Bbox_2& bbox, + const typename K::Circle_2& circle, + const K&) { return do_intersect_circle_iso_rectangle_2(circle, bbox, K()); } - template -bool do_intersect(const typename K::Circle_2& circle, - const CGAL::Bbox_2& bbox, - const K&) +typename K::Boolean +do_intersect(const typename K::Circle_2& circle, + const CGAL::Bbox_2& bbox, + const K&) { return do_intersect_circle_iso_rectangle_2(circle, bbox, K()); } @@ -44,15 +45,17 @@ bool do_intersect(const typename K::Circle_2& circle, } // namespace Intersections template -bool do_intersect(const CGAL::Bbox_2& a, - const Circle_2& b) +typename K::Boolean +do_intersect(const CGAL::Bbox_2& a, + const Circle_2& b) { return K().do_intersect_2_object()(a, b); } template -bool do_intersect(const Circle_2& a, - const CGAL::Bbox_2& b) +typename K::Boolean +do_intersect(const Circle_2& a, + const CGAL::Bbox_2& b) { return K().do_intersect_2_object()(a, b); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Iso_rectangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Iso_rectangle_2.h index 1ada75030d3..1c389664308 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Iso_rectangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Iso_rectangle_2.h @@ -21,15 +21,19 @@ namespace CGAL { template -inline bool do_intersect(const Iso_rectangle_2 &rect, - const Bbox_2 &box) +inline +typename K::Boolean +do_intersect(const Iso_rectangle_2& rect, + const Bbox_2& box) { return do_intersect(K::Iso_rectangle_2(box), rect); } template -inline bool do_intersect(const Bbox_2 &box, - const Iso_rectangle_2 &rect) +inline +typename K::Boolean +do_intersect(const Bbox_2 &box, + const Iso_rectangle_2 &rect) { return do_intersect(rect, box); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Line_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Line_2.h index 3b762f0882e..76a4cf316a0 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Line_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Line_2.h @@ -27,18 +27,20 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Line_2& line, - const CGAL::Bbox_2& bbox, - const K& k) +typename K::Boolean +do_intersect(const typename K::Line_2& line, + const CGAL::Bbox_2& bbox, + const K& k) { typedef typename K::Iso_rectangle_2 Iso_rectangle_2; return Intersections::internal::do_intersect(line, Iso_rectangle_2(bbox), k); } template -bool do_intersect(const CGAL::Bbox_2& bbox, - const typename K::Line_2& line, - const K& k) +typename K::Boolean +do_intersect(const CGAL::Bbox_2& bbox, + const typename K::Line_2& line, + const K& k) { return Intersections::internal::do_intersect(line, bbox, k); } @@ -47,13 +49,17 @@ bool do_intersect(const CGAL::Bbox_2& bbox, } // namespace Intersections template -bool do_intersect(const CGAL::Bbox_2& bbox, const Line_2& line) +typename K::Boolean +do_intersect(const CGAL::Bbox_2& bbox, + const Line_2& line) { return K().do_intersect_2_object()(bbox, line); } template -bool do_intersect(const Line_2& line, const CGAL::Bbox_2& bbox) +typename K::Boolean +do_intersect(const Line_2& line, + const CGAL::Bbox_2& bbox) { return K().do_intersect_2_object()(line, bbox); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Point_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Point_2.h index 237407c60ba..1c214d44a4d 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Point_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Point_2.h @@ -24,9 +24,11 @@ namespace Intersections { namespace internal { template -inline bool do_intersect(const Bbox_2 &bbox, - const Point_2 &pt, - const K& k) +inline +typename K::Boolean +do_intersect(const Bbox_2 &bbox, + const Point_2 &pt, + const K& k) { Point_2 bl(bbox.xmin(), bbox.ymin()), tr(bbox.xmax(), bbox.ymax()); @@ -36,9 +38,11 @@ inline bool do_intersect(const Bbox_2 &bbox, } template -inline bool do_intersect(const Point_2 &pt, - const Bbox_2& bbox, - const K& k) +inline +typename K::Boolean +do_intersect(const Point_2 &pt, + const Bbox_2& bbox, + const K& k) { return do_intersect(bbox, pt, k); } @@ -69,15 +73,17 @@ intersection(const CGAL::Bbox_2& b, } // namespace Intersections template -bool do_intersect(const CGAL::Bbox_2& a, - const Point_2& b) +typename K::Boolean +do_intersect(const CGAL::Bbox_2& a, + const Point_2& b) { return Intersections::internal::do_intersect(a,b,K()); } template -bool do_intersect(const Point_2& a, - const CGAL::Bbox_2& b) +typename K::Boolean +do_intersect(const Point_2& a, + const CGAL::Bbox_2& b) { return Intersections::internal::do_intersect(b,a,K()); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Ray_2.h index 75b2e71ebf7..ca5c4411e7e 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Ray_2.h @@ -27,18 +27,20 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Ray_2& ray, - const CGAL::Bbox_2& bbox, - const K& k) +typename K::Boolean +do_intersect(const typename K::Ray_2& ray, + const CGAL::Bbox_2& bbox, + const K& k) { typedef typename K::Iso_rectangle_2 Iso_rectangle_2; return Intersections::internal::do_intersect(ray, Iso_rectangle_2(bbox), k); } template -bool do_intersect(const CGAL::Bbox_2& bbox, - const typename K::Ray_2& ray, - const K& k) +typename K::Boolean +do_intersect(const CGAL::Bbox_2& bbox, + const typename K::Ray_2& ray, + const K& k) { return Intersections::internal::do_intersect(ray, bbox, k); } @@ -47,13 +49,17 @@ bool do_intersect(const CGAL::Bbox_2& bbox, } // namespace Intersections template -bool do_intersect(const CGAL::Bbox_2& bbox, const Ray_2& ray) +typename K::Boolean +do_intersect(const CGAL::Bbox_2& bbox, + const Ray_2& ray) { return K().do_intersect_2_object()(bbox, ray); } template -bool do_intersect(const Ray_2& ray, const CGAL::Bbox_2& bbox) +typename K::Boolean +do_intersect(const Ray_2& ray, + const CGAL::Bbox_2& bbox) { return K().do_intersect_2_object()(ray, bbox); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Segment_2.h index 1bb05d61c91..0d359ca146b 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Segment_2.h @@ -20,20 +20,21 @@ namespace CGAL { - template -inline bool do_intersect( - const Segment_2 &seg, - const Bbox_2 &box) +inline +typename K::Boolean +do_intersect(const Segment_2& seg, + const Bbox_2& box) { typename K::Iso_rectangle_2 rec(box.xmin(), box.ymin(), box.xmax(), box.ymax()); return do_intersect(rec, seg); } template -inline bool do_intersect( - const Bbox_2 &box, - const Segment_2 &seg) +inline +typename K::Boolean +do_intersect(const Bbox_2& box, + const Segment_2& seg) { return do_intersect(seg, box); } @@ -41,7 +42,8 @@ inline bool do_intersect( template typename Intersection_traits::result_type intersection(const CGAL::Bbox_2& box, - const Segment_2& seg) { + const Segment_2& seg) + { typename K::Iso_rectangle_2 rec(box.xmin(), box.ymin(), box.xmax(), box.ymax()); return intersection(rec, seg); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Triangle_2.h index 854499c7151..2f467cbee0b 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Triangle_2.h @@ -22,18 +22,20 @@ namespace CGAL { template -inline bool do_intersect( - const Triangle_2 &tr, - const Bbox_2 &box) +inline +typename K::Boolean +do_intersect(const Triangle_2& tr, + const Bbox_2& box) { typename K::Iso_rectangle_2 rec(box.xmin(), box.ymin(), box.xmax(), box.ymax()); return do_intersect(rec, tr); } template -inline bool do_intersect( - const Bbox_2 &box, - const Triangle_2 &tr) +inline +typename K::Boolean +do_intersect(const Bbox_2& box, + const Triangle_2& tr) { return do_intersect(tr, box); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Circle_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Circle_2.h index 4f24b27c2de..ee7e48255a0 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Circle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Circle_2.h @@ -27,9 +27,9 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Circle_2 & circ1, - const typename K::Circle_2& circ2, - const K&) +typename K::Boolean do_intersect(const typename K::Circle_2& circ1, + const typename K::Circle_2& circ2, + const K&) { typedef typename K::FT FT; diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Iso_rectangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Iso_rectangle_2.h index c1ab3dbc4e1..37a41c0b66d 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Iso_rectangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Iso_rectangle_2.h @@ -24,9 +24,9 @@ namespace internal { // Circle_2 is not a disk, thus if the box is contained within the circle, there is no intersection. template -bool do_intersect_circle_iso_rectangle_2(const typename K::Circle_2& circle, - const typename K::Iso_rectangle_2& rec, - const K&) +typename K::Boolean do_intersect_circle_iso_rectangle_2(const typename K::Circle_2& circle, + const typename K::Iso_rectangle_2& rec, + const K&) { typedef typename K::FT FT; typedef typename K::Point_2 Point; @@ -92,18 +92,17 @@ bool do_intersect_circle_iso_rectangle_2(const typename K::Circle_2& circle, } template -bool do_intersect(const typename K::Iso_rectangle_2& rec, - const typename K::Circle_2& circle, - const K&) +typename K::Boolean do_intersect(const typename K::Iso_rectangle_2& rec, + const typename K::Circle_2& circle, + const K&) { return do_intersect_circle_iso_rectangle_2(circle, rec, K()); } - template -bool do_intersect(const typename K::Circle_2& circle, - const typename K::Iso_rectangle_2& rec, - const K&) +typename K::Boolean do_intersect(const typename K::Circle_2& circle, + const typename K::Iso_rectangle_2& rec, + const K&) { return do_intersect_circle_iso_rectangle_2(circle, rec, K()); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Line_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Line_2.h index a850baa2253..1e6adff6c75 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Line_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Line_2.h @@ -29,8 +29,8 @@ namespace Intersections { namespace internal { template -bool -do_intersect(const typename K::Circle_2 & c, +typename K::Boolean +do_intersect(const typename K::Circle_2& c, const typename K::Line_2& l, const K&) { @@ -38,9 +38,9 @@ do_intersect(const typename K::Circle_2 & c, } template -bool +typename K::Boolean do_intersect(const typename K::Line_2& l, - const typename K::Circle_2 & c, + const typename K::Circle_2& c, const K&) { return squared_distance(c.center(), l) <= c.squared_radius(); diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Point_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Point_2.h index 3d908c6a26b..f63cfa8f049 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Point_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Point_2.h @@ -25,20 +25,19 @@ namespace internal { template inline -bool -do_intersect(const typename K::Point_2 &pt, - const typename K::Circle_2 &circle, +typename K::Boolean +do_intersect(const typename K::Point_2& pt, + const typename K::Circle_2& circle, const K&) { return circle.has_on_boundary(pt); } - template inline -bool -do_intersect(const typename K::Circle_2 &circle, - const typename K::Point_2 &pt, +typename K::Boolean +do_intersect(const typename K::Circle_2& circle, + const typename K::Point_2& pt, const K&) { return circle.has_on_boundary(pt); diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Ray_2.h index 18c19fd8466..0a6980d0152 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Ray_2.h @@ -24,8 +24,8 @@ namespace Intersections { namespace internal { template -bool -do_intersect(const typename K::Circle_2 & c, +typename K::Boolean +do_intersect(const typename K::Circle_2& c, const typename K::Ray_2& r, const K&) { @@ -33,9 +33,9 @@ do_intersect(const typename K::Circle_2 & c, } template -bool +typename K::Boolean do_intersect(const typename K::Ray_2& r, - const typename K::Circle_2 & c, + const typename K::Circle_2& c, const K&) { return squared_distance(c.center(), r) <= c.squared_radius(); diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Segment_2.h index 71384fcc4e6..8aa1826cb88 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Segment_2.h @@ -24,8 +24,8 @@ namespace Intersections { namespace internal { template -bool -do_intersect(const typename K::Circle_2 & c, +typename K::Boolean +do_intersect(const typename K::Circle_2& c, const typename K::Segment_2& s, const K&) { @@ -33,9 +33,9 @@ do_intersect(const typename K::Circle_2 & c, } template -bool +typename K::Boolean do_intersect(const typename K::Segment_2& s, - const typename K::Circle_2 & c, + const typename K::Circle_2& c, const K&) { return squared_distance(c.center(), s) <= c.squared_radius(); diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Triangle_2.h index 9353da936ba..3fa6486477f 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Triangle_2.h @@ -25,7 +25,7 @@ namespace Intersections { namespace internal { template -bool +typename K::Boolean do_intersect(const typename K::Circle_2 & c, const typename K::Triangle_2& t, const K&) @@ -48,9 +48,9 @@ do_intersect(const typename K::Circle_2 & c, } template -bool +typename K::Boolean do_intersect(const typename K::Triangle_2& t, - const typename K::Circle_2 & c, + const typename K::Circle_2& c, const K&) { return do_intersect(c,t); diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Iso_rectangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Iso_rectangle_2.h index a097eab4250..4ce4fdcace6 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Iso_rectangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Iso_rectangle_2.h @@ -74,10 +74,11 @@ intersection( } template -inline bool -do_intersect(const typename K::Iso_rectangle_2 &irect1, - const typename K::Iso_rectangle_2 &irect2, - const K&) { +typename K::Boolean +do_intersect(const typename K::Iso_rectangle_2& irect1, + const typename K::Iso_rectangle_2& irect2, + const K&) +{ return bool(intersection(irect1, irect2)); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Line_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Line_2.h index a8d188a7a42..d1ff597c4f9 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Line_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Line_2.h @@ -58,21 +58,25 @@ protected: }; template -inline bool do_intersect(const typename K::Line_2 &p1, - const typename K::Iso_rectangle_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Line_2& l, + const typename K::Iso_rectangle_2& ir, + const K&) { - typedef Line_2_Iso_rectangle_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Line_2_Iso_rectangle_2_pair pair_t; + pair_t pair(&l, &ir); + return pair.intersection_type() != pair_t::NO_INTERSECTION; } template -inline bool do_intersect(const typename K::Iso_rectangle_2 &p2, - const typename K::Line_2 &p1, - const K& k) +inline +typename K::Boolean +do_intersect(const typename K::Iso_rectangle_2& ir, + const typename K::Line_2& l, + const K& k) { - return internal::do_intersect(p1, p2, k); + return internal::do_intersect(l, ir, k); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Point_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Point_2.h index 853dcc54600..e3fe24df2c5 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Point_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Point_2.h @@ -30,9 +30,9 @@ namespace internal { template inline -bool -do_intersect(const typename K::Point_2 &pt, - const typename K::Iso_rectangle_2 &iso, +typename K::Boolean +do_intersect(const typename K::Point_2& pt, + const typename K::Iso_rectangle_2& iso, const K&) { return !iso.has_on_unbounded_side(pt); @@ -40,9 +40,9 @@ do_intersect(const typename K::Point_2 &pt, template inline -bool -do_intersect(const typename K::Iso_rectangle_2 &iso, - const typename K::Point_2 &pt, +typename K::Boolean +do_intersect(const typename K::Iso_rectangle_2& iso, + const typename K::Point_2& pt, const K&) { return !iso.has_on_unbounded_side(pt); diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Ray_2.h index 5f2b52a311a..f6682a584df 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Ray_2.h @@ -55,21 +55,25 @@ protected: }; template -inline bool do_intersect(const typename K::Ray_2 &p1, - const typename K::Iso_rectangle_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Ray_2& r, + const typename K::Iso_rectangle_2& ir, + const K&) { - typedef Ray_2_Iso_rectangle_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Ray_2_Iso_rectangle_2_pair pair_t; + pair_t pair(&r, &ir); + return pair.intersection_type() != pair_t::NO_INTERSECTION; } template -inline bool do_intersect(const typename K::Iso_rectangle_2 &p2, - const typename K::Ray_2 &p1, - const K& k) +inline +typename K::Boolean +do_intersect(const typename K::Iso_rectangle_2& ir, + const typename K::Ray_2& r, + const K& k) { - return do_intersect(p1, p2, k); + return do_intersect(r, ir, k); } template diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Segment_2.h index 28121109d10..e9f45e439ff 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Segment_2.h @@ -54,21 +54,6 @@ protected: _max; }; -template -inline bool do_intersect( - const typename K::Segment_2 &p1, - const typename K::Iso_rectangle_2 &p2, - const K&) -{ - typedef Segment_2_Iso_rectangle_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; -} - - - - - template typename CGAL::Intersection_traits ::result_type @@ -208,17 +193,26 @@ intersection_point() const return translated_point(_ref_point, construct_scaled_vector(_dir,_min)); } - +template +inline +typename K::Boolean +do_intersect(const typename K::Segment_2& s, + const typename K::Iso_rectangle_2& ir, + const K&) +{ + typedef Segment_2_Iso_rectangle_2_pair pair_t; + pair_t pair(&s, &ir); + return pair.intersection_type() != pair_t::NO_INTERSECTION; +} template -inline bool do_intersect( - const typename K::Iso_rectangle_2 &p1, - const typename K::Segment_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Iso_rectangle_2& ir, + const typename K::Segment_2& s, + const K& k) { - typedef Segment_2_Iso_rectangle_2_pair pair_t; - pair_t pair(&p2, &p1); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + return do_intersect(s, ir, k); } } // namespace internal diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Triangle_2.h index 1409a6c7db8..30b4339109f 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Triangle_2.h @@ -292,10 +292,10 @@ namespace internal { } template - bool do_intersect( - const typename K::Triangle_2 &tr, - const typename K::Iso_rectangle_2 &ir, - const K& k) + typename K::Boolean + do_intersect(const typename K::Triangle_2& tr, + const typename K::Iso_rectangle_2& ir, + const K& k) { //1) check if at least one vertex of tr is not outside ir //2) if not, check if at least on vertex of tr is not outside tr @@ -318,10 +318,11 @@ namespace internal { } template - inline bool do_intersect( - const typename K::Iso_rectangle_2 &ir, - const typename K::Triangle_2 &tr, - const K& k) + inline + typename K::Boolean + do_intersect(const typename K::Iso_rectangle_2& ir, + const typename K::Triangle_2& tr, + const K& k) { return do_intersect(tr,ir,k); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h index 8d2d3e6ae0d..5c0dfd90f10 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h @@ -52,17 +52,18 @@ protected: mutable typename K::Point_2 _intersection_point; }; -template -inline bool do_intersect( - const typename K::Line_2 &p1, - const typename K::Line_2 &p2, - const K&) -{ - typedef Line_2_Line_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; -} +template +inline +typename K::Boolean +do_intersect(const typename K::Line_2& l1, + const typename K::Line_2& l2, + const K&) +{ + typedef Line_2_Line_2_pair pair_t; + pair_t pair(&l1, &l2); + return pair.intersection_type() != pair_t::NO_INTERSECTION; +} template diff --git a/Intersections_2/include/CGAL/Intersections_2/Line_2_Point_2.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Point_2.h index 9e3c2525b44..c2072eb9eec 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Line_2_Point_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Point_2.h @@ -29,18 +29,20 @@ namespace Intersections { namespace internal { template -inline bool -do_intersect(const typename K::Point_2 &pt, - const typename K::Line_2 &line, +inline +typename K::Boolean +do_intersect(const typename K::Point_2& pt, + const typename K::Line_2& line, const K&) { return line.has_on(pt); } template -inline bool -do_intersect(const typename K::Line_2 &line, - const typename K::Point_2 &pt, +inline +typename K::Boolean +do_intersect(const typename K::Line_2& line, + const typename K::Point_2& pt, const K&) { return line.has_on(pt); diff --git a/Intersections_2/include/CGAL/Intersections_2/Line_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Ray_2.h index 87f59d8a45a..8ea0cff4cd4 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Line_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Ray_2.h @@ -55,17 +55,26 @@ protected: }; template -inline bool do_intersect( - const typename K::Ray_2 &p1, - const typename K::Line_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Ray_2& r, + const typename K::Line_2& l, + const K&) { - typedef Ray_2_Line_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Ray_2_Line_2_pair pair_t; + pair_t pair(&r, &l); + return pair.intersection_type() != pair_t::NO_INTERSECTION; } - +template +inline +typename K::Boolean +do_intersect(const typename K::Line_2& l, + const typename K::Ray_2& r, + const K& k) +{ + return do_intersect(r, l, k); +} template typename Intersection_traits @@ -99,20 +108,6 @@ intersection(const typename K::Line_2 &line, return internal::intersection(ray, line, k); } - -template -inline bool do_intersect( - const typename K::Line_2 &p1, - const typename K::Ray_2 &p2, - const K&) -{ - typedef Ray_2_Line_2_pair pair_t; - pair_t pair(&p2, &p1); - return pair.intersection_type() != pair_t::NO_INTERSECTION; -} - - - template typename Ray_2_Line_2_pair::Intersection_results Ray_2_Line_2_pair::intersection_type() const diff --git a/Intersections_2/include/CGAL/Intersections_2/Line_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Segment_2.h index 5c2850af7a8..e2c3ec15d73 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Line_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Segment_2.h @@ -51,14 +51,25 @@ protected: }; template -inline bool do_intersect( - const typename K::Segment_2 &p1, - const typename K::Line_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Segment_2& s, + const typename K::Line_2& l, + const K& ) { - typedef Segment_2_Line_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Segment_2_Line_2_pair pair_t; + pair_t pair(&s, &l); + return pair.intersection_type() != pair_t::NO_INTERSECTION; +} + +template +inline +typename K::Boolean +do_intersect(const typename K::Line_2& l, + const typename K::Segment_2& s, + const K& k) +{ + return internal::do_intersect(s, l, k); } template @@ -92,17 +103,6 @@ intersection(const typename K::Line_2 &line, return internal::intersection(seg, line, k); } - -template -inline bool do_intersect( - const typename K::Line_2 &line, - const typename K::Segment_2 &seg, - const K& k) -{ - return internal::do_intersect(seg, line, k); -} - - template typename Segment_2_Line_2_pair::Intersection_results Segment_2_Line_2_pair::intersection_type() const diff --git a/Intersections_2/include/CGAL/Intersections_2/Line_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Triangle_2.h index 9f514030f8a..551e2f45703 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Line_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Triangle_2.h @@ -55,24 +55,24 @@ protected: template inline -bool -do_intersect(const typename K::Line_2 &p1, - const typename K::Triangle_2 &p2, +typename K::Boolean +do_intersect(const typename K::Line_2& l, + const typename K::Triangle_2& tr, const K&) { - typedef Line_2_Triangle_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Line_2_Triangle_2_pair pair_t; + pair_t pair(&l, &tr); + return pair.intersection_type() != pair_t::NO_INTERSECTION; } template inline -bool -do_intersect(const typename K::Triangle_2 &p2, - const typename K::Line_2 &p1, +typename K::Boolean +do_intersect(const typename K::Triangle_2& tr, + const typename K::Line_2& l, const K& k) { - return internal::do_intersect(p1, p2, k); + return internal::do_intersect(l, tr, k); } template diff --git a/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h b/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h index 7c67f3c4cf5..159c99bc3d6 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h @@ -28,10 +28,11 @@ namespace Intersections { namespace internal { template -inline bool -do_intersect(const typename K::Point_2 &pt1, - const typename K::Point_2 &pt2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Point_2& pt1, + const typename K::Point_2& pt2, + const K& k) { return pt1 == pt2; } diff --git a/Intersections_2/include/CGAL/Intersections_2/Point_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Point_2_Ray_2.h index ae67b94c503..bcdc75de506 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Point_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Point_2_Ray_2.h @@ -30,9 +30,9 @@ namespace internal { template inline -bool -do_intersect(const typename K::Point_2 &pt, - const typename K::Ray_2 &ray, +typename K::Boolean +do_intersect(const typename K::Point_2& pt, + const typename K::Ray_2& ray, const K&) { return ray.has_on(pt); @@ -41,9 +41,9 @@ do_intersect(const typename K::Point_2 &pt, template inline -bool -do_intersect(const typename K::Ray_2 &ray, - const typename K::Point_2 &pt, +typename K::Boolean +do_intersect(const typename K::Ray_2& ray, + const typename K::Point_2& pt, const K&) { return ray.has_on(pt); diff --git a/Intersections_2/include/CGAL/Intersections_2/Point_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Point_2_Segment_2.h index 3486d58896f..a0fcc40d543 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Point_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Point_2_Segment_2.h @@ -30,7 +30,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Point_2 &pt, const typename K::Segment_2 &seg, const K&) @@ -40,7 +40,7 @@ do_intersect(const typename K::Point_2 &pt, template inline -bool +typename K::Boolean do_intersect(const typename K::Segment_2 &seg, const typename K::Point_2 &pt, const K&) diff --git a/Intersections_2/include/CGAL/Intersections_2/Point_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Point_2_Triangle_2.h index ba496198cd9..e23a39229a1 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Point_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Point_2_Triangle_2.h @@ -50,9 +50,11 @@ protected: }; template -inline bool do_intersect(const typename K::Point_2 &p1, - const typename K::Triangle_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Point_2& p1, + const typename K::Triangle_2& p2, + const K&) { typedef Point_2_Triangle_2_pair pair_t; pair_t pair(&p1, &p2); @@ -60,9 +62,11 @@ inline bool do_intersect(const typename K::Point_2 &p1, } template -inline bool do_intersect(const typename K::Triangle_2 &p2, - const typename K::Point_2 &p1, - const K& k) +inline +typename K::Boolean +do_intersect(const typename K::Triangle_2& p2, + const typename K::Point_2& p1, + const K& k) { return internal::do_intersect(p1, p2, k); } diff --git a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h index 2b0c166797b..2069db1511c 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h @@ -54,14 +54,15 @@ protected: }; template -inline bool do_intersect( - const typename K::Ray_2 &p1, - const typename K::Ray_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Ray_2& r1, + const typename K::Ray_2& r2, + const K&) { - typedef Ray_2_Ray_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Ray_2_Ray_2_pair pair_t; + pair_t pair(&r1, &r2); + return pair.intersection_type() != pair_t::NO_INTERSECTION; } diff --git a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h index 2cdebe84a13..b936a195f7d 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h @@ -54,21 +54,25 @@ protected: }; template -inline bool do_intersect(const typename K::Ray_2 &p1, - const typename K::Segment_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Ray_2& r, + const typename K::Segment_2& s, + const K&) { - typedef Ray_2_Segment_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Ray_2_Segment_2_pair pair_t; + pair_t pair(&r, &s); + return pair.intersection_type() != pair_t::NO_INTERSECTION; } template -inline bool do_intersect(const typename K::Segment_2 &p2, - const typename K::Ray_2 &p1, - const K& k) +inline +typename K::Boolean +do_intersect(const typename K::Segment_2& s, + const typename K::Ray_2& r, + const K& k) { - return internal::do_intersect(p1, p2, k); + return internal::do_intersect(r, s, k); } template diff --git a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Triangle_2.h index 6db56586c55..dd1e66ec748 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Triangle_2.h @@ -165,26 +165,26 @@ intersection(const typename K::Triangle_2&tr, template -inline bool do_intersect( - const typename K::Ray_2 &p1, - const typename K::Triangle_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Ray_2& r, + const typename K::Triangle_2& tr, + const K&) { - typedef Ray_2_Triangle_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Ray_2_Triangle_2_pair pair_t; + pair_t pair(&r, &tr); + return pair.intersection_type() != pair_t::NO_INTERSECTION; } template -inline bool do_intersect( - const typename K::Triangle_2 &p1, - const typename K::Ray_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Triangle_2& tr, + const typename K::Ray_2& r, + const K& k) { - typedef Ray_2_Triangle_2_pair pair_t; - pair_t pair(&p2, &p1); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + return do_intersect(r, tr, k); } } // namespace internal diff --git a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h index 5fd1545cc38..3e531a9416b 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h @@ -326,7 +326,7 @@ do_intersect_with_info(const typename K::Segment_2 &seg1, template -bool +typename K::Boolean do_intersect(const typename K::Segment_2 &seg1, const typename K::Segment_2 &seg2, const K& k) diff --git a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Triangle_2.h index 4d2b93c05cf..df5f08aef9b 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Triangle_2.h @@ -52,19 +52,26 @@ protected: }; template -inline bool do_intersect( - const typename K::Segment_2 &p1, - const typename K::Triangle_2 &p2, - const K&) +inline +typename K::Boolean +do_intersect(const typename K::Segment_2& s, + const typename K::Triangle_2& tr, + const K&) { - typedef Segment_2_Triangle_2_pair pair_t; - pair_t pair(&p1, &p2); - return pair.intersection_type() != pair_t::NO_INTERSECTION; + typedef Segment_2_Triangle_2_pair pair_t; + pair_t pair(&s, &tr); + return pair.intersection_type() != pair_t::NO_INTERSECTION; } - - - +template +inline +typename K::Boolean +do_intersect(const typename K::Triangle_2& tr, + const typename K::Segment_2& s, + const K& k) +{ + return do_intersect(s, tr, k); +} template typename Segment_2_Triangle_2_pair::Intersection_results @@ -174,18 +181,6 @@ intersection(const typename K::Triangle_2&tr, return internal::intersection(seg, tr, k); } - -template -inline bool do_intersect( - const typename K::Triangle_2 &p1, - const typename K::Segment_2 &p2, - const K&) -{ - typedef Segment_2_Triangle_2_pair pair_t; - pair_t pair(&p2, &p1); - return pair.intersection_type() != pair_t::NO_INTERSECTION; -} - } // namespace internal } // namespace Intersections diff --git a/Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_do_intersect_impl.h b/Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_do_intersect_impl.h index e5db80f33e1..ad3202287cb 100644 --- a/Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_do_intersect_impl.h +++ b/Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_do_intersect_impl.h @@ -23,15 +23,15 @@ namespace Intersections { namespace internal { template -bool intersection_test_vertex(const typename K::Point_2 * P1, - const typename K::Point_2 * Q1, - const typename K::Point_2 * R1, - const typename K::Point_2 * P2, - const typename K::Point_2 * Q2, - const typename K::Point_2 * R2, - const K & k ){ - - +typename K::Boolean +intersection_test_vertex(const typename K::Point_2* P1, + const typename K::Point_2* Q1, + const typename K::Point_2* R1, + const typename K::Point_2* P2, + const typename K::Point_2* Q2, + const typename K::Point_2* R2, + const K& k) +{ CGAL_kernel_precondition( k.orientation_2_object() (*P1,*Q1,*R1) == POSITIVE); CGAL_kernel_precondition( k.orientation_2_object() (*P2,*Q2,*R2) @@ -65,16 +65,15 @@ bool intersection_test_vertex(const typename K::Point_2 * P1, template -bool intersection_test_edge(const typename K::Point_2 * P1, - const typename K::Point_2 * Q1, - const typename K::Point_2 * R1, - const typename K::Point_2 * P2, - const typename K::Point_2 * - CGAL_kernel_precondition_code(Q2), - const typename K::Point_2 * R2, - const K & k ){ - - +typename K::Boolean +intersection_test_edge(const typename K::Point_2* P1, + const typename K::Point_2* Q1, + const typename K::Point_2* R1, + const typename K::Point_2* P2, + const typename K::Point_2* CGAL_kernel_precondition_code(Q2), + const typename K::Point_2* R2, + const K& k) +{ CGAL_kernel_precondition( k.orientation_2_object() (*P1,*Q1,*R1) == POSITIVE); CGAL_kernel_precondition( k.orientation_2_object() (*P2,*Q2,*R2) @@ -99,12 +98,12 @@ bool intersection_test_edge(const typename K::Point_2 * P1, } - template -bool do_intersect(const typename K::Triangle_2 &t1, - const typename K::Triangle_2 &t2, - const K & k ){ - +typename K::Boolean +do_intersect(const typename K::Triangle_2& t1, + const typename K::Triangle_2& t2, + const K& k) +{ CGAL_kernel_precondition( ! k.is_degenerate_2_object() (t1) ); CGAL_kernel_precondition( ! k.is_degenerate_2_object() (t2) ); diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h index f497eb4527f..bb244628c5a 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h @@ -64,7 +64,7 @@ namespace Intersections { namespace internal { template -bool +typename K::Boolean inline do_intersect(const CGAL::Bbox_3& c, const CGAL::Bbox_3& bbox, diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Iso_cuboid_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Iso_cuboid_3.h index fae76f0d787..9e509f0f405 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Iso_cuboid_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Iso_cuboid_3.h @@ -30,15 +30,17 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Iso_cuboid_3& ic) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Iso_cuboid_3& ic) { return K().do_intersect_3_object()(box, ic); } template -bool do_intersect(const Iso_cuboid_3& ic, - const CGAL::Bbox_3& box) +typename K::Boolean +do_intersect(const Iso_cuboid_3& ic, + const CGAL::Bbox_3& box) { return K().do_intersect_3_object()(ic, box); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Line_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Line_3.h index 20a9e5e3d2a..d0aa3a8ddd3 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Line_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Line_3.h @@ -24,15 +24,17 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Line_3& l) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Line_3& l) { return K().do_intersect_3_object()(box, l); } template -bool do_intersect(const Line_3& l, - const CGAL::Bbox_3& box) +typename K::Boolean +do_intersect(const Line_3& l, + const CGAL::Bbox_3& box) { return K().do_intersect_3_object()(l, box); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Plane_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Plane_3.h index ce7888e7539..1b83a30290f 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Plane_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Plane_3.h @@ -30,15 +30,17 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Plane_3& pl) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Plane_3& pl) { return K().do_intersect_3_object()(box, pl); } template -bool do_intersect(const Plane_3& pl, - const CGAL::Bbox_3& box) +typename K::Boolean +do_intersect(const Plane_3& pl, + const CGAL::Bbox_3& box) { return K().do_intersect_3_object()(pl, box); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Point_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Point_3.h index 5737a04dba5..316e5ffc003 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Point_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Point_3.h @@ -30,8 +30,9 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Point_3& p) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Point_3& p) { Point_3 bl(box.xmin(), box.ymin(), box.zmin()), tr(box.xmax(), box.ymax(), box.zmax()); @@ -40,8 +41,9 @@ bool do_intersect(const CGAL::Bbox_3& box, } template -bool do_intersect(const Point_3& a, - const CGAL::Bbox_3& b) +typename K::Boolean +do_intersect(const Point_3& a, + const CGAL::Bbox_3& b) { return do_intersect(b,a); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Ray_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Ray_3.h index 3d557b0ecdd..5d53929d895 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Ray_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Ray_3.h @@ -30,15 +30,17 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Ray_3& r) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Ray_3& r) { return K().do_intersect_3_object()(box, r); } template -bool do_intersect(const Ray_3& r, - const CGAL::Bbox_3& box) +typename K::Boolean +do_intersect(const Ray_3& r, + const CGAL::Bbox_3& box) { return K().do_intersect_3_object()(r, box); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Segment_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Segment_3.h index 35b20b8091d..cb8cd08bd88 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Segment_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Segment_3.h @@ -30,15 +30,17 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Segment_3& s) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Segment_3& s) { return K().do_intersect_3_object()(box, s); } template -bool do_intersect(const Segment_3& s, - const CGAL::Bbox_3& box) +typename K::Boolean +do_intersect(const Segment_3& s, + const CGAL::Bbox_3& box) { return K().do_intersect_3_object()(s, box); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Sphere_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Sphere_3.h index 913020d62cd..87171cfd3de 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Sphere_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Sphere_3.h @@ -28,15 +28,17 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Sphere_3& s) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Sphere_3& s) { return K().do_intersect_3_object()(box, s); } template -bool do_intersect(const Sphere_3& s, - const CGAL::Bbox_3& box) +typename K::Boolean +do_intersect(const Sphere_3& s, + const CGAL::Bbox_3& box) { return K().do_intersect_3_object()(s, box); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Tetrahedron_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Tetrahedron_3.h index 456973dbc6a..73fee00b20d 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Tetrahedron_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Tetrahedron_3.h @@ -28,15 +28,17 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Tetrahedron_3& t) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Tetrahedron_3& t) { return K().do_intersect_3_object()(box, t); } template -bool do_intersect(const Tetrahedron_3& t, - const CGAL::Bbox_3& box) +typename K::Boolean +do_intersect(const Tetrahedron_3& t, + const CGAL::Bbox_3& box) { return K().do_intersect_3_object()(t, box); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Triangle_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Triangle_3.h index 202765284c7..ccf1a560256 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Triangle_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Triangle_3.h @@ -29,15 +29,17 @@ namespace CGAL { template -bool do_intersect(const CGAL::Bbox_3& box, - const Triangle_3& tr) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& box, + const Triangle_3& tr) { return K().do_intersect_3_object()(box, tr); } template -bool do_intersect(const Triangle_3& tr, - const CGAL::Bbox_3& box) +typename K::Boolean +do_intersect(const Triangle_3& tr, + const CGAL::Bbox_3& box) { return K().do_intersect_3_object()(tr, box); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Plane_3_Plane_3_Plane_3.h b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Plane_3_Plane_3.h index 236fd2a9f50..3030089906c 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Plane_3_Plane_3_Plane_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Plane_3_Plane_3.h @@ -30,7 +30,8 @@ namespace CGAL { template -inline bool +inline +typename K::Boolean do_intersect(const Plane_3& plane1, const Plane_3& plane2, const Plane_3& plane3) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Iso_cuboid_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Iso_cuboid_3_do_intersect.h index 1a2ae1310e5..ab6a98443af 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Iso_cuboid_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Iso_cuboid_3_do_intersect.h @@ -23,9 +23,10 @@ namespace Intersections { namespace internal { template -bool do_intersect(const CGAL::Bbox_3& bb, - const typename K::Iso_cuboid_3& ic, - const K& /* k */) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& bb, + const typename K::Iso_cuboid_3& ic, + const K& /* k */) { // use CGAL::compare to access the Coercion_traits between K::FT and double if(compare(bb.xmax(), ic.xmin()) == SMALLER || compare(ic.xmax(), bb.xmin()) == SMALLER) @@ -38,9 +39,10 @@ bool do_intersect(const CGAL::Bbox_3& bb, } template -bool do_intersect(const typename K::Iso_cuboid_3& ic, - const CGAL::Bbox_3& bb, - const K& k) +typename K::Boolean +do_intersect(const typename K::Iso_cuboid_3& ic, + const CGAL::Bbox_3& bb, + const K& k) { return do_intersect(bb, ic, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Line_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Line_3_do_intersect.h index 6062ba6085a..352515571d5 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Line_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Line_3_do_intersect.h @@ -25,9 +25,9 @@ namespace CGAL { namespace Intersections { namespace internal { -template +template inline -bool +typename K::Boolean bbox_line_do_intersect_aux(const LFT px, const LFT py, const LFT pz, const LFT vx, const LFT vy, const LFT vz, const BFT bxmin, const BFT bymin, const BFT bzmin, @@ -135,9 +135,10 @@ bbox_line_do_intersect_aux(const LFT px, const LFT py, const LFT pz, } template -bool do_intersect(const typename K::Line_3& line, - const CGAL::Bbox_3& bbox, - const K&) +typename K::Boolean +do_intersect(const typename K::Line_3& line, + const CGAL::Bbox_3& bbox, + const K&) { typedef typename K::Point_3 Point_3; typedef typename K::Vector_3 Vector_3; @@ -145,16 +146,17 @@ bool do_intersect(const typename K::Line_3& line, const Point_3& point = line.point(); const Vector_3& v = line.to_vector(); - return bbox_line_do_intersect_aux(point.x(), point.y(), point.z(), - v.x(), v.y(), v.z(), - bbox.xmin(), bbox.ymin(), bbox.zmin(), - bbox.xmax(), bbox.ymax(), bbox.zmax()); + return bbox_line_do_intersect_aux(point.x(), point.y(), point.z(), + v.x(), v.y(), v.z(), + bbox.xmin(), bbox.ymin(), bbox.zmin(), + bbox.xmax(), bbox.ymax(), bbox.zmax()); } template -bool do_intersect(const CGAL::Bbox_3& bbox, - const typename K::Line_3& line, - const K& k) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& bbox, + const typename K::Line_3& line, + const K& k) { return do_intersect(line, bbox, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Plane_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Plane_3_do_intersect.h index 803d8594e64..4e412f45d67 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Plane_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Plane_3_do_intersect.h @@ -22,17 +22,19 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Plane_3& plane, - const Bbox_3& bbox, - const K& k) +typename K::Boolean +do_intersect(const typename K::Plane_3& plane, + const Bbox_3& bbox, + const K& k) { return do_intersect_plane_box(plane, bbox, k); } template -bool do_intersect(const Bbox_3& bbox, - const typename K::Plane_3& plane, - const K& k) +typename K::Boolean +do_intersect(const Bbox_3& bbox, + const typename K::Plane_3& plane, + const K& k) { return do_intersect_plane_box(plane, bbox, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Ray_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Ray_3_do_intersect.h index 36ca263a827..cb6813acf02 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Ray_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Ray_3_do_intersect.h @@ -26,9 +26,10 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Ray_3& ray, - const CGAL::Bbox_3& bbox, - const K&) +typename K::Boolean +do_intersect(const typename K::Ray_3& ray, + const CGAL::Bbox_3& bbox, + const K&) { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; @@ -49,9 +50,10 @@ bool do_intersect(const typename K::Ray_3& ray, } template -bool do_intersect(const CGAL::Bbox_3& bbox, - const typename K::Ray_3& ray, - const K& k) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& bbox, + const typename K::Ray_3& ray, + const K& k) { return do_intersect(ray, bbox, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h index 8a94ade50b7..72c9eee7692 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h @@ -467,9 +467,10 @@ do_intersect_bbox_segment_aux( } template -bool do_intersect(const typename K::Segment_3& segment, - const CGAL::Bbox_3& bbox, - const K&) +typename K::Boolean +do_intersect(const typename K::Segment_3& segment, + const CGAL::Bbox_3& bbox, + const K&) { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; @@ -483,9 +484,10 @@ bool do_intersect(const typename K::Segment_3& segment, } template -bool do_intersect(const CGAL::Bbox_3& bbox, - const typename K::Segment_3& segment, - const K& k) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& bbox, + const typename K::Segment_3& segment, + const K& k) { return do_intersect(segment, bbox, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h index f37ede7b5fa..4c3c4f0c731 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h @@ -23,9 +23,10 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Sphere_3& sphere, - const CGAL::Bbox_3& bbox, - const K& k) +typename K::Boolean +do_intersect(const typename K::Sphere_3& sphere, + const CGAL::Bbox_3& bbox, + const K& k) { return do_intersect_sphere_box_3(sphere, bbox.xmin(), bbox.ymin(), bbox.zmin(), @@ -34,9 +35,10 @@ bool do_intersect(const typename K::Sphere_3& sphere, } template -bool do_intersect(const CGAL::Bbox_3& bbox, - const typename K::Sphere_3& sphere, - const K& k) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& bbox, + const typename K::Sphere_3& sphere, + const K& k) { return do_intersect(sphere, bbox, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Tetrahedron_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Tetrahedron_3_do_intersect.h index 9be2c0ccef6..c842e5623ea 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Tetrahedron_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Tetrahedron_3_do_intersect.h @@ -24,9 +24,11 @@ namespace Intersections { namespace internal { template -inline typename K::Boolean do_intersect(const CGAL::Bbox_3& aabb, - const typename K::Tetrahedron_3& tet, - const K& k) +inline +typename K::Boolean +do_intersect(const CGAL::Bbox_3& aabb, + const typename K::Tetrahedron_3& tet, + const K& k) { typename K::Construct_triangle_3 tr = k.construct_triangle_3_object(); typename K::Boolean result = false; @@ -57,9 +59,11 @@ inline typename K::Boolean do_intersect(const CGAL::Bbox_3& aabb, } template -inline typename K::Boolean do_intersect(const typename K::Tetrahedron_3& tet, - const CGAL::Bbox_3& bb, - const K &k) +inline +typename K::Boolean +do_intersect(const typename K::Tetrahedron_3& tet, + const CGAL::Bbox_3& bb, + const K &k) { return do_intersect(bb, tet, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Triangle_3_do_intersect.h index 8eca9e6a517..81d93d25210 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Triangle_3_do_intersect.h @@ -397,9 +397,10 @@ do_intersect_bbox_or_iso_cuboid_impl(const std::array< std::array, 3>& tr } template -bool do_intersect_bbox_or_iso_cuboid(const typename K::Triangle_3& a_triangle, - const Box3& a_bbox, - const K& k) +typename K::Boolean +do_intersect_bbox_or_iso_cuboid(const typename K::Triangle_3& a_triangle, + const Box3& a_bbox, + const K& k) { if(certainly_not(do_bbox_intersect(a_triangle, a_bbox))) return false; @@ -423,22 +424,23 @@ bool do_intersect_bbox_or_iso_cuboid(const typename K::Triangle_3& a_triangle, { a_triangle[2][0], a_triangle[2][1], a_triangle[2][2] } }}; - // exception will be thrown in case the output is indeterminate return do_intersect_bbox_or_iso_cuboid_impl(triangle, a_bbox, do_axis_intersect_aux_impl); } template -bool do_intersect(const typename K::Triangle_3& triangle, - const CGAL::Bbox_3& bbox, - const K& k) +typename K::Boolean +do_intersect(const typename K::Triangle_3& triangle, + const CGAL::Bbox_3& bbox, + const K& k) { return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k); } template -bool do_intersect(const CGAL::Bbox_3& bbox, - const typename K::Triangle_3& triangle, - const K& k) +typename K::Boolean +do_intersect(const CGAL::Bbox_3& bbox, + const typename K::Triangle_3& triangle, + const K& k) { return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Iso_cuboid_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Iso_cuboid_3_do_intersect.h index 3cdf1025537..18bc0e585f4 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Iso_cuboid_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Iso_cuboid_3_do_intersect.h @@ -18,7 +18,8 @@ namespace Intersections { namespace internal { template -inline bool +inline +typename K::Boolean do_intersect(const typename K::Iso_cuboid_3& icub1, const typename K::Iso_cuboid_3& icub2, const K&) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Line_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Line_3_do_intersect.h index 0b3c26bf131..43c4db6c48c 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Line_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Line_3_do_intersect.h @@ -23,7 +23,8 @@ namespace Intersections { namespace internal { template -inline bool +inline +typename K::Boolean do_intersect(const typename K::Line_3& line, const typename K::Iso_cuboid_3& ic, const K&) @@ -34,14 +35,15 @@ do_intersect(const typename K::Line_3& line, const Point_3& point = line.point(); const Vector_3& v = line.to_vector(); - return bbox_line_do_intersect_aux(point.x(), point.y(), point.z(), - v.x(), v.y(), v.z(), - (ic.min)().x(), (ic.min)().y(), (ic.min)().z(), - (ic.max)().x(), (ic.max)().y(), (ic.max)().z()); + return bbox_line_do_intersect_aux(point.x(), point.y(), point.z(), + v.x(), v.y(), v.z(), + (ic.min)().x(), (ic.min)().y(), (ic.min)().z(), + (ic.max)().x(), (ic.max)().y(), (ic.max)().z()); } template -inline bool +inline +typename K::Boolean do_intersect(const typename K::Iso_cuboid_3& ic, const typename K::Line_3& l, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Plane_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Plane_3_do_intersect.h index 17af49e0246..3510e29db64 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Plane_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Plane_3_do_intersect.h @@ -79,9 +79,9 @@ Uncertain get_min_max(const typename K::Vector_3& p, } template // Iso_cuboid_3 or Bbox_3 -bool do_intersect_plane_box(const typename K::Plane_3& plane, - const Box3& bbox, - const K&) +typename K::Boolean do_intersect_plane_box(const typename K::Plane_3& plane, + const Box3& bbox, + const K&) { typedef typename K::Point_3 Point_3; @@ -114,17 +114,19 @@ bool do_intersect_plane_box(const typename K::Plane_3& plane, } template -bool do_intersect(const typename K::Plane_3& plane, - const typename K::Iso_cuboid_3& bbox, - const K& k) +typename K::Boolean +do_intersect(const typename K::Plane_3& plane, + const typename K::Iso_cuboid_3& bbox, + const K& k) { return do_intersect_plane_box(plane, bbox, k); } template -bool do_intersect(const typename K::Iso_cuboid_3& bbox, - const typename K::Plane_3& plane, - const K& k) +typename K::Boolean +do_intersect(const typename K::Iso_cuboid_3& bbox, + const typename K::Plane_3& plane, + const K& k) { return do_intersect_plane_box(plane, bbox, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Point_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Point_3_do_intersect.h index bafe971d903..32d01b5526a 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Point_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Point_3_do_intersect.h @@ -19,7 +19,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Point_3& pt, const typename K::Iso_cuboid_3& iso, const K& k) @@ -29,7 +29,7 @@ do_intersect(const typename K::Point_3& pt, template inline -bool +typename K::Boolean do_intersect(const typename K::Iso_cuboid_3& iso, const typename K::Point_3& pt, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Ray_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Ray_3_do_intersect.h index e467d7ea327..6dd2a0ee646 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Ray_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Ray_3_do_intersect.h @@ -27,9 +27,10 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Ray_3& ray, - const typename K::Iso_cuboid_3& ic, - const K&) +typename K::Boolean +do_intersect(const typename K::Ray_3& ray, + const typename K::Iso_cuboid_3& ic, + const K&) { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; @@ -51,9 +52,11 @@ bool do_intersect(const typename K::Ray_3& ray, } template -bool do_intersect(const typename K::Iso_cuboid_3& ic, - const typename K::Ray_3& ray, - const K& k) { +typename K::Boolean +do_intersect(const typename K::Iso_cuboid_3& ic, + const typename K::Ray_3& ray, + const K& k) +{ return do_intersect(ray, ic, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Segment_3_do_intersect.h index 3c42487730f..c14046c54aa 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Segment_3_do_intersect.h @@ -24,9 +24,10 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Segment_3& seg, - const typename K::Iso_cuboid_3& ic, - const K&) +typename K::Boolean +do_intersect(const typename K::Segment_3& seg, + const typename K::Iso_cuboid_3& ic, + const K&) { typedef typename K::FT FT; typedef typename K::Point_3 Point_3; @@ -48,9 +49,10 @@ bool do_intersect(const typename K::Segment_3& seg, } template -bool do_intersect(const typename K::Iso_cuboid_3& ic, - const typename K::Segment_3& seg, - const K& k) +typename K::Boolean +do_intersect(const typename K::Iso_cuboid_3& ic, + const typename K::Segment_3& seg, + const K& k) { return do_intersect(seg, ic, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Sphere_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Sphere_3_do_intersect.h index f6090ba7cbf..a9ef6c3a50a 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Sphere_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Sphere_3_do_intersect.h @@ -22,10 +22,11 @@ namespace Intersections { namespace internal { template // Iso_cuboid_3 or Bbox_3 -bool do_intersect_sphere_box_3(const typename K::Sphere_3& sphere, - const BFT bxmin, const BFT bymin, const BFT bzmin, - const BFT bxmax, const BFT bymax, const BFT bzmax, - const K&) +typename K::Boolean +do_intersect_sphere_box_3(const typename K::Sphere_3& sphere, + const BFT bxmin, const BFT bymin, const BFT bzmin, + const BFT bxmax, const BFT bymax, const BFT bzmax, + const K&) { typedef typename K::FT SFT; typedef typename Coercion_traits::Type FT; @@ -94,9 +95,10 @@ bool do_intersect_sphere_box_3(const typename K::Sphere_3& sphere, } template -bool do_intersect(const typename K::Sphere_3& sphere, - const typename K::Iso_cuboid_3& ic, - const K& k) +typename K::Boolean +do_intersect(const typename K::Sphere_3& sphere, + const typename K::Iso_cuboid_3& ic, + const K& k) { return do_intersect_sphere_box_3(sphere, (ic.min)().x(), (ic.min)().y(), (ic.min)().z(), @@ -105,9 +107,10 @@ bool do_intersect(const typename K::Sphere_3& sphere, } template -bool do_intersect(const typename K::Iso_cuboid_3& ic, - const typename K::Sphere_3& sphere, - const K& k) +typename K::Boolean +do_intersect(const typename K::Iso_cuboid_3& ic, + const typename K::Sphere_3& sphere, + const K& k) { return do_intersect(sphere, ic, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h index 723ef269306..08a2e19e49d 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h @@ -21,17 +21,19 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Triangle_3& triangle, - const typename K::Iso_cuboid_3& bbox, - const K& k) +typename K::Boolean +do_intersect(const typename K::Triangle_3& triangle, + const typename K::Iso_cuboid_3& bbox, + const K& k) { return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k); } template -bool do_intersect(const typename K::Iso_cuboid_3& bbox, - const typename K::Triangle_3& triangle, - const K& k) +typename K::Boolean +do_intersect(const typename K::Iso_cuboid_3& bbox, + const typename K::Triangle_3& triangle, + const K& k) { return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Line_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Line_3_do_intersect.h index 5da82672621..43a161c9c3f 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Line_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Line_3_do_intersect.h @@ -18,7 +18,7 @@ namespace Intersections { namespace internal { template -bool +typename K::Boolean do_intersect(const typename K::Line_3& l1, const typename K::Line_3& l2, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Plane_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Plane_3_do_intersect.h index 2dc5b2122cd..72ead862807 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Plane_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Plane_3_do_intersect.h @@ -21,7 +21,7 @@ namespace Intersections { namespace internal { template -bool +typename K::Boolean do_intersect(const typename K::Plane_3& plane, const typename K::Line_3& line, const K&) @@ -48,7 +48,7 @@ do_intersect(const typename K::Plane_3& plane, template inline -bool +typename K::Boolean do_intersect(const typename K::Line_3& line, const typename K::Plane_3& plane, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Point_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Point_3_do_intersect.h index b4a0cf92113..a4407eb7f16 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Point_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Point_3_do_intersect.h @@ -18,7 +18,7 @@ namespace Intersections { namespace internal { template -inline bool +inline typename K::Boolean do_intersect(const typename K::Point_3& pt, const typename K::Line_3& line, const K& k) @@ -27,7 +27,7 @@ do_intersect(const typename K::Point_3& pt, } template -inline bool +inline typename K::Boolean do_intersect(const typename K::Line_3& line, const typename K::Point_3& pt, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Ray_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Ray_3_do_intersect.h index e6e125107f0..f4aa1e8e37c 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Ray_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Ray_3_do_intersect.h @@ -23,7 +23,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Line_3& l, const typename K::Ray_3& r, const K& k) @@ -47,7 +47,7 @@ do_intersect(const typename K::Line_3& l, template inline -bool +typename K::Boolean do_intersect(const typename K::Ray_3& r, const typename K::Line_3& l, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Segment_3_do_intersect.h index d03d33e76e7..d080ac11279 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Segment_3_do_intersect.h @@ -24,7 +24,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Line_3& l, const typename K::Segment_3& s, const K& k) @@ -52,7 +52,7 @@ do_intersect(const typename K::Line_3& l, template inline -bool +typename K::Boolean do_intersect(const typename K::Segment_3& s, const typename K::Line_3& l, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Triangle_3_do_intersect.h index 4b2635a3153..a5b5dd1fc76 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Triangle_3_do_intersect.h @@ -21,9 +21,10 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Triangle_3& t, - const typename K::Line_3& l, - const K& k) +typename K::Boolean +do_intersect(const typename K::Triangle_3& t, + const typename K::Line_3& l, + const K& k) { CGAL_kernel_precondition(!k.is_degenerate_3_object()(t)); CGAL_kernel_precondition(!k.is_degenerate_3_object()(l)); @@ -73,9 +74,10 @@ bool do_intersect(const typename K::Triangle_3& t, template inline -bool do_intersect(const typename K::Line_3& l, - const typename K::Triangle_3& t, - const K& k) +typename K::Boolean + do_intersect(const typename K::Line_3& l, + const typename K::Triangle_3& t, + const K& k) { return do_intersect(t, l, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_Plane_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_Plane_3_do_intersect.h index 2884506fc20..05ff652ccfa 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_Plane_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_Plane_3_do_intersect.h @@ -23,7 +23,7 @@ namespace Intersections { namespace internal { template -inline bool +inline typename K::Boolean do_intersect(const typename K::Plane_3& plane1, const typename K::Plane_3& plane2, const typename K::Plane_3& plane3, diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_do_intersect.h index fc984e41dcf..cf39bbe2c41 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Plane_3_do_intersect.h @@ -20,7 +20,7 @@ namespace Intersections { namespace internal { template -inline bool +inline typename K::Boolean do_intersect(const typename K::Plane_3& plane1, const typename K::Plane_3& plane2, const K&) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Point_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Point_3_do_intersect.h index f53221b5700..d3798d69b6b 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Point_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Point_3_do_intersect.h @@ -18,7 +18,7 @@ namespace Intersections { namespace internal { template -inline bool +inline typename K::Boolean do_intersect(const typename K::Point_3& pt, const typename K::Plane_3& plane, const K& k) @@ -27,7 +27,7 @@ do_intersect(const typename K::Point_3& pt, } template -inline bool +inline typename K::Boolean do_intersect(const typename K::Plane_3& plane, const typename K::Point_3& pt, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Ray_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Ray_3_do_intersect.h index d254bc3f367..f57d4f9d25a 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Ray_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Ray_3_do_intersect.h @@ -25,7 +25,7 @@ namespace Intersections { namespace internal { template -bool +typename K::Boolean do_intersect(const typename K::Plane_3& plane, const typename K::Ray_3& ray, const K& k) @@ -40,7 +40,7 @@ do_intersect(const typename K::Plane_3& plane, template inline -bool +typename K::Boolean do_intersect(const typename K::Ray_3& ray, const typename K::Plane_3& plane, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Segment_3_do_intersect.h index 581a9cfa9a8..509ef49ecee 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Segment_3_do_intersect.h @@ -20,7 +20,7 @@ namespace Intersections { namespace internal { template -bool +typename K::Boolean do_intersect(const typename K::Plane_3& plane, const typename K::Segment_3& seg, const K&) @@ -41,7 +41,7 @@ do_intersect(const typename K::Plane_3& plane, template inline -bool +typename K::Boolean do_intersect(const typename K::Segment_3& seg, const typename K::Plane_3& plane, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Sphere_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Sphere_3_do_intersect.h index df7b7c738ae..9f1e51f8686 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Sphere_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Sphere_3_do_intersect.h @@ -21,7 +21,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Plane_3& p, const typename K::Sphere_3& s, const K&) @@ -37,7 +37,7 @@ do_intersect(const typename K::Plane_3& p, template inline -bool +typename K::Boolean do_intersect(const typename K::Sphere_3& s, const typename K::Plane_3& p, const K&) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Triangle_3_do_intersect.h index 2d7cd516900..ea0462dadd6 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Triangle_3_do_intersect.h @@ -21,9 +21,10 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Triangle_3& t, - const typename K::Plane_3& h, - const K& k) +typename K::Boolean +do_intersect(const typename K::Triangle_3& t, + const typename K::Plane_3& h, + const K& k) { CGAL_kernel_precondition(!k.is_degenerate_3_object()(t)); CGAL_kernel_precondition(!k.is_degenerate_3_object()(h)); @@ -49,9 +50,10 @@ bool do_intersect(const typename K::Triangle_3& t, template inline -bool do_intersect(const typename K::Plane_3& h, - const typename K::Triangle_3& t, - const K& k) +typename K::Boolean +do_intersect(const typename K::Plane_3& h, + const typename K::Triangle_3& t, + const K& k) { return do_intersect(t, h, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Ray_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Ray_3_do_intersect.h index 0aec93a129c..69f75948f8b 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Ray_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Ray_3_do_intersect.h @@ -19,7 +19,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Point_3& pt, const typename K::Ray_3& ray, const K& k) @@ -29,7 +29,7 @@ do_intersect(const typename K::Point_3& pt, template inline -bool +typename K::Boolean do_intersect(const typename K::Ray_3& ray, const typename K::Point_3& pt, const K& k) @@ -39,7 +39,7 @@ do_intersect(const typename K::Ray_3& ray, template -bool +typename K::Boolean Ray_3_has_on_collinear_Point_3(const typename K::Ray_3& r, const typename K::Point_3& p, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Segment_3_do_intersect.h index 2872694d6af..fa54c9bbaba 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Segment_3_do_intersect.h @@ -19,7 +19,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Point_3& pt, const typename K::Segment_3& seg, const K& k) @@ -29,7 +29,7 @@ do_intersect(const typename K::Point_3& pt, template inline -bool +typename K::Boolean do_intersect(const typename K::Segment_3& seg, const typename K::Point_3& pt, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Sphere_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Sphere_3_do_intersect.h index d825e2ff820..e9734dfdb23 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Sphere_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Sphere_3_do_intersect.h @@ -19,7 +19,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Point_3& pt, const typename K::Sphere_3& sphere, const K& k) @@ -29,7 +29,7 @@ do_intersect(const typename K::Point_3& pt, template inline -bool +typename K::Boolean do_intersect(const typename K::Sphere_3& sphere, const typename K::Point_3& pt, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Tetrahedron_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Tetrahedron_3_do_intersect.h index 0518a305073..b22ffc8d0a2 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Tetrahedron_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Tetrahedron_3_do_intersect.h @@ -19,7 +19,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Point_3& pt, const typename K::Tetrahedron_3& tetrahedron, const K& k) @@ -29,7 +29,7 @@ do_intersect(const typename K::Point_3& pt, template inline -bool +typename K::Boolean do_intersect(const typename K::Tetrahedron_3& tetrahedron, const typename K::Point_3& pt, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Triangle_3_do_intersect.h index a116b4617a9..f22d551e842 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Triangle_3_do_intersect.h @@ -21,9 +21,10 @@ namespace Intersections { namespace internal { template -bool do_intersect(const typename K::Triangle_3& t, - const typename K::Point_3& p, - const K& k) +typename K::Boolean +do_intersect(const typename K::Triangle_3& t, + const typename K::Point_3& p, + const K& k) { CGAL_kernel_precondition(!k.is_degenerate_3_object()(t)); @@ -68,9 +69,10 @@ bool do_intersect(const typename K::Triangle_3& t, } template -bool do_intersect(const typename K::Point_3& p, - const typename K::Triangle_3& t, - const K& k) +typename K::Boolean +do_intersect(const typename K::Point_3& p, + const typename K::Triangle_3& t, + const K& k) { return do_intersect(t, p, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Ray_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Ray_3_do_intersect.h index cf334475335..5ceb8e0eeb9 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Ray_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Ray_3_do_intersect.h @@ -24,7 +24,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Ray_3& r1, const typename K::Ray_3& r2, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Segment_3_do_intersect.h index bf57d977f0c..72d4ceec703 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Segment_3_do_intersect.h @@ -24,7 +24,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Segment_3& s, const typename K::Ray_3& r, const K& k) @@ -56,7 +56,7 @@ do_intersect(const typename K::Segment_3& s, template inline -bool +typename K::Boolean do_intersect(const typename K::Ray_3& r, const typename K::Segment_3& s, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Triangle_3_do_intersect.h index f0d6ea725d3..d349c2616e2 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Triangle_3_do_intersect.h @@ -328,18 +328,20 @@ do_intersect(const typename K::Triangle_3& t, } template -bool do_intersect(const typename K::Triangle_3& t, - const typename K::Ray_3& r, - const K& k) +typename K::Boolean +do_intersect(const typename K::Triangle_3& t, + const typename K::Ray_3& r, + const K& k) { return do_intersect(t, r, k, r3t3_do_intersect_empty_visitor()); } template inline -bool do_intersect(const typename K::Ray_3& r, - const typename K::Triangle_3& t, - const K& k) +typename K::Boolean +do_intersect(const typename K::Ray_3& r, + const typename K::Triangle_3& t, + const K& k) { return do_intersect(t, r, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Segment_3_do_intersect.h index 5943325975b..db3b01bffb9 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Segment_3_do_intersect.h @@ -23,7 +23,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Segment_3& s1, const typename K::Segment_3& s2, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Triangle_3_do_intersect.h index 70c0f3e0813..5a1f7ecff28 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Triangle_3_do_intersect.h @@ -173,9 +173,10 @@ bool do_intersect_coplanar(const typename K::Triangle_3& t, } template -bool do_intersect(const typename K::Triangle_3& t, - const typename K::Segment_3& s, - const K& k) +typename K::Boolean +do_intersect(const typename K::Triangle_3& t, + const typename K::Segment_3& s, + const K& k) { CGAL_kernel_precondition(!k.is_degenerate_3_object()(t) ); CGAL_kernel_precondition(!k.is_degenerate_3_object()(s) ); @@ -269,9 +270,10 @@ bool do_intersect(const typename K::Triangle_3& t, template inline -bool do_intersect(const typename K::Segment_3& s, - const typename K::Triangle_3& t, - const K& k) +typename K::Boolean +do_intersect(const typename K::Segment_3& s, + const typename K::Triangle_3& t, + const K& k) { return do_intersect(t, s, k); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Sphere_3_Sphere_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Sphere_3_Sphere_3_do_intersect.h index 52976148c05..b7bf1a8e5c0 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Sphere_3_Sphere_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Sphere_3_Sphere_3_do_intersect.h @@ -21,7 +21,7 @@ namespace internal { template inline -bool +typename K::Boolean do_intersect(const typename K::Sphere_3& s1, const typename K::Sphere_3& s2, const K& k) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_do_intersect.h index ce993540138..0ab18e3e0c8 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_do_intersect.h @@ -22,13 +22,14 @@ namespace Intersections { namespace internal { template -bool _intersection_test_vertex(const typename K::Point_3* p, - const typename K::Point_3* q, - const typename K::Point_3* r, - const typename K::Point_3* a, - const typename K::Point_3* b, - const typename K::Point_3* c, - const K& k) +typename K::Boolean +_intersection_test_vertex(const typename K::Point_3* p, + const typename K::Point_3* q, + const typename K::Point_3* r, + const typename K::Point_3* a, + const typename K::Point_3* b, + const typename K::Point_3* c, + const K& k) { CGAL_kernel_precondition(k.coplanar_orientation_3_object()(*p,*q,*r) == POSITIVE); CGAL_kernel_precondition(k.coplanar_orientation_3_object()(*a,*b,*c) == POSITIVE); @@ -64,13 +65,14 @@ bool _intersection_test_vertex(const typename K::Point_3* p, } template -bool _intersection_test_edge(const typename K::Point_3* p, - const typename K::Point_3* q, - const typename K::Point_3* r, - const typename K::Point_3* a, - const typename K::Point_3* CGAL_kernel_precondition_code(b), - const typename K::Point_3* c, - const K& k) +typename K::Boolean +_intersection_test_edge(const typename K::Point_3* p, + const typename K::Point_3* q, + const typename K::Point_3* r, + const typename K::Point_3* a, + const typename K::Point_3* CGAL_kernel_precondition_code(b), + const typename K::Point_3* c, + const K& k) { CGAL_kernel_precondition(k.coplanar_orientation_3_object() (*p,*q,*r) == POSITIVE); CGAL_kernel_precondition(k.coplanar_orientation_3_object() (*a,*b,*c) == POSITIVE); @@ -97,9 +99,10 @@ bool _intersection_test_edge(const typename K::Point_3* p, } template -bool do_intersect_coplanar(const typename K::Triangle_3& t1, - const typename K::Triangle_3& t2, - const K& k) +typename K::Boolean +do_intersect_coplanar(const typename K::Triangle_3& t1, + const typename K::Triangle_3& t2, + const K& k) { typedef typename K::Point_3 Point_3; From 8ba0b41f510f15460d52443187499920b3ecbff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 22 Nov 2022 12:35:10 +0100 Subject: [PATCH 33/39] Drive-by cleaning --- .../include/CGAL/Intersections_2/Bbox_2_Segment_2.h | 6 ++++-- .../include/CGAL/Intersections_2/Bbox_2_Triangle_2.h | 10 ++++++---- .../include/CGAL/Intersections_2/Circle_2_Line_2.h | 2 +- .../include/CGAL/Intersections_2/Circle_2_Point_2.h | 11 ++++++----- .../include/CGAL/Intersections_2/Circle_2_Ray_2.h | 1 + .../include/CGAL/Intersections_2/Circle_2_Segment_2.h | 1 + .../CGAL/Intersections_2/Circle_2_Triangle_2.h | 1 + .../Intersections_2/Iso_rectangle_2_Iso_rectangle_2.h | 5 ++--- .../CGAL/Intersections_2/Iso_rectangle_2_Line_2.h | 4 +--- .../CGAL/Intersections_2/Iso_rectangle_2_Point_2.h | 8 ++++---- .../CGAL/Intersections_2/Iso_rectangle_2_Ray_2.h | 5 ++--- .../CGAL/Intersections_2/Iso_rectangle_2_Segment_2.h | 2 +- .../CGAL/Intersections_2/Iso_rectangle_2_Triangle_2.h | 8 ++++---- .../include/CGAL/Intersections_2/Line_2_Line_2.h | 5 ++--- .../include/CGAL/Intersections_2/Line_2_Point_2.h | 8 ++++---- .../include/CGAL/Intersections_2/Line_2_Segment_2.h | 5 ++--- .../include/CGAL/Intersections_2/Line_2_Triangle_2.h | 4 ++-- .../include/CGAL/Intersections_2/Point_2_Point_2.h | 7 +++---- .../include/CGAL/Intersections_2/Point_2_Ray_2.h | 11 ++++------- .../include/CGAL/Intersections_2/Point_2_Segment_2.h | 5 ++--- .../include/CGAL/Intersections_2/Point_2_Triangle_2.h | 4 ++-- .../include/CGAL/Intersections_2/Ray_2_Ray_2.h | 5 ++--- .../include/CGAL/Intersections_2/Ray_2_Segment_2.h | 4 ++-- .../include/CGAL/Intersections_2/Ray_2_Triangle_2.h | 5 ++--- .../CGAL/Intersections_2/Segment_2_Segment_2.h | 4 ++-- .../CGAL/Intersections_2/Segment_2_Triangle_2.h | 4 ++-- .../CGAL/Intersections_2/Triangle_2_Triangle_2.h | 4 +++- .../CGAL/Intersections_2/internal/Straight_2.h | 5 ++--- .../Triangle_2_Triangle_2_do_intersect_impl.h | 4 ++-- .../CGAL/Intersections_3/Iso_cuboid_3_Triangle_3.h | 2 +- .../internal/Bbox_3_Segment_3_do_intersect.h | 7 +++---- .../internal/Iso_cuboid_3_Plane_3_do_intersect.h | 3 ++- .../internal/Iso_cuboid_3_Triangle_3_do_intersect.h | 3 --- .../internal/Segment_3_Triangle_3_do_intersect.h | 3 ++- 34 files changed, 80 insertions(+), 86 deletions(-) diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Segment_2.h index 0d359ca146b..25834353eb8 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Segment_2.h @@ -51,9 +51,11 @@ intersection(const CGAL::Bbox_2& box, template typename Intersection_traits::result_type intersection(const Segment_2& seg, - const CGAL::Bbox_2& box) { + const CGAL::Bbox_2& box) +{ return intersection(box, seg); } -} +} // namespace CGAL + #endif // CGAL_INTERSECTIONS_BBOX_2_SEGMENT_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Triangle_2.h index 2f467cbee0b..8dd4236f591 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Triangle_2.h @@ -20,7 +20,6 @@ namespace CGAL { - template inline typename K::Boolean @@ -43,7 +42,8 @@ do_intersect(const Bbox_2& box, template typename Intersection_traits::result_type intersection(const Bbox_2& box, - const Triangle_2& tr) { + const Triangle_2& tr) + { typename K::Iso_rectangle_2 rec(box.xmin(), box.ymin(), box.xmax(), box.ymax()); return intersection(rec, tr); } @@ -51,9 +51,11 @@ intersection(const Bbox_2& box, template typename Intersection_traits::result_type intersection(const Triangle_2& tr, - const Bbox_2& box) { + const Bbox_2& box) +{ return intersection(box, tr); } -} +} // namespace CGAL + #endif // CGAL_INTERSECTIONS_BBOX_2_TRIANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Line_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Line_2.h index 1e6adff6c75..2d2ac26fc56 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Line_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Line_2.h @@ -53,4 +53,4 @@ CGAL_DO_INTERSECT_FUNCTION(Circle_2, Line_2, 2) } // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_CIRCLE_2_LINE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Point_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Point_2.h index f63cfa8f049..ac88c867d12 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Point_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Point_2.h @@ -47,8 +47,8 @@ do_intersect(const typename K::Circle_2& circle, template typename CGAL::Intersection_traits ::result_type -intersection(const typename K::Point_2 &pt, - const typename K::Circle_2 &circle, +intersection(const typename K::Point_2& pt, + const typename K::Circle_2& circle, const K& k) { if (do_intersect(pt,circle, k)) @@ -59,8 +59,8 @@ intersection(const typename K::Point_2 &pt, template typename CGAL::Intersection_traits ::result_type -intersection(const typename K::Circle_2 &circle, - const typename K::Point_2 &pt, +intersection(const typename K::Circle_2& circle, + const typename K::Point_2& pt, const K& k) { return internal::intersection(pt, circle, k); @@ -72,5 +72,6 @@ intersection(const typename K::Circle_2 &circle, CGAL_INTERSECTION_FUNCTION(Point_2, Circle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Circle_2, Point_2, 2) -} //namespace CGAL +} // namespace CGAL + #endif // CGAL_INTERSECTIONS_2_POINT_2_CIRCLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Ray_2.h index 0a6980d0152..0bb6c56f331 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Ray_2.h @@ -47,4 +47,5 @@ do_intersect(const typename K::Ray_2& r, CGAL_DO_INTERSECT_FUNCTION(Circle_2, Ray_2, 2) } // namespace CGAL + #endif // CGAL_INTERSECTIONS_2_CIRCLE_2_RAY_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Segment_2.h index 8aa1826cb88..d884d520332 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Segment_2.h @@ -47,4 +47,5 @@ do_intersect(const typename K::Segment_2& s, CGAL_DO_INTERSECT_FUNCTION(Circle_2, Segment_2, 2) } // namespace CGAL + #endif // CGAL_INTERSECTIONS_2_CIRCLE_2_SEGMENT_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Triangle_2.h index 3fa6486477f..e74f1e80e8d 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Triangle_2.h @@ -62,4 +62,5 @@ do_intersect(const typename K::Triangle_2& t, CGAL_DO_INTERSECT_FUNCTION(Circle_2, Triangle_2, 2) } // namespace CGAL + #endif // CGAL_INTERSECTIONS_2_CIRCLE_2_TRIANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Iso_rectangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Iso_rectangle_2.h index 4ce4fdcace6..0b73db82b88 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Iso_rectangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Iso_rectangle_2.h @@ -85,10 +85,9 @@ do_intersect(const typename K::Iso_rectangle_2& irect1, } // namespace internal } // namespace Intersections - CGAL_INTERSECTION_FUNCTION_SELF(Iso_rectangle_2, 2) CGAL_DO_INTERSECT_FUNCTION_SELF(Iso_rectangle_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_ISO_RECTANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Line_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Line_2.h index d1ff597c4f9..74bb8ff2f82 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Line_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Line_2.h @@ -79,8 +79,6 @@ do_intersect(const typename K::Iso_rectangle_2& ir, return internal::do_intersect(l, ir, k); } - - template typename Line_2_Iso_rectangle_2_pair::Intersection_results Line_2_Iso_rectangle_2_pair::intersection_type() const @@ -221,4 +219,4 @@ CGAL_DO_INTERSECT_FUNCTION(Line_2, Iso_rectangle_2, 2) #include -#endif +#endif // CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_LINE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Point_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Point_2.h index e3fe24df2c5..011eacf8e36 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Point_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Point_2.h @@ -35,7 +35,7 @@ do_intersect(const typename K::Point_2& pt, const typename K::Iso_rectangle_2& iso, const K&) { - return !iso.has_on_unbounded_side(pt); + return !iso.has_on_unbounded_side(pt); } template @@ -45,7 +45,7 @@ do_intersect(const typename K::Iso_rectangle_2& iso, const typename K::Point_2& pt, const K&) { - return !iso.has_on_unbounded_side(pt); + return !iso.has_on_unbounded_side(pt); } template @@ -77,6 +77,6 @@ intersection(const typename K::Iso_rectangle_2 &iso, CGAL_INTERSECTION_FUNCTION(Point_2, Iso_rectangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Point_2, Iso_rectangle_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_POINT_2_ISO_RECTANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Ray_2.h index f6682a584df..6d9bb8e6e91 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Ray_2.h @@ -204,9 +204,8 @@ Ray_2_Iso_rectangle_2_pair::intersection_point() const CGAL_INTERSECTION_FUNCTION(Ray_2, Iso_rectangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Ray_2, Iso_rectangle_2, 2) - -} //namespace CGAL +} // namespace CGAL #include -#endif // CGAL_RAY_2_iSO_RECTANGLE_2_INTERSECTION_H +#endif // CGAL_RAY_2_ISO_RECTANGLE_2_INTERSECTION_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Segment_2.h index e9f45e439ff..be4c309f0df 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Segment_2.h @@ -221,7 +221,7 @@ do_intersect(const typename K::Iso_rectangle_2& ir, CGAL_INTERSECTION_FUNCTION(Segment_2, Iso_rectangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Segment_2, Iso_rectangle_2, 2) -} //namespace CGAL +} // namespace CGAL #include diff --git a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Triangle_2.h index 30b4339109f..0fb171e7b92 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Triangle_2.h @@ -324,15 +324,15 @@ namespace internal { const typename K::Triangle_2& tr, const K& k) { - return do_intersect(tr,ir,k); + return do_intersect(tr, ir, k); } -} //namespace internal +} // namespace internal } // namespace Intersections CGAL_INTERSECTION_FUNCTION(Triangle_2, Iso_rectangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Triangle_2, Iso_rectangle_2, 2) -}//end namespace +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_TRIANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h index 5c0dfd90f10..6a48b777594 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h @@ -201,7 +201,6 @@ Line_2_Line_2_pair::intersection_line() const CGAL_INTERSECTION_FUNCTION_SELF(Line_2, 2) CGAL_DO_INTERSECT_FUNCTION_SELF(Line_2, 2) +} // namespace CGAL -} //namespace CGAL - -#endif +#endif // CGAL_INTERSECTIONS_2_LINE_2_LINE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Line_2_Point_2.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Point_2.h index c2072eb9eec..96ede987ac4 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Line_2_Point_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Point_2.h @@ -35,7 +35,7 @@ do_intersect(const typename K::Point_2& pt, const typename K::Line_2& line, const K&) { - return line.has_on(pt); + return line.has_on(pt); } template @@ -45,7 +45,7 @@ do_intersect(const typename K::Line_2& line, const typename K::Point_2& pt, const K&) { - return line.has_on(pt); + return line.has_on(pt); } template @@ -78,6 +78,6 @@ intersection(const typename K::Line_2 &line, CGAL_INTERSECTION_FUNCTION(Point_2, Line_2, 2) CGAL_DO_INTERSECT_FUNCTION(Point_2, Line_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_POINT_2_LINE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Line_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Segment_2.h index e2c3ec15d73..f61d38c2a06 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Line_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Segment_2.h @@ -156,7 +156,6 @@ Segment_2_Line_2_pair::intersection_segment() const CGAL_INTERSECTION_FUNCTION(Segment_2, Line_2, 2) CGAL_DO_INTERSECT_FUNCTION(Segment_2, Line_2, 2) +} // namespace CGAL -} //namespace CGAL - -#endif +#endif // CGAL_INTERSECTIONS_2_SEGMENT_2_LINE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Line_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Triangle_2.h index 551e2f45703..158ede462b6 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Line_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Triangle_2.h @@ -190,6 +190,6 @@ intersection(const typename K::Triangle_2 &tr, CGAL_INTERSECTION_FUNCTION(Line_2, Triangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Line_2, Triangle_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_LINE_2_TRIANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h b/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h index 159c99bc3d6..2981dad86ad 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h @@ -50,13 +50,12 @@ intersection(const typename K::Point_2 &pt1, return intersection_return(); } -}// namespace internal +} // namespace internal } // namespace Intersections CGAL_INTERSECTION_FUNCTION_SELF(Point_2, 2) CGAL_DO_INTERSECT_FUNCTION_SELF(Point_2, 2) +} // namespace CGAL -} //namespace CGAL - -#endif +#endif // CGAL_INTERSECTIONS_2_POINT_2_POINT_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Point_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Point_2_Ray_2.h index bcdc75de506..271e86184cf 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Point_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Point_2_Ray_2.h @@ -51,8 +51,7 @@ do_intersect(const typename K::Ray_2& ray, template -typename CGAL::Intersection_traits -::result_type +typename CGAL::Intersection_traits::result_type intersection(const typename K::Point_2 &pt, const typename K::Ray_2 &ray, const K& k) @@ -64,8 +63,7 @@ intersection(const typename K::Point_2 &pt, } template -typename CGAL::Intersection_traits -::result_type +typename CGAL::Intersection_traits::result_type intersection(const typename K::Ray_2 &ray, const typename K::Point_2 &pt, const K& k) @@ -79,7 +77,6 @@ intersection(const typename K::Ray_2 &ray, CGAL_INTERSECTION_FUNCTION(Point_2, Ray_2, 2) CGAL_DO_INTERSECT_FUNCTION(Point_2, Ray_2, 2) +} // namespace CGAL -} //namespace CGAL - -#endif +#endif // CGAL_INTERSECTIONS_2_POINT_2_RAY_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Point_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Point_2_Segment_2.h index a0fcc40d543..8a48c10b6e3 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Point_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Point_2_Segment_2.h @@ -77,10 +77,9 @@ intersection( const typename K::Segment_2 &seg, } // namespace internal } // namespace Intersections - CGAL_INTERSECTION_FUNCTION(Point_2, Segment_2, 2) CGAL_DO_INTERSECT_FUNCTION(Point_2, Segment_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_POINT_2_SEGMENT_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Point_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Point_2_Triangle_2.h index e23a39229a1..1d70d3b7d54 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Point_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Point_2_Triangle_2.h @@ -137,6 +137,6 @@ intersection(const typename K::Triangle_2 &tr, CGAL_INTERSECTION_FUNCTION(Point_2, Triangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Point_2, Triangle_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_POINT_2_TRIANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h index 2069db1511c..850f3e364b0 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h @@ -253,7 +253,6 @@ intersection(const typename K::Ray_2 &ray1, CGAL_INTERSECTION_FUNCTION_SELF(Ray_2, 2) CGAL_DO_INTERSECT_FUNCTION_SELF(Ray_2, 2) +} // namespace CGAL -} //namespace CGAL - -#endif +#endif // CGAL_INTERSECTIONS_2_RAY_2_RAY_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h index b936a195f7d..acc6d4a41df 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h @@ -269,6 +269,6 @@ intersection(const typename K::Segment_2 &seg, CGAL_INTERSECTION_FUNCTION(Ray_2, Segment_2, 2) CGAL_DO_INTERSECT_FUNCTION(Ray_2, Segment_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_RAY_2_SEGMENT_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Triangle_2.h index dd1e66ec748..cb915a1020b 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Triangle_2.h @@ -193,7 +193,6 @@ do_intersect(const typename K::Triangle_2& tr, CGAL_INTERSECTION_FUNCTION(Ray_2, Triangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Ray_2, Triangle_2, 2) +} // namespace CGAL -} //namespace CGAL - -#endif +#endif // CGAL_INTERSECTIONS_2_RAY_2_TRIANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h index 3e531a9416b..663db4b19f2 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h @@ -492,6 +492,6 @@ intersection(const typename K::Segment_2 &seg1, CGAL_INTERSECTION_FUNCTION_SELF(Segment_2, 2) CGAL_DO_INTERSECT_FUNCTION_SELF(Segment_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_SEGMENT_2_SEGMENT_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Triangle_2.h index df5f08aef9b..f747ac083cf 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Triangle_2.h @@ -187,6 +187,6 @@ intersection(const typename K::Triangle_2&tr, CGAL_INTERSECTION_FUNCTION(Segment_2, Triangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Segment_2, Triangle_2, 2) -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_SEGMENT_2_TRIANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2.h index 27b2d9f8f67..405d6499696 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2.h @@ -22,8 +22,10 @@ #include namespace CGAL { + CGAL_DO_INTERSECT_FUNCTION_SELF(Triangle_2, 2) CGAL_INTERSECTION_FUNCTION_SELF(Triangle_2, 2) + } // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_TRIANGLE_2_TRIANGLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/internal/Straight_2.h b/Intersections_2/include/CGAL/Intersections_2/internal/Straight_2.h index 36cc7e06486..88176280301 100644 --- a/Intersections_2/include/CGAL/Intersections_2/internal/Straight_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/internal/Straight_2.h @@ -14,7 +14,6 @@ // // Author(s) : Geert-Jan Giezeman - #ifndef CGAL_INTERSECTIONS_2_INTERNAL_STRAIGHT_2_H #define CGAL_INTERSECTIONS_2_INTERNAL_STRAIGHT_2_H @@ -346,6 +345,6 @@ collinear_order(typename K::Point_2 const &pt1, typename K::Point_2 const & pt2) } // namespace internal } // namespace Intersections -} //namespace CGAL +} // namespace CGAL -#endif +#endif // CGAL_INTERSECTIONS_2_INTERNAL_STRAIGHT_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_do_intersect_impl.h b/Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_do_intersect_impl.h index ad3202287cb..774abba6178 100644 --- a/Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_do_intersect_impl.h +++ b/Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_do_intersect_impl.h @@ -163,6 +163,6 @@ do_intersect(const typename K::Triangle_2& t1, } // namespace internal } // namespace Intersections -} //namespace CGAL +} // namespace CGAL -#endif //CGAL_TRIANGLE_2_TRIANGLE_2_DO_INTERSECT_H +#endif // CGAL_TRIANGLE_2_TRIANGLE_2_DO_INTERSECT_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Triangle_3.h b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Triangle_3.h index b6d7c174b9f..764e6005cf3 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Triangle_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Triangle_3.h @@ -34,4 +34,4 @@ CGAL_INTERSECTION_FUNCTION(Iso_cuboid_3, Triangle_3, 3) } // namespace CGAL -#endif // CGAL_INTERSECTIONS_3_BBOX_3_TRIANGLE_3_H +#endif // CGAL_INTERSECTIONS_3_ISO_CUBOID_3_TRIANGLE_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h index 72c9eee7692..1c4572bfb53 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h @@ -454,10 +454,9 @@ template inline typename Do_intersect_bbox_segment_aux_is_greater::result_type -do_intersect_bbox_segment_aux( - const FT& px, const FT& py, const FT& pz, - const FT& qx, const FT& qy, const FT& qz, - const Bbox_3& bb) +do_intersect_bbox_segment_aux(const FT& px, const FT& py, const FT& pz, + const FT& qx, const FT& qy, const FT& qz, + const Bbox_3& bb) { return do_intersect_bbox_segment_aux(px, py, pz, diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Plane_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Plane_3_do_intersect.h index 3510e29db64..f35ddb65d2b 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Plane_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Plane_3_do_intersect.h @@ -87,7 +87,8 @@ typename K::Boolean do_intersect_plane_box(const typename K::Plane_3& plane, Point_3 p_max, p_min; Uncertain b = get_min_max(plane.orthogonal_vector(), bbox, p_min, p_max); - if(is_certain(b)){ + if(is_certain(b)) + { return ! (plane.oriented_side(p_max) == ON_NEGATIVE_SIDE || plane.oriented_side(p_min) == ON_POSITIVE_SIDE); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h index 08a2e19e49d..6974c72ebad 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h @@ -40,9 +40,6 @@ do_intersect(const typename K::Iso_cuboid_3& bbox, } // namespace internal } // namespace Intersections - - - } // namespace CGAL #endif // CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_TRIANGLE_3_DO_INTERSECT_H diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Triangle_3_do_intersect.h index 5a1f7ecff28..23fc5d897f4 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Triangle_3_do_intersect.h @@ -25,7 +25,8 @@ bool do_intersect_coplanar(const typename K::Point_3& A, const typename K::Point_3& B, const typename K::Point_3& C, const typename K::Point_3& p, - const typename K::Point_3& q, const K& k) + const typename K::Point_3& q, + const K& k) { typedef typename K::Point_3 Point_3; From dbe4c0fb5efb40ac5bde3e0ea82d9348e5996ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 22 Nov 2022 12:35:22 +0100 Subject: [PATCH 34/39] Use a kernel functor instead of assuming kernel object operators exist --- .../CGAL/Intersections_2/Point_2_Point_2.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h b/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h index 2981dad86ad..3b13b6a461e 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h @@ -34,20 +34,19 @@ do_intersect(const typename K::Point_2& pt1, const typename K::Point_2& pt2, const K& k) { - return pt1 == pt2; + return k.equal_2_object()(pt1, pt2); } template -typename CGAL::Intersection_traits -::result_type -intersection(const typename K::Point_2 &pt1, - const typename K::Point_2 &pt2, - const K&) +typename CGAL::Intersection_traits::result_type +intersection(const typename K::Point_2& pt1, + const typename K::Point_2& pt2, + const K& k) { - if (pt1 == pt2) { - return intersection_return(pt1); - } - return intersection_return(); + if (k.equal_2_object()(pt1, pt2)) + return intersection_return(pt1); + + return intersection_return(); } } // namespace internal From a7581010386e659c0e6638f180630ab45c9524fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 22 Nov 2022 12:35:44 +0100 Subject: [PATCH 35/39] Remove some useless includes --- .../include/CGAL/Intersections_2/Segment_2_Segment_2.h | 1 - .../test/Intersections_3/bbox_other_do_intersect_test.cpp | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h index 663db4b19f2..57f2e31b5bb 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h @@ -25,7 +25,6 @@ #include #include #include -#include #include namespace CGAL { diff --git a/Intersections_3/test/Intersections_3/bbox_other_do_intersect_test.cpp b/Intersections_3/test/Intersections_3/bbox_other_do_intersect_test.cpp index 29debe09068..5abda44ee23 100644 --- a/Intersections_3/test/Intersections_3/bbox_other_do_intersect_test.cpp +++ b/Intersections_3/test/Intersections_3/bbox_other_do_intersect_test.cpp @@ -11,8 +11,6 @@ // Author(s) : Stephane Tayeb // -#include - #include #if defined(BOOST_MSVC) @@ -22,17 +20,19 @@ // leda_rational, or Gmpq, or Quotient typedef CGAL::Exact_rational Rational; + #include #include #include #include #include #include - -#include +#include #include // for nextafter +#include +#include double random_in(const double a, const double b) From 517f4db59d3cf4f9f8f85e5ce50d1422ec8ab045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 22 Nov 2022 12:35:54 +0100 Subject: [PATCH 36/39] Hide some ifs behind assertion_code macros --- .../internal/Bbox_3_Segment_3_do_intersect.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h index 1c4572bfb53..9e5371814ad 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h @@ -224,10 +224,10 @@ do_intersect_bbox_segment_aux(const FT& px, const FT& py, const FT& pz, CGAL_assertion(! is_negative(dmin)); CGAL_assertion(! is_negative(dmax)); - if(bounded_0) { + CGAL_assertion_code(if(bounded_0) {) CGAL_assertion(! is_negative(tmin)); CGAL_assertion(! is_negative(tmax)); - } + CGAL_assertion_code(}) // ----------------------------------- // treat y coord @@ -365,11 +365,10 @@ do_intersect_bbox_segment_aux(const FT& px, const FT& py, const FT& pz, CGAL_assertion(! is_negative(dzmin)); CGAL_assertion(! is_negative(dzmax)); - if(bounded_0) - { + CGAL_assertion_code(if(bounded_0) {) CGAL_assertion(! is_negative(tzmin)); CGAL_assertion(! is_negative(tzmax)); - } + CGAL_assertion_code(}) typedef Do_intersect_bbox_segment_aux_is_greater Is_greater; typedef typename Is_greater::result_type Is_greater_value; From 4bb2d1327231572dd5db370e26fc6faa662d1f91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 22 Nov 2022 12:36:07 +0100 Subject: [PATCH 37/39] Rephrase comment --- Kernel_23/include/CGAL/Kernel/function_objects.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index c9a7391f225..3dee6912b54 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -3023,7 +3023,7 @@ namespace CommonKernelFunctors { public: typedef typename K::Boolean result_type; - // Needs FT because Line/Line (and variations) and Circle_2/X compute intersections + // Needs_FT because Line/Line (and variations) as well as Circle_2/X compute intersections template Needs_FT operator()(const T1& t1, const T2& t2) const From 386c6a3ac26f4d627773fee1a5a9f51b56bc8ab4 Mon Sep 17 00:00:00 2001 From: Mael Date: Tue, 22 Nov 2022 18:42:13 +0100 Subject: [PATCH 38/39] Fix typo --- .../include/CGAL/Intersections_2/Bbox_2_Triangle_2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Triangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Triangle_2.h index 8dd4236f591..0cf76cbff32 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Triangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Triangle_2.h @@ -43,7 +43,7 @@ template typename Intersection_traits::result_type intersection(const Bbox_2& box, const Triangle_2& tr) - { +{ typename K::Iso_rectangle_2 rec(box.xmin(), box.ymin(), box.xmax(), box.ymax()); return intersection(rec, tr); } From 18ff1d425657bccc04904cfeb5829b477a06ec9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 24 Nov 2022 11:39:50 +0100 Subject: [PATCH 39/39] Add missing CGAL enums to Homogeneous_d --- Kernel_d/include/CGAL/Cartesian_d.h | 4 ++-- Kernel_d/include/CGAL/Homogeneous_d.h | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Kernel_d/include/CGAL/Cartesian_d.h b/Kernel_d/include/CGAL/Cartesian_d.h index f23ed661412..cb4d1f848c2 100644 --- a/Kernel_d/include/CGAL/Cartesian_d.h +++ b/Kernel_d/include/CGAL/Cartesian_d.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include @@ -71,7 +71,7 @@ public: typedef typename Point_d_base::Cartesian_const_iterator Cartesian_const_iterator_d; - // Boolean had originally been Bool. It was renamed to avoid a conflict + // Boolean had originally been Bool. It was renamed to avoid a conflict // between a macro defined in Xlib.h poorly chosen to have the same name, // that is 'Bool'. typedef typename Same_uncertainty_nt::type diff --git a/Kernel_d/include/CGAL/Homogeneous_d.h b/Kernel_d/include/CGAL/Homogeneous_d.h index 5f8026fbbf5..b5f6981a468 100644 --- a/Kernel_d/include/CGAL/Homogeneous_d.h +++ b/Kernel_d/include/CGAL/Homogeneous_d.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -67,6 +67,24 @@ public: typedef typename Point_d_base::Cartesian_const_iterator Cartesian_const_iterator_d; + // Boolean had originally been Bool. It was renamed to avoid a conflict + // between a macro defined in Xlib.h poorly chosen to have the same name, + // that is 'Bool'. + typedef typename Same_uncertainty_nt::type + Boolean; + typedef typename Same_uncertainty_nt::type + Sign; + typedef typename Same_uncertainty_nt::type + Comparison_result; + typedef typename Same_uncertainty_nt::type + Orientation; + typedef typename Same_uncertainty_nt::type + Oriented_side; + typedef typename Same_uncertainty_nt::type + Bounded_side; + typedef typename Same_uncertainty_nt::type + Angle; + typedef Dynamic_dimension_tag Dimension; template