Calculating angle for line tangent to circle through a point

58 Views Asked by At

I have a circle of fixed radius $r$. I have a target that is $x$ units laterally separated from the center of the circle, and $y$ units vertically. I need to calculate the angle $θ$ which is the declination of the radius that connects that target to the upper tangent on the circle.

visual depiction of the above, with the line connecting the origin to the target labeled as 'h'

It feels like there should be a simpler formula than what I've shown in the diagram:

$$θ=180° - tan^{-1}\left(\frac{y}{x}\right) - cos^{-1}\left(\frac{r}{\sqrt{x^{2}+y^{2}}}\right)$$

Is there a way to simplify this calculation further?