Files
cgal/Bounding_volumes/examples/Min_sphere_d/min_sphere_d.cpp
T
Philipp Möller 394b8de4d9 Merge the Bounding_volumes package from its parts
Merge Min_circle_2, Min_ellipse_2, Min_sphere_d, Min_annulus_d,
Min_sphere_of_spheres_d, Min_quadrilateral_2 and
Approximate_min_ellipsoid_d. The documentation from the part that is
in Matrix_search has also been moved here, but not the code. Add a new
don't submit that covers the old ones, combine the package_info
files. Examples and tests are still in separate folders. Merge them in
a separate step.
2012-08-16 09:44:11 +00:00

35 lines
1.0 KiB
C++

#include <CGAL/Cartesian_d.h>
#include <iostream>
#include <cstdlib>
#include <CGAL/Random.h>
#include <CGAL/Min_sphere_annulus_d_traits_d.h>
#include <CGAL/Min_sphere_d.h>
typedef CGAL::Cartesian_d<double> K;
typedef CGAL::Min_sphere_annulus_d_traits_d<K> Traits;
typedef CGAL::Min_sphere_d<Traits> Min_sphere;
typedef K::Point_d Point;
const int n = 10; // number of points
const int d = 5; // dimension of points
int main ()
{
Point P[n]; // n points
double coord[d]; // d coordinates
CGAL::Random r; // random number generator
for (int i=0; i<n; ++i) {
for (int j=0; j<d; ++j)
coord[j] = r.get_double();
P[i] = Point(d, coord, coord+d); // random point
}
Min_sphere ms (P, P+n); // smallest enclosing sphere
CGAL::set_pretty_mode (std::cout);
std::cout << ms; // output the sphere
return 0;
}