summaryrefslogtreecommitdiff
path: root/src/Subsampling/example/example_sparsify_point_set.cpp
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-10-12 20:43:00 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-10-12 20:43:00 +0000
commitff39c01329748691e94a776ed10a56692e05e15e (patch)
treeae565e75c6f82e6196805c6210660cbd62407401 /src/Subsampling/example/example_sparsify_point_set.cpp
parent9f2b8a393a19dad35db964d0f6ee78e8b15cafa5 (diff)
parentfc770aacbde64904795b9d6afdc503beb989f6ee (diff)
Merge last trunk modifications
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_create_complex@1715 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 68b171b536522a45c4304e40bafe11d08c8921dd
Diffstat (limited to 'src/Subsampling/example/example_sparsify_point_set.cpp')
-rw-r--r--src/Subsampling/example/example_sparsify_point_set.cpp27
1 files changed, 27 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..b35a18d9
--- /dev/null
+++ b/src/Subsampling/example/example_sparsify_point_set.cpp
@@ -0,0 +1,27 @@
+#include <gudhi/sparsify_point_set.h>
+
+#include <CGAL/Epick_d.h>
+#include <CGAL/Random.h>
+
+#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;
+}