Graphics Reference
In-Depth Information
Fig. 11.10
The point
(
0
,
1
,
1
)
is rotated 90° about
the vector
v
to
(
1
,
1
,
0
)
11.8 Interpolating Quaternions
Like vectors, quaternions can also be interpolated to compute an in-between quater-
nion. However, whereas two interpolated vectors results in a third vector that is
readily visualised, two interpolated quaternions results in a third quaternion that
acts as a rotor, and is not immediately visualised.
We have already seen that the spherical interpolant for vectors is
sin
(
1
−
t)θ
sin
tθ
sin
θ
v
=
v
1
+
v
2
sin
θ
and requires no modification for quaternions:
−
sin
(
1
t)θ
sin
tθ
sin
θ
q
=
q
1
+
q
2
.
(11.7)
sin
θ
So, given
q
1
=
s
1
+
x
1
i
+
y
1
j
+
z
1
k
z
2
k
θ
is obtained by taking the 4D dot product of
q
1
and
q
2
:
q
2
=
s
2
+
x
2
i
+
y
2
j
+
q
1
·
q
2
cos
θ
=
|
q
1
||
q
2
|
s
1
s
2
+
x
1
x
2
+
y
1
y
2
+
z
1
z
2
cos
θ
=
q
2
|
and if we are working with unit quaternions, then
cos
θ
|
q
1
||
=
s
1
s
2
+
x
1
x
2
+
y
1
y
2
+
z
1
z
2
.
(11.8)
Let's use (
11.7
) in a scenario with two simple quaternions.
Figure
11.10
shows one such scenario where the point
(
0
,
1
,
1
)
is rotated 90°
about
v
, the axis of
q
1
. Figure
11.11
shows another scenario where the same point
(
0
,
1
,
1
)
is rotated 90° about
v
, the axis of
q
2
. The quaternions are
√
2
2
+
√
2
2
q
1
=
+
=
cos 45°
sin 45°
j
j
√
2
2
+
√
2
2
q
2
=
cos 45°
+
sin 45°
i
=
i
.