Skip to content

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

  1. Contract the surface with a weighted mean-curvature solve (optional Voronoi-pole medial term).
  2. Remesh locally (collapse short edges, split obtuse faces).
  3. Pin formed branch tips.
  4. Convert the thin meso-surface into a 1D curve skeleton.
  5. Optionally refine (prune / tip extension / resample) and score the result.

Where to go

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 to branching="sparse" (fewer junctions).
  • Exact float64 point-in-mesh gating is the default; Embree is opt-in only.