7 #ifndef PHYSICS_ENGINE_H
8 #define PHYSICS_ENGINE_H
14 class CEmbodiedEntity;
20 #include <argos3/core/utility/logging/argos_log.h>
21 #include <argos3/core/utility/math/ray2.h>
22 #include <argos3/core/utility/configuration/base_configurable_resource.h>
23 #include <argos3/core/utility/configuration/argos_configuration.h>
24 #include <argos3/core/utility/datatypes/datatypes.h>
25 #include <argos3/core/utility/plugins/factory.h>
135 typedef std::map<std::string, CPhysicsEngine*, std::less<std::string> >
TMap;
190 return !m_vecTransferData.empty();
232 const CRay3& c_ray)
const = 0;
271 return m_unIterations;
281 return m_fPhysicsClockTick;
288 inline const std::string&
GetId()
const {
296 void SetId(
const std::string& str_id) {
306 Real m_fPhysicsClockTick;
312 static Real m_fSimulationClockTick;
315 static Real m_fInverseSimulationClockTick;
321 std::vector<CEmbodiedEntity*> m_vecTransferData;
326 #define REGISTER_PHYSICS_ENGINE(CLASSNAME, \
333 REGISTER_SYMBOL(CPhysicsEngine, \
unsigned int UInt32
32-bit unsigned integer.
float Real
Collects all ARGoS code.
The namespace containing all the ARGoS related code.
bool GetClosestEmbodiedEntityIntersectedByRay(SEmbodiedEntityIntersectionItem &s_item, const CRay3 &c_ray)
Returns the closest intersection with an embodied entity to the ray start.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
bool GetEmbodiedEntitiesIntersectedByRay(TEmbodiedEntityIntersectionData &t_data, const CRay3 &c_ray)
Checks whether the given ray intersects any entity.
std::vector< SEmbodiedEntityIntersectionItem > TEmbodiedEntityIntersectionData
This entity is a link to a body in the physics engine.
SEmbodiedEntityIntersectionItem(CEmbodiedEntity *pc_entity, Real f_t_on_ray)
CEmbodiedEntity * IntersectedEntity
bool operator<(const SEmbodiedEntityIntersectionItem &s_item)
SEmbodiedEntityIntersectionItem(const SEmbodiedEntityIntersectionItem &s_item)
SEmbodiedEntityIntersectionItem & operator=(const SEmbodiedEntityIntersectionItem &s_item)
SEmbodiedEntityIntersectionItem()
std::map< std::string, CPhysicsEngine *, std::less< std::string > > TMap
virtual void CheckIntersectionWithRay(TEmbodiedEntityIntersectionData &t_data, const CRay3 &c_ray) const =0
Check which objects in this engine intersect the given ray.
static Real GetSimulationClockTick()
Returns the simulation clock tick.
virtual bool IsPointContained(const CVector3 &c_point)
Returns true if the given point is contained in this physics engine.
void SetId(const std::string &str_id)
Sets the id of this physics engine.
SVolume & GetVolume()
Returns the boundary faces for the volume associated to this engine.
virtual void ScheduleEntityForTransfer(CEmbodiedEntity &c_entity)
Schedules an entity of transfer.
std::vector< CPhysicsEngine * > TVector
static Real GetInverseSimulationClockTick()
Returns the inverse of GetSimulationClockTick().
const SVolume & GetVolume() const
Returns the boundary faces for the volume associated to this engine.
const std::string & GetId() const
Returns the id of this physics engine.
virtual void Init(TConfigurationNode &t_tree)
Initializes the resource.
Real GetPhysicsClockTick() const
Returns the length of the physics engine tick.
virtual ~CPhysicsEngine()
virtual void PostSpaceInit()
Executes extra initialization activities after the space has been initialized.
static void SetSimulationClockTick(Real f_simulation_clock_tick)
Sets the simulation clock tick.
virtual size_t GetNumPhysicsModels()=0
bool IsEntityTransferNeeded() const
Returns true if this engine has entities that must be transferred to another engine.
virtual void TransferEntities()
Executes the transfer of entities to other engines.
UInt32 GetIterations() const
Returns the number of iterations per simulation clock tick.
bool IsEntityTransferActive() const
Returns true if entity transfer is active for this engine.
virtual void Destroy()
Undoes whatever was done by Init().
virtual bool RemoveEntity(CEntity &c_entity)=0
Removes an entity from the physics engine.
virtual void Reset()
Resets the resource.
virtual bool AddEntity(CEntity &c_entity)=0
Adds an entity to the physics engine.
A boundary face for entity transfer among physics engines.
A boundary face for top/bottom parts of the volume.
A boundary face for side parts of the volume.
std::vector< SVerticalFace * > SideFaces
void Init(TConfigurationNode &t_node)
SHorizontalFace * TopFace
SHorizontalFace * BottomFace
This class is the base of all XML-configurable ARGoS interface.