home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_09_05 / 9n05102a < prev    next >
Text File  |  1991-03-26  |  1KB  |  44 lines

  1.  
  2. // Defines for all functions in this article.
  3.  
  4. #define PI     3.141592654
  5. #define TWOPI (2*PI)
  6. #define RTD   (180/PI)
  7. #define DTR   (PI/180)
  8.  
  9. // All code was written in MSC 5.1 under PC-DOS.
  10.  
  11. // Units used: km for position, km/s for vel
  12. //             angle (i,lan,w,M,E,nu) units: deg   
  13. // Value of earth mu used: 398600.8 km**3/s**2
  14.  
  15. //  FUNCTION k2ce()
  16. //  This routine converts classical Keplerian elements to
  17. //    Cartesian position and velocity.
  18. //  Input : k[6] -- a, e, i, lan, w, m     
  19. //          mu   -- mu of central body    ;
  20. //  Output: c[6] -- x, y, z, xdot, ydot, zdot  
  21.  
  22.   k2c (double *k, double mu, double *c)
  23.   
  24.  
  25.   SAMPLE INPUT/OUTPUT
  26. A   7378.14  E  0.10  I  30.00     X  6640.32 Y  0.00  Z  0.00
  27. LAN    0.00  W  0.00  M   0.00     XD    0.00 YD 7.03  ZD 4.06
  28.  
  29.  
  30. //  FUNCTION c2ke()
  31. //  This routine converts Cartesian position and velocity
  32. //    to classical Keplerian elements, for elliptical
  33. //    orbits.
  34.  
  35. //  Input : c[6] -- pos/vel; 
  36. //          mu   -- mu of central body
  37. //  Output: k[6] -- a,e,i,lan,w,m
  38. //          ** i,lan,w,M are output in degrees **        
  39.  
  40.  
  41.                            SAMPLE INPUT/OUTPUT
  42. Outputs from k2ce() were input; the output reproduced
  43. the k2ce() input.
  44.