A* Pathfinding Project
3.8
The A* Pathfinding Project for Unity 3D
|
Handles thread specific path data. More...
Handles thread specific path data.
Public Member Functions | |
PathHandler (int threadID, int totalThreadCount) | |
void | ClearPathIDs () |
Set all nodes' pathIDs to 0. | |
void | DestroyNode (GraphNode node) |
Internal method to clean up node data. | |
BinaryHeapM | GetHeap () |
The internal heap. | |
PathNode | GetPathNode (int nodeIndex) |
PathNode | GetPathNode (GraphNode node) |
Returns the PathNode corresponding to the specified node. | |
bool | HeapEmpty () |
True if the heap is empty. | |
void | InitializeForPath (Path p) |
void | InitializeNode (GraphNode node) |
Internal method to initialize node data. | |
PathNode | PopNode () |
Pop the node with the lowest F score from the heap. | |
void | PushNode (PathNode node) |
Push a node to the heap. | |
void | RebuildHeap () |
Rebuild the heap to account for changed node values. | |
Public Attributes | |
readonly System.Text.StringBuilder | DebugStringBuilder = new System.Text.StringBuilder() |
StringBuilder that paths can use to build debug strings. | |
PathNode[][] | nodes = new PathNode[0][] |
Array of buckets containing PathNodes. | |
readonly int | threadID |
readonly int | totalThreadCount |
Properties | |
ushort | PathID [get] |
ID for the path currently being calculated or last path that was calculated. | |
Private Attributes | |
Stack< PathNode[]> | bucketCache = new Stack<PathNode[]>() |
bool[] | bucketCreated = new bool[0] |
const int | BucketIndexMask = (1 << BucketSizeLog2)-1 |
bool[] | bucketNew = new bool[0] |
const int | BucketSize = 1 << BucketSizeLog2 |
Real bucket size. | |
const int | BucketSizeLog2 = 10 |
Log2 size of buckets. | |
int | filledBuckets |
BinaryHeapM | heap = new BinaryHeapM(128) |
Binary heap to keep track of nodes on the "Open list". | |
ushort | pathID |
Current PathID. | |
PathHandler | ( | int | threadID, |
int | totalThreadCount | ||
) |
void ClearPathIDs | ( | ) |
Set all nodes' pathIDs to 0.
void DestroyNode | ( | GraphNode | node | ) |
Internal method to clean up node data.
BinaryHeapM GetHeap | ( | ) |
PathNode GetPathNode | ( | int | nodeIndex | ) |
Returns the PathNode corresponding to the specified node.
The PathNode is specific to this PathHandler since multiple PathHandlers are used at the same time if multithreading is enabled.
bool HeapEmpty | ( | ) |
True if the heap is empty.
void InitializeForPath | ( | Path | p | ) |
void InitializeNode | ( | GraphNode | node | ) |
Internal method to initialize node data.
PathNode PopNode | ( | ) |
Pop the node with the lowest F score from the heap.
void PushNode | ( | PathNode | node | ) |
Push a node to the heap.
void RebuildHeap | ( | ) |
Rebuild the heap to account for changed node values.
Some path types change the target for the H score in the middle of the path calculation, that requires rebuilding the heap to keep it correctly sorted.
|
private |
|
private |
|
private |
|
private |
Real bucket size.
|
private |
Log2 size of buckets.
So 10 yields a real bucket size of 1024. Be careful with large values.
readonly System.Text.StringBuilder DebugStringBuilder = new System.Text.StringBuilder() |
StringBuilder that paths can use to build debug strings.
Better for performance and memory usage to use a single StringBuilder instead of each path creating its own
|
private |
|
private |
Binary heap to keep track of nodes on the "Open list".
|
private |
Current PathID.
readonly int threadID |
readonly int totalThreadCount |
|
get |
ID for the path currently being calculated or last path that was calculated.