diff options
Diffstat (limited to 'src/Panorama.cxx')
-rw-r--r-- | src/Panorama.cxx | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/Panorama.cxx b/src/Panorama.cxx index 4ecf2f4..503f373 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -11,6 +11,7 @@ #include "Panorama.H" #include "ProjectionTangential.H" +#include "ProjectionTangentialLSQ.H" #include "ProjectionSphaeric.H" #define EARTH_RADIUS 6371010.0 @@ -160,9 +161,10 @@ int Panorama::guess(Hills *p, Hill *m1) { Hill *p2, *m_tmp1, *m_tmp2; Hill *m2; + Hills h; double best = 100000000.0, v; double a_center_best, a_nick_best, a_tilt_best, scale_best; - int x1_sav, y1_sav; + double x1_sav, y1_sav; int i, j; if (m1 == NULL) { @@ -192,7 +194,10 @@ Panorama::guess(Hills *p, Hill *m1) { m2->x = p2->x; m2->y = p2->y; - comp_params(m1, m2); + h.clear(); + h.add(m1); + h.add(m2); + comp_params(&h); v = get_value(p); @@ -219,10 +224,10 @@ Panorama::guess(Hills *p, Hill *m1) { } int -Panorama::comp_params(Hill *m1, Hill *m2) { +Panorama::comp_params(Hills *h) { int ret; - ret = proj->comp_params(m1, m2, &parms); + ret = proj->comp_params(h, &parms); update_visible_mountains(); return ret; } @@ -285,7 +290,7 @@ Panorama::set_projection(Projection::Projection_t p) { switch(projection_type) { case Projection::TANGENTIAL: - proj = new ProjectionTangential(); + proj = new ProjectionTangentialLSQ(); view_angle = pi_d / 3.0; break; case Projection::SPHAERIC: @@ -470,7 +475,6 @@ Panorama::update_visible_mountains() { m = close_mountains->get(i); m->a_view = m->alph - parms.a_center; - if (m->a_view > pi_d) { m->a_view -= 2.0*pi_d; } else if (m->a_view < -pi_d) { @@ -494,11 +498,7 @@ Panorama::update_coordinates() { for (int i=0; i<visible_mountains->get_num(); i++) { m = visible_mountains->get(i); - double tmp_x, tmp_y; - - proj->get_coordinates(m->a_view, m->a_nick, &parms, &tmp_x, &tmp_y); - m->x = (int) rint(tmp_x); - m->y = (int) rint(tmp_y); + proj->get_coordinates(m->alph, m->a_nick, &parms, &m->x, &m->y); } } @@ -593,4 +593,3 @@ Panorama::get_coordinates(double a_view, double a_nick, double *x, double *y) { return 0; } - |