11 #ifndef SPARSIFY_POINT_SET_H_ 12 #define SPARSIFY_POINT_SET_H_ 14 #include <gudhi/Kd_tree_search.h> 15 #ifdef GUDHI_SUBSAMPLING_PROFILING 16 #include <gudhi/Clock.h> 24 namespace subsampling {
46 template <
typename Kernel,
typename Po
int_range,
typename OutputIterator>
49 const Kernel &k, Point_range
const& input_pts,
50 typename Kernel::FT min_squared_dist,
51 OutputIterator output_it) {
53 Kernel, Point_range> Points_ds;
55 #ifdef GUDHI_SUBSAMPLING_PROFILING 59 Points_ds points_ds(input_pts);
61 std::vector<bool> dropped_points(input_pts.size(),
false);
65 std::size_t pt_idx = 0;
66 for (
typename Point_range::const_iterator it_pt = input_pts.begin();
67 it_pt != input_pts.end();
69 if (dropped_points[pt_idx])
72 *output_it++ = *it_pt;
74 auto ins_range = points_ds.incremental_nearest_neighbors(*it_pt);
77 for (
auto const& neighbor : ins_range) {
78 std::size_t neighbor_point_idx = neighbor.first;
80 if (neighbor.second < min_squared_dist) {
84 dropped_points[neighbor_point_idx] =
true;
91 #ifdef GUDHI_SUBSAMPLING_PROFILING 93 std::cerr <<
"Point set sparsified in " << t.num_seconds()
94 <<
" seconds." << std::endl;
101 #endif // SPARSIFY_POINT_SET_H_ Spatial tree data structure to perform (approximate) nearest and furthest neighbor search...
Definition: Kd_tree_search.h:70
void sparsify_point_set(const Kernel &k, Point_range const &input_pts, typename Kernel::FT min_squared_dist, OutputIterator output_it)
Outputs a subset of the input points so that the squared distance between any two points is greater t...
Definition: sparsify_point_set.h:48
Definition: SimplicialComplexForAlpha.h:14