# How many equally spaced points are needed around a circle of radius r such that every point is d units apart from eachother?

This question is a bit different than what I have seen here. I know how to calculate the positions such that n points will be equally spaced around a circle however I am trying to solve a different problem. Lets say I am trying to draw a circle with a computer program and I want to intelligently decide how many points will be needed such that the lines between the points are d units a part. This formula would allow for small circles to be drawn with few points but large circles to be drawn with many.

I have tried to solve for d using the following formula however I am not sure I solved it right. In this formula I am solving for dr or the ammount I will need to increment the angle by for each of these points. The number of points needed would then be ceil((2 * PI) / dr)

d = |(r*(cos(dr) - cos(0)))^2 + (r*(sin(dr) - sin(0)))^2|


And I solved this down to dr = (((d/r*r)-2)/-2.0f) but I do not think that that is right.

I am also told the solution may be dr = d / (2.0 * r * PI + 6) but I have no idea where this came from.

• Right that is the goal. In order to do that I need to calculate how many lines would make up this regular polygon. – CalebK Apr 16 at 19:29

The figure below shows one side of the polygon that represents the circle. The radius of your circle is $$g$$ or $$h$$ and the side of the polygon is $$BC$$. You ask that $$|BC|=d$$. From the upper right triangle we have $$\frac d2=h\sin \theta$$. This gives that the full angle subtended by the side is $$2 \theta=\arcsin \frac d{2h}$$. The number of sides is $$\frac \pi \theta$$. If this doesn't come out even, presumably you want to round up in number of sides and down in the length of the sides.

If I understand your question, you can't always find a number of points $$n$$ that will be spaced a distance $$d$$ apart from each other when placed evenly around a circle. After all, suppose you have a given circle of radius $$r$$. You can make a table where you list various numbers of points $$n$$ spaced evenly around the circle, and the corresponding distance $$d(n)$$ between the points. These entries are discrete, rather than continuous. If you have a value of $$d$$ that doesn't appear in the table, then you can't find $$n$$ points that are spaced $$d$$ units apart.

That being said, you can always arrange for all but one pair of neighboring points to be distance $$d$$ apart, as follows.

When $$n$$ points are spaced evenly around the circumference of a circle, the angle between any two pairs of points is $$\theta = 2\pi/n$$ (in radians). The two points form a triangle with the center of the circle being the third point; in this case, the distance $$d$$ between the two points is the base of the triangle, and the other two sides have length $$r$$, the radius of the circle. Split the triangle in half and you have a right triangle (drawing a picture can help).

By trigonometry, you can solve for $$d$$ in terms of $$r$$ (the size of the circle) and $$\theta$$ or $$n$$ (the number of points):

$$\frac{d/2}{r} = \sin(\theta/2) = \sin\left(\pi / n\right)$$

Solving for $$\theta$$ or $$n$$:

$$\theta = 2\arcsin\left(\frac{d}{2r}\right)$$ $$n = \frac{2\pi}{\theta} = \pi/\arcsin\left(\frac{d}{2r}\right)$$

When $$n$$ is an integer, you'll have evenly spaced points. When $$n$$ isn't an integer, you'll have points spaced $$\theta$$ units apart still, except for the first and last points you place.