Maintaining rotation during Quaternion normalization

I've been studying Quaternions for an upcoming project and have come across a conceptual problem that I can't wrap my head around.

The way to normalize a quaternion is as follows:

q_mag = sqrt(q0^2+q1^2+q2^2+q3^2)
q0 = q0/q_mag  
q1 = q1/q_mag   
q2 = q2/q_mag  
q3 = q3/q_mag

Straight forward and just like normalizing any other vector. But my question is how does this normalization method retain the same rotation information. Using the definition of a quaternion representing an axis-angle representation like below,

angle = 2 * acos(q0)
x = qx / sqrt(1-q0*q0)
y = qy / sqrt(1-q0*q0)
z = qz / sqrt(1-q0*q0)

Since the normalization operation scales the x,y,z values equally, the axis around which you are rotating never changes. But the value of the angle itself changes drasticly with a normalization operation.

So wouldn't it make more sense to use a method that preserves the value of q0 and only adjusts the other points to reach normalization?


Math answer: A unit quaternion represents a rotation in 3D space. Any other (ie: non-unit) quaternion does not represent a rotation, so the formula angle = 2 * acos(q0) does not apply to these quaternions. So there is no change of angle when normalising, because the quaternions that you would normalise do not represent rotations in the first place.

Programming answer: Floating point operations have accuracy issues. These issues result in small errors, which if accumulated may become large errors. When multiplying two unit quaternions, the mathematical result is another unit quaternion. However the floating point implementation of unit quaternions multiplication may result in a quaternion with a norm close to 1 but not equal 1. In this case we shall normalise the quaternion to correct the error. When we normalise we divide q0 by the norm which is very close to 1, so there is no major change in the value of q0. Because we normalise early the norm is always very close to 1 and we don't need to worry about the precision.

Late answer, but I hope it help.

链接地址: http://www.djcxy.com/p/81764.html

上一篇: 问题与自由飞行相机和四元数旋转的组合

下一篇: 四元数正态化期间保持旋转