Skip to content

Commit

Permalink
Fixed scale sign for image output.
Browse files Browse the repository at this point in the history
  • Loading branch information
zlogic committed Jan 14, 2024
1 parent 5c6777e commit 80f6edf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,12 @@ pub fn output<PL: ProgressListener>(
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)?;
Expand Down Expand Up @@ -1049,6 +1054,7 @@ struct ImageWriter {
output_map: DMatrix<Option<f64>>,
point_projections: Vec<Option<(u32, u32, f64)>>,
path: String,
scale: f64,
img1_width: u32,
img1_height: u32,
}
Expand All @@ -1058,6 +1064,7 @@ impl ImageWriter {
path: &str,
images: Vec<RgbImage>,
surface: &triangulation::Surface,
scale: f64,
) -> Result<ImageWriter, std::io::Error> {
let point_projections = surface
.iter_tracks()
Expand All @@ -1074,6 +1081,7 @@ impl ImageWriter {
output_map,
point_projections,
path: path.to_owned(),
scale,
img1_width: img1.width(),
img1_height: img1.height(),
})
Expand Down Expand Up @@ -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;
};
Expand Down

0 comments on commit 80f6edf

Please sign in to comment.