V-ART
polyaxialjoint.cpp
Go to the documentation of this file.
1 
5 #include "vart/polyaxialjoint.h"
6 #include <cassert>
7 
8 using namespace std;
9 
11 {
12 }
13 
15 {
16  this->operator=(joint);
17 }
18 
20 {
21  this->Joint::operator=(joint);
22  return *this;
23 }
24 
26 {
27  VART::Joint * copy;
28 
29  copy = new VART::PolyaxialJoint(*this);
30  copy->CopyDofListFrom(*this);
31  return copy;
32 }
33 
35  VART::Dof* ptrFirstDof = dofList.front();
36  ptrFirstDof->MoveTo(value);
37 }
38 
40  list<VART::Dof*>::iterator iter = dofList.begin();
41  ++iter;
42  VART::Dof* ptrSecondDof = *iter;
43  ptrSecondDof->MoveTo(value);
44 }
45 
47  list<VART::Dof*>::iterator iter = dofList.begin();
48  ++iter;
49  ++iter;
50  VART::Dof* ptrThirdDof = *iter;
51  ptrThirdDof->MoveTo(value);
52 }
53 
54 void VART::PolyaxialJoint::Adduct(float variance)
55 {
56  assert(GetNumDofs() == 3);
57  list<VART::Dof*>::iterator iter = dofList.begin();
58  ++iter;
59  VART::Dof* ptrSecondDof = *iter;
60  ptrSecondDof->Move(variance);
61 }
62 
63 void VART::PolyaxialJoint::Twist(float variance)
64 {
65  assert(GetNumDofs() == 3);
66  list<VART::Dof*>::iterator iter = dofList.begin();
67  ++iter;
68  ++iter;
69  VART::Dof* ptrSecondDof = *iter;
70  ptrSecondDof->Move(variance);
71 }
72 
74  assert (GetNumDofs() < 3);
76  // If the third DOF was added, the joint should be made ready for use.
77  if (GetNumDofs() == 3)
78  MakeLim();
79 }
Base class for objects that compose a scene graph.
Definition: scenenode.h:25
Representation of joints.
Definition: joint.h:34
virtual VART::SceneNode * Copy()
Returns a copy of an PolyaxialJoint. Every derived class must reimplements this method, to avoid errors with VART::SceneNode::RecursiveCopy.
void SetTwistTo(float value)
void SetAductionTo(float value)
void AddDof(Dof *dof)
Adds a Dof.
void Adduct(float variance)
virtual Dof * AddDof(const Point4D &vec, const Point4D &pos, float min, float max)
Adds a Dof.
Definition: joint.cpp:69
Header file for V-ART class "PolyaxialJoint".
virtual void CopyDofListFrom(VART::Joint &joint)
Copy the dofList atribute from an joint, setting the ownerJoint atribute of copied dof to 'this' join...
Definition: joint.cpp:37
void Twist(float variance)
void MoveTo(float pos)
Sets DOF's current position.
Definition: dof.cpp:257
A joint with three rotational degrees of freedom.
void Move(float variance)
Changes DOF.
Definition: dof.h:99
VART::PolyaxialJoint & operator=(const VART::PolyaxialJoint &joint)
Copy the polyaxialJoint data to another PolyaxialJoint.
Degree Of Freedom - basic component of a Joint.
Definition: dof.h:28
void SetFlexionTo(float value)