Attachment 't41.c'
Download 1 // t41.c
2 // v0.1 KHL 2009-04-21
3 // gcc -o t41 t41.c -lm -lgd ; ./t41
4 // static drawing, though slow to compute
5 // earth and toroid around orbit
6
7 #define TITLE "Orbit map, 500km minor radius"
8 #define GIFOUT "t41.gif"
9 #define RADIUS 500.00
10 #define SQUARE 10.00
11 #define SCALE 0.5
12
13 #include "tor00.hc"
14
15 int main () {
16 int diam = (int) ( 2.0 * SCALE * RADIUS );
17 double rmax = (RADIUS/SQUARE)-0.51 ;
18 int ymax = (int) rmax ;
19 int xmax ;
20 int delta = (int) ( SCALE * SQUARE + 0.001 );
21 int sq = (delta / 2) - 1 ;
22 int num = 0 ;
23 int xp, yp ;
24 int ycent = YCENTER - 25 ;
25
26 displaystart();
27 torstart();
28 gdImageGifAnimBegin( im1, gifout, 1, -1 ) ; // no repeat
29 // gdImageGifAnimBegin( im1, gifout, 1, 4 ) ; // repeat 4 times
30 // gdImageGifAnimBegin( im1, gifout, 1, 0 ) ; // continuous repeat
31 framestart( 90, TITLE );
32
33 gdImageFilledEllipse( im, XCENTER, ycent, diam, diam, white );
34
35 for( yp = -ymax ; yp <= ymax ; yp++ ) {
36 xmax = (int) sqrt( rmax*rmax - (double) (yp*yp) );
37 int y = yp*delta + ycent ;
38 for( xp = -xmax ; xp <= xmax ; xp++ ) {
39 int x = xp*delta + XCENTER ;
40 num++ ;
41 gdImageFilledRectangle( im, x-sq, y-sq, x+sq, y+sq, black );
42 }
43 }
44 sprintf( bottom, "%6d orbits,%3.0fkm spacing between orbits", num, SQUARE );
45
46 frameend();
47 displayend();
48 return 0;
49 }
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.