Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
summer_2018:gravitation [2018/06/19 03:36] tallpaul [Part B] |
summer_2018:gravitation [2018/06/19 03:52] (current) tallpaul [Part B] |
||
---|---|---|---|
Line 23: | Line 23: | ||
<code> | <code> | ||
- | from __future__ import division | + | get_library('https://rawgit.com/perlatmsu/physutil/master/js/physutil.js') |
+ | rom __future__ import division | ||
from visual import * | from visual import * | ||
from visual.graph import * | from visual.graph import * | ||
- | from physutil import * | ||
#Window setup | #Window setup | ||
Line 34: | Line 34: | ||
#Objects | #Objects | ||
- | Earth = sphere(pos=vector(0,0,0), radius=6.4e6, material=materials.BlueMarble) | + | Earth = sphere(pos=vector(0,0,0), radius=6.4e6, texture=textures.earth) |
Satellite = sphere(pos=vector(7*Earth.radius, 0,0), radius=1e6, color=color.red, make_trail=True) | Satellite = sphere(pos=vector(7*Earth.radius, 0,0), radius=1e6, color=color.red, make_trail=True) | ||
Line 51: | Line 51: | ||
#Calculation Loop | #Calculation Loop | ||
while t < tf: | while t < tf: | ||
- | rate(10000) | + | rate(10000) |
- | Fnet = vector(0,0,0) | + | Fnet = vector(0,0,0) |
- | pSatellite = pSatellite + Fnet*dt | + | pSatellite = pSatellite + Fnet*dt |
- | Satellite.pos = Satellite.pos + (pSatellite/mSatellite)*dt | + | Satellite.pos = Satellite.pos + (pSatellite/mSatellite)*dt |
- | SatelliteMotionMap.update(t, pSatellite/mSatellite) | + | SatelliteMotionMap.update(t, pSatellite/mSatellite) |
- | t = t + dt | + | t = t + dt |
- | + | ||
- | #Earth Rotation (IGNORE) | + | #Earth Rotation (IGNORE) |
- | theta = 7.29e-5*dt | + | theta = 7.29e-5*dt |
- | Earth.rotate(angle=theta, axis=vector(0,0,1), origin=Earth.pos) | + | Earth.rotate(angle=theta, axis=vector(0,0,1), origin=Earth.pos) |
</code> | </code> |