I'm a programmer and I saw this question on stackoverflow which exactly does my job: https://stackoverflow.com/questions/13608186/trying-to-plot-coordinates-around-the-edge-of-a-circle.
In this, the answer says that:
var items = 10; // say there are 10 points to be plotted.
var x0 = 40;
var y0 = 40;
// Remember top left pixel of computer screen is (0,0) and both axis go positive from left to right and top to bottom.
for(var i = 0; i < items; i++) {
var x = x0 + r * Math.cos(2 * Math.PI * i / items); // WHAT IS HAPPENING HERE?
var y = y0 + r * Math.sin(2 * Math.PI * i / items); // WHAT IS HAPPENING HERE?
}
I'm just undone about the code above. How is that happening. Why are we adding the x0 and y0 (coordinates of center of circle). How does it gives us exact points exactly equidistant from each other? Please explain how this math is working.
For e.g., the above code gives us like this:

That's what I want to do. The points generated is the variable items.
The equations translated:
$$x(n)=x(0)+r\cos\left(2\pi\frac{n}{N}\right)\\ y(n)=y(0)+r\sin\left(2\pi\frac{n}{N}\right)\\$$
Remember points on a circle with centre at $x_0,y_0$ with radius $r$ at an angle $\theta$ are: $$(x,y)\equiv(x_0+r\cos\theta,y_0+r\sin\theta)$$ The $360^\circ\equiv2\pi$ radians has been divided into $N$ parts and thus the angle between two adjacent points will be $2\pi/N$, I hope you can understand the rest.