home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume27 / sfs / part11 < prev    next >
Encoding:
Text File  |  1991-12-27  |  55.2 KB  |  2,071 lines

  1. Newsgroups: comp.sources.misc
  2. From: tcamp@hercules.acpub.duke.edu (Ted Campbell)
  3. Subject:  v27i011:  sfs - Space Flight Simulator, Part11/21
  4. Message-ID: <1991Dec24.191551.20647@sparky.imd.sterling.com>
  5. X-Md4-Signature: 3f36da4d83528efde87ed208ab4d7692
  6. Date: Tue, 24 Dec 1991 19:15:51 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: tcamp@hercules.acpub.duke.edu (Ted Campbell)
  10. Posting-number: Volume 27, Issue 11
  11. Archive-name: sfs/part11
  12. Environment: IBMPC && EGA/VGA, UNIX-PC && MGR, UNIX && X11
  13.  
  14. #!/bin/sh
  15. # do not concatenate these parts, unpack them in order with /bin/sh
  16. # file sfs/as/as_focus.c continued
  17. #
  18. if test ! -r _shar_seq_.tmp; then
  19.     echo 'Please unpack part 1 first!'
  20.     exit 1
  21. fi
  22. (read Scheck
  23.  if test "$Scheck" != 11; then
  24.     echo Please unpack part "$Scheck" next!
  25.     exit 1
  26.  else
  27.     exit 0
  28.  fi
  29. ) < _shar_seq_.tmp || exit 1
  30. if test ! -f _shar_wnt_.tmp; then
  31.     echo 'x - still skipping sfs/as/as_focus.c'
  32. else
  33. echo 'x - continuing file sfs/as/as_focus.c'
  34. sed 's/^X//' << 'SHAR_EOF' >> 'sfs/as/as_focus.c' &&
  35. X    and software based on it under the following conditions:
  36. X    (a) in general, the code and software based upon it may be 
  37. X    used by individuals and by non-profit organizations; (b) it
  38. X    may also be utilized by governmental agencies in any country,
  39. X    with the exception of military agencies; (c) the code and/or
  40. X    software based upon it may not be sold for a profit without
  41. X    an explicit and specific permission from the author, except
  42. X    that a minimal fee may be charged for media on which it is
  43. X    copied, and for copying and handling; (d) the code must be 
  44. X    distributed in the form in which it has been released by the
  45. X    author; and (e) the code and software based upon it may not 
  46. X    be used for illegal activities. 
  47. X
  48. ****************************************************************/
  49. X
  50. #include "stdio.h"
  51. #include "ctype.h"
  52. #include "bw.h"
  53. #include "as.h"
  54. X
  55. #ifdef __STDC__
  56. #include "malloc.h"
  57. #else
  58. extern char * malloc();
  59. #endif
  60. X
  61. #define CHECK_PARAMS
  62. X
  63. /****************************************************************
  64. X
  65. X    as_readfd()     read a focal data (fd) file
  66. X
  67. ****************************************************************/
  68. X
  69. as_readfd( fdfile, fstruct )
  70. X   char *fdfile;
  71. X   struct as_focus *fstruct;
  72. X   {
  73. X   FILE *data;                          /* data file for read */
  74. X   register int c;                      /* counter */
  75. X   static char x_buffer[ BW_EBUFSIZE ]; /* buffer to read data */
  76. X   char *r;                             /* return value from as_fgets */
  77. X
  78. X   /* Send notice */
  79. X
  80. X   sprintf( bw_ebuf, "Reading focal datafile %s",
  81. X      fdfile );
  82. X   bw_message( bw_ebuf );
  83. X
  84. X   /***  Try to open the file, return for failure */
  85. X
  86. X   if ( ( data = fopen( fdfile, "rb" )) == NULL )
  87. X      {
  88. X      sprintf( bw_ebuf, "Cannot open focal data file %s",
  89. X     fdfile );
  90. X      bw_error( bw_ebuf );
  91. X      return BW_ERROR;
  92. X      }
  93. X
  94. X   /***  Begin reading elements from the file */
  95. X   /***  0. save fd filename itself */
  96. X
  97. X   /* allocate memory for name */
  98. X
  99. X   if ( ( fstruct->fdfile = malloc( strlen( fdfile ) + 2 )) == NULL )
  100. X      {
  101. X      bw_error( "Failed to allocate memory for fd filename. " );
  102. X      return BW_ERROR;                          /* error return */
  103. X      }
  104. X   strcpy( fstruct->fdfile, fdfile );
  105. X
  106. X   /***  1. Read name of the focus */
  107. X
  108. X   r = as_fgets( x_buffer, 127, data );         /* get a string */
  109. X   if ( r == NULL )
  110. X      {
  111. X      sprintf( bw_ebuf, "Failure to read focal data file %s ", fdfile );
  112. X      bw_error( bw_ebuf );
  113. X      return BW_ERROR;
  114. X      }
  115. X
  116. #ifdef OLD_DEBUG
  117. X   fprintf( stderr, "DEBUG: read name \n" );
  118. #endif
  119. X
  120. X   for ( c = 0; x_buffer[ c ] >= ' '; ++c )     /* find end of string */
  121. X      {
  122. X
  123. #ifdef OLD_DEBUG
  124. X   fprintf( stderr, "DEBUG: counting: %3d [char 0x%3x next 0x%3x] \n", 
  125. X      c, x_buffer[ c ], x_buffer[ c + 1 ]  );
  126. #endif
  127. X
  128. X      }
  129. X   x_buffer[ c ] = 0;                           /* terminate with 0 */
  130. X
  131. X   /* allocate memory for name */
  132. X
  133. X   if ( ( fstruct->name = malloc( strlen( x_buffer ) + 2 )) == NULL )
  134. X      {
  135. X      bw_error( "Failed to allocate memory for focal data elements. " );
  136. X      return BW_ERROR;                          /* error return */
  137. X      }
  138. X
  139. #ifdef OLD_DEBUG
  140. X   fprintf( stderr, "DEBUG: allocated memory \n" );
  141. #endif
  142. X
  143. X   strcpy( fstruct->name, x_buffer );           /* copy name to buffer */
  144. X
  145. #ifdef OLD_DEBUG
  146. X   fprintf( stderr, "DEBUG: copied name to buffer \n" );
  147. #endif
  148. X
  149. X   /***  2. Read adjective for the focus */
  150. X
  151. X   r = as_fgets( x_buffer, 127, data );        /* get a string */
  152. X   if ( r == NULL )
  153. X      {
  154. X      sprintf( bw_ebuf, "Failure to read focal data file %s ", fdfile );
  155. X      bw_error( bw_ebuf );
  156. X      return BW_ERROR;
  157. X      }
  158. X
  159. #ifdef OLD_DEBUG
  160. X   fprintf( stderr, "DEBUG: read adjective \n" );
  161. #endif
  162. X
  163. X   for ( c = 0; x_buffer[ c ] >= ' '; ++c )    /* find end of string */
  164. X      {
  165. X
  166. #ifdef OLD_DEBUG
  167. X   fprintf( stderr, "DEBUG: counting: %2d [char 0x%2x next 0x%2x] \n",
  168. X      c, x_buffer[ c ], x_buffer[ c + 1 ]  );
  169. #endif
  170. X
  171. X      }
  172. X
  173. #ifdef OLD_DEBUG
  174. X   fprintf( stderr, "DEBUG: count complete; c = %d \n", c );
  175. #endif
  176. X
  177. X   x_buffer[ c ] = 0;                          /* terminate with 0 */
  178. X
  179. #ifdef OLD_DEBUG
  180. X   fprintf( stderr, "DEBUG: buffer terminated \n" );
  181. #endif
  182. X
  183. X   /* allocate memory for adjective */
  184. X
  185. X   if ( ( fstruct->adjective = malloc( strlen( x_buffer ) + 2 )) == NULL )
  186. X      {
  187. X      bw_error( "Failed to allocate memory for focal data elements. " );
  188. X      return BW_ERROR;                          /* error return */
  189. X      }
  190. X
  191. #ifdef OLD_DEBUG
  192. X   fprintf( stderr, "DEBUG: allocated memory \n" );
  193. #endif
  194. X
  195. X   strcpy( fstruct->adjective, x_buffer );      /* copy adjective to buffer */
  196. X
  197. #ifdef OLD_DEBUG
  198. X   fprintf( stderr, "DEBUG: copied adjective \n" );
  199. #endif
  200. X
  201. X   /***  3. Read radius of the focus */
  202. X
  203. X   r = as_fgets( x_buffer, 127, data );
  204. X   if ( r == NULL )
  205. X      {
  206. X      sprintf( bw_ebuf, "Failure to read focal data file %s ", fdfile );
  207. X      bw_error( bw_ebuf );
  208. X      return BW_ERROR;
  209. X      }
  210. X
  211. #ifdef OLD_DEBUG
  212. X   fprintf( stderr, "DEBUG: read radius \n" );
  213. #endif
  214. X
  215. X   sscanf( x_buffer, "%lf", &fstruct->radius );
  216. X
  217. #ifdef OLD_DEBUG
  218. X   fprintf( stderr, "DEBUG: scanned radius \n" );
  219. #endif
  220. X
  221. X   /***  4. Read mass of the focus */
  222. X
  223. X   r = as_fgets( x_buffer, 127, data );
  224. X   if ( r == NULL )
  225. X      {
  226. X      sprintf( bw_ebuf, "Failure to read focal data file %s ", fdfile );
  227. X      bw_error( bw_ebuf );
  228. X      return BW_ERROR;
  229. X      }
  230. X
  231. #ifdef OLD_DEBUG
  232. X   fprintf( stderr, "DEBUG: read mass \n" );
  233. #endif
  234. X
  235. X   sscanf( x_buffer, "%lf", &fstruct->mass );
  236. X
  237. #ifdef OLD_DEBUG
  238. X   fprintf( stderr, "DEBUG: scanned mass \n" );
  239. #endif
  240. X
  241. X   fstruct->mass *= 5.98e27;
  242. X
  243. X   /***  5. Read sidereal period of the focus */
  244. X
  245. X   r = as_fgets( x_buffer, 127, data );
  246. X   if ( r == NULL )
  247. X      {
  248. X      sprintf( bw_ebuf, "Failure to read focal data file %s ", fdfile );
  249. X      bw_error( bw_ebuf );
  250. X      return BW_ERROR;
  251. X      }
  252. X
  253. #ifdef OLD_DEBUG
  254. X   fprintf( stderr, "DEBUG: read sidereal period \n" );
  255. #endif
  256. X
  257. X   sscanf( x_buffer, "%lf", &fstruct->sid_day );
  258. X
  259. #ifdef OLD_DEBUG
  260. X   fprintf( stderr, "DEBUG: scanned sidereal period \n" );
  261. #endif
  262. X
  263. X   fclose( data );                              /* close the fd file */
  264. X
  265. X   }
  266. X
  267. X
  268. SHAR_EOF
  269. echo 'File sfs/as/as_focus.c is complete' &&
  270. chmod 0644 sfs/as/as_focus.c ||
  271. echo 'restore of sfs/as/as_focus.c failed'
  272. Wc_c="`wc -c < 'sfs/as/as_focus.c'`"
  273. test 6547 -eq "$Wc_c" ||
  274.     echo 'sfs/as/as_focus.c: original size 6547, current size' "$Wc_c"
  275. rm -f _shar_wnt_.tmp
  276. fi
  277. # ============= sfs/as/as_orbit.c ==============
  278. if test -f 'sfs/as/as_orbit.c' -a X"$1" != X"-c"; then
  279.     echo 'x - skipping sfs/as/as_orbit.c (File already exists)'
  280.     rm -f _shar_wnt_.tmp
  281. else
  282. > _shar_wnt_.tmp
  283. echo 'x - extracting sfs/as/as_orbit.c (Text)'
  284. sed 's/^X//' << 'SHAR_EOF' > 'sfs/as/as_orbit.c' &&
  285. /****************************************************************
  286. X
  287. X    as_orbit.c      Orbital calculation routines
  288. X            for astronomy (as) subsystem
  289. X
  290. X            Copyright (c) 1991, Ted A. Campbell
  291. X
  292. X            Bywater Software
  293. X            P. O. Box 4023 
  294. X            Duke Station 
  295. X            Durham, NC  27706
  296. X
  297. X            email: tcamp@hercules.acpub.duke.edu
  298. X
  299. X    Copyright and Permissions Information:
  300. X
  301. X    All U.S. and international copyrights are claimed by the
  302. X    author. The author grants permission to use this code
  303. X    and software based on it under the following conditions:
  304. X    (a) in general, the code and software based upon it may be 
  305. X    used by individuals and by non-profit organizations; (b) it
  306. X    may also be utilized by governmental agencies in any country,
  307. X    with the exception of military agencies; (c) the code and/or
  308. X    software based upon it may not be sold for a profit without
  309. X    an explicit and specific permission from the author, except
  310. X    that a minimal fee may be charged for media on which it is
  311. X    copied, and for copying and handling; (d) the code must be 
  312. X    distributed in the form in which it has been released by the
  313. X    author; and (e) the code and software based upon it may not 
  314. X    be used for illegal activities. 
  315. X
  316. ****************************************************************/
  317. X
  318. #include "math.h"
  319. #include "time.h"
  320. #include "bw.h"
  321. #include "as.h"
  322. X
  323. #define KEP_ACCURACY    0.00001
  324. X
  325. /****************************************************************
  326. X
  327. X   or_init()      Set up an orbit
  328. X
  329. ****************************************************************/
  330. X
  331. or_init( orbit, ap, aa )
  332. X   struct as_orbit *orbit;
  333. X   double aa, ap;
  334. X   {
  335. X
  336. #ifdef  DEBUG
  337. X   if ( orbit->focus->radius <= 0.0 )
  338. X      {
  339. X      sprintf( bw_ebuf, "[pr:] or_init() received orbit->focus->radius = %lf",
  340. X     orbit->focus->radius );
  341. X      bw_error( bw_ebuf );
  342. X      return;
  343. X      }
  344. X   if ( orbit->focus->sid_day < 0.0 )
  345. X      {
  346. X      sprintf( bw_ebuf, "[pr:] or_init() received orbit->focus->sid_day = %lf",
  347. X     orbit->focus->sid_day );
  348. X      bw_error( bw_ebuf );
  349. X      return;
  350. X      }
  351. X   if ( orbit->focus->mass < 0.0 )
  352. X      {
  353. X      sprintf( bw_ebuf, "[pr:] or_init() received orbit->focus->mass = %lf",
  354. X     orbit->focus->mass );
  355. X      bw_error( bw_ebuf );
  356. X      return;
  357. X      }
  358. X   if ( ( orbit->inclination > 180.0 ) || ( orbit->inclination < -180.0 ))
  359. X      {
  360. X      sprintf( bw_ebuf, "[pr:] or_init() received orbit->inclination = %lf",
  361. X     orbit->inclination );
  362. X      bw_error( bw_ebuf );
  363. X      return;
  364. X      }
  365. X   if ( ( orbit->lon_an > 180.0 ) || ( orbit->lon_an < -180.0 ))
  366. X      {
  367. X      sprintf( bw_ebuf, "[pr:] or_init() received orbit->lon_an = %lf",
  368. X     orbit->lon_an );
  369. X      bw_error( bw_ebuf );
  370. X      return;
  371. X      }
  372. X   if ( ( orbit->arg_per > 180.0 ) || ( orbit->arg_per < -180.0 ))
  373. X      {
  374. X      sprintf( bw_ebuf, "[pr:] or_init() received orbit->arg_per = %lf",
  375. X     orbit->arg_per );
  376. X      bw_error( bw_ebuf );
  377. X      return;
  378. X      }
  379. #endif
  380. X
  381. X   /***    Calculate semimajor axis        */
  382. X
  383. X   orbit->semimajor = ( aa + ap + ( 2 * orbit->focus->radius )) / 2;
  384. X
  385. X   /***    Calculate orbital center - focus distance       */
  386. X
  387. X   orbit->dist = orbit->semimajor - ( orbit->focus->radius + ap );
  388. X
  389. X   /***    Calculate semiminor axis        */
  390. X
  391. X   orbit->semiminor = sqrt( (double) ( orbit->semimajor * orbit->semimajor ) - (double) ( orbit->dist * orbit->dist ));
  392. X
  393. X   /***    Calculate orbital eccentricity  */
  394. X
  395. X   orbit->eccentricity = sqrt( 1.0 - (( orbit->semiminor / (double) orbit->semimajor ) * ( orbit->semiminor / (double) orbit->semimajor )) );
  396. X
  397. X   /***    Calculate orbital period        */
  398. X
  399. X   orbit->period = sqrt ( ( ( 4.0 * ( PI * (double) PI ) ) / ( UGC * orbit->focus->mass ) )
  400. X      * ( orbit->semimajor * orbit->semimajor * orbit->semimajor ) );
  401. X
  402. X   /***   Calculate the increment factor of longitude of 
  403. X      the ascending node.  This factor must be multiplied
  404. X      by a time factor (orbital period or time into orbit, 
  405. X      in seconds).  See Davidoff, pp. 8-9 and 8-10, and
  406. X      formula 8.14.    */
  407. X
  408. X   if ( orbit->focus->sid_day == 0.0 )
  409. X      {
  410. X      orbit->lif = 0;
  411. X      }
  412. X   else
  413. X      {
  414. X      orbit->lif = (2 * PI) / (double) orbit->focus->sid_day;
  415. X      }
  416. X
  417. X   }
  418. X
  419. /****************************************************************
  420. X
  421. X   or_kep()      Solve Kepler's equation
  422. X
  423. X   Globals utilized:  
  424. X
  425. X   orbit->eccentricity Eccentricity of the orbital ellipse
  426. X
  427. X   orbit->semimajor    Semimajor axis of the orbital ellipse (km)
  428. X
  429. X   orbit->period       Orbital period (seconds)
  430. X
  431. X   Input:
  432. X
  433. X   t                   Time from periapsis in seconds
  434. X               ( 0 < t < orbit->period )
  435. X
  436. X   Output:
  437. X
  438. X   theta               Angle between periapsis, geocenter, and
  439. X               current position (theta).
  440. X
  441. X   r                   Distance from satellite to focal center,
  442. X               in kilometers
  443. X
  444. ****************************************************************/
  445. X
  446. or_kep( orbit, t, theta, r )
  447. X   struct as_orbit *orbit;
  448. X   long t;
  449. X   double *theta;
  450. X   long *r;
  451. X   {
  452. X   double z, z3, E;
  453. X   z  = 2.0 * PI * ( (double) t / (double) orbit->period );
  454. X   E  = z;
  455. X
  456. X   do
  457. X      {
  458. X      z3 = ( E - ( orbit->eccentricity * sin( E )) - z ) / ( 1 - ( orbit->eccentricity * cos( E )));
  459. X      E  = E - z3;
  460. X      }
  461. X   while ( fabs( z3 ) > KEP_ACCURACY );
  462. X
  463. X   *theta = PI;
  464. X   if ( E != PI )
  465. X      {
  466. X      *theta = 2.0 * atan( sqrt( ( 1 - orbit->eccentricity ) / ( 1 + orbit->eccentricity )) * tan( E / 2.0 ));
  467. X      if ( E > PI )
  468. X         {
  469. X         *theta = ( (double) 2.0 * PI ) + *theta;
  470. X         }
  471. X      }
  472. X
  473. X   *r = orbit->semimajor * ( 1 - orbit->eccentricity * orbit->eccentricity ) / ( 1 + orbit->eccentricity * cos( *theta ));
  474. X   return 1;
  475. X   }
  476. X
  477. X
  478. /****************************************************************
  479. X
  480. X   or_ssp()   Calculate Subsatellite Point
  481. X
  482. X   This function utilizes available data on the satellite 
  483. X   to return the subsatellite point, that is, the point 
  484. X   on the surface of the orbital focus directly under 
  485. X   the satellite at a given moment.  
  486. X
  487. ****************************************************************/
  488. X
  489. or_ssp( orbit, t, latitude, longitude, r, n )
  490. X   struct as_orbit *orbit;
  491. X   long t, *r, *n;
  492. X   double *longitude, *latitude;
  493. X   {
  494. X   static long _r, tp;
  495. X   static double theta;
  496. X   double n1, n2, n4, E, lan;
  497. X   long t1;
  498. X
  499. #ifdef  DEBUG
  500. X   if ( orbit->focus->radius < OR_RAD_MIN )
  501. X      {
  502. X      sprintf( bw_ebuf, "[pr:] or_ssp() received orbit->focus->radius = %lf",
  503. X     orbit->focus->radius );
  504. X      bw_error( bw_ebuf );
  505. X      return;
  506. X      }
  507. X   if ( orbit->focus->sid_day < OR_SID_MIN )
  508. X      {
  509. X      sprintf( bw_ebuf, "[pr:] or_ssp() received orbit->focus->sid_day = %lf",
  510. X     orbit->focus->sid_day );
  511. X      bw_error( bw_ebuf );
  512. X      return;
  513. X      }
  514. X   if ( orbit->focus->mass < OR_MAS_MIN )
  515. X      {
  516. X      sprintf( bw_ebuf, "[pr:] or_ssp() received orbit->focus->mass = %le",
  517. X     orbit->focus->mass );
  518. X      bw_error( bw_ebuf );
  519. X      return;
  520. X      }
  521. X   if ( ( orbit->inclination > OR_INC_MAX ) || ( orbit->inclination < OR_INC_MIN ))
  522. X      {
  523. X      sprintf( bw_ebuf, "[pr:] or_ssp() received orbit->inclination = %lf",
  524. X     orbit->inclination );
  525. X      bw_error( bw_ebuf );
  526. X      return;
  527. X      }
  528. X   if ( ( orbit->lon_an > OR_LAN_MAX ) || ( orbit->lon_an < OR_LAN_MIN ))
  529. X      {
  530. X      sprintf( bw_ebuf, "[pr:] or_ssp() received orbit->lon_an = %lf",
  531. X     orbit->lon_an );
  532. X      bw_error( bw_ebuf );
  533. X      return;
  534. X      }
  535. X   if ( ( orbit->arg_per > OR_ARP_MAX ) || ( orbit->arg_per < OR_ARP_MIN ))
  536. X      {
  537. X      sprintf( bw_ebuf, "[pr:] or_ssp() received orbit->arg_per = %lf",
  538. X     orbit->arg_per );
  539. X      bw_error( bw_ebuf );
  540. X      return;
  541. X      }
  542. X   if ( orbit->period < OR_PER_MIN )
  543. X      {
  544. X      sprintf( bw_ebuf, "[pr:] or_ssp() received orbit->period = %lf",
  545. X     orbit->period );
  546. X      bw_error( bw_ebuf );
  547. X      return;
  548. X      }
  549. X   if ( ( orbit->eccentricity < OR_ECC_MIN ) || ( orbit->eccentricity > OR_ECC_MAX ))
  550. X      {
  551. X      sprintf( bw_ebuf, "[pr:] or_ssp() received orbit->eccentricity = %lf",
  552. X     orbit->eccentricity );
  553. X      bw_error( bw_ebuf );
  554. X      return;
  555. X      }
  556. #endif
  557. X
  558. X   *n = t / (long) orbit->period;           /* return number of current orbit */
  559. X   t1 = t - ( orbit->period * ( *n ) );     /* get seconds into this orbit */
  560. X   if ( t1 == 0 )
  561. X      {
  562. X      t1 = 1;
  563. X      }
  564. X
  565. X   or_kep( orbit, t1, &theta, &_r );
  566. X   *r = _r;
  567. X
  568. #ifdef  OLD_DEBUG
  569. X    sprintf( bw_ebuf, "or_ssp(): r     = %ld (%ld) ", _r, *r );
  570. X    bw_debug( bw_ebuf );
  571. X    sprintf( bw_ebuf, "or_ssp(): theta = %lf", theta );
  572. X    bw_debug( bw_ebuf );
  573. #endif
  574. X
  575. X   /***   Calculate the longitude of the ascending node at 
  576. X      the beginning of this orbit.  See Davidoff, p. 8-9
  577. X      and 8-10, and equations 8.13a, 8.13b, and 8.14.   */
  578. X
  579. X   lan = ( orbit->lon_an * DEG_RAD ) - ( orbit->lif * orbit->period * *n );
  580. X
  581. X   /***   Calculate the latitude of the SSP.  See Davidoff, 
  582. X      pp. 8-13 - 8-15, esp. equation 8.20.      */
  583. X
  584. X   *latitude = asin( sin( orbit->inclination * DEG_RAD )
  585. X      * sin( theta + ( orbit->arg_per * DEG_RAD )));
  586. X
  587. X   if ( ( orbit->inclination >= 0 ) && ( orbit->inclination < 90 ) )
  588. X      {
  589. X      n2 = 1;
  590. X      }
  591. X   else
  592. X      {
  593. X      n2 = 0;
  594. X      }
  595. X   if ( ( ( *latitude ) * RAD_DEG ) < 0.0 )
  596. X      {
  597. X      n4 = 1;
  598. X      }
  599. X   else
  600. X      {
  601. X      n4 = 0;
  602. X      }
  603. X
  604. X   if ( ( orbit->arg_per > 180 ) && ( orbit->arg_per <= 540 ) )
  605. X      {
  606. X      n1 = 1;
  607. X      }
  608. X   else
  609. X      {
  610. X      n1 = 0;
  611. X      }
  612. X
  613. X   E = 2 * atan( (double) pow( ( 1 - orbit->eccentricity ) / ( 1 + orbit->eccentricity ), (double) 0.5 )
  614. X        * tan( ( orbit->arg_per * DEG_RAD ) / 2.0 )) + ( 2.0 * PI * n1);
  615. X   tp = ( orbit->period / ( 2.0 * PI ) ) * ( E - sin( E ) );
  616. X
  617. X   *longitude = as_lfix( lan
  618. X           - pow( (double) -1.0, n2 + n4 )
  619. X       * acos( cos( theta + ( orbit->arg_per * DEG_RAD ))
  620. X       / cos( *latitude ) )
  621. X       - orbit->lif * (double) t1
  622. X       - orbit->lif * (double) tp );
  623. X
  624. X   /* convert to degrees */
  625. X
  626. X   *longitude = *longitude * RAD_DEG;
  627. X   *latitude  = *latitude  * RAD_DEG;
  628. X
  629. X   }
  630. X
  631. double
  632. as_lfix( l )
  633. X   double l;
  634. X   {
  635. X   double l1;
  636. X   l1 = l;
  637. X   while ( l1 < ( 0 - PI ) )
  638. X      {
  639. X      l1 += ( 2.0 * PI );
  640. X      }
  641. X   while ( l1 > PI )
  642. X      {
  643. X      l1 -= ( 2.0 * PI );
  644. X      }
  645. X   return l1;
  646. X   }
  647. X
  648. X
  649. SHAR_EOF
  650. chmod 0644 sfs/as/as_orbit.c ||
  651. echo 'restore of sfs/as/as_orbit.c failed'
  652. Wc_c="`wc -c < 'sfs/as/as_orbit.c'`"
  653. test 9998 -eq "$Wc_c" ||
  654.     echo 'sfs/as/as_orbit.c: original size 9998, current size' "$Wc_c"
  655. rm -f _shar_wnt_.tmp
  656. fi
  657. # ============= sfs/as/as_spj.c ==============
  658. if test -f 'sfs/as/as_spj.c' -a X"$1" != X"-c"; then
  659.     echo 'x - skipping sfs/as/as_spj.c (File already exists)'
  660.     rm -f _shar_wnt_.tmp
  661. else
  662. > _shar_wnt_.tmp
  663. echo 'x - extracting sfs/as/as_spj.c (Text)'
  664. sed 's/^X//' << 'SHAR_EOF' > 'sfs/as/as_spj.c' &&
  665. /***************************************************************
  666. X
  667. X    as_spj.c        Spherical projection routines
  668. X            for astronomy (as) subsystem
  669. X
  670. X            Copyright (c) 1991, Ted A. Campbell
  671. X
  672. X            Bywater Software
  673. X            P. O. Box 4023
  674. X            Duke Station
  675. X            Durham, NC  27706
  676. X
  677. X            email: tcamp@hercules.acpub.duke.edu
  678. X
  679. X    Copyright and Permissions Information:
  680. X
  681. X    All U.S. and international copyrights are claimed by the
  682. X    author. The author grants permission to use this code
  683. X    and software based on it under the following conditions:
  684. X    (a) in general, the code and software based upon it may be
  685. X    used by individuals and by non-profit organizations; (b) it
  686. X    may also be utilized by governmental agencies in any country,
  687. X    with the exception of military agencies; (c) the code and/or
  688. X    software based upon it may not be sold for a profit without
  689. X    an explicit and specific permission from the author, except
  690. X    that a minimal fee may be charged for media on which it is
  691. X    copied, and for copying and handling; (d) the code must be
  692. X    distributed in the form in which it has been released by the
  693. X    author; and (e) the code and software based upon it may not
  694. X    be used for illegal activities.
  695. X
  696. ***************************************************************/
  697. X
  698. #include "stdio.h"
  699. #include "math.h"
  700. #include "bw.h"
  701. #include "as.h"
  702. X
  703. #ifdef __STDC__
  704. #include "malloc.h"
  705. #else
  706. extern char * malloc();
  707. #endif
  708. X
  709. /***************************************************************
  710. X
  711. X    spj_readspd()            Read an SPJ datafile
  712. X
  713. ***************************************************************/
  714. X
  715. spj_readspd( datafile, start, end )
  716. X   char *datafile;
  717. X   struct spj_pt *start, *end;
  718. X   {
  719. X   FILE *data;
  720. X   register int c;
  721. X   static char read_buffer[ 128 ];
  722. X   static int co;
  723. X   static double la, lo, di;
  724. X   struct spj_pt *current, *new;
  725. X
  726. X   /* Open the datafile */
  727. X
  728. X   if ( ( data = fopen( datafile, "rb" )) == NULL )
  729. X      {
  730. X      sprintf( bw_ebuf, "Failed to open datafile %s", datafile );
  731. X      bw_error( bw_ebuf );
  732. X      return BW_ERROR;
  733. X      }
  734. X   else
  735. X      {
  736. X      sprintf( bw_ebuf, "Reading spherical projection datafile %s",
  737. X     datafile );
  738. X      bw_message( bw_ebuf );
  739. X      }
  740. X
  741. X   /* Get storage for the first point */
  742. X
  743. X   if ( ( current = ( struct spj_pt  *) malloc( sizeof( struct spj_pt ) )) == NULL )
  744. X      {
  745. X      sprintf( bw_ebuf, "Failed to allocate memory reading %s", datafile );
  746. X      bw_error( bw_ebuf );
  747. X      return BW_ERROR;
  748. X      }
  749. #ifdef  OLD_DEBUG
  750. X   else
  751. X      {
  752. X      sprintf( bw_ebuf, "Memory for %s allocated ok",
  753. X     datafile );
  754. X      bw_message( bw_ebuf );
  755. X      }
  756. #endif
  757. X
  758. X    start->next = current;
  759. X
  760. X   /* Read the data from the file */
  761. X
  762. X   c = 0;
  763. X   while( feof( data ) == 0 )
  764. X      {
  765. X
  766. X      as_fgets( read_buffer, 127, data );
  767. X      sscanf( read_buffer, "%d%lf%lf%lf", &co, &la, &lo, &di );
  768. X      current->code = co;
  769. X      current->latitude  = la;
  770. X      current->longitude = lo;
  771. X      current->radius    = di;
  772. X
  773. #ifdef  OLD_DEBUG
  774. X      sprintf( bw_ebuf, "[pr:] spj_readsd(): %d: %.1lf %.1lf",
  775. X      c, la, lo );
  776. X      bw_message( bw_ebuf );
  777. #endif
  778. X
  779. X      /* Now get a new 'current' */
  780. X
  781. X      if ( ( new = (struct spj_pt  *)
  782. X     malloc( sizeof( struct spj_pt ) )) == 0 )
  783. X     {
  784. X     sprintf( bw_ebuf, "Failed to allocate memory reading %s", datafile );
  785. X     bw_error( bw_ebuf );
  786. X     return BW_ERROR;
  787. X     }
  788. #ifdef  OLD_DEBUG
  789. X      else
  790. X     {
  791. X     sprintf( bw_ebuf, "Memory for %s allocated ok",
  792. X        datafile );
  793. X     bw_message( bw_ebuf );
  794. X     }
  795. #endif
  796. X
  797. X      /* Reassign linkage from current to new */
  798. X
  799. X      if ( feof( data ) == FALSE )
  800. X     {
  801. X     current->next = new;
  802. X     current       = new;
  803. X     current->next = end;
  804. X     }
  805. X
  806. X      if ( ferror( data ) != FALSE )
  807. X     {
  808. X     sprintf( bw_ebuf, "Failed reading %s", datafile );
  809. X     bw_error( bw_ebuf );
  810. X     return BW_ERROR;
  811. X     }
  812. X      ++c;
  813. X      }
  814. X
  815. X   fclose( data );
  816. X   return TRUE;
  817. X   }
  818. X
  819. /***************************************************************
  820. X
  821. X    spj_calc()      Calculate a linked set of SPJ
  822. X            point structures
  823. X
  824. ***************************************************************/
  825. X
  826. spj_calc( start, end, vlat, vlon, vdis, forced_radius, rotation, mode, poll )
  827. X   struct spj_pt *start, *end;
  828. X   double vlat, vlon, vdis;
  829. X   double forced_radius;
  830. X   double rotation;
  831. X   int mode;
  832. X   int (*poll)();
  833. X   {
  834. X   struct spj_pt *current;
  835. X   static double x, y;
  836. X   static int side;
  837. X   register int d;
  838. X   double radius;
  839. X
  840. #ifdef  DEBUG
  841. X   if ( ( vlat < -90.0 ) || ( vlat > 90.0 ))
  842. X      {
  843. X      sprintf( bw_ebuf, "[pr:] spj_calc() received vlat = %lf", vlat );
  844. X      bw_error( bw_ebuf );
  845. X      return;
  846. X      }
  847. X   if ( ( vlon < -180.0 ) || ( vlon > 180.0 ))
  848. X      {
  849. X      sprintf( bw_ebuf, "[pr:] spj_calc() received vlon = %lf", vlon );
  850. X      bw_error( bw_ebuf );
  851. X      return;
  852. X      }
  853. X   if ( vdis < 0.0 )
  854. X      {
  855. X      sprintf( bw_ebuf, "[pr:] spj_calc() received vdis = %lf", vdis );
  856. X      bw_error( bw_ebuf );
  857. X      return;
  858. X      }
  859. X   if ( ( rotation < 0.0 ) || ( rotation > 360.0 ))
  860. X      {
  861. X      sprintf( bw_ebuf, "[pr:] spj_calc() received rotation = %lf", rotation );
  862. X      bw_error( bw_ebuf );
  863. X      return;
  864. X      }
  865. X   if ( ( mode < 0 ) || ( mode > 2 ))
  866. X      {
  867. X      sprintf( bw_ebuf, "[pr: spj_calc() received mode = %d", mode );
  868. X      bw_error( bw_ebuf );
  869. X      return;
  870. X      }
  871. #endif
  872. X
  873. X   d = 0;
  874. X   current = start->next;
  875. X   while( current != end )
  876. X      {
  877. X
  878. X      ++d;
  879. X
  880. X      if ( forced_radius == 0.0 )
  881. X     {
  882. X     radius = current->radius;
  883. X     }
  884. X      else
  885. X     {
  886. X     radius = forced_radius;
  887. X     }
  888. X
  889. #ifdef    OLD_DEBUG
  890. X      sprintf( bw_ebuf, " calculate %d: lat %0.2lf, lon %0.2lf, rad %0.2lf      >>",
  891. X     d, current->latitude, current->longitude, radius );
  892. X      bw_message( bw_ebuf );
  893. X      kb_rx();
  894. #endif
  895. X
  896. X      spj_point( current->latitude, current->longitude,
  897. X     radius, vlat, vlon, vdis, rotation,
  898. X     mode, &x, &y, &side );
  899. X      current->x    = x;
  900. X      current->y    = y;
  901. X      current->side = side;
  902. X
  903. #ifdef    OLD_DEBUG
  904. X      sprintf( bw_ebuf, " x = %0.2lf, y = %0.2lf, v = %d      >>",
  905. X     current->x * ACC_FAC,
  906. X     current->y * ACC_FAC,
  907. X     current->side );
  908. X      bw_message( bw_ebuf );
  909. X      kb_rx();
  910. #endif
  911. X
  912. X      /* call poll function */
  913. X
  914. X      (*poll) ();
  915. X
  916. X      current = current->next;
  917. X      }
  918. X   }
  919. X
  920. /***************************************************************
  921. X
  922. X    spj_point()     Calculate a spherical projection point
  923. X
  924. X    This routine is, in a sense, the heart of the Space
  925. X    Flight Simulator and other spherical-projection programs
  926. X    related to it, such as the Space Flight Atlas.
  927. X
  928. ***************************************************************/
  929. X
  930. spj_point( plat, plon, prad, vlat, vlon, vdis, rotation, mode, x, y, side )
  931. X   double plat;       /* latitude of point in object coordinates */
  932. X   double plon;       /* longitude of point in object coordinates */
  933. X   double prad;       /* "radius" i.e., distance from center of
  934. X           object, of the point */
  935. X   double vlat;       /* latitude of viewer */
  936. X   double vlon;       /* longitude of viewer */
  937. X   double vdis;       /* distance of viewer from center of object */
  938. X   double rotation;   /* rotation of object in degrees, counter-
  939. X           clockwise;
  940. X   int mode;          /* mode of calculation, i.e., side(s) to calculate */
  941. X   double *x;         /* return x viewer coordinate in degrees of arc */
  942. X   double *y;         /* return y viewer coordinate in degrees of arc */
  943. X   int *side;         /* return side of sphere */
  944. X   {
  945. X   static double old_vlat = 361.0;
  946. X   static double old_vlon = 361.0;
  947. X   static double old_vdis = -1.0;
  948. X   static double old_plat = 361.0;
  949. X   static double old_plon = 361.0;
  950. X   static double old_prad = -1.0;
  951. X   static double old_rot  = 361.0;
  952. X   static double x_lon    = 361.0;
  953. X   static double x_rsin, x_rcos;
  954. X   static double x_cosplat, x_sinplat;
  955. X   static double x_cosvlat, x_sinvlat;
  956. X   static double x_angrad;
  957. X   double x_cosc, x_cosl;
  958. X   double x_temp, y_temp;
  959. X
  960. #ifdef  OLD_DEBUG
  961. X   sprintf( bw_ebuf, "[pr:] spj_point() received: plat %0.2lf, plon %0.2lf, prad %0.2lf      >>",
  962. X      plat, plon, prad );
  963. X   bw_message( bw_ebuf );
  964. X   kb_rx();
  965. X   sprintf( bw_ebuf, "[pr:] spj_point() received: vlat %0.2lf, vlon %0.2lf, vdis %0.2lf      >>",
  966. X      vlat, vlon, vdis );
  967. X   bw_message( bw_ebuf );
  968. X   kb_rx();
  969. X   sprintf( bw_ebuf, "[pr:] spj_point() received: rot %0.2lf, mode %d      >>",
  970. X      rotation, mode );
  971. X   bw_message( bw_ebuf );
  972. X   kb_rx();
  973. #endif
  974. X
  975. #ifdef  DEBUG
  976. X   if ( ( vlat < -90.0 ) || ( vlat > 90.0 ))
  977. X      {
  978. X      sprintf( bw_ebuf, "[pr:] spj_calc() received vlat = %lf", vlat );
  979. X      bw_error( bw_ebuf );
  980. X      return;
  981. X      }
  982. X   if ( ( vlon < -180.0 ) || ( vlon > 180.0 ))
  983. X      {
  984. X      sprintf( bw_ebuf, "[pr:] spj_calc() received vlon = %lf", vlon );
  985. X      bw_error( bw_ebuf );
  986. X      return;
  987. X      }
  988. X   if ( vdis < 0.0 )
  989. X      {
  990. X      sprintf( bw_ebuf, "[pr:] spj_calc() received vdis = %lf", vdis );
  991. X      bw_error( bw_ebuf );
  992. X      return;
  993. X      }
  994. X   if ( ( plat < -90.0 ) || ( plat > 90.0 ))
  995. X      {
  996. X      sprintf( bw_ebuf, "[pr:] spj_calc() received plat = %lf", plat );
  997. X      bw_error( bw_ebuf );
  998. X      return;
  999. X      }
  1000. X   if ( ( plon < -180.0 ) || ( plon > 180.0 ))
  1001. X      {
  1002. X      sprintf( bw_ebuf, "[pr:] spj_calc() received plon = %lf", plon );
  1003. X      bw_error( bw_ebuf );
  1004. X      return;
  1005. X      }
  1006. X   if ( prad < 0.0 )
  1007. X      {
  1008. X      sprintf( bw_ebuf, "[pr:] spj_calc() received prad = %lf", prad );
  1009. X      bw_error( bw_ebuf );
  1010. X      return;
  1011. X      }
  1012. X   if ( ( rotation < 0.0 ) || ( rotation > 360.0 ))
  1013. X      {
  1014. X      sprintf( bw_ebuf, "[pr:] spj_calc() received rotation = %lf", rotation );
  1015. X      bw_error( bw_ebuf );
  1016. X      return;
  1017. X      }
  1018. X   if ( ( mode < 0 ) || ( mode > 2 ))
  1019. X      {
  1020. X      sprintf( bw_ebuf, "[pr: spj_calc() received mode = %d", mode );
  1021. X      bw_error( bw_ebuf );
  1022. X      return;
  1023. X      }
  1024. #endif
  1025. X
  1026. X   /* if longitude is changed, calculate its sine and cosine */
  1027. X
  1028. X   if ( plon != old_plon )
  1029. X      {
  1030. X      x_lon    = spj_meridian( vlon, plon );
  1031. X      old_plon = plon;
  1032. #ifdef  OLD_DEBUG
  1033. X      bw_message( "[pr:] spj_point() recalculated plon" );
  1034. X      kb_rx();
  1035. #endif
  1036. X      }
  1037. X
  1038. X   /* if viewer latitude is changed, calculate its sine and cosine */
  1039. X
  1040. X   if ( vlat != old_vlat )
  1041. X      {
  1042. X      x_cosvlat = vpt_cos( vlat );
  1043. X      x_sinvlat = vpt_sin( vlat );
  1044. X      old_vlat = vlat;
  1045. #ifdef  OLD_DEBUG
  1046. X      bw_debug( "[pr:] spj_point() recalculated vlat" );
  1047. #endif
  1048. X      }
  1049. X
  1050. X   /* if point latitude is changed, calculate its sine and cosine */
  1051. X
  1052. X   if ( plat != old_plat )
  1053. X      {
  1054. X      x_cosplat = vpt_cos( plat );
  1055. X      x_sinplat = vpt_sin( plat );
  1056. X      old_plat = plat;
  1057. #ifdef  OLD_DEBUG
  1058. X      bw_debug( "[pr:] spj_point() recalculated plat" );
  1059. #endif
  1060. X      }
  1061. X
  1062. X   /* calculations to determine side */
  1063. X
  1064. X   x_cosl    = vpt_cos( x_lon ) * x_cosplat;
  1065. X   x_cosc    = x_sinvlat * x_sinplat + x_cosvlat * x_cosl;
  1066. X
  1067. X   /* Note side of sphere, and return if this side is not
  1068. X      to be calculated now */
  1069. X
  1070. X   if ( x_cosc < 0 )
  1071. X      {
  1072. X      *side = SPJ_FARSIDE;
  1073. X      if ( mode == SPJ_NEARSIDE )
  1074. X     {
  1075. X     return;
  1076. X     }
  1077. X      }
  1078. X   else
  1079. X      {
  1080. X      *side = SPJ_NEARSIDE;
  1081. X      if ( mode == SPJ_FARSIDE )
  1082. X     {
  1083. X     return;
  1084. X     }
  1085. X      }
  1086. X
  1087. X   /* if point radius or viewer distance is changed, recalculate
  1088. X      the angular radius */
  1089. X
  1090. X   if ( ( prad != old_prad ) || ( vdis != old_vdis ))
  1091. X      {
  1092. X      x_angrad = spj_angrad( vdis, prad );
  1093. X      old_prad = prad;
  1094. X      old_vdis = vdis;
  1095. #ifdef  OLD_DEBUG
  1096. X      bw_message( "[pr:] spj_point() recalculated angular radius" );
  1097. X      kb_rx();
  1098. #endif
  1099. X      }
  1100. X
  1101. X   /* Assign unrotated values */
  1102. X
  1103. X   *x = x_angrad * ( x_cosplat * vpt_sin( x_lon ) );
  1104. X   *y = x_angrad * ( x_cosvlat * x_sinplat - x_sinvlat * x_cosl );
  1105. X
  1106. X   /* if rotation has changed, recalculate its sine and cosine */
  1107. X
  1108. X   if ( rotation != old_rot )
  1109. X      {
  1110. X      x_rsin  = vpt_sin( rotation );
  1111. X      x_rcos  = vpt_cos( rotation );
  1112. X      old_rot = rotation;
  1113. #ifdef  OLD_DEBUG
  1114. X      bw_message( "[pr:] spj_point() recalculated rotation" );
  1115. X      kb_rx();
  1116. #endif
  1117. X      }
  1118. X
  1119. X   /* Rotate the image */
  1120. X
  1121. X   x_temp = *x;
  1122. X   y_temp = *y;
  1123. X   *x = 0.0 - (( x_temp * x_rcos ) - ( y_temp * x_rsin ));
  1124. X   *y = ( x_temp * x_rsin ) + ( y_temp * x_rcos );
  1125. X
  1126. #ifdef  OLD_DEBUG
  1127. X   sprintf( bw_ebuf, "[pr:] spj_point() returns: x %0.2lf, y %0.2lf, side %d      >>",
  1128. X      *x, *y, *side );
  1129. X   bw_message( bw_ebuf );
  1130. X   kb_rx();
  1131. #endif
  1132. X
  1133. X   }
  1134. X
  1135. /***************************************************************
  1136. X
  1137. X    spj_meridian()  Calculate the distance in degrees
  1138. X            between a point's longitude and the
  1139. X            viewer's longitude
  1140. X
  1141. ***************************************************************/
  1142. X
  1143. double
  1144. spj_meridian( vlon, plon )
  1145. X   double vlon;       /* viewer's longitude */
  1146. X   double plon;       /* point longitude */
  1147. X   {
  1148. X   double retval;
  1149. X
  1150. X   retval = vlon - plon;
  1151. X   if ( retval < -180 )
  1152. X      {
  1153. X      retval += 360;
  1154. X      }
  1155. X   if ( retval > 180 )
  1156. X      {
  1157. X      retval -= 360;
  1158. X      }
  1159. X   return retval;
  1160. X   }
  1161. X
  1162. /***************************************************************
  1163. X
  1164. X   spj_angrad()    Calculate the angular radius of an object
  1165. X     given the radius of the object and the
  1166. X     distance to the viewer
  1167. X
  1168. ***************************************************************/
  1169. X
  1170. double
  1171. spj_angrad( distance, radius )
  1172. X   double distance, radius;
  1173. X   {
  1174. X
  1175. #ifdef  DEBUG
  1176. X   if ( distance == 0.0 )
  1177. X      {
  1178. X      sprintf( bw_ebuf, "[pr:] spj_angrad() received distance = %lf",
  1179. X     distance );
  1180. X      bw_error( bw_ebuf );
  1181. X      return 1.0;
  1182. X      }
  1183. #endif
  1184. X
  1185. X   return ( RAD_DEG * atan( radius / distance ));
  1186. X   }
  1187. X
  1188. /***************************************************************
  1189. X
  1190. X   spj_degfix()    Fix degrees, i.e., 0 < d < 360
  1191. X
  1192. ***************************************************************/
  1193. X
  1194. double
  1195. spj_degfix( n )
  1196. X   double n;
  1197. X   {
  1198. X   double retval;
  1199. X
  1200. X   retval = n;
  1201. X   while ( retval < 0 )
  1202. X      {
  1203. X      retval += 360;
  1204. X      }
  1205. X   while ( retval > 360 )
  1206. X      {
  1207. X      retval -= 360;
  1208. X      }
  1209. X
  1210. #ifdef  OLD_DEBUG
  1211. X   sprintf( bw_ebuf, "spj_degfix(): rec %.2lf, ret %.2lf", n, retval );
  1212. X   bw_debug( bw_ebuf );
  1213. #endif
  1214. X
  1215. X   return retval;
  1216. X   }
  1217. X
  1218. /***************************************************************
  1219. X
  1220. X    as_fgets()      Gets a string from a bitstream,
  1221. X            excluding strings that begin with ';'
  1222. X
  1223. X    This function acts exactly as the standard Unix/C
  1224. X    fgets() function, except that it rejects lines that
  1225. X    begin with a semicolon.  This alllows us to imbed
  1226. X    comment lines in as datafiles by beginning them with
  1227. X    a semicolon.
  1228. X
  1229. ***************************************************************/
  1230. X
  1231. char *
  1232. as_fgets( s, n, stream )
  1233. X   char *s;
  1234. X   int n;
  1235. X   FILE *stream;
  1236. X   {
  1237. X   char *r;
  1238. X
  1239. X   r = (char *) 1;
  1240. X   s[ 0 ] = ';';
  1241. X   while( s[ 0 ] == ';' )
  1242. X      {
  1243. X      r = fgets( s, n, stream );
  1244. X      if ( r == NULL )
  1245. X     {
  1246. X     return NULL;
  1247. X     }
  1248. X      }
  1249. X   return r;
  1250. X   }
  1251. X
  1252. SHAR_EOF
  1253. chmod 0644 sfs/as/as_spj.c ||
  1254. echo 'restore of sfs/as/as_spj.c failed'
  1255. Wc_c="`wc -c < 'sfs/as/as_spj.c'`"
  1256. test 14480 -eq "$Wc_c" ||
  1257.     echo 'sfs/as/as_spj.c: original size 14480, current size' "$Wc_c"
  1258. rm -f _shar_wnt_.tmp
  1259. fi
  1260. # ============= sfs/as/as_test.c ==============
  1261. if test -f 'sfs/as/as_test.c' -a X"$1" != X"-c"; then
  1262.     echo 'x - skipping sfs/as/as_test.c (File already exists)'
  1263.     rm -f _shar_wnt_.tmp
  1264. else
  1265. > _shar_wnt_.tmp
  1266. echo 'x - extracting sfs/as/as_test.c (Text)'
  1267. sed 's/^X//' << 'SHAR_EOF' > 'sfs/as/as_test.c' &&
  1268. /****************************************************************
  1269. X
  1270. X    as_test.c       test astronomical (as) subsystem
  1271. X
  1272. X            Copyright (c) 1991, Ted A. Campbell
  1273. X
  1274. X            Bywater Software
  1275. X            P. O. Box 4023 
  1276. X            Duke Station 
  1277. X            Durham, NC  27706
  1278. X
  1279. X            email: tcamp@hercules.acpub.duke.edu
  1280. X
  1281. X    Copyright and Permissions Information:
  1282. X
  1283. X    All U.S. and international copyrights are claimed by the
  1284. X    author. The author grants permission to use this code
  1285. X    and software based on it under the following conditions:
  1286. X    (a) in general, the code and software based upon it may be 
  1287. X    used by individuals and by non-profit organizations; (b) it
  1288. X    may also be utilized by governmental agencies in any country,
  1289. X    with the exception of military agencies; (c) the code and/or
  1290. X    software based upon it may not be sold for a profit without
  1291. X    an explicit and specific permission from the author, except
  1292. X    that a minimal fee may be charged for media on which it is
  1293. X    copied, and for copying and handling; (d) the code must be 
  1294. X    distributed in the form in which it has been released by the
  1295. X    author; and (e) the code and software based upon it may not 
  1296. X    be used for illegal activities. 
  1297. X
  1298. ****************************************************************/
  1299. X
  1300. #include "stdio.h"
  1301. X
  1302. #include "math.h"
  1303. #include "time.h"
  1304. #include "bw.h"
  1305. #include "as.h"
  1306. X
  1307. #ifndef  __STDC__
  1308. #define time_t long
  1309. #endif
  1310. X
  1311. struct as_focus test_focus;
  1312. struct as_orbit test_orbit;
  1313. X
  1314. char bw_ebuf[ BW_EBUFSIZE ];
  1315. X
  1316. /***************************************************************
  1317. X
  1318. X   main()      Main function for stand-alone TEST
  1319. X
  1320. ***************************************************************/
  1321. X
  1322. main()
  1323. X   {
  1324. X   static char c;
  1325. X   int keep_on;
  1326. X
  1327. X   keep_on = 1;
  1328. X   while( keep_on == 1 )
  1329. X      {
  1330. X
  1331. X      vpt_init();
  1332. X      vpt_level = 1;
  1333. X
  1334. X      ast_rollup();
  1335. X      printf( "Test \"as\" (Astronomical) Functions: \n" );
  1336. X      printf( "----------------------------------  \n" );
  1337. X      printf( "\n" );
  1338. X      printf( "     f - Test Focal Datafile (fd) Read Function \n" );
  1339. X      printf( "     o - Test Orbital Functions   \n" );
  1340. X      printf( "     r - Test Angular Radius Function \n" );
  1341. X      printf( "     s - Test Spherical Projection \n" );
  1342. X      printf( "\n" );
  1343. X      printf( "     x - Exit                     \n" );
  1344. X      printf( "\n" );
  1345. X      printf( "     Select:  " );
  1346. X      c = getchar();
  1347. X      fflush( stdin );
  1348. X
  1349. X      switch( c )
  1350. X     {
  1351. X     case 'F':
  1352. X     case 'f':
  1353. X        ast_readfd();
  1354. X        break;
  1355. X     case 'O':
  1356. X     case 'o':
  1357. X        ast_orbital();
  1358. X        break;
  1359. X         case 'R':
  1360. X         case 'r':
  1361. X            ast_angrad();
  1362. X            break;
  1363. X     case 'S':
  1364. X     case 's':
  1365. X        ast_spj();
  1366. X        break;
  1367. X     case 'X':
  1368. X     case 'x':
  1369. X        ast_rollup();
  1370. X        keep_on = 0;
  1371. X        break;
  1372. X     default:
  1373. X        break;
  1374. X     }
  1375. X      }
  1376. X   }
  1377. X
  1378. ast_rollup()
  1379. X   {
  1380. X   register int c;
  1381. X
  1382. X   for ( c = 0; c < 25; ++c )
  1383. X    {
  1384. X    printf( "\n" );
  1385. X    }
  1386. X   }
  1387. X
  1388. /***************************************************************
  1389. X
  1390. X   ast_orbital()      test orbital functions
  1391. X
  1392. ***************************************************************/
  1393. X
  1394. ast_orbital()
  1395. X   {
  1396. X   static long t, r, n;
  1397. X   static double lat, lon, ap, aa;
  1398. X
  1399. X   test_orbit.focus = &test_focus;
  1400. X
  1401. X   ast_rollup();
  1402. X   printf( "Test Orbital Functions \n" );
  1403. X   printf( "---------------------- \n\n" );
  1404. X
  1405. X   printf( "Radius of the focus (km):               " );
  1406. X   scanf( "%lf", &test_orbit.focus->radius );
  1407. X
  1408. X   printf( "Sidereal period of the focus:           " );
  1409. X   scanf( "%lf", &test_orbit.focus->sid_day );
  1410. X
  1411. X   printf( "Mass of the focus (grams):              " );
  1412. X   scanf( "%lf", &test_orbit.focus->mass );
  1413. X
  1414. X   printf( "Altitude of perigee (km):               " );
  1415. X   scanf( "%lf", &ap );
  1416. X
  1417. X   printf( "Altitude of apogee (km):                " );
  1418. X   scanf( "%lf", &aa );
  1419. X
  1420. X   printf( "Inclination (degrees):                  " );
  1421. X   scanf( "%lf", &test_orbit.inclination );
  1422. X
  1423. X   printf( "Longitude of ascending node (degrees):  " );
  1424. X   scanf( "%lf", &test_orbit.lon_an );
  1425. X
  1426. X   printf( "Argument of the perigee (degrees):      " );
  1427. X   scanf( "%lf", &test_orbit.arg_per );
  1428. X
  1429. X   fflush( stdin );
  1430. X
  1431. X   or_init( &test_orbit, ap, aa );
  1432. X
  1433. X   printf( "\n" );
  1434. X   printf( "Focus:               Radius         = %lf\n", test_orbit.focus->radius );
  1435. X   printf( "                     Sidereal Day   = %lf\n", test_orbit.focus->sid_day );
  1436. X   printf( "                     Mass           = %lf\n", test_orbit.focus->mass );
  1437. X   printf( "Orbital Parameters:  Semimajor axis = %lf\n", test_orbit.semimajor );
  1438. X   printf( "                     Semiminor axis = %lf\n", test_orbit.semiminor );
  1439. X   printf( "                     Period (T)     = %lf\n", test_orbit.period );
  1440. X   printf( "                     Eccentricity   = %lf\n", test_orbit.eccentricity );
  1441. X   printf( "                     Lon. As. Node  = %lf\n", test_orbit.lon_an );
  1442. X   printf( "                     Inclination    = %lf\n", test_orbit.inclination  );
  1443. X   printf( "                     Arg. Perigee   = %lf\n", test_orbit.arg_per );
  1444. X   printf( "                     Long. inc.     = %lf\n", test_orbit.lif );
  1445. X   printf( "\n" );
  1446. X   ast_wait();
  1447. X
  1448. X   for ( t = 0; t < ( test_orbit.period * 3); t += ( test_orbit.period / 12 ))
  1449. X      {
  1450. X      or_ssp( &test_orbit, t, &lat, &lon, &r, &n );
  1451. X      printf( "Orbit %ld, time %ld: \t\nDistance:  %ld km \tlat: %lf deg \tlon: %lf deg\n", 
  1452. X     n, t, (long) (r - test_orbit.focus->radius ), lat,
  1453. X     lon );
  1454. X      }
  1455. X   }
  1456. X
  1457. /***************************************************************
  1458. X
  1459. X   ast_angrad()      test angular radius function
  1460. X
  1461. ***************************************************************/
  1462. X
  1463. ast_angrad()
  1464. X   {
  1465. X   static double distance, radius;
  1466. X   double ang_rad;
  1467. X
  1468. X   ast_rollup();
  1469. X   printf( "Test Angular Radius Function \n" );
  1470. X   printf( "-------------------------- \n\n" );
  1471. X
  1472. X   printf( "Radius of the focus (km):           " );
  1473. X   scanf( "%lf", &radius );
  1474. X
  1475. X   printf( "Distance to the focus (km):         " );
  1476. X   scanf( "%lf", &distance );
  1477. X
  1478. X   ang_rad = spj_angrad( distance, radius );
  1479. X   printf( "\nThe angular radius is %0.9lf degrees. \n", ang_rad );
  1480. X   ast_wait();
  1481. X   
  1482. X   }
  1483. X
  1484. ast_wait()
  1485. X   {
  1486. X   printf( "\nPress any key: " );
  1487. X   getchar();
  1488. X   }
  1489. X
  1490. /***************************************************************
  1491. X
  1492. X   ast_spj()      test spherical projection
  1493. X
  1494. ***************************************************************/
  1495. X
  1496. ast_spj()
  1497. X   {
  1498. X   static double x, y, side;
  1499. X   static double radius, distance;
  1500. X   static double vlat, vlon;
  1501. X   static double plat, plon;
  1502. X
  1503. X   ast_rollup();
  1504. X   printf( "Test Spherical Projection Point Calculation Function \n" );
  1505. X   printf( "---------------------------------------------------- \n\n" );
  1506. X
  1507. X   printf( "Radius of the point (km):             " );
  1508. X   scanf( "%lf", &radius );
  1509. X   printf( "Latitude of the point:                " );
  1510. X   scanf( "%lf", &plat );
  1511. X   printf( "Longitude of the point:               " );
  1512. X   scanf( "%lf", &plon );
  1513. X   printf( "Distance from viewer (km):            " );
  1514. X   scanf( "%lf", &distance );
  1515. X   printf( "Latitude of viewer:                   " );
  1516. X   scanf( "%lf", &vlat );
  1517. X   printf( "Longitude of viewer:                  " );
  1518. X   scanf( "%lf", &vlon );
  1519. X
  1520. X   spj_point( plat, plon, radius, vlat, vlon, distance, 0.0,
  1521. X      SPJ_ALLSIDES, &x, &y, &side );
  1522. X   printf( "\n\nPoint is on the " );
  1523. X   if ( side == SPJ_NEARSIDE )
  1524. X      {
  1525. X      printf( "near " );
  1526. X      }
  1527. X   else
  1528. X      {
  1529. X      printf( "far " );
  1530. X      }
  1531. X   printf( "side of the sphere:\n" );
  1532. X   printf( "x axis: %lf degrees of arc (left or right)\n", x );
  1533. X   printf( "y axis: %lf degrees of arc (up or down)\n", y );
  1534. X   ast_wait();
  1535. X
  1536. X   }
  1537. X
  1538. /***************************************************************
  1539. X
  1540. X   ast_readfd()      test read focal data file function
  1541. X
  1542. ***************************************************************/
  1543. X
  1544. ast_readfd()
  1545. X   {
  1546. X   static char fdfile[ 128 ];
  1547. X
  1548. X   ast_rollup();
  1549. X   printf( "Test Focal Datafile Read Function \n" );
  1550. X   printf( "--------------------------------- \n\n" );
  1551. X
  1552. X   printf( "Enter name of a focal data file:    " );
  1553. X   gets( fdfile );
  1554. X   fflush( stdin );
  1555. X
  1556. X   if ( as_readfd( fdfile, &test_focus ) == BW_ERROR )
  1557. X      {
  1558. X      return;
  1559. X      }
  1560. X
  1561. X   printf( "\n\n" );
  1562. X   printf( "Name of orbital focus:             %s\n", test_focus.name );
  1563. X   printf( "Adjective for orbital focus:       %s\n", test_focus.adjective );
  1564. X   printf( "Radius of orbital focus:           %.0lf km\n", test_focus.radius );
  1565. X   printf( "Mass of orbital focus:             %.2le kg\n", test_focus.mass );
  1566. X   printf( "Sidereal period of orbital focus:  %.0lf seconds\n", test_focus.sid_day );
  1567. X
  1568. X   ast_wait();
  1569. X
  1570. X   }
  1571. X
  1572. bw_message( m )
  1573. X   char *m;
  1574. X   {
  1575. X   fprintf( stderr, "%s\n", m );
  1576. X   }
  1577. X
  1578. bw_error( m )
  1579. X   char *m;
  1580. X   {
  1581. X   fprintf( stderr, "ERROR: %s\n", m );
  1582. X   getchar();
  1583. X   fflush( stdin );
  1584. X   }
  1585. X
  1586. #ifdef  DEBUG
  1587. bw_debug( m )
  1588. X   char *m;
  1589. X   {
  1590. X   fprintf( stderr, "DEBUG: %s\n", m );
  1591. X   getchar();
  1592. X   fflush( stdin );
  1593. X   }
  1594. #endif
  1595. X
  1596. SHAR_EOF
  1597. chmod 0644 sfs/as/as_test.c ||
  1598. echo 'restore of sfs/as/as_test.c failed'
  1599. Wc_c="`wc -c < 'sfs/as/as_test.c'`"
  1600. test 8757 -eq "$Wc_c" ||
  1601.     echo 'sfs/as/as_test.c: original size 8757, current size' "$Wc_c"
  1602. rm -f _shar_wnt_.tmp
  1603. fi
  1604. # ============= sfs/as/as_test.mak ==============
  1605. if test -f 'sfs/as/as_test.mak' -a X"$1" != X"-c"; then
  1606.     echo 'x - skipping sfs/as/as_test.mak (File already exists)'
  1607.     rm -f _shar_wnt_.tmp
  1608. else
  1609. > _shar_wnt_.tmp
  1610. echo 'x - extracting sfs/as/as_test.mak (Text)'
  1611. sed 's/^X//' << 'SHAR_EOF' > 'sfs/as/as_test.mak' &&
  1612. PROJ    =AS_TEST
  1613. DEBUG    =0
  1614. CC    =qcl
  1615. CFLAGS_G    = /AL /W1 /Za /DDEBUG 
  1616. CFLAGS_D    = /Zd /Gi$(PROJ).mdt /Od 
  1617. CFLAGS_R    = /O /Ot /DNDEBUG 
  1618. CFLAGS    =$(CFLAGS_G) $(CFLAGS_R)
  1619. LFLAGS_G    =/NOI
  1620. LFLAGS_D    =/INCR /CO
  1621. LFLAGS_R    =
  1622. LFLAGS    =$(LFLAGS_G) $(LFLAGS_R)
  1623. RUNFLAGS    =
  1624. OBJS_EXT =     
  1625. LIBS_EXT =     
  1626. X
  1627. all:    $(PROJ).exe
  1628. X
  1629. as_test.obj:    as_test.c
  1630. X
  1631. as_orbit.obj:    as_orbit.c
  1632. X
  1633. as_vpt.obj:    as_vpt.c
  1634. X
  1635. as_spj.obj:    as_spj.c
  1636. X
  1637. as_focus.obj:    as_focus.c
  1638. X
  1639. $(PROJ).exe:    as_test.obj as_orbit.obj as_vpt.obj as_spj.obj as_focus.obj $(OBJS_EXT)
  1640. X    echo >NUL @<<$(PROJ).crf
  1641. as_test.obj +
  1642. as_orbit.obj +
  1643. as_vpt.obj +
  1644. as_spj.obj +
  1645. as_focus.obj +
  1646. $(OBJS_EXT)
  1647. $(PROJ).exe
  1648. X
  1649. $(LIBS_EXT);
  1650. <<
  1651. X    link $(LFLAGS) @$(PROJ).crf
  1652. X
  1653. run: $(PROJ).exe
  1654. X    $(PROJ) $(RUNFLAGS)
  1655. X
  1656. SHAR_EOF
  1657. chmod 0644 sfs/as/as_test.mak ||
  1658. echo 'restore of sfs/as/as_test.mak failed'
  1659. Wc_c="`wc -c < 'sfs/as/as_test.mak'`"
  1660. test 703 -eq "$Wc_c" ||
  1661.     echo 'sfs/as/as_test.mak: original size 703, current size' "$Wc_c"
  1662. rm -f _shar_wnt_.tmp
  1663. fi
  1664. # ============= sfs/as/as_vpt.c ==============
  1665. if test -f 'sfs/as/as_vpt.c' -a X"$1" != X"-c"; then
  1666.     echo 'x - skipping sfs/as/as_vpt.c (File already exists)'
  1667.     rm -f _shar_wnt_.tmp
  1668. else
  1669. > _shar_wnt_.tmp
  1670. echo 'x - extracting sfs/as/as_vpt.c (Text)'
  1671. sed 's/^X//' << 'SHAR_EOF' > 'sfs/as/as_vpt.c' &&
  1672. /****************************************************************
  1673. X
  1674. X    as_vpt.c        Variable precision trigonometry routines
  1675. X            for astronomy (as) subsystem
  1676. X
  1677. X            Copyright (c) 1991, Ted A. Campbell
  1678. X
  1679. X            Bywater Software
  1680. X            P. O. Box 4023 
  1681. X            Duke Station 
  1682. X            Durham, NC  27706
  1683. X
  1684. X            email: tcamp@hercules.acpub.duke.edu
  1685. X
  1686. X    Copyright and Permissions Information:
  1687. X
  1688. X    All U.S. and international copyrights are claimed by the
  1689. X    author. The author grants permission to use this code
  1690. X    and software based on it under the following conditions:
  1691. X    (a) in general, the code and software based upon it may be 
  1692. X    used by individuals and by non-profit organizations; (b) it
  1693. X    may also be utilized by governmental agencies in any country,
  1694. X    with the exception of military agencies; (c) the code and/or
  1695. X    software based upon it may not be sold for a profit without
  1696. X    an explicit and specific permission from the author, except
  1697. X    that a minimal fee may be charged for media on which it is
  1698. X    copied, and for copying and handling; (d) the code must be 
  1699. X    distributed in the form in which it has been released by the
  1700. X    author; and (e) the code and software based upon it may not 
  1701. X    be used for illegal activities. 
  1702. X
  1703. ****************************************************************/
  1704. X
  1705. #include "math.h"
  1706. #include "bw.h"
  1707. #include "as.h"
  1708. X
  1709. int     vpt_level;
  1710. X
  1711. double     sin_table[ 91 ];
  1712. X
  1713. vpt_init()
  1714. X    {    
  1715. X    int i;
  1716. X    for ( i = 0; i < 91; i++ )
  1717. X        {
  1718. X        sin_table[ i ] = sin( (double) DEG_RAD * i );
  1719. X        }
  1720. X    }
  1721. X
  1722. double 
  1723. vpt_sin( i )
  1724. X    double i;
  1725. X    {
  1726. X    int target, work;
  1727. X
  1728. X    switch( vpt_level )
  1729. X        {
  1730. X        case 1:
  1731. X            work = i;
  1732. X            work = (work >= 0) ? work % 360 : 359 - (-work % 360);
  1733. X            target = work % 90;
  1734. X            if (target != (work % 180) )
  1735. X                target = 90 - target;
  1736. X            return (work < 180) ?
  1737. X                    sin_table[ target ] :
  1738. X                    -sin_table[ target ] ;
  1739. X        default:
  1740. X            return sin( DEG_RAD * i );
  1741. X        }
  1742. X    }
  1743. X
  1744. double
  1745. vpt_cos( i )
  1746. X    double i;
  1747. X    {
  1748. X    int target, work;
  1749. X    switch( vpt_level )
  1750. X        {
  1751. X        case 1:
  1752. X            work = i;
  1753. X            work = (work >= 0) ? work % 360 : 359 - (-work % 360);
  1754. X            target = work % 90;
  1755. X            if (target == (work % 180) )
  1756. X                target = 90 - target;
  1757. X            return (90 <= work && work < 270) ? 
  1758. X                    -sin_table[ target ] :
  1759. X                    sin_table[ target ] ;
  1760. X        default: 
  1761. X            return cos( DEG_RAD * i );
  1762. X        }
  1763. X    }
  1764. X
  1765. double
  1766. vpt_tan( i )
  1767. X    double i;
  1768. X    {
  1769. X    double c;
  1770. X    switch( vpt_level )
  1771. X        {
  1772. X        case 1:
  1773. X            c = vpt_cos( i );
  1774. X            if ( c == 0 )
  1775. X                {
  1776. X                /* really?  shouldn't it be +/-infinity */
  1777. X                return 0;    /* or a signalled error? */
  1778. X                }
  1779. X            else
  1780. X                {
  1781. X                return vpt_sin( i ) / c ;
  1782. X                }
  1783. X        default: 
  1784. X            return tan( DEG_RAD * i );
  1785. X        }
  1786. X    }
  1787. X
  1788. X
  1789. SHAR_EOF
  1790. chmod 0644 sfs/as/as_vpt.c ||
  1791. echo 'restore of sfs/as/as_vpt.c failed'
  1792. Wc_c="`wc -c < 'sfs/as/as_vpt.c'`"
  1793. test 2526 -eq "$Wc_c" ||
  1794.     echo 'sfs/as/as_vpt.c: original size 2526, current size' "$Wc_c"
  1795. rm -f _shar_wnt_.tmp
  1796. fi
  1797. # ============= sfs/bin/callisto.fd ==============
  1798. if test ! -d 'sfs/bin'; then
  1799.     echo 'x - creating directory sfs/bin'
  1800.     mkdir 'sfs/bin'
  1801. fi
  1802. if test -f 'sfs/bin/callisto.fd' -a X"$1" != X"-c"; then
  1803.     echo 'x - skipping sfs/bin/callisto.fd (File already exists)'
  1804.     rm -f _shar_wnt_.tmp
  1805. else
  1806. > _shar_wnt_.tmp
  1807. echo 'x - extracting sfs/bin/callisto.fd (Text)'
  1808. sed 's/^X//' << 'SHAR_EOF' > 'sfs/bin/callisto.fd' &&
  1809. Callisto
  1810. Callistonian
  1811. 4800
  1812. 0.01779592
  1813. 60300
  1814. SHAR_EOF
  1815. chmod 0644 sfs/bin/callisto.fd ||
  1816. echo 'restore of sfs/bin/callisto.fd failed'
  1817. Wc_c="`wc -c < 'sfs/bin/callisto.fd'`"
  1818. test 44 -eq "$Wc_c" ||
  1819.     echo 'sfs/bin/callisto.fd: original size 44, current size' "$Wc_c"
  1820. rm -f _shar_wnt_.tmp
  1821. fi
  1822. # ============= sfs/bin/callisto.sfs ==============
  1823. if test -f 'sfs/bin/callisto.sfs' -a X"$1" != X"-c"; then
  1824.     echo 'x - skipping sfs/bin/callisto.sfs (File already exists)'
  1825.     rm -f _shar_wnt_.tmp
  1826. else
  1827. > _shar_wnt_.tmp
  1828. echo 'x - extracting sfs/bin/callisto.sfs (Text)'
  1829. sed 's/^X//' << 'SHAR_EOF' > 'sfs/bin/callisto.sfs' &&
  1830. ;---------------------------------------
  1831. ;    callisto.sfs 
  1832. ;    created Sat May 04 22:21:54 1991
  1833. ;---------------------------------------
  1834. Orbit around Callisto       
  1835. tfactor        1
  1836. update        20
  1837. trig        1
  1838. insertion    23000
  1839. ;---------------------------------------
  1840. ;    parameters for orbit 1
  1841. ;---------------------------------------
  1842. name        1    Callisto_Orbiter
  1843. focus        1    callisto.fd
  1844. periapsis    1    200.000000
  1845. apoapsis    1    4000.000000
  1846. inclination    1    30.000000
  1847. argper        1    90.000000
  1848. lonan        1    40.000000
  1849. orb        1    orb.spd
  1850. grid        1    latlon.spd
  1851. surface        1    callisto.spd
  1852. ;---------------------------------------
  1853. ;    end of file callisto.sfs 
  1854. ;---------------------------------------
  1855. SHAR_EOF
  1856. chmod 0644 sfs/bin/callisto.sfs ||
  1857. echo 'restore of sfs/bin/callisto.sfs failed'
  1858. Wc_c="`wc -c < 'sfs/bin/callisto.sfs'`"
  1859. test 638 -eq "$Wc_c" ||
  1860.     echo 'sfs/bin/callisto.sfs: original size 638, current size' "$Wc_c"
  1861. rm -f _shar_wnt_.tmp
  1862. fi
  1863. # ============= sfs/bin/callisto.spd ==============
  1864. if test -f 'sfs/bin/callisto.spd' -a X"$1" != X"-c"; then
  1865.     echo 'x - skipping sfs/bin/callisto.spd (File already exists)'
  1866.     rm -f _shar_wnt_.tmp
  1867. else
  1868. > _shar_wnt_.tmp
  1869. echo 'x - extracting sfs/bin/callisto.spd (Text)'
  1870. sed 's/^X//' << 'SHAR_EOF' > 'sfs/bin/callisto.spd' &&
  1871. ;    callisto.spd
  1872. ;
  1873. ;    map of callistonian surface features
  1874. ;
  1875. ;----------------------------------------------------------------
  1876. ;
  1877. ;    Valhalla
  1878. ;
  1879. 1001    13.333333    -48.258860    0.000000
  1880. 5    13.750000    -50.477658    0.000000
  1881. 5    14.166667    -52.141757    0.000000
  1882. 5    13.750000    -54.083205    0.000000
  1883. 5    12.500000    -55.469954    0.000000
  1884. 5    12.083333    -56.579353    0.000000
  1885. 5    11.250000    -58.520801    0.000000
  1886. 5    10.833333    -59.907550    0.000000
  1887. 5    10.000000    -61.294299    0.000000
  1888. 5    8.750000    -62.403698    0.000000
  1889. 5    6.250000    -62.681048    0.000000
  1890. 5    5.416667    -61.571649    0.000000
  1891. 5    4.583333    -60.462250    0.000000
  1892. 5    2.500000    -59.352851    0.000000
  1893. 5    0.833333    -57.688752    0.000000
  1894. 5    0.416667    -55.747304    0.000000
  1895. 5    -0.833333    -53.251156    0.000000
  1896. 5    -0.416667    -50.755008    0.000000
  1897. 5    0.833333    -49.368259    0.000000
  1898. 5    4.583333    -47.981510    0.000000
  1899. 5    5.000000    -45.208012    0.000000
  1900. 5    5.833333    -43.543914    0.000000
  1901. 5    9.166667    -43.821263    0.000000
  1902. 5    12.500000    -44.930663    0.000000
  1903. 5    13.333333    -48.258860    0.000000
  1904. 5    13.333333    -48.258860    0.000000
  1905. 1001    15.000000    -45.485362    0.000000
  1906. 5    17.500000    -47.981510    0.000000
  1907. 5    18.333333    -50.755008    0.000000
  1908. 5    18.333333    -54.637904    0.000000
  1909. 5    19.166667    -57.966102    0.000000
  1910. 5    17.500000    -61.294299    0.000000
  1911. 5    16.250000    -63.513097    0.000000
  1912. 5    15.416667    -64.622496    0.000000
  1913. 5    13.333333    -66.841294    0.000000
  1914. 5    11.666667    -69.060092    0.000000
  1915. 5    7.916667    -69.892142    0.000000
  1916. 5    6.250000    -69.060092    0.000000
  1917. 5    5.000000    -67.118644    0.000000
  1918. 5    2.916667    -66.563945    0.000000
  1919. 5    1.250000    -65.731895    0.000000
  1920. 5    0.000000    -63.790447    0.000000
  1921. 5    -1.250000    -62.126348    0.000000
  1922. 5    -2.083333    -60.462250    0.000000
  1923. 5    -3.750000    -57.966102    0.000000
  1924. 5    -3.750000    -54.915254    0.000000
  1925. 5    -2.500000    -50.477658    0.000000
  1926. 5    -1.250000    -48.813559    0.000000
  1927. 5    0.416667    -46.872111    0.000000
  1928. 5    1.666667    -43.821263    0.000000
  1929. 5    4.583333    -42.434515    0.000000
  1930. 5    7.916667    -41.047766    0.000000
  1931. 5    12.083333    -42.157165    0.000000
  1932. 5    14.583333    -45.208012    0.000000
  1933. 5    14.583333    -45.208012    0.000000
  1934. 1001    15.000000    -30.231125    0.000000
  1935. 5    20.000000    -34.946071    0.000000
  1936. 5    21.250000    -38.551618    0.000000
  1937. 5    23.333333    -42.711864    0.000000
  1938. 5    24.166667    -45.208012    0.000000
  1939. 5    24.583333    -48.536210    0.000000
  1940. 5    25.000000    -52.696456    0.000000
  1941. 5    25.833333    -56.579353    0.000000
  1942. 5    25.416667    -59.907550    0.000000
  1943. 5    25.416667    -62.681048    0.000000
  1944. 5    25.000000    -66.563945    0.000000
  1945. 5    22.500000    -70.724191    0.000000
  1946. 5    20.000000    -72.942989    0.000000
  1947. 5    18.333333    -73.497689    0.000000
  1948. 5    17.083333    -74.329738    0.000000
  1949. 5    15.000000    -75.439137    0.000000
  1950. 5    12.500000    -76.271186    0.000000
  1951. 5    9.583333    -76.271186    0.000000
  1952. 5    7.083333    -76.548536    0.000000
  1953. 5    4.166667    -76.825886    0.000000
  1954. 5    2.916667    -76.271186    0.000000
  1955. 5    0.833333    -75.716487    0.000000
  1956. 5    -0.833333    -74.884438    0.000000
  1957. 5    -3.333333    -72.388290    0.000000
  1958. 5    -5.416667    -69.892142    0.000000
  1959. 5    -7.916667    -66.841294    0.000000
  1960. 5    -11.250000    -64.067797    0.000000
  1961. 5    -13.333333    -61.571649    0.000000
  1962. 5    -14.583333    -57.966102    0.000000
  1963. 5    -15.000000    -53.528505    0.000000
  1964. 5    -12.500000    -48.258860    0.000000
  1965. 5    -11.250000    -45.208012    0.000000
  1966. 5    -8.750000    -42.434515    0.000000
  1967. 5    -5.000000    -39.383667    0.000000
  1968. 5    -0.416667    -36.055470    0.000000
  1969. 5    4.166667    -32.727273    0.000000
  1970. 5    9.166667    -30.785824    0.000000
  1971. 5    14.583333    -30.508475    0.000000
  1972. 5    14.583333    -30.508475    0.000000
  1973. 1001    15.000000    -28.012327    0.000000
  1974. 5    21.666667    -32.449923    0.000000
  1975. 5    23.750000    -37.164869    0.000000
  1976. 5    26.250000    -41.602465    0.000000
  1977. 5    27.916667    -45.208012    0.000000
  1978. 5    28.333333    -51.587057    0.000000
  1979. 5    29.166667    -55.192604    0.000000
  1980. 5    29.583333    -58.798151    0.000000
  1981. 5    29.166667    -62.126348    0.000000
  1982. 5    29.166667    -67.118644    0.000000
  1983. 5    28.333333    -70.446841    0.000000
  1984. 5    19.583333    -76.271186    0.000000
  1985. 5    16.250000    -78.489985    0.000000
  1986. 5    12.083333    -80.708783    0.000000
  1987. 5    4.583333    -80.431433    0.000000
  1988. 5    -3.750000    -79.599384    0.000000
  1989. 5    -9.583333    -75.439137    0.000000
  1990. 5    -15.000000    -68.228043    0.000000
  1991. 5    -17.916667    -62.681048    0.000000
  1992. 5    -18.333333    -57.411402    0.000000
  1993. 5    -17.916667    -51.864407    0.000000
  1994. 5    -13.750000    -44.375963    0.000000
  1995. 5    -10.416667    -39.661017    0.000000
  1996. 5    -5.833333    -36.055470    0.000000
  1997. 5    -1.666667    -33.836672    0.000000
  1998. 5    3.333333    -30.508475    0.000000
  1999. 5    15.416667    -28.844376    0.000000
  2000. 5    15.416667    -28.844376    0.000000
  2001. 1001    15.000000    -18.582435    0.000000
  2002. 5    19.583333    -21.078582    0.000000
  2003. 5    23.750000    -28.844376    0.000000
  2004. 5    27.500000    -35.778120    0.000000
  2005. 5    30.416667    -41.047766    0.000000
  2006. 5    32.500000    -44.653313    0.000000
  2007. 5    32.916667    -47.426810    0.000000
  2008. 5    33.333333    -49.645609    0.000000
  2009. 5    32.916667    -56.579353    0.000000
  2010. 5    32.083333    -60.462250    0.000000
  2011. 5    32.500000    -63.513097    0.000000
  2012. 5    29.166667    -72.665639    0.000000
  2013. 5    26.666667    -75.161787    0.000000
  2014. 5    22.083333    -79.322034    0.000000
  2015. 5    18.333333    -81.818182    0.000000
  2016. 5    15.833333    -84.036980    0.000000
  2017. 5    13.333333    -84.314330    0.000000
  2018. 5    7.500000    -84.314330    0.000000
  2019. 5    1.666667    -85.423729    0.000000
  2020. 5    -4.166667    -84.869029    0.000000
  2021. 5    -11.250000    -81.540832    0.000000
  2022. 5    -14.166667    -79.322034    0.000000
  2023. 5    -17.083333    -75.161787    0.000000
  2024. 5    -19.166667    -71.833590    0.000000
  2025. 5    -21.666667    -64.067797    0.000000
  2026. 5    -23.333333    -57.966102    0.000000
  2027. 5    -22.500000    -50.200308    0.000000
  2028. 5    -20.833333    -43.543914    0.000000
  2029. 5    -17.500000    -39.661017    0.000000
  2030. 5    -14.166667    -33.004622    0.000000
  2031. 5    -11.250000    -29.953775    0.000000
  2032. 5    -6.250000    -25.793529    0.000000
  2033. 5    -1.250000    -22.742681    0.000000
  2034. 5    4.583333    -19.969183    0.000000
  2035. 5    14.583333    -18.859784    0.000000
  2036. 5    14.583333    -18.859784    0.000000
  2037. ;----------------------------------------------------------------
  2038. ;
  2039. ;    Asgard
  2040. ;
  2041. 1001    30.416667    -135.069337    0.000000
  2042. 5    30.000000    -136.733436    0.000000
  2043. 5    27.500000    -141.448382    0.000000
  2044. 5    26.250000    -143.667180    0.000000
  2045. 5    23.333333    -145.608629    0.000000
  2046. 5    20.416667    -145.331279    0.000000
  2047. 5    18.750000    -143.667180    0.000000
  2048. 5    17.083333    -141.448382    0.000000
  2049. 5    15.833333    -140.338983    0.000000
  2050. 5    16.250000    -135.901387    0.000000
  2051. 5    16.250000    -133.405239    0.000000
  2052. 5    17.500000    -131.463790    0.000000
  2053. 5    19.583333    -129.522342    0.000000
  2054. 5    23.333333    -127.303544    0.000000
  2055. 5    25.833333    -128.135593    0.000000
  2056. 5    27.916667    -129.522342    0.000000
  2057. 5    28.750000    -131.741140    0.000000
  2058. SHAR_EOF
  2059. true || echo 'restore of sfs/bin/callisto.spd failed'
  2060. fi
  2061. echo 'End of  part 11'
  2062. echo 'File sfs/bin/callisto.spd is continued in part 12'
  2063. echo 12 > _shar_seq_.tmp
  2064. exit 0
  2065. exit 0 # Just in case...
  2066. -- 
  2067. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  2068. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  2069. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  2070. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  2071.