summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/mandi/vdemo.py
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-12-30 22:59:31 +0000
committerKarl Berry <karl@freefriends.org>2014-12-30 22:59:31 +0000
commit290049375b418246b47914c316746543a0a7e11f (patch)
tree28a186c754e91182e5be95f35a2784a1779e83c3 /Master/texmf-dist/doc/latex/mandi/vdemo.py
parent52342328d697c341a49231053d155a030eb05b56 (diff)
mandi (30dec14)
git-svn-id: svn://tug.org/texlive/trunk@35931 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/mandi/vdemo.py')
-rw-r--r--Master/texmf-dist/doc/latex/mandi/vdemo.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/Master/texmf-dist/doc/latex/mandi/vdemo.py b/Master/texmf-dist/doc/latex/mandi/vdemo.py
index b50f0c35eea..6af517625a1 100644
--- a/Master/texmf-dist/doc/latex/mandi/vdemo.py
+++ b/Master/texmf-dist/doc/latex/mandi/vdemo.py
@@ -1,22 +1,25 @@
-from __future__ import print_function, division
+from __future__ import division,print_function
from visual import *
-giant = sphere(pos=vector(-1e11,0,0),radius=2e10,mass=2e30,color=color.red)
-giant.p = vector(0, 0, -1e4) * giant.mass
+G = 6.7e-11
+# create objects
+giant = sphere(pos=vector(-1e11,0,0),radius=2e10,mass=2e30,color=color.red)
+giant.p = vector(0,0,-1e4) * giant.mass
dwarf = sphere(pos=vector(1.5e11,0,0),radius=1e10,mass=1e30,color=color.yellow)
dwarf.p = -giant.p
-for a in [giant, dwarf]:
- a.orbit = curve(color=a.color, radius=2e9)
+for a in [giant,dwarf]:
+ a.orbit = curve(color=a.color,radius=2e9)
dt = 86400
while 1:
rate(100)
dist = dwarf.pos - giant.pos
- force = 6.7e-11 * giant.mass * dwarf.mass * dist / mag(dist)**3
+ force = G * giant.mass * dwarf.mass * dist / mag(dist)**3
giant.p = giant.p + force*dt
dwarf.p = dwarf.p - force*dt
- for a in [giant, dwarf]:
+ for a in [giant,dwarf]:
a.pos = a.pos + a.p/a.mass * dt
a.orbit.append(pos=a.pos)
+