Skip to content

Commit fdd617d

Browse files
Update ceiling to round for correct results on multiples of 90 degrees rotations
1 parent 0923401 commit fdd617d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/geometric_transformations.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,8 @@ where
336336
let cos = theta.cos();
337337
let sin = theta.sin();
338338

339-
let new_width = (height as f32 * sin.abs() + width as f32 * cos.abs()).ceil() as u32;
340-
let new_height = (height as f32 * cos.abs() + width as f32 * sin.abs()).ceil() as u32;
339+
let new_width = (height as f32 * sin.abs() + width as f32 * cos.abs()).round() as u32;
340+
let new_height = (height as f32 * cos.abs() + width as f32 * sin.abs()).round() as u32;
341341

342342
let mut out_img = Image::new(new_width, new_height);
343343

0 commit comments

Comments
 (0)