Guido Ottaviani / Mbed 2 deprecated LeonardoMbos

Dependencies:   mbos Watchdog TextLCD mbed ConfigFile

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers gmath.h Source File

gmath.h

Go to the documentation of this file.
00001 /*
00002  *
00003  * NMEA library
00004  * URL: http://nmea.sourceforge.net
00005  * Author: Tim (xtimor@gmail.com)
00006  * Licence: http://www.gnu.org/licenses/lgpl.html
00007  * $Id: gmath.h 17 2008-03-11 11:56:11Z xtimor $
00008  *
00009  */
00010 
00011 #ifndef __NMEA_GMATH_H__
00012 #define __NMEA_GMATH_H__
00013 
00014 #include "info.h "
00015 
00016 #define NMEA_PI                     (3.141592653589793)             /**< PI value */
00017 #define NMEA_PI180                  (NMEA_PI / 180)                 /**< PI division by 180 */
00018 #define NMEA_EARTHRADIUS_KM         (6378)                          /**< Earth's mean radius in km */
00019 #define NMEA_EARTHRADIUS_M          (NMEA_EARTHRADIUS_KM * 1000)    /**< Earth's mean radius in m */
00020 #define NMEA_EARTH_SEMIMAJORAXIS_M  (6378137.0)                     /**< Earth's semi-major axis in m according WGS84 */
00021 #define NMEA_EARTH_SEMIMAJORAXIS_KM (NMEA_EARTHMAJORAXIS_KM / 1000) /**< Earth's semi-major axis in km according WGS 84 */
00022 #define NMEA_EARTH_FLATTENING       (1 / 298.257223563)             /**< Earth's flattening according WGS 84 */
00023 #define NMEA_DOP_FACTOR             (5)                             /**< Factor for translating DOP to meters */
00024 
00025 #ifdef  __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 /*
00030  * degree VS radian
00031  */
00032 
00033 double nmea_degree2radian(double val);
00034 double nmea_radian2degree(double val);
00035 
00036 /*
00037  * NDEG (NMEA degree)
00038  */
00039 
00040 double nmea_ndeg2degree(double val);
00041 double nmea_degree2ndeg(double val);
00042 
00043 double nmea_ndeg2radian(double val);
00044 double nmea_radian2ndeg(double val);
00045 
00046 /*
00047  * DOP
00048  */
00049 
00050 double nmea_calc_pdop(double hdop, double vdop);
00051 double nmea_dop2meters(double dop);
00052 double nmea_meters2dop(double meters);
00053 
00054 /*
00055  * positions work
00056  */
00057 
00058 void nmea_info2pos(const nmeaINFO *info, nmeaPOS *pos);
00059 void nmea_pos2info(const nmeaPOS *pos, nmeaINFO *info);
00060 
00061 double  nmea_distance(
00062         const nmeaPOS *from_pos,
00063         const nmeaPOS *to_pos
00064         );
00065 
00066 double  nmea_distance_ellipsoid(
00067         const nmeaPOS *from_pos,
00068         const nmeaPOS *to_pos,
00069         double *from_azimuth,
00070         double *to_azimuth
00071         );
00072 
00073 int     nmea_move_horz(
00074         const nmeaPOS *start_pos,
00075         nmeaPOS *end_pos,
00076         double azimuth,
00077         double distance
00078         );
00079 
00080 int     nmea_move_horz_ellipsoid(
00081         const nmeaPOS *start_pos,
00082         nmeaPOS *end_pos,
00083         double azimuth,
00084         double distance,
00085         double *end_azimuth
00086         );
00087 
00088 #ifdef  __cplusplus
00089 }
00090 #endif
00091 
00092 #endif /* __NMEA_GMATH_H__ */