I have a set of circles of arbitrary radii: $r_1, r_2, r_3, ... r_n$.
I wish to arrange them around an inner circle so that they are all touching the perimeter of the inner circle, and do not overlap each other.
What I don't know how to do is figure out the inner radius $r_{inner}$.
I can figure out the angle each circle will use given an inner radius: $\theta_i = 2\sin^{-1} \frac{r_i}{r_i+r_{inner}}$, so I can test whether an inner radius is correct.
My first guess was to solve $2\pi = \sum_i (2\sin^{-1} \frac{r_i}{r_i+r_{inner}})$ for $r_{inner}$, but that's beyond my skills.
I also considered whether the sum of the diameters would equal the circumference of the circle, but that's a set of line segments rather than a smooth arc, and correcting that is also beyond me.
How do I figure out $r_{inner}$?
Numbers of circles around a circle is related, but assumes the circles are identical, which mine are not.
Answer
Using the cosine rule, the angle at the centre of the inner circle between lines through the centres of two adjacent touching circles is given by
$$
\varphi(i,{i+1}) \;=\;
\cos^{-1}\left(\frac{R^2+R r_i+R r_{i+1}-r_i r_{i+1}}{(R+r_i) (R+r_{i+1})}\right)
$$
where I've used $R$ instead of $r_{inner}$ for simplicity.
So, we need
$$
\qquad\qquad\qquad
\qquad\qquad\qquad
\sum\limits_{i=1}^n\varphi(i,{i+1})\;=\;2\pi
\qquad\qquad\qquad
\qquad\qquad\qquad(1)
$$
where we consider $r_{n+1}=r_1$.
Using trigonometric identities, for a given $n$, it is possible to convert this into a very complex expression full of square roots, but there seems to be no easy way of solving the result in general (although for $n=3$ and $r_i=1,2,3$, we somewhat surprisingly get $R=\frac{6}{23}$).
Numerical solution is probably the best approach. (The diagram below was generated using Mathematica to solve numerically.)
Moreover, although this is a necessary condition, it is not sufficient in general because a sequence of small circles between two large circles may not fit tightly, causing the solution above to give an incorrect result (with the large circles overlapping):
$\qquad\qquad\qquad\qquad$
So for all $i\neq j$, for the above solution to be correct we also need
$$
\varphi(i,j) \;\geqslant\; \sum_{k=i}^{j-1}\varphi(k,{k+1})
$$
with appropriate wrapping around of indexes if $i>j$. If this does not hold for some $i$ and $j$, then the correct solution for $R$ is obtained from $(1)$ by discarding circles $i+1,\ldots,j-1$. Due to the possibility of nested overlapping, the testing and discarding needs to be done iteratively, considering increasing values of $|i-j|$ in order.
No comments:
Post a Comment