00001 /*************************************************************************** 00002 SimLeg.h - description 00003 ------------------- 00004 begin : mer jun 25 2003 00005 copyright : (C) 2003 by Yann Le Guyadec, Michel DUBOIS 00006 email : Yann.Le-Guyadec@univ-ubs.fr, Michel.Dubois@univ-ubs.fr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef SIMLEG_H 00019 #define SIMLEG_H 00020 00021 #include "RigidBody.h" 00022 #include "RigidBodyEntity.h" 00023 #include "SimServoMotor.h" 00024 #include "Matrix22.h" 00025 #include "Vector2.h" 00026 #include "Vector3.h" 00027 #include "SphereGeometry.h" 00028 #include "RigidBodyCollider.h" 00029 #include "CylinderGeometry.h" 00030 #include "SimAtom.h" 00031 //#include "RayGeometry.h" 00032 #include "SimLinkedLeg.h" 00033 00038 class SimAtom; 00039 class SimLinkedLeg; 00040 00041 class SimLeg : public RigidBodyEntity { 00042 friend class SimLink; 00043 #ifdef LEGLINK 00044 friend class SimLinkedLeg; 00045 #endif 00046 friend class SimServoMotor; 00047 00048 protected: 00049 int ID; 00050 SimAtom * simatom; 00051 SimRigidBody * sphere; 00052 SphereGeometry * sphereGeometry; 00053 RigidBodyCollider * sphereCollider; 00054 SimRigidBody * body; 00055 CylinderGeometry * bodyGeometry; 00056 RigidBodyCollider * bodyCollider; 00057 SimServoMotor * servo[2]; 00058 #ifdef LEGLINK 00059 SimLinkedLeg * linkedLeg; 00060 #endif 00061 #ifndef LEGLINK 00062 SimLink * slink; 00063 #endif 00064 00065 public: 00066 SimLeg(SimAtom * atom, int aLegID); 00067 ~SimLeg(); 00068 void handleEvent (Event * event); 00069 unsigned int getSimServoMotorCount() const; 00070 SimServoMotor * getSimServoMotor(unsigned int aSimServoMotorID) const; 00071 Vector3 getVector() const; 00072 Vector3 getAbsPosSphere() const; 00073 Vector3 getAbsPosBody() const; 00074 Vector3 getAbsPosEnd() const; 00075 Vector3 getAbsPosConnexionDevice(unsigned int device) const; 00076 bool isConnectable(SimLeg * aSimLeg) const; 00077 Vector3 getAxis(unsigned int index) const; 00078 Real getRotationAngle() const; 00079 Vector3 getColor() const; 00080 void link(SimLeg * aSimLeg); 00081 void unlink(); 00082 bool isLinked(); 00083 virtual void print(); 00084 00085 }; 00086 00087 #endif