300 likes | 417 Views
Module 2. Prepared by Elizabeth Isaac DCS, RSET. 2D Transformations. Transformation is the back bone of computer graphics. 2D images uses lines, curves.. enables to manipulate the orientation, shape, size and location of the object. Translation Rotation Scaling Reflection Shearing.
E N D
Module 2 Prepared by Elizabeth Isaac DCS, RSET
2D Transformations Transformation is the back bone of computer graphics. 2D images uses lines, curves.. enables to manipulate the orientation, shape, size and location of the object. • Translation • Rotation • Scaling • Reflection • Shearing
Translation • Translation - repositioning an object along a straight-line path from one coordinate location to another. • Rigid-body transformation
Translation Translation distance – tx and ty (tx,ty)-Translation Vector or shift vector.
Rotation • Rotation - repositions an object along a circular path in the xy plane. Rotation angle- θ pivot point or rotation point (Xr,Yr)
R- rotation matrix X’=Xr+(X-Xr)COS θ –(Y-Yr)SIN θ Y’=Yr+(X-Xr)SIN θ+(Y-Yr)COS θ Translation and rotation move without deformation
2D Scaling Scaling transformation alter the size of an object. Scaling factor
2D Scaling • Scaling matrix
2D Scaling • Uniform scaling –same value • Differential scaling
Control the location of a scaled object by choosing a position called-fixed point (Xf ,Yf ).
Reflection • A reflection is a transformation that produces a mirror image of an object. • rotating the object 180 degrees about the reflection axis.
y x Reflection of an object about the x axis Reflection-About the x axis
y x Reflection of an object about the y axis Reflection-About the Y axis
3 2 1 1 3 2 With respect to the line y = x
2 1 3 2 1 3
Shear • A transformation that distorts the shape of an object such that the transformed shape appears as if the object were composed of internal layers that had been caused to slide over each other is called a shear
1 1 Initial object y y 1 1 3 2 shx = 2 x x Shear shear parameter shx
1 1 Initial object 3 y y 2 1 1 shy = 2 x x y-direction shear
y 1 1 x yref = -1 yref = -1 1 1 3 x 2 shx = ½, yref = -1 Shear-x-direction relative to other reference line
y 1 x 1 xref = -1 xref = -1 y 2 1 x 1 y-direction relative to other reference line