1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/// Trait for immutable simulation snapshots supporting smooth discontinuity-safe render interpolation. pub trait InterpolatableState: Clone { /// Interpolates between `self` (previous fixed-step snapshot) and `next` (current fixed-step snapshot) at `alpha` in `[0.0, 1.0]`. /// /// # Arguments /// /// - `&Self` - Previous immutable simulation snapshot (`t - dt`). /// - `&Self` - Current immutable simulation snapshot (`t`). /// - `f32` - Render interpolation factor clamped to `[0.0, 1.0]`. /// /// # Returns /// /// - `Self` - Smoothly interpolated state for rendering without interpolating discontinuous events. #[must_use] fn interpolate(&self, next: &Self, alpha: f32) -> Self; }