revisions for line drawing

This commit is contained in:
Ruben van de Ven 2025-05-02 19:36:50 +02:00
parent 1dfac5728c
commit 2ff2dc45d5
2 changed files with 8 additions and 1 deletions

View file

@ -375,6 +375,7 @@ fn update(_app: &App, model: &mut Model, update: Update) {
ui.separator();
ui.add(egui::Label::new(format!("Lines {}", model.current_lines.lines.len())));
ui.add(egui::Label::new(format!("Points {}", model.current_lines.point_count())));
ui.heading("Laser Settings");
@ -514,7 +515,6 @@ fn view_line_canvas(app: &App, model: &Model, frame: Frame) {
// let hz = ((app.mouse.x + win.right()) / win.w()).powi(4) * 1000.0;
// TODO refactor to using euclid::point2D for scale
for line in &model.current_lines.lines{
let vertices = line.points.iter().map(|p| {
let color = srgba(p.color.red, p.color.green, p.color.blue, p.color.alpha);

View file

@ -66,6 +66,13 @@ impl RenderableLines{
// self.lines.append(rl.lines);
// }
pub fn point_count(&self) -> usize {
let s = self.lines.iter().map(|x| x.points.len()).sum();
s
}
}
impl From<&RenderablePoint> for laser::Point {