EvenRCoordinates

Data class representing even-R coordinates in a pointy-topped hexagonal grid layout. The Even-R coordinate system uses a 2D grid representation (column and row) differing from the cube coordinate system utilized in the HexCoordinates class:

  • The HexCoordinates class maps hexagonal grid coordinates using three axes q, r, s, forming a cube structure.

  • Conversely, the EvenRCoordinates class interprets the hexagonal grid using a horizontal row system consistent with even-R. Here, 'R' aligns with the row, with the origin placed at the top-left.

  • In this layout, even rows are offset by half a column value. As one moves vertically in the positive direction, each even row appears shifted right to the midway of the adjacent columns.

The col attribute denotes the column, whereas the row signifies the row (which aligns with the r-axis in cube coordinates).

The EvenRCoordinates can be particularly advantageous when working with graphical representations or user interface elements, where Cartesian coordinates (column and row) would be more straightforward and convenient.

Constructors

Link copied to clipboard
constructor(col: Int, row: Int)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val col: Int
Link copied to clipboard
open override val hex: HexCoordinates

Expects a property of HexCoordinates type, which should be provided by instances of this interface.

Link copied to clipboard
open override val q: Int

The column coordinate of the point on the hexagonal grid.

Link copied to clipboard
open override val r: Int

The row coordinate of the point on the hexagonal grid.

Link copied to clipboard
open override val row: Int

Functions

Link copied to clipboard
operator fun get(int: Int): EvenRCoordinates
Link copied to clipboard
open override fun HexCoordinates.into(): EvenRCoordinates

Transforms the given this from HexCoordinates into the corresponding subtype of Coordinates.

Link copied to clipboard