pub trait UpdateMechanics<Pos, Vel, For, const N: usize> {
// Required methods
fn set_last_position(&mut self, pos: Pos);
fn previous_positions<'a>(&'a self) -> RingBufferIterRef<'a, Pos, N> ⓘ;
fn set_last_velocity(&mut self, vel: Vel);
fn previous_velocities<'a>(&'a self) -> RingBufferIterRef<'a, Vel, N> ⓘ;
fn n_previous_values(&self) -> usize;
fn add_force(&mut self, force: For);
fn get_current_force_and_reset(&mut self) -> For;
}
Expand description
Used to store intermediate information about last positions and velocities.
Can store up to N
values.
Required Methods§
Sourcefn set_last_position(&mut self, pos: Pos)
fn set_last_position(&mut self, pos: Pos)
Stores the last position of the cell. May overwrite old results depending on how many old results are being stored.
Sourcefn previous_positions<'a>(&'a self) -> RingBufferIterRef<'a, Pos, N> ⓘ
fn previous_positions<'a>(&'a self) -> RingBufferIterRef<'a, Pos, N> ⓘ
Get all previous positions. This number maybe smaller than the maximum number of stored positions but never exceeds it.
Sourcefn set_last_velocity(&mut self, vel: Vel)
fn set_last_velocity(&mut self, vel: Vel)
Stores the last velocity of the cell. Overwrites old results when stored amount exceeds number of maximum stored values.
Sourcefn previous_velocities<'a>(&'a self) -> RingBufferIterRef<'a, Vel, N> ⓘ
fn previous_velocities<'a>(&'a self) -> RingBufferIterRef<'a, Vel, N> ⓘ
Get all previous velocities. This number may be smaller than the maximum number of stored velocities but never exceeds it.
Sourcefn n_previous_values(&self) -> usize
fn n_previous_values(&self) -> usize
Get the number of previous values currently stored
This number is by definition between 0 and N
.
Sourcefn get_current_force_and_reset(&mut self) -> For
fn get_current_force_and_reset(&mut self) -> For
Obtain current force on cell