Grid
Companion object for the Grid type, providing utility methods for grid manipulation.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Grid.type
Members list
Value members
Concrete methods
Overlay two grids taking the maximum at each cell.
Overlay two grids taking the maximum at each cell.
Value parameters
- base
-
The base grid.
- over
-
The overlay grid.
Attributes
- Returns
-
A new grid where each cell contains the maximum value from the corresponding cells of the base and overlay grids.
Create a grid by tabulating a function over coordinates.
Create a grid by tabulating a function over coordinates.
Type parameters
- A
-
The type of elements in the grid.
Value parameters
- f
-
A function that takes the x and y coordinates and returns the value for that cell.
- h
-
The height of the grid (number of rows).
- w
-
The width of the grid (number of columns).
Attributes
- Returns
-
A two-dimensional array representing the grid.
Extensions
Extensions
Gets the height (cells) of the grid (number of rows).
Gets the height (cells) of the grid (number of rows).
Attributes
- Returns
-
The height of the grid.
Checks if the given coordinates are within the bounds of the grid.
Checks if the given coordinates are within the bounds of the grid.
Value parameters
- x
-
The x-coordinate to check.
- y
-
The y-coordinate to check.
Attributes
- Returns
-
true
if the coordinates are within bounds,false
otherwise.
Checks if the grid is empty.
Checks if the grid is empty.
Attributes
- Returns
-
true
if the grid is empty,false
otherwise.
Gets the width (cells) of the grid (number of columns).
Gets the width (cells) of the grid (number of columns).
Attributes
- Returns
-
The width of the grid.
Flattens the grid in row-major order (x-fast).
Flattens the grid in row-major order (x-fast).
Attributes
- Returns
-
An ArraySeq containing all elements of the grid in row-major order.