pub struct SpatialIndex3D<T: Copy>(/* private fields */);Expand description
Owned 3D collider snapshot with the same lifecycle as SpatialIndex2D.
Implementations§
Source§impl<T: Copy> SpatialIndex3D<T>
impl<T: Copy> SpatialIndex3D<T>
Sourcepub fn rebuild(
&mut self,
source: impl IntoIterator<Item = (T, Aabb3)>,
) -> Result<usize, SpatialError>
pub fn rebuild( &mut self, source: impl IntoIterator<Item = (T, Aabb3)>, ) -> Result<usize, SpatialError>
Copies (id, bounds) pairs and atomically replaces the snapshot.
Invalid input returns its original position and preserves old data.
Build cost is O(n log n); query cost depends on overlap distribution.
Sourcepub fn nearest(
&self,
ray: Ray3,
max_distance: f32,
) -> Result<Option<SpatialHit3<T>>, SpatialError>
pub fn nearest( &self, ray: Ray3, max_distance: f32, ) -> Result<Option<SpatialHit3<T>>, SpatialError>
Nearest ray contact within an inclusive world-unit distance. Exact-distance ties use original input order. Infinity is allowed.
Sourcepub fn visit_overlapping(
&self,
area: Aabb3,
emit: impl FnMut(T),
) -> Result<(), SpatialError>
pub fn visit_overlapping( &self, area: Aabb3, emit: impl FnMut(T), ) -> Result<(), SpatialError>
Visits boxes with positive-volume overlap. Touching alone is excluded. Visitor order follows the hierarchy, not input order. No allocation.
Sourcepub fn overlapping(&self, area: Aabb3) -> Result<Vec<T>, SpatialError>
pub fn overlapping(&self, area: Aabb3) -> Result<Vec<T>, SpatialError>
Collects positive-volume overlaps for convenience.
Sourcepub fn visit_visible(&self, view: &Frustum3D, emit: impl FnMut(T))
pub fn visit_visible(&self, view: &Frustum3D, emit: impl FnMut(T))
Visits boxes that may be visible in this camera. No allocation.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for SpatialIndex3D<T>where
Bvh<T, 3>: Freeze,
impl<T> RefUnwindSafe for SpatialIndex3D<T>where
Bvh<T, 3>: RefUnwindSafe,
impl<T> Send for SpatialIndex3D<T>where
Bvh<T, 3>: Send,
impl<T> Sync for SpatialIndex3D<T>where
Bvh<T, 3>: Sync,
impl<T> Unpin for SpatialIndex3D<T>where
Bvh<T, 3>: Unpin,
impl<T> UnsafeUnpin for SpatialIndex3D<T>where
Bvh<T, 3>: UnsafeUnpin,
impl<T> UnwindSafe for SpatialIndex3D<T>where
Bvh<T, 3>: 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