Skip to main content

lerp

Function lerp 

Source
pub fn lerp(table: &[(f64, f64)], x: f64) -> f64
Expand description

Linear interpolation in a sorted table of (x, y) pairs.

If x is below the first entry, returns the first y value. If x is above the last entry, returns the last y value. Otherwise, linearly interpolates between the two surrounding entries.

§Panics

Panics if table is empty.