The hexagonal grid constructor.
The grid configuration
Is this grid column-based (flat-topped) or row-based (pointy-topped)?
Is this grid even or odd?
The size of a grid space in pixels.
The width of a grid space in pixels.
The height of a grid space in pixels.
The distance of a grid space in units.
The distance units used in this grid.
The style of the grid.
The thickness of the grid.
The color of the grid.
The opacity of the grid.
Static
Private
#TEMP_Used by HexagonalGrid#snapToCenter.
Static
Private
#TEMP_Used by HexagonalGrid#snapToCenter. Always an odd grid!
Is this a gridless grid?
Is this a square grid?
Is this a hexagonal grid?
Returns the cube coordinates of the grid space corresponding to the given coordinates.
The coordinates
The cube coordinates
Returns the cube coordinates of grid spaces adjacent to the one corresponding to the given coordinates.
The coordinates
The adjacent cube coordinates
Returns the cube coordinates of the grid space corresponding to the given coordinates shifted by one grid space in the given direction.
The coordinates
The direction (see CONST.MOVEMENT_DIRECTIONS)
The cube coordinates
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.
The width of the scene.
The height of the scene.
The percentage of padding.
Convert point coordinates (x, y) into cube coordinates (q, r, s). Inverse of HexagonalGrid#cubeToPoint.
The point
The (fractional) cube coordinates
Convert cube coordinates (q, r, s) into point coordinates (x, y). Inverse of HexagonalGrid#pointToCube.
The cube coordinates
The point coordinates
Convert offset coordinates (i, j) into integer cube coordinates (q, r, s). Inverse of HexagonalGrid#cubeToOffset.
The offset coordinates
The integer cube coordinates
Convert integer cube coordinates (q, r, s) into offset coordinates (i, j). Inverse of HexagonalGrid#offsetToCube.
The cube coordinates
The offset coordinates
Measure a shortest, direct path through the given waypoints.
The waypoints the path must pass through
Optional
options: { Additional measurement options
The function that returns the cost for a given move between grid spaces (default is the distance travelled along the direct path)
The measurements a shortest, direct path through the given waypoints.
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.
The origin point of the cone.
The radius in grid units.
The direction in degrees.
The angle in degrees.
The points of the cone polygon.
Private
#snapSnap the point to the nearest center of a hexagon.
The point
The grid resolution
Optional
dx: number = 0The x-translation of the grid
Optional
dy: number = 0The y-translation of the grid
Optional
columns: boolean = ...Flat-top instead of pointy-top?
Optional
even: boolean = ...Start at a full grid space?
Optional
size: number = ...The size of a grid space
The snapped point
Private
#snapPrivate
#snapPrivate
#snapPrivate
#snapPrivate
#snapPrivate
#snapPrivate
#snapPrivate
#snapPrivate
#snapSnap the point to the nearest top/bottom-left/right vertex or center of a hexagon.
The point
Bottom-right instead of top-left vertex?
The grid resolution
The snapped point
Private
#snapPrivate
#snapSnap the point to the nearest grid intersection of the rectanglar grid.
The point
Align rectangles with top-left vertices instead of top-left corners?
The grid resolution
The snapped point
Private
#snapPrivate
#snapPrivate
#calculateCalculate the cost of the direct path segment.
The coordinates the segment starts from
The coordinates the segment goes to
The cost function
The cost of the path segment
Static
_calculateInternal
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. (Legacy)
Column or row orientation?
The legacy size of the grid.
The width of the scene.
The height of the scene.
The percentage of padding.
Static
cubeRound the fractional cube coordinates (q, r, s).
The fractional cube coordinates
The rounded integer cube coordinates
Static
cubeMeasure the distance in hexagons between two cube coordinates.
The first cube coordinates
The second cube coordinates
The distance between the two cube coordinates in hexagons
The hexagonal grid class.