better square

This commit is contained in:
Ruben van de Ven 2025-07-03 13:17:30 +02:00
parent 13c8628590
commit 308697fe6a

View file

@ -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) {