shape: don't inflate seg front and back to prevent false infringements

This commit is contained in:
Mikolaj Wielgus 2024-02-15 03:28:12 +00:00
parent 6fa6ec7527
commit ff19c252c1
1 changed files with 2 additions and 4 deletions

View File

@ -125,11 +125,9 @@ impl ShapeTrait for SegShape {
} }
fn inflate(&self, margin: f64) -> Shape { fn inflate(&self, margin: f64) -> Shape {
let mag = (self.to - self.from).euclidean_distance(&point! {x: 0.0, y: 0.0});
Shape::Seg(SegShape { Shape::Seg(SegShape {
from: self.from + (self.from - self.to) / mag * margin, from: self.from,
to: self.to + (self.to - self.from) / mag * margin, to: self.to,
width: self.width + 2.0 * margin, width: self.width + 2.0 * margin,
}) })
} }