feat(astar): create class labelstar
This commit is contained in:
parent
224ab4a97d
commit
a0c6437bd2
1 changed files with 19 additions and 0 deletions
|
@ -0,0 +1,19 @@
|
||||||
|
package org.insa.graphs.algorithm.shortestpath;
|
||||||
|
|
||||||
|
import org.insa.graphs.model.Node;
|
||||||
|
import org.insa.graphs.model.Point;
|
||||||
|
|
||||||
|
public class LabelStar extends Label {
|
||||||
|
private float distanceToDestination;
|
||||||
|
|
||||||
|
public LabelStar(Node node, Node destination) {
|
||||||
|
super(node);
|
||||||
|
// precision was never an answer
|
||||||
|
distanceToDestination = (float) Point.distance(node.getPoint(), destination.getPoint());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getTotalCost() {
|
||||||
|
return this.getCost() + distanceToDestination;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue