# Find points on a circle given arc length and radius.

I am trying to layout a circle, given the arc length l, radius r and center (cx, cy). I need to find all the n points that are on the circle.

What I've tried so far:

The first part is to find n:

n = floor(2*pi*r/l); i.e. dividing circumference in to equal number of arcs.

Now my next task is to find the n points. I would assume my first point to be p(cx+r, cy) and try to go on clockwise direction from there.

for(each point)
{
draw(p);
angle = atan2(py-cy, px-cx);
px    = cx + r * cosine(angle);
py    = cy + r * sine(angle);
}


This doesn't seem to work, I am not sure where I am making a mistake. Please help.

• to make sure I understand, are you trying to find the coordinates of a set of points which divide the circle into n arcs of equal length? May 22, 2014 at 21:20
• @rVitale Yes Sir!! May 22, 2014 at 21:22
• @Dasari: from the given data it seems that $n$ must be computed from $l$, as $2\pi\frac rl$. Generally, this won't be an integer. If you truncate or round to get integer $n$, the arc length will be slightly different, $\frac{2\pi}n$.
– user65203
May 22, 2014 at 21:38

If you want to divide a circle into $n$ arcs you can split the angle $2 \pi$ into $n$ parts: $\left[0, 2\pi \cdot\frac{1}{n}\right]$, $\left[2\pi \cdot\frac{1}{n},2\pi \cdot\frac{2}{n}\right]$,...,$\left[2\pi \cdot \frac{n-1}{n},2\pi\right]$. Use the endpoints of these intervals to define points on your circle: $p_k =\left(c_x+r\cos(2\pi\cdot\frac{k}{n}),c_y+r\sin(2\pi\cdot\frac{k}{n})\right); k=1,2,3,...,n$. When $k=0$ you get the point you wanted to start with, and you can check that the points are being plotted counter-clockwise as $k$ increases.

• It worked, pretty simple. May 22, 2014 at 22:20
• Wish I had found this after I had done a lot of tedious trig to find the same answer :) Jun 20, 2020 at 13:32

You've got a few things going on here.

Pi is a constant ratio; it has no unit. It merely describes the ratio of a circles circumference to its diameter. I will take this phrase to mean you are doing your calculations in radians. If this is the case, why are you calling a method entitled "RadiansToDegrees"? Also, you are calling this on the arc length. Remember, in your given information, l represents arc length, not an angle measure.

I take it you are programming this on a computer? If so, then the line:

angle = atan2(py-cy, px-cx);

is useless, considering the next line changes your variable "angle".

From @rVitale's comment:

to make sure I understand, are you trying to find the coordinates of a set of points which divide the circle into n arcs of equal length?

If this is true, then you have too many constants, since you are unsure that the given arc length l will produce n equal parts, given n (unless it is stated). For the remainder of my answer, I will assume you meant what @rVitale did.

Given that you must find n equal arcs in a circle of given radius, the arc length ("s") will be: $$s = \frac{2\pi{r}}{n}$$ The angle will be: $$\theta = \frac{s}{r}$$

Then just iterate through your loop, adding angles as necessary. The finished code would look something like this:


s = (2*pi*r)/n;
angle = s/r;
currentAngle = 0; //because it's a circle, it doesnt matter where you start because you can just rotate it
for(n times) {
px = cx+r*cosine(currentAngle);
py = cy+r*sine(currentAngle);
draw(px, py);
currentAngle = currentAngle + angle;
}