marching-cubes
A Rust implementation of the marching cubes algorithm for extracting isosurfaces from 3D volumetric data.
Features
- Fast and efficient
- Commonly used in computer graphics, medical imaging, and scientific visualization
Examples
use ;
let grid = GridCell ;
let mut triangles = vec!;
let isolevel = 0.5;
let mc = new;
let triangle_count = mc.polygonise;
assert_eq!;
Usage
The MarchingCubes struct is the main entry point to the library.
- The
newmethod creates a new instance of the algorithm and takes two arguments: the 3D volumetric data as a nested array of scalar values and the isovalue used to extract the isosurface. - The
polygonisemethod executes the algorithm and returns the resulting vertices as a vector of 3D points.
Note: The example code uses a 4x4x4 volume for simplicity, but in practice the volume size can be much larger and the algorithm will scale accordingly.