Microsoft Small Basic

Program Listing: CLJ212
' Orbit
' Version 0.1
' Last update 2016-06-04
' Reference:
' [1] 国立天文台, 理科年表 平成23年 (Chronological Scientific Tables 2010), 2010
' http://www.rikanenpyo.jp
'
GraphicsWindow.Title = "Orbit 0.1"
Init()
DrawOrbits()
Sub DrawOrbits
GraphicsWindow.PenWidth = 1
xo = gw / 2
yo = gh / 2
rMa = yo - 10
PI = Math.Pi
For i = 1 To n - 1
e = c[index[i]]["e"] ' eccentricity
a = c[index[i]]["a"] / c["Ma"]["a"] * rMa ' semimajor axis
b = Math.SquareRoot(1 - e) * a ' semiminor axis
π = c[index[i]]["π"] ' longitude of perihelion [degree]
GraphicsWindow.PenColor = "#333333"
GraphicsWindow.BrushColor = "Transparent"
ell = Shapes.AddEllipse(2 * a, 2 * b)
xc = xo + e * a * Math.Cos(_π + PI)
yc = yo - e * a * Math.Sin(_π + PI)
x = xc - a
y = yc - b
Shapes.Move(ell, x, y)
Shapes.Rotate(ell, -π)
r = c[index[i]]["r"] / c["Ma"]["a"] * rMa * 500
x = xo + (1 - e) * a * Math.Cos(_π) - r
y = yo - (1 - e) * a * Math.Sin(_π) - r
GraphicsWindow.PenColor = "Transparent"
GraphicsWindow.BrushColor = c[index[i]]["color"]
c[index[i]]["ell"] = Shapes.AddEllipse(2 * r, 2 * r)
Shapes.Move(c[index[i]]["ell"], x, y)
EndFor
r = c[index[n]]["r"] / c["Ma"]["a"] * rMa * 15
GraphicsWindow.BrushColor = c[index[n]]["color"]
GraphicsWindow.FillEllipse(xo - r, yo - r, 2 * r, 2 * r)
EndSub
Sub Init
gw = 598
gh = 428
GraphicsWindow.Width = gw
GraphicsWindow.Height = gh
GraphicsWindow.BackgroundColor = "Black"
' Me - Mercury
' V - Venus
' E - Earth
' Ma - Mars
' J - Jupter
' Sa - Saturn
' U - Uranus
' N - Neptune
' a - semimajor axis of the orbit [km]
' e - eccentricity of the orbit
' i1 - orbital inclination to ecliptic plane [degree]
' i2 - orbital inclination to invariable plane [degree]
' π - longitude of perihelion in ecliptic plane [degree]
' Ω - longitude of the ascending node in ecliptic plane [degree]
' Mo - mean anomaly
' r - equatorial radius of the planet [km]
' m - mass of the planet [kg]
' color - color for the planet
c["Me"] = "a=5.791E7;e=0.2056;i1=7.004;i2=6.344;π= 77.474;Ω= 48.316;Mo=309.724;"
c["V"] = "a=1.082E8;e=0.0068;i1=3.395;i2=2.196;π=131.565;Ω= 76.648;Mo= 28.282;"
c["E"] = "a=1.496E8;e=0.0167;i1=0.002;i2=1.578;π=102.976;Ω=174.845;Mo=231.750;"
c["Ma"] = "a=2.279E8;e=0.0934;i1=1.849;i2=1.680;π=336.112;Ω= 49.524;Mo= 89.343;"
c["J"] = "a=7.783E8;e=0.0485;i1=1.303;i2=0.328;π= 14.356;Ω=100.487;Mo= 13.590;"
c["Sa"] = "a=1.429E9;e=0.0555;i1=2.489;i2=0.934;π= 93.123;Ω=113.635;Mo= 99.342;"
c["U"] = "a=2.875E9;e=0.0463;i1=0.773;i2=1.028;π=173.015;Ω= 74.015;Mo=190.960;"
c["N"] = "a=4.504E9;e=0.0090;i1=1.770;i2=0.726;π= 48.124;Ω=131.782;Mo=281.679;"
c["Su"] = "r=696000;m=1.989E30;color=White;"
c["Me"] = c["Me"] + "r= 2440;m=3.302E23;color=Cyan;"
c["V"] = c["V"] + "r= 6052;m=4.869E24;color=Gold;"
c["E"] = c["E"] + "r= 6378;m=5.974E24;color=Blue;"
c["Ma"] = c["Ma"] + "r= 3396;m=6.416E23;color=Red;"
c["J"] = c["J"] + "r=71492;m=1.899E27;color=Green;"
c["Sa"] = c["Sa"] + "r=60268;m=5.685E26;color=Brown;"
c["U"] = c["U"] + "r=25559;m=8.686E25;color=SkyBlue;"
c["N"] = c["N"] + "r=24764;m=1.025E26;color=Navy;"
n = Array.GetItemCount(c)
index = Array.GetAllIndices(c)
EndSub