Graphics Programs Reference
In-Depth Information
is identical to the product (
a
+
ib
)(
c
+
id
). Quaternions extend this similarity to three
dimensions as follows. To rotate a point
P
by an angle
θ
about a direction
v
,wefirst
prepare the quaternion
q
= [cos(
θ/
2)
,
sin(
θ/
2)
u
], where
u
=
v
/
is a unit vector in the
direction of
v
. The rotation can then be expressed as the triple product
q
|
v
|
·
[0
,
P
]
·
q
−
1
.
Note that our
q
is a unit quaternion since sin
2
(
θ/
2) + cos
2
(
θ/
2) = 1.
q
−
1
really performs a rotation
of
P
about
v
(or
u
). [Hint: Perform the multiplications and show that they produce
Equation (1.31).]
Exercise 1.43:
Prove that the triple product
q
·
[0
,
P
]
·
As an example of quaternion rotation, consider a 90
◦
rotation of point
P
=(0
,
1
,
1)
about the
y
axis. The quaternion required is
q
=[cos45
◦
,
sin 45
◦
(0
,
1
,
0)]. It is a unit
quaternion, so its inverse is
q
−
1
=[cos45
◦
,
sin 45
◦
(0
,
1
,
0)]. The rotated point is thus
−
q
[0
,
P
]
q
−
1
=[
sin 45
◦
,
(sin 45
◦
,
cos 45
◦
,
cos 45
◦
)] [0
,
(0
,
1
,
1)] [cos 45
◦
,
sin 45
◦
(0
,
1
,
0)]
−
−
=[0
,
(1
,
1
,
0)]
.
The quaternion resulting from the triple product always has a zero scalar. We ignore
the scalar and find that the point has been moved, by the rotation, from the
x
=0
plane to the
z
=0plane.
Figure 1.30 illustrates this particular rotation about the
y
axis and also makes it
easy to understand the rule for the direction of the quaternion rotation
q
[0
,
P
]
q
−
1
.The
rule is: Let
q
=[
s,
v
] be a rotation quaternion in a right-handed three-dimensional
coordinate system. To an observer looking in the direction of
v
, the triple product
q
[0
,
P
]
q
−
1
rotates point
P
clockwise. For a negative rotation angle, the rotation is
counterclockwise. In a left-handed coordinate system (Figure 1.30b), the direction of
rotation is the opposite.
y
y
z
(inside
the page)
z
(outside
the page)
x
x
(a)
(b)
Figure 1.30: Rotation in a Right-Handed (a) and in a Left-Handed (b) Coordinate System.
Search WWH ::
Custom Search