| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Box2D.DynamicTree
Synopsis
- create :: Int -> Ptr DynamicTree -> IO ()
- destroy :: Ptr DynamicTree -> IO ()
- createProxy :: Ptr DynamicTree -> AABB -> Word64 -> Word64 -> IO Int
- destroyProxy :: Ptr DynamicTree -> Int -> IO ()
- moveProxy :: Ptr DynamicTree -> Int -> AABB -> IO ()
- enlargeProxy :: Ptr DynamicTree -> Int -> AABB -> IO ()
- setCategoryBits :: Ptr DynamicTree -> Int -> Word64 -> IO ()
- getCategoryBits :: Ptr DynamicTree -> Int -> IO Word64
- query :: Ptr DynamicTree -> AABB -> Word64 -> FunPtr TreeQueryCallbackFcn -> Ptr () -> IO TreeStats
- queryAll :: Ptr DynamicTree -> AABB -> FunPtr TreeQueryCallbackFcn -> Ptr () -> IO TreeStats
- rayCast :: Ptr DynamicTree -> RayCastInput -> Word64 -> FunPtr TreeRayCastCallbackFcn -> Ptr () -> IO TreeStats
- boxCast :: Ptr DynamicTree -> Ptr BoxCastInput -> Word64 -> FunPtr TreeBoxCastCallbackFcn -> Ptr () -> IO TreeStats
- boxCastInto :: Ptr DynamicTree -> Ptr BoxCastInput -> Word64 -> FunPtr TreeBoxCastCallbackFcn -> Ptr () -> Ptr TreeStats -> IO ()
- getHeight :: Ptr DynamicTree -> IO Int
- getAreaRatio :: Ptr DynamicTree -> IO Float
- getRootBounds :: Ptr DynamicTree -> IO AABB
- getRootBoundsInto :: Ptr DynamicTree -> Ptr AABB -> IO ()
- getProxyCount :: Ptr DynamicTree -> IO Int
- rebuild :: Ptr DynamicTree -> Bool -> IO Int
- getByteCount :: Ptr DynamicTree -> IO Int
- getUserData :: Ptr DynamicTree -> Int -> IO Word64
- getAABB :: Ptr DynamicTree -> Int -> IO AABB
- getAABBInto :: Ptr DynamicTree -> Int -> Ptr AABB -> IO ()
- validate :: Ptr DynamicTree -> IO ()
- validateNoEnlarged :: Ptr DynamicTree -> IO ()
Documentation
Arguments
| :: Int | proxyCapacity |
| -> Ptr DynamicTree | Result buffer. |
| -> IO () |
Constructing the tree initializes the node pool.
Binds b2DynamicTree_Create.
destroy :: Ptr DynamicTree -> IO () Source #
Destroy the tree, freeing the node pool.
Binds b2DynamicTree_Destroy.
Create a proxy. Provide an AABB and a userData value.
Binds b2DynamicTree_CreateProxy.
Arguments
| :: Ptr DynamicTree | |
| -> Int | proxyId |
| -> IO () |
Destroy a proxy. This asserts if the id is invalid.
Binds b2DynamicTree_DestroyProxy.
Arguments
| :: Ptr DynamicTree | |
| -> Int | proxyId |
| -> AABB | |
| -> IO () |
Move a proxy to a new AABB by removing and reinserting into the tree.
Binds b2DynamicTree_MoveProxy.
Arguments
| :: Ptr DynamicTree | |
| -> Int | proxyId |
| -> AABB | |
| -> IO () |
Enlarge a proxy and enlarge ancestors as necessary.
Binds b2DynamicTree_EnlargeProxy.
Arguments
| :: Ptr DynamicTree | |
| -> Int | proxyId |
| -> Word64 | categoryBits |
| -> IO () |
Modify the category bits on a proxy. This is an expensive operation.
Binds b2DynamicTree_SetCategoryBits.
Arguments
| :: Ptr DynamicTree | |
| -> Int | proxyId |
| -> IO Word64 |
Get the category bits on a proxy.
Binds b2DynamicTree_GetCategoryBits.
Arguments
| :: Ptr DynamicTree | |
| -> AABB | |
| -> Word64 | maskBits |
| -> FunPtr TreeQueryCallbackFcn | |
| -> Ptr () | context |
| -> IO TreeStats |
Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.
Returns: performance data
Binds b2DynamicTree_Query.
Arguments
| :: Ptr DynamicTree | |
| -> AABB | |
| -> FunPtr TreeQueryCallbackFcn | |
| -> Ptr () | context |
| -> IO TreeStats |
Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB. No filtering is performed.
Returns: performance data
Binds b2DynamicTree_QueryAll.
Arguments
| :: Ptr DynamicTree |
|
| -> RayCastInput |
|
| -> Word64 |
|
| -> FunPtr TreeRayCastCallbackFcn |
|
| -> Ptr () |
|
| -> IO TreeStats |
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. Bit-wise filtering using mask bits can greatly improve performance in some scenarios. However, this filtering may be approximate, so the user should still apply filtering to results.
Returns: performance data
Binds b2DynamicTree_RayCast.
Arguments
| :: Ptr DynamicTree |
|
| -> Ptr BoxCastInput |
|
| -> Word64 |
|
| -> FunPtr TreeBoxCastCallbackFcn |
|
| -> Ptr () |
|
| -> IO TreeStats |
Cast a swept AABB through the tree. 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.
Returns: performance data
Binds b2DynamicTree_BoxCast.
Arguments
| :: Ptr DynamicTree |
|
| -> Ptr BoxCastInput |
|
| -> Word64 |
|
| -> FunPtr TreeBoxCastCallbackFcn |
|
| -> Ptr () |
|
| -> Ptr TreeStats | Result buffer. |
| -> IO () |
Like boxCast, but the result is written into a caller-supplied buffer.
getHeight :: Ptr DynamicTree -> IO Int Source #
Get the height of the binary tree.
Binds b2DynamicTree_GetHeight.
getAreaRatio :: Ptr DynamicTree -> IO Float Source #
Get the ratio of the sum of the node areas to the root area.
Binds b2DynamicTree_GetAreaRatio.
getRootBounds :: Ptr DynamicTree -> IO AABB Source #
Get the bounding box that contains the entire tree
Binds b2DynamicTree_GetRootBounds.
Arguments
| :: Ptr DynamicTree | |
| -> Ptr AABB | Result buffer. |
| -> IO () |
Like getRootBounds, but the result is written into a caller-supplied buffer.
getProxyCount :: Ptr DynamicTree -> IO Int Source #
Get the number of proxies created
Binds b2DynamicTree_GetProxyCount.
Arguments
| :: Ptr DynamicTree | |
| -> Bool | fullBuild |
| -> IO Int |
Rebuild the tree while retaining subtrees that haven't changed. Returns the number of boxes sorted.
Binds b2DynamicTree_Rebuild.
getByteCount :: Ptr DynamicTree -> IO Int Source #
Get the number of bytes used by this tree
Binds b2DynamicTree_GetByteCount.
Arguments
| :: Ptr DynamicTree | |
| -> Int | proxyId |
| -> IO Word64 |
Get proxy user data
Binds b2DynamicTree_GetUserData.
Arguments
| :: Ptr DynamicTree | |
| -> Int | proxyId |
| -> IO AABB |
Get the AABB of a proxy
Binds b2DynamicTree_GetAABB.
Like getAABB, but the result is written into a caller-supplied buffer.
validate :: Ptr DynamicTree -> IO () Source #
Validate this tree. For testing.
Binds b2DynamicTree_Validate.
validateNoEnlarged :: Ptr DynamicTree -> IO () Source #
Validate this tree has no enlarged AABBs. For testing.
Binds b2DynamicTree_ValidateNoEnlarged.