A* Pathfinding Project  3.8.2
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
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.
 
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.
 
new void ToString ()
 

Public Attributes

RecastBBTreeBox root
 

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 RectContains (Rect r, Vector3 p)
 Returns if a rect contains the 3D point in XZ space.
 
static bool RectIntersectsCircle (Rect r, Vector3 p, float radius)
 
static bool RectIntersectsRect (Rect r, Rect r2)
 
static bool XIntersectsCircle (float x1, float x2, float zpos, Vector3 circle, float radius)
 
static bool ZIntersectsCircle (float z1, float z2, float xpos, Vector3 circle, float radius)
 

Member Function Documentation

static Rect ExpandToContain ( Rect  r,
Rect  r2 
)
staticprivate

Returns a new rect which contains both r and r2.

static float ExpansionRequired ( Rect  r,
Rect  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)
void QueryBoxInBounds ( RecastBBTreeBox  box,
Rect  bounds,
List< RecastMeshObj boxes 
)
private
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
static float RectArea ( Rect  r)
staticprivate

Returns the area of a rect.

static bool RectContains ( Rect  r,
Vector3  p 
)
staticprivate

Returns if a rect contains the 3D point in XZ space.

static bool RectIntersectsCircle ( Rect  r,
Vector3  p,
float  radius 
)
staticprivate
static bool RectIntersectsRect ( Rect  r,
Rect  r2 
)
staticprivate
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.
RecastBBTreeBox RemoveBox ( RecastBBTreeBox  c,
RecastMeshObj  mesh,
Rect  bounds,
ref bool  found 
)
private
new void ToString ( )
static bool XIntersectsCircle ( float  x1,
float  x2,
float  zpos,
Vector3  circle,
float  radius 
)
staticprivate
static bool ZIntersectsCircle ( float  z1,
float  z2,
float  xpos,
Vector3  circle,
float  radius 
)
staticprivate

Member Data Documentation


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