Class AStar<NodeId>

java.lang.Object
eu.iv4xr.framework.extensions.pathfinding.AStar<NodeId>
All Implemented Interfaces:
Pathfinder<NodeId>

public class AStar<NodeId> extends Object implements Pathfinder<NodeId>
A* pathfinding algorithm
Author:
Naraenda
  • Field Details

    • searchMode

      public AStar.SearchMode searchMode
    • dynamicHeuristicDistance

      public Function<Navigatable<NodeId>,​BiFunction<NodeId,​NodeId,​Float>> dynamicHeuristicDistance
      When this is set, this function will be use to calculate the heuristic distance between two nodes, rather than using the default heuristic-method supplied by underlying navigation graph.
  • Constructor Details

    • AStar

      public AStar()
  • Method Details

    • getHeuristicDistance

      float getHeuristicDistance(Navigatable<NodeId> graph, NodeId a, NodeId b)
    • findPath

      public ArrayList<NodeId> findPath(Navigatable<NodeId> graph, NodeId start, NodeId goal)
      Description copied from interface: Pathfinder
      Finds a path in a navigatable environment.
      Specified by:
      findPath in interface Pathfinder<NodeId>
      Parameters:
      graph - : The environment to find a path in.
      start - : The starting position of the pathfinder.
      goal - : The goal of the pathfinder.
      Returns:
      An arraylist with the path. Null if no path is found.