Go to the documentation of this file.00001 #ifndef OPENTISSUE_UTILITY_GL_GL_DRAW_FRAME_H
00002 #define OPENTISSUE_UTILITY_GL_GL_DRAW_FRAME_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/utility/gl/gl.h>
00013
00014 #include <OpenTissue/utility/gl/gl_color_picker.h>
00015 #include <OpenTissue/utility/gl/gl_draw_point.h>
00016 #include <OpenTissue/utility/gl/gl_draw_vector.h>
00017
00018 #include <OpenTissue/core/math/math_vector3.h>
00019 #include <OpenTissue/core/math/math_matrix3x3.h>
00020 #include <OpenTissue/core/math/math_quaternion.h>
00021 #include <OpenTissue/core/math/math_coordsys.h>
00022
00023 namespace OpenTissue
00024 {
00025
00026 namespace gl
00027 {
00028
00035 template <typename T>
00036 inline void DrawFrame( math::Vector3<T> const & p, math::Quaternion<T> const & Q )
00037 {
00038 typedef T real_type;
00039 math::Matrix3x3<real_type> R(Q);
00040 math::Vector3<real_type> axis1( R( 0, 0 ), R( 1, 0 ), R( 2, 0 ) );
00041 math::Vector3<real_type> axis2( R( 0, 1 ), R( 1, 1 ), R( 2, 1 ) );
00042 math::Vector3<real_type> axis3( R( 0, 2 ), R( 1, 2 ), R( 2, 2 ) );
00043 ColorPicker( 1.0, 0.0, 0.0 );
00044 DrawVector( p, axis1 );
00045 ColorPicker ( 0.0, 1.0, 0.0 );
00046 DrawVector( p, axis2 );
00047 ColorPicker( 0.0, 0.0, 1.0 );
00048 DrawVector( p, axis3 );
00049 GLUquadric * qobj = gluNewQuadric();
00050 glPushMatrix();
00051 glTranslatef( p(0), p(1), p(2) );
00052 GLint slices = 12;
00053 GLint stacks = 12;
00054 GLdouble radius = 0.1;
00055 ColorPicker( .7, .7, .7 );
00056 gluSphere( qobj, radius, slices, stacks );
00057 glPopMatrix();
00058 gluDeleteQuadric( qobj );
00059 }
00060
00061 template <typename V>
00062 inline void DrawFrame( math::CoordSys<V> const & C)
00063 {
00064 DrawFrame(C.T(),C.Q());
00065 }
00066
00067 }
00068
00069 }
00070
00071
00072 #endif