#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Mean_curvature_flow_skeletonization.h>
#include <fstream>
typedef boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
typedef Skeletonization::Skeleton Skeleton;
typedef Skeleton::vertex_descriptor Skeleton_vertex;
typedef Skeleton::edge_descriptor Skeleton_edge;
int main(int argc, char* argv[])
{
std::ifstream input((argc>1)?argv[1]:"data/elephant.off");
Polyhedron tmesh;
input >> tmesh;
Skeleton skeleton;
Skeletonization mcs(tmesh);
mcs.contract_geometry();
mcs.collapse_edges();
mcs.split_faces();
mcs.detect_degeneracies();
mcs.contract();
mcs.contract_until_convergence();
mcs.convert_to_skeleton(skeleton);
std::cout << "Number of vertices of the skeleton: " << boost::num_vertices(skeleton) << "\n";
std::cout << "Number of edges of the skeleton: " << boost::num_edges(skeleton) << "\n";
std::ofstream output("skel.cgal");
BOOST_FOREACH(Skeleton_edge e,
edges(skeleton))
{
const Point& s = skeleton[
source(e, skeleton)].point;
const Point& t = skeleton[
target(e, skeleton)].point;
output << "2 "<< s << " " << t << "\n";
}
output.close();
output.open("correspondance.cgal");
BOOST_FOREACH(Skeleton_vertex v,
vertices(skeleton))
BOOST_FOREACH(vertex_descriptor vd, skeleton[v].
vertices)
return 0;
}