Title: Quaternions
1Quaternions
Visualization and Animation Course
- Presented by
- Zachi Karni
- Tali Sapir
2Motivation
- Finding the most natural and compact way to
present rotation and orientations - Orientation interpolation which result in a
natural motion - A closed mathematical form that deals with
rotation and orientations (expansion for the
complex numbers)
3Euler Angles
- A general rotation is a combination of three
elementary rotations around the x-axis (x-roll)
, around the y-axis (y-roll) and around the
z-axis (z-roll).
4Euler Angles (cont)
5Rotation Matrix
- A general rotation can be represented by a single
3x3 matrix - Length Preserving (Isometric)
- Reflection Preserving
- Orthonormal
6Euler Angles and Rotation Matrices
7Gimbal Lock
- Rotation by 90o causes a loss of a degree of
freedom
8Euler angles interpolation
R(0,0,0),,R(?t,0,0),,R(?,0,0) t?0,1
R(0,0,0),,R(0,?t, ?t),,R(0,?, ?)
9Goal
- Find a parametrization in which
- a simple steady rotation exists between two key
orientations - moves are independent of the choice of the
coordinate system
10Angular displacement
- (?,n) defines an angular displacement of ? about
an axis n
11Quaternions Definition
- Quaternions are an extension of complex numbers
q s vxi vyj vzk or q (s,v) where
i2 j2 k2 -1 ij k and ji -k jk i
and kj -i ki j and ik -j
12Quaternions properties
- The conjugate and magnitude are similar to
complex numbers
- Quaternions are non commutative
q1 (s1,v1) q2 (s2,v2) q1q2 (s1s2 v1.v2
, s1v2 s2v1 v1 x v2)
13Quaternions as Rotations
- Rotation of P(0,r) about the unit vector n by an
angle ? using the unit quaternion q(s,v)
but q(cos½?, sin½?n) where n1
same form as angular displacement !
14Quaternions as Rotations cont.
15Interpolating using Quaternions
- The animator sets a sequence of key orientations
- The mission interpolate between them
16Interpolating using quaternions
- Rotations are represented by unit quaternions
therefore the group of rotations lies on a 4D
unit hypersphere
17Interpolating two quaternions
- Linear interpolation move along a straight line
- Spherical linear interpolation move along an arc
q(u) ?(u)q1?(u)q2 for u?0,1 Solve the
following equations to get ?(u) and ?(u)
18Interpolating two quaternions
- Spherical linear interpolation
- Moving on the arc from p to q has the same effect
as moving on the arc from p to q. - Choose the shorter path.
19Interpolating a sequence of quaternions
- Spherical linear interpolation between more than
two key orientations causes non smooth motion
because of derivatives discontinuities at the
keys - We need the spherical equivalent for cubic spline
in 4D
20linear interpolation
cubic spline interpolation