[╯°□°]╯︵┻━┻
|
00001 #ifndef PRJ_OBJ_H 00002 #define PRJ_OBJ_H 00003 00004 #include "Vect.h" 00005 #include "Matrix.h" 00006 #include "Disp.h" 00007 #include "Rand.h" 00008 #include "CouldBeInseredToSystem.h" 00009 #include "Integrator.h" 00010 #include "String3d.h" 00011 00012 00013 using namespace std; 00014 00015 class Obj: virtual public Disp, virtual public CouldBeInseredToSystem{ 00016 public: 00017 static Integrator* integ; 00018 bool forceTranslate; 00019 bool forceRotate; 00020 bool collision; 00021 bool showPath; 00022 protected: 00023 vector<Vect> path; 00024 void dispPath(); 00025 00026 Vect x; 00027 Vect dx;//dx/dt 00028 Vect f;//forces 00029 double m;//masse 00030 double temp;//temperature 00031 00032 Matrix i;//inertie 00033 Vect ang;//angle : axe de rotation, norme=angle 00034 Vect mcin;//moment cin 00035 Vect mf;//moment force 00036 00037 public: 00038 Vect getAcc(); 00039 virtual double getVolume() const; 00040 virtual double getR() const; 00041 Matrix rotateMatrix(bool const& inverse=false);//changement de repre, sans translation 00042 00043 Vect convertRefRel(Vect const& v); 00044 Vect convertRefAbs(Vect const& v); 00045 void enableTranslationForce(bool b=true); 00046 void enableRotationForce(bool b=true); 00047 00048 //proprits 00049 void setM(double const& newM); 00050 void setT(double const& newT); 00051 double getT() const; 00052 double getM() const; 00053 00054 //translations 00055 void addFWorldCoord(Vect const& df, Vect const& pos); 00056 void addFObjCoord(Vect const& df, Vect const& pos=Vect(3)); 00057 void setF(Vect const& f); 00058 void setX(Vect const& v); 00059 void setdx(Vect const& v); 00060 Vect getX() const; 00061 Vect getdx() const; 00062 Vect getdxAbs(Vect const& pos) ; 00063 Vect getF() const; 00064 //rotations 00065 void addM(Vect const& df, Vect const& dfPos);//moment de force 00066 Vect getAng() const; 00067 Vect getVitAng() ; 00068 Vect getMCin() const; 00069 Vect getMf() const; 00070 void addMf(Vect const& m); 00071 void setAng(Vect const& v); 00072 void setMCin(Vect const& v); 00073 void setMf(Vect const& v); 00074 00075 //collision 00076 virtual Vect supportPoint (Vect const& direction); 00077 00078 //update 00079 virtual void init(); 00080 virtual void update(); 00081 00082 //affichage 00083 virtual ostream& cdisp(ostream& out); 00084 virtual void disp(vector<bool> options); 00085 //CONSTR--- 00086 Obj(Vect const& x,double const& mass, Vect const& dx=Vect(3), Vect const& ang=Vect(3), Vect const& mcin=Vect(3)); 00087 virtual ~Obj(){} 00088 }; 00089 00090 #endif //PRJ_OBJ_H