Scaling in 3D is a straightforward extension of scaling in 2D. As in the 2D case, if Sx = Sy = Sz the object shapes are maintained, else they are distorted.
Scaling: x' = x * Sx y' = y * Sy z' = z * Sz (Sx 0 0 0) (x' y' z' 1) = (x y z 1) * (0 Sy 0 0) (0 0 Sz 0) (0 0 0 1)
As in 2D, if the object is not centered at the origin (0, 0, 0) the scaling transformation causes both size change and movement of the object. Scaling about a fixed point P0 (x0,y0,z0) can be accomplished by the following:
1. translating P0 to the origin
2. scaling the object
3. translating P0 back to original position.
so the composite matrix is = T(-x0,-y0,-z0)*(S(Sx,Sy,Sz))*(T(x0,y0,z0))
Inverse Scaling: replace Sx 1/Sx, Sy with 1/Sy, and Sz with 1/Sz, then S(S-1) = 1