#include <CGAL/dd_geo/chull_traits_3.h>
|
| |
|
== R::RT, coordinate ring type used for calculations.
| |
|
| |
|
== Point_3<R>, point type.
| |
|
| |
|
== Point_3<R>, internal point type.
| |
|
| |
|
== Plane_3<R>, hyperplane type.
| |
|
| |
|
== Vector_3<R>, internal vector type.
| |
|
| |
|
== Ray_3<R>, internal ray type.
| |
The following example uses CGAL's 3D random point generator Random_points_in_sphere_3<>, which generates random points on a sphere, and CGAL's STL extension function copy_n, which copies elements.
#include <CGAL/Homogeneous.h>
#include <CGAL/chull_traits_3.h>
#include <LEP/dd_geo/chull.h>
#include <CGAL/point_generators_3.h>
#include <CGAL/copy_n.h>
#include <vector>
using namespace std;
using namespace CGAL;
typedef Homogeneous< double > RepCls;
typedef chull_traits_3< RepCls > ChullTraits;
typedef chull< ChullTraits > ChullType;
typedef ChullTraits::POINT Point;
typedef Creator_uniform_3<double,Point> PointCreator;
int
main()
{
/* generate 250 points randomly on a sphere of radius 100.0 */
Random_points_in_sphere_3< Point, PointCreator> gen(100.0);
vector<Point> V;
/* and copy them to a vector */
copy_n( gen, 250, back_inserter(V) );
/* compute their convex hull */
ChullType CH(3);
vector<Point>::iterator it;
for (it = V.begin(); it != V.end(); ++it) CH.insert(*it);
return 0;
}