Skip to main content

CellIndex

Struct CellIndex 

Source
pub struct CellIndex { /* private fields */ }
Expand description

Station-local 3D cell index.

Implementations§

Source§

impl CellIndex

Source

pub fn new(grid: GridSpec) -> Self

Creates an empty cell index.

Source

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.

Source

pub fn reserve(&mut self, additional_entities: usize, additional_cells: usize)

Reserves capacity for additional indexed entities and occupied cells.

Source

pub fn reclaim_retained_capacity(&mut self)

Releases unused retained map, bucket, and multi-cell membership storage.

Source

pub fn entity_capacity(&self) -> usize

Indexed-entity entries currently retained without another rehash.

Source

pub fn occupied_cell_capacity(&self) -> usize

Occupied-cell entries currently retained without another rehash.

Source

pub const fn grid(&self) -> GridSpec

Returns the grid spec.

Source

pub fn upsert( &mut self, handle: EntityHandle, position: Position3, bounds: Bounds, )

Inserts or updates an entity in all cells touched by its bounds.

Source

pub fn upsert_tracked( &mut self, handle: EntityHandle, position: Position3, bounds: Bounds, ) -> CellIndexUpdate

Inserts or updates an entity and reports whether index membership changed.

Source

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.

Source

pub fn remove(&mut self, handle: EntityHandle) -> bool

Removes an entity from the index.

Source

pub fn query_aabb(&self, aabb: Aabb3) -> Vec<EntityHandle>

Queries candidate handles overlapping an AABB.

Source

pub fn query_aabb_into<'a>( &self, aabb: Aabb3, scratch: &'a mut CellQueryScratch, ) -> &'a [EntityHandle]

Queries candidate handles overlapping an AABB using caller scratch.

Source

pub fn query_sphere(&self, center: Position3, radius: f32) -> Vec<EntityHandle>

Queries candidate handles inside cells touched by a sphere.

Source

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.

Source

pub fn handles_in_cell(&self, cell: CellCoord3) -> Vec<EntityHandle>

Returns handles indexed directly in one cell.

Source

pub fn handles_in_cell_slice(&self, cell: CellCoord3) -> &[EntityHandle]

Returns handles indexed directly in one cell without allocating.

Source

pub fn cells_for_handle(&self, handle: EntityHandle) -> Option<&[CellCoord3]>

Returns cells currently occupied by one entity handle.

Source

pub fn entity_count(&self) -> usize

Number of indexed entities.

Source

pub fn point_membership_count(&self) -> usize

Number of entities using allocation-free single-cell membership.

Source

pub fn occupied_cell_count(&self) -> usize

Number of non-empty cells.

Source

pub fn cell_occupancy(&self) -> Vec<CellOccupancy>

Returns deterministic occupancy counts for all non-empty cells.

Source

pub fn cell_occupancy_into(&self, out: &mut Vec<CellOccupancy>)

Writes deterministic occupancy counts into caller-owned reusable storage.

Trait Implementations§

Source§

impl Clone for CellIndex

Source§

fn clone(&self) -> CellIndex

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CellIndex

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.