line

fun line(startQ: Int, startR: Int, endQ: Int, endR: Int, process: (x: Int, y: Int) -> Unit)(source)

Generates a line of points between two given points in a hexagonal grid. The line is generated by calculating the distance between the start and end points, and then interpolating the coordinates for each step along the line. The provided process function is called for each point along the line.

Parameters

startQ

The 'q' coordinate of the start point.

startR

The 'r' coordinate of the start point.

endQ

The 'q' coordinate of the end point.

endR

The 'r' coordinate of the end point.

process

A function that's called for each point on the line.


Generates a line of coordinates from this coordinate to another.

Return

A list of coordinates marking a path between the two points.

Parameters

other

The destination coordinate.