两个 3d 矢量之间的欧拉角 [英] Euler angles between two 3d vectors

查看:47
本文介绍了两个 3d 矢量之间的欧拉角的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何找到 2 个 3D 向量之间的 3 个欧拉角?当我有一个 Vector 并且想要获取它的旋转时,通常可以使用此链接:计算旋转以查看 3D 点?

但是在相互计算它们时我该怎么做?

How do you find the 3 euler angles between 2 3D vectors? When I have one Vector and I want to get its rotation, this link can be usually used: Calculate rotations to look at a 3D point?

But how do I do it when calculating them according to one another?

推荐答案

正如其他人已经指出的,您的问题应该修改.让我们称您的向量为 ab.我假设 length(a)==length(b) >0 否则我无法回答问题.

As others have already pointed out, your question should be revised. Let's call your vectors a and b. I assume that length(a)==length(b) > 0 otherwise I cannot answer the question.

计算向量的叉积v = axb;v 给出旋转的.通过计算点积,您可以得到角度的余弦strong> 你应该用 cos(angle)=dot(a,b)/(length(a)length(b)) 旋转,并且用 acos 你可以唯一确定角度(@Archie 感谢指出我之前的错误).此时,您拥有旋转的轴角表示.

Calculate the cross product of your vectors v = a x b; v gives the axis of rotation. By computing the dot product, you can get the cosine of the angle you should rotate with cos(angle)=dot(a,b)/(length(a)length(b)), and with acos you can uniquely determine the angle (@Archie thanks for pointing out my earlier mistake). At this point you have the axis angle representation of your rotation.

剩下的工作就是把这个表示转换成你要找的表示:欧拉角.将轴角转换为欧拉是一种方法它,正如你发现的那样.当 v = [ 0, 0, 0] 时,即角度为 0 或 180 度时,您必须处理退化情况.

The remaining work is to convert this representation to the representation you are looking for: Euler angles. Conversion Axis-Angle to Euler is a way to do it, as you have found it. You have to handle the degenerate case when v = [ 0, 0, 0], that is, when the angle is either 0 or 180 degrees.

我个人不喜欢欧拉角,它们会破坏应用程序的稳定性,并且不适合插值,另见

I personally don't like Euler angles, they screw up the stability of your app and they are not appropriate for interpolation, see also

在旋转矩阵之间进行插值

这篇关于两个 3d 矢量之间的欧拉角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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