dynamics2d_multi_body_object_model.h
Go to the documentation of this file.
1 
7 #ifndef DYNAMICS2D_MULTI_BODY_OBJECT_MODEL_H
8 #define DYNAMICS2D_MULTI_BODY_OBJECT_MODEL_H
9 
10 namespace argos {
11  class CDynamics2DMultiBodyObjectModel;
12 }
13 
14 #include <argos3/plugins/simulator/physics_engines/dynamics2d/dynamics2d_model.h>
15 #include <argos3/plugins/simulator/physics_engines/dynamics2d/chipmunk-physics/include/chipmunk.h>
16 
17 namespace argos {
18 
45 
46  public:
47 
48  struct SBody {
49  cpBody* Body;
50  cpVect OffsetPos;
51  cpFloat OffsetOrient;
53  SBody(cpBody* pt_body,
54  const cpVect& t_offset_pos,
55  cpFloat t_offset_orient,
56  Real f_height);
57  };
58 
59  public:
60 
68  CComposableEntity& c_entity);
69 
75 
81  return m_cEntity;
82  }
83 
88  inline const CComposableEntity& GetComposableEntity() const {
89  return m_cEntity;
90  }
91 
96  inline SBody& GetBody(size_t i) {
97  return m_vecBodies[i];
98  }
99 
104  inline const SBody& GetBody(size_t i) const {
105  return m_vecBodies[i];
106  }
107 
108  virtual void Reset();
109 
110  virtual void MoveTo(const CVector3& c_position,
111  const CQuaternion& c_orientation);
112 
113  virtual void CalculateBoundingBox();
114 
115  virtual void UpdateFromEntityStatus() = 0;
116 
117  virtual bool IsCollidingWithSomething() const;
118 
143  virtual void AddBody(cpBody* pt_body,
144  const cpVect& t_offset_pos,
145  cpFloat t_offset_orient,
146  Real f_height);
147 
148  private:
149 
150  CComposableEntity& m_cEntity;
151  std::vector<SBody> m_vecBodies;
152  };
153 
154 }
155 
156 #endif
A 3D vector class.
Definition: vector3.h:29
Base class for object models with multiple bodies.
CComposableEntity & GetComposableEntity()
Returns the associated composable entity as a non-const reference.
float Real
Collects all ARGoS code.
Definition: datatypes.h:39
const SBody & GetBody(size_t i) const
Returns the i-th body associated to the model.
virtual bool IsCollidingWithSomething() const
Returns true if this model is colliding with another model.
SBody & GetBody(size_t i)
Returns the i-th body associated to the model.
virtual void MoveTo(const CVector3 &c_position, const CQuaternion &c_orientation)
SBody(cpBody *pt_body, const cpVect &t_offset_pos, cpFloat t_offset_orient, Real f_height)
virtual void AddBody(cpBody *pt_body, const cpVect &t_offset_pos, cpFloat t_offset_orient, Real f_height)
Adds a body.
virtual void UpdateFromEntityStatus()=0
Updates the state of this model from the status of the associated entity.
Basic class for an entity that contains other entities.
const CComposableEntity & GetComposableEntity() const
Returns the associated composable entity as a const reference.
The base class for models in the dynamics 2D engine.
CDynamics2DMultiBodyObjectModel(CDynamics2DEngine &c_engine, CComposableEntity &c_entity)
Class constructor.
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
virtual void CalculateBoundingBox()
Calculates the axis-aligned box that contains the entire physics model.