OddQCoordinates

Data class representing odd-Q coordinates in a flat-topped hexagonal grid layout. The Odd-Q coordinate system employs a 2D grid representation (column and row), which differentiates it from the cube coordinate system utilized in the HexCoordinates class:

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

  • The OddQCoordinates class, alternatively, interprets the hexagonal grid using a vertical column system in line with odd-Q. The column ('q') holds its origin at the top-left.

  • In contrast to even-Q layout, in this layout, it is the odd-numbered columns that are slightly to the left of the even-numbered columns when moving upwards in the positive direction.

The col field stands for the column (corresponding to the q-axis in cube coordinates), while the row represents the row.

The OddQCoordinates class can be beneficial when working with UI elements or graphical representations where Cartesian coordinates are more practical.

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): OddQCoordinates
Link copied to clipboard
open override fun HexCoordinates.into(): OddQCoordinates

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

Link copied to clipboard