00001 // rdForce.h 00002 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00003 // Copyright 2002 Realistic Dynamics, Inc. 00004 // All rights reserved. 00005 // 00006 // Please do not read, copy, distribute, or use without permission. 00007 // Contact: Frank C. Anderson, fca@RealisticDynamics.com 00008 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00009 #include "rdModel.h" 00010 #include "rdActuator.h" 00011 //============================================================================= 00012 #ifndef __rdForce_h__ 00013 #define __rdForce_h__ 00014 00015 00016 00017 00018 //============================================================================= 00019 //============================================================================= 00028 class RDSIMULATION_API rdForce : public rdActuator 00029 { 00030 00031 //============================================================================= 00032 // DATA 00033 //============================================================================= 00034 public: 00035 static const char PROP_BODYA[]; 00036 static const char PROP_POINTA[]; 00037 static const char PROP_DIRECTIONA[]; 00038 static const char PROP_BODYB[]; 00039 static const char PROP_POINTB[]; 00040 00041 protected: 00043 int _bA; 00046 double _pA[3]; 00049 double _uA[3]; 00051 int _bB; 00054 double _pB[3]; 00057 double _uB[3]; 00058 00059 //============================================================================= 00060 // METHODS 00061 //============================================================================= 00062 //-------------------------------------------------------------------------- 00063 // CONSTRUCTION 00064 //-------------------------------------------------------------------------- 00065 public: 00066 rdForce(int aBodyA=0,int aBodyB=0,int aNX=1,int aNY=0,int aNYP=0); 00067 rdForce(IDOM_Element *aElement,int aNX=1,int aNY=0,int aNYP=0); 00068 rdForce(const rdForce &aForce); 00069 virtual ~rdForce(); 00070 virtual rdActuator* copy() const; 00071 virtual rdActuator* copy(IDOM_Element *aElement) const; 00072 private: 00073 void setNull(); 00074 00075 //-------------------------------------------------------------------------- 00076 // OPERATORS 00077 //-------------------------------------------------------------------------- 00078 public: 00079 rdForce& operator=(const rdForce &aForce); 00080 00081 //-------------------------------------------------------------------------- 00082 // GET AND SET 00083 //-------------------------------------------------------------------------- 00084 public: 00085 // CONTROLS 00086 virtual void setControls(const double aX[]); 00087 virtual void getControls(double rX[]) const; 00088 // BODY A 00089 void setBodyA(int aID); 00090 int getBodyA() const; 00091 // POINT A 00092 void setPointA(const double aPoint[3]); 00093 void getPointA(double rPoint[3]) const; 00094 // DIRECTION A 00095 void setForceDirectionA(const double aDirection[3]); 00096 void getForceDirectionA(double rDirection[3]) const; 00097 // BODY B 00098 void setBodyB(int aID); 00099 int getBodyB() const; 00100 // POINT B 00101 void setPointB(const double aPoint[3]); 00102 void getPointB(double rPoint[3]) const; 00103 // DIRECTION B 00104 void getForceDirectionB(double rDirection[3]) const; 00105 00106 //-------------------------------------------------------------------------- 00107 // APPLICATION 00108 //-------------------------------------------------------------------------- 00109 virtual void apply(); 00110 00111 //-------------------------------------------------------------------------- 00112 // COMPUTATIONS 00113 //-------------------------------------------------------------------------- 00114 virtual void computeActuation(); 00115 void computeForceDirectionForBodyB(); 00116 void computeSpeed(); 00117 00118 //-------------------------------------------------------------------------- 00119 // CHECK 00120 //-------------------------------------------------------------------------- 00121 virtual bool check() const; 00122 00123 //-------------------------------------------------------------------------- 00124 // UTILITY 00125 //-------------------------------------------------------------------------- 00126 void computeLineOfAction(double aLineOfAction[3]) const; 00127 00128 //-------------------------------------------------------------------------- 00129 // XML 00130 //-------------------------------------------------------------------------- 00131 virtual void updateObject(bool aDeep=true); 00132 virtual void updateNode(bool aDeep=true); 00133 virtual void generateNode(IDOM_Element *aParent); 00134 void updateData(); 00135 00136 //============================================================================= 00137 }; // END of class rdForce 00138 //============================================================================= 00139 //============================================================================= 00140 00141 #endif // __rdForce_h__ 00142 00143
1.3