@tscircuit/schematic-trace-solver 0.0.57 → 0.0.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +15 -1
- package/dist/index.js +367 -136
- package/lib/solvers/AvailableNetOrientationSolver/AvailableNetOrientationSolver.ts +150 -14
- package/lib/solvers/AvailableNetOrientationSolver/geometry.ts +1 -1
- package/lib/solvers/AvailableNetOrientationSolver/types.ts +1 -1
- package/lib/solvers/Example28Solver/reroute.ts +137 -17
- package/lib/solvers/Example28Solver/types.ts +1 -0
- package/lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver.ts +32 -10
- package/lib/solvers/TraceAnchoredNetLabelOverlapSolver/candidates.ts +17 -5
- package/lib/solvers/TraceCleanupSolver/is4PointRectangle.ts +7 -2
- package/lib/types/InputProblem.ts +1 -0
- package/package.json +1 -1
- package/site/examples/example35.page.tsx +4 -0
- package/site/examples/example36.page.tsx +4 -0
- package/site/examples/example37.page.tsx +4 -0
- package/site/examples/example38.page.tsx +4 -0
- package/tests/assets/example35.json +127 -0
- package/tests/assets/example36.json +124 -0
- package/tests/assets/example37.json +173 -0
- package/tests/assets/example38.json +32 -0
- package/tests/examples/__snapshots__/example04.snap.svg +16 -17
- package/tests/examples/__snapshots__/example35.snap.svg +177 -0
- package/tests/examples/__snapshots__/example36.snap.svg +160 -0
- package/tests/examples/__snapshots__/example37.snap.svg +320 -0
- package/tests/examples/__snapshots__/example38.snap.svg +77 -0
- package/tests/examples/example35.test.ts +12 -0
- package/tests/examples/example36.test.ts +12 -0
- package/tests/examples/example37.test.ts +12 -0
- package/tests/examples/example38.test.ts +12 -0
package/dist/index.d.ts
CHANGED
|
@@ -77,6 +77,7 @@ interface InputChip {
|
|
|
77
77
|
interface InputDirectConnection {
|
|
78
78
|
pinIds: [PinId, PinId];
|
|
79
79
|
netId?: string;
|
|
80
|
+
netLabelWidth?: number;
|
|
80
81
|
}
|
|
81
82
|
interface InputNetConnection {
|
|
82
83
|
netId: string;
|
|
@@ -383,6 +384,7 @@ declare class NetLabelPlacementSolver extends BaseSolver {
|
|
|
383
384
|
inputTraceMap: Record<MspConnectionPairId, SolvedTracePath>;
|
|
384
385
|
});
|
|
385
386
|
computeOverlappingSameNetTraceGroups(): Array<OverlappingSameNetTraceGroup>;
|
|
387
|
+
private getNetLabelWidthForGroup;
|
|
386
388
|
_step(): void;
|
|
387
389
|
visualize(): GraphicsObject;
|
|
388
390
|
}
|
|
@@ -603,6 +605,7 @@ type RerouteCandidateResult = {
|
|
|
603
605
|
path: Point[];
|
|
604
606
|
score?: TracePathScore;
|
|
605
607
|
status: "valid" | "duplicate" | "chip-collision";
|
|
608
|
+
usesHorizontalSegmentPush?: boolean;
|
|
606
609
|
selected: boolean;
|
|
607
610
|
};
|
|
608
611
|
|
|
@@ -645,7 +648,7 @@ type CandidateLabel = {
|
|
|
645
648
|
height: number;
|
|
646
649
|
};
|
|
647
650
|
type CandidateStatus$1 = "valid" | "chip-collision" | "trace-collision" | "netlabel-collision";
|
|
648
|
-
type CandidatePhase = "rotate" | "shift";
|
|
651
|
+
type CandidatePhase = "rotate" | "shift" | "lateral-shift";
|
|
649
652
|
type EvaluatedCandidate = CandidateLabel & {
|
|
650
653
|
status: CandidateStatus$1;
|
|
651
654
|
selected: boolean;
|
|
@@ -685,12 +688,23 @@ declare class AvailableNetOrientationSolver extends BaseSolver {
|
|
|
685
688
|
private findValidRotatedCandidate;
|
|
686
689
|
private getAvailableOrientations;
|
|
687
690
|
private findValidShiftedCandidate;
|
|
691
|
+
/**
|
|
692
|
+
* When all candidates fail for the current (unshifted) position, try
|
|
693
|
+
* shifting the label anchor laterally — x for y-orientations, y for
|
|
694
|
+
* x-orientations — and re-attempting the required orientation.
|
|
695
|
+
*
|
|
696
|
+
* Offsets are tried in alternating sign order:
|
|
697
|
+
* -1·step, +1·step, -2·step, +2·step, …
|
|
698
|
+
* so the nearest escape routes are tested first.
|
|
699
|
+
*/
|
|
700
|
+
private findValidLateralShiftedCandidate;
|
|
688
701
|
private findValidCandidateInShiftColumn;
|
|
689
702
|
private evaluateCandidate;
|
|
690
703
|
private getSearchStartAnchor;
|
|
691
704
|
private getWickOffsetAnchor;
|
|
692
705
|
private getSideOffsetAnchor;
|
|
693
706
|
private getSearchDistanceLimit;
|
|
707
|
+
private getLateralColumnMaxDistance;
|
|
694
708
|
private createCandidate;
|
|
695
709
|
private getNetLabelWidth;
|
|
696
710
|
private getCandidateStatus;
|