brepjs 12.7.1 → 12.7.3

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.
Files changed (61) hide show
  1. package/dist/2d.cjs +2 -2
  2. package/dist/2d.js +11 -11
  3. package/dist/{Blueprint-CtuUvzex.js → Blueprint-C3lWY1Jf.js} +21 -20
  4. package/dist/{Blueprint-CoFJDAQd.cjs → Blueprint-CnDVffSX.cjs} +3 -2
  5. package/dist/{boolean2D-x2irapGj.js → boolean2D-CwZAIJDS.js} +15 -17
  6. package/dist/{boolean2D-Dk-vLBdl.cjs → boolean2D-DyQJt8Na.cjs} +3 -5
  7. package/dist/{booleanFns-DtOkwLHI.js → booleanFns-CcNUsgI8.js} +3 -3
  8. package/dist/{booleanFns-BJjYqwJ5.cjs → booleanFns-D7HmkpYt.cjs} +2 -2
  9. package/dist/brepjs.cjs +99 -43
  10. package/dist/brepjs.js +1006 -950
  11. package/dist/core.cjs +1 -1
  12. package/dist/core.js +1 -1
  13. package/dist/{cornerFinder-BESZIitp.cjs → cornerFinder-3zfbQvXg.cjs} +1 -1
  14. package/dist/{cornerFinder-FY38t0zq.js → cornerFinder-BV-l1BCw.js} +1 -1
  15. package/dist/{curveFns-LRNGcHXh.js → curveFns-CloOqAQ_.js} +11 -11
  16. package/dist/{drawFns-D8QyY7cg.js → drawFns-5myJTgtX.js} +69 -325
  17. package/dist/{drawFns-BEeoD1yO.cjs → drawFns-CDNafQhv.cjs} +64 -320
  18. package/dist/{helpers-DNzVfe-Z.cjs → helpers-6kn30cSD.cjs} +1 -1
  19. package/dist/{helpers-DeFPsrcI.js → helpers-C9KvE1RW.js} +6 -6
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/io.cjs +2 -2
  23. package/dist/io.js +2 -2
  24. package/dist/kernel/brepkitAdapter.d.ts.map +1 -1
  25. package/dist/kernel/brepkitWasmTypes.d.ts +5 -1
  26. package/dist/kernel/brepkitWasmTypes.d.ts.map +1 -1
  27. package/dist/{loft-DsVv4yxU.js → loft-BcZUCGKi.js} +1 -1
  28. package/dist/{meshFns-BU2l_yOm.cjs → meshFns-3gy0empP.cjs} +1 -1
  29. package/dist/{meshFns-HNwWuM4v.js → meshFns-DsLRd3tA.js} +1 -1
  30. package/dist/{operations-D-gTZNtM.cjs → operations-DLFzmdFX.cjs} +2 -2
  31. package/dist/{operations-D_3rrfrE.js → operations-Dcz6YlOt.js} +3 -3
  32. package/dist/operations.cjs +1 -1
  33. package/dist/operations.js +2 -2
  34. package/dist/query.cjs +2 -2
  35. package/dist/query.js +4 -4
  36. package/dist/{shapeFns-DHlLNHTn.cjs → shapeFns-D-MOoqJd.cjs} +4 -0
  37. package/dist/{shapeFns-CbXxLvV_.js → shapeFns-D2PlLFE6.js} +11 -7
  38. package/dist/sketching/Sketcher.d.ts +31 -77
  39. package/dist/sketching/Sketcher.d.ts.map +1 -1
  40. package/dist/sketching/Sketcher2d.d.ts +1 -1
  41. package/dist/sketching/Sketcher2d.d.ts.map +1 -1
  42. package/dist/sketching/draw.d.ts +2 -2
  43. package/dist/sketching/draw.d.ts.map +1 -1
  44. package/dist/sketching/sketcherlib.d.ts +32 -1
  45. package/dist/sketching/sketcherlib.d.ts.map +1 -1
  46. package/dist/sketching.cjs +2 -2
  47. package/dist/sketching.js +2 -2
  48. package/dist/{surfaceBuilders-D7ZH2QNS.js → surfaceBuilders-D6iDVPIM.js} +12 -12
  49. package/dist/topology/shapeFns.d.ts +5 -0
  50. package/dist/topology/shapeFns.d.ts.map +1 -1
  51. package/dist/{topology-BHnY7Szr.cjs → topology-CKtCGLmb.cjs} +3 -3
  52. package/dist/{topology-C1eZ86dI.js → topology-DxD58iQ6.js} +5 -5
  53. package/dist/topology.cjs +5 -4
  54. package/dist/topology.d.ts +1 -1
  55. package/dist/topology.d.ts.map +1 -1
  56. package/dist/topology.js +23 -22
  57. package/dist/{vectors-TlfO1hu2.cjs → vectors-BafmMf96.cjs} +0 -5
  58. package/dist/{vectors-cec8p8NQ.js → vectors-CESkzEm6.js} +1 -6
  59. package/dist/vectors.cjs +1 -1
  60. package/dist/vectors.js +1 -1
  61. package/package.json +2 -2
package/dist/brepjs.js CHANGED
@@ -26,10 +26,10 @@ var __using = (stack, value, async) => {
26
26
  return value;
27
27
  };
28
28
  var __callDispose = (stack, error, hasError) => {
29
- var E6 = typeof SuppressedError === "function" ? SuppressedError : function(e8, s6, m10, _2) {
29
+ var E7 = typeof SuppressedError === "function" ? SuppressedError : function(e8, s6, m10, _2) {
30
30
  return _2 = Error(m10), _2.name = "SuppressedError", _2.error = e8, _2.suppressed = s6, _2;
31
31
  };
32
- var fail = (e8) => error = hasError ? new E6(e8, error, "An error was suppressed during disposal") : (hasError = true, e8);
32
+ var fail = (e8) => error = hasError ? new E7(e8, error, "An error was suppressed during disposal") : (hasError = true, e8);
33
33
  var next = (it) => {
34
34
  while (it = stack.pop()) {
35
35
  try {
@@ -49,39 +49,39 @@ import { o as ok, z as translateKernelError, e as err, p as typeCastError, q as
49
49
  import { O as O2, A as A2, a as a2, c, b as b2, f as f2, C as C2, g as g2, m as m2, h as h2, j, l as l2, D, E as E2, F, s as s2, G, H as H2, t as t2, n as n2, u, v as v2, w as w2, x as x2, I as I2 } from "./errors-B7kgv0cd.js";
50
50
  import { c as vecDistance, H as HASH_CODE_MAX, n as vecScale, j as vecNormalize, f as vecIsZero } from "./vecOps-ZDdZWbwT.js";
51
51
  import { D as D2, R as R2, v as v3, a as a3, b as b3, d as d2, e as e2, g as g3, h as h3, i as i2, k, l as l3, m as m3, o as o2 } from "./vecOps-ZDdZWbwT.js";
52
- import { B, d as d3, C as C3, t as t3 } from "./Blueprint-CtuUvzex.js";
53
- import { b as b4, g as g4, r } from "./loft-DsVv4yxU.js";
54
- import { w as walkAssembly, e as extrude$1, r as revolve$1, s as sweep, c as circularPattern, l as linearPattern } from "./operations-D_3rrfrE.js";
55
- import { a as a4, b as b5, d as d4, f as f3, g as g5, h as h4, i as i3, j as j2, k as k2, m as m4, n as n3, o as o3, p, q, t as t4, u as u2, v as v4, x as x3, y as y2, z as z2, A as A3, B as B2, C as C4, D as D3, E as E3, F as F2, G as G2 } from "./operations-D_3rrfrE.js";
56
- import { B as B3, a as a5, e as e3, C as C5, F as F3, S as S2, f as f4, l as l4, g as g6, n as n4, k as k3, q as q2, o as o4, p as p2, r as r2 } from "./boolean2D-x2irapGj.js";
52
+ import { B, e as e3, C as C3, u as u2 } from "./Blueprint-C3lWY1Jf.js";
53
+ import { b as b4, g as g4, r } from "./loft-BcZUCGKi.js";
54
+ import { w as walkAssembly, e as extrude$1, r as revolve$1, s as sweep, c as circularPattern, l as linearPattern } from "./operations-Dcz6YlOt.js";
55
+ import { a as a4, b as b5, d as d3, f as f3, g as g5, h as h4, i as i3, j as j2, k as k2, m as m4, n as n3, o as o3, p, q, t as t3, u as u3, v as v4, x as x3, y as y2, z as z2, A as A3, B as B2, C as C4, D as D3, E as E3, F as F2, G as G2 } from "./operations-Dcz6YlOt.js";
56
+ import { B as B3, a as a5, c as c2, C as C5, F as F3, S as S2, d as d4, j as j3, f as f4, k as k3, h as h5, l as l4, o as o4, p as p2, r as r2 } from "./boolean2D-CwZAIJDS.js";
57
57
  import { createBlueprint, curve2dBoundingBox, curve2dDistanceFrom, curve2dFirstPoint, curve2dIsOnCurve, curve2dLastPoint, curve2dParameter, curve2dSplitAt, curve2dTangentAt, getBounds2D, getOrientation2D, isInside2D, mirror2D, reverseCurve, rotate2D, scale2D, sketch2DOnFace, sketch2DOnPlane, stretch2D, toSVGPathD, translate2D } from "./2d.js";
58
- import { l as createTypedFinder, m as faceFinder } from "./helpers-DeFPsrcI.js";
59
- import { g as g7 } from "./helpers-DeFPsrcI.js";
58
+ import { l as createTypedFinder, m as faceFinder } from "./helpers-C9KvE1RW.js";
59
+ import { g as g6 } from "./helpers-C9KvE1RW.js";
60
60
  import { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportOBJ, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD } from "./io.js";
61
- import { C as C6, D as D4, a as a6, S as S3, b as b6, X, Y, c as c2, d as d5, e as e4, f as f5, Z, g as g8, h as h5, i as i4, j as j3, k as k4, l as l5, m as m5, n as n5, o as o5, p as p3, q as q3, r as r3, s as s3, t as t5, u as u3, v as v5, w as w3, x as x4, y as y3, z as z3, _, $, a0, a1, A as A4, a2 as a22, B as B4, E as E4, a3 as a32, F as F4, G as G3, H as H3, I as I3, J, K, L, M as M2, N as N2, O as O3, P as P2, Q as Q2, R as R3, T, U, a4 as a42, V, a5 as a52, a6 as a62, W } from "./drawFns-D8QyY7cg.js";
61
+ import { C as C6, D as D4, a as a6, S as S3, b as b6, X, Y, c as c3, d as d5, e as e4, f as f5, Z, g as g7, h as h6, i as i4, j as j4, k as k4, l as l5, m as m5, n as n4, o as o5, p as p3, q as q2, r as r3, s as s3, t as t4, u as u4, v as v5, w as w3, x as x4, y as y3, z as z3, _, $, a0, a1, A as A4, a2 as a22, B as B4, E as E4, a3 as a32, F as F4, G as G3, H as H3, I as I3, J, K, L, M as M2, N as N2, O as O3, P as P2, Q as Q2, R as R3, T, U, a4 as a42, V, a5 as a52, a6 as a62, W } from "./drawFns-5myJTgtX.js";
62
62
  import { a as toVec3 } from "./types-CWDdqcrq.js";
63
- import { r as r4, t as t6 } from "./types-CWDdqcrq.js";
64
- import { c as c3, a as a7, p as p4, r as r5, t as t7 } from "./vectors-cec8p8NQ.js";
65
- import { v as vertexPosition, a as getFaces, e as getVertices, d as getEdges, h as getBounds, b as propagateOriginsFromEvolution, g as getFaceOrigins, j as applyMatrix$1, k as clone$1, l as describe$1, m as isEmpty$1, n as mirror$1, r as rotate$1, s as scale$1, o as simplify$1, t as toBREP$1, q as transformCopy$1, u as translate$1, c as getWires } from "./shapeFns-CbXxLvV_.js";
66
- import { w as w4, f as f6, x as x5, i as i5, y as y4, z as z4, A as A5, B as B5, C as C7, D as D5 } from "./shapeFns-CbXxLvV_.js";
67
- import { p as propagateFaceTagsFromEvolution, a as propagateColorsFromEvolution, h as hasFaceTags, b as hasColorMetadata, c as cut$1, f as fuse$1, i as intersect$1, s as section$1, d as sectionToFace$1, e as slice$1, g as split$1, j as fuseAll, k as cutAll } from "./booleanFns-DtOkwLHI.js";
68
- import { l as l6, m as m6, n as n6, o as o6, q as q4, r as r6, t as t8, u as u4, v as v6 } from "./booleanFns-DtOkwLHI.js";
69
- import { c as chamferDistAngle, h as heal$1, i as isValid$1 } from "./topology-C1eZ86dI.js";
70
- import { a as a8, b as b7, d as d6, e as e5, f as f7, g as g9, j as j4, k as k5, l as l7, m as m7, n as n7, o as o7, p as p5, q as q5, r as r7, s as s4, t as t9, u as u5, v as v7, w as w5, x as x6, y as y5, z as z5, A as A6, B as B6, C as C8, D as D6, E as E5, F as F5, G as G4, H as H4, I as I4, J as J2, K as K2, L as L2, M as M3, N as N3, O as O4, P as P3, Q as Q3 } from "./topology-C1eZ86dI.js";
71
- import { e as curveIsClosed, d as curveStartPoint, c as curveTangentAt, h as curvePointAt, a as curveEndPoint, i as curveLength } from "./curveFns-LRNGcHXh.js";
72
- import { j as j5, k as k6, l as l8, f as f8, b as b8, g as g10, m as m8, o as o8 } from "./curveFns-LRNGcHXh.js";
63
+ import { r as r4, t as t5 } from "./types-CWDdqcrq.js";
64
+ import { c as c4, a as a7, p as p4, r as r5, t as t6 } from "./vectors-CESkzEm6.js";
65
+ import { v as vertexPosition, a as getFaces, e as getVertices, d as getEdges, h as getBounds, b as propagateOriginsFromEvolution, g as getFaceOrigins, j as applyMatrix$1, k as clone$1, l as describe$1, m as isEmpty$1, n as mirror$1, r as rotate$1, s as scale$1, o as simplify$1, t as toBREP$1, q as transformCopy$1, u as translate$1, c as getWires } from "./shapeFns-D2PlLFE6.js";
66
+ import { w as w4, f as f6, x as x5, y as y4, i as i5, z as z4, A as A5, B as B5, C as C7, D as D5, E as E5 } from "./shapeFns-D2PlLFE6.js";
67
+ import { p as propagateFaceTagsFromEvolution, a as propagateColorsFromEvolution, h as hasFaceTags, b as hasColorMetadata, c as cut$1, f as fuse$1, i as intersect$1, s as section$1, d as sectionToFace$1, e as slice$1, g as split$1, j as fuseAll, k as cutAll } from "./booleanFns-CcNUsgI8.js";
68
+ import { l as l6, m as m6, n as n5, o as o6, q as q3, r as r6, t as t7, u as u5, v as v6 } from "./booleanFns-CcNUsgI8.js";
69
+ import { c as chamferDistAngle, h as heal$1, i as isValid$1 } from "./topology-DxD58iQ6.js";
70
+ import { a as a8, b as b7, d as d6, e as e5, f as f7, g as g8, j as j5, k as k5, l as l7, m as m7, n as n6, o as o7, p as p5, q as q4, r as r7, s as s4, t as t8, u as u6, v as v7, w as w5, x as x6, y as y5, z as z5, A as A6, B as B6, C as C8, D as D6, E as E6, F as F5, G as G4, H as H4, I as I4, J as J2, K as K2, L as L2, M as M3, N as N3, O as O4, P as P3, Q as Q3 } from "./topology-DxD58iQ6.js";
71
+ import { b as curveIsClosed, c as curveStartPoint, a as curveTangentAt, d as curvePointAt, e as curveEndPoint, f as curveLength } from "./curveFns-CloOqAQ_.js";
72
+ import { h as h7, i as i6, j as j6, k as k6, l as l8, g as g9, m as m8, o as o8 } from "./curveFns-CloOqAQ_.js";
73
73
  import { i as iterTopo, e as faceCenter, n as normalAt, j as fromBREP$1, k as innerWires, o as outerWire, g as getSurfaceType } from "./faceFns-B6ebRh5I.js";
74
- import { l as l9, c as c4, m as m9, d as d7, f as f9, q as q6, r as r8, s as s5, p as p6, t as t10, v as v8, w as w6, u as u6, h as h6 } from "./faceFns-B6ebRh5I.js";
75
- import { m as mesh$1, a as meshEdges$1 } from "./meshFns-HNwWuM4v.js";
76
- import { c as c5, b as b9, e as e6, d as d8, f as f10 } from "./meshFns-HNwWuM4v.js";
74
+ import { l as l9, c as c5, m as m9, d as d7, f as f8, q as q5, r as r8, s as s5, p as p6, t as t9, v as v8, w as w6, u as u7, h as h8 } from "./faceFns-B6ebRh5I.js";
75
+ import { m as mesh$1, a as meshEdges$1 } from "./meshFns-DsLRd3tA.js";
76
+ import { c as c6, b as b8, e as e6, d as d8, f as f9 } from "./meshFns-DsLRd3tA.js";
77
77
  import { m as measureArea, a as measureSurfaceProps, b as measureVolumeProps, c as measureVolume } from "./measurement-oWvhSVZG.js";
78
- import { d as d9, e as e7, f as f11, g as g11, h as h7, i as i6 } from "./measurement-oWvhSVZG.js";
79
- import { m as makeFace } from "./surfaceBuilders-D7ZH2QNS.js";
80
- import { n as n8 } from "./surfaceBuilders-D7ZH2QNS.js";
78
+ import { d as d9, e as e7, f as f10, g as g10, h as h9, i as i7 } from "./measurement-oWvhSVZG.js";
79
+ import { m as makeFace } from "./surfaceBuilders-D6iDVPIM.js";
80
+ import { i as i8 } from "./surfaceBuilders-D6iDVPIM.js";
81
81
  import { edgeFinder } from "./query.js";
82
82
  import { c as makeCylinder } from "./solidBuilders-BXhh5hP2.js";
83
83
  import { BrepBugError, bug } from "./result.js";
84
- import { c as c6 } from "./cornerFinder-FY38t0zq.js";
84
+ import { c as c7 } from "./cornerFinder-BV-l1BCw.js";
85
85
  import { createOperationRegistry, createTaskQueue, createWorkerClient, createWorkerHandler, dequeueTask, enqueueTask, isDisposeRequest, isErrorResponse, isInitRequest, isOperationRequest, isQueueEmpty, isSuccessResponse, pendingCount, registerHandler, rejectAll } from "./worker.js";
86
86
  function supportsProjection(kernel) {
87
87
  return "projectShape" in kernel;
@@ -89,91 +89,91 @@ function supportsProjection(kernel) {
89
89
  function supportsConstraintSketch(kernel) {
90
90
  return "sketchNew" in kernel && "sketchDof" in kernel;
91
91
  }
92
- function evaluateCurve2d(c7, t11) {
93
- switch (c7.__bk2d) {
92
+ function evaluateCurve2d(c8, t10) {
93
+ switch (c8.__bk2d) {
94
94
  case "line":
95
- return [c7.ox + c7.dx * t11, c7.oy + c7.dy * t11];
95
+ return [c8.ox + c8.dx * t10, c8.oy + c8.dy * t10];
96
96
  case "circle": {
97
- const angle = c7.sense ? t11 : -t11;
98
- return [c7.cx + c7.radius * Math.cos(angle), c7.cy + c7.radius * Math.sin(angle)];
97
+ const angle = c8.sense ? t10 : -t10;
98
+ return [c8.cx + c8.radius * Math.cos(angle), c8.cy + c8.radius * Math.sin(angle)];
99
99
  }
100
100
  case "ellipse": {
101
- const angle = c7.sense ? t11 : -t11;
102
- const cos = Math.cos(c7.xDirAngle);
103
- const sin = Math.sin(c7.xDirAngle);
104
- const x7 = c7.majorRadius * Math.cos(angle);
105
- const y6 = c7.minorRadius * Math.sin(angle);
106
- return [c7.cx + x7 * cos - y6 * sin, c7.cy + x7 * sin + y6 * cos];
101
+ const angle = c8.sense ? t10 : -t10;
102
+ const cos = Math.cos(c8.xDirAngle);
103
+ const sin = Math.sin(c8.xDirAngle);
104
+ const x7 = c8.majorRadius * Math.cos(angle);
105
+ const y6 = c8.minorRadius * Math.sin(angle);
106
+ return [c8.cx + x7 * cos - y6 * sin, c8.cy + x7 * sin + y6 * cos];
107
107
  }
108
108
  case "bezier":
109
- return evaluateBezier(c7.poles, t11);
109
+ return evaluateBezier(c8.poles, t10);
110
110
  case "bspline":
111
- return evaluateBSpline2d(c7, t11);
111
+ return evaluateBSpline2d(c8, t10);
112
112
  case "trimmed": {
113
- const mapped = c7.tStart + t11 * (c7.tEnd - c7.tStart);
114
- return evaluateCurve2d(c7.basis, mapped);
113
+ const mapped = c8.tStart + t10 * (c8.tEnd - c8.tStart);
114
+ return evaluateCurve2d(c8.basis, mapped);
115
115
  }
116
116
  }
117
117
  }
118
- function tangentCurve2d(c7, t11) {
119
- switch (c7.__bk2d) {
118
+ function tangentCurve2d(c8, t10) {
119
+ switch (c8.__bk2d) {
120
120
  case "line":
121
- return [c7.dx, c7.dy];
121
+ return [c8.dx, c8.dy];
122
122
  case "circle": {
123
- const angle = c7.sense ? t11 : -t11;
124
- const sign = c7.sense ? 1 : -1;
125
- return [-c7.radius * Math.sin(angle) * sign, c7.radius * Math.cos(angle) * sign];
123
+ const angle = c8.sense ? t10 : -t10;
124
+ const sign = c8.sense ? 1 : -1;
125
+ return [-c8.radius * Math.sin(angle) * sign, c8.radius * Math.cos(angle) * sign];
126
126
  }
127
127
  case "ellipse": {
128
- const angle = c7.sense ? t11 : -t11;
129
- const sign = c7.sense ? 1 : -1;
130
- const cos = Math.cos(c7.xDirAngle);
131
- const sin = Math.sin(c7.xDirAngle);
132
- const dx = -c7.majorRadius * Math.sin(angle) * sign;
133
- const dy = c7.minorRadius * Math.cos(angle) * sign;
128
+ const angle = c8.sense ? t10 : -t10;
129
+ const sign = c8.sense ? 1 : -1;
130
+ const cos = Math.cos(c8.xDirAngle);
131
+ const sin = Math.sin(c8.xDirAngle);
132
+ const dx = -c8.majorRadius * Math.sin(angle) * sign;
133
+ const dy = c8.minorRadius * Math.cos(angle) * sign;
134
134
  return [dx * cos - dy * sin, dx * sin + dy * cos];
135
135
  }
136
136
  case "bezier": {
137
- const h8 = 1e-8;
138
- const p0 = evaluateBezier(c7.poles, Math.max(0, t11 - h8));
139
- const p1 = evaluateBezier(c7.poles, Math.min(1, t11 + h8));
140
- const dt = Math.min(1, t11 + h8) - Math.max(0, t11 - h8);
137
+ const h10 = 1e-8;
138
+ const p0 = evaluateBezier(c8.poles, Math.max(0, t10 - h10));
139
+ const p1 = evaluateBezier(c8.poles, Math.min(1, t10 + h10));
140
+ const dt = Math.min(1, t10 + h10) - Math.max(0, t10 - h10);
141
141
  return [(p1[0] - p0[0]) / dt, (p1[1] - p0[1]) / dt];
142
142
  }
143
143
  case "bspline": {
144
- const h8 = 1e-8;
145
- const kFirst = c7.knots[0];
146
- const kLast = c7.knots[c7.knots.length - 1];
147
- const p0 = evaluateBSpline2d(c7, Math.max(kFirst, t11 - h8));
148
- const p1 = evaluateBSpline2d(c7, Math.min(kLast, t11 + h8));
149
- const dt = Math.min(kLast, t11 + h8) - Math.max(kFirst, t11 - h8);
144
+ const h10 = 1e-8;
145
+ const kFirst = c8.knots[0];
146
+ const kLast = c8.knots[c8.knots.length - 1];
147
+ const p0 = evaluateBSpline2d(c8, Math.max(kFirst, t10 - h10));
148
+ const p1 = evaluateBSpline2d(c8, Math.min(kLast, t10 + h10));
149
+ const dt = Math.min(kLast, t10 + h10) - Math.max(kFirst, t10 - h10);
150
150
  return [(p1[0] - p0[0]) / dt, (p1[1] - p0[1]) / dt];
151
151
  }
152
152
  case "trimmed": {
153
- const mapped = c7.tStart + t11 * (c7.tEnd - c7.tStart);
154
- const tan = tangentCurve2d(c7.basis, mapped);
155
- const scale2 = c7.tEnd - c7.tStart;
153
+ const mapped = c8.tStart + t10 * (c8.tEnd - c8.tStart);
154
+ const tan = tangentCurve2d(c8.basis, mapped);
155
+ const scale2 = c8.tEnd - c8.tStart;
156
156
  return [tan[0] * scale2, tan[1] * scale2];
157
157
  }
158
158
  }
159
159
  }
160
- function curveBounds(c7) {
161
- switch (c7.__bk2d) {
160
+ function curveBounds(c8) {
161
+ switch (c8.__bk2d) {
162
162
  case "line":
163
- return { first: 0, last: c7.len };
163
+ return { first: 0, last: c8.len };
164
164
  case "circle":
165
165
  case "ellipse":
166
166
  return { first: 0, last: 2 * Math.PI };
167
167
  case "bezier":
168
168
  return { first: 0, last: 1 };
169
169
  case "bspline":
170
- return { first: c7.knots[0], last: c7.knots[c7.knots.length - 1] };
170
+ return { first: c8.knots[0], last: c8.knots[c8.knots.length - 1] };
171
171
  case "trimmed":
172
172
  return { first: 0, last: 1 };
173
173
  }
174
174
  }
175
- function curveTypeName(c7) {
176
- switch (c7.__bk2d) {
175
+ function curveTypeName(c8) {
176
+ switch (c8.__bk2d) {
177
177
  case "line":
178
178
  return "LINE";
179
179
  case "circle":
@@ -185,7 +185,7 @@ function curveTypeName(c7) {
185
185
  case "bspline":
186
186
  return "BSPLINE_CURVE";
187
187
  case "trimmed":
188
- return "TRIMMED_" + curveTypeName(c7.basis);
188
+ return "TRIMMED_" + curveTypeName(c8.basis);
189
189
  }
190
190
  }
191
191
  function makeLine2d(x1, y1, x22, y22) {
@@ -218,23 +218,23 @@ function makeEllipse2d(cx, cy, majorRadius, minorRadius, xDirX = 1, xDirY = 0, s
218
218
  function makeBezier2d(poles) {
219
219
  return { __bk2d: "bezier", poles: [...poles] };
220
220
  }
221
- function translateCurve2d(c7, dx, dy) {
222
- switch (c7.__bk2d) {
221
+ function translateCurve2d(c8, dx, dy) {
222
+ switch (c8.__bk2d) {
223
223
  case "line":
224
- return { ...c7, ox: c7.ox + dx, oy: c7.oy + dy };
224
+ return { ...c8, ox: c8.ox + dx, oy: c8.oy + dy };
225
225
  case "circle":
226
- return { ...c7, cx: c7.cx + dx, cy: c7.cy + dy };
226
+ return { ...c8, cx: c8.cx + dx, cy: c8.cy + dy };
227
227
  case "ellipse":
228
- return { ...c7, cx: c7.cx + dx, cy: c7.cy + dy };
228
+ return { ...c8, cx: c8.cx + dx, cy: c8.cy + dy };
229
229
  case "bezier":
230
- return { ...c7, poles: c7.poles.map(([x7, y6]) => [x7 + dx, y6 + dy]) };
230
+ return { ...c8, poles: c8.poles.map(([x7, y6]) => [x7 + dx, y6 + dy]) };
231
231
  case "bspline":
232
- return { ...c7, poles: c7.poles.map(([x7, y6]) => [x7 + dx, y6 + dy]) };
232
+ return { ...c8, poles: c8.poles.map(([x7, y6]) => [x7 + dx, y6 + dy]) };
233
233
  case "trimmed":
234
- return { ...c7, basis: translateCurve2d(c7.basis, dx, dy) };
234
+ return { ...c8, basis: translateCurve2d(c8.basis, dx, dy) };
235
235
  }
236
236
  }
237
- function rotateCurve2d(c7, angle, cx, cy) {
237
+ function rotateCurve2d(c8, angle, cx, cy) {
238
238
  const cos = Math.cos(angle);
239
239
  const sin = Math.sin(angle);
240
240
  const rotatePoint = (x7, y6) => {
@@ -242,65 +242,65 @@ function rotateCurve2d(c7, angle, cx, cy) {
242
242
  const ry = y6 - cy;
243
243
  return [cx + rx * cos - ry * sin, cy + rx * sin + ry * cos];
244
244
  };
245
- switch (c7.__bk2d) {
245
+ switch (c8.__bk2d) {
246
246
  case "line": {
247
- const [ox, oy] = rotatePoint(c7.ox, c7.oy);
248
- const ndx = c7.dx * cos - c7.dy * sin;
249
- const ndy = c7.dx * sin + c7.dy * cos;
250
- return { ...c7, ox, oy, dx: ndx, dy: ndy };
247
+ const [ox, oy] = rotatePoint(c8.ox, c8.oy);
248
+ const ndx = c8.dx * cos - c8.dy * sin;
249
+ const ndy = c8.dx * sin + c8.dy * cos;
250
+ return { ...c8, ox, oy, dx: ndx, dy: ndy };
251
251
  }
252
252
  case "circle": {
253
- const [ncx, ncy] = rotatePoint(c7.cx, c7.cy);
254
- return { ...c7, cx: ncx, cy: ncy };
253
+ const [ncx, ncy] = rotatePoint(c8.cx, c8.cy);
254
+ return { ...c8, cx: ncx, cy: ncy };
255
255
  }
256
256
  case "ellipse": {
257
- const [ncx, ncy] = rotatePoint(c7.cx, c7.cy);
258
- return { ...c7, cx: ncx, cy: ncy, xDirAngle: c7.xDirAngle + angle };
257
+ const [ncx, ncy] = rotatePoint(c8.cx, c8.cy);
258
+ return { ...c8, cx: ncx, cy: ncy, xDirAngle: c8.xDirAngle + angle };
259
259
  }
260
260
  case "bezier":
261
- return { ...c7, poles: c7.poles.map(([x7, y6]) => rotatePoint(x7, y6)) };
261
+ return { ...c8, poles: c8.poles.map(([x7, y6]) => rotatePoint(x7, y6)) };
262
262
  case "bspline":
263
- return { ...c7, poles: c7.poles.map(([x7, y6]) => rotatePoint(x7, y6)) };
263
+ return { ...c8, poles: c8.poles.map(([x7, y6]) => rotatePoint(x7, y6)) };
264
264
  case "trimmed":
265
- return { ...c7, basis: rotateCurve2d(c7.basis, angle, cx, cy) };
265
+ return { ...c8, basis: rotateCurve2d(c8.basis, angle, cx, cy) };
266
266
  }
267
267
  }
268
- function scaleCurve2d(c7, factor, cx, cy) {
268
+ function scaleCurve2d(c8, factor, cx, cy) {
269
269
  const scalePoint = (x7, y6) => [
270
270
  cx + (x7 - cx) * factor,
271
271
  cy + (y6 - cy) * factor
272
272
  ];
273
- switch (c7.__bk2d) {
273
+ switch (c8.__bk2d) {
274
274
  case "line": {
275
- const [ox, oy] = scalePoint(c7.ox, c7.oy);
276
- return { ...c7, ox, oy };
275
+ const [ox, oy] = scalePoint(c8.ox, c8.oy);
276
+ return { ...c8, ox, oy };
277
277
  }
278
278
  case "circle": {
279
- const [ncx, ncy] = scalePoint(c7.cx, c7.cy);
280
- return { ...c7, cx: ncx, cy: ncy, radius: c7.radius * Math.abs(factor) };
279
+ const [ncx, ncy] = scalePoint(c8.cx, c8.cy);
280
+ return { ...c8, cx: ncx, cy: ncy, radius: c8.radius * Math.abs(factor) };
281
281
  }
282
282
  case "ellipse": {
283
- const [ncx, ncy] = scalePoint(c7.cx, c7.cy);
283
+ const [ncx, ncy] = scalePoint(c8.cx, c8.cy);
284
284
  return {
285
- ...c7,
285
+ ...c8,
286
286
  cx: ncx,
287
287
  cy: ncy,
288
- majorRadius: c7.majorRadius * Math.abs(factor),
289
- minorRadius: c7.minorRadius * Math.abs(factor)
288
+ majorRadius: c8.majorRadius * Math.abs(factor),
289
+ minorRadius: c8.minorRadius * Math.abs(factor)
290
290
  };
291
291
  }
292
292
  case "bezier":
293
- return { ...c7, poles: c7.poles.map(([x7, y6]) => scalePoint(x7, y6)) };
293
+ return { ...c8, poles: c8.poles.map(([x7, y6]) => scalePoint(x7, y6)) };
294
294
  case "bspline":
295
- return { ...c7, poles: c7.poles.map(([x7, y6]) => scalePoint(x7, y6)) };
295
+ return { ...c8, poles: c8.poles.map(([x7, y6]) => scalePoint(x7, y6)) };
296
296
  case "trimmed":
297
- return { ...c7, basis: scaleCurve2d(c7.basis, factor, cx, cy) };
297
+ return { ...c8, basis: scaleCurve2d(c8.basis, factor, cx, cy) };
298
298
  }
299
299
  }
300
- function mirrorAtPoint(c7, cx, cy) {
301
- return scaleCurve2d(c7, -1, cx, cy);
300
+ function mirrorAtPoint(c8, cx, cy) {
301
+ return scaleCurve2d(c8, -1, cx, cy);
302
302
  }
303
- function mirrorAcrossAxis(c7, ox, oy, dx, dy) {
303
+ function mirrorAcrossAxis(c8, ox, oy, dx, dy) {
304
304
  const len = Math.sqrt(dx * dx + dy * dy);
305
305
  const nx = dx / len;
306
306
  const ny = dy / len;
@@ -310,33 +310,33 @@ function mirrorAcrossAxis(c7, ox, oy, dx, dy) {
310
310
  const dot = rx * nx + ry * ny;
311
311
  return [ox + 2 * dot * nx - rx, oy + 2 * dot * ny - ry];
312
312
  };
313
- switch (c7.__bk2d) {
313
+ switch (c8.__bk2d) {
314
314
  case "line": {
315
- const [nox, noy] = reflectPoint(c7.ox, c7.oy);
316
- const ndx = 2 * (c7.dx * nx + c7.dy * ny) * nx - c7.dx;
317
- const ndy = 2 * (c7.dx * nx + c7.dy * ny) * ny - c7.dy;
318
- return { ...c7, ox: nox, oy: noy, dx: ndx, dy: ndy };
315
+ const [nox, noy] = reflectPoint(c8.ox, c8.oy);
316
+ const ndx = 2 * (c8.dx * nx + c8.dy * ny) * nx - c8.dx;
317
+ const ndy = 2 * (c8.dx * nx + c8.dy * ny) * ny - c8.dy;
318
+ return { ...c8, ox: nox, oy: noy, dx: ndx, dy: ndy };
319
319
  }
320
320
  case "circle": {
321
- const [ncx, ncy] = reflectPoint(c7.cx, c7.cy);
322
- return { ...c7, cx: ncx, cy: ncy, sense: !c7.sense };
321
+ const [ncx, ncy] = reflectPoint(c8.cx, c8.cy);
322
+ return { ...c8, cx: ncx, cy: ncy, sense: !c8.sense };
323
323
  }
324
324
  case "ellipse": {
325
- const [ncx, ncy] = reflectPoint(c7.cx, c7.cy);
325
+ const [ncx, ncy] = reflectPoint(c8.cx, c8.cy);
326
326
  const cos2 = nx * nx - ny * ny;
327
327
  const sin2 = 2 * nx * ny;
328
328
  const newAngle = Math.atan2(
329
- sin2 * Math.cos(c7.xDirAngle) - cos2 * Math.sin(c7.xDirAngle),
330
- cos2 * Math.cos(c7.xDirAngle) + sin2 * Math.sin(c7.xDirAngle)
329
+ sin2 * Math.cos(c8.xDirAngle) - cos2 * Math.sin(c8.xDirAngle),
330
+ cos2 * Math.cos(c8.xDirAngle) + sin2 * Math.sin(c8.xDirAngle)
331
331
  );
332
- return { ...c7, cx: ncx, cy: ncy, xDirAngle: newAngle, sense: !c7.sense };
332
+ return { ...c8, cx: ncx, cy: ncy, xDirAngle: newAngle, sense: !c8.sense };
333
333
  }
334
334
  case "bezier":
335
- return { ...c7, poles: c7.poles.map(([x7, y6]) => reflectPoint(x7, y6)) };
335
+ return { ...c8, poles: c8.poles.map(([x7, y6]) => reflectPoint(x7, y6)) };
336
336
  case "bspline":
337
- return { ...c7, poles: c7.poles.map(([x7, y6]) => reflectPoint(x7, y6)) };
337
+ return { ...c8, poles: c8.poles.map(([x7, y6]) => reflectPoint(x7, y6)) };
338
338
  case "trimmed":
339
- return { ...c7, basis: mirrorAcrossAxis(c7.basis, ox, oy, dx, dy) };
339
+ return { ...c8, basis: mirrorAcrossAxis(c8.basis, ox, oy, dx, dy) };
340
340
  }
341
341
  }
342
342
  function intersectCurves2dFn(c1, c22, tolerance) {
@@ -357,34 +357,34 @@ function intersectCurves2dFn(c1, c22, tolerance) {
357
357
  const isSelf = c1 === c22;
358
358
  return numericalIntersect(c1, c22, tolerance, isSelf);
359
359
  }
360
- function unwrapCurve(c7) {
361
- let cur = c7;
360
+ function unwrapCurve(c8) {
361
+ let cur = c8;
362
362
  while (cur.__bk2d === "trimmed") cur = cur.basis;
363
363
  return cur;
364
364
  }
365
- function inDomain(c7, t11, tol) {
366
- const b10 = curveBounds(c7);
367
- return t11 >= b10.first - tol && t11 <= b10.last + tol;
365
+ function inDomain(c8, t10, tol) {
366
+ const b9 = curveBounds(c8);
367
+ return t10 >= b9.first - tol && t10 <= b9.last + tol;
368
368
  }
369
- function refineParam(c7, px, py) {
370
- const bounds = curveBounds(c7);
369
+ function refineParam(c8, px, py) {
370
+ const bounds = curveBounds(c8);
371
371
  if (!isFinite(bounds.first) || !isFinite(bounds.last)) return null;
372
372
  const N4 = 80;
373
373
  const dt = (bounds.last - bounds.first) / N4;
374
374
  let bestT = bounds.first;
375
375
  let bestD = Infinity;
376
- for (let i7 = 0; i7 <= N4; i7++) {
377
- const t11 = bounds.first + i7 * dt;
378
- const [ex2, ey2] = evaluateCurve2d(c7, t11);
376
+ for (let i9 = 0; i9 <= N4; i9++) {
377
+ const t10 = bounds.first + i9 * dt;
378
+ const [ex2, ey2] = evaluateCurve2d(c8, t10);
379
379
  const d10 = (ex2 - px) ** 2 + (ey2 - py) ** 2;
380
380
  if (d10 < bestD) {
381
381
  bestD = d10;
382
- bestT = t11;
382
+ bestT = t10;
383
383
  }
384
384
  }
385
- const [sx, sy] = evaluateCurve2d(c7, bounds.first);
386
- const [ex, ey] = evaluateCurve2d(c7, bounds.last);
387
- const [mx, my] = evaluateCurve2d(c7, (bounds.first + bounds.last) / 2);
385
+ const [sx, sy] = evaluateCurve2d(c8, bounds.first);
386
+ const [ex, ey] = evaluateCurve2d(c8, bounds.last);
387
+ const [mx, my] = evaluateCurve2d(c8, (bounds.first + bounds.last) / 2);
388
388
  const geomExtent = Math.max(
389
389
  Math.sqrt((ex - sx) ** 2 + (ey - sy) ** 2),
390
390
  Math.sqrt((mx - sx) ** 2 + (my - sy) ** 2),
@@ -427,14 +427,14 @@ function intersectLineCircle(cLine, line, cCirc, circ, tol) {
427
427
  const fx = line.ox - circ.cx;
428
428
  const fy = line.oy - circ.cy;
429
429
  const a9 = line.dx * line.dx + line.dy * line.dy;
430
- const b10 = 2 * (fx * line.dx + fy * line.dy);
431
- const c7 = fx * fx + fy * fy - circ.radius * circ.radius;
432
- const disc = b10 * b10 - 4 * a9 * c7;
430
+ const b9 = 2 * (fx * line.dx + fy * line.dy);
431
+ const c8 = fx * fx + fy * fy - circ.radius * circ.radius;
432
+ const disc = b9 * b9 - 4 * a9 * c8;
433
433
  if (disc < -tol) return [];
434
434
  const results = [];
435
435
  const sqrtDisc = Math.sqrt(Math.max(0, disc));
436
- const t1 = (-b10 - sqrtDisc) / (2 * a9);
437
- const t22 = (-b10 + sqrtDisc) / (2 * a9);
436
+ const t1 = (-b9 - sqrtDisc) / (2 * a9);
437
+ const t22 = (-b9 + sqrtDisc) / (2 * a9);
438
438
  for (const tLine of disc < tol * tol ? [t1] : [t1, t22]) {
439
439
  if (!inDomain(cLine, tLine, tol)) continue;
440
440
  const px = line.ox + tLine * line.dx;
@@ -456,12 +456,12 @@ function intersectCircleCircle(c1, circ1, c22, circ2, tol) {
456
456
  if (d10 < 1e-14) return [];
457
457
  const a9 = (circ1.radius * circ1.radius - circ2.radius * circ2.radius + d10 * d10) / (2 * d10);
458
458
  const h22 = circ1.radius * circ1.radius - a9 * a9;
459
- const h8 = Math.sqrt(Math.max(0, h22));
459
+ const h10 = Math.sqrt(Math.max(0, h22));
460
460
  const mx = circ1.cx + a9 * dx / d10;
461
461
  const my = circ1.cy + a9 * dy / d10;
462
- const candidates = h8 < tol ? [[mx, my]] : [
463
- [mx + h8 * dy / d10, my - h8 * dx / d10],
464
- [mx - h8 * dy / d10, my + h8 * dx / d10]
462
+ const candidates = h10 < tol ? [[mx, my]] : [
463
+ [mx + h10 * dy / d10, my - h10 * dx / d10],
464
+ [mx - h10 * dy / d10, my + h10 * dx / d10]
465
465
  ];
466
466
  const results = [];
467
467
  for (const [px, py] of candidates) {
@@ -486,22 +486,22 @@ function numericalIntersect(c1, c22, tolerance, isSelf = false) {
486
486
  const N4 = 100;
487
487
  const pts1 = [];
488
488
  const pts2 = [];
489
- for (let i7 = 0; i7 <= N4; i7++) {
490
- const t1 = b1.first + (b1.last - b1.first) * i7 / N4;
489
+ for (let i9 = 0; i9 <= N4; i9++) {
490
+ const t1 = b1.first + (b1.last - b1.first) * i9 / N4;
491
491
  const [x1, y1] = evaluateCurve2d(c1, t1);
492
492
  pts1.push({ t: t1, x: x1, y: y1 });
493
- const t22 = b22.first + (b22.last - b22.first) * i7 / N4;
493
+ const t22 = b22.first + (b22.last - b22.first) * i9 / N4;
494
494
  const [x22, y22] = evaluateCurve2d(c22, t22);
495
495
  pts2.push({ t: t22, x: x22, y: y22 });
496
496
  }
497
497
  const crossTol = Math.max(tolerance * 100, 0.5);
498
498
  const candidates = [];
499
- for (let i7 = 0; i7 < N4; i7++) {
500
- const p1a = pts1[i7];
501
- const p1b = pts1[i7 + 1];
502
- for (let j6 = 0; j6 < N4; j6++) {
503
- const p2a = pts2[j6];
504
- const p2b = pts2[j6 + 1];
499
+ for (let i9 = 0; i9 < N4; i9++) {
500
+ const p1a = pts1[i9];
501
+ const p1b = pts1[i9 + 1];
502
+ for (let j7 = 0; j7 < N4; j7++) {
503
+ const p2a = pts2[j7];
504
+ const p2b = pts2[j7 + 1];
505
505
  const x1min = Math.min(p1a.x, p1b.x) - crossTol;
506
506
  const x1max = Math.max(p1a.x, p1b.x) + crossTol;
507
507
  const y1min = Math.min(p1a.y, p1b.y) - crossTol;
@@ -557,8 +557,8 @@ function numericalIntersect(c1, c22, tolerance, isSelf = false) {
557
557
  }
558
558
  return { points: found, segments: [] };
559
559
  }
560
- function serializeCurve2d(c7) {
561
- return JSON.stringify(c7);
560
+ function serializeCurve2d(c8) {
561
+ return JSON.stringify(c8);
562
562
  }
563
563
  function deserializeCurve2d(data) {
564
564
  return JSON.parse(data);
@@ -566,68 +566,68 @@ function deserializeCurve2d(data) {
566
566
  function createBBox2d() {
567
567
  return { __bk2d_bbox: true, xMin: Infinity, yMin: Infinity, xMax: -Infinity, yMax: -Infinity };
568
568
  }
569
- function addCurveToBBox(bbox, c7, _tol) {
570
- const bounds = curveBounds(c7);
569
+ function addCurveToBBox(bbox, c8, _tol) {
570
+ const bounds = curveBounds(c8);
571
571
  if (!isFinite(bounds.first) || !isFinite(bounds.last)) return;
572
572
  const nSamples = 20;
573
573
  const dt = (bounds.last - bounds.first) / nSamples;
574
- for (let i7 = 0; i7 <= nSamples; i7++) {
575
- const t11 = bounds.first + i7 * dt;
576
- const [x7, y6] = evaluateCurve2d(c7, t11);
574
+ for (let i9 = 0; i9 <= nSamples; i9++) {
575
+ const t10 = bounds.first + i9 * dt;
576
+ const [x7, y6] = evaluateCurve2d(c8, t10);
577
577
  if (x7 < bbox.xMin) bbox.xMin = x7;
578
578
  if (y6 < bbox.yMin) bbox.yMin = y6;
579
579
  if (x7 > bbox.xMax) bbox.xMax = x7;
580
580
  if (y6 > bbox.yMax) bbox.yMax = y6;
581
581
  }
582
582
  }
583
- function evaluateBezier(poles, t11) {
584
- const n9 = poles.length;
583
+ function evaluateBezier(poles, t10) {
584
+ const n7 = poles.length;
585
585
  const work = poles.map(([x7, y6]) => [x7, y6]);
586
- for (let r9 = 1; r9 < n9; r9++) {
587
- for (let i7 = 0; i7 < n9 - r9; i7++) {
588
- const wi = work[i7];
589
- const wi1 = work[i7 + 1];
590
- wi[0] = (1 - t11) * wi[0] + t11 * wi1[0];
591
- wi[1] = (1 - t11) * wi[1] + t11 * wi1[1];
586
+ for (let r9 = 1; r9 < n7; r9++) {
587
+ for (let i9 = 0; i9 < n7 - r9; i9++) {
588
+ const wi = work[i9];
589
+ const wi1 = work[i9 + 1];
590
+ wi[0] = (1 - t10) * wi[0] + t10 * wi1[0];
591
+ wi[1] = (1 - t10) * wi[1] + t10 * wi1[1];
592
592
  }
593
593
  }
594
594
  return work[0];
595
595
  }
596
- function evaluateBSpline2d(c7, t11) {
596
+ function evaluateBSpline2d(c8, t10) {
597
597
  const fullKnots = [];
598
- for (let i7 = 0; i7 < c7.knots.length; i7++) {
599
- const mult = c7.multiplicities[i7] ?? 1;
600
- for (let j6 = 0; j6 < mult; j6++) {
601
- fullKnots.push(c7.knots[i7]);
598
+ for (let i9 = 0; i9 < c8.knots.length; i9++) {
599
+ const mult = c8.multiplicities[i9] ?? 1;
600
+ for (let j7 = 0; j7 < mult; j7++) {
601
+ fullKnots.push(c8.knots[i9]);
602
602
  }
603
603
  }
604
- const p7 = c7.degree;
605
- const n9 = c7.poles.length;
604
+ const p7 = c8.degree;
605
+ const n7 = c8.poles.length;
606
606
  const k7 = fullKnots.length;
607
- const tClamped = Math.max(fullKnots[p7], Math.min(fullKnots[k7 - p7 - 1], t11));
607
+ const tClamped = Math.max(fullKnots[p7], Math.min(fullKnots[k7 - p7 - 1], t10));
608
608
  let span = p7;
609
- for (let i7 = p7; i7 < k7 - p7 - 1; i7++) {
610
- if (tClamped >= fullKnots[i7] && tClamped < fullKnots[i7 + 1]) {
611
- span = i7;
609
+ for (let i9 = p7; i9 < k7 - p7 - 1; i9++) {
610
+ if (tClamped >= fullKnots[i9] && tClamped < fullKnots[i9 + 1]) {
611
+ span = i9;
612
612
  break;
613
613
  }
614
614
  }
615
615
  if (tClamped >= fullKnots[k7 - p7 - 1]) span = k7 - p7 - 2;
616
616
  const d10 = [];
617
- for (let j6 = 0; j6 <= p7; j6++) {
618
- const idx = Math.min(span - p7 + j6, n9 - 1);
619
- const pole = c7.poles[Math.max(0, idx)];
617
+ for (let j7 = 0; j7 <= p7; j7++) {
618
+ const idx = Math.min(span - p7 + j7, n7 - 1);
619
+ const pole = c8.poles[Math.max(0, idx)];
620
620
  d10.push([pole[0], pole[1]]);
621
621
  }
622
622
  for (let r9 = 1; r9 <= p7; r9++) {
623
- for (let j6 = p7; j6 >= r9; j6--) {
624
- const i7 = span - p7 + j6;
625
- const left = fullKnots[i7] ?? 0;
626
- const right = fullKnots[i7 + p7 - r9 + 1] ?? 1;
623
+ for (let j7 = p7; j7 >= r9; j7--) {
624
+ const i9 = span - p7 + j7;
625
+ const left = fullKnots[i9] ?? 0;
626
+ const right = fullKnots[i9 + p7 - r9 + 1] ?? 1;
627
627
  const denom = right - left;
628
628
  const alpha = denom > 1e-15 ? (tClamped - left) / denom : 0;
629
- const dj = d10[j6];
630
- const djPrev = d10[j6 - 1];
629
+ const dj = d10[j7];
630
+ const djPrev = d10[j7 - 1];
631
631
  dj[0] = (1 - alpha) * djPrev[0] + alpha * dj[0];
632
632
  dj[1] = (1 - alpha) * djPrev[1] + alpha * dj[1];
633
633
  }
@@ -669,11 +669,11 @@ function shellHandle(id) {
669
669
  return handle("shell", id);
670
670
  }
671
671
  function compoundHandle(id) {
672
- const h8 = handle("compound", id);
672
+ const h10 = handle("compound", id);
673
673
  if (syntheticCompounds.has(id)) {
674
- return { ...h8, delete: () => syntheticCompounds.delete(id) };
674
+ return { ...h10, delete: () => syntheticCompounds.delete(id) };
675
675
  }
676
- return h8;
676
+ return h10;
677
677
  }
678
678
  function vertexHandle(id) {
679
679
  return handle("vertex", id);
@@ -746,20 +746,20 @@ function translationMatrix(x7, y6, z6) {
746
746
  }
747
747
  function rotationMatrix(angleDeg, axis = [0, 0, 1], center = [0, 0, 0]) {
748
748
  const rad = angleDeg * Math.PI / 180;
749
- const c7 = Math.cos(rad);
749
+ const c8 = Math.cos(rad);
750
750
  const s6 = Math.sin(rad);
751
- const t11 = 1 - c7;
751
+ const t10 = 1 - c8;
752
752
  const len = Math.sqrt(axis[0] ** 2 + axis[1] ** 2 + axis[2] ** 2);
753
753
  const [ux, uy, uz] = [axis[0] / len, axis[1] / len, axis[2] / len];
754
- const r00 = t11 * ux * ux + c7;
755
- const r01 = t11 * ux * uy - s6 * uz;
756
- const r02 = t11 * ux * uz + s6 * uy;
757
- const r10 = t11 * uy * ux + s6 * uz;
758
- const r11 = t11 * uy * uy + c7;
759
- const r12 = t11 * uy * uz - s6 * ux;
760
- const r20 = t11 * uz * ux - s6 * uy;
761
- const r21 = t11 * uz * uy + s6 * ux;
762
- const r22 = t11 * uz * uz + c7;
754
+ const r00 = t10 * ux * ux + c8;
755
+ const r01 = t10 * ux * uy - s6 * uz;
756
+ const r02 = t10 * ux * uz + s6 * uy;
757
+ const r10 = t10 * uy * ux + s6 * uz;
758
+ const r11 = t10 * uy * uy + c8;
759
+ const r12 = t10 * uy * uz - s6 * ux;
760
+ const r20 = t10 * uz * ux - s6 * uy;
761
+ const r21 = t10 * uz * uy + s6 * ux;
762
+ const r22 = t10 * uz * uz + c8;
763
763
  const [cx, cy, cz] = center;
764
764
  const tx = cx - (r00 * cx + r01 * cy + r02 * cz);
765
765
  const ty = cy - (r10 * cx + r11 * cy + r12 * cz);
@@ -949,9 +949,9 @@ class BrepkitAdapter {
949
949
  if (this.bk.compoundFuse) {
950
950
  const solidIds = [];
951
951
  for (const shape2 of shapes) {
952
- const h8 = shape2;
953
- if (h8.type === "compound") {
954
- solidIds.push(...toArray(this.bk.getCompoundSolids(h8.id)));
952
+ const h10 = shape2;
953
+ if (h10.type === "compound") {
954
+ solidIds.push(...toArray(this.bk.getCompoundSolids(h10.id)));
955
955
  } else {
956
956
  solidIds.push(unwrapSolidOrThrow(shape2, "fuseAll"));
957
957
  }
@@ -965,11 +965,11 @@ class BrepkitAdapter {
965
965
  let current = [...shapes];
966
966
  while (current.length > 1) {
967
967
  const next = [];
968
- for (let i7 = 0; i7 < current.length; i7 += 2) {
969
- if (i7 + 1 < current.length) {
970
- next.push(this.fuse(current[i7], current[i7 + 1], options));
968
+ for (let i9 = 0; i9 < current.length; i9 += 2) {
969
+ if (i9 + 1 < current.length) {
970
+ next.push(this.fuse(current[i9], current[i9 + 1], options));
971
971
  } else {
972
- next.push(current[i7]);
972
+ next.push(current[i9]);
973
973
  }
974
974
  }
975
975
  current = next;
@@ -982,9 +982,9 @@ class BrepkitAdapter {
982
982
  const baseId = unwrapSolidOrThrow(shape2, "cutAll");
983
983
  const toolIds = [];
984
984
  for (const tool of tools) {
985
- const h8 = tool;
986
- if (h8.type === "compound") {
987
- toolIds.push(...toArray(this.bk.getCompoundSolids(h8.id)));
985
+ const h10 = tool;
986
+ if (h10.type === "compound") {
987
+ toolIds.push(...toArray(this.bk.getCompoundSolids(h10.id)));
988
988
  } else {
989
989
  toolIds.push(unwrapSolidOrThrow(tool, "cutAll"));
990
990
  }
@@ -1015,15 +1015,15 @@ class BrepkitAdapter {
1015
1015
  hull(shapes, _tolerance) {
1016
1016
  const coords = [];
1017
1017
  for (const shape2 of shapes) {
1018
- const h8 = shape2;
1019
- if (h8.type === "solid") {
1020
- const vertIds = toArray(this.bk.getSolidVertices(h8.id));
1018
+ const h10 = shape2;
1019
+ if (h10.type === "solid") {
1020
+ const vertIds = toArray(this.bk.getSolidVertices(h10.id));
1021
1021
  for (const vid of vertIds) {
1022
1022
  const pos = this.bk.getVertexPosition(vid);
1023
1023
  coords.push(pos[0], pos[1], pos[2]);
1024
1024
  }
1025
- } else if (h8.type === "vertex") {
1026
- const pos = this.bk.getVertexPosition(h8.id);
1025
+ } else if (h10.type === "vertex") {
1026
+ const pos = this.bk.getVertexPosition(h10.id);
1027
1027
  coords.push(pos[0], pos[1], pos[2]);
1028
1028
  }
1029
1029
  }
@@ -1042,18 +1042,18 @@ class BrepkitAdapter {
1042
1042
  }
1043
1043
  buildSolidFromFaces(points, faces, _tolerance) {
1044
1044
  const positions = new Float64Array(points.length * 3);
1045
- for (let i7 = 0; i7 < points.length; i7++) {
1046
- const p7 = points[i7];
1047
- positions[i7 * 3] = p7.x;
1048
- positions[i7 * 3 + 1] = p7.y;
1049
- positions[i7 * 3 + 2] = p7.z;
1045
+ for (let i9 = 0; i9 < points.length; i9++) {
1046
+ const p7 = points[i9];
1047
+ positions[i9 * 3] = p7.x;
1048
+ positions[i9 * 3 + 1] = p7.y;
1049
+ positions[i9 * 3 + 2] = p7.z;
1050
1050
  }
1051
1051
  const indices = new Uint32Array(faces.length * 3);
1052
- for (let i7 = 0; i7 < faces.length; i7++) {
1053
- const f12 = faces[i7];
1054
- indices[i7 * 3] = f12[0];
1055
- indices[i7 * 3 + 1] = f12[1];
1056
- indices[i7 * 3 + 2] = f12[2];
1052
+ for (let i9 = 0; i9 < faces.length; i9++) {
1053
+ const f11 = faces[i9];
1054
+ indices[i9 * 3] = f11[0];
1055
+ indices[i9 * 3 + 1] = f11[1];
1056
+ indices[i9 * 3 + 2] = f11[2];
1057
1057
  }
1058
1058
  const id = this.bk.importIndexedMesh(positions, indices);
1059
1059
  return solidHandle(id);
@@ -1091,9 +1091,9 @@ class BrepkitAdapter {
1091
1091
  makeWire(edges) {
1092
1092
  const edgeIds = [];
1093
1093
  for (const e8 of edges) {
1094
- const h8 = e8;
1095
- if (h8.type === "wire") {
1096
- for (const childEdgeId of toArray(this.bk.getWireEdges(h8.id))) {
1094
+ const h10 = e8;
1095
+ if (h10.type === "wire") {
1096
+ for (const childEdgeId of toArray(this.bk.getWireEdges(h10.id))) {
1097
1097
  edgeIds.push(childEdgeId);
1098
1098
  }
1099
1099
  } else {
@@ -1104,9 +1104,9 @@ class BrepkitAdapter {
1104
1104
  return wireHandle(id);
1105
1105
  }
1106
1106
  makeFace(wire, _planar) {
1107
- const h8 = wire;
1108
- if (h8.type === "edge") {
1109
- const wireId = this.bk.makeWire([h8.id], true);
1107
+ const h10 = wire;
1108
+ if (h10.type === "edge") {
1109
+ const wireId = this.bk.makeWire([h10.id], true);
1110
1110
  const id2 = this.bk.makeFaceFromWire(wireId);
1111
1111
  return faceHandle(id2);
1112
1112
  }
@@ -1215,23 +1215,21 @@ class BrepkitAdapter {
1215
1215
  p1[1] + ccx * ux[1] + ccy * uy[1],
1216
1216
  p1[2] + ccx * ux[2] + ccy * uy[2]
1217
1217
  ];
1218
- const radius = Math.sqrt(
1219
- (p1[0] - center[0]) ** 2 + (p1[1] - center[1]) ** 2 + (p1[2] - center[2]) ** 2
1218
+ const id = this.bk.makeCircleArc3d(
1219
+ p1[0],
1220
+ p1[1],
1221
+ p1[2],
1222
+ p32[0],
1223
+ p32[1],
1224
+ p32[2],
1225
+ center[0],
1226
+ center[1],
1227
+ center[2],
1228
+ nz[0],
1229
+ nz[1],
1230
+ nz[2]
1220
1231
  );
1221
- const lx = [p1[0] - center[0], p1[1] - center[1], p1[2] - center[2]];
1222
- const lxLen = Math.sqrt(lx[0] ** 2 + lx[1] ** 2 + lx[2] ** 2);
1223
- const uxA = [lx[0] / lxLen, lx[1] / lxLen, lx[2] / lxLen];
1224
- const uyA = [
1225
- nz[1] * uxA[2] - nz[2] * uxA[1],
1226
- nz[2] * uxA[0] - nz[0] * uxA[2],
1227
- nz[0] * uxA[1] - nz[1] * uxA[0]
1228
- ];
1229
- const v32 = [p32[0] - center[0], p32[1] - center[1], p32[2] - center[2]];
1230
- const dotX = v32[0] * uxA[0] + v32[1] * uxA[1] + v32[2] * uxA[2];
1231
- const dotY = v32[0] * uyA[0] + v32[1] * uyA[1] + v32[2] * uyA[2];
1232
- let endAngle = Math.atan2(dotY, dotX);
1233
- if (endAngle <= 0) endAngle += 2 * Math.PI;
1234
- return this.makeCircleNurbs(center, normal, radius, 0, endAngle);
1232
+ return edgeHandle(id);
1235
1233
  }
1236
1234
  makeEllipseEdge(center, normal, majorRadius, minorRadius, xDir) {
1237
1235
  return this.makeEllipseNurbs(center, normal, majorRadius, minorRadius, 0, 2 * Math.PI, xDir);
@@ -1250,12 +1248,12 @@ class BrepkitAdapter {
1250
1248
  makeBezierEdge(points) {
1251
1249
  if (points.length < 2) throw new Error("brepkit: bezier requires at least 2 points");
1252
1250
  const degree = points.length - 1;
1253
- const n9 = points.length;
1251
+ const n7 = points.length;
1254
1252
  const knots = [...Array(degree + 1).fill(0), ...Array(degree + 1).fill(1)];
1255
- const weights = Array(n9).fill(1);
1253
+ const weights = Array(n7).fill(1);
1256
1254
  const flatCp = points.flatMap(([x7, y6, z6]) => [x7, y6, z6]);
1257
1255
  const startPt = points[0];
1258
- const endPt = points[n9 - 1];
1256
+ const endPt = points[n7 - 1];
1259
1257
  const id = this.bk.makeNurbsEdge(
1260
1258
  startPt[0],
1261
1259
  startPt[1],
@@ -1271,21 +1269,73 @@ class BrepkitAdapter {
1271
1269
  return edgeHandle(id);
1272
1270
  }
1273
1271
  makeTangentArc(startPoint, startTangent, endPoint) {
1274
- const cp1 = [
1275
- startPoint[0] + startTangent[0] / 3,
1276
- startPoint[1] + startTangent[1] / 3,
1277
- startPoint[2] + startTangent[2] / 3
1272
+ const tLen = Math.sqrt(startTangent[0] ** 2 + startTangent[1] ** 2 + startTangent[2] ** 2);
1273
+ if (tLen < 1e-12) return this.makeLineEdge(startPoint, endPoint);
1274
+ const t10 = [
1275
+ startTangent[0] / tLen,
1276
+ startTangent[1] / tLen,
1277
+ startTangent[2] / tLen
1278
+ ];
1279
+ const ch = [
1280
+ startPoint[0] - endPoint[0],
1281
+ startPoint[1] - endPoint[1],
1282
+ startPoint[2] - endPoint[2]
1278
1283
  ];
1279
- const dx = endPoint[0] - cp1[0];
1280
- const dy = endPoint[1] - cp1[1];
1281
- const dz = endPoint[2] - cp1[2];
1282
- const len = Math.sqrt(dx * dx + dy * dy + dz * dz);
1283
- const cp2 = [
1284
- endPoint[0] - dx / (3 * Math.max(len, 1e-10)),
1285
- endPoint[1] - dy / (3 * Math.max(len, 1e-10)),
1286
- endPoint[2] - dz / (3 * Math.max(len, 1e-10))
1284
+ const chDotT = ch[0] * t10[0] + ch[1] * t10[1] + ch[2] * t10[2];
1285
+ const perp = [
1286
+ ch[0] - chDotT * t10[0],
1287
+ ch[1] - chDotT * t10[1],
1288
+ ch[2] - chDotT * t10[2]
1287
1289
  ];
1288
- return this.makeBezierEdge([startPoint, cp1, cp2, endPoint]);
1290
+ const perpLen = Math.sqrt(perp[0] ** 2 + perp[1] ** 2 + perp[2] ** 2);
1291
+ if (perpLen < 1e-12) return this.makeLineEdge(startPoint, endPoint);
1292
+ const n7 = [perp[0] / perpLen, perp[1] / perpLen, perp[2] / perpLen];
1293
+ const chord2 = ch[0] ** 2 + ch[1] ** 2 + ch[2] ** 2;
1294
+ const nDotCh = n7[0] * ch[0] + n7[1] * ch[1] + n7[2] * ch[2];
1295
+ const s6 = -chord2 / (2 * nDotCh);
1296
+ const center = [
1297
+ startPoint[0] + s6 * n7[0],
1298
+ startPoint[1] + s6 * n7[1],
1299
+ startPoint[2] + s6 * n7[2]
1300
+ ];
1301
+ const radius = Math.abs(s6);
1302
+ const e1 = [
1303
+ (startPoint[0] - center[0]) / radius,
1304
+ (startPoint[1] - center[1]) / radius,
1305
+ (startPoint[2] - center[2]) / radius
1306
+ ];
1307
+ const e22 = [
1308
+ (endPoint[0] - center[0]) / radius,
1309
+ (endPoint[1] - center[1]) / radius,
1310
+ (endPoint[2] - center[2]) / radius
1311
+ ];
1312
+ let mx = e1[0] + e22[0];
1313
+ let my = e1[1] + e22[1];
1314
+ let mz = e1[2] + e22[2];
1315
+ let mLen = Math.sqrt(mx * mx + my * my + mz * mz);
1316
+ if (mLen < 1e-12) {
1317
+ mx = t10[0];
1318
+ my = t10[1];
1319
+ mz = t10[2];
1320
+ mLen = 1;
1321
+ }
1322
+ const mid = [
1323
+ center[0] + radius * mx / mLen,
1324
+ center[1] + radius * my / mLen,
1325
+ center[2] + radius * mz / mLen
1326
+ ];
1327
+ const toMid = [
1328
+ mid[0] - startPoint[0],
1329
+ mid[1] - startPoint[1],
1330
+ mid[2] - startPoint[2]
1331
+ ];
1332
+ const dotTM = t10[0] * toMid[0] + t10[1] * toMid[1] + t10[2] * toMid[2];
1333
+ if (dotTM < 0) {
1334
+ mid[0] = center[0] - radius * mx / mLen;
1335
+ mid[1] = center[1] - radius * my / mLen;
1336
+ mid[2] = center[2] - radius * mz / mLen;
1337
+ }
1338
+ return this.makeArcEdge(startPoint, mid, endPoint);
1289
1339
  }
1290
1340
  makeHelixWire(pitch, height, radius, center, _direction, leftHanded) {
1291
1341
  const turns = height / pitch;
@@ -1296,10 +1346,10 @@ class BrepkitAdapter {
1296
1346
  const cz = center?.[2] ?? 0;
1297
1347
  const sign = leftHanded ? -1 : 1;
1298
1348
  const points = [];
1299
- for (let i7 = 0; i7 <= nSamples; i7++) {
1300
- const t11 = i7 / nSamples;
1301
- const angle = sign * 2 * Math.PI * turns * t11;
1302
- points.push([cx + radius * Math.cos(angle), cy + radius * Math.sin(angle), cz + height * t11]);
1349
+ for (let i9 = 0; i9 <= nSamples; i9++) {
1350
+ const t10 = i9 / nSamples;
1351
+ const angle = sign * 2 * Math.PI * turns * t10;
1352
+ points.push([cx + radius * Math.cos(angle), cy + radius * Math.sin(angle), cz + height * t10]);
1303
1353
  }
1304
1354
  const edge = this.interpolatePoints(points);
1305
1355
  return this.makeWire([edge]);
@@ -1307,11 +1357,11 @@ class BrepkitAdapter {
1307
1357
  makeWireFromMixed(items) {
1308
1358
  const edgeIds = [];
1309
1359
  for (const item of items) {
1310
- const h8 = item;
1311
- if (h8.type === "edge") {
1312
- edgeIds.push(h8.id);
1313
- } else if (h8.type === "wire") {
1314
- for (const childEdgeId of toArray(this.bk.getWireEdges(h8.id))) {
1360
+ const h10 = item;
1361
+ if (h10.type === "edge") {
1362
+ edgeIds.push(h10.id);
1363
+ } else if (h10.type === "wire") {
1364
+ for (const childEdgeId of toArray(this.bk.getWireEdges(h10.id))) {
1315
1365
  edgeIds.push(childEdgeId);
1316
1366
  }
1317
1367
  }
@@ -1326,9 +1376,9 @@ class BrepkitAdapter {
1326
1376
  if (handles.length === 0) {
1327
1377
  throw new Error("brepkit: makeCompound requires at least one shape");
1328
1378
  }
1329
- const allSolids = handles.every((h8) => h8.type === "solid");
1379
+ const allSolids = handles.every((h10) => h10.type === "solid");
1330
1380
  if (allSolids) {
1331
- const id2 = this.bk.makeCompound(handles.map((h8) => h8.id));
1381
+ const id2 = this.bk.makeCompound(handles.map((h10) => h10.id));
1332
1382
  return compoundHandle(id2);
1333
1383
  }
1334
1384
  const id = syntheticCompoundCounter++;
@@ -1337,9 +1387,9 @@ class BrepkitAdapter {
1337
1387
  }
1338
1388
  makeBoxFromCorners(p1, p22) {
1339
1389
  const w7 = Math.abs(p22[0] - p1[0]);
1340
- const h8 = Math.abs(p22[1] - p1[1]);
1390
+ const h10 = Math.abs(p22[1] - p1[1]);
1341
1391
  const d10 = Math.abs(p22[2] - p1[2]);
1342
- const box = this.makeBox(w7, h8, d10);
1392
+ const box = this.makeBox(w7, h10, d10);
1343
1393
  const minX = Math.min(p1[0], p22[0]);
1344
1394
  const minY = Math.min(p1[1], p22[1]);
1345
1395
  const minZ = Math.min(p1[2], p22[2]);
@@ -1349,15 +1399,15 @@ class BrepkitAdapter {
1349
1399
  return box;
1350
1400
  }
1351
1401
  solidFromShell(shell2) {
1352
- const h8 = shell2;
1353
- if (h8.type === "solid") return shell2;
1354
- if (h8.type === "shell") {
1402
+ const h10 = shell2;
1403
+ if (h10.type === "solid") return shell2;
1404
+ if (h10.type === "shell") {
1355
1405
  try {
1356
- this.bk.getSolidFaces(h8.id);
1357
- return solidHandle(h8.id);
1406
+ this.bk.getSolidFaces(h10.id);
1407
+ return solidHandle(h10.id);
1358
1408
  } catch {
1359
1409
  }
1360
- const id2 = this.bk.solidFromShell(h8.id);
1410
+ const id2 = this.bk.solidFromShell(h10.id);
1361
1411
  return solidHandle(id2);
1362
1412
  }
1363
1413
  const id = this.bk.solidFromShell(unwrap(shell2, "shell"));
@@ -1418,9 +1468,9 @@ class BrepkitAdapter {
1418
1468
  );
1419
1469
  }
1420
1470
  const faceIds = wires.map((w7) => {
1421
- const h8 = w7;
1422
- if (h8.type === "wire") {
1423
- return this.bk.makeFaceFromWire(h8.id);
1471
+ const h10 = w7;
1472
+ if (h10.type === "wire") {
1473
+ return this.bk.makeFaceFromWire(h10.id);
1424
1474
  }
1425
1475
  return unwrap(w7, "face");
1426
1476
  });
@@ -1486,8 +1536,8 @@ class BrepkitAdapter {
1486
1536
  return solidHandle(this.bk.fillet(solidId, edgeIds, radius));
1487
1537
  }
1488
1538
  const spec = [];
1489
- for (const [i7, edge] of edges.entries()) {
1490
- const edgeId = edgeIds[i7] ?? 0;
1539
+ for (const [i9, edge] of edges.entries()) {
1540
+ const edgeId = edgeIds[i9] ?? 0;
1491
1541
  let r9;
1492
1542
  if (typeof radius === "function") {
1493
1543
  r9 = radius(edge);
@@ -1530,8 +1580,8 @@ class BrepkitAdapter {
1530
1580
  const solidId = unwrapSolidOrThrow(shape2, "shell");
1531
1581
  const solidFaces = toArray(this.bk.getSolidFaces(solidId));
1532
1582
  const solidFaceSet = new Set(solidFaces);
1533
- const resolvedFaceIds = faces.map((f12) => {
1534
- const fid = unwrap(f12, "face");
1583
+ const resolvedFaceIds = faces.map((f11) => {
1584
+ const fid = unwrap(f11, "face");
1535
1585
  if (solidFaceSet.has(fid)) return fid;
1536
1586
  try {
1537
1587
  const origNormal = this.bk.getFaceNormal(fid);
@@ -1557,9 +1607,9 @@ class BrepkitAdapter {
1557
1607
  return solidHandle(id);
1558
1608
  }
1559
1609
  thicken(shape2, thickness) {
1560
- const h8 = shape2;
1561
- if (h8.type === "face") {
1562
- const id = this.bk.thicken(h8.id, thickness);
1610
+ const h10 = shape2;
1611
+ if (h10.type === "face") {
1612
+ const id = this.bk.thicken(h10.id, thickness);
1563
1613
  return solidHandle(id);
1564
1614
  }
1565
1615
  throw new Error("brepkit: thicken() requires a face");
@@ -1571,9 +1621,9 @@ class BrepkitAdapter {
1571
1621
  "offset() tolerance parameter is not supported; brepkit uses its own internal tolerance."
1572
1622
  );
1573
1623
  }
1574
- const h8 = shape2;
1575
- if (h8.type === "face") {
1576
- const id2 = this.bk.thicken(h8.id, distance);
1624
+ const h10 = shape2;
1625
+ if (h10.type === "face") {
1626
+ const id2 = this.bk.thicken(h10.id, distance);
1577
1627
  return solidHandle(id2);
1578
1628
  }
1579
1629
  const id = this.bk.offsetSolid(unwrapSolidOrThrow(shape2, "offset"), distance);
@@ -1595,10 +1645,10 @@ class BrepkitAdapter {
1595
1645
  return this.applyMatrix(shape2, rotationMatrix(angle, axis, center));
1596
1646
  }
1597
1647
  mirror(shape2, origin, normal) {
1598
- const h8 = shape2;
1599
- if (h8.type === "solid") {
1648
+ const h10 = shape2;
1649
+ if (h10.type === "solid") {
1600
1650
  const id = this.bk.mirror(
1601
- h8.id,
1651
+ h10.id,
1602
1652
  origin[0],
1603
1653
  origin[1],
1604
1654
  origin[2],
@@ -1668,16 +1718,16 @@ class BrepkitAdapter {
1668
1718
  * fallback when hash matching fails (brepkit always creates new face IDs).
1669
1719
  */
1670
1720
  buildEvolution(resultShape, inputFaceHashes, hashUpperBound, isTransform, originalShape) {
1671
- const h8 = resultShape;
1721
+ const h10 = resultShape;
1672
1722
  const modified = /* @__PURE__ */ new Map();
1673
1723
  const generated = /* @__PURE__ */ new Map();
1674
1724
  const deleted = /* @__PURE__ */ new Set();
1675
- if (h8.type === "solid") {
1676
- const outputFaces = toArray(this.bk.getSolidFaces(h8.id));
1725
+ if (h10.type === "solid") {
1726
+ const outputFaces = toArray(this.bk.getSolidFaces(h10.id));
1677
1727
  const outputHashes = outputFaces.map((fid) => fid % hashUpperBound);
1678
1728
  if (isTransform) {
1679
- for (let i7 = 0; i7 < inputFaceHashes.length && i7 < outputHashes.length; i7++) {
1680
- modified.set(inputFaceHashes[i7], [outputHashes[i7]]);
1729
+ for (let i9 = 0; i9 < inputFaceHashes.length && i9 < outputHashes.length; i9++) {
1730
+ modified.set(inputFaceHashes[i9], [outputHashes[i9]]);
1681
1731
  }
1682
1732
  } else {
1683
1733
  const inputSet = new Set(inputFaceHashes);
@@ -1715,8 +1765,8 @@ class BrepkitAdapter {
1715
1765
  deleted
1716
1766
  );
1717
1767
  } else {
1718
- for (let i7 = 0; i7 < inputFaceHashes.length && i7 < outputHashes.length; i7++) {
1719
- modified.set(inputFaceHashes[i7], [outputHashes[i7]]);
1768
+ for (let i9 = 0; i9 < inputFaceHashes.length && i9 < outputHashes.length; i9++) {
1769
+ modified.set(inputFaceHashes[i9], [outputHashes[i9]]);
1720
1770
  }
1721
1771
  if (outputHashes.length > inputFaceHashes.length && inputFaceHashes.length > 0) {
1722
1772
  generated.set(inputFaceHashes[0], outputHashes.slice(inputFaceHashes.length));
@@ -1756,10 +1806,10 @@ class BrepkitAdapter {
1756
1806
  }
1757
1807
  }
1758
1808
  /** Squared Euclidean distance between two 3-component centroids. */
1759
- static centroidDistSq(a9, b10) {
1760
- const dx = a9[0] - b10[0];
1761
- const dy = a9[1] - b10[1];
1762
- const dz = a9[2] - b10[2];
1809
+ static centroidDistSq(a9, b9) {
1810
+ const dx = a9[0] - b9[0];
1811
+ const dy = a9[1] - b9[1];
1812
+ const dz = a9[2] - b9[2];
1763
1813
  return dx * dx + dy * dy + dz * dz;
1764
1814
  }
1765
1815
  /** Compute face centroid as the average of tessellation vertices. */
@@ -1771,10 +1821,10 @@ class BrepkitAdapter {
1771
1821
  let cy = 0;
1772
1822
  let cz = 0;
1773
1823
  const nVerts = pos.length / 3;
1774
- for (let i7 = 0; i7 < pos.length; i7 += 3) {
1775
- cx += pos[i7];
1776
- cy += pos[i7 + 1];
1777
- cz += pos[i7 + 2];
1824
+ for (let i9 = 0; i9 < pos.length; i9 += 3) {
1825
+ cx += pos[i9];
1826
+ cy += pos[i9 + 1];
1827
+ cz += pos[i9 + 2];
1778
1828
  }
1779
1829
  return [cx / nVerts, cy / nVerts, cz / nVerts];
1780
1830
  } catch {
@@ -1791,15 +1841,15 @@ class BrepkitAdapter {
1791
1841
  const inputFaceIds = toArray(this.bk.getSolidFaces(orig.id));
1792
1842
  const hashCount = Math.min(inputFaceIds.length, inputFaceHashes.length);
1793
1843
  const inputSigs = [];
1794
- for (let i7 = 0; i7 < hashCount; i7++) {
1795
- const fid = inputFaceIds[i7];
1844
+ for (let i9 = 0; i9 < hashCount; i9++) {
1845
+ const fid = inputFaceIds[i9];
1796
1846
  try {
1797
1847
  const normal = this.bk.getFaceNormal(fid);
1798
1848
  const centroid = this.faceCentroidById(fid);
1799
- inputSigs.push({ hash: inputFaceHashes[i7] ?? fid % hashUpperBound, normal, centroid });
1849
+ inputSigs.push({ hash: inputFaceHashes[i9] ?? fid % hashUpperBound, normal, centroid });
1800
1850
  } catch {
1801
1851
  inputSigs.push({
1802
- hash: inputFaceHashes[i7] ?? fid % hashUpperBound,
1852
+ hash: inputFaceHashes[i9] ?? fid % hashUpperBound,
1803
1853
  normal: [0, 0, 0],
1804
1854
  centroid: this.faceCentroidById(fid)
1805
1855
  });
@@ -1825,8 +1875,8 @@ class BrepkitAdapter {
1825
1875
  for (const out of outputSigs) {
1826
1876
  let bestScore = -Infinity;
1827
1877
  let bestIdx = -1;
1828
- for (let i7 = 0; i7 < inputSigs.length; i7++) {
1829
- const inp = inputSigs[i7];
1878
+ for (let i9 = 0; i9 < inputSigs.length; i9++) {
1879
+ const inp = inputSigs[i9];
1830
1880
  const dot = (out.normal[0] ?? 0) * (inp.normal[0] ?? 0) + (out.normal[1] ?? 0) * (inp.normal[1] ?? 0) + (out.normal[2] ?? 0) * (inp.normal[2] ?? 0);
1831
1881
  if (dot < NORMAL_THRESHOLD) continue;
1832
1882
  const distSq = BrepkitAdapter.centroidDistSq(out.centroid, inp.centroid);
@@ -1834,7 +1884,7 @@ class BrepkitAdapter {
1834
1884
  const score = dot - distSq / CENTROID_DIST_SQ_MAX;
1835
1885
  if (score > bestScore) {
1836
1886
  bestScore = score;
1837
- bestIdx = i7;
1887
+ bestIdx = i9;
1838
1888
  }
1839
1889
  }
1840
1890
  if (bestIdx >= 0) {
@@ -1860,9 +1910,9 @@ class BrepkitAdapter {
1860
1910
  }
1861
1911
  }
1862
1912
  }
1863
- for (let i7 = 0; i7 < inputSigs.length; i7++) {
1864
- if (!matchedInputIndices.has(i7)) {
1865
- deleted.add(inputSigs[i7].hash);
1913
+ for (let i9 = 0; i9 < inputSigs.length; i9++) {
1914
+ if (!matchedInputIndices.has(i9)) {
1915
+ deleted.add(inputSigs[i9].hash);
1866
1916
  }
1867
1917
  }
1868
1918
  }
@@ -1979,8 +2029,8 @@ class BrepkitAdapter {
1979
2029
  inputFaceHashes,
1980
2030
  hashUpperBound,
1981
2031
  options,
1982
- (a9, b10) => this.bk.fuseWithEvolution(a9, b10),
1983
- (s6, t11, o9) => this.fuse(s6, t11, o9),
2032
+ (a9, b9) => this.bk.fuseWithEvolution(a9, b9),
2033
+ (s6, t10, o9) => this.fuse(s6, t10, o9),
1984
2034
  "fuseWithHistory"
1985
2035
  );
1986
2036
  }
@@ -1991,8 +2041,8 @@ class BrepkitAdapter {
1991
2041
  inputFaceHashes,
1992
2042
  hashUpperBound,
1993
2043
  options,
1994
- (a9, b10) => this.bk.cutWithEvolution(a9, b10),
1995
- (s6, t11, o9) => this.cut(s6, t11, o9),
2044
+ (a9, b9) => this.bk.cutWithEvolution(a9, b9),
2045
+ (s6, t10, o9) => this.cut(s6, t10, o9),
1996
2046
  "cutWithHistory"
1997
2047
  );
1998
2048
  }
@@ -2003,8 +2053,8 @@ class BrepkitAdapter {
2003
2053
  inputFaceHashes,
2004
2054
  hashUpperBound,
2005
2055
  options,
2006
- (a9, b10) => this.bk.intersectWithEvolution(a9, b10),
2007
- (s6, t11, o9) => this.intersect(s6, t11, o9),
2056
+ (a9, b9) => this.bk.intersectWithEvolution(a9, b9),
2057
+ (s6, t10, o9) => this.intersect(s6, t10, o9),
2008
2058
  "intersectWithHistory"
2009
2059
  );
2010
2060
  }
@@ -2063,14 +2113,14 @@ class BrepkitAdapter {
2063
2113
  "mesh angularTolerance is not supported; only linear deflection is used."
2064
2114
  );
2065
2115
  }
2066
- const h8 = unwrap(shape2);
2116
+ const h10 = unwrap(shape2);
2067
2117
  const bkHandle = shape2;
2068
2118
  const deflection = options.tolerance || DEFAULT_DEFLECTION;
2069
2119
  let result;
2070
2120
  if (bkHandle.type === "solid") {
2071
- result = this.meshSolid(h8, deflection, !!options.includeUVs);
2121
+ result = this.meshSolid(h10, deflection, !!options.includeUVs);
2072
2122
  } else if (bkHandle.type === "face") {
2073
- result = this.meshSingleFace(h8, deflection, 0);
2123
+ result = this.meshSingleFace(h10, deflection, 0);
2074
2124
  } else {
2075
2125
  throw new Error(`brepkit: cannot mesh shape of type '${bkHandle.type}'`);
2076
2126
  }
@@ -2093,16 +2143,16 @@ class BrepkitAdapter {
2093
2143
  if (bkHandle.type !== "solid") {
2094
2144
  return { lines: new Float32Array(0), edgeGroups: [] };
2095
2145
  }
2096
- const edgeLines = this.bk.meshEdges(bkHandle.id, tolerance);
2146
+ const edgeLines = this.bk.meshEdgesAll ? this.bk.meshEdgesAll(bkHandle.id, tolerance) : this.bk.meshEdges(bkHandle.id, tolerance);
2097
2147
  const positions = edgeLines.positions;
2098
2148
  const offsets = edgeLines.offsets;
2099
2149
  const edgeCount = edgeLines.edgeCount;
2100
2150
  const edgeGroups = [];
2101
- for (let i7 = 0; i7 < edgeCount; i7++) {
2102
- const startIdx = offsets[i7];
2103
- const endIdx = i7 + 1 < edgeCount ? offsets[i7 + 1] : positions.length;
2151
+ for (let i9 = 0; i9 < edgeCount; i9++) {
2152
+ const startIdx = offsets[i9];
2153
+ const endIdx = i9 + 1 < edgeCount ? offsets[i9 + 1] : positions.length;
2104
2154
  const pointCount = (endIdx - startIdx) / 3;
2105
- edgeGroups.push({ start: startIdx / 3, count: pointCount, edgeHash: i7 });
2155
+ edgeGroups.push({ start: startIdx / 3, count: pointCount, edgeHash: i9 });
2106
2156
  }
2107
2157
  return {
2108
2158
  lines: new Float32Array(positions),
@@ -2167,11 +2217,11 @@ class BrepkitAdapter {
2167
2217
  // Measurement
2168
2218
  // ═══════════════════════════════════════════════════════════════════════
2169
2219
  volume(shape2) {
2170
- const h8 = shape2;
2171
- if (h8.type === "solid") {
2220
+ const h10 = shape2;
2221
+ if (h10.type === "solid") {
2172
2222
  return this.bk.volume(unwrap(shape2), DEFAULT_DEFLECTION);
2173
2223
  }
2174
- if (h8.type === "compound") {
2224
+ if (h10.type === "compound") {
2175
2225
  const solids = this.iterShapes(shape2, "solid");
2176
2226
  let total = 0;
2177
2227
  for (const s6 of solids) {
@@ -2182,14 +2232,14 @@ class BrepkitAdapter {
2182
2232
  return 0;
2183
2233
  }
2184
2234
  area(shape2) {
2185
- const h8 = shape2;
2186
- if (h8.type === "face") {
2235
+ const h10 = shape2;
2236
+ if (h10.type === "face") {
2187
2237
  return this.bk.faceArea(unwrap(shape2), DEFAULT_DEFLECTION);
2188
2238
  }
2189
- if (h8.type === "solid") {
2239
+ if (h10.type === "solid") {
2190
2240
  return this.bk.surfaceArea(unwrap(shape2), DEFAULT_DEFLECTION);
2191
2241
  }
2192
- if (h8.type === "compound") {
2242
+ if (h10.type === "compound") {
2193
2243
  const faces = this.iterShapes(shape2, "face");
2194
2244
  let total = 0;
2195
2245
  for (const face of faces) {
@@ -2200,39 +2250,39 @@ class BrepkitAdapter {
2200
2250
  return 0;
2201
2251
  }
2202
2252
  length(shape2) {
2203
- const h8 = shape2;
2204
- if (h8.type === "edge") {
2253
+ const h10 = shape2;
2254
+ if (h10.type === "edge") {
2205
2255
  return this.bk.edgeLength(unwrap(shape2));
2206
2256
  }
2207
- if (h8.type === "face") {
2257
+ if (h10.type === "face") {
2208
2258
  return this.bk.facePerimeter(unwrap(shape2));
2209
2259
  }
2210
- if (h8.type === "wire") {
2211
- return this.bk.wireLength(h8.id);
2260
+ if (h10.type === "wire") {
2261
+ return this.bk.wireLength(h10.id);
2212
2262
  }
2213
2263
  throw new Error("brepkit: length() requires an edge, wire, or face");
2214
2264
  }
2215
2265
  centerOfMass(shape2) {
2216
- const h8 = shape2;
2217
- if (h8.type === "solid") {
2266
+ const h10 = shape2;
2267
+ if (h10.type === "solid") {
2218
2268
  const result = this.bk.centerOfMass(unwrap(shape2), DEFAULT_DEFLECTION);
2219
2269
  return [result[0], result[1], result[2]];
2220
2270
  }
2221
- if (h8.type === "face") {
2271
+ if (h10.type === "face") {
2222
2272
  const domain = this.uvBounds(shape2);
2223
2273
  const uMid = (domain.uMin + domain.uMax) / 2;
2224
2274
  const vMid = (domain.vMin + domain.vMax) / 2;
2225
2275
  return this.pointOnSurface(shape2, uMid, vMid);
2226
2276
  }
2227
- if (h8.type === "edge") {
2228
- const verts = this.bk.getEdgeVertices(h8.id);
2277
+ if (h10.type === "edge") {
2278
+ const verts = this.bk.getEdgeVertices(h10.id);
2229
2279
  return [
2230
2280
  (verts[0] + verts[3]) / 2,
2231
2281
  (verts[1] + verts[4]) / 2,
2232
2282
  (verts[2] + verts[5]) / 2
2233
2283
  ];
2234
2284
  }
2235
- if (h8.type === "vertex") {
2285
+ if (h10.type === "vertex") {
2236
2286
  return this.vertexPosition(shape2);
2237
2287
  }
2238
2288
  const vertices = this.iterShapes(shape2, "vertex");
@@ -2249,9 +2299,9 @@ class BrepkitAdapter {
2249
2299
  return [0, 0, 0];
2250
2300
  }
2251
2301
  linearCenterOfMass(shape2) {
2252
- const h8 = shape2;
2253
- if (h8.type === "edge") {
2254
- const verts = this.bk.getEdgeVertices(h8.id);
2302
+ const h10 = shape2;
2303
+ if (h10.type === "edge") {
2304
+ const verts = this.bk.getEdgeVertices(h10.id);
2255
2305
  return [
2256
2306
  (verts[0] + verts[3]) / 2,
2257
2307
  (verts[1] + verts[4]) / 2,
@@ -2261,15 +2311,15 @@ class BrepkitAdapter {
2261
2311
  return this.centerOfMass(shape2);
2262
2312
  }
2263
2313
  boundingBox(shape2) {
2264
- const h8 = shape2;
2265
- if (h8.type === "solid") {
2314
+ const h10 = shape2;
2315
+ if (h10.type === "solid") {
2266
2316
  const bb = this.bk.boundingBox(unwrap(shape2));
2267
2317
  return {
2268
2318
  min: [bb[0], bb[1], bb[2]],
2269
2319
  max: [bb[3], bb[4], bb[5]]
2270
2320
  };
2271
2321
  }
2272
- if (h8.type === "vertex") {
2322
+ if (h10.type === "vertex") {
2273
2323
  const pos = this.vertexPosition(shape2);
2274
2324
  return { min: [...pos], max: [...pos] };
2275
2325
  }
@@ -2280,8 +2330,8 @@ class BrepkitAdapter {
2280
2330
  const first = this.vertexPosition(vertices[0]);
2281
2331
  let minX = first[0], minY = first[1], minZ = first[2];
2282
2332
  let maxX = first[0], maxY = first[1], maxZ = first[2];
2283
- for (let i7 = 1; i7 < vertices.length; i7++) {
2284
- const p7 = this.vertexPosition(vertices[i7]);
2333
+ for (let i9 = 1; i9 < vertices.length; i9++) {
2334
+ const p7 = this.vertexPosition(vertices[i9]);
2285
2335
  if (p7[0] < minX) minX = p7[0];
2286
2336
  if (p7[0] > maxX) maxX = p7[0];
2287
2337
  if (p7[1] < minY) minY = p7[1];
@@ -2295,11 +2345,11 @@ class BrepkitAdapter {
2295
2345
  // Topology introspection
2296
2346
  // ═══════════════════════════════════════════════════════════════════════
2297
2347
  iterShapes(shape2, type) {
2298
- const h8 = unwrap(shape2);
2348
+ const h10 = unwrap(shape2);
2299
2349
  const bkHandle = shape2;
2300
2350
  switch (bkHandle.type) {
2301
2351
  case "compound": {
2302
- const children = syntheticCompounds.get(h8);
2352
+ const children = syntheticCompounds.get(h10);
2303
2353
  if (children) {
2304
2354
  const results = [];
2305
2355
  for (const child of children) {
@@ -2312,10 +2362,10 @@ class BrepkitAdapter {
2312
2362
  return results;
2313
2363
  }
2314
2364
  if (type === "solid") {
2315
- return toArray(this.bk.getCompoundSolids(h8)).map(solidHandle);
2365
+ return toArray(this.bk.getCompoundSolids(h10)).map(solidHandle);
2316
2366
  }
2317
2367
  if (type === "face" || type === "edge" || type === "vertex" || type === "wire") {
2318
- const solids = toArray(this.bk.getCompoundSolids(h8)).map(solidHandle);
2368
+ const solids = toArray(this.bk.getCompoundSolids(h10)).map(solidHandle);
2319
2369
  return solids.flatMap((s6) => this.iterShapes(s6, type));
2320
2370
  }
2321
2371
  return [];
@@ -2323,13 +2373,13 @@ class BrepkitAdapter {
2323
2373
  case "solid": {
2324
2374
  switch (type) {
2325
2375
  case "face":
2326
- return toArray(this.bk.getSolidFaces(h8)).map(faceHandle);
2376
+ return toArray(this.bk.getSolidFaces(h10)).map(faceHandle);
2327
2377
  case "edge":
2328
- return toArray(this.bk.getSolidEdges(h8)).map(edgeHandle);
2378
+ return toArray(this.bk.getSolidEdges(h10)).map(edgeHandle);
2329
2379
  case "vertex":
2330
- return toArray(this.bk.getSolidVertices(h8)).map(vertexHandle);
2380
+ return toArray(this.bk.getSolidVertices(h10)).map(vertexHandle);
2331
2381
  case "wire":
2332
- return toArray(this.bk.getSolidFaces(h8)).flatMap(
2382
+ return toArray(this.bk.getSolidFaces(h10)).flatMap(
2333
2383
  (faceId) => toArray(this.bk.getFaceWires(faceId)).map(wireHandle)
2334
2384
  );
2335
2385
  default:
@@ -2338,10 +2388,10 @@ class BrepkitAdapter {
2338
2388
  }
2339
2389
  case "shell": {
2340
2390
  if (type === "face") {
2341
- return toArray(this.bk.getShellFaces(h8)).map(faceHandle);
2391
+ return toArray(this.bk.getShellFaces(h10)).map(faceHandle);
2342
2392
  }
2343
2393
  if (type === "edge" || type === "vertex") {
2344
- const faces = toArray(this.bk.getShellFaces(h8)).map(faceHandle);
2394
+ const faces = toArray(this.bk.getShellFaces(h10)).map(faceHandle);
2345
2395
  const seen = /* @__PURE__ */ new Set();
2346
2396
  const results = [];
2347
2397
  for (const face of faces) {
@@ -2362,13 +2412,13 @@ class BrepkitAdapter {
2362
2412
  return [shape2];
2363
2413
  }
2364
2414
  if (type === "edge") {
2365
- return toArray(this.bk.getFaceEdges(h8)).map(edgeHandle);
2415
+ return toArray(this.bk.getFaceEdges(h10)).map(edgeHandle);
2366
2416
  }
2367
2417
  if (type === "vertex") {
2368
- return toArray(this.bk.getFaceVertices(h8)).map(vertexHandle);
2418
+ return toArray(this.bk.getFaceVertices(h10)).map(vertexHandle);
2369
2419
  }
2370
2420
  if (type === "wire") {
2371
- return toArray(this.bk.getFaceWires(h8)).map(wireHandle);
2421
+ return toArray(this.bk.getFaceWires(h10)).map(wireHandle);
2372
2422
  }
2373
2423
  return [];
2374
2424
  }
@@ -2377,10 +2427,10 @@ class BrepkitAdapter {
2377
2427
  return [shape2];
2378
2428
  }
2379
2429
  if (type === "edge") {
2380
- return toArray(this.bk.getWireEdges(h8)).map(edgeHandle);
2430
+ return toArray(this.bk.getWireEdges(h10)).map(edgeHandle);
2381
2431
  }
2382
2432
  if (type === "vertex") {
2383
- const edgeIds = toArray(this.bk.getWireEdges(h8));
2433
+ const edgeIds = toArray(this.bk.getWireEdges(h10));
2384
2434
  const seen = /* @__PURE__ */ new Set();
2385
2435
  const results = [];
2386
2436
  for (const eid of edgeIds) {
@@ -2406,7 +2456,7 @@ class BrepkitAdapter {
2406
2456
  return [shape2];
2407
2457
  }
2408
2458
  if (type === "vertex") {
2409
- const verts = this.bk.getEdgeVertices(h8);
2459
+ const verts = this.bk.getEdgeVertices(h10);
2410
2460
  const v1 = this.bk.makeVertex(verts[0], verts[1], verts[2]);
2411
2461
  const v22 = this.bk.makeVertex(verts[3], verts[4], verts[5]);
2412
2462
  return [vertexHandle(v1), vertexHandle(v22)];
@@ -2426,11 +2476,11 @@ class BrepkitAdapter {
2426
2476
  if (isBrepkitHandle(shape2)) return shape2.type;
2427
2477
  throw new Error("brepkit: cannot determine shape type of non-brepkit handle");
2428
2478
  }
2429
- isSame(a9, b10) {
2430
- return isBrepkitHandle(a9) && isBrepkitHandle(b10) && a9.id === b10.id && a9.type === b10.type;
2479
+ isSame(a9, b9) {
2480
+ return isBrepkitHandle(a9) && isBrepkitHandle(b9) && a9.id === b9.id && a9.type === b9.type;
2431
2481
  }
2432
- isEqual(a9, b10) {
2433
- return this.isSame(a9, b10);
2482
+ isEqual(a9, b9) {
2483
+ return this.isSame(a9, b9);
2434
2484
  }
2435
2485
  downcast(shape2, _type) {
2436
2486
  return shape2;
@@ -2443,8 +2493,8 @@ class BrepkitAdapter {
2443
2493
  return !shape2 || !isBrepkitHandle(shape2);
2444
2494
  }
2445
2495
  shapeOrientation(shape2) {
2446
- const h8 = unwrap(shape2);
2447
- const orient = this.bk.getShapeOrientation(h8);
2496
+ const h10 = unwrap(shape2);
2497
+ const orient = this.bk.getShapeOrientation(h10);
2448
2498
  return orient;
2449
2499
  }
2450
2500
  // ═══════════════════════════════════════════════════════════════════════
@@ -2469,12 +2519,12 @@ class BrepkitAdapter {
2469
2519
  const id = this.bk.getFaceOuterWire(unwrap(face, "face"));
2470
2520
  return wireHandle(id);
2471
2521
  }
2472
- surfaceNormal(face, u7, v9) {
2473
- const n9 = this.bk.evaluateSurfaceNormal(unwrap(face, "face"), u7, v9);
2474
- return [n9[0], n9[1], n9[2]];
2522
+ surfaceNormal(face, u8, v9) {
2523
+ const n7 = this.bk.evaluateSurfaceNormal(unwrap(face, "face"), u8, v9);
2524
+ return [n7[0], n7[1], n7[2]];
2475
2525
  }
2476
- pointOnSurface(face, u7, v9) {
2477
- const p7 = this.bk.evaluateSurface(unwrap(face, "face"), u7, v9);
2526
+ pointOnSurface(face, u8, v9) {
2527
+ const p7 = this.bk.evaluateSurface(unwrap(face, "face"), u8, v9);
2478
2528
  return [p7[0], p7[1], p7[2]];
2479
2529
  }
2480
2530
  uvFromPoint(face, point) {
@@ -2504,11 +2554,11 @@ class BrepkitAdapter {
2504
2554
  // Geometry queries: edge / curve
2505
2555
  // ═══════════════════════════════════════════════════════════════════════
2506
2556
  curveTangent(shape2, param) {
2507
- const h8 = shape2;
2557
+ const h10 = shape2;
2508
2558
  let edgeId;
2509
2559
  let evalParam = param;
2510
- if (h8.type === "wire") {
2511
- const edgeIds = toArray(this.bk.getWireEdges(h8.id));
2560
+ if (h10.type === "wire") {
2561
+ const edgeIds = toArray(this.bk.getWireEdges(h10.id));
2512
2562
  edgeId = edgeIds[edgeIds.length - 1];
2513
2563
  let cumulative = 0;
2514
2564
  for (const eid of edgeIds) {
@@ -2531,9 +2581,9 @@ class BrepkitAdapter {
2531
2581
  };
2532
2582
  }
2533
2583
  curveParameters(shape2) {
2534
- const h8 = shape2;
2535
- if (h8.type === "wire") {
2536
- const edgeIds = toArray(this.bk.getWireEdges(h8.id));
2584
+ const h10 = shape2;
2585
+ if (h10.type === "wire") {
2586
+ const edgeIds = toArray(this.bk.getWireEdges(h10.id));
2537
2587
  if (edgeIds.length === 0) return [0, 0];
2538
2588
  let total = 0;
2539
2589
  for (const eid of edgeIds) {
@@ -2547,9 +2597,9 @@ class BrepkitAdapter {
2547
2597
  return [params[0], params[1]];
2548
2598
  }
2549
2599
  curvePointAtParam(shape2, param) {
2550
- const h8 = shape2;
2551
- if (h8.type === "wire") {
2552
- const edgeIds = toArray(this.bk.getWireEdges(h8.id));
2600
+ const h10 = shape2;
2601
+ if (h10.type === "wire") {
2602
+ const edgeIds = toArray(this.bk.getWireEdges(h10.id));
2553
2603
  let cumulative = 0;
2554
2604
  for (const eid of edgeIds) {
2555
2605
  const p22 = this.bk.getEdgeCurveParameters(eid);
@@ -2569,9 +2619,9 @@ class BrepkitAdapter {
2569
2619
  return [p7[0], p7[1], p7[2]];
2570
2620
  }
2571
2621
  curveIsClosed(shape2) {
2572
- const h8 = shape2;
2573
- if (h8.type === "wire") {
2574
- const edgeIds = toArray(this.bk.getWireEdges(h8.id));
2622
+ const h10 = shape2;
2623
+ if (h10.type === "wire") {
2624
+ const edgeIds = toArray(this.bk.getWireEdges(h10.id));
2575
2625
  if (edgeIds.length === 0) return false;
2576
2626
  if (edgeIds.length === 1) {
2577
2627
  const verts2 = this.bk.getEdgeVertices(edgeIds[0]);
@@ -2586,7 +2636,7 @@ class BrepkitAdapter {
2586
2636
  const unmatched = [];
2587
2637
  for (const pt of endpoints) {
2588
2638
  const matchIdx = unmatched.findIndex(
2589
- (u7) => dist3(u7[0], u7[1], u7[2], pt[0], pt[1], pt[2]) < 1e-7
2639
+ (u8) => dist3(u8[0], u8[1], u8[2], pt[0], pt[1], pt[2]) < 1e-7
2590
2640
  );
2591
2641
  if (matchIdx >= 0) {
2592
2642
  unmatched.splice(matchIdx, 1);
@@ -2600,11 +2650,11 @@ class BrepkitAdapter {
2600
2650
  return dist3(verts[0], verts[1], verts[2], verts[3], verts[4], verts[5]) < 1e-7;
2601
2651
  }
2602
2652
  curveIsPeriodic(shape2) {
2603
- const h8 = shape2;
2653
+ const h10 = shape2;
2604
2654
  try {
2605
- if (h8.type === "edge") return this.curveIsClosed(shape2);
2606
- if (h8.type === "wire") {
2607
- const edgeIds = toArray(this.bk.getWireEdges(h8.id));
2655
+ if (h10.type === "edge") return this.curveIsClosed(shape2);
2656
+ if (h10.type === "wire") {
2657
+ const edgeIds = toArray(this.bk.getWireEdges(h10.id));
2608
2658
  if (edgeIds.length === 1) return this.curveIsClosed(shape2);
2609
2659
  }
2610
2660
  } catch {
@@ -2622,8 +2672,8 @@ class BrepkitAdapter {
2622
2672
  return 0;
2623
2673
  }
2624
2674
  curveType(shape2) {
2625
- const h8 = shape2;
2626
- if (h8.type === "wire") {
2675
+ const h10 = shape2;
2676
+ if (h10.type === "wire") {
2627
2677
  const edges = this.iterShapes(shape2, "edge");
2628
2678
  const first = edges[0];
2629
2679
  if (first) return this.bk.getEdgeCurveType(unwrap(first, "edge"));
@@ -2669,15 +2719,15 @@ class BrepkitAdapter {
2669
2719
  sew(shapes, tolerance) {
2670
2720
  const faceIds = [];
2671
2721
  for (const s6 of shapes) {
2672
- const h8 = s6;
2673
- if (h8.type === "face") {
2674
- faceIds.push(h8.id);
2675
- } else if (h8.type === "solid") {
2676
- for (const fid of toArray(this.bk.getSolidFaces(h8.id))) {
2722
+ const h10 = s6;
2723
+ if (h10.type === "face") {
2724
+ faceIds.push(h10.id);
2725
+ } else if (h10.type === "solid") {
2726
+ for (const fid of toArray(this.bk.getSolidFaces(h10.id))) {
2677
2727
  faceIds.push(fid);
2678
2728
  }
2679
- } else if (h8.type === "shell") {
2680
- for (const fid of toArray(this.bk.getShellFaces(h8.id))) {
2729
+ } else if (h10.type === "shell") {
2730
+ for (const fid of toArray(this.bk.getShellFaces(h10.id))) {
2681
2731
  faceIds.push(fid);
2682
2732
  }
2683
2733
  }
@@ -2693,10 +2743,10 @@ class BrepkitAdapter {
2693
2743
  return shellHandle(id);
2694
2744
  }
2695
2745
  healSolid(shape2) {
2696
- const h8 = shape2;
2697
- if (h8.type !== "solid") {
2746
+ const h10 = shape2;
2747
+ if (h10.type !== "solid") {
2698
2748
  throw new Error(
2699
- `brepkit: healSolid requires a solid, got ${h8.type}. Consider using makeCompound() to combine shapes first.`
2749
+ `brepkit: healSolid requires a solid, got ${h10.type}. Consider using makeCompound() to combine shapes first.`
2700
2750
  );
2701
2751
  }
2702
2752
  try {
@@ -2741,8 +2791,8 @@ class BrepkitAdapter {
2741
2791
  if (coords2d.length < 6) return wire;
2742
2792
  const result = this.bk.offsetPolygon2d(coords2d, offset2, 1e-10);
2743
2793
  const coords3d = [];
2744
- for (let i7 = 0; i7 < result.length; i7 += 2) {
2745
- coords3d.push(result[i7], result[i7 + 1], 0);
2794
+ for (let i9 = 0; i9 < result.length; i9 += 2) {
2795
+ coords3d.push(result[i9], result[i9 + 1], 0);
2746
2796
  }
2747
2797
  const wireId = this.bk.makePolygonWire(coords3d);
2748
2798
  return wireHandle(wireId);
@@ -2805,7 +2855,7 @@ class BrepkitAdapter {
2805
2855
  // ═══════════════════════════════════════════════════════════════════════
2806
2856
  // Classification
2807
2857
  // ═══════════════════════════════════════════════════════════════════════
2808
- classifyPointOnFace(face, u7, v9, tolerance) {
2858
+ classifyPointOnFace(face, u8, v9, tolerance) {
2809
2859
  if (tolerance !== void 0) {
2810
2860
  warnOnce(
2811
2861
  "classify-tolerance",
@@ -2814,7 +2864,7 @@ class BrepkitAdapter {
2814
2864
  }
2815
2865
  const faceId = unwrap(face, "face");
2816
2866
  const domain = this.bk.getSurfaceDomain(faceId);
2817
- if (u7 < domain[0] || u7 > domain[1] || v9 < domain[2] || v9 > domain[3]) {
2867
+ if (u8 < domain[0] || u8 > domain[1] || v9 < domain[2] || v9 > domain[3]) {
2818
2868
  return "out";
2819
2869
  }
2820
2870
  return "in";
@@ -2920,8 +2970,8 @@ class BrepkitAdapter {
2920
2970
  }
2921
2971
  loftAdvanced(wires, options) {
2922
2972
  const faceIds = wires.map((w7) => {
2923
- const h8 = w7;
2924
- if (h8.type === "wire") return this.bk.makeFaceFromWire(h8.id);
2973
+ const h10 = w7;
2974
+ if (h10.type === "wire") return this.bk.makeFaceFromWire(h10.id);
2925
2975
  return unwrap(w7, "face");
2926
2976
  });
2927
2977
  try {
@@ -2987,8 +3037,8 @@ class BrepkitAdapter {
2987
3037
  }
2988
3038
  linearPattern(shape2, direction, spacing, count) {
2989
3039
  const results = [shape2];
2990
- for (let i7 = 1; i7 < count; i7++) {
2991
- const offset2 = spacing * i7;
3040
+ for (let i9 = 1; i9 < count; i9++) {
3041
+ const offset2 = spacing * i9;
2992
3042
  results.push(
2993
3043
  this.translate(shape2, direction[0] * offset2, direction[1] * offset2, direction[2] * offset2)
2994
3044
  );
@@ -2997,8 +3047,8 @@ class BrepkitAdapter {
2997
3047
  }
2998
3048
  circularPattern(shape2, center, axis, angleStep, count) {
2999
3049
  const results = [shape2];
3000
- for (let i7 = 1; i7 < count; i7++) {
3001
- results.push(this.rotate(shape2, angleStep * i7, axis, center));
3050
+ for (let i9 = 1; i9 < count; i9++) {
3051
+ results.push(this.rotate(shape2, angleStep * i9, axis, center));
3002
3052
  }
3003
3053
  return results;
3004
3054
  }
@@ -3053,11 +3103,11 @@ class BrepkitAdapter {
3053
3103
  triangulatedSurface(points, rows, cols) {
3054
3104
  const faces = [];
3055
3105
  for (let r9 = 0; r9 < rows - 1; r9++) {
3056
- for (let c7 = 0; c7 < cols - 1; c7++) {
3057
- const i00 = r9 * cols + c7;
3058
- const i10 = (r9 + 1) * cols + c7;
3059
- const i01 = r9 * cols + (c7 + 1);
3060
- const i11 = (r9 + 1) * cols + (c7 + 1);
3106
+ for (let c8 = 0; c8 < cols - 1; c8++) {
3107
+ const i00 = r9 * cols + c8;
3108
+ const i10 = (r9 + 1) * cols + c8;
3109
+ const i01 = r9 * cols + (c8 + 1);
3110
+ const i11 = (r9 + 1) * cols + (c8 + 1);
3061
3111
  const f1 = this.buildTriFace(points[i00], points[i10], points[i01]);
3062
3112
  if (f1) faces.push(f1);
3063
3113
  const f22 = this.buildTriFace(points[i10], points[i11], points[i01]);
@@ -3070,9 +3120,9 @@ class BrepkitAdapter {
3070
3120
  // ═══════════════════════════════════════════════════════════════════════
3071
3121
  // Mesh sewing -> solid
3072
3122
  // ═══════════════════════════════════════════════════════════════════════
3073
- buildTriFace(a9, b10, c7) {
3074
- const ab = [b10[0] - a9[0], b10[1] - a9[1], b10[2] - a9[2]];
3075
- const ac = [c7[0] - a9[0], c7[1] - a9[1], c7[2] - a9[2]];
3123
+ buildTriFace(a9, b9, c8) {
3124
+ const ab = [b9[0] - a9[0], b9[1] - a9[1], b9[2] - a9[2]];
3125
+ const ac = [c8[0] - a9[0], c8[1] - a9[1], c8[2] - a9[2]];
3076
3126
  const cross = [
3077
3127
  ab[1] * ac[2] - ab[2] * ac[1],
3078
3128
  ab[2] * ac[0] - ab[0] * ac[2],
@@ -3081,9 +3131,9 @@ class BrepkitAdapter {
3081
3131
  const area = Math.sqrt(cross[0] ** 2 + cross[1] ** 2 + cross[2] ** 2);
3082
3132
  if (area < 1e-12) return null;
3083
3133
  try {
3084
- const e1 = this.makeLineEdge(a9, b10);
3085
- const e22 = this.makeLineEdge(b10, c7);
3086
- const e32 = this.makeLineEdge(c7, a9);
3134
+ const e1 = this.makeLineEdge(a9, b9);
3135
+ const e22 = this.makeLineEdge(b9, c8);
3136
+ const e32 = this.makeLineEdge(c8, a9);
3087
3137
  const wire = this.makeWire([e1, e22, e32]);
3088
3138
  return this.makeFace(wire);
3089
3139
  } catch (e8) {
@@ -3100,9 +3150,9 @@ class BrepkitAdapter {
3100
3150
  // Repair
3101
3151
  // ═══════════════════════════════════════════════════════════════════════
3102
3152
  fixShape(shape2) {
3103
- const h8 = shape2;
3104
- if (h8.type === "solid") {
3105
- this.bk.healSolid(h8.id);
3153
+ const h10 = shape2;
3154
+ if (h10.type === "solid") {
3155
+ this.bk.healSolid(h10.id);
3106
3156
  }
3107
3157
  return shape2;
3108
3158
  }
@@ -3112,9 +3162,9 @@ class BrepkitAdapter {
3112
3162
  // ═══════════════════════════════════════════════════════════════════════
3113
3163
  // Measurement (advanced)
3114
3164
  // ═══════════════════════════════════════════════════════════════════════
3115
- surfaceCurvature(face, u7, v9) {
3165
+ surfaceCurvature(face, u8, v9) {
3116
3166
  const fid = unwrap(face, "face");
3117
- const data = this.bk.measureCurvatureAtSurface(fid, u7, v9);
3167
+ const data = this.bk.measureCurvatureAtSurface(fid, u8, v9);
3118
3168
  if (data.length < 8) {
3119
3169
  throw new Error(
3120
3170
  `brepkit: measureCurvatureAtSurface returned ${data.length} values, expected 8`
@@ -3138,8 +3188,8 @@ class BrepkitAdapter {
3138
3188
  const pos = mesh2.positions;
3139
3189
  const idx = mesh2.indices;
3140
3190
  let cx = 0, cy = 0, cz = 0, totalArea = 0;
3141
- for (let t11 = 0; t11 < idx.length; t11 += 3) {
3142
- const i0 = idx[t11] * 3, i1 = idx[t11 + 1] * 3, i22 = idx[t11 + 2] * 3;
3191
+ for (let t10 = 0; t10 < idx.length; t10 += 3) {
3192
+ const i0 = idx[t10] * 3, i1 = idx[t10 + 1] * 3, i22 = idx[t10 + 2] * 3;
3143
3193
  const tcx = (pos[i0] + pos[i1] + pos[i22]) / 3;
3144
3194
  const tcy = (pos[i0 + 1] + pos[i1 + 1] + pos[i22 + 1]) / 3;
3145
3195
  const tcz = (pos[i0 + 2] + pos[i1 + 2] + pos[i22 + 2]) / 3;
@@ -3229,11 +3279,11 @@ class BrepkitAdapter {
3229
3279
  getBezierPenultimatePole(edge) {
3230
3280
  const nurbsData = this.extractNurbsFromEdge(edge);
3231
3281
  if (!nurbsData || nurbsData.controlPoints.length < 6) return null;
3232
- const n9 = nurbsData.controlPoints.length;
3282
+ const n7 = nurbsData.controlPoints.length;
3233
3283
  return [
3234
- nurbsData.controlPoints[n9 - 6],
3235
- nurbsData.controlPoints[n9 - 5],
3236
- nurbsData.controlPoints[n9 - 4]
3284
+ nurbsData.controlPoints[n7 - 6],
3285
+ nurbsData.controlPoints[n7 - 5],
3286
+ nurbsData.controlPoints[n7 - 4]
3237
3287
  ];
3238
3288
  }
3239
3289
  // ═══════════════════════════════════════════════════════════════════════
@@ -3286,9 +3336,9 @@ class BrepkitAdapter {
3286
3336
  // Shape reversal
3287
3337
  // ═══════════════════════════════════════════════════════════════════════
3288
3338
  reverseShape(shape2) {
3289
- const h8 = shape2;
3290
- const newId = this.bk.reverseShape(h8.id);
3291
- return handle(h8.type, newId);
3339
+ const h10 = shape2;
3340
+ const newId = this.bk.reverseShape(h10.id);
3341
+ return handle(h10.type, newId);
3292
3342
  }
3293
3343
  // ═══════════════════════════════════════════════════════════════════════
3294
3344
  // Dispose
@@ -3320,17 +3370,17 @@ class BrepkitAdapter {
3320
3370
  // ═══════════════════════════════════════════════════════════════════════
3321
3371
  // Kernel2DCapability — pure TypeScript implementation
3322
3372
  // ═══════════════════════════════════════════════════════════════════════
3323
- c2d(h8) {
3324
- return h8;
3373
+ c2d(h10) {
3374
+ return h10;
3325
3375
  }
3326
3376
  /** Unwrap any trimmed wrappers to get the underlying geometry. */
3327
- c2dBasis(h8) {
3328
- let c7 = this.c2d(h8);
3329
- while (c7.__bk2d === "trimmed") c7 = c7.basis;
3330
- return c7;
3377
+ c2dBasis(h10) {
3378
+ let c8 = this.c2d(h10);
3379
+ while (c8.__bk2d === "trimmed") c8 = c8.basis;
3380
+ return c8;
3331
3381
  }
3332
- bb2d(h8) {
3333
- return h8;
3382
+ bb2d(h10) {
3383
+ return h10;
3334
3384
  }
3335
3385
  createPoint2d(x7, y6) {
3336
3386
  return { x: x7, y: y6 };
@@ -3375,9 +3425,14 @@ class BrepkitAdapter {
3375
3425
  const sense = da1m < da12;
3376
3426
  const circle = makeCircle2d(cx, cy, radius, sense);
3377
3427
  if (!sense) {
3378
- return { __bk2d: "trimmed", basis: circle, tStart: -a12, tEnd: -a23 };
3428
+ const tStart = -a12;
3429
+ let tEnd2 = -a23;
3430
+ if (tEnd2 < tStart - 1e-9) tEnd2 += 2 * Math.PI;
3431
+ return { __bk2d: "trimmed", basis: circle, tStart, tEnd: tEnd2 };
3379
3432
  }
3380
- return { __bk2d: "trimmed", basis: circle, tStart: a12, tEnd: a23 };
3433
+ let tEnd = a23;
3434
+ if (tEnd < a12 - 1e-9) tEnd += 2 * Math.PI;
3435
+ return { __bk2d: "trimmed", basis: circle, tStart: a12, tEnd };
3381
3436
  }
3382
3437
  makeArc2dTangent(sx, sy, tx, ty, ex, ey) {
3383
3438
  const len = Math.sqrt(tx * tx + ty * ty);
@@ -3390,10 +3445,10 @@ class BrepkitAdapter {
3390
3445
  return makeLine2d(sx, sy, ex, ey);
3391
3446
  }
3392
3447
  const chord2 = dx * dx + dy * dy;
3393
- const t11 = -chord2 / denom;
3394
- const cx = sx - t11 * nty;
3395
- const cy = sy + t11 * ntx;
3396
- const radius = Math.abs(t11);
3448
+ const t10 = -chord2 / denom;
3449
+ const cx = sx - t10 * nty;
3450
+ const cy = sy + t10 * ntx;
3451
+ const radius = Math.abs(t10);
3397
3452
  const a12 = Math.atan2(sy - cy, sx - cx);
3398
3453
  const a23 = Math.atan2(ey - cy, ex - cx);
3399
3454
  const ccwTanX = -(sy - cy) / radius;
@@ -3424,15 +3479,15 @@ class BrepkitAdapter {
3424
3479
  return makeBezier2d(points);
3425
3480
  }
3426
3481
  makeBSpline2d(points, _options) {
3427
- const n9 = points.length;
3428
- const degree = Math.min(3, n9 - 1);
3482
+ const n7 = points.length;
3483
+ const degree = Math.min(3, n7 - 1);
3429
3484
  const knots = [];
3430
3485
  const mults = [];
3431
3486
  knots.push(0);
3432
3487
  mults.push(degree + 1);
3433
- const nInternal = n9 - degree - 1;
3434
- for (let i7 = 1; i7 <= nInternal; i7++) {
3435
- knots.push(i7 / (nInternal + 1));
3488
+ const nInternal = n7 - degree - 1;
3489
+ for (let i9 = 1; i9 <= nInternal; i9++) {
3490
+ knots.push(i9 / (nInternal + 1));
3436
3491
  mults.push(1);
3437
3492
  }
3438
3493
  knots.push(1);
@@ -3470,14 +3525,14 @@ class BrepkitAdapter {
3470
3525
  return JSON.parse(JSON.stringify(curve));
3471
3526
  }
3472
3527
  offsetCurve2d(curve, offset2) {
3473
- const c7 = this.c2d(curve);
3474
- const bounds = curveBounds(c7);
3528
+ const c8 = this.c2d(curve);
3529
+ const bounds = curveBounds(c8);
3475
3530
  const N4 = 30;
3476
3531
  const poles = [];
3477
- for (let i7 = 0; i7 <= N4; i7++) {
3478
- const t11 = bounds.first + (bounds.last - bounds.first) * i7 / N4;
3479
- const [px, py] = evaluateCurve2d(c7, t11);
3480
- const [tx, ty] = tangentCurve2d(c7, t11);
3532
+ for (let i9 = 0; i9 <= N4; i9++) {
3533
+ const t10 = bounds.first + (bounds.last - bounds.first) * i9 / N4;
3534
+ const [px, py] = evaluateCurve2d(c8, t10);
3535
+ const [tx, ty] = tangentCurve2d(c8, t10);
3481
3536
  const tLen = Math.sqrt(tx * tx + ty * ty);
3482
3537
  if (tLen > 1e-12) {
3483
3538
  poles.push([px - ty / tLen * offset2, py + tx / tLen * offset2]);
@@ -3550,8 +3605,8 @@ class BrepkitAdapter {
3550
3605
  return this._gtrsf([-1, 0, 0, 0, -1, 0, 0, 0, 1], 2 * cx, 2 * cy);
3551
3606
  }
3552
3607
  createRotationGTrsf2d(angle, cx, cy) {
3553
- const c7 = Math.cos(angle), s6 = Math.sin(angle);
3554
- return this._gtrsf([c7, -s6, 0, s6, c7, 0, 0, 0, 1], cx - c7 * cx + s6 * cy, cy - s6 * cx - c7 * cy);
3608
+ const c8 = Math.cos(angle), s6 = Math.sin(angle);
3609
+ return this._gtrsf([c8, -s6, 0, s6, c8, 0, 0, 0, 1], cx - c8 * cx + s6 * cy, cy - s6 * cx - c8 * cy);
3555
3610
  }
3556
3611
  createScaleGTrsf2d(factor, cx, cy) {
3557
3612
  return this._gtrsf([factor, 0, 0, 0, factor, 0, 0, 0, 1], cx * (1 - factor), cy * (1 - factor));
@@ -3561,17 +3616,17 @@ class BrepkitAdapter {
3561
3616
  gtrsf.ty = dy;
3562
3617
  }
3563
3618
  multiplyGTrsf2d(base, other) {
3564
- const a9 = base.m, b10 = other.m;
3619
+ const a9 = base.m, b9 = other.m;
3565
3620
  const r9 = [
3566
- a9[0] * b10[0] + a9[1] * b10[3] + a9[2] * b10[6],
3567
- a9[0] * b10[1] + a9[1] * b10[4] + a9[2] * b10[7],
3568
- a9[0] * b10[2] + a9[1] * b10[5] + a9[2] * b10[8],
3569
- a9[3] * b10[0] + a9[4] * b10[3] + a9[5] * b10[6],
3570
- a9[3] * b10[1] + a9[4] * b10[4] + a9[5] * b10[7],
3571
- a9[3] * b10[2] + a9[4] * b10[5] + a9[5] * b10[8],
3572
- a9[6] * b10[0] + a9[7] * b10[3] + a9[8] * b10[6],
3573
- a9[6] * b10[1] + a9[7] * b10[4] + a9[8] * b10[7],
3574
- a9[6] * b10[2] + a9[7] * b10[5] + a9[8] * b10[8]
3621
+ a9[0] * b9[0] + a9[1] * b9[3] + a9[2] * b9[6],
3622
+ a9[0] * b9[1] + a9[1] * b9[4] + a9[2] * b9[7],
3623
+ a9[0] * b9[2] + a9[1] * b9[5] + a9[2] * b9[8],
3624
+ a9[3] * b9[0] + a9[4] * b9[3] + a9[5] * b9[6],
3625
+ a9[3] * b9[1] + a9[4] * b9[4] + a9[5] * b9[7],
3626
+ a9[3] * b9[2] + a9[4] * b9[5] + a9[5] * b9[8],
3627
+ a9[6] * b9[0] + a9[7] * b9[3] + a9[8] * b9[6],
3628
+ a9[6] * b9[1] + a9[7] * b9[4] + a9[8] * b9[7],
3629
+ a9[6] * b9[2] + a9[7] * b9[5] + a9[8] * b9[8]
3575
3630
  ];
3576
3631
  base.m = r9;
3577
3632
  const oldTx = base.tx, oldTy = base.ty;
@@ -3580,19 +3635,19 @@ class BrepkitAdapter {
3580
3635
  base.ty = a9[3] * otx + a9[4] * oty + oldTy;
3581
3636
  }
3582
3637
  transformCurve2dGeneral(curve, gtrsf) {
3583
- const c7 = this.c2d(curve);
3638
+ const c8 = this.c2d(curve);
3584
3639
  const m10 = gtrsf.m ?? [1, 0, 0, 0, 1, 0, 0, 0, 1];
3585
3640
  const tx = Number(gtrsf.tx) || 0, ty = Number(gtrsf.ty) || 0;
3586
3641
  const isIdentityMatrix = Math.abs(m10[0] - 1) < 1e-12 && Math.abs(m10[4] - 1) < 1e-12 && Math.abs(m10[1]) < 1e-12 && Math.abs(m10[3]) < 1e-12;
3587
3642
  if (isIdentityMatrix) {
3588
- return translateCurve2d(c7, tx, ty);
3643
+ return translateCurve2d(c8, tx, ty);
3589
3644
  }
3590
- const bounds = curveBounds(c7);
3645
+ const bounds = curveBounds(c8);
3591
3646
  const N4 = 20;
3592
3647
  const pts = [];
3593
- for (let i7 = 0; i7 <= N4; i7++) {
3594
- const t11 = bounds.first + (bounds.last - bounds.first) * i7 / N4;
3595
- const [px, py] = evaluateCurve2d(c7, t11);
3648
+ for (let i9 = 0; i9 <= N4; i9++) {
3649
+ const t10 = bounds.first + (bounds.last - bounds.first) * i9 / N4;
3650
+ const [px, py] = evaluateCurve2d(c8, t10);
3596
3651
  pts.push([m10[0] * px + m10[1] * py + tx, m10[3] * px + m10[4] * py + ty]);
3597
3652
  }
3598
3653
  return makeBezier2d(pts);
@@ -3609,40 +3664,40 @@ class BrepkitAdapter {
3609
3664
  return { points: result.points, segments };
3610
3665
  }
3611
3666
  projectPointOnCurve2d(curve, x7, y6) {
3612
- const c7 = this.c2d(curve);
3613
- const bounds = curveBounds(c7);
3614
- if (c7.__bk2d === "line") {
3615
- const dx = x7 - c7.ox;
3616
- const dy = y6 - c7.oy;
3617
- const t11 = Math.max(bounds.first, Math.min(bounds.last, dx * c7.dx + dy * c7.dy));
3618
- const [px, py] = evaluateCurve2d(c7, t11);
3619
- return { param: t11, distance: Math.sqrt((px - x7) ** 2 + (py - y6) ** 2) };
3620
- }
3621
- if (c7.__bk2d === "circle") {
3622
- const angle = Math.atan2(y6 - c7.cy, x7 - c7.cx);
3623
- let t11 = c7.sense ? angle : -angle;
3624
- while (t11 < 0) t11 += 2 * Math.PI;
3625
- while (t11 > 2 * Math.PI) t11 -= 2 * Math.PI;
3626
- const [px, py] = evaluateCurve2d(c7, t11);
3627
- return { param: t11, distance: Math.sqrt((px - x7) ** 2 + (py - y6) ** 2) };
3667
+ const c8 = this.c2d(curve);
3668
+ const bounds = curveBounds(c8);
3669
+ if (c8.__bk2d === "line") {
3670
+ const dx = x7 - c8.ox;
3671
+ const dy = y6 - c8.oy;
3672
+ const t10 = Math.max(bounds.first, Math.min(bounds.last, dx * c8.dx + dy * c8.dy));
3673
+ const [px, py] = evaluateCurve2d(c8, t10);
3674
+ return { param: t10, distance: Math.sqrt((px - x7) ** 2 + (py - y6) ** 2) };
3675
+ }
3676
+ if (c8.__bk2d === "circle") {
3677
+ const angle = Math.atan2(y6 - c8.cy, x7 - c8.cx);
3678
+ let t10 = c8.sense ? angle : -angle;
3679
+ while (t10 < 0) t10 += 2 * Math.PI;
3680
+ while (t10 > 2 * Math.PI) t10 -= 2 * Math.PI;
3681
+ const [px, py] = evaluateCurve2d(c8, t10);
3682
+ return { param: t10, distance: Math.sqrt((px - x7) ** 2 + (py - y6) ** 2) };
3628
3683
  }
3629
3684
  if (!isFinite(bounds.first) || !isFinite(bounds.last)) return null;
3630
3685
  let bestT = bounds.first;
3631
3686
  let bestDist = Infinity;
3632
3687
  const N4 = 200;
3633
3688
  const dt = (bounds.last - bounds.first) / N4;
3634
- for (let i7 = 0; i7 <= N4; i7++) {
3635
- const t11 = bounds.first + i7 * dt;
3636
- const [px, py] = evaluateCurve2d(c7, t11);
3689
+ for (let i9 = 0; i9 <= N4; i9++) {
3690
+ const t10 = bounds.first + i9 * dt;
3691
+ const [px, py] = evaluateCurve2d(c8, t10);
3637
3692
  const d10 = (px - x7) ** 2 + (py - y6) ** 2;
3638
3693
  if (d10 < bestDist) {
3639
3694
  bestDist = d10;
3640
- bestT = t11;
3695
+ bestT = t10;
3641
3696
  }
3642
3697
  }
3643
3698
  for (let iter = 0; iter < 10; iter++) {
3644
- const [px, py] = evaluateCurve2d(c7, bestT);
3645
- const [tx, ty] = tangentCurve2d(c7, bestT);
3699
+ const [px, py] = evaluateCurve2d(c8, bestT);
3700
+ const [tx, ty] = tangentCurve2d(c8, bestT);
3646
3701
  const dot = (px - x7) * tx + (py - y6) * ty;
3647
3702
  const denom = tx * tx + ty * ty;
3648
3703
  if (denom < 1e-20) break;
@@ -3651,7 +3706,7 @@ class BrepkitAdapter {
3651
3706
  if (Math.abs(newT - bestT) < 1e-14) break;
3652
3707
  bestT = newT;
3653
3708
  }
3654
- const [fx, fy] = evaluateCurve2d(c7, bestT);
3709
+ const [fx, fy] = evaluateCurve2d(c8, bestT);
3655
3710
  return { param: bestT, distance: Math.sqrt((fx - x7) ** 2 + (fy - y6) ** 2) };
3656
3711
  }
3657
3712
  distanceBetweenCurves2d(c1, c22, p1s, p1e, p2s, p2e) {
@@ -3661,11 +3716,11 @@ class BrepkitAdapter {
3661
3716
  let bestT2 = p2s;
3662
3717
  let minDistSq = Infinity;
3663
3718
  const N4 = 50;
3664
- for (let i7 = 0; i7 <= N4; i7++) {
3665
- const t12 = p1s + (p1e - p1s) * i7 / N4;
3719
+ for (let i9 = 0; i9 <= N4; i9++) {
3720
+ const t12 = p1s + (p1e - p1s) * i9 / N4;
3666
3721
  const [x1, y1] = evaluateCurve2d(curve1, t12);
3667
- for (let j6 = 0; j6 <= N4; j6++) {
3668
- const t222 = p2s + (p2e - p2s) * j6 / N4;
3722
+ for (let j7 = 0; j7 <= N4; j7++) {
3723
+ const t222 = p2s + (p2e - p2s) * j7 / N4;
3669
3724
  const [x22, y22] = evaluateCurve2d(curve2, t222);
3670
3725
  const d10 = (x22 - x1) ** 2 + (y22 - y1) ** 2;
3671
3726
  if (d10 < minDistSq) {
@@ -3700,8 +3755,8 @@ class BrepkitAdapter {
3700
3755
  return Math.sqrt((fx2 - fx1) ** 2 + (fy2 - fy1) ** 2);
3701
3756
  }
3702
3757
  approximateCurve2dAsBSpline(curve, tol, cont, maxSeg) {
3703
- const c7 = this.c2d(curve);
3704
- const bounds = curveBounds(c7);
3758
+ const c8 = this.c2d(curve);
3759
+ const bounds = curveBounds(c8);
3705
3760
  const contDeg = cont === "C0" ? 1 : cont === "C1" ? 2 : cont === "C2" ? 3 : 4;
3706
3761
  const degree = Math.max(3, contDeg);
3707
3762
  let N4 = Math.max(100, maxSeg * 10);
@@ -3709,16 +3764,16 @@ class BrepkitAdapter {
3709
3764
  let maxErr = Infinity;
3710
3765
  for (let attempt = 0; attempt < 3 && maxErr > tol; attempt++) {
3711
3766
  poles = [];
3712
- for (let i7 = 0; i7 <= N4; i7++) {
3713
- const t11 = bounds.first + (bounds.last - bounds.first) * i7 / N4;
3714
- poles.push(evaluateCurve2d(c7, t11));
3767
+ for (let i9 = 0; i9 <= N4; i9++) {
3768
+ const t10 = bounds.first + (bounds.last - bounds.first) * i9 / N4;
3769
+ poles.push(evaluateCurve2d(c8, t10));
3715
3770
  }
3716
3771
  maxErr = 0;
3717
- for (let i7 = 0; i7 < N4; i7++) {
3718
- const tMid = bounds.first + (bounds.last - bounds.first) * (i7 + 0.5) / N4;
3719
- const [ex, ey] = evaluateCurve2d(c7, tMid);
3720
- const p0 = poles[i7];
3721
- const p1 = poles[i7 + 1];
3772
+ for (let i9 = 0; i9 < N4; i9++) {
3773
+ const tMid = bounds.first + (bounds.last - bounds.first) * (i9 + 0.5) / N4;
3774
+ const [ex, ey] = evaluateCurve2d(c8, tMid);
3775
+ const p0 = poles[i9];
3776
+ const p1 = poles[i9 + 1];
3722
3777
  const mx = (p0[0] + p1[0]) / 2;
3723
3778
  const my = (p0[1] + p1[1]) / 2;
3724
3779
  const err2 = Math.sqrt((ex - mx) ** 2 + (ey - my) ** 2);
@@ -3729,9 +3784,9 @@ class BrepkitAdapter {
3729
3784
  return this.makeBSpline2d(poles, { degMax: degree });
3730
3785
  }
3731
3786
  decomposeBSpline2dToBeziers(curve) {
3732
- const c7 = this.c2dBasis(curve);
3733
- if (c7.__bk2d === "bezier") return [curve];
3734
- if (c7.__bk2d !== "bspline") {
3787
+ const c8 = this.c2dBasis(curve);
3788
+ if (c8.__bk2d === "bezier") return [curve];
3789
+ if (c8.__bk2d !== "bspline") {
3735
3790
  const approx = this.approximateCurve2dAsBSpline(curve, 1e-6, "C2", 10);
3736
3791
  return this.decomposeBSpline2dToBeziers(approx);
3737
3792
  }
@@ -3739,20 +3794,20 @@ class BrepkitAdapter {
3739
3794
  const first = trimBounds.first;
3740
3795
  const last = trimBounds.last;
3741
3796
  const internalKnots = [];
3742
- for (const k7 of c7.knots) {
3797
+ for (const k7 of c8.knots) {
3743
3798
  if (k7 > first + 1e-12 && k7 < last - 1e-12) internalKnots.push(k7);
3744
3799
  }
3745
3800
  const breakpoints = [first, ...internalKnots, last];
3746
3801
  const result = [];
3747
- for (let i7 = 0; i7 < breakpoints.length - 1; i7++) {
3748
- const t0 = breakpoints[i7];
3749
- const t1 = breakpoints[i7 + 1];
3802
+ for (let i9 = 0; i9 < breakpoints.length - 1; i9++) {
3803
+ const t0 = breakpoints[i9];
3804
+ const t1 = breakpoints[i9 + 1];
3750
3805
  const span = t1 - t0;
3751
3806
  if (span < 1e-15) continue;
3752
- const p0 = evaluateCurve2d(c7, t0);
3753
- const p32 = evaluateCurve2d(c7, t1);
3754
- const tan0 = tangentCurve2d(c7, t0);
3755
- const tan3 = tangentCurve2d(c7, t1);
3807
+ const p0 = evaluateCurve2d(c8, t0);
3808
+ const p32 = evaluateCurve2d(c8, t1);
3809
+ const tan0 = tangentCurve2d(c8, t0);
3810
+ const tan3 = tangentCurve2d(c8, t1);
3756
3811
  const s6 = span / 3;
3757
3812
  const bezier = {
3758
3813
  __bk2d: "bezier",
@@ -3775,60 +3830,60 @@ class BrepkitAdapter {
3775
3830
  addCurveToBBox(this.bb2d(bbox), this.c2d(curve));
3776
3831
  }
3777
3832
  getBBox2dBounds(bbox) {
3778
- const b10 = this.bb2d(bbox);
3779
- return { xMin: b10.xMin, yMin: b10.yMin, xMax: b10.xMax, yMax: b10.yMax };
3833
+ const b9 = this.bb2d(bbox);
3834
+ return { xMin: b9.xMin, yMin: b9.yMin, xMax: b9.xMax, yMax: b9.yMax };
3780
3835
  }
3781
3836
  mergeBBox2d(target, other) {
3782
- const t11 = this.bb2d(target), o9 = this.bb2d(other);
3783
- t11.xMin = Math.min(t11.xMin, o9.xMin);
3784
- t11.yMin = Math.min(t11.yMin, o9.yMin);
3785
- t11.xMax = Math.max(t11.xMax, o9.xMax);
3786
- t11.yMax = Math.max(t11.yMax, o9.yMax);
3787
- }
3788
- isBBox2dOut(a9, b10) {
3789
- const ba = this.bb2d(a9), bb = this.bb2d(b10);
3837
+ const t10 = this.bb2d(target), o9 = this.bb2d(other);
3838
+ t10.xMin = Math.min(t10.xMin, o9.xMin);
3839
+ t10.yMin = Math.min(t10.yMin, o9.yMin);
3840
+ t10.xMax = Math.max(t10.xMax, o9.xMax);
3841
+ t10.yMax = Math.max(t10.yMax, o9.yMax);
3842
+ }
3843
+ isBBox2dOut(a9, b9) {
3844
+ const ba = this.bb2d(a9), bb = this.bb2d(b9);
3790
3845
  return ba.xMax < bb.xMin || bb.xMax < ba.xMin || ba.yMax < bb.yMin || bb.yMax < ba.yMin;
3791
3846
  }
3792
3847
  isBBox2dOutPoint(bbox, x7, y6) {
3793
- const b10 = this.bb2d(bbox);
3794
- return x7 < b10.xMin || x7 > b10.xMax || y6 < b10.yMin || y6 > b10.yMax;
3848
+ const b9 = this.bb2d(bbox);
3849
+ return x7 < b9.xMin || x7 > b9.xMax || y6 < b9.yMin || y6 > b9.yMax;
3795
3850
  }
3796
3851
  // --- 2D type extraction ---
3797
3852
  getCurve2dCircleData(curve) {
3798
- const c7 = this.c2dBasis(curve);
3799
- if (c7.__bk2d === "circle") return { cx: c7.cx, cy: c7.cy, radius: c7.radius, isDirect: c7.sense };
3853
+ const c8 = this.c2dBasis(curve);
3854
+ if (c8.__bk2d === "circle") return { cx: c8.cx, cy: c8.cy, radius: c8.radius, isDirect: c8.sense };
3800
3855
  return null;
3801
3856
  }
3802
3857
  getCurve2dEllipseData(curve) {
3803
- const c7 = this.c2dBasis(curve);
3804
- if (c7.__bk2d === "ellipse")
3858
+ const c8 = this.c2dBasis(curve);
3859
+ if (c8.__bk2d === "ellipse")
3805
3860
  return {
3806
- majorRadius: c7.majorRadius,
3807
- minorRadius: c7.minorRadius,
3808
- xAxisAngle: c7.xDirAngle,
3809
- isDirect: c7.sense
3861
+ majorRadius: c8.majorRadius,
3862
+ minorRadius: c8.minorRadius,
3863
+ xAxisAngle: c8.xDirAngle,
3864
+ isDirect: c8.sense
3810
3865
  };
3811
3866
  return null;
3812
3867
  }
3813
3868
  getCurve2dBezierPoles(curve) {
3814
- const c7 = this.c2dBasis(curve);
3815
- if (c7.__bk2d === "bezier") return [...c7.poles];
3869
+ const c8 = this.c2dBasis(curve);
3870
+ if (c8.__bk2d === "bezier") return [...c8.poles];
3816
3871
  return null;
3817
3872
  }
3818
3873
  getCurve2dBezierDegree(curve) {
3819
- const c7 = this.c2dBasis(curve);
3820
- if (c7.__bk2d === "bezier") return c7.poles.length - 1;
3874
+ const c8 = this.c2dBasis(curve);
3875
+ if (c8.__bk2d === "bezier") return c8.poles.length - 1;
3821
3876
  return null;
3822
3877
  }
3823
3878
  getCurve2dBSplineData(curve) {
3824
- const c7 = this.c2dBasis(curve);
3825
- if (c7.__bk2d === "bspline")
3879
+ const c8 = this.c2dBasis(curve);
3880
+ if (c8.__bk2d === "bspline")
3826
3881
  return {
3827
- poles: [...c7.poles],
3828
- knots: [...c7.knots],
3829
- multiplicities: [...c7.multiplicities],
3830
- degree: c7.degree,
3831
- isPeriodic: c7.isPeriodic
3882
+ poles: [...c8.poles],
3883
+ knots: [...c8.knots],
3884
+ multiplicities: [...c8.multiplicities],
3885
+ degree: c8.degree,
3886
+ isPeriodic: c8.isPeriodic
3832
3887
  };
3833
3888
  return null;
3834
3889
  }
@@ -3841,49 +3896,49 @@ class BrepkitAdapter {
3841
3896
  }
3842
3897
  // --- 2D curve splitting ---
3843
3898
  splitCurve2d(curve, params) {
3844
- const c7 = this.c2d(curve);
3845
- const bounds = curveBounds(c7);
3846
- const sortedParams = [bounds.first, ...params.sort((a9, b10) => a9 - b10), bounds.last];
3899
+ const c8 = this.c2d(curve);
3900
+ const bounds = curveBounds(c8);
3901
+ const sortedParams = [bounds.first, ...params.sort((a9, b9) => a9 - b9), bounds.last];
3847
3902
  const result = [];
3848
- for (let i7 = 0; i7 < sortedParams.length - 1; i7++) {
3903
+ for (let i9 = 0; i9 < sortedParams.length - 1; i9++) {
3849
3904
  result.push({
3850
3905
  __bk2d: "trimmed",
3851
- basis: c7,
3852
- tStart: sortedParams[i7],
3853
- tEnd: sortedParams[i7 + 1]
3906
+ basis: c8,
3907
+ tStart: sortedParams[i9],
3908
+ tEnd: sortedParams[i9 + 1]
3854
3909
  });
3855
3910
  }
3856
3911
  return result;
3857
3912
  }
3858
3913
  // --- 2D → 3D projection ---
3859
3914
  liftCurve2dToPlane(curve, origin, planeZ, planeX) {
3860
- const c7 = this.c2d(curve);
3915
+ const c8 = this.c2d(curve);
3861
3916
  const y6 = [
3862
3917
  planeZ[1] * planeX[2] - planeZ[2] * planeX[1],
3863
3918
  planeZ[2] * planeX[0] - planeZ[0] * planeX[2],
3864
3919
  planeZ[0] * planeX[1] - planeZ[1] * planeX[0]
3865
3920
  ];
3866
- const lift = (u7, v9) => [
3867
- origin[0] + u7 * planeX[0] + v9 * y6[0],
3868
- origin[1] + u7 * planeX[1] + v9 * y6[1],
3869
- origin[2] + u7 * planeX[2] + v9 * y6[2]
3921
+ const lift = (u8, v9) => [
3922
+ origin[0] + u8 * planeX[0] + v9 * y6[0],
3923
+ origin[1] + u8 * planeX[1] + v9 * y6[1],
3924
+ origin[2] + u8 * planeX[2] + v9 * y6[2]
3870
3925
  ];
3871
- if (c7.__bk2d === "line") {
3872
- const p1 = lift(c7.ox, c7.oy);
3873
- const p22 = lift(c7.ox + c7.dx * c7.len, c7.oy + c7.dy * c7.len);
3926
+ if (c8.__bk2d === "line") {
3927
+ const p1 = lift(c8.ox, c8.oy);
3928
+ const p22 = lift(c8.ox + c8.dx * c8.len, c8.oy + c8.dy * c8.len);
3874
3929
  return this.makeLineEdge(p1, p22);
3875
3930
  }
3876
- if (c7.__bk2d === "circle" || c7.__bk2d === "trimmed") {
3877
- let basis = c7;
3931
+ if (c8.__bk2d === "circle" || c8.__bk2d === "trimmed") {
3932
+ let basis = c8;
3878
3933
  while (basis.__bk2d === "trimmed") basis = basis.basis;
3879
3934
  if (basis.__bk2d === "circle") {
3880
3935
  const circ = basis;
3881
3936
  const center3d = lift(circ.cx, circ.cy);
3882
3937
  const axis = circ.sense ? planeZ : [-planeZ[0], -planeZ[1], -planeZ[2]];
3883
- const bounds2 = curveBounds(c7);
3938
+ const bounds2 = curveBounds(c8);
3884
3939
  let angularSpan;
3885
- if (c7.__bk2d === "trimmed") {
3886
- angularSpan = Math.abs(c7.tEnd - c7.tStart);
3940
+ if (c8.__bk2d === "trimmed") {
3941
+ angularSpan = Math.abs(c8.tEnd - c8.tStart);
3887
3942
  } else {
3888
3943
  angularSpan = 2 * Math.PI;
3889
3944
  }
@@ -3891,8 +3946,8 @@ class BrepkitAdapter {
3891
3946
  const segmentSpan = (bounds2.last - bounds2.first) / nSegments;
3892
3947
  const edgeIds = [];
3893
3948
  for (let seg = 0; seg < nSegments; seg++) {
3894
- const [su, sv] = evaluateCurve2d(c7, bounds2.first + seg * segmentSpan);
3895
- const [eu, ev] = evaluateCurve2d(c7, bounds2.first + (seg + 1) * segmentSpan);
3949
+ const [su, sv] = evaluateCurve2d(c8, bounds2.first + seg * segmentSpan);
3950
+ const [eu, ev] = evaluateCurve2d(c8, bounds2.first + (seg + 1) * segmentSpan);
3896
3951
  edgeIds.push(
3897
3952
  this.bk.makeCircleArc3d(...lift(su, sv), ...lift(eu, ev), ...center3d, ...axis)
3898
3953
  );
@@ -3901,21 +3956,21 @@ class BrepkitAdapter {
3901
3956
  return wireHandle(this.bk.makeWire(edgeIds, false));
3902
3957
  }
3903
3958
  }
3904
- if (c7.__bk2d === "bezier" || c7.__bk2d === "bspline") {
3905
- const points3d = c7.poles.map(([u7, v9]) => lift(u7, v9));
3959
+ if (c8.__bk2d === "bezier" || c8.__bk2d === "bspline") {
3960
+ const points3d = c8.poles.map(([u8, v9]) => lift(u8, v9));
3906
3961
  if (points3d.length === 2) return this.makeLineEdge(points3d[0], points3d[1]);
3907
3962
  const degree = Math.min(3, points3d.length - 1);
3908
3963
  const coords = points3d.flatMap(([px, py, pz]) => [px, py, pz]);
3909
3964
  const id = this.bk.interpolatePoints(coords, degree);
3910
3965
  return edgeHandle(id);
3911
3966
  }
3912
- const bounds = curveBounds(c7);
3967
+ const bounds = curveBounds(c8);
3913
3968
  const nSamples = 100;
3914
3969
  const points = [];
3915
- for (let i7 = 0; i7 <= nSamples; i7++) {
3916
- const t11 = bounds.first + (bounds.last - bounds.first) * i7 / nSamples;
3917
- const [u7, v9] = evaluateCurve2d(c7, t11);
3918
- points.push(lift(u7, v9));
3970
+ for (let i9 = 0; i9 <= nSamples; i9++) {
3971
+ const t10 = bounds.first + (bounds.last - bounds.first) * i9 / nSamples;
3972
+ const [u8, v9] = evaluateCurve2d(c8, t10);
3973
+ points.push(lift(u8, v9));
3919
3974
  }
3920
3975
  return this.interpolatePoints(points);
3921
3976
  }
@@ -3923,15 +3978,15 @@ class BrepkitAdapter {
3923
3978
  if (!isBrepkitHandle(surface))
3924
3979
  throw new Error("brepkit: buildEdgeOnSurface requires a face handle as surface");
3925
3980
  const fid = unwrap(surface, "face");
3926
- const c7 = this.c2d(curve);
3927
- const bounds = curveBounds(c7);
3981
+ const c8 = this.c2d(curve);
3982
+ const bounds = curveBounds(c8);
3928
3983
  const surfType = this.bk.getSurfaceType(fid);
3929
3984
  const N4 = surfType === "plane" ? 50 : 100;
3930
3985
  const points = [];
3931
- for (let i7 = 0; i7 <= N4; i7++) {
3932
- const t11 = bounds.first + (bounds.last - bounds.first) * i7 / N4;
3933
- const [u7, v9] = evaluateCurve2d(c7, t11);
3934
- const p7 = this.bk.evaluateSurface(fid, u7, v9);
3986
+ for (let i9 = 0; i9 <= N4; i9++) {
3987
+ const t10 = bounds.first + (bounds.last - bounds.first) * i9 / N4;
3988
+ const [u8, v9] = evaluateCurve2d(c8, t10);
3989
+ const p7 = this.bk.evaluateSurface(fid, u8, v9);
3935
3990
  points.push([p7[0], p7[1], p7[2]]);
3936
3991
  }
3937
3992
  return this.interpolatePoints(points);
@@ -3949,37 +4004,37 @@ class BrepkitAdapter {
3949
4004
  const MAX_N = 80;
3950
4005
  const REFINE_THRESHOLD = 0.05;
3951
4006
  const tValues = [];
3952
- for (let i7 = 0; i7 <= BASE_N; i7++) {
3953
- tValues.push(tMin + (tMax - tMin) * i7 / BASE_N);
4007
+ for (let i9 = 0; i9 <= BASE_N; i9++) {
4008
+ tValues.push(tMin + (tMax - tMin) * i9 / BASE_N);
3954
4009
  }
3955
- const evaluateUV = (t11) => {
3956
- const pt = this.bk.evaluateEdgeCurve(eid, t11);
4010
+ const evaluateUV = (t10) => {
4011
+ const pt = this.bk.evaluateEdgeCurve(eid, t10);
3957
4012
  const uv = this.bk.projectPointOnSurface(fid, pt[0], pt[1], pt[2]);
3958
4013
  return [uv[0], uv[1]];
3959
4014
  };
3960
- const uvSamples = tValues.map((t11) => ({
3961
- t: t11,
3962
- uv: evaluateUV(t11)
4015
+ const uvSamples = tValues.map((t10) => ({
4016
+ t: t10,
4017
+ uv: evaluateUV(t10)
3963
4018
  }));
3964
4019
  let refinements = 0;
3965
4020
  while (uvSamples.length < MAX_N) {
3966
4021
  const insertions = [];
3967
- for (let i7 = 0; i7 < uvSamples.length - 1; i7++) {
3968
- const a9 = uvSamples[i7];
3969
- const b10 = uvSamples[i7 + 1];
3970
- const tMid = (a9.t + b10.t) / 2;
4022
+ for (let i9 = 0; i9 < uvSamples.length - 1; i9++) {
4023
+ const a9 = uvSamples[i9];
4024
+ const b9 = uvSamples[i9 + 1];
4025
+ const tMid = (a9.t + b9.t) / 2;
3971
4026
  const uvMid = evaluateUV(tMid);
3972
- const interpU = (a9.uv[0] + b10.uv[0]) / 2;
3973
- const interpV = (a9.uv[1] + b10.uv[1]) / 2;
4027
+ const interpU = (a9.uv[0] + b9.uv[0]) / 2;
4028
+ const interpV = (a9.uv[1] + b9.uv[1]) / 2;
3974
4029
  const deviation = Math.sqrt((uvMid[0] - interpU) ** 2 + (uvMid[1] - interpV) ** 2);
3975
4030
  if (deviation > REFINE_THRESHOLD) {
3976
- insertions.push({ index: i7 + 1, t: tMid, uv: uvMid });
4031
+ insertions.push({ index: i9 + 1, t: tMid, uv: uvMid });
3977
4032
  }
3978
4033
  }
3979
4034
  if (insertions.length === 0) break;
3980
4035
  let budget = MAX_N - uvSamples.length;
3981
- for (let j6 = insertions.length - 1; j6 >= 0 && budget > 0; j6--) {
3982
- const ins = insertions[j6];
4036
+ for (let j7 = insertions.length - 1; j7 >= 0 && budget > 0; j7--) {
4037
+ const ins = insertions[j7];
3983
4038
  uvSamples.splice(ins.index, 0, { t: ins.t, uv: ins.uv });
3984
4039
  budget--;
3985
4040
  }
@@ -4015,9 +4070,9 @@ class BrepkitAdapter {
4015
4070
  const tMin = params[0], tMax = params[1];
4016
4071
  const N4 = 10;
4017
4072
  const pts = [];
4018
- for (let i7 = 0; i7 <= N4; i7++) {
4019
- const t11 = tMin + (tMax - tMin) * i7 / N4;
4020
- const p7 = this.bk.evaluateEdgeCurve(edgeId, t11);
4073
+ for (let i9 = 0; i9 <= N4; i9++) {
4074
+ const t10 = tMin + (tMax - tMin) * i9 / N4;
4075
+ const p7 = this.bk.evaluateEdgeCurve(edgeId, t10);
4021
4076
  pts.push(p7[0], p7[1], p7[2]);
4022
4077
  }
4023
4078
  allCoords.push(...pts);
@@ -4039,13 +4094,13 @@ class BrepkitAdapter {
4039
4094
  // Private helpers
4040
4095
  // ═══════════════════════════════════════════════════════════════════════
4041
4096
  applyMatrix(shape2, matrix) {
4042
- const h8 = shape2;
4097
+ const h10 = shape2;
4043
4098
  if (!isBrepkitHandle(shape2)) {
4044
4099
  throw new Error("brepkit: applyMatrix requires a BrepkitHandle");
4045
4100
  }
4046
- switch (h8.type) {
4101
+ switch (h10.type) {
4047
4102
  case "solid": {
4048
- const copy = this.bk.copySolid(h8.id);
4103
+ const copy = this.bk.copySolid(h10.id);
4049
4104
  this.bk.transformSolid(copy, matrix);
4050
4105
  return solidHandle(copy);
4051
4106
  }
@@ -4055,7 +4110,7 @@ class BrepkitAdapter {
4055
4110
  "brepkit: applyMatrix for faces requires copyFace/transformFace WASM exports"
4056
4111
  );
4057
4112
  }
4058
- const copy = this.bk.copyFace(h8.id);
4113
+ const copy = this.bk.copyFace(h10.id);
4059
4114
  this.bk.transformFace(copy, matrix);
4060
4115
  return faceHandle(copy);
4061
4116
  }
@@ -4065,7 +4120,7 @@ class BrepkitAdapter {
4065
4120
  "brepkit: applyMatrix for wires requires copyWire/transformWire WASM exports"
4066
4121
  );
4067
4122
  }
4068
- const copy = this.bk.copyWire(h8.id);
4123
+ const copy = this.bk.copyWire(h10.id);
4069
4124
  this.bk.transformWire(copy, matrix);
4070
4125
  return wireHandle(copy);
4071
4126
  }
@@ -4075,12 +4130,12 @@ class BrepkitAdapter {
4075
4130
  "brepkit: applyMatrix for edges requires copyEdge/transformEdge WASM exports"
4076
4131
  );
4077
4132
  }
4078
- const copy = this.bk.copyEdge(h8.id);
4133
+ const copy = this.bk.copyEdge(h10.id);
4079
4134
  this.bk.transformEdge(copy, matrix);
4080
4135
  return edgeHandle(copy);
4081
4136
  }
4082
4137
  default:
4083
- throw new Error(`brepkit: applyMatrix does not support '${h8.type}' shapes`);
4138
+ throw new Error(`brepkit: applyMatrix does not support '${h10.type}' shapes`);
4084
4139
  }
4085
4140
  }
4086
4141
  /** Check if we need to transform from default placement (origin, +Z). */
@@ -4142,14 +4197,14 @@ class BrepkitAdapter {
4142
4197
  );
4143
4198
  }
4144
4199
  const faceGroups = [];
4145
- for (let i7 = 0; i7 < data.faceOffsets.length - 1; i7++) {
4146
- const start = data.faceOffsets[i7];
4147
- const count = data.faceOffsets[i7 + 1] - start;
4200
+ for (let i9 = 0; i9 < data.faceOffsets.length - 1; i9++) {
4201
+ const start = data.faceOffsets[i9];
4202
+ const count = data.faceOffsets[i9 + 1] - start;
4148
4203
  if (count === 0) continue;
4149
4204
  faceGroups.push({
4150
4205
  start,
4151
4206
  count,
4152
- faceHash: faceIds[i7] ?? 0
4207
+ faceHash: faceIds[i9] ?? 0
4153
4208
  });
4154
4209
  }
4155
4210
  let uvs = new Float32Array(0);
@@ -4194,11 +4249,11 @@ class BrepkitAdapter {
4194
4249
  if (vertCount === 0) continue;
4195
4250
  const triStart = allTriangles.length;
4196
4251
  for (const v9 of positions) allVertices.push(v9);
4197
- for (const n9 of normals) allNormals.push(n9);
4252
+ for (const n7 of normals) allNormals.push(n7);
4198
4253
  for (const idx of indices) {
4199
4254
  allTriangles.push(idx + vertexOffset);
4200
4255
  }
4201
- for (let i7 = 0; i7 < vertCount; i7++) {
4256
+ for (let i9 = 0; i9 < vertCount; i9++) {
4202
4257
  allUVs.push(0, 0);
4203
4258
  }
4204
4259
  faceGroups.push({
@@ -4227,7 +4282,7 @@ class BrepkitAdapter {
4227
4282
  const indices = faceMesh.indices;
4228
4283
  const vertCount = positions.length / 3;
4229
4284
  const uvs = [];
4230
- for (let i7 = 0; i7 < vertCount; i7++) {
4285
+ for (let i9 = 0; i9 < vertCount; i9++) {
4231
4286
  uvs.push(0, 0);
4232
4287
  }
4233
4288
  return {
@@ -4266,15 +4321,15 @@ class BrepkitAdapter {
4266
4321
  const dAngle = (endAngle - startAngle) / nSegments;
4267
4322
  const controlPoints = [];
4268
4323
  const weights = [];
4269
- for (let i7 = 0; i7 <= nSegments; i7++) {
4270
- const angle = startAngle + i7 * dAngle;
4324
+ for (let i9 = 0; i9 <= nSegments; i9++) {
4325
+ const angle = startAngle + i9 * dAngle;
4271
4326
  const cos = Math.cos(angle);
4272
4327
  const sin = Math.sin(angle);
4273
4328
  const px = center[0] + radius * (cos * xAxis[0] + sin * yAxis[0]);
4274
4329
  const py = center[1] + radius * (cos * xAxis[1] + sin * yAxis[1]);
4275
4330
  const pz = center[2] + radius * (cos * xAxis[2] + sin * yAxis[2]);
4276
- if (i7 > 0) {
4277
- const midAngle = startAngle + (i7 - 0.5) * dAngle;
4331
+ if (i9 > 0) {
4332
+ const midAngle = startAngle + (i9 - 0.5) * dAngle;
4278
4333
  const midCos = Math.cos(midAngle);
4279
4334
  const midSin = Math.sin(midAngle);
4280
4335
  const midR = radius / Math.cos(dAngle / 2);
@@ -4289,13 +4344,13 @@ class BrepkitAdapter {
4289
4344
  }
4290
4345
  const degree = 2;
4291
4346
  const knots = Array(degree + 1).fill(0);
4292
- for (let i7 = 1; i7 < nSegments; i7++) {
4293
- knots.push(i7, i7);
4347
+ for (let i9 = 1; i9 < nSegments; i9++) {
4348
+ knots.push(i9, i9);
4294
4349
  }
4295
4350
  knots.push(...Array(degree + 1).fill(nSegments));
4296
4351
  const kMax = knots[knots.length - 1];
4297
- for (let i7 = 0; i7 < knots.length; i7++) {
4298
- knots[i7] = knots[i7] / kMax;
4352
+ for (let i9 = 0; i9 < knots.length; i9++) {
4353
+ knots[i9] = knots[i9] / kMax;
4299
4354
  }
4300
4355
  const startPt = controlPoints.slice(0, 3);
4301
4356
  const endPt = controlPoints.slice(-3);
@@ -4319,9 +4374,9 @@ class BrepkitAdapter {
4319
4374
  * Returns {degree, knots, controlPoints, weights} for NURBS edges.
4320
4375
  */
4321
4376
  extractNurbsFromEdge(shape2) {
4322
- const h8 = shape2;
4323
- if (h8.type !== "edge") return null;
4324
- const nurbsJson = this.bk.getEdgeNurbsData(h8.id);
4377
+ const h10 = shape2;
4378
+ if (h10.type !== "edge") return null;
4379
+ const nurbsJson = this.bk.getEdgeNurbsData(h10.id);
4325
4380
  if (nurbsJson) {
4326
4381
  const data = JSON.parse(nurbsJson);
4327
4382
  return {
@@ -4331,7 +4386,7 @@ class BrepkitAdapter {
4331
4386
  weights: data.weights
4332
4387
  };
4333
4388
  }
4334
- const verts = this.bk.getEdgeVertices(h8.id);
4389
+ const verts = this.bk.getEdgeVertices(h10.id);
4335
4390
  return {
4336
4391
  degree: 1,
4337
4392
  knots: [0, 0, 1, 1],
@@ -4370,15 +4425,15 @@ class BrepkitAdapter {
4370
4425
  const dAngle = (endAngle - startAngle) / nSegments;
4371
4426
  const controlPoints = [];
4372
4427
  const weights = [];
4373
- for (let i7 = 0; i7 <= nSegments; i7++) {
4374
- const angle = startAngle + i7 * dAngle;
4428
+ for (let i9 = 0; i9 <= nSegments; i9++) {
4429
+ const angle = startAngle + i9 * dAngle;
4375
4430
  const cos = Math.cos(angle);
4376
4431
  const sin = Math.sin(angle);
4377
4432
  const px = center[0] + majorRadius * cos * xAxis[0] + minorRadius * sin * yAxis[0];
4378
4433
  const py = center[1] + majorRadius * cos * xAxis[1] + minorRadius * sin * yAxis[1];
4379
4434
  const pz = center[2] + majorRadius * cos * xAxis[2] + minorRadius * sin * yAxis[2];
4380
- if (i7 > 0) {
4381
- const midAngle = startAngle + (i7 - 0.5) * dAngle;
4435
+ if (i9 > 0) {
4436
+ const midAngle = startAngle + (i9 - 0.5) * dAngle;
4382
4437
  const midCos = Math.cos(midAngle);
4383
4438
  const midSin = Math.sin(midAngle);
4384
4439
  const scale2 = 1 / Math.cos(dAngle / 2);
@@ -4393,13 +4448,13 @@ class BrepkitAdapter {
4393
4448
  }
4394
4449
  const degree = 2;
4395
4450
  const knots = Array(degree + 1).fill(0);
4396
- for (let i7 = 1; i7 < nSegments; i7++) {
4397
- knots.push(i7, i7);
4451
+ for (let i9 = 1; i9 < nSegments; i9++) {
4452
+ knots.push(i9, i9);
4398
4453
  }
4399
4454
  knots.push(...Array(degree + 1).fill(nSegments));
4400
4455
  const kMax = knots[knots.length - 1];
4401
- for (let i7 = 0; i7 < knots.length; i7++) {
4402
- knots[i7] = knots[i7] / kMax;
4456
+ for (let i9 = 0; i9 < knots.length; i9++) {
4457
+ knots[i9] = knots[i9] / kMax;
4403
4458
  }
4404
4459
  const startPt = controlPoints.slice(0, 3);
4405
4460
  const endPt = controlPoints.slice(-3);
@@ -4423,16 +4478,16 @@ class BrepkitAdapter {
4423
4478
  */
4424
4479
  extractPlaneFromFace(faceShape) {
4425
4480
  let faceId;
4426
- const h8 = faceShape;
4427
- if (h8.type === "solid" || h8.type === "compound") {
4481
+ const h10 = faceShape;
4482
+ if (h10.type === "solid" || h10.type === "compound") {
4428
4483
  const faces = this.iterShapes(faceShape, "face");
4429
4484
  if (faces.length === 0) throw new Error("brepkit: extractPlaneFromFace: no faces found");
4430
4485
  const firstFace = faces[0];
4431
4486
  if (!firstFace) throw new Error("brepkit: extractPlaneFromFace: no faces found");
4432
4487
  let bestId = unwrap(firstFace, "face");
4433
4488
  let bestArea = 0;
4434
- for (const f12 of faces) {
4435
- const id = unwrap(f12, "face");
4489
+ for (const f11 of faces) {
4490
+ const id = unwrap(f11, "face");
4436
4491
  try {
4437
4492
  const a9 = this.bk.faceArea(id, DEFAULT_DEFLECTION);
4438
4493
  if (a9 > bestArea) {
@@ -4446,8 +4501,8 @@ class BrepkitAdapter {
4446
4501
  } else {
4447
4502
  faceId = unwrap(faceShape, "face");
4448
4503
  }
4449
- const n9 = this.bk.getFaceNormal(faceId);
4450
- const normal = [n9[0], n9[1], n9[2]];
4504
+ const n7 = this.bk.getFaceNormal(faceId);
4505
+ const normal = [n7[0], n7[1], n7[2]];
4451
4506
  const mesh2 = this.bk.tessellateFace(faceId, 1);
4452
4507
  const positions = mesh2.positions;
4453
4508
  if (positions.length >= 3) {
@@ -4546,7 +4601,7 @@ class BrepkitAdapter {
4546
4601
  }
4547
4602
  draft(shape2, faces, pullDirection, neutralPlane, angleDeg) {
4548
4603
  const solidId = unwrapSolidOrThrow(shape2, "draft");
4549
- const faceIds = faces.map((f12) => unwrap(f12, "face"));
4604
+ const faceIds = faces.map((f11) => unwrap(f11, "face"));
4550
4605
  return solidHandle(
4551
4606
  this.bk.draft(
4552
4607
  solidId,
@@ -4563,7 +4618,7 @@ class BrepkitAdapter {
4563
4618
  }
4564
4619
  defeature(shape2, faces) {
4565
4620
  const solidId = unwrapSolidOrThrow(shape2, "defeature");
4566
- const faceIds = faces.map((f12) => unwrap(f12, "face"));
4621
+ const faceIds = faces.map((f11) => unwrap(f11, "face"));
4567
4622
  return solidHandle(this.bk.defeature(solidId, faceIds));
4568
4623
  }
4569
4624
  // ═══════════════════════════════════════════════════════════════════════
@@ -4681,12 +4736,12 @@ class BrepkitAdapter {
4681
4736
  return this.bk.executeBatch(json);
4682
4737
  }
4683
4738
  }
4684
- function multiplyMatrices(a9, b10) {
4739
+ function multiplyMatrices(a9, b9) {
4685
4740
  const result = new Array(16).fill(0);
4686
- for (let i7 = 0; i7 < 4; i7++) {
4687
- for (let j6 = 0; j6 < 4; j6++) {
4741
+ for (let i9 = 0; i9 < 4; i9++) {
4742
+ for (let j7 = 0; j7 < 4; j7++) {
4688
4743
  for (let k7 = 0; k7 < 4; k7++) {
4689
- result[i7 * 4 + j6] = result[i7 * 4 + j6] + a9[i7 * 4 + k7] * b10[k7 * 4 + j6];
4744
+ result[i9 * 4 + j7] = result[i9 * 4 + j7] + a9[i9 * 4 + k7] * b9[k7 * 4 + j7];
4690
4745
  }
4691
4746
  }
4692
4747
  }
@@ -4815,11 +4870,11 @@ function withNearestPostFilter(baseFinder, nearestPoint) {
4815
4870
  if (candidates.length === 0) return [];
4816
4871
  let bestIdx = 0;
4817
4872
  let bestDist = vecDistance(vertexPosition(candidates[0]), nearestPoint);
4818
- for (let i7 = 1; i7 < candidates.length; i7++) {
4819
- const d10 = vecDistance(vertexPosition(candidates[i7]), nearestPoint);
4873
+ for (let i9 = 1; i9 < candidates.length; i9++) {
4874
+ const d10 = vecDistance(vertexPosition(candidates[i9]), nearestPoint);
4820
4875
  if (d10 < bestDist) {
4821
4876
  bestDist = d10;
4822
- bestIdx = i7;
4877
+ bestIdx = i9;
4823
4878
  }
4824
4879
  }
4825
4880
  return [candidates[bestIdx]];
@@ -4953,10 +5008,10 @@ function surfaceFromGrid(heights, options = {}) {
4953
5008
  function buildBSplineSurface(heights, rows, cols, dx, dy, scaleZ) {
4954
5009
  const points = [];
4955
5010
  for (let r9 = 0; r9 < rows; r9++) {
4956
- for (let c7 = 0; c7 < cols; c7++) {
5011
+ for (let c8 = 0; c8 < cols; c8++) {
4957
5012
  const row = heights[r9];
4958
- const z6 = (row ? row[c7] ?? 0 : 0) * scaleZ;
4959
- points.push([c7 * dx, r9 * dy, z6]);
5013
+ const z6 = (row ? row[c8] ?? 0 : 0) * scaleZ;
5014
+ points.push([c8 * dx, r9 * dy, z6]);
4960
5015
  }
4961
5016
  }
4962
5017
  const faceShape = getKernel().bsplineSurface(points, rows, cols);
@@ -4970,10 +5025,10 @@ function buildBSplineSurface(heights, rows, cols, dx, dy, scaleZ) {
4970
5025
  function buildTriangulatedSurface(heights, rows, cols, dx, dy, scaleZ) {
4971
5026
  const points = [];
4972
5027
  for (let r9 = 0; r9 < rows; r9++) {
4973
- for (let c7 = 0; c7 < cols; c7++) {
5028
+ for (let c8 = 0; c8 < cols; c8++) {
4974
5029
  const row = heights[r9];
4975
- const z6 = (row ? row[c7] ?? 0 : 0) * scaleZ;
4976
- points.push([c7 * dx, r9 * dy, z6]);
5030
+ const z6 = (row ? row[c8] ?? 0 : 0) * scaleZ;
5031
+ points.push([c8 * dx, r9 * dy, z6]);
4977
5032
  }
4978
5033
  }
4979
5034
  const resultShape = getKernel().triangulatedSurface(points, rows, cols);
@@ -5012,13 +5067,13 @@ async function surfaceFromImage(blob, options = {}) {
5012
5067
  );
5013
5068
  }
5014
5069
  const w7 = bitmap.width;
5015
- const h8 = bitmap.height;
5016
- if (w7 < 2 || h8 < 2) {
5070
+ const h10 = bitmap.height;
5071
+ if (w7 < 2 || h10 < 2) {
5017
5072
  bitmap.close();
5018
5073
  return err(
5019
5074
  validationError(
5020
5075
  BrepErrorCode.SURFACE_GRID_TOO_SMALL,
5021
- `surfaceFromImage: image too small (${w7}x${h8}), need at least 2x2`
5076
+ `surfaceFromImage: image too small (${w7}x${h10}), need at least 2x2`
5022
5077
  )
5023
5078
  );
5024
5079
  }
@@ -5031,7 +5086,7 @@ async function surfaceFromImage(blob, options = {}) {
5031
5086
  )
5032
5087
  );
5033
5088
  }
5034
- const canvas = new OffscreenCanvas(w7, h8);
5089
+ const canvas = new OffscreenCanvas(w7, h10);
5035
5090
  const ctx = canvas.getContext("2d");
5036
5091
  if (!ctx) {
5037
5092
  bitmap.close();
@@ -5041,29 +5096,29 @@ async function surfaceFromImage(blob, options = {}) {
5041
5096
  }
5042
5097
  ctx.drawImage(bitmap, 0, 0);
5043
5098
  bitmap.close();
5044
- const imageData = ctx.getImageData(0, 0, w7, h8);
5099
+ const imageData = ctx.getImageData(0, 0, w7, h10);
5045
5100
  const data = imageData.data;
5046
5101
  const rows = [];
5047
- for (let y6 = 0; y6 < h8; y6 += downsample) {
5102
+ for (let y6 = 0; y6 < h10; y6 += downsample) {
5048
5103
  const row = [];
5049
5104
  for (let x7 = 0; x7 < w7; x7 += downsample) {
5050
5105
  const idx = (y6 * w7 + x7) * 4;
5051
5106
  const r9 = data[idx] ?? 0;
5052
- const g12 = data[idx + 1] ?? 0;
5053
- const b10 = data[idx + 2] ?? 0;
5107
+ const g11 = data[idx + 1] ?? 0;
5108
+ const b9 = data[idx + 2] ?? 0;
5054
5109
  let value;
5055
5110
  switch (channel) {
5056
5111
  case "r":
5057
5112
  value = r9 / 255;
5058
5113
  break;
5059
5114
  case "g":
5060
- value = g12 / 255;
5115
+ value = g11 / 255;
5061
5116
  break;
5062
5117
  case "b":
5063
- value = b10 / 255;
5118
+ value = b9 / 255;
5064
5119
  break;
5065
5120
  default:
5066
- value = (REC601_R * r9 + REC601_G * g12 + REC601_B * b10) / 255;
5121
+ value = (REC601_R * r9 + REC601_G * g11 + REC601_B * b9) / 255;
5067
5122
  break;
5068
5123
  }
5069
5124
  row.push(value);
@@ -5094,8 +5149,8 @@ function hull(shapes, options = {}) {
5094
5149
  )
5095
5150
  );
5096
5151
  }
5097
- for (const [i7, shape2] of shapes.entries()) {
5098
- const check = validateNotNull$1(shape2, `hull: shapes[${i7}]`);
5152
+ for (const [i9, shape2] of shapes.entries()) {
5153
+ const check = validateNotNull$1(shape2, `hull: shapes[${i9}]`);
5099
5154
  if (isErr(check)) return check;
5100
5155
  }
5101
5156
  const tolerance = options.tolerance ?? 0.1;
@@ -5251,8 +5306,8 @@ function polyhedron(points, faces, options = {}) {
5251
5306
  }
5252
5307
  if (face.length < 3) continue;
5253
5308
  const v0 = face[0];
5254
- for (let i7 = 1; i7 < face.length - 1; i7++) {
5255
- triangles.push([v0, face[i7], face[i7 + 1]]);
5309
+ for (let i9 = 1; i9 < face.length - 1; i9++) {
5310
+ triangles.push([v0, face[i9], face[i9 + 1]]);
5256
5311
  }
5257
5312
  }
5258
5313
  try {
@@ -5283,20 +5338,20 @@ function multiSectionSweep(sections, spine, options) {
5283
5338
  }
5284
5339
  const { solid = true, ruled = false, tolerance = 1e-6 } = options ?? {};
5285
5340
  const explicitLocations = sections.map((s6) => s6.location);
5286
- for (let i7 = 0; i7 < explicitLocations.length; i7++) {
5287
- const loc = explicitLocations[i7];
5341
+ for (let i9 = 0; i9 < explicitLocations.length; i9++) {
5342
+ const loc = explicitLocations[i9];
5288
5343
  if (loc !== void 0 && (loc < 0 || loc > 1)) {
5289
5344
  return err(
5290
5345
  validationError(
5291
5346
  BrepErrorCode.MULTI_SWEEP_FAILED,
5292
- `Section ${i7} location ${loc} is out of range [0, 1]`
5347
+ `Section ${i9} location ${loc} is out of range [0, 1]`
5293
5348
  )
5294
5349
  );
5295
5350
  }
5296
5351
  }
5297
5352
  const definedLocs = explicitLocations.filter((l10) => l10 !== void 0);
5298
- for (let i7 = 1; i7 < definedLocs.length; i7++) {
5299
- if ((definedLocs[i7] ?? 0) <= (definedLocs[i7 - 1] ?? 0)) {
5353
+ for (let i9 = 1; i9 < definedLocs.length; i9++) {
5354
+ if ((definedLocs[i9] ?? 0) <= (definedLocs[i9 - 1] ?? 0)) {
5300
5355
  return err(
5301
5356
  validationError(
5302
5357
  BrepErrorCode.MULTI_SWEEP_FAILED,
@@ -5309,16 +5364,16 @@ function multiSectionSweep(sections, spine, options) {
5309
5364
  const kernel = getKernel();
5310
5365
  const [uFirst, uLast] = kernel.curveParameters(spine.wrapped);
5311
5366
  const uRange = uLast - uFirst;
5312
- const params = sections.map((s6, i7) => {
5367
+ const params = sections.map((s6, i9) => {
5313
5368
  if (s6.location !== void 0) {
5314
5369
  return uFirst + s6.location * uRange;
5315
5370
  }
5316
- return uFirst + i7 / (sections.length - 1) * uRange;
5371
+ return uFirst + i9 / (sections.length - 1) * uRange;
5317
5372
  });
5318
5373
  const positionedWires = [];
5319
- for (let i7 = 0; i7 < sections.length; i7++) {
5320
- const param = params[i7];
5321
- const section2 = sections[i7];
5374
+ for (let i9 = 0; i9 < sections.length; i9++) {
5375
+ const param = params[i9];
5376
+ const section2 = sections[i9];
5322
5377
  if (param === void 0 || section2 === void 0) continue;
5323
5378
  const positioned = kernel.positionOnCurve(section2.wire.wrapped, spine.wrapped, param);
5324
5379
  positionedWires.push(kernel.downcast(positioned, "wire"));
@@ -5371,25 +5426,25 @@ function dot2(ax, ay, bx, by) {
5371
5426
  function len2(x7, y6) {
5372
5427
  return Math.sqrt(x7 * x7 + y6 * y6);
5373
5428
  }
5374
- function polyAt(poly, i7) {
5375
- const p7 = poly[(i7 % poly.length + poly.length) % poly.length];
5376
- if (!p7) throw new Error(`Invalid polygon index ${i7} for length ${poly.length}`);
5429
+ function polyAt(poly, i9) {
5430
+ const p7 = poly[(i9 % poly.length + poly.length) % poly.length];
5431
+ if (!p7) throw new Error(`Invalid polygon index ${i9} for length ${poly.length}`);
5377
5432
  return p7;
5378
5433
  }
5379
5434
  function ensureCCW(poly) {
5380
5435
  let area = 0;
5381
- for (let i7 = 0; i7 < poly.length; i7++) {
5382
- const cur = polyAt(poly, i7);
5383
- const nxt = polyAt(poly, i7 + 1);
5436
+ for (let i9 = 0; i9 < poly.length; i9++) {
5437
+ const cur = polyAt(poly, i9);
5438
+ const nxt = polyAt(poly, i9 + 1);
5384
5439
  area += cur.x * nxt.y - nxt.x * cur.y;
5385
5440
  }
5386
5441
  if (area < 0) return [...poly].reverse();
5387
5442
  return poly;
5388
5443
  }
5389
- function bisector(poly, i7) {
5390
- const prev = polyAt(poly, i7 - 1);
5391
- const cur = polyAt(poly, i7);
5392
- const next = polyAt(poly, i7 + 1);
5444
+ function bisector(poly, i9) {
5445
+ const prev = polyAt(poly, i9 - 1);
5446
+ const cur = polyAt(poly, i9);
5447
+ const next = polyAt(poly, i9 + 1);
5393
5448
  const e1x = cur.x - prev.x;
5394
5449
  const e1y = cur.y - prev.y;
5395
5450
  const e1l = len2(e1x, e1y);
@@ -5419,23 +5474,23 @@ function isLavNodeReflex(node) {
5419
5474
  return cross2(node.x - prev.x, node.y - prev.y, next.x - node.x, next.y - node.y) < -EPS;
5420
5475
  }
5421
5476
  function createLav(poly) {
5422
- const nodes = poly.map((p7, i7) => {
5423
- const b10 = bisector(poly, i7);
5477
+ const nodes = poly.map((p7, i9) => {
5478
+ const b9 = bisector(poly, i9);
5424
5479
  return {
5425
5480
  x: p7.x,
5426
5481
  y: p7.y,
5427
- bx: b10.dx,
5428
- by: b10.dy,
5429
- origIdx: i7,
5482
+ bx: b9.dx,
5483
+ by: b9.dy,
5484
+ origIdx: i9,
5430
5485
  prev: null,
5431
5486
  next: null,
5432
5487
  active: true
5433
5488
  };
5434
5489
  });
5435
- for (let i7 = 0; i7 < nodes.length; i7++) {
5436
- const node = nodes[i7];
5437
- const prevNode = nodes[(i7 - 1 + nodes.length) % nodes.length];
5438
- const nextNode = nodes[(i7 + 1) % nodes.length];
5490
+ for (let i9 = 0; i9 < nodes.length; i9++) {
5491
+ const node = nodes[i9];
5492
+ const prevNode = nodes[(i9 - 1 + nodes.length) % nodes.length];
5493
+ const nextNode = nodes[(i9 + 1) % nodes.length];
5439
5494
  if (node && prevNode && nextNode) {
5440
5495
  node.prev = prevNode;
5441
5496
  node.next = nextNode;
@@ -5453,26 +5508,26 @@ function lavSize(start) {
5453
5508
  }
5454
5509
  return count;
5455
5510
  }
5456
- function bisectorIntersectTime(a9, b10) {
5457
- const ddx = a9.bx - b10.bx;
5458
- const ddy = a9.by - b10.by;
5459
- const dxp = b10.x - a9.x;
5460
- const dyp = b10.y - a9.y;
5511
+ function bisectorIntersectTime(a9, b9) {
5512
+ const ddx = a9.bx - b9.bx;
5513
+ const ddy = a9.by - b9.by;
5514
+ const dxp = b9.x - a9.x;
5515
+ const dyp = b9.y - a9.y;
5461
5516
  if (Math.abs(ddx) < EPS && Math.abs(ddy) < EPS) return null;
5462
- let t11;
5517
+ let t10;
5463
5518
  if (Math.abs(ddx) > Math.abs(ddy)) {
5464
- t11 = dxp / ddx;
5519
+ t10 = dxp / ddx;
5465
5520
  } else {
5466
- t11 = dyp / ddy;
5521
+ t10 = dyp / ddy;
5467
5522
  }
5468
- if (t11 < EPS) return null;
5523
+ if (t10 < EPS) return null;
5469
5524
  const otherDd = Math.abs(ddx) > Math.abs(ddy) ? ddy : ddx;
5470
5525
  const otherDp = Math.abs(ddx) > Math.abs(ddy) ? dyp : dxp;
5471
5526
  if (Math.abs(otherDd) > EPS) {
5472
5527
  const t22 = otherDp / otherDd;
5473
- if (Math.abs(t11 - t22) > 1e-4 * Math.max(1, Math.abs(t11))) return null;
5528
+ if (Math.abs(t10 - t22) > 1e-4 * Math.max(1, Math.abs(t10))) return null;
5474
5529
  }
5475
- return t11;
5530
+ return t10;
5476
5531
  }
5477
5532
  function raySplitTime(node, eA, eB) {
5478
5533
  const edx = eB.x - eA.x;
@@ -5486,31 +5541,31 @@ function raySplitTime(node, eA, eB) {
5486
5541
  const relBy = node.by - (eA.by + eB.by) / 2;
5487
5542
  const dRate = relBx * enx + relBy * eny;
5488
5543
  if (Math.abs(dRate) < EPS) return null;
5489
- const t11 = -d0 / dRate;
5490
- if (t11 < EPS) return null;
5491
- const px = node.x + t11 * node.bx;
5492
- const py = node.y + t11 * node.by;
5493
- const ax = eA.x + t11 * eA.bx;
5494
- const ay = eA.y + t11 * eA.by;
5495
- const bxx = eB.x + t11 * eB.bx;
5496
- const byy = eB.y + t11 * eB.by;
5544
+ const t10 = -d0 / dRate;
5545
+ if (t10 < EPS) return null;
5546
+ const px = node.x + t10 * node.bx;
5547
+ const py = node.y + t10 * node.by;
5548
+ const ax = eA.x + t10 * eA.bx;
5549
+ const ay = eA.y + t10 * eA.by;
5550
+ const bxx = eB.x + t10 * eB.bx;
5551
+ const byy = eB.y + t10 * eB.by;
5497
5552
  const segDx = bxx - ax;
5498
5553
  const segDy = byy - ay;
5499
5554
  const segL = len2(segDx, segDy);
5500
- if (segL < EPS) return t11;
5555
+ if (segL < EPS) return t10;
5501
5556
  const s6 = dot2(px - ax, py - ay, segDx, segDy) / (segL * segL);
5502
5557
  if (s6 < -0.01 || s6 > 1.01) return null;
5503
- return t11;
5558
+ return t10;
5504
5559
  }
5505
5560
  function computeEvents(lavNodes) {
5506
5561
  const events = [];
5507
5562
  for (const node of lavNodes) {
5508
5563
  if (!node.active) continue;
5509
- const t11 = bisectorIntersectTime(node, node.next);
5510
- if (t11 !== null && t11 > EPS) {
5511
- const x7 = node.x + t11 * node.bx;
5512
- const y6 = node.y + t11 * node.by;
5513
- events.push({ time: t11, x: x7, y: y6, nodeA: node, nodeB: node.next, type: "edge" });
5564
+ const t10 = bisectorIntersectTime(node, node.next);
5565
+ if (t10 !== null && t10 > EPS) {
5566
+ const x7 = node.x + t10 * node.bx;
5567
+ const y6 = node.y + t10 * node.by;
5568
+ events.push({ time: t10, x: x7, y: y6, nodeA: node, nodeB: node.next, type: "edge" });
5514
5569
  }
5515
5570
  if (isLavNodeReflex(node)) {
5516
5571
  let cur = node.next.next;
@@ -5527,7 +5582,7 @@ function computeEvents(lavNodes) {
5527
5582
  }
5528
5583
  }
5529
5584
  }
5530
- events.sort((a9, b10) => a9.time - b10.time);
5585
+ events.sort((a9, b9) => a9.time - b9.time);
5531
5586
  return events;
5532
5587
  }
5533
5588
  function computeStraightSkeleton(polygon) {
@@ -5535,12 +5590,12 @@ function computeStraightSkeleton(polygon) {
5535
5590
  return { nodes: [], faces: [] };
5536
5591
  }
5537
5592
  const poly = ensureCCW(polygon);
5538
- const n9 = poly.length;
5593
+ const n7 = poly.length;
5539
5594
  const skeletonNodes = [];
5540
- const vertexToSkelNodes = Array.from({ length: n9 }, () => []);
5595
+ const vertexToSkelNodes = Array.from({ length: n7 }, () => []);
5541
5596
  const lavNodes = createLav(poly);
5542
5597
  let iterations = 0;
5543
- const maxIter = n9 * n9 * 2;
5598
+ const maxIter = n7 * n7 * 2;
5544
5599
  while (iterations < maxIter) {
5545
5600
  iterations++;
5546
5601
  const activeStart = lavNodes.find((nd) => nd.active);
@@ -5549,26 +5604,26 @@ function computeStraightSkeleton(polygon) {
5549
5604
  if (sz <= 3) {
5550
5605
  if (sz === 3) {
5551
5606
  const a9 = activeStart;
5552
- const b10 = a9.next;
5553
- const c7 = b10.next;
5554
- const t11 = bisectorIntersectTime(a9, b10);
5555
- const time = t11 !== null && t11 > EPS ? t11 : 0;
5556
- const mx = (a9.x + b10.x + c7.x) / 3 + time * (a9.bx + b10.bx + c7.bx) / 3;
5557
- const my = (a9.y + b10.y + c7.y) / 3 + time * (a9.by + b10.by + c7.by) / 3;
5607
+ const b9 = a9.next;
5608
+ const c8 = b9.next;
5609
+ const t10 = bisectorIntersectTime(a9, b9);
5610
+ const time = t10 !== null && t10 > EPS ? t10 : 0;
5611
+ const mx = (a9.x + b9.x + c8.x) / 3 + time * (a9.bx + b9.bx + c8.bx) / 3;
5612
+ const my = (a9.y + b9.y + c8.y) / 3 + time * (a9.by + b9.by + c8.by) / 3;
5558
5613
  const nodeIdx = skeletonNodes.length;
5559
5614
  skeletonNodes.push({ x: mx, y: my, height: time });
5560
5615
  const aNodes = vertexToSkelNodes[a9.origIdx];
5561
- const bNodes = vertexToSkelNodes[b10.origIdx];
5562
- const cNodes = vertexToSkelNodes[c7.origIdx];
5616
+ const bNodes = vertexToSkelNodes[b9.origIdx];
5617
+ const cNodes = vertexToSkelNodes[c8.origIdx];
5563
5618
  if (aNodes) aNodes.push(nodeIdx);
5564
5619
  if (bNodes) bNodes.push(nodeIdx);
5565
5620
  if (cNodes) cNodes.push(nodeIdx);
5566
5621
  a9.active = false;
5567
- b10.active = false;
5568
- c7.active = false;
5622
+ b9.active = false;
5623
+ c8.active = false;
5569
5624
  } else {
5570
5625
  let cur = activeStart;
5571
- for (let i7 = 0; i7 < sz; i7++) {
5626
+ for (let i9 = 0; i9 < sz; i9++) {
5572
5627
  cur.active = false;
5573
5628
  cur = cur.next;
5574
5629
  }
@@ -5587,19 +5642,19 @@ function computeStraightSkeleton(polygon) {
5587
5642
  if (!ev) break;
5588
5643
  if (ev.type === "edge") {
5589
5644
  const a9 = ev.nodeA;
5590
- const b10 = ev.nodeB;
5591
- if (!a9.active || !b10.active) continue;
5645
+ const b9 = ev.nodeB;
5646
+ if (!a9.active || !b9.active) continue;
5592
5647
  const nodeIdx = skeletonNodes.length;
5593
5648
  skeletonNodes.push({ x: ev.x, y: ev.y, height: ev.time });
5594
5649
  const aNodes = vertexToSkelNodes[a9.origIdx];
5595
- const bNodes = vertexToSkelNodes[b10.origIdx];
5650
+ const bNodes = vertexToSkelNodes[b9.origIdx];
5596
5651
  if (aNodes) aNodes.push(nodeIdx);
5597
5652
  if (bNodes) bNodes.push(nodeIdx);
5598
5653
  a9.x = ev.x;
5599
5654
  a9.y = ev.y;
5600
- a9.next = b10.next;
5601
- b10.next.prev = a9;
5602
- b10.active = false;
5655
+ a9.next = b9.next;
5656
+ b9.next.prev = a9;
5657
+ b9.active = false;
5603
5658
  const lavPoly = [];
5604
5659
  let cur = a9;
5605
5660
  do {
@@ -5611,13 +5666,13 @@ function computeStraightSkeleton(polygon) {
5611
5666
  a9.by = bDir.dy;
5612
5667
  } else {
5613
5668
  const a9 = ev.nodeA;
5614
- const b10 = ev.nodeB;
5615
- if (!a9.active || !b10.active) continue;
5669
+ const b9 = ev.nodeB;
5670
+ if (!a9.active || !b9.active) continue;
5616
5671
  const nodeIdx = skeletonNodes.length;
5617
5672
  skeletonNodes.push({ x: ev.x, y: ev.y, height: ev.time });
5618
5673
  const aNodes = vertexToSkelNodes[a9.origIdx];
5619
5674
  if (aNodes) aNodes.push(nodeIdx);
5620
- const bNodes = vertexToSkelNodes[b10.origIdx];
5675
+ const bNodes = vertexToSkelNodes[b9.origIdx];
5621
5676
  if (bNodes) bNodes.push(nodeIdx);
5622
5677
  const aCopy = {
5623
5678
  x: ev.x,
@@ -5633,20 +5688,20 @@ function computeStraightSkeleton(polygon) {
5633
5688
  a9.x = ev.x;
5634
5689
  a9.y = ev.y;
5635
5690
  const aNext = a9.next;
5636
- const bNext = b10.next;
5691
+ const bNext = b9.next;
5637
5692
  a9.next = bNext;
5638
5693
  bNext.prev = a9;
5639
5694
  aCopy.next = aNext;
5640
5695
  aNext.prev = aCopy;
5641
- aCopy.prev = b10;
5642
- b10.next = aCopy;
5696
+ aCopy.prev = b9;
5697
+ b9.next = aCopy;
5643
5698
  const buildLavPoly = (start) => {
5644
5699
  const poly2 = [];
5645
- let c7 = start;
5700
+ let c8 = start;
5646
5701
  do {
5647
- poly2.push({ x: c7.x, y: c7.y });
5648
- c7 = c7.next;
5649
- } while (c7 !== start);
5702
+ poly2.push({ x: c8.x, y: c8.y });
5703
+ c8 = c8.next;
5704
+ } while (c8 !== start);
5650
5705
  return poly2;
5651
5706
  };
5652
5707
  const lav1Poly = buildLavPoly(a9);
@@ -5660,14 +5715,14 @@ function computeStraightSkeleton(polygon) {
5660
5715
  }
5661
5716
  }
5662
5717
  const faces = [];
5663
- for (let i7 = 0; i7 < n9; i7++) {
5664
- const j6 = (i7 + 1) % n9;
5665
- const pi = polyAt(poly, i7);
5666
- const pj = polyAt(poly, j6);
5718
+ for (let i9 = 0; i9 < n7; i9++) {
5719
+ const j7 = (i9 + 1) % n7;
5720
+ const pi = polyAt(poly, i9);
5721
+ const pj = polyAt(poly, j7);
5667
5722
  const faceVerts = [pi, pj];
5668
5723
  const faceHeights = [0, 0];
5669
- const jNodes = vertexToSkelNodes[j6];
5670
- const iNodes = vertexToSkelNodes[i7];
5724
+ const jNodes = vertexToSkelNodes[j7];
5725
+ const iNodes = vertexToSkelNodes[i9];
5671
5726
  if (jNodes) {
5672
5727
  for (const ni of jNodes) {
5673
5728
  const sn = skeletonNodes[ni];
@@ -5722,8 +5777,8 @@ function extractPolygon(w7) {
5722
5777
  }
5723
5778
  function fanTriangulate(count) {
5724
5779
  const tris = [];
5725
- for (let i7 = 1; i7 < count - 1; i7++) {
5726
- tris.push([0, i7, i7 + 1]);
5780
+ for (let i9 = 1; i9 < count - 1; i9++) {
5781
+ tris.push([0, i9, i9 + 1]);
5727
5782
  }
5728
5783
  return tris;
5729
5784
  }
@@ -5739,42 +5794,42 @@ function pointInTriangle(px, py, ax, ay, bx, by, cx, cy) {
5739
5794
  return !(hasNeg && hasPos);
5740
5795
  }
5741
5796
  function earClipTriangulate(poly) {
5742
- const n9 = poly.length;
5743
- if (n9 < 3) return [];
5744
- if (n9 === 3) return [[0, 1, 2]];
5797
+ const n7 = poly.length;
5798
+ if (n7 < 3) return [];
5799
+ if (n7 === 3) return [[0, 1, 2]];
5745
5800
  let area2 = 0;
5746
- for (let i7 = 0; i7 < n9; i7++) {
5747
- const a9 = poly[i7];
5748
- const b10 = poly[(i7 + 1) % n9];
5749
- if (a9 && b10) area2 += a9.x * b10.y - b10.x * a9.y;
5801
+ for (let i9 = 0; i9 < n7; i9++) {
5802
+ const a9 = poly[i9];
5803
+ const b9 = poly[(i9 + 1) % n7];
5804
+ if (a9 && b9) area2 += a9.x * b9.y - b9.x * a9.y;
5750
5805
  }
5751
5806
  const tris = [];
5752
- const idx = Array.from({ length: n9 }, (_2, i7) => i7);
5807
+ const idx = Array.from({ length: n7 }, (_2, i9) => i9);
5753
5808
  if (area2 < 0) idx.reverse();
5754
5809
  const isEar = (prev, curr, next) => {
5755
5810
  const a9 = poly[prev];
5756
- const b10 = poly[curr];
5757
- const c7 = poly[next];
5758
- if (!a9 || !b10 || !c7) return false;
5759
- if (cross2d(a9.x, a9.y, b10.x, b10.y, c7.x, c7.y) <= 0) return false;
5811
+ const b9 = poly[curr];
5812
+ const c8 = poly[next];
5813
+ if (!a9 || !b9 || !c8) return false;
5814
+ if (cross2d(a9.x, a9.y, b9.x, b9.y, c8.x, c8.y) <= 0) return false;
5760
5815
  for (const vi of idx) {
5761
5816
  if (vi === prev || vi === curr || vi === next) continue;
5762
5817
  const p7 = poly[vi];
5763
5818
  if (!p7) continue;
5764
- if (pointInTriangle(p7.x, p7.y, a9.x, a9.y, b10.x, b10.y, c7.x, c7.y)) return false;
5819
+ if (pointInTriangle(p7.x, p7.y, a9.x, a9.y, b9.x, b9.y, c8.x, c8.y)) return false;
5765
5820
  }
5766
5821
  return true;
5767
5822
  };
5768
5823
  while (idx.length > 3) {
5769
5824
  let clipped = false;
5770
- for (let i7 = 0; i7 < idx.length; i7++) {
5771
- const prev = idx[(i7 - 1 + idx.length) % idx.length];
5772
- const curr = idx[i7];
5773
- const next = idx[(i7 + 1) % idx.length];
5825
+ for (let i9 = 0; i9 < idx.length; i9++) {
5826
+ const prev = idx[(i9 - 1 + idx.length) % idx.length];
5827
+ const curr = idx[i9];
5828
+ const next = idx[(i9 + 1) % idx.length];
5774
5829
  if (prev === void 0 || curr === void 0 || next === void 0) continue;
5775
5830
  if (isEar(prev, curr, next)) {
5776
5831
  tris.push([prev, curr, next]);
5777
- idx.splice(i7, 1);
5832
+ idx.splice(i9, 1);
5778
5833
  clipped = true;
5779
5834
  break;
5780
5835
  }
@@ -5782,8 +5837,8 @@ function earClipTriangulate(poly) {
5782
5837
  if (!clipped) break;
5783
5838
  }
5784
5839
  if (idx.length === 3) {
5785
- const [a9, b10, c7] = idx;
5786
- if (a9 !== void 0 && b10 !== void 0 && c7 !== void 0) tris.push([a9, b10, c7]);
5840
+ const [a9, b9, c8] = idx;
5841
+ if (a9 !== void 0 && b9 !== void 0 && c8 !== void 0) tris.push([a9, b9, c8]);
5787
5842
  }
5788
5843
  return tris;
5789
5844
  }
@@ -5810,10 +5865,10 @@ function roof(w7, options) {
5810
5865
  const triFaces = [];
5811
5866
  for (const skFace of skeleton.faces) {
5812
5867
  const verts3d = skFace.vertices.map(
5813
- (v9, i7) => [
5868
+ (v9, i9) => [
5814
5869
  v9.x,
5815
5870
  v9.y,
5816
- (skFace.heights[i7] ?? 0) * tanAngle
5871
+ (skFace.heights[i9] ?? 0) * tanAngle
5817
5872
  ]
5818
5873
  );
5819
5874
  const tris = fanTriangulate(verts3d.length);
@@ -5888,36 +5943,36 @@ function solveConstraints(nodes, constraints) {
5888
5943
  });
5889
5944
  }
5890
5945
  const unsupported = [];
5891
- for (const c7 of constraints) {
5892
- if (c7.type === "coincident" && c7.entityA && c7.entityB) {
5893
- const a9 = c7.entityA;
5894
- const b10 = c7.entityB;
5895
- if (a9.entity.type === "plane" && b10.entity.type === "plane") {
5946
+ for (const c8 of constraints) {
5947
+ if (c8.type === "coincident" && c8.entityA && c8.entityB) {
5948
+ const a9 = c8.entityA;
5949
+ const b9 = c8.entityB;
5950
+ if (a9.entity.type === "plane" && b9.entity.type === "plane") {
5896
5951
  const aNormal = a9.entity.normal ?? [0, 0, 1];
5897
5952
  const aOrigin = a9.entity.origin;
5898
- const bOrigin = b10.entity.origin;
5953
+ const bOrigin = b9.entity.origin;
5899
5954
  const dot = aNormal[0] * (aOrigin[0] - bOrigin[0]) + aNormal[1] * (aOrigin[1] - bOrigin[1]) + aNormal[2] * (aOrigin[2] - bOrigin[2]);
5900
5955
  const pos = [dot * aNormal[0], dot * aNormal[1], dot * aNormal[2]];
5901
- transforms.set(b10.node, { position: pos, rotation: [1, 0, 0, 0] });
5956
+ transforms.set(b9.node, { position: pos, rotation: [1, 0, 0, 0] });
5902
5957
  } else {
5903
- unsupported.push(`coincident(${a9.entity.type}-${b10.entity.type})`);
5958
+ unsupported.push(`coincident(${a9.entity.type}-${b9.entity.type})`);
5904
5959
  }
5905
- } else if (c7.type === "distance" && c7.entityA && c7.entityB && c7.value !== void 0) {
5906
- const a9 = c7.entityA;
5907
- const b10 = c7.entityB;
5908
- if (a9.entity.type === "plane" && b10.entity.type === "plane") {
5960
+ } else if (c8.type === "distance" && c8.entityA && c8.entityB && c8.value !== void 0) {
5961
+ const a9 = c8.entityA;
5962
+ const b9 = c8.entityB;
5963
+ if (a9.entity.type === "plane" && b9.entity.type === "plane") {
5909
5964
  const aNormal = a9.entity.normal ?? [0, 0, 1];
5910
5965
  const aOrigin = a9.entity.origin;
5911
- const bOrigin = b10.entity.origin;
5966
+ const bOrigin = b9.entity.origin;
5912
5967
  const currentDist = aNormal[0] * (aOrigin[0] - bOrigin[0]) + aNormal[1] * (aOrigin[1] - bOrigin[1]) + aNormal[2] * (aOrigin[2] - bOrigin[2]);
5913
- const offset2 = currentDist + c7.value;
5968
+ const offset2 = currentDist + c8.value;
5914
5969
  const pos = [offset2 * aNormal[0], offset2 * aNormal[1], offset2 * aNormal[2]];
5915
- transforms.set(b10.node, { position: pos, rotation: [1, 0, 0, 0] });
5970
+ transforms.set(b9.node, { position: pos, rotation: [1, 0, 0, 0] });
5916
5971
  } else {
5917
- unsupported.push(`distance(${a9.entity.type}-${b10.entity.type})`);
5972
+ unsupported.push(`distance(${a9.entity.type}-${b9.entity.type})`);
5918
5973
  }
5919
- } else if (c7.type === "concentric" || c7.type === "angle") {
5920
- unsupported.push(c7.type);
5974
+ } else if (c8.type === "concentric" || c8.type === "angle") {
5975
+ unsupported.push(c8.type);
5921
5976
  }
5922
5977
  }
5923
5978
  const dof = unsupported.reduce((sum, type) => {
@@ -5937,9 +5992,9 @@ function extractEntity(mate) {
5937
5992
  }
5938
5993
  return null;
5939
5994
  }
5940
- function extractPair(a9, b10) {
5995
+ function extractPair(a9, b9) {
5941
5996
  const entA = extractEntity(a9);
5942
- const entB = extractEntity(b10);
5997
+ const entB = extractEntity(b9);
5943
5998
  if (!entA || !entB) {
5944
5999
  return err(
5945
6000
  validationError(
@@ -5950,7 +6005,7 @@ function extractPair(a9, b10) {
5950
6005
  }
5951
6006
  return ok({
5952
6007
  entityA: { node: a9.node, entity: entA },
5953
- entityB: { node: b10.node, entity: entB }
6008
+ entityB: { node: b9.node, entity: entB }
5954
6009
  });
5955
6010
  }
5956
6011
  function addMate(assembly, constraint) {
@@ -6041,28 +6096,28 @@ function checkInterference(shape1, shape2, tolerance = 1e-6) {
6041
6096
  function checkAllInterferences(shapes, tolerance = 1e-6) {
6042
6097
  const pairs = [];
6043
6098
  const boxes = shapes.map((s6) => getBounds(s6));
6044
- shapes.forEach((si, i7) => {
6045
- for (let j6 = i7 + 1; j6 < shapes.length; j6++) {
6046
- if (aabbDisjoint(boxes[i7], boxes[j6], tolerance)) continue;
6047
- const result = unwrap$1(checkInterference(si, shapes[j6], tolerance));
6099
+ shapes.forEach((si, i9) => {
6100
+ for (let j7 = i9 + 1; j7 < shapes.length; j7++) {
6101
+ if (aabbDisjoint(boxes[i9], boxes[j7], tolerance)) continue;
6102
+ const result = unwrap$1(checkInterference(si, shapes[j7], tolerance));
6048
6103
  if (result.hasInterference) {
6049
- pairs.push({ i: i7, j: j6, result });
6104
+ pairs.push({ i: i9, j: j7, result });
6050
6105
  }
6051
6106
  }
6052
6107
  });
6053
6108
  return pairs;
6054
6109
  }
6055
- function aabbDisjoint(a9, b10, tolerance) {
6056
- return a9.xMax + tolerance < b10.xMin || b10.xMax + tolerance < a9.xMin || a9.yMax + tolerance < b10.yMin || b10.yMax + tolerance < a9.yMin || a9.zMax + tolerance < b10.zMin || b10.zMax + tolerance < a9.zMin;
6110
+ function aabbDisjoint(a9, b9, tolerance) {
6111
+ return a9.xMax + tolerance < b9.xMin || b9.xMax + tolerance < a9.xMin || a9.yMax + tolerance < b9.yMin || b9.yMax + tolerance < a9.yMin || a9.zMax + tolerance < b9.zMin || b9.zMax + tolerance < a9.zMin;
6057
6112
  }
6058
6113
  function parseEntities(text) {
6059
6114
  const lines = text.split(/\r?\n/);
6060
6115
  const entities = [];
6061
6116
  let inEntities = false;
6062
6117
  let current;
6063
- for (let i7 = 0; i7 < lines.length - 1; i7 += 2) {
6064
- const codeLine = lines[i7];
6065
- const valueLine = lines[i7 + 1];
6118
+ for (let i9 = 0; i9 < lines.length - 1; i9 += 2) {
6119
+ const codeLine = lines[i9];
6120
+ const valueLine = lines[i9 + 1];
6066
6121
  if (codeLine === void 0 || valueLine === void 0) continue;
6067
6122
  const code = parseInt(codeLine.trim(), 10);
6068
6123
  const value = valueLine.trim();
@@ -6094,8 +6149,8 @@ function parseEntities(text) {
6094
6149
  function getNum(data, code, fallback = 0) {
6095
6150
  const v9 = data.get(code);
6096
6151
  if (v9 === void 0) return fallback;
6097
- const n9 = parseFloat(v9);
6098
- return isNaN(n9) ? fallback : n9;
6152
+ const n7 = parseFloat(v9);
6153
+ return isNaN(n7) ? fallback : n7;
6099
6154
  }
6100
6155
  function entityToEdge(entity) {
6101
6156
  const { type, data } = entity;
@@ -6199,10 +6254,10 @@ function buildSolidFromMesh$1(vertices, faces) {
6199
6254
  const kernel = getKernel();
6200
6255
  const triFaces = [];
6201
6256
  for (const face of faces) {
6202
- for (let i7 = 1; i7 < face.length - 1; i7++) {
6257
+ for (let i9 = 1; i9 < face.length - 1; i9++) {
6203
6258
  const rawA = face[0] ?? 0;
6204
- const rawB = face[i7] ?? 0;
6205
- const rawC = face[i7 + 1] ?? 0;
6259
+ const rawB = face[i9] ?? 0;
6260
+ const rawC = face[i9 + 1] ?? 0;
6206
6261
  const ai = rawA > 0 ? rawA - 1 : vertices.length + rawA;
6207
6262
  const bi = rawB > 0 ? rawB - 1 : vertices.length + rawB;
6208
6263
  const ci = rawC > 0 ? rawC - 1 : vertices.length + rawC;
@@ -6233,9 +6288,9 @@ function buildSolidFromMesh$1(vertices, faces) {
6233
6288
  }
6234
6289
  function extractFromZip(data, target) {
6235
6290
  let eocdOffset = -1;
6236
- for (let i7 = data.length - 22; i7 >= 0; i7--) {
6237
- if (data[i7] === 80 && data[i7 + 1] === 75 && data[i7 + 2] === 5 && data[i7 + 3] === 6) {
6238
- eocdOffset = i7;
6291
+ for (let i9 = data.length - 22; i9 >= 0; i9--) {
6292
+ if (data[i9] === 80 && data[i9 + 1] === 75 && data[i9 + 2] === 5 && data[i9 + 3] === 6) {
6293
+ eocdOffset = i9;
6239
6294
  break;
6240
6295
  }
6241
6296
  }
@@ -6640,7 +6695,7 @@ function shell$1(shape2, faces, thickness, tolerance = 1e-3) {
6640
6695
  const inputFaceHashes = collectInputFaceHashes([shape2]);
6641
6696
  const { shape: resultShape, evolution } = getKernel().shellWithHistory(
6642
6697
  shape2.wrapped,
6643
- faces.map((f12) => f12.wrapped),
6698
+ faces.map((f11) => f11.wrapped),
6644
6699
  thickness,
6645
6700
  inputFaceHashes,
6646
6701
  HASH_CODE_MAX,
@@ -6716,14 +6771,14 @@ function applyMatrix(shape2, matrix) {
6716
6771
  function transformCopy(shape2, composed) {
6717
6772
  return transformCopy$1(resolve(shape2), composed);
6718
6773
  }
6719
- function fuse(a9, b10, options) {
6720
- return fuse$1(resolve(a9), resolve(b10), options);
6774
+ function fuse(a9, b9, options) {
6775
+ return fuse$1(resolve(a9), resolve(b9), options);
6721
6776
  }
6722
6777
  function cut(base, tool, options) {
6723
6778
  return cut$1(resolve(base), resolve(tool), options);
6724
6779
  }
6725
- function intersect(a9, b10, options) {
6726
- return intersect$1(resolve(a9), resolve(b10), options);
6780
+ function intersect(a9, b9, options) {
6781
+ return intersect$1(resolve(a9), resolve(b9), options);
6727
6782
  }
6728
6783
  function section(shape2, plane, options) {
6729
6784
  return section$1(resolve(shape2), plane, options);
@@ -6873,9 +6928,9 @@ function loft$1(wires, { ruled = true, startPoint, endPoint, tolerance = 1e-6 }
6873
6928
  }
6874
6929
  }
6875
6930
  function extrude(face, height) {
6876
- const f12 = resolve(face);
6931
+ const f11 = resolve(face);
6877
6932
  const vec = typeof height === "number" ? [0, 0, height] : height;
6878
- return extrude$1(f12, vec);
6933
+ return extrude$1(f11, vec);
6879
6934
  }
6880
6935
  function revolve(face, options) {
6881
6936
  const pivotPoint = options?.at ?? [0, 0, 0];
@@ -6900,11 +6955,11 @@ function resolveTargetFace(shape2, faceSpec) {
6900
6955
  }
6901
6956
  let best = faces[0];
6902
6957
  let bestZ = faceCenter(best)[2];
6903
- for (let i7 = 1; i7 < faces.length; i7++) {
6904
- const f12 = faces[i7];
6905
- const z6 = faceCenter(f12)[2];
6958
+ for (let i9 = 1; i9 < faces.length; i9++) {
6959
+ const f11 = faces[i9];
6960
+ const z6 = faceCenter(f11)[2];
6906
6961
  if (z6 > bestZ) {
6907
- best = f12;
6962
+ best = f11;
6908
6963
  bestZ = z6;
6909
6964
  }
6910
6965
  }
@@ -6947,23 +7002,23 @@ function drill(shape2, options) {
6947
7002
  if (options.depth !== void 0) {
6948
7003
  tool = makeCylinder(radius, options.depth, pos, dir);
6949
7004
  } else {
6950
- const b10 = getBounds(s6);
7005
+ const b9 = getBounds(s6);
6951
7006
  const corners = [
6952
- [b10.xMin, b10.yMin, b10.zMin],
6953
- [b10.xMax, b10.yMin, b10.zMin],
6954
- [b10.xMin, b10.yMax, b10.zMin],
6955
- [b10.xMax, b10.yMax, b10.zMin],
6956
- [b10.xMin, b10.yMin, b10.zMax],
6957
- [b10.xMax, b10.yMin, b10.zMax],
6958
- [b10.xMin, b10.yMax, b10.zMax],
6959
- [b10.xMax, b10.yMax, b10.zMax]
7007
+ [b9.xMin, b9.yMin, b9.zMin],
7008
+ [b9.xMax, b9.yMin, b9.zMin],
7009
+ [b9.xMin, b9.yMax, b9.zMin],
7010
+ [b9.xMax, b9.yMax, b9.zMin],
7011
+ [b9.xMin, b9.yMin, b9.zMax],
7012
+ [b9.xMax, b9.yMin, b9.zMax],
7013
+ [b9.xMin, b9.yMax, b9.zMax],
7014
+ [b9.xMax, b9.yMax, b9.zMax]
6960
7015
  ];
6961
7016
  let tMin = Infinity;
6962
7017
  let tMax = -Infinity;
6963
- for (const c7 of corners) {
6964
- const t11 = (c7[0] - pos[0]) * dir[0] + (c7[1] - pos[1]) * dir[1] + (c7[2] - pos[2]) * dir[2];
6965
- if (t11 < tMin) tMin = t11;
6966
- if (t11 > tMax) tMax = t11;
7018
+ for (const c8 of corners) {
7019
+ const t10 = (c8[0] - pos[0]) * dir[0] + (c8[1] - pos[1]) * dir[1] + (c8[2] - pos[2]) * dir[2];
7020
+ if (t10 < tMin) tMin = t10;
7021
+ if (t10 > tMax) tMax = t10;
6967
7022
  }
6968
7023
  const overshoot = 1;
6969
7024
  tMin -= overshoot;
@@ -7166,8 +7221,8 @@ function createWrappedCurve(val) {
7166
7221
  length: () => curveLength(val),
7167
7222
  startPoint: () => curveStartPoint(val),
7168
7223
  endPoint: () => curveEndPoint(val),
7169
- pointAt: (t11) => curvePointAt(val, t11),
7170
- tangentAt: (t11) => curveTangentAt(val, t11),
7224
+ pointAt: (t10) => curvePointAt(val, t10),
7225
+ tangentAt: (t10) => curveTangentAt(val, t10),
7171
7226
  isClosed: () => curveIsClosed(val),
7172
7227
  sweep(spine, opts) {
7173
7228
  if (!isWire(val)) throw new Error("sweep requires a Wire");
@@ -7218,8 +7273,8 @@ export {
7218
7273
  B3 as BaseSketcher2d,
7219
7274
  B as Blueprint,
7220
7275
  a5 as BlueprintSketcher,
7221
- e3 as Blueprints,
7222
- d3 as BoundingBox2d,
7276
+ c2 as Blueprints,
7277
+ e3 as BoundingBox2d,
7223
7278
  BrepBugError,
7224
7279
  BrepErrorCode,
7225
7280
  BrepWrapperError,
@@ -7247,7 +7302,7 @@ export {
7247
7302
  a2 as andThen,
7248
7303
  applyGlue,
7249
7304
  applyMatrix,
7250
- j5 as approximateCurve,
7305
+ h7 as approximateCurve,
7251
7306
  M as as2D,
7252
7307
  N as as3D,
7253
7308
  l9 as asTopo,
@@ -7257,38 +7312,38 @@ export {
7257
7312
  blueprintToDXF,
7258
7313
  boss,
7259
7314
  f7 as box,
7260
- g9 as bsplineApprox,
7315
+ g8 as bsplineApprox,
7261
7316
  bug,
7262
7317
  X as cameraFromPlane,
7263
7318
  Y as cameraLookAt,
7264
- c4 as cast,
7319
+ c5 as cast,
7265
7320
  castShape,
7266
7321
  O as castShape3D,
7267
7322
  chamfer,
7268
7323
  chamferDistAngle as chamferDistAngleShape,
7269
7324
  checkAllInterferences,
7270
7325
  checkInterference,
7271
- j4 as circle,
7326
+ j5 as circle,
7272
7327
  circularPattern,
7273
7328
  m9 as classifyPointOnFace,
7274
- c5 as clearMeshCache,
7329
+ c6 as clearMeshCache,
7275
7330
  clone,
7276
7331
  a as closedWire,
7277
7332
  c as collect,
7278
- d4 as collectShapes,
7333
+ d3 as collectShapes,
7279
7334
  l6 as colorFaces,
7280
7335
  m6 as colorShape,
7281
7336
  f3 as complexExtrude,
7282
7337
  w4 as composeTransforms,
7283
7338
  k5 as compound,
7284
- c2 as compoundSketchExtrude,
7339
+ c3 as compoundSketchExtrude,
7285
7340
  d5 as compoundSketchFace,
7286
7341
  e4 as compoundSketchLoft,
7287
7342
  f5 as compoundSketchRevolve,
7288
7343
  b2 as computationError,
7289
7344
  computeStraightSkeleton,
7290
7345
  l7 as cone,
7291
- c6 as cornerFinder,
7346
+ c7 as cornerFinder,
7292
7347
  g5 as countNodes,
7293
7348
  h4 as createAssembly,
7294
7349
  i3 as createAssemblyNode,
@@ -7301,8 +7356,8 @@ export {
7301
7356
  b as createHandle,
7302
7357
  j2 as createHistory,
7303
7358
  d as createKernelHandle,
7304
- b9 as createMeshCache,
7305
- c3 as createNamedPlane,
7359
+ b8 as createMeshCache,
7360
+ c4 as createNamedPlane,
7306
7361
  createOperationRegistry,
7307
7362
  a7 as createPlane,
7308
7363
  k2 as createRegistry,
@@ -7323,37 +7378,37 @@ export {
7323
7378
  curve2dTangentAt,
7324
7379
  curveEndPoint,
7325
7380
  curveIsClosed,
7326
- k6 as curveIsPeriodic,
7381
+ i6 as curveIsPeriodic,
7327
7382
  curveLength,
7328
- l8 as curvePeriod,
7383
+ j6 as curvePeriod,
7329
7384
  curvePointAt,
7330
7385
  curveStartPoint,
7331
7386
  curveTangentAt,
7332
7387
  cut,
7333
- f4 as cut2D,
7388
+ d4 as cut2D,
7334
7389
  cutAll,
7335
- l4 as cutBlueprints,
7390
+ j3 as cutBlueprints,
7336
7391
  m7 as cylinder,
7337
7392
  dequeueTask,
7338
7393
  describe,
7339
- g8 as deserializeDrawing,
7394
+ g7 as deserializeDrawing,
7340
7395
  m4 as deserializeHistory,
7341
7396
  fromBREP$1 as deserializeShape,
7342
7397
  d7 as downcast,
7343
- h5 as draw,
7398
+ h6 as draw,
7344
7399
  i4 as drawCircle,
7345
- j3 as drawEllipse,
7400
+ j4 as drawEllipse,
7346
7401
  k4 as drawFaceOutline,
7347
7402
  l5 as drawParametricFunction,
7348
7403
  m5 as drawPointsInterpolation,
7349
- n5 as drawPolysides,
7404
+ n4 as drawPolysides,
7350
7405
  o5 as drawProjection,
7351
7406
  p3 as drawRectangle,
7352
- q3 as drawRoundedRectangle,
7407
+ q2 as drawRoundedRectangle,
7353
7408
  r3 as drawSingleCircle,
7354
7409
  s3 as drawSingleEllipse,
7355
- t5 as drawText,
7356
- u3 as drawingChamfer,
7410
+ t4 as drawText,
7411
+ u4 as drawingChamfer,
7357
7412
  v5 as drawingCut,
7358
7413
  w3 as drawingFillet,
7359
7414
  x4 as drawingFuse,
@@ -7361,10 +7416,10 @@ export {
7361
7416
  z3 as drawingToSketchOnPlane,
7362
7417
  drill,
7363
7418
  edgeFinder,
7364
- n7 as edgesOfFace,
7419
+ n6 as edgesOfFace,
7365
7420
  o7 as ellipse,
7366
7421
  p5 as ellipseArc,
7367
- q5 as ellipsoid,
7422
+ q4 as ellipsoid,
7368
7423
  enqueueTask,
7369
7424
  err,
7370
7425
  n3 as exportAssemblySTEP,
@@ -7374,25 +7429,25 @@ export {
7374
7429
  e6 as exportIGES,
7375
7430
  exportOBJ,
7376
7431
  d8 as exportSTEP,
7377
- f10 as exportSTL,
7432
+ f9 as exportSTL,
7378
7433
  exportThreeMF,
7379
7434
  extrude,
7380
7435
  r7 as face,
7381
7436
  faceCenter,
7382
7437
  faceFinder,
7383
- f9 as faceGeomType,
7384
- q6 as faceOrientation,
7438
+ f8 as faceGeomType,
7439
+ q5 as faceOrientation,
7385
7440
  s4 as facesOfEdge,
7386
- n8 as fill,
7387
- t9 as filledFace,
7441
+ i8 as fill,
7442
+ t8 as filledFace,
7388
7443
  fillet,
7389
7444
  findCurveType,
7390
- n6 as findFacesByTag,
7445
+ n5 as findFacesByTag,
7391
7446
  o3 as findNode,
7392
7447
  p as findStep,
7393
7448
  f2 as flatMap,
7394
7449
  r8 as flipFaceOrientation,
7395
- f8 as flipOrientation,
7450
+ k6 as flipOrientation,
7396
7451
  _ as fontMetrics,
7397
7452
  fromBREP,
7398
7453
  fromKernelDir,
@@ -7400,34 +7455,34 @@ export {
7400
7455
  fromKernelVec,
7401
7456
  C2 as fromNullable,
7402
7457
  fuse,
7403
- g6 as fuse2D,
7458
+ f4 as fuse2D,
7404
7459
  fuseAll,
7405
- n4 as fuseBlueprints,
7460
+ k3 as fuseBlueprints,
7406
7461
  g4 as genericSweep,
7407
7462
  getBounds,
7408
7463
  getBounds2D,
7409
- b8 as getCurveType,
7464
+ l8 as getCurveType,
7410
7465
  getEdges,
7411
7466
  o6 as getFaceColor,
7412
7467
  getFaceOrigins,
7413
- q4 as getFaceTags,
7468
+ q3 as getFaceTags,
7414
7469
  getFaces,
7415
7470
  $ as getFont,
7416
7471
  f6 as getHashCode,
7417
7472
  q as getHistoryShape,
7418
7473
  getKernel,
7419
- g10 as getOrientation,
7474
+ g9 as getOrientation,
7420
7475
  getOrientation2D,
7421
7476
  r6 as getShapeColor,
7422
7477
  g as getShapeKind,
7423
- g7 as getSingleFace,
7478
+ g6 as getSingleFace,
7424
7479
  getSurfaceType,
7425
- t8 as getTagMetadata,
7480
+ t7 as getTagMetadata,
7426
7481
  getVertices,
7427
7482
  getWires,
7428
7483
  guidedSweep,
7429
7484
  heal,
7430
- u5 as healFace,
7485
+ u6 as healFace,
7431
7486
  v7 as healSolid,
7432
7487
  w5 as healWire,
7433
7488
  x6 as helix,
@@ -7444,8 +7499,9 @@ export {
7444
7499
  innerWires,
7445
7500
  m8 as interpolateCurve,
7446
7501
  intersect,
7447
- k3 as intersect2D,
7448
- q2 as intersectBlueprints,
7502
+ h5 as intersect2D,
7503
+ l4 as intersectBlueprints,
7504
+ x5 as invalidateShapeCache,
7449
7505
  ioError,
7450
7506
  i as is2D,
7451
7507
  e as is3D,
@@ -7456,7 +7512,7 @@ export {
7456
7512
  isDisposeRequest,
7457
7513
  isEdge,
7458
7514
  isEmpty,
7459
- x5 as isEqualShape,
7515
+ y4 as isEqualShape,
7460
7516
  isErr,
7461
7517
  isErrorResponse,
7462
7518
  isFace,
@@ -7481,11 +7537,11 @@ export {
7481
7537
  s as isValidSolid,
7482
7538
  t as isVertex,
7483
7539
  isWire,
7484
- y4 as iterEdges,
7485
- z4 as iterFaces,
7540
+ z4 as iterEdges,
7541
+ A5 as iterFaces,
7486
7542
  iterTopo,
7487
- A5 as iterVertices,
7488
- B5 as iterWires,
7543
+ B5 as iterVertices,
7544
+ C7 as iterWires,
7489
7545
  kernelCall,
7490
7546
  kernelCallRaw,
7491
7547
  kernelCallScoped,
@@ -7495,7 +7551,7 @@ export {
7495
7551
  a1 as loadFont,
7496
7552
  loft,
7497
7553
  A4 as makeBaseBox,
7498
- t3 as makePlane,
7554
+ u2 as makePlane,
7499
7555
  a22 as makeProjectedEdges,
7500
7556
  v as manifoldShell,
7501
7557
  m2 as map,
@@ -7503,10 +7559,10 @@ export {
7503
7559
  j as match,
7504
7560
  measureArea,
7505
7561
  e7 as measureCurvatureAt,
7506
- f11 as measureCurvatureAtMid,
7507
- g11 as measureDistance,
7508
- h7 as measureLength,
7509
- i6 as measureLinearProps,
7562
+ f10 as measureCurvatureAtMid,
7563
+ g10 as measureDistance,
7564
+ h9 as measureLength,
7565
+ i7 as measureLinearProps,
7510
7566
  measureSurfaceProps,
7511
7567
  measureVolume,
7512
7568
  measureVolumeProps,
@@ -7517,7 +7573,7 @@ export {
7517
7573
  mirror2D,
7518
7574
  B4 as mirrorDrawing,
7519
7575
  mirrorJoin,
7520
- t4 as modifyStep,
7576
+ t3 as modifyStep,
7521
7577
  l2 as moduleInitError,
7522
7578
  multiSectionSweep,
7523
7579
  normalAt,
@@ -7540,19 +7596,19 @@ export {
7540
7596
  E4 as polysideInnerRadius,
7541
7597
  p2 as polysidesBlueprint,
7542
7598
  a32 as projectEdges,
7543
- t10 as projectPointOnFace,
7599
+ t9 as projectPointOnFace,
7544
7600
  queryError,
7545
7601
  rectangularPattern,
7546
7602
  registerHandler,
7547
7603
  R as registerKernel,
7548
- u2 as registerOperation,
7604
+ u3 as registerOperation,
7549
7605
  v4 as registerShape,
7550
7606
  rejectAll,
7551
7607
  x3 as removeChild,
7552
7608
  v8 as removeHolesFromFace,
7553
7609
  y2 as replayFrom,
7554
7610
  z2 as replayHistory,
7555
- C7 as resize,
7611
+ D5 as resize,
7556
7612
  resolve,
7557
7613
  resolve3D,
7558
7614
  r4 as resolveDirection,
@@ -7571,8 +7627,8 @@ export {
7571
7627
  section,
7572
7628
  sectionToFace,
7573
7629
  A3 as serializeHistory,
7574
- D5 as setShapeOrigin,
7575
- u4 as setTagMetadata,
7630
+ E5 as setShapeOrigin,
7631
+ u5 as setTagMetadata,
7576
7632
  B6 as sewShells,
7577
7633
  shape,
7578
7634
  w6 as shapeType,
@@ -7600,7 +7656,7 @@ export {
7600
7656
  slice,
7601
7657
  D6 as solid,
7602
7658
  solveAssembly,
7603
- E5 as sphere,
7659
+ E6 as sphere,
7604
7660
  split,
7605
7661
  B2 as stepCount,
7606
7662
  C4 as stepsFrom,
@@ -7626,14 +7682,14 @@ export {
7626
7682
  toKernelVec,
7627
7683
  K2 as toLineGeometryData,
7628
7684
  toSVGPathD,
7629
- t6 as toVec2,
7685
+ t5 as toVec2,
7630
7686
  toVec3,
7631
7687
  L2 as torus,
7632
7688
  transformCopy,
7633
7689
  translate,
7634
7690
  translate2D,
7635
7691
  W as translateDrawing,
7636
- t7 as translatePlane,
7692
+ t6 as translatePlane,
7637
7693
  t2 as tryCatch,
7638
7694
  n2 as tryCatchAsync,
7639
7695
  E3 as twistExtrude,
@@ -7645,8 +7701,8 @@ export {
7645
7701
  w2 as unwrapOr,
7646
7702
  x2 as unwrapOrElse,
7647
7703
  G2 as updateNode,
7648
- u6 as uvBounds,
7649
- h6 as uvCoordinates,
7704
+ u7 as uvBounds,
7705
+ h8 as uvCoordinates,
7650
7706
  x as validSolid,
7651
7707
  validationError,
7652
7708
  v3 as vecAdd,