aboutsummaryrefslogblamecommitdiffstats
path: root/libtellurian_coarse_distance.c
blob: 37768555cd7bf013666f951256d3bbd298d81f1b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

                                                         
            











                                                                                                  

















                                                                                                                               
/* See LICENSE file for copyright and license details. */
#include "common.h"
#ifndef TEST


double
libtellurian_coarse_distance(double latitude1, double longitude1,
                             double latitude2, double longitude2)
{
	latitude1 = radians(latitude1);
	longitude1 = radians(longitude1);
	latitude2 = radians(latitude2);
	longitude2 = radians(longitude2);
	return libtellurian_coarse_distance_radians(latitude1, longitude1, latitude2, longitude2);
}


#else


int
main(void)
{
	ASSERT(libtellurian_coarse_distance(0, 0, 0, 0) == libtellurian_coarse_distance_radians(0, 0, 0, 0));
	ASSERT(libtellurian_coarse_distance(90, 0, 0, 0) == libtellurian_coarse_distance_radians(D90, 0, 0, 0));
	ASSERT(libtellurian_coarse_distance(90, 180, 0, 0) == libtellurian_coarse_distance_radians(D90, D180, 0, 0));
	ASSERT(libtellurian_coarse_distance(90, 180, -45, 0) == libtellurian_coarse_distance_radians(D90, D180, -D45, 0));
	ASSERT(libtellurian_coarse_distance(90, 180, -45, -30) == libtellurian_coarse_distance_radians(D90, D180, -D45, -D30));
	return 0;
}


#endif