diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-03-02 20:46:46 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-03-02 20:46:46 +0000 |
commit | effc4723dfa2604c8c505b0dfff48b4cab8012ca (patch) | |
tree | 09f0a1361644eaba294549246a59efb9e99f1451 /src/Witness_complex/example/generators.h | |
parent | 087fdfa6bdce9c40d046c983fbe36b94b976568a (diff) | |
parent | 3602c71163c6c0b26cb866a6a5757e57a15bb6fe (diff) |
Merge relaxed-witness branch
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@2138 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 63b007a9fb25b25383d2d7de360f1efc94aa3906
Diffstat (limited to 'src/Witness_complex/example/generators.h')
-rw-r--r-- | src/Witness_complex/example/generators.h | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/src/Witness_complex/example/generators.h b/src/Witness_complex/example/generators.h index ac445261..7df43db5 100644 --- a/src/Witness_complex/example/generators.h +++ b/src/Witness_complex/example/generators.h @@ -25,17 +25,19 @@ #include <CGAL/Epick_d.h> #include <CGAL/point_generators_d.h> +#include <CGAL/Random.h> #include <fstream> #include <string> #include <vector> +#include <cmath> -typedef CGAL::Epick_d<CGAL::Dynamic_dimension_tag> K; -typedef K::FT FT; -typedef K::Point_d Point_d; -typedef std::vector<Point_d> Point_Vector; -typedef CGAL::Random_points_in_cube_d<Point_d> Random_cube_iterator; -typedef CGAL::Random_points_in_ball_d<Point_d> Random_point_iterator; +using K = CGAL::Epick_d<CGAL::Dynamic_dimension_tag>; +using FT = K::FT; +using Point_d = K::Point_d; +using Point_Vector = std::vector<Point_d>; +using Random_cube_iterator = CGAL::Random_points_in_cube_d<Point_d>; +using Random_point_iterator = CGAL::Random_points_in_ball_d<Point_d>; /** * \brief Rock age method of reading off file @@ -144,4 +146,21 @@ void generate_points_sphere(Point_Vector& W, int nbP, int dim) { W.push_back(*rp++); } +/** \brief Generate nbP points on a (flat) d-torus embedded in R^{2d} + * + */ +void generate_points_torus(Point_Vector& W, int nbP, int dim) { + CGAL::Random rand; + const double pi = std::acos(-1); + for (int i = 0; i < nbP; i++) { + std::vector<FT> point; + for (int j = 0; j < dim; j++) { + double alpha = rand.uniform_real(static_cast<double>(0), 2*pi); + point.push_back(sin(alpha)); + point.push_back(cos(alpha)); + } + W.push_back(Point_d(point)); + } +} + #endif // EXAMPLE_WITNESS_COMPLEX_GENERATORS_H_ |