Nippon02.cc

// Generator of image nippon02.jpg (clickable at right). // The input with the coastal lines is required, // the following files should be downoaded for the compilation: // // russia.txt, // chinaa.txt, // koreano.txt, // koreasua.txt, // sakhalin.txt, // hokkaido.txt, // honshu.txt, // kyushu.txt, // shikoku.txt, // habomai.txt, // shikotan.txt, // kunashiri.txt, // etorofu.txt, // urupu.txt.

//

// void ado(FILE *O, int X, int Y) // {	fprintf(O,"%c!PS-Adobe-2.0 EPSF-2.0\n",'%'); // fprintf(O,"%c%cBoundingBox: 0 0 %d %d\n",'%','%',X,Y); // fprintf(O,"/M {moveto} bind def\n"); // fprintf(O,"/L {lineto} bind def\n"); // fprintf(O,"/S {stroke} bind def\n"); // fprintf(O,"/s {show newpath} bind def\n"); // fprintf(O,"/C {closepath} bind def\n"); // fprintf(O,"/F {fill} bind def\n"); // fprintf(O,"/times-Roman findfont 90 scalefont setfont\n"); // fprintf(O,"/W {setlinewidth} bind def\n"); // fprintf(O,"/RGB {setrgbcolor} bind def\n");} //
 * 1) include
 * 2) include
 * 3) include
 * 4) define DB double
 * 5) define DO(x,y) for(x=0;x<y;x++)
 * 1) include "russia.txt" //
 * 2) include "chinaa.txt" //
 * 3) include "koreano.txt" //
 * 4) include "koreasua.txt" //
 * 5) include "sakhalin.txt" //
 * 6) include "hokkaido.txt" //
 * 7) include "honshu.txt" //
 * 8) include "kyushu.txt" //
 * 9) include "shikoku.txt" //
 * 10) include "habomai.txt" //
 * 11) include "shikotan.txt" //
 * 12) include "kunashiri.txt" //
 * 13) include "etorofu.txt" //
 * 14) include "urupu.txt" //

DB R=6400.; //kilometers, unity at the map// DB GR=M_PI/180.; // gradus //
 * 1) define ADn(array) {a=array[n][0];d=array[n][1]; if(d<1.) d+=360.;} //

DB A0=40; // DB D0=140.; // DB C0=cos(A0*GR); // DB R0=cos(A0*GR)/sin(A0*GR); // DB r, f; //
 * 1) define XY { r=R0-GR*(a-A0); f=GR*C0*(d-D0)/R0; x=r*sin(f); y=R0-r*cos(f); x*=R; y*=R;} //
 * 2) define MLn {if(n==0)M(x,y)else L(x,y)} //

main{ int n,j,k; DB a,d,x,y,c; // FILE *o; o=fopen("nippon02.eps","w"); ado(o,2040,2440); // M(0,0)L(2040,0)L(2040,2440)L(0,2440) fprintf(o,".88 .95 1 RGB C F\n"); // Blue sea // //fprintf(o,"120 112 translate .1 .1 scale\n"); //for the low resolution version// fprintf(o,"1200 1120 translate\n"); //
 * 1) define M(x,y) fprintf(o,"%5.2f %5.2f M\n",0.+x,0.+y); //
 * 2) define L(x,y) fprintf(o,"%5.2f %5.2f L\n",0.+x,0.+y); //

DO(n,RussiaN){ADn(Russia); XY; MLn} fprintf(o,"C .95 .95 .95 RGB F\n"); // DO(n,RussiaN){ADn(Russia); XY; MLn} fprintf(o,"C 0 0 0 RGB S\n"); //

DO(n,ChinaaN){ADn(Chinaa); XY; MLn} fprintf(o,"C 1 1 .9 RGB F\n"); // DO(n,ChinaaN){ADn(Chinaa); XY; MLn} fprintf(o,"C 0 0 0 RGB S\n"); //

DO(n,KoreanoN){ADn(Koreano); XY; MLn} fprintf(o,"C 1 .9 .9 RGB F\n"); // DO(n,KoreanoN){ADn(Koreano); XY; MLn} fprintf(o,"C 0 0 0 RGB S\n"); //

DO(n,KoreasuaN){ADn(Koreasua); XY; MLn} fprintf(o,"C 1 .94 1 RGB F\n"); // DO(n,KoreasuaN){ADn(Koreasua); XY; MLn} fprintf(o,"C 0 0 0 RGB S\n"); //

DO(n,SakhalinN){ADn(Sakhalin); XY; MLn} fprintf(o,"C 1 1 1 RGB F\n"); // DO(n,SakhalinN){ADn(Sakhalin); XY; MLn} fprintf(o,"C 0 0 0 RGB S\n"); //

DO(n,HokkaidoN){ADn(Hokkaido); XY; MLn} fprintf(o,"C 1 1 1 RGB F\n"); // DO(n,HokkaidoN){ADn(Hokkaido); XY; MLn} fprintf(o,"C 0 0 0 RGB S\n"); //

DO(n,HonshuN){ADn(Honshu); XY; MLn} fprintf(o,"C 1 1 1 RGB F\n"); // DO(n,HonshuN){ADn(Honshu); XY; MLn} fprintf(o,"C 0 0 0 RGB S\n"); //

DO(n,KyushuN){ADn(Kyushu); XY; MLn} fprintf(o,"C 1 1 1 RGB F\n"); // DO(n,KyushuN){ADn(Kyushu); XY; MLn} fprintf(o,"C 0 0 0 RGB S\n"); //

DO(n,ShikokuN){ADn(Shikoku); XY; MLn} fprintf(o,"C 1 1 1 RGB F\n"); // DO(n,ShikokuN){ADn(Shikoku); XY; MLn} fprintf(o,"C 0 0 0 RGB S\n"); //

DO(n,HabomaiN){ADn(Habomai); XY; MLn} fprintf(o,"C 1 1 1 RGB F\n"); // DO(n,HabomaiN){ADn(Habomai); XY; MLn} fprintf(o,"C 0 0 0 RGB S\n"); //

DO(n,ShikotanN){ADn(Shikotan); XY; MLn} fprintf(o,"C 1 1 1 RGB F\n"); // DO(n,ShikotanN){ADn(Shikotan); XY; MLn} fprintf(o,"C 0 0 0 RGB S\n"); //

DO(n,KunashiriN){ADn(Kunashiri); XY; MLn} fprintf(o,"C 1 1 1 RGB F\n"); // DO(n,KunashiriN){ADn(Kunashiri); XY; MLn} fprintf(o,"C 0 0 0 RGB S\n"); //

DO(n,EtorofuN){ADn(Etorofu); XY; MLn} fprintf(o,"C 1 1 1 RGB F\n"); // DO(n,EtorofuN){ADn(Etorofu); XY; MLn} fprintf(o,"C 0 0 0 RGB S\n"); //

DO(n,UrupuN){ADn(Urupu); XY; MLn} fprintf(o,"C 1 1 1 RGB F\n"); // DO(n,UrupuN){ADn(Urupu); XY; MLn} fprintf(o,"C 0 0 0 RGB S\n"); //

for(j= 0;j< 81;j+=2){a=j; // for(k=28;k<181;k+=2){d=k; XY; if(k==28)M(x,y) else L(x,y)}} // for(j=28;j<181;j+=2) {d=j; a= 0.; XY; M(x,y) a= 80.; XY; L(x,y)} // fprintf(o,"0.2 W 0 0 1 RGB S\n"); //

d=133; for(a=0;a< 80; a+=10){XY; M(x-60,y-20.); fprintf(o,"(%2.0f) show\n",a); } // a= 31; for(d=90;d<189; d+=10){XY; M( x-90.,y-80.); fprintf(o,"(%3.0f) show\n",d); } //

fprintf(o,"showpage\n%cTrailer\n",'%'); fclose(o); // //system("epstopdf nippon02.eps"); // //system(   "open nippon02.pdf"); // This is specific for Macintosh; // system("convert nippon02.eps nippon02.jpg"); // system(   "open nippon02.jpg"); // This is specific for Macintosh; // //system("convert nippon02.eps nippon02.png"); // //system("convert nippon02.eps nippon02.gif"); // } // // Copyleft 2011 by Dmitrii Kouznetsov // // //