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