Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
b2BroadPhase Class Reference

#include <b2BroadPhase.h>

List of all members.

Public Types

enum  { e_nullProxy = -1 }

Public Member Functions

 b2BroadPhase ()
int32 CreateProxy (const b2AABB &aabb, void *userData)
void DestroyProxy (int32 proxyId)
 Destroy a proxy. It is up to the client to remove any pairs.
const b2AABBGetFatAABB (int32 proxyId) const
 Get the fat AABB for a proxy.
int32 GetProxyCount () const
 Get the number of proxies.
int32 GetTreeBalance () const
 Get the balance of the embedded tree.
int32 GetTreeHeight () const
 Get the height of the embedded tree.
float32 GetTreeQuality () const
 Get the quality metric of the embedded tree.
void * GetUserData (int32 proxyId) const
 Get user data from a proxy. Returns NULL if the id is invalid.
void MoveProxy (int32 proxyId, const b2AABB &aabb, const b2Vec2 &displacement)
template<typename T >
void Query (T *callback, const b2AABB &aabb) const
template<typename T >
void RayCast (T *callback, const b2RayCastInput &input) const
void ShiftOrigin (const b2Vec2 &newOrigin)
bool TestOverlap (int32 proxyIdA, int32 proxyIdB) const
 Test overlap of fat AABBs.
void TouchProxy (int32 proxyId)
 Call to trigger a re-processing of it's pairs on the next call to UpdatePairs.
template<typename T >
void UpdatePairs (T *callback)
 Update the pairs. This results in pair callbacks. This can only add pairs.
 ~b2BroadPhase ()

Private Member Functions

void BufferMove (int32 proxyId)
bool QueryCallback (int32 proxyId)
void UnBufferMove (int32 proxyId)

Private Attributes

int32m_moveBuffer
int32 m_moveCapacity
int32 m_moveCount
b2Pairm_pairBuffer
int32 m_pairCapacity
int32 m_pairCount
int32 m_proxyCount
int32 m_queryProxyId
b2DynamicTree m_tree

Friends

class b2DynamicTree

Detailed Description

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.

Definition at line 36 of file b2BroadPhase.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
e_nullProxy 

Definition at line 40 of file b2BroadPhase.h.


Constructor & Destructor Documentation

Definition at line 21 of file b2BroadPhase.cpp.

Definition at line 34 of file b2BroadPhase.cpp.


Member Function Documentation

void b2BroadPhase::BufferMove ( int32  proxyId) [private]

Definition at line 69 of file b2BroadPhase.cpp.

int32 b2BroadPhase::CreateProxy ( const b2AABB aabb,
void *  userData 
)

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

Definition at line 40 of file b2BroadPhase.cpp.

void b2BroadPhase::DestroyProxy ( int32  proxyId)

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

Definition at line 48 of file b2BroadPhase.cpp.

const b2AABB & b2BroadPhase::GetFatAABB ( int32  proxyId) const [inline]

Get the fat AABB for a proxy.

Definition at line 159 of file b2BroadPhase.h.

int32 b2BroadPhase::GetProxyCount ( ) const [inline]

Get the number of proxies.

Definition at line 164 of file b2BroadPhase.h.

int32 b2BroadPhase::GetTreeBalance ( ) const [inline]

Get the balance of the embedded tree.

Definition at line 174 of file b2BroadPhase.h.

int32 b2BroadPhase::GetTreeHeight ( ) const [inline]

Get the height of the embedded tree.

Definition at line 169 of file b2BroadPhase.h.

Get the quality metric of the embedded tree.

Definition at line 179 of file b2BroadPhase.h.

void * b2BroadPhase::GetUserData ( int32  proxyId) const [inline]

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

Definition at line 147 of file b2BroadPhase.h.

void b2BroadPhase::MoveProxy ( int32  proxyId,
const b2AABB aabb,
const b2Vec2 displacement 
)

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

Definition at line 55 of file b2BroadPhase.cpp.

template<typename T >
void b2BroadPhase::Query ( T callback,
const b2AABB aabb 
) const [inline]

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

Definition at line 241 of file b2BroadPhase.h.

bool b2BroadPhase::QueryCallback ( int32  proxyId) [private]

Definition at line 96 of file b2BroadPhase.cpp.

template<typename T >
void b2BroadPhase::RayCast ( T callback,
const b2RayCastInput input 
) const [inline]

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.

Parameters:
inputthe ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1).
callbacka callback class that is called for each proxy that is hit by the ray.

Definition at line 247 of file b2BroadPhase.h.

void b2BroadPhase::ShiftOrigin ( const b2Vec2 newOrigin) [inline]

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

Parameters:
newOriginthe new origin with respect to the old origin

Definition at line 252 of file b2BroadPhase.h.

bool b2BroadPhase::TestOverlap ( int32  proxyIdA,
int32  proxyIdB 
) const [inline]

Test overlap of fat AABBs.

Definition at line 152 of file b2BroadPhase.h.

void b2BroadPhase::TouchProxy ( int32  proxyId)

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

Definition at line 64 of file b2BroadPhase.cpp.

void b2BroadPhase::UnBufferMove ( int32  proxyId) [private]

Definition at line 84 of file b2BroadPhase.cpp.

template<typename T >
void b2BroadPhase::UpdatePairs ( T callback)

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

Definition at line 185 of file b2BroadPhase.h.


Friends And Related Function Documentation

friend class b2DynamicTree [friend]

Definition at line 109 of file b2BroadPhase.h.


Member Data Documentation

Definition at line 120 of file b2BroadPhase.h.

Definition at line 121 of file b2BroadPhase.h.

Definition at line 122 of file b2BroadPhase.h.

Definition at line 124 of file b2BroadPhase.h.

Definition at line 125 of file b2BroadPhase.h.

Definition at line 126 of file b2BroadPhase.h.

Definition at line 118 of file b2BroadPhase.h.

Definition at line 128 of file b2BroadPhase.h.

Definition at line 116 of file b2BroadPhase.h.


The documentation for this class was generated from the following files:


mvsim
Author(s):
autogenerated on Thu Jun 6 2019 22:08:35