|
tile2d
|
Used for spatial indexing. More...
#include <spatial.hpp>
Classes | |
| struct | GridElement |
| struct | ParentCell |
Public Types | |
| using | GridMap = boost::unordered_flat_map<ivec2, ParentCell> |
Public Member Functions | |
| Grid (Float cellSize=(Float) tcW) | |
| Constructs a new Grid. | |
| uint16_t | insert (const AABB< Float > &aabb, const T &data) |
| Inserts a new element into the grid. | |
| void | relocate (uint16_t idx, const AABB< Float > &newAABB) |
| Relocates an already existing element within the grid. | |
| void | erase (uint16_t idx) |
| Erases an element. | |
| template<typename Callback > | |
| void | queryIntersects (const AABB< Float > &area, Callback &&clbk) const |
| void | cleanup () |
| Removes empty cells, if any. | |
| GridMap & | gridMap () |
| Returns the map of all cells. | |
Protected Attributes | |
| Float | m_invCellSize |
| Float | m_cellSize |
| FreeList< GridElement, uint16_t > | m_elementList |
| GridMap | m_cells |
| std::vector< ivec2 > | m_possiblyEmptyCells |
Used for spatial indexing.
|
inline |
Constructs a new Grid.
@parram cellSize the side length of a cell within this grid
|
inline |
Erases an element.
| idx | The id of the element to remove |
|
inline |
Returns the map of all cells.
|
inline |
Inserts a new element into the grid.
| aabb | The AABB of the element |
| data | The user data of the element |
|
inline |
Relocates an already existing element within the grid.
| idx | The id of the element |
| newAABB | The new AABB of the element |