From 046857dfb88f05e6b310fe9ef07b9f2d3ac5922d Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Thu, 20 Feb 2014 22:42:56 +0100 Subject: Restructure project, make names more clear --- src/convertcoords.c | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 src/convertcoords.c (limited to 'src/convertcoords.c') diff --git a/src/convertcoords.c b/src/convertcoords.c deleted file mode 100644 index 37d780a..0000000 --- a/src/convertcoords.c +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include -#include -int main(int argc, char *argv[]) -{ - double x, y; - char buf[64]; - int in; - while( fgets( buf, sizeof(buf), stdin ) ) - { - if( sscanf( buf, "%lf %lf", &x, &y ) == 2 ) { - double R = 6365000; - double fe = 5200000; - double fn = 1200000; - double ph0 = 0.5235977; // 30deg - double ph1 = 0.7853980; // 45deg - double ph2 = 0.9599309; // 55deg - double l0 = 0.1745329; // 10deg - - double xs = (x-fe)/R; - double ys = (y-fn)/R; - double ph0_s = 0.25*M_PI+0.5*ph0; - double ph1_s = 0.25*M_PI+0.5*ph1; - double ph2_s = 0.25*M_PI+0.5*ph2; - - double n = log(cos(ph1)/cos(ph2))/log(tan(ph2_s)/tan(ph1_s)); - double F = cos(ph1)*pow(tan(ph1_s),n)/n; - double r0 = F / pow(tan(ph0_s),n); - double r = sqrt(pow(xs,2)+pow(r0-ys,2)); - double th = atan(xs/(r0-ys)); - - double lon = l0+th/n; - double lat = 2.0*atan(pow(F/r,1.0/n))-0.5*M_PI; - - printf("%lf\t%lf\n", lat*180.0/M_PI, lon*180.0/M_PI); - } else - printf("\t\n"); - } - return 0; -} -- cgit v1.2.3