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 { pub fn get_shape(&self, current_lines: LaserPoints) -> LaserPoints {
match self { match self {
Self::CurrentLines => current_lines, Self::CurrentLines => current_lines,
Self::Rectangle => LaserPoints { points: vec!( Self::Rectangle => {
laser::Point{ let mut points = Vec::new();
position:[0xFFF as f32, 0xFFF as f32], let steps: usize = 10;
color: [1.,1.,1.], for i in (0..=steps).rev()a {
weight: 0, points.push(laser::Point{
}, position:[0xFFF as f32, (0xFFF * i / steps) as f32],
laser::Point{ color: [1.,1.,1.],
position:[0xFFF as f32, 0.0], weight: 0,
color: [1.,1.,1.], });
weight: 0, }
}, for i in (0..=steps).rev() {
laser::Point{ points.push(laser::Point{
position:[0.0, 0.0], position:[(0xFFF * i / steps) as f32, 0.0],
color: [1.,1.,1.], color: [1.,1.,1.],
weight: 0, weight: 0,
}, });
laser::Point{ }
position:[0.0, 0xFFF as f32], for i in 0..=steps {
color: [1.,1.,1.], points.push(laser::Point{
weight: 0, position:[0.0 , (0xFFF * i / steps) as f32],
}, color: [1.,1.,1.],
laser::Point{ weight: 0,
position:[0xFFF as f32, 0xFFF as f32], });
color: [1.,1.,1.], }
weight: 0, for i in 0..=steps {
}, points.push(laser::Point{
), space: CoordinateSpace::Laser }, position:[(0xFFF * i / steps) as f32 , 0xFFF as f32],
color: [1.,1.,1.],
weight: 0,
});
}
// dbg!("{:?}", &points);
LaserPoints { points, space: CoordinateSpace::Laser }
},
Self::Grid => { Self::Grid => {
let mut points = Vec::new(); let mut points = Vec::new();
for i in (0..=0xFFF).step_by(0xFFF / 5) { for i in (0..=0xFFF).step_by(0xFFF / 5) {