[][src]Struct box2d_rs::b2_broad_phase::B2broadPhase

pub struct B2broadPhase<UserDataType> { /* fields omitted */ }

The broad-phase is used for computing pairs and performing volume queries and ray casts. This broad-phase does not persist pairs. Instead, this reports potentially new pairs. It is up to the client to consume the new pairs and to track subsequent overlap.

Implementations

impl<UserDataType: Default + Clone> B2broadPhase<UserDataType>[src]

pub fn new() -> Self[src]

pub fn create_proxy(&mut self, aabb: B2AABB, user_data: &UserDataType) -> i32[src]

create a proxy with an initial AABB. Pairs are not reported until UpdatePairs is called.

pub fn destroy_proxy(&mut self, proxy_id: i32)[src]

destroy a proxy. It is up to the client to remove any pairs.

pub fn move_proxy(&mut self, proxy_id: i32, aabb: B2AABB, displacement: B2vec2)[src]

Call move_proxy as many times as you like, then when you are done call UpdatePairs to finalized the proxy pairs (for your time step).

pub fn touch_proxy(&mut self, proxy_id: i32)[src]

Call to trigger a re-processing of it's pairs on the next call to UpdatePairs.

pub fn get_fat_aabb(&self, proxy_id: i32) -> B2AABB[src]

Get the fat AABB for a proxy.

pub fn get_user_data(&self, proxy_id: i32) -> Option<UserDataType>[src]

Get user data from a proxy. Returns None if the id is invalid.

pub fn test_overlap(&self, proxy_id_a: i32, proxy_id_b: i32) -> bool[src]

Test overlap of fat AABBs.

pub fn get_proxy_count(&self) -> i32[src]

Get the number of proxies.

pub fn update_pairs<CallbackType: AddPairTrait<UserDataType>>(
    &mut self,
    callback: &mut CallbackType
)
[src]

update the pairs. This results in pair callbacks. This can only add pairs.

pub fn query<F: QueryCallback>(&self, callback: F, aabb: B2AABB)[src]

query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.

pub fn ray_cast<T: RayCastCallback>(&self, callback: T, input: &B2rayCastInput)[src]

Ray-cast against the proxies in the tree. This relies on the callback to perform a exact ray-cast in the case were the proxy contains a shape. The callback also performs the any collision filtering. This has performance roughly equal to k * log(n), where k is the number of collisions and n is the number of proxies in the tree.

  • input - the ray-cast input data. The ray extends from p1 to p1 + max_fraction * (p2 - p1).
  • callback - a callback class that is called for each proxy that is hit by the ray.

pub fn get_tree_height(&self) -> i32[src]

Get the height of the embedded tree.

pub fn get_tree_balance(&self) -> i32[src]

Get the balance of the embedded tree.

pub fn get_tree_quality(&self) -> f32[src]

Get the quality metric of the embedded tree.

pub fn shift_origin(&mut self, new_origin: B2vec2)[src]

Shift the world origin. Useful for large worlds. The shift formula is: position -= new_origin

  • new_origin - the new origin with respect to the old origin

pub fn get_tree_mut(&mut self) -> &mut B2dynamicTree<UserDataType>[src]

Trait Implementations

impl<UserDataType: Debug> Debug for B2broadPhase<UserDataType>[src]

Auto Trait Implementations

impl<UserDataType> RefUnwindSafe for B2broadPhase<UserDataType> where
    UserDataType: RefUnwindSafe

impl<UserDataType> Send for B2broadPhase<UserDataType> where
    UserDataType: Send

impl<UserDataType> Sync for B2broadPhase<UserDataType> where
    UserDataType: Sync

impl<UserDataType> Unpin for B2broadPhase<UserDataType> where
    UserDataType: Unpin

impl<UserDataType> UnwindSafe for B2broadPhase<UserDataType> where
    UserDataType: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.