File: grid_d.cpp

package info (click to toggle)
cgal 6.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 141,840 kB
  • sloc: cpp: 797,081; ansic: 203,398; sh: 490; python: 411; makefile: 286; javascript: 174
file content (25 lines) | stat: -rw-r--r-- 822 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
#include <vector>
#include <CGAL/Cartesian_d.h>
#include <CGAL/point_generators_d.h>
#include <CGAL/constructions_d.h>

typedef CGAL::Cartesian_d<double>                        Kd;
typedef Kd::Point_d                                      Point;
typedef CGAL::Creator_uniform_d
          <std::vector<double>::iterator, Point>         Creator_d;

int main ()
{
  int nb_points = 20;
  int dim = 4;
  double size = 5.0;
  std::cout << "Generating "<<nb_points<<" grid points in "
              <<dim<<"D" << std::endl;
  std::vector<Point> v;
  v.reserve(nb_points);
  CGAL::points_on_cube_grid_d (dim, size, static_cast<std::size_t>(nb_points),
                               std::back_inserter(v), Creator_d(dim) );
  for (int i = 0; i < nb_points; ++i) std::cout<<"  "<<v[i]<<std::endl;
  return 0;
}