@tscircuit/schematic-trace-solver 0.0.49 → 0.0.51
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 +133 -1
- package/dist/index.js +1084 -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 +30 -0
- package/lib/solvers/VccNetLabelCornerPlacementSolver/VccNetLabelCornerPlacementSolver.ts +268 -0
- package/lib/solvers/VccNetLabelCornerPlacementSolver/geometry.ts +59 -0
- package/lib/solvers/VccNetLabelCornerPlacementSolver/types.ts +37 -0
- package/lib/solvers/VccNetLabelCornerPlacementSolver/visualize.ts +114 -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 +72 -66
- 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/tests/examples/__snapshots__/example31.snap.svg +12 -12
package/dist/index.d.ts
CHANGED
|
@@ -630,6 +630,136 @@ 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
|
+
|
|
709
|
+
interface VccNetLabelCornerPlacementSolverParams {
|
|
710
|
+
inputProblem: InputProblem;
|
|
711
|
+
traces: SolvedTracePath[];
|
|
712
|
+
netLabelPlacements: NetLabelPlacement[];
|
|
713
|
+
}
|
|
714
|
+
type TraceCornerCandidate = {
|
|
715
|
+
anchorPoint: Point;
|
|
716
|
+
traceId: string;
|
|
717
|
+
distance: number;
|
|
718
|
+
};
|
|
719
|
+
type CornerCandidateStatus = "valid" | "chip-collision" | "trace-collision" | "netlabel-collision";
|
|
720
|
+
type EvaluatedCornerCandidate = TraceCornerCandidate & {
|
|
721
|
+
center: Point;
|
|
722
|
+
width: number;
|
|
723
|
+
height: number;
|
|
724
|
+
status: CornerCandidateStatus;
|
|
725
|
+
selected: boolean;
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
declare class VccNetLabelCornerPlacementSolver extends BaseSolver {
|
|
729
|
+
inputProblem: InputProblem;
|
|
730
|
+
traces: SolvedTracePath[];
|
|
731
|
+
netLabelPlacements: NetLabelPlacement[];
|
|
732
|
+
outputNetLabelPlacements: NetLabelPlacement[];
|
|
733
|
+
queuedLabelIndices: number[];
|
|
734
|
+
currentLabelIndex: number | null;
|
|
735
|
+
currentLabel: NetLabelPlacement | null;
|
|
736
|
+
currentCandidateResults: EvaluatedCornerCandidate[];
|
|
737
|
+
private queuedCornerCandidates;
|
|
738
|
+
private shouldAdvanceToNextLabel;
|
|
739
|
+
private traceMap;
|
|
740
|
+
constructor(params: VccNetLabelCornerPlacementSolverParams);
|
|
741
|
+
getConstructorParams(): ConstructorParameters<typeof VccNetLabelCornerPlacementSolver>[0];
|
|
742
|
+
_step(): void;
|
|
743
|
+
getOutput(): {
|
|
744
|
+
netLabelPlacements: NetLabelPlacement[];
|
|
745
|
+
};
|
|
746
|
+
private getProcessableLabelIndices;
|
|
747
|
+
private prepareNextLabel;
|
|
748
|
+
private advanceToNextLabel;
|
|
749
|
+
private clearCurrentLabel;
|
|
750
|
+
private finish;
|
|
751
|
+
private evaluateCornerCandidate;
|
|
752
|
+
private getCandidateStatus;
|
|
753
|
+
private applyCandidate;
|
|
754
|
+
private shouldProcessLabel;
|
|
755
|
+
private intersectsAnyChip;
|
|
756
|
+
private intersectsAnyOtherNetLabel;
|
|
757
|
+
private getCornerCandidatesForLabel;
|
|
758
|
+
private getTraceLinesForLabel;
|
|
759
|
+
private isTraceForLabel;
|
|
760
|
+
visualize(): GraphicsObject;
|
|
761
|
+
}
|
|
762
|
+
|
|
633
763
|
/**
|
|
634
764
|
* Pipeline solver that runs a series of solvers to find the best schematic layout.
|
|
635
765
|
* Coordinates the entire layout process from chip partitioning through final packing.
|
|
@@ -656,12 +786,14 @@ declare class SchematicTracePipelineSolver extends BaseSolver {
|
|
|
656
786
|
traceLabelOverlapAvoidanceSolver?: TraceLabelOverlapAvoidanceSolver;
|
|
657
787
|
traceCleanupSolver?: TraceCleanupSolver;
|
|
658
788
|
example28Solver?: Example28Solver;
|
|
789
|
+
availableNetOrientationSolver?: AvailableNetOrientationSolver;
|
|
790
|
+
vccNetLabelCornerPlacementSolver?: VccNetLabelCornerPlacementSolver;
|
|
659
791
|
startTimeOfPhase: Record<string, number>;
|
|
660
792
|
endTimeOfPhase: Record<string, number>;
|
|
661
793
|
timeSpentOnPhase: Record<string, number>;
|
|
662
794
|
firstIterationOfPhase: Record<string, number>;
|
|
663
795
|
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>)[];
|
|
796
|
+
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> | PipelineStep<typeof VccNetLabelCornerPlacementSolver>)[];
|
|
665
797
|
constructor(inputProblem: InputProblem);
|
|
666
798
|
getConstructorParams(): ConstructorParameters<typeof SchematicTracePipelineSolver>[0];
|
|
667
799
|
currentPipelineStepIndex: number;
|