Skip to content

Commit 11baaea

Browse files
committed
Fixed scale sign for image output.
1 parent 5c6777e commit 11baaea

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/output.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,12 @@ pub fn output<PL: ProgressListener>(
578578
out_scale,
579579
)?)
580580
} else {
581-
Box::new(ImageWriter::new(path, images, &surface)?)
581+
Box::new(ImageWriter::new(
582+
path,
583+
images,
584+
&surface,
585+
out_scale.2.signum(),
586+
)?)
582587
};
583588

584589
let mesh = Mesh::create(surface, interpolation, progress_listener)?;
@@ -1049,6 +1054,7 @@ struct ImageWriter {
10491054
output_map: DMatrix<Option<f64>>,
10501055
point_projections: Vec<Option<(u32, u32, f64)>>,
10511056
path: String,
1057+
scale: f64,
10521058
img1_width: u32,
10531059
img1_height: u32,
10541060
}
@@ -1058,6 +1064,7 @@ impl ImageWriter {
10581064
path: &str,
10591065
images: Vec<RgbImage>,
10601066
surface: &triangulation::Surface,
1067+
scale: f64,
10611068
) -> Result<ImageWriter, std::io::Error> {
10621069
let point_projections = surface
10631070
.iter_tracks()
@@ -1074,6 +1081,7 @@ impl ImageWriter {
10741081
output_map,
10751082
point_projections,
10761083
path: path.to_owned(),
1084+
scale,
10771085
img1_width: img1.width(),
10781086
img1_height: img1.height(),
10791087
})
@@ -1123,7 +1131,7 @@ impl MeshWriter for ImageWriter {
11231131
};
11241132
let (row, col) = (point2d.0 as usize, point2d.1 as usize);
11251133
if row < self.output_map.nrows() && col < self.output_map.ncols() {
1126-
self.output_map[(row, col)] = Some(point3d.z);
1134+
self.output_map[(row, col)] = Some(point3d.z * self.scale);
11271135
}
11281136
Ok(())
11291137
}
@@ -1158,7 +1166,7 @@ impl MeshWriter for ImageWriter {
11581166
}
11591167
let value = if let Some(value) = self.barycentric_interpolation(polygon, (row, col))
11601168
{
1161-
value
1169+
value * self.scale
11621170
} else {
11631171
continue;
11641172
};

0 commit comments

Comments
 (0)