Represents a collection of GraphNodes.
More...
Represents a collection of GraphNodes.
It allows for fast lookups of the closest node to a point.
- See also
- https://en.wikipedia.org/wiki/K-d_tree
|
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 | 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) |
|
GraphNode [] | GetOrCreateList () |
|
void | Rebalance (int index) |
|
int | Size (int index) |
|
◆ PointKDTree()
◆ Add() [1/2]
Add the node to the tree.
◆ Add() [2/2]
void Add |
( |
GraphNode |
point, |
|
|
int |
index, |
|
|
int |
depth = 0 |
|
) |
| |
|
private |
◆ Build()
void Build |
( |
int |
index, |
|
|
List< GraphNode > |
nodes, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
|
private |
◆ CollectAndClear()
void CollectAndClear |
( |
int |
index, |
|
|
List< GraphNode > |
buffer |
|
) |
| |
|
private |
◆ EnsureSize()
void EnsureSize |
( |
int |
index | ) |
|
|
private |
◆ GetInRange()
void GetInRange |
( |
Int3 |
point, |
|
|
long |
sqrRadius, |
|
|
List< GraphNode > |
buffer |
|
) |
| |
Add all nodes within a squared distance of the point to the buffer.
- Parameters
-
point | Nodes around this point will be added to the buffer. |
sqrRadius | squared maximum distance in Int3 space. If you are converting from world space you will need to multiply by Int3.Precision: var sqrRadius = (worldSpaceRadius * Int3.Precision) * (worldSpaceRadius * Int3.Precision); |
buffer | All nodes will be added to this list. |
◆ GetInRangeInternal()
void GetInRangeInternal |
( |
int |
index, |
|
|
Int3 |
point, |
|
|
long |
sqrRadius, |
|
|
List< GraphNode > |
buffer |
|
) |
| |
|
private |
◆ GetNearest()
Closest node to the point which satisfies the constraint.
◆ GetNearestInternal()
◆ GetOrCreateList()
◆ MaxAllowedSize()
static int MaxAllowedSize |
( |
int |
numNodes, |
|
|
int |
depth |
|
) |
| |
|
staticprivate |
◆ Rebalance()
void Rebalance |
( |
int |
index | ) |
|
|
private |
◆ Rebuild()
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)
◆ Size()
◆ arrayCache
◆ comparers
◆ largeList
◆ LeafArraySize
const int LeafArraySize = LeafSize*2 + 1 |
◆ LeafSize
◆ numNodes
◆ tree
The documentation for this class was generated from the following file:
- /Users/arong/Unity/a-pathfinding-project/Assets/AstarPathfindingProject/Generators/Utilities/PointKDTree.cs