dsn: skip dot coincident with preceding dot

This commit is contained in:
Mikolaj Wielgus 2024-05-06 20:47:08 +02:00
parent 4efc2d482b
commit 95674a9a53
1 changed files with 24 additions and 17 deletions

View File

@ -469,17 +469,18 @@ impl DsnDesign {
net: usize, net: usize,
) { ) {
// add the first coordinate in the wire path as a dot and save its index // 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 let mut prev_index = layout
.add_fixed_dot(FixedDotWeight { .add_fixed_dot(FixedDotWeight {
circle: Circle { circle: Circle {
pos: Self::pos( pos: prev_pos,
place_pos,
place_rot,
pin_pos,
pin_rot,
coords[0].x as f64,
coords[0].y as f64,
),
r: width / 2.0, r: width / 2.0,
}, },
layer, layer,
@ -489,18 +490,23 @@ impl DsnDesign {
// iterate through path coords starting from the second // iterate through path coords starting from the second
for coord in coords.iter().skip(1) { 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 let index = layout
.add_fixed_dot(FixedDotWeight { .add_fixed_dot(FixedDotWeight {
circle: Circle { circle: Circle {
pos: Self::pos( pos,
place_pos,
place_rot,
pin_pos,
pin_rot,
coord.x as f64,
coord.y as f64,
)
.into(),
r: width / 2.0, r: width / 2.0,
}, },
layer, layer,
@ -522,6 +528,7 @@ impl DsnDesign {
.unwrap(); .unwrap();
prev_index = index; prev_index = index;
prev_pos = pos;
} }
} }