@tscircuit/circuit-json-util 0.0.130 → 0.0.131
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 +20 -9
- package/dist/index.js +23 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -22263,18 +22263,29 @@ declare function getMinimumFlexContainer(children: Array<{
|
|
|
22263
22263
|
declare function getElementRenderLayers(element: AnyCircuitElement): PcbRenderLayer[];
|
|
22264
22264
|
|
|
22265
22265
|
type ViaGeometry = Pick<PcbVia, "x" | "y"> & Partial<Pick<PcbVia, "outer_diameter" | "hole_diameter">>;
|
|
22266
|
-
|
|
22267
|
-
* Checks whether a physical via covers a route transition at the same position
|
|
22268
|
-
* with compatible dimensions. Callers must check electrical connectivity
|
|
22269
|
-
* separately. Missing route dimensions use the physical via's dimensions;
|
|
22270
|
-
* missing or unknown layers cannot establish coverage.
|
|
22271
|
-
*/
|
|
22272
|
-
declare function isRouteViaCoveredByPhysicalVia(physicalVia: ViaGeometry & {
|
|
22266
|
+
type ViaWithLayers = ViaGeometry & {
|
|
22273
22267
|
layers?: readonly string[];
|
|
22274
|
-
}
|
|
22268
|
+
};
|
|
22269
|
+
type RouteViaGeometry = ViaGeometry & {
|
|
22275
22270
|
from_layer?: string;
|
|
22276
22271
|
to_layer?: string;
|
|
22277
|
-
}
|
|
22272
|
+
};
|
|
22273
|
+
type RouteViaCoverageOptions = {
|
|
22274
|
+
viaWithLayers: ViaWithLayers;
|
|
22275
|
+
routeVia: RouteViaGeometry;
|
|
22276
|
+
positionTolerance?: number;
|
|
22277
|
+
};
|
|
22278
|
+
/**
|
|
22279
|
+
* Checks whether a via with explicit layers covers a route transition at the
|
|
22280
|
+
* same position with compatible dimensions. Callers must check electrical
|
|
22281
|
+
* connectivity separately. Missing route dimensions use the layered via's dimensions;
|
|
22282
|
+
* missing or unknown layers cannot establish coverage.
|
|
22283
|
+
* Position tolerance is an inclusive limit per axis in mm, defaulting to zero.
|
|
22284
|
+
* Use the named options object to opt in; two-argument calls remain exact.
|
|
22285
|
+
* Neither input is modified.
|
|
22286
|
+
*/
|
|
22287
|
+
declare function isRouteViaCoveredByPhysicalVia(options: RouteViaCoverageOptions): boolean;
|
|
22288
|
+
declare function isRouteViaCoveredByPhysicalVia(viaWithLayers: ViaWithLayers, routeVia: RouteViaGeometry): boolean;
|
|
22278
22289
|
|
|
22279
22290
|
declare const computeGapBetweenCopper: (elm1: AnyCircuitElement, elm2: AnyCircuitElement) => number;
|
|
22280
22291
|
|
package/dist/index.js
CHANGED
|
@@ -2501,18 +2501,31 @@ var getLayerDepth = (layer) => {
|
|
|
2501
2501
|
const match = layer?.match(/^inner([1-9]\d*)$/);
|
|
2502
2502
|
return match ? Number(match[1]) : Number.NaN;
|
|
2503
2503
|
};
|
|
2504
|
-
function isRouteViaCoveredByPhysicalVia(
|
|
2505
|
-
if (
|
|
2506
|
-
|
|
2504
|
+
function isRouteViaCoveredByPhysicalVia(viaWithLayersOrOptions, legacyRouteVia) {
|
|
2505
|
+
if (!("viaWithLayers" in viaWithLayersOrOptions)) {
|
|
2506
|
+
if (!legacyRouteVia) return false;
|
|
2507
|
+
return isRouteViaCoveredByPhysicalVia({
|
|
2508
|
+
viaWithLayers: viaWithLayersOrOptions,
|
|
2509
|
+
routeVia: legacyRouteVia
|
|
2510
|
+
});
|
|
2511
|
+
}
|
|
2512
|
+
const {
|
|
2513
|
+
viaWithLayers,
|
|
2514
|
+
routeVia,
|
|
2515
|
+
positionTolerance = 0
|
|
2516
|
+
} = viaWithLayersOrOptions;
|
|
2517
|
+
const samePosition = Math.abs(viaWithLayers.x - routeVia.x) <= positionTolerance && Math.abs(viaWithLayers.y - routeVia.y) <= positionTolerance;
|
|
2518
|
+
if (!samePosition) return false;
|
|
2519
|
+
if (routeVia.outer_diameter !== void 0 && routeVia.outer_diameter !== viaWithLayers.outer_diameter || routeVia.hole_diameter !== void 0 && routeVia.hole_diameter !== viaWithLayers.hole_diameter) {
|
|
2507
2520
|
return false;
|
|
2508
2521
|
}
|
|
2509
|
-
const
|
|
2510
|
-
if (!
|
|
2511
|
-
const
|
|
2512
|
-
const
|
|
2513
|
-
const
|
|
2514
|
-
const
|
|
2515
|
-
return
|
|
2522
|
+
const viaLayerDepths = viaWithLayers.layers?.map(getLayerDepth);
|
|
2523
|
+
if (!viaLayerDepths?.length || viaLayerDepths.some(Number.isNaN)) return false;
|
|
2524
|
+
const viaTopDepth = Math.min(...viaLayerDepths);
|
|
2525
|
+
const viaBottomDepth = Math.max(...viaLayerDepths);
|
|
2526
|
+
const fromLayerDepth = getLayerDepth(routeVia.from_layer);
|
|
2527
|
+
const toLayerDepth = getLayerDepth(routeVia.to_layer);
|
|
2528
|
+
return viaTopDepth < viaBottomDepth && fromLayerDepth !== toLayerDepth && viaTopDepth <= Math.min(fromLayerDepth, toLayerDepth) && viaBottomDepth >= Math.max(fromLayerDepth, toLayerDepth);
|
|
2516
2529
|
}
|
|
2517
2530
|
|
|
2518
2531
|
// lib/shape-distances/geometry.ts
|