Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Why my volumes of convex hull and alpha shape are almost the same?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Why my volumes of convex hull and alpha shape are almost the same?


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Why my volumes of convex hull and alpha shape are almost the same?
  • Date: Tue, 24 Sep 2013 09:38:06 +0200
  • Organization: GeometryFactory

In particular, you are iterating over all the cells.
You need to use the function get_alpha_shape_cells to get only a subset
or add in your loop over cells:

if (as.classify(it)==Alpha_shape_3::EXTERIOR) continue;

You should also have a look at the function find_optimal_alpha that might be helpful in your case.

Sebastien.

http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Alpha_shape_3.html

On 09/24/2013 09:24 AM, Mariette Yvinec wrote:
You might
look at the alpha_spectrum to see if all the alpha-values
you have been trying are relevant or not.


Le 23/09/13 19:40, evantong623 a écrit :
I have a 3D point cloud, and need to determine whether there is a big hole or
not. So I extract its convex hull and alpha shape, and measure their
volumes. If the volume of convex hull is much larger than the one of alpha
shape, I say there exist big hole(s) in the point cloud.
To compute the volume of convex hull, I first triangulate the convex hull
and then sum up the volumes of the tetrahedrons. To compute the volume of
alpha shape, I just sum up the volumes of its cells. Here is the code:

//generating convex hull
Polyhedron_3 poly;
CGAL::convex_hull_3(_bundlePoints[ib].begin(), _bundlePoints[ib].end(),
poly);

//convex hull volume
std::vector<Triangulation::Point> L;
for (Polyhedron_3::Vertex_const_iterator it = poly.vertices_begin(); it !=
poly.vertices_end(); it++)
L.push_back(Triangulation::Point(it->point().x(), it->point().y(),
it->point().z()));
Triangulation T(L.begin(), L.end());
float hull_volume = 0;
for(Triangulation::Finite_cells_iterator it = T.finite_cells_begin(); it !=
T.finite_cells_end(); it++)
{
Tetrahedron_3 tetr = T.tetrahedron(it);
hull_volume += tetr.volume();
}
cout<<"hull volume:"<< hull_volume<< endl;

//generating alpha shape
Alpha_shape_3 as(_bundlePoints[ib].begin(),
_bundlePoints[ib].end(),10000,Alpha_shape_3::GENERAL);

//alpha shape volume
float alpha_volume = 0;
for(Alpha_shape_3::Finite_cells_iterator it = as.finite_cells_begin(); it !=
as.finite_cells_end(); it++)
{
Tetrahedron_3 tetr = as.tetrahedron(it);
alpha_volume += tetr.volume();
}
cout<<"alpha volume:"<< alpha_volume<< endl;

I tried different alpha values, but the volumes of convex hull and alpha
shape are always almost the same. Is my volume computation not correct? I am
very new to CGAL, hope someone could give me a clue for my problem. Thanks,



--
View this message in
context:http://cgal-discuss.949826.n4.nabble.com/Why-my-volumes-of-convex-hull-and-alpha-shape-are-almost-the-same-tp4658070.html
Sent from the cgal-discuss mailing list archive at Nabble.com.


--
Mariette Yvinec
Geometrica project team
INRIA Sophia-Antipolis







Archive powered by MHonArc 2.6.18.

Top of Page