Graphics Reference
In-Depth Information
The web material for this chapter describes the quaternions in detail, derives the
mapping
K
above, and shows how it's related to Rodrigues' formula. For most
purposes in graphics, it's sufficient to know the three properties above, and one
more fact, which we now develop.
cos(
u
)
v
1
sin(
u
)
w
w
If we have a point
q
=
abcd
T
S
3
, we know
∈
−
1
≤
a
≤
1, so
a
is
u
the cosine of some number. We let
θ
= arccos(
a
)
.
(11.34)
v
Furthermore, since
abcd
T
S
3
, we know that
a
2
+
b
2
+
c
2
+
d
2
=
1.
∈
Figure 11.6: All cosine-sine com-
binations of two perpendicular
unit vectors in the sphere again
form a unit circle, called a great
circle.
Thus,
1
=
a
2
+
b
2
+
c
2
+
d
2
(11.35)
=cos
2
(
)+
b
2
+
c
2
+
d
2
θ
(11.36)
so that
bcd
T
is a vector of squared length
sin
2
(
θ
)
.If
a
=
±
1, then
sin(
θ
)
=
0, and we can let
=
0
sin(
θ
)
T
b
sin(
θ
)
c
sin(
θ
)
d
v
,
(11.37)
and say that
)
1000
T
+sin(
q
=cos(
θ
θ
)
v
.
(11.38)
In the case where
sin(
θ
)=
0, we can choose any unit vector for
. In short, every
v
element of
S
3
can be written in the form
)
1000
T
+sin(
q
=cos(
θ
θ
)
,
(11.39)
v
is a unit vector in the
xyz
-subspace of
S
3
, that is, perpen-
dicular to
1000
T
.
With a good deal of algebra, you can plug in
a
=cos(
where 0
≤ θ ≤ π
and
v
θ
)
,
b
=sin(
θ
)
v
x
,
3
p
/8
c
=sin(
v
z
in Equation 11.32, and discover that it's
exactly
the same matrix you get if you apply Rodrigues' formula to build a rotation about
the
xyz
-vector
θ
)
v
y
, and
d
=sin(
θ
)
p
/8
(note the factor of two!).
The map
K
has a great deal in common with the map
K
1
:
S
1
by angle 2
θ
v
11
p
/8
S
1
→
:
(cos(
θ
)
,
sin(
θ
))
→
(cos(
2
θ
)
,
sin(
2
θ
))
.Like
K
,themap
K
1
is also two-to-one.
u
For instance, the points at
θ
=
0 and
θ
=
π
both get sent to the point at
θ
=
0
by
K
1
. In fact, the points at
θ
and
θ
+
π
are both sent to the point at
θ
, for any
angle
; in other words,
K
1
maps each pair of antipodal points to the same point.
If you wanted to interpolate between, say,
θ
2
u
π/
4 and 3
π/
4 in the codomain, you
3
p
/4
p
/4
could pick the points
8 in the domain, interpolate between them, and
then apply
K
1
to the interpolated angles and get the result you expect. Of course,
if instead of picking 3
π/
8 and 3
π/
π/
π/
8, you pick 11
8, then the interpolation will run along
the
long
path between
π/
4 and 3
π/
4, as shown in Figure 11.7.
By the way, although
K
is not invertible, it's easy to build a
kind
of inverse:
Given
M
S
3
with
K
(
q
)=
M
; we just cannot
claim that it is
the
element with this property. Recall that Rodrigues' formula tells
us that every rotation matrix has the form
∈
SO
(
3
)
, we can find
an
element
q
∈
Figure 11.7: The blue path in the
domain transforms to the short
arc between
π/
4
and
3
π/
4
in
the codomain, while the red one
transforms to the long arc.
)
J
2
M
=
I
+sin(
θ
)
J
v
+(
1
−
cos
θ
,
(11.40)
v