From e2423af1ad5045d443fbc6aa7dc838f6d6613310 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Thu, 25 Aug 2022 19:11:07 +0300 Subject: [PATCH 001/194] Replaced call to member traits() with geometry_traits() and cleaned up --- .../Arr_trapezoid_ric_pl_impl.h | 39 +++++++------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h index f95817735da..45964fdf1e6 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h @@ -316,7 +316,7 @@ _vertical_ray_shoot(const Point_2& p, bool shoot_up) const // face) we check the isolated vertices inside the face to check whether there // is an isolated vertex right above/below the query point. // -template +template typename Arr_trapezoid_ric_point_location::result_type Arr_trapezoid_ric_point_location:: _check_isolated_for_vertical_ray_shoot (Halfedge_const_handle halfedge_found, @@ -324,40 +324,33 @@ _check_isolated_for_vertical_ray_shoot (Halfedge_const_handle halfedge_found, bool shoot_up, const Td_map_item& tr) const { + const auto* gt = this->arrangement()->geometry_traits(); const Comparison_result point_above_under = (shoot_up ? SMALLER : LARGER); - typename Geometry_traits_2::Compare_x_2 compare_x = - this->arrangement()->traits()->compare_x_2_object(); - typename Geometry_traits_2::Compare_xy_2 compare_xy = - this->arrangement()->traits()->compare_xy_2_object(); - typename Geometry_traits_2::Compare_y_at_x_2 compare_y_at_x = - this->arrangement()->traits()->compare_y_at_x_2_object(); + auto compare_x = gt->compare_x_2_object(); + auto compare_xy = gt->compare_xy_2_object(); + auto compare_y_at_x = gt->compare_y_at_x_2_object(); - Isolated_vertex_const_iterator iso_verts_it; - Vertex_const_handle closest_iso_v; - const Vertex_const_handle invalid_v; - const Halfedge_const_handle invalid_he; - Face_const_handle face; + Vertex_const_handle closest_iso_v; + const Vertex_const_handle invalid_v; + const Halfedge_const_handle invalid_he; // If the closest feature is a valid halfedge, take its incident face. // Otherwise, take the unbounded face. - if (halfedge_found == invalid_he) - face = _get_unbounded_face(tr, p, All_sides_oblivious_category()); - else + Face_const_handle face = (halfedge_found == invalid_he) ? + _get_unbounded_face(tr, p, All_sides_oblivious_category()) : face = halfedge_found->face(); // Go over the isolated vertices in the face. - for (iso_verts_it = face->isolated_vertices_begin(); + for (auto iso_verts_it = face->isolated_vertices_begin(); iso_verts_it != face->isolated_vertices_end(); ++iso_verts_it) { // The current isolated vertex should have the same x-coordinate as the // query point in order to be below or above it. - if (compare_x (p, iso_verts_it->point()) != EQUAL) - continue; + if (compare_x (p, iso_verts_it->point()) != EQUAL) continue; // Make sure the isolated vertex is above the query point (if we shoot up) // or below it (if we shoot down). - if (compare_xy (p, iso_verts_it->point()) != point_above_under) - continue; + if (compare_xy (p, iso_verts_it->point()) != point_above_under) continue; // Check if the current isolated vertex lies closer to the query point than // the closest feature so far. @@ -379,12 +372,10 @@ _check_isolated_for_vertical_ray_shoot (Halfedge_const_handle halfedge_found, // If we found an isolated vertex above (or under) the query point, return // a handle to this vertex. - if (closest_iso_v != invalid_v) - return make_result(closest_iso_v); + if (closest_iso_v != invalid_v) return make_result(closest_iso_v); // If we are inside the unbounded face, return this face. - if (halfedge_found == invalid_he) - return make_result(face); + if (halfedge_found == invalid_he) return make_result(face); // Return the halfedge lying above (or below) the query point. return make_result(halfedge_found); From 7c92341be777d7c295d3fa8010c34dc8b35eab16 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 2 Sep 2022 11:31:47 +0200 Subject: [PATCH 002/194] 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 003/194] 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 004/194] 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 005/194] 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 f62a289d112f795df54512f65b4665ae8486c4d6 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Wed, 7 Sep 2022 10:23:10 +0300 Subject: [PATCH 006/194] Fixed _check_isolated_for_vertical_ray_shoot() --- .../include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h index 45964fdf1e6..e618f3a37fa 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h @@ -338,7 +338,7 @@ _check_isolated_for_vertical_ray_shoot (Halfedge_const_handle halfedge_found, // Otherwise, take the unbounded face. Face_const_handle face = (halfedge_found == invalid_he) ? _get_unbounded_face(tr, p, All_sides_oblivious_category()) : - face = halfedge_found->face(); + halfedge_found->face(); // Go over the isolated vertices in the face. for (auto iso_verts_it = face->isolated_vertices_begin(); From 1e485113e8a90685519d09d5dbeece4ccb7b4e86 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 7 Sep 2022 10:30:01 +0200 Subject: [PATCH 007/194] 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 008/194] 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 009/194] 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 010/194] 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 011/194] 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 012/194] 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 013/194] 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 014/194] 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 015/194] 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 016/194] 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 017/194] 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 018/194] 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 019/194] 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 020/194] 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 021/194] 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 022/194] 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 023/194] 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 024/194] 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 fb36bde04562e2c6ed0ff6a9de24e0e971a46e66 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Wed, 28 Sep 2022 10:59:25 +0300 Subject: [PATCH 025/194] Declared an isolated-vertex iterator to pacify MSVC. Without it the implicit conversion from the iterator to the corresponding handle fails! --- .../CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h index e618f3a37fa..5ad5f86b400 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h @@ -341,7 +341,10 @@ _check_isolated_for_vertical_ray_shoot (Halfedge_const_handle halfedge_found, halfedge_found->face(); // Go over the isolated vertices in the face. - for (auto iso_verts_it = face->isolated_vertices_begin(); + // The following statement pacifies MSVC. Without it the implicit conversion + // from the iterator to the corresponding handle fails! + Isolated_vertex_const_iterator iso_verts_it; + for (iso_verts_it = face->isolated_vertices_begin(); iso_verts_it != face->isolated_vertices_end(); ++iso_verts_it) { // The current isolated vertex should have the same x-coordinate as the From ea35fa8f88dbcabb24fca6d5fe0b5b76fe602227 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 5 Oct 2022 15:01:56 +0200 Subject: [PATCH 026/194] Fix autotest_cgal_with_ctest That commit makes the CMake variables `CGAL_TEST_SUITE` (the new one) and `RUNNING_CGAL_AUTO_TEST` (the legacy one) completely equivalent. --- Installation/CMakeLists.txt | 12 ++++++------ Installation/cmake/modules/CGAL_Common.cmake | 2 +- .../cmake/modules/CGAL_SetupCGALDependencies.cmake | 2 +- Installation/cmake/modules/CGAL_SetupFlags.cmake | 2 +- .../CGAL_enable_end_of_configuration_hook.cmake | 2 +- Installation/cmake/modules/UseCGAL.cmake | 2 +- Installation/lib/cmake/CGAL/CGALConfig.cmake | 4 ++-- .../Polyhedron/Plugins/Three_examples/CMakeLists.txt | 2 +- .../test/Set_movable_separability_2/CMakeLists.txt | 2 +- .../examples/Surface_mesher/CMakeLists.txt | 2 +- Three/doc/Three/Three.txt | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index e050c6b9c2b..c10bcd3b1f5 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -354,7 +354,7 @@ include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake) include(${CGAL_MODULES_DIR}/CGAL_enable_end_of_configuration_hook.cmake) cgal_setup_module_path() -if(RUNNING_CGAL_AUTO_TEST) +if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) message(STATUS "Operating system:") execute_process( COMMAND uname -a @@ -394,7 +394,7 @@ if(MSVC) )# Suppress warnings C4503 about "decorated name length exceeded" uniquely_add_flags(CGAL_CXX_FLAGS "/bigobj") # Use /bigobj by default - if(RUNNING_CGAL_AUTO_TEST) + if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) set(CMAKE_CXX_WARNING_LEVEL 2 CACHE STRING "MSVC C++ compiler warning level" FORCE) @@ -447,7 +447,7 @@ if(CMAKE_COMPILER_IS_GNUCXX) if(GCC_FOUND) - if(RUNNING_CGAL_AUTO_TEST) + if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) uniquely_add_flags(CGAL_CXX_FLAGS "-Wall") # Remove -g from the relevant CMAKE_CXX_FLAGS. This will also # propagate to the rest of the tests, since we overwrite those @@ -484,7 +484,7 @@ message("== Generate version files (DONE) ==\n") # #-------------------------------------------------------------------------------------------------- -if(CGAL_DEV_MODE OR RUNNING_CGAL_AUTO_TEST) +if(CGAL_DEV_MODE OR RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) message("== Set up flags ==") # Ugly hack to be compatible with current CGAL testsuite process (as of @@ -842,7 +842,7 @@ endmacro() # This allows programs to locate CGALConfig.cmake set(CGAL_DIR ${CGAL_BINARY_DIR}) -if(NOT RUNNING_CGAL_AUTO_TEST) +if(NOT RUNNING_CGAL_AUTO_TEST AND NOT CGAL_TEST_SUITE) add_programs(examples examples OFF) add_programs(demo demos OFF) @@ -1258,4 +1258,4 @@ if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) if(Qt5_FOUND) message(STATUS "USING Qt5_VERSION = '${Qt5Core_VERSION_STRING}'") endif()#Qt5_FOUND -endif()#RUNNING_CGAL_AUTO_TEST +endif()#RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE diff --git a/Installation/cmake/modules/CGAL_Common.cmake b/Installation/cmake/modules/CGAL_Common.cmake index c9c61644d23..d6026c6cdf0 100644 --- a/Installation/cmake/modules/CGAL_Common.cmake +++ b/Installation/cmake/modules/CGAL_Common.cmake @@ -4,7 +4,7 @@ option(CGAL_DEV_MODE "Activate the CGAL developers mode. See https://github.com/CGAL/cgal/wiki/CGAL_DEV_MODE" $ENV{CGAL_DEV_MODE}) -if(RUNNING_CGAL_AUTO_TEST) +if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) # Just to avoid a warning from CMake if that variable is set on the command line... endif() diff --git a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake index cb16e161fc7..da1f1d7a268 100644 --- a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake @@ -152,7 +152,7 @@ function(CGAL_setup_CGAL_dependencies target) "-features=extensions;-library=stlport4;-D_GNU_SOURCE") target_link_libraries(${target} INTERFACE "-library=stlport4") elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") - if ( RUNNING_CGAL_AUTO_TEST ) + if ( RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE ) target_compile_options(${target} INTERFACE "-Wall") endif() if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3) diff --git a/Installation/cmake/modules/CGAL_SetupFlags.cmake b/Installation/cmake/modules/CGAL_SetupFlags.cmake index 514ad5c58c8..3693e29724e 100644 --- a/Installation/cmake/modules/CGAL_SetupFlags.cmake +++ b/Installation/cmake/modules/CGAL_SetupFlags.cmake @@ -46,7 +46,7 @@ uniquely_add_flags( CMAKE_EXE_LINKER_FLAGS_DEBUG ${CGAL_EXE_LINKER_FLAGS_DE # Set a default build type if none is given if ( NOT CMAKE_BUILD_TYPE ) - if( RUNNING_CGAL_AUTO_TEST ) + if( RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE ) typed_cache_set ( STRING "Build type: Release, Debug, RelWithDebInfo or MinSizeRel" CMAKE_BUILD_TYPE Debug ) else () typed_cache_set ( STRING "Build type: Release, Debug, RelWithDebInfo or MinSizeRel" CMAKE_BUILD_TYPE Release ) diff --git a/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake b/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake index 5909d3fc525..9710c8dbd90 100644 --- a/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake +++ b/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake @@ -90,7 +90,7 @@ function(CGAL_run_at_the_end_of_configuration variable access value current_list if(DEFINED CMAKE_BUILD_TYPE AND ( NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "Debug") ) set(keyword WARNING) set(type warning) - if(RUNNING_CGAL_AUTO_TEST) + if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) # No warning in the CMake test suite, but a status message set(keyword) set(type notice) diff --git a/Installation/cmake/modules/UseCGAL.cmake b/Installation/cmake/modules/UseCGAL.cmake index 4d44ca90219..43449b85e51 100644 --- a/Installation/cmake/modules/UseCGAL.cmake +++ b/Installation/cmake/modules/UseCGAL.cmake @@ -13,7 +13,7 @@ if(NOT USE_CGAL_FILE_INCLUDED) set(USE_CGAL_FILE_INCLUDED 1) include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Common.cmake) - if( CGAL_DEV_MODE OR RUNNING_CGAL_AUTO_TEST ) + if( CGAL_DEV_MODE OR RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE ) include(${CMAKE_CURRENT_LIST_DIR}/CGAL_SetupFlags.cmake) else() include(${CMAKE_CURRENT_LIST_DIR}/CGAL_display_flags.cmake) diff --git a/Installation/lib/cmake/CGAL/CGALConfig.cmake b/Installation/lib/cmake/CGAL/CGALConfig.cmake index 6edefb1810f..6f72b2cc2e4 100644 --- a/Installation/lib/cmake/CGAL/CGALConfig.cmake +++ b/Installation/lib/cmake/CGAL/CGALConfig.cmake @@ -89,7 +89,7 @@ if (NOT CGAL_DATA_DIR) if (EXISTS "${CMAKE_SOURCE_DIR}/../../data") set(CGAL_DATA_DIR "${CMAKE_SOURCE_DIR}/../../data") else() - if(CGAL_TEST_SUITE) + if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) message(WARNING "CGAL_DATA_DIR cannot be deduced, set the variable CGAL_DATA_DIR to set the default value of CGAL::data_file_path()") endif() endif() @@ -195,7 +195,7 @@ cgal_setup_module_path() set(CGAL_USE_FILE ${CGAL_MODULES_DIR}/UseCGAL.cmake) include(${CGAL_MODULES_DIR}/CGAL_target_use_TBB.cmake) -if( CGAL_DEV_MODE OR RUNNING_CGAL_AUTO_TEST ) +if( CGAL_DEV_MODE OR RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE ) # Do not use -isystem for CGAL include paths set(CMAKE_NO_SYSTEM_FROM_IMPORTED TRUE) endif() diff --git a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Three_examples/CMakeLists.txt index a903de94ce5..bce67cbef7f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Three_examples/CMakeLists.txt @@ -17,7 +17,7 @@ find_package( COMPONENTS OpenGL Script Svg OPTIONAL_COMPONENTS ScriptTools WebSockets) -if(RUNNING_CGAL_AUTO_TEST) +if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) if(Qt5_FOUND) include(${CGAL_USE_FILE}) endif() diff --git a/Set_movable_separability_2/test/Set_movable_separability_2/CMakeLists.txt b/Set_movable_separability_2/test/Set_movable_separability_2/CMakeLists.txt index ae9419d4515..3beb5b93cd8 100644 --- a/Set_movable_separability_2/test/Set_movable_separability_2/CMakeLists.txt +++ b/Set_movable_separability_2/test/Set_movable_separability_2/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.1...3.22) project(Set_movable_separability_2_Tests) -if(RUNNING_CGAL_AUTO_TEST) +if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) # Just to avoid a warning from CMake when that variable is set on the command line... endif() if(CGAL_DIR) diff --git a/Surface_mesher/examples/Surface_mesher/CMakeLists.txt b/Surface_mesher/examples/Surface_mesher/CMakeLists.txt index 5477ae22041..02e14ed5b1b 100644 --- a/Surface_mesher/examples/Surface_mesher/CMakeLists.txt +++ b/Surface_mesher/examples/Surface_mesher/CMakeLists.txt @@ -11,7 +11,7 @@ if(CGAL_ImageIO_FOUND) create_single_source_cgal_program("mesh_an_implicit_function.cpp") else() - if(RUNNING_CGAL_AUTO_TEST) + if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) # Just to avoid a warning from CMake if that variable is set on the command line... endif() diff --git a/Three/doc/Three/Three.txt b/Three/doc/Three/Three.txt index 99a29c67242..de50c0a1d09 100644 --- a/Three/doc/Three/Three.txt +++ b/Three/doc/Three/Three.txt @@ -392,7 +392,7 @@ Notice that an external plugin will not be automatically loaded in the Polyhedro \section example Examples -All the examples are de-activated in the cmake list outside of our testsuite. To tesr them, one must add `-DRUNNING_CGAL_AUTO_TEST=ON` to the cmake call. +All the examples are de-activated in the cmake list outside of our testsuite. To test them, one must add `-DCGAL_TEST_SUITE=ON` to the cmake call. \subsection example1 Creating a Basic Plugin \cgalExample{Three_examples/Basic_plugin.cpp} 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 027/194] 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 028/194] 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 029/194] 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 030/194] 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 031/194] 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 032/194] 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 033/194] 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 fd6745af6248576b0aabc21698a4dfd843475d0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 17 Oct 2022 16:20:48 +0200 Subject: [PATCH 034/194] Use a more standard indentation in Weights/include --- .../include/CGAL/Weights/authalic_weights.h | 265 ++-- .../CGAL/Weights/barycentric_region_weights.h | 166 +-- .../include/CGAL/Weights/cotangent_weights.h | 829 ++++++----- .../CGAL/Weights/discrete_harmonic_weights.h | 717 +++++---- .../Weights/internal/pmp_weights_deprecated.h | 320 ++-- .../CGAL/Weights/internal/polygon_utils_2.h | 584 ++++---- Weights/include/CGAL/Weights/internal/utils.h | 1326 ++++++++--------- .../CGAL/Weights/inverse_distance_weights.h | 230 ++- .../include/CGAL/Weights/mean_value_weights.h | 852 +++++------ .../Weights/mixed_voronoi_region_weights.h | 206 ++- .../include/CGAL/Weights/shepard_weights.h | 339 +++-- .../include/CGAL/Weights/tangent_weights.h | 836 +++++------ .../CGAL/Weights/three_point_family_weights.h | 221 ++- .../CGAL/Weights/triangular_region_weights.h | 132 +- .../CGAL/Weights/uniform_region_weights.h | 135 +- .../include/CGAL/Weights/uniform_weights.h | 102 +- Weights/include/CGAL/Weights/utils.h | 303 ++-- .../CGAL/Weights/voronoi_region_weights.h | 168 +-- .../include/CGAL/Weights/wachspress_weights.h | 681 ++++----- 19 files changed, 4089 insertions(+), 4323 deletions(-) diff --git a/Weights/include/CGAL/Weights/authalic_weights.h b/Weights/include/CGAL/Weights/authalic_weights.h index 5b76f7a9480..25d38e60f26 100644 --- a/Weights/include/CGAL/Weights/authalic_weights.h +++ b/Weights/include/CGAL/Weights/authalic_weights.h @@ -14,186 +14,185 @@ #ifndef CGAL_AUTHALIC_WEIGHTS_H #define CGAL_AUTHALIC_WEIGHTS_H -// Internal includes. #include namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace authalic_ns { +/// \cond SKIP_IN_MANUAL +namespace authalic_ns { - template - FT half_weight(const FT cot, const FT r2) { - - FT w = FT(0); - CGAL_precondition(r2 != FT(0)); - if (r2 != FT(0)) { - const FT inv = FT(2) / r2; - w = cot * inv; - } - return w; - } - - template - FT weight(const FT cot_gamma, const FT cot_beta, const FT r2) { - - FT w = FT(0); - CGAL_precondition(r2 != FT(0)); - if (r2 != FT(0)) { - const FT inv = FT(2) / r2; - w = (cot_gamma + cot_beta) * inv; - } - return w; - } +template +FT half_weight(const FT cot, const FT r2) +{ + FT w = FT(0); + CGAL_precondition(r2 != FT(0)); + if (r2 != FT(0)) { + const FT inv = FT(2) / r2; + w = cot * inv; } - /// \endcond + return w; +} - /*! - \ingroup PkgWeightsRefAuthalicWeights - - \brief computes the half value of the authalic weight. - - This function constructs the half of the authalic weight using the precomputed - cotangent and squared distance values. The returned value is - \f$\frac{2\textbf{cot}}{\textbf{d2}}\f$. - - \tparam FT - a model of `FieldNumberType` - - \param cot - the cotangent value - - \param d2 - the squared distance value - - \pre d2 != 0 - - \sa `authalic_weight()` - */ - template - FT half_authalic_weight(const FT cot, const FT d2) { - return authalic_ns::half_weight(cot, d2); +template +FT weight(const FT cot_gamma, const FT cot_beta, const FT r2) +{ + FT w = FT(0); + CGAL_precondition(r2 != FT(0)); + if (r2 != FT(0)) + { + const FT inv = FT(2) / r2; + w = (cot_gamma + cot_beta) * inv; } - #if defined(DOXYGEN_RUNNING) + return w; +} - /*! - \ingroup PkgWeightsRefAuthalicWeights +} // namespace authalic_ns - \brief computes the authalic weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT authalic_weight( +/// \endcond + +/*! + \ingroup PkgWeightsRefAuthalicWeights + + \brief computes the half value of the authalic weight. + + This function constructs the half of the authalic weight using the precomputed + cotangent and squared distance values. The returned value is + \f$\frac{2\textbf{cot}}{\textbf{d2}}\f$. + + \tparam FT a model of `FieldNumberType` + + \param cot the cotangent value + \param d2 the squared distance value + + \pre d2 != 0 + + \sa `authalic_weight()` +*/ +template +FT half_authalic_weight(const FT cot, const FT d2) +{ + return authalic_ns::half_weight(cot, d2); +} + +#if defined(DOXYGEN_RUNNING) + +/*! + \ingroup PkgWeightsRefAuthalicWeights + + \brief computes the authalic weight in 2D at `q` using the points `p0`, `p1`, + and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT authalic_weight( const typename GeomTraits::Point_2& p0, const typename GeomTraits::Point_2& p1, const typename GeomTraits::Point_2& p2, const typename GeomTraits::Point_2& q, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefAuthalicWeights +/*! + \ingroup PkgWeightsRefAuthalicWeights - \brief computes the authalic weight in 3D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT authalic_weight( + \brief computes the authalic weight in 3D at `q` using the points `p0`, `p1`, + and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT authalic_weight( const typename GeomTraits::Point_3& p0, const typename GeomTraits::Point_3& p1, const typename GeomTraits::Point_3& p2, const typename GeomTraits::Point_3& q, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefAuthalicWeights +/*! + \ingroup PkgWeightsRefAuthalicWeights - \brief computes the authalic weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT authalic_weight( + \brief computes the authalic weight in 2D at `q` using the points `p0`, `p1`, + and `p2` which are parameterized by a `Kernel` K. +*/ +template +typename K::FT authalic_weight( const CGAL::Point_2& p0, const CGAL::Point_2& p1, const CGAL::Point_2& p2, const CGAL::Point_2& q) { } - /*! - \ingroup PkgWeightsRefAuthalicWeights +/*! + \ingroup PkgWeightsRefAuthalicWeights - \brief computes the authalic weight in 3D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT authalic_weight( + \brief computes the authalic weight in 3D at `q` using the points `p0`, `p1`, + and `p2` which are parameterized by a `Kernel` K. +*/ +template +typename K::FT authalic_weight( const CGAL::Point_3& p0, const CGAL::Point_3& p1, const CGAL::Point_3& p2, const CGAL::Point_3& q) { } - #endif // DOXYGEN_RUNNING +#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL - // Overloads! - template - typename GeomTraits::FT authalic_weight( - const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { +/// \cond SKIP_IN_MANUAL +// Overloads! +template +typename GeomTraits::FT authalic_weight(const typename GeomTraits::Point_2& t, + const typename GeomTraits::Point_2& r, + const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - using FT = typename GeomTraits::FT; - const FT cot_gamma = internal::cotangent_2(traits, t, r, q); - const FT cot_beta = internal::cotangent_2(traits, q, r, p); + const auto squared_distance_2 = traits.compute_squared_distance_2_object(); - const auto squared_distance_2 = - traits.compute_squared_distance_2_object(); - const FT d2 = squared_distance_2(q, r); - return authalic_ns::weight(cot_gamma, cot_beta, d2); - } + const FT cot_gamma = internal::cotangent_2(traits, t, r, q); + const FT cot_beta = internal::cotangent_2(traits, q, r, p); - template - typename GeomTraits::FT authalic_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) { + const FT d2 = squared_distance_2(q, r); + return authalic_ns::weight(cot_gamma, cot_beta, d2); +} - const GeomTraits traits; - return authalic_weight(t, r, p, q, traits); - } +template +typename GeomTraits::FT authalic_weight(const CGAL::Point_2& t, + const CGAL::Point_2& r, + const CGAL::Point_2& p, + const CGAL::Point_2& q) +{ + const GeomTraits traits; + return authalic_weight(t, r, p, q, traits); +} - template - typename GeomTraits::FT authalic_weight( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { +template +typename GeomTraits::FT authalic_weight(const typename GeomTraits::Point_3& t, + const typename GeomTraits::Point_3& r, + const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - using FT = typename GeomTraits::FT; - const FT cot_gamma = internal::cotangent_3(traits, t, r, q); - const FT cot_beta = internal::cotangent_3(traits, q, r, p); + const auto squared_distance_3 = traits.compute_squared_distance_3_object(); - const auto squared_distance_3 = - traits.compute_squared_distance_3_object(); - const FT d2 = squared_distance_3(q, r); - return authalic_ns::weight(cot_gamma, cot_beta, d2); - } + const FT cot_gamma = internal::cotangent_3(traits, t, r, q); + const FT cot_beta = internal::cotangent_3(traits, q, r, p); + const FT d2 = squared_distance_3(q, r); - template - typename GeomTraits::FT authalic_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) { + return authalic_ns::weight(cot_gamma, cot_beta, d2); +} - const GeomTraits traits; - return authalic_weight(t, r, p, q, traits); - } - /// \endcond +template +typename GeomTraits::FT authalic_weight(const CGAL::Point_3& t, + const CGAL::Point_3& r, + const CGAL::Point_3& p, + const CGAL::Point_3& q) +{ + const GeomTraits traits; + return authalic_weight(t, r, p, q, traits); +} + +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/barycentric_region_weights.h b/Weights/include/CGAL/Weights/barycentric_region_weights.h index 46fe69bcfa4..c095bd8c520 100644 --- a/Weights/include/CGAL/Weights/barycentric_region_weights.h +++ b/Weights/include/CGAL/Weights/barycentric_region_weights.h @@ -14,131 +14,125 @@ #ifndef CGAL_BARYCENTRIC_REGION_WEIGHTS_H #define CGAL_BARYCENTRIC_REGION_WEIGHTS_H -// Internal includes. #include namespace CGAL { namespace Weights { - #if defined(DOXYGEN_RUNNING) +#if defined(DOXYGEN_RUNNING) - /*! - \ingroup PkgWeightsRefBarycentricRegionWeights +/*! + \ingroup PkgWeightsRefBarycentricRegionWeights - \brief computes the area of the barycentric cell in 2D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT barycentric_area( + \brief computes the area of the barycentric cell in 2D using the points `p`, `q` + and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT barycentric_area( const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2& q, const typename GeomTraits::Point_2& r, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefBarycentricRegionWeights +/*! + \ingroup PkgWeightsRefBarycentricRegionWeights - \brief computes the area of the barycentric cell in 3D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT barycentric_area( + \brief computes the area of the barycentric cell in 3D using the points `p`, `q` + and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT barycentric_area( const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& q, const typename GeomTraits::Point_3& r, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefBarycentricRegionWeights +/*! + \ingroup PkgWeightsRefBarycentricRegionWeights - \brief computes the area of the barycentric cell in 2D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. - */ - template - typename K::FT barycentric_area( + \brief computes the area of the barycentric cell in 2D using the points `p`, `q` + and `r` which are parameterized by a `Kernel` K. +*/ +template +typename K::FT barycentric_area( const CGAL::Point_2& p, const CGAL::Point_2& q, const CGAL::Point_2& r) { } - /*! - \ingroup PkgWeightsRefBarycentricRegionWeights +/*! + \ingroup PkgWeightsRefBarycentricRegionWeights - \brief computes the area of the barycentric cell in 3D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. - */ - template - typename K::FT barycentric_area( + \brief computes the area of the barycentric cell in 3D using the points `p`, `q` + and `r` which are parameterized by a `Kernel` K. +*/ +template +typename K::FT barycentric_area( const CGAL::Point_3& p, const CGAL::Point_3& q, const CGAL::Point_3& r) { } - #endif // DOXYGEN_RUNNING +#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT barycentric_area( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { +/// \cond SKIP_IN_MANUAL +template +typename GeomTraits::FT barycentric_area(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - using FT = typename GeomTraits::FT; - const auto midpoint_2 = - traits.construct_midpoint_2_object(); - const auto centroid_2 = - traits.construct_centroid_2_object(); + const auto midpoint_2 = traits.construct_midpoint_2_object(); + const auto centroid_2 = traits.construct_centroid_2_object(); - const auto center = centroid_2(p, q, r); - const auto m1 = midpoint_2(q, r); - const auto m2 = midpoint_2(q, p); + const auto center = centroid_2(p, q, r); + const auto m1 = midpoint_2(q, r); + const auto m2 = midpoint_2(q, p); - const FT A1 = internal::positive_area_2(traits, q, m1, center); - const FT A2 = internal::positive_area_2(traits, q, center, m2); - return A1 + A2; - } + const FT A1 = internal::positive_area_2(traits, q, m1, center); + const FT A2 = internal::positive_area_2(traits, q, center, m2); + return A1 + A2; +} - template - typename GeomTraits::FT barycentric_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { +template +typename GeomTraits::FT barycentric_area(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const GeomTraits traits; + return barycentric_area(p, q, r, traits); +} - const GeomTraits traits; - return barycentric_area(p, q, r, traits); - } +template +typename GeomTraits::FT barycentric_area(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - template - typename GeomTraits::FT barycentric_area( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { + const auto midpoint_3 = traits.construct_midpoint_3_object(); + const auto centroid_3 = traits.construct_centroid_3_object(); - using FT = typename GeomTraits::FT; - const auto midpoint_3 = - traits.construct_midpoint_3_object(); - const auto centroid_3 = - traits.construct_centroid_3_object(); + const auto center = centroid_3(p, q, r); + const auto m1 = midpoint_3(q, r); + const auto m2 = midpoint_3(q, p); - const auto center = centroid_3(p, q, r); - const auto m1 = midpoint_3(q, r); - const auto m2 = midpoint_3(q, p); + const FT A1 = internal::positive_area_3(traits, q, m1, center); + const FT A2 = internal::positive_area_3(traits, q, center, m2); + return A1 + A2; +} - const FT A1 = internal::positive_area_3(traits, q, m1, center); - const FT A2 = internal::positive_area_3(traits, q, center, m2); - return A1 + A2; - } +template +typename GeomTraits::FT barycentric_area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const GeomTraits traits; + return barycentric_area(p, q, r, traits); +} - template - typename GeomTraits::FT barycentric_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { - - const GeomTraits traits; - return barycentric_area(p, q, r, traits); - } - /// \endcond +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/cotangent_weights.h b/Weights/include/CGAL/Weights/cotangent_weights.h index 0591d105d0d..5b8a5617fa7 100644 --- a/Weights/include/CGAL/Weights/cotangent_weights.h +++ b/Weights/include/CGAL/Weights/cotangent_weights.h @@ -14,482 +14,505 @@ #ifndef CGAL_COTANGENT_WEIGHTS_H #define CGAL_COTANGENT_WEIGHTS_H -// Internal includes. #include namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace cotangent_ns { +/// \cond SKIP_IN_MANUAL - template - FT half_weight(const FT cot) { - return FT(2) * cot; - } +namespace cotangent_ns { - template - FT weight(const FT cot_beta, const FT cot_gamma) { - return FT(2) * (cot_beta + cot_gamma); - } - } - /// \endcond +template +FT half_weight(const FT cot) +{ + return FT(2) * cot; +} - /*! - \ingroup PkgWeightsRefCotangentWeights +template +FT weight(const FT cot_beta, const FT cot_gamma) +{ + return FT(2) * (cot_beta + cot_gamma); +} - \brief computes the half value of the cotangent weight. +} // namespace cotangent_ns - This function constructs the half of the cotangent weight using the precomputed - cotangent value. The returned value is - \f$2\textbf{cot}\f$. +/// \endcond - \tparam FT - a model of `FieldNumberType` +/*! + \ingroup PkgWeightsRefCotangentWeights - \param cot - the cotangent value + \brief computes the half value of the cotangent weight. - \sa `cotangent_weight()` - */ - template - FT half_cotangent_weight(const FT cot) { - return cotangent_ns::half_weight(cot); - } + This function constructs the half of the cotangent weight using the precomputed + cotangent value. The returned value is \f$2\textbf{cot}\f$. - #if defined(DOXYGEN_RUNNING) + \tparam FT a model of `FieldNumberType` - /*! - \ingroup PkgWeightsRefCotangentWeights + \param cot the cotangent value - \brief computes the cotangent weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT cotangent_weight( + \sa `cotangent_weight()` +*/ +template +FT half_cotangent_weight(const FT cot) +{ + return cotangent_ns::half_weight(cot); +} + +#if defined(DOXYGEN_RUNNING) + +/*! + \ingroup PkgWeightsRefCotangentWeights + + \brief computes the cotangent weight in 2D at `q` using the points `p0`, `p1`, + and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT cotangent_weight( const typename GeomTraits::Point_2& p0, const typename GeomTraits::Point_2& p1, const typename GeomTraits::Point_2& p2, const typename GeomTraits::Point_2& q, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefCotangentWeights +/*! + \ingroup PkgWeightsRefCotangentWeights - \brief computes the cotangent weight in 3D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT cotangent_weight( + \brief computes the cotangent weight in 3D at `q` using the points `p0`, `p1`, + and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT cotangent_weight( const typename GeomTraits::Point_3& p0, const typename GeomTraits::Point_3& p1, const typename GeomTraits::Point_3& p2, const typename GeomTraits::Point_3& q, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefCotangentWeights +/*! + \ingroup PkgWeightsRefCotangentWeights - \brief computes the cotangent weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT cotangent_weight( + \brief computes the cotangent weight in 2D at `q` using the points `p0`, `p1`, + and `p2` which are parameterized by a `Kernel` K. +*/ +template +typename K::FT cotangent_weight( const CGAL::Point_2& p0, const CGAL::Point_2& p1, const CGAL::Point_2& p2, const CGAL::Point_2& q) { } - /*! - \ingroup PkgWeightsRefCotangentWeights +/*! + \ingroup PkgWeightsRefCotangentWeights - \brief computes the cotangent weight in 3D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT cotangent_weight( + \brief computes the cotangent weight in 3D at `q` using the points `p0`, `p1`, + and `p2` which are parameterized by a `Kernel` K. +*/ +template +typename K::FT cotangent_weight( const CGAL::Point_3& p0, const CGAL::Point_3& p1, const CGAL::Point_3& p2, const CGAL::Point_3& q) { } - #endif // DOXYGEN_RUNNING +#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT cotangent_weight( - const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { +/// \cond SKIP_IN_MANUAL +template +typename GeomTraits::FT cotangent_weight(const typename GeomTraits::Point_2& t, + const typename GeomTraits::Point_2& r, + const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - using FT = typename GeomTraits::FT; - const FT cot_beta = internal::cotangent_2(traits, q, t, r); - const FT cot_gamma = internal::cotangent_2(traits, r, p, q); - return cotangent_ns::weight(cot_beta, cot_gamma); - } + const FT cot_beta = internal::cotangent_2(traits, q, t, r); + const FT cot_gamma = internal::cotangent_2(traits, r, p, q); - template - typename GeomTraits::FT cotangent_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) { - GeomTraits traits; - return cotangent_weight(t, r, p, q, traits); - } + return cotangent_ns::weight(cot_beta, cot_gamma); +} - template - typename GeomTraits::FT cotangent_weight( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { +template +typename GeomTraits::FT cotangent_weight(const CGAL::Point_2& t, + const CGAL::Point_2& r, + const CGAL::Point_2& p, + const CGAL::Point_2& q) +{ + GeomTraits traits; + return cotangent_weight(t, r, p, q, traits); +} - using FT = typename GeomTraits::FT; - const FT cot_beta = internal::cotangent_3(traits, q, t, r); - const FT cot_gamma = internal::cotangent_3(traits, r, p, q); - return cotangent_ns::weight(cot_beta, cot_gamma); - } +template +typename GeomTraits::FT cotangent_weight(const typename GeomTraits::Point_3& t, + const typename GeomTraits::Point_3& r, + const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - template - typename GeomTraits::FT cotangent_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) { + const FT cot_beta = internal::cotangent_3(traits, q, t, r); + const FT cot_gamma = internal::cotangent_3(traits, r, p, q); - GeomTraits traits; - return cotangent_weight(t, r, p, q, traits); - } + return cotangent_ns::weight(cot_beta, cot_gamma); +} - // Undocumented cotangent weight class. - // Its constructor takes a polygon mesh and a vertex to point map - // and its operator() is defined based on the halfedge_descriptor only. - // This version is currently used in: - // Polygon_mesh_processing -> curvature_flow_impl.h - template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> - class Edge_cotangent_weight { +template +typename GeomTraits::FT cotangent_weight(const CGAL::Point_3& t, + const CGAL::Point_3& r, + const CGAL::Point_3& p, + const CGAL::Point_3& q) +{ + GeomTraits traits; + return cotangent_weight(t, r, p, q, traits); +} - using GeomTraits = typename CGAL::Kernel_traits< - typename boost::property_traits::value_type>::type; - using FT = typename GeomTraits::FT; +// Undocumented cotangent weight class. +// Its constructor takes a polygon mesh and a vertex to point map +// and its operator() is defined based on the halfedge_descriptor only. +// This version is currently used in: +// Polygon_mesh_processing -> curvature_flow_impl.h +template< + typename PolygonMesh, + typename VertexPointMap = typename boost::property_map::type> +class Edge_cotangent_weight +{ + using GeomTraits = typename CGAL::Kernel_traits::value_type>::type; + using FT = typename GeomTraits::FT; - const PolygonMesh& m_pmesh; - const VertexPointMap m_pmap; - GeomTraits m_traits; + const PolygonMesh& m_pmesh; + const VertexPointMap m_pmap; + GeomTraits m_traits; - public: - using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; - using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; +public: + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - Edge_cotangent_weight(const PolygonMesh& pmesh, const VertexPointMap pmap) : - m_pmesh(pmesh), m_pmap(pmap), m_traits() { } + Edge_cotangent_weight(const PolygonMesh& pmesh, const VertexPointMap pmap) + : m_pmesh(pmesh), m_pmap(pmap), m_traits() + { } - FT operator()(const halfedge_descriptor he) const { + FT operator()(const halfedge_descriptor he) const + { - FT weight = FT(0); - if (is_border_edge(he, m_pmesh)) { - const auto h1 = next(he, m_pmesh); - - const auto v0 = target(he, m_pmesh); - const auto v1 = source(he, m_pmesh); - const auto v2 = target(h1, m_pmesh); - - const auto& p0 = get(m_pmap, v0); - const auto& p1 = get(m_pmap, v1); - const auto& p2 = get(m_pmap, v2); - - weight = internal::cotangent_3(m_traits, p0, p2, p1); - - } else { - const auto h1 = next(he, m_pmesh); - const auto h2 = prev(opposite(he, m_pmesh), m_pmesh); - - const auto v0 = target(he, m_pmesh); - const auto v1 = source(he, m_pmesh); - const auto v2 = target(h1, m_pmesh); - const auto v3 = source(h2, m_pmesh); - - const auto& p0 = get(m_pmap, v0); - const auto& p1 = get(m_pmap, v1); - const auto& p2 = get(m_pmap, v2); - const auto& p3 = get(m_pmap, v3); - - weight = cotangent_weight(p2, p1, p3, p0) / FT(2); - } - return weight; - } - }; - - // Undocumented cotangent weight class. - // Returns a single cotangent weight, its operator() is defined based on the - // halfedge_descriptor, polygon mesh, and vertex to point map. - // For border edges it returns zero. - // This version is currently used in: - // Surface_mesh_deformation -> Surface_mesh_deformation.h - template - class Single_cotangent_weight { - - public: - using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; - using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - - template - decltype(auto) operator()(const halfedge_descriptor he, - const PolygonMesh& pmesh, const VertexPointMap pmap) const { - - using GeomTraits = typename CGAL::Kernel_traits< - typename boost::property_traits::value_type>::type; - using FT = typename GeomTraits::FT; - GeomTraits traits; - - if (is_border(he, pmesh)) { - return FT(0); - } - - const vertex_descriptor v0 = target(he, pmesh); - const vertex_descriptor v1 = source(he, pmesh); - const vertex_descriptor v2 = target(next(he, pmesh), pmesh); - - const auto& p0 = get(pmap, v0); - const auto& p1 = get(pmap, v1); - const auto& p2 = get(pmap, v2); - - return internal::cotangent_3(traits, p0, p2, p1); - } - }; - - // Undocumented cotangent weight class. - // Its constructor takes a boolean flag to choose between default and clamped - // versions of the cotangent weights and its operator() is defined based on the - // halfedge_descriptor, polygon mesh, and vertex to point map. - // This version is currently used in: - // Surface_mesh_deformation -> Surface_mesh_deformation.h (default version) - // Surface_mesh_parameterizer -> Orbifold_Tutte_parameterizer_3.h (default version) - // Surface_mesh_skeletonization -> Mean_curvature_flow_skeletonization.h (clamped version) - template - class Cotangent_weight { - bool m_use_clamped_version; - - public: - using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; - using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - - Cotangent_weight(const bool use_clamped_version = false) : - m_use_clamped_version(use_clamped_version) { } - - template - decltype(auto) operator()(const halfedge_descriptor he, - const PolygonMesh& pmesh, const VertexPointMap pmap) const { - - using GeomTraits = typename CGAL::Kernel_traits< - typename boost::property_traits::value_type>::type; - using FT = typename GeomTraits::FT; - GeomTraits traits; - - const auto v0 = target(he, pmesh); - const auto v1 = source(he, pmesh); - - const auto& p0 = get(pmap, v0); - const auto& p1 = get(pmap, v1); - - FT weight = FT(0); - if (is_border_edge(he, pmesh)) { - const auto he_cw = opposite(next(he, pmesh), pmesh); - auto v2 = source(he_cw, pmesh); - - if (is_border_edge(he_cw, pmesh)) { - const auto he_ccw = prev(opposite(he, pmesh), pmesh); - v2 = source(he_ccw, pmesh); - - const auto& p2 = get(pmap, v2); - if (m_use_clamped_version) { - weight = internal::cotangent_3_clamped(traits, p1, p2, p0); - } else { - weight = internal::cotangent_3(traits, p1, p2, p0); - } - weight = (CGAL::max)(FT(0), weight); - weight /= FT(2); - } else { - const auto& p2 = get(pmap, v2); - if (m_use_clamped_version) { - weight = internal::cotangent_3_clamped(traits, p0, p2, p1); - } else { - weight = internal::cotangent_3(traits, p0, p2, p1); - } - weight = (CGAL::max)(FT(0), weight); - weight /= FT(2); - } - - } else { - const auto he_cw = opposite(next(he, pmesh), pmesh); - const auto v2 = source(he_cw, pmesh); - const auto he_ccw = prev(opposite(he, pmesh), pmesh); - const auto v3 = source(he_ccw, pmesh); - - const auto& p2 = get(pmap, v2); - const auto& p3 = get(pmap, v3); - FT cot_beta = FT(0), cot_gamma = FT(0); - - if (m_use_clamped_version) { - cot_beta = internal::cotangent_3_clamped(traits, p0, p2, p1); - } else { - cot_beta = internal::cotangent_3(traits, p0, p2, p1); - } - - if (m_use_clamped_version) { - cot_gamma = internal::cotangent_3_clamped(traits, p1, p3, p0); - } else { - cot_gamma = internal::cotangent_3(traits, p1, p3, p0); - } - - cot_beta = (CGAL::max)(FT(0), cot_beta); cot_beta /= FT(2); - cot_gamma = (CGAL::max)(FT(0), cot_gamma); cot_gamma /= FT(2); - weight = cot_beta + cot_gamma; - } - return weight; - } - }; - - // Undocumented cotangent weight class. - // Its constructor takes a polygon mesh and a vertex to point map - // and its operator() is defined based on the halfedge_descriptor only. - // This class is using a special clamped version of the cotangent weights. - // This version is currently used in: - // Polygon_mesh_processing -> fair.h - // Polyhedron demo -> Hole_filling_plugin.cpp - template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> - class Secure_cotangent_weight_with_voronoi_area { - - using GeomTraits = typename CGAL::Kernel_traits< - typename boost::property_traits::value_type>::type; - using FT = typename GeomTraits::FT; - - const PolygonMesh& m_pmesh; - const VertexPointMap m_pmap; - GeomTraits m_traits; - - public: - using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; - using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - - Secure_cotangent_weight_with_voronoi_area(const PolygonMesh& pmesh, const VertexPointMap pmap) : - m_pmesh(pmesh), m_pmap(pmap), m_traits() { } - - FT w_i(const vertex_descriptor v_i) const { - return FT(1) / (FT(2) * voronoi(v_i)); - } - - FT w_ij(const halfedge_descriptor he) const { - return cotangent_clamped(he); - } - - private: - FT cotangent_clamped(const halfedge_descriptor he) const { + FT weight = FT(0); + if (is_border_edge(he, m_pmesh)) + { + const auto h1 = next(he, m_pmesh); const auto v0 = target(he, m_pmesh); const auto v1 = source(he, m_pmesh); + const auto v2 = target(h1, m_pmesh); const auto& p0 = get(m_pmap, v0); const auto& p1 = get(m_pmap, v1); + const auto& p2 = get(m_pmap, v2); - FT weight = FT(0); - if (is_border_edge(he, m_pmesh)) { - const auto he_cw = opposite(next(he, m_pmesh), m_pmesh); - auto v2 = source(he_cw, m_pmesh); + weight = internal::cotangent_3(m_traits, p0, p2, p1); - if (is_border_edge(he_cw, m_pmesh)) { - const auto he_ccw = prev(opposite(he, m_pmesh), m_pmesh); - v2 = source(he_ccw, m_pmesh); + } + else + { + const auto h1 = next(he, m_pmesh); + const auto h2 = prev(opposite(he, m_pmesh), m_pmesh); - const auto& p2 = get(m_pmap, v2); - weight = internal::cotangent_3_clamped(m_traits, p1, p2, p0); - } else { - const auto& p2 = get(m_pmap, v2); - weight = internal::cotangent_3_clamped(m_traits, p0, p2, p1); - } + const auto v0 = target(he, m_pmesh); + const auto v1 = source(he, m_pmesh); + const auto v2 = target(h1, m_pmesh); + const auto v3 = source(h2, m_pmesh); - } else { - const auto he_cw = opposite(next(he, m_pmesh), m_pmesh); - const auto v2 = source(he_cw, m_pmesh); + const auto& p0 = get(m_pmap, v0); + const auto& p1 = get(m_pmap, v1); + const auto& p2 = get(m_pmap, v2); + const auto& p3 = get(m_pmap, v3); + + weight = cotangent_weight(p2, p1, p3, p0) / FT(2); + } + return weight; + } +}; + +// Undocumented cotangent weight class. +// +// Returns a single cotangent weight, its operator() is defined based on the +// halfedge_descriptor, polygon mesh, and vertex to point map. +// For border edges it returns zero. +// This version is currently used in: +// Surface_mesh_deformation -> Surface_mesh_deformation.h +template +class Single_cotangent_weight +{ +public: + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; + + template + decltype(auto) operator()(const halfedge_descriptor he, + const PolygonMesh& pmesh, + const VertexPointMap pmap) const + { + using GeomTraits = typename CGAL::Kernel_traits::value_type>::type; + using FT = typename GeomTraits::FT; + GeomTraits traits; + + if (is_border(he, pmesh)) + return FT(0); + + const vertex_descriptor v0 = target(he, pmesh); + const vertex_descriptor v1 = source(he, pmesh); + const vertex_descriptor v2 = target(next(he, pmesh), pmesh); + + const auto& p0 = get(pmap, v0); + const auto& p1 = get(pmap, v1); + const auto& p2 = get(pmap, v2); + + return internal::cotangent_3(traits, p0, p2, p1); + } +}; + +// Undocumented cotangent weight class. +// Its constructor takes a boolean flag to choose between default and clamped +// versions of the cotangent weights and its operator() is defined based on the +// halfedge_descriptor, polygon mesh, and vertex to point map. +// This version is currently used in: +// Surface_mesh_deformation -> Surface_mesh_deformation.h (default version) +// Surface_mesh_parameterizer -> Orbifold_Tutte_parameterizer_3.h (default version) +// Surface_mesh_skeletonization -> Mean_curvature_flow_skeletonization.h (clamped version) +template +class Cotangent_weight +{ + bool m_use_clamped_version; + +public: + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; + + Cotangent_weight(const bool use_clamped_version = false) + : m_use_clamped_version(use_clamped_version) + { } + + template + decltype(auto) operator()(const halfedge_descriptor he, + const PolygonMesh& pmesh, + const VertexPointMap pmap) const + { + using GeomTraits = typename CGAL::Kernel_traits::value_type>::type; + using FT = typename GeomTraits::FT; + + GeomTraits traits; + + const auto v0 = target(he, pmesh); + const auto v1 = source(he, pmesh); + + const auto& p0 = get(pmap, v0); + const auto& p1 = get(pmap, v1); + + FT weight = FT(0); + if (is_border_edge(he, pmesh)) + { + const auto he_cw = opposite(next(he, pmesh), pmesh); + auto v2 = source(he_cw, pmesh); + + if (is_border_edge(he_cw, pmesh)) + { + const auto he_ccw = prev(opposite(he, pmesh), pmesh); + v2 = source(he_ccw, pmesh); + + const auto& p2 = get(pmap, v2); + if (m_use_clamped_version) + weight = internal::cotangent_3_clamped(traits, p1, p2, p0); + else + weight = internal::cotangent_3(traits, p1, p2, p0); + + weight = (CGAL::max)(FT(0), weight); + weight /= FT(2); + } + else + { + const auto& p2 = get(pmap, v2); + if (m_use_clamped_version) + weight = internal::cotangent_3_clamped(traits, p0, p2, p1); + else + weight = internal::cotangent_3(traits, p0, p2, p1); + + weight = (CGAL::max)(FT(0), weight); + weight /= FT(2); + } + } + else + { + const auto he_cw = opposite(next(he, pmesh), pmesh); + const auto v2 = source(he_cw, pmesh); + const auto he_ccw = prev(opposite(he, pmesh), pmesh); + const auto v3 = source(he_ccw, pmesh); + + const auto& p2 = get(pmap, v2); + const auto& p3 = get(pmap, v3); + FT cot_beta = FT(0), cot_gamma = FT(0); + + if (m_use_clamped_version) + cot_beta = internal::cotangent_3_clamped(traits, p0, p2, p1); + else + cot_beta = internal::cotangent_3(traits, p0, p2, p1); + + if (m_use_clamped_version) + cot_gamma = internal::cotangent_3_clamped(traits, p1, p3, p0); + else + cot_gamma = internal::cotangent_3(traits, p1, p3, p0); + + cot_beta = (CGAL::max)(FT(0), cot_beta); cot_beta /= FT(2); + cot_gamma = (CGAL::max)(FT(0), cot_gamma); cot_gamma /= FT(2); + weight = cot_beta + cot_gamma; + } + + return weight; + } +}; + +// Undocumented cotangent weight class. +// Its constructor takes a polygon mesh and a vertex to point map +// and its operator() is defined based on the halfedge_descriptor only. +// This class is using a special clamped version of the cotangent weights. +// This version is currently used in: +// Polygon_mesh_processing -> fair.h +// Polyhedron demo -> Hole_filling_plugin.cpp +template< + typename PolygonMesh, + typename VertexPointMap = typename boost::property_map::type> +class Secure_cotangent_weight_with_voronoi_area +{ + using GeomTraits = typename CGAL::Kernel_traits::value_type>::type; + using FT = typename GeomTraits::FT; + + const PolygonMesh& m_pmesh; + const VertexPointMap m_pmap; + GeomTraits m_traits; + +public: + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; + + Secure_cotangent_weight_with_voronoi_area(const PolygonMesh& pmesh, + const VertexPointMap pmap) + : m_pmesh(pmesh), m_pmap(pmap), m_traits() + { } + + FT w_i(const vertex_descriptor v_i) const + { + return FT(1) / (FT(2) * voronoi(v_i)); + } + + FT w_ij(const halfedge_descriptor he) const + { + return cotangent_clamped(he); + } + +private: + FT cotangent_clamped(const halfedge_descriptor he) const + { + + const auto v0 = target(he, m_pmesh); + const auto v1 = source(he, m_pmesh); + + const auto& p0 = get(m_pmap, v0); + const auto& p1 = get(m_pmap, v1); + + FT weight = FT(0); + if (is_border_edge(he, m_pmesh)) + { + const auto he_cw = opposite(next(he, m_pmesh), m_pmesh); + auto v2 = source(he_cw, m_pmesh); + + if (is_border_edge(he_cw, m_pmesh)) + { const auto he_ccw = prev(opposite(he, m_pmesh), m_pmesh); - const auto v3 = source(he_ccw, m_pmesh); + v2 = source(he_ccw, m_pmesh); const auto& p2 = get(m_pmap, v2); - const auto& p3 = get(m_pmap, v3); - - const FT cot_beta = internal::cotangent_3_clamped(m_traits, p0, p2, p1); - const FT cot_gamma = internal::cotangent_3_clamped(m_traits, p1, p3, p0); - weight = cot_beta + cot_gamma; + weight = internal::cotangent_3_clamped(m_traits, p1, p2, p0); } - return weight; - } - - FT voronoi(const vertex_descriptor v0) const { - - const auto squared_length_3 = - m_traits.compute_squared_length_3_object(); - const auto construct_vector_3 = - m_traits.construct_vector_3_object(); - - FT voronoi_area = FT(0); - CGAL_assertion(CGAL::is_triangle_mesh(m_pmesh)); - for (const auto& he : halfedges_around_target(halfedge(v0, m_pmesh), m_pmesh)) { - CGAL_assertion(v0 == target(he, m_pmesh)); - if (is_border(he, m_pmesh)) { - continue; - } - - const auto v1 = source(he, m_pmesh); - const auto v2 = target(next(he, m_pmesh), m_pmesh); - - const auto& p0 = get(m_pmap, v0); - const auto& p1 = get(m_pmap, v1); + else + { const auto& p2 = get(m_pmap, v2); - - const auto angle0 = CGAL::angle(p1, p0, p2); - const auto angle1 = CGAL::angle(p2, p1, p0); - const auto angle2 = CGAL::angle(p0, p2, p1); - - const bool obtuse = - (angle0 == CGAL::OBTUSE) || - (angle1 == CGAL::OBTUSE) || - (angle2 == CGAL::OBTUSE); - - if (!obtuse) { - const FT cot_p1 = internal::cotangent_3(m_traits, p2, p1, p0); - const FT cot_p2 = internal::cotangent_3(m_traits, p0, p2, p1); - - const auto v1 = construct_vector_3(p0, p1); - const auto v2 = construct_vector_3(p0, p2); - - const FT t1 = cot_p1 * squared_length_3(v2); - const FT t2 = cot_p2 * squared_length_3(v1); - voronoi_area += (t1 + t2) / FT(8); - - } else { - - const FT A = internal::positive_area_3(m_traits, p0, p1, p2); - if (angle0 == CGAL::OBTUSE) { - voronoi_area += A / FT(2); - } else { - voronoi_area += A / FT(4); - } - } + weight = internal::cotangent_3_clamped(m_traits, p0, p2, p1); } - CGAL_assertion(voronoi_area != FT(0)); - return voronoi_area; } - }; + else + { + const auto he_cw = opposite(next(he, m_pmesh), m_pmesh); + const auto v2 = source(he_cw, m_pmesh); + const auto he_ccw = prev(opposite(he, m_pmesh), m_pmesh); + const auto v3 = source(he_ccw, m_pmesh); - /// \endcond + const auto& p2 = get(m_pmap, v2); + const auto& p3 = get(m_pmap, v3); + + const FT cot_beta = internal::cotangent_3_clamped(m_traits, p0, p2, p1); + const FT cot_gamma = internal::cotangent_3_clamped(m_traits, p1, p3, p0); + weight = cot_beta + cot_gamma; + } + + return weight; + } + + FT voronoi(const vertex_descriptor v0) const + { + const auto squared_length_3 = m_traits.compute_squared_length_3_object(); + const auto construct_vector_3 = m_traits.construct_vector_3_object(); + + FT voronoi_area = FT(0); + CGAL_assertion(CGAL::is_triangle_mesh(m_pmesh)); + for (const auto& he : halfedges_around_target(halfedge(v0, m_pmesh), m_pmesh)) + { + CGAL_assertion(v0 == target(he, m_pmesh)); + if (is_border(he, m_pmesh)) + continue; + + const auto v1 = source(he, m_pmesh); + const auto v2 = target(next(he, m_pmesh), m_pmesh); + + const auto& p0 = get(m_pmap, v0); + const auto& p1 = get(m_pmap, v1); + const auto& p2 = get(m_pmap, v2); + + const auto angle0 = CGAL::angle(p1, p0, p2); + const auto angle1 = CGAL::angle(p2, p1, p0); + const auto angle2 = CGAL::angle(p0, p2, p1); + + const bool obtuse = (angle0 == CGAL::OBTUSE) || + (angle1 == CGAL::OBTUSE) || + (angle2 == CGAL::OBTUSE); + + if (!obtuse) + { + const FT cot_p1 = internal::cotangent_3(m_traits, p2, p1, p0); + const FT cot_p2 = internal::cotangent_3(m_traits, p0, p2, p1); + + const auto v1 = construct_vector_3(p0, p1); + const auto v2 = construct_vector_3(p0, p2); + + const FT t1 = cot_p1 * squared_length_3(v2); + const FT t2 = cot_p2 * squared_length_3(v1); + voronoi_area += (t1 + t2) / FT(8); + + } + else + { + const FT A = internal::positive_area_3(m_traits, p0, p1, p2); + if (angle0 == CGAL::OBTUSE) + voronoi_area += A / FT(2); + else + voronoi_area += A / FT(4); + } + } + + CGAL_assertion(voronoi_area != FT(0)); + return voronoi_area; + } +}; + +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/discrete_harmonic_weights.h b/Weights/include/CGAL/Weights/discrete_harmonic_weights.h index 42a7056afc2..170b73a67b3 100644 --- a/Weights/include/CGAL/Weights/discrete_harmonic_weights.h +++ b/Weights/include/CGAL/Weights/discrete_harmonic_weights.h @@ -14,429 +14,396 @@ #ifndef CGAL_DISCRETE_HARMONIC_WEIGHTS_H #define CGAL_DISCRETE_HARMONIC_WEIGHTS_H -// Internal includes. #include #include namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace discrete_harmonic_ns { +/// \cond SKIP_IN_MANUAL - template - FT weight( - const FT r1, const FT r2, const FT r3, - const FT A1, const FT A2, const FT B) { +namespace discrete_harmonic_ns { - FT w = FT(0); - CGAL_precondition(A1 != FT(0) && A2 != FT(0)); - const FT prod = A1 * A2; - if (prod != FT(0)) { - const FT inv = FT(1) / prod; - w = (r3 * A1 - r2 * B + r1 * A2) * inv; - } - return w; - } +template +FT weight(const FT r1, const FT r2, const FT r3, + const FT A1, const FT A2, const FT B) +{ + FT w = FT(0); + CGAL_precondition(A1 != FT(0) && A2 != FT(0)); + const FT prod = A1 * A2; + if (prod != FT(0)) + { + const FT inv = FT(1) / prod; + w = (r3 * A1 - r2 * B + r1 * A2) * inv; } - /// \endcond - #if defined(DOXYGEN_RUNNING) + return w; +} - /*! - \ingroup PkgWeightsRefDiscreteHarmonicWeights +} // namespace discrete_harmonic_ns - \brief computes the discrete harmonic weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT discrete_harmonic_weight( +/// \endcond + +#if defined(DOXYGEN_RUNNING) + +/*! + \ingroup PkgWeightsRefDiscreteHarmonicWeights + + \brief computes the discrete harmonic weight in 2D at `q` using the points `p0`, `p1`, + and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT discrete_harmonic_weight( const typename GeomTraits::Point_2& p0, const typename GeomTraits::Point_2& p1, const typename GeomTraits::Point_2& p2, const typename GeomTraits::Point_2& q, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefDiscreteHarmonicWeights +/*! + \ingroup PkgWeightsRefDiscreteHarmonicWeights - \brief computes the discrete harmonic weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT discrete_harmonic_weight( + \brief computes the discrete harmonic weight in 2D at `q` using the points `p0`, `p1`, + and `p2` which are parameterized by a `Kernel` K. +*/ +template +typename K::FT discrete_harmonic_weight( const CGAL::Point_2& p0, const CGAL::Point_2& p1, const CGAL::Point_2& p2, const CGAL::Point_2& q) { } - #endif // DOXYGEN_RUNNING +#endif // DOXYGEN_RUNNING + +/// \cond SKIP_IN_MANUAL +template +typename GeomTraits::FT discrete_harmonic_weight(const typename GeomTraits::Point_2& t, + const typename GeomTraits::Point_2& r, + const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + + const auto squared_distance_2 = traits.compute_squared_distance_2_object(); + + const FT d1 = squared_distance_2(q, t); + const FT d2 = squared_distance_2(q, r); + const FT d3 = squared_distance_2(q, p); + + const FT A1 = internal::area_2(traits, r, q, t); + const FT A2 = internal::area_2(traits, p, q, r); + const FT B = internal::area_2(traits, p, q, t); + + return discrete_harmonic_ns::weight(d1, d2, d3, A1, A2, B); +} + +template +typename GeomTraits::FT discrete_harmonic_weight(const CGAL::Point_2& t, + const CGAL::Point_2& r, + const CGAL::Point_2& p, + const CGAL::Point_2& q) +{ + const GeomTraits traits; + return discrete_harmonic_weight(t, r, p, q, traits); +} + +namespace internal { + +template +typename GeomTraits::FT discrete_harmonic_weight(const typename GeomTraits::Point_3& t, + const typename GeomTraits::Point_3& r, + const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + using Point_2 = typename GeomTraits::Point_2; + + Point_2 tf, rf, pf, qf; + internal::flatten(traits, + t, r, p, q, + tf, rf, pf, qf); + return CGAL::Weights::discrete_harmonic_weight(tf, rf, pf, qf, traits); +} + +template +typename GeomTraits::FT discrete_harmonic_weight(const CGAL::Point_3& t, + const CGAL::Point_3& r, + const CGAL::Point_3& p, + const CGAL::Point_3& q) +{ + const GeomTraits traits; + return discrete_harmonic_weight(t, r, p, q, traits); +} + +} // namespace internal + +/// \endcond + +/*! + \ingroup PkgWeightsRefBarycentricDiscreteHarmonicWeights + + \brief 2D discrete harmonic weights for polygons. + + This class implements 2D discrete harmonic weights (\cite cgal:bc:eddhls-maam-95, + \cite cgal:bc:fhk-gcbcocp-06, \cite cgal:pp-cdmsc-93) which can be computed + at any point inside a strictly convex polygon. + + Discrete harmonic weights are well-defined inside a strictly convex polygon + but they are not necessarily positive. These weights are computed analytically + using the formulation from the `discrete_harmonic_weight()`. + + \tparam VertexRange a model of `ConstRange` whose iterator type is `RandomAccessIterator` + \tparam GeomTraits a model of `AnalyticWeightTraits_2` + \tparam PointMap a model of `ReadablePropertyMap` whose key type is `VertexRange::value_type` and + value type is `Point_2`. The default is `CGAL::Identity_property_map`. + + \cgalModels `BarycentricWeights_2` +*/ +template > +class Discrete_harmonic_weights_2 +{ +public: + /// \name Types + /// @{ /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT discrete_harmonic_weight( - const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { - - using FT = typename GeomTraits::FT; - const auto squared_distance_2 = - traits.compute_squared_distance_2_object(); - - const FT d1 = squared_distance_2(q, t); - const FT d2 = squared_distance_2(q, r); - const FT d3 = squared_distance_2(q, p); - - const FT A1 = internal::area_2(traits, r, q, t); - const FT A2 = internal::area_2(traits, p, q, r); - const FT B = internal::area_2(traits, p, q, t); - - return discrete_harmonic_ns::weight( - d1, d2, d3, A1, A2, B); - } - - template - typename GeomTraits::FT discrete_harmonic_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) { - - const GeomTraits traits; - return discrete_harmonic_weight(t, r, p, q, traits); - } - - namespace internal { - - template - typename GeomTraits::FT discrete_harmonic_weight( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { - - using Point_2 = typename GeomTraits::Point_2; - Point_2 tf, rf, pf, qf; - internal::flatten( - traits, - t, r, p, q, - tf, rf, pf, qf); - return CGAL::Weights:: - discrete_harmonic_weight(tf, rf, pf, qf, traits); - } - - template - typename GeomTraits::FT discrete_harmonic_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) { - - const GeomTraits traits; - return discrete_harmonic_weight(t, r, p, q, traits); - } - - } // namespace internal + using Vertex_range = VertexRange; + using Geom_traits = GeomTraits; + using Point_map = PointMap; + using Area_2 = typename GeomTraits::Compute_area_2; + using Squared_distance_2 = typename GeomTraits::Compute_squared_distance_2; /// \endcond - /*! - \ingroup PkgWeightsRefBarycentricDiscreteHarmonicWeights + /// Number type. + typedef typename GeomTraits::FT FT; - \brief 2D discrete harmonic weights for polygons. + /// Point type. + typedef typename GeomTraits::Point_2 Point_2; - This class implements 2D discrete harmonic weights ( \cite cgal:bc:fhk-gcbcocp-06, - \cite cgal:pp-cdmsc-93, \cite cgal:bc:eddhls-maam-95 ) which can be computed - at any point inside a strictly convex polygon. + /// @} - Discrete harmonic weights are well-defined inside a strictly convex polygon - but they are not necessarily positive. These weights are computed analytically - using the formulation from the `discrete_harmonic_weight()`. - - \tparam VertexRange - a model of `ConstRange` whose iterator type is `RandomAccessIterator` - - \tparam GeomTraits - a model of `AnalyticWeightTraits_2` - - \tparam PointMap - a model of `ReadablePropertyMap` whose key type is `VertexRange::value_type` and - value type is `Point_2`. The default is `CGAL::Identity_property_map`. - - \cgalModels `BarycentricWeights_2` - */ - template< - typename VertexRange, - typename GeomTraits, - typename PointMap = CGAL::Identity_property_map > - class Discrete_harmonic_weights_2 { - - public: - - /// \name Types - /// @{ - - /// \cond SKIP_IN_MANUAL - using Vertex_range = VertexRange; - using Geom_traits = GeomTraits; - using Point_map = PointMap; - - using Area_2 = typename GeomTraits::Compute_area_2; - using Squared_distance_2 = typename GeomTraits::Compute_squared_distance_2; - /// \endcond - - /// Number type. - typedef typename GeomTraits::FT FT; - - /// Point type. - typedef typename GeomTraits::Point_2 Point_2; - - /// @} - - /// \name Initialization - /// @{ - - /*! - \brief initializes all internal data structures. - - This class implements the behavior of discrete harmonic weights - for 2D query points inside strictly convex polygons. - - \param polygon - an instance of `VertexRange` with the vertices of a strictly convex polygon - - \param traits - a traits class with geometric objects, predicates, and constructions; - the default initialization is provided - - \param point_map - an instance of `PointMap` that maps a vertex from `polygon` to `Point_2`; - the default initialization is provided - - \pre polygon.size() >= 3 - \pre polygon is simple - \pre polygon is strictly convex - */ - Discrete_harmonic_weights_2( - const VertexRange& polygon, - const GeomTraits traits = GeomTraits(), - const PointMap point_map = PointMap()) : - m_polygon(polygon), - m_traits(traits), - m_point_map(point_map), - m_area_2(m_traits.compute_area_2_object()), - m_squared_distance_2(m_traits.compute_squared_distance_2_object()) { - - CGAL_precondition( - polygon.size() >= 3); - CGAL_precondition( - internal::is_simple_2(polygon, traits, point_map)); - CGAL_precondition( - internal::polygon_type_2(polygon, traits, point_map) == - internal::Polygon_type::STRICTLY_CONVEX); - resize(); - } - - /// @} - - /// \name Access - /// @{ - - /*! - \brief computes 2D discrete harmonic weights. - - This function fills a destination range with 2D discrete harmonic weights - computed at the `query` point with respect to the vertices of the input polygon. - - The number of computed weights is equal to the number of polygon vertices. - - \tparam OutIterator - a model of `OutputIterator` whose value type is `FT` - - \param query - a query point - - \param w_begin - the beginning of the destination range with the computed weights - - \return an output iterator to the element in the destination range, - one past the last weight stored - */ - template - OutIterator operator()(const Point_2& query, OutIterator w_begin) { - const bool normalize = false; - return operator()(query, w_begin, normalize); - } - - /// @} - - /// \cond SKIP_IN_MANUAL - template - OutIterator operator()(const Point_2& query, OutIterator w_begin, const bool normalize) { - return optimal_weights(query, w_begin, normalize); - } - /// \endcond - - private: - - // Fields. - const VertexRange& m_polygon; - const GeomTraits m_traits; - const PointMap m_point_map; - - const Area_2 m_area_2; - const Squared_distance_2 m_squared_distance_2; - - std::vector r; - std::vector A; - std::vector B; - std::vector w; - - // Functions. - void resize() { - r.resize(m_polygon.size()); - A.resize(m_polygon.size()); - B.resize(m_polygon.size()); - w.resize(m_polygon.size()); - } - - template - OutputIterator optimal_weights( - const Point_2& query, OutputIterator weights, const bool normalize) { - - // Get the number of vertices in the polygon. - const std::size_t n = m_polygon.size(); - - // Compute areas A, B, and distances r following the notation from [1]. - // Split the loop to make this computation faster. - const auto& p1 = get(m_point_map, *(m_polygon.begin() + 0)); - const auto& p2 = get(m_point_map, *(m_polygon.begin() + 1)); - const auto& pn = get(m_point_map, *(m_polygon.begin() + (n - 1))); - - r[0] = m_squared_distance_2(p1, query); - A[0] = m_area_2(p1, p2, query); - B[0] = m_area_2(pn, p2, query); - - for (std::size_t i = 1; i < n - 1; ++i) { - const auto& pi0 = get(m_point_map, *(m_polygon.begin() + (i - 1))); - const auto& pi1 = get(m_point_map, *(m_polygon.begin() + (i + 0))); - const auto& pi2 = get(m_point_map, *(m_polygon.begin() + (i + 1))); - - r[i] = m_squared_distance_2(pi1, query); - A[i] = m_area_2(pi1, pi2, query); - B[i] = m_area_2(pi0, pi2, query); - } - - const auto& pm = get(m_point_map, *(m_polygon.begin() + (n - 2))); - r[n - 1] = m_squared_distance_2(pn, query); - A[n - 1] = m_area_2(pn, p1, query); - B[n - 1] = m_area_2(pm, p1, query); - - // Compute unnormalized weights following the formula (25) with p = 2 from [1]. - CGAL_assertion(A[n - 1] != FT(0) && A[0] != FT(0)); - w[0] = (r[1] * A[n - 1] - r[0] * B[0] + r[n - 1] * A[0]) / (A[n - 1] * A[0]); - - for (std::size_t i = 1; i < n - 1; ++i) { - CGAL_assertion(A[i - 1] != FT(0) && A[i] != FT(0)); - w[i] = (r[i + 1] * A[i - 1] - r[i] * B[i] + r[i - 1] * A[i]) / (A[i - 1] * A[i]); - } - - CGAL_assertion(A[n - 2] != FT(0) && A[n - 1] != FT(0)); - w[n - 1] = (r[0] * A[n - 2] - r[n - 1] * B[n - 1] + r[n - 2] * A[n - 1]) / (A[n - 2] * A[n - 1]); - - // Normalize if necessary. - if (normalize) { - internal::normalize(w); - } - - // Return weights. - for (std::size_t i = 0; i < n; ++i) { - *(weights++) = w[i]; - } - return weights; - } - }; + /// \name Initialization + /// @{ /*! - \ingroup PkgWeightsRefBarycentricDiscreteHarmonicWeights + \brief initializes all internal data structures. - \brief computes 2D discrete harmonic weights for polygons. + This class implements the behavior of discrete harmonic weights + for 2D query points inside strictly convex polygons. - This function computes 2D discrete harmonic weights at a given `query` point - with respect to the vertices of a strictly convex `polygon`, that is one - weight per vertex. The weights are stored in a destination range - beginning at `w_begin`. - - Internally, the class `Discrete_harmonic_weights_2` is used. If one wants to process - multiple query points, it is better to use that class. When using the free function, - internal memory is allocated for each query point, while when using the class, - it is allocated only once which is much more efficient. However, for a few query - points, it is easier to use this function. It can also be used when the processing - time is not a concern. - - \tparam PointRange - a model of `ConstRange` whose iterator type is `RandomAccessIterator` - and value type is `GeomTraits::Point_2` - - \tparam OutIterator - a model of `OutputIterator` whose value type is `GeomTraits::FT` - - \tparam GeomTraits - a model of `AnalyticWeightTraits_2` - - \param polygon - an instance of `PointRange` with 2D points which form a strictly convex polygon - - \param query - a query point - - \param w_begin - the beginning of the destination range with the computed weights - - \param traits - a traits class with geometric objects, predicates, and constructions; - this parameter can be omitted if the traits class can be deduced from the point type - - \return an output iterator to the element in the destination range, - one past the last weight stored + \param polygon an instance of `VertexRange` with the vertices of a strictly convex polygon + \param traits a traits class with geometric objects, predicates, and constructions; + the default initialization is provided + \param point_map an instance of `PointMap` that maps a vertex from `polygon` to `Point_2`; + the default initialization is provided \pre polygon.size() >= 3 \pre polygon is simple \pre polygon is strictly convex */ - template< - typename PointRange, - typename OutIterator, - typename GeomTraits> - OutIterator discrete_harmonic_weights_2( - const PointRange& polygon, const typename GeomTraits::Point_2& query, - OutIterator w_begin, const GeomTraits& traits) { + Discrete_harmonic_weights_2(const VertexRange& polygon, + const GeomTraits traits = GeomTraits(), + const PointMap point_map = PointMap()) + : m_polygon(polygon), + m_traits(traits), + m_point_map(point_map), + m_area_2(m_traits.compute_area_2_object()), + m_squared_distance_2(m_traits.compute_squared_distance_2_object()) + { + CGAL_precondition(polygon.size() >= 3); + CGAL_precondition(internal::is_simple_2(polygon, traits, point_map)); + CGAL_precondition(internal::polygon_type_2(polygon, traits, point_map) == internal::Polygon_type::STRICTLY_CONVEX); - Discrete_harmonic_weights_2 - discrete_harmonic(polygon, traits); - return discrete_harmonic(query, w_begin); + resize(); } + /// @} + + /// \name Access + /// @{ + + /*! + \brief computes 2D discrete harmonic weights. + + This function fills a destination range with 2D discrete harmonic weights + computed at the `query` point with respect to the vertices of the input polygon. + + The number of computed weights is equal to the number of polygon vertices. + + \tparam OutIterator a model of `OutputIterator` whose value type is `FT` + + \param query a query point + \param w_begin the beginning of the destination range with the computed weights + + \return an output iterator to the element in the destination range, one past the last weight stored + */ + template + OutIterator operator()(const Point_2& query, + OutIterator w_begin) + { + const bool normalize = false; + return operator()(query, w_begin, normalize); + } + + /// @} + /// \cond SKIP_IN_MANUAL - template< - typename PointRange, - typename OutIterator> - OutIterator discrete_harmonic_weights_2( - const PointRange& polygon, - const typename PointRange::value_type& query, - OutIterator w_begin) { - - using Point_2 = typename PointRange::value_type; - using GeomTraits = typename Kernel_traits::Kernel; - const GeomTraits traits; - return discrete_harmonic_weights_2( - polygon, query, w_begin, traits); + template + OutIterator operator()(const Point_2& query, + OutIterator w_begin, + const bool normalize) + { + return optimal_weights(query, w_begin, normalize); } + /// \endcond +private: + const VertexRange& m_polygon; + const GeomTraits m_traits; + const PointMap m_point_map; + + const Area_2 m_area_2; + const Squared_distance_2 m_squared_distance_2; + + std::vector r; + std::vector A; + std::vector B; + std::vector w; + + void resize() + { + r.resize(m_polygon.size()); + A.resize(m_polygon.size()); + B.resize(m_polygon.size()); + w.resize(m_polygon.size()); + } + + template + OutputIterator optimal_weights(const Point_2& query, + OutputIterator weights, + const bool normalize) + { + // Get the number of vertices in the polygon. + const std::size_t n = m_polygon.size(); + + // Compute areas A, B, and distances r following the notation from [1]. + // Split the loop to make this computation faster. + const auto& p1 = get(m_point_map, *(m_polygon.begin() + 0)); + const auto& p2 = get(m_point_map, *(m_polygon.begin() + 1)); + const auto& pn = get(m_point_map, *(m_polygon.begin() + (n - 1))); + + r[0] = m_squared_distance_2(p1, query); + A[0] = m_area_2(p1, p2, query); + B[0] = m_area_2(pn, p2, query); + + for (std::size_t i = 1; i < n - 1; ++i) + { + const auto& pi0 = get(m_point_map, *(m_polygon.begin() + (i - 1))); + const auto& pi1 = get(m_point_map, *(m_polygon.begin() + (i + 0))); + const auto& pi2 = get(m_point_map, *(m_polygon.begin() + (i + 1))); + + r[i] = m_squared_distance_2(pi1, query); + A[i] = m_area_2(pi1, pi2, query); + B[i] = m_area_2(pi0, pi2, query); + } + + const auto& pm = get(m_point_map, *(m_polygon.begin() + (n - 2))); + r[n - 1] = m_squared_distance_2(pn, query); + A[n - 1] = m_area_2(pn, p1, query); + B[n - 1] = m_area_2(pm, p1, query); + + // Compute unnormalized weights following the formula (25) with p = 2 from [1]. + CGAL_assertion(A[n - 1] != FT(0) && A[0] != FT(0)); + w[0] = (r[1] * A[n - 1] - r[0] * B[0] + r[n - 1] * A[0]) / (A[n - 1] * A[0]); + + for (std::size_t i = 1; i < n - 1; ++i) + { + CGAL_assertion(A[i - 1] != FT(0) && A[i] != FT(0)); + w[i] = (r[i + 1] * A[i - 1] - r[i] * B[i] + r[i - 1] * A[i]) / (A[i - 1] * A[i]); + } + + CGAL_assertion(A[n - 2] != FT(0) && A[n - 1] != FT(0)); + w[n - 1] = (r[0] * A[n - 2] - r[n - 1] * B[n - 1] + r[n - 2] * A[n - 1]) / (A[n - 2] * A[n - 1]); + + // Normalize if necessary. + if (normalize) + internal::normalize(w); + + // Return weights. + for (std::size_t i = 0; i < n; ++i) + *(weights++) = w[i]; + + return weights; + } +}; + +/*! + \ingroup PkgWeightsRefBarycentricDiscreteHarmonicWeights + + \brief computes 2D discrete harmonic weights for polygons. + + This function computes 2D discrete harmonic weights at a given `query` point + with respect to the vertices of a strictly convex `polygon`, that is one + weight per vertex. The weights are stored in a destination range + beginning at `w_begin`. + + Internally, the class `Discrete_harmonic_weights_2` is used. If one wants to process + multiple query points, it is better to use that class. When using the free function, + internal memory is allocated for each query point, while when using the class, + it is allocated only once which is much more efficient. However, for a few query + points, it is easier to use this function. It can also be used when the processing + time is not a concern. + + \tparam PointRange a model of `ConstRange` whose iterator type is `RandomAccessIterator` + and value type is `GeomTraits::Point_2` + \tparam OutIterator a model of `OutputIterator` whose value type is `GeomTraits::FT` + \tparam GeomTraits a model of `AnalyticWeightTraits_2` + + \param polygon an instance of `PointRange` with 2D points which form a strictly convex polygon + \param query a query point + \param w_begin the beginning of the destination range with the computed weights + \param traits a traits class with geometric objects, predicates, and constructions; + this parameter can be omitted if the traits class can be deduced from the point type + + \return an output iterator to the element in the destination range, one past the last weight stored + + \pre polygon.size() >= 3 + \pre polygon is simple + \pre polygon is strictly convex +*/ +template +OutIterator discrete_harmonic_weights_2(const PointRange& polygon, + const typename GeomTraits::Point_2& query, + OutIterator w_begin, + const GeomTraits& traits) +{ + Discrete_harmonic_weights_2 discrete_harmonic(polygon, traits); + return discrete_harmonic(query, w_begin); +} + +/// \cond SKIP_IN_MANUAL + +template +OutIterator discrete_harmonic_weights_2(const PointRange& polygon, + const typename PointRange::value_type& query, + OutIterator w_begin) +{ + using Point_2 = typename PointRange::value_type; + using GeomTraits = typename Kernel_traits::Kernel; + + const GeomTraits traits; + return discrete_harmonic_weights_2(polygon, query, w_begin, traits); +} +/// \endcond + } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h b/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h index 0170e812d1f..942ad0dc8d5 100644 --- a/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h +++ b/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h @@ -20,7 +20,7 @@ #include // README: -// This header collects all weights, which have been in CGAL before unifying them +// This header collects all weights which have been in CGAL before unifying them // into the new package Weights. This header is for information purpose only. It // will be removed in the next release. @@ -47,13 +47,13 @@ struct Cotangent_value_Meyer_impl { template double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2, - const VertexPointMap& ppmap) { + vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2, + const VertexPointMap& ppmap) { typedef typename Kernel_traits< - typename boost::property_traits::value_type >::Kernel::Vector_3 Vector; + typename boost::property_traits::value_type >::Kernel::Vector_3 Vector; const Vector a = get(ppmap, v0) - get(ppmap, v1); const Vector b = get(ppmap, v2) - get(ppmap, v1); @@ -67,16 +67,16 @@ struct Cotangent_value_Meyer_impl { const Vector cross_ab = CGAL::cross_product(a, b); const double divider = CGAL::to_double( - CGAL::approximate_sqrt(cross_ab * cross_ab)); + CGAL::approximate_sqrt(cross_ab * cross_ab)); if (divider == 0.0 /* || divider != divider */) { CGAL::collinear(get(ppmap, v0), get(ppmap, v1), get(ppmap, v2)) ? - CGAL_warning_msg(false, "Infinite Cotangent value with the degenerate triangle!") : - CGAL_warning_msg(false, "Infinite Cotangent value due to the floating point arithmetic!"); + CGAL_warning_msg(false, "Infinite Cotangent value with the degenerate triangle!") : + CGAL_warning_msg(false, "Infinite Cotangent value due to the floating point arithmetic!"); return dot_ab > 0.0 ? - (std::numeric_limits::max)() : - -(std::numeric_limits::max)(); + (std::numeric_limits::max)() : + -(std::numeric_limits::max)(); } return dot_ab / divider; } @@ -84,8 +84,8 @@ struct Cotangent_value_Meyer_impl { // Same as above but with a different API. template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type> + typename PolygonMesh, + typename VertexPointMap = typename boost::property_map::type> class Cotangent_value_Meyer { protected: @@ -99,10 +99,10 @@ protected: public: Cotangent_value_Meyer( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - pmesh_(pmesh_), - ppmap_(vpmap_) + PolygonMesh& pmesh_, + VertexPointMap vpmap_) : + pmesh_(pmesh_), + ppmap_(vpmap_) { } PolygonMesh& pmesh() { @@ -114,9 +114,9 @@ public: } double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { + vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) { return Cotangent_value_Meyer_impl()(v0, v1, v2, ppmap()); } @@ -124,8 +124,8 @@ public: // Imported from skeletonization. template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type> + typename PolygonMesh, + typename VertexPointMap = typename boost::property_map::type> class Cotangent_value_Meyer_secure { typedef VertexPointMap Point_property_map; @@ -138,10 +138,10 @@ class Cotangent_value_Meyer_secure { public: Cotangent_value_Meyer_secure( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - pmesh_(pmesh_), - ppmap_(vpmap_) + PolygonMesh& pmesh_, + VertexPointMap vpmap_) : + pmesh_(pmesh_), + ppmap_(vpmap_) { } PolygonMesh& pmesh() { @@ -153,9 +153,9 @@ public: } double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { + vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) { const Vector a = get(ppmap(), v0) - get(ppmap(), v1); const Vector b = get(ppmap(), v2) - get(ppmap(), v1); @@ -175,9 +175,9 @@ public: // Returns the cotangent value of the half angle [v0, v1, v2] by clamping between // [1, 89] degrees as suggested by -[Friedel] Unconstrained Spherical Parameterization-. template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type, -typename CotangentValue = Cotangent_value_Meyer > + typename PolygonMesh, + typename VertexPointMap = typename boost::property_map::type, + typename CotangentValue = Cotangent_value_Meyer > class Cotangent_value_clamped : CotangentValue { Cotangent_value_clamped() @@ -185,9 +185,9 @@ class Cotangent_value_clamped : CotangentValue { public: Cotangent_value_clamped( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + PolygonMesh& pmesh_, + VertexPointMap vpmap_) : + CotangentValue(pmesh_, vpmap_) { } PolygonMesh& pmesh() { @@ -201,9 +201,9 @@ public: typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { + vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) { const double cot_1 = 57.289962; const double cot_89 = 0.017455; @@ -213,9 +213,9 @@ public: }; template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type, -typename CotangentValue = Cotangent_value_Meyer > + typename PolygonMesh, + typename VertexPointMap = typename boost::property_map::type, + typename CotangentValue = Cotangent_value_Meyer > class Cotangent_value_clamped_2 : CotangentValue { Cotangent_value_clamped_2() @@ -223,9 +223,9 @@ class Cotangent_value_clamped_2 : CotangentValue { public: Cotangent_value_clamped_2( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + PolygonMesh& pmesh_, + VertexPointMap vpmap_) : + CotangentValue(pmesh_, vpmap_) { } PolygonMesh& pmesh() { @@ -239,9 +239,9 @@ public: typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { + vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) { const double cot_5 = 5.671282; const double cot_175 = -cot_5; @@ -251,18 +251,18 @@ public: }; template< -typename PolygonMesh, -typename CotangentValue = Cotangent_value_Meyer_impl > + typename PolygonMesh, + typename CotangentValue = Cotangent_value_Meyer_impl > struct Cotangent_value_minimum_zero_impl : CotangentValue { typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; template double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2, - const VertexPointMap ppmap) { + vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2, + const VertexPointMap ppmap) { const double value = CotangentValue::operator()(v0, v1, v2, ppmap); return (std::max)(0.0, value); @@ -270,9 +270,9 @@ struct Cotangent_value_minimum_zero_impl : CotangentValue { }; template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type, -typename CotangentValue = Cotangent_value_Meyer > + typename PolygonMesh, + typename VertexPointMap = typename boost::property_map::type, + typename CotangentValue = Cotangent_value_Meyer > class Cotangent_value_minimum_zero : CotangentValue { Cotangent_value_minimum_zero() @@ -280,9 +280,9 @@ class Cotangent_value_minimum_zero : CotangentValue { public: Cotangent_value_minimum_zero( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + PolygonMesh& pmesh_, + VertexPointMap vpmap_) : + CotangentValue(pmesh_, vpmap_) { } PolygonMesh& pmesh() { @@ -296,25 +296,25 @@ public: typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { + vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) { const double value = CotangentValue::operator()(v0, v1, v2); return (std::max)(0.0, value); } }; template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type, -typename CotangentValue = Cotangent_value_Meyer > + typename PolygonMesh, + typename VertexPointMap = typename boost::property_map::type, + typename CotangentValue = Cotangent_value_Meyer > class Voronoi_area : CotangentValue { public: Voronoi_area( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + PolygonMesh& pmesh_, + VertexPointMap vpmap_) : + CotangentValue(pmesh_, vpmap_) { } PolygonMesh& pmesh() { @@ -338,7 +338,7 @@ public: // return 1.0; double voronoi_area = 0.0; for (const halfedge_descriptor he : - halfedges_around_target(halfedge(v0, pmesh()), pmesh())) { + halfedges_around_target(halfedge(v0, pmesh()), pmesh())) { if (is_border(he, pmesh()) ) { continue; } @@ -357,9 +357,9 @@ public: const CGAL::Angle angle_op = CGAL::angle(v0_p, v_op_p, v1_p); bool obtuse = - (angle0 == CGAL::OBTUSE) || - (angle1 == CGAL::OBTUSE) || - (angle_op == CGAL::OBTUSE); + (angle0 == CGAL::OBTUSE) || + (angle1 == CGAL::OBTUSE) || + (angle_op == CGAL::OBTUSE); if (!obtuse) { const double cot_v1 = CotangentValue::operator()(v_op, v1, v0); @@ -371,8 +371,8 @@ public: } else { const double area_t = to_double( - CGAL::approximate_sqrt( - CGAL::squared_area(v0_p, v1_p, v_op_p))); + CGAL::approximate_sqrt( + CGAL::squared_area(v0_p, v1_p, v_op_p))); if (angle0 == CGAL::OBTUSE) { voronoi_area += area_t / 2.0; @@ -389,9 +389,9 @@ public: // Returns the cotangent value of the half angle [v0, v1, v2] by dividing the triangle area // as suggested by -[Mullen08] Spectral Conformal Parameterization-. template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type, -typename CotangentValue = Cotangent_value_Meyer > + typename PolygonMesh, + typename VertexPointMap = typename boost::property_map::type, + typename CotangentValue = Cotangent_value_Meyer > class Cotangent_value_area_weighted : CotangentValue { Cotangent_value_area_weighted() @@ -399,9 +399,9 @@ class Cotangent_value_area_weighted : CotangentValue { public: Cotangent_value_area_weighted( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + PolygonMesh& pmesh_, + VertexPointMap vpmap_) : + CotangentValue(pmesh_, vpmap_) { } PolygonMesh& pmesh() { @@ -415,15 +415,15 @@ public: typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { + vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) { return CotangentValue::operator()(v0, v1, v2) / - CGAL::sqrt(CGAL::squared_area( - get(this->ppmap(), v0), - get(this->ppmap(), v1), - get(this->ppmap(), v2))); + CGAL::sqrt(CGAL::squared_area( + get(this->ppmap(), v0), + get(this->ppmap(), v1), + get(this->ppmap(), v2))); } }; @@ -431,8 +431,8 @@ public: // Cotangent_value: as suggested by -[Sorkine07] ARAP Surface Modeling-. // Cotangent_value_area_weighted: as suggested by -[Mullen08] Spectral Conformal Parameterization-. template< -typename PolygonMesh, -typename CotangentValue = Cotangent_value_minimum_zero_impl > + typename PolygonMesh, + typename CotangentValue = Cotangent_value_minimum_zero_impl > struct Cotangent_weight_impl : CotangentValue { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; @@ -442,9 +442,9 @@ struct Cotangent_weight_impl : CotangentValue { // Edge orientation is trivial. template double operator()( - halfedge_descriptor he, - PolygonMesh& pmesh, - const VertexPointMap& ppmap) { + halfedge_descriptor he, + PolygonMesh& pmesh, + const VertexPointMap& ppmap) { const vertex_descriptor v0 = target(he, pmesh); const vertex_descriptor v1 = source(he, pmesh); @@ -467,16 +467,16 @@ struct Cotangent_weight_impl : CotangentValue { const vertex_descriptor v3 = source(he_ccw, pmesh); return ( - CotangentValue::operator()(v0, v2, v1, ppmap) / 2.0 + - CotangentValue::operator()(v0, v3, v1, ppmap) / 2.0 ); + CotangentValue::operator()(v0, v2, v1, ppmap) / 2.0 + + CotangentValue::operator()(v0, v3, v1, ppmap) / 2.0 ); } } }; template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type, -typename CotangentValue = Cotangent_value_minimum_zero > + typename PolygonMesh, + typename VertexPointMap = typename boost::property_map::type, + typename CotangentValue = Cotangent_value_minimum_zero > class Cotangent_weight : CotangentValue { Cotangent_weight() @@ -484,13 +484,13 @@ class Cotangent_weight : CotangentValue { public: Cotangent_weight( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + PolygonMesh& pmesh_, + VertexPointMap vpmap_) : + CotangentValue(pmesh_, vpmap_) { } Cotangent_weight(PolygonMesh& pmesh_) : - CotangentValue(pmesh_, get(CGAL::vertex_point, pmesh_)) + CotangentValue(pmesh_, get(CGAL::vertex_point, pmesh_)) { } PolygonMesh& pmesh() { @@ -532,16 +532,16 @@ public: const vertex_descriptor v3 = source(he_ccw, pmesh()); return ( - CotangentValue::operator()(v0, v2, v1) / 2.0 + - CotangentValue::operator()(v0, v3, v1) / 2.0 ); - } + CotangentValue::operator()(v0, v2, v1) / 2.0 + + CotangentValue::operator()(v0, v3, v1) / 2.0 ); + } } }; // Single cotangent from -[Chao10] Simple Geometric Model for Elastic Deformation. template< -typename PolygonMesh, -typename CotangentValue = Cotangent_value_Meyer_impl > + typename PolygonMesh, + typename CotangentValue = Cotangent_value_Meyer_impl > struct Single_cotangent_weight_impl : CotangentValue { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; @@ -551,9 +551,9 @@ struct Single_cotangent_weight_impl : CotangentValue { // 0 for border edges (which does not have an opposite angle). template double operator()( - halfedge_descriptor he, - PolygonMesh& pmesh, - const VertexPointMap& ppmap) { + halfedge_descriptor he, + PolygonMesh& pmesh, + const VertexPointMap& ppmap) { if (is_border(he, pmesh)) { return 0.0; } @@ -565,9 +565,9 @@ struct Single_cotangent_weight_impl : CotangentValue { }; template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type, -typename CotangentValue = Cotangent_value_Meyer > + typename PolygonMesh, + typename VertexPointMap = typename boost::property_map::type, + typename CotangentValue = Cotangent_value_Meyer > class Single_cotangent_weight : CotangentValue { Single_cotangent_weight() @@ -575,9 +575,9 @@ class Single_cotangent_weight : CotangentValue { public: Single_cotangent_weight( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + PolygonMesh& pmesh_, + VertexPointMap vpmap_) : + CotangentValue(pmesh_, vpmap_) { } PolygonMesh& pmesh() { @@ -609,9 +609,9 @@ public: }; template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type, -typename CotangentValue = Cotangent_value_Meyer > + typename PolygonMesh, + typename VertexPointMap = typename boost::property_map::type, + typename CotangentValue = Cotangent_value_Meyer > class Cotangent_weight_with_triangle_area : CotangentValue { typedef PolygonMesh PM; @@ -626,9 +626,9 @@ class Cotangent_weight_with_triangle_area : CotangentValue { public: Cotangent_weight_with_triangle_area( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + PolygonMesh& pmesh_, + VertexPointMap vpmap_) : + CotangentValue(pmesh_, vpmap_) { } PolygonMesh& pmesh() { @@ -656,7 +656,7 @@ public: const Point& v1_p = get(ppmap(), v1); const Point& v2_p = get(ppmap(), v2); const double area_t = to_double( - CGAL::sqrt(CGAL::squared_area(v0_p, v1_p, v2_p))); + CGAL::sqrt(CGAL::squared_area(v0_p, v1_p, v2_p))); return (CotangentValue::operator()(v0, v2, v1) / area_t); } else { @@ -673,8 +673,8 @@ public: const double area_t2 = to_double(CGAL::sqrt(CGAL::squared_area(v0_p, v1_p, v3_p))); return ( - CotangentValue::operator()(v0, v2, v1) / area_t1 + - CotangentValue::operator()(v0, v3, v1) / area_t2 ); + CotangentValue::operator()(v0, v2, v1) / area_t1 + + CotangentValue::operator()(v0, v3, v1) / area_t2 ); } return 0.0; } @@ -682,8 +682,8 @@ public: // Mean value calculator described in -[Floater04] Mean Value Coordinates- template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type> + typename PolygonMesh, + typename VertexPointMap = typename boost::property_map::type> class Mean_value_weight { // Mean_value_weight() @@ -694,10 +694,10 @@ class Mean_value_weight { public: Mean_value_weight( - PolygonMesh& pmesh_, - VertexPointMap vpmap) : - pmesh_(pmesh_), - vpmap_(vpmap) + PolygonMesh& pmesh_, + VertexPointMap vpmap) : + pmesh_(pmesh_), + vpmap_(vpmap) { } PolygonMesh& pmesh() { @@ -738,17 +738,17 @@ public: const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); const vertex_descriptor v3 = source(he_ccw, pmesh()); return ( - half_tan_value_2(v1, v0, v2) / norm + - half_tan_value_2(v1, v0, v3) / norm); + half_tan_value_2(v1, v0, v2) / norm + + half_tan_value_2(v1, v0, v3) / norm); } } private: // Returns the tangent value of the half angle v0_v1_v2 / 2. double half_tan_value( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { + vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) { const Vector vec0 = get(vpmap_, v1) - get(vpmap_, v2); const Vector vec1 = get(vpmap_, v2) - get(vpmap_, v0); @@ -766,9 +766,9 @@ private: // My deviation built on Meyer_02. double half_tan_value_2( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { + vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) { const Vector a = get(vpmap_, v0) - get(vpmap_, v1); const Vector b = get(vpmap_, v2) - get(vpmap_, v1); @@ -788,9 +788,9 @@ private: }; template< -typename PolygonMesh, -typename PrimaryWeight = Cotangent_weight, -typename SecondaryWeight = Mean_value_weight > + typename PolygonMesh, + typename PrimaryWeight = Cotangent_weight, + typename SecondaryWeight = Mean_value_weight > class Hybrid_weight : public PrimaryWeight, SecondaryWeight { PrimaryWeight primary; @@ -801,8 +801,8 @@ class Hybrid_weight : public PrimaryWeight, SecondaryWeight { public: Hybrid_weight(PolygonMesh& pmesh_) : - primary(pmesh_), - secondary(pmesh_) + primary(pmesh_), + secondary(pmesh_) { } PolygonMesh& pmesh() { @@ -836,7 +836,7 @@ class Scale_dependent_weight_fairing { public: Scale_dependent_weight_fairing(PolygonMesh& pmesh_) : - pmesh_(pmesh_) + pmesh_(pmesh_) { } PolygonMesh& pmesh() { @@ -865,8 +865,8 @@ public: }; template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type> + typename PolygonMesh, + typename VertexPointMap = typename boost::property_map::type> class Cotangent_weight_with_voronoi_area_fairing { typedef PolygonMesh PM; @@ -876,15 +876,15 @@ class Cotangent_weight_with_voronoi_area_fairing { public: Cotangent_weight_with_voronoi_area_fairing(PM& pmesh_) : - voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_)), - cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_)) + voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_)), + cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_)) { } Cotangent_weight_with_voronoi_area_fairing( - PM& pmesh_, - VPMap vpmap_) : - voronoi_functor(pmesh_, vpmap_), - cotangent_functor(pmesh_, vpmap_) + PM& pmesh_, + VPMap vpmap_) : + voronoi_functor(pmesh_, vpmap_), + cotangent_functor(pmesh_, vpmap_) { } PM& pmesh() { @@ -907,8 +907,8 @@ public: // Cotangent_value_Meyer_secure to avoid imprecisions from // the issue #4706 - https://github.com/CGAL/cgal/issues/4706. template< -typename PolygonMesh, -typename VertexPointMap = typename boost::property_map::type> + typename PolygonMesh, + typename VertexPointMap = typename boost::property_map::type> class Cotangent_weight_with_voronoi_area_fairing_secure { typedef PolygonMesh PM; @@ -918,15 +918,15 @@ class Cotangent_weight_with_voronoi_area_fairing_secure { public: Cotangent_weight_with_voronoi_area_fairing_secure(PM& pmesh_) : - voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_)), - cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_)) + voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_)), + cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_)) { } Cotangent_weight_with_voronoi_area_fairing_secure( - PM& pmesh_, - VPMap vpmap_) : - voronoi_functor(pmesh_, vpmap_), - cotangent_functor(pmesh_, vpmap_) + PM& pmesh_, + VPMap vpmap_) : + voronoi_functor(pmesh_, vpmap_), + cotangent_functor(pmesh_, vpmap_) { } PM& pmesh() { diff --git a/Weights/include/CGAL/Weights/internal/polygon_utils_2.h b/Weights/include/CGAL/Weights/internal/polygon_utils_2.h index b65ed49828c..c52388c7559 100644 --- a/Weights/include/CGAL/Weights/internal/polygon_utils_2.h +++ b/Weights/include/CGAL/Weights/internal/polygon_utils_2.h @@ -14,7 +14,12 @@ #ifndef CGAL_WEIGHTS_INTERNAL_POLYGON_UTILS_2_H #define CGAL_WEIGHTS_INTERNAL_POLYGON_UTILS_2_H -// STL includes. +#include +#include +#include +#include +#include + #include #include #include @@ -23,345 +28,328 @@ #include #include -// CGAL includes. -#include -#include -#include -#include -#include - namespace CGAL { namespace Weights { namespace internal { - enum class Edge_case { +enum class Edge_case { - EXTERIOR = 0, // exterior part of the polygon - BOUNDARY = 1, // boundary part of the polygon - INTERIOR = 2 // interior part of the polygon - }; + EXTERIOR = 0, // exterior part of the polygon + BOUNDARY = 1, // boundary part of the polygon + INTERIOR = 2 // interior part of the polygon +}; - // VertexRange type enum. - enum class Polygon_type { +// VertexRange type enum. +enum class Polygon_type +{ + CONCAVE = 0, // Concave polygon = non-convex polygon. + WEAKLY_CONVEX = 1, // This is a convex polygon with collinear vertices. + STRICTLY_CONVEX = 2 // This is a convex polygon without collinear vertices. +}; - // Concave polygon = non-convex polygon. - CONCAVE = 0, +// This function is taken from the Polygon_2_algorithms.h header. +// But it is updated to support property maps. +template +int which_side_in_slab_2(const Point_2& query, + const Point_2& low, const Point_2& high, + const Orientation_2& orientation_2, + const CompareX_2& compare_x_2) +{ + const Comparison_result low_x_comp_res = compare_x_2(query, low); + const Comparison_result high_x_comp_res = compare_x_2(query, high); - // This is a convex polygon with collinear vertices. - WEAKLY_CONVEX = 1, - - // This is a convex polygon without collinear vertices. - STRICTLY_CONVEX = 2 - }; - - // This function is taken from the Polygon_2_algorithms.h header. - // But it is updated to support property maps. - template< - class Point_2, - class Orientation_2, - class CompareX_2> - int which_side_in_slab_2( - const Point_2& query, const Point_2& low, const Point_2& high, - const Orientation_2& orientation_2, const CompareX_2& compare_x_2) { - - const auto low_x_comp_res = compare_x_2(query, low); - const auto high_x_comp_res = compare_x_2(query, high); - if (low_x_comp_res == CGAL::SMALLER) { - if (high_x_comp_res == CGAL::SMALLER) { - return -1; - } - } else { - switch (high_x_comp_res) { - case CGAL::LARGER: return 1; - case CGAL::SMALLER: break; - case CGAL::EQUAL: return (low_x_comp_res == CGAL::EQUAL) ? 0 : 1; - } + if (low_x_comp_res == CGAL::SMALLER) { + if (high_x_comp_res == CGAL::SMALLER) { + return -1; } - switch (orientation_2(low, query, high)) { - case CGAL::LEFT_TURN: return 1; - case CGAL::RIGHT_TURN: return -1; - default: return 0; + } else { + switch (high_x_comp_res) { + case CGAL::LARGER: return 1; + case CGAL::SMALLER: break; + case CGAL::EQUAL: return (low_x_comp_res == CGAL::EQUAL) ? 0 : 1; } } - // This function is taken from the Polygon_2_algorithms.h header. - // But it is updated to support property maps. - template< - typename VertexRange, - typename GeomTraits, - typename PointMap> - Edge_case bounded_side_2( - const VertexRange& polygon, const typename GeomTraits::Point_2& query, - const GeomTraits& traits, const PointMap point_map) { - - const auto first = polygon.begin(); - const auto last = polygon.end(); - - auto curr = first; - if (curr == last) { - return Edge_case::EXTERIOR; - } - - auto next = curr; ++next; - if (next == last) { - return Edge_case::EXTERIOR; - } - - const auto compare_x_2 = traits.compare_x_2_object(); - const auto compare_y_2 = traits.compare_y_2_object(); - const auto orientation_2 = traits.orientation_2_object(); - - bool is_inside = false; - auto curr_y_comp_res = compare_y_2(get(point_map, *curr), query); - - // Check if the segment (curr, next) intersects - // the ray { (t, query.y()) | t >= query.x() }. - do { - const auto& currp = get(point_map, *curr); - const auto& nextp = get(point_map, *next); - - auto next_y_comp_res = compare_y_2(nextp, query); - switch (curr_y_comp_res) { - case CGAL::SMALLER: - switch (next_y_comp_res) { - case CGAL::SMALLER: - break; - case CGAL::EQUAL: - switch (compare_x_2(query, nextp)) { - case CGAL::SMALLER: is_inside = !is_inside; break; - case CGAL::EQUAL: return Edge_case::BOUNDARY; - case CGAL::LARGER: break; - } - break; - case CGAL::LARGER: - switch (which_side_in_slab_2( - query, currp, nextp, orientation_2, compare_x_2)) { - case -1: is_inside = !is_inside; break; - case 0: return Edge_case::BOUNDARY; - } - break; - } - break; - case CGAL::EQUAL: - switch (next_y_comp_res) { - case CGAL::SMALLER: - switch (compare_x_2(query, currp)) { - case CGAL::SMALLER: is_inside = !is_inside; break; - case CGAL::EQUAL: return Edge_case::BOUNDARY; - case CGAL::LARGER: break; - } - break; - case CGAL::EQUAL: - switch (compare_x_2(query, currp)) { - case CGAL::SMALLER: - if (compare_x_2(query, nextp) != CGAL::SMALLER) { - return Edge_case::BOUNDARY; - } - break; - case CGAL::EQUAL: return Edge_case::BOUNDARY; - case CGAL::LARGER: - if (compare_x_2(query, nextp) != CGAL::LARGER) { - return Edge_case::BOUNDARY; - } - break; - } - break; - case CGAL::LARGER: - if (compare_x_2(query, currp) == CGAL::EQUAL) { - return Edge_case::BOUNDARY; - } - break; - } - break; - case CGAL::LARGER: - switch (next_y_comp_res) { - case CGAL::SMALLER: - switch (which_side_in_slab_2( - query, nextp, currp, orientation_2, compare_x_2)) { - case -1: is_inside = !is_inside; break; - case 0: return Edge_case::BOUNDARY; - } - break; - case CGAL::EQUAL: - if (compare_x_2(query, nextp) == CGAL::EQUAL) { - return Edge_case::BOUNDARY; - } - break; - case CGAL::LARGER: - break; - } - break; - } - - curr = next; - curr_y_comp_res = next_y_comp_res; - ++next; - if (next == last) { - next = first; - } - } while (curr != first); - return is_inside ? Edge_case::INTERIOR : Edge_case::EXTERIOR; + switch (orientation_2(low, query, high)) { + case CGAL::LEFT_TURN: return 1; + case CGAL::RIGHT_TURN: return -1; + default: return 0; } +} - // This function is taken from the Polygon_2_algorithms.h header. - // But it is updated to support property maps. - template< - typename VertexRange, - typename GeomTraits, - typename PointMap> - bool is_convex_2( - const VertexRange& polygon, const GeomTraits traits, const PointMap point_map) { +// This function is taken from the Polygon_2_algorithms.h header. +// But it is updated to support property maps. +template +Edge_case bounded_side_2(const VertexRange& polygon, + const typename GeomTraits::Point_2& query, + const GeomTraits& traits, + const PointMap point_map) +{ + const auto first = polygon.begin(); + const auto last = polygon.end(); - auto first = polygon.begin(); - const auto last = polygon.end(); + auto curr = first; + if (curr == last) + return Edge_case::EXTERIOR; - auto prev = first; - if (prev == last) { - return true; - } + auto next = curr; + ++next; + if (next == last) + return Edge_case::EXTERIOR; - auto curr = prev; ++curr; - if (curr == last) { - return true; - } + const auto compare_x_2 = traits.compare_x_2_object(); + const auto compare_y_2 = traits.compare_y_2_object(); + const auto orientation_2 = traits.orientation_2_object(); - auto next = curr; ++next; - if (next == last) { - return true; - } + bool is_inside = false; + auto curr_y_comp_res = compare_y_2(get(point_map, *curr), query); - const auto equal_2 = traits.equal_2_object(); - while (equal_2(get(point_map, *prev), get(point_map, *curr))) { - curr = next; ++next; - if (next == last) { - return true; - } - } + // Check if the segment (curr, next) intersects + // the ray { (t, query.y()) | t >= query.x() }. + do { + const auto& currp = get(point_map, *curr); + const auto& nextp = get(point_map, *next); - const auto less_xy_2 = traits.less_xy_2_object(); - const auto orientation_2 = traits.orientation_2_object(); - - bool has_clockwise_triplets = false; - bool has_counterclockwise_triplets = false; - bool order = less_xy_2( - get(point_map, *prev), get(point_map, *curr)); - int num_order_changes = 0; - - do { - switch_orient: - switch (orientation_2( - get(point_map, *prev), get(point_map, *curr), get(point_map, *next))) { - - case CGAL::CLOCKWISE: - has_clockwise_triplets = true; - break; - case CGAL::COUNTERCLOCKWISE: - has_counterclockwise_triplets = true; - break; - case CGAL::ZERO: { - if (equal_2( - get(point_map, *curr), - get(point_map, *next))) { - - if (next == first) { - first = curr; + auto next_y_comp_res = compare_y_2(nextp, query); + switch (curr_y_comp_res) { + case CGAL::SMALLER: + switch (next_y_comp_res) { + case CGAL::SMALLER: + break; + case CGAL::EQUAL: + switch (compare_x_2(query, nextp)) { + case CGAL::SMALLER: is_inside = !is_inside; break; + case CGAL::EQUAL: return Edge_case::BOUNDARY; + case CGAL::LARGER: break; } - ++next; - if (next == last) { - next = first; + break; + case CGAL::LARGER: + switch (which_side_in_slab_2( + query, currp, nextp, orientation_2, compare_x_2)) { + case -1: is_inside = !is_inside; break; + case 0: return Edge_case::BOUNDARY; } - goto switch_orient; - } - break; + break; } - } + break; + case CGAL::EQUAL: + switch (next_y_comp_res) { + case CGAL::SMALLER: + switch (compare_x_2(query, currp)) { + case CGAL::SMALLER: is_inside = !is_inside; break; + case CGAL::EQUAL: return Edge_case::BOUNDARY; + case CGAL::LARGER: break; + } + break; + case CGAL::EQUAL: + switch (compare_x_2(query, currp)) { + case CGAL::SMALLER: + if (compare_x_2(query, nextp) != CGAL::SMALLER) { + return Edge_case::BOUNDARY; + } + break; + case CGAL::EQUAL: return Edge_case::BOUNDARY; + case CGAL::LARGER: + if (compare_x_2(query, nextp) != CGAL::LARGER) { + return Edge_case::BOUNDARY; + } + break; + } + break; + case CGAL::LARGER: + if (compare_x_2(query, currp) == CGAL::EQUAL) { + return Edge_case::BOUNDARY; + } + break; + } + break; + case CGAL::LARGER: + switch (next_y_comp_res) { + case CGAL::SMALLER: + switch (which_side_in_slab_2( + query, nextp, currp, orientation_2, compare_x_2)) { + case -1: is_inside = !is_inside; break; + case 0: return Edge_case::BOUNDARY; + } + break; + case CGAL::EQUAL: + if (compare_x_2(query, nextp) == CGAL::EQUAL) { + return Edge_case::BOUNDARY; + } + break; + case CGAL::LARGER: + break; + } + break; + } - const bool new_order = less_xy_2( - get(point_map, *curr), get(point_map, *next)); + curr = next; + curr_y_comp_res = next_y_comp_res; + ++next; + if (next == last) { + next = first; + } + } while (curr != first); - if (order != new_order) { - num_order_changes++; - } + return is_inside ? Edge_case::INTERIOR : Edge_case::EXTERIOR; +} - if (num_order_changes > 2) { - return false; - } +// This function is taken from the Polygon_2_algorithms.h header. +// But it is updated to support property maps. +template +bool is_convex_2(const VertexRange& polygon, + const GeomTraits traits, + const PointMap point_map) +{ + auto first = polygon.begin(); + const auto last = polygon.end(); - if (has_clockwise_triplets && has_counterclockwise_triplets) { - return false; - } - - prev = curr; - curr = next; - ++next; - if (next == last) { - next = first; - } - order = new_order; - } while (prev != first); + auto prev = first; + if (prev == last) return true; - } - // This function is taken from the Polygon_2_algorithms.h header. - // But it is updated to support property maps. - template< - typename VertexRange, - typename GeomTraits, - typename PointMap> - bool is_simple_2( - const VertexRange& polygon, const GeomTraits traits, const PointMap point_map) { + auto curr = prev; + ++curr; + if (curr == last) + return true; - const auto first = polygon.begin(); - const auto last = polygon.end(); - if (first == last) { + auto next = curr; + ++next; + if (next == last) + return true; + + const auto equal_2 = traits.equal_2_object(); + while (equal_2(get(point_map, *prev), get(point_map, *curr))) { + curr = next; ++next; + if (next == last) return true; - } - - std::vector poly; - poly.reserve(polygon.size()); - for (const auto& vertex : polygon) { - poly.push_back(get(point_map, vertex)); - } - return CGAL::is_simple_2(poly.begin(), poly.end(), traits); } - template< - typename VertexRange, - typename GeomTraits, - typename PointMap> - Polygon_type polygon_type_2( - const VertexRange& polygon, const GeomTraits traits, const PointMap point_map) { + const auto less_xy_2 = traits.less_xy_2_object(); + const auto orientation_2 = traits.orientation_2_object(); - const auto collinear_2 = - traits.collinear_2_object(); - CGAL_precondition(polygon.size() >= 3); + bool has_clockwise_triplets = false; + bool has_counterclockwise_triplets = false; + bool order = less_xy_2(get(point_map, *prev), get(point_map, *curr)); + int num_order_changes = 0; - // First, test the polygon on convexity. - if (is_convex_2(polygon, traits, point_map)) { + do + { +switch_orient: + switch (orientation_2(get(point_map, *prev), get(point_map, *curr), get(point_map, *next))) + { + case CGAL::CLOCKWISE: + has_clockwise_triplets = true; + break; + case CGAL::COUNTERCLOCKWISE: + has_counterclockwise_triplets = true; + break; + case CGAL::ZERO: { + if (equal_2(get(point_map, *curr), + get(point_map, *next))) + { + if (next == first) + first = curr; - // Test all the consequent triplets of polygon vertices on collinearity. - // In case we find at least one, return WEAKLY_CONVEX polygon. - const std::size_t n = polygon.size(); - for (std::size_t i = 0; i < n; ++i) { - const auto& p1 = get(point_map, *(polygon.begin() + i)); + ++next; + if (next == last) + next = first; - const std::size_t im = (i + n - 1) % n; - const std::size_t ip = (i + 1) % n; - - const auto& p0 = get(point_map, *(polygon.begin() + im)); - const auto& p2 = get(point_map, *(polygon.begin() + ip)); - - if (collinear_2(p0, p1, p2)) { - return Polygon_type::WEAKLY_CONVEX; + goto switch_orient; } + break; } - // Otherwise, return STRICTLY_CONVEX polygon. - return Polygon_type::STRICTLY_CONVEX; } - // Otherwise, return CONCAVE polygon. - return Polygon_type::CONCAVE; + + const bool new_order = less_xy_2(get(point_map, *curr), get(point_map, *next)); + + if (order != new_order) + num_order_changes++; + + if (num_order_changes > 2) + return false; + + if (has_clockwise_triplets && has_counterclockwise_triplets) + return false; + + prev = curr; + curr = next; + ++next; + if (next == last) + next = first; + + order = new_order; + } while (prev != first); + + return true; +} + +// This function is taken from the Polygon_2_algorithms.h header. +// But it is updated to support property maps. +template +bool is_simple_2(const VertexRange& polygon, + const GeomTraits traits, + const PointMap point_map) +{ + const auto first = polygon.begin(); + const auto last = polygon.end(); + if (first == last) + return true; + + std::vector poly; + poly.reserve(polygon.size()); + for (const auto& vertex : polygon) + poly.push_back(get(point_map, vertex)); + + return CGAL::is_simple_2(poly.begin(), poly.end(), traits); +} + +template +Polygon_type polygon_type_2(const VertexRange& polygon, + const GeomTraits traits, + const PointMap point_map) +{ + auto collinear_2 = traits.collinear_2_object(); + CGAL_precondition(polygon.size() >= 3); + + // First, test the polygon on convexity. + if (is_convex_2(polygon, traits, point_map)) + { + // Test all the consequent triplets of polygon vertices on collinearity. + // In case we find at least one, return WEAKLY_CONVEX polygon. + const std::size_t n = polygon.size(); + for (std::size_t i = 0; i < n; ++i) + { + const auto& p1 = get(point_map, *(polygon.begin() + i)); + + const std::size_t im = (i + n - 1) % n; + const std::size_t ip = (i + 1) % n; + + const auto& p0 = get(point_map, *(polygon.begin() + im)); + const auto& p2 = get(point_map, *(polygon.begin() + ip)); + + if (collinear_2(p0, p1, p2)) + return Polygon_type::WEAKLY_CONVEX; + } + + // Otherwise, return STRICTLY_CONVEX polygon. + return Polygon_type::STRICTLY_CONVEX; } + // Otherwise, return CONCAVE polygon. + return Polygon_type::CONCAVE; +} + } // namespace internal } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/internal/utils.h b/Weights/include/CGAL/Weights/internal/utils.h index 4e6ef42f96c..58eed2cd389 100644 --- a/Weights/include/CGAL/Weights/internal/utils.h +++ b/Weights/include/CGAL/Weights/internal/utils.h @@ -14,722 +14,650 @@ #ifndef CGAL_WEIGHTS_INTERNAL_UTILS_H #define CGAL_WEIGHTS_INTERNAL_UTILS_H -// STL includes. -#include -#include -#include -#include -#include -#include -#include -#include - -// Boost headers. -#include -#include - -// CGAL includes. -#include #include -#include +#include #include +#include #include -#include -#include +#include + +#include + +#include +#include +#include +#include +#include namespace CGAL { namespace Weights { namespace internal { - // Sqrt helpers. - template - class Default_sqrt { +// Sqrt helpers. +template +class Default_sqrt +{ +private: + using Traits = GeomTraits; + using FT = typename Traits::FT; - private: - using Traits = GeomTraits; - using FT = typename Traits::FT; - - public: - FT operator()(const FT value) const { - return static_cast( - CGAL::sqrt(CGAL::to_double(CGAL::abs(value)))); - } - }; - - BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_nested_type_Sqrt, Sqrt, false) - - // Case: do_not_use_default = false. - template::value> - class Get_sqrt { - - public: - using Traits = GeomTraits; - using Sqrt = Default_sqrt; - - static Sqrt sqrt_object(const Traits& ) { - return Sqrt(); - } - }; - - // Case: do_not_use_default = true. - template - class Get_sqrt { - - public: - using Traits = GeomTraits; - using Sqrt = typename Traits::Sqrt; - - static Sqrt sqrt_object(const Traits& traits) { - return traits.sqrt_object(); - } - }; - - // Normalize values. - template - void normalize(std::vector& values) { - - FT sum = FT(0); - for (const FT& value : values) { - sum += value; - } - - CGAL_assertion(sum != FT(0)); - if (sum == FT(0)) { - return; - } - - const FT inv_sum = FT(1) / sum; - for (FT& value : values) { - value *= inv_sum; - } +public: + FT operator()(const FT value) const + { + return static_cast(CGAL::sqrt(CGAL::to_double(CGAL::abs(value)))); } +}; - // Raises value to the power. - template - typename GeomTraits::FT power( - const GeomTraits&, - const typename GeomTraits::FT value, - const typename GeomTraits::FT p) { +BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_nested_type_Sqrt, Sqrt, false) - using FT = typename GeomTraits::FT; - const double base = CGAL::to_double(value); - const double exp = CGAL::to_double(p); - return static_cast(std::pow(base, exp)); +// Case: do_not_use_default = false. +template::value> +class Get_sqrt +{ +public: + using Traits = GeomTraits; + using Sqrt = Default_sqrt; + + static Sqrt sqrt_object(const Traits&) + { + return Sqrt(); } +}; - // Computes distance between two 2D points. - template - typename GeomTraits::FT distance_2( - const GeomTraits& traits, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q) { +// Case: do_not_use_default = true. +template +class Get_sqrt +{ +public: + using Traits = GeomTraits; + using Sqrt = typename Traits::Sqrt; - using Get_sqrt = Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); - - const auto squared_distance_2 = - traits.compute_squared_distance_2_object(); - return sqrt(squared_distance_2(p, q)); + static Sqrt sqrt_object(const Traits& traits) + { + return traits.sqrt_object(); } - - // Computes length of a 2D vector. - template - typename GeomTraits::FT length_2( - const GeomTraits& traits, - const typename GeomTraits::Vector_2& v) { - - using Get_sqrt = Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); - - const auto squared_length_2 = - traits.compute_squared_length_2_object(); - return sqrt(squared_length_2(v)); - } - - // Normalizes a 2D vector. - template - void normalize_2( - const GeomTraits& traits, - typename GeomTraits::Vector_2& v) { - - using FT = typename GeomTraits::FT; - const FT length = length_2(traits, v); - CGAL_assertion(length != FT(0)); - if (length == FT(0)) { - return; - } - v /= length; - } - - // Computes cotanget between two 2D vectors. - template - typename GeomTraits::FT cotangent_2( - const GeomTraits& traits, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r) { - - using FT = typename GeomTraits::FT; - const auto dot_product_2 = - traits.compute_scalar_product_2_object(); - const auto cross_product_2 = - traits.compute_determinant_2_object(); - const auto construct_vector_2 = - traits.construct_vector_2_object(); - - const auto v1 = construct_vector_2(q, r); - const auto v2 = construct_vector_2(q, p); - - const FT dot = dot_product_2(v1, v2); - const FT cross = cross_product_2(v1, v2); - - const FT length = CGAL::abs(cross); - // CGAL_assertion(length != FT(0)); not really necessary - if (length != FT(0)) { - return dot / length; - } else { - return FT(0); // undefined - } - } - - // Computes tanget between two 2D vectors. - template - typename GeomTraits::FT tangent_2( - const GeomTraits& traits, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r) { - - using FT = typename GeomTraits::FT; - const auto dot_product_2 = - traits.compute_scalar_product_2_object(); - const auto cross_product_2 = - traits.compute_determinant_2_object(); - const auto construct_vector_2 = - traits.construct_vector_2_object(); - - const auto v1 = construct_vector_2(q, r); - const auto v2 = construct_vector_2(q, p); - - const FT dot = dot_product_2(v1, v2); - const FT cross = cross_product_2(v1, v2); - - const FT length = CGAL::abs(cross); - // CGAL_assertion(dot != FT(0)); not really necessary - if (dot != FT(0)) { - return length / dot; - } else { - return FT(0); // undefined - } - } - - // Computes distance between two 3D points. - template - typename GeomTraits::FT distance_3( - const GeomTraits& traits, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q) { - - using Get_sqrt = Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); - - const auto squared_distance_3 = - traits.compute_squared_distance_3_object(); - return sqrt(squared_distance_3(p, q)); - } - - // Computes length of a 3D vector. - template - typename GeomTraits::FT length_3( - const GeomTraits& traits, - const typename GeomTraits::Vector_3& v) { - - using Get_sqrt = Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); - - const auto squared_length_3 = - traits.compute_squared_length_3_object(); - return sqrt(squared_length_3(v)); - } - - // Normalizes a 3D vector. - template - void normalize_3( - const GeomTraits& traits, - typename GeomTraits::Vector_3& v) { - - using FT = typename GeomTraits::FT; - const FT length = length_3(traits, v); - CGAL_assertion(length != FT(0)); - if (length == FT(0)) { - return; - } - v /= length; - } - - // Computes cotanget between two 3D vectors. - template - typename GeomTraits::FT cotangent_3( - const GeomTraits& traits, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r) { - - using FT = typename GeomTraits::FT; - const auto dot_product_3 = - traits.compute_scalar_product_3_object(); - const auto cross_product_3 = - traits.construct_cross_product_vector_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); - - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); - - const FT dot = dot_product_3(v1, v2); - const auto cross = cross_product_3(v1, v2); - - const FT length = length_3(traits, cross); - // TODO: - // Not really necessary: since we handle case length = 0. Does this case happen? - // Yes, e.g. in Surface Parameterization tests. Does it affect the results? - // In current applications, not really. - // CGAL_assertion(length != FT(0)); - if (length != FT(0)) { - return dot / length; - } else { - return FT(0); // undefined - } - } - - // Computes tanget between two 3D vectors. - template - typename GeomTraits::FT tangent_3( - const GeomTraits& traits, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r) { - - using FT = typename GeomTraits::FT; - const auto dot_product_3 = - traits.compute_scalar_product_3_object(); - const auto cross_product_3 = - traits.construct_cross_product_vector_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); - - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); - - const FT dot = dot_product_3(v1, v2); - const auto cross = cross_product_3(v1, v2); - - const FT length = length_3(traits, cross); - // CGAL_assertion(dot != FT(0)); not really necessary - if (dot != FT(0)) { - return length / dot; - } else { - return FT(0); // undefined - } - } - - // Computes 3D angle between two vectors. - template - double angle_3( - const GeomTraits& traits, - const typename GeomTraits::Vector_3& v1, - const typename GeomTraits::Vector_3& v2) { - - const auto dot_product_3 = - traits.compute_scalar_product_3_object(); - const double dot = - CGAL::to_double(dot_product_3(v1, v2)); - - double angle_rad = 0.0; - if (dot < -1.0) { - angle_rad = std::acos(-1.0); - } else if (dot > 1.0) { - angle_rad = std::acos(+1.0); - } else { - angle_rad = std::acos(dot); - } - return angle_rad; - } - - // Rotates a 3D point around axis. - template - typename GeomTraits::Point_3 rotate_point_3( - const GeomTraits&, - const double angle_rad, - const typename GeomTraits::Vector_3& axis, - const typename GeomTraits::Point_3& query) { - - using FT = typename GeomTraits::FT; - using Point_3 = typename GeomTraits::Point_3; - - const FT c = static_cast(std::cos(angle_rad)); - const FT s = static_cast(std::sin(angle_rad)); - const FT C = FT(1) - c; - - const auto x = axis.x(); - const auto y = axis.y(); - const auto z = axis.z(); - - return Point_3( - (x * x * C + c) * query.x() + - (x * y * C - z * s) * query.y() + - (x * z * C + y * s) * query.z(), - (y * x * C + z * s) * query.x() + - (y * y * C + c) * query.y() + - (y * z * C - x * s) * query.z(), - (z * x * C - y * s) * query.x() + - (z * y * C + x * s) * query.y() + - (z * z * C + c) * query.z()); - } - - // Computes two 3D orthogonal base vectors wrt a given normal. - template - void orthogonal_bases_3( - const GeomTraits& traits, - const typename GeomTraits::Vector_3& normal, - typename GeomTraits::Vector_3& b1, - typename GeomTraits::Vector_3& b2) { - - using Vector_3 = typename GeomTraits::Vector_3; - const auto cross_product_3 = - traits.construct_cross_product_vector_3_object(); - - const auto nx = normal.x(); - const auto ny = normal.y(); - const auto nz = normal.z(); - - if (CGAL::abs(nz) >= CGAL::abs(ny)) { - b1 = Vector_3(nz, 0, -nx); - } else { - b1 = Vector_3(ny, -nx, 0); - } - b2 = cross_product_3(normal, b1); - - normalize_3(traits, b1); - normalize_3(traits, b2); - } - - // Converts a 3D point into a 2D point wrt to a given plane. - template - typename GeomTraits::Point_2 to_2d( - const GeomTraits& traits, - const typename GeomTraits::Vector_3& b1, - const typename GeomTraits::Vector_3& b2, - const typename GeomTraits::Point_3& origin, - const typename GeomTraits::Point_3& query) { - - using Point_2 = typename GeomTraits::Point_2; - const auto dot_product_3 = - traits.compute_scalar_product_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); - - const auto v = construct_vector_3(origin, query); - const auto x = dot_product_3(b1, v); - const auto y = dot_product_3(b2, v); - return Point_2(x, y); - } - - // Flattening. - - // \cgalFigureBegin{flattening, flattening.svg} - // The non-planar configuration (top) is flattened to the planar configuration (bottom). - // \cgalFigureEnd - - // When computing weights for a query point \f$q\f$ with respect to its neighbors - // \f$p_0\f$, \f$p_1\f$, and \f$p_2\f$, the local configuration is a quadrilateral - // [\f$p_0\f$, \f$p_1\f$, \f$p_2\f$, \f$q\f$] or two connected triangles [\f$q\f$, \f$p_0\f$, \f$p_1\f$] - // and [\f$q\f$, \f$p_1\f$, \f$p_2\f$]. When working in 3D, these triangles are not - // necessarily coplanar, in other words, they do not belong to the same common plane. - // When they are not coplanar, they can be made coplanar through the process called *flattening* (see the Figure above), - // however the latter introduces a distortion because the weights are computed with respect to the - // flattened configuration rather than to the original non-flat configuration. - - // \subsection Weights_Examples_ProjectionTraits Computing 2D Weights in 3D - - // If you have a 2D polygon in 3D plane that is not an XY plane, you can still compute - // the 2D weights, however you need to provide a special projection traits class. - // The common plane that is used in this example is projectable to the XY plane. We first - // compute `Mean_value_weights_2` for a 3D polygon in this plane. We then also show how to use - // the projection traits to compute the \ref PkgWeightsRefWachspressWeights "2D Wachspress weight" - // for 3D points which are not strictly coplanar. - - // \cgalExample{Weights/projection_traits.cpp} - - // Example of flattening: - - // 3D configuration. - // const Point_3 p0(0, 1, 1); - // const Point_3 p1(2, 0, 1); - // const Point_3 p2(7, 1, 1); - // const Point_3 q0(3, 1, 1); - - // Choose a type of the weight: - // e.g. 0 - Wachspress (WP) weight. - // const FT wp = FT(0); - - // Compute WP weights for q1 which is not on the plane [p0, p1, p2]. - - // Point_3 q1(3, 1, 2); - // std::cout << "3D wachspress (WP, q1): "; - // std::cout << CGAL::Weights::three_point_family_weight(p0, p1, p2, q1, wp) << std::endl; - - // Converge q1 towards q0 that is we flatten the configuration. - // We also compare the result with the authalic weight. - - // std::cout << "Converge q1 to q0: " << std::endl; - // for (FT x = FT(0); x <= FT(1); x += step) { - // std::cout << "3D wachspress/authalic: "; - // q1 = Point_3(3, 1, FT(2) - x); - // std::cout << CGAL::Weights::three_point_family_weight(p0, p1, p2, q1, wp) << "/"; - // std::cout << CGAL::Weights::authalic_weight(p0, p1, p2, q1) << std::endl; - // } - - // Flattens an arbitrary quad into a planar quad. - template - void flatten( - const GeomTraits& traits, - const typename GeomTraits::Point_3& t, // prev neighbor/vertex/point - const typename GeomTraits::Point_3& r, // curr neighbor/vertex/point - const typename GeomTraits::Point_3& p, // next neighbor/vertex/point - const typename GeomTraits::Point_3& q, // query point - typename GeomTraits::Point_2& tf, - typename GeomTraits::Point_2& rf, - typename GeomTraits::Point_2& pf, - typename GeomTraits::Point_2& qf) { - - // std::cout << std::endl; - using Point_3 = typename GeomTraits::Point_3; - using Vector_3 = typename GeomTraits::Vector_3; - - const auto cross_product_3 = - traits.construct_cross_product_vector_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); - const auto centroid_3 = - traits.construct_centroid_3_object(); - - // Compute centroid. - const auto center = centroid_3(t, r, p, q); - // std::cout << "centroid: " << center << std::endl; - - // Translate. - const Point_3 t1 = Point_3( - t.x() - center.x(), t.y() - center.y(), t.z() - center.z()); - const Point_3 r1 = Point_3( - r.x() - center.x(), r.y() - center.y(), r.z() - center.z()); - const Point_3 p1 = Point_3( - p.x() - center.x(), p.y() - center.y(), p.z() - center.z()); - const Point_3 q1 = Point_3( - q.x() - center.x(), q.y() - center.y(), q.z() - center.z()); - - // std::cout << "translated t1: " << t1 << std::endl; - // std::cout << "translated r1: " << r1 << std::endl; - // std::cout << "translated p1: " << p1 << std::endl; - // std::cout << "translated q1: " << q1 << std::endl; - - // Middle axis. - auto ax = construct_vector_3(q1, r1); - normalize_3(traits, ax); - - // Prev and next vectors. - auto v1 = construct_vector_3(q1, t1); - auto v2 = construct_vector_3(q1, p1); - - normalize_3(traits, v1); - normalize_3(traits, v2); - - // Two triangle normals. - auto n1 = cross_product_3(v1, ax); - auto n2 = cross_product_3(ax, v2); - - normalize_3(traits, n1); - normalize_3(traits, n2); - - // std::cout << "normal n1: " << n1 << std::endl; - // std::cout << "normal n2: " << n2 << std::endl; - - // Angle between two normals. - const double angle_rad = angle_3(traits, n1, n2); - // std::cout << "angle deg n1 <-> n2: " << angle_rad * 180.0 / CGAL_PI << std::endl; - - // Rotate p1 around ax so that it lands onto the plane [q1, t1, r1]. - const auto& t2 = t1; - const auto& r2 = r1; - const auto p2 = rotate_point_3(traits, angle_rad, ax, p1); - const auto& q2 = q1; - // std::cout << "rotated p2: " << p2 << std::endl; - - // Compute orthogonal base vectors. - Vector_3 b1, b2; - const auto& normal = n1; - orthogonal_bases_3(traits, normal, b1, b2); - - // const auto angle12 = angle_3(traits, b1, b2); - // std::cout << "angle deg b1 <-> b2: " << angle12 * 180.0 / CGAL_PI << std::endl; - - // Flatten a quad. - const auto& origin = q2; - tf = to_2d(traits, b1, b2, origin, t2); - rf = to_2d(traits, b1, b2, origin, r2); - pf = to_2d(traits, b1, b2, origin, p2); - qf = to_2d(traits, b1, b2, origin, q2); - - // std::cout << "flattened qf: " << qf << std::endl; - // std::cout << "flattened tf: " << tf << std::endl; - // std::cout << "flattened rf: " << rf << std::endl; - // std::cout << "flattened pf: " << pf << std::endl; - - // std::cout << "A1: " << area_2(traits, rf, qf, pf) << std::endl; - // std::cout << "A2: " << area_2(traits, pf, qf, rf) << std::endl; - // std::cout << "C: " << area_2(traits, tf, rf, pf) << std::endl; - // std::cout << "B: " << area_2(traits, pf, qf, tf) << std::endl; - } - - // Computes area of a 2D triangle. - template - typename GeomTraits::FT area_2( - const GeomTraits& traits, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r) { - - const auto area_2 = traits.compute_area_2_object(); - return area_2(p, q, r); - } - - // Computes positive area of a 2D triangle. - template - typename GeomTraits::FT positive_area_2( - const GeomTraits& traits, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r) { - - return CGAL::abs(area_2(traits, p, q, r)); - } - - // Computes area of a 3D triangle. - template - typename GeomTraits::FT area_3( - const GeomTraits& traits, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r) { - - using FT = typename GeomTraits::FT; - using Point_3 = typename GeomTraits::Point_3; - using Vector_3 = typename GeomTraits::Vector_3; - - const auto cross_product_3 = - traits.construct_cross_product_vector_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); - const auto centroid_3 = - traits.construct_centroid_3_object(); - - // Compute centroid. - const auto center = centroid_3(p, q, r); - - // Translate. - const Point_3 a = Point_3( - p.x() - center.x(), p.y() - center.y(), p.z() - center.z()); - const Point_3 b = Point_3( - q.x() - center.x(), q.y() - center.y(), q.z() - center.z()); - const Point_3 c = Point_3( - r.x() - center.x(), r.y() - center.y(), r.z() - center.z()); - - // Prev and next vectors. - auto v1 = construct_vector_3(b, a); - auto v2 = construct_vector_3(b, c); - normalize_3(traits, v1); - normalize_3(traits, v2); - - // Compute normal. - auto normal = cross_product_3(v1, v2); - normalize_3(traits, normal); - - // Compute orthogonal base vectors. - Vector_3 b1, b2; - orthogonal_bases_3(traits, normal, b1, b2); - - // Compute area. - const auto& origin = b; - const auto pf = to_2d(traits, b1, b2, origin, a); - const auto qf = to_2d(traits, b1, b2, origin, b); - const auto rf = to_2d(traits, b1, b2, origin, c); - - const FT A = area_2(traits, pf, qf, rf); - return A; - } - - // Computes positive area of a 3D triangle. - template - typename GeomTraits::FT positive_area_3( - const GeomTraits& traits, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r) { - - using FT = typename GeomTraits::FT; - const auto construct_vector_3 = - traits.construct_vector_3_object(); - - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); - - const auto cross_product_3 = - traits.construct_cross_product_vector_3_object(); - const auto cross = cross_product_3(v1, v2); - const FT half = FT(1) / FT(2); - const FT A = half * length_3(traits, cross); - return A; - } - - // Computes a clamped cotangent between two 3D vectors. - // In the old version of weights in PMP, it has been called secure. - // See Weights/internal/pmp_weights_deprecated.h for more information. - template - typename GeomTraits::FT cotangent_3_clamped( - const GeomTraits& traits, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r) { - - using FT = typename GeomTraits::FT; - using Get_sqrt = Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); - - const auto dot_product_3 = - traits.compute_scalar_product_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); - - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); - - const FT dot = dot_product_3(v1, v2); - const FT length_v1 = length_3(traits, v1); - const FT length_v2 = length_3(traits, v2); - - const FT lb = -FT(999) / FT(1000), ub = FT(999) / FT(1000); - FT cosine = dot / length_v1 / length_v2; - cosine = (cosine < lb) ? lb : cosine; - cosine = (cosine > ub) ? ub : cosine; - const FT sine = sqrt(FT(1) - cosine * cosine); - - CGAL_assertion(sine != FT(0)); - if (sine != FT(0)) { - return cosine / sine; - } +}; + +template +void normalize(std::vector& values) +{ + FT sum = FT(0); + for (const FT& value : values) + sum += value; + + CGAL_assertion(sum != FT(0)); + if (sum == FT(0)) + return; + + const FT inv_sum = FT(1) / sum; + for (FT& value : values) + value *= inv_sum; +} + +// Raises value to the power. +template +typename GeomTraits::FT power(const GeomTraits&, + const typename GeomTraits::FT value, + const typename GeomTraits::FT p) +{ + using FT = typename GeomTraits::FT; + + const double base = CGAL::to_double(value); + const double exp = CGAL::to_double(p); + + return static_cast(std::pow(base, exp)); +} + +// Computes distance between two 2D points. +template +typename GeomTraits::FT distance_2(const GeomTraits& traits, + const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q) +{ + using Get_sqrt = Get_sqrt; + const auto sqrt = Get_sqrt::sqrt_object(traits); + + const auto squared_distance_2 = traits.compute_squared_distance_2_object(); + return sqrt(squared_distance_2(p, q)); +} + +// Computes length of a 2D vector. +template +typename GeomTraits::FT length_2(const GeomTraits& traits, + const typename GeomTraits::Vector_2& v) +{ + using Get_sqrt = Get_sqrt; + const auto sqrt = Get_sqrt::sqrt_object(traits); + + const auto squared_length_2 = traits.compute_squared_length_2_object(); + return sqrt(squared_length_2(v)); +} + +template +void normalize_2(const GeomTraits& traits, + typename GeomTraits::Vector_2& v) +{ + using FT = typename GeomTraits::FT; + const FT length = length_2(traits, v); + CGAL_assertion(length != FT(0)); + if (length == FT(0)) + return; + + v /= length; +} + +// Computes cotanget between two 2D vectors. +template +typename GeomTraits::FT cotangent_2(const GeomTraits& traits, + const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r) +{ + using FT = typename GeomTraits::FT; + const auto dot_product_2 = traits.compute_scalar_product_2_object(); + const auto cross_product_2 = traits.compute_determinant_2_object(); + const auto construct_vector_2 = traits.construct_vector_2_object(); + + const auto v1 = construct_vector_2(q, r); + const auto v2 = construct_vector_2(q, p); + + const FT dot = dot_product_2(v1, v2); + const FT cross = cross_product_2(v1, v2); + + const FT length = CGAL::abs(cross); + // CGAL_assertion(length != FT(0)); not really necessary + if (length != FT(0)) + return dot / length; + else return FT(0); // undefined - } +} + +// Computes tanget between two 2D vectors. +template +typename GeomTraits::FT tangent_2(const GeomTraits& traits, + const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r) +{ + using FT = typename GeomTraits::FT; + const auto dot_product_2 = traits.compute_scalar_product_2_object(); + const auto cross_product_2 = traits.compute_determinant_2_object(); + const auto construct_vector_2 = traits.construct_vector_2_object(); + + const auto v1 = construct_vector_2(q, r); + const auto v2 = construct_vector_2(q, p); + + const FT dot = dot_product_2(v1, v2); + const FT cross = cross_product_2(v1, v2); + + const FT length = CGAL::abs(cross); + // CGAL_assertion(dot != FT(0)); not really necessary + if (dot != FT(0)) + return length / dot; + else + return FT(0); // undefined +} + +// Computes distance between two 3D points. +template +typename GeomTraits::FT distance_3(const GeomTraits& traits, + const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q) +{ + using Get_sqrt = Get_sqrt; + const auto sqrt = Get_sqrt::sqrt_object(traits); + + const auto squared_distance_3 = traits.compute_squared_distance_3_object(); + return sqrt(squared_distance_3(p, q)); +} + +template +typename GeomTraits::FT length_3(const GeomTraits& traits, + const typename GeomTraits::Vector_3& v) +{ + using Get_sqrt = Get_sqrt; + const auto sqrt = Get_sqrt::sqrt_object(traits); + + const auto squared_length_3 = traits.compute_squared_length_3_object(); + return sqrt(squared_length_3(v)); +} + +template +void normalize_3(const GeomTraits& traits, + typename GeomTraits::Vector_3& v) +{ + using FT = typename GeomTraits::FT; + + const FT length = length_3(traits, v); + CGAL_assertion(length != FT(0)); + if (length == FT(0)) + return; + + v /= length; +} + +template +typename GeomTraits::FT cotangent_3(const GeomTraits& traits, + const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r) +{ + using FT = typename GeomTraits::FT; + const auto dot_product_3 = traits.compute_scalar_product_3_object(); + const auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + const auto construct_vector_3 = traits.construct_vector_3_object(); + + const auto v1 = construct_vector_3(q, r); + const auto v2 = construct_vector_3(q, p); + + const FT dot = dot_product_3(v1, v2); + const auto cross = cross_product_3(v1, v2); + + const FT length = length_3(traits, cross); + // TODO: + // Not really necessary: since we handle case length = 0. Does this case happen? + // Yes, e.g. in Surface Parameterization tests. Does it affect the results? + // In current applications, not really. + // CGAL_assertion(length != FT(0)); + if (length != FT(0)) + return dot / length; + else + return FT(0); // undefined +} + +// Computes tanget between two 3D vectors. +template +typename GeomTraits::FT tangent_3(const GeomTraits& traits, + const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r) +{ + using FT = typename GeomTraits::FT; + const auto dot_product_3 = traits.compute_scalar_product_3_object(); + const auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + const auto construct_vector_3 = traits.construct_vector_3_object(); + + const auto v1 = construct_vector_3(q, r); + const auto v2 = construct_vector_3(q, p); + + const FT dot = dot_product_3(v1, v2); + const auto cross = cross_product_3(v1, v2); + + const FT length = length_3(traits, cross); + // CGAL_assertion(dot != FT(0)); not really necessary + if (dot != FT(0)) + return length / dot; + else + return FT(0); // undefined +} + +// Computes 3D angle between two vectors. +template +double angle_3(const GeomTraits& traits, + const typename GeomTraits::Vector_3& v1, + const typename GeomTraits::Vector_3& v2) +{ + const auto dot_product_3 = traits.compute_scalar_product_3_object(); + const double dot = CGAL::to_double(dot_product_3(v1, v2)); + + double angle_rad = 0.0; + if (dot < -1.0) + angle_rad = std::acos(-1.0); + else if (dot > 1.0) + angle_rad = std::acos(+1.0); + else + angle_rad = std::acos(dot); + + return angle_rad; +} + +// Rotates a 3D point around axis. +template +typename GeomTraits::Point_3 rotate_point_3(const GeomTraits&, + const double angle_rad, + const typename GeomTraits::Vector_3& axis, + const typename GeomTraits::Point_3& query) +{ + using FT = typename GeomTraits::FT; + using Point_3 = typename GeomTraits::Point_3; + + const FT c = static_cast(std::cos(angle_rad)); + const FT s = static_cast(std::sin(angle_rad)); + const FT C = FT(1) - c; + + const auto x = axis.x(); + const auto y = axis.y(); + const auto z = axis.z(); + + return Point_3( + (x * x * C + c) * query.x() + + (x * y * C - z * s) * query.y() + + (x * z * C + y * s) * query.z(), + (y * x * C + z * s) * query.x() + + (y * y * C + c) * query.y() + + (y * z * C - x * s) * query.z(), + (z * x * C - y * s) * query.x() + + (z * y * C + x * s) * query.y() + + (z * z * C + c) * query.z()); +} + +// Computes two 3D orthogonal base vectors wrt a given normal. +template +void orthogonal_bases_3(const GeomTraits& traits, + const typename GeomTraits::Vector_3& normal, + typename GeomTraits::Vector_3& b1, + typename GeomTraits::Vector_3& b2) +{ + using Vector_3 = typename GeomTraits::Vector_3; + const auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + + const auto nx = normal.x(); + const auto ny = normal.y(); + const auto nz = normal.z(); + + if (CGAL::abs(nz) >= CGAL::abs(ny)) + b1 = Vector_3(nz, 0, -nx); + else + b1 = Vector_3(ny, -nx, 0); + + b2 = cross_product_3(normal, b1); + + normalize_3(traits, b1); + normalize_3(traits, b2); +} + +// Converts a 3D point into a 2D point wrt to a given plane. +template +typename GeomTraits::Point_2 to_2d(const GeomTraits& traits, + const typename GeomTraits::Vector_3& b1, + const typename GeomTraits::Vector_3& b2, + const typename GeomTraits::Point_3& origin, + const typename GeomTraits::Point_3& query) +{ + using Point_2 = typename GeomTraits::Point_2; + const auto dot_product_3 = traits.compute_scalar_product_3_object(); + const auto construct_vector_3 = traits.construct_vector_3_object(); + + const auto v = construct_vector_3(origin, query); + const auto x = dot_product_3(b1, v); + const auto y = dot_product_3(b2, v); + + return Point_2(x, y); +} + +// Flattening. + +// \cgalFigureBegin{flattening, flattening.svg} +// The non-planar configuration (top) is flattened to the planar configuration (bottom). +// \cgalFigureEnd + +// When computing weights for a query point \f$q\f$ with respect to its neighbors +// \f$p_0\f$, \f$p_1\f$, and \f$p_2\f$, the local configuration is a quadrilateral +// [\f$p_0\f$, \f$p_1\f$, \f$p_2\f$, \f$q\f$] or two connected triangles [\f$q\f$, \f$p_0\f$, \f$p_1\f$] +// and [\f$q\f$, \f$p_1\f$, \f$p_2\f$]. When working in 3D, these triangles are not +// necessarily coplanar, in other words, they do not belong to the same common plane. +// When they are not coplanar, they can be made coplanar through the process called *flattening* (see the Figure above), +// however the latter introduces a distortion because the weights are computed with respect to the +// flattened configuration rather than to the original non-flat configuration. + +// \subsection Weights_Examples_ProjectionTraits Computing 2D Weights in 3D + +// If you have a 2D polygon in 3D plane that is not an XY plane, you can still compute +// the 2D weights, however you need to provide a special projection traits class. +// The common plane that is used in this example is projectable to the XY plane. We first +// compute `Mean_value_weights_2` for a 3D polygon in this plane. We then also show how to use +// the projection traits to compute the \ref PkgWeightsRefWachspressWeights "2D Wachspress weight" +// for 3D points which are not strictly coplanar. + +// \cgalExample{Weights/projection_traits.cpp} + +// Example of flattening: + +// 3D configuration. +// const Point_3 p0(0, 1, 1); +// const Point_3 p1(2, 0, 1); +// const Point_3 p2(7, 1, 1); +// const Point_3 q0(3, 1, 1); + +// Choose a type of the weight: +// e.g. 0 - Wachspress (WP) weight. +// const FT wp = FT(0); + +// Compute WP weights for q1 which is not on the plane [p0, p1, p2]. + +// Point_3 q1(3, 1, 2); +// std::cout << "3D wachspress (WP, q1): "; +// std::cout << CGAL::Weights::three_point_family_weight(p0, p1, p2, q1, wp) << std::endl; + +// Converge q1 towards q0 that is we flatten the configuration. +// We also compare the result with the authalic weight. + +// std::cout << "Converge q1 to q0: " << std::endl; +// for (FT x = FT(0); x <= FT(1); x += step) { +// std::cout << "3D wachspress/authalic: "; +// q1 = Point_3(3, 1, FT(2) - x); +// std::cout << CGAL::Weights::three_point_family_weight(p0, p1, p2, q1, wp) << "/"; +// std::cout << CGAL::Weights::authalic_weight(p0, p1, p2, q1) << std::endl; +// } + +// Flattens an arbitrary quad into a planar quad. +template +void flatten(const GeomTraits& traits, + const typename GeomTraits::Point_3& t, // prev neighbor/vertex/point + const typename GeomTraits::Point_3& r, // curr neighbor/vertex/point + const typename GeomTraits::Point_3& p, // next neighbor/vertex/point + const typename GeomTraits::Point_3& q, // query point + typename GeomTraits::Point_2& tf, + typename GeomTraits::Point_2& rf, + typename GeomTraits::Point_2& pf, + typename GeomTraits::Point_2& qf) +{ + // std::cout << std::endl; + using Point_3 = typename GeomTraits::Point_3; + using Vector_3 = typename GeomTraits::Vector_3; + + const auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + const auto construct_vector_3 = traits.construct_vector_3_object(); + const auto centroid_3 = traits.construct_centroid_3_object(); + + // Compute centroid. + const auto center = centroid_3(t, r, p, q); + // std::cout << "centroid: " << center << std::endl; + + // Translate. + const Point_3 t1 = Point_3(t.x() - center.x(), t.y() - center.y(), t.z() - center.z()); + const Point_3 r1 = Point_3(r.x() - center.x(), r.y() - center.y(), r.z() - center.z()); + const Point_3 p1 = Point_3(p.x() - center.x(), p.y() - center.y(), p.z() - center.z()); + const Point_3 q1 = Point_3(q.x() - center.x(), q.y() - center.y(), q.z() - center.z()); + + // std::cout << "translated t1: " << t1 << std::endl; + // std::cout << "translated r1: " << r1 << std::endl; + // std::cout << "translated p1: " << p1 << std::endl; + // std::cout << "translated q1: " << q1 << std::endl; + + // Middle axis. + auto ax = construct_vector_3(q1, r1); + normalize_3(traits, ax); + + // Prev and next vectors. + auto v1 = construct_vector_3(q1, t1); + auto v2 = construct_vector_3(q1, p1); + + normalize_3(traits, v1); + normalize_3(traits, v2); + + // Two triangle normals. + auto n1 = cross_product_3(v1, ax); + auto n2 = cross_product_3(ax, v2); + + normalize_3(traits, n1); + normalize_3(traits, n2); + + // std::cout << "normal n1: " << n1 << std::endl; + // std::cout << "normal n2: " << n2 << std::endl; + + // Angle between two normals. + const double angle_rad = angle_3(traits, n1, n2); + // std::cout << "angle deg n1 <-> n2: " << angle_rad * 180.0 / CGAL_PI << std::endl; + + // Rotate p1 around ax so that it lands onto the plane [q1, t1, r1]. + const auto& t2 = t1; + const auto& r2 = r1; + const auto p2 = rotate_point_3(traits, angle_rad, ax, p1); + const auto& q2 = q1; + // std::cout << "rotated p2: " << p2 << std::endl; + + // Compute orthogonal base vectors. + Vector_3 b1, b2; + const auto& normal = n1; + orthogonal_bases_3(traits, normal, b1, b2); + + // const auto angle12 = angle_3(traits, b1, b2); + // std::cout << "angle deg b1 <-> b2: " << angle12 * 180.0 / CGAL_PI << std::endl; + + // Flatten a quad. + const auto& origin = q2; + tf = to_2d(traits, b1, b2, origin, t2); + rf = to_2d(traits, b1, b2, origin, r2); + pf = to_2d(traits, b1, b2, origin, p2); + qf = to_2d(traits, b1, b2, origin, q2); + + // std::cout << "flattened qf: " << qf << std::endl; + // std::cout << "flattened tf: " << tf << std::endl; + // std::cout << "flattened rf: " << rf << std::endl; + // std::cout << "flattened pf: " << pf << std::endl; + + // std::cout << "A1: " << area_2(traits, rf, qf, pf) << std::endl; + // std::cout << "A2: " << area_2(traits, pf, qf, rf) << std::endl; + // std::cout << "C: " << area_2(traits, tf, rf, pf) << std::endl; + // std::cout << "B: " << area_2(traits, pf, qf, tf) << std::endl; +} + +// Computes area of a 2D triangle. +template +typename GeomTraits::FT area_2(const GeomTraits& traits, + const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r) +{ + const auto area_2 = traits.compute_area_2_object(); + return area_2(p, q, r); +} + +// Computes positive area of a 2D triangle. +template +typename GeomTraits::FT positive_area_2(const GeomTraits& traits, + const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r) +{ + return CGAL::abs(area_2(traits, p, q, r)); +} + +// Computes area of a 3D triangle. +template +typename GeomTraits::FT area_3(const GeomTraits& traits, + const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r) +{ + using FT = typename GeomTraits::FT; + using Point_3 = typename GeomTraits::Point_3; + using Vector_3 = typename GeomTraits::Vector_3; + + const auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + const auto construct_vector_3 = traits.construct_vector_3_object(); + const auto centroid_3 = traits.construct_centroid_3_object(); + + // Compute centroid. + const auto center = centroid_3(p, q, r); + + // Translate. + const Point_3 a = Point_3(p.x() - center.x(), p.y() - center.y(), p.z() - center.z()); + const Point_3 b = Point_3(q.x() - center.x(), q.y() - center.y(), q.z() - center.z()); + const Point_3 c = Point_3(r.x() - center.x(), r.y() - center.y(), r.z() - center.z()); + + // Prev and next vectors. + auto v1 = construct_vector_3(b, a); + auto v2 = construct_vector_3(b, c); + normalize_3(traits, v1); + normalize_3(traits, v2); + + // Compute normal. + auto normal = cross_product_3(v1, v2); + normalize_3(traits, normal); + + // Compute orthogonal base vectors. + Vector_3 b1, b2; + orthogonal_bases_3(traits, normal, b1, b2); + + // Compute area. + const auto& origin = b; + const auto pf = to_2d(traits, b1, b2, origin, a); + const auto qf = to_2d(traits, b1, b2, origin, b); + const auto rf = to_2d(traits, b1, b2, origin, c); + + const FT A = area_2(traits, pf, qf, rf); + return A; +} + +// Computes positive area of a 3D triangle. +template +typename GeomTraits::FT positive_area_3(const GeomTraits& traits, + const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r) +{ + using FT = typename GeomTraits::FT; + + const auto construct_vector_3 = traits.construct_vector_3_object(); + const auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + + const auto v1 = construct_vector_3(q, r); + const auto v2 = construct_vector_3(q, p); + + const auto cross = cross_product_3(v1, v2); + const FT half = FT(1) / FT(2); + const FT A = half * length_3(traits, cross); + return A; +} + +// Computes a clamped cotangent between two 3D vectors. +// In the old version of weights in PMP, it has been called secure. +// See Weights/internal/pmp_weights_deprecated.h for more information. +template +typename GeomTraits::FT cotangent_3_clamped(const GeomTraits& traits, + const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r) +{ + using FT = typename GeomTraits::FT; + using Get_sqrt = Get_sqrt; + const auto sqrt = Get_sqrt::sqrt_object(traits); + + const auto dot_product_3 = traits.compute_scalar_product_3_object(); + const auto construct_vector_3 = traits.construct_vector_3_object(); + + const auto v1 = construct_vector_3(q, r); + const auto v2 = construct_vector_3(q, p); + + const FT dot = dot_product_3(v1, v2); + const FT length_v1 = length_3(traits, v1); + const FT length_v2 = length_3(traits, v2); + + const FT lb = -FT(999) / FT(1000), ub = FT(999) / FT(1000); + FT cosine = dot / length_v1 / length_v2; + cosine = (cosine < lb) ? lb : cosine; + cosine = (cosine > ub) ? ub : cosine; + const FT sine = sqrt(FT(1) - cosine * cosine); + + CGAL_assertion(sine != FT(0)); + if (sine != FT(0)) + return cosine / sine; + + return FT(0); // undefined +} } // namespace internal } // namespace Weights diff --git a/Weights/include/CGAL/Weights/inverse_distance_weights.h b/Weights/include/CGAL/Weights/inverse_distance_weights.h index 39dd22a189b..28fec763c5e 100644 --- a/Weights/include/CGAL/Weights/inverse_distance_weights.h +++ b/Weights/include/CGAL/Weights/inverse_distance_weights.h @@ -14,219 +14,215 @@ #ifndef CGAL_INVERSE_DISTANCE_WEIGHTS_H #define CGAL_INVERSE_DISTANCE_WEIGHTS_H -// Internal includes. #include namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace inverse_distance_ns { +/// \cond SKIP_IN_MANUAL +namespace inverse_distance_ns { - template - FT weight(const FT d) { +template +FT weight(const FT d) +{ + FT w = FT(0); + CGAL_precondition(d != FT(0)); + if (d != FT(0)) + w = FT(1) / d; - FT w = FT(0); - CGAL_precondition(d != FT(0)); - if (d != FT(0)) { - w = FT(1) / d; - } - return w; - } - } - /// \endcond + return w; +} - #if defined(DOXYGEN_RUNNING) +} // namespace inverse_distance_ns - /*! +/// \endcond + +#if defined(DOXYGEN_RUNNING) + +/*! \ingroup PkgWeightsRefInverseDistanceWeights \brief computes the inverse distance weight in 2D using the points `p` and `q`, given a traits class `traits` with geometric objects, predicates, and constructions. */ - template - typename GeomTraits::FT inverse_distance_weight( +template +typename GeomTraits::FT inverse_distance_weight( const typename GeomTraits::Point_2&, const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2&, const typename GeomTraits::Point_2& q, const GeomTraits& traits) { } - /*! +/*! \ingroup PkgWeightsRefInverseDistanceWeights \brief computes the inverse distance weight in 3D using the points `p` and `q`, given a traits class `traits` with geometric objects, predicates, and constructions. */ - template - typename GeomTraits::FT inverse_distance_weight( +template +typename GeomTraits::FT inverse_distance_weight( const typename GeomTraits::Point_3&, const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3&, const typename GeomTraits::Point_3& q, const GeomTraits& traits) { } - /*! +/*! \ingroup PkgWeightsRefInverseDistanceWeights \brief computes the inverse distance weight in 2D using the points `p` and `q`, which are parameterized by a `Kernel` K. */ - template - typename K::FT inverse_distance_weight( +template +typename K::FT inverse_distance_weight( const CGAL::Point_2&, const CGAL::Point_2& p, const CGAL::Point_2&, const CGAL::Point_2& q) { } - /*! +/*! \ingroup PkgWeightsRefInverseDistanceWeights \brief computes the inverse distance weight in 3D using the points `p` and `q`, which are parameterized by a `Kernel` K. */ - template - typename K::FT inverse_distance_weight( +template +typename K::FT inverse_distance_weight( const CGAL::Point_3&, const CGAL::Point_3& p, const CGAL::Point_3&, const CGAL::Point_3& q) { } - /*! +/*! \ingroup PkgWeightsRefInverseDistanceWeights \brief computes the inverse distance weight in 2D using the points `p` and `q`, given a traits class `traits` with geometric objects, predicates, and constructions. */ - template - typename GeomTraits::FT inverse_distance_weight( +template +typename GeomTraits::FT inverse_distance_weight( const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2& q, const GeomTraits& traits) { } - /*! +/*! \ingroup PkgWeightsRefInverseDistanceWeights \brief computes the inverse distance weight in 3D using the points `p` and `q`, given a traits class `traits` with geometric objects, predicates, and constructions. */ - template - typename GeomTraits::FT inverse_distance_weight( +template +typename GeomTraits::FT inverse_distance_weight( const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& q, const GeomTraits& traits) { } - /*! +/*! \ingroup PkgWeightsRefInverseDistanceWeights \brief computes the inverse distance weight in 2D using the points `p` and `q`, which are parameterized by a `Kernel` K. */ - template - typename K::FT inverse_distance_weight( +template +typename K::FT inverse_distance_weight( const CGAL::Point_2& p, const CGAL::Point_2& q) { } - /*! +/*! \ingroup PkgWeightsRefInverseDistanceWeights \brief computes the inverse distance weight in 3D using the points `p` and `q`, which are parameterized by a `Kernel` K. */ - template - typename K::FT inverse_distance_weight( +template +typename K::FT inverse_distance_weight( const CGAL::Point_3& p, const CGAL::Point_3& q) { } - #endif // DOXYGEN_RUNNING +#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT inverse_distance_weight( - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { +/// \cond SKIP_IN_MANUAL +template +typename GeomTraits::FT inverse_distance_weight(const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2& r, + const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - using FT = typename GeomTraits::FT; - const FT d = internal::distance_2(traits, q, r); - return inverse_distance_ns::weight(d); - } + const FT d = internal::distance_2(traits, q, r); + return inverse_distance_ns::weight(d); +} - template - typename GeomTraits::FT inverse_distance_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) { +template +typename GeomTraits::FT inverse_distance_weight(const CGAL::Point_2& t, + const CGAL::Point_2& r, + const CGAL::Point_2& p, + const CGAL::Point_2& q) +{ + const GeomTraits traits; + return inverse_distance_weight(t, r, p, q, traits); +} - const GeomTraits traits; - return inverse_distance_weight(t, r, p, q, traits); - } +template +typename GeomTraits::FT inverse_distance_weight(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) +{ + typename GeomTraits::Point_2 stub; + return inverse_distance_weight(stub, p, stub, q, traits); +} - template - typename GeomTraits::FT inverse_distance_weight( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { +template +typename GeomTraits::FT inverse_distance_weight(const CGAL::Point_2& p, + const CGAL::Point_2& q) +{ + CGAL::Point_2 stub; + return inverse_distance_weight(stub, p, stub, q); +} - typename GeomTraits::Point_2 stub; - return inverse_distance_weight(stub, p, stub, q, traits); - } +template +typename GeomTraits::FT inverse_distance_weight(const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3& r, + const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - template - typename GeomTraits::FT inverse_distance_weight( - const CGAL::Point_2& p, - const CGAL::Point_2& q) { + const FT d = internal::distance_3(traits, q, r); + return inverse_distance_ns::weight(d); +} - CGAL::Point_2 stub; - return inverse_distance_weight(stub, p, stub, q); - } +template +typename GeomTraits::FT inverse_distance_weight(const CGAL::Point_3& t, + const CGAL::Point_3& r, + const CGAL::Point_3& p, + const CGAL::Point_3& q) +{ + const GeomTraits traits; + return inverse_distance_weight(t, r, p, q, traits); +} - template - typename GeomTraits::FT inverse_distance_weight( - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { +template +typename GeomTraits::FT inverse_distance_weight(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + typename GeomTraits::Point_3 stub; + return inverse_distance_weight(stub, p, stub, q, traits); +} - using FT = typename GeomTraits::FT; - const FT d = internal::distance_3(traits, q, r); - return inverse_distance_ns::weight(d); - } +template +typename GeomTraits::FT inverse_distance_weight(const CGAL::Point_3& p, + const CGAL::Point_3& q) +{ + CGAL::Point_3 stub; + return inverse_distance_weight(stub, p, stub, q); +} - template - typename GeomTraits::FT inverse_distance_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) { - - const GeomTraits traits; - return inverse_distance_weight(t, r, p, q, traits); - } - - template - typename GeomTraits::FT inverse_distance_weight( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { - - typename GeomTraits::Point_3 stub; - return inverse_distance_weight(stub, p, stub, q, traits); - } - - template - typename GeomTraits::FT inverse_distance_weight( - const CGAL::Point_3& p, - const CGAL::Point_3& q) { - - CGAL::Point_3 stub; - return inverse_distance_weight(stub, p, stub, q); - } - /// \endcond +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/mean_value_weights.h b/Weights/include/CGAL/Weights/mean_value_weights.h index 814ba883608..810294355ac 100644 --- a/Weights/include/CGAL/Weights/mean_value_weights.h +++ b/Weights/include/CGAL/Weights/mean_value_weights.h @@ -14,498 +14,466 @@ #ifndef CGAL_MEAN_VALUE_WEIGHTS_H #define CGAL_MEAN_VALUE_WEIGHTS_H -// Internal includes. #include #include namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace mean_value_ns { +/// \cond SKIP_IN_MANUAL +namespace mean_value_ns { - template - FT sign_of_weight(const FT A1, const FT A2, const FT B) { +template +FT sign_of_weight(const FT A1, const FT A2, const FT B) +{ + if (A1 > FT(0) && A2 > FT(0) && B <= FT(0)) + return +FT(1); - if (A1 > FT(0) && A2 > FT(0) && B <= FT(0)) { - return +FT(1); - } - if (A1 < FT(0) && A2 < FT(0) && B >= FT(0)) { - return -FT(1); - } - if (B > FT(0)) { - return +FT(1); - } - if (B < FT(0)) { - return -FT(1); - } - return FT(0); - } + if (A1 < FT(0) && A2 < FT(0) && B >= FT(0)) + return -FT(1); - template - typename GeomTraits::FT weight( - const GeomTraits& traits, - const typename GeomTraits::FT r1, - const typename GeomTraits::FT r2, - const typename GeomTraits::FT r3, - const typename GeomTraits::FT D1, - const typename GeomTraits::FT D2, - const typename GeomTraits::FT D, - const typename GeomTraits::FT sign) { + if (B > FT(0)) + return +FT(1); - using FT = typename GeomTraits::FT; - using Get_sqrt = internal::Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); + if (B < FT(0)) + return -FT(1); - const FT P1 = r1 * r2 + D1; - const FT P2 = r2 * r3 + D2; + return FT(0); +} - FT w = FT(0); - CGAL_precondition(P1 != FT(0) && P2 != FT(0)); - const FT prod = P1 * P2; - if (prod != FT(0)) { - const FT inv = FT(1) / prod; - w = FT(2) * (r1 * r3 - D) * inv; - CGAL_assertion(w >= FT(0)); - w = sqrt(w); - } - w *= FT(2); w *= sign; - return w; - } +template +typename GeomTraits::FT weight(const GeomTraits& traits, + const typename GeomTraits::FT r1, + const typename GeomTraits::FT r2, + const typename GeomTraits::FT r3, + const typename GeomTraits::FT D1, + const typename GeomTraits::FT D2, + const typename GeomTraits::FT D, + const typename GeomTraits::FT sign) +{ + using FT = typename GeomTraits::FT; + + using Get_sqrt = internal::Get_sqrt; + const auto sqrt = Get_sqrt::sqrt_object(traits); + + const FT P1 = r1 * r2 + D1; + const FT P2 = r2 * r3 + D2; + + FT w = FT(0); + CGAL_precondition(P1 != FT(0) && P2 != FT(0)); + const FT prod = P1 * P2; + if (prod != FT(0)) + { + const FT inv = FT(1) / prod; + w = FT(2) * (r1 * r3 - D) * inv; + CGAL_assertion(w >= FT(0)); + w = sqrt(w); } - /// \endcond - #if defined(DOXYGEN_RUNNING) + w *= FT(2); w *= sign; + return w; +} - /*! - \ingroup PkgWeightsRefMeanValueWeights +} // namespace mean_value_ns - \brief computes the mean value weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT mean_value_weight( +/// \endcond + +#if defined(DOXYGEN_RUNNING) + +/*! + \ingroup PkgWeightsRefMeanValueWeights + + \brief computes the mean value weight in 2D at `q` using the points `p0`, `p1`, + and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT mean_value_weight( const typename GeomTraits::Point_2& p0, const typename GeomTraits::Point_2& p1, const typename GeomTraits::Point_2& p2, const typename GeomTraits::Point_2& q, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefMeanValueWeights +/*! + \ingroup PkgWeightsRefMeanValueWeights - \brief computes the mean value weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT mean_value_weight( + \brief computes the mean value weight in 2D at `q` using the points `p0`, `p1`, + and `p2` which are parameterized by a `Kernel` K. +*/ +template +typename K::FT mean_value_weight( const CGAL::Point_2& p0, const CGAL::Point_2& p1, const CGAL::Point_2& p2, const CGAL::Point_2& q) { } - #endif // DOXYGEN_RUNNING +#endif // DOXYGEN_RUNNING + +/// \cond SKIP_IN_MANUAL +template +typename GeomTraits::FT mean_value_weight(const typename GeomTraits::Point_2& t, + const typename GeomTraits::Point_2& r, + const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + + const auto dot_product_2 = traits.compute_scalar_product_2_object(); + const auto construct_vector_2 = traits.construct_vector_2_object(); + + const auto v1 = construct_vector_2(q, t); + const auto v2 = construct_vector_2(q, r); + const auto v3 = construct_vector_2(q, p); + + const FT l1 = internal::length_2(traits, v1); + const FT l2 = internal::length_2(traits, v2); + const FT l3 = internal::length_2(traits, v3); + + const FT D1 = dot_product_2(v1, v2); + const FT D2 = dot_product_2(v2, v3); + const FT D = dot_product_2(v1, v3); + + const FT A1 = internal::area_2(traits, r, q, t); + const FT A2 = internal::area_2(traits, p, q, r); + const FT B = internal::area_2(traits, p, q, t); + + const FT sign = mean_value_ns::sign_of_weight(A1, A2, B); + return mean_value_ns::weight(traits, l1, l2, l3, D1, D2, D, sign); +} + +template +typename GeomTraits::FT mean_value_weight(const CGAL::Point_2& t, + const CGAL::Point_2& r, + const CGAL::Point_2& p, + const CGAL::Point_2& q) +{ + const GeomTraits traits; + return mean_value_weight(t, r, p, q, traits); +} + +namespace internal { + +template +typename GeomTraits::FT mean_value_weight(const typename GeomTraits::Point_3& t, + const typename GeomTraits::Point_3& r, + const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + using Point_2 = typename GeomTraits::Point_2; + Point_2 tf, rf, pf, qf; + internal::flatten(traits, + t, r, p, q, + tf, rf, pf, qf); + return CGAL::Weights::mean_value_weight(tf, rf, pf, qf, traits); +} + +template +typename GeomTraits::FT mean_value_weight(const CGAL::Point_3& t, + const CGAL::Point_3& r, + const CGAL::Point_3& p, + const CGAL::Point_3& q) +{ + const GeomTraits traits; + return mean_value_weight(t, r, p, q, traits); +} + +} // namespace internal + +/// \endcond + +/*! + \ingroup PkgWeightsRefBarycentricMeanValueWeights + + \brief 2D mean value weights for polygons. + + This class implements 2D mean value weights ( \cite cgal:bc:hf-mvcapp-06, + \cite cgal:bc:fhk-gcbcocp-06, \cite cgal:f-mvc-03 ) which can be computed + at any point inside and outside a simple polygon. + + Mean value weights are well-defined inside and outside a simple polygon and are + non-negative in the kernel of a star-shaped polygon. These weights are computed + analytically using the formulation from the `tangent_weight()`. + + \tparam VertexRange a model of `ConstRange` whose iterator type is `RandomAccessIterator` + \tparam GeomTraits a model of `AnalyticWeightTraits_2` + \tparam PointMap a model of `ReadablePropertyMap` whose key type is `VertexRange::value_type` and + value type is `Point_2`. The default is `CGAL::Identity_property_map`. + + \cgalModels `BarycentricWeights_2` +*/ +template > +class Mean_value_weights_2 +{ +public: + /// \name Types + /// @{ /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT mean_value_weight( - const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { - - using FT = typename GeomTraits::FT; - const auto dot_product_2 = - traits.compute_scalar_product_2_object(); - const auto construct_vector_2 = - traits.construct_vector_2_object(); - - const auto v1 = construct_vector_2(q, t); - const auto v2 = construct_vector_2(q, r); - const auto v3 = construct_vector_2(q, p); - - const FT l1 = internal::length_2(traits, v1); - const FT l2 = internal::length_2(traits, v2); - const FT l3 = internal::length_2(traits, v3); - - const FT D1 = dot_product_2(v1, v2); - const FT D2 = dot_product_2(v2, v3); - const FT D = dot_product_2(v1, v3); - - const FT A1 = internal::area_2(traits, r, q, t); - const FT A2 = internal::area_2(traits, p, q, r); - const FT B = internal::area_2(traits, p, q, t); - - const FT sign = mean_value_ns::sign_of_weight(A1, A2, B); - return mean_value_ns::weight( - traits, l1, l2, l3, D1, D2, D, sign); - } - - template - typename GeomTraits::FT mean_value_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) { - - const GeomTraits traits; - return mean_value_weight(t, r, p, q, traits); - } - - namespace internal { - - template - typename GeomTraits::FT mean_value_weight( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { - - using Point_2 = typename GeomTraits::Point_2; - Point_2 tf, rf, pf, qf; - internal::flatten( - traits, - t, r, p, q, - tf, rf, pf, qf); - return CGAL::Weights:: - mean_value_weight(tf, rf, pf, qf, traits); - } - - template - typename GeomTraits::FT mean_value_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) { - - const GeomTraits traits; - return mean_value_weight(t, r, p, q, traits); - } - - } // namespace internal + using Vertex_range = VertexRange; + using Geom_traits = GeomTraits; + using Point_map = PointMap; + using Vector_2 = typename GeomTraits::Vector_2; + using Area_2 = typename GeomTraits::Compute_area_2; + using Construct_vector_2 = typename GeomTraits::Construct_vector_2; + using Squared_length_2 = typename GeomTraits::Compute_squared_length_2; + using Scalar_product_2 = typename GeomTraits::Compute_scalar_product_2; + using Get_sqrt = internal::Get_sqrt; + using Sqrt = typename Get_sqrt::Sqrt; /// \endcond - /*! - \ingroup PkgWeightsRefBarycentricMeanValueWeights + /// Number type. + typedef typename GeomTraits::FT FT; - \brief 2D mean value weights for polygons. + /// Point type. + typedef typename GeomTraits::Point_2 Point_2; - This class implements 2D mean value weights ( \cite cgal:bc:hf-mvcapp-06, - \cite cgal:bc:fhk-gcbcocp-06, \cite cgal:f-mvc-03 ) which can be computed - at any point inside and outside a simple polygon. + /// @} - Mean value weights are well-defined inside and outside a simple polygon and are - non-negative in the kernel of a star-shaped polygon. These weights are computed - analytically using the formulation from the `tangent_weight()`. - - \tparam VertexRange - a model of `ConstRange` whose iterator type is `RandomAccessIterator` - - \tparam GeomTraits - a model of `AnalyticWeightTraits_2` - - \tparam PointMap - a model of `ReadablePropertyMap` whose key type is `VertexRange::value_type` and - value type is `Point_2`. The default is `CGAL::Identity_property_map`. - - \cgalModels `BarycentricWeights_2` - */ - template< - typename VertexRange, - typename GeomTraits, - typename PointMap = CGAL::Identity_property_map > - class Mean_value_weights_2 { - - public: - - /// \name Types - /// @{ - - /// \cond SKIP_IN_MANUAL - using Vertex_range = VertexRange; - using Geom_traits = GeomTraits; - using Point_map = PointMap; - - using Vector_2 = typename GeomTraits::Vector_2; - using Area_2 = typename GeomTraits::Compute_area_2; - using Construct_vector_2 = typename GeomTraits::Construct_vector_2; - using Squared_length_2 = typename GeomTraits::Compute_squared_length_2; - using Scalar_product_2 = typename GeomTraits::Compute_scalar_product_2; - using Get_sqrt = internal::Get_sqrt; - using Sqrt = typename Get_sqrt::Sqrt; - /// \endcond - - /// Number type. - typedef typename GeomTraits::FT FT; - - /// Point type. - typedef typename GeomTraits::Point_2 Point_2; - - /// @} - - /// \name Initialization - /// @{ - - /*! - \brief initializes all internal data structures. - - This class implements the behavior of mean value weights - for 2D query points inside simple polygons. - - \param polygon - an instance of `VertexRange` with the vertices of a simple polygon - - \param traits - a traits class with geometric objects, predicates, and constructions; - the default initialization is provided - - \param point_map - an instance of `PointMap` that maps a vertex from `polygon` to `Point_2`; - the default initialization is provided - - \pre polygon.size() >= 3 - \pre polygon is simple - */ - Mean_value_weights_2( - const VertexRange& polygon, - const GeomTraits traits = GeomTraits(), - const PointMap point_map = PointMap()) : - m_polygon(polygon), - m_traits(traits), - m_point_map(point_map), - m_area_2(m_traits.compute_area_2_object()), - m_construct_vector_2(m_traits.construct_vector_2_object()), - m_squared_length_2(m_traits.compute_squared_length_2_object()), - m_scalar_product_2(m_traits.compute_scalar_product_2_object()), - m_sqrt(Get_sqrt::sqrt_object(m_traits)) { - - CGAL_precondition( - polygon.size() >= 3); - CGAL_precondition( - internal::is_simple_2(polygon, traits, point_map)); - resize(); - } - - /// @} - - /// \name Access - /// @{ - - /*! - \brief computes 2D mean value weights. - - This function fills a destination range with 2D mean value weights computed at - the `query` point with respect to the vertices of the input polygon. - - The number of computed weights is equal to the number of polygon vertices. - - \tparam OutIterator - a model of `OutputIterator` whose value type is `FT` - - \param query - a query point - - \param w_begin - the beginning of the destination range with the computed weights - - \return an output iterator to the element in the destination range, - one past the last weight stored - */ - template - OutIterator operator()(const Point_2& query, OutIterator w_begin) { - const bool normalize = false; - return operator()(query, w_begin, normalize); - } - - /// @} - - /// \cond SKIP_IN_MANUAL - template - OutIterator operator()(const Point_2& query, OutIterator weights, const bool normalize) { - return optimal_weights(query, weights, normalize); - } - /// \endcond - - private: - - // Fields. - const VertexRange& m_polygon; - const GeomTraits m_traits; - const PointMap m_point_map; - - const Area_2 m_area_2; - const Construct_vector_2 m_construct_vector_2; - const Squared_length_2 m_squared_length_2; - const Scalar_product_2 m_scalar_product_2; - const Sqrt m_sqrt; - - std::vector s; - std::vector r; - std::vector A; - std::vector D; - std::vector t; - std::vector w; - - // Functions. - void resize() { - s.resize(m_polygon.size()); - r.resize(m_polygon.size()); - A.resize(m_polygon.size()); - D.resize(m_polygon.size()); - t.resize(m_polygon.size()); - w.resize(m_polygon.size()); - } - - template - OutputIterator optimal_weights( - const Point_2& query, OutputIterator weights, const bool normalize) { - - // Get the number of vertices in the polygon. - const std::size_t n = m_polygon.size(); - - // Compute vectors s following the pseudo-code in the Figure 10 from [1]. - for (std::size_t i = 0; i < n; ++i) { - const auto& pi = get(m_point_map, *(m_polygon.begin() + i)); - s[i] = m_construct_vector_2(query, pi); - } - - // Compute lengths r, areas A, and dot products D following the pseudo-code - // in the Figure 10 from [1]. Split the loop to make this computation faster. - const auto& p1 = get(m_point_map, *(m_polygon.begin() + 0)); - const auto& p2 = get(m_point_map, *(m_polygon.begin() + 1)); - - r[0] = m_sqrt(m_squared_length_2(s[0])); - A[0] = m_area_2(p1, p2, query); - D[0] = m_scalar_product_2(s[0], s[1]); - - for (std::size_t i = 1; i < n - 1; ++i) { - const auto& pi1 = get(m_point_map, *(m_polygon.begin() + (i + 0))); - const auto& pi2 = get(m_point_map, *(m_polygon.begin() + (i + 1))); - - r[i] = m_sqrt(m_squared_length_2(s[i])); - A[i] = m_area_2(pi1, pi2, query); - D[i] = m_scalar_product_2(s[i], s[i + 1]); - } - - const auto& pn = get(m_point_map, *(m_polygon.begin() + (n - 1))); - r[n - 1] = m_sqrt(m_squared_length_2(s[n - 1])); - A[n - 1] = m_area_2(pn, p1, query); - D[n - 1] = m_scalar_product_2(s[n - 1], s[0]); - - // Compute intermediate values t using the formulas from slide 19 here - // - http://www.inf.usi.ch/hormann/nsfworkshop/presentations/Hormann.pdf - for (std::size_t i = 0; i < n - 1; ++i) { - CGAL_assertion((r[i] * r[i + 1] + D[i]) != FT(0)); - t[i] = FT(2) * A[i] / (r[i] * r[i + 1] + D[i]); - } - - CGAL_assertion((r[n - 1] * r[0] + D[n - 1]) != FT(0)); - t[n - 1] = FT(2) * A[n - 1] / (r[n - 1] * r[0] + D[n - 1]); - - // Compute mean value weights using the same pseudo-code as before. - CGAL_assertion(r[0] != FT(0)); - w[0] = FT(2) * (t[n - 1] + t[0]) / r[0]; - - for (std::size_t i = 1; i < n - 1; ++i) { - CGAL_assertion(r[i] != FT(0)); - w[i] = FT(2) * (t[i - 1] + t[i]) / r[i]; - } - - CGAL_assertion(r[n - 1] != FT(0)); - w[n - 1] = FT(2) * (t[n - 2] + t[n - 1]) / r[n - 1]; - - // Normalize if necessary. - if (normalize) { - internal::normalize(w); - } - - // Return weights. - for (std::size_t i = 0; i < n; ++i) { - *(weights++) = w[i]; - } - return weights; - } - }; + /// \name Initialization + /// @{ /*! - \ingroup PkgWeightsRefBarycentricMeanValueWeights + \brief initializes all internal data structures. - \brief computes 2D mean value weights for polygons. + This class implements the behavior of mean value weights + for 2D query points inside simple polygons. - This function computes 2D mean value weights at a given `query` point - with respect to the vertices of a simple `polygon`, that is one - weight per vertex. The weights are stored in a destination range - beginning at `w_begin`. - - Internally, the class `Mean_value_weights_2` is used. If one wants to process - multiple query points, it is better to use that class. When using the free function, - internal memory is allocated for each query point, while when using the class, - it is allocated only once which is much more efficient. However, for a few query - points, it is easier to use this function. It can also be used when the processing - time is not a concern. - - \tparam PointRange - a model of `ConstRange` whose iterator type is `RandomAccessIterator` - and value type is `GeomTraits::Point_2` - - \tparam OutIterator - a model of `OutputIterator` whose value type is `GeomTraits::FT` - - \tparam GeomTraits - a model of `AnalyticWeightTraits_2` - - \param polygon - an instance of `PointRange` with 2D points which form a simple polygon - - \param query - a query point - - \param w_begin - the beginning of the destination range with the computed weights - - \param traits - a traits class with geometric objects, predicates, and constructions; - this parameter can be omitted if the traits class can be deduced from the point type - - \return an output iterator to the element in the destination range, - one past the last weight stored + \param polygon an instance of `VertexRange` with the vertices of a simple polygon + \param traits a traits class with geometric objects, predicates, and constructions; + the default initialization is provided + \param point_map an instance of `PointMap` that maps a vertex from `polygon` to `Point_2`; + the default initialization is provided \pre polygon.size() >= 3 \pre polygon is simple */ - template< - typename PointRange, - typename OutIterator, - typename GeomTraits> - OutIterator mean_value_weights_2( - const PointRange& polygon, const typename GeomTraits::Point_2& query, - OutIterator w_begin, const GeomTraits& traits) { - - Mean_value_weights_2 - mean_value(polygon, traits); - return mean_value(query, w_begin); + Mean_value_weights_2(const VertexRange& polygon, + const GeomTraits traits = GeomTraits(), + const PointMap point_map = PointMap()) + : m_polygon(polygon), + m_traits(traits), + m_point_map(point_map), + m_area_2(m_traits.compute_area_2_object()), + m_construct_vector_2(m_traits.construct_vector_2_object()), + m_squared_length_2(m_traits.compute_squared_length_2_object()), + m_scalar_product_2(m_traits.compute_scalar_product_2_object()), + m_sqrt(Get_sqrt::sqrt_object(m_traits)) + { + CGAL_precondition(polygon.size() >= 3); + CGAL_precondition(internal::is_simple_2(polygon, traits, point_map)); + resize(); } + /// @} + + /// \name Access + /// @{ + + /*! + \brief computes 2D mean value weights. + + This function fills a destination range with 2D mean value weights computed at + the `query` point with respect to the vertices of the input polygon. + + The number of computed weights is equal to the number of polygon vertices. + + \tparam OutIterator a model of `OutputIterator` whose value type is `FT` + + \param query a query point + \param w_begin the beginning of the destination range with the computed weights + + \return an output iterator to the element in the destination range, one past the last weight stored + */ + template + OutIterator operator()(const Point_2& query, OutIterator w_begin) + { + const bool normalize = false; + return operator()(query, w_begin, normalize); + } + + /// @} + /// \cond SKIP_IN_MANUAL - template< - typename PointRange, - typename OutIterator> - OutIterator mean_value_weights_2( - const PointRange& polygon, - const typename PointRange::value_type& query, - OutIterator w_begin) { - - using Point_2 = typename PointRange::value_type; - using GeomTraits = typename Kernel_traits::Kernel; - const GeomTraits traits; - return mean_value_weights_2( - polygon, query, w_begin, traits); + template + OutIterator operator()(const Point_2& query, + OutIterator weights, + const bool normalize) + { + return optimal_weights(query, weights, normalize); } + /// \endcond +private: + const VertexRange& m_polygon; + const GeomTraits m_traits; + const PointMap m_point_map; + + const Area_2 m_area_2; + const Construct_vector_2 m_construct_vector_2; + const Squared_length_2 m_squared_length_2; + const Scalar_product_2 m_scalar_product_2; + const Sqrt m_sqrt; + + std::vector s; + std::vector r; + std::vector A; + std::vector D; + std::vector t; + std::vector w; + + void resize() + { + s.resize(m_polygon.size()); + r.resize(m_polygon.size()); + A.resize(m_polygon.size()); + D.resize(m_polygon.size()); + t.resize(m_polygon.size()); + w.resize(m_polygon.size()); + } + + template + OutputIterator optimal_weights(const Point_2& query, + OutputIterator weights, + const bool normalize) + { + const std::size_t n = m_polygon.size(); + + // Compute vectors s following the pseudo-code in the Figure 10 from [1]. + for (std::size_t i = 0; i < n; ++i) + { + const auto& pi = get(m_point_map, *(m_polygon.begin() + i)); + s[i] = m_construct_vector_2(query, pi); + } + + // Compute lengths r, areas A, and dot products D following the pseudo-code + // in the Figure 10 from [1]. Split the loop to make this computation faster. + const auto& p1 = get(m_point_map, *(m_polygon.begin() + 0)); + const auto& p2 = get(m_point_map, *(m_polygon.begin() + 1)); + + r[0] = m_sqrt(m_squared_length_2(s[0])); + A[0] = m_area_2(p1, p2, query); + D[0] = m_scalar_product_2(s[0], s[1]); + + for (std::size_t i = 1; i < n - 1; ++i) + { + const auto& pi1 = get(m_point_map, *(m_polygon.begin() + (i + 0))); + const auto& pi2 = get(m_point_map, *(m_polygon.begin() + (i + 1))); + + r[i] = m_sqrt(m_squared_length_2(s[i])); + A[i] = m_area_2(pi1, pi2, query); + D[i] = m_scalar_product_2(s[i], s[i + 1]); + } + + const auto& pn = get(m_point_map, *(m_polygon.begin() + (n - 1))); + r[n - 1] = m_sqrt(m_squared_length_2(s[n - 1])); + A[n - 1] = m_area_2(pn, p1, query); + D[n - 1] = m_scalar_product_2(s[n - 1], s[0]); + + // Compute intermediate values t using the formulas from slide 19 here + // - http://www.inf.usi.ch/hormann/nsfworkshop/presentations/Hormann.pdf + for (std::size_t i = 0; i < n - 1; ++i) + { + CGAL_assertion((r[i] * r[i + 1] + D[i]) != FT(0)); + t[i] = FT(2) * A[i] / (r[i] * r[i + 1] + D[i]); + } + + CGAL_assertion((r[n - 1] * r[0] + D[n - 1]) != FT(0)); + t[n - 1] = FT(2) * A[n - 1] / (r[n - 1] * r[0] + D[n - 1]); + + // Compute mean value weights using the same pseudo-code as before. + CGAL_assertion(r[0] != FT(0)); + w[0] = FT(2) * (t[n - 1] + t[0]) / r[0]; + + for (std::size_t i = 1; i < n - 1; ++i) + { + CGAL_assertion(r[i] != FT(0)); + w[i] = FT(2) * (t[i - 1] + t[i]) / r[i]; + } + + CGAL_assertion(r[n - 1] != FT(0)); + w[n - 1] = FT(2) * (t[n - 2] + t[n - 1]) / r[n - 1]; + + // Normalize if necessary. + if (normalize) + internal::normalize(w); + + // Return weights. + for (std::size_t i = 0; i < n; ++i) + *(weights++) = w[i]; + + return weights; + } +}; + +/*! + \ingroup PkgWeightsRefBarycentricMeanValueWeights + + \brief computes 2D mean value weights for polygons. + + This function computes 2D mean value weights at a given `query` point + with respect to the vertices of a simple `polygon`, that is one + weight per vertex. The weights are stored in a destination range + beginning at `w_begin`. + + Internally, the class `Mean_value_weights_2` is used. If one wants to process + multiple query points, it is better to use that class. When using the free function, + internal memory is allocated for each query point, while when using the class, + it is allocated only once which is much more efficient. However, for a few query + points, it is easier to use this function. It can also be used when the processing + time is not a concern. + + \tparam PointRange a model of `ConstRange` whose iterator type is `RandomAccessIterator` + and value type is `GeomTraits::Point_2` + \tparam OutIterator a model of `OutputIterator` whose value type is `GeomTraits::FT` + \tparam GeomTraits a model of `AnalyticWeightTraits_2` + + \param polygon an instance of `PointRange` with 2D points which form a simple polygon + \param query a query point + \param w_begin the beginning of the destination range with the computed weights + \param traits a traits class with geometric objects, predicates, and constructions; + this parameter can be omitted if the traits class can be deduced from the point type + + \return an output iterator to the element in the destination range, + one past the last weight stored + + \pre polygon.size() >= 3 + \pre polygon is simple +*/ +template +OutIterator mean_value_weights_2(const PointRange& polygon, + const typename GeomTraits::Point_2& query, + OutIterator w_begin, + const GeomTraits& traits) +{ + Mean_value_weights_2 mean_value(polygon, traits); + return mean_value(query, w_begin); +} + +/// \cond SKIP_IN_MANUAL + +template +OutIterator mean_value_weights_2(const PointRange& polygon, + const typename PointRange::value_type& query, + OutIterator w_begin) +{ + using Point_2 = typename PointRange::value_type; + using GeomTraits = typename Kernel_traits::Kernel; + + const GeomTraits traits; + return mean_value_weights_2(polygon, query, w_begin, traits); +} + +/// \endcond + } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h b/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h index 579e8efda77..0dafc0f198c 100644 --- a/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h +++ b/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h @@ -14,157 +14,147 @@ #ifndef CGAL_MIXED_VORONOI_REGION_WEIGHTS_H #define CGAL_MIXED_VORONOI_REGION_WEIGHTS_H -// Internal includes. #include namespace CGAL { namespace Weights { - #if defined(DOXYGEN_RUNNING) +#if defined(DOXYGEN_RUNNING) - /*! - \ingroup PkgWeightsRefMixedVoronoiRegionWeights +/*! + \ingroup PkgWeightsRefMixedVoronoiRegionWeights - \brief computes the area of the mixed Voronoi cell in 2D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT mixed_voronoi_area( + \brief computes the area of the mixed Voronoi cell in 2D using the points `p`, `q` + and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT mixed_voronoi_area( const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2& q, const typename GeomTraits::Point_2& r, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefMixedVoronoiRegionWeights +/*! + \ingroup PkgWeightsRefMixedVoronoiRegionWeights - \brief computes the area of the mixed Voronoi cell in 3D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT mixed_voronoi_area( + \brief computes the area of the mixed Voronoi cell in 3D using the points `p`, `q` + and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT mixed_voronoi_area( const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& q, const typename GeomTraits::Point_3& r, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefMixedVoronoiRegionWeights +/*! + \ingroup PkgWeightsRefMixedVoronoiRegionWeights - \brief computes the area of the mixed Voronoi cell in 2D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. - */ - template - typename K::FT mixed_voronoi_area( + \brief computes the area of the mixed Voronoi cell in 2D using the points `p`, `q` + and `r` which are parameterized by a `Kernel` K. +*/ +template +typename K::FT mixed_voronoi_area( const CGAL::Point_2& p, const CGAL::Point_2& q, const CGAL::Point_2& r) { } - /*! - \ingroup PkgWeightsRefMixedVoronoiRegionWeights +/*! + \ingroup PkgWeightsRefMixedVoronoiRegionWeights - \brief computes the area of the mixed Voronoi cell in 3D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. - */ - template - typename K::FT mixed_voronoi_area( + \brief computes the area of the mixed Voronoi cell in 3D using the points `p`, `q` + and `r` which are parameterized by a `Kernel` K. +*/ +template +typename K::FT mixed_voronoi_area( const CGAL::Point_3& p, const CGAL::Point_3& q, const CGAL::Point_3& r) { } - #endif // DOXYGEN_RUNNING +#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT mixed_voronoi_area( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { +/// \cond SKIP_IN_MANUAL +template +typename GeomTraits::FT mixed_voronoi_area(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Point_2 = typename GeomTraits::Point_2; - using FT = typename GeomTraits::FT; - using Point_2 = typename GeomTraits::Point_2; + const auto angle_2 = traits.angle_2_object(); + const auto midpoint_2 = traits.construct_midpoint_2_object(); + const auto circumcenter_2 = traits.construct_circumcenter_2_object(); - const auto angle_2 = - traits.angle_2_object(); - const auto a1 = angle_2(p, q, r); - const auto a2 = angle_2(q, r, p); - const auto a3 = angle_2(r, p, q); + const auto a1 = angle_2(p, q, r); + const auto a2 = angle_2(q, r, p); + const auto a3 = angle_2(r, p, q); - Point_2 center; - const auto midpoint_2 = - traits.construct_midpoint_2_object(); - if (a1 != CGAL::OBTUSE && a2 != CGAL::OBTUSE && a3 != CGAL::OBTUSE) { - const auto circumcenter_2 = - traits.construct_circumcenter_2_object(); - center = circumcenter_2(p, q, r); - } else { - center = midpoint_2(r, p); - } + Point_2 center; + if (a1 != CGAL::OBTUSE && a2 != CGAL::OBTUSE && a3 != CGAL::OBTUSE) + center = circumcenter_2(p, q, r); + else + center = midpoint_2(r, p); - const auto m1 = midpoint_2(q, r); - const auto m2 = midpoint_2(q, p); + const auto m1 = midpoint_2(q, r); + const auto m2 = midpoint_2(q, p); - const FT A1 = internal::positive_area_2(traits, q, m1, center); - const FT A2 = internal::positive_area_2(traits, q, center, m2); - return A1 + A2; - } + const FT A1 = internal::positive_area_2(traits, q, m1, center); + const FT A2 = internal::positive_area_2(traits, q, center, m2); + return A1 + A2; +} - template - typename GeomTraits::FT mixed_voronoi_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { +template +typename GeomTraits::FT mixed_voronoi_area(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const GeomTraits traits; + return mixed_voronoi_area(p, q, r, traits); +} - const GeomTraits traits; - return mixed_voronoi_area(p, q, r, traits); - } +template +typename GeomTraits::FT mixed_voronoi_area(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Point_3 = typename GeomTraits::Point_3; - template - typename GeomTraits::FT mixed_voronoi_area( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { + const auto angle_3 = traits.angle_3_object(); + const auto midpoint_3 = traits.construct_midpoint_3_object(); + const auto circumcenter_3 = traits.construct_circumcenter_3_object(); - using FT = typename GeomTraits::FT; - using Point_3 = typename GeomTraits::Point_3; + const auto a1 = angle_3(p, q, r); + const auto a2 = angle_3(q, r, p); + const auto a3 = angle_3(r, p, q); - const auto angle_3 = - traits.angle_3_object(); - const auto a1 = angle_3(p, q, r); - const auto a2 = angle_3(q, r, p); - const auto a3 = angle_3(r, p, q); + Point_3 center; + if (a1 != CGAL::OBTUSE && a2 != CGAL::OBTUSE && a3 != CGAL::OBTUSE) + center = circumcenter_3(p, q, r); + else + center = midpoint_3(r, p); - Point_3 center; - const auto midpoint_3 = - traits.construct_midpoint_3_object(); - if (a1 != CGAL::OBTUSE && a2 != CGAL::OBTUSE && a3 != CGAL::OBTUSE) { - const auto circumcenter_3 = - traits.construct_circumcenter_3_object(); - center = circumcenter_3(p, q, r); - } else { - center = midpoint_3(r, p); - } + const auto m1 = midpoint_3(q, r); + const auto m2 = midpoint_3(q, p); - const auto m1 = midpoint_3(q, r); - const auto m2 = midpoint_3(q, p); + const FT A1 = internal::positive_area_3(traits, q, m1, center); + const FT A2 = internal::positive_area_3(traits, q, center, m2); + return A1 + A2; +} - const FT A1 = internal::positive_area_3(traits, q, m1, center); - const FT A2 = internal::positive_area_3(traits, q, center, m2); - return A1 + A2; - } +template +typename GeomTraits::FT mixed_voronoi_area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const GeomTraits traits; + return mixed_voronoi_area(p, q, r, traits); +} - template - typename GeomTraits::FT mixed_voronoi_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { - - const GeomTraits traits; - return mixed_voronoi_area(p, q, r, traits); - } - /// \endcond +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/shepard_weights.h b/Weights/include/CGAL/Weights/shepard_weights.h index 0a9fb5f8494..00e21883d21 100644 --- a/Weights/include/CGAL/Weights/shepard_weights.h +++ b/Weights/include/CGAL/Weights/shepard_weights.h @@ -14,46 +14,49 @@ #ifndef CGAL_SHEPARD_WEIGHTS_H #define CGAL_SHEPARD_WEIGHTS_H -// Internal includes. #include namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace shepard_ns { +/// \cond SKIP_IN_MANUAL +namespace shepard_ns { - template - typename GeomTraits::FT weight( - const GeomTraits& traits, - const typename GeomTraits::FT d, - const typename GeomTraits::FT p) { +template +typename GeomTraits::FT weight(const GeomTraits& traits, + const typename GeomTraits::FT d, + const typename GeomTraits::FT p) +{ + using FT = typename GeomTraits::FT; - using FT = typename GeomTraits::FT; - FT w = FT(0); - CGAL_precondition(d != FT(0)); - if (d != FT(0)) { - FT denom = d; - if (p != FT(1)) { - denom = internal::power(traits, d, p); - } - w = FT(1) / denom; - } - return w; - } + FT w = FT(0); + CGAL_precondition(d != FT(0)); + if (d != FT(0)) + { + FT denom = d; + if (p != FT(1)) + denom = internal::power(traits, d, p); + + w = FT(1) / denom; } - /// \endcond - #if defined(DOXYGEN_RUNNING) + return w; +} - /*! - \ingroup PkgWeightsRefShepardWeights +} // namespace shepard_ns - \brief computes the Shepard weight in 2D using the points `p` and `q` and the power parameter `a`, - given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT shepard_weight( +/// \endcond + +#if defined(DOXYGEN_RUNNING) + +/*! + \ingroup PkgWeightsRefShepardWeights + + \brief computes the Shepard weight in 2D using the points `p` and `q` and the power parameter `a`, + given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT shepard_weight( const typename GeomTraits::Point_2&, const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2&, @@ -61,14 +64,14 @@ namespace Weights { const typename GeomTraits::FT a, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefShepardWeights +/*! + \ingroup PkgWeightsRefShepardWeights - \brief computes the Shepard weight in 3D using the points `p` and `q` and the power parameter `a`, - given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT shepard_weight( + \brief computes the Shepard weight in 3D using the points `p` and `q` and the power parameter `a`, + given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT shepard_weight( const typename GeomTraits::Point_3&, const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3&, @@ -76,189 +79,179 @@ namespace Weights { const typename GeomTraits::FT a, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefShepardWeights +/*! + \ingroup PkgWeightsRefShepardWeights - \brief computes the Shepard weight in 2D using the points `p` and `q`, - which are parameterized by a `Kernel` K, and the power parameter `a` which - can be omitted. - */ - template - typename K::FT shepard_weight( + \brief computes the Shepard weight in 2D using the points `p` and `q`, + which are parameterized by a `Kernel` K, and the power parameter `a` which + can be omitted. +*/ +template +typename K::FT shepard_weight( const CGAL::Point_2&, const CGAL::Point_2& p, const CGAL::Point_2&, const CGAL::Point_2& q, const typename K::FT a = typename K::FT(1)) { } - /*! - \ingroup PkgWeightsRefShepardWeights +/*! + \ingroup PkgWeightsRefShepardWeights - \brief computes the Shepard weight in 3D using the points `p` and `q`, - which are parameterized by a `Kernel` K, and the power parameter `a` which - can be omitted. - */ - template - typename K::FT shepard_weight( + \brief computes the Shepard weight in 3D using the points `p` and `q`, + which are parameterized by a `Kernel` K, and the power parameter `a` which + can be omitted. +*/ +template +typename K::FT shepard_weight( const CGAL::Point_3&, const CGAL::Point_3& p, const CGAL::Point_3&, const CGAL::Point_3& q, const typename K::FT a = typename K::FT(1)) { } - /*! - \ingroup PkgWeightsRefShepardWeights +/*! + \ingroup PkgWeightsRefShepardWeights - \brief computes the Shepard weight in 2D using the points `p` and `q` and the power parameter `a`, - given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT shepard_weight( + \brief computes the Shepard weight in 2D using the points `p` and `q` and the power parameter `a`, + given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT shepard_weight( const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2& q, const typename GeomTraits::FT a, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefShepardWeights +/*! + \ingroup PkgWeightsRefShepardWeights - \brief computes the Shepard weight in 3D using the points `p` and `q` and the power parameter `a`, - given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT shepard_weight( + \brief computes the Shepard weight in 3D using the points `p` and `q` and the power parameter `a`, + given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT shepard_weight( const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& q, const typename GeomTraits::FT a, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefShepardWeights +/*! + \ingroup PkgWeightsRefShepardWeights - \brief computes the Shepard weight in 2D using the points `p` and `q`, - which are parameterized by a `Kernel` K, and the power parameter `a` which - can be omitted. - */ - template - typename K::FT shepard_weight( + \brief computes the Shepard weight in 2D using the points `p` and `q`, + which are parameterized by a `Kernel` K, and the power parameter `a` which + can be omitted. +*/ +template +typename K::FT shepard_weight( const CGAL::Point_2& p, const CGAL::Point_2& q, const typename K::FT a = typename K::FT(1)) { } - /*! - \ingroup PkgWeightsRefShepardWeights +/*! + \ingroup PkgWeightsRefShepardWeights - \brief computes the Shepard weight in 3D using the points `p` and `q`, - which are parameterized by a `Kernel` K, and the power parameter `a` which - can be omitted. - */ - template - typename K::FT shepard_weight( + \brief computes the Shepard weight in 3D using the points `p` and `q`, + which are parameterized by a `Kernel` K, and the power parameter `a` which + can be omitted. +*/ +template +typename K::FT shepard_weight( const CGAL::Point_3& p, const CGAL::Point_3& q, const typename K::FT a = typename K::FT(1)) { } - #endif // DOXYGEN_RUNNING +#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT shepard_weight( - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { +/// \cond SKIP_IN_MANUAL +template +typename GeomTraits::FT shepard_weight(const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2& r, + const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::FT a, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - using FT = typename GeomTraits::FT; - const FT d = internal::distance_2(traits, q, r); - return shepard_ns::weight(traits, d, a); - } + const FT d = internal::distance_2(traits, q, r); + return shepard_ns::weight(traits, d, a); +} - template - typename GeomTraits::FT shepard_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const typename GeomTraits::FT a = - typename GeomTraits::FT(1)) { +template +typename GeomTraits::FT shepard_weight(const CGAL::Point_2& t, + const CGAL::Point_2& r, + const CGAL::Point_2& p, + const CGAL::Point_2& q, + const typename GeomTraits::FT a = typename GeomTraits::FT(1)) +{ + const GeomTraits traits; + return shepard_weight(t, r, p, q, a, traits); +} - const GeomTraits traits; - return shepard_weight(t, r, p, q, a, traits); - } +template +typename GeomTraits::FT shepard_weight(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::FT a, + const GeomTraits& traits) +{ + typename GeomTraits::Point_2 stub; + return shepard_weight(stub, p, stub, q, a, traits); +} - template - typename GeomTraits::FT shepard_weight( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { +template +typename GeomTraits::FT shepard_weight(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const typename GeomTraits::FT a = typename GeomTraits::FT(1)) +{ + CGAL::Point_2 stub; + return shepard_weight(stub, p, stub, q, a); +} - typename GeomTraits::Point_2 stub; - return shepard_weight(stub, p, stub, q, a, traits); - } +template +typename GeomTraits::FT shepard_weight(const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3& r, + const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::FT a, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + const FT d = internal::distance_3(traits, q, r); + return shepard_ns::weight(traits, d, a); +} - template - typename GeomTraits::FT shepard_weight( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const typename GeomTraits::FT a = - typename GeomTraits::FT(1)) { +template +typename GeomTraits::FT shepard_weight(const CGAL::Point_3& t, + const CGAL::Point_3& r, + const CGAL::Point_3& p, + const CGAL::Point_3& q, + const typename GeomTraits::FT a = typename GeomTraits::FT(1)) +{ + const GeomTraits traits; + return shepard_weight(t, r, p, q, a, traits); +} - CGAL::Point_2 stub; - return shepard_weight(stub, p, stub, q, a); - } +template +typename GeomTraits::FT shepard_weight(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::FT a, + const GeomTraits& traits) +{ + typename GeomTraits::Point_3 stub; + return shepard_weight(stub, p, stub, q, a, traits); +} - template - typename GeomTraits::FT shepard_weight( - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { +template +typename GeomTraits::FT shepard_weight(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const typename GeomTraits::FT a = typename GeomTraits::FT(1)) +{ + CGAL::Point_3 stub; + return shepard_weight(stub, p, stub, q, a); +} - using FT = typename GeomTraits::FT; - const FT d = internal::distance_3(traits, q, r); - return shepard_ns::weight(traits, d, a); - } - - template - typename GeomTraits::FT shepard_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const typename GeomTraits::FT a = - typename GeomTraits::FT(1)) { - - const GeomTraits traits; - return shepard_weight(t, r, p, q, a, traits); - } - - template - typename GeomTraits::FT shepard_weight( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { - - typename GeomTraits::Point_3 stub; - return shepard_weight(stub, p, stub, q, a, traits); - } - - template - typename GeomTraits::FT shepard_weight( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const typename GeomTraits::FT a = - typename GeomTraits::FT(1)) { - - CGAL::Point_3 stub; - return shepard_weight(stub, p, stub, q, a); - } - /// \endcond +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/tangent_weights.h b/Weights/include/CGAL/Weights/tangent_weights.h index da4c87d0fdd..399878326f7 100644 --- a/Weights/include/CGAL/Weights/tangent_weights.h +++ b/Weights/include/CGAL/Weights/tangent_weights.h @@ -20,489 +20,469 @@ namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace tangent_ns { +/// \cond SKIP_IN_MANUAL +namespace tangent_ns { - template - FT half_angle_tangent(const FT r, const FT d, const FT A, const FT D) { - - FT t = FT(0); - const FT P = r * d + D; - CGAL_precondition(P != FT(0)); - if (P != FT(0)) { - const FT inv = FT(2) / P; - t = A * inv; - } - return t; - } - - template - FT half_weight(const FT t, const FT r) { - - FT w = FT(0); - CGAL_precondition(r != FT(0)); - if (r != FT(0)) { - const FT inv = FT(2) / r; - w = t * inv; - } - return w; - } - - template - FT weight(const FT t1, const FT t2, const FT r) { - - FT w = FT(0); - CGAL_precondition(r != FT(0)); - if (r != FT(0)) { - const FT inv = FT(2) / r; - w = (t1 + t2) * inv; - } - return w; - } - - template - FT weight( - const FT d1, const FT r, const FT d2, - const FT A1, const FT A2, - const FT D1, const FT D2) { - - const FT P1 = d1 * r + D1; - const FT P2 = d2 * r + D2; - - FT w = FT(0); - CGAL_precondition(P1 != FT(0) && P2 != FT(0)); - if (P1 != FT(0) && P2 != FT(0)) { - const FT inv1 = FT(2) / P1; - const FT inv2 = FT(2) / P2; - const FT t1 = A1 * inv1; - const FT t2 = A2 * inv2; - w = weight(t1, t2, r); - } - return w; - } - - // This is positive case only. - // This version is based on the positive area. - // This version is more precise for all positive cases. - template - typename GeomTraits::FT tangent_weight_v1( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { - - using FT = typename GeomTraits::FT; - const auto dot_product_3 = - traits.compute_scalar_product_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); - - const auto v1 = construct_vector_3(q, t); - const auto v2 = construct_vector_3(q, r); - const auto v3 = construct_vector_3(q, p); - - const FT l1 = internal::length_3(traits, v1); - const FT l2 = internal::length_3(traits, v2); - const FT l3 = internal::length_3(traits, v3); - - const FT A1 = internal::positive_area_3(traits, r, q, t); - const FT A2 = internal::positive_area_3(traits, p, q, r); - - const FT D1 = dot_product_3(v1, v2); - const FT D2 = dot_product_3(v2, v3); - - return weight(l1, l2, l3, A1, A2, D1, D2); - } - - // This version handles both positive and negative cases. - // However, it is less precise. - template - typename GeomTraits::FT tangent_weight_v2( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { - - using FT = typename GeomTraits::FT; - const auto construct_vector_3 = - traits.construct_vector_3_object(); - - auto v1 = construct_vector_3(q, t); - auto v2 = construct_vector_3(q, r); - auto v3 = construct_vector_3(q, p); - - const FT l2 = internal::length_3(traits, v2); - - internal::normalize_3(traits, v1); - internal::normalize_3(traits, v2); - internal::normalize_3(traits, v3); - - const double ha_rad_1 = internal::angle_3(traits, v1, v2) / 2.0; - const double ha_rad_2 = internal::angle_3(traits, v2, v3) / 2.0; - const FT t1 = static_cast(std::tan(ha_rad_1)); - const FT t2 = static_cast(std::tan(ha_rad_2)); - - return weight(t1, t2, l2); - } - } - /// \endcond - - /*! - \ingroup PkgWeightsRefTangentWeights - - \brief computes the tangent of the half angle. - - This function computes the tangent of the half angle using the precomputed - distance, area, and dot product values. The returned value is - \f$\frac{2\textbf{A}}{\textbf{d}\textbf{l} + \textbf{D}}\f$. - - \tparam FT - a model of `FieldNumberType` - - \param d - the distance value - - \param l - the distance value - - \param A - the area value - - \param D - the dot product value - - \pre (d * l + D) != 0 - - \sa `half_tangent_weight()` - */ - template - FT tangent_half_angle(const FT d, const FT l, const FT A, const FT D) { - return tangent_ns::half_angle_tangent(d, l, A, D); +template +FT half_angle_tangent(const FT r, const FT d, const FT A, const FT D) +{ + FT t = FT(0); + const FT P = r * d + D; + CGAL_precondition(P != FT(0)); + if (P != FT(0)) + { + const FT inv = FT(2) / P; + t = A * inv; } - /*! - \ingroup PkgWeightsRefTangentWeights + return t; +} - \brief computes the half value of the tangent weight. - - This function constructs the half of the tangent weight using the precomputed - half angle tangent and distance values. The returned value is - \f$\frac{2\textbf{tan05}}{\textbf{d}}\f$. - - \tparam FT - a model of `FieldNumberType` - - \param tan05 - the half angle tangent value - - \param d - the distance value - - \pre d != 0 - - \sa `tangent_half_angle()` - \sa `tangent_weight()` - */ - template - FT half_tangent_weight(const FT tan05, const FT d) { - return tangent_ns::half_weight(tan05, d); +template +FT half_weight(const FT t, const FT r) +{ + FT w = FT(0); + CGAL_precondition(r != FT(0)); + if (r != FT(0)) + { + const FT inv = FT(2) / r; + w = t * inv; } - /*! - \ingroup PkgWeightsRefTangentWeights + return w; +} - \brief computes the half value of the tangent weight. - - This function constructs the half of the tangent weight using the precomputed - distance, area, and dot product values. The returned value is - \f$\frac{2\textbf{t}}{\textbf{d}}\f$ where - \f$\textbf{t} = \frac{2\textbf{A}}{\textbf{d}\textbf{l} + \textbf{D}}\f$. - - \tparam FT - a model of `FieldNumberType` - - \param d - the distance value - - \param l - the distance value - - \param A - the area value - - \param D - the dot product value - - \pre (d * l + D) != 0 && d != 0 - - \sa `tangent_weight()` - */ - template - FT half_tangent_weight(const FT d, const FT l, const FT A, const FT D) { - const FT tan05 = tangent_half_angle(d, l, A, D); - return half_tangent_weight(tan05, d); +template +FT weight(const FT t1, const FT t2, const FT r) +{ + FT w = FT(0); + CGAL_precondition(r != FT(0)); + if (r != FT(0)) + { + const FT inv = FT(2) / r; + w = (t1 + t2) * inv; } - #if defined(DOXYGEN_RUNNING) + return w; +} - /*! - \ingroup PkgWeightsRefTangentWeights +template +FT weight(const FT d1, const FT r, const FT d2, + const FT A1, const FT A2, + const FT D1, const FT D2) +{ + const FT P1 = d1 * r + D1; + const FT P2 = d2 * r + D2; - \brief computes the tangent weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT tangent_weight( + FT w = FT(0); + CGAL_precondition(P1 != FT(0) && P2 != FT(0)); + if (P1 != FT(0) && P2 != FT(0)) + { + const FT inv1 = FT(2) / P1; + const FT inv2 = FT(2) / P2; + const FT t1 = A1 * inv1; + const FT t2 = A2 * inv2; + w = weight(t1, t2, r); + } + + return w; +} + +// This is positive case only. +// This version is based on the positive area. +// This version is more precise for all positive cases. +template +typename GeomTraits::FT tangent_weight_v1(const typename GeomTraits::Point_3& t, + const typename GeomTraits::Point_3& r, + const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + + const auto dot_product_3 = traits.compute_scalar_product_3_object(); + const auto construct_vector_3 = traits.construct_vector_3_object(); + + const auto v1 = construct_vector_3(q, t); + const auto v2 = construct_vector_3(q, r); + const auto v3 = construct_vector_3(q, p); + + const FT l1 = internal::length_3(traits, v1); + const FT l2 = internal::length_3(traits, v2); + const FT l3 = internal::length_3(traits, v3); + + const FT A1 = internal::positive_area_3(traits, r, q, t); + const FT A2 = internal::positive_area_3(traits, p, q, r); + + const FT D1 = dot_product_3(v1, v2); + const FT D2 = dot_product_3(v2, v3); + + return weight(l1, l2, l3, A1, A2, D1, D2); +} + +// This version handles both positive and negative cases. +// However, it is less precise. +template +typename GeomTraits::FT tangent_weight_v2(const typename GeomTraits::Point_3& t, + const typename GeomTraits::Point_3& r, + const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + + const auto construct_vector_3 = traits.construct_vector_3_object(); + + auto v1 = construct_vector_3(q, t); + auto v2 = construct_vector_3(q, r); + auto v3 = construct_vector_3(q, p); + + const FT l2 = internal::length_3(traits, v2); + + internal::normalize_3(traits, v1); + internal::normalize_3(traits, v2); + internal::normalize_3(traits, v3); + + const double ha_rad_1 = internal::angle_3(traits, v1, v2) / 2.0; + const double ha_rad_2 = internal::angle_3(traits, v2, v3) / 2.0; + const FT t1 = static_cast(std::tan(ha_rad_1)); + const FT t2 = static_cast(std::tan(ha_rad_2)); + + return weight(t1, t2, l2); +} + +} // namespace tangent_ns + +/// \endcond + +/*! + \ingroup PkgWeightsRefTangentWeights + + \brief computes the tangent of the half angle. + + This function computes the tangent of the half angle using the precomputed + distance, area, and dot product values. The returned value is + \f$\frac{2\textbf{A}}{\textbf{d}\textbf{l} + \textbf{D}}\f$. + + \tparam FT a model of `FieldNumberType` + + \param d the distance value + \param l the distance value + \param A the area value + \param D the dot product value + + \pre (d * l + D) != 0 + + \sa `half_tangent_weight()` +*/ +template +FT tangent_half_angle(const FT d, const FT l, const FT A, const FT D) +{ + return tangent_ns::half_angle_tangent(d, l, A, D); +} + +/*! + \ingroup PkgWeightsRefTangentWeights + + \brief computes the half value of the tangent weight. + + This function constructs the half of the tangent weight using the precomputed + half angle tangent and distance values. The returned value is + \f$\frac{2\textbf{tan05}}{\textbf{d}}\f$. + + \tparam FT a model of `FieldNumberType` + + \param tan05 the half angle tangent value + \param d the distance value + + \pre d != 0 + + \sa `tangent_half_angle()` + \sa `tangent_weight()` +*/ +template +FT half_tangent_weight(const FT tan05, const FT d) +{ + return tangent_ns::half_weight(tan05, d); +} + +/*! + \ingroup PkgWeightsRefTangentWeights + + \brief computes the half value of the tangent weight. + + This function constructs the half of the tangent weight using the precomputed + distance, area, and dot product values. The returned value is + \f$\frac{2\textbf{t}}{\textbf{d}}\f$ where + \f$\textbf{t} = \frac{2\textbf{A}}{\textbf{d}\textbf{l} + \textbf{D}}\f$. + + \tparam FT a model of `FieldNumberType` + + \param d the distance value + \param l the distance value + \param A the area value + \param D the dot product value + + \pre (d * l + D) != 0 && d != 0 + + \sa `tangent_weight()` +*/ +template +FT half_tangent_weight(const FT d, const FT l, const FT A, const FT D) +{ + const FT tan05 = tangent_half_angle(d, l, A, D); + return half_tangent_weight(tan05, d); +} + +#if defined(DOXYGEN_RUNNING) + +/*! + \ingroup PkgWeightsRefTangentWeights + + \brief computes the tangent weight in 2D at `q` using the points `p0`, `p1`, + and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT tangent_weight( const typename GeomTraits::Point_2& p0, const typename GeomTraits::Point_2& p1, const typename GeomTraits::Point_2& p2, const typename GeomTraits::Point_2& q, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefTangentWeights +/*! + \ingroup PkgWeightsRefTangentWeights - \brief computes the tangent weight in 3D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT tangent_weight( + \brief computes the tangent weight in 3D at `q` using the points `p0`, `p1`, + and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT tangent_weight( const typename GeomTraits::Point_3& p0, const typename GeomTraits::Point_3& p1, const typename GeomTraits::Point_3& p2, const typename GeomTraits::Point_3& q, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefTangentWeights +/*! + \ingroup PkgWeightsRefTangentWeights - \brief computes the tangent weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT tangent_weight( + \brief computes the tangent weight in 2D at `q` using the points `p0`, `p1`, + and `p2` which are parameterized by a `Kernel` K. +*/ +template +typename K::FT tangent_weight( const CGAL::Point_2& p0, const CGAL::Point_2& p1, const CGAL::Point_2& p2, const CGAL::Point_2& q) { } - /*! - \ingroup PkgWeightsRefTangentWeights +/*! + \ingroup PkgWeightsRefTangentWeights - \brief computes the tangent weight in 3D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT tangent_weight( + \brief computes the tangent weight in 3D at `q` using the points `p0`, `p1`, + and `p2` which are parameterized by a `Kernel` K. +*/ +template +typename K::FT tangent_weight( const CGAL::Point_3& p0, const CGAL::Point_3& p1, const CGAL::Point_3& p2, const CGAL::Point_3& q) { } - #endif // DOXYGEN_RUNNING +#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT tangent_weight( - const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { +/// \cond SKIP_IN_MANUAL +template +typename GeomTraits::FT tangent_weight(const typename GeomTraits::Point_2& t, + const typename GeomTraits::Point_2& r, + const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + const auto dot_product_2 = traits.compute_scalar_product_2_object(); + const auto construct_vector_2 = traits.construct_vector_2_object(); - using FT = typename GeomTraits::FT; - const auto dot_product_2 = - traits.compute_scalar_product_2_object(); - const auto construct_vector_2 = - traits.construct_vector_2_object(); + const auto v1 = construct_vector_2(q, t); + const auto v2 = construct_vector_2(q, r); + const auto v3 = construct_vector_2(q, p); - const auto v1 = construct_vector_2(q, t); - const auto v2 = construct_vector_2(q, r); - const auto v3 = construct_vector_2(q, p); + const FT l1 = internal::length_2(traits, v1); + const FT l2 = internal::length_2(traits, v2); + const FT l3 = internal::length_2(traits, v3); - const FT l1 = internal::length_2(traits, v1); - const FT l2 = internal::length_2(traits, v2); - const FT l3 = internal::length_2(traits, v3); + const FT A1 = internal::area_2(traits, r, q, t); + const FT A2 = internal::area_2(traits, p, q, r); - const FT A1 = internal::area_2(traits, r, q, t); - const FT A2 = internal::area_2(traits, p, q, r); + const FT D1 = dot_product_2(v1, v2); + const FT D2 = dot_product_2(v2, v3); - const FT D1 = dot_product_2(v1, v2); - const FT D2 = dot_product_2(v2, v3); + return tangent_ns::weight(l1, l2, l3, A1, A2, D1, D2); +} - return tangent_ns::weight( - l1, l2, l3, A1, A2, D1, D2); +template +typename GeomTraits::FT tangent_weight(const CGAL::Point_2& t, + const CGAL::Point_2& r, + const CGAL::Point_2& p, + const CGAL::Point_2& q) +{ + const GeomTraits traits; + return tangent_weight(t, r, p, q, traits); +} + +template +typename GeomTraits::FT tangent_weight(const typename GeomTraits::Point_3& t, + const typename GeomTraits::Point_3& r, + const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + // return tangent_ns::tangent_weight_v1(t, r, p, q, traits); + return tangent_ns::tangent_weight_v2(t, r, p, q, traits); +} + +template +typename GeomTraits::FT tangent_weight(const CGAL::Point_3& t, + const CGAL::Point_3& r, + const CGAL::Point_3& p, + const CGAL::Point_3& q) +{ + const GeomTraits traits; + return tangent_weight(t, r, p, q, traits); +} + +// Undocumented tangent weight class. +// Its constructor takes a polygon mesh and a vertex to point map +// and its operator() is defined based on the halfedge_descriptor only. +// This version is currently used in: +// Surface_mesh_parameterizer -> Iterative_authalic_parameterizer_3.h +template::type> +class Edge_tangent_weight +{ + using GeomTraits = typename CGAL::Kernel_traits::value_type>::type; + using FT = typename GeomTraits::FT; + + const PolygonMesh& m_pmesh; + const VertexPointMap m_pmap; + const GeomTraits m_traits; + +public: + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; + + Edge_tangent_weight(const PolygonMesh& pmesh, const VertexPointMap pmap) + : m_pmesh(pmesh), m_pmap(pmap), m_traits() + { } + + FT operator()(const halfedge_descriptor he) const + { + FT weight = FT(0); + if (is_border_edge(he, m_pmesh)) + { + const auto h1 = next(he, m_pmesh); + + const auto v0 = target(he, m_pmesh); + const auto v1 = source(he, m_pmesh); + const auto v2 = target(h1, m_pmesh); + + const auto& p0 = get(m_pmap, v0); + const auto& p1 = get(m_pmap, v1); + const auto& p2 = get(m_pmap, v2); + + weight = internal::tangent_3(m_traits, p0, p2, p1); + } + else + { + const auto h1 = next(he, m_pmesh); + const auto h2 = prev(opposite(he, m_pmesh), m_pmesh); + + const auto v0 = target(he, m_pmesh); + const auto v1 = source(he, m_pmesh); + const auto v2 = target(h1, m_pmesh); + const auto v3 = source(h2, m_pmesh); + + const auto& p0 = get(m_pmap, v0); + const auto& p1 = get(m_pmap, v1); + const auto& p2 = get(m_pmap, v2); + const auto& p3 = get(m_pmap, v3); + + weight = tangent_weight(p2, p1, p3, p0) / FT(2); + } + return weight; } +}; +// Undocumented tangent weight class. +// Its constructor takes three points either in 2D or 3D. +// This version is currently used in: +// Surface_mesh_parameterizer -> MVC_post_processor_3.h +// Surface_mesh_parameterizer -> Orbifold_Tutte_parameterizer_3.h +template +class Tangent_weight { + FT m_d_r, m_d_p, m_w_base; + +public: template - typename GeomTraits::FT tangent_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) { - + Tangent_weight(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) + { const GeomTraits traits; - return tangent_weight(t, r, p, q, traits); + + const auto scalar_product_2 = traits.compute_scalar_product_2_object(); + const auto construct_vector_2 = traits.construct_vector_2_object(); + + m_d_r = internal::distance_2(traits, q, r); + CGAL_assertion(m_d_r != FT(0)); // two points are identical! + m_d_p = internal::distance_2(traits, q, p); + CGAL_assertion(m_d_p != FT(0)); // two points are identical! + + const auto v1 = construct_vector_2(q, r); + const auto v2 = construct_vector_2(q, p); + + const auto A = internal::positive_area_2(traits, p, q, r); + CGAL_assertion(A != FT(0)); // three points are identical! + const auto S = scalar_product_2(v1, v2); + m_w_base = -tangent_half_angle(m_d_r, m_d_p, A, S); } template - typename GeomTraits::FT tangent_weight( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { - - // return tangent_ns::tangent_weight_v1(t, r, p, q, traits); - return tangent_ns::tangent_weight_v2(t, r, p, q, traits); - } - - template - typename GeomTraits::FT tangent_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) { - + Tangent_weight(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) + { const GeomTraits traits; - return tangent_weight(t, r, p, q, traits); + const auto scalar_product_3 = traits.compute_scalar_product_3_object(); + const auto construct_vector_3 = traits.construct_vector_3_object(); + + m_d_r = internal::distance_3(traits, q, r); + CGAL_assertion(m_d_r != FT(0)); // two points are identical! + m_d_p = internal::distance_3(traits, q, p); + CGAL_assertion(m_d_p != FT(0)); // two points are identical! + + const auto v1 = construct_vector_3(q, r); + const auto v2 = construct_vector_3(q, p); + + const auto A = internal::positive_area_3(traits, p, q, r); + CGAL_assertion(A != FT(0)); // three points are identical! + const auto S = scalar_product_3(v1, v2); + m_w_base = -tangent_half_angle(m_d_r, m_d_p, A, S); } - // Undocumented tangent weight class. - // Its constructor takes a polygon mesh and a vertex to point map - // and its operator() is defined based on the halfedge_descriptor only. - // This version is currently used in: - // Surface_mesh_parameterizer -> Iterative_authalic_parameterizer_3.h - template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> - class Edge_tangent_weight { + FT get_w_r() const + { + return half_tangent_weight(m_w_base, m_d_r) / FT(2); + } - using GeomTraits = typename CGAL::Kernel_traits< - typename boost::property_traits::value_type>::type; - using FT = typename GeomTraits::FT; + FT get_w_p() const + { + return half_tangent_weight(m_w_base, m_d_p) / FT(2); + } +}; - const PolygonMesh& m_pmesh; - const VertexPointMap m_pmap; - const GeomTraits m_traits; - - public: - using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; - using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - - Edge_tangent_weight(const PolygonMesh& pmesh, const VertexPointMap pmap) : - m_pmesh(pmesh), m_pmap(pmap), m_traits() { } - - FT operator()(const halfedge_descriptor he) const { - - FT weight = FT(0); - if (is_border_edge(he, m_pmesh)) { - const auto h1 = next(he, m_pmesh); - - const auto v0 = target(he, m_pmesh); - const auto v1 = source(he, m_pmesh); - const auto v2 = target(h1, m_pmesh); - - const auto& p0 = get(m_pmap, v0); - const auto& p1 = get(m_pmap, v1); - const auto& p2 = get(m_pmap, v2); - - weight = internal::tangent_3(m_traits, p0, p2, p1); - - } else { - const auto h1 = next(he, m_pmesh); - const auto h2 = prev(opposite(he, m_pmesh), m_pmesh); - - const auto v0 = target(he, m_pmesh); - const auto v1 = source(he, m_pmesh); - const auto v2 = target(h1, m_pmesh); - const auto v3 = source(h2, m_pmesh); - - const auto& p0 = get(m_pmap, v0); - const auto& p1 = get(m_pmap, v1); - const auto& p2 = get(m_pmap, v2); - const auto& p3 = get(m_pmap, v3); - - weight = tangent_weight(p2, p1, p3, p0) / FT(2); - } - return weight; - } - }; - - // Undocumented tangent weight class. - // Its constructor takes three points either in 2D or 3D. - // This version is currently used in: - // Surface_mesh_parameterizer -> MVC_post_processor_3.h - // Surface_mesh_parameterizer -> Orbifold_Tutte_parameterizer_3.h - template - class Tangent_weight { - FT m_d_r, m_d_p, m_w_base; - - public: - template - Tangent_weight( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { - - const GeomTraits traits; - const auto scalar_product_2 = - traits.compute_scalar_product_2_object(); - const auto construct_vector_2 = - traits.construct_vector_2_object(); - - m_d_r = internal::distance_2(traits, q, r); - CGAL_assertion(m_d_r != FT(0)); // two points are identical! - m_d_p = internal::distance_2(traits, q, p); - CGAL_assertion(m_d_p != FT(0)); // two points are identical! - - const auto v1 = construct_vector_2(q, r); - const auto v2 = construct_vector_2(q, p); - - const auto A = internal::positive_area_2(traits, p, q, r); - CGAL_assertion(A != FT(0)); // three points are identical! - const auto S = scalar_product_2(v1, v2); - m_w_base = -tangent_half_angle(m_d_r, m_d_p, A, S); - } - - template - Tangent_weight( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { - - const GeomTraits traits; - const auto scalar_product_3 = - traits.compute_scalar_product_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); - - m_d_r = internal::distance_3(traits, q, r); - CGAL_assertion(m_d_r != FT(0)); // two points are identical! - m_d_p = internal::distance_3(traits, q, p); - CGAL_assertion(m_d_p != FT(0)); // two points are identical! - - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); - - const auto A = internal::positive_area_3(traits, p, q, r); - CGAL_assertion(A != FT(0)); // three points are identical! - const auto S = scalar_product_3(v1, v2); - m_w_base = -tangent_half_angle(m_d_r, m_d_p, A, S); - } - - FT get_w_r() const { - return half_tangent_weight(m_w_base, m_d_r) / FT(2); - } - - FT get_w_p() const { - return half_tangent_weight(m_w_base, m_d_p) / FT(2); - } - }; - - /// \endcond +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/three_point_family_weights.h b/Weights/include/CGAL/Weights/three_point_family_weights.h index eca32f1b281..ce7b0d978a0 100644 --- a/Weights/include/CGAL/Weights/three_point_family_weights.h +++ b/Weights/include/CGAL/Weights/three_point_family_weights.h @@ -14,58 +14,62 @@ #ifndef CGAL_THREE_POINT_FAMILY_WEIGHTS_H #define CGAL_THREE_POINT_FAMILY_WEIGHTS_H -// Internal includes. #include namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace three_point_family_ns { +/// \cond SKIP_IN_MANUAL +namespace three_point_family_ns { - template - typename GeomTraits::FT weight( - const GeomTraits& traits, - const typename GeomTraits::FT d1, - const typename GeomTraits::FT d2, - const typename GeomTraits::FT d3, - const typename GeomTraits::FT A1, - const typename GeomTraits::FT A2, - const typename GeomTraits::FT B, - const typename GeomTraits::FT p) { +template +typename GeomTraits::FT weight(const GeomTraits& traits, + const typename GeomTraits::FT d1, + const typename GeomTraits::FT d2, + const typename GeomTraits::FT d3, + const typename GeomTraits::FT A1, + const typename GeomTraits::FT A2, + const typename GeomTraits::FT B, + const typename GeomTraits::FT p) +{ + using FT = typename GeomTraits::FT; - using FT = typename GeomTraits::FT; - FT w = FT(0); - CGAL_precondition(A1 != FT(0) && A2 != FT(0)); - const FT prod = A1 * A2; - if (prod != FT(0)) { - const FT inv = FT(1) / prod; - FT r1 = d1; - FT r2 = d2; - FT r3 = d3; - if (p != FT(1)) { - r1 = internal::power(traits, d1, p); - r2 = internal::power(traits, d2, p); - r3 = internal::power(traits, d3, p); - } - w = (r3 * A1 - r2 * B + r1 * A2) * inv; - } - return w; + FT w = FT(0); + CGAL_precondition(A1 != FT(0) && A2 != FT(0)); + const FT prod = A1 * A2; + if (prod != FT(0)) + { + const FT inv = FT(1) / prod; + FT r1 = d1; + FT r2 = d2; + FT r3 = d3; + if (p != FT(1)) + { + r1 = internal::power(traits, d1, p); + r2 = internal::power(traits, d2, p); + r3 = internal::power(traits, d3, p); } + w = (r3 * A1 - r2 * B + r1 * A2) * inv; } - /// \endcond - #if defined(DOXYGEN_RUNNING) + return w; +} - /*! - \ingroup PkgWeightsRefThreePointFamilyWeights +} // namespace three_point_family_ns - \brief computes the three-point family weight in 2D at `q` using the points `p0`, `p1`, - and `p2` and the power parameter `a`, given a traits class `traits` with geometric objects, - predicates, and constructions. - */ - template - typename GeomTraits::FT three_point_family_weight( +/// \endcond + +#if defined(DOXYGEN_RUNNING) + +/*! + \ingroup PkgWeightsRefThreePointFamilyWeights + + \brief computes the three-point family weight in 2D at `q` using the points `p0`, `p1`, + and `p2` and the power parameter `a`, given a traits class `traits` with geometric objects, + predicates, and constructions. +*/ +template +typename GeomTraits::FT three_point_family_weight( const typename GeomTraits::Point_2& p0, const typename GeomTraits::Point_2& p1, const typename GeomTraits::Point_2& p2, @@ -73,96 +77,89 @@ namespace Weights { const typename GeomTraits::FT a, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefThreePointFamilyWeights +/*! + \ingroup PkgWeightsRefThreePointFamilyWeights - \brief computes the three-point family weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K, and the power parameter `a` which - can be omitted. - */ - template - typename K::FT three_point_family_weight( + \brief computes the three-point family weight in 2D at `q` using the points `p0`, `p1`, + and `p2` which are parameterized by a `Kernel` K, and the power parameter `a` which + can be omitted. +*/ +template +typename K::FT three_point_family_weight( const CGAL::Point_2& p0, const CGAL::Point_2& p1, const CGAL::Point_2& p2, const CGAL::Point_2& q, const typename K::FT a = typename K::FT(1)) { } - #endif // DOXYGEN_RUNNING +#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT three_point_family_weight( - const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { +/// \cond SKIP_IN_MANUAL +template +typename GeomTraits::FT three_point_family_weight(const typename GeomTraits::Point_2& t, + const typename GeomTraits::Point_2& r, + const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::FT a, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - using FT = typename GeomTraits::FT; - const FT d1 = internal::distance_2(traits, q, t); - const FT d2 = internal::distance_2(traits, q, r); - const FT d3 = internal::distance_2(traits, q, p); + const FT d1 = internal::distance_2(traits, q, t); + const FT d2 = internal::distance_2(traits, q, r); + const FT d3 = internal::distance_2(traits, q, p); - const FT A1 = internal::area_2(traits, r, q, t); - const FT A2 = internal::area_2(traits, p, q, r); - const FT B = internal::area_2(traits, p, q, t); + const FT A1 = internal::area_2(traits, r, q, t); + const FT A2 = internal::area_2(traits, p, q, r); + const FT B = internal::area_2(traits, p, q, t); - return three_point_family_ns::weight( - traits, d1, d2, d3, A1, A2, B, a); - } + return three_point_family_ns::weight(traits, d1, d2, d3, A1, A2, B, a); +} - template - typename GeomTraits::FT three_point_family_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const typename GeomTraits::FT a = - typename GeomTraits::FT(1)) { +template +typename GeomTraits::FT three_point_family_weight(const CGAL::Point_2& t, + const CGAL::Point_2& r, + const CGAL::Point_2& p, + const CGAL::Point_2& q, + const typename GeomTraits::FT a = typename GeomTraits::FT(1)) +{ + const GeomTraits traits; + return three_point_family_weight(t, r, p, q, a, traits); +} - const GeomTraits traits; - return three_point_family_weight(t, r, p, q, a, traits); - } +namespace internal { - namespace internal { +template +typename GeomTraits::FT three_point_family_weight(const typename GeomTraits::Point_3& t, + const typename GeomTraits::Point_3& r, + const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::FT a, + const GeomTraits& traits) +{ + using Point_2 = typename GeomTraits::Point_2; - template - typename GeomTraits::FT three_point_family_weight( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { + Point_2 tf, rf, pf, qf; + internal::flatten(traits, + t, r, p, q, + tf, rf, pf, qf); + return CGAL::Weights::three_point_family_weight(tf, rf, pf, qf, a, traits); +} - using Point_2 = typename GeomTraits::Point_2; - Point_2 tf, rf, pf, qf; - internal::flatten( - traits, - t, r, p, q, - tf, rf, pf, qf); - return CGAL::Weights:: - three_point_family_weight(tf, rf, pf, qf, a, traits); - } +template +typename GeomTraits::FT three_point_family_weight(const CGAL::Point_3& t, + const CGAL::Point_3& r, + const CGAL::Point_3& p, + const CGAL::Point_3& q, + const typename GeomTraits::FT a = typename GeomTraits::FT(1)) +{ + const GeomTraits traits; + return three_point_family_weight(t, r, p, q, a, traits); +} - template - typename GeomTraits::FT three_point_family_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const typename GeomTraits::FT a = - typename GeomTraits::FT(1)) { +} // namespace internal - const GeomTraits traits; - return three_point_family_weight(t, r, p, q, a, traits); - } - - } // namespace internal - - /// \endcond +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/triangular_region_weights.h b/Weights/include/CGAL/Weights/triangular_region_weights.h index d0605d8e1bf..bb94af1a332 100644 --- a/Weights/include/CGAL/Weights/triangular_region_weights.h +++ b/Weights/include/CGAL/Weights/triangular_region_weights.h @@ -14,107 +14,103 @@ #ifndef CGAL_TRIANGULAR_REGION_WEIGHTS_H #define CGAL_TRIANGULAR_REGION_WEIGHTS_H -// Internal includes. #include namespace CGAL { namespace Weights { - #if defined(DOXYGEN_RUNNING) +#if defined(DOXYGEN_RUNNING) - /*! - \ingroup PkgWeightsRefTriangularRegionWeights +/*! + \ingroup PkgWeightsRefTriangularRegionWeights - \brief computes the area of the triangular cell in 2D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT triangular_area( + \brief computes the area of the triangular cell in 2D using the points `p`, `q` + and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT triangular_area( const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2& q, const typename GeomTraits::Point_2& r, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefTriangularRegionWeights +/*! + \ingroup PkgWeightsRefTriangularRegionWeights - \brief computes the area of the triangular cell in 3D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT triangular_area( + \brief computes the area of the triangular cell in 3D using the points `p`, `q` + and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT triangular_area( const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& q, const typename GeomTraits::Point_3& r, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefTriangularRegionWeights +/*! + \ingroup PkgWeightsRefTriangularRegionWeights - \brief computes the area of the triangular cell in 2D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. - */ - template - typename K::FT triangular_area( + \brief computes the area of the triangular cell in 2D using the points `p`, `q` + and `r` which are parameterized by a `Kernel` K. +*/ +template +typename K::FT triangular_area( const CGAL::Point_2& p, const CGAL::Point_2& q, const CGAL::Point_2& r) { } - /*! - \ingroup PkgWeightsRefTriangularRegionWeights +/*! + \ingroup PkgWeightsRefTriangularRegionWeights - \brief computes the area of the triangular cell in 3D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. - */ - template - typename K::FT triangular_area( + \brief computes the area of the triangular cell in 3D using the points `p`, `q` + and `r` which are parameterized by a `Kernel` K. +*/ +template +typename K::FT triangular_area( const CGAL::Point_3& p, const CGAL::Point_3& q, const CGAL::Point_3& r) { } - #endif // DOXYGEN_RUNNING +#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT triangular_area( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { +/// \cond SKIP_IN_MANUAL +template +typename GeomTraits::FT triangular_area(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) +{ + return internal::positive_area_2(traits, p, q, r); +} - return internal::positive_area_2(traits, p, q, r); - } +template +typename GeomTraits::FT triangular_area(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const GeomTraits traits; + return triangular_area(p, q, r, traits); +} - template - typename GeomTraits::FT triangular_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { +template +typename GeomTraits::FT triangular_area(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + return internal::positive_area_3(traits, p, q, r); +} - const GeomTraits traits; - return triangular_area(p, q, r, traits); - } +template +typename GeomTraits::FT triangular_area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const GeomTraits traits; + return triangular_area(p, q, r, traits); +} - template - typename GeomTraits::FT triangular_area( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { - - return internal::positive_area_3(traits, p, q, r); - } - - template - typename GeomTraits::FT triangular_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { - - const GeomTraits traits; - return triangular_area(p, q, r, traits); - } - /// \endcond +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/uniform_region_weights.h b/Weights/include/CGAL/Weights/uniform_region_weights.h index 9d78a58b6b5..f028c700903 100644 --- a/Weights/include/CGAL/Weights/uniform_region_weights.h +++ b/Weights/include/CGAL/Weights/uniform_region_weights.h @@ -20,103 +20,100 @@ namespace CGAL { namespace Weights { - #if defined(DOXYGEN_RUNNING) +#if defined(DOXYGEN_RUNNING) - /*! - \ingroup PkgWeightsRefUniformRegionWeights +/*! + \ingroup PkgWeightsRefUniformRegionWeights - \brief this function always returns 1, given three points in 2D and a traits class - with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT uniform_area( + \brief this function always returns 1, given three points in 2D and a traits class + with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT uniform_area( const typename GeomTraits::Point_2&, const typename GeomTraits::Point_2&, const typename GeomTraits::Point_2&, const GeomTraits&) { } - /*! - \ingroup PkgWeightsRefUniformRegionWeights +/*! + \ingroup PkgWeightsRefUniformRegionWeights - \brief this function always returns 1, given three points in 3D and a traits class - with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT uniform_area( + \brief this function always returns 1, given three points in 3D and a traits class + with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT uniform_area( const typename GeomTraits::Point_3&, const typename GeomTraits::Point_3&, const typename GeomTraits::Point_3&, const GeomTraits&) { } - /*! - \ingroup PkgWeightsRefUniformRegionWeights +/*! + \ingroup PkgWeightsRefUniformRegionWeights - \brief this function always returns 1, given three points in 2D which are - parameterized by a `Kernel` K. - */ - template - typename K::FT uniform_area( + \brief this function always returns 1, given three points in 2D which are + parameterized by a `Kernel` K. +*/ +template +typename K::FT uniform_area( const CGAL::Point_2&, const CGAL::Point_2&, const CGAL::Point_2&) { } - /*! - \ingroup PkgWeightsRefUniformRegionWeights +/*! + \ingroup PkgWeightsRefUniformRegionWeights - \brief this function always returns 1, given three points in 3D which are - parameterized by a `Kernel` K. - */ - template - typename K::FT uniform_area( + \brief this function always returns 1, given three points in 3D which are + parameterized by a `Kernel` K. +*/ +template +typename K::FT uniform_area( const CGAL::Point_3&, const CGAL::Point_3&, const CGAL::Point_3&) { } - #endif // DOXYGEN_RUNNING +#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT uniform_area( - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const GeomTraits&) { +/// \cond SKIP_IN_MANUAL +template +typename GeomTraits::FT uniform_area(const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2&, + const GeomTraits&) +{ + using FT = typename GeomTraits::FT; + return FT(1); +} - using FT = typename GeomTraits::FT; - return FT(1); - } +template +typename GeomTraits::FT uniform_area(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const GeomTraits traits; + return uniform_area(p, q, r, traits); +} - template - typename GeomTraits::FT uniform_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { +template +typename GeomTraits::FT uniform_area(const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3&, + const GeomTraits&) +{ + using FT = typename GeomTraits::FT; + return FT(1); +} - const GeomTraits traits; - return uniform_area(p, q, r, traits); - } +template +typename GeomTraits::FT uniform_area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const GeomTraits traits; + return uniform_area(p, q, r, traits); +} - template - typename GeomTraits::FT uniform_area( - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const GeomTraits&) { - - using FT = typename GeomTraits::FT; - return FT(1); - } - - template - typename GeomTraits::FT uniform_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { - - const GeomTraits traits; - return uniform_area(p, q, r, traits); - } - /// \endcond +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/uniform_weights.h b/Weights/include/CGAL/Weights/uniform_weights.h index 9ce8d49d360..439e0e74075 100644 --- a/Weights/include/CGAL/Weights/uniform_weights.h +++ b/Weights/include/CGAL/Weights/uniform_weights.h @@ -20,128 +20,128 @@ namespace CGAL { namespace Weights { - #if defined(DOXYGEN_RUNNING) +#if defined(DOXYGEN_RUNNING) - /*! +/*! \ingroup PkgWeightsRefUniformWeights \brief this function always returns 1, given four points in 2D and a traits class with geometric objects, predicates, and constructions. */ - template - typename GeomTraits::FT uniform_weight( +template +typename GeomTraits::FT uniform_weight( const typename GeomTraits::Point_2&, const typename GeomTraits::Point_2&, const typename GeomTraits::Point_2&, const typename GeomTraits::Point_2&, const GeomTraits&) { } - /*! +/*! \ingroup PkgWeightsRefUniformWeights \brief this function always returns 1, given four points in 3D and a traits class with geometric objects, predicates, and constructions. */ - template - typename GeomTraits::FT uniform_weight( +template +typename GeomTraits::FT uniform_weight( const typename GeomTraits::Point_3&, const typename GeomTraits::Point_3&, const typename GeomTraits::Point_3&, const typename GeomTraits::Point_3&, const GeomTraits&) { } - /*! +/*! \ingroup PkgWeightsRefUniformWeights \brief this function always returns 1, given four points in 2D which are parameterized by a `Kernel` K. */ - template - typename K::FT uniform_weight( +template +typename K::FT uniform_weight( const CGAL::Point_2&, const CGAL::Point_2&, const CGAL::Point_2&, const CGAL::Point_2&) { } - /*! +/*! \ingroup PkgWeightsRefUniformWeights \brief this function always returns 1, given four points in 3D which are parameterized by a `Kernel` K. */ - template - typename K::FT uniform_weight( +template +typename K::FT uniform_weight( const CGAL::Point_3&, const CGAL::Point_3&, const CGAL::Point_3&, const CGAL::Point_3&) { } - #endif // DOXYGEN_RUNNING +#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT uniform_weight( +/// \cond SKIP_IN_MANUAL +template +typename GeomTraits::FT uniform_weight( const typename GeomTraits::Point_2&, const typename GeomTraits::Point_2&, const typename GeomTraits::Point_2&, const typename GeomTraits::Point_2&, const GeomTraits&) { - using FT = typename GeomTraits::FT; - return FT(1); - } + using FT = typename GeomTraits::FT; + return FT(1); +} - template - typename GeomTraits::FT uniform_weight( +template +typename GeomTraits::FT uniform_weight( const CGAL::Point_2& q, const CGAL::Point_2& t, const CGAL::Point_2& r, const CGAL::Point_2& p) { - const GeomTraits traits; - return uniform_weight(q, t, r, p, traits); - } + const GeomTraits traits; + return uniform_weight(q, t, r, p, traits); +} - template - typename GeomTraits::FT uniform_weight( +template +typename GeomTraits::FT uniform_weight( const typename GeomTraits::Point_3&, const typename GeomTraits::Point_3&, const typename GeomTraits::Point_3&, const typename GeomTraits::Point_3&, const GeomTraits&) { - using FT = typename GeomTraits::FT; - return FT(1); - } + using FT = typename GeomTraits::FT; + return FT(1); +} - template - typename GeomTraits::FT uniform_weight( +template +typename GeomTraits::FT uniform_weight( const CGAL::Point_3& q, const CGAL::Point_3& t, const CGAL::Point_3& r, const CGAL::Point_3& p) { - const GeomTraits traits; - return uniform_weight(q, t, r, p, traits); - } + const GeomTraits traits; + return uniform_weight(q, t, r, p, traits); +} - // Undocumented uniform weight class taking as input a polygon mesh. - // It is currently used in: - // Polygon_mesh_processing -> triangulate_hole_Polyhedron_3_test.cpp - // Polygon_mesh_processing -> triangulate_hole_Polyhedron_3_no_delaunay_test.cpp - // Polyhedron demo -> Fairing_plugin.cpp - // Polyhedron demo -> Hole_filling_plugin.cpp - template - class Uniform_weight { +// Undocumented uniform weight class taking as input a polygon mesh. +// It is currently used in: +// Polygon_mesh_processing -> triangulate_hole_Polyhedron_3_test.cpp +// Polygon_mesh_processing -> triangulate_hole_Polyhedron_3_no_delaunay_test.cpp +// Polyhedron demo -> Fairing_plugin.cpp +// Polyhedron demo -> Hole_filling_plugin.cpp +template +class Uniform_weight +{ +public: + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; + double w_i(vertex_descriptor) { return 1.; } + double w_ij(halfedge_descriptor) { return 1.; } +}; - public: - using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; - using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - double w_i(vertex_descriptor) { return 1; } - double w_ij(halfedge_descriptor) { return 1; } - }; - - /// \endcond +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/utils.h b/Weights/include/CGAL/Weights/utils.h index 5636e00f296..d28dfe877ba 100644 --- a/Weights/include/CGAL/Weights/utils.h +++ b/Weights/include/CGAL/Weights/utils.h @@ -20,187 +20,168 @@ namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT tangent( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { +/// \cond SKIP_IN_MANUAL +template +typename GeomTraits::FT tangent(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) +{ + return internal::tangent_2(traits, p, q, r); +} - return internal::tangent_2(traits, p, q, r); - } +template +typename GeomTraits::FT tangent(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const GeomTraits traits; + return tangent(p, q, r, traits); +} - template - typename GeomTraits::FT tangent( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { +template +typename GeomTraits::FT tangent(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + return internal::tangent_3(traits, p, q, r); +} - const GeomTraits traits; - return tangent(p, q, r, traits); - } +template +typename GeomTraits::FT tangent(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const GeomTraits traits; + return tangent(p, q, r, traits); +} - template - typename GeomTraits::FT tangent( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { +template +typename GeomTraits::FT cotangent(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) +{ + return internal::cotangent_2(traits, p, q, r); +} - return internal::tangent_3(traits, p, q, r); - } +template +typename GeomTraits::FT cotangent(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const GeomTraits traits; + return cotangent(p, q, r, traits); +} - template - typename GeomTraits::FT tangent( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { +template +typename GeomTraits::FT cotangent(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + return internal::cotangent_3(traits, p, q, r); +} - const GeomTraits traits; - return tangent(p, q, r, traits); - } +template +typename GeomTraits::FT cotangent(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const GeomTraits traits; + return cotangent(p, q, r, traits); +} - template - typename GeomTraits::FT cotangent( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { +/// \endcond - return internal::cotangent_2(traits, p, q, r); - } +/// \cond SKIP_IN_MANUAL +// These are free functions to be used when building weights from parts rather +// than using the predefined weight functions. In principle, they can be removed. +// They are here to have unified interface within the Weights package and its +// construction weight system. +template +typename GeomTraits::FT squared_distance(const CGAL::Point_2& p, + const CGAL::Point_2& q) +{ + const GeomTraits traits; + const auto squared_distance_2 = traits.compute_squared_distance_2_object(); + return squared_distance_2(p, q); +} - template - typename GeomTraits::FT cotangent( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { +template +typename GeomTraits::FT squared_distance(const CGAL::Point_3& p, + const CGAL::Point_3& q) +{ + const GeomTraits traits; + const auto squared_distance_3 = traits.compute_squared_distance_3_object(); + return squared_distance_3(p, q); +} - const GeomTraits traits; - return cotangent(p, q, r, traits); - } +template +typename GeomTraits::FT distance(const CGAL::Point_2& p, + const CGAL::Point_2& q) +{ + const GeomTraits traits; + return internal::distance_2(traits, p, q); +} - template - typename GeomTraits::FT cotangent( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { +template +typename GeomTraits::FT distance(const CGAL::Point_3& p, + const CGAL::Point_3& q) +{ + const GeomTraits traits; + return internal::distance_3(traits, p, q); +} - return internal::cotangent_3(traits, p, q, r); - } +template +typename GeomTraits::FT area(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const GeomTraits traits; + return internal::area_2(traits, p, q, r); +} - template - typename GeomTraits::FT cotangent( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { +template +typename GeomTraits::FT area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const GeomTraits traits; + return internal::positive_area_3(traits, p, q, r); +} - const GeomTraits traits; - return cotangent(p, q, r, traits); - } - /// \endcond +template +typename GeomTraits::FT scalar_product(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const GeomTraits traits; - /// \cond SKIP_IN_MANUAL - // These are free functions to be used when building weights from parts rather - // than using the predefined weight functions. In principle, they can be removed. - // They are here to have unified interface within the Weights package and its - // construction weight system. - template - typename GeomTraits::FT squared_distance( - const CGAL::Point_2& p, - const CGAL::Point_2& q) { + const auto scalar_product_2 = traits.compute_scalar_product_2_object(); + const auto construct_vector_2 = traits.construct_vector_2_object(); - const GeomTraits traits; - const auto squared_distance_2 = - traits.compute_squared_distance_2_object(); - return squared_distance_2(p, q); - } + const auto v1 = construct_vector_2(q, r); + const auto v2 = construct_vector_2(q, p); + return scalar_product_2(v1, v2); +} - template - typename GeomTraits::FT squared_distance( - const CGAL::Point_3& p, - const CGAL::Point_3& q) { +template +typename GeomTraits::FT scalar_product(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const GeomTraits traits; + const auto scalar_product_3 = traits.compute_scalar_product_3_object(); + const auto construct_vector_3 = traits.construct_vector_3_object(); - const GeomTraits traits; - const auto squared_distance_3 = - traits.compute_squared_distance_3_object(); - return squared_distance_3(p, q); - } + const auto v1 = construct_vector_3(q, r); + const auto v2 = construct_vector_3(q, p); + return scalar_product_3(v1, v2); +} - template - typename GeomTraits::FT distance( - const CGAL::Point_2& p, - const CGAL::Point_2& q) { - - const GeomTraits traits; - return internal::distance_2(traits, p, q); - } - - template - typename GeomTraits::FT distance( - const CGAL::Point_3& p, - const CGAL::Point_3& q) { - - const GeomTraits traits; - return internal::distance_3(traits, p, q); - } - - template - typename GeomTraits::FT area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { - - const GeomTraits traits; - return internal::area_2(traits, p, q, r); - } - - template - typename GeomTraits::FT area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { - - const GeomTraits traits; - return internal::positive_area_3(traits, p, q, r); - } - - template - typename GeomTraits::FT scalar_product( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { - - const GeomTraits traits; - const auto scalar_product_2 = - traits.compute_scalar_product_2_object(); - const auto construct_vector_2 = - traits.construct_vector_2_object(); - - const auto v1 = construct_vector_2(q, r); - const auto v2 = construct_vector_2(q, p); - return scalar_product_2(v1, v2); - } - - template - typename GeomTraits::FT scalar_product( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { - - const GeomTraits traits; - const auto scalar_product_3 = - traits.compute_scalar_product_3_object(); - const auto construct_vector_3 = - traits.construct_vector_3_object(); - - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); - return scalar_product_3(v1, v2); - } - /// \endcond +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/voronoi_region_weights.h b/Weights/include/CGAL/Weights/voronoi_region_weights.h index 569c26a6870..8497c8aad57 100644 --- a/Weights/include/CGAL/Weights/voronoi_region_weights.h +++ b/Weights/include/CGAL/Weights/voronoi_region_weights.h @@ -14,131 +14,125 @@ #ifndef CGAL_VORONOI_REGION_WEIGHTS_H #define CGAL_VORONOI_REGION_WEIGHTS_H -// Internal includes. #include namespace CGAL { namespace Weights { - #if defined(DOXYGEN_RUNNING) +#if defined(DOXYGEN_RUNNING) - /*! - \ingroup PkgWeightsRefVoronoiRegionWeights +/*! + \ingroup PkgWeightsRefVoronoiRegionWeights - \brief computes the area of the Voronoi cell in 2D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT voronoi_area( + \brief computes the area of the Voronoi cell in 2D using the points `p`, `q` + and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT voronoi_area( const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2& q, const typename GeomTraits::Point_2& r, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefVoronoiRegionWeights +/*! + \ingroup PkgWeightsRefVoronoiRegionWeights - \brief computes the area of the Voronoi cell in 3D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT voronoi_area( + \brief computes the area of the Voronoi cell in 3D using the points `p`, `q` + and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT voronoi_area( const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& q, const typename GeomTraits::Point_3& r, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefVoronoiRegionWeights +/*! + \ingroup PkgWeightsRefVoronoiRegionWeights - \brief computes the area of the Voronoi cell in 2D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. - */ - template - typename K::FT voronoi_area( + \brief computes the area of the Voronoi cell in 2D using the points `p`, `q` + and `r` which are parameterized by a `Kernel` K. +*/ +template +typename K::FT voronoi_area( const CGAL::Point_2& p, const CGAL::Point_2& q, const CGAL::Point_2& r) { } - /*! - \ingroup PkgWeightsRefVoronoiRegionWeights +/*! + \ingroup PkgWeightsRefVoronoiRegionWeights - \brief computes the area of the Voronoi cell in 3D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. - */ - template - typename K::FT voronoi_area( - const CGAL::Point_3& p, + \brief computes the area of the Voronoi cell in 3D using the points `p`, `q` + and `r` which are parameterized by a `Kernel` K. +*/ +template +typename K::FT voronoi_area( + const CGAL::Point_3& p, const CGAL::Point_3& q, const CGAL::Point_3& r) { } - #endif // DOXYGEN_RUNNING +#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT voronoi_area( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { +/// \cond SKIP_IN_MANUAL +template +typename GeomTraits::FT voronoi_area(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - using FT = typename GeomTraits::FT; - const auto circumcenter_2 = - traits.construct_circumcenter_2_object(); - const auto midpoint_2 = - traits.construct_midpoint_2_object(); + const auto circumcenter_2 = traits.construct_circumcenter_2_object(); + const auto midpoint_2 = traits.construct_midpoint_2_object(); - const auto center = circumcenter_2(p, q, r); - const auto m1 = midpoint_2(q, r); - const auto m2 = midpoint_2(q, p); + const auto center = circumcenter_2(p, q, r); + const auto m1 = midpoint_2(q, r); + const auto m2 = midpoint_2(q, p); - const FT A1 = internal::positive_area_2(traits, q, m1, center); - const FT A2 = internal::positive_area_2(traits, q, center, m2); - return A1 + A2; - } + const FT A1 = internal::positive_area_2(traits, q, m1, center); + const FT A2 = internal::positive_area_2(traits, q, center, m2); + return A1 + A2; +} - template - typename GeomTraits::FT voronoi_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { +template +typename GeomTraits::FT voronoi_area(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const GeomTraits traits; + return voronoi_area(p, q, r, traits); +} - const GeomTraits traits; - return voronoi_area(p, q, r, traits); - } +template +typename GeomTraits::FT voronoi_area(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; - template - typename GeomTraits::FT voronoi_area( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { + const auto circumcenter_3 = traits.construct_circumcenter_3_object(); + const auto midpoint_3 = traits.construct_midpoint_3_object(); - using FT = typename GeomTraits::FT; - const auto circumcenter_3 = - traits.construct_circumcenter_3_object(); - const auto midpoint_3 = - traits.construct_midpoint_3_object(); + const auto center = circumcenter_3(p, q, r); + const auto m1 = midpoint_3(q, r); + const auto m2 = midpoint_3(q, p); - const auto center = circumcenter_3(p, q, r); - const auto m1 = midpoint_3(q, r); - const auto m2 = midpoint_3(q, p); + const FT A1 = internal::positive_area_3(traits, q, m1, center); + const FT A2 = internal::positive_area_3(traits, q, center, m2); + return A1 + A2; +} - const FT A1 = internal::positive_area_3(traits, q, m1, center); - const FT A2 = internal::positive_area_3(traits, q, center, m2); - return A1 + A2; - } +template +typename GeomTraits::FT voronoi_area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const GeomTraits traits; + return voronoi_area(p, q, r, traits); +} - template - typename GeomTraits::FT voronoi_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { - - const GeomTraits traits; - return voronoi_area(p, q, r, traits); - } - /// \endcond +/// \endcond } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/wachspress_weights.h b/Weights/include/CGAL/Weights/wachspress_weights.h index 34299c24a52..00d843d18d1 100644 --- a/Weights/include/CGAL/Weights/wachspress_weights.h +++ b/Weights/include/CGAL/Weights/wachspress_weights.h @@ -21,402 +21,377 @@ namespace CGAL { namespace Weights { - /// \cond SKIP_IN_MANUAL - namespace wachspress_ns { +/// \cond SKIP_IN_MANUAL +namespace wachspress_ns { - template - FT weight(const FT A1, const FT A2, const FT C) { - - FT w = FT(0); - CGAL_precondition(A1 != FT(0) && A2 != FT(0)); - const FT prod = A1 * A2; - if (prod != FT(0)) { - const FT inv = FT(1) / prod; - w = C * inv; - } - return w; - } +template +FT weight(const FT A1, const FT A2, const FT C) +{ + FT w = FT(0); + CGAL_precondition(A1 != FT(0) && A2 != FT(0)); + const FT prod = A1 * A2; + if (prod != FT(0)) + { + const FT inv = FT(1) / prod; + w = C * inv; } - /// \endcond + return w; +} - #if defined(DOXYGEN_RUNNING) +} // wachspress_ns - /*! - \ingroup PkgWeightsRefWachspressWeights +/// \endcond - \brief computes the Wachspress weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. - */ - template - typename GeomTraits::FT wachspress_weight( +#if defined(DOXYGEN_RUNNING) + +/*! + \ingroup PkgWeightsRefWachspressWeights + + \brief computes the Wachspress weight in 2D at `q` using the points `p0`, `p1`, + and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. +*/ +template +typename GeomTraits::FT wachspress_weight( const typename GeomTraits::Point_2& p0, const typename GeomTraits::Point_2& p1, const typename GeomTraits::Point_2& p2, const typename GeomTraits::Point_2& q, const GeomTraits& traits) { } - /*! - \ingroup PkgWeightsRefWachspressWeights +/*! + \ingroup PkgWeightsRefWachspressWeights - \brief computes the Wachspress weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. - */ - template - typename K::FT wachspress_weight( + \brief computes the Wachspress weight in 2D at `q` using the points `p0`, `p1`, + and `p2` which are parameterized by a `Kernel` K. +*/ +template +typename K::FT wachspress_weight( const CGAL::Point_2& p0, const CGAL::Point_2& p1, const CGAL::Point_2& p2, const CGAL::Point_2& q) { } - #endif // DOXYGEN_RUNNING +#endif // DOXYGEN_RUNNING + +/// \cond SKIP_IN_MANUAL +template +typename GeomTraits::FT wachspress_weight(const typename GeomTraits::Point_2& t, + const typename GeomTraits::Point_2& r, + const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + const FT A1 = internal::area_2(traits, r, q, t); + const FT A2 = internal::area_2(traits, p, q, r); + const FT C = internal::area_2(traits, t, r, p); + return wachspress_ns::weight(A1, A2, C); +} + +template +typename GeomTraits::FT wachspress_weight(const CGAL::Point_2& t, + const CGAL::Point_2& r, + const CGAL::Point_2& p, + const CGAL::Point_2& q) +{ + const GeomTraits traits; + return wachspress_weight(t, r, p, q, traits); +} + +namespace internal { + +template +typename GeomTraits::FT wachspress_weight(const typename GeomTraits::Point_3& t, + const typename GeomTraits::Point_3& r, + const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) +{ + using Point_2 = typename GeomTraits::Point_2; + + Point_2 tf, rf, pf, qf; + internal::flatten(traits, + t, r, p, q, + tf, rf, pf, qf); + return CGAL::Weights::wachspress_weight(tf, rf, pf, qf, traits); +} + +template +typename GeomTraits::FT wachspress_weight(const CGAL::Point_3& t, + const CGAL::Point_3& r, + const CGAL::Point_3& p, + const CGAL::Point_3& q) +{ + const GeomTraits traits; + return wachspress_weight(t, r, p, q, traits); +} + +} // namespace internal + +/// \endcond + +/*! + \ingroup PkgWeightsRefBarycentricWachspressWeights + + \brief 2D Wachspress weights for polygons. + + This class implements 2D Wachspress weights ( \cite cgal:bc:fhk-gcbcocp-06, + \cite cgal:bc:mlbd-gbcip-02, \cite cgal:bc:w-rfeb-75 ) which can be computed + at any point inside a strictly convex polygon. + + Wachspress weights are well-defined and non-negative inside a strictly convex polygon. + The weights are computed analytically using the formulation from the `wachspress_weight()`. + + \tparam VertexRange a model of `ConstRange` whose iterator type is `RandomAccessIterator` + \tparam GeomTraits a model of `AnalyticWeightTraits_2` + \tparam PointMap a model of `ReadablePropertyMap` whose key type is `VertexRange::value_type` and + value type is `Point_2`. The default is `CGAL::Identity_property_map`. + + \cgalModels `BarycentricWeights_2` +*/ +template > +class Wachspress_weights_2 +{ +public: + + /// \name Types + /// @{ /// \cond SKIP_IN_MANUAL - template - typename GeomTraits::FT wachspress_weight( - const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { - using FT = typename GeomTraits::FT; - const FT A1 = internal::area_2(traits, r, q, t); - const FT A2 = internal::area_2(traits, p, q, r); - const FT C = internal::area_2(traits, t, r, p); - return wachspress_ns::weight(A1, A2, C); - } + using Vertex_range = VertexRange; + using Geom_traits = GeomTraits; + using Point_map = PointMap; - template - typename GeomTraits::FT wachspress_weight( - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) { - - const GeomTraits traits; - return wachspress_weight(t, r, p, q, traits); - } - - namespace internal { - - template - typename GeomTraits::FT wachspress_weight( - const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { - - using Point_2 = typename GeomTraits::Point_2; - Point_2 tf, rf, pf, qf; - internal::flatten( - traits, - t, r, p, q, - tf, rf, pf, qf); - return CGAL::Weights:: - wachspress_weight(tf, rf, pf, qf, traits); - } - - template - typename GeomTraits::FT wachspress_weight( - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) { - - const GeomTraits traits; - return wachspress_weight(t, r, p, q, traits); - } - - } // namespace internal + using Area_2 = typename GeomTraits::Compute_area_2; /// \endcond - /*! - \ingroup PkgWeightsRefBarycentricWachspressWeights + /// Number type. + typedef typename GeomTraits::FT FT; - \brief 2D Wachspress weights for polygons. + /// Point type. + typedef typename GeomTraits::Point_2 Point_2; - This class implements 2D Wachspress weights ( \cite cgal:bc:fhk-gcbcocp-06, - \cite cgal:bc:mlbd-gbcip-02, \cite cgal:bc:w-rfeb-75 ) which can be computed - at any point inside a strictly convex polygon. + /// @} - Wachspress weights are well-defined and non-negative inside a strictly convex polygon. - The weights are computed analytically using the formulation from the `wachspress_weight()`. - - \tparam VertexRange - a model of `ConstRange` whose iterator type is `RandomAccessIterator` - - \tparam GeomTraits - a model of `AnalyticWeightTraits_2` - - \tparam PointMap - a model of `ReadablePropertyMap` whose key type is `VertexRange::value_type` and - value type is `Point_2`. The default is `CGAL::Identity_property_map`. - - \cgalModels `BarycentricWeights_2` - */ - template< - typename VertexRange, - typename GeomTraits, - typename PointMap = CGAL::Identity_property_map > - class Wachspress_weights_2 { - - public: - - /// \name Types - /// @{ - - /// \cond SKIP_IN_MANUAL - using Vertex_range = VertexRange; - using Geom_traits = GeomTraits; - using Point_map = PointMap; - - using Area_2 = typename GeomTraits::Compute_area_2; - /// \endcond - - /// Number type. - typedef typename GeomTraits::FT FT; - - /// Point type. - typedef typename GeomTraits::Point_2 Point_2; - - /// @} - - /// \name Initialization - /// @{ - - /*! - \brief initializes all internal data structures. - - This class implements the behavior of Wachspress weights - for 2D query points inside strictly convex polygons. - - \param polygon - an instance of `VertexRange` with the vertices of a strictly convex polygon - - \param traits - a traits class with geometric objects, predicates, and constructions; - the default initialization is provided - - \param point_map - an instance of `PointMap` that maps a vertex from `polygon` to `Point_2`; - the default initialization is provided - - \pre polygon.size() >= 3 - \pre polygon is simple - \pre polygon is strictly convex - */ - Wachspress_weights_2( - const VertexRange& polygon, - const GeomTraits traits = GeomTraits(), - const PointMap point_map = PointMap()) : - m_polygon(polygon), - m_traits(traits), - m_point_map(point_map), - m_area_2(m_traits.compute_area_2_object()) { - - CGAL_precondition( - polygon.size() >= 3); - CGAL_precondition( - internal::is_simple_2(polygon, traits, point_map)); - CGAL_precondition( - internal::polygon_type_2(polygon, traits, point_map) == - internal::Polygon_type::STRICTLY_CONVEX); - resize(); - } - - /// @} - - /// \name Access - /// @{ - - /*! - \brief computes 2D Wachspress weights. - - This function fills a destination range with 2D Wachspress weights computed - at the `query` point with respect to the vertices of the input polygon. - - The number of computed weights is equal to the number of polygon vertices. - - \tparam OutIterator - a model of `OutputIterator` whose value type is `FT` - - \param query - a query point - - \param w_begin - the beginning of the destination range with the computed weights - - \return an output iterator to the element in the destination range, - one past the last weight stored - */ - template - OutIterator operator()(const Point_2& query, OutIterator w_begin) { - const bool normalize = false; - return operator()(query, w_begin, normalize); - } - - /// @} - - /// \cond SKIP_IN_MANUAL - template - OutIterator operator()(const Point_2& query, OutIterator w_begin, const bool normalize) { - return optimal_weights(query, w_begin, normalize); - } - /// \endcond - - private: - - // Fields. - const VertexRange& m_polygon; - const GeomTraits m_traits; - const PointMap m_point_map; - - const Area_2 m_area_2; - - std::vector A; - std::vector C; - std::vector w; - - // Functions. - void resize() { - A.resize(m_polygon.size()); - C.resize(m_polygon.size()); - w.resize(m_polygon.size()); - } - - template - OutputIterator optimal_weights( - const Point_2& query, OutputIterator weights, const bool normalize) { - - // Get the number of vertices in the polygon. - const std::size_t n = m_polygon.size(); - - // Compute areas A and C following the area notation from [1]. - // Split the loop to make this computation faster. - const auto& p1 = get(m_point_map, *(m_polygon.begin() + 0)); - const auto& p2 = get(m_point_map, *(m_polygon.begin() + 1)); - const auto& pn = get(m_point_map, *(m_polygon.begin() + (n - 1))); - - A[0] = m_area_2(p1, p2, query); - C[0] = m_area_2(pn, p1, p2); - - for (std::size_t i = 1; i < n - 1; ++i) { - const auto& pi0 = get(m_point_map, *(m_polygon.begin() + (i - 1))); - const auto& pi1 = get(m_point_map, *(m_polygon.begin() + (i + 0))); - const auto& pi2 = get(m_point_map, *(m_polygon.begin() + (i + 1))); - - A[i] = m_area_2(pi1, pi2, query); - C[i] = m_area_2(pi0, pi1, pi2); - } - - const auto& pm = get(m_point_map, *(m_polygon.begin() + (n - 2))); - A[n - 1] = m_area_2(pn, p1, query); - C[n - 1] = m_area_2(pm, pn, p1); - - // Compute unnormalized weights following the formula (28) from [1]. - CGAL_assertion(A[n - 1] != FT(0) && A[0] != FT(0)); - w[0] = C[0] / (A[n - 1] * A[0]); - - for (std::size_t i = 1; i < n - 1; ++i) { - CGAL_assertion(A[i - 1] != FT(0) && A[i] != FT(0)); - w[i] = C[i] / (A[i - 1] * A[i]); - } - - CGAL_assertion(A[n - 2] != FT(0) && A[n - 1] != FT(0)); - w[n - 1] = C[n - 1] / (A[n - 2] * A[n - 1]); - - // Normalize if necessary. - if (normalize) { - internal::normalize(w); - } - - // Return weights. - for (std::size_t i = 0; i < n; ++i) { - *(weights++) = w[i]; - } - return weights; - } - }; + /// \name Initialization + /// @{ /*! - \ingroup PkgWeightsRefBarycentricWachspressWeights + \brief initializes all internal data structures. - \brief computes 2D Wachspress weights for polygons. + This class implements the behavior of Wachspress weights + for 2D query points inside strictly convex polygons. - This function computes 2D Wachspress weights at a given `query` point - with respect to the vertices of a strictly convex `polygon`, that is one - weight per vertex. The weights are stored in a destination range - beginning at `w_begin`. - - Internally, the class `Wachspress_weights_2` is used. If one wants to process - multiple query points, it is better to use that class. When using the free function, - internal memory is allocated for each query point, while when using the class, - it is allocated only once which is much more efficient. However, for a few query - points, it is easier to use this function. It can also be used when the processing - time is not a concern. - - \tparam PointRange - a model of `ConstRange` whose iterator type is `RandomAccessIterator` - and value type is `GeomTraits::Point_2` - - \tparam OutIterator - a model of `OutputIterator` whose value type is `GeomTraits::FT` - - \tparam GeomTraits - a model of `AnalyticWeightTraits_2` - - \param polygon - an instance of `PointRange` with 2D points which form a strictly convex polygon - - \param query - a query point - - \param w_begin - the beginning of the destination range with the computed weights - - \param traits - a traits class with geometric objects, predicates, and constructions; - this parameter can be omitted if the traits class can be deduced from the point type - - \return an output iterator to the element in the destination range, - one past the last weight stored + \param polygon an instance of `VertexRange` with the vertices of a strictly convex polygon + \param traits a traits class with geometric objects, predicates, and constructions; + the default initialization is provided + \param point_map an instance of `PointMap` that maps a vertex from `polygon` to `Point_2`; + the default initialization is provided \pre polygon.size() >= 3 \pre polygon is simple \pre polygon is strictly convex */ - template< - typename PointRange, - typename OutIterator, - typename GeomTraits> - OutIterator wachspress_weights_2( - const PointRange& polygon, const typename GeomTraits::Point_2& query, - OutIterator w_begin, const GeomTraits& traits) { - - Wachspress_weights_2 - wachspress(polygon, traits); - return wachspress(query, w_begin); + Wachspress_weights_2(const VertexRange& polygon, + const GeomTraits traits = GeomTraits(), + const PointMap point_map = PointMap()) + : m_polygon(polygon), + m_traits(traits), + m_point_map(point_map), + m_area_2(m_traits.compute_area_2_object()) + { + CGAL_precondition(polygon.size() >= 3); + CGAL_precondition(internal::is_simple_2(polygon, traits, point_map)); + CGAL_precondition(internal::polygon_type_2(polygon, traits, point_map) == + internal::Polygon_type::STRICTLY_CONVEX); + resize(); } + /// @} + + /// \name Access + /// @{ + + /*! + \brief computes 2D Wachspress weights. + + This function fills a destination range with 2D Wachspress weights computed + at the `query` point with respect to the vertices of the input polygon. + + The number of computed weights is equal to the number of polygon vertices. + + \tparam OutIterator a model of `OutputIterator` whose value type is `FT` + + \param query a query point + \param w_begin the beginning of the destination range with the computed weights + + \return an output iterator to the element in the destination range, + one past the last weight stored + */ + template + OutIterator operator()(const Point_2& query, + OutIterator w_begin) + { + const bool normalize = false; + return operator()(query, w_begin, normalize); + } + + /// @} + /// \cond SKIP_IN_MANUAL - template< - typename PointRange, - typename OutIterator> - OutIterator wachspress_weights_2( - const PointRange& polygon, - const typename PointRange::value_type& query, - OutIterator w_begin) { - using Point_2 = typename PointRange::value_type; - using GeomTraits = typename Kernel_traits::Kernel; - const GeomTraits traits; - return wachspress_weights_2( - polygon, query, w_begin, traits); + template + OutIterator operator()(const Point_2& query, + OutIterator w_begin, + const bool normalize) + { + return optimal_weights(query, w_begin, normalize); } + /// \endcond +private: + const VertexRange& m_polygon; + const GeomTraits m_traits; + const PointMap m_point_map; + + const Area_2 m_area_2; + + std::vector A; + std::vector C; + std::vector w; + + void resize() + { + A.resize(m_polygon.size()); + C.resize(m_polygon.size()); + w.resize(m_polygon.size()); + } + + template + OutputIterator optimal_weights(const Point_2& query, + OutputIterator weights, + const bool normalize) + { + + // Get the number of vertices in the polygon. + const std::size_t n = m_polygon.size(); + + // Compute areas A and C following the area notation from [1]. + // Split the loop to make this computation faster. + const auto& p1 = get(m_point_map, *(m_polygon.begin() + 0)); + const auto& p2 = get(m_point_map, *(m_polygon.begin() + 1)); + const auto& pn = get(m_point_map, *(m_polygon.begin() + (n - 1))); + + A[0] = m_area_2(p1, p2, query); + C[0] = m_area_2(pn, p1, p2); + + for (std::size_t i = 1; i < n - 1; ++i) + { + const auto& pi0 = get(m_point_map, *(m_polygon.begin() + (i - 1))); + const auto& pi1 = get(m_point_map, *(m_polygon.begin() + (i + 0))); + const auto& pi2 = get(m_point_map, *(m_polygon.begin() + (i + 1))); + + A[i] = m_area_2(pi1, pi2, query); + C[i] = m_area_2(pi0, pi1, pi2); + } + + const auto& pm = get(m_point_map, *(m_polygon.begin() + (n - 2))); + A[n - 1] = m_area_2(pn, p1, query); + C[n - 1] = m_area_2(pm, pn, p1); + + // Compute unnormalized weights following the formula (28) from [1]. + CGAL_assertion(A[n - 1] != FT(0) && A[0] != FT(0)); + w[0] = C[0] / (A[n - 1] * A[0]); + + for (std::size_t i = 1; i < n - 1; ++i) + { + CGAL_assertion(A[i - 1] != FT(0) && A[i] != FT(0)); + w[i] = C[i] / (A[i - 1] * A[i]); + } + + CGAL_assertion(A[n - 2] != FT(0) && A[n - 1] != FT(0)); + w[n - 1] = C[n - 1] / (A[n - 2] * A[n - 1]); + + // Normalize if necessary. + if (normalize) + internal::normalize(w); + + // Return weights. + for (std::size_t i = 0; i < n; ++i) + *(weights++) = w[i]; + + return weights; + } +}; + +/*! + \ingroup PkgWeightsRefBarycentricWachspressWeights + + \brief computes 2D Wachspress weights for polygons. + + This function computes 2D Wachspress weights at a given `query` point + with respect to the vertices of a strictly convex `polygon`, that is one + weight per vertex. The weights are stored in a destination range + beginning at `w_begin`. + + Internally, the class `Wachspress_weights_2` is used. If one wants to process + multiple query points, it is better to use that class. When using the free function, + internal memory is allocated for each query point, while when using the class, + it is allocated only once which is much more efficient. However, for a few query + points, it is easier to use this function. It can also be used when the processing + time is not a concern. + + \tparam PointRange a model of `ConstRange` whose iterator type is `RandomAccessIterator` + and value type is `GeomTraits::Point_2` + \tparam OutIterator a model of `OutputIterator` whose value type is `GeomTraits::FT` + \tparam GeomTraits a model of `AnalyticWeightTraits_2` + + \param polygon an instance of `PointRange` with 2D points which form a strictly convex polygon + \param query a query point + \param w_begin the beginning of the destination range with the computed weights + \param traits a traits class with geometric objects, predicates, and constructions; + this parameter can be omitted if the traits class can be deduced from the point type + + \return an output iterator to the element in the destination range, one past the last weight stored + + \pre polygon.size() >= 3 + \pre polygon is simple + \pre polygon is strictly convex +*/ +template +OutIterator wachspress_weights_2(const PointRange& polygon, + const typename GeomTraits::Point_2& query, + OutIterator w_begin, + const GeomTraits& traits) +{ + Wachspress_weights_2 wachspress(polygon, traits); + return wachspress(query, w_begin); +} + +/// \cond SKIP_IN_MANUAL + +template +OutIterator wachspress_weights_2(const PointRange& polygon, + const typename PointRange::value_type& query, + OutIterator w_begin) +{ + using Point_2 = typename PointRange::value_type; + using GeomTraits = typename Kernel_traits::Kernel; + + const GeomTraits traits; + return wachspress_weights_2(polygon, query, w_begin, traits); +} + +/// \endcond + } // namespace Weights } // namespace CGAL From e0e0c4d54bdee2e566e992ddba886dab2d74774f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 17 Oct 2022 16:25:36 +0200 Subject: [PATCH 035/194] Remove old doc (new one to be re-added directly on the functions) --- .../include/CGAL/Weights/authalic_weights.h | 62 --------- .../CGAL/Weights/barycentric_region_weights.h | 57 --------- .../include/CGAL/Weights/cotangent_weights.h | 61 --------- .../CGAL/Weights/discrete_harmonic_weights.h | 34 ----- .../CGAL/Weights/inverse_distance_weights.h | 107 ---------------- .../include/CGAL/Weights/mean_value_weights.h | 34 ----- .../Weights/mixed_voronoi_region_weights.h | 54 -------- .../include/CGAL/Weights/shepard_weights.h | 119 ------------------ .../include/CGAL/Weights/tangent_weights.h | 58 --------- .../CGAL/Weights/three_point_family_weights.h | 38 ------ .../CGAL/Weights/triangular_region_weights.h | 54 -------- .../CGAL/Weights/uniform_region_weights.h | 55 -------- .../include/CGAL/Weights/uniform_weights.h | 59 --------- Weights/include/CGAL/Weights/utils.h | 1 - .../CGAL/Weights/voronoi_region_weights.h | 54 -------- .../include/CGAL/Weights/wachspress_weights.h | 34 ----- 16 files changed, 881 deletions(-) diff --git a/Weights/include/CGAL/Weights/authalic_weights.h b/Weights/include/CGAL/Weights/authalic_weights.h index 25d38e60f26..447c58f1bea 100644 --- a/Weights/include/CGAL/Weights/authalic_weights.h +++ b/Weights/include/CGAL/Weights/authalic_weights.h @@ -76,66 +76,6 @@ FT half_authalic_weight(const FT cot, const FT d2) return authalic_ns::half_weight(cot, d2); } -#if defined(DOXYGEN_RUNNING) - -/*! - \ingroup PkgWeightsRefAuthalicWeights - - \brief computes the authalic weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT authalic_weight( - const typename GeomTraits::Point_2& p0, - const typename GeomTraits::Point_2& p1, - const typename GeomTraits::Point_2& p2, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefAuthalicWeights - - \brief computes the authalic weight in 3D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT authalic_weight( - const typename GeomTraits::Point_3& p0, - const typename GeomTraits::Point_3& p1, - const typename GeomTraits::Point_3& p2, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefAuthalicWeights - - \brief computes the authalic weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. -*/ -template -typename K::FT authalic_weight( - const CGAL::Point_2& p0, - const CGAL::Point_2& p1, - const CGAL::Point_2& p2, - const CGAL::Point_2& q) { } - -/*! - \ingroup PkgWeightsRefAuthalicWeights - - \brief computes the authalic weight in 3D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. -*/ -template -typename K::FT authalic_weight( - const CGAL::Point_3& p0, - const CGAL::Point_3& p1, - const CGAL::Point_3& p2, - const CGAL::Point_3& q) { } - -#endif // DOXYGEN_RUNNING - -/// \cond SKIP_IN_MANUAL -// Overloads! template typename GeomTraits::FT authalic_weight(const typename GeomTraits::Point_2& t, const typename GeomTraits::Point_2& r, @@ -192,8 +132,6 @@ typename GeomTraits::FT authalic_weight(const CGAL::Point_3& t, return authalic_weight(t, r, p, q, traits); } -/// \endcond - } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/barycentric_region_weights.h b/Weights/include/CGAL/Weights/barycentric_region_weights.h index c095bd8c520..4b8d5692bf5 100644 --- a/Weights/include/CGAL/Weights/barycentric_region_weights.h +++ b/Weights/include/CGAL/Weights/barycentric_region_weights.h @@ -19,61 +19,6 @@ namespace CGAL { namespace Weights { -#if defined(DOXYGEN_RUNNING) - -/*! - \ingroup PkgWeightsRefBarycentricRegionWeights - - \brief computes the area of the barycentric cell in 2D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT barycentric_area( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefBarycentricRegionWeights - - \brief computes the area of the barycentric cell in 3D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT barycentric_area( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefBarycentricRegionWeights - - \brief computes the area of the barycentric cell in 2D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. -*/ -template -typename K::FT barycentric_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { } - -/*! - \ingroup PkgWeightsRefBarycentricRegionWeights - - \brief computes the area of the barycentric cell in 3D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. -*/ -template -typename K::FT barycentric_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { } - -#endif // DOXYGEN_RUNNING - -/// \cond SKIP_IN_MANUAL template typename GeomTraits::FT barycentric_area(const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2& q, @@ -132,8 +77,6 @@ typename GeomTraits::FT barycentric_area(const CGAL::Point_3& p, return barycentric_area(p, q, r, traits); } -/// \endcond - } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/cotangent_weights.h b/Weights/include/CGAL/Weights/cotangent_weights.h index 5b8a5617fa7..b4096632442 100644 --- a/Weights/include/CGAL/Weights/cotangent_weights.h +++ b/Weights/include/CGAL/Weights/cotangent_weights.h @@ -59,65 +59,6 @@ FT half_cotangent_weight(const FT cot) return cotangent_ns::half_weight(cot); } -#if defined(DOXYGEN_RUNNING) - -/*! - \ingroup PkgWeightsRefCotangentWeights - - \brief computes the cotangent weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT cotangent_weight( - const typename GeomTraits::Point_2& p0, - const typename GeomTraits::Point_2& p1, - const typename GeomTraits::Point_2& p2, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefCotangentWeights - - \brief computes the cotangent weight in 3D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT cotangent_weight( - const typename GeomTraits::Point_3& p0, - const typename GeomTraits::Point_3& p1, - const typename GeomTraits::Point_3& p2, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefCotangentWeights - - \brief computes the cotangent weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. -*/ -template -typename K::FT cotangent_weight( - const CGAL::Point_2& p0, - const CGAL::Point_2& p1, - const CGAL::Point_2& p2, - const CGAL::Point_2& q) { } - -/*! - \ingroup PkgWeightsRefCotangentWeights - - \brief computes the cotangent weight in 3D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. -*/ -template -typename K::FT cotangent_weight( - const CGAL::Point_3& p0, - const CGAL::Point_3& p1, - const CGAL::Point_3& p2, - const CGAL::Point_3& q) { } - -#endif // DOXYGEN_RUNNING - -/// \cond SKIP_IN_MANUAL template typename GeomTraits::FT cotangent_weight(const typename GeomTraits::Point_2& t, const typename GeomTraits::Point_2& r, @@ -512,8 +453,6 @@ private: } }; -/// \endcond - } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/discrete_harmonic_weights.h b/Weights/include/CGAL/Weights/discrete_harmonic_weights.h index 170b73a67b3..5f836d0a2bc 100644 --- a/Weights/include/CGAL/Weights/discrete_harmonic_weights.h +++ b/Weights/include/CGAL/Weights/discrete_harmonic_weights.h @@ -42,40 +42,6 @@ FT weight(const FT r1, const FT r2, const FT r3, } // namespace discrete_harmonic_ns -/// \endcond - -#if defined(DOXYGEN_RUNNING) - -/*! - \ingroup PkgWeightsRefDiscreteHarmonicWeights - - \brief computes the discrete harmonic weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT discrete_harmonic_weight( - const typename GeomTraits::Point_2& p0, - const typename GeomTraits::Point_2& p1, - const typename GeomTraits::Point_2& p2, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefDiscreteHarmonicWeights - - \brief computes the discrete harmonic weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. -*/ -template -typename K::FT discrete_harmonic_weight( - const CGAL::Point_2& p0, - const CGAL::Point_2& p1, - const CGAL::Point_2& p2, - const CGAL::Point_2& q) { } - -#endif // DOXYGEN_RUNNING - -/// \cond SKIP_IN_MANUAL template typename GeomTraits::FT discrete_harmonic_weight(const typename GeomTraits::Point_2& t, const typename GeomTraits::Point_2& r, diff --git a/Weights/include/CGAL/Weights/inverse_distance_weights.h b/Weights/include/CGAL/Weights/inverse_distance_weights.h index 28fec763c5e..a6774ad509a 100644 --- a/Weights/include/CGAL/Weights/inverse_distance_weights.h +++ b/Weights/include/CGAL/Weights/inverse_distance_weights.h @@ -35,113 +35,6 @@ FT weight(const FT d) } // namespace inverse_distance_ns -/// \endcond - -#if defined(DOXYGEN_RUNNING) - -/*! - \ingroup PkgWeightsRefInverseDistanceWeights - - \brief computes the inverse distance weight in 2D using the points `p` and `q`, - given a traits class `traits` with geometric objects, predicates, and constructions. - */ -template -typename GeomTraits::FT inverse_distance_weight( - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefInverseDistanceWeights - - \brief computes the inverse distance weight in 3D using the points `p` and `q`, - given a traits class `traits` with geometric objects, predicates, and constructions. - */ -template -typename GeomTraits::FT inverse_distance_weight( - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefInverseDistanceWeights - - \brief computes the inverse distance weight in 2D using the points `p` and `q`, - which are parameterized by a `Kernel` K. - */ -template -typename K::FT inverse_distance_weight( - const CGAL::Point_2&, - const CGAL::Point_2& p, - const CGAL::Point_2&, - const CGAL::Point_2& q) { } - -/*! - \ingroup PkgWeightsRefInverseDistanceWeights - - \brief computes the inverse distance weight in 3D using the points `p` and `q`, - which are parameterized by a `Kernel` K. - */ -template -typename K::FT inverse_distance_weight( - const CGAL::Point_3&, - const CGAL::Point_3& p, - const CGAL::Point_3&, - const CGAL::Point_3& q) { } - -/*! - \ingroup PkgWeightsRefInverseDistanceWeights - - \brief computes the inverse distance weight in 2D using the points `p` and `q`, - given a traits class `traits` with geometric objects, predicates, and constructions. - */ -template -typename GeomTraits::FT inverse_distance_weight( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefInverseDistanceWeights - - \brief computes the inverse distance weight in 3D using the points `p` and `q`, - given a traits class `traits` with geometric objects, predicates, and constructions. - */ -template -typename GeomTraits::FT inverse_distance_weight( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefInverseDistanceWeights - - \brief computes the inverse distance weight in 2D using the points `p` and `q`, - which are parameterized by a `Kernel` K. - */ -template -typename K::FT inverse_distance_weight( - const CGAL::Point_2& p, - const CGAL::Point_2& q) { } - -/*! - \ingroup PkgWeightsRefInverseDistanceWeights - - \brief computes the inverse distance weight in 3D using the points `p` and `q`, - which are parameterized by a `Kernel` K. - */ -template -typename K::FT inverse_distance_weight( - const CGAL::Point_3& p, - const CGAL::Point_3& q) { } - -#endif // DOXYGEN_RUNNING - -/// \cond SKIP_IN_MANUAL template typename GeomTraits::FT inverse_distance_weight(const typename GeomTraits::Point_2&, const typename GeomTraits::Point_2& r, diff --git a/Weights/include/CGAL/Weights/mean_value_weights.h b/Weights/include/CGAL/Weights/mean_value_weights.h index 810294355ac..0e688e72226 100644 --- a/Weights/include/CGAL/Weights/mean_value_weights.h +++ b/Weights/include/CGAL/Weights/mean_value_weights.h @@ -76,40 +76,6 @@ typename GeomTraits::FT weight(const GeomTraits& traits, } // namespace mean_value_ns -/// \endcond - -#if defined(DOXYGEN_RUNNING) - -/*! - \ingroup PkgWeightsRefMeanValueWeights - - \brief computes the mean value weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT mean_value_weight( - const typename GeomTraits::Point_2& p0, - const typename GeomTraits::Point_2& p1, - const typename GeomTraits::Point_2& p2, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefMeanValueWeights - - \brief computes the mean value weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. -*/ -template -typename K::FT mean_value_weight( - const CGAL::Point_2& p0, - const CGAL::Point_2& p1, - const CGAL::Point_2& p2, - const CGAL::Point_2& q) { } - -#endif // DOXYGEN_RUNNING - -/// \cond SKIP_IN_MANUAL template typename GeomTraits::FT mean_value_weight(const typename GeomTraits::Point_2& t, const typename GeomTraits::Point_2& r, diff --git a/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h b/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h index 0dafc0f198c..4eea980e123 100644 --- a/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h +++ b/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h @@ -19,60 +19,6 @@ namespace CGAL { namespace Weights { -#if defined(DOXYGEN_RUNNING) - -/*! - \ingroup PkgWeightsRefMixedVoronoiRegionWeights - - \brief computes the area of the mixed Voronoi cell in 2D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT mixed_voronoi_area( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefMixedVoronoiRegionWeights - - \brief computes the area of the mixed Voronoi cell in 3D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT mixed_voronoi_area( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefMixedVoronoiRegionWeights - - \brief computes the area of the mixed Voronoi cell in 2D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. -*/ -template -typename K::FT mixed_voronoi_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { } - -/*! - \ingroup PkgWeightsRefMixedVoronoiRegionWeights - - \brief computes the area of the mixed Voronoi cell in 3D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. -*/ -template -typename K::FT mixed_voronoi_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { } - -#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL template typename GeomTraits::FT mixed_voronoi_area(const typename GeomTraits::Point_2& p, diff --git a/Weights/include/CGAL/Weights/shepard_weights.h b/Weights/include/CGAL/Weights/shepard_weights.h index 00e21883d21..7fbc2e7a6e5 100644 --- a/Weights/include/CGAL/Weights/shepard_weights.h +++ b/Weights/include/CGAL/Weights/shepard_weights.h @@ -45,125 +45,6 @@ typename GeomTraits::FT weight(const GeomTraits& traits, } // namespace shepard_ns -/// \endcond - -#if defined(DOXYGEN_RUNNING) - -/*! - \ingroup PkgWeightsRefShepardWeights - - \brief computes the Shepard weight in 2D using the points `p` and `q` and the power parameter `a`, - given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT shepard_weight( - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefShepardWeights - - \brief computes the Shepard weight in 3D using the points `p` and `q` and the power parameter `a`, - given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT shepard_weight( - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefShepardWeights - - \brief computes the Shepard weight in 2D using the points `p` and `q`, - which are parameterized by a `Kernel` K, and the power parameter `a` which - can be omitted. -*/ -template -typename K::FT shepard_weight( - const CGAL::Point_2&, - const CGAL::Point_2& p, - const CGAL::Point_2&, - const CGAL::Point_2& q, - const typename K::FT a = typename K::FT(1)) { } - -/*! - \ingroup PkgWeightsRefShepardWeights - - \brief computes the Shepard weight in 3D using the points `p` and `q`, - which are parameterized by a `Kernel` K, and the power parameter `a` which - can be omitted. -*/ -template -typename K::FT shepard_weight( - const CGAL::Point_3&, - const CGAL::Point_3& p, - const CGAL::Point_3&, - const CGAL::Point_3& q, - const typename K::FT a = typename K::FT(1)) { } - -/*! - \ingroup PkgWeightsRefShepardWeights - - \brief computes the Shepard weight in 2D using the points `p` and `q` and the power parameter `a`, - given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT shepard_weight( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefShepardWeights - - \brief computes the Shepard weight in 3D using the points `p` and `q` and the power parameter `a`, - given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT shepard_weight( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefShepardWeights - - \brief computes the Shepard weight in 2D using the points `p` and `q`, - which are parameterized by a `Kernel` K, and the power parameter `a` which - can be omitted. -*/ -template -typename K::FT shepard_weight( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const typename K::FT a = typename K::FT(1)) { } - -/*! - \ingroup PkgWeightsRefShepardWeights - - \brief computes the Shepard weight in 3D using the points `p` and `q`, - which are parameterized by a `Kernel` K, and the power parameter `a` which - can be omitted. -*/ -template -typename K::FT shepard_weight( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const typename K::FT a = typename K::FT(1)) { } - -#endif // DOXYGEN_RUNNING - -/// \cond SKIP_IN_MANUAL template typename GeomTraits::FT shepard_weight(const typename GeomTraits::Point_2&, const typename GeomTraits::Point_2& r, diff --git a/Weights/include/CGAL/Weights/tangent_weights.h b/Weights/include/CGAL/Weights/tangent_weights.h index 399878326f7..f4f6e5c623f 100644 --- a/Weights/include/CGAL/Weights/tangent_weights.h +++ b/Weights/include/CGAL/Weights/tangent_weights.h @@ -234,64 +234,6 @@ FT half_tangent_weight(const FT d, const FT l, const FT A, const FT D) return half_tangent_weight(tan05, d); } -#if defined(DOXYGEN_RUNNING) - -/*! - \ingroup PkgWeightsRefTangentWeights - - \brief computes the tangent weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT tangent_weight( - const typename GeomTraits::Point_2& p0, - const typename GeomTraits::Point_2& p1, - const typename GeomTraits::Point_2& p2, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefTangentWeights - - \brief computes the tangent weight in 3D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT tangent_weight( - const typename GeomTraits::Point_3& p0, - const typename GeomTraits::Point_3& p1, - const typename GeomTraits::Point_3& p2, - const typename GeomTraits::Point_3& q, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefTangentWeights - - \brief computes the tangent weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. -*/ -template -typename K::FT tangent_weight( - const CGAL::Point_2& p0, - const CGAL::Point_2& p1, - const CGAL::Point_2& p2, - const CGAL::Point_2& q) { } - -/*! - \ingroup PkgWeightsRefTangentWeights - - \brief computes the tangent weight in 3D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. -*/ -template -typename K::FT tangent_weight( - const CGAL::Point_3& p0, - const CGAL::Point_3& p1, - const CGAL::Point_3& p2, - const CGAL::Point_3& q) { } - -#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL template typename GeomTraits::FT tangent_weight(const typename GeomTraits::Point_2& t, diff --git a/Weights/include/CGAL/Weights/three_point_family_weights.h b/Weights/include/CGAL/Weights/three_point_family_weights.h index ce7b0d978a0..44743f8497e 100644 --- a/Weights/include/CGAL/Weights/three_point_family_weights.h +++ b/Weights/include/CGAL/Weights/three_point_family_weights.h @@ -57,44 +57,6 @@ typename GeomTraits::FT weight(const GeomTraits& traits, } // namespace three_point_family_ns -/// \endcond - -#if defined(DOXYGEN_RUNNING) - -/*! - \ingroup PkgWeightsRefThreePointFamilyWeights - - \brief computes the three-point family weight in 2D at `q` using the points `p0`, `p1`, - and `p2` and the power parameter `a`, given a traits class `traits` with geometric objects, - predicates, and constructions. -*/ -template -typename GeomTraits::FT three_point_family_weight( - const typename GeomTraits::Point_2& p0, - const typename GeomTraits::Point_2& p1, - const typename GeomTraits::Point_2& p2, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::FT a, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefThreePointFamilyWeights - - \brief computes the three-point family weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K, and the power parameter `a` which - can be omitted. -*/ -template -typename K::FT three_point_family_weight( - const CGAL::Point_2& p0, - const CGAL::Point_2& p1, - const CGAL::Point_2& p2, - const CGAL::Point_2& q, - const typename K::FT a = typename K::FT(1)) { } - -#endif // DOXYGEN_RUNNING - -/// \cond SKIP_IN_MANUAL template typename GeomTraits::FT three_point_family_weight(const typename GeomTraits::Point_2& t, const typename GeomTraits::Point_2& r, diff --git a/Weights/include/CGAL/Weights/triangular_region_weights.h b/Weights/include/CGAL/Weights/triangular_region_weights.h index bb94af1a332..6975bb38349 100644 --- a/Weights/include/CGAL/Weights/triangular_region_weights.h +++ b/Weights/include/CGAL/Weights/triangular_region_weights.h @@ -19,60 +19,6 @@ namespace CGAL { namespace Weights { -#if defined(DOXYGEN_RUNNING) - -/*! - \ingroup PkgWeightsRefTriangularRegionWeights - - \brief computes the area of the triangular cell in 2D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT triangular_area( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefTriangularRegionWeights - - \brief computes the area of the triangular cell in 3D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT triangular_area( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefTriangularRegionWeights - - \brief computes the area of the triangular cell in 2D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. -*/ -template -typename K::FT triangular_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { } - -/*! - \ingroup PkgWeightsRefTriangularRegionWeights - - \brief computes the area of the triangular cell in 3D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. -*/ -template -typename K::FT triangular_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { } - -#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL template typename GeomTraits::FT triangular_area(const typename GeomTraits::Point_2& p, diff --git a/Weights/include/CGAL/Weights/uniform_region_weights.h b/Weights/include/CGAL/Weights/uniform_region_weights.h index f028c700903..fd5d41179a1 100644 --- a/Weights/include/CGAL/Weights/uniform_region_weights.h +++ b/Weights/include/CGAL/Weights/uniform_region_weights.h @@ -14,66 +14,11 @@ #ifndef CGAL_UNIFORM_REGION_WEIGHTS_H #define CGAL_UNIFORM_REGION_WEIGHTS_H -// Internal includes. #include namespace CGAL { namespace Weights { -#if defined(DOXYGEN_RUNNING) - -/*! - \ingroup PkgWeightsRefUniformRegionWeights - - \brief this function always returns 1, given three points in 2D and a traits class - with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT uniform_area( - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const GeomTraits&) { } - -/*! - \ingroup PkgWeightsRefUniformRegionWeights - - \brief this function always returns 1, given three points in 3D and a traits class - with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT uniform_area( - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const GeomTraits&) { } - -/*! - \ingroup PkgWeightsRefUniformRegionWeights - - \brief this function always returns 1, given three points in 2D which are - parameterized by a `Kernel` K. -*/ -template -typename K::FT uniform_area( - const CGAL::Point_2&, - const CGAL::Point_2&, - const CGAL::Point_2&) { } - -/*! - \ingroup PkgWeightsRefUniformRegionWeights - - \brief this function always returns 1, given three points in 3D which are - parameterized by a `Kernel` K. -*/ -template -typename K::FT uniform_area( - const CGAL::Point_3&, - const CGAL::Point_3&, - const CGAL::Point_3&) { } - -#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL template typename GeomTraits::FT uniform_area(const typename GeomTraits::Point_2&, diff --git a/Weights/include/CGAL/Weights/uniform_weights.h b/Weights/include/CGAL/Weights/uniform_weights.h index 439e0e74075..dd96ca4a9f5 100644 --- a/Weights/include/CGAL/Weights/uniform_weights.h +++ b/Weights/include/CGAL/Weights/uniform_weights.h @@ -14,70 +14,11 @@ #ifndef CGAL_UNIFORM_WEIGHTS_H #define CGAL_UNIFORM_WEIGHTS_H -// Internal includes. #include namespace CGAL { namespace Weights { -#if defined(DOXYGEN_RUNNING) - -/*! - \ingroup PkgWeightsRefUniformWeights - - \brief this function always returns 1, given four points in 2D and a traits class - with geometric objects, predicates, and constructions. - */ -template -typename GeomTraits::FT uniform_weight( - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const GeomTraits&) { } - -/*! - \ingroup PkgWeightsRefUniformWeights - - \brief this function always returns 1, given four points in 3D and a traits class - with geometric objects, predicates, and constructions. - */ -template -typename GeomTraits::FT uniform_weight( - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const GeomTraits&) { } - -/*! - \ingroup PkgWeightsRefUniformWeights - - \brief this function always returns 1, given four points in 2D which are - parameterized by a `Kernel` K. - */ -template -typename K::FT uniform_weight( - const CGAL::Point_2&, - const CGAL::Point_2&, - const CGAL::Point_2&, - const CGAL::Point_2&) { } - -/*! - \ingroup PkgWeightsRefUniformWeights - - \brief this function always returns 1, given four points in 3D which are - parameterized by a `Kernel` K. - */ -template -typename K::FT uniform_weight( - const CGAL::Point_3&, - const CGAL::Point_3&, - const CGAL::Point_3&, - const CGAL::Point_3&) { } - -#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL template typename GeomTraits::FT uniform_weight( diff --git a/Weights/include/CGAL/Weights/utils.h b/Weights/include/CGAL/Weights/utils.h index d28dfe877ba..6c72a4e27c8 100644 --- a/Weights/include/CGAL/Weights/utils.h +++ b/Weights/include/CGAL/Weights/utils.h @@ -14,7 +14,6 @@ #ifndef CGAL_WEIGHTS_UTILS_H #define CGAL_WEIGHTS_UTILS_H -// Internal includes. #include namespace CGAL { diff --git a/Weights/include/CGAL/Weights/voronoi_region_weights.h b/Weights/include/CGAL/Weights/voronoi_region_weights.h index 8497c8aad57..729ae98e8a8 100644 --- a/Weights/include/CGAL/Weights/voronoi_region_weights.h +++ b/Weights/include/CGAL/Weights/voronoi_region_weights.h @@ -19,60 +19,6 @@ namespace CGAL { namespace Weights { -#if defined(DOXYGEN_RUNNING) - -/*! - \ingroup PkgWeightsRefVoronoiRegionWeights - - \brief computes the area of the Voronoi cell in 2D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT voronoi_area( - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefVoronoiRegionWeights - - \brief computes the area of the Voronoi cell in 3D using the points `p`, `q` - and `r`, given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT voronoi_area( - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefVoronoiRegionWeights - - \brief computes the area of the Voronoi cell in 2D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. -*/ -template -typename K::FT voronoi_area( - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) { } - -/*! - \ingroup PkgWeightsRefVoronoiRegionWeights - - \brief computes the area of the Voronoi cell in 3D using the points `p`, `q` - and `r` which are parameterized by a `Kernel` K. -*/ -template -typename K::FT voronoi_area( - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) { } - -#endif // DOXYGEN_RUNNING - /// \cond SKIP_IN_MANUAL template typename GeomTraits::FT voronoi_area(const typename GeomTraits::Point_2& p, diff --git a/Weights/include/CGAL/Weights/wachspress_weights.h b/Weights/include/CGAL/Weights/wachspress_weights.h index 00d843d18d1..c695cfbea4a 100644 --- a/Weights/include/CGAL/Weights/wachspress_weights.h +++ b/Weights/include/CGAL/Weights/wachspress_weights.h @@ -40,40 +40,6 @@ FT weight(const FT A1, const FT A2, const FT C) } // wachspress_ns -/// \endcond - -#if defined(DOXYGEN_RUNNING) - -/*! - \ingroup PkgWeightsRefWachspressWeights - - \brief computes the Wachspress weight in 2D at `q` using the points `p0`, `p1`, - and `p2`, given a traits class `traits` with geometric objects, predicates, and constructions. -*/ -template -typename GeomTraits::FT wachspress_weight( - const typename GeomTraits::Point_2& p0, - const typename GeomTraits::Point_2& p1, - const typename GeomTraits::Point_2& p2, - const typename GeomTraits::Point_2& q, - const GeomTraits& traits) { } - -/*! - \ingroup PkgWeightsRefWachspressWeights - - \brief computes the Wachspress weight in 2D at `q` using the points `p0`, `p1`, - and `p2` which are parameterized by a `Kernel` K. -*/ -template -typename K::FT wachspress_weight( - const CGAL::Point_2& p0, - const CGAL::Point_2& p1, - const CGAL::Point_2& p2, - const CGAL::Point_2& q) { } - -#endif // DOXYGEN_RUNNING - -/// \cond SKIP_IN_MANUAL template typename GeomTraits::FT wachspress_weight(const typename GeomTraits::Point_2& t, const typename GeomTraits::Point_2& r, From d20475f3222d1411c9914586e342af7434d057e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 17 Oct 2022 16:29:32 +0200 Subject: [PATCH 036/194] Add missing includes in Weights --- Weights/include/CGAL/Weights/authalic_weights.h | 6 +++++- Weights/include/CGAL/Weights/barycentric_region_weights.h | 5 ++++- Weights/include/CGAL/Weights/cotangent_weights.h | 8 +++++++- Weights/include/CGAL/Weights/discrete_harmonic_weights.h | 6 ++++++ Weights/include/CGAL/Weights/inverse_distance_weights.h | 3 +++ Weights/include/CGAL/Weights/mean_value_weights.h | 8 ++++++++ .../include/CGAL/Weights/mixed_voronoi_region_weights.h | 3 +++ Weights/include/CGAL/Weights/shepard_weights.h | 4 ++++ Weights/include/CGAL/Weights/tangent_weights.h | 8 ++++++-- Weights/include/CGAL/Weights/three_point_family_weights.h | 3 +++ Weights/include/CGAL/Weights/triangular_region_weights.h | 3 +++ Weights/include/CGAL/Weights/uniform_region_weights.h | 3 ++- Weights/include/CGAL/Weights/uniform_weights.h | 5 ++++- Weights/include/CGAL/Weights/voronoi_region_weights.h | 3 +++ Weights/include/CGAL/Weights/wachspress_weights.h | 8 +++++++- 15 files changed, 68 insertions(+), 8 deletions(-) diff --git a/Weights/include/CGAL/Weights/authalic_weights.h b/Weights/include/CGAL/Weights/authalic_weights.h index 447c58f1bea..316fb62289b 100644 --- a/Weights/include/CGAL/Weights/authalic_weights.h +++ b/Weights/include/CGAL/Weights/authalic_weights.h @@ -14,12 +14,16 @@ #ifndef CGAL_AUTHALIC_WEIGHTS_H #define CGAL_AUTHALIC_WEIGHTS_H -#include +#include + +#include +#include namespace CGAL { namespace Weights { /// \cond SKIP_IN_MANUAL + namespace authalic_ns { template diff --git a/Weights/include/CGAL/Weights/barycentric_region_weights.h b/Weights/include/CGAL/Weights/barycentric_region_weights.h index 4b8d5692bf5..f044887186d 100644 --- a/Weights/include/CGAL/Weights/barycentric_region_weights.h +++ b/Weights/include/CGAL/Weights/barycentric_region_weights.h @@ -14,7 +14,10 @@ #ifndef CGAL_BARYCENTRIC_REGION_WEIGHTS_H #define CGAL_BARYCENTRIC_REGION_WEIGHTS_H -#include +#include + +#include +#include namespace CGAL { namespace Weights { diff --git a/Weights/include/CGAL/Weights/cotangent_weights.h b/Weights/include/CGAL/Weights/cotangent_weights.h index b4096632442..65a5908a51e 100644 --- a/Weights/include/CGAL/Weights/cotangent_weights.h +++ b/Weights/include/CGAL/Weights/cotangent_weights.h @@ -14,7 +14,13 @@ #ifndef CGAL_COTANGENT_WEIGHTS_H #define CGAL_COTANGENT_WEIGHTS_H -#include +#include + +#include +#include +#include +#include +#include namespace CGAL { namespace Weights { diff --git a/Weights/include/CGAL/Weights/discrete_harmonic_weights.h b/Weights/include/CGAL/Weights/discrete_harmonic_weights.h index 5f836d0a2bc..865525dbb5f 100644 --- a/Weights/include/CGAL/Weights/discrete_harmonic_weights.h +++ b/Weights/include/CGAL/Weights/discrete_harmonic_weights.h @@ -17,6 +17,12 @@ #include #include +#include +#include +#include + +#include + namespace CGAL { namespace Weights { diff --git a/Weights/include/CGAL/Weights/inverse_distance_weights.h b/Weights/include/CGAL/Weights/inverse_distance_weights.h index a6774ad509a..9d0927c21ee 100644 --- a/Weights/include/CGAL/Weights/inverse_distance_weights.h +++ b/Weights/include/CGAL/Weights/inverse_distance_weights.h @@ -16,6 +16,9 @@ #include +#include +#include + namespace CGAL { namespace Weights { diff --git a/Weights/include/CGAL/Weights/mean_value_weights.h b/Weights/include/CGAL/Weights/mean_value_weights.h index 0e688e72226..33291d74fa7 100644 --- a/Weights/include/CGAL/Weights/mean_value_weights.h +++ b/Weights/include/CGAL/Weights/mean_value_weights.h @@ -17,10 +17,18 @@ #include #include +#include +#include +#include +#include + +#include + namespace CGAL { namespace Weights { /// \cond SKIP_IN_MANUAL + namespace mean_value_ns { template diff --git a/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h b/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h index 4eea980e123..6808512751f 100644 --- a/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h +++ b/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h @@ -16,6 +16,9 @@ #include +#include +#include + namespace CGAL { namespace Weights { diff --git a/Weights/include/CGAL/Weights/shepard_weights.h b/Weights/include/CGAL/Weights/shepard_weights.h index 7fbc2e7a6e5..2cfbc76b862 100644 --- a/Weights/include/CGAL/Weights/shepard_weights.h +++ b/Weights/include/CGAL/Weights/shepard_weights.h @@ -16,10 +16,14 @@ #include +#include +#include + namespace CGAL { namespace Weights { /// \cond SKIP_IN_MANUAL + namespace shepard_ns { template diff --git a/Weights/include/CGAL/Weights/tangent_weights.h b/Weights/include/CGAL/Weights/tangent_weights.h index f4f6e5c623f..46599707e14 100644 --- a/Weights/include/CGAL/Weights/tangent_weights.h +++ b/Weights/include/CGAL/Weights/tangent_weights.h @@ -14,8 +14,12 @@ #ifndef CGAL_TANGENT_WEIGHTS_H #define CGAL_TANGENT_WEIGHTS_H -// Internal includes. -#include +#include + +#include +#include + +#include namespace CGAL { namespace Weights { diff --git a/Weights/include/CGAL/Weights/three_point_family_weights.h b/Weights/include/CGAL/Weights/three_point_family_weights.h index 44743f8497e..6f2b5f7925f 100644 --- a/Weights/include/CGAL/Weights/three_point_family_weights.h +++ b/Weights/include/CGAL/Weights/three_point_family_weights.h @@ -16,6 +16,9 @@ #include +#include +#include + namespace CGAL { namespace Weights { diff --git a/Weights/include/CGAL/Weights/triangular_region_weights.h b/Weights/include/CGAL/Weights/triangular_region_weights.h index 6975bb38349..9e0f7d2facd 100644 --- a/Weights/include/CGAL/Weights/triangular_region_weights.h +++ b/Weights/include/CGAL/Weights/triangular_region_weights.h @@ -16,6 +16,9 @@ #include +#include +#include + namespace CGAL { namespace Weights { diff --git a/Weights/include/CGAL/Weights/uniform_region_weights.h b/Weights/include/CGAL/Weights/uniform_region_weights.h index fd5d41179a1..a7035fcccdd 100644 --- a/Weights/include/CGAL/Weights/uniform_region_weights.h +++ b/Weights/include/CGAL/Weights/uniform_region_weights.h @@ -14,7 +14,8 @@ #ifndef CGAL_UNIFORM_REGION_WEIGHTS_H #define CGAL_UNIFORM_REGION_WEIGHTS_H -#include +#include +#include namespace CGAL { namespace Weights { diff --git a/Weights/include/CGAL/Weights/uniform_weights.h b/Weights/include/CGAL/Weights/uniform_weights.h index dd96ca4a9f5..be69470d143 100644 --- a/Weights/include/CGAL/Weights/uniform_weights.h +++ b/Weights/include/CGAL/Weights/uniform_weights.h @@ -14,7 +14,10 @@ #ifndef CGAL_UNIFORM_WEIGHTS_H #define CGAL_UNIFORM_WEIGHTS_H -#include +#include +#include + +#include namespace CGAL { namespace Weights { diff --git a/Weights/include/CGAL/Weights/voronoi_region_weights.h b/Weights/include/CGAL/Weights/voronoi_region_weights.h index 729ae98e8a8..5d8f748f26e 100644 --- a/Weights/include/CGAL/Weights/voronoi_region_weights.h +++ b/Weights/include/CGAL/Weights/voronoi_region_weights.h @@ -16,6 +16,9 @@ #include +#include +#include + namespace CGAL { namespace Weights { diff --git a/Weights/include/CGAL/Weights/wachspress_weights.h b/Weights/include/CGAL/Weights/wachspress_weights.h index c695cfbea4a..58face6b47a 100644 --- a/Weights/include/CGAL/Weights/wachspress_weights.h +++ b/Weights/include/CGAL/Weights/wachspress_weights.h @@ -14,14 +14,20 @@ #ifndef CGAL_WACHSPRESS_WEIGHTS_H #define CGAL_WACHSPRESS_WEIGHTS_H -// Internal includes. #include #include +#include +#include +#include + +#include + namespace CGAL { namespace Weights { /// \cond SKIP_IN_MANUAL + namespace wachspress_ns { template From 9a438b26c421092100a23b8fac8f4ec9cbe66776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 17 Oct 2022 16:48:56 +0200 Subject: [PATCH 037/194] Use fewer 'auto's --- .../include/CGAL/Weights/authalic_weights.h | 4 +- .../CGAL/Weights/barycentric_region_weights.h | 22 ++- .../include/CGAL/Weights/cotangent_weights.h | 75 ++++---- .../CGAL/Weights/discrete_harmonic_weights.h | 2 +- .../CGAL/Weights/internal/polygon_utils_2.h | 12 +- Weights/include/CGAL/Weights/internal/utils.h | 182 ++++++++++-------- .../include/CGAL/Weights/mean_value_weights.h | 13 +- .../Weights/mixed_voronoi_region_weights.h | 32 +-- .../include/CGAL/Weights/tangent_weights.h | 81 ++++---- Weights/include/CGAL/Weights/utils.h | 27 +-- .../CGAL/Weights/voronoi_region_weights.h | 22 ++- 11 files changed, 255 insertions(+), 217 deletions(-) diff --git a/Weights/include/CGAL/Weights/authalic_weights.h b/Weights/include/CGAL/Weights/authalic_weights.h index 316fb62289b..6700bdbb6ad 100644 --- a/Weights/include/CGAL/Weights/authalic_weights.h +++ b/Weights/include/CGAL/Weights/authalic_weights.h @@ -89,7 +89,7 @@ typename GeomTraits::FT authalic_weight(const typename GeomTraits::Point_2& t, { using FT = typename GeomTraits::FT; - const auto squared_distance_2 = traits.compute_squared_distance_2_object(); + auto squared_distance_2 = traits.compute_squared_distance_2_object(); const FT cot_gamma = internal::cotangent_2(traits, t, r, q); const FT cot_beta = internal::cotangent_2(traits, q, r, p); @@ -117,7 +117,7 @@ typename GeomTraits::FT authalic_weight(const typename GeomTraits::Point_3& t, { using FT = typename GeomTraits::FT; - const auto squared_distance_3 = traits.compute_squared_distance_3_object(); + auto squared_distance_3 = traits.compute_squared_distance_3_object(); const FT cot_gamma = internal::cotangent_3(traits, t, r, q); const FT cot_beta = internal::cotangent_3(traits, q, r, p); diff --git a/Weights/include/CGAL/Weights/barycentric_region_weights.h b/Weights/include/CGAL/Weights/barycentric_region_weights.h index f044887186d..fe95dedd107 100644 --- a/Weights/include/CGAL/Weights/barycentric_region_weights.h +++ b/Weights/include/CGAL/Weights/barycentric_region_weights.h @@ -29,13 +29,14 @@ typename GeomTraits::FT barycentric_area(const typename GeomTraits::Point_2& p, const GeomTraits& traits) { using FT = typename GeomTraits::FT; + using Point_2 = typename GeomTraits::Point_2; - const auto midpoint_2 = traits.construct_midpoint_2_object(); - const auto centroid_2 = traits.construct_centroid_2_object(); + auto midpoint_2 = traits.construct_midpoint_2_object(); + auto centroid_2 = traits.construct_centroid_2_object(); - const auto center = centroid_2(p, q, r); - const auto m1 = midpoint_2(q, r); - const auto m2 = midpoint_2(q, p); + const Point_2 center = centroid_2(p, q, r); + const Point_2 m1 = midpoint_2(q, r); + const Point_2 m2 = midpoint_2(q, p); const FT A1 = internal::positive_area_2(traits, q, m1, center); const FT A2 = internal::positive_area_2(traits, q, center, m2); @@ -58,13 +59,14 @@ typename GeomTraits::FT barycentric_area(const typename GeomTraits::Point_3& p, const GeomTraits& traits) { using FT = typename GeomTraits::FT; + using Point_3 = typename GeomTraits::Point_3; - const auto midpoint_3 = traits.construct_midpoint_3_object(); - const auto centroid_3 = traits.construct_centroid_3_object(); + auto midpoint_3 = traits.construct_midpoint_3_object(); + auto centroid_3 = traits.construct_centroid_3_object(); - const auto center = centroid_3(p, q, r); - const auto m1 = midpoint_3(q, r); - const auto m2 = midpoint_3(q, p); + const Point_3 center = centroid_3(p, q, r); + const Point_3 m1 = midpoint_3(q, r); + const Point_3 m2 = midpoint_3(q, p); const FT A1 = internal::positive_area_3(traits, q, m1, center); const FT A2 = internal::positive_area_3(traits, q, center, m2); diff --git a/Weights/include/CGAL/Weights/cotangent_weights.h b/Weights/include/CGAL/Weights/cotangent_weights.h index 65a5908a51e..be6b1b7876d 100644 --- a/Weights/include/CGAL/Weights/cotangent_weights.h +++ b/Weights/include/CGAL/Weights/cotangent_weights.h @@ -146,11 +146,11 @@ public: FT weight = FT(0); if (is_border_edge(he, m_pmesh)) { - const auto h1 = next(he, m_pmesh); + const halfedge_descriptor h1 = next(he, m_pmesh); - const auto v0 = target(he, m_pmesh); - const auto v1 = source(he, m_pmesh); - const auto v2 = target(h1, m_pmesh); + const vertex_descriptor v0 = target(he, m_pmesh); + const vertex_descriptor v1 = source(he, m_pmesh); + const vertex_descriptor v2 = target(h1, m_pmesh); const auto& p0 = get(m_pmap, v0); const auto& p1 = get(m_pmap, v1); @@ -161,13 +161,13 @@ public: } else { - const auto h1 = next(he, m_pmesh); - const auto h2 = prev(opposite(he, m_pmesh), m_pmesh); + const halfedge_descriptor h1 = next(he, m_pmesh); + const halfedge_descriptor h2 = prev(opposite(he, m_pmesh), m_pmesh); - const auto v0 = target(he, m_pmesh); - const auto v1 = source(he, m_pmesh); - const auto v2 = target(h1, m_pmesh); - const auto v3 = source(h2, m_pmesh); + const vertex_descriptor v0 = target(he, m_pmesh); + const vertex_descriptor v1 = source(he, m_pmesh); + const vertex_descriptor v2 = target(h1, m_pmesh); + const vertex_descriptor v3 = source(h2, m_pmesh); const auto& p0 = get(m_pmap, v0); const auto& p1 = get(m_pmap, v1); @@ -249,8 +249,8 @@ public: GeomTraits traits; - const auto v0 = target(he, pmesh); - const auto v1 = source(he, pmesh); + const vertex_descriptor v0 = target(he, pmesh); + const vertex_descriptor v1 = source(he, pmesh); const auto& p0 = get(pmap, v0); const auto& p1 = get(pmap, v1); @@ -258,12 +258,12 @@ public: FT weight = FT(0); if (is_border_edge(he, pmesh)) { - const auto he_cw = opposite(next(he, pmesh), pmesh); + const halfedge_descriptor he_cw = opposite(next(he, pmesh), pmesh); auto v2 = source(he_cw, pmesh); if (is_border_edge(he_cw, pmesh)) { - const auto he_ccw = prev(opposite(he, pmesh), pmesh); + const halfedge_descriptor he_ccw = prev(opposite(he, pmesh), pmesh); v2 = source(he_ccw, pmesh); const auto& p2 = get(pmap, v2); @@ -289,10 +289,10 @@ public: } else { - const auto he_cw = opposite(next(he, pmesh), pmesh); - const auto v2 = source(he_cw, pmesh); - const auto he_ccw = prev(opposite(he, pmesh), pmesh); - const auto v3 = source(he_ccw, pmesh); + const halfedge_descriptor he_cw = opposite(next(he, pmesh), pmesh); + const vertex_descriptor v2 = source(he_cw, pmesh); + const halfedge_descriptor he_ccw = prev(opposite(he, pmesh), pmesh); + const vertex_descriptor v3 = source(he_ccw, pmesh); const auto& p2 = get(pmap, v2); const auto& p3 = get(pmap, v3); @@ -331,6 +331,7 @@ class Secure_cotangent_weight_with_voronoi_area { using GeomTraits = typename CGAL::Kernel_traits::value_type>::type; using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; const PolygonMesh& m_pmesh; const VertexPointMap m_pmap; @@ -359,8 +360,8 @@ private: FT cotangent_clamped(const halfedge_descriptor he) const { - const auto v0 = target(he, m_pmesh); - const auto v1 = source(he, m_pmesh); + const vertex_descriptor v0 = target(he, m_pmesh); + const vertex_descriptor v1 = source(he, m_pmesh); const auto& p0 = get(m_pmap, v0); const auto& p1 = get(m_pmap, v1); @@ -368,12 +369,12 @@ private: FT weight = FT(0); if (is_border_edge(he, m_pmesh)) { - const auto he_cw = opposite(next(he, m_pmesh), m_pmesh); - auto v2 = source(he_cw, m_pmesh); + const halfedge_descriptor he_cw = opposite(next(he, m_pmesh), m_pmesh); + vertex_descriptor v2 = source(he_cw, m_pmesh); if (is_border_edge(he_cw, m_pmesh)) { - const auto he_ccw = prev(opposite(he, m_pmesh), m_pmesh); + const halfedge_descriptor he_ccw = prev(opposite(he, m_pmesh), m_pmesh); v2 = source(he_ccw, m_pmesh); const auto& p2 = get(m_pmap, v2); @@ -387,10 +388,10 @@ private: } else { - const auto he_cw = opposite(next(he, m_pmesh), m_pmesh); - const auto v2 = source(he_cw, m_pmesh); - const auto he_ccw = prev(opposite(he, m_pmesh), m_pmesh); - const auto v3 = source(he_ccw, m_pmesh); + const halfedge_descriptor he_cw = opposite(next(he, m_pmesh), m_pmesh); + const vertex_descriptor v2 = source(he_cw, m_pmesh); + const halfedge_descriptor he_ccw = prev(opposite(he, m_pmesh), m_pmesh); + const vertex_descriptor v3 = source(he_ccw, m_pmesh); const auto& p2 = get(m_pmap, v2); const auto& p3 = get(m_pmap, v3); @@ -405,27 +406,27 @@ private: FT voronoi(const vertex_descriptor v0) const { - const auto squared_length_3 = m_traits.compute_squared_length_3_object(); - const auto construct_vector_3 = m_traits.construct_vector_3_object(); + auto squared_length_3 = m_traits.compute_squared_length_3_object(); + auto vector_3 = m_traits.construct_vector_3_object(); FT voronoi_area = FT(0); CGAL_assertion(CGAL::is_triangle_mesh(m_pmesh)); - for (const auto& he : halfedges_around_target(halfedge(v0, m_pmesh), m_pmesh)) + for (const halfedge_descriptor& he : halfedges_around_target(halfedge(v0, m_pmesh), m_pmesh)) { CGAL_assertion(v0 == target(he, m_pmesh)); if (is_border(he, m_pmesh)) continue; - const auto v1 = source(he, m_pmesh); - const auto v2 = target(next(he, m_pmesh), m_pmesh); + const vertex_descriptor v1 = source(he, m_pmesh); + const vertex_descriptor v2 = target(next(he, m_pmesh), m_pmesh); const auto& p0 = get(m_pmap, v0); const auto& p1 = get(m_pmap, v1); const auto& p2 = get(m_pmap, v2); - const auto angle0 = CGAL::angle(p1, p0, p2); - const auto angle1 = CGAL::angle(p2, p1, p0); - const auto angle2 = CGAL::angle(p0, p2, p1); + const Angle angle0 = CGAL::angle(p1, p0, p2); + const Angle angle1 = CGAL::angle(p2, p1, p0); + const Angle angle2 = CGAL::angle(p0, p2, p1); const bool obtuse = (angle0 == CGAL::OBTUSE) || (angle1 == CGAL::OBTUSE) || @@ -436,8 +437,8 @@ private: const FT cot_p1 = internal::cotangent_3(m_traits, p2, p1, p0); const FT cot_p2 = internal::cotangent_3(m_traits, p0, p2, p1); - const auto v1 = construct_vector_3(p0, p1); - const auto v2 = construct_vector_3(p0, p2); + const Vector_3 v1 = vector_3(p0, p1); + const Vector_3 v2 = vector_3(p0, p2); const FT t1 = cot_p1 * squared_length_3(v2); const FT t2 = cot_p2 * squared_length_3(v1); diff --git a/Weights/include/CGAL/Weights/discrete_harmonic_weights.h b/Weights/include/CGAL/Weights/discrete_harmonic_weights.h index 865525dbb5f..ea0b89a923b 100644 --- a/Weights/include/CGAL/Weights/discrete_harmonic_weights.h +++ b/Weights/include/CGAL/Weights/discrete_harmonic_weights.h @@ -57,7 +57,7 @@ typename GeomTraits::FT discrete_harmonic_weight(const typename GeomTraits::Poin { using FT = typename GeomTraits::FT; - const auto squared_distance_2 = traits.compute_squared_distance_2_object(); + auto squared_distance_2 = traits.compute_squared_distance_2_object(); const FT d1 = squared_distance_2(q, t); const FT d2 = squared_distance_2(q, r); diff --git a/Weights/include/CGAL/Weights/internal/polygon_utils_2.h b/Weights/include/CGAL/Weights/internal/polygon_utils_2.h index c52388c7559..f2933317972 100644 --- a/Weights/include/CGAL/Weights/internal/polygon_utils_2.h +++ b/Weights/include/CGAL/Weights/internal/polygon_utils_2.h @@ -101,9 +101,9 @@ Edge_case bounded_side_2(const VertexRange& polygon, if (next == last) return Edge_case::EXTERIOR; - const auto compare_x_2 = traits.compare_x_2_object(); - const auto compare_y_2 = traits.compare_y_2_object(); - const auto orientation_2 = traits.orientation_2_object(); + auto compare_x_2 = traits.compare_x_2_object(); + auto compare_y_2 = traits.compare_y_2_object(); + auto orientation_2 = traits.orientation_2_object(); bool is_inside = false; auto curr_y_comp_res = compare_y_2(get(point_map, *curr), query); @@ -224,15 +224,15 @@ bool is_convex_2(const VertexRange& polygon, if (next == last) return true; - const auto equal_2 = traits.equal_2_object(); + auto equal_2 = traits.equal_2_object(); while (equal_2(get(point_map, *prev), get(point_map, *curr))) { curr = next; ++next; if (next == last) return true; } - const auto less_xy_2 = traits.less_xy_2_object(); - const auto orientation_2 = traits.orientation_2_object(); + auto less_xy_2 = traits.less_xy_2_object(); + auto orientation_2 = traits.orientation_2_object(); bool has_clockwise_triplets = false; bool has_counterclockwise_triplets = false; diff --git a/Weights/include/CGAL/Weights/internal/utils.h b/Weights/include/CGAL/Weights/internal/utils.h index 58eed2cd389..640ef28e789 100644 --- a/Weights/include/CGAL/Weights/internal/utils.h +++ b/Weights/include/CGAL/Weights/internal/utils.h @@ -116,9 +116,9 @@ typename GeomTraits::FT distance_2(const GeomTraits& traits, const typename GeomTraits::Point_2& q) { using Get_sqrt = Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); + auto sqrt = Get_sqrt::sqrt_object(traits); - const auto squared_distance_2 = traits.compute_squared_distance_2_object(); + auto squared_distance_2 = traits.compute_squared_distance_2_object(); return sqrt(squared_distance_2(p, q)); } @@ -128,9 +128,9 @@ typename GeomTraits::FT length_2(const GeomTraits& traits, const typename GeomTraits::Vector_2& v) { using Get_sqrt = Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); + auto sqrt = Get_sqrt::sqrt_object(traits); - const auto squared_length_2 = traits.compute_squared_length_2_object(); + auto squared_length_2 = traits.compute_squared_length_2_object(); return sqrt(squared_length_2(v)); } @@ -155,12 +155,14 @@ typename GeomTraits::FT cotangent_2(const GeomTraits& traits, const typename GeomTraits::Point_2& r) { using FT = typename GeomTraits::FT; - const auto dot_product_2 = traits.compute_scalar_product_2_object(); - const auto cross_product_2 = traits.compute_determinant_2_object(); - const auto construct_vector_2 = traits.construct_vector_2_object(); + using Vector_2 = typename GeomTraits::Vector_2; - const auto v1 = construct_vector_2(q, r); - const auto v2 = construct_vector_2(q, p); + auto dot_product_2 = traits.compute_scalar_product_2_object(); + auto cross_product_2 = traits.compute_determinant_2_object(); + auto construct_vector_2 = traits.construct_vector_2_object(); + + const Vector_2 v1 = construct_vector_2(q, r); + const Vector_2 v2 = construct_vector_2(q, p); const FT dot = dot_product_2(v1, v2); const FT cross = cross_product_2(v1, v2); @@ -181,12 +183,14 @@ typename GeomTraits::FT tangent_2(const GeomTraits& traits, const typename GeomTraits::Point_2& r) { using FT = typename GeomTraits::FT; - const auto dot_product_2 = traits.compute_scalar_product_2_object(); - const auto cross_product_2 = traits.compute_determinant_2_object(); - const auto construct_vector_2 = traits.construct_vector_2_object(); + using Vector_2 = typename GeomTraits::Vector_2; - const auto v1 = construct_vector_2(q, r); - const auto v2 = construct_vector_2(q, p); + auto dot_product_2 = traits.compute_scalar_product_2_object(); + auto cross_product_2 = traits.compute_determinant_2_object(); + auto construct_vector_2 = traits.construct_vector_2_object(); + + const Vector_2 v1 = construct_vector_2(q, r); + const Vector_2 v2 = construct_vector_2(q, p); const FT dot = dot_product_2(v1, v2); const FT cross = cross_product_2(v1, v2); @@ -206,9 +210,9 @@ typename GeomTraits::FT distance_3(const GeomTraits& traits, const typename GeomTraits::Point_3& q) { using Get_sqrt = Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); + auto sqrt = Get_sqrt::sqrt_object(traits); - const auto squared_distance_3 = traits.compute_squared_distance_3_object(); + auto squared_distance_3 = traits.compute_squared_distance_3_object(); return sqrt(squared_distance_3(p, q)); } @@ -217,9 +221,9 @@ typename GeomTraits::FT length_3(const GeomTraits& traits, const typename GeomTraits::Vector_3& v) { using Get_sqrt = Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); + auto sqrt = Get_sqrt::sqrt_object(traits); - const auto squared_length_3 = traits.compute_squared_length_3_object(); + auto squared_length_3 = traits.compute_squared_length_3_object(); return sqrt(squared_length_3(v)); } @@ -244,15 +248,17 @@ typename GeomTraits::FT cotangent_3(const GeomTraits& traits, const typename GeomTraits::Point_3& r) { using FT = typename GeomTraits::FT; - const auto dot_product_3 = traits.compute_scalar_product_3_object(); - const auto cross_product_3 = traits.construct_cross_product_vector_3_object(); - const auto construct_vector_3 = traits.construct_vector_3_object(); + using Vector_3 = typename GeomTraits::Vector_3; - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); + auto dot_product_3 = traits.compute_scalar_product_3_object(); + auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + auto vector_3 = traits.construct_vector_3_object(); + + const Vector_3 v1 = vector_3(q, r); + const Vector_3 v2 = vector_3(q, p); const FT dot = dot_product_3(v1, v2); - const auto cross = cross_product_3(v1, v2); + auto cross = cross_product_3(v1, v2); const FT length = length_3(traits, cross); // TODO: @@ -274,15 +280,17 @@ typename GeomTraits::FT tangent_3(const GeomTraits& traits, const typename GeomTraits::Point_3& r) { using FT = typename GeomTraits::FT; - const auto dot_product_3 = traits.compute_scalar_product_3_object(); - const auto cross_product_3 = traits.construct_cross_product_vector_3_object(); - const auto construct_vector_3 = traits.construct_vector_3_object(); + using Vector_3 = typename GeomTraits::Vector_3; - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); + auto dot_product_3 = traits.compute_scalar_product_3_object(); + auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + auto vector_3 = traits.construct_vector_3_object(); + + const Vector_3 v1 = vector_3(q, r); + const Vector_3 v2 = vector_3(q, p); const FT dot = dot_product_3(v1, v2); - const auto cross = cross_product_3(v1, v2); + auto cross = cross_product_3(v1, v2); const FT length = length_3(traits, cross); // CGAL_assertion(dot != FT(0)); not really necessary @@ -298,7 +306,7 @@ double angle_3(const GeomTraits& traits, const typename GeomTraits::Vector_3& v1, const typename GeomTraits::Vector_3& v2) { - const auto dot_product_3 = traits.compute_scalar_product_3_object(); + auto dot_product_3 = traits.compute_scalar_product_3_object(); const double dot = CGAL::to_double(dot_product_3(v1, v2)); double angle_rad = 0.0; @@ -326,9 +334,9 @@ typename GeomTraits::Point_3 rotate_point_3(const GeomTraits&, const FT s = static_cast(std::sin(angle_rad)); const FT C = FT(1) - c; - const auto x = axis.x(); - const auto y = axis.y(); - const auto z = axis.z(); + const FT x = axis.x(); + const FT y = axis.y(); + const FT z = axis.z(); return Point_3( (x * x * C + c) * query.x() + @@ -349,12 +357,14 @@ void orthogonal_bases_3(const GeomTraits& traits, typename GeomTraits::Vector_3& b1, typename GeomTraits::Vector_3& b2) { + using FT = typename GeomTraits::FT; using Vector_3 = typename GeomTraits::Vector_3; - const auto cross_product_3 = traits.construct_cross_product_vector_3_object(); - const auto nx = normal.x(); - const auto ny = normal.y(); - const auto nz = normal.z(); + auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + + const FT nx = normal.x(); + const FT ny = normal.y(); + const FT nz = normal.z(); if (CGAL::abs(nz) >= CGAL::abs(ny)) b1 = Vector_3(nz, 0, -nx); @@ -375,15 +385,19 @@ typename GeomTraits::Point_2 to_2d(const GeomTraits& traits, const typename GeomTraits::Point_3& origin, const typename GeomTraits::Point_3& query) { + using FT = typename GeomTraits::FT; using Point_2 = typename GeomTraits::Point_2; - const auto dot_product_3 = traits.compute_scalar_product_3_object(); - const auto construct_vector_3 = traits.construct_vector_3_object(); + using Vector_3 = typename GeomTraits::Vector_3; - const auto v = construct_vector_3(origin, query); - const auto x = dot_product_3(b1, v); - const auto y = dot_product_3(b2, v); + auto point_2 = traits.construct_point_2_object(); + auto dot_product_3 = traits.compute_scalar_product_3_object(); + auto vector_3 = traits.construct_vector_3_object(); - return Point_2(x, y); + const Vector_3 v = vector_3(origin, query); + const FT x = dot_product_3(b1, v); + const FT y = dot_product_3(b2, v); + + return point_2(x, y); } // Flattening. @@ -457,12 +471,12 @@ void flatten(const GeomTraits& traits, using Point_3 = typename GeomTraits::Point_3; using Vector_3 = typename GeomTraits::Vector_3; - const auto cross_product_3 = traits.construct_cross_product_vector_3_object(); - const auto construct_vector_3 = traits.construct_vector_3_object(); - const auto centroid_3 = traits.construct_centroid_3_object(); + auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + auto vector_3 = traits.construct_vector_3_object(); + auto centroid_3 = traits.construct_centroid_3_object(); // Compute centroid. - const auto center = centroid_3(t, r, p, q); + const Point_3 center = centroid_3(t, r, p, q); // std::cout << "centroid: " << center << std::endl; // Translate. @@ -477,19 +491,19 @@ void flatten(const GeomTraits& traits, // std::cout << "translated q1: " << q1 << std::endl; // Middle axis. - auto ax = construct_vector_3(q1, r1); + Vector_3 ax = vector_3(q1, r1); normalize_3(traits, ax); // Prev and next vectors. - auto v1 = construct_vector_3(q1, t1); - auto v2 = construct_vector_3(q1, p1); + Vector_3 v1 = vector_3(q1, t1); + Vector_3 v2 = vector_3(q1, p1); normalize_3(traits, v1); normalize_3(traits, v2); // Two triangle normals. - auto n1 = cross_product_3(v1, ax); - auto n2 = cross_product_3(ax, v2); + Vector_3 n1 = cross_product_3(v1, ax); + Vector_3 n2 = cross_product_3(ax, v2); normalize_3(traits, n1); normalize_3(traits, n2); @@ -502,22 +516,22 @@ void flatten(const GeomTraits& traits, // std::cout << "angle deg n1 <-> n2: " << angle_rad * 180.0 / CGAL_PI << std::endl; // Rotate p1 around ax so that it lands onto the plane [q1, t1, r1]. - const auto& t2 = t1; - const auto& r2 = r1; - const auto p2 = rotate_point_3(traits, angle_rad, ax, p1); - const auto& q2 = q1; + const Point_3& t2 = t1; + const Point_3& r2 = r1; + const Point_3 p2 = rotate_point_3(traits, angle_rad, ax, p1); + const Point_3& q2 = q1; // std::cout << "rotated p2: " << p2 << std::endl; // Compute orthogonal base vectors. Vector_3 b1, b2; - const auto& normal = n1; + const Vector_3& normal = n1; orthogonal_bases_3(traits, normal, b1, b2); - // const auto angle12 = angle_3(traits, b1, b2); + // const Angle angle12 = angle_3(traits, b1, b2); // std::cout << "angle deg b1 <-> b2: " << angle12 * 180.0 / CGAL_PI << std::endl; // Flatten a quad. - const auto& origin = q2; + const Point_3& origin = q2; tf = to_2d(traits, b1, b2, origin, t2); rf = to_2d(traits, b1, b2, origin, r2); pf = to_2d(traits, b1, b2, origin, p2); @@ -541,7 +555,7 @@ typename GeomTraits::FT area_2(const GeomTraits& traits, const typename GeomTraits::Point_2& q, const typename GeomTraits::Point_2& r) { - const auto area_2 = traits.compute_area_2_object(); + auto area_2 = traits.compute_area_2_object(); return area_2(p, q, r); } @@ -563,15 +577,16 @@ typename GeomTraits::FT area_3(const GeomTraits& traits, const typename GeomTraits::Point_3& r) { using FT = typename GeomTraits::FT; + using Point_2 = typename GeomTraits::Point_2; using Point_3 = typename GeomTraits::Point_3; using Vector_3 = typename GeomTraits::Vector_3; - const auto cross_product_3 = traits.construct_cross_product_vector_3_object(); - const auto construct_vector_3 = traits.construct_vector_3_object(); - const auto centroid_3 = traits.construct_centroid_3_object(); + auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + auto vector_3 = traits.construct_vector_3_object(); + auto centroid_3 = traits.construct_centroid_3_object(); // Compute centroid. - const auto center = centroid_3(p, q, r); + const Point_3 center = centroid_3(p, q, r); // Translate. const Point_3 a = Point_3(p.x() - center.x(), p.y() - center.y(), p.z() - center.z()); @@ -579,13 +594,13 @@ typename GeomTraits::FT area_3(const GeomTraits& traits, const Point_3 c = Point_3(r.x() - center.x(), r.y() - center.y(), r.z() - center.z()); // Prev and next vectors. - auto v1 = construct_vector_3(b, a); - auto v2 = construct_vector_3(b, c); + Vector_3 v1 = vector_3(b, a); + Vector_3 v2 = vector_3(b, c); normalize_3(traits, v1); normalize_3(traits, v2); // Compute normal. - auto normal = cross_product_3(v1, v2); + Vector_3 normal = cross_product_3(v1, v2); normalize_3(traits, normal); // Compute orthogonal base vectors. @@ -593,10 +608,10 @@ typename GeomTraits::FT area_3(const GeomTraits& traits, orthogonal_bases_3(traits, normal, b1, b2); // Compute area. - const auto& origin = b; - const auto pf = to_2d(traits, b1, b2, origin, a); - const auto qf = to_2d(traits, b1, b2, origin, b); - const auto rf = to_2d(traits, b1, b2, origin, c); + const Point_3& origin = b; + const Point_2 pf = to_2d(traits, b1, b2, origin, a); + const Point_2 qf = to_2d(traits, b1, b2, origin, b); + const Point_2 rf = to_2d(traits, b1, b2, origin, c); const FT A = area_2(traits, pf, qf, rf); return A; @@ -610,14 +625,15 @@ typename GeomTraits::FT positive_area_3(const GeomTraits& traits, const typename GeomTraits::Point_3& r) { using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; - const auto construct_vector_3 = traits.construct_vector_3_object(); - const auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + auto vector_3 = traits.construct_vector_3_object(); + auto cross_product_3 = traits.construct_cross_product_vector_3_object(); - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); + const Vector_3 v1 = vector_3(q, r); + const Vector_3 v2 = vector_3(q, p); - const auto cross = cross_product_3(v1, v2); + Vector_3 cross = cross_product_3(v1, v2); const FT half = FT(1) / FT(2); const FT A = half * length_3(traits, cross); return A; @@ -633,14 +649,16 @@ typename GeomTraits::FT cotangent_3_clamped(const GeomTraits& traits, const typename GeomTraits::Point_3& r) { using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; + using Get_sqrt = Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); + auto sqrt = Get_sqrt::sqrt_object(traits); - const auto dot_product_3 = traits.compute_scalar_product_3_object(); - const auto construct_vector_3 = traits.construct_vector_3_object(); + auto dot_product_3 = traits.compute_scalar_product_3_object(); + auto vector_3 = traits.construct_vector_3_object(); - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); + const Vector_3 v1 = vector_3(q, r); + const Vector_3 v2 = vector_3(q, p); const FT dot = dot_product_3(v1, v2); const FT length_v1 = length_3(traits, v1); diff --git a/Weights/include/CGAL/Weights/mean_value_weights.h b/Weights/include/CGAL/Weights/mean_value_weights.h index 33291d74fa7..c08ccef1c51 100644 --- a/Weights/include/CGAL/Weights/mean_value_weights.h +++ b/Weights/include/CGAL/Weights/mean_value_weights.h @@ -62,7 +62,7 @@ typename GeomTraits::FT weight(const GeomTraits& traits, using FT = typename GeomTraits::FT; using Get_sqrt = internal::Get_sqrt; - const auto sqrt = Get_sqrt::sqrt_object(traits); + auto sqrt = Get_sqrt::sqrt_object(traits); const FT P1 = r1 * r2 + D1; const FT P2 = r2 * r3 + D2; @@ -92,13 +92,14 @@ typename GeomTraits::FT mean_value_weight(const typename GeomTraits::Point_2& t, const GeomTraits& traits) { using FT = typename GeomTraits::FT; + using Vector_2 = typename GeomTraits::Vector_2; - const auto dot_product_2 = traits.compute_scalar_product_2_object(); - const auto construct_vector_2 = traits.construct_vector_2_object(); + auto dot_product_2 = traits.compute_scalar_product_2_object(); + auto construct_vector_2 = traits.construct_vector_2_object(); - const auto v1 = construct_vector_2(q, t); - const auto v2 = construct_vector_2(q, r); - const auto v3 = construct_vector_2(q, p); + const Vector_2 v1 = construct_vector_2(q, t); + const Vector_2 v2 = construct_vector_2(q, r); + const Vector_2 v3 = construct_vector_2(q, p); const FT l1 = internal::length_2(traits, v1); const FT l2 = internal::length_2(traits, v2); diff --git a/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h b/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h index 6808512751f..1e5ab27327c 100644 --- a/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h +++ b/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h @@ -32,13 +32,13 @@ typename GeomTraits::FT mixed_voronoi_area(const typename GeomTraits::Point_2& p using FT = typename GeomTraits::FT; using Point_2 = typename GeomTraits::Point_2; - const auto angle_2 = traits.angle_2_object(); - const auto midpoint_2 = traits.construct_midpoint_2_object(); - const auto circumcenter_2 = traits.construct_circumcenter_2_object(); + auto angle_2 = traits.angle_2_object(); + auto midpoint_2 = traits.construct_midpoint_2_object(); + auto circumcenter_2 = traits.construct_circumcenter_2_object(); - const auto a1 = angle_2(p, q, r); - const auto a2 = angle_2(q, r, p); - const auto a3 = angle_2(r, p, q); + const Angle a1 = angle_2(p, q, r); + const Angle a2 = angle_2(q, r, p); + const Angle a3 = angle_2(r, p, q); Point_2 center; if (a1 != CGAL::OBTUSE && a2 != CGAL::OBTUSE && a3 != CGAL::OBTUSE) @@ -46,8 +46,8 @@ typename GeomTraits::FT mixed_voronoi_area(const typename GeomTraits::Point_2& p else center = midpoint_2(r, p); - const auto m1 = midpoint_2(q, r); - const auto m2 = midpoint_2(q, p); + const Point_2 m1 = midpoint_2(q, r); + const Point_2 m2 = midpoint_2(q, p); const FT A1 = internal::positive_area_2(traits, q, m1, center); const FT A2 = internal::positive_area_2(traits, q, center, m2); @@ -72,13 +72,13 @@ typename GeomTraits::FT mixed_voronoi_area(const typename GeomTraits::Point_3& p using FT = typename GeomTraits::FT; using Point_3 = typename GeomTraits::Point_3; - const auto angle_3 = traits.angle_3_object(); - const auto midpoint_3 = traits.construct_midpoint_3_object(); - const auto circumcenter_3 = traits.construct_circumcenter_3_object(); + auto angle_3 = traits.angle_3_object(); + auto midpoint_3 = traits.construct_midpoint_3_object(); + auto circumcenter_3 = traits.construct_circumcenter_3_object(); - const auto a1 = angle_3(p, q, r); - const auto a2 = angle_3(q, r, p); - const auto a3 = angle_3(r, p, q); + const Angle a1 = angle_3(p, q, r); + const Angle a2 = angle_3(q, r, p); + const Angle a3 = angle_3(r, p, q); Point_3 center; if (a1 != CGAL::OBTUSE && a2 != CGAL::OBTUSE && a3 != CGAL::OBTUSE) @@ -86,8 +86,8 @@ typename GeomTraits::FT mixed_voronoi_area(const typename GeomTraits::Point_3& p else center = midpoint_3(r, p); - const auto m1 = midpoint_3(q, r); - const auto m2 = midpoint_3(q, p); + const Point_3 m1 = midpoint_3(q, r); + const Point_3 m2 = midpoint_3(q, p); const FT A1 = internal::positive_area_3(traits, q, m1, center); const FT A2 = internal::positive_area_3(traits, q, center, m2); diff --git a/Weights/include/CGAL/Weights/tangent_weights.h b/Weights/include/CGAL/Weights/tangent_weights.h index 46599707e14..9986d115bcd 100644 --- a/Weights/include/CGAL/Weights/tangent_weights.h +++ b/Weights/include/CGAL/Weights/tangent_weights.h @@ -103,13 +103,14 @@ typename GeomTraits::FT tangent_weight_v1(const typename GeomTraits::Point_3& t, const GeomTraits& traits) { using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; - const auto dot_product_3 = traits.compute_scalar_product_3_object(); - const auto construct_vector_3 = traits.construct_vector_3_object(); + auto dot_product_3 = traits.compute_scalar_product_3_object(); + auto construct_vector_3 = traits.construct_vector_3_object(); - const auto v1 = construct_vector_3(q, t); - const auto v2 = construct_vector_3(q, r); - const auto v3 = construct_vector_3(q, p); + const Vector_3 v1 = construct_vector_3(q, t); + const Vector_3 v2 = construct_vector_3(q, r); + const Vector_3 v3 = construct_vector_3(q, p); const FT l1 = internal::length_3(traits, v1); const FT l2 = internal::length_3(traits, v2); @@ -134,12 +135,13 @@ typename GeomTraits::FT tangent_weight_v2(const typename GeomTraits::Point_3& t, const GeomTraits& traits) { using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; - const auto construct_vector_3 = traits.construct_vector_3_object(); + auto construct_vector_3 = traits.construct_vector_3_object(); - auto v1 = construct_vector_3(q, t); - auto v2 = construct_vector_3(q, r); - auto v3 = construct_vector_3(q, p); + Vector_3 v1 = construct_vector_3(q, t); + Vector_3 v2 = construct_vector_3(q, r); + Vector_3 v3 = construct_vector_3(q, p); const FT l2 = internal::length_3(traits, v2); @@ -247,12 +249,14 @@ typename GeomTraits::FT tangent_weight(const typename GeomTraits::Point_2& t, const GeomTraits& traits) { using FT = typename GeomTraits::FT; - const auto dot_product_2 = traits.compute_scalar_product_2_object(); - const auto construct_vector_2 = traits.construct_vector_2_object(); + using Vector_2 = typename GeomTraits::Vector_2; - const auto v1 = construct_vector_2(q, t); - const auto v2 = construct_vector_2(q, r); - const auto v3 = construct_vector_2(q, p); + auto dot_product_2 = traits.compute_scalar_product_2_object(); + auto construct_vector_2 = traits.construct_vector_2_object(); + + const Vector_2 v1 = construct_vector_2(q, t); + const Vector_2 v2 = construct_vector_2(q, r); + const Vector_2 v3 = construct_vector_2(q, p); const FT l1 = internal::length_2(traits, v1); const FT l2 = internal::length_2(traits, v2); @@ -327,11 +331,11 @@ public: FT weight = FT(0); if (is_border_edge(he, m_pmesh)) { - const auto h1 = next(he, m_pmesh); + const halfedge_descriptor h1 = next(he, m_pmesh); - const auto v0 = target(he, m_pmesh); - const auto v1 = source(he, m_pmesh); - const auto v2 = target(h1, m_pmesh); + const vertex_descriptor v0 = target(he, m_pmesh); + const vertex_descriptor v1 = source(he, m_pmesh); + const vertex_descriptor v2 = target(h1, m_pmesh); const auto& p0 = get(m_pmap, v0); const auto& p1 = get(m_pmap, v1); @@ -341,13 +345,13 @@ public: } else { - const auto h1 = next(he, m_pmesh); - const auto h2 = prev(opposite(he, m_pmesh), m_pmesh); + const halfedge_descriptor h1 = next(he, m_pmesh); + const halfedge_descriptor h2 = prev(opposite(he, m_pmesh), m_pmesh); - const auto v0 = target(he, m_pmesh); - const auto v1 = source(he, m_pmesh); - const auto v2 = target(h1, m_pmesh); - const auto v3 = source(h2, m_pmesh); + const vertex_descriptor v0 = target(he, m_pmesh); + const vertex_descriptor v1 = source(he, m_pmesh); + const vertex_descriptor v2 = target(h1, m_pmesh); + const vertex_descriptor v3 = source(h2, m_pmesh); const auto& p0 = get(m_pmap, v0); const auto& p1 = get(m_pmap, v1); @@ -375,22 +379,24 @@ public: const CGAL::Point_2& q, const CGAL::Point_2& r) { + using Vector_2 = typename GeomTraits::Vector_2; + const GeomTraits traits; - const auto scalar_product_2 = traits.compute_scalar_product_2_object(); - const auto construct_vector_2 = traits.construct_vector_2_object(); + auto scalar_product_2 = traits.compute_scalar_product_2_object(); + auto construct_vector_2 = traits.construct_vector_2_object(); m_d_r = internal::distance_2(traits, q, r); CGAL_assertion(m_d_r != FT(0)); // two points are identical! m_d_p = internal::distance_2(traits, q, p); CGAL_assertion(m_d_p != FT(0)); // two points are identical! - const auto v1 = construct_vector_2(q, r); - const auto v2 = construct_vector_2(q, p); + const Vector_2 v1 = construct_vector_2(q, r); + const Vector_2 v2 = construct_vector_2(q, p); - const auto A = internal::positive_area_2(traits, p, q, r); + const FT A = internal::positive_area_2(traits, p, q, r); CGAL_assertion(A != FT(0)); // three points are identical! - const auto S = scalar_product_2(v1, v2); + const FT S = scalar_product_2(v1, v2); m_w_base = -tangent_half_angle(m_d_r, m_d_p, A, S); } @@ -399,21 +405,24 @@ public: const CGAL::Point_3& q, const CGAL::Point_3& r) { + using Vector_3 = typename GeomTraits::Vector_3; + const GeomTraits traits; - const auto scalar_product_3 = traits.compute_scalar_product_3_object(); - const auto construct_vector_3 = traits.construct_vector_3_object(); + + auto scalar_product_3 = traits.compute_scalar_product_3_object(); + auto construct_vector_3 = traits.construct_vector_3_object(); m_d_r = internal::distance_3(traits, q, r); CGAL_assertion(m_d_r != FT(0)); // two points are identical! m_d_p = internal::distance_3(traits, q, p); CGAL_assertion(m_d_p != FT(0)); // two points are identical! - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); + const Vector_3 v1 = construct_vector_3(q, r); + const Vector_3 v2 = construct_vector_3(q, p); - const auto A = internal::positive_area_3(traits, p, q, r); + const FT A = internal::positive_area_3(traits, p, q, r); CGAL_assertion(A != FT(0)); // three points are identical! - const auto S = scalar_product_3(v1, v2); + const FT S = scalar_product_3(v1, v2); m_w_base = -tangent_half_angle(m_d_r, m_d_p, A, S); } diff --git a/Weights/include/CGAL/Weights/utils.h b/Weights/include/CGAL/Weights/utils.h index 6c72a4e27c8..fe4f5705afd 100644 --- a/Weights/include/CGAL/Weights/utils.h +++ b/Weights/include/CGAL/Weights/utils.h @@ -104,7 +104,7 @@ typename GeomTraits::FT squared_distance(const CGAL::Point_2& p, const CGAL::Point_2& q) { const GeomTraits traits; - const auto squared_distance_2 = traits.compute_squared_distance_2_object(); + auto squared_distance_2 = traits.compute_squared_distance_2_object(); return squared_distance_2(p, q); } @@ -113,7 +113,7 @@ typename GeomTraits::FT squared_distance(const CGAL::Point_3& p, const CGAL::Point_3& q) { const GeomTraits traits; - const auto squared_distance_3 = traits.compute_squared_distance_3_object(); + auto squared_distance_3 = traits.compute_squared_distance_3_object(); return squared_distance_3(p, q); } @@ -156,13 +156,15 @@ typename GeomTraits::FT scalar_product(const CGAL::Point_2& p, const CGAL::Point_2& q, const CGAL::Point_2& r) { + using Vector_2 = typename GeomTraits::Vector_2; + const GeomTraits traits; - const auto scalar_product_2 = traits.compute_scalar_product_2_object(); - const auto construct_vector_2 = traits.construct_vector_2_object(); + auto scalar_product_2 = traits.compute_scalar_product_2_object(); + auto construct_vector_2 = traits.construct_vector_2_object(); - const auto v1 = construct_vector_2(q, r); - const auto v2 = construct_vector_2(q, p); + const Vector_2 v1 = construct_vector_2(q, r); + const Vector_2 v2 = construct_vector_2(q, p); return scalar_product_2(v1, v2); } @@ -171,12 +173,15 @@ typename GeomTraits::FT scalar_product(const CGAL::Point_3& p, const CGAL::Point_3& q, const CGAL::Point_3& r) { - const GeomTraits traits; - const auto scalar_product_3 = traits.compute_scalar_product_3_object(); - const auto construct_vector_3 = traits.construct_vector_3_object(); + using Vector_3 = typename GeomTraits::Vector_3; - const auto v1 = construct_vector_3(q, r); - const auto v2 = construct_vector_3(q, p); + const GeomTraits traits; + + auto scalar_product_3 = traits.compute_scalar_product_3_object(); + auto vector_3 = traits.construct_vector_3_object(); + + const Vector_3 v1 = vector_3(q, r); + const Vector_3 v2 = vector_3(q, p); return scalar_product_3(v1, v2); } diff --git a/Weights/include/CGAL/Weights/voronoi_region_weights.h b/Weights/include/CGAL/Weights/voronoi_region_weights.h index 5d8f748f26e..61880e73ff8 100644 --- a/Weights/include/CGAL/Weights/voronoi_region_weights.h +++ b/Weights/include/CGAL/Weights/voronoi_region_weights.h @@ -30,13 +30,14 @@ typename GeomTraits::FT voronoi_area(const typename GeomTraits::Point_2& p, const GeomTraits& traits) { using FT = typename GeomTraits::FT; + using Point_2 = typename GeomTraits::Point_2; - const auto circumcenter_2 = traits.construct_circumcenter_2_object(); - const auto midpoint_2 = traits.construct_midpoint_2_object(); + auto circumcenter_2 = traits.construct_circumcenter_2_object(); + auto midpoint_2 = traits.construct_midpoint_2_object(); - const auto center = circumcenter_2(p, q, r); - const auto m1 = midpoint_2(q, r); - const auto m2 = midpoint_2(q, p); + const Point_2 center = circumcenter_2(p, q, r); + const Point_2 m1 = midpoint_2(q, r); + const Point_2 m2 = midpoint_2(q, p); const FT A1 = internal::positive_area_2(traits, q, m1, center); const FT A2 = internal::positive_area_2(traits, q, center, m2); @@ -59,13 +60,14 @@ typename GeomTraits::FT voronoi_area(const typename GeomTraits::Point_3& p, const GeomTraits& traits) { using FT = typename GeomTraits::FT; + using Point_3 = typename GeomTraits::Point_3; - const auto circumcenter_3 = traits.construct_circumcenter_3_object(); - const auto midpoint_3 = traits.construct_midpoint_3_object(); + auto circumcenter_3 = traits.construct_circumcenter_3_object(); + auto midpoint_3 = traits.construct_midpoint_3_object(); - const auto center = circumcenter_3(p, q, r); - const auto m1 = midpoint_3(q, r); - const auto m2 = midpoint_3(q, p); + const Point_3 center = circumcenter_3(p, q, r); + const Point_3 m1 = midpoint_3(q, r); + const Point_3 m2 = midpoint_3(q, p); const FT A1 = internal::positive_area_3(traits, q, m1, center); const FT A2 = internal::positive_area_3(traits, q, center, m2); From 85132eea04c7c8c6994b0b7b8821f4f56c134e51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 17 Oct 2022 17:02:29 +0200 Subject: [PATCH 038/194] More re-indentation --- .../Weights/internal/pmp_weights_deprecated.h | 744 ++++++++---------- 1 file changed, 329 insertions(+), 415 deletions(-) diff --git a/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h b/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h index 942ad0dc8d5..fb44deac937 100644 --- a/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h +++ b/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h @@ -41,19 +41,18 @@ namespace deprecated { // (i.e. for v0, v1, v2 and v2, v1, v0 the returned cot weights can be slightly different). // This one provides stable results. template -struct Cotangent_value_Meyer_impl { - +struct Cotangent_value_Meyer_impl +{ typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; template - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2, - const VertexPointMap& ppmap) { - + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2, + const VertexPointMap& ppmap) + { typedef typename Kernel_traits< - typename boost::property_traits::value_type >::Kernel::Vector_3 Vector; + typename boost::property_traits::value_type >::Kernel::Vector_3 Vector; const Vector a = get(ppmap, v0) - get(ppmap, v1); const Vector b = get(ppmap, v2) - get(ppmap, v1); @@ -66,28 +65,27 @@ struct Cotangent_value_Meyer_impl { // double divider = CGAL::sqrt(dot_aa * dot_bb - dot_ab * dot_ab); const Vector cross_ab = CGAL::cross_product(a, b); - const double divider = CGAL::to_double( - CGAL::approximate_sqrt(cross_ab * cross_ab)); + const double divider = CGAL::to_double(CGAL::approximate_sqrt(cross_ab * cross_ab)); - if (divider == 0.0 /* || divider != divider */) { + if (divider == 0.0 /* || divider != divider */) + { CGAL::collinear(get(ppmap, v0), get(ppmap, v1), get(ppmap, v2)) ? - CGAL_warning_msg(false, "Infinite Cotangent value with the degenerate triangle!") : - CGAL_warning_msg(false, "Infinite Cotangent value due to the floating point arithmetic!"); + CGAL_warning_msg(false, "Infinite Cotangent value with the degenerate triangle!") : + CGAL_warning_msg(false, "Infinite Cotangent value due to the floating point arithmetic!"); - return dot_ab > 0.0 ? - (std::numeric_limits::max)() : - -(std::numeric_limits::max)(); + return dot_ab > 0.0 ? (std::numeric_limits::max)() : + -(std::numeric_limits::max)(); } + return dot_ab / divider; } }; // Same as above but with a different API. -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> -class Cotangent_value_Meyer { - +template::type> +class Cotangent_value_Meyer +{ protected: typedef VertexPointMap Point_property_map; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -98,36 +96,27 @@ protected: Point_property_map ppmap_; public: - Cotangent_value_Meyer( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - pmesh_(pmesh_), - ppmap_(vpmap_) + Cotangent_value_Meyer(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : pmesh_(pmesh_), ppmap_(vpmap_) { } - PolygonMesh& pmesh() { - return pmesh_; - } - - Point_property_map& ppmap() { - return ppmap_; - } - - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { + PolygonMesh& pmesh() { return pmesh_; } + Point_property_map& ppmap() { return ppmap_; } + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { return Cotangent_value_Meyer_impl()(v0, v1, v2, ppmap()); } }; // Imported from skeletonization. -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> -class Cotangent_value_Meyer_secure { - +template::type> +class Cotangent_value_Meyer_secure +{ typedef VertexPointMap Point_property_map; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::property_traits::value_type Point; @@ -137,26 +126,18 @@ class Cotangent_value_Meyer_secure { Point_property_map ppmap_; public: - Cotangent_value_Meyer_secure( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - pmesh_(pmesh_), - ppmap_(vpmap_) + Cotangent_value_Meyer_secure(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : pmesh_(pmesh_), ppmap_(vpmap_) { } - PolygonMesh& pmesh() { - return pmesh_; - } - - Point_property_map& ppmap() { - return ppmap_; - } - - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { + PolygonMesh& pmesh() { return pmesh_; } + Point_property_map& ppmap() { return ppmap_; } + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const Vector a = get(ppmap(), v0) - get(ppmap(), v1); const Vector b = get(ppmap(), v2) - get(ppmap(), v1); @@ -174,37 +155,28 @@ public: // Returns the cotangent value of the half angle [v0, v1, v2] by clamping between // [1, 89] degrees as suggested by -[Friedel] Unconstrained Spherical Parameterization-. -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type, - typename CotangentValue = Cotangent_value_Meyer > -class Cotangent_value_clamped : CotangentValue { - - Cotangent_value_clamped() - { } +template::type, +typename CotangentValue = Cotangent_value_Meyer > +class Cotangent_value_clamped : CotangentValue +{ + Cotangent_value_clamped() { } public: - Cotangent_value_clamped( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Cotangent_value_clamped(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap& ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { - + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const double cot_1 = 57.289962; const double cot_89 = 0.017455; const double value = CotangentValue::operator()(v0, v1, v2); @@ -212,37 +184,28 @@ public: } }; -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type, - typename CotangentValue = Cotangent_value_Meyer > -class Cotangent_value_clamped_2 : CotangentValue { - - Cotangent_value_clamped_2() - { } +template::type, +typename CotangentValue = Cotangent_value_Meyer > +class Cotangent_value_clamped_2 : CotangentValue +{ + Cotangent_value_clamped_2() { } public: - Cotangent_value_clamped_2( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Cotangent_value_clamped_2(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap& ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { - + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const double cot_5 = 5.671282; const double cot_175 = -cot_5; const double value = CotangentValue::operator()(v0, v1, v2); @@ -250,80 +213,66 @@ public: } }; -template< - typename PolygonMesh, - typename CotangentValue = Cotangent_value_Meyer_impl > -struct Cotangent_value_minimum_zero_impl : CotangentValue { - +template > +struct Cotangent_value_minimum_zero_impl + : CotangentValue +{ typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; template - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2, - const VertexPointMap ppmap) { - + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2, + const VertexPointMap ppmap) + { const double value = CotangentValue::operator()(v0, v1, v2, ppmap); return (std::max)(0.0, value); } }; -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type, - typename CotangentValue = Cotangent_value_Meyer > -class Cotangent_value_minimum_zero : CotangentValue { - +template::type, +typename CotangentValue = Cotangent_value_Meyer > +class Cotangent_value_minimum_zero : CotangentValue +{ Cotangent_value_minimum_zero() { } public: - Cotangent_value_minimum_zero( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Cotangent_value_minimum_zero(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap& ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const double value = CotangentValue::operator()(v0, v1, v2); return (std::max)(0.0, value); } }; -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type, - typename CotangentValue = Cotangent_value_Meyer > -class Voronoi_area : CotangentValue { - +template::type, + typename CotangentValue = Cotangent_value_Meyer > +class Voronoi_area + : CotangentValue +{ public: - Voronoi_area( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Voronoi_area(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap& ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::in_edge_iterator in_edge_iterator; @@ -333,13 +282,13 @@ public: typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel::Vector_3 Vector; - double operator()(vertex_descriptor v0) { - + double operator()(vertex_descriptor v0) + { // return 1.0; double voronoi_area = 0.0; for (const halfedge_descriptor he : - halfedges_around_target(halfedge(v0, pmesh()), pmesh())) { - + halfedges_around_target(halfedge(v0, pmesh()), pmesh())) + { if (is_border(he, pmesh()) ) { continue; } CGAL_assertion(CGAL::is_triangle_mesh(pmesh())); @@ -356,12 +305,12 @@ public: const CGAL::Angle angle1 = CGAL::angle(v_op_p, v1_p, v0_p); const CGAL::Angle angle_op = CGAL::angle(v0_p, v_op_p, v1_p); - bool obtuse = - (angle0 == CGAL::OBTUSE) || - (angle1 == CGAL::OBTUSE) || - (angle_op == CGAL::OBTUSE); + bool obtuse = (angle0 == CGAL::OBTUSE) || + (angle1 == CGAL::OBTUSE) || + (angle_op == CGAL::OBTUSE); - if (!obtuse) { + if (!obtuse) + { const double cot_v1 = CotangentValue::operator()(v_op, v1, v0); const double cot_v_op = CotangentValue::operator()(v0, v_op, v1); @@ -369,18 +318,18 @@ public: const double term2 = cot_v_op * to_double((v1_p - v0_p).squared_length()); voronoi_area += (1.0 / 8.0) * (term1 + term2); - } else { - const double area_t = to_double( - CGAL::approximate_sqrt( - CGAL::squared_area(v0_p, v1_p, v_op_p))); + } + else + { + const double area_t = to_double(CGAL::approximate_sqrt(CGAL::squared_area(v0_p, v1_p, v_op_p))); - if (angle0 == CGAL::OBTUSE) { + if (angle0 == CGAL::OBTUSE) voronoi_area += area_t / 2.0; - } else { + else voronoi_area += area_t / 4.0; - } } } + CGAL_warning_msg(voronoi_area != 0.0, "Zero Voronoi area!"); return voronoi_area; } @@ -388,118 +337,103 @@ public: // Returns the cotangent value of the half angle [v0, v1, v2] by dividing the triangle area // as suggested by -[Mullen08] Spectral Conformal Parameterization-. -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type, - typename CotangentValue = Cotangent_value_Meyer > -class Cotangent_value_area_weighted : CotangentValue { - - Cotangent_value_area_weighted() - { } +template::type, + typename CotangentValue = Cotangent_value_Meyer > +class Cotangent_value_area_weighted + : CotangentValue +{ + Cotangent_value_area_weighted() { } public: - Cotangent_value_area_weighted( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : + Cotangent_value_area_weighted(PolygonMesh& pmesh_, + VertexPointMap vpmap_) : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap& ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { - + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { return CotangentValue::operator()(v0, v1, v2) / - CGAL::sqrt(CGAL::squared_area( - get(this->ppmap(), v0), - get(this->ppmap(), v1), - get(this->ppmap(), v2))); + CGAL::sqrt(CGAL::squared_area(get(this->ppmap(), v0), + get(this->ppmap(), v1), + get(this->ppmap(), v2))); } }; // Cotangent weight calculator: // Cotangent_value: as suggested by -[Sorkine07] ARAP Surface Modeling-. // Cotangent_value_area_weighted: as suggested by -[Mullen08] Spectral Conformal Parameterization-. -template< - typename PolygonMesh, - typename CotangentValue = Cotangent_value_minimum_zero_impl > -struct Cotangent_weight_impl : CotangentValue { - +template > +struct Cotangent_weight_impl + : CotangentValue +{ typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; // Returns the cotangent weight of the specified halfedge_descriptor. // Edge orientation is trivial. template - double operator()( - halfedge_descriptor he, - PolygonMesh& pmesh, - const VertexPointMap& ppmap) { - + double operator()(halfedge_descriptor he, + PolygonMesh& pmesh, + const VertexPointMap& ppmap) + { const vertex_descriptor v0 = target(he, pmesh); const vertex_descriptor v1 = source(he, pmesh); // Only one triangle for border edges. - if (is_border_edge(he, pmesh)) { - + if (is_border_edge(he, pmesh)) + { const halfedge_descriptor he_cw = opposite(next(he, pmesh), pmesh); vertex_descriptor v2 = source(he_cw, pmesh); - if (is_border_edge(he_cw, pmesh)) { + if (is_border_edge(he_cw, pmesh)) + { const halfedge_descriptor he_ccw = prev(opposite(he, pmesh), pmesh); v2 = source(he_ccw, pmesh); } - return (CotangentValue::operator()(v0, v2, v1, ppmap) / 2.0); - } else { + return (CotangentValue::operator()(v0, v2, v1, ppmap) / 2.0); + } + else + { const halfedge_descriptor he_cw = opposite(next(he, pmesh), pmesh); const vertex_descriptor v2 = source(he_cw, pmesh); const halfedge_descriptor he_ccw = prev(opposite(he, pmesh), pmesh); const vertex_descriptor v3 = source(he_ccw, pmesh); - return ( - CotangentValue::operator()(v0, v2, v1, ppmap) / 2.0 + - CotangentValue::operator()(v0, v3, v1, ppmap) / 2.0 ); + return (CotangentValue::operator()(v0, v2, v1, ppmap) / 2.0 + + CotangentValue::operator()(v0, v3, v1, ppmap) / 2.0 ); } } }; -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type, - typename CotangentValue = Cotangent_value_minimum_zero > -class Cotangent_weight : CotangentValue { - - Cotangent_weight() - { } +template::type, + typename CotangentValue = Cotangent_value_minimum_zero > +class Cotangent_weight + : CotangentValue +{ + Cotangent_weight() { } public: - Cotangent_weight( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Cotangent_weight(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - Cotangent_weight(PolygonMesh& pmesh_) : - CotangentValue(pmesh_, get(CGAL::vertex_point, pmesh_)) + Cotangent_weight(PolygonMesh& pmesh_) + : CotangentValue(pmesh_, get(CGAL::vertex_point, pmesh_)) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap& ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -510,52 +444,55 @@ public: // Returns the cotangent weight of the specified halfedge_descriptor. // Edge orientation is trivial. - double operator()(halfedge_descriptor he) { + double operator()(halfedge_descriptor he) + { const vertex_descriptor v0 = target(he, pmesh()); const vertex_descriptor v1 = source(he, pmesh()); // Only one triangle for border edges. - if (is_border_edge(he, pmesh())) { - + if (is_border_edge(he, pmesh())) + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); vertex_descriptor v2 = source(he_cw, pmesh()); - if (is_border_edge(he_cw, pmesh())) { + if (is_border_edge(he_cw, pmesh())) + { const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); v2 = source(he_ccw, pmesh()); } - return (CotangentValue::operator()(v0, v2, v1) / 2.0); - } else { + return (CotangentValue::operator()(v0, v2, v1) / 2.0); + } + else + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); const vertex_descriptor v2 = source(he_cw, pmesh()); const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); const vertex_descriptor v3 = source(he_ccw, pmesh()); - return ( - CotangentValue::operator()(v0, v2, v1) / 2.0 + - CotangentValue::operator()(v0, v3, v1) / 2.0 ); + return (CotangentValue::operator()(v0, v2, v1) / 2.0 + + CotangentValue::operator()(v0, v3, v1) / 2.0 ); } } }; // Single cotangent from -[Chao10] Simple Geometric Model for Elastic Deformation. -template< - typename PolygonMesh, - typename CotangentValue = Cotangent_value_Meyer_impl > -struct Single_cotangent_weight_impl : CotangentValue { - +template > +struct Single_cotangent_weight_impl + : CotangentValue +{ typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; // Returns the cotangent of the opposite angle of the edge // 0 for border edges (which does not have an opposite angle). template - double operator()( - halfedge_descriptor he, - PolygonMesh& pmesh, - const VertexPointMap& ppmap) { - - if (is_border(he, pmesh)) { return 0.0; } + double operator()(halfedge_descriptor he, + PolygonMesh& pmesh, + const VertexPointMap& ppmap) + { + if (is_border(he, pmesh)) + return 0.0; const vertex_descriptor v0 = target(he, pmesh); const vertex_descriptor v1 = source(he, pmesh); @@ -564,29 +501,22 @@ struct Single_cotangent_weight_impl : CotangentValue { } }; -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type, - typename CotangentValue = Cotangent_value_Meyer > -class Single_cotangent_weight : CotangentValue { - - Single_cotangent_weight() - { } +template::type, + typename CotangentValue = Cotangent_value_Meyer > +class Single_cotangent_weight + : CotangentValue +{ + Single_cotangent_weight() { } public: - Single_cotangent_weight( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Single_cotangent_weight(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap& ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -597,9 +527,10 @@ public: // Returns the cotangent of the opposite angle of the edge // 0 for border edges (which does not have an opposite angle). - double operator()(halfedge_descriptor he) { - - if (is_border(he, pmesh())) { return 0.0; } + double operator()(halfedge_descriptor he) + { + if (is_border(he, pmesh())) + return 0.0; const vertex_descriptor v0 = target(he, pmesh()); const vertex_descriptor v1 = source(he, pmesh()); @@ -608,12 +539,12 @@ public: } }; -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type, - typename CotangentValue = Cotangent_value_Meyer > -class Cotangent_weight_with_triangle_area : CotangentValue { - +template::type, + typename CotangentValue = Cotangent_value_Meyer > +class Cotangent_weight_with_triangle_area + : CotangentValue +{ typedef PolygonMesh PM; typedef VertexPointMap VPMap; typedef typename boost::property_traits::value_type Point; @@ -621,33 +552,29 @@ class Cotangent_weight_with_triangle_area : CotangentValue { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - Cotangent_weight_with_triangle_area() - { } + Cotangent_weight_with_triangle_area() { } public: - Cotangent_weight_with_triangle_area( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Cotangent_weight_with_triangle_area(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } + PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap& ppmap() { return CotangentValue::ppmap(); } - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } - - double operator()(halfedge_descriptor he) { + double operator()(halfedge_descriptor he) + { const vertex_descriptor v0 = target(he, pmesh()); const vertex_descriptor v1 = source(he, pmesh()); // Only one triangle for border edges. - if (is_border_edge(he, pmesh())) { + if (is_border_edge(he, pmesh())) + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); vertex_descriptor v2 = source(he_cw, pmesh()); - if (is_border_edge(he_cw, pmesh())) { + if (is_border_edge(he_cw, pmesh())) + { const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); v2 = source(he_ccw, pmesh()); } @@ -655,11 +582,11 @@ public: const Point& v0_p = get(ppmap(), v0); const Point& v1_p = get(ppmap(), v1); const Point& v2_p = get(ppmap(), v2); - const double area_t = to_double( - CGAL::sqrt(CGAL::squared_area(v0_p, v1_p, v2_p))); + const double area_t = to_double(CGAL::sqrt(CGAL::squared_area(v0_p, v1_p, v2_p))); return (CotangentValue::operator()(v0, v2, v1) / area_t); - - } else { + } + else + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); const vertex_descriptor v2 = source(he_cw, pmesh()); const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); @@ -672,37 +599,31 @@ public: const double area_t1 = to_double(CGAL::sqrt(CGAL::squared_area(v0_p, v1_p, v2_p))); const double area_t2 = to_double(CGAL::sqrt(CGAL::squared_area(v0_p, v1_p, v3_p))); - return ( - CotangentValue::operator()(v0, v2, v1) / area_t1 + - CotangentValue::operator()(v0, v3, v1) / area_t2 ); + return (CotangentValue::operator()(v0, v2, v1) / area_t1 + + CotangentValue::operator()(v0, v3, v1) / area_t2 ); } + return 0.0; } }; // Mean value calculator described in -[Floater04] Mean Value Coordinates- -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> -class Mean_value_weight { - - // Mean_value_weight() - // {} +template::type> +class Mean_value_weight +{ + // Mean_value_weight() {} PolygonMesh& pmesh_; VertexPointMap vpmap_; public: - Mean_value_weight( - PolygonMesh& pmesh_, - VertexPointMap vpmap) : - pmesh_(pmesh_), - vpmap_(vpmap) + Mean_value_weight(PolygonMesh& pmesh_, + VertexPointMap vpmap) + : pmesh_(pmesh_), vpmap_(vpmap) { } - PolygonMesh& pmesh() { - return pmesh_; - } + PolygonMesh& pmesh() { return pmesh_; } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -714,42 +635,43 @@ public: // Returns the mean-value coordinate of the specified halfedge_descriptor. // Returns different value for different edge orientation (which is a normal // behavior according to the formula). - double operator()(halfedge_descriptor he) { - + double operator()(halfedge_descriptor he) + { const vertex_descriptor v0 = target(he, pmesh()); const vertex_descriptor v1 = source(he, pmesh()); const Vector vec = get(vpmap_, v0) - get(vpmap_, v1); const double norm = CGAL::sqrt(vec.squared_length()); // Only one triangle for border edges. - if (is_border_edge(he, pmesh())) { - + if (is_border_edge(he, pmesh())) + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); vertex_descriptor v2 = source(he_cw, pmesh()); - if (is_border_edge(he_cw, pmesh())) { + if (is_border_edge(he_cw, pmesh())) + { const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); v2 = source(he_ccw, pmesh()); } - return (half_tan_value_2(v1, v0, v2) / norm); - } else { + return (half_tan_value_2(v1, v0, v2) / norm); + } + else + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); const vertex_descriptor v2 = source(he_cw, pmesh()); const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); const vertex_descriptor v3 = source(he_ccw, pmesh()); - return ( - half_tan_value_2(v1, v0, v2) / norm + - half_tan_value_2(v1, v0, v3) / norm); + return (half_tan_value_2(v1, v0, v2) / norm + + half_tan_value_2(v1, v0, v3) / norm); } } private: // Returns the tangent value of the half angle v0_v1_v2 / 2. - double half_tan_value( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { - + double half_tan_value(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const Vector vec0 = get(vpmap_, v1) - get(vpmap_, v2); const Vector vec1 = get(vpmap_, v2) - get(vpmap_, v0); const Vector vec2 = get(vpmap_, v0) - get(vpmap_, v1); @@ -765,11 +687,10 @@ private: } // My deviation built on Meyer_02. - double half_tan_value_2( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { - + double half_tan_value_2(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const Vector a = get(vpmap_, v0) - get(vpmap_, v1); const Vector b = get(vpmap_, v2) - get(vpmap_, v1); const double dot_ab = a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; @@ -787,32 +708,28 @@ private: } }; -template< - typename PolygonMesh, - typename PrimaryWeight = Cotangent_weight, - typename SecondaryWeight = Mean_value_weight > -class Hybrid_weight : public PrimaryWeight, SecondaryWeight { - +template, + typename SecondaryWeight = Mean_value_weight > +class Hybrid_weight + : public PrimaryWeight, SecondaryWeight +{ PrimaryWeight primary; SecondaryWeight secondary; - Hybrid_weight() - { } + Hybrid_weight() { } public: - Hybrid_weight(PolygonMesh& pmesh_) : - primary(pmesh_), - secondary(pmesh_) + Hybrid_weight(PolygonMesh& pmesh_) + : primary(pmesh_), secondary(pmesh_) { } - PolygonMesh& pmesh() { - return primary.pmesh(); - } + PolygonMesh& pmesh() { return primary.pmesh(); } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - double operator()(halfedge_descriptor he) { - + double operator()(halfedge_descriptor he) + { const double weight = primary(he); // if (weight < 0.0) { std::cout << "Negative weight!" << std::endl; } return (weight >= 0.0) ? weight : secondary(he); @@ -821,27 +738,25 @@ public: // Trivial uniform weights (created for test purposes). template -class Uniform_weight { +class Uniform_weight +{ public: typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - double operator()(halfedge_descriptor /* e */) - { return 1.0; } + double operator()(halfedge_descriptor /* e */) { return 1.0; } }; template -class Scale_dependent_weight_fairing { - +class Scale_dependent_weight_fairing +{ PolygonMesh& pmesh_; public: - Scale_dependent_weight_fairing(PolygonMesh& pmesh_) : - pmesh_(pmesh_) + Scale_dependent_weight_fairing(PolygonMesh& pmesh_) + : pmesh_(pmesh_) { } - PolygonMesh& pmesh() { - return pmesh_; - } + PolygonMesh& pmesh() { return pmesh_; } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -852,53 +767,53 @@ public: double w_i(vertex_descriptor /* v_i */) { return 1.0; } - double w_ij(halfedge_descriptor he) { - + double w_ij(halfedge_descriptor he) + { const Vector v = target(he, pmesh())->point() - source(he, pmesh())->point(); const double divider = CGAL::sqrt(v.squared_length()); - if (divider == 0.0) { + if (divider == 0.0) + { CGAL_warning_msg(false, "Scale dependent weight - zero length edge."); return (std::numeric_limits::max)(); } + return 1.0 / divider; } }; -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> -class Cotangent_weight_with_voronoi_area_fairing { - +template::type> +class Cotangent_weight_with_voronoi_area_fairing +{ typedef PolygonMesh PM; typedef VertexPointMap VPMap; Voronoi_area voronoi_functor; Cotangent_weight > cotangent_functor; public: - Cotangent_weight_with_voronoi_area_fairing(PM& pmesh_) : - voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_)), - cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_)) + Cotangent_weight_with_voronoi_area_fairing(PM& pmesh_) + : voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_)), + cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_)) { } - Cotangent_weight_with_voronoi_area_fairing( - PM& pmesh_, - VPMap vpmap_) : - voronoi_functor(pmesh_, vpmap_), - cotangent_functor(pmesh_, vpmap_) + Cotangent_weight_with_voronoi_area_fairing(PM& pmesh_, + VPMap vpmap_) + : voronoi_functor(pmesh_, vpmap_), + cotangent_functor(pmesh_, vpmap_) { } - PM& pmesh() { - return voronoi_functor.pmesh(); - } + PM& pmesh() { return voronoi_functor.pmesh(); } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double w_i(vertex_descriptor v_i) { + double w_i(vertex_descriptor v_i) + { return 0.5 / voronoi_functor(v_i); } - double w_ij(halfedge_descriptor he) { + double w_ij(halfedge_descriptor he) + { return cotangent_functor(he) * 2.0; } }; @@ -906,54 +821,51 @@ public: // Cotangent_value_Meyer has been changed to the version: // Cotangent_value_Meyer_secure to avoid imprecisions from // the issue #4706 - https://github.com/CGAL/cgal/issues/4706. -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> -class Cotangent_weight_with_voronoi_area_fairing_secure { - +template::type> +class Cotangent_weight_with_voronoi_area_fairing_secure +{ typedef PolygonMesh PM; typedef VertexPointMap VPMap; Voronoi_area voronoi_functor; Cotangent_weight > cotangent_functor; public: - Cotangent_weight_with_voronoi_area_fairing_secure(PM& pmesh_) : - voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_)), - cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_)) + Cotangent_weight_with_voronoi_area_fairing_secure(PM& pmesh_) + : voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_)), + cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_)) { } - Cotangent_weight_with_voronoi_area_fairing_secure( - PM& pmesh_, - VPMap vpmap_) : - voronoi_functor(pmesh_, vpmap_), - cotangent_functor(pmesh_, vpmap_) + Cotangent_weight_with_voronoi_area_fairing_secure(PM& pmesh_, + VPMap vpmap_) + : voronoi_functor(pmesh_, vpmap_), + cotangent_functor(pmesh_, vpmap_) { } - PM& pmesh() { - return voronoi_functor.pmesh(); - } + PM& pmesh() { return voronoi_functor.pmesh(); } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double w_i(vertex_descriptor v_i) { + double w_i(vertex_descriptor v_i) + { return 0.5 / voronoi_functor(v_i); } - double w_ij(halfedge_descriptor he) { + double w_ij(halfedge_descriptor he) + { return cotangent_functor(he) * 2.0; } }; template -class Uniform_weight_fairing { - +class Uniform_weight_fairing +{ public: typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - Uniform_weight_fairing(PolygonMesh&) - { } + Uniform_weight_fairing(PolygonMesh&) { } double w_ij(halfedge_descriptor /* e */) { return 1.0; } double w_i(vertex_descriptor /* v_i */) { return 1.0; } @@ -965,4 +877,6 @@ public: } // namespace Weights } // namespace CGAL +#endif // CGAL_NO_DEPRECATED_CODE + #endif // CGAL_WEIGHTS_PMP_DEPRECATED_H From 72163bc009692b082e359a8b127980b943d5280a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 17 Oct 2022 17:54:01 +0200 Subject: [PATCH 039/194] Simply weight computations and use documentation variable names --- .../include/CGAL/Weights/authalic_weights.h | 18 ++--- .../CGAL/Weights/discrete_harmonic_weights.h | 11 ++- Weights/include/CGAL/Weights/internal/utils.h | 14 ++-- .../CGAL/Weights/inverse_distance_weights.h | 4 +- .../include/CGAL/Weights/mean_value_weights.h | 4 +- .../include/CGAL/Weights/shepard_weights.h | 12 +--- .../include/CGAL/Weights/tangent_weights.h | 69 +++++++------------ .../CGAL/Weights/three_point_family_weights.h | 36 +++------- 8 files changed, 60 insertions(+), 108 deletions(-) diff --git a/Weights/include/CGAL/Weights/authalic_weights.h b/Weights/include/CGAL/Weights/authalic_weights.h index 6700bdbb6ad..0e9b18782ad 100644 --- a/Weights/include/CGAL/Weights/authalic_weights.h +++ b/Weights/include/CGAL/Weights/authalic_weights.h @@ -30,11 +30,10 @@ template FT half_weight(const FT cot, const FT r2) { FT w = FT(0); - CGAL_precondition(r2 != FT(0)); - if (r2 != FT(0)) { - const FT inv = FT(2) / r2; - w = cot * inv; - } + CGAL_precondition(!is_zero(r2)); + if (!is_zero(r2)) + w = FT(2) * cot / r2; + return w; } @@ -42,12 +41,9 @@ template FT weight(const FT cot_gamma, const FT cot_beta, const FT r2) { FT w = FT(0); - CGAL_precondition(r2 != FT(0)); - if (r2 != FT(0)) - { - const FT inv = FT(2) / r2; - w = (cot_gamma + cot_beta) * inv; - } + CGAL_precondition(!is_zero(r2)); + if (!is_zero(r2)) + w = FT(2) * (cot_gamma + cot_beta) / r2; return w; } diff --git a/Weights/include/CGAL/Weights/discrete_harmonic_weights.h b/Weights/include/CGAL/Weights/discrete_harmonic_weights.h index ea0b89a923b..514b25eb488 100644 --- a/Weights/include/CGAL/Weights/discrete_harmonic_weights.h +++ b/Weights/include/CGAL/Weights/discrete_harmonic_weights.h @@ -31,17 +31,14 @@ namespace Weights { namespace discrete_harmonic_ns { template -FT weight(const FT r1, const FT r2, const FT r3, +FT weight(const FT d1, const FT d2, const FT d, const FT A1, const FT A2, const FT B) { FT w = FT(0); - CGAL_precondition(A1 != FT(0) && A2 != FT(0)); + CGAL_precondition(!is_zero(A1) && !is_zero(A2)); const FT prod = A1 * A2; - if (prod != FT(0)) - { - const FT inv = FT(1) / prod; - w = (r3 * A1 - r2 * B + r1 * A2) * inv; - } + if (!is_zero(prod)) + w = (d2 * A1 - d * B + d1 * A2) / prod; return w; } diff --git a/Weights/include/CGAL/Weights/internal/utils.h b/Weights/include/CGAL/Weights/internal/utils.h index 640ef28e789..8a0d58341d1 100644 --- a/Weights/include/CGAL/Weights/internal/utils.h +++ b/Weights/include/CGAL/Weights/internal/utils.h @@ -86,8 +86,8 @@ void normalize(std::vector& values) for (const FT& value : values) sum += value; - CGAL_assertion(sum != FT(0)); - if (sum == FT(0)) + CGAL_assertion(!is_zero(sum)); + if (is_zero(sum)) return; const FT inv_sum = FT(1) / sum; @@ -95,14 +95,10 @@ void normalize(std::vector& values) value *= inv_sum; } -// Raises value to the power. -template -typename GeomTraits::FT power(const GeomTraits&, - const typename GeomTraits::FT value, - const typename GeomTraits::FT p) +template +FT power(const FT value, + const FT p) { - using FT = typename GeomTraits::FT; - const double base = CGAL::to_double(value); const double exp = CGAL::to_double(p); diff --git a/Weights/include/CGAL/Weights/inverse_distance_weights.h b/Weights/include/CGAL/Weights/inverse_distance_weights.h index 9d0927c21ee..332d18f9c4a 100644 --- a/Weights/include/CGAL/Weights/inverse_distance_weights.h +++ b/Weights/include/CGAL/Weights/inverse_distance_weights.h @@ -29,8 +29,8 @@ template FT weight(const FT d) { FT w = FT(0); - CGAL_precondition(d != FT(0)); - if (d != FT(0)) + CGAL_precondition(!is_zero(d)); + if (!is_zero(d)) w = FT(1) / d; return w; diff --git a/Weights/include/CGAL/Weights/mean_value_weights.h b/Weights/include/CGAL/Weights/mean_value_weights.h index c08ccef1c51..3271db9cbb0 100644 --- a/Weights/include/CGAL/Weights/mean_value_weights.h +++ b/Weights/include/CGAL/Weights/mean_value_weights.h @@ -68,9 +68,9 @@ typename GeomTraits::FT weight(const GeomTraits& traits, const FT P2 = r2 * r3 + D2; FT w = FT(0); - CGAL_precondition(P1 != FT(0) && P2 != FT(0)); + CGAL_precondition(!is_zero(P1) && !is_zero(P2)); const FT prod = P1 * P2; - if (prod != FT(0)) + if (!is_zero(prod)) { const FT inv = FT(1) / prod; w = FT(2) * (r1 * r3 - D) * inv; diff --git a/Weights/include/CGAL/Weights/shepard_weights.h b/Weights/include/CGAL/Weights/shepard_weights.h index 2cfbc76b862..8c12d55687d 100644 --- a/Weights/include/CGAL/Weights/shepard_weights.h +++ b/Weights/include/CGAL/Weights/shepard_weights.h @@ -34,15 +34,9 @@ typename GeomTraits::FT weight(const GeomTraits& traits, using FT = typename GeomTraits::FT; FT w = FT(0); - CGAL_precondition(d != FT(0)); - if (d != FT(0)) - { - FT denom = d; - if (p != FT(1)) - denom = internal::power(traits, d, p); - - w = FT(1) / denom; - } + CGAL_precondition(is_positive(d)); + if(is_positive(d)) + w = internal::power(d, -p); return w; } diff --git a/Weights/include/CGAL/Weights/tangent_weights.h b/Weights/include/CGAL/Weights/tangent_weights.h index 9986d115bcd..4c4260314fd 100644 --- a/Weights/include/CGAL/Weights/tangent_weights.h +++ b/Weights/include/CGAL/Weights/tangent_weights.h @@ -25,33 +25,16 @@ namespace CGAL { namespace Weights { /// \cond SKIP_IN_MANUAL + namespace tangent_ns { -template -FT half_angle_tangent(const FT r, const FT d, const FT A, const FT D) -{ - FT t = FT(0); - const FT P = r * d + D; - CGAL_precondition(P != FT(0)); - if (P != FT(0)) - { - const FT inv = FT(2) / P; - t = A * inv; - } - - return t; -} - template FT half_weight(const FT t, const FT r) { FT w = FT(0); - CGAL_precondition(r != FT(0)); - if (r != FT(0)) - { - const FT inv = FT(2) / r; - w = t * inv; - } + CGAL_precondition(!is_zero(r)); + if (!is_zero(r)) + w = FT(2) * t / r; return w; } @@ -62,33 +45,27 @@ FT weight(const FT t1, const FT t2, const FT r) FT w = FT(0); CGAL_precondition(r != FT(0)); if (r != FT(0)) - { - const FT inv = FT(2) / r; - w = (t1 + t2) * inv; - } + w = FT(2) * (t1 + t2) / r; return w; } template -FT weight(const FT d1, const FT r, const FT d2, +FT weight(const FT d1, const FT d, const FT d2, const FT A1, const FT A2, const FT D1, const FT D2) { - const FT P1 = d1 * r + D1; - const FT P2 = d2 * r + D2; + const FT P1 = d1 * d + D1; + const FT P2 = d2 * d + D2; FT w = FT(0); - CGAL_precondition(P1 != FT(0) && P2 != FT(0)); - if (P1 != FT(0) && P2 != FT(0)) + CGAL_precondition(!is_zero(P1) && !is_zero(P2)); + if (!is_zero(P1) && !is_zero(P2)) { - const FT inv1 = FT(2) / P1; - const FT inv2 = FT(2) / P2; - const FT t1 = A1 * inv1; - const FT t2 = A2 * inv2; - w = weight(t1, t2, r); + const FT t1 = FT(2) * A1 / P1; + const FT t2 = FT(2) * A2 / P2; + w = weight(t1, t2, d); } - return w; } @@ -168,23 +145,29 @@ typename GeomTraits::FT tangent_weight_v2(const typename GeomTraits::Point_3& t, This function computes the tangent of the half angle using the precomputed distance, area, and dot product values. The returned value is - \f$\frac{2\textbf{A}}{\textbf{d}\textbf{l} + \textbf{D}}\f$. + \f$\frac{2\textbf{A}}{\textbf{d}\textbf{d_1} + \textbf{D_1}}\f$. \tparam FT a model of `FieldNumberType` - \param d the distance value - \param l the distance value + \param d1 the first distance value + \param d2 the second distance value \param A the area value \param D the dot product value - \pre (d * l + D) != 0 + \pre (d1 * d2 + D) != 0 \sa `half_tangent_weight()` */ template -FT tangent_half_angle(const FT d, const FT l, const FT A, const FT D) +FT tangent_half_angle(const FT d1, const FT d2, const FT A, const FT D) { - return tangent_ns::half_angle_tangent(d, l, A, D); + FT t = FT(0); + const FT P = d1 * d2 + D; + CGAL_precondition(!is_zero(P)); + if (!is_zero(P)) + t = FT(2) * A / P; + + return t; } /*! @@ -237,7 +220,7 @@ template FT half_tangent_weight(const FT d, const FT l, const FT A, const FT D) { const FT tan05 = tangent_half_angle(d, l, A, D); - return half_tangent_weight(tan05, d); + return tangent_ns::half_weight(tan05, d); } /// \cond SKIP_IN_MANUAL diff --git a/Weights/include/CGAL/Weights/three_point_family_weights.h b/Weights/include/CGAL/Weights/three_point_family_weights.h index 6f2b5f7925f..f5b08ce9c48 100644 --- a/Weights/include/CGAL/Weights/three_point_family_weights.h +++ b/Weights/include/CGAL/Weights/three_point_family_weights.h @@ -25,36 +25,22 @@ namespace Weights { /// \cond SKIP_IN_MANUAL namespace three_point_family_ns { -template -typename GeomTraits::FT weight(const GeomTraits& traits, - const typename GeomTraits::FT d1, - const typename GeomTraits::FT d2, - const typename GeomTraits::FT d3, - const typename GeomTraits::FT A1, - const typename GeomTraits::FT A2, - const typename GeomTraits::FT B, - const typename GeomTraits::FT p) +template +FT weight(const FT d1, const FT d2, const FT d, + const FT A1, const FT A2, const FT B, + const FT p) { - using FT = typename GeomTraits::FT; - FT w = FT(0); - CGAL_precondition(A1 != FT(0) && A2 != FT(0)); + CGAL_precondition(!is_zero(A1) && !is_zero(A2)); const FT prod = A1 * A2; - if (prod != FT(0)) + if (!is_zero(prod)) { - const FT inv = FT(1) / prod; - FT r1 = d1; - FT r2 = d2; - FT r3 = d3; - if (p != FT(1)) - { - r1 = internal::power(traits, d1, p); - r2 = internal::power(traits, d2, p); - r3 = internal::power(traits, d3, p); - } - w = (r3 * A1 - r2 * B + r1 * A2) * inv; - } + const FT r1 = internal::power(d1, p); + const FT r2 = internal::power(d2, p); + const FT r = internal::power(d , p); + w = (r2 * A1 - r * B + r1 * A2) / prod; + } return w; } From 15de97faf1981888f1eb76d6a3deec97b2d44b8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 17 Oct 2022 21:40:05 +0200 Subject: [PATCH 040/194] Re-organize internal functions and use usual APIs --- Weights/include/CGAL/Weights/internal/utils.h | 314 ++++-------------- Weights/include/CGAL/Weights/utils.h | 293 +++++++++------- 2 files changed, 250 insertions(+), 357 deletions(-) diff --git a/Weights/include/CGAL/Weights/internal/utils.h b/Weights/include/CGAL/Weights/internal/utils.h index 8a0d58341d1..2c01c4e1e30 100644 --- a/Weights/include/CGAL/Weights/internal/utils.h +++ b/Weights/include/CGAL/Weights/internal/utils.h @@ -105,11 +105,12 @@ FT power(const FT value, return static_cast(std::pow(base, exp)); } -// Computes distance between two 2D points. +// 2D ============================================================================================== + template -typename GeomTraits::FT distance_2(const GeomTraits& traits, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q) +typename GeomTraits::FT distance_2(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const GeomTraits& traits) { using Get_sqrt = Get_sqrt; auto sqrt = Get_sqrt::sqrt_object(traits); @@ -118,10 +119,9 @@ typename GeomTraits::FT distance_2(const GeomTraits& traits, return sqrt(squared_distance_2(p, q)); } -// Computes length of a 2D vector. template -typename GeomTraits::FT length_2(const GeomTraits& traits, - const typename GeomTraits::Vector_2& v) +typename GeomTraits::FT length_2(const typename GeomTraits::Vector_2& v, + const GeomTraits& traits) { using Get_sqrt = Get_sqrt; auto sqrt = Get_sqrt::sqrt_object(traits); @@ -131,8 +131,8 @@ typename GeomTraits::FT length_2(const GeomTraits& traits, } template -void normalize_2(const GeomTraits& traits, - typename GeomTraits::Vector_2& v) +void normalize_2(typename GeomTraits::Vector_2& v, + const GeomTraits& traits) { using FT = typename GeomTraits::FT; const FT length = length_2(traits, v); @@ -143,78 +143,24 @@ void normalize_2(const GeomTraits& traits, v /= length; } -// Computes cotanget between two 2D vectors. +// 3D ============================================================================================== + template -typename GeomTraits::FT cotangent_2(const GeomTraits& traits, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r) +typename GeomTraits::FT distance_3(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const GeomTraits& traits) { - using FT = typename GeomTraits::FT; - using Vector_2 = typename GeomTraits::Vector_2; + auto squared_distance_3 = traits.compute_squared_distance_3_object(); - auto dot_product_2 = traits.compute_scalar_product_2_object(); - auto cross_product_2 = traits.compute_determinant_2_object(); - auto construct_vector_2 = traits.construct_vector_2_object(); - - const Vector_2 v1 = construct_vector_2(q, r); - const Vector_2 v2 = construct_vector_2(q, p); - - const FT dot = dot_product_2(v1, v2); - const FT cross = cross_product_2(v1, v2); - - const FT length = CGAL::abs(cross); - // CGAL_assertion(length != FT(0)); not really necessary - if (length != FT(0)) - return dot / length; - else - return FT(0); // undefined -} - -// Computes tanget between two 2D vectors. -template -typename GeomTraits::FT tangent_2(const GeomTraits& traits, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r) -{ - using FT = typename GeomTraits::FT; - using Vector_2 = typename GeomTraits::Vector_2; - - auto dot_product_2 = traits.compute_scalar_product_2_object(); - auto cross_product_2 = traits.compute_determinant_2_object(); - auto construct_vector_2 = traits.construct_vector_2_object(); - - const Vector_2 v1 = construct_vector_2(q, r); - const Vector_2 v2 = construct_vector_2(q, p); - - const FT dot = dot_product_2(v1, v2); - const FT cross = cross_product_2(v1, v2); - - const FT length = CGAL::abs(cross); - // CGAL_assertion(dot != FT(0)); not really necessary - if (dot != FT(0)) - return length / dot; - else - return FT(0); // undefined -} - -// Computes distance between two 3D points. -template -typename GeomTraits::FT distance_3(const GeomTraits& traits, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q) -{ using Get_sqrt = Get_sqrt; auto sqrt = Get_sqrt::sqrt_object(traits); - auto squared_distance_3 = traits.compute_squared_distance_3_object(); return sqrt(squared_distance_3(p, q)); } template -typename GeomTraits::FT length_3(const GeomTraits& traits, - const typename GeomTraits::Vector_3& v) +typename GeomTraits::FT length_3(const typename GeomTraits::Vector_3& v, + const GeomTraits& traits) { using Get_sqrt = Get_sqrt; auto sqrt = Get_sqrt::sqrt_object(traits); @@ -224,8 +170,8 @@ typename GeomTraits::FT length_3(const GeomTraits& traits, } template -void normalize_3(const GeomTraits& traits, - typename GeomTraits::Vector_3& v) +void normalize_3(typename GeomTraits::Vector_3& v, + const GeomTraits& traits) { using FT = typename GeomTraits::FT; @@ -238,71 +184,12 @@ void normalize_3(const GeomTraits& traits, } template -typename GeomTraits::FT cotangent_3(const GeomTraits& traits, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r) -{ - using FT = typename GeomTraits::FT; - using Vector_3 = typename GeomTraits::Vector_3; - - auto dot_product_3 = traits.compute_scalar_product_3_object(); - auto cross_product_3 = traits.construct_cross_product_vector_3_object(); - auto vector_3 = traits.construct_vector_3_object(); - - const Vector_3 v1 = vector_3(q, r); - const Vector_3 v2 = vector_3(q, p); - - const FT dot = dot_product_3(v1, v2); - auto cross = cross_product_3(v1, v2); - - const FT length = length_3(traits, cross); - // TODO: - // Not really necessary: since we handle case length = 0. Does this case happen? - // Yes, e.g. in Surface Parameterization tests. Does it affect the results? - // In current applications, not really. - // CGAL_assertion(length != FT(0)); - if (length != FT(0)) - return dot / length; - else - return FT(0); // undefined -} - -// Computes tanget between two 3D vectors. -template -typename GeomTraits::FT tangent_3(const GeomTraits& traits, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r) -{ - using FT = typename GeomTraits::FT; - using Vector_3 = typename GeomTraits::Vector_3; - - auto dot_product_3 = traits.compute_scalar_product_3_object(); - auto cross_product_3 = traits.construct_cross_product_vector_3_object(); - auto vector_3 = traits.construct_vector_3_object(); - - const Vector_3 v1 = vector_3(q, r); - const Vector_3 v2 = vector_3(q, p); - - const FT dot = dot_product_3(v1, v2); - auto cross = cross_product_3(v1, v2); - - const FT length = length_3(traits, cross); - // CGAL_assertion(dot != FT(0)); not really necessary - if (dot != FT(0)) - return length / dot; - else - return FT(0); // undefined -} - -// Computes 3D angle between two vectors. -template -double angle_3(const GeomTraits& traits, - const typename GeomTraits::Vector_3& v1, - const typename GeomTraits::Vector_3& v2) +double angle_3(const typename GeomTraits::Vector_3& v1, + const typename GeomTraits::Vector_3& v2, + const GeomTraits& traits) { auto dot_product_3 = traits.compute_scalar_product_3_object(); + const double dot = CGAL::to_double(dot_product_3(v1, v2)); double angle_rad = 0.0; @@ -318,10 +205,10 @@ double angle_3(const GeomTraits& traits, // Rotates a 3D point around axis. template -typename GeomTraits::Point_3 rotate_point_3(const GeomTraits&, - const double angle_rad, +typename GeomTraits::Point_3 rotate_point_3(const double angle_rad, const typename GeomTraits::Vector_3& axis, - const typename GeomTraits::Point_3& query) + const typename GeomTraits::Point_3& query, + const GeomTraits& traits) { using FT = typename GeomTraits::FT; using Point_3 = typename GeomTraits::Point_3; @@ -348,10 +235,10 @@ typename GeomTraits::Point_3 rotate_point_3(const GeomTraits&, // Computes two 3D orthogonal base vectors wrt a given normal. template -void orthogonal_bases_3(const GeomTraits& traits, - const typename GeomTraits::Vector_3& normal, +void orthogonal_bases_3(const typename GeomTraits::Vector_3& normal, typename GeomTraits::Vector_3& b1, - typename GeomTraits::Vector_3& b2) + typename GeomTraits::Vector_3& b2, + const GeomTraits& traits) { using FT = typename GeomTraits::FT; using Vector_3 = typename GeomTraits::Vector_3; @@ -369,17 +256,17 @@ void orthogonal_bases_3(const GeomTraits& traits, b2 = cross_product_3(normal, b1); - normalize_3(traits, b1); - normalize_3(traits, b2); + normalize_3(b1, traits); + normalize_3(b2, traits); } // Converts a 3D point into a 2D point wrt to a given plane. template -typename GeomTraits::Point_2 to_2d(const GeomTraits& traits, - const typename GeomTraits::Vector_3& b1, +typename GeomTraits::Point_2 to_2d(const typename GeomTraits::Vector_3& b1, const typename GeomTraits::Vector_3& b2, const typename GeomTraits::Point_3& origin, - const typename GeomTraits::Point_3& query) + const typename GeomTraits::Point_3& query, + const GeomTraits& traits) { using FT = typename GeomTraits::FT; using Point_2 = typename GeomTraits::Point_2; @@ -453,15 +340,15 @@ typename GeomTraits::Point_2 to_2d(const GeomTraits& traits, // Flattens an arbitrary quad into a planar quad. template -void flatten(const GeomTraits& traits, - const typename GeomTraits::Point_3& t, // prev neighbor/vertex/point +void flatten(const typename GeomTraits::Point_3& t, // prev neighbor/vertex/point const typename GeomTraits::Point_3& r, // curr neighbor/vertex/point const typename GeomTraits::Point_3& p, // next neighbor/vertex/point const typename GeomTraits::Point_3& q, // query point typename GeomTraits::Point_2& tf, typename GeomTraits::Point_2& rf, typename GeomTraits::Point_2& pf, - typename GeomTraits::Point_2& qf) + typename GeomTraits::Point_2& qf, + const GeomTraits& traits) { // std::cout << std::endl; using Point_3 = typename GeomTraits::Point_3; @@ -488,89 +375,76 @@ void flatten(const GeomTraits& traits, // Middle axis. Vector_3 ax = vector_3(q1, r1); - normalize_3(traits, ax); + normalize_3(ax, traits); // Prev and next vectors. Vector_3 v1 = vector_3(q1, t1); Vector_3 v2 = vector_3(q1, p1); - normalize_3(traits, v1); - normalize_3(traits, v2); + normalize_3(v1, traits); + normalize_3(v2, traits); // Two triangle normals. Vector_3 n1 = cross_product_3(v1, ax); Vector_3 n2 = cross_product_3(ax, v2); - normalize_3(traits, n1); - normalize_3(traits, n2); + normalize_3(n1, traits); + normalize_3(n2, traits); // std::cout << "normal n1: " << n1 << std::endl; // std::cout << "normal n2: " << n2 << std::endl; // Angle between two normals. - const double angle_rad = angle_3(traits, n1, n2); + const double angle_rad = angle_3(n1, n2, traits); // std::cout << "angle deg n1 <-> n2: " << angle_rad * 180.0 / CGAL_PI << std::endl; // Rotate p1 around ax so that it lands onto the plane [q1, t1, r1]. const Point_3& t2 = t1; const Point_3& r2 = r1; - const Point_3 p2 = rotate_point_3(traits, angle_rad, ax, p1); + const Point_3 p2 = rotate_point_3(angle_rad, ax, p1, traits); const Point_3& q2 = q1; // std::cout << "rotated p2: " << p2 << std::endl; // Compute orthogonal base vectors. Vector_3 b1, b2; const Vector_3& normal = n1; - orthogonal_bases_3(traits, normal, b1, b2); + orthogonal_bases_3(normal, b1, b2, traits); - // const Angle angle12 = angle_3(traits, b1, b2); + // const Angle angle12 = angle_3(b1, b2, traits); // std::cout << "angle deg b1 <-> b2: " << angle12 * 180.0 / CGAL_PI << std::endl; // Flatten a quad. const Point_3& origin = q2; - tf = to_2d(traits, b1, b2, origin, t2); - rf = to_2d(traits, b1, b2, origin, r2); - pf = to_2d(traits, b1, b2, origin, p2); - qf = to_2d(traits, b1, b2, origin, q2); + tf = to_2d(b1, b2, origin, t2, traits); + rf = to_2d(b1, b2, origin, r2, traits); + pf = to_2d(b1, b2, origin, p2, traits); + qf = to_2d(b1, b2, origin, q2, traits); // std::cout << "flattened qf: " << qf << std::endl; // std::cout << "flattened tf: " << tf << std::endl; // std::cout << "flattened rf: " << rf << std::endl; // std::cout << "flattened pf: " << pf << std::endl; - // std::cout << "A1: " << area_2(traits, rf, qf, pf) << std::endl; - // std::cout << "A2: " << area_2(traits, pf, qf, rf) << std::endl; - // std::cout << "C: " << area_2(traits, tf, rf, pf) << std::endl; - // std::cout << "B: " << area_2(traits, pf, qf, tf) << std::endl; + // std::cout << "A1: " << area_2(rf, qf, pf, traits) << std::endl; + // std::cout << "A2: " << area_2(pf, qf, rf, traits) << std::endl; + // std::cout << "C: " << area_2(tf, rf, pf, traits) << std::endl; + // std::cout << "B: " << area_2(pf, qf, tf, traits) << std::endl; } -// Computes area of a 2D triangle. template -typename GeomTraits::FT area_2(const GeomTraits& traits, - const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r) -{ - auto area_2 = traits.compute_area_2_object(); - return area_2(p, q, r); -} - -// Computes positive area of a 2D triangle. -template -typename GeomTraits::FT positive_area_2(const GeomTraits& traits, - const typename GeomTraits::Point_2& p, +typename GeomTraits::FT positive_area_2(const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r) + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) { return CGAL::abs(area_2(traits, p, q, r)); } -// Computes area of a 3D triangle. template -typename GeomTraits::FT area_3(const GeomTraits& traits, - const typename GeomTraits::Point_3& p, +typename GeomTraits::FT area_3(const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r) + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) { using FT = typename GeomTraits::FT; using Point_2 = typename GeomTraits::Point_2; @@ -592,22 +466,22 @@ typename GeomTraits::FT area_3(const GeomTraits& traits, // Prev and next vectors. Vector_3 v1 = vector_3(b, a); Vector_3 v2 = vector_3(b, c); - normalize_3(traits, v1); - normalize_3(traits, v2); + normalize_3(v1, traits); + normalize_3(v2, traits); // Compute normal. Vector_3 normal = cross_product_3(v1, v2); - normalize_3(traits, normal); + normalize_3(normal, traits); // Compute orthogonal base vectors. Vector_3 b1, b2; - orthogonal_bases_3(traits, normal, b1, b2); + orthogonal_bases_3(normal, b1, b2, traits); // Compute area. const Point_3& origin = b; - const Point_2 pf = to_2d(traits, b1, b2, origin, a); - const Point_2 qf = to_2d(traits, b1, b2, origin, b); - const Point_2 rf = to_2d(traits, b1, b2, origin, c); + const Point_2 pf = to_2d(b1, b2, origin, a, traits); + const Point_2 qf = to_2d(b1, b2, origin, b, traits); + const Point_2 rf = to_2d(b1, b2, origin, c, traits); const FT A = area_2(traits, pf, qf, rf); return A; @@ -615,62 +489,18 @@ typename GeomTraits::FT area_3(const GeomTraits& traits, // Computes positive area of a 3D triangle. template -typename GeomTraits::FT positive_area_3(const GeomTraits& traits, - const typename GeomTraits::Point_3& p, +typename GeomTraits::FT positive_area_3(const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r) + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) { using FT = typename GeomTraits::FT; - using Vector_3 = typename GeomTraits::Vector_3; - - auto vector_3 = traits.construct_vector_3_object(); - auto cross_product_3 = traits.construct_cross_product_vector_3_object(); - - const Vector_3 v1 = vector_3(q, r); - const Vector_3 v2 = vector_3(q, p); - - Vector_3 cross = cross_product_3(v1, v2); - const FT half = FT(1) / FT(2); - const FT A = half * length_3(traits, cross); - return A; -} - -// Computes a clamped cotangent between two 3D vectors. -// In the old version of weights in PMP, it has been called secure. -// See Weights/internal/pmp_weights_deprecated.h for more information. -template -typename GeomTraits::FT cotangent_3_clamped(const GeomTraits& traits, - const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r) -{ - using FT = typename GeomTraits::FT; - using Vector_3 = typename GeomTraits::Vector_3; - using Get_sqrt = Get_sqrt; auto sqrt = Get_sqrt::sqrt_object(traits); - auto dot_product_3 = traits.compute_scalar_product_3_object(); - auto vector_3 = traits.construct_vector_3_object(); + auto squared_area_3 = traits.compute_squared_area_3_object(); - const Vector_3 v1 = vector_3(q, r); - const Vector_3 v2 = vector_3(q, p); - - const FT dot = dot_product_3(v1, v2); - const FT length_v1 = length_3(traits, v1); - const FT length_v2 = length_3(traits, v2); - - const FT lb = -FT(999) / FT(1000), ub = FT(999) / FT(1000); - FT cosine = dot / length_v1 / length_v2; - cosine = (cosine < lb) ? lb : cosine; - cosine = (cosine > ub) ? ub : cosine; - const FT sine = sqrt(FT(1) - cosine * cosine); - - CGAL_assertion(sine != FT(0)); - if (sine != FT(0)) - return cosine / sine; - - return FT(0); // undefined + return sqrt(squared_area_3(p, q, r)); } } // namespace internal diff --git a/Weights/include/CGAL/Weights/utils.h b/Weights/include/CGAL/Weights/utils.h index fe4f5705afd..43c0a0945da 100644 --- a/Weights/include/CGAL/Weights/utils.h +++ b/Weights/include/CGAL/Weights/utils.h @@ -16,44 +16,37 @@ #include +#include + namespace CGAL { namespace Weights { /// \cond SKIP_IN_MANUAL -template -typename GeomTraits::FT tangent(const typename GeomTraits::Point_2& p, - const typename GeomTraits::Point_2& q, - const typename GeomTraits::Point_2& r, - const GeomTraits& traits) -{ - return internal::tangent_2(traits, p, q, r); -} +// Computes cotangent between two 2D vectors. template -typename GeomTraits::FT tangent(const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) +typename GeomTraits::FT cotangent_2(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) { - const GeomTraits traits; - return tangent(p, q, r, traits); -} + using FT = typename GeomTraits::FT; + using Vector_2 = typename GeomTraits::Vector_2; -template -typename GeomTraits::FT tangent(const typename GeomTraits::Point_3& p, - const typename GeomTraits::Point_3& q, - const typename GeomTraits::Point_3& r, - const GeomTraits& traits) -{ - return internal::tangent_3(traits, p, q, r); -} + auto dot_product_2 = traits.compute_scalar_product_2_object(); + auto determinant_2 = traits.compute_determinant_2_object(); + auto vector_2 = traits.construct_vector_2_object(); -template -typename GeomTraits::FT tangent(const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) -{ - const GeomTraits traits; - return tangent(p, q, r, traits); + const Vector_2 v1 = vector_2(q, r); + const Vector_2 v2 = vector_2(q, p); + + const FT dot = dot_product_2(v1, v2); + const FT length = CGAL::abs(determinant_2(v1, v2)); + + if (!is_zero(length)) + return dot / length; + else + return FT(0); // undefined } template @@ -62,127 +55,197 @@ typename GeomTraits::FT cotangent(const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2& r, const GeomTraits& traits) { - return internal::cotangent_2(traits, p, q, r); + return cotangent_2(p, q, r, traits); } -template -typename GeomTraits::FT cotangent(const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) +template +typename Kernel::FT cotangent(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) { - const GeomTraits traits; + const Kernel traits; return cotangent(p, q, r, traits); } +// ================================================================================================= + +// Computes cotangent between two 3D vectors. +template +typename GeomTraits::FT cotangent_3(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; + + auto dot_product_3 = traits.compute_scalar_product_3_object(); + auto cross_product_3 = traits.construct_cross_product_vector_3_object(); + auto vector_3 = traits.construct_vector_3_object(); + + const Vector_3 v1 = vector_3(q, r); + const Vector_3 v2 = vector_3(q, p); + + const FT dot = dot_product_3(v1, v2); + const Vector_3 cross = cross_product_3(v1, v2); + + const FT length = internal::length_3(cross, traits); + if (!is_zero(length)) + return dot / length; + else + return FT(0); // undefined +} + template typename GeomTraits::FT cotangent(const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& q, const typename GeomTraits::Point_3& r, const GeomTraits& traits) { - return internal::cotangent_3(traits, p, q, r); + return cotangent_3(p, q, r, traits); } -template -typename GeomTraits::FT cotangent(const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) +template +typename Kernel::FT cotangent(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) { - const GeomTraits traits; + const Kernel traits; return cotangent(p, q, r, traits); } -/// \endcond +// ================================================================================================= -/// \cond SKIP_IN_MANUAL -// These are free functions to be used when building weights from parts rather -// than using the predefined weight functions. In principle, they can be removed. -// They are here to have unified interface within the Weights package and its -// construction weight system. +// Computes tangent between two 2D vectors. template -typename GeomTraits::FT squared_distance(const CGAL::Point_2& p, - const CGAL::Point_2& q) -{ - const GeomTraits traits; - auto squared_distance_2 = traits.compute_squared_distance_2_object(); - return squared_distance_2(p, q); -} - -template -typename GeomTraits::FT squared_distance(const CGAL::Point_3& p, - const CGAL::Point_3& q) -{ - const GeomTraits traits; - auto squared_distance_3 = traits.compute_squared_distance_3_object(); - return squared_distance_3(p, q); -} - -template -typename GeomTraits::FT distance(const CGAL::Point_2& p, - const CGAL::Point_2& q) -{ - const GeomTraits traits; - return internal::distance_2(traits, p, q); -} - -template -typename GeomTraits::FT distance(const CGAL::Point_3& p, - const CGAL::Point_3& q) -{ - const GeomTraits traits; - return internal::distance_3(traits, p, q); -} - -template -typename GeomTraits::FT area(const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) -{ - const GeomTraits traits; - return internal::area_2(traits, p, q, r); -} - -template -typename GeomTraits::FT area(const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) -{ - const GeomTraits traits; - return internal::positive_area_3(traits, p, q, r); -} - -template -typename GeomTraits::FT scalar_product(const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) +typename GeomTraits::FT tangent_2(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) { + using FT = typename GeomTraits::FT; using Vector_2 = typename GeomTraits::Vector_2; - const GeomTraits traits; + auto dot_product_2 = traits.compute_scalar_product_2_object(); + auto determinant_2 = traits.compute_determinant_2_object(); + auto vector_2 = traits.construct_vector_2_object(); - auto scalar_product_2 = traits.compute_scalar_product_2_object(); - auto construct_vector_2 = traits.construct_vector_2_object(); + const Vector_2 v1 = vector_2(q, r); + const Vector_2 v2 = vector_2(q, p); - const Vector_2 v1 = construct_vector_2(q, r); - const Vector_2 v2 = construct_vector_2(q, p); - return scalar_product_2(v1, v2); + const FT dot = dot_product_2(v1, v2); + if (!is_zero(dot)) + { + const FT cross = determinant_2(v1, v2); + const FT length = CGAL::abs(cross); + return length / dot; + } + else + { + return FT(0); // undefined + } } template -typename GeomTraits::FT scalar_product(const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) +typename GeomTraits::FT tangent(const typename GeomTraits::Point_2& p, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& r, + const GeomTraits& traits) { + return tangent_2(p, q, r, traits); +} + +template +typename Kernel::FT tangent(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const Kernel traits; + return tangent(p, q, r, traits); +} + +// ================================================================================================= + +// Computes tangent between two 3D vectors. +template +typename GeomTraits::FT tangent_3(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; using Vector_3 = typename GeomTraits::Vector_3; - const GeomTraits traits; - - auto scalar_product_3 = traits.compute_scalar_product_3_object(); + auto dot_product_3 = traits.compute_scalar_product_3_object(); + auto cross_product_3 = traits.construct_cross_product_vector_3_object(); auto vector_3 = traits.construct_vector_3_object(); const Vector_3 v1 = vector_3(q, r); const Vector_3 v2 = vector_3(q, p); - return scalar_product_3(v1, v2); + + const FT dot = dot_product_3(v1, v2); + if (!is_zero(dot)) + { + const Vector_3 cross = cross_product_3(v1, v2); + const FT length = internal::length_3(cross, traits); + return length / dot; + } + else + { + return FT(0); // undefined + } +} + +template +typename GeomTraits::FT tangent(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + return tangent_3(p, q, r, traits); +} + +template +typename Kernel::FT tangent(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const Kernel traits; + return tangent(p, q, r, traits); +} + +template +typename GeomTraits::FT cotangent_3_clamped(const typename GeomTraits::Point_3& p, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& r, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; + + using Get_sqrt = internal::Get_sqrt; + auto sqrt = Get_sqrt::sqrt_object(traits); + + auto dot_product_3 = traits.compute_scalar_product_3_object(); + auto vector_3 = traits.construct_vector_3_object(); + + const Vector_3 v1 = vector_3(q, r); + const Vector_3 v2 = vector_3(q, p); + + const FT dot = dot_product_3(v1, v2); + const FT length_v1 = internal::length_3(v1, traits); + const FT length_v2 = internal::length_3(v2, traits); + + const FT lb = -FT(999) / FT(1000), + ub = FT(999) / FT(1000); + const FT cosine = boost::algorithm::clamp(dot / (length_v1 * length_v2), lb, ub); + const FT sine = sqrt(FT(1) - square(cosine)); + + CGAL_assertion(!is_zero(sine)); + if (!is_zero(sine)) + return cosine / sine; + + return FT(0); // undefined } /// \endcond From 5f89766c5cf1e74f2c559999221040dde11f29ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Oct 2022 17:17:06 +0200 Subject: [PATCH 041/194] Uniformize notations across the package + re-introduce documentation --- Weights/doc/Weights/PackageDescription.txt | 14 +- .../include/CGAL/Weights/authalic_weights.h | 96 +++--- .../CGAL/Weights/barycentric_region_weights.h | 52 +++- .../include/CGAL/Weights/cotangent_weights.h | 76 +++-- .../CGAL/Weights/discrete_harmonic_weights.h | 104 ++++--- .../CGAL/Weights/inverse_distance_weights.h | 112 +++++-- .../include/CGAL/Weights/mean_value_weights.h | 146 +++++---- .../Weights/mixed_voronoi_region_weights.h | 47 ++- .../include/CGAL/Weights/shepard_weights.h | 137 +++++--- .../include/CGAL/Weights/tangent_weights.h | 292 +++++++++++------- .../CGAL/Weights/three_point_family_weights.h | 107 ++++--- .../CGAL/Weights/triangular_region_weights.h | 51 ++- .../CGAL/Weights/uniform_region_weights.h | 47 ++- .../include/CGAL/Weights/uniform_weights.h | 85 ++--- Weights/include/CGAL/Weights/utils.h | 5 + .../CGAL/Weights/voronoi_region_weights.h | 57 +++- .../include/CGAL/Weights/wachspress_weights.h | 111 ++++--- 17 files changed, 990 insertions(+), 549 deletions(-) diff --git a/Weights/doc/Weights/PackageDescription.txt b/Weights/doc/Weights/PackageDescription.txt index b3c78d87b5f..76186f8025d 100644 --- a/Weights/doc/Weights/PackageDescription.txt +++ b/Weights/doc/Weights/PackageDescription.txt @@ -101,7 +101,7 @@ a model of `AnalyticWeightTraits_3` for 3D points \endverbatim This weight is computed as -\f$w = \frac{d_2^a A_1 - d^a B + d_1^a A_2}{A_1 A_2}\f$ +\f$w = \frac{d_2^a A_0 - d^a B + d_0^a A_2}{A_0 A_2}\f$ with notations shown in the figure below and \f$a\f$ any real number being the power parameter. @@ -142,7 +142,7 @@ a model of `AnalyticWeightTraits_3` for 3D points \endverbatim This weight is computed as -\f$w = \frac{C}{A_1 A_2}\f$ +\f$w = \frac{C}{A_0 A_2}\f$ with notations shown in the figure below. Here, `q` is a query point and the points `p0`, `p1`, and `p2` are its neighbors. @@ -207,10 +207,10 @@ a model of `AnalyticWeightTraits_3` for 3D points \endverbatim This weight is computed as -\f$w = \pm 2 \sqrt{\frac{2 (d_1 d_2 - D)}{(d d_1 + D_1)(d d_2 + D_2)}}\f$ +\f$w = \pm 2 \sqrt{\frac{2 (d_0 d_2 - D)}{(d d_0 + D_0)(d d_2 + D_2)}}\f$ with notations shown in the figure below and dot products -\f$D_1 = (p_0 - q) \cdot (p_1 - q)\f$, +\f$D_0 = (p_0 - q) \cdot (p_1 - q)\f$, \f$D_2 = (p_1 - q) \cdot (p_2 - q)\f$, and \f$D = (p_0 - q) \cdot (p_2 - q)\f$. @@ -247,11 +247,11 @@ a model of `AnalyticWeightTraits_3` for 3D points This weight is computed as \f$w = 2 \frac{t_1 + t_2}{d}\f$, where -\f$t_1 = \frac{2 A_1}{d d_1 + D_1}\f$ and +\f$t_1 = \frac{2 A_0}{d d_0 + D_0}\f$ and \f$t_2 = \frac{2 A_2}{d d_2 + D_2}\f$ with notations shown in the figure below and dot products -\f$D_1 = (p_0 - q) \cdot (p_1 - q)\f$ and +\f$D_0 = (p_0 - q) \cdot (p_1 - q)\f$ and \f$D_2 = (p_1 - q) \cdot (p_2 - q)\f$. Here, `q` is a query point and the points `p0`, `p1`, and `p2` are its neighbors. @@ -283,7 +283,7 @@ a model of `AnalyticWeightTraits_3` for 3D points \endverbatim This weight is computed as -\f$w = \frac{d_2^2 A_1 - d^2 B + d_1^2 A_2}{A_1 A_2}\f$ +\f$w = \frac{d_2^2 A_0 - d^2 B + d_0^2 A_2}{A_0 A_2}\f$ with notations shown in the figure below. Here, `q` is a query point and the points `p0`, `p1`, and `p2` are its neighbors. diff --git a/Weights/include/CGAL/Weights/authalic_weights.h b/Weights/include/CGAL/Weights/authalic_weights.h index 0e9b18782ad..8c3eede9a25 100644 --- a/Weights/include/CGAL/Weights/authalic_weights.h +++ b/Weights/include/CGAL/Weights/authalic_weights.h @@ -57,79 +57,103 @@ FT weight(const FT cot_gamma, const FT cot_beta, const FT r2) \brief computes the half value of the authalic weight. - This function constructs the half of the authalic weight using the precomputed + This function computes the half of the authalic weight using the precomputed cotangent and squared distance values. The returned value is - \f$\frac{2\textbf{cot}}{\textbf{d2}}\f$. + \f$\frac{2\textbf{cot}}{\textbf{sq_d}}\f$. \tparam FT a model of `FieldNumberType` \param cot the cotangent value - \param d2 the squared distance value + \param sq_d the squared distance value - \pre d2 != 0 + \pre sq_d != 0 \sa `authalic_weight()` */ template -FT half_authalic_weight(const FT cot, const FT d2) +FT half_authalic_weight(const FT cot, const FT sq_d) { - return authalic_ns::half_weight(cot, d2); + return authalic_ns::half_weight(cot, sq_d); } +// 2D ============================================================================================== + +/*! + \ingroup PkgWeightsRefAuthalicWeights + \brief computes the authalic weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ template -typename GeomTraits::FT authalic_weight(const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, +typename GeomTraits::FT authalic_weight(const typename GeomTraits::Point_2& p0, + const typename GeomTraits::Point_2& p1, + const typename GeomTraits::Point_2& p2, const typename GeomTraits::Point_2& q, const GeomTraits& traits) { using FT = typename GeomTraits::FT; + const FT cot_gamma = cotangent_2(p0, p1, q, traits); + const FT cot_beta = cotangent_2(q, p1, p2, traits); + auto squared_distance_2 = traits.compute_squared_distance_2_object(); + const FT sq_d = squared_distance_2(q, p1); - const FT cot_gamma = internal::cotangent_2(traits, t, r, q); - const FT cot_beta = internal::cotangent_2(traits, q, r, p); - - const FT d2 = squared_distance_2(q, r); - return authalic_ns::weight(cot_gamma, cot_beta, d2); + return authalic_ns::weight(cot_gamma, cot_beta, sq_d); } -template -typename GeomTraits::FT authalic_weight(const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) +/*! + \ingroup PkgWeightsRefAuthalicWeights + \brief computes the authalic weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT authalic_weight(const CGAL::Point_2& p0, + const CGAL::Point_2& p1, + const CGAL::Point_2& p2, + const CGAL::Point_2& q) { - const GeomTraits traits; - return authalic_weight(t, r, p, q, traits); + const Kernel traits; + return authalic_weight(p0, p1, p2, q, traits); } +// 3D ============================================================================================== + +/*! + \ingroup PkgWeightsRefAuthalicWeights + \brief computes the authalic weight in 3D at `q` using the points `p0`, `p1`, and `p2`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ template -typename GeomTraits::FT authalic_weight(const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, +typename GeomTraits::FT authalic_weight(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, const typename GeomTraits::Point_3& q, const GeomTraits& traits) { using FT = typename GeomTraits::FT; + const FT cot_gamma = cotangent_3(p0, p1, q, traits); + const FT cot_beta = cotangent_3(q, p1, p2, traits); + auto squared_distance_3 = traits.compute_squared_distance_3_object(); + const FT sq_d = squared_distance_3(q, p1); - const FT cot_gamma = internal::cotangent_3(traits, t, r, q); - const FT cot_beta = internal::cotangent_3(traits, q, r, p); - const FT d2 = squared_distance_3(q, r); - - return authalic_ns::weight(cot_gamma, cot_beta, d2); + return authalic_ns::weight(cot_gamma, cot_beta, sq_d); } -template -typename GeomTraits::FT authalic_weight(const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) +/*! + \ingroup PkgWeightsRefAuthalicWeights + \brief computes the authalic weight in 3D at `q` using the points `p0`, `p1`, and `p2`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT authalic_weight(const CGAL::Point_3& p0, + const CGAL::Point_3& p1, + const CGAL::Point_3& p2, + const CGAL::Point_3& q) { - const GeomTraits traits; - return authalic_weight(t, r, p, q, traits); + const Kernel traits; + return authalic_weight(p0, p1, p2, q, traits); } } // namespace Weights diff --git a/Weights/include/CGAL/Weights/barycentric_region_weights.h b/Weights/include/CGAL/Weights/barycentric_region_weights.h index fe95dedd107..7d9f0bf2feb 100644 --- a/Weights/include/CGAL/Weights/barycentric_region_weights.h +++ b/Weights/include/CGAL/Weights/barycentric_region_weights.h @@ -22,6 +22,13 @@ namespace CGAL { namespace Weights { +// 2D ============================================================================================== + +/*! + \ingroup PkgWeightsRefBarycentricRegionWeights + \brief computes the area of the barycentric cell in 2D using the points `p`, `q`, and `r`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ template typename GeomTraits::FT barycentric_area(const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2& q, @@ -38,20 +45,32 @@ typename GeomTraits::FT barycentric_area(const typename GeomTraits::Point_2& p, const Point_2 m1 = midpoint_2(q, r); const Point_2 m2 = midpoint_2(q, p); - const FT A1 = internal::positive_area_2(traits, q, m1, center); - const FT A2 = internal::positive_area_2(traits, q, center, m2); + const FT A1 = internal::positive_area_2(q, m1, center, traits); + const FT A2 = internal::positive_area_2(q, center, m2, traits); return A1 + A2; } -template -typename GeomTraits::FT barycentric_area(const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) +/*! + \ingroup PkgWeightsRefBarycentricRegionWeights + \brief computes the area of the barycentric cell in 2D using the points `p`, `q`, and `r`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT barycentric_area(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) { - const GeomTraits traits; + const Kernel traits; return barycentric_area(p, q, r, traits); } +// 3D ============================================================================================== + +/*! + \ingroup PkgWeightsRefBarycentricRegionWeights + \brief computes the area of the barycentric cell in 3D using the points `p`, `q`, and `r`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ template typename GeomTraits::FT barycentric_area(const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& q, @@ -68,17 +87,22 @@ typename GeomTraits::FT barycentric_area(const typename GeomTraits::Point_3& p, const Point_3 m1 = midpoint_3(q, r); const Point_3 m2 = midpoint_3(q, p); - const FT A1 = internal::positive_area_3(traits, q, m1, center); - const FT A2 = internal::positive_area_3(traits, q, center, m2); + const FT A1 = internal::positive_area_3(q, m1, center, traits); + const FT A2 = internal::positive_area_3(q, center, m2, traits); return A1 + A2; } -template -typename GeomTraits::FT barycentric_area(const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) +/*! + \ingroup PkgWeightsRefBarycentricRegionWeights + \brief computes the area of the barycentric cell in 3D using the points `p`, `q`, and `r`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT barycentric_area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) { - const GeomTraits traits; + const Kernel traits; return barycentric_area(p, q, r, traits); } diff --git a/Weights/include/CGAL/Weights/cotangent_weights.h b/Weights/include/CGAL/Weights/cotangent_weights.h index be6b1b7876d..c7596aa53ee 100644 --- a/Weights/include/CGAL/Weights/cotangent_weights.h +++ b/Weights/include/CGAL/Weights/cotangent_weights.h @@ -65,57 +65,82 @@ FT half_cotangent_weight(const FT cot) return cotangent_ns::half_weight(cot); } +/*! + \ingroup PkgWeightsRefCotangentWeights + \brief computes the cotangent weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ template -typename GeomTraits::FT cotangent_weight(const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, +typename GeomTraits::FT cotangent_weight(const typename GeomTraits::Point_2& p0, + const typename GeomTraits::Point_2& p1, + const typename GeomTraits::Point_2& p2, const typename GeomTraits::Point_2& q, const GeomTraits& traits) { using FT = typename GeomTraits::FT; - const FT cot_beta = internal::cotangent_2(traits, q, t, r); - const FT cot_gamma = internal::cotangent_2(traits, r, p, q); + const FT cot_beta = cotangent_2(q, p0, p1, traits); + const FT cot_gamma = cotangent_2(p1, p2, q, traits); return cotangent_ns::weight(cot_beta, cot_gamma); } -template -typename GeomTraits::FT cotangent_weight(const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) +/*! + \ingroup PkgWeightsRefCotangentWeights + \brief computes the cotangent weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT cotangent_weight(const CGAL::Point_2& p0, + const CGAL::Point_2& p1, + const CGAL::Point_2& p2, + const CGAL::Point_2& q) { - GeomTraits traits; - return cotangent_weight(t, r, p, q, traits); + Kernel traits; + return cotangent_weight(p0, p1, p2, q, traits); } +// 3D ============================================================================================== + +/*! + \ingroup PkgWeightsRefCotangentWeights + \brief computes the cotangent weight in 3D at `q` using the points `p0`, `p1`, and `p2`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ template -typename GeomTraits::FT cotangent_weight(const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, +typename GeomTraits::FT cotangent_weight(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, const typename GeomTraits::Point_3& q, const GeomTraits& traits) { using FT = typename GeomTraits::FT; - const FT cot_beta = internal::cotangent_3(traits, q, t, r); - const FT cot_gamma = internal::cotangent_3(traits, r, p, q); + const FT cot_beta = cotangent_3(q, p0, p1, traits); + const FT cot_gamma = cotangent_3(p1, p2, q, traits); return cotangent_ns::weight(cot_beta, cot_gamma); } -template -typename GeomTraits::FT cotangent_weight(const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) +/*! + \ingroup PkgWeightsRefCotangentWeights + \brief computes the cotangent weight in 3D at `q` using the points `p0`, `p1`, and `p2`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT cotangent_weight(const CGAL::Point_3& p0, + const CGAL::Point_3& p1, + const CGAL::Point_3& p2, + const CGAL::Point_3& q) { - GeomTraits traits; - return cotangent_weight(t, r, p, q, traits); + Kernel traits; + return cotangent_weight(p0, p1, p2, q, traits); } +/// \cond SKIP_IN_MANUAL + // Undocumented cotangent weight class. +// // Its constructor takes a polygon mesh and a vertex to point map // and its operator() is defined based on the halfedge_descriptor only. // This version is currently used in: @@ -219,6 +244,7 @@ public: }; // Undocumented cotangent weight class. +// // Its constructor takes a boolean flag to choose between default and clamped // versions of the cotangent weights and its operator() is defined based on the // halfedge_descriptor, polygon mesh, and vertex to point map. @@ -460,6 +486,8 @@ private: } }; +/// \endcond + } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/discrete_harmonic_weights.h b/Weights/include/CGAL/Weights/discrete_harmonic_weights.h index 514b25eb488..6faa6f189c4 100644 --- a/Weights/include/CGAL/Weights/discrete_harmonic_weights.h +++ b/Weights/include/CGAL/Weights/discrete_harmonic_weights.h @@ -31,82 +31,97 @@ namespace Weights { namespace discrete_harmonic_ns { template -FT weight(const FT d1, const FT d2, const FT d, - const FT A1, const FT A2, const FT B) +FT weight(const FT d0, const FT d2, const FT d, + const FT A0, const FT A2, const FT B) { FT w = FT(0); - CGAL_precondition(!is_zero(A1) && !is_zero(A2)); - const FT prod = A1 * A2; + CGAL_precondition(!is_zero(A0) && !is_zero(A2)); + const FT prod = A0 * A2; if (!is_zero(prod)) - w = (d2 * A1 - d * B + d1 * A2) / prod; + w = (d2 * A0 - d * B + d0 * A2) / prod; return w; } } // namespace discrete_harmonic_ns +/// \endcond + +// 2D ============================================================================================== + +/*! + \ingroup PkgWeightsRefDiscreteHarmonicWeights + \brief computes the discrete harmonic weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ template -typename GeomTraits::FT discrete_harmonic_weight(const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, +typename GeomTraits::FT discrete_harmonic_weight(const typename GeomTraits::Point_2& p0, + const typename GeomTraits::Point_2& p1, + const typename GeomTraits::Point_2& p2, const typename GeomTraits::Point_2& q, const GeomTraits& traits) { using FT = typename GeomTraits::FT; auto squared_distance_2 = traits.compute_squared_distance_2_object(); + auto area_2 = traits.compute_area_2_object(); - const FT d1 = squared_distance_2(q, t); - const FT d2 = squared_distance_2(q, r); - const FT d3 = squared_distance_2(q, p); + const FT d0 = squared_distance_2(q, p0); + const FT d = squared_distance_2(q, p1); + const FT d2 = squared_distance_2(q, p2); - const FT A1 = internal::area_2(traits, r, q, t); - const FT A2 = internal::area_2(traits, p, q, r); - const FT B = internal::area_2(traits, p, q, t); + const FT A0 = area_2(p1, q, p0); + const FT A2 = area_2(p2, q, p1); + const FT B = area_2(p2, q, p0); - return discrete_harmonic_ns::weight(d1, d2, d3, A1, A2, B); + return discrete_harmonic_ns::weight(d0, d2, d, A0, A2, B); } -template -typename GeomTraits::FT discrete_harmonic_weight(const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) +/*! + \ingroup PkgWeightsRefDiscreteHarmonicWeights + \brief computes the discrete harmonic weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT discrete_harmonic_weight(const CGAL::Point_2& p0, + const CGAL::Point_2& p1, + const CGAL::Point_2& p2, + const CGAL::Point_2& q) { - const GeomTraits traits; - return discrete_harmonic_weight(t, r, p, q, traits); + const Kernel traits; + return discrete_harmonic_weight(p0, p1, p2, q, traits); } -namespace internal { +// 3D ============================================================================================== + +/// \cond SKIP_IN_MANUAL template -typename GeomTraits::FT discrete_harmonic_weight(const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, +typename GeomTraits::FT discrete_harmonic_weight(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, const typename GeomTraits::Point_3& q, const GeomTraits& traits) { using Point_2 = typename GeomTraits::Point_2; - Point_2 tf, rf, pf, qf; - internal::flatten(traits, - t, r, p, q, - tf, rf, pf, qf); - return CGAL::Weights::discrete_harmonic_weight(tf, rf, pf, qf, traits); + Point_2 p0f, p1f, p2f, qf; + internal::flatten(p0, p1, p2, q, + p0f, p1f, p2f, qf, + traits); + return discrete_harmonic_weight(p0f, p1f, p2f, qf, traits); } -template -typename GeomTraits::FT discrete_harmonic_weight(const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) +template +typename Kernel::FT discrete_harmonic_weight(const CGAL::Point_3& p0, + const CGAL::Point_3& p1, + const CGAL::Point_3& p2, + const CGAL::Point_3& q) { - const GeomTraits traits; - return discrete_harmonic_weight(t, r, p, q, traits); + const Kernel traits; + return discrete_harmonic_weight(p0, p1, p2, q, traits); } -} // namespace internal - /// \endcond /*! @@ -125,7 +140,7 @@ typename GeomTraits::FT discrete_harmonic_weight(const CGAL::Point_3 \tparam VertexRange a model of `ConstRange` whose iterator type is `RandomAccessIterator` \tparam GeomTraits a model of `AnalyticWeightTraits_2` \tparam PointMap a model of `ReadablePropertyMap` whose key type is `VertexRange::value_type` and - value type is `Point_2`. The default is `CGAL::Identity_property_map`. + value type is `Point_2`. The default is `CGAL::Identity_property_map`. \cgalModels `BarycentricWeights_2` */ @@ -341,9 +356,9 @@ private: \return an output iterator to the element in the destination range, one past the last weight stored - \pre polygon.size() >= 3 - \pre polygon is simple - \pre polygon is strictly convex + \pre `polygon.size() >= 3` + \pre `polygon` is simple + \pre `polygon` is strictly convex */ template OutIterator discrete_harmonic_weights_2(const PointRange& polygon, diff --git a/Weights/include/CGAL/Weights/inverse_distance_weights.h b/Weights/include/CGAL/Weights/inverse_distance_weights.h index 332d18f9c4a..34e7a69bddd 100644 --- a/Weights/include/CGAL/Weights/inverse_distance_weights.h +++ b/Weights/include/CGAL/Weights/inverse_distance_weights.h @@ -38,29 +38,53 @@ FT weight(const FT d) } // namespace inverse_distance_ns +/// \endcond + +/*! + \ingroup PkgWeightsRefInverseDistanceWeights + \brief computes the inverse distance weight in 2D using the points `p` and `q`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ template typename GeomTraits::FT inverse_distance_weight(const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& r, + const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2&, const typename GeomTraits::Point_2& q, const GeomTraits& traits) { using FT = typename GeomTraits::FT; - const FT d = internal::distance_2(traits, q, r); + const FT d = internal::distance_2(p, q, traits); return inverse_distance_ns::weight(d); } -template -typename GeomTraits::FT inverse_distance_weight(const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) +/*! + \ingroup PkgWeightsRefInverseDistanceWeights + \brief computes the inverse distance weight in 2D using the points `p` and `q`. + \tparam Kernel a model of `Kernel` +*/ +template +#ifdef DOXYGEN_RUNNING +typename Kernel::FT inverse_distance_weight(const CGAL::Point_2&, + const CGAL::Point_2& p, + const CGAL::Point_2&, + const CGAL::Point_2& q) +#else +typename Kernel::FT inverse_distance_weight(const CGAL::Point_2& stub_l, + const CGAL::Point_2& p, + const CGAL::Point_2& stub_r, + const CGAL::Point_2& q) +#endif { - const GeomTraits traits; - return inverse_distance_weight(t, r, p, q, traits); + const Kernel traits; + return inverse_distance_weight(stub_l, p, stub_r, q, traits); } +/*! + \ingroup PkgWeightsRefInverseDistanceWeights + \brief computes the inverse distance weight in 2D using the points `p` and `q`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ template typename GeomTraits::FT inverse_distance_weight(const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2& q, @@ -70,37 +94,66 @@ typename GeomTraits::FT inverse_distance_weight(const typename GeomTraits::Point return inverse_distance_weight(stub, p, stub, q, traits); } -template -typename GeomTraits::FT inverse_distance_weight(const CGAL::Point_2& p, - const CGAL::Point_2& q) +/*! + \ingroup PkgWeightsRefInverseDistanceWeights + \brief computes the inverse distance weight in 2D using the points `p` and `q`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT inverse_distance_weight(const CGAL::Point_2& p, + const CGAL::Point_2& q) { - CGAL::Point_2 stub; + CGAL::Point_2 stub; return inverse_distance_weight(stub, p, stub, q); } +// 3D ============================================================================================== + +/*! + \ingroup PkgWeightsRefInverseDistanceWeights + \brief computes the inverse distance weight in 3D using the points `p` and `q`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ template typename GeomTraits::FT inverse_distance_weight(const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& r, + const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3&, const typename GeomTraits::Point_3& q, const GeomTraits& traits) { using FT = typename GeomTraits::FT; - const FT d = internal::distance_3(traits, q, r); + const FT d = internal::distance_3(p, q, traits); return inverse_distance_ns::weight(d); } -template -typename GeomTraits::FT inverse_distance_weight(const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) +/*! + \ingroup PkgWeightsRefInverseDistanceWeights + \brief computes the inverse distance weight in 3D using the points `p` and `q`. + \tparam Kernel a model of `Kernel` +*/ +template +#ifdef DOXYGEN_RUNNING +typename Kernel::FT inverse_distance_weight(const CGAL::Point_3&, + const CGAL::Point_3& p, + const CGAL::Point_3&, + const CGAL::Point_3& q) +#else +typename Kernel::FT inverse_distance_weight(const CGAL::Point_3& stub_l, + const CGAL::Point_3& p, + const CGAL::Point_3& stub_r, + const CGAL::Point_3& q) +#endif { - const GeomTraits traits; - return inverse_distance_weight(t, r, p, q, traits); + const Kernel traits; + return inverse_distance_weight(stub_l, p, stub_r, q, traits); } +/*! + \ingroup PkgWeightsRefInverseDistanceWeights + \brief computes the inverse distance weight in 3D using the points `p` and `q`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ template typename GeomTraits::FT inverse_distance_weight(const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& q, @@ -110,16 +163,19 @@ typename GeomTraits::FT inverse_distance_weight(const typename GeomTraits::Point return inverse_distance_weight(stub, p, stub, q, traits); } -template -typename GeomTraits::FT inverse_distance_weight(const CGAL::Point_3& p, - const CGAL::Point_3& q) +/*! + \ingroup PkgWeightsRefInverseDistanceWeights + \brief computes the inverse distance weight in 3D using the points `p` and `q`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT inverse_distance_weight(const CGAL::Point_3& p, + const CGAL::Point_3& q) { - CGAL::Point_3 stub; + CGAL::Point_3 stub; return inverse_distance_weight(stub, p, stub, q); } -/// \endcond - } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/mean_value_weights.h b/Weights/include/CGAL/Weights/mean_value_weights.h index 3271db9cbb0..a7bd53e9d6c 100644 --- a/Weights/include/CGAL/Weights/mean_value_weights.h +++ b/Weights/include/CGAL/Weights/mean_value_weights.h @@ -32,12 +32,12 @@ namespace Weights { namespace mean_value_ns { template -FT sign_of_weight(const FT A1, const FT A2, const FT B) +FT sign_of_weight(const FT A0, const FT A2, const FT B) { - if (A1 > FT(0) && A2 > FT(0) && B <= FT(0)) + if (A0 > FT(0) && A2 > FT(0) && B <= FT(0)) return +FT(1); - if (A1 < FT(0) && A2 < FT(0) && B >= FT(0)) + if (A0 < FT(0) && A2 < FT(0) && B >= FT(0)) return -FT(1); if (B > FT(0)) @@ -50,112 +50,127 @@ FT sign_of_weight(const FT A1, const FT A2, const FT B) } template -typename GeomTraits::FT weight(const GeomTraits& traits, - const typename GeomTraits::FT r1, - const typename GeomTraits::FT r2, - const typename GeomTraits::FT r3, - const typename GeomTraits::FT D1, +typename GeomTraits::FT weight(const typename GeomTraits::FT d0, + const typename GeomTraits::FT d2, + const typename GeomTraits::FT d, + const typename GeomTraits::FT D0, const typename GeomTraits::FT D2, const typename GeomTraits::FT D, - const typename GeomTraits::FT sign) + const typename GeomTraits::FT sign, + const GeomTraits& traits) { using FT = typename GeomTraits::FT; using Get_sqrt = internal::Get_sqrt; auto sqrt = Get_sqrt::sqrt_object(traits); - const FT P1 = r1 * r2 + D1; - const FT P2 = r2 * r3 + D2; + const FT P1 = d * d0 + D0; + const FT P2 = d * d2 + D2; FT w = FT(0); CGAL_precondition(!is_zero(P1) && !is_zero(P2)); const FT prod = P1 * P2; if (!is_zero(prod)) { - const FT inv = FT(1) / prod; - w = FT(2) * (r1 * r3 - D) * inv; + w = FT(2) * (d0 * d2 - D) / prod; CGAL_assertion(w >= FT(0)); w = sqrt(w); } - w *= FT(2); w *= sign; + w *= sign * FT(2); return w; } } // namespace mean_value_ns +/// \endcond + +// 2D ============================================================================================== + +/*! + \ingroup PkgWeightsRefMeanValueWeights + \brief computes the mean value weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ template -typename GeomTraits::FT mean_value_weight(const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, +typename GeomTraits::FT mean_value_weight(const typename GeomTraits::Point_2& p0, + const typename GeomTraits::Point_2& p1, + const typename GeomTraits::Point_2& p2, const typename GeomTraits::Point_2& q, const GeomTraits& traits) { using FT = typename GeomTraits::FT; using Vector_2 = typename GeomTraits::Vector_2; + auto vector_2 = traits.construct_vector_2_object(); auto dot_product_2 = traits.compute_scalar_product_2_object(); - auto construct_vector_2 = traits.construct_vector_2_object(); + auto area_2 = traits.compute_area_2_object(); - const Vector_2 v1 = construct_vector_2(q, t); - const Vector_2 v2 = construct_vector_2(q, r); - const Vector_2 v3 = construct_vector_2(q, p); + const Vector_2 v1 = vector_2(q, p0); + const Vector_2 v = vector_2(q, p1); + const Vector_2 v2 = vector_2(q, p2); - const FT l1 = internal::length_2(traits, v1); - const FT l2 = internal::length_2(traits, v2); - const FT l3 = internal::length_2(traits, v3); + const FT d0 = internal::length_2(v1, traits); + const FT d = internal::length_2(v, traits); + const FT d2 = internal::length_2(v2, traits); - const FT D1 = dot_product_2(v1, v2); - const FT D2 = dot_product_2(v2, v3); - const FT D = dot_product_2(v1, v3); + const FT D0 = dot_product_2(v1, v); + const FT D2 = dot_product_2(v, v2); + const FT D = dot_product_2(v1, v2); - const FT A1 = internal::area_2(traits, r, q, t); - const FT A2 = internal::area_2(traits, p, q, r); - const FT B = internal::area_2(traits, p, q, t); + const FT A0 = area_2(p1, q, p0); + const FT A2 = area_2(p2, q, p1); + const FT B = area_2(p2, q, p0); - const FT sign = mean_value_ns::sign_of_weight(A1, A2, B); - return mean_value_ns::weight(traits, l1, l2, l3, D1, D2, D, sign); + const FT sign = mean_value_ns::sign_of_weight(A0, A2, B); + return mean_value_ns::weight(d0, d2, d, D0, D2, D, sign, traits); } -template -typename GeomTraits::FT mean_value_weight(const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) +/*! + \ingroup PkgWeightsRefMeanValueWeights + \brief computes the mean value weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT mean_value_weight(const CGAL::Point_2& p0, + const CGAL::Point_2& p1, + const CGAL::Point_2& p2, + const CGAL::Point_2& q) { - const GeomTraits traits; - return mean_value_weight(t, r, p, q, traits); + const Kernel traits; + return mean_value_weight(p0, p1, p2, q, traits); } -namespace internal { +// 3D ============================================================================================== + +/// \cond SKIP_IN_MANUAL template -typename GeomTraits::FT mean_value_weight(const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, +typename GeomTraits::FT mean_value_weight(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, const typename GeomTraits::Point_3& q, const GeomTraits& traits) { using Point_2 = typename GeomTraits::Point_2; - Point_2 tf, rf, pf, qf; - internal::flatten(traits, - t, r, p, q, - tf, rf, pf, qf); - return CGAL::Weights::mean_value_weight(tf, rf, pf, qf, traits); + + Point_2 p0f, p1f, p2f, qf; + internal::flatten(p0, p1, p2, q, + p0f, p1f, p2f, qf, + traits); + return CGAL::Weights::mean_value_weight(p0f, p1f, p2f, qf, traits); } -template -typename GeomTraits::FT mean_value_weight(const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) +template +typename Kernel::FT mean_value_weight(const CGAL::Point_3& p0, + const CGAL::Point_3& p1, + const CGAL::Point_3& p2, + const CGAL::Point_3& q) { - const GeomTraits traits; - return mean_value_weight(t, r, p, q, traits); + const Kernel traits; + return mean_value_weight(p0, p1, p2, q, traits); } -} // namespace internal - /// \endcond /*! @@ -163,13 +178,12 @@ typename GeomTraits::FT mean_value_weight(const CGAL::Point_3& t, \brief 2D mean value weights for polygons. - This class implements 2D mean value weights ( \cite cgal:bc:hf-mvcapp-06, - \cite cgal:bc:fhk-gcbcocp-06, \cite cgal:f-mvc-03 ) which can be computed - at any point inside and outside a simple polygon. + This class implements 2D mean value weights (\cite cgal:bc:fhk-gcbcocp-06, \cite cgal:f-mvc-03, + \cite cgal:bc:hf-mvcapp-06) which can be computed at any point inside and outside a simple polygon. Mean value weights are well-defined inside and outside a simple polygon and are non-negative in the kernel of a star-shaped polygon. These weights are computed - analytically using the formulation from the `tangent_weight()`. + analytically using the formulation from `tangent_weight()`. \tparam VertexRange a model of `ConstRange` whose iterator type is `RandomAccessIterator` \tparam GeomTraits a model of `AnalyticWeightTraits_2` @@ -188,6 +202,7 @@ public: /// @{ /// \cond SKIP_IN_MANUAL + using Vertex_range = VertexRange; using Geom_traits = GeomTraits; using Point_map = PointMap; @@ -199,6 +214,7 @@ public: using Scalar_product_2 = typename GeomTraits::Compute_scalar_product_2; using Get_sqrt = internal::Get_sqrt; using Sqrt = typename Get_sqrt::Sqrt; + /// \endcond /// Number type. @@ -274,6 +290,7 @@ public: /// @} /// \cond SKIP_IN_MANUAL + template OutIterator operator()(const Point_2& query, OutIterator weights, @@ -414,11 +431,10 @@ private: \param traits a traits class with geometric objects, predicates, and constructions; this parameter can be omitted if the traits class can be deduced from the point type - \return an output iterator to the element in the destination range, - one past the last weight stored + \return an output iterator to the element in the destination range, one past the last weight stored - \pre polygon.size() >= 3 - \pre polygon is simple + \pre `polygon.size() >= 3` + \pre `polygon` is simple */ template typename GeomTraits::FT mixed_voronoi_area(const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2& q, @@ -49,11 +55,17 @@ typename GeomTraits::FT mixed_voronoi_area(const typename GeomTraits::Point_2& p const Point_2 m1 = midpoint_2(q, r); const Point_2 m2 = midpoint_2(q, p); - const FT A1 = internal::positive_area_2(traits, q, m1, center); - const FT A2 = internal::positive_area_2(traits, q, center, m2); + const FT A1 = internal::positive_area_2(q, m1, center, traits); + const FT A2 = internal::positive_area_2(q, center, m2, traits); + return A1 + A2; } +/*! + \ingroup PkgWeightsRefMixedVoronoiRegionWeights + \brief computes the area of the mixed Voronoi cell in 2D using the points `p`, `q`, and `r`. + \tparam Kernel a model of `Kernel` +*/ template typename GeomTraits::FT mixed_voronoi_area(const CGAL::Point_2& p, const CGAL::Point_2& q, @@ -63,6 +75,13 @@ typename GeomTraits::FT mixed_voronoi_area(const CGAL::Point_2& p, return mixed_voronoi_area(p, q, r, traits); } +// 3D ============================================================================================== + +/*! + \ingroup PkgWeightsRefMixedVoronoiRegionWeights + \brief computes the area of the mixed Voronoi cell in 3D using the points `p`, `q`, and `r`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ template typename GeomTraits::FT mixed_voronoi_area(const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& q, @@ -89,22 +108,26 @@ typename GeomTraits::FT mixed_voronoi_area(const typename GeomTraits::Point_3& p const Point_3 m1 = midpoint_3(q, r); const Point_3 m2 = midpoint_3(q, p); - const FT A1 = internal::positive_area_3(traits, q, m1, center); - const FT A2 = internal::positive_area_3(traits, q, center, m2); + const FT A1 = internal::positive_area_3(q, m1, center, traits); + const FT A2 = internal::positive_area_3(q, center, m2, traits); + return A1 + A2; } -template -typename GeomTraits::FT mixed_voronoi_area(const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) +/*! + \ingroup PkgWeightsRefMixedVoronoiRegionWeights + \brief computes the area of the mixed Voronoi cell in 3D using the points `p`, `q`, and `r`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT mixed_voronoi_area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) { - const GeomTraits traits; + const Kernel traits; return mixed_voronoi_area(p, q, r, traits); } -/// \endcond - } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/shepard_weights.h b/Weights/include/CGAL/Weights/shepard_weights.h index 8c12d55687d..e510cbd6507 100644 --- a/Weights/include/CGAL/Weights/shepard_weights.h +++ b/Weights/include/CGAL/Weights/shepard_weights.h @@ -26,13 +26,9 @@ namespace Weights { namespace shepard_ns { -template -typename GeomTraits::FT weight(const GeomTraits& traits, - const typename GeomTraits::FT d, - const typename GeomTraits::FT p) +template +FT weight(const FT d, const FT p) { - using FT = typename GeomTraits::FT; - FT w = FT(0); CGAL_precondition(is_positive(d)); if(is_positive(d)) @@ -43,31 +39,57 @@ typename GeomTraits::FT weight(const GeomTraits& traits, } // namespace shepard_ns +/// \endcond + +// 2D ============================================================================================== + +/*! + \ingroup PkgWeightsRefShepardWeights + \brief computes the Shepard weight in 2D using the points `p` and `q` and the power parameter `a`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ template typename GeomTraits::FT shepard_weight(const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2& r, + const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2&, const typename GeomTraits::Point_2& q, const typename GeomTraits::FT a, const GeomTraits& traits) { using FT = typename GeomTraits::FT; - - const FT d = internal::distance_2(traits, q, r); - return shepard_ns::weight(traits, d, a); + const FT d = internal::distance_2(p, q, traits); + return shepard_ns::weight(d, a); } -template -typename GeomTraits::FT shepard_weight(const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const typename GeomTraits::FT a = typename GeomTraits::FT(1)) +/*! + \ingroup PkgWeightsRefShepardWeights + \brief computes the Shepard weight in 2D using the points `p` and `q`, and the power parameter `a` + \tparam Kernel a model of `Kernel` +*/ +template +#ifdef DOXYGEN_RUNNING +typename Kernel::FT shepard_weight(const CGAL::Point_2&, + const CGAL::Point_2& p^, + const CGAL::Point_2&, + const CGAL::Point_2& q, + const typename Kernel::FT a = {1}) +#else +typename Kernel::FT shepard_weight(const CGAL::Point_2& stub_l, + const CGAL::Point_2& p, + const CGAL::Point_2& stub_r, + const CGAL::Point_2& q, + const typename Kernel::FT a = {1}) +#endif { - const GeomTraits traits; - return shepard_weight(t, r, p, q, a, traits); + const Kernel traits; + return shepard_weight(stub_l, p, stub_r, q, a, traits); } +/*! + \ingroup PkgWeightsRefShepardWeights + \brief computes the Shepard weight in 2D using the points `p` and `q` and the power parameter `a`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ template typename GeomTraits::FT shepard_weight(const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2& q, @@ -78,39 +100,69 @@ typename GeomTraits::FT shepard_weight(const typename GeomTraits::Point_2& p, return shepard_weight(stub, p, stub, q, a, traits); } -template -typename GeomTraits::FT shepard_weight(const CGAL::Point_2& p, - const CGAL::Point_2& q, - const typename GeomTraits::FT a = typename GeomTraits::FT(1)) +/*! + \ingroup PkgWeightsRefShepardWeights + \brief computes the Shepard weight in 2D using the points `p` and `q`, and the power parameter `a`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT shepard_weight(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const typename Kernel::FT a = {1}) { - CGAL::Point_2 stub; + CGAL::Point_2 stub; return shepard_weight(stub, p, stub, q, a); } +// 3D ============================================================================================== + +/*! + \ingroup PkgWeightsRefShepardWeights + \brief computes the Shepard weight in 3D using the points `p` and `q` and the power parameter `a`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ template typename GeomTraits::FT shepard_weight(const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3& r, + const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3&, const typename GeomTraits::Point_3& q, const typename GeomTraits::FT a, const GeomTraits& traits) { using FT = typename GeomTraits::FT; - const FT d = internal::distance_3(traits, q, r); - return shepard_ns::weight(traits, d, a); + const FT d = internal::distance_3(p, q, traits); + return shepard_ns::weight(d, a); } -template -typename GeomTraits::FT shepard_weight(const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const typename GeomTraits::FT a = typename GeomTraits::FT(1)) +/*! + \ingroup PkgWeightsRefShepardWeights + \brief computes the Shepard weight in 3D using the points `p` and `q`, and the power parameter `a`. + \tparam Kernel a model of `Kernel` +*/ +template +#ifdef DOXYGEN_RUNNING +typename Kernel::FT shepard_weight(const CGAL::Point_3& p, + const CGAL::Point_3&, + const CGAL::Point_3& q, + const CGAL::Point_3&, + const typename Kernel::FT a = {1}) +#else +typename Kernel::FT shepard_weight(const CGAL::Point_3& stub_l, + const CGAL::Point_3& p, + const CGAL::Point_3& stub_r, + const CGAL::Point_3& q, + const typename Kernel::FT a = {1}) +#endif { - const GeomTraits traits; - return shepard_weight(t, r, p, q, a, traits); + const Kernel traits; + return shepard_weight(stub_l, p, stub_r, q, a, traits); } +/*! + \ingroup PkgWeightsRefShepardWeights + \brief computes the Shepard weight in 3D using the points `p` and `q` and the power parameter `a`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ template typename GeomTraits::FT shepard_weight(const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& q, @@ -121,17 +173,20 @@ typename GeomTraits::FT shepard_weight(const typename GeomTraits::Point_3& p, return shepard_weight(stub, p, stub, q, a, traits); } -template -typename GeomTraits::FT shepard_weight(const CGAL::Point_3& p, - const CGAL::Point_3& q, - const typename GeomTraits::FT a = typename GeomTraits::FT(1)) +/*! + \ingroup PkgWeightsRefShepardWeights + \brief computes the Shepard weight in 3D using the points `p` and `q`, and the power parameter `a`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT shepard_weight(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const typename Kernel::FT a = {1}) { - CGAL::Point_3 stub; + CGAL::Point_3 stub; return shepard_weight(stub, p, stub, q, a); } -/// \endcond - } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/tangent_weights.h b/Weights/include/CGAL/Weights/tangent_weights.h index 4c4260314fd..119dee11623 100644 --- a/Weights/include/CGAL/Weights/tangent_weights.h +++ b/Weights/include/CGAL/Weights/tangent_weights.h @@ -40,32 +40,33 @@ FT half_weight(const FT t, const FT r) } template -FT weight(const FT t1, const FT t2, const FT r) +FT weight(const FT t0, const FT t2, const FT r) { FT w = FT(0); CGAL_precondition(r != FT(0)); if (r != FT(0)) - w = FT(2) * (t1 + t2) / r; + w = FT(2) * (t0 + t2) / r; return w; } template -FT weight(const FT d1, const FT d, const FT d2, - const FT A1, const FT A2, - const FT D1, const FT D2) +FT weight(const FT d0, const FT d2, const FT d, + const FT A0, const FT A2, + const FT D0, const FT D2) { - const FT P1 = d1 * d + D1; - const FT P2 = d2 * d + D2; + const FT P0 = d * d0 + D0; + const FT P2 = d * d2 + D2; FT w = FT(0); - CGAL_precondition(!is_zero(P1) && !is_zero(P2)); - if (!is_zero(P1) && !is_zero(P2)) + CGAL_precondition(!is_zero(P0) && !is_zero(P2)); + if (!is_zero(P0) && !is_zero(P2)) { - const FT t1 = FT(2) * A1 / P1; + const FT t0 = FT(2) * A0 / P0; const FT t2 = FT(2) * A2 / P2; - w = weight(t1, t2, d); + w = weight(t0, t2, d); } + return w; } @@ -73,9 +74,9 @@ FT weight(const FT d1, const FT d, const FT d2, // This version is based on the positive area. // This version is more precise for all positive cases. template -typename GeomTraits::FT tangent_weight_v1(const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, +typename GeomTraits::FT tangent_weight_v1(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, const typename GeomTraits::Point_3& q, const GeomTraits& traits) { @@ -83,92 +84,62 @@ typename GeomTraits::FT tangent_weight_v1(const typename GeomTraits::Point_3& t, using Vector_3 = typename GeomTraits::Vector_3; auto dot_product_3 = traits.compute_scalar_product_3_object(); - auto construct_vector_3 = traits.construct_vector_3_object(); + auto vector_3 = traits.construct_vector_3_object(); - const Vector_3 v1 = construct_vector_3(q, t); - const Vector_3 v2 = construct_vector_3(q, r); - const Vector_3 v3 = construct_vector_3(q, p); + const Vector_3 v0 = vector_3(q, p0); + const Vector_3 v = vector_3(q, p1); + const Vector_3 v2 = vector_3(q, p2); - const FT l1 = internal::length_3(traits, v1); - const FT l2 = internal::length_3(traits, v2); - const FT l3 = internal::length_3(traits, v3); + const FT d0 = internal::length_3(v0, traits); + const FT d = internal::length_3(v, traits); + const FT d2 = internal::length_3(v2, traits); - const FT A1 = internal::positive_area_3(traits, r, q, t); - const FT A2 = internal::positive_area_3(traits, p, q, r); + const FT A0 = internal::positive_area_3(p1, q, p0, traits); + const FT A2 = internal::positive_area_3(p2, q, p1, traits); - const FT D1 = dot_product_3(v1, v2); - const FT D2 = dot_product_3(v2, v3); + const FT D0 = dot_product_3(v0, v); + const FT D2 = dot_product_3(v, v2); - return weight(l1, l2, l3, A1, A2, D1, D2); + return weight(d0, d2, d, A0, A2, D0, D2); } // This version handles both positive and negative cases. // However, it is less precise. template -typename GeomTraits::FT tangent_weight_v2(const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, +typename GeomTraits::FT tangent_weight_v2(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, const typename GeomTraits::Point_3& q, const GeomTraits& traits) { using FT = typename GeomTraits::FT; using Vector_3 = typename GeomTraits::Vector_3; - auto construct_vector_3 = traits.construct_vector_3_object(); + auto vector_3 = traits.construct_vector_3_object(); - Vector_3 v1 = construct_vector_3(q, t); - Vector_3 v2 = construct_vector_3(q, r); - Vector_3 v3 = construct_vector_3(q, p); + Vector_3 v0 = vector_3(q, p0); + Vector_3 v = vector_3(q, p1); + Vector_3 v2 = vector_3(q, p2); - const FT l2 = internal::length_3(traits, v2); + const FT l2 = internal::length_3(v, traits); - internal::normalize_3(traits, v1); - internal::normalize_3(traits, v2); - internal::normalize_3(traits, v3); + internal::normalize_3(v0, traits); + internal::normalize_3(v, traits); + internal::normalize_3(v2, traits); - const double ha_rad_1 = internal::angle_3(traits, v1, v2) / 2.0; - const double ha_rad_2 = internal::angle_3(traits, v2, v3) / 2.0; - const FT t1 = static_cast(std::tan(ha_rad_1)); + const double ha_rad_1 = internal::angle_3(v0, v, traits) / 2.0; + const double ha_rad_2 = internal::angle_3(v, v2, traits) / 2.0; + const FT t0 = static_cast(std::tan(ha_rad_1)); const FT t2 = static_cast(std::tan(ha_rad_2)); - return weight(t1, t2, l2); + return weight(t0, t2, l2); } } // namespace tangent_ns /// \endcond -/*! - \ingroup PkgWeightsRefTangentWeights - - \brief computes the tangent of the half angle. - - This function computes the tangent of the half angle using the precomputed - distance, area, and dot product values. The returned value is - \f$\frac{2\textbf{A}}{\textbf{d}\textbf{d_1} + \textbf{D_1}}\f$. - - \tparam FT a model of `FieldNumberType` - - \param d1 the first distance value - \param d2 the second distance value - \param A the area value - \param D the dot product value - - \pre (d1 * d2 + D) != 0 - - \sa `half_tangent_weight()` -*/ -template -FT tangent_half_angle(const FT d1, const FT d2, const FT A, const FT D) -{ - FT t = FT(0); - const FT P = d1 * d2 + D; - CGAL_precondition(!is_zero(P)); - if (!is_zero(P)) - t = FT(2) * A / P; - - return t; -} +// 2D ============================================================================================== /*! \ingroup PkgWeightsRefTangentWeights @@ -195,6 +166,42 @@ FT half_tangent_weight(const FT tan05, const FT d) return tangent_ns::half_weight(tan05, d); } +/*! + \ingroup PkgWeightsRefTangentWeights + + \brief computes the tangent of the half angle. + + This function computes the tangent of the half angle using the precomputed + distance, area, and dot product values. The returned value is + \f$\frac{2\textbf{A}}{\textbf{d}\textbf{l} + \textbf{D}}\f$. + + \tparam FT a model of `FieldNumberType` + + \param d the distance value + \param l the distance value + \param A the area value + \param D the dot product value + + \pre (d * l + D) != 0 + + \sa `half_tangent_weight()` +*/ +template +FT tangent_half_angle(const FT d, const FT l, const FT A, const FT D) +{ + // tan(theta/2) = sin(theta) / ( 1 + cos(theta) ), also = (1 - cos(theta)) / sin(theta). + // = ( 2*A / |v1|*|v2| ) / ( 1 + v1.v2 / |v1|*|v2| ) + // = 2*A / ( |v1|*|v2| + v1.v2 ) + + FT t = FT(0); + const FT P = d * l + D; + CGAL_precondition(!is_zero(P)); + if (!is_zero(P)) + t = FT(2) * A / P; + + return t; +} + /*! \ingroup PkgWeightsRefTangentWeights @@ -224,65 +231,138 @@ FT half_tangent_weight(const FT d, const FT l, const FT A, const FT D) } /// \cond SKIP_IN_MANUAL + template -typename GeomTraits::FT tangent_weight(const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, +typename GeomTraits::FT half_tangent_weight(const typename GeomTraits::Point_2& p0, + const typename GeomTraits::Point_2& q, + const typename GeomTraits::Point_2& p2, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + + auto vector_2 = traits.construct_vector_2_object(); + auto dot_product_2 = traits.compute_scalar_product_2_object(); + auto area_2 = traits.compute_area_2_object(); + + const Vector_2 v0 = vector_2(q, p0); + const Vector_2 v2 = vector_2(q, p2); + + const FT l0 = internal::length_2(v0, traits); + const FT l2 = internal::length_2(v2, traits); + const FT A = area_2(p2, q, p0); + const FT D = dot_product_2(v0, v2); + + return half_tangent_weight(l0, l2, A, D); +} + +template +typename GeomTraits::FT half_tangent_weight(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& q, + const typename GeomTraits::Point_3& p2, + const GeomTraits& traits) +{ + using FT = typename GeomTraits::FT; + + auto vector_3 = traits.construct_vector_3_object(); + auto dot_product_3 = traits.compute_scalar_product_3_object(); + + const Vector_3 v0 = vector_3(q, p0); + const Vector_3 v2 = vector_3(q, p2); + + const FT l0 = internal::length_3(v0, traits); + const FT l2 = internal::length_3(v2, traits); + const FT A = internal::area_3(p2, q, p0, traits); + const FT D = dot_product_3(v0, v2); + + return half_tangent_weight(l0, l2, A, D); +} + +/// \endcond + +// 2D ============================================================================================== + +/*! + \ingroup PkgWeightsRefTangentWeights + \brief computes the tangent weight in 2D at `q` using the points `p0`, `p1`, and `p2` + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT tangent_weight(const typename GeomTraits::Point_2& p0, + const typename GeomTraits::Point_2& p1, + const typename GeomTraits::Point_2& p2, const typename GeomTraits::Point_2& q, const GeomTraits& traits) { using FT = typename GeomTraits::FT; using Vector_2 = typename GeomTraits::Vector_2; + auto vector_2 = traits.construct_vector_2_object(); auto dot_product_2 = traits.compute_scalar_product_2_object(); - auto construct_vector_2 = traits.construct_vector_2_object(); + auto area_2 = traits.compute_area_2_object(); - const Vector_2 v1 = construct_vector_2(q, t); - const Vector_2 v2 = construct_vector_2(q, r); - const Vector_2 v3 = construct_vector_2(q, p); + const Vector_2 v0 = vector_2(q, p0); + const Vector_2 v = vector_2(q, p1); + const Vector_2 v2 = vector_2(q, p2); - const FT l1 = internal::length_2(traits, v1); - const FT l2 = internal::length_2(traits, v2); - const FT l3 = internal::length_2(traits, v3); + const FT l0 = internal::length_2(v0, traits); + const FT l = internal::length_2(v, traits); + const FT l2 = internal::length_2(v2, traits); - const FT A1 = internal::area_2(traits, r, q, t); - const FT A2 = internal::area_2(traits, p, q, r); + const FT A0 = area_2(p1, q, p0); + const FT A2 = area_2(p2, q, p1); - const FT D1 = dot_product_2(v1, v2); - const FT D2 = dot_product_2(v2, v3); + const FT D0 = dot_product_2(v0, v); + const FT D2 = dot_product_2(v, v2); - return tangent_ns::weight(l1, l2, l3, A1, A2, D1, D2); + return tangent_ns::weight(l0, l2, l, A0, A2, D0, D2); } -template -typename GeomTraits::FT tangent_weight(const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) +/*! + \ingroup PkgWeightsRefTangentWeights + \brief computes the tangent weight in 2D at `q` using the points `p0`, `p1`, and `p2` + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT tangent_weight(const CGAL::Point_2& p0, + const CGAL::Point_2& p1, + const CGAL::Point_2& p2, + const CGAL::Point_2& q) { - const GeomTraits traits; - return tangent_weight(t, r, p, q, traits); + const Kernel traits; + return tangent_weight(p0, p1, p2, q, traits); } +// 3D ============================================================================================== + +/*! + \ingroup PkgWeightsRefTangentWeights + \brief computes the tangent weight in 3D at `q` using the points `p0`, `p1`, and `p2` + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ template -typename GeomTraits::FT tangent_weight(const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, +typename GeomTraits::FT tangent_weight(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, const typename GeomTraits::Point_3& q, const GeomTraits& traits) { - // return tangent_ns::tangent_weight_v1(t, r, p, q, traits); - return tangent_ns::tangent_weight_v2(t, r, p, q, traits); +// return tangent_ns::tangent_weight_v1(p0, p1, p2, q, traits); + return tangent_ns::tangent_weight_v2(p0, p1, p2, q, traits); } -template -typename GeomTraits::FT tangent_weight(const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) +/*! + \ingroup PkgWeightsRefTangentWeights + \brief computes the tangent weight in 3D at `q` using the points `p0`, `p1`, and `p2` + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT tangent_weight(const CGAL::Point_3& p0, + const CGAL::Point_3& p1, + const CGAL::Point_3& p2, + const CGAL::Point_3& q) { - const GeomTraits traits; - return tangent_weight(t, r, p, q, traits); + const Kernel traits; + return tangent_weight(p0, p1, p2, q, traits); } // Undocumented tangent weight class. diff --git a/Weights/include/CGAL/Weights/three_point_family_weights.h b/Weights/include/CGAL/Weights/three_point_family_weights.h index f5b08ce9c48..51bdf0eeb51 100644 --- a/Weights/include/CGAL/Weights/three_point_family_weights.h +++ b/Weights/include/CGAL/Weights/three_point_family_weights.h @@ -26,90 +26,109 @@ namespace Weights { namespace three_point_family_ns { template -FT weight(const FT d1, const FT d2, const FT d, - const FT A1, const FT A2, const FT B, +FT weight(const FT d0, const FT d2, const FT d, + const FT A0, const FT A2, const FT B, const FT p) { FT w = FT(0); - CGAL_precondition(!is_zero(A1) && !is_zero(A2)); - const FT prod = A1 * A2; + CGAL_precondition(!is_zero(A0) && !is_zero(A2)); + const FT prod = A0 * A2; if (!is_zero(prod)) { - const FT r1 = internal::power(d1, p); + const FT r0 = internal::power(d0, p); + const FT r = internal::power(d , p); const FT r2 = internal::power(d2, p); - const FT r = internal::power(d , p); - w = (r2 * A1 - r * B + r1 * A2) / prod; + w = (r2 * A0 - r * B + r0 * A2) / prod; } return w; } } // namespace three_point_family_ns +/// \endcond + +// 2D ============================================================================================== + +/*! + \ingroup PkgWeightsRefThreePointFamilyWeights + \brief computes the three-point family weight in 2D at `q` using the points `p0`, `p1` and `p2`, + and the power parameter `a`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ template -typename GeomTraits::FT three_point_family_weight(const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, +typename GeomTraits::FT three_point_family_weight(const typename GeomTraits::Point_2& p0, + const typename GeomTraits::Point_2& p1, + const typename GeomTraits::Point_2& p2, const typename GeomTraits::Point_2& q, const typename GeomTraits::FT a, const GeomTraits& traits) { using FT = typename GeomTraits::FT; - const FT d1 = internal::distance_2(traits, q, t); - const FT d2 = internal::distance_2(traits, q, r); - const FT d3 = internal::distance_2(traits, q, p); + auto area_2 = traits.compute_area_2_object(); - const FT A1 = internal::area_2(traits, r, q, t); - const FT A2 = internal::area_2(traits, p, q, r); - const FT B = internal::area_2(traits, p, q, t); + const FT d0 = internal::distance_2(q, p0, traits); + const FT d = internal::distance_2(q, p1, traits); + const FT d2 = internal::distance_2(q, p2, traits); - return three_point_family_ns::weight(traits, d1, d2, d3, A1, A2, B, a); + const FT A0 = area_2(p1, q, p0); + const FT A2 = area_2(p2, q, p1); + const FT B = area_2(p2, q, p0); + + return three_point_family_ns::weight(d0, d2, d, A0, A2, B, a); } -template -typename GeomTraits::FT three_point_family_weight(const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q, - const typename GeomTraits::FT a = typename GeomTraits::FT(1)) +/*! + \ingroup PkgWeightsRefThreePointFamilyWeights + \brief computes the three-point family weight in 2D at `q` using the points `p0`, `p1` and `p2`, + and the power parameter `a`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT three_point_family_weight(const CGAL::Point_2& p0, + const CGAL::Point_2& p1, + const CGAL::Point_2& p2, + const CGAL::Point_2& q, + const typename Kernel::FT a = {1}) { - const GeomTraits traits; - return three_point_family_weight(t, r, p, q, a, traits); + const Kernel traits; + return three_point_family_weight(p0, p1, p2, q, a, traits); } -namespace internal { +// 3D ============================================================================================== + +/// \cond SKIP_IN_MANUAL template -typename GeomTraits::FT three_point_family_weight(const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, +typename GeomTraits::FT three_point_family_weight(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, const typename GeomTraits::Point_3& q, const typename GeomTraits::FT a, const GeomTraits& traits) { using Point_2 = typename GeomTraits::Point_2; - Point_2 tf, rf, pf, qf; - internal::flatten(traits, - t, r, p, q, - tf, rf, pf, qf); - return CGAL::Weights::three_point_family_weight(tf, rf, pf, qf, a, traits); + Point_2 p0f, p1f, p2f, qf; + internal::flatten(p0, p1, p2 , q, + p0f, p1f, p2f, qf, + traits); + + return CGAL::Weights::three_point_family_weight(p0f, p1f, p2f, qf, a, traits); } -template -typename GeomTraits::FT three_point_family_weight(const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q, - const typename GeomTraits::FT a = typename GeomTraits::FT(1)) +template +typename Kernel::FT three_point_family_weight(const CGAL::Point_3& p0, + const CGAL::Point_3& p1, + const CGAL::Point_3& p2, + const CGAL::Point_3& q, + const typename Kernel::FT a = {1}) { - const GeomTraits traits; - return three_point_family_weight(t, r, p, q, a, traits); + const Kernel traits; + return three_point_family_weight(p0, p1, p2, q, a, traits); } -} // namespace internal - /// \endcond } // namespace Weights diff --git a/Weights/include/CGAL/Weights/triangular_region_weights.h b/Weights/include/CGAL/Weights/triangular_region_weights.h index 9e0f7d2facd..aa4b20a567a 100644 --- a/Weights/include/CGAL/Weights/triangular_region_weights.h +++ b/Weights/include/CGAL/Weights/triangular_region_weights.h @@ -22,45 +22,66 @@ namespace CGAL { namespace Weights { -/// \cond SKIP_IN_MANUAL +// 2D ============================================================================================== + +/*! + \ingroup PkgWeightsRefTriangularRegionWeights + \brief computes the area of the triangular cell in 2D using the points `p`, `q`, and `r` + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ template typename GeomTraits::FT triangular_area(const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2& q, const typename GeomTraits::Point_2& r, const GeomTraits& traits) { - return internal::positive_area_2(traits, p, q, r); + return internal::positive_area_2(p, q, r, traits); } -template -typename GeomTraits::FT triangular_area(const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) +/*! + \ingroup PkgWeightsRefTriangularRegionWeights + \brief computes the area of the triangular cell in 2D using the points `p`, `q`, and `r`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT triangular_area(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) { - const GeomTraits traits; + const Kernel traits; return triangular_area(p, q, r, traits); } +// 3D ============================================================================================== + +/*! + \ingroup PkgWeightsRefTriangularRegionWeights + \brief computes the area of the triangular cell in 3D using the points `p`, `q`, and `r`. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ template typename GeomTraits::FT triangular_area(const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& q, const typename GeomTraits::Point_3& r, const GeomTraits& traits) { - return internal::positive_area_3(traits, p, q, r); + return internal::positive_area_3(p, q, r, traits); } -template -typename GeomTraits::FT triangular_area(const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) +/*! + \ingroup PkgWeightsRefTriangularRegionWeights + \brief computes the area of the triangular cell in 3D using the points `p`, `q`, and `r`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT triangular_area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) { - const GeomTraits traits; + const Kernel traits; return triangular_area(p, q, r, traits); } -/// \endcond - } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/uniform_region_weights.h b/Weights/include/CGAL/Weights/uniform_region_weights.h index a7035fcccdd..6ed0f0726b8 100644 --- a/Weights/include/CGAL/Weights/uniform_region_weights.h +++ b/Weights/include/CGAL/Weights/uniform_region_weights.h @@ -20,7 +20,13 @@ namespace CGAL { namespace Weights { -/// \cond SKIP_IN_MANUAL +// 2D ============================================================================================== + +/*! + \ingroup PkgWeightsRefUniformRegionWeights + \brief this function always returns `1`, given three 2D points. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ template typename GeomTraits::FT uniform_area(const typename GeomTraits::Point_2&, const typename GeomTraits::Point_2&, @@ -31,15 +37,27 @@ typename GeomTraits::FT uniform_area(const typename GeomTraits::Point_2&, return FT(1); } -template -typename GeomTraits::FT uniform_area(const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) +/*! + \ingroup PkgWeightsRefUniformRegionWeights + \brief this function always returns `1`, given three 2D points in 2D. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT uniform_area(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) { - const GeomTraits traits; + const Kernel traits; return uniform_area(p, q, r, traits); } +// 3D ============================================================================================== + +/*! + \ingroup PkgWeightsRefUniformRegionWeights + \brief this function always returns `1`, given three 3D points. + \tparam GeomTraits a model of `AnalyticWeightTraits_3` +*/ template typename GeomTraits::FT uniform_area(const typename GeomTraits::Point_3&, const typename GeomTraits::Point_3&, @@ -50,17 +68,20 @@ typename GeomTraits::FT uniform_area(const typename GeomTraits::Point_3&, return FT(1); } -template -typename GeomTraits::FT uniform_area(const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) +/*! + \ingroup PkgWeightsRefUniformRegionWeights + \brief this function always returns `1`, given three 3D points. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT uniform_area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) { - const GeomTraits traits; + const Kernel traits; return uniform_area(p, q, r, traits); } -/// \endcond - } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/uniform_weights.h b/Weights/include/CGAL/Weights/uniform_weights.h index be69470d143..541dd95937a 100644 --- a/Weights/include/CGAL/Weights/uniform_weights.h +++ b/Weights/include/CGAL/Weights/uniform_weights.h @@ -22,51 +22,68 @@ namespace CGAL { namespace Weights { -/// \cond SKIP_IN_MANUAL -template -typename GeomTraits::FT uniform_weight( - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const typename GeomTraits::Point_2&, - const GeomTraits&) { +// 2D ============================================================================================== - using FT = typename GeomTraits::FT; - return FT(1); +/*! + \ingroup PkgWeightsRefUniformWeights + \brief returns `1`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT uniform_weight(const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2&, + const typename GeomTraits::Point_2&, + const GeomTraits&) +{ + return {1}; } +/*! + \ingroup PkgWeightsRefUniformWeights + \brief returns `1`. + \tparam Kernel a model of `Kernel` +*/ template -typename GeomTraits::FT uniform_weight( - const CGAL::Point_2& q, - const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p) { - +typename GeomTraits::FT uniform_weight(const CGAL::Point_2& p0, + const CGAL::Point_2& p1, + const CGAL::Point_2& p2, + const CGAL::Point_2& q) +{ const GeomTraits traits; - return uniform_weight(q, t, r, p, traits); + return uniform_weight(p0, p1, p2, q, traits); } -template -typename GeomTraits::FT uniform_weight( - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const typename GeomTraits::Point_3&, - const GeomTraits&) { +// 3D ============================================================================================== - using FT = typename GeomTraits::FT; - return FT(1); +/*! + \ingroup PkgWeightsRefUniformWeights + \brief returns `1`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ +template +typename GeomTraits::FT uniform_weight(const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3&, + const typename GeomTraits::Point_3&, + const GeomTraits&) +{ + return {1}; } +/*! + \ingroup PkgWeightsRefUniformWeights + \brief returns `1`. + \tparam Kernel a model of `Kernel` +*/ template -typename GeomTraits::FT uniform_weight( - const CGAL::Point_3& q, - const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p) { - +typename GeomTraits::FT uniform_weight(const CGAL::Point_3& p0, + const CGAL::Point_3& p1, + const CGAL::Point_3& p2, + const CGAL::Point_3& q) +{ const GeomTraits traits; - return uniform_weight(q, t, r, p, traits); + return uniform_weight(p0, p1, p2, q, traits); } // Undocumented uniform weight class taking as input a polygon mesh. @@ -85,8 +102,6 @@ public: double w_ij(halfedge_descriptor) { return 1.; } }; -/// \endcond - } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/utils.h b/Weights/include/CGAL/Weights/utils.h index 43c0a0945da..9f75bd14854 100644 --- a/Weights/include/CGAL/Weights/utils.h +++ b/Weights/include/CGAL/Weights/utils.h @@ -214,6 +214,11 @@ typename Kernel::FT tangent(const CGAL::Point_3& p, return tangent(p, q, r, traits); } +// ================================================================================================= + +// Computes a clamped cotangent between two 3D vectors. +// In the old version of weights in PMP, it was called "Cotangent_value_Meyer_secure". +// See Weights/internal/pmp_weights_deprecated.h for more information. template typename GeomTraits::FT cotangent_3_clamped(const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& q, diff --git a/Weights/include/CGAL/Weights/voronoi_region_weights.h b/Weights/include/CGAL/Weights/voronoi_region_weights.h index 61880e73ff8..86d06a07243 100644 --- a/Weights/include/CGAL/Weights/voronoi_region_weights.h +++ b/Weights/include/CGAL/Weights/voronoi_region_weights.h @@ -22,7 +22,13 @@ namespace CGAL { namespace Weights { -/// \cond SKIP_IN_MANUAL +// 2D ============================================================================================== + +/*! + \ingroup PkgWeightsRefVoronoiRegionWeights + \brief computes the area of the Voronoi cell in 2D using the points `p`, `q`, and `r`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ template typename GeomTraits::FT voronoi_area(const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2& q, @@ -39,20 +45,33 @@ typename GeomTraits::FT voronoi_area(const typename GeomTraits::Point_2& p, const Point_2 m1 = midpoint_2(q, r); const Point_2 m2 = midpoint_2(q, p); - const FT A1 = internal::positive_area_2(traits, q, m1, center); - const FT A2 = internal::positive_area_2(traits, q, center, m2); + const FT A1 = internal::positive_area_2(q, m1, center,traits); + const FT A2 = internal::positive_area_2(q, center, m2, traits); + return A1 + A2; } -template -typename GeomTraits::FT voronoi_area(const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) +/*! + \ingroup PkgWeightsRefVoronoiRegionWeights + \brief computes the area of the Voronoi cell in 2D using the points `p`, `q`, and `r`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT voronoi_area(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) { - const GeomTraits traits; + const Kernel traits; return voronoi_area(p, q, r, traits); } +// 3D ============================================================================================== + +/*! + \ingroup PkgWeightsRefVoronoiRegionWeights + \brief computes the area of the Voronoi cell in 3D using the points `p`, `q`, and `r` + \tparam GeomTraits a model of `AnalyticWeightTraits_3`. +*/ template typename GeomTraits::FT voronoi_area(const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& q, @@ -69,22 +88,26 @@ typename GeomTraits::FT voronoi_area(const typename GeomTraits::Point_3& p, const Point_3 m1 = midpoint_3(q, r); const Point_3 m2 = midpoint_3(q, p); - const FT A1 = internal::positive_area_3(traits, q, m1, center); - const FT A2 = internal::positive_area_3(traits, q, center, m2); + const FT A1 = internal::positive_area_3(q, m1, center, traits); + const FT A2 = internal::positive_area_3(q, center, m2, traits); + return A1 + A2; } -template -typename GeomTraits::FT voronoi_area(const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) +/*! + \ingroup PkgWeightsRefVoronoiRegionWeights + \brief computes the area of the Voronoi cell in 3D using the points `p`, `q`, and `r`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT voronoi_area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) { - const GeomTraits traits; + const Kernel traits; return voronoi_area(p, q, r, traits); } -/// \endcond - } // namespace Weights } // namespace CGAL diff --git a/Weights/include/CGAL/Weights/wachspress_weights.h b/Weights/include/CGAL/Weights/wachspress_weights.h index 58face6b47a..9a1c9e7bd1b 100644 --- a/Weights/include/CGAL/Weights/wachspress_weights.h +++ b/Weights/include/CGAL/Weights/wachspress_weights.h @@ -31,75 +31,92 @@ namespace Weights { namespace wachspress_ns { template -FT weight(const FT A1, const FT A2, const FT C) +FT weight(const FT A0, const FT A2, const FT C) { FT w = FT(0); - CGAL_precondition(A1 != FT(0) && A2 != FT(0)); - const FT prod = A1 * A2; - if (prod != FT(0)) - { - const FT inv = FT(1) / prod; - w = C * inv; - } + CGAL_precondition(!is_zero(A0) && !is_zero(A2)); + const FT prod = A0 * A2; + if (!is_zero(prod)) + w = C / prod; + return w; } -} // wachspress_ns +} // namespace wachspress_ns +/// \endcond + +// 2D ============================================================================================== + +/*! + \ingroup PkgWeightsRefWachspressWeights + \brief computes the Wachspress weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam GeomTraits a model of `AnalyticWeightTraits_2` +*/ template -typename GeomTraits::FT wachspress_weight(const typename GeomTraits::Point_2& t, - const typename GeomTraits::Point_2& r, - const typename GeomTraits::Point_2& p, +typename GeomTraits::FT wachspress_weight(const typename GeomTraits::Point_2& p0, + const typename GeomTraits::Point_2& p1, + const typename GeomTraits::Point_2& p2, const typename GeomTraits::Point_2& q, const GeomTraits& traits) { using FT = typename GeomTraits::FT; - const FT A1 = internal::area_2(traits, r, q, t); - const FT A2 = internal::area_2(traits, p, q, r); - const FT C = internal::area_2(traits, t, r, p); - return wachspress_ns::weight(A1, A2, C); + + auto area_2 = traits.compute_area_2_object(); + + const FT A0 = area_2(p1, q, p0); + const FT A2 = area_2(p2, q, p1); + const FT C = area_2(p0, p1, p2); + + return wachspress_ns::weight(A0, A2, C); } -template -typename GeomTraits::FT wachspress_weight(const CGAL::Point_2& t, - const CGAL::Point_2& r, - const CGAL::Point_2& p, - const CGAL::Point_2& q) +/*! + \ingroup PkgWeightsRefWachspressWeights + \brief computes the Wachspress weight in 2D at `q` using the points `p0`, `p1`, and `p2`. + \tparam Kernel a model of `Kernel` +*/ +template +typename Kernel::FT wachspress_weight(const CGAL::Point_2& p0, + const CGAL::Point_2& p1, + const CGAL::Point_2& p2, + const CGAL::Point_2& q) { - const GeomTraits traits; - return wachspress_weight(t, r, p, q, traits); + const Kernel traits; + return wachspress_weight(p0, p1, p2, q, traits); } -namespace internal { +// 3D ============================================================================================== + +/// \cond SKIP_IN_MANUAL template -typename GeomTraits::FT wachspress_weight(const typename GeomTraits::Point_3& t, - const typename GeomTraits::Point_3& r, - const typename GeomTraits::Point_3& p, +typename GeomTraits::FT wachspress_weight(const typename GeomTraits::Point_3& p0, + const typename GeomTraits::Point_3& p1, + const typename GeomTraits::Point_3& p2, const typename GeomTraits::Point_3& q, const GeomTraits& traits) { using Point_2 = typename GeomTraits::Point_2; - Point_2 tf, rf, pf, qf; - internal::flatten(traits, - t, r, p, q, - tf, rf, pf, qf); - return CGAL::Weights::wachspress_weight(tf, rf, pf, qf, traits); + Point_2 p0f, p1f, p2f, qf; + internal::flatten(p0, p1, p2, q, + p0f, p1f, p2f, qf, + traits); + + return CGAL::Weights::wachspress_weight(p0f, p1f, p2f, qf, traits); } -template -typename GeomTraits::FT wachspress_weight(const CGAL::Point_3& t, - const CGAL::Point_3& r, - const CGAL::Point_3& p, - const CGAL::Point_3& q) +template +typename Kernel::FT wachspress_weight(const CGAL::Point_3& p0, + const CGAL::Point_3& p1, + const CGAL::Point_3& p2, + const CGAL::Point_3& q) { - const GeomTraits traits; - return wachspress_weight(t, r, p, q, traits); + const Kernel traits; + return wachspress_weight(p0, p1, p2, q, traits); } -} // namespace internal - /// \endcond /*! @@ -164,9 +181,9 @@ public: \param point_map an instance of `PointMap` that maps a vertex from `polygon` to `Point_2`; the default initialization is provided - \pre polygon.size() >= 3 - \pre polygon is simple - \pre polygon is strictly convex + \pre `polygon.size() >= 3` + \pre `polygon` is simple + \pre `polygon` is strictly convex */ Wachspress_weights_2(const VertexRange& polygon, const GeomTraits traits = GeomTraits(), @@ -331,9 +348,9 @@ private: \return an output iterator to the element in the destination range, one past the last weight stored - \pre polygon.size() >= 3 - \pre polygon is simple - \pre polygon is strictly convex + \pre `polygon.size() >= 3` + \pre `polygon` is simple + \pre `polygon` is strictly convex */ template Date: Thu, 20 Oct 2022 17:21:43 +0200 Subject: [PATCH 042/194] Misc minor code cleaning --- .../Harmonic_coordinates_2.h | 3 +- .../Surface_mesh_geodesic_distances_3.h | 12 +-- .../include/CGAL/Mesh_3/vertex_perturbation.h | 2 +- .../CGAL/Polygon_mesh_processing/fair.h | 28 +++---- .../Hole_filling/Triangulate_hole_polyline.h | 12 +-- .../include/CGAL/Weights/cotangent_weights.h | 4 +- .../CGAL/Weights/internal/polygon_utils_2.h | 5 +- Weights/include/CGAL/Weights/internal/utils.h | 76 ++++++++++--------- Weights/include/CGAL/Weights/utils.h | 20 ++--- 9 files changed, 79 insertions(+), 83 deletions(-) diff --git a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Harmonic_coordinates_2.h b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Harmonic_coordinates_2.h index 8e7efbd5fc3..164861dc6aa 100644 --- a/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Harmonic_coordinates_2.h +++ b/Barycentric_coordinates_2/include/CGAL/Barycentric_coordinates_2/Harmonic_coordinates_2.h @@ -587,8 +587,7 @@ namespace Barycentric_coordinates { const auto& p0 = m_domain.vertex(neighbors[jm]); const auto& p1 = m_domain.vertex(neighbors[j]); const auto& p2 = m_domain.vertex(neighbors[jp]); - const FT w = -Weights::cotangent_weight( - p0, p1, p2, query, m_traits) / FT(2); + const FT w = -Weights::cotangent_weight(p0, p1, p2, query, m_traits) / FT(2); W -= w; if (m_domain.is_on_boundary(idx)) { diff --git a/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h b/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h index fd38855d2d5..64c1782bb9c 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h @@ -545,22 +545,19 @@ private: pj = p_j; pk = p_k; - const double cotan_i = CGAL::to_double( - CGAL::Weights::cotangent(pk, pi, pj, traits)); + const double cotan_i = CGAL::to_double(CGAL::Weights::cotangent(pk, pi, pj, traits)); m_cotan_matrix.add_coef(j, k, -(1./2) * cotan_i); m_cotan_matrix.add_coef(k, j, -(1./2) * cotan_i); m_cotan_matrix.add_coef(j, j, (1./2) * cotan_i); m_cotan_matrix.add_coef(k, k, (1./2) * cotan_i); - const double cotan_j = CGAL::to_double( - CGAL::Weights::cotangent(pk, pj, pi, traits)); + const double cotan_j = CGAL::to_double(CGAL::Weights::cotangent(pk, pj, pi, traits)); m_cotan_matrix.add_coef(i, k, -(1./2) * cotan_j); m_cotan_matrix.add_coef(k, i, -(1./2) * cotan_j); m_cotan_matrix.add_coef(i, i, (1./2) * cotan_j); m_cotan_matrix.add_coef(k, k, (1./2) * cotan_j); - const double cotan_k = CGAL::to_double( - CGAL::Weights::cotangent(pj, pk, pi, traits)); + const double cotan_k = CGAL::to_double(CGAL::Weights::cotangent(pj, pk, pi, traits)); m_cotan_matrix.add_coef(i, j, -(1./2) * cotan_k); m_cotan_matrix.add_coef(j, i, -(1./2) * cotan_k); m_cotan_matrix.add_coef(i, i, (1./2) * cotan_k); @@ -569,8 +566,7 @@ private: const Vector_3 v_ij = construct_vector(p_i, p_j); const Vector_3 v_ik = construct_vector(p_i, p_k); const Vector_3 cross = cross_product(v_ij, v_ik); - const double norm_cross = CGAL::sqrt( - CGAL::to_double(scalar_product(cross, cross))); + const double norm_cross = CGAL::sqrt(CGAL::to_double(scalar_product(cross, cross))); //double area_face = CGAL::Polygon_mesh_processing::face_area(f,tm); //cross is 2*area diff --git a/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h b/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h index 1b5e004548a..a7e610afe51 100644 --- a/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h +++ b/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h @@ -1058,7 +1058,7 @@ private: */ FT cotangent(const FT& value) const { - return FT(1/std::tan(CGAL::to_double(value))); + return FT(1./std::tan(CGAL::to_double(value))); } /** diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h index b6e9d00b9d0..49ea054aa45 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h @@ -41,18 +41,18 @@ namespace internal { typename TriangleMesh, typename VertexRange, typename VertexPointMap> - bool fair(TriangleMesh& tmesh, - const VertexRange& vertices, - SparseLinearSolver solver, - WeightCalculator weight_calculator, - unsigned int continuity, - VertexPointMap vpmap) - { - CGAL::Polygon_mesh_processing::internal::Fair_Polyhedron_3 - - fair_functor(tmesh, vpmap, weight_calculator); - return fair_functor.fair(vertices, solver, continuity); - } +bool fair(TriangleMesh& tmesh, + const VertexRange& vertices, + SparseLinearSolver solver, + WeightCalculator weight_calculator, + unsigned int continuity, + VertexPointMap vpmap) +{ + CGAL::Polygon_mesh_processing::internal::Fair_Polyhedron_3 + + fair_functor(tmesh, vpmap, weight_calculator); + return fair_functor.fair(vertices, solver, continuity); +} } //end namespace internal @@ -182,9 +182,9 @@ namespace internal { CGAL::Polygon_mesh_processing::parameters::all_default()); } -} //end namespace Polygon_mesh_processing +} // namespace Polygon_mesh_processing -} //end namespace CGAL +} // namespace CGAL #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h index 99f6e0bd64d..1b915b25201 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h @@ -385,9 +385,9 @@ class Weight_incomplete private: template Weight_incomplete(const std::vector& P, - const std::vector& Q, - int i, int j, int k, - const LookupTable& lambda) + const std::vector& Q, + int i, int j, int k, + const LookupTable& lambda) : weight(P,Q,i,j,k,lambda), patch_size(1) { } @@ -444,9 +444,9 @@ struct Weight_calculator template Weight operator()(const std::vector& P, - const std::vector& Q, - int i, int j, int k, - const LookupTable& lambda) const + const std::vector& Q, + int i, int j, int k, + const LookupTable& lambda) const { if( !is_valid(P,i,j,k) ) { return Weight::NOT_VALID(); } diff --git a/Weights/include/CGAL/Weights/cotangent_weights.h b/Weights/include/CGAL/Weights/cotangent_weights.h index c7596aa53ee..f4afc5c6f14 100644 --- a/Weights/include/CGAL/Weights/cotangent_weights.h +++ b/Weights/include/CGAL/Weights/cotangent_weights.h @@ -79,7 +79,7 @@ typename GeomTraits::FT cotangent_weight(const typename GeomTraits::Point_2& p0, { using FT = typename GeomTraits::FT; - const FT cot_beta = cotangent_2(q, p0, p1, traits); + const FT cot_beta = cotangent_2(q, p0, p1, traits); const FT cot_gamma = cotangent_2(p1, p2, q, traits); return cotangent_ns::weight(cot_beta, cot_gamma); @@ -116,7 +116,7 @@ typename GeomTraits::FT cotangent_weight(const typename GeomTraits::Point_3& p0, { using FT = typename GeomTraits::FT; - const FT cot_beta = cotangent_3(q, p0, p1, traits); + const FT cot_beta = cotangent_3(q, p0, p1, traits); const FT cot_gamma = cotangent_3(p1, p2, q, traits); return cotangent_ns::weight(cot_beta, cot_gamma); diff --git a/Weights/include/CGAL/Weights/internal/polygon_utils_2.h b/Weights/include/CGAL/Weights/internal/polygon_utils_2.h index f2933317972..361896fc105 100644 --- a/Weights/include/CGAL/Weights/internal/polygon_utils_2.h +++ b/Weights/include/CGAL/Weights/internal/polygon_utils_2.h @@ -106,7 +106,7 @@ Edge_case bounded_side_2(const VertexRange& polygon, auto orientation_2 = traits.orientation_2_object(); bool is_inside = false; - auto curr_y_comp_res = compare_y_2(get(point_map, *curr), query); + Comparison_result curr_y_comp_res = compare_y_2(get(point_map, *curr), query); // Check if the segment (curr, next) intersects // the ray { (t, query.y()) | t >= query.x() }. @@ -225,7 +225,8 @@ bool is_convex_2(const VertexRange& polygon, return true; auto equal_2 = traits.equal_2_object(); - while (equal_2(get(point_map, *prev), get(point_map, *curr))) { + while (equal_2(get(point_map, *prev), get(point_map, *curr))) + { curr = next; ++next; if (next == last) return true; diff --git a/Weights/include/CGAL/Weights/internal/utils.h b/Weights/include/CGAL/Weights/internal/utils.h index 2c01c4e1e30..f51136186b9 100644 --- a/Weights/include/CGAL/Weights/internal/utils.h +++ b/Weights/include/CGAL/Weights/internal/utils.h @@ -135,9 +135,10 @@ void normalize_2(typename GeomTraits::Vector_2& v, const GeomTraits& traits) { using FT = typename GeomTraits::FT; - const FT length = length_2(traits, v); - CGAL_assertion(length != FT(0)); - if (length == FT(0)) + + const FT length = length_2(v, traits); + CGAL_assertion(!is_zero(length)); + if (is_zero(length)) return; v /= length; @@ -174,15 +175,15 @@ void normalize_3(typename GeomTraits::Vector_3& v, const GeomTraits& traits) { using FT = typename GeomTraits::FT; - - const FT length = length_3(traits, v); - CGAL_assertion(length != FT(0)); - if (length == FT(0)) + const FT length = length_3(v, traits); + CGAL_assertion(!is_zero(length)); + if (is_zero(length)) return; v /= length; } +// the angle is in radians template double angle_3(const typename GeomTraits::Vector_3& v1, const typename GeomTraits::Vector_3& v2, @@ -213,24 +214,26 @@ typename GeomTraits::Point_3 rotate_point_3(const double angle_rad, using FT = typename GeomTraits::FT; using Point_3 = typename GeomTraits::Point_3; + auto point_3 = traits.construct_point_3_object(); + const FT c = static_cast(std::cos(angle_rad)); const FT s = static_cast(std::sin(angle_rad)); const FT C = FT(1) - c; - const FT x = axis.x(); - const FT y = axis.y(); - const FT z = axis.z(); + const FT& x = axis.x(); + const FT& y = axis.y(); + const FT& z = axis.z(); - return Point_3( - (x * x * C + c) * query.x() + - (x * y * C - z * s) * query.y() + - (x * z * C + y * s) * query.z(), - (y * x * C + z * s) * query.x() + - (y * y * C + c) * query.y() + - (y * z * C - x * s) * query.z(), - (z * x * C - y * s) * query.x() + - (z * y * C + x * s) * query.y() + - (z * z * C + c) * query.z()); + return point_3( + (x * x * C + c) * query.x() + + (x * y * C - z * s) * query.y() + + (x * z * C + y * s) * query.z(), + (y * x * C + z * s) * query.x() + + (y * y * C + c) * query.y() + + (y * z * C - x * s) * query.z(), + (z * x * C - y * s) * query.x() + + (z * y * C + x * s) * query.y() + + (z * z * C + c) * query.z()); } // Computes two 3D orthogonal base vectors wrt a given normal. @@ -245,9 +248,9 @@ void orthogonal_bases_3(const typename GeomTraits::Vector_3& normal, auto cross_product_3 = traits.construct_cross_product_vector_3_object(); - const FT nx = normal.x(); - const FT ny = normal.y(); - const FT nz = normal.z(); + const FT& nx = normal.x(); + const FT& ny = normal.y(); + const FT& nz = normal.z(); if (CGAL::abs(nz) >= CGAL::abs(ny)) b1 = Vector_3(nz, 0, -nx); @@ -268,13 +271,13 @@ typename GeomTraits::Point_2 to_2d(const typename GeomTraits::Vector_3& b1, const typename GeomTraits::Point_3& query, const GeomTraits& traits) { - using FT = typename GeomTraits::FT; - using Point_2 = typename GeomTraits::Point_2; + using FT = typename GeomTraits::FT; + using Point_2 = typename GeomTraits::Point_2; using Vector_3 = typename GeomTraits::Vector_3; - auto point_2 = traits.construct_point_2_object(); auto dot_product_3 = traits.compute_scalar_product_3_object(); auto vector_3 = traits.construct_vector_3_object(); + auto point_2 = traits.construct_point_2_object(); const Vector_3 v = vector_3(origin, query); const FT x = dot_product_3(b1, v); @@ -354,6 +357,7 @@ void flatten(const typename GeomTraits::Point_3& t, // prev neighbor/vertex/poin using Point_3 = typename GeomTraits::Point_3; using Vector_3 = typename GeomTraits::Vector_3; + auto point_3 = traits.construct_point_3_object(); auto cross_product_3 = traits.construct_cross_product_vector_3_object(); auto vector_3 = traits.construct_vector_3_object(); auto centroid_3 = traits.construct_centroid_3_object(); @@ -363,10 +367,10 @@ void flatten(const typename GeomTraits::Point_3& t, // prev neighbor/vertex/poin // std::cout << "centroid: " << center << std::endl; // Translate. - const Point_3 t1 = Point_3(t.x() - center.x(), t.y() - center.y(), t.z() - center.z()); - const Point_3 r1 = Point_3(r.x() - center.x(), r.y() - center.y(), r.z() - center.z()); - const Point_3 p1 = Point_3(p.x() - center.x(), p.y() - center.y(), p.z() - center.z()); - const Point_3 q1 = Point_3(q.x() - center.x(), q.y() - center.y(), q.z() - center.z()); + const Point_3 t1 = point_3(t.x() - center.x(), t.y() - center.y(), t.z() - center.z()); + const Point_3 r1 = point_3(r.x() - center.x(), r.y() - center.y(), r.z() - center.z()); + const Point_3 p1 = point_3(p.x() - center.x(), p.y() - center.y(), p.z() - center.z()); + const Point_3 q1 = point_3(q.x() - center.x(), q.y() - center.y(), q.z() - center.z()); // std::cout << "translated t1: " << t1 << std::endl; // std::cout << "translated r1: " << r1 << std::endl; @@ -447,10 +451,11 @@ typename GeomTraits::FT area_3(const typename GeomTraits::Point_3& p, const GeomTraits& traits) { using FT = typename GeomTraits::FT; - using Point_2 = typename GeomTraits::Point_2; using Point_3 = typename GeomTraits::Point_3; using Vector_3 = typename GeomTraits::Vector_3; + auto area_2 = traits.compute_area_2_object(); + auto point_3 = traits.construct_point_3_object(); auto cross_product_3 = traits.construct_cross_product_vector_3_object(); auto vector_3 = traits.construct_vector_3_object(); auto centroid_3 = traits.construct_centroid_3_object(); @@ -459,9 +464,9 @@ typename GeomTraits::FT area_3(const typename GeomTraits::Point_3& p, const Point_3 center = centroid_3(p, q, r); // Translate. - const Point_3 a = Point_3(p.x() - center.x(), p.y() - center.y(), p.z() - center.z()); - const Point_3 b = Point_3(q.x() - center.x(), q.y() - center.y(), q.z() - center.z()); - const Point_3 c = Point_3(r.x() - center.x(), r.y() - center.y(), r.z() - center.z()); + const Point_3 a = point_3(p.x() - center.x(), p.y() - center.y(), p.z() - center.z()); + const Point_3 b = point_3(q.x() - center.x(), q.y() - center.y(), q.z() - center.z()); + const Point_3 c = point_3(r.x() - center.x(), r.y() - center.y(), r.z() - center.z()); // Prev and next vectors. Vector_3 v1 = vector_3(b, a); @@ -483,8 +488,7 @@ typename GeomTraits::FT area_3(const typename GeomTraits::Point_3& p, const Point_2 qf = to_2d(b1, b2, origin, b, traits); const Point_2 rf = to_2d(b1, b2, origin, c, traits); - const FT A = area_2(traits, pf, qf, rf); - return A; + return area_2(pf, qf, rf); } // Computes positive area of a 3D triangle. diff --git a/Weights/include/CGAL/Weights/utils.h b/Weights/include/CGAL/Weights/utils.h index 9f75bd14854..67c10ce16c2 100644 --- a/Weights/include/CGAL/Weights/utils.h +++ b/Weights/include/CGAL/Weights/utils.h @@ -45,8 +45,8 @@ typename GeomTraits::FT cotangent_2(const typename GeomTraits::Point_2& p, if (!is_zero(length)) return dot / length; - else - return FT(0); // undefined + + return FT(0); // undefined } template @@ -92,8 +92,8 @@ typename GeomTraits::FT cotangent_3(const typename GeomTraits::Point_3& p, const FT length = internal::length_3(cross, traits); if (!is_zero(length)) return dot / length; - else - return FT(0); // undefined + + return FT(0); // undefined } template @@ -140,10 +140,8 @@ typename GeomTraits::FT tangent_2(const typename GeomTraits::Point_2& p, const FT length = CGAL::abs(cross); return length / dot; } - else - { - return FT(0); // undefined - } + + return FT(0); // undefined } template @@ -190,10 +188,8 @@ typename GeomTraits::FT tangent_3(const typename GeomTraits::Point_3& p, const FT length = internal::length_3(cross, traits); return length / dot; } - else - { - return FT(0); // undefined - } + + return FT(0); // undefined } template From 92ea84d672ba866286286c71975c9bd5aba3c714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Oct 2022 17:23:11 +0200 Subject: [PATCH 043/194] Factorize cotangent_weight classes --- .../include/CGAL/Weights/cotangent_weights.h | 361 ++++++------------ 1 file changed, 119 insertions(+), 242 deletions(-) diff --git a/Weights/include/CGAL/Weights/cotangent_weights.h b/Weights/include/CGAL/Weights/cotangent_weights.h index f4afc5c6f14..93413b7cb24 100644 --- a/Weights/include/CGAL/Weights/cotangent_weights.h +++ b/Weights/include/CGAL/Weights/cotangent_weights.h @@ -140,236 +140,165 @@ typename Kernel::FT cotangent_weight(const CGAL::Point_3& p0, /// \cond SKIP_IN_MANUAL // Undocumented cotangent weight class. -// -// Its constructor takes a polygon mesh and a vertex to point map -// and its operator() is defined based on the halfedge_descriptor only. -// This version is currently used in: -// Polygon_mesh_processing -> curvature_flow_impl.h -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> -class Edge_cotangent_weight -{ - using GeomTraits = typename CGAL::Kernel_traits::value_type>::type; - using FT = typename GeomTraits::FT; - - const PolygonMesh& m_pmesh; - const VertexPointMap m_pmap; - GeomTraits m_traits; - -public: - using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; - using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - - Edge_cotangent_weight(const PolygonMesh& pmesh, const VertexPointMap pmap) - : m_pmesh(pmesh), m_pmap(pmap), m_traits() - { } - - FT operator()(const halfedge_descriptor he) const - { - - FT weight = FT(0); - if (is_border_edge(he, m_pmesh)) - { - const halfedge_descriptor h1 = next(he, m_pmesh); - - const vertex_descriptor v0 = target(he, m_pmesh); - const vertex_descriptor v1 = source(he, m_pmesh); - const vertex_descriptor v2 = target(h1, m_pmesh); - - const auto& p0 = get(m_pmap, v0); - const auto& p1 = get(m_pmap, v1); - const auto& p2 = get(m_pmap, v2); - - weight = internal::cotangent_3(m_traits, p0, p2, p1); - - } - else - { - const halfedge_descriptor h1 = next(he, m_pmesh); - const halfedge_descriptor h2 = prev(opposite(he, m_pmesh), m_pmesh); - - const vertex_descriptor v0 = target(he, m_pmesh); - const vertex_descriptor v1 = source(he, m_pmesh); - const vertex_descriptor v2 = target(h1, m_pmesh); - const vertex_descriptor v3 = source(h2, m_pmesh); - - const auto& p0 = get(m_pmap, v0); - const auto& p1 = get(m_pmap, v1); - const auto& p2 = get(m_pmap, v2); - const auto& p3 = get(m_pmap, v3); - - weight = cotangent_weight(p2, p1, p3, p0) / FT(2); - } - return weight; - } -}; - -// Undocumented cotangent weight class. +// Returns: cot(beta) // // Returns a single cotangent weight, its operator() is defined based on the // halfedge_descriptor, polygon mesh, and vertex to point map. // For border edges it returns zero. // This version is currently used in: // Surface_mesh_deformation -> Surface_mesh_deformation.h -template +template::value_type>::type> class Single_cotangent_weight { -public: using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - template - decltype(auto) operator()(const halfedge_descriptor he, - const PolygonMesh& pmesh, - const VertexPointMap pmap) const + using Point_ref = typename boost::property_traits::reference; + using FT = typename GeomTraits::FT; + +private: + const PolygonMesh& m_pmesh; + const VertexPointMap m_vpm; + const GeomTraits m_traits; + +public: + Single_cotangent_weight(const PolygonMesh& pmesh, + const VertexPointMap vpm, + const GeomTraits& traits = GeomTraits()) + : m_pmesh(pmesh), m_vpm(vpm), m_traits(traits) + { } + + decltype(auto) operator()(const halfedge_descriptor he) const { - using GeomTraits = typename CGAL::Kernel_traits::value_type>::type; - using FT = typename GeomTraits::FT; - GeomTraits traits; + if (is_border(he, m_pmesh)) + return FT{0}; - if (is_border(he, pmesh)) - return FT(0); + const vertex_descriptor v0 = target(he, m_pmesh); + const vertex_descriptor v1 = source(he, m_pmesh); + const vertex_descriptor v2 = target(next(he, m_pmesh), m_pmesh); - const vertex_descriptor v0 = target(he, pmesh); - const vertex_descriptor v1 = source(he, pmesh); - const vertex_descriptor v2 = target(next(he, pmesh), pmesh); + const Point_ref p0 = get(m_vpm, v0); + const Point_ref p1 = get(m_vpm, v1); + const Point_ref p2 = get(m_vpm, v2); - const auto& p0 = get(pmap, v0); - const auto& p1 = get(pmap, v1); - const auto& p2 = get(pmap, v2); - - return internal::cotangent_3(traits, p0, p2, p1); + return cotangent_3(p0, p2, p1, m_traits); } }; // Undocumented cotangent weight class. +// Returns: 0.5 * (cot(beta) + cot(gamma)) // // Its constructor takes a boolean flag to choose between default and clamped // versions of the cotangent weights and its operator() is defined based on the // halfedge_descriptor, polygon mesh, and vertex to point map. // This version is currently used in: +// Polygon_mesh_processing -> curvature_flow_impl.h (no clamping, no bounding) // Surface_mesh_deformation -> Surface_mesh_deformation.h (default version) // Surface_mesh_parameterizer -> Orbifold_Tutte_parameterizer_3.h (default version) // Surface_mesh_skeletonization -> Mean_curvature_flow_skeletonization.h (clamped version) -template +template::value_type>::type> class Cotangent_weight { - bool m_use_clamped_version; - -public: using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - Cotangent_weight(const bool use_clamped_version = false) - : m_use_clamped_version(use_clamped_version) + using Point_ref = typename boost::property_traits::reference; + using FT = typename GeomTraits::FT; + +private: + const PolygonMesh& m_pmesh; + const VertexPointMap m_vpm; + const GeomTraits m_traits; + + bool m_use_clamped_version; + bool m_bound_from_below; + +public: + Cotangent_weight(const PolygonMesh& pmesh, + const VertexPointMap vpm, + const GeomTraits& traits = GeomTraits(), + const bool use_clamped_version = false, + const bool bound_from_below = true) + : m_pmesh(pmesh), m_vpm(vpm), m_traits(traits), + m_use_clamped_version(use_clamped_version), + m_bound_from_below(bound_from_below) { } - template - decltype(auto) operator()(const halfedge_descriptor he, - const PolygonMesh& pmesh, - const VertexPointMap pmap) const + decltype(auto) operator()(const halfedge_descriptor he) const { - using GeomTraits = typename CGAL::Kernel_traits::value_type>::type; - using FT = typename GeomTraits::FT; + if(is_border(he, m_pmesh)) + return FT{0}; - GeomTraits traits; - - const vertex_descriptor v0 = target(he, pmesh); - const vertex_descriptor v1 = source(he, pmesh); - - const auto& p0 = get(pmap, v0); - const auto& p1 = get(pmap, v1); - - FT weight = FT(0); - if (is_border_edge(he, pmesh)) + auto half_weight = [&] (const halfedge_descriptor he) -> FT { - const halfedge_descriptor he_cw = opposite(next(he, pmesh), pmesh); - auto v2 = source(he_cw, pmesh); + if(is_border(he, m_pmesh)) + return FT{0}; - if (is_border_edge(he_cw, pmesh)) - { - const halfedge_descriptor he_ccw = prev(opposite(he, pmesh), pmesh); - v2 = source(he_ccw, pmesh); + const vertex_descriptor v0 = target(he, m_pmesh); + const vertex_descriptor v1 = source(he, m_pmesh); + const vertex_descriptor v2 = target(next(he, m_pmesh), m_pmesh); - const auto& p2 = get(pmap, v2); - if (m_use_clamped_version) - weight = internal::cotangent_3_clamped(traits, p1, p2, p0); - else - weight = internal::cotangent_3(traits, p1, p2, p0); - - weight = (CGAL::max)(FT(0), weight); - weight /= FT(2); - } - else - { - const auto& p2 = get(pmap, v2); - if (m_use_clamped_version) - weight = internal::cotangent_3_clamped(traits, p0, p2, p1); - else - weight = internal::cotangent_3(traits, p0, p2, p1); - - weight = (CGAL::max)(FT(0), weight); - weight /= FT(2); - } - } - else - { - const halfedge_descriptor he_cw = opposite(next(he, pmesh), pmesh); - const vertex_descriptor v2 = source(he_cw, pmesh); - const halfedge_descriptor he_ccw = prev(opposite(he, pmesh), pmesh); - const vertex_descriptor v3 = source(he_ccw, pmesh); - - const auto& p2 = get(pmap, v2); - const auto& p3 = get(pmap, v3); - FT cot_beta = FT(0), cot_gamma = FT(0); + const Point_ref p0 = get(m_vpm, v0); + const Point_ref p1 = get(m_vpm, v1); + const Point_ref p2 = get(m_vpm, v2); + FT weight = 0; if (m_use_clamped_version) - cot_beta = internal::cotangent_3_clamped(traits, p0, p2, p1); + weight = cotangent_3_clamped(p1, p2, p0, m_traits); else - cot_beta = internal::cotangent_3(traits, p0, p2, p1); + weight = cotangent_3(p1, p2, p0, m_traits); - if (m_use_clamped_version) - cot_gamma = internal::cotangent_3_clamped(traits, p1, p3, p0); - else - cot_gamma = internal::cotangent_3(traits, p1, p3, p0); + if(m_bound_from_below) + weight = (CGAL::max)(FT(0), weight); - cot_beta = (CGAL::max)(FT(0), cot_beta); cot_beta /= FT(2); - cot_gamma = (CGAL::max)(FT(0), cot_gamma); cot_gamma /= FT(2); - weight = cot_beta + cot_gamma; - } + return weight / FT(2); + }; + FT weight = half_weight(he) + half_weight(opposite(he, m_pmesh)); return weight; } }; // Undocumented cotangent weight class. +// // Its constructor takes a polygon mesh and a vertex to point map // and its operator() is defined based on the halfedge_descriptor only. // This class is using a special clamped version of the cotangent weights. // This version is currently used in: // Polygon_mesh_processing -> fair.h // Polyhedron demo -> Hole_filling_plugin.cpp -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> +template class Secure_cotangent_weight_with_voronoi_area { - using GeomTraits = typename CGAL::Kernel_traits::value_type>::type; - using FT = typename GeomTraits::FT; - using Vector_3 = typename GeomTraits::Vector_3; - - const PolygonMesh& m_pmesh; - const VertexPointMap m_pmap; - GeomTraits m_traits; - -public: using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; + using Point_ref = typename boost::property_traits::reference; + using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; + +private: + const PolygonMesh& m_pmesh; + const VertexPointMap m_vpm; + GeomTraits m_traits; + + Cotangent_weight cotangent_weight_calculator; + +public: Secure_cotangent_weight_with_voronoi_area(const PolygonMesh& pmesh, - const VertexPointMap pmap) - : m_pmesh(pmesh), m_pmap(pmap), m_traits() + const VertexPointMap vpm, + const GeomTraits& traits = GeomTraits()) + : m_pmesh(pmesh), m_vpm(vpm), m_traits(traits), + cotangent_weight_calculator(m_pmesh, m_vpm, m_traits, + true /*clamp*/, true /*bound from below*/) { } FT w_i(const vertex_descriptor v_i) const @@ -379,89 +308,46 @@ public: FT w_ij(const halfedge_descriptor he) const { - return cotangent_clamped(he); + return cotangent_weight_calculator(he); } private: - FT cotangent_clamped(const halfedge_descriptor he) const - { - - const vertex_descriptor v0 = target(he, m_pmesh); - const vertex_descriptor v1 = source(he, m_pmesh); - - const auto& p0 = get(m_pmap, v0); - const auto& p1 = get(m_pmap, v1); - - FT weight = FT(0); - if (is_border_edge(he, m_pmesh)) - { - const halfedge_descriptor he_cw = opposite(next(he, m_pmesh), m_pmesh); - vertex_descriptor v2 = source(he_cw, m_pmesh); - - if (is_border_edge(he_cw, m_pmesh)) - { - const halfedge_descriptor he_ccw = prev(opposite(he, m_pmesh), m_pmesh); - v2 = source(he_ccw, m_pmesh); - - const auto& p2 = get(m_pmap, v2); - weight = internal::cotangent_3_clamped(m_traits, p1, p2, p0); - } - else - { - const auto& p2 = get(m_pmap, v2); - weight = internal::cotangent_3_clamped(m_traits, p0, p2, p1); - } - } - else - { - const halfedge_descriptor he_cw = opposite(next(he, m_pmesh), m_pmesh); - const vertex_descriptor v2 = source(he_cw, m_pmesh); - const halfedge_descriptor he_ccw = prev(opposite(he, m_pmesh), m_pmesh); - const vertex_descriptor v3 = source(he_ccw, m_pmesh); - - const auto& p2 = get(m_pmap, v2); - const auto& p3 = get(m_pmap, v3); - - const FT cot_beta = internal::cotangent_3_clamped(m_traits, p0, p2, p1); - const FT cot_gamma = internal::cotangent_3_clamped(m_traits, p1, p3, p0); - weight = cot_beta + cot_gamma; - } - - return weight; - } - FT voronoi(const vertex_descriptor v0) const { auto squared_length_3 = m_traits.compute_squared_length_3_object(); auto vector_3 = m_traits.construct_vector_3_object(); FT voronoi_area = FT(0); - CGAL_assertion(CGAL::is_triangle_mesh(m_pmesh)); - for (const halfedge_descriptor& he : halfedges_around_target(halfedge(v0, m_pmesh), m_pmesh)) + for (const halfedge_descriptor he : halfedges_around_target(halfedge(v0, m_pmesh), m_pmesh)) { CGAL_assertion(v0 == target(he, m_pmesh)); + CGAL_assertion(CGAL::is_triangle(he, m_pmesh)); + if (is_border(he, m_pmesh)) continue; const vertex_descriptor v1 = source(he, m_pmesh); const vertex_descriptor v2 = target(next(he, m_pmesh), m_pmesh); - const auto& p0 = get(m_pmap, v0); - const auto& p1 = get(m_pmap, v1); - const auto& p2 = get(m_pmap, v2); + const Point_ref p0 = get(m_vpm, v0); + const Point_ref p1 = get(m_vpm, v1); + const Point_ref p2 = get(m_vpm, v2); - const Angle angle0 = CGAL::angle(p1, p0, p2); - const Angle angle1 = CGAL::angle(p2, p1, p0); - const Angle angle2 = CGAL::angle(p0, p2, p1); - - const bool obtuse = (angle0 == CGAL::OBTUSE) || - (angle1 == CGAL::OBTUSE) || - (angle2 == CGAL::OBTUSE); - - if (!obtuse) + const CGAL::Angle angle0 = CGAL::angle(p1, p0, p2); + if((angle0 == CGAL::OBTUSE) || + (CGAL::angle(p2, p1, p0) == CGAL::OBTUSE) || + (CGAL::angle(p0, p2, p1) == CGAL::OBTUSE)) { - const FT cot_p1 = internal::cotangent_3(m_traits, p2, p1, p0); - const FT cot_p2 = internal::cotangent_3(m_traits, p0, p2, p1); + const FT A = internal::positive_area_3(m_traits, p0, p1, p2); + if (angle0 == CGAL::OBTUSE) + voronoi_area += A / FT(2); + else + voronoi_area += A / FT(4); + } + else + { + const FT cot_p1 = cotangent_3_clamped(p2, p1, p0, m_traits); + const FT cot_p2 = cotangent_3_clamped(p0, p2, p1, m_traits); const Vector_3 v1 = vector_3(p0, p1); const Vector_3 v2 = vector_3(p0, p2); @@ -469,19 +355,10 @@ private: const FT t1 = cot_p1 * squared_length_3(v2); const FT t2 = cot_p2 * squared_length_3(v1); voronoi_area += (t1 + t2) / FT(8); - - } - else - { - const FT A = internal::positive_area_3(m_traits, p0, p1, p2); - if (angle0 == CGAL::OBTUSE) - voronoi_area += A / FT(2); - else - voronoi_area += A / FT(4); } } - CGAL_assertion(voronoi_area != FT(0)); + CGAL_assertion(!is_zero(voronoi_area)); return voronoi_area; } }; From 670fec5e3cef8cbd4f4427b4ecca1467d8ee4f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Oct 2022 17:23:54 +0200 Subject: [PATCH 044/194] Fix issues in tangent_weight classes - Edge_tangent_weight returns 0 if the halfedge is border - if opp(h, mesh) is tangent, properly returns tan of the HALF angle and not tangent_3. --- .../include/CGAL/Weights/tangent_weights.h | 114 ++++++++++-------- 1 file changed, 65 insertions(+), 49 deletions(-) diff --git a/Weights/include/CGAL/Weights/tangent_weights.h b/Weights/include/CGAL/Weights/tangent_weights.h index 119dee11623..afa64e2da90 100644 --- a/Weights/include/CGAL/Weights/tangent_weights.h +++ b/Weights/include/CGAL/Weights/tangent_weights.h @@ -365,16 +365,24 @@ typename Kernel::FT tangent_weight(const CGAL::Point_3& p0, return tangent_weight(p0, p1, p2, q, traits); } +/// \cond SKIP_IN_MANUAL + // Undocumented tangent weight class. +// // Its constructor takes a polygon mesh and a vertex to point map // and its operator() is defined based on the halfedge_descriptor only. // This version is currently used in: // Surface_mesh_parameterizer -> Iterative_authalic_parameterizer_3.h -template::type> +template< + typename PolygonMesh, + typename VertexPointMap, + typename GeomTraits> class Edge_tangent_weight { - using GeomTraits = typename CGAL::Kernel_traits::value_type>::type; + using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; + using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; + + using Point_ref = typename boost::property_traits::reference; using FT = typename GeomTraits::FT; const PolygonMesh& m_pmesh; @@ -382,17 +390,20 @@ class Edge_tangent_weight const GeomTraits m_traits; public: - using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; - using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - Edge_tangent_weight(const PolygonMesh& pmesh, const VertexPointMap pmap) - : m_pmesh(pmesh), m_pmap(pmap), m_traits() + Edge_tangent_weight(const PolygonMesh& pmesh, + const VertexPointMap pmap, + const GeomTraits& traits) + : m_pmesh(pmesh), m_pmap(pmap), m_traits(traits) { } - FT operator()(const halfedge_descriptor he) const + FT operator()(halfedge_descriptor he) const { + if(is_border(he, m_pmesh)) + return FT(0); + FT weight = FT(0); - if (is_border_edge(he, m_pmesh)) + if (is_border_edge(he, m_pmesh)) // ie, opp(he, pmesh) is a border halfedge { const halfedge_descriptor h1 = next(he, m_pmesh); @@ -400,11 +411,11 @@ public: const vertex_descriptor v1 = source(he, m_pmesh); const vertex_descriptor v2 = target(h1, m_pmesh); - const auto& p0 = get(m_pmap, v0); - const auto& p1 = get(m_pmap, v1); - const auto& p2 = get(m_pmap, v2); + const Point_ref p0 = get(m_pmap, v0); + const Point_ref p1 = get(m_pmap, v1); + const Point_ref p2 = get(m_pmap, v2); - weight = internal::tangent_3(m_traits, p0, p2, p1); + weight = half_tangent_weight(p1, p0, p2, m_traits) / FT(2); } else { @@ -416,75 +427,80 @@ public: const vertex_descriptor v2 = target(h1, m_pmesh); const vertex_descriptor v3 = source(h2, m_pmesh); - const auto& p0 = get(m_pmap, v0); - const auto& p1 = get(m_pmap, v1); - const auto& p2 = get(m_pmap, v2); - const auto& p3 = get(m_pmap, v3); + const Point_ref p0 = get(m_pmap, v0); + const Point_ref p1 = get(m_pmap, v1); + const Point_ref p2 = get(m_pmap, v2); + const Point_ref p3 = get(m_pmap, v3); - weight = tangent_weight(p2, p1, p3, p0) / FT(2); + weight = tangent_weight(p2, p1, p3, p0, m_traits) / FT(2); } return weight; } }; // Undocumented tangent weight class. +// Returns - std::tan(theta/2); uses positive areas. +// // Its constructor takes three points either in 2D or 3D. // This version is currently used in: // Surface_mesh_parameterizer -> MVC_post_processor_3.h // Surface_mesh_parameterizer -> Orbifold_Tutte_parameterizer_3.h template -class Tangent_weight { +class Tangent_weight +{ FT m_d_r, m_d_p, m_w_base; public: - template - Tangent_weight(const CGAL::Point_2& p, - const CGAL::Point_2& q, - const CGAL::Point_2& r) + template + Tangent_weight(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) { - using Vector_2 = typename GeomTraits::Vector_2; + const Kernel traits; - const GeomTraits traits; + using Vector_2 = typename Kernel::Vector_2; + auto vector_2 = traits.construct_vector_2_object(); auto scalar_product_2 = traits.compute_scalar_product_2_object(); - auto construct_vector_2 = traits.construct_vector_2_object(); - m_d_r = internal::distance_2(traits, q, r); - CGAL_assertion(m_d_r != FT(0)); // two points are identical! - m_d_p = internal::distance_2(traits, q, p); - CGAL_assertion(m_d_p != FT(0)); // two points are identical! + m_d_r = internal::distance_2(q, r, traits); + CGAL_assertion(is_positive(m_d_r)); // two points are identical! + m_d_p = internal::distance_2(q, p, traits); + CGAL_assertion(is_positive(m_d_p)); // two points are identical! - const Vector_2 v1 = construct_vector_2(q, r); - const Vector_2 v2 = construct_vector_2(q, p); + const Vector_2 v1 = vector_2(q, r); + const Vector_2 v2 = vector_2(q, p); + + const FT A = internal::positive_area_2(p, q, r, traits); + CGAL_assertion(!is_zero(A)); - const FT A = internal::positive_area_2(traits, p, q, r); - CGAL_assertion(A != FT(0)); // three points are identical! const FT S = scalar_product_2(v1, v2); m_w_base = -tangent_half_angle(m_d_r, m_d_p, A, S); } - template - Tangent_weight(const CGAL::Point_3& p, - const CGAL::Point_3& q, - const CGAL::Point_3& r) + template + Tangent_weight(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) { - using Vector_3 = typename GeomTraits::Vector_3; + const Kernel traits; - const GeomTraits traits; + using Vector_3 = typename Kernel::Vector_3; + auto vector_3 = traits.construct_vector_3_object(); auto scalar_product_3 = traits.compute_scalar_product_3_object(); - auto construct_vector_3 = traits.construct_vector_3_object(); - m_d_r = internal::distance_3(traits, q, r); - CGAL_assertion(m_d_r != FT(0)); // two points are identical! - m_d_p = internal::distance_3(traits, q, p); - CGAL_assertion(m_d_p != FT(0)); // two points are identical! + m_d_r = internal::distance_3(q, r, traits); + CGAL_assertion(is_positive(m_d_r)); // two points are identical! + m_d_p = internal::distance_3(q, p, traits); + CGAL_assertion(is_positive(m_d_p)); // two points are identical! - const Vector_3 v1 = construct_vector_3(q, r); - const Vector_3 v2 = construct_vector_3(q, p); + const Vector_3 v1 = vector_3(q, r); + const Vector_3 v2 = vector_3(q, p); + + const FT A = internal::positive_area_3(p, q, r, traits); + CGAL_assertion(is_positive(A)); - const FT A = internal::positive_area_3(traits, p, q, r); - CGAL_assertion(A != FT(0)); // three points are identical! const FT S = scalar_product_3(v1, v2); m_w_base = -tangent_half_angle(m_d_r, m_d_p, A, S); } From 7eb3002790e1d593d4b420dacde8133b40cedec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Oct 2022 17:25:52 +0200 Subject: [PATCH 045/194] Avoid computing all angles if possible --- .../CGAL/Weights/mixed_voronoi_region_weights.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h b/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h index 35136a82ec5..647e771a7c9 100644 --- a/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h +++ b/Weights/include/CGAL/Weights/mixed_voronoi_region_weights.h @@ -42,12 +42,10 @@ typename GeomTraits::FT mixed_voronoi_area(const typename GeomTraits::Point_2& p auto midpoint_2 = traits.construct_midpoint_2_object(); auto circumcenter_2 = traits.construct_circumcenter_2_object(); - const Angle a1 = angle_2(p, q, r); - const Angle a2 = angle_2(q, r, p); - const Angle a3 = angle_2(r, p, q); - Point_2 center; - if (a1 != CGAL::OBTUSE && a2 != CGAL::OBTUSE && a3 != CGAL::OBTUSE) + if (angle_2(p, q, r) != CGAL::OBTUSE && + angle_2(q, r, p) != CGAL::OBTUSE && + angle_2(r, p, q) != CGAL::OBTUSE) center = circumcenter_2(p, q, r); else center = midpoint_2(r, p); @@ -95,12 +93,10 @@ typename GeomTraits::FT mixed_voronoi_area(const typename GeomTraits::Point_3& p auto midpoint_3 = traits.construct_midpoint_3_object(); auto circumcenter_3 = traits.construct_circumcenter_3_object(); - const Angle a1 = angle_3(p, q, r); - const Angle a2 = angle_3(q, r, p); - const Angle a3 = angle_3(r, p, q); - Point_3 center; - if (a1 != CGAL::OBTUSE && a2 != CGAL::OBTUSE && a3 != CGAL::OBTUSE) + if (angle_3(p, q, r) != CGAL::OBTUSE && + angle_3(q, r, p) != CGAL::OBTUSE && + angle_3(r, p, q) != CGAL::OBTUSE) center = circumcenter_3(p, q, r); else center = midpoint_3(r, p); From 6cd5c24f70c44431c9bd31ff8a40d4cade9f3500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Oct 2022 17:26:34 +0200 Subject: [PATCH 046/194] Pass traits to the secure Vor-weighted cotan functor --- .../include/CGAL/Polygon_mesh_processing/fair.h | 16 +++++++++------- .../Plugins/PMP/Hole_filling_plugin.cpp | 13 +++++++------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h index 49ea054aa45..b90c3a798bc 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h @@ -159,20 +159,22 @@ bool fair(TriangleMesh& tmesh, #endif typedef typename GetVertexPointMap < TriangleMesh, NamedParameters>::type VPMap; + VPMap vpmap = choose_parameter(get_parameter(np, internal_np::vertex_point), + get_property_map(vertex_point, tmesh)); + + typedef typename GetGeomTraits < TriangleMesh, NamedParameters>::type GT; + GT gt = choose_parameter(get_parameter(np, internal_np::geom_traits)); // Cotangent_weight_with_voronoi_area_fairing has been changed to the version: - // Cotangent_weight_with_voronoi_area_fairing_secure to avoid imprecisions from + // Secure_cotangent_weight_with_voronoi_area to avoid imprecisions from // the issue #4706 - https://github.com/CGAL/cgal/issues/4706. - typedef CGAL::Weights::Secure_cotangent_weight_with_voronoi_area Default_weight_calculator; - - VPMap vpmap_ = choose_parameter(get_parameter(np, internal_np::vertex_point), - get_property_map(vertex_point, tmesh)); + typedef CGAL::Weights::Secure_cotangent_weight_with_voronoi_area Default_weight_calculator; return internal::fair(tmesh, vertices, choose_parameter(get_parameter(np, internal_np::sparse_linear_solver)), - choose_parameter(get_parameter(np, internal_np::weight_calculator), Default_weight_calculator(tmesh, vpmap_)), + choose_parameter(get_parameter(np, internal_np::weight_calculator), Default_weight_calculator(tmesh, vpmap, gt)), choose_parameter(get_parameter(np, internal_np::fairing_continuity), 1), - vpmap_); + vpmap); } template diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp index c4a6207c968..423ee5124c6 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp @@ -725,14 +725,15 @@ bool Polyhedron_demo_hole_filling_plugin::fill use_delaunay_triangulation(use_DT))); } else { - auto pmap = get_property_map(CGAL::vertex_point, poly); + auto vpm = get_property_map(CGAL::vertex_point, poly); + auto weight_calc = CGAL::Weights::Secure_cotangent_weight_with_voronoi_area(poly, vpm, EPICK()); + success = std::get<0>(CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole(poly, it, std::back_inserter(patch), CGAL::Emptyset_iterator(), - CGAL::Polygon_mesh_processing::parameters:: - weight_calculator(CGAL::Weights::Secure_cotangent_weight_with_voronoi_area(poly, pmap)). - density_control_factor(alpha). - fairing_continuity(continuity). - use_delaunay_triangulation(use_DT))); + CGAL::parameters::weight_calculator(weight_calc). + density_control_factor(alpha). + fairing_continuity(continuity). + use_delaunay_triangulation(use_DT))); } if(!success) { print_message("Error: fairing is not successful, only triangulation and refinement are applied!"); } From 19f847a74b6caed13faf7923073da7edf11c66d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Oct 2022 17:27:39 +0200 Subject: [PATCH 047/194] Fix API of cotan functor in shape smoothing --- .../internal/Smoothing/curvature_flow_impl.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h index fa600557af3..fa92c34bb3e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h @@ -78,7 +78,7 @@ public: vimap_(get(Vertex_local_index(), mesh_)), scale_volume_after_smoothing(true), traits_(traits), - weight_calculator_(mesh, vpmap) + weight_calculator_(mesh_, vpmap_, traits_, false /*no clamping*/, false /*no bounding from below*/) { } template @@ -177,7 +177,8 @@ public: if(is_source_constrained && is_target_constrained) continue; - const FT Lij = weight_calculator_(hi); + // Cotangent_weight returns (cot(beta) + cot(gamma)) / 2 + const FT Lij = FT(2) * weight_calculator_(hi); const std::size_t i_source = get(vimap_, v_source); const std::size_t i_target = get(vimap_, v_target); @@ -368,8 +369,8 @@ private: std::vector diagonal_; // index of vector -> index of vimap_ std::vector constrained_flags_; - const GeomTraits& traits_; - const CGAL::Weights::Edge_cotangent_weight weight_calculator_; + GeomTraits traits_; + const CGAL::Weights::Cotangent_weight weight_calculator_; }; } // internal From 91336eb213ab042b0c2fc61d1772eed9f27c751d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Oct 2022 17:28:00 +0200 Subject: [PATCH 048/194] Use modern C++ --- .../internal/Smoothing/curvature_flow_impl.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h index fa92c34bb3e..509d2394fdd 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h @@ -186,14 +186,14 @@ public: // note that these constraints create asymmetry in the matrix if(!is_source_constrained) { - stiffness_elements.push_back(Triplet(i_source, i_target, Lij)); - diag_coeff.insert(std::make_pair(i_source, 0)).first->second -= Lij; + stiffness_elements.emplace_back(i_source, i_target, Lij); + diag_coeff.emplace(i_source, 0).first->second -= Lij; } if(!is_target_constrained) { - stiffness_elements.push_back(Triplet(i_target, i_source, Lij)); - diag_coeff.insert(std::make_pair(i_target, 0)).first->second -= Lij; + stiffness_elements.emplace_back(i_target, i_source, Lij); + diag_coeff.emplace(i_target, 0).first->second -= Lij; } } } @@ -201,7 +201,7 @@ public: typename std::unordered_map::iterator it = diag_coeff.begin(), end = diag_coeff.end(); for(; it!=end; ++it) - stiffness_elements.push_back(Triplet(it->first, it->first, it->second)); + stiffness_elements.emplace_back(it->first, it->first, it->second); } void update_mesh_no_scaling(const Eigen_vector& Xx, const Eigen_vector& Xy, const Eigen_vector& Xz) From 010e24f4ff10b75792ae6441d3b2295d2e8fa908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Oct 2022 17:28:42 +0200 Subject: [PATCH 049/194] Fix weight calculator initialization in Surface mesh deformation --- .../include/CGAL/Surface_mesh_deformation.h | 252 ++++++++---------- 1 file changed, 110 insertions(+), 142 deletions(-) diff --git a/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h b/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h index c267c49b808..a715accf733 100644 --- a/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h +++ b/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h @@ -55,49 +55,72 @@ enum Deformation_algorithm_tag /// @cond CGAL_DOCUMENT_INTERNAL namespace internal { -template +// property map that create a Simple_cartesian::Point_3 +// on the fly in order the deformation class to be used +// with points with minimal requirements +template +struct SC_on_the_fly_pmap + : public Vertex_point_map +{ + typedef boost::readable_property_map_tag category; + typedef CGAL::Simple_cartesian::Point_3 value_type; + typedef value_type reference; + typedef typename boost::property_traits::key_type key_type; + + SC_on_the_fly_pmap(Vertex_point_map base): + Vertex_point_map(base) {} + + friend value_type + get(const SC_on_the_fly_pmap map, key_type k) + { + typename boost::property_traits::reference base= + get(static_cast(map), k); + return value_type(base[0], base[1], base[2]); + } +}; + +template struct Types_selectors; -template -struct Types_selectors { +template +struct Types_selectors +{ + typedef SC_on_the_fly_pmap Wrapped_VertexPointMap; + typedef CGAL::Weights::Single_cotangent_weight Weight_calculator; - // Get weight from the weight interface. - typedef CGAL::Weights::Single_cotangent_weight Weight_calculator; - - struct ARAP_visitor{ - template + struct ARAP_visitor + { void init(TriangleMesh, VertexPointMap){} - void rotation_matrix_pre( - typename boost::graph_traits::vertex_descriptor, - TriangleMesh&){} + void rotation_matrix_pre(typename boost::graph_traits::vertex_descriptor, + TriangleMesh&){} template - void update_covariance_matrix( - Square_matrix_3&, - const Square_matrix_3&){} + void update_covariance_matrix(Square_matrix_3&, + const Square_matrix_3&){} void set_sre_arap_alpha(double){} }; }; -template -struct Types_selectors { +template +struct Types_selectors +{ + typedef SC_on_the_fly_pmap Wrapped_VertexPointMap; + typedef CGAL::Weights::Cotangent_weight Weight_calculator; - // Get weight from the weight interface. - typedef CGAL::Weights::Cotangent_weight Weight_calculator; - - typedef typename Types_selectors - ::ARAP_visitor ARAP_visitor; + typedef typename Types_selectors::ARAP_visitor ARAP_visitor; }; -template -struct Types_selectors { +template +struct Types_selectors +{ + typedef SC_on_the_fly_pmap Wrapped_VertexPointMap; + typedef CGAL::Weights::Cotangent_weight Weight_calculator; - // Get weight from the weight interface. - typedef CGAL::Weights::Cotangent_weight Weight_calculator; - - class ARAP_visitor{ + class ARAP_visitor + { double m_nb_edges_incident; double m_area; double m_alpha; @@ -105,7 +128,6 @@ struct Types_selectors { public: ARAP_visitor(): m_alpha(0.02) {} - template void init(TriangleMesh triangle_mesh, const VertexPointMap& vpmap) { // calculate area @@ -144,31 +166,6 @@ struct Types_selectors { }; }; -// property map that create a Simple_cartesian::Point_3 -// on the fly in order the deformation class to be used -// with points with minimal requirements -template -struct SC_on_the_fly_pmap - : public Vertex_point_map -{ - typedef boost::readable_property_map_tag category; - typedef CGAL::Simple_cartesian::Point_3 value_type; - typedef value_type reference; - typedef typename boost::property_traits::key_type key_type; - - SC_on_the_fly_pmap(Vertex_point_map base): - Vertex_point_map(base) {} - - friend value_type - get(const SC_on_the_fly_pmap map, key_type k) - { - typename boost::property_traits::reference base= - get(static_cast(map), k); - return value_type(base[0], base[1], base[2]); - } -}; - - }//namespace internal /// @endcond @@ -235,17 +232,6 @@ public: typedef HIM Hedge_index_map; #endif -// weight calculator -#ifndef DOXYGEN_RUNNING - typedef typename Default::Get< - WC, - typename internal::Types_selectors::Weight_calculator - >::type Weight_calculator; -#else - /// weight calculator functor type - typedef WC Weight_calculator; -#endif - // sparse linear solver #ifndef DOXYGEN_RUNNING typedef typename Default::Get< @@ -290,6 +276,17 @@ public: typedef VPM Vertex_point_map; #endif +// weight calculator +#ifndef DOXYGEN_RUNNING + typedef typename Default::Get< + WC, + typename internal::Types_selectors::Weight_calculator + >::type Weight_calculator; +#else + /// weight calculator functor type + typedef WC Weight_calculator; +#endif + /// The type for vertex descriptor typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; /// The type for halfedge descriptor @@ -304,8 +301,6 @@ public: private: typedef Surface_mesh_deformation Self; // Repeat Triangle_mesh types - typedef typename boost::graph_traits::vertex_iterator vertex_iterator; - typedef typename boost::graph_traits::halfedge_iterator halfedge_iterator; typedef typename boost::graph_traits::in_edge_iterator in_edge_iterator; typedef typename boost::graph_traits::out_edge_iterator out_edge_iterator; @@ -340,12 +335,11 @@ private: bool last_preprocess_successful; ///< stores the result of last call to preprocess() + Vertex_point_map vertex_point_map; Weight_calculator weight_calculator; - Vertex_point_map vertex_point_map; - public: - typename internal::Types_selectors::ARAP_visitor arap_visitor; + typename internal::Types_selectors::ARAP_visitor arap_visitor; private: #ifdef CGAL_DEFORM_MESH_USE_EXPERIMENTAL_SCALE @@ -359,68 +353,13 @@ public: public: /// \cond SKIP_FROM_MANUAL - //vertex_point_map set by default - Surface_mesh_deformation(Triangle_mesh& triangle_mesh, - Vertex_index_map vertex_index_map, - Hedge_index_map hedge_index_map) - : m_triangle_mesh(triangle_mesh), - vertex_index_map(vertex_index_map), - hedge_index_map(hedge_index_map), - ros_id_map(std::vector(num_vertices(triangle_mesh), (std::numeric_limits::max)() )), - is_roi_map(std::vector(num_vertices(triangle_mesh), false)), - is_ctrl_map(std::vector(num_vertices(triangle_mesh), false)), - m_iterations(5), m_tolerance(1e-4), - need_preprocess_factorization(true), - need_preprocess_region_of_solution(true), - last_preprocess_successful(false), - weight_calculator(Weight_calculator()), - vertex_point_map(get(vertex_point, triangle_mesh)) - { - init(); - } - - //vertex_point_map and hedge_index_map set by default - Surface_mesh_deformation(Triangle_mesh& triangle_mesh, - Vertex_index_map vertex_index_map) - : m_triangle_mesh(triangle_mesh), - vertex_index_map(vertex_index_map), - hedge_index_map(CGAL::get_initialized_halfedge_index_map(triangle_mesh)), - ros_id_map(std::vector(num_vertices(triangle_mesh), (std::numeric_limits::max)() )), - is_roi_map(std::vector(num_vertices(triangle_mesh), false)), - is_ctrl_map(std::vector(num_vertices(triangle_mesh), false)), - m_iterations(5), m_tolerance(1e-4), - need_preprocess_factorization(true), - need_preprocess_region_of_solution(true), - last_preprocess_successful(false), - weight_calculator(Weight_calculator()), - vertex_point_map(get(vertex_point, triangle_mesh)) - { - init(); - } - //vertex_point_map, hedge_index_map and vertex_index_map set by default - Surface_mesh_deformation(Triangle_mesh& triangle_mesh) - : m_triangle_mesh(triangle_mesh), - vertex_index_map(CGAL::get_initialized_vertex_index_map(triangle_mesh)), - hedge_index_map(CGAL::get_initialized_halfedge_index_map(triangle_mesh)), - ros_id_map(std::vector(num_vertices(triangle_mesh), (std::numeric_limits::max)() )), - is_roi_map(std::vector(num_vertices(triangle_mesh), false)), - is_ctrl_map(std::vector(num_vertices(triangle_mesh), false)), - m_iterations(5), m_tolerance(1e-4), - need_preprocess_factorization(true), - need_preprocess_region_of_solution(true), - last_preprocess_successful(false), - weight_calculator(Weight_calculator()), - vertex_point_map(get(vertex_point, triangle_mesh)) - { - init(); - } // Constructor with all the parameters provided Surface_mesh_deformation(Triangle_mesh& triangle_mesh, Vertex_index_map vertex_index_map, Hedge_index_map hedge_index_map, Vertex_point_map vertex_point_map, - Weight_calculator weight_calculator = Weight_calculator()) + Weight_calculator weight_calculator) : m_triangle_mesh(triangle_mesh), vertex_index_map(vertex_index_map), hedge_index_map(hedge_index_map), @@ -431,13 +370,47 @@ public: need_preprocess_factorization(true), need_preprocess_region_of_solution(true), last_preprocess_successful(false), - weight_calculator(weight_calculator), - vertex_point_map(vertex_point_map) + vertex_point_map(vertex_point_map), + weight_calculator(weight_calculator) { init(); } + + Surface_mesh_deformation(Triangle_mesh& triangle_mesh, + Vertex_index_map vertex_index_map, + Hedge_index_map hedge_index_map, + Vertex_point_map vertex_point_map) + : Surface_mesh_deformation(triangle_mesh, + vertex_index_map, + hedge_index_map, + vertex_point_map, + Weight_calculator(triangle_mesh, internal::SC_on_the_fly_pmap(vertex_point_map))) + { } + + Surface_mesh_deformation(Triangle_mesh& triangle_mesh, + Vertex_index_map vertex_index_map, + Hedge_index_map hedge_index_map) + : Surface_mesh_deformation(triangle_mesh, + vertex_index_map, + hedge_index_map, + get(vertex_point, triangle_mesh)) + { } + + Surface_mesh_deformation(Triangle_mesh& triangle_mesh, + Vertex_index_map vertex_index_map) + : Surface_mesh_deformation(triangle_mesh, + vertex_index_map, + CGAL::get_initialized_halfedge_index_map(triangle_mesh)) + { } + + Surface_mesh_deformation(Triangle_mesh& triangle_mesh) + : Surface_mesh_deformation(triangle_mesh, + CGAL::get_initialized_vertex_index_map(triangle_mesh)) + { } + /// \endcond - #if DOXYGEN_RUNNING + +#if DOXYGEN_RUNNING /// \name Construction /// @{ /** @@ -457,21 +430,17 @@ public: Vertex_index_map vertex_index_map = unspecified_internal_vertex_index_map, Hedge_index_map hedge_index_map = unspecified_internal_halfedge_index_map, Vertex_point_map vertex_point_map = get(boost::vertex_point, triangle_mesh), - Weight_calculator weight_calculator = Weight_calculator()); + Weight_calculator weight_calculator = Weight_calculator(triangle_mesh, vertex_point_map)); /// @} #endif private: - void init() { - typedef internal::SC_on_the_fly_pmap Wrapper; - // compute halfedge weights - halfedge_iterator eb, ee; - hedge_weight.reserve(2*num_edges(m_triangle_mesh)); - for(std::tie(eb, ee) = halfedges(m_triangle_mesh); eb != ee; ++eb) - { - hedge_weight.push_back( - this->weight_calculator(*eb, m_triangle_mesh, Wrapper(vertex_point_map))); - } + void init() + { + hedge_weight.reserve(num_halfedges(m_triangle_mesh)); + for(halfedge_descriptor he : halfedges(m_triangle_mesh)) + hedge_weight.push_back(this->weight_calculator(he)); + arap_visitor.init(m_triangle_mesh, vertex_point_map); } @@ -854,7 +823,6 @@ public: */ void overwrite_initial_geometry() { - typedef internal::SC_on_the_fly_pmap Wrapper; if(roi.empty()) { return; } // no ROI to overwrite region_of_solution(); // the roi should be preprocessed since we are using original_position vec @@ -875,13 +843,13 @@ public: std::size_t id_e = id(he); if(is_weight_computed[id_e]) { continue; } - hedge_weight[id_e] = weight_calculator(he, m_triangle_mesh, Wrapper(vertex_point_map)); + hedge_weight[id_e] = weight_calculator(he); is_weight_computed[id_e] = true; halfedge_descriptor e_opp = opposite(he, m_triangle_mesh); std::size_t id_e_opp = id(e_opp); - hedge_weight[id_e_opp] = weight_calculator(e_opp, m_triangle_mesh, Wrapper(vertex_point_map)); + hedge_weight[id_e_opp] = weight_calculator(e_opp); is_weight_computed[id_e_opp] = true; } } From b469a58df9b31d58349138cf878021c8028139bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Oct 2022 17:29:44 +0200 Subject: [PATCH 050/194] Fix compilation of alternate, unused iterative authalic initializers --- .../Iterative_authalic_parameterizer_3.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h index 2e475b11db8..50c2fb16165 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h @@ -478,7 +478,7 @@ private: double weight; }; - NT determinant(Point_2& v0, Point_2& v1) const + NT determinant(const Point_2& v0, const Point_2& v1) const { return (v0.x() * v1.y() - v1.x() * v0.y()); } @@ -489,8 +489,8 @@ private: const NT det0 = determinant(uv1, uv2); const NT det1 = determinant(uv2, uv0); const NT det2 = determinant(uv0, uv1); - const NT det3 = CGAL::determinant(Vector_2(uv1.x()-uv0.x(), uv1.y()-uv0.y()), - Vector_2(uv2.x()-uv0.x(), uv2.y()-uv0.y())); + NT det3 = CGAL::determinant(Vector_2(uv1.x()-uv0.x(), uv1.y()-uv0.y()), + Vector_2(uv2.x()-uv0.x(), uv2.y()-uv0.y())); CGAL_assertion(det3 > NT(0)); if(det3 <= NT(0)) det3 = NT(1); @@ -527,7 +527,7 @@ private: { Neighbor_list NL; NL.vertex = *v_j; - NL.vector = Vector_3(get(ppmap, v), tmesh.point(*v_j)); + NL.vector = Vector_3(get(ppmap, v), get(ppmap, *v_j)); NL.length = sqrt(NL.vector.squared_length()); neighbor_list.push_back(NL); ++neighborsCounter; From 936b02b87eb45f7127b36ce3d3b5f9e114e515d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Oct 2022 17:30:18 +0200 Subject: [PATCH 051/194] Fix order of points: the circulator is clockwise around the vertex --- .../Discrete_authalic_parameterizer_3.h | 2 +- .../Discrete_conformal_map_parameterizer_3.h | 2 +- .../Iterative_authalic_parameterizer_3.h | 2 +- .../Mean_value_coordinates_parameterizer_3.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Discrete_authalic_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Discrete_authalic_parameterizer_3.h index aeb891cff92..ee6c011ce30 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Discrete_authalic_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Discrete_authalic_parameterizer_3.h @@ -187,7 +187,7 @@ protected: ++next_vertex_v_l; const Point_3& position_v_l = get(ppmap, *next_vertex_v_l); - return CGAL::Weights::authalic_weight(position_v_k, position_v_j, position_v_l, position_v_i) / NT(2); + return CGAL::Weights::authalic_weight(position_v_l, position_v_j, position_v_k, position_v_i) / NT(2); } }; diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Discrete_conformal_map_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Discrete_conformal_map_parameterizer_3.h index 3d09fad861c..b1afca32d4e 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Discrete_conformal_map_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Discrete_conformal_map_parameterizer_3.h @@ -183,7 +183,7 @@ protected: ++next_vertex_v_l; const Point_3& position_v_l = get(ppmap, *next_vertex_v_l); - return CGAL::Weights::cotangent_weight(position_v_k, position_v_j, position_v_l, position_v_i) / NT(2); + return CGAL::Weights::cotangent_weight(position_v_l, position_v_j, position_v_k, position_v_i) / NT(2); } }; diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h index 50c2fb16165..fce8e6d3622 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h @@ -723,7 +723,7 @@ private: VertexIndexMap& vimap) const { auto vpm = get_const_property_map(CGAL::vertex_point, tmesh); - const CGAL::Weights::Edge_tangent_weight compute_mvc(tmesh, vpm); + const CGAL::Weights::Edge_tangent_weight weight_calc(tmesh, vpm, Kernel()); const int i = get(vimap, v); diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Mean_value_coordinates_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Mean_value_coordinates_parameterizer_3.h index 95593adf95e..630391fa28b 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Mean_value_coordinates_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Mean_value_coordinates_parameterizer_3.h @@ -206,7 +206,7 @@ protected: ++next_vertex_v_l; const Point_3& position_v_l = get(ppmap, *next_vertex_v_l); - return CGAL::Weights::tangent_weight(position_v_k, position_v_j, position_v_l, position_v_i) / NT(2); + return CGAL::Weights::tangent_weight(position_v_l, position_v_j, position_v_k, position_v_i) / NT(2); } }; From ca93b406a2f57baad1a3d3bfc771805191ab62dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Oct 2022 17:30:45 +0200 Subject: [PATCH 052/194] Avoid needless length check (the weight functors already do it) --- .../Iterative_authalic_parameterizer_3.h | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h index fce8e6d3622..ca2fba0a85d 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h @@ -641,9 +641,6 @@ private: const PPM_ref position_v_i = get(ppmap, main_vertex_v_i); const PPM_ref position_v_j = get(ppmap, *neighbor_vertex_v_j); - const Vector_3 edge = position_v_i - position_v_j; - const NT squared_length = edge * edge; - vertex_around_target_circulator previous_vertex_v_k = neighbor_vertex_v_j; --previous_vertex_v_k; const PPM_ref position_v_k = get(ppmap, *previous_vertex_v_k); @@ -652,14 +649,10 @@ private: ++next_vertex_v_l; const PPM_ref position_v_l = get(ppmap, *next_vertex_v_l); - NT weight = NT(0); - CGAL_assertion(squared_length > NT(0)); // two points are identical! - if(squared_length != NT(0)) { - // This version was commented out to be an alternative weight - // in the original code by authors. - // weight = CGAL::Weights::authalic_weight(position_v_k, position_v_j, position_v_l, position_v_i) / NT(2); - weight = CGAL::Weights::cotangent_weight(position_v_k, position_v_j, position_v_l, position_v_i) / NT(2); - } + // This version was commented out to be an alternative weight in the original code by authors. +// NT weight = CGAL::Weights::authalic_weight(position_v_l, position_v_j, position_v_k, position_v_i) / NT(2); + NT weight = CGAL::Weights::cotangent_weight(position_v_l, position_v_j, position_v_k, position_v_i) / NT(2); + return weight; } From dfe3ff5d608fbdd4dbddb75b94a4ca426aa160c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Oct 2022 17:31:22 +0200 Subject: [PATCH 053/194] Code clarifications --- .../ARAP_parameterizer_3.h | 1 + .../Iterative_authalic_parameterizer_3.h | 2 +- .../Orbifold_Tutte_parameterizer_3.h | 10 +++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h index 33fef26c674..154b6f7f940 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h @@ -458,6 +458,7 @@ private: const Faces_vector& faces, Cot_map ctmap) const { + // Since we loop faces, we are implicitely defining the weight of border halfedges as 0... for(face_descriptor fd : faces) { halfedge_descriptor hd = halfedge(fd, mesh), hdb = hd; diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h index ca2fba0a85d..06d0fbc09bd 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Iterative_authalic_parameterizer_3.h @@ -726,7 +726,7 @@ private: for(halfedge_descriptor h : CGAL::halfedges_around_target(v, tmesh)) { - NT w_ij = NT(-1) * compute_mvc(h); + NT w_ij = NT(-1) * weight_calc(h); // w_ii = - sum of w_ijs w_ii -= w_ij; diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h index 3f8337d0660..5256204c0fd 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h @@ -783,9 +783,13 @@ private: const int i = get(vimap, vi); const int j = get(vimap, vj); - if (i > j) continue; - const CGAL::Weights::Cotangent_weight cotangent_weight; - const NT w_ij = NT(2) * cotangent_weight(hd, mesh, pmap); + if (i > j) + continue; + + const CGAL::Weights::Cotangent_weight cotangent_weight(mesh, pmap); + + // x2 because Cotangent_weight returns 0.5 * (cot alpha + cot beta)... + const NT w_ij = NT(2) * cotangent_weight(hd); // ij M.set_coef(2*i, 2*j, w_ij, true /* new coef */); From 59f2021eaf76da9ddbc7a2dec3552f3ee09a3801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Oct 2022 17:32:20 +0200 Subject: [PATCH 054/194] Update Weights doc figure to use compatible notations --- Weights/doc/Weights/fig/discrete_harmonic.svg | 552 +++++++++++------ Weights/doc/Weights/fig/mean_value.svg | 208 +++++-- Weights/doc/Weights/fig/tangent.svg | 229 ++++--- .../doc/Weights/fig/three_point_family.svg | 546 +++++++++++------ Weights/doc/Weights/fig/wachspress.svg | 561 ++++++++++++------ 5 files changed, 1429 insertions(+), 667 deletions(-) diff --git a/Weights/doc/Weights/fig/discrete_harmonic.svg b/Weights/doc/Weights/fig/discrete_harmonic.svg index 21fdafc5cd7..08c74518014 100644 --- a/Weights/doc/Weights/fig/discrete_harmonic.svg +++ b/Weights/doc/Weights/fig/discrete_harmonic.svg @@ -1,235 +1,439 @@ - + - - diff --git a/Weights/doc/Weights/fig/mean_value.svg b/Weights/doc/Weights/fig/mean_value.svg index 0e40e87eaef..d102c8d130f 100644 --- a/Weights/doc/Weights/fig/mean_value.svg +++ b/Weights/doc/Weights/fig/mean_value.svg @@ -1,79 +1,163 @@ - + - - diff --git a/Weights/doc/Weights/fig/tangent.svg b/Weights/doc/Weights/fig/tangent.svg index a52fcf03170..9ee59f419e8 100644 --- a/Weights/doc/Weights/fig/tangent.svg +++ b/Weights/doc/Weights/fig/tangent.svg @@ -1,93 +1,174 @@ - + - - diff --git a/Weights/doc/Weights/fig/three_point_family.svg b/Weights/doc/Weights/fig/three_point_family.svg index 21fdafc5cd7..079ce8129b1 100644 --- a/Weights/doc/Weights/fig/three_point_family.svg +++ b/Weights/doc/Weights/fig/three_point_family.svg @@ -1,235 +1,433 @@ - + - - diff --git a/Weights/doc/Weights/fig/wachspress.svg b/Weights/doc/Weights/fig/wachspress.svg index cc751743d65..2b79da2a60b 100644 --- a/Weights/doc/Weights/fig/wachspress.svg +++ b/Weights/doc/Weights/fig/wachspress.svg @@ -1,244 +1,439 @@ - + - - From 141f05abd27680c6b8b7748f0f236a99588e316a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Oct 2022 17:32:53 +0200 Subject: [PATCH 055/194] Use num_halfedges instead of 2*num_edges --- .../include/CGAL/Mean_curvature_flow_skeletonization.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h b/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h index 3882180786a..aa86264e177 100644 --- a/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h +++ b/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h @@ -883,11 +883,9 @@ private: void compute_edge_weight() { m_edge_weight.clear(); - m_edge_weight.reserve(2 * num_edges(m_tmesh)); + m_edge_weight.reserve(num_halfedges(m_tmesh)); for(halfedge_descriptor hd : halfedges(m_tmesh)) - { m_edge_weight.push_back(m_weight_calculator(hd, m_tmesh, m_tmesh_point_pmap)); - } } /// Assemble the left hand side. From f4f6229c428e182fa59efb11e8a59901cab3cbc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Oct 2022 17:34:02 +0200 Subject: [PATCH 056/194] Weights examples/tests improvements --- Weights/examples/Weights/convergence.cpp | 1 - .../examples/Weights/weighted_laplacian.cpp | 46 +- Weights/test/Weights/include/utils.h | 611 +++++++++--------- Weights/test/Weights/include/wrappers.h | 250 ++++--- .../test/Weights/test_authalic_weights.cpp | 23 +- .../test_barycentric_region_weights.cpp | 43 +- .../test/Weights/test_cotangent_weights.cpp | 33 +- .../test_discrete_harmonic_weights.cpp | 40 +- .../Weights/test_inverse_distance_weights.cpp | 48 +- .../test/Weights/test_mean_value_weights.cpp | 32 +- .../test_mixed_voronoi_region_weights.cpp | 21 +- .../test/Weights/test_projected_weights.cpp | 8 +- Weights/test/Weights/test_shepard_weights.cpp | 50 +- Weights/test/Weights/test_tangent_weights.cpp | 23 +- .../test_three_point_family_weights.cpp | 37 +- .../test_triangular_region_weights.cpp | 21 +- .../Weights/test_uniform_region_weights.cpp | 25 +- Weights/test/Weights/test_uniform_weights.cpp | 27 +- .../Weights/test_voronoi_region_weights.cpp | 21 +- .../test/Weights/test_wachspress_weights.cpp | 40 +- 20 files changed, 783 insertions(+), 617 deletions(-) diff --git a/Weights/examples/Weights/convergence.cpp b/Weights/examples/Weights/convergence.cpp index 8cc85915531..83bb06ebe83 100644 --- a/Weights/examples/Weights/convergence.cpp +++ b/Weights/examples/Weights/convergence.cpp @@ -1,5 +1,4 @@ #include -#include #include // Typedefs. diff --git a/Weights/examples/Weights/weighted_laplacian.cpp b/Weights/examples/Weights/weighted_laplacian.cpp index bd44f1fb0ea..af3e4345b41 100644 --- a/Weights/examples/Weights/weighted_laplacian.cpp +++ b/Weights/examples/Weights/weighted_laplacian.cpp @@ -20,18 +20,18 @@ using HD = boost::graph_traits::halfedge_descriptor; template FT get_w_ij(const Mesh& mesh, const HD he, const PointMap pmap) { - const auto v0 = target(he, mesh); - const auto v1 = source(he, mesh); + const VD v0 = target(he, mesh); + const VD v1 = source(he, mesh); const auto& q = get(pmap, v0); // query const auto& p1 = get(pmap, v1); // neighbor j if (is_border_edge(he, mesh)) { - const auto he_cw = opposite(next(he, mesh), mesh); - auto v2 = source(he_cw, mesh); + const HD he_cw = opposite(next(he, mesh), mesh); + VD v2 = source(he_cw, mesh); if (is_border_edge(he_cw, mesh)) { - const auto he_ccw = prev(opposite(he, mesh), mesh); + const HD he_ccw = prev(opposite(he, mesh), mesh); v2 = source(he_ccw, mesh); const auto& p2 = get(pmap, v2); // neighbor jp @@ -42,10 +42,10 @@ FT get_w_ij(const Mesh& mesh, const HD he, const PointMap pmap) { } } - const auto he_cw = opposite(next(he, mesh), mesh); - const auto v2 = source(he_cw, mesh); - const auto he_ccw = prev(opposite(he, mesh), mesh); - const auto v3 = source(he_ccw, mesh); + const HD he_cw = opposite(next(he, mesh), mesh); + const VD v2 = source(he_cw, mesh); + const HD he_ccw = prev(opposite(he, mesh), mesh); + const VD v3 = source(he_ccw, mesh); const auto& p0 = get(pmap, v2); // neighbor jm const auto& p2 = get(pmap, v3); // neighbor jp @@ -56,14 +56,14 @@ template FT get_w_i(const Mesh& mesh, const VD v_i, const PointMap pmap) { FT A_i = 0.0; - const auto v0 = v_i; - const auto init = halfedge(v_i, mesh); - for (const auto& he : halfedges_around_target(init, mesh)) { + const VD v0 = v_i; + const HD init = halfedge(v_i, mesh); + for (const HD he : halfedges_around_target(init, mesh)) { assert(v0 == target(he, mesh)); if (is_border(he, mesh)) { continue; } - const auto v1 = source(he, mesh); - const auto v2 = target(next(he, mesh), mesh); + const VD v1 = source(he, mesh); + const VD v2 = target(next(he, mesh), mesh); const auto& p = get(pmap, v0); const auto& q = get(pmap, v1); @@ -81,14 +81,14 @@ void set_laplacian_matrix(const Mesh& mesh, Matrix& L) { // Precompute Voronoi areas. std::map w_i; - for (const auto& v_i : vertices(mesh)) { + for (const VD v_i : vertices(mesh)) { w_i[get(imap, v_i)] = get_w_i(mesh, v_i, pmap); } // Fill the matrix. - for (const auto& he : halfedges(mesh)) { - const auto vi = source(he, mesh); - const auto vj = target(he, mesh); + for (const HD he : halfedges(mesh)) { + const VD vi = source(he, mesh); + const VD vj = target(he, mesh); const std::size_t i = get(imap, vi); const std::size_t j = get(imap, vj); @@ -106,11 +106,11 @@ int main() { // Create mesh. Mesh mesh; - const auto v0 = mesh.add_vertex(Point_3(0, 2, 0)); - const auto v1 = mesh.add_vertex(Point_3(2, 2, 0)); - const auto v2 = mesh.add_vertex(Point_3(0, 0, 0)); - const auto v3 = mesh.add_vertex(Point_3(2, 0, 0)); - const auto v4 = mesh.add_vertex(Point_3(1, 1, 1)); + const VD v0 = mesh.add_vertex(Point_3(0, 2, 0)); + const VD v1 = mesh.add_vertex(Point_3(2, 2, 0)); + const VD v2 = mesh.add_vertex(Point_3(0, 0, 0)); + const VD v3 = mesh.add_vertex(Point_3(2, 0, 0)); + const VD v4 = mesh.add_vertex(Point_3(1, 1, 1)); mesh.add_face(v0, v2, v4); mesh.add_face(v2, v3, v4); mesh.add_face(v3, v1, v4); diff --git a/Weights/test/Weights/include/utils.h b/Weights/test/Weights/include/utils.h index bfbc8d78086..90afd589149 100644 --- a/Weights/test/Weights/include/utils.h +++ b/Weights/test/Weights/include/utils.h @@ -1,113 +1,177 @@ #ifndef CGAL_WEIGHTS_TESTS_UTILS_H #define CGAL_WEIGHTS_TESTS_UTILS_H -// STL includes. +#include + +#include +#include + #include #include #include #include #include -// CGAL includes. -#include -#include -#include +namespace CGAL { +namespace Weights { +namespace internal { + +template +typename Kernel::FT squared_distance(const CGAL::Point_2& p, + const CGAL::Point_2& q) +{ + const Kernel traits; + auto squared_distance_2 = traits.compute_squared_distance_2_object(); + return squared_distance_2(p, q); +} + +template +typename Kernel::FT squared_distance(const CGAL::Point_3& p, + const CGAL::Point_3& q) +{ + const Kernel traits; + auto squared_distance_3 = traits.compute_squared_distance_3_object(); + return squared_distance_3(p, q); +} + +template +typename Kernel::FT distance(const CGAL::Point_2& p, + const CGAL::Point_2& q) +{ + const Kernel traits; + return CGAL::Weights::internal::distance_2(p, q, traits); +} + +template +typename Kernel::FT distance(const CGAL::Point_3& p, + const CGAL::Point_3& q) +{ + const Kernel traits; + return CGAL::Weights::internal::distance_3(p, q, traits); +} + +template +typename Kernel::FT area(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const Kernel traits; + return CGAL::Weights::internal::positive_area_2(p, q, r, traits); +} + +template +typename Kernel::FT area(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const Kernel traits; + return CGAL::Weights::internal::positive_area_3(p, q, r, traits); +} + +template +typename Kernel::FT scalar_product(const CGAL::Point_2& p, + const CGAL::Point_2& q, + const CGAL::Point_2& r) +{ + const Kernel traits; + auto scalar_product_2 = traits.compute_scalar_product_2_object(); + auto vector_2 = traits.construct_vector_2_object(); + + const auto v1 = vector_2(q, r); + const auto v2 = vector_2(q, p); + return scalar_product_2(v1, v2); +} + +template +typename Kernel::FT scalar_product(const CGAL::Point_3& p, + const CGAL::Point_3& q, + const CGAL::Point_3& r) +{ + const Kernel traits; + auto scalar_product_3 = traits.compute_scalar_product_3_object(); + auto vector_3 = traits.construct_vector_3_object(); + + const auto v1 = vector_3(q, r); + const auto v2 = vector_3(q, p); + + return scalar_product_3(v1, v2); +} + +} // namespace internal +} // namespace Weights +} // namespace CGAL namespace tests { template -FT get_tolerance() { - return FT(1) / FT(10000000000); -} +FT get_tolerance() { return FT(1e-10); } template std::vector< std::array > -get_all_triangles() { - +get_all_triangles() +{ using Point_2 = typename Kernel::Point_2; - const std::array triangle0 = { - Point_2(-1, 0), Point_2(0, -1), Point_2(1, 0) - }; - const std::array triangle1 = { - Point_2(-2, 0), Point_2(0, -1), Point_2(2, 0) - }; - const std::array triangle2 = { - Point_2(-2, 0), Point_2(-2, -2), Point_2(2, 0) - }; - const std::array triangle3 = { - Point_2(-2, 0), Point_2(2, -2), Point_2(2, 0) - }; + + const std::array triangle0 = { Point_2(-1, 0), Point_2(0, -1), Point_2(1, 0) }; + const std::array triangle1 = { Point_2(-2, 0), Point_2(0, -1), Point_2(2, 0) }; + const std::array triangle2 = { Point_2(-2, 0), Point_2(-2, -2), Point_2(2, 0) }; + const std::array triangle3 = { Point_2(-2, 0), Point_2(2, -2), Point_2(2, 0) }; + return { triangle0, triangle1, triangle2, triangle3 }; } template std::vector< std::array > -get_symmetric_triangles() { - +get_symmetric_triangles() +{ using Point_2 = typename Kernel::Point_2; - const std::array triangle0 = { - Point_2(-1, 0), Point_2(0, -1), Point_2(1, 0) - }; - const std::array triangle1 = { - Point_2(-2, 0), Point_2(0, -1), Point_2(2, 0) - }; - const std::array triangle2 = { - Point_2(-3, 0), Point_2(0, -1), Point_2(3, 0) - }; + + const std::array triangle0 = { Point_2(-1, 0), Point_2(0, -1), Point_2(1, 0) }; + const std::array triangle1 = { Point_2(-2, 0), Point_2(0, -1), Point_2(2, 0) }; + const std::array triangle2 = { Point_2(-3, 0), Point_2(0, -1), Point_2(3, 0) }; + return { triangle0, triangle1, triangle2 }; } template std::vector< std::array > -get_uniform_triangles() { - +get_uniform_triangles() +{ using Point_2 = typename Kernel::Point_2; - const std::array triangle0 = { - Point_2(-1, 0), Point_2(0, -1), Point_2(1, 0) - }; - const std::array triangle1 = { - Point_2(-2, 0), Point_2(0, -2), Point_2(2, 0) - }; - const std::array triangle2 = { - Point_2(1, 0), Point_2(-1, 0), Point_2(-1, -2) - }; - const std::array triangle3 = { - Point_2(1, -2), Point_2(1, 0), Point_2(-1, 0) - }; + + const std::array triangle0 = { Point_2(-1, 0), Point_2(0, -1), Point_2(1, 0) }; + const std::array triangle1 = { Point_2(-2, 0), Point_2(0, -2), Point_2(2, 0) }; + const std::array triangle2 = { Point_2(1, 0), Point_2(-1, 0), Point_2(-1, -2) }; + const std::array triangle3 = { Point_2(1, -2), Point_2(1, 0), Point_2(-1, 0) }; + return { triangle0, triangle1, triangle2, triangle3 }; } template std::vector< std::vector > -get_all_polygons() { - +get_all_polygons() +{ using Point_2 = typename Kernel::Point_2; - const std::vector polygon0 = { - Point_2(-2, -2), Point_2(2, -2), Point_2(0, 2) - }; - const std::vector polygon1 = { - Point_2(-1, -1), Point_2(1, -1), Point_2(1, 1), Point_2(-1, 1) - }; - const std::vector polygon2 = { - Point_2(-2, 0), Point_2(0, -2), Point_2(2, 0), Point_2(0, 2) - }; - const std::vector polygon3 = { - Point_2(-2, -2), Point_2(2, -2), Point_2(2, 0), Point_2(0, 2), Point_2(-2, 0) - }; + + const std::vector polygon0 = { Point_2(-2, -2), Point_2(2, -2), Point_2(0, 2) }; + const std::vector polygon1 = { Point_2(-1, -1), Point_2(1, -1), Point_2(1, 1), Point_2(-1, 1) }; + const std::vector polygon2 = { Point_2(-2, 0), Point_2(0, -2), Point_2(2, 0), Point_2(0, 2) }; + const std::vector polygon3 = { Point_2(-2, -2), Point_2(2, -2), Point_2(2, 0), + Point_2(0, 2), Point_2(-2, 0) }; + return { polygon0, polygon1, polygon2, polygon3 }; } -template< -typename Kernel, -typename Weight_wrapper> -bool test_query( - const Weight_wrapper& wrapper, - const typename Kernel::Point_2& query, - const std::array& neighbors) { - +template +void test_query(const Weight_wrapper& wrapper, + const typename Kernel::Point_2& query, + const std::array& neighbors) +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; + const FT tol = get_tolerance(); // 2D configuration. @@ -122,36 +186,28 @@ bool test_query( const Point_3 p3(p2.x(), p2.y(), 1); const Point_3 q3(q2.x(), q2.y(), 1); - const auto a2 = wrapper.weight_a(t2, r2, p2, q2); - const auto b2 = wrapper.weight_b(t2, r2, p2, q2); - CGAL_assertion(a2 >= FT(0) && b2 >= FT(0)); - if (a2 < FT(0) || b2 < FT(0)) return false; - CGAL_assertion(CGAL::abs(a2 - b2) < tol); - if (CGAL::abs(a2 - b2) >= tol) return false; + const FT a2 = wrapper.weight_a(t2, r2, p2, q2); + const FT b2 = wrapper.weight_b(t2, r2, p2, q2); + assert(a2 >= FT(0) && b2 >= FT(0)); + assert(CGAL::abs(a2 - b2) < tol); - if (wrapper.supports_3d()) { - const auto a3 = wrapper.weight_a(t3, r3, p3, q3); - const auto b3 = wrapper.weight_b(t3, r3, p3, q3); - CGAL_assertion(a3 >= FT(0) && b3 >= FT(0)); - if (a3 < FT(0) || b3 < FT(0)) return false; - CGAL_assertion(CGAL::abs(a3 - b3) < tol); - if (CGAL::abs(a3 - b3) >= tol) return false; - CGAL_assertion(CGAL::abs(a2 - a3) < tol); - CGAL_assertion(CGAL::abs(b2 - b3) < tol); - if (CGAL::abs(a2 - a3) >= tol) return false; - if (CGAL::abs(b2 - b3) >= tol) return false; + if (wrapper.supports_3d()) + { + const FT a3 = wrapper.weight_a(t3, r3, p3, q3); + const FT b3 = wrapper.weight_b(t3, r3, p3, q3); + assert(a3 >= FT(0) && b3 >= FT(0)); + assert(CGAL::abs(a3 - b3) < tol); + assert(CGAL::abs(a2 - a3) < tol); + assert(CGAL::abs(b2 - b3) < tol); } - return true; } -template< -typename Kernel, -typename Weight_wrapper> -bool test_symmetry_x( - const Weight_wrapper& wrapper, - const std::array& neighbors, - const typename Kernel::FT& x) { - +template +void test_symmetry_x(const Weight_wrapper& wrapper, + const std::array& neighbors, + const typename Kernel::FT& x) +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; @@ -167,41 +223,34 @@ bool test_symmetry_x( const Point_3 r3(r2.x(), r2.y(), 1); const Point_3 p3(p2.x(), p2.y(), 1); - const auto a2 = wrapper.weight_a(t2, r2, p2, Point_2(-x, 0)); - const auto b2 = wrapper.weight_a(t2, r2, p2, Point_2(+x, 0)); - CGAL_assertion(a2 >= FT(0) && b2 >= FT(0)); - if (a2 < FT(0) || b2 < FT(0)) return false; - CGAL_assertion(CGAL::abs(a2 - b2) < tol); - if (CGAL::abs(a2 - b2) >= tol) return false; + const FT a2 = wrapper.weight_a(t2, r2, p2, Point_2(-x, 0)); + const FT b2 = wrapper.weight_a(t2, r2, p2, Point_2(+x, 0)); + assert(a2 >= FT(0) && b2 >= FT(0)); + assert(CGAL::abs(a2 - b2) < tol); - if (wrapper.supports_3d()) { - const auto a3 = wrapper.weight_a(t3, r3, p3, Point_3(-x, 0, 1)); - const auto b3 = wrapper.weight_a(t3, r3, p3, Point_3(+x, 0, 1)); - CGAL_assertion(a3 >= FT(0) && b3 >= FT(0)); - if (a3 < FT(0) || b3 < FT(0)) return false; - CGAL_assertion(CGAL::abs(a3 - b3) < tol); - if (CGAL::abs(a3 - b3) >= tol) return false; - CGAL_assertion(CGAL::abs(a2 - a3) < tol); - CGAL_assertion(CGAL::abs(b2 - b3) < tol); - if (CGAL::abs(a2 - a3) >= tol) return false; - if (CGAL::abs(b2 - b3) >= tol) return false; + if (wrapper.supports_3d()) + { + const FT a3 = wrapper.weight_a(t3, r3, p3, Point_3(-x, 0, 1)); + const FT b3 = wrapper.weight_a(t3, r3, p3, Point_3(+x, 0, 1)); + assert(a3 >= FT(0) && b3 >= FT(0)); + assert(CGAL::abs(a3 - b3) < tol); + assert(CGAL::abs(a2 - a3) < tol); + assert(CGAL::abs(b2 - b3) < tol); } - return true; } -template< -typename Kernel, -typename Weight_wrapper_1, -typename Weight_wrapper_2> -bool test_compare( - const Weight_wrapper_1& wrapper1, - const Weight_wrapper_2& wrapper2, - const typename Kernel::Point_2& query, - const std::array& neighbors) { - +template +void test_compare(const Weight_wrapper_1& wrapper1, + const Weight_wrapper_2& wrapper2, + const typename Kernel::Point_2& query, + const std::array& neighbors) +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; + const FT tol = get_tolerance(); // 2D configuration. @@ -216,34 +265,29 @@ bool test_compare( const Point_3 p3(p2.x(), p2.y(), 1); const Point_3 q3(q2.x(), q2.y(), 1); - const auto a2 = wrapper1.weight_a(t2, r2, p2, q2); - const auto b2 = wrapper2.weight_a(t2, r2, p2, q2); - CGAL_assertion(a2 >= FT(0) && b2 >= FT(0)); - if (a2 < FT(0) || b2 < FT(0)) return false; - CGAL_assertion(CGAL::abs(a2 - b2) < tol); - if (CGAL::abs(a2 - b2) >= tol) return false; + const FT a2 = wrapper1.weight_a(t2, r2, p2, q2); + const FT b2 = wrapper2.weight_a(t2, r2, p2, q2); + assert(a2 >= FT(0) && b2 >= FT(0)); + assert(CGAL::abs(a2 - b2) < tol); - if (wrapper1.supports_3d() && wrapper2.supports_3d()) { - const auto a3 = wrapper1.weight_a(t3, r3, p3, q3); - const auto b3 = wrapper2.weight_a(t3, r3, p3, q3); - CGAL_assertion(a3 >= FT(0) && b3 >= FT(0)); - if (a3 < FT(0) || b3 < FT(0)) return false; - CGAL_assertion(CGAL::abs(a3 - b3) < tol); - if (CGAL::abs(a3 - b3) >= tol) return false; + if (wrapper1.supports_3d() && wrapper2.supports_3d()) + { + const FT a3 = wrapper1.weight_a(t3, r3, p3, q3); + const FT b3 = wrapper2.weight_a(t3, r3, p3, q3); + assert(a3 >= FT(0) && b3 >= FT(0)); + assert(CGAL::abs(a3 - b3) < tol); } - return true; } -template< -typename Kernel, -typename Weight_wrapper> -bool test_neighbors( - const Weight_wrapper& wrapper, - const std::array& neighbors) { - +template +void test_neighbors(const Weight_wrapper& wrapper, + const std::array& neighbors) +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; + const FT tol = get_tolerance(); // 2D configuration. @@ -256,22 +300,17 @@ bool test_neighbors( const Point_3 q3(q2.x(), q2.y(), 1); const Point_3 r3(r2.x(), r2.y(), 1); - const auto a2 = wrapper.weight(p2, q2, r2); - const auto a3 = wrapper.weight(p3, q3, r3); - CGAL_assertion(a2 >= FT(0) && a3 >= FT(0)); - if (a2 < FT(0) || a3 < FT(0)) return false; - CGAL_assertion(CGAL::abs(a2 - a3) < tol); - if (CGAL::abs(a2 - a3) >= tol) return false; - return true; + const FT a2 = wrapper.weight(p2, q2, r2); + const FT a3 = wrapper.weight(p3, q3, r3); + assert(a2 >= FT(0) && a3 >= FT(0)); + assert(CGAL::abs(a2 - a3) < tol); } -template< -typename Kernel, -typename Weight_wrapper> -bool test_area( - const Weight_wrapper& wrapper, - const std::array& neighbors) { - +template +void test_area(const Weight_wrapper& wrapper, + const std::array& neighbors) +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; @@ -286,129 +325,105 @@ bool test_area( const Point_3 q3(q2.x(), q2.y(), 1); const Point_3 r3(r2.x(), r2.y(), 1); - const auto a2 = wrapper.weight(p2, q2, r2); - const auto a3 = wrapper.weight(p3, q3, r3); - CGAL_assertion(a2 <= CGAL::Weights::area(p2, q2, r2)); - CGAL_assertion(a3 <= CGAL::Weights::area(p3, q3, r3)); - if (a2 > CGAL::Weights::area(p2, q2, r2)) return false; - if (a3 > CGAL::Weights::area(p3, q3, r3)) return false; - CGAL_assertion(a2 >= FT(0)); - CGAL_assertion(a3 >= FT(0)); - if (a2 < FT(0)) return false; - if (a3 < FT(0)) return false; - return true; + const FT a2 = wrapper.weight(p2, q2, r2); + const FT a3 = wrapper.weight(p3, q3, r3); + assert(a2 <= CGAL::Weights::internal::area(p2, q2, r2)); + assert(a3 <= CGAL::Weights::internal::area(p3, q3, r3)); + + assert(a2 >= FT(0)); + assert(a3 >= FT(0)); } template -bool test_coordinates( - const Point& query, - const std::vector& polygon, - const std::vector& weights) { - - CGAL_assertion(weights.size() > 0); - if (weights.size() == 0) return false; +void test_coordinates(const Point& query, + const std::vector& polygon, + const std::vector& weights) +{ + assert(weights.size() > 0); // Compute the sum of weights. const FT tol = get_tolerance(); FT sum = FT(0); - for (const FT& weight : weights) { + for (const FT& weight : weights) sum += weight; - } - CGAL_assertion(sum >= tol); - if (sum < tol) return false; + assert(sum >= tol); // Compute coordinates. std::vector coordinates; coordinates.reserve(weights.size()); - for (const FT& weight : weights) { + for (const FT& weight : weights) coordinates.push_back(weight / sum); - } - CGAL_assertion(coordinates.size() == weights.size()); - if (coordinates.size() != weights.size()) return false; + + assert(coordinates.size() == weights.size()); // Test partition of unity. sum = FT(0); - for (const FT& coordinate : coordinates) { + for (const FT& coordinate : coordinates) sum += coordinate; - } - CGAL_assertion(CGAL::abs(FT(1) - sum) < tol); - if (CGAL::abs(FT(1) - sum) >= tol) return false; + assert(CGAL::abs(FT(1) - sum) < tol); // Test linear precision. FT x = FT(0), y = FT(0); - for (std::size_t i = 0; i < polygon.size(); ++i) { + for (std::size_t i = 0; i < polygon.size(); ++i) + { x += coordinates[i] * polygon[i].x(); y += coordinates[i] * polygon[i].y(); } - CGAL_assertion(CGAL::abs(query.x() - x) < tol); - CGAL_assertion(CGAL::abs(query.y() - y) < tol); - if (CGAL::abs(query.x() - x) >= tol) return false; - if (CGAL::abs(query.y() - y) >= tol) return false; - return true; + assert(CGAL::abs(query.x() - x) < tol); + assert(CGAL::abs(query.y() - y) < tol); } -template< -typename Kernel, -typename Weight_wrapper> -bool test_on_polygon( - const Weight_wrapper& wrapper, - const typename Kernel::Point_2& query_2, - const std::vector& polygon_2) { - +template +void test_on_polygon(const Weight_wrapper& wrapper, + const typename Kernel::Point_2& query_2, + const std::vector& polygon_2) +{ // Get weights. using FT = typename Kernel::FT; - CGAL_assertion(polygon_2.size() >= 3); - if (polygon_2.size() < 3) return false; + assert(polygon_2.size() >= 3); // 2D version. std::vector weights_2; weights_2.reserve(polygon_2.size()); - wrapper.compute_on_polygon( - polygon_2, query_2, Kernel(), std::back_inserter(weights_2)); - CGAL_assertion(weights_2.size() == polygon_2.size()); - if (weights_2.size() != polygon_2.size()) return false; - if (!test_coordinates(query_2, polygon_2, weights_2)) return false; + wrapper.compute_on_polygon(polygon_2, query_2, Kernel(), std::back_inserter(weights_2)); + assert(weights_2.size() == polygon_2.size()); + test_coordinates(query_2, polygon_2, weights_2); // 3D version. using Point_3 = typename Kernel::Point_3; const Point_3 query_3(query_2.x(), query_2.y(), 1); std::vector polygon_3; polygon_3.reserve(polygon_2.size()); - for (const auto& vertex_2 : polygon_2) { - polygon_3.push_back(Point_3(vertex_2.x(), vertex_2.y(), 1)); - } - CGAL_assertion(polygon_3.size() == polygon_2.size()); - if (polygon_3.size() != polygon_2.size()) return false; - const CGAL::Projection_traits_xy_3 ptraits; + for (const auto& vertex_2 : polygon_2) + polygon_3.emplace_back(vertex_2.x(), vertex_2.y(), 1); + assert(polygon_3.size() == polygon_2.size()); + const CGAL::Projection_traits_xy_3 ptraits; std::vector weights_3; weights_3.reserve(polygon_3.size()); - wrapper.compute_on_polygon( - polygon_3, query_3, ptraits, std::back_inserter(weights_3)); - CGAL_assertion(weights_3.size() == polygon_3.size()); - if (weights_3.size() != polygon_3.size()) return false; - if (!test_coordinates(query_3, polygon_3, weights_3)) return false; - return true; + wrapper.compute_on_polygon(polygon_3, query_3, ptraits, std::back_inserter(weights_3)); + assert(weights_3.size() == polygon_3.size()); + + test_coordinates(query_3, polygon_3, weights_3); } -template< -typename Kernel, -typename Weight_wrapper> -bool test_barycentric_properties( - const Weight_wrapper& wrapper, - const typename Kernel::Point_2& query, - const std::vector& polygon) { - +template +void test_barycentric_properties(const Weight_wrapper& wrapper, + const typename Kernel::Point_2& query, + const std::vector& polygon) +{ // Get weights. using FT = typename Kernel::FT; const std::size_t n = polygon.size(); - CGAL_assertion(n >= 3); - if (n < 3) return false; + assert(n >= 3); // Check properties. std::vector weights; weights.reserve(n); - for (std::size_t i = 0; i < n; ++i) { + for (std::size_t i = 0; i < n; ++i) + { const std::size_t im = (i + n - 1) % n; const std::size_t ip = (i + 1) % n; const auto& t = polygon[im]; @@ -418,24 +433,20 @@ bool test_barycentric_properties( const FT weight = wrapper.weight_a(t, r, p, q); weights.push_back(weight); } - CGAL_assertion(weights.size() == n); - if (weights.size() != n) return false; - if (!test_coordinates(query, polygon, weights)) return false; - return true; + assert(weights.size() == n); + + test_coordinates(query, polygon, weights); } -template< -typename Kernel, -typename Weight_wrapper_1, -typename Weight_wrapper_2> -bool test_analytic_weight( - const Weight_wrapper_1& weight, - const Weight_wrapper_2& alternative) { - +template +void test_analytic_weight(const Weight_wrapper_1& weight, + const Weight_wrapper_2& alternative) +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; - // Data. const FT q = FT(1) / FT(4); const FT h = FT(1) / FT(2); const FT t = FT(3) / FT(4); @@ -449,66 +460,59 @@ bool test_analytic_weight( // Test query points. auto configs = get_all_triangles(); - for (const auto& config : configs) { - if (!test_query(weight, zero, config)) return false; - for (const auto& query : queries) { - if (!test_query(weight, query, config)) return false; - } + for (const auto& config : configs) + { + test_query(weight, zero, config); + for (const auto& query : queries) + test_query(weight, query, config); } // Test alternative formulations. - for (const auto& config : configs) { - if (!test_compare(weight, alternative, zero, config)) { - return false; - } - for (const auto& query : queries) { - if (!test_compare(weight, alternative, query, config)) { - return false; - } - } + for (const auto& config : configs) + { + test_compare(weight, alternative, zero, config); + for (const auto& query : queries) + test_compare(weight, alternative, query, config); } // Test symmetry along x axis. configs = get_symmetric_triangles(); - for (const auto& config : configs) { - if (!test_symmetry_x(weight, config, q)) return false; - if (!test_symmetry_x(weight, config, h)) return false; - if (!test_symmetry_x(weight, config, t)) return false; + for (const auto& config : configs) + { + test_symmetry_x(weight, config, q); + test_symmetry_x(weight, config, h); + test_symmetry_x(weight, config, t); } // Test barycentric properties. - if (weight.is_barycentric()) { + if (weight.is_barycentric()) + { const auto polygons = get_all_polygons(); - for (const auto& polygon : polygons) { - if (!test_barycentric_properties(weight, zero, polygon)) { - return false; - } - for (const auto& query : queries) { - if (!test_barycentric_properties(weight, query, polygon)) { - return false; - } - } + for (const auto& polygon : polygons) + { + test_barycentric_properties(weight, zero, polygon); + for (const auto& query : queries) + test_barycentric_properties(weight, query, polygon); } } - return true; + + return; } -template< -typename Kernel, -typename Weight_wrapper_1, -typename Weight_wrapper_2> -bool test_barycentric_weight( - const Weight_wrapper_1& weight, - const Weight_wrapper_2& alternative) { - +template +void test_barycentric_weight(const Weight_wrapper_1& weight, + const Weight_wrapper_2& alternative) +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; - // Data. const FT q = FT(1) / FT(4); const FT h = FT(1) / FT(2); const Point_2 zero(0, 0); - const std::vector queries = { + const std::vector queries = + { Point_2(-h, 0), Point_2(+h, 0), Point_2(-q, 0), Point_2(+q, 0), Point_2( 0, -h), Point_2( 0, +h), Point_2( 0, -q), Point_2( 0, +q), Point_2(-h, -h), Point_2(+h, +h), Point_2(-q, -q), Point_2(+q, +q), @@ -516,40 +520,29 @@ bool test_barycentric_weight( }; // Test analytic formulations. - if (!test_analytic_weight(weight, alternative)) { - return false; - } + test_analytic_weight(weight, alternative); // Test on polygons. const auto polygons = get_all_polygons(); - for (const auto& polygon : polygons) { - if (!test_on_polygon(weight, zero, polygon)) return false; - for (const auto& query : queries) { - if (!test_on_polygon(weight, query, polygon)) { - return false; - } - } + for (const auto& polygon : polygons) + { + test_on_polygon(weight, zero, polygon); + for (const auto& query : queries) + test_on_polygon(weight, query, polygon); } - return true; } -template< -typename Kernel, -typename Weight_wrapper> -bool test_region_weight(const Weight_wrapper& weight) { - - // Test neighborhoods. +template +void test_region_weight(const Weight_wrapper& weight) +{ auto configs = get_all_triangles(); - for (const auto& config : configs) { - if (!test_neighbors(weight, config)) return false; - } + for (const auto& config : configs) + test_neighbors(weight, config); - // Test areas. configs = get_uniform_triangles(); - for (const auto& config : configs) { - if (!test_area(weight, config)) return false; - } - return true; + for (const auto& config : configs) + test_area(weight, config); } } // namespace tests diff --git a/Weights/test/Weights/include/wrappers.h b/Weights/test/Weights/include/wrappers.h index 9946236476a..9a6bdbbb653 100644 --- a/Weights/test/Weights/include/wrappers.h +++ b/Weights/test/Weights/include/wrappers.h @@ -1,261 +1,345 @@ #ifndef CGAL_WEIGHTS_TESTS_WRAPPERS_H #define CGAL_WEIGHTS_TESTS_WRAPPERS_H -// STL includes. +#include "utils.h" + +#include + #include #include -// CGAL includes. -#include - namespace wrappers { template -struct Authalic_wrapper { +struct Authalic_wrapper +{ using FT = typename Kernel::FT; + template - FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const { - return CGAL::Weights::authalic_weight(t, r, p, q); + FT weight_a(const Point& p0, const Point& p1, const Point& p2, const Point& q) const + { + return CGAL::Weights::authalic_weight(p0, p1, p2, q); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { - return - CGAL::Weights::half_authalic_weight( - CGAL::Weights::cotangent(t, r, q), - CGAL::Weights::squared_distance(q, r)) + - CGAL::Weights::half_authalic_weight( - CGAL::Weights::cotangent(q, r, p), - CGAL::Weights::squared_distance(q, r)); + FT weight_b(const Point& p0, const Point& p1, const Point& p2, const Point& q) const + { + return CGAL::Weights::half_authalic_weight(CGAL::Weights::cotangent(p0, p1, q), + CGAL::Weights::internal::squared_distance(q, p1)) + + CGAL::Weights::half_authalic_weight(CGAL::Weights::cotangent(q, p1, p2), + CGAL::Weights::internal::squared_distance(q, p1)); } + bool supports_3d() const { return true; } bool is_barycentric() const { return true; } }; template -struct Cotangent_wrapper { +struct Cotangent_wrapper +{ using FT = typename Kernel::FT; + template - FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const { - return CGAL::Weights::cotangent_weight(t, r, p, q); + FT weight_a(const Point& p0, const Point& p1, const Point& p2, const Point& q) const + { + return CGAL::Weights::cotangent_weight(p0, p1, p2, q); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { - return - CGAL::Weights::half_cotangent_weight( - CGAL::Weights::cotangent(q, t, r)) + - CGAL::Weights::half_cotangent_weight( - CGAL::Weights::cotangent(r, p, q)); + FT weight_b(const Point& p0, const Point& p1, const Point& p2, const Point& q) const + { + return CGAL::Weights::half_cotangent_weight(CGAL::Weights::cotangent(q, p0, p1)) + + CGAL::Weights::half_cotangent_weight(CGAL::Weights::cotangent(p1, p2, q)); } + bool supports_3d() const { return true; } bool is_barycentric() const { return true; } }; template -struct Tangent_wrapper { +struct Tangent_wrapper +{ using FT = typename Kernel::FT; + template - FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const + { return CGAL::Weights::tangent_weight(t, r, p, q); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { - return - CGAL::Weights::half_tangent_weight( - CGAL::Weights::distance(r, q), - CGAL::Weights::distance(t, q), - CGAL::Weights::area(r, q, t), - CGAL::Weights::scalar_product(r, q, t)) + - CGAL::Weights::half_tangent_weight( - CGAL::Weights::distance(r, q), - CGAL::Weights::distance(p, q), - CGAL::Weights::area(p, q, r), - CGAL::Weights::scalar_product(p, q, r)); + FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const + { + return CGAL::Weights::half_tangent_weight(CGAL::Weights::internal::distance(r, q), + CGAL::Weights::internal::distance(t, q), + CGAL::Weights::internal::area(r, q, t), + CGAL::Weights::internal::scalar_product(r, q, t)) + + CGAL::Weights::half_tangent_weight(CGAL::Weights::internal::distance(r, q), + CGAL::Weights::internal::distance(p, q), + CGAL::Weights::internal::area(p, q, r), + CGAL::Weights::internal::scalar_product(p, q, r)); } + bool supports_3d() const { return true; } bool is_barycentric() const { return true; } }; template -struct Wachspress_wrapper { +struct Wachspress_wrapper +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; - FT weight_a(const Point_2& t, const Point_2& r, const Point_2& p, const Point_2& q) const { - return CGAL::Weights::wachspress_weight(t, r, p, q); + + FT weight_a(const Point_2& p0, const Point_2& p1, const Point_2& p2, const Point_2& q) const + { + return CGAL::Weights::wachspress_weight(p0, p1, p2, q); } - FT weight_a(const Point_3&, const Point_3&, const Point_3&, const Point_3&) const { + + FT weight_a(const Point_3&, const Point_3&, const Point_3&, const Point_3&) const + { return FT(-1); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { - return weight_a(t, r, p, q); + FT weight_b(const Point& p0, const Point& p1, const Point& p2, const Point& q) const + { + return weight_a(p0, p1, p2, q); } + template - void compute_on_polygon( - const Polygon& polygon, const Point& query, const Traits& traits, OutputIterator out) const { + void compute_on_polygon(const Polygon& polygon, + const Point& query, + const Traits& traits, + OutputIterator out) const + { CGAL::Weights::wachspress_weights_2(polygon, query, out, traits); } + bool supports_3d() const { return false; } bool is_barycentric() const { return true; } }; template -struct Discrete_harmonic_wrapper { +struct Discrete_harmonic_wrapper +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; - FT weight_a(const Point_2& t, const Point_2& r, const Point_2& p, const Point_2& q) const { - return CGAL::Weights::discrete_harmonic_weight(t, r, p, q); + + FT weight_a(const Point_2& p0, const Point_2& p1, const Point_2& p2, const Point_2& q) const + { + return CGAL::Weights::discrete_harmonic_weight(p0, p1, p2, q); } - FT weight_a(const Point_3&, const Point_3&, const Point_3&, const Point_3&) const { + + FT weight_a(const Point_3&, const Point_3&, const Point_3&, const Point_3&) const + { return FT(-1); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { - return weight_a(t, r, p, q); + FT weight_b(const Point& p0, const Point& p1, const Point& p2, const Point& q) const + { + return weight_a(p0, p1, p2, q); } + template - void compute_on_polygon( - const Polygon& polygon, const Point& query, const Traits& traits, OutputIterator out) const { + void compute_on_polygon(const Polygon& polygon, + const Point& query, + const Traits& traits, + OutputIterator out) const + { CGAL::Weights::discrete_harmonic_weights_2(polygon, query, out, traits); } + bool supports_3d() const { return false; } bool is_barycentric() const { return true; } }; template -struct Mean_value_wrapper { +struct Mean_value_wrapper +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; - FT weight_a(const Point_2& t, const Point_2& r, const Point_2& p, const Point_2& q) const { + + FT weight_a(const Point_2& t, const Point_2& r, const Point_2& p, const Point_2& q) const + { return CGAL::Weights::mean_value_weight(t, r, p, q); } - FT weight_a(const Point_3&, const Point_3&, const Point_3&, const Point_3&) const { + + FT weight_a(const Point_3&, const Point_3&, const Point_3&, const Point_3&) const + { return FT(-1); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const + { return weight_a(t, r, p, q); } + template - void compute_on_polygon( - const Polygon& polygon, const Point& query, const Traits& traits, OutputIterator out) const { + void compute_on_polygon(const Polygon& polygon, + const Point& query, + const Traits& traits, + OutputIterator out) const + { CGAL::Weights::mean_value_weights_2(polygon, query, out, traits); } + bool supports_3d() const { return false; } bool is_barycentric() const { return true; } }; template -struct Three_point_family_wrapper { +struct Three_point_family_wrapper +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; + const FT a; + Three_point_family_wrapper(const FT a) : a(a) { } - FT weight_a(const Point_2& t, const Point_2& r, const Point_2& p, const Point_2& q) const { + FT weight_a(const Point_2& t, const Point_2& r, const Point_2& p, const Point_2& q) const + { return CGAL::Weights::three_point_family_weight(t, r, p, q, a); } - FT weight_a(const Point_3&, const Point_3&, const Point_3&, const Point_3&) const { + + FT weight_a(const Point_3&, const Point_3&, const Point_3&, const Point_3&) const + { return FT(-1); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const + { return weight_a(t, r, p, q); } + bool supports_3d() const { return false; } bool is_barycentric() const { return true; } }; template -struct Uniform_region_wrapper { +struct Uniform_region_wrapper +{ using FT = typename Kernel::FT; template - FT weight(const Point& p, const Point& q, const Point& r) const { + FT weight(const Point& p, const Point& q, const Point& r) const + { return CGAL::Weights::uniform_area(p, q, r); } }; template -struct Triangular_region_wrapper { +struct Triangular_region_wrapper +{ using FT = typename Kernel::FT; template - FT weight(const Point& p, const Point& q, const Point& r) const { + FT weight(const Point& p, const Point& q, const Point& r) const + { return CGAL::Weights::triangular_area(p, q, r); } }; template -struct Barycentric_region_wrapper { +struct Barycentric_region_wrapper +{ using FT = typename Kernel::FT; template - FT weight(const Point& p, const Point& q, const Point& r) const { + FT weight(const Point& p, const Point& q, const Point& r) const + { return CGAL::Weights::barycentric_area(p, q, r); } }; template -struct Voronoi_region_wrapper { +struct Voronoi_region_wrapper +{ using FT = typename Kernel::FT; template - FT weight(const Point& p, const Point& q, const Point& r) const { + FT weight(const Point& p, const Point& q, const Point& r) const + { return CGAL::Weights::voronoi_area(p, q, r); } }; template -struct Mixed_voronoi_region_wrapper { +struct Mixed_voronoi_region_wrapper +{ using FT = typename Kernel::FT; template - FT weight(const Point& p, const Point& q, const Point& r) const { + FT weight(const Point& p, const Point& q, const Point& r) const + { return CGAL::Weights::mixed_voronoi_area(p, q, r); } }; template -struct Uniform_wrapper { +struct Uniform_wrapper +{ using FT = typename Kernel::FT; + template - FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const + { return CGAL::Weights::uniform_weight(t, r, p, q); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const + { return weight_a(t, r, p, q); } + bool supports_3d() const { return true; } bool is_barycentric() const { return false; } }; template -struct Inverse_distance_wrapper { +struct Inverse_distance_wrapper +{ using FT = typename Kernel::FT; + template - FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const + { return CGAL::Weights::inverse_distance_weight(t, r, p, q); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const + { return weight_a(t, r, p, q); } + bool supports_3d() const { return true; } bool is_barycentric() const { return false; } }; template -struct Shepard_wrapper { +struct Shepard_wrapper +{ using FT = typename Kernel::FT; + const FT a; + Shepard_wrapper(const FT a) : a(a) { } + template - FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_a(const Point& t, const Point& r, const Point& p, const Point& q) const + { return CGAL::Weights::shepard_weight(t, r, p, q, a); } + template - FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { + FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const + { return weight_a(t, r, p, q); } + bool supports_3d() const { return true; } bool is_barycentric() const { return false; } }; diff --git a/Weights/test/Weights/test_authalic_weights.cpp b/Weights/test/Weights/test_authalic_weights.cpp index 1aa439a3523..68aa6553417 100644 --- a/Weights/test/Weights/test_authalic_weights.cpp +++ b/Weights/test/Weights/test_authalic_weights.cpp @@ -1,26 +1,29 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -bool test_kernel() { +void test_kernel() +{ const wrappers::Authalic_wrapper aut; const wrappers::Wachspress_wrapper whp; - return tests::test_analytic_weight(aut, whp); + const wrappers::Three_point_family_wrapper tpf(0); + tests::test_analytic_weight(aut, whp); + tests::test_analytic_weight(aut, tpf); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_authalic_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_barycentric_region_weights.cpp b/Weights/test/Weights/test_barycentric_region_weights.cpp index 49be26810bf..39dfebe8c39 100644 --- a/Weights/test/Weights/test_barycentric_region_weights.cpp +++ b/Weights/test/Weights/test_barycentric_region_weights.cpp @@ -1,25 +1,48 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -bool test_kernel() { +void test_kernel() +{ + using FT = typename Kernel::FT; + using Point_2 = typename Kernel::Point_2; + using Point_3 = typename Kernel::Point_3; + + const Point_2 p( 1, 0); + const Point_2 q( 0, 6); + const Point_2 r(-1, 0); + const FT w1 = CGAL::Weights::barycentric_area(p, q, r); + const FT w2 = CGAL::Weights::barycentric_area(r, p, q); + const FT w3 = CGAL::Weights::barycentric_area(q, r, p); + assert(w1 == FT(2)); // medians subdivide a triangle into 6 triangles of equal areas + assert(w1 == w2 && w2 == w3); + + const Point_3 s( 0, -1, 0); + const Point_3 t( 0, 0, 6); + const Point_3 u( 0, 1, 0); + const FT w4 = CGAL::Weights::barycentric_area(s, t, u); + const FT w5 = CGAL::Weights::barycentric_area(t, u, s); + const FT w6 = CGAL::Weights::barycentric_area(u, s, t); + assert(w4 == FT(2)); + assert(w4 == w5 && w5 == w6); + const wrappers::Barycentric_region_wrapper bar; - return tests::test_region_weight(bar); + tests::test_region_weight(bar); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_barycentric_region_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_cotangent_weights.cpp b/Weights/test/Weights/test_cotangent_weights.cpp index 962ed140c44..e1bcb98da72 100644 --- a/Weights/test/Weights/test_cotangent_weights.cpp +++ b/Weights/test/Weights/test_cotangent_weights.cpp @@ -1,26 +1,39 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -bool test_kernel() { +void test_kernel() +{ + using FT = typename Kernel::FT; + using Point_2 = typename Kernel::Point_2; + + const Point_2 p0(-2, 1); + const Point_2 p1( 0, 1); + const Point_2 p2( 0, 3); + const Point_2 q( -2, 3); + const FT w = CGAL::Weights::cotangent_weight(p0, p1, p2, q); + assert(w == FT(0)); + const wrappers::Cotangent_wrapper cot; const wrappers::Discrete_harmonic_wrapper dhw; - return tests::test_analytic_weight(cot, dhw); + const wrappers::Three_point_family_wrapper tpf(2); + tests::test_analytic_weight(cot, dhw); + tests::test_analytic_weight(cot, tpf); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_cotangent_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_discrete_harmonic_weights.cpp b/Weights/test/Weights/test_discrete_harmonic_weights.cpp index b49d7beac51..f358f412191 100644 --- a/Weights/test/Weights/test_discrete_harmonic_weights.cpp +++ b/Weights/test/Weights/test_discrete_harmonic_weights.cpp @@ -1,17 +1,17 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_overloads() { +void test_overloads() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; @@ -19,36 +19,42 @@ void test_overloads() { const Point_2 r1( 0, -1); const Point_2 p1( 1, 0); const Point_2 q1( 0, 0); + const Point_3 t2(-1, 0, 1); const Point_3 r2( 0, -1, 1); const Point_3 p2( 1, 0, 1); const Point_3 q2( 0, 0, 1); + const FT a2 = CGAL::Weights::discrete_harmonic_weight(t1, r1, p1, q1); - const FT a3 = CGAL::Weights::internal::discrete_harmonic_weight(t2, r2, p2, q2); - assert(a2 >= FT(0)); - assert(a3 >= FT(0)); + const FT a3 = CGAL::Weights::discrete_harmonic_weight(t2, r2, p2, q2); + assert(a2 == FT(4)); + assert(a3 == FT(4)); assert(a2 == a3); + struct Traits : public Kernel { }; assert(CGAL::Weights::discrete_harmonic_weight(t1, r1, p1, q1, Traits()) == a2); - assert(CGAL::Weights::internal::discrete_harmonic_weight(t2, r2, p2, q2, Traits()) == a3); + assert(CGAL::Weights::discrete_harmonic_weight(t2, r2, p2, q2, Traits()) == a3); + CGAL::Projection_traits_xy_3 ptraits; const FT a23 = CGAL::Weights::discrete_harmonic_weight(t2, r2, p2, q2, ptraits); - assert(a23 >= FT(0)); - assert(a23 == a2 && a23 == a3); + assert(a23 == FT(4)); + assert(a23 == a2); } template -bool test_kernel() { +void test_kernel() +{ test_overloads(); const wrappers::Discrete_harmonic_wrapper dhw; const wrappers::Cotangent_wrapper cot; - return tests::test_barycentric_weight(dhw, cot); + tests::test_barycentric_weight(dhw, cot); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_discrete_harmonic_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_inverse_distance_weights.cpp b/Weights/test/Weights/test_inverse_distance_weights.cpp index a19dec04749..5cccd29824b 100644 --- a/Weights/test/Weights/test_inverse_distance_weights.cpp +++ b/Weights/test/Weights/test_inverse_distance_weights.cpp @@ -1,47 +1,53 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_overloads() { +void test_overloads() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; const Point_2 p1(0, 0); - const Point_2 q1(1, 0); + const Point_2 q1(2, 0); const Point_3 p2(0, 0, 1); - const Point_3 q2(1, 0, 1); - const FT a2 = CGAL::Weights::inverse_distance_weight(p1, q1); - const FT a3 = CGAL::Weights::inverse_distance_weight(p2, q2); - assert(a2 == FT(1)); - assert(a3 == FT(1)); - assert(CGAL::Weights::inverse_distance_weight(p1, p1, q1, q1) == a2); - assert(CGAL::Weights::inverse_distance_weight(p2, p2, q2, q2) == a3); + const Point_3 q2(2, 0, 1); + + const FT w1 = CGAL::Weights::inverse_distance_weight(p1, q1); + const FT w2 = CGAL::Weights::inverse_distance_weight(p2, q2); + assert(w1 == FT(1) / FT(2)); + assert(w2 == FT(1) / FT(2)); + assert(CGAL::Weights::inverse_distance_weight(p1, p1, q1, q1) == w1); + assert(CGAL::Weights::inverse_distance_weight(p2, p2, q2, q2) == w2); + struct Traits : public Kernel { }; - assert(CGAL::Weights::inverse_distance_weight(p1, p1, q1, q1, Traits()) == a2); - assert(CGAL::Weights::inverse_distance_weight(p2, p2, q2, q2, Traits()) == a3); + assert(CGAL::Weights::inverse_distance_weight(p1, q1, Traits()) == w1); + assert(CGAL::Weights::inverse_distance_weight(p2, q2, Traits()) == w2); + assert(CGAL::Weights::inverse_distance_weight(p1, p1, q1, q1, Traits()) == w1); + assert(CGAL::Weights::inverse_distance_weight(p2, p2, q2, q2, Traits()) == w2); } template -bool test_kernel() { +void test_kernel() +{ test_overloads(); const wrappers::Inverse_distance_wrapper idw; const wrappers::Shepard_wrapper spw(1); - return tests::test_analytic_weight(idw, spw); + tests::test_analytic_weight(idw, spw); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_inverse_distance_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_mean_value_weights.cpp b/Weights/test/Weights/test_mean_value_weights.cpp index 883ff79d591..74ec6ffa4a5 100644 --- a/Weights/test/Weights/test_mean_value_weights.cpp +++ b/Weights/test/Weights/test_mean_value_weights.cpp @@ -1,17 +1,17 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_overloads() { +void test_overloads() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; @@ -23,14 +23,16 @@ void test_overloads() { const Point_3 r2( 0, -1, 1); const Point_3 p2( 1, 0, 1); const Point_3 q2( 0, 0, 1); + const FT a2 = CGAL::Weights::mean_value_weight(t1, r1, p1, q1); - const FT a3 = CGAL::Weights::internal::mean_value_weight(t2, r2, p2, q2); + const FT a3 = CGAL::Weights::mean_value_weight(t2, r2, p2, q2); assert(a2 >= FT(0)); assert(a3 >= FT(0)); assert(a2 == a3); + struct Traits : public Kernel { }; assert(CGAL::Weights::mean_value_weight(t1, r1, p1, q1, Traits()) == a2); - assert(CGAL::Weights::internal::mean_value_weight(t2, r2, p2, q2, Traits()) == a3); + assert(CGAL::Weights::mean_value_weight(t2, r2, p2, q2, Traits()) == a3); CGAL::Projection_traits_xy_3 ptraits; const FT a23 = CGAL::Weights::mean_value_weight(t2, r2, p2, q2, ptraits); assert(a23 >= FT(0)); @@ -38,17 +40,21 @@ void test_overloads() { } template -bool test_kernel() { +void test_kernel() +{ test_overloads(); const wrappers::Mean_value_wrapper mvw; const wrappers::Tangent_wrapper tan; - return tests::test_barycentric_weight(mvw, tan); + const wrappers::Three_point_family_wrapper tpf(1); + tests::test_barycentric_weight(mvw, tan); + tests::test_barycentric_weight(mvw, tpf); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_mean_value_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_mixed_voronoi_region_weights.cpp b/Weights/test/Weights/test_mixed_voronoi_region_weights.cpp index 3c78f1f18a2..d0c6571d95e 100644 --- a/Weights/test/Weights/test_mixed_voronoi_region_weights.cpp +++ b/Weights/test/Weights/test_mixed_voronoi_region_weights.cpp @@ -1,25 +1,26 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -bool test_kernel() { +void test_kernel() +{ const wrappers::Mixed_voronoi_region_wrapper mix; - return tests::test_region_weight(mix); + tests::test_region_weight(mix); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_mixed_voronoi_region_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_projected_weights.cpp b/Weights/test/Weights/test_projected_weights.cpp index 96d01644499..874bc73d22b 100644 --- a/Weights/test/Weights/test_projected_weights.cpp +++ b/Weights/test/Weights/test_projected_weights.cpp @@ -1,18 +1,19 @@ #include #include #include + #include #include #include #include -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_kernel() { +void test_kernel() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; @@ -110,7 +111,8 @@ void test_kernel() { assert(CGAL::Weights::three_point_family_weight(t3, r3, p3, q3, 1, yz_traits) == ref_value); } -int main() { +int main(int, char**) +{ test_kernel(); test_kernel(); test_kernel(); diff --git a/Weights/test/Weights/test_shepard_weights.cpp b/Weights/test/Weights/test_shepard_weights.cpp index e178b574144..9806892d386 100644 --- a/Weights/test/Weights/test_shepard_weights.cpp +++ b/Weights/test/Weights/test_shepard_weights.cpp @@ -1,49 +1,55 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_overloads() { +void test_overloads() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; + const Point_2 p1(0, 0); - const Point_2 q1(1, 0); + const Point_2 q1(2, 0); const Point_3 p2(0, 0, 1); - const Point_3 q2(1, 0, 1); - const FT a2 = CGAL::Weights::shepard_weight(p1, q1); - const FT a3 = CGAL::Weights::shepard_weight(p2, q2); - assert(a2 == FT(1)); - assert(a3 == FT(1)); - assert(CGAL::Weights::shepard_weight(p1, p1, q1, q1) == a2); - assert(CGAL::Weights::shepard_weight(p2, p2, q2, q2) == a3); + const Point_3 q2(2, 0, 1); + + const FT a2 = CGAL::Weights::shepard_weight(p1, q1, 3); + const FT a3 = CGAL::Weights::shepard_weight(p2, q2, 3); + assert(a2 == FT(1)/FT(8)); + assert(a3 == FT(1)/FT(8)); + + assert(CGAL::Weights::shepard_weight(p1, p1, q1, q1, 3) == a2); + assert(CGAL::Weights::shepard_weight(p2, p2, q2, q2, 3) == a3); + struct Traits : public Kernel { }; - assert(CGAL::Weights::shepard_weight(p1, p1, q1, q1, 1, Traits()) == a2); - assert(CGAL::Weights::shepard_weight(p2, p2, q2, q2, 1, Traits()) == a3); + assert(CGAL::Weights::shepard_weight(p1, p1, q1, q1, 3, Traits()) == a2); + assert(CGAL::Weights::shepard_weight(p2, p2, q2, q2, 3, Traits()) == a3); } template -bool test_kernel() { +void test_kernel() +{ test_overloads(); const wrappers::Shepard_wrapper spwa(1); const wrappers::Shepard_wrapper spwb(2); const wrappers::Inverse_distance_wrapper idw; - assert(tests::test_analytic_weight(spwa, idw)); - return tests::test_analytic_weight(spwb, spwb); + tests::test_analytic_weight(spwa, idw); + tests::test_analytic_weight(spwb, spwb); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_shepard_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_tangent_weights.cpp b/Weights/test/Weights/test_tangent_weights.cpp index 8fe08620ad7..aece71cb567 100644 --- a/Weights/test/Weights/test_tangent_weights.cpp +++ b/Weights/test/Weights/test_tangent_weights.cpp @@ -1,26 +1,29 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -bool test_kernel() { +void test_kernel() +{ const wrappers::Tangent_wrapper tan; const wrappers::Mean_value_wrapper mvw; - return tests::test_analytic_weight(tan, mvw); + const wrappers::Three_point_family_wrapper tpf(1); + tests::test_analytic_weight(tan, mvw); + tests::test_analytic_weight(tan, tpf); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_tangent_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_three_point_family_weights.cpp b/Weights/test/Weights/test_three_point_family_weights.cpp index e6ebfb0f64b..85f231b7eb0 100644 --- a/Weights/test/Weights/test_three_point_family_weights.cpp +++ b/Weights/test/Weights/test_three_point_family_weights.cpp @@ -1,17 +1,17 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_overloads() { +void test_overloads() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; @@ -23,14 +23,16 @@ void test_overloads() { const Point_3 r2( 0, -1, 1); const Point_3 p2( 1, 0, 1); const Point_3 q2( 0, 0, 1); + const FT a2 = CGAL::Weights::three_point_family_weight(t1, r1, p1, q1); - const FT a3 = CGAL::Weights::internal::three_point_family_weight(t2, r2, p2, q2); + const FT a3 = CGAL::Weights::three_point_family_weight(t2, r2, p2, q2); assert(a2 >= FT(0)); assert(a3 >= FT(0)); assert(a2 == a3); + struct Traits : public Kernel { }; assert(CGAL::Weights::three_point_family_weight(t1, r1, p1, q1, 1, Traits()) == a2); - assert(CGAL::Weights::internal::three_point_family_weight(t2, r2, p2, q2, 1, Traits()) == a3); + assert(CGAL::Weights::three_point_family_weight(t2, r2, p2, q2, 1, Traits()) == a3); CGAL::Projection_traits_xy_3 ptraits; const FT a23 = CGAL::Weights::three_point_family_weight(t2, r2, p2, q2, 0, ptraits); assert(a23 >= FT(0)); @@ -38,7 +40,8 @@ void test_overloads() { } template -bool test_kernel() { +void test_kernel() +{ test_overloads(); using FT = typename Kernel::FT; const FT h = FT(1) / FT(2); @@ -49,16 +52,18 @@ bool test_kernel() { const wrappers::Wachspress_wrapper whp; const wrappers::Mean_value_wrapper mvw; const wrappers::Discrete_harmonic_wrapper dhw; - assert(tests::test_analytic_weight(tpfa, whp)); - assert(tests::test_analytic_weight(tpfb, mvw)); - assert(tests::test_analytic_weight(tpfc, dhw)); - return tests::test_analytic_weight(tpfd, tpfd); + + tests::test_analytic_weight(tpfa, whp); + tests::test_analytic_weight(tpfb, mvw); + tests::test_analytic_weight(tpfc, dhw); + tests::test_analytic_weight(tpfd, tpfd); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_three_point_family_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_triangular_region_weights.cpp b/Weights/test/Weights/test_triangular_region_weights.cpp index c6bde65c492..bafdc2ed189 100644 --- a/Weights/test/Weights/test_triangular_region_weights.cpp +++ b/Weights/test/Weights/test_triangular_region_weights.cpp @@ -1,25 +1,26 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -bool test_kernel() { +void test_kernel() +{ const wrappers::Triangular_region_wrapper tri; - return tests::test_region_weight(tri); + tests::test_region_weight(tri); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_triangular_region_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_uniform_region_weights.cpp b/Weights/test/Weights/test_uniform_region_weights.cpp index 52124ede996..71d25a9a555 100644 --- a/Weights/test/Weights/test_uniform_region_weights.cpp +++ b/Weights/test/Weights/test_uniform_region_weights.cpp @@ -1,17 +1,17 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_overloads() { +void test_overloads() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; @@ -20,22 +20,25 @@ void test_overloads() { const Point_3 q(0, 0, 0); assert(CGAL::Weights::uniform_area(p, p, p) == a); assert(CGAL::Weights::uniform_area(q, q, q) == a); + struct Traits : public Kernel { }; assert(CGAL::Weights::uniform_area(p, p, p, Traits()) == a); assert(CGAL::Weights::uniform_area(q, q, q, Traits()) == a); } template -bool test_kernel() { +void test_kernel() +{ test_overloads(); const wrappers::Uniform_region_wrapper uni; - return tests::test_region_weight(uni); + tests::test_region_weight(uni); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_uniform_region_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_uniform_weights.cpp b/Weights/test/Weights/test_uniform_weights.cpp index 68ae5af005c..00501f1f13d 100644 --- a/Weights/test/Weights/test_uniform_weights.cpp +++ b/Weights/test/Weights/test_uniform_weights.cpp @@ -1,41 +1,46 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_overloads() { +void test_overloads() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; + const FT a = FT(1); const Point_2 p(0, 0); const Point_3 q(0, 0, 0); + assert(CGAL::Weights::uniform_weight(p, p, p, p) == a); assert(CGAL::Weights::uniform_weight(q, q, q, q) == a); + struct Traits : public Kernel { }; assert(CGAL::Weights::uniform_weight(p, p, p, p, Traits()) == a); assert(CGAL::Weights::uniform_weight(q, q, q, q, Traits()) == a); } template -bool test_kernel() { +void test_kernel() +{ test_overloads(); const wrappers::Uniform_wrapper uni; - return tests::test_analytic_weight(uni, uni); + tests::test_analytic_weight(uni, uni); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_uniform_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_voronoi_region_weights.cpp b/Weights/test/Weights/test_voronoi_region_weights.cpp index a0d6bcc43d4..7040392d029 100644 --- a/Weights/test/Weights/test_voronoi_region_weights.cpp +++ b/Weights/test/Weights/test_voronoi_region_weights.cpp @@ -1,25 +1,26 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -bool test_kernel() { +void test_kernel() +{ const wrappers::Voronoi_region_wrapper vor; - return tests::test_region_weight(vor); + tests::test_region_weight(vor); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_voronoi_region_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } diff --git a/Weights/test/Weights/test_wachspress_weights.cpp b/Weights/test/Weights/test_wachspress_weights.cpp index 75b43f46437..f370c383745 100644 --- a/Weights/test/Weights/test_wachspress_weights.cpp +++ b/Weights/test/Weights/test_wachspress_weights.cpp @@ -1,17 +1,17 @@ +#include "include/utils.h" +#include "include/wrappers.h" + #include #include #include -#include "include/utils.h" -#include "include/wrappers.h" - -// Typedefs. using SCKER = CGAL::Simple_cartesian; using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel; using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template -void test_overloads() { +void test_overloads() +{ using FT = typename Kernel::FT; using Point_2 = typename Kernel::Point_2; using Point_3 = typename Kernel::Point_3; @@ -23,32 +23,38 @@ void test_overloads() { const Point_3 r2( 0, -1, 1); const Point_3 p2( 1, 0, 1); const Point_3 q2( 0, 0, 1); + const FT a2 = CGAL::Weights::wachspress_weight(t1, r1, p1, q1); - const FT a3 = CGAL::Weights::internal::wachspress_weight(t2, r2, p2, q2); - assert(a2 >= FT(0)); - assert(a3 >= FT(0)); + const FT a3 = CGAL::Weights::wachspress_weight(t2, r2, p2, q2); + assert(a2 == FT(4)); + assert(a3 == FT(4)); assert(a2 == a3); + struct Traits : public Kernel { }; assert(CGAL::Weights::wachspress_weight(t1, r1, p1, q1, Traits()) == a2); - assert(CGAL::Weights::internal::wachspress_weight(t2, r2, p2, q2, Traits()) == a3); + assert(CGAL::Weights::wachspress_weight(t2, r2, p2, q2, Traits()) == a3); CGAL::Projection_traits_xy_3 ptraits; const FT a23 = CGAL::Weights::wachspress_weight(t2, r2, p2, q2, ptraits); - assert(a23 >= FT(0)); - assert(a23 == a2 && a23 == a3); + assert(a23 == FT(4)); + assert(a23 == a2); } template -bool test_kernel() { +void test_kernel() +{ test_overloads(); const wrappers::Wachspress_wrapper whp; const wrappers::Authalic_wrapper aut; - return tests::test_barycentric_weight(whp, aut); + const wrappers::Three_point_family_wrapper tpf(0); + tests::test_barycentric_weight(whp, aut); + tests::test_barycentric_weight(whp, tpf); } -int main() { - assert(test_kernel()); - assert(test_kernel()); - assert(test_kernel()); +int main(int, char**) +{ + test_kernel(); + test_kernel(); + test_kernel(); std::cout << "* test_wachspress_weights: SUCCESS" << std::endl; return EXIT_SUCCESS; } From 0640470f5d1253ddd3347053b1277cd0332b4d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Oct 2022 17:34:34 +0200 Subject: [PATCH 057/194] Hide pmp_weights_deprecated.h behind CGAL_NO_DEPRECATED_CODE --- Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h b/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h index fb44deac937..7a7cd14a4c2 100644 --- a/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h +++ b/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h @@ -19,6 +19,8 @@ "This part of the package is deprecated since the version 5.4 of CGAL!" #include +#ifndef CGAL_NO_DEPRECATED_CODE + // README: // This header collects all weights which have been in CGAL before unifying them // into the new package Weights. This header is for information purpose only. It From b9e7c2aa13b6312cf6e86538be6fb3eb28136cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Oct 2022 17:35:19 +0200 Subject: [PATCH 058/194] Misc minor fixes --- .../CGAL/Weights/internal/polygon_utils_2.h | 2 +- Weights/include/CGAL/Weights/internal/utils.h | 17 ++++++++++------- Weights/include/CGAL/Weights/uniform_weights.h | 5 +++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Weights/include/CGAL/Weights/internal/polygon_utils_2.h b/Weights/include/CGAL/Weights/internal/polygon_utils_2.h index 361896fc105..8b2bb361673 100644 --- a/Weights/include/CGAL/Weights/internal/polygon_utils_2.h +++ b/Weights/include/CGAL/Weights/internal/polygon_utils_2.h @@ -114,7 +114,7 @@ Edge_case bounded_side_2(const VertexRange& polygon, const auto& currp = get(point_map, *curr); const auto& nextp = get(point_map, *next); - auto next_y_comp_res = compare_y_2(nextp, query); + Comparison_result next_y_comp_res = compare_y_2(nextp, query); switch (curr_y_comp_res) { case CGAL::SMALLER: switch (next_y_comp_res) { diff --git a/Weights/include/CGAL/Weights/internal/utils.h b/Weights/include/CGAL/Weights/internal/utils.h index f51136186b9..af5e3f27c91 100644 --- a/Weights/include/CGAL/Weights/internal/utils.h +++ b/Weights/include/CGAL/Weights/internal/utils.h @@ -191,17 +191,19 @@ double angle_3(const typename GeomTraits::Vector_3& v1, { auto dot_product_3 = traits.compute_scalar_product_3_object(); + const double product = CGAL::sqrt(to_double(scalar_product(v1,v1)) * to_double(scalar_product(v2,v2))); + if(product == 0.) + return 0.; + const double dot = CGAL::to_double(dot_product_3(v1, v2)); + const double costine = dot / product; - double angle_rad = 0.0; if (dot < -1.0) - angle_rad = std::acos(-1.0); + return std::acos(-1.0); else if (dot > 1.0) - angle_rad = std::acos(+1.0); + return std::acos(+1.0); else - angle_rad = std::acos(dot); - - return angle_rad; + return std::acos(dot); } // Rotates a 3D point around axis. @@ -441,7 +443,8 @@ typename GeomTraits::FT positive_area_2(const typename GeomTraits::Point_2& p, const typename GeomTraits::Point_2& r, const GeomTraits& traits) { - return CGAL::abs(area_2(traits, p, q, r)); + auto area_2 = traits.compute_area_2_object(); + return CGAL::abs(area_2(p, q, r)); } template diff --git a/Weights/include/CGAL/Weights/uniform_weights.h b/Weights/include/CGAL/Weights/uniform_weights.h index 541dd95937a..69d1cf2a288 100644 --- a/Weights/include/CGAL/Weights/uniform_weights.h +++ b/Weights/include/CGAL/Weights/uniform_weights.h @@ -86,7 +86,10 @@ typename GeomTraits::FT uniform_weight(const CGAL::Point_3& p0, return uniform_weight(p0, p1, p2, q, traits); } +/// \cond SKIP_IN_MANUAL + // Undocumented uniform weight class taking as input a polygon mesh. +// // It is currently used in: // Polygon_mesh_processing -> triangulate_hole_Polyhedron_3_test.cpp // Polygon_mesh_processing -> triangulate_hole_Polyhedron_3_no_delaunay_test.cpp @@ -102,6 +105,8 @@ public: double w_ij(halfedge_descriptor) { return 1.; } }; +/// \endcond + } // namespace Weights } // namespace CGAL From 0d00ad237b2e851488af4276184e1276f7eaf107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 21 Oct 2022 00:05:20 +0200 Subject: [PATCH 059/194] Remove needless normalization calls --- Weights/include/CGAL/Weights/internal/utils.h | 19 +++++-------------- .../include/CGAL/Weights/tangent_weights.h | 4 ---- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/Weights/include/CGAL/Weights/internal/utils.h b/Weights/include/CGAL/Weights/internal/utils.h index af5e3f27c91..483616d8254 100644 --- a/Weights/include/CGAL/Weights/internal/utils.h +++ b/Weights/include/CGAL/Weights/internal/utils.h @@ -191,19 +191,19 @@ double angle_3(const typename GeomTraits::Vector_3& v1, { auto dot_product_3 = traits.compute_scalar_product_3_object(); - const double product = CGAL::sqrt(to_double(scalar_product(v1,v1)) * to_double(scalar_product(v2,v2))); + const double product = CGAL::sqrt(to_double(dot_product_3(v1,v1) * dot_product_3(v2,v2))); if(product == 0.) return 0.; const double dot = CGAL::to_double(dot_product_3(v1, v2)); - const double costine = dot / product; + const double cosine = dot / product; - if (dot < -1.0) + if (cosine < -1.0) return std::acos(-1.0); - else if (dot > 1.0) + else if (cosine > 1.0) return std::acos(+1.0); else - return std::acos(dot); + return std::acos(cosine); } // Rotates a 3D point around axis. @@ -387,16 +387,10 @@ void flatten(const typename GeomTraits::Point_3& t, // prev neighbor/vertex/poin Vector_3 v1 = vector_3(q1, t1); Vector_3 v2 = vector_3(q1, p1); - normalize_3(v1, traits); - normalize_3(v2, traits); - // Two triangle normals. Vector_3 n1 = cross_product_3(v1, ax); Vector_3 n2 = cross_product_3(ax, v2); - normalize_3(n1, traits); - normalize_3(n2, traits); - // std::cout << "normal n1: " << n1 << std::endl; // std::cout << "normal n2: " << n2 << std::endl; @@ -474,12 +468,9 @@ typename GeomTraits::FT area_3(const typename GeomTraits::Point_3& p, // Prev and next vectors. Vector_3 v1 = vector_3(b, a); Vector_3 v2 = vector_3(b, c); - normalize_3(v1, traits); - normalize_3(v2, traits); // Compute normal. Vector_3 normal = cross_product_3(v1, v2); - normalize_3(normal, traits); // Compute orthogonal base vectors. Vector_3 b1, b2; diff --git a/Weights/include/CGAL/Weights/tangent_weights.h b/Weights/include/CGAL/Weights/tangent_weights.h index afa64e2da90..6f31b0b1c6c 100644 --- a/Weights/include/CGAL/Weights/tangent_weights.h +++ b/Weights/include/CGAL/Weights/tangent_weights.h @@ -123,10 +123,6 @@ typename GeomTraits::FT tangent_weight_v2(const typename GeomTraits::Point_3& p0 const FT l2 = internal::length_3(v, traits); - internal::normalize_3(v0, traits); - internal::normalize_3(v, traits); - internal::normalize_3(v2, traits); - const double ha_rad_1 = internal::angle_3(v0, v, traits) / 2.0; const double ha_rad_2 = internal::angle_3(v, v2, traits) / 2.0; const FT t0 = static_cast(std::tan(ha_rad_1)); From 6a5f099f4191455ca72ec9dc41afa3beac58644d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 21 Oct 2022 00:05:30 +0200 Subject: [PATCH 060/194] Add a test --- .../test/Weights/test_voronoi_region_weights.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Weights/test/Weights/test_voronoi_region_weights.cpp b/Weights/test/Weights/test_voronoi_region_weights.cpp index 7040392d029..49b0fe672af 100644 --- a/Weights/test/Weights/test_voronoi_region_weights.cpp +++ b/Weights/test/Weights/test_voronoi_region_weights.cpp @@ -12,6 +12,22 @@ using EPECK = CGAL::Exact_predicates_exact_constructions_kernel; template void test_kernel() { + using FT = typename Kernel::FT; + using Point_2 = typename Kernel::Point_2; + using Point_3 = typename Kernel::Point_3; + + const Point_2 p( 2, 0); + const Point_2 q( 0, 2); + const Point_2 r(-2, 0); + const FT w1 = CGAL::Weights::voronoi_area(p, q, r); + assert(w1 == FT(2)); + + const Point_3 s( 0, -2, 0); + const Point_3 t( 0, 0, 2); + const Point_3 u( 0, 2, 0); + const FT w4 = CGAL::Weights::voronoi_area(s, t, u); + assert(w4 == FT(2)); + const wrappers::Voronoi_region_wrapper vor; tests::test_region_weight(vor); } From 6a694366f035e422a7fcc45199b5914dd76bf872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 21 Oct 2022 10:34:07 +0200 Subject: [PATCH 061/194] Remove trailing whitespace --- Weights/test/Weights/include/wrappers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Weights/test/Weights/include/wrappers.h b/Weights/test/Weights/include/wrappers.h index 9a6bdbbb653..2566a219a6c 100644 --- a/Weights/test/Weights/include/wrappers.h +++ b/Weights/test/Weights/include/wrappers.h @@ -245,7 +245,7 @@ struct Triangular_region_wrapper }; template -struct Barycentric_region_wrapper +struct Barycentric_region_wrapper { using FT = typename Kernel::FT; template From 82c0d0686e0f73a8ec9c85691b384f363a97c8e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 21 Oct 2022 11:23:36 +0200 Subject: [PATCH 062/194] Add missing typedef --- Weights/include/CGAL/Weights/internal/utils.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Weights/include/CGAL/Weights/internal/utils.h b/Weights/include/CGAL/Weights/internal/utils.h index 483616d8254..744af8be2d3 100644 --- a/Weights/include/CGAL/Weights/internal/utils.h +++ b/Weights/include/CGAL/Weights/internal/utils.h @@ -448,6 +448,7 @@ typename GeomTraits::FT area_3(const typename GeomTraits::Point_3& p, const GeomTraits& traits) { using FT = typename GeomTraits::FT; + using Point_2 = typename GeomTraits::Point_2; using Point_3 = typename GeomTraits::Point_3; using Vector_3 = typename GeomTraits::Vector_3; From b0c183fc3d90ee04400a7a6e6f6586e725987c69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 21 Oct 2022 12:07:12 +0200 Subject: [PATCH 063/194] Add missing typedef --- Weights/include/CGAL/Weights/tangent_weights.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Weights/include/CGAL/Weights/tangent_weights.h b/Weights/include/CGAL/Weights/tangent_weights.h index 6f31b0b1c6c..2ec910d67e2 100644 --- a/Weights/include/CGAL/Weights/tangent_weights.h +++ b/Weights/include/CGAL/Weights/tangent_weights.h @@ -235,6 +235,7 @@ typename GeomTraits::FT half_tangent_weight(const typename GeomTraits::Point_2& const GeomTraits& traits) { using FT = typename GeomTraits::FT; + using Vector_2 = typename GeomTraits::Vector_2; auto vector_2 = traits.construct_vector_2_object(); auto dot_product_2 = traits.compute_scalar_product_2_object(); From 8d7669d559d543c9e7251a7b3bf8d023a74b9979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 21 Oct 2022 12:15:03 +0200 Subject: [PATCH 064/194] Test alternate API + add missing typedef --- Weights/include/CGAL/Weights/tangent_weights.h | 1 + Weights/test/Weights/include/wrappers.h | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Weights/include/CGAL/Weights/tangent_weights.h b/Weights/include/CGAL/Weights/tangent_weights.h index 2ec910d67e2..7788a961218 100644 --- a/Weights/include/CGAL/Weights/tangent_weights.h +++ b/Weights/include/CGAL/Weights/tangent_weights.h @@ -259,6 +259,7 @@ typename GeomTraits::FT half_tangent_weight(const typename GeomTraits::Point_3& const GeomTraits& traits) { using FT = typename GeomTraits::FT; + using Vector_3 = typename GeomTraits::Vector_3; auto vector_3 = traits.construct_vector_3_object(); auto dot_product_3 = traits.compute_scalar_product_3_object(); diff --git a/Weights/test/Weights/include/wrappers.h b/Weights/test/Weights/include/wrappers.h index 2566a219a6c..94138e735df 100644 --- a/Weights/test/Weights/include/wrappers.h +++ b/Weights/test/Weights/include/wrappers.h @@ -70,10 +70,7 @@ struct Tangent_wrapper template FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { - return CGAL::Weights::half_tangent_weight(CGAL::Weights::internal::distance(r, q), - CGAL::Weights::internal::distance(t, q), - CGAL::Weights::internal::area(r, q, t), - CGAL::Weights::internal::scalar_product(r, q, t)) + + return CGAL::Weights::half_tangent_weight(r, q, t, Kernel()) + CGAL::Weights::half_tangent_weight(CGAL::Weights::internal::distance(r, q), CGAL::Weights::internal::distance(p, q), CGAL::Weights::internal::area(p, q, r), From 4d4bf04b835849a4735a28833a3b722c1a5f78b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 21 Oct 2022 12:47:52 +0200 Subject: [PATCH 065/194] Fix constructor of Mean_curvature_flow_skeletonization + weight API --- .../CGAL/Mean_curvature_flow_skeletonization.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h b/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h index aa86264e177..43a6a41ceb6 100644 --- a/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h +++ b/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h @@ -223,7 +223,7 @@ public: typedef typename boost::graph_traits::edge_iterator edge_iterator; // Get weight from the weight interface. - typedef CGAL::Weights::Cotangent_weight Weight_calculator; + typedef CGAL::Weights::Cotangent_weight Weight_calculator; typedef internal::Curve_skeleton Vertex_pair; std::vector v2v; copy_face_graph(tmesh, m_tmesh, - CGAL::parameters::vertex_to_vertex_output_iterator(std::back_inserter(v2v))); + CGAL::parameters::vertex_to_vertex_output_iterator(std::back_inserter(v2v)) + .vertex_point_map(vpm)); // copy input vertices to keep correspondence for(const Vertex_pair& vp : v2v) From bd83e152e3f85642539792feb1f18bc2b812c761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 21 Oct 2022 13:52:55 +0200 Subject: [PATCH 066/194] Fix initialization and usage of Weights in skeletonization --- .../include/CGAL/Mean_curvature_flow_skeletonization.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h b/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h index 43a6a41ceb6..58e8e0b4d43 100644 --- a/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h +++ b/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h @@ -371,7 +371,11 @@ public: Mean_curvature_flow_skeletonization(const TriangleMesh& tmesh, VertexPointMap vertex_point_map, const Traits& traits = Traits()) - : m_traits(traits), m_weight_calculator(tmesh, vertex_point_map, traits, true /* use_clamped_version */) + : + m_tmesh(), + m_tmesh_point_pmap(get(CGAL::vertex_point, m_tmesh)), + m_traits(traits), + m_weight_calculator(m_tmesh, m_tmesh_point_pmap, m_traits, true /* use_clamped_version */) { init(tmesh, vertex_point_map); } @@ -884,7 +888,7 @@ private: m_edge_weight.clear(); m_edge_weight.reserve(num_halfedges(m_tmesh)); for(halfedge_descriptor hd : halfedges(m_tmesh)) - m_edge_weight.push_back(m_weight_calculator(hd, m_tmesh, m_tmesh_point_pmap)); + m_edge_weight.push_back(m_weight_calculator(hd)); } /// Assemble the left hand side. From 88b3d0ab88731588dbdf770c14848913131a5320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 21 Oct 2022 14:32:42 +0200 Subject: [PATCH 067/194] Fix compilation --- Weights/include/CGAL/Weights/cotangent_weights.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Weights/include/CGAL/Weights/cotangent_weights.h b/Weights/include/CGAL/Weights/cotangent_weights.h index 93413b7cb24..d462c3f5174 100644 --- a/Weights/include/CGAL/Weights/cotangent_weights.h +++ b/Weights/include/CGAL/Weights/cotangent_weights.h @@ -338,7 +338,7 @@ private: (CGAL::angle(p2, p1, p0) == CGAL::OBTUSE) || (CGAL::angle(p0, p2, p1) == CGAL::OBTUSE)) { - const FT A = internal::positive_area_3(m_traits, p0, p1, p2); + const FT A = internal::positive_area_3(p0, p1, p2, m_traits); if (angle0 == CGAL::OBTUSE) voronoi_area += A / FT(2); else From e99f4428303c82b66a5e93979991081e45c40588 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 25 Oct 2022 11:59:59 +0200 Subject: [PATCH 068/194] NP_helper::has_normal_map should not always return true look for a normal_map in the point set, and in the named parameters # Conflicts: # BGL/include/CGAL/boost/graph/named_params_helper.h # Point_set_processing_3/include/CGAL/jet_estimate_normals.h --- .../CGAL/boost/graph/named_params_helper.h | 6 +++--- Point_set_3/include/CGAL/Point_set_3.h | 16 +++++++++++----- .../include/CGAL/IO/read_off_points.h | 7 +++---- .../include/CGAL/IO/read_ply_points.h | 9 +++------ .../include/CGAL/IO/read_xyz_points.h | 7 +++---- .../include/CGAL/IO/write_off_points.h | 2 +- .../include/CGAL/IO/write_ply_points.h | 2 +- .../include/CGAL/IO/write_xyz_points.h | 2 +- .../include/CGAL/bilateral_smooth_point_set.h | 2 +- .../include/CGAL/edge_aware_upsample_point_set.h | 2 +- .../include/CGAL/jet_estimate_normals.h | 2 +- .../include/CGAL/mst_orient_normals.h | 2 +- .../include/CGAL/pca_estimate_normals.h | 2 +- .../include/CGAL/scanline_orient_normals.h | 2 +- .../include/CGAL/structure_point_set.h | 2 +- .../include/CGAL/vcm_estimate_normals.h | 2 +- 16 files changed, 34 insertions(+), 33 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index 4399e555143..e80cae78072 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -336,10 +336,10 @@ struct Point_set_processing_3_np_helper return parameters::choose_parameter(parameters::get_parameter(np, internal_np::geom_traits)); } - static constexpr bool has_normal_map() + static constexpr bool has_normal_map(const PointRange&, const NamedParameters&) { - return !boost::is_same< typename internal_np::Get_param::type, - internal_np::Param_not_found> ::value; + using CGAL::parameters::is_default_parameter; + return !(is_default_parameter::value); } }; diff --git a/Point_set_3/include/CGAL/Point_set_3.h b/Point_set_3/include/CGAL/Point_set_3.h index 74b731a0d31..66f86d0ed04 100644 --- a/Point_set_3/include/CGAL/Point_set_3.h +++ b/Point_set_3/include/CGAL/Point_set_3.h @@ -219,11 +219,9 @@ public: added. If `false` (default value), the normal map can still be added later on (see `add_normal_map()`). */ - Point_set_3 (bool with_normal_map = false) : m_base() + Point_set_3 () : m_base() { clear(); - if (with_normal_map) - add_normal_map(); } /*! @@ -1341,11 +1339,17 @@ struct Point_set_processing_3_np_helper, NamedParamet static const Normal_map get_normal_map(const Point_set_3& ps, const NamedParameters& np) { + CGAL_assertion_code( + if (!(parameters::is_default_parameter::value))) + CGAL_assertion(!!ps.normal_map()); return parameters::choose_parameter(parameters::get_parameter(np, internal_np::normal_map), ps.normal_map()); } static Normal_map get_normal_map(Point_set_3& ps, const NamedParameters& np) { + CGAL_assertion_code( + if (!(parameters::is_default_parameter::value))) + CGAL_assertion(!!ps.normal_map()); return parameters::choose_parameter(parameters::get_parameter(np, internal_np::normal_map), ps.normal_map()); } @@ -1354,9 +1358,11 @@ struct Point_set_processing_3_np_helper, NamedParamet return parameters::choose_parameter(parameters::get_parameter(np, internal_np::geom_traits)); } - static constexpr bool has_normal_map() + static constexpr bool has_normal_map(const Point_set_3& ps, const NamedParameters& np) { - return true; + using CGAL::parameters::is_default_parameter; + const bool np_has_normals = !(is_default_parameter::value); + return np_has_normals || !!ps.normal_map(); } }; diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Point_set_processing_3/include/CGAL/IO/read_off_points.h index 783fd20c1fc..7ef015cc018 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_off_points.h @@ -98,8 +98,8 @@ bool read_OFF(std::istream& is, typedef typename NP_helper::Geom_traits Kernel; typedef typename Kernel::FT FT; - bool has_normals = NP_helper::has_normal_map(); - + //the default value for normal map, if not provided in the np, + // is a dummy Constant_property_map PointMap point_map = NP_helper::get_point_map(np); NormalMap normal_map = NP_helper::get_normal_map(np); @@ -183,8 +183,7 @@ bool read_OFF(std::istream& is, Enriched_point pwn; put(point_map, pwn, point); // point_map[&pwn] = point - if (has_normals) - put(normal_map, pwn, normal); // normal_map[&pwn] = normal + put(normal_map, pwn, normal); // normal_map[&pwn] = normal *output++ = pwn; ++pointsRead; diff --git a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h index 1a0f7ed547b..5a38b4fd034 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h @@ -258,17 +258,14 @@ bool read_PLY(std::istream& is, typedef typename NP_helper::Point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - bool has_normals = NP_helper::has_normal_map(); - + //the default value for normal map, if not provided in the np, + // is a dummy Constant_property_map PointMap point_map = NP_helper::get_point_map(np); NormalMap normal_map = NP_helper::get_normal_map(np); - if(has_normals) - return read_PLY_with_properties(is, output, + return read_PLY_with_properties(is, output, make_ply_point_reader(point_map), make_ply_normal_reader(normal_map)); - // else - return read_PLY_with_properties(is, output, make_ply_point_reader(point_map)); } /** diff --git a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h index 793c7e2e85f..d2a7f178992 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h @@ -90,8 +90,8 @@ bool read_XYZ(std::istream& is, typedef typename NP_helper::Normal_map NormalMap; typedef typename NP_helper::Geom_traits Kernel; - bool has_normals = NP_helper::has_normal_map(); - + //the default value for normal map, if not provided in the np, + // is a dummy Constant_property_map PointMap point_map = NP_helper::get_point_map(np); NormalMap normal_map = NP_helper::get_normal_map(np); @@ -156,8 +156,7 @@ bool read_XYZ(std::istream& is, Enriched_point pwn; put(point_map, pwn, point); // point_map[pwn] = point - if (has_normals) - put(normal_map, pwn, normal); // normal_map[pwn] = normal + put(normal_map, pwn, normal); // normal_map[pwn] = normal *output++ = pwn; continue; diff --git a/Point_set_processing_3/include/CGAL/IO/write_off_points.h b/Point_set_processing_3/include/CGAL/IO/write_off_points.h index f89ca2a28c0..2fb38456379 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_off_points.h @@ -46,7 +46,7 @@ bool write_OFF_PSP(std::ostream& os, typedef typename NP_helper::Const_point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - const bool has_normals = !(is_default_parameter::value); + bool has_normals = NP_helper::has_normal_map(points, np); PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h index 38b361ff779..d151871a541 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h @@ -201,7 +201,7 @@ bool write_PLY(std::ostream& os, typedef typename NP_helper::Const_point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - bool has_normals = NP_helper::has_normal_map(); + bool has_normals = NP_helper::has_normal_map(points, np); PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h index 73610c9545f..b98ebb247df 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h @@ -47,7 +47,7 @@ bool write_XYZ_PSP(std::ostream& os, typedef typename NP_helper::Const_point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - bool has_normals = NP_helper::has_normal_map(); + bool has_normals = NP_helper::has_normal_map(points, np); PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h index 86fa5d23b19..5c1d2d7cf25 100644 --- a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h @@ -278,7 +278,7 @@ bilateral_smooth_point_set( typedef typename Kernel::Point_3 Point_3; typedef typename Kernel::Vector_3 Vector_3; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); typedef typename Kernel::FT FT; diff --git a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h index 507418d45b8..7bcb43eaf8f 100644 --- a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h +++ b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h @@ -367,7 +367,7 @@ edge_aware_upsample_point_set( typedef typename NP_helper::Geom_traits Kernel; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); typedef typename Kernel::Point_3 Point; typedef typename Kernel::Vector_3 Vector; diff --git a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h index da74d6e93ee..092c479c53d 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -196,7 +196,7 @@ jet_estimate_normals( typedef typename Kernel::FT FT; typedef typename GetSvdTraits::type SvdTraits; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); CGAL_static_assertion_msg(!(boost::is_same::NoTraits>::value), "Error: no SVD traits"); diff --git a/Point_set_processing_3/include/CGAL/mst_orient_normals.h b/Point_set_processing_3/include/CGAL/mst_orient_normals.h index 909dc37a63d..18be66609e5 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -631,7 +631,7 @@ mst_orient_normals( typedef typename NP_helper::Geom_traits Kernel; typedef typename Point_set_processing_3::GetIsConstrainedMap::type ConstrainedMap; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h index 8447ae952ff..9c4f5cde3e6 100644 --- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h @@ -168,7 +168,7 @@ pca_estimate_normals( typedef typename NP_helper::Geom_traits Kernel; typedef typename Kernel::FT FT; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/scanline_orient_normals.h b/Point_set_processing_3/include/CGAL/scanline_orient_normals.h index 02f956f2416..272ce021158 100644 --- a/Point_set_processing_3/include/CGAL/scanline_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/scanline_orient_normals.h @@ -478,7 +478,7 @@ void scanline_orient_normals (PointRange& points, const NamedParameters& np = pa ::type; using Fallback_scanline_ID = Boolean_tag::value>; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/structure_point_set.h b/Point_set_processing_3/include/CGAL/structure_point_set.h index f0a9fc34c86..5930d4b08f0 100644 --- a/Point_set_processing_3/include/CGAL/structure_point_set.h +++ b/Point_set_processing_3/include/CGAL/structure_point_set.h @@ -234,7 +234,7 @@ public: typedef typename Point_set_processing_3::GetPlaneMap::type PlaneMap; typedef typename Point_set_processing_3::GetPlaneIndexMap::type PlaneIndexMap; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); CGAL_static_assertion_msg((!is_default_parameter::value), "Error: no plane index map"); diff --git a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h index 5b69f3ef0f9..de0c26d68f6 100644 --- a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h @@ -321,7 +321,7 @@ vcm_estimate_normals_internal (PointRange& points, typedef typename NP_helper::Geom_traits Kernel; typedef typename GetDiagonalizeTraits::type DiagonalizeTraits; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); From 0ee5493f02101f802f400dabff6feee3a024fe52 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 25 Oct 2022 12:53:39 +0200 Subject: [PATCH 069/194] revert unintended change --- Point_set_3/include/CGAL/Point_set_3.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Point_set_3/include/CGAL/Point_set_3.h b/Point_set_3/include/CGAL/Point_set_3.h index 66f86d0ed04..dbf00b0182b 100644 --- a/Point_set_3/include/CGAL/Point_set_3.h +++ b/Point_set_3/include/CGAL/Point_set_3.h @@ -219,9 +219,11 @@ public: added. If `false` (default value), the normal map can still be added later on (see `add_normal_map()`). */ - Point_set_3 () : m_base() + Point_set_3 (bool with_normal_map = false) : m_base() { clear(); + if (with_normal_map) + add_normal_map(); } /*! From 95dd353904417f9f007f31a43718f712a624546d Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 27 Oct 2022 18:06:55 +0200 Subject: [PATCH 070/194] transform cell_selector into a property map to be consistent with doc --- ...tetrahedral_remeshing_of_one_subdomain.cpp | 26 +++++++++++++---- .../internal/smooth_vertices.h | 2 +- .../tetrahedral_adaptive_remeshing_impl.h | 29 +------------------ .../internal/tetrahedral_remeshing_helpers.h | 12 ++++---- .../include/CGAL/tetrahedral_remeshing.h | 17 ++++++----- 5 files changed, 38 insertions(+), 48 deletions(-) diff --git a/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/tetrahedral_remeshing_of_one_subdomain.cpp b/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/tetrahedral_remeshing_of_one_subdomain.cpp index ec9f56138e0..097b7955fb5 100644 --- a/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/tetrahedral_remeshing_of_one_subdomain.cpp +++ b/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/tetrahedral_remeshing_of_one_subdomain.cpp @@ -10,19 +10,34 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Tetrahedral_remeshing::Remeshing_triangulation_3 Remeshing_triangulation; -struct Cells_of_subdomain +template +struct Cells_of_subdomain_pmap { private: + using Cell_handle = typename Tr::Cell_handle; + const int m_subdomain; public: - Cells_of_subdomain(const int& subdomain) + using key_type = Cell_handle; + using value_type = bool; + using reference = bool; + using category = boost::read_write_property_map_tag; + + Cells_of_subdomain_pmap(const int& subdomain) : m_subdomain(subdomain) {} - bool operator()(Remeshing_triangulation::Cell_handle c) const + friend value_type get(const Cells_of_subdomain_pmap& map, + const key_type& c) { - return m_subdomain == c->subdomain_index(); + return (map.m_subdomain == c->subdomain_index()); + } + friend void put(Cells_of_subdomain_pmap&, + const key_type&, + const value_type) + { + ; //nothing to do : subdomain indices are updated in remeshing } }; @@ -35,7 +50,8 @@ int main(int argc, char* argv[]) CGAL::Tetrahedral_remeshing::generate_input_two_subdomains(nbv, tr); CGAL::tetrahedral_isotropic_remeshing(tr, target_edge_length, - CGAL::parameters::cell_is_selected_map(Cells_of_subdomain(2))); + CGAL::parameters::cell_is_selected_map( + Cells_of_subdomain_pmap(2))); return EXIT_SUCCESS; } diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h index 7c784af9820..ed60e69495c 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h @@ -451,7 +451,7 @@ public: inc_cells(nbv, boost::container::small_vector()); for (const Cell_handle c : tr.finite_cell_handles()) { - const bool cell_is_selected = cell_selector(c); + const bool cell_is_selected = get(cell_selector, c); for (int i = 0; i < 4; ++i) { diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h index b4f1093393d..4117c01bc89 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h @@ -55,33 +55,6 @@ public: void after_flip(CellHandle /* c */) {} }; -template -struct All_cells_selected -{ - typedef typename Tr::Cell_handle argument_type; - typedef typename Tr::Cell::Subdomain_index Subdomain_index; - - typedef bool result_type; - - result_type operator()(const argument_type c) const - { - return c->subdomain_index() != Subdomain_index(); - } -}; - -template -struct No_constraint_pmap -{ -public: - typedef Primitive key_type; - typedef bool value_type; - typedef value_type reference; - typedef boost::read_write_property_map_tag category; - - friend value_type get(No_constraint_pmap, key_type) { return false; } - friend void put(No_constraint_pmap, key_type, value_type) {} -}; - templatesubdomain_index(); if(!input_is_c3t3()) diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h index 2b348e4574b..4ac4db080ec 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h @@ -440,7 +440,7 @@ bool is_boundary(const C3T3& c3t3, const CellSelector& cell_selector) { return c3t3.is_in_complex(f) - || cell_selector(f.first) != cell_selector(f.first->neighbor(f.second)); + || get(cell_selector, f.first) != get(cell_selector, f.first->neighbor(f.second)); } template @@ -496,7 +496,7 @@ bool is_boundary_vertex(const typename C3t3::Vertex_handle& v, { if (c3t3.is_in_complex(f)) return true; - if (cell_selector(f.first) ^ cell_selector(f.first->neighbor(f.second))) + if (get(cell_selector, f.first) ^ get(cell_selector, f.first->neighbor(f.second))) return true; } return false; @@ -766,7 +766,7 @@ bool is_outside(const typename C3t3::Edge & edge, if (c3t3.is_in_complex(circ)) return false; // does circ belong to the selection? - if (cell_selector(circ)) + if (get(cell_selector, circ)) return false; ++circ; @@ -788,7 +788,7 @@ bool is_selected(const typename C3t3::Vertex_handle v, for(Cell_handle c : cells) { - if (cell_selector(c)) + if (get(cell_selector, c)) return true; } return false; @@ -813,7 +813,7 @@ bool is_internal(const typename C3t3::Edge& edge, return false; if (si != circ->subdomain_index()) return false; - if (!cell_selector(circ)) + if (!get(cell_selector, circ)) return false; if (c3t3.is_in_complex( circ, @@ -835,7 +835,7 @@ bool is_selected(const typename C3T3::Triangulation::Edge& e, Cell_circulator done = circ; do { - if (cell_selector(circ)) + if (get(cell_selector, circ)) return true; } while (++circ != done); diff --git a/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h b/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h index b1818bbded1..a5039038896 100644 --- a/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h +++ b/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h @@ -26,6 +26,8 @@ #include #include +#include + #ifdef CGAL_DUMP_REMESHING_STEPS #include #endif @@ -214,34 +216,33 @@ void tetrahedral_isotropic_remeshing( = choose_parameter(get_parameter(np, internal_np::smooth_constrained_edges), false); + typedef typename Tr::Cell_handle Cell_handle; typedef typename internal_np::Lookup_named_param_def < internal_np::cell_selector_t, NamedParameters, - Tetrahedral_remeshing::internal::All_cells_selected//default + Constant_property_map//default > ::type SelectionFunctor; SelectionFunctor cell_select = choose_parameter(get_parameter(np, internal_np::cell_selector), - Tetrahedral_remeshing::internal::All_cells_selected()); + Constant_property_map(true)); typedef std::pair Edge_vv; - typedef Tetrahedral_remeshing::internal::No_constraint_pmap No_edge; typedef typename internal_np::Lookup_named_param_def < internal_np::edge_is_constrained_t, NamedParameters, - No_edge//default + Constant_property_map//default > ::type ECMap; ECMap ecmap = choose_parameter(get_parameter(np, internal_np::edge_is_constrained), - No_edge()); + Constant_property_map(false)); typedef typename Tr::Facet Facet; - typedef Tetrahedral_remeshing::internal::No_constraint_pmap No_facet; typedef typename internal_np::Lookup_named_param_def < internal_np::facet_is_constrained_t, NamedParameters, - No_facet//default + Constant_property_map//default > ::type FCMap; FCMap fcmap = choose_parameter(get_parameter(np, internal_np::facet_is_constrained), - No_facet()); + Constant_property_map(false)); typedef typename internal_np::Lookup_named_param_def < internal_np::visitor_t, From ff3a47738a4e25f558bc0e07e0491a23f6a1d103 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 28 Oct 2022 09:44:32 +0200 Subject: [PATCH 071/194] use Constant_propert_map --- .../include/CGAL/tetrahedral_remeshing.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h b/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h index a5039038896..4ae71cf1360 100644 --- a/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h +++ b/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h @@ -410,34 +410,33 @@ void tetrahedral_isotropic_remeshing( = choose_parameter(get_parameter(np, internal_np::smooth_constrained_edges), false); + typedef typename Tr::Cell_handle Cell_handle; typedef typename internal_np::Lookup_named_param_def < internal_np::cell_selector_t, NamedParameters, - Tetrahedral_remeshing::internal::All_cells_selected//default + Constant_property_map//default > ::type SelectionFunctor; SelectionFunctor cell_select = choose_parameter(get_parameter(np, internal_np::cell_selector), - Tetrahedral_remeshing::internal::All_cells_selected()); + Constant_property_map(true)); typedef std::pair Edge_vv; - typedef Tetrahedral_remeshing::internal::No_constraint_pmap No_edge; typedef typename internal_np::Lookup_named_param_def < internal_np::edge_is_constrained_t, NamedParameters, - No_edge//default + Constant_property_map//default > ::type ECMap; ECMap ecmap = choose_parameter(get_parameter(np, internal_np::edge_is_constrained), - No_edge()); + Constant_property_map(false)); typedef typename Tr::Facet Facet; - typedef Tetrahedral_remeshing::internal::No_constraint_pmap No_facet; typedef typename internal_np::Lookup_named_param_def < internal_np::facet_is_constrained_t, NamedParameters, - No_facet//default + Constant_property_map//default > ::type FCMap; FCMap fcmap = choose_parameter(get_parameter(np, internal_np::facet_is_constrained), - No_facet()); + Constant_property_map(false)); typedef typename internal_np::Lookup_named_param_def < internal_np::visitor_t, From e1b319bf6a2fb51b330499f8f960f639c2fd4385 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 28 Oct 2022 10:11:57 +0200 Subject: [PATCH 072/194] use pmaps for cell selector everywhere --- .../internal/compute_c3t3_statistics.h | 4 ++-- .../internal/tetrahedral_remeshing_helpers.h | 6 ++--- ...tetrahedral_remeshing_of_one_subdomain.cpp | 24 +++++++++++++++---- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/compute_c3t3_statistics.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/compute_c3t3_statistics.h index 36b93215109..5f77df7bd2b 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/compute_c3t3_statistics.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/compute_c3t3_statistics.h @@ -63,7 +63,7 @@ void compute_statistics(const Triangulation& tr, { const Cell_handle cell = fit->first; const int& index = fit->second; - if (!cell_selector(cell) || !cell_selector(cell->neighbor(index))) + if (!get(cell_selector, cell) || !get(cell_selector, cell->neighbor(index))) continue; const Point& pa = point(cell->vertex((index + 1) & 3)->point()); @@ -96,7 +96,7 @@ void compute_statistics(const Triangulation& tr, ++cit) { const Subdomain_index& si = cit->subdomain_index(); - if (si == Subdomain_index() || !cell_selector(cit)) + if (si == Subdomain_index() || !get(cell_selector, cit)) continue; ++nb_tets; diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h index 4ac4db080ec..e067efa2f33 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h @@ -1591,11 +1591,9 @@ void dump_cells_with_small_dihedral_angle(const Tr& tr, std::vector cells; std::vector indices; - for (typename Tr::Finite_cells_iterator cit = tr.finite_cells_begin(); - cit != tr.finite_cells_end(); ++cit) + for (Cell_handle c : tr.finite_cell_handles()) { - Cell_handle c = cit; - if (c->subdomain_index() != Subdomain_index() && cell_select(c)) + if (c->subdomain_index() != Subdomain_index() && get(cell_select, c)) { double dh = min_dihedral_angle(tr, c); if (dh < angle_bound) diff --git a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing_of_one_subdomain.cpp b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing_of_one_subdomain.cpp index 05f9add785e..bd0049f19a0 100644 --- a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing_of_one_subdomain.cpp +++ b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing_of_one_subdomain.cpp @@ -47,20 +47,33 @@ void generate_input_two_subdomains(const std::size_t nbv, Remeshing_triangulatio #endif } -struct Cells_of_subdomain +template +struct Cells_of_subdomain_pmap { private: + using Cell_handle = typename Tr::Cell_handle; + const int m_subdomain; public: - Cells_of_subdomain(const int& subdomain) + using key_type = Cell_handle; + using value_type = bool; + using reference = bool; + using category = boost::read_write_property_map_tag; + + Cells_of_subdomain_pmap(const int& subdomain) : m_subdomain(subdomain) {} - bool operator()(Remeshing_triangulation::Cell_handle c) const + friend value_type get( + const Cells_of_subdomain_pmap& map, const key_type& c) { - return m_subdomain == c->subdomain_index(); + return (map.m_subdomain == c->subdomain_index()); } + friend void put( + Cells_of_subdomain_pmap&, const key_type&, const value_type) + {} //nothing to do : subdomain indices are updated in remeshing + }; int main(int argc, char* argv[]) @@ -74,7 +87,8 @@ int main(int argc, char* argv[]) generate_input_two_subdomains(1000, tr); CGAL::tetrahedral_isotropic_remeshing(tr, target_edge_length, - CGAL::parameters::cell_is_selected_map(Cells_of_subdomain(2))); + CGAL::parameters::cell_is_selected_map( + Cells_of_subdomain_pmap(2))); return EXIT_SUCCESS; } From 7a0cb92e43d6d01f5c0beae03742cdece87fd4f2 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 28 Oct 2022 12:50:23 +0200 Subject: [PATCH 073/194] fix cell_selector use in flip() --- .../internal/split_long_edges.h | 49 ++++++++++--------- .../internal/tetrahedral_remeshing_helpers.h | 32 ++++++++++++ 2 files changed, 59 insertions(+), 22 deletions(-) diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/split_long_edges.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/split_long_edges.h index d0d3c12f442..e074975d53a 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/split_long_edges.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/split_long_edges.h @@ -32,8 +32,9 @@ namespace Tetrahedral_remeshing { namespace internal { -template +template typename C3t3::Vertex_handle split_edge(const typename C3t3::Edge& e, + CellSelector cell_selector, C3t3& c3t3) { typedef typename C3t3::Triangulation Tr; @@ -68,8 +69,16 @@ typename C3t3::Vertex_handle split_edge(const typename C3t3::Edge& e, } CGAL_assertion(dimension > 0); - boost::unordered_map cells_info; - boost::unordered_map > facets_info; + struct Cell_info { + Subdomain_index subdomain_index_; + bool selected_; + }; + struct Facet_info { + Vertex_handle opp_vertex_; + Surface_patch_index patch_index_; + }; + boost::unordered_map cells_info; + boost::unordered_map facets_info; // check orientation and collect incident cells to avoid circulating twice boost::container::small_vector inc_cells; @@ -113,23 +122,21 @@ typename C3t3::Vertex_handle split_edge(const typename C3t3::Edge& e, //keys are the opposite facets to the ones not containing e, //because they will not be modified const Subdomain_index subdomain = c3t3.subdomain_index(c); + const bool selected = get(cell_selector, c); const Facet opp_facet1 = tr.mirror_facet(Facet(c, index_v1)); const Facet opp_facet2 = tr.mirror_facet(Facet(c, index_v2)); // volume data - cells_info.insert(std::make_pair(opp_facet1, subdomain)); - cells_info.insert(std::make_pair(opp_facet2, subdomain)); - if (c3t3.is_in_complex(c)) - c3t3.remove_from_complex(c); + cells_info.insert(std::make_pair(opp_facet1, Cell_info{subdomain, selected})); + cells_info.insert(std::make_pair(opp_facet2, Cell_info{subdomain, selected})); + treat_before_delete(c, cell_selector, c3t3); // surface data for facets of the cells to be split const int findex = CGAL::Triangulation_utils_3::next_around_edge(index_v1, index_v2); Surface_patch_index patch = c3t3.surface_patch_index(c, findex); Vertex_handle opp_vertex = c->vertex(findex); - facets_info.insert(std::make_pair(opp_facet1, - std::make_pair(opp_vertex, patch))); - facets_info.insert(std::make_pair(opp_facet2, - std::make_pair(opp_vertex, patch))); + facets_info.insert(std::make_pair(opp_facet1, Facet_info{opp_vertex, patch})); + facets_info.insert(std::make_pair(opp_facet2, Facet_info{opp_vertex, patch})); if(c3t3.is_in_complex(c, findex)) c3t3.remove_from_complex(c, findex); @@ -150,28 +157,26 @@ typename C3t3::Vertex_handle split_edge(const typename C3t3::Edge& e, //get subdomain info back CGAL_assertion(cells_info.find(mfi) != cells_info.end()); - Subdomain_index n_index = cells_info.at(mfi); - if (Subdomain_index() != n_index) - c3t3.add_to_complex(new_cell, n_index); - else - new_cell->set_subdomain_index(Subdomain_index()); + Cell_info c_info = cells_info.at(mfi); + treat_new_cell(new_cell, c_info.subdomain_index_, + cell_selector, c_info.selected_, c3t3); // get surface info back CGAL_assertion(facets_info.find(mfi) != facets_info.end()); - const std::pair v_and_opp_patch = facets_info.at(mfi); + const Facet_info v_and_opp_patch = facets_info.at(mfi); // facet opposite to new_v (status wrt c3t3 is unchanged) new_cell->set_surface_patch_index(new_cell->index(new_v), mfi.first->surface_patch_index(mfi.second)); // new half-facet (added or not to c3t3 depending on the stored surface patch index) - if (Surface_patch_index() == v_and_opp_patch.second) - new_cell->set_surface_patch_index(new_cell->index(v_and_opp_patch.first), + if (Surface_patch_index() == v_and_opp_patch.patch_index_) + new_cell->set_surface_patch_index(new_cell->index(v_and_opp_patch.opp_vertex_), Surface_patch_index()); else c3t3.add_to_complex(new_cell, - new_cell->index(v_and_opp_patch.first), - v_and_opp_patch.second); + new_cell->index(v_and_opp_patch.opp_vertex_), + v_and_opp_patch.patch_index_); // newly created internal facet for (int i = 0; i < 4; ++i) @@ -301,7 +306,7 @@ void split_long_edges(C3T3& c3t3, continue; visitor.before_split(tr, edge); - Vertex_handle vh = split_edge(edge, c3t3); + Vertex_handle vh = split_edge(edge, cell_selector, c3t3); if(vh != Vertex_handle()) visitor.after_split(tr, vh); diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h index e067efa2f33..f5b34ad19f8 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h @@ -1134,6 +1134,38 @@ void get_edge_info(const typename C3t3::Edge& edge, } } +namespace internal +{ + template + void treat_before_delete(typename C3t3::Cell_handle c, + CellSelector& cell_selector, + C3t3& c3t3) + { + if (c3t3.is_in_complex(c)) + c3t3.remove_from_complex(c); + if (get(cell_selector, c)) + put(cell_selector, c, false); + } + + template + void treat_new_cell(typename C3t3::Cell_handle c, + const typename C3t3::Subdomain_index& subdomain, + CellSelector& cell_selector, + const bool selected, + C3t3& c3t3) + { + //update C3t3 + using Subdomain_index = typename C3t3::Subdomain_index; + if (Subdomain_index() != subdomain) + c3t3.add_to_complex(c, subdomain); + else + c->set_subdomain_index(Subdomain_index()); + + //update cell_selector property map + put(cell_selector, c, selected); + } +} + namespace debug { From 1891985a82bd12d5982f36b743bbaf926f9f27d8 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 28 Oct 2022 13:13:36 +0200 Subject: [PATCH 074/194] update cell selector after collapse --- .../internal/collapse_short_edges.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/collapse_short_edges.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/collapse_short_edges.h index 4ce1fe25af0..feec9fe79aa 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/collapse_short_edges.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/collapse_short_edges.h @@ -744,10 +744,11 @@ void merge_surface_patch_indices(const typename C3t3::Facet& f1, } } -template +template typename C3t3::Vertex_handle collapse(const typename C3t3::Cell_handle ch, const int to, const int from, + CellSelector& cell_selector, C3t3& c3t3) { typedef typename C3t3::Triangulation Tr; @@ -913,8 +914,7 @@ collapse(const typename C3t3::Cell_handle ch, for (Cell_handle cell_to_remove : cells_to_remove) { // remove cell - if (c3t3.is_in_complex(cell_to_remove)) - c3t3.remove_from_complex(cell_to_remove); + treat_before_delete(cell_to_remove, cell_selector, c3t3); c3t3.triangulation().tds().delete_cell(cell_to_remove); } @@ -927,9 +927,10 @@ collapse(const typename C3t3::Cell_handle ch, } -template +template typename C3t3::Vertex_handle collapse(typename C3t3::Edge& edge, const Collapse_type& collapse_type, + CellSelector& cell_selector, C3t3& c3t3) { typedef typename C3t3::Vertex_handle Vertex_handle; @@ -953,7 +954,7 @@ typename C3t3::Vertex_handle collapse(typename C3t3::Edge& edge, vh0->set_point(new_position); vh1->set_point(new_position); - vh = collapse(edge.first, edge.second, edge.third, c3t3); + vh = collapse(edge.first, edge.second, edge.third, cell_selector, c3t3); c3t3.set_dimension(vh, (std::min)(dim_vh0, dim_vh1)); } else //Collapse at vertex @@ -961,7 +962,7 @@ typename C3t3::Vertex_handle collapse(typename C3t3::Edge& edge, if (collapse_type == TO_V1) { vh0->set_point(p1); - vh = collapse(edge.first, edge.third, edge.second, c3t3); + vh = collapse(edge.first, edge.third, edge.second, cell_selector, c3t3); c3t3.set_dimension(vh, (std::min)(dim_vh0, dim_vh1)); } else //Collapse at v0 @@ -969,7 +970,7 @@ typename C3t3::Vertex_handle collapse(typename C3t3::Edge& edge, if (collapse_type == TO_V0) { vh1->set_point(p0); - vh = collapse(edge.first, edge.second, edge.third, c3t3); + vh = collapse(edge.first, edge.second, edge.third, cell_selector, c3t3); c3t3.set_dimension(vh, (std::min)(dim_vh0, dim_vh1)); } else @@ -1133,7 +1134,7 @@ typename C3t3::Vertex_handle collapse_edge(typename C3t3::Edge& edge, if (in_cx) nb_valid_collapse++; #endif - return collapse(edge, collapse_type, c3t3); + return collapse(edge, collapse_type, cell_selector, c3t3); } } #ifdef CGAL_DEBUG_TET_REMESHING_IN_PLUGIN From 1501d9943aa48e8e6133d2797fa51a0873613313 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 28 Oct 2022 15:19:09 +0200 Subject: [PATCH 075/194] Fix the bug! See the empty columns in https://cgal.geometryfactory.com/CGAL/testsuite/results-5.6-Ic-100.shtml and the CMake output at https://cgal.geometryfactory.com/CGAL/testsuite/CGAL-5.6-Ic-100/Installation/TestReport_Christo_MSVC-2022-Community-Release.gz With `Scripts/developer_scripts/run_testsuite_with_ctest`, CMake is called with `-DWITH_tests=ON -DCGAL_TEST_SUITE=ON`. We do not want to disable that option `-DWITH_tests=ON` because it is crucial for the correct behavior of `run_testsuite_with_ctest`. --- Installation/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index c10bcd3b1f5..f200d97caad 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -842,7 +842,7 @@ endmacro() # This allows programs to locate CGALConfig.cmake set(CGAL_DIR ${CGAL_BINARY_DIR}) -if(NOT RUNNING_CGAL_AUTO_TEST AND NOT CGAL_TEST_SUITE) +if(NOT RUNNING_CGAL_AUTO_TEST) add_programs(examples examples OFF) add_programs(demo demos OFF) From 23bccfe1aa4ecab6512556ce7bf69222c5d03a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 2 Nov 2022 10:58:21 +0100 Subject: [PATCH 076/194] Remove obsolete (and wrong) comments --- .../Edge_collapse/Count_ratio_stop_predicate.h | 10 +--------- .../Policies/Edge_collapse/Count_stop_predicate.h | 10 +--------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h index eaa2849e61b..3d97e16e490 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h @@ -19,15 +19,7 @@ namespace CGAL { namespace Surface_mesh_simplification { -//******************************************************************************************************************* -// -= stopping condition predicate =- -// -// Determines whether the simplification has finished. -// The arguments are (current_cost,vertex,vertex,is_edge,initial_pair_count,current_pair_count,surface) and the result is bool -// -//******************************************************************************************************************* - -// Stops when the ratio of initial to current vertex pairs is below some value. +// Stops when the ratio of initial to current number of edges is below some value. template class Count_ratio_stop_predicate { diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h index ddc7e7a4843..0fea930b44a 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h @@ -19,15 +19,7 @@ namespace CGAL { namespace Surface_mesh_simplification { -//******************************************************************************************************************* -// -= stopping condition predicate =- -// -// Determines whether the simplification has finished. -// The arguments are (current_cost,vertex,vertex,is_edge,initial_pair_count,current_pair_count,surface) and the result is bool -// -//******************************************************************************************************************* - -// Stops when the number of edges left falls below a given number. +// Stops when the number of edges falls below a given number. template class Count_stop_predicate { From ba3a0d7d22131acf826f5138fa897f0e8a6e16af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 2 Nov 2022 13:46:45 +0100 Subject: [PATCH 077/194] Replace SMS::Count_* stop predicates with new Edge/Face_count_* stop predicates --- .../Mesh_simplification_plugin.cpp | 4 +- .../benchmark/polyhedron_performance.h | 4 +- .../benchmark/surface_mesh_performance.h | 4 +- .../Count_ratio_stop_predicate.h | 8 ++- .../Edge_collapse/Count_stop_predicate.h | 6 +- .../Edge_count_ratio_stop_predicate.h | 50 +++++++++++++++++ .../Edge_collapse/Edge_count_stop_predicate.h | 48 ++++++++++++++++ .../Face_count_ratio_stop_predicate.h | 51 +++++++++++++++++ .../Edge_collapse/Face_count_stop_predicate.h | 49 ++++++++++++++++ .../Concepts/StopPredicate.h | 6 +- .../PackageDescription.txt | 8 ++- .../edge_collapse_OpenMesh.cpp | 4 +- .../edge_collapse_bounded_normal_change.cpp | 4 +- .../edge_collapse_constrain_sharp_edges.cpp | 4 +- ...collapse_constrained_border_polyhedron.cpp | 4 +- ...llapse_constrained_border_surface_mesh.cpp | 4 +- .../edge_collapse_enriched_polyhedron.cpp | 4 +- .../edge_collapse_envelope.cpp | 4 +- .../edge_collapse_garland_heckbert.cpp | 8 ++- .../edge_collapse_linear_cell_complex.cpp | 4 +- .../edge_collapse_polyhedron.cpp | 4 +- .../edge_collapse_surface_mesh.cpp | 4 +- .../edge_collapse_visitor_surface_mesh.cpp | 4 +- .../Count_ratio_stop_predicate.h | 36 ++++-------- .../Edge_collapse/Count_stop_predicate.h | 36 ++++-------- .../Edge_count_ratio_stop_predicate.h | 52 +++++++++++++++++ .../Edge_collapse/Edge_count_stop_predicate.h | 50 +++++++++++++++++ .../Face_count_ratio_stop_predicate.h | 56 +++++++++++++++++++ .../Edge_collapse/Face_count_stop_predicate.h | 52 +++++++++++++++++ .../test/Surface_mesh_simplification/basics.h | 3 +- ...e_collapse_garland_heckbert_variations.cpp | 4 +- .../edge_collapse_topology.cpp | 4 +- .../test_edge_collapse_Envelope.cpp | 4 +- .../test_edge_collapse_Polyhedron_3.cpp | 2 +- .../test_edge_collapse_bounded_distance.cpp | 4 +- 35 files changed, 492 insertions(+), 101 deletions(-) create mode 100644 Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h create mode 100644 Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_stop_predicate.h create mode 100644 Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h create mode 100644 Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_stop_predicate.h create mode 100644 Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h create mode 100644 Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_stop_predicate.h create mode 100644 Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h create mode 100644 Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_stop_predicate.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp index c8913412da2..31f46ffc2fb 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include @@ -25,7 +25,7 @@ typedef Scene_facegraph_item::Face_graph FaceGraph; class Custom_stop_predicate { bool m_and; - CGAL::Surface_mesh_simplification::Count_stop_predicate m_count_stop; + CGAL::Surface_mesh_simplification::Edge_count_stop_predicate m_count_stop; CGAL::Surface_mesh_simplification::Edge_length_stop_predicate m_length_stop; public: diff --git a/Surface_mesh/benchmark/polyhedron_performance.h b/Surface_mesh/benchmark/polyhedron_performance.h index 6229adb0007..b4de8bd6b6d 100644 --- a/Surface_mesh/benchmark/polyhedron_performance.h +++ b/Surface_mesh/benchmark/polyhedron_performance.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include @@ -461,7 +461,7 @@ private: ) vb->id() = index++; - SMS::Count_ratio_stop_predicate stop(0.1); + SMS::Edge_count_ratio_stop_predicate stop(0.1); int r = SMS::edge_collapse(P, stop); #endif } diff --git a/Surface_mesh/benchmark/surface_mesh_performance.h b/Surface_mesh/benchmark/surface_mesh_performance.h index 9ab57e28c9a..e310a6f4400 100644 --- a/Surface_mesh/benchmark/surface_mesh_performance.h +++ b/Surface_mesh/benchmark/surface_mesh_performance.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include typedef CGAL::Simple_cartesian K; @@ -284,7 +284,7 @@ private: mesh.clear(); bool b = CGAL::IO::read_OFF(_filename, mesh); - SMS::Count_ratio_stop_predicate stop(0.1); + SMS::Edge_count_ratio_stop_predicate stop(0.1); int r = SMS::edge_collapse(mesh, stop); } diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h index 8ffe08d081a..5825ac62f5b 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h @@ -5,6 +5,8 @@ namespace Surface_mesh_simplification { /*! \ingroup PkgSurfaceMeshSimplificationRef +\deprecated + The class `Count_ratio_stop_predicate` is a model for the `StopPredicate` concept which returns `true` when the relation between the initial and current number of edges drops below a certain ratio. @@ -12,8 +14,8 @@ which returns `true` when the relation between the initial and current number of \cgalModels `StopPredicate` -\sa `CGAL::Surface_mesh_simplification::Count_stop_predicate` - +\sa `CGAL::Surface_mesh_simplification::Edge_count_ratio_stop_predicate` +\sa `CGAL::Surface_mesh_simplification::Face_count_ratio_stop_predicate` */ template< typename TriangleMesh> class Count_ratio_stop_predicate @@ -34,7 +36,7 @@ public: /// @{ /*! - Returns `((double)current_edge_count / (double)initial_edge_count) < ratio`. + Returns `(double(current_edge_count) / double(initial_edge_count)) < ratio`. All other parameters are ignored (but exist since this is a generic policy). */ bool operator()(const Edge_profile::FT current_cost, diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h index 7e6deb0254a..452302a0634 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h @@ -4,6 +4,8 @@ namespace Surface_mesh_simplification { /*! \ingroup PkgSurfaceMeshSimplificationRef +\deprecated + The class `Count_stop_predicate` is a model for the `StopPredicate` concept, which returns `true` when the number of current edges drops below a certain threshold. @@ -11,8 +13,8 @@ which returns `true` when the number of current edges drops below a certain thre \cgalModels `StopPredicate` -\sa `CGAL::Surface_mesh_simplification::Count_ratio_stop_predicate` - +\sa `CGAL::Surface_mesh_simplification::Edge_count_stop_predicate` +\sa `CGAL::Surface_mesh_simplification::Face_count_stop_predicate` */ template class Count_stop_predicate diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h new file mode 100644 index 00000000000..31da80779c6 --- /dev/null +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h @@ -0,0 +1,50 @@ + +namespace CGAL { +namespace Surface_mesh_simplification { + +/*! +\ingroup PkgSurfaceMeshSimplificationRef + +\cgalModels `StopPredicate` + +The class `Edge_count_ratio_stop_predicate` is a model for the `StopPredicate` concept +which returns `true` when the relation between the initial and current number of edges drops below a certain ratio. + +\tparam TriangleMesh is the type of surface mesh being simplified, and must be a model of the `MutableFaceGraph` and `HalfedgeListGraph` concepts. + +\sa `CGAL::Surface_mesh_simplification::Edge_count_ratio_stop_predicate` +\sa `CGAL::Surface_mesh_simplification::Face_count_ratio_stop_predicate` +*/ +template< typename TriangleMesh> +class Edge_count_ratio_stop_predicate +{ +public: + + /// \name Creation + /// @{ + + /*! + Initializes the predicate establishing the `ratio`. + */ + Edge_count_ratio_stop_predicate(const double ratio); + + /// @} + + /// \name Operations + /// @{ + + /*! + Returns `(double(current_edge_count) / double(initial_edge_count)) < ratio`. + All other parameters are ignored (but exist since this is a generic policy). + */ + bool operator()(const Edge_profile::FT current_cost, + const Edge_profile& edge_profile, + const Edge_profile::edges_size_type initial_edge_count, + const Edge_profile::edges_size_type current_edge_count) const; + + /// @} + +}; + +} // namespace Surface_mesh_simplification +} // namespace CGAL diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_stop_predicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_stop_predicate.h new file mode 100644 index 00000000000..6e3920dd421 --- /dev/null +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_stop_predicate.h @@ -0,0 +1,48 @@ +namespace CGAL { +namespace Surface_mesh_simplification { + +/*! +\ingroup PkgSurfaceMeshSimplificationRef + +\cgalModels `StopPredicate` + +The class `Edge_count_stop_predicate` is a model for the `StopPredicate` concept, +which returns `true` when the number of current edges drops below a certain threshold. + +\tparam TriangleMesh is the type of surface mesh being simplified, and must be a model of the `MutableFaceGraph` and `HalfedgeListGraph` concepts. + +\sa `CGAL::Surface_mesh_simplification::Face_count_stop_predicate` +\sa `CGAL::Surface_mesh_simplification::Edge_ratio_count_stop_predicate` +*/ +template +class Edge_count_stop_predicate +{ +public: + + /// \name Creation + /// @{ + + /*! + Initializes the predicate establishing the `threshold` value. + */ + Edge_count_stop_predicate(const Edge_profile::edges_size_type threshold); + + /// @} + + /// \name Operations + /// @{ + + /*! + Returns `(current_edge_count < threshold)`. All other parameters are ignored (but exist since this is a generic policy). + */ + bool operator()(const Edge_profile::FT& current_cost, + const Edge_profile& edge_profile, + const Edge_profile::edges_size_type initial_edge_count, + const Edge_profile::edges_size_type current_edge_count) const; + + /// @} + +}; + +} // namespace Surface_mesh_simplification +} // namespace CGAL diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h new file mode 100644 index 00000000000..82cfdf2e62e --- /dev/null +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h @@ -0,0 +1,51 @@ + +namespace CGAL { +namespace Surface_mesh_simplification { + +/*! +\ingroup PkgSurfaceMeshSimplificationRef + +\cgalModels `StopPredicate` + +The class `Face_count_ratio_stop_predicate` is a model for the `StopPredicate` concept +which returns `true` when the relation between the initial and current number of edges drops below a certain ratio. + +\tparam TriangleMesh is the type of surface mesh being simplified, and must be a model of the `MutableFaceGraph` and `HalfedgeListGraph` concepts. + +\sa `CGAL::Surface_mesh_simplification::Edge_count_ratio_stop_predicate` +\sa `CGAL::Surface_mesh_simplification::Face_count_ratio_stop_predicate` +*/ +template< typename TriangleMesh> +class Face_count_ratio_stop_predicate +{ +public: + + /// \name Creation + /// @{ + + /*! + Initializes the predicate establishing the `ratio`. + */ + Face_count_ratio_stop_predicate(const double ratio, const TriangleMesh& tmesh); + + /// @} + + /// \name Operations + /// @{ + + /*! + Returns `true` if the ratio of current face count over initial face count is strictly smaller than `ratio`, + and `false` otherwise. + All other parameters are ignored (but exist since this is a generic policy). + */ + bool operator()(const Edge_profile::FT current_cost, + const Edge_profile& edge_profile, + const Edge_profile::edges_size_type initial_edge_count, + const Edge_profile::edges_size_type current_edge_count) const; + + /// @} + +}; + +} // namespace Surface_mesh_simplification +} // namespace CGAL diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_stop_predicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_stop_predicate.h new file mode 100644 index 00000000000..8c35a5c35e7 --- /dev/null +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_stop_predicate.h @@ -0,0 +1,49 @@ +namespace CGAL { +namespace Surface_mesh_simplification { + +/*! +\ingroup PkgSurfaceMeshSimplificationRef + +\cgalModels `StopPredicate` + +The class `Face_count_stop_predicate` is a model for the `StopPredicate` concept, +which returns `true` when the number of current faces drops below a certain threshold. + +\tparam TriangleMesh is the type of surface mesh being simplified, and must be a model of the `MutableFaceGraph` and `HalfedgeListGraph` concepts. + +\sa `CGAL::Surface_mesh_simplification::Edge_count_stop_predicate` +\sa `CGAL::Surface_mesh_simplification::Face_count_ratio_stop_predicate` +*/ +template +class Face_count_stop_predicate +{ +public: + + /// \name Creation + /// @{ + + /*! + Initializes the predicate establishing the `threshold` value. + */ + Face_count_stop_predicate(const Edge_profile::edges_size_type threshold); + + /// @} + + /// \name Operations + /// @{ + + /*! + Returns `true` if the current face count is strictly smaller than `threshold`, and `false` otherwise. + All other parameters are ignored (but exist since this is a generic policy). + */ + bool operator()(const Edge_profile::FT& current_cost, + const Edge_profile& edge_profile, + const Edge_profile::edges_size_type initial_edge_count, + const Edge_profile::edges_size_type current_edge_count) const; + + /// @} + +}; + +} // namespace Surface_mesh_simplification +} // namespace CGAL diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/StopPredicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/StopPredicate.h index b24bc09c99e..ad5f22d4ccb 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/StopPredicate.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Concepts/StopPredicate.h @@ -4,8 +4,10 @@ The concept `StopPredicate` describes the requirements for the predicate which indicates if the simplification process must finish. -\cgalHasModel `CGAL::Surface_mesh_simplification::Count_stop_predicate` -\cgalHasModel `CGAL::Surface_mesh_simplification::Count_ratio_stop_predicate` +\cgalHasModel `CGAL::Surface_mesh_simplification::Edge_count_stop_predicate` +\cgalHasModel `CGAL::Surface_mesh_simplification::Face_count_stop_predicate` +\cgalHasModel `CGAL::Surface_mesh_simplification::Edge_count_ratio_stop_predicate` +\cgalHasModel `CGAL::Surface_mesh_simplification::Face_count_ratio_stop_predicate` \cgalHasModel `CGAL::Surface_mesh_simplification::Edge_length_stop_predicate` */ diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/PackageDescription.txt b/Surface_mesh_simplification/doc/Surface_mesh_simplification/PackageDescription.txt index f29f913fc0a..1d97e670f9d 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/PackageDescription.txt +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/PackageDescription.txt @@ -34,8 +34,12 @@ - `CGAL::Surface_mesh_simplification::edge_collapse()` \cgalCRPSection{Policies} -- `CGAL::Surface_mesh_simplification::Count_stop_predicate` -- `CGAL::Surface_mesh_simplification::Count_ratio_stop_predicate` +- `CGAL::Surface_mesh_simplification::Count_stop_predicate` (deprecated) +- `CGAL::Surface_mesh_simplification::Count_ratio_stop_predicate` (deprecated) +- `CGAL::Surface_mesh_simplification::Edge_count_stop_predicate` +- `CGAL::Surface_mesh_simplification::Face_count_stop_predicate` +- `CGAL::Surface_mesh_simplification::Edge_count_ratio_stop_predicate` +- `CGAL::Surface_mesh_simplification::Face_count_ratio_stop_predicate` - `CGAL::Surface_mesh_simplification::Edge_length_stop_predicate` - `CGAL::Surface_mesh_simplification::Edge_length_cost` - `CGAL::Surface_mesh_simplification::Midpoint_placement` diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_OpenMesh.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_OpenMesh.cpp index ae8c50b4c45..7612d7436e2 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_OpenMesh.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_OpenMesh.cpp @@ -5,7 +5,7 @@ // Simplification function #include -#include +#include #include #include @@ -70,7 +70,7 @@ int main(int argc, char** argv) // In this example, the simplification stops when the number of undirected edges // left in the surface mesh drops below the specified number (1000) const std::size_t stop_n = (argc > 2) ? std::stoi(argv[2]) : 1000; - SMS::Count_stop_predicate stop(stop_n); + SMS::Edge_count_stop_predicate stop(stop_n); // This the actual call to the simplification algorithm. // The surface mesh and stop conditions are mandatory arguments. diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_bounded_normal_change.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_bounded_normal_change.cpp index e8d0ba8ba1b..88eb9b986e7 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_bounded_normal_change.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_bounded_normal_change.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include @@ -53,7 +53,7 @@ int main(int argc, char** argv) // In this example, the simplification stops when the number of undirected edges // left in the surface mesh drops below the specified number const std::size_t stop_n = (argc > 2) ? std::stoi(argv[2]) : num_halfedges(surface_mesh)/2 - 1; - SMS::Count_stop_predicate stop(stop_n); + SMS::Edge_count_stop_predicate stop(stop_n); typedef SMS::LindstromTurk_placement Placement; diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cpp index 678087c38b2..f40a35faeae 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include @@ -121,7 +121,7 @@ int main(int argc, char** argv) std::cerr << "# sharp edges = " << nb_sharp_edges << std::endl; // Contract the surface mesh as much as possible - SMS::Count_stop_predicate stop(0); + SMS::Edge_count_stop_predicate stop(0); std::cout << "Collapsing as many non-sharp edges of mesh: " << filename << " as possible..." << std::endl; int r = SMS::edge_collapse(surface_mesh, stop, diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cpp index 9c50a593725..1fcb9ce4e05 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cpp @@ -11,7 +11,7 @@ #include // Stop-condition policy -#include +#include #include #include @@ -78,7 +78,7 @@ int main(int argc, char** argv) } // Contract the surface mesh as much as possible - SMS::Count_stop_predicate stop(0); + SMS::Edge_count_stop_predicate stop(0); Border_is_constrained_edge_map bem(surface_mesh); // This the actual call to the simplification algorithm. diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp index b60753cddfc..4d3418e9abe 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp @@ -11,7 +11,7 @@ #include // Stop-condition policy -#include +#include #include #include @@ -77,7 +77,7 @@ int main(int argc, char** argv) } // Contract the surface mesh as much as possible - SMS::Count_stop_predicate stop(0); + SMS::Edge_count_stop_predicate stop(0); Border_is_constrained_edge_map bem(surface_mesh); // This the actual call to the simplification algorithm. diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cpp index d8b574b241f..a48e1833bb3 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_enriched_polyhedron.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include @@ -53,7 +53,7 @@ int main(int argc, char** argv) // In this example, the simplification stops when the number of undirected edges // drops below xx% of the initial count const double ratio = (argc > 2) ? std::stod(argv[2]) : 0.1; - SMS::Count_ratio_stop_predicate stop(ratio); + SMS::Edge_count_ratio_stop_predicate stop(ratio); // The index maps are not explicitelty passed as in the previous // example because the surface mesh items have a proper id() field. diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_envelope.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_envelope.cpp index 6b8ee4e8902..7fc05ffc8b8 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_envelope.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_envelope.cpp @@ -3,7 +3,7 @@ #include -#include +#include #include #include #include @@ -33,7 +33,7 @@ int main(int argc, char** argv) std::ifstream is(argc > 1 ? argv[1] : CGAL::data_file_path("meshes/helmet.off")); is >> mesh; - SMS::Count_stop_predicate stop(0); // go as far as you can while in the envelope + SMS::Edge_count_stop_predicate stop(0); // go as far as you can while in the envelope CGAL::Iso_cuboid_3 bbox(CGAL::Polygon_mesh_processing::bbox(mesh)); diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_garland_heckbert.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_garland_heckbert.cpp index ef14f4f94ba..8a70a30d560 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_garland_heckbert.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_garland_heckbert.cpp @@ -1,11 +1,13 @@ #include #include -#include +#include #include #include #include +#include + #include #include #include @@ -29,13 +31,13 @@ void collapse_gh(Surface_mesh& mesh, { std::chrono::steady_clock::time_point start_time = std::chrono::steady_clock::now(); - SMS::Count_ratio_stop_predicate stop(ratio); + SMS::Edge_count_ratio_stop_predicate stop(ratio); // Garland&Heckbert simplification policies typedef typename GHPolicies::Get_cost GH_cost; typedef typename GHPolicies::Get_placement GH_placement; - typedef SMS::Bounded_normal_change_placement Bounded_GH_placement; + typedef SMS::Bounded_normal_change_placement Bounded_GH_placement; GHPolicies gh_policies(mesh); const GH_cost& gh_cost = gh_policies.get_cost(); diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_linear_cell_complex.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_linear_cell_complex.cpp index 3528fb06646..4bedf34619a 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_linear_cell_complex.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_linear_cell_complex.cpp @@ -4,7 +4,7 @@ #include // Stop-condition policy -#include +#include #include #include @@ -42,7 +42,7 @@ int main(int argc, char** argv) // In this example, the simplification stops when the number of undirected edges // left in the surface mesh drops below the specified number (1000 by default) const std::size_t edge_count_treshold = (argc > 2) ? std::stoi(argv[2]) : 1000; - SMS::Count_stop_predicate stop(edge_count_treshold); + SMS::Edge_count_stop_predicate stop(edge_count_treshold); // This the actual call to the simplification algorithm. // The surface mesh and stop conditions are mandatory arguments. diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cpp index a46b5ab76db..712afa46742 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_polyhedron.cpp @@ -5,7 +5,7 @@ #include // Stop-condition policy -#include +#include #include #include @@ -36,7 +36,7 @@ int main(int argc, char** argv) // In this example, the simplification stops when the number of undirected edges // left in the surface mesh drops below the specified number (1000) const std::size_t edge_count_treshold = (argc > 2) ? std::stoi(argv[2]) : 1000; - SMS::Count_stop_predicate stop(edge_count_treshold); + SMS::Edge_count_stop_predicate stop(edge_count_treshold); // This the actual call to the simplification algorithm. // The surface mesh and stop conditions are mandatory arguments. diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cpp index d0bce9ca051..d21417d9829 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include @@ -36,7 +36,7 @@ int main(int argc, char** argv) // In this example, the simplification stops when the number of undirected edges // drops below 10% of the initial count double stop_ratio = (argc > 2) ? std::stod(argv[2]) : 0.1; - SMS::Count_ratio_stop_predicate stop(stop_ratio); + SMS::Edge_count_ratio_stop_predicate stop(stop_ratio); int r = SMS::edge_collapse(surface_mesh, stop); diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_visitor_surface_mesh.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_visitor_surface_mesh.cpp index 2568e555755..f0b747108a6 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_visitor_surface_mesh.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_visitor_surface_mesh.cpp @@ -8,7 +8,7 @@ #include // Stop-condition policy -#include +#include #include #include @@ -112,7 +112,7 @@ int main(int argc, char** argv) // In this example, the simplification stops when the number of undirected edges // drops below xx% of the initial count const double ratio = (argc > 2) ? std::stod(argv[2]) : 0.1; - SMS::Count_ratio_stop_predicate stop(ratio); + SMS::Edge_count_ratio_stop_predicate stop(ratio); Stats stats; My_visitor vis(&stats); diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h index 3d97e16e490..ec8f2a3a225 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h @@ -13,40 +13,24 @@ #include -#include -#include +#define CGAL_DEPRECATED_HEADER "" +#define CGAL_REPLACEMENT_HEADER "" +#include + +#include + +#ifndef CGAL_NO_DEPRECATED_CODE namespace CGAL { namespace Surface_mesh_simplification { // Stops when the ratio of initial to current number of edges is below some value. template -class Count_ratio_stop_predicate -{ -public: - typedef TM_ TM; - typedef typename boost::graph_traits::edges_size_type size_type; - - Count_ratio_stop_predicate(const double ratio) - : m_ratio(ratio) - { - CGAL_warning(0. < ratio && ratio <= 1.); - } - - template - bool operator()(const F& /*current_cost*/, - const Profile& /*profile*/, - size_type initial_edge_count, - size_type current_edge_count) const - { - return (static_cast(current_edge_count) / static_cast(initial_edge_count)) < m_ratio; - } - -private: - double m_ratio; -}; +using Count_ratio_stop_predicate = CGAL_DEPRECATED Edge_count_ratio_stop_predicate; } // namespace Surface_mesh_simplification } // namespace CGAL +#endif // CGAL_NO_DEPRECATED_CODE + #endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COUNT_RATIO_STOP_PREDICATE_H diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h index 0fea930b44a..c72b0bafea2 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h @@ -13,38 +13,24 @@ #include -#include -#include +#define CGAL_DEPRECATED_HEADER "" +#define CGAL_REPLACEMENT_HEADER "" +#include + +#include + +#ifndef CGAL_NO_DEPRECATED_CODE namespace CGAL { namespace Surface_mesh_simplification { -// Stops when the number of edges falls below a given number. +// Stops when the number of edges left falls below a given number. template -class Count_stop_predicate -{ -public: - typedef TM_ TM; - typedef typename boost::graph_traits::edges_size_type size_type; - - Count_stop_predicate(const std::size_t edge_count_threshold) - : m_edge_count_threshold(edge_count_threshold) - { } - - template - bool operator()(const F& /*current_cost*/, - const Profile& /*profile*/, - std::size_t /*initial_edge_count*/, - std::size_t current_edge_count) const - { - return current_edge_count < m_edge_count_threshold; - } - -private: - std::size_t m_edge_count_threshold; -}; +using Count_stop_predicate = CGAL_DEPRECATED Edge_count_stop_predicate; } // namespace Surface_mesh_simplification } // namespace CGAL +#endif // CGAL_NO_DEPRECATED_CODE + #endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_COUNT_STOP_PREDICATE_H diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h new file mode 100644 index 00000000000..0642d1644b0 --- /dev/null +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h @@ -0,0 +1,52 @@ +// Copyright (c) 2006 GeometryFactory (France). All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Fernando Cacciola +// +#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_EDGE_COUNT_STOP_PREDICATE_H +#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_EDGE_COUNT_STOP_PREDICATE_H + +#include + +#include +#include + +namespace CGAL { +namespace Surface_mesh_simplification { + +// Stops when the ratio of initial to current number of edges is below some value. +template +class Edge_count_ratio_stop_predicate +{ +public: + typedef TM_ TM; + typedef typename boost::graph_traits::edges_size_type size_type; + + Edge_count_ratio_stop_predicate(const double ratio) + : m_ratio(ratio) + { + CGAL_warning(0. < ratio && ratio <= 1.); + } + + template + bool operator()(const F& /*current_cost*/, + const Profile& /*profile*/, + size_type initial_edge_count, + size_type current_edge_count) const + { + return (static_cast(current_edge_count) / static_cast(initial_edge_count)) < m_ratio; + } + +private: + double m_ratio; +}; + +} // namespace Surface_mesh_simplification +} // namespace CGAL + +#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_EDGE_COUNT_STOP_PREDICATE_H diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_stop_predicate.h new file mode 100644 index 00000000000..aa3de2159a9 --- /dev/null +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_stop_predicate.h @@ -0,0 +1,50 @@ +// Copyright (c) 2006 GeometryFactory (France). All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Fernando Cacciola +// +#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_EDGE_COUNT_STOP_PREDICATE_H +#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_EDGE_COUNT_STOP_PREDICATE_H + +#include + +#include +#include + +namespace CGAL { +namespace Surface_mesh_simplification { + +// Stops when the number of edges falls below a given number. +template +class Edge_count_stop_predicate +{ +public: + typedef TM_ TM; + typedef typename boost::graph_traits::edges_size_type size_type; + + Edge_count_stop_predicate(const std::size_t edge_count_threshold) + : m_edge_count_threshold(edge_count_threshold) + { } + + template + bool operator()(const F& /*current_cost*/, + const Profile& /*profile*/, + std::size_t /*initial_edge_count*/, + std::size_t current_edge_count) const + { + return current_edge_count < m_edge_count_threshold; + } + +private: + std::size_t m_edge_count_threshold; +}; + +} // namespace Surface_mesh_simplification +} // namespace CGAL + +#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_EDGE_COUNT_STOP_PREDICATE_H diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h new file mode 100644 index 00000000000..383d389d2a3 --- /dev/null +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h @@ -0,0 +1,56 @@ +// Copyright (c) 2006 GeometryFactory (France). All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Fernando Cacciola +// +#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_EDGE_FACE_COUNT_RATIO_STOP_PREDICATE_H +#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_EDGE_FACE_COUNT_RATIO_STOP_PREDICATE_H + +#include + +#include +#include +#include + +namespace CGAL { +namespace Surface_mesh_simplification { + +// Stops when the ratio of initial to current number of edges is below some value. +template +class Face_count_ratio_stop_predicate +{ +public: + typedef TM_ TM; + typedef typename boost::graph_traits::edges_size_type size_type; + + Face_count_ratio_stop_predicate(const double ratio, + const TM& tmesh) + : m_ratio(ratio), m_initial_face_count(CGAL::internal::exact_num_faces(tmesh)) + { + CGAL_warning(0. < ratio && ratio <= 1.); + } + + template + bool operator()(const F& /*current_cost*/, + const Profile& profile, + size_type /*initial_edge_count*/, + size_type /*current_edge_count*/) const + { + const std::size_t current_face_count = CGAL::internal::exact_num_faces(profile.surface_mesh()); + return (static_cast(current_face_count) / static_cast(m_initial_face_count)) < m_ratio; + } + +private: + const double m_ratio; + const std::size_t m_initial_face_count; +}; + +} // namespace Surface_mesh_simplification +} // namespace CGAL + +#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_EDGE_FACE_COUNT_RATIO_STOP_PREDICATE_H diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_stop_predicate.h new file mode 100644 index 00000000000..873cac7c320 --- /dev/null +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_stop_predicate.h @@ -0,0 +1,52 @@ +// Copyright (c) 2006 GeometryFactory (France). All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Fernando Cacciola +// +#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_COUNT_STOP_PREDICATE_H +#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_COUNT_STOP_PREDICATE_H + +#include + +#include +#include +#include + +namespace CGAL { +namespace Surface_mesh_simplification { + +// Stops when the number of faces falls below a given number. +template +class Face_count_stop_predicate +{ +public: + typedef TM_ TM; + typedef typename boost::graph_traits::faces_size_type size_type; + + Face_count_stop_predicate(const std::size_t face_count_threshold) + : m_face_count_threshold(face_count_threshold) + { } + + template + bool operator()(const F& /*current_cost*/, + const Profile& profile, + std::size_t /*initial_edge_count*/, + std::size_t /*current_edge_count*/) const + { + const std::size_t current_face_count = CGAL::internal::exact_num_faces(profile.surface_mesh()); + return (current_face_count < m_face_count_threshold); + } + +private: + std::size_t m_face_count_threshold; +}; + +} // namespace Surface_mesh_simplification +} // namespace CGAL + +#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_COUNT_STOP_PREDICATE_H diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/basics.h b/Surface_mesh_simplification/test/Surface_mesh_simplification/basics.h index 703a7f4c194..e1363e7fed6 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/basics.h +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/basics.h @@ -32,7 +32,8 @@ void Surface_simplification_external_trace(std::string s) #include #include #include -#include +#include +#include #include #include diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_garland_heckbert_variations.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_garland_heckbert_variations.cpp index 9b7bd975503..32505153d06 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_garland_heckbert_variations.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_garland_heckbert_variations.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include @@ -102,7 +102,7 @@ Surface_mesh edge_collapse(Surface_mesh& mesh, const Cost& cost = p.get_cost(); const Placement& unbounded_placement = p.get_placement(); Bounded_placement bounded_placement(unbounded_placement); - SMS::Count_ratio_stop_predicate stop(ratio); + SMS::Edge_count_ratio_stop_predicate stop(ratio); std::chrono::time_point start_time = std::chrono::steady_clock::now(); diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_topology.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_topology.cpp index 5e0ab17d1d6..d52a8e1daa1 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_topology.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_topology.cpp @@ -8,7 +8,7 @@ #include // Stop-condition policy -#include +#include typedef CGAL::Simple_cartesian Kernel; typedef CGAL::Polyhedron_3 Surface; @@ -36,7 +36,7 @@ int main(int argc, char** argv) std::cout << "Initial count " << initial_count << " edges.\n"; // Contract the surface as much as possible - SMS::Count_stop_predicate stop(0); + SMS::Edge_count_stop_predicate stop(0); int r = SMS::edge_collapse (surface diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Envelope.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Envelope.cpp index d7228a1406a..cb52e089ede 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Envelope.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Envelope.cpp @@ -7,7 +7,7 @@ #include -#include +#include #include #include @@ -96,7 +96,7 @@ int main(int argc, char** argv) std::ifstream is(argc > 1 ? argv[1] : "data/helmet.off"); is >> input_mesh; - SMS::Count_stop_predicate stop(0); // go as far as you can while in the envelope + SMS::Edge_count_stop_predicate stop(0); // go as far as you can while in the envelope Stats stats; My_visitor vis(&stats); diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Polyhedron_3.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Polyhedron_3.cpp index 7c641c5eb69..b81c477049c 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Polyhedron_3.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Polyhedron_3.cpp @@ -378,7 +378,7 @@ bool Test (string aName) set_halfedgeds_items_id(lSurface); - SMS::Count_stop_predicate stop(sStop); + SMS::Edge_count_stop_predicate stop(sStop); Real_timer t; t.start(); diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_bounded_distance.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_bounded_distance.cpp index 0764b881fe1..f6cd535bf50 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_bounded_distance.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_bounded_distance.cpp @@ -4,7 +4,7 @@ // Simplification function #include #include -#include +#include #include #include @@ -42,7 +42,7 @@ int main(int argc, char** argv) std::ifstream is(argc > 1 ? argv[1] : "data/helmet.off"); is >> ref_mesh; - SMS::Count_stop_predicate stop(num_halfedges(ref_mesh)/10); + SMS::Edge_count_stop_predicate stop(num_halfedges(ref_mesh)/10); std::cout << "input has " << num_vertices(ref_mesh) << " vertices." << std::endl; CGAL::Iso_cuboid_3 bbox(CGAL::Polygon_mesh_processing::bbox(ref_mesh)); From e64a8d759fb0e19206f9b635d0133f2942c7d981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 2 Nov 2022 13:47:41 +0100 Subject: [PATCH 078/194] Add a test for new count stop predicates + test deprecated versions --- .../CMakeLists.txt | 1 + .../test_edge_deprecated_stop_predicates.cpp | 171 ++++++++++++++++++ 2 files changed, 172 insertions(+) create mode 100644 Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_deprecated_stop_predicates.cpp diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt b/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt index 86599afd28e..2f55474593a 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/CMakeLists.txt @@ -11,6 +11,7 @@ create_single_source_cgal_program("test_edge_collapse_bounded_distance.cpp") create_single_source_cgal_program("test_edge_collapse_Envelope.cpp") create_single_source_cgal_program("test_edge_collapse_Polyhedron_3.cpp") create_single_source_cgal_program("test_edge_profile_link.cpp") +create_single_source_cgal_program("test_edge_deprecated_stop_predicates.cpp") find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater) include(CGAL_Eigen3_support) diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_deprecated_stop_predicates.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_deprecated_stop_predicates.cpp new file mode 100644 index 00000000000..e1b7be1fb1e --- /dev/null +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_deprecated_stop_predicates.cpp @@ -0,0 +1,171 @@ +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include + +// deprecated +#include +#include + +#include +#include + +#include + +typedef CGAL::Simple_cartesian K; +typedef CGAL::Surface_mesh Mesh; + +namespace SMS = CGAL::Surface_mesh_simplification; + +typedef SMS::Edge_count_stop_predicate Edge_count_stop; +typedef SMS::Face_count_stop_predicate Face_count_stop; +typedef SMS::Edge_count_ratio_stop_predicate Edge_count_ratio_stop; +typedef SMS::Face_count_ratio_stop_predicate Face_count_ratio_stop; + +typedef SMS::Count_stop_predicate Count_stop; +typedef SMS::Count_ratio_stop_predicate Count_ratio_stop; + +typedef SMS::Count_ratio_stop_predicate Count_ratio_stop; + +typedef SMS::Edge_length_cost Cost; +typedef SMS::Midpoint_placement Placement; + +int main(int argc, char** argv) +{ + const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/cube-meshed.off"); + + Mesh mesh; + if(!CGAL::IO::read_polygon_mesh(filename, mesh)) + { + std::cerr << "Failed to read input mesh: " << filename << std::endl; + return EXIT_FAILURE; + } + + if(!CGAL::is_triangle_mesh(mesh)) + { + std::cerr << "Input geometry is not triangulated." << std::endl; + return EXIT_FAILURE; + } + + std::cout << "Input mesh has " << num_vertices(mesh) << " nv " + << num_edges(mesh) << " ne " + << num_faces(mesh) << " nf" << std::endl; + + Cost cost; + Placement placement; + + // Edge_count_stop + { + Mesh mesh_cpy = mesh; + const std::size_t expected_ne = num_edges(mesh_cpy) / 2; + Edge_count_stop stop(expected_ne); + SMS::edge_collapse(mesh_cpy, stop, + CGAL::parameters::get_cost(cost) + .get_placement(placement)); + + std::cout << "Output mesh has " << CGAL::internal::exact_num_vertices(mesh_cpy) << " nv " + << CGAL::internal::exact_num_edges(mesh_cpy) << " ne " + << CGAL::internal::exact_num_faces(mesh_cpy) << " nf" << std::endl; + + assert(CGAL::internal::exact_num_edges(mesh_cpy) < expected_ne); + } + + // Count_stop + { + Mesh mesh_cpy = mesh; + const std::size_t expected_ne = num_edges(mesh_cpy) + 1; + Count_stop stop(expected_ne); + SMS::edge_collapse(mesh_cpy, stop, + CGAL::parameters::get_cost(cost) + .get_placement(placement)); + + std::cout << "Output mesh has " << CGAL::internal::exact_num_vertices(mesh_cpy) << " nv " + << CGAL::internal::exact_num_edges(mesh_cpy) << " ne " + << CGAL::internal::exact_num_faces(mesh_cpy) << " nf" << std::endl; + + assert(CGAL::internal::exact_num_edges(mesh_cpy) < expected_ne); + } + + // Face_count_stop + { + Mesh mesh_cpy = mesh; + const std::size_t expected_nf = num_faces(mesh_cpy) / 4; + Face_count_stop stop(expected_nf); + SMS::edge_collapse(mesh_cpy, stop, + CGAL::parameters::get_cost(cost) + .get_placement(placement)); + + std::cout << "Output mesh has " << CGAL::internal::exact_num_vertices(mesh_cpy) << " nv " + << CGAL::internal::exact_num_edges(mesh_cpy) << " ne " + << CGAL::internal::exact_num_faces(mesh_cpy) << " nf" << std::endl; + + assert(CGAL::internal::exact_num_faces(mesh_cpy) < expected_nf); + } + + /// RATIO + + // Edge_count_ratio_stop + { + Mesh mesh_cpy = mesh; + const double ratio = 0.5; + const std::size_t initial_ne = num_edges(mesh_cpy); + Edge_count_ratio_stop stop(ratio); + SMS::edge_collapse(mesh_cpy, stop, + CGAL::parameters::get_cost(cost) + .get_placement(placement)); + + std::cout << "Output mesh has " << CGAL::internal::exact_num_vertices(mesh_cpy) << " nv " + << CGAL::internal::exact_num_edges(mesh_cpy) << " ne " + << CGAL::internal::exact_num_faces(mesh_cpy) << " nf" << std::endl; + + assert(CGAL::internal::exact_num_edges(mesh_cpy) / initial_ne < ratio); + } + + // Count_ratio_stop + { + Mesh mesh_cpy = mesh; + const double ratio = 1.; + const std::size_t initial_ne = num_edges(mesh_cpy); + Count_ratio_stop stop(ratio); + SMS::edge_collapse(mesh_cpy, stop, + CGAL::parameters::get_cost(cost) + .get_placement(placement)); + + std::cout << "Output mesh has " << CGAL::internal::exact_num_vertices(mesh_cpy) << " nv " + << CGAL::internal::exact_num_edges(mesh_cpy) << " ne " + << CGAL::internal::exact_num_faces(mesh_cpy) << " nf" << std::endl; + + assert(CGAL::internal::exact_num_edges(mesh_cpy) / initial_ne < ratio); + } + + // Face_count_ratio_stop + { + Mesh mesh_cpy = mesh; + const double ratio = 0.7; + const std::size_t initial_nf = num_faces(mesh_cpy); + Face_count_ratio_stop stop(ratio, mesh_cpy); + SMS::edge_collapse(mesh_cpy, stop, + CGAL::parameters::get_cost(cost) + .get_placement(placement)); + + std::cout << "Output mesh has " << CGAL::internal::exact_num_vertices(mesh_cpy) << " nv " + << CGAL::internal::exact_num_edges(mesh_cpy) << " ne " + << CGAL::internal::exact_num_faces(mesh_cpy) << " nf" << std::endl; + + assert(CGAL::internal::exact_num_faces(mesh_cpy) / initial_nf < ratio); + } + + return 0; +} + From 837573119d16627b96f7f4f2e7b4e0481d3d9614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 2 Nov 2022 13:55:32 +0100 Subject: [PATCH 079/194] Fix include guard names --- .../Edge_collapse/Edge_count_ratio_stop_predicate.h | 6 +++--- .../Edge_collapse/Face_count_ratio_stop_predicate.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h index 0642d1644b0..13123440d86 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h @@ -8,8 +8,8 @@ // // Author(s) : Fernando Cacciola // -#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_EDGE_COUNT_STOP_PREDICATE_H -#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_EDGE_COUNT_STOP_PREDICATE_H +#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_EDGE_COUNT_RATIO_STOP_PREDICATE_H +#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_EDGE_COUNT_RATIO_STOP_PREDICATE_H #include @@ -49,4 +49,4 @@ private: } // namespace Surface_mesh_simplification } // namespace CGAL -#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_EDGE_COUNT_STOP_PREDICATE_H +#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_EDGE_COUNT_RATIO_STOP_PREDICATE_H diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h index 383d389d2a3..e21db25c3a0 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h @@ -8,8 +8,8 @@ // // Author(s) : Fernando Cacciola // -#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_EDGE_FACE_COUNT_RATIO_STOP_PREDICATE_H -#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_EDGE_FACE_COUNT_RATIO_STOP_PREDICATE_H +#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_COUNT_RATIO_STOP_PREDICATE_H +#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_COUNT_RATIO_STOP_PREDICATE_H #include @@ -53,4 +53,4 @@ private: } // namespace Surface_mesh_simplification } // namespace CGAL -#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_EDGE_FACE_COUNT_RATIO_STOP_PREDICATE_H +#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_EDGE_COLLAPSE_FACE_COUNT_RATIO_STOP_PREDICATE_H From 47032c62c72ded8822132c3e344444fcaaad770a Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Wed, 2 Nov 2022 22:34:56 +0200 Subject: [PATCH 080/194] Fixed link --- .../doc/Minkowski_sum_2/CGAL/approximated_offset_2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Minkowski_sum_2/doc/Minkowski_sum_2/CGAL/approximated_offset_2.h b/Minkowski_sum_2/doc/Minkowski_sum_2/CGAL/approximated_offset_2.h index 4b98132bb68..d53817e4676 100644 --- a/Minkowski_sum_2/doc/Minkowski_sum_2/CGAL/approximated_offset_2.h +++ b/Minkowski_sum_2/doc/Minkowski_sum_2/CGAL/approximated_offset_2.h @@ -14,7 +14,7 @@ several disconnected components. The result is therefore represented as a sequence of generalized polygons, whose edges are either line segments or circular arcs. The output sequence is returned via the output iterator `oi`, whose -value-type must be `Gps_circle_segment_traits_2::Polygon_2`. +value-type must be `Gps_circle_segment_traits_2::Polygon_2`. \pre `P` is a simple polygon. */ template From 895c8574b9eef4f62a0168ca800582bc3ebc47db Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Wed, 2 Nov 2022 22:36:25 +0200 Subject: [PATCH 081/194] Added mising const --- Boolean_set_operations_2/include/CGAL/Polygon_set_2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Boolean_set_operations_2/include/CGAL/Polygon_set_2.h b/Boolean_set_operations_2/include/CGAL/Polygon_set_2.h index d986acfd860..d1c2305c2dd 100644 --- a/Boolean_set_operations_2/include/CGAL/Polygon_set_2.h +++ b/Boolean_set_operations_2/include/CGAL/Polygon_set_2.h @@ -58,7 +58,7 @@ public: {} /*! Constructor with traits object. */ - Polygon_set_2 (Traits_2& tr) : + Polygon_set_2 (const Traits_2& tr) : Base(tr) {} From 7c8eac05ce67acec75a33a77012a505a7a7c6401 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 3 Nov 2022 11:40:42 +0100 Subject: [PATCH 082/194] add cell_selector to flip_all_edges() --- .../internal/flip_edges.h | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/flip_edges.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/flip_edges.h index f849baea079..18c0c119109 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/flip_edges.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/flip_edges.h @@ -87,12 +87,13 @@ void update_c3t3_facets(C3t3& c3t3, } } -template +template Sliver_removal_result flip_3_to_2(typename C3t3::Edge& edge, C3t3& c3t3, const std::vector& vertices_around_edge, const Flip_Criterion& criterion, - IncCellsVectorMap& inc_cells) + IncCellsVectorMap& inc_cells, + Cell_selector& cell_selector) { typedef typename C3t3::Triangulation Tr; typedef typename C3t3::Facet Facet; @@ -323,7 +324,7 @@ Sliver_removal_result flip_3_to_2(typename C3t3::Edge& edge, // Update c3t3 update_c3t3_facets(c3t3, cells_to_update, outer_mirror_facets); - c3t3.remove_from_complex(cell_to_remove); + treat_before_delete(cell_to_remove, cell_selector, c3t3); tr.tds().delete_cell(cell_to_remove); /********************VALIDITY CHECK***************************/ @@ -703,11 +704,15 @@ void find_best_flip_to_improve_dh(C3t3& c3t3, } } -template +template Sliver_removal_result flip_n_to_m(C3t3& c3t3, typename C3t3::Edge& edge, typename C3t3::Vertex_handle vh, IncCellsVectorMap& inc_cells, + Cell_selector& cell_selector, Visitor& visitor, bool check_validity = false) { @@ -862,6 +867,7 @@ Sliver_removal_result flip_n_to_m(C3t3& c3t3, //Subdomain index? typename C3t3::Subdomain_index subdomain = to_remove[0]->subdomain_index(); + bool selected = get(m_cell_selector, to_remove[0]); visitor.before_flip(to_remove[0]); #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG @@ -882,7 +888,8 @@ Sliver_removal_result flip_n_to_m(C3t3& c3t3, new_cell->set_vertex(fi.second, vh); - c3t3.add_to_complex(new_cell, subdomain); + treat_new_cell(new_cell, subdomain, cell_selector, selected, c3t3); + visitor.after_flip(new_cell); cells_to_update.push_back(new_cell); } @@ -951,7 +958,7 @@ Sliver_removal_result flip_n_to_m(C3t3& c3t3, //Remove cells for (Cell_handle ch : to_remove) { - c3t3.remove_from_complex(ch); + treat_before_delete(ch, cell_selector, c3t3); tr.tds().delete_cell(ch); } @@ -1072,11 +1079,12 @@ Sliver_removal_result flip_n_to_m(typename C3t3::Edge& edge, return result; } -template +template Sliver_removal_result find_best_flip(typename C3t3::Edge& edge, C3t3& c3t3, const Flip_Criterion& criterion, IncCellsVectorMap& inc_cells, + Cell_selector& cell_selector, Visitor& visitor) { typedef typename C3t3::Triangulation Tr; @@ -1139,7 +1147,7 @@ Sliver_removal_result find_best_flip(typename C3t3::Edge& edge, { std::vector vertices; vertices.insert(vertices.end(), vertices_around_edge.begin(), vertices_around_edge.end()); - res = flip_3_to_2(edge, c3t3, vertices, criterion, inc_cells); + res = flip_3_to_2(edge, c3t3, vertices, criterion, inc_cells, cell_selector); } } else @@ -1151,7 +1159,7 @@ Sliver_removal_result find_best_flip(typename C3t3::Edge& edge, { std::vector vertices; vertices.insert(vertices.end(), boundary_vertices.begin(), boundary_vertices.end()); - res = flip_n_to_m(edge, c3t3, vertices, criterion, inc_cells, visitor); + res = flip_n_to_m(edge, c3t3, vertices, criterion, inc_cells, cell_selector, visitor); //return n_to_m_flip(edge, boundary_vertices, flip_criterion); } } @@ -1160,10 +1168,11 @@ Sliver_removal_result find_best_flip(typename C3t3::Edge& edge, } -template +template std::size_t flip_all_edges(const std::vector& edges, C3t3& c3t3, const Flip_Criterion& criterion, + Cell_selector& cell_selector, Visitor& visitor) { typedef typename C3t3::Triangulation Tr; @@ -1194,7 +1203,8 @@ std::size_t flip_all_edges(const std::vector& edges, { Edge edge(ch, i0, i1); - Sliver_removal_result res = find_best_flip(edge, c3t3, criterion, inc_cells, visitor); + Sliver_removal_result res + = find_best_flip(edge, c3t3, criterion, inc_cells, cell_selector, visitor); if (res == INVALID_CELL || res == INVALID_VERTEX || res == INVALID_ORIENTATION) { std::cout << "FLIP PROBLEM!!!!" << std::endl; @@ -1237,8 +1247,6 @@ void flip_edges(C3T3& c3t3, //const Flip_Criterion criterion = VALENCE_MIN_DH_BASED; - //collect long edges - //compute vertices normals map? // typedef typename C3T3::Surface_patch_index Surface_patch_index; @@ -1272,7 +1280,7 @@ void flip_edges(C3T3& c3t3, #ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE nb_flips = #endif - flip_all_edges(inside_edges, c3t3, MIN_ANGLE_BASED, visitor); + flip_all_edges(inside_edges, c3t3, MIN_ANGLE_BASED, cell_selector, visitor); //} #ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE From e4c7c2e6ec0ead4e3453890658473839c8a9f17b Mon Sep 17 00:00:00 2001 From: Mael Date: Fri, 4 Nov 2022 10:25:49 +0100 Subject: [PATCH 083/194] Add a depreciation message --- .../Policies/Edge_collapse/Count_ratio_stop_predicate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h index 5825ac62f5b..f4a5378489b 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h @@ -5,7 +5,7 @@ namespace Surface_mesh_simplification { /*! \ingroup PkgSurfaceMeshSimplificationRef -\deprecated +\deprecated This class is deprecated since \cgal 5.6, the class `Edge_count_ratio_stop_predicate` should be used instead. The class `Count_ratio_stop_predicate` is a model for the `StopPredicate` concept which returns `true` when the relation between the initial and current number of edges drops below a certain ratio. From d9a98ab2b81a9f4502213da6ea0a55b945991d7f Mon Sep 17 00:00:00 2001 From: Mael Date: Fri, 4 Nov 2022 10:26:34 +0100 Subject: [PATCH 084/194] Add a depreciation message --- .../Policies/Edge_collapse/Count_stop_predicate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h index 452302a0634..bef9e2fdba9 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h @@ -4,7 +4,7 @@ namespace Surface_mesh_simplification { /*! \ingroup PkgSurfaceMeshSimplificationRef -\deprecated +\deprecated This class is deprecated since \cgal 5.6, the class `Edge_count_stop_predicate` should be used instead. The class `Count_stop_predicate` is a model for the `StopPredicate` concept, which returns `true` when the number of current edges drops below a certain threshold. From a929b4af09b04cbd582f7f3045934f0c489e83ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 4 Nov 2022 10:45:50 +0100 Subject: [PATCH 085/194] Fix typo --- .../test/Surface_mesh_simplification/edge_collapse_topology.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_topology.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_topology.cpp index d52a8e1daa1..479a7687dda 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_topology.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_topology.cpp @@ -8,7 +8,7 @@ #include // Stop-condition policy -#include +#include typedef CGAL::Simple_cartesian Kernel; typedef CGAL::Polyhedron_3 Surface; From ab96b29f0c5e0ede6859690193bcb9eebf9bac7b Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 4 Nov 2022 11:16:09 +0100 Subject: [PATCH 086/194] cell_selector in flipping step --- .../CGAL/Tetrahedral_remeshing/internal/flip_edges.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/flip_edges.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/flip_edges.h index 18c0c119109..c6354b5e4ef 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/flip_edges.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/flip_edges.h @@ -867,7 +867,7 @@ Sliver_removal_result flip_n_to_m(C3t3& c3t3, //Subdomain index? typename C3t3::Subdomain_index subdomain = to_remove[0]->subdomain_index(); - bool selected = get(m_cell_selector, to_remove[0]); + bool selected = get(cell_selector, to_remove[0]); visitor.before_flip(to_remove[0]); #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG @@ -1015,12 +1015,13 @@ Sliver_removal_result flip_n_to_m(C3t3& c3t3, } -template +template Sliver_removal_result flip_n_to_m(typename C3t3::Edge& edge, C3t3& c3t3, const std::vector& boundary_vertices, const Flip_Criterion& criterion, IncCellsVectorMap& inc_cells, + CellSelector& cell_selector, Visitor& visitor) { typedef typename C3t3::Vertex_handle Vertex_handle; @@ -1069,7 +1070,8 @@ Sliver_removal_result flip_n_to_m(typename C3t3::Edge& edge, if (curr_max_cosdh <= curr_cost_vpair.first) return NO_BEST_CONFIGURATION; - result = flip_n_to_m(c3t3, edge, curr_cost_vpair.second.first, inc_cells, visitor); + result = flip_n_to_m(c3t3, edge, curr_cost_vpair.second.first, inc_cells, + cell_selector, visitor); if (result != NOT_FLIPPABLE) flip_performed = true; @@ -1231,7 +1233,7 @@ std::size_t flip_all_edges(const std::vector& edges, template void flip_edges(C3T3& c3t3, const bool protect_boundaries, - CellSelector cell_selector, + CellSelector& cell_selector, Visitor& visitor) { CGAL_USE(protect_boundaries); From dcf0ea09b32204bd6bc17c5f69c699bb60658536 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 4 Nov 2022 14:12:52 +0100 Subject: [PATCH 087/194] create normal_map when not already created before usage --- Point_set_3/include/CGAL/Point_set_3.h | 30 ++++++++++++++------------ 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Point_set_3/include/CGAL/Point_set_3.h b/Point_set_3/include/CGAL/Point_set_3.h index dbf00b0182b..a02ea9509bd 100644 --- a/Point_set_3/include/CGAL/Point_set_3.h +++ b/Point_set_3/include/CGAL/Point_set_3.h @@ -465,8 +465,8 @@ public: \note Properties of the added point other than its normal vector are initialized to their default value. - \note A normal property must have been added to the point set - before using this method. + \note If not already added, a normal property is automatically + added to the point set when using this method. \note If a reallocation happens, all iterators, pointers and references related to the container are invalidated. Otherwise, @@ -479,8 +479,7 @@ public: iterator insert (const Point& p, const Vector& n) { iterator out = insert (p); - CGAL_assertion(has_normal_map()); - m_normals[size()-1] = n; + normal_map()[size()-1] = n; return out; } @@ -550,17 +549,17 @@ public: /*! \brief returns a reference to the normal corresponding to `index`. - \note The normal property must have been added to the point set - before calling this method (see `add_normal_map()`). + \note If not already added, a normal property is automatically + added to the point set (see `add_normal_map()`). */ - Vector& normal (const Index& index) { return m_normals[index]; } + Vector& normal (const Index& index) { return normal_map()[index]; } /*! \brief returns a constant reference to the normal corresponding to `index`. - \note The normal property must have been added to the point set - before calling this method (see `add_normal_map()`). + \note If not already added, a normal property is automatically + added to the point set (see `add_normal_map()`). */ - const Vector& normal (const Index& index) const { return m_normals[index]; } + const Vector& normal (const Index& index) const { return normal_map()[index]; } /// @} @@ -869,11 +868,14 @@ public: /*! \brief returns the property map of the normal property. - \note The normal property must have been added to the point set - before calling this method (see `add_normal_map()`). + \note If the normal property has not been added yet to the point set + before calling this method, the property map is automatically added + with `add_normal_map()`. */ Vector_map normal_map () { + if (!m_normals) + add_normal_map(); return m_normals; } /*! @@ -982,7 +984,7 @@ public: inline parameters() const { return CGAL::parameters::point_map (m_points). - normal_map (m_normals). + normal_map (normal_map()). geom_traits (typename Kernel_traits::Kernel()); } @@ -1036,7 +1038,7 @@ public: */ Vector_range normals () const { - return this->range (m_normals); + return this->range (normal_map()); } /// @} From 9ed334bcf9c0178205c0099159aa2364eb6f2294 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 4 Nov 2022 14:27:09 +0100 Subject: [PATCH 088/194] now normal_map is always valid since it is created before it's used, when not available --- Point_set_3/include/CGAL/Point_set_3.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Point_set_3/include/CGAL/Point_set_3.h b/Point_set_3/include/CGAL/Point_set_3.h index a02ea9509bd..55d2f5bfa5a 100644 --- a/Point_set_3/include/CGAL/Point_set_3.h +++ b/Point_set_3/include/CGAL/Point_set_3.h @@ -1343,17 +1343,11 @@ struct Point_set_processing_3_np_helper, NamedParamet static const Normal_map get_normal_map(const Point_set_3& ps, const NamedParameters& np) { - CGAL_assertion_code( - if (!(parameters::is_default_parameter::value))) - CGAL_assertion(!!ps.normal_map()); return parameters::choose_parameter(parameters::get_parameter(np, internal_np::normal_map), ps.normal_map()); } static Normal_map get_normal_map(Point_set_3& ps, const NamedParameters& np) { - CGAL_assertion_code( - if (!(parameters::is_default_parameter::value))) - CGAL_assertion(!!ps.normal_map()); return parameters::choose_parameter(parameters::get_parameter(np, internal_np::normal_map), ps.normal_map()); } @@ -1362,11 +1356,9 @@ struct Point_set_processing_3_np_helper, NamedParamet return parameters::choose_parameter(parameters::get_parameter(np, internal_np::geom_traits)); } - static constexpr bool has_normal_map(const Point_set_3& ps, const NamedParameters& np) + static constexpr bool has_normal_map(const Point_set_3&, const NamedParameters&) { - using CGAL::parameters::is_default_parameter; - const bool np_has_normals = !(is_default_parameter::value); - return np_has_normals || !!ps.normal_map(); + return true;//either available in np, or in point set } }; From b8e96fef84316d2be45a6efe1ab3c055de129688 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 7 Nov 2022 09:11:19 +0000 Subject: [PATCH 089/194] Surface_mesh: Deal with PLY files with vertex and face color which is float instead of unsigned char --- .../include/CGAL/Surface_mesh/IO/PLY.h | 40 +++++++++++++++---- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h b/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h index 97ba5aed47b..0204a0ac701 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h @@ -289,10 +289,22 @@ public: if(m_vcolors == 3) { - unsigned char r, g, b; - element.assign(r, "red"); - element.assign(g, "green"); - element.assign(b, "blue"); + unsigned char r=0, g=0, b=0; + float rf=0, gf=0, bf=0; + if(element.has_property("red",r)) + { + element.assign(r, "red"); + element.assign(g, "green"); + element.assign(b, "blue"); + }else if(element.has_property("red", rf)) + { + element.assign(rf, "red"); + element.assign(gf, "green"); + element.assign(bf, "blue"); + r = std::floor(rf*255); + g = std::floor(gf*255); + b = std::floor(bf*255); + } m_vcolor_map[vi] = CGAL::IO::Color(r, g, b); } } @@ -331,10 +343,22 @@ public: if(m_fcolors == 3) { - unsigned char r, g, b; - element.assign(r, "red"); - element.assign(g, "green"); - element.assign(b, "blue"); + unsigned char r=0, g=0, b=0; + float rf=0, gf=0, bf=0; + if(element.has_property("red",r)) + { + element.assign(r, "red"); + element.assign(g, "green"); + element.assign(b, "blue"); + } else if(element.has_property("red", rf)) + { + element.assign(rf, "red"); + element.assign(gf, "green"); + element.assign(bf, "blue"); + r = std::floor(rf*255); + g = std::floor(gf*255); + b = std::floor(bf*255); + } m_fcolor_map[fi] = CGAL::IO::Color(r, g, b); } } From 3f9f7429b8f70eedc829b189339b2ad51cac43f2 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 7 Nov 2022 10:20:13 +0100 Subject: [PATCH 090/194] Update Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h Co-authored-by: Sebastien Loriot --- Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h b/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h index 0204a0ac701..ae1853a0a12 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h @@ -350,7 +350,7 @@ public: element.assign(r, "red"); element.assign(g, "green"); element.assign(b, "blue"); - } else if(element.has_property("red", rf)) + } else if(element.has_property("red", rf)) { element.assign(rf, "red"); element.assign(gf, "green"); From 1a226ed87705c4ae0cabc664dc74020ede52e8ca Mon Sep 17 00:00:00 2001 From: Sebastien Loriot Date: Mon, 7 Nov 2022 10:41:22 +0100 Subject: [PATCH 091/194] Restore [revious API --- BGL/include/CGAL/boost/graph/named_params_helper.h | 2 +- Point_set_3/include/CGAL/Point_set_3.h | 2 +- Point_set_processing_3/include/CGAL/IO/write_off_points.h | 2 +- Point_set_processing_3/include/CGAL/IO/write_ply_points.h | 2 +- Point_set_processing_3/include/CGAL/IO/write_xyz_points.h | 2 +- .../include/CGAL/bilateral_smooth_point_set.h | 2 +- .../include/CGAL/edge_aware_upsample_point_set.h | 2 +- Point_set_processing_3/include/CGAL/jet_estimate_normals.h | 2 +- Point_set_processing_3/include/CGAL/mst_orient_normals.h | 2 +- Point_set_processing_3/include/CGAL/pca_estimate_normals.h | 2 +- Point_set_processing_3/include/CGAL/scanline_orient_normals.h | 2 +- Point_set_processing_3/include/CGAL/structure_point_set.h | 2 +- Point_set_processing_3/include/CGAL/vcm_estimate_normals.h | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index e80cae78072..948de5dded6 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -336,7 +336,7 @@ struct Point_set_processing_3_np_helper return parameters::choose_parameter(parameters::get_parameter(np, internal_np::geom_traits)); } - static constexpr bool has_normal_map(const PointRange&, const NamedParameters&) + static constexpr bool has_normal_map() { using CGAL::parameters::is_default_parameter; return !(is_default_parameter::value); diff --git a/Point_set_3/include/CGAL/Point_set_3.h b/Point_set_3/include/CGAL/Point_set_3.h index 55d2f5bfa5a..6ca6be884d5 100644 --- a/Point_set_3/include/CGAL/Point_set_3.h +++ b/Point_set_3/include/CGAL/Point_set_3.h @@ -1356,7 +1356,7 @@ struct Point_set_processing_3_np_helper, NamedParamet return parameters::choose_parameter(parameters::get_parameter(np, internal_np::geom_traits)); } - static constexpr bool has_normal_map(const Point_set_3&, const NamedParameters&) + static constexpr bool has_normal_map() { return true;//either available in np, or in point set } diff --git a/Point_set_processing_3/include/CGAL/IO/write_off_points.h b/Point_set_processing_3/include/CGAL/IO/write_off_points.h index 2fb38456379..a3435090bb8 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_off_points.h @@ -46,7 +46,7 @@ bool write_OFF_PSP(std::ostream& os, typedef typename NP_helper::Const_point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - bool has_normals = NP_helper::has_normal_map(points, np); + bool has_normals = NP_helper::has_normal_map(); PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h index d151871a541..faad40b8f9a 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h @@ -201,7 +201,7 @@ bool write_PLY(std::ostream& os, typedef typename NP_helper::Const_point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - bool has_normals = NP_helper::has_normal_map(points, np); + bool has_normals = NP_helper::has_normal_map(np); PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h index b98ebb247df..73610c9545f 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h @@ -47,7 +47,7 @@ bool write_XYZ_PSP(std::ostream& os, typedef typename NP_helper::Const_point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - bool has_normals = NP_helper::has_normal_map(points, np); + bool has_normals = NP_helper::has_normal_map(); PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h index 5c1d2d7cf25..91147a5a6e5 100644 --- a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h @@ -278,7 +278,7 @@ bilateral_smooth_point_set( typedef typename Kernel::Point_3 Point_3; typedef typename Kernel::Vector_3 Vector_3; - CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); typedef typename Kernel::FT FT; diff --git a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h index 7bcb43eaf8f..eaafa1251eb 100644 --- a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h +++ b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h @@ -367,7 +367,7 @@ edge_aware_upsample_point_set( typedef typename NP_helper::Geom_traits Kernel; - CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); typedef typename Kernel::Point_3 Point; typedef typename Kernel::Vector_3 Vector; diff --git a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h index 092c479c53d..91b29879d1a 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -196,7 +196,7 @@ jet_estimate_normals( typedef typename Kernel::FT FT; typedef typename GetSvdTraits::type SvdTraits; - CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); CGAL_static_assertion_msg(!(boost::is_same::NoTraits>::value), "Error: no SVD traits"); diff --git a/Point_set_processing_3/include/CGAL/mst_orient_normals.h b/Point_set_processing_3/include/CGAL/mst_orient_normals.h index 18be66609e5..ff81bcb6305 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -631,7 +631,7 @@ mst_orient_normals( typedef typename NP_helper::Geom_traits Kernel; typedef typename Point_set_processing_3::GetIsConstrainedMap::type ConstrainedMap; - CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h index 9c4f5cde3e6..64a7a99dec0 100644 --- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h @@ -168,7 +168,7 @@ pca_estimate_normals( typedef typename NP_helper::Geom_traits Kernel; typedef typename Kernel::FT FT; - CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/scanline_orient_normals.h b/Point_set_processing_3/include/CGAL/scanline_orient_normals.h index 272ce021158..a1a8bdf5f8d 100644 --- a/Point_set_processing_3/include/CGAL/scanline_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/scanline_orient_normals.h @@ -478,7 +478,7 @@ void scanline_orient_normals (PointRange& points, const NamedParameters& np = pa ::type; using Fallback_scanline_ID = Boolean_tag::value>; - CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/structure_point_set.h b/Point_set_processing_3/include/CGAL/structure_point_set.h index 5930d4b08f0..72785255714 100644 --- a/Point_set_processing_3/include/CGAL/structure_point_set.h +++ b/Point_set_processing_3/include/CGAL/structure_point_set.h @@ -234,7 +234,7 @@ public: typedef typename Point_set_processing_3::GetPlaneMap::type PlaneMap; typedef typename Point_set_processing_3::GetPlaneIndexMap::type PlaneIndexMap; - CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); CGAL_static_assertion_msg((!is_default_parameter::value), "Error: no plane index map"); diff --git a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h index de0c26d68f6..afe5c3a2535 100644 --- a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h @@ -321,7 +321,7 @@ vcm_estimate_normals_internal (PointRange& points, typedef typename NP_helper::Geom_traits Kernel; typedef typename GetDiagonalizeTraits::type DiagonalizeTraits; - CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); From 04e4eec6fdbf91efcc1af3b9f778e024fe986610 Mon Sep 17 00:00:00 2001 From: Sebastien Loriot Date: Mon, 7 Nov 2022 10:44:02 +0100 Subject: [PATCH 092/194] reuse static assertions --- Point_set_processing_3/include/CGAL/IO/write_ply_points.h | 2 +- .../include/CGAL/bilateral_smooth_point_set.h | 2 +- .../include/CGAL/edge_aware_upsample_point_set.h | 2 +- Point_set_processing_3/include/CGAL/jet_estimate_normals.h | 2 +- Point_set_processing_3/include/CGAL/mst_orient_normals.h | 2 +- Point_set_processing_3/include/CGAL/pca_estimate_normals.h | 2 +- Point_set_processing_3/include/CGAL/scanline_orient_normals.h | 2 +- Point_set_processing_3/include/CGAL/structure_point_set.h | 2 +- Point_set_processing_3/include/CGAL/vcm_estimate_normals.h | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h index faad40b8f9a..38b361ff779 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h @@ -201,7 +201,7 @@ bool write_PLY(std::ostream& os, typedef typename NP_helper::Const_point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - bool has_normals = NP_helper::has_normal_map(np); + bool has_normals = NP_helper::has_normal_map(); PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h index 91147a5a6e5..86fa5d23b19 100644 --- a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h @@ -278,7 +278,7 @@ bilateral_smooth_point_set( typedef typename Kernel::Point_3 Point_3; typedef typename Kernel::Vector_3 Vector_3; - CGAL_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); typedef typename Kernel::FT FT; diff --git a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h index eaafa1251eb..507418d45b8 100644 --- a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h +++ b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h @@ -367,7 +367,7 @@ edge_aware_upsample_point_set( typedef typename NP_helper::Geom_traits Kernel; - CGAL_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); typedef typename Kernel::Point_3 Point; typedef typename Kernel::Vector_3 Vector; diff --git a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h index 91b29879d1a..da74d6e93ee 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -196,7 +196,7 @@ jet_estimate_normals( typedef typename Kernel::FT FT; typedef typename GetSvdTraits::type SvdTraits; - CGAL_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); CGAL_static_assertion_msg(!(boost::is_same::NoTraits>::value), "Error: no SVD traits"); diff --git a/Point_set_processing_3/include/CGAL/mst_orient_normals.h b/Point_set_processing_3/include/CGAL/mst_orient_normals.h index ff81bcb6305..909dc37a63d 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -631,7 +631,7 @@ mst_orient_normals( typedef typename NP_helper::Geom_traits Kernel; typedef typename Point_set_processing_3::GetIsConstrainedMap::type ConstrainedMap; - CGAL_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h index 64a7a99dec0..8447ae952ff 100644 --- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h @@ -168,7 +168,7 @@ pca_estimate_normals( typedef typename NP_helper::Geom_traits Kernel; typedef typename Kernel::FT FT; - CGAL_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/scanline_orient_normals.h b/Point_set_processing_3/include/CGAL/scanline_orient_normals.h index a1a8bdf5f8d..02f956f2416 100644 --- a/Point_set_processing_3/include/CGAL/scanline_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/scanline_orient_normals.h @@ -478,7 +478,7 @@ void scanline_orient_normals (PointRange& points, const NamedParameters& np = pa ::type; using Fallback_scanline_ID = Boolean_tag::value>; - CGAL_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/structure_point_set.h b/Point_set_processing_3/include/CGAL/structure_point_set.h index 72785255714..f0a9fc34c86 100644 --- a/Point_set_processing_3/include/CGAL/structure_point_set.h +++ b/Point_set_processing_3/include/CGAL/structure_point_set.h @@ -234,7 +234,7 @@ public: typedef typename Point_set_processing_3::GetPlaneMap::type PlaneMap; typedef typename Point_set_processing_3::GetPlaneIndexMap::type PlaneIndexMap; - CGAL_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); CGAL_static_assertion_msg((!is_default_parameter::value), "Error: no plane index map"); diff --git a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h index afe5c3a2535..5b69f3ef0f9 100644 --- a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h @@ -321,7 +321,7 @@ vcm_estimate_normals_internal (PointRange& points, typedef typename NP_helper::Geom_traits Kernel; typedef typename GetDiagonalizeTraits::type DiagonalizeTraits; - CGAL_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); From b609f5364b64740cb022102a18895360e42e2486 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 7 Nov 2022 12:19:16 +0100 Subject: [PATCH 093/194] remove duplicate include --- Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp index 999a81bc2cf..e35576fc98f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp @@ -60,12 +60,10 @@ #include #include #include -#include #include #include #include #include -#include #include #include From 57c6d59ddcef1fac903149ff3e3f5812191aca34 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 7 Nov 2022 12:20:14 +0100 Subject: [PATCH 094/194] add vtkNrrd reader to Io_image_plugin --- .../Plugins/Mesh_3/Io_image_plugin.cpp | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp index 72ef02c7c4c..826c4867696 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp @@ -65,7 +65,9 @@ #include #include #include +#include #endif + #include // Covariant return types don't work for scalar types and we cannot @@ -978,7 +980,8 @@ private Q_SLOTS: QString Io_image_plugin::nameFilters() const { return QString("Inrimage files (*.inr *.inr.gz) ;; " "Analyze files (*.hdr *.img *img.gz) ;; " - "Stanford Exploration Project files (*.H *.HH)"); + "Stanford Exploration Project files (*.H *.HH) ;; " + "NRRD image files (*.nrrd)"); } @@ -1011,7 +1014,23 @@ Io_image_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_scene) ok = true; QApplication::restoreOverrideCursor(); Image* image = new Image; - if(fileinfo.suffix() != "H" && fileinfo.suffix() != "HH" && + if (fileinfo.suffix() == "nrrd") + { +#ifdef CGAL_USE_VTK + vtkNew reader; + reader->SetFileName(fileinfo.filePath().toUtf8()); + reader->Update(); + auto vtk_image = reader->GetOutput(); + vtk_image->Print(std::cerr); + *image = CGAL::IO::read_vtk_image_data(vtk_image); // copy the image data +#else + CGAL::Three::Three::warning("You need VTK to read a NRRD file"); + CGAL_USE(dirname); + delete image; + return QList(); +#endif + } + else if(fileinfo.suffix() != "H" && fileinfo.suffix() != "HH" && !image->read(fileinfo.filePath().toUtf8())) { QMessageBox qmb(QMessageBox::NoIcon, From 41f1acc4650b897568a1333700a0e367c9a633e6 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 7 Nov 2022 12:41:53 +0100 Subject: [PATCH 095/194] reorder if/else conditions --- .../Plugins/Mesh_3/Io_image_plugin.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp index 826c4867696..7a3f29db756 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp @@ -1014,6 +1014,8 @@ Io_image_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_scene) ok = true; QApplication::restoreOverrideCursor(); Image* image = new Image; + + //read a nrrd file if (fileinfo.suffix() == "nrrd") { #ifdef CGAL_USE_VTK @@ -1030,6 +1032,15 @@ Io_image_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_scene) return QList(); #endif } + + //read a sep file + else if (fileinfo.suffix() == "H" || fileinfo.suffix() == "HH") + { + CGAL::SEP_to_ImageIO reader(fileinfo.filePath().toUtf8().data()); + *image = *reader.cgal_image(); + is_gray = true; + } + else if(fileinfo.suffix() != "H" && fileinfo.suffix() != "HH" && !image->read(fileinfo.filePath().toUtf8())) { @@ -1119,13 +1130,7 @@ Io_image_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_scene) return QList(); } } - //read a sep file - else if(fileinfo.suffix() == "H" || fileinfo.suffix() == "HH") - { - CGAL::SEP_to_ImageIO reader(fileinfo.filePath().toUtf8().data()); - *image = *reader.cgal_image(); - is_gray = true; - } + // Get display precision QDialog dialog; ui.setupUi(&dialog); From 26472284e4ee0ae551fbcf32bbfa663951242625 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 7 Nov 2022 12:47:35 +0100 Subject: [PATCH 096/194] the demo can now mesh images with any word type thanks to the new domain constructors that do not need to be defined explicitly a priori --- .../Plugins/Mesh_3/Mesh_3_plugin.cpp | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp index 6aa0571c8b9..ac61fa258e9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp @@ -374,27 +374,6 @@ boost::optional Mesh_3_plugin::get_items_or_return_error_string() const auto& image_item = image_mesh_items->image_item; item = image_item; features_protection_available = true; - - bool fit_wrdtp = true; - std::size_t img_wdim = image_item->image()->image()->wdim; - WORD_KIND img_wordKind = image_item->image()->image()->wordKind; - // check if the word type fits the hardcoded values in the plugin - if (image_item->isGray()) { - if (img_wordKind != WK_FLOAT) - fit_wrdtp = false; - else if (img_wdim != 4) - fit_wrdtp = false; - } else { - if (img_wordKind != WK_FIXED) - fit_wrdtp = false; - else if (img_wdim != 1) - fit_wrdtp = false; - } - if (!fit_wrdtp) { - return tr( - "Selected object can't be meshed because the image's word type is " - "not supported by this plugin."); - } } # endif From 07ebf4da2389345e53e900fa1fc39e449e987c30 Mon Sep 17 00:00:00 2001 From: Mael Date: Mon, 7 Nov 2022 13:12:49 +0100 Subject: [PATCH 097/194] Fix test --- Weights/test/Weights/include/wrappers.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Weights/test/Weights/include/wrappers.h b/Weights/test/Weights/include/wrappers.h index 94138e735df..2566a219a6c 100644 --- a/Weights/test/Weights/include/wrappers.h +++ b/Weights/test/Weights/include/wrappers.h @@ -70,7 +70,10 @@ struct Tangent_wrapper template FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { - return CGAL::Weights::half_tangent_weight(r, q, t, Kernel()) + + return CGAL::Weights::half_tangent_weight(CGAL::Weights::internal::distance(r, q), + CGAL::Weights::internal::distance(t, q), + CGAL::Weights::internal::area(r, q, t), + CGAL::Weights::internal::scalar_product(r, q, t)) + CGAL::Weights::half_tangent_weight(CGAL::Weights::internal::distance(r, q), CGAL::Weights::internal::distance(p, q), CGAL::Weights::internal::area(p, q, r), From 7a0fbcffd2cc1cb7b4acc3354379e3179374d33d Mon Sep 17 00:00:00 2001 From: Mael Date: Mon, 7 Nov 2022 14:03:54 +0100 Subject: [PATCH 098/194] Apply fixes from @sloriot Co-authored-by: Sebastien Loriot --- .../Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h | 2 +- .../Policies/Edge_collapse/Face_count_ratio_stop_predicate.h | 4 ++-- .../Policies/Edge_collapse/Face_count_ratio_stop_predicate.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h index 31da80779c6..fed8537304f 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_count_ratio_stop_predicate.h @@ -12,7 +12,7 @@ which returns `true` when the relation between the initial and current number of \tparam TriangleMesh is the type of surface mesh being simplified, and must be a model of the `MutableFaceGraph` and `HalfedgeListGraph` concepts. -\sa `CGAL::Surface_mesh_simplification::Edge_count_ratio_stop_predicate` +\sa `CGAL::Surface_mesh_simplification::Edge_count_stop_predicate` \sa `CGAL::Surface_mesh_simplification::Face_count_ratio_stop_predicate` */ template< typename TriangleMesh> diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h index 82cfdf2e62e..f5154aeb0d8 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h @@ -8,12 +8,12 @@ namespace Surface_mesh_simplification { \cgalModels `StopPredicate` The class `Face_count_ratio_stop_predicate` is a model for the `StopPredicate` concept -which returns `true` when the relation between the initial and current number of edges drops below a certain ratio. +which returns `true` when the relation between the initial and current number of faces drops below a certain ratio. \tparam TriangleMesh is the type of surface mesh being simplified, and must be a model of the `MutableFaceGraph` and `HalfedgeListGraph` concepts. \sa `CGAL::Surface_mesh_simplification::Edge_count_ratio_stop_predicate` -\sa `CGAL::Surface_mesh_simplification::Face_count_ratio_stop_predicate` +\sa `CGAL::Surface_mesh_simplification::Face_count_stop_predicate` */ template< typename TriangleMesh> class Face_count_ratio_stop_predicate diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h index e21db25c3a0..d349c948181 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Face_count_ratio_stop_predicate.h @@ -20,7 +20,7 @@ namespace CGAL { namespace Surface_mesh_simplification { -// Stops when the ratio of initial to current number of edges is below some value. +// Stops when the ratio of initial to current number of faces is below some value. template class Face_count_ratio_stop_predicate { From 56244a493f0ae7efd00837cd5cbad363cc104d8e Mon Sep 17 00:00:00 2001 From: Mael Date: Mon, 7 Nov 2022 13:12:49 +0100 Subject: [PATCH 099/194] Fix test --- Weights/test/Weights/include/wrappers.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Weights/test/Weights/include/wrappers.h b/Weights/test/Weights/include/wrappers.h index 94138e735df..2566a219a6c 100644 --- a/Weights/test/Weights/include/wrappers.h +++ b/Weights/test/Weights/include/wrappers.h @@ -70,7 +70,10 @@ struct Tangent_wrapper template FT weight_b(const Point& t, const Point& r, const Point& p, const Point& q) const { - return CGAL::Weights::half_tangent_weight(r, q, t, Kernel()) + + return CGAL::Weights::half_tangent_weight(CGAL::Weights::internal::distance(r, q), + CGAL::Weights::internal::distance(t, q), + CGAL::Weights::internal::area(r, q, t), + CGAL::Weights::internal::scalar_product(r, q, t)) + CGAL::Weights::half_tangent_weight(CGAL::Weights::internal::distance(r, q), CGAL::Weights::internal::distance(p, q), CGAL::Weights::internal::area(p, q, r), From a24c6ac84c90b966a3a33ea58f6a3678f67dea7b Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 7 Nov 2022 14:13:18 +0100 Subject: [PATCH 100/194] Apply suggestions from Mael's code review Co-authored-by: Mael --- Point_set_3/include/CGAL/Point_set_3.h | 2 +- Point_set_processing_3/include/CGAL/IO/read_ply_points.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Point_set_3/include/CGAL/Point_set_3.h b/Point_set_3/include/CGAL/Point_set_3.h index 6ca6be884d5..76f261949ad 100644 --- a/Point_set_3/include/CGAL/Point_set_3.h +++ b/Point_set_3/include/CGAL/Point_set_3.h @@ -1358,7 +1358,7 @@ struct Point_set_processing_3_np_helper, NamedParamet static constexpr bool has_normal_map() { - return true;//either available in np, or in point set + return true; // either available in named parameters, and always available in Point_set_3 otherwise } }; diff --git a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h index 5a38b4fd034..e52a2758f0f 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h @@ -264,8 +264,8 @@ bool read_PLY(std::istream& is, NormalMap normal_map = NP_helper::get_normal_map(np); return read_PLY_with_properties(is, output, - make_ply_point_reader(point_map), - make_ply_normal_reader(normal_map)); + make_ply_point_reader(point_map), + make_ply_normal_reader(normal_map)); } /** From 6555faf73f3b2b7dbf0ca81c5802ef9f7625ee17 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 7 Nov 2022 14:14:16 +0100 Subject: [PATCH 101/194] this is only for ranges, not for Point_set_3 --- Point_set_processing_3/include/CGAL/IO/read_off_points.h | 2 -- Point_set_processing_3/include/CGAL/IO/read_ply_points.h | 2 -- Point_set_processing_3/include/CGAL/IO/read_xyz_points.h | 2 -- 3 files changed, 6 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Point_set_processing_3/include/CGAL/IO/read_off_points.h index 7ef015cc018..01a7138eb5b 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_off_points.h @@ -98,8 +98,6 @@ bool read_OFF(std::istream& is, typedef typename NP_helper::Geom_traits Kernel; typedef typename Kernel::FT FT; - //the default value for normal map, if not provided in the np, - // is a dummy Constant_property_map PointMap point_map = NP_helper::get_point_map(np); NormalMap normal_map = NP_helper::get_normal_map(np); diff --git a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h index 5a38b4fd034..dd780cc6436 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h @@ -258,8 +258,6 @@ bool read_PLY(std::istream& is, typedef typename NP_helper::Point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - //the default value for normal map, if not provided in the np, - // is a dummy Constant_property_map PointMap point_map = NP_helper::get_point_map(np); NormalMap normal_map = NP_helper::get_normal_map(np); diff --git a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h index d2a7f178992..29e48e25918 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h @@ -90,8 +90,6 @@ bool read_XYZ(std::istream& is, typedef typename NP_helper::Normal_map NormalMap; typedef typename NP_helper::Geom_traits Kernel; - //the default value for normal map, if not provided in the np, - // is a dummy Constant_property_map PointMap point_map = NP_helper::get_point_map(np); NormalMap normal_map = NP_helper::get_normal_map(np); From 32486e4be871aa2380e570e746912cf38c02b59d Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 7 Nov 2022 14:14:30 +0100 Subject: [PATCH 102/194] precise default normal --- Point_set_3/include/CGAL/Point_set_3.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Point_set_3/include/CGAL/Point_set_3.h b/Point_set_3/include/CGAL/Point_set_3.h index 55d2f5bfa5a..fc1da7fe601 100644 --- a/Point_set_3/include/CGAL/Point_set_3.h +++ b/Point_set_3/include/CGAL/Point_set_3.h @@ -466,7 +466,8 @@ public: are initialized to their default value. \note If not already added, a normal property is automatically - added to the point set when using this method. + added to the point set when using this method. The default value + for normal vectors is `CGAL::NULL_VECTOR`. \note If a reallocation happens, all iterators, pointers and references related to the container are invalidated. Otherwise, From 0a43b5ff7de697c25a7641878495f74f9c19e865 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 7 Nov 2022 14:55:17 +0100 Subject: [PATCH 103/194] has_normals is const --- Point_set_processing_3/include/CGAL/IO/write_off_points.h | 2 +- Point_set_processing_3/include/CGAL/IO/write_ply_points.h | 2 +- Point_set_processing_3/include/CGAL/IO/write_xyz_points.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/IO/write_off_points.h b/Point_set_processing_3/include/CGAL/IO/write_off_points.h index a3435090bb8..379f4afd0bc 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_off_points.h @@ -46,7 +46,7 @@ bool write_OFF_PSP(std::ostream& os, typedef typename NP_helper::Const_point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - bool has_normals = NP_helper::has_normal_map(); + const bool has_normals = NP_helper::has_normal_map(); PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h index 38b361ff779..ae47bf501fd 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h @@ -201,7 +201,7 @@ bool write_PLY(std::ostream& os, typedef typename NP_helper::Const_point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - bool has_normals = NP_helper::has_normal_map(); + const bool has_normals = NP_helper::has_normal_map(); PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h index 73610c9545f..06f77c4b419 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h @@ -47,7 +47,7 @@ bool write_XYZ_PSP(std::ostream& os, typedef typename NP_helper::Const_point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - bool has_normals = NP_helper::has_normal_map(); + const bool has_normals = NP_helper::has_normal_map(); PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); From 2b41ebaaaa459592ba0817c1f42b36a2a500abc4 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 7 Nov 2022 15:45:58 +0100 Subject: [PATCH 104/194] 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 105/194] 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 38fd07dfc45d36868771336da5600b8a1e0937b5 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 8 Nov 2022 10:24:43 +0100 Subject: [PATCH 106/194] differentiate has_normal_map() between const and non-const point set --- BGL/include/CGAL/boost/graph/named_params_helper.h | 2 +- Point_set_3/include/CGAL/Point_set_3.h | 11 +++++++++-- .../include/CGAL/IO/write_off_points.h | 2 +- .../include/CGAL/IO/write_ply_points.h | 2 +- .../include/CGAL/IO/write_xyz_points.h | 2 +- .../include/CGAL/bilateral_smooth_point_set.h | 2 +- .../include/CGAL/edge_aware_upsample_point_set.h | 2 +- .../include/CGAL/jet_estimate_normals.h | 2 +- .../include/CGAL/mst_orient_normals.h | 2 +- .../include/CGAL/pca_estimate_normals.h | 2 +- .../include/CGAL/scanline_orient_normals.h | 2 +- .../include/CGAL/structure_point_set.h | 2 +- .../include/CGAL/vcm_estimate_normals.h | 2 +- 13 files changed, 21 insertions(+), 14 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index 948de5dded6..e80cae78072 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -336,7 +336,7 @@ struct Point_set_processing_3_np_helper return parameters::choose_parameter(parameters::get_parameter(np, internal_np::geom_traits)); } - static constexpr bool has_normal_map() + static constexpr bool has_normal_map(const PointRange&, const NamedParameters&) { using CGAL::parameters::is_default_parameter; return !(is_default_parameter::value); diff --git a/Point_set_3/include/CGAL/Point_set_3.h b/Point_set_3/include/CGAL/Point_set_3.h index 539c75e7db6..5a833713161 100644 --- a/Point_set_3/include/CGAL/Point_set_3.h +++ b/Point_set_3/include/CGAL/Point_set_3.h @@ -1357,11 +1357,18 @@ struct Point_set_processing_3_np_helper, NamedParamet return parameters::choose_parameter(parameters::get_parameter(np, internal_np::geom_traits)); } - static constexpr bool has_normal_map() + static bool has_normal_map(const Point_set_3& ps, const NamedParameters&) + { + if (ps.has_normal_map()) + return true; + using CGAL::parameters::is_default_parameter; + return !(is_default_parameter::value); + } + + static constexpr bool has_normal_map(Point_set_3& ps, const NamedParameters&) { return true; // either available in named parameters, and always available in Point_set_3 otherwise } - }; /// \endcond diff --git a/Point_set_processing_3/include/CGAL/IO/write_off_points.h b/Point_set_processing_3/include/CGAL/IO/write_off_points.h index 379f4afd0bc..1ae7746e301 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_off_points.h @@ -46,7 +46,7 @@ bool write_OFF_PSP(std::ostream& os, typedef typename NP_helper::Const_point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - const bool has_normals = NP_helper::has_normal_map(); + const bool has_normals = NP_helper::has_normal_map(points, np); PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h index ae47bf501fd..897f1bbd089 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h @@ -201,7 +201,7 @@ bool write_PLY(std::ostream& os, typedef typename NP_helper::Const_point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - const bool has_normals = NP_helper::has_normal_map(); + const bool has_normals = NP_helper::has_normal_map(points, np); PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h index 06f77c4b419..45b351d18f0 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h @@ -47,7 +47,7 @@ bool write_XYZ_PSP(std::ostream& os, typedef typename NP_helper::Const_point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - const bool has_normals = NP_helper::has_normal_map(); + const bool has_normals = NP_helper::has_normal_map(points, np); PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h index 86fa5d23b19..5c1d2d7cf25 100644 --- a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h @@ -278,7 +278,7 @@ bilateral_smooth_point_set( typedef typename Kernel::Point_3 Point_3; typedef typename Kernel::Vector_3 Vector_3; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); typedef typename Kernel::FT FT; diff --git a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h index 507418d45b8..5c6ab8f9139 100644 --- a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h +++ b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h @@ -367,7 +367,7 @@ edge_aware_upsample_point_set( typedef typename NP_helper::Geom_traits Kernel; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion(NP_helper::has_normal_map(points, np), "Error: no normal map"); typedef typename Kernel::Point_3 Point; typedef typename Kernel::Vector_3 Vector; diff --git a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h index da74d6e93ee..1bd1b57e0e9 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -196,7 +196,7 @@ jet_estimate_normals( typedef typename Kernel::FT FT; typedef typename GetSvdTraits::type SvdTraits; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion(NP_helper::has_normal_map(points, np), "Error: no normal map"); CGAL_static_assertion_msg(!(boost::is_same::NoTraits>::value), "Error: no SVD traits"); diff --git a/Point_set_processing_3/include/CGAL/mst_orient_normals.h b/Point_set_processing_3/include/CGAL/mst_orient_normals.h index 909dc37a63d..f5c366c6f7f 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -631,7 +631,7 @@ mst_orient_normals( typedef typename NP_helper::Geom_traits Kernel; typedef typename Point_set_processing_3::GetIsConstrainedMap::type ConstrainedMap; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion(NP_helper::has_normal_map(points, np), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h index 8447ae952ff..42718e38177 100644 --- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h @@ -168,7 +168,7 @@ pca_estimate_normals( typedef typename NP_helper::Geom_traits Kernel; typedef typename Kernel::FT FT; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion(NP_helper::has_normal_map(points, np), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/scanline_orient_normals.h b/Point_set_processing_3/include/CGAL/scanline_orient_normals.h index 02f956f2416..da232f97961 100644 --- a/Point_set_processing_3/include/CGAL/scanline_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/scanline_orient_normals.h @@ -478,7 +478,7 @@ void scanline_orient_normals (PointRange& points, const NamedParameters& np = pa ::type; using Fallback_scanline_ID = Boolean_tag::value>; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion(NP_helper::has_normal_map(points, np), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/structure_point_set.h b/Point_set_processing_3/include/CGAL/structure_point_set.h index f0a9fc34c86..e4054c0d11c 100644 --- a/Point_set_processing_3/include/CGAL/structure_point_set.h +++ b/Point_set_processing_3/include/CGAL/structure_point_set.h @@ -234,7 +234,7 @@ public: typedef typename Point_set_processing_3::GetPlaneMap::type PlaneMap; typedef typename Point_set_processing_3::GetPlaneIndexMap::type PlaneIndexMap; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion(NP_helper::has_normal_map(points, np), "Error: no normal map"); CGAL_static_assertion_msg((!is_default_parameter::value), "Error: no plane index map"); diff --git a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h index 5b69f3ef0f9..689bb2df132 100644 --- a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h @@ -321,7 +321,7 @@ vcm_estimate_normals_internal (PointRange& points, typedef typename NP_helper::Geom_traits Kernel; typedef typename GetDiagonalizeTraits::type DiagonalizeTraits; - CGAL_static_assertion_msg(NP_helper::has_normal_map(), "Error: no normal map"); + CGAL_assertion(NP_helper::has_normal_map(points, np), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); From bccf3990f90d254c50889f643ce4e7cbae9de9f7 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 8 Nov 2022 10:51:46 +0100 Subject: [PATCH 107/194] fix compilation --- .../include/CGAL/edge_aware_upsample_point_set.h | 2 +- Point_set_processing_3/include/CGAL/jet_estimate_normals.h | 2 +- Point_set_processing_3/include/CGAL/mst_orient_normals.h | 2 +- Point_set_processing_3/include/CGAL/pca_estimate_normals.h | 2 +- Point_set_processing_3/include/CGAL/scanline_orient_normals.h | 2 +- Point_set_processing_3/include/CGAL/structure_point_set.h | 2 +- Point_set_processing_3/include/CGAL/vcm_estimate_normals.h | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h index 5c6ab8f9139..7bcb43eaf8f 100644 --- a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h +++ b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h @@ -367,7 +367,7 @@ edge_aware_upsample_point_set( typedef typename NP_helper::Geom_traits Kernel; - CGAL_assertion(NP_helper::has_normal_map(points, np), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); typedef typename Kernel::Point_3 Point; typedef typename Kernel::Vector_3 Vector; diff --git a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h index 1bd1b57e0e9..092c479c53d 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -196,7 +196,7 @@ jet_estimate_normals( typedef typename Kernel::FT FT; typedef typename GetSvdTraits::type SvdTraits; - CGAL_assertion(NP_helper::has_normal_map(points, np), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); CGAL_static_assertion_msg(!(boost::is_same::NoTraits>::value), "Error: no SVD traits"); diff --git a/Point_set_processing_3/include/CGAL/mst_orient_normals.h b/Point_set_processing_3/include/CGAL/mst_orient_normals.h index f5c366c6f7f..18be66609e5 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -631,7 +631,7 @@ mst_orient_normals( typedef typename NP_helper::Geom_traits Kernel; typedef typename Point_set_processing_3::GetIsConstrainedMap::type ConstrainedMap; - CGAL_assertion(NP_helper::has_normal_map(points, np), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h index 42718e38177..9c4f5cde3e6 100644 --- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h @@ -168,7 +168,7 @@ pca_estimate_normals( typedef typename NP_helper::Geom_traits Kernel; typedef typename Kernel::FT FT; - CGAL_assertion(NP_helper::has_normal_map(points, np), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/scanline_orient_normals.h b/Point_set_processing_3/include/CGAL/scanline_orient_normals.h index da232f97961..272ce021158 100644 --- a/Point_set_processing_3/include/CGAL/scanline_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/scanline_orient_normals.h @@ -478,7 +478,7 @@ void scanline_orient_normals (PointRange& points, const NamedParameters& np = pa ::type; using Fallback_scanline_ID = Boolean_tag::value>; - CGAL_assertion(NP_helper::has_normal_map(points, np), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/structure_point_set.h b/Point_set_processing_3/include/CGAL/structure_point_set.h index e4054c0d11c..5930d4b08f0 100644 --- a/Point_set_processing_3/include/CGAL/structure_point_set.h +++ b/Point_set_processing_3/include/CGAL/structure_point_set.h @@ -234,7 +234,7 @@ public: typedef typename Point_set_processing_3::GetPlaneMap::type PlaneMap; typedef typename Point_set_processing_3::GetPlaneIndexMap::type PlaneIndexMap; - CGAL_assertion(NP_helper::has_normal_map(points, np), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); CGAL_static_assertion_msg((!is_default_parameter::value), "Error: no plane index map"); diff --git a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h index 689bb2df132..de0c26d68f6 100644 --- a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h @@ -321,7 +321,7 @@ vcm_estimate_normals_internal (PointRange& points, typedef typename NP_helper::Geom_traits Kernel; typedef typename GetDiagonalizeTraits::type DiagonalizeTraits; - CGAL_assertion(NP_helper::has_normal_map(points, np), "Error: no normal map"); + CGAL_assertion_msg(NP_helper::has_normal_map(points, np), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); From f0443a6ab33bf9dec3860937568f7921cee1ca94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 8 Nov 2022 14:43:19 +0100 Subject: [PATCH 108/194] Rework as to not break the Surface_mesh_deformation weight concept --- .../include/CGAL/Surface_mesh_deformation.h | 19 ++-- .../include/CGAL/Weights/cotangent_weights.h | 106 ++++++++++-------- 2 files changed, 67 insertions(+), 58 deletions(-) diff --git a/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h b/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h index a715accf733..a536e13ddae 100644 --- a/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h +++ b/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h @@ -86,8 +86,7 @@ struct Types_selectors; template struct Types_selectors { - typedef SC_on_the_fly_pmap Wrapped_VertexPointMap; - typedef CGAL::Weights::Single_cotangent_weight Weight_calculator; + typedef CGAL::Weights::Single_cotangent_weight Weight_calculator; struct ARAP_visitor { @@ -107,8 +106,7 @@ struct Types_selectors template struct Types_selectors { - typedef SC_on_the_fly_pmap Wrapped_VertexPointMap; - typedef CGAL::Weights::Cotangent_weight Weight_calculator; + typedef CGAL::Weights::Cotangent_weight Weight_calculator; typedef typename Types_selectors::ARAP_visitor ARAP_visitor; }; @@ -116,8 +114,7 @@ struct Types_selectors template struct Types_selectors { - typedef SC_on_the_fly_pmap Wrapped_VertexPointMap; - typedef CGAL::Weights::Cotangent_weight Weight_calculator; + typedef CGAL::Weights::Cotangent_weight Weight_calculator; class ARAP_visitor { @@ -384,7 +381,7 @@ public: vertex_index_map, hedge_index_map, vertex_point_map, - Weight_calculator(triangle_mesh, internal::SC_on_the_fly_pmap(vertex_point_map))) + Weight_calculator()) { } Surface_mesh_deformation(Triangle_mesh& triangle_mesh, @@ -437,9 +434,10 @@ public: private: void init() { + typedef internal::SC_on_the_fly_pmap Wrapper; hedge_weight.reserve(num_halfedges(m_triangle_mesh)); for(halfedge_descriptor he : halfedges(m_triangle_mesh)) - hedge_weight.push_back(this->weight_calculator(he)); + hedge_weight.push_back(this->weight_calculator(he, m_triangle_mesh, Wrapper(vertex_point_map))); arap_visitor.init(m_triangle_mesh, vertex_point_map); } @@ -823,6 +821,7 @@ public: */ void overwrite_initial_geometry() { + typedef internal::SC_on_the_fly_pmap Wrapper; if(roi.empty()) { return; } // no ROI to overwrite region_of_solution(); // the roi should be preprocessed since we are using original_position vec @@ -843,13 +842,13 @@ public: std::size_t id_e = id(he); if(is_weight_computed[id_e]) { continue; } - hedge_weight[id_e] = weight_calculator(he); + hedge_weight[id_e] = weight_calculator(he, m_triangle_mesh, Wrapper(vertex_point_map)); is_weight_computed[id_e] = true; halfedge_descriptor e_opp = opposite(he, m_triangle_mesh); std::size_t id_e_opp = id(e_opp); - hedge_weight[id_e_opp] = weight_calculator(e_opp); + hedge_weight[id_e_opp] = weight_calculator(e_opp, m_triangle_mesh, Wrapper(vertex_point_map)); is_weight_computed[id_e_opp] = true; } } diff --git a/Weights/include/CGAL/Weights/cotangent_weights.h b/Weights/include/CGAL/Weights/cotangent_weights.h index d462c3f5174..89af4fa88d4 100644 --- a/Weights/include/CGAL/Weights/cotangent_weights.h +++ b/Weights/include/CGAL/Weights/cotangent_weights.h @@ -147,44 +147,38 @@ typename Kernel::FT cotangent_weight(const CGAL::Point_3& p0, // For border edges it returns zero. // This version is currently used in: // Surface_mesh_deformation -> Surface_mesh_deformation.h -template::value_type>::type> +template class Single_cotangent_weight { using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - using Point_ref = typename boost::property_traits::reference; - using FT = typename GeomTraits::FT; - -private: - const PolygonMesh& m_pmesh; - const VertexPointMap m_vpm; - const GeomTraits m_traits; - public: - Single_cotangent_weight(const PolygonMesh& pmesh, - const VertexPointMap vpm, - const GeomTraits& traits = GeomTraits()) - : m_pmesh(pmesh), m_vpm(vpm), m_traits(traits) - { } - - decltype(auto) operator()(const halfedge_descriptor he) const + // Returns the cotangent of the opposite angle of the edge + // 0 for border edges (which does not have an opposite angle). + template + auto operator()(halfedge_descriptor he, + PolygonMesh& pmesh, + VPM vpm) { - if (is_border(he, m_pmesh)) + using Point = typename boost::property_traits::value_type; + using Point_ref = typename boost::property_traits::reference; + + using GeomTraits = typename Kernel_traits::type; + using FT = typename GeomTraits::FT; + + if(is_border(he, pmesh)) return FT{0}; - const vertex_descriptor v0 = target(he, m_pmesh); - const vertex_descriptor v1 = source(he, m_pmesh); - const vertex_descriptor v2 = target(next(he, m_pmesh), m_pmesh); + const vertex_descriptor v0 = target(he, pmesh); + const vertex_descriptor v1 = source(he, pmesh); + const vertex_descriptor v2 = target(next(he, pmesh), pmesh); - const Point_ref p0 = get(m_vpm, v0); - const Point_ref p1 = get(m_vpm, v1); - const Point_ref p2 = get(m_vpm, v2); + const Point_ref p0 = get(vpm, v0); + const Point_ref p1 = get(vpm, v1); + const Point_ref p2 = get(vpm, v2); - return cotangent_3(p0, p2, p1, m_traits); + return cotangent(p0, p2, p1); } }; @@ -200,7 +194,7 @@ public: // Surface_mesh_parameterizer -> Orbifold_Tutte_parameterizer_3.h (default version) // Surface_mesh_skeletonization -> Mean_curvature_flow_skeletonization.h (clamped version) template::type, typename GeomTraits = typename Kernel_traits< typename boost::property_traits::value_type>::type> class Cotangent_weight @@ -208,11 +202,10 @@ class Cotangent_weight using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - using Point_ref = typename boost::property_traits::reference; using FT = typename GeomTraits::FT; private: - const PolygonMesh& m_pmesh; + PolygonMesh* const* m_pmesh_ptr; const VertexPointMap m_vpm; const GeomTraits m_traits; @@ -220,33 +213,33 @@ private: bool m_bound_from_below; public: - Cotangent_weight(const PolygonMesh& pmesh, - const VertexPointMap vpm, - const GeomTraits& traits = GeomTraits(), - const bool use_clamped_version = false, - const bool bound_from_below = true) - : m_pmesh(pmesh), m_vpm(vpm), m_traits(traits), - m_use_clamped_version(use_clamped_version), - m_bound_from_below(bound_from_below) + // Surface_mesh_deformation has its own API locked by the concept SurfaceMeshDeformationWeights + Cotangent_weight() + : m_pmesh_ptr(nullptr), m_vpm(), m_traits(), m_use_clamped_version(false), m_bound_from_below(true) { } - decltype(auto) operator()(const halfedge_descriptor he) const + template + FT operator()(const halfedge_descriptor he, + const PolygonMesh& pmesh, + const VPM vpm) const { - if(is_border(he, m_pmesh)) + using Point_ref = typename boost::property_traits::reference; + + if(is_border(he, pmesh)) return FT{0}; auto half_weight = [&] (const halfedge_descriptor he) -> FT { - if(is_border(he, m_pmesh)) + if(is_border(he, pmesh)) return FT{0}; - const vertex_descriptor v0 = target(he, m_pmesh); - const vertex_descriptor v1 = source(he, m_pmesh); - const vertex_descriptor v2 = target(next(he, m_pmesh), m_pmesh); + const vertex_descriptor v0 = target(he, pmesh); + const vertex_descriptor v1 = source(he, pmesh); + const vertex_descriptor v2 = target(next(he, pmesh), pmesh); - const Point_ref p0 = get(m_vpm, v0); - const Point_ref p1 = get(m_vpm, v1); - const Point_ref p2 = get(m_vpm, v2); + const Point_ref p0 = get(vpm, v0); + const Point_ref p1 = get(vpm, v1); + const Point_ref p2 = get(vpm, v2); FT weight = 0; if (m_use_clamped_version) @@ -260,9 +253,26 @@ public: return weight / FT(2); }; - FT weight = half_weight(he) + half_weight(opposite(he, m_pmesh)); + FT weight = half_weight(he) + half_weight(opposite(he, pmesh)); return weight; } + +public: + Cotangent_weight(const PolygonMesh& pmesh, + const VertexPointMap vpm, + const GeomTraits& traits = GeomTraits(), + const bool use_clamped_version = false, + const bool bound_from_below = true) + : m_pmesh_ptr(&pmesh), m_vpm(vpm), m_traits(traits), + m_use_clamped_version(use_clamped_version), + m_bound_from_below(bound_from_below) + { } + + FT operator()(const halfedge_descriptor he) const + { + CGAL_precondition(m_pmesh_ptr != nullptr); + return this->operator()(he, *m_pmesh_ptr, m_vpm); + } }; // Undocumented cotangent weight class. From 72fdfbeb1846b5b125b7bdb58bdc6c81a6d17bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 8 Nov 2022 14:44:57 +0100 Subject: [PATCH 109/194] Some const correctness + don't take pmaps by ref --- .../Weights/internal/pmp_weights_deprecated.h | 97 +++++++++---------- 1 file changed, 47 insertions(+), 50 deletions(-) diff --git a/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h b/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h index 7a7cd14a4c2..40984d8bc0f 100644 --- a/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h +++ b/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h @@ -51,7 +51,7 @@ struct Cotangent_value_Meyer_impl double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2, - const VertexPointMap& ppmap) + VertexPointMap ppmap) { typedef typename Kernel_traits< typename boost::property_traits::value_type >::Kernel::Vector_3 Vector; @@ -94,17 +94,17 @@ protected: typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel::Vector_3 Vector; - PolygonMesh& pmesh_; + const PolygonMesh& pmesh_; Point_property_map ppmap_; public: - Cotangent_value_Meyer(PolygonMesh& pmesh_, + Cotangent_value_Meyer(const PolygonMesh& pmesh_, VertexPointMap vpmap_) : pmesh_(pmesh_), ppmap_(vpmap_) { } - PolygonMesh& pmesh() { return pmesh_; } - Point_property_map& ppmap() { return ppmap_; } + const PolygonMesh& pmesh() { return pmesh_; } + Point_property_map ppmap() { return ppmap_; } double operator()(vertex_descriptor v0, vertex_descriptor v1, @@ -128,13 +128,13 @@ class Cotangent_value_Meyer_secure Point_property_map ppmap_; public: - Cotangent_value_Meyer_secure(PolygonMesh& pmesh_, + Cotangent_value_Meyer_secure(const PolygonMesh& pmesh_, VertexPointMap vpmap_) : pmesh_(pmesh_), ppmap_(vpmap_) { } - PolygonMesh& pmesh() { return pmesh_; } - Point_property_map& ppmap() { return ppmap_; } + const PolygonMesh& pmesh() { return pmesh_; } + Point_property_map ppmap() { return ppmap_; } double operator()(vertex_descriptor v0, vertex_descriptor v1, @@ -165,13 +165,13 @@ class Cotangent_value_clamped : CotangentValue Cotangent_value_clamped() { } public: - Cotangent_value_clamped(PolygonMesh& pmesh_, + Cotangent_value_clamped(const PolygonMesh& pmesh_, VertexPointMap vpmap_) : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { return CotangentValue::pmesh(); } - VertexPointMap& ppmap() { return CotangentValue::ppmap(); } + const PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -194,13 +194,13 @@ class Cotangent_value_clamped_2 : CotangentValue Cotangent_value_clamped_2() { } public: - Cotangent_value_clamped_2(PolygonMesh& pmesh_, + Cotangent_value_clamped_2(const PolygonMesh& pmesh_, VertexPointMap vpmap_) : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { return CotangentValue::pmesh(); } - VertexPointMap& ppmap() { return CotangentValue::ppmap(); } + const PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -238,17 +238,16 @@ template > class Cotangent_value_minimum_zero : CotangentValue { - Cotangent_value_minimum_zero() - { } - public: - Cotangent_value_minimum_zero(PolygonMesh& pmesh_, + Cotangent_value_minimum_zero() { } + + Cotangent_value_minimum_zero(const PolygonMesh& pmesh_, VertexPointMap vpmap_) : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { return CotangentValue::pmesh(); } - VertexPointMap& ppmap() { return CotangentValue::ppmap(); } + const PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -268,13 +267,13 @@ class Voronoi_area : CotangentValue { public: - Voronoi_area(PolygonMesh& pmesh_, + Voronoi_area(const PolygonMesh& pmesh_, VertexPointMap vpmap_) : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { return CotangentValue::pmesh(); } - VertexPointMap& ppmap() { return CotangentValue::ppmap(); } + const PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::in_edge_iterator in_edge_iterator; @@ -348,13 +347,13 @@ class Cotangent_value_area_weighted Cotangent_value_area_weighted() { } public: - Cotangent_value_area_weighted(PolygonMesh& pmesh_, + Cotangent_value_area_weighted(const PolygonMesh& pmesh_, VertexPointMap vpmap_) : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { return CotangentValue::pmesh(); } - VertexPointMap& ppmap() { return CotangentValue::ppmap(); } + const PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -385,7 +384,7 @@ struct Cotangent_weight_impl template double operator()(halfedge_descriptor he, PolygonMesh& pmesh, - const VertexPointMap& ppmap) + VertexPointMap ppmap) { const vertex_descriptor v0 = target(he, pmesh); const vertex_descriptor v1 = source(he, pmesh); @@ -422,20 +421,20 @@ template::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -512,13 +511,13 @@ class Single_cotangent_weight Single_cotangent_weight() { } public: - Single_cotangent_weight(PolygonMesh& pmesh_, + Single_cotangent_weight(const PolygonMesh& pmesh_, VertexPointMap vpmap_) : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { return CotangentValue::pmesh(); } - VertexPointMap& ppmap() { return CotangentValue::ppmap(); } + const PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -557,13 +556,13 @@ class Cotangent_weight_with_triangle_area Cotangent_weight_with_triangle_area() { } public: - Cotangent_weight_with_triangle_area(PolygonMesh& pmesh_, + Cotangent_weight_with_triangle_area(const PolygonMesh& pmesh_, VertexPointMap vpmap_) : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { return CotangentValue::pmesh(); } - VertexPointMap& ppmap() { return CotangentValue::ppmap(); } + const PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap ppmap() { return CotangentValue::ppmap(); } double operator()(halfedge_descriptor he) { @@ -614,18 +613,16 @@ template::type> class Mean_value_weight { - // Mean_value_weight() {} - - PolygonMesh& pmesh_; + const PolygonMesh& pmesh_; VertexPointMap vpmap_; public: - Mean_value_weight(PolygonMesh& pmesh_, + Mean_value_weight(const PolygonMesh& pmesh_, VertexPointMap vpmap) : pmesh_(pmesh_), vpmap_(vpmap) { } - PolygonMesh& pmesh() { return pmesh_; } + const PolygonMesh& pmesh() { return pmesh_; } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -722,11 +719,11 @@ class Hybrid_weight Hybrid_weight() { } public: - Hybrid_weight(PolygonMesh& pmesh_) + Hybrid_weight(const PolygonMesh& pmesh_) : primary(pmesh_), secondary(pmesh_) { } - PolygonMesh& pmesh() { return primary.pmesh(); } + const PolygonMesh& pmesh() { return primary.pmesh(); } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; @@ -751,14 +748,14 @@ public: template class Scale_dependent_weight_fairing { - PolygonMesh& pmesh_; + const PolygonMesh& pmesh_; public: - Scale_dependent_weight_fairing(PolygonMesh& pmesh_) + Scale_dependent_weight_fairing(const PolygonMesh& pmesh_) : pmesh_(pmesh_) { } - PolygonMesh& pmesh() { return pmesh_; } + const PolygonMesh& pmesh() { return pmesh_; } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -800,7 +797,7 @@ public: Cotangent_weight_with_voronoi_area_fairing(PM& pmesh_, VPMap vpmap_) - : voronoi_functor(pmesh_, vpmap_), + : voronoi_functor(pmesh_, vpmap_), cotangent_functor(pmesh_, vpmap_) { } @@ -867,7 +864,7 @@ public: typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - Uniform_weight_fairing(PolygonMesh&) { } + Uniform_weight_fairing(const PolygonMesh&) { } double w_ij(halfedge_descriptor /* e */) { return 1.0; } double w_i(vertex_descriptor /* v_i */) { return 1.0; } From 7163a188d308596389e36c075ba3307d6b792e06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 8 Nov 2022 14:45:12 +0100 Subject: [PATCH 110/194] Remove unused typedefs --- Weights/include/CGAL/Weights/internal/utils.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Weights/include/CGAL/Weights/internal/utils.h b/Weights/include/CGAL/Weights/internal/utils.h index 744af8be2d3..850fccff1e8 100644 --- a/Weights/include/CGAL/Weights/internal/utils.h +++ b/Weights/include/CGAL/Weights/internal/utils.h @@ -214,7 +214,6 @@ typename GeomTraits::Point_3 rotate_point_3(const double angle_rad, const GeomTraits& traits) { using FT = typename GeomTraits::FT; - using Point_3 = typename GeomTraits::Point_3; auto point_3 = traits.construct_point_3_object(); @@ -274,7 +273,6 @@ typename GeomTraits::Point_2 to_2d(const typename GeomTraits::Vector_3& b1, const GeomTraits& traits) { using FT = typename GeomTraits::FT; - using Point_2 = typename GeomTraits::Point_2; using Vector_3 = typename GeomTraits::Vector_3; auto dot_product_3 = traits.compute_scalar_product_3_object(); @@ -447,7 +445,6 @@ typename GeomTraits::FT area_3(const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& r, const GeomTraits& traits) { - using FT = typename GeomTraits::FT; using Point_2 = typename GeomTraits::Point_2; using Point_3 = typename GeomTraits::Point_3; using Vector_3 = typename GeomTraits::Vector_3; @@ -493,7 +490,6 @@ typename GeomTraits::FT positive_area_3(const typename GeomTraits::Point_3& p, const typename GeomTraits::Point_3& r, const GeomTraits& traits) { - using FT = typename GeomTraits::FT; using Get_sqrt = Get_sqrt; auto sqrt = Get_sqrt::sqrt_object(traits); From f744b2fbec0643e28deb3cb891b573e3fa68cc8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 8 Nov 2022 14:53:03 +0100 Subject: [PATCH 111/194] Fix placement of [[deprecated]] in old stop predicate aliases --- .../Policies/Edge_collapse/Count_ratio_stop_predicate.h | 2 +- .../Policies/Edge_collapse/Count_stop_predicate.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h index ec8f2a3a225..36b784e4dbf 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_ratio_stop_predicate.h @@ -26,7 +26,7 @@ namespace Surface_mesh_simplification { // Stops when the ratio of initial to current number of edges is below some value. template -using Count_ratio_stop_predicate = CGAL_DEPRECATED Edge_count_ratio_stop_predicate; +using Count_ratio_stop_predicate CGAL_DEPRECATED = Edge_count_ratio_stop_predicate; } // namespace Surface_mesh_simplification } // namespace CGAL diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h index c72b0bafea2..66b0f5fb8c9 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h @@ -26,7 +26,7 @@ namespace Surface_mesh_simplification { // Stops when the number of edges left falls below a given number. template -using Count_stop_predicate = CGAL_DEPRECATED Edge_count_stop_predicate; +using Count_stop_predicate CGAL_DEPRECATED = Edge_count_stop_predicate; } // namespace Surface_mesh_simplification } // namespace CGAL From d7b46586a86bae5d53e4e6898d2b00235d03e4a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 8 Nov 2022 14:53:31 +0100 Subject: [PATCH 112/194] Fix double include (also preventing de-activation of [[deprecated]] warnings...) --- .../test_edge_deprecated_stop_predicates.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_deprecated_stop_predicates.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_deprecated_stop_predicates.cpp index e1b7be1fb1e..238a796eb03 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_deprecated_stop_predicates.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_deprecated_stop_predicates.cpp @@ -1,4 +1,3 @@ -#include #include #include From dd249a21f8ed06e2915c55e0bc318c3b7cd6dc79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 8 Nov 2022 16:08:00 +0100 Subject: [PATCH 113/194] Fix intercompatiblity between APIs of Cotangent_weight --- .../include/CGAL/Weights/cotangent_weights.h | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/Weights/include/CGAL/Weights/cotangent_weights.h b/Weights/include/CGAL/Weights/cotangent_weights.h index 89af4fa88d4..ce3471550b5 100644 --- a/Weights/include/CGAL/Weights/cotangent_weights.h +++ b/Weights/include/CGAL/Weights/cotangent_weights.h @@ -205,6 +205,10 @@ class Cotangent_weight using FT = typename GeomTraits::FT; private: + // These class members are used only when the constructor initializing them + // is used, but Surface_mesh_deformation has its own weight API locked + // by the concept SurfaceMeshDeformationWeights. + // A bit awkward, but better than duplicating code... PolygonMesh* const* m_pmesh_ptr; const VertexPointMap m_vpm; const GeomTraits m_traits; @@ -213,15 +217,17 @@ private: bool m_bound_from_below; public: - // Surface_mesh_deformation has its own API locked by the concept SurfaceMeshDeformationWeights Cotangent_weight() : m_pmesh_ptr(nullptr), m_vpm(), m_traits(), m_use_clamped_version(false), m_bound_from_below(true) { } - template + // Common API whether mesh/vpm/traits are initialized in the constructor, + // or passed in the operator() + template FT operator()(const halfedge_descriptor he, const PolygonMesh& pmesh, - const VPM vpm) const + const VPM vpm, + const GT& traits) const { using Point_ref = typename boost::property_traits::reference; @@ -243,9 +249,9 @@ public: FT weight = 0; if (m_use_clamped_version) - weight = cotangent_3_clamped(p1, p2, p0, m_traits); + weight = cotangent_3_clamped(p1, p2, p0, traits); else - weight = cotangent_3(p1, p2, p0, m_traits); + weight = cotangent_3(p1, p2, p0, traits); if(m_bound_from_below) weight = (CGAL::max)(FT(0), weight); @@ -257,7 +263,19 @@ public: return weight; } + // That is the API called by Surface_mesh_deformation + template + FT operator()(const halfedge_descriptor he, + const PolygonMesh& pmesh, + const VPM vpm) const + { + using Point = typename boost::property_traits::value_type; + using GT = typename Kernel_traits::type; + return this->operator()(he, pmesh, vpm, GT()); + } + public: + // This is the "normal" API: give all info to the constructor, and operator()(halfedge) Cotangent_weight(const PolygonMesh& pmesh, const VertexPointMap vpm, const GeomTraits& traits = GeomTraits(), @@ -271,7 +289,7 @@ public: FT operator()(const halfedge_descriptor he) const { CGAL_precondition(m_pmesh_ptr != nullptr); - return this->operator()(he, *m_pmesh_ptr, m_vpm); + return this->operator()(he, *m_pmesh_ptr, m_vpm, m_traits); } }; From f3f3af10bbe104ac5b49bd49700cc29d2ce91979 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 9 Nov 2022 08:18:22 +0000 Subject: [PATCH 114/194] Remove CGAL_USE(dirname) as not defined --- Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp index 7a3f29db756..f74562e6e58 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp @@ -1027,7 +1027,6 @@ Io_image_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_scene) *image = CGAL::IO::read_vtk_image_data(vtk_image); // copy the image data #else CGAL::Three::Three::warning("You need VTK to read a NRRD file"); - CGAL_USE(dirname); delete image; return QList(); #endif From fa6a2bddac4ec08f9f1d9f37269938573b1ee225 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 9 Nov 2022 08:32:59 +0000 Subject: [PATCH 115/194] static_cast to avoid warning --- Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h b/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h index ae1853a0a12..3f03e20badd 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h @@ -355,9 +355,9 @@ public: element.assign(rf, "red"); element.assign(gf, "green"); element.assign(bf, "blue"); - r = std::floor(rf*255); - g = std::floor(gf*255); - b = std::floor(bf*255); + r = static_cast(std::floor(rf*255)); + g = static_cast(std::floor(gf*255)); + b = static_cast(std::floor(bf*255)); } m_fcolor_map[fi] = CGAL::IO::Color(r, g, b); } From d1eca8310f955652616b3e1abdaa77f646ae004a Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 7 Nov 2022 17:34:54 +0000 Subject: [PATCH 116/194] typo --- Orthtree/include/CGAL/Orthtree/Node.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Orthtree/include/CGAL/Orthtree/Node.h b/Orthtree/include/CGAL/Orthtree/Node.h index 5a485adcae8..219959b81cc 100644 --- a/Orthtree/include/CGAL/Orthtree/Node.h +++ b/Orthtree/include/CGAL/Orthtree/Node.h @@ -345,7 +345,7 @@ public: } /*! - \brief returns the nth child fo this node. + \brief returns the nth child of this node. \pre `!is_null()` \pre `!is_leaf()` From 331ea2898a896b3a6b1c3cd4966f88c1b7221d41 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 8 Nov 2022 15:15:20 +0000 Subject: [PATCH 117/194] Orthtree: Fix memory leak --- Orthtree/include/CGAL/Orthtree.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Orthtree/include/CGAL/Orthtree.h b/Orthtree/include/CGAL/Orthtree.h index 5c8cc3ca021..8091001a32f 100644 --- a/Orthtree/include/CGAL/Orthtree.h +++ b/Orthtree/include/CGAL/Orthtree.h @@ -320,8 +320,21 @@ public: void refine(const Split_predicate& split_predicate) { // If the tree has already been refined, reset it - if (!m_root.is_leaf()) + if (!m_root.is_leaf()){ + std::queue nodes; + for (std::size_t i = 0; i < Degree::value; ++ i) + nodes.push (m_root[i]); + while (!nodes.empty()) + { + Node node = nodes.front(); + nodes.pop(); + if (!node.is_leaf()) + for (std::size_t i = 0; i < Degree::value; ++ i) + nodes.push (node[i]); + node.free(); + } m_root.unsplit(); + } // Reset the side length map, too m_side_per_depth.resize(1); From b603aab68005688abd8161862e420dd81a9d84c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 9 Nov 2022 09:55:29 +0100 Subject: [PATCH 118/194] Fix syntax --- Weights/include/CGAL/Weights/cotangent_weights.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Weights/include/CGAL/Weights/cotangent_weights.h b/Weights/include/CGAL/Weights/cotangent_weights.h index ce3471550b5..ba128a98502 100644 --- a/Weights/include/CGAL/Weights/cotangent_weights.h +++ b/Weights/include/CGAL/Weights/cotangent_weights.h @@ -209,7 +209,7 @@ private: // is used, but Surface_mesh_deformation has its own weight API locked // by the concept SurfaceMeshDeformationWeights. // A bit awkward, but better than duplicating code... - PolygonMesh* const* m_pmesh_ptr; + PolygonMesh const * const m_pmesh_ptr; const VertexPointMap m_vpm; const GeomTraits m_traits; From 07c60df0ce0d5f08f7fa0350f3f1d6dd500c9460 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 9 Nov 2022 10:00:54 +0000 Subject: [PATCH 119/194] Polygon_mesh_processing: reparation -> repairing --- .../doc/Polygon_mesh_processing/Polygon_mesh_processing.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt index 08e11df647d..e7345cd3c4c 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt @@ -59,7 +59,7 @@ of the graph concepts defined in the package \ref PkgBGLRef. Using common graph enables having common input/output functions for all the models of these concepts. The page \ref PkgBGLIOFct provides an exhaustive description of the available I/O functions. In addition, this package offers the function `CGAL::Polygon_mesh_processing::IO::read_polygon_mesh()`, -which can perform some reparation if the input data do not represent a manifold surface. +which can perform some repairing if the input data do not represent a manifold surface. **************************************** \section PMPMeshing Meshing From 91ab7000b05a7fcb70338e36a73fbffc8567476c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 9 Nov 2022 11:25:27 +0000 Subject: [PATCH 120/194] Add a default parameter so that the test does something --- .../test/Surface_mesh_shortest_path/TestMesh.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp index 389cc215f11..c52c87fa50e 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp @@ -308,7 +308,7 @@ int main(int argc, char** argv) options.add_options() ("help,h", "Display help message") - ("polyhedron,p", po::value(), "Polyhedron input file") + ("polyhedron,p", po::value()->default_value("./data/test_mesh_6.off"), "Polyhedron input file") ("debugmode,d", po::value()->default_value(false), "Enable debug output") ("randomseed,r", po::value(), "Randomization seed value") ("trials,t", po::value()->default_value(1), "Number of trials to run") From 8ff15b25a015279856e22083e096d9aeaa3788c1 Mon Sep 17 00:00:00 2001 From: Mael Date: Wed, 9 Nov 2022 15:44:10 +0100 Subject: [PATCH 121/194] reparation -> repairing --- .../Polygon_mesh_processing/repair_polygon_soup_example.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/repair_polygon_soup_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/repair_polygon_soup_example.cpp index 13da122a884..e58267d6da7 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/repair_polygon_soup_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/repair_polygon_soup_example.cpp @@ -84,9 +84,9 @@ int main(int, char**) polygons.push_back({0,1,2,3,4,3,2,1}); #endif - std::cout << "Before reparation, the soup has " << points.size() << " vertices and " << polygons.size() << " faces" << std::endl; + std::cout << "Before repairing, the soup has " << points.size() << " vertices and " << polygons.size() << " faces" << std::endl; PMP::repair_polygon_soup(points, polygons, CGAL::parameters::geom_traits(Array_traits())); - std::cout << "After reparation, the soup has " << points.size() << " vertices and " << polygons.size() << " faces" << std::endl; + std::cout << "After repairing, the soup has " << points.size() << " vertices and " << polygons.size() << " faces" << std::endl; Mesh mesh; PMP::orient_polygon_soup(points, polygons); From cd4de51a4035bf066e49abb9a2fa0d5ef96cba24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 9 Nov 2022 18:17:31 +0100 Subject: [PATCH 122/194] fix inconsistency check --- .../Corefinement/Face_graph_output_builder.h | 17 +++++++++---- .../data-coref/floating_squares.off | 16 +++++++++++++ .../data-coref/hexa.off | 24 +++++++++++++++++++ .../test_corefinement_bool_op.cmd | 1 + 4 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 Polygon_mesh_processing/test/Polygon_mesh_processing/data-coref/floating_squares.off create mode 100644 Polygon_mesh_processing/test/Polygon_mesh_processing/data-coref/hexa.off diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index bb52550f111..6709b3705eb 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -1069,15 +1069,15 @@ public: if (!used_to_clip_a_surface && !used_to_classify_patches && (!is_tm1_closed || !is_tm2_closed)) { //make sure there is no ambiguity in tm1 - if( (patch_status_was_not_already_set[0] && previous_bitvalue[0]!=is_patch_inside_tm2[patch_id_p1] ) || - (patch_status_was_not_already_set[1] && previous_bitvalue[1]!=is_patch_inside_tm2[patch_id_p2] ) ) + if( (!patch_status_was_not_already_set[0] && previous_bitvalue[0]!=is_patch_inside_tm2.test(patch_id_p1) ) || + (!patch_status_was_not_already_set[1] && previous_bitvalue[1]!=is_patch_inside_tm2.test(patch_id_p2) ) ) { impossible_operation.set(); return true; } //make sure there is no ambiguity in tm2 - if( (patch_status_was_not_already_set[2] && previous_bitvalue[2]!=is_patch_inside_tm2[patch_id_q1] ) || - (patch_status_was_not_already_set[3] && previous_bitvalue[3]!=is_patch_inside_tm2[patch_id_q2] ) ) + if( (!patch_status_was_not_already_set[2] && previous_bitvalue[2]!=is_patch_inside_tm1.test(patch_id_q1) ) || + (!patch_status_was_not_already_set[3] && previous_bitvalue[3]!=is_patch_inside_tm1.test(patch_id_q2) ) ) { impossible_operation.set(); return true; @@ -1092,6 +1092,15 @@ public: patch_status_not_set_tm2.reset(patch_id_q1); patch_status_not_set_tm2.reset(patch_id_q2); + // restore initial state, needed when checking in `inconsistent_classification()` + if (!is_tm1_closed || !is_tm2_closed) + { + is_patch_inside_tm2.reset(patch_id_p1); + is_patch_inside_tm2.reset(patch_id_p2); + is_patch_inside_tm1.reset(patch_id_q1); + is_patch_inside_tm1.reset(patch_id_q2); + } + #ifdef CGAL_COREFINEMENT_POLYHEDRA_DEBUG #warning: Factorize the orientation predicates. #endif //CGAL_COREFINEMENT_POLYHEDRA_DEBUG diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/data-coref/floating_squares.off b/Polygon_mesh_processing/test/Polygon_mesh_processing/data-coref/floating_squares.off new file mode 100644 index 00000000000..86709d5e8ac --- /dev/null +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/data-coref/floating_squares.off @@ -0,0 +1,16 @@ +OFF +8 4 0 + +0 0 1 +1 0 1 +1 1 1 +0 1 1 +0 0 0 +1 0 0 +1 1 0 +0 1 0 +3 0 1 2 +3 2 3 0 +3 6 5 4 +3 4 7 6 + diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/data-coref/hexa.off b/Polygon_mesh_processing/test/Polygon_mesh_processing/data-coref/hexa.off new file mode 100644 index 00000000000..4bbb30354ec --- /dev/null +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/data-coref/hexa.off @@ -0,0 +1,24 @@ +OFF +8 12 0 + +0.75 0.75 -1 +0.25 0.75 -1 +0.25 0.25 -1 +0.75 0.25 -1 +0.75 0.25 1 +0.75 0.75 1 +0.25 0.75 1 +0.25 0.25 1 +3 4 5 6 +3 0 3 2 +3 1 2 7 +3 0 1 6 +3 3 0 5 +3 2 3 4 +3 6 7 4 +3 2 1 0 +3 7 6 1 +3 6 5 0 +3 5 4 3 +3 4 7 2 + diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cmd b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cmd index 99d70e20728..c11009e6559 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cmd +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cmd @@ -1,2 +1,3 @@ ${CGAL_DATA_DIR}/meshes/elephant.off ${CGAL_DATA_DIR}/meshes/sphere.off ALL 1 1 1 1 ${CGAL_DATA_DIR}/meshes/open_cube.off data-coref/incompatible_with_open_cube.off ALL 0 0 0 0 +data-coref/floating_squares.off data-coref/hexa.off ALL 1 1 1 1 From 178bc9e905bf9221542fb23cfa0c144a183b06e7 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 10 Nov 2022 09:24:26 +0000 Subject: [PATCH 123/194] More static cast --- Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h b/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h index 3f03e20badd..8e274941fc1 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h @@ -301,9 +301,9 @@ public: element.assign(rf, "red"); element.assign(gf, "green"); element.assign(bf, "blue"); - r = std::floor(rf*255); - g = std::floor(gf*255); - b = std::floor(bf*255); + r = static_cast(std::floor(rf*255)); + g = static_cast(std::floor(gf*255)); + b = static_cast(std::floor(bf*255)); } m_vcolor_map[vi] = CGAL::IO::Color(r, g, b); } From 792ea897908fc5b5226a312713f6e7b84a19bc01 Mon Sep 17 00:00:00 2001 From: Mael Date: Thu, 10 Nov 2022 14:34:52 +0100 Subject: [PATCH 124/194] Also give a default initialization for the random seed + fix typo --- .../test/Surface_mesh_shortest_path/TestMesh.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp index c52c87fa50e..66ced595875 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp @@ -264,7 +264,7 @@ void run_program_instance(po::variables_map& vm) if (vm.count("randomseed")) { - programInstance.randomizer = new CGAL::Random(vm["randomSeed"].as()); + programInstance.randomizer = new CGAL::Random(vm["randomseed"].as()); } programInstance.debugMode = vm["debugmode"].as(); @@ -310,7 +310,7 @@ int main(int argc, char** argv) ("help,h", "Display help message") ("polyhedron,p", po::value()->default_value("./data/test_mesh_6.off"), "Polyhedron input file") ("debugmode,d", po::value()->default_value(false), "Enable debug output") - ("randomseed,r", po::value(), "Randomization seed value") + ("randomseed,r", po::value()->default_value(0), "Randomization seed value") ("trials,t", po::value()->default_value(1), "Number of trials to run") ("kernel,k", po::value()->default_value("epick"), "Kernel to use. One of \'ipick\', \'epick\', \'epeck\'") ; From 2bcc9ad8c591067f1b2aff6c33a6925629221245 Mon Sep 17 00:00:00 2001 From: albert-github Date: Sun, 13 Nov 2022 13:19:22 +0100 Subject: [PATCH 125/194] Link corrections - Correcting some permanent redirects - corrected link for to `max_element`, link was incorrect --- Combinatorial_map/doc/Combinatorial_map/Combinatorial_map.txt | 2 +- Documentation/doc/Documentation/Third_party.txt | 2 +- Generalized_map/doc/Generalized_map/Generalized_map.txt | 2 +- STL_Extension/doc/STL_Extension/CGAL/algorithm.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Combinatorial_map/doc/Combinatorial_map/Combinatorial_map.txt b/Combinatorial_map/doc/Combinatorial_map/Combinatorial_map.txt index 58ada384336..423f49aae1c 100644 --- a/Combinatorial_map/doc/Combinatorial_map/Combinatorial_map.txt +++ b/Combinatorial_map/doc/Combinatorial_map/Combinatorial_map.txt @@ -542,7 +542,7 @@ Let d0\f$ \in \f$ D be a dart. Given i, 1 \f$ \leq \f$ i \section Combinatorial_mapDesign Design and Implementation History -The code of this package is inspired by Moka, a 3D topological modeler mainly developed by Frédéric Vidil and Guillaume Damiand (http://moka-modeller.sourceforge.net/). However, Moka was based on Generalized maps (and not Combinatorial maps), and the design was not \cgal "compatible". Thus, Guillaume Damiand started to develop a totally new package by mixing ideas taken from Moka with the design of the Halfedge data structure package of \cgal. Andreas Fabri and Sébastien Loriot contributed to the design, the coding, and to the documentation of the package, and Laurent Rineau helped for the design. Emma Michel contributed to the manual. Monique Teillaud and Bernd Gärtner contributed to the manual by giving useful remarks, really numerous and detailed for Monique. Ken Arroyo Ohori contributed to the two reverse orientation functions. +The code of this package is inspired by Moka, a 3D topological modeler mainly developed by Frédéric Vidil and Guillaume Damiand (https://moka-modeller.sourceforge.net/). However, Moka was based on Generalized maps (and not Combinatorial maps), and the design was not \cgal "compatible". Thus, Guillaume Damiand started to develop a totally new package by mixing ideas taken from Moka with the design of the Halfedge data structure package of \cgal. Andreas Fabri and Sébastien Loriot contributed to the design, the coding, and to the documentation of the package, and Laurent Rineau helped for the design. Emma Michel contributed to the manual. Monique Teillaud and Bernd Gärtner contributed to the manual by giving useful remarks, really numerous and detailed for Monique. Ken Arroyo Ohori contributed to the two reverse orientation functions. */ } /* namespace CGAL */ diff --git a/Documentation/doc/Documentation/Third_party.txt b/Documentation/doc/Documentation/Third_party.txt index d74dcdaf7b9..1b281911cc8 100644 --- a/Documentation/doc/Documentation/Third_party.txt +++ b/Documentation/doc/Documentation/Third_party.txt @@ -213,7 +213,7 @@ the handling of \pdb data. In \cgal, the \esbtl is used in an example of the \ref PkgSkinSurface3 package. -It can be downloaded from `http://esbtl.sourceforge.net/`. +It can be downloaded from `https://esbtl.sourceforge.net/`. \subsection thirdpartyTBB Intel TBB diff --git a/Generalized_map/doc/Generalized_map/Generalized_map.txt b/Generalized_map/doc/Generalized_map/Generalized_map.txt index 09ad37a4946..0b08884f40a 100644 --- a/Generalized_map/doc/Generalized_map/Generalized_map.txt +++ b/Generalized_map/doc/Generalized_map/Generalized_map.txt @@ -551,7 +551,7 @@ Let d0 \f$ \in \f$ D be a dart. Given i, 0 \f$ \leq \f$ \section Generalized_mapDesign Design and Implementation History -The code of this package followed the code of Combinatorial maps and was inspired by Moka, a 3D topological modeler that uses 3D generalized maps (http://moka-modeller.sourceforge.net/). +The code of this package followed the code of Combinatorial maps and was inspired by Moka, a 3D topological modeler that uses 3D generalized maps (https://moka-modeller.sourceforge.net/). */ } /* namespace CGAL */ diff --git a/STL_Extension/doc/STL_Extension/CGAL/algorithm.h b/STL_Extension/doc/STL_Extension/CGAL/algorithm.h index 13fa64df19b..2250a4a3e93 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/algorithm.h +++ b/STL_Extension/doc/STL_Extension/CGAL/algorithm.h @@ -42,7 +42,7 @@ Computes the minimal and the maximal element of a range. It is modeled after the \stl functions `std::min_element` and `std::max_element`. +href="https://en.cppreference.com/w/cpp/algorithm/max_element">`std::max_element`. The advantage of `min_max_element()` compared to calling both \stl functions is that one only iterates once over the sequence. This is more efficient especially for large and/or complex sequences. From c5993c7458b17b7c1e16c76c27f82be9bf2dd192 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 14 Nov 2022 18:10:26 +0000 Subject: [PATCH 126/194] Snap_rounding: cleanup --- .../doc/Snap_rounding_2/Concepts/SnapRoundingTraits_2.h | 4 ++-- Snap_rounding_2/include/CGAL/Snap_rounding_kd_2.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Snap_rounding_2/doc/Snap_rounding_2/Concepts/SnapRoundingTraits_2.h b/Snap_rounding_2/doc/Snap_rounding_2/Concepts/SnapRoundingTraits_2.h index 1a888a011ce..5f908c59c86 100644 --- a/Snap_rounding_2/doc/Snap_rounding_2/Concepts/SnapRoundingTraits_2.h +++ b/Snap_rounding_2/doc/Snap_rounding_2/Concepts/SnapRoundingTraits_2.h @@ -189,7 +189,7 @@ class ConstructVertex_2 public: /*! returns the source or target of `seg`. If `i` modulo 2 is 0, - the source is returned, otherwise the target is returned.} + the source is returned, otherwise the target is returned. */ Point_2 operator()(Segment_2 seg, int i); }; @@ -223,7 +223,7 @@ class ConstructIsoRectangle_2 public: /*! - introduces an iso-oriented rectangle fo whose minimal `x` coordinate + introduces an iso-oriented rectangle whose minimal `x` coordinate is the one of `left`, the maximal `x` coordinate is the one of `right`, the minimal `y` coordinate is the one of `bottom`, the maximal `y` coordinate is the one of `top`.} diff --git a/Snap_rounding_2/include/CGAL/Snap_rounding_kd_2.h b/Snap_rounding_2/include/CGAL/Snap_rounding_kd_2.h index cf7b6c2def6..20140344b84 100644 --- a/Snap_rounding_2/include/CGAL/Snap_rounding_kd_2.h +++ b/Snap_rounding_2/include/CGAL/Snap_rounding_kd_2.h @@ -19,7 +19,6 @@ #include #include -#include #include #include #include From 40d8e9d7b2aec640d345fa9a92b3f6c694d8d175 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 14 Nov 2022 18:20:23 +0000 Subject: [PATCH 127/194] fix path to demo --- Snap_rounding_2/doc/Snap_rounding_2/Snap_rounding_2.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Snap_rounding_2/doc/Snap_rounding_2/Snap_rounding_2.txt b/Snap_rounding_2/doc/Snap_rounding_2/Snap_rounding_2.txt index bffd43ef1dd..41d9f6872e4 100644 --- a/Snap_rounding_2/doc/Snap_rounding_2/Snap_rounding_2.txt +++ b/Snap_rounding_2/doc/Snap_rounding_2/Snap_rounding_2.txt @@ -128,8 +128,7 @@ Polyline number 4: The package is supplied with a graphical demo program that opens a window, allows the user to edit segments dynamically, applies a selected snap-rounding procedures, and displays the result onto the same window -(see `/demo/Snap_rounding_2/demo.cpp`). +(see `/demo/Snap_rounding_2/Snap_rounding_2.cpp`). */ } /* namespace CGAL */ - From 5f6f1e2e8d6543745ff73daa4b5b1df71eef87fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 14 Nov 2022 20:14:55 +0100 Subject: [PATCH 128/194] remove line that seems useless --- .github/install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/install.sh b/.github/install.sh index e06328da401..32b8552aa8f 100755 --- a/.github/install.sh +++ b/.github/install.sh @@ -1,5 +1,4 @@ #!/bin/bash -sudo add-apt-repository ppa:mikhailnov/pulseeffects -y sudo apt-get update sudo apt-get install -y libmpfr-dev \ libeigen3-dev qtbase5-dev libqt5sql5-sqlite libqt5opengl5-dev qtscript5-dev \ From d43269cb4355de08a3c890ed31d141e91ac08cdb Mon Sep 17 00:00:00 2001 From: Mael Date: Tue, 15 Nov 2022 11:22:45 +0100 Subject: [PATCH 129/194] Update CHANGES.md --- Installation/CHANGES.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index 5ec9848fddb..d639da0e917 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -4,7 +4,7 @@ Release History [Release 5.6](https://github.com/CGAL/cgal/releases/tag/v5.6) ----------- -Release date: December 2022 +Release date: June 2023 ### [Combinatorial Maps](https://doc.cgal.org/5.6/Manual/packages.html#PkgCombinatorialMaps) [Generalized Maps](https://doc.cgal.org/5.6/Manual/packages.html#PkgGeneralizedMaps) [Linear Cell Complex](https://doc.cgal.org/5.6/Manual/packages.html#PkgLinearCellComplex) @@ -48,6 +48,10 @@ CGAL tetrahedral Delaunay refinement algorithm. described by the concept `TriangulationDataStructure_2::Face`. The model `CGAL::Hyperbolic_triangulation_face_base_2` has been adapted correspondingly. +### [Surface Mesh Simplification](https://doc.cgal.org/5.6/Manual/packages.html#PkgSurfaceMeshSimplification) +- The stop predicates `Count_stop_predicate` and `Count_ratio_stop_predicate` are renamed to `Edge_count_stop_predicate` and `Edge_count_ratio_stop_predicate`. Older versions have been deprecated. +- Introduce `Face_count_stop_predicate` and `Face_count_ratio_stop_predicate` that can be used to stop the simplification algorithm based on a desired number of faces in the output, or a ratio between input and output face numbers. + [Release 5.5](https://github.com/CGAL/cgal/releases/tag/v5.5) ----------- From 0fb05d14800de6db73b5d6f0bdf2170fa19c407c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 15 Nov 2022 20:04:23 +0100 Subject: [PATCH 130/194] fix warning --- Point_set_3/include/CGAL/Point_set_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Point_set_3/include/CGAL/Point_set_3.h b/Point_set_3/include/CGAL/Point_set_3.h index 5a833713161..c9e6ba4f0ba 100644 --- a/Point_set_3/include/CGAL/Point_set_3.h +++ b/Point_set_3/include/CGAL/Point_set_3.h @@ -1365,7 +1365,7 @@ struct Point_set_processing_3_np_helper, NamedParamet return !(is_default_parameter::value); } - static constexpr bool has_normal_map(Point_set_3& ps, const NamedParameters&) + static constexpr bool has_normal_map(Point_set_3&, const NamedParameters&) { return true; // either available in named parameters, and always available in Point_set_3 otherwise } From d89d6b1b759175539c4050f48dbf9e0bd23cd285 Mon Sep 17 00:00:00 2001 From: SaillantNicolas <97436229+SaillantNicolas@users.noreply.github.com> Date: Wed, 16 Nov 2022 16:35:37 +0100 Subject: [PATCH 131/194] Fix javascript syntax --- .github/workflows/build_doc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_doc.yml b/.github/workflows/build_doc.yml index b15b2658b6c..fe5614e4a78 100644 --- a/.github/workflows/build_doc.yml +++ b/.github/workflows/build_doc.yml @@ -155,7 +155,7 @@ jobs: if: ${{ failure() && steps.get_round.outputs.result != 'stop' }} with: script: | - const error = "${{steps.build_and_run.outputs.DoxygenError}}" + const error = `${{steps.build_and_run.outputs.DoxygenError}}` const msg = "There was an error while building the doc: \n"+error github.rest.issues.createComment({ owner: "CGAL", From 4af943d5ec351b7d1e4cc2c045f5f82c81de8517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 16 Nov 2022 20:05:20 +0100 Subject: [PATCH 132/194] delete random --- .../test/Surface_mesh_shortest_path/TestMesh.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp index 66ced595875..aaf41537b8b 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp @@ -72,6 +72,12 @@ struct TestMeshProgramInstance numIterations = 1; } + ~TestMeshProgramInstance() + { + if (randomizer) + delete randomizer; + } + size_t numIterations; std::string meshName; bool debugMode; From 8437eec29dc0207b9813beff6225f16344585c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 17 Nov 2022 11:17:54 +0100 Subject: [PATCH 133/194] Fix implicit conversion from std::size_t to bool creating ambiguous calls --- BGL/include/CGAL/boost/graph/selection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BGL/include/CGAL/boost/graph/selection.h b/BGL/include/CGAL/boost/graph/selection.h index b63bb387efe..085b63a210a 100644 --- a/BGL/include/CGAL/boost/graph/selection.h +++ b/BGL/include/CGAL/boost/graph/selection.h @@ -543,7 +543,7 @@ regularize_face_selection_borders( (face_index_map)); for (mesh_face_descriptor fd : faces(mesh)) - put(is_selected, fd, graph.labels[get(face_index_map,fd)]); + put(is_selected, fd, (graph.labels[get(face_index_map,fd)] != 0)); } /// \cond SKIP_IN_MANUAL From 33cfc700b2a765c0dff2e225946fde5027ef52be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 17 Nov 2022 12:12:01 +0100 Subject: [PATCH 134/194] fix unused warning --- Number_types/include/CGAL/FPU.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Number_types/include/CGAL/FPU.h b/Number_types/include/CGAL/FPU.h index d5a123608c4..0c7c70a7ebb 100644 --- a/Number_types/include/CGAL/FPU.h +++ b/Number_types/include/CGAL/FPU.h @@ -500,6 +500,7 @@ void FPU_set_cw (FPU_CW_t cw) { #ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + CGAL_USE(cw); CGAL_assertion(cw == CGAL_FE_TONEAREST); #else CGAL_IA_SETFPCW(cw); @@ -511,6 +512,7 @@ FPU_CW_t FPU_get_and_set_cw (FPU_CW_t cw) { #ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + CGAL_USE(cw); CGAL_assertion(cw == CGAL_FE_TONEAREST); return CGAL_FE_TONEAREST; #else From 5fd1a8070cb4fc9b841662f1d27a9558cf4ac1cf Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 17 Nov 2022 16:34:41 +0100 Subject: [PATCH 135/194] add missing is_in_complex() check --- .../internal/tetrahedral_adaptive_remeshing_impl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h index 4117c01bc89..870b60cb1a9 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h @@ -385,7 +385,8 @@ private: const Subdomain_index index = cit->subdomain_index(); if(!input_is_c3t3()) m_c3t3.remove_from_complex(cit); - m_c3t3.add_to_complex(cit, index); + if(Subdomain_index() != index) + m_c3t3.add_to_complex(cit, index); #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG ++nbc; From 4d797b55c494f48dc1ffcfe558cd17dd3a29e9ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 17 Nov 2022 19:03:30 +0100 Subject: [PATCH 136/194] try working around a warning --- 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..07fb7748e21 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 std::distance(static_cast(0), PTR); } bool identical(const Handle& h) const noexcept { return PTR == h.PTR; } From 8bbbf8d494703e7b0487d8c93ae4ce4fdf0dea02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 17 Nov 2022 19:11:00 +0100 Subject: [PATCH 137/194] try workaround warnings --- .../CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h | 5 ++--- .../include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h | 3 +-- .../include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h | 5 +---- Nef_3/include/CGAL/Nef_3/SNC_SM_explorer.h | 5 +---- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h index b02303fa6af..c3f2d09f1f2 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h @@ -356,10 +356,9 @@ public: const OuterFunctor& outer) : _inner(inner), _outer(outer) {} - Unary_compose(const Unary_compose& other) - : _inner(other._inner), _outer(other._outer) {} + Unary_compose(const Unary_compose& other) = default; - Unary_compose() : _inner(::boost::none),_outer(::boost::none) {} + Unary_compose() : _inner(::boost::none),_outer(::boost::none) {} typedef typename InnerFunctor::argument_type argument_type; typedef typename OuterFunctor::result_type result_type; diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h index f1f45aab56c..88235d5d90a 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h @@ -1147,8 +1147,7 @@ public: Bitstream_descartes() : Base(new Rep()) {} //! Copy constructor - Bitstream_descartes(const Self& other) : Base(static_cast(other)) - {} + Bitstream_descartes(const Self& other) = default; /*! * \brief Constructor for a polynomial \c f diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h index b4b057ef2d0..27ca4692e72 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h @@ -35,10 +35,7 @@ public: { } - AABB_segment_2_primitive(const AABB_segment_2_primitive &primitive) - { - m_it = primitive.id(); - } + AABB_segment_2_primitive(const AABB_segment_2_primitive &primitive) = default; const Id &id() const { diff --git a/Nef_3/include/CGAL/Nef_3/SNC_SM_explorer.h b/Nef_3/include/CGAL/Nef_3/SNC_SM_explorer.h index 4a38ac41754..95440eb3bd8 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_SM_explorer.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_SM_explorer.h @@ -30,10 +30,7 @@ class SNC_SM_explorer : public SMCDEC { public: SNC_SM_explorer(const Base& E) : Base(E) {} - Self& operator=(const Self& E) { - Base::operator=(E); - return *this; - } + Self& operator=(const Self& E) = default; }; } //namespace CGAL From 285dbb96bf05bbf68e93b86d4482d05f5b9e1f45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 17 Nov 2022 19:17:32 +0100 Subject: [PATCH 138/194] value must be removed Was reported as a warning by MSVC 2022 --- Partition_2/include/CGAL/Partition_2/Rotation_tree_2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Partition_2/include/CGAL/Partition_2/Rotation_tree_2.h b/Partition_2/include/CGAL/Partition_2/Rotation_tree_2.h index fa78978a4dd..284dda6df73 100644 --- a/Partition_2/include/CGAL/Partition_2/Rotation_tree_2.h +++ b/Partition_2/include/CGAL/Partition_2/Rotation_tree_2.h @@ -78,7 +78,7 @@ public: Greater greater (traits.less_xy_2_object()); Equal equal; std::sort(this->begin(), this->end(), greater); - std::unique(this->begin(), this->end(),equal); + this->erase(std::unique(this->begin(), this->end(),equal), this->end()); // front() is the point with the largest x coordinate From b8aa2558fd3dc56099bcfc77117a1261ac74a46e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 17 Nov 2022 19:40:38 +0100 Subject: [PATCH 139/194] add missing using --- Partition_2/include/CGAL/Partition_2/Rotation_tree_2.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Partition_2/include/CGAL/Partition_2/Rotation_tree_2.h b/Partition_2/include/CGAL/Partition_2/Rotation_tree_2.h index 284dda6df73..8887bc4164b 100644 --- a/Partition_2/include/CGAL/Partition_2/Rotation_tree_2.h +++ b/Partition_2/include/CGAL/Partition_2/Rotation_tree_2.h @@ -47,7 +47,8 @@ public: typedef typename Traits::Point_2 Point_2; using internal::vector< Rotation_tree_node_2 >::push_back; - using internal::vector< Rotation_tree_node_2 >::back; + using internal::vector< Rotation_tree_node_2 >::back; + using internal::vector< Rotation_tree_node_2 >::erase; class Greater { typename Traits::Less_xy_2 less; From 7322c7908dfe68c24590529a2f27aa16ba39c9ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 21 Nov 2022 14:09:08 +0100 Subject: [PATCH 140/194] try to workaround warnings --- .../CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h | 1 + .../include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h | 1 + .../CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h | 1 + .../CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h | 1 + .../include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h | 3 ++- Nef_3/include/CGAL/Nef_3/SNC_SM_explorer.h | 1 + STL_Extension/include/CGAL/iterator.h | 4 ++++ 7 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h index c3f2d09f1f2..2674b63e66b 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h @@ -357,6 +357,7 @@ public: : _inner(inner), _outer(outer) {} Unary_compose(const Unary_compose& other) = default; + Unary_compose& operator=(const Unary_compose& other) = default; Unary_compose() : _inner(::boost::none),_outer(::boost::none) {} diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h index 88235d5d90a..974e26d0a57 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h @@ -1148,6 +1148,7 @@ public: //! Copy constructor Bitstream_descartes(const Self& other) = default; + Bitstream_descartes& operator=(const Self& other) = default; /*! * \brief Constructor for a polynomial \c f diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h index d78d50acfd0..a2caaa91aaf 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h @@ -467,6 +467,7 @@ private: log_C_eps_ = n.log_C_eps_; } + Bitstream_descartes_E08_node(const Self&) = delete; Self& operator= (const Self&) = delete; }; // struct Bitstream_descartes_E08_node diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h index 869b758cb12..6ba6d3d47a2 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h @@ -558,6 +558,7 @@ private: log_C_eps_ = n.log_C_eps_; } + Bitstream_descartes_rndl_node(const Self&)=delete; Self& operator= (const Self&)=delete; }; // struct Bitstream_descartes_rndl_node diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h index 27ca4692e72..59b5f208021 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_segment_2_primitive.h @@ -35,7 +35,8 @@ public: { } - AABB_segment_2_primitive(const AABB_segment_2_primitive &primitive) = default; + AABB_segment_2_primitive(const AABB_segment_2_primitive& primitive) = default; + AABB_segment_2_primitive& operator=(const AABB_segment_2_primitive& primitive) = default; const Id &id() const { diff --git a/Nef_3/include/CGAL/Nef_3/SNC_SM_explorer.h b/Nef_3/include/CGAL/Nef_3/SNC_SM_explorer.h index 95440eb3bd8..cef97636549 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_SM_explorer.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_SM_explorer.h @@ -30,6 +30,7 @@ class SNC_SM_explorer : public SMCDEC { public: SNC_SM_explorer(const Base& E) : Base(E) {} + SNC_SM_explorer(const Self& E) = default; Self& operator=(const Self& E) = default; }; diff --git a/STL_Extension/include/CGAL/iterator.h b/STL_Extension/include/CGAL/iterator.h index e395ab3c76f..ea9a964c8a3 100644 --- a/STL_Extension/include/CGAL/iterator.h +++ b/STL_Extension/include/CGAL/iterator.h @@ -1283,6 +1283,8 @@ template < typename D, typename V = std::tuple<>, typename O = std::tuple<> > struct Derivator { typedef Derivator Self; + Derivator() = default; + Derivator(const Self&) = default; Self& operator=(const Self&) = delete; template void tuple_dispatch(const Tuple&) @@ -1296,6 +1298,8 @@ struct Derivator, std::tuple > typedef Derivator, std::tuple > Self; typedef Derivator, std::tuple > Base; + Derivator() = default; + Derivator(const Self&) = default; Self& operator=(const Self&) = delete; using Base::operator=; From fd00ce2d02941a8547d3502c5b403d90d4f149c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 21 Nov 2022 16:02:04 +0100 Subject: [PATCH 141/194] seems that the no_parameter function is no longer needed --- .../test_corefinement_and_constraints.cpp | 4 ++-- STL_Extension/include/CGAL/Named_function_parameters.h | 8 -------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_and_constraints.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_and_constraints.cpp index 889a92636bf..1eec758737e 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_and_constraints.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_and_constraints.cpp @@ -176,8 +176,8 @@ void test_bool_op_no_copy( params::edge_is_constrained_map(ecm2), std::make_tuple(params::edge_is_constrained_map(ecm_out_union), params::edge_is_constrained_map(ecm_out_inter), - params::no_parameters(params::edge_is_constrained_map(ecm_out_union)), - params::no_parameters(params::edge_is_constrained_map(ecm_out_union)))); + params::default_values(), + params::default_values())); // dump_constrained_edges(*(*output[0]), ecm_out_union, "out_cst_union.cgal"); // dump_constrained_edges(*(*output[1]), ecm_out_inter, "out_cst_inter.cgal"); diff --git a/STL_Extension/include/CGAL/Named_function_parameters.h b/STL_Extension/include/CGAL/Named_function_parameters.h index 06d9043ab33..243ed7b4be5 100644 --- a/STL_Extension/include/CGAL/Named_function_parameters.h +++ b/STL_Extension/include/CGAL/Named_function_parameters.h @@ -426,14 +426,6 @@ inline all_default() } #endif -template -Named_function_parameters -inline no_parameters(Named_function_parameters) -{ - typedef Named_function_parameters Params; - return Params(); -} - template struct Boost_parameter_compatibility_wrapper { From 718214bf4fb3e6f2e42dd2bced44f5ac6a5c174a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 21 Nov 2022 19:26:35 +0100 Subject: [PATCH 142/194] fix include --- .../CGAL/Polygon_mesh_processing/repair_self_intersections.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h index bee807468a2..0a52404278f 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h @@ -20,10 +20,10 @@ #include #include #include -#include #include #include #include +#include #ifndef CGAL_PMP_REMOVE_SELF_INTERSECTION_NO_POLYHEDRAL_ENVELOPE_CHECK #include #endif From 5a992f60a44ea369fe9e20bef0d060ac935bd867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 22 Nov 2022 10:31:34 +0100 Subject: [PATCH 143/194] split repair --- .../combinatorial_repair.h | 60 +++++++++++++++++++ .../{repair.h => geometric_repair.h} | 28 ++++----- .../include/CGAL/license/gpl_package_list.txt | 3 +- .../internal/Snapping/helper.h | 2 +- .../internal/Snapping/snap.h | 2 +- .../internal/Snapping/snap_vertices.h | 2 +- .../internal/repair_extra.h | 2 +- .../internal/simplify_polyline.h | 2 +- .../Polygon_mesh_processing/manifoldness.h | 2 +- .../merge_border_vertices.h | 2 +- .../orient_polygon_soup_extension.h | 2 +- .../polygon_mesh_to_polygon_soup.h | 2 +- .../polygon_soup_to_polygon_mesh.h | 2 +- .../CGAL/Polygon_mesh_processing/repair.h | 2 +- .../repair_degeneracies.h | 2 +- .../repair_polygon_soup.h | 2 +- .../repair_self_intersections.h | 2 +- .../shape_predicates.h | 2 +- .../Polygon_mesh_processing/stitch_borders.h | 2 +- 19 files changed, 92 insertions(+), 31 deletions(-) create mode 100644 Installation/include/CGAL/license/Polygon_mesh_processing/combinatorial_repair.h rename Installation/include/CGAL/license/Polygon_mesh_processing/{repair.h => geometric_repair.h} (53%) diff --git a/Installation/include/CGAL/license/Polygon_mesh_processing/combinatorial_repair.h b/Installation/include/CGAL/license/Polygon_mesh_processing/combinatorial_repair.h new file mode 100644 index 00000000000..cf07529839b --- /dev/null +++ b/Installation/include/CGAL/license/Polygon_mesh_processing/combinatorial_repair.h @@ -0,0 +1,60 @@ +// Copyright (c) 2016 GeometryFactory SARL (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org) +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Andreas Fabri +// +// Warning: this file is generated, see include/CGAL/licence/README.md +// not entirely true due to the backward compatibility issue + +#ifndef CGAL_LICENSE_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_H +#define CGAL_LICENSE_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_H + +#include +#include + +// backward compatibility +#ifdef CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE +#define CGAL_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_COMMERCIAL_LICENSE CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE +#endif + +#ifdef CGAL_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_COMMERCIAL_LICENSE + +# if CGAL_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE + +# if defined(CGAL_LICENSE_WARNING) + + CGAL_pragma_warning("Your commercial license for CGAL does not cover " + "this release of the Polygon Mesh Processing - Combinatorial Repair package.") +# endif + +# ifdef CGAL_LICENSE_ERROR +# error "Your commercial license for CGAL does not cover this release \ + of the Polygon Mesh Processing - Combinatorial Repair package. \ + You get this error, as you defined CGAL_LICENSE_ERROR." +# endif // CGAL_LICENSE_ERROR + +# endif // CGAL_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE + +#else // no CGAL_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_COMMERCIAL_LICENSE + +# if defined(CGAL_LICENSE_WARNING) + CGAL_pragma_warning("\nThe macro CGAL_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_COMMERCIAL_LICENSE is not defined." + "\nYou use the CGAL Polygon Mesh Processing - Combinatorial Repair package under " + "the terms of the GPLv3+.") +# endif // CGAL_LICENSE_WARNING + +# ifdef CGAL_LICENSE_ERROR +# error "The macro CGAL_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_COMMERCIAL_LICENSE is not defined.\ + You use the CGAL Polygon Mesh Processing - Combinatorial Repair package under the terms of \ + the GPLv3+. You get this error, as you defined CGAL_LICENSE_ERROR." +# endif // CGAL_LICENSE_ERROR + +#endif // no CGAL_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_COMMERCIAL_LICENSE + +#endif // CGAL_LICENSE_POLYGON_MESH_PROCESSING_COMBINATORIAL_REPAIR_H diff --git a/Installation/include/CGAL/license/Polygon_mesh_processing/repair.h b/Installation/include/CGAL/license/Polygon_mesh_processing/geometric_repair.h similarity index 53% rename from Installation/include/CGAL/license/Polygon_mesh_processing/repair.h rename to Installation/include/CGAL/license/Polygon_mesh_processing/geometric_repair.h index 1c4e7be9825..affdde5cfc6 100644 --- a/Installation/include/CGAL/license/Polygon_mesh_processing/repair.h +++ b/Installation/include/CGAL/license/Polygon_mesh_processing/geometric_repair.h @@ -11,44 +11,44 @@ // // Warning: this file is generated, see include/CGAL/licence/README.md -#ifndef CGAL_LICENSE_POLYGON_MESH_PROCESSING_REPAIR_H -#define CGAL_LICENSE_POLYGON_MESH_PROCESSING_REPAIR_H +#ifndef CGAL_LICENSE_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_H +#define CGAL_LICENSE_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_H #include #include -#ifdef CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE +#ifdef CGAL_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_COMMERCIAL_LICENSE -# if CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE +# if CGAL_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE # if defined(CGAL_LICENSE_WARNING) CGAL_pragma_warning("Your commercial license for CGAL does not cover " - "this release of the Polygon Mesh Processing - Repair package.") + "this release of the Polygon Mesh Processing - Geometric Repair package.") # endif # ifdef CGAL_LICENSE_ERROR # error "Your commercial license for CGAL does not cover this release \ - of the Polygon Mesh Processing - Repair package. \ + of the Polygon Mesh Processing - Geometric Repair package. \ You get this error, as you defined CGAL_LICENSE_ERROR." # endif // CGAL_LICENSE_ERROR -# endif // CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE +# endif // CGAL_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_COMMERCIAL_LICENSE < CGAL_RELEASE_DATE -#else // no CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE +#else // no CGAL_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_COMMERCIAL_LICENSE # if defined(CGAL_LICENSE_WARNING) - CGAL_pragma_warning("\nThe macro CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE is not defined." - "\nYou use the CGAL Polygon Mesh Processing - Repair package under " + CGAL_pragma_warning("\nThe macro CGAL_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_COMMERCIAL_LICENSE is not defined." + "\nYou use the CGAL Polygon Mesh Processing - Geometric Repair package under " "the terms of the GPLv3+.") # endif // CGAL_LICENSE_WARNING # ifdef CGAL_LICENSE_ERROR -# error "The macro CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE is not defined.\ - You use the CGAL Polygon Mesh Processing - Repair package under the terms of \ +# error "The macro CGAL_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_COMMERCIAL_LICENSE is not defined.\ + You use the CGAL Polygon Mesh Processing - Geometric Repair package under the terms of \ the GPLv3+. You get this error, as you defined CGAL_LICENSE_ERROR." # endif // CGAL_LICENSE_ERROR -#endif // no CGAL_POLYGON_MESH_PROCESSING_REPAIR_COMMERCIAL_LICENSE +#endif // no CGAL_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_COMMERCIAL_LICENSE -#endif // CGAL_LICENSE_POLYGON_MESH_PROCESSING_REPAIR_H +#endif // CGAL_LICENSE_POLYGON_MESH_PROCESSING_GEOMETRIC_REPAIR_H diff --git a/Installation/include/CGAL/license/gpl_package_list.txt b/Installation/include/CGAL/license/gpl_package_list.txt index 28c3cd25f87..79dc8fd362c 100644 --- a/Installation/include/CGAL/license/gpl_package_list.txt +++ b/Installation/include/CGAL/license/gpl_package_list.txt @@ -55,7 +55,8 @@ Polygon_mesh_processing/measure Polygon Mesh Processing - Geometric Measure Polygon_mesh_processing/meshing_hole_filling Polygon Mesh Processing - Meshing and Hole Filling Polygon_mesh_processing/orientation Polygon Mesh Processing - Orientation Polygon_mesh_processing/predicate Polygon Mesh Processing - Predicate -Polygon_mesh_processing/repair Polygon Mesh Processing - Repair +Polygon_mesh_processing/combinatorial_repair Polygon Mesh Processing - Combinatorial Repair +Polygon_mesh_processing/geometric_repair Polygon Mesh Processing - Geometric Repair Polygon_mesh_processing/miscellaneous Polygon Mesh Processing - Miscellaneous Polygon_mesh_processing/detect_features Polygon Mesh Processing - Feature Detection Polygon_mesh_processing/collision_detection Polygon Mesh Processing - Collision Detection diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/helper.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/helper.h index ce67cc83a84..af813961029 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/helper.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/helper.h @@ -13,7 +13,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_INTERNAL_SNAPPING_HELPER_H #define CGAL_POLYGON_MESH_PROCESSING_INTERNAL_SNAPPING_HELPER_H -#include +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h index 4520e825de5..1ceaad6ce38 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h @@ -14,7 +14,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_SNAPPING_SNAP_H #define CGAL_POLYGON_MESH_PROCESSING_SNAPPING_SNAP_H -#include +#include #ifdef CGAL_PMP_SNAP_DEBUG_PP #ifndef CGAL_PMP_SNAP_DEBUG diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap_vertices.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap_vertices.h index 91f1a51952b..27ad666a2a0 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap_vertices.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap_vertices.h @@ -13,7 +13,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_SNAPPING_SNAP_VERTICES_H #define CGAL_POLYGON_MESH_PROCESSING_SNAPPING_SNAP_VERTICES_H -#include +#include #ifdef CGAL_PMP_SNAP_DEBUG_PP #ifndef CGAL_PMP_SNAP_DEBUG diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/repair_extra.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/repair_extra.h index af22ed1df25..2e3b8a63d7a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/repair_extra.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/repair_extra.h @@ -14,7 +14,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_INTERNAL_REPAIR_EXTRA_H #define CGAL_POLYGON_MESH_PROCESSING_INTERNAL_REPAIR_EXTRA_H -#include +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/simplify_polyline.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/simplify_polyline.h index 016dedea22d..74fc83d0ec8 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/simplify_polyline.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/simplify_polyline.h @@ -13,7 +13,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_SIMPLIFY_POLYLINE_H #define CGAL_POLYGON_MESH_PROCESSING_SIMPLIFY_POLYLINE_H -#include +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/manifoldness.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/manifoldness.h index 096cbd61ff5..9df968777c2 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/manifoldness.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/manifoldness.h @@ -13,7 +13,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_MANIFOLDNESS_H #define CGAL_POLYGON_MESH_PROCESSING_MANIFOLDNESS_H -#include +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/merge_border_vertices.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/merge_border_vertices.h index b0a97548d83..df7d51927e5 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/merge_border_vertices.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/merge_border_vertices.h @@ -14,7 +14,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_MERGE_BORDER_VERTICES_H #define CGAL_POLYGON_MESH_PROCESSING_MERGE_BORDER_VERTICES_H -#include +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orient_polygon_soup_extension.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orient_polygon_soup_extension.h index 14defb6b29e..612620049a0 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orient_polygon_soup_extension.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orient_polygon_soup_extension.h @@ -15,7 +15,7 @@ #ifndef CGAL_ORIENT_POLYGON_SOUP_EXTENSION_H #define CGAL_ORIENT_POLYGON_SOUP_EXTENSION_H -#include +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_mesh_to_polygon_soup.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_mesh_to_polygon_soup.h index 5766b85593f..a928499de25 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_mesh_to_polygon_soup.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_mesh_to_polygon_soup.h @@ -13,7 +13,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_POLYGON_MESH_TO_POLYGON_SOUP_H #define CGAL_POLYGON_MESH_PROCESSING_POLYGON_MESH_TO_POLYGON_SOUP_H -#include +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h index 45f76b3aa71..bb2c5f68454 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h @@ -13,7 +13,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_POLYGON_SOUP_TO_POLYGON_MESH_H #define CGAL_POLYGON_MESH_PROCESSING_POLYGON_SOUP_TO_POLYGON_MESH_H -#include +#include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h index 9e9827f08fe..7ae0e9a75aa 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h @@ -14,7 +14,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_REPAIR_H #define CGAL_POLYGON_MESH_PROCESSING_REPAIR_H -#include +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h index 818e5809e37..94c039965de 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h @@ -13,7 +13,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_REPAIR_DEGENERACIES_H #define CGAL_POLYGON_MESH_PROCESSING_REPAIR_DEGENERACIES_H -#include +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h index 219a4925c24..7d42bfb0520 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h @@ -12,7 +12,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_REPAIR_POLYGON_SOUP #define CGAL_POLYGON_MESH_PROCESSING_REPAIR_POLYGON_SOUP -#include +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h index bee807468a2..a2af245c8b9 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h @@ -13,7 +13,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_REPAIR_SELF_INTERSECTIONS_H #define CGAL_POLYGON_MESH_PROCESSING_REPAIR_SELF_INTERSECTIONS_H -#include +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/shape_predicates.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/shape_predicates.h index 3eb3fa892e6..f56ac96e5eb 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/shape_predicates.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/shape_predicates.h @@ -14,7 +14,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_SHAPE_PREDICATES_H #define CGAL_POLYGON_MESH_PROCESSING_SHAPE_PREDICATES_H -#include +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h index 7fdd1a05fc3..494251b3e21 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h @@ -14,7 +14,7 @@ #ifndef CGAL_POLYGON_MESH_PROCESSING_STITCH_BORDERS_H #define CGAL_POLYGON_MESH_PROCESSING_STITCH_BORDERS_H -#include +#include #include #include From 550d86cc0d3a754699cb19374942707e21f17e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 22 Nov 2022 10:48:27 +0100 Subject: [PATCH 144/194] update doc --- .../PackageDescription.txt | 10 +++- .../Polygon_mesh_processing.txt | 53 ++++++++++--------- .../internal/Snapping/snap.h | 2 +- .../internal/Snapping/snap_vertices.h | 2 +- .../Polygon_mesh_processing/manifoldness.h | 6 +-- .../merge_border_vertices.h | 6 +-- .../polygon_mesh_to_polygon_soup.h | 2 +- .../polygon_soup_to_polygon_mesh.h | 4 +- .../CGAL/Polygon_mesh_processing/repair.h | 4 +- .../repair_degeneracies.h | 8 +-- .../repair_polygon_soup.h | 18 +++---- .../Polygon_mesh_processing/stitch_borders.h | 10 ++-- 12 files changed, 66 insertions(+), 59 deletions(-) diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt index 1699ca2a0f9..3906fe9dab3 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt @@ -32,7 +32,11 @@ /// Functions to test if there are self intersections, and to report faces that do intersect. /// \ingroup PkgPolygonMeshProcessingRef -/// \defgroup PMP_repairing_grp Combinatorial Repairing +/// \defgroup PMP_combinatorial_repair_grp Combinatorial Repair +/// Functions to repair polygon soups and polygon meshes. +/// \ingroup PkgPolygonMeshProcessingRef + +/// \defgroup PMP_geometric_repair_grp Geometric Repair /// Functions to repair polygon soups and polygon meshes. /// \ingroup PkgPolygonMeshProcessingRef @@ -162,7 +166,7 @@ The page \ref bgl_namedparameters "Named Parameters" describes their usage. - `CGAL::Polyhedral_envelope` - `CGAL::Side_of_triangle_mesh` -\cgalCRPSection{Combinatorial Repairing Functions} +\cgalCRPSection{Combinatorial Repair Functions} - `CGAL::Polygon_mesh_processing::merge_duplicate_points_in_polygon_soup()` - `CGAL::Polygon_mesh_processing::merge_duplicate_polygons_in_polygon_soup()` - `CGAL::Polygon_mesh_processing::remove_isolated_points_in_polygon_soup()` @@ -179,6 +183,8 @@ The page \ref bgl_namedparameters "Named Parameters" describes their usage. - `CGAL::Polygon_mesh_processing::duplicate_non_manifold_vertices()` - `CGAL::Polygon_mesh_processing::merge_duplicated_vertices_in_boundary_cycle()` - `CGAL::Polygon_mesh_processing::merge_duplicated_vertices_in_boundary_cycles()` + +\cgalCRPSection{Geometric Repair Functions} - `CGAL::Polygon_mesh_processing::remove_almost_degenerate_faces()` \cgalCRPSection{Connected Components} diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt index e7345cd3c4c..947c907a7b3 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt @@ -46,7 +46,8 @@ and smoothing algorithms. - \ref PMPPredicates : predicates that can be evaluated on the processed polygon. mesh, which includes point location and self intersection tests. - \ref PMPOrientation : checking or fixing the orientation of a polygon soup. -- \ref PMPRepairing : repair of polygon meshes and polygon soups. +- \ref PMPCombinatorialRepair : repair of polygon meshes and polygon soups. +- \ref PMPGeometricRepair : repair of the geometry of polygon meshes. - \ref PMPNormalComp : normal computation at vertices and on faces of a polygon mesh. - \ref PMPSlicer : functor able to compute the intersections of a polygon mesh with arbitrary planes (slicer). - \ref PMPConnectedComponents : methods to deal with connected @@ -746,7 +747,7 @@ This example shows how to correctly repair and orient a soup to get a mesh from **************************************** -\section PMPRepairing Combinatorial Repairing +\section PMPCombinatorialRepair Combinatorial Repair ******************* \subsection PSRepairing Polygon Soup Repairing @@ -785,31 +786,7 @@ with duplicated border edges. \cgalExample{Polygon_mesh_processing/stitch_borders_example.cpp} -\if READY_TO_PUBLISH - -\subsection DegenerateFaces Removing Degenerate Faces - -Some degenerate faces may be part of a given triangle mesh. -A face is considered \e degenerate if two of its vertices -share the same location, or more generally if its three vertices are collinear. -The function `CGAL::Polygon_mesh_processing::remove_degenerate_faces()` -removes those faces and fixes the connectivity of the newly cleaned up mesh. -It is also possible to remove isolated vertices from any polygon mesh, using the function -`CGAL::Polygon_mesh_processing::remove_isolated_vertices()`. - -\subsubsection RemoveDegenerateExample Example - -In the following example, the degenerate faces of a triangle mesh -are removed, the connectivity is fixed, and the number of removed faces -is output. - -\cgalExample{Polygon_mesh_processing/remove_degeneracies_example.cpp} -\endif - \subsection PMPManifoldness Polygon Mesh Manifoldness -This package offers repairing methods to clean ill-formed polygon soups, -see Section \ref PMPRepairing. - Non-manifold vertices can be detected using the function `CGAL::Polygon_mesh_processing::is_non_manifold_vertex()`. The function `CGAL::Polygon_mesh_processing::duplicate_non_manifold_vertices()` can be used to attempt to create a combinatorially manifold surface mesh by splitting any non-manifold vertex @@ -835,6 +812,9 @@ more than once (although, with different vertices) before reaching the initial b `CGAL::Polygon_mesh_processing::merge_duplicated_vertices_in_boundary_cycle()`, which merge vertices at identical positions, can be used to repair this configuration. +\section PMPGeometricRepair Geometric Repair +**************************************** + \subsection PMPRemoveCapsNeedles Removal of Almost Degenerate Triangle Faces Triangle faces of a mesh made up of almost collinear points are badly shaped elements that might not be desirable to have in a mesh. The function @@ -844,6 +824,27 @@ As some badly shaped elements are inevitable (the triangulation of a long cylind with only vertices on the top and bottom circles for example), extra parameters can be passed to prevent the removal of such elements (`collapse_length_threshold` and `flip_triangle_height_threshold`). +\if READY_TO_PUBLISH + +\subsection DegenerateFaces Removing Degenerate Faces + +Some degenerate faces may be part of a given triangle mesh. +A face is considered \e degenerate if two of its vertices +share the same location, or more generally if its three vertices are collinear. +The function `CGAL::Polygon_mesh_processing::remove_degenerate_faces()` +removes those faces and fixes the connectivity of the newly cleaned up mesh. +It is also possible to remove isolated vertices from any polygon mesh, using the function +`CGAL::Polygon_mesh_processing::remove_isolated_vertices()`. + +\subsubsection RemoveDegenerateExample Example + +In the following example, the degenerate faces of a triangle mesh +are removed, the connectivity is fixed, and the number of removed faces +is output. + +\cgalExample{Polygon_mesh_processing/remove_degeneracies_example.cpp} +\endif + **************************************** \section PMPNormalComp Computing Normals diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h index c25d805590f..1388ebaeb22 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h @@ -1009,7 +1009,7 @@ std::size_t snap_non_conformal_one_way(const HalfedgeRange& halfedge_range_S, } } -// \ingroup PMP_repairing_grp +// \ingroup PMP_geometric_repair_grp // // Attempts to snap the vertices in `halfedge_range_A` onto edges of `halfedge_range_B`, and reciprocally. // A vertex from the first range is only snapped to an edge of the second range if the distance to diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap_vertices.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap_vertices.h index e0d5e6163e2..10043e346a8 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap_vertices.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap_vertices.h @@ -1140,7 +1140,7 @@ std::size_t snap_vertices_two_way(const HalfedgeRange_A& halfedge_range_A, namespace experimental { -// \ingroup PMP_repairing_grp +// \ingroup PMP_geometric_repair_grp // // Attempts to snap the vertices in `halfedge_range_A` and `halfedge_range_B`. // A vertex from the first range and a vertex from the second range are only snapped diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/manifoldness.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/manifoldness.h index a0ddbb6b2ef..de45ca3150e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/manifoldness.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/manifoldness.h @@ -33,7 +33,7 @@ namespace CGAL { namespace Polygon_mesh_processing { -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// \brief returns whether a vertex of a polygon mesh is non-manifold. /// @@ -284,7 +284,7 @@ std::size_t make_umbrella_manifold(typename boost::graph_traits::ha } // end namespace internal -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// \brief collects the non-manifold vertices (if any) present in the mesh. /// @@ -394,7 +394,7 @@ OutputIterator non_manifold_vertices(const PolygonMesh& pm, return out; } -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// duplicates all the non-manifold vertices of the input mesh. /// diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/merge_border_vertices.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/merge_border_vertices.h index 364cc32fc69..27bda80bc9c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/merge_border_vertices.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/merge_border_vertices.h @@ -204,7 +204,7 @@ void detect_identical_mergeable_vertices( } } -// \ingroup PMP_repairing_grp +// \ingroup PMP_combinatorial_repair_grp // // merges target vertices of a list of halfedges. // Halfedges must be sorted in the list. @@ -259,7 +259,7 @@ void merge_vertices_in_range(const HalfedgeRange& sorted_hedges, } // end of internal -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// merges identical vertices around a cycle of boundary edges. /// @@ -319,7 +319,7 @@ void merge_duplicated_vertices_in_boundary_cycle(typename boost::graph_traits > } // namespace internal -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// adds the vertices and faces of a mesh into a (possibly non-empty) polygon soup. /// diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h index 1ff8673eed6..7f4878648ae 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h @@ -153,7 +153,7 @@ private: } // namespace internal /** -* \ingroup PMP_repairing_grp +* \ingroup PMP_combinatorial_repair_grp * * \brief returns `true` if the soup of polygons defines a valid polygon * mesh that can be handled by @@ -231,7 +231,7 @@ bool is_polygon_soup_a_polygon_mesh(const PolygonRange& polygons) } /** -* \ingroup PMP_repairing_grp +* \ingroup PMP_combinatorial_repair_grp * * builds a polygon mesh from a soup of polygons. * diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h index 7ae0e9a75aa..73828b33115 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h @@ -29,7 +29,7 @@ namespace CGAL { namespace Polygon_mesh_processing { -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_geometric_repair_grp /// /// \brief removes the isolated vertices from any polygon mesh. /// @@ -60,7 +60,7 @@ std::size_t remove_isolated_vertices(PolygonMesh& pmesh) return nb_removed; } -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_geometric_repair_grp /// /// \brief removes connected components whose area or volume is under a certain threshold value. /// diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h index c90ecc501c7..22be1f47e8e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h @@ -535,7 +535,7 @@ struct Filter_wrapper_for_cap_needle_removalneedle @@ -1034,7 +1034,7 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, return false; } -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_geometric_repair_grp /// removes all almost degenerate faces from a triangulated surface mesh. /// Equivalent to `remove_almost_degenerate_faces(faces(tmesh), tmesh, np)` template @@ -1326,7 +1326,7 @@ remove_a_border_edge(typename boost::graph_traits::edge_descriptor return remove_a_border_edge(ed, tm, input_range, edge_set, face_set); } -// \ingroup PMP_repairing_grp +// \ingroup PMP_geometric_repair_grp // // removes the degenerate edges from a triangulated surface mesh. // An edge is considered degenerate if its two extremities share the same location. @@ -1880,7 +1880,7 @@ bool remove_degenerate_edges(TriangleMesh& tmesh, return remove_degenerate_edges(edges(tmesh), tmesh, face_set, np); } -// \ingroup PMP_repairing_grp +// \ingroup PMP_geometric_repair_grp // // removes the degenerate faces from a triangulated surface mesh. // A face is considered degenerate if two of its vertices share the same location, diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h index 84a84733584..cb24ce8ae7c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h @@ -140,7 +140,7 @@ bool simplify_polygon(PointRange& points, return (removed_points_n != 0); } -// \ingroup PMP_repairing_grp +// \ingroup PMP_combinatorial_repair_grp // // For each polygon of the soup, removes consecutive identical (in a geometric sense) points. // @@ -194,7 +194,7 @@ std::size_t simplify_polygons_in_polygon_soup(PointRange& points, return simplified_polygons_n; } -// \ingroup PMP_repairing_grp +// \ingroup PMP_combinatorial_repair_grp // // splits "pinched" polygons, that is polygons for which a point appears more than once, // into multiple non-pinched polygons. @@ -291,7 +291,7 @@ std::size_t split_pinched_polygons_in_polygon_soup(PointRange& points, return new_polygons_n; } -// \ingroup PMP_repairing_grp +// \ingroup PMP_combinatorial_repair_grp // // removes polygons with fewer than 2 points from the soup. // @@ -334,7 +334,7 @@ std::size_t remove_invalid_polygons_in_polygon_soup(PointRange& /*points*/, return removed_polygons_n; } -// \ingroup PMP_repairing_grp +// \ingroup PMP_combinatorial_repair_grp // // Removes invalid array-based polygons, i.e. polygons which have two equal consecutive points. // @@ -397,7 +397,7 @@ std::size_t remove_invalid_polygons_in_array_polygon_soup(PointRange& points, } // end namespace internal -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// removes the isolated points from a polygon soup. /// A point is considered isolated if it does not appear in any polygon of the soup. @@ -500,7 +500,7 @@ std::size_t remove_isolated_points_in_polygon_soup(PointRange& points, return removed_points_n; } -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// \brief merges the duplicate points in a polygon soup. /// @@ -817,7 +817,7 @@ struct Duplicate_collector void dump(CGAL::Emptyset_iterator) { } }; -// \ingroup PMP_repairing_grp +// \ingroup PMP_combinatorial_repair_grp // // collects duplicate polygons in a polygon soup, that is polygons that share the same vertices in the same // order. @@ -897,7 +897,7 @@ DuplicateOutputIterator collect_duplicate_polygons(const PointRange& points, } // end namespace internal -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// merges the duplicate polygons in a polygon soup. Two polygons are duplicate if they share the same /// vertices in the same order. Note that the first vertex of the polygon does not matter, that is @@ -1104,7 +1104,7 @@ struct Polygon_soup_fixer > } // namespace internal -/// \ingroup PMP_repairing_grp +/// \ingroup PMP_combinatorial_repair_grp /// /// \brief cleans a given polygon soup through various repairing operations. /// diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h index b2878954478..e30f95fd289 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h @@ -1119,7 +1119,7 @@ std::size_t stitch_boundary_cycle(const typename boost::graph_traits Date: Tue, 22 Nov 2022 11:14:14 +0100 Subject: [PATCH 145/194] fix compilation in debug code --- .../CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h index ed60e69495c..dde882984b1 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h @@ -281,7 +281,8 @@ private: for (auto& kv : ons_map) { std::ostringstream oss; - oss << "dump_normals_normalized_" << kv.first << ".polylines.txt"; + oss << "dump_normals_normalized_[" + << kv.first.first << "_" << kv.first.second << "].polylines.txt"; std::ofstream ons(oss.str()); for (auto s : kv.second) ons << "2 " << s.source() << " " << s.target() << std::endl; From 85756cd8eae687945031333335de9ad501fbe212 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 22 Nov 2022 11:19:49 +0100 Subject: [PATCH 146/194] default cell_selector selects all cells with non-0 subdomain index not all cells --- .../tetrahedral_adaptive_remeshing_impl.h | 18 ++++++++++++++++++ .../include/CGAL/tetrahedral_remeshing.h | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h index 870b60cb1a9..966548be7c9 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h @@ -55,6 +55,24 @@ public: void after_flip(CellHandle /* c */) {} }; +template +struct All_cells_selected +{ + using key_type = typename Tr::Cell_handle; + using value_type = bool; + using reference = bool; + using category = boost::read_write_property_map_tag; + + friend value_type get(const All_cells_selected&, const key_type& c) + { + using SI = typename Tr::Cell::Subdomain_index; + return c->subdomain_index() != SI(); + } + friend void put(All_cells_selected&, const key_type&, const value_type) + {} //nothing to do : subdomain indices are updated in remeshing}; +}; + + template//default + Tetrahedral_remeshing::internal::All_cells_selected//default > ::type SelectionFunctor; SelectionFunctor cell_select = choose_parameter(get_parameter(np, internal_np::cell_selector), - Constant_property_map(true)); + Tetrahedral_remeshing::internal::All_cells_selected()); typedef std::pair Edge_vv; typedef typename internal_np::Lookup_named_param_def < From 207cd1ad667147842c02285aae52dc180d0bf45d Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 22 Nov 2022 11:59:48 +0100 Subject: [PATCH 147/194] add assertions --- .../internal/tetrahedral_adaptive_remeshing_impl.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h index 966548be7c9..4c8fac7609c 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h @@ -189,6 +189,7 @@ public: "1-facets_in_complex_after_split.off"); CGAL::Tetrahedral_remeshing::debug::dump_vertices_by_dimension( m_c3t3.triangulation(), "1-c3t3_vertices_after_split"); + CGAL::Tetrahedral_remeshing::debug::check_surface_patch_indices(m_c3t3); #endif #ifdef CGAL_DUMP_REMESHING_STEPS CGAL::Tetrahedral_remeshing::debug::dump_c3t3(m_c3t3, "1-split"); @@ -210,6 +211,7 @@ public: CGAL_assertion(debug::are_cell_orientations_valid(tr())); CGAL::Tetrahedral_remeshing::debug::dump_vertices_by_dimension( m_c3t3.triangulation(), "2-c3t3_vertices_after_collapse"); + CGAL::Tetrahedral_remeshing::debug::check_surface_patch_indices(m_c3t3); #endif #ifdef CGAL_DUMP_REMESHING_STEPS CGAL::Tetrahedral_remeshing::debug::dump_c3t3(m_c3t3, "2-collapse"); @@ -226,6 +228,7 @@ public: CGAL_assertion(debug::are_cell_orientations_valid(tr())); CGAL::Tetrahedral_remeshing::debug::dump_vertices_by_dimension( m_c3t3.triangulation(), "3-c3t3_vertices_after_flip"); + CGAL::Tetrahedral_remeshing::debug::check_surface_patch_indices(m_c3t3); #endif #ifdef CGAL_DUMP_REMESHING_STEPS CGAL::Tetrahedral_remeshing::debug::dump_c3t3(m_c3t3, "3-flip"); @@ -241,6 +244,7 @@ public: CGAL_assertion(debug::are_cell_orientations_valid(tr())); CGAL::Tetrahedral_remeshing::debug::dump_vertices_by_dimension( m_c3t3.triangulation(), "4-c3t3_vertices_after_smooth"); + CGAL::Tetrahedral_remeshing::debug::check_surface_patch_indices(m_c3t3); #endif #ifdef CGAL_DUMP_REMESHING_STEPS CGAL::Tetrahedral_remeshing::debug::dump_c3t3(m_c3t3, "4-smooth"); @@ -527,6 +531,7 @@ private: CGAL::Tetrahedral_remeshing::debug::dump_vertices_by_dimension( m_c3t3.triangulation(), "c3t3_vertices_"); + CGAL::Tetrahedral_remeshing::debug::check_surface_patch_indices(m_c3t3); #endif } 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 148/194] 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 149/194] 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 150/194] 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 151/194] 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 152/194] 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 153/194] 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 a1850bad44079aac19ceca111d75dc8f4510f077 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 22 Nov 2022 15:06:51 +0100 Subject: [PATCH 154/194] fix debug display --- .../internal/smooth_vertices.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h index dde882984b1..dd71aba145d 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h @@ -140,6 +140,20 @@ private: return n; } + template + std::string debug_to_string(const Patch_index i) + { + return std::to_string(i); + } + + template + std::string debug_to_string(const std::pair& pi) + { + std::string str = std::to_string(pi.first); + str.append("_").append(std::to_string(pi.second)); + return str; + } + template void compute_vertices_normals(const C3t3& c3t3, VertexNormalsMap& normals_map, @@ -282,7 +296,7 @@ private: { std::ostringstream oss; oss << "dump_normals_normalized_[" - << kv.first.first << "_" << kv.first.second << "].polylines.txt"; + << debug_to_string(kv.first) << "].polylines.txt"; std::ofstream ons(oss.str()); for (auto s : kv.second) ons << "2 " << s.source() << " " << s.target() << std::endl; From a90488fce5e5d7defb387d57560afda09819db38 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 22 Nov 2022 15:09:16 +0100 Subject: [PATCH 155/194] fix init_c3t3 for internal C3t3 the dimensions stored in vertices are made consistent by scanning the triangulation/subdomains/patches/features/corners, in this order. Dimensions are tagged like that : all have dimension 3, - then surface vertices are overridden with dimension 2, - feature vertices overridden with dimension 1, - corner vertices overridden with dimension 0. --- .../tetrahedral_adaptive_remeshing_impl.h | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h index 4c8fac7609c..0d68c959ccb 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h @@ -417,10 +417,7 @@ private: if (!input_is_c3t3()) { for (int i = 0; i < 4; ++i) - { - if (cit->vertex(i)->in_dimension() == -1) - cit->vertex(i)->set_dimension(3); - } + cit->vertex(i)->set_dimension(3); } #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG else if (input_is_c3t3() && m_c3t3.is_in_complex(cit)) @@ -449,8 +446,7 @@ private: for (int j = 0; j < 3; ++j) { Vertex_handle vij = f.first->vertex(Tr::vertex_triple_index(i, j)); - if (vij->in_dimension() == -1 || vij->in_dimension() > 2) - vij->set_dimension(2); + vij->set_dimension(2); } #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG ++nbf; @@ -482,12 +478,10 @@ private: m_c3t3.add_to_complex(e, 1); Vertex_handle v = e.first->vertex(e.second); - if (v->in_dimension() == -1 || v->in_dimension() > 1) - v->set_dimension(1); + v->set_dimension(1); v = e.first->vertex(e.third); - if (v->in_dimension() == -1 || v->in_dimension() > 1) - v->set_dimension(1); + v->set_dimension(1); #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG ++nbe; @@ -508,8 +502,7 @@ private: if(!m_c3t3.is_in_complex(vit)) m_c3t3.add_to_complex(vit, ++corner_id); - if (vit->in_dimension() == -1 || vit->in_dimension() > 0) - vit->set_dimension(0); + vit->set_dimension(0); vit->set_index(corner_id); From 16da969e88cf9ca926de63c40a1d21fea550d5f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 22 Nov 2022 17:06:22 +0100 Subject: [PATCH 156/194] Use OpenMesh::DefaultTraitsDouble directly instead of using custom traits --- .../Linear_cell_complex_2/openmesh_performance.h | 11 +---------- .../Cactus_deformation_session_OpenMesh.cpp | 15 ++++----------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_2/openmesh_performance.h b/Linear_cell_complex/benchmark/Linear_cell_complex_2/openmesh_performance.h index 71ff72ea813..afdb700c75b 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_2/openmesh_performance.h +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_2/openmesh_performance.h @@ -22,19 +22,10 @@ public: mesh.request_face_normals(); } - private: - - struct MyTraits : public OpenMesh::DefaultTraits - { - typedef OpenMesh::Vec3d Point; - typedef OpenMesh::Vec3d Normal; - }; - - typedef OpenMesh::TriMesh_ArrayKernelT Mesh; + typedef OpenMesh::TriMesh_ArrayKernelT Mesh; Mesh mesh; - private: void display_info() { diff --git a/Surface_mesh_deformation/test/Surface_mesh_deformation/Cactus_deformation_session_OpenMesh.cpp b/Surface_mesh_deformation/test/Surface_mesh_deformation/Cactus_deformation_session_OpenMesh.cpp index fe1aded57c0..06817a78b71 100644 --- a/Surface_mesh_deformation/test/Surface_mesh_deformation/Cactus_deformation_session_OpenMesh.cpp +++ b/Surface_mesh_deformation/test/Surface_mesh_deformation/Cactus_deformation_session_OpenMesh.cpp @@ -13,17 +13,10 @@ #include -struct DoubleTraits : public OpenMesh::DefaultTraits -{ - typedef OpenMesh::Vec3d Point; - typedef OpenMesh::Vec3d Normal; -}; - - -typedef OpenMesh::PolyMesh_ArrayKernelT Mesh; -typedef Mesh::Point Point; -typedef boost::graph_traits::vertex_descriptor vertex_descriptor; -typedef boost::graph_traits::vertex_iterator vertex_iterator; +typedef OpenMesh::PolyMesh_ArrayKernelT Mesh; +typedef Mesh::Point Point; +typedef boost::graph_traits::vertex_descriptor vertex_descriptor; +typedef boost::graph_traits::vertex_iterator vertex_iterator; typedef CGAL::Surface_mesh_deformation Deform_mesh_arap; typedef CGAL::Surface_mesh_deformation Deform_mesh_spoke; From adb10155fcc87552897a2ba1d245c768d932ec77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 22 Nov 2022 17:22:05 +0100 Subject: [PATCH 157/194] Use kernel traits to adapt put() to point coordinates type --- BGL/include/CGAL/boost/graph/properties_OpenMesh.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/properties_OpenMesh.h b/BGL/include/CGAL/boost/graph/properties_OpenMesh.h index 7f1d44979d1..6b2e69c1bb2 100644 --- a/BGL/include/CGAL/boost/graph/properties_OpenMesh.h +++ b/BGL/include/CGAL/boost/graph/properties_OpenMesh.h @@ -13,6 +13,8 @@ #include #include #include +#include + #include #ifndef OPEN_MESH_CLASS @@ -231,8 +233,8 @@ public: #if defined(CGAL_USE_OM_POINTS) const_cast(*pm.sm_).set_point(v,p); #else - const_cast(*pm.sm_).set_point - (v, typename OpenMesh::Point((float)p[0], (float)p[1], (float)p[2])); + typedef typename CGAL::Kernel_traits::type FT; + const_cast(*pm.sm_).set_point(v, typename OpenMesh::Point(FT(p[0]), FT(p[1]), FT(p[2]))); #endif } From c0ba9b479ebb39a13f50c4d6ae0a38bde09c5c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 22 Nov 2022 17:42:02 +0100 Subject: [PATCH 158/194] fix compilation issues --- .../CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h | 6 +++--- .../CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h index a2caaa91aaf..50ae06acee9 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h @@ -436,6 +436,9 @@ public: friend class CGAL::internal::Bitstream_descartes_E08_tree; friend class CGAL::internal::Bitstream_descartes_E08_tree_rep; + Bitstream_descartes_E08_node(const Self&) = default; + Self& operator= (const Self&) = delete; + private: // "node data" (set individually in subdivision) Integer lower_num_, upper_num_; // TODO use lower_num_, width_num_ instead @@ -466,9 +469,6 @@ private: log_eps_ = n.log_eps_; log_C_eps_ = n.log_C_eps_; } - - Bitstream_descartes_E08_node(const Self&) = delete; - Self& operator= (const Self&) = delete; }; // struct Bitstream_descartes_E08_node diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h index 6ba6d3d47a2..b86439473dd 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h @@ -524,6 +524,9 @@ public: friend class internal::Bitstream_descartes_rndl_tree; friend class internal::Bitstream_descartes_rndl_tree_rep; + + Bitstream_descartes_rndl_node(const Self&) = default; + Self& operator= (const Self&) = delete; private: // "node data" (set individually in subdivision) @@ -557,9 +560,6 @@ private: log_eps_ = n.log_eps_; log_C_eps_ = n.log_C_eps_; } - - Bitstream_descartes_rndl_node(const Self&)=delete; - Self& operator= (const Self&)=delete; }; // struct Bitstream_descartes_rndl_node From 3abb7366d5a5704a1e69cbb0eb15b9f2c5b67f99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 22 Nov 2022 17:46:01 +0100 Subject: [PATCH 159/194] Try to fix compatibility between Weights and OpenMesh --- .../include/CGAL/Weights/cotangent_weights.h | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Weights/include/CGAL/Weights/cotangent_weights.h b/Weights/include/CGAL/Weights/cotangent_weights.h index ba128a98502..dc070c5c493 100644 --- a/Weights/include/CGAL/Weights/cotangent_weights.h +++ b/Weights/include/CGAL/Weights/cotangent_weights.h @@ -193,6 +193,9 @@ public: // Surface_mesh_deformation -> Surface_mesh_deformation.h (default version) // Surface_mesh_parameterizer -> Orbifold_Tutte_parameterizer_3.h (default version) // Surface_mesh_skeletonization -> Mean_curvature_flow_skeletonization.h (clamped version) +// +// The API is a bit awkward: the template parameters VertexPointMap and GeomTraits +// are only meaningful in the API that calls the operator with a single parameter. template::type, typename GeomTraits = typename Kernel_traits< @@ -202,8 +205,6 @@ class Cotangent_weight using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - using FT = typename GeomTraits::FT; - private: // These class members are used only when the constructor initializing them // is used, but Surface_mesh_deformation has its own weight API locked @@ -224,12 +225,14 @@ public: // Common API whether mesh/vpm/traits are initialized in the constructor, // or passed in the operator() template - FT operator()(const halfedge_descriptor he, - const PolygonMesh& pmesh, - const VPM vpm, - const GT& traits) const + typename GT::FT + operator()(const halfedge_descriptor he, + const PolygonMesh& pmesh, + const VPM vpm, + const GT& traits) const { using Point_ref = typename boost::property_traits::reference; + using FT = typename GT::FT; if(is_border(he, pmesh)) return FT{0}; @@ -265,9 +268,10 @@ public: // That is the API called by Surface_mesh_deformation template - FT operator()(const halfedge_descriptor he, - const PolygonMesh& pmesh, - const VPM vpm) const + auto // kernel_traits::type::FT + operator()(const halfedge_descriptor he, + const PolygonMesh& pmesh, + const VPM vpm) const { using Point = typename boost::property_traits::value_type; using GT = typename Kernel_traits::type; @@ -286,7 +290,7 @@ public: m_bound_from_below(bound_from_below) { } - FT operator()(const halfedge_descriptor he) const + typename GeomTraits::FT operator()(const halfedge_descriptor he) const { CGAL_precondition(m_pmesh_ptr != nullptr); return this->operator()(he, *m_pmesh_ptr, m_vpm, m_traits); From 6fd4c1694240636e60f8cf8e8436de052098b23a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 22 Nov 2022 17:47:19 +0100 Subject: [PATCH 160/194] TWS --- .../CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h index b86439473dd..9d1084414cd 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree.h @@ -524,7 +524,7 @@ public: friend class internal::Bitstream_descartes_rndl_tree; friend class internal::Bitstream_descartes_rndl_tree_rep; - + Bitstream_descartes_rndl_node(const Self&) = default; Self& operator= (const Self&) = delete; From 613ae0d564c35b681d3f1745185d67a1b18a57c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 22 Nov 2022 18:33:43 +0100 Subject: [PATCH 161/194] Proper fix after botched fix (adb10155fcc) --- BGL/include/CGAL/boost/graph/properties_OpenMesh.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/properties_OpenMesh.h b/BGL/include/CGAL/boost/graph/properties_OpenMesh.h index 6b2e69c1bb2..bdc9cec7ef0 100644 --- a/BGL/include/CGAL/boost/graph/properties_OpenMesh.h +++ b/BGL/include/CGAL/boost/graph/properties_OpenMesh.h @@ -13,8 +13,6 @@ #include #include #include -#include - #include #ifndef OPEN_MESH_CLASS @@ -233,8 +231,9 @@ public: #if defined(CGAL_USE_OM_POINTS) const_cast(*pm.sm_).set_point(v,p); #else - typedef typename CGAL::Kernel_traits::type FT; - const_cast(*pm.sm_).set_point(v, typename OpenMesh::Point(FT(p[0]), FT(p[1]), FT(p[2]))); + typedef typename OpenMesh::vector_traits::value_type Scalar; + const_cast(*pm.sm_).set_point + (v, typename OpenMesh::Point(Scalar(p[0]), Scalar(p[1]), Scalar(p[2]))); #endif } From 386c6a3ac26f4d627773fee1a5a9f51b56bc8ab4 Mon Sep 17 00:00:00 2001 From: Mael Date: Tue, 22 Nov 2022 18:42:13 +0100 Subject: [PATCH 162/194] 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 d157adcb6ec39ae8c51a545cbda913a0f29f334b Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 23 Nov 2022 08:27:39 +0000 Subject: [PATCH 163/194] CGAL: Fixes for cmake 3.25 --- .../examples/Barycentric_coordinates_2/CMakeLists.txt | 4 ++-- .../test/Barycentric_coordinates_2/CMakeLists.txt | 4 ++-- .../examples/Polygonal_surface_reconstruction/CMakeLists.txt | 4 ++-- .../test/Polygonal_surface_reconstruction/CMakeLists.txt | 4 ++-- .../examples/Shape_regularization/CMakeLists.txt | 4 ++-- Shape_regularization/test/Shape_regularization/CMakeLists.txt | 4 ++-- Weights/examples/Weights/CMakeLists.txt | 4 ++-- Weights/test/Weights/CMakeLists.txt | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt b/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt index 772e3bb17a0..cc3c33324b5 100644 --- a/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt +++ b/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -project(Barycentric_coordinates_2_Examples) - cmake_minimum_required(VERSION 3.1...3.22) +project(Barycentric_coordinates_2_Examples) + find_package(CGAL REQUIRED COMPONENTS Core) create_single_source_cgal_program("segment_coordinates.cpp") diff --git a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt index aa85e483ff4..c1706930f9d 100644 --- a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt +++ b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -project(Barycentric_coordinates_2_Tests) - cmake_minimum_required(VERSION 3.1...3.22) +project(Barycentric_coordinates_2_Tests) + find_package(CGAL REQUIRED COMPONENTS Core) create_single_source_cgal_program("test_almost_degenerate_segment.cpp") diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt index 78163e83f4d..e242a60619e 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -project(Polygonal_surface_reconstruction_Examples) - cmake_minimum_required(VERSION 3.1...3.22) +project(Polygonal_surface_reconstruction_Examples) + # CGAL and its components find_package(CGAL REQUIRED) diff --git a/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt b/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt index fc715b2c92e..c417ae3898d 100644 --- a/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt +++ b/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -project(Polygonal_surface_reconstruction_Tests) - cmake_minimum_required(VERSION 3.1...3.22) +project(Polygonal_surface_reconstruction_Tests) + # CGAL and its components find_package(CGAL REQUIRED) diff --git a/Shape_regularization/examples/Shape_regularization/CMakeLists.txt b/Shape_regularization/examples/Shape_regularization/CMakeLists.txt index 83cb84969cd..94b9bfa588c 100644 --- a/Shape_regularization/examples/Shape_regularization/CMakeLists.txt +++ b/Shape_regularization/examples/Shape_regularization/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -project(Shape_regularization_Examples) - cmake_minimum_required(VERSION 3.1...3.22) +project(Shape_regularization_Examples) + find_package(CGAL REQUIRED COMPONENTS Core) # Find OSQP library and headers. diff --git a/Shape_regularization/test/Shape_regularization/CMakeLists.txt b/Shape_regularization/test/Shape_regularization/CMakeLists.txt index 3060457e2e2..17ed9754335 100644 --- a/Shape_regularization/test/Shape_regularization/CMakeLists.txt +++ b/Shape_regularization/test/Shape_regularization/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -project(Shape_regularization_Tests) - cmake_minimum_required(VERSION 3.1...3.22) +project(Shape_regularization_Tests) + find_package(CGAL REQUIRED COMPONENTS Core) # Find OSQP library and headers. diff --git a/Weights/examples/Weights/CMakeLists.txt b/Weights/examples/Weights/CMakeLists.txt index 6d8beeaf6e7..74e406bfec5 100644 --- a/Weights/examples/Weights/CMakeLists.txt +++ b/Weights/examples/Weights/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -project(Weights_Examples) - cmake_minimum_required(VERSION 3.1...3.22) +project(Weights_Examples) + find_package(CGAL REQUIRED COMPONENTS Core) create_single_source_cgal_program("weights.cpp") diff --git a/Weights/test/Weights/CMakeLists.txt b/Weights/test/Weights/CMakeLists.txt index fee76719f00..eefbbda9a6d 100644 --- a/Weights/test/Weights/CMakeLists.txt +++ b/Weights/test/Weights/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -project(Weights_Tests) - cmake_minimum_required(VERSION 3.1...3.22) +project(Weights_Tests) + find_package(CGAL REQUIRED COMPONENTS Core) create_single_source_cgal_program("test_uniform_weights.cpp") From 20dacdb0c766ea1c715b0829ae1ec43eed0a1c3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 23 Nov 2022 10:03:25 +0100 Subject: [PATCH 164/194] add check that cmake_minimum_required is the first line --- .../developer_scripts/test_merge_of_branch | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Scripts/developer_scripts/test_merge_of_branch b/Scripts/developer_scripts/test_merge_of_branch index 50e7f8c8c37..5ddb20bcf9c 100755 --- a/Scripts/developer_scripts/test_merge_of_branch +++ b/Scripts/developer_scripts/test_merge_of_branch @@ -117,6 +117,30 @@ if [ -n "${project_name_demo}" ]; then exit 1 fi +# check minimal version is the first instruction in cmake scripts +echo '.. Checking if all CMakeLists.txt starts with cmake_minimum_required...' +cmr_tests=$(for i in ^build*/test/*/CMakeLists.txt; do pkg=$(echo $i | awk -F "/" '{print $3}'); res=$(egrep -v "^\s*#" $i | grep -v "^\s*$" | head -n 1 | grep -v cmake_minimum_required); if [ -n "${res}" ]; then echo $pkg; fi; done) +cmr_examples=$(for i in ^build*/examples/*/CMakeLists.txt; do pkg=$(echo $i | awk -F "/" '{print $3}'); res=$(egrep -v "^s*#" $i | grep -v "^\s*$" | head -n 1 | grep -v cmake_minimum_required); if [ -n "${res}" ]; then echo $pkg; fi; done) +cmr_demo=$(for i in ^build*/demo/*/CMakeLists.txt; do pkg=$(echo $i | awk -F "/" '{print $3}'); res=$(egrep -v "^s*#" $i | grep -v "^\s*$" | head -n 1 | grep -v cmake_minimum_required); if [ -n "${res}" ]; then echo $pkg; fi; done) + +if [ -n "${cmr_tests}" ]; then + echo "CMakeLists in test with issues:" + echo ${cmr_tests} + exit 1 +fi + +if [ -n "${cmr_examples}" ]; then + echo "CMakeLists in examples with issues:" + echo ${cmr_examples} + exit 1 +fi + +if [ -n "${cmr_demo}" ]; then + echo "CMakeLists in demo with issues:" + echo ${cmr_demo} + exit 1 +fi + #check header files without SPDX license identifier echo '.. Checking SPDX license identifier presence in header files...' file_without_SPDX_identifiers=$(for pkg in `find */package_info -name 'license.txt' | awk -F "/" '{print $1}'`; do if [ -e ${pkg}/include ]; then find ${pkg}/include -type f \( -name '*.h' -o -name '*.hpp' \) | xargs -r grep -L "SPDX-License-Identifier"; fi; done) From b404f7337090bfcc921b3cef6a22d5f77979ebad Mon Sep 17 00:00:00 2001 From: SaillantNicolas <97436229+SaillantNicolas@users.noreply.github.com> Date: Wed, 23 Nov 2022 15:57:09 +0100 Subject: [PATCH 165/194] use an intermediate environment variable also move emoji-comment script --- .github/workflows/build_doc.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build_doc.yml b/.github/workflows/build_doc.yml index fe5614e4a78..3d2f2941c95 100644 --- a/.github/workflows/build_doc.yml +++ b/.github/workflows/build_doc.yml @@ -47,15 +47,7 @@ jobs: //get pullrequest url const pr_number = context.payload.issue.number return pr_number - - uses: actions/checkout@v3 - name: "checkout branch" - if: steps.get_round.outputs.result != 'stop' - with: - repository: ${{ github.repository }} - ref: refs/pull/${{ steps.get_pr_number.outputs.result }}/merge - token: ${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }} - fetch-depth: 2 - + - name: Emoji-comment uses: actions/github-script@v6 if: steps.get_round.outputs.result != 'stop' @@ -67,6 +59,16 @@ jobs: repo: context.repo.repo, content: 'rocket' }) + + - uses: actions/checkout@v3 + name: "checkout branch" + if: steps.get_round.outputs.result != 'stop' + with: + repository: ${{ github.repository }} + ref: refs/pull/${{ steps.get_pr_number.outputs.result }}/merge + token: ${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }} + fetch-depth: 2 + - name: install dependencies if: steps.get_round.outputs.result != 'stop' run: | @@ -151,11 +153,13 @@ jobs: }); - name: Post error + env: + ERRORMSG: ${{steps.build_and_run.outputs.DoxygenError}} uses: actions/github-script@v6 if: ${{ failure() && steps.get_round.outputs.result != 'stop' }} with: script: | - const error = `${{steps.build_and_run.outputs.DoxygenError}}` + const error = process.env.ERRORMSG const msg = "There was an error while building the doc: \n"+error github.rest.issues.createComment({ owner: "CGAL", From 876e69aeb4b886d83eb587aec52227668f79adfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 23 Nov 2022 18:08:13 +0100 Subject: [PATCH 166/194] add missing option that make the function almost useless if not present --- .../Polygon_mesh_processing/orientation.h | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h index 31595ae0213..cf517731c0c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h @@ -1646,6 +1646,12 @@ void merge_reversible_connected_components(PolygonMesh& pm, * \cgalParamExtra{If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` * should be available for the vertices of `pm`.} * \cgalParamNEnd + * \cgalParamNBegin{face_partition_id_map} + * \cgalParamDescription{a property map filled by this function and that will contain for each face + * the id of its surface component after reversal and stitching in the range in the range `[0, n - 1]`, + * with `n` the number of such components. + * \cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits::face_descriptor` as key type and `std::size_t` as value type} + * \cgalParamNEnd * \cgalNamedParamsEnd * * \sa reverse_face_orientations() @@ -1667,6 +1673,15 @@ bool compatible_orientations(const PolygonMesh& pm, Vpm vpm = parameters::choose_parameter(parameters::get_parameter(np, internal_np::vertex_point), get_const_property_map(vertex_point, pm)); + typedef typename internal_np::Lookup_named_param_def < + internal_np::face_partition_id_t, + NamedParameters, + Constant_property_map // default + >::type Partition_map; + + // cc id map if compatible edges were stitched + Partition_map partition_map = parameters::choose_parameter(parameters::get_parameter(np, internal_np::face_partition_id)); + typedef std::size_t F_cc_id; // Face cc-id typedef std::size_t E_id; // Edge id @@ -1753,6 +1768,8 @@ bool compatible_orientations(const PolygonMesh& pm, sorted_ids.insert(cc_id); // consider largest CC first, default and set its bit to 0 + std::size_t partition_id = 0; + std::vector partition_ids(nb_cc); for(F_cc_id cc_id : sorted_ids) { if (cc_handled[cc_id]) continue; @@ -1821,6 +1838,8 @@ bool compatible_orientations(const PolygonMesh& pm, continue; } cc_handled[id]=true; + CGAL_assertion(cc_bits[id]==false); + partition_ids[id] = partition_id; } // set bit of incompatible patches @@ -1839,13 +1858,19 @@ bool compatible_orientations(const PolygonMesh& pm, continue; } cc_handled[id]=true; + partition_ids[id] = partition_id; cc_bits[id]=true; } + ++partition_id; } // set the bit per face for (face_descriptor f : faces(pm)) - put(fbm, f, cc_bits[get(f_cc_ids,f)]); + { + std::size_t f_cc_id = get(f_cc_ids,f); + put(fbm, f, cc_bits[f_cc_id]); + put(partition_map, f, partition_ids[f_cc_id]); + } return true; } From 75e08a9736b17b8bc80f614fadf10a0c602b61e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 23 Nov 2022 18:36:43 +0100 Subject: [PATCH 167/194] typo --- .../include/CGAL/Polygon_mesh_processing/orientation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h index cf517731c0c..1458ca18b00 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h @@ -1648,7 +1648,7 @@ void merge_reversible_connected_components(PolygonMesh& pm, * \cgalParamNEnd * \cgalParamNBegin{face_partition_id_map} * \cgalParamDescription{a property map filled by this function and that will contain for each face - * the id of its surface component after reversal and stitching in the range in the range `[0, n - 1]`, + * the id of its surface component after reversal and stitching in the range `[0, n - 1]`, * with `n` the number of such components. * \cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits::face_descriptor` as key type and `std::size_t` as value type} * \cgalParamNEnd From b5c21e1f5db33a30fd4e6ea9bf472e2c22e0aa6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 23 Nov 2022 18:48:43 +0100 Subject: [PATCH 168/194] Http -> https + update some dead links --- AABB_tree/demo/AABB_tree/resources/about.html | 4 +- ...ebraic_real_quadratic_refinement_rep_bfi.h | 2 +- .../include/CGAL/_test_real_root_isolator.h | 6 +- .../ColorItemEditor.cpp | 4 +- .../ColorItemEditor.h | 4 +- .../CGAL/Arr_polycurve_basic_traits_2.h | 2 +- .../include/CGAL/IO/Fig_stream.h | 2 +- BGL/examples/BGL_LCC/normals_lcc.cpp | 2 +- BGL/examples/BGL_polyhedron_3/normals.cpp | 2 +- .../graph_traits_PolyMesh_ArrayKernelT.h | 2 +- .../graph/graph_traits_TriMesh_ArrayKernelT.h | 2 +- .../Min_sphere_of_spheres_d_pair.h | 8 +- CGAL_Core/include/CGAL/CORE/BigFloat.h | 2 +- CGAL_Core/include/CGAL/CORE/BigFloatRep.h | 2 +- CGAL_Core/include/CGAL/CORE/BigFloat_impl.h | 2 +- CGAL_Core/include/CGAL/CORE/BigInt.h | 2 +- CGAL_Core/include/CGAL/CORE/BigRat.h | 2 +- CGAL_Core/include/CGAL/CORE/CORE.h | 2 +- CGAL_Core/include/CGAL/CORE/CoreAux.h | 2 +- CGAL_Core/include/CGAL/CORE/CoreAux_impl.h | 2 +- CGAL_Core/include/CGAL/CORE/CoreDefs.h | 2 +- CGAL_Core/include/CGAL/CORE/CoreDefs_impl.h | 2 +- CGAL_Core/include/CGAL/CORE/CoreIO_impl.h | 2 +- CGAL_Core/include/CGAL/CORE/Expr.h | 2 +- CGAL_Core/include/CGAL/CORE/ExprRep.h | 2 +- CGAL_Core/include/CGAL/CORE/Expr_impl.h | 2 +- CGAL_Core/include/CGAL/CORE/Filter.h | 2 +- CGAL_Core/include/CGAL/CORE/MemoryPool.h | 2 +- CGAL_Core/include/CGAL/CORE/Promote.h | 2 +- CGAL_Core/include/CGAL/CORE/Real.h | 2 +- CGAL_Core/include/CGAL/CORE/RealRep.h | 2 +- CGAL_Core/include/CGAL/CORE/Real_impl.h | 2 +- CGAL_Core/include/CGAL/CORE/RefCount.h | 2 +- CGAL_Core/include/CGAL/CORE/Timer.h | 2 +- CGAL_Core/include/CGAL/CORE/extLong.h | 2 +- CGAL_Core/include/CGAL/CORE/extLong_impl.h | 2 +- CGAL_Core/include/CGAL/CORE/linearAlgebra.h | 2 +- CGAL_Core/include/CGAL/CORE/poly/Curves.h | 2 +- CGAL_Core/include/CGAL/CORE/poly/Curves.tcc | 2 +- CGAL_Core/include/CGAL/CORE/poly/Poly.h | 2 +- CGAL_Core/include/CGAL/CORE/poly/Poly.tcc | 2 +- CGAL_Core/include/CGAL/CORE/poly/Sturm.h | 2 +- CGAL_Core/include/CGAL/export/CORE.h | 2 +- CGAL_ImageIO/include/CGAL/ImageIO.h | 6 +- CGAL_ImageIO/include/CGAL/ImageIO/convert.h | 2 +- CGAL_ImageIO/include/CGAL/ImageIO/recbuffer.h | 2 +- CGAL_ImageIO/include/CGAL/ImageIO/recline.h | 2 +- CGAL_ImageIO/include/CGAL/ImageIO/typedefs.h | 2 +- .../doc/CGAL_ipelets/CGAL_ipelets.txt | 2 +- .../Circular_kernel_2/Circular_kernel_2.txt | 2 +- .../include/CGAL/IO/Dxf_reader.h | 2 +- .../include/CGAL/IO/Dxf_reader_doubles.h | 3 +- .../include/CGAL/IO/Dxf_variant_reader.h | 2 +- .../doc/Classification/Classification.txt | 5 +- .../Developer_manual/Chapter_checks.txt | 4 +- Documentation/doc/Documentation/License.txt | 6 +- .../doc/Documentation/Third_party.txt | 12 +- Documentation/doc/Documentation/main.txt | 2 +- Documentation/doc/biblio/cgal_manual.bib | 75 +++--- Documentation/doc/biblio/geom.bib | 229 ++++++++---------- .../doc/resources/1.8.13/BaseDoxyfile.in | 55 ++--- .../doc/resources/1.8.13/footer.html | 4 +- .../doc/resources/1.8.13/header.html | 2 +- .../doc/resources/1.8.13/header_package.html | 2 +- .../doc/resources/1.8.14/BaseDoxyfile.in | 16 +- .../doc/resources/1.8.14/footer.html | 4 +- .../doc/resources/1.8.14/header.html | 2 +- .../doc/resources/1.8.14/header_package.html | 2 +- .../doc/resources/1.8.20/BaseDoxyfile.in | 12 +- .../doc/resources/1.8.20/footer.html | 4 +- .../doc/resources/1.8.20/header.html | 2 +- .../doc/resources/1.8.20/header_package.html | 2 +- .../doc/resources/1.8.4/BaseDoxyfile.in | 32 +-- Documentation/doc/resources/1.8.4/footer.html | 4 +- Documentation/doc/resources/1.8.4/header.html | 8 +- .../doc/resources/1.8.4/header_package.html | 8 +- .../doc/resources/1.9.3/BaseDoxyfile.in | 14 +- Documentation/doc/resources/1.9.3/footer.html | 4 +- Documentation/doc/resources/1.9.3/header.html | 2 +- .../doc/resources/1.9.3/header_package.html | 2 +- .../doc/scripts/generate_how_to_cite.py | 6 +- .../scripts/html_output_post_processing.py | 4 +- Filtered_kernel/TODO | 2 +- .../internal/Static_filters/Angle_3.h | 2 +- .../internal/Static_filters/Do_intersect_3.h | 2 +- .../GraphicsView/fig_src/uml-design.graphml | 2 +- .../resources/about_CGAL.html | 2 +- Installation/CHANGES.md | 4 +- Installation/LICENSE.GPL | 8 +- Installation/LICENSE.LGPL | 2 +- Installation/cmake/modules/FindTBB.cmake | 2 +- Installation/doc_html/Manual/index.html | 4 +- Installation/doc_html/Manual/packages.html | 4 +- Installation/doc_html/index.html | 10 +- Installation/include/CGAL/config.h | 6 +- .../internal/Bbox_3_Line_3_do_intersect.h | 2 +- .../internal/Bbox_3_Ray_3_do_intersect.h | 2 +- .../internal/Bbox_3_Segment_3_do_intersect.h | 2 +- .../Iso_cuboid_3_Ray_3_do_intersect.h | 2 +- .../Iso_cuboid_3_Segment_3_do_intersect.h | 2 +- .../cmake/FindGoogleTest.cmake | 2 +- Linear_cell_complex/benchmark/README.TXT | 8 +- Maintenance/deb/sid/debian/README.Debian | 2 +- Maintenance/deb/sid/debian/copyright | 2 +- Maintenance/deb/sid/debian/rules | 6 +- Maintenance/deb/squeeze/debian/README.Debian | 2 +- Maintenance/deb/squeeze/debian/copyright | 2 +- Maintenance/deb/squeeze/debian/rules | 6 +- Maintenance/deb/wheezy/debian/README.Debian | 2 +- Maintenance/deb/wheezy/debian/copyright | 2 +- Maintenance/deb/wheezy/debian/rules | 6 +- .../cgal.geometryfactory.com/crontab | 2 +- .../boost/user-config.jam | 10 +- .../patch-qt-4.8/QtCore/qobjectdefs.h | 4 +- .../patch-qt-4.8/QtCore/qplugin.h | 4 +- .../patch-qt-4.8/QtCore/qobjectdefs.h | 4 +- .../patch-qt-4.8/QtCore/qplugin.h | 4 +- .../announcement/mailing-beta.eml | 2 +- .../public_release/announcement/mailing.eml | 2 +- .../test_handling/create_testresult_page | 6 +- .../filter_testsuite/create_testresult_page | 6 +- Mesh_3/benchmark/Mesh_3/concurrency.cpp | 2 +- .../doc/Number_types/CGAL/Sqrt_extension.h | 2 +- Number_types/include/CGAL/FPU.h | 14 +- Number_types/include/CGAL/GMP/Gmpz_type.h | 4 +- OpenNL/include/CGAL/OpenNL/bicgstab.h | 4 +- OpenNL/include/CGAL/OpenNL/blas.h | 4 +- .../include/CGAL/OpenNL/conjugate_gradient.h | 4 +- OpenNL/include/CGAL/OpenNL/full_vector.h | 4 +- OpenNL/include/CGAL/OpenNL/linear_solver.h | 4 +- OpenNL/include/CGAL/OpenNL/preconditioner.h | 4 +- OpenNL/include/CGAL/OpenNL/sparse_matrix.h | 4 +- .../package_info/OpenNL/long_description.txt | 2 +- .../test_p2t2_delaunay_performance.cpp | 2 +- .../demo/Periodic_3_triangulation_3/Scene.cpp | 2 +- .../resources/about.html | 4 +- .../icons/about_CGAL.html | 2 +- Polyhedron/demo/Polyhedron/Mainpage.md | 2 +- .../Display/Display_property_plugin.cpp | 2 +- .../Plugins/IO/Polylines_io_plugin.cpp | 2 +- .../PartitionDialog.ui | 2 +- .../Plugins/PCA/Basic_generator_widget.ui | 4 +- .../PMP/Point_inside_polyhedron_plugin.cpp | 2 +- .../Point_set/Register_point_sets_plugin.ui | 2 +- .../demo/Polyhedron/Polyhedron_demo.cpp | 2 +- .../Scene_polyhedron_selection_item.h | 2 +- .../demo/Polyhedron/Show_point_dialog.ui | 2 +- .../demo/Polyhedron/resources/about.html | 6 +- .../resources/about.html | 4 +- Profiling_tools/include/CGAL/Memory_sizer.h | 2 +- .../masters/additional/QBORE3D.mps | 4 +- .../masters/additional/QCAPRI.mps | 4 +- .../masters/additional/QRECIPE.mps | 4 +- .../masters/additional/fit1d.mps | 4 +- .../masters/additional/fit2d.mps | 4 +- .../masters/additional/scsd1.mps | 4 +- .../test_solver_data/masters/cgal/HS118.mps | 4 +- .../masters/cgal/PRIMALC1.mps | 4 +- .../test_solver_data/masters/cgal/QPTEST.mps | 2 +- .../masters/cgal/ZECEVIC2.mps | 4 +- .../CGAL/Mesh_complex_3_in_triangulation_3.h | 2 +- STL_Extension/include/CGAL/Handle_for.h | 2 +- .../internal/boost/relaxed_heap.hpp | 2 +- STL_Extension/include/CGAL/array.h | 2 +- .../include/CGAL/Eigen_diagonalize_traits.h | 2 +- Solver_interface/include/CGAL/Eigen_matrix.h | 2 +- .../include/CGAL/Eigen_solver_traits.h | 2 +- .../include/CGAL/Eigen_sparse_matrix.h | 4 +- Solver_interface/include/CGAL/Eigen_vector.h | 2 +- .../Spatial_searching/include/nanoflann.hpp | 8 +- .../include/CGAL/IO/Dxf_stream.h | 2 +- .../include/CGAL/IO/Dxf_writer.h | 2 +- .../File_formats/Supported_file_formats.txt | 4 +- .../internal/auxiliary/graph.h | 2 +- .../Triangulation_3/documentation/about.html | 2 +- .../include/CGAL/Regular_triangulation_3.h | 2 +- 176 files changed, 475 insertions(+), 496 deletions(-) diff --git a/AABB_tree/demo/AABB_tree/resources/about.html b/AABB_tree/demo/AABB_tree/resources/about.html index 8d2c41d1ea0..1ab9dc84c1b 100644 --- a/AABB_tree/demo/AABB_tree/resources/about.html +++ b/AABB_tree/demo/AABB_tree/resources/about.html @@ -2,8 +2,8 @@

AABB Tree Demo

Copyright ©2009 - INRIA Sophia Antipolis - Mediterranee

-

This application illustrates the AABB tree component + INRIA Sophia Antipolis - Mediterranee

+

This application illustrates the AABB tree component of CGAL, applied to polyhedron facets and edges.

See also the following chapters of the manual: diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_quadratic_refinement_rep_bfi.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_quadratic_refinement_rep_bfi.h index 19f447c08f2..18b7fa805dd 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_quadratic_refinement_rep_bfi.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_quadratic_refinement_rep_bfi.h @@ -45,7 +45,7 @@ namespace internal { * @Unpublished{abbott-quadratic, * author = {John Abbott}, * title = {Quadratic Interval Refinement for Real Roots}, - * url = {http://www.dima.unige.it/~abbott/}, + * url = {https://www.dima.unige.it/~abbott/}, * note = {Poster presented at the 2006 Internat. Sympos. on Symbolic and Algebraic Computation (ISSAC 2006)} * } diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_root_isolator.h b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_root_isolator.h index b79e47262b3..ce3d7b3fda1 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_root_isolator.h +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_root_isolator.h @@ -187,7 +187,7 @@ void test_real_root_isolator() { assert( n == number_of_roots); }{ //std::cout << "Kameny 3\n"; - // from http://www-sop.inria.fr/saga/POL/BASE/1.unipol + // from https://www-sop.inria.fr/saga/POL/BASE/1.unipol/ NT c = CGAL::ipower(NT(10),12); Polynomial P(NT(-3),NT(0),c); @@ -202,7 +202,7 @@ void test_real_root_isolator() { assert(3 == internal::check_intervals_real_root_isolator(P)); }{ //std::cout << "Kameny 4\n"; - // from http://www-sop.inria.fr/saga/POL/BASE/1.unipol + // from https://www-sop.inria.fr/saga/POL/BASE/1.unipol NT z(0); NT a = CGAL::ipower(NT(10),24); // a = 10^{24} @@ -218,7 +218,7 @@ void test_real_root_isolator() { assert( 4 == internal::check_intervals_real_root_isolator(P)); }{ //std::cout << "Polynomial with large and small clustered roots\n"; - // from http://www-sop.inria.fr/saga/POL/BASE/1.unipol + // from https://www-sop.inria.fr/saga/POL/BASE/1.unipol // there seems to be some error or misunderstanding NT z(0); diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.cpp index 2de4a0d6e28..ee1772a644b 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.cpp @@ -19,7 +19,7 @@ ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements - ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception @@ -31,7 +31,7 @@ ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be - ** met: http://www.gnu.org/copyleft/gpl.html. + ** met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.h index 13c6c13b06e..ea1a2ba7a47 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.h @@ -19,7 +19,7 @@ ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements - ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception @@ -31,7 +31,7 @@ ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be - ** met: http://www.gnu.org/copyleft/gpl.html. + ** met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h index ca5e8ce1447..dab9ffa9248 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h @@ -1114,7 +1114,7 @@ public: // model of this concept. // // The following implementation is inspired by - // http://stackoverflow.com/a/11816999/1915421 + // https://stackoverflow.com/a/11816999/1915421 template struct Void { diff --git a/Arrangement_on_surface_2/include/CGAL/IO/Fig_stream.h b/Arrangement_on_surface_2/include/CGAL/IO/Fig_stream.h index 0a89ec038a3..5fd87bc4e7b 100644 --- a/Arrangement_on_surface_2/include/CGAL/IO/Fig_stream.h +++ b/Arrangement_on_surface_2/include/CGAL/IO/Fig_stream.h @@ -164,7 +164,7 @@ enum Fig_depth /*! * \class A class for writing geometric objects in a FIG format (version 3.2). - * For more details, see: http://www.xfig.org/userman/fig-format.html + * For more details, see: https://mcj.sourceforge.net/ */ template class Fig_stream diff --git a/BGL/examples/BGL_LCC/normals_lcc.cpp b/BGL/examples/BGL_LCC/normals_lcc.cpp index c5d1e671ff0..da1177a7062 100644 --- a/BGL/examples/BGL_LCC/normals_lcc.cpp +++ b/BGL/examples/BGL_LCC/normals_lcc.cpp @@ -74,7 +74,7 @@ int main(int argc, char** argv) // Ad hoc property_map to store normals. Face_index_map is used to // map face_descriptors to a contiguous range of indices. See - // http://www.boost.org/libs/property_map/doc/vector_property_map.html + // https://www.boost.org/libs/property_map/doc/vector_property_map.html // for details. boost::vector_property_map normals(static_cast(num_faces(lcc)), get(CGAL::face_index, lcc)); diff --git a/BGL/examples/BGL_polyhedron_3/normals.cpp b/BGL/examples/BGL_polyhedron_3/normals.cpp index 9a67ba42b2d..711800cb8ab 100644 --- a/BGL/examples/BGL_polyhedron_3/normals.cpp +++ b/BGL/examples/BGL_polyhedron_3/normals.cpp @@ -79,7 +79,7 @@ int main(int argc, char** argv) // Ad hoc property_map to store normals. Face_index_map is used to // map face_descriptors to a contiguous range of indices. See - // http://www.boost.org/libs/property_map/doc/vector_property_map.html + // https://www.boost.org/libs/property_map/doc/vector_property_map.html // for details. boost::vector_property_map normals(static_cast(num_faces(P)), get(CGAL::face_index, P)); diff --git a/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h b/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h index a6e5bfe287d..5127f692a24 100644 --- a/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h +++ b/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h @@ -11,7 +11,7 @@ #ifndef CGAL_BOOST_GRAPH_GRAPH_TRAITS_POLYMESH_ARRAYKERNELT_H #define CGAL_BOOST_GRAPH_GRAPH_TRAITS_POLYMESH_ARRAYKERNELT_H -// http://openmesh.org/Documentation/OpenMesh-Doc-Latest/classOpenMesh_1_1Concepts_1_1KernelT.html +// https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a02182.html #include #include #include diff --git a/BGL/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h b/BGL/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h index 863dc50b075..512a4991e76 100644 --- a/BGL/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h +++ b/BGL/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h @@ -11,7 +11,7 @@ #ifndef CGAL_BOOST_GRAPH_GRAPH_TRAITS_TRIMESH_ARRAYKERNELT_H #define CGAL_BOOST_GRAPH_GRAPH_TRAITS_TRIMESH_ARRAYKERNELT_H -// http://openmesh.org/Documentation/OpenMesh-Doc-Latest/classOpenMesh_1_1Concepts_1_1KernelT.html +// https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-Doc-Latest/a02182.html #include #include #include diff --git a/Bounding_volumes/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_pair.h b/Bounding_volumes/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_pair.h index c3dcc29c393..e30576790c5 100644 --- a/Bounding_volumes/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_pair.h +++ b/Bounding_volumes/include/CGAL/Min_sphere_of_spheres_d/Min_sphere_of_spheres_d_pair.h @@ -42,7 +42,7 @@ namespace CGAL_MINIBALL_NAMESPACE { { // That constant is embedded in an inline static function, to // workaround a bug of g++>=4.1 - // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36912 + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36912 // g++ does not like const floating expression when -frounding-math // is used. static double result() { @@ -55,7 +55,7 @@ namespace CGAL_MINIBALL_NAMESPACE { { // That constant is embedded in an inline static function, to // workaround a bug of g++>=4.1 - // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36912 + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36912 // g++ does not like const floating expression when -frounding-math // is used. static float result() { @@ -68,7 +68,7 @@ namespace CGAL_MINIBALL_NAMESPACE { { // That constant is embedded in an inline static function, to // workaround a bug of g++>=4.1 - // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36912 + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36912 // g++ does not like const floating expression when -frounding-math // is used. static double result() { @@ -81,7 +81,7 @@ namespace CGAL_MINIBALL_NAMESPACE { { // That constant is embedded in an inline static function, to // workaround a bug of g++>=4.1 - // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36912 + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36912 // g++ does not like const floating expression when -frounding-math // is used. static float result() { diff --git a/CGAL_Core/include/CGAL/CORE/BigFloat.h b/CGAL_Core/include/CGAL/CORE/BigFloat.h index 97183f63e50..6c7a8abff4c 100644 --- a/CGAL_Core/include/CGAL/CORE/BigFloat.h +++ b/CGAL_Core/include/CGAL/CORE/BigFloat.h @@ -14,7 +14,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/BigFloatRep.h b/CGAL_Core/include/CGAL/CORE/BigFloatRep.h index 7439ce025a9..da8cb6967c8 100644 --- a/CGAL_Core/include/CGAL/CORE/BigFloatRep.h +++ b/CGAL_Core/include/CGAL/CORE/BigFloatRep.h @@ -14,7 +14,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/BigFloat_impl.h b/CGAL_Core/include/CGAL/CORE/BigFloat_impl.h index aa029b5c51b..dc828ae9379 100644 --- a/CGAL_Core/include/CGAL/CORE/BigFloat_impl.h +++ b/CGAL_Core/include/CGAL/CORE/BigFloat_impl.h @@ -23,7 +23,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/BigInt.h b/CGAL_Core/include/CGAL/CORE/BigInt.h index 7b16a960ac3..f88a5877c9b 100644 --- a/CGAL_Core/include/CGAL/CORE/BigInt.h +++ b/CGAL_Core/include/CGAL/CORE/BigInt.h @@ -14,7 +14,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/BigRat.h b/CGAL_Core/include/CGAL/CORE/BigRat.h index 29b99509d40..d57e4e44cd9 100644 --- a/CGAL_Core/include/CGAL/CORE/BigRat.h +++ b/CGAL_Core/include/CGAL/CORE/BigRat.h @@ -14,7 +14,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/CORE.h b/CGAL_Core/include/CGAL/CORE/CORE.h index 3fb78af5f83..a3e0b2ef83d 100644 --- a/CGAL_Core/include/CGAL/CORE/CORE.h +++ b/CGAL_Core/include/CGAL/CORE/CORE.h @@ -15,7 +15,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/CoreAux.h b/CGAL_Core/include/CGAL/CORE/CoreAux.h index 9d75668be3a..fdb6c5de7cf 100644 --- a/CGAL_Core/include/CGAL/CORE/CoreAux.h +++ b/CGAL_Core/include/CGAL/CORE/CoreAux.h @@ -14,7 +14,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/CoreAux_impl.h b/CGAL_Core/include/CGAL/CORE/CoreAux_impl.h index 3f22a4cdfa1..9b335c393b2 100644 --- a/CGAL_Core/include/CGAL/CORE/CoreAux_impl.h +++ b/CGAL_Core/include/CGAL/CORE/CoreAux_impl.h @@ -15,7 +15,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/CoreDefs.h b/CGAL_Core/include/CGAL/CORE/CoreDefs.h index 57c3da34645..e10ea21ec1a 100644 --- a/CGAL_Core/include/CGAL/CORE/CoreDefs.h +++ b/CGAL_Core/include/CGAL/CORE/CoreDefs.h @@ -17,7 +17,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/CoreDefs_impl.h b/CGAL_Core/include/CGAL/CORE/CoreDefs_impl.h index d28326496f3..ecc29261130 100644 --- a/CGAL_Core/include/CGAL/CORE/CoreDefs_impl.h +++ b/CGAL_Core/include/CGAL/CORE/CoreDefs_impl.h @@ -14,7 +14,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/CoreIO_impl.h b/CGAL_Core/include/CGAL/CORE/CoreIO_impl.h index 0e4a2044e74..59f4a7a63f6 100644 --- a/CGAL_Core/include/CGAL/CORE/CoreIO_impl.h +++ b/CGAL_Core/include/CGAL/CORE/CoreIO_impl.h @@ -11,7 +11,7 @@ * Zilin Du * Chee Yap * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/Expr.h b/CGAL_Core/include/CGAL/CORE/Expr.h index 5cd5092d7e9..94b086e24d3 100644 --- a/CGAL_Core/include/CGAL/CORE/Expr.h +++ b/CGAL_Core/include/CGAL/CORE/Expr.h @@ -18,7 +18,7 @@ * Sylvain Pion * Vikram Sharma * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/ExprRep.h b/CGAL_Core/include/CGAL/CORE/ExprRep.h index 7920485fff7..bc142c77b6c 100644 --- a/CGAL_Core/include/CGAL/CORE/ExprRep.h +++ b/CGAL_Core/include/CGAL/CORE/ExprRep.h @@ -18,7 +18,7 @@ * Sylvain Pion * Vikram Sharma * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/Expr_impl.h b/CGAL_Core/include/CGAL/CORE/Expr_impl.h index 5e3806024fa..69ccc73b616 100644 --- a/CGAL_Core/include/CGAL/CORE/Expr_impl.h +++ b/CGAL_Core/include/CGAL/CORE/Expr_impl.h @@ -16,7 +16,7 @@ * Zilin Du * Sylvain Pion * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/Filter.h b/CGAL_Core/include/CGAL/CORE/Filter.h index ea0a02da1fa..56649b80c86 100644 --- a/CGAL_Core/include/CGAL/CORE/Filter.h +++ b/CGAL_Core/include/CGAL/CORE/Filter.h @@ -17,7 +17,7 @@ * Zilin Du * Chee Yap * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/MemoryPool.h b/CGAL_Core/include/CGAL/CORE/MemoryPool.h index 606b9223b2b..60a95c862e2 100644 --- a/CGAL_Core/include/CGAL/CORE/MemoryPool.h +++ b/CGAL_Core/include/CGAL/CORE/MemoryPool.h @@ -14,7 +14,7 @@ * Chee Yap * Sylvain Pion * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/Promote.h b/CGAL_Core/include/CGAL/CORE/Promote.h index 62a98e434ef..d882b6abcf3 100644 --- a/CGAL_Core/include/CGAL/CORE/Promote.h +++ b/CGAL_Core/include/CGAL/CORE/Promote.h @@ -18,7 +18,7 @@ * Sylvain Pion * Vikram Sharma * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/Real.h b/CGAL_Core/include/CGAL/CORE/Real.h index b79503eb4c2..11174960dd2 100644 --- a/CGAL_Core/include/CGAL/CORE/Real.h +++ b/CGAL_Core/include/CGAL/CORE/Real.h @@ -18,7 +18,7 @@ * Zilin Du * Sylvain Pion * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/RealRep.h b/CGAL_Core/include/CGAL/CORE/RealRep.h index 5a18d2748d1..85f7818a884 100644 --- a/CGAL_Core/include/CGAL/CORE/RealRep.h +++ b/CGAL_Core/include/CGAL/CORE/RealRep.h @@ -16,7 +16,7 @@ * Zilin Du * Sylvain Pion * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/Real_impl.h b/CGAL_Core/include/CGAL/CORE/Real_impl.h index 8a6a4899c64..e7ac7379f4c 100644 --- a/CGAL_Core/include/CGAL/CORE/Real_impl.h +++ b/CGAL_Core/include/CGAL/CORE/Real_impl.h @@ -17,7 +17,7 @@ * Zilin Du * Sylvain Pion * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/RefCount.h b/CGAL_Core/include/CGAL/CORE/RefCount.h index 91fafbf074f..ba1c8416a4b 100644 --- a/CGAL_Core/include/CGAL/CORE/RefCount.h +++ b/CGAL_Core/include/CGAL/CORE/RefCount.h @@ -35,7 +35,7 @@ * Zilin Du * Chee Yap * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/Timer.h b/CGAL_Core/include/CGAL/CORE/Timer.h index a0f2ce9f152..0e998c0b020 100644 --- a/CGAL_Core/include/CGAL/CORE/Timer.h +++ b/CGAL_Core/include/CGAL/CORE/Timer.h @@ -23,7 +23,7 @@ * Written by * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/extLong.h b/CGAL_Core/include/CGAL/CORE/extLong.h index d20caf05589..52ba91e321a 100644 --- a/CGAL_Core/include/CGAL/CORE/extLong.h +++ b/CGAL_Core/include/CGAL/CORE/extLong.h @@ -17,7 +17,7 @@ * Chen Li * Zilin Du * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/extLong_impl.h b/CGAL_Core/include/CGAL/CORE/extLong_impl.h index 0baeb58fbcd..69d92131839 100644 --- a/CGAL_Core/include/CGAL/CORE/extLong_impl.h +++ b/CGAL_Core/include/CGAL/CORE/extLong_impl.h @@ -21,7 +21,7 @@ * Zilin Du * Sylvain Pion * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/linearAlgebra.h b/CGAL_Core/include/CGAL/CORE/linearAlgebra.h index 16da34e461a..3d760cc629b 100644 --- a/CGAL_Core/include/CGAL/CORE/linearAlgebra.h +++ b/CGAL_Core/include/CGAL/CORE/linearAlgebra.h @@ -22,7 +22,7 @@ * Written by * Shubin Zhao (shubinz@cs.nyu.edu) (2001) * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $Id$ diff --git a/CGAL_Core/include/CGAL/CORE/poly/Curves.h b/CGAL_Core/include/CGAL/CORE/poly/Curves.h index 65d1422d255..f1c9172e3e9 100644 --- a/CGAL_Core/include/CGAL/CORE/poly/Curves.h +++ b/CGAL_Core/include/CGAL/CORE/poly/Curves.h @@ -49,7 +49,7 @@ * Author: Vikram Sharma and Chee Yap * Date: April 12, 2004 * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/poly/Curves.tcc b/CGAL_Core/include/CGAL/CORE/poly/Curves.tcc index d9be84796c0..f21ddfec3a8 100644 --- a/CGAL_Core/include/CGAL/CORE/poly/Curves.tcc +++ b/CGAL_Core/include/CGAL/CORE/poly/Curves.tcc @@ -16,7 +16,7 @@ * Author: Vikram Sharma and Chee Yap * Date: April 12, 2004 * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/poly/Poly.h b/CGAL_Core/include/CGAL/CORE/poly/Poly.h index bd56376a5b2..50ec728b685 100644 --- a/CGAL_Core/include/CGAL/CORE/poly/Poly.h +++ b/CGAL_Core/include/CGAL/CORE/poly/Poly.h @@ -36,7 +36,7 @@ * Author: Chee Yap * Date: May 28, 2002 * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/poly/Poly.tcc b/CGAL_Core/include/CGAL/CORE/poly/Poly.tcc index 325f64d528c..604a86ad6e1 100644 --- a/CGAL_Core/include/CGAL/CORE/poly/Poly.tcc +++ b/CGAL_Core/include/CGAL/CORE/poly/Poly.tcc @@ -30,7 +30,7 @@ * Author: Chee Yap, Sylvain Pion and Vikram Sharma * Date: May 28, 2002 * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/CORE/poly/Sturm.h b/CGAL_Core/include/CGAL/CORE/poly/Sturm.h index 57fe5b26b7f..77ceab8c9ae 100644 --- a/CGAL_Core/include/CGAL/CORE/poly/Sturm.h +++ b/CGAL_Core/include/CGAL/CORE/poly/Sturm.h @@ -37,7 +37,7 @@ * Author: Chee Yap and Sylvain Pion, Vikram Sharma * Date: July 20, 2002 * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_Core/include/CGAL/export/CORE.h b/CGAL_Core/include/CGAL/export/CORE.h index 440239528a1..651387e610d 100644 --- a/CGAL_Core/include/CGAL/export/CORE.h +++ b/CGAL_Core/include/CGAL/export/CORE.h @@ -18,7 +18,7 @@ * Sylvain Pion * Vikram Sharma * - * WWW URL: http://cs.nyu.edu/exact/ + * WWW URL: https://cs.nyu.edu/exact/ * Email: exact@cs.nyu.edu * * $URL$ diff --git a/CGAL_ImageIO/include/CGAL/ImageIO.h b/CGAL_ImageIO/include/CGAL/ImageIO.h index 9c6b4281cc6..26ada2cfd76 100644 --- a/CGAL_ImageIO/include/CGAL/ImageIO.h +++ b/CGAL_ImageIO/include/CGAL/ImageIO.h @@ -24,7 +24,7 @@ #ifdef CGAL_USE_ZLIB #include -/* see http://www.gzip.org/zlib/ +/* see https://zlib.net/ for details and documentation */ #endif @@ -342,8 +342,8 @@ CGAL_IMAGEIO_EXPORT _image *_createImage(std::size_t x, std::size_t y, std::size GIS (CEA, IRISA, ENST 3D image format). See also: - http://www.dcs.ed.ac.uk/home/mxr/gfx/2d-hi.html and - http://www.gzip.org/zlib/ + https://www.martinreddy.net/gfx/2d-hi.html and + https://zlib.net/ @param name image file name or nullptr for stdin */ diff --git a/CGAL_ImageIO/include/CGAL/ImageIO/convert.h b/CGAL_ImageIO/include/CGAL/ImageIO/convert.h index 4cb73637c49..0119d73736d 100644 --- a/CGAL_ImageIO/include/CGAL/ImageIO/convert.h +++ b/CGAL_ImageIO/include/CGAL/ImageIO/convert.h @@ -19,7 +19,7 @@ * * AUTHOR: * Gregoire Malandain (greg@sophia.inria.fr) - * http://www.inria.fr/epidaure/personnel/malandain/ + * https://www-sop.inria.fr/members/Gregoire.Malandain/ * * CREATION DATE: * June, 9 1998 diff --git a/CGAL_ImageIO/include/CGAL/ImageIO/recbuffer.h b/CGAL_ImageIO/include/CGAL/ImageIO/recbuffer.h index 4fba58fb19b..9e35ebd637b 100644 --- a/CGAL_ImageIO/include/CGAL/ImageIO/recbuffer.h +++ b/CGAL_ImageIO/include/CGAL/ImageIO/recbuffer.h @@ -23,7 +23,7 @@ * * AUTHOR: * Gregoire Malandain (greg@sophia.inria.fr) - * http://www.inria.fr/epidaure/personnel/malandain/ + * https://www-sop.inria.fr/members/Gregoire.Malandain/ * * CREATION DATE: * June, 9 1998 diff --git a/CGAL_ImageIO/include/CGAL/ImageIO/recline.h b/CGAL_ImageIO/include/CGAL/ImageIO/recline.h index b8ae7b398a3..588bd8d6434 100644 --- a/CGAL_ImageIO/include/CGAL/ImageIO/recline.h +++ b/CGAL_ImageIO/include/CGAL/ImageIO/recline.h @@ -23,7 +23,7 @@ * * AUTHOR: * Gregoire Malandain (greg@sophia.inria.fr) - * http://www.inria.fr/epidaure/personnel/malandain/ + * https://www-sop.inria.fr/members/Gregoire.Malandain/ * * CREATION DATE: * June, 9 1998 diff --git a/CGAL_ImageIO/include/CGAL/ImageIO/typedefs.h b/CGAL_ImageIO/include/CGAL/ImageIO/typedefs.h index c4c612cc6e3..a77de031f64 100644 --- a/CGAL_ImageIO/include/CGAL/ImageIO/typedefs.h +++ b/CGAL_ImageIO/include/CGAL/ImageIO/typedefs.h @@ -19,7 +19,7 @@ * * AUTHOR: * Gregoire Malandain (greg@sophia.inria.fr) - * http://www.inria.fr/epidaure/personnel/malandain/ + * https://www-sop.inria.fr/members/Gregoire.Malandain/ * * CREATION DATE: * June, 9 1998 diff --git a/CGAL_ipelets/doc/CGAL_ipelets/CGAL_ipelets.txt b/CGAL_ipelets/doc/CGAL_ipelets/CGAL_ipelets.txt index e5c3467650f..922e4e8f9bd 100644 --- a/CGAL_ipelets/doc/CGAL_ipelets/CGAL_ipelets.txt +++ b/CGAL_ipelets/doc/CGAL_ipelets/CGAL_ipelets.txt @@ -9,7 +9,7 @@ namespace CGAL { \section CGAL_ipeletsIntroduction Introduction -The Ipe extensible drawing editor (http://ipe.otfried.org) \cgalCite{schwarzkopf1995ede}, \cgalCite{ipe:man-09} +The Ipe extensible drawing editor (https://ipe.otfried.org/) \cgalCite{schwarzkopf1995ede}, \cgalCite{ipe:man-09} is a tool used by computational geometry researchers to produce 2D figures for inclusion in articles or presentations. The extensible adjective sheds a light on an important feature: the possibility for users to write small extensions (called ipelets) diff --git a/Circular_kernel_2/doc/Circular_kernel_2/Circular_kernel_2.txt b/Circular_kernel_2/doc/Circular_kernel_2/Circular_kernel_2.txt index 41a5e7b9db4..740788d9b14 100644 --- a/Circular_kernel_2/doc/Circular_kernel_2/Circular_kernel_2.txt +++ b/Circular_kernel_2/doc/Circular_kernel_2/Circular_kernel_2.txt @@ -90,7 +90,7 @@ also added more functionality in 2008. This work was partially supported by the IST Programme of the EU as a Shared-cost RTD (FET Open) Project under Contract No IST-2000-26473 -(ECG - Effective +(ECG - Effective Computational Geometry for Curves and Surfaces) and by the IST Programme of the 6th Framework Programme of the EU as a STREP (FET Open Scheme) Project under Contract No IST-006413 diff --git a/Circular_kernel_2/include/CGAL/IO/Dxf_reader.h b/Circular_kernel_2/include/CGAL/IO/Dxf_reader.h index bf00857272b..a66bd69bf63 100644 --- a/Circular_kernel_2/include/CGAL/IO/Dxf_reader.h +++ b/Circular_kernel_2/include/CGAL/IO/Dxf_reader.h @@ -16,7 +16,7 @@ // (ACS -- Algorithms for Complex Shapes) // Description of the file format can be found at the following address: -// http://www.autodesk.com/techpubs/autocad/acad2000/dxf/ +// https://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf #ifndef CGAL_IO_DXF_READER_H #define CGAL_IO_DXF_READER_H diff --git a/Circular_kernel_2/include/CGAL/IO/Dxf_reader_doubles.h b/Circular_kernel_2/include/CGAL/IO/Dxf_reader_doubles.h index 4da1adc4c96..900dd9aed87 100644 --- a/Circular_kernel_2/include/CGAL/IO/Dxf_reader_doubles.h +++ b/Circular_kernel_2/include/CGAL/IO/Dxf_reader_doubles.h @@ -16,8 +16,7 @@ // (ACS -- Algorithms for Complex Shapes) // Descriptions of the file format can be found at -// http://www.autodesk.com/techpubs/autocad/acad2000/dxf/ -// http://www.tnt.uni-hannover.de/soft/compgraph/fileformats/docs/DXF.ascii +// https://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf #ifndef CGAL_IO_DXF_READER_DOUBLES_H #define CGAL_IO_DXF_READER_DOUBLES_H diff --git a/Circular_kernel_2/include/CGAL/IO/Dxf_variant_reader.h b/Circular_kernel_2/include/CGAL/IO/Dxf_variant_reader.h index 84672c295f7..d0ace79c85c 100644 --- a/Circular_kernel_2/include/CGAL/IO/Dxf_variant_reader.h +++ b/Circular_kernel_2/include/CGAL/IO/Dxf_variant_reader.h @@ -17,7 +17,7 @@ // (ACS -- Algorithms for Complex Shapes) // Description of the file format can be found at the following address: -// http://www.autodesk.com/techpubs/autocad/acad2000/dxf/ +// https://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf #ifndef CGAL_IO_DXF_VARIANT_READER_H #define CGAL_IO_DXF_VARIANT_READER_H diff --git a/Classification/doc/Classification/Classification.txt b/Classification/doc/Classification/Classification.txt index 2c4c11eee49..10157e274ff 100644 --- a/Classification/doc/Classification/Classification.txt +++ b/Classification/doc/Classification/Classification.txt @@ -528,7 +528,10 @@ The following example: \section Classification_history History -This package is based on a research code by [Florent Lafarge](https://www-sop.inria.fr/members/Florent.Lafarge/) that was generalized, extended and packaged by [Simon Giraudot](http://geometryfactory.com/who-we-are/) in \cgal 4.12. %Classification of surface meshes and of clusters were introduced in \cgal 4.13. The Neural Network classifier was introduced in \cgal 4.14. +This package is based on a research code by [Florent Lafarge](https://www-sop.inria.fr/members/Florent.Lafarge/) +that was generalized, extended and packaged by [Simon Giraudot](https://geometryfactory.com/who-we-are/) +in \cgal 4.12. %Classification of surface meshes and of clusters were introduced in \cgal 4.13. +The Neural Network classifier was introduced in \cgal 4.14. diff --git a/Documentation/doc/Documentation/Developer_manual/Chapter_checks.txt b/Documentation/doc/Documentation/Developer_manual/Chapter_checks.txt index 73cd228cf95..0583952c360 100644 --- a/Documentation/doc/Documentation/Developer_manual/Chapter_checks.txt +++ b/Documentation/doc/Documentation/Developer_manual/Chapter_checks.txt @@ -185,7 +185,7 @@ MSVC][msvc-assume], or [`__builtin_unreachable`][builtin-unreachable] recognized by both clang and g++. [msvc-assume]: https://msdn.microsoft.com/en-us/library/1b3fsfxw.aspx -[builtin-unreachable]: http://clang.llvm.org/docs/LanguageExtensions.html#builtin-unreachable +[builtin-unreachable]: https://clang.llvm.org/docs/LanguageExtensions.html#builtin-unreachable \section secexception_handling Exception handling @@ -193,7 +193,7 @@ Some parts of the library use exceptions, but there is no general specific policy concerning exception handling in \cgal. It is nevertheless good to target exception safety, as much as possible. Good references on exception safety are: Appendix E of \cgalCite{cgal:s-cpl-97} (also available at -http://www.stroustrup.com/3rd_safe0.html), +https://www.stroustrup.com/3rd_safe0.html), and \cgalCite{cgal:a-esgc-98} (also available at https://www.boost.org/community/exception_safety.html). Any destructor which might throw an exception, including a destructor which diff --git a/Documentation/doc/Documentation/License.txt b/Documentation/doc/Documentation/License.txt index cb272b4180f..1eaf49026dd 100644 --- a/Documentation/doc/Documentation/License.txt +++ b/Documentation/doc/Documentation/License.txt @@ -19,7 +19,7 @@ based on GPLed \cgal data structures, obliges you to distribute the source code of your software under the GPL. The exact license terms can be found at the Free Software Foundation -web site: http://www.gnu.org/copyleft/gpl.html. +web site: https://www.gnu.org/licenses/gpl-3.0.html. \section licensesLGPL GNU LGPL @@ -29,7 +29,7 @@ In contrast to the GPL, there is no obligation to distribute the source code of software you build on top of LGPLed \cgal data structures. The exact license terms can be found at the Free Software Foundation web site: -http://www.gnu.org/copyleft/lesser.html. +https://www.gnu.org/licenses/lgpl-3.0.html. \section licensesRationale Rationale of the License Choice @@ -46,7 +46,7 @@ The package overview states for each package under which license it is distribut Users who cannot comply with the Open Source license terms can buy individual data structures under various commercial licenses from GeometryFactory: -http://www.geometryfactory.com/. License fees paid by commercial +https://www.geometryfactory.com/. License fees paid by commercial customers are reinvested in R\&D performed by the \cgal project partners, as well as in evolutive maintenance. diff --git a/Documentation/doc/Documentation/Third_party.txt b/Documentation/doc/Documentation/Third_party.txt index 1b281911cc8..b981472df6a 100644 --- a/Documentation/doc/Documentation/Third_party.txt +++ b/Documentation/doc/Documentation/Third_party.txt @@ -11,11 +11,11 @@ supporting C++14 or later. | Operating System | Compiler | | :---------- | :--------------- | -| Linux | \gnu `g++` 10.2.1 or later\cgalFootnote{\cgalFootnoteCode{http://gcc.gnu.org/}} | -| | `Clang` \cgalFootnote{\cgalFootnoteCode{http://clang.llvm.org/}} compiler version 13.0.1 | -| \ms Windows | \gnu `g++` 10.2.1 or later\cgalFootnote{\cgalFootnoteCode{http://gcc.gnu.org/}} | +| Linux | \gnu `g++` 10.2.1 or later\cgalFootnote{\cgalFootnoteCode{https://gcc.gnu.org/}} | +| | `Clang` \cgalFootnote{\cgalFootnoteCode{https://clang.llvm.org/}} compiler version 13.0.1 | +| \ms Windows | \gnu `g++` 10.2.1 or later\cgalFootnote{\cgalFootnoteCode{https://gcc.gnu.org/}} | | | \ms Visual `C++` 14.0, 15.9, 16.10, 17.0 (\visualstudio 2015, 2017, 2019, and 2022)\cgalFootnote{\cgalFootnoteCode{https://visualstudio.microsoft.com/}} | -| MacOS X | \gnu `g++` 10.2.1 or later\cgalFootnote{\cgalFootnoteCode{http://gcc.gnu.org/}} | +| MacOS X | \gnu `g++` 10.2.1 or later\cgalFootnote{\cgalFootnoteCode{https://gcc.gnu.org/}} | | | Apple `Clang` compiler versions 10.0.1, 12.0.5, and 13.0.0 | @@ -131,7 +131,7 @@ Overview page. In order to use Eigen in \cgal programs, the executables should be linked with the CMake imported target `CGAL::Eigen3_support` provided in `CGAL_Eigen3_support.cmake`. -The \eigen web site is `http://eigen.tuxfamily.org`. +The \eigen web site is `https://eigen.tuxfamily.org`. \subsection thirdpartyOpenGR OpenGR @@ -309,7 +309,7 @@ The \glpk web site is `https://www. In \cgal, \scip provides an optional linear integer program solver in the \ref PkgPolygonalSurfaceReconstruction package. In order to use \scip in \cgal programs, the executables should be linked with the CMake imported target `CGAL::SCIP_support` provided in `CGAL_SCIP_support.cmake`. -The \scip web site is `http://scip.zib.de/`. +The \scip web site is `https://www.scipopt.org/`. \subsection thirdpartyOSQP OSQP diff --git a/Documentation/doc/Documentation/main.txt b/Documentation/doc/Documentation/main.txt index 085a2ad83b6..2026356b76c 100644 --- a/Documentation/doc/Documentation/main.txt +++ b/Documentation/doc/Documentation/main.txt @@ -35,7 +35,7 @@ Head over to \ref general_intro to learn how to obtain, install, and use \cgal. \cgal is distributed under a dual-license scheme. \cgal can be used together with Open Source software free of charge. Using \cgal in other contexts can be done by obtaining a commercial license from -[GeometryFactory](http://www.geometryfactory.com). For more details +[GeometryFactory](https://www.geometryfactory.com). For more details see the \ref license "License" page.

Acknowledgement

diff --git a/Documentation/doc/biblio/cgal_manual.bib b/Documentation/doc/biblio/cgal_manual.bib index 1c49fe6ffd2..34858e1e6b3 100644 --- a/Documentation/doc/biblio/cgal_manual.bib +++ b/Documentation/doc/biblio/cgal_manual.bib @@ -8,7 +8,7 @@ % - Entries are sorted alphabetically by their key % % - The key is created following the same rules as geombib, see -% http://compgeom.cs.uiuc.edu/~jeffe/compgeom/biblios.html +% https://jeffe.cs.illinois.edu/teaching/compgeom/ % % Here are roughly the rules: % initials of authors' last names '-' initials of 5 first title words @@ -264,7 +264,7 @@ Boissonnat} pages = {67--91}, volume = {4}, issue = {1}, - url = {http://dx.doi.org/10.1007/s11786-010-0043-4}, + url = {https://dx.doi.org/10.1007/s11786-010-0043-4}, year = {2010} } @@ -279,7 +279,7 @@ Boissonnat} pages = {45--66}, volume = {4}, issue = {1}, - url = {http://dx.doi.org/10.1007/s11786-010-0042-5}, + url = {https://dx.doi.org/10.1007/s11786-010-0042-5}, year = {2010} } @@ -335,8 +335,8 @@ Boissonnat} ,author = {Gavin Bell and Anthony Parisi and Mark Pesce} ,title = {VRML The Virtual Reality Modeling Language: Version 1.0 Specification} - ,howpublished = {\url{http://www.web3d.org/standards}} - ,url = "http://www.web3d.org/standards" + ,howpublished = {\url{https://www.web3d.org/standards}} + ,url = "https://www.web3d.org/standards" ,month = {May 26} ,year = 1995 ,update = "13.04 lrineau" @@ -674,7 +674,7 @@ Mourrain and Monique Teillaud" year = "1996", issn = "0377-2217", doi = "DOI: 10.1016/0377-2217(94)00366-1", - url = "http://www.sciencedirect.com/science/article/B6VCT-3VW8NPR-11/2/3cf4525c68d79c055676541418264043", + url = "https://www.sciencedirect.com/science/article/abs/pii/0377221794003661", keywords = "Convex hull problem, Frame, Linear programming, Data envelopment analysis, Redundancy" } @@ -791,7 +791,7 @@ Teillaud" @Misc{ cgal:e-esmr, title = {{EPFL} statue model repository}, howpublished = {{EPFL} Computer Graphics and Geometry Laboratory}, - url = {http://lgg.epfl.ch/statues_dataset.php} + url = {https://lgg.epfl.ch/statues_dataset.php} } @inproceedings{ cgal:eddhls-maam-95 @@ -995,7 +995,7 @@ Teillaud" ,number = {B 98-05} ,year = 1998 ,month = apr - ,url = {http://www.inf.fu-berlin.de/inst/pubs/tr-b-98-05.abstract.html} + ,url = {https://www.inf.fu-berlin.de/inst/pubs/tr-b-98-05.abstract.html} ,update = "98.06 schoenherr" } @@ -1008,7 +1008,7 @@ Teillaud" ,number = {B 98-04} ,year = 1998 ,month = apr - ,url = {http://www.inf.fu-berlin.de/inst/pubs/tr-b-98-04.abstract.html} + ,url = {https://www.inf.fu-berlin.de/inst/pubs/tr-b-98-04.abstract.html} ,update = "98.06 schoenherr" } @@ -1020,7 +1020,7 @@ Teillaud" ,number = {B 97-03} ,year = 1997 ,month = jun - ,url = {http://www.inf.fu-berlin.de/inst/pubs/tr-b-97-03.abstract.html} + ,url = {https://www.inf.fu-berlin.de/inst/pubs/tr-b-97-03.abstract.html} ,update = "97.06 schoenherr, 98.02 schoenherr, 98.06 schoenherr" } @@ -1061,7 +1061,7 @@ Teillaud" ,edition = {1.0.1} ,month = {June} ,year = {1999} - ,url = {http://clisp.cons.org/~haible/packages-cln.html} + ,url = {https://www.ginac.de/CLN/} ,update = "99.06 pion" } @@ -1297,7 +1297,7 @@ Teillaud" (full paper will be available shortly)}, YEAR = {2005}, MONTH = {November}, - URL = {http://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics} + URL = {https://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics} } @Article{ cgal:l-tmbrc-91, @@ -1555,7 +1555,7 @@ TITLE = {Intersecting Quadrics\,: An Efficient and Exact Implementation}, BOOKTITLE = {{ACM Symposium on Computational Geometry - SoCG'2004, Brooklyn, NY}}, YEAR ={ 2004}, MONTH ={ Jun}, -URL = {http://www.loria.fr/publications/2004/A04-R-021/A04-R-021.ps}, +URL = {https://www.loria.fr/publications/2004/A04-R-021/A04-R-021.ps}, ABSTRACT = {We present the first complete, exact and efficient C++ implementation of a method for parameterizing the intersection of two implicit quadrics with integer coefficients of arbitrary size. It is based on the near-optimal algorithm recently introduced by Dupont et al.~\cite{dupont03a}. Unlike existing implementations, it correctly identifies and parameterizes all the connected components of the intersection in all the possible cases, returning parameterizations with rational functions whenever such parameterizations exist. In addition, the coefficient field of the parameterizations is either minimal or involves one possibly unneeded square root.}, } @@ -1567,9 +1567,9 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio booktitle = {SEA}, year = {2009}, pages = {209-220}, - ee = {http://dx.doi.org/10.1007/978-3-642-02011-7_20}, + ee = {https://link.springer.com/chapter/10.1007/978-3-642-02011-7_20}, crossref = {cgal:v-ea-09}, - bibsource = {DBLP, http://dblp.uni-trier.de}, + bibsource = {DBLP, https://dblp.org/}, update = "09.11 penarand" } @@ -1582,8 +1582,8 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio year = "2011", note = "Advances in \{LIDAR\} Data Processing and Applications ", issn = "0924-2716", - doi = "http://dx.doi.org/10.1016/j.isprsjprs.2011.09.008", - url = "http://www.sciencedirect.com/science/article/pii/S0924271611001055", + doi = "https://dx.doi.org/10.1016/j.isprsjprs.2011.09.008", + url = "https://www.sciencedirect.com/science/article/abs/pii/S0924271611001055?via%3Dihub", author = "Clément Mallet and Frédéric Bretar and Michel Roux and Uwe Soergel and Christian Heipke" } @@ -1688,7 +1688,7 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio volume = {33}, number = {5}, issn = {1467-8659}, - url = {http://dx.doi.org/10.1111/cgf.12446}, + url = {https://onlinelibrary.wiley.com/doi/10.1111/cgf.12446}, doi = {10.1111/cgf.12446}, pages = {205--215}, year = {2014} @@ -1715,7 +1715,7 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio ,title = {The {LEDA} {U}ser {M}anual} ,organization = {Max-Planck-Insitut f\"ur Informatik} ,address = {66123 Saarbr\"ucken, Germany} - ,url = {http://www.mpi-sb.mpg.de/LEDA/leda.html} + ,url = {https://domino.mpi-inf.mpg.de/internet/reports.nsf/efc044f1568a0058c125642e0064c817/cff150e000ddc461c12562a80045cb82/$FILE/MPI-I-95-1-002.pdf} ,update = "99.05 schirra, 00.09 hert" } @@ -1724,7 +1724,7 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio ,title = {The {LEDA} {U}ser {M}anual} ,organization = {Algorithmic Solutions} ,address = {66123 Saarbr\"ucken, Germany} - ,url = {http://www.algorithmic-solutions.info/leda_manual/MANUAL.html} + ,url = {https://www.algorithmic-solutions.info/leda_manual/MANUAL.html} } @article{ cgal:mog-vbcfe-11 @@ -1979,7 +1979,7 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio title = {{MPFI} - The Multiple Precision Floating-Point Interval Library}, howpublished = {{R}evol, {N}athalie and {R}ouillier, {F}abrice}, - url = {http://perso.ens-lyon.fr/nathalie.revol/software.html}, + url = {https://perso.ens-lyon.fr/nathalie.revol/software.html}, update = "09.11 penarand" } @@ -2022,7 +2022,7 @@ ABSTRACT = {We present the first complete, exact and efficient C++ implementatio ,journal = "Comput. Geom. Theory Appl." , volume = 38 , pages = "100--110" - , url = "http://dx.doi.org/10.1016/j.comgeo.2006.11.008" + , url = "https://www.sciencedirect.com/science/article/pii/S0925772107000193?via%3Dihub" , publisher = "Elsevier Science Publishers B. V." ,update = "09.02 lrineau" } @@ -2298,8 +2298,8 @@ location = {Salt Lake City, Utah, USA} volume = {5526}, year = {2009}, isbn = {978-3-642-02010-0}, - ee = {http://dx.doi.org/10.1007/978-3-642-02011-7}, - bibsource = {DBLP, http://dblp.uni-trier.de}, + ee = {https://link.springer.com/book/10.1007/978-3-642-02011-7}, + bibsource = {DBLP, https://dblp.org/}, update = "09.11 penarand" } @@ -2368,7 +2368,7 @@ location = {Salt Lake City, Utah, USA} ,key = {VRML2} ,title = {The Virtual Reality Modeling Language Specification: Version 2.0, {ISO}/{IEC} {CD} 14772} - ,url = {http://www.web3d.org/documents/specifications/14772/V2.0/index.html} + ,url = {https://www.web3d.org/documents/specifications/14772/V2.0/index.html} ,month = {December} ,year = 1997 ,update = "13.04 lrineau" @@ -2503,7 +2503,6 @@ location = {Salt Lake City, Utah, USA} editor = "L{\'{a}}szl{\'{o}} Szirmay Kalos", pages = "210--218", year = "1998", - url = "http://citeseer.ist.psu.edu/article/felkel98straight.html" } @inproceedings{ cgal:ee-rrccpp-98, @@ -2512,7 +2511,7 @@ location = {Salt Lake City, Utah, USA} booktitle = "Symposium on Computational Geometry", pages = "58--67", year = "1998", - url = "http://citeseer.ist.psu.edu/eppstein98raising.html" + url = "https://jeffe.cs.illinois.edu/pubs/cycles.html" } @inproceedings{ cgal:ld-agrm-03, @@ -2525,11 +2524,9 @@ booktitle = {The 11-th International Conference in Central Europe year = 2003, volume = 11, issn = {ISSN 1213-6972}, -url = "http://wscg.zcu.cz/wscg2003/Papers_2003/G67.pdf" +url = "https://wscg.zcu.cz/wscg2003/Papers_2003/G67.pdf" } - - @InProceedings{cgal:k-vdc-06, author = {Menelaos I. Karavelas}, title = {Voronoi diagrams in {\sc Cgal}}, @@ -2576,7 +2573,7 @@ year = {1998}, pages = {69-79}, ee = {http://link.springer.de/link/service/series/0558/bibs/1766/17660069.htm}, crossref = {cgal:jlm-isgp-98}, -bibsource = {DBLP, http://dblp.uni-trier.de}, +bibsource = {DBLP, https://dblp.org/}, url = "https://www.boost.org/community/exception_safety.html" } @@ -2624,7 +2621,7 @@ url = "https://www.boost.org/community/exception_safety.html" volume = {1766}, year = {2000}, isbn = {3-540-41090-2}, - bibsource = {DBLP, http://dblp.uni-trier.de} + bibsource = {DBLP, https://dblp.org/} } @inproceedings{Kazhdan06, @@ -2719,14 +2716,14 @@ author = "Pedro M.M. de Castro and Frederic Cazals and Sebastien Loriot and Moni AUTHOR = {Otfried Cheong}, EDITION = {6.0pre32}, YEAR = {2009}, - URL = {http://ipe.otfried.org/} + URL = {https://ipe.otfried.org/} } @misc{cgal:t-ocdl-05, key = "opcode", author = {P. Terdiman}, title = "{{OPCODE 3D} Collision Detection library}", - note = "http://www.codercorner.com/Opcode.htm", + note = "https://www.codercorner.com/Opcode.htm", year = {2005} } @@ -2806,7 +2803,7 @@ ADDRESS = "Saarbr{\"u}cken, Germany" @misc{abbott-qir-06, author = "J. Abbott", title = "Quadratic Interval Refinement for Real Roots", - URL = "http://www.dima.unige.it/~abbott/", + URL = "https://www.dima.unige.it/~abbott/", year= "2006", note = "Poster presented at the 2006 Int.\ Symp.\ on Symb.\ and Alg.\ Comp.\ (ISSAC 2006)"} @@ -3035,9 +3032,9 @@ pages = "458--473" booktitle = {FOCS}, year = {1985}, pages = {155-164}, - ee = {http://doi.ieeecomputersociety.org/10.1109/SFCS.1985.65}, + ee = {https://doi.ieeecomputersociety.org/10.1109/SFCS.1985.65}, crossref = {DBLP:conf/focs/FOCS26}, - bibsource = {DBLP, http://dblp.uni-trier.de} + bibsource = {DBLP, https://dblp.org/} } @article{dtl-voasp-83, @@ -3061,8 +3058,8 @@ pages = "207--221" volume = {abs/1403.3905}, url = {https://arxiv.org/abs/1403.3905}, timestamp = {Wed, 17 Sep 2014 16:30:16 +0200}, - biburl = {http://dblp.uni-trier.de/rec/bib/journals/corr/BungiuHHHK14}, - bibsource = {dblp computer science bibliography, http://dblp.org} + biburl = {https://dblp.uni-trier.de/rec/bib/journals/corr/BungiuHHHK14}, + bibsource = {dblp computer science bibliography, https://dblp.org/} } @book{botsch2010PMP, diff --git a/Documentation/doc/biblio/geom.bib b/Documentation/doc/biblio/geom.bib index 270f537e139..3a19d0dccbb 100644 --- a/Documentation/doc/biblio/geom.bib +++ b/Documentation/doc/biblio/geom.bib @@ -78,7 +78,7 @@ , title = "IRIT $6.0$ User's Manual" , organization = "Technion" , year = 1996 -, url = "http://www.cs.technion.ac.il/~irit" +, url = "https://www.cs.technion.ac.il/~irit" , update = "98.07 bibrelex" } @@ -1925,7 +1925,7 @@ cell neighborhood in $O(m)$ time." , type = "Project Proposal (U. S. Army Research Office grant DAAH04-96-1-0013)" , institution = "Center for Geometric Computing" , year = 1995 -, url = "http://www.cs.brown.edu/cgc/" +, url = "https://www.cs.brown.edu/cgc/" , update = "98.07 bibrelex, 97.03 tamassia" } @@ -6908,7 +6908,7 @@ cell neighborhood in $O(m)$ time." @misc{a-dcgs- , author = "Nina Amenta" , title = "Directory of Computational Geometry Software" -, url = "http://www.geom.umn.edu/software/cglist/" +, url = "https://www.geom.uiuc.edu/software/cglist/" , update = "97.03 tamassia" } @@ -13110,7 +13110,6 @@ It is highly suitable for parallelization." , institution = "INRIA" , address = "BP93, 06902 Sophia-Antipolis, France" , year = 1994 -, url = "http://www.inria.fr/RRRT/RR-2306" , precedes = "abdpy-esdus-97" , update = "99.11 bibrelex, 99.07 devillers, 97.03 devillers, 96.01 devillers, 95.09 devillers, 95.01 devillers" , abstract = "We propose a method to evaluate signs of $2\times 2$ and @@ -14473,7 +14472,7 @@ whereas standard (polynomial) splines do not. Contains pseudocode." , number = 4 , year = 1995 , pages = "568--572" -, url = "http://www.cs.brown.edu/cgc/papers/bclt-nmaaw-95.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/bclt-nmaaw-95.ps.gz" , keywords = "algorithm animation, Java, Web, WWW, graph drawing, CGC, Brown" , update = "97.03 tamassia, 96.09 tamassia" } @@ -14485,7 +14484,7 @@ whereas standard (polynomial) splines do not. Contains pseudocode." , nickname = "AVI '96" , year = 1996 , pages = "203--212" -, url = "http://www.cs.brown.edu/cgc/papers/bclt-aawww-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/bclt-aawww-96.ps.gz" , keywords = "algorithm animation, Java, Web, WWW, CGC, Brown" , update = "97.03 tamassia, 96.09 tamassia" } @@ -14496,7 +14495,7 @@ whereas standard (polynomial) splines do not. Contains pseudocode." , booktitle = "Proc. 12th Annu. ACM Sympos. Comput. Geom." , year = 1996 , pages = "C3--C4" -, url = "http://www.cs.brown.edu/cgc/papers/bclt-agaow-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/bclt-agaow-96.ps.gz" , keywords = "algorithm animation, Java, Web, WWW, CGC, Brown" , cites = "bclt-nmaaw-95, ZZZ" , update = "97.11 bibrelex, 97.03 tamassia, 96.09 tamassia, 96.05 efrat" @@ -14509,7 +14508,7 @@ whereas standard (polynomial) splines do not. Contains pseudocode." , nickname = "AVI '96" , year = 1996 , pages = "248--250" -, url = "http://www.cs.brown.edu/cgc/papers/bclt-maas-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/bclt-maas-96.ps.gz" , keywords = "algorithm animation, Java, Web, WWW, CGC, Brown" , update = "97.03 tamassia, 96.09 tamassia" } @@ -18585,7 +18584,6 @@ the interior. Contains pseudocode." , institution = "INRIA" , address = "BP93, 06902 Sophia-Antipolis, France" , year = 1995 -, url = "http://www.inria.fr/RRRT/RR-2626" , precedes = "bdds-cscot-97" , update = "99.11 bibrelex, 99.07 devillers, 98.11 devillers, 97.03 devillers, 96.01 devillers" , abstract = "This note presents a non trivial combination of two techniques previously used with randomized incremental algorithms: the lazy cleaning scheme \cite{bds-lric-94} to maintain structures with `non local' definition and the $O(n\log^{\star}n)$ acceleration when some additional information about the data is known \cite{s-sfira-91,cct-rpatd-92,d-rysoa-92}. Authors assume that the reader is somehow familiar with this techniques. @@ -21935,7 +21933,7 @@ where $d > 3 \sqrt 3$ denotes the distance between S and T." , number = 7 , year = 1998 , pages = "1--31" -, url = "http://www.cs.brown.edu/publications/jgaa/accepted/98/Biedl98.2.7.ps.gz" +, url = "https://www.cs.brown.edu/publications/jgaa/accepted/98/Biedl98.2.7.ps.gz" , succeeds = "b-nlbog-96" , update = "00.03 vismara" } @@ -23872,7 +23870,6 @@ In [BSBL93], the synthesis problem has been solved for a , address = "Valbonne, France" , month = apr , year = 1991 -, url = "http://www.inria.fr/RRRT/RR-1415" , keywords = "Delaunay triangulation, Voronoi diagrams, output-sensitive algorithms, shape reconstructions, shelling, tomography" , precedes = "bcdt-osc3d-91i, bcdt-oscdt-96" , update = "99.11 bibrelex, 99.07 devillers, 97.03 devillers, 96.05 devillers, 96.01 devillers, 95.09 devillers, 95.01 devillers" @@ -23930,7 +23927,6 @@ of the output, and the extra storage is {$O(n)$}." , number = 2160 , institution = "INRIA" , year = 1994 -, url = "http://www-sop.inria.fr/RRRT/RR-2160.html" , precedes = "bcdkl-sppbd-99" , update = "99.11 devillers, 99.07 devillers, 98.03 mitchell" } @@ -24176,7 +24172,6 @@ must lie in the halfplanes delimited by the query lines." , address = "Sophia-Antipolis, France" , month = oct , year = 1990 -, url = "http://www.inria.fr/RRRT/RR-1293" , precedes = "bdp-cu3ct-91" , update = "99.11 bibrelex, 99.07 devillers, 97.03 devillers, 96.01 devillers, 95.09 devillers, 95.01 devillers, 93.09 milone+mitchell" } @@ -24203,7 +24198,6 @@ must lie in the halfplanes delimited by the query lines." , institution = "INRIA Sophia-Antipolis" , address = "Valbonne, France" , year = 1990 -, url = "http://www.inria.fr/RRRT/RR-1285" , succeeds = "bt-hrodt-86" , precedes = "bdsty-olgag-91i" , update = "99.11 bibrelex, 99.07 devillers, 98.07 bibrelex, 97.03 devillers, 96.01 devillers, 95.09 devillers, 95.01 devillers, 93.09 milone+mitchell" @@ -24271,7 +24265,6 @@ arrangements of curves in the plane and others." , institution = "INRIA Sophia-Antipolis" , address = "Valbonne, France" , year = 1990 -, url = "http://www.inria.fr/RRRT/RR-1207" , keywords = "randomized algorithms, higher order Voronoi diagrams, dynamic algorithms" , succeeds = "bdt-olcho-90, bt-hrodt-86" , precedes = "bdt-schov-93" @@ -24430,7 +24423,7 @@ the computational geometry algorithms library CGAL." , address = "Valbonne, France" , month = apr , year = 1992 -, url = "http://www-sop.inria.fr/cgi-bin/wais_ra_sophia?question=1697" +, url = "https://www-sop.inria.fr/cgi-bin/wais_ra_sophia?question=1697" , keywords = "shape reconstruction, medical images, Delaunay triangulation" , update = "99.07 devillers, 95.09 devillers, 95.01 devillers, 93.09 held" } @@ -24643,7 +24636,6 @@ present a polynomial-time exact algorithm to solve this problem." , number = 3825 , institution = "INRIA" , year = 1999 -, url = "http://www.inria.fr/RRRT/RR-3825" , cites = "b-oafsi-95, bo-arcgi-79, bs-ealcs-99, bp-rpsis-, c-stsar-94, ce-oails-92, cs-arscg-89, afl-rracg-98, k-ah-92, lpt-rpqid-99, p-iaeia-99, ps-cgi-90, s-ri-99, y-tegc-97, y-rgc-97" , update = "00.03 devillers" , abstract = "We propose several @@ -25563,7 +25555,7 @@ present a polynomial-time exact algorithm to solve this problem." , number = "RT-INF-9-96" , institution = "Dip. Discipline Scientifiche, Sez. Informatica, Univ. Roma III" , year = 1996 -, url = "http://www.cs.brown.edu/cgc/papers/bdll-pcrt-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/bdll-pcrt-96.ps.gz" , keywords = "graph drawing, proximity, CGC, Brown" , update = "97.03 tamassia" } @@ -26988,7 +26980,7 @@ and solids on dynamically evolving grids without remeshing." , title = "Optimal Compaction of Orthogonal Representations" , booktitle = "CGC Workshop on Geometric Computing" , year = 1998 -, url = "http://www.cs.brown.edu/cgc/cgc98/" +, url = "https://www.cs.brown.edu/cgc/cgc98/" , keywords = "graph drawing, planar, orthogonal" , update = "98.11 tamassia" } @@ -27016,7 +27008,7 @@ and solids on dynamically evolving grids without remeshing." , publisher = "Springer-Verlag" , year = 1997 , pages = "45--52" -, url = "http://www.cs.brown.edu/cgc/papers/bgt-gdtsw-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/bgt-gdtsw-97.ps.gz" , keywords = "graph drawing, system, WWW, orthogonal, planarization, CGC, Brown" , update = "98.07 vismara, 97.03 tamassia" } @@ -27448,7 +27440,6 @@ and solids on dynamically evolving grids without remeshing." , number = 3758 , institution = "INRIA" , year = 1999 -, url = "http://www.inria.fr/RRRT/RR-3758" , archive = "XXX:cs.CG/9907025" , cites = "h-bevv-56, bcddy-acchs-96" , update = "99.11 devillers" @@ -31078,7 +31069,7 @@ determinants." , publisher = "Springer-Verlag" , year = 1997 , pages = "63--75" -, url = "http://www.cs.brown.edu/cgc/papers/cgkt-oaars-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/cgkt-oaars-97.ps.gz" , keywords = "graph drawing, upward, tree, planar, straight-line, orthogonal, CGC, Brown" , update = "98.07 agarwal, 98.03 smid, 97.11 bibrelex, 97.03 tamassia" } @@ -31421,7 +31412,7 @@ determinants." , site = "Waterloo, Canada" , year = 1993 , pages = "67--72" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation, exact arithmetic" , cites = "m-cacau-89, dbs-gttd-92, fm-nsala-91, fv-eeacg-93, h-gsm-89, kln-edtur-91, m-vigau-88t, m-cacau-89, m-rfldd-90, m-rflp-89, fw-lnum-93, si-cvdom-89, f-pcg-93, ZZZ" , update = "98.11 bibrelex, 97.03 daniels, 93.09 milone+mitchell" @@ -31730,7 +31721,7 @@ determinants." , title = "Finding Basis Functions for Pyramidal Finite Elements" , booktitle = "CGC Workshop on Geometric Computing" , year = 1998 -, url = "http://www.cs.brown.edu/cgc/cgc98/" +, url = "https://www.cs.brown.edu/cgc/cgc98/" , update = "98.11 tamassia" } @@ -35104,7 +35095,7 @@ The algorithms can be extended to 3D with more complex data structures." , booktitle = "Proc. 6th ACM-SIAM Sympos. Discrete Algorithms" , year = 1995 , pages = "139--149" -, url = "http://www.cs.brown.edu/cgc/papers/cggtvv-emga-95.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/cggtvv-emga-95.ps.gz" , update = "97.03 tamassia, 95.05 tamassia, 95.01 tamassia" } @@ -35159,7 +35150,7 @@ The algorithms can be extended to 3D with more complex data structures." , volume = 25 , year = 1996 , pages = "207--233" -, url = "http://www.cs.brown.edu/cgc/papers/cpt-uadpl-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/cpt-uadpl-96.ps.gz" , succeeds = "cpt-uadpl-93" , update = "97.03 tamassia, 96.05 smid, 95.01 tamassia" } @@ -35259,7 +35250,7 @@ The algorithms can be extended to 3D with more complex data structures." , volume = 7 , year = 1997 , pages = "85--121" -, url = "http://www.cs.brown.edu/cgc/papers/ct-ospml-.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/ct-ospml-.ps.gz" , keywords = "Shortest Path, Minimum-Link Path, dynamic algorithm, CGC, Brown" , succeeds = "ct-ospml-94i" , update = "98.07 mitchell, 97.11 bibrelex, 97.07 devillers, 97.03 tamassia, 96.09 tamassia, 95.01 tamassia" @@ -36242,7 +36233,7 @@ avoids overlap. This is useful in cartography." , booktitle = "Proc. 12th Annu. ACM Sympos. Comput. Geom." , year = 1996 , pages = "319--328" -, url = "http://www.cs.brown.edu/cgc/papers/cgt-cdgtt-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/cgt-cdgtt-96.ps.gz" , keywords = "graph drawing, straight-line, 3D, convex, CGC, Brown" , cites = "a-lbvsc-63, bh-olpgf-87, bo-lwbl-87, con-dpgn-85, cyn-lacdp-84, ck-cgd3c-93, cn-mwgdp-95, cp-ltadp-95, celr-tdgd-95, c-re-82, cw-mmap-90, cw-sfmps-82, dg-caitd-95, fpp-sssfe-88, fpp-hdpgg-90, dett-adgab-94, dtt-arsdp-92, dtv-olcpt-95, ds-ltati-92, eg-dspg-96, esw-tkbtd-95, f-slrpg-48, fhhklsww-dgphr-93, gt-pdara-94, gt-anda-87, g-cp-67, hr-udfs-94, hrs-cchpc-92, ht-dgtc-73, ht-ept-74, hk-prga-92, jj-3dlrg-95, k-dpguc-96, k-dpgul-92, ls-cavg-92, ld-cpdt3-95, lrt-gnd-79, lt-apst-80, mp-arpg-94, m-orfdf-64, ps-cgi-85, r-3dvpi-95, r-e3vpi-95, s-epgg-90, st-ce3cp-92, s-cm-51, sr-vudtd-34, t-pdfip-80, t-prg-84, t-crg-60, t-hdg-63, w-mspp-82, ZZZ" , update = "98.11 bibrelex, 97.11 bibrelex, 97.03 tamassia, 96.09 tamassia" @@ -37879,7 +37870,7 @@ data. Contains C code." , number = 5 , year = 1995 , pages = "970--1001" -, url = "http://www.cs.brown.edu/cgc/papers/cdtt-dgdts-95.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/cdtt-dgdts-95.ps.gz" , keywords = "graph drawing, dynamic, planar, trees, series-parallel" , succeeds = "cdttb-fdgd-92" , update = "97.03 tamassia, 96.09 tamassia, 95.09 tamassia, 95 tamassia" @@ -37972,7 +37963,7 @@ data. Contains C code." , volume = 13 , year = 1995 , pages = "245--265" -, url = "http://www.cs.brown.edu/cgc/papers/ct-det-95.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/ct-det-95.ps.gz" , succeeds = "ct-detta-91" , update = "97.03 tamassia, 95.01 tamassia, 95.01 tamassia" } @@ -41130,7 +41121,7 @@ Contains C code." , booktitle = "Proc. 1st ACM Workshop on Appl. Comput. Geom." , year = 1996 , pages = "33--38" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "layout, nesting, placement, Minkowski sum, configuration space" , comments = "to appear in Lecture Notes in Computer Science; submitted to Internat. J. Comput. Geom. Appl." @@ -41143,7 +41134,7 @@ Contains C code." , booktitle = "Proc. 6th Canad. Conf. Comput. Geom." , year = 1994 , pages = "225--230" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "layout, packing, nesting, placement, reachability, Minkowski sum, configuration space, decomposition" , cites = "dmr-fmaap-93, f-savd-87, l-tdvdl-80, lm-ccp-93, ZZZ" , update = "98.11 bibrelex, 97.03 daniels, 94.09 jones" @@ -41155,7 +41146,7 @@ Contains C code." , booktitle = "Proc. 6th ACM-SIAM Sympos. Discrete Algorithms" , year = 1995 , pages = "205--214" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "packing, layout, placement, nesting, Minkowski sum, configuration space" , update = "97.03 daniels, 96.09 agarwal, 96.05 mitchell" } @@ -41208,7 +41199,7 @@ Contains C code." , site = "Waterloo, Canada" , year = 1993 , pages = "322--327" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "optimization, monotone matrices, polygons, inclusion" , precedes = "dmr-flaap -97" , cites = "akmsw-gamsa-87, as-facle-87, aw-cg-88, c-tsplt-90i, cdl-cler-86, kk-altag-90, mos-fmrio-85, mdl-amm-91, mdl-pcnpc-92, ow-rv-88, ps-cgi-85, srw-gsv-cccg-91, nhl-merp-84, wy-ocsp-88, ZZZ" @@ -41221,7 +41212,7 @@ Contains C code." , booktitle = "Proc. 8th Canad. Conf. Comput. Geom." , year = 1996 , pages = "196--201" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "concave, polygons, decomposition" , update = "97.03 agarwal+daniels, 96.09 mitchell" } @@ -43601,7 +43592,7 @@ Contains C code." , month = aug , year = 2000 , pages = "??--??" -, url = "http://cs.smith.edu/~orourke/papers.html" +, url = "https://www.science.smith.edu/~jorourke/papers.php" , cites = "ddo-ppnph2d-00" , update = "01.04 icking, 00.11 smid, 00.07 orourke" } @@ -43682,7 +43673,7 @@ Contains C code." , month = jan , year = 1999 , pages = "891--892" -, url = "http://www.siam.org/meetings/da99/" +, url = "https://archive.siam.org/meetings/da99/" , update = "99.07 orourke" } @@ -43759,7 +43750,7 @@ Contains C code." , address = "Northampton, MA, USA" , month = oct , year = 2001 -, url = "http://arXiv.org/abs/cs/0110054/" +, url = "https://arxiv.org/abs/cs/0110054" , succeeds = "deeho-vusp-01" , update = "01.11 orourke" } @@ -43773,7 +43764,7 @@ Contains C code." , address = "Northampton, MA, USA" , month = jul , year = 2001 -, url = "http://arXiv.org/abs/cs/0107023/" +, url = "https://arXiv.org/abs/cs/0107023/" , update = "01.11 orourke" } @@ -44318,7 +44309,6 @@ Contains C code." , number = 3451 , institution = "INRIA" , year = 1998 -, url = "http://www.inria.fr/RRRT/RR-3451" , precedes = "d-ddt-99" , update = "99.11 bibrelex, 99.07 devillers, 98.11 devillers" , abstract = "This paper present how space of spheres and shelling can be used to delete efficiently a point from d-dimensional triangulation. In 2-dimension, if k is the degree of the deleted vertex, the complexity is $O(k\log k)$, but we notice that this number apply only to low cost operations; time consuming computations are done only a linear number of times. This algorithm can be viewed as a variation of Heller algorithm which is popular in the geographic information system community. Unfortunately Heller algorithm is false as explained in this paper." @@ -44382,7 +44372,6 @@ minimum spanning tree)." , institution = "INRIA Sophia-Antipolis" , address = "Valbonne, France" , year = 1992 -, url = "http://www.inria.fr/RRRT/RR-1619" , keywords = "randomized algorithms, Delaunay triangulation, practical issue, degenerate cases" , update = "99.11 bibrelex, 99.07 devillers, 97.03 devillers, 96.01 devillers, 95.09 devillers, 95.01 devillers" } @@ -44408,7 +44397,6 @@ minimum spanning tree)." , institution = "INRIA Sophia-Antipolis" , address = "Valbonne, France" , year = 1990 -, url = "http://www.inria.fr/RRRT/RR-1179" , keywords = "polygon placement, contact configurations" , precedes = "d-scspa-93" , update = "99.11 bibrelex, 99.07 devillers, 97.03 devillers, 96.01 devillers, 95.09 devillers, 95.01 devillers, 94.05 devillers" @@ -44740,7 +44728,6 @@ respectively, we obtain a speedup of $\frac p{\log p}$." , institution = "INRIA Sophia-Antipolis" , address = "Valbonne, France" , year = 1992 -, url = "http://www.inria.fr/RRRT/RR-1620" , precedes = "dmt-ssgtu-92i" , update = "99.11 bibrelex, 99.07 devillers, 97.03 devillers, 96.01 devillers, 95.09 devillers, 95.01 devillers" } @@ -45657,7 +45644,7 @@ dimensions. Constants are small, and are given in the paper." , publisher = "Springer-Verlag" , year = 1997 , pages = "76--91" -, url = "http://www.cs.brown.edu/cgc/papers/dglpttvv-ddges-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/dglpttvv-ddges-97.ps.gz" , keywords = "graph drawing, upward, experiments, CGC, Brown" , update = "98.07 patrignani+tamassia+vismara, 97.11 bibrelex, 97.03 tamassia" } @@ -45680,7 +45667,7 @@ dimensions. Constants are small, and are given in the paper." , type = "Manuscript" , institution = "Dept. of Computer Sci., Brown University" , year = 1996 -, url = "http://www.cs.brown.edu/cgc/papers/dglttv-ecfgd-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/dglttv-ecfgd-96.ps.gz" , keywords = "graph drawing, experiments, orthogonal" , precedes = "dglttv-ecfgd-97" , update = "97.03 tamassia, 96.09 tamassia" @@ -45694,7 +45681,7 @@ dimensions. Constants are small, and are given in the paper." , volume = 7 , year = 1997 , pages = "303--325" -, url = "http://www.cs.brown.edu/cgc/papers/dglttv-ecfgd-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/dglttv-ecfgd-96.ps.gz" , keywords = "graph drawing, experiments, orthogonal, CGC, Brown" , succeeds = "dglttv-ecfgd-96" , update = "98.07 patrignani+tamassia+vismara, 97.07 devillers, 97.03 tamassia, 96.09 tamassia" @@ -45706,7 +45693,7 @@ dimensions. Constants are small, and are given in the paper." , booktitle = "Proc. 11th Annu. ACM Sympos. Comput. Geom." , year = 1995 , pages = "306--315" -, url = "http://www.cs.brown.edu/cgc/papers/dglttv-ectgd-95.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/dglttv-ectgd-95.ps.gz" , keywords = "graph drawing, experiments, orthogonal" , cites = "bcn-cdder-92, bfn-wigdp-85, bnt-ladfd-86, bbdl-tealf-91, bk-bhogd-94, con-dpgn-85, cp-ltadp-90, celr-tdgd-95, dh-dgnus-89, fpp-sssfe-88, fr-scpdt-84, dett-adgab-94, dgst-ads-90, dlv-sorod-93, dlt-pepg-84, eg-rpdfb-94, eg-glbdb-95, fr-gdfdp-91, gs-ssa-79, gnv-dptdd-88, h-celag-94, h-ggpig-95, jemwdt-npgda-91, jm-mpsne-96, k-vaor-89, kk-adgug-89, k-dpgul-92, k-adpg-93, k-mcvr-93, kb-pgap-92, l-aeglv-80, lmp-sbeac-94, lmps-trm1b-90, lms-gtrre-91, lms-la3be-93, nt-fapsd-84, pt-iabod-95, r-nmdpg-87, rt-rplbo-86, s-mncpe-84, stt-mvuhs-81, t-eggmn-87, tdb-agdrd-88, tt-uavrp-86, tt-pgelt-89, tt-gd-95, t-dgds-88, t-hdg-63, v-ucvc-81, w-npagt-90, w-cblsg-85, w-dpg-82, ZZZ" , update = "01.04 icking, 98.11 bibrelex, 98.03 bibrelex, 97.03 tamassia, 96.09 tamassia, 95.05 tamassia" @@ -45820,7 +45807,7 @@ dimensions. Constants are small, and are given in the paper." , publisher = "Springer-Verlag" , year = 1996 , pages = "178--189" -, url = "http://www.cs.brown.edu/cgc/papers/dlw-swp-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/dlw-swp-96.ps.gz" , keywords = "graph drawing" , update = "98.11 bibrelex, 97.11 bibrelex, 97.03 tamassia, 96.09 tamassia" } @@ -45842,7 +45829,7 @@ dimensions. Constants are small, and are given in the paper." , journal = "J. Graph Algorithms Appl." , volume = "3:4" , year = 1999 -, url = "http://www.cs.brown.edu/publications/jgaa/papers.html" +, url = "https://www.cs.brown.edu/publications/jgaa/papers.html" , update = "00.03 vismara" } @@ -46114,7 +46101,7 @@ dimensions. Constants are small, and are given in the paper." , publisher = "Springer-Verlag" , year = 1996 , pages = "81--91" -, url = "http://www.cs.brown.edu/cgc/papers/dtv-osrdp-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/dtv-osrdp-96.ps.gz" , update = "99.11 bibrelex, 98.07 vismara, 97.03 tamassia" } @@ -48478,7 +48465,7 @@ conjecture posed by O'Rourke and Supowit \cite{os-snhpd-83}." , address = "Northampton, MA, USA" , month = oct , year = 2001 -, url = "http://arXiv.org/abs/cs/0110059/" +, url = "https://arXiv.org/abs/cs/0110059/" , comments = "Answers a question posed in bls-wcnfp-99" , update = "01.11 orourke" } @@ -49693,7 +49680,7 @@ library." , author = "E. Durand" , title = "Quasitiler 3.0 documentation" , year = 1994 -, url = "http//www.geom.umn.edu/apps/quasitiler/about.html" +, url = "http://www.geom.uiuc.edu/apps/quasitiler/about.html" , update = "97.11 bibrelex" } @@ -50766,7 +50753,7 @@ library." , volume = 6 , year = 1996 , pages = "145--156" -, url = "http://www.cs.brown.edu/cgc/papers/elt-adhg-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/elt-adhg-96.ps.gz" , succeeds = "elt-adhg-92" , update = "97.03 tamassia, 96.09 devillers" } @@ -54611,7 +54598,7 @@ algebraic geometry." @misc{e-ga- , author = "David Eppstein" , title = "Geometry in Action" -, url = "http://www.ics.uci.edu/~eppstein/geom.html" +, url = "https://www.ics.uci.edu/~eppstein/geom.html" , update = "97.03 tamassia" } @@ -55925,7 +55912,7 @@ between all the vertices of the polygons." , site = "Pacific Grove, CA" , year = 1994 , pages = "498--502" -, url = "http://ptolemy.eecs.berkeley.edu" +, url = "https://ptolemy.berkeley.edu/" , update = "98.03 bibrelex" } @@ -59800,7 +59787,7 @@ reflection formula and derives a surprising relationship between them." , month = jun , year = 1991 , pages = "334--341" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "arrangements, implementing algorithms, robust geometric computation" , cites = "cgl-pgd-83, eg-tsa-86, eos-calha-86, f-smpst-90, gt-tgt-87, g-as-72, gss-egbra-89, gs-pmgsc-85, h-pargc-89, hhk-tirgc-88, hk-prga-89, k-rmrs-89, lm-cschu-90, m-dpggt-89, m-vigau-88p, m-vigau-88a, m-utcpc-89, si-gafpa-88, si-cvd10-89, ZZZ" , update = "98.11 bibrelex, 97.11 bibrelex, 97.03 daniels" @@ -63930,7 +63917,7 @@ Complete thesis available only on microfilm from Harvard, since Harvard did not , volume = 6 , year = 1996 , pages = "333--356" -, url = "http://www.cs.brown.edu/cgc/papers/ggt-aoutd-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/ggt-aoutd-96.ps.gz" , keywords = "graph drawing, tree, planar, upward" , succeeds = "ggt-aeutd-93" , update = "97.03 devillers+tamassia" @@ -63956,7 +63943,7 @@ Complete thesis available only on microfilm from Harvard, since Harvard did not , publisher = "Springer-Verlag" , year = 1997 , pages = "201--216" -, url = "http://www.cs.brown.edu/cgc/papers/gt-nmcfa-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/gt-nmcfa-97.ps.gz" , keywords = "graph drawing, planar, orthogonal, grid" , update = "99.03 vismara, 97.03 tamassia, 96.09 tamassia" } @@ -63971,7 +63958,7 @@ Complete thesis available only on microfilm from Harvard, since Harvard did not , publisher = "Springer-Verlag" , year = 1994 , pages = "12--21" -, url = "http://www.cs.brown.edu/cgc/papers/gt-agd-94.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/gt-agd-94.ps.gz" , keywords = "graph drawing" , update = "97.11 bibrelex, 97.03 tamassia, 94.05 tamassia" } @@ -63991,8 +63978,8 @@ Complete thesis available only on microfilm from Harvard, since Harvard did not , type = "Manuscript" , institution = "Dept. of Computer Sci., Brown University" , year = 1996 -, note = "Available at \url{http://www.cs.brown.edu/people/rt/fadiva/giotto3d.html}" -, url = "http://www.cs.brown.edu/people/rt/fadiva/giotto3d.html" +, note = "Available at \url{https://www.cs.brown.edu/people/rt/fadiva/giotto3d.html}" +, url = "https://www.cs.brown.edu/people/rt/fadiva/giotto3d.html" , keywords = "graph drawing, 3D" , update = "97.03 tamassia, 96.09 tamassia" } @@ -64015,7 +64002,7 @@ Complete thesis available only on microfilm from Harvard, since Harvard did not , series = "Lecture Notes Comput. Sci." , publisher = "Springer-Verlag" , year = 1997 -, url = "http://www.cs.brown.edu/cgc/papers/gt-gsvhs-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/gt-gsvhs-97.ps.gz" , keywords = "graph drawing, upward, 3D, CGC, Brown" , update = "99.11 bibrelex, 97.03 tamassia" } @@ -64059,7 +64046,7 @@ Complete thesis available only on microfilm from Harvard, since Harvard did not , publisher = "Springer-Verlag" , year = 1995 , pages = "286--297" -, url = "http://www.cs.brown.edu/cgc/papers/gt-ccurp-95.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/gt-ccurp-95.ps.gz" , keywords = "graph drawing, planar, upward, rectilinear, orthogonal, NP-hardness" , update = "97.03 tamassia, 95.01 tamassia" } @@ -64085,7 +64072,7 @@ Complete thesis available only on microfilm from Harvard, since Harvard did not , volume = 12 , year = 1995 , pages = "109--133" -, url = "http://www.cs.brown.edu/cgc/papers/gt-upt-95.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/gt-upt-95.ps.gz" , keywords = "graph drawing, planar, upward, survey" , update = "97.03 tamassia, 96.09 tamassia, 95.09 tamassia, 95.05 tamassia" } @@ -64100,7 +64087,7 @@ Complete thesis available only on microfilm from Harvard, since Harvard did not , publisher = "Springer-Verlag" , year = 1996 , pages = "12--26" -, url = "http://www.cs.brown.edu/cgc/papers/gtv-dc-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/gtv-dc-96.ps.gz" , keywords = "graph drawing, 3D, straight-line" , update = "97.03 smid+tamassia" } @@ -68869,7 +68856,7 @@ generated in O(dn2d+1) time. We present a simple proof that the (d - , title = "{GMP}, The {GNU} Multiple Precision Arithmetic Library" , edition = "2.0.2" , year = 1996 -, url = "http://gmplib.org/" +, url = "https://gmplib.org/" , update = "02.03 devillers, 00.03 devillers" } @@ -70364,7 +70351,7 @@ cos, etc." , number = "Report B 96-11" , institution = "Institut {f\"ur} Informatik, Freie Universit{\"a}t Berlin" , year = 1996 -, url = "http://www.inf.fu-berlin.de/pub/reports/tr-b-96-11.ps.gz, http://www.inf.fu-berlin.de/inst/pubs/tr-b-96-11.abstract.html" +, url = "https://www.inf.fu-berlin.de/pub/reports/tr-b-96-11.ps.gz, https://www.inf.fu-berlin.de/inst/pubs/tr-b-96-11.abstract.html" , update = "98.03 mitchell" } @@ -73908,7 +73895,7 @@ useful for geometric modeling or for ray tracing." , title = "Algebraic Topology" , publisher = "Cambridge University Press" , year = 2001 -, url = "http://www.math.cornell.edu/~hatcher/" +, url = "https://www.math.cornell.edu/~hatcher/" , update = "01.11 orourke" } @@ -76153,7 +76140,7 @@ processing. Contains C code." , type = "Manuscript" , institution = "Universit{\"a}t Passau, Innstra\ss e 33, 94030 Passau, Germany" , year = 1996 -, url = "http://www.uni-passau.de/~himsolt/Graphlet/GML" +, url = "https://www.uni-passau.de/~himsolt/Graphlet/GML" , keywords = "graph drawing" , update = "96.09 tamassia" } @@ -84058,7 +84045,7 @@ fitting method." , number = 1 , year = 1997 , pages = "1--25" -, url = "http://www.cs.brown.edu/publications/jgaa/accepted/97/JuengerMutzel97.1.1.ps.gz" +, url = "https://www.cs.brown.edu/publications/jgaa/accepted/97/JuengerMutzel97.1.1.ps.gz" , keywords = "graph drawing, straight-line, planarization, crossings, experiments" , succeeds = "jm-eha2s-96" , update = "99.07 vismara, 98.07 tamassia+vismara" @@ -84900,7 +84887,7 @@ fitting method." , month = aug , year = 2000 , pages = "139--146" -, url = "http://cs.smith.edu/~orourke/ShortestPaths/" +, url = "https://www.science.smith.edu/~jorourke/ShortestPaths//" , keywords = "shortest paths" , update = "02.03 icking, 01.11 orourke, 01.04 icking+orourke, 00.11 smid, 00.07 orourke" } @@ -85234,7 +85221,7 @@ fitting method." , number = 2 , year = 1997 , pages = "81--88" -, url = "http://www.cs.brown.edu/cgc/papers/kltt-arvrt-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/kltt-arvrt-97.ps.gz" , keywords = "graph drawing, visibility, tree, CGC, Brown" , update = "98.11 tamassia, 97.03 tamassia" } @@ -86661,7 +86648,6 @@ the R*-tree." , number = 2874 , institution = "INRIA" , year = 1996 -, url = "http://www.inria.fr/rrrt/rr-2874.html" , update = "02.03 devillers, 97.11 bibrelex" , abstract = "A set of objects is $k$-pierceable if there exists a set of $k$ poin ts such that each object is pierced by (contains) at least one of these points. Finding the smallest integer $k$ such that a set is $k$-pierceable is NP-complete. In this technical report, we present efficient algorithms for findi ng a piercing set (i.e., a set of $k$ points as above) for several classes of convex objects and small values of $k$. In some of the cases, our algorithms imply known as well as new Helly-type theorems, thus adding to previous results of Danzer and Gr{\"u}nbaum who studied the case of axis-parallel boxes. The problems studied here are related to the collection of optimization problems in which one seeks the smallest scaling factor of a centrally symmetric convex object $K$, so that a set of points can be covered by $k$ congruent homothets of $K$." } @@ -91777,7 +91763,7 @@ some 2 curves cross exponentially many times." , nickname = "WAFR '98" , year = 1998 , pages = "to appear" -, url = "http://www.cs.unc.edu/~dm/collision.html" +, url = "https://www.cs.unc.edu/~dm/collision.html" , update = "98.11 bibrelex, 98.07 bibrelex, 98.03 mitchell" } @@ -95357,7 +95343,7 @@ addition to their own purposes before conducting the conversion." , number = 5 , year = 1996 , pages = "253--260" -, url = "http://www.cs.brown.edu/cgc/papers/ll-domwt-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/ll-domwt-96.ps.gz" , keywords = "graph drawing, planar, minimum weight triangulation" , update = "98.11 tamassia, 97.03 tamassia, 96.01 liotta" } @@ -95372,7 +95358,7 @@ addition to their own purposes before conducting the conversion." , publisher = "Springer-Verlag" , year = 1996 , pages = "373--384" -, url = "http://www.cs.brown.edu/cgc/papers/ll-hdomw-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/ll-hdomw-96.ps.gz" , keywords = "graph drawing" , update = "97.03 tamassia, 96.09 tamassia" } @@ -95399,7 +95385,7 @@ addition to their own purposes before conducting the conversion." , publisher = "Springer-Verlag" , year = 1997 , pages = "286--302" -, url = "http://www.cs.brown.edu/cgc/papers/ll-pdog-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/ll-pdog-97.ps.gz" , keywords = "graph drawing, proximity, CGC, Brown" , update = "98.07 tamassia, 97.03 tamassia" } @@ -96347,7 +96333,7 @@ addition to their own purposes before conducting the conversion." , booktitle = "Proc. 9th Annu. ACM Sympos. Comput. Geom." , year = 1993 , pages = "153--162" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "optimization, CAD, CAM, packing, layout, linear programming, motion planning, separation, configuration space, Minkowski sum" , cites = "aks-oa1dt-90, b-amdsn-89, bb-msbdc-88, c-crmp-87, dhks-isccd-90, grs-kfcg-83, hss-cmpmi-84, kos-cmsrp-91i, l-sisri-84, m-hphc-90, mdl-amm-91, mdl-pcnpc-92, mw-cdrca-88, mfs-2dcmc-87, p-ccmsp-87, pb-cmfm-88, sss-tdczr-86, sp-cppca-92, w-otdcs-85, ZZZ" , update = "98.07 bibrelex, 98.03 bibrelex, 97.03 daniels, 93.09 rote" @@ -96360,7 +96346,7 @@ addition to their own purposes before conducting the conversion." , volume = 84 , year = 1995 , pages = "539--561" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "layout, packing, placement, linear programming, motion planning, Minkowski sum, configuration space" , update = "97.03 daniels" } @@ -96371,7 +96357,7 @@ addition to their own purposes before conducting the conversion." , booktitle = "Proc. 6th Annu. ACM Sympos. Comput. Geom." , year = 1990 , pages = "235--243" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation" , precedes = "lm-cschu-92" , cites = "f-smpst-89, g-eadch-72, gss-egbra-89, m-cacau-89, m-dpggt-89, m-vigau-88p, si-cvd10-89, ZZZ" @@ -96385,7 +96371,7 @@ addition to their own purposes before conducting the conversion." , volume = 8 , year = 1992 , pages = "345--364" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation" , succeeds = "lm-cschu-90" , update = "97.03 daniels" @@ -96398,7 +96384,7 @@ addition to their own purposes before conducting the conversion." , site = "Waterloo, Canada" , year = 1993 , pages = "7--11" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "packing, layout, motion planning, PSPACE" , cites = "cosw-cds-84, hss-cmpmi-84, lm-cancp-93, ZZZ" , update = "98.11 bibrelex, 98.03 mitchell, 97.03 daniels, 93.09 milone+mitchell" @@ -97363,7 +97349,7 @@ rectilinear polygon." , publisher = "Springer-Verlag" , year = 1997 , pages = "135--146" -, url = "http://www.cs.brown.edu/cgc/papers/lttv-argd-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/lttv-argd-97.ps.gz" , keywords = "graph drawing, proximity, CGC, Brown" , update = "98.07 tamassia, 97.03 tamassia" } @@ -104690,7 +104676,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 5th Annu. ACM Sympos. Comput. Geom." , year = 1989 , pages = "197--207" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation" , cites = "acm-aacad-88, acm-cad1b-84, acm-cad2a-84, c-qercf-75, cr-tlcra-88, em-sstcd-87, gy-frcg-86, hhk-tirgc-88, hhk-rsops-87, h-pargc-88, k-rmrs-89, kln-edtur-89, m-vigau-88a, m-vigau-88t, otu-nsga-87, r-paff-80, gss-egbra-89, ss-pmp2g-83, ss-ccsm-85, ss-pponp-88, s-aefsm-87, t-dmeag-51, y-gctsp-88, ZZZ" , update = "98.03 bibrelex, 97.03 daniels" @@ -104702,7 +104688,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 30th Annu. IEEE Sympos. Found. Comput. Sci." , year = 1989 , pages = "500--505" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation" , update = "98.03 agarwal, 97.03 daniels" } @@ -104713,7 +104699,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 7th Canad. Conf. Comput. Geom." , year = 1995 , pages = "79--84" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "computer graphics, simulation, physically-based modeling, linear programming, Minkowski sum, configuration space" , update = "97.03 daniels, 95.09 jones" } @@ -104725,7 +104711,7 @@ used in many computational geometry algorithms. Contains C++ code." , year = 1996 , pages = "129--136" , note = "Proc. SIGGRAPH '96" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "computer graphics, animation, physically-based modeling, linear programming, Minkowski sum, configuration space" , update = "97.03 daniels" } @@ -104737,7 +104723,7 @@ used in many computational geometry algorithms. Contains C++ code." , site = "Waterloo, Canada" , year = 1993 , pages = "473--478" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation" , cites = "ck-acp-70, b-tends-67, cs-arscg-89, e-acg-87, f-smpst-90, f-savd-87, fm-nsala-91, ghms-apsml-91, hhk-tirgc-88, iss-nriac-92, l-knnvd-82, ld-gvdp-81, lm-cschu-90, m-vigau-88a, m-cacau-89, ms-saps-92, sh-cpp-75, si-cvd10-89, ls-ippvd-87, ls-pptmc-87, m-dpggt-89, ZZZ" , update = "98.11 bibrelex, 97.03 daniels, 93.09 milone+mitchell" @@ -104750,7 +104736,7 @@ used in many computational geometry algorithms. Contains C++ code." , volume = 25 , number = 9 , year = 1993 -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "algorithms, polygons, geometric modeling" , update = "98.03 agarwal, 97.03 daniels, 96.05 pascucci" } @@ -104771,7 +104757,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 2nd Canad. Conf. Comput. Geom." , year = 1990 , pages = "40--45" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation, geometric rounding" , cites = "ZZZ" , update = "98.07 bibrelex, 97.03 daniels" @@ -104783,7 +104769,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Abstracts 1st Canad. Conf. Comput. Geom." , year = 1989 , pages = 12 -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation, geometric rounding" , update = "97.03 daniels" } @@ -104794,7 +104780,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 28th Annu. ACM Sympos. Theory Comput." , year = 1996 , pages = "109--118" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "layout, packing, placement, nesting, concave, polygons, Minkowski sum, configuration space" , update = "97.03 daniels" } @@ -104857,7 +104843,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 3rd Canad. Conf. Comput. Geom." , year = 1991 , pages = "243--246" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "layout, nesting, placement, optimization" , update = "97.03 daniels" } @@ -104868,7 +104854,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 4th Canad. Conf. Comput. Geom." , year = 1992 , pages = "236--243" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "concave, polygons, layout, nesting, packing, optimization, Minkowski sum, configuration space" , cites = "dhks-isccd-90, g-ctfsr-86, grs-kfcg-83, kos-cmsrp-91i, ml-sipat-91, mdl-amm-91, s-iamm-82, tw-cmm-73, nh-aplpg-84, s-iamm-88, ZZZ" , update = "98.07 bibrelex, 97.03 daniels" @@ -104881,7 +104867,7 @@ used in many computational geometry algorithms. Contains C++ code." , site = "Waterloo, Canada" , year = 1993 , pages = "485--490" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "geometric modeling, quaternion arithmetic, basis reduction, integer programming, exact arithmetic" , precedes = "mm-roaom-97" , cites = "cdr-rrmrg-92, c-sede-92, crss-igbra-91, e-sap-80, fw-eeacg-92, h-eq-69, kln-edtur-89, mn-fccrp-90a, m-rfldd-90, r-srsrf-77, lll-fprc-82, l-atngc-86, ls-gbra-92, m-rflp-89, s-qrm-78" @@ -104894,7 +104880,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 6th Annu. ACM Sympos. Comput. Geom." , year = 1990 , pages = "244--252" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation" , precedes = "mn-fccrp-90a" , cites = "gj-cigtn-79, gps-crotr-89, h-gsm-89, m-rflp-89, mn-fccrp-90a, m-utcpc-89, s-fprgo-89, tt-pgelt-89, ZZZ" @@ -104910,7 +104896,7 @@ used in many computational geometry algorithms. Contains C++ code." , month = sep , year = 1990 , pages = "753--769" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation" , succeeds = "mn-fccrp-90i" , update = "98.11 bibrelex, 97.03 daniels" @@ -104943,7 +104929,7 @@ used in many computational geometry algorithms. Contains C++ code." , booktitle = "Proc. 7th Canad. Conf. Comput. Geom." , year = 1995 , pages = "55--60" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation, shortest-path rounding, nonuniform grids, geometric modeling, geometric rounding" , update = "97.03 daniels, 95.09 jones" } @@ -104989,7 +104975,7 @@ used in many computational geometry algorithms. Contains C++ code." , volume = 37 , year = 1988 , pages = "377--401" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "robust geometric computation" , succeeds = "m-vigau-88p, m-vigau-88t" , update = "98.11 bibrelex, 97.03 daniels, 95.01 devillers" @@ -105010,7 +104996,7 @@ used in many computational geometry algorithms. Contains C++ code." , volume = 7 , year = 1997 , pages = "25--35" -, url = "http://www.cs.miami.edu/~vjm/papers.html" +, url = "https://www.cs.miami.edu/home/vjm/papers.html" , keywords = "geometric modeling, quaternion arithmetic, basis reduction, integer programming, exact arithmetic" , succeeds = "mm-roaom-93" , update = "97.03 daniels" @@ -109344,11 +109330,11 @@ problems in computational geometry is presented." , update = "96.01 held+mitchell" } -@article{nan2017polyfit, - title = {PolyFit: Polygonal Surface Reconstruction from Point Clouds}, - author = {Nan, Liangliang and Wonka, Peter}, - journal = {ICCV}, - year = {2017} +@article{nan2017polyfit, + title = {PolyFit: Polygonal Surface Reconstruction from Point Clouds}, + author = {Nan, Liangliang and Wonka, Peter}, + journal = {ICCV}, + year = {2017} } @article{nhl-merp-84 @@ -110721,7 +110707,6 @@ envelope of line segments." , number = 1 , year = 1998 , pages = "39--66" -, url = "http://www.inria.fr/RRRT/RR-2575" , succeeds = "ny-oscha-94" , update = "99.11 bibrelex, 99.07 devillers, 98.07 devillers" , abstract = "A set of planar objects is said to be of type $m$ if the @@ -111527,7 +111512,6 @@ encapsulated PostScript" , address = "France" , year = 1998 , note = "TU-0606" -, url = "http://www.inria.fr/RRRT/TU-0606" , keywords = "doctoral thesis" , update = "00.03 devillers" } @@ -113167,7 +113151,7 @@ small) triangulation of a convex polyhedron is NP-complete. Their 3SAT-reduction , edition = "2nd" , publisher = "Cambridge University Press" , year = 1998 -, url = "http://cs.smith.edu/~orourke/books/compgeom.html" +, url = "https://www.science.smith.edu/~jorourke/books/compgeom.html" , comments = "Printed 28 Sep 1998" , update = "01.11 orourke, 99.11 bibrelex, 98.11 orourke" , annote = "Textbook" @@ -113362,8 +113346,8 @@ small) triangulation of a convex polyhedron is NP-complete. Their 3SAT-reduction , month = jun , year = 2000 , note = "LANL arXiv cs.CG/0006035 v3, - \url{http://cs.smith.edu/~orourke/papers.html}" -, url = "http://cs.smith.edu/~orourke/papers.html" + \url{https://www.science.smith.edu/~jorourke/papers.php}" +, url = "https://www.science.smith.edu/~jorourke/papers.php" , archive = "LANL arXiv cs.CG/0006035 v3" , keywords = "polygonal chains, polytopes, polyhedra" , cites = "c-cses-89, s-usedkkk-21" @@ -117683,7 +117667,6 @@ both for rendering and for modeling. Contains C code." , address = "France" , year = 1999 , note = "TU-0619" -, url = "http://www.inria.fr/rrrt/tu-0619.html" , keywords = "doctoral thesis" , update = "02.03 devillers, 00.03 devillers" } @@ -128644,7 +128627,7 @@ Contains C code." , type = "Technical {Report}" , institution = "Courant Institute, New York University" , year = 1996 -, url = "http://cs.nyu.edu" +, url = "https://cs.nyu.edu/" , update = "97.11 bibrelex" } @@ -136211,7 +136194,7 @@ Contains C code." , number = 9 , year = 1990 , pages = "27--39" -, url = "http://www.cc.gatech.edu/gvu/softviz/algoanim/xtango.html" +, url = "https://www.cc.gatech.edu/gvu/ii/softvis/algoanim/xtango.html" , update = "96.01 tamassia" } @@ -139116,7 +139099,7 @@ code." , number = 1 , year = 1996 , pages = "23--26" -, url = "http://www.cs.brown.edu/cgc/papers/t-ds-96.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/t-ds-96.ps.gz" , keywords = "data structures, survey" , update = "97.03 tamassia" } @@ -139145,7 +139128,7 @@ code." @misc{t-gd- , author = "Roberto Tamassia" , title = "Graph Drawing" -, url = "http://www.cs.brown.edu/people/rt/gd.html" +, url = "http://graphdrawing.org/index.html" , update = "98.07 tamassia" } @@ -139159,7 +139142,7 @@ code." , address = "Boca Raton, FL" , year = 1997 , pages = "815--832" -, url = "http://www.cs.brown.edu/cgc/papers/t-gd-97.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/t-gd-97.ps.gz" , keywords = "graph drawing, survey" , update = "97.11 orourke, 97.07 orourke, 97.03 tamassia" } @@ -139254,7 +139237,7 @@ code." , publisher = "CRC Press" , year = 1997 , pages = "86--110" -, url = "http://www.cs.brown.edu/cgc/papers/tc-ds-.ps.gz" +, url = "https://www.cs.brown.edu/cgc/papers/tc-ds-.ps.gz" , keywords = "data structures, survey" , update = "97.03 tamassia" } @@ -139289,7 +139272,7 @@ code." , number = 4 , year = 1996 , pages = "591--606" -, url = "http://www.cs.brown.edu/people/rt/sdcr/report.html" +, url = "https://www.cs.brown.edu/people/rt/sdcr/report.html" , update = "98.07 tamassia+vismara, 97.03 tamassia" , annote = "short form of taacddfdhopsstvw-sdcg-96" } @@ -141035,7 +141018,7 @@ code." , title = "Hexahedral decomposition of polyhedra" , month = oct , year = 1993 -, url = "http://www.ics.uci.edu/~eppstein/gina/Thurston-hexahedra" +, url = "https://www.ics.uci.edu/~eppstein/gina/Thurston-hexahedra" , update = "97.11 bibrelex" } @@ -144105,7 +144088,7 @@ of geometric optics." @misc{v-qfemg-95 , author = "S. Vavasis" , title = "QMG: a finite element mesh generation package" -, url = "http://www.cs.cornell.edu/Info/People/vavasis/qmg-home.html" +, url = "https://www.cs.cornell.edu/info/people/vavasis/qmg-home.html" , update = "97.11 bibrelex" } @@ -151845,7 +151828,7 @@ amplification and suppression of local contrast. Contains C code." , keywords = {Computer Science - Computational Geometry, Computer Science - Data Structures and Algorithms} , year = 2012 , month = may -, adsurl = {http://adsabs.harvard.edu/abs/2012arXiv1205.5434H} +, adsurl = {https://ui.adsabs.harvard.edu/abs/2012arXiv1205.5434H/abstract} , adsnote = {Provided by the SAO/NASA Astrophysics Data System} } @@ -152040,7 +152023,7 @@ pages = {179--189} Booktitle = {24rd Annual ACM-SIAM Symposium on Discrete Algorithms (SODA)}, Year = {2013}, Pages = {1646--1655}, - Url = {http://jeffe.cs.illinois.edu/pubs/pdf/dehn.pdf} + Url = {https://jeffe.cs.illinois.edu/pubs/pdf/dehn.pdf} } @InProceedings{lr-hts-12, @@ -152059,7 +152042,7 @@ pages = {179--189} Volume = {45}, Pages = {215--224}, Year = {2012}, - Url = {http://monge.univ-mlv.fr/~colinde/pub/09edgewidth.pdf} + Url = {https://monge.univ-mlv.fr/~colinde/pub/09edgewidth.pdf} @inproceedings{tang2009interactive, title={Interactive Hausdorff distance computation for general polygonal models}, diff --git a/Documentation/doc/resources/1.8.13/BaseDoxyfile.in b/Documentation/doc/resources/1.8.13/BaseDoxyfile.in index 7d6685977cf..3d749fa16b6 100644 --- a/Documentation/doc/resources/1.8.13/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.13/BaseDoxyfile.in @@ -1,7 +1,7 @@ # Doxyfile 1.8.13 # This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. +# doxygen (https://www.doxygen.nl/) for a project. # # All text after a double hash (##) is considered a comment and is placed in # front of the TAG it is preceding. @@ -20,7 +20,7 @@ # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all text # before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# built into libc) for the transcoding. See https://www.gnu.org/software/libiconv/ # for the list of possible encodings. # The default value is: UTF-8. @@ -409,7 +409,7 @@ EXTENSION_MAPPING = txt=C++ # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. +# documentation. See https://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. @@ -451,7 +451,7 @@ BUILTIN_STL_SUPPORT = YES CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# https://riverbankcomputing.com/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. @@ -834,7 +834,7 @@ LAYOUT_FILE = ${CGAL_DOC_RESOURCE_DIR}/DoxygenLayoutPackage.xml # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. @@ -922,7 +922,7 @@ INPUT = # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# documentation (see: https://www.gnu.org/software/libiconv/) for the list of # possible encodings. # The default value is: UTF-8. @@ -1138,7 +1138,7 @@ SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version +# (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: @@ -1283,7 +1283,7 @@ HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. @@ -1342,7 +1342,7 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# environment (see: https://developer.apple.com/xcode/), introduced with # OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in @@ -1387,7 +1387,7 @@ DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# (see: https://www.microsoft.com/en-us/download/default.aspx) on # Windows. # # The HTML Help Workshop contains a compiler that can convert all HTML output @@ -1463,7 +1463,7 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1471,8 +1471,7 @@ QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). +# Folders (see: https//doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1480,23 +1479,21 @@ QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: https//doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: https//doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# https//doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = @@ -1601,7 +1598,7 @@ FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering +# https://www.mathjax.org) which uses client side Javascript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path @@ -1613,7 +1610,7 @@ USE_MATHJAX = YES # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# https://docs.mathjax.org/en/latest/output/index.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. @@ -1628,7 +1625,7 @@ MATHJAX_FORMAT = HTML-CSS # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. +# MathJax from https://www.mathjax.org before deployment. # The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1644,7 +1641,7 @@ MATHJAX_EXTENSIONS = TeX/AMSmath \ # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: https://docs.mathjax.org/en/latest/output/index.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1691,7 +1688,7 @@ SERVER_BASED_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). +# Xapian (see: https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1704,7 +1701,7 @@ EXTERNAL_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). See the section "External Indexing and +# Xapian (see: https://xapian.org/). See the section "External Indexing and # Searching" for details. # This tag requires that the tag SEARCHENGINE is set to YES. @@ -1891,7 +1888,7 @@ LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See -# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# https://en.wikipedia.org/wiki/BibTeX and \cite for more info. # The default value is: plain. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -2074,7 +2071,7 @@ DOCBOOK_PROGRAMLISTING = NO #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sf.net) file that captures the +# AutoGen Definitions (see https://autogen.sourceforge.net/) file that captures the # structure of the code including all documentation. Note that this feature is # still experimental and incomplete at the moment. # The default value is: NO. @@ -2271,7 +2268,7 @@ CLASS_DIAGRAMS = NO # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see: -# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the +# https://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. @@ -2293,7 +2290,7 @@ HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz (see: -# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent +# https://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO # The default value is: NO. @@ -2448,7 +2445,7 @@ DIRECTORY_GRAPH = NO # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: -# http://www.graphviz.org/)). +# https://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). diff --git a/Documentation/doc/resources/1.8.13/footer.html b/Documentation/doc/resources/1.8.13/footer.html index a1ef3c24ea8..9aab1a87eea 100644 --- a/Documentation/doc/resources/1.8.13/footer.html +++ b/Documentation/doc/resources/1.8.13/footer.html @@ -8,14 +8,14 @@ move the footer to the bottom of the page. -->
    $navpath
diff --git a/Documentation/doc/resources/1.8.13/header.html b/Documentation/doc/resources/1.8.13/header.html index 8c8b86f5b9d..aaa5e95ea30 100644 --- a/Documentation/doc/resources/1.8.13/header.html +++ b/Documentation/doc/resources/1.8.13/header.html @@ -1,6 +1,6 @@ - + diff --git a/Documentation/doc/resources/1.8.13/header_package.html b/Documentation/doc/resources/1.8.13/header_package.html index 544fd3ced7f..9e6fe125d50 100644 --- a/Documentation/doc/resources/1.8.13/header_package.html +++ b/Documentation/doc/resources/1.8.13/header_package.html @@ -1,6 +1,6 @@ - + diff --git a/Documentation/doc/resources/1.8.14/BaseDoxyfile.in b/Documentation/doc/resources/1.8.14/BaseDoxyfile.in index 44a6b9f72b3..1a59e5d2d97 100644 --- a/Documentation/doc/resources/1.8.14/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.14/BaseDoxyfile.in @@ -1,7 +1,7 @@ # Doxyfile 1.8.14 # This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. +# doxygen (https://www.doxygen.nl/) for a project. # # All text after a double hash (##) is considered a comment and is placed in # front of the TAG it is preceding. @@ -404,7 +404,7 @@ EXTENSION_MAPPING = txt=C++ # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. +# documentation. See https://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. @@ -1333,7 +1333,7 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: https://developer.apple.com/tools/xcode/), introduced with +# environment (see: https://developer.apple.com/xcode/), introduced with # OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in @@ -1601,7 +1601,7 @@ USE_MATHJAX = YES # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# https://docs.mathjax.org/en/latest/output/index.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. @@ -1632,7 +1632,7 @@ MATHJAX_EXTENSIONS = TeX/AMSmath \ # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: https://docs.mathjax.org/en/latest/output/index.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -2062,7 +2062,7 @@ DOCBOOK_PROGRAMLISTING = NO #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# AutoGen Definitions (see https://autogen.sourceforge.net/) file that captures # the structure of the code including all documentation. Note that this feature # is still experimental and incomplete at the moment. # The default value is: NO. @@ -2266,7 +2266,7 @@ HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz (see: -# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent +# https://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO # The default value is: NO. @@ -2421,7 +2421,7 @@ DIRECTORY_GRAPH = NO # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: -# http://www.graphviz.org/)). +# https://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). diff --git a/Documentation/doc/resources/1.8.14/footer.html b/Documentation/doc/resources/1.8.14/footer.html index a1ef3c24ea8..379470c59e2 100644 --- a/Documentation/doc/resources/1.8.14/footer.html +++ b/Documentation/doc/resources/1.8.14/footer.html @@ -8,14 +8,14 @@ move the footer to the bottom of the page. -->
    $navpath
diff --git a/Documentation/doc/resources/1.8.14/header.html b/Documentation/doc/resources/1.8.14/header.html index 8c8b86f5b9d..aaa5e95ea30 100644 --- a/Documentation/doc/resources/1.8.14/header.html +++ b/Documentation/doc/resources/1.8.14/header.html @@ -1,6 +1,6 @@ - + diff --git a/Documentation/doc/resources/1.8.14/header_package.html b/Documentation/doc/resources/1.8.14/header_package.html index 89f76a8a441..f429c63135d 100644 --- a/Documentation/doc/resources/1.8.14/header_package.html +++ b/Documentation/doc/resources/1.8.14/header_package.html @@ -1,6 +1,6 @@ - + diff --git a/Documentation/doc/resources/1.8.20/BaseDoxyfile.in b/Documentation/doc/resources/1.8.20/BaseDoxyfile.in index 7f258d33a4b..f950a6836db 100644 --- a/Documentation/doc/resources/1.8.20/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.20/BaseDoxyfile.in @@ -1,7 +1,7 @@ # Doxyfile 1.8.20 # This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. +# doxygen (https://www.doxygen.nl/) for a project. # # All text after a double hash (##) is considered a comment and is placed in # front of the TAG it is preceding. @@ -1683,7 +1683,7 @@ USE_MATHJAX = YES # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# https://docs.mathjax.org/en/latest/output/index.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. @@ -1714,7 +1714,7 @@ MATHJAX_EXTENSIONS = TeX/AMSmath \ # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: https://docs.mathjax.org/en/latest/output/index.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -2146,7 +2146,7 @@ DOCBOOK_OUTPUT = docbook #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# AutoGen Definitions (see https://autogen.sourceforge.net/) file that captures # the structure of the code including all documentation. Note that this feature # is still experimental and incomplete at the moment. # The default value is: NO. @@ -2350,7 +2350,7 @@ HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz (see: -# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent +# https://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO # The default value is: NO. @@ -2505,7 +2505,7 @@ DIRECTORY_GRAPH = NO # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: -# http://www.graphviz.org/)). +# https://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). diff --git a/Documentation/doc/resources/1.8.20/footer.html b/Documentation/doc/resources/1.8.20/footer.html index cd9ad4553bc..28e5afe0f39 100644 --- a/Documentation/doc/resources/1.8.20/footer.html +++ b/Documentation/doc/resources/1.8.20/footer.html @@ -7,13 +7,13 @@ move the footer to the bottom of the page. --> diff --git a/Documentation/doc/resources/1.8.20/header.html b/Documentation/doc/resources/1.8.20/header.html index 50e4e4dcb49..c0530eec8bf 100644 --- a/Documentation/doc/resources/1.8.20/header.html +++ b/Documentation/doc/resources/1.8.20/header.html @@ -1,6 +1,6 @@ - + diff --git a/Documentation/doc/resources/1.8.20/header_package.html b/Documentation/doc/resources/1.8.20/header_package.html index 007d84e7b10..d2a1ed6051b 100644 --- a/Documentation/doc/resources/1.8.20/header_package.html +++ b/Documentation/doc/resources/1.8.20/header_package.html @@ -1,6 +1,6 @@ - + diff --git a/Documentation/doc/resources/1.8.4/BaseDoxyfile.in b/Documentation/doc/resources/1.8.4/BaseDoxyfile.in index 45d422384df..10f3050a8f3 100644 --- a/Documentation/doc/resources/1.8.4/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.4/BaseDoxyfile.in @@ -1,7 +1,7 @@ # Doxyfile 1.8.4 # This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. +# doxygen (https://www.doxygen.nl/) for a project. # # All text after a double hash (##) is considered a comment and is placed # in front of the TAG it is preceding . @@ -20,7 +20,7 @@ # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. +# https://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 @@ -409,7 +409,7 @@ EXTENSION_MAPPING = # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all # comments according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. +# documentation. See https://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you # can mix doxygen, HTML, and XML commands with Markdown formatting. # Disable only in case of backward compatibilities issues. @@ -754,7 +754,7 @@ LAYOUT_FILE = ${CGAL_DOC_RESOURCE_DIR}/DoxygenLayoutPackage.xml # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also -# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# https://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. Do not use # file names with spaces, bibtex cannot handle them. @@ -827,7 +827,7 @@ INPUT = # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# into libc) for the transcoding. See https://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 @@ -1005,7 +1005,7 @@ REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You +# tagging system (see https://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO @@ -1110,7 +1110,7 @@ HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. +# see https://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. @@ -1251,25 +1251,25 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters +# https//doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see -# +# # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = @@ -1277,7 +1277,7 @@ QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. -# +# # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = @@ -1361,7 +1361,7 @@ FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax -# (see http://www.mathjax.org) which uses client side Javascript for the +# (see https://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you may also need to install MathJax separately and @@ -1384,7 +1384,7 @@ MATHJAX_FORMAT = HTML-CSS # the MathJax Content Delivery Network so you can quickly see the result without # installing MathJax. # However, it is strongly recommended to install a local -# copy of MathJax from http://www.mathjax.org before deployment. +# copy of MathJax from https://www.mathjax.org before deployment. MATHJAX_RELPATH = ../../MathJax/ @@ -1560,7 +1560,7 @@ LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See -# http://en.wikipedia.org/wiki/BibTeX for more info. +# https://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain @@ -1850,7 +1850,7 @@ CLASS_DIAGRAMS = NO # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# https://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. diff --git a/Documentation/doc/resources/1.8.4/footer.html b/Documentation/doc/resources/1.8.4/footer.html index 8b23c63651f..5c8bc85e026 100644 --- a/Documentation/doc/resources/1.8.4/footer.html +++ b/Documentation/doc/resources/1.8.4/footer.html @@ -5,14 +5,14 @@
    $navpath
diff --git a/Documentation/doc/resources/1.8.4/header.html b/Documentation/doc/resources/1.8.4/header.html index a98007ec2a5..8ffa7e46ea8 100644 --- a/Documentation/doc/resources/1.8.4/header.html +++ b/Documentation/doc/resources/1.8.4/header.html @@ -1,5 +1,5 @@ - + @@ -46,8 +46,8 @@ $mathjax onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-
diff --git a/Documentation/doc/resources/1.8.4/header_package.html b/Documentation/doc/resources/1.8.4/header_package.html index 4b3ae0e7cc2..e47f3e9a158 100644 --- a/Documentation/doc/resources/1.8.4/header_package.html +++ b/Documentation/doc/resources/1.8.4/header_package.html @@ -1,5 +1,5 @@ - + @@ -63,8 +63,8 @@ $mathjax onmouseout="return searchBox.OnSearchSelectHide()" alt=""/>
@@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "../Manual/search",false,'Search');
-
diff --git a/Documentation/doc/resources/1.9.3/BaseDoxyfile.in b/Documentation/doc/resources/1.9.3/BaseDoxyfile.in index d95cfc9dd5a..775ba2ce757 100644 --- a/Documentation/doc/resources/1.9.3/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.9.3/BaseDoxyfile.in @@ -1,7 +1,7 @@ # Doxyfile 1.9.3 # This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. +# doxygen (https://www.doxygen.nl/) for a project. # # All text after a double hash (##) is considered a comment and is placed in # front of the TAG it is preceding. @@ -1688,7 +1688,7 @@ USE_MATHJAX = YES # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# https://docs.mathjax.org/en/latest/output/index.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. @@ -1719,7 +1719,7 @@ MATHJAX_EXTENSIONS = TeX/AMSmath \ # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: https://docs.mathjax.org/en/latest/output/index.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -2151,7 +2151,7 @@ DOCBOOK_OUTPUT = docbook #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# AutoGen Definitions (see https://autogen.sourceforge.net/) file that captures # the structure of the code including all documentation. Note that this feature # is still experimental and incomplete at the moment. # The default value is: NO. @@ -2261,7 +2261,7 @@ PREDEFINED = DOXYGEN_RUNNING \ "CGAL_NP_TEMPLATE_PARAMETERS_2=NamedParameters2 = CGAL::parameters::Default_named_parameter" \ "CGAL_NP_CLASS_2=NamedParameters2" \ CGAL_DEPRECATED - + # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The @@ -2347,7 +2347,7 @@ HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz (see: -# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent +# https://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO # The default value is: NO. @@ -2507,7 +2507,7 @@ DIRECTORY_GRAPH = NO # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: -# http://www.graphviz.org/)). +# https://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). diff --git a/Documentation/doc/resources/1.9.3/footer.html b/Documentation/doc/resources/1.9.3/footer.html index cd9ad4553bc..28e5afe0f39 100644 --- a/Documentation/doc/resources/1.9.3/footer.html +++ b/Documentation/doc/resources/1.9.3/footer.html @@ -7,13 +7,13 @@ move the footer to the bottom of the page. --> diff --git a/Documentation/doc/resources/1.9.3/header.html b/Documentation/doc/resources/1.9.3/header.html index 50e4e4dcb49..c0530eec8bf 100644 --- a/Documentation/doc/resources/1.9.3/header.html +++ b/Documentation/doc/resources/1.9.3/header.html @@ -1,6 +1,6 @@ - + diff --git a/Documentation/doc/resources/1.9.3/header_package.html b/Documentation/doc/resources/1.9.3/header_package.html index 007d84e7b10..d2a1ed6051b 100644 --- a/Documentation/doc/resources/1.9.3/header_package.html +++ b/Documentation/doc/resources/1.9.3/header_package.html @@ -1,6 +1,6 @@ - + diff --git a/Documentation/doc/scripts/generate_how_to_cite.py b/Documentation/doc/scripts/generate_how_to_cite.py index e1108d6a51f..470c71d4e45 100644 --- a/Documentation/doc/scripts/generate_how_to_cite.py +++ b/Documentation/doc/scripts/generate_how_to_cite.py @@ -46,7 +46,7 @@ software. If you want to cite the \cgal Library or project as a whole, please -- cite: \cgal, Computational Geometry Algorithms Library, https://www.cgal.org +- cite: \cgal, Computational Geometry Algorithms Library, https://www.cgal.org - use the first bibtex entry from the file how_to_cite_cgal.bib. ## Citing the User and Reference Manual ## @@ -65,7 +65,7 @@ If you want to refer to \cgal manual, please cite the appropriate The \cgal Project. \cgal User and Reference Manual. \cgal Editorial Board, ${CGAL_CREATED_VERSION_NUM} edition, ${CGAL_BUILD_YEAR4}. -[ bib | +[ bib | http ] @@ -80,7 +80,7 @@ result_txt_footer=r""" """ pre_html=r""" - + diff --git a/Documentation/doc/scripts/html_output_post_processing.py b/Documentation/doc/scripts/html_output_post_processing.py index 44d15aa6d70..5402d7bc50f 100755 --- a/Documentation/doc/scripts/html_output_post_processing.py +++ b/Documentation/doc/scripts/html_output_post_processing.py @@ -55,7 +55,7 @@ def write_out_html(d, fn): f = codecs.open(fn, 'w', encoding='utf-8') # this is the normal doxygen doctype, which is thrown away by pyquery f.write('\n') - f.write('') + f.write('') if d.html() is not None: f.write(d.html()) f.write('\n') @@ -85,7 +85,7 @@ def clean_doc(): for fn in duplicate_files: os.remove(fn) -# from http://stackoverflow.com/a/1597755/105672 +# from https://stackoverflow.com/a/1597755/105672 def re_replace_in_file(pat, s_after, fname): # first, see if the pattern is even in the file. with codecs.open(fname, encoding='utf-8') as f: diff --git a/Filtered_kernel/TODO b/Filtered_kernel/TODO index 477746d7bce..7e1b5441ad9 100644 --- a/Filtered_kernel/TODO +++ b/Filtered_kernel/TODO @@ -140,7 +140,7 @@ except we could merge stuff with Olivier's Fixed ! So the good choice seems to be to have data stored in each predicate object, and having the kernel store a predicate object for each predicate. Then the orientation_2_object() simply returns a reference to it. - + Then it means algorithms should use one "global" object per predicate (e.g. one orientation object for a whole Triangulation). Except for cases where they actually want different contexts. diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Angle_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Angle_3.h index ac57decb63e..e9428fd2917 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Angle_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Angle_3.h @@ -21,7 +21,7 @@ #include #include -// inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf +// inspired from https://people.csail.mit.edu/amy/papers/box-jgt.pdf namespace CGAL { diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_3.h b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_3.h index 3b94f56663c..2b0ef97d7fc 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_3.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel/internal/Static_filters/Do_intersect_3.h @@ -26,7 +26,7 @@ #include -// inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf +// inspired from https://people.csail.mit.edu/amy/papers/box-jgt.pdf namespace CGAL { diff --git a/GraphicsView/doc/GraphicsView/fig_src/uml-design.graphml b/GraphicsView/doc/GraphicsView/fig_src/uml-design.graphml index b4d866c7279..39d1878397c 100644 --- a/GraphicsView/doc/GraphicsView/fig_src/uml-design.graphml +++ b/GraphicsView/doc/GraphicsView/fig_src/uml-design.graphml @@ -1,5 +1,5 @@ - + diff --git a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/resources/about_CGAL.html b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/resources/about_CGAL.html index 6b2b2a5d943..f2f0fb9318b 100644 --- a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/resources/about_CGAL.html +++ b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/resources/about_CGAL.html @@ -3,6 +3,6 @@

Computational Geometry Algorithms Library

CGAL provides efficient and reliable geometric algorithms in the form of a C++ library.

-

For more information visit www.cgal.org

+

For more information visit www.cgal.org

diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index c0dca7da118..30e31329e62 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -3191,7 +3191,7 @@ Release date: October 2012 - Added more general script to create CMakeLists.txt files: `cgal_create_CMakeLists` - Availability tests for C++11 features are now performed with the - help of [Boost.Config](http://www.boost.org/libs/config). A Boost + help of [Boost.Config](https://www.boost.org/libs/config). A Boost version of 1.40.0 or higher is needed to use C++11 features. ### 2D Arrangement @@ -3683,7 +3683,7 @@ CGAL 3.7 offers the following improvements and new functionality : - Some demos now require a version of Qt4 >= 4.3. - CGAL\_PDB is no longer provided with CGAL. An alternative solution for people interested in reading PDB files is to use ESBTL - (http://esbtl.sourceforge.net/). + (https://esbtl.sourceforge.net/). - Fix issues of the CGAL wrappers around the CORE library, on 64 bits platforms. diff --git a/Installation/LICENSE.GPL b/Installation/LICENSE.GPL index 94a9ed024d3..ae0725d8014 100644 --- a/Installation/LICENSE.GPL +++ b/Installation/LICENSE.GPL @@ -1,7 +1,7 @@ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found. GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see -. +. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. +. diff --git a/Installation/LICENSE.LGPL b/Installation/LICENSE.LGPL index 65c5ca88a67..1cd6ad68146 100644 --- a/Installation/LICENSE.LGPL +++ b/Installation/LICENSE.LGPL @@ -1,7 +1,7 @@ GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. diff --git a/Installation/cmake/modules/FindTBB.cmake b/Installation/cmake/modules/FindTBB.cmake index 3cbea03d9b9..8b7aa08a92b 100644 --- a/Installation/cmake/modules/FindTBB.cmake +++ b/Installation/cmake/modules/FindTBB.cmake @@ -43,7 +43,7 @@ #------------------------------------------------------------------- # This file is part of the CMake build system for OGRE # (Object-oriented Graphics Rendering Engine) -# For the latest info, see http://www.ogre3d.org/ +# For the latest info, see https://www.ogre3d.org/ # # The contents of this file are placed in the public domain. Feel # free to make use of it in any way you like. diff --git a/Installation/doc_html/Manual/index.html b/Installation/doc_html/Manual/index.html index ce6b70c0d9a..446d46ff910 100644 --- a/Installation/doc_html/Manual/index.html +++ b/Installation/doc_html/Manual/index.html @@ -1,10 +1,10 @@ - + CGAL - Computational Geometry Algorithms Library - + diff --git a/Installation/doc_html/Manual/packages.html b/Installation/doc_html/Manual/packages.html index ce6b70c0d9a..446d46ff910 100644 --- a/Installation/doc_html/Manual/packages.html +++ b/Installation/doc_html/Manual/packages.html @@ -1,10 +1,10 @@ - + CGAL - Computational Geometry Algorithms Library - + diff --git a/Installation/doc_html/index.html b/Installation/doc_html/index.html index 24cd53e0c23..5638303fdc9 100644 --- a/Installation/doc_html/index.html +++ b/Installation/doc_html/index.html @@ -1,10 +1,10 @@ - + CGAL - Computational Geometry Algorithms Library - + @@ -19,7 +19,7 @@

-The goal of the CGAL Open Source Project is to provide +The goal of the CGAL Open Source Project is to provide easy access to efficient and reliable geometric algorithms in the form of a C++ library.

@@ -36,7 +36,7 @@ You can access the CGAL Online Manual from the @@ -46,7 +46,7 @@ You can access the CGAL Online Manual from the

CGAL is distributed under a dual-license scheme. CGAL can be used together with Open Source software free of charge. Using CGAL in other contexts can be done by obtaining a commercial license from -GeometryFactory. +GeometryFactory. For more details see the License page.

diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h index 7d7d435a302..c1e3605e862 100644 --- a/Installation/include/CGAL/config.h +++ b/Installation/include/CGAL/config.h @@ -52,7 +52,7 @@ #endif // CGAL_TEST_SUITE and NDEBUG // See [[Small features/Visual_Leak_Detector]] in CGAL developers wiki -// See also: http://vld.codeplex.com/ +// See also: https://kinddragon.github.io/vld/ #if defined(CGAL_ENABLE_VLD) # include #endif // CGAL_ENABLE_VLD @@ -296,7 +296,7 @@ using std::max; // Macros to detect features of clang. We define them for the other // compilers. -// See http://clang.llvm.org/docs/LanguageExtensions.html +// See https://clang.llvm.org/docs/LanguageExtensions.html // See also https://en.cppreference.com/w/cpp/experimental/feature_test #ifndef __has_feature #define __has_feature(x) 0 // Compatibility with non-clang compilers. @@ -473,7 +473,7 @@ namespace cpp11{ // The fallthrough attribute // See for clang: -// http://clang.llvm.org/docs/AttributeReference.html#statement-attributes +// https://clang.llvm.org/docs/AttributeReference.html#statement-attributes // See for gcc: // https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html #if __cplusplus > 201402L && __has_cpp_attribute(fallthrough) 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..e5bea904e92 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 @@ -14,7 +14,7 @@ #ifndef CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_LINE_3_DO_INTERSECT_H #define CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_LINE_3_DO_INTERSECT_H -// inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf +// inspired from https://people.csail.mit.edu/amy/papers/box-jgt.pdf #include #include 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..a96148099c5 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 @@ -14,7 +14,7 @@ #ifndef CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_RAY_3_DO_INTERSECT_H #define CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_RAY_3_DO_INTERSECT_H -// inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf +// inspired from https://people.csail.mit.edu/amy/papers/box-jgt.pdf #include // for CGAL::internal::do_intersect_bbox_segment_aux 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..fa1c0b8ba24 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 @@ -22,7 +22,7 @@ #include -// inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf +// inspired from https://people.csail.mit.edu/amy/papers/box-jgt.pdf // This algorithm intersects the line with the x-, y-, and z-slabs of the // bounding box, and computes the interval [t1, t2], in the 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..e389f17136f 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 @@ -20,7 +20,7 @@ #include // for CGAL::internal::do_intersect_bbox_segment_aux -// inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf +// inspired from https://people.csail.mit.edu/amy/papers/box-jgt.pdf namespace CGAL { namespace Intersections { 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..5a961c3d5e2 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 @@ -14,7 +14,7 @@ #ifndef CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_SEGMENT_3_DO_INTERSECT_H #define CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_SEGMENT_3_DO_INTERSECT_H -// inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf +// inspired from https://people.csail.mit.edu/amy/papers/box-jgt.pdf #include // for CGAL::internal::do_intersect_bbox_segment_aux diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_3/cmake/FindGoogleTest.cmake b/Linear_cell_complex/benchmark/Linear_cell_complex_3/cmake/FindGoogleTest.cmake index 37bd9a812d6..5e86a4dd4cf 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_3/cmake/FindGoogleTest.cmake +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_3/cmake/FindGoogleTest.cmake @@ -13,7 +13,7 @@ # use this file except in compliance with the License. You may obtain a copy # of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT diff --git a/Linear_cell_complex/benchmark/README.TXT b/Linear_cell_complex/benchmark/README.TXT index a721960047d..588995c5edb 100644 --- a/Linear_cell_complex/benchmark/README.TXT +++ b/Linear_cell_complex/benchmark/README.TXT @@ -18,9 +18,9 @@ INSTALLATION: 1) Install all the following libraries: CGAL: https://www.cgal.org/ -CGoGN: http://cgogn.u-strasbg.fr/ -OpenMesh: http://www.openmesh.org/ -OpenVolumeMesh: http://www.openvolumemesh.org/ +CGoGN: https://cgogn.github.io/ +OpenMesh: https://www.openmesh.org/ +OpenVolumeMesh: https://www.openvolumemesh.org/ 2) create links (or copy directory): * in the 2D directory: @@ -41,7 +41,7 @@ CGAL_BUILD_DIR being the build directory of the CGAL library. * In 2D, the programs take off files as input. * In 3D, lcc and cgogn take tetmesh and OpenVolumeMesh takes ovm. -You can create a tetmesh file using tetgen programm with an off file as input (http://tetgen.berlios.de/) with option -g to generate XXX.mesh file. Rename this file into XXX.tetmesh. Modify the file to keep only the two following sections: +You can create a tetmesh file using tetgen programm with an off file as input (https://www.berlios.de/software/tetgen/) with option -g to generate XXX.mesh file. Rename this file into XXX.tetmesh. Modify the file to keep only the two following sections: ********************** Vertices diff --git a/Maintenance/deb/sid/debian/README.Debian b/Maintenance/deb/sid/debian/README.Debian index 4be997664d7..e1056ac3ab7 100644 --- a/Maintenance/deb/sid/debian/README.Debian +++ b/Maintenance/deb/sid/debian/README.Debian @@ -44,7 +44,7 @@ and pass the option -DQGLVIEWER_INCLUDE_DIR=/some/dir -to cmake. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=522659 for more +to cmake. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=522659 for more information. -- Joachim Reichel Sat, 06 Feb 2010 12:29:02 +0100 diff --git a/Maintenance/deb/sid/debian/copyright b/Maintenance/deb/sid/debian/copyright index ecc6058b7dc..6390c1a2874 100644 --- a/Maintenance/deb/sid/debian/copyright +++ b/Maintenance/deb/sid/debian/copyright @@ -318,7 +318,7 @@ src/CGALCore and include/CGAL/CORE. Copyright (c) 1995-2004 Exact Computation Project All rights reserved. - This file is part of CORE (http://cs.nyu.edu/exact/core/). + This file is part of CORE (https://cs.nyu.edu/exact/core/). You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. diff --git a/Maintenance/deb/sid/debian/rules b/Maintenance/deb/sid/debian/rules index 4e3de31d8e9..a3533b8b2cb 100755 --- a/Maintenance/deb/sid/debian/rules +++ b/Maintenance/deb/sid/debian/rules @@ -2,7 +2,7 @@ # export DH_VERBOSE=1 -# See http://wiki.debian.org/Hardening#Notes_for_packages_using_CMake +# See https://wiki.debian.org/Hardening#Notes_for_packages_using_CMake CFLAGS := $(CFLAGS) $(CPPFLAGS) CXXFLAGS := $(CXXFLAGS) $(CPPFLAGS) @@ -26,11 +26,11 @@ override_dh_auto_configure: cd shared && QTDIR= cmake .. \ -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release \ -DWITH_CGAL_Qt3=OFF -DWITH_demos=OFF -DWITH_examples=OFF \ - -DCGAL_ENABLE_PRECONFIG=OFF -DBUILD_SHARED_LIBS=TRUE -DCMAKE_SKIP_RPATH=TRUE + -DCGAL_ENABLE_PRECONFIG=OFF -DBUILD_SHARED_LIBS=TRUE -DCMAKE_SKIP_RPATH=TRUE mkdir -p shared/demo/CGAL_ipelets cd shared/demo/CGAL_ipelets && QTDIR= cmake ../../../demo/CGAL_ipelets \ -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release \ - -DCGAL_DIR=$(CURDIR)/shared + -DCGAL_DIR=$(CURDIR)/shared override_dh_auto_build: $(MAKE) -C static diff --git a/Maintenance/deb/squeeze/debian/README.Debian b/Maintenance/deb/squeeze/debian/README.Debian index 4be997664d7..e1056ac3ab7 100644 --- a/Maintenance/deb/squeeze/debian/README.Debian +++ b/Maintenance/deb/squeeze/debian/README.Debian @@ -44,7 +44,7 @@ and pass the option -DQGLVIEWER_INCLUDE_DIR=/some/dir -to cmake. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=522659 for more +to cmake. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=522659 for more information. -- Joachim Reichel Sat, 06 Feb 2010 12:29:02 +0100 diff --git a/Maintenance/deb/squeeze/debian/copyright b/Maintenance/deb/squeeze/debian/copyright index ecc6058b7dc..6390c1a2874 100644 --- a/Maintenance/deb/squeeze/debian/copyright +++ b/Maintenance/deb/squeeze/debian/copyright @@ -318,7 +318,7 @@ src/CGALCore and include/CGAL/CORE. Copyright (c) 1995-2004 Exact Computation Project All rights reserved. - This file is part of CORE (http://cs.nyu.edu/exact/core/). + This file is part of CORE (https://cs.nyu.edu/exact/core/). You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. diff --git a/Maintenance/deb/squeeze/debian/rules b/Maintenance/deb/squeeze/debian/rules index 4e3de31d8e9..a3533b8b2cb 100755 --- a/Maintenance/deb/squeeze/debian/rules +++ b/Maintenance/deb/squeeze/debian/rules @@ -2,7 +2,7 @@ # export DH_VERBOSE=1 -# See http://wiki.debian.org/Hardening#Notes_for_packages_using_CMake +# See https://wiki.debian.org/Hardening#Notes_for_packages_using_CMake CFLAGS := $(CFLAGS) $(CPPFLAGS) CXXFLAGS := $(CXXFLAGS) $(CPPFLAGS) @@ -26,11 +26,11 @@ override_dh_auto_configure: cd shared && QTDIR= cmake .. \ -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release \ -DWITH_CGAL_Qt3=OFF -DWITH_demos=OFF -DWITH_examples=OFF \ - -DCGAL_ENABLE_PRECONFIG=OFF -DBUILD_SHARED_LIBS=TRUE -DCMAKE_SKIP_RPATH=TRUE + -DCGAL_ENABLE_PRECONFIG=OFF -DBUILD_SHARED_LIBS=TRUE -DCMAKE_SKIP_RPATH=TRUE mkdir -p shared/demo/CGAL_ipelets cd shared/demo/CGAL_ipelets && QTDIR= cmake ../../../demo/CGAL_ipelets \ -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release \ - -DCGAL_DIR=$(CURDIR)/shared + -DCGAL_DIR=$(CURDIR)/shared override_dh_auto_build: $(MAKE) -C static diff --git a/Maintenance/deb/wheezy/debian/README.Debian b/Maintenance/deb/wheezy/debian/README.Debian index 4be997664d7..e1056ac3ab7 100644 --- a/Maintenance/deb/wheezy/debian/README.Debian +++ b/Maintenance/deb/wheezy/debian/README.Debian @@ -44,7 +44,7 @@ and pass the option -DQGLVIEWER_INCLUDE_DIR=/some/dir -to cmake. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=522659 for more +to cmake. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=522659 for more information. -- Joachim Reichel Sat, 06 Feb 2010 12:29:02 +0100 diff --git a/Maintenance/deb/wheezy/debian/copyright b/Maintenance/deb/wheezy/debian/copyright index ecc6058b7dc..6390c1a2874 100644 --- a/Maintenance/deb/wheezy/debian/copyright +++ b/Maintenance/deb/wheezy/debian/copyright @@ -318,7 +318,7 @@ src/CGALCore and include/CGAL/CORE. Copyright (c) 1995-2004 Exact Computation Project All rights reserved. - This file is part of CORE (http://cs.nyu.edu/exact/core/). + This file is part of CORE (https://cs.nyu.edu/exact/core/). You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. diff --git a/Maintenance/deb/wheezy/debian/rules b/Maintenance/deb/wheezy/debian/rules index 4e3de31d8e9..a3533b8b2cb 100755 --- a/Maintenance/deb/wheezy/debian/rules +++ b/Maintenance/deb/wheezy/debian/rules @@ -2,7 +2,7 @@ # export DH_VERBOSE=1 -# See http://wiki.debian.org/Hardening#Notes_for_packages_using_CMake +# See https://wiki.debian.org/Hardening#Notes_for_packages_using_CMake CFLAGS := $(CFLAGS) $(CPPFLAGS) CXXFLAGS := $(CXXFLAGS) $(CPPFLAGS) @@ -26,11 +26,11 @@ override_dh_auto_configure: cd shared && QTDIR= cmake .. \ -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release \ -DWITH_CGAL_Qt3=OFF -DWITH_demos=OFF -DWITH_examples=OFF \ - -DCGAL_ENABLE_PRECONFIG=OFF -DBUILD_SHARED_LIBS=TRUE -DCMAKE_SKIP_RPATH=TRUE + -DCGAL_ENABLE_PRECONFIG=OFF -DBUILD_SHARED_LIBS=TRUE -DCMAKE_SKIP_RPATH=TRUE mkdir -p shared/demo/CGAL_ipelets cd shared/demo/CGAL_ipelets && QTDIR= cmake ../../../demo/CGAL_ipelets \ -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release \ - -DCGAL_DIR=$(CURDIR)/shared + -DCGAL_DIR=$(CURDIR)/shared override_dh_auto_build: $(MAKE) -C static diff --git a/Maintenance/infrastructure/cgal.geometryfactory.com/crontab b/Maintenance/infrastructure/cgal.geometryfactory.com/crontab index ce30c5ee6d7..633a3f95570 100644 --- a/Maintenance/infrastructure/cgal.geometryfactory.com/crontab +++ b/Maintenance/infrastructure/cgal.geometryfactory.com/crontab @@ -107,7 +107,7 @@ LC_CTYPE=en_US.UTF-8 # - on trunk #0 21 * * Sat cd $HOME/CGAL/create_internal_release; scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/trunk --public --do-it -# Check the links of http://www.cgal.org/projects.html every sunday at 17:42 +# Check the links of https://www.cgal.org/projects.html every sunday at 17:42 #42 17 * * Sun linklint -host www.cgal.org -http /projects.html -net -no_anchors -quiet -silent -error # A test that does not work diff --git a/Maintenance/infrastructure/renoir.geometryfactory.com/boost/user-config.jam b/Maintenance/infrastructure/renoir.geometryfactory.com/boost/user-config.jam index 60d4ad326c3..cb26334a389 100644 --- a/Maintenance/infrastructure/renoir.geometryfactory.com/boost/user-config.jam +++ b/Maintenance/infrastructure/renoir.geometryfactory.com/boost/user-config.jam @@ -2,13 +2,13 @@ # Copyright 2004 John Maddock # Copyright 2002, 2003, 2004, 2007 Vladimir Prus # Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) +# (See accompanying file LICENSE_1_0.txt or https://www.boost.org/LICENSE_1_0.txt) # This file is used to configure your Boost.Build installation. You can modify # this file in place, or you can place it in a permanent location so that it # does not get overwritten should you get a new version of Boost.Build. See: # -# http://www.boost.org/boost-build2/doc/html/bbv2/overview/configuration.html +# https://www.boost.org/build/doc/html/bbv2/overview/configuration.html # # for documentation about possible permanent locations. @@ -17,7 +17,7 @@ # example lines and adjust them to taste. The complete list of supported tools, # and configuration instructions can be found at: # -# http://boost.org/boost-build2/doc/html/bbv2/reference/tools.html +# https://www.boost.org/build/doc/html/bbv2/reference/tools.html # # This file uses Jam language syntax to describe available tools. Mostly, @@ -31,7 +31,7 @@ # # More details about the syntax can be found at: # -# http://boost.org/boost-build2/doc/html/bbv2/advanced.html#bbv2.advanced.jam_language +# https://www.boost.org/build/doc/html/jam/language.html # # ------------------ @@ -96,7 +96,7 @@ using gcc : : /usr/local/packages/gcc-4.5/bin/g++ ; using gcc : cxxdebug : "/usr/lib64/ccache/g++" # your path to the C++ compiler - : -D_GLIBCXX_DEBUG + : -D_GLIBCXX_DEBUG ; using gcc diff --git a/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-4.8_CXX0X/patch-qt-4.8/QtCore/qobjectdefs.h b/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-4.8_CXX0X/patch-qt-4.8/QtCore/qobjectdefs.h index 8cfc61a0e88..1b633566c73 100644 --- a/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-4.8_CXX0X/patch-qt-4.8/QtCore/qobjectdefs.h +++ b/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-4.8_CXX0X/patch-qt-4.8/QtCore/qobjectdefs.h @@ -13,7 +13,7 @@ ** appearing in the file LICENSE.LGPL included in the packaging of this ** file. Please review the following information to ensure the GNU Lesser ** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception @@ -25,7 +25,7 @@ ** and appearing in the file LICENSE.GPL included in the packaging of this ** file. Please review the following information to ensure the GNU General ** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** Other Usage ** Alternatively, this file may be used in accordance with the terms and diff --git a/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-4.8_CXX0X/patch-qt-4.8/QtCore/qplugin.h b/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-4.8_CXX0X/patch-qt-4.8/QtCore/qplugin.h index 559822a843e..d7e47535627 100644 --- a/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-4.8_CXX0X/patch-qt-4.8/QtCore/qplugin.h +++ b/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-4.8_CXX0X/patch-qt-4.8/QtCore/qplugin.h @@ -13,7 +13,7 @@ ** appearing in the file LICENSE.LGPL included in the packaging of this ** file. Please review the following information to ensure the GNU Lesser ** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception @@ -25,7 +25,7 @@ ** and appearing in the file LICENSE.GPL included in the packaging of this ** file. Please review the following information to ensure the GNU General ** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** Other Usage ** Alternatively, this file may be used in accordance with the terms and diff --git a/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-trunk_CXX0X/patch-qt-4.8/QtCore/qobjectdefs.h b/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-trunk_CXX0X/patch-qt-4.8/QtCore/qobjectdefs.h index 8cfc61a0e88..1b633566c73 100644 --- a/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-trunk_CXX0X/patch-qt-4.8/QtCore/qobjectdefs.h +++ b/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-trunk_CXX0X/patch-qt-4.8/QtCore/qobjectdefs.h @@ -13,7 +13,7 @@ ** appearing in the file LICENSE.LGPL included in the packaging of this ** file. Please review the following information to ensure the GNU Lesser ** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception @@ -25,7 +25,7 @@ ** and appearing in the file LICENSE.GPL included in the packaging of this ** file. Please review the following information to ensure the GNU General ** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** Other Usage ** Alternatively, this file may be used in accordance with the terms and diff --git a/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-trunk_CXX0X/patch-qt-4.8/QtCore/qplugin.h b/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-trunk_CXX0X/patch-qt-4.8/QtCore/qplugin.h index 559822a843e..d7e47535627 100644 --- a/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-trunk_CXX0X/patch-qt-4.8/QtCore/qplugin.h +++ b/Maintenance/infrastructure/renoir.geometryfactory.com/reference-platforms/x86-64_Linux-Fedora19_g++-trunk_CXX0X/patch-qt-4.8/QtCore/qplugin.h @@ -13,7 +13,7 @@ ** appearing in the file LICENSE.LGPL included in the packaging of this ** file. Please review the following information to ensure the GNU Lesser ** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception @@ -25,7 +25,7 @@ ** and appearing in the file LICENSE.GPL included in the packaging of this ** file. Please review the following information to ensure the GNU General ** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** Other Usage ** Alternatively, this file may be used in accordance with the terms and diff --git a/Maintenance/public_release/announcement/mailing-beta.eml b/Maintenance/public_release/announcement/mailing-beta.eml index e6de484eb6d..11b4295f32f 100644 --- a/Maintenance/public_release/announcement/mailing-beta.eml +++ b/Maintenance/public_release/announcement/mailing-beta.eml @@ -160,7 +160,7 @@ Most modules are distributed under the terms of the GPL Open Source license (GNU General Public License v3 or later versions). If your intended usage does not meet the criteria of the aforementioned licenses, a commercial license can be purchased from -GeometryFactory (http://www.geometryfactory.com/). +GeometryFactory (https://www.geometryfactory.com/). For further information and for downloading the library and its diff --git a/Maintenance/public_release/announcement/mailing.eml b/Maintenance/public_release/announcement/mailing.eml index 67f9e890a9e..23ea320c941 100644 --- a/Maintenance/public_release/announcement/mailing.eml +++ b/Maintenance/public_release/announcement/mailing.eml @@ -159,7 +159,7 @@ Most modules are distributed under the terms of the GPL Open Source license (GNU General Public License v3 or later versions). If your intended usage does not meet the criteria of the aforementioned licenses, a commercial license can be purchased from -GeometryFactory (http://www.geometryfactory.com/). +GeometryFactory (https://www.geometryfactory.com/). For further information and for downloading the library and its diff --git a/Maintenance/test_handling/create_testresult_page b/Maintenance/test_handling/create_testresult_page index ac7d8d5c28a..386e5b8843c 100755 --- a/Maintenance/test_handling/create_testresult_page +++ b/Maintenance/test_handling/create_testresult_page @@ -40,7 +40,7 @@ my @testresults; my $testresult_dir=cwd()."/TESTRESULTS"; # Inspired from -# http://cpansearch.perl.org/src/EDAVIS/Sort-Versions-1.5/Versions.pm +# https://metacpan.org/pod/Sort::Versions sub sort_releases($$) { # Take arguments in revert order: one wants to sort from the recent to @@ -596,7 +596,7 @@ sub print_little_header(){ my $release_version = substr($release_name, 5); print OUTPUT<<"EOF"; + "https://www.w3.org/TR/html4/strict.dtd"> @@ -675,7 +675,7 @@ sub main() See the log here.

- ">">Valid HTML 4.01 Strict

diff --git a/Maintenance/test_handling/filter_testsuite/create_testresult_page b/Maintenance/test_handling/filter_testsuite/create_testresult_page index 399e57d5ddd..76ca849b01f 100755 --- a/Maintenance/test_handling/filter_testsuite/create_testresult_page +++ b/Maintenance/test_handling/filter_testsuite/create_testresult_page @@ -35,7 +35,7 @@ my @testresults; my $testresult_dir=cwd()."/TESTRESULTS"; # Inspired from -# http://cpansearch.perl.org/src/EDAVIS/Sort-Versions-1.5/Versions.pm +# https://metacpan.org/pod/Sort::Versions sub sort_releases($$) { # Take arguments in revert order: one wants to sort from the recent to @@ -591,7 +591,7 @@ sub print_little_header(){ my $release_version = substr($release_name, 5); print OUTPUT<<"EOF"; + "https://www.w3.org/TR/html4/strict.dtd"> @@ -665,7 +665,7 @@ sub main() See the log here.

- ">">Valid HTML 4.01 Strict

diff --git a/Mesh_3/benchmark/Mesh_3/concurrency.cpp b/Mesh_3/benchmark/Mesh_3/concurrency.cpp index ea383a78832..006c917b990 100644 --- a/Mesh_3/benchmark/Mesh_3/concurrency.cpp +++ b/Mesh_3/benchmark/Mesh_3/concurrency.cpp @@ -7,7 +7,7 @@ #endif // Without TBB_USE_THREADING_TOOL Intel Inspector XE will report false positives in Intel TBB -// (http://software.intel.com/en-us/articles/compiler-settings-for-threading-error-analysis-in-intel-inspector-xe/) +// (https://www.intel.com/content/www/us/en/developer/articles/technical/compiler-settings-for-threading-error-analysis-in-intel-inspector-xe.html) #ifdef _DEBUG # define TBB_USE_THREADING_TOOL #endif diff --git a/Number_types/doc/Number_types/CGAL/Sqrt_extension.h b/Number_types/doc/Number_types/CGAL/Sqrt_extension.h index e5869154551..a52f55780dc 100644 --- a/Number_types/doc/Number_types/CGAL/Sqrt_extension.h +++ b/Number_types/doc/Number_types/CGAL/Sqrt_extension.h @@ -13,7 +13,7 @@ An instance of this class represents an extension of the type `NT` by *one* squa For example, let `Integer` be some type representing \f$ \mathbb{Z}\f$, then `Sqrt_extension` is able to represent \f$ \mathbb{Z}[\sqrt{\mathrm{root}}]\f$ -for some arbitrary Integer \f$\mathrm{root}\f$. \cgalFootnote{\f$ R[a]\f$ denotes the extension of a ring \f$ R\f$ by an element \f$ a\f$. See also: \cgalFootnoteCode{http://mathworld.wolfram.com/ExtensionRing.html}} +for some arbitrary Integer \f$\mathrm{root}\f$. \cgalFootnote{\f$ R[a]\f$ denotes the extension of a ring \f$ R\f$ by an element \f$ a\f$. See also: \cgalFootnoteCode{https://mathworld.wolfram.com/ExtensionRing.html}} The value of \f$\mathrm{root}\f$ is set at construction time, or set to zero if it is not specified. diff --git a/Number_types/include/CGAL/FPU.h b/Number_types/include/CGAL/FPU.h index 429941be991..04746f99211 100644 --- a/Number_types/include/CGAL/FPU.h +++ b/Number_types/include/CGAL/FPU.h @@ -143,8 +143,8 @@ inline double IA_opacify(double x) { #ifdef __llvm__ // LLVM's support for inline asm is completely messed up: - // http://llvm.org/bugs/show_bug.cgi?id=17958 - // http://llvm.org/bugs/show_bug.cgi?id=17959 + // https://bugs.llvm.org/show_bug.cgi?id=17958 + // https://bugs.llvm.org/show_bug.cgi?id=17959 // etc. // This seems to produce code that is ok (not optimal but better than // volatile). In case of trouble, use volatile instead. @@ -166,7 +166,7 @@ inline double IA_opacify(double x) // Intel used not to emulate this perfectly, we'll see. // If we create a version of IA_opacify for vectors, note that gcc < 4.8 // fails with "+g" and we need to use "+mx" instead. - // "+X" ICEs ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59155 ) and + // "+X" ICEs ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59155 ) and // may not be safe? // The constraint 'g' doesn't include floating point registers ??? // Intel has a bug where -mno-sse still defines __SSE__ and __SSE2__ @@ -180,10 +180,10 @@ inline double IA_opacify(double x) # endif # elif (defined __i386__ || defined __x86_64__) // "+f" doesn't compile on x86(_64) - // ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59157 ) - // Don't mix "t" with "g": http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59180 + // ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59157 ) + // Don't mix "t" with "g": https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59180 // We can't put "t" with "x" either, prefer "x" for -mfpmath=sse,387. - // ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59181 ) + // ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59181 ) asm volatile ("" : "+mt"(x) ); # elif (defined __VFP_FP__ && !defined __SOFTFP__) || defined __aarch64__ // ARM @@ -217,7 +217,7 @@ inline double IA_force_to_double(double x) #if defined __GNUG__ # ifdef CGAL_HAS_SSE2 // For an explanation of volatile: - // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56027 + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56027 asm volatile ("" : "+mx"(x) ); # else // Similar to writing to a volatile and reading back, except that calling diff --git a/Number_types/include/CGAL/GMP/Gmpz_type.h b/Number_types/include/CGAL/GMP/Gmpz_type.h index b6ace5743a0..bf91ddb5d91 100644 --- a/Number_types/include/CGAL/GMP/Gmpz_type.h +++ b/Number_types/include/CGAL/GMP/Gmpz_type.h @@ -324,9 +324,9 @@ gmpz_new_read(std::istream &is, Gmpz &z) // peek() sets also the failbit, one has to check for EOL twice. // // See the LWG C++ Issue 2036, classified as Not-A-Defect: - // http://lwg.github.com/issues/lwg-closed.html#2036 + // https://lwg.github.io/issues/lwg-closed.html#2036 // and a StackOverflow related question: - // http://stackoverflow.com/a/9020292/1728537 + // https://stackoverflow.com/a/9020292/1728537 // -- // Laurent Rineau, 2013/10/10 while (!is.eof()) { diff --git a/OpenNL/include/CGAL/OpenNL/bicgstab.h b/OpenNL/include/CGAL/OpenNL/bicgstab.h index dd8ea48a3ca..a9cef2c92e8 100644 --- a/OpenNL/include/CGAL/OpenNL/bicgstab.h +++ b/OpenNL/include/CGAL/OpenNL/bicgstab.h @@ -1,7 +1,7 @@ // Copyright (c) 2005-2008 Inria Loria (France). /* * author: Bruno Levy, INRIA, project ALICE - * website: http://www.loria.fr/~levy/software + * website: https://www.loria.fr/~levy/software * * This file is part of CGAL (www.cgal.org) * @@ -13,7 +13,7 @@ * TITLE = Numerical Methods for Digital Geometry Processing, * BOOKTITLE =Israel Korea Bi-National Conference, * YEAR=November 2005, - * URL=http://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics + * URL=https://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics * } * * Laurent Saboret 2005-2008: Changes for CGAL: diff --git a/OpenNL/include/CGAL/OpenNL/blas.h b/OpenNL/include/CGAL/OpenNL/blas.h index 52c4810e2c8..8cea9da67ad 100644 --- a/OpenNL/include/CGAL/OpenNL/blas.h +++ b/OpenNL/include/CGAL/OpenNL/blas.h @@ -1,7 +1,7 @@ // Copyright (c) 2005-2008 Inria Loria (France). /* * author: Bruno Levy, INRIA, project ALICE - * website: http://www.loria.fr/~levy/software + * website: https://www.loria.fr/~levy/software * * This file is part of CGAL (www.cgal.org) * @@ -13,7 +13,7 @@ * TITLE = Numerical Methods for Digital Geometry Processing, * BOOKTITLE =Israel Korea Bi-National Conference, * YEAR=November 2005, - * URL=http://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics + * URL=https://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics * } * * Laurent Saboret 01/2005: Change for CGAL: diff --git a/OpenNL/include/CGAL/OpenNL/conjugate_gradient.h b/OpenNL/include/CGAL/OpenNL/conjugate_gradient.h index c575aa6f0c8..6f2e6f5b2e8 100644 --- a/OpenNL/include/CGAL/OpenNL/conjugate_gradient.h +++ b/OpenNL/include/CGAL/OpenNL/conjugate_gradient.h @@ -1,7 +1,7 @@ // Copyright (c) 2005-2008 Inria Loria (France). /* * author: Bruno Levy, INRIA, project ALICE - * website: http://www.loria.fr/~levy/software + * website: https://www.loria.fr/~levy/software * * This file is part of CGAL (www.cgal.org) * @@ -13,7 +13,7 @@ * TITLE = Numerical Methods for Digital Geometry Processing, * BOOKTITLE =Israel Korea Bi-National Conference, * YEAR=November 2005, - * URL=http://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics + * URL=https://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics * } * * Laurent Saboret 2005-2006: Changes for CGAL: diff --git a/OpenNL/include/CGAL/OpenNL/full_vector.h b/OpenNL/include/CGAL/OpenNL/full_vector.h index b0857dfa851..0459808b638 100644 --- a/OpenNL/include/CGAL/OpenNL/full_vector.h +++ b/OpenNL/include/CGAL/OpenNL/full_vector.h @@ -1,7 +1,7 @@ // Copyright (c) 2005-2008 Inria Loria (France). /* * author: Bruno Levy, INRIA, project ALICE - * website: http://www.loria.fr/~levy/software + * website: https://www.loria.fr/~levy/software * * This file is part of CGAL (www.cgal.org) * @@ -13,7 +13,7 @@ * TITLE = Numerical Methods for Digital Geometry Processing, * BOOKTITLE =Israel Korea Bi-National Conference, * YEAR=November 2005, - * URL=http://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics + * URL=https://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics * } * * Laurent Saboret 01/2005: Change for CGAL: diff --git a/OpenNL/include/CGAL/OpenNL/linear_solver.h b/OpenNL/include/CGAL/OpenNL/linear_solver.h index 33dccdcc6cb..d4e928eec9a 100644 --- a/OpenNL/include/CGAL/OpenNL/linear_solver.h +++ b/OpenNL/include/CGAL/OpenNL/linear_solver.h @@ -1,7 +1,7 @@ // Copyright (c) 2005-2008 Inria Loria (France). /* * author: Bruno Levy, INRIA, project ALICE - * website: http://www.loria.fr/~levy/software + * website: https://www.loria.fr/~levy/software * * This file is part of CGAL (www.cgal.org) * @@ -13,7 +13,7 @@ * TITLE = Numerical Methods for Digital Geometry Processing, * BOOKTITLE =Israel Korea Bi-National Conference, * YEAR=November 2005, - * URL=http://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics + * URL=https://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics * } * * Laurent Saboret 2005-2006: Changes for CGAL: diff --git a/OpenNL/include/CGAL/OpenNL/preconditioner.h b/OpenNL/include/CGAL/OpenNL/preconditioner.h index 2d7728a94ca..808b6f39eb1 100644 --- a/OpenNL/include/CGAL/OpenNL/preconditioner.h +++ b/OpenNL/include/CGAL/OpenNL/preconditioner.h @@ -1,7 +1,7 @@ // Copyright (c) 2005-2008 Inria Loria (France). /* * author: Bruno Levy, INRIA, project ALICE - * website: http://www.loria.fr/~levy/software + * website: https://www.loria.fr/~levy/software * * This file is part of CGAL (www.cgal.org) * @@ -13,7 +13,7 @@ * TITLE = Numerical Methods for Digital Geometry Processing, * BOOKTITLE =Israel Korea Bi-National Conference, * YEAR=November 2005, - * URL=http://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics + * URL=https://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics * } * * Laurent Saboret 2006: Changes for CGAL: diff --git a/OpenNL/include/CGAL/OpenNL/sparse_matrix.h b/OpenNL/include/CGAL/OpenNL/sparse_matrix.h index 2d5b3812e30..4e4c01f46d4 100644 --- a/OpenNL/include/CGAL/OpenNL/sparse_matrix.h +++ b/OpenNL/include/CGAL/OpenNL/sparse_matrix.h @@ -1,7 +1,7 @@ // Copyright (c) 2005-2008 Inria Loria (France). /* * author: Bruno Levy, INRIA, project ALICE - * website: http://www.loria.fr/~levy/software + * website: https://www.loria.fr/~levy/software * * This file is part of CGAL (www.cgal.org) * @@ -13,7 +13,7 @@ * TITLE = Numerical Methods for Digital Geometry Processing, * BOOKTITLE =Israel Korea Bi-National Conference, * YEAR=November 2005, - * URL=http://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics + * URL=https://www.loria.fr/~levy/php/article.php?pub=../publications/papers/2005/Numerics * } * * Laurent Saboret 01/2005: Change for CGAL: diff --git a/OpenNL/package_info/OpenNL/long_description.txt b/OpenNL/package_info/OpenNL/long_description.txt index 8c0cd24b1f9..645de7254ee 100644 --- a/OpenNL/package_info/OpenNL/long_description.txt +++ b/OpenNL/package_info/OpenNL/long_description.txt @@ -15,7 +15,7 @@ Contact ======= The author is Bruno Levy . -OpenNL main page is http://www.loria.fr/~levy/software/. +OpenNL main page is https://www.loria.fr/~levy/software/. Caution ======= diff --git a/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/test_p2t2_delaunay_performance.cpp b/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/test_p2t2_delaunay_performance.cpp index ddef1fcc6de..3268d9dd881 100644 --- a/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/test_p2t2_delaunay_performance.cpp +++ b/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/test_p2t2_delaunay_performance.cpp @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) // For generating the plot: /* - + diff --git a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/Scene.cpp b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/Scene.cpp index 64ed148670d..513e34d5ebc 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/Scene.cpp +++ b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/Scene.cpp @@ -12,7 +12,7 @@ * * The above copyright notice including the dates of first publication and * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ + * https://spdx.org/licenses/SGI-B-2.0.html * shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS diff --git a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/resources/about.html b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/resources/about.html index bf9e3becae7..9816a12a0c3 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/resources/about.html +++ b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/resources/about.html @@ -2,8 +2,8 @@

CGAL Periodic Delaunay Triangulation

Copyright ©2008-2009
- INRIA Sophia Antipolis - Mediterranee

-

This application illustrates the 3D Periodic Delaunay Triangulation + INRIA Sophia Antipolis - Mediterranee

+

This application illustrates the 3D Periodic Delaunay Triangulation of CGAL.

See also the package manual:
diff --git a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/icons/about_CGAL.html b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/icons/about_CGAL.html index 6b2b2a5d943..f2f0fb9318b 100644 --- a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/icons/about_CGAL.html +++ b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/icons/about_CGAL.html @@ -3,6 +3,6 @@

Computational Geometry Algorithms Library

CGAL provides efficient and reliable geometric algorithms in the form of a C++ library.

-

For more information visit www.cgal.org

+

For more information visit www.cgal.org

diff --git a/Polyhedron/demo/Polyhedron/Mainpage.md b/Polyhedron/demo/Polyhedron/Mainpage.md index 0e8322a8f70..444a5ee8b98 100644 --- a/Polyhedron/demo/Polyhedron/Mainpage.md +++ b/Polyhedron/demo/Polyhedron/Mainpage.md @@ -197,7 +197,7 @@ class Polyhedron_demo_example_plugin : public : // To silent a warning -Woverloaded-virtual - // See http://stackoverflow.com/questions/9995421/gcc-woverloaded-virtual-warnings + // See https://stackoverflow.com/questions/9995421/gcc-woverloaded-virtual-warnings using Polyhedron_demo_plugin_helper::init; void init(QMainWindow* mainWindow, diff --git a/Polyhedron/demo/Polyhedron/Plugins/Display/Display_property_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Display/Display_property_plugin.cpp index 0d8687bd635..af1eef9e115 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Display/Display_property_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Display/Display_property_plugin.cpp @@ -1694,7 +1694,7 @@ private: /*========================================================================= Copyright (c) 2006 Sandia Corporation. All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + See Copyright.txt or https://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp index 4063d2107ed..db0d99bdb57 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp @@ -27,7 +27,7 @@ class Polyhedron_demo_polylines_io_plugin : public: // To silent a warning -Woverloaded-virtual - // See http://stackoverflow.com/questions/9995421/gcc-woverloaded-virtual-warnings + // See https://stackoverflow.com/questions/9995421/gcc-woverloaded-virtual-warnings using Polyhedron_demo_io_plugin_interface::init; //! Configures the widget diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/PartitionDialog.ui b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/PartitionDialog.ui index 91f3b989f8a..9b8b669d72b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/PartitionDialog.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/PartitionDialog.ui @@ -62,7 +62,7 @@ - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "https://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_widget.ui b/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_widget.ui index 5592bbbde5a..f2839e20f06 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_widget.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_widget.ui @@ -1046,7 +1046,7 @@ QGroupBox::title { - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "https://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> @@ -1094,7 +1094,7 @@ p, li { white-space: pre-wrap; } - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "https://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp index f32c322c16d..f3be698c5ad 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp @@ -192,7 +192,7 @@ public Q_SLOTS: boost::optional bbox = boost::make_optional(false, CGAL::Three::Scene_interface::Bbox()); // Workaround a bug in g++-4.8.3: - // http://stackoverflow.com/a/21755207/1728537 + // https://stackoverflow.com/a/21755207/1728537 // Using boost::make_optional to copy-initialize 'bbox' hides the // warning about '*bbox' not being initialized. // -- Laurent Rineau, 2014/10/30 diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.ui b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.ui index 9cc5d979842..e527115cd2b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.ui @@ -187,7 +187,7 @@ - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "https://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Noto Sans'; font-size:9pt; font-weight:400; font-style:normal;"> diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp index 4a1ec1d8a6d..7b6e5225dfe 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp @@ -104,7 +104,7 @@ Polyhedron_demo::Polyhedron_demo(int& argc, char **argv, // On Apple, the first time the application is launched, the menus are unclicable, and // the only way you can fix it is to unfocus and re-focus the application. // This is a hack that makes the application lose the focus after it is started, to force the user - // to re-focus it. (source : http://www.alecjacobson.com/weblog/?p=3910) + // to re-focus it. (source: https://www.alecjacobson.com/weblog/?p=3910) #ifdef __APPLE__ system("osascript -e 'tell application \"System Events\" " "to keystroke tab using {command down, shift down}'"); diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h index 5b803274716..8164cdacf8f 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h @@ -288,7 +288,7 @@ public: void compute_bbox() const { // Workaround a bug in g++-4.8.3: - // http://stackoverflow.com/a/21755207/1728537 + // https://stackoverflow.com/a/21755207/1728537 // Using boost::make_optional to copy-initialize 'item_bbox' hides the // warning about '*item_bbox' not being initialized. // -- Laurent Rineau, 2014/10/30 diff --git a/Polyhedron/demo/Polyhedron/Show_point_dialog.ui b/Polyhedron/demo/Polyhedron/Show_point_dialog.ui index bbe92b716a9..1816683d2fe 100644 --- a/Polyhedron/demo/Polyhedron/Show_point_dialog.ui +++ b/Polyhedron/demo/Polyhedron/Show_point_dialog.ui @@ -43,7 +43,7 @@ - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "https://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'DejaVu LGC Sans'; font-size:11pt; font-weight:400; font-style:normal;"> diff --git a/Polyhedron/demo/Polyhedron/resources/about.html b/Polyhedron/demo/Polyhedron/resources/about.html index 3089144f7a1..b881e30bab7 100644 --- a/Polyhedron/demo/Polyhedron/resources/about.html +++ b/Polyhedron/demo/Polyhedron/resources/about.html @@ -1,9 +1,9 @@

3D Polyhedral Surfaces

-

Copyright ©2008-2009 - GeometryFactory - and INRIA Sophia Antipolis - Mediterranee

+

Copyright ©2008-2009 + GeometryFactory + and INRIA Sophia Antipolis - Mediterranee

This application illustrates the data structures of CGAL, and operations and algorithms that can be applied to.

diff --git a/Principal_component_analysis/demo/Principal_component_analysis/resources/about.html b/Principal_component_analysis/demo/Principal_component_analysis/resources/about.html index 8d2c41d1ea0..d6b327c3558 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/resources/about.html +++ b/Principal_component_analysis/demo/Principal_component_analysis/resources/about.html @@ -2,8 +2,8 @@

AABB Tree Demo

Copyright ©2009 - INRIA Sophia Antipolis - Mediterranee

-

This application illustrates the AABB tree component + INRIA Sophia Antipolis - Mediterranee

+

This application illustrates the AABB tree component of CGAL, applied to polyhedron facets and edges.

See also the following chapters of the manual: diff --git a/Profiling_tools/include/CGAL/Memory_sizer.h b/Profiling_tools/include/CGAL/Memory_sizer.h index 4bf90350f2e..6d0551ef7f9 100644 --- a/Profiling_tools/include/CGAL/Memory_sizer.h +++ b/Profiling_tools/include/CGAL/Memory_sizer.h @@ -125,7 +125,7 @@ private: #else // __APPLE__ is defined - // http://miknight.blogspot.com/2005/11/resident-set-size-in-mac-os-x.html + // https://miknight.blogspot.com/2005/11/resident-set-size-in-mac-os-x.html // This is highly experimental. But still better than returning 0. // It appears that we might need certain 'rights' to get access to the kernel // task... It works if you have admin rights apparently diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/additional/QBORE3D.mps b/QP_solver/test/QP_solver/test_solver_data/masters/additional/QBORE3D.mps index be23f7d172f..966b92282a6 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/additional/QBORE3D.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/additional/QBORE3D.mps @@ -1,6 +1,6 @@ * Number-type: floating-point -* Description: QBORE3D http://www.doc.ic.ac.uk/~im/ -* Generated-by: http://www.doc.ic.ac.uk/%7Eim/QPDATA2.ZIP +* Description: QBORE3D https://www.doc.ic.ac.uk/~im/ +* Generated-by: https://www.doc.ic.ac.uk/%7Eim/QPDATA2.ZIP * Derivatives: none NAME BORE3D ROWS diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/additional/QCAPRI.mps b/QP_solver/test/QP_solver/test_solver_data/masters/additional/QCAPRI.mps index bdf64319be2..cecd01701f7 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/additional/QCAPRI.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/additional/QCAPRI.mps @@ -1,6 +1,6 @@ * Number-type: floating-point -* Description: QCAPRI http://www.doc.ic.ac.uk/~im/ -* Generated-by: http://www.doc.ic.ac.uk/%7Eim/QPDATA2.ZIP +* Description: QCAPRI https://www.doc.ic.ac.uk/~im/ +* Generated-by: https://www.doc.ic.ac.uk/%7Eim/QPDATA2.ZIP * Derivatives: none NAME CAPRI ROWS diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/additional/QRECIPE.mps b/QP_solver/test/QP_solver/test_solver_data/masters/additional/QRECIPE.mps index b38a5944b85..81306a3cfc8 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/additional/QRECIPE.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/additional/QRECIPE.mps @@ -1,6 +1,6 @@ * Number-type: floating-point -* Description: QRECIPE http://www.doc.ic.ac.uk/~im/ -* Generated-by: http://www.doc.ic.ac.uk/%7Eim/QPDATA2.ZIP +* Description: QRECIPE https://www.doc.ic.ac.uk/~im/ +* Generated-by: https://www.doc.ic.ac.uk/%7Eim/QPDATA2.ZIP * Derivatives: none NAME RECIPE ROWS diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/additional/fit1d.mps b/QP_solver/test/QP_solver/test_solver_data/masters/additional/fit1d.mps index 65e0935866b..dee88708b9a 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/additional/fit1d.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/additional/fit1d.mps @@ -1,6 +1,6 @@ * Number-type: floating-point -* Description: http://www.netlib.org/lp/data/ -* Generated-by: +* Description: https://www.netlib.org/lp/data/ +* Generated-by: * Derivatives: none NAME FIT1D ROWS diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/additional/fit2d.mps b/QP_solver/test/QP_solver/test_solver_data/masters/additional/fit2d.mps index aeacd42c629..c63185ec865 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/additional/fit2d.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/additional/fit2d.mps @@ -1,6 +1,6 @@ * Number-type: floating-point -* Description: http://www.netlib.org/lp/data/ -* Generated-by: +* Description: https://www.netlib.org/lp/data/ +* Generated-by: * Derivatives: none NAME FIT2D ROWS diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/additional/scsd1.mps b/QP_solver/test/QP_solver/test_solver_data/masters/additional/scsd1.mps index 5766d6427fe..83cc8430687 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/additional/scsd1.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/additional/scsd1.mps @@ -1,6 +1,6 @@ * Number-type: floating-point -* Description: http://www.netlib.org/lp/data/ -* Generated-by: +* Description: https://www.netlib.org/lp/data/ +* Generated-by: * Derivatives: none NAME SCSD1 ROWS diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/cgal/HS118.mps b/QP_solver/test/QP_solver/test_solver_data/masters/cgal/HS118.mps index 875d0b3c931..4f6af9720da 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/cgal/HS118.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/cgal/HS118.mps @@ -1,5 +1,5 @@ -* Description: from the benchmarks at http://www.doc.ic.ac.uk/~im/ -NAME HS118 +* Description: from the benchmarks at https://www.doc.ic.ac.uk/~im/ +NAME HS118 ROWS N OBJ.FUNC G R------1 diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/cgal/PRIMALC1.mps b/QP_solver/test/QP_solver/test_solver_data/masters/cgal/PRIMALC1.mps index f0846c3402f..24aca9bb682 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/cgal/PRIMALC1.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/cgal/PRIMALC1.mps @@ -1,6 +1,6 @@ -* Description: from the benchmarks at http://www.doc.ic.ac.uk/~im/ +* Description: from the benchmarks at https://www.doc.ic.ac.uk/~im/ * Derivatives: none -NAME PRIMALC1 +NAME PRIMALC1 ROWS N OBJ.FUNC L R------1 diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/cgal/QPTEST.mps b/QP_solver/test/QP_solver/test_solver_data/masters/cgal/QPTEST.mps index fb89b43794b..3b8f8bc546c 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/cgal/QPTEST.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/cgal/QPTEST.mps @@ -1,4 +1,4 @@ -* Description: from the benchmarks at http://www.doc.ic.ac.uk/~im/ +* Description: from the benchmarks at https://www.doc.ic.ac.uk/~im/ NAME QP example ROWS N obj diff --git a/QP_solver/test/QP_solver/test_solver_data/masters/cgal/ZECEVIC2.mps b/QP_solver/test/QP_solver/test_solver_data/masters/cgal/ZECEVIC2.mps index 2d2e36a96e6..a42199f6137 100644 --- a/QP_solver/test/QP_solver/test_solver_data/masters/cgal/ZECEVIC2.mps +++ b/QP_solver/test/QP_solver/test_solver_data/masters/cgal/ZECEVIC2.mps @@ -1,5 +1,5 @@ -* Description: from the benchmarks at http://www.doc.ic.ac.uk/~im/ -NAME ZECEVIC2 +* Description: from the benchmarks at https://www.doc.ic.ac.uk/~im/ +NAME ZECEVIC2 ROWS N OBJ.FUNC L R------1 diff --git a/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h b/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h index 3ab95555707..4bbe0d3caf0 100644 --- a/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h +++ b/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h @@ -1461,7 +1461,7 @@ public: private: // Sequential: non-atomic // "dummy" is here to allow the specialization (see below) - // See http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/285ab1eec49e1cb6 + // See https://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/285ab1eec49e1cb6 template struct Number_of_elements { diff --git a/STL_Extension/include/CGAL/Handle_for.h b/STL_Extension/include/CGAL/Handle_for.h index 2a93662e69b..2f05c6be1ce 100644 --- a/STL_Extension/include/CGAL/Handle_for.h +++ b/STL_Extension/include/CGAL/Handle_for.h @@ -30,7 +30,7 @@ #if defined(BOOST_MSVC) # pragma warning(push) -# pragma warning(disable:4345) // Avoid warning http://msdn.microsoft.com/en-us/library/wewb47ee(VS.80).aspx +# pragma warning(disable:4345) // Avoid warning https://learn.microsoft.com/en-us/previous-versions/wewb47ee(v=vs.120) #endif namespace CGAL { diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/boost/relaxed_heap.hpp b/STL_Extension/include/CGAL/STL_Extension/internal/boost/relaxed_heap.hpp index c91dea7d62f..a02a831f044 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/boost/relaxed_heap.hpp +++ b/STL_Extension/include/CGAL/STL_Extension/internal/boost/relaxed_heap.hpp @@ -3,7 +3,7 @@ // Copyright 2004 The Trustees of Indiana University. // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) +// https://www.boost.org/LICENSE_1_0.txt) // // Authors: Douglas Gregor // Andrew Lumsdaine diff --git a/STL_Extension/include/CGAL/array.h b/STL_Extension/include/CGAL/array.h index cfaca0a0550..ff234183f99 100644 --- a/STL_Extension/include/CGAL/array.h +++ b/STL_Extension/include/CGAL/array.h @@ -30,7 +30,7 @@ namespace CGAL { // https://lists.boost.org/Archives/boost/2006/08/109003.php // // C++0x has it under discussion here : -// http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#851 +// https://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#851 // Hopefully C++0x will fix this properly with initializer_lists. // So, it's temporary, therefore I do not document it and keep it internal. diff --git a/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h b/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h index e0321f57395..2138c377e42 100644 --- a/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h +++ b/Solver_interface/include/CGAL/Eigen_diagonalize_traits.h @@ -53,7 +53,7 @@ struct Restricted_FT { typedef float type; }; /// /// \cgalModels `DiagonalizeTraits` /// -/// \sa http://eigen.tuxfamily.org/index.php?title=Main_Page +/// \sa https://eigen.tuxfamily.org/index.php?title=Main_Page template class Eigen_diagonalize_traits { diff --git a/Solver_interface/include/CGAL/Eigen_matrix.h b/Solver_interface/include/CGAL/Eigen_matrix.h index 4a34a022d0d..4f28c3f7c6f 100644 --- a/Solver_interface/include/CGAL/Eigen_matrix.h +++ b/Solver_interface/include/CGAL/Eigen_matrix.h @@ -23,7 +23,7 @@ namespace CGAL { \ingroup PkgSolverInterfaceLS The class `Eigen_matrix` is a wrapper around `Eigen` matrix type -`Eigen::Matrix`. +`Eigen::Matrix`. \cgalModels `SvdTraits::Matrix` diff --git a/Solver_interface/include/CGAL/Eigen_solver_traits.h b/Solver_interface/include/CGAL/Eigen_solver_traits.h index 9fe3457e84d..93820b7b827 100644 --- a/Solver_interface/include/CGAL/Eigen_solver_traits.h +++ b/Solver_interface/include/CGAL/Eigen_solver_traits.h @@ -75,7 +75,7 @@ The class `Eigen_solver_traits` provides an interface to the sparse solvers of \ \sa `CGAL::Eigen_sparse_matrix` \sa `CGAL::Eigen_sparse_symmetric_matrix` \sa `CGAL::Eigen_vector` -\sa http://eigen.tuxfamily.org/index.php?title=Main_Page +\sa https://eigen.tuxfamily.org/index.php?title=Main_Page \cgalHeading{Instantiation Example} diff --git a/Solver_interface/include/CGAL/Eigen_sparse_matrix.h b/Solver_interface/include/CGAL/Eigen_sparse_matrix.h index ff83d2a65fd..20e8962bb15 100644 --- a/Solver_interface/include/CGAL/Eigen_sparse_matrix.h +++ b/Solver_interface/include/CGAL/Eigen_sparse_matrix.h @@ -21,7 +21,7 @@ namespace CGAL { \ingroup PkgSolverInterfaceLS The class `Eigen_sparse_matrix` is a wrapper around `Eigen` matrix type -`Eigen::SparseMatrix` +`Eigen::SparseMatrix` that represents general matrices, be they symmetric or not. \cgalModels `SparseLinearAlgebraTraits_d::Matrix` @@ -301,7 +301,7 @@ private: \ingroup PkgSolverInterfaceRefLS The class `Eigen_sparse_symmetric_matrix` is a wrapper around `Eigen` matrix type -`Eigen::SparseMatrix` +`Eigen::SparseMatrix` Since the matrix is symmetric, only the lower triangle part is stored. diff --git a/Solver_interface/include/CGAL/Eigen_vector.h b/Solver_interface/include/CGAL/Eigen_vector.h index d080777a2f8..b50ac037eff 100644 --- a/Solver_interface/include/CGAL/Eigen_vector.h +++ b/Solver_interface/include/CGAL/Eigen_vector.h @@ -20,7 +20,7 @@ namespace CGAL { \ingroup PkgSolverInterfaceLS The class `Eigen_vector` is a wrapper around `Eigen` -vector type, +vector type, which is a simple array of numbers. \cgalModels `SvdTraits::Vector` diff --git a/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp b/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp index 766b41c77fc..a999a5235ec 100644 --- a/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp +++ b/Spatial_searching/benchmark/Spatial_searching/include/nanoflann.hpp @@ -393,7 +393,7 @@ namespace nanoflann /** @addtogroup param_grp Parameter structs * @{ */ - /** Parameters (see http://code.google.com/p/nanoflann/ for help choosing the parameters) + /** Parameters (see https://github.com/jlblancoc/nanoflann for help choosing the parameters) */ struct KDTreeSingleIndexAdaptorParams { @@ -580,10 +580,10 @@ namespace nanoflann * This code is an adapted version from Boost, modifed for its integration * within MRPT (JLBC, Dec/2009) (Renamed array -> CArray to avoid possible potential conflicts). * See - * http://www.josuttis.com/cppcode + * https://www.josuttis.com/cppcode/ * for details and the latest version. * See - * http://www.boost.org/libs/array for Documentation. + * https://www.boost.org/libs/array for Documentation. * for documentation. * * (C) Copyright Nicolai M. Josuttis 2001. @@ -851,7 +851,7 @@ namespace nanoflann * * Params: * inputData = dataset with the input features - * params = parameters passed to the kdtree algorithm (see http://code.google.com/p/nanoflann/ for help choosing the parameters) + * params = parameters passed to the kdtree algorithm (see https://github.com/jlblancoc/nanoflann for help choosing the parameters) */ KDTreeSingleIndexAdaptor(const int dimensionality, const DatasetAdaptor& inputData, const KDTreeSingleIndexAdaptorParams& params = KDTreeSingleIndexAdaptorParams() ) : dataset(inputData), index_params(params), root_node(NULL), distance(inputData) diff --git a/Straight_skeleton_2/include/CGAL/IO/Dxf_stream.h b/Straight_skeleton_2/include/CGAL/IO/Dxf_stream.h index ed0dceb3efe..8e1d0387b18 100644 --- a/Straight_skeleton_2/include/CGAL/IO/Dxf_stream.h +++ b/Straight_skeleton_2/include/CGAL/IO/Dxf_stream.h @@ -10,7 +10,7 @@ // Author(s) : Fernando Cacciola // // Descriptions of the file format can be found at -// http://www.autodesk.com/techpubs/autocad/acad2000/dxf/ +// https://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf #ifndef CGAL_DXF_STREAM_H #define CGAL_DXF_STREAM_H diff --git a/Straight_skeleton_2/include/CGAL/IO/Dxf_writer.h b/Straight_skeleton_2/include/CGAL/IO/Dxf_writer.h index 2c6e28c1fc7..11a41b3a204 100644 --- a/Straight_skeleton_2/include/CGAL/IO/Dxf_writer.h +++ b/Straight_skeleton_2/include/CGAL/IO/Dxf_writer.h @@ -10,7 +10,7 @@ // Author(s) : Fernando Cacciola // // Description of the file format can be found at the following address: -// http://www.autodesk.com/techpubs/autocad/acad2000/dxf/ +// https://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf #ifndef CGAL_IO_DXF_WRITER_H #define CGAL_IO_DXF_WRITER_H diff --git a/Stream_support/doc/Stream_support/File_formats/Supported_file_formats.txt b/Stream_support/doc/Stream_support/File_formats/Supported_file_formats.txt index 4834a83616b..5ca36ae8a8c 100644 --- a/Stream_support/doc/Stream_support/File_formats/Supported_file_formats.txt +++ b/Stream_support/doc/Stream_support/File_formats/Supported_file_formats.txt @@ -107,7 +107,7 @@ which offers combinatorial repairing while reading bad inputs. The `OBJ` file format, using the file extension `.obj`, is a simple \ascii data format that represents 3D geometry. Vertices are stored in a counter-clockwise order by default, making explicit declaration of face normals unnecessary. -A precise specification of the format is available here. +A precise specification of the format is available here. @@ -148,7 +148,7 @@ The `STL` file format, using the file extension `.stl`, is an \ascii or binary f to the stereolithography CAD software created by 3D Systems. STL files describe the surface geometry of a three-dimensional object. -A precise specification of those formats is available here. +A precise specification of those formats is available here.
diff --git a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/auxiliary/graph.h b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/auxiliary/graph.h index 5f357c809ab..03c90101c33 100644 --- a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/auxiliary/graph.h +++ b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/auxiliary/graph.h @@ -53,7 +53,7 @@ This program is available under dual licence: 1) Under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Note that any program that incorporates the code under this licence must, under the terms of the GNU GPL, be released under a licence compatible with the GPL. GNU GPL does not permit incorporating this program into proprietary programs. If you wish to do this, please see the alternative licence available below. -GNU General Public License can be found at http://www.gnu.org/licenses/old-licenses/gpl-2.0.html +GNU General Public License can be found at https://www.gnu.org/licenses/old-licenses/gpl-2.0.html 2) Proprietary Licence from UCL Business PLC. To enable programers to include the MaxFlow software in a proprietary system (which is not allowed by the GNU GPL), this licence gives you the right to incorporate the software in your program and distribute under any licence of your choosing. The full terms of the licence and applicable fee, are available from the Licensors at: http://www.uclb-elicensing.com/optimisation_software/maxflow_computervision.html diff --git a/Triangulation_3/demo/Triangulation_3/documentation/about.html b/Triangulation_3/demo/Triangulation_3/documentation/about.html index 1954aa1d7fa..d6077d7b567 100644 --- a/Triangulation_3/demo/Triangulation_3/documentation/about.html +++ b/Triangulation_3/demo/Triangulation_3/documentation/about.html @@ -2,7 +2,7 @@

CGAL Triangulation_3 Demo

Copyright ©2010-2011
- INRIA Sophia Antipolis - Mediterranee

+ INRIA Sophia Antipolis - Mediterranee

This application illustrates an interactive demo for 3D Delaunay Triangulation package of CGAL.

See also the package manual:
diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_3.h index ac6371c6484..482cb41c176 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_3.h @@ -1243,7 +1243,7 @@ protected: // Sequential version // "dummy" is here to allow the specialization (see below) - // See http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/285ab1eec49e1cb6 + // See https://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/285ab1eec49e1cb6 template class Hidden_point_visitor { From 98f324a1471a029f9b31648c62fcb057dee49469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 23 Nov 2022 21:15:38 +0100 Subject: [PATCH 169/194] Translate some French error messages / comments --- .../Advancing_front_surface_reconstruction.h | 168 ++++++++---------- ...ont_surface_reconstruction_vertex_base_3.h | 2 +- 2 files changed, 78 insertions(+), 92 deletions(-) diff --git a/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction.h b/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction.h index 3e4d8ba7df9..c7f5e1325b2 100644 --- a/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction.h +++ b/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction.h @@ -370,19 +370,19 @@ namespace CGAL { coord_type K, min_K; const coord_type eps; const coord_type inv_eps_2; // 1/(eps^2) - const coord_type eps_3; // test de ^3 donc points tel 1e-7 soit petit + const coord_type eps_3; // tests using cubed eps so points such that 1e-7 is small const criteria STANDBY_CANDIDATE; const criteria STANDBY_CANDIDATE_BIS; const criteria NOT_VALID_CANDIDATE; //--------------------------------------------------------------------- - //Pour une visu correcte - //pour retenir les facettes selectionnees + // For a correct visualization + // to retain the selected facets int _vh_number; int _facet_number; //--------------------------------------------------------------------- - //Pour le post traitement + // For post-processing mutable int _postprocessing_counter; int _size_before_postprocessing; @@ -501,9 +501,8 @@ namespace CGAL { } //------------------------------------------------------------------- - // pour gerer certaines aretes interieures: a savoir celle encore connectee au - // bord (en fait seule, les aretes interieures reliant 2 bords nous - // interressent...) + // to handle certain interior edges, meaning those still connected to the boundary + // (actually, only the interior edges linking two boundaries are relevant) inline void set_interior_edge(Vertex_handle w, Vertex_handle v) { @@ -806,7 +805,7 @@ namespace CGAL { if ((number_of_facets() > static_cast(T.number_of_vertices()))&& (NB_BORDER_MAX > 0)) - // en principe 2*nb_sommets = nb_facettes: y a encore de la marge!!! + // in theory 2*vertices_n = facets_n: plenty of room!!! { while(postprocessing()){ extend2_timer.start(); @@ -1068,9 +1067,8 @@ namespace CGAL { //--------------------------------------------------------------------- bool is_interior_edge(const Edge_like& key) const - // pour gerer certaines aretes interieures: a savoir celle encore connectee au - // bord (en fait seule, les aretes interieures reliant 2 bords nous - // interressent...) + // to handle certain interior edges, meaning those still connected to the boundary + // (actually, only the interior edges linking two boundaries are relevant) { return (is_interior_edge(key.first, key.second)|| is_interior_edge(key.second, key.first)); @@ -1299,7 +1297,6 @@ namespace CGAL { #ifdef AFSR_LAZY value = lazy_squared_radius(cc); #else - // qualified with CGAL, to avoid a compilation error with clang if(volume(pp0, pp1, pp2, pp3) != 0){ value = T.geom_traits().compute_squared_radius_3_object()(pp0, pp1, pp2, pp3); } else { @@ -1337,7 +1334,6 @@ namespace CGAL { { value = compute_scalar_product(Vc, Vc) - ac*ac/norm_V; if ((value < 0)||(norm_V > inv_eps_2)){ - // qualified with CGAL, to avoid a compilation error with clang value = T.geom_traits().compute_squared_radius_3_object()(cp1, cp2, cp3); } } @@ -1365,7 +1361,7 @@ namespace CGAL { /// @} //--------------------------------------------------------------------- - // For a border edge e we determine the incident facet which has the highest + // For a border edge e, we determine the incident facet which has the highest // chance to be a natural extension of the surface Radius_edge_type @@ -1425,8 +1421,7 @@ namespace CGAL { P2Pn = construct_vector(p2, pn); v2 = construct_cross_product(P2P1,P2Pn); - //pas necessaire de normer pour un bon echantillon: - // on peut alors tester v1*v2 >= 0 + // no need to normalize for a correct sampling: one can then test v1*v2 >= 0 norm = sqrt(norm1 * compute_scalar_product(v2,v2)); pscal = v1*v2; // check if the triangle will produce a sliver on the surface @@ -1437,7 +1432,8 @@ namespace CGAL { if (tmp < min_valueA) { PnP1 = p1-pn; - // DELTA represente la qualite d'echantillonnage du bord + // DELTA encodes the quality of the border sampling + // // We skip triangles having an internal angle along e // whose cosinus is smaller than -DELTA // that is the angle is larger than arcos(-DELTA) @@ -1462,37 +1458,36 @@ namespace CGAL { if ((min_valueA == infinity()) || border_facet) // bad facets case { - min_facet = Facet(c, i); // !!! sans aucune signification.... - value = NOT_VALID_CANDIDATE; // Attention a ne pas inserer dans PQ + min_facet = Facet(c, i); // !!! without any meaning.... + value = NOT_VALID_CANDIDATE; // Do not insert in the PQ } else { min_facet = min_facetA; - //si on considere seulement la pliure value appartient a [0, 2] - //value = coord_type(1) - min_valueP; - - // si la pliure est bonne on note suivant le alpha sinon on prend en compte la - // pliure seule... pour discriminer entre les bons slivers... - // si on veut discriminer les facettes de bonnes pliures plus finement - // alors -(1+1/min_valueA) app a [-inf, -1] - // -min_valueP app a [-1, 1] + // If we only consider the fold value belongs to [0, 2] + // value = coord_type(1) - min_valueP; + // If the fold is OK, we rate based on the alpha value. Otherwise, take only the fold into account + // to discriminate between good slivers. + // + // If we wish to discriminate the facets with good folds more finely, + // then: + // -(1+1/min_valueA) is within [-inf, -1] + // -min_valueP is within [-1, 1] + // if (min_valueP > COS_BETA) value = -(coord_type(1) + coord_type(1)/min_valueA); else { - //on refuse une trop grande non-uniformite + // reject overly non-uniform values coord_type tmp = priority (*this, c, i); if (min_valueA <= K * tmp) value = - min_valueP; else { - value = STANDBY_CANDIDATE; // tres mauvais candidat mauvaise pliure - // + grand alpha... a traiter plus tard.... - min_K = - (std::min)(min_K, - min_valueA/tmp); + value = STANDBY_CANDIDATE; // extremely bad candidate, bad fold + large alpha; handle later + min_K = (std::min)(min_K, min_valueA/tmp); } } } @@ -1597,7 +1592,7 @@ namespace CGAL { } //--------------------------------------------------------------------- - // test de reciprocite avant de recoller une oreille anti-singularite + // reciprocity test before glueing anti-singularity ear int test_merge(const Edge_like& ordered_key, const Border_elt& result, const Vertex_handle& v, const coord_type& ear_alpha) @@ -1622,12 +1617,12 @@ namespace CGAL { coord_type norm = sqrt(compute_scalar_product(v1, v1) * compute_scalar_product(v2, v2)); if (v1*v2 > COS_BETA*norm) - return 1; // label bonne pliure sinon: + return 1; // mark as good fold if (ear_alpha <= K * priority(*this, neigh, n_ind)) - return 2; // label alpha coherent... + return 2; // mark alpha consistent - return 0; //sinon oreille a rejeter... + return 0; // ear to be rejected } @@ -1753,7 +1748,7 @@ namespace CGAL { Edge_like ordered_key(v1,v2); if (!is_border_elt(ordered_key, result12)) - std::cerr << "+++probleme coherence bord " << std::endl; + std::cerr << "+++issue with border consistency " << std::endl; bool is_border_el1 = is_border_elt(ordered_el1, result1), is_border_el2 = is_border_elt(ordered_el2, result2); @@ -1782,8 +1777,7 @@ namespace CGAL { return FINAL_CASE; } //--------------------------------------------------------------------- - //on peut alors marquer v1 et on pourrait essayer de merger - //sans faire de calcul inutile??? + // we can then mark v1 and could try to merge without any useless computation??? if (is_border_el1) { Edge_incident_facet edge_Ifacet_2(Edge(c, i, edge_Efacet.first.third), @@ -1796,7 +1790,7 @@ namespace CGAL { return EAR_CASE; } //--------------------------------------------------------------------- - //idem pour v2 + //idem for v2 if (is_border_el2) { Edge_incident_facet edge_Ifacet_1(Edge(c, i, edge_Efacet.first.second), @@ -1852,9 +1846,9 @@ namespace CGAL { // border incident to a point... _mark<1 even if th orientation // may be such as one vh has 2 successorson the same border... { - // a ce niveau on peut tester si le recollement se fait en - // maintenant la compatibilite d'orientation des bords (pour - // surface orientable...) ou si elle est brisee... + // at this level, we can test if glueing can be done while keeping + // compatible orientations for the borders (for an orientable surface...) + // or if it is broken Edge_incident_facet edge_Ifacet_1(Edge(c, i, edge_Efacet.first.second), edge_Efacet.second); Edge_incident_facet edge_Ifacet_2(Edge(c, i, edge_Efacet.first.third), @@ -1884,8 +1878,8 @@ namespace CGAL { Border_elt result_ear2; Edge_like ear1_e, ear2_e; - // pour maintenir la reconstruction d'une surface orientable : - // on verifie que les bords se recollent dans des sens opposes + // to preserve the reconstruction of an orientable surface, we check that + // borders glue to one another in opposite directions if (ordered_key.first==v1) { ear1_e = Edge_like(c->vertex(i), ear1_c ->vertex(ear1_i)); @@ -1897,7 +1891,7 @@ namespace CGAL { ear2_e = Edge_like(c->vertex(i), ear2_c ->vertex(ear2_i)); } - //maintient la surface orientable + // preserves orientability of the surface bool is_border_ear1 = is_ordered_border_elt(ear1_e, result_ear1); bool is_border_ear2 = is_ordered_border_elt(ear2_e, result_ear2); bool ear1_valid(false), ear2_valid(false); @@ -1931,8 +1925,7 @@ namespace CGAL { { Validation_case res = validate(ear1, e1.first); if (!((res == EAR_CASE)||(res == FINAL_CASE))) - std::cerr << "+++probleme de recollement : cas " - << res << std::endl; + std::cerr << "+++issue in glueing: case " << res << std::endl; e2 = compute_value(edge_Ifacet_2); if (ordered_key.first == v1) @@ -1948,8 +1941,7 @@ namespace CGAL { { Validation_case res = validate(ear2, e2.first); if (!((res == EAR_CASE)||(res == FINAL_CASE))) - std::cerr << "+++probleme de recollement : cas " - << res << std::endl; + std::cerr << "+++issue in glueing : case " << res << std::endl; e1 = compute_value(edge_Ifacet_1); if (ordered_key.first == v1) @@ -1962,25 +1954,23 @@ namespace CGAL { _ordered_border.insert(Radius_ptr_type(e1.first, p1)); } } - else// les deux oreilles ne se recollent pas sur la meme arete... + else // both ears do not glue on the same edge { - // on resoud la singularite. + // resolve the singularity if (ear1_valid) { Validation_case res = validate(ear1, e1.first); if (!((res == EAR_CASE)||(res == FINAL_CASE))) - std::cerr << "+++probleme de recollement : cas " - << res << std::endl; + std::cerr << "+++issue in glueing: case " << res << std::endl; } if (ear2_valid) { Validation_case res = validate(ear2, e2.first); if (!((res == EAR_CASE)||(res == FINAL_CASE))) - std::cerr << "+++probleme de recollement : cas " - << res << std::endl; + std::cerr << "+++issue in glueing : case " << res << std::endl; } - // on met a jour la PQ s'il y a lieu... mais surtout pas - // avant la resolution de la singularite + + // Update the PQ if needed, but not before resolving the singularity if (!ear1_valid) { _ordered_border.insert(Radius_ptr_type(e1.first, p1)); @@ -2020,7 +2010,7 @@ namespace CGAL { if (new_candidate.first == STANDBY_CANDIDATE) { - // a garder pour un K un peu plus grand... + // put aside for a slightly larger K new_candidate.first = STANDBY_CANDIDATE_BIS; } @@ -2042,8 +2032,8 @@ namespace CGAL { void extend() { - // initilisation de la variable globale K: qualite d'echantillonnage requise - K = K_init; // valeur d'initialisation de K pour commencer prudemment... + // Initialize the global variable K: required sampling quality + K = K_init; // initial value of K to start carefully coord_type K_prev = K; Vertex_handle v1, v2; @@ -2052,7 +2042,7 @@ namespace CGAL { } do { - min_K = infinity(); // pour retenir le prochain K necessaire pour progresser... + min_K = infinity(); // to store the next K required to progress do { @@ -2095,7 +2085,7 @@ namespace CGAL { { new_candidate = compute_value(mem_Ifacet); if ((new_candidate != mem_e_it)) - // &&(new_candidate.first < NOT_VALID_CANDIDATE)) + // &&(new_candidate.first < NOT_VALID_CANDIDATE)) { IO_edge_type* pnew = set_again_border_elt(key_tmp.first, key_tmp.second, @@ -2111,8 +2101,7 @@ namespace CGAL { (_ordered_border.begin()->first < STANDBY_CANDIDATE_BIS)); K_prev = K; K += (std::max)(K_step, min_K - K + eps); - // on augmente progressivement le K mais on a deja rempli sans - // faire des betises auparavant... + // Progressively increase K, but having already filled without issue beforehand } while((!_ordered_border.empty())&&(K <= K)&&(min_K != infinity())&&(K!=K_prev)); @@ -2125,9 +2114,8 @@ namespace CGAL { //--------------------------------------------------------------------- - // En principe, si l'allocateur de cellules etait bien fait on aurait pas besoin - // de mettre a jour les valeurs rajoutees pour les cellules a la main... - + // In theory, if the cell allocator were properly made, one would not need to manually update + // the values added for the cells void re_init_for_free_cells_cache(const Vertex_handle& vh) { @@ -2152,9 +2140,8 @@ namespace CGAL { int index = c->index(vh); Cell_handle neigh = c->neighbor(index); int n_ind = neigh->index(c); - neigh->set_smallest_radius(n_ind, -1); // pour obliger le recalcul - // si c est selectionnee c'est qu'elle est aussi le mem_IFacet renvoye par - // compute_value... donc a swapper aussi + neigh->set_smallest_radius(n_ind, -1); // forces recomputation + // if c is selected, then it is also the mem_IFacet returned by compute_value... so to be swapped too if (c->is_selected_facet(index)) { int fn = c->facet_number(index); @@ -2214,8 +2201,8 @@ namespace CGAL { circ = next(circ); } while(circ.first.first != c); - // si on passe par la, alors y a eu un probleme.... - std::cerr << "+++probleme dans la MAJ avant remove..." << std::endl; + // if we are here, something went wrong + std::cerr << "+++issue in the update before removal..." << std::endl; return Facet(c, start.second); } @@ -2237,7 +2224,7 @@ namespace CGAL { ordered_map_erase(border_elt.second.first.first, border_IO_elt(vh, vh_succ)); remove_border_edge(vh, vh_succ); - // 1- a virer au cas ou car vh va etre detruit + // 1- remove just in case since vh is about to be destroyed remove_interior_edge(vh_succ, vh); bool while_cond(true); do @@ -2266,14 +2253,14 @@ namespace CGAL { { ordered_map_erase(result.first.first, border_IO_elt(vh_int, vh)); remove_border_edge(vh_int, vh); - // 1- a virer au cas ou car vh va etre detruit + // 1- remove just in case since vh is about to be destroyed remove_interior_edge(vh_int, vh); while_cond = false; } - // a titre preventif... on essaye de s'assurer de marquer les aretes - // interieures au sens large... - // 2- a virer a tout pris pour que maintenir le sens de interior edge + // As a preventive measure, we try to ensure marking the interior edges in a broad sense + + // 2- remove to preserve the interior edge remove_interior_edge(vh_int, vh_succ); remove_interior_edge(vh_succ, vh_int); @@ -2304,16 +2291,16 @@ namespace CGAL { bool create_singularity(const Vertex_handle& vh) { - // Pour reperer le cas de triangle isole + // To detect the isolated triangle case if (vh->is_on_border()) { - // vh sommet 0 + // vh vertex 0 Next_border_elt border_elt = *(vh->first_incident()); - Vertex_handle vh_1 = border_elt.first;// sommet 1 + Vertex_handle vh_1 = border_elt.first;// vertex 1 border_elt = *(vh_1->first_incident()); - Vertex_handle vh_2 = border_elt.first;// sommet 2 + Vertex_handle vh_2 = border_elt.first;// vertex 2 border_elt = *(vh_2->first_incident()); - Vertex_handle vh_3 = border_elt.first;// sommet 0 ??? + Vertex_handle vh_3 = border_elt.first;// vertex 0 ??? Cell_handle c; int i, j, k; if ((vh_3 == vh)&&(T.is_facet(vh, vh_1, vh_2, c, i ,j ,k))) @@ -2328,7 +2315,7 @@ namespace CGAL { } - // Reperer le cas d'aretes interieures... + // Detect the interior edges case std::list vh_list; T.incident_vertices(vh, std::back_inserter(vh_list)); @@ -2402,9 +2389,9 @@ namespace CGAL { std::list L_v; - // Pour controler les sommets choisis sur le bord... + // To control vertices chosen on the boundary - // nombre d'aretes a partir duquel on considere que c'est irrecuperable NB_BORDER_MAX + // NB_BORDER_MAX: number of edges from which we consider that things are irrecoverable int vh_on_border_inserted(0); for(Finite_vertices_iterator v_it = T.finite_vertices_begin(); @@ -2445,7 +2432,7 @@ namespace CGAL { std::size_t itmp, L_v_size_mem; L_v_size_mem = L_v.size(); - if ((vh_on_border_inserted != 0)&& // pour ne post-traiter que les bords + if ((vh_on_border_inserted != 0)&& // to post-process only the borders (L_v.size() < .1 * _size_before_postprocessing)) { { @@ -2460,7 +2447,7 @@ namespace CGAL { } #ifdef VERBOSE if(L_v.size() > 0){ - std::cout << " " << L_v.size() << " non regular points." << std::endl; + std::cout << " " << L_v.size() << " non-regular points." << std::endl; } #endif // VERBOSE re_compute_values(); @@ -2469,7 +2456,7 @@ namespace CGAL { postprocess_timer.stop(); return false; } - // we stop if we removed more than 10% of points or after 20 rounds + // we stop if we removed more than 10% of points, or after 20 rounds if ((L_v_size_mem == L_v.size())|| ((_size_before_postprocessing - T.number_of_vertices()) > .1 * _size_before_postprocessing)|| @@ -2479,7 +2466,6 @@ namespace CGAL { } min_K = infinity(); - // fin-- // if (_postprocessing_counter < 5) // return true; postprocess_timer.stop(); diff --git a/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction_vertex_base_3.h b/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction_vertex_base_3.h index a8c2bf4b2b4..bbecac5c757 100644 --- a/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction_vertex_base_3.h +++ b/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction_vertex_base_3.h @@ -220,7 +220,7 @@ namespace CGAL { else { if (m_incident_border->second->first != nullptr) - std::cerr << "+++probleme de MAJ du bord " << std::endl; + std::cerr << "+++issue while updating border " << std::endl; *m_incident_border->second = elt; } } From 3b640e5e0ad56bac65f322bcb6c5915512cb74c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 23 Nov 2022 21:25:58 +0100 Subject: [PATCH 170/194] Fix the Kernel concept being weaker than TriangulationTraits_23 requirements --- .../Concepts/FunctionObjectConcepts.h | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h index 566d7643bcd..f6fc1663da5 100644 --- a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h +++ b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h @@ -5964,13 +5964,22 @@ public: /// A model of this concept must provide: /// @{ - /*! introduces a variable with Cartesian coordinates \f$ (0,0)\f$. */ Kernel::Point_2 operator()(const CGAL::Origin &CGAL::ORIGIN); + /*! + returns `p`. + + \note It is advised to return a const reference to `p` to avoid useless copies. + + \note This peculiar requirement is necessary because some CGAL structures such as triangulations + internally manipulate points whose type might `Point_2` or `Weighted_point_2`. + */ + Kernel::Point_2 operator()(const Kernel::Point_2& p); + /*! extracts the bare point from the weighted point. */ @@ -6001,6 +6010,16 @@ public: */ Kernel::Point_3 operator()(const CGAL::Origin &CGAL::ORIGIN); + /*! + returns `p`. + + \note It is advised to return a const reference to `p` to avoid useless copies. + + \note This peculiar requirement is necessary because some CGAL structures such as triangulations + internally manipulate points whose type might `Point_3` or `Weighted_point_3`. + */ + Kernel::Point_3 operator()(const Kernel::Point_3& p); + /*! extracts the bare point from the weighted point. */ From 0e8a76e615a4d91c972dfb2f169b1002f08ee626 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 24 Nov 2022 07:53:31 +0000 Subject: [PATCH 171/194] Polygonal Surface Reconstuction: Fix paths in examples --- .../Polygonal_surface_reconstruction.txt | 2 +- .../doc/Polygonal_surface_reconstruction/examples.txt | 2 +- .../Polygonal_surface_reconstruction/CMakeLists.txt | 4 ++-- .../polyfit_example_model_complexty_control.cpp | 6 +++--- .../polyfit_example_user_provided_planes.cpp | 2 +- .../polyfit_example_with_region_growing.cpp | 2 +- .../polyfit_example_without_input_planes.cpp | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Polygonal_surface_reconstruction/doc/Polygonal_surface_reconstruction/Polygonal_surface_reconstruction.txt b/Polygonal_surface_reconstruction/doc/Polygonal_surface_reconstruction/Polygonal_surface_reconstruction.txt index cbaf4f3e5a1..1f6d1200192 100644 --- a/Polygonal_surface_reconstruction/doc/Polygonal_surface_reconstruction/Polygonal_surface_reconstruction.txt +++ b/Polygonal_surface_reconstruction/doc/Polygonal_surface_reconstruction/Polygonal_surface_reconstruction.txt @@ -182,7 +182,7 @@ The following example shows how to control the model complexity by tuning the we \remark This example also shows how to reuse the intermediate results from the candidate generation step. -\cgalExample{Polygonal_surface_reconstruction/polyfit_example_model_complexty_control.cpp} +\cgalExample{Polygonal_surface_reconstruction/polyfit_example_model_complexity_control.cpp} \section secPerformances Performance diff --git a/Polygonal_surface_reconstruction/doc/Polygonal_surface_reconstruction/examples.txt b/Polygonal_surface_reconstruction/doc/Polygonal_surface_reconstruction/examples.txt index 0b1b37d6a26..24a2ab456cc 100644 --- a/Polygonal_surface_reconstruction/doc/Polygonal_surface_reconstruction/examples.txt +++ b/Polygonal_surface_reconstruction/doc/Polygonal_surface_reconstruction/examples.txt @@ -1,6 +1,6 @@ /*! \example Polygonal_surface_reconstruction/polyfit_example_without_input_planes.cpp \example Polygonal_surface_reconstruction/polyfit_example_user_provided_planes.cpp -\example Polygonal_surface_reconstruction/polyfit_example_model_complexty_control.cpp +\example Polygonal_surface_reconstruction/polyfit_example_model_complexity_control.cpp \example Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp */ diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt index 9db1ae5e988..0fb6ae17322 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt @@ -51,13 +51,13 @@ endif() create_single_source_cgal_program("polyfit_example_without_input_planes.cpp") create_single_source_cgal_program("polyfit_example_user_provided_planes.cpp") -create_single_source_cgal_program("polyfit_example_model_complexty_control.cpp") +create_single_source_cgal_program("polyfit_example_model_complexity_control.cpp") create_single_source_cgal_program("polyfit_example_with_region_growing.cpp") foreach( target polyfit_example_without_input_planes polyfit_example_user_provided_planes - polyfit_example_model_complexty_control polyfit_example_with_region_growing) + polyfit_example_model_complexity_control polyfit_example_with_region_growing) target_link_libraries(${target} PUBLIC CGAL::Eigen3_support) if(TARGET CGAL::SCIP_support) target_link_libraries(${target} PUBLIC CGAL::SCIP_support) diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_model_complexty_control.cpp b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_model_complexty_control.cpp index 64fd9a9784a..e132d62975d 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_model_complexty_control.cpp +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_model_complexty_control.cpp @@ -90,7 +90,7 @@ int main() return EXIT_FAILURE; } else { - const std::string& output_file = "data/building_result-0.05.off"; + const std::string& output_file = "building_result-0.05.off"; if (CGAL::IO::write_OFF(output_file, model)) { std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; } @@ -108,7 +108,7 @@ int main() return EXIT_FAILURE; } else { - const std::string& output_file = "data/building_result-0.5.off"; + const std::string& output_file = "building_result-0.5.off"; if (CGAL::IO::write_OFF(output_file, model)) std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; else { @@ -125,7 +125,7 @@ int main() return EXIT_FAILURE; } else { - const std::string& output_file = "data/building_result-0.7.off"; + const std::string& output_file = "building_result-0.7.off"; if (CGAL::IO::write_OFF(output_file, model)){ std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; } diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_user_provided_planes.cpp b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_user_provided_planes.cpp index 733f0113749..2f2ed2df2c9 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_user_provided_planes.cpp +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_user_provided_planes.cpp @@ -89,7 +89,7 @@ int main() } // Saves the mesh model - const std::string& output_file("data/ball_result.off"); + const std::string& output_file("user_provided_planes_result.off"); if (CGAL::IO::write_OFF(output_file, model)) std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; else { diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp index 8dc81bd3c1e..493c8c138aa 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp @@ -172,7 +172,7 @@ int main() std::cout << "Saving..."; t.reset(); - const std::string& output_file("data/cube_result.off"); + const std::string& output_file("with_region_growing_result.off"); if (CGAL::IO::write_OFF(output_file, model)) std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; else { diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_without_input_planes.cpp b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_without_input_planes.cpp index 85e474d99d7..4b2ed8f91a4 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_without_input_planes.cpp +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_without_input_planes.cpp @@ -125,7 +125,7 @@ int main() return EXIT_FAILURE; } - const std::string& output_file("data/cube_result.off"); + const std::string& output_file("without_input_planes_result.off"); if (CGAL::IO::write_OFF(output_file, model)) std::cout << " Done. Saved to " << output_file << ". Time: " << t.time() << " sec." << std::endl; else { @@ -138,7 +138,7 @@ int main() // Also stores the candidate faces as a surface mesh to a file Surface_mesh candidate_faces; algo.output_candidate_faces(candidate_faces); - const std::string& candidate_faces_file("data/cube_candidate_faces.off"); + const std::string& candidate_faces_file("without_input_planes_cube_candidate_faces.off"); std::ofstream candidate_stream(candidate_faces_file.c_str()); if (CGAL::IO::write_OFF(candidate_stream, candidate_faces)) std::cout << "Candidate faces saved to " << candidate_faces_file << "." << std::endl; From 1cce49285b90d969500afbb67b16dd3bfeaa8ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 24 Nov 2022 08:56:50 +0100 Subject: [PATCH 172/194] fix doc issue (locally tested) --- .../doc/Minkowski_sum_2/CGAL/approximated_offset_2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Minkowski_sum_2/doc/Minkowski_sum_2/CGAL/approximated_offset_2.h b/Minkowski_sum_2/doc/Minkowski_sum_2/CGAL/approximated_offset_2.h index d53817e4676..8ccc2643a0e 100644 --- a/Minkowski_sum_2/doc/Minkowski_sum_2/CGAL/approximated_offset_2.h +++ b/Minkowski_sum_2/doc/Minkowski_sum_2/CGAL/approximated_offset_2.h @@ -14,7 +14,7 @@ several disconnected components. The result is therefore represented as a sequence of generalized polygons, whose edges are either line segments or circular arcs. The output sequence is returned via the output iterator `oi`, whose -value-type must be `Gps_circle_segment_traits_2::Polygon_2`. +value-type must be `Gps_circle_segment_traits_2::%Polygon_2`. \pre `P` is a simple polygon. */ template From 9734f71e121332f39961d314b40d6135a1c312e6 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 24 Nov 2022 08:01:21 +0000 Subject: [PATCH 173/194] Rename example file --- ...y_control.cpp => polyfit_example_model_complexity_control.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/{polyfit_example_model_complexty_control.cpp => polyfit_example_model_complexity_control.cpp} (100%) diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_model_complexty_control.cpp b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_model_complexity_control.cpp similarity index 100% rename from Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_model_complexty_control.cpp rename to Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_model_complexity_control.cpp From 45609cfc4729a52d49d70d64c57ead5032e0f412 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 24 Nov 2022 09:30:35 +0100 Subject: [PATCH 174/194] unused typedef --- Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h b/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h index 36192b297c6..90b6216f5f7 100644 --- a/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h +++ b/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h @@ -216,7 +216,6 @@ void tetrahedral_isotropic_remeshing( = choose_parameter(get_parameter(np, internal_np::smooth_constrained_edges), false); - typedef typename Tr::Cell_handle Cell_handle; typedef typename internal_np::Lookup_named_param_def < internal_np::cell_selector_t, NamedParameters, 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 175/194] 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 From 0ecffe291342eaf1407594719589259dc253788e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 24 Nov 2022 11:50:06 +0100 Subject: [PATCH 176/194] Avoid conflicts between 'OpenMesh' as a mesh template parameter and namespace --- .../CGAL/boost/graph/properties_OpenMesh.h | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/properties_OpenMesh.h b/BGL/include/CGAL/boost/graph/properties_OpenMesh.h index bdc9cec7ef0..5ce5808ff81 100644 --- a/BGL/include/CGAL/boost/graph/properties_OpenMesh.h +++ b/BGL/include/CGAL/boost/graph/properties_OpenMesh.h @@ -130,16 +130,16 @@ public: }; -template +template class OM_edge_weight_pmap { public: typedef boost::readable_property_map_tag category; - typedef typename OpenMesh::Scalar value_type; + typedef typename OM_Mesh::Scalar value_type; typedef value_type reference; - typedef typename boost::graph_traits::edge_descriptor key_type; + typedef typename boost::graph_traits::edge_descriptor key_type; - OM_edge_weight_pmap(const OpenMesh& sm) + OM_edge_weight_pmap(const OM_Mesh& sm) : sm_(sm) {} @@ -151,7 +151,7 @@ public: friend inline value_type get(const OM_edge_weight_pmap& m, const key_type& k) { return m[k]; } private: - const OpenMesh& sm_; + const OM_Mesh& sm_; }; template @@ -175,26 +175,26 @@ public: }; -template +template class OM_point_pmap { public: #if defined(CGAL_USE_OM_POINTS) typedef boost::lvalue_property_map_tag category; - typedef typename OpenMesh::Point value_type; - typedef const typename OpenMesh::Point& reference; + typedef typename OM_Mesh::Point value_type; + typedef const typename OM_Mesh::Point& reference; #else typedef boost::read_write_property_map_tag category; typedef P value_type; typedef P reference; #endif - typedef typename boost::graph_traits::vertex_descriptor key_type; + typedef typename boost::graph_traits::vertex_descriptor key_type; OM_point_pmap() : sm_(nullptr) {} - OM_point_pmap(const OpenMesh& sm) + OM_point_pmap(const OM_Mesh& sm) : sm_(&sm) {} @@ -208,37 +208,37 @@ public: return sm_->point(v); #else CGAL_assertion(sm_!=nullptr); - typename OpenMesh::Point const& omp = sm_->point(v); + typename OM_Mesh::Point const& omp = sm_->point(v); return value_type(omp[0], omp[1], omp[2]); #endif } - inline friend reference get(const OM_point_pmap& pm, key_type v) + inline friend reference get(const OM_point_pmap& pm, key_type v) { CGAL_precondition(pm.sm_!=nullptr); #if defined(CGAL_USE_OM_POINTS) return pm.sm_->point(v); #else CGAL_assertion(pm.sm_!=nullptr); - typename OpenMesh::Point const& omp = pm.sm_->point(v); + typename OM_Mesh::Point const& omp = pm.sm_->point(v); return value_type(omp[0], omp[1], omp[2]); #endif } - inline friend void put(const OM_point_pmap& pm, key_type v, const value_type& p) + inline friend void put(const OM_point_pmap& pm, key_type v, const value_type& p) { CGAL_precondition(pm.sm_!=nullptr); #if defined(CGAL_USE_OM_POINTS) - const_cast(*pm.sm_).set_point(v,p); + const_cast(*pm.sm_).set_point(v,p); #else - typedef typename OpenMesh::vector_traits::value_type Scalar; - const_cast(*pm.sm_).set_point - (v, typename OpenMesh::Point(Scalar(p[0]), Scalar(p[1]), Scalar(p[2]))); + typedef typename OpenMesh::vector_traits::value_type Scalar; + const_cast(*pm.sm_).set_point + (v, typename OM_Mesh::Point(Scalar(p[0]), Scalar(p[1]), Scalar(p[2]))); #endif } private: - const OpenMesh* sm_; + const OM_Mesh* sm_; }; } // CGAL #endif // CGAL_BOOST_GRAPH_PROPERTIES_OPENMESH_H From 87960efc48fdace3c23831534a5eb6f7786e403d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 24 Nov 2022 12:41:05 +0100 Subject: [PATCH 177/194] Fix Line_3 Tet_3 intersection test The construction of the line is only valid if the tet is well oriented --- .../test/Intersections_3/test_intersections_Line_3.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Intersections_3/test/Intersections_3/test_intersections_Line_3.cpp b/Intersections_3/test/Intersections_3/test_intersections_Line_3.cpp index 9b5490c0164..6fe55a40654 100644 --- a/Intersections_3/test/Intersections_3/test_intersections_Line_3.cpp +++ b/Intersections_3/test/Intersections_3/test_intersections_Line_3.cpp @@ -339,12 +339,15 @@ public: { P tet0 = random_point(), tet1 = random_point(), tet2 = random_point(), tet3 = random_point(); - const Tet tet(tet0, tet1, tet2, tet3); + Tet tet(tet0, tet1, tet2, tet3); if(tet.is_degenerate()) continue; - P l0 = tet0 - CGAL::cross_product(V(tet0, tet1), V(tet0, tet2)); - P l1 = tet3 + CGAL::cross_product(V(tet3, tet1), V(tet3, tet2)); + if(tet.orientation() == CGAL::NEGATIVE) + tet = Tet(tet1, tet0, tet2, tet3); + + P l0 = tet[0] - CGAL::cross_product(V(tet[0], tet[1]), V(tet[0], tet[2])); + P l1 = tet[3] + CGAL::cross_product(V(tet[3], tet[1]), V(tet[3], tet[2])); assert(tet.has_on_unbounded_side(l0) && tet.has_on_unbounded_side(l1)); From 2b44e11fb53929ef6a2c10aadb4528ffcaea91a6 Mon Sep 17 00:00:00 2001 From: Mael Date: Thu, 24 Nov 2022 13:10:22 +0100 Subject: [PATCH 178/194] Apply suggestions from @albert-github & @afabri --- Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h index f6fc1663da5..c770d0b7b40 100644 --- a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h +++ b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h @@ -5975,8 +5975,8 @@ public: \note It is advised to return a const reference to `p` to avoid useless copies. - \note This peculiar requirement is necessary because some CGAL structures such as triangulations - internally manipulate points whose type might `Point_2` or `Weighted_point_2`. + \note This peculiar requirement is necessary because some \cgal structures such as triangulations + internally manipulate points whose type might be `Point_2` or `Weighted_point_2`. */ Kernel::Point_2 operator()(const Kernel::Point_2& p); @@ -6015,8 +6015,8 @@ public: \note It is advised to return a const reference to `p` to avoid useless copies. - \note This peculiar requirement is necessary because some CGAL structures such as triangulations - internally manipulate points whose type might `Point_3` or `Weighted_point_3`. + \note This peculiar requirement is necessary because some \cgal structures such as triangulations + internally manipulate points whose type might be `Point_3` or `Weighted_point_3`. */ Kernel::Point_3 operator()(const Kernel::Point_3& p); From 5fbeecaef898b3ed150d09a6232998f9a4b36ed3 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 28 Nov 2022 10:54:54 +0100 Subject: [PATCH 179/194] disable sharpFeaturesGroup for gray level images --- .../demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp index 246a0fd2f8d..5436c53281e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp @@ -543,6 +543,9 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, .arg(bbox.ymax() - bbox.ymin(),0,'g',3) .arg(bbox.zmax() - bbox.zmin(),0,'g',3) ); + const bool input_is_labeled_img = (image_item != nullptr && !image_item->isGray()); + const bool input_is_gray_img = (image_item != nullptr && image_item->isGray()); + set_defaults(); double diag = CGAL::sqrt((bbox.xmax()-bbox.xmin())*(bbox.xmax()-bbox.xmin()) + (bbox.ymax()-bbox.ymin())*(bbox.ymax()-bbox.ymin()) + (bbox.zmax()-bbox.zmin())*(bbox.zmax()-bbox.zmin())); ui.facetSizing->setRange(diag * 10e-6, // min @@ -561,11 +564,13 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, ui.protect->setEnabled(features_protection_available); ui.protect->setChecked(features_protection_available); ui.protectEdges->setEnabled(features_protection_available); + if(input_is_gray_img) + ui.sharpFeaturesGroup->setEnabled(false); ui.facegraphCheckBox->setVisible(mesh_type == Mesh_type::SURFACE_ONLY); - ui.initializationGroup->setVisible(image_item != nullptr && - !image_item->isGray()); - ui.grayImgGroup->setVisible(image_item != nullptr && image_item->isGray()); + ui.initializationGroup->setVisible(input_is_labeled_img); + ui.grayImgGroup->setVisible(input_is_gray_img); + if (items->which() == POLYHEDRAL_MESH_ITEMS) ui.volumeGroup->setVisible(mesh_type == Mesh_type::VOLUME && nullptr != bounding_sm_item); @@ -609,7 +614,6 @@ void Mesh_3_plugin::mesh_3(const Mesh_type mesh_type, connect(ui.useWeights_checkbox, SIGNAL(toggled(bool)), ui.weightsSigma_label, SLOT(setEnabled(bool))); ui.weightsSigma->setValue(1.); - bool input_is_labeled_img = (image_item != nullptr && !image_item->isGray()); ui.labeledImgGroup->setVisible(input_is_labeled_img); #ifndef CGAL_USE_ITK From aee677f2897f22684f4cfb36c54f65484fa51414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 28 Nov 2022 12:13:50 +0100 Subject: [PATCH 180/194] Revert "Use OpenMesh::DefaultTraitsDouble directly instead of custom traits" This reverts commit 16da969e88cf9ca926de63c40a1d21fea550d5f3. So that it does not bump OpenMesh required version --- .../Linear_cell_complex_2/openmesh_performance.h | 11 ++++++++++- .../Cactus_deformation_session_OpenMesh.cpp | 15 +++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_2/openmesh_performance.h b/Linear_cell_complex/benchmark/Linear_cell_complex_2/openmesh_performance.h index afdb700c75b..71ff72ea813 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_2/openmesh_performance.h +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_2/openmesh_performance.h @@ -22,10 +22,19 @@ public: mesh.request_face_normals(); } + private: - typedef OpenMesh::TriMesh_ArrayKernelT Mesh; + + struct MyTraits : public OpenMesh::DefaultTraits + { + typedef OpenMesh::Vec3d Point; + typedef OpenMesh::Vec3d Normal; + }; + + typedef OpenMesh::TriMesh_ArrayKernelT Mesh; Mesh mesh; + private: void display_info() { diff --git a/Surface_mesh_deformation/test/Surface_mesh_deformation/Cactus_deformation_session_OpenMesh.cpp b/Surface_mesh_deformation/test/Surface_mesh_deformation/Cactus_deformation_session_OpenMesh.cpp index 06817a78b71..fe1aded57c0 100644 --- a/Surface_mesh_deformation/test/Surface_mesh_deformation/Cactus_deformation_session_OpenMesh.cpp +++ b/Surface_mesh_deformation/test/Surface_mesh_deformation/Cactus_deformation_session_OpenMesh.cpp @@ -13,10 +13,17 @@ #include -typedef OpenMesh::PolyMesh_ArrayKernelT Mesh; -typedef Mesh::Point Point; -typedef boost::graph_traits::vertex_descriptor vertex_descriptor; -typedef boost::graph_traits::vertex_iterator vertex_iterator; +struct DoubleTraits : public OpenMesh::DefaultTraits +{ + typedef OpenMesh::Vec3d Point; + typedef OpenMesh::Vec3d Normal; +}; + + +typedef OpenMesh::PolyMesh_ArrayKernelT Mesh; +typedef Mesh::Point Point; +typedef boost::graph_traits::vertex_descriptor vertex_descriptor; +typedef boost::graph_traits::vertex_iterator vertex_iterator; typedef CGAL::Surface_mesh_deformation Deform_mesh_arap; typedef CGAL::Surface_mesh_deformation Deform_mesh_spoke; From 0b56297ea2b1e215bed1dbc99e204b3e93b56f2c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 28 Nov 2022 14:05:59 +0000 Subject: [PATCH 181/194] Polygon Mesh Processing: Fix CGAL_assertion_msg --- .../Polygon_mesh_processing/isotropic_remeshing_example.cpp | 3 +++ .../internal/Isotropic_remeshing/remesh_impl.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp index 9db3996b581..0a01650a082 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp @@ -1,3 +1,6 @@ +#define CGAL_NO_ASSERTIONS + + #include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index b75198cd96a..08f18872a52 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -328,7 +328,7 @@ namespace internal { halfedge_status_pmap_ = get(CGAL::dynamic_halfedge_property_t(), pmesh); CGAL_assertion_code(input_mesh_is_valid_ = CGAL::is_valid_polygon_mesh(pmesh)); - CGAL_warning_msg(input_mesh_is_valid_, + CGAL_assertion_msg(input_mesh_is_valid_, "The input mesh is not a valid polygon mesh. " "It could lead PMP::isotropic_remeshing() to fail."); } From 92a4a4180ded369b509f3a75c01325d3cf6a8e84 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 28 Nov 2022 14:15:53 +0000 Subject: [PATCH 182/194] Polyhedron demo: unamed --- Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp | 2 +- .../Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp index b4a495d9422..8216f422372 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp @@ -1069,7 +1069,7 @@ public Q_SLOTS: selection_item->set_is_insert(is_insert); selection_item->set_k_ring(k_ring); selection_item->setRenderingMode(Flat); - if(selection_item->name() == "unamed") { + if(selection_item->name() == "unnamed") { selection_item->setName(tr("%1 (selection)").arg(poly_item->name())); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp index 03259d7e6eb..d6be0d38c6a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp @@ -222,7 +222,7 @@ void Polyhedron_demo_shortest_path_plugin::new_item(int itemIndex) item->setRenderingMode(Flat); - if(item->name() == "unamed") + if(item->name() == "unnamed") { item->setName(tr("%1 (shortest path computation item)").arg(item->polyhedron_item()->name())); } From 675d4a4efff66ae710e274e2990db5bccda2b598 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 28 Nov 2022 14:22:42 +0000 Subject: [PATCH 183/194] Remove debug code --- .../Polygon_mesh_processing/isotropic_remeshing_example.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp index 0a01650a082..9db3996b581 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp @@ -1,6 +1,3 @@ -#define CGAL_NO_ASSERTIONS - - #include #include #include From 6572a8fb585af2494539366dd117d3cda451d8c1 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 28 Nov 2022 14:39:20 +0000 Subject: [PATCH 184/194] It's a warning not an assertion --- .../internal/Isotropic_remeshing/remesh_impl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index 08f18872a52..b062ecfed2d 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -327,8 +327,8 @@ namespace internal { { halfedge_status_pmap_ = get(CGAL::dynamic_halfedge_property_t(), pmesh); - CGAL_assertion_code(input_mesh_is_valid_ = CGAL::is_valid_polygon_mesh(pmesh)); - CGAL_assertion_msg(input_mesh_is_valid_, + CGAL_warning_code(input_mesh_is_valid_ = CGAL::is_valid_polygon_mesh(pmesh)); + CGAL_warning_msg(input_mesh_is_valid_, "The input mesh is not a valid polygon mesh. " "It could lead PMP::isotropic_remeshing() to fail."); } From 128cc719fe4708bbd1a26d4374ce7dd99c0890f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 29 Nov 2022 11:14:22 +0100 Subject: [PATCH 185/194] missing } --- .../include/CGAL/Polygon_mesh_processing/orientation.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h index 1458ca18b00..fa239568322 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orientation.h @@ -1649,8 +1649,8 @@ void merge_reversible_connected_components(PolygonMesh& pm, * \cgalParamNBegin{face_partition_id_map} * \cgalParamDescription{a property map filled by this function and that will contain for each face * the id of its surface component after reversal and stitching in the range `[0, n - 1]`, - * with `n` the number of such components. - * \cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits::face_descriptor` as key type and `std::size_t` as value type} + * with `n` the number of such components.} + * \cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits::%face_descriptor` as key type and `std::size_t` as value type} * \cgalParamNEnd * \cgalNamedParamsEnd * From 2c8d3179609fefa7a8c4b503f9ca4f1ee4e9febf Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 29 Nov 2022 10:45:00 +0000 Subject: [PATCH 186/194] Spatial_searching: Fix doc --- .../doc/Spatial_searching/CGAL/Weighted_Minkowski_distance.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Spatial_searching/doc/Spatial_searching/CGAL/Weighted_Minkowski_distance.h b/Spatial_searching/doc/Spatial_searching/CGAL/Weighted_Minkowski_distance.h index d82fd2ca8b7..e1575fb05f3 100644 --- a/Spatial_searching/doc/Spatial_searching/CGAL/Weighted_Minkowski_distance.h +++ b/Spatial_searching/doc/Spatial_searching/CGAL/Weighted_Minkowski_distance.h @@ -52,7 +52,8 @@ Constructor implementing \f$ l_2\f$ metric for \f$ d\f$-dimensional points. Weighted_Minkowski_distance(int d,Traits t=Traits()); /*! -Constructor implementing the \f$ l_{power}(weights)\f$ metric. \f$ power \leq0\f$ denotes the \f$ l_{\infty}(weights)\f$ metric. +Constructor implementing the \f$ l_{power}(weights)\f$ metric. `power=0` +denotes the \f$ l_{\infty}(weights)\f$ metric. The values in the iterator range `[wb,we)` are the weight. */ template From 699454ae84d76afd4f0198fffe65d2392ef98fa1 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 29 Nov 2022 13:22:00 +0000 Subject: [PATCH 187/194] STL Extensions: Correct spelling --- .../include/CGAL/Compact_container_with_index.h | 5 ++++- .../Chapter_iterators_and_circulators.txt | 2 +- STL_Extension/doc/STL_Extension/CGAL/Compact_container.h | 2 +- .../doc/STL_Extension/CGAL/Concurrent_compact_container.h | 2 +- STL_Extension/include/CGAL/Compact_container.h | 8 +++++++- STL_Extension/include/CGAL/Concurrent_compact_container.h | 6 +++++- .../test/STL_Extension/test_Compact_container.cpp | 8 ++++---- .../STL_Extension/test_Concurrent_compact_container.cpp | 8 ++++---- TDS_3/include/CGAL/Triangulation_data_structure_3.h | 8 ++++---- 9 files changed, 31 insertions(+), 18 deletions(-) diff --git a/Combinatorial_map/include/CGAL/Compact_container_with_index.h b/Combinatorial_map/include/CGAL/Compact_container_with_index.h index 37d555793b6..7cbd54e5c94 100644 --- a/Combinatorial_map/include/CGAL/Compact_container_with_index.h +++ b/Combinatorial_map/include/CGAL/Compact_container_with_index.h @@ -752,7 +752,10 @@ public: return false; } - bool owns_dereferencable(const_iterator cit) const + bool owns_dereferenceable(const_iterator cit) const + { return cit!=end() && owns(cit); } + + CGAL_DEPRECATED bool owns_dereferencable(const_iterator cit) const { return cit!=end() && owns(cit); } /** Reserve method to ensure that the capacity of the Compact_container be diff --git a/Documentation/doc/Documentation/Developer_manual/Chapter_iterators_and_circulators.txt b/Documentation/doc/Documentation/Developer_manual/Chapter_iterators_and_circulators.txt index b7450d5cd3d..bb7567c4858 100644 --- a/Documentation/doc/Documentation/Developer_manual/Chapter_iterators_and_circulators.txt +++ b/Documentation/doc/Documentation/Developer_manual/Chapter_iterators_and_circulators.txt @@ -42,7 +42,7 @@ Thus we will not give a full description of these concept here but only a few hints about how to use and write handle, iterators and circulators in \cgal. Developers should consult the above-mentioned references to become familiar with the iterator, circulator and handle concepts. In particular, the notions of iterator and circulator ranges, -dereferencable and past-the-end values, +dereferenceable and past-the-end values, mutable and constant iterators and circulators, and the different categories (forward, bidirectional, random-access, etc.) of iterators and circulators, are fundamental. diff --git a/STL_Extension/doc/STL_Extension/CGAL/Compact_container.h b/STL_Extension/doc/STL_Extension/CGAL/Compact_container.h index 98a1af5ceb6..dd409ee8f02 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/Compact_container.h +++ b/STL_Extension/doc/STL_Extension/CGAL/Compact_container.h @@ -672,7 +672,7 @@ bool owns(const_iterator pos); /*! * returns whether `pos` is in the range `[cc.begin(), cc`.end())` (`cc.end()` excluded). */ -bool owns_dereferencable(const_iterator pos); +bool owns_dereferenceable(const_iterator pos); /// @} 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..608c81f2f7a 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/Concurrent_compact_container.h +++ b/STL_Extension/doc/STL_Extension/CGAL/Concurrent_compact_container.h @@ -294,7 +294,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). - bool owns_dereferencable(const_iterator pos); + bool owns_dereferenceable(const_iterator pos); /// @} diff --git a/STL_Extension/include/CGAL/Compact_container.h b/STL_Extension/include/CGAL/Compact_container.h index 93a6debd770..cbdec0be4ac 100644 --- a/STL_Extension/include/CGAL/Compact_container.h +++ b/STL_Extension/include/CGAL/Compact_container.h @@ -537,7 +537,13 @@ public: return false; } - bool owns_dereferencable(const_iterator cit) const + bool owns_dereferenceable(const_iterator cit) const + { + return cit != end() && owns(cit); + } + + + CGAL_DEPRECATED bool owns_dereferencable(const_iterator cit) const { return cit != end() && owns(cit); } diff --git a/STL_Extension/include/CGAL/Concurrent_compact_container.h b/STL_Extension/include/CGAL/Concurrent_compact_container.h index 6bbdeee9176..1c50020ae5d 100644 --- a/STL_Extension/include/CGAL/Concurrent_compact_container.h +++ b/STL_Extension/include/CGAL/Concurrent_compact_container.h @@ -542,11 +542,15 @@ public: return false; } - bool owns_dereferencable(const_iterator cit) const + bool owns_dereferenceable(const_iterator cit) const { return cit != end() && owns(cit); } + CGAL_DEPRECATED bool owns_dereferencable(const_iterator cit) const + { + return cit != end() && owns(cit); + } /** Reserve method to ensure that the capacity of the Concurrent_compact_container be * greater or equal than a given value n. */ diff --git a/STL_Extension/test/STL_Extension/test_Compact_container.cpp b/STL_Extension/test/STL_Extension/test_Compact_container.cpp index 661ec453cbd..d2d96cdfc4b 100644 --- a/STL_Extension/test/STL_Extension/test_Compact_container.cpp +++ b/STL_Extension/test/STL_Extension/test_Compact_container.cpp @@ -242,15 +242,15 @@ void test(const Cont &) assert(c11.size() == v1.size()); assert(c10 == c11); - // owns() and owns_dereferencable(). + // owns() and owns_dereferenceable(). for(typename Cont::const_iterator it = c9.begin(), end = c9.end(); it != end; ++it) { assert(c9.owns(it)); - assert(c9.owns_dereferencable(it)); + assert(c9.owns_dereferenceable(it)); assert(! c10.owns(it)); - assert(! c10.owns_dereferencable(it)); + assert(! c10.owns_dereferenceable(it)); } assert(c9.owns(c9.end())); - assert(! c9.owns_dereferencable(c9.end())); + assert(! c9.owns_dereferenceable(c9.end())); c9.erase(c9.begin(), c9.end()); diff --git a/STL_Extension/test/STL_Extension/test_Concurrent_compact_container.cpp b/STL_Extension/test/STL_Extension/test_Concurrent_compact_container.cpp index 00f2e1da4ec..a42676f8f7f 100644 --- a/STL_Extension/test/STL_Extension/test_Concurrent_compact_container.cpp +++ b/STL_Extension/test/STL_Extension/test_Concurrent_compact_container.cpp @@ -322,15 +322,15 @@ void test(const Cont &) assert(c11.size() == v1.size()); assert(c10 == c11);*/ - // owns() and owns_dereferencable(). + // owns() and owns_dereferenceable(). for(typename Cont::const_iterator it = c9.begin(), end = c9.end(); it != end; ++it) { assert(c9.owns(it)); - assert(c9.owns_dereferencable(it)); + assert(c9.owns_dereferenceable(it)); assert(! c10.owns(it)); - assert(! c10.owns_dereferencable(it)); + assert(! c10.owns_dereferenceable(it)); } assert(c9.owns(c9.end())); - assert(! c9.owns_dereferencable(c9.end())); + assert(! c9.owns_dereferenceable(c9.end())); c9.erase(c9.begin(), c9.end()); diff --git a/TDS_3/include/CGAL/Triangulation_data_structure_3.h b/TDS_3/include/CGAL/Triangulation_data_structure_3.h index 8f2df91c48a..6333387f28b 100644 --- a/TDS_3/include/CGAL/Triangulation_data_structure_3.h +++ b/TDS_3/include/CGAL/Triangulation_data_structure_3.h @@ -2049,7 +2049,7 @@ bool Triangulation_data_structure_3:: is_vertex(Vertex_handle v) const { - return vertices().owns_dereferencable(v); + return vertices().owns_dereferenceable(v); } template @@ -2102,7 +2102,7 @@ is_edge(Cell_handle c, int i, int j) const if ( (dimension() == 2) && ((i>2) || (j>2)) ) return false; if ((i>3) || (j>3)) return false; - return cells().owns_dereferencable(c); + return cells().owns_dereferenceable(c); } template @@ -2149,7 +2149,7 @@ is_facet(Cell_handle c, int i) const if ( (dimension() == 2) && (i!=3) ) return false; - return cells().owns_dereferencable(c); + return cells().owns_dereferenceable(c); } template @@ -2161,7 +2161,7 @@ is_cell( Cell_handle c ) const if (dimension() < 3) return false; - return cells().owns_dereferencable(c); + return cells().owns_dereferenceable(c); } template From 8ddf7848a0a820c0d187dd911a525341cce7e05b Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 30 Nov 2022 10:03:45 +0000 Subject: [PATCH 188/194] forward call instead of duplicated code --- Combinatorial_map/include/CGAL/Compact_container_with_index.h | 2 +- STL_Extension/include/CGAL/Compact_container.h | 2 +- STL_Extension/include/CGAL/Concurrent_compact_container.h | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Combinatorial_map/include/CGAL/Compact_container_with_index.h b/Combinatorial_map/include/CGAL/Compact_container_with_index.h index 7cbd54e5c94..a87122500fc 100644 --- a/Combinatorial_map/include/CGAL/Compact_container_with_index.h +++ b/Combinatorial_map/include/CGAL/Compact_container_with_index.h @@ -756,7 +756,7 @@ public: { return cit!=end() && owns(cit); } CGAL_DEPRECATED bool owns_dereferencable(const_iterator cit) const - { return cit!=end() && owns(cit); } + { return owns_dereferenceable(cit); } /** Reserve method to ensure that the capacity of the Compact_container be * greater or equal than a given value n. diff --git a/STL_Extension/include/CGAL/Compact_container.h b/STL_Extension/include/CGAL/Compact_container.h index cbdec0be4ac..b8c1cb0769c 100644 --- a/STL_Extension/include/CGAL/Compact_container.h +++ b/STL_Extension/include/CGAL/Compact_container.h @@ -545,7 +545,7 @@ public: CGAL_DEPRECATED bool owns_dereferencable(const_iterator cit) const { - return cit != end() && owns(cit); + return owns_dereferenceable(cit); } /** Reserve method to ensure that the capacity of the Compact_container be diff --git a/STL_Extension/include/CGAL/Concurrent_compact_container.h b/STL_Extension/include/CGAL/Concurrent_compact_container.h index 1c50020ae5d..395f8a483f4 100644 --- a/STL_Extension/include/CGAL/Concurrent_compact_container.h +++ b/STL_Extension/include/CGAL/Concurrent_compact_container.h @@ -549,8 +549,9 @@ public: CGAL_DEPRECATED bool owns_dereferencable(const_iterator cit) const { - return cit != end() && owns(cit); + return owns_dereferenceable(cit); } + /** Reserve method to ensure that the capacity of the Concurrent_compact_container be * greater or equal than a given value n. */ From d89111412aee3acd25190d99f1739e78c02f633b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 1 Dec 2022 03:48:49 +0100 Subject: [PATCH 189/194] add link to page generating diff of test results --- Maintenance/test_handling/create_testresult_page | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Maintenance/test_handling/create_testresult_page b/Maintenance/test_handling/create_testresult_page index ac7d8d5c28a..8d4a3d96f71 100755 --- a/Maintenance/test_handling/create_testresult_page +++ b/Maintenance/test_handling/create_testresult_page @@ -622,6 +622,8 @@ Downloading internal releases

  • The doxygen documentation testpage (and the overview page)
  • +
  • +Diff of testsuites results
  • EOF if ( -r "announce.html" ) { print OUTPUT<<"EOF"; From e22e36b15a0c553230b385a4b0956df35b0df0a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 1 Dec 2022 03:49:58 +0100 Subject: [PATCH 190/194] remove no longer used functionality --- Maintenance/test_handling/create_testresult_page | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Maintenance/test_handling/create_testresult_page b/Maintenance/test_handling/create_testresult_page index 8d4a3d96f71..332dd91b63c 100755 --- a/Maintenance/test_handling/create_testresult_page +++ b/Maintenance/test_handling/create_testresult_page @@ -624,14 +624,8 @@ The doxygen documentation testpage (and the overview page)
  • Diff of testsuites results
  • + EOF - if ( -r "announce.html" ) { - print OUTPUT<<"EOF"; -
  • Announcement of this release
  • -EOF - } - - print OUTPUT "\n"; } From 079993d0c6693435758c2315fc60c68619d3eb39 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 5 Dec 2022 15:18:03 +0100 Subject: [PATCH 191/194] updated crontab (automated commit) --- Maintenance/infrastructure/cgal.geometryfactory.com/crontab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Maintenance/infrastructure/cgal.geometryfactory.com/crontab b/Maintenance/infrastructure/cgal.geometryfactory.com/crontab index 633a3f95570..ce30c5ee6d7 100644 --- a/Maintenance/infrastructure/cgal.geometryfactory.com/crontab +++ b/Maintenance/infrastructure/cgal.geometryfactory.com/crontab @@ -107,7 +107,7 @@ LC_CTYPE=en_US.UTF-8 # - on trunk #0 21 * * Sat cd $HOME/CGAL/create_internal_release; scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/trunk --public --do-it -# Check the links of https://www.cgal.org/projects.html every sunday at 17:42 +# Check the links of http://www.cgal.org/projects.html every sunday at 17:42 #42 17 * * Sun linklint -host www.cgal.org -http /projects.html -net -no_anchors -quiet -silent -error # A test that does not work From 0d89f3c12bc310a8d7e47978a06925d1a5528d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 8 Dec 2022 15:56:55 +0100 Subject: [PATCH 192/194] remove non-needed instruction --- .github/install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/install.sh b/.github/install.sh index e06328da401..32b8552aa8f 100755 --- a/.github/install.sh +++ b/.github/install.sh @@ -1,5 +1,4 @@ #!/bin/bash -sudo add-apt-repository ppa:mikhailnov/pulseeffects -y sudo apt-get update sudo apt-get install -y libmpfr-dev \ libeigen3-dev qtbase5-dev libqt5sql5-sqlite libqt5opengl5-dev qtscript5-dev \ From 112ae67664d007463761e1d2e67f6ec64d762ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 12 Dec 2022 16:06:30 +0100 Subject: [PATCH 193/194] Add include guard --- .../CGAL/Testsuite/Triangulation_23/test_move_semantic.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Testsuite/include/CGAL/Testsuite/Triangulation_23/test_move_semantic.h b/Testsuite/include/CGAL/Testsuite/Triangulation_23/test_move_semantic.h index 3254fb6571f..ed489b44bcf 100644 --- a/Testsuite/include/CGAL/Testsuite/Triangulation_23/test_move_semantic.h +++ b/Testsuite/include/CGAL/Testsuite/Triangulation_23/test_move_semantic.h @@ -11,6 +11,8 @@ // Author(s) : Laurent Rineau // +#ifndef CGAL_TEST_T23_MOVE_SEMANTIC_C +#define CGAL_TEST_T23_MOVE_SEMANTIC_C #include @@ -67,3 +69,5 @@ namespace CGAL { } } } + +#endif // CGAL_TEST_T23_MOVE_SEMANTIC_C From ecced44ee7c2b011fef5292b66947c03bb0b76dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 12 Dec 2022 16:07:21 +0100 Subject: [PATCH 194/194] Various test cleaning / improvements for Triangulation_3 --- .../test/Triangulation_3/CMakeLists.txt | 9 +- .../include/CGAL/_test_cls_delaunay_3.h | 47 +- .../include/CGAL/_test_cls_regular_3.h | 347 ++++++++++--- .../include/CGAL/_test_cls_triangulation_3.h | 19 +- .../test/Triangulation_3/test_regular_3.cpp | 456 +----------------- .../test_regular_as_delaunay_3.cpp | 50 +- 6 files changed, 368 insertions(+), 560 deletions(-) diff --git a/Triangulation_3/test/Triangulation_3/CMakeLists.txt b/Triangulation_3/test/Triangulation_3/CMakeLists.txt index a820549bf20..7ef92e999fa 100644 --- a/Triangulation_3/test/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/test/Triangulation_3/CMakeLists.txt @@ -19,13 +19,12 @@ create_single_source_cgal_program("test_regular_as_delaunay_3.cpp") create_single_source_cgal_program("test_regular_insert_range_with_info.cpp") create_single_source_cgal_program("test_regular_remove_3.cpp") create_single_source_cgal_program("test_regular_traits_3.cpp") -create_single_source_cgal_program( - "test_RT_cell_base_with_weighted_circumcenter_3.cpp") +create_single_source_cgal_program("test_RT_cell_base_with_weighted_circumcenter_3.cpp") create_single_source_cgal_program("test_robust_weighted_circumcenter.cpp") create_single_source_cgal_program("test_simplex_3.cpp") -create_single_source_cgal_program( "test_simplex_iterator_3.cpp" ) -create_single_source_cgal_program( "test_segment_cell_traverser_3.cpp" ) -create_single_source_cgal_program( "test_segment_simplex_traverser_3.cpp" ) +create_single_source_cgal_program("test_simplex_iterator_3.cpp" ) +create_single_source_cgal_program("test_segment_cell_traverser_3.cpp" ) +create_single_source_cgal_program("test_segment_simplex_traverser_3.cpp" ) create_single_source_cgal_program("test_static_filters.cpp") create_single_source_cgal_program("test_triangulation_3.cpp") create_single_source_cgal_program("test_io_triangulation_3.cpp") diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h index 1a6f6d7e78a..f58c05d0bef 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h @@ -14,6 +14,19 @@ #ifndef CGAL_TEST_CLS_DELAUNAY_C #define CGAL_TEST_CLS_DELAUNAY_C +#include "_test_cls_iterator.h" +#include "_test_cls_circulator.h" +#include "_test_remove_cluster.h" + +#include +#include + +#include +#include + +#include +#include + #include #include #include @@ -21,18 +34,6 @@ #include #include -#include -#include - -#include "_test_cls_iterator.h" -#include "_test_cls_circulator.h" -#include "_test_remove_cluster.h" - -#include -#include -#include -#include - // Accessory set of functions to differentiate between // Delaunay::nearest_vertex[_in_cell] and // Regular::nearest_power_vertex[_in_cell]. @@ -93,22 +94,6 @@ nearest_vertex_in_cell(const T&t, const P&p, const typename T::Cell_handle c) return nearest_vertex_in_cell(t, p, c, typename T::Weighted_tag()); } -// Template meta programming if. -template < typename Cond, typename Then, typename Else > -struct If; - -template < typename Then, typename Else > -struct If -{ - typedef Then type; -}; - -template < typename Then, typename Else > -struct If -{ - typedef Else type; -}; - template < typename T, typename P > void test_conflicts(T& T3_13, const P *q) { @@ -221,6 +206,10 @@ _test_cls_delaunay_3(const Triangulation &) CGAL_USE_TYPE(Cell); CGAL_USE_TYPE(Vertex_iterator); CGAL_USE_TYPE(Cell_iterator); + + CGAL_USE_TYPE(typename Cls::Periodic_tag); + CGAL_USE_TYPE(typename Cls::Weighted_tag); + // +++ We define now some points for building triangulations +++++// // list of Points for T1_0 , T1_1, T1_2 : @@ -947,7 +936,7 @@ _test_cls_delaunay_3(const Triangulation &) Vertex_handle tmv1 = TM_0.insert(Point(0,0,0)); Vertex_handle tmv2 = TM_0.insert(Point(0,1,0)); - TM_0.move_if_no_collision(tmv1, Point(0, 2, 1)); + TM_0.move_if_no_collision(tmv1, Point(0, 2, 1)); assert(TM_0.tds().is_valid()); assert(TM_0.is_valid()); assert(TM_0.dimension() == 1); diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_regular_3.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_regular_3.h index ea40d75963e..798c40e2b5f 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_regular_3.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_regular_3.h @@ -10,49 +10,62 @@ // // Author(s) : Monique Teillaud (Monique.Teillaud@sophia.inria.fr) -// This stuff is not used (obsolete) at the moment. +#include + +#include #include #include #include #include -#include -#include template void _test_cls_regular_3(const Triangulation &) { - typedef Triangulation Cls; + typedef Triangulation Cls; - static_assert(std::is_nothrow_move_constructible::value, - "move cstr is missing"); - static_assert(std::is_nothrow_move_assignable::value, - "move assignment is missing"); + typedef typename Cls::Bare_point Point; + typedef typename Cls::Weighted_point Weighted_point; + + typedef typename Cls::Vertex_handle Vertex_handle; + typedef typename Cls::Cell_handle Cell_handle; + typedef typename Cls::Facet Facet; + typedef typename Cls::Edge Edge; + + typedef std::list list_point; + typedef typename Cls::Finite_cells_iterator Finite_cells_iterator; typedef typename Triangulation::Geom_traits Gt; CGAL_USE_TYPE(Gt); - // We assume the traits class has been tested already - // actually, any traits is good if it has been tested + CGAL_USE_TYPE(typename Cls::Periodic_tag); + CGAL_USE_TYPE(typename Cls::Weighted_tag); - typedef typename Cls::Bare_point Bare_point; - typedef typename Cls::Weighted_point Weighted_point; + int n, m; + int count = 0; - typedef std::list list_point; - - // temporary version - - int n,m; - int count = 0 ; + // For dimension 0, we need to check that the point of highest weight is the + // one that finally ends up in the vertex. + std::cout << " test dimension 0 " << std::endl; + Cls T0; + T0.insert(Weighted_point( Point (0,0,0), 0) ); + T0.insert(Weighted_point( Point (0,0,0), 1) ); + T0.insert(Weighted_point( Point (0,0,0), -1) ); + assert(T0.dimension() == 0); + assert(T0.number_of_vertices() == 1); + assert(T0.finite_vertices_begin()->point().weight() == 1); std::cout << " test dimension 1 " << std::endl; Cls T1; std::cout << " number of inserted points : " ; + Weighted_point p[5]; for ( m=0; m<5; m++) { if ( (m%2)== 0 ) - T1.insert( Weighted_point( Bare_point( 2*m,0,0 ), 2 ) ); - else T1.insert( Weighted_point( Bare_point( -2*m+1,0,0 ), 2 ) ); + p[m] = Weighted_point( Point( 2*m,0,0 ), 2 ); + else + p[m] = Weighted_point( Point( -2*m+1,0,0 ), 2 ); + T1.insert( p[m] ); count++; if (count <10) std::cout << count << '\b' ; @@ -65,47 +78,123 @@ _test_cls_regular_3(const Triangulation &) } assert( T1.is_valid() ); std::cout << std::endl << " number of vertices : " - << T1.number_of_vertices() << std::endl; + << T1.number_of_vertices() << std::endl; std::cout << " number of inserted points : " ; + Weighted_point q[5]; for ( m=0; m<5; m++) { if ( (m%2)== 0 ) - T1.insert( Weighted_point( Bare_point( 2*m+1,0,0 ), 5 ) ); - else T1.insert( Weighted_point( Bare_point( -2*m+1,0,0 ), 5 ) ); + q[m] = Weighted_point( Point( 2*m+1,0,0 ), 5 ); + else + q[m] = Weighted_point( Point( -2*m+1,0,0 ), 5 ); + T1.insert( q[m] ); count++; if (count <10) std::cout << count << '\b' ; else if (count < 100) - std::cout << count << '\b' << '\b' ; + std::cout << count << '\b' << '\b' ; else - std::cout << count << '\b' << '\b' << '\b' ; + std::cout << count << '\b' << '\b' << '\b' ; std::cout.flush(); } assert( T1.is_valid() ); std::cout << std::endl << " number of vertices : " - << T1.number_of_vertices() << std::endl; + << T1.number_of_vertices() << std::endl; std::cout << " number of inserted points : " ; + Weighted_point r[10]; for ( m=0; m<10; m++) { if ( (m%2)== 0 ) - T1.insert( Weighted_point( Bare_point( m,0,0 ), 1 ) ); - else T1.insert( Weighted_point( Bare_point( -m,0,0 ), 1 ) ); + r[m] = Weighted_point( Point( m,0,0 ), 1 ); + else + r[m] = Weighted_point( Point( -m,0,0 ), 1 ); + T1.insert( r[m] ); count++; if (count <10) std::cout << count << '\b' ; else if (count < 100) - std::cout << count << '\b' << '\b' ; + std::cout << count << '\b' << '\b' ; else - std::cout << count << '\b' << '\b' << '\b' ; + std::cout << count << '\b' << '\b' << '\b' ; std::cout.flush(); } assert( T1.is_valid() ); std::cout << std::endl << " number of vertices : " - << T1.number_of_vertices() << std::endl; + << T1.number_of_vertices() << std::endl; assert( T1.dimension()==1 ); + // The following is distilled from a bug report by Wulue Zhao + // (zhao.88@osu.edu), a student of Tamal Dey. + Point pt0(0,0,0); + Point pt1( 1,0,0), pt2(2,0,0), pt3(3,0,0); + Point pt4(-1,0,0), pt5(-2,0,0), pt6(-3,0,0); + + Weighted_point wp0(pt0,10.0); + Weighted_point wp1(pt1,0.0), wp2(pt2,0.0), wp3(pt3,0.0); + Weighted_point wp4(pt4,0.0), wp5(pt5,0.0), wp6(pt6,0.0); + + Cls T11; + + T11.insert(wp0); + T11.insert(wp1); + T11.insert(wp2); + T11.insert(wp3); + T11.insert(wp4); + T11.insert(wp5); + T11.insert(wp6); + + assert(T11.is_valid()); + + // And another distilled bug report from the same guy. + { + Point p1(-0.07, 0.04, 0.04); + Point p2(0.09, 0.04, 0.04); + Point p3(0.09, -0.05, 0.04); + Point p4(0.05, -0.05, 0.04); + Point p5(0.05, 0.0, 0.04); + Point p6(-0.07, 0.0, 0.04); + Point p7(-0.07, 0.04, -0.04); + Point p8(0.09, 0.04, -0.04); + Point p9(0.09, -0.05, -0.04); + Point p10(0.05, -0.05, -0.04); + Point p11(0.05, 0.0, -0.04); + Point p12(-0.07, 0.0, -0.04); + + Weighted_point wp1(p1,0); + Weighted_point wp2(p2,0); + Weighted_point wp3(p3,0); + Weighted_point wp4(p4,0); + Weighted_point wp5(p5,0); + Weighted_point wp6(p6,0); + Weighted_point wp7(p7,0); + Weighted_point wp8(p8,0); + Weighted_point wp9(p9,0); + Weighted_point wp10(p10,0); + Weighted_point wp11(p11,0); + Weighted_point wp12(p12,0); + Weighted_point wp13(p3,0.3); // wp13 has the same coordinates with wp3 + + Cls T111; + + T111.insert(wp1); + T111.insert(wp2); + T111.insert(wp3); + T111.insert(wp13); // it doesnot work inserting wp13 here + T111.insert(wp4); + T111.insert(wp5); + T111.insert(wp6); + T111.insert(wp7); + T111.insert(wp8); + T111.insert(wp9); + T111.insert(wp10); + T111.insert(wp11); + T111.insert(wp12); + + assert(T111.is_valid()); + } + std::cout << " test dimension 2 " << std::endl; std::cout << " number of inserted points : " ; Cls T2; @@ -113,61 +202,66 @@ _test_cls_regular_3(const Triangulation &) count = 0 ; int px=1, py=1; int qx=-1, qy=2; + Weighted_point s[400]; for (m=0; m<10; m++) for (n=0; n<10; n++) { - T2.insert( Weighted_point( Bare_point(m*px+n*qx, m*py+n*qy, 0), 1 ) ); + s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), 1 ); + T2.insert( s[m+20*n] ); count++; if (count <10) - std::cout << count << '\b' ; + std::cout << count << '\b' ; else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; + if (count < 100) + std::cout << count << '\b' << '\b' ; + else + std::cout << count << '\b' << '\b' << '\b' ; std::cout.flush(); } for (m=10; m<20; m++) for (n=0; n<10; n++) { - T2.insert( Weighted_point( Bare_point(m*px+n*qx, m*py+n*qy, 0), -1 ) ); + s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), -1 ); + T2.insert( s[m+20*n] ); count++; if (count <10) - std::cout << count << '\b' ; + std::cout << count << '\b' ; else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; + if (count < 100) + std::cout << count << '\b' << '\b' ; + else + std::cout << count << '\b' << '\b' << '\b' ; std::cout.flush(); } for (m=0; m<10; m++) for (n=10; n<20; n++) { - T2.insert( Weighted_point( Bare_point(m*px+n*qx, m*py+n*qy, 0), -2 ) ); + s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), -2 ); + T2.insert( s[m+20*n] ); count++; if (count <10) - std::cout << count << '\b' ; + std::cout << count << '\b' ; else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; + if (count < 100) + std::cout << count << '\b' << '\b' ; + else + std::cout << count << '\b' << '\b' << '\b' ; std::cout.flush(); } for (m=10; m<20; m++) for (n=10; n<20; n++) { - T2.insert( Weighted_point( Bare_point(m*px+n*qx, m*py+n*qy, 0), 5 ) ); + s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), 5 ); + T2.insert( s[m+20*n] ); count++; if (count <10) - std::cout << count << '\b' ; + std::cout << count << '\b' ; else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; + if (count < 100) + std::cout << count << '\b' << '\b' ; + else + std::cout << count << '\b' << '\b' << '\b' ; std::cout.flush(); } std::cout << std::endl << " number of vertices : " - << T2.number_of_vertices() << std::endl; + << T2.number_of_vertices() << std::endl; assert( T2.dimension()==2 ); assert( T2.is_valid() ); @@ -178,16 +272,18 @@ _test_cls_regular_3(const Triangulation &) list_point lp; int a, b, d; for (a=0;a!=10;a++) - for (b=0;b!=10;b++) - for (d=0;d!=10;d++) - lp.push_back(Weighted_point( Bare_point(a*b-d*a + (a-b)*10 +a , - a-b+d +5*b, - a*a-d*d+b), - a*b-a*d) ); + // for (b=0;b!=10;b++) + for (b=0;b!=5;b++) + // for (d=0;d!=10;d++) + for (d=0;d!=5;d++) + lp.push_back(Weighted_point( Point(a*b-d*a + (a-b)*10 +a , + a-b+d +5*b, + a*a-d*d+b), + a*b-a*d) ); typename list_point::iterator it; count = 0 ; std::cout << " number of inserted points : " ; - for (it=lp.begin(); it!=lp.end();it++){ + for (it=lp.begin(); it!=lp.end(); ++it){ count++; T.insert(*it); if (count <10) @@ -199,15 +295,136 @@ _test_cls_regular_3(const Triangulation &) if (count < 1000) std::cout << count << '\b' << '\b' << '\b' ; else - std::cout << count << std::endl; + std::cout << count << std::endl; std::cout.flush(); } + std::cout << std::endl; std::cout << " number of vertices : " - << T.number_of_vertices() << std::endl; + << T.number_of_vertices() << std::endl; assert(T.is_valid()); assert(T.dimension()==3); + T.clear(); + std::cout << " test iterator range insert" << std::endl; + T.insert (lp.begin(), lp.end()); + + std::cout << " number of vertices : " + << T.number_of_vertices() << std::endl; + assert(T.is_valid()); + assert(T.dimension()==3); + + + //test nearest_power_vertex + std::cout << " test nearest_power_vertex " << std::endl; + Point pp1(0.0, 0.0, 0.0); + Point pp2(1.0, 0.0, 0.0); + Point pp3(0.0, 1.0, 0.0); + Point pp4(0.0, 0.0, 1.0); + Point pp5(1.0, 1.0, 0.0); + Point pp6(0.0, 1.0, 1.0); + Point pp7(1.0, 0.0, 1.0); + Point pp8(1.0, 1.0, 1.0); + Point pp9(0.5, 0.5, 0.5); + + Weighted_point wpp1(pp1, 1.0); + Weighted_point wpp2(pp2, 2.0); + Weighted_point wpp3(pp3, 1.0); + Weighted_point wpp4(pp4, 4.0); + Weighted_point wpp5(pp5, 1.0); + Weighted_point wpp6(pp6, 1.0); + Weighted_point wpp7(pp7, 1.0); + Weighted_point wpp8(pp8, 8.0); + Weighted_point wpp9(pp9, -8.0); + + Cls T3; + + T3.insert(wpp1); + Vertex_handle v2 = T3.insert(wpp2); + assert( T3.nearest_power_vertex(Point(0.5,0.5,0.5)) == v2); + + T3.insert(wpp3); + Vertex_handle v4 = T3.insert(wpp4); + assert( T3.nearest_power_vertex(Point(0.5,0.5,0.5)) == v4); + + T3.insert(wpp5); + T3.insert(wpp6); + T3.insert(wpp7); + + Vertex_handle v8 = T3.insert(wpp8); + Point query(0.5,0.5,0.5); + assert(T3.nearest_power_vertex(query) == v8); + assert(T3.nearest_power_vertex_in_cell(query ,v8->cell()) == v8); + + Vertex_handle v9 = T3.insert(wpp9); + assert(v9 == Vertex_handle()); // hidden point + + // test dual + std::cout << " test dual member functions" << std::endl; + Finite_cells_iterator fcit = T3.finite_cells_begin(); + for( ; fcit != T3.finite_cells_end(); ++fcit) { + Point cc = T3.dual(fcit); + Vertex_handle ncc = T3.nearest_power_vertex(cc); + assert(fcit->has_vertex(ncc)); + } + + // test Gabriel + std::cout << " test is_Gabriel " << std::endl; + Point q0(0.,0.,0.); + Point q1(2.,0.,0.); + Point q2(0.,2.,0.); + Point q3(0.,0.,2.); + + Weighted_point wq0(q0,0.); + Weighted_point wq1(q1,0.); + Weighted_point wq2(q2,0.); + Weighted_point wq3(q3,0.); + Weighted_point wq01(q0,2.); + + Cls T4; + Vertex_handle v0 = T4.insert(wq0); + Vertex_handle v1 = T4.insert(wq1); + v2 = T4.insert(wq2); + Vertex_handle v3 = T4.insert(wq3); + Cell_handle c; + int i,j,k,l; + assert(T4.is_facet(v0,v1,v2,c,j,k,l)); + i = 6 - (j+k+l); + Facet f = std::make_pair(c,i); + assert(T4.is_Gabriel(c,i)); + assert(T4.is_Gabriel(f)); + assert(T4.is_facet(v1,v2,v3,c,j,k,l)); + i = 6 - (j+k+l); + assert(!T4.is_Gabriel(c,i)); + assert(T4.is_edge(v0,v1,c,i,j)); + assert(T4.is_Gabriel(c,i,j)); + Edge e = make_triple(c,i,j); + assert(T4.is_Gabriel(e)); + assert(T4.is_edge(v2,v3,c,i,j)); + assert(T4.is_Gabriel(c,i,j)); + + Vertex_handle v01 = T4.insert(wq01); + (void) v01; // kill warning + assert(T4.is_edge(v2,v3,c,i,j)); + assert(!T4.is_Gabriel(c,i,j)); + + Weighted_point wwq0(q0,0.); + Weighted_point wwq1(q1,0.); + Weighted_point wwq2(q2,0.); + Weighted_point wwq3(q3,5.); + Cls T5; + v0 = T5.insert(wwq0); + v1 = T5.insert(wwq1); + v2 = T5.insert(wwq2); + v3 = T5.insert(wwq3); + assert(T5.nearest_power_vertex(v3->point().point()) == v3); + assert(T5.nearest_power_vertex(v0->point().point()) == v3); + assert(T5.is_Gabriel(v3)); + assert(!T5.is_Gabriel(v0)); + + static_assert(std::is_nothrow_move_constructible::value, "move cstr is missing"); + static_assert(std::is_nothrow_move_assignable::value, "move assignment is missing"); + namespace test_tr_23 = CGAL::Testsuite::Triangulation_23; test_tr_23::test_move_semantic(T); } diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_triangulation_3.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_triangulation_3.h index 9790692fd90..8d85533d589 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_triangulation_3.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_triangulation_3.h @@ -10,6 +10,14 @@ // // Author(s) : Francois Rebufat +#include "_test_cls_iterator.h" +#include "_test_cls_circulator.h" +#include +#include + +#include +#include + #include #include #include @@ -17,14 +25,6 @@ #include #include -#include "_test_cls_iterator.h" -#include "_test_cls_circulator.h" - -#include -#include -#include -#include - template bool check_all_are_finite(Triangulation* tr, const Container& cont) { @@ -120,6 +120,9 @@ _test_cls_triangulation_3(const Triangulation &) CGAL_USE_TYPE(Vertex_iterator); CGAL_USE_TYPE(Cell_iterator); + CGAL_USE_TYPE(typename Cls::Periodic_tag); + CGAL_USE_TYPE(typename Cls::Weighted_tag); + // +++ We define now some points for building triangulations +++++// // list of Points for T1_0 , T1_1, T1_2 : diff --git a/Triangulation_3/test/Triangulation_3/test_regular_3.cpp b/Triangulation_3/test/Triangulation_3/test_regular_3.cpp index 430a2dee4ed..b8a9d8170ad 100644 --- a/Triangulation_3/test/Triangulation_3/test_regular_3.cpp +++ b/Triangulation_3/test/Triangulation_3/test_regular_3.cpp @@ -1,455 +1,51 @@ -// Copyright (c) 1998 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Monique Teillaud (Monique.Teillaud@sophia.inria.fr) -// : Mariette Yvinec (Mariette.Yvinec@sophia.inria.fr) - #include -#include -#include -#include + +bool del = true; #include #include #include -bool del=true; - -typedef CGAL::Exact_predicates_inexact_constructions_kernel traits; +#include +#include +#include +typedef CGAL::Exact_predicates_inexact_constructions_kernel EPIC; // Explicit instantiation of the whole class : -template class CGAL::Regular_triangulation_3; +template class CGAL::Regular_triangulation_3; -template -void test_RT() +template +void test_kernel() { - typedef RT Cls; + using Cls = CGAL::Regular_triangulation_3; - _test_cls_regular_3( Cls() ); - typedef typename RT::Bare_point Point; - typedef typename RT::Weighted_point Weighted_point; - - typedef typename Cls::Vertex_handle Vertex_handle; - typedef typename Cls::Cell_handle Cell_handle; - typedef typename Cls::Facet Facet; - typedef typename Cls::Edge Edge; - - typedef std::list list_point; - typedef typename Cls::Finite_cells_iterator Finite_cells_iterator; - - // temporary version - - int n, m; - int count = 0; - - // For dimension 0, we need to check that the point of highest weight is the - // one that finally ends up in the vertex. - std::cout << " test dimension 0 " << std::endl; - Cls T0; - T0.insert(Weighted_point( Point (0,0,0), 0) ); - T0.insert(Weighted_point( Point (0,0,0), 1) ); - T0.insert(Weighted_point( Point (0,0,0), -1) ); - assert(T0.dimension() == 0); - assert(T0.number_of_vertices() == 1); - assert(T0.finite_vertices_begin()->point().weight() == 1); - - std::cout << " test dimension 1 " << std::endl; - Cls T1; - std::cout << " number of inserted points : " ; - Weighted_point p[5]; - for ( m=0; m<5; m++) { - if ( (m%2)== 0 ) - p[m] = Weighted_point( Point( 2*m,0,0 ), 2 ); - else - p[m] = Weighted_point( Point( -2*m+1,0,0 ), 2 ); - T1.insert( p[m] ); - count++; - if (count <10) - std::cout << count << '\b' ; - else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; - std::cout.flush(); - } - assert( T1.is_valid() ); - std::cout << std::endl << " number of vertices : " - << T1.number_of_vertices() << std::endl; - - std::cout << " number of inserted points : " ; - Weighted_point q[5]; - for ( m=0; m<5; m++) { - if ( (m%2)== 0 ) - q[m] = Weighted_point( Point( 2*m+1,0,0 ), 5 ); - else - q[m] = Weighted_point( Point( -2*m+1,0,0 ), 5 ); - T1.insert( q[m] ); - count++; - if (count <10) - std::cout << count << '\b' ; - else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; - std::cout.flush(); - } - assert( T1.is_valid() ); - std::cout << std::endl << " number of vertices : " - << T1.number_of_vertices() << std::endl; - - std::cout << " number of inserted points : " ; - Weighted_point r[10]; - for ( m=0; m<10; m++) { - if ( (m%2)== 0 ) - r[m] = Weighted_point( Point( m,0,0 ), 1 ); - else - r[m] = Weighted_point( Point( -m,0,0 ), 1 ); - T1.insert( r[m] ); - count++; - if (count <10) - std::cout << count << '\b' ; - else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; - std::cout.flush(); - } - assert( T1.is_valid() ); - std::cout << std::endl << " number of vertices : " - << T1.number_of_vertices() << std::endl; - assert( T1.dimension()==1 ); - - // The following is distilled from a bug report by Wulue Zhao - // (zhao.88@osu.edu), a student of Tamal Dey. - Point pt0(0,0,0); - Point pt1( 1,0,0), pt2(2,0,0), pt3(3,0,0); - Point pt4(-1,0,0), pt5(-2,0,0), pt6(-3,0,0); - - Weighted_point wp0(pt0,10.0); - Weighted_point wp1(pt1,0.0), wp2(pt2,0.0), wp3(pt3,0.0); - Weighted_point wp4(pt4,0.0), wp5(pt5,0.0), wp6(pt6,0.0); - - Cls T11; - - T11.insert(wp0); - T11.insert(wp1); - T11.insert(wp2); - T11.insert(wp3); - T11.insert(wp4); - T11.insert(wp5); - T11.insert(wp6); - - assert(T11.is_valid()); - - // And another distilled bug report from the same guy. - { - Point p1(-0.07, 0.04, 0.04); - Point p2(0.09, 0.04, 0.04); - Point p3(0.09, -0.05, 0.04); - Point p4(0.05, -0.05, 0.04); - Point p5(0.05, 0.0, 0.04); - Point p6(-0.07, 0.0, 0.04); - Point p7(-0.07, 0.04, -0.04); - Point p8(0.09, 0.04, -0.04); - Point p9(0.09, -0.05, -0.04); - Point p10(0.05, -0.05, -0.04); - Point p11(0.05, 0.0, -0.04); - Point p12(-0.07, 0.0, -0.04); - - Weighted_point wp1(p1,0); - Weighted_point wp2(p2,0); - Weighted_point wp3(p3,0); - Weighted_point wp4(p4,0); - Weighted_point wp5(p5,0); - Weighted_point wp6(p6,0); - Weighted_point wp7(p7,0); - Weighted_point wp8(p8,0); - Weighted_point wp9(p9,0); - Weighted_point wp10(p10,0); - Weighted_point wp11(p11,0); - Weighted_point wp12(p12,0); - Weighted_point wp13(p3,0.3); // wp13 has the same coordinates with wp3 - - Cls T111; - - T111.insert(wp1); - T111.insert(wp2); - T111.insert(wp3); - T111.insert(wp13); // it doesnot work inserting wp13 here - T111.insert(wp4); - T111.insert(wp5); - T111.insert(wp6); - T111.insert(wp7); - T111.insert(wp8); - T111.insert(wp9); - T111.insert(wp10); - T111.insert(wp11); - T111.insert(wp12); - - assert(T111.is_valid()); - } - - std::cout << " test dimension 2 " << std::endl; - std::cout << " number of inserted points : " ; - Cls T2; - - count = 0 ; - int px=1, py=1; - int qx=-1, qy=2; - Weighted_point s[400]; - for (m=0; m<10; m++) - for (n=0; n<10; n++) { - s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), 1 ); - T2.insert( s[m+20*n] ); - count++; - if (count <10) - std::cout << count << '\b' ; - else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; - std::cout.flush(); - } - for (m=10; m<20; m++) - for (n=0; n<10; n++) { - s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), -1 ); - T2.insert( s[m+20*n] ); - count++; - if (count <10) - std::cout << count << '\b' ; - else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; - std::cout.flush(); - } - for (m=0; m<10; m++) - for (n=10; n<20; n++) { - s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), -2 ); - T2.insert( s[m+20*n] ); - count++; - if (count <10) - std::cout << count << '\b' ; - else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; - std::cout.flush(); - } - for (m=10; m<20; m++) - for (n=10; n<20; n++) { - s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), 5 ); - T2.insert( s[m+20*n] ); - count++; - if (count <10) - std::cout << count << '\b' ; - else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - std::cout << count << '\b' << '\b' << '\b' ; - std::cout.flush(); - } - - std::cout << std::endl << " number of vertices : " - << T2.number_of_vertices() << std::endl; - assert( T2.dimension()==2 ); - assert( T2.is_valid() ); - - // dimension 3 - std::cout << " test dimension 3" << std::endl; - Cls T; - - list_point lp; - int a, b, d; - for (a=0;a!=10;a++) - // for (b=0;b!=10;b++) - for (b=0;b!=5;b++) - // for (d=0;d!=10;d++) - for (d=0;d!=5;d++) - lp.push_back(Weighted_point( Point(a*b-d*a + (a-b)*10 +a , - a-b+d +5*b, - a*a-d*d+b), - a*b-a*d) ); - typename list_point::iterator it; - count = 0 ; - std::cout << " number of inserted points : " ; - for (it=lp.begin(); it!=lp.end(); ++it){ - count++; - T.insert(*it); - if (count <10) - std::cout << count << '\b' ; - else - if (count < 100) - std::cout << count << '\b' << '\b' ; - else - if (count < 1000) - std::cout << count << '\b' << '\b' << '\b' ; - else - std::cout << count << std::endl; - std::cout.flush(); - } - std::cout << std::endl; - - std::cout << " number of vertices : " - << T.number_of_vertices() << std::endl; - assert(T.is_valid()); - assert(T.dimension()==3); - - T.clear(); - std::cout << " test iterator range insert" << std::endl; - T.insert (lp.begin(), lp.end()); - - std::cout << " number of vertices : " - << T.number_of_vertices() << std::endl; - assert(T.is_valid()); - assert(T.dimension()==3); - - - //test nearest_power_vertex - std::cout << " test nearest_power_vertex " << std::endl; - Point pp1(0.0, 0.0, 0.0); - Point pp2(1.0, 0.0, 0.0); - Point pp3(0.0, 1.0, 0.0); - Point pp4(0.0, 0.0, 1.0); - Point pp5(1.0, 1.0, 0.0); - Point pp6(0.0, 1.0, 1.0); - Point pp7(1.0, 0.0, 1.0); - Point pp8(1.0, 1.0, 1.0); - Point pp9(0.5, 0.5, 0.5); - - Weighted_point wpp1(pp1, 1.0); - Weighted_point wpp2(pp2, 2.0); - Weighted_point wpp3(pp3, 1.0); - Weighted_point wpp4(pp4, 4.0); - Weighted_point wpp5(pp5, 1.0); - Weighted_point wpp6(pp6, 1.0); - Weighted_point wpp7(pp7, 1.0); - Weighted_point wpp8(pp8, 8.0); - Weighted_point wpp9(pp9, -8.0); - - Cls T3; - - T3.insert(wpp1); - Vertex_handle v2 = T3.insert(wpp2); - assert( T3.nearest_power_vertex(Point(0.5,0.5,0.5)) == v2); - - T3.insert(wpp3); - Vertex_handle v4 = T3.insert(wpp4); - assert( T3.nearest_power_vertex(Point(0.5,0.5,0.5)) == v4); - - T3.insert(wpp5); - T3.insert(wpp6); - T3.insert(wpp7); - - Vertex_handle v8 = T3.insert(wpp8); - Point query(0.5,0.5,0.5); - assert(T3.nearest_power_vertex(query) == v8); - assert(T3.nearest_power_vertex_in_cell(query ,v8->cell()) == v8); - - Vertex_handle v9 = T3.insert(wpp9); - assert(v9 == Vertex_handle()); // hidden point - - // test dual - std::cout << " test dual member functions" << std::endl; - Finite_cells_iterator fcit = T3.finite_cells_begin(); - for( ; fcit != T3.finite_cells_end(); ++fcit) { - Point cc = T3.dual(fcit); - Vertex_handle ncc = T3.nearest_power_vertex(cc); - assert(fcit->has_vertex(ncc)); - } - - // test Gabriel - std::cout << " test is_Gabriel " << std::endl; - Point q0(0.,0.,0.); - Point q1(2.,0.,0.); - Point q2(0.,2.,0.); - Point q3(0.,0.,2.); - - Weighted_point wq0(q0,0.); - Weighted_point wq1(q1,0.); - Weighted_point wq2(q2,0.); - Weighted_point wq3(q3,0.); - Weighted_point wq01(q0,2.); - - Cls T4; - Vertex_handle v0 = T4.insert(wq0); - Vertex_handle v1 = T4.insert(wq1); - v2 = T4.insert(wq2); - Vertex_handle v3 = T4.insert(wq3); - Cell_handle c; - int i,j,k,l; - assert(T4.is_facet(v0,v1,v2,c,j,k,l)); - i = 6 - (j+k+l); - Facet f = std::make_pair(c,i); - assert(T4.is_Gabriel(c,i)); - assert(T4.is_Gabriel(f)); - assert(T4.is_facet(v1,v2,v3,c,j,k,l)); - i = 6 - (j+k+l); - assert(!T4.is_Gabriel(c,i)); - assert(T4.is_edge(v0,v1,c,i,j)); - assert(T4.is_Gabriel(c,i,j)); - Edge e = make_triple(c,i,j); - assert(T4.is_Gabriel(e)); - assert(T4.is_edge(v2,v3,c,i,j)); - assert(T4.is_Gabriel(c,i,j)); - - Vertex_handle v01 = T4.insert(wq01); - (void) v01; // kill warning - assert(T4.is_edge(v2,v3,c,i,j)); - assert(!T4.is_Gabriel(c,i,j)); - - Weighted_point wwq0(q0,0.); - Weighted_point wwq1(q1,0.); - Weighted_point wwq2(q2,0.); - Weighted_point wwq3(q3,5.); - Cls T5; - v0 = T5.insert(wwq0); - v1 = T5.insert(wwq1); - v2 = T5.insert(wwq2); - v3 = T5.insert(wwq3); - assert(T5.nearest_power_vertex(v3->point().point()) == v3); - assert(T5.nearest_power_vertex(v0->point().point()) == v3); - assert(T5.is_Gabriel(v3)); - assert(!T5.is_Gabriel(v0)); -} - -int main() -{ - test_RT >(); + _test_cls_regular_3(Cls()); #ifdef CGAL_LINKED_WITH_TBB typedef CGAL::Spatial_lock_grid_3< CGAL::Tag_priority_blocking> Lock_ds; typedef CGAL::Triangulation_data_structure_3< - CGAL::Regular_triangulation_vertex_base_3, - CGAL::Regular_triangulation_cell_base_3, - CGAL::Parallel_tag > Tds_parallel; + CGAL::Regular_triangulation_vertex_base_3, + CGAL::Regular_triangulation_cell_base_3, + CGAL::Parallel_tag > Tds_parallel; typedef CGAL::Regular_triangulation_3< - traits, Tds_parallel, Lock_ds> RT_parallel; + K, Tds_parallel, Lock_ds> RT_parallel; // The following test won't do things in parallel since it doesn't provide a lock data structure - test_RT(); + _test_cls_regular_3(RT_parallel()); // This test performs parallel operations - _test_cls_parallel_triangulation_3( RT_parallel() ); + _test_cls_parallel_triangulation_3(RT_parallel()); #endif - - std::cout << " quit " << std::endl; - return 0; +} + +int main() +{ + test_kernel(); + test_kernel(); + + std::cout << "Done!" << std::endl; + return EXIT_SUCCESS; } diff --git a/Triangulation_3/test/Triangulation_3/test_regular_as_delaunay_3.cpp b/Triangulation_3/test/Triangulation_3/test_regular_as_delaunay_3.cpp index c607bae4119..b7ab0c7c7cb 100644 --- a/Triangulation_3/test/Triangulation_3/test_regular_as_delaunay_3.cpp +++ b/Triangulation_3/test/Triangulation_3/test_regular_as_delaunay_3.cpp @@ -1,33 +1,37 @@ -// Copyright (c) 2004 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Sylvain Pion - #include +bool del = true; -bool del=true; +#include +#include -#include "include/CGAL/_test_types.h" -#include "include/CGAL/_test_cls_delaunay_3.h" +template +void test_kernel() +{ + using Cls = CGAL::Regular_triangulation_3; + _test_cls_delaunay_3(Cls()); + +#ifdef CGAL_LINKED_WITH_TBB + typedef CGAL::Spatial_lock_grid_3< + CGAL::Tag_priority_blocking> Lock_ds; + typedef CGAL::Triangulation_data_structure_3< + CGAL::Regular_triangulation_vertex_base_3, + CGAL::Regular_triangulation_cell_base_3, + CGAL::Parallel_tag > Tds_parallel; + typedef CGAL::Regular_triangulation_3< + K, Tds_parallel, Lock_ds> RT_parallel; + + // The following test won't do things in parallel since it doesn't provide a lock data structure + _test_cls_delaunay_3(RT_parallel()); +#endif +} int main() { - typedef CGAL::Regular_triangulation_3 Cls; + test_kernel(); + test_kernel(); - _test_cls_delaunay_3( Cls() ); - - return 0; + std::cout << "Done!" << std::endl; + return EXIT_SUCCESS; } - -// MipsPro prefers this after the other instantiations... -// Explicit instantiation of the whole class : -template class CGAL::Regular_triangulation_3;