Move curve_sin to interpolation module

This commit is contained in:
Danny McGee
2023-10-13 18:04:39 -04:00
parent 2c4dfec839
commit f9a3031085
2 changed files with 9 additions and 11 deletions
+9 -1
View File
@@ -1,4 +1,4 @@
use std::ops;
use std::{f32::consts, ops};
use super::NearlyEq;
@@ -52,3 +52,11 @@ where
t.lerp(to.0, to.1)
}
}
/// Fit a [0, 1] `t` interpolation parameter to a sine curve
///
/// https://www.desmos.com/calculator/k9x4c4cr5y
#[inline]
pub fn curve_sin(t: f32) -> f32 {
-1. * (f32::cos(t * consts::PI) / 2.) + 0.5
}
-10
View File
@@ -1,5 +1,3 @@
use std::f32::consts;
use bevy::prelude::Vec3;
pub trait NearlyEq<Rhs> {
@@ -17,11 +15,3 @@ impl NearlyEq<Vec3> for Vec3 {
self.x.nearly_eq(rhs.x) && self.y.nearly_eq(rhs.y) && self.z.nearly_eq(rhs.z)
}
}
/// Fit a [0, 1] `t` interpolation parameter to a sine curve
///
/// https://www.desmos.com/calculator/k9x4c4cr5y
#[inline]
pub fn curve_sin(t: f32) -> f32 {
-1. * (f32::cos(t * consts::PI) / 2.) + 0.5
}