# Computing overlapping circle positions, equidistant from each other.

Hello, I am a programmer and I wanted to develop an application that would have several overlapping circles in the same location, where each circle can be selectable.

Is there a mathematical way of computing circle positions to be equidistant from each other. The image shows something similar to what I want to achieve. I assume the distance between neighboring circles in the pattern should be the same, where their edges overlap the centers? Is there a formula for something similar? Or is this something achieved per individual case computation.

Thank you

• I recommend specifying your question a little more clearly if you want responses. – parsiad Oct 22 '14 at 18:55
• It looks like the circle centers are just spaced at regular intervals around a circle? – Hao Ye Oct 22 '14 at 19:04
• I am trying to construct a better, not hastily drawn image, not the best at it. The idea is for the circle to be within a center position (x,y), the more circles, the smaller the distance between their centers (more clustered). – DustBunny Oct 22 '14 at 19:07

The simplest way is to use polar coordinates to obtain the centers of $n$ circles equidistant from each others. These coordinates are

$$(\rho \cos\frac{2 \pi k}{n}, \rho \sin\frac{2 \pi k}{n})$$

where $\rho$ is the radius of the circles and $k=0,1,2...(n-1)$ is an integer that identifies the $k^{the}$ circle, counting them from that corresponding to $k=0$ (whose center is on the $x$-axis) and moving in a counterclockwise direction. For example, for $n=6$ and considering a radius of $\rho=5$, the formulas would give the following coordinates for the six centers:

$$(5 \cos\frac{0\pi}{6}, 5 \sin\frac{0\pi}{6})= (5,0)$$

$$(5 \cos\frac{2 \pi}{6}, 5 \sin\frac{2 \pi}{6})=(\frac{5}{2},\frac{5\sqrt{3}}{2})$$

$$(5 \cos\frac{4\pi}{6}, 5 \sin\frac{4\pi}{6})= (-\frac{5}{2},\frac{5\sqrt{3}}{2})$$

$$(5 \cos\frac{6\pi}{6}, 5\sin\frac{6\pi}{6})= (-5,0)$$

$$(5 \cos\frac{8 \pi}{6}, 5\sin\frac{8 \pi}{6})=(-\frac{5}{2},-\frac{5\sqrt{3}}{2})$$

$$(5 \cos\frac{10 \pi}{6}, 5\sin\frac{10 \pi}{6})=(\frac{5}{2},-\frac{5\sqrt{3}}{2})$$

This approach gives you the centers of $n$ circles equally spaced around the origin, equidistant from each others, all passing through the origin, and with at least one circle having its center on the $x$-axis. If we do not want any center to be on the $x$-axis, we could also rotate all centers counterclockwise by an angle $\theta$. In this case, the coordinates of the centers become

$$[\rho \cos(\frac{2 \pi k}{n}+ \theta), \rho \sin(\frac{2 \pi k}{n}+ \theta)]$$

In addition, to change the degree of overlapping, we could decide to move all centers away from the origin or towards it by a distance $d$ without modifying the radius. To do this, set the coordinates as

$$[(\rho+d) \cos(\frac{2 \pi k}{n}+ \theta), (\rho +d) \sin(\frac{2 \pi k}{n}+ \theta)]$$

where for $d$ positive the centers move away and the overlapping reduces, whereas for $d$ negative (and $|d| \leq \rho$) the centers move towards the origin and the overlapping increases.

Lastly, to draw the circles once the centers have been identified, remind that the equation of a circumference having radius $\rho$ and center with coordinates $(p,q)$ is given by

$$(x-p)^2+(y-q)^2=\rho^2$$

• Thank you, this is a very well described answer! I really appreciate it – DustBunny Oct 23 '14 at 8:18