1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 12:58:33 +01:00

slightly improved A* documentation

This commit is contained in:
Ell 2023-02-18 12:32:32 +01:00
parent 695fba59a4
commit dbd7f66c89

View file

@ -209,28 +209,28 @@ namespace MLEM.Pathfinding {
/// </summary> /// </summary>
public readonly T Pos; public readonly T Pos;
/// <summary> /// <summary>
/// The F cost of this path point /// The F cost of this path point, which is the estimated total distance from the start to the goal.
/// </summary> /// </summary>
public readonly float F; public readonly float F;
/// <summary> /// <summary>
/// The G cost of this path point /// The G cost of this path point, which is the actual distance from the start to the current <see cref="Pos"/>.
/// </summary> /// </summary>
public readonly float G; public readonly float G;
/// <summary> /// <summary>
/// Creates a new path point with the supplied settings. /// Creates a new path point with the supplied settings.
/// </summary> /// </summary>
/// <param name="pos">The point's position</param> /// <param name="pos">The point's position.</param>
/// <param name="distance">The point's distance from the start point</param> /// <param name="heuristicDistance">The point's estimated distance from the <paramref name="pos"/> to the goal, based on the <paramref name="defaultCost"/>.</param>
/// <param name="parent">The point's parent</param> /// <param name="parent">The point's parent.</param>
/// <param name="terrainCostForThisPos">The point's terrain cost, based on <see cref="AStar{T}.GetCost"/></param> /// <param name="terrainCost">The terrain cost to move from the <paramref name="parent"/> to this point, based on <see cref="AStar{T}.GetCost"/>.</param>
/// <param name="defaultCost">The default cost for a path point</param> /// <param name="defaultCost">The default cost for a path point.</param>
public PathPoint(T pos, float distance, PathPoint<T> parent, float terrainCostForThisPos, float defaultCost) { public PathPoint(T pos, float heuristicDistance, PathPoint<T> parent, float terrainCost, float defaultCost) {
this.Pos = pos; this.Pos = pos;
this.Parent = parent; this.Parent = parent;
this.G = (parent == null ? 0 : parent.G) + terrainCostForThisPos; this.G = (parent == null ? 0 : parent.G) + terrainCost;
this.F = this.G + distance * defaultCost; this.F = this.G + heuristicDistance * defaultCost;
} }
/// <summary>Indicates whether the current object is equal to another object of the same type.</summary> /// <summary>Indicates whether the current object is equal to another object of the same type.</summary>