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

查看:167
本文介绍了给定一组欧拉角(俯仰,偏航,横滚),如何找到描述相同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,Roll限制在-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天全站免登陆