Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Take the triangles of a polyhedron

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Take the triangles of a polyhedron


Chronological Thread 
  • From: Philipp Moeller <>
  • To:
  • Subject: Re: [cgal-discuss] Take the triangles of a polyhedron
  • Date: Fri, 09 Mar 2012 19:39:22 +0100
  • Organization: GeometryFactory

sgdimitris
<>
writes:

> Hello,
> I have a list of 3D points and I used the quickhull example from the folder
> "CGAL-3.9\examples\Convex_hull_3"
> to calculate their convex hull. I used the following code to take the list
> of vertices and edges of convex hull
> "
> Polyhedron_3 poly;
> // compute convex hull of non-collinear points
> CGAL::convex_hull_3(points.begin(), points.end(), poly);
> std::cout << "The convex hull contains " << poly.size_of_vertices() << "
> vertices" << std::endl;
> for ( Vertex_iterator v = poly.vertices_begin(); v != poly.vertices_end();
> ++v)
> std::cout << v->point() << std::endl;
> for ( Edge_iterator w = poly.edges_begin(); w != poly.edges_end(); ++w)
> {
> std::cout << "First Vertex of the edge" <<
> w->opposite()->vertex()->point().x() << std::endl;
> std::cout << "Second Vertex of the edge" << w->vertex()->point() <<
> std::endl;
> }
> "
> I need to take the *triangles that connect the vertices of the polyhedron*.
> Is any way to do that?
By "take" you mean iterate over them?

typedef typename Polyhedron_3::Facet_iterator Facet_iterator;
for(Facet_iterator f = polyhedron.facets_begin();
f != polyhedron.facets_end();
++f) {
// your code to work on a face
}

--
Philipp Moeller
GeometryFactory



Archive powered by MHonArc 2.6.16.

Top of Page