CGAL 6.1 - Dynamic Skeletonization Via Variational Medial Axis Sampling
Loading...
Searching...
No Matches
CGAL::Medial_Skeleton< TriangleMesh_, GeomTraits_ > Class Template Reference

#include <CGAL/variational_medial_axis_sampling.h>

Definition

template<typename TriangleMesh_, typename GeomTraits_ = Default>
class CGAL::Medial_Skeleton< TriangleMesh_, GeomTraits_ >

Class representing the medial skeleton of a shape.

This class provides methods to manage and export the medial skeleton of a shape. It stores the medial spheres, edges, and faces of the skeleton.

Template Parameters
TriangleMeshThe type of the triangle mesh representing the shape.
GTThe geometric traits class used for geometric computations. Default:
boost::property_traits<
boost::property_map<TriangleMesh, CGAL::vertex_point_t>::type
>::value_type
Examples
Variational_medial_axis/vmas_free_function_example.cpp.

Public Member Functions

bool load_skeleton_from_ply (std::string &filepath)
 loads a medial skeleton from a PLY file.
 

Accessor methods

const std::vector< Sphere_3 > & vertices () const
 returns the container of vertices, where each vertex is a medial sphere (Sphere_3).
 
const std::vector< std::pair< std::size_t, std::size_t > > & edges () const
 returns the container of edges, where each edge is represented as a pair of indices in the vertices vector.
 
const std::vector< std::array< std::size_t, 3 > > & faces () const
 returns the container of faces, where each face is represented as an array of three indices in the vertices vector.
 
std::size_t number_of_vertices () const
 returns the number of vertices in the medial skeleton.
 
std::size_t number_of_edges () const
 returns the number of edges in the medial skeleton.
 
std::size_t number_of_faces () const
 returns the number of faces in the medial skeleton.
 
void clear ()
 clears the data for the medial skeleton.
 
void set_data (std::vector< Sphere_3 > &&vertices, std::vector< std::pair< std::size_t, std::size_t > > &&edges, std::vector< std::array< std::size_t, 3 > > &&faces)
 sets the data for the medial skeleton.
 

Member Function Documentation

◆ load_skeleton_from_ply()

template<typename TriangleMesh_ , typename GeomTraits_ = Default>
bool CGAL::Medial_Skeleton< TriangleMesh_, GeomTraits_ >::load_skeleton_from_ply ( std::string &  filepath)

loads a medial skeleton from a PLY file.

Parameters
filepathFilepath to the PLY file containing the medial skeleton data.
Returns
True if the skeleton was successfully loaded, false otherwise.

Note: The file format is :

ply
format ascii 1.0
element vertex N
property float x
property float y
property float z
property float radius
element edge M
property int vertex1
property int vertex2
element face K
property list uchar int vertex_indices
end_header
x1 y1 z1 r1
... // N vertices
xn yn zn rn
vx vy
... // M edges
vz vw
3 v1 v2 v3
... // K faces
3 vx vy vz

◆ set_data()

template<typename TriangleMesh_ , typename GeomTraits_ = Default>
void CGAL::Medial_Skeleton< TriangleMesh_, GeomTraits_ >::set_data ( std::vector< Sphere_3 > &&  vertices,
std::vector< std::pair< std::size_t, std::size_t > > &&  edges,
std::vector< std::array< std::size_t, 3 > > &&  faces 
)

sets the data for the medial skeleton.

Parameters
verticesA list of Sphere_3 representing the vertices (medial spheres).
edgesA list of pairs representing the edges, where each pair contains indices of vertices.
facesA list of arrays representing the faces, where each array contains three indices of vertices.