@tscircuit/core 0.0.2319 → 0.0.2321

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.
Files changed (2) hide show
  1. package/dist/index.js +55 -9
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -60485,6 +60485,10 @@ function boardSegmentIsClear({
60485
60485
  return false;
60486
60486
  const ring2 = input.outline;
60487
60487
  if (!ring2?.length) return true;
60488
+ if (start.x === end.x && start.y === end.y)
60489
+ return inside2(start, ring2) && ring2.every(
60490
+ (p2, i2) => pointSegmentDistanceToPoints(start, p2, ring2[(i2 + 1) % ring2.length]) >= margin - epsilon
60491
+ );
60488
60492
  if (!inside2(start, ring2) || !inside2(end, ring2)) return false;
60489
60493
  return ring2.every(
60490
60494
  (p2, i2) => segmentDistance2([start, end], [p2, ring2[(i2 + 1) % ring2.length]]) >= margin - epsilon
@@ -62510,6 +62514,44 @@ var GridComponents = class {
62510
62514
  return 0;
62511
62515
  }
62512
62516
  };
62517
+ var boardGrids = /* @__PURE__ */ new WeakMap();
62518
+ var maxBoardGridBytes = 8 * 1024 * 1024;
62519
+ function getBoardGrid({
62520
+ input,
62521
+ copperRadiusMm,
62522
+ xs,
62523
+ ys,
62524
+ step
62525
+ }) {
62526
+ const key = JSON.stringify([
62527
+ xs[0],
62528
+ ys[0],
62529
+ xs.length,
62530
+ ys.length,
62531
+ step,
62532
+ copperRadiusMm,
62533
+ input.bounds,
62534
+ input.outline,
62535
+ input.minBoardEdgeClearance
62536
+ ]);
62537
+ const previous = boardGrids.get(input);
62538
+ if (previous?.key === key) return previous.blocked;
62539
+ const blocked = new Uint8Array(xs.length * ys.length);
62540
+ for (let y2 = 0; y2 < ys.length; y2++)
62541
+ for (let x2 = 0; x2 < xs.length; x2++) {
62542
+ const point52 = { x: xs[x2], y: ys[y2] };
62543
+ if (!boardSegmentIsClear({
62544
+ input,
62545
+ start: point52,
62546
+ end: point52,
62547
+ copperRadiusMm
62548
+ }))
62549
+ blocked[x2 + y2 * xs.length] = 1;
62550
+ }
62551
+ if (blocked.byteLength <= maxBoardGridBytes)
62552
+ boardGrids.set(input, { key, blocked });
62553
+ return blocked;
62554
+ }
62513
62555
  var GridHeap = class {
62514
62556
  ids = new Int32Array(1024);
62515
62557
  costs = new Float64Array(1024);
@@ -63122,6 +63164,16 @@ var GridVisibilitySearch = class extends GridHistoryProjector {
63122
63164
  this.lengthFrontier = new LengthSearchFrontier();
63123
63165
  let componentIndex = cachedGrid?.components;
63124
63166
  if (!cachedGrid) {
63167
+ if (scene.input.outline?.length)
63168
+ this.blocked.set(
63169
+ getBoardGrid({
63170
+ input: scene.input,
63171
+ copperRadiusMm: scene.width / 2,
63172
+ xs: this.xs,
63173
+ ys: this.ys,
63174
+ step: this.stepSize
63175
+ })
63176
+ );
63125
63177
  const testedBy = new Uint32Array(n2);
63126
63178
  let copperStamp = 0;
63127
63179
  const markBox = (minX, maxX, minY, maxY, entry) => {
@@ -63185,12 +63237,6 @@ var GridVisibilitySearch = class extends GridHistoryProjector {
63185
63237
  markBox(p2.x - r2, p2.x + r2, p2.y - r2, p2.y + r2, entry);
63186
63238
  }
63187
63239
  }
63188
- if (scene.input.outline?.length)
63189
- for (let id = 0; id < n2; id++) {
63190
- if (this.blocked[id]) continue;
63191
- const point52 = this.point(id);
63192
- if (!scene.boardEdgeIsClear(point52, point52)) this.blocked[id] = 1;
63193
- }
63194
63240
  componentIndex = grid3?.checkReachability ? new GridComponents(this.blocked, this.nx) : void 0;
63195
63241
  const bytes = (componentIndex?.storageBytes ?? 0) + n2 * 3 + this.copperBuckets.storageBytes + gridKey.length * 2 + [...this.copperBuckets.values()].reduce(
63196
63242
  (sum, bucket) => sum + bucket.length * 8 + 64,
@@ -159556,7 +159602,7 @@ var RoutingPhasePreparationError = class extends Error {
159556
159602
  var package_default = {
159557
159603
  name: "@tscircuit/core",
159558
159604
  type: "module",
159559
- version: "0.0.2318",
159605
+ version: "0.0.2320",
159560
159606
  types: "dist/index.d.ts",
159561
159607
  main: "dist/index.js",
159562
159608
  module: "dist/index.js",
@@ -159594,9 +159640,9 @@ var package_default = {
159594
159640
  "@tsci/tscircuit.ti": "github:tscircuit/ti#57e314be4b2b06bc546d4def7453e619604d1157",
159595
159641
  "@tscircuit/alphabet": "0.0.25",
159596
159642
  "@tscircuit/bga-fanout-solver": "github:tscircuit/bga-fanout-solver#247c835cb8d69b65e53891dcf869731079415b39",
159597
- "@tscircuit/bus-lanes-solver": "https://jscdn.tscircuit.com/@tscircuit/bus-lanes-solver/0.0.50.tgz",
159643
+ "@tscircuit/bus-lanes-solver": "https://jscdn.tscircuit.com/@tscircuit/bus-lanes-solver/0.0.51.tgz",
159598
159644
  "@tscircuit/cableprinter": "^0.0.6",
159599
- "@tscircuit/capacity-autorouter": "^0.0.1067",
159645
+ "@tscircuit/capacity-autorouter": "^0.0.1068",
159600
159646
  "@tscircuit/checks": "^0.0.270",
159601
159647
  "@tscircuit/circuit-json-util": "^0.0.131",
159602
159648
  "@tscircuit/common": "^0.0.20",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.2319",
4
+ "version": "0.0.2321",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -39,9 +39,9 @@
39
39
  "@tsci/tscircuit.ti": "github:tscircuit/ti#57e314be4b2b06bc546d4def7453e619604d1157",
40
40
  "@tscircuit/alphabet": "0.0.25",
41
41
  "@tscircuit/bga-fanout-solver": "github:tscircuit/bga-fanout-solver#247c835cb8d69b65e53891dcf869731079415b39",
42
- "@tscircuit/bus-lanes-solver": "https://jscdn.tscircuit.com/@tscircuit/bus-lanes-solver/0.0.50.tgz",
42
+ "@tscircuit/bus-lanes-solver": "https://jscdn.tscircuit.com/@tscircuit/bus-lanes-solver/0.0.51.tgz",
43
43
  "@tscircuit/cableprinter": "^0.0.6",
44
- "@tscircuit/capacity-autorouter": "^0.0.1067",
44
+ "@tscircuit/capacity-autorouter": "^0.0.1068",
45
45
  "@tscircuit/checks": "^0.0.270",
46
46
  "@tscircuit/circuit-json-util": "^0.0.131",
47
47
  "@tscircuit/common": "^0.0.20",