Package-level declarations

Provides the classes and interfaces for representing different coordinates in hexagonal grid layouts. The key components of this package are:

  • Coordinates: This interface sets a general contract for types that implement or extend Coordinates. It provides constant directions for two specific coordinate layouts: Flat-top and Pointy-top hexagonal grids.

  • FractionalHexCoordinates: This class is used to represent the fractional parts of a hexagonal coordinate.

  • HexCoordinates: This class represents a point in a hexagonal grid using a cubical coordinate system (q, r, s).

  • Offset and Doubled Coordinate Classes: This package includes a variety of classes derived from the Coordinates interface. These classes are used to represent different types of hexagonal layouts, like offset (even or odd) or doubled (width or height) coordinates.

Types

Link copied to clipboard
interface AxisPoint

Interface representing a point in a hexagonal grid using an axial coordinate system (q, r).

Link copied to clipboard

The Coordinates interface is a generic contract for types which extend or implement Coordinates themselves. It provides constant directions for two hexagonal coordinate systems, Flat-top and Pointy-top.

Link copied to clipboard

Represents a double height coordinate in the hexagonal grid layout, which doubles the row step size. Use in a flat top hex layout, the row is increased by 2 for each hex.

Link copied to clipboard

Represents a double width coordinate in the hexagonal grid layout, which doubles the column step size. Use in a pointy top hex layout, the column is increased by 2 for each hex.

Link copied to clipboard

Data class representing even-Q coordinates in a flat-topped hexagonal grid layout. The Even-Q coordinate system makes use of a 2D grid representation (column and row), which differs from the cube coordinates system used by the HexCoordinates:

Link copied to clipboard

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:

Link copied to clipboard
data class FractionalHexCoordinates(val q: Float, val r: Float, val s: Float)
Link copied to clipboard

This interface provides a single method to transform instances of HexCoordinates into an arbitrary, but specific, subtype of Coordinates. This is particularly useful when functions generate new values inside a specific coordinate system and these need to be represented, or 'converted', into another domain-specific coordinate system.

Link copied to clipboard

A data class representing a point in a hexagonal grid using cube coordinates (q, r, s). The s coordinate is calculated based on q and r as -q - r.

Link copied to clipboard

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:

Link copied to clipboard

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:

Link copied to clipboard