Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] [CGAL NOOB] Extract Cell from polyhedron_3

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] [CGAL NOOB] Extract Cell from polyhedron_3


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] [CGAL NOOB] Extract Cell from polyhedron_3
  • Date: Thu, 06 Sep 2012 18:34:10 +0200
  • Organization: GeometryFactory

The following compiles on my machine.

Sebastien.

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/convex_hull_3.h>
#include <CGAL/Polyhedron_items_with_id_3.h>

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Polyhedron_3<K,CGAL::Polyhedron_items_with_id_3> Polyhedron;

int main()
{
std::vector<K::Point_3> points;
Polyhedron P;

CGAL::convex_hull_3(points.begin(),points.end(),P);

}



On 09/06/2012 11:54 AM, Mathieu Westphal wrote:
On 09/05/2012 07:07 AM, Sebastien Loriot (GeometryFactory) wrote:
On 09/04/2012 05:24 PM, Mathieu Westphal wrote:
I have a polyhedron_3 (with only triangles in it ) and i want to create
a vtkPolyData with it.

I can extract Points from the polyhedron without problem and inject them
into the vtkPolyData

However i see no evident way to extract cells (facets in CGAL?)
Looking at this page:
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Polyhedron_ref/Class_Polyhedron_3.htm


given a polyhefron Pyou can see that the range
P.facets_begin(), P.facets_end() is what you are looking for.

To access the vertices, given a facet f,

Halfedge_handle h=f.halhedge()
do{
h->vertex();//access the vertex
h->vertex()->point();//access the point
h=h->next();
}while (h!=f.halhedge());

To associate an id to each vertex you can use a
std::map<Vertex_handle,unsigned> for example
Thanks, everything works well, thanks to you !
or use an
item class with id likeClass_Polyhedron_items_with_id_3

http://www.cgal.org/Manual/latest/doc_html/cgal_manual/BGL_ref/Class_Polyhedron_items_with_id_3.html

The mesh generation fonction (CGAL::convex_hull_3) seem not to work with
a Polyhedron_items_with_id_3

Sebastien.


vtkPolyData need for each cell, the id of constituing points.

Is there any way to find facets from one points? or points from one
facet?










Archive powered by MHonArc 2.6.18.

Top of Page