HughPH.Box2D
Organised dotnet bindings for Box2D 3.1.0
|
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< TreeNode > | Nodes [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< AABB > | LeafBoxes [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. | |
Dynamic tree for broad-phase collision detection.
static DynamicTree Box2D.DynamicTree.Create | ( | ) |
Constructing the tree initializes the node pool.
This wraps b2DynamicTree_Create
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
void Box2D.DynamicTree.Destroy | ( | ) |
Destroy the tree, freeing the node pool.
This wraps b2DynamicTree_Destroy
|
inline |
Destroy a proxy. This asserts if the id is invalid.
This wraps b2DynamicTree_DestroyProxy
void Box2D.DynamicTree.EnlargeProxy | ( | int | proxyId, |
AABB | aabb | ||
) |
Enlarge a proxy and enlarge ancestors as necessary.
This wraps b2DynamicTree_EnlargeProxy
AABB Box2D.DynamicTree.GetAABB | ( | int | proxyId | ) |
Get the AABB of a proxy.
This wraps b2DynamicTree_GetAABB
uint64_t Box2D.DynamicTree.GetCategoryBits | ( | int | proxyId | ) |
Get the category bits on a proxy.
This wraps b2DynamicTree_GetCategoryBits
uint64_t Box2D.DynamicTree.GetUserData | ( | int | proxyId | ) |
Get proxy user data.
This wraps b2DynamicTree_GetUserData
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
|
inline |
Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.
This wraps b2DynamicTree_Query
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.
This wraps b2DynamicTree_Query
|
inline |
Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.
This wraps b2DynamicTree_Query
TContext | : | class |
|
inline |
Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.
This wraps b2DynamicTree_Query
TContext | : | unmanaged |
|
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.
input | The ray cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1) |
maskBits | Mask bit hint: bool accept = (maskBits & node->categoryBits) != 0; |
callback | A callback class that is called for each proxy that is hit by the ray |
This wraps b2DynamicTree_RayCast
|
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.
input | The ray cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1) |
maskBits | Mask bit hint: bool accept = (maskBits & node->categoryBits) != 0; |
callback | A callback class that is called for each proxy that is hit by the ray |
context | User context that is passed to the callback |
This wraps b2DynamicTree_RayCast
|
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.
input | The ray cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1) |
maskBits | Mask bit hint: bool accept = (maskBits & node->categoryBits) != 0; |
callback | A callback class that is called for each proxy that is hit by the ray |
context | User context that is passed to the callback |
This wraps b2DynamicTree_RayCast
TContext | : | class |
|
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.
input | The ray cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1) |
maskBits | Mask bit hint: bool accept = (maskBits & node->categoryBits) != 0; |
callback | A callback class that is called for each proxy that is hit by the ray |
context | User context that is passed to the callback |
This wraps b2DynamicTree_RayCast
TContext | : | unmanaged |
int Box2D.DynamicTree.Rebuild | ( | bool | fullBuild | ) |
Rebuild the tree while retaining subtrees that haven't changed. Returns the number of boxes sorted.
fullBuild | If true, the tree is fully rebuilt. If false, only the boxes that have changed are rebuilt. |
This wraps b2DynamicTree_Rebuild
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
|
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.
input | The ray cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1). |
maskBits | Filter bits: bool accept = (maskBits & node->categoryBits) != 0; |
callback | A callback class that is called for each proxy that is hit by the shape |
This wraps b2DynamicTree_ShapeCast
|
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.
input | The ray cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1). |
maskBits | Filter bits: bool accept = (maskBits & node->categoryBits) != 0; |
callback | A callback class that is called for each proxy that is hit by the shape |
context | User context that is passed to the callback |
This wraps b2DynamicTree_ShapeCast
|
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.
input | The ray cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1). |
maskBits | Filter bits: bool accept = (maskBits & node->categoryBits) != 0; |
callback | A callback class that is called for each proxy that is hit by the shape |
context | User context that is passed to the callback |
This wraps b2DynamicTree_ShapeCast
TContext | : | class |
|
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.
input | The ray cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1). |
maskBits | Filter bits: bool accept = (maskBits & node->categoryBits) != 0; |
callback | A callback class that is called for each proxy that is hit by the shape |
context | User context that is passed to the callback |
This wraps b2DynamicTree_ShapeCast
TContext | : | unmanaged |
void Box2D.DynamicTree.Validate | ( | ) |
Validate this tree. For testing.
This wraps b2DynamicTree_Validate
void Box2D.DynamicTree.ValidateNoEnlarged | ( | ) |
Validate this tree. For testing.
This wraps b2DynamicTree_ValidateNoEnlarged
|
get |
Get the ratio of the sum of the node areas to the root area.
This wraps b2DynamicTree_GetAreaRatio
|
get |
Get the number of bytes used by this tree.
This wraps b2DynamicTree_GetByteCount
|
get |
Get the height of the binary tree.
This wraps b2DynamicTree_GetHeight
|
get |
Get the number of proxies created.
This wraps b2DynamicTree_GetProxyCount
|
get |
Get the bounding box that contains the entire tree.
This wraps b2DynamicTree_GetRootBounds