I never used CGAL and had little or no experience in C / C ++. But following Google, however, I managed to put together the example "Alpha_shapes_3" (\ CGAL-4.1-beta1 \ examples \ Alpha_shapes_3) on a 64-bit Windows 7 machine using visual studio 2010.

Now, if we check the source code of the program "ex_alpha_shapes_3", we notice that the data file called "bunny_1000" is red, where the 3D point is a cluster. Now my question is: how to change the source code so that after the alpha form is calculated for the given points, the surface mesh of the alpha form is saved / written in an external file. It can be just a list of polygons and their corresponding three-dimensional vertices. I think that these polygons will determine the alpha surface mesh. If I can do this, I can see the output of the alpha form generation program in an external tool that I am familiar with.
I know this is very simple, but I could not figure it out with my limited knowledge of CGAL. A.
I know you have gueys code, but I am pasting it again to complete.
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Delaunay_triangulation_3.h> #include <CGAL/Alpha_shape_3.h> #include <fstream> #include <list> #include <cassert> typedef CGAL::Exact_predicates_inexact_constructions_kernel Gt; typedef CGAL::Alpha_shape_vertex_base_3<Gt> Vb; typedef CGAL::Alpha_shape_cell_base_3<Gt> Fb; typedef CGAL::Triangulation_data_structure_3<Vb,Fb> Tds; typedef CGAL::Delaunay_triangulation_3<Gt,Tds> Triangulation_3; typedef CGAL::Alpha_shape_3<Triangulation_3> Alpha_shape_3; typedef Gt::Point_3 Point; typedef Alpha_shape_3::Alpha_iterator Alpha_iterator; int main() { std::list<Point> lp; //read input std::ifstream is("./data/bunny_1000"); int n; is >> n; std::cout << "Reading " << n << " points " << std::endl; Point p; for( ; n>0 ; n--) { is >> p; lp.push_back(p); } // compute alpha shape Alpha_shape_3 as(lp.begin(),lp.end()); std::cout << "Alpha shape computed in REGULARIZED mode by default" << std::endl; // find optimal alpha value Alpha_iterator opt = as.find_optimal_alpha(1); std::cout << "Optimal alpha value to get one connected component is " << *opt << std::endl; as.set_alpha(*opt); assert(as.number_of_solid_components() == 1); return 0; }
After much searching on the Internet, I found that we probably need to use something like
std::list<Facet> facets; alpha_shape.get_alpha_shape_facets ( std::back_inserter(facets),Alpha_shape::REGULAR );
But I still donβt know at all how to use this in the above code!
source share