glam/f64/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 f64 {
6 #[inline]
7 fn lerp(self, rhs: f64, t: f64) -> f64 {
8 self + (rhs - self) * t
9 }
10
11 #[inline]
12 fn inverse_lerp(a: f64, b: f64, v: f64) -> f64 {
13 (v - a) / (b - a)
14 }
15
16 #[inline]
17 fn remap(self, in_start: f64, in_end: f64, out_start: f64, out_end: f64) -> f64 {
18 let t = f64::inverse_lerp(in_start, in_end, self);
19 f64::lerp(out_start, out_end, t)
20 }
21}