only lines, instead of grid

This commit is contained in:
Ruben van de Ven 2025-10-16 20:02:23 +02:00
parent e0b81abd33
commit a2ee8da80e

View file

@ -125,7 +125,7 @@ pub enum StreamSource {
Disabled, Disabled,
CurrentLines, CurrentLines,
Rectangle, Rectangle,
Grid, // lines GridY, // lines
WorldGrid, // grid in world space WorldGrid, // grid in world space
Homography, // points for homography alignment Homography, // points for homography alignment
// Circle, // segments // Circle, // segments
@ -137,7 +137,7 @@ pub const STREAM_SOURCES: [StreamSource; 6] = [
StreamSource::Disabled, StreamSource::Disabled,
StreamSource::CurrentLines, StreamSource::CurrentLines,
StreamSource::Rectangle, StreamSource::Rectangle,
StreamSource::Grid, StreamSource::GridY,
StreamSource::WorldGrid, StreamSource::WorldGrid,
StreamSource::Homography, StreamSource::Homography,
// StreamSource::Spiral // StreamSource::Spiral
@ -218,7 +218,7 @@ impl StreamSource{
Self::Rectangle => { Self::Rectangle => {
shape_rect(LaserSpace::READY, 11) shape_rect(LaserSpace::READY, 11)
}, },
Self::Grid => { Self::GridY => {
let lines: usize = 5; let lines: usize = 5;
let half = (0xFFF / 2) as f32; let half = (0xFFF / 2) as f32;
let mut points = Vec::new(); let mut points = Vec::new();
@ -243,25 +243,25 @@ impl StreamSource{
points.push(points[points.len()-1].blanked()); points.push(points[points.len()-1].blanked());
} }
for i in 0..=lines { // for i in 0..=lines {
let offset = if i % 2 == 0 { 0 } else {0xFFF } as f32; // let offset = if i % 2 == 0 { 0 } else {0xFFF } as f32;
let y = i * 0xFFF / lines; // let y = i * 0xFFF / lines;
points.push(laser::Point{ // points.push(laser::Point{
position:[(offset as f32 - half)/half, (y as f32 - half)/half], // position:[(offset as f32 - half)/half, (y as f32 - half)/half],
color: [0., 0., 0.], // color: [0., 0., 0.],
weight: 0, // weight: 0,
}); // });
for j in (0..=0xFFF).step_by(0xFFF / 10) { // for j in (0..=0xFFF).step_by(0xFFF / 10) {
// go back and forth, so galvo has it easier // // go back and forth, so galvo has it easier
let x = if i % 2 == 0 { j } else {0xFFF - j}; // let x = if i % 2 == 0 { j } else {0xFFF - j};
points.push(laser::Point{ // points.push(laser::Point{
position:[(x as f32 - half)/half, (y as f32 - half)/half], // position:[(x as f32 - half)/half, (y as f32 - half)/half],
color: [1.,1.,1.], // color: [1.,1.,1.],
weight: 0, // weight: 0,
}); // });
} // }
points.push(points[points.len()-1].blanked()); // points.push(points[points.len()-1].blanked());
} // }
LaserPoints { points, space: CoordinateSpace::Laser } LaserPoints { points, space: CoordinateSpace::Laser }