Struct BroadphaseBvh
pub struct BroadphaseBvh<const MAX_LEAVES: usize = 256> {
pub leaves: [BvhLeafEntry; MAX_LEAVES],
pub cluster_aabbs: [Aabb3D; MAX_LEAVES],
pub active_count: usize,
pub fat_margin: f32,
pub refit_count: u64,
}Expand description
Zero-heap dynamic broadphase BVH with fat-AABB hysteresis.
Maintains up to MAX_LEAVES colliders alongside an upper-level spatial cluster partition
so queries skip non-overlapping regions without heap allocation.
Fields§
§leaves: [BvhLeafEntry; MAX_LEAVES]§cluster_aabbs: [Aabb3D; MAX_LEAVES]Cluster bounding boxes (groups of 8 leaves per cluster node).
active_count: usize§fat_margin: f32Hysteresis expansion margin (meters) added when updating fat_aabb.
refit_count: u64Total number of fat-AABB hysteresis refits performed.
Implementations§
§impl<const MAX_LEAVES: usize> BroadphaseBvh<MAX_LEAVES>
impl<const MAX_LEAVES: usize> BroadphaseBvh<MAX_LEAVES>
pub fn new(fat_margin: f32) -> BroadphaseBvh<MAX_LEAVES>
pub fn new(fat_margin: f32) -> BroadphaseBvh<MAX_LEAVES>
Creates an empty BroadphaseBvh with the specified fat_margin (meters).
pub fn insert(&mut self, collider_id: u32, tight_aabb: Aabb3D) -> Option<usize>
pub fn insert(&mut self, collider_id: u32, tight_aabb: Aabb3D) -> Option<usize>
Inserts a collider with its initial tight_aabb, returning the assigned leaf slot index.
pub fn update(&mut self, leaf_slot: usize, new_tight_aabb: Aabb3D) -> bool
pub fn update(&mut self, leaf_slot: usize, new_tight_aabb: Aabb3D) -> bool
Updates a collider’s tight_aabb with fat-AABB margin hysteresis.
Returns true if the tight_aabb exited the cached fat_aabb and triggered a cluster refit,
or false if absorbed by hysteresis without refitting.
pub fn overlap_aabb(
&self,
query_aabb: &Aabb3D,
out_collider_ids: &mut [u32],
) -> usize
pub fn overlap_aabb( &self, query_aabb: &Aabb3D, out_collider_ids: &mut [u32], ) -> usize
Writes all collider IDs whose tight_aabb overlaps query_aabb into out_collider_ids.
Returns the number of collider IDs written.
pub fn collect_overlapping_pairs(&self, out_pairs: &mut [(u32, u32)]) -> usize
pub fn collect_overlapping_pairs(&self, out_pairs: &mut [(u32, u32)]) -> usize
Generates all broadphase collision pairs (collider_a, collider_b) whose tight AABBs overlap.
Trait Implementations§
§impl<const MAX_LEAVES: usize> Clone for BroadphaseBvh<MAX_LEAVES>
impl<const MAX_LEAVES: usize> Clone for BroadphaseBvh<MAX_LEAVES>
§fn clone(&self) -> BroadphaseBvh<MAX_LEAVES>
fn clone(&self) -> BroadphaseBvh<MAX_LEAVES>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<const MAX_LEAVES: usize> Debug for BroadphaseBvh<MAX_LEAVES>
impl<const MAX_LEAVES: usize> Debug for BroadphaseBvh<MAX_LEAVES>
§impl<const MAX_LEAVES: usize> Default for BroadphaseBvh<MAX_LEAVES>
impl<const MAX_LEAVES: usize> Default for BroadphaseBvh<MAX_LEAVES>
§fn default() -> BroadphaseBvh<MAX_LEAVES>
fn default() -> BroadphaseBvh<MAX_LEAVES>
Auto Trait Implementations§
impl<const MAX_LEAVES: usize> Freeze for BroadphaseBvh<MAX_LEAVES>
impl<const MAX_LEAVES: usize> RefUnwindSafe for BroadphaseBvh<MAX_LEAVES>
impl<const MAX_LEAVES: usize> Send for BroadphaseBvh<MAX_LEAVES>
impl<const MAX_LEAVES: usize> Sync for BroadphaseBvh<MAX_LEAVES>
impl<const MAX_LEAVES: usize> Unpin for BroadphaseBvh<MAX_LEAVES>
impl<const MAX_LEAVES: usize> UnsafeUnpin for BroadphaseBvh<MAX_LEAVES>
impl<const MAX_LEAVES: usize> UnwindSafe for BroadphaseBvh<MAX_LEAVES>
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more