compas_cgal.skeletonization
¤
Functions¤
mesh_skeleton
¤
mesh_skeleton(mesh: VerticesFaces) -> PolylinesNumpySkeleton
Compute the geometric skeleton of a triangle mesh using mean curvature flow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
VerticesFaces
|
A tuple containing: * vertices: Nx3 array of vertex coordinates * faces: Mx3 array of vertex indices |
required |
Returns:
| Type | Description |
|---|---|
PolylinesNumpySkeleton
|
List of polylines representing the skeleton edges. Each polyline is a tuple of start and end point coordinates. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the input mesh is not a tuple of vertices and faces. |
ValueError
|
If the vertices array is not Nx3. If the faces array is not Mx3. If the face indices are out of range. If the mesh is not manifold and closed. |
RuntimeError
|
If the mesh contraction fails to converge. |
Notes
The input mesh must be manifold and closed. The skeleton is computed using mean curvature flow.
mesh_skeleton_with_mapping
¤
mesh_skeleton_with_mapping(
mesh: VerticesFaces,
) -> tuple[PolylinesNumpySkeleton, SkeletonVertexMapping]
Compute the geometric skeleton of a triangle mesh with vertex correspondence mapping.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
VerticesFaces
|
A tuple containing: * vertices: Nx3 array of vertex coordinates * faces: Mx3 array of vertex indices |
required |
Returns:
| Type | Description |
|---|---|
PolylinesSkeletonWithMapping
|
A tuple containing: * edges: List of polylines representing the skeleton edges. Each polyline is a tuple of start and end point coordinates. * vertex_indices: List of tuples, each containing two lists of vertex indices corresponding to the start and end vertices of each skeleton edge. These are the original mesh vertices that contracted to form each skeleton vertex. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the input mesh is not a tuple of vertices and faces. |
ValueError
|
If the vertices array is not Nx3. If the faces array is not Mx3. If the face indices are out of range. If the mesh is not manifold and closed. |
RuntimeError
|
If the mesh contraction fails to converge. |
Notes
The input mesh must be manifold and closed. The skeleton is computed using mean curvature flow. Each skeleton vertex corresponds to a set of original mesh vertices that were contracted to that point during the skeletonization process. (The set might be empty for some skeleton vertices that don't correspond to any original vertex.)