The abstract definition of a space hash. More...
#include <space_hash.h>
Public Types | |
typedef CSet< ENTITY * > | TEntityList |
Type definition for the list of entities held by the space hash. More... | |
Public Member Functions | |
CAbstractSpaceHash () | |
Class constructor. More... | |
virtual | ~CAbstractSpaceHash () |
Class destructor. More... | |
virtual void | AddEntity (ENTITY &c_entity) |
Adds an entity to the space hash. More... | |
TEntityList & | GetEntities () |
Returns the list of entities held by this space hash. More... | |
virtual void | RemoveEntity (ENTITY &c_entity) |
Remove an entity from the space hash. More... | |
size_t | GetSize () |
Returns the size of the space hash. More... | |
virtual void | SetSize (size_t un_size) |
Sets the size of the space hash. More... | |
CVector3 & | GetCellSize () |
Returns the size of the cells of the space hash. More... | |
CVector3 & | GetInvCellSize () |
Returns the inverse size of the cells of the space hash. More... | |
virtual void | SetCellSize (const CVector3 &c_cell_size) |
Sets the size of the cells of the space hash. More... | |
virtual void | Update ()=0 |
Updates the entire space hash. More... | |
virtual void | UpdateCell (SInt32 n_x, SInt32 n_y, SInt32 n_z, ENTITY &c_entity)=0 |
Adds an entity to a cell of the space hash. More... | |
virtual SInt32 | SpaceToHashTable (Real f_coord, UInt32 un_axis) |
Converts a single space coordinate into a space hash cell coordinate. More... | |
virtual Real | HashTableToSpace (SInt32 n_coord, UInt32 un_axis) |
Converts a single space hash cell coordinate into a space coordinate. More... | |
virtual void | SpaceToHashTable (SInt32 &n_i, SInt32 &n_j, SInt32 &n_k, const CVector3 &c_pos) |
Converts a space position into a space hash cell The values are written into n_i, n_j, and n_k. More... | |
virtual bool | CheckCell (SInt32 n_i, SInt32 n_j, SInt32 n_k, TEntityList &t_entities)=0 |
Looks for entities to process in a cell. More... | |
virtual void | Dump (CARGoSLog &c_os)=0 |
Public Member Functions inherited from argos::CPositionalIndex< ENTITY > | |
CPositionalIndex () | |
virtual | ~CPositionalIndex () |
virtual void | Init (TConfigurationNode &t_tree)=0 |
Initializes the resource. More... | |
virtual void | Reset ()=0 |
Resets the resource. More... | |
virtual void | Destroy ()=0 |
Undoes whatever was done by Init(). More... | |
virtual void | GetEntitiesAt (CSet< ENTITY *, SEntityComparator > &c_entities, const CVector3 &c_position) const =0 |
Puts the entities located at the given point in the passed buffer. More... | |
virtual void | ForAllEntities (COperation &c_operation)=0 |
Executes an operation on all the indexed entities. More... | |
virtual void | ForEntitiesInSphereRange (const CVector3 &c_center, Real f_radius, COperation &c_operation)=0 |
Executes an operation on all entities within the specified sphere range. More... | |
virtual void | ForEntitiesInBoxRange (const CVector3 &c_center, const CVector3 &c_half_size, COperation &c_operation)=0 |
Executes an operation on all entities within the specified box range. More... | |
virtual void | ForEntitiesInCircleRange (const CVector3 &c_center, Real f_radius, COperation &c_operation)=0 |
Executes an operation on all entities within the specified circle range. More... | |
virtual void | ForEntitiesInRectangleRange (const CVector3 &c_center, const CVector2 &c_half_size, COperation &c_operation)=0 |
Executes an operation on all entities within the specified rectangle range. More... | |
virtual void | ForEntitiesAlongRay (const CRay3 &c_ray, COperation &c_operation, bool b_stop_at_closest_match=false)=0 |
Executes an operation on all entities that intersect the given ray. More... | |
Protected Member Functions | |
UInt32 | CoordinateHash (SInt32 n_i, SInt32 n_j, SInt32 n_k) |
Calculates the hash of a space hash coordinate. More... | |
The abstract definition of a space hash.
This template class defines all the basic functionality of a space hash. This class is used only internally. To define your own space hash, you have to subclass CSpaceHash.
ENTITY | The type of the entity held by the space hash |
Definition at line 34 of file space_hash.h.
typedef CSet<ENTITY*> argos::CAbstractSpaceHash< ENTITY >::TEntityList |
Type definition for the list of entities held by the space hash.
Definition at line 41 of file space_hash.h.
|
inline |
Class constructor.
The size of the space hash (the number of buckets) is set to zero. To be able to use the space hash, you first must set the size to an appropriate value.
Definition at line 52 of file space_hash.h.
|
inlinevirtual |
Class destructor.
Definition at line 57 of file space_hash.h.
|
inlinevirtual |
Adds an entity to the space hash.
c_entity | The entity to add. |
Implements argos::CPositionalIndex< ENTITY >.
Definition at line 63 of file space_hash.h.
|
pure virtual |
Looks for entities to process in a cell.
n_i | The X coordinate of the space hash cell. |
n_j | The Y coordinate of the space hash cell. |
n_k | The Z coordinate of the space hash cell. |
t_entities | The resulting list of entities to process. |
true
if new entities were added to t_entities.
|
inlineprotected |
Calculates the hash of a space hash coordinate.
n_i | The X coordinate of the space hash cell. |
n_j | The Y coordinate of the space hash cell. |
n_k | The Z coordinate of the space hash cell. |
Definition at line 220 of file space_hash.h.
|
pure virtual |
Implemented in argos::CSpaceHashNative< Element, Updater >.
|
inline |
Returns the size of the cells of the space hash.
The size is returned in meters.
Definition at line 112 of file space_hash.h.
|
inline |
Returns the list of entities held by this space hash.
Definition at line 71 of file space_hash.h.
|
inline |
Returns the inverse size of the cells of the space hash.
It is used to convert measures of the space into cells of the space hash.
Definition at line 122 of file space_hash.h.
|
inline |
Returns the size of the space hash.
The size corresponds to the number of buckets.
Definition at line 94 of file space_hash.h.
|
inlinevirtual |
Converts a single space hash cell coordinate into a space coordinate.
n_coord | The value of the X/Y/Z space hash coordinate. |
un_axis | the axis: 0 -> X, 1 -> Y, 2 -> Z. |
Definition at line 174 of file space_hash.h.
|
inlinevirtual |
Remove an entity from the space hash.
c_entity | The entity to remove. |
Implements argos::CPositionalIndex< ENTITY >.
Definition at line 79 of file space_hash.h.
|
inlinevirtual |
Sets the size of the cells of the space hash.
The size is measured in meters.
c_cell_size | The new size for the cells of the space hash. |
Definition at line 131 of file space_hash.h.
|
inlinevirtual |
Sets the size of the space hash.
The size corresponds to the number of buckets.
un_size | The size of the space hash. |
Reimplemented in argos::CSpaceHashNative< Element, Updater >.
Definition at line 103 of file space_hash.h.
|
inlinevirtual |
Converts a single space coordinate into a space hash cell coordinate.
f_coord | The value of the X/Y/Z coordinate in meters. |
un_axis | the axis: 0 -> X, 1 -> Y, 2 -> Z. |
Definition at line 163 of file space_hash.h.
|
inlinevirtual |
Converts a space position into a space hash cell The values are written into n_i, n_j, and n_k.
n_i | The X coordinate of the space hash cell. |
n_j | The Y coordinate of the space hash cell. |
n_k | The Z coordinate of the space hash cell. |
c_pos | The value position in meters. |
Definition at line 187 of file space_hash.h.
|
pure virtual |
Updates the entire space hash.
Implements argos::CPositionalIndex< ENTITY >.
Implemented in argos::CSpaceHashNative< Element, Updater >, argos::CSpaceHash< ENTITY, UPDATER >, and argos::CSpaceHash< Element, Updater >.
|
pure virtual |
Adds an entity to a cell of the space hash.
n_x | The x coordinate of the cell. |
n_y | The y coordinate of the cell. |
n_z | The z coordinate of the cell. |
c_entity | The entity to add. |