Class AStarAlgorithm
- java.lang.Object
-
- com.epicbot.api.shared.model.path.finding.AStarAlgorithm
-
public class AStarAlgorithm extends java.lang.Object
A* path finding algorithm.
-
-
Constructor Summary
Constructors Constructor Description AStarAlgorithm()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
distance(Locatable origin, Locatable destination, boolean ignoreObjects, APIContext ctx)
Calculates the distance between the origin and the destination.static double
distance(Locatable origin, Locatable destination, APIContext ctx)
Calculates the distance between the origin and the destination.static Tile[]
findPath(Locatable origin, Locatable destination, APIContext ctx)
Finds a path from origin to destination.
-
-
-
Method Detail
-
findPath
public static Tile[] findPath(Locatable origin, Locatable destination, APIContext ctx)
Finds a path from origin to destination.- Parameters:
origin
- the start pointdestination
- the end pointctx
-APIContext
- Returns:
- the tile path or null if not reachable
-
distance
public static double distance(Locatable origin, Locatable destination, APIContext ctx)
Calculates the distance between the origin and the destination.- Parameters:
origin
- to calculate distance fromdestination
- to calculate the distance toctx
-APIContext
- Returns:
- the calculated distance or
Double.POSITIVE_INFINITY
if not reachable
-
distance
public static double distance(Locatable origin, Locatable destination, boolean ignoreObjects, APIContext ctx)
Calculates the distance between the origin and the destination. Does not take objects in to account- Parameters:
origin
- to calculate distance fromdestination
- to calculate the distance toctx
-APIContext
- Returns:
- the calculated distance or
Double.POSITIVE_INFINITY
if not reachable
-
-