Skip to content
On this page

Class: Hex ​

Implements ​

Table of contents ​

Constructors ​

Properties ​

Accessors ​

Methods ​

Constructors ​

constructor ​

new Hex(coordinates?)

Parameters ​

NameType
coordinatesHexCoordinates

Defined in ​

hex/hex.ts:107

Properties ​

q ​

Readonly q: number

Implementation of ​

Readonly.q

Defined in ​

hex/hex.ts:104


r ​

Readonly r: number

Implementation of ​

Readonly.r

Defined in ​

hex/hex.ts:105

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 ​

Point

Defined in ​

hex/hex.ts:33


col ​

get col(): number

Returns ​

number

Implementation of ​

Readonly.col

Defined in ​

hex/hex.ts:38


corners ​

get corners(): Point[]

Returns ​

Point[]

Defined in ​

hex/hex.ts:43


dimensions ​

get dimensions(): Ellipse

Returns ​

Ellipse

Defined in ​

hex/hex.ts:48


height ​

get height(): number

Returns ​

number

Implementation of ​

Readonly.height

Defined in ​

hex/hex.ts:52


isFlat ​

get isFlat(): boolean

Returns ​

boolean

Defined in ​

hex/hex.ts:60


isPointy ​

get isPointy(): boolean

Returns ​

boolean

Defined in ​

hex/hex.ts:64


offset ​

get offset(): HexOffset

Returns ​

HexOffset

Defined in ​

hex/hex.ts:76


orientation ​

get orientation(): Orientation

Returns ​

Orientation

Defined in ​

hex/hex.ts:68


origin ​

get origin(): Point

Returns ​

Point

Defined in ​

hex/hex.ts:72


row ​

get row(): number

Returns ​

number

Implementation of ​

Readonly.row

Defined in ​

hex/hex.ts:80


s ​

get s(): number

Returns ​

number

Implementation of ​

Readonly.s

Defined in ​

hex/hex.ts:100


settings ​

Static get settings(): HexSettings

Returns ​

HexSettings

Defined in ​

hex/hex.ts:22


width ​

get width(): number

Returns ​

number

Implementation of ​

Readonly.width

Defined in ​

hex/hex.ts:84


x ​

get x(): number

Returns ​

number

Implementation of ​

Readonly.x

Defined in ​

hex/hex.ts:92


y ​

get y(): number

Returns ​

number

Implementation of ​

Readonly.y

Defined in ​

hex/hex.ts:96

Methods ​

clone ​

clone<T>(newProps?): T

Type parameters ​

NameType
Textends Hex

Parameters ​

NameType
newPropsHexCoordinates

Returns ​

T

Defined in ​

hex/hex.ts:113


equals ​

equals(coordinates): boolean

Parameters ​

NameType
coordinatesHexCoordinates

Returns ​

boolean

Defined in ​

hex/hex.ts:117


toString ​

toString(): string

Returns ​

string

Defined in ​

hex/hex.ts:121


translate ​

translate(delta): Hex

Parameters ​

NameType
deltaPartialCubeCoordinates

Returns ​

Hex

Defined in ​

hex/hex.ts:125

Released under the MIT License.