Calculate the angle from the given points coordinates.

20.5k Views Asked by At

I'm trying to figure out the way to calculate the a angle value from given coordinates of three points as showed on the illustration below: enter image description here

I know how to calculate the a angle from the triangle's base length and its height, but in this case I'm stucked. I'll appreciate any help.

EDIT

The a value should be expressed in degrees. Also, the points coordinates can vary.

4

There are 4 best solutions below

0
On

Drop a perpendicular from $x_1y_1$ to get a right triangle with the adjacent and opposite of $a$ both equal to $50$. Hence $a=\pi/4$ (because $\tan a = {O\over A} = {50\over 50} = 1$).

EDIT: Note $\pi/4$ radians equals $45$ degrees. The result here is invariant under translation (it stays the same when the points move).

3
On

This is the solution (be aware that your figure is misleading):

$$ A = (150 - 100, 50 - 100) = (50, -50) $$ $$ B = (180 - 100, 100 - 100) = (80, 0) $$ $$ \cos\Theta = \dfrac{A \cdot B}{|A||B|} = \dfrac{400}{50\sqrt{2} \times 80} = \dfrac{1}{\sqrt{2}} $$ $$ \Rightarrow \Theta = \dfrac\pi4 $$

0
On

Maybe it is just me but the answers here seem a bit overly complex for a simple task like this. This can easily be solved with distance formula and Law of Cosines in a universal way not limited to making special rights. No need for vectors, norms, dot products, or any of that. Just basic algebra and trig.

$A=\sqrt{\left(x_{2}-x_{1}\right)^{2}+\left(y_{2}-y_{1}\right)^{2}}$

$B=\sqrt{\left(x_{2}-x_{0}\right)^{2}+\left(y_{2}-y_{0}\right)^{2}}$

$C=\sqrt{\left(x_{1}-x_{0}\right)^{2}+\left(y_{1}-y_{0}\right)^{2}}$

$a=\cos^{-1}\left(\frac{A^{2}-B^{2}-C^{2}}{-2BC}\right)$

0
On

The angle being non-dimensional, we can proportionally divide the vector magnitude by $10$ for convenience of calculation. The $(i,j)$ are unit vectors along $(x,y)$ axes

$$ \vec{P2 \;P0} =(8i+0j)$$

$$ \vec{P1 \;P0} =(5i-5j)$$

Using scalar dot product

$$ \cos a = \dfrac{a_1b_1+a_2b_2}{|A| \cdot |B|}$$

$$ \cos a = \dfrac{40}{\sqrt{64(25+25)}}= \dfrac{40}{8\cdot\sqrt2 \cdot 5}= \dfrac{1}{\sqrt 2}$$ or $$ a = \dfrac{\pi}{4}=45^{\circ}$$