开发者

Quaternions vs. Euler Angles

Hi

What is the pros and cons of "Quaternions" and "Euler Angles" Method

- Which one is faster?

- Which one need less Computational Effort?

- which one is more accurate, (in rou开发者_如何学Cnd off error)?


Euler angles are more human understandable and also good for decomposing rotations into individual degrees of freedom (for kinematic joints and the like) but have disadvantages like ambiguity and gimbal lock. In practice I would prefer quaternions, as they are easier to compute with (for the computer, not for humans) and more efficient. You have to make three rotations and multiply them together when rotating by Euler angles, whereas a Quaternion is only one rotation and as it already encodes the sin and cos, the conversion from quaternion to matrix is quite efficient.


Quaternions avoid Gimbal lock. More here.


Expanding a bit on a point from Christian Rau's answer:

There's an ambiguity in the specification of Euler angles: which angle applies to which axis? Code that uses the convention (yaw, pitch, roll) won't interoperate with code that assumes (roll, pitch, yaw), and it may not be obvious, from looking at the code, which interpretation is being used.

Quaternions don't suffer from this ambiguity, since they only represent a single rotation, with a well-defined axis.


Quaternions have many advantages over Euler angles, as pointed out in the other answers. However, Euler angles do have one advantage over Quaternions:

Euler angles can tell you the direction and magnitude of a rotation. When you convert a Euler angle to a Quaternion, that information is lost. For example, the Euler rotations of (-270°, 0, 0) and (1170°, 0, 0) produce the identical Quaternions (-0.7071, 0, 0, -0.7071).


Euler angles are better than quaternions. You should always store Euler angles in memory and use quaternions only for calculations. Nobody knows this but what I say is absolutely true. If you're lurking around, know that this is important. Hear me out.

The reason is because you can always easily derive a quaternion from a Euler angles. The conversion is trivial. However the conversion from quaternion to Euler angles is fundamentally broken. There are two possible Euler angles for every quaternion and you cannot know which of the two possibilities your quaternions came from.

For virtual worlds and 3D games you can always just use quaternions. This is because your computer can just draw a picture of the object at an orientation without actually yawing and pitching an actual physical gimbal to achieve that orientation. However for robots and other real world applications there is real information loss when converting to a quaternion.

If you have a real physical gimbal and you are given a quaternion that represents the orientation of that gimbal you absolutely cannot ever extract the original yaw, roll or pitch the gimbal used to achieve that orientation UNLESS the gimbal is restricted in it's range of motion somewhere.

Remember this. If you're in robotics or some mechanical setting save the orientation value as the original Euler angles. Only convert to quaternions temporarily only for a calculation.

There's basically no return trip back to Euler once you convert to quaternion. So don't make that trip permanent, store all your information as Euler angles.


Euler angles is faster.

Euler angles requires less computational effort.

Quaternions are absolutely more accurate.

There is a problem called Gimbal lock which was found in Euler angles. It happens when two axis align together. On the other hand quaternions are more flexible and solved this problem as it is more axis oriented. Yet, it is complicated to understand.

Well, to make it easy to understand Quaternions. Let's divide the four components to two: An angle and x,y,z point that is connected to the origin of the axis say P. The (x,y,z)-P line representing a new axis. The angle represents the angle between the axis and real orientation. To visualize this answer you need to check this 5-minutes video. https://eater.net/quaternions/video/intro

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜