@tscircuit/schematic-trace-solver 0.0.49 → 0.0.50
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 +78 -1
- package/dist/index.js +762 -41
- package/lib/solvers/AvailableNetOrientationSolver/AvailableNetOrientationSolver.ts +682 -0
- package/lib/solvers/AvailableNetOrientationSolver/constants.ts +6 -0
- package/lib/solvers/AvailableNetOrientationSolver/geometry.ts +192 -0
- package/lib/solvers/AvailableNetOrientationSolver/traces.ts +43 -0
- package/lib/solvers/AvailableNetOrientationSolver/types.ts +44 -0
- package/lib/solvers/AvailableNetOrientationSolver/visualize.ts +123 -0
- package/lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver.ts +14 -0
- package/package.json +1 -1
- package/tests/assets/example22.json +1 -1
- package/tests/examples/__snapshots__/example12.snap.svg +33 -30
- package/tests/examples/__snapshots__/example13.snap.svg +10 -4
- package/tests/examples/__snapshots__/example14.snap.svg +10 -4
- package/tests/examples/__snapshots__/example16.snap.svg +33 -27
- package/tests/examples/__snapshots__/example20.snap.svg +29 -23
- package/tests/examples/__snapshots__/example21.snap.svg +77 -65
- package/tests/examples/__snapshots__/example22.snap.svg +31 -25
package/dist/index.d.ts
CHANGED
|
@@ -630,6 +630,82 @@ declare class Example28Solver extends BaseSolver {
|
|
|
630
630
|
visualize(): GraphicsObject;
|
|
631
631
|
}
|
|
632
632
|
|
|
633
|
+
interface AvailableNetOrientationSolverParams {
|
|
634
|
+
inputProblem: InputProblem;
|
|
635
|
+
traces: SolvedTracePath[];
|
|
636
|
+
netLabelPlacements: NetLabelPlacement[];
|
|
637
|
+
}
|
|
638
|
+
type CandidateLabel = {
|
|
639
|
+
orientation: FacingDirection;
|
|
640
|
+
anchorPoint: Point;
|
|
641
|
+
center: Point;
|
|
642
|
+
width: number;
|
|
643
|
+
height: number;
|
|
644
|
+
};
|
|
645
|
+
type CandidateStatus = "valid" | "chip-collision" | "trace-collision" | "netlabel-collision";
|
|
646
|
+
type CandidatePhase = "rotate" | "shift";
|
|
647
|
+
type EvaluatedCandidate = CandidateLabel & {
|
|
648
|
+
status: CandidateStatus;
|
|
649
|
+
selected: boolean;
|
|
650
|
+
phase: CandidatePhase;
|
|
651
|
+
distance?: number;
|
|
652
|
+
outwardDistance?: number;
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
declare class AvailableNetOrientationSolver extends BaseSolver {
|
|
656
|
+
inputProblem: InputProblem;
|
|
657
|
+
traces: SolvedTracePath[];
|
|
658
|
+
netLabelPlacements: NetLabelPlacement[];
|
|
659
|
+
outputNetLabelPlacements: NetLabelPlacement[];
|
|
660
|
+
queuedLabelIndices: number[];
|
|
661
|
+
currentLabelIndex: number | null;
|
|
662
|
+
currentLabel: NetLabelPlacement | null;
|
|
663
|
+
currentCandidateResults: EvaluatedCandidate[];
|
|
664
|
+
private traceMap;
|
|
665
|
+
private chipObstacleSpatialIndex;
|
|
666
|
+
private maxSearchDistance;
|
|
667
|
+
private pinMap;
|
|
668
|
+
constructor(params: AvailableNetOrientationSolverParams);
|
|
669
|
+
getConstructorParams(): ConstructorParameters<typeof AvailableNetOrientationSolver>[0];
|
|
670
|
+
_step(): void;
|
|
671
|
+
getOutput(): {
|
|
672
|
+
traces: SolvedTracePath[];
|
|
673
|
+
netLabelPlacements: NetLabelPlacement[];
|
|
674
|
+
};
|
|
675
|
+
private getProcessableLabelIndices;
|
|
676
|
+
private shouldProcessLabel;
|
|
677
|
+
private processLabel;
|
|
678
|
+
private applyCandidate;
|
|
679
|
+
private addConnectorTrace;
|
|
680
|
+
private finish;
|
|
681
|
+
private setCurrentLabel;
|
|
682
|
+
private findCorrectedCandidate;
|
|
683
|
+
private findValidRotatedCandidate;
|
|
684
|
+
private getAvailableOrientations;
|
|
685
|
+
private findValidShiftedCandidate;
|
|
686
|
+
private findValidCandidateInShiftColumn;
|
|
687
|
+
private evaluateCandidate;
|
|
688
|
+
private getSearchStartAnchor;
|
|
689
|
+
private getWickOffsetAnchor;
|
|
690
|
+
private getSideOffsetAnchor;
|
|
691
|
+
private getSearchDistanceLimit;
|
|
692
|
+
private createCandidate;
|
|
693
|
+
private getNetLabelWidth;
|
|
694
|
+
private isLabelPlacementValid;
|
|
695
|
+
private isCandidateValidWithOffset;
|
|
696
|
+
private getCandidateStatus;
|
|
697
|
+
private getBoundsStatus;
|
|
698
|
+
private getOffsetCollisionBounds;
|
|
699
|
+
private intersectsAnyOtherNetLabel;
|
|
700
|
+
private sharesChipBoundary;
|
|
701
|
+
private getChipSideForPoint;
|
|
702
|
+
private getPerpendicularOutwardDirection;
|
|
703
|
+
private getContainingChipSide;
|
|
704
|
+
private getOutsideChipSide;
|
|
705
|
+
private getNearestChipSide;
|
|
706
|
+
visualize(): GraphicsObject;
|
|
707
|
+
}
|
|
708
|
+
|
|
633
709
|
/**
|
|
634
710
|
* Pipeline solver that runs a series of solvers to find the best schematic layout.
|
|
635
711
|
* Coordinates the entire layout process from chip partitioning through final packing.
|
|
@@ -656,12 +732,13 @@ declare class SchematicTracePipelineSolver extends BaseSolver {
|
|
|
656
732
|
traceLabelOverlapAvoidanceSolver?: TraceLabelOverlapAvoidanceSolver;
|
|
657
733
|
traceCleanupSolver?: TraceCleanupSolver;
|
|
658
734
|
example28Solver?: Example28Solver;
|
|
735
|
+
availableNetOrientationSolver?: AvailableNetOrientationSolver;
|
|
659
736
|
startTimeOfPhase: Record<string, number>;
|
|
660
737
|
endTimeOfPhase: Record<string, number>;
|
|
661
738
|
timeSpentOnPhase: Record<string, number>;
|
|
662
739
|
firstIterationOfPhase: Record<string, number>;
|
|
663
740
|
inputProblem: InputProblem;
|
|
664
|
-
pipelineDef: (PipelineStep<typeof MspConnectionPairSolver> | PipelineStep<typeof SchematicTraceLinesSolver> | PipelineStep<typeof LongDistancePairSolver> | PipelineStep<typeof TraceOverlapShiftSolver> | PipelineStep<typeof NetLabelPlacementSolver> | PipelineStep<typeof TraceLabelOverlapAvoidanceSolver> | PipelineStep<typeof TraceCleanupSolver> | PipelineStep<typeof Example28Solver>)[];
|
|
741
|
+
pipelineDef: (PipelineStep<typeof MspConnectionPairSolver> | PipelineStep<typeof SchematicTraceLinesSolver> | PipelineStep<typeof LongDistancePairSolver> | PipelineStep<typeof TraceOverlapShiftSolver> | PipelineStep<typeof NetLabelPlacementSolver> | PipelineStep<typeof TraceLabelOverlapAvoidanceSolver> | PipelineStep<typeof TraceCleanupSolver> | PipelineStep<typeof Example28Solver> | PipelineStep<typeof AvailableNetOrientationSolver>)[];
|
|
665
742
|
constructor(inputProblem: InputProblem);
|
|
666
743
|
getConstructorParams(): ConstructorParameters<typeof SchematicTracePipelineSolver>[0];
|
|
667
744
|
currentPipelineStepIndex: number;
|