Subject: CGAL users discussion list
List archive
- From: Jari Vauhkonen <>
- To:
- Subject: A bug with alpha shape creation?
- Date: Thu, 24 May 2007 17:33:36 +0300
Hello,
I've been trying to get a boundary of a point set by building an alpha shape
with an optimal alpha value and outputting the points belonging to the
boundary
of the alpha shape.
My problem is that the alpha shape I created seems to contain only a half of
the
points set.
See http://cc.joensuu.fi/~jvauhkon/half_alpha.GIF for an example. The red
points
are the boundary points outputted. I've got around 100 nearly similar point
sets and, as far as I've checked, the result seems to be the same every time.
Here's the central pieces of my code. The standard list (lp) that contains the
input points should be OK. The code is always ran with an optimal alpha value,
although the result is same with a defined alpha. What am I doing wrong?
// compute alpha shape
Alpha_shape_2 as(lp.begin(),lp.end());
std::cout << "Alpha shape computed in REGULARIZED mode by default"
<< std::endl;
if (isOptimalAlpha)
{
// find optimal alpha value
Alpha_iterator opt = as.find_optimal_alpha(5);
std::cout << "Optimal alpha value to get a connected
component:"
<< *opt << std::endl;
alpha = *opt;
as.set_alpha(alpha);
}
else
as.set_alpha(alpha);
Alpha_shape_2::Alpha_shape_vertices_iterator vert_it;
for ( vert_it = as.alpha_shape_vertices_begin(); vert_it !=
as.alpha_shape_vertices_end(); vert_it++ ) {
Vertex_handle h = *vert_it;
// not a part of the interior & optimal alpha,
// so has to be a part of the boundary
if (as.classify(h) != Alpha_shape_2::INTERIOR) {
Point p = h->point();
fprintf(output, "%f %f\n", CGAL::to_double(p[0]),
CGAL::to_double(p[1]) );
}
}
Thanks in advance,
Jari
- A bug with alpha shape creation?, Jari Vauhkonen, 05/24/2007
Archive powered by MHonArc 2.6.16.