AnimatLab  2
Test
RbJoint.cpp
1 // RbJoint.cpp: implementation of the RbJoint class.
2 //
4 
5 #include "StdAfx.h"
6 #include "RbMovableItem.h"
7 #include "RbBody.h"
8 #include "RbJoint.h"
9 #include "RbMotorizedJoint.h"
10 #include "RbRigidBody.h"
11 #include "RbSimulator.h"
12 
13 namespace RoboticsAnimatSim
14 {
15  namespace Environment
16  {
17 
19 // Construction/Destruction
21 
22 RbJoint::RbJoint()
23 {
24  m_lpRbParent = NULL;
25  m_lpRbChild = NULL;
26  m_lpRbSim = NULL;
27  m_lpRbParent = NULL;
28  m_lpRbChild = NULL;
29  m_lpThisJoint = NULL;
30 
31  m_fltPrevBtJointPos = 0;
32  m_fltPrevJointPos = 0;
33 }
34 
35 RbJoint::~RbJoint()
36 {
37 }
38 
39 void RbJoint::SetThisPointers()
40 {
41  RbBody::SetThisPointers();
42 
43  m_lpThisJoint = dynamic_cast<Joint *>(this);
44  if(!m_lpThisJoint)
45  THROW_TEXT_ERROR(Rb_Err_lThisPointerNotDefined, Rb_Err_strThisPointerNotDefined, "m_lpThisJoint, " + m_lpThisAB->Name());
46 
47  m_lpThisJoint->PhysicsBody(this);
48 }
49 
50 RbSimulator *RbJoint::GetRbSimulator()
51 {
52  if(!m_lpRbSim)
53  {
54  m_lpRbSim = dynamic_cast<RbSimulator *>(m_lpThisAB->GetSimulator());
55  if(!m_lpThisRbMI)
56  THROW_TEXT_ERROR(Rb_Err_lThisPointerNotDefined, Rb_Err_strThisPointerNotDefined, "m_lpRbSim, " + m_lpThisAB->Name());
57  }
58  return m_lpRbSim;
59 }
60 void RbJoint::Physics_CollectData()
61 {
62  RbBody::Physics_CollectData();
63 
64 }
65 
66 void RbJoint::Physics_ResetSimulation()
67 {
68  m_fltPrevBtJointPos = 0;
69  m_fltPrevJointPos = 0;
70  RbBody::Physics_ResetSimulation();
71 }
72 
73 
74  } // Environment
75 } //RoboticsAnimatSim
Classes for implementing the cm-labs vortex physics engine for AnimatLab.