V-ART
joint.h
Go to the documentation of this file.
1 
5 
6 #ifndef VART_JOINT_H
7 #define VART_JOINT_H
8 
9 #ifdef VISUAL_JOINTS
10 #include "vart/material.h"
11 #endif
12 
13 #include "vart/transform.h"
14 #include <list>
15 #include <iostream> // for XmlPrintOn
16 
17 namespace VART {
18  class Dof;
34  class Joint : public Transform {
35  public:
38  Joint();
39  Joint(const Joint& j);
40  virtual ~Joint();
41 
44  virtual VART::SceneNode * Copy();
45 
48  virtual void CopyDofListFrom( VART::Joint& joint );
49 
50  const Joint& operator=(const Joint& j);
51  unsigned short int GetNumDofs() const { return dofList.size(); }
52 
64  virtual Dof* AddDof(const Point4D& vec, const Point4D& pos, float min, float max);
65 
67  virtual void AddDof(Dof *dof);
68 
73  void MakeLim();
74 
79  const Dof& GetDof(DofID dof) const;
80 
84  void GetDofs(std::list<Dof*>* dofListPtr);
85 
87  DofID GetDofID(const Dof* dofPtr) const;
88 
90  void SetAtRest();
91 
96  bool MoveDof(DofID dof, float variance);
97 
99  bool HasDof(DofID dof);
100 
102  virtual TypeID GetID() { return JOINT; }
103 
105  virtual void XmlPrintOn(std::ostream& os, unsigned int indent) const;
106 
107  #ifdef VISUAL_JOINTS
108  virtual bool DrawOGL() const;
109  #endif
110 
111  protected:
112  // PROTECTED METHODS
113  #ifdef VISUAL_JOINTS
114  static const Material& GetMaterial(int num);
116  #endif
117  // PROTECTED ATTRIBUTES
118  std::list<Dof*> dofList;
119  }; // end class declaration
120  std::ostream& operator<<(std::ostream& output, const Joint::DofID& dofId);
121  std::istream& operator>>(std::istream& input, Joint::DofID& dofId);
122 } // end namespace
123 #endif
const Joint & operator=(const Joint &j)
Definition: joint.cpp:62
std::istream & operator>>(std::istream &input, Joint::DofID &dofId)
Base class for objects that compose a scene graph.
Definition: scenenode.h:25
Representation of joints.
Definition: joint.h:34
Header file for V-ART class "Material".
Points and vectors using homogeneous coordinates.
Definition: point4d.h:22
std::list< Dof * > dofList
Definition: joint.h:118
std::ostream & operator<<(std::ostream &output, const Joint::DofID &dofId)
bool HasDof(DofID dof)
Checks whether a DOF exists in the joint.
Definition: joint.cpp:167
unsigned short int GetNumDofs() const
Definition: joint.h:51
Geometric transformations.
Definition: transform.h:24
void MakeLim()
Updates the LIM, based on DOFs' situation.
Definition: joint.cpp:83
bool MoveDof(DofID dof, float variance)
Moves a joint's DOF.
Definition: joint.cpp:148
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 "Transform".
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
Material properties for graphical objects.
Definition: material.h:16
virtual bool DrawOGL() const
Apply transform to rendering engine.
Definition: transform.cpp:260
void SetAtRest()
Put the joint in a rest position.
Definition: joint.cpp:141
virtual VART::SceneNode * Copy()
Returns a copy of a Joint. Every derived class must reimplement this method, to avoid errors with VAR...
Definition: joint.cpp:28
void GetDofs(std::list< Dof * > *dofListPtr)
Returns all DOFs.
Definition: joint.cpp:113
Joint()
Creates an uninitialized joint.
Definition: joint.cpp:19
virtual ~Joint()
Definition: joint.cpp:51
DofID GetDofID(const Dof *dofPtr) const
Returns the DofID of some member Dof.
Definition: joint.cpp:127
virtual TypeID GetID()
Returns type identification of the node.
Definition: joint.h:102
const Dof & GetDof(DofID dof) const
Returns a joint's DOF.
Definition: joint.cpp:100
Degree Of Freedom - basic component of a Joint.
Definition: dof.h:28
virtual void XmlPrintOn(std::ostream &os, unsigned int indent) const
Outputs XML representation of the scene.
Definition: joint.cpp:218