@tscircuit/circuit-json-util 0.0.83 → 0.0.85

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/README.md CHANGED
@@ -47,6 +47,7 @@ It reduces the amount of code to retrieve or join elements from circuit json, it
47
47
  | `getStringFromCircuitJsonTree` | [`lib/getStringFromCircuitJsonTree.ts`](./lib/getStringFromCircuitJsonTree.ts) | Renders a circuit-json tree as text for debugging. |
48
48
  | `getMinimumFlexContainer` | [`lib/get-minimum-flex-container.ts`](./lib/get-minimum-flex-container.ts) | Computes a minimum flex container from layout constraints. |
49
49
  | `getElementRenderLayers` | [`lib/get-element-render-layers.ts`](./lib/get-element-render-layers.ts) | Returns schematic/PCB render layers used for an element. |
50
+ | `computeGapBetweenCopper` | [`lib/compute-gap-between-copper.ts`](./lib/compute-gap-between-copper.ts) | Computes the minimum copper-to-copper gap between two circuit elements by decomposing them into primitive shapes. |
50
51
 
51
52
  ## Standard Usage
52
53
 
@@ -134,3 +135,39 @@ repositionSchematicGroupTo(circuitJson, "g1", { x: 20, y: 15 })
134
135
  ```
135
136
 
136
137
 
138
+
139
+ ## Compute Copper Gap
140
+
141
+ Use `computeGapBetweenCopper` to calculate the minimum copper clearance between two PCB elements.
142
+
143
+ It decomposes each element into primitive shapes (`circle`, `rect`, `polygon`) and returns the minimum distance across all shape-pair combinations. If an element does not produce any supported copper shapes, the function returns `Infinity`.
144
+
145
+ ```ts
146
+ import { computeGapBetweenCopper } from "@tscircuit/circuit-json-util"
147
+
148
+ const gap = computeGapBetweenCopper(
149
+ {
150
+ type: "pcb_smtpad",
151
+ pcb_smtpad_id: "pad1",
152
+ shape: "circle",
153
+ x: 0,
154
+ y: 0,
155
+ radius: 0.5,
156
+ layer: "top",
157
+ },
158
+ {
159
+ type: "pcb_smtpad",
160
+ pcb_smtpad_id: "pad2",
161
+ shape: "rect",
162
+ x: 2,
163
+ y: 0,
164
+ width: 1,
165
+ height: 1,
166
+ layer: "top",
167
+ },
168
+ )
169
+
170
+ console.log(gap) // 1
171
+ ```
172
+
173
+ Currently supported decomposition targets include `pcb_smtpad` (circle/rect/polygon), `pcb_trace` wire segments, `pcb_via`, and `pcb_plated_hole`.
package/dist/index.d.ts CHANGED
@@ -16619,4 +16619,8 @@ declare function getMinimumFlexContainer(children: Array<{
16619
16619
 
16620
16620
  declare function getElementRenderLayers(element: AnyCircuitElement): PcbRenderLayer[];
16621
16621
 
16622
- export { type BoardBounds, type CircuitJsonInputUtilObjects, type CircuitJsonOps, type CircuitJsonTreeNode, type CircuitJsonUtilObjects, type CircuitJsonUtilOptions, type GetCircuitJsonUtilFn, type GetIndexedCircuitJsonUtilFn, type IndexedCircuitJsonUtilOptions, type Size, type SubtreeOptions, applySelector, applySelectorAST, buildSubtree, cju, cjuIndexed, directionToVec, findBoundsAndCenter, getBoardBounds, getBoundsOfPcbElements, getCircuitJsonTree, getElementById, getElementId, getElementRenderLayers, getMinimumFlexContainer, getPrimaryId, getReadableNameForElement, getReadableNameForPcbPort, getReadableNameForPcbSmtpad, getReadableNameForPcbTrace, getStringFromCircuitJsonTree, oppositeDirection, oppositeSide, repositionPcbComponentTo, repositionPcbGroupTo, repositionSchematicComponentTo, repositionSchematicGroupTo, rotateClockwise, rotateCounterClockwise, rotateDirection, su, transformPCBElement, transformPCBElements, transformPCBElement as transformPcbElement, transformPCBElements as transformPcbElements, transformSchematicElement, transformSchematicElements, vecToDirection };
16622
+ declare const computeGapBetweenCopper: (elm1: AnyCircuitElement, elm2: AnyCircuitElement) => number;
16623
+
16624
+ declare const computeClearanceBetweenElements: (elm1: AnyCircuitElement, elm2: AnyCircuitElement) => number;
16625
+
16626
+ export { type BoardBounds, type CircuitJsonInputUtilObjects, type CircuitJsonOps, type CircuitJsonTreeNode, type CircuitJsonUtilObjects, type CircuitJsonUtilOptions, type GetCircuitJsonUtilFn, type GetIndexedCircuitJsonUtilFn, type IndexedCircuitJsonUtilOptions, type Size, type SubtreeOptions, applySelector, applySelectorAST, buildSubtree, cju, cjuIndexed, computeClearanceBetweenElements, computeGapBetweenCopper, directionToVec, findBoundsAndCenter, getBoardBounds, getBoundsOfPcbElements, getCircuitJsonTree, getElementById, getElementId, getElementRenderLayers, getMinimumFlexContainer, getPrimaryId, getReadableNameForElement, getReadableNameForPcbPort, getReadableNameForPcbSmtpad, getReadableNameForPcbTrace, getStringFromCircuitJsonTree, oppositeDirection, oppositeSide, repositionPcbComponentTo, repositionPcbGroupTo, repositionSchematicComponentTo, repositionSchematicGroupTo, rotateClockwise, rotateCounterClockwise, rotateDirection, su, transformPCBElement, transformPCBElements, transformPCBElement as transformPcbElement, transformPCBElements as transformPcbElements, transformSchematicElement, transformSchematicElements, vecToDirection };
package/dist/index.js CHANGED
@@ -1970,12 +1970,389 @@ function getElementRenderLayers(element) {
1970
1970
  }
1971
1971
  return [];
1972
1972
  }
1973
+
1974
+ // lib/shape-distances/geometry.ts
1975
+ var EPSILON = 1e-9;
1976
+ var toRadians = (degrees) => degrees * Math.PI / 180;
1977
+ var clamp = (value, min, max) => Math.max(min, Math.min(max, value));
1978
+ var distanceBetweenPoints = (a, b) => Math.hypot(a.x - b.x, a.y - b.y);
1979
+ var distanceBetweenPointAndSegment = (point, a, b) => {
1980
+ const abX = b.x - a.x;
1981
+ const abY = b.y - a.y;
1982
+ const lengthSquared = abX * abX + abY * abY;
1983
+ if (lengthSquared <= EPSILON) return distanceBetweenPoints(point, a);
1984
+ const t = clamp(
1985
+ ((point.x - a.x) * abX + (point.y - a.y) * abY) / lengthSquared,
1986
+ 0,
1987
+ 1
1988
+ );
1989
+ return Math.hypot(point.x - (a.x + t * abX), point.y - (a.y + t * abY));
1990
+ };
1991
+ var cross = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
1992
+ var isPointOnSegment = (point, a, b) => {
1993
+ if (Math.abs(cross(a, b, point)) > EPSILON) return false;
1994
+ return point.x >= Math.min(a.x, b.x) - EPSILON && point.x <= Math.max(a.x, b.x) + EPSILON && point.y >= Math.min(a.y, b.y) - EPSILON && point.y <= Math.max(a.y, b.y) + EPSILON;
1995
+ };
1996
+ var segmentsIntersect = (a1, a2, b1, b2) => {
1997
+ const c1 = cross(a1, a2, b1);
1998
+ const c2 = cross(a1, a2, b2);
1999
+ const c3 = cross(b1, b2, a1);
2000
+ const c4 = cross(b1, b2, a2);
2001
+ if ((c1 > EPSILON && c2 < -EPSILON || c1 < -EPSILON && c2 > EPSILON) && (c3 > EPSILON && c4 < -EPSILON || c3 < -EPSILON && c4 > EPSILON)) {
2002
+ return true;
2003
+ }
2004
+ return isPointOnSegment(b1, a1, a2) || isPointOnSegment(b2, a1, a2) || isPointOnSegment(a1, b1, b2) || isPointOnSegment(a2, b1, b2);
2005
+ };
2006
+ var getPolygonEdges = (polygon) => {
2007
+ const edges = [];
2008
+ if (polygon.points.length < 2) return edges;
2009
+ for (let i = 0; i < polygon.points.length; i += 1) {
2010
+ const a = polygon.points[i];
2011
+ const b = polygon.points[(i + 1) % polygon.points.length];
2012
+ if (!a || !b) continue;
2013
+ edges.push([a, b]);
2014
+ }
2015
+ return edges;
2016
+ };
2017
+ var isPointInPolygon = (point, polygon) => {
2018
+ for (const [a, b] of getPolygonEdges(polygon)) {
2019
+ if (isPointOnSegment(point, a, b)) return true;
2020
+ }
2021
+ let inside = false;
2022
+ for (let i = 0, j = polygon.points.length - 1; i < polygon.points.length; j = i++) {
2023
+ const pi = polygon.points[i];
2024
+ const pj = polygon.points[j];
2025
+ if (!pi || !pj) continue;
2026
+ const intersects = pi.y > point.y !== pj.y > point.y && point.x < (pj.x - pi.x) * (point.y - pi.y) / (pj.y - pi.y) + pi.x;
2027
+ if (intersects) inside = !inside;
2028
+ }
2029
+ return inside;
2030
+ };
2031
+ var rotatePoint = (point, angleRadians) => ({
2032
+ x: point.x * Math.cos(angleRadians) - point.y * Math.sin(angleRadians),
2033
+ y: point.x * Math.sin(angleRadians) + point.y * Math.cos(angleRadians)
2034
+ });
2035
+ var rectToPolygon = (rect) => {
2036
+ const halfWidth = rect.width / 2;
2037
+ const halfHeight = rect.height / 2;
2038
+ const angle = toRadians(rect.rotationDegrees);
2039
+ return {
2040
+ kind: "polygon",
2041
+ points: [
2042
+ { x: -halfWidth, y: -halfHeight },
2043
+ { x: halfWidth, y: -halfHeight },
2044
+ { x: halfWidth, y: halfHeight },
2045
+ { x: -halfWidth, y: halfHeight }
2046
+ ].map((localPoint) => {
2047
+ const rotated = rotatePoint(localPoint, angle);
2048
+ return { x: rect.centerX + rotated.x, y: rect.centerY + rotated.y };
2049
+ })
2050
+ };
2051
+ };
2052
+
2053
+ // lib/shape-distances/decompose-copper-into-shapes.ts
2054
+ var isFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value);
2055
+ var createWireSegmentRect = (start, end, width) => ({
2056
+ kind: "rect",
2057
+ centerX: (start.x + end.x) / 2,
2058
+ centerY: (start.y + end.y) / 2,
2059
+ width: Math.hypot(end.x - start.x, end.y - start.y),
2060
+ height: width,
2061
+ rotationDegrees: Math.atan2(end.y - start.y, end.x - start.x) * 180 / Math.PI
2062
+ });
2063
+ var decomposeCopperIntoShapes = (element) => {
2064
+ const elm = element;
2065
+ const shapes = [];
2066
+ if (elm.type === "pcb_smtpad") {
2067
+ if (elm.shape === "circle" && isFiniteNumber(elm.radius)) {
2068
+ shapes.push({ kind: "circle", x: elm.x, y: elm.y, radius: elm.radius });
2069
+ }
2070
+ if (elm.shape === "rect" && isFiniteNumber(elm.width) && isFiniteNumber(elm.height)) {
2071
+ shapes.push({
2072
+ kind: "rect",
2073
+ centerX: elm.x,
2074
+ centerY: elm.y,
2075
+ width: elm.width,
2076
+ height: elm.height,
2077
+ rotationDegrees: isFiniteNumber(elm.ccw_rotation) ? elm.ccw_rotation : 0
2078
+ });
2079
+ }
2080
+ if (elm.shape === "polygon" && Array.isArray(elm.points)) {
2081
+ const points = elm.points.filter(
2082
+ (point) => isFiniteNumber(point?.x) && isFiniteNumber(point?.y)
2083
+ );
2084
+ if (points.length >= 3) {
2085
+ shapes.push({ kind: "polygon", points });
2086
+ }
2087
+ }
2088
+ return shapes;
2089
+ }
2090
+ if (elm.type === "pcb_trace" && Array.isArray(elm.route)) {
2091
+ for (let i = 0; i < elm.route.length - 1; i += 1) {
2092
+ const start = elm.route[i];
2093
+ const end = elm.route[i + 1];
2094
+ if (!start || !end || start.route_type !== "wire" || end.route_type !== "wire" || !isFiniteNumber(start.x) || !isFiniteNumber(start.y) || !isFiniteNumber(end.x) || !isFiniteNumber(end.y)) {
2095
+ continue;
2096
+ }
2097
+ const width = isFiniteNumber(start.width) ? Math.max(0, start.width) : 0;
2098
+ const radius = width / 2;
2099
+ shapes.push({ kind: "circle", x: start.x, y: start.y, radius });
2100
+ shapes.push({ kind: "circle", x: end.x, y: end.y, radius });
2101
+ if (Math.hypot(end.x - start.x, end.y - start.y) > EPSILON) {
2102
+ shapes.push(createWireSegmentRect(start, end, width));
2103
+ }
2104
+ }
2105
+ return shapes;
2106
+ }
2107
+ if (elm.type === "pcb_via" && isFiniteNumber(elm.outer_diameter)) {
2108
+ shapes.push({
2109
+ kind: "circle",
2110
+ x: elm.x,
2111
+ y: elm.y,
2112
+ radius: elm.outer_diameter / 2
2113
+ });
2114
+ return shapes;
2115
+ }
2116
+ if (elm.type === "pcb_plated_hole") {
2117
+ if (isFiniteNumber(elm.outer_diameter)) {
2118
+ shapes.push({
2119
+ kind: "circle",
2120
+ x: elm.x,
2121
+ y: elm.y,
2122
+ radius: elm.outer_diameter / 2
2123
+ });
2124
+ }
2125
+ if (isFiniteNumber(elm.rect_pad_width) && isFiniteNumber(elm.rect_pad_height)) {
2126
+ shapes.push({
2127
+ kind: "rect",
2128
+ centerX: elm.x,
2129
+ centerY: elm.y,
2130
+ width: elm.rect_pad_width,
2131
+ height: elm.rect_pad_height,
2132
+ rotationDegrees: isFiniteNumber(elm.rect_ccw_rotation) ? elm.rect_ccw_rotation : 0
2133
+ });
2134
+ }
2135
+ if (isFiniteNumber(elm.outer_width) && isFiniteNumber(elm.outer_height)) {
2136
+ shapes.push({
2137
+ kind: "rect",
2138
+ centerX: elm.x,
2139
+ centerY: elm.y,
2140
+ width: elm.outer_width,
2141
+ height: elm.outer_height,
2142
+ rotationDegrees: 0
2143
+ });
2144
+ }
2145
+ return shapes;
2146
+ }
2147
+ return shapes;
2148
+ };
2149
+
2150
+ // lib/shape-distances/distance-between-shapes.ts
2151
+ var distanceBetweenCircleAndCircle = (a, b) => Math.max(0, Math.hypot(a.x - b.x, a.y - b.y) - a.radius - b.radius);
2152
+ var distanceBetweenPolygonAndPolygon = (a, b) => {
2153
+ if (a.points.length < 3 || b.points.length < 3) {
2154
+ return Number.POSITIVE_INFINITY;
2155
+ }
2156
+ for (const [a1, a2] of getPolygonEdges(a)) {
2157
+ for (const [b1, b2] of getPolygonEdges(b)) {
2158
+ if (segmentsIntersect(a1, a2, b1, b2)) {
2159
+ return 0;
2160
+ }
2161
+ }
2162
+ }
2163
+ const aPoint = a.points[0];
2164
+ const bPoint = b.points[0];
2165
+ if (aPoint && isPointInPolygon(aPoint, b) || bPoint && isPointInPolygon(bPoint, a)) {
2166
+ return 0;
2167
+ }
2168
+ let minDistance = Number.POSITIVE_INFINITY;
2169
+ for (const [a1, a2] of getPolygonEdges(a)) {
2170
+ for (const [b1, b2] of getPolygonEdges(b)) {
2171
+ minDistance = Math.min(
2172
+ minDistance,
2173
+ distanceBetweenPointAndSegment(a1, b1, b2),
2174
+ distanceBetweenPointAndSegment(a2, b1, b2),
2175
+ distanceBetweenPointAndSegment(b1, a1, a2),
2176
+ distanceBetweenPointAndSegment(b2, a1, a2)
2177
+ );
2178
+ }
2179
+ }
2180
+ return minDistance;
2181
+ };
2182
+ var distanceBetweenCircleAndPolygon = (circle, polygon) => {
2183
+ if (polygon.points.length < 3) {
2184
+ return Number.POSITIVE_INFINITY;
2185
+ }
2186
+ if (isPointInPolygon({ x: circle.x, y: circle.y }, polygon)) {
2187
+ return 0;
2188
+ }
2189
+ let minDistanceToEdge = Number.POSITIVE_INFINITY;
2190
+ for (const [start, end] of getPolygonEdges(polygon)) {
2191
+ minDistanceToEdge = Math.min(
2192
+ minDistanceToEdge,
2193
+ distanceBetweenPointAndSegment({ x: circle.x, y: circle.y }, start, end)
2194
+ );
2195
+ }
2196
+ return Math.max(0, minDistanceToEdge - circle.radius);
2197
+ };
2198
+ var distanceBetweenShapes = (a, b) => {
2199
+ if (a.kind === "circle" && b.kind === "circle") {
2200
+ return distanceBetweenCircleAndCircle(a, b);
2201
+ }
2202
+ if (a.kind === "rect" && b.kind === "rect") {
2203
+ return distanceBetweenPolygonAndPolygon(rectToPolygon(a), rectToPolygon(b));
2204
+ }
2205
+ if (a.kind === "circle" && b.kind === "rect") {
2206
+ return distanceBetweenCircleAndPolygon(a, rectToPolygon(b));
2207
+ }
2208
+ if (a.kind === "rect" && b.kind === "circle") {
2209
+ return distanceBetweenCircleAndPolygon(b, rectToPolygon(a));
2210
+ }
2211
+ if (a.kind === "circle" && b.kind === "polygon") {
2212
+ return distanceBetweenCircleAndPolygon(a, b);
2213
+ }
2214
+ if (a.kind === "polygon" && b.kind === "circle") {
2215
+ return distanceBetweenCircleAndPolygon(b, a);
2216
+ }
2217
+ if (a.kind === "rect" && b.kind === "polygon") {
2218
+ return distanceBetweenPolygonAndPolygon(rectToPolygon(a), b);
2219
+ }
2220
+ if (a.kind === "polygon" && b.kind === "rect") {
2221
+ return distanceBetweenPolygonAndPolygon(a, rectToPolygon(b));
2222
+ }
2223
+ if (a.kind === "polygon" && b.kind === "polygon") {
2224
+ return distanceBetweenPolygonAndPolygon(a, b);
2225
+ }
2226
+ return Number.POSITIVE_INFINITY;
2227
+ };
2228
+
2229
+ // lib/compute-gap-between-copper.ts
2230
+ var computeGapBetweenCopper = (elm1, elm2) => {
2231
+ const shapes1 = decomposeCopperIntoShapes(elm1);
2232
+ const shapes2 = decomposeCopperIntoShapes(elm2);
2233
+ if (shapes1.length === 0 || shapes2.length === 0) {
2234
+ return Number.POSITIVE_INFINITY;
2235
+ }
2236
+ let minimumGap = Number.POSITIVE_INFINITY;
2237
+ for (const shape1 of shapes1) {
2238
+ for (const shape2 of shapes2) {
2239
+ minimumGap = Math.min(minimumGap, distanceBetweenShapes(shape1, shape2));
2240
+ }
2241
+ }
2242
+ return minimumGap;
2243
+ };
2244
+
2245
+ // lib/shape-distances/decompose-clearance-into-shapes.ts
2246
+ var isFiniteNumber2 = (value) => typeof value === "number" && Number.isFinite(value);
2247
+ var getCenter = (elm) => {
2248
+ if (isFiniteNumber2(elm?.x) && isFiniteNumber2(elm?.y)) {
2249
+ return { x: elm.x, y: elm.y };
2250
+ }
2251
+ if (isFiniteNumber2(elm?.center?.x) && isFiniteNumber2(elm?.center?.y)) {
2252
+ return { x: elm.center.x, y: elm.center.y };
2253
+ }
2254
+ return null;
2255
+ };
2256
+ var addCenterBasedShapes = (elm, shapes) => {
2257
+ const center = getCenter(elm);
2258
+ if (!center) return;
2259
+ if (elm.shape === "circle") {
2260
+ if (isFiniteNumber2(elm.radius)) {
2261
+ shapes.push({
2262
+ kind: "circle",
2263
+ x: center.x,
2264
+ y: center.y,
2265
+ radius: elm.radius
2266
+ });
2267
+ return;
2268
+ }
2269
+ if (isFiniteNumber2(elm.diameter)) {
2270
+ shapes.push({
2271
+ kind: "circle",
2272
+ x: center.x,
2273
+ y: center.y,
2274
+ radius: elm.diameter / 2
2275
+ });
2276
+ return;
2277
+ }
2278
+ }
2279
+ if (elm.shape === "rect" && isFiniteNumber2(elm.width) && isFiniteNumber2(elm.height)) {
2280
+ shapes.push({
2281
+ kind: "rect",
2282
+ centerX: center.x,
2283
+ centerY: center.y,
2284
+ width: elm.width,
2285
+ height: elm.height,
2286
+ rotationDegrees: isFiniteNumber2(elm.ccw_rotation) ? elm.ccw_rotation : 0
2287
+ });
2288
+ return;
2289
+ }
2290
+ if (elm.shape === "polygon" && Array.isArray(elm.points)) {
2291
+ const points = elm.points.filter(
2292
+ (point) => isFiniteNumber2(point?.x) && isFiniteNumber2(point?.y)
2293
+ );
2294
+ if (points.length >= 3) {
2295
+ shapes.push({ kind: "polygon", points });
2296
+ }
2297
+ }
2298
+ };
2299
+ var decomposeClearanceIntoShapes = (element) => {
2300
+ const elm = element;
2301
+ const shapes = [...decomposeCopperIntoShapes(element)];
2302
+ if (elm.type === "pcb_hole" && elm.hole_shape === "circle") {
2303
+ if (isFiniteNumber2(elm.hole_diameter) && isFiniteNumber2(elm.x) && isFiniteNumber2(elm.y)) {
2304
+ shapes.push({
2305
+ kind: "circle",
2306
+ x: elm.x,
2307
+ y: elm.y,
2308
+ radius: elm.hole_diameter / 2
2309
+ });
2310
+ }
2311
+ return shapes;
2312
+ }
2313
+ if (elm.type === "pcb_plated_hole") {
2314
+ if (isFiniteNumber2(elm.hole_diameter) && isFiniteNumber2(elm.x) && isFiniteNumber2(elm.y)) {
2315
+ const holeOffsetX = isFiniteNumber2(elm.hole_offset_x) ? elm.hole_offset_x : 0;
2316
+ const holeOffsetY = isFiniteNumber2(elm.hole_offset_y) ? elm.hole_offset_y : 0;
2317
+ shapes.push({
2318
+ kind: "circle",
2319
+ x: elm.x + holeOffsetX,
2320
+ y: elm.y + holeOffsetY,
2321
+ radius: elm.hole_diameter / 2
2322
+ });
2323
+ }
2324
+ return shapes;
2325
+ }
2326
+ if (elm.type === "pcb_keepout" || elm.type === "pcb_cutout" || elm.type === "pcb_board") {
2327
+ addCenterBasedShapes(elm, shapes);
2328
+ return shapes;
2329
+ }
2330
+ return shapes;
2331
+ };
2332
+
2333
+ // lib/compute-clearance-between-elements.ts
2334
+ var computeClearanceBetweenElements = (elm1, elm2) => {
2335
+ const shapes1 = decomposeClearanceIntoShapes(elm1);
2336
+ const shapes2 = decomposeClearanceIntoShapes(elm2);
2337
+ if (shapes1.length === 0 || shapes2.length === 0) {
2338
+ return Number.POSITIVE_INFINITY;
2339
+ }
2340
+ let minimumGap = Number.POSITIVE_INFINITY;
2341
+ for (const shape1 of shapes1) {
2342
+ for (const shape2 of shapes2) {
2343
+ minimumGap = Math.min(minimumGap, distanceBetweenShapes(shape1, shape2));
2344
+ }
2345
+ }
2346
+ return minimumGap;
2347
+ };
1973
2348
  export {
1974
2349
  applySelector,
1975
2350
  applySelectorAST,
1976
2351
  buildSubtree,
1977
2352
  cju_default as cju,
1978
2353
  cju_indexed_default as cjuIndexed,
2354
+ computeClearanceBetweenElements,
2355
+ computeGapBetweenCopper,
1979
2356
  directionToVec,
1980
2357
  findBoundsAndCenter,
1981
2358
  getBoardBounds,