Test patterns, and glitchy pillow distortion

This commit is contained in:
Ruben van de Ven 2025-07-02 11:25:29 +02:00
parent b25fc93997
commit 150b3b7fd8

View file

@ -313,6 +313,14 @@ impl Filter for PincushionFilter {
let projected_positions: Vec<laser::Point> = points.points.iter().map(|point| {
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 new_position = if radius > 0. {
let theta = p[1].atan2(p[0]);