Skip to content

Commit

Permalink
Update ceiling to round for correct results on multiples of 90 degree…
Browse files Browse the repository at this point in the history
…s rotations
  • Loading branch information
Tikitikitikidesuka committed Oct 6, 2024
1 parent 0923401 commit fdd617d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/geometric_transformations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ where
let cos = theta.cos();
let sin = theta.sin();

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

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

Expand Down

0 comments on commit fdd617d

Please sign in to comment.