OddRCoordinates

Data class representing odd-R coordinates in a pointy-topped hexagonal grid layout. The Odd-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 OddRCoordinates class interprets the hexagonal grid using a horizontal row system consistent with odd-R. Here, 'R' aligns with the row, with the origin placed at the top-left.

  • In this layout, odd rows are offset by half a column value to the left. As one moves vertically in the positive direction, each odd row appears shifted left 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 OddRCoordinates 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): OddRCoordinates
Link copied to clipboard
open override fun HexCoordinates.into(): OddRCoordinates

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

Link copied to clipboard