C# Class Box2D.Collision.Broadphase.DynamicTree

A dynamic tree arranges data in a binary tree to accelerate queries such as volume queries and ray casts. Leafs are proxies with an AABB. In the tree we expand the proxy AABB by _fatAABBFactor so that the proxy AABB is bigger than the client object. This allows the client object to move by small amounts without triggering a tree update.
Afficher le fichier Open project: gerich-home/box2dnet Class Usage Examples

Méthodes publiques

Méthode Description
ComputeHeight ( ) : int

Compute the height of the tree.

CreateProxy ( AABB aabb, Object userData ) : int

Create a proxy. Provide a tight fitting AABB and a userData pointer.

DestroyProxy ( int proxyId ) : void

Destroy a proxy

DrawTree ( DebugDraw argDraw ) : void
DrawTree ( DebugDraw argDraw, int nodeId, int spot, int height ) : void
DynamicTree ( ) : System
GetFatAABB ( int proxyId ) : AABB
GetUserData ( int proxyId ) : object
MoveProxy ( int proxyId, AABB aabb, Vec2 displacement ) : bool

Move a proxy with a swepted AABB. If the proxy has moved outside of its fattened AABB, then the proxy is removed from the tree and re-inserted. Otherwise the function returns immediately.

Query ( ITreeCallback callback, AABB aabb ) : void

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

Raycast ( ITreeRayCastCallback callback, RayCastInput input ) : void

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.

RebuildBottomUp ( ) : void

Build an optimal tree. Very expensive. For testing.

Validate ( ) : void

Validate this tree. For testing.

Private Methods

Méthode Description
AllocateNode ( ) : int
Balance ( int iA ) : int
ComputeHeight ( int nodeId ) : int
FreeNode ( int nodeId ) : void

returns a node to the pool

InsertLeaf ( int leaf ) : void
RemoveLeaf ( int leaf ) : void
ValidateMetrics ( int index ) : void
ValidateStructure ( int index ) : void

Method Details

ComputeHeight() public méthode

Compute the height of the tree.
public ComputeHeight ( ) : int
Résultat int

CreateProxy() public méthode

Create a proxy. Provide a tight fitting AABB and a userData pointer.
public CreateProxy ( AABB aabb, Object userData ) : int
aabb AABB
userData Object
Résultat int

DestroyProxy() public méthode

Destroy a proxy
public DestroyProxy ( int proxyId ) : void
proxyId int
Résultat void

DrawTree() public méthode

public DrawTree ( DebugDraw argDraw ) : void
argDraw Box2D.Callbacks.DebugDraw
Résultat void

DrawTree() public méthode

public DrawTree ( DebugDraw argDraw, int nodeId, int spot, int height ) : void
argDraw Box2D.Callbacks.DebugDraw
nodeId int
spot int
height int
Résultat void

DynamicTree() public méthode

public DynamicTree ( ) : System
Résultat System

GetFatAABB() public méthode

public GetFatAABB ( int proxyId ) : AABB
proxyId int
Résultat AABB

GetUserData() public méthode

public GetUserData ( int proxyId ) : object
proxyId int
Résultat object

MoveProxy() public méthode

Move a proxy with a swepted AABB. If the proxy has moved outside of its fattened AABB, then the proxy is removed from the tree and re-inserted. Otherwise the function returns immediately.
public MoveProxy ( int proxyId, AABB aabb, Vec2 displacement ) : bool
proxyId int
aabb AABB
displacement Box2D.Common.Vec2
Résultat bool

Query() public méthode

Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.
public Query ( ITreeCallback callback, AABB aabb ) : void
callback ITreeCallback
aabb AABB
Résultat void

Raycast() public méthode

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.
public Raycast ( ITreeRayCastCallback callback, RayCastInput input ) : void
callback ITreeRayCastCallback a callback class that is called for each proxy that is hit by the ray.
input RayCastInput the ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1).
Résultat void

RebuildBottomUp() public méthode

Build an optimal tree. Very expensive. For testing.
public RebuildBottomUp ( ) : void
Résultat void

Validate() public méthode

Validate this tree. For testing.
public Validate ( ) : void
Résultat void