pub struct SpringCoefficients<N> {
pub natural_frequency: N,
pub damping_ratio: N,
}Expand description
Coefficients for a spring, typically used for configuring constraint softness for contacts and joints.
Fields§
§natural_frequency: NSets the natural frequency (Hz) of the spring-like constraint.
Higher values make the constraint stiffer and resolve constraint violations more quickly.
damping_ratio: NSets the damping ratio for the spring-like constraint.
Larger values make the joint more compliant (allowing more drift before stabilization).
Implementations§
Source§impl<N: SimdRealField<Element = f32> + Copy> SpringCoefficients<N>
impl<N: SimdRealField<Element = f32> + Copy> SpringCoefficients<N>
Sourcepub fn new(natural_frequency: N, damping_ratio: N) -> Self
pub fn new(natural_frequency: N, damping_ratio: N) -> Self
Initializes spring coefficients from the spring natural frequency and damping ratio.
Sourcepub fn contact_defaults() -> Self
pub fn contact_defaults() -> Self
Default softness coefficients for contacts.
Sourcepub fn joint_defaults() -> Self
pub fn joint_defaults() -> Self
Default softness coefficients for joints.
Sourcepub fn angular_frequency(&self) -> N
pub fn angular_frequency(&self) -> N
The contact’s spring angular frequency for constraints regularization.
Sourcepub fn erp_inv_dt(&self, dt: N) -> N
pub fn erp_inv_dt(&self, dt: N) -> N
The Self::erp coefficient, multiplied by the inverse timestep length.
Sourcepub fn erp(&self, dt: N) -> N
pub fn erp(&self, dt: N) -> N
The effective Error Reduction Parameter applied for calculating regularization forces.
This parameter is computed automatically from Self::natural_frequency,
Self::damping_ratio and the substep length.
Sourcepub fn cfm_coeff(&self, dt: N) -> N
pub fn cfm_coeff(&self, dt: N) -> N
Compute CFM assuming a critically damped spring multiplied by the damping ratio.
This coefficient softens the impulse applied at each solver iteration.
Sourcepub fn cfm_factor(&self, dt: N) -> N
pub fn cfm_factor(&self, dt: N) -> N
The CFM factor to be used in the constraint resolution.
This parameter is computed automatically from Self::natural_frequency,
Self::damping_ratio and the substep length.
Trait Implementations§
Source§impl<N: Clone> Clone for SpringCoefficients<N>
impl<N: Clone> Clone for SpringCoefficients<N>
Source§fn clone(&self) -> SpringCoefficients<N>
fn clone(&self) -> SpringCoefficients<N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<N: Debug> Debug for SpringCoefficients<N>
impl<N: Debug> Debug for SpringCoefficients<N>
Source§impl<N: PartialEq> PartialEq for SpringCoefficients<N>
impl<N: PartialEq> PartialEq for SpringCoefficients<N>
impl<N: Copy> Copy for SpringCoefficients<N>
impl<N> StructuralPartialEq for SpringCoefficients<N>
Auto Trait Implementations§
impl<N> Freeze for SpringCoefficients<N>where
N: Freeze,
impl<N> RefUnwindSafe for SpringCoefficients<N>where
N: RefUnwindSafe,
impl<N> Send for SpringCoefficients<N>where
N: Send,
impl<N> Sync for SpringCoefficients<N>where
N: Sync,
impl<N> Unpin for SpringCoefficients<N>where
N: Unpin,
impl<N> UnwindSafe for SpringCoefficients<N>where
N: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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>
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>
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.