diff --git a/src/trap/filters.rs b/src/trap/filters.rs index da39e39..2314b1b 100644 --- a/src/trap/filters.rs +++ b/src/trap/filters.rs @@ -315,29 +315,9 @@ impl Filter for PincushionFilter { let projected_positions: Vec = points.points.iter().map(|point| { let p = point.position; - - - // formula by Ilya Sinenko: https://hackernoon.com/galvo-scanner-pillow-and-barrel-distortions-correction - // who states: x_angle = atan(x_cord / (sqrt(pow(d,2)+pow(y_cord,2))+e)) - // let x = (p[0] / (p[1].abs() + self.k_x )).atan(); - // let new_position = [x, p[1]]; - - // Adapted from https://www.geeks3d.com/20140213/glsl-shader-library-fish-eye-and-dome-and-barrel-distortion-post-processing-filters/2/ - // let mut radius = (p[0].powi(2) + p[1].powi(2)).sqrt(); - // let new_position = if radius > 0. { - // let theta = p[1].atan2(p[0]); - // let radius_x = radius.powf(self.k_x); - // let radius_y = radius.powf(self.k_y); - // let x = radius_x * theta.cos(); - // let y = radius_y * theta.sin(); - // [x, y] - // } else { - // p - // }; - - - // Apply Brown-Conrady model of distortion + // Apply Brown-Conrady model of distortion + // https://en.wikipedia.org/wiki/Distortion_(optics)#Software_correction // calculate radius (though we might be able to get away, just using p[1] and p[0] // as we calculate axes independently)