diff options
Diffstat (limited to 'src/Panorama.cxx')
-rw-r--r-- | src/Panorama.cxx | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/Panorama.cxx b/src/Panorama.cxx index 8bab3e4..5f59103 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -432,13 +432,26 @@ Panorama::alpha(const Hill *m) { } double +Panorama::refraction(const Hill *m) { + double a, b, c, alpha = 6.5, T0 = 0.0; + + a = 2.9e-4 * exp (-view_height / 10000.0) / (1.0 + 2.9 * T0 / 760.0); + b = 2.9 * alpha / (760.0 * (1.0 + 2.9 * T0 / 760.0)); + c = a * (b - 1.0 / 10.0); + + return c * get_real_distance(m) / (2000.0 * (1.0 + a)); +} +double Panorama::nick(const Hill *m) { - double b, c; + double b, c, theta = refraction(m); b = m->height + get_earth_radius(m->phi); c = view_height + get_earth_radius(view_phi); - return atan((cos(m->dist) * b - c) / (sin(m->dist) * b)); +if (get_real_distance(m) < 100000) +fprintf(stderr, "=== %s, %g, %g\n", m->name, get_real_distance(m), theta / deg2rad); + + return atan((cos(m->dist) * b - c) / (sin(m->dist) * b)) - theta; } // return local distance to center of WGS84 ellipsoid @@ -454,7 +467,7 @@ Panorama::get_earth_radius(double phi) { } double -Panorama::get_real_distance(Hill *m) { +Panorama::get_real_distance(const Hill *m) { double a, b, c, gam; a = view_height + get_earth_radius(view_phi); |