0% found this document useful (0 votes)
23 views78 pages

Quaternions Explaination

The document discusses complex numbers and quaternions, detailing their definitions, operations, and applications in 2D and 3D rotations. It highlights the historical development of quaternions by Hamilton and compares their computational efficiency with matrices. The document emphasizes that unit quaternions can represent 3D rotations effectively, providing mathematical formulations for these transformations.

Uploaded by

phucanh1st
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views78 pages

Quaternions Explaination

The document discusses complex numbers and quaternions, detailing their definitions, operations, and applications in 2D and 3D rotations. It highlights the historical development of quaternions by Hamilton and compares their computational efficiency with matrices. The document emphasizes that unit quaternions can represent 3D rotations effectively, providing mathematical formulations for these transformations.

Uploaded by

phucanh1st
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Quaternions and

Complex Numbers

Dr. Scott Schaefer

1
Complex Numbers
n Defined by real and imaginary part
u a + bi where i = - 1

2/75
Complex Numbers
n Defined by real and imaginary part
u a + bi where i = - 1

(a + bi ) + (c + di ) = (a + c) + (b + d )i

3/75
Complex Numbers
n Defined by real and imaginary part
u a + bi where i = - 1

(a + bi ) + (c + di ) = (a + c) + (b + d )i

(a + bi )(c + di ) = ac + adi + bci + bdi 2

4/75
Complex Numbers
n Defined by real and imaginary part
u a + bi where i = - 1

(a + bi ) + (c + di ) = (a + c) + (b + d )i
(a + bi )(c + di ) = (ac - bd ) + (ad + bc)i

5/75
Complex Numbers
n Defined by real and imaginary part
u a + bi where i = - 1

x = a + bi x = a - bi

6/75
Complex Numbers
n Defined by real and imaginary part
u a + bi where i = - 1

x = a + bi x = a - bi

2
x x = (a + bi )(a - bi ) = a + b = x
2 2

7/75
Complex Numbers
n Defined by real and imaginary part
u a + bi where i = - 1

imaginary

( a, b)
real

8/75
Complex Numbers
n Defined by real and imaginary part
u a + bi where i = - 1

imaginary

( a, b)
real

9/75
Complex Numbers
n Defined by real and imaginary part
u a + bi where i = - 1

imaginary
a + bi = a 2 + b 2
( a, b)
real

10/75
Complex Numbers
n Defined by real and imaginary part
u a + bi where i = - 1

imaginary
a + bi = a 2 + b 2
( a, b)
q
real

11/75
Complex Numbers and Rotations
n Given a point (x,y), rotate that point about the
origin by q

12/75
Complex Numbers and Rotations
n Given a point (x,y), rotate that point about the
origin by q
æ xˆ ö æ cos(q ) - sin(q ) öæ x ö
çç ÷÷ = çç ÷÷çç ÷÷
è yˆ ø è sin(q ) cos(q ) øè y ø

13/75
Complex Numbers and Rotations
n Given a point (x,y), rotate that point about the
origin by q
æ xˆ ö æ cos(q ) - sin(q ) öæ x ö
çç ÷÷ = çç ÷÷çç ÷÷
è yˆ ø è sin(q ) cos(q ) øè y ø

( x + y i )(cos(q ) + sin(q ) i ) = ( x cos(q ) - y sin(q )) + ( x sin(q ) + y cos(q )) i

14/75
Complex Numbers and Rotations
n Given a point (x,y), rotate that point about the
origin by q
æ xˆ ö æ cos(q ) - sin(q ) öæ x ö
çç ÷÷ = çç ÷÷çç ÷÷
è yˆ ø è sin(q ) cos(q ) øè y ø

( x + y i )(cos(q ) + sin(q ) i ) = ( x cos(q ) - y sin(q )) + ( x sin(q ) + y cos(q )) i

Multiplication is rotation!!!

15/75
Quaternions – History
n Hamilton attempted to extend complex
numbers from 2D to 3D… impossible
n 1843 Hamilton discovered
a generalization to 4D and
wrote it on the side of a
bridge in Dublin

n One real part, 3 complex parts

16/75
Quaternions
i = -1
2

17/75
Quaternions
i = j = k = -1
2 2 2

18/75
Quaternions
i = j = k = -1
2 2 2

ij = k ji = -k jk = i kj = -i ki = j ik = - j

19/75
Quaternions
i = j = k = -1
2 2 2

ij = k ji = -k jk = i kj = -i ki = j ik = - j

q = ( s, v ) = s + v x i + v y j + v z k

20/75
Quaternion Multiplication
i = j = k = -1
2 2 2

ij = k ji = -k jk = i kj = -i ki = j ik = - j

q1 = ( s1 , v1 ) q 2 = ( s 2 , v2 )

21/75
Quaternion Multiplication
i = j = k = -1
2 2 2

ij = k ji = -k jk = i kj = -i ki = j ik = - j

q1 = ( s1 , v1 ) q 2 = ( s 2 , v2 )

q1q2 = ( s1s2 - v1 × v2 , s1v2 + s2 v1 + v1 ´ v2 )

22/75
Quaternion Multiplication
i = j = k = -1
2 2 2

ij = k ji = -k jk = i kj = -i ki = j ik = - j

q1 = ( s1 , v1 ) q 2 = ( s 2 , v2 )

q1q2 = ( s1s2 - v1 × v2 , s1v2 + s2 v1 + v1 ´ v2 )

q1q2 ¹ q2 q1

23/75
Quaternion Operations
i = j = k = -1
2 2 2

ij = k ji = -k jk = i kj = -i ki = j ik = - j

q = ( s ,-v )

24/75
Quaternion Operations
i = j = k = -1
2 2 2

ij = k ji = -k jk = i kj = -i ki = j ik = - j

q = ( s ,-v )

qq = ?

25/75
Quaternion Operations
i = j = k = -1
2 2 2

ij = k ji = -k jk = i kj = -i ki = j ik = - j

q = ( s ,-v )

q q = ( s * s - v × (-v), sv + s (-v) + v ´ v)

26/75
Quaternion Operations
i = j = k = -1
2 2 2

ij = k ji = -k jk = i kj = -i ki = j ik = - j

q = ( s ,-v )
2 2
qq = s + v = q
2

27/75
Quaternion Operations
i = j = k = -1
2 2 2

ij = k ji = -k jk = i kj = -i ki = j ik = - j

q -1q = 1
-1
q =?

28/75
Quaternion Operations
i = j = k = -1
2 2 2

ij = k ji = -k jk = i kj = -i ki = j ik = - j

q -1q = 1
-1 q
q =
| q |2

29/75
Quaternion Operations
i = j = k = -1
2 2 2

ij = k ji = -k jk = i kj = -i ki = j ik = - j

2
q q q | q |
q -1q = 2
q= 2
= 2
=1
|q| |q| |q|

30/75
Quaternions and Rotations
n Claim: unit quaternions represent 3D rotation

31/75
Quaternions and Rotations
n Claim: unit quaternions represent 3D rotation
p = (0, r )

32/75
Quaternions and Rotations
n Claim: unit quaternions represent 3D rotation
p = (0, r )
q = (cos(q ), sin(q )v) where v = 1

33/75
Quaternions and Rotations
n Claim: unit quaternions represent 3D rotation
p = (0, r )
q = (cos(q ), sin(q )v) where v = 1

(0, v) (0, v ´ v ^ )

(1,0) (0, v ^ )

34/75
Quaternions and Rotations
n Claim: unit quaternions represent 3D rotation
p = (0, v)
q = (cos(q ), sin(q )v) where v = 1

(0, v) (0, v ´ v ^ )

(1,0) (0, v ^ )

35/75
Quaternions and Rotations
n Claim: unit quaternions represent 3D rotation
p = (0, v)
q = (cos(q ), sin(q )v) where v = 1
qp = (cos(q ), sin(q )v)(0, v) = (- sin(q ), cos(q )v)
(0, v) (0, v ´ v ^ )
qp

q
(1,0) (0, v ^ )

36/75
Quaternions and Rotations
n Claim: unit quaternions represent 3D rotation
p = (0, v)
q = (cos(q ), sin(q )v) where v = 1
pq = (0, v)(cos(q ), sin(q )v) = (- sin(q ), cos(q )v)
(0, v) (0, v ´ v ^ )
pq

q
(1,0) (0, v ^ )

37/75
Quaternions and Rotations
n Claim: unit quaternions represent 3D rotation
^
p = (0, v )
q = (cos(q ), sin(q )v) where v = 1

(0, v) (0, v ´ v ^ )

(1,0) (0, v ^ )

38/75
Quaternions and Rotations
n Claim: unit quaternions represent 3D rotation
^
p = (0, v )
q = (cos(q ), sin(q )v) where v = 1
qp = (cos(q ),sin(q )v)(0,v ^ ) = (0,cos(q )v ^ + sin(q )v´v ^ )
(0, v) (0, v ´ v ^ )
qp

q
(1,0) (0, v ^ )

39/75
Quaternions and Rotations
n Claim: unit quaternions represent 3D rotation
^
p = (0, v )
q = (cos(q ), sin(q )v) where v = 1
pq = (0, v ^ )(cos(q ), sin(q )v) = (0, cos(q )v ^ - sin(q )v ´ v ^ )
(0, v) (0, v ´ v ^ )

(1,0) q
(0, v ^ )

pq
40/75
Quaternions and Rotations
n Claim: unit quaternions represent 3D rotation
p = (0, r )
q = (cos(q ), sin(q )v) where v = 1

(0, v) (0, v ´ v ^ )
(0,v)q = q (0,v) q (0, v ^ )

q
q (0, v ^ )
(1,0) q

(0, v ^ )q
41/75
Quaternions and Rotations
n Claim: unit quaternions represent 3D rotation
p = (0, r )
q = (cos(q ), sin(q )v) where v = 1
qp
(0, v) (0, v ´ v ^ )
qp p p q (0, v ^ )

q qp
q
(1,0) (0, v ^ )

42/75
Quaternions and Rotations
n Claim: unit quaternions represent 3D rotation
p = (0, r )
q = (cos(-q ),sin(-q )v) where v =1
(qp )q
(0, v) (0, v ´ v ^ )
qp p = (qp )q
p q (0, v ^ )

q qp
(1,0) q
(0, v ^ )

(qp )q
43/75
Quaternions and Rotations
n The quaternion representing rotation about
the unit axis v by q is q = (cos(q 2 ),sin(q 2 )v)
q (0, r )q

44/75
Quaternions and Rotations
n The quaternion representing rotation about
the unit axis v by q is q = (cos(q 2 ),sin(q 2 )v)
q (0, r )q
n To convert to matrix, assume q=(s,v) and
|q|=1
æ1 - 2v y 2 - 2v z 2 2v x v y - 2 sv z 2v x v z + 2 sv y 0ö
ç ÷
ç 2v x v y + 2 sv z 1 - 2v x 2 - 2v z 2 2v y v z - 2 sv x 0÷
ç 2 2 ÷
2 v
ç x z v - 2 sv y 2 v v
y z + 2 sv x 1 - 2 v x - 2v y 0÷
ç 0 0 0 1 ÷ø
è
45/75
Quaternions vs. Matrices
n Quaternions take less space (4 numbers vs. 9
for matrices)
n Rotating a vector requires 28 multiplications
using quaternions vs. 9 for matrices
n Composing two rotations using quaternions
q1q2 requires 16 multiples vs. 27 for matrices

n Quaternions are typically not hardware


accelerated whereas matrices are

46/75
Quaternions and Interpolation
n Given two orientations q1 and q2, find the
orientation halfway between

47/75
Quaternions and Interpolation
n Given two orientations q1 and q2, find the
orientation halfway between

48/75
Quaternions and Interpolation
n Unit quaternions represent points on a 4D
hyper-sphere
n Interpolation on the sphere gives rotations
that bend the least

49/75
Quaternions and Interpolation
n Unit quaternions represent points on a 4D
hyper-sphere
n Interpolation on the sphere gives rotations
that bend the least

sin(q (1 - t ))q1 + sin(q t )q2


q (t ) = where cos -1 (q1 × q2 ) = q
sin(q )

50/75
Quaternions and Interpolation
n Unit quaternions represent points on a 4D
hyper-sphere
n Interpolation on the sphere gives rotations
that bend the least
n May need to interpolate between q1 and q2

sin(q (1 - t ))q1 + sin(q t )q2


q (t ) = where cos -1 (q1 × q2 ) = q
sin(q )

51/75
Quaternions and Interpolation

Quaternion Interpolation

52/75
Quaternions and Interpolation

Quaternion Interpolation

53/75
Quaternions and Interpolation

Quaternion Interpolation

54/75
Quaternions and Interpolation

Quaternion Interpolation

55/75
Quaternions and Interpolation

Quaternion Interpolation

56/75
Quaternions and Interpolation

Quaternion Interpolation

57/75
Quaternions and Interpolation

Euler Angle Interpolation

58/75
Quaternions and Interpolation

Euler Angle Interpolation

59/75
Quaternions and Interpolation

Euler Angle Interpolation

60/75
Quaternions and Interpolation

Euler Angle Interpolation

61/75
Quaternions and Interpolation

Euler Angle Interpolation

62/75
Quaternions and Interpolation

Euler Angle Interpolation

63/75
Quaternions and Interpolation

Quaternion Interpolation Euler Angle Interpolation

64/75
Quaternions and Interpolation

Quaternion Interpolation Euler Angle Interpolation

65/75
Quaternions and Interpolation

Quaternion Interpolation Euler Angle Interpolation

66/75
Quaternions and Interpolation

Quaternion Interpolation Euler Angle Interpolation

67/75
Quaternions and Interpolation

Quaternion Interpolation Euler Angle Interpolation

68/75
Quaternions and Interpolation

Quaternion Interpolation Euler Angle Interpolation

69/75
Quaternions and Interpolation

Quaternion Interpolation Euler Angle Interpolation

70/75
Quaternions and Interpolation

Quaternion Interpolation Euler Angle Interpolation

71/75
Quaternions and Interpolation

Quaternion Interpolation Euler Angle Interpolation

72/75
Quaternions and Interpolation

Quaternion Interpolation Euler Angle Interpolation

73/75
Quaternions and Interpolation

Quaternion Interpolation Euler Angle Interpolation

74/75
Quaternions and Interpolation

Quaternion Interpolation Euler Angle Interpolation

75/75
76/75
Exponential Forms
n Euler’s formula
qi
u re = r (cos(q ) + sin(q )i )
imaginary

r
q
real

77/75
Quaternions in Exponential Form
eqv = (cos(q ), sin(q )v)

78/75

You might also like