I'm trying to get the intermediate skeleton from the skeletonization tool of CGAL with the Meso_skeleton class.
The problem is that I want to iterate over its vertices and faces but I can't understand what class is the iterator and so I'm getting compiling errors (also the keyword auto doesn't seem to work in the iterator, giving compile errors because the compiler cannot interfer the type).
Also, it seems that the CGAL documentation is laking of info about how to use the Meso_skeleton class so if someone knows a place where I can find some other info would be great.
The code that I'm trying to run is like this:
Skeleton skeleton;
Skeletonization mcs(tmesh);
Triangle_mesh contractedMesh; // prova a creare una nuova mesh dalla Skeletonization
mcs.set_is_medially_centered(true);
// 1. Contract the mesh by mean curvature flow.
mcs.contract_geometry();
// 2. Collapse short edges and split bad triangles.
mcs.collapse_edges();
mcs.split_faces();
// 3. Fix degenerate vertices.
mcs.detect_degeneracies();
// Perform the above three steps in one iteration.
mcs.contract();
auto meso = mcs.meso_skeleton();
output.open("verticesTest.cgal");
int number_of_vertices = 0;
CGAL::Polyhedron_3<Kernel>::Vertex_iterator ptr;
for( ptr = meso.vertices_begin; ptr != meso.vertices_end; ptr++)
{
output << ptr->point << std::endl;
++number_of_vertices;
}
The aim of this code is to export the vertex and the faces of a meso_skeleton from the intermediate steps of the Skeletonization tool of CGAL ( mean_curvature_flow_skeleton ). Let me know if it's possibile to write a better solution ( maybe with some functions of CGAL that i'm ignoring ).
Thanks