# 3d Scaling

The 2D and 3D scaling are similar, but the key difference is that the 3D plane also includes the z-axis along with the x and y-axis.

In scaling, we can expend or compress the size of any object. We can apply scaling on the object by multiplying the original coordinates with scaling factors.

The term scaling factor is used to define whether the size of the object is increased or decreased. We can represent the scaling factor by ‘Sxfor the x-axis, ‘Syfor the y-axis, and ‘Szfor the z-axis.

The increment and decrement of an object is depends on two conditions. They are-

If scaling factor (Sx, Sy, Sz) > 1, then the size of the object increased.

If scaling factor (Sx, Sy, Sz) < 1, then the size of the object decreased.

For Example: Let us assume,

The initial coordinates of object = P (x0, y0, z0)

Scaling factor for x-axis = Sx

Scaling factor for y-axis = Sy

Scaling factor for z-axis = Sz

The coordinates after Scaling = Q (x1, y1, z1)

We can represent the 3D Scaling in the form of equation-

X1 = x0. Sx

Y1 = y0. Sy

Z1 = z0. Sz

Matrix representation of 3D Scaling-

Example: A 3D object that have coordinates points P(1, 4, 4), Q(4, 4, 6), R(4, 1, 2), T(1, 1, 1) and the scaling parameters are 3 along with x-axis, 4 along with y-axis and 4 along with z-axis. Apply scaling to find the new coordinates od the object?

Solution: we have,

The initial coordinates of object = P (1, 4, 4), Q (4, 4, 6), R (4, 1, 2), S (1, 1, 1)

Scaling factor along with x-axis (Sx) = 3

Scaling factor along with y-axis (Sy) = 4

Scaling factor along with z-axis (Sz) = 4

Let the new coordinates after scaling = (x1, y1, z1)

For coordinate P-

x1 = x0 x Sx = 1 x 3 = 3

y1 = y0 x Sy = 4 x 4 = 16

z1 = z0 x Sz = 4 x 4 = 16

The new coordinates = (3, 16, 16)

For coordinate Q-

x1 = x0 x Sx = 4 x 3 = 12

y1 = y0 x Sy = 4 x 4 = 16

z1 = z0 x Sz = 6 x 4 = 24

The new coordinates = (12, 16, 24)

For coordinate R-

x1 = x0 x Sx = 4 x 3 = 12

y1 = y0 x Sy = 1 x 4 = 4

z1 = z0 x Sz = 2 x 4 = 8

The new coordinates = (12, 4, 8)

For coordinate S-

x1 = x0 x Sx = 1 x 3 = 3

y1 = y0 x Sy = 1 x 4 = 4

z1 = z0 x Sz = 1 x 4 = 4

The new coordinates = (3, 4, 4)

Thus, the new coordinates after scaling = P (3, 16, 16), Q (12, 16, 24), R (12, 4, 8), S (3, 4, 4).