Transformations and Matrices Transformations I Transformations are - - PDF document

transformations and matrices transformations i
SMART_READER_LITE
LIVE PREVIEW

Transformations and Matrices Transformations I Transformations are - - PDF document

Transformations and Matrices Transformations I Transformations are functions Matrices are functions representations Matrices represent linear transfs CS5600 Computer Graphics Lecture Set 5 by 2 x 2 Matrices == 2D Linear


slide-1
SLIDE 1

CS5600 1

Transformations I

CS5600Computer Graphics

by

Rich Riesenfeld 27 February 2002

Lecture Set 5

CS5600 2

Transformations and Matrices

  • Transformations are functions
  • Matrices are functions representations
  • Matrices represent linear transf’s
  • 2 x 2 Matrices == 2D Linear Transf’s

CS5600 3

What is a 2D Linear Transf ?

Recall from Linear Algebra: Definition: T(ax + y) = aT(x) + T(y) for scalar a and vectors x and y

CS5600 4

Example: Scale in x

Scale in x, by 2: (2 (xo + x1), y0 + y1) = (2xo, yo) + (2x1, y1)

CS5600 5

Example: Scale in x by 2

What is the graphical view?

CS5600 6

Scale in x by 2

y (x1, y1) (2 x1, y1) (x0, y0) (2 x0, y0) x

slide-2
SLIDE 2

CS5600 2

CS5600 7

( 2xo + 2x1, y0 + y1 )

y x

( 2 xo + 2 x1, y0 + y1 )

(2 x1, y1) (2 x0, y0)

CS5600 8

( 2 (xo + x1), y0 + y1 )

(x1, y1) (x0, y0) y x

(( xo + x1 ), y0 + y1 ) ( 2 (xo + x1), y0 + y1 )

CS5600 9

( 2 (xo + x1), y0 + y1 )

(( xo + x1 ), y0 + y1 ) ( 2 (xo + x1), y0 + y1 )

y x

CS5600 10

Summary on Scale

  • “Scale then add,” is same as
  • “Add then scale”

CS5600 11

Matrix Representation

Scale in x by 2:

2 0 0 1 x y

= 2x

y

CS5600 12

Matrix Representation

Scale in y by 2:

1 0 0 2 x y

= x

2y

slide-3
SLIDE 3

CS5600 3

CS5600 13

Matrix Representation

Overall Scale by 2:

2 0 0 2 x y

= 2x

2y

CS5600 14

Matrix Representation Showing Same

2 0 0 1 x0 + x1 y0 + y1 = 2(x0 + x1) y0 + y1

=

2x0 + 2x1 y0 + y1

CS5600 15

What about Rotation?

Is it linear?

CS5600 16

Rotate by θ

y x

(0,1)

θ

θ

(1,0)

CS5600 17

Rotate by θ: 1st Quadrant

y x

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

(1,0)

CS5600 18

Rotate by θ: 1st Quadrant

(1, 0) (cos θ , sin θ )

slide-4
SLIDE 4

CS5600 4

CS5600 19

Rotate by θ: 2nd Quadrant

(0,1)

θ

θ

(1,0)

y x

CS5600 20

Rotate by θ: 2nd Quadrant

y

(0,1)

x

sin θ cos θ θ θ

CS5600 21

Rotate by θ: 2nd Quadrant

(0, 1) (-sin θ , cos θ )

CS5600 22

Summary of Rotation by θ

(0, 1) (-sin θ , cos θ ) (1, 0) (cos θ , sin θ )

CS5600 23

Summary (Column Form)

       − ⇒         θ θ cos sin 1

        ⇒         θ θ sin cos 1

CS5600 24

Using Matrix Notation

      =             θ θ θ θ θ θ sin cos 1 cos sin sin

  • cos

      =             θ θ θ θ θ θ cos sin

  • 1

cos sin sin

  • cos

(Note that unit vectors simply copy columns)

slide-5
SLIDE 5

CS5600 5

CS5600 25

General Rotation by Matrix

      + =             θ θ θ θ θ θ θ cos sin ysin

  • cos

cos sin sin

  • cos

y x x y x

θ

CS5600 26

Who had linear algebra?

Who understand matrices?

CS5600 27

What do the off diagonal elements do?

CS5600 28

Off Diagonal Elements

      + =             y bx x y x b 1 1       + =             y ay x y x a 1 1

CS5600 29

Example 1

y       + =             = y x x y x y x T 4 . 1 4 . 1 ) , (

) 1 , ( ) , 1 (

) 1 , 1 (

) , (

S

x

CS5600 30

Example 1

x

y       + = y x x y x T 4 . ) , (

S

) 1 , ( ) , 1 ( ) 1 , 1 ( ) , (

slide-6
SLIDE 6

CS5600 6

CS5600 31

Example 1

y

) 1 , (

) 4 . , 1 (

) , (

T(S)

      + = y x x y x T 4 . ) , (

) 4 . 1 , 1 (

x

CS5600 32

Example 2

y       + =             = y y x y x y x T 6 . 1 6 . 1 ) , (

S

x

) 1 , ( ) , 1 ( ) 1 , 1 ( ) , (

CS5600 33

Example 2

x

y       + = y y x y x T 6 . ) , (

S

) 1 , ( ) , 1 ( ) 1 , 1 ( ) , (

CS5600 34

Example 2

x

y

) 1 , ( ) , 1 ( ) , (

T(S)

) 1 , 6 . (

      + = y y x y x T 6 . ) , (

) 1 , 6 . 1 (

CS5600 35

Summary

Shear in x: Shear in y:

      + =             = y ay x y x a Shx 1 1       + =             = y bx x y x b Shy 1 1

CS5600 36

Double Shear

      + =             ab) ( 1 1 1 1

1 1

b a a b       + =            

1 1

ab) ( 1 1 1 1 b a b a

slide-7
SLIDE 7

CS5600 7

CS5600 37

Sample Points: unit inverses

      =       −       1 1 1 1 b b       =      −       1 1 1

1

a a

CS5600 38

Geometric View of Shear in x

) , 1 (

) 1 , ( a −

) 1 , ( ) , 1 ( ) 1 , 1 (

Another Geometric View of Shear in x

39

x x

y y

Another Geometric View of Shear in x

40

x

y

CS5600 41

Geometric View of Shear in y

) 1 , ( ) , (

) , 1 ( b −

) 1 , ( ) , 1 ( ) , (

) 1 , 1 (

Another Geometric View of Shear in y

h h

42x

y

x

y

slide-8
SLIDE 8

CS5600 8

Another Geometric View of Shear in y

43

x

y

CS5600 44

“Lazy 1”

             

1 1 1

                           

= 1 1 y x y x

CS5600 45

Translation in x

             

1 y x

                           

+ = 1

1 1 1

y x d x x d

CS5600 46

Translation in x

             

1 y x

                           

+ = 1

1 1 1

y d y x d y

CS5600 47

Homogeneous Coordinates

             

1 1 1

                           

= 1 1 y x y x

CS5600 48

Homogeneous Coordinates for , ≠ ↔

                     

=

λ

λ λ λ

y x

y x

             

1 y x

slide-9
SLIDE 9

CS5600 9

CS5600 49

Homogeneous Coordinates

Homogeneous term effects overall scaling

0, For ≠ λ

                                                                                 

= = y x y x y x y x λ λ λ λ

λ λ

1 1 1 1

1 1

Homogeneous Coordinates

An infinite number of points correspond to (x,y,1). They constitute the whole line (tx,ty,t).

x w

y

w = 1 (tx,ty,t) (x,y,1)

CS5600 51

We’ve got Affine Transformations

Linear + Translation

CS5600 52

Next Class: Compound Transformations

  • Build up compound transformations

by concatenating elementary ones

  • Use for complicated motion
  • Use for complicated modeling