Subject: CGAL users discussion list
List archive
- From: Mariette Yvinec <>
- To:
- Subject: Re: [cgal-discuss] Problems using Alpha Shapes
- Date: Tue, 24 May 2011 17:33:20 +0200
Use the Alpha_shape_edges_iterator
This will give you the edges of the alpha shapes,
draw only these edges.
Le 24/05/11 14:22, Markus Eich a écrit :
Dear
all.
I am using CGAL to recover the shape from a 2D point cloud. It
works fine, except that the result always looks like the
screenshot attached. This is due to the fact that the points are
not ordered alpha shape output is not ordered in any way.
Here is the code snipped:
=========================
for(size_t i=0; i<cloud_ptr->points.size(); i++){
Eigen::Vector3f p3d(cloud_ptr->points[i].x,
cloud_ptr->points[i].y,
cloud_ptr->points[i].z);
// subtract all 3D points with a point in the plane
// this will move the origin of the 3D coordinate system
// onto the plane
p3d = p3d - p0;
K::Point_2 p2d(p3d.dot(u),p3d.dot(v));
lp.push_back(p2d);
}
// compute alpha shape
Alpha_shape_2 as(lp.begin(),lp.end());
// find optimal alpha value
Alpha_iterator opt = as.find_optimal_alpha(1);
//as.set_alpha(*opt);
as.set_alpha(0.01);
boost::geometry::polygon_2d sorted_poly;
for(Vertice_iterator it = as.alpha_shape_vertices_begin(); it
!= as.alpha_shape_vertices_end(); it++){
Alpha_shape_2::Vertex_handle vh = *it;
append(sorted_poly,
boost::geometry::make<boost::geometry::point_2d>(vh->point().x(),vh->point().y()));
}
=========================
How can I convert the points that it is ordered (i.e. that only
the nearest points are connected) and that it doesn't look like a
spider web.
Cheers,
Markus
--
Mariette Yvinec
Geometrica project team
INRIA Sophia-Antipolis
|
Archive powered by MHonArc 2.6.16.