Lecture#5 Basics of 2D Transformations (Autosaved)
Lecture#5 Basics of 2D Transformations (Autosaved)
Lecture 5
Basics of 2D transformations
• Three basic transformations
i. Translation
ii. Scaling
iii. Rotation
Basics of 2D transformations
i. Translation
i. Moving from one position to other
ii. tx, ty are the translation parameters with respect to x-axis and y-axis
respectively
ii. Scaling
• Resizing the object
Maximize OR Minimize
• Sx, Sy are the scaling parameters with respect to x-axis and y-axis respectively
iii. Rotation
i. Clock-wise
ii. Anti-clock-wise
Translation
• Changing the position
• P(x,y) – Original point
• P’(x’,y’) – Point after translation
Two parameters tx,ty
• P’ = P + T
• x’ = x + tx
• y’ = y + ty
• [x’ y’] = [x y] + [tx ty]
Scaling
• Resize the object
• Max OR Min if Sx&Sy are in if p1k<0 then
between (0,1)
• Sx, Sy are the resizing parameters then yk+1 = yk
• P(x,y) – Original point before scaling • Point is closer so next point
to origin
• P’(x’,y’) – Point after scaling will be
• Size
• x’ = x . Sx decreases (xk+1, yk)
• y’ = y . Sy
• [x’ y’] = [x y]
Basic Trigonometric Equations
• Sin(A+B) = SinA.CosB + CosA.SinB
• Sina(A-B) = SinA.CosB - CosA.SinB
• Cos(A+B) = CosA.CosB – SinA.SinB
• Cos(A-B) = CosA.CosB + SinA.SinB
Rotation
Y
x P(x,y)
New Angle after rotating P to P’ = φ- θ y
r
x’ P’(x’,y’)
Cosφ = x / r
r
x = r Cosφ
φ y’
θ
Sinφ = y / r φ- θ
y = r Sinφ X
Similarly
Cos(φ – θ) = x’ / r
x’ = r Cos(φ – θ) =
Sin(φ – θ) = y’ / r
y’ = r Sin(φ – θ) =