summaryrefslogtreecommitdiff
path: root/src/Witness_complex/example/generators.h
diff options
context:
space:
mode:
authorskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-09-28 11:54:31 +0000
committerskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-09-28 11:54:31 +0000
commit1c09c91ddf4d38196a91bbff5ae432fb13be6762 (patch)
tree684a6722a714ab01f7c08cfd1d0419c98f07bb50 /src/Witness_complex/example/generators.h
parent68752bc0ce16dbff783b5f84a2d02a10b7d05a4e (diff)
All work up until now
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1578 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a9379060f1edfbc419e259b2e207ebc608798803
Diffstat (limited to 'src/Witness_complex/example/generators.h')
-rw-r--r--src/Witness_complex/example/generators.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/Witness_complex/example/generators.h b/src/Witness_complex/example/generators.h
index 23915546..731a52b0 100644
--- a/src/Witness_complex/example/generators.h
+++ b/src/Witness_complex/example/generators.h
@@ -25,10 +25,12 @@
#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;
@@ -144,12 +146,21 @@ void generate_points_sphere(Point_Vector& W, int nbP, int dim) {
W.push_back(*rp++);
}
-/** \brief Generate nbP points on a d-torus
+/** \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_points_on_sphere_d<Point_d> rp(2, 1);
-
+ 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((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_