16 #include <argos3/core/utility/math/ray3.h>
17 #include <argos3/core/utility/datatypes/set.h>
18 #include <argos3/core/simulator/space/positional_indices/positional_index.h>
33 template <
class ENTITY>
64 m_tEntities.
insert(&c_entity);
81 if(it != m_tEntities.
end()) {
82 m_tEntities.
erase(it);
123 return m_cInvCellSize;
132 m_cCellSize = c_cell_size;
133 m_cInvCellSize.
Set(1.0f / m_cCellSize.
GetX(),
134 1.0f / m_cCellSize.
GetY(),
135 1.0f / m_cCellSize.
GetZ());
155 ENTITY& c_entity) = 0;
176 return n_coord * m_cCellSize[un_axis];
268 template <
class ENTITY>
284 ENTITY& c_entity) = 0;
299 template <
class ENTITY,
class UPDATER>
313 m_cUpdater(*
this, **el);
#define THROW_ARGOSEXCEPTION(message)
This macro throws an ARGoS exception with the passed message.
signed int SInt32
32-bit signed integer.
unsigned int UInt32
32-bit unsigned integer.
float Real
Collects all ARGoS code.
The namespace containing all the ARGoS related code.
SInt32 RoundClosestToZero(Real f_value)
Rounds the passed floating-point value to the integer closest to zero.
A data structure that contains positional entities.
The abstract definition of a space hash.
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.
virtual Real HashTableToSpace(SInt32 n_coord, UInt32 un_axis)
Converts a single space hash cell coordinate into a space coordinate.
CAbstractSpaceHash()
Class constructor.
TEntityList & GetEntities()
Returns the list of entities held by this space hash.
virtual ~CAbstractSpaceHash()
Class destructor.
virtual void Update()=0
Updates the entire space hash.
virtual void Dump(CARGoSLog &c_os)=0
virtual void SetCellSize(const CVector3 &c_cell_size)
Sets the size of the cells of the space hash.
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,...
virtual SInt32 SpaceToHashTable(Real f_coord, UInt32 un_axis)
Converts a single space coordinate into a space hash cell coordinate.
CVector3 & GetInvCellSize()
Returns the inverse size of the cells of the space hash.
virtual void RemoveEntity(ENTITY &c_entity)
Remove an entity from the space hash.
virtual void SetSize(size_t un_size)
Sets the size of the space hash.
virtual void AddEntity(ENTITY &c_entity)
Adds an entity to the space hash.
CVector3 & GetCellSize()
Returns the size of the cells of the space hash.
size_t GetSize()
Returns the size of the space hash.
UInt32 CoordinateHash(SInt32 n_i, SInt32 n_j, SInt32 n_k)
Calculates the hash of a space hash coordinate.
virtual bool CheckCell(SInt32 n_i, SInt32 n_j, SInt32 n_k, TEntityList &t_entities)=0
Looks for entities to process in a cell.
CSet< ENTITY * > TEntityList
Type definition for the list of entities held by the space hash.
Defines the basic cell updater of the space hash.
virtual void operator()(CAbstractSpaceHash< ENTITY > &c_space_hash, ENTITY &c_entity)=0
Updates the necessary cells of a space hash.
virtual ~CSpaceHashUpdater()
Class destructor.
Defines the basic space hash.
virtual void Update()
Updates the entire space hash.
void erase(const T &t_element)
Removes the passed element from the list.
iterator find(const T &t_element)
Searches for an element in the list.
void insert(const T &t_element, C comp=C())
Inserts an element to the list.
iterator end() const
Returns an invalid iterator.
Real GetX() const
Returns the x coordinate of this vector.
void Set(const Real f_x, const Real f_y, const Real f_z)
Sets the vector contents from Cartesian coordinates.
Real GetY() const
Returns the y coordinate of this vector.
Real GetZ() const
Returns the z coordinate of this vector.