<p>I am not sure whether this is what you need, hope it helps:</p>
<p>To transform from one line to the other, <strong>one can try to use the homogeneous coordinates</strong>, which will incorporate the potential translation of the line. So we can formulate the problem in the following way. Notice that the length of the line stays the same, therefore we don't need to consider scaling. Thus, this case can be modeled as rigid body transformation:
<span class="math-container">$$
\begin{pmatrix}
\cos\theta &amp; -\sin\theta &amp; t_x\\
\sin\theta &amp; \cos\theta &amp; t_y\\
0 &amp; 0 &amp; 1\\
\end{pmatrix}
\begin{pmatrix}
0 &amp; 1\\
0 &amp; 1\\
1 &amp; 1\\
\end{pmatrix}
=
\begin{pmatrix}
0 &amp; -1\\
-1 &amp; 0\\
1 &amp; 1\\
\end{pmatrix}
$$</span>
Solving the above linear equations yields:
<span class="math-container">$\cos\theta = 0, \sin\theta = 1, t_x = 0, t_y = -1$</span>. So this tells us:</p>
<ul>
<li>Line AB is first rotated around <span class="math-container">$(0, 0)$</span> by 90<span class="math-container">$\deg$</span> (counter-clockwise), we have: CD <span class="math-container">$(0, 0)\rightarrow(-1, 1)$</span>.</li>
<li>Then we apply translation: CD -&gt; A'B', moving the line down the y-axis by 1: <span class="math-container">$(0, -1)\rightarrow(-1, 0)$</span>.</li>
</ul>
<p>So basically, if you know it is gonna be rigid body transformation, then approach the problem in the above way. A more general 2D transformation will be (given in homogeneous coordinate system):
<span class="math-container">$$
\begin{pmatrix}
a &amp; b &amp; c\\
d &amp; e &amp; f\\
0 &amp; 0 &amp; 1\\
\end{pmatrix}
$$</span></p>
<p>which takes translation, shearing, scaling and rotation into account. Since this representation has more unknown variables, it requires more information to solve the whole system.</p>

CC BY-SA 4.0
2024-03-08T08:23:25.457Z
Thanks for the support.
barnyard9
CC BY-SA 4.0
2024-03-07T06:42:01.363Z
2024-03-07T06:42:01.363Z
Enigmatisms
<p><a href="https://computergraphics.stackexchange.com/questions/12819/how-to-determine-transformation-matrix-for-an-object-given-a-graph?newreg=952eeb36a8d847e9bf8cddfe030a3d7b">How to determine transformation matrix for an object given a graph?</a></p>
<p>This is a problem indeed similar to this one. And I've approached it in the same way like there.</p>
<p>Given:
A line AB A(0,0),B(1,1).</p>
<p>It is transformed to
A'(0,-1),B'(-1,0)</p>
<p>Now, I need to find the transformation matrix.</p>
<p>I begin</p>
<p>TM.A=B</p>
<p>Where TM=Transformation Matrix</p>
<p>A=given coordinates</p>
<p>B=transformed coordinates
<a href="https://i.sstatic.net/imTLA.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/imTLA.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2024-03-06T12:42:36.653Z
So, what is your questions, specifically? Surely $TM\times A$ will not yield $B$ here. I think this actually requires a translation vector, which will not fit in a 2D matrix. You need 3D matrix (homogeneous coordinates), unless you are discussing transformation around point $(1/2, -1/2)$/
Enigmatisms
CC BY-SA 4.0
2024-03-06T13:45:25.240Z
@Enigmatisms I know I did wrong because when I take a look at it and reverse multiply, I don't get the coordinates that I should be getting after getting transformed. Can you guide me just the matrix required?
barnyard9
<transformations><mathematics><matrix>
How to determine the transformation matrix from given initial and transformed co-ordinates?
barnyard9
# How to determine the transformation matrix from given initial and transformed co-ordinates?

(Asked by: username_0 on 2024-03-06)

[How to determine transformation matrix for an object given a graph?](https://computergraphics.stackexchange.com/questions/12819/how-to-determine-transformation-matrix-for-an-object-given-a-graph?newreg=952eeb36a8d847e9bf8cddfe030a3d7b)

This is a problem indeed similar to this one. And I've approached it in the same way like there.

Given:
A line AB A(0,0),B(1,1).

It is transformed to
A'(0,-1),B'(-1,0)

Now, I need to find the transformation matrix.

I begin

TM.A=B

Where TM=Transformation Matrix

A=given coordinates

B=transformed coordinates
[![enter image description here](https://i.sstatic.net/imTLA.png)](https://i.sstatic.net/imTLA.png)

**Tags:** transformations, mathematics, matrix

> **Comments:**
> **username_1**: So, what is your questions, specifically? Surely $TM\times A$ will not yield $B$ here. I think this actually requires a translation vector, which will not fit in a 2D matrix. You need 3D matrix (homogeneous coordinates), unless you are discussing transformation around point $(1/2, -1/2)$/  
> **username_0**: @username_1 I know I did wrong because when I take a look at it and reverse multiply, I don't get the coordinates that I should be getting after getting transformed. Can you guide me just the matrix required?  

---

## 1 answers

### Answer by username_1 on 2024-03-07. Score: 1

I am not sure whether this is what you need, hope it helps:

To transform from one line to the other, **one can try to use the homogeneous coordinates**, which will incorporate the potential translation of the line. So we can formulate the problem in the following way. Notice that the length of the line stays the same, therefore we don't need to consider scaling. Thus, this case can be modeled as rigid body transformation:
$$
\begin{pmatrix}
\cos\theta & -\sin\theta & t\_x\\
\sin\theta & \cos\theta & t\_y\\
0 & 0 & 1\\
\end{pmatrix}
\begin{pmatrix}
0 & 1\\
0 & 1\\
1 & 1\\
\end{pmatrix}
=
\begin{pmatrix}
0 & -1\\
-1 & 0\\
1 & 1\\
\end{pmatrix}
$$
Solving the above linear equations yields:
$\cos\theta = 0, \sin\theta = 1, t\_x = 0, t\_y = -1$. So this tells us:

* Line AB is first rotated around $(0, 0)$ by 90$\deg$ (counter-clockwise), we have: CD $(0, 0)\rightarrow(-1, 1)$.
* Then we apply translation: CD -> A'B', moving the line down the y-axis by 1: $(0, -1)\rightarrow(-1, 0)$.

So basically, if you know it is gonna be rigid body transformation, then approach the problem in the above way. A more general 2D transformation will be (given in homogeneous coordinate system):
$$
\begin{pmatrix}
a & b & c\\
d & e & f\\
0 & 0 & 1\\
\end{pmatrix}
$$

which takes translation, shearing, scaling and rotation into account. Since this representation has more unknown variables, it requires more information to solve the whole system.

> **Comments:**
> **username_0**: Thanks for the support.  

---

