Upload
jsunayana
View
221
Download
0
Tags:
Embed Size (px)
DESCRIPTION
2D
Citation preview
Outline2D Affine Transformations
2D Transformations
Dr. Rahul Rai
Department of Mechanical and Aerospace EngineeringUniversity at Buffalo - SUNY
February 24, 2014
Most of the figures are adopted from Foley/VanDam. Only few of the
figures have been created by course team!!!
Dr. Rahul Rai 2D Transformations
Outline2D Affine Transformations
2D Affine Transformations
Dr. Rahul Rai 2D Transformations
Outline2D Affine Transformations
2D Affine Transformations
I All represented as matrix operations on vectors! Parallel linespreserved, angles/lengths not
I TranslateI RotateI ScaleI ShearI Reflect
Translation Rotation Uniform scaling
Non-uniform scaling
Shearing Reflection
Dr. Rahul Rai 2D Transformations
Outline2D Affine Transformations
2D Affine Transformations
I Example 1: rotation and non uniform scale on unit cube
I Example 2: shear first in x, then in yI Note:
I Preserves parallelsI Does not preserve lengths and angles
Dr. Rahul Rai 2D Transformations
Outline2D Affine Transformations
2D Transforms: Translation
I Rigid motion of points to new locations
I Defined with column vectors:
Before translation After translation
Dr. Rahul Rai 2D Transformations
Outline2D Affine Transformations
2D Transforms: Scale
I Stretching of points along axis:
I In matrix form:
I or just:
Before scaling After scaling
Dr. Rahul Rai 2D Transformations
Outline2D Affine Transformations
Dr. Rahul Rai 2D Transformations
Outline2D Affine Transformations
I Rotation of points about the origin:x’=x cos θ − y sin θ
y’=x sin θ + y cos θ
I In matrix form:
I or just:
Before rotation After rotation
Dr. Rahul Rai 2D Transformations
Outline2D Affine Transformations
2D Transforms: Rotation
I Substitute the 1st two equations into the 2nd two to get thegeneral equation:x=r cosφ
y=r sinφx’=r cos(θ + φ) = r cosφ cos θ − r sinφ sin θy’=r sin(θ + φ) = r cosφ sin θ + r sinφ cos θ
Dr. Rahul Rai 2D Transformations
Outline2D Affine Transformations
Homogenous Coordinates
I Translation is treated differently from scaling and rotationP’=P+TP’=S*PP’=R*P
I Homogenous coordinates: allows all transformations to betreated as matrix multiplications
I Example: A 2D point (x,y) is the line (x,y,w), where w is anyreal number, in 3D homogenous coordinates.To get the point, homogenize by dividing by w (i.e., w=1)
Dr. Rahul Rai 2D Transformations
Outline2D Affine Transformations
Recall our Affine Transformations
Translation Rotation Uniform scaling
Non-uniform scaling
Shearing Reflection
Dr. Rahul Rai 2D Transformations
Outline2D Affine Transformations
Matrix representation of 2D Affine Transformations
I Translation:
I Scale:
I Rotation:
I Shear:
I Reflection:
Dr. Rahul Rai 2D Transformations
Outline2D Affine Transformations
Composition of 2D Transforms
I Rotate about a point P1I Translate P1 to originI RotateI Translate back to P1
I T (x1, y1)R(θ)T (−x1,−y1)
Dr. Rahul Rai 2D Transformations
Outline2D Affine Transformations
Composition of 2D Transforms
I Scale object around point P1I Translate P1 to originI ScaleI Translate back to P1
Dr. Rahul Rai 2D Transformations
Outline2D Affine Transformations
Composition of 2D Transforms
I Scale + rotate object around point P1 and move to P2I Translate P1 to originI ScaleI RotateI Translate back to P1
Dr. Rahul Rai 2D Transformations
Outline2D Affine Transformations
Composition of 2D Transforms
I Be sure to multiply transformations in proper order!
Dr. Rahul Rai 2D Transformations