Contents

Different Approaches to 「Rotation」

对于euler angles,rotation matrices,quaternions的讨论

We know that there are different ways to represent “rotation”, and the different ways have their limitations.

Quaternions

Quaternions are usually notated as H (for Hamiltonian reasons).

From wikipedia, “Explicitly, quaternions are non-commutable extensions of complex numbers. If the set of quaternions is considered as a multidimensional real space, the quaternions represent a four-dimensional space, as opposed to a two-dimensional space of complex numbers. "

We can express it as a four-dimensional vector.

$$ q = <w,x,y,z>
q = w + xi + yi +zk
q = s + v $$ – w,x,y,z are real numbers,v is a 3-dimentional vector(e.g. a 3D point),

– i,j,k complex numbers (“quaternion units”) with $ i^2 = j^2=k^2=ijk=-1 $

Perhaps looking at the above equation may still be confused as to what each parameter represents, and seeing these parameters there is no specific imagination in the mind about the rotation. This is actually quite normal, if you can visualize it in your mind instead of some abnormal :) In any case, quaternions actually belong to the “remnants” of “spatial magic”. Why is that? The following is a deeper study of the quaternion by looking at it, or more accurately, the projection of the quaternion hypersphere in three.

The reason why quaternions are difficult to understand is that it is a four-dimensional representation. But it is not impossible, because we usually use the unit quaternion to represent the rotation, so we only need to focus on the unit hypersphere in our thinking, and then we can more easily obtain its spherical polar plane projection (stereographic projection) in three dimensions.

Projection of the unit circle in one dimension

We know that the projection of the unit circle in one dimension as a two-dimensional space is an infinitely extended line. Suppose we have a plane coordinate system, with the x-axis as the real axis and the y-axis as the imaginary axis, and the intersection of the line from the point - i and any point on the circle with the x-axis constitutes its projection. It is worth noting that the line coinciding with the x-axis is only one of the projections of the unit circle in this two-dimensional space, and there is no way to represent the projections of other points in the two-dimensional space in this one-dimensional space.。

Projection of the unit ball in two dimensions

Similarly, the projection of the unit sphere in two dimensions can be viewed similarly. Suppose we have the i-axis, the j-axis, two imaginary axes forming a plane, and the real axis coinciding with the z-axis. Then in a similar technique to the previous projection, we can describe the rotation of three in terms of the spherical polar plane projection. For each point on the unit sphere, we can connect it to -1, and the intersection of this line with the ij plane is the projection point in two dimensions, so that 1 on the real number axis will be projected at the origin of the plane, the point in the northern hemisphere will be projected inside the unit circle in the ij plane, and the point in the southern hemisphere will be projected in the unit circle outside the unit circle, and at infinity in any direction will be the projection of -1. The rotation is the process of “lines” gradually enclosing “circles” and “circles” gradually expanding into “lines”.

Projection of unit hypersphere in 3D space

Next is the focus of our attention. With the above layouts, it is easy to understand why quaternions are composed of a real term with three imaginary terms.

For a spherical polar plane projection of the unit sphere in four dimensions, the 1 of the real number axis projects the origin of the ijk coordinate system. When the four-dimensional hypersphere is projected into three-dimensional space, it intersects the three-dimensional unit sphere in the same position as the three-dimensional space, and this sphere corresponds to the pure quaternion, i.e., the real part is zero. The real part between 0 and 1 is projected inside this three-dimensional sphere, while the real part less than 0 is projected outside the three-dimensional sphere, and -1 is projected at infinity in all directions.

Just as a circle in three dimensions is projected as a line in the two-dimensional plane, a sphere (not a hypersphere) in four dimensions is projected as a plane in three dimensions; in fact, the plane in the three-dimensional projection is the projection of the sphere past -1 in the four-dimensional hypersphere in three dimensions.1

Quaternion algebraic operations

We have the following definitions: $$ q_1 = s_1 + v_1 \quad q_1=<w_1,x_1,y_1,z_1> $$ $$ q_2 = s_2 + v_2 \quad q_2=<w_2,x_2,y_2,z_2> $$ $$ \Box Addition \quad q_1 + q_2 = <w_1+w_2,x_1+x_2,y_1+y_2,z_1+z_2> $$ $$ \Box Multiplication \quad q_1q_2=s_1s_2 - v_1v_2+s_1v_2+s_2v_1+v_1 \times v_2 $$

where Multiplication can be represented by matrix: $$ \begin{vmatrix} w_1 & -x_1 & -y_1 & -z_1 \ x_1 & w_1 & -z_1 & y_1 \ y_1 & z_1 & w_1 & -x_1 \ z_1 & -y_1 & x_1 & w_1 \end{vmatrix}

\begin{vmatrix} w_2 \ x_2 \ y_2 \ z_2 \end{vmatrix} $$

We can also expand our definition: $$ Norm: ||q|| = q = \sqrt{w^2 +x^2+y^2+z^2} $$ $$:Unit quaternion||q|| = q = 1 $$ $$Pure quaternions:w = 0 \quad q = <0,x,y,z> $$

Next, let’s see how the “rotation” process works Suppose we need to rotate a vector a around $\theta$ angle, we discussed earlier how this process is implemented with rotation matrices, now let’s see how quaternions behave when facing this kind of problem.


  1. 可视化理解四元数,愿你不再掉头发 ↩︎