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>
37 IntersectedEntity(NULL),
42 IntersectedEntity(pc_entity),
46 IntersectedEntity(s_item.IntersectedEntity),
47 TOnRay(s_item.TOnRay) {}
50 return TOnRay < s_item.
TOnRay;
131 typedef std::map<std::string, CPhysicsEngine*, std::less<std::string> >
TMap;
142 virtual void Update() = 0;
186 return !m_vecTransferData.empty();
228 const CRay3& c_ray)
const = 0;
267 return m_unIterations;
277 return m_fPhysicsClockTick;
284 inline const std::string&
GetId()
const {
292 void SetId(
const std::string& str_id) {
302 Real m_fPhysicsClockTick;
308 static Real m_fSimulationClockTick;
311 static Real m_fInverseSimulationClockTick;
317 std::vector<CEmbodiedEntity*> m_vecTransferData;
322 #define REGISTER_PHYSICS_ENGINE(CLASSNAME, \
329 REGISTER_SYMBOL(CPhysicsEngine, \
SVolume & GetVolume()
Returns the boundary faces for the volume associated to this engine.
static Real GetInverseSimulationClockTick()
Returns the inverse of GetSimulationClockTick().
float Real
Collects all ARGoS code.
virtual void Destroy()
Undoes whatever was done by Init().
SHorizontalFace * TopFace
bool IsEntityTransferNeeded() const
Returns true if this engine has entities that must be transferred to another engine.
SEmbodiedEntityIntersectionItem(const SEmbodiedEntityIntersectionItem &s_item)
std::map< std::string, CPhysicsEngine *, std::less< std::string > > TMap
virtual bool IsPointContained(const CVector3 &c_point)
Returns true if the given point is contained in this physics engine.
Real GetPhysicsClockTick() const
Returns the length of the physics engine tick.
virtual void Init(TConfigurationNode &t_tree)
Initializes the resource.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
This entity is a link to a body in the physics engine.
A boundary face for entity transfer among physics engines.
void Init(TConfigurationNode &t_node)
virtual void PostSpaceInit()
Executes extra initialization activities after the space has been initialized.
SEmbodiedEntityIntersectionItem(CEmbodiedEntity *pc_entity, Real f_t_on_ray)
CEmbodiedEntity * IntersectedEntity
const std::string & GetId() const
Returns the id of this physics engine.
bool operator<(const SEmbodiedEntityIntersectionItem &s_item)
virtual bool RemoveEntity(CEntity &c_entity)=0
Removes an entity from the physics engine.
virtual void TransferEntities()
Executes the transfer of entities to other engines.
bool GetEmbodiedEntitiesIntersectedByRay(TEmbodiedEntityIntersectionData &t_data, const CRay3 &c_ray)
Checks whether the given ray intersects any entity.
std::vector< SVerticalFace * > SideFaces
std::vector< CPhysicsEngine * > TVector
unsigned int UInt32
32-bit unsigned integer.
std::vector< SEmbodiedEntityIntersectionItem > TEmbodiedEntityIntersectionData
bool IsEntityTransferActive() const
Returns true if entity transfer is active for this engine.
A boundary face for top/bottom parts of the volume.
void SetId(const std::string &str_id)
Sets the id of this physics engine.
virtual size_t GetNumPhysicsModels()=0
virtual void CheckIntersectionWithRay(TEmbodiedEntityIntersectionData &t_data, const CRay3 &c_ray) const =0
Check which objects in this engine intersect the given ray.
bool GetClosestEmbodiedEntityIntersectedByRay(SEmbodiedEntityIntersectionItem &s_item, const CRay3 &c_ray)
Returns the closest intersection with an embodied entity to the ray start.
SEmbodiedEntityIntersectionItem()
const SVolume & GetVolume() const
Returns the boundary faces for the volume associated to this engine.
static Real GetSimulationClockTick()
Returns the simulation clock tick.
UInt32 GetIterations() const
Returns the number of iterations per simulation clock tick.
virtual bool AddEntity(CEntity &c_entity)=0
Adds an entity to the physics engine.
A boundary face for side parts of the volume.
The namespace containing all the ARGoS related code.
static void SetSimulationClockTick(Real f_simulation_clock_tick)
Sets the simulation clock tick.
virtual void ScheduleEntityForTransfer(CEmbodiedEntity &c_entity)
Schedules an entity of transfer.
virtual ~CPhysicsEngine()
virtual void Reset()
Resets the resource.
This class is the base of all XML-configurable ARGoS interface.
SHorizontalFace * BottomFace