Trait SpatialIndex

Source
pub trait SpatialIndex<K>:
    Debug
    + Send
    + Sync {
    // Required methods
    fn visit_aabb(
        &self,
        query: &Aabb,
        visitor: &mut dyn FnMut(&K) -> ControlFlow<()>,
    );
    fn visit_ray(
        &self,
        ray: &Ray3,
        visitor: &mut dyn FnMut(RayHit<&K>) -> ControlFlow<()>,
    );
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

Read-only broad-phase query API. Callback visitation avoids allocating a result vector for large clash batches.

Required Methods§

Source

fn visit_aabb( &self, query: &Aabb, visitor: &mut dyn FnMut(&K) -> ControlFlow<()>, )

Visit keys whose stored bounds overlap query. Returning Break stops.

Source

fn visit_ray( &self, ray: &Ray3, visitor: &mut dyn FnMut(RayHit<&K>) -> ControlFlow<()>, )

Visit broad-phase ray candidates.

Source

fn len(&self) -> usize

Number of indexed items.

Provided Methods§

Source

fn is_empty(&self) -> bool

Whether no items are indexed.

Implementors§

Source§

impl<K> SpatialIndex<K> for Bvh<K>
where K: Debug + Send + Sync,