Space Engineers
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
VRageMath.MyDynamicAABBTree Class Reference

Dynamic aabb tree implementation as a prunning structure More...

Classes

class  DynamicTreeNode
 A dynamic BoundingBox tree broad-phase, inspired by Nathanael Presson's btDbvt.
 

Public Member Functions

 MyDynamicAABBTree (Vector3 extension, float aabbMultiplier=1)
 constructing the tree initializes the node pool. More...
 
int AddProxy (ref BoundingBox aabb, object userData, uint userFlags, bool rebalance=true)
 Create a proxy. Provide a tight fitting BoundingBox and a userData pointer. More...
 
void RemoveProxy (int proxyId)
 Destroy a proxy. This asserts if the id is invalid. More...
 
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. More...
 
GetUserData< T > (int proxyId)
 Get proxy user data. More...
 
int GetRoot ()
 
int GetLeafCount (int proxyId)
 
void GetNodeLeaves (int proxyId, List< int > children)
 
BoundingBox GetAabb (int proxyId)
 
void GetChildren (int proxyId, out int left, out int right)
 
void GetFatAABB (int proxyId, out BoundingBox fatAABB)
 Get the fat BoundingBox for a proxy. More...
 
void Query (Func< int, bool > callback, ref BoundingBox aabb)
 
int CountLeaves (int nodeId)
 
int GetHeight ()
 
int Balance (int iA)
 
void OverlapAllFrustum< T > (ref BoundingFrustum frustum, List< T > elementsList, bool clear=true)
 
void OverlapAllFrustum< T > (ref BoundingFrustum frustum, List< T > elementsList, uint requiredFlags, bool clear=true)
 
void OverlapAllFrustum< T > (ref BoundingFrustum frustum, List< T > elementsList, List< bool > isInsideList, uint requiredFlags, bool clear=true)
 
void OverlapAllFrustum< T > (ref BoundingFrustum frustum, List< T > elementsList, List< bool > isInsideList, Vector3 projectionDir, float projectionFactor, float ignoreThr, uint requiredFlags, bool clear=true)
 
void OverlapAllFrustumConservative< T > (ref BoundingFrustum frustum, List< T > elementsList, uint requiredFlags, bool clear=true)
 
void OverlapAllFrustumAny< T > (ref BoundingFrustum frustum, List< T > elementsList, bool clear=true)
 
void OverlapAllLineSegment< T > (ref Line line, List< MyLineSegmentOverlapResult< T >> elementsList)
 
void OverlapAllLineSegment< T > (ref Line line, List< MyLineSegmentOverlapResult< T >> elementsList, uint requiredFlags)
 
void OverlapAllBoundingBox< T > (ref BoundingBox bbox, List< T > elementsList, uint requiredFlags=0, bool clear=true)
 
bool OverlapsAnyLeafBoundingBox (ref BoundingBox bbox)
 
void OverlapSizeableClusters (ref BoundingBox bbox, List< BoundingBox > boundList, double minSize)
 
void OverlapAllBoundingSphere< T > (ref BoundingSphere sphere, List< T > overlapElementsList, bool clear=true)
 
void GetAll< T > (List< T > elementsList, bool clear, List< BoundingBox > boxsList=null)
 
void GetAllNodeBounds (List< BoundingBox > boxsList)
 
void Clear ()
 

Static Public Member Functions

static void Dispose ()
 

Public Attributes

const int NullNode = -1
 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. More...
 

Detailed Description

Dynamic aabb tree implementation as a prunning structure

Definition at line 16 of file MyDynamicAABBTree.cs.

Constructor & Destructor Documentation

VRageMath.MyDynamicAABBTree.MyDynamicAABBTree ( Vector3  extension,
float  aabbMultiplier = 1 
)
inline

constructing the tree initializes the node pool.

Definition at line 93 of file MyDynamicAABBTree.cs.

Member Function Documentation

int VRageMath.MyDynamicAABBTree.AddProxy ( ref BoundingBox  aabb,
object  userData,
uint  userFlags,
bool  rebalance = true 
)
inline

Create a proxy. Provide a tight fitting BoundingBox and a userData pointer.

Parameters
aabbThe aabb.
userDataThe user data.
Returns

Definition at line 133 of file MyDynamicAABBTree.cs.

int VRageMath.MyDynamicAABBTree.Balance ( int  iA)
inline

Definition at line 729 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.Clear ( )
inline

Definition at line 1603 of file MyDynamicAABBTree.cs.

int VRageMath.MyDynamicAABBTree.CountLeaves ( int  nodeId)
inline

Definition at line 409 of file MyDynamicAABBTree.cs.

static void VRageMath.MyDynamicAABBTree.Dispose ( )
inlinestatic

Definition at line 1611 of file MyDynamicAABBTree.cs.

BoundingBox VRageMath.MyDynamicAABBTree.GetAabb ( int  proxyId)
inline

Definition at line 330 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.GetAll< T > ( List< T >  elementsList,
bool  clear,
List< BoundingBox boxsList = null 
)
inline

Definition at line 1541 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.GetAllNodeBounds ( List< BoundingBox boxsList)
inline

Definition at line 1567 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.GetChildren ( int  proxyId,
out int  left,
out int  right 
)
inline

Definition at line 336 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.GetFatAABB ( int  proxyId,
out BoundingBox  fatAABB 
)
inline

Get the fat BoundingBox for a proxy.

Parameters
proxyIdThe proxy id.
fatAABBThe fat BoundingBox.

Definition at line 359 of file MyDynamicAABBTree.cs.

int VRageMath.MyDynamicAABBTree.GetHeight ( )
inline

Compute the height of the binary tree in O(N) time. Should not be called often.

Definition at line 714 of file MyDynamicAABBTree.cs.

int VRageMath.MyDynamicAABBTree.GetLeafCount ( int  proxyId)
inline

Definition at line 259 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.GetNodeLeaves ( int  proxyId,
List< int >  children 
)
inline

Definition at line 296 of file MyDynamicAABBTree.cs.

int VRageMath.MyDynamicAABBTree.GetRoot ( )
inline

Definition at line 254 of file MyDynamicAABBTree.cs.

T VRageMath.MyDynamicAABBTree.GetUserData< T > ( int  proxyId)
inline

Get proxy user data.

Parameters
proxyIdThe proxy id.
Returns
the proxy user data or 0 if the id is invalid.

Definition at line 248 of file MyDynamicAABBTree.cs.

bool VRageMath.MyDynamicAABBTree.MoveProxy ( int  proxyId,
ref BoundingBox  aabb,
Vector3  displacement 
)
inline

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.

Parameters
proxyIdThe proxy id.
aabbThe aabb.
displacementThe displacement.
Returns
true if the proxy was re-inserted.

Definition at line 182 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.OverlapAllBoundingBox< T > ( ref BoundingBox  bbox,
List< T >  elementsList,
uint  requiredFlags = 0,
bool  clear = true 
)
inline

Definition at line 1366 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.OverlapAllBoundingSphere< T > ( ref BoundingSphere  sphere,
List< T >  overlapElementsList,
bool  clear = true 
)
inline

Definition at line 1497 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.OverlapAllFrustum< T > ( ref BoundingFrustum  frustum,
List< T >  elementsList,
bool  clear = true 
)
inline

Definition at line 873 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.OverlapAllFrustum< T > ( ref BoundingFrustum  frustum,
List< T >  elementsList,
uint  requiredFlags,
bool  clear = true 
)
inline

Definition at line 878 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.OverlapAllFrustum< T > ( ref BoundingFrustum  frustum,
List< T >  elementsList,
List< bool >  isInsideList,
uint  requiredFlags,
bool  clear = true 
)
inline

Definition at line 960 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.OverlapAllFrustum< T > ( ref BoundingFrustum  frustum,
List< T >  elementsList,
List< bool >  isInsideList,
Vector3  projectionDir,
float  projectionFactor,
float  ignoreThr,
uint  requiredFlags,
bool  clear = true 
)
inline

Definition at line 1049 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.OverlapAllFrustumAny< T > ( ref BoundingFrustum  frustum,
List< T >  elementsList,
bool  clear = true 
)
inline

Definition at line 1228 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.OverlapAllFrustumConservative< T > ( ref BoundingFrustum  frustum,
List< T >  elementsList,
uint  requiredFlags,
bool  clear = true 
)
inline

Definition at line 1146 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.OverlapAllLineSegment< T > ( ref Line  line,
List< MyLineSegmentOverlapResult< T >>  elementsList 
)
inline

Definition at line 1304 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.OverlapAllLineSegment< T > ( ref Line  line,
List< MyLineSegmentOverlapResult< T >>  elementsList,
uint  requiredFlags 
)
inline

Definition at line 1309 of file MyDynamicAABBTree.cs.

bool VRageMath.MyDynamicAABBTree.OverlapsAnyLeafBoundingBox ( ref BoundingBox  bbox)
inline

Definition at line 1414 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.OverlapSizeableClusters ( ref BoundingBox  bbox,
List< BoundingBox boundList,
double  minSize 
)
inline

Use the tree to produce a list of clusters aproximatelly the requested size, while intersecting those with the provided bounding box.

Definition at line 1457 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.Query ( Func< int, bool >  callback,
ref BoundingBox  aabb 
)
inline

Query an BoundingBox for overlapping proxies. The callback class is called for each proxy that overlaps the supplied BoundingBox.

Definition at line 370 of file MyDynamicAABBTree.cs.

void VRageMath.MyDynamicAABBTree.RemoveProxy ( int  proxyId)
inline

Destroy a proxy. This asserts if the id is invalid.

Parameters
proxyIdThe proxy id.

Definition at line 159 of file MyDynamicAABBTree.cs.

Member Data Documentation

const int VRageMath.MyDynamicAABBTree.NullNode = -1

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.

Definition at line 54 of file MyDynamicAABBTree.cs.


The documentation for this class was generated from the following file: