Você está na página 1de 29

Quaternions

Sean Arietta
CS445: Graphics

Acknowledgment: slides by Misha Kazhdan, Allison Klein, Tom Funkhouser,


Adam Finkelstein and David Dobkin

Monday, April 26, 2010


Lecture Motivation
We have seen ways to rotate an object in 3D
o Euler angles
o SVD
o Matrices
o Axis/angle

Each method has its advantages/disadvantages

Monday, April 26, 2010


Lecture Motivation
Euler angles
o Suffer from gimbal lock

Monday, April 26, 2010


Lecture Motivation
Euler angles
o Suffer from gimbal lock

We have lost the ability to rotate about the original green ring

Monday, April 26, 2010


Lecture Motivation
This problem doesnt occur with 4 rotation axes
But we are operating in 3D space
o Cant find orthogonal rotation basis with 4 axes

Solution: Quaternions

Monday, April 26, 2010


Quaternions
Quaternions are extensions of complex numbers,
with 3 imaginary values instead of 1:

Monday, April 26, 2010


Quaternions
Quaternions are extensions of complex numbers,
with 3 imaginary values instead of 1:

Like the complex numbers, we can add quaternions


together by summing the individual components:

Monday, April 26, 2010


Quaternions
Quaternions are extensions of complex numbers,
with 3 imaginary values instead of 1:

Like the imaginary component of complex numbers,


squaring the components gives:

Monday, April 26, 2010


Quaternions
Quaternions are extensions of complex numbers,
with 3 imaginary values instead of 1:

Like the imaginary component of complex numbers,


squaring the components gives:

However, the multiplication rules are more complex:

Monday, April 26, 2010


Quaternions
Quaternions are extensions of complex numbers,
with 3 imaginary values instead of 1:

Like the imaginary component


Note that multiplication of complex
of quaternions is numbers,
squaringnotthe components gives:
commutative:
The result of the multiplication depends on
the order in which it was done
However, the multiplication rules are more complex:

Monday, April 26, 2010


Quaternions
More generally, the product of two quaternions is:

Monday, April 26, 2010


Quaternions
As with complex numbers, we define the conjugate
of a quaternion q=a+ib+jc+kd as:

Monday, April 26, 2010


Quaternions
As with complex numbers, we define the conjugate
of a quaternion q=a+ib+jc+kd as:

As with complex numbers, we define the norm of a


quaternion q=a+ib+jc+kd as:

Monday, April 26, 2010


Quaternions
As with complex numbers, we define the conjugate
of a quaternion q=a+ib+jc+kd as:

As with complex numbers, we define the norm of a


quaternion q=a+ib+jc+kd as:

As with complex numbers, the reciprocal is defined


by dividing the conjugate by the square norm:

Monday, April 26, 2010


Quaternions
One way to express a quaternion is as a pair
consisting of the real value and the 3D vector
consisting of the imaginary components:

Monday, April 26, 2010


Quaternions
One way to express a quaternion is as a pair
consisting of the real value and the 3D vector
consisting of the imaginary components:

The advantage of this representation is that it is


easier to express quaternion multiplication:

Monday, April 26, 2010


Quaternions
One way to express a quaternion is as a pair
consisting of the real value and the 3D vector
consisting of the imaginary components:

The advantage of this representation is that it is


easier to express quaternion multiplication:

Monday, April 26, 2010


Quaternions and Rotations
If q=a+ib+jc+kd is a unit quaternion (||q||=1), q
corresponds to a rotation:

Monday, April 26, 2010


Quaternions and Rotations
If q=a+ib+jc+kd is a unit quaternion (||q||=1), q
corresponds to a rotation:

Note that because all of the terms are


quadratic, the rotation associated with q is
the same as the rotation associated with -q.

Monday, April 26, 2010


Quaternions and Rotations
If q=a+ib+jc+kd is a unit quaternion (||q||=1), q
corresponds to a rotation:

Because q is a unit quaternion, we can write q as:

Monday, April 26, 2010


Quaternions and Rotations
If q=a+ib+jc+kd is a unit quaternion (||q||=1), q
corresponds to a rotation:

Because q is a unit quaternion, we can write q as:

It turns out that q corresponds to the rotation whose:


o axis of rotation is w, and
o angle of rotation is .
Monday, April 26, 2010
Quaternions
Instead of blending matrices and then normalizing
using SVD, we can blend the quaternions and
then normalize them:
o For each Mi, compute the quaternion rep. (i,wi)

Monday, April 26, 2010


Quaternions
Instead of blending matrices and then normalizing
using SVD, we can blend the quaternions and
then normalize them:
o For each Mi, compute the quaternion rep. (i,wi)
o Interpolate/Approximate the quaternions:

Monday, April 26, 2010


Quaternions
Instead of blending matrices and then normalizing
using SVD, we can blend the quaternions and
then normalize them:
o For each Mi, compute the quaternion rep. (i,wi)
o Interpolate/Approximate the quaternions:
Linear Interpolation:

Monday, April 26, 2010


Quaternions
Instead of blending matrices and then normalizing
using SVD, we can blend the quaternions and
then normalize them:
o For each Mi, compute the quaternion rep. (i,wi)
o Interpolate/Approximate the quaternions:
Linear Interpolation
Catmull-Rom Interpolation:

Monday, April 26, 2010


Quaternions
Instead of blending matrices and then normalizing
using SVD, we can blend the quaternions and
then normalize them:
o For each Mi, compute the quaternion rep. (i,wi)
o Interpolate/Approximate the quaternions:
Linear Interpolation
Catmull-Rom Interpolation
Uniform Cubic B-Spline Approximation:

Monday, April 26, 2010


Quaternions
Instead of blending matrices and then normalizing
using SVD, we can blend the quaternions and
then normalize them:
o For each Mi, compute the quaternion rep. (i,wi)
o Interpolate/Approximate the quaternions:
Linear Interpolation
Catmull-Rom Interpolation
Uniform Cubic B-Spline Approximation
o Set the value of the in-between rotation to be the
normalized quaternion:

Monday, April 26, 2010


Quaternions
As with points on the circle/sphere, this type of
interpolation/approximation has the limitation:
Uniform sampling in quaternion space does not
result in uniform sampling in rotation space.

p0 p1

(t)=(1-t)p0+tp1

Monday, April 26, 2010


Summary
In order to define in-between frames for an
animation, we need to interpolate/approximate
the transformations specified in the key-frames.
For translation, we can just use splines
For rotations, we need to ensure that the in-
between transformations are also rotations:
o Euler angles In-between transformations are
guaranteed to be rotations

o SVD Normalize in-between transformations to


o Quaternions turn them into the nearest rotations

Monday, April 26, 2010

Você também pode gostar