pub struct SpringTimeStep<F> { /* private fields */ }Expand description
Cached coefficients for a spring, based on its configuration and a particular time step.
Used to efficiently update one or more springs that share the same configuration.
§Usage
To derive a SpringTimeStep, you must first get a SpringParams from a SpringConfig:
// configure your spring...
let config = SpringConfig::new(5.0, 0.75);
let mut spring = Spring::new();
// derive its state
let state = SpringParams::from(config);
// then, either create your own `SpringTimeStep`...
let time_step = SpringTimeStep::new(state, delta_time);
spring.update(time_step);
// or let `Spring::update_single` do it for you
spring.update_single(state, delta_time);Implementations§
Source§impl<F: Float> SpringTimeStep<F>
impl<F: Float> SpringTimeStep<F>
Sourcepub fn new(state: impl Into<SpringParams<F>>, delta: F) -> Self
pub fn new(state: impl Into<SpringParams<F>>, delta: F) -> Self
Derive a spring time step from a particular delta time.
Sourcepub fn update_many(self, springs: &mut [&mut Spring<F>])
pub fn update_many(self, springs: &mut [&mut Spring<F>])
Update multiple springs using this time step. Simply calls Spring::update
on each passed spring.
Trait Implementations§
Source§impl<F: Clone> Clone for SpringTimeStep<F>
impl<F: Clone> Clone for SpringTimeStep<F>
Source§fn clone(&self) -> SpringTimeStep<F>
fn clone(&self) -> SpringTimeStep<F>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<F: Debug> Debug for SpringTimeStep<F>
impl<F: Debug> Debug for SpringTimeStep<F>
Source§impl<F: Float> Default for SpringTimeStep<F>
impl<F: Float> Default for SpringTimeStep<F>
Source§impl<F: PartialEq> PartialEq for SpringTimeStep<F>
impl<F: PartialEq> PartialEq for SpringTimeStep<F>
impl<F: Copy> Copy for SpringTimeStep<F>
impl<F> StructuralPartialEq for SpringTimeStep<F>
Auto Trait Implementations§
impl<F> Freeze for SpringTimeStep<F>where
F: Freeze,
impl<F> RefUnwindSafe for SpringTimeStep<F>where
F: RefUnwindSafe,
impl<F> Send for SpringTimeStep<F>where
F: Send,
impl<F> Sync for SpringTimeStep<F>where
F: Sync,
impl<F> Unpin for SpringTimeStep<F>where
F: Unpin,
impl<F> UnwindSafe for SpringTimeStep<F>where
F: UnwindSafe,
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