是否有转换四元数旋转到欧拉角旋转算法? [英] Is there an algorithm for converting quaternion rotations to Euler angle rotations?

查看:299
本文介绍了是否有转换四元数旋转到欧拉角旋转算法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个旋转的四元数再presentation转换为欧拉角再presentation现有的算法?为欧拉旋转次序重新presentation是已知的,可以是任何的六个置换(即XYZ,XZY,YXZ,YZX,ZXY,ZYX)。我见过一个固定的旋转顺序(通常是NASA标题,银行,滚惯例),但不是任意的旋转顺序算法。

Is there an existing algorithm for converting a quaternion representation of a rotation to an Euler angle representation? The rotation order for the Euler representation is known and can be any of the six permutations (i.e. xyz, xzy, yxz, yzx, zxy, zyx). I've seen algorithms for a fixed rotation order (usually the NASA heading, bank, roll convention) but not for arbitrary rotation order.

此外,因为有一个单一方向的多个欧拉角再presentations,这样的结果将是不明确的。这是可以接受的(因为取向仍<青霉>有效的,它只是可能不是一个用户期望看到),然而这将是更好的,如果有一个算法历时旋转限制(即的自由度,而且数量上的每个自由度的限制)考虑在内,得到最明智欧拉重新$ p $给出的约束psentation。

Furthermore, because there are multiple Euler angle representations of a single orientation, this result is going to be ambiguous. This is acceptable (because the orientation is still valid, it just may not be the one the user is expecting to see), however it would be even better if there was an algorithm which took rotation limits (i.e. the number of degrees of freedom and the limits on each degree of freedom) into account and yielded the 'most sensible' Euler representation given those constraints.

我有一种感觉,这个问题(或者类似的东西)在IK或刚体动力学领域可能存在。

I have a feeling this problem (or something similar) may exist in the IK or rigid body dynamics domains.

解决:我刚刚意识到它可能不是很清楚,我按照从图形宝石肯Shoemake的算法,解决了这个问题。我没有回答我的问题的时候,但它发生,我可能不是很清楚,我这样做了。一看便知,下面,了解更多详情。

Solved: I just realised that it might not be clear that I solved this problem by following Ken Shoemake's algorithms from Graphics Gems. I did answer my own question at the time, but it occurs to me it may not be clear that I did so. See the answer, below, for more detail.

只是为了澄清 - 我知道如何从四元数转换成所谓的大吉,布莱恩 再presentation - 我在调用NASA约定。这是一个旋转顺序(假设'Z'轴是向上的约定)ZXY的。我需要一个算法的所有的旋转订单。

Just to clarify - I know how to convert from a quaternion to the so-called 'Tait-Bryan' representation - what I was calling the 'NASA' convention. This is a rotation order (assuming the convention that the 'Z' axis is up) of zxy. I need an algorithm for all rotation orders.

可能的解决方案,那么,就是要把ZXY订单转化和衍生出其他五个转换为其他旋转订单。我猜我希望有更多的'首要的解决方案。在任何情况下,我很惊讶,我一直没能找到现有的解决方案在那里。

Possibly the solution, then, is to take the zxy order conversion and derive from it five other conversions for the other rotation orders. I guess I was hoping there was a more 'overarching' solution. In any case, I am surprised that I haven't been able to find existing solutions out there.

此外,这也许应该是一个单独的问题干脆,任何转换(假设一个已知的旋转顺序,当然)将要选择的有一个的欧拉重新presentation,但也有其实很多。例如,给定YXZ的旋转顺序,二重presentations(0,0,180)和(180,180,0)的当量(并会产生相同的四元数)。有没有办法来限制使用的自由度限制的解决方案?就像你在IK和刚体动力学吗?即,在上面的例子中,如果有仅一个然后围绕Z轴自由度的第二次再$​​ P $ psentation可以忽略。

In addition, and this perhaps should be a separate question altogether, any conversion (assuming a known rotation order, of course) is going to select one Euler representation, but there are in fact many. For example, given a rotation order of yxz, the two representations (0,0,180) and (180,180,0) are equivalent (and would yield the same quaternion). Is there a way to constrain the solution using limits on the degrees of freedom? Like you do in IK and rigid body dynamics? i.e. in the example above if there were only one degree of freedom about the Z axis then the second representation can be disregarded.

我已经找到了一份文件可能是在<一个算法href=\"http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/Quaternions.pdf\">this PDF 但我必须承认,我发现逻辑和数学有点难以跟随。当然还有其他的解决办法了吗?是任意的旋转顺序真的如此罕见?当然,每一个主要的3D封装,一起让骨骼动画与四元数插值(也就是玛雅,马克斯,搅拌机等)必须准确地解决了这个问题?

I have tracked down one paper which could be an algorithm in this pdf but I must confess I find the logic and math a little hard to follow. Surely there are other solutions out there? Is arbitrary rotation order really so rare? Surely every major 3D package that allows skeletal animation together with quaternion interpolation (i.e. Maya, Max, Blender, etc) must have solved exactly this problem?

推荐答案

这看起来像旧技术的一个经典案例被忽视 - 我设法从车库挖掘出显卡宝石IV的副本,它看起来像肯Shoemake有不仅从欧拉转换算法角的任意的轮换顺序,但还回答了我大部分关于这个问题的其他问题。万岁书籍。如果我可以投票了Shoemake先生的答案,并奖励他的信誉分。

This looks like a classic case of old technology being overlooked - I managed to dig out a copy of Graphics Gems IV from the garage and it looks like Ken Shoemake has not only an algorithm for converting from Euler angles of arbitrary rotation order, but also answers most of my other questions on the subject. Hooray for books. If only I could vote up Mr. Shoemake's answer and reward him with reputation points.

我想建议,任何人都与欧拉角工作应该从当地的图书馆获取图形宝石IV的副本,并仔细阅读章节起始页222将不得不这样做。它必须是我看过没有问题的最清晰,最简明的解释。

I guess a recommendation that anybody working with Euler angles should get a copy of Graphics Gems IV from their local library and read the section starting page 222 will have to do. It has to be the clearest and most concise explanation of the problem I have read yet.

下面是因为我已经找到一个有用的链接 - http://www.cgafaq.info/wiki/Euler_angles_from_matrix - 在此之前,在同一系统Shoemake;旋转顺序的24种不同的排列是连接codeD四个独立的参数 - 内轴,奇偶校验,重复和框架 - 然后允许你从24情况下能将算法2.可以在一般的一个有用的维基 - 我之前还没有遇到过。

Here's a useful link I have found since - http://www.cgafaq.info/wiki/Euler_angles_from_matrix - This follows the same system as Shoemake; the 24 different permutations of rotation order are encoded as four separate parameters - inner axis, parity, repetition and frame - which then allows you to reduce the algorithm from 24 cases to 2. Could be a useful wiki in general - I hadn't come across it before.

要提供旧的链接似乎被这里打破是计算欧拉另一个副本从一个​​旋转矩阵的角度

To old link provided seems to be broken here is another copy of "Computing Euler angles from a rotation matrix ".

这篇关于是否有转换四元数旋转到欧拉角旋转算法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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