Quaternions Chapter 11 - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

Quaternions Chapter 11

Description:

Quaternions (Chapter 11) A quaternion is an extension of the complex plane to a four ... The multiplicative inverse of a quaternion q is denoted q-1. ... – PowerPoint PPT presentation

Number of Views:123
Avg rating:3.0/5.0
Slides: 27
Provided by: larr160
Category:

less

Transcript and Presenter's Notes

Title: Quaternions Chapter 11


1
Quaternions (Chapter 11)
  • A quaternion is an extension of the complex
    plane to a four dimensional space.
  • q w xi yj zk, x,y,z in R
  • As in complex numbers i2j2k2-1
  • As well as ijk, jki, kij Also
  • ji-ij, jk-kj and ki-ik

2
Addition and Subtraction
Let
And similarly for subtraction.
3
Multiplication
Note Multiplication is not communitive.
4
The conjugate q
The conjugate of
is
Look familiar ?
5
Product of q and q

This is the norm of q denoted N(q)
6

The Norm and Magnitude
The norm of a quaternion satisfies the
following. N(pq) N(p)N(q) and N(q)
N(q) Also if N(p)1 then p is called a unit
quaternion. Note that the magnitude of q is the
square root of the norm. Of course if we have a
unit quaternion then the magnitude and norm are
both 1.
7
The multiplicative inverse of a quaternion
The multiplicative inverse of a quaternion q is
denoted q-1. This of course implies that qq-1
q-1q 1 How do you calculate q-1? Well the
following method works fine.
8


Other Representations
Quaternions can be represented in two other ways
As a real vector
As a four dimensional vector
9
Product Reviewed
What does the last term represent?
Hence the product becomes
10
Unit Quaternions
The set of unit quaternions forms a unit sphere
in four dimensional space. We will use these
unit quaternions to specify general rotations in
our 3D world. In particular we will use
quaternions to perform interpellations between
two 3D rotation matrices.
11
Complex review
  • Recall that in the complex number plane cos ?
    isin ? lies on the unit plane

1
12
Unit Quaternions
  • It can be shown (similar to the cos?isin? of
    complex numbers) that any unit quaternion can be
    represented as (cos ?, Vsin ?) where V
    u0iu1ju2k is a unit length vector and ??-p,p

13
Quaternion Rotations
The unit quaternion represents a 3D rotation of
the vector V by an angle of 2? about the 3D axis
vector U. How is this? Well lets first look at
this rotation in 3D
14
3D Rotation
R(v)
Recall that (vu)u r . Hence V-rs and wu x v
s
w
?
r
R(s)
w
v
s
?
u
R(s) s cos ? w sin ?
15
3D Rotation continued
R(s) s cos ? w sin ? Consequently R(v)R(s)
r r s cos ? w sin ? (vu)u
cos ?(v-(vu)u) sin ?(u x v) v cos ?
(1-cos ?)u(uv) sin ?(u x v)
The above equation lets call EQ 1. We will come
back to it later.
16

Back to Quaternions
Let p(0,v) be the quaternion representation of
the vector v. Also let
Lets look at the operation qpq-1. Here we
multiply p by q on the left and by the inverse of
q on the right.
Say What?
17
Well lets just do it
After a little algebra of course
And by substitution we have
18
Check out EQ 1
Comparing
To Eq 1 which is v cos ? (1-cos
?)u(uv) sin ?(u x v) The angle is one half the
above angle! But the rest is the same. In
other words if
then q(0,v)q-1 represents the same rotation we
discussed earlier.
19
So!
v
(0,v)
A ? rotation About U
q(0,v)q
R(v)
(0,R(v))
Quaternion space
3D space
20
MilkShape Example
21
MilkShape Bone Data
  • Bones 3
  • "joint1"
  • "
  • // joint flags, posx, posy, posz,
    rotx, roty, rotz
  • 16 0.300000 -12.500000 0.000000 -1.610774
    1.570794 0.000000
  • 1 // number of position keys
  • 1.000000 0.000000 0.000000 0.000000
  • 1
  • 1.000000 0.000000 0.000000 0.000000
  • "joint2" // Parent name
  • "joint1"
  • 21 0.000000 0.000000 20.015993 -0.031432 0.000156
    -3.141593

22
MilkShape Bone Data
The adjacent data is a section of the .txt
milkshape file showing a bones angle values for
each of the defined for each keyframe. The rots
are Euler angles.
  • // number of positions
  • // time, rotx, roty,
    rotz
  • 1.000000 0.000000 0.000000 0.000000
  • 3.000000 -0.104720 -0.000001 -0.000016
  • 5.000000 -0.436332 -0.000013 -0.000066
  • 7.000000 -1.553344 -0.000150 -0.000159
  • 9.000000 -1.550732 -0.006148 -0.785540
  • 11.000000 -1.538543 -0.005816 -2.373825
  • 13.000000 -1.536254 -0.000134 -3.106846
  • 15.000000 -1.539088 0.006364 2.321147
  • 17.000000 -1.545851 0.008490 1.465913
  • 19.000000 -1.551159 0.005720 0.750315
  • 21.000000 -1.553349 -0.000001 0.017295
  • 23.000000 -0.960007 -0.009700 0.014425
  • 25.000000 -0.488762 -0.015210 0.008519
  • 27.000000 -0.244390 -0.016824 0.004624
  • 30.000000 -0.017465 -0.017438 0.000756

23
Euler Angles
See http//mathworld.wolfram.com/EulerAngles.html
We will restrict ourselves to static aligned
rotations. Assuming that we have three
rotations Rx, Ry and Rz about the three static
axis. These rotations together can be used to
represent any desired 3D rotation M.
M Rx(?)Ry(?)Rz(?) The three
angles are called Euler angles and these are the
ones stored in the MS3D file.
24
Euler Angles issues
  • Euler angles are fine for many applications but
    have some problems when one would like to find
    intermediate positions between two different
    Rotation states (i.e. key frames).
  • A well known problem called gimbal lock can
    occur.
  • This happens when certain values of the middle
    angle cause the other two to have the same
    effect.

25
So lets use Quaternions
  • First we convert from Euler angles to
    Quaternions.

We do all our processing in this form as we
animate the model.
26
Converting to Matrix form
  • In order to get the graphics pipeline to perform
    a rotation we need to have it in matrix form.
    So if q(w,x,y,z) is our quaternion the
    corresponding matrix is
Write a Comment
User Comments (0)
About PowerShow.com