diff options
author | Hind-M <hind.montassif@gmail.com> | 2022-01-06 11:39:05 +0100 |
---|---|---|
committer | Hind-M <hind.montassif@gmail.com> | 2022-01-06 11:39:05 +0100 |
commit | b1f40dd2c4397c1975533c54a54538160c727d55 (patch) | |
tree | 3b89f83c0d37235effc86305db35a84345ffb524 /src/Cech_complex/include | |
parent | 9db268b5ecf056b87ee2f66c6d3f83de93a8681f (diff) |
Make kernel a parameter of Minimal_enclosing_ball_radius class
Use Epick in cech benchmark instead of Epeck
Diffstat (limited to 'src/Cech_complex/include')
-rw-r--r-- | src/Cech_complex/include/gudhi/Cech_complex.h | 3 | ||||
-rw-r--r-- | src/Cech_complex/include/gudhi/Cech_complex/Cech_kernel.h | 16 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/Cech_complex/include/gudhi/Cech_complex.h b/src/Cech_complex/include/gudhi/Cech_complex.h index 7bbf97d1..0031d861 100644 --- a/src/Cech_complex/include/gudhi/Cech_complex.h +++ b/src/Cech_complex/include/gudhi/Cech_complex.h @@ -18,7 +18,6 @@ #include <iostream> #include <stdexcept> // for exception management -#include <vector> namespace Gudhi { @@ -78,7 +77,7 @@ class Cech_complex { point_cloud_.assign(points.begin(), points.end()); cech_skeleton_graph_ = Gudhi::compute_proximity_graph<SimplicialComplexForProximityGraph>( - point_cloud_, max_radius_, Gudhi::Minimal_enclosing_ball_radius()); + point_cloud_, max_radius_, Gudhi::Minimal_enclosing_ball_radius<Kernel>()); } /** \brief Initializes the simplicial complex from the proximity graph and expands it until a given maximal diff --git a/src/Cech_complex/include/gudhi/Cech_complex/Cech_kernel.h b/src/Cech_complex/include/gudhi/Cech_complex/Cech_kernel.h index 348bb57d..89012206 100644 --- a/src/Cech_complex/include/gudhi/Cech_complex/Cech_kernel.h +++ b/src/Cech_complex/include/gudhi/Cech_complex/Cech_kernel.h @@ -11,9 +11,10 @@ #ifndef CECH_KERNEL_H_ #define CECH_KERNEL_H_ -#include <CGAL/Epeck_d.h> +#include <CGAL/Epeck_d.h> // for #include <CGAL/NewKernel_d/KernelD_converter.h> #include <cmath> // for std::sqrt +#include <vector> namespace Gudhi { @@ -21,8 +22,14 @@ namespace Gudhi { /** @brief Compute the radius of the minimal enclosing ball between Points given by a range of coordinates. * The points are assumed to have the same dimension. */ +template<typename Kernel> class Minimal_enclosing_ball_radius { + private: + Kernel kernel_; public: + using Point = typename Kernel::Point_d; + using Point_cloud = typename std::vector<Point>; + /** \brief Enclosing ball radius from two points using CGAL. * * @param[in] point_1 @@ -31,10 +38,7 @@ class Minimal_enclosing_ball_radius { * \tparam Point must be a Kernel::Point_d from CGAL. * */ - template< typename Kernel = CGAL::Epeck_d<CGAL::Dynamic_dimension_tag>, - typename Point= typename Kernel::Point_d> double operator()(const Point& point_1, const Point& point_2) const { - Kernel kernel_; return std::sqrt(CGAL::to_double(kernel_.squared_distance_d_object()(point_1, point_2))) / 2.; } @@ -46,11 +50,7 @@ class Minimal_enclosing_ball_radius { * \tparam Point_cloud must be a range of Kernel::Point_d points from CGAL. * */ - template< typename Kernel = CGAL::Epeck_d<CGAL::Dynamic_dimension_tag>, - typename Point= typename Kernel::Point_d, - typename Point_cloud = std::vector<Point>> double operator()(const Point_cloud& point_cloud) const { - Kernel kernel_; return std::sqrt(CGAL::to_double(kernel_.compute_squared_radius_d_object()(point_cloud.begin(), point_cloud.end()))); } |