#include <cmacs.h>
#include <video.h>
#include <units.h>

#define nedg 30   
#define Rearth (6378*KM)
#define Synch (20000*MI)
#define Skylen (90000*MI)
main(argc,argv)
int argc; char *argv[];
  {WINDOWS *north,*earth,*space;
   double w,rb,x[nedg],y[nedg]; int i;   double s,c,ss,cc,t;

   w = COS(PI/nedg);
   north = READWINDOWSET("polar.img",-w,-w,w,w,"W");
   rb = Rearth/10;
   space = WINDOWSET(-1.3333*Rearth*1.6667,-Rearth*1.6667,
                      1.3333*Rearth*1.6667,Rearth*1.6667,"W");
   earth = SUBWINDOW(space,-Rearth,-Rearth,Rearth,Rearth,-w,-w,w,w);
   for (i=0; i<nedg; ++i)
      {x[i]=COS((TWOPI*i)/nedg);  y[i]=SIN((TWOPI*i)/nedg);}
   SELECT(earth);
   PATCH(nedg,x,y,north,x,y);
   SELECT(space);
   PEN(8); INK(.6);
   for (t=0; t<1; t += .0002)
      {s=SIN(TWOPI*t);  c=COS(TWOPI*t);
       ss=SIN(TWOPI*t*4);  cc=COS(TWOPI*t*4);
       LINE(-Rearth/3*(4*c+cc),Rearth/3*(4*s+ss),
            -Rearth/3*(4*c-cc),Rearth/3*(4*s-ss));}
   INK(1); PEN(7);
   for (t=0; t<1; t += 1.0/60)
      {s=SIN(TWOPI*t);  c=COS(TWOPI*t);
       ss=SIN(TWOPI*t*4);  cc=COS(TWOPI*t*4);
       LINE(-Rearth/3*(4*c+cc),Rearth/3*(4*s+ss),
            -Rearth/3*(4*c-cc),Rearth/3*(4*s-ss));}
   GRINNELLUP(0);
   FILEUP("nonsynch.img");
   }

