pub struct SpringState1D {
pub position: f64,
pub velocity: f64,
pub target: f64,
}Expand description
State of a 1D spring simulation.
Fields§
§position: f64§velocity: f64§target: f64Implementations§
Source§impl SpringState1D
impl SpringState1D
Sourcepub const fn new(position: f64, velocity: f64, target: f64) -> Self
pub const fn new(position: f64, velocity: f64, target: f64) -> Self
Creates a new SpringState1D.
Sourcepub fn evaluate_at(&self, config: &SpringConfig, t: f64) -> (f64, f64, bool)
pub fn evaluate_at(&self, config: &SpringConfig, t: f64) -> (f64, f64, bool)
Closed-form analytical evaluation at time t seconds into the future.
Sourcepub fn step(&mut self, config: &SpringConfig, dt: f64) -> bool
pub fn step(&mut self, config: &SpringConfig, dt: f64) -> bool
Advance the state by dt seconds using the closed-form equation.
Trait Implementations§
Source§impl Clone for SpringState1D
impl Clone for SpringState1D
impl Copy for SpringState1D
Source§impl Debug for SpringState1D
impl Debug for SpringState1D
Source§impl PartialEq for SpringState1D
impl PartialEq for SpringState1D
impl StructuralPartialEq for SpringState1D
Auto Trait Implementations§
impl Freeze for SpringState1D
impl RefUnwindSafe for SpringState1D
impl Send for SpringState1D
impl Sync for SpringState1D
impl Unpin for SpringState1D
impl UnsafeUnpin for SpringState1D
impl UnwindSafe for SpringState1D
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