# Finding $2$ points from angle.

I have $2$ points,

$p_1(x_1=0,y_1=0)$
$p_2(x_2=5,y_2=5)$

And if i want to know what angle these $2$ points make. I can say, since $\sin \theta$ is $y$ axis and $\cos \theta$ is $x$ axis, so i can do:

$x_i = x_2-x_1$
$y_i = y_2-y_1$

and then get the $\tan\theta$ in radians:

$\tan \theta={\genfrac{}{}{}{}{y_i}{x_i}}$

and then convert it to degrees like so:

$\text{degrees} = \text{radians}*{\genfrac{}{}{}{}{180}{\pi}}$

so the answer is $45^o$ degrees. Cool.

But how can i convert the degrees back to $2$ points? For example if i have $25^o$

I can convert the Degree to Radians with:
$\text{radians}=\text{degrees}*{\genfrac{}{}{}{}{\pi}{180}}$

then, to make it simple, I make $p_1(x_1=0,y_1=0)$, but how can i get the $p_2$?

You cannot get $P2$ just from the angle. You also need to know the distance of $P2$ from $P1$. From radians, you get $\tan(\theta)$ = $y\over x$ If you know the distance which is $\sqrt{x^2+y^2}$, You get the value of $x$ and $y$
If $d$ is the distance, $P_1 = (0,0)$ , Then $$P_2=(d\cos(\theta) , d\sin(\theta))$$
As to how it came, It came from right angle triangle properties.

• okay, what i want to do is to get the Line Equation of an angle so any distance i can use, right? let say distance is 1, but how is distance going to help me? – Bear Feb 12 '16 at 4:03
• @BernardRouhi I edited my answer – Win Vineeth Feb 12 '16 at 4:08
• hmm... okay, but i don't have $opposite$ or $adjacent$, i only have the distance/$hypotenuse$ of the line and point 1. – Bear Feb 12 '16 at 4:18
• @BernardRo0uhi In my answer, d is the hypotenuse length. In fact, $d\cos(\theta)$ is the adjacent and $d\sin(\theta)$ is the opposite sides. Once you have $\theta$, you know $\cos$ and $\sin$ – Win Vineeth Feb 12 '16 at 4:22
• you mean i convert the angle with $\text{radians}=\text{degrees}*{\genfrac{}{}{}{}{\pi}{180}}$ and then do $d*\cos(\theta)$ to get x and $d*\sin(\theta)$ to get y right? i did that and then i try to convert it back to angle i get $68^o$. :| – Bear Feb 12 '16 at 4:55

If you have two points, $(x_1, y_1)$ and $(x_2, y_2)$, you can draw a right triangle such that $x_2 - x_1$ is the (signed) length of the horizontal side, and $y_2 - y_1$ is the (signed) length of the vertical side.

We call the tangent of the base angle the slope of the line, with formula $$m = \dfrac{y_2-y_1}{x_2-x_1}$$

Then one equation for this line is $$y - y_1 = m(x - x_1)$$

In your case, you have the "base" angle $\theta$ found in the right triangle (whether one of the points is the origin or not). Then the tangent of this angle is your slope.

$$y - y_1 = \tan(\theta)(x - x_1)$$