Skip to main content

Simulation

Trait Simulation 

Source
pub trait Simulation {
    // Required methods
    fn x(&self, time: f32) -> f32;
    fn dx(&self, time: f32) -> f32;
    fn is_done(&self, time: f32) -> bool;

    // Provided method
    fn tolerance(&self) -> Tolerance { ... }
}
Expand description

A motion described as a pure function of time.

time is in seconds since the motion began.

Required Methods§

Source

fn x(&self, time: f32) -> f32

The position at instant time.

Source

fn dx(&self, time: f32) -> f32

The velocity — the derivative of position — at instant time.

Source

fn is_done(&self, time: f32) -> bool

true once the motion has finished, within the tolerances.

Provided Methods§

Source

fn tolerance(&self) -> Tolerance

The stopping thresholds.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§