Skip to main content

inv_lerp

Function inv_lerp 

Source
pub fn inv_lerp<T: Real>(x: T, a: T, b: T) -> T
Expand description

Inverse linear interpolation: find t such that lerp(a, b, t) == x.

Alias for lerp_inv.

ยงExamples

use mathverse_core::ops::inv_lerp;

assert_eq!(inv_lerp(5.0, 0.0, 10.0), 0.5);
assert_eq!(inv_lerp(0.0, 0.0, 10.0), 0.0);