Java代码从四元数获得围绕轴的旋转角度 [英] Java code to get rotation angle around an axis from quaternion

查看:817
本文介绍了Java代码从四元数获得围绕轴的旋转角度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的非常努力地找到正确的方法来从任意四元数获得单个轴周围的旋转角度。所以换句话说,我希望找到围绕指定轴(在我的情况下为坐标系的Z轴,但是任意的解决方案将会很好)的角度表达旋转的部分。任何人都可以指出实现这一目标吗?理想情况下,一些java片段会很好。



我尝试了 1 的态度,这是:

  asin (2 * qx * qy + 2 * qz * qw)

然而,在某些情况下,例如一个围绕Z轴的旋转超过0.6 * PI。

解决方案

答案可以在这里找到围绕轴四元数旋转的组件 http://www.euclideanspace.com/maths/geometry/rotations/for/decomposition/


I am really struggeling to find the correct way to get the rotation angle around a single axis from an arbitrary quaternion. So other words I want to find the portion of the expressed rotation around a specified axis (in my case the Z-axis of the coordinate system, but an arbitrary solution would be nice) in terms of the angle. Can anyone point out to achieve this? Ideally some java fragment would be nice.

I tried the solution proposed in 1 for attitude, which is:

asin(2*qx*qy + 2*qz*qw)

However, this fails in some cases, e.g. a single rotation around the Z-axis with more than 0.6 * PI.

解决方案

The answer can be found here Component of a quaternion rotation around an axis

"swing twist decomposition" from http://www.euclideanspace.com/maths/geometry/rotations/for/decomposition/

这篇关于Java代码从四元数获得围绕轴的旋转角度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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