@tscircuit/hypergraph 0.0.34 → 0.0.36
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 +76 -215
- package/dist/index.js +634 -369
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseSolver } from '@tscircuit/solver-utils';
|
|
2
2
|
import { Matrix } from 'transformation-matrix';
|
|
3
|
-
import { GraphicsObject } from 'graphics-debug';
|
|
3
|
+
import { GraphicsObject, Point } from 'graphics-debug';
|
|
4
4
|
|
|
5
5
|
type PortId = string;
|
|
6
6
|
type GraphEdgeId = string;
|
|
@@ -248,6 +248,13 @@ declare class HyperGraphSolver<RegionType extends Region = Region, RegionPortTyp
|
|
|
248
248
|
* when there is no direct port-assignment conflict.
|
|
249
249
|
*/
|
|
250
250
|
isRipRequiredForPortUsage(_region: RegionType, _port1: RegionPortType, _port2: RegionPortType): boolean;
|
|
251
|
+
/**
|
|
252
|
+
* OPTIONALLY OVERRIDE THIS
|
|
253
|
+
*
|
|
254
|
+
* Return false to prevent transitioning through a region from `_port1` to
|
|
255
|
+
* `_port2`.
|
|
256
|
+
*/
|
|
257
|
+
isTransitionAllowed(_region: RegionType, _port1: RegionPortType, _port2: RegionPortType): boolean;
|
|
251
258
|
computeG(candidate: CandidateType): number;
|
|
252
259
|
/**
|
|
253
260
|
* Return a subset of the candidates for entering a region. These candidates
|
|
@@ -317,6 +324,11 @@ interface JRegion extends Region {
|
|
|
317
324
|
x: number;
|
|
318
325
|
y: number;
|
|
319
326
|
}[];
|
|
327
|
+
polygonPerimeterCache?: {
|
|
328
|
+
edgeLengths: number[];
|
|
329
|
+
cumulative: number[];
|
|
330
|
+
perimeter: number;
|
|
331
|
+
};
|
|
320
332
|
isPad: boolean;
|
|
321
333
|
isThroughJumper?: boolean;
|
|
322
334
|
isConnectionRegion?: boolean;
|
|
@@ -324,6 +336,8 @@ interface JRegion extends Region {
|
|
|
324
336
|
};
|
|
325
337
|
}
|
|
326
338
|
interface JPort extends RegionPort {
|
|
339
|
+
region1T?: number;
|
|
340
|
+
region2T?: number;
|
|
327
341
|
d: {
|
|
328
342
|
x: number;
|
|
329
343
|
y: number;
|
|
@@ -383,6 +397,7 @@ declare class JumperGraphSolver extends HyperGraphSolver<JRegion, JPort> {
|
|
|
383
397
|
private populateDistanceToEndMaps;
|
|
384
398
|
estimateCostToEnd(port: JPort): number;
|
|
385
399
|
getPortUsagePenalty(port: JPort): number;
|
|
400
|
+
isTransitionAllowed(region: JRegion, port1: JPort, port2: JPort): boolean;
|
|
386
401
|
computeIncreasedRegionCostIfPortsAreUsed(region: JRegion, port1: JPort, port2: JPort): number;
|
|
387
402
|
getRipsRequiredForPortUsage(region: JRegion, port1: JPort, port2: JPort): RegionPortAssignment[];
|
|
388
403
|
isRipRequiredForPortUsage(region: JRegion, _port1: JPort, _port2: JPort): boolean;
|
|
@@ -751,48 +766,24 @@ var routeSegments = [
|
|
|
751
766
|
y: 0.582296
|
|
752
767
|
},
|
|
753
768
|
{
|
|
754
|
-
x: 1.
|
|
755
|
-
y: 0.
|
|
756
|
-
},
|
|
757
|
-
{
|
|
758
|
-
x: 1.425309,
|
|
759
|
-
y: 0.74908
|
|
760
|
-
},
|
|
761
|
-
{
|
|
762
|
-
x: 1.762721,
|
|
763
|
-
y: 1.086492
|
|
764
|
-
},
|
|
765
|
-
{
|
|
766
|
-
x: 1.762721,
|
|
767
|
-
y: 1.563668
|
|
768
|
-
},
|
|
769
|
-
{
|
|
770
|
-
x: 1.425309,
|
|
771
|
-
y: 1.90108
|
|
772
|
-
},
|
|
773
|
-
{
|
|
774
|
-
x: 1.266397,
|
|
775
|
-
y: 1.90108
|
|
769
|
+
x: 1.712721,
|
|
770
|
+
y: 0.811183
|
|
776
771
|
},
|
|
777
772
|
{
|
|
778
|
-
x:
|
|
779
|
-
y:
|
|
773
|
+
x: 1.712721,
|
|
774
|
+
y: 1.542957
|
|
780
775
|
},
|
|
781
776
|
{
|
|
782
|
-
x: 0.
|
|
783
|
-
y: 2.
|
|
777
|
+
x: 0.920111,
|
|
778
|
+
y: 2.335567
|
|
784
779
|
},
|
|
785
780
|
{
|
|
786
|
-
x:
|
|
787
|
-
y:
|
|
788
|
-
},
|
|
789
|
-
{
|
|
790
|
-
x: -0.753066,
|
|
791
|
-
y: 1.360375
|
|
781
|
+
x: 0.034666,
|
|
782
|
+
y: 2.335566
|
|
792
783
|
},
|
|
793
784
|
{
|
|
794
785
|
x: -0.703066,
|
|
795
|
-
y: 1.
|
|
786
|
+
y: 1.597834
|
|
796
787
|
},
|
|
797
788
|
{
|
|
798
789
|
x: -0.703066,
|
|
@@ -815,32 +806,20 @@ var routeSegments = [
|
|
|
815
806
|
y: -1.893395
|
|
816
807
|
},
|
|
817
808
|
{
|
|
818
|
-
x: -2.
|
|
819
|
-
y: -1.
|
|
820
|
-
},
|
|
821
|
-
{
|
|
822
|
-
x: -2.2,
|
|
823
|
-
y: 0.903041
|
|
824
|
-
},
|
|
825
|
-
{
|
|
826
|
-
x: -1.603041,
|
|
827
|
-
y: 1.5
|
|
809
|
+
x: -2.10103,
|
|
810
|
+
y: -1.49897
|
|
828
811
|
},
|
|
829
812
|
{
|
|
830
|
-
x: -
|
|
831
|
-
y: 1.
|
|
813
|
+
x: -2.10103,
|
|
814
|
+
y: 1.002011
|
|
832
815
|
},
|
|
833
816
|
{
|
|
834
|
-
x: -1.
|
|
835
|
-
y: 1.
|
|
817
|
+
x: -1.708294,
|
|
818
|
+
y: 1.394747
|
|
836
819
|
},
|
|
837
820
|
{
|
|
838
|
-
x: -0.
|
|
839
|
-
y: 1.
|
|
840
|
-
},
|
|
841
|
-
{
|
|
842
|
-
x: -0.703066,
|
|
843
|
-
y: 1.310375
|
|
821
|
+
x: -0.897813,
|
|
822
|
+
y: 1.394747
|
|
844
823
|
},
|
|
845
824
|
{
|
|
846
825
|
x: -0.703066,
|
|
@@ -850,81 +829,37 @@ var routeSegments = [
|
|
|
850
829
|
},
|
|
851
830
|
{
|
|
852
831
|
routeId: "Net5:route_0",
|
|
853
|
-
fromPort: "
|
|
854
|
-
toPort: "
|
|
832
|
+
fromPort: "4e57cee8-0910-4c83-9ec1-1ed2c9d16dcc",
|
|
833
|
+
toPort: "a3797f13-73f9-48c3-a448-bea3980cdd65",
|
|
855
834
|
layer: "bottom",
|
|
856
835
|
segments: [
|
|
857
836
|
{
|
|
858
|
-
x:
|
|
859
|
-
y: -
|
|
860
|
-
},
|
|
861
|
-
{
|
|
862
|
-
x: -0.764375,
|
|
863
|
-
y: -0.447998
|
|
864
|
-
},
|
|
865
|
-
{
|
|
866
|
-
x: -0.636191,
|
|
867
|
-
y: -0.447998
|
|
868
|
-
},
|
|
869
|
-
{
|
|
870
|
-
x: -0.368136,
|
|
871
|
-
y: -0.179943
|
|
872
|
-
},
|
|
873
|
-
{
|
|
874
|
-
x: -0.368136,
|
|
875
|
-
y: -0.178529
|
|
876
|
-
},
|
|
877
|
-
{
|
|
878
|
-
x: 0.556834,
|
|
879
|
-
y: 0.746441
|
|
837
|
+
x: 1.268717,
|
|
838
|
+
y: -1.698536
|
|
880
839
|
},
|
|
881
840
|
{
|
|
882
|
-
x: 0.
|
|
883
|
-
y: 0.
|
|
841
|
+
x: 0.369558,
|
|
842
|
+
y: -0.799377
|
|
884
843
|
},
|
|
885
844
|
{
|
|
886
|
-
x:
|
|
887
|
-
y:
|
|
845
|
+
x: -1.115754,
|
|
846
|
+
y: -0.799377
|
|
888
847
|
}
|
|
889
848
|
]
|
|
890
849
|
},
|
|
891
850
|
{
|
|
892
851
|
routeId: "Net5:route_1",
|
|
893
|
-
fromPort: "
|
|
852
|
+
fromPort: "a3797f13-73f9-48c3-a448-bea3980cdd65",
|
|
894
853
|
toPort: "b0c56bb1-ea80-4154-9bb7-cb0fd760de8f",
|
|
895
854
|
layer: "bottom",
|
|
896
855
|
segments: [
|
|
897
856
|
{
|
|
898
|
-
x: 1.
|
|
899
|
-
y: -
|
|
900
|
-
},
|
|
901
|
-
{
|
|
902
|
-
x: 1.405649,
|
|
903
|
-
y: -1.561604
|
|
904
|
-
},
|
|
905
|
-
{
|
|
906
|
-
x: 1.393076,
|
|
907
|
-
y: -1.561604
|
|
908
|
-
},
|
|
909
|
-
{
|
|
910
|
-
x: 1.055664,
|
|
911
|
-
y: -1.224192
|
|
912
|
-
},
|
|
913
|
-
{
|
|
914
|
-
x: 1.055664,
|
|
915
|
-
y: -0.905992
|
|
916
|
-
},
|
|
917
|
-
{
|
|
918
|
-
x: 0.556834,
|
|
919
|
-
y: -0.407162
|
|
920
|
-
},
|
|
921
|
-
{
|
|
922
|
-
x: 0.556834,
|
|
923
|
-
y: 0.746441
|
|
857
|
+
x: -1.115754,
|
|
858
|
+
y: -0.799377
|
|
924
859
|
},
|
|
925
860
|
{
|
|
926
861
|
x: 0.397934,
|
|
927
|
-
y: 0.
|
|
862
|
+
y: 0.714311
|
|
928
863
|
},
|
|
929
864
|
{
|
|
930
865
|
x: 0.397934,
|
|
@@ -982,28 +917,16 @@ var routeSegments = [
|
|
|
982
917
|
x: 0.159346,
|
|
983
918
|
y: 2.034567
|
|
984
919
|
},
|
|
985
|
-
{
|
|
986
|
-
x: 0.06239,
|
|
987
|
-
y: 1.93761
|
|
988
|
-
},
|
|
989
920
|
{
|
|
990
921
|
x: -0.178066,
|
|
991
922
|
y: 1.697155
|
|
992
923
|
},
|
|
993
924
|
{
|
|
994
925
|
x: -0.178066,
|
|
995
|
-
y: 0.
|
|
996
|
-
},
|
|
997
|
-
{
|
|
998
|
-
x: -1.042874,
|
|
999
|
-
y: -0.040093
|
|
926
|
+
y: 0.981123
|
|
1000
927
|
},
|
|
1001
928
|
{
|
|
1002
|
-
x: -1.
|
|
1003
|
-
y: -0.040093
|
|
1004
|
-
},
|
|
1005
|
-
{
|
|
1006
|
-
x: -1.209798,
|
|
929
|
+
x: -1.159189,
|
|
1007
930
|
y: 0
|
|
1008
931
|
},
|
|
1009
932
|
{
|
|
@@ -1023,69 +946,25 @@ var routeSegments = [
|
|
|
1023
946
|
y: -0.164505
|
|
1024
947
|
},
|
|
1025
948
|
{
|
|
1026
|
-
x: 1.
|
|
1027
|
-
y: -0.
|
|
1028
|
-
},
|
|
1029
|
-
{
|
|
1030
|
-
x: 1.634312,
|
|
1031
|
-
y: -0.173664
|
|
1032
|
-
},
|
|
1033
|
-
{
|
|
1034
|
-
x: 2.207664,
|
|
1035
|
-
y: -0.747016
|
|
1036
|
-
},
|
|
1037
|
-
{
|
|
1038
|
-
x: 2.207664,
|
|
1039
|
-
y: -1.224192
|
|
1040
|
-
},
|
|
1041
|
-
{
|
|
1042
|
-
x: 1.870252,
|
|
1043
|
-
y: -1.561604
|
|
949
|
+
x: 1.565592,
|
|
950
|
+
y: -0.164505
|
|
1044
951
|
},
|
|
1045
952
|
{
|
|
1046
|
-
x:
|
|
1047
|
-
y: -
|
|
953
|
+
x: 2.181408,
|
|
954
|
+
y: -0.780321
|
|
1048
955
|
},
|
|
1049
956
|
{
|
|
1050
|
-
x:
|
|
1051
|
-
y: -1.
|
|
957
|
+
x: 2.181408,
|
|
958
|
+
y: -1.600433
|
|
1052
959
|
},
|
|
1053
960
|
{
|
|
1054
961
|
x: 1.507305,
|
|
1055
962
|
y: -2.274536
|
|
1056
963
|
},
|
|
1057
964
|
{
|
|
1058
|
-
x:
|
|
965
|
+
x: 0.630282,
|
|
1059
966
|
y: -2.274536
|
|
1060
967
|
},
|
|
1061
|
-
{
|
|
1062
|
-
x: 0.692717,
|
|
1063
|
-
y: -1.937124
|
|
1064
|
-
},
|
|
1065
|
-
{
|
|
1066
|
-
x: 0.692717,
|
|
1067
|
-
y: -1.739534
|
|
1068
|
-
},
|
|
1069
|
-
{
|
|
1070
|
-
x: 0.475553,
|
|
1071
|
-
y: -1.739534
|
|
1072
|
-
},
|
|
1073
|
-
{
|
|
1074
|
-
x: 0.470734,
|
|
1075
|
-
y: -1.744353
|
|
1076
|
-
},
|
|
1077
|
-
{
|
|
1078
|
-
x: 0.455647,
|
|
1079
|
-
y: -1.744353
|
|
1080
|
-
},
|
|
1081
|
-
{
|
|
1082
|
-
x: 0.30246,
|
|
1083
|
-
y: -1.89754
|
|
1084
|
-
},
|
|
1085
|
-
{
|
|
1086
|
-
x: 0.253286,
|
|
1087
|
-
y: -1.89754
|
|
1088
|
-
},
|
|
1089
968
|
{
|
|
1090
969
|
x: 0.222457,
|
|
1091
970
|
y: -1.866711
|
|
@@ -1103,23 +982,15 @@ var routeSegments = [
|
|
|
1103
982
|
y: -1.866711
|
|
1104
983
|
},
|
|
1105
984
|
{
|
|
1106
|
-
x: 0.
|
|
985
|
+
x: 0.137528,
|
|
1107
986
|
y: -1.866711
|
|
1108
987
|
},
|
|
1109
988
|
{
|
|
1110
|
-
x: 0.
|
|
1111
|
-
y: -1.
|
|
1112
|
-
},
|
|
1113
|
-
{
|
|
1114
|
-
x: 0.2,
|
|
1115
|
-
y: -1.2
|
|
1116
|
-
},
|
|
1117
|
-
{
|
|
1118
|
-
x: -0.701789,
|
|
1119
|
-
y: -1.2
|
|
989
|
+
x: -0.329183,
|
|
990
|
+
y: -1.4
|
|
1120
991
|
},
|
|
1121
992
|
{
|
|
1122
|
-
x: -0.
|
|
993
|
+
x: -0.361788,
|
|
1123
994
|
y: -1.367395
|
|
1124
995
|
},
|
|
1125
996
|
{
|
|
@@ -1127,28 +998,16 @@ var routeSegments = [
|
|
|
1127
998
|
y: -1.367395
|
|
1128
999
|
},
|
|
1129
1000
|
{
|
|
1130
|
-
x: -1.
|
|
1131
|
-
y: -1.
|
|
1132
|
-
},
|
|
1133
|
-
{
|
|
1134
|
-
x: -1.354342,
|
|
1135
|
-
y: -1.375377
|
|
1136
|
-
},
|
|
1137
|
-
{
|
|
1138
|
-
x: -1.529719,
|
|
1139
|
-
y: -1.2
|
|
1001
|
+
x: -1.237643,
|
|
1002
|
+
y: -1.587161
|
|
1140
1003
|
},
|
|
1141
1004
|
{
|
|
1142
|
-
x: -1.
|
|
1143
|
-
y: -1.
|
|
1144
|
-
},
|
|
1145
|
-
{
|
|
1146
|
-
x: -1.718497,
|
|
1147
|
-
y: -1.118497
|
|
1005
|
+
x: -1.587161,
|
|
1006
|
+
y: -1.587161
|
|
1148
1007
|
},
|
|
1149
1008
|
{
|
|
1150
1009
|
x: -1.8,
|
|
1151
|
-
y: -1.
|
|
1010
|
+
y: -1.374322
|
|
1152
1011
|
},
|
|
1153
1012
|
{
|
|
1154
1013
|
x: -1.8,
|
|
@@ -1160,19 +1019,11 @@ var routeSegments = [
|
|
|
1160
1019
|
},
|
|
1161
1020
|
{
|
|
1162
1021
|
x: -1.80003,
|
|
1163
|
-
y: -0.
|
|
1164
|
-
},
|
|
1165
|
-
{
|
|
1166
|
-
x: -1.8,
|
|
1167
|
-
y: -0.559759
|
|
1168
|
-
},
|
|
1169
|
-
{
|
|
1170
|
-
x: -1.8,
|
|
1171
|
-
y: 0.877363
|
|
1022
|
+
y: -0.6
|
|
1172
1023
|
},
|
|
1173
1024
|
{
|
|
1174
|
-
x: -1.
|
|
1175
|
-
y:
|
|
1025
|
+
x: -1.80003,
|
|
1026
|
+
y: 0.488423
|
|
1176
1027
|
},
|
|
1177
1028
|
{
|
|
1178
1029
|
x: -1.419706,
|
|
@@ -1186,6 +1037,11 @@ var viaTile = {
|
|
|
1186
1037
|
routeSegments: routeSegments
|
|
1187
1038
|
};
|
|
1188
1039
|
|
|
1040
|
+
type ResolvedRouteLineSegment = {
|
|
1041
|
+
points: Point[];
|
|
1042
|
+
layer: "top" | "bottom";
|
|
1043
|
+
};
|
|
1044
|
+
|
|
1189
1045
|
declare const VIA_GRAPH_SOLVER_DEFAULTS: {
|
|
1190
1046
|
portUsagePenalty: number;
|
|
1191
1047
|
portUsagePenaltySq: number;
|
|
@@ -1245,6 +1101,11 @@ declare class ViaGraphSolver extends HyperGraphSolver<JRegion, JPort> {
|
|
|
1245
1101
|
computeIncreasedRegionCostIfPortsAreUsed(region: JRegion, port1: JPort, port2: JPort): number;
|
|
1246
1102
|
getRipsRequiredForPortUsage(region: JRegion, port1: JPort, port2: JPort): RegionPortAssignment[];
|
|
1247
1103
|
routeSolvedHook(solvedRoute: SolvedRoute): void;
|
|
1104
|
+
getSolvedRoutePoints(solvedRoute: SolvedRoute): Array<{
|
|
1105
|
+
x: number;
|
|
1106
|
+
y: number;
|
|
1107
|
+
}>;
|
|
1108
|
+
getSolvedRouteLineSegments(solvedRoute: SolvedRoute): ResolvedRouteLineSegment[];
|
|
1248
1109
|
routeStartedHook(connection: Connection): void;
|
|
1249
1110
|
visualize(): GraphicsObject;
|
|
1250
1111
|
}
|