Advertisement
bwukki

Untitled

Mar 8th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. from visual import *
  2. scene=display(title="Universe!",x=0, y=0, width=800,
  3.               height=600,range=vector(500000000,500000000,500000000),
  4.               center=vector(0,0,0))
  5.  
  6. t = 0.0
  7. dt = 10000 #change in time
  8. sMoon = vector(384472282.0, 0.0, 0.0)
  9. sEarth = vector(0.0,0.0,0.0)
  10. v = 1023.41 #avg velcoity of moon
  11. r = 384472282 #distance between earth and moon
  12.  
  13.  
  14. Moon=sphere(pos=sMoon,radius=4000000,color=color.white, make_trail=True, trail_type="points", interval=10, retain=500) #moon model with trail
  15. Earth=sphere(pos=sEarth, radius=90000000, material=materials.earth) #earth model
  16.  
  17. while t < 5000000: #time for program to run
  18.     rate(50)  # This slows down the computer to 50 frames per second
  19.     sMoon = (cos(v*t/r)*r,sin(v*t/r)*r,0) #calculates the position of the moon
  20.     Moon.pos=sMoon #updating moon's position
  21.     t = t + dt #updating time
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement