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: "Sebastian Marino" <>
  • To:
  • Subject: Re: [cgal-discuss] Need to write facets created from Implicit surface meshing
  • Date: Sun, 30 Nov 2008 20:42:39 -0800

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 ) );
const Vertex v( *vh );
const Point p( 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++;
}
for( CGAL::Complex_2_in_triangulation_3<Tr>::Facet_iterator iter(
c2t3.facets_begin() ); iter != c2t3.facets_end(); iter++ )
{
const Cell_handle ch( iter->first );
int index( iter->second );
const Cell c( *ch );
const Vertex_handle vh1( c.vertex( (index + 1)%4 ) );
const Vertex_handle vh2( c.vertex( (index + 2)%4 ) );
const Vertex_handle vh3( c.vertex( (index + 3)%4 ) );
_face_indices.push_back( vh_to_index_map[vh1] );
_face_indices.push_back( vh_to_index_map[vh2] );
_face_indices.push_back( vh_to_index_map[vh3] );

}

If you make corrections, please post them back...

-Sebastian.


On Sat, Nov 29, 2008 at 2:27 AM,
<>
wrote:
> Hi All,
>
> I am trying to create an stl file after implicit surface meshing. I used the
> example examples/Surface_mesher/mesh_an_implicit_function.cpp in the cgal
> manual on page no 2164. Can any one please tell me, how can I access all the
> facets with their normals. I am just not getting a way out.
>
> Thanks
> Avanindra
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss
>



--
Sebastian Marino
Chief Software Architect
Makani Power, Inc., Alameda, Ca.
www.makanipower.com
510.387.8077



Archive powered by MHonArc 2.6.16.

Top of Page