Additional
More things with grids!
Spatial
- Grids.getLine : get an array of cell positions that connect to points
- Grids.getVectorFromCardinal : get an x,y vector corresponding to a cardinal direction like ‘north east’.
- Grids.neighbourList : returns an array of cells around a cell
- Grids.offset : calculate position offset from a cell. Includes logic for wrapping around the boundaries of a cell.
- Grids.offsetCardinals : compute the location of cells in the cardinal directions from a target cell
Comparison
- Grids.cellEquals : compares equality of cell position
- Grids.inside : returns true if a cell position is within bounds of a grid
- Grids.isCell : returns true if the passed object seems to be a cell (ie it has x & y properties)
- Grids.isEqual : returns true if two Grids have same value
1D Indexing
- Grids.cellFromIndex : get the
{x,y}
from an index. - Grids.indexFromCell : returns the index for a given cell position.