# Iterate on the vertices of a skeleton in order

3 messages
Open this post in threaded view
|

## Iterate on the vertices of a skeleton in order

 Hi, Is there a way to iterate over vertices of a skeleton in order? I'm trying with this code but the outputs points are not in order: typedef CGAL::Mean_curvature_flow_skeletonization Skeletonization; typedef Skeletonization::Skeleton                             Skeleton; typedef Skeleton::vertex_descriptor                           Skeleton_vertex; Skeleton skeleton; CGAL::extract_mean_curvature_flow_skeleton(*mesh, skeleton); BOOST_FOREACH(Skeleton_vertex v, vertices(skeleton) )   {     const Point& pts = skeleton[v].point;     skel_pt.push_back(pts);    } thanks! -- Sent from: http://cgal-discuss.949826.n4.nabble.com/-- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss
Open this post in threaded view
|

## Re: Iterate on the vertices of a skeleton in order

 The skeleton is a graph following the graph concepts from boost. So you can pick a vertex an navigate in the graph using the free functions defined in the boost concept. See http://www.boost.org/doc/libs/release/libs/graph/doc/adjacency_list.htmlIf you want something more structured, have a look at this example: https://doc.cgal.org/latest/Surface_mesh_skeletonization/Surface_mesh_skeletonization_2simple_mcfskel_example_8cpp-example.htmlWe are using the function CGAL::split_graph_into_polylines() and the struct Display_polylines to get all polylines made of nodes of degree 2 but at their end point. Maybe you can modify Display_polylines to do what you want to do. HTH, Sebastien On 09/13/2018 06:10 PM, Annie-Pier L. wrote: > Hi, > > Is there a way to iterate over vertices of a skeleton in order? I'm trying > with this code but the outputs points are not in order: > > typedef CGAL::Mean_curvature_flow_skeletonization > Skeletonization; > typedef Skeletonization::Skeleton                             Skeleton; > typedef Skeleton::vertex_descriptor > Skeleton_vertex; > > Skeleton skeleton; > CGAL::extract_mean_curvature_flow_skeleton(*mesh, skeleton); > > BOOST_FOREACH(Skeleton_vertex v, vertices(skeleton) ) >    { >      const Point& pts = skeleton[v].point; >      skel_pt.push_back(pts); >     } > > thanks! > > > > -- > Sent from: http://cgal-discuss.949826.n4.nabble.com/> -- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss
Open this post in threaded view
|

## Re: Iterate on the vertices of a skeleton in order

 Thank you very much. That helped me a lot! -- Sent from: http://cgal-discuss.949826.n4.nabble.com/-- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss