pub fn linear_weight(x1: f64, x2: f64, x: f64) -> f64
Expand description
Calculates the interpolation weight between x1
and x2
for a value x
.
The returned weight w
satisfies y = (1 - w) * y1 + w * y2
when
interpolating ordinates that correspond to abscissas x1
and x2
.
§Panics
Panics if x1 == x2
because the denominator becomes zero.