summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Panorama.H2
-rw-r--r--src/Panorama.cxx16
-rw-r--r--src/ProjectionLSQ.cxx3
3 files changed, 10 insertions, 11 deletions
diff --git a/src/Panorama.H b/src/Panorama.H
index c90d55e..651fe8e 100644
--- a/src/Panorama.H
+++ b/src/Panorama.H
@@ -116,7 +116,7 @@ class Panorama {
double get_view_height();
- double get_earth_radius(Hill *m);
+ double get_earth_radius(double latitude);
double get_real_distance(Hill *m);
diff --git a/src/Panorama.cxx b/src/Panorama.cxx
index c67b2e1..38cbd8c 100644
--- a/src/Panorama.cxx
+++ b/src/Panorama.cxx
@@ -13,7 +13,7 @@
#include "ProjectionRectilinear.H"
#include "ProjectionCylindrical.H"
-#define EARTH_RADIUS 6371010.0
+#define EARTH_RADIUS 6371000.785
Panorama::Panorama() {
mountains = new Hills();
@@ -393,7 +393,7 @@ Panorama::update_close_mountains() {
if (m->flags & Hill::TRACK_POINT ||
((m->phi != view_phi || m->lam != view_lam) &&
- (m->height / (m->dist * get_earth_radius(m))
+ (m->height / (m->dist * get_earth_radius(m->phi))
> height_dist_ratio))) {
close_mountains->add(m);
@@ -450,7 +450,7 @@ Panorama::alpha(double phi, double lam) {
cos_alph = (sin(phi) - sin(view_phi) * cos(dist)) /
(cos(view_phi) * sin(dist));
- return atan2(sin_alph, cos_alph);
+ return fmod(atan2(sin_alph, cos_alph) + 2.0 * pi_d, 2.0 * pi_d);
}
@@ -459,8 +459,8 @@ Panorama::nick(double dist, double height) {
double a, b, c;
double beta;
- b = height + EARTH_RADIUS;
- c = view_height + EARTH_RADIUS;
+ b = height + get_earth_radius(view_phi);
+ c = view_height + get_earth_radius(view_phi);
a = pow(((b * (b - (2.0 * c * cos(dist)))) + (c * c)), (1.0 / 2.0));
beta = acos((-(b*b) + (a*a) + (c*c))/(2 * a * c));
@@ -469,7 +469,7 @@ Panorama::nick(double dist, double height) {
}
double
-Panorama::get_earth_radius(Hill *m) {
+Panorama::get_earth_radius(double latitude) {
return EARTH_RADIUS;
}
@@ -477,8 +477,8 @@ double
Panorama::get_real_distance(Hill *m) {
double a, b, c, gam;
- a = view_height + get_earth_radius(m); // using m here is not quite right
- b = m->height + get_earth_radius(m);
+ a = view_height + get_earth_radius(m->phi);
+ b = m->height + get_earth_radius(m->phi);
gam = m->dist;
c = sqrt(pow(a, 2.0) + pow(b, 2.0) - 2.0 * a * b * cos(gam));
diff --git a/src/ProjectionLSQ.cxx b/src/ProjectionLSQ.cxx
index 24ff2a4..077641b 100644
--- a/src/ProjectionLSQ.cxx
+++ b/src/ProjectionLSQ.cxx
@@ -52,7 +52,7 @@ ProjectionLSQ::comp_params(const Hills *h, ViewParams *parms) {
scale_tmp = comp_scale(m1->alph, m2->alph, m1->x, m2->x);
- if (isnan(scale_tmp) || scale_tmp < 100.0) {
+ if (isnan(scale_tmp) || scale_tmp < 50.0) {
fprintf(stderr, "Could not determine initial scale value (%f)\n",
scale_tmp);
return 1;
@@ -235,7 +235,6 @@ ProjectionLSQ::get_coordinates(double alph, double a_nick,
double
ProjectionLSQ::comp_scale(double a1, double a2, double d1, double d2) {
-
return (fabs(d1 - d2) / fabs(a1 - a2));
}