-
Notifications
You must be signed in to change notification settings - Fork 123
VRageMath.MyDynamicAABBTree
← Index ← Namespace Index
public class MyDynamicAABBTree
Dynamic aabb tree implementation as a prunning structure
Namespace: VRageMath
Assembly: VRage.Math.dll
A dynamic tree arranges data in a binary tree to accelerate queries such as volume queries and ray casts. Leafs are proxies with an BoundingBox. In the tree we expand the proxy BoundingBox by Settings.b2_fatAABBFactor so that the proxy BoundingBox is bigger than the client object. This allows the client object to move by small amounts without triggering a tree update. Nodes are pooled and relocatable, so we use node indices rather than pointers.
DictionaryValuesReader<int, DynamicTreeNode> Leaves { get; }
ReadOnlySpan<DynamicTreeNode> Nodes { get; }
MyDynamicAABBTree(Vector3 extension, float aabbMultiplier = 1)
int AddProxy(ref BoundingBox aabb, object userData, uint userFlags, bool rebalance = default)
Create a proxy. Provide a tight fitting BoundingBox and a userData pointer.
BoundingBox GetAabb(int proxyId)
void GetAll<T>(List<T> elementsList, bool clear, List<BoundingBox> boxsList = null)
void GetAllNodeBounds(List<BoundingBox> boxsList)
void GetChildren(int proxyId, out int left, out int right)
void GetFatAABB(int proxyId, out BoundingBox fatAABB)
Get the fat BoundingBox for a proxy.
void GetNodeLeaves(int proxyId, List<int> children)
bool MoveProxy(int proxyId, ref BoundingBox aabb, Vector3 displacement)
Move a proxy with a swepted BoundingBox. If the proxy has moved outside of its fattened BoundingBox, then the proxy is removed from the tree and re-inserted. Otherwise the function returns immediately.
void OverlapAllFrustum<T>(ref BoundingFrustum frustum, List<T> elementsList, bool clear = default)
void OverlapAllFrustum<T>(ref BoundingFrustum frustum, Action<T, bool> add)
void OverlapAllFrustum<T, Op>(ref BoundingFrustum frustum, ref Op add)
void OverlapAllFrustum<T>(ref BoundingFrustum frustum, Action<T, bool> add, float tSqr)
void OverlapAllFrustum<T, Op>(ref BoundingFrustum frustum, float tSqr, ref Op add)
void OverlapAllLineSegment<T>(ref Line line, List<MyLineSegmentOverlapResult<T>> elementsList)
bool OverlapsAnyLeafBoundingBox(ref BoundingBox bbox)
void OverlapSizeableClusters(ref BoundingBox bbox, List<BoundingBox> boundList, double minSize)
void Query(Func<int, bool> callback, ref BoundingBox aabb)
Destroy a proxy. This asserts if the id is invalid.
Do you have questions, comments, suggestions for improvements? Is there something I can do better? Did I make a mistake? Please add an issue here, and prefix your issue title with Wiki. Thank you, your help will be very appreciated!