1 /**********************************************************
2  * Version $Id: geocent.h 911 2011-02-14 16:38:15Z reklov_w $
3  *********************************************************/
4 #ifndef GEOCENT_H
5   #define GEOCENT_H
6 
7 /***************************************************************************/
8 /* RSC IDENTIFIER:  GEOCENTRIC
9  *
10  * ABSTRACT
11  *
12  *    This component provides conversions between Geodetic coordinates (latitude,
13  *    longitude in radians and height in meters) and Geocentric coordinates
14  *    (X, Y, Z) in meters.
15  *
16  * ERROR HANDLING
17  *
18  *    This component checks parameters for valid values.  If an invalid value
19  *    is found, the error code is combined with the current error code using
20  *    the bitwise or.  This combining allows multiple error codes to be
21  *    returned. The possible error codes are:
22  *
23  *      GEOCENT_NO_ERROR        : No errors occurred in function
24  *      GEOCENT_LAT_ERROR       : Latitude out of valid range
25  *                                 (-90 to 90 degrees)
26  *      GEOCENT_LON_ERROR       : Longitude out of valid range
27  *                                 (-180 to 360 degrees)
28  *      GEOCENT_A_ERROR         : Semi-major axis less than or equal to zero
29  *      GEOCENT_INV_F_ERROR     : Inverse flattening outside of valid range
30  *								                 (250 to 350)
31  *
32  *
33  * REUSE NOTES
34  *
35  *    GEOCENTRIC is intended for reuse by any application that performs
36  *    coordinate conversions between geodetic coordinates and geocentric
37  *    coordinates.
38  *
39  *
40  * REFERENCES
41  *
42  *    An Improved Algorithm for Geocentric to Geodetic Coordinate Conversion,
43  *    Ralph Toms, February 1996  UCRL-JC-123138.
44  *
45  *    Further information on GEOCENTRIC can be found in the Reuse Manual.
46  *
47  *    GEOCENTRIC originated from : U.S. Army Topographic Engineering Center
48  *                                 Geospatial Information Division
49  *                                 7701 Telegraph Road
50  *                                 Alexandria, VA  22310-3864
51  *
52  * LICENSES
53  *
54  *    None apply to this component.
55  *
56  * RESTRICTIONS
57  *
58  *    GEOCENTRIC has no restrictions.
59  *
60  * ENVIRONMENT
61  *
62  *    GEOCENTRIC was tested and certified in the following environments:
63  *
64  *    1. Solaris 2.5 with GCC version 2.8.1
65  *    2. Windows 95 with MS Visual C++ version 6
66  *
67  * MODIFICATIONS
68  *
69  *    Date              Description
70  *    ----              -----------
71  *
72  *
73  */
74 
75 
76 /***************************************************************************/
77 /*
78  *                              DEFINES
79  */
80   #define GEOCENT_NO_ERROR        0x0000
81   #define GEOCENT_LAT_ERROR       0x0001
82   #define GEOCENT_LON_ERROR       0x0002
83   #define GEOCENT_A_ERROR         0x0004
84   #define GEOCENT_INV_F_ERROR     0x0008
85 
86 
87 /***************************************************************************/
88 /*
89  *                              FUNCTION PROTOTYPES
90  */
91 
92 /* ensure proper linkage to c++ programs */
93   #ifdef __cplusplus
94 extern "C" {
95   #endif
96 
97 
98   long Set_Geocentric_Parameters (double a,
99                                   double f);
100 /*
101  * The function Set_Geocentric_Parameters receives the ellipsoid parameters
102  * as inputs and sets the corresponding state variables.
103  *
104  *    a  : Semi-major axis of ellipsoid, in meters.          (input)
105  *    f  : Flattening of ellipsoid.						               (input)
106  */
107 
108 
109   void Get_Geocentric_Parameters (double *a,
110                                   double *f);
111 /*
112  * The function Get_Geocentric_Parameters returns the ellipsoid parameters
113  * to be used in geocentric coordinate conversions.
114  *
115  *    a  : Semi-major axis of ellipsoid, in meters.          (output)
116  *    f  : Flattening of ellipsoid.						               (output)
117  */
118 
119 
120   long Convert_Geodetic_To_Geocentric (double Latitude,
121                                        double Longitude,
122                                        double Height,
123                                        double *X,
124                                        double *Y,
125                                        double *Z);
126 /*
127  * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates
128  * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),
129  * according to the current ellipsoid parameters.
130  *
131  *    Latitude  : Geodetic latitude in radians                     (input)
132  *    Longitude : Geodetic longitude in radians                    (input)
133  *    Height    : Geodetic height, in meters                       (input)
134  *    X         : Calculated Geocentric X coordinate, in meters.   (output)
135  *    Y         : Calculated Geocentric Y coordinate, in meters.   (output)
136  *    Z         : Calculated Geocentric Z coordinate, in meters.   (output)
137  *
138  */
139 
140 
141   void Convert_Geocentric_To_Geodetic (double X,
142                                        double Y,
143                                        double Z,
144                                        double *Latitude,
145                                        double *Longitude,
146                                        double *Height);
147 /*
148  * The function Convert_Geocentric_To_Geodetic converts geocentric
149  * coordinates (X, Y, Z) to geodetic coordinates (latitude, longitude,
150  * and height), according to the current ellipsoid parameters.
151  *
152  *    X         : Geocentric X coordinate, in meters.         (input)
153  *    Y         : Geocentric Y coordinate, in meters.         (input)
154  *    Z         : Geocentric Z coordinate, in meters.         (input)
155  *    Latitude  : Calculated latitude value in radians.       (output)
156  *    Longitude : Calculated longitude value in radians.      (output)
157  *    Height    : Calculated height value, in meters.         (output)
158  */
159 
160 
161   #ifdef __cplusplus
162 }
163   #endif
164 
165 #endif /* GEOCENT_H */
166