type of labels in this set, compared for equality using ===.
Create an empty city with a gridSize
x gridSize
x gridSize
grid.
dimension of city grid, must be nonnegative integer
Get the footprint and height of a labeled building.
label of building
footprint (smallest rectangle that contains the projection of the building on the ground plane) and height (number of floors in the building), or undefined if no region with that label exists in this set.
Add a rectangle of grid cells to a particular floor of the building labeled by the given label (creating a building or adding a floor if necessary), if the expanded building rests on the ground plane, is still contiguous, and the expansion does not conflict with other existing buildings.
Two buildings conflict if a cubic cell of one building shares a face with a cubic cell belonging to the other building.
label of building
floor of building to expand. Must be an integer in {0...gridSize
-1}.
rectangle to add to specified floor of the labeled building. Required to have nonzero area
and integer coordinates drawn from {0...gridSize
}.
Get the labels of buildings whose projections on the ground plane intersect the given rectangle (where the intersection must contain at least one full grid cell).
rectangle to query. Its coordinates must be integers in {0...gridSize
}.
the labels of buildings in this set whose projections on the ground plane intersect with rect in at least one grid cell
Generated using TypeDoc
A mutable set of labeled "buildings" in 3D, where a building is a contiguous set of cubic cells in in a 3D grid with origin at (0,0,0) and extending to (
gridSize
,gridSize
,gridSize
) (for some nonnegative integergridSize
, fixed when the set is created). Coordinates (x,y,z) are interpreted as points in 3D space in the conventional way.Buildings must rest on the ground (the z=0 plane), and a building must be contiguous: adjacent cells share a face (not just an edge or corner), and any cell in the building must be reachable from any other cell in the building by a path passing through adjacent cells.
Buildings have floors numbered from 0 (the ground floor, resting on the ground plane) upwards to at most
gridSize
-1. Each individual floor of a building must be contiguous.Each building is labeled uniquely, and buildings must be separated: no cell from one building can share a face with a cell from a different building.
Labels may be of arbitrary type
L
and are compared for equality using ===.PS2 instructions: this is a required ADT interface. You may not change the specifications or add new methods.