0% found this document useful (0 votes)
66 views18 pages

2D Transformation Scaling Shearing

Scaling shearing

Uploaded by

khushiisaha2020
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
66 views18 pages

2D Transformation Scaling Shearing

Scaling shearing

Uploaded by

khushiisaha2020
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 18
2D Scaling in Computer Graphics Tr is used to alter or change the size of objects. The change is done using scaling factors. There are two scaling factors, ie. Sin x direction Sy in y- direction. If the original position is x and y. Sealing factors are Sx and Sy then the value of coordinates after scaling will be x’ and y. Scaling may be used to increase or reduce the size of object. Scaling subjects the coordinate points of the original object to change. Scaling factor determines whether the object size is to be increased or reduced. TF scaling factor » 1, then the object size is increased. TF scaling factor < 1, then the object size is reduced, Consider a point object O has to be scaled in a 2D plane. Let- Initial coordinates of the object © = (Xs, You) Scaling factor for X-axis = Se Scaling Factor for ¥-axi New coordinates of the object O after scaling = (Xvew, Yren) This scaling is achieved by using the following scaling equations- + Koon = Xa Si + Youn ® Yoit X Sy In Matrix form, the above scaling equations may be represented as- Scaling Matrix For homogeneous coordinates, the above scaling matrix may be represented as a 3.x 3 matrix as- Scaling Matrix (Homogeneous Coordinates Representation) Problem-01: Given a square object with coordinate points A(0, 3), B(3, 3), C(3, 0), B(O, 0). Apply the scaling parameter 2 towards X axis and 3 towards Y axis and obtain the new coordinates of the object. Solutior Given- + Old corner coordinates of the square = A (0, 3), 8(3, 3), €(3, 0), D(0, 0) + Scaling factor along X oxis = 2 = Sealing factor along ¥ axis = 3 For Coordinates A(O, 3) Let the new coordinates of corner A after scaling = (Xnew, Yeew). Applying the sceling equations, we have~ © Xnew = Xais x Ss + Yon = Yaa x 52 x20 x329 Thus, New coordinates of corner A after scaling = (0, 9). For Coordinates B(3, 3) Let the new coordinates of corner B after scaling = (Xnew, Ynew) Applying the scaling equations, we have- + Xeon Xa x S23 x26 = Yoon # Yau x S)2 3329 Thus, New coordinates of corner B after scaling = (6, 9). For Coordinates C(3, 0) Let the new coordinates of corner C after scaling = (Xrew, Yneu) ‘Applying the scaling equations, we have- + Moen = Xe x S23 x 226 = Yoow # Yas x $;20x3=0 Thus, New coordinates of corner C after scaling = (6, 0) For Coordinates D(O. 0) Let the new coordinates of corner D after scaling = (Xnew, Yreu). Applying the scaling equations, we have- © Xeon = Xo x Sez 0 x 250 + Ynow = Yas x Sy = Ox 3= 0 Thus, New coordinates of corner D after scalir = (0,0). Thus, New coordinates of the square after scaling = A (0, 9), B(6, 9). (6.0), D(O, 0). After Scaling Problem 2: Prove that 2D Scaling transformations are commutative ie, Sx S2=Se Si. Shearing in 2D Graphics Shearing deals with changing the shape and size of the 2D object along x-axis and y-anis. It is similar to sliding the layers in one direction to change the shape of the 2D object It isan ideal technique to change the shape of an existing object in a two dimensional plane. Ina two dimensional plane, the object size can be changed along X direction as well as Y disection. Shear nx shear, the y co-ordinates remain the same but the x co-ordinates changes, IFP(x. y) is the point then the new points will be P'(x’, y") given as — Matsis Fos: y-Shear : ny shear, the x co-ordinates remain the same but the y co-ordinates changes. IfP(s. y) i the ppoint then the new points will be P'(x’. y) given as — Sex Yoyeshyx Problem-01: Given a tiangle with points (1. 1), (0.0) and (1. 0). Apply shear parameter 2 on X axis and 2 ‘on Y axis and find out the new coordinates of the object. Homogeneous Coordinates ‘The rotation of a point, straight line or an entire image on the screen, about a point other than origin, is achieved by first moving the image until the point of rotation occupies the origin, then performing rotation, then finally moving the 1age to its originel po: The moving of an image from one place to another ina straight line is called a ‘translation. A translation may be done by adding or subtracting to each point, the amount, by which picture is required to be shifted. ‘Translation of point by the change of coordinate cannot be combined with other ‘transformation by using simple matrix application. Such a combination is essential if we wish to rotate an image about a point other than origin by translation, rotation again translation. To combine these three transformations into a single transformation, homogeneous coordinates are used. In homogeneous coordinate system, two- dimensional coordinate positions (x, y) are represented by triple-coordinates, Homogeneous coordinates are generally used in design and construction applications. Here we perform translations, rotations, scoling to fit the picture into proper position Example of representing coordinates into a homogeneous coordinate system: For two-dimensional geometric transfermation, we can choose hemogeneous parameter h to any non-zero value. For our convenience take it as one. Each two- dimensional position is then represented with homogeneous coordinates (x, y, 1). Following are matrix for two-dimensional transformation in homogeneous coordinate: 4. Translation 2. Scaling 3. Rotation (clockwise) ‘4. Rotation (anti-clock) 5.Reflection against X axis 6.Reflection against Y axis 7. Reflection against origin 8. Reflection against line 8 Reflection against x (i Bis bey a = is rs z n ty «| 4 4 : ° 4 : 10. Shearing in X direction She 11. Shearing in Y direction Composite Transformation: A number of transformations or sequence of transformations can be combined into single one called as composition. The resulting matrix is called as composite matrix. The process of combining is called as concatenation. Composition of two translations: Let ti tg ts teare translation vectors. They are two translations P: and Pz. The matrix of Pi and P2 given below. The Pi and Pzare represented using Homogeneous matrices and P will be the final transformation matrix obtained after multiplication. 10 ty ort oot Above resultant matrix show that two successive translations are adi Composition of two Rotations: Two Rotations are also additive Composition of two Scaling: The composition of two scoling is multiplicative. Let Su and Sizere matrix to be multiplied. wg oS S= Su ¥ Siz = Six (Ss-S2)-S:a(Ss-S4) (S182. 3-84)

You might also like