Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] 6 Dimensional Space

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] 6 Dimensional Space


Chronological Thread 
  • From: "Faisal Goussous" <>
  • To:
  • Subject: Re: [cgal-discuss] 6 Dimensional Space
  • Date: Fri, 27 Oct 2006 13:16:05 -0500
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=HygzCXqKnVrv8uL94uNDF6H51S5LN9DkWMFcFOHxYsHsVbDqjXvIhCQjZMhqB4nGXUfp6UlE6hwsvp/Y+UmR7NIDGhIIi0j2BN+zmJmibv0/ROy7/3xxTTlGn0RzjpCy00u3P8C6FxXzpIzESgmSNM+Lh2+fCwc4qMsj/c6t7K8=

Thank you very very much ! This has been an invaluable help.
 


 
On 10/27/06, Camille Wormser <> wrote:
wrote:

>Can anyone please provide me with a simple example to calculate the convex hull of a set of points in 6D, USING CGAL ?
>
>
Something like this should work :
--------------------------------------------------------------------
#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






Archive powered by MHonArc 2.6.16.

Top of Page