[Go to site: main page, start]

Class HexagonalGrid

The hexagonal grid class.

Hierarchy (View Summary)

Index

Constructors

Properties

alpha: number

The opacity of the grid.

color: Color

The color of the grid.

columns: boolean

Is this grid column-based (flat-topped) or row-based (pointy-topped)?

diagonals: GridDiagonalRule

The rule for diagonal measurement (see CONST.GRID_DIAGONALS).

distance: number

The distance of a grid space in units.

even: boolean

Is this grid even or odd?

size: number

The size of a grid space in pixels.

sizeX: number

The width of a grid space in pixels.

sizeY: number

The height of a grid space in pixels.

style: string

The style of the grid.

thickness: number

The thickness of the grid.

type: 2 | 3 | 4 | 5
units: string

The distance units used in this grid.

Accessors

  • get isGridless(): boolean

    Is this a gridless grid?

    Returns boolean

  • get isHexagonal(): boolean

    Is this a hexagonal grid?

    Returns boolean

  • get isSquare(): boolean

    Is this a square grid?

    Returns boolean

Methods

  • Parameters

    • waypoints: any
    • __namedParameters: { cost: any }
    • result: any

    Returns void

  • Calculate the total size of the canvas with padding applied, as well as the top-left coordinates of the inner rectangle that houses the scene.

    Parameters

    • sceneWidth: any

      The width of the scene.

    • sceneHeight: any

      The height of the scene.

    • padding: any

      The percentage of padding.

    Returns { columns: number; height: any; rows: number; width: any; x: number; y: number }

  • Parameters

    • coords: any

    Returns ({ i: any; j: any; k: any } | { i: any; j: any; k?: undefined })[]

  • Parameters

    • coords: any

    Returns Point | { elevation: number; x: number; y: number }

  • Parameters

    • __namedParameters: { x: any; y: any }
    • radius: any

    Returns { x: any; y: any }[]

  • Get the cone polygon given the radius in grid units and the angle in degrees for this grid. The points of the polygon are returned ordered in positive orientation. In gridless grids an approximation of the true cone with a deviation of less than 0.25 pixels is returned. If the angle less than 360 and the cone not empty, the first point of the polygon is the origin.

    Parameters

    • origin: Point

      The origin point of the cone

    • radius: number

      The radius in grid units

    • direction: number

      The direction in degrees

    • angle: number

      The angle in degrees

    Returns Point[]

    The points of the cone polygon

  • Get the ellipse polygon given the radius in grid units for this grid. The points of the polygon are returned ordered in positive orientation. In gridless grids an approximation of the true ellipse with a deviation of less than 0.25 pixels is returned.

    Parameters

    • center: Point

      The center point of the ellipse.

    • radiusX: number

      The x-radius in grid units.

    • radiusY: number

      The y-radius in grid units.

    • rotation: number

      The rotation in degrees.

    Returns Point[]

    The points of the ellipse polygon.

  • Get the line polygon given the length and width in grid units for this grid. The points of the polygon are returned ordered in positive orientation.

    Parameters

    • origin: Point

      The origin point of the line.

    • length: number

      The length in grid units.

    • width: number

      The width in grid units.

    • direction: number

      The direction in degrees.

    Returns Point[]

    The points of the line polygon.

  • Parameters

    • coords: any

    Returns { i: any; j: any; k: any } | { i: any; j: any; k?: undefined }

  • Parameters

    • __namedParameters: { height: any; width: any; x: any; y: any }

    Returns any[]

  • Get the rectangle polygon given the width and height in grid units for this grid. The points of the polygon are returned ordered in positive orientation.

    Parameters

    • origin: Point

      The origin point of the rectangle.

    • width: number

      The width in grid units.

    • height: number

      The height in grid units.

    • anchor: Point

      The anchor.

    • rotation: number

      The rotation in degrees.

    Returns Point[]

    The points of the rectangle polygon.

  • Get the ring polygon given the radius and width in grid units for this grid. The points of the polygons are returned ordered in positive orientation. In gridless grids an approximation of the true ring with a deviation of less than 0.25 pixels is returned.

    Parameters

    • center: Point

      The center point of the ring.

    • radius: number

      The radius in grid units.

    • innerWidth: number

      The inner width in grid units.

    • outerWidth: number

      The outer width in grid units.

    Returns [innerCircle: Point[], outerCircle: Point[]]

    The inner and outer circles of the ring polygon.

  • Returns { x: number; y: number }[]

  • Parameters

    • coords: any
    • direction: any

    Returns { i: any; j: any; k: any } | { i: any; j: any; k?: undefined }

  • Parameters

    • point: any
    • direction: any

    Returns Point | { elevation: number; x: number; y: number }

  • Parameters

    • point: any
    • __namedParameters: { mode: any; resolution?: number }

    Returns any

  • Parameters

    • coords: any

    Returns
        | { elevation: number; x: number; y: number }
        | { elevation?: undefined; x: number; y: number }

  • Parameters

    • point: any
    • direction: any
    • distance: any

    Returns { elevation: any; x: any; y: any } | { elevation?: undefined; x: any; y: any }

  • Parameters

    • coords: any

    Returns { x: number; y: number }[]

  • Parameters

    • coords1: any
    • coords2: any

    Returns boolean