|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.b3dgs.lionengine.game.pathfinding.AStarPathFinder
public class AStarPathFinder
A path finder implementation that uses the AStar heuristic based algorithm to determine a path.
Constructor Summary | |
---|---|
AStarPathFinder(PathBasedMap<? extends AbstractPathTile> map,
int maxSearchDistance,
boolean allowDiagMovement)
Create a path finder with the default heuristic - closest to target. |
|
AStarPathFinder(PathBasedMap<? extends AbstractPathTile> map,
int maxSearchDistance,
boolean allowDiagMovement,
AStarHeuristic heuristic)
Create a path finder. |
Method Summary | |
---|---|
protected void |
addToClosed(Node node)
Add a node to the closed list. |
protected void |
addToOpen(Node node)
Add a node to the open list. |
Path |
findPath(Pathfindable mover,
int sx,
int sy,
int tx,
int ty,
boolean ignoreRef)
Find a path from the starting location provided (sx,sy) to the target location (tx,ty) avoiding blockages and attempting to honour costs provided by the tile map. |
protected Node |
getFirstInOpen()
Get the first element from the open list. |
float |
getHeuristicCost(Pathfindable mover,
int x,
int y,
int tx,
int ty)
Get the heuristic cost for the given location. |
float |
getMovementCost(Pathfindable mover,
int sx,
int sy,
int tx,
int ty)
Get the cost to move through a given location. |
protected boolean |
inClosedList(Node node)
Check if the node supplied is in the closed list. |
protected boolean |
inOpenList(Node node)
Check if a node is in the open list. |
protected boolean |
isValidLocation(Pathfindable mover,
int sx,
int sy,
int x,
int y,
boolean ignoreRef)
Check if a given location is valid for the supplied mover. |
protected void |
removeFromClosed(Node node)
Remove a node from the closed list. |
protected void |
removeFromOpen(Node node)
Remove a node from the open list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AStarPathFinder(PathBasedMap<? extends AbstractPathTile> map, int maxSearchDistance, boolean allowDiagMovement)
map
- map to be searched.maxSearchDistance
- maximum depth we'll search before giving up.allowDiagMovement
- true if the search should try diaganol movement.public AStarPathFinder(PathBasedMap<? extends AbstractPathTile> map, int maxSearchDistance, boolean allowDiagMovement, AStarHeuristic heuristic)
heuristic
- heuristic used to determine the search order of the map.map
- map to be searched.maxSearchDistance
- maximum depth we'll search before giving up.allowDiagMovement
- if the search should try diaganol movement.Method Detail |
---|
public Path findPath(Pathfindable mover, int sx, int sy, int tx, int ty, boolean ignoreRef)
PathFinder
findPath
in interface PathFinder
mover
- entity that will be moving along the path.sx
- x coordinate of the start location.sy
- y coordinate of the start location.tx
- x coordinate of the target location.ty
- y coordinate of the target location.ignoreRef
- ignore map array ref checking.
protected Node getFirstInOpen()
protected void addToOpen(Node node)
node
- node to be added to the open list.protected boolean inOpenList(Node node)
node
- The node to check for.
protected void removeFromOpen(Node node)
node
- node to remove from the open list.protected void addToClosed(Node node)
node
- node to add to the closed list.protected boolean inClosedList(Node node)
node
- node to search for.
protected void removeFromClosed(Node node)
node
- the node to remove from the closed list.protected boolean isValidLocation(Pathfindable mover, int sx, int sy, int x, int y, boolean ignoreRef)
mover
- mover that would hold a given location.sx
- starting x coordinate.sy
- starting y coordinate.x
- x coordinate of the location to check.y
- y coordinate of the location to check.ignoreRef
- ignore map ref array checking.
public float getMovementCost(Pathfindable mover, int sx, int sy, int tx, int ty)
mover
- entity that is being moved.sx
- x coordinate of the tile whose cost is being determined.sy
- y coordiante of the tile whose cost is being determined.tx
- x coordinate of the target location.ty
- y coordinate of the target location.
public float getHeuristicCost(Pathfindable mover, int x, int y, int tx, int ty)
mover
- entity that is being movedx
- x coordinate of the tile whose cost is being determinedy
- y coordiante of the tile whose cost is being determinedtx
- x coordinate of the target locationty
- y coordinate of the target location
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |