@tscircuit/core 0.0.2152 → 0.0.2154
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.js +300 -118
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7179,50 +7179,248 @@ function getSavedTraceViaContactWidths(route, viaIndex, fallbackWidth) {
|
|
|
7179
7179
|
};
|
|
7180
7180
|
}
|
|
7181
7181
|
|
|
7182
|
-
// lib/components/primitive-components/Trace/
|
|
7183
|
-
var
|
|
7184
|
-
function
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
return
|
|
7192
|
-
(
|
|
7182
|
+
// lib/components/primitive-components/Trace/update-pcb-trace-teardrop-contacts.ts
|
|
7183
|
+
var pcbTraceTeardropRenderStateByRoot = /* @__PURE__ */ new WeakMap();
|
|
7184
|
+
function getRoutePointGeometryJson(routePoint) {
|
|
7185
|
+
const { is_inside_copper_pour, copper_pour_id, ...rest } = routePoint;
|
|
7186
|
+
return JSON.stringify(rest);
|
|
7187
|
+
}
|
|
7188
|
+
function hasSameGeneratedGeometry(currentRoute, generatedRoute) {
|
|
7189
|
+
if (currentRoute === generatedRoute) return true;
|
|
7190
|
+
if (currentRoute.length !== generatedRoute.length) return false;
|
|
7191
|
+
return currentRoute.every(
|
|
7192
|
+
(routePoint, routePointIndex) => getRoutePointGeometryJson(routePoint) === getRoutePointGeometryJson(generatedRoute[routePointIndex])
|
|
7193
|
+
);
|
|
7194
|
+
}
|
|
7195
|
+
function getPcbTraceTeardropRenderStateByPcbTraceId(root) {
|
|
7196
|
+
const existingState = pcbTraceTeardropRenderStateByRoot.get(root);
|
|
7197
|
+
if (existingState) return existingState;
|
|
7198
|
+
const createdState = /* @__PURE__ */ new Map();
|
|
7199
|
+
pcbTraceTeardropRenderStateByRoot.set(root, createdState);
|
|
7200
|
+
return createdState;
|
|
7201
|
+
}
|
|
7202
|
+
function refreshPcbTraceTeardropBaseline({
|
|
7203
|
+
pcbTrace,
|
|
7204
|
+
pcbTraceTeardropRenderState
|
|
7205
|
+
}) {
|
|
7206
|
+
if (hasSameGeneratedGeometry(
|
|
7207
|
+
pcbTrace.route,
|
|
7208
|
+
pcbTraceTeardropRenderState.generatedRoute
|
|
7209
|
+
)) {
|
|
7210
|
+
return false;
|
|
7211
|
+
}
|
|
7212
|
+
pcbTraceTeardropRenderState.originalRoute = pcbTrace.route;
|
|
7213
|
+
pcbTraceTeardropRenderState.generatedRoute = pcbTrace.route;
|
|
7214
|
+
return true;
|
|
7215
|
+
}
|
|
7216
|
+
function getRouteWithExplicitViaContacts({
|
|
7217
|
+
route,
|
|
7218
|
+
contacts
|
|
7219
|
+
}) {
|
|
7220
|
+
return route.flatMap((routePoint, routePointIndex) => {
|
|
7221
|
+
if (routePoint.route_type !== "via" || !contacts.some(
|
|
7222
|
+
(contact) => Math.hypot(contact.x - routePoint.x, contact.y - routePoint.y) < 1e-6
|
|
7223
|
+
)) {
|
|
7224
|
+
return [routePoint];
|
|
7225
|
+
}
|
|
7226
|
+
const { fromWidth, toWidth } = getSavedTraceViaContactWidths(
|
|
7227
|
+
route,
|
|
7228
|
+
routePointIndex,
|
|
7229
|
+
0
|
|
7230
|
+
);
|
|
7231
|
+
if (!fromWidth || !toWidth) return [routePoint];
|
|
7232
|
+
const previousRoutePoint = route[routePointIndex - 1];
|
|
7233
|
+
const nextRoutePoint = route[routePointIndex + 1];
|
|
7234
|
+
const explicitViaContactRoute = [];
|
|
7235
|
+
if (!(previousRoutePoint?.route_type === "wire" && previousRoutePoint.x === routePoint.x && previousRoutePoint.y === routePoint.y && previousRoutePoint.layer === routePoint.from_layer)) {
|
|
7236
|
+
explicitViaContactRoute.push({
|
|
7237
|
+
route_type: "wire",
|
|
7238
|
+
x: routePoint.x,
|
|
7239
|
+
y: routePoint.y,
|
|
7240
|
+
width: fromWidth,
|
|
7241
|
+
layer: routePoint.from_layer
|
|
7242
|
+
});
|
|
7243
|
+
}
|
|
7244
|
+
explicitViaContactRoute.push(routePoint);
|
|
7245
|
+
if (!(nextRoutePoint?.route_type === "wire" && nextRoutePoint.x === routePoint.x && nextRoutePoint.y === routePoint.y && nextRoutePoint.layer === routePoint.to_layer)) {
|
|
7246
|
+
explicitViaContactRoute.push({
|
|
7247
|
+
route_type: "wire",
|
|
7248
|
+
x: routePoint.x,
|
|
7249
|
+
y: routePoint.y,
|
|
7250
|
+
width: toWidth,
|
|
7251
|
+
layer: routePoint.to_layer
|
|
7252
|
+
});
|
|
7253
|
+
}
|
|
7254
|
+
return explicitViaContactRoute;
|
|
7255
|
+
});
|
|
7256
|
+
}
|
|
7257
|
+
function renderPcbTraceTeardrops({
|
|
7258
|
+
root,
|
|
7259
|
+
pcbTraceId,
|
|
7260
|
+
pcbTraceTeardropRenderStateByPcbTraceId
|
|
7261
|
+
}) {
|
|
7262
|
+
const pcbTraceTeardropRenderState = pcbTraceTeardropRenderStateByPcbTraceId.get(pcbTraceId);
|
|
7263
|
+
if (!pcbTraceTeardropRenderState) return;
|
|
7264
|
+
const pcbTrace = root.db.pcb_trace.get(pcbTraceId);
|
|
7265
|
+
if (!pcbTrace) {
|
|
7266
|
+
pcbTraceTeardropRenderStateByPcbTraceId.delete(pcbTraceId);
|
|
7267
|
+
return;
|
|
7268
|
+
}
|
|
7269
|
+
refreshPcbTraceTeardropBaseline({
|
|
7270
|
+
pcbTrace,
|
|
7271
|
+
pcbTraceTeardropRenderState
|
|
7272
|
+
});
|
|
7273
|
+
const contacts = [
|
|
7274
|
+
...pcbTraceTeardropRenderState.contactsBySourceTraceId.values()
|
|
7275
|
+
].flat();
|
|
7276
|
+
const routeWithExplicitViaContacts = getRouteWithExplicitViaContacts({
|
|
7277
|
+
route: pcbTraceTeardropRenderState.originalRoute,
|
|
7278
|
+
contacts
|
|
7279
|
+
});
|
|
7280
|
+
const generatedRoute = addTraceTeardrops(
|
|
7281
|
+
routeWithExplicitViaContacts,
|
|
7282
|
+
contacts
|
|
7193
7283
|
);
|
|
7284
|
+
root.db.pcb_trace.update(pcbTraceId, { route: generatedRoute });
|
|
7285
|
+
if (contacts.length === 0) {
|
|
7286
|
+
pcbTraceTeardropRenderStateByPcbTraceId.delete(pcbTraceId);
|
|
7287
|
+
return;
|
|
7288
|
+
}
|
|
7289
|
+
pcbTraceTeardropRenderState.generatedRoute = generatedRoute;
|
|
7194
7290
|
}
|
|
7291
|
+
function updatePcbTraceTeardropContacts({
|
|
7292
|
+
root,
|
|
7293
|
+
sourceTraceId,
|
|
7294
|
+
contactsByPcbTraceId
|
|
7295
|
+
}) {
|
|
7296
|
+
const pcbTraceTeardropRenderStateByPcbTraceId = getPcbTraceTeardropRenderStateByPcbTraceId(root);
|
|
7297
|
+
const affectedPcbTraceIds = /* @__PURE__ */ new Set();
|
|
7298
|
+
for (const [
|
|
7299
|
+
pcbTraceId,
|
|
7300
|
+
pcbTraceTeardropRenderState
|
|
7301
|
+
] of pcbTraceTeardropRenderStateByPcbTraceId) {
|
|
7302
|
+
const pcbTrace = root.db.pcb_trace.get(pcbTraceId);
|
|
7303
|
+
if (!pcbTrace) {
|
|
7304
|
+
pcbTraceTeardropRenderStateByPcbTraceId.delete(pcbTraceId);
|
|
7305
|
+
continue;
|
|
7306
|
+
}
|
|
7307
|
+
if (refreshPcbTraceTeardropBaseline({
|
|
7308
|
+
pcbTrace,
|
|
7309
|
+
pcbTraceTeardropRenderState
|
|
7310
|
+
})) {
|
|
7311
|
+
affectedPcbTraceIds.add(pcbTraceId);
|
|
7312
|
+
}
|
|
7313
|
+
if (pcbTraceTeardropRenderState.contactsBySourceTraceId.delete(sourceTraceId)) {
|
|
7314
|
+
affectedPcbTraceIds.add(pcbTraceId);
|
|
7315
|
+
}
|
|
7316
|
+
}
|
|
7317
|
+
for (const [pcbTraceId, contacts] of contactsByPcbTraceId) {
|
|
7318
|
+
const pcbTrace = root.db.pcb_trace.get(pcbTraceId);
|
|
7319
|
+
if (!pcbTrace || contacts.length === 0) continue;
|
|
7320
|
+
let pcbTraceTeardropRenderState = pcbTraceTeardropRenderStateByPcbTraceId.get(pcbTraceId);
|
|
7321
|
+
if (!pcbTraceTeardropRenderState) {
|
|
7322
|
+
pcbTraceTeardropRenderState = {
|
|
7323
|
+
originalRoute: pcbTrace.route,
|
|
7324
|
+
generatedRoute: pcbTrace.route,
|
|
7325
|
+
contactsBySourceTraceId: /* @__PURE__ */ new Map()
|
|
7326
|
+
};
|
|
7327
|
+
pcbTraceTeardropRenderStateByPcbTraceId.set(
|
|
7328
|
+
pcbTraceId,
|
|
7329
|
+
pcbTraceTeardropRenderState
|
|
7330
|
+
);
|
|
7331
|
+
} else {
|
|
7332
|
+
refreshPcbTraceTeardropBaseline({
|
|
7333
|
+
pcbTrace,
|
|
7334
|
+
pcbTraceTeardropRenderState
|
|
7335
|
+
});
|
|
7336
|
+
}
|
|
7337
|
+
pcbTraceTeardropRenderState.contactsBySourceTraceId.set(
|
|
7338
|
+
sourceTraceId,
|
|
7339
|
+
contacts
|
|
7340
|
+
);
|
|
7341
|
+
affectedPcbTraceIds.add(pcbTraceId);
|
|
7342
|
+
}
|
|
7343
|
+
for (const pcbTraceId of affectedPcbTraceIds) {
|
|
7344
|
+
renderPcbTraceTeardrops({
|
|
7345
|
+
root,
|
|
7346
|
+
pcbTraceId,
|
|
7347
|
+
pcbTraceTeardropRenderStateByPcbTraceId
|
|
7348
|
+
});
|
|
7349
|
+
}
|
|
7350
|
+
}
|
|
7351
|
+
|
|
7352
|
+
// lib/components/primitive-components/Trace/Trace_doInitialPcbTraceTeardropRender.ts
|
|
7195
7353
|
function getPadDiameter(pad) {
|
|
7196
7354
|
if (pad.shape === "polygon") return 0;
|
|
7197
7355
|
if (pad.shape === "circle") return pad.radius * 2;
|
|
7198
7356
|
return Math.min(pad.width, pad.height);
|
|
7199
7357
|
}
|
|
7200
|
-
function
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
const
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7358
|
+
function getConnectedPcbTraces({
|
|
7359
|
+
root,
|
|
7360
|
+
sourceTraceId
|
|
7361
|
+
}) {
|
|
7362
|
+
const sourceTrace = root.db.source_trace.get(sourceTraceId);
|
|
7363
|
+
const connectivityMapKey = sourceTrace?.subcircuit_connectivity_map_key;
|
|
7364
|
+
if (!connectivityMapKey) {
|
|
7365
|
+
return root.db.pcb_trace.list({ source_trace_id: sourceTraceId });
|
|
7366
|
+
}
|
|
7367
|
+
return root.db.pcb_trace.list().filter((pcbTrace) => {
|
|
7368
|
+
if (pcbTrace.source_trace_id === sourceTraceId) return true;
|
|
7369
|
+
if (!pcbTrace.source_trace_id) return false;
|
|
7370
|
+
const routedSourceTrace = root.db.source_trace.get(pcbTrace.source_trace_id);
|
|
7371
|
+
return routedSourceTrace?.subcircuit_connectivity_map_key === connectivityMapKey;
|
|
7372
|
+
});
|
|
7373
|
+
}
|
|
7374
|
+
function getTeardropContacts({
|
|
7375
|
+
root,
|
|
7376
|
+
pcbTrace,
|
|
7377
|
+
enabledPorts,
|
|
7378
|
+
padContacts,
|
|
7379
|
+
enableUnmatchedVias
|
|
7380
|
+
}) {
|
|
7381
|
+
const contacts = [...padContacts];
|
|
7382
|
+
for (const via of root.db.pcb_via.list({
|
|
7383
|
+
pcb_trace_id: pcbTrace.pcb_trace_id
|
|
7384
|
+
})) {
|
|
7385
|
+
const endpoint = enabledPorts.find(({ port }) => {
|
|
7386
|
+
const position = port._getGlobalPcbPositionAfterLayout();
|
|
7387
|
+
return Math.hypot(position.x - via.x, position.y - via.y) < 1e-6;
|
|
7388
|
+
});
|
|
7389
|
+
if (!(endpoint ? endpoint.enabled : enableUnmatchedVias)) continue;
|
|
7390
|
+
for (const layer of via.layers) {
|
|
7391
|
+
contacts.push({
|
|
7392
|
+
x: via.x,
|
|
7393
|
+
y: via.y,
|
|
7394
|
+
layer,
|
|
7395
|
+
diameter: via.outer_diameter
|
|
7396
|
+
});
|
|
7397
|
+
}
|
|
7398
|
+
}
|
|
7399
|
+
return contacts;
|
|
7400
|
+
}
|
|
7401
|
+
function isTeardropEnabledForSelector({
|
|
7402
|
+
selector,
|
|
7403
|
+
selectors,
|
|
7404
|
+
props
|
|
7405
|
+
}) {
|
|
7406
|
+
if (selector === selectors[0]) {
|
|
7407
|
+
return props.pcbTeardropStart ?? props.pcbTeardrops ?? false;
|
|
7408
|
+
}
|
|
7409
|
+
if (selector === selectors.at(-1)) {
|
|
7410
|
+
return props.pcbTeardropEnd ?? props.pcbTeardrops ?? false;
|
|
7411
|
+
}
|
|
7412
|
+
return props.pcbTeardrops ?? false;
|
|
7413
|
+
}
|
|
7414
|
+
function getPadContacts({
|
|
7415
|
+
root,
|
|
7416
|
+
enabledPorts
|
|
7417
|
+
}) {
|
|
7222
7418
|
const padContacts = [];
|
|
7223
7419
|
for (const { port, enabled } of enabledPorts) {
|
|
7224
7420
|
if (!enabled || !port.pcb_port_id) continue;
|
|
7225
|
-
for (const pad of
|
|
7421
|
+
for (const pad of root.db.pcb_smtpad.list({
|
|
7422
|
+
pcb_port_id: port.pcb_port_id
|
|
7423
|
+
})) {
|
|
7226
7424
|
if (pad.shape === "polygon") continue;
|
|
7227
7425
|
padContacts.push({
|
|
7228
7426
|
x: pad.x,
|
|
@@ -7231,84 +7429,66 @@ function Trace_doInitialPcbTraceTeardropRender(trace) {
|
|
|
7231
7429
|
diameter: getPadDiameter(pad)
|
|
7232
7430
|
});
|
|
7233
7431
|
}
|
|
7234
|
-
for (const hole of
|
|
7432
|
+
for (const hole of root.db.pcb_plated_hole.list({
|
|
7235
7433
|
pcb_port_id: port.pcb_port_id
|
|
7236
7434
|
})) {
|
|
7237
7435
|
if (hole.shape !== "circle") continue;
|
|
7238
|
-
for (const layer of hole.layers)
|
|
7436
|
+
for (const layer of hole.layers) {
|
|
7239
7437
|
padContacts.push({
|
|
7240
7438
|
x: hole.x,
|
|
7241
7439
|
y: hole.y,
|
|
7242
7440
|
layer,
|
|
7243
7441
|
diameter: hole.outer_diameter
|
|
7244
7442
|
});
|
|
7443
|
+
}
|
|
7245
7444
|
}
|
|
7246
7445
|
}
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7446
|
+
return padContacts;
|
|
7447
|
+
}
|
|
7448
|
+
function Trace_doInitialPcbTraceTeardropRender(trace) {
|
|
7449
|
+
if (!trace.root || trace.root.pcbDisabled || !trace.source_trace_id) return;
|
|
7450
|
+
const root = trace.root;
|
|
7451
|
+
const sourceTraceId = trace.source_trace_id;
|
|
7452
|
+
const props = trace._parsedProps;
|
|
7453
|
+
const contactsByPcbTraceId = /* @__PURE__ */ new Map();
|
|
7454
|
+
const anyTeardropsEnabled = Boolean(
|
|
7455
|
+
props.pcbTeardrops || props.pcbTeardropStart || props.pcbTeardropEnd
|
|
7456
|
+
);
|
|
7457
|
+
const connected = anyTeardropsEnabled ? trace._findConnectedPorts() : void 0;
|
|
7458
|
+
if (connected?.allPortsFound) {
|
|
7459
|
+
const selectors = trace._getTracePortOrNetSelectorListFromProps();
|
|
7460
|
+
const enabledPorts = connected.portsWithSelectors.map(
|
|
7461
|
+
({ port, selector }) => ({
|
|
7462
|
+
port,
|
|
7463
|
+
enabled: isTeardropEnabledForSelector({
|
|
7464
|
+
selector,
|
|
7465
|
+
selectors,
|
|
7466
|
+
props
|
|
7467
|
+
})
|
|
7468
|
+
})
|
|
7469
|
+
);
|
|
7470
|
+
const padContacts = getPadContacts({ root, enabledPorts });
|
|
7471
|
+
for (const pcbTrace of getConnectedPcbTraces({
|
|
7472
|
+
root,
|
|
7473
|
+
sourceTraceId
|
|
7254
7474
|
})) {
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
diameter: via.outer_diameter
|
|
7266
|
-
});
|
|
7475
|
+
contactsByPcbTraceId.set(
|
|
7476
|
+
pcbTrace.pcb_trace_id,
|
|
7477
|
+
getTeardropContacts({
|
|
7478
|
+
root,
|
|
7479
|
+
pcbTrace,
|
|
7480
|
+
enabledPorts,
|
|
7481
|
+
padContacts,
|
|
7482
|
+
enableUnmatchedVias: props.pcbTeardrops ?? false
|
|
7483
|
+
})
|
|
7484
|
+
);
|
|
7267
7485
|
}
|
|
7268
|
-
const wireContacts = pcbTrace.route.flatMap(
|
|
7269
|
-
(point6, index2) => {
|
|
7270
|
-
if (point6.route_type !== "via" || !contacts.some(
|
|
7271
|
-
(contact) => Math.hypot(contact.x - point6.x, contact.y - point6.y) < 1e-6
|
|
7272
|
-
))
|
|
7273
|
-
return [point6];
|
|
7274
|
-
const { fromWidth, toWidth } = getSavedTraceViaContactWidths(
|
|
7275
|
-
pcbTrace.route,
|
|
7276
|
-
index2,
|
|
7277
|
-
0
|
|
7278
|
-
);
|
|
7279
|
-
if (!fromWidth || !toWidth) return [point6];
|
|
7280
|
-
const before = pcbTrace.route[index2 - 1];
|
|
7281
|
-
const after = pcbTrace.route[index2 + 1];
|
|
7282
|
-
const result = [];
|
|
7283
|
-
if (!(before?.route_type === "wire" && before.x === point6.x && before.y === point6.y && before.layer === point6.from_layer))
|
|
7284
|
-
result.push({
|
|
7285
|
-
route_type: "wire",
|
|
7286
|
-
x: point6.x,
|
|
7287
|
-
y: point6.y,
|
|
7288
|
-
width: fromWidth,
|
|
7289
|
-
layer: point6.from_layer
|
|
7290
|
-
});
|
|
7291
|
-
result.push(point6);
|
|
7292
|
-
if (!(after?.route_type === "wire" && after.x === point6.x && after.y === point6.y && after.layer === point6.to_layer))
|
|
7293
|
-
result.push({
|
|
7294
|
-
route_type: "wire",
|
|
7295
|
-
x: point6.x,
|
|
7296
|
-
y: point6.y,
|
|
7297
|
-
width: toWidth,
|
|
7298
|
-
layer: point6.to_layer
|
|
7299
|
-
});
|
|
7300
|
-
return result;
|
|
7301
|
-
}
|
|
7302
|
-
);
|
|
7303
|
-
const route = addTraceTeardrops(wireContacts, contacts);
|
|
7304
|
-
if (route.length === pcbTrace.route.length) continue;
|
|
7305
|
-
outputs.set(pcbTrace.pcb_trace_id, {
|
|
7306
|
-
original: pcbTrace.route,
|
|
7307
|
-
generated: route
|
|
7308
|
-
});
|
|
7309
|
-
db2.pcb_trace.update(pcbTrace.pcb_trace_id, { route });
|
|
7310
7486
|
}
|
|
7311
|
-
|
|
7487
|
+
updatePcbTraceTeardropContacts({
|
|
7488
|
+
root,
|
|
7489
|
+
sourceTraceId,
|
|
7490
|
+
contactsByPcbTraceId
|
|
7491
|
+
});
|
|
7312
7492
|
}
|
|
7313
7493
|
|
|
7314
7494
|
// lib/components/primitive-components/Trace/Trace_doInitialPcbTraceRender.ts
|
|
@@ -118982,7 +119162,7 @@ var RoutingPhasePreparationError = class extends Error {
|
|
|
118982
119162
|
var package_default = {
|
|
118983
119163
|
name: "@tscircuit/core",
|
|
118984
119164
|
type: "module",
|
|
118985
|
-
version: "0.0.
|
|
119165
|
+
version: "0.0.2153",
|
|
118986
119166
|
types: "dist/index.d.ts",
|
|
118987
119167
|
main: "dist/index.js",
|
|
118988
119168
|
module: "dist/index.js",
|
|
@@ -119749,6 +119929,7 @@ function getAccumulatedPcbTracesWithStageOutputReplacements({
|
|
|
119749
119929
|
// lib/components/primitive-components/Group/get-source-trace-id-for-routed-trace.ts
|
|
119750
119930
|
import { distance as distance18, pointToSegmentDistance as pointToSegmentDistance4 } from "@tscircuit/math-utils";
|
|
119751
119931
|
import { ConnectivityMap as ConnectivityMap6 } from "circuit-json-to-connectivity-map";
|
|
119932
|
+
import { applyToPoint as applyToPoint39, rotateDEG as rotateDEG4 } from "transformation-matrix";
|
|
119752
119933
|
var POINT_EPSILON3 = 1e-6;
|
|
119753
119934
|
function isPointOnWireSegment({
|
|
119754
119935
|
point: point6,
|
|
@@ -119766,7 +119947,8 @@ function isPointInSmtPad({
|
|
|
119766
119947
|
traceWidth = 0
|
|
119767
119948
|
}) {
|
|
119768
119949
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
119769
|
-
|
|
119950
|
+
const unrotatedPoint = pad.shape === "rotated_rect" ? applyToPoint39(rotateDEG4(-pad.ccw_rotation, pad.x, pad.y), point6) : point6;
|
|
119951
|
+
return Math.abs(unrotatedPoint.x - pad.x) <= pad.width / 2 + traceWidth / 2 && Math.abs(unrotatedPoint.y - pad.y) <= pad.height / 2 + traceWidth / 2;
|
|
119770
119952
|
}
|
|
119771
119953
|
if (pad.shape === "circle") {
|
|
119772
119954
|
return distance18(point6, pad) <= pad.radius + traceWidth / 2;
|
|
@@ -122391,7 +122573,7 @@ import { symbols as symbols7 } from "schematic-symbols";
|
|
|
122391
122573
|
import { ledProps, resolveManufacturerPartNumber as resolveManufacturerPartNumber9 } from "@tscircuit/props";
|
|
122392
122574
|
|
|
122393
122575
|
// lib/components/normal-components/Led_addPolarityFabricationSymbol.ts
|
|
122394
|
-
import { applyToPoint as
|
|
122576
|
+
import { applyToPoint as applyToPoint40, compose as compose17, rotate as rotate7, translate as translate17 } from "transformation-matrix";
|
|
122395
122577
|
var generatedNotes = /* @__PURE__ */ new WeakMap();
|
|
122396
122578
|
var getPolarity2 = (port) => {
|
|
122397
122579
|
const hints = [port.name, ...port.port_hints ?? []].map(
|
|
@@ -122436,7 +122618,7 @@ var Led_addPolarityFabricationSymbol = (led) => {
|
|
|
122436
122618
|
translate17((a2.x + k2.x) / 2, (a2.y + k2.y) / 2),
|
|
122437
122619
|
rotate7(angle)
|
|
122438
122620
|
);
|
|
122439
|
-
const point6 = (x2, y2) =>
|
|
122621
|
+
const point6 = (x2, y2) => applyToPoint40(frame, { x: x2, y: y2 });
|
|
122440
122622
|
const common = {
|
|
122441
122623
|
pcb_component_id: pcb.pcb_component_id,
|
|
122442
122624
|
subcircuit_id: led.getSubcircuit()?.subcircuit_id ?? void 0,
|
|
@@ -127711,10 +127893,10 @@ var AutoroutingPhase = class extends PrimitiveComponent2 {
|
|
|
127711
127893
|
|
|
127712
127894
|
// lib/components/primitive-components/FabricationNoteDimension.ts
|
|
127713
127895
|
import { fabricationNoteDimensionProps } from "@tscircuit/props";
|
|
127714
|
-
import { applyToPoint as
|
|
127896
|
+
import { applyToPoint as applyToPoint42 } from "transformation-matrix";
|
|
127715
127897
|
|
|
127716
127898
|
// lib/utils/pcb/resolve-pcb-dimension-offset-direction.ts
|
|
127717
|
-
import { applyToPoint as
|
|
127899
|
+
import { applyToPoint as applyToPoint41 } from "transformation-matrix";
|
|
127718
127900
|
var resolvePcbDimensionOffsetDirection = ({
|
|
127719
127901
|
from,
|
|
127720
127902
|
offset,
|
|
@@ -127723,7 +127905,7 @@ var resolvePcbDimensionOffsetDirection = ({
|
|
|
127723
127905
|
transform
|
|
127724
127906
|
}) => {
|
|
127725
127907
|
if (offsetDirection) {
|
|
127726
|
-
return
|
|
127908
|
+
return applyToPoint41({ ...transform, e: 0, f: 0 }, offsetDirection);
|
|
127727
127909
|
}
|
|
127728
127910
|
const dx2 = to.x - from.x;
|
|
127729
127911
|
const dy2 = to.y - from.y;
|
|
@@ -127751,13 +127933,13 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
|
127751
127933
|
this.renderError(
|
|
127752
127934
|
`FabricationNoteDimension could not find selector "${input}"`
|
|
127753
127935
|
);
|
|
127754
|
-
return
|
|
127936
|
+
return applyToPoint42(transform, { x: 0, y: 0 });
|
|
127755
127937
|
}
|
|
127756
127938
|
return target._getGlobalPcbPositionBeforeLayout();
|
|
127757
127939
|
}
|
|
127758
127940
|
const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
|
|
127759
127941
|
const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
|
|
127760
|
-
return
|
|
127942
|
+
return applyToPoint42(transform, { x: numericX, y: numericY });
|
|
127761
127943
|
}
|
|
127762
127944
|
doInitialPcbPrimitiveRender() {
|
|
127763
127945
|
if (this.root?.pcbDisabled) return;
|
|
@@ -127861,7 +128043,7 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
|
127861
128043
|
|
|
127862
128044
|
// lib/components/primitive-components/PcbNoteDimension.ts
|
|
127863
128045
|
import { pcbNoteDimensionProps } from "@tscircuit/props";
|
|
127864
|
-
import { applyToPoint as
|
|
128046
|
+
import { applyToPoint as applyToPoint43 } from "transformation-matrix";
|
|
127865
128047
|
var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
127866
128048
|
pcb_note_dimension_id = null;
|
|
127867
128049
|
isPcbPrimitive = true;
|
|
@@ -127878,7 +128060,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
127878
128060
|
);
|
|
127879
128061
|
if (!target) {
|
|
127880
128062
|
this.renderError(`PcbNoteDimension could not find selector "${input}"`);
|
|
127881
|
-
return
|
|
128063
|
+
return applyToPoint43(transform, { x: 0, y: 0 });
|
|
127882
128064
|
}
|
|
127883
128065
|
const targetPcbComponentId = target.pcb_component_id;
|
|
127884
128066
|
const root = this.root;
|
|
@@ -127895,7 +128077,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
127895
128077
|
}
|
|
127896
128078
|
const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
|
|
127897
128079
|
const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
|
|
127898
|
-
return
|
|
128080
|
+
return applyToPoint43(transform, { x: numericX, y: numericY });
|
|
127899
128081
|
}
|
|
127900
128082
|
doInitialPcbPrimitiveRender() {
|
|
127901
128083
|
if (this.root?.pcbDisabled) return;
|
|
@@ -130673,7 +130855,7 @@ import {
|
|
|
130673
130855
|
getTransformedSvgPathRoutes,
|
|
130674
130856
|
loadImageSource
|
|
130675
130857
|
} from "@tscircuit/image-utils";
|
|
130676
|
-
import { applyToPoint as
|
|
130858
|
+
import { applyToPoint as applyToPoint44 } from "transformation-matrix";
|
|
130677
130859
|
var SilkscreenGraphic = class extends PrimitiveComponent2 {
|
|
130678
130860
|
pcb_silkscreen_graphic_id = null;
|
|
130679
130861
|
pcb_silkscreen_graphic_ids = [];
|
|
@@ -130775,7 +130957,7 @@ var SilkscreenGraphic = class extends PrimitiveComponent2 {
|
|
|
130775
130957
|
{ x: halfWidth, y: -halfHeight },
|
|
130776
130958
|
{ x: -halfWidth, y: -halfHeight }
|
|
130777
130959
|
]).map(
|
|
130778
|
-
(point6) =>
|
|
130960
|
+
(point6) => applyToPoint44(transform, point6)
|
|
130779
130961
|
)
|
|
130780
130962
|
},
|
|
130781
130963
|
inner_rings: []
|
|
@@ -134428,7 +134610,7 @@ var SpiceModel = class extends PrimitiveComponent2 {
|
|
|
134428
134610
|
|
|
134429
134611
|
// lib/components/primitive-components/PcbBend.ts
|
|
134430
134612
|
import { pcbBendProps } from "@tscircuit/props";
|
|
134431
|
-
import { applyToPoint as
|
|
134613
|
+
import { applyToPoint as applyToPoint45 } from "transformation-matrix";
|
|
134432
134614
|
|
|
134433
134615
|
// lib/components/primitive-components/getPcbFlexBoardTransform.ts
|
|
134434
134616
|
import { compose as compose20, translate as translate20 } from "transformation-matrix";
|
|
@@ -134462,8 +134644,8 @@ var PcbBend = class extends PrimitiveComponent2 {
|
|
|
134462
134644
|
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
|
|
134463
134645
|
subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0,
|
|
134464
134646
|
name: props.name,
|
|
134465
|
-
start:
|
|
134466
|
-
end:
|
|
134647
|
+
start: applyToPoint45(transform, { x: props.x1, y: props.y1 }),
|
|
134648
|
+
end: applyToPoint45(transform, { x: props.x2, y: props.y2 }),
|
|
134467
134649
|
bend_angle: props.bendAngle,
|
|
134468
134650
|
bend_radius: props.bendRadius,
|
|
134469
134651
|
bend_side: props.bendSide
|
|
@@ -134499,7 +134681,7 @@ var PcbBend = class extends PrimitiveComponent2 {
|
|
|
134499
134681
|
|
|
134500
134682
|
// lib/components/primitive-components/PcbStiffener.ts
|
|
134501
134683
|
import { pcbStiffenerProps } from "@tscircuit/props";
|
|
134502
|
-
import { applyToPoint as
|
|
134684
|
+
import { applyToPoint as applyToPoint46, decomposeTSR as decomposeTSR12 } from "transformation-matrix";
|
|
134503
134685
|
var PcbStiffener = class extends PrimitiveComponent2 {
|
|
134504
134686
|
pcb_stiffener_id = null;
|
|
134505
134687
|
get config() {
|
|
@@ -134522,14 +134704,14 @@ var PcbStiffener = class extends PrimitiveComponent2 {
|
|
|
134522
134704
|
};
|
|
134523
134705
|
const geometry = props.shape === "rect" ? {
|
|
134524
134706
|
shape: "rect",
|
|
134525
|
-
center:
|
|
134707
|
+
center: applyToPoint46(transform, { x: 0, y: 0 }),
|
|
134526
134708
|
rotation: decomposeTSR12(transform).rotation.angle * 180 / Math.PI,
|
|
134527
134709
|
width: props.width,
|
|
134528
134710
|
height: props.height
|
|
134529
134711
|
} : {
|
|
134530
134712
|
shape: "polygon",
|
|
134531
134713
|
outline: props.outline.map(
|
|
134532
|
-
(point6) =>
|
|
134714
|
+
(point6) => applyToPoint46(transform, point6)
|
|
134533
134715
|
)
|
|
134534
134716
|
};
|
|
134535
134717
|
this.pcb_stiffener_id = db2.pcb_stiffener.insert({
|