summaryrefslogtreecommitdiff
path: root/src/Alpha_complex/include/gudhi/Alpha_complex.h
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2019-11-07 17:02:38 +0100
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2019-11-07 17:02:38 +0100
commit5a2c3559da581136edb7facf5578bd1443080ef3 (patch)
treeb4e11a12963283d968fdfab5a0194f8b1872e3ed /src/Alpha_complex/include/gudhi/Alpha_complex.h
parentea296b4a93c37b0e19d4605c1be3e950ed8cd3c2 (diff)
Code review: Add suggested code using NT_converter to simplify the different alpha_complex_filtration computations cases
Diffstat (limited to 'src/Alpha_complex/include/gudhi/Alpha_complex.h')
-rw-r--r--src/Alpha_complex/include/gudhi/Alpha_complex.h18
1 files 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 <CGAL/Spatial_sort_traits_adapter_d.h>
#include <CGAL/property_map.h> // for CGAL::Identity_property_map
#include <CGAL/version.h> // for CGAL_VERSION_NR
+#include <CGAL/NT_converter.h>
#include <Eigen/src/Core/util/Macros.h> // 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<typename Geom_traits::FT, Filtration_value> 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