Transcript tutorial1

Rotations and Translations
Cherevatsky Boris
Mathematical terms

The inner product of 2 vectors a,b is defined as:
a   ax , a y , az  , b   bx , by , bz   a b  axbx  a y by  az bz

The cross product of 2 vectors is defined as:

A unit vector will be marked as:
X̂
Representing a Point 3D

A three-dimensional point
 px 


A
P   py 
 p z 
A is a reference coordinate system here
Representing a Point 3D (cont.)



Once a coordinate system is fixed, we can locate any
point in the universe with a 3x1 position vector.
The components of P in {A} have numerical values
which indicate distances along the axes of {A}.
To describe the orientation of a body we will attach a
coordinate system to the body and then give a
description of this coordinate system relative to the
reference system.
Example
YˆB
YˆA
B
1 
B
P  2
0
A
P
X̂ B
P?
30
X̂ A
A
PX  B PX cos(30 0 ) B PY sin( 30 0 )  0.866  2  0.5  0.134
PY  2.232
PZ  0.000
30
0.866  0.500 0.000 1   0.134






A
P  0.500 0.866 0.000 * 2  2.232 
0.000 0.000 1.000  0 0.000 
A
A
Description of Orientation
 Xˆ B  Xˆ A

A
A ˆ
A ˆ
A ˆ
XB
YB
Z B   Xˆ B  YˆA
BR 
ˆ ˆ
 X B  Z A
X̂ B is a unit vector in B

A

YˆB  Xˆ A Zˆ B  Xˆ A 

ˆ
ˆ
ˆ
ˆ
YB  YA Z B  YA 

YˆB  Zˆ A Zˆ B  Zˆ A 
X̂ B is a coordinate of a unit vector of
B in
coordinates system A (i.e. the projection of X̂ B
onto the unit direction of its reference)
YˆB
YˆA
X̂ B
X̂ A
Example

Rotating B relative to A around Z by 30
0.866  0.500 0.000


A
0.866 0.000
B R  0.500
0.000 0.000 1.000 
YˆB
YˆA
X̂ B
X̂ A
Example

In general:
cos 

A
B RZ     sin 
 0
 sin 
cos 
0
0

0
1
YˆB
YˆA
X̂ B

X̂ A
Using Rotation Matrices
A
P R P
A
B
B
Translation
A
P  P  PBORG
B
A
Ẑ B
Ẑ A
B
P
YˆB
A
YˆA
X̂ A
PBORG
X̂ B
Combining Rotation and
Translation
A
P R P  PBORG
A
B
B
A
YˆB
B
P
X̂ B
YˆA
A

P
A
X̂ A
PBORG
What is a Frame ?



A set of four vectors giving position and
orientation information.
The description of the frame can be thought
as a position vector and a rotation matrix.
Frame is a coordinate system, where in
addition to the orientation we give a position
vector which locates its origin relative to
some other embedding frame.
Arrows Convention


An Arrow - represents a vector drawn from
one origin to another which shows the
position of the origin at the head of the arrow
in terms of the frame at the tail of the arrow.
The direction of this locating arrow tells us
that {B} is known relative to {A} and not vice
versa.
Mapping a vector from one frame to another
– the quantity itself is not changed, only its
description is changed.
Example

Rotating a frame B relative to a frame A about Z axis
by 30degrees and moving it 10 units in direction of X
and 5 units in the direction of Y. What will be the
coordinates of a point in frame A if in frame B the
point is : [3, 7, 0]T?
0.866  0.500 0.000 3.000 10.000
A
P  0.500 0.866 0.000 7.000   5.000  
0.000 0.000 1.000  0.000  0.000 
- 0.902 10.000  9.098 
  7.562    5.000   12.562
 0.000   0.000   0.000 
Extension to 4x4

We can define a 4x4 matrix operator and use
a 4x1 position vector
  
 A P 
 
  
  
 1  0
A
B
R
0
0
 
A
PBORG   B P 
 
 
1  1 
Example

If we use the above example we can see that:
0.866  0.500 0.000 10.000
0.500 0.866 0.000 5.000 
A


T

B
0.000 0.000 1.000 0.000 


0
0
1 
 0
P in the coordinate system A
0.866  0.500 0.000 10.000 3.000  9.098 
0.500 0.866 0.000 5.000  7.000 12.562
A



P
0.000 0.000 1.000 0.000  0.000  0.000 


 

0
0
1  1   1 
 0
Formula
A
P T P
A
B
B
Compound Transformation
P T P
B
P T T P
A
C
A
A
A
B
A
B
B
B C
C
P T P
B
C
C
T T T
A
B
B
C
Several Combinations
1
T T T  T T T
U
D
U
A
1
D
A
U
B
T  T
U
A
A
U
T T T
U
C
U
A
D
A
T T T
U
C
U
B
B
C
1 D
C
T
B
C
D
C
1
Example
Example
 1.000
 0.000
A

BT 
 0.000

 0.000
3.000
 1.000 0.000 0.000
0.000 1.000 0.000

0.000 0.000 1.000 
0.000
0.000
0.500  0.866
 0.000
 0.000  0.866  0.500
B

CT 
 1.000 0.000
0.000

0.000
0.000
 0.000
0.000

0.000
2.000

1.000 
Notes


Homogeneous transforms are useful in
writing compact equations; a computer
program would not use them because
of the time wasted multiplying ones and
zeros. This representation is mainly for
our convenience.
For the details turn to chapter 2.
Euler Theorem


In three-dimensional space, any
displacement of a rigid body such that a
point on the rigid body remains fixed, is
equivalent to a single rotation about
some axis that runs through the fixed
point.
How can we compute the axis of
rotation? (Eigenvector corresponding to
eigenvalue 1).
Quaternions


The quaternion group has 8 members:
i,  j ,  k , 1
Their product is defined by the
equation:
i  j  k  ijk  1
2
2
2
Quaternions Algebra
We will call the following linear combination
Q  s  ia  jb  kc   s  v 
a quaternion. It can be written also as:
Q   s, a, b, c 
All the combinations of Q where a,b,c,s are
real numbers is called the quaternion
algebra.
Quaternion Algebra
By Euler’s theorem every rotation can be
represented as a rotation around some axis
K̂ with angle  .
In quaternion terms:
Rot ( Kˆ , )  (cos( 2 )  sin( 2 ) Kˆ )  (1,  2 ,  3 ,  4 )
Composition of rotations is equivalent to
quaternion multiplication.
Example
We want to represent a rotation around x-axis
by 90 , and then around z-axis by 90 :
(cos(45 )  sin(45 ) k )(cos(45 )  sin(45 )i) 
o
3 (i  j  k )
1
1
 2  2 (i  j  k )  cos(60 )  2

3
 (i  j  k )
o
Rot 
,120 
3


o
o
o
o
Rotating with quaternions
We can describe a rotation of a given vector v
around a unit vector u by angle  :
this action is called conjugation.
* Pay attention to the inverse of q (like in
complex numbers) !
Rotating with quaternions
The rotation matrix corresponding to a rotation
by the unit quaternion z = a + bi + cj + dk
(with |z| = 1) is given by:
Its also possible to calculate the quaternion
from rotation matrix:
Look at Craig (chapter 2 p.50 )
Rodrigues formula
We would like to rotate a vector v around a
unit vector u with angle  the rotated
vector will be:
vrot  v  cos   u  v  sin   u, v u  (1  cos  )