moving object along circle

sparx10 at gmail.com sparx10 at gmail.com
Tue Nov 20 22:35:00 EST 2012


I'm trying to move an object along a circle (orbit), and I did come up with this:

radius = 100
from math import sqrt
for x in range(-radius,radius):
    y = sqrt(radius**2-x**2)
    print(x, y)

however it moves faster at the beginning and end of the range (y value changes faster than x value) because the x value is changing at a constant rate but the y value isn't. I can't think of a way to get something to move smoothly around in a circle though..



More information about the Python-list mailing list