How can I calculate the origin of a scale transformation, given the starting and ending coords and dimensions?

1.1k Views Asked by At

Background:

I have two sets of coordinates/dimensions. One for the red rectangle and one for the blue rectangle, as shown below. The blue rectangle is quite simply the red rectangle transformed by a given scale factor.

enter image description here

Question:

Given that I know the coordinates for both the starting red rectangle and the resulting blue rectangle as well as the scale factor, how can I calculate the origin for this transformation?

e.g.

if the red rectangles coordinates/dimensions are as follows:

topleftX = 600
topleftY = 600
width = 400
height = 300

And the resulting blue rectangle needs to have the coordinates as follows:

 topleftX = 200
 topleftY = 200
 width = 2000
 height = 1500

I can calculate simply that the scale factor is 5

Given that scale factor, how can I calculate the origin of this transformation?

2

There are 2 best solutions below

1
On

The center of the red rectangle appears to be located at $p_{red} = \begin{bmatrix} 800 \\ 750 \end{bmatrix}$, and the blue rectangle at $p_{blue} = \begin{bmatrix} 1200 \\ 950 \end{bmatrix}$. So your amount of translation is given by $$ t = p_{blue} - p_{red} $$

0
On

You are trying to find what is called the "centre of enlargement."

Choose any corner on the blue rectangle and the corresponding corner on the red rectangle. Draw a straight line through them. Repeat with another corner. The point of intersection of these two lines is the centre of enlargement.