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
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
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.