glam/f32/
float.rs

1// Generated from float.rs.tera template. Edit the template, not the generated file.
2
3use crate::float::FloatExt;
4
5impl FloatExt for f32 {
6    #[inline]
7    fn lerp(self, rhs: f32, t: f32) -> f32 {
8        self + (rhs - self) * t
9    }
10
11    #[inline]
12    fn inverse_lerp(a: f32, b: f32, v: f32) -> f32 {
13        (v - a) / (b - a)
14    }
15
16    #[inline]
17    fn remap(self, in_start: f32, in_end: f32, out_start: f32, out_end: f32) -> f32 {
18        let t = f32::inverse_lerp(in_start, in_end, self);
19        f32::lerp(out_start, out_end, t)
20    }
21}