Class: Hex
Implements
Readonly
<CubeCoordinates
>Readonly
<OffsetCoordinates
>Readonly
<Point
>Readonly
<BoundingBox
>
Table of contents
Constructors
Properties
Accessors
Methods
Constructors
constructor
new Hex(coordinates?
)
Parameters
Name | Type |
---|---|
coordinates | HexCoordinates |
Defined in
Properties
q
Readonly
q: number
Implementation of
Readonly.q
Defined in
r
Readonly
r: number
Implementation of
Readonly.r
Defined in
Accessors
center
get
center(): Point
This returns a point relative to the top left corner of the hex with coordinates [0, 0]
, ignoring any origin
you may have set.
Deprecated
This probably doesn't do what you expect. If you want the center coordinates of a hex, use hex.x
and hex.y
instead. See https://github.com/flauwekeul/honeycomb/discussions/95#discussioncomment-5158862.
Returns
Defined in
col
get
col(): number
Returns
number
Implementation of
Readonly.col
Defined in
corners
get
corners(): Point
[]
Returns
Point
[]
Defined in
dimensions
get
dimensions(): Ellipse
Returns
Defined in
height
get
height(): number
Returns
number
Implementation of
Readonly.height
Defined in
isFlat
get
isFlat(): boolean
Returns
boolean
Defined in
isPointy
get
isPointy(): boolean
Returns
boolean
Defined in
offset
get
offset(): HexOffset
Returns
Defined in
orientation
get
orientation(): Orientation
Returns
Defined in
origin
get
origin(): Point
Returns
Defined in
row
get
row(): number
Returns
number
Implementation of
Readonly.row
Defined in
s
get
s(): number
Returns
number
Implementation of
Readonly.s
Defined in
settings
Static
get
settings(): HexSettings
Returns
Defined in
width
get
width(): number
Returns
number
Implementation of
Readonly.width
Defined in
x
get
x(): number
Returns
number
Implementation of
Readonly.x
Defined in
y
get
y(): number
Returns
number
Implementation of
Readonly.y
Defined in
Methods
clone
clone<T
>(newProps?
): T
Type parameters
Name | Type |
---|---|
T | extends Hex |
Parameters
Name | Type |
---|---|
newProps | HexCoordinates |
Returns
T
Defined in
equals
equals(coordinates
): boolean
Parameters
Name | Type |
---|---|
coordinates | HexCoordinates |
Returns
boolean
Defined in
toString
toString(): string
Returns
string
Defined in
translate
translate(delta
): Hex
Parameters
Name | Type |
---|---|
delta | PartialCubeCoordinates |