diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-12-02 13:26:47 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-12-02 13:26:47 +0000 |
commit | 9a3373a0db722c75994826d44b4cfbe1b7b5aeb0 (patch) | |
tree | c83cabae516d675fd7a27a673da1913835b1dcd5 /src/cython/include/Subsampling_interface.h | |
parent | 658e2ad845801f3b2a7a349e499763d7f28a8bc9 (diff) |
pick_n_random_points cythonization
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@1814 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 696c9b39cb05e69e2d9c2a3ac3f5400c7e518691
Diffstat (limited to 'src/cython/include/Subsampling_interface.h')
-rw-r--r-- | src/cython/include/Subsampling_interface.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/cython/include/Subsampling_interface.h b/src/cython/include/Subsampling_interface.h index 12c48012..8ef4fea1 100644 --- a/src/cython/include/Subsampling_interface.h +++ b/src/cython/include/Subsampling_interface.h @@ -38,6 +38,7 @@ using Subsampling_dynamic_kernel = CGAL::Epick_d< CGAL::Dynamic_dimension_tag >; using Subsampling_point_d = Subsampling_dynamic_kernel::Point_d; using Subsampling_ft = Subsampling_dynamic_kernel::FT; +// ------ choose_n_farthest_points ------ std::vector<std::vector<double>> subsampling_n_farthest_points(std::vector<std::vector<double>>& points, unsigned nb_points) { std::vector<Subsampling_point_d> input, output; for (auto point : points) @@ -71,6 +72,25 @@ std::vector<std::vector<double>> subsampling_n_farthest_points_from_file(std::st std::vector<std::vector<double>> points = off_reader.get_point_cloud(); return subsampling_n_farthest_points(points, nb_points, starting_point); } + +// ------ pick_n_random_points ------ +std::vector<std::vector<double>> subsampling_n_random_points(std::vector<std::vector<double>>& points, unsigned nb_points) { + std::vector<Subsampling_point_d> input, output; + for (auto point : points) + input.push_back(Subsampling_point_d(point.size(), point.begin(), point.end())); + std::vector<std::vector<double>> landmarks; + pick_n_random_points(points, nb_points, std::back_inserter(landmarks)); + + return landmarks; +} + +std::vector<std::vector<double>> subsampling_n_random_points_from_file(std::string& off_file, unsigned nb_points) { + Gudhi::Points_off_reader<std::vector<double>> off_reader(off_file); + std::vector<std::vector<double>> points = off_reader.get_point_cloud(); + return subsampling_n_random_points(points, nb_points); +} + + } // namespace subsampling } // namespace Gudhi |