Chapter 5 Geometric Transformations for Computer Graphics Nitinan

  • Slides: 26
Download presentation
Chapter 5 Geometric Transformations for Computer Graphics Nitinan mata

Chapter 5 Geometric Transformations for Computer Graphics Nitinan mata

2 D Translation 2

2 D Translation 2

2 D Rotation 3

2 D Rotation 3

2 D Scaling 4

2 D Scaling 4

Homogeneous Coordinates April 2010 5

Homogeneous Coordinates April 2010 5

2 D Translation 2 D Rotation 2 D Scaling 6

2 D Translation 2 D Rotation 2 D Scaling 6

Inverse transformations: Composite translations: 7

Inverse transformations: Composite translations: 7

Composite Rotations: Composite Scaling: 8

Composite Rotations: Composite Scaling: 8

General 2 D Rotation Move to origin Rotate Move back 9

General 2 D Rotation Move to origin Rotate Move back 9

General 2 D Scaling Move to origin Scale Move back 10

General 2 D Scaling Move to origin Scale Move back 10

2 D Directional Scaling 11

2 D Directional Scaling 11

2 D Reflections April 2010 12

2 D Reflections April 2010 12

3 2 2 1 1 3 2 3 13

3 2 2 1 1 3 2 3 13

Geometric Transformations by Rasterization • The transformed shape needs to be filled. – A

Geometric Transformations by Rasterization • The transformed shape needs to be filled. – A whole scan-line filling is usually in order. • However, simple transformations can save new filling by manipulating blocks in the frame buffer. Translation: Move block of pixels of frame buffer into new destination. 14

90° counterclockwise rotation 180° rotation Rotated pixel block Destination pixel array RGB of destination

90° counterclockwise rotation 180° rotation Rotated pixel block Destination pixel array RGB of destination pixel can be determined by averaging rotated ones (as antialiasing) April 2010 15

3 D Transformations Very similar to 2 D. Using 4 x 4 matrices rather

3 D Transformations Very similar to 2 D. Using 4 x 4 matrices rather than 3 x 3. Translation April 2010 16

General 3 D Rotation 1. Translate the object such that rotation axis passes through

General 3 D Rotation 1. Translate the object such that rotation axis passes through the origin. 2. Rotate the object such that rotation axis coincides with one of Cartesian axes. 3. Perform specified rotation about the Cartesian axis. 4. Apply inverse rotation to return rotation axis to original direction. 5. Apply inverse translation to return rotation axis to April 2010 17

18

18

19

19

20

20

April 2010 21

April 2010 21

22

22

Efficient 3 D Rotations by Quaternions 23

Efficient 3 D Rotations by Quaternions 23

24

24

3 D Scaling Enlarging object also moves it from origin 25

3 D Scaling Enlarging object also moves it from origin 25

Scaling with respect to a fixed point (not necessarily of object) 26

Scaling with respect to a fixed point (not necessarily of object) 26