distance

fun distance(fromQ: Int, fromR: Int, toQ: Int, toR: Int): Int(source)

Calculates the hexagonal distance between two points given by their (q, r) coordinates.

Return

The calculated distance.

Parameters

fromQ

The 'q' coordinate of the first point.

fromR

The 'r' coordinate of the first point.

toQ

The 'q' coordinate of the second point.

toR

The 'r' coordinate of the second point.


Calculates the hexagonal distance from this coordinate to another.

Return

The distance.

Parameters

other

The other coordinate.

See also