HughPH.Box2D
Organised dotnet bindings for Box2D 3.1.1
Loading...
Searching...
No Matches
Public Member Functions | Properties | List of all members
Box2D.DynamicTree Struct Reference

Dynamic tree for broad-phase collision detection. More...

Public Member Functions

void Destroy ()
 Destroy the tree, freeing the node pool.
 
int CreateProxy (AABB aabb, uint64_t categoryBits, uint64_t userData)
 Create a proxy. Provide an AABB and a userData value.
 
void DestroyProxy (int proxyId)
 Destroy a proxy. This asserts if the id is invalid.
 
void MoveProxy (int proxyId, AABB aabb)
 Move a proxy to a new AABB by removing and reinserting into the tree.
 
void EnlargeProxy (int proxyId, AABB aabb)
 Enlarge a proxy and enlarge ancestors as necessary.
 
void SetCategoryBits (int proxyId, uint64_t categoryBits)
 Modify the category bits on a proxy. This is an expensive operation.
 
uint64_t GetCategoryBits (int proxyId)
 Get the category bits on a proxy.
 
TreeStats Query< TContext > (AABB aabb, uint64_t maskBits, TreeQueryCallback< TContext > callback, TContext context)
 Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.
 
TreeStats Query< TContext > (AABB aabb, uint64_t maskBits, TreeQueryRefCallback< TContext > callback, ref TContext context)
 Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.
 
TreeStats Query (AABB aabb, uint64_t maskBits, TreeQueryCallback callback)
 Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.
 
TreeStats Query (AABB aabb, uint64_t maskBits, TreeQueryNintCallback callback, nint context)
 Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.
 
TreeStats RayCast< TContext > (in RayCastInput input, uint64_t maskBits, TreeRayCastCallback< TContext > callback, TContext context)
 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.
 
TreeStats RayCast< TContext > (in RayCastInput input, uint64_t maskBits, TreeRayCastRefCallback< TContext > callback, ref TContext context)
 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.
 
TreeStats RayCast (in RayCastInput input, uint64_t maskBits, TreeRayCastCallback callback)
 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.
 
TreeStats RayCast (in RayCastInput input, uint64_t maskBits, TreeRayCastNintCallback callback, nint context)
 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.
 
TreeStats ShapeCast< TContext > (in ShapeCastInput input, uint64_t maskBits, TreeShapeCastCallback< TContext > callback, TContext context)
 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.
 
TreeStats ShapeCast< TContext > (in ShapeCastInput input, uint64_t maskBits, TreeShapeCastRefCallback< TContext > callback, ref TContext context)
 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.
 
TreeStats ShapeCast (in ShapeCastInput input, uint64_t maskBits, TreeShapeCastCallback callback)
 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.
 
TreeStats ShapeCast (in ShapeCastInput input, uint64_t maskBits, TreeShapeCastNintCallback callback, nint context)
 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.
 
int Rebuild (bool fullBuild)
 Rebuild the tree while retaining subtrees that haven't changed. Returns the number of boxes sorted.
 
uint64_t GetUserData (int proxyId)
 Get proxy user data.
 
AABB GetAABB (int proxyId)
 Get the AABB of a proxy.
 
void Validate ()
 Validate this tree. For testing.
 
void ValidateNoEnlarged ()
 Validate this tree. For testing.
 
static DynamicTree Create ()
 Constructing the tree initializes the node pool.
 

Properties

ReadOnlySpan< TreeNodeNodes [get]
 The nodes in the tree. This is a read-only span of the nodes.
 
ReadOnlySpan< int > LeafIndices [get]
 The indices of the leaves in the tree. This is a read-only span of the leaf indices.
 
ReadOnlySpan< AABBLeafBoxes [get]
 The bounding boxes of the leaves in the tree. This is a read-only span of the leaf boxes.
 
ReadOnlySpan< Vec2 > LeafCenters [get]
 The centers of the leaves in the tree. This is a read-only span of the leaf centers.
 
ReadOnlySpan< int > BinIndices [get]
 The bin indices of the leaves in the tree. This is a read-only span of the bin indices.
 
int Height [get]
 Get the height of the binary tree.
 
float AreaRatio [get]
 Get the ratio of the sum of the node areas to the root area.
 
AABB RootBounds [get]
 Get the bounding box that contains the entire tree.
 
int ProxyCount [get]
 Get the number of proxies created.
 
int ByteCount [get]
 Get the number of bytes used by this tree.
 

Detailed Description

Dynamic tree for broad-phase collision detection.

Member Function Documentation

◆ Query() [1/2]

TreeStats Box2D.DynamicTree.Query ( AABB  aabb,
uint64_t  maskBits,
TreeQueryCallback  callback 
)
inline

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

Returns
Performance data

◆ Query() [2/2]

TreeStats Box2D.DynamicTree.Query ( AABB  aabb,
uint64_t  maskBits,
TreeQueryNintCallback  callback,
nint  context 
)

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

Returns
Performance data

◆ Query< TContext >() [1/2]

TreeStats Box2D.DynamicTree.Query< TContext > ( AABB  aabb,
uint64_t  maskBits,
TreeQueryCallback< TContext >  callback,
TContext  context 
)
inline

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

Returns
Performance data
Type Constraints
TContext :class 

◆ Query< TContext >() [2/2]

TreeStats Box2D.DynamicTree.Query< TContext > ( AABB  aabb,
uint64_t  maskBits,
TreeQueryRefCallback< TContext >  callback,
ref TContext  context 
)
inline

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

Returns
Performance data
Type Constraints
TContext :unmanaged 

◆ RayCast() [1/2]

TreeStats Box2D.DynamicTree.RayCast ( in RayCastInput  input,
uint64_t  maskBits,
TreeRayCastCallback  callback 
)
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)
maskBitsMask bit hint: bool accept = (maskBits &amp; node-&gt;categoryBits) != 0;
callbackA callback class that is called for each proxy that is hit by the ray
Returns
Performance data

◆ RayCast() [2/2]

TreeStats Box2D.DynamicTree.RayCast ( in RayCastInput  input,
uint64_t  maskBits,
TreeRayCastNintCallback  callback,
nint  context 
)
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)
maskBitsMask bit hint: bool accept = (maskBits &amp; node-&gt;categoryBits) != 0;
callbackA callback class that is called for each proxy that is hit by the ray
contextUser context that is passed to the callback
Returns
Performance data

◆ RayCast< TContext >() [1/2]

TreeStats Box2D.DynamicTree.RayCast< TContext > ( in RayCastInput  input,
uint64_t  maskBits,
TreeRayCastCallback< TContext >  callback,
TContext  context 
)
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)
maskBitsMask bit hint: bool accept = (maskBits &amp; node-&gt;categoryBits) != 0;
callbackA callback class that is called for each proxy that is hit by the ray
contextUser context that is passed to the callback
Returns
Performance data
Type Constraints
TContext :class 

◆ RayCast< TContext >() [2/2]

TreeStats Box2D.DynamicTree.RayCast< TContext > ( in RayCastInput  input,
uint64_t  maskBits,
TreeRayCastRefCallback< TContext >  callback,
ref TContext  context 
)
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)
maskBitsMask bit hint: bool accept = (maskBits &amp; node-&gt;categoryBits) != 0;
callbackA callback class that is called for each proxy that is hit by the ray
contextUser context that is passed to the callback
Returns
Performance data
Type Constraints
TContext :unmanaged 

◆ Rebuild()

int Box2D.DynamicTree.Rebuild ( bool  fullBuild)

Rebuild the tree while retaining subtrees that haven't changed. Returns the number of boxes sorted.

Parameters
fullBuildIf true, the tree is fully rebuilt. If false, only the boxes that have changed are rebuilt.
Returns
The number of boxes sorted.

◆ ShapeCast() [1/2]

TreeStats Box2D.DynamicTree.ShapeCast ( in ShapeCastInput  input,
uint64_t  maskBits,
TreeShapeCastCallback  callback 
)
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).
maskBitsFilter bits: bool accept = (maskBits &amp; node-&gt;categoryBits) != 0;
callbackA callback class that is called for each proxy that is hit by the shape
Returns
Performance data

◆ ShapeCast() [2/2]

TreeStats Box2D.DynamicTree.ShapeCast ( in ShapeCastInput  input,
uint64_t  maskBits,
TreeShapeCastNintCallback  callback,
nint  context 
)
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).
maskBitsFilter bits: bool accept = (maskBits &amp; node-&gt;categoryBits) != 0;
callbackA callback class that is called for each proxy that is hit by the shape
contextUser context that is passed to the callback
Returns
Performance data

◆ ShapeCast< TContext >() [1/2]

TreeStats Box2D.DynamicTree.ShapeCast< TContext > ( in ShapeCastInput  input,
uint64_t  maskBits,
TreeShapeCastCallback< TContext >  callback,
TContext  context 
)
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).
maskBitsFilter bits: bool accept = (maskBits &amp; node-&gt;categoryBits) != 0;
callbackA callback class that is called for each proxy that is hit by the shape
contextUser context that is passed to the callback
Returns
Performance data
Type Constraints
TContext :class 

◆ ShapeCast< TContext >() [2/2]

TreeStats Box2D.DynamicTree.ShapeCast< TContext > ( in ShapeCastInput  input,
uint64_t  maskBits,
TreeShapeCastRefCallback< TContext >  callback,
ref TContext  context 
)
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).
maskBitsFilter bits: bool accept = (maskBits &amp; node-&gt;categoryBits) != 0;
callbackA callback class that is called for each proxy that is hit by the shape
contextUser context that is passed to the callback
Returns
Performance data
Type Constraints
TContext :unmanaged 

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