Class PathfinderUtil.PathNode
java.lang.Object
de.tomatengames.util.PathfinderUtil.PathNode
- Enclosing class:
PathfinderUtil
A PathNode should represent a position (node in a graph) combined with the way to get there (edges) from the startpoint.
Specifically,
PathfinderUtil.World.positionEqual(PathNode, PathNode) needs implementation and typically the taken path is kept
to retrieve the resulting path rather than solely the goal position from the find methods.
This class contains some private attributes used in the find methods, so its instances should be single-use.
To find a path on a 2D grid, you would add attributes like int x, y; and PathNode previous;.- Since:
- 1.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected doubleInitially the cost of the single step that separates this PathNode from its original PathNode.protected doubleIs set to the estimated total cost from the startpoint to the goal going over this PathNode. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPathNode(double cost) Creates a new PathNode with the provided step cost. -
Method Summary
-
Field Details
-
cost
protected double costInitially the cost of the single step that separates this PathNode from its original PathNode. If this PathNode is not immediately discarded, the cost is updated to the total cost from the startpoint to this PathNode. -
estimateFullCost
protected double estimateFullCostIs set to the estimated total cost from the startpoint to the goal going over this PathNode. That is the cost from the startpoint to this PathNode +PathfinderUtil.World.estimateRemainingCost(PathNode).
-
-
Constructor Details
-
PathNode
protected PathNode(double cost) Creates a new PathNode with the provided step cost.- Parameters:
cost- the cost of reaching this PathNode from its original PathNode
-