Skip to main content

Scaling about arbitrary fixed point

Short answer

Translate fixed point to origin, scale, then translate back: M = [sx 0 xf(1-sx); 0 sy yf(1-sy); 0 0 1]. Transformed point: x' = x·sx + xf(1-sx), y' = y·sy + yf(1-sy).

Derive the 2D transformation matrix for scaling with respect to an arbitrary fixed point.

Scaling about the origin moves the object away from or toward the origin. To scale an object about a fixed point (xf, yf) so that this point stays unchanged, the object is moved so that the fixed point is at the origin, scaled, and then moved back.

Steps

  1. Translate the fixed point to the origin: T(−xf, −yf)
  2. Scale about the origin: S(sx, sy)
  3. Translate back: T(xf, yf)
M = T(xf, yf) · S(sx, sy) · T(−xf, −yf)

    | 1 0 xf |   | sx 0 0 |   | 1 0 −xf |
  = | 0 1 yf | · | 0 sy 0 | · | 0 1 −yf |
    | 0 0  1 |   | 0  0 1 |   | 0 0   1 |

Multiply the right two matrices:

| sx 0 −sx·xf |
| 0 sy −sy·yf |
| 0  0    1   |

Then the left matrix:

        | sx  0   xf(1 − sx) |
   M =  | 0   sy  yf(1 − sy) |
        | 0   0        1     |

So x' = x·sx + xf(1 − sx) and y' = y·sy + yf(1 − sy).

Check: for (x, y) = (xf, yf): x' = xf·sx + xf − xf·sx = xf, so the fixed point stays unchanged. Example: scaling by 2 about (4,2) gives x' = 2x − 4, y' = 2y − 2.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computer Graphics chapter 3 questions →