public interface BroadPhaseStrategy
Known subtypesDynamicTree
Methods
public abstract int createProxy(AABB aabb, Object userData) | Create a proxy. |
public abstract void destroyProxy(int proxyId) | Destroy a proxy |
public abstract boolean moveProxy(int proxyId, AABB aabb, Vec2 displacement) | Move a proxy with a swepted AABB. |
public abstract Object getUserData(int proxyId) | |
public abstract AABB getFatAABB(int proxyId) | |
public abstract void query(TreeCallback callback, AABB aabb) | Query an AABB for overlapping proxies. |
public abstract void raycast(TreeRayCastCallback callback, RayCastInput input) | Ray-cast against the proxies in the tree. |
public abstract int computeHeight() | Compute the height of the tree. |
public abstract int getHeight() | Compute the height of the binary tree in O(N) time. |
public abstract int getMaxBalance() | Get the maximum balance of an node in the tree. |
public abstract float getAreaRatio() | Get the ratio of the sum of the node areas to the root area. |
public abstract int getInsertionCount() | |
public abstract void drawTree(DebugDraw draw) |
Method details
createProxy
public abstract int createProxy(AABB aabb, Object userData)Create a proxy. Provide a tight fitting AABB and a userData pointer.
destroyProxy
public abstract void destroyProxy(int proxyId)Destroy a proxy
moveProxy
public abstract boolean moveProxy(int proxyId, AABB aabb, Vec2 displacement)Move a proxy with a swepted AABB. If the proxy has moved outside of its fattened AABB, then the
proxy is removed from the tree and re-inserted. Otherwise the function returns immediately.
Returns
true if the proxy was re-inserted.
getUserData
public abstract Object getUserData(int proxyId)getFatAABB
public abstract AABB getFatAABB(int proxyId)query
public abstract void query(TreeCallback callback, AABB aabb)Query an AABB for overlapping proxies. The callback class is called for each proxy that
overlaps the supplied AABB.
raycast
public abstract void raycast(TreeRayCastCallback callback, RayCastInput input)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
callbackTreeRayCastCallback- a callback class that is called for each proxy that is hit by the ray.
inputRayCastInput- the ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1).
computeHeight
public abstract int computeHeight()Compute the height of the tree.
getHeight
public abstract int getHeight()Compute the height of the binary tree in O(N) time. Should not be called often.
getMaxBalance
public abstract int getMaxBalance()Get the maximum balance of an node in the tree. The balance is the difference in height of the
two children of a node.
getAreaRatio
public abstract float getAreaRatio()Get the ratio of the sum of the node areas to the root area.
getInsertionCount
public abstract int getInsertionCount()drawTree
public abstract void drawTree(DebugDraw draw)