Lab 06 - SpaceVoyage2

Lab 06 - SpaceVoyage2 - from _future_ import division from...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
from __future__ import division from visual import * scene.width =1024 scene.height = 760 #CONSTANTS G = 6.7e-11 mEarth = 6e24 mMoon = 7e22 mcraft = 15e3 deltat = 10 pscale = .5 #OBJECTS AND INITIAL VALUES Earth = sphere(pos=vector(0,0,0), radius=6.4e6, color=color.cyan) Moon = sphere(pos=vector(4e8, 0, 0), radius=1.75e6, color=color.white) # Choose an exaggeratedly large radius for the # space craft so that you can see it! craft = sphere(pos=vector(-10*Earth.radius, 0,0), radius=3.2e6, color=color.yellow) vcraft = vector(0,3270,0) pcraft = mcraft*vcraft parr = arrow(color=color.green) r = craft.pos - Earth.pos rmag = sqrt(r.x**2 + r.y**2 + r.z**2) rmoon = craft.pos - Moon.pos rmagmoon = sqrt(rmoon.x**2 + rmoon.y**2 + rmoon.z**2) rhat = r / rmag rhatmoon = rmoon / rmagmoon trail = curve(color=craft.color) ## craft trail: starts with no points t = 0 scene.autoscale = 0 ## do not allow camera to zoom in or out #CALCULATIONS while t < 10*365*24*60*60: rate(2000) ## slow down motion to make animation look nicer
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

Lab 06 - SpaceVoyage2 - from _future_ import division from...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online