Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Convert Polyhedron_3 to Mesh_polyhedron_3

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Convert Polyhedron_3 to Mesh_polyhedron_3


Chronological Thread 
  • From: "Laurent Rineau (CGAL/GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Convert Polyhedron_3 to Mesh_polyhedron_3
  • Date: Fri, 03 Aug 2012 11:41:41 +0200
  • Organization: GeometryFactory

Le jeudi 02 août 2012 05:59:35 ju21 a écrit :
> Hello,
>
> I'm a new CGAL developper and I'd like to know if it's possible to convert a
> *Polyhedron_3* to a *Mesh_polyhedron_3* ?
>
> And if it's not a problem how could I do that ?

One can do that using the incremental builder.

There is a file <CGAL/Polyhedron_copy.h>, that can also help you. It is not
used for a long time in CGAL. There is a typo in it. Line 52:
typedef typename HDS::Point Point;
it should be:
typedef typename HDS::Vertex::Point Point;

Once that is fixed, you can do:

Polyhedron polyhedron;
Mesh_polyhedron new_polyhedron;

typedef CGAL::Polyhedron_copy_3<Polyhedron, Mesh_polyhedron::HDS> Poly_copy;

Poly_copy polyhedron_copy_modifier(polyhedron);

new_polyhedron.delegate(polyhedron_copy_modifier);

The last line will copy 'polyhedron' to 'new_polyhedron'.

--
Laurent Rineau, PhD
R&D Engineer at GeometryFactory http://www.geometryfactory.com/
Release Manager of the CGAL Project http://www.cgal.org/




Archive powered by MHonArc 2.6.18.

Top of Page