How to get an angle from 3 points?

85 Views Asked by At

I have three 2D points $A, B, C$. $C$ is the centre, $A$ is initial point, $B$ is secondary point (less important, or gathered after $A$). How to get an angle formed by $A, B, C$ where distance between $A$ and $C$ is used as circle radius?

A,B,C,angle

1

There are 1 best solutions below

3
On BEST ANSWER

Steps to follow.

1) line $AB$, be $\cal L$

2) circle $\cal C$ of center $C$ and radius $\overline{AC}=r$

3) intersection $\cal L\cap\cal C$ gives points $A$ and $C'$

4) $\overline{AC'}=d=\overline{AB}-\overline{C'B}=2r\sin\frac{\theta}{2}$

5) the angle $\theta$ is the solution.

►The geometrical construction is immediate.

►Analytically you have, $A=(a_1,a_2)$, $B=(b_1,b_2)$, $C=(0,0)$, $\overline{AC}=\sqrt{a_1^2+a_2^2}=r$, $\overline{AB}=\sqrt{(b_1-a_1)^2+(b_2-a_2)^2}$. Then

$\cal L:\frac{y-a_2}{x-a_1}=\frac{b_2-a_2}{b_1-a_1}$

$\cal C: x^2+y^2=r^2$

Solve the system $$\begin{cases}y=\frac{b_2-a_2}{b_1-a_1}(x-a_1)+a_2\\y=\sqrt{r^2-x^2}\end{cases}$$ which gives the points $A$ and $C'=(c'_1,c'_2)$.

$ \overline{AC'}=d=\sqrt{(b_1-a_1)^2+(b_2-a_2)^2}-\sqrt{(c'_1-b_1)^2+(c'_2-b_2)^2}$.

You finish with $$\sin\frac{\theta}{2}=\frac{d}{2r}$$

enter image description here