Calculate Point Coordinates

As you can see, In the image a rectangle gets translated to another position in the coordinates System.

The origin Coordinates are A1(8,2) B1(9,3) from the length 7 and the height 3 you can also guess the vertices of the rectangle.

Now the Rectangle gets moved.

Now A1 is at A2(16,9) and B1 is located at B2(16,11).

It means that the rectangle got translated, rotated and stretched.

How can I calculate the Coordinates, of the left-upper corner?

enter image description here


I first tried to calculate the stretching-factor but then I got stuck when I trying to calculate the angle and translation

Thanks for your help


Solution 1:

This answer uses complex numbers.

We want to find $a,b,\theta\in\mathbb R$ where $0\lt\theta\lt \pi$ such that $$(16+9i)-(a+bi)=\sqrt 2(8+2i)(\cos\theta+i\sin\theta)$$ $$(16+11i)-(a+bi)=\sqrt 2(9+3i)(\cos\theta+i\sin\theta)$$ Then, solving $$16-a=\sqrt 2(8\cos\theta-2\sin\theta)$$ $$9-b=\sqrt 2(8\sin\theta+2\cos\theta)$$ $$16-a=\sqrt 2(9\cos\theta-3\sin\theta)$$ $$11-b=\sqrt 2(9\sin\theta+3\cos\theta)$$ gives $$a=10,\quad b=-1,\quad \theta=\frac{\pi}{4}$$

Thus, the coordinate you want is $$\sqrt 2(3+4i)\left(\cos\frac{\pi}{4}+i\sin\frac{\pi}{4}\right)+(10-i)=9+6i,$$ i.e. $$\color{red}{(9,6)}$$

Solution 2:

Your transformation contains translation (2 parameter), rotation (1 parameter) and stretching, which I hope means scaling (1 parameter).

This in general is no linear but an affine transform, except for the case that the origin gets mapped to the origin, which I doubt here.

The transform would be like this, using homogeneous coordinates: $$ T = \left( \begin{matrix} t_{11} & t_{12} & t_{13} \\ t_{21} & t_{22} & t_{23} \\ 0 & 0 & 1 \end{matrix} \right) \quad (*) $$

Assuming we first do the translation, then the roation, then the scaling we get a matrix: \begin{align} T &= T_\text{scale} \, T_\text{rot} \, T_\text{trans} \\ &= \left( \begin{matrix} s & 0 & 0 \\ 0 & s & 0 \\ 0 & 0 & 1 \end{matrix} \right) \left( \begin{matrix} \cos \theta & -\sin \theta & 0 \\ \sin \theta & \cos \theta & 0 \\ 0 & 0 & 1 \end{matrix} \right) \left( \begin{matrix} 1 & 0 & t_x \\ 0 & 1 & t_y \\ 0 & 0 & 1 \end{matrix} \right) \\ &= \left( \begin{matrix} s \cos \theta & -s \sin \theta & 0 \\ s \sin \theta & s \cos \theta & 0 \\ 0 & 0 & 1 \end{matrix} \right) \left( \begin{matrix} 1 & 0 & t_x \\ 0 & 1 & t_y \\ 0 & 0 & 1 \end{matrix} \right) \\ &= \left( \begin{matrix} s \cos \theta & -s \sin \theta & s(t_x \cos \theta - t_y \sin \theta) \\ s \sin \theta & s \cos \theta & s(t_x \sin \theta + t_y \cos \theta) \\ 0 & 0 & 1 \end{matrix} \right) \end{align}

Your two points give four equations, it might be enough to determine the four parameters $t_x, t_y, \theta, s$.

Inserting the points and their images $$ \left( \begin{matrix} s \cos \theta & -s \sin \theta & s(t_x \cos \theta - t_y \sin \theta) \\ s \sin \theta & s \cos \theta & s(t_x \sin \theta + t_y \cos \theta) \\ 0 & 0 & 1 \end{matrix} \right) \left( \begin{matrix} x_1 \\ y_1 \\ 1 \end{matrix} \right) = \left( \begin{matrix} x_2 \\ y_2 \\ 1 \end{matrix} \right) $$ leads to the equations $$ \cos \theta - \sin \theta = 0 \\ \sin \theta + \cos \theta = 2 $$ where the second one has no real solution. So this is not working.

Looking at the rectangle, the ratio of the sides seems to have changed.

This means we have \begin{align} T &= T_\text{scale} \, T_\text{rot} \, T_\text{trans} \\ &= \left( \begin{matrix} s & 0 & 0 \\ 0 & t & 0 \\ 0 & 0 & 1 \end{matrix} \right) \left( \begin{matrix} \cos \theta & -\sin \theta & 0 \\ \sin \theta & \cos \theta & 0 \\ 0 & 0 & 1 \end{matrix} \right) \left( \begin{matrix} 1 & 0 & t_x \\ 0 & 1 & t_y \\ 0 & 0 & 1 \end{matrix} \right) \\ &= \left( \begin{matrix} s \cos \theta & -s \sin \theta & 0 \\ t \sin \theta & t \cos \theta & 0 \\ 0 & 0 & 1 \end{matrix} \right) \left( \begin{matrix} 1 & 0 & t_x \\ 0 & 1 & t_y \\ 0 & 0 & 1 \end{matrix} \right) \\ &= \left( \begin{matrix} s \cos \theta & -s \sin \theta & s(t_x \cos \theta - t_y \sin \theta) \\ t \sin \theta & t \cos \theta & t(t_x \sin \theta + t_y \cos \theta) \\ 0 & 0 & 1 \end{matrix} \right) \end{align} And we end up with five parameters $t_x, t_y, \theta, s, t$ and only four equations.

This agrees with the six unknowns of equation $(*)$ and making use of the property of the rotation that $1 = \text{det}(R) = \cos^2 \theta + \sin^2 \theta$. I fail to spot a fifth equation so far.

Update: It seems the given data $A1, B1, A2, B2$ does not match the other part of the drawing, especially the original rectangle boundary and its transformed image.