23 #ifndef SPARSIFY_POINT_SET_H_ 24 #define SPARSIFY_POINT_SET_H_ 26 #include <gudhi/Kd_tree_search.h> 27 #ifdef GUDHI_SUBSAMPLING_PROFILING 28 #include <gudhi/Clock.h> 36 namespace subsampling {
58 template <
typename Kernel,
typename Po
int_range,
typename OutputIterator>
61 const Kernel &k, Point_range
const& input_pts,
62 typename Kernel::FT min_squared_dist,
63 OutputIterator output_it) {
65 Kernel, Point_range> Points_ds;
67 #ifdef GUDHI_SUBSAMPLING_PROFILING 71 Points_ds points_ds(input_pts);
73 std::vector<bool> dropped_points(input_pts.size(),
false);
77 std::size_t pt_idx = 0;
78 for (
typename Point_range::const_iterator it_pt = input_pts.begin();
79 it_pt != input_pts.end();
81 if (dropped_points[pt_idx])
84 *output_it++ = *it_pt;
86 auto ins_range = points_ds.incremental_nearest_neighbors(*it_pt);
89 for (
auto const& neighbor : ins_range) {
90 std::size_t neighbor_point_idx = neighbor.first;
92 if (neighbor.second < min_squared_dist) {
96 dropped_points[neighbor_point_idx] =
true;
103 #ifdef GUDHI_SUBSAMPLING_PROFILING 105 std::cerr <<
"Point set sparsified in " << t.num_seconds()
106 <<
" seconds." << std::endl;
113 #endif // SPARSIFY_POINT_SET_H_ Spatial tree data structure to perform (approximate) nearest and furthest neighbor search...
Definition: Kd_tree_search.h:69
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:60
Definition: SimplicialComplexForAlpha.h:26