Game Development Reference

In-Depth Information

represents an orientation of
θ
about the axis:

⎡

⎣

⎤

⎦

x

y

z

Two quaternions can be multiplied together:

⎡

⎣

⎤

⎦

⎡

⎣

⎤

⎦
=

⎡

⎣

⎤

⎦

w
1

x
1

y
1

z
1

w
2

x
2

y
2

z
2

w
1
w
2
−

x
1
x
2
−

y
1
y
2
−

z
1
z
2

w
1
x
2
+

x
1
w
2
−

y
1
z
2
−

z
1
y
2

w
1
y
2

−

x
1
z
2

+

y
1
w
2

−

z
1
x
2

w
1
z
2
+

x
1
y
2
−

y
1
x
2
+

z
1
w
2

A quaternion representing orientation can be adjusted by a vector representing

amount of rotation according to

1

2
θ

θ

ˆ

=

θ

ˆ

+

θ

ˆ

ˆ

where the rotation is converted into a quaternion according to

[
θ
x
θ
y
θ
z
]

→

[0
θ
x
θ
y
θ
z
]

D.3

M
ATRICES

An
n

m
matrix has
n
rows and
m
columns.

Matrices can be post-multiplied (we don't use pre-multiplication in this topic) by

vectors with the same number of elements as the matrix has columns:

⎡

⎣

×

⎤

⎦

⎡

⎣

⎤

⎦
=

⎡

⎣

⎤

⎦

abc

def

ghi

x

y

z

ax

+

by

+

cz

dx

+

ey

+

fz

gx

+

hy

+

iz

Matrices can be multiplied together, providing that the number of columns in the

first matrix is the same as the number of rows in the second:

C
(i,j)
=

A
(i,k)
B
(k,j)

k

where
C
(i,j)
is the entry in matrix
C
at the
i
th row and
j
th column; and where
k
ranges

up to the number of columns in the first matrix.