HughPH.Box2D
Organised dotnet bindings for Box2D 3.1.1
|
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< 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.
|
inline |
Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.
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.
|
inline |
Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.
TContext | : | class |
|
inline |
Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.
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 |
|
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 |
|
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 |
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 |
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. |
|
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 |
|
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 |
|
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 |
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 |
TContext | : | unmanaged |