@tscircuit/checks 0.0.209 → 0.0.210
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 +5 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -229,9 +229,13 @@ function checkPcbTraceSelfShorts(circuitJson) {
|
|
|
229
229
|
const contactDistance = (a.thickness + b.thickness) / 2;
|
|
230
230
|
const dot = (a.x2 - a.x1) * (b.x2 - b.x1) + (a.y2 - a.y1) * (b.y2 - b.y1);
|
|
231
231
|
const cross = (a.x2 - a.x1) * (b.y2 - b.y1) - (a.y2 - a.y1) * (b.x2 - b.x1);
|
|
232
|
+
const directionLengthProduct = Math.hypot(a.x2 - a.x1, a.y2 - a.y1) * Math.hypot(b.x2 - b.x1, b.y2 - b.y1);
|
|
233
|
+
const isForwardOrRightAngle = dot >= -1e-9 * directionLengthProduct;
|
|
232
234
|
const adjacent = a.run === b.run && b.startDistance === a.endDistance;
|
|
233
235
|
if (adjacent && !(dot < 0 && Math.abs(cross) < 1e-9)) continue;
|
|
234
|
-
if (!adjacent && a.run === b.run &&
|
|
236
|
+
if (!adjacent && a.run === b.run && // A right-angle connector can have sqrt(2) times the straight-line
|
|
237
|
+
// distance. Its local copper overlap is still part of the same bend.
|
|
238
|
+
b.startDistance - a.endDistance <= Math.SQRT2 * contactDistance && isForwardOrRightAngle)
|
|
235
239
|
continue;
|
|
236
240
|
const gap = segmentToSegmentMinDistance(
|
|
237
241
|
{ x: a.x1, y: a.y1 },
|