feat(astar): create class labelstar

This commit is contained in:
Paul Alnet 2024-05-03 14:46:18 +02:00
parent 224ab4a97d
commit a0c6437bd2

View file

@ -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;
}
}