Lecture 4 - Transformations
Lecture 4 - Transformations
Transformations
Associate Professor
Dr. Ashraf Abdelaziz Taha
• Translations
• Scaling
• Rotation
-2-
Why Transformation
• Transformations are used to build or change a scene or to give the
description of a complex object that is composed of several parts
-4-
Translating a point from position P to
position P’ using a translation vector T.
-6-
Scaling
• Multiplying object positions (x, y) by scaling factors sx and sy to produce the
transformed coordinates (x’, y’):
x’ = sx . x y’ = sy . y
Scaling operation:
-7-
Uniform scaling:
Means the scalar is the same for all components
-8-
Non-uniform scaling: different scalars per component
-9-
Rotation
• A rotation R() repositions all points of an object by moving them
along a circular arc centered at the rotation point (xr , yr) by a given
rotation angle ()
Rotation of an object through angle θ around the axis point (xr , yr ) -10-
Rotation around the origin
P’ = R · P
-12-
Rotation is counterclockwise
-13-
Sequence of transformations for rotating an object around x axis -14-
Rotation around arbitrary point
• Idea
• Translate the object by the vector (-xr , -yr)
• Rotate around the origin
• Translate the rotated object back by the vector (xr , yr)
-15-
Rotation around an arbitrary point
-16-
Scaling around an arbitrary point
-17-
Two-Dimensional Translation Matrix
P’ = T(tx, ty) · P
-18-
Two-Dimensional Rotation Matrix
P’ = R(θ) · P
-19-
Translation
Translation of a point
-20-
Scaling
Uniform Scaling
-21-
Pipeline operations
• Scaling with a selected fixed position
-22-
Rotation
-23-