SpringSolver
struct · ferroui-base · v0.5.0
struct SpringSolver
Solves the motion of a damped spring: maps a time to the position of a
spring that is released at 0 and settles at 1.
Members
from_period
fn from_period(period_seconds: f64, zeta: f64, initial_velocity: f64) -> Self
Creates a solver from the period of the undamped oscillation in seconds, the damping ratio and the initial velocity.
new
fn new(m: f64, k: f64, c: f64, initial_velocity: f64) -> Self
Creates a solver from the mass m, the stiffness k, the damping
coefficient c and the initial velocity.
from_natural_frequency
fn from_natural_frequency(wn: f64, zeta: f64, initial_velocity: f64) -> Self
Creates a solver from the natural frequency, the damping ratio and the initial velocity.
solve
fn solve(self: &Self, t: f64) -> f64
The position of the spring at time t.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafePropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedErasedDestructorIntoEitherCloneCopyDebugDefaultStructuralPartialEqPartialEq
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.