A* Pathfinding Project  4.2.0
The A* Pathfinding Project for Unity 3D
RecastBBTree Class Reference

Axis Aligned Bounding Box Tree. More...

Detailed Description

Axis Aligned Bounding Box Tree.

Holds a bounding box tree of RecastMeshObj components.
Note that it assumes that once an object has been added, it stays at the same world position. If it is moved, then it might not be able to be found.

A* Pro Feature:
This is an A* Pathfinding Project Pro feature only. This function/class/variable might not exist in the Free version of the A* Pathfinding Project or the functionality might be limited
The Pro version can be bought here

Public Member Functions

void Insert (RecastMeshObj mesh)
 Inserts a RecastMeshObj in the tree at its current position. More...
 
void QueryInBounds (Rect bounds, List< RecastMeshObj > buffer)
 Queries the tree for all RecastMeshObjs inside the specified bounds. More...
 
bool Remove (RecastMeshObj mesh)
 Removes the specified mesh from the tree. More...
 

Private Member Functions

void QueryBoxInBounds (RecastBBTreeBox box, Rect bounds, List< RecastMeshObj > boxes)
 
RecastBBTreeBox RemoveBox (RecastBBTreeBox c, RecastMeshObj mesh, Rect bounds, ref bool found)
 

Static Private Member Functions

static Rect ExpandToContain (Rect r, Rect r2)
 Returns a new rect which contains both r and r2. More...
 
static float ExpansionRequired (Rect r, Rect r2)
 Returns the difference in area between r and r expanded to contain r2. More...
 
static float RectArea (Rect r)
 Returns the area of a rect. More...
 
static bool RectIntersectsRect (Rect r, Rect r2)
 

Private Attributes

RecastBBTreeBox root
 

Member Function Documentation

◆ ExpandToContain()

static Rect ExpandToContain ( Rect  r,
Rect  r2 
)
staticprivate

Returns a new rect which contains both r and r2.

◆ ExpansionRequired()

static float ExpansionRequired ( Rect  r,
Rect  r2 
)
staticprivate

Returns the difference in area between r and r expanded to contain r2.

◆ Insert()

void Insert ( RecastMeshObj  mesh)

Inserts a RecastMeshObj in the tree at its current position.

◆ QueryBoxInBounds()

void QueryBoxInBounds ( RecastBBTreeBox  box,
Rect  bounds,
List< RecastMeshObj boxes 
)
private

◆ QueryInBounds()

void QueryInBounds ( Rect  bounds,
List< RecastMeshObj buffer 
)

Queries the tree for all RecastMeshObjs inside the specified bounds.

Parameters
boundsWorld space bounds to search within
bufferThe results will be added to the buffer

◆ RectArea()

static float RectArea ( Rect  r)
staticprivate

Returns the area of a rect.

◆ RectIntersectsRect()

static bool RectIntersectsRect ( Rect  r,
Rect  r2 
)
staticprivate

◆ Remove()

bool Remove ( RecastMeshObj  mesh)

Removes the specified mesh from the tree.

Assumes that it has the correct bounds information.

Returns
True if the mesh was removed from the tree, false otherwise.

◆ RemoveBox()

RecastBBTreeBox RemoveBox ( RecastBBTreeBox  c,
RecastMeshObj  mesh,
Rect  bounds,
ref bool  found 
)
private

Member Data Documentation

◆ root

RecastBBTreeBox root
private

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