public abstract class PathFinder
extends java.lang.Object
Position
and goal Position
on a specified Map
. A path
is represented as a List
of Position
s, where each
Position
is a corner point in the path. If no feasible path can be
found, a list containing only the goal position Position
is returned.Modifier and Type | Field and Description |
---|---|
protected boolean[][] |
discretizedMap
The discretized map.
|
protected Map |
map
The
Map . |
protected double |
precision
The width of a tile in the discrete version of the
Map . |
Constructor and Description |
---|
PathFinder(Map map,
double precision)
Creates a path finder.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
directPathPossible(Position start,
Position goal)
Determines if there is a direct path possible between two
Position s. |
protected java.util.List<Position> |
getCornerPoints2(java.util.List<Position> path)
Gets the corner points from a path, represented as a list of
Position s. |
java.util.List<Position> |
getPath(Position start,
Position goal)
|
abstract java.util.List<Position> |
getPath(Position start,
Position goal,
boolean smooth)
|
java.util.List<Position> |
smooth(java.util.List<Position> path)
Gets the corner points from a path, represented as a list of
Position s. |
protected boolean[][] discretizedMap
protected double precision
Map
.public PathFinder(Map map, double precision)
map
- The map.precision
- The precision.protected boolean directPathPossible(Position start, Position goal)
Position
s. (i.e. there is no obstacle between the two points).start
- The start position.goal
- The goal position.protected java.util.List<Position> getCornerPoints2(java.util.List<Position> path)
Position
s.path
- The path.public java.util.List<Position> getPath(Position start, Position goal)
Position
to a goal
Position
. The method returns a list of points that are the corner
points of the specified path.start
- The start position.goal
- The goal position.public abstract java.util.List<Position> getPath(Position start, Position goal, boolean smooth)
Position
to a goal
Position
. The method returns a list of points that are the corner
points of the specified path.start
- The start position.goal
- The goal position.smooth
- Smooth or not.