A* Pathfinding Project
4.0.11
The A* Pathfinding Project for Unity 3D
|
Represents a collection of GraphNodes. More...
Represents a collection of GraphNodes.
It allows for fast lookups of the closest node to a point
Classes | |
class | CompareX |
class | CompareY |
class | CompareZ |
struct | Node |
Public Member Functions | |
PointKDTree () | |
void | Add (GraphNode node) |
Add the node to the tree. | |
void | GetInRange (Int3 point, long sqrRadius, List< GraphNode > buffer) |
Add all nodes within a squared distance of the point to the buffer. | |
GraphNode | GetNearest (Int3 point, NNConstraint constraint) |
Closest node to the point which satisfies the constraint. | |
void | OnDrawGizmos () |
Draw gizmos for the tree. | |
void | Rebuild (GraphNode[] nodes, int start, int end) |
Rebuild the tree starting with all nodes in the array between index start (inclusive) and end (exclusive) | |
Static Public Attributes | |
static int | LeafSize = 10 |
Private Member Functions | |
void | Add (GraphNode point, int index, int depth=0) |
void | Build (int index, List< GraphNode > nodes, int start, int end) |
void | CollectAndClear (int index, List< GraphNode > buffer) |
void | Draw (int index, Int3 mn, Int3 mx, int depth=0) |
void | EnsureSize (int index) |
void | GetInRangeInternal (int index, Int3 point, long sqrRadius, List< GraphNode > buffer) |
void | GetNearestInternal (int index, Int3 point, NNConstraint constraint, ref GraphNode best, ref long bestSqrDist) |
List< GraphNode > | GetOrCreateList () |
void | Rebalance (int index) |
int | Size (int index) |
Static Private Member Functions | |
static int | MaxAllowedSize (int numNodes, int depth) |
Private Attributes | |
readonly List< GraphNode > | largeList = new List<GraphNode>() |
readonly Stack< List< GraphNode > > | listCache = new Stack<List<GraphNode> >() |
int | numNodes = 0 |
Node[] | tree = new Node[16] |
Static Private Attributes | |
static readonly IComparer < GraphNode >[] | comparers = new IComparer<GraphNode>[] { new CompareX(), new CompareY(), new CompareZ() } |
PointKDTree | ( | ) |
void Add | ( | GraphNode | node | ) |
Add the node to the tree.
|
private |
|
private |
|
private |
|
private |
Add all nodes within a squared distance of the point to the buffer.
GraphNode GetNearest | ( | Int3 | point, |
NNConstraint | constraint | ||
) |
Closest node to the point which satisfies the constraint.
|
private |
|
private |
|
staticprivate |
void OnDrawGizmos | ( | ) |
Draw gizmos for the tree.
|
private |
void Rebuild | ( | GraphNode[] | nodes, |
int | start, | ||
int | end | ||
) |
Rebuild the tree starting with all nodes in the array between index start (inclusive) and end (exclusive)
|
private |
|
staticprivate |
|
static |
|
private |