You are on page 1of 62

TUTORIAL on QUATERNIONS Part I

Luis Ib nez a August 13, 2001


A This document was created using LYX and the LTEX Seminar style.

Introduction
Quaternions are commonly used to represent rotations. They were introduced by William Hamilton (1805-1865) [1] Quaternions were conceived as Geometrical Operators A Complete Calculus of Quaternions was introduced by Hamilton [2]

q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

qrs q q r r s s q r s lim q 0 r 0 s 0 M dq dr ds

Denition of Vector

A Vector is a line segment with orientation Vector MN represents the relative position of point N with respect to point M

Hamiltons Motivation for Quaternions

Create a Mathematical Concept to represent The RELATIONSHIP between two VECTORS. In the same way that a Vector represent The RELATIONSHIP between two POINTS.

q s q2 dh dq

Vector applied dw Point to dx


dy

Given : Point M and a Vector V


q

dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy qrs r s s q r s 0 s 0 M dq dr ds

M V

The application of the Vector over the Point Results in a q q r


lim q 0 r

N V

Unique Point N

y h w q s q2 dh Quaternion applied to Vector dq dw dx dy dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

In the same way, Hamilton wanted that given


q

Vector V and a Quaternion Q The application of the Quaternion over the Vector Results in a Unique Vector W

qrs q q r r s s q r s lim q 0 r 0 s 0 dq dr ds

Q V W

Quatenion Rationale
A vector is completly dened by Length Orientation In order to dene a vector in terms of another vector a Quaternion has to represent Relative Length Relative Orientaton

dq q dq q dq 1 dq q dq 1 Denition of Scalar q dq q dq 1 A Scalar is z f x as dened y f the The ratio betweenx y lengths of two PARALLEL vectors A and B qrs q q r r s s q r s lim q 0 r 0 s 0 dq dr ds

B A

S = Scale

It represents the RELATIVE LENGTH of one vector with respect to the other.
Note that in programming jargon scalar has mistakenly taken the place of real

Scalar - Vector Operations


A B A Scalar S is the Quotient between two PARALLEL vectors A and B A A Scalar is an Operator that Changes the SCALE of the vector Keeps its orientation unchanged Application the Scalar Operator is noted by the symbol
9

S B

dy dq 1 q dq q dq 1 1 dq q dqDenition of a Versor q dq q dq 1 A Versor is dened as z f xy The quotient between x y non-parallel vectors of EQUAL LENGTH f two q r sA q q r r s s q r s lim q 0 r 0 s 0 dq dr ds

It represents the RELATIVE ORIENTATION of one vector with respect to the other.

10

Versor - Vector Operations


A B A Versor V is the Geometric Quotient between two non-parallel vectors of EQUAL LENGTH A and B A A Versor is an operator that Changes the ORIENTATION of the vector Keeps its length unchanged Application of the Versor Operator is noted by the symbol
11

dx dy dq 1 q dq q dq 1 Right Versors dq q dq 1 A Right Versor is a Versor that applies a 90 rotation q dq q dq 1 z f xy V f xy qrs q q r r s s q r s lim q 0 r 0 s 0 dq dr ds

Vector length is left unchanged as in any other Versor application

12

dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

Composing Versors
A V3 V1 C
V3 V2 V1 Versor composition is the consecutive application of two versors operators. It is noted by the symbol

qrs q r r s s q r s r 0 s 0 dq dr ds

A B

V2

V1 C V2 V1 C V3 C

V2

A A

13

dw dx dy dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy qrs r r s s B q r s 0 s 0 dq dr ds

Composing Right Versors


V

A B
A

V V V V

B A B

B 1
B

V V

1 is the INVERSION operator that inverts the direction of a vector. The double application of a right versor to a vector, inverses the vector.

14

Denition of Quaternion
A B A Quaternion is the Geometrical Quotient of two vectors A and B A A Quaternion is an operator that Changes the ORIENTATION of the vector Changes the LENGTH of the vector Application of the Quaternion Operator is noted by the symbol
15

Q B

Quaternion Characteristics
Axis(Q) = Unit Vector perpendicular to the plane of rotation Angle(Q) = Angle between the vectors in the quotient Index(Q) = In a Right Quaternion is the Axis(Q) multiplied by the length ratio of the two vectors in the quotient.

16

Representation of Quaternions
Quaternion = A set of Four From the Latin Quaternio the Greek The combined operation of Scalar and Versor requires 4 numbers: 1 for Scale 1 for Angle 2 for Orientation (common plane) Quaternion = Scalar combined with Versor
17

dh dq dw dx Opposite Quaternions dy dq 1 has an Opposite quaternion O Q q dq The quaternion Q q dq 1 dq q dq 1 A A Q OQ Q dq q dq 1 B B z f xy f xy

qrs q r r s s q r s 0 r 0 s 0 A dq dr ds

B O(Q) Q A

18

dw dx dy dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

Opposite Quaternion Properties


Angle Q Axis Q Angle O Q Axis O Q

qrs q r r s s q r s 0 r 0 s 0 A dq dr ds

B O(Q) Q A

19

dy dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

Reciprocal Quaternions
B
A

A qrs q r r s s q r s 0 r 0 s 0 dq dr ds

R(Q) Q

B The quaternion Q has a Reciprocal quaternion R Q RQ Q


1

B A

Their composition (one quaternion applied after the other) is Q RQ 1

The 1 operator is an Identity Operator that leaves vectors unchanged.


20

q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

dq dw dx Conjugate Quaternion dy dq 1 q dq The geometric reection of vector B q dq 1 B (the denominator) over vector dq q dq 1 A (the numerator) will be vector q dq q dq 1 Q C z f xy f xy

qrs q q r r s s q r s 0 r 0 s 0 dq dr ds

C Given the pair of vectors A and B qrs and their quotient q q r r s s q r s A Q lim q 0 r 0 s 0 B dq dr ds

B A Q

21

dq q dq q dq 1 dq q dq 1 q dq q dq 1 Conjugate Quaternion z f xy f xy The Conjugate of Quaternion Q is C dened as the quotient K Q qrs q A K Q lim q C q r 0 r r s s q r s K(Q) 0 s 0 dq dr ds

B A Q

Angle Q Axis Q

Angle K Q Axis K Q

22

dw dx dy Norm ofdq Quaternion a 1 q dq The Norm is the composition of 1 Quaternion with its Conjugate a q dq dq q dq 1 N Q Q K Q q dq q dq 1 B A Q z f xy A f xy Q B qrs C K Q q q r r s s A q r s lim q 0 r 0 s 2 0 A dq dr ds A C C B A B B

K(Q)

N Q

23

dw dx dy dq 1 Norm of q Quaternion a dq q dq 1 dq q dq 1 The rotation of the Conjugate K qQ dq 1 q dq A compensates the rotation of the f x y z quaternion Q. f xy K(Q) qrs q q r r s s The operator N Q produce a q r s lim q 0 Q parallel vector, hence N r is 0 s 0 dq always a positive Scalar operator dr ds

24

q2 dh dq dw dx dy The Square dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

Square of a Quaternion
of a Quaternion is dened as : Applying the quaternion twice B
A
2

Q C Q B

qrs q q r r s s q r s q 0 r 0 s 0 dq dr ds

Q Q Q

Q C

Q Q C
C

Q Q Q
25

C C

q q dq 1 z f xy f xy qrs r s s q r s 0 s 0 dq dr dsB

Composing Right Quaternions


A D

The succesive application of a Right Quaternion over a Vector results in a Vector in the opposite direction. A B
2

B B

C E

D E

D E

The square of any right quaternion is a NEGATIVE scalar operator


26

Versor of a Quaternion
Versor of a Vector = Unit vector parallel to the vector A A Versor of a Quaternion = Quotient of the Versors of the vectors U A U B

U A

U Q

A B

A B

It is the part of the Quaternion that represents Relative Orientation

27

Tensor of a Quaternion
Tensor of a Vector = Length of the vector T A A

Tensor of a Quaternion = Quotient of the tensor of the vectors T T A B A B

T Q

A B

It is the part of the Quaternion that represents Relative Sscale

28

Tensor and Versor of a Quaternion


Versor operator applies VERSION to a vector Changes vectors orientation Tensor operator applies TENSION to a vector Stretches the vector and change its length

29

Tensor and Versor of a Quaternion


A Vector can be decomposed in Versor and Tensor parts A T A U A A A

A Quaternion can be decomposed in Versor and Tensor parts T T Q T Q U Q T B U B A U A

30

dx dy dq 1 q dq q dq 1 Vector - Arcs dq q dq 1 q dq q dq 1 Versors can be represented on the f x y z surface of a unit sphere. f xy qrs A V B q q r r s s q r s Application of versor V will lim q 0 r 0 s 0 move point B to point A dq dr ds

V A

The Maximum Arc joining points B and A is dened as Vector-Arc

31

dx dy dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

Sliding Vector - Arcs


In the same way that Vectors can be translated on a plane

qrs q r r s s q r s r 0 s 0 dq dr ds Vector arcs can freely slide along the great circle and still represent the SAME Versor.
32

dx dy dq 1 Composition of q dq Biplanar Versors q dq 1 dq q dq 1 A q dq q dq 1 VBA B z f xy A composed with f xy qrs B VCB Cq q r r s s q r s results in the versor lim q 0 r 0 s 0 dq dr ds A B A VCA B C C

VBA B

VCA VCB C

33

dw dx dy Multiplication and Division of Diplanar Versor dq 1 q dq 1 The Spherical Triangle ABCq used to dene versor operations is dq dq q dq 1 analogously to how the parallelogram is used for vector operations q dq q dq 1 Multiplication of Versors as z f xy A f xy VCA VBA VCB VBA qrs q q r r s s Division of Versors as q r s V VBA qCA 0 r 0 s 0 lim VCB like the difference of vectors dq dr ds like the sum of vectors

VCA VCB C

34

dy dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

Versor Composition is Non-Commutative

qrs q r r s s A q r s r 0 s 0 dq dr ds

C B C

C A A C A

The resulting versors VCA and VA C have the same angle but different axis (and so, different planes)

35

dw dx dy dq 1 q dq Composition of two Orthogonal Right Versors q dq 1 dq q dq 1 The multiplication of two dq q dq 1 A q orthogonal Right Versors produce af x y z Right Versor orthogonal to them f x y VCB VBA VCA qrs q q r r s s An when the order is reversed q r s C lim q 0 r 0 s 0 dq dr ds VCA VBA VCB

36

w q s q2 dh dq dw dx dy dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

Square of Elementary Versors


The Square of an operator is the operator applied twice

qrs q q r r s s q r s im q 0 r 0 s 0 dq dr ds

i i=i

i = 1
1 Operator

The square of Right Versors is always the

37

dw dx dy dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

Elementary Versors
Composition of Elementary Versors

j
right-hand self i i j j k k 1 1 1

qrs r r s s q r s 0 s 0 dq dr ds

i k

i j j k k i

k i j

38

dh dq dw dx dy dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

Index of Right Quaternions


The Index of a Right Quaternion is

qrs r r s s q r s r 0 s 0 dq dr ds

S<1

S=1

S>1

the Axis of the quaternion Scaled by the ratio of lengths

39

Sum of Versors
Versors are Quotients. They can be summed ONLY when they have a COMMON DENOMINATOR

VBC VBA

C B A B

VBC

VBA

C B

A B

C B

A Common Denominator can ALWAYS be found

40

dy dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

Getting a Common Denominator

qrs q r r s s q r s 0 r 0 s 0 dq dr ds

B V BA A V DC C D

VBA

A B

VDC

C D

41

dx dy dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

Getting a Common Denominator


Slide both versors along their great circles

B B A D C

qrs q r r s s A q r s 0 r 0 s 0 dq dr ds

C
Until their origins coincide

The vector B in the intersection is the common denominator


42

dw dx dy dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

Geometrical Interpretation of the Sum


As with Vectors, rst SLIDE both Vector-Arcs to a common origin

qrs q r r s s q r s 0 r 0 s 0 dq dr ds In order to get a common denominator


43

dx dy dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

Geometrical Interpretation of the Sum


Add the two vectors in the numerator

qrs q r r s s q r s 0 r 0 s 0 dq dr ds Finally get the new Quotient

44

dq

dw dx dy dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

Sum of two Right Versors


It is always a right quaternion

qrs r r s s q r s 0 s 0 dq dr ds

H/2 H/2

Its plane BISECTS those of the original two versors and has a Scalar characteristic
45

dw dx dy dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy
H/2 H/2

Sum of two Right Versors


The Index of the resulting Versor

qrs r r s s q r s 0 s 0 dq dr ds

H/2 H/2

is equal to the sum of indices of the two versors

46

q2 dh dq dw dx dy dq 1 q dq q dq 1 dq q dq 1 dq q dq 1 z f xy f xy

Multiplying a Right Versor by a Scalar


Multiplication by a Scalar affects only the Scalar part of the Right Versor

qrs r r s s q r s r 0 s 0 dq dr ds

S<1

S=1

S>1

It modies the length ration of the vectors in the Quotient


47

dq dw dx Right Versor in terms of Orthogonal Right Versor dy dq 1 If the three Orthogonal Right Versors i j k are multiplied by Scalars x y z q dq q dq 1 Q x i y j z k x2 y2 z2 1 dq q dq 1 dq q dq 1 z f xy f xy

qrs q r r s s q r s 0 r 0 s 0 dq dr ds

Their sum will be a Right Versor whose axis has x y z as componets.


48

dy dq 1 q dq q dq 1 dq q dq 1 Scalarqand Right Parts of Quaternions dq q dq 1 z f xy A Quaternion operator applied to a vector B f xy


performs an operation that produces another vector A

qrs A Q q q r r s s B q r s lim q 0 r 0 s 0 dq dr ds A Q B

A Q B

49

q dq q dq 1 f xy f xy

Scalar and Right Parts of Quaternions


The new vector A can be expressed as a sum of two orthogonal vectors

qrs r s s q r s B R 0 s 0 dq dr ds

BS

BR

BS

One parallel to B and another orthogonal to B

50

q dq 1 z f xy f xy qrs r s s q r s 0 s 0 dq dr ds

Scalar and Right Parts of Quaternions

A BR B BS B

B S is obtained by applying an Scalar Operator to B

B R is obtained by applying a Right Quaternion to B

51

q dq dq q dq 1 dq q dq 1 z f xy f xy

Tensor and Versor Part of a Quaternion


The same operation can be decomposed in a Tensor Operator and a Versor Operator

qrs r r s s q r s r 0 s 0 dq dr ds

A T B
BT T B

A V BT B
A V

BT

BT

52

Scalar and Right versus Tensor and Versor


SCALAR and RIGHT parts are a Representation in RECTANGULAR coordinates TENSOR and VERSOR parts are a Representation in POLAR coordinates

53

dq q dq 1 qQuaternions dqFour Coefcients dq q as 1 z f xy f xy Let L be the Ratio of lenghts between vectors A and B is L qrs q qBr r s s S S q r s B R B lim q should be equal to s 0 0 r 0 dq dr ds
L cos The Scalar factor

A B

BS

54

dq q dq 1 qQuaternions dqFour Coefcients dq q as 1 z f xy f xy Let L be the Ratio of lenghts between vectors A and B is L qrs q qBr r s s R R q r s B R B lim q should be equal to s 0 0 r 0 dq dr ds
L sin The Tensor of he Right part

A B

BS

55

Quaternions as Four Coefcients


The Quaternion Q can then be written as Q Where w x2 y2 z2 L cos L sin xi yj zk w

The real number w represents the Scalar part, The sum x i yj z k represents the Right part.

56

Product of Quaternions
Two quaternions Q1 and Q2 are composed by Q1 Q2 That is equivalent to Q1 Q2 T Q1 T Q2 U Q1 U Q2 T Q1 U Q1 T Q2 U Q2

57

Product of Quaternions
Given a Quaternion Q resulting from the composition Q Its Tensor is T Q Its Versor is U Q U Q1 U Q2 T Q1 T Q2 Q1 Q2

58

Representation by four coefcients


Let P and Q be two Quaternions, represented by four coefcients P Q xp i xq i yp j yq j zp k zq k wp wq

Their composition P Q can be expressed by wp P Q LPQ zp yp xp zp wp xp yp yp xp wp zp xp yp zp wp xq yq zq wq

59

Representation by four coefcients


Let P and Q be two Quaternions, represented by four coefcients P Q xp i xq i yp j yq j zp k zq k wp wq

Their composition P Q can be expressed by wq P Q RQP zq yq xq zq wq xq yq yq xq wq zq xq yq zq wq xp yp zp wp

60

Rotating a Vector (Finally !!)


A Quaternion q x y z w rotates a Vector v by using the product v q v q
1 1

Which can be reduced to a Matrix-Vector multiplication L q R q


w2 x2 2xy 2xz 0 y2 2wz 2wy z2 w2

2xy x2 2yz 0

2wz y2 2wx z2 w2

2xz 2yz x2 0

2wy 2wx y2 z2 w2 x2

0 0 0 y2 z2

61

References
[1] W.R. Hamilton. Elements of Quaternions, volume I. Chelsea Publishing Company, third edition, 1969. The original was published in 1866. [2] C.J. Joly. A Manual of Quaternions. MacMillan and Co., Limited, 1905.

62

You might also like