Skip to contents

Iso-lines of a grid z (length(x) rows by length(y) columns, z[i, j] at (x[i], y[j])): corners count as above when z > level, crossings are linearly interpolated along cell edges (as grDevices::contourLines), shared edge crossings are computed once, segments are chained into polylines (closed rings repeat their first vertex), saddles are resolved by the cell mean and cells with a missing corner are skipped. Identical to the Python arm morie.fn.isolines.

Usage

IsoLines(x, y, z, levels)

Arguments

x, y

Grid coordinates.

z

Matrix of values.

levels

Contour levels.

Value

List with lines (each level, x, y), length per level and levels.

References

Lorensen, W. E. and Cline, H. E. (1987). Marching cubes: a high resolution 3D surface construction algorithm. Computer Graphics 21, 163-169.

Examples

IsoLines(0:2, 0:2, rbind(c(0, 0, 0), c(0, 2, 0), c(0, 0, 0)), 1)$length
#> [1] 2.828427