Show / Hide Table of Contents

Class MyDynamicAABBTree

Dynamic aabb tree implementation as a prunning structure

Inheritance
System.Object
MyDynamicAABBTree
Namespace: VRageMath
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
Type Description
DictionaryValuesReader<System.Int32, MyDynamicAABBTree.DynamicTreeNode>

Nodes

Declaration
public ReadOnlySpan<MyDynamicAABBTree.DynamicTreeNode> Nodes { get; }
Property Value
Type Description
System.ReadOnlySpan<MyDynamicAABBTree.DynamicTreeNode>

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
public void Clear()

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
Type Description
BoundingBox

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
Name Description
T

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
public int GetHeight()
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
public int GetRoot()
Returns
Type Description
System.Int32

GetUserData<T>(Int32)

Get proxy user data.

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
Name Description
T

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
Name Description
T

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
Name Description
T

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
Name Description
T

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
Name Description
T

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
Name Description
T

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
Name Description
T

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
Name Description
T

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
Name Description
T

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 Name Description
BoundingFrustum frustum
Op add
Type Parameters
Name Description
T
Op

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 Name Description
BoundingFrustum frustum
System.Single tSqr
Op add
Type Parameters
Name Description
T
Op

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
Name Description
T

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
Name Description
T

OverlapAllLineSegment<T>(ref Line, List<MyLineSegmentOverlapResult<T>>)

Declaration
public void OverlapAllLineSegment<T>(ref Line line, List<MyLineSegmentOverlapResult<T>> elementsList)
Parameters
Type Name Description
Line line
System.Collections.Generic.List<MyLineSegmentOverlapResult<T>> elementsList
Type Parameters
Name Description
T

OverlapAllLineSegment<T>(ref Line, List<MyLineSegmentOverlapResult<T>>, UInt32)

Declaration
public void OverlapAllLineSegment<T>(ref Line line, List<MyLineSegmentOverlapResult<T>> elementsList, uint requiredFlags)
Parameters
Type Name Description
Line line
System.Collections.Generic.List<MyLineSegmentOverlapResult<T>> elementsList
System.UInt32 requiredFlags
Type Parameters
Name Description
T

OverlapsAnyLeafBoundingBox(ref BoundingBox)

Declaration
public bool OverlapsAnyLeafBoundingBox(ref BoundingBox bbox)
Parameters
Type Name Description
BoundingBox bbox
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.

☀
☾
In This Article
  • Constructors
    • MyDynamicAABBTree()
    • MyDynamicAABBTree(Vector3, Single)
  • Fields
    • NullNode
  • Properties
    • Leaves
    • Nodes
  • Methods
    • AddProxy(ref BoundingBox, Object, UInt32, Boolean)
    • Balance(Int32)
    • Clear()
    • CountLeaves(Int32)
    • Dispose()
    • GetAabb(Int32)
    • GetAll<T>(List<T>, Boolean, List<BoundingBox>)
    • GetAllNodeBounds(List<BoundingBox>)
    • GetChildren(Int32, out Int32, out Int32)
    • GetFatAABB(Int32, out BoundingBox)
    • GetHeight()
    • GetLeafCount()
    • GetLeafCount(Int32)
    • GetNodeLeaves(Int32, List<Int32>)
    • GetRoot()
    • GetUserData<T>(Int32)
    • MoveProxy(Int32, ref BoundingBox, Vector3)
    • OverlapAllBoundingBox<T>(ref BoundingBox, List<T>, UInt32, Boolean)
    • OverlapAllBoundingSphere<T>(ref BoundingSphere, List<T>, Boolean)
    • OverlapAllFrustum<T>(ref BoundingFrustum, Action<T, Boolean>)
    • OverlapAllFrustum<T>(ref BoundingFrustum, Action<T, Boolean>, Single)
    • OverlapAllFrustum<T>(ref BoundingFrustum, List<T>, Boolean)
    • OverlapAllFrustum<T>(ref BoundingFrustum, List<T>, List<Boolean>, Boolean)
    • OverlapAllFrustum<T>(ref BoundingFrustum, List<T>, List<Boolean>, Single, Boolean)
    • OverlapAllFrustum<T>(ref BoundingFrustum, List<T>, UInt32, Boolean)
    • OverlapAllFrustum<T, Op>(ref BoundingFrustum, ref Op)
    • OverlapAllFrustum<T, Op>(ref BoundingFrustum, Single, ref Op)
    • OverlapAllFrustumAny<T>(ref BoundingFrustum, List<T>, Boolean)
    • OverlapAllFrustumConservative<T>(ref BoundingFrustum, List<T>, UInt32, Boolean)
    • OverlapAllLineSegment<T>(ref Line, List<MyLineSegmentOverlapResult<T>>)
    • OverlapAllLineSegment<T>(ref Line, List<MyLineSegmentOverlapResult<T>>, UInt32)
    • OverlapsAnyLeafBoundingBox(ref BoundingBox)
    • OverlapSizeableClusters(ref BoundingBox, List<BoundingBox>, Double)
    • Query(Func<Int32, Boolean>, ref BoundingBox)
    • RemoveProxy(Int32)
Back to top
Generated by DocFX
☀
☾