- new
Base (__namedParameters, ...args): BaseGridGrid The base grid constructor.

#### Parameters

- __namedParameters: GridConfiguration
`Rest`

...args: any

#### Returns BaseGrid

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.

distance: number

The distance of a grid space in units.

units: string

The distance units used in this grid.

style: string

The style of the grid.

thickness: number

The thickness of the grid.

The color of the grid.

alpha: number

The opacity of the grid.

type: number

The grid type (see CONST.GRID_TYPES).

- get isGridless(): boolean
Is this a gridless grid?

#### Returns boolean

- get isSquare(): boolean
Is this a square grid?

#### Returns boolean

- get isHexagonal(): boolean
Is this a hexagonal grid?

#### Returns boolean

- calculate
Dimensions (sceneWidth, sceneHeight, padding): {

width: number;

height: number;

x: number;

y: number;

rows: number;

columns: number;

} 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: number
The width of the scene.

- sceneHeight: number
The height of the scene.

- padding: number
The percentage of padding.

#### Returns {

width: number;

height: number;

x: number;

y: number;

rows: number;

columns: number;

}##### width: number

##### height: number

##### x: number

##### y: number

##### rows: number

##### columns: number

#### Abstract

- sceneWidth: number

- get
Offset (coords): GridOffset Returns the offset of the grid space corresponding to the given coordinates.

#### Parameters

- coords: any
The coordinates

#### Returns GridOffset

The offset

#### Abstract

- coords: any

- get
Offset (bounds): [i0: number, j0: number, i1: number, j1: number]Range Returns 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.

#### Parameters

- bounds: Rectangle
The bounds

#### Returns [i0: number, j0: number, i1: number, j1: number]

The offset range

#### Example

`const [i0, j0, i1, j1] = grid.getOffsetRange(bounds);`

for ( let i = i0; i < i1; i++ ) {

for ( let j = j0; j < j1; j++ ) {

const offset = {i, j};

// ...

}

}#### Abstract

- bounds: Rectangle

- get
Adjacent (coords): GridOffset[]Offsets Returns the offsets of the grid spaces adjacent to the one corresponding to the given coordinates. Returns an empty array in gridless grids.

#### Parameters

- coords: any
The coordinates

#### Returns GridOffset[]

The adjacent offsets

#### Abstract

- coords: any

- test
Adjacency (coords1, coords2): boolean Returns true if the grid spaces corresponding to the given coordinates are adjacent to each other. In square grids with illegal diagonals the diagonally neighboring grid spaces are not adjacent. Returns false in gridless grids.

#### Parameters

- coords1: any
The first coordinates

- coords2: any
The second coordinates

#### Returns boolean

#### Abstract

- coords1: any

- get
Shifted (coords, direction): GridOffsetOffset Returns the offset of the grid space corresponding to the given coordinates shifted by one grid space in the given direction. In square grids with illegal diagonals the offset of the given coordinates is returned if the direction is diagonal.

#### Parameters

- coords: any
The coordinates

- direction: number
The direction (see CONST.MOVEMENT_DIRECTIONS)

#### Returns GridOffset

The offset

#### Abstract

- coords: any

- get
Shifted (point, direction): PointPoint Returns the point shifted by the difference between the grid space corresponding to the given coordinates and the shifted grid space in the given direction. In square 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.

#### Parameters

- point: Point
The point that is to be shifted

- direction: number
The direction (see CONST.MOVEMENT_DIRECTIONS)

#### Returns Point

The shifted point

#### Abstract

- point: Point

- get
Top (coords): PointLeft Point Returns the top-left point of the grid space corresponding to the given coordinates. If given a point, the top-left point of the grid space that contains it is returned. In gridless grids a point with the same coordinates as the given point is returned.

#### Parameters

- coords: any
The coordinates

#### Returns Point

The top-left point

#### Abstract

- coords: any

- get
Center (coords): PointPoint Returns 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. In gridless grids a point with the same coordinates as the given point is returned.

#### Parameters

- coords: any
The coordinates

#### Returns Point

The center point

#### Abstract

- coords: any

- get
Shape (): Point[] Returns 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.

#### Returns Point[]

The points of the polygon

#### Abstract

- get
Vertices (coords): Point[] Returns 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.

#### Parameters

- coords: any
The coordinates

#### Returns Point[]

The vertices

#### Abstract

- coords: any

- get
Snapped (point, behavior): PointPoint Snaps the given point to the grid.

#### Parameters

- point: Point
The point that is to be snapped

- behavior: GridSnappingBehavior
The snapping behavior

#### Returns Point

The snapped point

#### Abstract

- point: Point

- measure
Path (waypoints, options?): GridMeasurePathResult Measure a shortest, direct path through the given waypoints.

#### Parameters

- waypoints: any[]
The waypoints the path must pass through

`Optional`

options: {

cost: GridMeasurePathCostFunction;

} = {}Additional measurement options

##### cost: GridMeasurePathCostFunction

The function that returns the cost for a given move between grid spaces (default is the distance travelled along the direct path)

#### Returns GridMeasurePathResult

The measurements a shortest, direct path through the given waypoints.

- waypoints: any[]

- get
Direct (waypoints): GridOffset[]Path Returns the sequence of grid offsets of a shortest, direct path passing through the given waypoints.

#### Parameters

- waypoints: any[]
The waypoints the path must pass through

#### Returns GridOffset[]

The sequence of grid offsets of a shortest, direct path

#### Abstract

- waypoints: any[]

- get
Translated (point, direction, distance): PointPoint Get the point translated in a direction by a distance.

#### Parameters

- point: Point
The point that is to be translated.

- direction: number
The angle of direction in degrees.

- distance: number
The distance in grid units.

#### Returns Point

The translated point.

#### Abstract

- point: Point

- get
Circle (center, radius): Point[] Get 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.

#### Parameters

- center: Point
The center point of the circle.

- radius: number
The radius in grid units.

#### Returns Point[]

The points of the circle polygon.

#### Abstract

- center: Point

- get
Cone (origin, radius, direction, angle): Point[] 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.

#### 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.

- origin: Point

`Protected`

_measure- _measure
Path (waypoints, options, result): void `Protected`

Measures the path and writes the measurements into

`result`

. Called by BaseGrid#measurePath.#### Parameters

- waypoints: any[]
The waypoints the path must pass through

- options: {

cost: GridMeasurePathCostFunction;

}Additional measurement options

##### cost: GridMeasurePathCostFunction

The function that returns the cost for a given move between grid spaces (default is the distance travelled)

- result: GridMeasurePathResult
The measurement result that the measurements need to be written to

#### Returns void

#### Abstract

- waypoints: any[]

The base grid class.

## Abstract