How to get center coordinates of circles on edge bigger circle?

1.6k Views Asked by At

I want to draw 8 smaller circles on the edge of a big circle. I know the distance between all small circles should be 20. How can I find the center coordinates of the circles? I already know the center coordinates of the first small circle.

What I know:

  • Center coordinates of big circle is (100,100)
  • Big circle radius is 200
  • There are 8 small circles
  • Distance between edges of small circles is 20
  • Center coorindates of first small circle
  • Size of all small circles is equal

What I want to know:

  • Center coordinates of small circles

Sketch problem:

enter image description here

4

There are 4 best solutions below

1
On BEST ANSWER

You already have a formula for finding the center of one of the small circles:

x = xBigCircle + Math.round(200 * Math.cos(phi));
y = yBigCircle + Math.round(200 * Math.sin(phi));

Since you want the small circles all to be the same size and each one is the same distance from each of its neighbors, they will be evenly spaced around the circle. Since one full turn around the circle is the angle 2 * Math.PI, you want one eighth of that, which is 0.25 * Math.PI. Stepping by that angle around the circle eight times, starting at the first circle, gets you back to the first circle while finding seven other equally-spaced points.

The centers of the small circles should be at

x = xBigCircle + Math.round(200 * Math.cos(phi + n * 0.25 * Math.PI));
y = yBigCircle + Math.round(200 * Math.sin(phi + n * 0.25 * Math.PI));

where n ranges from $0$ through $7$, inclusive ($0 \leq n < 8$). The value $n=0$ is just the center of the first small circle, which you already know.

To make a "gap" of size $20$ between each pair of small circles, just set the radius of the small circles accordingly. The distance between centers is 200 * 2 * Math.sin(Math.PI/8), subtract $20$ from that for the desired gap, then divide by $2$ to get the desired radius.

5
On

Regardless of the radii of the smaller circles, this is essentially drawing a regular octagon in the big circle. The vertices of the octagon lie on the big circle and represent the centres of the small circles.

From here, trigonometry or coordinate geometry will finish the job.


I'm adding the sketch of another answer which looks quite elegant to me, based on the above.

Consider the $8$th roots of unity in the complex plane, that is, $e^{\frac{\pi}{4}i}, e^{\frac{\pi}{2}i}, e^{\frac{3\pi}{4}i}, e^{\pi i}, e^{0}, e^{-\frac{\pi}{4}i}, e^{-\frac{\pi}{2}i}, e^{-\frac{3\pi}{4}i}$. These lie on the unit circle centred at zero.

Now, we can easily scale them to the unit circle of radius $200$ by multiplying them all by 200, and converting them to cartesian form using $z = r\cos\theta + ir\sin\theta$. Then the real part is your $x$-coordinate and the imaginary part is the $y$-coordinate. The rest is rotation (changing $\theta$) or translation.

3
On

Hint: The distance of 20 will generate a isosceles triangle with the leg = R = 200.

Use $\sin(\alpha/2)=(20/2)/200$ to calculate alpha of the distance. How many distances do you have? It should be eight. Now the angle of all distances between the circles is $8\alpha$. From this you can calculate the angle of the circles $\beta$ by $8\beta=360-8\alpha$. Can you complete it from here?

If you know the angle for each circle the thing is pretty easy to calculate you need to find out the angle of the center of the circle and then use the definition of $\sin(x)$ and $\cos(x)$ to calculate the $x$ and $y$ coordinates of the centers.

9
On

Center coordinates of all small circles are: enter image description here