Go to the documentation of this file.00001 #ifndef OPENTISSUE_UTILITY_GL_GL_DRAW_BONE_PATH_H
00002 #define OPENTISSUE_UTILITY_GL_GL_DRAW_BONE_PATH_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/utility/gl/gl_util.h>
00013 #include <OpenTissue/core/math/math_constants.h>
00014
00015 #include <cassert>
00016
00017 namespace OpenTissue
00018 {
00019 namespace gl
00020 {
00021
00030 template<typename bone_type ,typename transform_container>
00031 inline void DrawBonePath(bone_type const & bone , transform_container const & poses, double const radius = 0.02)
00032 {
00033 typedef typename bone_type::vector3_type V;
00034
00035 V const draw_zone = bone.relative().T();
00036
00037 glPushMatrix();
00038 if(!bone.is_root())
00039 {
00040 Transform(bone.parent()->absolute());
00041 }
00042 Transform(bone.relative().T());
00043
00044 typename transform_container::const_iterator pose = poses.begin();
00045 typename transform_container::const_iterator end = poses.end();
00046
00047 size_t const N = std::distance(pose,end);
00048
00049 float const intensity_increment = 1.0f / N;
00050 float intensity = 0.0f;
00051
00052 for(;pose!=end;++pose)
00053 {
00054 glPushMatrix();
00055 Transform(pose->Q());
00056 ColorPicker(intensity*0.5f, intensity, 1.0f);
00057 DrawPoint(draw_zone,radius);
00058 glPopMatrix();
00059 intensity += intensity_increment;
00060 }
00061 glPopMatrix();
00062 }
00063
00064 }
00065
00066 }
00067
00068
00069 #endif