diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2013-10-16 18:50:44 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2013-10-16 18:50:44 +0200 |
commit | e9399539802b708b79aeef574d16f0a0cbfa0ca8 (patch) | |
tree | 6e5e96cd0ec9446512cf58ed8270b6bec9a7fa2e | |
parent | 4d255f274791a75b9a7a4c58b319e73c7564e3e9 (diff) | |
parent | 290df02e802d71da02f0a2c2b1f88ff5f893811b (diff) |
merge
-rw-r--r-- | src/GipfelWidget.cxx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index d264ae1..2c9c91e 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -499,7 +499,8 @@ GipfelWidget::set_tilt_angle(double a) { void GipfelWidget::set_focal_length_35mm(double s) { - pan->set_scale(s * (double) img->w() / 35.0); + int w = std::max(img->w(), img->h()); // assume sensor is wider than high + pan->set_scale(s * (double) w / 35.0); set_labels(pan->get_visible_mountains()); redraw(); } @@ -519,10 +520,13 @@ GipfelWidget::set_distortion_params(double k0, double k1, double x0) { double GipfelWidget::get_focal_length_35mm() { + int w; + if (img == NULL) return NAN; - else - return pan->get_scale() * 35.0 / (double) img->w(); + + w = std::max(img->w(), img->h()); // assume sensor is wider than high + return pan->get_scale() * 35.0 / (double) w; } void |