Change WorldPoint::distanceTo to use chebyshev distance instead of euclidean distance

This commit is contained in:
WooxSolo
2018-05-06 09:06:26 +02:00
committed by Adam
parent 1ec661010e
commit 348cba59de

View File

@@ -144,7 +144,7 @@ public class WorldPoint
return Integer.MAX_VALUE;
}
return (int) Math.hypot(getX() - other.getX(), getY() - other.getY());
return distanceTo2D(other);
}
@@ -156,7 +156,7 @@ public class WorldPoint
*/
public int distanceTo2D(WorldPoint other)
{
return (int) Math.hypot(getX() - other.getX(), getY() - other.getY());
return Math.max(Math.abs(getX() - other.getX()), Math.abs(getY() - other.getY()));
}
/**