pub struct CellIndex { /* private fields */ }Expand description
Station-local 3D cell index.
Implementations§
Source§impl CellIndex
impl CellIndex
Sourcepub fn with_capacity(
grid: GridSpec,
entity_capacity: usize,
occupied_cell_capacity: usize,
) -> Self
pub fn with_capacity( grid: GridSpec, entity_capacity: usize, occupied_cell_capacity: usize, ) -> Self
Creates an empty index with explicit entity and occupied-cell capacity.
Sourcepub fn reserve(&mut self, additional_entities: usize, additional_cells: usize)
pub fn reserve(&mut self, additional_entities: usize, additional_cells: usize)
Reserves capacity for additional indexed entities and occupied cells.
Sourcepub fn reclaim_retained_capacity(&mut self)
pub fn reclaim_retained_capacity(&mut self)
Releases unused retained map, bucket, and multi-cell membership storage.
Sourcepub fn entity_capacity(&self) -> usize
pub fn entity_capacity(&self) -> usize
Indexed-entity entries currently retained without another rehash.
Sourcepub fn occupied_cell_capacity(&self) -> usize
pub fn occupied_cell_capacity(&self) -> usize
Occupied-cell entries currently retained without another rehash.
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 upsert_tracked(
&mut self,
handle: EntityHandle,
position: Position3,
bounds: Bounds,
) -> CellIndexUpdate
pub fn upsert_tracked( &mut self, handle: EntityHandle, position: Position3, bounds: Bounds, ) -> CellIndexUpdate
Inserts or updates an entity and reports whether index membership changed.
Sourcepub fn upsert_with_scratch(
&mut self,
handle: EntityHandle,
position: Position3,
bounds: Bounds,
scratch: &mut CellIndexUpdateScratch,
) -> CellIndexUpdateReport
pub fn upsert_with_scratch( &mut self, handle: EntityHandle, position: Position3, bounds: Bounds, scratch: &mut CellIndexUpdateScratch, ) -> CellIndexUpdateReport
Inserts or updates membership with reusable storage and detailed work counters.
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 point_membership_count(&self) -> usize
pub fn point_membership_count(&self) -> usize
Number of entities using allocation-free single-cell membership.
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.
Sourcepub fn cell_occupancy_into(&self, out: &mut Vec<CellOccupancy>)
pub fn cell_occupancy_into(&self, out: &mut Vec<CellOccupancy>)
Writes deterministic occupancy counts into caller-owned reusable storage.