V-ART
dof.h
Go to the documentation of this file.
1 
5 #ifndef VART_DOF_H
6 #define VART_DOF_H
7 
8 #include "vart/point4d.h"
9 #include "vart/transform.h"
10 #include "vart/bezier.h"
11 #include "vart/memoryobj.h"
12 #include <string>
13 #include <list>
14 #include <iostream> // for XmlPrintOn
15 
16 namespace VART {
17  class Modifier;
18  class Joint;
28  class Dof : public MemoryObj {
29  public:
30  // PUBLIC METHODS
31  Dof();
32  Dof(const Dof& dof);
41  Dof(const Point4D& vec, const Point4D& pos, float min, float max);
42  ~Dof();
43  Dof& operator=(const Dof& dof);
44  void SetDescription(const std::string& desc);
45  const std::string& GetDescription() const { return description; }
46  Point4D GetAxis() const;
47  Point4D GetOrigin() const;
48  Point4D GetPosition() const { return position; }
49  Bezier* GetEvoluta() { return evoluta; }
50  void GetLim(Transform* resultPtr);
51  const Transform& GetLim() const;
52  float GetMin() const;
53  float GetMax() const;
54  float GetCurrentMin() const;
55  float GetCurrentMax() const;
57  float GetRest() const;
58  Joint* GetOwnerJoint() const;
59  void SetEvoluta( Bezier *evol );
60  void SetLim(const Transform& t);
61  void SetAxis(Point4D vec);
68  void SetMin(float min);
75  void SetMax(float max);
76  void SetOwnerJoint( Joint *ow );
83  void MoveTo(float pos);
89  void MoveTo(float pos, unsigned int newPriority);
90 
92  float GetCurrent() const;
93 
99  void Move(float variance) { MoveTo(currentPosition+variance); }
100 
101  void SetRest( float rest );
102 
111  void Set(const Point4D& vec, const Point4D& pos, float min, float max);
112 
113  void Rest();
114  void SetRangeModifier( Modifier *m );
116 
125  void ApplyTransformTo(Transform* ptrTrans) const;
126 
128  void XmlPrintOn(std::ostream& os, unsigned int indent) const;
129 
134  void Reconfigure(const Point4D& state, const Point4D& target);
135  #ifdef VISUAL_JOINTS
136  bool DrawInstanceOGL() const;
137  // PUBLIC STATIC ATTRIBUTES
138  static float axisSize;
139  #endif
140  // PUBLIC STATIC METHODS
145  static void ClearPriorities();
146  // PUBLIC ATTRIBUTES
147 
148  protected:
149  // PROTECTED METHODS
150  void ComputeLIM();
151  // PROTECTED ATTRIBUTES
160  unsigned int priority;
161  private:
162  // PRIVATE ATTRIBUTES
163  std::string description;// Name of the Dof; often related to the dof's type of motion
164  Bezier* evoluta; // 3D path related to the axis position along its rotation
165  Transform lim; // Local Instance Matrix
166  float minAngle; // Min base angle in rad.
167  float maxAngle; // Max base angle in rad.
168  float currentMinAngle; // Min angle in rad currently valid.
169  float currentMaxAngle; // Max angle in rad currently valid.
170  float confortMinAngle; // Min angle in rad for comfortable position.
171  float confortMaxAngle; // Max angle in rad for comfortable position.
172  Modifier* rangeModifier; // Entity used to change the motion range along motion.
173  float currentPosition; //A real number from 0 to 1
174  float restPosition; //Another real number from 0 to 1
175  Joint* ownerJoint; //Reference to the joint where this dof is set up
176  // PRIVATE STATIC ATTRIBUTES
177  // List of all instances of the class
178  static std::list<Dof*> instanceList;
179  }; // end class declaration
180 } // end namespace
181 #endif
A modifier controls how one DOF influences other DOF.
Definition: modifier.h:16
void Reconfigure(const Point4D &state, const Point4D &target)
Reconfigure DOF to match a target direction.
Definition: dof.cpp:346
Representation of joints.
Definition: joint.h:34
Points and vectors using homogeneous coordinates.
Definition: point4d.h:22
Header file for V-ART class "MemoryObj".
void SetEvoluta(Bezier *evol)
Definition: dof.cpp:235
A "Memory Object" is a V-ART object that has some memory allocation attributes, allowing V-ART to aut...
Definition: memoryobj.h:27
const std::string & GetDescription() const
Definition: dof.h:45
void Rest()
Definition: dof.cpp:326
float GetCurrentMax() const
Definition: dof.cpp:205
Point4D GetOrigin() const
Definition: dof.cpp:128
static void ClearPriorities()
Resets priorities of all DOF instances.
Definition: dof.cpp:418
unsigned int priority
Priority of last DOF change.
Definition: dof.h:160
float GetRest() const
Returns DOF's rest position.
Definition: dof.cpp:220
void SetAxis(Point4D vec)
Definition: dof.cpp:230
void SetOwnerJoint(Joint *ow)
Definition: dof.cpp:316
float GetMin() const
Definition: dof.cpp:185
void SetDescription(const std::string &desc)
Definition: dof.cpp:118
A Bezier curve.
Definition: bezier.h:16
Bezier * GetEvoluta()
Definition: dof.h:49
float GetCurrentMin() const
Definition: dof.cpp:195
Geometric transformations.
Definition: transform.h:24
void SetLim(const Transform &t)
Definition: dof.cpp:242
Point4D axis
Together with "position", defines the rotation axis. Relative to the parent reference system...
Definition: dof.h:155
Header file for V-ART class "Transform".
Header file for V-ART class "Bezier".
Modifier * GetRangeModifier()
Definition: dof.cpp:336
Dof()
Definition: dof.cpp:16
Point4D GetAxis() const
Definition: dof.cpp:123
void MoveTo(float pos)
Sets DOF's current position.
Definition: dof.cpp:257
~Dof()
Definition: dof.cpp:75
float GetCurrent() const
Gets DOF's current position.
Definition: dof.cpp:215
void SetRangeModifier(Modifier *m)
Definition: dof.cpp:331
const Transform & GetLim() const
Definition: dof.cpp:135
void Move(float variance)
Changes DOF.
Definition: dof.h:99
Point4D GetPosition() const
Definition: dof.h:48
Header file for V-ART class "Point4D".
float GetMax() const
Definition: dof.cpp:190
void SetMin(float min)
Sets DOF's minimal state.
Definition: dof.cpp:247
Joint * GetOwnerJoint() const
Definition: dof.cpp:225
void SetRest(float rest)
Definition: dof.cpp:321
void SetMax(float max)
Sets DOF's maximal state.
Definition: dof.cpp:252
Point4D position
Together with "axis", defines the rotation axis. Relative to the parent reference system...
Definition: dof.h:153
void ApplyTransformTo(Transform *ptrTrans) const
Apply internal transform to some external transform.
Definition: dof.cpp:341
Degree Of Freedom - basic component of a Joint.
Definition: dof.h:28
void XmlPrintOn(std::ostream &os, unsigned int indent) const
Outputs XML representation of the scene.
Definition: dof.cpp:426
void Set(const Point4D &vec, const Point4D &pos, float min, float max)
Initializes a DOF previouly created with default constructor.
Definition: dof.cpp:102
void ComputeLIM()
Definition: dof.cpp:296
Dof & operator=(const Dof &dof)
Definition: dof.cpp:82