summaryrefslogtreecommitdiff
path: root/src/Panorama.cxx
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-04-08 16:16:12 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-04-08 16:16:12 +0200
commitfad65d8b65673c66554bbf4f85fe46bef7e39542 (patch)
treeaf5d858013f2fce5d12f508586e2aaf0faffc079 /src/Panorama.cxx
parente4c3f1b8661cd3b1b4bc9e640b56c63ee234877f (diff)
add basic refraction correction
Diffstat (limited to 'src/Panorama.cxx')
-rw-r--r--src/Panorama.cxx19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/Panorama.cxx b/src/Panorama.cxx
index 32e14f4..49010f5 100644
--- a/src/Panorama.cxx
+++ b/src/Panorama.cxx
@@ -428,15 +428,28 @@ Panorama::alpha(const Hill *m) {
return fmod(atan2(sin_alph, cos_alph) + 2.0 * pi_d, 2.0 * pi_d);
}
+double
+Panorama::refraction_change(const Hill *m) {
+ double a, b, c, alpha = 6.5 / 1000.0, T0 = 10.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 / 10000.0);
+
+ return (c * get_real_distance(m) / (2.0 * (1.0 + a)));
+}
double
Panorama::nick(const Hill *m) {
- double b, c;
+ double b, c, theta = refraction_change(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) < 200000)
+fprintf(stderr, "=== %s, %g\n", m->name, theta);
+
+ return atan((cos(m->dist) * b - c) / (sin(m->dist) * b)) - theta;
}
// return local distance to center of WGS84 ellipsoid
@@ -452,7 +465,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);