Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Need to write facets created from Implicit surface meshing

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Need to write facets created from Implicit surface meshing


Chronological Thread 
  • From: Laurent Rineau <>
  • To:
  • Subject: Re: [cgal-discuss] Need to write facets created from Implicit surface meshing
  • Date: Mon, 1 Dec 2008 11:21:19 +0100

On Monday 01 December 2008 05:42:39 Sebastian Marino wrote:
> I was only playing around with this, however, I use the following
> block of code to extract the facets from such a triangulation:
>
> std::map<Vertex_handle, unsigned int> vh_to_index_map;
> unsigned int index( 0 ); for(
> CGAL::Complex_2_in_triangulation_3<Tr>::Vertex_iterator iter(
> c2t3.vertices_begin() ); iter != c2t3.vertices_end(); iter++ )
> {
> const Vertex_handle vh( static_cast<Vertex_handle>( iter ) );

No need for the static_cast: it is done automatically. Actually, there is no
need for that variable "vh" at all.

> const Vertex v( *vh );

No need for "v".

> const Point p( v.point() );

You can use "iter->point()", instead of "v.point()".

> const double x( p.x() );
> const double y( p.y() );
> const double z( p.z() );
> _vertices.push_back( Imath::V3d( x, y, z ) );
> vh_to_index_map[vh] = index++;

Idem: you can use "vh_to_index_map[iter]", because the type of "iter" is
castable to "Vertex_handle" (there is a cast operator defined in the iterator
type).

--
Laurent Rineau, PhD
Engineer at GeometryFactory
http://www.geometryfactory.com/



Archive powered by MHonArc 2.6.16.

Top of Page