27 #include <grass/gis.h>
35 static double t1, t2, t3, t4, t1r, t2r;
77 t1r = atan(boa * tan(
Radians(lat1)));
96 double stm, ctm, sdtm, cdtm;
99 t2r = atan(boa * tan(
Radians(lat2)));
101 tm = (t1r + t2r) / 2;
102 dtm = (t2r - t1r) / 2;
116 t4 = cdtm * cdtm - stm * stm;
138 q, sd, sdlmr, t, u, v, x,
y;
141 sdlmr = sin(
Radians(lon2 - lon1) / 2);
144 if (sdlmr == 0.0 && t1r == t2r)
147 q = t3 + sdlmr * sdlmr * t4;
173 sd = 2 * sqrt(q - q * q);
174 if (q != 0.0 && cd == 1.0)
191 (t - f / 4 * (t * x - y) +
192 ff64 * (x * (a + (t - (a + e) / 2) * x) + y * (-2 * d + e * y)
double G_geodesic_distance_lon_to_lon(double lon1, double lon2)
Calculates geodesic distance.
int G_set_geodesic_distance_lat1(double lat1)
Sets geodesic distance lat1.
int G_set_geodesic_distance_lat2(double lat2)
Sets geodesic distance lat2.
int G_begin_geodesic_distance(double a, double e2)
Begin geodesic distance.
double G_geodesic_distance(double lon1, double lat1, double lon2, double lat2)
Calculates geodesic distance.