Download or view drawPlanets.frink in plain text format
// Draws all the planets and their sizes and phase angles for a moment in time.
use planets.frink
if length[ARGS] > 0
{
d = parseDate[ARGS@0]
println["using date $d"]
} else
d = now[]
lat=40 deg North
long=105 deg West
// Uses the average colors from here:
// https://twitter.com/DonaldM38768041/status/1345288891801116672
colors = new dict[[["Mercury", makeColor[114, 102, 88]],
["Venus", makeColor[239, 235, 223]],
["Earth", makeColor[164, 159, 179]],
["Mars", makeColor[136, 100, 68]],
["Jupiter", makeColor[195, 190, 171]],
["Saturn", makeColor[201, 179, 142]],
["Uranus", makeColor[168, 192, 194]],
["Neptune", makeColor[145, 175, 186]],
["Pluto", makeColor[158, 147, 129]]]]
g=new graphics
y = 0 deg
x = 0 deg
spacing = 5 arcsec
for planet = Planet.allPlanetsMinusEarth
{
rad= Planet.Earth.radiusAngle[d, planet]
println[planet.name + " " + formatSci[rad, "arcsec", 5]]
// g.color[randomFloat[0,1], randomFloat[0,1], randomFloat[0,1]]
g.color[colors@(planet.getName[])]
if planet != Planet.Saturn
g.add[planet.drawPolygonRelativeToZenith[d, lat, long, x, y + rad + spacing, rad, true]]
else
g.add[planet.drawSaturnRelativeToZenith[d, lat, long, x, y+rad+spacing, rad]]
y = y + 2 rad + spacing
}
g.invertGrays[].show[]
g.invertGrays[].write["drawPlanets.png", 300, undef]
g.invertGrays[].write["drawPlanets.html", 300, undef]
g.invertGrays[].write["drawPlanets.svg", 300, undef]
g.print[]
makeColor[r, g, b] := new color[r/255, g/255, b/255]
Download or view drawPlanets.frink in plain text format
This is a program written in the programming language Frink.
For more information, view the Frink
Documentation or see More Sample Frink Programs.
Alan Eliasen, eliasen@mindspring.com