Skip to main content

Module linear

Module linear 

Source
Expand description

Piecewise linear interpolation and the pillar bracketing shared by curves and smiles.

Functions§

bracket
Bracket x in the sorted pillar grid xs: returns (idx, w) where xs[idx - 1] <= x <= xs[idx] and w is the weight of the upper pillar. x is clamped to the grid, so idx is always in [1, xs.len() - 1] and w in [0, 1].
interp_pairs
linear_interp over (x, y) pairs sorted by x — the smile storage shape.
lerp
Linear blend a + w (b - a).
linear_interp
Piecewise linear interpolation of (xs, ys) at x, flat beyond the ends. xs must be sorted strictly increasing.