Skip to main content

Module marching_cubes

Module marching_cubes 

Source
Expand description

Marching cubes isosurface extraction from 3D scalar fields.

Converts a scalar field (orbital ψ or density ρ) into a triangle mesh at a specified isovalue. Reference: Lorensen & Cline, SIGGRAPH 1987.

GPU path: dispatches a WGSL compute shader that processes each voxel independently, then reads back the generated triangle vertices. CPU path: triple-nested loop (always available as fallback).

Structs§

McOutput
Triangle mesh output from marching cubes.

Functions§

marching_cubes_cpu
CPU marching cubes on a 3D scalar field.
marching_cubes_gpu
GPU dispatch for marching cubes isosurface extraction.
marching_cubes_with_report
Marching cubes with automatic GPU/CPU backend selection.
smooth_mesh_normals
Smooth vertex normals by averaging at shared positions.