How do I scale a rectangle from a point other than the centre of the rectangle? Specifically, I am trying to determine the new X and Y position of a rectangle after having rescaled it, taking into account its old x and y, old width and height, new width and height, and a point other than the centre point of the rectangle.
2025-01-13 02:58:09.1736737089
Scale a rectangle from a point other than its center
2.1k Views Asked by Chris https://math.techqa.club/user/chris/detail At
2
When a rectangle is scaled, the distances from the point of scaling will be affected.
Consider the displacement of the rectangle $(x,y)$ from the point of scaling, $(x_0,y_0)$. This is a distance from the point of scaling. With a scale factor of $\lambda$, the difference vector would be multiplied by $\lambda$ to form $(\lambda(x-x_0),\lambda(y-y_0))$. Adding back $(x_0,y_0)$ results in $(\lambda(x-x_0)+x_0,\lambda(y-y_0)+y_0)$.
As the rectangle is scaled, the width and height will also be affected by $\lambda$ linearly. The new width $w=\lambda w_0$ and the new height $h=\lambda h_0$, where $w_0$ and $h_0$ are the original width and height of the rectangle.