Skip to content

Additional

More things with grids!

Spatial

  • By.getLine : get an array of cell positions that connect to points
  • By.getVectorFromCardinal : get an x,y vector corresponding to a cardinal direction like ‘north east’.
  • By.neighbourList : returns an array of cells around a cell
  • By.offset : calculate position offset from a cell. Includes logic for wrapping around the boundaries of a cell.
  • By.offsetCardinals : compute the location of cells in the cardinal directions from a target cell

Comparison

  • By.cellEquals : compares equality of cell position
  • By.inside : returns true if a cell position is within bounds of a grid
  • By.isCell : returns true if the passed object seems to be a cell (ie it has x & y properties)
  • By.isEqual : returns true if two Grids have same value

1D Indexing