pub struct SpringCollection<F, const N: usize> { /* private fields */ }Expand description
A fixed-size collection of springs that all share the same spring parameters. Useful for creating springs over multiple dimensions (i.e. 2D or 3D springs).
Implementations§
Source§impl<F: Float, const N: usize> SpringCollection<F, N>
impl<F: Float, const N: usize> SpringCollection<F, N>
Sourcepub fn from_equilibrium(
params: impl Into<SpringParams<F>>,
equilibrium: F,
) -> Self
pub fn from_equilibrium( params: impl Into<SpringParams<F>>, equilibrium: F, ) -> Self
Construct N springs, all starting at a specified equilibrium.
Sourcepub fn from_equilibriums(
params: impl Into<SpringParams<F>>,
equilibriums: [F; N],
) -> Self
pub fn from_equilibriums( params: impl Into<SpringParams<F>>, equilibriums: [F; N], ) -> Self
Construct N springs, each with a particular equilibrium.
Sourcepub fn update(&mut self, delta: F)
pub fn update(&mut self, delta: F)
Update all springs over the specified delta. Constructs a new SpringTimeStep
for this usage.
Sourcepub fn update_with(&mut self, time_step: SpringTimeStep<F>)
pub fn update_with(&mut self, time_step: SpringTimeStep<F>)
Update all springs using the specified time_step.
Note: this time step need not be derived from SpringCollection::params.
The implementation of this method uses all constants from time_step.
Source§impl<F: Float, const N: usize> SpringCollection<F, N>
impl<F: Float, const N: usize> SpringCollection<F, N>
Source§impl<F: Float, const N: usize> SpringCollection<F, N>
impl<F: Float, const N: usize> SpringCollection<F, N>
Sourcepub fn velocities(&self) -> &[F; N]
pub fn velocities(&self) -> &[F; N]
The array of current spring $plural.
Sourcepub fn velocities_mut(&mut self) -> &mut [F; N]
pub fn velocities_mut(&mut self) -> &mut [F; N]
Mutable reference of current spring velocities.
Source§impl<F: Float, const N: usize> SpringCollection<F, N>
impl<F: Float, const N: usize> SpringCollection<F, N>
Sourcepub fn equilibriums(&self) -> &[F; N]
pub fn equilibriums(&self) -> &[F; N]
The array of current spring $plural.
Sourcepub fn equilibriums_mut(&mut self) -> &mut [F; N]
pub fn equilibriums_mut(&mut self) -> &mut [F; N]
Mutable reference of current spring equilibriums.
Trait Implementations§
Source§impl<F: Clone, const N: usize> Clone for SpringCollection<F, N>
impl<F: Clone, const N: usize> Clone for SpringCollection<F, N>
Source§fn clone(&self) -> SpringCollection<F, N>
fn clone(&self) -> SpringCollection<F, N>
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: Float, const N: usize> From<SpringCollection<F, N>> for [Spring<F>; N]
impl<F: Float, const N: usize> From<SpringCollection<F, N>> for [Spring<F>; N]
Source§fn from(value: SpringCollection<F, N>) -> Self
fn from(value: SpringCollection<F, N>) -> Self
Converts to this type from the input type.
Source§impl<F: Float, const N: usize, T> From<T> for SpringCollection<F, N>where
T: Into<SpringParams<F>>,
impl<F: Float, const N: usize, T> From<T> for SpringCollection<F, N>where
T: Into<SpringParams<F>>,
impl<F, const N: usize> StructuralPartialEq for SpringCollection<F, N>
Auto Trait Implementations§
impl<F, const N: usize> Freeze for SpringCollection<F, N>where
F: Freeze,
impl<F, const N: usize> RefUnwindSafe for SpringCollection<F, N>where
F: RefUnwindSafe,
impl<F, const N: usize> Send for SpringCollection<F, N>where
F: Send,
impl<F, const N: usize> Sync for SpringCollection<F, N>where
F: Sync,
impl<F, const N: usize> Unpin for SpringCollection<F, N>where
F: Unpin,
impl<F, const N: usize> UnwindSafe for SpringCollection<F, N>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