Subject: CGAL users discussion list
List archive
Re: [cgal-discuss] Re: Help getting triangles coordinates from Delaunay Triangulation
Chronological Thread
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Re: Help getting triangles coordinates from Delaunay Triangulation
- Date: Thu, 10 Nov 2011 08:15:04 +0100
If you really need the id, you need to look at the implementation in
include/CGAL/convex_hull_3_to_polyhedron_3.h and more precisely to the
operator(). The code is not hard to understand, you'll see that I
collect tetrahedra incident to the infinite vertex and extract vertices
that are on the convex hull and get correctly oriented facets too.
Sebastien.
horstmann wrote:
Hello again Sebastien, and thak you so much for your valuable anwers, you are
very kind and patient.
Up to the moment, I have:
std::vector< std::pair<Point,unsigned> > points;
points.push_back( std::make_pair(Point(1,0,0),0) );
points.push_back( std::make_pair(Point(0,1,0),1) );
..........
..........
..........
// Create delaunay triangulation
Delaunay dt( points.begin(),points.end() );
// define polyhedron to hold convex hull
CGAL::Polyhedron_3<K> poly;
// Get only the surface
convex_hull_3_to_polyhedron_3(dt,poly);
Or just:
// define polyhedron to hold convex hull
Polyhedron_3 poly;
// compute convex hull of non-collinear points
CGAL::convex_hull_3(points.begin(), points.end(), poly);
I think, both options perform the same, right? But with the second choice, I
haven't be able to store the info together the points, so I choose the
first.
Now, I have to obtain what you already know, from the triangles that belong
to the polyhedron, the 3 "id" vertices of each triangle (one triangle per
line). The id, was stored as "info" together with each vertex.
I suppose I have to iterate over the Facets, and for each Facet, iterate
over its halfedges;
doing that for example:
CGAL::Polyhedron_3<K>::Facet_iterator it;
CGAL::Polyhedron_3<K>::Facet::Halfedge_around_facet_circulator ci;
for (it = poly.facets_begin(); it != poly.facets_end(); it++)
{
ci = it->facet_begin();
ci->vertex()->point();
ci++;
ci->vertex()->point();
ci++;
ci->vertex()->point();
}
This way, I have the 3 vertices of each triangle (ist x,y,z coordinates),
but how can I recover the "id" I stored before as "info" ¿?
I tried ci->vertex()->info(); , but it doesn't work.
Do I lost the "info" I stored togethe with de Triangulation calling the
function
""convex_hull_3_to_polyhedron_3(dt,poly);""
?¿
Thak you so much again.
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Help-getting-triangles-coordinates-from-Delaunay-Triangulation-tp3955310p4021298.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Re: Help getting triangles coordinates from Delaunay Triangulation, horstmann, 11/03/2011
- Re: [cgal-discuss] Re: Help getting triangles coordinates from Delaunay Triangulation, Sebastien Loriot (GeometryFactory), 11/03/2011
- [cgal-discuss] Re: Help getting triangles coordinates from Delaunay Triangulation, horstmann, 11/09/2011
- Re: [cgal-discuss] Re: Help getting triangles coordinates from Delaunay Triangulation, Sebastien Loriot (GeometryFactory), 11/10/2011
- [cgal-discuss] Re: Help getting triangles coordinates from Delaunay Triangulation, horstmann, 11/09/2011
- Re: [cgal-discuss] Re: Help getting triangles coordinates from Delaunay Triangulation, Sebastien Loriot (GeometryFactory), 11/03/2011
Archive powered by MHonArc 2.6.16.