<p><strong>Regarding question 3:</strong></p>
<p>There are many ways to solve this problem. Some answers are <a href="https://math.stackexchange.com/q/186286/776637">here</a>  and <a href="https://math.stackexchange.com/q/557507/776637">here</a>. You can also create a system of equations by writing down the matrix multiplication symbolically.</p>
<p><span class="math-container">$$
X \cdot A = B
$$</span></p>
<p><span class="math-container">$X$</span> is the transformation matrix you are looking for, <span class="math-container">$A$</span> your matrix before the transformation, and <span class="math-container">$B$</span> the matrix after the transformation. So you can write:</p>
<p><span class="math-container">$$
\begin{bmatrix}
x_{11}&amp;x_{12}&amp;x_{13}\\
x_{21}&amp;x_{22}&amp;x_{23}\\
x_{31}&amp;x_{32}&amp;x_{33}
\end{bmatrix}
\cdot
\begin{bmatrix}
a_{11}&amp;a_{12}&amp;a_{13}\\
a_{21}&amp;a_{22}&amp;a_{23}\\
a_{31}&amp;a_{32}&amp;a_{33}
\end{bmatrix}
=\begin{bmatrix}
b_{11}&amp;b_{12}&amp;b_{13}\\
b_{21}&amp;b_{22}&amp;b_{23}\\
b_{31}&amp;b_{32}&amp;b_{33}
\end{bmatrix}
$$</span></p>
<p>with the individual matrix products being:</p>
<p><span class="math-container">$$
\begin{matrix}
b_{11} =&amp;x_{11}\cdot a_{11} + x_{12}\cdot a_{21} + x_{13}\cdot a_{31}\\
b_{12} =&amp;x_{11}\cdot a_{12} + x_{12}\cdot a_{22} + x_{13}\cdot a_{32}\\
b_{13} =&amp;x_{11}\cdot a_{13} + x_{12}\cdot a_{23} + x_{13}\cdot a_{33}\\\\
b_{21} =&amp;x_{21}\cdot a_{11} + x_{22}\cdot a_{21} + x_{23}\cdot a_{31}\\
b_{22} =&amp;x_{21}\cdot a_{12} + x_{22}\cdot a_{22} + x_{23}\cdot a_{32}\\
b_{23} =&amp;x_{21}\cdot a_{13} + x_{22}\cdot a_{23} + x_{23}\cdot a_{33}\\\\
b_{31} =&amp;x_{31}\cdot a_{11} + x_{32}\cdot a_{21} + x_{33}\cdot a_{31}\\
b_{32} =&amp;x_{31}\cdot a_{12} + x_{32}\cdot a_{22} + x_{33}\cdot a_{32}\\
b_{33} =&amp;x_{31}\cdot a_{13} + x_{32}\cdot a_{23} + x_{33}\cdot a_{33}
\end{matrix}
$$</span></p>
<p>or in matrix form:</p>
<p><span class="math-container">$$
\begin{matrix}
\begin{bmatrix}
a_{11}&amp;a_{21}&amp;a_{31}\\
a_{12}&amp;a_{22}&amp;a_{32}\\
a_{13}&amp;a_{23}&amp;a_{33}
\end{bmatrix}
\cdot
\begin{bmatrix}
x_{11}\\
x_{12}\\
x_{13}
\end{bmatrix}
=\begin{bmatrix}
b_{11}\\
b_{12}\\
b_{13}
\end{bmatrix}\\\\
\begin{bmatrix}
a_{11}&amp;a_{21}&amp;a_{31}\\
a_{12}&amp;a_{22}&amp;a_{32}\\
a_{13}&amp;a_{23}&amp;a_{33}
\end{bmatrix}
\cdot
\begin{bmatrix}
x_{21}\\
x_{22}\\
x_{23}
\end{bmatrix}
=\begin{bmatrix}
b_{21}\\
b_{22}\\
b_{23}
\end{bmatrix}\\\\
\begin{bmatrix}
a_{11}&amp;a_{21}&amp;a_{31}\\
a_{12}&amp;a_{22}&amp;a_{32}\\
a_{13}&amp;a_{23}&amp;a_{33}
\end{bmatrix}
\cdot
\begin{bmatrix}
x_{31}\\
x_{32}\\
x_{33}
\end{bmatrix}
=\begin{bmatrix}
b_{31}\\
b_{32}\\
b_{33}
\end{bmatrix}\\
\end{matrix}
$$</span></p>
<blockquote>
<p><strong>Watch out:</strong> the matrix here is transposed -&gt; <span class="math-container">$A^T$</span></p>
</blockquote>
<p>Now you have 9 equations for 9 unknowns that you can solve with Gaussian elimination, LU decomposition, or any other linear solver you are familiar with.</p>
<p>You might say that those are just 3x3 matrices and yours are 3x5. Adding those two columns yourself should be easy, but you actually don't need them to determine the matrix. It would give you an overdetermined system of equations. Just pick 3 columns instead (but the same from both matrices).</p>
<p>Note that if you combine the 3 matrix-vector equations into a single matrix-matrix equation, you basically end up with <a href="https://math.stackexchange.com/a/2040965/776637">something similar to this solution</a>. All you need to do is to multiply by the inverse of <span class="math-container">$A^T$</span> and then transpose everything. Then you have the same equation.</p>
<p>I wrote a short python script to check if everything is correct that I wrote:</p>
<pre class="lang-python prettyprint-override"><code>import numpy as np

a = np.array([[2, 5, 1], [1, 3, 1], [1, 1, 1], [3, 1, 1], [3, 3, 1]]).transpose()
b = np.array([[7, 0, 1], [9, 4, 1], [9, 8, 1], [5, 8, 1], [5, 4, 1]]).transpose()

# pick first 3 vectors
a_red = a[:, :3]
b_red = b[:, :3]

# solve for each row vector of x
x_1 = np.linalg.solve(a_red.transpose(), b_red.transpose()[:, 0])
x_2 = np.linalg.solve(a_red.transpose(), b_red.transpose()[:, 1])
x_3 = np.linalg.solve(a_red.transpose(), b_red.transpose()[:, 2])

# combine vectors to the transformation matrix we are looking for
x = np.array([x_1, x_2, x_3])
print(x)

# check if x*a yields b
b_check = np.matmul(x, a)
print(b_check)
assert np.allclose(b, b_check)
</code></pre>
<p>The assertion holds and the matrix looks like expected:</p>
<p><span class="math-container">$$
\begin{bmatrix}
x_{11}&amp;x_{12}&amp;11\\
x_{21}&amp;x_{22}&amp;10\\
0&amp;0&amp;1
\end{bmatrix}
$$</span></p>
<p>Seems like you swapped the numbers in <code>dx</code> and <code>dy</code> cause I got <code>dx=11</code> and <code>dy=10</code>. The first two rows of the last column represent the translation vector as <a href="https://web.cse.ohio-state.edu/%7Eshen.94/681/Site/Slides_files/transformation_review.pdf" rel="nofollow noreferrer">described here</a>.
The last row is <code>(0, 0, 1)</code> as it should be since we are not doing any transformation into the 3. dimension.</p>
<p>I left out the upper left 2x2 matrices for you to find out. As another hint, <span class="math-container">$x_{11}=x_{22}$</span> and <span class="math-container">$x_{12}=x_{21}$</span>. I think you will manage to figure them out. If you can't, just ask for help or run the python script but I recommend trying it yourself.</p>
<p><strong>Regarding question 2</strong></p>
<p>The usual forward order is scale, rotate, and translate for reasons I won't further explain. But this is not a &quot;rule&quot; and you can not rely on that. It is just the approach that makes the most sense for us humans. However, looking at the graphics and the calculated matrix, they followed this order.</p>
<p><strong>Regarding question 1</strong></p>
<p>Now with the information, I gave you for question 2, it should be obvious. Just pick the point Γ and follow it if you first apply the scaling, then the rotation, and finally the translation. If you manage this, you should also be able to just guess the remaining numbers of the matrix with all the information you got, at least if you understood all the involved substeps and the basic transformation matrices (<a href="https://web.cse.ohio-state.edu/%7Eshen.94/681/Site/Slides_files/transformation_review.pdf" rel="nofollow noreferrer">check this link again</a>). You will also see that <code>dx</code> and <code>dy</code> are indeed swapped in your question.</p>

CC BY-SA 4.0
2022-07-04T09:54:37.507Z
2022-07-04T10:11:48.147Z
2022-07-04T10:11:48.147Z
wychmaster
<p>This kind of problem is usually called shape matching. It is possible to deduce the transformation between two given sets of positions.</p>
<p>You can learn more about the shape matching here</p>
<p>Müller, Matthias, et al. &quot;Meshless deformations based on shape matching.&quot; ACM transactions on graphics (TOG) 24.3 (2005): 471-478.</p>
<p><a href="https://dl.acm.org/doi/abs/10.1145/1073204.1073216?casa_token=ByW2rb3f-VgAAAAA:6wMJ5MT3moK_0lRPZtDDxFI0B16Nw8b5hcI-dclZaUV3RDJgeMUYTR7Sk7vE-4qMQ_6wHmlxReh5" rel="nofollow noreferrer">https://dl.acm.org/doi/abs/10.1145/1073204.1073216?casa_token=ByW2rb3f-VgAAAAA:6wMJ5MT3moK_0lRPZtDDxFI0B16Nw8b5hcI-dclZaUV3RDJgeMUYTR7Sk7vE-4qMQ_6wHmlxReh5</a></p>
<p>(hint: no need to finish the whole paper. Section 3.3 is all you need)</p>
<hr />
<p>Just apply the paper idea here to your question as a concrete example.</p>
<p>Denote the source point set as <span class="math-container">$x^0_i$</span> (<span class="math-container">$i=1..5$</span>), and target point set as <span class="math-container">$x_i$</span>.
Let <span class="math-container">$t^0$</span> be the center of source points, and <span class="math-container">$t$</span> be the center of target points.</p>
<p>Let <span class="math-container">$q_i$</span> be the source point set minus the center: <span class="math-container">$q_i = x^0_i-t^0$</span>.
Similarly let <span class="math-container">$p_i$</span> be the target point set minus the center: <span class="math-container">$p_i=x_i -t$</span>.</p>
<p>Then suppose we have found a transformation <span class="math-container">$A = R S$</span> (rotation and scaling), and the transformation maps our source point set to <span class="math-container">$A q_i + t^0$</span>.
We want its distance to the target as small as possible. That is, minimize this:
<span class="math-container">$$
F = \sum_i (A q_i - p_i)^2
$$</span></p>
<p>In order to minimize <span class="math-container">$F$</span> we want to take derivative of <span class="math-container">$F$</span> and set it to 0 and then solve for A.
That should give you
<span class="math-container">$$
A =
(\sum_i p_i q_i^T)(\sum_i q_i q_i^T)^{-1}
$$</span></p>
<p>That <span class="math-container">$A$</span> is the transform associates the source and the target point sets.
Further take QR decomposition of <span class="math-container">$A$</span> should give you the rotation and scaling.</p>
<p>In your case, (I am dropping z coordinates)</p>
<p>Centers:</p>
<pre><code>t0={2, 13/5}
t={7, 24/5}
</code></pre>
<p>Coordinates with center translations removed:</p>
<pre><code>p={{0, 2, 2, -2, -2}, {-24/5, -4/5, 16/5, 16/5, -4/5}}
q={{0, -1, -1, 1, 1}, {12/5, 2/5, -8/5, -8/5, 2/5}}
</code></pre>
<pre><code>pq={{-8, 0}, {0, -112/5}}
qq={{4, 0}, {0, 56/5}}
A={{-2, 0}, {0, -2}}
</code></pre>
<p>Then the expression <code>A q + t</code> should give you the target point set.</p>
<hr />
<p>This should give you a general solution to this problem without visualizing it.</p>
<p>For your question on transformation order: you can freely specify the order as you want. (that <span class="math-container">$A q + t$</span> thing).</p>
<p>For your question on deriving the translation: it should be the center of target point set, i.e. <code>{7, 24/5}</code> assuming the rotation happens at the center.</p>
<p>If you expand the transformation a bit:
<span class="math-container">$$
\begin{align}
A q + t &amp;=
A (x^0 - t^0) + t \\
&amp;= A x^0 - A t^0 + t \\
&amp;= A x^0 + (- A t^0 + t)
\end{align}
$$</span>
The given solution might assume the rotation happens at the origin. In that case the translation is <span class="math-container">$(-A t^0 + t)$</span>, and it is <code>{11, 10}</code>.</p>

CC BY-SA 4.0
2022-07-04T00:07:11.993Z
2022-07-04T00:07:11.993Z
TheBusyTypist
<p>I am given this image:</p>
<p><a href="https://i.sstatic.net/elqIe.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/elqIe.png" alt="enter image description here" /></a></p>
<p>and asked to determine the transformation matrix that took me from ΑΒΓΔΕ(let's call it ABCDE for convenience) to Α'Β'Γ'Δ'Ε' (A'B'C'D'E').</p>
<p>I am also given the solution, so as to be able to verify my process.
From the image, I can easily tell that ABCDE has been scaled by 2, rotated by π, and transposed by some vector, in that order.</p>
<p>Question 1. The solution says that the values for the transposition are dx =10, dy=11. It is unclear to me how these values were extracted.</p>
<p>Question 2. I am unsure as to the order of the transformations. Is there any way to tell for sure? My guess happened to agree with the solution but it was just that, a guess.</p>
<p>Question 3. Possessing the matrices that express each object:</p>
<p><a href="https://i.sstatic.net/LMsDq.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/LMsDq.png" alt="enter image description here" /></a></p>
<p>is it possible to extract the transformation matrix if the image was not provided? and if so, how?</p>
<p>I am aware that I am posing multiple questions but they all concern one subject and are very related to each other. Any pointers would be helpful. Thanks.</p>
<p>(My classes are not in English, apologies if the terms do not match up very well)</p>

CC BY-SA 4.0
2022-07-04T00:27:31.993Z
I'd like to point you to this related question: https://computergraphics.stackexchange.com/questions/12817/convert-one-triangle-to-another-in-matrix4x4. If the transformation is supposed to be rigid, 5 points are not necessary. 3 points are sufficient to deduce the transform. If we want a transformation that associates the source and target as close as possible, then checkout my answer.
TheBusyTypist
<transformations><mathematics><matrix>
How to determine transformation matrix for an object given a graph?
riverwastaken
# How to determine transformation matrix for an object given a graph?

(Asked by: username_0 on 2022-07-03)

I am given this image:

[![enter image description here](https://i.sstatic.net/elqIe.png)](https://i.sstatic.net/elqIe.png)

and asked to determine the transformation matrix that took me from ΑΒΓΔΕ(let's call it ABCDE for convenience) to Α'Β'Γ'Δ'Ε' (A'B'C'D'E').

I am also given the solution, so as to be able to verify my process.
From the image, I can easily tell that ABCDE has been scaled by 2, rotated by π, and transposed by some vector, in that order.

Question 1. The solution says that the values for the transposition are dx =10, dy=11. It is unclear to me how these values were extracted.

Question 2. I am unsure as to the order of the transformations. Is there any way to tell for sure? My guess happened to agree with the solution but it was just that, a guess.

Question 3. Possessing the matrices that express each object:

[![enter image description here](https://i.sstatic.net/LMsDq.png)](https://i.sstatic.net/LMsDq.png)

is it possible to extract the transformation matrix if the image was not provided? and if so, how?

I am aware that I am posing multiple questions but they all concern one subject and are very related to each other. Any pointers would be helpful. Thanks.

(My classes are not in English, apologies if the terms do not match up very well)

**Tags:** transformations, mathematics, matrix

> **Comments:**
> **username_1**: I'd like to point you to this related question: https://computergraphics.stackexchange.com/questions/12817/convert-one-triangle-to-another-in-matrix4x4. If the transformation is supposed to be rigid, 5 points are not necessary. 3 points are sufficient to deduce the transform. If we want a transformation that associates the source and target as close as possible, then checkout my answer.  

---

## 2 answers

### Answer by username_2 on 2022-07-04. Score: 0 | Accepted answer

**Regarding question 3:**

There are many ways to solve this problem. Some answers are [here](https://math.stackexchange.com/q/186286/776637) and [here](https://math.stackexchange.com/q/557507/776637). You can also create a system of equations by writing down the matrix multiplication symbolically.

$$
X \cdot A = B
$$

$X$ is the transformation matrix you are looking for, $A$ your matrix before the transformation, and $B$ the matrix after the transformation. So you can write:

$$
\begin{bmatrix}
x\_{11}&x\_{12}&x\_{13}\\
x\_{21}&x\_{22}&x\_{23}\\
x\_{31}&x\_{32}&x\_{33}
\end{bmatrix}
\cdot
\begin{bmatrix}
a\_{11}&a\_{12}&a\_{13}\\
a\_{21}&a\_{22}&a\_{23}\\
a\_{31}&a\_{32}&a\_{33}
\end{bmatrix}
=\begin{bmatrix}
b\_{11}&b\_{12}&b\_{13}\\
b\_{21}&b\_{22}&b\_{23}\\
b\_{31}&b\_{32}&b\_{33}
\end{bmatrix}
$$

with the individual matrix products being:

$$
\begin{matrix}
b\_{11} =&x\_{11}\cdot a\_{11} + x\_{12}\cdot a\_{21} + x\_{13}\cdot a\_{31}\\
b\_{12} =&x\_{11}\cdot a\_{12} + x\_{12}\cdot a\_{22} + x\_{13}\cdot a\_{32}\\
b\_{13} =&x\_{11}\cdot a\_{13} + x\_{12}\cdot a\_{23} + x\_{13}\cdot a\_{33}\\\\
b\_{21} =&x\_{21}\cdot a\_{11} + x\_{22}\cdot a\_{21} + x\_{23}\cdot a\_{31}\\
b\_{22} =&x\_{21}\cdot a\_{12} + x\_{22}\cdot a\_{22} + x\_{23}\cdot a\_{32}\\
b\_{23} =&x\_{21}\cdot a\_{13} + x\_{22}\cdot a\_{23} + x\_{23}\cdot a\_{33}\\\\
b\_{31} =&x\_{31}\cdot a\_{11} + x\_{32}\cdot a\_{21} + x\_{33}\cdot a\_{31}\\
b\_{32} =&x\_{31}\cdot a\_{12} + x\_{32}\cdot a\_{22} + x\_{33}\cdot a\_{32}\\
b\_{33} =&x\_{31}\cdot a\_{13} + x\_{32}\cdot a\_{23} + x\_{33}\cdot a\_{33}
\end{matrix}
$$

or in matrix form:

$$
\begin{matrix}
\begin{bmatrix}
a\_{11}&a\_{21}&a\_{31}\\
a\_{12}&a\_{22}&a\_{32}\\
a\_{13}&a\_{23}&a\_{33}
\end{bmatrix}
\cdot
\begin{bmatrix}
x\_{11}\\
x\_{12}\\
x\_{13}
\end{bmatrix}
=\begin{bmatrix}
b\_{11}\\
b\_{12}\\
b\_{13}
\end{bmatrix}\\\\
\begin{bmatrix}
a\_{11}&a\_{21}&a\_{31}\\
a\_{12}&a\_{22}&a\_{32}\\
a\_{13}&a\_{23}&a\_{33}
\end{bmatrix}
\cdot
\begin{bmatrix}
x\_{21}\\
x\_{22}\\
x\_{23}
\end{bmatrix}
=\begin{bmatrix}
b\_{21}\\
b\_{22}\\
b\_{23}
\end{bmatrix}\\\\
\begin{bmatrix}
a\_{11}&a\_{21}&a\_{31}\\
a\_{12}&a\_{22}&a\_{32}\\
a\_{13}&a\_{23}&a\_{33}
\end{bmatrix}
\cdot
\begin{bmatrix}
x\_{31}\\
x\_{32}\\
x\_{33}
\end{bmatrix}
=\begin{bmatrix}
b\_{31}\\
b\_{32}\\
b\_{33}
\end{bmatrix}\\
\end{matrix}
$$

> **Watch out:** the matrix here is transposed -> $A^T$

Now you have 9 equations for 9 unknowns that you can solve with Gaussian elimination, LU decomposition, or any other linear solver you are familiar with.

You might say that those are just 3x3 matrices and yours are 3x5. Adding those two columns yourself should be easy, but you actually don't need them to determine the matrix. It would give you an overdetermined system of equations. Just pick 3 columns instead (but the same from both matrices).

Note that if you combine the 3 matrix-vector equations into a single matrix-matrix equation, you basically end up with [something similar to this solution](https://math.stackexchange.com/a/2040965/776637). All you need to do is to multiply by the inverse of $A^T$ and then transpose everything. Then you have the same equation.

I wrote a short python script to check if everything is correct that I wrote:

```python
import numpy as np

a = np.array([[2, 5, 1], [1, 3, 1], [1, 1, 1], [3, 1, 1], [3, 3, 1]]).transpose()
b = np.array([[7, 0, 1], [9, 4, 1], [9, 8, 1], [5, 8, 1], [5, 4, 1]]).transpose()

# pick first 3 vectors
a_red = a[:, :3]
b_red = b[:, :3]

# solve for each row vector of x
x_1 = np.linalg.solve(a_red.transpose(), b_red.transpose()[:, 0])
x_2 = np.linalg.solve(a_red.transpose(), b_red.transpose()[:, 1])
x_3 = np.linalg.solve(a_red.transpose(), b_red.transpose()[:, 2])

# combine vectors to the transformation matrix we are looking for
x = np.array([x_1, x_2, x_3])
print(x)

# check if x*a yields b
b_check = np.matmul(x, a)
print(b_check)
assert np.allclose(b, b_check)

```

The assertion holds and the matrix looks like expected:

$$
\begin{bmatrix}
x\_{11}&x\_{12}&11\\
x\_{21}&x\_{22}&10\\
0&0&1
\end{bmatrix}
$$

Seems like you swapped the numbers in `dx` and `dy` cause I got `dx=11` and `dy=10`. The first two rows of the last column represent the translation vector as [described here](https://web.cse.ohio-state.edu/%7Eshen.94/681/Site/Slides_files/transformation_review.pdf).
The last row is `(0, 0, 1)` as it should be since we are not doing any transformation into the 3. dimension.

I left out the upper left 2x2 matrices for you to find out. As another hint, $x\_{11}=x\_{22}$ and $x\_{12}=x\_{21}$. I think you will manage to figure them out. If you can't, just ask for help or run the python script but I recommend trying it yourself.

**Regarding question 2**

The usual forward order is scale, rotate, and translate for reasons I won't further explain. But this is not a "rule" and you can not rely on that. It is just the approach that makes the most sense for us humans. However, looking at the graphics and the calculated matrix, they followed this order.

**Regarding question 1**

Now with the information, I gave you for question 2, it should be obvious. Just pick the point Γ and follow it if you first apply the scaling, then the rotation, and finally the translation. If you manage this, you should also be able to just guess the remaining numbers of the matrix with all the information you got, at least if you understood all the involved substeps and the basic transformation matrices ([check this link again](https://web.cse.ohio-state.edu/%7Eshen.94/681/Site/Slides_files/transformation_review.pdf)). You will also see that `dx` and `dy` are indeed swapped in your question.


---

### Answer by username_1 on 2022-07-04. Score: 0

This kind of problem is usually called shape matching. It is possible to deduce the transformation between two given sets of positions.

You can learn more about the shape matching here

Müller, Matthias, et al. "Meshless deformations based on shape matching." ACM transactions on graphics (TOG) 24.3 (2005): 471-478.

<https://dl.acm.org/doi/abs/10.1145/1073204.1073216?casa_token=ByW2rb3f-VgAAAAA:6wMJ5MT3moK_0lRPZtDDxFI0B16Nw8b5hcI-dclZaUV3RDJgeMUYTR7Sk7vE-4qMQ_6wHmlxReh5>

(hint: no need to finish the whole paper. Section 3.3 is all you need)

---

Just apply the paper idea here to your question as a concrete example.

Denote the source point set as $x^0\_i$ ($i=1..5$), and target point set as $x\_i$.
Let $t^0$ be the center of source points, and $t$ be the center of target points.

Let $q\_i$ be the source point set minus the center: $q\_i = x^0\_i-t^0$.
Similarly let $p\_i$ be the target point set minus the center: $p\_i=x\_i -t$.

Then suppose we have found a transformation $A = R S$ (rotation and scaling), and the transformation maps our source point set to $A q\_i + t^0$.
We want its distance to the target as small as possible. That is, minimize this:
$$
F = \sum\_i (A q\_i - p\_i)^2
$$

In order to minimize $F$ we want to take derivative of $F$ and set it to 0 and then solve for A.
That should give you
$$
A =
(\sum\_i p\_i q\_i^T)(\sum\_i q\_i q\_i^T)^{-1}
$$

That $A$ is the transform associates the source and the target point sets.
Further take QR decomposition of $A$ should give you the rotation and scaling.

In your case, (I am dropping z coordinates)

Centers:

```
t0={2, 13/5}
t={7, 24/5}

```

Coordinates with center translations removed:

```
p={{0, 2, 2, -2, -2}, {-24/5, -4/5, 16/5, 16/5, -4/5}}
q={{0, -1, -1, 1, 1}, {12/5, 2/5, -8/5, -8/5, 2/5}}

```

```
pq={{-8, 0}, {0, -112/5}}
qq={{4, 0}, {0, 56/5}}
A={{-2, 0}, {0, -2}}

```

Then the expression `A q + t` should give you the target point set.

---

This should give you a general solution to this problem without visualizing it.

For your question on transformation order: you can freely specify the order as you want. (that $A q + t$ thing).

For your question on deriving the translation: it should be the center of target point set, i.e. `{7, 24/5}` assuming the rotation happens at the center.

If you expand the transformation a bit:
$$
\begin{align}
A q + t &=
A (x^0 - t^0) + t \\
&= A x^0 - A t^0 + t \\
&= A x^0 + (- A t^0 + t)
\end{align}
$$
The given solution might assume the rotation happens at the origin. In that case the translation is $(-A t^0 + t)$, and it is `{11, 10}`.


---

