SparseGrid

indigoextras.datatypes.SparseGrid
See theSparseGrid companion object
final class SparseGrid[A](val size: Size, values: Batch[UndefOr[A]])

SparseGrid is a collection for managing grid of values where grid squares may or may not actually contain a value.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def clear: SparseGrid[A]

Empty the grid

Empty the grid

Attributes

def combine(other: SparseGrid[A]): SparseGrid[A]

Takes all of the 'set' entries of 'other' and puts them into this grid.

Takes all of the 'set' entries of 'other' and puts them into this grid.

Attributes

def fill(value: A): SparseGrid[A]

Fill the grid with the given value

Fill the grid with the given value

Attributes

def fillCircle(circle: Circle, value: A): SparseGrid[A]

Fill a circle on the grid with a value

Fill a circle on the grid with a value

Attributes

def fillLine(from: Point, to: Point, value: A): SparseGrid[A]

Fill a line (bresenham) with a value

Fill a line (bresenham) with a value

Attributes

def fillLine(line: LineSegment, value: A): SparseGrid[A]

Fill a line (bresenham) with a value

Fill a line (bresenham) with a value

Attributes

def fillRectangle(region: Rectangle, value: A): SparseGrid[A]

Fill a rectangle on the grid with a value

Fill a rectangle on the grid with a value

Attributes

def get(coords: Point): Option[A]

Get the value at the given coordinates

Get the value at the given coordinates

Attributes

def inset(other: SparseGrid[A], offset: Point): SparseGrid[A]

Combines two grids be insetting one within the other, at an offset.

Combines two grids be insetting one within the other, at an offset.

Attributes

def map(modifier: (Point, Option[A]) => Option[A]): SparseGrid[A]

Map over and modify all the points on the grid

Map over and modify all the points on the grid

Attributes

def mapCircle(circle: Circle)(modifier: (Point, Option[A]) => Option[A]): SparseGrid[A]

Map over and modify all the points on the grid that are within the circle

Map over and modify all the points on the grid that are within the circle

Attributes

def mapLine(from: Point, to: Point)(modifier: (Point, Option[A]) => Option[A]): SparseGrid[A]

Map over the grid squares on a line (bresenham) and modify

Map over the grid squares on a line (bresenham) and modify

Attributes

def mapLine(line: LineSegment)(modifier: (Point, Option[A]) => Option[A]): SparseGrid[A]

Map over the grid squares on a line (bresenham) and modify

Map over the grid squares on a line (bresenham) and modify

Attributes

def mapRectangle(region: Rectangle)(modifier: (Point, Option[A]) => Option[A]): SparseGrid[A]

Map over and modify all the points on the grid that are within the rectangle

Map over and modify all the points on the grid that are within the rectangle

Attributes

def modifyAt(coords: Point)(modifier: Option[A] => Option[A]): SparseGrid[A]

Modify a specific point on the grid

Modify a specific point on the grid

Attributes

def put(coords: Point, value: A): SparseGrid[A]

Put a value into the grid

Put a value into the grid

Attributes

def put(newValues: Batch[(Point, A)]): SparseGrid[A]

Put a batch of values into the grid

Put a batch of values into the grid

Attributes

def put(values: Batch[(Point, A)], offset: Point): SparseGrid[A]

Put a batch of values into the grid, at an offset position

Put a batch of values into the grid, at an offset position

Attributes

def put(values: (Point, A)*): SparseGrid[A]

Put repeating values into the grid

Put repeating values into the grid

Attributes

def remove(coords: Point): SparseGrid[A]

Remove the value at the given coordinates

Remove the value at the given coordinates

Attributes

def toBatch: Batch[Option[A]]

Returns all set values, guarantees order.

Returns all set values, guarantees order.

Attributes

def toBatch(default: A): Batch[A]

Returns all set values and a default for any value that is not present, guarantees order.

Returns all set values and a default for any value that is not present, guarantees order.

Attributes

def toBatch(region: Rectangle): Batch[A]

Returns all values in a given region.

Returns all values in a given region.

Attributes

def toBatch(region: Rectangle, default: A): Batch[A]

Returns all values in a given region, or the provided default for any missing values.

Returns all values in a given region, or the provided default for any missing values.

Attributes

def toPositionedBatch: Batch[(Point, A)]

Returns all set values with their grid positions.

Returns all set values with their grid positions.

Attributes

def toPositionedBatch(region: Rectangle): Batch[(Point, A)]

Returns all values with their grid positions in a given region.

Returns all values with their grid positions in a given region.

Attributes

def |+|(other: SparseGrid[A]): SparseGrid[A]

Alias for combine. Takes all of the 'set' entries of 'other' and puts them into this grid.

Alias for combine. Takes all of the 'set' entries of 'other' and puts them into this grid.

Attributes

Concrete fields

lazy val length: Int

Returns the length of the grid, i.e. width * height

Returns the length of the grid, i.e. width * height

Attributes

val size: Size