Scale a rectangle from a point other than its center

2.1k Views Asked by At

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.

2

There are 2 best solutions below

0
On BEST ANSWER

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.

0
On

It is by homothety/similitude, by similar and similarly placed polygons with respect to any arbitrary pole... in this case, a rectangle.

Homethically placed Rectangles

It is the top view of an eccentric 3D pyramid cut by a plane parallel to its base.

Similitude ratio or scale factor is the ratio of corresponding sides.