Rectangular Grid Spatial Model2D
Creates a grid in the 2D plane. The grid is based on the standard user coordinate system, with (x,y) = (0,0) being the upper left most corner point, with the x-axis going from left to right and the y-axis going from the top down
Parameters
The x coordinate of the upper left most corner point
The y coordinate of the upper left most corner point
The width (along the x-axis) of the grid
The height (along the y-axis) of the grid
The number of rows in the grid (0-based)
The number of columns in the grid (0-based)
Constructors
Properties
The line at the bottom of the grid
An iterator over the cells in the grid. The cells are accesses by rows (row, col): (0,0), then (0,1), etc 0th row first,
The cells in the grid as a list. The cells are accesses by rows (row, col): (0,0), then (0,1), etc 0th row first,
The default velocity for elements that move within the spatial model
The lower left corner point for the grid
The lower right corner point for the grid
The upper left corner point for the grid
The upper right corner point for the grid
Functions
Allows the adding (attaching) of an observer to the observable
Returns true if firstLocation is the same as secondLocation within the underlying spatial model. This is not object reference equality, but rather whether the locations within the underlying spatial model can be considered spatially (equivalent) according to the model. This may or may not imply that the distance between the locations is zero. No assumptions about distance are implied by true.
Returns true if firstElement is the same as secondElement within the underlying spatial model. This is not object reference equality, but rather whether the elements within the underlying spatial model can be considered spatially (equivalent) according to the model. This may or may not imply that the distance between the elements is zero. No assumptions about distance are implied by true.
Returns how many observers are currently attached to the observable
Detaches all the observers from the observable
Allows the deletion (removing) of an observer from the observable
Computes the distance between fromLocation and toLocation based on the spatial model's distance metric
Computes the distance between fromElement and toElement based on the spatial model's distance metric
The elements in the cell containing location or an empty list
The elements in the cell containing spatialElement or an empty list.
The row major index is row(number of columns) + col + 1 Labeling starts at 1 and goes by row (across columns). For example for a 3 by 3 grid 4, 5, 6 7, 8, 9
Returns true if the observer is already attached
Checks if the spatial model contains the supplied element. True indicates that the element is within the spatial model. If the element has already been added to this spatial model then this method should return true
Returns an array with the 1st order Moore neighborhood for the given core cell.
Fills the supplied array with the 1st order Moore neighborhood for the given core cell.
Includes the non-null cells in the neighborhood into a List
The number of elements in the cell containing location
The number of elements in the cell containing spatialElement
Causes the element to be tracked, held, by the spatial model. The user is responsible for maintaining this list