diff --git a/src/trap/laser.rs b/src/trap/laser.rs index 5af2263..f296473 100644 --- a/src/trap/laser.rs +++ b/src/trap/laser.rs @@ -137,33 +137,40 @@ impl StreamSource{ pub fn get_shape(&self, current_lines: LaserPoints) -> LaserPoints { match self { Self::CurrentLines => current_lines, - Self::Rectangle => LaserPoints { points: vec!( - laser::Point{ - position:[0xFFF as f32, 0xFFF as f32], - color: [1.,1.,1.], - weight: 0, - }, - laser::Point{ - position:[0xFFF as f32, 0.0], - color: [1.,1.,1.], - weight: 0, - }, - laser::Point{ - position:[0.0, 0.0], - color: [1.,1.,1.], - weight: 0, - }, - laser::Point{ - position:[0.0, 0xFFF as f32], - color: [1.,1.,1.], - weight: 0, - }, - laser::Point{ - position:[0xFFF as f32, 0xFFF as f32], - color: [1.,1.,1.], - weight: 0, - }, - ), space: CoordinateSpace::Laser }, + Self::Rectangle => { + let mut points = Vec::new(); + let steps: usize = 10; + for i in (0..=steps).rev()a { + points.push(laser::Point{ + position:[0xFFF as f32, (0xFFF * i / steps) as f32], + color: [1.,1.,1.], + weight: 0, + }); + } + for i in (0..=steps).rev() { + points.push(laser::Point{ + position:[(0xFFF * i / steps) as f32, 0.0], + color: [1.,1.,1.], + weight: 0, + }); + } + for i in 0..=steps { + points.push(laser::Point{ + position:[0.0 , (0xFFF * i / steps) as f32], + color: [1.,1.,1.], + weight: 0, + }); + } + for i in 0..=steps { + points.push(laser::Point{ + position:[(0xFFF * i / steps) as f32 , 0xFFF as f32], + color: [1.,1.,1.], + weight: 0, + }); + } + // dbg!("{:?}", &points); + LaserPoints { points, space: CoordinateSpace::Laser } + }, Self::Grid => { let mut points = Vec::new(); for i in (0..=0xFFF).step_by(0xFFF / 5) {