1 / 20

Quaternions

Visualization and Animation Course

- Presented by
- Zachi Karni
- Tali Sapir

Motivation

- 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)

Euler 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).

Euler Angles (cont)

Rotation Matrix

- A general rotation can be represented by a single

3x3 matrix - Length Preserving (Isometric)
- Reflection Preserving
- Orthonormal

Euler Angles and Rotation Matrices

Gimbal Lock

- Rotation by 90o causes a loss of a degree of

freedom

Euler 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,?, ?)

Goal

- Find a parametrization in which
- a simple steady rotation exists between two key

orientations - moves are independent of the choice of the

coordinate system

Angular displacement

- (?,n) defines an angular displacement of ? about

an axis n

Quaternions 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

Quaternions 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)

- inverse
- unit quaternion

Quaternions 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 !

Quaternions as Rotations cont.

Interpolating using Quaternions

- The animator sets a sequence of key orientations
- The mission interpolate between them

Interpolating using quaternions

- Rotations are represented by unit quaternions

therefore the group of rotations lies on a 4D

unit hypersphere

Interpolating 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)

Interpolating 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.

Interpolating 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

linear interpolation

cubic spline interpolation