@NotThreadSafe public class Node extends Object
Constructor and Description |
---|
Node(Node parent,
double x,
double y,
double z) |
Node(Node parent,
int x,
int y,
int z) |
Node(Node parent,
Position position) |
Modifier and Type | Method and Description |
---|---|
void |
calculateF()
Calculate F value, basically H + G.
|
void |
calculateG()
Calculate movement cost, we dislike jumping and moving diagonally.
|
void |
calculateH(Node target)
Calculate distance cost based on euclidean distance.
|
void |
calculateHGF(Node target)
Calculate all movement values in one go.
|
double |
distance(Node with)
Distance squared between this node and another
|
boolean |
equals(Object o) |
double |
getF()
Get f value of node.
|
Node |
getRelative(int dx,
int dy,
int dz)
Get node relative to current.
|
int |
hashCode() |
Node |
parent()
Get the current node parent.
|
void |
setParent(Node parent)
Set the node's parent.
|
String |
toString() |
int |
x()
Get the node x coord.
|
int |
y()
Get the node y coord
|
int |
z()
Get the node z coord
|
public double getF()
public Node getRelative(int dx, int dy, int dz)
dx
- relative xdy
- relative ydz
- relative zpublic int x()
public int y()
public int z()
public void setParent(Node parent)
parent
- New parent of nodepublic void calculateH(Node target)
target
- Final tile in pathpublic void calculateG()
public void calculateF()
public void calculateHGF(Node target)
target
- Final tile in pathpublic double distance(Node with)
with
- Node to compare withCopyright © 2016. All rights reserved.