Attachment 'cap11.c'
Download 1 // cap11.c Capture rail GEO
2 // ------------------------------------------------------------------------
3 // GEO, capture rail 24 hours of simulation
4 // ------------------------------------------------------------------------
5 // cc -o cap11 cap11.c -lgd -lpng -lm
6 // ------------------------------------------------------------------------
7 // Uses the libgd library, documentation: /usr/share/doc/gd-*/index.html
8 //
9 // The image is drawn large, then resampled down with ImageMagick "convert"
10 // Slow, but resulting in better looking output.
11 //
12 // png2swf segmentation faults if given too many large frames
13
14 #define NAME "cap11"
15 #define TITLETEXT "Capture Rail"
16
17 #define DEBUG 1
18
19 // earth and orbits -----------------------------------------------
20 // we will use a 24 hour, not a 23.9346 hour, sidereal day.
21 //
22 #define CAPTURE 30411.507 // climbing capture
23
24 #define SCALE 3400 // bigger for less magnification
25
26 #define OTIME 24.0 // orbit time
27 #define RAILHIGH 45000.0
28 #define RAILLOW 28000.0
29
30 #define NSTAR 100
31
32 #define RE 6378.0
33 #define ETIME 24.0 // hours per turn
34 #define MU 398600.0 // grav parameter km3/s2
35 #define ALTITUDE 80.0 // perigee altitude
36 #define GMAX 0.003 // 3 m/s^2, 0.003km/s^2
37
38 // plot rate ------------------------------------------------------
39 #define RATE 5
40 #define NPLOT 120
41 #define MAXHOUR 24.0
42 #define STEPS 1000 // orbit simulation steps per plot
43
44 // plot sizing -----------------------------------------------------
45 #define PSCALE 32 // global scaling factor for drawing
46 #define LINSCALE 1
47 #define XSIZE (96*PSCALE)
48 #define YSIZE (32*PSCALE)
49
50 #define XOUT 960 // size of output image after convert
51 #define YOUT 320
52
53 #define XCENT1 (16*PSCALE) // #1 fixed frame orbit
54 #define YCENT1 (18*PSCALE)
55 #define MAG1 1.0
56
57 #define XCENT2 (48*PSCALE) // #2 rotating frame orbit
58 #define YCENT2 (18*PSCALE)
59 #define MAG2 1.0
60
61 #define XCENT3 (80*PSCALE) // #3 magnified rotating frame orbit
62 #define YCENT3 (58*PSCALE)
63 #define MAG3 4.0
64
65 #define VSIZE (PSCALE/2) // Vehicle circle size
66
67 #define FNT "DejaVuMonoSans"
68 #define FSZ (1.25*PSCALE)
69
70 #include <gd.h>
71 #include <time.h>
72 #include <math.h>
73 #include <stdio.h>
74 #include <stdlib.h>
75
76 //-----------------------------------------------------------------------
77
78 int white, lgray, gray, dgray ; // color indexes
79 int black, blue, cyan, dcyan ;
80 int red, dred, green, dgreen ;
81 int yellow, dyellow ;
82
83 // elapsed time
84 long start_time = 0L ; // epoch start time
85 int end_time = 0 ; // estimated end time
86 int elapsed_time = 0 ; // elapsed time
87 int remaining_time = 0 ; // remaining time
88
89 double speedup ; // simulation to display time
90 double pi2 = 6.28318530717958646 ;
91 double third = 0.33333333333333 ;
92
93 // files and graphics arrays
94 gdImagePtr im ; // Declare the image
95 FILE *pngout ; // Declare output file
96 char command[200] ; //
97 char filename[80] ; //
98
99 // simulation time parameters
100
101 int iplot ; // number of plot
102 double ip1 ; // fraction of complete plot
103 double hour ; // time of plot in hours from start
104 double eangle ; // earth turn angle
105 double oangle ; // destination orbit turn angle
106
107 //-----------------------------------------------------------------------
108 // orbit parameters
109 // distances in km
110 // speeds in km/sec
111
112 // target orbit parameters
113 double omega ; // rad/sec angular velocity
114 double orbsize ; // km orbit radius
115
116 // transfer orbit parameters
117 double rp ; // km perigee radius
118 double ra ; // km apogee radius
119 double rc ; // km capture radius, apogee
120 double vc ; // km/s capture velocity
121 double sem ; // km semimajor axis
122 double e ; // eccentricity
123 double h ; // km^2/s angular momentum
124 double vp ; // km/s perigee velocity
125 double vct ; // km/s transverse capture velocity
126 double v0 ; // km/s orbit velocity
127 double r0 ; // km/s orbit radius
128 double costh ; // cos of orbit angle at capture
129 double sinth ; // sin of orbit angle at capture
130 double theta ; // orbit angle radians
131 double dtheta ; // orbit angle degrees
132 double period ; // orbit period, seconds
133 double tr_time ; // orbit transfer time, seconds
134 double arg_p ; // argument of perigee
135 double energy ; // orbit energy, MJ
136 double enc ; // energy at capture, MJ
137 double av ; //
138 double rv ; //
139 double vv ; //
140 double tstep ; // simulation timestep
141
142 // background stars ;
143 double starx[NSTAR], stary[NSTAR] ; // star field position
144
145 // transfer orbit simulation radius (km) and angle (radians), fixed frame
146 double cr[NPLOT], ca[NPLOT] ; // transfer orbit, with capture
147 double mr[NPLOT], ma[NPLOT] ; // transfer orbit, missed capture
148 double rr[NPLOT] ; // transfer orbit, rotation
149 int nc = NPLOT ; // capture step
150 int nv = 0 ; // number of transfer orbit points
151
152 int scale = SCALE/PSCALE ; // pixels per kilometer
153
154 // ========================================================================
155 void initialize() {
156
157 int i ;
158 double tmp ;
159 double E ;
160 double M ;
161
162 sprintf( command, "rm -rf %sdir ; mkdir %sdir", NAME, NAME );
163 system( command ) ; // make directory
164 start_time = (long) time( NULL );
165
166 speedup = 3600.0 * MAXHOUR * RATE / NPLOT ; // sim/display time ratio
167 tstep = 3600.0*MAXHOUR/(NPLOT*STEPS) ; // simulation timestep
168
169 // orbit initialize
170 // fake: sidereal 24 hour day
171
172 omega = pi2 / ( 3600.0 * OTIME ) ; // angular velocity
173 orbsize = pow( ( MU /(omega*omega)), third ) ; // orbit radius
174 rp = RE + ALTITUDE ; // perigee radius
175
176
177 // three different possibilities -
178 #ifdef CAPTURE // ---------------- new capture rail
179 rc = CAPTURE ;
180
181 // see http://www.nature1st.net/bogan/orbits/kepler/orbteqtn.html
182 // though be careful of the redefinition of q, both perigee and
183 // true anomaly
184
185 vct = rc*omega ; // transverse capture velocity
186 h = rc*vct ; // orbit angular momentum
187 vp = h/rp ; // perigee velocity km/sec
188 v0 = MU/h ; // orbit velocity
189 r0 = h/v0 ; // orbit radius
190 e = (r0/rp)-1.0 ; // eccentricity
191 ra = r0/(1.0-e) ; // apogee radius
192 sem = r0/(1.0-e*e) ; // semimajor axis
193 energy = 0.5*vp*vp-MU/rp ; // orbit energy MJ
194 enc = 0.5*vct*vct-MU/rc ; //
195 vc = sqrt(2.0*(energy-enc)); //
196 tmp = fabs(sem*sem*sem)/MU ; //
197 period = pi2*sqrt( tmp ) ; // orbit period
198 costh = ((r0/rc)-1.0)/e ;
199 sinth = sqrt(1.0-costh*costh) ;
200 theta = atan2(sinth,costh) ; // true anomaly
201 dtheta = (360.0/pi2)*theta ;
202 av = vct*vct/rc-MU/(rc*rc) ; // acceleration at capture
203
204 if( sem > 0.0 ) { // ----- elliptical
205
206 double cosE = (e+costh)/(1.0+e*costh);
207
208 // possibly two solutions for E, M, and tr_time !
209 E = acos( cosE ) ; // eccentric anomaly
210 M = E - e*sin( E ) ; // mean anomaly
211 }
212 else { // ----- hyperbolic
213 double coshE = (e+costh)/(1.0+e*costh);
214
215 // possibly two solutions for E, M, and tr_time !
216 E = acosh( coshE ) ; // eccentric anomaly
217 M = e*sinh( E ) - E ; // mean anomaly
218 }
219
220 #else // --------------------- classical capture
221
222 rc = 0.7*orbsize ;
223
224 tmp = 2.0 * MU / (omega*omega);
225
226 for( i = 0 ; i < 77 ; i++ ) {
227 rc = pow( tmp*rp/(rc+rp), third);//
228 }
229
230 sem = 0.5*(rp+rc) ; // semimajor axis
231 e = 1.0 - rp/sem ; // eccentricity
232 vct = rc*omega ; // apogee (capture) velocity
233 h = rc*vct ; // orbit angular momentum
234 v0 = MU/h ; // orbit velocity
235 r0 = h/v0 ; // orbit radius
236 ra = rc ; // apogee
237 vp = h/rp ; // perigee velocity km/sec
238 energy = 0.5*vp*vp-MU/rp ; // orbit energy MJ
239 enc = 0.5*vct*vct-MU/rc ; //
240 vc = sqrt(2.0*(energy-enc)); // radial capture velocity
241 tmp = fabs(sem*sem*sem)/MU ; //
242 period = pi2*sqrt( tmp ) ; // orbit period
243 costh = -1.0 ; //
244 sinth = 0.0 ; //
245 theta = 0.5*pi2 ; //
246 dtheta = 180.0 ; //
247 E = 0.5*pi2 ; //
248 M = E ; //
249 av = vct*vct/rc-MU/(rc*rc) ; // acceleration at capture
250
251 #endif
252
253 tr_time = M*period / pi2 ; // time from perigee, seconds
254 arg_p = omega*tr_time-theta ; // argument of perigee
255
256 #ifdef DEBUG
257 printf( "|omega %11.3e rd/s ", omega );
258 printf( "|orbsize%11.2f km ", orbsize );
259 printf( "|tstep %11.5f sec ", tstep );
260 printf( "|\n" );
261 printf( "|rp %11.2f km ", rp );
262 printf( "|ra %11.2f km ", ra );
263 printf( "|sem %11.2f km ", sem );
264 printf( "|\n" );
265 printf( "|e %11.6f ", e );
266 printf( "|vp %11.4f km/s ", vp );
267 printf( "|vct %11.4f km/s ", vct );
268 printf( "|\n" );
269 printf( "|h %11.2fkm2/s ", h );
270 printf( "|r0 %11.2f km ", r0 );
271 printf( "|v0 %11.4f km/s ", v0 );
272 printf( "|\n" );
273 printf( "|mu %11.2fm3/s2 ", MU );
274 printf( "|energy %11.4fMJ/kg ", energy );
275 printf( "|vc %11.4f km/s ", vc );
276 printf( "|\n" );
277 printf( "|rc %11.2f km ", rc );
278 printf( "|E %11.4f rad ", E );
279 printf( "|M %11.4f rad ", M );
280 printf( "|\n" );
281 printf( "|tr_time%11.2f sec ", tr_time );
282 printf( "|period %11.4f sec ", period );
283 printf( "|p.hours%11.4f hr ", period/3600.0 );
284 printf( "|\n" );
285 printf( "|theta %11.4f rad ", theta );
286 printf( "|arg_p %11.6f rad ", arg_p );
287 printf( "|av_c %11.4f m/s2 ", 1000.0*av );
288 printf( "|\n" );
289 #endif // DEBUG
290
291 // start simulations at perigee
292 cr[0] = rp ; // captured radius
293 mr[0] = rp ; // missed capture radius
294 ca[0] = 0.0 ; // captured angle
295 ma[0] = 0.0 ; // missed capture angle
296 rr[0] = 0.0 ; // rotation at capture
297
298 // --------------------------------------------- initialize stars
299 // generate a disk of stars with
300 // radius < 1.414*orbsize
301
302 double stmult = orbsize*sqrt(8.0);
303 for( i=0 ; i < NSTAR ; ) {
304 double x = drand48()-0.5;
305 double y = drand48()-0.5;
306 if( x*x+y*y < 0.25 ) {
307 starx[i]=stmult*x ;
308 stary[i]=stmult*y ;
309 i++ ;
310 }
311 }
312 }
313
314 //-----------------------------------------------------------------------
315 void openplot() {
316 im = gdImageCreateTrueColor( (int)XSIZE, (int)YSIZE );
317
318 black = gdImageColorAllocate(im, 0, 0, 0);
319 dgray = gdImageColorAllocate(im, 96, 96, 96);
320 gray = gdImageColorAllocate(im, 128, 128, 128);
321 lgray = gdImageColorAllocate(im, 160, 160, 160);
322 white = gdImageColorAllocate(im, 255, 255, 255);
323
324 red = gdImageColorAllocate(im, 255, 0, 0);
325 dred = gdImageColorAllocate(im, 160, 0, 0);
326 green = gdImageColorAllocate(im, 0, 255, 0);
327 dgreen = gdImageColorAllocate(im, 0, 160, 0);
328 cyan = gdImageColorAllocate(im, 0, 160, 160);
329 dcyan = gdImageColorAllocate(im, 0, 80, 80);
330 yellow = gdImageColorAllocate(im, 255, 255, 0);
331 dyellow = gdImageColorAllocate(im, 160, 160, 0);
332 blue = gdImageColorAllocate(im, 0, 0, 255);
333
334 gdImageSetThickness( im, LINSCALE );
335
336 #if DEBUG > 1
337 printf("\n---------------------------------------------------\n");
338 #endif // DEBUG
339 }
340
341 //-----------------------------------------------------------------------
342 // draw orbiting GEO tether
343 // ex, ey are center of drawing in pixels
344 // ang and rot in radians
345
346 void tether( double ang, double rot, double mag, int ex, int ey ) {
347 int x0, y0 ;
348 int x1, y1 ;
349 double rang = ang+rot;
350
351 double rlow = mag*RAILLOW /scale ;
352 double rhigh = mag*RAILHIGH/scale ;
353
354 int orb = 2*(int)(mag*orbsize/scale) ;
355 int wide = (7*orb)/10 ;
356
357 // Draw a black box over background. This covers up overlap
358 // from other views.
359
360 gdImageFilledRectangle( im, ex-wide, 0, ex+wide, YSIZE, black );
361
362 // draw orbit circle
363 gdImageSetThickness( im, (int)5.0*mag*LINSCALE );
364 gdImageArc( im, ex, ey, orb, orb, 0, 360, dgray );
365
366 // draw tether
367 gdImageSetThickness( im, (int)3.0*mag*LINSCALE );
368
369 x0 = ex + (int)( rlow * sin(rang));
370 y0 = ey - (int)( rlow * cos(rang));
371 x1 = ex + (int)( rhigh * sin(rang));
372 y1 = ey - (int)( rhigh * cos(rang));
373 gdImageLine( im, x0, y0, x1, y1, white );
374 }
375
376 //-----------------------------------------------------------------------
377 // draw stars
378 void stars( double rot, double mag, int ex, int ey ) {
379 int x, y, i ;
380 double s = sin( rot );
381 double c = cos( rot );
382 double ms = mag/scale ;
383 int size = 4*(int)sqrt(mag) ;
384 int wide = (int)(1.3*ms*orbsize) ;
385
386
387 gdImageSetThickness( im, 1);
388
389 for( i=0 ; i < NSTAR ; i++ ) {
390 int x = (int)(-ms*(c*starx[i] + s*stary[i]));
391 if( abs( x ) < wide ) {
392 x += ex ;
393 int y = ey + (int)(ms*(c*stary[i] - s*starx[i]));
394 gdImageFilledArc(im, x, y, size, size, 0, 360, white, gdArc);
395 }
396 }
397 }
398
399 //-----------------------------------------------------------------------
400 // draw rotating earth
401 // ex, ey are center of drawing in pixels
402 // ang and rot in radians
403
404 void earth( double ang, double rot, double mag, int ex, int ey ) {
405 int x0, y0 ;
406 int x1, y1 ;
407 double an0 ;
408 int i ;
409 double r2d = 360.0/pi2 ;
410 double drot = r2d*rot + 360000.0 ; // make sure it is positive
411 double rang = ang+rot;
412
413 double re = mag*RE/scale ;
414 int esize = 2*((int)re) ;
415
416 double ea1 = fmod( drot + 180.0, 360.0 ) ;
417 double ea2 = fmod( drot , 360.0 ) ;
418
419 gdImageSetThickness( im, 1);
420 gdImageFilledArc(im, ex, ey, esize, esize, 0, 360, cyan, gdArc);
421 gdImageFilledArc(im, ex, ey, esize, esize, ea2, ea1, dcyan, gdArc);
422
423 // draw longitude lines ( 6 = 180/30 degrees )
424 gdImageSetThickness( im, LINSCALE );
425 for( i=5 ; i >= 0 ; i-- ) {
426 an0 = rang + pi2*( (double) i ) / 12.0 ;
427 x0 = ex + (int)( re * sin(an0 ));
428 y0 = ey - (int)( re * cos(an0 ));
429 x1 = ex - (int)( re * sin(an0 ));
430 y1 = ey + (int)( re * cos(an0 ));
431 gdImageLine( im, x0, y0, x1, y1, black );
432 }
433 gdImageSetThickness( im, 3*LINSCALE );
434 gdImageLine( im, x0, y0, ex, ey, black );
435
436 // draw launch site pointer
437 x0 = ex + (int)( re * sin( rang + arg_p ));
438 y0 = ey - (int)( re * cos( rang + arg_p ));
439 x1 = ex + (int)( 0.5*re * sin( rang + arg_p ));
440 y1 = ey - (int)( 0.5*re * cos( rang + arg_p ));
441 gdImageSetThickness( im, 6*LINSCALE );
442 gdImageLine( im, x0, y0, x1, y1, yellow );
443
444 // draw latitude lines
445 gdImageSetThickness( im, LINSCALE );
446 for( i=1 ; i < 3 ; i++ ) {
447 an0 = pi2*( (double) i ) / 12.0 ;
448 x0 = (int)( 2.0 * ((double)re) * cos(an0) );
449 gdImageArc( im, ex, ey, x0, x0, 0, 360, black );
450 }
451 }
452
453 //-----------------------------------------------------------------------
454 // draw vehicle transfer orbit
455
456 void trans( int rotflag, double rot, double mag, int ex, int ey ) {
457 int i ;
458 int x, y ;
459
460 if( nv < iplot ) { // ------------ compute new transfer orbit point
461 double th0 = ma[nv] ;
462
463 #if DEBUG > 1
464 printf( "%5dnv%6dnc%6diplot%16.8fth0\n", nv, nc, iplot, th0 );
465 printf( "theta%9.4f rot%9.4f\n", theta, rot );
466 #endif // DEBUG
467
468 for( i = 0; i < STEPS ; i++ ) {
469 double rx = r0/(1.0+e*cos(th0)) ;
470 // double rx = r0/(1.0+e*cos(th0)) + 0.5*v0*e*tstep*sin(th0);
471 th0 += h*tstep/(rx*rx);
472
473 #if DEBUG > 1
474 printf( "rx%12.4e th0%10.6f\n", rx, th0 );
475 #endif // DEBUG
476
477 if( nc != NPLOT ) {
478 #ifdef CAPTURE
479 double atest = 0.5*vv*vv/fabs(orbsize-rv) ;
480 if( atest < GMAX ) { av = omega*omega*rv-MU/(rv*rv) ; }
481 else { av = -GMAX ; }
482 vv += tstep*av ;
483 if( ( vv < 0.0 ) || ( rv > orbsize ) ) { vv=0.0 ; }
484 rv += tstep*vv ;
485 #endif // CAPTURE
486 }
487 else if( th0 > theta ) {
488 nc = iplot ;
489 rv = r0/(1.0+e*cos(th0)) ;
490 vv = v0*e*sin(th0) ;
491 #if DEBUG > 0
492 printf("\nCapture nc=%04d rv=%9.2f vv=%7.4f\n", nc, rv, vv );
493 #endif
494 }
495 }
496 nv++ ;
497
498 rr[nv] = rot ;
499 mr[nv] = r0/(1.0+e*cos(th0));
500 ma[nv] = th0 ;
501
502 if( nc == NPLOT ) {
503 cr[nv] = mr[nv];
504 ca[nv] = ma[nv];
505 }
506 else {
507 cr[nv] = rv ;
508 ca[nv] = oangle-arg_p;
509 #if DEBUG > 0
510 printf("%8.4f%7.3f%9.1f", 1000.0*av, vv, rv );
511 #endif
512 }
513 }
514
515 // plot transfer orbit points
516
517 double man0 ;
518 int mx ;
519 int my ;
520 double can0 ;
521 int cx ;
522 int cy ;
523 double ms = mag/scale ;
524 int vsize = 2*((int)(0.5*mag*VSIZE)) ;
525 double ar ;
526
527 for( i = 0 ; i <= nv ; i++ ) {
528
529 if( rotflag == 1 ) { ar = arg_p + rr[i]; }
530 else { ar = arg_p + rot; }
531
532 man0 = ma[i] + ar ;
533 mx = ex + (int)(ms*mr[i]*sin(man0));
534 my = ey - (int)(ms*mr[i]*cos(man0));
535
536 #if DEBUG > 1
537 printf( "%4dnv%4dnc%4diplot%4di%5dmx%5dmy%8.1f_r%9.4f_an0\n",
538 nv, nc, iplot, i, mx, my , mr[i], man0 );
539 #endif // DEBUG
540
541 if( i <= nc ) {
542 gdImageFilledArc( im, mx, my, vsize, vsize, 0, 360, dyellow, gdArc );
543 } else {
544 gdImageFilledArc( im, mx, my, vsize, vsize, 0, 360, dred , gdArc );
545 can0 = ca[i] + ar ;
546 cx = ex + (int)(ms*cr[i]*sin(can0));
547 cy = ey - (int)(ms*cr[i]*cos(can0));
548 gdImageFilledArc( im, cx, cy, vsize, vsize, 0, 360, dgreen , gdArc );
549 }
550 }
551
552 // current points
553 if( iplot <= nc ) {
554 gdImageFilledArc( im, mx, my, vsize, vsize, 0, 360, yellow, gdArc );
555 } else {
556 gdImageFilledArc( im, mx, my, vsize, vsize, 0, 360, red , gdArc );
557 gdImageFilledArc( im, cx, cy, vsize, vsize, 0, 360, green , gdArc );
558 }
559 }
560
561 //-----------------------------------------------------------------------
562 void closeplot() {
563 sprintf( command, "%s.png", NAME );
564 pngout = fopen( command, "wb");
565 gdImagePngEx(im, pngout, 1);
566 fclose(pngout); // write out image
567 gdImageDestroy(im);
568
569 sprintf( command, "convert %s.png -resize %dx%d\\> %sdir/b%04d.png",
570 NAME, XOUT, YOUT, NAME, iplot );
571 system( command );
572 }
573
574 // ========================================================================
575 int main() {
576
577 initialize() ;
578
579 for( iplot = 0 ; iplot < NPLOT ; iplot++ ) {
580
581 openplot() ;
582
583 ip1 = ((double)iplot)/((double) NPLOT) ;
584 hour = ip1*MAXHOUR ;
585 eangle= pi2 * hour/ETIME ; // radians
586 oangle= pi2 * hour/OTIME ; // radians
587
588 tether( oangle, -oangle, MAG3, XCENT3, YCENT3 ) ;
589 stars( -oangle, MAG3, XCENT3, YCENT3 ) ;
590 earth( eangle, -oangle, MAG3, XCENT3, YCENT3 ) ;
591 trans( 1, -oangle, MAG3, XCENT3, YCENT3 ) ;
592
593 // note - the next two drawings overlap and obscure the
594 // first magnified plot
595
596 tether( oangle, -oangle, MAG2, XCENT2, YCENT2 ) ;
597 stars( -oangle, MAG2, XCENT2, YCENT2 ) ;
598 earth( eangle, -oangle, MAG2, XCENT2, YCENT2 ) ;
599 trans( 1, -oangle, MAG2, XCENT2, YCENT2 ) ;
600
601 tether( oangle, 0.0, MAG1, XCENT1, YCENT1 ) ;
602 stars( 0.0, MAG1, XCENT1, YCENT1 ) ;
603 earth( eangle, 0.0, MAG1, XCENT1, YCENT1 ) ;
604 trans( 0, 0.0, MAG1, XCENT1, YCENT1 ) ;
605
606 // labels -----------------------------------------------------------
607
608 gdImageStringFT( im, NULL, // imagespace, bounding
609 white, FNT, 1.6*FSZ, // color, font, fontsize
610 0.0, 1*PSCALE, 3*PSCALE, // angle, x, y
611 TITLETEXT ); // text
612
613 sprintf( command,
614 "View from South %04.1f/%04.1f hours, %4.0fx speedup",
615 hour, MAXHOUR, speedup );
616
617 gdImageStringFT( im, NULL, // imagespace, bounding
618 white, FNT, FSZ, // color, font, fontsize
619 0.0, 44*PSCALE, 3*PSCALE, // angle, x, y
620 command ); // text
621
622 gdImageStringFT( im, NULL, // imagespace, bounding
623 white, FNT, 0.75*FSZ, // color, font, fontsize
624 0.0, 1*PSCALE, 31*PSCALE, // angle, x, y
625 "Fixed Frame" ); // text
626
627 gdImageStringFT( im, NULL, // imagespace, bounding
628 white, FNT, 0.75*FSZ, // color, font, fontsize
629 0.0, 32*PSCALE, 31*PSCALE, // angle, x, y
630 "Rotating Frame" ); // text
631
632 gdImageStringFT( im, NULL, // imagespace, bounding
633 white, FNT, 0.75*FSZ, // color, font, fontsize
634 0.0, 64*PSCALE, 31*PSCALE, // angle, x, y
635 "Rotating Frame, 4x larger" );// text
636
637 closeplot();
638
639 elapsed_time = (int)(((long) time( NULL )) - start_time ) ;
640
641 if( elapsed_time > 1 ) {
642 end_time = (long)(((double) elapsed_time ) / ip1 );
643 remaining_time = end_time - elapsed_time ;
644 }
645
646 #if DEBUG < 2
647 printf( "%4d/%d-plot%4d-nc%5.1f/%04.1f-hour%4ld/%4ld/%4ldsec\r",
648 iplot+1, NPLOT, nc, hour, ((double)MAXHOUR),
649 elapsed_time, remaining_time, end_time );
650 fflush(stdout);
651 #endif // DEBUG
652 }
653
654 printf( "\n" ); fflush(stdout);
655
656 sprintf( command, "png2swf -o %s.swf -r%3d %sdir/*.png", NAME, RATE, NAME );
657 system( command );
658 return(0);
659 }
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.