While programming I have faced a math problem that needs to be solved before I can move on. Maybe you need more input data to be able to solve it, if that's the case, just let me know and I will consider this like it doesn't have a solution and move on and see if there are other ways of programming it.
Here is the problem:
You have a small circle,
- Predecided radious. Can be changed but we always know its value
- Center point, "A" is known, this will never be changed
You have a predecided point, "C". Can be changed but we always know its value
Now, the task is to come up with a bigger circle where its border have to touch point "C" and another unknown point "D". Point "D", exists somewhere on the border of the small circle.
In other words, the small circle should be inside the bigger one and touch each other in only one point "D" internally. At the same time the border of bigger circle shoud also touch point "C".
This is our starting point:
- Radius of small circle is known
- Point "A" is known
- Point "B" is unknown
- Point "C" is known
- Point "D" is unknown
We need to find B and D, if we do that, we get a triangle like the picture shows. Then we should be able to get the alpha angle CBD. When we have the angle we can easly do the calculation to get the arc distance between point C and D for the bigger circle, thats our final mission.
As I mentioned before, since point "C" and radius of small circle can vary, we need to find a general solution so the calculation always works


For convenience, I'll use $r$ for the (known) radius of the small circle and $R$ for the radius of the larger circle.
If the radius of the larger circle is not known in advance (that is, if we take the question as originally posted, where only $r$ and the positions of $A$ and $C$ are known at the start), then there are infinitely many solutions.
If the known coordinates of $A$ are $(0,0)$ as in the graph in the question, the simplest solution (in my opinion) is to find the distance from $A$ to $C$ -- let's call this distance $d$ -- and then multiply each of the coordinates of $C$ by $-\frac{r}{d}.$ This gives you the coordinates of $D.$ The points $A,$ $B,$ $C,$ and $D$ will all lie on the same single straight line with $B$ exactly halfway between $C$ and $D.$ It follows that $R = \frac12(d + r).$
If $R$ is given and is equal to $\frac12(d + r),$ then the solution in the previous paragraph is the only solution.
If $R$ is given but $R < \frac12(d + r),$ there is no solution.
But if $R$ is given and $R > \frac12(d + r),$ there are exactly two solutions. Rather than look at the triangle $\triangle BCD,$ however, I would look at $\triangle ABC.$ This has sides $AC = d,$ $BC = R$, and $AB = R - r,$ all of which are known or easily computed from the positions of known points. So by the law of cosines, $$ R^2 = d^2 + (R - r)^2 - 2 d(R-r) \cos\angle BAC.$$
Solve for $\cos\angle BAC$ and deduce $\angle BAC.$ Since you know the direction from $A$ to $C,$ by adding or subtracting $\angle BAC$ from that direction and taking the distance $R - r$ from $A$ to $B$ you can determine the two possible locations of $B.$