moonsizecut.frink

View or download moonsizecut.frink in plain text format


use sun.frink

// This program graphically draws the size (and phase) of the moon's closest
// point each day for many years.  It sort of debunks the idea that the
// so-called "supermoon" is really special at all.

g = new graphics

g.stroke[.1 mm]
g.color[0,0,1]
//g.rotate[4 deg]
//g.translate[1 in, 2 in]

width = 382 mm
height = 700 mm


x = 0
y = 0
lat = 40 degrees North
long = 105 degrees West
perline = 29

cellsize = width/perline

g.drawRectCenter[0 cellsize,0 cellsize, 80 .5 deg cellsize, 80 .5 deg cellsize]

for a = #2013-01-01# to #2016-01-01# step day
{
   interval = new interval[a, a + 1 day]
   r = moonRadiusAngle[interval]
   closest = supremum[r]

//  Use this instead to just draw the size of the moon.
//   g.fillEllipseCenter[x mod perline, x div perline, 200 closest, 200 closest]
   g.add[drawMoonPolygonRelativeToZenith[a+12 hours, lat, long, (x mod perline) cellsize, (x div perline) cellsize, 80 closest cellsize, false]]
   x = x + 1
}

g.show[]
g.write["moons.svg",width, height]
g.write["moons.png",1000,2000]
//g.printTiled[1,2]


View or download moonsizecut.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 was born 17651 days, 5 hours, 9 minutes ago.