package ch.epfl.maze.physical.stragegies.planner; import ch.epfl.maze.util.Direction; import ch.epfl.maze.util.Vector2D; /** * @author Pacien TRAN-GIRARD */ public interface DistanceCalculator { /** * Returns the current position. * * @return The current position vector */ Vector2D getPosition(); /** * Calculates the Euclidean distance from the adjacent position at the given Direction to the target position. * * @param dir The adjacent Direction * @param targetPosition The targeted position * @return The Euclidean distance between the two positions */ default double getDistanceTo(Direction dir, Vector2D targetPosition) { return this .getPosition() .addDirectionTo(dir) .sub(targetPosition) .dist(); } }