A* Pathfinding Project  3.6.6
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
PathHandler Class Reference

Handles thread specific path data. More...

Detailed Description

Handles thread specific path data.

Public Member Functions

 PathHandler (int threadID, int totalThreadCount)
 
void ClearPathIDs ()
 Set all node's pathIDs to 0.
 
void DestroyNode (GraphNode node)
 Internal method to clean up node data.
 
BinaryHeapM GetHeap ()
 Get the internal heap.
 
PathNode GetPathNode (int nodeIndex)
 
PathNode GetPathNode (GraphNode 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 off 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 = 0
 
BinaryHeapM heap = new BinaryHeapM(128)
 Binary heap to keep nodes on the "Open list".
 
ushort pathID
 Current PathID.
 

Constructor & Destructor Documentation

PathHandler ( int  threadID,
int  totalThreadCount 
)

Member Function Documentation

void ClearPathIDs ( )

Set all node's pathIDs to 0.

See Also
Pathfinding.PathNode.pathID
void DestroyNode ( GraphNode  node)

Internal method to clean up node data.

BinaryHeapM GetHeap ( )

Get the internal heap.

Note
Most things can be accomplished with the methods on this class instead.
PathNode GetPathNode ( int  nodeIndex)
PathNode GetPathNode ( GraphNode  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 off 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

Member Data Documentation

Stack<PathNode[]> bucketCache = new Stack<PathNode[]> ()
private
bool [] bucketCreated = new bool[0]
private
const int BucketIndexMask = (1 << BucketSizeLog2)-1
private
bool [] bucketNew = new bool[0]
private
const int BucketSize = 1 << BucketSizeLog2
private

Real bucket size.

const int BucketSizeLog2 = 10
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 to use a single StringBuilder instead of each path creating its own

int filledBuckets = 0
private
BinaryHeapM heap = new BinaryHeapM(128)
private

Binary heap to keep nodes on the "Open list".

PathNode [][] nodes = new PathNode[0][]

Array of buckets containing PathNodes.

ushort pathID
private

Current PathID.

See Also
PathID
readonly int threadID
readonly int totalThreadCount

Property Documentation

ushort PathID
get

ID for the path currently being calculated or last path that was calculated.


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