给定一组欧拉角,(俯仰、偏航、滚转)如何找到描述相同 3D 方向的替代集? [英] Given a set of Euler Angles, (Pitch, Yaw, Roll) how to find alternate set that describes same 3D orientation?

查看:21
本文介绍了给定一组欧拉角,(俯仰、偏航、滚转)如何找到描述相同 3D 方向的替代集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很好的欧拉四元数方程,它有时会返回一组非直观的角度.

I have a nice quaternion to euler equation that is sometimes returning a non-intuitive set of angles.

例如:

  • 音高:129
  • 偏航:-85
  • 滚动:126

我想以编程方式找到交替旋转,使俯仰和滚转在 -90 到 90 之间.偏航可以是 0 到 360.

I would like to programatically find alternate rotations such that Pitch and Roll are between -90 and 90. Yaw can be 0 to 360.

俯仰被限制在 -90 到 +90 并且滚动被限制在 -180 到 +180.

Pitch is constrained to -90 to +90 and Roll is constrained to -180 to +180.

推荐答案

基本上,您希望防止方向超出极点.这样做很容易:

Basically, you want to prevent the orientation to go beyond the pole. It is very easy to do that:

首先,检查俯仰是否超出极点(即大于 90° 或小于 -90°).在这种情况下,请执行以下操作:

First, check if pitch is beyond the pole (i.e. greater than 90° or smaller than -90°). In that case, do the following:

add 180° to yaw
add 180° to roll
set new pitch to 180° - old pitch (or -180° - old pitch in the case of south pole)

这基本上就是全部.您还可以按如下方式调整新角度:

This is basically all. You can also adapt the new angles as follows:

while(yaw < 0)
    yaw += 360
while(yaw > 360)
    yaw -= 360
while(roll < -180)
    roll += 360
while(roll > 180)
    roll -= 360

这篇关于给定一组欧拉角,(俯仰、偏航、滚转)如何找到描述相同 3D 方向的替代集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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