Click or drag to resize

DynamicTreeT Class

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 Settings.b2_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. Nodes are pooled and relocatable, so we use node indices rather than pointers.
Inheritance Hierarchy
SystemObject
  Internal.tainicom.Aether.Physics2D.CollisionDynamicTreeT

Namespace: Internal.tainicom.Aether.Physics2D.Collision
Assembly: NeoAxis.Core (in NeoAxis.Core.dll) Version: 2026.1.1.0 (2026.1.1.0)
Syntax
C#
public class DynamicTree<T>

Type Parameters

T

The DynamicTreeT type exposes the following members.

Constructors
 NameDescription
Public methodDynamicTreeT Constructing the tree initializes the node pool.
Top
Properties
 NameDescription
Public propertyAreaRatio Get the ratio of the sum of the node areas to the root area.
Public propertyHeight Compute the height of the binary tree in O(N) time. Should not be called often.
Public propertyMaxBalance Get the maximum balance of an node in the tree. The balance is the difference in height of the two children of a node.
Top
Methods
 NameDescription
Public methodAddProxy Create a proxy in the tree as a leaf node. We return the index of the node instead of a pointer so that we can grow the node pool. ///
Public methodComputeHeight Compute the height of the entire tree.
Public methodComputeHeight(Int32) Compute the height of a sub-tree.
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodGetFatAABB(Int32) Get the fat AABB for a proxy.
Public methodGetFatAABB(Int32, AABB) Get the fat AABB for a proxy.
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodGetUserData Get proxy user data.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodMoveProxy 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 methodQuery Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.
Public methodRayCast 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 methodRebuildBottomUp Build an optimal tree. Very expensive. For testing.
Public methodRemoveProxy Destroy a proxy. This asserts if the id is invalid.
Public methodSetUserData Set proxy user data.
Public methodShiftOrigin Shift the origin of the nodes
Public methodTestFatAABBOverlap Test overlap of fat AABBs.
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodValidate Validate this tree. For testing.
Public methodValidateMetrics 
Public methodValidateStructure 
Top
Extension Methods
 NameDescription
Public Extension MethodMethodInvoke Calls the object method by name.
(Defined by ObjectEx)
Public Extension MethodPropertyGet Gets the value of the object property by name.
(Defined by ObjectEx)
Public Extension MethodPropertyGetT Gets the value of the object property by name.
(Defined by ObjectEx)
Public Extension MethodPropertySet Sets the value of the object property by name.
(Defined by ObjectEx)
Top
See Also