find angle at line-circle intersection I have a ray $a$ starting at point $P$ (defined by the coordinates $d_h$,$d_v$) that intersect with a circle at point $S$ (defined by the coordinates $b_h$,$b_v$). How can I calculate angle $\beta$?
Given
(everything that's blue in the sketch)


*

*a circle located at the point of origin with a radius $r_w$, where $r_w > 0$

*starting point $P(d_h,d_v)$ of the ray $a$, where $d_h \ge r_w$ and $d_h \ge 0$

*angle $\alpha$ of the ray $a$, where $0° \lt \alpha \lt 90°$


Wanted


*

*angle $\beta$ in ° between the horizontal point of origin and the line going from the point of origin to point $S$



 A: Solve quadratic equation.
Circle:
$$x^2+y^2 = r_w^2$$
Line:
$$y = \tan(\pi-\alpha) (x+d_h) + d_v$$
Combine the two, solve, and pick the solution which is closer to the source.
Good luck!
A: I tried combining and transforming the equations as @dtldarek mentioned. It's just hard to verify that I didn't make a mistake:
$r_w^2=x^2+(tan(\pi-\alpha)(x+d_h)+d_v)^2$
$r_w^2=x^2+(tan(\pi-\alpha)(x+d_h))^2+2tan(\pi-\alpha)(x+d_h)d_v+d_v^2$
$k=tan(\pi-\alpha)$
$r_w^2=x^2+(k(x+d_h))^2+2k(x+d_h)d_v+d_v^2$
$r_w^2=x^2+(kx+kd_h)^2+2kd_vx+2kd_vd_h+d_v^2$
$r_w^2=x^2+(kx)^2+2k^2d_hx+(kd_h)^2+2kd_vx+2kd_vd_h+d_v^2$
$r_w^2=x^2+k^2x^2+2k^2d_hx+(kd_h)^2+2kd_vx+2kd_vd_h+d_v^2$
$r_w^2=(1+k^2)x^2+2k^2d_hx+(kd_h)^2+2kd_vx+2kd_vd_h+d_v^2$
$r_w^2=(1+k^2)x^2+(2k^2d_h+2kd_v)x+(kd_h)^2+2kd_vd_h+d_v^2$
$0=(1+k^2)x^2+(2k^2d_h+2kd_v)x+(kd_h)^2+2kd_vd_h+d_v^2-r_w^2$
$0=Ax^2+Bx+C$
$A=1+k^2=1+(tan(\pi-\alpha))^2$
$B=2k^2d_h+2kd_v=2(tan(\pi-\alpha))^2d_h+2(tan(\pi-\alpha))d_v$
$C=(kd_h)^2+2kd_vd_h+d_v^2-r_w^2=(tan(\pi-\alpha)d_h)^2+2tan(\pi-\alpha)d_vd_h+d_v^2-r_w^2$
