Given are two points, $P1(x_1, y_2)$ and $P2(x_2, y_2)$, and distance $a$. Now I want to find the two points $T1$ and $T2$.
$$d(P1,T1) = d(P2, T1) = a = d(P1,T2) = d(P2, T2)$$
Eg: (T1 and T2 are my two points I want to find)
T1
/|\
len = a / | \ len = a
/ |L \
P1 ------ P2
\ | /
len = a \ | / len = a
\|/
T2
len = a The distance between the points is given (they are all the same ($a$))
L Angle of 90 degrees.
I've been trying to solve this equation for an hour. I need this for an application, so I need an abstract formulla, in which I can insert the given $x_1, y_1, x_2, y_2$.
Thanks
The point at the centre of the diagram has coordinates $(x_1+x_2)/2$ and $(y_1+y_2)/2$. The distance $d$ from each of $P_1$ and $P_2$ to the centre is half the distance between $P_1$ and $P_2$, so $d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}/2$. Then the distance $h$ from each of $T_1$ and $T_2$ to the centre follows by Pythagoras: $h=\sqrt{a^2-d^2}$. The vector with components $y_2-y_1,x_1-x_2$ is orthogonal to the line $P_1P_2$ and thus points along the line $T_1T_2$. Thus you just have to add $\pm h$ times a normalized version of that vector to the centre to get $T_1$ and $T_2$:
$$ \begin{eqnarray} T_{1,2} &=& \frac12\left({x_1+x_2\atop y_1+y_2}\right)\pm\frac{\sqrt{a^2-\frac14((x_2-x_1)^2+(y_2-y_1)^2)}}{\sqrt{(x_1-x_2)^2+(y_2-y_1)^2}}\left(y_2-y_1\atop x_1-x_2\right) \\ &=& \frac12\left({x_1+x_2\atop y_1+y_2}\right)\pm{\sqrt{\frac{a^2}{(x_2-x_1)^2+(y_2-y_1)^2}-\frac14}}\left(y_2-y_1\atop x_1-x_2\right) \end{eqnarray} $$