1package com.runehive.game.world.pathfinding.distance;
3import com.runehive.game.world.position.Position;
32 int dx = Math.abs(from.
getX() - to.
getX());
33 int dy = Math.abs(from.
getX() - to.
getY());
34 return dx >= dy ? dx : dy;
49 int deltaX = from.
getX() - to.
getX();
50 int deltaY = from.
getY() - to.
getY();
51 return (
int) Math.sqrt(deltaX * deltaX + deltaY * deltaY);
68 int deltaX = Math.abs(from.
getX() - to.
getX());
69 int deltaY = Math.abs(from.
getY() - to.
getY());
70 return deltaX + deltaY;
The Chebyshev heuristic, ideal for a system that allows for 8-directional movement.
int calculate(Position to, Position from)
Calculates the heuristic value of the defined two positions.
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.
The Manhattan Distance is the distance between two points measured along axes at right angles.
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.
int calculate(Position from, Position to)
Calculates the heuristic value of the defined two positions.