Axis.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef SOFA_HELPER_GL_AXIS_H
00028 #define SOFA_HELPER_GL_AXIS_H
00029
00030 #include <sofa/defaulttype/Vec.h>
00031 #include <sofa/defaulttype/Quat.h>
00032
00033 #include <sofa/helper/system/gl.h>
00034 #include <sofa/helper/system/glu.h>
00035
00036 #include <map>
00037
00038 namespace sofa
00039 {
00040
00041 namespace helper
00042 {
00043
00044 namespace gl
00045 {
00046
00047 using namespace sofa::defaulttype;
00048
00049 class Axis
00050 {
00051 public:
00052
00053 Axis(SReal len=(SReal)1);
00054 Axis(const Vector3& len);
00055 Axis(const Vector3& center, const Quaternion &orient, const Vector3& length);
00056 Axis(const Vector3& center, const double orient[4][4], const Vector3& length);
00057 Axis(const double *mat, const Vector3& length);
00058 Axis(const Vector3& center, const Quaternion &orient, SReal length=(SReal)1);
00059 Axis(const Vector3& center, const double orient[4][4], SReal length=(SReal)1);
00060 Axis(const double *mat, SReal length=(SReal)1.0);
00061
00062 ~Axis();
00063
00064 void update(const Vector3& center, const Quaternion& orient = Quaternion());
00065 void update(const Vector3& center, const double orient[4][4]);
00066 void update(const double *mat);
00067
00068 void draw();
00069
00070 static void draw(const Vector3& center, const Quaternion& orient, const Vector3& length);
00071 static void draw(const Vector3& center, const double orient[4][4], const Vector3& length);
00072 static void draw(const double *mat, const Vector3& length);
00073 static void draw(const Vector3& center, const Quaternion& orient, SReal length=(SReal)1);
00074 static void draw(const Vector3& center, const double orient[4][4], SReal length=(SReal)1);
00075 static void draw(const double *mat, SReal length=(SReal)1.0);
00076
00077
00078 static void draw(const Vector3& center, const Vector3& ext, const double& radius);
00079
00080 static void draw(const Vector3& center, const Vector3& ext, const double& r1, const double& r2);
00081 private:
00082
00083 Vector3 length;
00084 double matTransOpenGL[16];
00085
00086 GLUquadricObj *quadratic;
00087 GLuint displayList;
00088
00089 void initDraw();
00090
00091 static std::map < std::pair<std::pair<float,float>,float>, Axis* > axisMap;
00092 static Axis* get(const Vector3& len);
00093
00094 };
00095
00096 }
00097
00098 }
00099
00100 }
00101
00102 #endif