pub fn trace_contours(
w: usize,
h: usize,
value: impl Fn(usize, usize) -> f64,
threshold: f64,
) -> Vec<Vec<(f64, f64)>>Expand description
Iso-contours of a scalar field sampled at texel centres (value(i, j) for
texel (i, j), centre at (i + 0.5, j + 0.5)), at threshold, as closed
rings in texel coordinates. Outside the grid the field is 0, so every
contour closes. Linear interpolation along cell edges matches bilinear
texture filtering at the threshold crossing.