algonim
    Preparing search index...

    A square grid that optimizes finding the smallest element in it as values change.

    If you have mutated data, you must use either:

    • recomputeDirty -- When only some data has changed and you've marked the changes as dirty.
    • recomputeAll -- When all data has changed.
    Index

    Constructors

    Properties

    data: Float64Array

    Data stored in the grid, in a row-continuous fashion. After changing this, you must ensure the grid is properly recomputed before attempting to retrieve the minimum value.

    size: number

    Side length of the grid.

    layers: Layer[] = []
    dirty: Set<number> = ...

    Stores the dirty indices of the lowest layer.

    Methods

    • Converts a column and a row into an index into data.

      Parameters

      • col: number
      • row: number

      Returns number

    • Converts an index into data back into a column and a row.

      Parameters

      • index: number

      Returns [number, number]

    • Gets the index of the smallest element in data. This will only be definitely accurate if the grid has been properly recomputed since the last data change.

      Returns number

    • Gets the column and row of the smallest element in data. This will only be definitely accurate if the grid has been properly recomputed since the last data change.

      Returns [number, number]

    • Fills an entire column with value.

      Parameters

      • col: number
      • value: number

      Returns void

    • Recomputes all elements that have been manually marked dirty so far, and marks them as clean.

      Returns number