ARGoS  3
A parallel, multi-engine simulator for swarm robotics
argos::CGrid< ENTITY > Class Template Reference

#include <grid.h>

+ Inheritance diagram for argos::CGrid< ENTITY >:

List of all members.

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
SCellGetCellAt (SInt32 n_i, SInt32 n_j, SInt32 n_k)
const SCellGetCellAt (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< Realm_cRangeX
CRange< Realm_cRangeY
CRange< Realm_cRangeZ
CVector3 m_cCellSize
CVector3 m_cInvCellSize
SCellm_psCells
size_t m_unCurTimestamp
CSet< ENTITY * > m_cEntities
CEntityOperationm_pcUpdateEntityOperation

Detailed Description

template<class ENTITY>
class argos::CGrid< ENTITY >

Definition at line 12 of file grid.h.


Member Typedef Documentation

template<class ENTITY>
typedef CPositionalIndex<ENTITY>::COperation argos::CGrid< ENTITY >::CEntityOperation

Definition at line 16 of file grid.h.


Constructor & Destructor Documentation

template<class ENTITY >
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.

template<class ENTITY >
argos::CGrid< ENTITY >::~CGrid ( ) [virtual]

Definition at line 76 of file grid_impl.h.


Member Function Documentation

template<class ENTITY>
void argos::CGrid< ENTITY >::AddEntity ( ENTITY &  c_entity) [virtual]

Adds an entity to this index.

Parameters:
c_entityThe entity to add.

Implements argos::CPositionalIndex< ENTITY >.

Definition at line 114 of file grid_impl.h.

template<class ENTITY >
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.

template<class ENTITY >
void argos::CGrid< ENTITY >::ClampCoordinates ( CVector3 c_pos) const [inline]

Definition at line 963 of file grid_impl.h.

template<class ENTITY >
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.

template<class ENTITY >
void argos::CGrid< ENTITY >::ForAllCells ( CCellOperation c_operation) [virtual]

Definition at line 521 of file grid_impl.h.

template<class ENTITY >
void argos::CGrid< ENTITY >::ForAllEntities ( CEntityOperation c_operation) [virtual]

Executes an operation on all the indexed entities.

Parameters:
c_operationThe operation to perform.
See also:
COperation

Implements argos::CPositionalIndex< ENTITY >.

Definition at line 161 of file grid_impl.h.

template<class ENTITY >
void argos::CGrid< ENTITY >::ForCellsAlongRay ( const CRay3 c_ray,
CCellOperation c_operation 
) [virtual]

Definition at line 706 of file grid_impl.h.

template<class ENTITY >
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.

template<class ENTITY >
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.

template<class ENTITY >
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.

template<class ENTITY >
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.

template<class ENTITY >
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.

Parameters:
c_rayThe ray.
c_operationThe operation to perform.
b_stop_at_closest_matchesStop the computation as soon as the first match is found.
See also:
CRay
COperation

Implements argos::CPositionalIndex< ENTITY >.

Definition at line 342 of file grid_impl.h.

template<class ENTITY >
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.

Parameters:
c_centerThe box center.
c_half_sizeThe box half-size.
c_operationThe operation to perform.
See also:
COperation

Implements argos::CPositionalIndex< ENTITY >.

Definition at line 260 of file grid_impl.h.

template<class ENTITY >
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.

Parameters:
c_centerThe circle center.
f_radiusThe circle radius.
c_operationThe operation to perform.
See also:
COperation

Implements argos::CPositionalIndex< ENTITY >.

Definition at line 283 of file grid_impl.h.

template<class ENTITY >
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.

Parameters:
c_centerThe rectangle center.
c_half_sizeThe rectangle half-size.
c_operationThe operation to perform.
See also:
COperation

Implements argos::CPositionalIndex< ENTITY >.

Definition at line 321 of file grid_impl.h.

template<class ENTITY >
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.

Parameters:
c_centerThe sphere center.
f_radiusThe sphere radius.
c_operationThe operation to perform.
See also:
COperation

Implements argos::CPositionalIndex< ENTITY >.

Definition at line 171 of file grid_impl.h.

template<class ENTITY >
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.

template<class ENTITY >
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.

template<class ENTITY>
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.

Parameters:
c_entitiesThe entity set to use as buffer.
c_positionThe wanted point in the space.

Implements argos::CPositionalIndex< ENTITY >.

Definition at line 139 of file grid_impl.h.

template<class ENTITY>
SInt32 argos::CGrid< ENTITY >::GetSizeI ( ) const [inline]

Definition at line 104 of file grid.h.

template<class ENTITY>
SInt32 argos::CGrid< ENTITY >::GetSizeJ ( ) const [inline]

Definition at line 108 of file grid.h.

template<class ENTITY>
SInt32 argos::CGrid< ENTITY >::GetSizeK ( ) const [inline]

Definition at line 112 of file grid.h.

template<class ENTITY >
void argos::CGrid< ENTITY >::Init ( TConfigurationNode t_tree) [virtual]

Initializes the resource.

Parameters:
t_treethe base of the XML configuration tree to parse
Exceptions:
CARGoSExceptionif an error occurs

Implements argos::CPositionalIndex< ENTITY >.

Definition at line 84 of file grid_impl.h.

template<class ENTITY >
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.

template<class ENTITY >
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.

template<class ENTITY>
void argos::CGrid< ENTITY >::RemoveEntity ( ENTITY &  c_entity) [virtual]

Removes an entity from this index.

Parameters:
c_entityThe entity to remove.

Implements argos::CPositionalIndex< ENTITY >.

Definition at line 122 of file grid_impl.h.

template<class ENTITY >
void argos::CGrid< ENTITY >::Reset ( ) [virtual]

Resets the resource.

Implements argos::CPositionalIndex< ENTITY >.

Definition at line 91 of file grid_impl.h.

template<class ENTITY >
void argos::CGrid< ENTITY >::SetUpdateEntityOperation ( CEntityOperation pc_operation) [inline]

Definition at line 907 of file grid_impl.h.

template<class ENTITY >
void argos::CGrid< ENTITY >::Update ( ) [virtual]

Updates this positional index.

Implements argos::CPositionalIndex< ENTITY >.

Definition at line 130 of file grid_impl.h.

template<class ENTITY>
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.


Member Data Documentation

template<class ENTITY>
CVector3 argos::CGrid< ENTITY >::m_cAreaMaxCorner [protected]

Definition at line 150 of file grid.h.

template<class ENTITY>
CVector3 argos::CGrid< ENTITY >::m_cAreaMinCorner [protected]

Definition at line 149 of file grid.h.

template<class ENTITY>
CVector3 argos::CGrid< ENTITY >::m_cCellSize [protected]

Definition at line 157 of file grid.h.

template<class ENTITY>
CSet<ENTITY*> argos::CGrid< ENTITY >::m_cEntities [protected]

Definition at line 161 of file grid.h.

template<class ENTITY>
CVector3 argos::CGrid< ENTITY >::m_cInvCellSize [protected]

Definition at line 158 of file grid.h.

template<class ENTITY>
CRange<Real> argos::CGrid< ENTITY >::m_cRangeX [protected]

Definition at line 154 of file grid.h.

template<class ENTITY>
CRange<Real> argos::CGrid< ENTITY >::m_cRangeY [protected]

Definition at line 155 of file grid.h.

template<class ENTITY>
CRange<Real> argos::CGrid< ENTITY >::m_cRangeZ [protected]

Definition at line 156 of file grid.h.

template<class ENTITY>
SInt32 argos::CGrid< ENTITY >::m_nSizeI [protected]

Definition at line 151 of file grid.h.

template<class ENTITY>
SInt32 argos::CGrid< ENTITY >::m_nSizeJ [protected]

Definition at line 152 of file grid.h.

template<class ENTITY>
SInt32 argos::CGrid< ENTITY >::m_nSizeK [protected]

Definition at line 153 of file grid.h.

template<class ENTITY>
CEntityOperation* argos::CGrid< ENTITY >::m_pcUpdateEntityOperation [protected]

Definition at line 162 of file grid.h.

template<class ENTITY>
SCell* argos::CGrid< ENTITY >::m_psCells [protected]

Definition at line 159 of file grid.h.

template<class ENTITY>
size_t argos::CGrid< ENTITY >::m_unCurTimestamp [protected]

Definition at line 160 of file grid.h.


The documentation for this class was generated from the following files: