|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpath.AStarNode
path.GridNode
public class GridNode
Node that represents a square in the walkable area grid. This node is then used for A* path finding.
| Constructor Summary | |
|---|---|
GridNode(double x,
double y,
int width,
int height)
Creates a new grid node with the specified parameters |
|
| Method Summary | |
|---|---|
void |
addNeighbor(GridNode node)
Adds a neighbour to the list of neighbours of this grid node |
boolean |
containsPoint(double x,
double y)
Checks, if the specified coordinates lay in this grid node's bounds |
float |
getCost(AStarNode node)
Gets the cost between this node and the specified adjacent (aka "neighbor" or "child") node. |
float |
getEstimatedCost(AStarNode node)
Gets the estimated cost between this node and the specified node. |
int |
getHeight()
Returns the height of the grid node |
double |
getMidX()
Returns the x coordinate of the center point of the grid node |
double |
getMidY()
Returns the y coordinate of the center point of the grid node |
java.util.List<GridNode> |
getNeighbors()
Gets the children (aka "neighbors" or "adjacent nodes") of this node. |
int |
getWidth()
Returns the width of the grid node |
double |
getX()
Returns the x coordinate of the grid node |
double |
getY()
Returns the y coordinate of the grid node |
boolean |
isNeighbor(GridNode node)
Determines whether the grid node is a neighbour of the specified node. |
boolean |
isWalkable()
Determines whether the grid node is walkable |
void |
setWalkable(boolean walkable)
Sets the walkable status for the grid node |
| Methods inherited from class path.AStarNode |
|---|
compareTo, getCost, sign |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GridNode(double x,
double y,
int width,
int height)
x - x coordinate of the grid nodey - y coordinate of the grid nodewidth - width of the grid nodeheight - height of the grid node| Method Detail |
|---|
public void setWalkable(boolean walkable)
walkable - set walkable? --> true=yes, false=nopublic double getMidX()
public double getMidY()
public boolean containsPoint(double x,
double y)
x - x coordinatesy - y coordinates
public boolean isNeighbor(GridNode node)
node - node to check, if naighbour
public int getHeight()
public int getWidth()
public double getX()
public double getY()
public boolean isWalkable()
public void addNeighbor(GridNode node)
node - grid node neighbour node to addpublic float getCost(AStarNode node)
AStarNode
getCost in class AStarNodepublic float getEstimatedCost(AStarNode node)
AStarNode
getEstimatedCost in class AStarNodepublic java.util.List<GridNode> getNeighbors()
AStarNode
getNeighbors in class AStarNode
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||