Class RepMapRegionSet

An implementation of RegionSet.

PS2 instructions: you must use the provided rep. You may not change the spec of the constructor.

Hierarchy

  • RepMapRegionSet

Implements

Constructors

Properties

Methods

Constructors

  • Create an empty region set for a gridSize x gridSize grid.

    Parameters

    • gridSize: number

      dimension of grid, must be nonnegative integer

    Returns RepMapRegionSet

Properties

gridSize: number

dimension of grid, must be nonnegative integer

Methods

  • Add a rectangle of grid cells to the region labeled by the given label (or create such a labeled region if it was not already present), if it does not intersect with other existing labeled regions.

    Throws

    Error if adding the rectangle would make label's region discontiguous or would intersect with a cell in another labeled region

    Parameters

    • label: string

      label of region

    • rect: Rect

      rectangle to add to labeled region. Required to have nonzero area and integer coordinates drawn from [0,gridSize].

    Returns void

  • Get the bounding box of a labeled region.

    Returns

    the smallest rectangle that contains all the grid cells in the labeled region, or undefined if no region with that label exists.

    Parameters

    • label: string

      label of region

    Returns undefined | Rect

  • Get the labels of regions that intersect the given rectangle (where the intersection contains at least one full grid cell).

    Returns

    the labels of regions in this set whose intersection with rect contains at least one grid cell

    Parameters

    • rect: Rect

      rectangle to query. Its coordinates must be integers in [0,gridSize].

    Returns Set<string>

Generated using TypeDoc