Skip to main content

3D scaling about arbitrary point

Short answer

Translate point A to origin, scale, then translate back. Composite matrix M = T(A) S(sx,sy,sz) T(-A) = [sx 0 0 xp(1-sx); 0 sy 0 yp(1-sy); 0 0 sz zp(1-sz); 0 0 0 1]. Coordinates transform as x' = sx·x + xp(1-sx), y' = sy·y + yp(1-sy), z' = sz·z + zp(1-sz).

Derive a three dimensional matrix expression to scale a point with respect to any arbitrary point A(Xp, Yp, Zp).

To scale about a fixed point A(xp, yp, zp) (so that A does not move): translate A to the origin, scale about the origin, then translate back.

M = T(xp, yp, zp) · S(sx, sy, sz) · T(−xp, −yp, −zp)

T(A)              S                T(-A)
| 1 0 0 xp |   | sx 0  0  0 |   | 1 0 0 -xp |
| 0 1 0 yp |   | 0  sy 0  0 |   | 0 1 0 -yp |
| 0 0 1 zp |   | 0  0  sz 0 |   | 0 0 1 -zp |
| 0 0 0 1  |   | 0  0  0  1 |   | 0 0 0  1  |

First S · T(−A):

| sx 0  0  -sx·xp |
| 0  sy 0  -sy·yp |
| 0  0  sz -sz·zp |
| 0  0  0   1     |

Then multiplying by T(A) on the left:

M = | sx 0  0  xp(1 - sx) |
    | 0  sy 0  yp(1 - sy) |
    | 0  0  sz zp(1 - sz) |
    | 0  0  0  1          |

Equations: x' = sx·x + xp(1 − sx), y' = sy·y + yp(1 − sy), z' = sz·z + zp(1 − sz).

Check: for P = A, x' = sx·xp + xp − sx·xp = xp, so the fixed point stays unchanged.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computer Graphics chapter 4 questions →