# Calculate center coordinates of circles surrounding a larger circle

I want to draw, say, 8 smaller circles that are adjacent to the big circle the edge of a big circle, similar to this picture.

I know the center coordinates of the bigger circle $$(A, B)$$, its radius $$(R)$$,radius of the smaller circles $$(r)$$, and the number of circles I want to draw $$(n)$$.

My question is very similar to the one discussed there, with one exception. I want a formula that calculates center coordinates of circles adjacent, not those on the edge of a bigger circle. Mathematics is not my strongest side (to say the least), so I'd greatly appreciate any help. Thank you!

• I think $n$ determines $r$, so for example if you want $6$ externally tangent circles then $r$ is fixed at $r=R$ (all $7$ circles are the same size in that special case). In general, you could write $r$ as a function of $n$ and it would be strictly decreasing. Commented Jan 14, 2019 at 20:13
• I mention that because you cannot presuppose $n$ and $r$ - most pairs that you choose will lead to impossible situations. Just presuppose $n$ and $R$ and those will together determine $r$. Commented Jan 14, 2019 at 20:14
• Thank you, that makes sense (in lay terminology, only certain amount of circles of size will fit, correct?) Commented Jan 14, 2019 at 20:16
• Connect the centers of the $n$ externally tangent circles and you will have a regular $n$-gon Commented Jan 14, 2019 at 20:16
• If you choose the number of small circles and the size of the big circle, the size of the small circles is fixed, invariable, set, locked. Commented Jan 14, 2019 at 20:17

For the 'adjacent' circles use : $$\delta = 360/n$$ where $$n$$ is the number of circles you want. Then the centers are $$c_i = ((R+r)\cos i\delta + \phi, (R+r)\sin i\delta + \phi)$$, where $$i=0,1,...,n-1$$ and $$\phi$$ is some offset rotation. Note that the small circles will not necessarily touch, but they will touch the large circle.

• I just edited it, realized I had already divided by $n$, so check the corrected version. @AntonLeontyev Commented Jan 14, 2019 at 20:25
• Could you please clarify what do you mean by "offset rotation"? Thank you! Commented Jan 14, 2019 at 20:29
• @AntonLeontyev check the shadertoy example I gave, the offset is literally what rotates the circles around. Commented Jan 14, 2019 at 20:41