Angle between tangent on circle and a line to a point on a larger concentric circle I have two concentric circles, the smaller one has radius $r$ and the larger one radius $r+a$. I am trying to calculate the angle between the tangent line at a point $A$ on the smaller circle and the line from point $A$ to point a $B$ on the larger circle. I made this diagram to illustrate my problem.

The angle I want to find is angle $\beta$.
Distances $a$ (between $B$ and $D$), $d$ (along the circumference of the inner circle), and $r$ are known. With this information, I can calculate angles $\alpha$, $\delta$, and distance $b$, angles $\epsilon$ and $\theta$, as well as the supplementary angles $\delta'$ and $\theta'$ (not drawn to avoid clutter).
Intuitively I see that triangles $ABD$ and $ABE$ are now fully defined but I am not able to work out angles $\beta$ and $\eta$.
How do I solve this problem? I want to code this problem with single-precision floating-point numbers in C++ so a computationally efficient solution is preferred.
EDIT: In this example point $B$ lies "above the horizon" as seen from point $A$. Is it also possible to calculate angle $\beta$ when $B$ is below the horizon?
 A: I can suggest a couple of methods.

Method 1. This method is crude but I hope it is numerically stable.
Drop a perpendicular from $A$ to the line $BC.$
Let $E$ be the point of intersection on $BC$, so $\triangle AEC$ is a right triangle with the right angle at $E.$ Then
\begin{align}
AE &= r \sin\alpha, \\
CE &= r \cos\alpha.
\end{align}
Now $\triangle AEB$ is a right triangle with legs $AE = r \sin\alpha$ and
$$
BE = r + a - r\cos\alpha = a + (1 - \cos\alpha)r,
$$
and with angle
$$
\angle BAE = \alpha + \beta.
$$
But
$$
\tan\left(\alpha + \beta\right) =
\tan \angle BAE = \frac{BE}{AE} = \frac{a + (1 - \cos\alpha)r}{r \sin\alpha}.
$$
Solving for $\beta,$
$$
\beta = \arctan\left(\frac{a + (1 - \cos\alpha)r}{r \sin\alpha}\right) - \alpha.
$$

Method 2. First work out $f$ via the Cosine Rule applied to triangle $\triangle ABC$, using $\alpha$ as the angle:
$$ f^2 = r^2 + (r + a)^2 - 2r(r+a)\cos\alpha. $$
Then apply the Cosine Rule again, but using $\angle BAC = \beta + \frac\pi2$
as the angle:
\begin{align}
 (r + a)^2 &= r^2 + f^2 - 2rf\cos\left(\beta + \frac\pi2\right) \\
&= r^2 + f^2 + 2rf\sin\beta.
\end{align}
Therefore
\begin{align}
\beta &= \arcsin\left(\frac{(r + a)^2 - r^2 - f^2}{2rf}\right) \\
&= \arcsin\left(\frac{(r + a)^2 - r^2 - (r^2 + (r + a)^2 - 2r(r+a)\cos\alpha)}{2rf}\right) \\
&= \arcsin\left(\frac{2r(r+a)\cos\alpha - 2r^2}{2rf}\right) \\
&= \arcsin\left(\frac{(r+a)\cos\alpha - r}{f}\right).
\end{align}
A: Assuming that point B always lies on the opposite side of the tangent line from the center C, this is a triangle problem of type SSS where all three sides are known.
To solve a an angle $\alpha$ of the triangle one uses the appropriate version of the Law of Cosines
$$\cos\alpha=\frac{b^2+c^2-a^2}{2bc}$$
In this case,  we have
$$ \cos(\angle CAB)=\frac{r^2+f^2-(r+a)^2}{2rf}$$
and to find angle $\beta$ we subtract away a right angle.
$$ \beta=\angle CAB-90^\circ$$
The angle $\eta$ can be found in a similar fashion, using the Law of Cosines.
A: Firstly, $\angle ACB=\frac dr$
Then, using the Sine Rule in $\triangle ABC$, you have $$\frac{r+a}{\sin(90+\beta)}=\frac{f}{\sin(\frac dr)}$$
So if you first work out $f$ using the Cosine Rule:$$f^2=r^2+(r+a)^2-2r(r+a)\cos(\frac dr)$$
Then you can calculate $\beta$
When $B$ is below the horizon, you just have to change from $90+\beta$ to $90-\beta$ in the above.
A: Vectors, anyone?
a  = A - C
b  = B - C
f = b - a

b is a rotated by d/r and scaled by (r + a)/r

then find the angle between a perpendicular and f
you can use the below in 2D also: https://math.stackexchange.com/q/2385142 (version: 2017-08-07)
much normalization can be avoided by use of atan2() on each vector:
atan2(f) - atan2(a) +/- pi/2
