|
| SpatialSubdivision () |
|
| ~SpatialSubdivision () |
|
| SpatialSubdivision (const SpatialSubdivision &rhs) |
|
SpatialSubdivision & | operator= (const SpatialSubdivision &rhs) |
|
entity_pos_t | GetDivisionSize () const |
|
uint32_t | GetWidth () const |
|
uint32_t | GetHeight () const |
|
void | Create (size_t count) |
|
bool | operator== (const SpatialSubdivision &rhs) const |
| Equivalence test (ignoring order of items within each subdivision) More...
|
|
bool | operator!= (const SpatialSubdivision &rhs) const |
|
void | Reset (entity_pos_t maxX, entity_pos_t maxZ, entity_pos_t divisionSize) |
|
void | Add (uint32_t item, CFixedVector2D toMin, CFixedVector2D toMax) |
| Add an item with the given 'to' size. More...
|
|
void | Remove (uint32_t item, CFixedVector2D fromMin, CFixedVector2D fromMax) |
| Remove an item with the given 'from' size. More...
|
|
void | Move (uint32_t item, CFixedVector2D fromMin, CFixedVector2D fromMax, CFixedVector2D toMin, CFixedVector2D toMax) |
| Equivalent to Remove() then Add(), but potentially faster. More...
|
|
void | Add (uint32_t item, CFixedVector2D to) |
| Convenience function for Add() of individual points. More...
|
|
void | Remove (uint32_t item, CFixedVector2D from) |
| Convenience function for Remove() of individual points. More...
|
|
void | Move (uint32_t item, CFixedVector2D from, CFixedVector2D to) |
| Convenience function for Move() of individual points. More...
|
|
void | GetInRange (std::vector< uint32_t > &out, CFixedVector2D posMin, CFixedVector2D posMax) const |
| Returns a sorted list of unique items that includes all items within the given axis-aligned square range. More...
|
|
void | GetNear (std::vector< uint32_t > &out, CFixedVector2D pos, entity_pos_t range) const |
| Returns a sorted list of unique items that includes all items within the given circular distance of the given point. More...
|
|
A very basic subdivision scheme for finding items in ranges.
Items are stored in lists in dynamic-sized divisions. Items have a size (min/max values of their axis-aligned bounding box) and are stored in all divisions overlapping that area.
It is the caller's responsibility to ensure items are only added once, aren't removed unless they've been added, etc, and that Move/Remove are called with the same coordinates originally passed to Add (since this class doesn't remember which divisions an item occupies).