From 5a2c3559da581136edb7facf5578bd1443080ef3 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 7 Nov 2019 17:02:38 +0100 Subject: Code review: Add suggested code using NT_converter to simplify the different alpha_complex_filtration computations cases --- src/Alpha_complex/include/gudhi/Alpha_complex.h | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex.h b/src/Alpha_complex/include/gudhi/Alpha_complex.h index 9aa30383..b3d1e6ea 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex.h @@ -25,6 +25,7 @@ #include #include // for CGAL::Identity_property_map #include // for CGAL_VERSION_NR +#include #include // for EIGEN_VERSION_AT_LEAST @@ -340,17 +341,12 @@ class Alpha_complex { // squared_radius function initialization Squared_Radius squared_radius = kernel_.compute_squared_radius_d_object(); -#if CGAL_VERSION_NR < 1050000000 - // With CGAL >= 4.11 and < 5.X, CGAL::exact do not work as it is always exact values - // This is why it is slow and 5.X is advised - alpha_complex_filtration = CGAL::to_double(squared_radius(pointVector.begin(), pointVector.end())); -#else // CGAL_VERSION_NR < 1050000000 - if (exact) { - alpha_complex_filtration = CGAL::to_double(CGAL::exact(squared_radius(pointVector.begin(), pointVector.end()))); - } else { - alpha_complex_filtration = CGAL::to_double(squared_radius(pointVector.begin(), pointVector.end())); - } -#endif //CGAL_VERSION_NR < 1050000000 + CGAL::NT_converter cv; + auto sqrad = squared_radius(pointVector.begin(), pointVector.end()); +#if CGAL_VERSION_NR >= 1050000000 + if(exact) CGAL::exact(sqrad); +#endif + alpha_complex_filtration = cv(sqrad); } complex.assign_filtration(f_simplex, alpha_complex_filtration); #ifdef DEBUG_TRACES -- cgit v1.2.3