@tscircuit/capacity-autorouter 0.0.205 → 0.0.206

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 CHANGED
@@ -29,7 +29,9 @@ type ConnectionPoint = SingleLayerConnectionPoint | MultiLayerConnectionPoint;
29
29
  interface SimpleRouteJson {
30
30
  layerCount: number;
31
31
  minTraceWidth: number;
32
+ nominalTraceWidth?: number;
32
33
  minViaDiameter?: number;
34
+ defaultObstacleMargin?: number;
33
35
  obstacles: Obstacle[];
34
36
  connections: Array<SimpleRouteConnection>;
35
37
  bounds: {
@@ -2774,7 +2776,7 @@ interface Point$1 {
2774
2776
  y: number;
2775
2777
  z: number;
2776
2778
  }
2777
- type Point2D$2 = {
2779
+ type Point2D$3 = {
2778
2780
  x: number;
2779
2781
  y: number;
2780
2782
  };
@@ -2819,26 +2821,26 @@ declare class HighDensityRouteSpatialIndex {
2819
2821
  * @param margin The minimum required clearance distance from the query point.
2820
2822
  * @returns An array of conflicting routes and their minimum distance to the point.
2821
2823
  */
2822
- getConflictingRoutesNearPoint(point: Point2D$2, margin: number): Array<{
2824
+ getConflictingRoutesNearPoint(point: Point2D$3, margin: number): Array<{
2823
2825
  conflictingRoute: HighDensityRoute;
2824
2826
  distance: number;
2825
2827
  }>;
2826
2828
  }
2827
2829
 
2828
- interface Point2D$1 {
2830
+ interface Point2D$2 {
2829
2831
  x: number;
2830
2832
  y: number;
2831
2833
  }
2832
2834
  interface Segment {
2833
- start: Point2D$1;
2834
- end: Point2D$1;
2835
+ start: Point2D$2;
2836
+ end: Point2D$2;
2835
2837
  }
2836
2838
 
2837
- interface Point2D {
2839
+ interface Point2D$1 {
2838
2840
  x: number;
2839
2841
  y: number;
2840
2842
  }
2841
- interface Point3D extends Point2D {
2843
+ interface Point3D$1 extends Point2D$1 {
2842
2844
  z: number;
2843
2845
  }
2844
2846
  interface TraceKeepoutSolverInput {
@@ -2847,7 +2849,6 @@ interface TraceKeepoutSolverInput {
2847
2849
  connMap: ConnectivityMap;
2848
2850
  colorMap: Record<string, string>;
2849
2851
  keepoutRadiusSchedule?: number[];
2850
- smoothDistance?: number;
2851
2852
  srj?: Pick<SimpleRouteJson, "outline" | "bounds">;
2852
2853
  }
2853
2854
  /**
@@ -2864,7 +2865,6 @@ declare class TraceKeepoutSolver extends BaseSolver {
2864
2865
  originalHdRoutes: HighDensityRoute$1[];
2865
2866
  hdRoutes: HighDensityRoute$1[];
2866
2867
  redrawnHdRoutes: HighDensityRoute$1[];
2867
- smoothDistance: number;
2868
2868
  KEEPOUT_RADIUS_SCHEDULE: number[];
2869
2869
  currentScheduleIndex: number;
2870
2870
  currentKeepoutRadius: number;
@@ -2872,18 +2872,20 @@ declare class TraceKeepoutSolver extends BaseSolver {
2872
2872
  smoothedCursorRoutes: HighDensityRoute$1[];
2873
2873
  processedRoutes: HighDensityRoute$1[];
2874
2874
  currentTrace: HighDensityRoute$1 | null;
2875
- cursorPosition: Point3D | null;
2876
- lastCursorPosition: Point3D | null;
2877
- drawPosition: Point2D | null;
2875
+ cursorPosition: Point3D$1 | null;
2876
+ lastCursorPosition: Point3D$1 | null;
2877
+ drawPosition: Point2D$1 | null;
2878
2878
  currentTraceSegmentIndex: number;
2879
2879
  currentTraceSegmentT: number;
2880
- recordedDrawPositions: Point3D[];
2880
+ recordedDrawPositions: Point3D$1[];
2881
2881
  lastCollidingSegments: Segment[];
2882
2882
  obstacleSHI: ObstacleSpatialHashIndex;
2883
2883
  hdRouteSHI: HighDensityRouteSpatialIndex;
2884
2884
  boardOutlineRoutes: HighDensityRoute$1[];
2885
2885
  constructor(input: TraceKeepoutSolverInput);
2886
+ getSmoothDistance(): number;
2886
2887
  _step(): void;
2888
+ getStepDistance(): number;
2887
2889
  /**
2888
2890
  * Steps the cursor forward by CURSOR_STEP_DISTANCE along the trace
2889
2891
  * Returns false if we've reached the end of the trace
@@ -2916,6 +2918,85 @@ declare class TraceKeepoutSolver extends BaseSolver {
2916
2918
  getRedrawnHdRoutes(): HighDensityRoute$1[];
2917
2919
  }
2918
2920
 
2921
+ interface Point2D {
2922
+ x: number;
2923
+ y: number;
2924
+ }
2925
+ interface Point3D extends Point2D {
2926
+ z: number;
2927
+ }
2928
+ interface TraceWidthSolverInput {
2929
+ hdRoutes: HighDensityRoute$1[];
2930
+ obstacles?: Obstacle[];
2931
+ connMap?: ConnectivityMap;
2932
+ colorMap?: Record<string, string>;
2933
+ nominalTraceWidth?: number;
2934
+ minTraceWidth: number;
2935
+ obstacleMargin?: number;
2936
+ }
2937
+ /**
2938
+ * TraceWidthSolver determines the optimal trace width for each route.
2939
+ * It uses a TRACE_WIDTH_SCHEDULE to try progressively narrower widths:
2940
+ * [nominalTraceWidth, (nominalTraceWidth + minTraceWidth)/2, minTraceWidth]
2941
+ *
2942
+ * For each trace, it walks along with a cursor checking clearance.
2943
+ * If clearance is insufficient for the current width, it tries the next
2944
+ * narrower width in the schedule.
2945
+ *
2946
+ * nominalTraceWidth defaults to minTraceWidth * 2 if not specified.
2947
+ */
2948
+ declare class TraceWidthSolver extends BaseSolver {
2949
+ hdRoutes: HighDensityRoute$1[];
2950
+ hdRoutesWithWidths: HighDensityRoute$1[];
2951
+ nominalTraceWidth: number;
2952
+ minTraceWidth: number;
2953
+ obstacleMargin: number;
2954
+ TRACE_WIDTH_SCHEDULE: number[];
2955
+ unprocessedRoutes: HighDensityRoute$1[];
2956
+ processedRoutes: HighDensityRoute$1[];
2957
+ currentTrace: HighDensityRoute$1 | null;
2958
+ cursorPosition: Point3D | null;
2959
+ currentTraceSegmentIndex: number;
2960
+ currentTraceSegmentT: number;
2961
+ currentScheduleIndex: number;
2962
+ currentTargetWidth: number;
2963
+ hasInsufficientClearance: boolean;
2964
+ currentWalkMinClearance: number;
2965
+ bestMinClearance: number;
2966
+ bestWidth: number;
2967
+ lastCollidingObstacles: Obstacle[];
2968
+ lastCollidingRoutes: HighDensityRoute$1[];
2969
+ lastClearance: number;
2970
+ obstacles: Obstacle[];
2971
+ obstacleSHI?: ObstacleSpatialHashIndex;
2972
+ hdRouteSHI: HighDensityRouteSpatialIndex;
2973
+ connMap?: ConnectivityMap;
2974
+ colorMap?: Record<string, string>;
2975
+ constructor(input: TraceWidthSolverInput);
2976
+ _step(): void;
2977
+ /**
2978
+ * Initializes/resets the cursor for processing a trace
2979
+ */
2980
+ private initializeCursor;
2981
+ /**
2982
+ * Steps the cursor forward by CURSOR_STEP_DISTANCE along the trace
2983
+ * Returns false if we've reached the end of the trace
2984
+ */
2985
+ private stepCursorForward;
2986
+ /**
2987
+ * Gets the minimum clearance at a given position from obstacles and other traces
2988
+ * Also updates lastCollidingObstacles and lastCollidingRoutes for visualization
2989
+ */
2990
+ private getClearanceAtPosition;
2991
+ /**
2992
+ * Finalizes the current trace with the given width
2993
+ */
2994
+ private finalizeCurrentTrace;
2995
+ visualize(): GraphicsObject;
2996
+ /** Returns the routes with determined widths. This is the primary output of the solver. */
2997
+ getHdRoutesWithWidths(): HighDensityRoute$1[];
2998
+ }
2999
+
2919
3000
  interface OffboardPortPoint {
2920
3001
  portPointId: string;
2921
3002
  x: number;
@@ -3076,6 +3157,7 @@ declare class AssignableAutoroutingPipeline2 extends BaseSolver {
3076
3157
  deadEndSolver?: DeadEndSolver;
3077
3158
  traceSimplificationSolver?: TraceSimplificationSolver;
3078
3159
  traceKeepoutSolver?: TraceKeepoutSolver;
3160
+ traceWidthSolver?: TraceWidthSolver;
3079
3161
  availableSegmentPointSolver?: AvailableSegmentPointSolver;
3080
3162
  portPointPathingSolver?: PortPointPathingSolver;
3081
3163
  multiSectionPortPointOptimizer?: MultiSectionPortPointOptimizer;
@@ -3090,7 +3172,7 @@ declare class AssignableAutoroutingPipeline2 extends BaseSolver {
3090
3172
  capacityNodes: CapacityMeshNode[] | null;
3091
3173
  capacityEdges: CapacityMeshEdge[] | null;
3092
3174
  cacheProvider: CacheProvider | null;
3093
- pipelineDef: (PipelineStep$1<typeof NetToPointPairsSolver> | PipelineStep$1<typeof RectDiffPipeline> | PipelineStep$1<typeof RelateNodesToOffBoardConnectionsSolver> | PipelineStep$1<typeof CapacityMeshEdgeSolver2_NodeTreeOptimization> | PipelineStep$1<typeof AvailableSegmentPointSolver> | PipelineStep$1<typeof HyperPortPointPathingSolver> | PipelineStep$1<typeof SimpleHighDensitySolver> | PipelineStep$1<typeof MultipleHighDensityRouteStitchSolver> | PipelineStep$1<typeof TraceSimplificationSolver> | PipelineStep$1<typeof TraceKeepoutSolver>)[];
3175
+ pipelineDef: (PipelineStep$1<typeof NetToPointPairsSolver> | PipelineStep$1<typeof RectDiffPipeline> | PipelineStep$1<typeof RelateNodesToOffBoardConnectionsSolver> | PipelineStep$1<typeof CapacityMeshEdgeSolver2_NodeTreeOptimization> | PipelineStep$1<typeof AvailableSegmentPointSolver> | PipelineStep$1<typeof HyperPortPointPathingSolver> | PipelineStep$1<typeof SimpleHighDensitySolver> | PipelineStep$1<typeof MultipleHighDensityRouteStitchSolver> | PipelineStep$1<typeof TraceSimplificationSolver> | PipelineStep$1<typeof TraceKeepoutSolver> | PipelineStep$1<typeof TraceWidthSolver>)[];
3094
3176
  constructor(srj: SimpleRouteJson, opts?: CapacityMeshSolverOptions$1);
3095
3177
  getConstructorParams(): readonly [SimpleRouteJson, CapacityMeshSolverOptions$1];
3096
3178
  currentPipelineStepIndex: number;