// I think this works reasonably well: find the lat-lon the sun is centered over.
// (or the anti-sun, since this code shades darkness)
// draw a spiral/circle of points 90 degrees away from that point.
latlon = Function( {originLatRadians, originLonRadians, bearingRadians, angularDistanceRadians = Pi() / 2},
{// http://www.movable-type.co.uk/scripts/latlong.html provided distance formula
sinOriginLatRadians = Sin( originLatRadians ), cosAngularDistanceRadians = Cos( angularDistanceRadians ), cosOriginLatRadians =
Cos( originLatRadians ), sinAngularDistanceRadians = Sin( angularDistanceRadians ), cosBearingRadians = Cos( bearingRadians ), newLatRadians =
ArSin( sinOriginLatRadians * cosAngularDistanceRadians + cosOriginLatRadians * sinAngularDistanceRadians * cosBearingRadians ), sinBearingRadians
= Sin( bearingRadians ), sinNewLatRadians = Sin( newLatRadians ), newLonRadians = originLonRadians + ATan(
sinBearingRadians * sinAngularDistanceRadians * cosOriginLatRadians,
cosAngularDistanceRadians - sinOriginLatRadians * sinNewLatRadians
)}, // new lon depends on new lat, but see bummer below...
Return( newLatRadians || newLonRadians )
);
loops = 100; // ALSO, see .95 in the XYFunction below. IT IS AN APPROXIMATION!
pensize = 9; // try different compromises: slower and finer vs faster and coarser. pensize 35 is pretty coarse and makes the dark overlap into the light.
for(time=0,time<24,time=time+1,
xCenter = -2 * Pi() * time / 24 + 2 * Pi();
highpoint = Day Of Year( Date MDY( 6, 21, 2000 ) ); // map this to 1*PI
lowpoint = Day Of Year( Date MDY( 12, 21, 2000 ) ); // map this to 2*PI
currentpoint = Day Of Year( Today() ); // <<<<< here! set the day of year to move the sun (dark) north and south <<<<
currentangle = Interpolate( currentpoint, highpoint, Pi(), lowpoint, 2 * Pi() );
// apply sin to that. the sun moves north-south over the year in a sin path, hanging at the 23.5 and -23.5 ends for a bit, moving faster over the equator
yCenter = 23.5 * Cos( currentangle ) * Pi() / 180; // +23.5 21JUN to -23.5 21DEC
New Window( "Spiral of Darkness", // borrowed from spiral example in scripting index
g = Graph Box( Frame Size( 500, 260 ),/*<