pub struct Scratch {
pub grid: NeighborGrid,
/* private fields */
}Expand description
Reusable scratch buffers for the crowd models.
Every step_* path in this crate needs exactly one Vec<Vec2> of
length peds.len() (for next-tick accelerations, velocities, or
positions) and one NeighborGrid rebuilt against the current
pedestrian slice. Scratch bundles both so a caller can allocate
once per simulation instead of twice per tick.
ⓘ
let mut scratch = Scratch::with_capacity(peds.len(), 1.0);
for _ in 0..num_steps {
social_force::step_scratch(&mut peds, &walls, ¶ms, dt, &mut scratch);
}Scratch is not tied to a specific model: the same instance can
drive social_force, collision_free_speed, anticipation_velocity,
generalized_centrifugal_force, or optimal_steps step-by-step,
provided the grid’s cell_size is a sensible cap on the largest
neighbor_cutoff in play.
Fields§
§grid: NeighborGridNeighbour grid rebuilt against the pedestrian slice each tick.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scratch
impl RefUnwindSafe for Scratch
impl Send for Scratch
impl Sync for Scratch
impl Unpin for Scratch
impl UnsafeUnpin for Scratch
impl UnwindSafe for Scratch
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
Mutably borrows from an owned value. Read more