I have 2 points $B$ and $P$ and need to calculate angle $\alpha$ (maybe also I will need point $C$ and $E$)

How can I do this. I know that I can calculate point $D$ it's $(\frac{1}{2}(x_P-x_B), \frac{1}{2}(y_P-y_B))$ then calculate line that it's perpendicular to $PB$ and that go through $D$ and then intercections with lines $x=x_B$ and $y=y_B$, if I have point $E$ I can calculate angle from triangle $PDE$, but need exact formula to do this.