Cylinder.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_CYLINDER_H
00028 #define SOFA_HELPER_GL_CYLINDER_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 Cylinder
00050 {
00051 public:
00052
00053 Cylinder(SReal len=(SReal)1);
00054 Cylinder(const Vector3& len);
00055 Cylinder(const Vector3& center, const Quaternion &orient, const Vector3& length);
00056 Cylinder(const Vector3& center, const double orient[4][4], const Vector3& length);
00057 Cylinder(const double *mat, const Vector3& length);
00058 Cylinder(const Vector3& center, const Quaternion &orient, SReal length=(SReal)1);
00059 Cylinder(const Vector3& center, const double orient[4][4], SReal length=(SReal)1);
00060 Cylinder(const double *mat, SReal length=(SReal)1.0);
00061
00062 ~Cylinder();
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 private:
00078
00079 Vector3 length;
00080 double matTransOpenGL[16];
00081
00082 GLUquadricObj *quadratic;
00083 GLuint displayList;
00084
00085 void initDraw();
00086
00087 static std::map < std::pair<std::pair<float,float>,float>, Cylinder* > CylinderMap;
00088 static Cylinder* get(const Vector3& len);
00089
00090 };
00091
00092 }
00093
00094 }
00095
00096 }
00097
00098 #endif