diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 463ef501b34..95d79065451 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -108,11 +108,26 @@ templateinline std::enable_if_t::value||std::is_e templateinline std::enable_if_t::value||std::is_enum::value, T> exact (T d){return d;} templateinline std::enable_if_t::value||std::is_enum::value, int> depth(T){return -1;} +templateinline std::enable_if_t::value, Quotient> approx(Quotient d){return d;} +templateinline std::enable_if_t::value, Quotient> exact (Quotient d){return d;} +templateinline std::enable_if_t::value, int> depth(Quotient){return -1;} + // For tag classes: Return_base_tag, Homogeneous_tag, Null_vector, Origin templateinline std::enable_if_t::value, T> exact(T){return {};} templateinline std::enable_if_t::value, T> approx(T){return {};} templateinline std::enable_if_t::value, int> depth(T){return -1;} +namespace internal{ +template +struct Evaluate> +{ + void operator()(const Lazy& l) + { + exact(l); + } +}; +} // internal namespace + // For an iterator, exact/approx applies to the objects it points to template ::value>> auto exact(T const& t) {return make_transforming_iterator(t,[](auto const&u)->decltype(auto){return CGAL::exact(u);});} 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 64c1782bb9c..46441d6f8e2 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 @@ -25,6 +25,8 @@ #include #include #include +#include + #ifdef CGAL_EIGEN3_ENABLED #include #endif diff --git a/Heat_method_3/package_info/Heat_method_3/dependencies b/Heat_method_3/package_info/Heat_method_3/dependencies index 50488d5544f..f69807f53d7 100644 --- a/Heat_method_3/package_info/Heat_method_3/dependencies +++ b/Heat_method_3/package_info/Heat_method_3/dependencies @@ -4,7 +4,6 @@ Cartesian_kernel Circulator Distance_2 Distance_3 -Filtered_kernel Heat_method_3 Installation Interval_support diff --git a/Number_types/include/CGAL/utils_classes.h b/Number_types/include/CGAL/utils_classes.h index 06a569a6d8b..1b4eb95ce89 100644 --- a/Number_types/include/CGAL/utils_classes.h +++ b/Number_types/include/CGAL/utils_classes.h @@ -266,6 +266,17 @@ class Is_valid }; }; +namespace internal +{ +// utility class to be used for calling exact(Lazy) when doing accumulation with EPECK +template +struct Evaluate +{ + void operator()(const NT&) + {} +}; +} // internal namespace + } //namespace CGAL #endif // CGAL_UTILS_CLASSES_H diff --git a/Polygon/include/CGAL/Polygon_2_algorithms.h b/Polygon/include/CGAL/Polygon_2_algorithms.h index 5c836466c11..40b1e06a9c7 100644 --- a/Polygon/include/CGAL/Polygon_2_algorithms.h +++ b/Polygon/include/CGAL/Polygon_2_algorithms.h @@ -25,6 +25,7 @@ #include #include #include +#include /// namespace CGAL { @@ -142,6 +143,7 @@ area_2( ForwardIterator first, ForwardIterator last, const PolygonTraits& traits) { typedef typename PolygonTraits::FT FT; + internal::Evaluate evaluate; result = FT(0); // check if the polygon is empty if (first == last) return; @@ -153,6 +155,7 @@ area_2( ForwardIterator first, ForwardIterator last, ForwardIterator third = second; while (++third != last) { result = result + compute_area_2(*first, *second, *third); + evaluate(result); second = third; } } @@ -179,6 +182,7 @@ polygon_area_2( ForwardIterator first, ForwardIterator last, const PolygonTraits& traits) { typedef typename PolygonTraits::FT FT; + internal::Evaluate evaluate; FT result = FT(0); // check if the polygon is empty if (first == last) return result; @@ -190,6 +194,7 @@ polygon_area_2( ForwardIterator first, ForwardIterator last, ForwardIterator third = second; while (++third != last) { result = result + compute_area_2(*first, *second, *third); + evaluate(result); second = third; } return result; 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 a0841748aee..87946231227 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h @@ -23,9 +23,7 @@ #include #include #include - - -#include // needed for CGAL::exact(FT)/CGAL::exact(Lazy_exact_nt) +#include #include #include @@ -261,12 +259,14 @@ face_border_length(typename boost::graph_traits::halfedge_descripto const PolygonMesh& pmesh, const NamedParameters& np = parameters::default_values()) { - typename GetGeomTraits::type::FT result = 0; + using FT = typename GetGeomTraits::type::FT; + ::CGAL::internal::Evaluate evaluate; + FT result = 0; for(typename boost::graph_traits::halfedge_descriptor haf : halfedges_around_face(h, pmesh)) { result += edge_length(haf, pmesh, np); - exact(result); + evaluate(result); } return result; @@ -559,11 +559,14 @@ area(FaceRange face_range, { typedef typename boost::graph_traits::face_descriptor face_descriptor; - typename GetGeomTraits::type::FT result = 0; + using FT = typename GetGeomTraits::type::FT; + FT result = 0; + ::CGAL::internal::Evaluate evaluate; + for(face_descriptor f : face_range) { result += face_area(f, tmesh, np); - exact(result); + evaluate(result); } return result; @@ -676,7 +679,10 @@ volume(const TriangleMesh& tmesh, typedef typename boost::graph_traits::face_descriptor face_descriptor; - typename GetGeomTraits::type::FT volume = 0; + using FT = typename GetGeomTraits::type::FT; + ::CGAL::internal::Evaluate evaluate; + + FT volume = 0; typename CGAL::Kernel_traits::type>::Kernel::Compute_volume_3 cv3; @@ -686,7 +692,7 @@ volume(const TriangleMesh& tmesh, get(vpm, target(halfedge(f, tmesh), tmesh)), get(vpm, target(next(halfedge(f, tmesh), tmesh), tmesh)), get(vpm, target(prev(halfedge(f, tmesh), tmesh), tmesh))); - exact(volume); + evaluate(volume); } return volume;