00001 #ifndef SIGEL_ROBOT_SIG_LINK_H 00002 #define SIGEL_ROBOT_SIG_LINK_H 00003 00004 namespace SIGEL_Robot { class SIG_Link; } 00005 00006 #include <qstring.h> 00007 #include <qlist.h> 00008 #include <qtextstream.h> 00009 #include <pointvector.h> 00010 #include "SIGEL_Robot/SIG_Robot.h" 00011 #include "SIGEL_Robot/SIG_Material.h" 00012 #include "SIGEL_Robot/SIG_Body.h" 00013 #include "SIGEL_Robot/SIG_Joint.h" 00014 #include "SIGEL_Robot/SIG_Geometry.h" 00015 #include "SIGEL_Robot/SIG_Mirtich.h" 00016 00017 namespace SIGEL_Robot 00018 { 00019 00029 class SIG_Link 00030 { 00031 public: 00032 SIG_Link (SIG_Robot *par, QString n, int nr); 00033 SIG_Link (SIG_Robot *par, QTextStream & tx); 00034 ~SIG_Link (void); 00035 00036 QString getName (void) const; 00037 int getNumber (void) const; 00038 bool isRootLink (void) const; 00039 00040 void setBody (SIG_Body *b); 00041 SIG_Body const *getBody (void) const; 00042 void setMaterial (SIG_Material *mtrl); 00043 SIG_Material const *getMaterial (void) const; 00044 void addPoint (QString pointname, DL_vector point); 00045 DL_vector getPoint (QString id) const; 00046 bool hasPoint (QString pointname) const; 00047 QDictIterator<DL_vector> getPointIter (void) const; 00048 int getNrOfPoints (void) const; 00049 00050 void instantiateGeometry (void); 00051 void transformToDynaMo (void); 00052 void transformToDynaMechs ( SIG_Joint *predecessor, 00053 DL_vector predBase = DL_vector(0, 0, 0), 00054 DL_vector predDir = DL_vector(0, 0, 0), 00055 DL_vector predHand = DL_vector(0, 0, 0) ); 00056 void transformPoints (DL_vector mov, DL_matrix rot); 00065 void addNoCollide (SIG_Link *link, bool negotiate = true); 00066 QList<SIG_Link> getNoCollides () const; 00067 void addJoint (SIG_Joint *joint); 00068 QList<SIG_Joint> getJoints () const; 00069 00070 SIG_Geometry const *getGeometry (void) const; 00071 void getPhysics (DL_Scalar & m, 00072 DL_vector & com, 00073 DL_matrix & it); 00074 void propagateInitialLocation (SIG_Link *comingfrom); 00075 void setInitialLocation (DL_vector p, DL_matrix o, SIG_Link *comingfrom = 0); 00076 void getInitialLocation (DL_vector & p, DL_matrix & o) const; 00077 bool isInitiated (void) const; 00078 bool isMDHVisited (void) const; 00079 void calculateCommonNormal( DL_vector a, 00080 DL_vector u, 00081 DL_vector b, 00082 DL_vector v, 00083 DL_vector &c, 00084 DL_vector &w ); 00085 00086 void writeToFileTransfer (QTextStream & tx) const; 00087 00088 private: 00089 SIG_Robot *parent; 00090 QString name; 00091 int number; 00092 SIG_Body *body; 00093 SIG_Geometry *geometry; 00094 SIG_Mirtich *mirtich; 00095 SIG_Material *material; 00096 QDict<DL_vector> points; 00097 QList<SIG_Joint> adjacentJoints; 00098 QList<SIG_Link> noCollide; 00099 DL_vector initialLocation; 00100 DL_matrix initialOrientation; 00101 bool initiated, mdh_visited; 00102 }; 00103 } 00104 00105 #endif // SIGEL_ROBOT_SIG_LINK_H 00106 00107