I have some problem with math today :) Could you tell me how should I calculate $P$ angle?
![img]](https://i.stack.imgur.com/jqTlW.png)
I know first and last point of each line. So I have:
L1 = [(10,10),(15,15)]
L2 = [(15,15),(20,8)]
But I don't have idea how calculate this angle. If I should be more specific I need to know $\cos$ of this angle. I would like to write this in Python.
Find the slope of the two lines, then use the trig identity: $$\tan{\left(A+B\right)}=\frac{\tan{A}+\tan{B}}{1-\tan{A}\tan{B}}$$ Where $\tan{A}$ is the slope of one line, $\tan{B}$ is the slope of the other line, and $\tan{\left(A+B\right)}$ is the tangent of the angle between the two lines. Then use the following identity to solve for the secant of the angle: $$\tan^2{\left(A+B\right)}+1=\sec^2{\left(A+B\right)}$$ Then find cosine by taking the reciprocal of the secant.