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 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 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));