@tscircuit/checks 0.0.204 → 0.0.205

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 CHANGED
@@ -1596,7 +1596,35 @@ var getPolygonShape = (pad) => {
1596
1596
  ]
1597
1597
  };
1598
1598
  };
1599
+ var getRoundedPadCore = (pad) => {
1600
+ if (pad.type !== "pcb_smtpad" || pad.shape !== "rect" && pad.shape !== "rotated_rect" || !pad.corner_radius || pad.corner_radius <= 0)
1601
+ return null;
1602
+ const radius = Math.min(pad.corner_radius, pad.width / 2, pad.height / 2);
1603
+ if (radius === Math.min(pad.width, pad.height) / 2) {
1604
+ const core = {
1605
+ ...pad,
1606
+ shape: "rotated_pill",
1607
+ radius,
1608
+ ccw_rotation: pad.shape === "rotated_rect" ? pad.ccw_rotation : 0
1609
+ };
1610
+ return { core, radius: 0 };
1611
+ }
1612
+ return {
1613
+ core: {
1614
+ ...pad,
1615
+ width: pad.width - 2 * radius,
1616
+ height: pad.height - 2 * radius,
1617
+ corner_radius: 0
1618
+ },
1619
+ radius
1620
+ };
1621
+ };
1599
1622
  var getPadToPadGap = (padA, padB) => {
1623
+ const roundedA = getRoundedPadCore(padA);
1624
+ const roundedB = getRoundedPadCore(padB);
1625
+ if (roundedA || roundedB) {
1626
+ return getPadToPadGap(roundedA?.core ?? padA, roundedB?.core ?? padB) - (roundedA?.radius ?? 0) - (roundedB?.radius ?? 0);
1627
+ }
1600
1628
  if (isPillPad(padA) && isPillPad(padB)) {
1601
1629
  const pillA = getPillCenterLineForPad(padA);
1602
1630
  const pillB = getPillCenterLineForPad(padB);
@@ -1715,6 +1743,9 @@ var getCenterBetweenCopperEdges = ({
1715
1743
  return midpoint(traceEdge, obstacleEdge);
1716
1744
  };
1717
1745
  var getTraceObstacleClearance = (segment, obstacle) => {
1746
+ const rounded = getRoundedPadCore(obstacle);
1747
+ if (rounded) obstacle = rounded.core;
1748
+ const obstacleRadius = rounded?.radius ?? 0;
1718
1749
  const start = { x: segment.x1, y: segment.y1 };
1719
1750
  const end = { x: segment.x2, y: segment.y2 };
1720
1751
  const traceRadius = segment.thickness / 2;
@@ -1753,12 +1784,12 @@ var getTraceObstacleClearance = (segment, obstacle) => {
1753
1784
  getPolygonShape(obstacle).points
1754
1785
  );
1755
1786
  return {
1756
- gap: clearance.distance - traceRadius,
1787
+ gap: clearance.distance - traceRadius - obstacleRadius,
1757
1788
  center: getCenterBetweenCopperEdges({
1758
1789
  tracePoint: clearance.tracePoint,
1759
1790
  obstaclePoint: clearance.obstaclePoint,
1760
1791
  traceRadius,
1761
- obstacleRadius: 0
1792
+ obstacleRadius
1762
1793
  })
1763
1794
  };
1764
1795
  };