Attachment 't01.c'
Download 1 // t01.c
2 // v0.1 KHL 2009-04-21
3 // gcc -o t01 t01.c -lm -lgd ; ./t01
4 // static drawing, though slow to compute
5 // earth and toroid around orbit
6
7 #define TITLE "M288, 1 center orbit"
8 #define GIFOUT "t01.gif"
9 #define DELTANG 0.2
10 #define ORBWIDTH 9
11 #define ANG0 0
12 #define ANG1 90
13 #define ANG2 142
14 #define NELIP 32
15
16 #include "tor00.hc"
17
18 int main () {
19 double t_ang ;
20 int e_cnt ;
21 int orb ;
22 int norb ;
23
24 gdPoint ellipse[NELIP+2];
25
26 displaystart();
27 torstart();
28
29 gdImageGifAnimBegin( im1, gifout, 1, -1 ) ; // no repeat
30 // gdImageGifAnimBegin( im1, gifout, 1, 4 ) ; // repeat 4 times
31 // gdImageGifAnimBegin( im1, gifout, 1, 0 ) ; // continuous repeat
32
33 framestart( 90, TITLE );
34
35 for( t_ang=-ANG1 ; t_ang < ANG1 ; t_ang += DELTANG ) {
36 double angle_rad=DEG2RAD( t_ang );
37 double tox = -major*sin( angle_rad );
38 double toz = -major*cos( angle_rad );
39 gdPoint pto = sr0( tox, 0.0, toz );
40 gdImageFilledEllipse( im, pto.x, pto.y, ORBWIDTH, ORBWIDTH, tc[0]);
41 }
42 drawearth();
43
44 for( t_ang=ANG1 ; t_ang < 360-ANG1 ; t_ang += DELTANG ) {
45 double angle_rad=DEG2RAD( t_ang );
46 double tox = -major*sin( angle_rad );
47 double toz = -major*cos( angle_rad );
48 gdPoint pto = sr0( tox, 0.0, toz );
49 gdImageFilledEllipse( im, pto.x, pto.y, ORBWIDTH, ORBWIDTH, tc[0]);
50 }
51
52 frameend();
53 displayend();
54 return 0;
55 }
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.