Untold Engine  Beta v0.0.16
docs
U4DEngine::U4DPathfinderAStar Class Reference

The U4DPathfinderAStar class implements the Path Finding algorithm known as A Star algorithm. More...

Public Member Functions

 U4DPathfinderAStar ()
 class constructor
 
 ~U4DPathfinderAStar ()
 class destructor
 
bool findPath (std::vector< U4DNavMeshNode > uNavMeshNodeContainer, int uStartNodeIndex, int uEndNodeIndex, std::vector< U4DSegment > &uPath)
 computes the path using the A Star algorithm More...
 
std::vector< U4DSegmentassemblePath (std::vector< U4DNavMeshNode > &uNavMeshNodes)
 assembles the path computed using the A Star algorithm More...
 
void reHeapDown (int root, int bottom)
 sorts the heap data structure using a heap-down implementation More...
 
void heapSort ()
 sorts the Head data structure. The lowest value is at the root
 
void swap (int uIndex1, int uIndex2)
 swaps the nodes indices. This is used to sort the Head data structure More...
 
void setCost (U4DNavMeshNode &uCurrentNode, U4DNavMeshNode &uStartNode, U4DNavMeshNode &uEndNode)
 sets the gCost, hCost and total cost of the current nav mesh node More...
 

Detailed Description

The U4DPathfinderAStar class implements the Path Finding algorithm known as A Star algorithm.

Member Function Documentation

◆ assemblePath()

std::vector< U4DSegment > U4DEngine::U4DPathfinderAStar::assemblePath ( std::vector< U4DNavMeshNode > &  uNavMeshNodes)

assembles the path computed using the A Star algorithm

Parameters
uNavMeshNodesnav mesh nodes creating the path
Returns
container with segments representing the computed path

◆ findPath()

bool U4DEngine::U4DPathfinderAStar::findPath ( std::vector< U4DNavMeshNode uNavMeshNodeContainer,
int  uStartNodeIndex,
int  uEndNodeIndex,
std::vector< U4DSegment > &  uPath 
)

computes the path using the A Star algorithm

Parameters
uNavMeshNodeContainernavigation mesh containing the nav mesh nodes
uStartNodeIndexstarting node to compute path
uEndNodeIndexending node to compute path
uPathvector containing the computed path segments
Returns
true if the path was able to be determined

◆ reHeapDown()

void U4DEngine::U4DPathfinderAStar::reHeapDown ( int  root,
int  bottom 
)

sorts the heap data structure using a heap-down implementation

Parameters
rootroot node in the data structure
bottombottom node in the data structure

◆ setCost()

void U4DEngine::U4DPathfinderAStar::setCost ( U4DNavMeshNode uCurrentNode,
U4DNavMeshNode uStartNode,
U4DNavMeshNode uEndNode 
)

sets the gCost, hCost and total cost of the current nav mesh node

Parameters
uCurrentNodecurrent mesh node
uStartNodestart mesh node
uEndNodeend mesh node

◆ swap()

void U4DEngine::U4DPathfinderAStar::swap ( int  uIndex1,
int  uIndex2 
)

swaps the nodes indices. This is used to sort the Head data structure

Parameters
uIndex1node1 index
uIndex2node2 index