blob: 2668d91b6cf1b6698e7974697d16a965419c2be8 (
plain) (
tree)
|
|
/* See LICENSE file for copyright and license details. */
#include "libtellurian.h"
#include <stddef.h>
#include <math.h>
#if defined(__GNUC__) && !defined(__clang__)
# pragma GCC diagnostic ignored "-Wunsuffixed-float-constants"
#endif
#define radians(DEG) ((double)M_PI / 180.0 * (DEG))
#define degrees(RAD) (180.0 / (double)M_PI * (RAD))
#define haversin(X) (fma(-0.5, cos(X), 0.5))
#define geodetic(GEOCENTRIC)\
atan(tan(GEOCENTRIC) * (LIBTELLURIAN_EQUATORIAL_RADIUS * LIBTELLURIAN_EQUATORIAL_RADIUS /\
(LIBTELLURIAN_POLAR_RADIUS * LIBTELLURIAN_POLAR_RADIUS)))
void libtellurian_vincenty_inverse__(double latitude1, double longitude1, double latitude2, double longitude2,
double *distance_out, double *azimuth1_out, double *azimuth2_out);
#ifdef TEST
# include <stdio.h>
# include <stdlib.h>
# if __GNUC__
# pragma GCC diagnostic ignored "-Wfloat-equal"
# endif
# define D180 M_PI
# define D90 (M_PI / 2.0)
# define D60 (M_PI / 3.0)
# define D45 (M_PI / 4.0)
# define D30 (M_PI / 6.0)
# define ASSERT(ASSERTION)\
do {\
if (!(ASSERTION)) {\
fprintf(stderr, "Failed assertion at line %i: %s\n", __LINE__, #ASSERTION);\
exit(1);\
}\
} while (0)
# if defined(__GNUC__)
# define TO\
DO_TEST __attribute__((__const__)) int main(void) { return 0; }
# else
# define TO\
DO_TEST int main(void) { return 0; }
# endif
#endif
|