![]() |
Gamedev Framework (gf) 1.2.0
A C++17 framework for 2D games
|
An very simple spatial index. More...
#include <gf/Spatial_SimpleSpatialIndex.h>
Public Member Functions | |
SimpleSpatialIndex () | |
Constructor. More... | |
SpatialId | insert (Handle handle, const RectF &bounds) |
Insert an object in the tree. More... | |
void | modify (SpatialId id, RectF bounds) |
Modify the bounds of an object. More... | |
std::size_t | query (const RectF &bounds, SpatialQueryCallback callback, SpatialQuery kind=SpatialQuery::Intersect) |
Query objects in the tree. More... | |
void | remove (SpatialId id) |
Remove an object from the tree. More... | |
void | clear () |
Remove all the objects from the tree. More... | |
Handle | operator[] (SpatialId id) |
Get the handle associated to a spatial id. More... | |
An very simple spatial index.
gf::SimpleSpatialIndex::SimpleSpatialIndex | ( | ) |
Constructor.
void gf::SimpleSpatialIndex::clear | ( | ) |
Remove all the objects from the tree.
Insert an object in the tree.
handle | A handle that represents the object to insert |
bounds | The bounds of the object |
Modify the bounds of an object.
id | The spatial id of the object |
bounds | The new bounds of the object |
Get the handle associated to a spatial id.
id | The spatial id of the object |
std::size_t gf::SimpleSpatialIndex::query | ( | const RectF & | bounds, |
SpatialQueryCallback | callback, | ||
SpatialQuery | kind = SpatialQuery::Intersect |
||
) |
Query objects in the tree.
bounds | The bounds of the query |
callback | The callback to apply to found objects |
kind | The kind of spatial query |
void gf::SimpleSpatialIndex::remove | ( | SpatialId | id | ) |
Remove an object from the tree.
id | The spatial id of the object |