feat: specialized linear layout for decoupling capacitor partitions#40
Open
huangyebiaoke wants to merge 1 commit intotscircuit:mainfrom
Open
feat: specialized linear layout for decoupling capacitor partitions#40huangyebiaoke wants to merge 1 commit intotscircuit:mainfrom
huangyebiaoke wants to merge 1 commit intotscircuit:mainfrom
Conversation
…scircuit#15) Replaces the generic PackSolver2 with a dedicated horizontal row layout for partitions of type 'decoupling_caps'. ## Problem Decoupling capacitors placed by PackSolver2 produce a chaotic cluster (see before screenshot in tscircuit#15). The maintainer's 'acceptable solution' shows caps arranged in a clean horizontal row. ## Solution In SingleInnerPartitionPackingSolver._step(), when the partition type is 'decoupling_caps', skip PackSolver2 and call _layoutDecouplingCapsLinear() instead. _layoutDecouplingCapsLinear(): - Sorts caps deterministically by chipId (lexicographic) → stable CI results - Centers the row at the origin (x=0, y=0) - Uses decouplingCapsGap (fallback: chipGap → 0.2) between caps - Sets ccwRotationDegrees=0 for all caps (vertical orientation, y+ pin on top) ## Tests New test file: tests/DecouplingCapsLinearLayout.test.ts - All caps placed at y=0 in a horizontal row - Deterministic sorting by chipId - Row is centered at x=0 - Gap between adjacent caps matches decouplingCapsGap - Single cap placed at origin - RP2040 pipeline completes successfully All new tests pass. Pre-existing IdentifyDecouplingCapsSolver06 failure is unrelated (circuit-to-svg export mismatch, present on main). Fixes tscircuit#15
|
Someone is attempting to deploy a commit to the tscircuit Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
The CI failure in This error exists on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/claim #15
Replaces the generic PackSolver2 with a dedicated horizontal row layout for partitions of type
decoupling_caps, matching the "acceptable solution" image posted by @seveibar.Before / After
Before (PackSolver2): caps cluster in a chaotic pile
After (this PR): caps are arranged in a clean horizontal row, centered at origin, with configurable gap:
Implementation
Only one file changed in
lib/—SingleInnerPartitionPackingSolver.ts:_layoutDecouplingCapsLinear():chipId(lexicographic) → stable CI resultsx=0, y=0decouplingCapsGapproperty (fallback:chipGap → 0.2)ccwRotationDegrees=0for all caps (vertical, y+ pin on top per schematic convention)Tests
All 6 new tests pass:
decouplingCapsGapPre-existing
IdentifyDecouplingCapsSolver06failure is unrelated (circuit-to-svg export mismatch onmain).