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

Binary heap implementation. More...

Detailed Description

Binary heap implementation.

Binary heaps are really fast for ordering nodes in a way that makes it possible to get the node with the lowest F score. Also known as a priority queue.

This has actually been rewritten as an n-ary heap (by default a 4-ary heap) for performance, but it's the same principle.

See Also
http://en.wikipedia.org/wiki/Binary_heap

Classes

struct  Tuple
 

Public Member Functions

 BinaryHeapM (int numberOfElements)
 
void Add (PathNode node)
 Adds a node to the heap.
 
void Clear ()
 
void Rebuild ()
 Rebuilds the heap by trickeling down all items.
 
PathNode Remove ()
 Returns the node with the lowest F score from the heap.
 

Public Attributes

const int D = 4
 
float growthFactor = 2
 
int numberOfItems
 

Package Functions

PathNode GetNode (int i)
 
void SetF (int i, uint F)
 

Private Member Functions

void Validate ()
 

Private Attributes

Tuple[] binaryHeap
 
const bool SortGScores = true
 

Constructor & Destructor Documentation

BinaryHeapM ( int  numberOfElements)

Member Function Documentation

void Add ( PathNode  node)

Adds a node to the heap.

void Clear ( )
PathNode GetNode ( int  i)
package
void Rebuild ( )

Rebuilds the heap by trickeling down all items.

Usually called after the hTarget on a path has been changed

PathNode Remove ( )

Returns the node with the lowest F score from the heap.

void SetF ( int  i,
uint  F 
)
package
void Validate ( )
private

Member Data Documentation

Tuple [] binaryHeap
private
const int D = 4
float growthFactor = 2
int numberOfItems
const bool SortGScores = true
private

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