A Python visualisation of the Cubical Marching Squares (CMS) isosurface-extraction algorithm running on a uniform voxel grid.
- Evaluates a signed-distance field (SDF) on a regular 3-D grid.
- Runs Marching Squares independently on each cell face to find isosurface contour segments and Hermite data.
- Connects per-face feature points into closed 3-D loops (the mesh edges).
- Displays the result interactively with matplotlib (drag to rotate, scroll to zoom).
| Symbol | Meaning |
|---|---|
| Blue filled circles | Inside corners (SDF < 0) |
| Orange open circles | Outside corners (SDF ≥ 0) |
| Green arrows | Surface normals near the isosurface |
| Grey wireframe | Cell grid |
- Python 3.10+
numpymatplotlib
pip install numpy matplotlibpython cms_uniform_grid.py [--sdf <shape>]--sdf choices: box (default), sphere, torus, combo, smooth_union
python cms_uniform_grid.py --sdf torus