geodesy.h

Go to the documentation of this file.
00001 /**
00002 \file    geodesy.h
00003 \brief   GNSS core 'c' function library: geodesy related functions.
00004 \author  Glenn D. MacGougan (GDM)
00005 \date    2007-11-28
00006 \since   2005-07-30
00007 
00008 \b REFERENCES \n
00009 - NovAtel OEM3 reference manual (www.novatel.com). \n
00010 - Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy. 
00011   Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering, 
00012   University of Calgary. \n
00013 - Hsu, David Y. (1992). Closed Form Solution for Geodetic Coordinate 
00014   Transformation. ION NTM 1992. pp. 397-400. \n
00015 - Misra, Pratap & Per Enge (2004). Global Positioning System Signals 
00016   Measurements and Performance. Ganga-Jamuna Press. 
00017   ISBN 0-9709544-0-9. PP. 115-116. \n
00018 
00019 \b "LICENSE INFORMATION" \n
00020 Copyright (c) 2007, refer to 'author' doxygen tags \n
00021 All rights reserved. \n
00022 
00023 Redistribution and use in source and binary forms, with or without
00024 modification, are permitted provided the following conditions are met: \n
00025 
00026 - Redistributions of source code must retain the above copyright
00027   notice, this list of conditions and the following disclaimer. \n
00028 - Redistributions in binary form must reproduce the above copyright
00029   notice, this list of conditions and the following disclaimer in the
00030   documentation and/or other materials provided with the distribution. \n
00031 - The name(s) of the contributor(s) may not be used to endorse or promote 
00032   products derived from this software without specific prior written 
00033   permission. \n
00034 
00035 THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS 
00036 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
00037 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00038 DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
00039 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00040 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
00041 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
00042 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
00043 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
00044 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
00045 SUCH DAMAGE.
00046 */
00047 
00048 #ifndef _C_GEODESY_H_
00049 #define _C_GEODESY_H_
00050 
00051 #ifdef __cplusplus
00052 extern "C" {
00053 #endif
00054 
00055 #include "basictypes.h"
00056 
00057 
00058 /*************************************************************************************************/
00059 // preprocessor constant definitions, any related enumerations and descriptors
00060 
00061 /**
00062 \enum   GEODESY_enumReferenceEllipse
00063 \brief  Enumerated for various reference ellipsoids
00064 
00065 Comma delimited data (copy data below to a text file and rename the extension to .csv for easy 
00066 viewing in an excel spreadsheet for example. \n
00067 GEODESY_REFERENCE_ELLIPSE_AIRY,                         6377563.396, 299.3249647,   6356256.9092444032, 0.00667053999776051,\n  
00068 GEODESY_REFERENCE_ELLIPSE_MODIFED_AIRY,                 6377340.189, 299.3249647,   6356034.4479456525, 0.00667053999776060,\n  
00069 GEODESY_REFERENCE_ELLIPSE_AUSTRALIAN_NATIONAL,          6378160.0,   298.25,        6356774.7191953063, 0.00669454185458760,\n  
00070 GEODESY_REFERENCE_ELLIPSE_BESSEL_1841,                  6377397.155, 299.1528128,   6356078.9628181886, 0.00667437223180205,\n  
00071 GEODESY_REFERENCE_ELLIPSE_CLARKE_1866,                  6378206.4,   294.9786982,   6356583.7999989809, 0.00676865799760959,\n  
00072 GEODESY_REFERENCE_ELLIPSE_CLARKE_1880,                  6378249.145, 293.465,       6356514.8695497755, 0.00680351128284912,\n  
00073 GEODESY_REFERENCE_ELLIPSE_EVEREST_INDIA_1830,           6377276.345, 300.8017,      6356075.4131402392, 0.00663784663019987,\n  
00074 GEODESY_REFERENCE_ELLIPSE_EVEREST_BRUNEI_E_MALAYSIA,    6377298.556, 300.8017,      6356097.5503008962, 0.00663784663019965,\n  
00075 GEODESY_REFERENCE_ELLIPSE_EVEREST_W_MALAYSIA_SINGAPORE, 6377304.063, 300.8017,      6356103.0389931547, 0.00663784663019970,\n  
00076 GEODESY_REFERENCE_ELLIPSE_GRS_1980,                     6378137.0,   298.257222101, 6356752.3141403561, 0.00669438002290069,\n  
00077 GEODESY_REFERENCE_ELLIPSE_HELMERT_1906,                 6378200.0,   298.30,        6356818.1696278909, 0.00669342162296610,\n  
00078 GEODESY_REFERENCE_ELLIPSE_HOUGH_1960,                   6378270.0,   297.00,        6356794.3434343431, 0.00672267002233347,\n  
00079 GEODESY_REFERENCE_ELLIPSE_INTERNATIONAL_1924,           6378388.0,   297.00,        6356911.9461279465, 0.00672267002233323,\n  
00080 GEODESY_REFERENCE_ELLIPSE_SOUTH_AMERICAN_1969,          6378160.0,   298.25,        6356774.7191953063, 0.00669454185458760,\n  
00081 GEODESY_REFERENCE_ELLIPSE_WGS72,                        6378135.0,   298.26,        6356750.5200160937, 0.00669431777826668,\n  
00082 GEODESY_REFERENCE_ELLIPSE_WGS84,                        6378137.0,   298.257223563, 6356752.3142451793, 0.00669437999014132,\n  
00083 */
00084 typedef enum 
00085 {
00086   GEODESY_REFERENCE_ELLIPSE_WGS84 = 0,                         //!< WGS84
00087   GEODESY_REFERENCE_ELLIPSE_AIRY_1830=1,                       //!< Airy 1830
00088   GEODESY_REFERENCE_ELLIPSE_MODIFED_AIRY=2,                    //!< Modified Airy                         
00089   GEODESY_REFERENCE_ELLIPSE_AUSTRALIAN_NATIONAL=3,             //!< Australian National
00090   GEODESY_REFERENCE_ELLIPSE_BESSEL_1841=4,                     //!< Bessel 1841
00091   GEODESY_REFERENCE_ELLIPSE_CLARKE_1866=5,                     //!< Clarke 1866
00092   GEODESY_REFERENCE_ELLIPSE_CLARKE_1880=6,                     //!< Clarke 1880
00093   GEODESY_REFERENCE_ELLIPSE_EVEREST_INDIA_1830=7,              //!< Everest(India 1830)
00094   GEODESY_REFERENCE_ELLIPSE_EVEREST_BRUNEI_E_MALAYSIA=8,       //!< Everest(Brunei & E.Malaysia)
00095   GEODESY_REFERENCE_ELLIPSE_EVEREST_W_MALAYSIA_SINGAPORE=9,    //!< Everest(W.Malaysia & Singapore)
00096   GEODESY_REFERENCE_ELLIPSE_GRS_1980=10,                       //!< Geodetic Reference System 1980
00097   GEODESY_REFERENCE_ELLIPSE_HELMERT_1906=11,                   //!< Helmert 1906
00098   GEODESY_REFERENCE_ELLIPSE_HOUGH_1960=12,                     //!< Hough 1960
00099   GEODESY_REFERENCE_ELLIPSE_INTERNATIONAL_1924=13,             //!< International 1924
00100   GEODESY_REFERENCE_ELLIPSE_SOUTH_AMERICAN_1969=14,            //!< South American 1969
00101   GEODESY_REFERENCE_ELLIPSE_WGS72=15                           //!< World Geodetic System 1972
00102 
00103 } GEODESY_enumReferenceEllipse;
00104 
00105 /**
00106 \var    GEODESY_REFERENCE_ELLIPSE_STRING_DESCRIPTION
00107 \brief  string array with text description corresponding to GEODESY_enumReferenceEllipse
00108 \see    GEODESY_enumReferenceEllipse
00109 */
00110 static char *GEODESY_REFERENCE_ELLIPSE_STRING_DESCRIPTION[64] =
00111 {
00112   "World Geodetic System 1984",
00113   "Airy 1830",
00114   "Modified Airy",
00115   "Australian National",
00116   "Bessel 1841",
00117   "Clarke 1866",
00118   "Clarke 1880",
00119   "Everest(India 1830)",
00120   "Everest(Brunei & E.Malaysia)",
00121   "Everest(W.Malaysia & Singapore)",
00122   "Geodetic Reference System 1980",
00123   "Helmert 1906",
00124   "Hough 1960",
00125   "International 1924",
00126   "South American 1969",
00127   "World Geodetic System 1972",  
00128 };
00129 
00130 
00131 #define GEODESY_REFERENCE_ELLIPSE_WGS84_A                                (6378137.0)
00132 #define GEODESY_REFERENCE_ELLIPSE_WGS84_F_INV                            (298.257223563)       
00133 #define GEODESY_REFERENCE_ELLIPSE_WGS84_B                                (6356752.31424518)
00134 #define GEODESY_REFERENCE_ELLIPSE_WGS84_E2                               (0.00669437999014132)
00135 
00136 #define GEODESY_REFERENCE_ELLIPSE_AIRY_1830_A                            (6377563.396)
00137 #define GEODESY_REFERENCE_ELLIPSE_AIRY_1830_F_INV                        (299.3249647)
00138 #define GEODESY_REFERENCE_ELLIPSE_AIRY_1830_B                            (6356256.9092444)
00139 #define GEODESY_REFERENCE_ELLIPSE_AIRY_1830_E2                           (0.00667053999776051)
00140 
00141 #define GEODESY_REFERENCE_ELLIPSE_MODIFED_AIRY_A                         (6377340.189)
00142 #define GEODESY_REFERENCE_ELLIPSE_MODIFED_AIRY_F_INV                     (299.3249647)       
00143 #define GEODESY_REFERENCE_ELLIPSE_MODIFED_AIRY_B                         (356034.44794565)
00144 #define GEODESY_REFERENCE_ELLIPSE_MODIFED_AIRY_E2                        (0.0066705399977606)
00145 
00146 #define GEODESY_REFERENCE_ELLIPSE_AUSTRALIAN_NATIONAL_A                  (6378160.0)
00147 #define GEODESY_REFERENCE_ELLIPSE_AUSTRALIAN_NATIONAL_F_INV              (298.25)      
00148 #define GEODESY_REFERENCE_ELLIPSE_AUSTRALIAN_NATIONAL_B                  (6356774.7191953063)      
00149 #define GEODESY_REFERENCE_ELLIPSE_AUSTRALIAN_NATIONAL_E2                 (0.0066945418545876)      
00150 
00151 #define GEODESY_REFERENCE_ELLIPSE_BESSEL_1841_A                          (6377397.155)
00152 #define GEODESY_REFERENCE_ELLIPSE_BESSEL_1841_F_INV                      (299.1528128)      
00153 #define GEODESY_REFERENCE_ELLIPSE_BESSEL_1841_B                          (6356078.9628181886)
00154 #define GEODESY_REFERENCE_ELLIPSE_BESSEL_1841_E2                         (0.00667437223180205)
00155 
00156 #define GEODESY_REFERENCE_ELLIPSE_CLARKE_1866_A                          (6378206.4)
00157 #define GEODESY_REFERENCE_ELLIPSE_CLARKE_1866_F_INV                      (294.9786982)            
00158 #define GEODESY_REFERENCE_ELLIPSE_CLARKE_1866_B                          (6356583.7999989809)
00159 #define GEODESY_REFERENCE_ELLIPSE_CLARKE_1866_E2                         (0.00676865799760959)
00160 
00161 #define GEODESY_REFERENCE_ELLIPSE_CLARKE_1880_A                          (6378249.145)
00162 #define GEODESY_REFERENCE_ELLIPSE_CLARKE_1880_F_INV                      (293.465)      
00163 #define GEODESY_REFERENCE_ELLIPSE_CLARKE_1880_B                          (6356514.8695497755)
00164 #define GEODESY_REFERENCE_ELLIPSE_CLARKE_1880_E2                         (0.00680351128284912)
00165 
00166 #define GEODESY_REFERENCE_ELLIPSE_EVEREST_INDIA_1830_A                   (6377276.345)
00167 #define GEODESY_REFERENCE_ELLIPSE_EVEREST_INDIA_1830_F_INV               (300.8017)      
00168 #define GEODESY_REFERENCE_ELLIPSE_EVEREST_INDIA_1830_B                   (6356075.4131402392)
00169 #define GEODESY_REFERENCE_ELLIPSE_EVEREST_INDIA_1830_E2                  (0.00663784663019987)
00170 
00171 #define GEODESY_REFERENCE_ELLIPSE_EVEREST_BRUNEI_E_MALAYSIA_A            (6377298.556)
00172 #define GEODESY_REFERENCE_ELLIPSE_EVEREST_BRUNEI_E_MALAYSIA_F_INV        (300.8017)      
00173 #define GEODESY_REFERENCE_ELLIPSE_EVEREST_BRUNEI_E_MALAYSIA_B            (6356097.5503008962)
00174 #define GEODESY_REFERENCE_ELLIPSE_EVEREST_BRUNEI_E_MALAYSIA_E2           (0.00663784663019965)
00175 
00176 #define GEODESY_REFERENCE_ELLIPSE_EVEREST_W_MALAYSIA_SINGAPORE_A         (6377304.063)
00177 #define GEODESY_REFERENCE_ELLIPSE_EVEREST_W_MALAYSIA_SINGAPORE_F_INV     (300.8017)      
00178 #define GEODESY_REFERENCE_ELLIPSE_EVEREST_W_MALAYSIA_SINGAPORE_B         (6356103.0389931547)
00179 #define GEODESY_REFERENCE_ELLIPSE_EVEREST_W_MALAYSIA_SINGAPORE_E2        (0.00663784663019970)
00180 
00181 #define GEODESY_REFERENCE_ELLIPSE_GRS_1980_A                             (6378137.0)
00182 #define GEODESY_REFERENCE_ELLIPSE_GRS_1980_F_INV                         (298.257222101)              
00183 #define GEODESY_REFERENCE_ELLIPSE_GRS_1980_B                             (6356752.3141403561)
00184 #define GEODESY_REFERENCE_ELLIPSE_GRS_1980_E2                            (0.00669438002290069)
00185 
00186 #define GEODESY_REFERENCE_ELLIPSE_HELMERT_1906_A                         (6378200.0)
00187 #define GEODESY_REFERENCE_ELLIPSE_HELMERT_1906_F_INV                     (298.30)       
00188 #define GEODESY_REFERENCE_ELLIPSE_HELMERT_1906_B                         (6356818.1696278909)
00189 #define GEODESY_REFERENCE_ELLIPSE_HELMERT_1906_E2                        (0.00669342162296610)
00190 
00191 #define GEODESY_REFERENCE_ELLIPSE_HOUGH_1960_A                           (6378270.0)
00192 #define GEODESY_REFERENCE_ELLIPSE_HOUGH_1960_F_INV                       (297.00)      
00193 #define GEODESY_REFERENCE_ELLIPSE_HOUGH_1960_B                           (6356794.3434343431)
00194 #define GEODESY_REFERENCE_ELLIPSE_HOUGH_1960_E2                          (0.00672267002233347)
00195 
00196 #define GEODESY_REFERENCE_ELLIPSE_INTERNATIONAL_1924_A                   (6378388.0)
00197 #define GEODESY_REFERENCE_ELLIPSE_INTERNATIONAL_1924_F_INV               (297.00)            
00198 #define GEODESY_REFERENCE_ELLIPSE_INTERNATIONAL_1924_B                   (6356911.9461279465)
00199 #define GEODESY_REFERENCE_ELLIPSE_INTERNATIONAL_1924_E2                  (0.00672267002233323)
00200 
00201 #define GEODESY_REFERENCE_ELLIPSE_SOUTH_AMERICAN_1969_A                  (6378160.0)
00202 #define GEODESY_REFERENCE_ELLIPSE_SOUTH_AMERICAN_1969_F_INV              (298.25)      
00203 #define GEODESY_REFERENCE_ELLIPSE_SOUTH_AMERICAN_1969_B                  (6356774.7191953063)
00204 #define GEODESY_REFERENCE_ELLIPSE_SOUTH_AMERICAN_1969_E2                 (0.00669454185458760)
00205 
00206 #define GEODESY_REFERENCE_ELLIPSE_WGS72_A                                (6378135.0)
00207 #define GEODESY_REFERENCE_ELLIPSE_WGS72_F_INV                            (298.26)      
00208 #define GEODESY_REFERENCE_ELLIPSE_WGS72_B                                (6356750.5200160937)
00209 #define GEODESY_REFERENCE_ELLIPSE_WGS72_E2                               (0.00669431777826668)
00210 
00211 /*************************************************************************************************/
00212 
00213 
00214 
00215 /** 
00216 \brief    This is a look up table function to get reference ellipse parameters.
00217 \author   Glenn D. MacGougan (GDM)
00218 \date     2005-07-30
00219 \since    2005-07-30
00220 \return   TRUE(1) if successful, FALSE(0) otherwise.
00221 
00222 \b Example \n
00223 \code
00224   double a;      //!< semi-major axis of the reference ellipse                     [m]
00225   double b;      //!< semi-minor axis of the reference ellipse (b = a - a*f_inv)   [m] 
00226   double f_inv;  //!< inverse of the flattening of the reference ellipse           []
00227   double e2;     //!< eccentricity of the reference ellipse (e2 = (a*a-b*b)/(a*a)) [] 
00228   BOOL result;
00229   result = GEODESY_GetReferenceEllipseParameters( GEODESY_REFERENCE_ELLIPSE_WGS84_A, &a, &b, &f_inv, &e2 );
00230   if( result == TRUE )
00231   {
00232     printf( "ellipse = %s\n", GEODESY_REFERENCE_ELLIPSE_STRING_DESCRIPTION[GEODESY_REFERENCE_ELLIPSE_WGS84_A] );
00233     printf( "a       = %20.3f\n", a );
00234     printf( "b       = %20.9f\n", b );
00235     printf( "f_inv   = %20.11f\n", f_inv );
00236     printf( "e2      = %.15f\n\n", e2 );
00237   }
00238 \endcode 
00239 
00240 \b REFERENCES \n
00241 - NovAtel OEM3 reference manual (www.novatel.com).
00242 */
00243 BOOL GEODESY_GetReferenceEllipseParameters( 
00244   const GEODESY_enumReferenceEllipse ellipse, //!< reference ellipse enumerated    []
00245   double* a,      //!< semi-major axis of the reference ellipse                     [m]
00246   double* b,      //!< semi-minor axis of the reference ellipse (b = a - a*f_inv)   [m] 
00247   double* f_inv,  //!< inverse of the flattening of the reference ellipse           []
00248   double* e2      //!< eccentricity of the reference ellipse (e2 = (a*a-b*b)/(a*a)) [] 
00249   );
00250 
00251 
00252 
00253 /**
00254 \brief    This function converts curvilinear geodetic coordinates from latitude, longitude, 
00255 and ellipsoidal height to cartesian geodetic coordinates x, y, and z for the 
00256 reference ellipse specified. 
00257 (e.g. GEODESY_REFERENCE_ELLIPSE_WGS84).
00258 
00259 \author   Glenn D. MacGougan (GDM)
00260 \date     2005-07-30
00261 \since    2005-07-30
00262 \return   TRUE(1) if successful, FALSE(0) otherwise.
00263 
00264 \b Example \n
00265 \code
00266   double latitude=0;   //!< geodetic latitude                [rad]
00267   double longitude=0;  //!< geodetic longitude               [rad]
00268   double height=0;     //!< geodetic height                  [m]
00269   double x;            //!< earth fixed cartesian coordinate [m]
00270   double y;            //!< earth fixed cartesian coordinate [m]
00271   double z;            //!< earth fixed cartesian coordinate [m]
00272 
00273   result = GEODESY_ConvertGeodeticCurvilinearToEarthFixedCartesianCoordinates(
00274     GEODESY_REFERENCE_ELLIPSE_WGS84_A,
00275     latitude, 
00276     longitude,
00277     height,   
00278     &x,       
00279     &y,       
00280     &z        
00281     );
00282   printf( "ellipse   = %s\n", GEODESY_REFERENCE_ELLIPSE_STRING_DESCRIPTION[GEODESY_REFERENCE_ELLIPSE_WGS84_A] );
00283   printf( "latitude  = %.12lf\n", latitude );
00284   printf( "longitude = %.12lf\n", longitude );
00285   printf( "height    = %.4lf\n", height );
00286   printf( "x         = %.4lf\n", x );
00287   printf( "y         = %.4lf\n", y );
00288   printf( "z         = %.4lf\n\n", z );
00289 \endcode
00290 
00291 \b REFERENCES \n
00292 - Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy. 
00293   Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering, 
00294   University of Calgary.\n
00295 */
00296 BOOL GEODESY_ConvertGeodeticCurvilinearToEarthFixedCartesianCoordinates(
00297   const GEODESY_enumReferenceEllipse  referenceEllipse,  //!< reference ellipse enumerated []
00298   const double latitude,   //!< geodetic latitude                [rad]
00299   const double longitude,  //!< geodetic longitude               [rad]
00300   const double height,     //!< geodetic height                  [m]
00301   double *x,               //!< earth fixed cartesian coordinate [m]
00302   double *y,               //!< earth fixed cartesian coordinate [m]
00303   double *z                //!< earth fixed cartesian coordinate [m]
00304   );
00305 
00306 /**
00307 \brief    This function converts cartesian geodetic coordinates from x, y, and z to 
00308 curvilinear geodetic coordinates latitude, longitude, and ellipsoidal 
00309 height for the reference ellipse specified. An iterative approach is used.
00310 (e.g. GEODESY_REFERENCE_ELLIPSE_WGS84).
00311 
00312 \author   Glenn D. MacGougan (GDM)
00313 \date     2005-07-30
00314 \since    2005-07-30
00315 \return   TRUE(1) if successful, FALSE(0) otherwise.
00316 
00317 \remarks
00318 (1) Hsu (1992) shows that the iterative form is slightly faster than the closed form for 3 iterations. \n
00319 (2) Testing by GDM for WGS84, all points lat = -90:1:90 and lon = -180:1:180 were tested
00320    lat, lon, hgt first converted to x, y, z then converted back to lat ,lon, hgt and the number of
00321    iterations noted. No errors observed. 2-5 iterations are needed with a mean of 4.32 iterations. \n
00322 
00323 \b REFERENCES \n
00324 - Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy. 
00325   Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering, 
00326   University of Calgary. \n
00327   Iterative Method - Chapter 3, pp. 33-66.
00328   Closed Form      - Appendix B, pp. 178-183. \n
00329 - Hsu, David Y. (1992). Closed Form Solution for Geodetic Coordinate 
00330   Transformation. ION NTM 1992. pp. 397-400. \n
00331 - Misra, Pratap & Per Enge (2004). Global Positioning System Signals 
00332   Measurements and Performance. Ganga-Jamuna Press. 
00333   ISBN 0-9709544-0-9. PP. 115-116. \n
00334 */
00335 BOOL GEODESY_ConvertEarthFixedCartesianToGeodeticCurvilinearCoordinates(
00336   const GEODESY_enumReferenceEllipse  referenceEllipse,  //!< reference ellipse enumerated []
00337   const double x,              // earth fixed cartesian coordinate [m]
00338   const double y,              // earth fixed cartesian coordinate [m]
00339   const double z,              // earth fixed cartesian coordinate [m]  
00340   double *latitude,            // geodetic latitude                [rad]
00341   double *longitude,           // geodetic longitude               [rad]
00342   double *height               // geodetic height                  [m]
00343   );
00344 
00345 
00346 /**
00347 \brief    Given a reference point (datum) for a local geodetic coordinate system
00348 compute northing easting and vertical of another point given its latitude,
00349 longitude, and height for the reference ellipse specified.
00350 (e.g. GEODESY_REFERENCE_ELLIPSE_WGS84).
00351 
00352 \author   Glenn D. MacGougan (GDM)
00353 \date     2005-07-30
00354 \since    2005-07-30
00355 \return   TRUE(1) if successful, FALSE(0) otherwise.
00356 
00357 \b REFERENCES \n
00358 [1] Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy. 
00359    Chapter 4, pp 79. \n
00360 */
00361 BOOL GEODESY_ComputeNorthingEastingVertical(
00362   const GEODESY_enumReferenceEllipse  referenceEllipse,  //!< reference ellipse enumerated []
00363   const double referenceLatitude,  //!< datum geodetic latitude  [rad]
00364   const double referenceLongitude, //!< datum geodetic longitude [rad]
00365   const double referenceHeight,    //!< datum geodetic height    [m]
00366   const double latitude,           //!< geodetic latitude        [rad]
00367   const double longitude,          //!< geodetic longitude       [rad]
00368   const double height,             //!< geodetic height          [m]
00369   double *northing,                //!< local geodetic northing  [m]
00370   double *easting,                 //!< local geodetic easting   [m]
00371   double *vertical                 //!< local geodetic vertical  [m]
00372   );
00373 
00374 
00375 
00376 /**
00377 \brief  Compute the difference between two points in a local geodetic frame
00378 using one point as the reference. Can be used to compute position error 
00379 with respect to a known reference but keep in mind a local geodetic 
00380 frame is used.
00381  
00382 \author   Glenn D. MacGougan (GDM)
00383 \date     2005-07-30
00384 \since    2005-07-30
00385 \return   TRUE(1) if successful, FALSE(0) otherwise.
00386 
00387 \b REFERENCES \n
00388 \see GEODESY_ComputeNorthingEastingVertical
00389 */
00390 BOOL GEODESY_ComputePositionDifference(
00391   const GEODESY_enumReferenceEllipse  referenceEllipse,  //!< reference ellipse enumerated []
00392   const double referenceLatitude,  //!< reference point geodetic latitude  [rad]
00393   const double referenceLongitude, //!< reference point geodetic longitude [rad]
00394   const double referenceHeight,    //!< reference point geodetic height    [m]
00395   const double latitude,           //!< geodetic latitude        [rad]
00396   const double longitude,          //!< geodetic longitude       [rad]
00397   const double height,             //!< geodetic height          [m]
00398   double *difference_northing,     //!< difference in northing   [m]  (+2 m, means 2 m North of the reference)
00399   double *difference_easting,      //!< difference in easting    [m]  (+2 m, means 2 m East  of the reference)
00400   double *difference_vertical      //!< difference in vertical   [m]  (+2 m, means 2 m above of the reference)
00401   );
00402  
00403 
00404 
00405 
00406 /**
00407 \brief  Computes meridian radius of curvature for the reference ellipse specified.
00408 (e.g. GEODESY_REFERENCE_ELLIPSE_WGS84).
00409 
00410 \author   Glenn D. MacGougan (GDM)
00411 \date     2005-07-30
00412 \since    2005-07-30
00413 \return   TRUE(1) if successful, FALSE(0) otherwise.
00414 
00415 \b REFERENCES \n
00416 - Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy. 
00417   Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering, 
00418   University of Calgary. \n
00419 */
00420 BOOL GEODESY_ComputeMeridianRadiusOfCurvature(
00421   const GEODESY_enumReferenceEllipse  referenceEllipse, //!< reference ellipse enumerated []
00422   const double latitude,  //!< geodetic latitude                     [rad]
00423   double*  M              //!< computed meridian radius of curvature [m]
00424   );
00425 
00426 /**
00427 \brief  Computes the prime vertical radius of curvature for the reference ellipse specified.
00428 (e.g. GEODESY_REFERENCE_ELLIPSE_WGS84).
00429 
00430 \author   Glenn D. MacGougan (GDM)
00431 \date     2005-07-30
00432 \since    2005-07-30
00433 \return   TRUE(1) if successful, FALSE(0) otherwise.
00434 
00435 \b REFERENCES \n
00436 - Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy. 
00437   Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering, 
00438   University of Calgary. \n
00439 */
00440 BOOL GEODESY_ComputePrimeVerticalRadiusOfCurvature(
00441   const GEODESY_enumReferenceEllipse  referenceEllipse, //!< reference ellipse enumerated []
00442   const double latitude,  //!< geodetic latitude                           [rad]
00443   double*  N              //!< computed prime vertical radius of curvature [m]
00444   );
00445 
00446 
00447 /**
00448 \brief  Compute the meridian arc between two latitudes for the reference ellipse specified.
00449 (e.g. GEODESY_REFERENCE_ELLIPSE_WGS84).
00450  
00451 \author   Glenn D. MacGougan (GDM)
00452 \date     2005-07-30
00453 \since    2005-07-30
00454 \return   TRUE(1) if successful, FALSE(0) otherwise.
00455 
00456 \b REFERENCES \n
00457 - Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy. 
00458   Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering, 
00459   University of Calgary. \n
00460 */
00461 BOOL GEODESY_ComputeMeridianArcBetweenTwoLatitudes(
00462   const GEODESY_enumReferenceEllipse  referenceEllipse, //!< reference ellipse enumerated []
00463   const double referenceLatitude,  //!< datum geodetic latitude  [rad]
00464   const double latitude,           //!< geodetic latitude        [rad]
00465   double*      arc                 //!< computed meridian arc, North +ve, South -ve [m]
00466   );
00467 
00468 
00469 /**
00470 \brief  Compute the parallel arc between two longitudes for the reference ellipse specified.
00471 (e.g. GEODESY_REFERENCE_ELLIPSE_WGS84).
00472  
00473 \author   Glenn D. MacGougan (GDM)
00474 \date     2005-07-30
00475 \since    2005-07-30
00476 \return   TRUE(1) if successful, FALSE(0) otherwise.
00477 
00478 \b REFERENCES \n
00479 - Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy. 
00480   Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering, 
00481   University of Calgary. \n
00482 */ 
00483 BOOL GEODESY_ComputeParallelArcBetweenTwoLongitudes(
00484   const GEODESY_enumReferenceEllipse  referenceEllipse, //!< reference ellipse enumerated []
00485   const double referenceLatitude,  //!< reference geodetic latitude  [rad]
00486   const double referenceLongitude, //!< reference geodetic longitude [rad]
00487   const double longitude,          //!< geodetic longitude           [rad]
00488   double*      arc                 //!< computed parallel arc, East +ve, West -ve [m]
00489   );
00490 
00491 /**
00492 \brief  Rotates a vector from a Local Geodetic Frame (LG) to and Earth Centered Earth Fixed Frame (ECEF).
00493  
00494 \author   Glenn D. MacGougan (GDM)
00495 \date     2005-07-30
00496 \since    2005-07-30
00497 \return   TRUE(1) if successful, FALSE(0) otherwise.
00498 
00499 \b REFERENCES \n
00500 - Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy. 
00501   Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering, 
00502   University of Calgary. \n
00503 */ 
00504 BOOL GEODESY_RotateVectorFromLocalGeodeticFrameToEarthFixedFrame(
00505   const double referenceLatitude,  //!< reference geodetic latitude                 [rad]
00506   const double referenceLongitude, //!< reference geodetic longitude                [rad]
00507   const double dN,                 //!< local geodetic northing vector component    [m]
00508   const double dE,                 //!< local geodetic easting  vector component    [m]
00509   const double dUp,                //!< local geodetic vertical vector component    [m]
00510   double* dX,                      //!< earth centered earth fixed vector component [m]
00511   double* dY,                      //!< earth centered earth fixed vector component [m]
00512   double* dZ                       //!< earth centered earth fixed vector component [m]
00513   );
00514 
00515 /**
00516 \brief  Rotates a vector from a Earth Centered Earth Fixed Frame (ECEF) to a Local Geodetic Frame (LG).
00517  
00518 \author   Glenn D. MacGougan (GDM)
00519 \date     2005-07-30
00520 \since    2005-07-30
00521 \return   TRUE(1) if successful, FALSE(0) otherwise.
00522 
00523 \b REFERENCES \n
00524 - Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy. 
00525   Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering, 
00526   University of Calgary. \n
00527 */ 
00528 BOOL GEODESY_RotateVectorFromEarthFixedFrameToLocalGeodeticFrame(
00529   const double referenceLatitude,  //!< reference geodetic latitude                 [rad]
00530   const double referenceLongitude, //!< reference geodetic longitude                [rad]
00531   const double dX,                 //!< earth centered earth fixed vector component [m]
00532   const double dY,                 //!< earth centered earth fixed vector component [m]
00533   const double dZ,                 //!< earth centered earth fixed vector component [m]
00534   double* dN,                      //!< local geodetic northing vector component    [m]
00535   double* dE,                      //!< local geodetic easting  vector component    [m]
00536   double* dUp                      //!< local geodetic vertical vector component    [m]
00537   );
00538 
00539 /**
00540 \brief  Computes the azimuth and elevation angles in the local geodetic (LG) frame between the 'from' 
00541 point to the 'to' point given these point in the earth fixed frame. 
00542 e.g. between a user gps location (from) and a satellite (to).
00543  
00544 \author   Glenn D. MacGougan (GDM)
00545 \date     2005-07-30
00546 \since    2005-07-30 
00547 \return   TRUE(1) if successful, FALSE(0) otherwise.
00548  */
00549 BOOL GEODESY_ComputeAzimuthAndElevationAnglesBetweenToPointsInTheEarthFixedFrame(
00550   const GEODESY_enumReferenceEllipse  referenceEllipse, //!< reference ellipse enumerated []
00551   const double fromX, //!< earth centered earth fixed vector from point X component [m]
00552   const double fromY, //!< earth centered earth fixed vector from point Y component [m]
00553   const double fromZ, //!< earth centered earth fixed vector from point Z component [m]
00554   const double toX,   //!< earth centered earth fixed vector to point X component   [m]
00555   const double toY,   //!< earth centered earth fixed vector to point Y component   [m]
00556   const double toZ,   //!< earth centered earth fixed vector to point Z component   [m]
00557   double* elevation,  //!< elevation angle [rad]
00558   double* azimuth     //!< azimuth angle   [rad]
00559   );
00560   
00561 #ifdef __cplusplus
00562 }
00563 #endif
00564 
00565 
00566 #endif // _C_GEODESY_H_