diff options
author | Hind-M <hind.montassif@gmail.com> | 2021-08-09 16:21:24 +0200 |
---|---|---|
committer | Hind-M <hind.montassif@gmail.com> | 2021-08-09 16:21:24 +0200 |
commit | 91b0ff839b8058d3f5767e6ed80b93c23be2c98a (patch) | |
tree | ba6b3c36cb526bd6dd2544e3f608e6c00cb67241 /src/common | |
parent | 2bd2f8134daeb65a9fff730fef75c323320faefb (diff) |
First version of cech enhancement
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/include/gudhi/distance_functions.h | 42 | ||||
-rw-r--r-- | src/common/include/gudhi/graph_simplicial_complex.h | 3 |
2 files changed, 45 insertions, 0 deletions
diff --git a/src/common/include/gudhi/distance_functions.h b/src/common/include/gudhi/distance_functions.h index 9bbc62b7..ae5168aa 100644 --- a/src/common/include/gudhi/distance_functions.h +++ b/src/common/include/gudhi/distance_functions.h @@ -18,6 +18,8 @@ #include <boost/range/metafunctions.hpp> #include <boost/range/size.hpp> +#include <CGAL/Epeck_d.h> + #include <cmath> // for std::sqrt #include <type_traits> // for std::decay #include <iterator> // for std::begin, std::end @@ -63,6 +65,23 @@ class Euclidean_distance { * The points are assumed to have the same dimension. */ class Minimal_enclosing_ball_radius { public: + /** \brief TODO + * + * @param[in] point_1 + * @param[in] point_2 + * @return + * \tparam Point + * + */ + //typename FT = typename Kernel::FT, + 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 { + std::clog << "Added template: distance betw points 1 and 2" << std::endl; + Kernel kernel_; + return std::sqrt(CGAL::to_double(kernel_.squared_distance_d_object()(point_1, point_2))) / 2.; + } + /** \brief Minimal_enclosing_ball_radius from two points. * * @param[in] point_1 First point. @@ -75,8 +94,29 @@ class Minimal_enclosing_ball_radius { template< typename Point > typename std::iterator_traits<typename boost::range_iterator<Point>::type>::value_type operator()(const Point& point_1, const Point& point_2) const { + std::clog << "Hind: Minimal_enclosing_ball_radius point1 et 2; Euclidean" << std::endl; + std::clog << "#" << *point_1.begin() << "##" << *point_2.begin() << std::endl; return Euclidean_distance()(point_1, point_2) / 2.; } + + + /** \brief TODO + * + * @param[in] point_cloud The points. + * @return + * \tparam Point_cloud + * + */ + //typename FT = typename Kernel::FT, + 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 { + std::clog << "Added template: distance in point cloud" << std::endl; + Kernel kernel_; + return std::sqrt(CGAL::to_double(kernel_.compute_squared_radius_d_object()(point_cloud.begin(), point_cloud.end()))); + } + /** \brief Minimal_enclosing_ball_radius from a point cloud. * * @param[in] point_cloud The points. @@ -93,6 +133,8 @@ class Minimal_enclosing_ball_radius { typename Coordinate = typename std::iterator_traits<Coordinate_iterator>::value_type> Coordinate operator()(const Point_cloud& point_cloud) const { + std::clog << "Hind: Minimal_enclosing_ball_radius point cloud; Miniball" << std::endl; + using Min_sphere = Miniball::Miniball<Miniball::CoordAccessor<Point_iterator, Coordinate_iterator>>; Min_sphere ms(boost::size(*point_cloud.begin()), point_cloud.begin(), point_cloud.end()); diff --git a/src/common/include/gudhi/graph_simplicial_complex.h b/src/common/include/gudhi/graph_simplicial_complex.h index da9dee7d..9190182c 100644 --- a/src/common/include/gudhi/graph_simplicial_complex.h +++ b/src/common/include/gudhi/graph_simplicial_complex.h @@ -18,6 +18,8 @@ #include <map> #include <tuple> // for std::tie +#include <iostream> + namespace Gudhi { /** @file * @brief Graph simplicial complex methods @@ -76,6 +78,7 @@ Proximity_graph<SimplicialComplexForProximityGraph> compute_proximity_graph( for (auto it_u = points.begin(); it_u != points.end(); ++it_u) { idx_v = idx_u + 1; for (auto it_v = it_u + 1; it_v != points.end(); ++it_v, ++idx_v) { + std::clog << "#idx_u" << idx_u << "#idx_v " << idx_v << std::endl; fil = distance(*it_u, *it_v); if (fil <= threshold) { edges.emplace_back(idx_u, idx_v); |