Calculate third point of triangle from two points and angles I've got two points(p1 and p2) and two angles(angle1 and angle2), I can calculate the third angle, but how do I calculate the coordinates of point p? Not just the distances from the points, but coordinates.
I'm trying to use this to do texture mapping on triangles. Here is an image of my idea
p1 = (2, 0)
p2 = (6, 4)

angle1 is angle next to p1,  
angle2 is angle next to p2.


 A: Let us fix some notations:

*

*let $\alpha_1,\alpha_2,\alpha_3$ be "angle1,angle2,angle3" resp.


*let length of $p_1p_2 = a_3$ and the other sides' lengthes names by cyclic permutation.


*let $u=x_2-x_1, v=y_2-y_1$. Thus $a_3=\sqrt{u^2+v^2}$.
First of all: $\alpha_3=\pi-(\alpha_1+\alpha_2)$.
Then, using the law of sines (https://en.wikipedia.org/wiki/Law_of_sines):
$$\dfrac{a_1}{\sin \alpha_1}=\dfrac{a_2}{\sin \alpha_2}=\dfrac{a_3}{\sin \alpha_3}$$
one obtains in particular $a_2=a_3\dfrac{\sin \alpha_2}{\sin \alpha_3}$ where where  $\alpha_2,\alpha_3$ and $a_3$ are known  quantities.
Let us now express

*

*the  dot product $\vec{p_1p_2}.\vec{p_1p_3}=a_2 a_3 \cos \alpha_1$ and


*the norm of the cross product $\|\vec{p_1p_2}\times\vec{p_1p_3}\|=a_2 a_3 \sin \alpha_1$
by using coordinates:
$$\begin{cases} u(x_3-x_1)+v(y_3-y_1)&=&a_2 a_3 \cos \alpha_1\\
u(y_3-y_2)-v(x_3-x_2)&=&a_2 a_3 \sin \alpha_1\end{cases}$$
One obtains a linear system of 2 equations with the two unknowns $x_3$ and $y_3$ ; the solution of this system is without difficulty.
Here is a complete Matlab program with explicit formulas for $x_3$ and $y_3$:
x1=0;y1=0;x2=6;y2=0; % initial data
alp1=2*pi/3;alp2=pi/6; % initial data
u=x2-x1;v=y2-y1;a3=sqrt(u^2+v^2);
alp3=pi-alp1-alp2;
a2=a3*sin(alp2)/sin(alp3);
RHS1=x1*u+y1*v+a2*a3*cos(alp1);
RHS2=y2*u-x2*v-a2*a3*sin(alp1);
x3=(1/a3^2)*(u*RHS1-v*RHS2);
y3=(1/a3^2)*(v*RHS1+u*RHS2);

A: I don't understand any of your pictures. Ignoring them, first, find the slope of $\overline{P_1P_2}$:
$$m_0 = \frac{y_2 - y_1}{x_2 - x_1} = 1$$
The angle associated with that is $\arctan(1) = \frac{\pi}{4}$
Next, find the slope of the lines:
$$m_1 = \arctan(\frac{\pi}{4} - \angle_1) , m_2 = \arctan(\angle_1 - \frac{\pi}{4}) $$
You may have to be a little intelligent about subtracting those angles. Next, write the lines in point-slope form:
$$y - y_1 = m_1 ( x - x_1) \\
y - y_2 = m_2 ( x-x_2)$$
Finally, the point in question is located where those two lines cross:
$$ m_1 ( x - x_1) + y_1 =m_2 ( x - x_2) + y_2 \\
x = \frac{y_2 - y_1 - m_2 x_2 + m_1 x_1}{ m_1 - m_2} \\
y = \frac{\frac{y_1}{m_1} - \frac{y_2}{m_2} + x_2 - x_1}{\frac{1}{m_1} - \frac{1}{m_2}}$$
The $\hat x$ equation is stable unless the slopes of those two lines are very close, so leave that to the computer. The $\hat y$ equation, conversely, is unstable, so instead calculate:
$$y = m_1 ( x_p - x_1) + y_1$$
A: Hint: write the equations linking $(x,y)$ coordinates for points on the green and blue lines. Then solve as a system of simultaneous equations.
Also: you need to clarify if the angles are signed or not, and if the lines are half lines as on the drawing. With full lines and non-signed angles, there are as much as 4 solutions.
