| 1 | #include "slalib.h" | 
|---|
| 2 | #include "slamac.h" | 
|---|
| 3 | void slaGeoc ( double p, double h, double *r, double *z ) | 
|---|
| 4 | /* | 
|---|
| 5 | **  - - - - - - - - | 
|---|
| 6 | **   s l a G e o c | 
|---|
| 7 | **  - - - - - - - - | 
|---|
| 8 | ** | 
|---|
| 9 | **  Convert geodetic position to geocentric. | 
|---|
| 10 | ** | 
|---|
| 11 | **  (double precision) | 
|---|
| 12 | ** | 
|---|
| 13 | **  Given: | 
|---|
| 14 | **     p     double     latitude (geodetic, radians) | 
|---|
| 15 | **     h     double     height above reference spheroid (geodetic, metres) | 
|---|
| 16 | ** | 
|---|
| 17 | **  Returned: | 
|---|
| 18 | **     *r    double     distance from Earth axis (AU) | 
|---|
| 19 | **     *z    double     distance from plane of Earth equator (AU) | 
|---|
| 20 | ** | 
|---|
| 21 | **  Notes: | 
|---|
| 22 | ** | 
|---|
| 23 | **     1)  Geocentric latitude can be obtained by evaluating atan2(z,r). | 
|---|
| 24 | ** | 
|---|
| 25 | **     2)  IAU 1976 constants are used. | 
|---|
| 26 | ** | 
|---|
| 27 | **  Reference: | 
|---|
| 28 | **     Green,R.M., Spherical Astronomy, CUP 1985, p98. | 
|---|
| 29 | ** | 
|---|
| 30 | **  Last revision:   25 July 1993 | 
|---|
| 31 | ** | 
|---|
| 32 | **  Copyright P.T.Wallace.  All rights reserved. | 
|---|
| 33 | */ | 
|---|
| 34 | { | 
|---|
| 35 | double sp, cp, c, s; | 
|---|
| 36 |  | 
|---|
| 37 | /* Earth equatorial radius (metres) */ | 
|---|
| 38 | static double a0 = 6378140.0; | 
|---|
| 39 |  | 
|---|
| 40 | /* Reference spheroid flattening factor and useful function thereof */ | 
|---|
| 41 | static double f = 1.0 / 298.257; | 
|---|
| 42 | double b = ( 1.0 - f ) * ( 1.0 - f ); | 
|---|
| 43 |  | 
|---|
| 44 | /* Astronomical unit in metres */ | 
|---|
| 45 | static double au = 1.49597870e11; | 
|---|
| 46 |  | 
|---|
| 47 | /* Geodetic to geocentric conversion */ | 
|---|
| 48 | sp = sin ( p ); | 
|---|
| 49 | cp = cos ( p ); | 
|---|
| 50 | c = 1.0 / sqrt ( cp * cp + b * sp * sp ); | 
|---|
| 51 | s = b * c; | 
|---|
| 52 | *r = ( a0 * c + h ) * cp / au; | 
|---|
| 53 | *z = ( a0 * s + h ) * sp / au; | 
|---|
| 54 | } | 
|---|