pub struct SpatialHashGrid3D { /* private fields */ }Expand description
O(1) uniform-cell 3D spatial hash grid with reusable scratch buffers and zero steady-state allocations.
Implementations§
Source§impl SpatialHashGrid3D
Zero-allocation open-addressed uniform-cell 3D spatial hash grid operations.
impl SpatialHashGrid3D
Zero-allocation open-addressed uniform-cell 3D spatial hash grid operations.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears all entries in O(active_cells) time while retaining every internal buffer’s capacity.
Sourcepub fn insert_aabb(&mut self, id: u64, bounds: AxisAlignedBox3D)
pub fn insert_aabb(&mut self, id: u64, bounds: AxisAlignedBox3D)
Inserts an item (id, bounds) into every 3D cell overlapped by bounds.
§Arguments
u64- Entity identifier.AxisAlignedBox3D- World-space 3D bounding box.
Sourcepub fn insert_point(&mut self, id: u64, position: Vec3)
pub fn insert_point(&mut self, id: u64, position: Vec3)
Inserts a 3D point (id, position) into its enclosing grid cell.
§Arguments
u64- Entity identifier.Vec3- World-space 3D position.
Sourcepub fn query_aabb_into(&self, query_box: AxisAlignedBox3D, out: &mut Vec<u64>)
pub fn query_aabb_into(&self, query_box: AxisAlignedBox3D, out: &mut Vec<u64>)
Queries all items overlapping query_box, writing deduplicated IDs into out.
§Arguments
AxisAlignedBox3D- Query 3D bounding box.&mut Vec<u64>- Reusable output buffer.
Sourcepub fn query_sphere_into(&self, center: Vec3, radius: f32, out: &mut Vec<u64>)
pub fn query_sphere_into(&self, center: Vec3, radius: f32, out: &mut Vec<u64>)
Queries all items intersecting sphere (center, radius), writing deduplicated IDs into out.
§Arguments
Vec3- Query sphere center.f32- Query sphere radius.&mut Vec<u64>- Reusable output buffer.
Sourcepub fn query_sphere(&mut self, center: Vec3, radius: f32) -> &[u64]
pub fn query_sphere(&mut self, center: Vec3, radius: f32) -> &[u64]
Source§impl SpatialHashGrid3D
Implements impl #impl_generics #name #ty_generics #where_clause.
impl SpatialHashGrid3D
Implements impl #impl_generics #name #ty_generics #where_clause.
pub fn get_cell_size(&self) -> f32
pub fn get_mut_cell_size(&mut self) -> &mut f32
pub fn set_cell_size(&mut self, val: f32) -> &mut Self
pub fn get_inv_cell_size(&self) -> f32
pub fn get_mut_inv_cell_size(&mut self) -> &mut f32
pub fn set_inv_cell_size(&mut self, val: f32) -> &mut Self
pub fn get_occupied_buckets(&self) -> usize
pub fn get_mut_occupied_buckets(&mut self) -> &mut usize
pub fn set_occupied_buckets(&mut self, val: usize) -> &mut Self
Trait Implementations§
Source§impl Clone for SpatialHashGrid3D
impl Clone for SpatialHashGrid3D
Auto Trait Implementations§
impl Forget for SpatialHashGrid3D
impl Freeze for SpatialHashGrid3Dwhere
*const u8 is !null: Freeze,
PhantomData<SpatialHashBucket3D>: Freeze,
PhantomData<usize>: Freeze,
PhantomData<SpatialHashEntry3D>: Freeze,
PhantomData<u64>: Freeze,
impl Move for SpatialHashGrid3D
impl RefUnwindSafe for SpatialHashGrid3D
impl Send for SpatialHashGrid3Dwhere
RawVecInner: Send,
impl Sync for SpatialHashGrid3Dwhere
RawVecInner: Sync,
impl Unpin for SpatialHashGrid3D
impl UnsafeUnpin for SpatialHashGrid3Dwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<SpatialHashBucket3D>: UnsafeUnpin,
PhantomData<usize>: UnsafeUnpin,
PhantomData<SpatialHashEntry3D>: UnsafeUnpin,
PhantomData<u64>: UnsafeUnpin,
impl UnwindSafe for SpatialHashGrid3Dwhere
RawVecInner: 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