|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.rico.engine.path.AStarNode
de.rico.engine.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(int id,
float x,
float z,
int width,
int length)
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(float x,
float z)
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 |
getId()
Returns the id of this grid node. |
int |
getLength()
Returns the length of the grid node |
float |
getMidX()
Returns the x coordinate of the center point of the grid node |
float |
getMidZ()
Returns the z 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 |
float |
getX()
Returns the x coordinate of the grid node |
float |
getZ()
Returns the z 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 de.rico.engine.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(int id,
float x,
float z,
int width,
int length)
id - a number that uniquely identifies the grid node. This is
important for saving and loading the grid node status to the
editor filex - x coordinate of the grid nodez - z coordinate of the grid nodewidth - width of the grid nodelength - height of the grid node| Method Detail |
|---|
public int getId()
public void setWalkable(boolean walkable)
walkable - set walkable? --> true=yes, false=nopublic float getMidX()
public float getMidZ()
public boolean containsPoint(float x,
float z)
x - x coordinatesz - z coordinates
public boolean isNeighbor(GridNode node)
node - node to check, if naighbour
public int getLength()
public int getWidth()
public float getX()
public float getZ()
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 | ||||||||