Test patterns, and glitchy pillow distortion
This commit is contained in:
parent
b25fc93997
commit
150b3b7fd8
1 changed files with 8 additions and 0 deletions
|
@ -313,6 +313,14 @@ impl Filter for PincushionFilter {
|
||||||
|
|
||||||
let projected_positions: Vec<laser::Point> = points.points.iter().map(|point| {
|
let projected_positions: Vec<laser::Point> = points.points.iter().map(|point| {
|
||||||
let p = point.position;
|
let p = point.position;
|
||||||
|
|
||||||
|
|
||||||
|
// formula by Ilya Sinenko: https://hackernoon.com/galvo-scanner-pillow-and-barrel-distortions-correction
|
||||||
|
// 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();
|
||||||
|
return [x, p[1]];
|
||||||
|
|
||||||
let mut radius = (p[0].powi(2) + p[1].powi(2)).sqrt();
|
let mut radius = (p[0].powi(2) + p[1].powi(2)).sqrt();
|
||||||
let new_position = if radius > 0. {
|
let new_position = if radius > 0. {
|
||||||
let theta = p[1].atan2(p[0]);
|
let theta = p[1].atan2(p[0]);
|
||||||
|
|
Loading…
Reference in a new issue