Skip to content

feat: specialized linear layout for decoupling capacitor partitions#107

Open
voltrace-io wants to merge 1 commit into
tscircuit:mainfrom
voltrace-io:voltrace-io/1779329834-decoupling-caps-layout
Open

feat: specialized linear layout for decoupling capacitor partitions#107
voltrace-io wants to merge 1 commit into
tscircuit:mainfrom
voltrace-io:voltrace-io/1779329834-decoupling-caps-layout

Conversation

@voltrace-io
Copy link
Copy Markdown

Summary

Replaces the generic PackSolver2 with a dedicated horizontal row layout for partitions of type decoupling_caps in SingleInnerPartitionPackingSolver.

Before: Decoupling capacitors are packed using the generic algorithm, which produces cluttered/chaotic arrangements.

After: Decoupling capacitors are arranged in a clean horizontal row:

[C7] [C8] [C9] [C10] [C11]
       ← centered at x=0 →

Implementation

Only one source file changed — SingleInnerPartitionPackingSolver.ts:

  • When partitionType === "decoupling_caps", the solver uses layoutDecouplingCapsLinear() instead of PackSolver2
  • Caps are sorted by chipId (lexicographic) for deterministic output
  • The row is centered at x=0, y=0
  • Respects decouplingCapsGap (falls back to chipGap, then 0.2)
  • All caps get ccwRotationDegrees=0 (upright orientation)
  • Existing PackSolver2 path unchanged for non-decoupling partitions

Tests

6 new tests added, all passing:

  • Caps placed in horizontal row at y=0
  • Deterministic sort by chipId
  • Row centered at x=0
  • Gap between adjacent caps matches decouplingCapsGap
  • Single cap placed at origin
  • All caps have rotation=0

Full suite: 23 pass, 1 skip, 0 new failures.

Addresses #15

/claim #15

Review & Testing Checklist for Human

  • Verify the linear layout produces a cleaner arrangement than the default PackSolver2 for decoupling caps
  • Verify non-decoupling partitions still use the original PackSolver2 path
  • Run bun test — all tests should pass (23 pass, 1 skip; the pre-existing IdentifyDecouplingCapsSolver06 error is from circuit-to-svg)

Notes

  • The pre-existing test failure in IdentifyDecouplingCapsSolver06.test.ts is caused by a missing export in circuit-to-svg and exists on main — not related to this PR.
  • Only 2 files changed: 1 source file + 1 test file.

Adds a dedicated horizontal row layout for partitions of type
decoupling_caps in SingleInnerPartitionPackingSolver. Instead of using
the generic PackSolver2, decoupling capacitors are arranged in a clean
horizontal row, sorted by chipId for deterministic output, centered at
the origin, with configurable gap via decouplingCapsGap.

Addresses tscircuit#15

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2026

@voltrace-io 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.

1 participant