HexCoordinate class
六边形坐标类 (使用立方体坐标系统) 约束: x + y + z = 0
Constructors
- HexCoordinate(int x, int y, int z)
-
const
- HexCoordinate.fromOffsetFlat(int col, int row)
-
从偏移坐标创建 (平顶朝上)
factory
- HexCoordinate.fromOffsetPointy(int col, int row)
-
从偏移坐标创建 (尖顶朝上)
factory
- HexCoordinate.fromXZ(int x, int z)
-
从 x 和 z 创建坐标 (自动计算 y)
factory
Properties
Methods
-
distanceTo(
HexCoordinate other) → int - 计算到另一个坐标的曼哈顿距离
-
neighbor(
int direction) → HexCoordinate - 获取指定方向的邻居 (0-5)
-
neighbors(
) → List< HexCoordinate> - 获取相邻的六个坐标
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
ring(
int radius) → List< HexCoordinate> - 获取以此坐标为中心,半径为 radius 的环形坐标列表
-
rotateLeft(
int steps) → HexCoordinate - 旋转(逆时针旋转 60 度的倍数)
-
rotateRight(
int steps) → HexCoordinate - 旋转(顺时针旋转 60 度的倍数)
-
spiral(
int radius) → List< HexCoordinate> - 获取以此坐标为中心,半径为 radius 的螺旋坐标列表(包含中心)
-
toOffsetFlat(
) → (int, int) - 转换为偏移坐标 (平顶朝上) - 返回 (col, row)
-
toOffsetPointy(
) → (int, int) - 转换为偏移坐标 (尖顶朝上) - 返回 (col, row)
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator *(
int scalar) → HexCoordinate - 标量乘法
-
operator +(
HexCoordinate other) → HexCoordinate - 加法运算符
-
operator -(
HexCoordinate other) → HexCoordinate - 减法运算符
-
operator ==(
Object other) → bool -
The equality operator.
override