Catalano.Graph.Pathfinding.AStar
Class NodeMap
- java.lang.Object
-
- Catalano.Graph.Pathfinding.AStar.NodeMap
-
public class NodeMap extends java.lang.ObjectRepresents all nodes associates a map.
-
-
Constructor Summary
Constructors Constructor and Description NodeMap(double[][] nodeCostMap)Initializes a new instance of the NodeMap class.NodeMap(double[][] costMap, AStar.Neighbor direction, AStar.Heuristic heuristic)Initializes a new instance of the NodeMap class.NodeMap(int width, int height, double initialCost)Initializes a new instance of the NodeMap class.NodeMap(int width, int height, double initialCost, AStar.Neighbor direction, AStar.Heuristic heuristic)Initializes a new instance of the NodeMap class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description NodeMapclone()doubleComputeHeuristic(int startX, int startY, int endX, int endY)Compute the heuristic.AStar.NeighborgetDirection()Get direction.intgetHeight()Get height of Node Map.AStar.HeuristicgetHeuristic()Get heuristic.ANodegetNode(int x, int y)Get ANode from associate in this Node map.ANode[]getSurroundingNodes(int x, int y)Get the neighbour nodes from the specified point.intgetWidth()Get width of Node Map.voidsetDirection(AStar.Neighbor direction)Set direction.voidsetHeuristic(AStar.Heuristic heuristic)Set heuristic.voidsetNode(int x, int y, ANode node)Set ANode.
-
-
-
Field Detail
-
nodes
public ANode[][] nodes
-
-
Constructor Detail
-
NodeMap
public NodeMap(int width, int height, double initialCost)Initializes a new instance of the NodeMap class.- Parameters:
width- Width.height- Height.initialCost- Initial cost to all nodes.
-
NodeMap
public NodeMap(double[][] nodeCostMap)
Initializes a new instance of the NodeMap class.- Parameters:
nodeCostMap- Cost map.
-
NodeMap
public NodeMap(int width, int height, double initialCost, AStar.Neighbor direction, AStar.Heuristic heuristic)Initializes a new instance of the NodeMap class.- Parameters:
width- Width.height- Height.initialCost- Initial cost.direction- Direction.heuristic- Heuristic.
-
NodeMap
public NodeMap(double[][] costMap, AStar.Neighbor direction, AStar.Heuristic heuristic)Initializes a new instance of the NodeMap class.- Parameters:
costMap- Cost map.direction- Direction.heuristic- Heuristic.
-
-
Method Detail
-
getWidth
public int getWidth()
Get width of Node Map.- Returns:
- Width.
-
getHeight
public int getHeight()
Get height of Node Map.- Returns:
- Height.
-
getNode
public ANode getNode(int x, int y)
Get ANode from associate in this Node map.- Parameters:
x- X axis coordinate.y- Y axis coordinate.- Returns:
- ANode.
-
setNode
public void setNode(int x, int y, ANode node)Set ANode.- Parameters:
x- X axis coordinate.y- Y axis coordinate.node- ANode.
-
getDirection
public AStar.Neighbor getDirection()
Get direction.- Returns:
- Direction.
-
setDirection
public void setDirection(AStar.Neighbor direction)
Set direction.- Parameters:
direction- Direction.
-
getHeuristic
public AStar.Heuristic getHeuristic()
Get heuristic.- Returns:
- Heuristic.
-
setHeuristic
public void setHeuristic(AStar.Heuristic heuristic)
Set heuristic.- Parameters:
heuristic- Heuristic.
-
getSurroundingNodes
public ANode[] getSurroundingNodes(int x, int y)
Get the neighbour nodes from the specified point.- Parameters:
x- X axis coordinate.y- Y axis coordinate.- Returns:
- Surrounding nodes.
-
ComputeHeuristic
public double ComputeHeuristic(int startX, int startY, int endX, int endY)Compute the heuristic.- Parameters:
startX- X axis coordinate.startY- Y axis coordinate.endX- X axis coordinate.endY- Y axis coordinate.- Returns:
- Value.
-
clone
public NodeMap clone()
- Overrides:
clonein classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG