diff options
author | Gard Spreemann <gspr@nonempty.org> | 2019-09-25 14:48:23 +0200 |
---|---|---|
committer | Gard Spreemann <gspr@nonempty.org> | 2019-09-25 14:48:23 +0200 |
commit | ed5877aa83ff0deb385e81e55bdf0f85e43a8a8f (patch) | |
tree | ba42bee792344ec8c157e372a286446fb7b5d223 /src/Subsampling/example/example_sparsify_point_set.cpp | |
parent | 599d68cd916f533bdb66dd9e684dd5703233b6bb (diff) | |
parent | de8e4aba94a0d5ecf933ad3ee1c05ccb866288b0 (diff) |
Merge tag 'tags/gudhi-release-3.0.0' into dfsg/latest
Diffstat (limited to 'src/Subsampling/example/example_sparsify_point_set.cpp')
-rw-r--r-- | src/Subsampling/example/example_sparsify_point_set.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/Subsampling/example/example_sparsify_point_set.cpp b/src/Subsampling/example/example_sparsify_point_set.cpp new file mode 100644 index 00000000..a8caa720 --- /dev/null +++ b/src/Subsampling/example/example_sparsify_point_set.cpp @@ -0,0 +1,28 @@ +#include <gudhi/sparsify_point_set.h> + +#include <CGAL/Epick_d.h> +#include <CGAL/Random.h> + +#include <iostream> +#include <vector> +#include <iterator> + +int main(void) { + typedef CGAL::Epick_d<CGAL::Dimension_tag<4> > K; + typedef typename K::Point_d Point_d; + + CGAL::Random rd; + + std::vector<Point_d> points; + for (int i = 0; i < 500; ++i) + points.push_back(Point_d(rd.get_double(-1., 1), rd.get_double(-1., 1), + rd.get_double(-1., 1), rd.get_double(-1., 1))); + + K k; + std::vector<Point_d> results; + Gudhi::subsampling::sparsify_point_set(k, points, 0.4, std::back_inserter(results)); + std::cout << "Before sparsification: " << points.size() << " points.\n"; + std::cout << "After sparsification: " << results.size() << " points.\n"; + + return 0; +} |