Lecture 6: Normal Transformations, 3D Transformations, Euler Angles - - PowerPoint PPT Presentation

lecture 6 normal transformations 3d transformations euler
SMART_READER_LITE
LIVE PREVIEW

Lecture 6: Normal Transformations, 3D Transformations, Euler Angles - - PowerPoint PPT Presentation

Lecture 6: Normal Transformations, 3D Transformations, Euler Angles COMPSCI/MATH 290-04 Chris Tralie, Duke University 2/2/2016 COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles Announcements Mini


slide-1
SLIDE 1

Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

COMPSCI/MATH 290-04

Chris Tralie, Duke University

2/2/2016

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-2
SLIDE 2

Announcements

◮ Mini Assignment 2 Out, Due Next Monday 11:55 PM ◮ Online notes coming soon... (for now slides)

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-3
SLIDE 3

Table of Contents

◮ Linear Functions Continued ⊲ Normal Transformations ⊲ Linear Equations ⊲ 3D Transformations / Euler Angles

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-4
SLIDE 4

Column Vector Walking Interpretation

    | | . . . | . . . |

  • v1
  • v2

. . .

  • vk

. . .

  • vN

| | . . . | . . . |               . . . ak . . .           = ak vk

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-5
SLIDE 5

Column Vector Walking Interpretation

    | | . . . |

  • v1
  • v2

. . .

  • vN

| | . . . |          a1 a2 . . . aN      =

N

  • i=1

ai vi Linear combination of column vectors!

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-6
SLIDE 6

Column Vector Walking Interpretation

−1 1 1 u v

  • =

−1

  • u +

1 1

  • v

X

Y v(1, 1) u(-1, 0)

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-7
SLIDE 7

Linear Function To Matrix Proof

⊲ Define a linear function L : x ∈ RN → y ∈ RM

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-8
SLIDE 8

Linear Function To Matrix Proof

⊲ Define a linear function L : x ∈ RN → y ∈ RM ⊲ Let Lj = L 1 k = j

  • therwise
  • , k = 1 to N
  • COMPSCI/MATH 290-04

Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-9
SLIDE 9

Linear Function To Matrix Proof

⊲ Define a linear function L : x ∈ RN → y ∈ RM ⊲ Let Lj = L 1 k = j

  • therwise
  • , k = 1 to N

   | | . . . | L1 L2 . . . LN | | . . . |          a1 a2 . . . aN      =

N

  • i=1

aiLi

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-10
SLIDE 10

Linear Function To Matrix Proof

⊲ Define a linear function L : x ∈ RN → y ∈ RM ⊲ Let Lj = L 1 k = j

  • therwise
  • , k = 1 to N

   | | . . . | L1 L2 . . . LN | | . . . |          a1 a2 . . . aN      =

N

  • i=1

aiLi ⊲ Recall that for a linear function: L(ax + by) = aL(x) + bL(y)

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-11
SLIDE 11

Linear Function To Matrix Example

f(x, y, z) = (x + y + 2z, 3x − 2y) f(1, 0, 0) = f(0, 1, 0) = f(0, 0, 1) =

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-12
SLIDE 12

Square Matrix Inverse

A−1A = I AA−1 = I

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-13
SLIDE 13

Square Matrix Inverse

A−1A = I AA−1 = I Example: A = 2 1

  • , A−1 =

0.5 1

  • COMPSCI/MATH 290-04

Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-14
SLIDE 14

Square Matrix Inverse

A−1A = I AA−1 = I Example: A = −1 1

  • , A−1 =

−1 1

  • COMPSCI/MATH 290-04

Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-15
SLIDE 15

Square Matrix Product Inverse

(AB)−1 = B−1A−1

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-16
SLIDE 16

Matrix Transpose

AT

ij = Aji

A : M × N ⇐ ⇒ AT : N × M

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-17
SLIDE 17

Matrix Transpose

AT

ij = Aji

A : M × N ⇐ ⇒ AT : N × M A =     | | . . . | . . . |

  • v1
  • v2

. . .

  • vk

. . .

  • vN

| | . . . | . . . |    

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-18
SLIDE 18

Matrix Transpose

AT

ij = Aji

A : M × N ⇐ ⇒ AT : N × M A =     | | . . . | . . . |

  • v1
  • v2

. . .

  • vk

. . .

  • vN

| | . . . | . . . |     AT =      −

  • v1

− −

  • v2

− . . . . . . . . . −

  • vN

−     

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-19
SLIDE 19

Matrix Transpose Example

A =   1 2 −2 3 4 5 −1 6 −4 3 2   AT =     1 6 2 4 −4 −2 5 3 3 −1 2    

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-20
SLIDE 20

Transpose of Product Matrix

(AB)T = BTAT Check dimensions!

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-21
SLIDE 21

Rotation Matrices Inverse

Rθ = cos(θ) − sin(θ) sin(θ) cos(θ)

  • COMPSCI/MATH 290-04

Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-22
SLIDE 22

Rotation Matrices Inverse

Rθ = cos(θ) − sin(θ) sin(θ) cos(θ)

  • R−1

θ

= R−θ = cos(θ) sin(θ) − sin(θ) cos(θ)

  • COMPSCI/MATH 290-04

Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-23
SLIDE 23

Rotation Matrices Inverse

Rθ = cos(θ) − sin(θ) sin(θ) cos(θ)

  • R−1

θ

= R−θ = cos(θ) sin(θ) − sin(θ) cos(θ)

  • R−1

θ

= RT

θ

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-24
SLIDE 24

Table of Contents

⊲ Linear Functions Continued ◮ Normal Transformations ⊲ Linear Equations ⊲ 3D Transformations / Euler Angles

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-25
SLIDE 25

Normal Transformations

cos(θ) − sin(θ) sin(θ) cos(θ) x y

  • =

x cos(θ) − y sin(θ) x sin(θ) + y cos(θ)

  • Before

After

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-26
SLIDE 26

Normal Transformations

2 1 x y

  • =

2x y

  • Before

After

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-27
SLIDE 27

Normal Transformations

Uh oh.... 2 1 x y

  • =

2x y

  • Before

After

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-28
SLIDE 28

Normal Transformation Corrected

P2 P1

Tangent Vector: T = P2 − P1 Normal Vector: N Treating as column vectors: T TN = 0

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-29
SLIDE 29

Normal Transformation Corrected

Given Transformation matrix A, transformed tangent vector is AP2 − AP1 = A(P2 − P1) = AT

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-30
SLIDE 30

Normal Transformation Corrected

Given Transformation matrix A, transformed tangent vector is AP2 − AP1 = A(P2 − P1) = AT Want to find a matrix G s.t. transformed normal GN is

  • rthogonal to AT

(AT)T(GN) = 0

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-31
SLIDE 31

Normal Transformation Corrected

(AT)T(GN) = 0

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-32
SLIDE 32

Normal Transformation Corrected

(AT)T(GN) = 0 T TATGN = 0

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-33
SLIDE 33

Normal Transformation Corrected

(AT)T(GN) = 0 T TATGN = 0 T T(ATG)N = 0

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-34
SLIDE 34

Normal Transformation Corrected

(AT)T(GN) = 0 T TATGN = 0 T T(ATG)N = 0 We know T TN = 0, so ATG = I Therefore, G = (AT)−1

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-35
SLIDE 35

Normal Transformation Corrected

A = 2 1

  • , G = (AT)−1 = A−1 =

0.5 1

  • Before

After

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-36
SLIDE 36

Normal Transformations Corrected

A = cos(θ) − sin(θ) sin(θ) cos(θ)

  • , G = (AT)−1 = (A−1)−1 = A

Before After

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-37
SLIDE 37

Normal Transformations Corrected

A = 3

2

1 1

  • , G = (AT)−1 =
  • 2

3

− 2

3

1

  • Before

After

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-38
SLIDE 38

Table of Contents

⊲ Linear Functions Continued ⊲ Normal Transformations ◮ Linear Equations ⊲ 3D Transformations / Euler Angles

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-39
SLIDE 39

Linear Equations Geometric Interpretation

Ax = b

  • v1
  • v2

s t

  • =

b

X

Y

v1 v2 b s*v1 t*v2

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-40
SLIDE 40

Linear Equations Geometric Interpretation

Ax = b What if A has more rows than columns?

X

Y

v1 v2 b Z

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-41
SLIDE 41

Linear Equations Geometric Interpretation

Ax = b What if A has more rows than columns? (ATA)x = (ATb)

X

Y

v1 v2 b Z

Least Squares solution / Pseudoinverse

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-42
SLIDE 42

Table of Contents

⊲ Linear Functions Continued ⊲ Normal Transformations ⊲ Linear Equations ◮ 3D Transformations / Euler Angles

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-43
SLIDE 43

3D Scale X

  2 1 1     x y z   =   2x y z  

2 1

X

  • 1
  • 1

1

Y

2 1

  • 1

2

Z

Before

2 1

X

  • 1
  • 1
  • 0.5

0.5 1

Y

1.5 2 1.5 1 0.5

  • 0.5
  • 1

2

Z

After

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-44
SLIDE 44

3D Flip XZ

  −1 1 −1     x y z   =   −x y −z  

2 1

X

  • 1
  • 1

1

Y

2 1

  • 1

2

Z

Before

2 1

X

  • 1
  • 1
  • 0.5

0.5 1

Y

1.5 2 1.5 1 0.5

  • 0.5
  • 1

2

Z

After

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-45
SLIDE 45

X Shear Along Y

  1 1 1 1     x y z   =   x + y y z  

2 1

X

  • 1
  • 1

1

Y

2 1

  • 1

2

Z

Before

2 1

X

  • 1
  • 1
  • 0.5

0.5 1

Y

1.5 2 1.5 1 0.5

  • 0.5
  • 1

2

Z

After

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-46
SLIDE 46

X Shear Along Y and Z

  1 1 1 1 1     x y z   =   x + y + z y z  

2 1

X

  • 1
  • 1

1

Y

2 1

  • 1

2

Z

Before

3 2.5 2 1.5

X

1 0.5 0.5 1 1.5

Y

2 1.5 1 0.5 2

Z

After

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-47
SLIDE 47

X Shear Along Y, Y Shear Along Z

  1 1 1 1 1     x y z   =   x + y y + z z  

2 1

X

  • 1
  • 1

1

Y

2 1

  • 1

2

Z

Before

2 1

X

  • 1
  • 1
  • 0.5

0.5 1

Y

1.5 2 1.5 1 0.5

  • 0.5
  • 1

2

Z

After

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-48
SLIDE 48

X Shear Along Y, Y Shear Along Z

  1 1 1 1 1     x y z   =   x + y y + z z   Interactive Demo

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-49
SLIDE 49

3D Homogenous Coordinates

A =     A11 A12 A13 Tx A21 A22 A23 Ty A31 A32 A33 Tz 1    

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-50
SLIDE 50

3D Homogenous Coordinates

A =     A11 A12 A13 Tx A21 A22 A23 Ty A31 A32 A33 Tz 1     A x 1

  • =

    A3×3x +   Tx Ty Tz   1    

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-51
SLIDE 51

2D Rotation Matrix Design: Review

X

Y

cos(θ) sin(θ) θ cos(θ) θ

  • sin(θ)

cos(θ) − sin(θ) sin(θ) cos(θ)

  • COMPSCI/MATH 290-04

Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-52
SLIDE 52

Rotation About X

RX(γ) =   1 cos(γ) − sin(γ) sin(γ) cos(γ)  

X,X' Y Z Y' Z'

γ γ

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-53
SLIDE 53

Rotation About Y

RY(β) =   cos(β) sin(β) 1 − sin(β) cos(β)  

X Y,Y' Z X' Z' β β

This one hurts the brain a little

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-54
SLIDE 54

Rotation About Z

RZ(α) =   cos(α) − sin(α) sin(α) cos(α) 1  

X Y Z,Z'

α α

X' Y'

Just like the normal 2D XY rotation

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-55
SLIDE 55

Euler Angles

Can chain these matrices together in any order, such as RZYX = RX(γ)RY(β)RZ(α) RXYZ = RZ(α)RY(β)RX(γ) Resulting matrix is always orthogonal

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-56
SLIDE 56

Euler Angles: Raffle Point Question

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-57
SLIDE 57

Euler Angles: Raffle Point Question

How many degrees of freedom to reach any 3D orientation? Give me a reason

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-58
SLIDE 58

Euler Angles: Raffle Point Question

How many degrees of freedom to reach any 3D orientation? Give me a reason ⊲ Each column of the matrix is a unit vector

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-59
SLIDE 59

Euler Angles: Raffle Point Question

How many degrees of freedom to reach any 3D orientation? Give me a reason ⊲ Each column of the matrix is a unit vector ⊲ Every pair of columns is orthogonal. In matrix language, ATA = I

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles

slide-60
SLIDE 60

Euler Angles

Euler Angles Demo

COMPSCI/MATH 290-04 Lecture 6: Normal Transformations, 3D Transformations, Euler Angles