联合旋转成角度? C ++ [英] joint rotations into angles? C++

查看:62
本文介绍了联合旋转成角度? C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道怎样才能将关节旋转计算出来 在欧拉角中。

i am woundering how it is possible to calcullate the joint rotation  in euler angles.

sdk提供了层数和绝对格式的联合旋转,但我希望以角度进行关节旋转。

the sdk provides the joint rotations in hirarchial and absolute format but i would like to have the joint rotations in angle degrees.

是否有一个简单的appproach如何在c ++中完成?

is there a simple appproach how to do it in c++?

获取雇佣旋转数据的代码:

the code to get the hirerchial rotation data:

void getVector(const Vector4& v )

{     

    

     r [0] [2] = v.z;

     r [0] [0] = v.x;

     r [0] [1] = v.y;

   

}

void getVector(const Vector4& v)
{     
    
    r[0][2]=v.z;
    r[0][0]=v.x;
    r[0][1]=v.y;
   
}

void getMatrix(const Matrix4& m)

{

    ; xy = m.M21;

     xx = m.M11;

     xz = m.M31;

     yz = m.M32;

     zz = m.M33;

   

}

void getMatrix(const Matrix4& m)
{
    xy=m.M21;
    xx=m.M11;
    xz=m.M31;
    yz=m.M32;
    zz=m.M33;
   
}

getVector(leftUpperArm.hierarchicalRotation.rotationQuaternion);

getVector(leftUpperArm.hierarchicalRotation.rotationQuaternion);

getMatrix(leftUpperArm.hierarchicalRotation.rotationMatrix);

getMatrix(leftUpperArm.hierarchicalRotation.rotationMatrix);

如果存在simlpe方式,有人可以给我一个c ++代码如何计算这些数据的角度。

would be great someone could give me a code in c++ how to calculate the angles out of this data, if there a simlpe way is existing.

非常感谢所有人尝试

推荐答案

以下是我从熟悉该主题的同事那里得到的答案:

Here's an answer I got from a co-worker familiar with the subject:

虽然在概念上更容易理解,但由于万向节锁定/奇点问题,不建议将Euler角度用于一般用途。

查找Matrix-> Euler或Quaternion-> Euler转换(例如以下链接),然后对结果执行弧度到度转换。

http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm

了解还有许多不同的欧拉角度排序,每个都是以不同的方式计算的。对于上述转换,请使用网站上定义的标准转换( http://www.euclideanspace.com/maths/标准/ index.htm的)。


这篇关于联合旋转成角度? C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆