public class AStarGrid extends java.lang.Object implements IRenderable
Modifier and Type | Field and Description |
---|---|
static double |
PENALTY_NOT_WALKABLE_NEIGHBOR |
static double |
PENALTY_STATIC_PROP |
Constructor and Description |
---|
AStarGrid(java.awt.Dimension size,
int nodeSize) |
AStarGrid(int width,
int height,
int nodeSize) |
Modifier and Type | Method and Description |
---|---|
protected void |
assignPenalty(AStarNode node) |
AStarNode[][] |
getGrid() |
java.util.List<AStarNode> |
getIntersectedNodes(java.awt.geom.Rectangle2D rectangle) |
java.util.List<AStarNode> |
getNeighbors(AStarNode node) |
AStarNode |
getNode(double x,
double y) |
AStarNode |
getNode(java.awt.geom.Point2D point) |
int |
getNodeSize() |
java.awt.Dimension |
getSize() |
boolean |
isDiagonalCornerMovementAllowed() |
boolean |
isDiagonalMovementAllowed() |
void |
render(java.awt.Graphics2D g) |
void |
setAllowCuttingCorners(boolean allowCuttingCorners) |
void |
setAllowDiagonalMovement(boolean allowDiagonalMovement) |
void |
updateWalkable(java.awt.geom.Rectangle2D rectangle)
Updates the walkable attribute of nodes intersected by the specified
rectangle.
|
public static final double PENALTY_STATIC_PROP
public static final double PENALTY_NOT_WALKABLE_NEIGHBOR
public AStarGrid(int width, int height, int nodeSize)
public AStarGrid(java.awt.Dimension size, int nodeSize)
public boolean isDiagonalMovementAllowed()
public boolean isDiagonalCornerMovementAllowed()
public AStarNode[][] getGrid()
public java.util.List<AStarNode> getIntersectedNodes(java.awt.geom.Rectangle2D rectangle)
public AStarNode getNode(java.awt.geom.Point2D point)
public AStarNode getNode(double x, double y)
public int getNodeSize()
public java.awt.Dimension getSize()
public void render(java.awt.Graphics2D g)
render
in interface IRenderable
public void setAllowDiagonalMovement(boolean allowDiagonalMovement)
public void setAllowCuttingCorners(boolean allowCuttingCorners)
public void updateWalkable(java.awt.geom.Rectangle2D rectangle)
rectangle
- The rectangle within which the nodes should be updated.protected void assignPenalty(AStarNode node)