ARGoS
3
A parallel, multi-engine simulator for swarm robotics
|
#include <grid.h>
Classes | |
class | CCellOperation |
struct | SCell |
Public Types | |
typedef CPositionalIndex < ENTITY >::COperation | CEntityOperation |
Public Member Functions | |
CGrid (const CVector3 &c_area_min_corner, const CVector3 &c_area_max_corner, SInt32 n_size_i, SInt32 n_size_j, SInt32 n_size_k) | |
virtual | ~CGrid () |
virtual void | Init (TConfigurationNode &t_tree) |
Initializes the resource. | |
virtual void | Reset () |
Resets the resource. | |
virtual void | Destroy () |
Undoes whatever was done by Init(). | |
virtual void | AddEntity (ENTITY &c_entity) |
Adds an entity to this index. | |
virtual void | RemoveEntity (ENTITY &c_entity) |
Removes an entity from this index. | |
virtual void | Update () |
Updates this positional index. | |
virtual void | GetEntitiesAt (CSet< ENTITY * > &c_entities, const CVector3 &c_position) const |
Puts the entities located at the given point in the passed buffer. | |
virtual void | ForAllEntities (CEntityOperation &c_operation) |
Executes an operation on all the indexed entities. | |
virtual void | ForEntitiesInSphereRange (const CVector3 &c_center, Real f_radius, CEntityOperation &c_operation) |
Executes an operation on all entities within the specified sphere range. | |
virtual void | ForEntitiesInBoxRange (const CVector3 &c_center, const CVector3 &c_half_size, CEntityOperation &c_operation) |
Executes an operation on all entities within the specified box range. | |
virtual void | ForEntitiesInCircleRange (const CVector3 &c_center, Real f_radius, CEntityOperation &c_operation) |
Executes an operation on all entities within the specified circle range. | |
virtual void | ForEntitiesInRectangleRange (const CVector3 &c_center, const CVector2 &c_half_size, CEntityOperation &c_operation) |
Executes an operation on all entities within the specified rectangle range. | |
virtual void | ForEntitiesAlongRay (const CRay3 &c_ray, CEntityOperation &c_operation, bool b_stop_at_closest_match=false) |
Executes an operation on all entities that intersect the given ray. | |
virtual void | ForAllCells (CCellOperation &c_operation) |
virtual void | ForCellsInSphereRange (const CVector3 &c_center, Real f_radius, CCellOperation &c_operation) |
virtual void | ForCellsInBoxRange (const CVector3 &c_center, const CVector3 &c_half_size, CCellOperation &c_operation) |
virtual void | ForCellsInCircleRange (const CVector3 &c_center, Real f_radius, CCellOperation &c_operation) |
virtual void | ForCellsInRectangleRange (const CVector3 &c_center, const CVector2 &c_half_size, CCellOperation &c_operation) |
virtual void | ForCellsAlongRay (const CRay3 &c_ray, CCellOperation &c_operation) |
SInt32 | GetSizeI () const |
SInt32 | GetSizeJ () const |
SInt32 | GetSizeK () const |
void | SetUpdateEntityOperation (CEntityOperation *pc_operation) |
void | UpdateCell (SInt32 n_i, SInt32 n_j, SInt32 n_k, ENTITY &c_entity) |
void | PositionToCell (SInt32 &n_i, SInt32 &n_j, SInt32 &n_k, const CVector3 &c_position) const |
void | PositionToCellUnsafe (SInt32 &n_i, SInt32 &n_j, SInt32 &n_k, const CVector3 &c_position) const |
void | ClampCoordinates (SInt32 &n_i, SInt32 &n_j, SInt32 &n_k) const |
void | ClampCoordinates (CVector3 &c_pos) const |
SCell & | GetCellAt (SInt32 n_i, SInt32 n_j, SInt32 n_k) |
const SCell & | GetCellAt (SInt32 n_i, SInt32 n_j, SInt32 n_k) const |
Protected Attributes | |
CVector3 | m_cAreaMinCorner |
CVector3 | m_cAreaMaxCorner |
SInt32 | m_nSizeI |
SInt32 | m_nSizeJ |
SInt32 | m_nSizeK |
CRange< Real > | m_cRangeX |
CRange< Real > | m_cRangeY |
CRange< Real > | m_cRangeZ |
CVector3 | m_cCellSize |
CVector3 | m_cInvCellSize |
SCell * | m_psCells |
size_t | m_unCurTimestamp |
CSet< ENTITY * > | m_cEntities |
CEntityOperation * | m_pcUpdateEntityOperation |
typedef CPositionalIndex<ENTITY>::COperation argos::CGrid< ENTITY >::CEntityOperation |
argos::CGrid< ENTITY >::CGrid | ( | const CVector3 & | c_area_min_corner, |
const CVector3 & | c_area_max_corner, | ||
SInt32 | n_size_i, | ||
SInt32 | n_size_j, | ||
SInt32 | n_size_k | ||
) |
Definition at line 48 of file grid_impl.h.
argos::CGrid< ENTITY >::~CGrid | ( | ) | [virtual] |
Definition at line 76 of file grid_impl.h.
void argos::CGrid< ENTITY >::AddEntity | ( | ENTITY & | c_entity | ) | [virtual] |
Adds an entity to this index.
c_entity | The entity to add. |
Implements argos::CPositionalIndex< ENTITY >.
Definition at line 114 of file grid_impl.h.
void argos::CGrid< ENTITY >::ClampCoordinates | ( | SInt32 & | n_i, |
SInt32 & | n_j, | ||
SInt32 & | n_k | ||
) | const [inline] |
Definition at line 948 of file grid_impl.h.
void argos::CGrid< ENTITY >::ClampCoordinates | ( | CVector3 & | c_pos | ) | const [inline] |
Definition at line 963 of file grid_impl.h.
void argos::CGrid< ENTITY >::Destroy | ( | ) | [virtual] |
Undoes whatever was done by Init().
Implements argos::CPositionalIndex< ENTITY >.
Definition at line 107 of file grid_impl.h.
void argos::CGrid< ENTITY >::ForAllCells | ( | CCellOperation & | c_operation | ) | [virtual] |
Definition at line 521 of file grid_impl.h.
void argos::CGrid< ENTITY >::ForAllEntities | ( | CEntityOperation & | c_operation | ) | [virtual] |
Executes an operation on all the indexed entities.
c_operation | The operation to perform. |
Implements argos::CPositionalIndex< ENTITY >.
Definition at line 161 of file grid_impl.h.
void argos::CGrid< ENTITY >::ForCellsAlongRay | ( | const CRay3 & | c_ray, |
CCellOperation & | c_operation | ||
) | [virtual] |
Definition at line 706 of file grid_impl.h.
void argos::CGrid< ENTITY >::ForCellsInBoxRange | ( | const CVector3 & | c_center, |
const CVector3 & | c_half_size, | ||
CCellOperation & | c_operation | ||
) | [virtual] |
Definition at line 624 of file grid_impl.h.
void argos::CGrid< ENTITY >::ForCellsInCircleRange | ( | const CVector3 & | c_center, |
Real | f_radius, | ||
CCellOperation & | c_operation | ||
) | [virtual] |
Definition at line 647 of file grid_impl.h.
void argos::CGrid< ENTITY >::ForCellsInRectangleRange | ( | const CVector3 & | c_center, |
const CVector2 & | c_half_size, | ||
CCellOperation & | c_operation | ||
) | [virtual] |
Definition at line 685 of file grid_impl.h.
void argos::CGrid< ENTITY >::ForCellsInSphereRange | ( | const CVector3 & | c_center, |
Real | f_radius, | ||
CCellOperation & | c_operation | ||
) | [virtual] |
Definition at line 535 of file grid_impl.h.
void argos::CGrid< ENTITY >::ForEntitiesAlongRay | ( | const CRay3 & | c_ray, |
CEntityOperation & | c_operation, | ||
bool | b_stop_at_closest_match = false |
||
) | [virtual] |
Executes an operation on all entities that intersect the given ray.
When the parameter b_stop_at_closest_matches
is set to true
, this method stops at the closest match. Depending on the actual index implementation, there may be multiple closest matches. In this case, the operation is executed on all of them.
c_ray | The ray. |
c_operation | The operation to perform. |
b_stop_at_closest_matches | Stop the computation as soon as the first match is found. |
Implements argos::CPositionalIndex< ENTITY >.
Definition at line 342 of file grid_impl.h.
void argos::CGrid< ENTITY >::ForEntitiesInBoxRange | ( | const CVector3 & | c_center, |
const CVector3 & | c_half_size, | ||
CEntityOperation & | c_operation | ||
) | [virtual] |
Executes an operation on all entities within the specified box range.
The box is axis-aligned.
c_center | The box center. |
c_half_size | The box half-size. |
c_operation | The operation to perform. |
Implements argos::CPositionalIndex< ENTITY >.
Definition at line 260 of file grid_impl.h.
void argos::CGrid< ENTITY >::ForEntitiesInCircleRange | ( | const CVector3 & | c_center, |
Real | f_radius, | ||
CEntityOperation & | c_operation | ||
) | [virtual] |
Executes an operation on all entities within the specified circle range.
The circle is parallel to the XY plane.
c_center | The circle center. |
f_radius | The circle radius. |
c_operation | The operation to perform. |
Implements argos::CPositionalIndex< ENTITY >.
Definition at line 283 of file grid_impl.h.
void argos::CGrid< ENTITY >::ForEntitiesInRectangleRange | ( | const CVector3 & | c_center, |
const CVector2 & | c_half_size, | ||
CEntityOperation & | c_operation | ||
) | [virtual] |
Executes an operation on all entities within the specified rectangle range.
The rectangle is axis-aligned and parallel to the XY plane.
c_center | The rectangle center. |
c_half_size | The rectangle half-size. |
c_operation | The operation to perform. |
Implements argos::CPositionalIndex< ENTITY >.
Definition at line 321 of file grid_impl.h.
void argos::CGrid< ENTITY >::ForEntitiesInSphereRange | ( | const CVector3 & | c_center, |
Real | f_radius, | ||
CEntityOperation & | c_operation | ||
) | [virtual] |
Executes an operation on all entities within the specified sphere range.
c_center | The sphere center. |
f_radius | The sphere radius. |
c_operation | The operation to perform. |
Implements argos::CPositionalIndex< ENTITY >.
Definition at line 171 of file grid_impl.h.
CGrid< ENTITY >::SCell & argos::CGrid< ENTITY >::GetCellAt | ( | SInt32 | n_i, |
SInt32 | n_j, | ||
SInt32 | n_k | ||
) | [inline] |
Definition at line 976 of file grid_impl.h.
const CGrid< ENTITY >::SCell & argos::CGrid< ENTITY >::GetCellAt | ( | SInt32 | n_i, |
SInt32 | n_j, | ||
SInt32 | n_k | ||
) | const [inline] |
Definition at line 988 of file grid_impl.h.
void argos::CGrid< ENTITY >::GetEntitiesAt | ( | CSet< ENTITY * > & | c_entities, |
const CVector3 & | c_position | ||
) | const [virtual] |
Puts the entities located at the given point in the passed buffer.
c_entities | The entity set to use as buffer. |
c_position | The wanted point in the space. |
Implements argos::CPositionalIndex< ENTITY >.
Definition at line 139 of file grid_impl.h.
SInt32 argos::CGrid< ENTITY >::GetSizeI | ( | ) | const [inline] |
SInt32 argos::CGrid< ENTITY >::GetSizeJ | ( | ) | const [inline] |
SInt32 argos::CGrid< ENTITY >::GetSizeK | ( | ) | const [inline] |
void argos::CGrid< ENTITY >::Init | ( | TConfigurationNode & | t_tree | ) | [virtual] |
Initializes the resource.
t_tree | the base of the XML configuration tree to parse |
CARGoSException | if an error occurs |
Implements argos::CPositionalIndex< ENTITY >.
Definition at line 84 of file grid_impl.h.
void argos::CGrid< ENTITY >::PositionToCell | ( | SInt32 & | n_i, |
SInt32 & | n_j, | ||
SInt32 & | n_k, | ||
const CVector3 & | c_position | ||
) | const [inline] |
Definition at line 915 of file grid_impl.h.
void argos::CGrid< ENTITY >::PositionToCellUnsafe | ( | SInt32 & | n_i, |
SInt32 & | n_j, | ||
SInt32 & | n_k, | ||
const CVector3 & | c_position | ||
) | const [inline] |
Definition at line 935 of file grid_impl.h.
void argos::CGrid< ENTITY >::RemoveEntity | ( | ENTITY & | c_entity | ) | [virtual] |
Removes an entity from this index.
c_entity | The entity to remove. |
Implements argos::CPositionalIndex< ENTITY >.
Definition at line 122 of file grid_impl.h.
void argos::CGrid< ENTITY >::Reset | ( | ) | [virtual] |
Resets the resource.
Implements argos::CPositionalIndex< ENTITY >.
Definition at line 91 of file grid_impl.h.
void argos::CGrid< ENTITY >::SetUpdateEntityOperation | ( | CEntityOperation * | pc_operation | ) | [inline] |
Definition at line 907 of file grid_impl.h.
void argos::CGrid< ENTITY >::Update | ( | ) | [virtual] |
Updates this positional index.
Implements argos::CPositionalIndex< ENTITY >.
Definition at line 130 of file grid_impl.h.
void argos::CGrid< ENTITY >::UpdateCell | ( | SInt32 | n_i, |
SInt32 | n_j, | ||
SInt32 | n_k, | ||
ENTITY & | c_entity | ||
) |
Definition at line 884 of file grid_impl.h.
CVector3 argos::CGrid< ENTITY >::m_cAreaMaxCorner [protected] |
CVector3 argos::CGrid< ENTITY >::m_cAreaMinCorner [protected] |
CVector3 argos::CGrid< ENTITY >::m_cCellSize [protected] |
CSet<ENTITY*> argos::CGrid< ENTITY >::m_cEntities [protected] |
CVector3 argos::CGrid< ENTITY >::m_cInvCellSize [protected] |
CRange<Real> argos::CGrid< ENTITY >::m_cRangeX [protected] |
CRange<Real> argos::CGrid< ENTITY >::m_cRangeY [protected] |
CRange<Real> argos::CGrid< ENTITY >::m_cRangeZ [protected] |
SInt32 argos::CGrid< ENTITY >::m_nSizeI [protected] |
SInt32 argos::CGrid< ENTITY >::m_nSizeJ [protected] |
SInt32 argos::CGrid< ENTITY >::m_nSizeK [protected] |
CEntityOperation* argos::CGrid< ENTITY >::m_pcUpdateEntityOperation [protected] |
SCell* argos::CGrid< ENTITY >::m_psCells [protected] |
size_t argos::CGrid< ENTITY >::m_unCurTimestamp [protected] |