DynamicTree class

A dynamic tree arranges data in a binary tree to accelerate queries such as volume queries and ray casts. Leaves 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.

Implemented types

Constructors

DynamicTree()

Properties

drawVecs List<Vector2>
final
hashCode int
The hash code for this object.
no setterinherited
nodeStackIndex int
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

computeHeight() int
Compute the height of the tree.
override
createProxy(AABB aabb, Object? userData) int
Create a proxy. Provide a tight fitting AABB and a userData pointer.
override
destroyProxy(int proxyId) → void
Destroy a proxy
override
drawTree(DebugDraw argDraw) → void
override
drawTreeX(DebugDraw argDraw, DynamicTreeNode node, int spot, int height) → void
fatAABB(int proxyId) AABB
override
getAreaRatio() double
Get the ratio of the sum of the node areas to the root area.
override
getHeight() int
Compute the height of the binary tree in O(N) time. Should not be called often.
override
getMaxBalance() int
Get the maximum balance of an node in the tree. The balance is the difference in height of the two children of a node.
override
moveProxy(int proxyId, AABB aabb, Vector2 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. It returns true if the proxy was re-inserted.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
query(TreeCallback callback, AABB aabb) → void
Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.
override
raycast(TreeRayCastCallback 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.
override
rebuildBottomUp() → void
Build an optimal tree. Very expensive. For testing.
toString() String
A string representation of this object.
inherited
userData(int proxyId) Object?
override
validate() → void
Validate this tree. For testing.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

maxStackSize → const int
nullNode → const int