libcfe  0.12.1
some useful C-functions
geo_calculations.h File Reference
#include <cfe/gpstypes.h>
Include dependency graph for geo_calculations.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

long double calculate_distance (lat_t lat1_deg, lng_t lng1_deg, alt_t ele1, lat_t lat2_deg, lng_t lng2_deg, alt_t ele2) __attribute__((const))
 
float calculate_incline (long double dst, alt_t d_ele) __attribute__((const))
 

Function Documentation

◆ calculate_distance()

long double calculate_distance ( lat_t  lat1_deg,
lng_t  lng1_deg,
alt_t  ele1,
lat_t  lat2_deg,
lng_t  lng2_deg,
alt_t  ele2 
) const

Calculate the distance between to points on the surface of earth. This function uses Vincenty formula.

Parameters
[in]lat1_degLatitude of point A in degrees.
[in]lng1_degLongitude of point A in degrees.
[in]ele1Altitude of point A in meters.
[in]lat2_degLatitude of point B in degrees.
[in]lng2_degLongitude of point B in degrees.
[in]ele2Altitude of point B in meters.
Returns
Distance between point A and B in meters.

◆ calculate_incline()

float calculate_incline ( long double  dst,
alt_t  d_ele 
) const

Calculate the incline.

Note
it does not matter which units are used as input as long as both parameters use the same unit.
Parameters
[in]dstDistance along the real path (e.x. road).
[in]d_eleDelta elevation, the height difference.
Returns
incline