Skip to main content

marching_cubes

Function marching_cubes 

Source
pub fn marching_cubes(
    sdf: &dyn ImplicitSurface,
    bounds: [[f64; 2]; 3],
    resolution: usize,
) -> (Vec<[f64; 3]>, Vec<[usize; 3]>)
Expand description

Extract an isosurface from an implicit SDF using the Marching Cubes algorithm.

§Arguments

  • sdf — any type implementing ImplicitSurface
  • bounds — axis-aligned bounding box as [[xmin,xmax\], [ymin,ymax], [zmin,zmax]]
  • resolution — number of grid cells per axis

§Returns

A tuple (vertices, triangles) where each vertex is [x, y, z] and each triangle is [i0, i1, i2] (indices into vertices).