Go to the documentation of this file.00001 #ifndef OPENTISSUE_KINEMATICS_INVERSE_INVERSE_SET_JOINT_PARAMETERS_H
00002 #define OPENTISSUE_KINEMATICS_INVERSE_INVERSE_SET_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
00031 template<typename skeleton_type>
00032 void set_joint_parameters(
00033 skeleton_type & skeleton
00034 , ublas::vector<typename skeleton_type::bone_traits::real_type> const & theta
00035 )
00036 {
00037 using ublas::subrange;
00038
00039 typedef typename skeleton_type::bone_traits bone_traits;
00040 typedef typename bone_traits::real_type real_type;
00041 typedef ublas::vector<real_type> vector_type;
00042 typedef ublas::vector_range<const vector_type> const_vector_range;
00043
00044 size_t i = 0u;
00045 size_t dof = 0u;
00046
00047 typename skeleton_type::bone_iterator bone = skeleton.begin();
00048 typename skeleton_type::bone_iterator end = skeleton.end();
00049 for(;bone!=end;++bone)
00050 {
00051 dof = bone->active_dofs();
00052
00053 const_vector_range sub_theta = subrange(theta,i,(i+dof));
00054
00055 bone_traits::set_theta( *bone, sub_theta);
00056 i += dof;
00057 }
00058
00059 skeleton.compute_pose();
00060 }
00061
00062 }
00063 }
00064 }
00065
00066
00067 #endif