From 80f6edf2be4314c33361bf6f1e2892216216c3e4 Mon Sep 17 00:00:00 2001 From: Dmitry Zolotukhin Date: Sun, 14 Jan 2024 21:31:15 +0100 Subject: [PATCH] Fixed scale sign for image output. --- src/output.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/output.rs b/src/output.rs index e2ca138..cc81994 100644 --- a/src/output.rs +++ b/src/output.rs @@ -578,7 +578,12 @@ pub fn output( out_scale, )?) } else { - Box::new(ImageWriter::new(path, images, &surface)?) + Box::new(ImageWriter::new( + path, + images, + &surface, + out_scale.2.signum(), + )?) }; let mesh = Mesh::create(surface, interpolation, progress_listener)?; @@ -1049,6 +1054,7 @@ struct ImageWriter { output_map: DMatrix>, point_projections: Vec>, path: String, + scale: f64, img1_width: u32, img1_height: u32, } @@ -1058,6 +1064,7 @@ impl ImageWriter { path: &str, images: Vec, surface: &triangulation::Surface, + scale: f64, ) -> Result { let point_projections = surface .iter_tracks() @@ -1074,6 +1081,7 @@ impl ImageWriter { output_map, point_projections, path: path.to_owned(), + scale, img1_width: img1.width(), img1_height: img1.height(), }) @@ -1158,7 +1166,7 @@ impl MeshWriter for ImageWriter { } let value = if let Some(value) = self.barycentric_interpolation(polygon, (row, col)) { - value + value * self.scale } else { continue; };