pub struct CellIndex { /* private fields */ }Expand description
Station-local 3D cell index.
Implementations§
Source§impl CellIndex
impl CellIndex
Sourcepub fn upsert(
&mut self,
handle: EntityHandle,
position: Position3,
bounds: Bounds,
)
pub fn upsert( &mut self, handle: EntityHandle, position: Position3, bounds: Bounds, )
Inserts or updates an entity in all cells touched by its bounds.
Sourcepub fn remove(&mut self, handle: EntityHandle) -> bool
pub fn remove(&mut self, handle: EntityHandle) -> bool
Removes an entity from the index.
Sourcepub fn query_aabb(&self, aabb: Aabb3) -> Vec<EntityHandle>
pub fn query_aabb(&self, aabb: Aabb3) -> Vec<EntityHandle>
Queries candidate handles overlapping an AABB.
Sourcepub fn query_aabb_into<'a>(
&self,
aabb: Aabb3,
scratch: &'a mut CellQueryScratch,
) -> &'a [EntityHandle]
pub fn query_aabb_into<'a>( &self, aabb: Aabb3, scratch: &'a mut CellQueryScratch, ) -> &'a [EntityHandle]
Queries candidate handles overlapping an AABB using caller scratch.
Sourcepub fn query_sphere(&self, center: Position3, radius: f32) -> Vec<EntityHandle>
pub fn query_sphere(&self, center: Position3, radius: f32) -> Vec<EntityHandle>
Queries candidate handles inside cells touched by a sphere.
Sourcepub fn query_sphere_into<'a>(
&self,
center: Position3,
radius: f32,
scratch: &'a mut CellQueryScratch,
) -> &'a [EntityHandle]
pub fn query_sphere_into<'a>( &self, center: Position3, radius: f32, scratch: &'a mut CellQueryScratch, ) -> &'a [EntityHandle]
Queries candidate handles inside cells touched by a sphere using caller scratch.
Sourcepub fn handles_in_cell(&self, cell: CellCoord3) -> Vec<EntityHandle>
pub fn handles_in_cell(&self, cell: CellCoord3) -> Vec<EntityHandle>
Returns handles indexed directly in one cell.
Sourcepub fn handles_in_cell_slice(&self, cell: CellCoord3) -> &[EntityHandle]
pub fn handles_in_cell_slice(&self, cell: CellCoord3) -> &[EntityHandle]
Returns handles indexed directly in one cell without allocating.
Sourcepub fn cells_for_handle(&self, handle: EntityHandle) -> Option<&[CellCoord3]>
pub fn cells_for_handle(&self, handle: EntityHandle) -> Option<&[CellCoord3]>
Returns cells currently occupied by one entity handle.
Sourcepub fn entity_count(&self) -> usize
pub fn entity_count(&self) -> usize
Number of indexed entities.
Sourcepub fn occupied_cell_count(&self) -> usize
pub fn occupied_cell_count(&self) -> usize
Number of non-empty cells.
Sourcepub fn cell_occupancy(&self) -> Vec<CellOccupancy>
pub fn cell_occupancy(&self) -> Vec<CellOccupancy>
Returns deterministic occupancy counts for all non-empty cells.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CellIndex
impl RefUnwindSafe for CellIndex
impl Send for CellIndex
impl Sync for CellIndex
impl Unpin for CellIndex
impl UnsafeUnpin for CellIndex
impl UnwindSafe for CellIndex
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