HughPH.Box2D
Organised dotnet bindings for Box2D 3.1.0
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

static DynamicTree Create ()
 Constructing the tree initializes the node pool.
 
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.
 

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

◆ Create()

static DynamicTree Box2D.DynamicTree.Create ( )

Constructing the tree initializes the node pool.

This wraps b2DynamicTree_Create

◆ CreateProxy()

int Box2D.DynamicTree.CreateProxy ( AABB  aabb,
uint64_t  categoryBits,
uint64_t  userData 
)

Create a proxy. Provide an AABB and a userData value.

This wraps b2DynamicTree_CreateProxy

◆ Destroy()

void Box2D.DynamicTree.Destroy ( )

Destroy the tree, freeing the node pool.

This wraps b2DynamicTree_Destroy

◆ DestroyProxy()

void Box2D.DynamicTree.DestroyProxy ( int  proxyId)
inline

Destroy a proxy. This asserts if the id is invalid.

This wraps b2DynamicTree_DestroyProxy

◆ EnlargeProxy()

void Box2D.DynamicTree.EnlargeProxy ( int  proxyId,
AABB  aabb 
)

Enlarge a proxy and enlarge ancestors as necessary.

This wraps b2DynamicTree_EnlargeProxy

◆ GetAABB()

AABB Box2D.DynamicTree.GetAABB ( int  proxyId)

Get the AABB of a proxy.

This wraps b2DynamicTree_GetAABB

◆ GetCategoryBits()

uint64_t Box2D.DynamicTree.GetCategoryBits ( int  proxyId)

Get the category bits on a proxy.

This wraps b2DynamicTree_GetCategoryBits

◆ GetUserData()

uint64_t Box2D.DynamicTree.GetUserData ( int  proxyId)

Get proxy user data.

This wraps b2DynamicTree_GetUserData

◆ MoveProxy()

void Box2D.DynamicTree.MoveProxy ( int  proxyId,
AABB  aabb 
)

Move a proxy to a new AABB by removing and reinserting into the tree.

This wraps b2DynamicTree_MoveProxy

◆ 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

This wraps b2DynamicTree_Query

◆ 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

This wraps b2DynamicTree_Query

◆ 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

This wraps b2DynamicTree_Query

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

This wraps b2DynamicTree_Query

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

This wraps b2DynamicTree_RayCast

◆ 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

This wraps b2DynamicTree_RayCast

◆ 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

This wraps b2DynamicTree_RayCast

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

This wraps b2DynamicTree_RayCast

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.

This wraps b2DynamicTree_Rebuild

◆ SetCategoryBits()

void Box2D.DynamicTree.SetCategoryBits ( int  proxyId,
uint64_t  categoryBits 
)

Modify the category bits on a proxy. This is an expensive operation.

This wraps b2DynamicTree_SetCategoryBits

◆ 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

This wraps b2DynamicTree_ShapeCast

◆ 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

This wraps b2DynamicTree_ShapeCast

◆ 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

This wraps b2DynamicTree_ShapeCast

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

This wraps b2DynamicTree_ShapeCast

Type Constraints
TContext :unmanaged 

◆ Validate()

void Box2D.DynamicTree.Validate ( )

Validate this tree. For testing.

This wraps b2DynamicTree_Validate

◆ ValidateNoEnlarged()

void Box2D.DynamicTree.ValidateNoEnlarged ( )

Validate this tree. For testing.

This wraps b2DynamicTree_ValidateNoEnlarged

Property Documentation

◆ AreaRatio

float Box2D.DynamicTree.AreaRatio
get

Get the ratio of the sum of the node areas to the root area.

This wraps b2DynamicTree_GetAreaRatio

◆ ByteCount

int Box2D.DynamicTree.ByteCount
get

Get the number of bytes used by this tree.

This wraps b2DynamicTree_GetByteCount

◆ Height

int Box2D.DynamicTree.Height
get

Get the height of the binary tree.

This wraps b2DynamicTree_GetHeight

◆ ProxyCount

int Box2D.DynamicTree.ProxyCount
get

Get the number of proxies created.

This wraps b2DynamicTree_GetProxyCount

◆ RootBounds

AABB Box2D.DynamicTree.RootBounds
get

Get the bounding box that contains the entire tree.

This wraps b2DynamicTree_GetRootBounds


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