Quaternion
Under Construction...
Related Topics: Euler's Equation
Quaternion is a geometrical operator to represent the relationship (relative length and relative orientation) between two vectors in 3D space. William Hamilton invented Quaternion and completed the calculus of Quaternions to generalize complex numbers in 4 dimension (one real part and 3 imaginary numbers). In this article, we focus on rotations of 3D vectors because Quaternion implementation for 3D rotation is usually simpler, cheaper and better behaved than other methods.
- Background of Quaternion
- Understanding of Quaternion
- Quaternion Algebra
- 3D Rotation with Quaternion
- Slerp
Background of Quaternion
Euler's equation (formula) can be used to represent a 2D point with a length and angle on a complex plane. Multiplication of 2 complex numbers implies a rotation in 2D. One may think instantly it can be extended to 3D rotation by adding additional dimension. William Hamilton initially studied it by adding an additional imaginary number, j to generalize complex numbers to 3D.
However, the set of 3 dimensional complex numbers is not closed under multiplication. For example, the multiplication of i and j cannot be represented as the form of a+ib+jc. If multiplication is closed, then there exist a, b, c ∈ R that satisfies ij=a+ib+jc.

The equation c2+1=0 gives the contradiction. There is no real number c to satisfy c2+1=0.
Later, Hamilton realized 4 dimensional complex numbers are required for multiplication to be closed. And, he denoted this 4D complex number set as Quaternion. (In mathematics, each algebra has twice the dimension of the previous one. Therefore, the higher number set of complex number is quaternion, and the next number set is octonion.)
Understanding of Quaternion
Definition

Definition of Quaternion operator
Hamilton's motivation was to create a geometrical operator to transform from a vector to the other in 3D space. This operator is the geometric quotient (ratio) between two vectors that changes the length and the orientation, and it is called a Quaternion because the operation is required 4 parameters.
, or, 
(Note that this notation is not same as numerical division nor multiplication. Instead, it is translated as "the quaternion operator q on
to produce
, or the operator q to convert
into
".)
(Note that this notation is not same as numerical division nor multiplication. Instead, it is translated as "the quaternion operator q on
Tensor and Versor
When
is transformed to vector
, quaternion operator performs 2 distinct operations:
1. Tensor: scaling the length of
, so as to make it of the same length as
.
2. Versor: rotating
, so as to cause it to coincide with
in direction.
These 2 opearions can be symbolically represented
(tensor of q) and
(versor of q) respectively.

1. Tensor: scaling the length of
2. Versor: rotating
These 2 opearions can be symbolically represented
The order of these two operations does not make any difference of the result. The combined tensor and versor operation requires 4 numbers; 1 for scaling, 1 for rotation angle, 2 additional angles to determine the orientation of the rotation plane. For example, a xy-plane is rotated about x and y axis. But, rotation along z axis does not change the orientation of the xy plane.

Tensor operator
Tensor
Tensor of q is the geometric quotient (ratio) between the lengths of 2 parallel vectors. It changes the scale of the vector, but, keeps the orientation of the vector unchanged.
Tensor of q is the geometric quotient (ratio) between the lengths of 2 parallel vectors. It changes the scale of the vector, but, keeps the orientation of the vector unchanged.

Versor operator
Versor
Versor of q is the geometric quotient of 2 non-parallel vectors of equal length. It represents the relative orientation of one vector with respect to the other vector, but, it does not change the length of the vector.
Versor of q is the geometric quotient of 2 non-parallel vectors of equal length. It represents the relative orientation of one vector with respect to the other vector, but, it does not change the length of the vector.
Expression with unit vectors

Quaternion with unit vectors
To investigate the quaternion operator deeper, let
and
as unit vectors along
and
. so that

And, draw AC perpendicular to
, and let the unit vector along
be
. Therefore,
becomes
and
. Since
, we substitute
and
in the above equation, then we have a quaternion,
;



Vector of Rotation axis
The last term contains the geometric quotient
of two unit vectors at right angles (90 degree) to each other. This quotient represents a unit vector perpendicular to the plane of
and
. (Think of cross product of 2 vectors) This unit vector is indicating the rotation axis of the plane and the direction of rotation. If we define it
, the above equation becomes

From this equation, A/B is tensor (scaling) operation of a quaternion, and
is versor (rotation) operator of a quaternion. Note that versor of q is very similar to Euler's equation. Euler's equation contains an imaginary number i, but a quaternion has a vector instead, which is the rotation axis perpendicular to its rotation plane.
Thus, a quaternion is also expressed as the sum of scalar S(q) and vector parts U(q);


Quaternion can be also written as a 2-tuple form, [s, v]. A unit quaternion can be represented as
Quadrantal vectors, i j k

Quadrantal vectors
Let i, j, k represent unit vectors orthogonal (perpendicular) each other. We define multiplications and divisions as rotating a unit vector to another at right angle. Note that, this multiplication and division is not numeric algebra. This kind of multiplication and quotient is called geometric. Thus, production or quotient of two unit vectors at right angles to each other produces a unit vector, perpendicular to their plane. And, it reads as i operating on j (or, rotating from i to j) produces k.
In same manner, we can write other multiplications and divisions;


The square of a unit vector can be defined from above equations;

In same manner,


In same manner,
Also, ijk can be defined as -1 using above multiplication table and square of unit vector.


Quaternion Algebra
Here, the basic quaternion mathematics is described. These algebraic definitions and properties are specially required for rotation in 3D space, which describe in the next section. You may skip this section and move on the next section. And, come back later if you need to review a specific definition or property.
1. Addition

2. Multiplication

Note that quaternion multiplication is not commutative, however, multiplication is associative and distributive across addition.


3. Scalar Multiplication

Unlike quaternion multiplication, scalar multiplication is commutative.
4. Subtraction
Quaternion subtraction can be derived from scalar multiplication and quaternion addition.


5. Conjugate
Quaternion congugate is defined by negating the vector part of the quaternion.

Note that the multiplication of a quaternion and its conjugate is commutative.

Note that the multiplication of a quaternion and its conjugate is commutative.
6. Norm
The norm of a quaternion is defined by;


The norm of quaternion is multiplicative meaning that the norm of the multiplication of multiple quaternions equals to the multiplication of the norms of quaternions.


7. Inverse
The inverse of a quaternion is defined to be;

The quaternion inverse makes it possible to divide two quaternions.

The quaternion inverse makes it possible to divide two quaternions.
8. Unit Quaternion

Note that the inverse of a unit quaternion equals to the conjugate of the unit quaternion.
3D Rotation with Quaternion
In 2D, the multiplication of two complex numbers implies 2D rotation. When z=x+iy is multiplied by
, the length of z' remains same (|z|=|z'|), but the angle of z' is added by θ. (See details in Euler's equation.)
However, multiplying a quaternion p by a unit quaternion q does not conserve the length (norm) of the vector part of the quaternion p. For example;

Thus, we need a special multiplication for 3D rotations that is length-conserving transformation. For this reason, we multiply the unit quaternion q at the front of p and multiplying q-1 at the back of p, in order to cancel out the length changes. This special double multiplication is called "conjugation by q".
If q is a unit quaternion and p = [s, v], then the scalar (s) and the length of v, |v| are unchanged after conjugation by q. For the above example;

Proof
If p = [s, v] and p' = qpq-1, then p' = [s, v'] where |v| = |v'|
The proof takes 3 steps. First, we show S(p)=S(p') for p=[s, 0], then for p=[0, v]. Finally, both results are used to show S(p)=S(p') for p=[s, v]=[s, 0]+[0, v].
1. If p has a scalar part only p = [s, 0], then

2. If p has a vector part only p = [0, v], then the scalar part of qpq-1 can be computed by 2S(q)=q+q*.


3. If p = [s, v] = [s, 0] + [0, v], then


Since we found that the scalar parts of p and p' are same, the norm of p' is;


0 comments:
发表评论