How to find coordinates of 3rd vertex of a right angled triangle when everything else is known?

I want to locate precisely the 3rd coordinate of a right angled triangle.
I have:

  1. the length of three sides
  2. The three angles
  3. The other two coordinates of the triangle

The triangle can lie in any orientation in 2D coordinate system.

The three sides, angles and coordinates could be different in the piece of experiment and I am not working with any fix pair of values… I am actually dealing with multiple pairs of all above mentioned values.

I need a reliable and accurate way of finding the 3rd coordinate. Currently I have this formula but it calculated two pairs of coordinates (forming a butterfly) instead of the triangle.

Edit 2:

In the diagram that I mentioned and to which a (potential) solution has been presented, I have a confusion/connected question (because I believe this could be the cause of the problem).

Question:

Can $(x_1, y_1)$ and $(x_2, y_2)$ be any pair of the right angles triangle? or does $(x_1, y_1)$ must the coordinates of the right angle and $(x_2, y_2)$ for the base vertex?

Currently I get this:

Circles and Triangles formed

As you can see, the coordinate I am trying to get is draw way-off the border of the circle. The coordinate should be found on the border of the circles and not that far away in space.

As you might have guessed that I am trying to draw tangents between each circle. I have worked out rest of the code but the coordinate is being calculated incorrectly and thus the right angled triangle is formed incorrectly..

Edit (ignore this heading please):

I want to find only ONE triangle instead of the four possibilities.

http://awaismunir.net/universal/tangents/3rd-third-vertext-calculate-right-angled-triangle.gif

Calculate 3rd Vertext of Right angled triangle

Note:

I have already reviewed these urls:

Calculate coordinates of 3rd point (vertex) of a scalene triangle if angles and sides are known.

and

How to find the third coordinate of a right triangle given 2 coordinates and lengths of each side

Kindly help.

Thanks!

Steve

Solutions Collecting From Web of "How to find coordinates of 3rd vertex of a right angled triangle when everything else is known?"

If you always want the $(x-x_1,y-y_1)$ vector to be rotated $90°$ counter-clockwise against the $(x_2-x_1,y_2-y_1)$ one, then you have

\begin{align*}
n(x-x_1) &= m(y_1-y_2) \\
n(y-y_1) &= m(x_2-x_1)
\end{align*}

So the left $y$ difference is the right $x$ difference, and the left $x$ difference is the negative of the right $y$ difference. This amounts to the $90°$ rotation I mentioned.

Solve the above and you find

\begin{align*}
x &= \frac{m(y_1-y_2)}n+x_1 \\
y &= \frac{m(x_2-x_1)}n+y_1
\end{align*}

which corresponds to one of your four solutions.