pymcfs¶
Mean-curvature flow skeletonization (MCFS) of closed 3D triangle meshes in Python. Inspired by CGAL Triangulated Surface Mesh Skeletonization and Tagliasacchi et al. (SGP 2012).
Import and call — there is no CLI.
import trimesh as tm
from pymcfs import skeletonize
mesh = tm.load("mesh.obj", force="mesh", process=False)
skel = skeletonize(mesh)
skel.write_polylines("skeleton.polylines.txt")
What it does¶
- Contract the surface with a weighted mean-curvature solve (optional Voronoi-pole medial term).
- Remesh locally (collapse short edges, split obtuse faces).
- Pin formed branch tips.
- Convert the thin meso-surface into a 1D curve skeleton.
- Optionally refine (prune / tip extension / resample) and score the result.
Where to go¶
- Install — core, CHOLMOD, viz, Embree
- Quick start — first skeleton in a few lines
- Meshes and validation — input requirements and repair
- Profiles and weights —
robust/starlab/auto - Parameter proposals — mesh-conditioned weights
- Refine and quality — prune, score, analyze
- Parameter search — automatic nearby-weight trials
- Export and I/O — polylines,
.cg, plotting - Algorithm — how MCFS is implemented here
- API reference — public functions and classes
Design notes¶
- Coordinates are not normalized; skeletons stay in the input frame.
- Default profile (
robust) targets complex tubular surfaces with pole gating. propose_mcfs_params/profile="auto"defaults tobranching="sparse"(fewer junctions).- Exact float64 point-in-mesh gating is the default; Embree is opt-in only.