A* Pathfinding Project
3.6.1
The A* Pathfinding Project for Unity 3D
|
Binary heap implementation. More...
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.
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 |
BinaryHeapM | ( | int | numberOfElements | ) |
void Add | ( | PathNode | node | ) |
Adds a node to the heap.
void Clear | ( | ) |
|
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.
|
package |
|
private |
|
private |
const int D = 4 |
float growthFactor = 2 |
int numberOfItems |
|
private |