biscuitboard 1.0.3 → 1.0.4
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/npm.cjs +39 -10
- package/dist/npm.cjs.map +1 -1
- package/dist/npm.js +39 -10
- package/dist/npm.js.map +1 -1
- package/package.json +1 -1
package/dist/npm.cjs
CHANGED
|
@@ -14258,6 +14258,31 @@ var createBiscuitBoardAutorouter = (options = {}) => ({
|
|
|
14258
14258
|
var createBiscuitBoardAutorouter2 = (options = {}) => createBiscuitBoardAutorouter(options);
|
|
14259
14259
|
|
|
14260
14260
|
// lib/create-prefabricated-via-autorouter.ts
|
|
14261
|
+
var ROUTER_COORDINATE_SCALE = 1e6;
|
|
14262
|
+
var ROUTER_COORDINATE_EPSILON = 1e-7;
|
|
14263
|
+
var normalizeCoordinate = (value) => Math.round(value * ROUTER_COORDINATE_SCALE) / ROUTER_COORDINATE_SCALE;
|
|
14264
|
+
var normalizePoint = (point) => {
|
|
14265
|
+
const x = normalizeCoordinate(point.x);
|
|
14266
|
+
const y = normalizeCoordinate(point.y);
|
|
14267
|
+
if (Math.abs(x - point.x) <= ROUTER_COORDINATE_EPSILON && Math.abs(y - point.y) <= ROUTER_COORDINATE_EPSILON) {
|
|
14268
|
+
return point;
|
|
14269
|
+
}
|
|
14270
|
+
return { ...point, x, y };
|
|
14271
|
+
};
|
|
14272
|
+
var normalizeRouterTerminalCoordinates = (input) => {
|
|
14273
|
+
let inputChanged = false;
|
|
14274
|
+
const connections = input.connections.map((connection) => {
|
|
14275
|
+
const pointsToConnect = connection.pointsToConnect.map(normalizePoint);
|
|
14276
|
+
if (pointsToConnect.every(
|
|
14277
|
+
(point, pointIndex) => point === connection.pointsToConnect[pointIndex]
|
|
14278
|
+
)) {
|
|
14279
|
+
return connection;
|
|
14280
|
+
}
|
|
14281
|
+
inputChanged = true;
|
|
14282
|
+
return { ...connection, pointsToConnect };
|
|
14283
|
+
});
|
|
14284
|
+
return inputChanged ? { ...input, connections } : input;
|
|
14285
|
+
};
|
|
14261
14286
|
var createPrefabricatedViaAutorouter = ({
|
|
14262
14287
|
width,
|
|
14263
14288
|
height,
|
|
@@ -14269,27 +14294,31 @@ var createPrefabricatedViaAutorouter = ({
|
|
|
14269
14294
|
}) => ({
|
|
14270
14295
|
...createBiscuitBoardAutorouter2(options),
|
|
14271
14296
|
algorithmFn: async (input) => {
|
|
14297
|
+
const normalizedInput = normalizeRouterTerminalCoordinates(input);
|
|
14272
14298
|
const maximumTraceWidth = Math.max(
|
|
14273
|
-
|
|
14274
|
-
|
|
14299
|
+
normalizedInput.minTraceWidth,
|
|
14300
|
+
normalizedInput.nominalTraceWidth ?? 0,
|
|
14275
14301
|
minimumTraceWidth ?? 0,
|
|
14276
14302
|
nominalTraceWidth,
|
|
14277
|
-
...
|
|
14278
|
-
(connection) => connection.width ??
|
|
14303
|
+
...normalizedInput.connections.map(
|
|
14304
|
+
(connection) => connection.width ?? normalizedInput.minTraceWidth
|
|
14279
14305
|
)
|
|
14280
14306
|
);
|
|
14281
14307
|
return new BiscuitBoardAutorouter(
|
|
14282
14308
|
{
|
|
14283
|
-
...
|
|
14284
|
-
minTraceWidth: Math.max(
|
|
14309
|
+
...normalizedInput,
|
|
14310
|
+
minTraceWidth: Math.max(
|
|
14311
|
+
normalizedInput.minTraceWidth,
|
|
14312
|
+
minimumTraceWidth ?? 0
|
|
14313
|
+
),
|
|
14285
14314
|
nominalTraceWidth: Math.max(
|
|
14286
|
-
|
|
14315
|
+
normalizedInput.nominalTraceWidth ?? 0,
|
|
14287
14316
|
nominalTraceWidth,
|
|
14288
14317
|
minimumTraceWidth ?? 0
|
|
14289
14318
|
),
|
|
14290
|
-
connections:
|
|
14319
|
+
connections: normalizedInput.connections.map((connection) => {
|
|
14291
14320
|
const width2 = Math.max(
|
|
14292
|
-
connection.width ??
|
|
14321
|
+
connection.width ?? normalizedInput.minTraceWidth,
|
|
14293
14322
|
minimumTraceWidth ?? 0
|
|
14294
14323
|
);
|
|
14295
14324
|
return {
|
|
@@ -14302,7 +14331,7 @@ var createPrefabricatedViaAutorouter = ({
|
|
|
14302
14331
|
)
|
|
14303
14332
|
};
|
|
14304
14333
|
}),
|
|
14305
|
-
obstacles: [...
|
|
14334
|
+
obstacles: [...normalizedInput.obstacles, ...reservedObstacles],
|
|
14306
14335
|
// The clad DRC measures clearance from the copper edge, while this
|
|
14307
14336
|
// router bound constrains trace centerlines.
|
|
14308
14337
|
minBoardEdgeClearance: edgeClearance + maximumTraceWidth / 2,
|