API - v4.1.5
Table of contents
Hex Enumerations
Traverser Enumerations
Grid Enumerations
Classes
Coordinates Interfaces
Hex Interfaces
Traverser Interfaces
Grid Interfaces
Other Interfaces
Coordinates Type Aliases
Hex Type Aliases
Traverser Type Aliases
Hex Variables
Coordinates Functions
Hex Functions
- createHexDimensions
- createHexOrigin
- defineHex
- equals
- hexToOffset
- hexToPoint
- offsetToCube
- pointToCube
- round
- translate
Traverser Functions
Other Functions
Coordinates Type Aliases
HexCoordinates
HexCoordinates: PartialCubeCoordinates
| OffsetCoordinates
| TupleCoordinates
Defined in
PartialCubeCoordinates
PartialCubeCoordinates: { q?
: number
; r
: number
; s
: number
} | { q
: number
; r?
: number
; s
: number
} | { q
: number
; r
: number
; s?
: number
}
Defined in
TupleCoordinates
TupleCoordinates: [q: number, r: number, s?: number]
Defined in
Hex Type Aliases
HexConstructor
HexConstructor<T
>: (coordinates?
: HexCoordinates
) => T
Type parameters
Name | Type |
---|---|
T | extends Hex |
Type declaration
(coordinates?
)
Parameters
Name | Type |
---|---|
coordinates? | HexCoordinates |
Defined in
HexOffset
HexOffset: 1
| -1
Defined in
Traverser Type Aliases
Traverser
Traverser<T
, R
>: (createHex
: (coordinates?
: HexCoordinates
) => T
, cursor?
: HexCoordinates
) => R
Type parameters
Name | Type |
---|---|
T | extends Hex |
R | extends Iterable <T > = T [] |
Type declaration
(createHex
, cursor?
): R
Parameters
Name | Type |
---|---|
createHex | (coordinates? : HexCoordinates ) => T |
cursor? | HexCoordinates |
Returns
R
Defined in
Hex Variables
defaultHexSettings
Const
defaultHexSettings: HexSettings
Defined in
Coordinates Functions
completeCube
completeCube(«destructured»
): CubeCoordinates
Parameters
Name | Type |
---|---|
«destructured» | PartialCubeCoordinates |
Returns
Defined in
hex/functions/completeCube.ts:7
isAxial
isAxial(value
): value is AxialCoordinates
Parameters
Name | Type |
---|---|
value | unknown |
Returns
value is AxialCoordinates
Defined in
isOffset
isOffset(value
): value is OffsetCoordinates
Parameters
Name | Type |
---|---|
value | unknown |
Returns
value is OffsetCoordinates
Defined in
isTuple
isTuple(value
): value is TupleCoordinates
Parameters
Name | Type |
---|---|
value | unknown |
Returns
value is TupleCoordinates
Defined in
toCube
toCube(hexSettings
, coordinates
): CubeCoordinates
Util for converting offset/axial/cube/tuple coordinates to cube coordinates.
Parameters
Name | Type |
---|---|
hexSettings | Pick <HexSettings , "orientation" | "offset" > |
coordinates | HexCoordinates |
Returns
Defined in
tupleToCube
tupleToCube(«destructured»
): Object
Parameters
Name | Type |
---|---|
«destructured» | TupleCoordinates |
Returns
Object
Name | Type |
---|---|
q | number |
r | number |
s | number |
Defined in
Hex Functions
createHexDimensions
createHexDimensions(radius
): Ellipse
Parameters
Name | Type |
---|---|
radius | number |
Returns
Defined in
hex/functions/createHexDimensions.ts:7
createHexDimensions(boundingBox
, orientation
): Ellipse
Parameters
Name | Type |
---|---|
boundingBox | BoundingBox |
orientation | Orientation |
Returns
Defined in
hex/functions/createHexDimensions.ts:8
createHexDimensions(ellipse
): Ellipse
Parameters
Name | Type |
---|---|
ellipse | Ellipse |
Returns
Defined in
hex/functions/createHexDimensions.ts:9
createHexOrigin
createHexOrigin(input
, boundingBox
): Point
Parameters
Name | Type |
---|---|
input | "topLeft" |
boundingBox | BoundingBox |
Returns
Defined in
hex/functions/createHexOrigin.ts:7
createHexOrigin(input
): Point
Parameters
Name | Type |
---|---|
input | Point |
Returns
Defined in
hex/functions/createHexOrigin.ts:8
defineHex
defineHex(hexOptions?
): typeof Hex
Parameters
Name | Type |
---|---|
hexOptions? | Partial <HexOptions > |
Returns
typeof Hex
Defined in
equals
equals(a
, b
): boolean
Parameters
Name | Type |
---|---|
a | TupleCoordinates | PartialCubeCoordinates |
b | TupleCoordinates | PartialCubeCoordinates |
Returns
boolean
Defined in
equals(a
, b
): boolean
Parameters
Name | Type |
---|---|
a | OffsetCoordinates |
b | OffsetCoordinates |
Returns
boolean
Defined in
hexToOffset
hexToOffset(«destructured»
): OffsetCoordinates
Parameters
Name | Type |
---|---|
«destructured» | Pick <Hex , "q" | "r" | "offset" | "isPointy" > |
Returns
Defined in
hex/functions/hexToOffset.ts:18
hexToPoint
hexToPoint(«destructured»
): Point
Parameters
Name | Type |
---|---|
«destructured» | Hex |
Returns
Defined in
offsetToCube
offsetToCube(«destructured»
, «destructured»
): CubeCoordinates
Parameters
Name | Type |
---|---|
«destructured» | Pick <HexSettings , "orientation" | "offset" > |
«destructured» | OffsetCoordinates |
Returns
Defined in
hex/functions/offsetToCube.ts:27
pointToCube
pointToCube(«destructured»
, «destructured»
): CubeCoordinates
Parameters
Name | Type |
---|---|
«destructured» | Pick <HexSettings , "dimensions" | "orientation" | "origin" > |
«destructured» | Point |
Returns
Defined in
hex/functions/pointToCube.ts:10
round
round(coordinates
): CubeCoordinates
Parameters
Name | Type |
---|---|
coordinates | PartialCubeCoordinates |
Returns
Defined in
translate
translate<T
>(hex
, delta
): T
Type parameters
Name | Type |
---|---|
T | extends Hex |
Parameters
Name | Type |
---|---|
hex | T |
delta | PartialCubeCoordinates |
Returns
T
Defined in
translate(coordinates
, delta
): CubeCoordinates
Parameters
Name | Type |
---|---|
coordinates | PartialCubeCoordinates |
delta | PartialCubeCoordinates |
Returns
Defined in
Traverser Functions
concat
concat<T
>(traversers
): Traverser
<T
>
Type parameters
Name | Type |
---|---|
T | extends Hex |
Parameters
Name | Type |
---|---|
traversers | Traverser <T > | Traverser <T >[] |
Returns
Traverser
<T
>
Defined in
fromCoordinates
fromCoordinates<T
>(...coordinates
): Traverser
<T
>
Type parameters
Name | Type |
---|---|
T | extends Hex |
Parameters
Name | Type |
---|---|
...coordinates | HexCoordinates [] |
Returns
Traverser
<T
>
Defined in
grid/traversers/fromCoordinates.ts:8
line
line<T
>(options
): Traverser
<T
>
Type parameters
Name | Type |
---|---|
T | extends Hex |
Parameters
Name | Type |
---|---|
options | LineAsVectorOptions |
Returns
Traverser
<T
>
Defined in
line<T
>(options
): Traverser
<T
>
Type parameters
Name | Type |
---|---|
T | extends Hex |
Parameters
Name | Type |
---|---|
options | LineBetweenOptions |
Returns
Traverser
<T
>
Defined in
move
move<T
>(direction
): Traverser
<T
>
Type parameters
Name | Type |
---|---|
T | extends Hex |
Parameters
Name | Type |
---|---|
direction | Direction |
Returns
Traverser
<T
>
Defined in
rectangle
rectangle<T
>(options
): Traverser
<T
>
Remarks
The rectangle will only have 90° corners for the directions North, East, South and West.
Type parameters
Name | Type |
---|---|
T | extends Hex |
Parameters
Name | Type |
---|---|
options | RectangleOptions |
Returns
Traverser
<T
>
Defined in
grid/traversers/rectangle.ts:14
rectangle<T
>(cornerA
, cornerB
): Traverser
<T
>
Type parameters
Name | Type |
---|---|
T | extends Hex |
Parameters
Name | Type |
---|---|
cornerA | HexCoordinates |
cornerB | HexCoordinates |
Returns
Traverser
<T
>
Defined in
grid/traversers/rectangle.ts:15
repeat
repeat<T
>(times
, traversers
): Traverser
<T
>
Type parameters
Name | Type |
---|---|
T | extends Hex |
Parameters
Name | Type |
---|---|
times | number |
traversers | Traverser <T > | Traverser <T >[] |
Returns
Traverser
<T
>
Defined in
repeatWith
repeatWith<T
>(sources
, branches
, «destructured»?
): Traverser
<T
>
Type parameters
Name | Type |
---|---|
T | extends Hex |
Parameters
Name | Type |
---|---|
sources | Traverser <T > | Traverser <T >[] |
branches | Traverser <T > | Traverser <T >[] |
«destructured» | Object |
› includeSource | undefined | boolean |
Returns
Traverser
<T
>
Defined in
grid/traversers/repeatWith.ts:8
ring
ring<T
>(options
): Traverser
<T
>
Type parameters
Name | Type |
---|---|
T | extends Hex |
Parameters
Name | Type |
---|---|
options | RingOptions |
Returns
Traverser
<T
>
Defined in
ring<T
>(options
): Traverser
<T
>
Type parameters
Name | Type |
---|---|
T | extends Hex |
Parameters
Name | Type |
---|---|
options | RingFromRadiusOptions |
Returns
Traverser
<T
>
Defined in
spiral
spiral<T
>(«destructured»
): Traverser
<T
>
Type parameters
Name | Type |
---|---|
T | extends Hex |
Parameters
Name | Type |
---|---|
«destructured» | SpiralOptions |
Returns
Traverser
<T
>
Defined in
Other Functions
distance
distance(hexSettings
, from
, to
): number
Parameters
Name | Type |
---|---|
hexSettings | Pick <HexSettings , "orientation" | "offset" > |
from | HexCoordinates |
to | HexCoordinates |
Returns
number
Defined in
isPoint
isPoint(value
): value is Point
Parameters
Name | Type |
---|---|
value | unknown |
Returns
value is Point
Defined in
neighborOf
neighborOf<T
>(hex
, direction
): T
Type parameters
Name | Type |
---|---|
T | extends Hex |
Parameters
Name | Type |
---|---|
hex | T |
direction | Direction |
Returns
T
Defined in
grid/functions/neighborOf.ts:47
offsetFromZero
offsetFromZero(offset
, distance
): number
Parameters
Name | Type |
---|---|
offset | HexOffset |
distance | number |
Returns
number