![]() |
fpmas 1.6
|
#include <grid.h>
Public Member Functions | |
GridRange (DiscreteCoordinate size) | |
DiscreteCoordinate | getSize () const |
void | setSize (DiscreteCoordinate size) |
bool | contains (typename GridConfig::CellType *location_cell, typename GridConfig::CellType *cell) const override |
std::size_t | radius (typename GridConfig::CellType *) const override |
![]() | |
virtual bool | contains (GridConfig::CellType *root, GridConfig::CellType *cell) const=0 |
virtual std::size_t | radius (GridConfig::CellType *origin) const=0 |
A generic api::model::Range implementation for Grid environments.
The corresponding ranges are uniform ranges constructed using a size
threshold and the GridRangeConfig::Distance
function object.
Formally a GridRange range
centered on p1
is constituted by any point of the Grid p
such that GridRangeConfig::Distance()(p1, p) <= range.getSize()
.
Notice the two following cases:
size==0
, only the current location is included in the range.size<0
, the range is empty.GridConfig | grid configuration, that notably defines how a distance between two cells of the grid can be computed, using the GridConfig::Distance function object. The type GridConfig::CellType also defines which type of cells are used to define the Grid. |
GridRangeConfig | grid range configuration. The GridRangeConfig::Distance member type is used to define the shape of the range, independently of the current GridConfig. The GridRangeConfig::Perimeter member type is used to define the perimeter of the range. |
|
inline |
GridRange constructor.
size | initial size |
|
inline |
Returns the size of this range.
|
inline |
Sets the size of this range.
This can be used to dynamically update mobility or perception ranges of SpatialAgents during the simulation of a Model.
size | new range size |
|
inlineoverride |
Returns true if and only if the distance from location_cell->location()
to cell->location()
, computed using a RangeConfig::Distance
instance, is less than or equal to the current range size
.
location_cell | range center |
cell | cell to check |
cell
is in this range
|
inlineoverride |
Returns the Radius of the current range, depending on the current GridConfig
and RangeConfig
.
Possible implementation:
See the fpmas::api::model::Range::radius() documentation for more details about what a "range radius" is.