Skip to main content

clamped_lerp

Function clamped_lerp 

Source
pub fn clamped_lerp<T>(min: T, max: T, factor: T) -> T
where T: Add<Output = T> + Copy + From<f32> + Mul<Output = T> + PartialOrd + Sub<Output = T>,
Expand description

Clamped linear interpolation.

Clamps the interpolation factor to [0, 1] before interpolating.

Java reference: Mth.clampedLerp(double, double, double). Note: Vanilla’s parameter order is (factor, min, max), ours is (min, max, factor).