QGIS API Documentation  2.12.0-Lyon
gmath.h
Go to the documentation of this file.
1 /*
2 * Copyright Tim ([email protected])
3 *
4 * NMEA library is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>
16 */
17 /*
18  *
19  * NMEA library
20  * URL: http://nmea.sourceforge.net
21  * Author: Tim ([email protected])
22  * Licence: http://www.gnu.org/licenses/lgpl.html
23  * $Id: gmath.h 17 2008-03-11 11:56:11Z xtimor $
24  *
25  */
26 
27 #ifndef __NMEA_GMATH_H__
28 #define __NMEA_GMATH_H__
29 
30 #include "info.h"
31 
32 #define NMEA_PI (3.141592653589793)
33 #define NMEA_PI180 (NMEA_PI / 180)
34 #define NMEA_EARTHRADIUS_KM (6378)
35 #define NMEA_EARTHRADIUS_M (NMEA_EARTHRADIUS_KM * 1000)
36 #define NMEA_EARTH_SEMIMAJORAXIS_M (6378137.0)
37 #define NMEA_EARTH_SEMIMAJORAXIS_KM (NMEA_EARTHMAJORAXIS_KM / 1000)
38 #define NMEA_EARTH_FLATTENING (1 / 298.257223563)
39 #define NMEA_DOP_FACTOR (5)
41 #ifdef __cplusplus
42 extern "C"
43 {
44 #endif
45 
46  /*
47  * degree VS radian
48  */
49 
50  double nmea_degree2radian( double val );
51  double nmea_radian2degree( double val );
52 
53  /*
54  * NDEG (NMEA degree)
55  */
56 
57  double nmea_ndeg2degree( double val );
58  double nmea_degree2ndeg( double val );
59 
60  double nmea_ndeg2radian( double val );
61  double nmea_radian2ndeg( double val );
62 
63  /*
64  * DOP
65  */
66 
67  double nmea_calc_pdop( double hdop, double vdop );
68  double nmea_dop2meters( double dop );
69  double nmea_meters2dop( double meters );
70 
71  /*
72  * positions work
73  */
74 
75  void nmea_info2pos( const nmeaINFO *info, nmeaPOS *pos );
76  void nmea_pos2info( const nmeaPOS *pos, nmeaINFO *info );
77 
78  double nmea_distance(
79  const nmeaPOS *from_pos,
80  const nmeaPOS *to_pos
81  );
82 
84  const nmeaPOS *from_pos,
85  const nmeaPOS *to_pos,
86  double *from_azimuth,
87  double *to_azimuth
88  );
89 
90  int nmea_move_horz(
91  const nmeaPOS *start_pos,
92  nmeaPOS *end_pos,
93  double azimuth,
94  double distance
95  );
96 
98  const nmeaPOS *start_pos,
99  nmeaPOS *end_pos,
100  double azimuth,
101  double distance,
102  double *end_azimuth
103  );
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif /* __NMEA_GMATH_H__ */
double nmea_ndeg2degree(double val)
double nmea_degree2ndeg(double val)
double nmea_radian2degree(double val)
double nmea_distance_ellipsoid(const nmeaPOS *from_pos, const nmeaPOS *to_pos, double *from_azimuth, double *to_azimuth)
double nmea_dop2meters(double dop)
double nmea_degree2radian(double val)
double nmea_distance(const nmeaPOS *from_pos, const nmeaPOS *to_pos)
double nmea_ndeg2radian(double val)
int nmea_move_horz(const nmeaPOS *start_pos, nmeaPOS *end_pos, double azimuth, double distance)
double nmea_radian2ndeg(double val)
Summary GPS information from all parsed packets, used also for generating NMEA stream.
Definition: info.h:99
int nmea_move_horz_ellipsoid(const nmeaPOS *start_pos, nmeaPOS *end_pos, double azimuth, double distance, double *end_azimuth)
Position data in fractional degrees or radians.
Definition: info.h:58
double nmea_meters2dop(double meters)
double nmea_calc_pdop(double hdop, double vdop)
void nmea_pos2info(const nmeaPOS *pos, nmeaINFO *info)
void nmea_info2pos(const nmeaINFO *info, nmeaPOS *pos)