Models a uniform grid in 3D space, with the ability to insert and inspect certain cells in the grid. These cells contains a collection of objects.
More...
#include <uniformGrid.h>
|
void | insert (int x, int y, int z, T item) |
| Insert an item into the grid.
|
|
void | remove (int x, int y, int z, T item) |
| Remove an item from a grid cell.
|
|
std::optional< GridCell > | getCell (int x, int y, int z) |
| Get the grid cell at a certain coordinate.
|
|
template<class T>
class Saga::UniformGrid< T >
Models a uniform grid in 3D space, with the ability to insert and inspect certain cells in the grid. These cells contains a collection of objects.
- Template Parameters
-
T | the type of objects stored in each of the grid's cells. |
- Note
- useful for optimizing collisions of dynamic entities.
◆ getCell()
template<class T >
std::optional< std::list< T > > Saga::UniformGrid< T >::getCell |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
z |
|
) |
| |
Get the grid cell at a certain coordinate.
- Parameters
-
x | the x coordinate of the cell. |
y | the y coordinate of the cell. |
z | the z coordinate of the cell. |
- Returns
- {} if the grid cell at position at (x,y,z) has always been empty.
-
GridCell the list of objects at that cell position otherwise.
◆ insert()
Insert an item into the grid.
- Parameters
-
x | the x coordinate of the cell. |
y | the y coordinate of the cell. |
z | the z coordinate of the cell. |
item | the item to insert into the grid at (x,y,z). |
◆ remove()
Remove an item from a grid cell.
- Parameters
-
x | the x coordinate of the cell. |
y | the y coordinate of the cell. |
z | the z coordinate of the cell. |
item | the item to remove from the grid cell at (x,y,z). |
The documentation for this class was generated from the following files: