public class DijkstraPathFinder extends PathFinder
Position
to a goal Position
.Modifier and Type | Field and Description |
---|---|
private java.util.List<DijkstraNode> |
unvisited
A list of unvisited nodes.
|
private java.util.List<DijkstraNode> |
visited
A list of visited nodes.
|
discretizedMap, map, precision
Constructor and Description |
---|
DijkstraPathFinder(Map map,
double precision)
Creates the Dijkstra Path Finder.
|
Modifier and Type | Method and Description |
---|---|
private java.util.Collection<DijkstraNode> |
getNeighbors(DijkstraNode node)
Gets the neighbors of a node.
|
private DijkstraNode |
getNodeFromPosition(Position position)
Gets a Dijkstra node from a
Position . |
private DijkstraNode |
getNodeWithLowestDistance()
Gets the node with the lowest distance.
|
java.util.List<Position> |
getPath(Position start,
Position goal,
boolean smooth)
|
private Position |
getPositionFromNode(DijkstraNode node)
Gets a
Position from a Dijkstra Node. |
directPathPossible, getCornerPoints2, getPath, smooth
private java.util.List<DijkstraNode> unvisited
private java.util.List<DijkstraNode> visited
public DijkstraPathFinder(Map map, double precision)
map
- The map.precision
- The precision.private java.util.Collection<DijkstraNode> getNeighbors(DijkstraNode node)
node
- The node.private DijkstraNode getNodeFromPosition(Position position)
Position
. Returns null if the node
cannot be found.position
- The position.private DijkstraNode getNodeWithLowestDistance()
public java.util.List<Position> getPath(Position start, Position goal, boolean smooth)
PathFinder
Position
to a goal
Position
. The method returns a list of points that are the corner
points of the specified path.getPath
in class PathFinder
start
- The start position.goal
- The goal position.smooth
- Smooth or not.private Position getPositionFromNode(DijkstraNode node)
Position
from a Dijkstra Node.node
- The node.