检索3欧拉角2的Vector3D [英] Retrieve 3 Euler angles from 2 Vector3D

查看:119
本文介绍了检索3欧拉角2的Vector3D的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何找回3欧拉角2的Vector3D?

How can i retrieve the 3 euler angles from 2 vector3D ?

感谢

CEDRE

dim vector1 = new Vector3D(0, 0, 1);

dim vector2 = new Vector3D(0.33, 0.45, 0.49);


dim myEuler = GetEulerFrom2Vector(vector1,vector2); // ?????

我工作在一个直角坐标系中,我使用ZYX欧拉约定

I work in a right angle coordinate system and i use the ZYX euler convention

推荐答案

我用一个旋转矩阵:

R11 R12 R13
R21 R22 R23
R31 R32 R33

与R = RZ Ry的接收

with R = Rz Ry Rx

if (R31 <> ±1)
    y1 = -sin-1(R31)
    y2 = pi + sin-1(R31)

    x1 = atan2 (R32/cos y1,R33/cos y1)
    x2 = atan2 (R32/cos y2,R33/cos y2)

    z1 = atan2( R21/cos y1,R11/cos y1)
    z2 = atan2( R21/cos y2,R11/cos y2)
        Else
    z= anything; can set to 0
    if (R31 = -1)
        y = -pi / 2
        x = z  + atan2(R12,R13)
     Else
         y = -pi / 2
         x  = -z + atan2(-R12,-R13)     
    End If
End If

<一个href="https://truesculpt.google$c$c.com/hg-history/38000e9dfece971460473d5788c235fbbe82f31b/Doc/rotation_matrix_to_euler.pdf" rel="nofollow">https://truesculpt.google$c$c.com/hg-history/38000e9dfece971460473d5788c235fbbe82f31b/Doc/rotation_matrix_to_euler.pdf

或一个简单的版本

    result.X = Math.Atan2(R32, R33) * (180.0 / Math.PI)
    result.Y = Math.Atan2(-1 * R31, Math.Sqrt(R32 * R32 + R33 * R33)) * (180.0 / Math.PI)
    result.Z = Math.Atan2(R21, R11) * (180.0 / Math.PI)

这篇关于检索3欧拉角2的Vector3D的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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