pub struct BoidParams {
pub visual_range: f32,
pub visual_sq: f32,
pub protected_sq: f32,
pub separation_factor: f32,
pub alignment_factor: f32,
pub cohesion_factor: f32,
pub max_speed: f32,
pub min_speed: f32,
pub half_w: f32,
pub half_h: f32,
pub world_w: f32,
pub world_h: f32,
}Expand description
Parameters of BoidsModel, read once per tick.
The squared ranges and half extents are precomputed, so the inner loop does no setup per neighbour.
Fields§
§visual_range: f32Distance within which a boid sees its neighbours.
visual_sq: f32Square of visual_range.
protected_sq: f32Square of the distance within which a boid steers away from its neighbours.
separation_factor: f32Weight of the steer away from close neighbours.
alignment_factor: f32Weight of the steer towards the neighbours’ mean velocity.
cohesion_factor: f32Weight of the steer towards the neighbours’ mean position.
max_speed: f32Highest speed a boid keeps after a step.
min_speed: f32Lowest speed a boid keeps after a step.
half_w: f32Half the world width.
half_h: f32Half the world height.
world_w: f32World width.
world_h: f32World height.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BoidParams
impl RefUnwindSafe for BoidParams
impl Send for BoidParams
impl Sync for BoidParams
impl Unpin for BoidParams
impl UnsafeUnpin for BoidParams
impl UnwindSafe for BoidParams
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more