Skip to main content

iso_lines

Function iso_lines 

Source
pub fn iso_lines(grid: &ScalarGrid, threshold: f64) -> Vec<ClosedPath>
Available on crate feature geometry only.
Expand description

The closed paths along which the grid crosses threshold.

A node is inside when its value is above threshold (a NaN is outside). Crossings between two nodes are placed by linear interpolation; a crossing to the virtual ring around the grid sits half a cell outside it. A saddle is joined when the mean of its four corners is above threshold.

Each path has the inside on its left: outer boundaries run counter-clockwise (positive signed_area), holes clockwise. No vertex repeats within a path and no path has fewer than three vertices or zero area: where a line touches itself at a node holding exactly threshold, it is cut there into separate loops. Paths start at the vertex that comes first in row-major order of the crossing edges (horizontal edges of a row before its vertical edges) and are listed in that order, except that a loop cut off at a pinch starts at the pinch vertex and is listed before the rest of its line. The cost is linear in the count of nodes.

ยงPanics

When grid.values.len() != grid.cols * grid.rows.