Quaternions are a natural extension of complex numbers. Like complexes, they have a real part, however, they have three imaginary parts, i, j, & k, with some special rules. Once again, quaternions have uses concerning fractals. Due to the fact that they have four components, these fractals are four dimensional, for example, the four dimensional julia sets you can generate using POV. Quaternions can also be use for rotations. Instead of the rotation being around one of the x, y, and z axes, you can specify any axis. Quaternions (q in this example) come in the form
w, x,
y, & z are real numbers. w is the real part, and xi,
yj, & zk are the imaginary parts, where i, j, & k are
equal to square root of -1, HOWEVER, they cannnot be treated as if there
are equal, - here are the special rules I talked about :
Quaternion
Algebra
Here are the various quaternion algebra functions.
Addition
Addition of the quaternions q and r :
Subtraction
Subtraction of the quaternions q and r :
Multiplication
Multiplication of the quaternions q and r :
Note that
multiplication of quaternions is NOT COMMUTATIVE. Should be pretty obvoius
actually =)
Norm
Norm of the quaternion q :
Modulus
Modulus
of the quaternion q (|q|) :
Conjugate
Conjugate of the quaternion q (q*) :
Inverse
Inverse of the quaternion z (
)
:
Division
Division
of the quaternions q and r (
)
:
Quaternion
Rotations
I mentioned earlier that Quaternions can be used to do rotations about
an arbitary axis. Heres how.
The quaternion q which rotates
radians about the axis whose vector is
(make sure the vector is normalised),
So:
,
,
,
and
.
To make this useful, we convert this quaternion into a transformation matrix. The transformation matrix for the quaternion q where
is
Code that
lot up in a library or something.
If anyone has any questions, ideas for optimiztions, etc, don't hesitate to mail me at :
mrmeanie@easynet.co.uk