Subject: CGAL users discussion list
List archive
- From: Camille Wormser <>
- To:
- Subject: Re: [cgal-discuss] 6 Dimensional Space
- Date: Fri, 27 Oct 2006 12:16:44 +0200
wrote:
Can anyone please provide me with a simple example to calculate the convexSomething like this should work :
hull of a set of points in 6D, USING CGAL ?
--------------------------------------------------------------------
#include <list>
#include <Convex_hull_d.h>
#include <CGAL/Cartesian_d.h>
typedef CGAL::Cartesian_d<double> Kd;
typedef CGAL::Convex_hull_d<Kd> CHull_d;
typedef CHull_d::Point_d Point_d;
typedef std::list<Point_d> List_ptd;
CHull_d* init_insertion(List_ptd points) {
CHull_d::Vertex_handle vh6;
List_ptd::iterator a, b;
a = points->begin();
b = points->end();
ch6 = new CHull_d(6);
while(a != b) {
vh6 = ch6->insert(*a);
++a;
}
}
--------------------------------------------------------------------
A Point_d can be created by calling for example
Point_d(6, c.begin(), c.end());
where c is a list of 6 doubles.
Then, if you want to retrieve the points on the convex hull, you have access to iterators
ch6->Hull_point_const_iterator hull_points_begin()
ch6->Hull_point_const_iterator hull_points_end()
You also have the facets iterators
ch6->Facet_iterator facets_begin()
ch6->Facet_iterator facets_end()
and ch6->vertex_of_facet(facet,j) for j = 0..5 gives you the vertices.
ch6->vertex_of_facet(facet,j)->point() gives you the point.
ch6->vertex_of_facet(facet,j)->point().cartesian_begin() gives you an iterator on the coordinates.
You may however soon encounter robustness issues, and then need an exact number type (note that this Convex_hull_d computes and stores some hyperplanes, and is not completely predicate-based...).
--
Camille
- 6 Dimensional Space, fasfoosxxx, 10/26/2006
- Re: [cgal-discuss] 6 Dimensional Space, Camille Wormser, 10/27/2006
- Re: [cgal-discuss] 6 Dimensional Space, Faisal Goussous, 10/27/2006
- Re: [cgal-discuss] 6 Dimensional Space, Camille Wormser, 10/27/2006
Archive powered by MHonArc 2.6.16.