14#include <CGAL/Epick_d.h>
15#include <CGAL/point_generators_d.h>
16#include <CGAL/Random.h>
23using K = CGAL::Epick_d<CGAL::Dynamic_dimension_tag>;
25using Point_d = K::Point_d;
26using Point_Vector = std::vector<Point_d>;
27using Random_cube_iterator = CGAL::Random_points_in_cube_d<Point_d>;
28using Random_point_iterator = CGAL::Random_points_in_ball_d<Point_d>;
35off_reader_cust(std::string file_name, std::vector<Point_d> & points) {
36 std::ifstream in_file(file_name.c_str(), std::ios::in);
37 if (!in_file.is_open()) {
38 std::cerr <<
"Unable to open file " << file_name << std::endl;
44 if (!getline(in_file, line)) {
45 std::cerr <<
"No line OFF\n";
49 if (!getline(in_file, line)) {
50 std::cerr <<
"No line with 3 numbers\n";
54 while (getline(in_file, line)) {
55 std::vector< double > point;
56 std::istringstream iss(line);
60 points.push_back(Point_d(point));
71read_points_cust(std::string file_name, Point_Vector & points) {
72 std::ifstream in_file(file_name.c_str(), std::ios::in);
73 if (!in_file.is_open()) {
74 std::cerr <<
"Unable to open file " << file_name << std::endl;
79 while (getline(in_file, line)) {
80 std::vector< double > point;
81 std::istringstream iss(line);
85 Point_d p(point.begin(), point.end());
86 if (point.size() != 1)
99void generate_points_grid(Point_Vector& W,
int width,
int D,
bool torus) {
101 for (
int i = 0; i < D; ++i)
103 for (
int i = 0; i < nb_points; ++i) {
104 std::vector<double> point;
106 for (
int l = 0; l < D; ++l) {
108 point.push_back(-1 + (2.0 / (width - 1))*(cell_i % width));
110 point.push_back(-1 + (2.0 / width)*(cell_i % width));
121void generate_points_random_box(Point_Vector& W,
int nbP,
int dim) {
122 Random_cube_iterator rp(dim, 1.0);
123 for (
int i = 0; i < nbP; i++) {
131void generate_points_sphere(Point_Vector& W,
int nbP,
int dim) {
132 CGAL::Random_points_on_sphere_d<Point_d> rp(dim, 1);
133 for (
int i = 0; i < nbP; i++)
140void generate_points_torus(Point_Vector& W,
int nbP,
int dim) {
142 const double pi = std::acos(-1);
143 for (
int i = 0; i < nbP; i++) {
144 std::vector<FT> point;
145 for (
int j = 0; j < dim; j++) {
146 double alpha = rand.uniform_real(
static_cast<double>(0), 2*pi);
147 point.push_back(sin(alpha));
148 point.push_back(cos(alpha));
150 W.push_back(Point_d(point));