Class MyDynamicAABBTree
Dynamic aabb tree implementation as a prunning structure
Inheritance
System.Object
MyDynamicAABBTree
Assembly: VRage.Math.dll
Syntax
public class MyDynamicAABBTree : Object
Constructors
MyDynamicAABBTree()
Declaration
public MyDynamicAABBTree()
MyDynamicAABBTree(Vector3, Single)
Declaration
public MyDynamicAABBTree(Vector3 extension, float aabbMultiplier = 1F)
Parameters
Type |
Name |
Description |
Vector3 |
extension |
|
System.Single |
aabbMultiplier |
|
Fields
NullNode
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.
Declaration
public const int NullNode = -1
Field Value
Type |
Description |
System.Int32 |
|
Properties
Leaves
Declaration
public DictionaryValuesReader<int, MyDynamicAABBTree.DynamicTreeNode> Leaves { get; }
Property Value
Nodes
Declaration
public ReadOnlySpan<MyDynamicAABBTree.DynamicTreeNode> Nodes { get; }
Property Value
Methods
AddProxy(ref BoundingBox, Object, UInt32, Boolean)
Create a proxy. Provide a tight fitting BoundingBox and a userData pointer.
Declaration
public int AddProxy(ref BoundingBox aabb, object userData, uint userFlags, bool rebalance = true)
Parameters
Type |
Name |
Description |
BoundingBox |
aabb |
The aabb.
|
System.Object |
userData |
The user data.
|
System.UInt32 |
userFlags |
|
System.Boolean |
rebalance |
|
Returns
Type |
Description |
System.Int32 |
|
Balance(Int32)
Declaration
public int Balance(int iA)
Parameters
Type |
Name |
Description |
System.Int32 |
iA |
|
Returns
Type |
Description |
System.Int32 |
|
Clear()
Declaration
CountLeaves(Int32)
Declaration
public int CountLeaves(int nodeId)
Parameters
Type |
Name |
Description |
System.Int32 |
nodeId |
|
Returns
Type |
Description |
System.Int32 |
|
Dispose()
Declaration
public static void Dispose()
GetAabb(Int32)
Declaration
public BoundingBox GetAabb(int proxyId)
Parameters
Type |
Name |
Description |
System.Int32 |
proxyId |
|
Returns
GetAll<T>(List<T>, Boolean, List<BoundingBox>)
Declaration
public void GetAll<T>(List<T> elementsList, bool clear, List<BoundingBox> boxsList = null)
Parameters
Type |
Name |
Description |
System.Collections.Generic.List<T> |
elementsList |
|
System.Boolean |
clear |
|
System.Collections.Generic.List<BoundingBox> |
boxsList |
|
Type Parameters
GetAllNodeBounds(List<BoundingBox>)
Declaration
public void GetAllNodeBounds(List<BoundingBox> boxsList)
Parameters
Type |
Name |
Description |
System.Collections.Generic.List<BoundingBox> |
boxsList |
|
GetChildren(Int32, out Int32, out Int32)
Declaration
public void GetChildren(int proxyId, out int left, out int right)
Parameters
Type |
Name |
Description |
System.Int32 |
proxyId |
|
System.Int32 |
left |
|
System.Int32 |
right |
|
GetFatAABB(Int32, out BoundingBox)
Get the fat BoundingBox for a proxy.
Declaration
public void GetFatAABB(int proxyId, out BoundingBox fatAABB)
Parameters
Type |
Name |
Description |
System.Int32 |
proxyId |
The proxy id.
|
BoundingBox |
fatAABB |
The fat BoundingBox.
|
GetHeight()
Declaration
Returns
Type |
Description |
System.Int32 |
|
GetLeafCount()
Declaration
public int GetLeafCount()
Returns
Type |
Description |
System.Int32 |
|
GetLeafCount(Int32)
Declaration
public int GetLeafCount(int proxyId)
Parameters
Type |
Name |
Description |
System.Int32 |
proxyId |
|
Returns
Type |
Description |
System.Int32 |
|
GetNodeLeaves(Int32, List<Int32>)
Declaration
public void GetNodeLeaves(int proxyId, List<int> children)
Parameters
Type |
Name |
Description |
System.Int32 |
proxyId |
|
System.Collections.Generic.List<System.Int32> |
children |
|
GetRoot()
Declaration
Returns
Type |
Description |
System.Int32 |
|
GetUserData<T>(Int32)
Declaration
public T GetUserData<T>(int proxyId)
Parameters
Type |
Name |
Description |
System.Int32 |
proxyId |
The proxy id.
|
Returns
Type |
Description |
T |
the proxy user data or 0 if the id is invalid.
|
Type Parameters
MoveProxy(Int32, ref BoundingBox, Vector3)
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.
Declaration
public bool MoveProxy(int proxyId, ref BoundingBox aabb, Vector3 displacement)
Parameters
Type |
Name |
Description |
System.Int32 |
proxyId |
The proxy id.
|
BoundingBox |
aabb |
The aabb.
|
Vector3 |
displacement |
The displacement.
|
Returns
Type |
Description |
System.Boolean |
true if the proxy was re-inserted.
|
OverlapAllBoundingBox<T>(ref BoundingBox, List<T>, UInt32, Boolean)
Declaration
public void OverlapAllBoundingBox<T>(ref BoundingBox bbox, List<T> elementsList, uint requiredFlags = 0U, bool clear = true)
Parameters
Type |
Name |
Description |
BoundingBox |
bbox |
|
System.Collections.Generic.List<T> |
elementsList |
|
System.UInt32 |
requiredFlags |
|
System.Boolean |
clear |
|
Type Parameters
OverlapAllBoundingSphere<T>(ref BoundingSphere, List<T>, Boolean)
Declaration
public void OverlapAllBoundingSphere<T>(ref BoundingSphere sphere, List<T> overlapElementsList, bool clear = true)
Parameters
Type |
Name |
Description |
BoundingSphere |
sphere |
|
System.Collections.Generic.List<T> |
overlapElementsList |
|
System.Boolean |
clear |
|
Type Parameters
OverlapAllFrustum<T>(ref BoundingFrustum, Action<T, Boolean>)
Declaration
public void OverlapAllFrustum<T>(ref BoundingFrustum frustum, Action<T, bool> add)
Parameters
Type |
Name |
Description |
BoundingFrustum |
frustum |
|
System.Action<T, System.Boolean> |
add |
|
Type Parameters
OverlapAllFrustum<T>(ref BoundingFrustum, Action<T, Boolean>, Single)
Declaration
public void OverlapAllFrustum<T>(ref BoundingFrustum frustum, Action<T, bool> add, float tSqr)
Parameters
Type |
Name |
Description |
BoundingFrustum |
frustum |
|
System.Action<T, System.Boolean> |
add |
|
System.Single |
tSqr |
|
Type Parameters
OverlapAllFrustum<T>(ref BoundingFrustum, List<T>, Boolean)
Declaration
public void OverlapAllFrustum<T>(ref BoundingFrustum frustum, List<T> elementsList, bool clear = true)
Parameters
Type |
Name |
Description |
BoundingFrustum |
frustum |
|
System.Collections.Generic.List<T> |
elementsList |
|
System.Boolean |
clear |
|
Type Parameters
OverlapAllFrustum<T>(ref BoundingFrustum, List<T>, List<Boolean>, Boolean)
Declaration
public void OverlapAllFrustum<T>(ref BoundingFrustum frustum, List<T> elementsList, List<bool> isInsideList, bool clear = true)
Parameters
Type |
Name |
Description |
BoundingFrustum |
frustum |
|
System.Collections.Generic.List<T> |
elementsList |
|
System.Collections.Generic.List<System.Boolean> |
isInsideList |
|
System.Boolean |
clear |
|
Type Parameters
OverlapAllFrustum<T>(ref BoundingFrustum, List<T>, List<Boolean>, Single, Boolean)
Declaration
public void OverlapAllFrustum<T>(ref BoundingFrustum frustum, List<T> elementsList, List<bool> isInsideList, float tSqr, bool clear = true)
Parameters
Type |
Name |
Description |
BoundingFrustum |
frustum |
|
System.Collections.Generic.List<T> |
elementsList |
|
System.Collections.Generic.List<System.Boolean> |
isInsideList |
|
System.Single |
tSqr |
|
System.Boolean |
clear |
|
Type Parameters
OverlapAllFrustum<T>(ref BoundingFrustum, List<T>, UInt32, Boolean)
Declaration
public void OverlapAllFrustum<T>(ref BoundingFrustum frustum, List<T> elementsList, uint requiredFlags, bool clear = true)
Parameters
Type |
Name |
Description |
BoundingFrustum |
frustum |
|
System.Collections.Generic.List<T> |
elementsList |
|
System.UInt32 |
requiredFlags |
|
System.Boolean |
clear |
|
Type Parameters
OverlapAllFrustum<T, Op>(ref BoundingFrustum, ref Op)
Declaration
public void OverlapAllFrustum<T, Op>(ref BoundingFrustum frustum, ref Op add)
where Op : struct, IAddOp<T>, ValueType
Parameters
Type Parameters
OverlapAllFrustum<T, Op>(ref BoundingFrustum, Single, ref Op)
Declaration
public void OverlapAllFrustum<T, Op>(ref BoundingFrustum frustum, float tSqr, ref Op add)
where Op : struct, IAddOp<T>, ValueType
Parameters
Type Parameters
OverlapAllFrustumAny<T>(ref BoundingFrustum, List<T>, Boolean)
Declaration
public void OverlapAllFrustumAny<T>(ref BoundingFrustum frustum, List<T> elementsList, bool clear = true)
Parameters
Type |
Name |
Description |
BoundingFrustum |
frustum |
|
System.Collections.Generic.List<T> |
elementsList |
|
System.Boolean |
clear |
|
Type Parameters
OverlapAllFrustumConservative<T>(ref BoundingFrustum, List<T>, UInt32, Boolean)
Declaration
public void OverlapAllFrustumConservative<T>(ref BoundingFrustum frustum, List<T> elementsList, uint requiredFlags, bool clear = true)
Parameters
Type |
Name |
Description |
BoundingFrustum |
frustum |
|
System.Collections.Generic.List<T> |
elementsList |
|
System.UInt32 |
requiredFlags |
|
System.Boolean |
clear |
|
Type Parameters
OverlapAllLineSegment<T>(ref Line, List<MyLineSegmentOverlapResult<T>>)
Declaration
public void OverlapAllLineSegment<T>(ref Line line, List<MyLineSegmentOverlapResult<T>> elementsList)
Parameters
Type Parameters
OverlapAllLineSegment<T>(ref Line, List<MyLineSegmentOverlapResult<T>>, UInt32)
Declaration
public void OverlapAllLineSegment<T>(ref Line line, List<MyLineSegmentOverlapResult<T>> elementsList, uint requiredFlags)
Parameters
Type Parameters
OverlapsAnyLeafBoundingBox(ref BoundingBox)
Declaration
public bool OverlapsAnyLeafBoundingBox(ref BoundingBox bbox)
Parameters
Returns
Type |
Description |
System.Boolean |
|
OverlapSizeableClusters(ref BoundingBox, List<BoundingBox>, Double)
Declaration
public void OverlapSizeableClusters(ref BoundingBox bbox, List<BoundingBox> boundList, double minSize)
Parameters
Type |
Name |
Description |
BoundingBox |
bbox |
|
System.Collections.Generic.List<BoundingBox> |
boundList |
|
System.Double |
minSize |
|
Query(Func<Int32, Boolean>, ref BoundingBox)
Declaration
public void Query(Func<int, bool> callback, ref BoundingBox aabb)
Parameters
Type |
Name |
Description |
System.Func<System.Int32, System.Boolean> |
callback |
|
BoundingBox |
aabb |
|
RemoveProxy(Int32)
Destroy a proxy. This asserts if the id is invalid.
Declaration
public void RemoveProxy(int proxyId)
Parameters
Type |
Name |
Description |
System.Int32 |
proxyId |
The proxy id.
|