Skip to content

Commit

Permalink
make computation of box sizes more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
torfmaster committed Aug 20, 2024
1 parent c6a3c28 commit c96d460
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/imageops/fast_blur.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ pub fn fast_blur<P: Pixel>(
}

fn boxes_for_gauss(sigma: f32, n: usize) -> Vec<usize> {
let w_ideal = f32::sqrt((12.0 * sigma * sigma / (n as f32)) + 1.0);
let w_ideal = f32::sqrt((12.0 * sigma.powi(2) / (n as f32)) + 1.0);
let mut w_l = w_ideal.floor();
if w_l % 2.0 == 0.0 {
w_l -= 1.0
};
let w_u = w_l + 2.0;

let m_ideal = (12.0 * sigma * sigma
- (n as f32) * (w_l) * (w_l)
let m_ideal = (12.0 * sigma.powi(2)
- (n as f32) * w_l.powi(2)
- 4.0 * (n as f32) * (w_l)
- 3.0 * (n as f32))
/ (-4.0 * (w_l) - 4.0);
Expand Down

0 comments on commit c96d460

Please sign in to comment.