A* Pathfinding Project  4.1.12
The A* Pathfinding Project for Unity 3D
PathNode Class Reference

Stores temporary node data for a single pathfinding request. More...

Detailed Description

Stores temporary node data for a single pathfinding request.

Every node has one PathNode per thread used. It stores e.g G score, H score and other temporary variables needed for path calculation, but which are not part of the graph structure.

See also
Pathfinding.PathHandler
https://en.wikipedia.org/wiki/A*_search_algorithm

Public Member Functions

void UpdateG (Path path)
 

Public Attributes

ushort heapIndex = BinaryHeap.NotInHeap
 Index of the node in the binary heap. More...
 
GraphNode node
 Reference to the actual graph node. More...
 
PathNode parent
 Parent node in the search tree. More...
 
ushort pathID
 The path request (in this thread, if multithreading is used) which last used this node. More...
 

Properties

uint cost [get, set]
 
uint F [get]
 F score. More...
 
bool flag1 [get, set]
 Use as temporary flag during pathfinding. More...
 
bool flag2 [get, set]
 Use as temporary flag during pathfinding. More...
 
uint G [get, set]
 G score, cost to get to this node. More...
 
uint H [get, set]
 H score, estimated cost to get to to the target. More...
 

Private Attributes

const uint CostMask = (1U << 28) - 1U
 Cost uses the first 28 bits. More...
 
const uint Flag1Mask = (uint)(1 << Flag1Offset)
 
const int Flag1Offset = 28
 Flag 1 is at bit 28. More...
 
const uint Flag2Mask = (uint)(1 << Flag2Offset)
 
const int Flag2Offset = 29
 Flag 2 is at bit 29. More...
 
uint flags
 Bitpacked variable which stores several fields. More...
 
uint g
 Backing field for the G score. More...
 
uint h
 Backing field for the H score. More...
 

Member Function Documentation

◆ UpdateG()

void UpdateG ( Path  path)

Member Data Documentation

◆ CostMask

const uint CostMask = (1U << 28) - 1U
private

Cost uses the first 28 bits.

◆ Flag1Mask

const uint Flag1Mask = (uint)(1 << Flag1Offset)
private

◆ Flag1Offset

const int Flag1Offset = 28
private

Flag 1 is at bit 28.

◆ Flag2Mask

const uint Flag2Mask = (uint)(1 << Flag2Offset)
private

◆ Flag2Offset

const int Flag2Offset = 29
private

Flag 2 is at bit 29.

◆ flags

uint flags
private

Bitpacked variable which stores several fields.

◆ g

uint g
private

Backing field for the G score.

◆ h

uint h
private

Backing field for the H score.

◆ heapIndex

ushort heapIndex = BinaryHeap.NotInHeap

Index of the node in the binary heap.

The open list in the A* algorithm is backed by a binary heap. To support fast 'decrease key' operations, the index of the node is saved here.

◆ node

GraphNode node

Reference to the actual graph node.

◆ parent

PathNode parent

Parent node in the search tree.

◆ pathID

ushort pathID

The path request (in this thread, if multithreading is used) which last used this node.

Property Documentation

◆ cost

uint cost
getset

◆ F

uint F
get

F score.

H score + G score

◆ flag1

bool flag1
getset

Use as temporary flag during pathfinding.

Pathfinders (only) can use this during pathfinding to mark nodes. When done, this flag should be reverted to its default state (false) to avoid messing up other pathfinding requests.

◆ flag2

bool flag2
getset

Use as temporary flag during pathfinding.

Pathfinders (only) can use this during pathfinding to mark nodes. When done, this flag should be reverted to its default state (false) to avoid messing up other pathfinding requests.

◆ G

uint G
getset

G score, cost to get to this node.

◆ H

uint H
getset

H score, estimated cost to get to to the target.


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