summaryrefslogtreecommitdiff
path: root/crates/gipfel-app/src
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-28 09:23:46 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-28 10:34:53 +0100
commit11689fb14f3a4d0291e2ccc05d6cb3556e4ea1ab (patch)
tree4ffabbb3e395e4cf0c9930d10f9beaa055fbcae0 /crates/gipfel-app/src
parentaab6af1601fa4cdb9b351987220f32de062d4b2c (diff)
core: fix focal-length-to-scale constant (36 mm film width, not 35)
The 35mm film frame is 36 mm wide, so a lens with 35mm-equivalent focal length f projects with focal length f*w/36 in pixels. The original C++ code divided by 35, making the EXIF-derived initial scale ~2.9% too large (and the fitted focal readout ~2.9% low). - EXIF init and the focal slider/readout in both apps now use /36 - the gipfel JPEG comment KEEPS its historical scale*35/w encoding (focal_from_comment flag), so annotated JPEGs written by any older gipfel version still reproduce the identical view, and files saved by this version remain readable by them - new regression test focal_scale_exif_vs_comment; golden tests untouched (they pin the comment path)
Diffstat (limited to 'crates/gipfel-app/src')
-rw-r--r--crates/gipfel-app/src/main.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/gipfel-app/src/main.rs b/crates/gipfel-app/src/main.rs
index 12e2845..9ef046a 100644
--- a/crates/gipfel-app/src/main.rs
+++ b/crates/gipfel-app/src/main.rs
@@ -363,11 +363,11 @@ impl Gipfel {
}
fn focal_35mm(&self) -> f64 {
- self.pan.get_scale() * 35.0 / self.img_max()
+ self.pan.get_scale() * 36.0 / self.img_max()
}
fn set_focal_35mm(&mut self, f: f64) {
- self.pan.set_scale(f * self.img_max() / 35.0);
+ self.pan.set_scale(f * self.img_max() / 36.0);
}
fn sync_inputs(&mut self) {
@@ -476,7 +476,10 @@ impl Gipfel {
md.direction = self.pan.get_center_angle();
md.pitch = self.pan.get_pitch_angle();
md.roll = self.pan.get_roll_angle();
- md.focal_length_35mm = self.focal_35mm();
+ // the comment keeps its historical scale * 35 / w encoding so
+ // annotated JPEGs stay interchangeable with older gipfel
+ // versions (see apply_image_metadata)
+ md.focal_length_35mm = self.pan.get_scale() * 35.0 / self.img_max();
md.projection_type = self.pan.projection_type as i32;
md.k0 = self.pan.parms.k0;
md.k1 = self.pan.parms.k1;