Rebornbuddy
Loading...
Searching...
No Matches
Pathfinding.AStarz Class Reference

Class to search the best path between two nodes on a graph. More...

Public Member Functions

 AStarz (Graph G)
 AStar Constructor.
bool SearchPath (Node StartNode, Node EndNode)
 Searches for the best path to reach the specified EndNode from the specified StartNode.
void Initialize (Node StartNode, Node EndNode)
 Use for a 'step by step' search only. This method is alternate to SearchPath. Initializes AStar before performing search steps manually with NextStep.
bool NextStep ()
 Use for a 'step by step' search only. This method is alternate to SearchPath. The algorithm must have been initialize before.
bool ResultInformation (out int NbArcsOfPath, out double CostOfPath)
 Returns information on the result.

Public Attributes

Graph _Graph

Properties

static Heuristic EuclidianHeuristic [get]
 Heuristic based on the euclidian distance : Sqrt(Dx�+Dy�+Dz�)
static Heuristic MaxAlongAxisHeuristic [get]
 Heuristic based on the maximum distance : Max(|Dx|, |Dy|, |Dz|)
static Heuristic ManhattanHeuristic [get]
 Heuristic based on the manhattan distance : |Dx|+|Dy|+|Dz|.
Heuristic ChoosenHeuristic [get, set]
 Gets/Sets the heuristic that AStar will use. It must be homogeneous to arc's cost.
float DijkstraHeuristicBalance [set]
 This value must belong to [0; 1] and it determines the influence of the heuristic on the algorithm. If this influence value is set to 0, then the search will behave in accordance with the Dijkstra algorithm. If this value is set to 1, then the cost to come to the current node will not be used whereas only the heuristic will be taken into account.
Node[][] Open [get]
 Use for debug in 'step by step' mode only. Returns all the tracks found in the 'Open' list of the algorithm at a given time. A track is a list of the nodes visited to come to the current node.
Node[][] Closed [get]
 Use for debug in a 'step by step' mode only. Returns all the tracks found in the 'Closed' list of the algorithm at a given time. A track is a list of the nodes visited to come to the current node.
bool Initialized [get]
 To know if the search has been initialized.
bool SearchStarted [get]
 To know if the search has been started.
bool SearchEnded [get]
 To know if the search has ended.
bool PathFound [get]
 To know if a path has been found.
int StepCounter [get]
 Use for a 'step by step' search only. Gets the number of the current step. -1 if the search has not been initialized. 0 if it has not been started.
Node[] PathByNodes [get]
 Gets the array of nodes representing the found path.
Vector3[] PathByCoordinates [get]
 Gets the array of arcs representing the found path.

Detailed Description

Class to search the best path between two nodes on a graph.

Constructor & Destructor Documentation

◆ AStarz()

Pathfinding.AStarz.AStarz ( Graph G)

AStar Constructor.

Parameters
GThe graph on which AStar will perform the search.

Member Function Documentation

◆ Initialize()

void Pathfinding.AStarz.Initialize ( Node StartNode,
Node EndNode )

Use for a 'step by step' search only. This method is alternate to SearchPath. Initializes AStar before performing search steps manually with NextStep.

Exceptions
ArgumentNullExceptionStartNode and EndNode cannot be null.
Parameters
StartNodeThe node from which the path must start.
EndNodeThe node to which the path must end.

◆ NextStep()

bool Pathfinding.AStarz.NextStep ( )

Use for a 'step by step' search only. This method is alternate to SearchPath. The algorithm must have been initialize before.

Exceptions
InvalidOperationExceptionYou must initialize AStar before using NextStep().
Returns
'true' unless the search ended.

◆ ResultInformation()

bool Pathfinding.AStarz.ResultInformation ( out int NbArcsOfPath,
out double CostOfPath )

Returns information on the result.

Parameters
NbArcsOfPathThe number of arcs in the result path / -1 if no result.
CostOfPathThe cost of the result path / -1 if no result.
Returns
'true' if the search succeeded / 'false' if it failed.

◆ SearchPath()

bool Pathfinding.AStarz.SearchPath ( Node StartNode,
Node EndNode )

Searches for the best path to reach the specified EndNode from the specified StartNode.

Exceptions
ArgumentNullExceptionStartNode and EndNode cannot be null.
Parameters
StartNodeThe node from which the path must start.
EndNodeThe node to which the path must end.
Returns
'true' if succeeded / 'false' if failed.

Member Data Documentation

◆ _Graph

Graph Pathfinding.AStarz._Graph

Property Documentation

◆ ChoosenHeuristic

Heuristic Pathfinding.AStarz.ChoosenHeuristic
getset

Gets/Sets the heuristic that AStar will use. It must be homogeneous to arc's cost.

◆ Closed

Node [][] Pathfinding.AStarz.Closed
get

Use for debug in a 'step by step' mode only. Returns all the tracks found in the 'Closed' list of the algorithm at a given time. A track is a list of the nodes visited to come to the current node.

◆ DijkstraHeuristicBalance

float Pathfinding.AStarz.DijkstraHeuristicBalance
set

This value must belong to [0; 1] and it determines the influence of the heuristic on the algorithm. If this influence value is set to 0, then the search will behave in accordance with the Dijkstra algorithm. If this value is set to 1, then the cost to come to the current node will not be used whereas only the heuristic will be taken into account.

Exceptions
ArgumentExceptionValue must belong to [0;1].

◆ EuclidianHeuristic

Heuristic Pathfinding.AStarz.EuclidianHeuristic
staticget

Heuristic based on the euclidian distance : Sqrt(Dx�+Dy�+Dz�)

◆ Initialized

bool Pathfinding.AStarz.Initialized
get

To know if the search has been initialized.

◆ ManhattanHeuristic

Heuristic Pathfinding.AStarz.ManhattanHeuristic
staticget

Heuristic based on the manhattan distance : |Dx|+|Dy|+|Dz|.

◆ MaxAlongAxisHeuristic

Heuristic Pathfinding.AStarz.MaxAlongAxisHeuristic
staticget

Heuristic based on the maximum distance : Max(|Dx|, |Dy|, |Dz|)

◆ Open

Node [][] Pathfinding.AStarz.Open
get

Use for debug in 'step by step' mode only. Returns all the tracks found in the 'Open' list of the algorithm at a given time. A track is a list of the nodes visited to come to the current node.

◆ PathByCoordinates

Vector3 [] Pathfinding.AStarz.PathByCoordinates
get

Gets the array of arcs representing the found path.

Exceptions
InvalidOperationExceptionYou cannot get a result unless the search has ended.

Gets the array of points representing the found path.

Exceptions
InvalidOperationExceptionYou cannot get a result unless the search has ended.

◆ PathByNodes

Node [] Pathfinding.AStarz.PathByNodes
get

Gets the array of nodes representing the found path.

Exceptions
InvalidOperationExceptionYou cannot get a result unless the search has ended.

◆ PathFound

bool Pathfinding.AStarz.PathFound
get

To know if a path has been found.

◆ SearchEnded

bool Pathfinding.AStarz.SearchEnded
get

To know if the search has ended.

◆ SearchStarted

bool Pathfinding.AStarz.SearchStarted
get

To know if the search has been started.

◆ StepCounter

int Pathfinding.AStarz.StepCounter
get

Use for a 'step by step' search only. Gets the number of the current step. -1 if the search has not been initialized. 0 if it has not been started.