Beruflich Dokumente
Kultur Dokumente
Andrew J. Hanson
Computer Science Department
Indiana University
1
GRAND PLAN
I: Fundamentals of Quaternions
2
I: Fundamentals of Quaternions
Motivation
2D Frames: Simple example, complex numbers.
3D Frames: Rotations and quaternions.
3
II: Visualizing Quaternion Geometry
4
III: Quaternion Frames
5
IV: Clifford Algebras
6
Visualizing Quaternions
Part I: Fundamentals
of
Quaternions
Andrew J. Hanson
Indiana University
7
Part I: OUTLINE
Motivation
2D Frames: Simple example, complex numbers.
3D Frames: Rotations and quaternions.
8
Motivation
10
Task vs Strategy
11
Simple Example: 2D Rotations
12
Frames in 2D
^
N
^
T
13
Frames in 2D
^
N
^
T
14
Frames in 2D
^ ^
N
T
15
Frame Matrix in 2D
2 3
4 cos , sin :
5
sin cos
=
16
Another 2D Frame
17
The Belt Trick:
Is There a Problem?
18
Half-Angle Transform:
2 3
6
6
cos2
2 , sin
2
2 ,
2 cos sin
2
2 7
7
6 77
R2 ( ) = 6
6
6 sin cos2
, 2 77
6
4
2 cos
2 2 2 sin
2 7 5
19
Half-Angle Transform:
a2 + b2)2 = 1
(
21
Frame Evolution in 2D
23
Frame Evolution in (a; b):
^; N
Using the basis (T ^ ) we have Four equations with Three
24
Frame Evolution in (a; b):
_
^
But this formula for T is just N^ , where
2 3 2 32 3
,
N = 2 2 =
4 2ab
5 4 a ,b 54 ,b 5
a ,b b a a
^
or
2 32 32 3
N^ = ab ,ab
4 54 0
1
,1
0
54 a
b
5
25
2D Quaternion Frames!
_
^ _
^
Rearranging terms, both T and N eqns reduce to
2 3 2 3 2 3
4 a_ 5 = 1 4 0 ,
5 4a5
b
b
_ 2 + 0
26
2D Quaternions . . .
So one equation in the two quaternion variables (a; b) with
the constraint a2 + b2 = 1 contains both the frame equations
_
^
T ^
= + N
_
^
N = ,T^
) this is much better for computer implementation, etc.
27
Rotation as Complex Multiplication
28
Rotation with no matrices!
a + ib = ei=2
represents rotations more nicely than the matrices R( ).
( a 0
+ ib )(a + ib
0
) = e
i ( 0+ )=2
= A + iB
where if we want the matrix, we write:
2 3
R( )R() = R( + ) = 4 A2 , B 2 ,2AB 5
A2 , B 2
0 0
2AB
29
The Algebra of 2D Rotations
(
0 (a + ib )(a + ib)
a ; b ) (a; b) =
0 0 0
= a a , b b + i(a b + ab )
0 0 0 0
= (a a , b b; a b + ab )
0 0 0 0
= (A; B )
30
The Geometry of 2D Rotations
+
(a,b)
2 /2
/2
(1,0)
31
The Geometry of 2D Rotations
+
2
/2
(a,b)
/2 (1,0)
32
The Geometry of 2D Rotations
+
2
/2
/2 (a,b)
(1,0)
33
Quaternion Frames
In 3D, repeat our trick: take square root of the frame, but now
use quaternions:
35
The Geometry of 3D Rotations
36
The Geometry of 3D Rotations
37
Quaternion Frames . . .
R3(; n^) =
2 3
c n
66 + ( 1 , c) n1n2(1 , c) , sn3 n3n1(1 , c) + sn
)
2 (1
27
n n , c sn3 c + (n2)2(1 , c) n3n2(1 , c) , sn
64 1 2(1 )+
77
15
n1n3(1 , c) , sn2 n2n3(1 , c) + sn1 c + (n3)2(1 , c)
where c = cos , s = sin , and n
^ n
^ = 1.
38
Quaternion Frame Parameters
TrM = 1 + 2 cos
) solve for .
M , Mt =
2 3
6
0 ,2n3 sin +2n2 sin 7
4 +2n3 sin
6 0 ,2n1 sin 75
,2n2 sin +2n1 sin 0
1 0 0
= 0 1 0
0 0 1
11111111
00000000 x
00000000
11111111
z 00000000
11111111
00000000
11111111
40
Quaternions and Rotations
b
1111111
0000000 0110 ax
0000000
1111111
a
0000000
11111110000000000
1111111111 1010 ay
b
x
c
x
0000000
1111111
0000
11110000000000
1111111111 = b c
0000000
1111111
0000
11110000000000
1111111111 1010 az
y y
0000
1111 b
z
c
z
0000
1111
c 1111
0000
0000
1111
41
Quaternions and Rotations
b
111111
000000 0110 ax
000000
111111
000000
111111
000000000000
111111111111
a
1010 ay
b
x
c
x
000000
111111
000000111111111111
000000000000
111111
= b c
0000000
1111111
y y
0000000
1111111 1010 az b
z
c
z
0000000
1111111
c1111111
0000000
0000000
1111111
42
Quaternions and Rotations
b
11111
00000
00000
11111 0110 ax
00000
11111 b c
00000
11111
00000000000
11111111111
a
1010 ay
x x
00000
11111
0000000
111111100000000000
11111111111
00000
11111
= b c
0000000
1111111
y y
0000000
1111111 1010 az b
z
c
z
c 1111111
0000000
0000000
1111111
43
Quaternions and Rotations
00111100
b
11001100 0110 ax b c
1010 ay
x x
11001100 a = b c
00000000
11111111 11111111111
00000000000
y y
1010 az
c11111111
00000000 b c
z z
00000000
11111111
44
Quaternions and Rotations
b
1111111
0000000
0000000
1111111
a
0000000000
1111111111
0000000
1111111
0000000000
1111111111
a
x
b
x
c
x
0000000
1111111
00000
111110000000000
1111111111
0000000
1111111
= a b c
00000
11111
y y y
00000
11111
00000
11111
a
z
b
z
c
z
c11111
00000
00000
11111 y
1 0 0
^
n
= 0 1 0
= 111111111
000000000
111111111111 x
000000000000 0 0 1
000000000
111111111
000000000
111111111
z 111111111
000000000
000000000
111111111
45
Rotations and Quadratic Polynomials
2 3
Remember R2( ) = 4 a , b2 ,2ab
2
5?
2ab a2 , b2
What if we try a 3 3 matrix R3 instead of 2 2?
2 3
q
66 0 q , q , q 2q1q2 , 2q0q3 2q1q3 + 2q q
2+ 2
1
2
2
2
3 0 2 7
qq q q q02 , q12 + q22 , q32 2q2q3 , 2q q
64 2 1 2 + 2 0 3 77
0 1 5
2q1q3 , 2q0q2 2q2q3 + 2q0 q1 q02 , q12 , q22 + q32
coli colj = 0 for i 6= j
What is LENGTH of 3-vector column?
coli coli q2 q12 + q22 + q32)2
= ( 0 +
47
Quaternions and Rotations . . .
48
Quaternions and Rotations . . .
LOOK at
?
R3(; n^) = R3(q0; q1; q2; q3)
NOTICE: Choosing
q(; n^) = (cos ; n
^ sin )
2 2
50
Quaternions and Rotations . . .
= q0 0 0 + q20 q3 , 0
1 3 77
h 0
i 7
66 77 66
66 Q1 q 66 q0q1 + q1q0 q q2 777
= q0 0 0 + q30 q1 , 0
= 3
66 Q
64 2
h
q
i1 77
77 66 q q + q q
64 0 2 2 0 q1q3 7
7
75
= q0 00 03 01 02
q q3 + q q0 + q q2 , q q1
h 2
i 5
Q3 q
3
51
Algebra of Quaternions
= 3D Rotations!
52
Algebraic 2D/3D Rotations
(a ; b ) (a; b) = (a a , b b; a b + ab )
0 0 0 0 0 0
q q
0
q q , q1q1 , q2q2 , q3q3;
0
= ( 0 0
0 0 0
53
Algebra of Quaternions . . .
q
0q = (q00 q0 , q0 q
~
~;
0q
q0~ q0 + q0 q)
+ q0 ~ ~
~
54
Quaternions and Rotations
a + ib = ei=2
How? We set
= e
^=2)
(I n
56
Key to Quaternion Intuition
q0 = cos(=2); ~q = n^ sin(=2)
We also know that any coordinate frame M can be written
as M = R(; n
^ ).
Therefore
~q points exactly along the axis we have to rotate
around to go from identity I to M , and the length of
~q tells us how much to rotate.
57
Summarize Quaternion Properties
59
Quaternion Summary . . .
with n
^ a unit 3-vector, n
^ n
^ = 1. Then R(; n^) is usual
3D rotation by in the plane? to n^.
Inversion. Any 3 3 matrix R can be inverted for q up
to a sign. Carefully treat singularities! Can choose sign,
e.g., by local consistency, to get continuous frames.
60
SUMMARY
61