Geometric Transformations for Computer Graphics Shmuel Wimer Bar
Geometric Transformations for Computer Graphics Shmuel Wimer Bar Ilan Univ. , School of Engineering April 2010 1
2 D Translation April 2010 2
2 D Rotation April 2010 3
2 D Scaling April 2010 4
Homogeneous Coordinates April 2010 5
2 D Translation 2 D Rotation 2 D Scaling April 2010 6
Inverse transformations: Composite translations: April 2010 7
Composite Rotations: Composite Scaling: April 2010 8
General 2 D Rotation Move to origin April 2010 Rotate Move back 9
General 2 D Scaling Move to origin April 2010 Scale Move back 10
2 D Directional Scaling April 2010 11
2 D Reflections April 2010 12
3 2 2 1 1 3 2 3 April 2010 13
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. April 2010 14
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 than 3 x 3. Translation April 2010 16
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 original position. April 2010 17
April 2010 18
April 2010 19
April 2010 20
April 2010 21
April 2010 22
Efficient 3 D Rotations by Quaternions April 2010 23
April 2010 24
3 D Scaling Enlarging object also moves it from origin April 2010 25
Scaling with respect to a fixed point (not necessarily of object) April 2010 26
- Slides: 26