From 95674a9a53f2216c9f7d31e474f245b3c96f62e8 Mon Sep 17 00:00:00 2001 From: Mikolaj Wielgus Date: Mon, 6 May 2024 20:47:08 +0200 Subject: [PATCH] dsn: skip dot coincident with preceding dot --- src/dsn/design.rs | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/dsn/design.rs b/src/dsn/design.rs index 015405f..fe08960 100644 --- a/src/dsn/design.rs +++ b/src/dsn/design.rs @@ -469,17 +469,18 @@ impl DsnDesign { net: usize, ) { // add the first coordinate in the wire path as a dot and save its index + let mut prev_pos = Self::pos( + place_pos, + place_rot, + pin_pos, + pin_rot, + coords[0].x as f64, + coords[0].y as f64, + ); let mut prev_index = layout .add_fixed_dot(FixedDotWeight { circle: Circle { - pos: Self::pos( - place_pos, - place_rot, - pin_pos, - pin_rot, - coords[0].x as f64, - coords[0].y as f64, - ), + pos: prev_pos, r: width / 2.0, }, layer, @@ -489,18 +490,23 @@ impl DsnDesign { // iterate through path coords starting from the second for coord in coords.iter().skip(1) { + let pos = Self::pos( + place_pos, + place_rot, + pin_pos, + pin_rot, + coord.x as f64, + coord.y as f64, + ); + + if pos == prev_pos { + continue; + } + let index = layout .add_fixed_dot(FixedDotWeight { circle: Circle { - pos: Self::pos( - place_pos, - place_rot, - pin_pos, - pin_rot, - coord.x as f64, - coord.y as f64, - ) - .into(), + pos, r: width / 2.0, }, layer, @@ -522,6 +528,7 @@ impl DsnDesign { .unwrap(); prev_index = index; + prev_pos = pos; } }