Warning: include(php/utility.php): Failed to open stream: No such file or directory in /home/argos/argos3/doc/api/embedded/a00846_source.php on line 2

Warning: include(): Failed opening 'php/utility.php' for inclusion (include_path='.:/usr/lib64/php') in /home/argos/argos3/doc/api/embedded/a00846_source.php on line 2
The ARGoS Website

pointmass3d_model.cpp
Go to the documentation of this file.
1 #include "pointmass3d_model.h"
2 #include <argos3/core/simulator/entity/embodied_entity.h>
3 
4 namespace argos {
5 
6  /****************************************/
7  /****************************************/
8 
10  CEmbodiedEntity& c_entity) :
11  CPhysicsModel(c_engine, c_entity),
12  m_cPM3DEngine(c_engine) {
13  /* Register the origin anchor update method */
14  RegisterAnchorMethod(GetEmbodiedEntity().GetOriginAnchor(),
16  /* Set initial position */
18  }
19 
20  /****************************************/
21  /****************************************/
22 
28  }
29 
30  /****************************************/
31  /****************************************/
32 
33  void CPointMass3DModel::MoveTo(const CVector3& c_position,
34  const CQuaternion& c_orientation) {
35  m_cPosition = c_position;
37  }
38 
39  /****************************************/
40  /****************************************/
41 
43  /* Go through other objects and check if the BB intersect */
44  for(std::map<std::string, CPointMass3DModel*>::const_iterator it = GetPM3DEngine().GetPhysicsModels().begin();
45  it != GetPM3DEngine().GetPhysicsModels().end(); ++it) {
46  if((it->second != this) &&
47  GetBoundingBox().Intersects(it->second->GetBoundingBox()))
48  return true;
49  }
50  return false;
51  }
52 
53  /****************************************/
54  /****************************************/
55 
57  s_anchor.Position = m_cPosition;
58  }
59 
60  /****************************************/
61  /****************************************/
62 
63 }
A 3D vector class.
Definition: vector3.h:29
virtual void MoveTo(const CVector3 &c_position, const CQuaternion &c_orientation)
CPointMass3DModel(CPointMass3DEngine &c_engine, CEmbodiedEntity &c_entity)
virtual void CalculateBoundingBox()=0
Calculates the axis-aligned box that contains the entire physics model.
bool Intersects(const SBoundingBox &s_bb) const
Definition: physics_model.h:91
CPointMass3DEngine & GetPM3DEngine()
Returns a reference to the physics engine controlling this model.
CVector3 m_cVelocity
The linear velocity of this model in the engine.
This entity is a link to a body in the physics engine.
virtual void UpdateOriginAnchor(SAnchor &s_anchor)
Updates the origin anchor associated to the embodied entity.
CVector3 m_cPosition
The position of the model in this engine.
virtual void UpdateEntityStatus()
Updates the status of the associated entity.
std::map< std::string, CPointMass3DModel * > & GetPhysicsModels()
void RegisterAnchorMethod(const SAnchor &s_anchor, void(MODEL::*pt_method)(SAnchor &))
Registers an anchor method.
An anchor related to the body of an entity.
Definition: physics_model.h:38
CEmbodiedEntity & GetEmbodiedEntity()
Returns the embodied entity associated to this physics model.
const SBoundingBox & GetBoundingBox() const
Returns an axis-aligned box that contains the physics model.
CVector3 m_cAcceleration
The acceleration of this model in the engine.
CVector3 Position
The position of the anchor wrt the global coordinate system.
Definition: physics_model.h:51
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
virtual bool IsCollidingWithSomething() const
Returns true if this model is colliding with another model.
const SAnchor & GetOriginAnchor() const
Returns a const reference to the origin anchor associated to this entity.