Title: Quaternions
1Quaternions
2Euler Angles
Rotations are defined as rotations about the x, y
and z axes. Rotations about any other vector in
space have to be broken down into equivalent
rotations about the major axes.
y
z
x
3Animation
y
To produce the effect of a smooth rotation about
some arbitrary axis in space, we generate a
series of FRAMES.
z
x
4Frames
y
With Euler Angles, knowing the transformations
for the entire rotation does not help us with the
intermediate rotations. Each is a unique set of
three rotations about the x,y and z axes
z
x
5Quaternions
- Invented in 1800s
- Alternate way to describe rotations about an
arbitrary axis. - Useful in animation because it is easy to
interpolate rotations - 4-tuple described by four real numbers q w, x,
y, z
6Quaternion Operations
- q w,x,y,z where w is a scaler related to an
angle and x,y,z, is a vector. - We can write this as ?, v where
- w and v x,y,z
- ?1, v1 ?2, v2 ?1 ?2, v1 v2
- ?1, v1 ?2, v2
- (?1?2 - v1v2), (?1v2 ?2 v1 v1 x v2)
7Quaternion Operations
- q ?(w2 x2 y2 z2)
- q-1 ?, -v / q2
- qq-1 1, 0, 0, 0
8Describing Motion in Animations
- Only consider quaternions such that q 1
- To perform a rotation of point d about the unit
vector v of ? degrees we compute - q-10,dq (remember q ?, v)
- The result will be a vector that represents a
rotation of point d about the vector v with angle
? given by the equation ? cos(?/2)
9Example
Rotation of 180 degrees about the vector 1,0,1,
of point (1,0,0).
y
(0,0,1)
z
x
(1,0,0)
10Notation for this example
- What is q ?, v such that q 1?
- cos (180/2) cos(90) 0
- v ?2//2, 0, ?2//2
- q 0, ?2//2, 0, ?2//2
- q-1 ?, -v /q2 0, -?2//2, 0, -?2//2
- 0,d 0, 1, 0, 0
11To Rotate
- ?1, v1 ?2, v2
- (?1?2 - v1v2), (?1v2 ?2 v1 v1 x v2)
- q-10,dq
- 0, ?2//2, 0, ?2//20, 1, 0, 00, -?2//2, 0,
-?2//2 - 0, 0, 0 1, new rotated coordinate is (0,0,1)
12Why is this cool?
Rotation of 90 degrees about the vector 1,0,1,
of point (1,0,0).
y
z
x
13Why is this cool?
- Finding the quaternion representation for all the
intermediate frame rotations is easy. - For example, a rotation of 90 degrees of the
point (1,0,0) about the vector 1,0,1 - What is q ?, v such that q 1?
- cos (90/2) cos(45) ?2//2
- v 1/2, 0, 1/2
- q45 ?2//2, 1/2, 0, 1/2
14How to find the unit quaternion?
- Assume that you want to rotate 30 degrees about
the axis 0, 3, 4 - First find unit vector 0,3,4/5 0,0.6, 0.8
- Unit quaternion is
- cos (15), 0sin(15), 0.6sin(15), 0.8sin(15)
- 0.966, 0, 0.60.259, 0.80.259
- 0.966, 0, 0.155, 0.207