- The desired number of medial spheres in the resulting skeleton.
- Type: unsigned int
- Default: 100
|
CGAL 6.1 - Dynamic Skeletonization Via Variational Medial Axis Sampling
|
#include <CGAL/Variational_medial_axis_sampling.h>
Algorithm class for extracting a variational medial skeleton from a triangulated surface mesh.
This class takes as input a triangulated surface mesh and iteratively samples the medial axis by optimizing the placement of medial spheres. The result is a non-manifold triangle mesh that captures the medial structure of the shape, consisting of both curve segments (1D) and triangle face patches (2D), derived from the adjacency of clusters associated with each medial sphere.
The process terminates when either the desired number of spheres is reached, or a maximum number of iterations is exceeded.
| TriangleMesh | a model of FaceListGraph |
| ConcurrencyTag | a tag indicating whether the algorithm should run sequentially or in parallel. This determines the execution mode at compile time. Default: CGAL::Sequential_tagValid values: CGAL::Sequential_tag, CGAL::Parallel_tag, CGAL::Parallel_if_available_tag |
| AccelerationType | a tag indicating whether the algorithm should use Kd-tree or BVH as acceleration structure. Default: CGAL::KD_tree_tagValid values: CGAL::KD_tree_tag, CGAL::BVH_tag, |
| GeomTraits | a model of KernelDefault: boost::property_traits<
boost::property_map<TriangleMesh, CGAL::vertex_point_t>::type
>::value_type
|
| VertexPointMap | a model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key and GeomTraits::Point_3 as value type.Default: boost::property_map<TriangleMesh, CGAL::vertex_point_t>::const_type.
|
Public Types | |
| using | Sphere_3 = typename GT::Sphere_3 |
| sphere type | |
| using | FT = typename GT::FT |
| number type | |
Public Member Functions | |
| template<class NamedParameters = parameters::Default_named_parameters> | |
| bool | sample (const NamedParameters &np=parameters::default_values()) |
| computes a static skeleton based on the Variational Medial Axis Sampling method. | |
| bool | update_single_step (bool enable_split=false) |
| updates the medial spheres by performing a single step of the algorithm. | |
| void | update (std::size_t nb_iteration) |
| performs a specified number of algorithm iterations. | |
| bool | add_spheres (int nb_sphere) |
| adds spheres by iteratively splitting existing spheres. | |
| void | add_sphere_by_id (Sphere_ID sphere_id, int nb_iteration=10) |
adds a new sphere by splitting sphere with the id sphere_id. | |
| void | remove_sphere_by_id (Sphere_ID sphere_id, int nb_iteration=10) |
| removes a sphere by its sphere_id. | |
| Medial_skeleton< TriangleMesh, GeomTraits > | skeleton () const |
returns the medial skeleton as a Medial_skeleton object. | |
Constructor | |||||||||||||||||||||||
The constructor of a vmas object.
| |||||||||||||||||||||||
| template<class NamedParameters = parameters::Default_named_parameters> | |||||||||||||||||||||||
| Variational_medial_axis_sampling (const TriangleMesh &tmesh, const NamedParameters &np=parameters::default_values(), const GT >=GT()) | |||||||||||||||||||||||
Parameters | |
| FT | lambda () const |
| returns the lambda parameter for the algorithm. | |
| void | set_lambda (FT lambda) |
sets function for lambda(). | |
| int | number_of_spheres () const |
| returns the desired number of spheres for the algorithm. | |
| void | set_number_of_spheres (int num) |
| sets the desired number of spheres. | |
| int | max_iteration () const |
| returns the maximum number of iterations for the algorithm. | |
| void | set_max_iteration (int max_iter) |
| sets the maximum number of iterations. | |
| void CGAL::Variational_medial_axis_sampling< TriangleMesh, ConcurrencyTag, AccelerationType, GeomTraits, VertexPointMap >::add_sphere_by_id | ( | Sphere_ID | sphere_id, |
| int | nb_iteration = 10 |
||
| ) |
adds a new sphere by splitting sphere with the id sphere_id.
This function is aimed to be called during interactive sessions, where the use can specify a sphere to split and add a new sphere based on the split vertex.
| sphere_id | The ID of the sphere to split. |
| nb_iteration | Number of optimization iterations to perform after adding the sphere (default: 10). |
| bool CGAL::Variational_medial_axis_sampling< TriangleMesh, ConcurrencyTag, AccelerationType, GeomTraits, VertexPointMap >::add_spheres | ( | int | nb_sphere | ) |
adds spheres by iteratively splitting existing spheres.
This function attempts to add the specified number of spheres by running the algorithm with sphere splitting enabled until either the target number is reached or maximum iterations are exceeded.
| nb_sphere | Number of spheres to add |
| FT CGAL::Variational_medial_axis_sampling< TriangleMesh, ConcurrencyTag, AccelerationType, GeomTraits, VertexPointMap >::lambda | ( | ) | const |
returns the lambda parameter for the algorithm.
This parameter controls the balance between the SQEM and Euclidean energy terms. Smaller values encourage the skeleton to extend deeper into local geometric features of the shape.
| int CGAL::Variational_medial_axis_sampling< TriangleMesh, ConcurrencyTag, AccelerationType, GeomTraits, VertexPointMap >::max_iteration | ( | ) | const |
returns the maximum number of iterations for the algorithm.
In case the algorithm does not converge, it will stop after this number of iterations.
| void CGAL::Variational_medial_axis_sampling< TriangleMesh, ConcurrencyTag, AccelerationType, GeomTraits, VertexPointMap >::remove_sphere_by_id | ( | Sphere_ID | sphere_id, |
| int | nb_iteration = 10 |
||
| ) |
removes a sphere by its sphere_id.
This function is aimed to be called during interactive sessions, where the user can specify a sphere to remove.
| sphere_id | The ID of the sphere to remove. |
| nb_iteration | Number of optimization iterations to perform after removing the sphere (default: 10). |
| bool CGAL::Variational_medial_axis_sampling< TriangleMesh, ConcurrencyTag, AccelerationType, GeomTraits, VertexPointMap >::sample | ( | const NamedParameters & | np = parameters::default_values() | ) |
computes a static skeleton based on the Variational Medial Axis Sampling method.
| NamedParameters | a sequence of Named Parameters |
| np | an optional sequence of Named Parameters, listed below: |
| |
| |
| |
| |
| |
|
| void CGAL::Variational_medial_axis_sampling< TriangleMesh, ConcurrencyTag, AccelerationType, GeomTraits, VertexPointMap >::set_lambda | ( | FT | lambda | ) |
sets function for lambda().
Note: The value of lambda must be strictly positive; if set to zero, it will default to 0.2.
| Medial_skeleton< TriangleMesh, GeomTraits > CGAL::Variational_medial_axis_sampling< TriangleMesh, ConcurrencyTag, AccelerationType, GeomTraits, VertexPointMap >::skeleton | ( | ) | const |
returns the medial skeleton as a Medial_skeleton object.
This function builds a medial skeleton from the current state of the medial sphere mesh. It extracts the vertices, edges, and faces from the medial sphere mesh and constructs the medial skeleton accordingly.
Medial_skeleton object containing the medial skeleton data. | void CGAL::Variational_medial_axis_sampling< TriangleMesh, ConcurrencyTag, AccelerationType, GeomTraits, VertexPointMap >::update | ( | std::size_t | nb_iteration | ) |
performs a specified number of algorithm iterations.
This function allows manual control over the algorithm execution, performing only position optimization without sphere splitting.
| nb_iteration | Number of iterations to perform |
| bool CGAL::Variational_medial_axis_sampling< TriangleMesh, ConcurrencyTag, AccelerationType, GeomTraits, VertexPointMap >::update_single_step | ( | bool | enable_split = false | ) |
updates the medial spheres by performing a single step of the algorithm.
This function performs one iteration of the algorithm, updating sphere positions and computing errors. It can optionally enable sphere splitting based on convergence criteria.
| enable_split | If true, allows sphere splitting based on convergence criteria. |
truet if the algorithm has converged,false` otherwise.