2

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.

figure

ca1ek
  • 121
  • 1
    Welcome to math.SE: since you are new, I wanted to let you know a few things about the site. In order to get the best possible answers, it is helpful if you say in what context you encountered the problem, and what your thoughts on it are; this will prevent people from telling you things you already know, and help them give their answers at the right level. – Inazuma Apr 03 '16 at 10:50
  • There is obviously not a single, but 2 answers for point $p_3$ (symmetrical with respect to line $p_1p_2$) – Jean Marie Apr 03 '16 at 10:53
  • @JeanMarie I know, I also know how to determine the point I want. – ca1ek Apr 03 '16 at 11:10

3 Answers3

3

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);
Jean Marie
  • 81,803
  • @amonk I'm sorry but I don't see what you mean. 1) I haven't used the law of cosines but the law of sines 2) If it's the law of sines, I don't see where there are angles in the nominator. Besides, I have checked my results. – Jean Marie Aug 30 '19 at 08:11
  • Mea culpa. I meant the law of sines. The description of the nominator involves lengths of the sides of the triangle and not angles. Hope it's clearer now – amonk Aug 30 '19 at 08:33
  • @amonk With my notations (see the introduction of my answer) $a_1,a_2,a_3$ are for sides, not for angles. – Jean Marie Aug 30 '19 at 08:41
  • let α1,α2,α3 be "angle1,angle2,angle3" resp. – amonk Aug 30 '19 at 08:42
  • 1
    I think that you are mixing letter "alpha" and letters "a". I use letters "alpha" for angles, not to be confused with letters "a" for length, i.e., when I say in my introduction $p_1p_2 = a_3$, letter "a" is designating a length. – Jean Marie Aug 30 '19 at 08:47
  • RHS2=y2*u-x2*v+a2*a3*sin(alp1); change this to RHS2=y2*u-x2*v-a2*a3*sin(alp1); –  Dec 01 '20 at 07:49
  • @Vinay H P Done. Thank you ! – Jean Marie Dec 01 '20 at 07:55
1

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$$

0

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.

fgrieu
  • 1,758