diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2007-01-16 19:39:28 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2007-01-16 19:39:28 +0100 |
commit | 469983dbc81c46c552a460e82c5c2443fef0658a (patch) | |
tree | a63a428ca035c6ebea6ae649bd9aa6a62805f4cd | |
parent | 54f77f2aca70e6b895e07778e4bfa9810bef9c58 (diff) |
simplify get_earth_radius()
-rw-r--r-- | src/Panorama.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Panorama.cxx b/src/Panorama.cxx index b1d42d3..cfdfb22 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -35,6 +35,9 @@ Panorama::Panorama() { view_height = 0.0; proj = NULL; set_projection(ProjectionLSQ::RECTILINEAR); + + +fprintf(stderr, "=> %f, %f\n", get_earth_radius(0.0), get_earth_radius(pi_d/2.0)); } Panorama::~Panorama() { @@ -474,14 +477,11 @@ double Panorama::get_earth_radius(double phi) { double a = 6378137.000; double b = 6356752.315; - double x, y, r; - - x = a*b*pow(pow(a,2)*pow(tan(phi),2)+pow(b,2),-1.0/2.0); - y = a*b*tan(phi)*pow(pow(a,2)*pow(tan(phi),2)+pow(b,2),-1.0/2.0); + double r; + double ata = tan(phi); - r = sqrt(pow(x, 2) + pow(y, 2)); + r = a*pow(pow(ata,2)+1,1.0/2.0)*fabs(b)*pow(pow(b,2)+pow(a,2)*pow(ata,2),-1.0/2.0); - fprintf(stderr, "==> %f %f %f %f\n", phi, x, y, r); return r; } |