Cube class

Smart representation of a hexagon in a hexagonal grid, positioned on three axis. Very practical for a lots of algorithms. Sum of these coordinates is always 0, so technically only q and r are actually necessary (these are called axial coordinates, see Cube.fromAxial)). See https://www.redblobgames.com/grids/hexagons/#coordinates for more information.

Constructors

Cube(int q, int r, int s)
Cube.fromAxial(int q, int r)
Cube.fromGridOffset(GridOffset o, [GridLayout gridLayout = GridLayout.POINTY_TOP])
factory

Properties

hashCode int
The hash code for this object.
no setteroverride
q int
final
r int
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
s int
final

Methods

centerPoint(double size, [GridLayout gridLayout = GridLayout.POINTY_TOP]) PixelPoint
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toGridOffset([GridLayout gridLayout = GridLayout.POINTY_TOP]) GridOffset
Converts this cube to an GridOffset coordinate, using the given GridLayout.
toString() String
A string representation of this object.
override

Operators

operator *(int scalar) Cube
operator +(Cube delta) Cube
operator -(Cube delta) Cube
operator ==(Object other) bool
The equality operator.
override