Skip to main content

Collider

Struct Collider 

Source
pub struct Collider { /* private fields */ }

Implementations§

Source§

impl Collider

Source

pub fn new(leaf_bbox: Vec<BBox>, leaf_morton: Vec<u32>) -> Self

Create a new Collider from leaf bounding boxes and morton codes. Sorts leaves by morton code internally (required by radix tree algorithm).

Source

pub fn collisions_one<R: FnMut(usize, usize)>( &self, query: &BBox, query_idx: usize, record: R, )

Run a single query box against the BVH, invoking record(query_idx, leaf_idx) per overlap. Same traversal as collisions_fn for one index — the per-query entry point for parallel callers (&self only, so queries can run concurrently with thread-local recording).

Source

pub fn collisions_fn<F, R>(&self, query_box_fn: F, n: usize, record: R)
where F: Fn(usize) -> BBox, R: FnMut(usize, usize),

BVH-accelerated collision query with function-generated query boxes. For each query index 0..n, calls query_box_fn(i) to get the query AABB, then traverses the BVH to find overlapping leaves.

Source

pub fn collisions_with_boxes<F: FnMut(usize, usize)>( &self, queries: &[BBox], self_collision: bool, record: F, )

BVH-accelerated collision query with pre-computed query boxes.

Source

pub fn collisions_point<F, R>(&self, point_fn: F, n: usize, record: R)
where F: Fn(usize) -> Vec3, R: FnMut(usize, usize),

Point-based collision query using BVH.

Source

pub fn update_boxes(&mut self, leaf_bbox: Vec<BBox>)

Source

pub fn transform(&mut self, transform: &Mat3x4)

Source

pub fn leaf_count(&self) -> usize

Source

pub fn leaf_bbox(&self) -> &[BBox]

Source

pub fn morton_code(position: Vec3, bbox: &BBox) -> u32

Source

pub fn is_axis_aligned(transform: &Mat3x4) -> bool

Source

pub fn leaf_morton(&self) -> &[u32]

Trait Implementations§

Source§

impl Clone for Collider

Source§

fn clone(&self) -> Collider

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 Collider

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Collider

Source§

fn default() -> Collider

Returns the “default value” for a type. 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.