Distance between two lines inside a circle In the following figure:

The points are given by
$$
\begin{aligned}
A &= (\cos(a_1), \sin(a_1)) \times r_1 \\
C &= (\cos(a_2), \sin(a_2)) \times r_1 \\
&\\
B &= (\cos(a_1), \sin(a_1)) \times r_2 \\
D &= (\cos(a_2), \sin(a_2)) \times r_2
\end{aligned}
$$
where $a_1$ and $a_2$ are angles, $r_1$ the radius of the small circle and $r_2$ the radius of the big circle.
As you can see, the angles are the same for both circles, but because the radius is not the same, the points end up in a different place, and are not aligned.
Now I have two problems, that may be in fact the same, I don't know, you can choose to answer either of them:

*

*Find the distance between the two lines (AC) and (BD)

*Determine the angle of $B'$ and $D'$, from the point of view of the small circle, such as the points are on the (AC) line

I figured out the first problem by taking the dot product of the normal of (AC) and the vector AB, but this solution seems overkill, because the second line is not "any" line, it's just a scaled version of the first line, so maybe there's a better way to compute this distance?
Or we could solve the second problem instead, to get the angle such as $B'$ gets aligned with (AC) (and this angle is not $a_1$, because the radius is different unfortunately, and I have no idea what it could be)
 A: The angular displacement between $A$ and $C$ is $a_2 - a_1$, therefore, the minimum (perpendicular )distance from the origin to line $AC$ is given by
$d_1 = r_1 \cos \dfrac{(a_2 - a_1)}{2} $
similarly the minimum (perpendicular) distance from the origin to $BD$ is given by
$d_2 = r_2 \cos \dfrac{(a_2 - a_1)}{2} $
Hence the distance between the two lines is
$d = d_2 - d_1 = (r_2 - r_1) \cos \dfrac{(a_2 - a_1)}{2} $
For the second part, point $B'$ is given by
$B' = r_2 (\cos \phi, \sin \phi ) = A + t (C - A) $
Since the distance of $B'$ from the origin is $r_2$, then $t$ must be the root of the following equation:
$\mathbf{A} \cdot \mathbf{A} + 2 t \mathbf{A} \cdot (\mathbf{C}-\mathbf{A}) + t^2 (\mathbf{C} - \mathbf{A}) \cdot (\mathbf{C} - \mathbf{A}) = r_2 ^2$
All the quantities can be computed, and the quadratic equation in $t$ can be solved using the quadratic formula resulting in two values of $t$ corresponding to point $B'$ and $D'$.  The negative value of $t$ corresponds to $B'$ and the positive value corresponds to $D'$.  To find the angles just use the $\text{ATAN2}$ function, so that
$\phi_{\text{B'}} = \text{ATAN2}( B'_x , B'_y)$
$\phi_{\text{D'}} = \text{ATAN2}( D'_x , D'_y)$
