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