Package pfvisualizer.algorithms
Interface Pathfinder
-
- All Known Implementing Classes:
AStar,Dijkstra,JumpPointSearch
public interface PathfinderAn interface for path-finding algorithms.
-
-
Field Summary
Fields Modifier and Type Field Description static intCHECKEDstatic floatDIAGONAL_DISTANCEstatic intPATHstatic floatSTRAIGHT_DISTANCEstatic intUNVISITEDstatic intVISITEDstatic intWALL
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidbuildPath(Node node, int[][] map)Draws the path found by the algorithm to the map provided.Resultsearch(int[][] grid, int startCol, int startRow, int endCol, int endRow)Performs a search for a path from given starting coordinates to the given end coordinates on the given grid.
-
-
-
Field Detail
-
UNVISITED
static final int UNVISITED
- See Also:
- Constant Field Values
-
WALL
static final int WALL
- See Also:
- Constant Field Values
-
VISITED
static final int VISITED
- See Also:
- Constant Field Values
-
CHECKED
static final int CHECKED
- See Also:
- Constant Field Values
-
PATH
static final int PATH
- See Also:
- Constant Field Values
-
STRAIGHT_DISTANCE
static final float STRAIGHT_DISTANCE
- See Also:
- Constant Field Values
-
DIAGONAL_DISTANCE
static final float DIAGONAL_DISTANCE
- See Also:
- Constant Field Values
-
-
Method Detail
-
search
Result search(int[][] grid, int startCol, int startRow, int endCol, int endRow)
Performs a search for a path from given starting coordinates to the given end coordinates on the given grid.- Parameters:
grid- map to perform the search onstartCol- start columnstartRow- start rowendCol- end columnendRow- end row- Returns:
- Result object which contains information such as the length of the optimal path
-
buildPath
default void buildPath(Node node, int[][] map)
Draws the path found by the algorithm to the map provided.- Parameters:
node- The end node of the pathmap- The map to draw the path into
-
-