00001 00002 00003 00004 00005 // ChangeLog is at the implementation file 00006 00007 #ifndef __VPDOF_H 00008 #define __VPDOF_H 00009 00010 #ifndef __VPJOINT_H 00011 class VPJoint; 00012 #endif 00013 00014 #ifndef __VPMODIFIER_H 00015 class VPModifier; 00016 #endif 00017 00018 #include "vppoint4d.h" 00019 #include "vptransform.h" 00020 #include "vpbezier.h" 00021 #include "vpmemoryobj.h" 00022 #include <string> 00023 00033 class VPDof : public VPMemoryObj { 00034 public: 00035 VPDof(); 00036 VPDof(const VPDof& dof); 00037 VPDof(const VPPoint4D& vec, const VPPoint4D& pos, float min, float max); 00038 VPDof& operator=(const VPDof& dof); 00039 void SetDescription(const std::string& desc); 00040 const std::string& GetDescription() { return description; } 00041 VPPoint4D GetAxis(); 00042 VPPoint4D GetOrigin(); 00043 VPBezier* GetEvoluta() { return evoluta; } 00044 void GetLim(VPTransform* ptrResult); 00045 VPTransform GetLim(); 00046 float GetMin(); 00047 float GetMax(); 00048 float GetCurrentMin(); 00049 float GetCurrentMax(); 00050 float GetRest(); 00051 VPJoint* GetOwnerJoint(); 00052 void SetEvoluta( VPBezier *evol ); 00053 void SetLim(const VPTransform& t); 00054 void SetAxis( VPVector3D v ); 00055 void SetMin( float min ); 00056 void SetMax( float max ); 00057 void SetOwnerJoint( VPJoint *ow ); 00064 void MoveTo( float pos ); 00065 00067 float GetCurrent(); 00068 00070 00074 void Move(float variance) { MoveTo(currentPosition+variance); } 00075 00077 00082 void Transform(const VPTransform& t); 00083 00084 void SetRest( float rest ); 00085 00087 00094 void Set(const VPPoint4D& vec, const VPPoint4D& pos, float min, float max); 00095 00096 void Rest(); 00097 void SetRangeModifier( VPModifier *m ); 00098 VPModifier* GetRangeModifier(); 00099 00101 00108 void ApplyTransformTo(VPTransform* ptrTrans) const; 00109 00110 protected: 00111 void setAxis(VPVector3D ax); 00112 void ComputeLIM(); 00113 private: 00114 std::string description;// Name of the Dof; often related to the dof's type of motion 00115 VPPoint4D position; // Position of the dof related to the parent reference system 00116 VPPoint4D axis; // Arbitrary axis of rotation 00117 VPBezier* evoluta; // 3D path related to the axis position along its rotation 00118 VPTransform lim; // Local Instance Matrix 00119 float minAngle; // Min base angle in rad. 00120 float maxAngle; // Max base angle in rad. 00121 float currentMinAngle; // Min angle in rad currently valid. 00122 float currentMaxAngle; // Max angle in rad currently valid. 00123 float confortMinAngle; // Min angle in rad for comfortable position. 00124 float confortMaxAngle; // Max angle in rad for comfortable position. 00125 VPModifier* rangeModifier; // Entity used to change the motion range along motion. 00126 float currentPosition; //A real number from 0 to 1 00127 float restPosition; //Another real number from 0 to 1 00128 VPJoint* ownerJoint; //Reference to the joint where this dof is set up 00129 }; 00130 00131 #endif