diff options
author | Hind-M <hind.montassif@gmail.com> | 2022-06-24 14:49:48 +0200 |
---|---|---|
committer | Hind-M <hind.montassif@gmail.com> | 2022-06-24 14:49:48 +0200 |
commit | a178b101780ded149d73fcbec622d7ae7ec2728c (patch) | |
tree | 945841d2d149cd85e9ca19a6b88567bb15f505cf /src/Cech_complex/include/gudhi/Sphere_circumradius.h | |
parent | c69c9eec18336d44be157e4fd6ee5261b47ddb49 (diff) | |
parent | 9fc4f5e2ba50287979fc6e56708ec469d29c968c (diff) |
Merge remote-tracking branch 'upstream/master' into cech_extra_point
Diffstat (limited to 'src/Cech_complex/include/gudhi/Sphere_circumradius.h')
-rw-r--r-- | src/Cech_complex/include/gudhi/Sphere_circumradius.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Cech_complex/include/gudhi/Sphere_circumradius.h b/src/Cech_complex/include/gudhi/Sphere_circumradius.h index b0d9f7cc..790f6950 100644 --- a/src/Cech_complex/include/gudhi/Sphere_circumradius.h +++ b/src/Cech_complex/include/gudhi/Sphere_circumradius.h @@ -11,7 +11,7 @@ #ifndef SPHERE_CIRCUMRADIUS_H_ #define SPHERE_CIRCUMRADIUS_H_ -#include <CGAL/Epeck_d.h> // for #include <CGAL/NewKernel_d/KernelD_converter.h> +#include <CGAL/Epick_d.h> // for #include <CGAL/NT_converter.h> which is not working/compiling alone #include <cmath> // for std::sqrt #include <vector> @@ -22,14 +22,17 @@ namespace cech_complex { /** \private @brief Compute the circumradius of the sphere passing through points given by a range of coordinates. * The points are assumed to have the same dimension. */ -template<typename Kernel> +template<typename Kernel, typename Filtration_value> class Sphere_circumradius { private: Kernel kernel_; public: + using FT = typename Kernel::FT; using Point = typename Kernel::Point_d; using Point_cloud = typename std::vector<Point>; + CGAL::NT_converter<FT, Filtration_value> cast_to_fv; + /** \brief Circumradius of sphere passing through two points using CGAL. * * @param[in] point_1 @@ -38,8 +41,8 @@ class Sphere_circumradius { * \tparam Point must be a Kernel::Point_d from CGAL. * */ - double operator()(const Point& point_1, const Point& point_2) const { - return std::sqrt(CGAL::to_double(kernel_.squared_distance_d_object()(point_1, point_2))) / 2.; + Filtration_value operator()(const Point& point_1, const Point& point_2) const { + return std::sqrt(cast_to_fv(kernel_.squared_distance_d_object()(point_1, point_2))) / 2.; } /** \brief Circumradius of sphere passing through point cloud using CGAL. @@ -49,8 +52,8 @@ class Sphere_circumradius { * \tparam Point_cloud must be a range of Kernel::Point_d points from CGAL. * */ - double operator()(const Point_cloud& point_cloud) const { - return std::sqrt(CGAL::to_double(kernel_.compute_squared_radius_d_object()(point_cloud.begin(), point_cloud.end()))); + Filtration_value operator()(const Point_cloud& point_cloud) const { + return std::sqrt(cast_to_fv(kernel_.compute_squared_radius_d_object()(point_cloud.begin(), point_cloud.end()))); } }; |