I'd like to calculate all points in a circle. I already know I can calculate points using x = r * cos(theta) + x0, y = r * sin(theta) + y0 - however I was wondering if there is a nice way to find an appropriate step size for theta, based on the resolution of my pixel canvas (or LCD for me) and the radius of the circle.
This is the code I already have (_arange() is like range() but also takes a floating value for step):
def circle(x0, y0, r):
step = 2 * math.pi / 1000
for theta in _arange(0, 2 * math.pi, step):
x = x0 + r * math.cos(theta)
y = y0 + r * math.sin(theta)
set(round(x), round(y))