CVF07 Lec05-06

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

3D Transformations

3D Translation
 Point in 3D given by (X1 Y1 Z1)
 Translated by (dx dy dz)

X2 = X1 + dx
Y2 = Y1 + dy
Z2 = Z1 + dz
Translation
 In matrix form

 X 2  1 0 0 dx   X 1 
 Y  0 1 0 dy   Y1 
 2=
 Z 2  0 0 1 dz   Z1 
    
 1  0 0 0 1  1 

Inverse Transformation

1 0 0 dx  1 0 0 − dx 
0 1 0 dy  0 1 0 − dy 
T= T −1 = 
0 0 1 dz  0 0 1 − dz 
   
0 0 0 1 0 0 0 1 

T T-1 = I
Scaling
 Point in 3D given by (X1 Y1 Z1)
 Scaled by (Sx Sy Sz)

X2 = X1 * Sx
Y2 = Y1 * Sy
Z2 = Z1 * Sz

Scaling
 In matrix form

 X 2   Sx 0 0 0  X 1 
 Y   0 Sy 0 0  Y 
 2=  1 
 Z 2   0 0 Sz 0  Z1 
    
 1   0 0 0 1  1 

S
Inverse Transformation

1 
 Sx 0 0 0  Sx 0 0 0
 0 Sy 0 0  1 
S=  0
S −1 = 
0 0
 0 0 Sz 0 Sy 
   1 
 0 0 0 1  0 0 0
0 Sz
 0 0 1

S S-1 = I

Shearing
 What will these do?
1 e 0 0 1 0 e 0 1 d e 0 1 d 0 0
0 1 0 0 0 1 0 0 0 1 0 0  e 1 0 0
      
0 0 1 0 0 0 1 0 0 0 1 0  0 0 1 0
      
0 0 0 1 0 0 0 1 0 0 0 1  0 0 0 1
3D Rotation
Y
 Rotation about Z-axis (x2 y2 z2)
 Z-coordinate will not
change
 Z’ = Z (x1 y1 z1)
θ
 If we ignore the Z-
coordinate, it is 2-D
transformation in XY X
plane
 X ' cosθ − sin θ 0 0  X 
 Y '   sin θ cosθ 0 0  Y  Z
 =  
 Z '  0 0 1 0  Z 
    
1  0 0 0 1  1 

Rotation
Y
 Positive rotation is (x2 y2 z2)

counterclockwise
when looking (x1 y1 z1)
down the axis of θ

rotation towards
origin X

Z
Rotation about Principal Axes
 Right hand rule
 XYZ is a right
handed system if:
 Place your right
wrist at the origin,
curl your fingers
from X to Y, thumb
should point along
+ve Z

Rotation about Principal Axes


Y Rotation about Z z Rotation about X x Rotation about Y

X y z

Z x y
X ' = X cosθ − Y sin θ Y ' = Y cosθ − Z sin θ Z ' = Z cosθ − X sin θ
Y ' = X sin θ + Y cosθ Z ' = Y sin θ + Z cosθ X ' = Z sin θ + X cosθ
Z'= Z X '= X Y'= Y
Rotation about Principal Axes
X ' = X cosθ − Y sin θ Y ' = Y cosθ − Z sin θ Z ' = Z cosθ − X sin θ
Y ' = X sin θ + Y cosθ Z ' = Y sin θ + Z cosθ X ' = Z sin θ + X cosθ
Z'= Z X '= X Y'= Y
Rotation about Z Rotation about X Rotation about Y
cosθ − sin θ 0 0 1 0 0 0  cos β 0 sin β 0
 sin θ cosθ 0 0 0 cos γ − sin γ 0  0 1 0 0
  
 0 0 1 0 0 sin γ cos γ 0 − sin β 0 cos β 0
     
 0 0 0 1 0 0 0 1  0 0 0 1

Concatenation of Rotations
 Rotation around X by γ followed by
rotation around Y by β followed by
rotation around Z by α

R = RαZ RβY RγX


Small Angle Approximation

Small angle approximation

Properties of Rotation Matrix


 Rotation Matrices are orthonormal
i.e. R R T = R TR = I [Proof?]
 3D rigid motion can be described by a
rotation and translation

 X '  r11 r12 r13   X  Tx 


 Y '  = r r22 r23   Y  + Ty 
   21
 Z '   r31 r32 r33   Z  Tz 
Properties of Rotation Matrix
 r11 r12 r13 
R = r21 r22 r23 
r31 r32 r33 
 R has 9 unknowns, but orthonormality
provides 6 constraints
3 3
0 i ≠ k
∑ r r
ij kj = ∑ r r
ji jk = 
j =1 j =1 1 i = k
 Hence the number of degrees of freedom of a
3D rotation are 9 – 6 = 3

Properties of Rotation Matrices


 Any concatenation of rotation matrices
also forms a rotation matrix i.e. the
matrix remains orthonormal [Proof?]
Properties of Rotation Matrices
 A rotation matrix transforms its own
rows onto the principal axes
 r11 r12 r13   r11  1  r11 r12 r13   r21  0
r r r23  r12  = 0?  r r r23  r22  = 1
 21 22      21 22    
 r31 r32 r33   r13  0  r31 r32 r33   r23  0
 r11 r12 r13   r31  0
r r r23  r32  = 0
 21 22    
 r31 r32 r33   r33  1

Rotation about Arbitrary Axis


 Any complex rotation can be described
by a single rotation around an axis n by
an angle θ [Proof?]
 Therefore, any complex rotation can be
described by [n1, n2, n3]T and θ
 Still 3 degrees of freedom as n can be
taken to be a unit vector without any
loss of generality
n12 + n22 + n32 = 1
Rotation about Arbitrary Axis
 To rotate about an axis n by an angle
θ
1. Set up rotations such that n rotates
onto one of the principal axis [How?]
2. Rotate about that axis by θ
3. Undo the transformations in step 1

Rotation about Arbitrary Axis


 Question: Given an arbitrary 3D rotation
matrix, how can we find out the axis n and
the angle θ that represents this rotation?

 - 0.8256 0.40388 - 0.39404 Given R on the left, how


- 0.20084 - 0.86294 - 0.46367 can we tell n and θ?
 
 - 0.5273 - 0.30367 0.79356 
Eigenvectors and Values of a
Rotation Matrix
 3D rotation matrix has eigenvalues of 1,
cosθ + i sinθ and cosθ -i sinθ [Proof?]
 The eigenvector associated with the
real eigenvalue represents the axis of
rotation [proof?]

Rodrigues’ Formula
 Alternate description of a rotation matrix
 Assume we want to rotate a vector v about n
by angle θ so that v transforms to v’

n
v'

v
Rodrigues’ Formula
 v can be decomposed into two components,
v|| and v⊥
 v|| is the component of v parallel to n
 v⊥is the component of v perpendicular to n

n v'

n v'
Rodrigues’ Formula
v
 v = v|| + v⊥ (Eq 1)

 v|| = [projection of v on n]
 v|| = (v.n)n

 v⊥ from Eq 1
 v⊥ = v - (v.n)n
 1st component (v||) is invariant under rotation
 2nd component (v⊥) will rotate to v’⊥
Rodrigues’ Formula
 Claim:
 v’⊥= v⊥cosθ + (n x v⊥) sinθ v'
n

n x v⊥
v’⊥
v

θ
n θ
out v⊥
of paper
v’⊥ = (v - (v.n)n) cosθ + n x (v - (v.n)n) sinθ

Rodrigues’ Formula
 v’ = v’|| + v’⊥

 v’ = (v.n)n +
(v - (v.n)n) cosθ + n x (v - (v.n)n) sinθ
v'
n

θ
 v’ = (v.n)n + (v - (v.n)n) cosθ + n x (v - (v.n)n) sinθ
 v’ = v cosθ + (n x v) sinθ + (1- cosθ) (v.n)n
 v’ = v + (n x v) sinθ + (1- cosθ) (n x (n x v)) [show]
v'
n

You might also like