[英]Given a set of Euler Angles, (Pitch, Yaw, Roll) how to find alternate set that describes same 3D orientation?
I have a nice quaternion to euler equation that is sometimes returning a non-intuitive set of angles. 我对欧拉方程有一个很好的四元数,有时会返回一组非直觉的角度。
For example: 例如:
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之间。偏航角可以为0至360。
[EDIT] Pitch is constrained to -90 to +90 and Roll is constrained to -180 to +180. [编辑]音高限制为-90至+90,侧倾限制为-180至+180。
Basically, you want to prevent the orientation to go beyond the pole. 基本上,您想防止方向超出极点。 It is very easy to do that:
这很容易做到:
First, check if pitch is beyond the pole (ie greater than 90° or smaller than -90°). 首先,检查螺距是否超过极点(即大于90°或小于-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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.