From cfde2eac20fb07295f24fbe756fd5c81321f1eb6 Mon Sep 17 00:00:00 2001 From: Ellen Emilia Anna Zscheile Date: Wed, 18 Jun 2025 17:32:12 +0200 Subject: [PATCH] fix(planar-incr-embed): Fix Edge lhs vs. rhs association --- crates/planar-incr-embed/src/navmesh/generate.rs | 4 ++-- src/router/ng/mod.rs | 5 ++--- src/router/ng/poly.rs | 11 ++--------- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/crates/planar-incr-embed/src/navmesh/generate.rs b/crates/planar-incr-embed/src/navmesh/generate.rs index 0d697f3..a09c350 100644 --- a/crates/planar-incr-embed/src/navmesh/generate.rs +++ b/crates/planar-incr-embed/src/navmesh/generate.rs @@ -93,8 +93,8 @@ where b_idx, &b, Edge { - lhs: Some(delaunay.from().data().idx.clone()), - rhs: Some(delaunay.to().data().idx.clone()), + lhs: Some(delaunay.to().data().idx.clone()), + rhs: Some(delaunay.from().data().idx.clone()), }, ); } diff --git a/src/router/ng/mod.rs b/src/router/ng/mod.rs index 00091fa..7241fa4 100644 --- a/src/router/ng/mod.rs +++ b/src/router/ng/mod.rs @@ -455,9 +455,8 @@ fn cane_around( sense ); - // TODO: fix `-sense` vs `sense`. let ret = match inner { - None => layout.cane_around_dot(recorder, old_head, core, -sense, width), + None => layout.cane_around_dot(recorder, old_head, core, sense, width), Some(inner) => { // now, inner is expected to be a bend. // TODO: handle the case that the same path wraps multiple times around the same core @@ -478,7 +477,7 @@ fn cane_around( }) .next(); if let Some(inner_bend) = inner_bend { - layout.cane_around_bend(recorder, old_head, inner_bend.into(), -sense, width) + layout.cane_around_bend(recorder, old_head, inner_bend.into(), sense, width) } else { return Err(EvalException::BendNotFound { core: core, diff --git a/src/router/ng/poly.rs b/src/router/ng/poly.rs index b636b7c..582aade 100644 --- a/src/router/ng/poly.rs +++ b/src/router/ng/poly.rs @@ -105,10 +105,7 @@ impl PolygonRouting { origin: destination, }); }; - let cw = match self.cw { - RotationSense::Counterclockwise => false, - RotationSense::Clockwise => true, - }; + let cw = matches!(self.cw, RotationSense::Clockwise); Ok(if invert_cw ^ cw { lhs } else { rhs }) } @@ -175,11 +172,7 @@ impl PolygonRouting { ); let mut mr = mayrev::MaybeReversed::new(&self.convex_hull.0[..]); // the convex hull is oriented counter-clockwise - // FIXME(fogti): I have no clue where the orientation gets wrong... - mr.reversed = !match self.cw { - RotationSense::Counterclockwise => false, - RotationSense::Clockwise => true, - }; + mr.reversed = matches!(self.cw, RotationSense::Clockwise); let mut route_length = 0.0;