39 std::optional<unsigned int> seed = std::nullopt)
41 std::mt19937 gen(seed ? *seed : std::random_device{}());
42 std::uniform_real_distribution<T> accept_dist(0.0, 1.0);
44 std::vector<Point<T, N>> result;
45 result.reserve(points.size());
47 for (
const auto &p : points)
49 T prob = density_fn(p);
50 T threshold = accept_dist(gen);
52 if (prob >= threshold)
std::vector< Point< T, N > > function_rejection_filter(const std::vector< Point< T, N > > &points, DensityFn density_fn, std::optional< unsigned int > seed=std::nullopt)
Filters points based on a spatial probability (density) function.
Definition function_rejection_filter.hpp:36