UNPKG

@rickosborne/hexgrid

Version:

Rick Osborne's collection of hexagonal grid-related code.

34 lines 1.46 kB
import type { EVEN_Q, EVEN_R, ODD_Q, ODD_R } from "./hex-system.js"; import type { Point } from "./point.js"; export interface BareOffset { col: number; row: number; } export type OffsetSystem = typeof ODD_Q | typeof ODD_R | typeof EVEN_Q | typeof EVEN_R; export interface OffsetPoint<SystemT extends OffsetSystem> extends Point, BareOffset { system: SystemT; } export interface OddRPoint extends OffsetPoint<typeof ODD_R> { } export interface OddQPoint extends OffsetPoint<typeof ODD_Q> { } export interface EvenRPoint extends OffsetPoint<typeof EVEN_R> { } export interface EvenQPoint extends OffsetPoint<typeof EVEN_Q> { } export declare const OFFSET_R_E = 0; export declare const OFFSET_R_NE = 1; export declare const OFFSET_R_NW = 2; export declare const OFFSET_R_W = 3; export declare const OFFSET_R_SW = 4; export declare const OFFSET_R_SE = 5; export type OffsetDirection = typeof OFFSET_R_E | typeof OFFSET_R_NE | typeof OFFSET_R_NW | typeof OFFSET_R_W | typeof OFFSET_R_SW | typeof OFFSET_R_SE; export declare const OFFSET_Q_SE = 0; export declare const OFFSET_Q_NE = 1; export declare const OFFSET_Q_N = 2; export declare const OFFSET_Q_NW = 3; export declare const OFFSET_Q_SW = 4; export declare const OFFSET_Q_S = 5; export declare const OFFSET_DIRECTIONS: Readonly<Readonly<OffsetDirection>[]>; export declare const stringifyOffset: ({ row, col, system }: OffsetPoint<OffsetSystem>) => string; //# sourceMappingURL=offset.d.ts.map