AnimatLab  2
Test
RbOrganism.cpp
Go to the documentation of this file.
1 
7 #include "StdAfx.h"
8 #include "RbMovableItem.h"
9 #include "RbBody.h"
10 #include "RbRigidBody.h"
11 #include "RbJoint.h"
12 #include "RbOrganism.h"
13 #include "RbSimulator.h"
14 
15 namespace RoboticsAnimatSim
16 {
17  namespace Environment
18  {
19 
27 {
28  m_lpRbBody = NULL;
29  SetThisPointers();
30 }
31 
32 RbOrganism::~RbOrganism()
33 {
34 }
35 
36 void RbOrganism::Body(RigidBody *lpBody)
37 {
38  Organism::Body(lpBody);
39  m_lpRbBody = dynamic_cast<RbMovableItem *>(lpBody);
40 
41  if(!m_lpRbBody)
42  THROW_TEXT_ERROR(Rb_Err_lUnableToConvertToVsRigidBody, Rb_Err_strUnableToConvertToVsRigidBody, "ID: " + lpBody->Name());
43 }
44 
45 void RbOrganism::SetThisPointers()
46 {
47  RbMovableItem::SetThisPointers();
48 
49  m_lpThisST = dynamic_cast<Structure *>(this);
50  if(!m_lpThisST)
51  THROW_TEXT_ERROR(Rb_Err_lThisPointerNotDefined, Rb_Err_strThisPointerNotDefined, "m_lpThisST, " + m_lpThisAB->Name());
52 
53  m_lpThisOG = dynamic_cast<Organism *>(this);
54  if(!m_lpThisOG)
55  THROW_TEXT_ERROR(Rb_Err_lThisPointerNotDefined, Rb_Err_strThisPointerNotDefined, "m_lpThisOG, " + m_lpThisAB->Name());
56 }
57 
58 void RbOrganism::Create()
59 {
60  CreateItem();
61 
62  Organism::Create();
63 }
64 
66 {
67  RbMovableItem::Physics_ResetSimulation();
68 
69  Organism::ResetSimulation();
70 }
71 
72  } // Environment
73 } //RoboticsAnimatSim
virtual RigidBody * Body()
Gets the root body.
Definition: Structure.cpp:115
Organism()
Default constructor.
Definition: Organism.cpp:50
Structure()
Default constructor.
Definition: Structure.cpp:53
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
Declares the vortex organism class.
virtual void ResetSimulation()
Resets the simulation back to time 0.
Definition: RbOrganism.cpp:65