summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <johannes.hofmann@gmx.de>2013-10-13 19:05:36 +0200
committerJohannes Hofmann <johannes.hofmann@gmx.de>2013-10-13 19:05:36 +0200
commit290df02e802d71da02f0a2c2b1f88ff5f893811b (patch)
treea06440586e0cddf1e99023391657d72787581dcf
parent6b08f9ab9c676360770b372bb87a15900bc7548b (diff)
fix focal length for images in portrait format
-rw-r--r--src/GipfelWidget.cxx10
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