ixfx
    Preparing search index...

    Namespace Grids

    Namespaces

    Array1d
    Array2d
    As

    Iterates over slices of the grid (eg a whole row, a whole column)

    By
    Visit

    Functions

    applyBounds

    Calculates a legal position for a cell based on grid size and bounds wrapping logic.

    asRectangles

    Generator that returns rectangles for each cell in a grid

    cellAtPoint

    Returns the cell at a specified visual coordinate or undefined if the position is outside of the grid.

    cellEquals

    Returns true if two cells equal. Returns false if either cell are undefined

    cellFromIndex

    Returns x,y from an array index.

    cellKeyString

    Returns a key string for a cell instance A key string allows comparison of instances by value rather than reference

    cellMiddle

    Returns the visual midpoint of a cell (eg. pixel coordinate)

    getLine

    Returns the cells on the line of start and end, inclusive

    getVectorFromCardinal

    Returns an { x, y } signed vector corresponding to the provided cardinal direction.

    guardGrid

    Throws an exception if any of the grid's parameters are invalid

    indexFromCell

    Returns the index for a given cell. This is useful if a grid is stored in an array.

    inside

    Returns true if cell coordinates are above zero and within bounds of grid

    isCell

    Returns true if cell parameter is a cell with x,y fields. Does not check validity of fields.

    isEqual

    Returns true if grids a and b are equal in value. Returns false if either parameter is undefined.

    neighbourList

    Gets a list of neighbours for cell (using neighbours), filtering results to only those that are valid neighbours (using isNeighbour)

    neighbours

    Returns neighbours for a cell. If no directions are provided, it defaults to allDirections.

    offset

    Returns a coordinate offset from start by vector amount.

    offsetCardinals

    Returns cells that correspond to the cardinal directions at a specified distance i.e. it projects a line from start cell in all cardinal directions and returns the cells at steps distance.

    randomNeighbour
    rectangleForCell

    Returns a visual rectangle of the cell, positioned from the top-left corner

    simpleLine

    Returns a list of cells from start to end.

    toArray2d
    values

    Converts an 1D or 2D array of cell coordinates into values

    References

    Grid → Grid
    GridArray1d → GridArray1d
    GridBoundsLogic → GridBoundsLogic
    GridCardinalDirection → GridCardinalDirection
    GridCardinalDirectionOptional → GridCardinalDirectionOptional
    GridCell → GridCell
    GridCellAccessor → GridCellAccessor
    GridCellAndValue → GridCellAndValue
    GridCellSetter → GridCellSetter
    GridCreateVisitor → GridCreateVisitor
    GridIdentifyNeighbours → GridIdentifyNeighbours
    GridNeighbour → GridNeighbour
    GridNeighbourMaybe → GridNeighbourMaybe
    GridNeighbours → GridNeighbours
    GridNeighbourSelectionLogic → GridNeighbourSelectionLogic
    GridNeighbourSelector → GridNeighbourSelector
    GridReadable → GridReadable
    GridVisitorOpts → GridVisitorOpts
    GridVisual → GridVisual
    GridWritable → GridWritable

    Variables

    allDirections

    Returns a list of all cardinal directions: n, ne, nw, e, s, se, sw, w

    crossDirections

    Returns a list of + shaped directions: n, e, s, w