2
Computer graphics (Assignment) By: Farwa Abdul Hannan (12 CS 13) Zubaid Khalil (12 CS 22) Hassan Ali Khan (12 CS 28) Scaling: Scaling is the process of changing the size of a picture or object. It can be done in either compression or expansion. It consists of three scale factors 1. Sx for scaling of x-coordinates 2. Sy for scaling of y-coordinates 3. Sz for scaling of z-coordinates If the scaling factors are greater than 1 then the expansion in size will occur and if they are less than 1 then the compression in length will occur. If the values for Sx and Sy are negative then the mirror image can be created. For scaling, at the backend the scaled values for x and y coordinates are computed by using matrix multiplication. The matrix is known as scaling matrix and is like ---------- (1) 2D Scaling: For 2D scaling x and y components are used for scaling of x and y coordinates and scaling matrix for 2D scaling is ---------- (2) Here x and y are the values of the x-axis and y-axis where the object is placed and the Sx and Sy are the scaled values that is the value we want the object to be scaled at. These values are multiplied by using the matrix multiplication property and the computed values will be given out as x’ and y’. Example: Consider the values of x and y are 1 and 1 respectively for a rectangular object as shown below. And suppose the values of Sx & Sy are 3 & -2 respectively then putting them in eq. (2)

Scaling

Embed Size (px)

Citation preview

Computer graphics (Assignment) By: Farwa Abdul Hannan (12 – CS – 13)

Zubaid Khalil (12 – CS – 22)

Hassan Ali Khan (12 – CS – 28)

Scaling: Scaling is the process of changing the size of a picture or object. It can be done in either

compression or expansion. It consists of three scale factors

1. Sx – for scaling of x-coordinates

2. Sy – for scaling of y-coordinates

3. Sz – for scaling of z-coordinates

If the scaling factors are greater than 1 then the expansion in size will occur and if they are less

than 1 then the compression in length will occur. If the values for Sx and Sy are negative then the

mirror image can be created.

For scaling, at the backend the scaled values for x and y coordinates are computed by using matrix

multiplication. The matrix is known as scaling matrix and is like

---------- (1)

2D Scaling: For 2D scaling x and y components are used for scaling of x and y coordinates and scaling

matrix for 2D scaling is

---------- (2)

Here x and y are the values of the x-axis and y-axis where the object is placed and the Sx and Sy

are the scaled values that is the value we want the object to be scaled at. These values are multiplied

by using the matrix multiplication property and the computed values will be given out as x’ and

y’.

Example: Consider the values of x and y are 1 and 1 respectively for a rectangular object as shown

below.

And suppose the values of Sx & Sy are 3 & -2 respectively then putting them in eq. (2)

And after computation we’ve got new scaled values which are 3 and -2 so the shape will look like

the following.

3D Scaling: For 3D scaling x, y and z components are used for scaling of x, y and z coordinates and

scaling matrix for 3D scaling is

---------- (3)

Here x, y and z are the values of the x-axis, y-axis and z-axis where the object is placed and the

Sx, Sy and Sz are the scaled values that is the value we want the object to be scaled at. These

values are multiplied by using the matrix multiplication property and the computed values will be

given out as x’, y’ and z’.

Example: Consider the values of x, y and z are 3, 2 and 2 respectively for a rectangular object as shown

below.

And suppose the values of Sx, Sy & Sz are 1, 2 & 1 respectively then putting them in eq. (3)

And after computation we’ve got new scaled values which are 3, 4 and -2 so the shape will look

like the following.

Uniform & non-uniform scaling: If the values of Sx, Sy and Sz are same then the scaling is known as uniform scaling or

pure reflection and if both the values are not same then the scaling is known as non-uniform scaling

or differential scaling.