diff --git a/Basic_viewer/examples/Basic_viewer/CMakeLists.txt b/Basic_viewer/examples/Basic_viewer/CMakeLists.txt index 4106c9defb4..e6aa5faba8a 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,19 @@ 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 PRIVATE CGAL::CGAL_Basic_viewer) - target_link_libraries(draw_mesh_and_points PRIVATE CGAL::CGAL_Basic_viewer) - target_link_libraries(draw_several_windows PRIVATE CGAL::CGAL_Basic_viewer) target_link_libraries(draw_surface_mesh_height PRIVATE CGAL::CGAL_Basic_viewer) target_link_libraries(draw_surface_mesh_small_faces PRIVATE CGAL::CGAL_Basic_viewer) target_link_libraries(draw_surface_mesh_vcolor PRIVATE 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 PRIVATE CGAL::Eigen3_support CGAL::CGAL_Basic_viewer) + target_link_libraries(draw_several_windows PRIVATE 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 PRIVATE CGAL::Eigen3_support) - target_link_libraries(draw_several_windows PRIVATE CGAL::Eigen3_support) -endif() - #end of the file diff --git a/Convex_hull_3/include/CGAL/convex_hull_3.h b/Convex_hull_3/include/CGAL/convex_hull_3.h index 239d83f9134..38053786f0e 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 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()); diff --git a/Convex_hull_3/test/Convex_hull_3/issue_8954.cpp b/Convex_hull_3/test/Convex_hull_3/issue_8954.cpp new file mode 100644 index 00000000000..7b68f3f2dad --- /dev/null +++ b/Convex_hull_3/test/Convex_hull_3/issue_8954.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() { + 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; +} diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index f62e70e6dc0..fc6d8d4c60c 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -119,23 +119,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 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 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 fd1ad888f5a..d9de6b43ffd 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h @@ -912,6 +912,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)); @@ -922,6 +924,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); @@ -932,6 +935,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));