|
Quantum GIS API Documentation
master-ce49b66
|
00001 /* 00002 * Copyright Tim (xtimor@gmail.com) 00003 * 00004 * NMEA library is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU Lesser General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/> 00016 */ 00017 /* 00018 * 00019 * NMEA library 00020 * URL: http://nmea.sourceforge.net 00021 * Author: Tim (xtimor@gmail.com) 00022 * Licence: http://www.gnu.org/licenses/lgpl.html 00023 * $Id: gmath.h 17 2008-03-11 11:56:11Z xtimor $ 00024 * 00025 */ 00026 00027 #ifndef __NMEA_GMATH_H__ 00028 #define __NMEA_GMATH_H__ 00029 00030 #include "info.h" 00031 00032 #define NMEA_PI (3.141592653589793) 00033 #define NMEA_PI180 (NMEA_PI / 180) 00034 #define NMEA_EARTHRADIUS_KM (6378) 00035 #define NMEA_EARTHRADIUS_M (NMEA_EARTHRADIUS_KM * 1000) 00036 #define NMEA_EARTH_SEMIMAJORAXIS_M (6378137.0) 00037 #define NMEA_EARTH_SEMIMAJORAXIS_KM (NMEA_EARTHMAJORAXIS_KM / 1000) 00038 #define NMEA_EARTH_FLATTENING (1 / 298.257223563) 00039 #define NMEA_DOP_FACTOR (5) 00041 #ifdef __cplusplus 00042 extern "C" 00043 { 00044 #endif 00045 00046 /* 00047 * degree VS radian 00048 */ 00049 00050 double nmea_degree2radian( double val ); 00051 double nmea_radian2degree( double val ); 00052 00053 /* 00054 * NDEG (NMEA degree) 00055 */ 00056 00057 double nmea_ndeg2degree( double val ); 00058 double nmea_degree2ndeg( double val ); 00059 00060 double nmea_ndeg2radian( double val ); 00061 double nmea_radian2ndeg( double val ); 00062 00063 /* 00064 * DOP 00065 */ 00066 00067 double nmea_calc_pdop( double hdop, double vdop ); 00068 double nmea_dop2meters( double dop ); 00069 double nmea_meters2dop( double meters ); 00070 00071 /* 00072 * positions work 00073 */ 00074 00075 void nmea_info2pos( const nmeaINFO *info, nmeaPOS *pos ); 00076 void nmea_pos2info( const nmeaPOS *pos, nmeaINFO *info ); 00077 00078 double nmea_distance( 00079 const nmeaPOS *from_pos, 00080 const nmeaPOS *to_pos 00081 ); 00082 00083 double nmea_distance_ellipsoid( 00084 const nmeaPOS *from_pos, 00085 const nmeaPOS *to_pos, 00086 double *from_azimuth, 00087 double *to_azimuth 00088 ); 00089 00090 int nmea_move_horz( 00091 const nmeaPOS *start_pos, 00092 nmeaPOS *end_pos, 00093 double azimuth, 00094 double distance 00095 ); 00096 00097 int nmea_move_horz_ellipsoid( 00098 const nmeaPOS *start_pos, 00099 nmeaPOS *end_pos, 00100 double azimuth, 00101 double distance, 00102 double *end_azimuth 00103 ); 00104 00105 #ifdef __cplusplus 00106 } 00107 #endif 00108 00109 #endif /* __NMEA_GMATH_H__ */