Thursday 20 February 2014

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



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


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.


No comments:

Post a Comment

real analysis - How to find $lim_{hrightarrow 0}frac{sin(ha)}{h}$

How to find $\lim_{h\rightarrow 0}\frac{\sin(ha)}{h}$ without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...