# How to Transform a Line to another Line which is parallel to it

Let say i have two parallel lines, $L_1$ and $L_2$,

Now how to Transform line $L_2$ in to $L_1$.

-
What do you mean by transform? If you mean two lines (not segments) on a plane, you could use two symmetries, to just translate it. Even single symmetry would do if you don't care about the sign. – dtldarek Apr 14 '12 at 12:14
I mean two line segments. I need to transform L2 into L1. Means, L2 and L1 become same lines. – user960567 Apr 14 '12 at 12:17
If the two segments are of the same length, you just translate, no? – J. M. is back. Apr 14 '12 at 12:25
@J.M., yes u are right – user960567 Apr 14 '12 at 12:26
@dtldarek, can you explain a little more. – user960567 Apr 14 '12 at 12:49

## 2 Answers

You want to transform point $(x1,y1)$ to $(x2,y2)$, and $(x3,y3)$ to $(x4,y4)$. This means: $$\left( \begin{array}{cc} a & b \\ c & d \end{array} \right) \cdot \left( \begin{array}{c} x1 \\ y1 \end{array} \right) = \left( \begin{array}{c} x2 \\ y2 \end{array} \right)$$ And: $$\left( \begin{array}{cc} a & b \\ c & d \end{array} \right) \cdot \left( \begin{array}{c} x3 \\ y3 \end{array} \right) = \left( \begin{array}{c} x4 \\ y4 \end{array} \right)$$

You have four equations in the four unknowns $a,b,c,d$. Once you solve these equations the transformed coordinates $(x',y')$ are related to the old ones by: $$\left( \begin{array}{cc} a & b \\ c & d \end{array} \right) \cdot \left( \begin{array}{c} x \\ y \end{array} \right) = \left( \begin{array}{c} x' \\ y' \end{array} \right)$$

-
I don't understand. – user960567 Apr 14 '12 at 12:20
I think some of those $c$s were meant to be $d$s, nbubis. – Gerry Myerson Apr 14 '12 at 12:25
@GerryMyerson - Thanks, Fixed. – nbubis Apr 14 '12 at 12:28
@user960567 - Do you want to explain what you don't understand? Are you familiar with matrix multiplication? – nbubis Apr 14 '12 at 12:32
Yup. I am thinking, X2 + (X1 - X2), Y2 + (Y1 - Y2) may work or not – user960567 Apr 14 '12 at 12:47

The comments are too short, so I will explain it here. Let $A = (X_1, Y_1)$, $B = (X_2, Y_2)$, $C = (X_3, Y_3)$ and $D = (X_4, Y_4)$. We have that $AC\ \|\ BD$ and that you want to transform $A$ to $B$ and $C$ to $D$ (of course the same approach can be used to map $A$ to $D$ and $C$ to $B$). The notation $|PQ|$ means the length of $PQ$.

First of all, there are infinitely many transformations that would map $AC$ to $BD$ (without any constraints, if you assume that you want your map to be of some specific class, there may be just a few or even none), and I will just give you an example of such transformation.

What I will construct is called usually homothety or simply scaling, and this is one of the basic geometry transformations (along with rotation, translation and symmetry).

To start we need the center, let call it $S = (S_x, S_y)$. However, we know that $S$ is a point on the line passing through $A$ and $B$, and also on the line passing through $C$ and $D$. Therefore, $S$ is the intersection of those two lines (with the special case I will deal later). To apply the transformation to the point say $P$, just draw a line $SP$ and then set $P'$ on the same line, but with $|SP'| = \frac{|BS|}{|AS|}|SP| = \frac{|DS|}{|CS|}|SP|$ (where positive sign means $X'$ is on the same side as $X$, and the negative sign denotes opposite side). Please, compare it with Intercept theorem (in my country this is known as Thales' theorem). To give algebraic formula: $$T(P) = \frac{|BS|}{|AS|}(P-S) + S$$ or written more explicitly: $$T(P_x, P_y) = \left(\frac{|BS|}{|AS|}(P_x-S_x)+S_x, \frac{|BS|}{|AS|}(P_y-S_y)+S_y\right)$$

As you can see, if $S = (0,0)$ then this becomes a simple scaling. There is a special case when $AB\ \|\ CD$, i.e. when $S$ does not exists, or as some like to say $S$ is in infinity. But in this degenerate case homothety becomes just translation, so $$T(P) = P+AB$$ or $$T(P_x, P_y) = (P_x + B_x - A_x, P_y + B_y - A_y)$$

Hope that helps ;-)

-
Isn't this is some how complex. What about taking the difference? I mean subtraction – user960567 Apr 14 '12 at 16:59
@user960567 What do you mean? – dtldarek Apr 14 '12 at 17:49
See below comments. – user960567 Apr 15 '12 at 3:01