1package com.runehive.game.world.pathfinding.distance;
3import com.runehive.game.world.position.Position;
14 int deltaX = from.
getX() - to.
getX();
15 int deltaY = from.
getY() - to.
getY();
16 return (
int) Math.sqrt(deltaX * deltaX + deltaY * deltaY);
Since Euclidean distance is shorter than Manhattan or diagonal distance, you will still get shortest ...
int calculate(Position to, Position from)
Calculates the heuristic value of the defined two positions.
Represents a single tile on the game world.
int getY()
Gets the absolute y coordinate.
int getX()
Gets the absolute x coordinate.
An interface to calculate the distance between two nodes in a Position.