FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    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.

    Source

    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.

    Source

    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.

    Source

    solve

    fn solve(self: &Self, t: f64) -> f64
    

    The position of the spring at time t.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • PropertyValue
    • AnyValue
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ErasedDestructor
    • IntoEither
    • Clone
    • Copy
    • Debug
    • Default
    • StructuralPartialEq
    • PartialEq

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.