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

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

问题描述

是否有将旋转的四元数表示转换为欧拉角表示的现有算法?欧拉表示的旋转顺序是已知的,可以是六种排列中的任何一种(即 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.

此外,由于单个方向有多个欧拉角表示,因此这个结果将是模棱两可的.这是可以接受的(因为方向仍然有效,它可能不是用户期望看到的方向),但是如果有一种算法可以接受旋转限制(即自由度的数量和每个自由度的限制),并在给定这些约束的情况下产生最合理"的欧拉表示.

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.

只是为了澄清 - 我知道如何从四元数转换为所谓的 'Tait-Bryan' 代表 - 我称之为美国宇航局"公约.这是 zxy 的旋转顺序(假设Z"轴向上的约定).我需要一个用于所有轮换订单的算法.

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.

此外,这也许应该是一个单独的问题,任何转换(当然,假设旋转顺序已知)都会选择一个欧拉表示,但实际上有很多.例如,给定 yxz 的旋转顺序,两个表示 (0,0,180) 和 (180,180,0) 是等效的(并且会产生相同的四元数).有没有办法使用自由度的限制来约束解决方案?就像你在 IK 和刚体动力学中所做的那样?即在上面的示例中,如果关于 Z 轴只有一个自由度,则可以忽略第二个表示.

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.

我在 this pdf 但我必须承认我发现逻辑和数学有点难以理解.当然还有其他解决方案吗?任意轮换顺序真的这么少见吗?当然,每个允许骨骼动画与四元数插值(即 Maya、Max、Blender 等)一起使用的主要 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?

推荐答案

这看起来像是一个被忽视的旧技术的经典案例 - 我设法找到了一份 Graphics Gems IV 来自车库,看起来 Ken 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.

我想建议任何使用欧拉角的人都应该从他们当地的图书馆获得一份 Graphics Gems 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 种不同排列被编码为四个单独的参数 - 内轴、奇偶校验、重复和帧 - 然后允许您将算法从 24 种情况减少到 2 种情况.通常可能是一个有用的 wiki - 我还没来之前穿过它.

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天全站免登陆