Skip to content

feat: specialized linear layout for decoupling capacitor partitions#60

Open
LuSrodri wants to merge 1 commit intotscircuit:mainfrom
LuSrodri:fix/algora-15-decoupling-caps-linear-layout
Open

feat: specialized linear layout for decoupling capacitor partitions#60
LuSrodri wants to merge 1 commit intotscircuit:mainfrom
LuSrodri:fix/algora-15-decoupling-caps-linear-layout

Conversation

@LuSrodri
Copy link
Copy Markdown

Summary

Resolves #15 — decoupling capacitors were being laid out by the generic PackSolver2, which produces a messy scattered arrangement. This PR adds a specialized fast-path that places them in a clean centered horizontal row.

Changes

lib/solvers/PackInnerPartitionsSolver/SingleInnerPartitionPackingSolver.ts

  • Added early return in _step() when partitionType === "decoupling_caps"
  • Added createDecouplingCapsLinearLayout() private method:
    • Sorts capacitors by chipId (deterministic ordering)
    • Computes total row width and centers it at x=0, y=0
    • Spacing uses decouplingCapsGap ?? chipGap
    • All caps placed at y=0 with ccwRotationDegrees=0
    • Zero impact on non-decoupling partitions

tests/PackInnerPartitionsSolver/DecouplingCapsLayout.test.ts

5 new tests:

  • Caps placed in horizontal row at y=0
  • Gap spacing matches decouplingCapsGap
  • Row is centered at origin
  • Single cap placed at origin
  • Non-decoupling partitions still go through PackSolver2

Test results

22 pass, 1 skip, 1 fail (pre-existing RP2040 overlap), 1 error (pre-existing React warning)

No regressions introduced.


/claim #15

When partitionType is 'decoupling_caps', bypass PackSolver2 and place
capacitors in a centered horizontal row with configurable gap spacing
(decouplingCapsGap ?? chipGap), sorted by chipId for determinism.
This produces the clean layout shown in issue tscircuit#15 instead of the messy
scattered arrangement from the generic packing algorithm.

Adds 5 unit tests covering: row alignment, gap spacing, centering,
single-cap edge case, and non-decoupling partitions unchanged.
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 11, 2026

@LuSrodri is attempting to deploy a commit to the tscircuit Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Specialized Layout for Decoupling Capacitors

1 participant