The title sums it up pretty well, though I will elaborate:

I am trying to find the Diameter/Radius of a set of smaller circles that are inscribed in a ring-like fashion tangentially on the inside edge of a larger circle. The number of circles will change dynamically with the program they are being displayed in like so. You can assume you have the diameter of the larger circle - and what is needed is the diameter of the smaller circles

Or like so.

I have searched for a while but have come up empty to a post that gives an accurate and sourced answer. If anyone could help I would be forever grateful :)

  • $\begingroup$ Please insert the image in your text. $\endgroup$ – Jean Marie Nov 11 '19 at 8:22
  • 1
    $\begingroup$ @JeanMarie New users cannot embed images. You need to meet a certain reputation threshold before images can be embedded. $\endgroup$ – Xander Henderson Nov 11 '19 at 14:18

Here is a solution, that I give in two parts :

A) for the first level (see Fig. 1).

Let $n$ be the number of small circles. Take the vertices of a regular $n$-gon inscribed into the unit circle as the centers of your circles ; the common radius of these circles warranting their tangencies two by two is $r=\tfrac{VW}{2}=\sin \tfrac{\pi}{n}$, (consider that in isosceles triangle $VOW$, angle $VOW=\tfrac{2\pi}{n}$ giving distance $VW=2\sin \tfrac{\pi}{n}$). The radius of the large circle will have to be $1+r$ in order to ensure the tangency of the small circles to it.

Remark : therefore, the ratio Radius of a small circle/Radius of the large one is $r/r+1$.

enter image description here

Fig.1 : The case $n=8$.

The following Matlab program implements this solution using complex numbers.

  w=exp(i*2*pi/n);% point W
  r=sin(pi/n);% radius of all small circles
  % Function "cir(cle)" with parameters "C" center, "R" radius :
  pol=w.^(0:n);%plot(pol,'r');% polygon inscribed in unit circle
  P=[cir(0+0i,1+r),NaN];% external circle (NaN is for "pen up")
   for k=1:n;
       P=[P,NaN,cir(pol(k),r)];% adding circle n°k

B) General drawing (Fig. 2) :

We are now faced with a recursive issue. We have to draw the very same figure obtained in part A) :

  • at a smaller scale with a scale ratio $r/(r+1)$ ; we have encountered this ratio in a remark above.

  • at different places (which are the vertices of the regular $n$-gon defined in part A)).

Once this has been done, we just have to repeat the process, taking every time the new figure as "point of departure" for the next one. The whole process will be done $d$ times where $d$ is the "depth" we want to achieve in this recursive drawing. The details will be understood by analysing thoroughly the following part (to be concatenated with the previous program) :

for d=1:3 ; % d manages the depth
   Q=[];% list of "objects" to be drawn
   for k=1:n
      Q=[Q,NaN,pol(k)+(r/(r+1))*P];% concatenation 

giving a figure such as Fig. 2:.

enter image description here

Fig. 2: Case $n=4$ (based on a polygon with $n=4$ vertices, alias a square... and depth $d=3.$

Edit : Some explanations on the Matlab code and its peculiar aspects:

Point $V$ has modulus $1$, polar angle $0$, therfore represented plainly as number $1$. Point $W$ has modulus $1$, polar angle $2\pi/n$, therefore is represented by complex number $w=1e^{i2\pi/n}$; the other vertices having modulus $1$, polar angle $k2\pi/n$ ($k=2,3...$), they re represented by complex numbers $1e^{i2k\pi/n}=(e^{i2\pi/n})^k=w^k$ ; finaly, connecting all of these vertices, we get $1=w^0, w^1, w^2, ... w^n=1$, abbreviated in the program under the compact form $pol=w^{0,1,2, \cdots n}$. Therefore, pol is to be understood as an array of $n+1$ complex numbers representing the vertices (please note that the first vertex is represented twice for "loop closing" necessity).

$cir$ is a function with two parameters, called under the form $cir(C,R)$ ; the result is an array of complex numbers that are points of the circle with center $C \in \mathbb{C}$ and radius $R \in \mathbb{R_+}$.

We constitute a big array $P$ using progressive concatenation of the small arrays in the loop $P=[P, NaN, ...]$ (NaN, in this context, generates a "pen up" action in order that no spurious straight line is drawn between individual circles) initializing the process with $P=[ \ ]$ (empty list). We find the same construction later on with $Q=[Q,NaN,...]$.

Concerning the second part of this program, the general idea is of course to do the same thing as before at different places (loop on $k$), at a different scale $(r/(r+1))$ and at a different depth (loop on $d$). One could ask why the different scales aren't $(r/(r+1))^2$, $(r/(r+1))^3$... : this is because $P$, the "reference" old set of circles of the first level is replaced by (one of) the new ones, temporarily called $Q$, and then taking the name $P$ (instruction $P=Q;$.)

| cite | improve this answer | |
  • $\begingroup$ Hey, apologies for being difficult - I am unable to wrap my head around the MatLab code you have given me, as I am a mere Java peasant who does not yet comprehend the wizard-like knowledge of a language such as MatLab. Would you mind clarifying your code a little bit for me? $\endgroup$ – Aec Nov 12 '19 at 3:30
  • $\begingroup$ Sorry, unable to answer you right now but in a few hours. One question : are you familiar with complex numbers ? $\endgroup$ – Jean Marie Nov 12 '19 at 5:21
  • $\begingroup$ Another question : is the first program understandable ? $\endgroup$ – Jean Marie Nov 12 '19 at 5:24
  • $\begingroup$ Could you answer my 2 questions ? It will help me, in return, to "clarify my code" in a better fitted way. $\endgroup$ – Jean Marie Nov 12 '19 at 21:39
  • $\begingroup$ Sorry for the delay Jean! In regards to the complex numbers, I feel like I understand them ~well enough~ to get their place in the code, however, I am having trouble understanding the syntax of the Matlab code itself, so I am not sure what a lot of it means as it looks entirely foreign to me, since I do not know the language. $\endgroup$ – Aec Nov 13 '19 at 2:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.