# pip install ivisual
from ivisual import *
canvas(width=900, height=400)
earth = sphere(radius = 6371, color=color.blue)
moon_earth_dist = 50000
moon = sphere(radius = 1737, pos=(moon_earth_dist, 0, 0), color=color.gray(0.7))
sat_earth_dist = 15000
sat = box(width=1000, height=1000, length=1000, pos=(sat_earth_dist, 0, 0), color=color.white)
r = moon_earth_dist
r2 = sat_earth_dist
for _ in range(100):
for theta in np.linspace(0, 2*np.pi):
rate(24)
x = r*np.cos(theta)
y = r*np.sin(theta)
assert np.allclose(x**2+y**2, r, x**2+y**2)
moon.pos = (x, y, 0)
x = r2*np.cos(theta*4)
y = r2*np.sin(theta*4)
sat.pos = (0, x, y)