pub struct SpatialHashGrid<D: Sized> { /* private fields */ }Expand description
Spatial hash data structure. see crate docs for usage.
Implementations§
Source§impl<D: Sized> SpatialHashGrid<D>
impl<D: Sized> SpatialHashGrid<D>
Sourcepub fn new<V>(x: usize, y: usize, z: usize, filler: V) -> Selfwhere
V: FnMut() -> D,
pub fn new<V>(x: usize, y: usize, z: usize, filler: V) -> Selfwhere
V: FnMut() -> D,
x,y,z set the dimentsions, filler is a function that is used to initialize contents.
Sourcepub fn get_mut(&mut self, idx: usize) -> Option<&mut D>
pub fn get_mut(&mut self, idx: usize) -> Option<&mut D>
Safely retrieve element by index, will do runtime OOB checks
Sourcepub fn get(&mut self, idx: usize) -> Option<&D>
pub fn get(&mut self, idx: usize) -> Option<&D>
Safely retrieve element by index, will do runtime OOB checks
Sourcepub fn pos_to_index(&self, v: Vector3<u32>) -> Option<usize>
pub fn pos_to_index(&self, v: Vector3<u32>) -> Option<usize>
Convert given position into index in this spatial hash grid
Sourcepub fn iter_cube_indices(
&self,
min: Vector3<u32>,
max: Vector3<u32>,
) -> BoxIdxIterator ⓘ
pub fn iter_cube_indices( &self, min: Vector3<u32>, max: Vector3<u32>, ) -> BoxIdxIterator ⓘ
Iterate over cube indices in given bounds [min, max]
Sourcepub fn iter_cubes(
&self,
min: Vector3<u32>,
max: Vector3<u32>,
) -> BoxIterator<'_, D> ⓘ
pub fn iter_cubes( &self, min: Vector3<u32>, max: Vector3<u32>, ) -> BoxIterator<'_, D> ⓘ
Iterate over cubes in given bounds [min, max] inside the main cube in read only state
Sourcepub fn iter_cubes_mut(
&mut self,
min: Vector3<u32>,
max: Vector3<u32>,
) -> BoxIteratorMut<'_, D> ⓘ
pub fn iter_cubes_mut( &mut self, min: Vector3<u32>, max: Vector3<u32>, ) -> BoxIteratorMut<'_, D> ⓘ
Iterate over cubes in given bounds [min, max] in read and write state.
Trait Implementations§
Source§impl<D: Debug> Debug for SpatialHashGrid<D>
impl<D: Debug> Debug for SpatialHashGrid<D>
Auto Trait Implementations§
impl<D> Freeze for SpatialHashGrid<D>
impl<D> RefUnwindSafe for SpatialHashGrid<D>where
D: RefUnwindSafe,
impl<D> Send for SpatialHashGrid<D>where
D: Send,
impl<D> Sync for SpatialHashGrid<D>where
D: Sync,
impl<D> Unpin for SpatialHashGrid<D>where
D: Unpin,
impl<D> UnwindSafe for SpatialHashGrid<D>where
D: UnwindSafe,
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