pub struct SpringConfig {
pub mass: f64,
pub stiffness: f64,
pub damping: f64,
}Expand description
Spring physics configuration.
Fields§
§mass: f64Mass of the object (affects inertia)
stiffness: f64Stiffness of the spring (affects speed)
damping: f64Damping coefficient (affects bounciness)
Implementations§
Source§impl SpringConfig
impl SpringConfig
Sourcepub const fn custom(mass: f64, stiffness: f64, damping: f64) -> Self
pub const fn custom(mass: f64, stiffness: f64, damping: f64) -> Self
Create custom spring config.
Sourcepub fn damping_ratio(&self) -> f64
pub fn damping_ratio(&self) -> f64
Calculate damping ratio.
Sourcepub fn is_underdamped(&self) -> bool
pub fn is_underdamped(&self) -> bool
Whether spring is underdamped (will oscillate).
Sourcepub fn is_critically_damped(&self) -> bool
pub fn is_critically_damped(&self) -> bool
Whether spring is critically damped (fastest without oscillation).
Sourcepub fn is_overdamped(&self) -> bool
pub fn is_overdamped(&self) -> bool
Whether spring is overdamped (slow, no oscillation).
Trait Implementations§
Source§impl Clone for SpringConfig
impl Clone for SpringConfig
Source§fn clone(&self) -> SpringConfig
fn clone(&self) -> SpringConfig
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 Debug for SpringConfig
impl Debug for SpringConfig
Source§impl Default for SpringConfig
impl Default for SpringConfig
Source§impl PartialEq for SpringConfig
impl PartialEq for SpringConfig
impl Copy for SpringConfig
impl StructuralPartialEq for SpringConfig
Auto Trait Implementations§
impl Freeze for SpringConfig
impl RefUnwindSafe for SpringConfig
impl Send for SpringConfig
impl Sync for SpringConfig
impl Unpin for SpringConfig
impl UnwindSafe for SpringConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().