A* Pathfinding Project
3.8.12
The A* Pathfinding Project for Unity 3D
|
Axis Aligned Bounding Box Tree. More...
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.
Public Member Functions | |
void | Insert (RecastMeshObj mesh) |
Inserts a RecastMeshObj in the tree at its current position. | |
void | OnDrawGizmos () |
void | OnDrawGizmos (RecastBBTreeBox box) |
void | QueryInBounds (Rect bounds, List< RecastMeshObj > buffer) |
Queries the tree for all RecastMeshObjs inside the specified bounds. | |
bool | Remove (RecastMeshObj mesh) |
Removes the specified mesh from the tree. | |
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. | |
static float | ExpansionRequired (Rect r, Rect r2) |
Returns the difference in area between r and r expanded to contain r2. | |
static float | RectArea (Rect r) |
Returns the area of a rect. | |
static bool | RectIntersectsRect (Rect r, Rect r2) |
Private Attributes | |
RecastBBTreeBox | root |
|
staticprivate |
Returns a new rect which contains both r and r2.
|
staticprivate |
Returns the difference in area between r and r expanded to contain r2.
void Insert | ( | RecastMeshObj | mesh | ) |
Inserts a RecastMeshObj in the tree at its current position.
void OnDrawGizmos | ( | ) |
void OnDrawGizmos | ( | RecastBBTreeBox | box | ) |
|
private |
void QueryInBounds | ( | Rect | bounds, |
List< RecastMeshObj > | buffer | ||
) |
Queries the tree for all RecastMeshObjs inside the specified bounds.
bounds | World space bounds to search within |
buffer | The results will be added to the buffer |
|
staticprivate |
Returns the area of a rect.
|
staticprivate |
bool Remove | ( | RecastMeshObj | mesh | ) |
Removes the specified mesh from the tree.
Assumes that it has the correct bounds information.
|
private |
|
private |