Graphics Reference
In-Depth Information
7.7.2 Adding and Subtracting Quaternions
Given two quaternions
q
1
and
q
2
,
q
1
=[
s
1
,
v
1
]=[
s
1
+
x
1
i
+
y
1
j
+
z
1
k
]
q
2
=[
s
2
,
v
2
]=[
s
2
+
x
2
i
+
y
2
j
+
z
2
k
]
(7.86)
they are equal if, and only if, their corresponding terms are equal. Further-
more, like vectors, they can be added and subtracted as follows:
q
1
±
q
2
=[(
s
1
±
s
2
)+(
x
1
±
x
2
)
i
+(
y
1
±
y
2
)
j
+(
z
1
±
z
2
)
k
]
(7.87)
7.7.3 Multiplying Quaternions
Hamilton discovered that special rules must be used when multiplying quater-
nions:
i
2
=
j
2
=
k
2
=
ijk
=
−
1
ij
=
k
,
jk
=
i
,
ki
=
j
ji
=
−
k
,
kj
=
−
i
,
ik
=
−
j
(7.88)
Note that although quaternion addition is commutative, the rules make quater-
nion multiplication non-commutative.
Given two quaternions
q
1
and
q
2
,
q
1
=[
s
1
,
v
1
]=[
s
1
+
x
1
i
+
y
1
j
+
z
1
k
]
q
2
=[
s
2
,
v
2
]=[
s
2
+
x
2
i
+
y
2
j
+
z
2
k
]
(7.89)
the product
q
1
q
2
,isgivenby
q
1
q
2
=[(
s
1
s
2
− x
1
x
2
− y
1
y
2
− z
1
z
2
)+(
s
1
x
2
+
s
2
x
1
+
y
1
z
2
− y
2
z
1
)
i
+(
s
1
y
2
+
s
2
y
1
+
z
1
x
2
−
z
2
x
1
)
j
+(
s
1
z
2
+
s
2
z
1
+
x
1
y
2
−
x
2
y
1
)
k
(7.90)
which can be rewritten using the dot and cross product notation as
q
1
q
2
=[(
s
1
s
2
−
v
1
·
v
2
)
,s
1
v
2
+
s
2
v
1
+
v
1
×
v
2
]
(7.91)
7.7.4 The Inverse Quaternion
Given the quaternion
q
=[
s
+
x
i
+
y
j
+
z
k
]
(7.92)
the inverse quaternion
q
−
1
is
q
−
1
=
[
s
−
x
i
−
y
j
−
z
k
]
(7.93)
|
q
|
2