From 6aaa37f3efdf8d9ed8b401f4939154a392b28796 Mon Sep 17 00:00:00 2001 From: Sven Oesau Date: Thu, 26 Jun 2025 16:26:12 +0200 Subject: [PATCH 01/12] defaulting to Convex_hull_traits_3 instead of Kernel_traits::type --- Convex_hull_3/include/CGAL/convex_hull_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Convex_hull_3/include/CGAL/convex_hull_3.h b/Convex_hull_3/include/CGAL/convex_hull_3.h index 50e4a08627c..9f37e70fffe 100644 --- a/Convex_hull_3/include/CGAL/convex_hull_3.h +++ b/Convex_hull_3/include/CGAL/convex_hull_3.h @@ -1092,7 +1092,7 @@ void convex_hull_3(InputIterator first, InputIterator beyond, std::enable_if_t::value>* = 0) { typedef typename std::iterator_traits::value_type Point_3; - typedef typename Kernel_traits::type Traits; + typedef Convex_hull_traits_3::type> Traits; Convex_hull_3::internal::Indexed_triangle_set its(vertices,faces); convex_hull_3(first, beyond, its, Traits()); From 327de417bb295f84bfca809490878446d0d73394 Mon Sep 17 00:00:00 2001 From: Sven Oesau Date: Thu, 26 Jun 2025 16:44:27 +0200 Subject: [PATCH 02/12] Update convex_hull_3.h fix Default_traits_for_Chull_3 --- Convex_hull_3/include/CGAL/convex_hull_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Convex_hull_3/include/CGAL/convex_hull_3.h b/Convex_hull_3/include/CGAL/convex_hull_3.h index 9f37e70fffe..344c5b44ae6 100644 --- a/Convex_hull_3/include/CGAL/convex_hull_3.h +++ b/Convex_hull_3/include/CGAL/convex_hull_3.h @@ -154,7 +154,7 @@ template< class Point_3, class Is_floating_point=typename std::is_floating_point::Kernel::FT>::type, class Has_filtered_predicates_tag=typename Kernel_traits::Kernel::Has_filtered_predicates_tag > struct Default_traits_for_Chull_3{ - typedef typename Kernel_traits::Kernel type; + typedef Convex_hull_traits_3< typename Kernel_traits::Kernel > type; }; //FT is a floating point type and Kernel is a filtered kernel From 47815db05e765679dcf55ba814c5bb8580f39d12 Mon Sep 17 00:00:00 2001 From: Sven Oesau Date: Fri, 27 Jun 2025 10:53:02 +0200 Subject: [PATCH 03/12] added test --- .../test/Convex_hull_3/issue_8594.cpp | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Convex_hull_3/test/Convex_hull_3/issue_8594.cpp diff --git a/Convex_hull_3/test/Convex_hull_3/issue_8594.cpp b/Convex_hull_3/test/Convex_hull_3/issue_8594.cpp new file mode 100644 index 00000000000..b6f114023f5 --- /dev/null +++ b/Convex_hull_3/test/Convex_hull_3/issue_8594.cpp @@ -0,0 +1,41 @@ +#include +#include + +#include +#include +#include + + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef K::Point_3 Point_3; + + +int main(int argc, char* argv[]) { + std::vector points = { +{-7.71169150943396353 ,-19.809308490566039, 10.0950745283018861}, +{-7.90879905660377602, -19.809308490566039, 9.8979669811320754}, +{-7.71169150943396353, -19.6122009433962283, 9.8979669811320754}, +{-7.90879905660377602, -19.6122009433962283, 9.8979669811320754}, +{-7.71169150943396353, -19.4150933962264141, 10.0950745283018861}, +{-7.90879905660377602, -19.809308490566039, 10.0950745283018861}, +{-7.71169150943396353, -19.6122009433962283, 10.2921820754716968}, +{-7.90879905660377602, -19.6122009433962283, 10.0950745283018861}, +{-7.71169150943396353, -19.6122009433962283, 10.0950745283018861}, +{-7.71169150943396353, -19.809308490566039, 9.8979669811320754}, +{-7.90879905660377602, -19.4150933962264141, 9.8979669811320754}, +{-7.90879905660377602, -19.4150933962264141, 10.0950745283018861}, +{-7.71169150943396353, -19.4150933962264141, 9.8979669811320754}, +{-7.90879905660377602, -19.6122009433962283, 10.2921820754716968}, +{-7.90879905660377602, -19.4150933962264141, 10.2921820754716968}, +{-7.71169150943396353, -19.4150933962264141, 10.2921820754716968} }; + + std::vector vertices; + std::vector > faces; + + CGAL::convex_hull_3(points.begin(), points.end(), vertices, faces); + + assert(vertices.size() == 10); + assert(faces.size() == 16); + + return 0; +} From 4b7df57bce49168dd137ad1b790387dc78fbc47f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 4 Jul 2025 16:09:26 +0200 Subject: [PATCH 04/12] rename test --- .../test/Convex_hull_3/{issue_8594.cpp => issue_8954.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Convex_hull_3/test/Convex_hull_3/{issue_8594.cpp => issue_8954.cpp} (100%) diff --git a/Convex_hull_3/test/Convex_hull_3/issue_8594.cpp b/Convex_hull_3/test/Convex_hull_3/issue_8954.cpp similarity index 100% rename from Convex_hull_3/test/Convex_hull_3/issue_8594.cpp rename to Convex_hull_3/test/Convex_hull_3/issue_8954.cpp From 6fb75112dd6bdfd94ed7d3186c827f45110394a1 Mon Sep 17 00:00:00 2001 From: Sven Oesau Date: Wed, 9 Jul 2025 16:08:50 +0200 Subject: [PATCH 05/12] changing Default_traits_for_Chull_3 check --- .../test/Convex_hull_3/quick_hull_default_traits.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp b/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp index 269c14995bc..dfd8677ca08 100644 --- a/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp +++ b/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp @@ -23,11 +23,11 @@ using namespace CGAL::Convex_hull_3::internal; int main() { - static_assert(std::is_same::type>::value); - static_assert(std::is_same::type>::value); - static_assert(std::is_same::type>::value); - static_assert(std::is_same::type>::value); - static_assert(std::is_same::type>::value); + static_assert(std::is_same,Default_traits_for_Chull_3::type>::value); + static_assert(std::is_same,Default_traits_for_Chull_3::type>::value); + static_assert(std::is_same,Default_traits_for_Chull_3::type>::value); + static_assert(std::is_same,Default_traits_for_Chull_3::type>::value); + static_assert(std::is_same,Default_traits_for_Chull_3::type>::value); static_assert(std::is_same,Default_traits_for_Chull_3::type>::value); static_assert(std::is_same, std::true_type >::Protector,CGAL::Protect_FPU_rounding >::value); return 0; From 6517c7f48ad5ca9efff30f19d08c0c69a9909c66 Mon Sep 17 00:00:00 2001 From: Sven Oesau Date: Thu, 10 Jul 2025 09:06:49 +0200 Subject: [PATCH 06/12] fix warning --- Convex_hull_3/test/Convex_hull_3/issue_8954.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Convex_hull_3/test/Convex_hull_3/issue_8954.cpp b/Convex_hull_3/test/Convex_hull_3/issue_8954.cpp index b6f114023f5..7b68f3f2dad 100644 --- a/Convex_hull_3/test/Convex_hull_3/issue_8954.cpp +++ b/Convex_hull_3/test/Convex_hull_3/issue_8954.cpp @@ -10,7 +10,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef K::Point_3 Point_3; -int main(int argc, char* argv[]) { +int main() { std::vector points = { {-7.71169150943396353 ,-19.809308490566039, 10.0950745283018861}, {-7.90879905660377602, -19.809308490566039, 9.8979669811320754}, From e668cb9ae615d4c8c82fdfd257a5efb0adc15e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 4 Aug 2025 09:33:03 +0200 Subject: [PATCH 07/12] restore logic and use traits helper in the free function --- Convex_hull_3/include/CGAL/convex_hull_3.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Convex_hull_3/include/CGAL/convex_hull_3.h b/Convex_hull_3/include/CGAL/convex_hull_3.h index 344c5b44ae6..60c568a2683 100644 --- a/Convex_hull_3/include/CGAL/convex_hull_3.h +++ b/Convex_hull_3/include/CGAL/convex_hull_3.h @@ -154,7 +154,7 @@ template< class Point_3, class Is_floating_point=typename std::is_floating_point::Kernel::FT>::type, class Has_filtered_predicates_tag=typename Kernel_traits::Kernel::Has_filtered_predicates_tag > struct Default_traits_for_Chull_3{ - typedef Convex_hull_traits_3< typename Kernel_traits::Kernel > type; + typedef typename Kernel_traits::Kernel type; }; //FT is a floating point type and Kernel is a filtered kernel @@ -1092,7 +1092,7 @@ void convex_hull_3(InputIterator first, InputIterator beyond, std::enable_if_t::value>* = 0) { typedef typename std::iterator_traits::value_type Point_3; - typedef Convex_hull_traits_3::type> Traits; + typedef typename Convex_hull_3::internal::Default_traits_for_Chull_3::type Traits; Convex_hull_3::internal::Indexed_triangle_set its(vertices,faces); convex_hull_3(first, beyond, its, Traits()); From a9923e9e02461b754ff852fec022c6f26ac25d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 4 Aug 2025 09:41:42 +0200 Subject: [PATCH 08/12] restore test --- .../test/Convex_hull_3/quick_hull_default_traits.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp b/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp index dfd8677ca08..269c14995bc 100644 --- a/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp +++ b/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp @@ -23,11 +23,11 @@ using namespace CGAL::Convex_hull_3::internal; int main() { - static_assert(std::is_same,Default_traits_for_Chull_3::type>::value); - static_assert(std::is_same,Default_traits_for_Chull_3::type>::value); - static_assert(std::is_same,Default_traits_for_Chull_3::type>::value); - static_assert(std::is_same,Default_traits_for_Chull_3::type>::value); - static_assert(std::is_same,Default_traits_for_Chull_3::type>::value); + static_assert(std::is_same::type>::value); + static_assert(std::is_same::type>::value); + static_assert(std::is_same::type>::value); + static_assert(std::is_same::type>::value); + static_assert(std::is_same::type>::value); static_assert(std::is_same,Default_traits_for_Chull_3::type>::value); static_assert(std::is_same, std::true_type >::Protector,CGAL::Protect_FPU_rounding >::value); return 0; From 9c56293e8b6b4e719f7591c2a2c4cd52f799c095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 5 Aug 2025 15:14:06 +0200 Subject: [PATCH 09/12] build targets only if Eigen is available --- .../examples/Basic_viewer/CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Basic_viewer/examples/Basic_viewer/CMakeLists.txt b/Basic_viewer/examples/Basic_viewer/CMakeLists.txt index 29c492e8864..14d1847d719 100644 --- a/Basic_viewer/examples/Basic_viewer/CMakeLists.txt +++ b/Basic_viewer/examples/Basic_viewer/CMakeLists.txt @@ -15,8 +15,6 @@ find_package(Eigen3 3.1.0) include(CGAL_Eigen3_support) create_single_source_cgal_program("draw_lcc.cpp") -create_single_source_cgal_program("draw_mesh_and_points.cpp") -create_single_source_cgal_program("draw_several_windows.cpp") create_single_source_cgal_program("draw_surface_mesh_height.cpp") create_single_source_cgal_program("draw_surface_mesh_small_faces.cpp") create_single_source_cgal_program("draw_surface_mesh_vcolor.cpp") @@ -24,18 +22,20 @@ create_single_source_cgal_program("draw_surface_mesh_vcolor.cpp") if(CGAL_Qt6_FOUND) #link it with the required CGAL libraries target_link_libraries(draw_lcc PUBLIC CGAL::CGAL_Basic_viewer) - target_link_libraries(draw_mesh_and_points PUBLIC CGAL::CGAL_Basic_viewer) - target_link_libraries(draw_several_windows PUBLIC CGAL::CGAL_Basic_viewer) target_link_libraries(draw_surface_mesh_height PUBLIC CGAL::CGAL_Basic_viewer) target_link_libraries(draw_surface_mesh_small_faces PUBLIC CGAL::CGAL_Basic_viewer) target_link_libraries(draw_surface_mesh_vcolor PUBLIC CGAL::CGAL_Basic_viewer) + if(TARGET CGAL::Eigen3_support) + create_single_source_cgal_program("draw_mesh_and_points.cpp") + create_single_source_cgal_program("draw_several_windows.cpp") + target_link_libraries(draw_mesh_and_points PUBLIC CGAL::Eigen3_support CGAL::CGAL_Basic_viewer) + target_link_libraries(draw_several_windows PUBLIC CGAL::Eigen3_support CGAL::CGAL_Basic_viewer) + else() + message("Eigen3 is not found, examples that require Eigen3 will not be compiled.") + endif() else() message("CGAL_Qt6 not configured: examples that require Qt will not be compiled.") endif() -if(TARGET CGAL::Eigen3_support) - target_link_libraries(draw_mesh_and_points PUBLIC CGAL::Eigen3_support) - target_link_libraries(draw_several_windows PUBLIC CGAL::Eigen3_support) -endif() #end of the file From b1f151e598425dd178f554304bb1b2f8b5e50b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 7 Aug 2025 18:19:02 +0200 Subject: [PATCH 10/12] use only one specialization using FT cannot get the specialization as an object inherits from Lazy --- Filtered_kernel/include/CGAL/Lazy.h | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 5d7b22ec37b..9b4041793c1 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -112,23 +112,19 @@ templateinline std::enable_if_t::value, int> depth(T){ namespace internal{ - template - struct Evaluate> +template +struct Evaluate> +{ + template + void operator()(const Lazy& l) { - void operator()(const Lazy& l) - { - exact(l); - } + exact(l); + } + void operator()(const Lazy_exact_nt& l) + { + exact(l); + } }; - - template - struct Evaluate> - { - void operator()(const Lazy_exact_nt& l) - { - exact(l); - } - }; } // internal namespace // For an iterator, exact/approx applies to the objects it points to From fdd7c17ec1217ec9d14ec1189d5a509176ef548e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 7 Aug 2025 18:20:20 +0200 Subject: [PATCH 11/12] avoid large dag in centroid --- .../include/CGAL/Polygon_mesh_processing/measure.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h index 42492891ef0..43ee6eb534f 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h @@ -893,6 +893,8 @@ centroid(const TriangleMesh& tmesh, Scale scale = k.construct_scaled_vector_3_object(); Sum sum = k.construct_sum_of_vectors_3_object(); + ::CGAL::internal::Evaluate evaluate; + for(face_descriptor fd : faces(tmesh)) { const Point_3_ref p = get(vpm, target(halfedge(fd, tmesh), tmesh)); @@ -903,6 +905,7 @@ centroid(const TriangleMesh& tmesh, vr = vector(ORIGIN, r); Vector_3 n = normal(p, q, r); volume += (scalar_product(n,vp))/FT(6); + evaluate(volume); n = scale(n, FT(1)/FT(24)); Vector_3 v2 = sum(vp, vq); @@ -913,6 +916,7 @@ centroid(const TriangleMesh& tmesh, v3 = sum(v3, Vector_3(square(v2.x()), square(v2.y()), square(v2.z()))); centroid = sum(centroid, Vector_3(n.x() * v3.x(), n.y() * v3.y(), n.z() * v3.z())); + evaluate(centroid); } centroid = scale(centroid, FT(1)/(FT(2)*volume)); From 29e6836e9c9e6df9796b77e3672743f3f5a1f561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 7 Aug 2025 18:44:34 +0200 Subject: [PATCH 12/12] we need to support all types of objects --- Number_types/include/CGAL/utils_classes.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Number_types/include/CGAL/utils_classes.h b/Number_types/include/CGAL/utils_classes.h index 1b4eb95ce89..f7052a8c59a 100644 --- a/Number_types/include/CGAL/utils_classes.h +++ b/Number_types/include/CGAL/utils_classes.h @@ -272,7 +272,8 @@ namespace internal template struct Evaluate { - void operator()(const NT&) + template + void operator()(const T&) {} }; } // internal namespace