Method AStar
AStar<TPoint>(IGrid<TPoint>, TPoint, TPoint, Func<TPoint, TPoint, float>, Func<TPoint, bool>, Func<TPoint, IEnumerable<TPoint>>, Func<TPoint, TPoint, float>)
Find the shortest path between a start and goal node.
public static IEnumerable<TPoint> AStar<TPoint>(IGrid<TPoint> grid, TPoint start, TPoint goal, Func<TPoint, TPoint, float> heuristicCostEstimate, Func<TPoint, bool> isAccessible, Func<TPoint, IEnumerable<TPoint>> getConnectedPoints, Func<TPoint, TPoint, float> neighborToNeighborCost)
Parameters
gridIGrid<TPoint>Grid in which the operation is performed.
startTPointPoint where the path must start.
goalTPointPoint where the path must end.
heuristicCostEstimateFunc<TPoint, TPoint, float>This function is used to calculate the heuristic.
isAccessibleFunc<TPoint, bool>This function is used to check if a point is accessible within the grid.
getConnectedPointsFunc<TPoint, IEnumerable<TPoint>>This function is used to get the connected points of a given point.
neighborToNeighborCostFunc<TPoint, TPoint, float>This function is used to calculate the cost of moving to a given neighbor.
Returns
- IEnumerable<TPoint>
The list of nodes on the path in order.If no path is possible, null is returned.
Type Parameters
TPoint
Remarks
For detailed documentation on how this method works, see