C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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

Описание методов

ComputeHeight() публичный Метод

Compute the height of the tree.
public ComputeHeight ( ) : int
Результат int

CreateProxy() публичный Метод

Create a proxy. Provide a tight fitting AABB and a userData pointer.
public CreateProxy ( AABB aabb, Object userData ) : int
aabb AABB
userData Object
Результат int

DestroyProxy() публичный Метод

Destroy a proxy
public DestroyProxy ( int proxyId ) : void
proxyId int
Результат void

DrawTree() публичный Метод

public DrawTree ( DebugDraw argDraw ) : void
argDraw Box2D.Callbacks.DebugDraw
Результат void

DrawTree() публичный Метод

public DrawTree ( DebugDraw argDraw, int nodeId, int spot, int height ) : void
argDraw Box2D.Callbacks.DebugDraw
nodeId int
spot int
height int
Результат void

DynamicTree() публичный Метод

public DynamicTree ( ) : System
Результат System

GetFatAABB() публичный Метод

public GetFatAABB ( int proxyId ) : AABB
proxyId int
Результат AABB

GetUserData() публичный Метод

public GetUserData ( int proxyId ) : object
proxyId int
Результат object

MoveProxy() публичный Метод

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
Результат bool

Query() публичный Метод

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
Результат void

Raycast() публичный Метод

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).
Результат void

RebuildBottomUp() публичный Метод

Build an optimal tree. Very expensive. For testing.
public RebuildBottomUp ( ) : void
Результат void

Validate() публичный Метод

Validate this tree. For testing.
public Validate ( ) : void
Результат void