Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Extracting triangulation from alpha shape

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Extracting triangulation from alpha shape


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Extracting triangulation from alpha shape
  • Date: Fri, 02 Aug 2013 07:27:42 +0200
  • Organization: GeometryFactory

Use one of the following examples [1] to build the triangulation of your points and set their indices. Then build the alpha shape from the triangulation.

then you can do:

typedef CGAL::Delaunay_triangulation_3<.....> DT3;

....

for (std::list<Facet>::iterator it = facets.begin(); it != facets.end(); ++it)
{
it->first->vertex( DT3::vertex_triple_index(it->second,0) )->info();
it->first->vertex( DT3::vertex_triple_index(it->second,1) )->info();
it->first->vertex( DT3::vertex_triple_index(it->second,2) )->info();
}

Sebastien.

[1] http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Triangulation_3/Chapter_main.html#Subsection_39.5.3

On 08/01/2013 08:44 PM, rcasero wrote:
Dear all,

I'm computing alpha shapes on a set of points

// read points from function
std::vector<Point> x =
some_function_to_read_points();

// compute alpha shape
Alpha_shape_3 as(x.begin(), x.end());

based on the example from the "3D Alpha shapes" documentation:

http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Alpha_shapes_3/Chapter_main.html#Subsection_43.5.1

What I would like to do now is extract the triangulation of a given alpha
shape in index form, e.g.

tri = [3 2 8
2 1 3
...]

where the indices are the indices of the points in the x vector above.

This is similar to a previous question I got help from Sebastien Loriot to

http://cgal-discuss.949826.n4.nabble.com/Getting-index-of-facet-closest-to-a-point-tp4657635.html

but I don't manage to find the right pointers in this case so that I can do
something like

std::distance(x.begin(), some_iterator_here);

to get the index.

I can get a list of the facets

// get alpha-shape surface
std::list<Facet> facets;
as.get_alpha_shape_facets(std::back_inserter(facets),
Alpha_shape_3::REGULAR);

and I can iterate said facets

for (std::list<Facet>::iterator it = facets.begin(); it != facets.end();
++it) {

}

From the documentation and an old question replied to by sloriot

http://stackoverflow.com/questions/7938311/cgal-help-getting-triangles-coordinates-from-delaunay-triangulation

I know I can the coordinates of the facet vertices as

for (std::list<Facet>::iterator it = facets.begin(); it != facets.end();
++it) {

it->first->vertex((it->second+1)%4)->point();
it->first->vertex((it->second+2)%4)->point();
it->first->vertex((it->second+3)%4)->point();

}

but the it->...->point(); above are not pointing to elements in x, neither
it->first->vertex((it->second+1)%4).

Many thanks for any help or, ahem, pointers.

Best regards,

Ramon.



--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Extracting-triangulation-from-alpha-shape-tp4657870.html
Sent from the cgal-discuss mailing list archive at Nabble.com.





Archive powered by MHonArc 2.6.18.

Top of Page