AbstractThe base grid constructor.
The grid configuration
ReadonlyalphaThe opacity of the grid.
ReadonlycolorThe color of the grid.
ReadonlydistanceThe distance of a grid space in units.
ReadonlysizeThe size of a grid space in pixels.
ReadonlysizeXThe width of a grid space in pixels.
ReadonlysizeYThe height of a grid space in pixels.
ReadonlystyleThe style of the grid.
ReadonlythicknessThe thickness of the grid.
ReadonlytypeThe grid type (see CONST.GRID_TYPES).
ReadonlyunitsThe distance units used in this grid.
Is this a gridless grid?
Is this a hexagonal grid?
Is this a square grid?
AbstractcalculateCalculate 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.
AbstractgetReturns the offsets of the grid spaces adjacent to the one corresponding to the given coordinates. Returns always an empty array in gridless grids.
The coordinates
The adjacent offsets
AbstractgetReturns the center point of the grid space corresponding to the given coordinates. If given a point, the center point of the grid space that contains it is returned. The center point lies in the plane of the bottom face of the 3D grid space. In gridless grids a point with the same coordinates as the given point is returned.
The coordinates
The center point
AbstractgetGet the circle 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 circle with a deviation of less than 0.25 pixels is returned.
The center point of the circle.
The radius in grid units.
The points of the circle polygon.
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
AbstractgetReturns the sequence of grid offsets of a shortest, direct path passing through the given waypoints.
The waypoints the path must pass through
The sequence of grid offsets of a shortest, direct path
The waypoints the path must pass through
The sequence of grid offsets of a shortest, direct path
AbstractgetReturns the offset of the grid space corresponding to the given coordinates.
The coordinates
The offset
AbstractgetReturns the smallest possible range containing the offsets of all grid spaces that intersect the given bounds. If the bounds are empty (nonpositive width or height), then the offset range is empty.
The bounds
The offset range
AbstractgetReturns the points of the grid space shape relative to the center point. The points are returned in the same order as in BaseGrid#getVertices. In gridless grids an empty array is returned.
The points of the polygon
AbstractgetReturns the offset of the grid space corresponding to the given coordinates shifted by one grid space in the given direction. The k-coordinate is not changed. In square and hexagonal grids with illegal diagonals the offset of the given coordinates is returned if the direction is diagonal. In gridless grids the point is by the grid size.
The coordinates
The direction (see CONST.MOVEMENT_DIRECTIONS)
The offset
The coordinates
The direction (see CONST.MOVEMENT_DIRECTIONS)
The offset
AbstractgetReturns the point shifted by the difference between the grid space corresponding to the given coordinates and the shifted grid space in the given direction. The z-coordinate is not changed. In square and hexagonal grids with illegal diagonals the point is not shifted if the direction is diagonal. In gridless grids the point coordinates are shifted by the grid size.
The point that is to be shifted
The direction (see CONST.MOVEMENT_DIRECTIONS)
The shifted point
The point that is to be shifted
The direction (see CONST.MOVEMENT_DIRECTIONS)
The shifted point
AbstractgetSnaps the given point to the grid. In square and hexagonal grids the z-coordinate of the point is rounded to the nearest multiple of the grid size. In gridless grids a point with the same coordinates as the given point is returned regardless of the snapping behavior.
The point that is to be snapped
The snapping behavior
The snapped point
The point that is to be snapped
The snapping behavior
The snapped point
AbstractgetReturns the top-left point of the grid space bounds corresponding to the given coordinates. If given a point, the top-left point of the grid space bounds that contains it is returned. The top-left point lies in the plane of the bottom face of the 3D grid space. In gridless grids a point with the same coordinates as the given point is returned.
The coordinates
The top-left point
AbstractgetThe point that is to be translated
The angle of direction in degrees
The distance in grid units
The translated point
AbstractgetReturns the vertices of the grid space corresponding to the given coordinates. The vertices are returned ordered in positive orientation with the first vertex being the top-left vertex in square grids, the top vertex in row-oriented hexagonal grids, and the left vertex in column-oriented hexagonal grids. In gridless grids an empty array is returned.
The coordinates
The vertices
Measure a shortest, direct path through the given waypoints.
The waypoints the path must pass through
Optionaloptions: { cost?: GridMeasurePathCostFunction2D<SegmentData> }Additional measurement options
Optionalcost?: GridMeasurePathCostFunction2D<SegmentData>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
The waypoints the path must pass through
Optionaloptions: { cost?: GridMeasurePathCostFunction3D<SegmentData> }Additional measurement options
Optionalcost?: GridMeasurePathCostFunction3D<SegmentData>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
AbstracttestReturns true if the grid spaces corresponding to the given coordinates are adjacent to each other. In square and hexagonal grids with illegal diagonals the diagonally neighboring grid spaces are not adjacent. Returns always false in gridless grids.
The first coordinates
The second coordinates
The first coordinates
The second coordinates
Protected Abstract_measureMeasures the path and writes the segments measurements into the result. The waypoint measurements are filled in by BaseGrid#measurePath. Called by BaseGrid#measurePath.
The waypoints the path must pass through
Optionaloptions: { cost?: GridMeasurePathCostFunction2D<SegmentData> }Additional measurement options
Optionalcost?: GridMeasurePathCostFunction2D<SegmentData>The function that returns the cost for a given move between grid spaces (default is the distance travelled)
The measurement result that the measurements need to be written to
ProtectedThe waypoints the path must pass through
Optionaloptions: { cost?: GridMeasurePathCostFunction3D<SegmentData> }Additional measurement options
Optionalcost?: GridMeasurePathCostFunction3D<SegmentData>The function that returns the cost for a given move between grid spaces (default is the distance travelled)
The measurement result that the measurements need to be written to
The base grid class.