Skip to main content

BroadPhase

Struct BroadPhase 

Source
pub struct BroadPhase {
    pub trees: [DynamicTree; 3],
    pub moved_proxies: [BitSet; 3],
    pub move_array: Vec<i32>,
    pub pair_set: HashSet,
}
Expand description

The broad-phase is used for computing pairs and performing volume queries and ray casts. It does not persist pairs; it reports potentially new pairs. It is up to the client to consume the new pairs and to track subsequent overlap. (b2BroadPhase)

Fields§

§trees: [DynamicTree; 3]§moved_proxies: [BitSet; 3]

Per body-type bit sets indexed by proxyId, marking proxies moved this step. Paired with move_array which preserves deterministic insertion order for pair queries.

§move_array: Vec<i32>§pair_set: HashSet

Tracks shape pairs that have a Contact.

Implementations§

Source§

impl BroadPhase

Source

pub fn new(capacity: &Capacity) -> BroadPhase

(b2CreateBroadPhase)

Source

pub fn destroy(&mut self)

(b2DestroyBroadPhase)

Source

pub fn buffer_move(&mut self, query_proxy: i32)

This triggers new contact pairs to be created. Must be called in deterministic order. (static inline b2BufferMove)

Source

pub fn create_proxy( &mut self, proxy_type_: BodyType, aabb: Aabb, category_bits: u64, shape_index: i32, force_pair_creation: bool, ) -> i32

(b2BroadPhase_CreateProxy)

Source

pub fn destroy_proxy(&mut self, proxy_key: i32)

(b2BroadPhase_DestroyProxy)

Source

pub fn move_proxy(&mut self, proxy_key: i32, aabb: Aabb)

(b2BroadPhase_MoveProxy)

Source

pub fn enlarge_proxy(&mut self, proxy_key: i32, aabb: Aabb)

(b2BroadPhase_EnlargeProxy)

Source

pub fn shape_index(&self, proxy_key: i32) -> i32

(b2BroadPhase_GetShapeIndex)

Source

pub fn test_overlap(&self, proxy_key_a: i32, proxy_key_b: i32) -> bool

(b2BroadPhase_TestOverlap)

Source

pub fn validate(&self)

(b2ValidateBroadphase)

Source

pub fn validate_no_enlarged(&self)

(b2ValidateNoEnlarged — C compiles the body under B2_ENABLE_VALIDATION; here the check runs in debug builds only)

Source

pub fn validate_moved_proxies(&self)

(b2ValidateMovedProxies — C compiles the body under B2_ENABLE_VALIDATION; here the whole check runs in debug builds only)

Trait Implementations§

Source§

impl Debug for BroadPhase

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> 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, 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.