Hi

In my own work in 3d worlds I found quaternions very, very useful

because compacticy, elegance and ease of use.

Quaternions are mathematical entities which you may considere as four

dimensional _r_e_a_l_

vectors. You may add, subtract couples of them and you may multiply by

real numbers (scalars) as you do with 2d or 3d vectors. Thus a

quaternion Q is a entity determined by four real (not complex) numbers

Q = (a, b, c, d)

There are four distinguished quaternions:

1 = (1, 0, 0, 0)

i = (0, 1, 0, 0)

j = (0, 0, 1, 0)

k = (0, 0, 0, 0)

which acts as a system basis, as vectors i, j, k in 3d vector system do.

You have

Q = (a, b, c, d) = a + bi + cj + dk

Because bi + cj + dk = V may be seen as a 3d vector, you may write

Q = (a, b, c, d) = a + bi + cj + dk = a + V

You may compute quaternion modules in this way

|Q| = sqrt(a^2 + b^2 + c^2 + d^2) = sqrt(a^2 + |V|^2)

Unlikely 3d vectors but likely 2d vectors (see them as complex numbers)

you may multiply two quaternions obtaining a new quaternion. Algebraic

rules are as usual but you must reminder these new rules

ii = -1 ; ij = k ; ik = -j ;

ji = -k ; jj = -1 ; jk = i ;

ki = j ; kj = -i ; kk = -1

Notice that quaternion product is _n_o_t_ commutative!

The product rules yield

Q* = (a, -b, -c, -d) = a - bi -cj - dk = a - V

compulsory for conjugation. Then you have

QQ* = Q*Q = |Q|^2

Q^(-1) = Q*/|Q|^2

You may divide quaternions:

QR^(-1) = QR*/|R|^2

R^(-1)Q = R*Q/|R|^2

but writing Q/R is not allowed because QR* != R*Q. (Some authors use Q/R

for QR^(-1) and

Q\R for R^(-1)Q)

Obviously, if |Q| = 1, then Q^(-1) = Q*.

A 3d vector, V = (p, q, r) is a quaternion in this way

V = (p, q, r) = pi + qj + rk = (0, p, q, r)

and for a scalar s (_r_e_a_l_ number) you may put

s = (s, 0, 0, 0)

Let V, W be two 3d vectors. Then

VW = VxW - V.W = (-V.W, VxW) ("x" for cross product and "." for

dot product)

The importance of quaternions in 3d work lies in the fact that they are

very related with rotations and homoteces

If you whish rotate a vector V a angle _g (in radians) around an axis

containing the vector X, you will act in this way

1) Calculate the unitary vector in the direction an sense of the axis Y

= X/|X|

2) Construct the quaternion Q = (cos_g, Y)

3) Rotate the vector V as follows

QVQ*

Doing the same but Q = (a, Z) being not unitary you obtain QVQ*, a

vector enlarged |Q|^2 times

rotated arc_cos(a/|Q|) around the axis Z.

More:

Rotation R1 -----> quaternion Q

Rotation R2 -----> quaternion R

--------------------------------------------------

Rotation R2 after Rotation R1 -----> quaternion RQ

Quaternions were invented by Sir William Rowan Hamilton and he believed

they would become an

useful language for mathematical physics at the time field theory began.

But physicists found

quaternions abstract and they preferred the language of scalars,

vectors, dot product, cross

product and the like (notice that quaternions includes all of the

concepts in a single entity!)

rendering field theory as we know it nowadays. In the other side

mathematicians quickly found other algebra systems and they created the

general theory of algebras in which quaternions are nothing than a

single example.

Maybe this facts explain why to found a clear and useful explanation of

quaternions in the literature is a hard task for us!

May be computer graphics science will recover quaternions and establish

them as a leading tool.

I hope this helps!

Carles Romero

I.E.S."Manuel Blancafort"

08530 La Garriga, Catalonia, Spain

http://www.xtec.es/~cromero/index0.htm

> I have some questions about quaternions.

> I've seen lots of references to them, but have yet to see a clear

> explaination of how they work.

> I know that a quaternion is an method of storing a 3d orientation,

> a superior (as it's smaller, and faster to compute) alternative

> to a Euler matrix.

> I know that a quaternion some how represents a direction vector, and

> the rotation around that vector.

> I know that a quaternion Q is defined as Q = r,(vx,vy,vz), where r is

> a scalar, and (vx,vt,vz) is a vector, but I'm not sure how this

> relates to the description immediately above.

> I've some "black box" code to convert Euler Matrices to Quaternions,

> and

> vice versa, but it's been of little assistance!

> An application where I'd like to use quaternions is as follows:

> I have a cuboid object, with associated orientation quaternion, which

> I'm

> trying to rest on a plane.I have the plane normal. The object is not

> quite

> flat on the plane plane. It seems to me, that I could use the plane

> normal

> as the direction part of the quaternion, to align the object in the

> plane normal axis, and retain the angle information of the quaternion,

> so that the orientation in the other 2 axes perpendicular to the plane

> normal is not lost.

> (I hope this makes sense!)

> Does this seem like a good appropriate way to use quaternions?

> I'd greatly appreciate any help with any of these questions, or

> pointers

> to on-line places to look.

> Thanks

> Jim Williams