feat: handle direct straight-line trace when possible#56
feat: handle direct straight-line trace when possible#56
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| // Attempt direct straight-line connection if pins are aligned | ||
| const EPS = 1e-6 | ||
| const isDirectVertical = Math.abs(pin1.x - pin2.x) < EPS | ||
| const isDirectHorizontal = Math.abs(pin1.y - pin2.y) < EPS | ||
| if (isDirectVertical || isDirectHorizontal) { | ||
| const directPath = [ | ||
| { x: pin1.x, y: pin1.y }, | ||
| { x: pin2.x, y: pin2.y }, | ||
| ] | ||
| const excludeChipIds = Array.from(new Set(this.pins.map((p) => p.chipId))) | ||
| const intersects = | ||
| this.chipObstacleSpatialIndex.doesOrthogonalLineIntersectChip( | ||
| directPath, | ||
| { excludeChipIds }, | ||
| ) | ||
| if (!intersects) { |
There was a problem hiding this comment.
[P1] Direct-line solver ignores collisions with shared chip
The early return for aligned pins drops both pins’ chip IDs before calling doesOrthogonalLineIntersectChip. When the pins are on the same chip this removes the only obstacle that would block the path, so the solver now marks a straight segment across the chip interior as solved without running the later getRestrictedCenterLines and interior-approach checks. Previously these routes were forced to leave the chip and bend around its center; now they can cut directly through the component. This violates the solver’s own chip-intersection rules and will produce invalid traces for any same-chip connection. The shortcut should skip when both pins share a chip or still verify the path against that chip’s bounds.
Useful? React with 👍 / 👎.
Summary
Testing
bun test tests/solvers/SchematicTraceSingleLineSolver2bun test tests/solvers/SchematicTraceSingleLineSolverhttps://chatgpt.com/codex/tasks/task_b_68bf634afad4832e981f4728ae900be7