@tscircuit/hypergraph 0.0.43 → 0.0.45
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 +22 -79
- package/dist/index.js +540 -832
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -306,7 +306,7 @@ declare class HyperGraphSolver<RegionType extends Region = Region, RegionPortTyp
|
|
|
306
306
|
_step(): void;
|
|
307
307
|
}
|
|
308
308
|
|
|
309
|
-
type Bounds$
|
|
309
|
+
type Bounds$1 = {
|
|
310
310
|
minX: number;
|
|
311
311
|
minY: number;
|
|
312
312
|
maxX: number;
|
|
@@ -315,7 +315,7 @@ type Bounds$2 = {
|
|
|
315
315
|
|
|
316
316
|
interface JRegion extends Region {
|
|
317
317
|
d: {
|
|
318
|
-
bounds: Bounds$
|
|
318
|
+
bounds: Bounds$1;
|
|
319
319
|
center: {
|
|
320
320
|
x: number;
|
|
321
321
|
y: number;
|
|
@@ -406,7 +406,7 @@ declare class JumperGraphSolver extends HyperGraphSolver<JRegion, JPort> {
|
|
|
406
406
|
visualize(): GraphicsObject;
|
|
407
407
|
}
|
|
408
408
|
|
|
409
|
-
declare const calculateGraphBounds: (regions: JRegion[]) => Bounds$
|
|
409
|
+
declare const calculateGraphBounds: (regions: JRegion[]) => Bounds$1;
|
|
410
410
|
|
|
411
411
|
type XYConnection = {
|
|
412
412
|
start: {
|
|
@@ -502,7 +502,7 @@ type SharedBoundary = {
|
|
|
502
502
|
};
|
|
503
503
|
type RegionData = {
|
|
504
504
|
id: string;
|
|
505
|
-
bounds: Bounds$
|
|
505
|
+
bounds: Bounds$1 | null;
|
|
506
506
|
polygon: {
|
|
507
507
|
x: number;
|
|
508
508
|
y: number;
|
|
@@ -543,7 +543,7 @@ declare class RegionBuilder implements RegionRef {
|
|
|
543
543
|
private data;
|
|
544
544
|
constructor(id: string);
|
|
545
545
|
get id(): string;
|
|
546
|
-
rect(b: Bounds$
|
|
546
|
+
rect(b: Bounds$1): this;
|
|
547
547
|
polygon(points: {
|
|
548
548
|
x: number;
|
|
549
549
|
y: number;
|
|
@@ -572,7 +572,7 @@ declare class ConnectBuilder {
|
|
|
572
572
|
private portIds;
|
|
573
573
|
private boundary;
|
|
574
574
|
private prefixWasExplicitlySet;
|
|
575
|
-
constructor(region1Id: string, region2Id: string, bounds1: Bounds$
|
|
575
|
+
constructor(region1Id: string, region2Id: string, bounds1: Bounds$1, bounds2: Bounds$1, addPortFn: AddPortFn$1, prefixIdFn: PrefixIdFn, opts?: {
|
|
576
576
|
idPrefix?: string;
|
|
577
577
|
tolerance?: number;
|
|
578
578
|
});
|
|
@@ -592,7 +592,7 @@ declare class ConnectBuilder {
|
|
|
592
592
|
|
|
593
593
|
type ResolveRegionFn = (ref: RegionRef | string) => {
|
|
594
594
|
id: string;
|
|
595
|
-
bounds: Bounds$
|
|
595
|
+
bounds: Bounds$1;
|
|
596
596
|
};
|
|
597
597
|
type AddPortFn = (port: PortData) => void;
|
|
598
598
|
declare class PortBuilder {
|
|
@@ -920,9 +920,13 @@ var routeSegments = [
|
|
|
920
920
|
]
|
|
921
921
|
}
|
|
922
922
|
];
|
|
923
|
+
var tileWidth = 3.735441;
|
|
924
|
+
var tileHeight = 4.029267;
|
|
923
925
|
var viaTile4Regions = {
|
|
924
926
|
viasByNet: viasByNet,
|
|
925
|
-
routeSegments: routeSegments
|
|
927
|
+
routeSegments: routeSegments,
|
|
928
|
+
tileWidth: tileWidth,
|
|
929
|
+
tileHeight: tileHeight
|
|
926
930
|
};
|
|
927
931
|
|
|
928
932
|
type ResolvedRouteLineSegment = {
|
|
@@ -960,6 +964,8 @@ type ViaByNet = Record<string, ViaData[]>;
|
|
|
960
964
|
type ViaTile = {
|
|
961
965
|
viasByNet: ViaByNet;
|
|
962
966
|
routeSegments: RouteSegment[];
|
|
967
|
+
tileWidth?: number;
|
|
968
|
+
tileHeight?: number;
|
|
963
969
|
};
|
|
964
970
|
declare class ViaGraphSolver extends HyperGraphSolver<JRegion, JPort> {
|
|
965
971
|
getSolverName(): string;
|
|
@@ -998,36 +1004,6 @@ declare class ViaGraphSolver extends HyperGraphSolver<JRegion, JPort> {
|
|
|
998
1004
|
visualize(): GraphicsObject;
|
|
999
1005
|
}
|
|
1000
1006
|
|
|
1001
|
-
type Bounds$1 = {
|
|
1002
|
-
minX: number;
|
|
1003
|
-
maxX: number;
|
|
1004
|
-
minY: number;
|
|
1005
|
-
maxY: number;
|
|
1006
|
-
};
|
|
1007
|
-
/**
|
|
1008
|
-
* Generates a tiled grid of via topologies with outer frame regions.
|
|
1009
|
-
*
|
|
1010
|
-
* The via tiles are centered within the given bounds. If the bounds are smaller
|
|
1011
|
-
* than one tile, no via tiles are created - only outer frame regions.
|
|
1012
|
-
*
|
|
1013
|
-
* The outer frame consists of rectangular regions (T, B, L, R) that fill the
|
|
1014
|
-
* space between the tiled area and the problem bounds.
|
|
1015
|
-
*/
|
|
1016
|
-
declare function generateViaTopologyGrid(opts: {
|
|
1017
|
-
viaTile: ViaTile;
|
|
1018
|
-
bounds: Bounds$1;
|
|
1019
|
-
tileSize?: number;
|
|
1020
|
-
portPitch?: number;
|
|
1021
|
-
}): {
|
|
1022
|
-
regions: JRegion[];
|
|
1023
|
-
ports: JPort[];
|
|
1024
|
-
viaTile: ViaTile;
|
|
1025
|
-
tileCount: {
|
|
1026
|
-
rows: number;
|
|
1027
|
-
cols: number;
|
|
1028
|
-
};
|
|
1029
|
-
};
|
|
1030
|
-
|
|
1031
1007
|
/**
|
|
1032
1008
|
* Generates four outer topology regions (top, bottom, left, right) that wrap
|
|
1033
1009
|
* around all vias, forming a closed frame that extends to the graph boundary.
|
|
@@ -1048,15 +1024,6 @@ declare function generateDefaultViaTopologyRegions(opts: Parameters<typeof gener
|
|
|
1048
1024
|
regions: JRegion[];
|
|
1049
1025
|
ports: JPort[];
|
|
1050
1026
|
};
|
|
1051
|
-
declare function generateDefaultViaTopologyGrid(opts: Omit<Parameters<typeof generateViaTopologyGrid>[0], "viaTile">): {
|
|
1052
|
-
regions: JRegion[];
|
|
1053
|
-
ports: JPort[];
|
|
1054
|
-
viaTile: ViaTile;
|
|
1055
|
-
tileCount: {
|
|
1056
|
-
rows: number;
|
|
1057
|
-
cols: number;
|
|
1058
|
-
};
|
|
1059
|
-
};
|
|
1060
1027
|
|
|
1061
1028
|
type ConvexViaGraphFromXYConnectionsResult = JumperGraph & {
|
|
1062
1029
|
connections: Connection[];
|
|
@@ -1092,33 +1059,6 @@ declare function createConvexViaGraphFromXYConnections(xyConnections: XYConnecti
|
|
|
1092
1059
|
concavityTolerance?: number;
|
|
1093
1060
|
}): ConvexViaGraphFromXYConnectionsResult;
|
|
1094
1061
|
|
|
1095
|
-
type ViaGraphFromXYConnectionsResult = JumperGraph & {
|
|
1096
|
-
connections: Connection[];
|
|
1097
|
-
viaTile: ViaTile;
|
|
1098
|
-
tileCount: {
|
|
1099
|
-
rows: number;
|
|
1100
|
-
cols: number;
|
|
1101
|
-
};
|
|
1102
|
-
};
|
|
1103
|
-
/**
|
|
1104
|
-
* Creates a complete via topology graph from XY connections.
|
|
1105
|
-
*
|
|
1106
|
-
* This is the main entry point for integrating ViaGraphSolver with dataset02.
|
|
1107
|
-
* It:
|
|
1108
|
-
* 1. Calculates bounds from connection XY coordinates (no margin)
|
|
1109
|
-
* 2. Generates a tiled grid of via topologies that fits within bounds
|
|
1110
|
-
* 3. Creates outer frame regions to fill remaining space
|
|
1111
|
-
* 4. Attaches connection regions to the graph
|
|
1112
|
-
*
|
|
1113
|
-
* @param xyConnections - Array of connections with start/end XY coordinates
|
|
1114
|
-
* @param viaTile - Via tile data (vias grouped by net plus route segments)
|
|
1115
|
-
* @param opts - Optional configuration (tileSize defaults to 5mm, portPitch to 0.4mm)
|
|
1116
|
-
*/
|
|
1117
|
-
declare function createViaGraphFromXYConnections(xyConnections: XYConnection[], viaTile: ViaTile, opts?: {
|
|
1118
|
-
tileSize?: number;
|
|
1119
|
-
portPitch?: number;
|
|
1120
|
-
}): ViaGraphFromXYConnectionsResult;
|
|
1121
|
-
|
|
1122
1062
|
type ViaGraphWithConnections = JumperGraph & {
|
|
1123
1063
|
connections: Connection[];
|
|
1124
1064
|
};
|
|
@@ -1141,10 +1081,13 @@ type Bounds = {
|
|
|
1141
1081
|
/**
|
|
1142
1082
|
* Generates a via topology using convex regions computed by ConvexRegionsSolver.
|
|
1143
1083
|
*
|
|
1144
|
-
*
|
|
1145
|
-
*
|
|
1146
|
-
*
|
|
1147
|
-
*
|
|
1084
|
+
* New tiled approach:
|
|
1085
|
+
* 1. Compute convex regions for a single unit tile (centered at origin)
|
|
1086
|
+
* 2. Replicate the tile's regions across the grid by translation
|
|
1087
|
+
* 3. Create rectangular filler regions for outer areas:
|
|
1088
|
+
* - Top/bottom regions extend horizontally across full bounds width
|
|
1089
|
+
* - Left/right regions extend vertically between top/bottom regions
|
|
1090
|
+
* 4. Create ports between adjacent tiles and between tiles and filler regions
|
|
1148
1091
|
*/
|
|
1149
1092
|
declare function generateConvexViaTopologyRegions(opts: {
|
|
1150
1093
|
viaTile: ViaTile;
|
|
@@ -1165,4 +1108,4 @@ declare function generateConvexViaTopologyRegions(opts: {
|
|
|
1165
1108
|
};
|
|
1166
1109
|
};
|
|
1167
1110
|
|
|
1168
|
-
export { type Bounds$
|
|
1111
|
+
export { type Bounds$1 as Bounds, type BuildOpts, type Candidate, ConnectBuilder, type ConnectOpts, type Connection, type ConnectionId, type ConvexViaGraphFromXYConnectionsResult, type GScore, type GraphEdgeId, type HyperGraph, HyperGraphSolver, type JPort, type JRegion, JUMPER_GRAPH_SOLVER_DEFAULTS, type JumperGraph, JumperGraphSolver, type JumperGraphWithConnections, type NetworkId, type PortAssignment, PortBuilder, type PortData, type PortId, type PortSpread, type Region, RegionBuilder, type RegionData, type RegionId, type RegionPort, type RegionPortAssignment, type RegionRef, type RouteSegment, type SerializedConnection, type SerializedGraphPort, type SerializedGraphRegion, type SerializedHyperGraph, type SerializedRegionPortAssignment, type SharedBoundary, type SolvedRoute, Topology, TopologyError, VIA_GRAPH_SOLVER_DEFAULTS, type ValidateOpts, type ViaByNet, type ViaData, ViaGraphSolver, type ViaGraphWithConnections, type ViaTile, type XYConnection, applyTransformToGraph, calculateGraphBounds, convertConnectionsToSerializedConnections, convertHyperGraphToSerializedHyperGraph, createConvexViaGraphFromXYConnections, createGraphWithConnectionsFromBaseGraph, createViaGraphWithConnections, generateConvexViaTopologyRegions, generateDefaultViaTopologyRegions, generateJumperGrid, generateJumperX4Grid, generateViaTopologyRegions, rotateGraph90Degrees, viaTile4Regions as viaTile };
|