pub struct MonoSpline { /* private fields */ }Expand description
A monotone cubic Hermite spline for C1-continuous interpolation of f32 values.
Uses the Fritsch–Carlson method to compute tangents that preserve monotonicity
and prevent overshoot. Based on Android Compose’s MonoSpline.
Implementations§
Source§impl MonoSpline
impl MonoSpline
Sourcepub fn new(times: Vec<f32>, values: Vec<f32>) -> Self
pub fn new(times: Vec<f32>, values: Vec<f32>) -> Self
Build a spline from keyframe times and values. Times must be sorted ascending and have at least 2 entries. Values must have the same length as times.
Degenerate segments (duplicate/unsorted/non-finite times) are coerced
to zero slope instead of producing inf/NaN tangents: dividing by a
zero dt in f32 arithmetic does not panic, it silently corrupts every
later evaluation, so the constructor sanitizes here.
Trait Implementations§
Source§impl Clone for MonoSpline
impl Clone for MonoSpline
Auto Trait Implementations§
impl Freeze for MonoSpline
impl RefUnwindSafe for MonoSpline
impl Send for MonoSpline
impl Sync for MonoSpline
impl Unpin for MonoSpline
impl UnsafeUnpin for MonoSpline
impl UnwindSafe for MonoSpline
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more