Compare commits

..

No commits in common. "main" and "display" have entirely different histories.

2 changed files with 14 additions and 37 deletions

View file

@ -198,7 +198,7 @@ fn zmq_receive(model: &mut GuiModel) {
// RenderableLayers::new() // RenderableLayers::new()
// }, // if Err("some message"), panic with error message "some message" // }, // if Err("some message"), panic with error message "some message"
// }; // };
} else if model.last_update < Instant::now() - Duration::from_millis(200){ } else if model.last_update < Instant::now() - Duration::from_millis(100){
// set lines empty, if no new input for > 100ms (10fps) // set lines empty, if no new input for > 100ms (10fps)
model.connected = false; model.connected = false;

View file

@ -472,49 +472,27 @@ impl Filter for CropFilter {
if !within_laser_bounds(&point.position) { if !within_laser_bounds(&point.position) {
let mut either = false; let mut either = false;
if id > 0 { if id > 0 {
// previous is _in_ frame. Insert blank _after_ crop
let prev_position = points.points[id-1].position; let prev_position = points.points[id-1].position;
if within_laser_bounds(&prev_position) { if within_laser_bounds(&prev_position) {
either = true; either = true;
// interpolate with prev // interpolate with prev
let clip = clip_line_to_bounds(&prev_position, &point.position); let clip = clip_line_to_bounds(&prev_position, &point.position);
if let Some((p1, p2)) = clip { if let Some((p1, p2)) = clip {
new_points.push(laser::Point{ new_positions.push(p1);
position: p1, new_positions.push(p2);
.. point.clone()
});
new_points.push(laser::Point{
position: p2,
.. point.clone()
});
new_points.push(laser::Point{
position: p2,
.. point.blanked()
});
} }
} }
} }
if id < (points.points.len()-1) { if id < (points.points.len()-1) {
let next_position = points.points[id+1].position; let next_position = points.points[id+1].position;
// if next is _in_ frame. Insert blank _before_ crop
if within_laser_bounds(&next_position) { if within_laser_bounds(&next_position) {
either = true; either = true;
// interpolate with next // interpolate with next
let clip = clip_line_to_bounds(&point.position, &next_position); let clip = clip_line_to_bounds(&point.position, &next_position);
if let Some((p1, p2)) = clip { if let Some((p1, p2)) = clip {
new_points.push(laser::Point{ new_positions.push(p1);
position: p1, new_positions.push(p2);
.. point.blanked()
});
new_points.push(laser::Point{
position: p1,
.. point.clone()
});
new_points.push(laser::Point{
position: p2,
.. point.clone()
});
} }
} }
} }
@ -524,18 +502,17 @@ impl Filter for CropFilter {
continue; continue;
} }
} else { } else {
new_points.push(*point); new_positions.push(point.position.clone());
// new_positions.push(point.position.clone());
} }
// for position in new_positions { for position in new_positions {
// // let pos: [f32; 2] = position.clone(); // let pos: [f32; 2] = position.clone();
// let new_point = laser::Point { let new_point = laser::Point {
// position, position,
// .. point.clone() .. point.clone()
// }; };
// new_points.push(new_point); new_points.push(new_point);
// } }
} }
LaserPoints{ LaserPoints{
points: new_points, points: new_points,