Go to the documentation of this file.00001 #ifndef OPENTISSUE_KINEMATICS_INVERSE_INVERSE_GET_JOINT_PARAMETERS_H
00002 #define OPENTISSUE_KINEMATICS_INVERSE_INVERSE_GET_JOINT_PARAMETERS_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/core/math/big/big_types.h>
00013
00014 namespace OpenTissue
00015 {
00016 namespace kinematics
00017 {
00018 namespace inverse
00019 {
00020
00030 template< typename skeleton_type>
00031 inline void get_joint_parameters(
00032 skeleton_type const & skeleton
00033 , ublas::vector<typename skeleton_type::bone_traits::real_type> & theta
00034 )
00035 {
00036 using ublas::subrange;
00037
00038 typedef typename skeleton_type::bone_traits bone_traits;
00039 typedef typename bone_traits::real_type real_type;
00040 typedef ublas::vector<real_type> vector_type;
00041 typedef ublas::vector_range<vector_type> vector_range;
00042
00043
00044 size_t dofs = 0u;
00045
00046 typename skeleton_type::const_bone_iterator bone = skeleton.begin();
00047 typename skeleton_type::const_bone_iterator end = skeleton.end();
00048
00049 for(;bone!=end;++bone)
00050 dofs += bone->active_dofs();
00051
00052
00053 if(theta.size() != dofs )
00054 theta.resize( dofs );
00055
00056
00057 size_t i = 0u;
00058 size_t dof = 0u;
00059
00060 bone = skeleton.begin();
00061 for(;bone!=end;++bone)
00062 {
00063 dof = bone->active_dofs();
00064
00065 vector_range sub_theta = subrange(theta,i,i+dof);
00066
00067 bone_traits::get_theta( *bone , sub_theta);
00068
00069 i += dof;
00070 }
00071 }
00072
00073
00074 }
00075 }
00076 }
00077
00078
00079 #endif