Drawing a circle is easy: all you need is a loop and the right equations:
px = cx + r * cos(a)
py = cy + r * sin(a)
Where the center of the circle with radius
r
is
(cx, cy)
, and
a
is the angle which changes as you go round the circle drawing the points / lines
(px, py)
.
The smaller the change in angle each time round your loop, the better the resolution of the circle.
So if you want a circle that is actually square, the angle has five values: 0
o, 90
o, 180
o, 270
o, and 360
o (or their equivalent in radians) though the first and last will generate the same point. More pints, better looking circle - as the number of points you need obviously increases as the radius of the circle does because the length of its circumference is proportional to that radius.