# How to calculate coordinates of third point in a triangle (2D) knowing 2 points coordinates, all lenghts and all angles

I have a triangle and I know the coordinates of two vertices: $A=(x_1,y_1), B=(x_2,y_2)$
All the angles: $ABC = 90^\circ, CAB = 30^\circ$ and $BCA = 60^\circ$ and all the edge lengths. How can I find the coordonates of the third verix $C=(x_3,y_3)$?

I know there are two solutions (I want both).

Thank you.

-

Given the right angle at $B$, the slopes of $AB$ and $BC$ are negative inverses. So the slope of $BC$=$\frac {-1}{\frac {y_2-y_1}{x_2-x_1}}=\frac {x_1-x_2}{y_2-y_1}$. Now you can use the point-slope form of the linear equation. If we let $C=(x_3,y_3)$ the equation of $BC$ is $y-y_2=\frac {x_1-x_2}{y_2-y_1}(x-x_2)$ $C$ then is $(x_3,\frac {x_1-x_2}{y_2-y_1}(x_3-x_2)+y_2)$ You can then sum the squares of these and solve for $(x_3-x_2)^2$. Your two solutions are the two signs of this.
If the coordinate system was such that $A' = (0, 0), B' = (AB, 0)$ you'd know that $C' = AC \cdot (\cos CAB, \pm \sin CAB)$. Now you only need to find what rotations and translations were applied to $A', B'$ to get $A, B$ and apply them to $C'$ to get $C$.
There will be a rotation by $\alpha$ such that $\sin \alpha = \frac{y_2 - y_1}{AB}, \cos \alpha = \frac{x_2-x_1}{AB}$ and a translation by $(x_1, y_1)$.
Edit: That was for general triangle though. Having $AB$ perpendicular to $BC$ makes this more trivial. Given a vector $(x, y)$, all vectors perpendicular to it can be written as $c \cdot (-y, x)$ for some $c$. So if we have that $\vec{AB} = (x_2-x_1, y_2-y_1)$ then $\vec{BC} = c\cdot(y_1-y_2, x_2-x_1)$. To find $c$ is simple. Knowing that $|\vec{AB}| = AB, |\vec{BC}| = BC$ and $|a\vec{x}| = |a| |\vec{x}|$, it is clear that $c = \pm\frac{BC}{AB}$. Finally $C = B + \vec{BC}$