brepjs 8.0.1 → 8.0.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 (131) hide show
  1. package/dist/2d/blueprints/booleanHelpers.d.ts +32 -0
  2. package/dist/2d/blueprints/booleanHelpers.d.ts.map +1 -0
  3. package/dist/2d/blueprints/booleanOperations.d.ts +5 -3
  4. package/dist/2d/blueprints/booleanOperations.d.ts.map +1 -1
  5. package/dist/2d/blueprints/intersectionSegments.d.ts +12 -0
  6. package/dist/2d/blueprints/intersectionSegments.d.ts.map +1 -0
  7. package/dist/2d/blueprints/segmentAssembly.d.ts +31 -0
  8. package/dist/2d/blueprints/segmentAssembly.d.ts.map +1 -0
  9. package/dist/2d.cjs +2 -2
  10. package/dist/2d.js +8 -8
  11. package/dist/{Blueprint-D3JfGJTz.js → Blueprint-DnAO3gr5.js} +116 -30
  12. package/dist/{Blueprint-CVctc41Z.cjs → Blueprint-FxmMji4s.cjs} +110 -24
  13. package/dist/{boolean2D-hOw5Qay5.js → boolean2D-BnZKKBWU.js} +391 -310
  14. package/dist/{boolean2D-BdZATaHs.cjs → boolean2D-BrjHZfWn.cjs} +426 -345
  15. package/dist/{booleanFns-CqehfzcK.js → booleanFns-Ct3wDnhc.js} +14 -18
  16. package/dist/{booleanFns-BBSVKhL2.cjs → booleanFns-ND7sZvhu.cjs} +12 -16
  17. package/dist/brepjs.cjs +171 -101
  18. package/dist/brepjs.js +315 -244
  19. package/dist/{cast-DQaUibmm.js → cast-BEg1mN7n.js} +2 -2
  20. package/dist/{cast-DkB0GKmQ.cjs → cast-CqDc8oFW.cjs} +2 -2
  21. package/dist/core/disposal.d.ts +1 -1
  22. package/dist/core/disposal.d.ts.map +1 -1
  23. package/dist/core.cjs +3 -3
  24. package/dist/core.js +3 -3
  25. package/dist/cornerFinder-89obDwGi.js +59 -0
  26. package/dist/cornerFinder-BKsCkrXd.cjs +58 -0
  27. package/dist/curveBuilders-BjtdNw1B.cjs +196 -0
  28. package/dist/curveBuilders-U26XDfxg.js +197 -0
  29. package/dist/curveFns-BoG_iA07.cjs +375 -0
  30. package/dist/curveFns-Cg99XKe2.js +376 -0
  31. package/dist/{drawFns-CUyx50gi.cjs → drawFns-C-MCkYj6.cjs} +60 -62
  32. package/dist/{drawFns-921SkhDL.js → drawFns-DJV-nOox.js} +12 -14
  33. package/dist/{faceFns-DHu-2JpA.js → faceFns-CyokaCDr.js} +3 -3
  34. package/dist/{faceFns-BwK7FP7N.cjs → faceFns-DcSCjDG0.cjs} +3 -3
  35. package/dist/helpers--iZxPeJg.cjs +203 -0
  36. package/dist/helpers-CRx_ks-u.js +204 -0
  37. package/dist/io.cjs +4 -4
  38. package/dist/io.js +4 -4
  39. package/dist/kernel/curveOps.d.ts.map +1 -1
  40. package/dist/kernel/meshOps.d.ts.map +1 -1
  41. package/dist/kernel/modifierOps.d.ts.map +1 -1
  42. package/dist/kernel/occtAdapter.d.ts +1 -0
  43. package/dist/kernel/occtAdapter.d.ts.map +1 -1
  44. package/dist/kernel/sweepOps.d.ts +8 -0
  45. package/dist/kernel/sweepOps.d.ts.map +1 -1
  46. package/dist/kernel/types.d.ts +1 -0
  47. package/dist/kernel/types.d.ts.map +1 -1
  48. package/dist/loft-8asn63t4.cjs +372 -0
  49. package/dist/loft-jIkZRqHm.js +373 -0
  50. package/dist/{measurement-C5JGCuUP.js → measurement-DWv8kK6J.js} +3 -3
  51. package/dist/{measurement-fxm_pW7x.cjs → measurement-lRLwaoqD.cjs} +3 -3
  52. package/dist/measurement.cjs +1 -1
  53. package/dist/measurement.js +1 -1
  54. package/dist/{meshFns-BhrZGi6w.cjs → meshFns-DWuLC3fk.cjs} +29 -9
  55. package/dist/{meshFns-AqAjTTVl.js → meshFns-DgAIL1B-.js} +29 -9
  56. package/dist/{occtBoundary-du8_ex-p.cjs → occtBoundary-DHtzU4tz.cjs} +93 -61
  57. package/dist/{occtBoundary-CwegMzqc.js → occtBoundary-DYsksDtE.js} +98 -66
  58. package/dist/operations/extrude.d.ts.map +1 -1
  59. package/dist/operations/extrudeFns.d.ts.map +1 -1
  60. package/dist/operations/extrudeUtils.d.ts +17 -0
  61. package/dist/operations/extrudeUtils.d.ts.map +1 -1
  62. package/dist/operations/patternFns.d.ts.map +1 -1
  63. package/dist/{operations-C1rWoba2.js → operations-B8FHVC22.js} +54 -9
  64. package/dist/{operations-BP1wVDw0.cjs → operations-CCFPvtd-.cjs} +54 -9
  65. package/dist/operations.cjs +2 -2
  66. package/dist/operations.js +4 -4
  67. package/dist/query/cornerFinder.d.ts +48 -0
  68. package/dist/query/cornerFinder.d.ts.map +1 -0
  69. package/dist/query/directionUtils.d.ts +6 -0
  70. package/dist/query/directionUtils.d.ts.map +1 -0
  71. package/dist/query/edgeFinder.d.ts +15 -0
  72. package/dist/query/edgeFinder.d.ts.map +1 -0
  73. package/dist/query/faceFinder.d.ts +15 -0
  74. package/dist/query/faceFinder.d.ts.map +1 -0
  75. package/dist/query/finderCore.d.ts +35 -0
  76. package/dist/query/finderCore.d.ts.map +1 -0
  77. package/dist/query/finderFns.d.ts +21 -106
  78. package/dist/query/finderFns.d.ts.map +1 -1
  79. package/dist/query/shapeDistanceFilter.d.ts +11 -0
  80. package/dist/query/shapeDistanceFilter.d.ts.map +1 -0
  81. package/dist/query/vertexFinder.d.ts +16 -0
  82. package/dist/query/vertexFinder.d.ts.map +1 -0
  83. package/dist/query/wireFinder.d.ts +10 -0
  84. package/dist/query/wireFinder.d.ts.map +1 -0
  85. package/dist/query.cjs +42 -5
  86. package/dist/query.js +40 -2
  87. package/dist/{shapeTypes-DKhwEnUM.cjs → shapeTypes-b_lhwQB7.cjs} +24 -20
  88. package/dist/{shapeTypes-BlSElW8z.js → shapeTypes-i7VwMRwc.js} +32 -28
  89. package/dist/sketching/Sketcher.d.ts.map +1 -1
  90. package/dist/sketching/Sketcher2d.d.ts +12 -4
  91. package/dist/sketching/Sketcher2d.d.ts.map +1 -1
  92. package/dist/sketching/ellipseUtils.d.ts +29 -0
  93. package/dist/sketching/ellipseUtils.d.ts.map +1 -0
  94. package/dist/sketching.cjs +2 -2
  95. package/dist/sketching.js +2 -2
  96. package/dist/topology/booleanFns.d.ts.map +1 -1
  97. package/dist/topology/curveBuilders.d.ts +75 -0
  98. package/dist/topology/curveBuilders.d.ts.map +1 -0
  99. package/dist/topology/curveFns.d.ts.map +1 -1
  100. package/dist/topology/meshFns.d.ts.map +1 -1
  101. package/dist/topology/primitiveFns.d.ts.map +1 -1
  102. package/dist/topology/shapeFns.d.ts.map +1 -1
  103. package/dist/topology/shapeHelpers.d.ts +6 -173
  104. package/dist/topology/shapeHelpers.d.ts.map +1 -1
  105. package/dist/topology/shapeUtils.d.ts +13 -0
  106. package/dist/topology/shapeUtils.d.ts.map +1 -0
  107. package/dist/topology/solidBuilders.d.ts +70 -0
  108. package/dist/topology/solidBuilders.d.ts.map +1 -0
  109. package/dist/topology/surfaceBuilders.d.ts +35 -0
  110. package/dist/topology/surfaceBuilders.d.ts.map +1 -0
  111. package/dist/topology/wrapperFns.d.ts +1 -0
  112. package/dist/topology/wrapperFns.d.ts.map +1 -1
  113. package/dist/{topology-tFzqSrGH.js → topology-Bh-aPIxA.js} +7 -8
  114. package/dist/{topology-CIooytHH.cjs → topology-ByOn_z3E.cjs} +12 -13
  115. package/dist/topology.cjs +33 -34
  116. package/dist/topology.js +54 -55
  117. package/dist/{vectors-CBuaMeZv.js → vectors-DWLjb9-P.js} +1 -1
  118. package/dist/{vectors-ChWEZPwy.cjs → vectors-aQBZK0Sb.cjs} +1 -1
  119. package/dist/vectors.cjs +2 -2
  120. package/dist/vectors.js +2 -2
  121. package/package.json +1 -1
  122. package/dist/curveFns-BilyYL_s.cjs +0 -190
  123. package/dist/curveFns-CdVE4da7.js +0 -191
  124. package/dist/loft-BzWFokmC.cjs +0 -178
  125. package/dist/loft-CtG5nMq5.js +0 -179
  126. package/dist/query-V6nV-VfL.js +0 -396
  127. package/dist/query-hMSmOWJP.cjs +0 -395
  128. package/dist/shapeFns-BrF97sKt.js +0 -204
  129. package/dist/shapeFns-BvOndshS.cjs +0 -203
  130. package/dist/shapeHelpers-B2SXz1p4.cjs +0 -488
  131. package/dist/shapeHelpers-BcoZf2N9.js +0 -489
@@ -1,20 +1,20 @@
1
1
  "use strict";
2
2
  const errors = require("./errors-DK1VAdP4.cjs");
3
- const shapeHelpers = require("./shapeHelpers-B2SXz1p4.cjs");
4
- const vectors = require("./vectors-ChWEZPwy.cjs");
5
- const occtBoundary = require("./occtBoundary-du8_ex-p.cjs");
3
+ const vectors = require("./vectors-aQBZK0Sb.cjs");
4
+ const occtBoundary = require("./occtBoundary-DHtzU4tz.cjs");
6
5
  const vecOps = require("./vecOps-CjRL1jau.cjs");
7
- const boolean2D = require("./boolean2D-BdZATaHs.cjs");
8
- const faceFns = require("./faceFns-BwK7FP7N.cjs");
9
- const curveFns = require("./curveFns-BilyYL_s.cjs");
10
- const shapeTypes = require("./shapeTypes-DKhwEnUM.cjs");
11
- const cast = require("./cast-DkB0GKmQ.cjs");
12
- const Blueprint = require("./Blueprint-CVctc41Z.cjs");
6
+ const boolean2D = require("./boolean2D-BrjHZfWn.cjs");
7
+ const faceFns = require("./faceFns-DcSCjDG0.cjs");
8
+ const curveFns = require("./curveFns-BoG_iA07.cjs");
9
+ const curveBuilders = require("./curveBuilders-BjtdNw1B.cjs");
10
+ const shapeTypes = require("./shapeTypes-b_lhwQB7.cjs");
11
+ const cast = require("./cast-CqDc8oFW.cjs");
12
+ const Blueprint = require("./Blueprint-FxmMji4s.cjs");
13
13
  const result = require("./result.cjs");
14
- const query = require("./query-hMSmOWJP.cjs");
15
- const shapeFns = require("./shapeFns-BvOndshS.cjs");
16
- const loft = require("./loft-BzWFokmC.cjs");
14
+ const helpers = require("./helpers--iZxPeJg.cjs");
15
+ const loft = require("./loft-8asn63t4.cjs");
17
16
  const opentype = require("opentype.js");
17
+ const cornerFinder = require("./cornerFinder-BKsCkrXd.cjs");
18
18
  const stitchCurves = (curves, precision = 1e-7) => {
19
19
  const startPoints = new boolean2D.Flatbush(curves.length);
20
20
  curves.forEach((c) => {
@@ -97,7 +97,7 @@ class Sketcher {
97
97
  /** Draw a straight line to an absolute 2D point on the sketch plane. */
98
98
  lineTo([x, y]) {
99
99
  const endPoint = vectors.planeToWorld(this.plane, [x, y]);
100
- this.pendingEdges.push(shapeHelpers.makeLine(this.pointer, endPoint));
100
+ this.pendingEdges.push(curveBuilders.makeLine(this.pointer, endPoint));
101
101
  this._updatePointer(endPoint);
102
102
  return this;
103
103
  }
@@ -127,13 +127,13 @@ class Sketcher {
127
127
  /** Draw a line in polar coordinates (distance and angle in degrees) from the current point. */
128
128
  polarLine(distance, angle) {
129
129
  const angleInRads = angle * vecOps.DEG2RAD;
130
- const [x, y] = query.polarToCartesian(distance, angleInRads);
130
+ const [x, y] = helpers.polarToCartesian(distance, angleInRads);
131
131
  return this.line(x, y);
132
132
  }
133
133
  /** Draw a line to a point given in polar coordinates [r, theta] from the origin. */
134
134
  polarLineTo([r, theta]) {
135
135
  const angleInRads = theta * vecOps.DEG2RAD;
136
- const point = query.polarToCartesian(r, angleInRads);
136
+ const point = helpers.polarToCartesian(r, angleInRads);
137
137
  return this.lineTo(point);
138
138
  }
139
139
  /** Draw a line tangent to the previous edge, extending by the given distance. */
@@ -144,7 +144,7 @@ class Sketcher {
144
144
  const tangent = curveFns.curveTangentAt(previousEdge, 1);
145
145
  const scaledTangent = vecOps.vecScale(vecOps.vecNormalize(tangent), distance);
146
146
  const endPoint = vecOps.vecAdd(scaledTangent, this.pointer);
147
- this.pendingEdges.push(shapeHelpers.makeLine(this.pointer, endPoint));
147
+ this.pendingEdges.push(curveBuilders.makeLine(this.pointer, endPoint));
148
148
  this._updatePointer(endPoint);
149
149
  return this;
150
150
  }
@@ -152,7 +152,7 @@ class Sketcher {
152
152
  threePointsArcTo(end, innerPoint) {
153
153
  const gpoint1 = vectors.planeToWorld(this.plane, innerPoint);
154
154
  const gpoint2 = vectors.planeToWorld(this.plane, end);
155
- this.pendingEdges.push(shapeHelpers.makeThreePointArc(this.pointer, gpoint1, gpoint2));
155
+ this.pendingEdges.push(curveBuilders.makeThreePointArc(this.pointer, gpoint1, gpoint2));
156
156
  this._updatePointer(gpoint2);
157
157
  return this;
158
158
  }
@@ -169,7 +169,7 @@ class Sketcher {
169
169
  result.bug("Sketcher.tangentArcTo", "You need a previous edge to create a tangent arc");
170
170
  const prevEnd = curveFns.curveEndPoint(previousEdge);
171
171
  const prevTangent = curveFns.curveTangentAt(previousEdge, 1);
172
- this.pendingEdges.push(shapeHelpers.makeTangentArc(prevEnd, prevTangent, endPoint));
172
+ this.pendingEdges.push(curveBuilders.makeTangentArc(prevEnd, prevTangent, endPoint));
173
173
  this._updatePointer(endPoint);
174
174
  return this;
175
175
  }
@@ -189,7 +189,7 @@ class Sketcher {
189
189
  const sagDirection = vecOps.vecNormalize(crossResult);
190
190
  const sagVector = vecOps.vecScale(sagDirection, sagitta);
191
191
  const sagPoint = vecOps.vecAdd(midPoint, sagVector);
192
- this.pendingEdges.push(shapeHelpers.makeThreePointArc(this.pointer, sagPoint, endPoint));
192
+ this.pendingEdges.push(curveBuilders.makeThreePointArc(this.pointer, sagPoint, endPoint));
193
193
  this._updatePointer(endPoint);
194
194
  return this;
195
195
  }
@@ -210,7 +210,7 @@ class Sketcher {
210
210
  bulgeArcTo(end, bulge) {
211
211
  if (!bulge) return this.lineTo(end);
212
212
  const [px, py] = vectors.planeToLocal(this.plane, this.pointer);
213
- const halfChord = query.distance2d([px, py], end) / 2;
213
+ const halfChord = helpers.distance2d([px, py], end) / 2;
214
214
  const bulgeAsSagitta = -bulge * halfChord;
215
215
  return this.sagittaArcTo(end, bulgeAsSagitta);
216
216
  }
@@ -229,7 +229,6 @@ class Sketcher {
229
229
  }
230
230
  /** Draw an elliptical arc to an absolute end point (SVG-style parameters). */
231
231
  ellipseTo(end, horizontalRadius, verticalRadius, rotation = 0, longAxis = false, sweep = false) {
232
- const [, gc] = shapeTypes.localGC();
233
232
  const [startX, startY] = vectors.planeToLocal(this.plane, this.pointer);
234
233
  let rotationAngle = rotation;
235
234
  let majorRadius = horizontalRadius;
@@ -250,7 +249,7 @@ class Sketcher {
250
249
  );
251
250
  const xDir = vecOps.vecRotate(this.plane.xDir, this.plane.zDir, rotationAngle * vecOps.DEG2RAD);
252
251
  const arc = errors.unwrap(
253
- shapeHelpers.makeEllipseArc(
252
+ curveBuilders.makeEllipseArc(
254
253
  rx,
255
254
  ry,
256
255
  clockwise ? startAngle : endAngle,
@@ -265,7 +264,6 @@ class Sketcher {
265
264
  }
266
265
  this.pendingEdges.push(arc);
267
266
  this._updatePointer(vectors.planeToWorld(this.plane, end));
268
- gc();
269
267
  return this;
270
268
  }
271
269
  /** Draw an elliptical arc to a relative end point (SVG-style parameters). */
@@ -284,8 +282,8 @@ class Sketcher {
284
282
  halfEllipseTo(end, verticalRadius, sweep = false) {
285
283
  const [px, py] = vectors.planeToLocal(this.plane, this.pointer);
286
284
  const start = [px, py];
287
- const angle = query.polarAngle2d(end, start);
288
- const distance = query.distance2d(end, start);
285
+ const angle = helpers.polarAngle2d(end, start);
286
+ const distance = helpers.distance2d(end, start);
289
287
  return this.ellipseTo(end, distance / 2, verticalRadius, angle * vecOps.RAD2DEG, false, sweep);
290
288
  }
291
289
  /** Draw a half-ellipse arc to a relative end point with a given minor radius. */
@@ -303,7 +301,7 @@ class Sketcher {
303
301
  }
304
302
  const inWorldPoints = cp.map((p) => vectors.planeToWorld(this.plane, p));
305
303
  const endPoint = vectors.planeToWorld(this.plane, end);
306
- this.pendingEdges.push(errors.unwrap(shapeHelpers.makeBezierCurve([this.pointer, ...inWorldPoints, endPoint])));
304
+ this.pendingEdges.push(errors.unwrap(curveBuilders.makeBezierCurve([this.pointer, ...inWorldPoints, endPoint])));
307
305
  this._updatePointer(endPoint);
308
306
  return this;
309
307
  }
@@ -352,7 +350,7 @@ class Sketcher {
352
350
  const endPoleDistance = vecOps.vecScale(vecOps.vecNormalize(endPoleDirection), endFactor * defaultDistance);
353
351
  const endControl = vecOps.vecSub(endPoint, endPoleDistance);
354
352
  this.pendingEdges.push(
355
- errors.unwrap(shapeHelpers.makeBezierCurve([this.pointer, startControl, endControl, endPoint]))
353
+ errors.unwrap(curveBuilders.makeBezierCurve([this.pointer, startControl, endControl, endPoint]))
356
354
  );
357
355
  this._updatePointer(endPoint);
358
356
  return this;
@@ -373,12 +371,12 @@ class Sketcher {
373
371
  const mirroredRaw = Blueprint.mirror(clonedWrapped, normal, this.pointer);
374
372
  const mirroredWrapped = errors.unwrap(cast.downcast(mirroredRaw));
375
373
  const mirroredWire = shapeTypes.createWire(mirroredWrapped);
376
- const combinedWire = errors.unwrap(shapeHelpers.assembleWire([wire, mirroredWire]));
374
+ const combinedWire = errors.unwrap(curveBuilders.assembleWire([wire, mirroredWire]));
377
375
  return combinedWire;
378
376
  }
379
377
  buildWire() {
380
378
  if (!this.pendingEdges.length) result.bug("Sketcher.buildWire", "No lines to convert into a wire");
381
- let wire = errors.unwrap(shapeHelpers.assembleWire(this.pendingEdges));
379
+ let wire = errors.unwrap(curveBuilders.assembleWire(this.pendingEdges));
382
380
  if (this._mirrorWire) {
383
381
  wire = this._mirrorWireOnStartEnd(wire);
384
382
  }
@@ -416,7 +414,7 @@ const guessFaceFromWires = (wires) => {
416
414
  new oc.BRepOffsetAPI_MakeFilling(3, 15, 2, false, 1e-5, 1e-4, 0.01, 0.1, 8, 9)
417
415
  );
418
416
  wires.forEach((wire, wireIndex) => {
419
- shapeFns.getEdges(wire).forEach((edge) => {
417
+ curveFns.getEdges(wire).forEach((edge) => {
420
418
  faceBuilder.Add_1(edge.wrapped, oc.GeomAbs_Shape.GeomAbs_C0, wireIndex === 0);
421
419
  });
422
420
  });
@@ -440,7 +438,7 @@ const fixWire = (wire, baseFace) => {
440
438
  const faceFromWires = (wires) => {
441
439
  let baseFace;
442
440
  let holeWires;
443
- const faceResult = shapeHelpers.makeFace(wires[0]);
441
+ const faceResult = Blueprint.makeFace(wires[0]);
444
442
  if (errors.isOk(faceResult)) {
445
443
  baseFace = faceResult.value;
446
444
  holeWires = wires.slice(1);
@@ -448,7 +446,7 @@ const faceFromWires = (wires) => {
448
446
  baseFace = guessFaceFromWires(wires);
449
447
  holeWires = wires.slice(1).map((w) => fixWire(w, baseFace));
450
448
  }
451
- return shapeHelpers.addHolesInFace(baseFace, holeWires);
449
+ return Blueprint.addHolesInFace(baseFace, holeWires);
452
450
  };
453
451
  const solidFromShellGenerator = (sketches, shellGenerator) => {
454
452
  const shells = [];
@@ -462,7 +460,7 @@ const solidFromShellGenerator = (sketches, shellGenerator) => {
462
460
  });
463
461
  const startFace = faceFromWires(startWires);
464
462
  const endFace = faceFromWires(endWires);
465
- const solid = errors.unwrap(shapeHelpers.makeSolid([startFace, ...shells, endFace]));
463
+ const solid = errors.unwrap(loft.makeSolid([startFace, ...shells, endFace]));
466
464
  return solid;
467
465
  };
468
466
  class CompoundSketch {
@@ -490,12 +488,12 @@ class CompoundSketch {
490
488
  /** Return all wires (outer + holes) combined into a compound shape. */
491
489
  get wires() {
492
490
  const wires = this.sketches.map((s) => s.wire);
493
- return shapeHelpers.makeCompound(wires);
491
+ return loft.makeCompound(wires);
494
492
  }
495
493
  /** Build a face from the outer boundary with inner wires subtracted as holes. */
496
494
  face() {
497
495
  const baseFace = this.outerSketch.face();
498
- const newFace = shapeHelpers.addHolesInFace(
496
+ const newFace = Blueprint.addHolesInFace(
499
497
  baseFace,
500
498
  this.innerSketches.map((s) => s.wire)
501
499
  );
@@ -574,7 +572,7 @@ class CompoundSketch {
574
572
  const baseFaceRaw = this.face();
575
573
  const baseFace = shapeTypes.createFace(errors.unwrap(cast.downcast(baseFaceRaw.wrapped)));
576
574
  shells.push(baseFace, otherCompound.face());
577
- return errors.unwrap(shapeHelpers.makeSolid(shells));
575
+ return errors.unwrap(loft.makeSolid(shells));
578
576
  }
579
577
  }
580
578
  class Sketches {
@@ -585,12 +583,12 @@ class Sketches {
585
583
  /** Return all wires combined into a single compound shape. */
586
584
  wires() {
587
585
  const wires = this.sketches.map((s) => s instanceof boolean2D.Sketch ? s.wire : s.wires);
588
- return shapeHelpers.makeCompound(wires);
586
+ return loft.makeCompound(wires);
589
587
  }
590
588
  /** Return all sketch faces combined into a single compound shape. */
591
589
  faces() {
592
590
  const faces = this.sketches.map((s) => s.face());
593
- return shapeHelpers.makeCompound(faces);
591
+ return loft.makeCompound(faces);
594
592
  }
595
593
  /** Extrudes the sketch to a certain distance (along the default direction
596
594
  * and origin of the sketch).
@@ -604,19 +602,19 @@ class Sketches {
604
602
  */
605
603
  extrude(extrusionDistance, extrusionConfig = {}) {
606
604
  const extruded = this.sketches.map((s) => s.extrude(extrusionDistance, extrusionConfig));
607
- return shapeHelpers.makeCompound(extruded);
605
+ return loft.makeCompound(extruded);
608
606
  }
609
607
  /**
610
608
  * Revolves the drawing on an axis (defined by its direction and an origin
611
609
  * (defaults to the sketch origin)
612
610
  */
613
611
  revolve(revolutionAxis, config) {
614
- return shapeHelpers.makeCompound(this.sketches.map((s) => s.revolve(revolutionAxis, config)));
612
+ return loft.makeCompound(this.sketches.map((s) => s.revolve(revolutionAxis, config)));
615
613
  }
616
614
  }
617
615
  const sketchCircle = (radius, planeConfig = {}) => {
618
616
  const plane = planeConfig.plane && typeof planeConfig.plane !== "string" ? { ...planeConfig.plane } : vectors.resolvePlane(planeConfig.plane ?? "XY", planeConfig.origin);
619
- const wire = errors.unwrap(shapeHelpers.assembleWire([shapeHelpers.makeCircle(radius, plane.origin, plane.zDir)]));
617
+ const wire = errors.unwrap(curveBuilders.assembleWire([curveBuilders.makeCircle(radius, plane.origin, plane.zDir)]));
620
618
  const sketch = new boolean2D.Sketch(wire, {
621
619
  defaultOrigin: [...plane.origin],
622
620
  defaultDirection: [...plane.zDir]
@@ -634,7 +632,7 @@ const sketchEllipse = (xRadius = 1, yRadius = 2, planeConfig = {}) => {
634
632
  minR = xRadius;
635
633
  }
636
634
  const wire = errors.unwrap(
637
- shapeHelpers.assembleWire([errors.unwrap(shapeHelpers.makeEllipse(majR, minR, plane.origin, plane.zDir, xDir))])
635
+ curveBuilders.assembleWire([errors.unwrap(curveBuilders.makeEllipse(majR, minR, plane.origin, plane.zDir, xDir))])
638
636
  );
639
637
  const sketch = new boolean2D.Sketch(wire, {
640
638
  defaultOrigin: [...plane.origin],
@@ -696,7 +694,7 @@ const sketchParametricFunction = (func, planeConfig = {}, { pointsCount = 400, s
696
694
  return vectors.planeToWorld(plane, point);
697
695
  });
698
696
  const wire = errors.unwrap(
699
- shapeHelpers.assembleWire([r(errors.unwrap(shapeHelpers.makeBSplineApproximation(points, approximationConfig)))])
697
+ curveBuilders.assembleWire([r(errors.unwrap(curveBuilders.makeBSplineApproximation(points, approximationConfig)))])
700
698
  );
701
699
  const sketch = new boolean2D.Sketch(wire, {
702
700
  defaultOrigin: [...plane.origin],
@@ -709,13 +707,13 @@ const sketchHelix = (pitch, height, radius, center = [0, 0, 0], dir = [0, 0, 1],
709
707
  const centerVec3 = occtBoundary.toVec3(center);
710
708
  const dirVec3 = occtBoundary.toVec3(dir);
711
709
  return new boolean2D.Sketch(
712
- errors.unwrap(shapeHelpers.assembleWire([shapeHelpers.makeHelix(pitch, height, radius, centerVec3, dirVec3, lefthand)]))
710
+ errors.unwrap(curveBuilders.assembleWire([curveBuilders.makeHelix(pitch, height, radius, centerVec3, dirVec3, lefthand)]))
713
711
  );
714
712
  };
715
713
  const makeBaseBox = (xLength, yLength, zLength) => {
716
714
  return new Sketcher().movePointerTo([-xLength / 2, yLength / 2]).hLine(xLength).vLine(-yLength).hLine(-xLength).close().extrude(zLength);
717
715
  };
718
- const samePoint = (x, y) => query.samePoint(x, y, query.PRECISION_OFFSET * 10);
716
+ const samePoint = (x, y) => helpers.samePoint(x, y, helpers.PRECISION_OFFSET * 10);
719
717
  const getIntersectionPoint = (line1Start, line1End, line2Start, line2End) => {
720
718
  const dx1 = line1Start[0] - line1End[0];
721
719
  const dy1 = line1Start[1] - line1End[1];
@@ -744,8 +742,8 @@ function joinBevel(appendCurve, previousLastPoint, firstPoint, previousCurve, _c
744
742
  appendCurve(bevelJoiner);
745
743
  }
746
744
  function joinMiter(appendCurve, previousLastPoint, firstPoint, previousCurve, curve) {
747
- const previousOtherPoint = previousCurve.offset instanceof Blueprint.Curve2D ? query.subtract2d(previousLastPoint, previousCurve.offset.tangentAt(1)) : previousCurve.offset.firstPoint;
748
- const nextOtherPoint = curve.offset instanceof Blueprint.Curve2D ? query.add2d(firstPoint, curve.offset.tangentAt(0)) : curve.offset.lastPoint;
745
+ const previousOtherPoint = previousCurve.offset instanceof Blueprint.Curve2D ? helpers.subtract2d(previousLastPoint, previousCurve.offset.tangentAt(1)) : previousCurve.offset.firstPoint;
746
+ const nextOtherPoint = curve.offset instanceof Blueprint.Curve2D ? helpers.add2d(firstPoint, curve.offset.tangentAt(0)) : curve.offset.lastPoint;
749
747
  const offsetIntersectionPoint = getIntersectionPoint(
750
748
  previousOtherPoint,
751
749
  previousLastPoint,
@@ -810,7 +808,7 @@ function rawOffsets(blueprint, offset2, offsetConfig = {}) {
810
808
  let intersections = [];
811
809
  if (previousCurve.offset instanceof Blueprint.Curve2D && curve.offset instanceof Blueprint.Curve2D) {
812
810
  const { intersections: pointIntersections, commonSegmentsPoints } = errors.unwrap(
813
- boolean2D.intersectCurves(previousCurve.offset, curve.offset, query.PRECISION_OFFSET / 100)
811
+ boolean2D.intersectCurves(previousCurve.offset, curve.offset, helpers.PRECISION_OFFSET / 100)
814
812
  );
815
813
  intersections = [...pointIntersections, ...commonSegmentsPoints];
816
814
  }
@@ -818,10 +816,10 @@ function rawOffsets(blueprint, offset2, offsetConfig = {}) {
818
816
  let intersection = intersections[0];
819
817
  if (intersections.length > 1) {
820
818
  const originalEndpoint = previousCurve.original.lastPoint;
821
- let minDist = query.squareDistance2d(intersection, originalEndpoint);
819
+ let minDist = helpers.squareDistance2d(intersection, originalEndpoint);
822
820
  for (let i = 1; i < intersections.length; i++) {
823
821
  const point = intersections[i];
824
- const d = query.squareDistance2d(point, originalEndpoint);
822
+ const d = helpers.squareDistance2d(point, originalEndpoint);
825
823
  if (d < minDist) {
826
824
  minDist = d;
827
825
  intersection = point;
@@ -830,9 +828,9 @@ function rawOffsets(blueprint, offset2, offsetConfig = {}) {
830
828
  }
831
829
  const splitPreviousCurve = previousCurve.offset.splitAt(
832
830
  [intersection],
833
- query.PRECISION_OFFSET
831
+ helpers.PRECISION_OFFSET
834
832
  )[0];
835
- const splitCurve = curve.offset.splitAt([intersection], query.PRECISION_OFFSET).at(-1);
833
+ const splitCurve = curve.offset.splitAt([intersection], helpers.PRECISION_OFFSET).at(-1);
836
834
  if (!splitCurve) result.bug("offset.rawOffsets", "Split produced no trailing curve segment");
837
835
  appendCurve({
838
836
  offset: splitPreviousCurve,
@@ -873,7 +871,7 @@ function offsetBlueprint(blueprint, offset2, offsetConfig = {}) {
873
871
  testedPairs.add(pairKey);
874
872
  const secondCurve = offsettedArray[secondIndex];
875
873
  const { intersections: rawIntersections, commonSegmentsPoints } = errors.unwrap(
876
- boolean2D.intersectCurves(firstCurve, secondCurve, query.PRECISION_OFFSET)
874
+ boolean2D.intersectCurves(firstCurve, secondCurve, helpers.PRECISION_OFFSET)
877
875
  );
878
876
  const intersections = [...rawIntersections, ...commonSegmentsPoints].filter(
879
877
  (intersection) => {
@@ -895,12 +893,12 @@ function offsetBlueprint(blueprint, offset2, offsetConfig = {}) {
895
893
  const splitCurves = offsettedArray.flatMap((curve, index) => {
896
894
  if (!allIntersections.has(index)) return curve;
897
895
  const intersections = allIntersections.get(index) || [];
898
- const splitCurves2 = curve.splitAt(intersections, query.PRECISION_OFFSET * 100);
896
+ const splitCurves2 = curve.splitAt(intersections, helpers.PRECISION_OFFSET * 100);
899
897
  return splitCurves2;
900
898
  });
901
899
  const prunedCurves = splitCurves.filter((curve) => {
902
900
  const closeCurve = blueprint.curves.find(
903
- (c) => c.distanceFrom(curve) < Math.abs(offset2) - query.PRECISION_OFFSET
901
+ (c) => c.distanceFrom(curve) < Math.abs(offset2) - helpers.PRECISION_OFFSET
904
902
  );
905
903
  return !closeCurve;
906
904
  });
@@ -971,7 +969,7 @@ function modifyCorners(makeCorner, blueprint, radius, finder) {
971
969
  result.bug("customCorners.modifyCorners", "Unexpected empty curve list during corner modification");
972
970
  if (
973
971
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
974
- query.samePoint(curves[0].firstPoint, lastCurve.lastPoint) && curves.length > 1
972
+ helpers.samePoint(curves[0].firstPoint, lastCurve.lastPoint) && curves.length > 1
975
973
  ) {
976
974
  const firstCurve = curves.pop();
977
975
  const secondCurve = curves.shift();
@@ -1121,7 +1119,7 @@ function isProjectionPlane(plane) {
1121
1119
  }
1122
1120
  const getEdgesFromOc = (shape) => {
1123
1121
  if (shape.IsNull()) return [];
1124
- return shapeFns.getEdges(shapeTypes.castShape(shape));
1122
+ return curveFns.getEdges(shapeTypes.castShape(shape));
1125
1123
  };
1126
1124
  function makeProjectedEdges(shape, camera, withHiddenLines = true) {
1127
1125
  const oc = occtBoundary.getKernel().oc;
@@ -1302,7 +1300,7 @@ class Drawing {
1302
1300
  * @category Drawing Modifications
1303
1301
  */
1304
1302
  fillet(radius, filter) {
1305
- const finder = filter && filter(query.cornerFinder());
1303
+ const finder = filter && filter(cornerFinder.cornerFinder());
1306
1304
  return new Drawing(fillet2D(this.innerShape, radius, finder));
1307
1305
  }
1308
1306
  /**
@@ -1312,7 +1310,7 @@ class Drawing {
1312
1310
  * @category Drawing Modifications
1313
1311
  */
1314
1312
  chamfer(radius, filter) {
1315
- const finder = filter && filter(query.cornerFinder());
1313
+ const finder = filter && filter(cornerFinder.cornerFinder());
1316
1314
  return new Drawing(chamfer2D(this.innerShape, radius, finder));
1317
1315
  }
1318
1316
  sketchOnPlane(inputPlane, origin) {
@@ -1459,7 +1457,7 @@ const drawPointsInterpolation = (points, approximationConfig = {}, options = {})
1459
1457
  const curves = [errors.unwrap(Blueprint.make2dInerpolatedBSplineCurve(points, approximationConfig))];
1460
1458
  const firstPoint = points[0];
1461
1459
  const lastPoint = points[points.length - 1];
1462
- if (options.closeShape && firstPoint && lastPoint && !query.samePoint(firstPoint, lastPoint)) {
1460
+ if (options.closeShape && firstPoint && lastPoint && !helpers.samePoint(firstPoint, lastPoint)) {
1463
1461
  curves.push(Blueprint.make2dSegmentCurve(lastPoint, firstPoint));
1464
1462
  }
1465
1463
  return new Drawing(new Blueprint.Blueprint(curves));
@@ -1474,7 +1472,7 @@ const drawParametricFunction = (func, { pointsCount = 400, start = 0, stop = 1,
1474
1472
  const edgesToDrawing = (edges) => {
1475
1473
  const [r, gc] = shapeTypes.localGC();
1476
1474
  const planeSketch = drawRectangle(1e3, 1e3).sketchOnPlane();
1477
- const planeFace = r(errors.unwrap(shapeHelpers.makeFace(planeSketch.wire)));
1475
+ const planeFace = r(errors.unwrap(Blueprint.makeFace(planeSketch.wire)));
1478
1476
  const curves = edges.map((e) => Blueprint.edgeToCurve(e, planeFace));
1479
1477
  gc();
1480
1478
  const stitchedCurves = stitchCurves(curves).map((s) => new Blueprint.Blueprint(s));
@@ -1499,7 +1497,7 @@ function drawFaceOutline(face) {
1499
1497
  const [r, gc] = shapeTypes.localGC();
1500
1498
  const clonedFace = r(shapeTypes.createFace(errors.unwrap(cast.downcast(face.wrapped))));
1501
1499
  const faceOuterWire = r(faceFns.outerWire(clonedFace));
1502
- const curves = shapeFns.getEdges(faceOuterWire).map((e) => Blueprint.edgeToCurve(e, face));
1500
+ const curves = curveFns.getEdges(faceOuterWire).map((e) => Blueprint.edgeToCurve(e, face));
1503
1501
  gc();
1504
1502
  const stitchedCurves = stitchCurves(curves).map((s) => new Blueprint.Blueprint(s));
1505
1503
  if (stitchedCurves.length === 0) return new Drawing();
@@ -1,19 +1,19 @@
1
1
  import { u as unwrap, g as isOk, e as err, x as validationError, l as ok } from "./errors-wGhcJMpB.js";
2
- import { m as makeLine, x as makeThreePointArc, v as makeTangentArc, l as makeEllipseArc, e as makeBezierCurve, a as assembleWire, h as makeCompound, d as addHolesInFace, s as makeSolid, o as makeFace, g as makeCircle, k as makeEllipse, b as makeHelix, f as makeBSplineApproximation } from "./shapeHelpers-BcoZf2N9.js";
3
- import { r as resolvePlane, b as planeToWorld, d as planeToLocal } from "./vectors-CBuaMeZv.js";
4
- import { g as getKernel, a as toVec3, c as makeOcAx2 } from "./occtBoundary-CwegMzqc.js";
2
+ import { r as resolvePlane, b as planeToWorld, d as planeToLocal } from "./vectors-DWLjb9-P.js";
3
+ import { g as getKernel, a as toVec3, m as makeOcAx2 } from "./occtBoundary-DYsksDtE.js";
5
4
  import { n as vecScale, j as vecNormalize, v as vecAdd, o as vecSub, b as vecCross, m as vecRotate, R as RAD2DEG, g as vecLength, e as vecEquals, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
6
- import { h as Flatbush, j as convertSvgEllipseParams, k as defaultsSplineOptions, S as Sketch, r as roundedRectangleBlueprint, b as Blueprints, C as CompoundBlueprint, c as cut2D, l as intersectCurves, f as fuse2D, m as make2dOffset, n as filletCurves, q as chamferCurves, o as organiseBlueprints, a as BlueprintSketcher, i as intersect2D, B as BaseSketcher2d, p as polysidesBlueprint } from "./boolean2D-hOw5Qay5.js";
7
- import { f as faceCenter, n as normalAt, o as outerWire } from "./faceFns-DHu-2JpA.js";
8
- import { a as curveTangentAt, d as curveEndPoint, l as getCurveType, o as offsetWire2D } from "./curveFns-CdVE4da7.js";
9
- import { s as createWire, o as localGC, q as createFace, e as isFace, n as gcWithScope, c as castShape } from "./shapeTypes-BlSElW8z.js";
10
- import { d as downcast, c as cast } from "./cast-DQaUibmm.js";
11
- import { n as mirror, B as Blueprint, C as Curve2D, c as make2dSegmentCurve, g as make2dArcFromCenter, o as approximateAsSvgCompatibleCurve, a as BoundingBox2d, p as edgeToCurve, q as make2dInerpolatedBSplineCurve, e as make2dCircle, s as make2dEllipse, t as deserializeCurve2D } from "./Blueprint-D3JfGJTz.js";
5
+ import { h as Flatbush, j as convertSvgEllipseParams, k as defaultsSplineOptions, S as Sketch, r as roundedRectangleBlueprint, b as Blueprints, C as CompoundBlueprint, c as cut2D, l as intersectCurves, f as fuse2D, m as make2dOffset, n as filletCurves, q as chamferCurves, o as organiseBlueprints, a as BlueprintSketcher, i as intersect2D, B as BaseSketcher2d, p as polysidesBlueprint } from "./boolean2D-BnZKKBWU.js";
6
+ import { f as faceCenter, n as normalAt, o as outerWire } from "./faceFns-CyokaCDr.js";
7
+ import { l as curveTangentAt, o as curveEndPoint, C as getCurveType, a as getEdges, K as offsetWire2D } from "./curveFns-Cg99XKe2.js";
8
+ import { m as makeLine, i as makeThreePointArc, h as makeTangentArc, g as makeEllipseArc, c as makeBezierCurve, a as assembleWire, e as makeCircle, f as makeEllipse, b as makeHelix, d as makeBSplineApproximation } from "./curveBuilders-U26XDfxg.js";
9
+ import { n as createWire, t as localGC, u as createFace, e as isFace, p as gcWithScope, c as castShape } from "./shapeTypes-i7VwMRwc.js";
10
+ import { d as downcast, c as cast } from "./cast-BEg1mN7n.js";
11
+ import { h as mirror, a as addHolesInFace, m as makeFace, B as Blueprint, C as Curve2D, i as make2dSegmentCurve, j as make2dArcFromCenter, k as approximateAsSvgCompatibleCurve, e as BoundingBox2d, l as edgeToCurve, n as make2dInerpolatedBSplineCurve, o as make2dCircle, p as make2dEllipse, q as deserializeCurve2D } from "./Blueprint-DnAO3gr5.js";
12
12
  import { bug } from "./result.js";
13
- import { i as distance2d, k as polarAngle2d, p as polarToCartesian, l as PRECISION_OFFSET, m as squareDistance2d, s as samePoint$1, a as subtract2d, b as add2d, c as cornerFinder } from "./query-V6nV-VfL.js";
14
- import { g as getEdges } from "./shapeFns-BrF97sKt.js";
15
- import { b as basicFaceExtrusion, r as revolution, c as complexExtrude, t as twistExtrude } from "./loft-CtG5nMq5.js";
13
+ import { d as distance2d, p as polarAngle2d, b as polarToCartesian, P as PRECISION_OFFSET, e as squareDistance2d, s as samePoint$1, h as subtract2d, i as add2d } from "./helpers-CRx_ks-u.js";
14
+ import { m as makeCompound, i as basicFaceExtrusion, r as revolution, e as makeSolid, k as complexExtrude, t as twistExtrude } from "./loft-jIkZRqHm.js";
16
15
  import opentype from "opentype.js";
16
+ import { c as cornerFinder } from "./cornerFinder-89obDwGi.js";
17
17
  const stitchCurves = (curves, precision = 1e-7) => {
18
18
  const startPoints = new Flatbush(curves.length);
19
19
  curves.forEach((c) => {
@@ -228,7 +228,6 @@ class Sketcher {
228
228
  }
229
229
  /** Draw an elliptical arc to an absolute end point (SVG-style parameters). */
230
230
  ellipseTo(end, horizontalRadius, verticalRadius, rotation = 0, longAxis = false, sweep = false) {
231
- const [, gc] = localGC();
232
231
  const [startX, startY] = planeToLocal(this.plane, this.pointer);
233
232
  let rotationAngle = rotation;
234
233
  let majorRadius = horizontalRadius;
@@ -264,7 +263,6 @@ class Sketcher {
264
263
  }
265
264
  this.pendingEdges.push(arc);
266
265
  this._updatePointer(planeToWorld(this.plane, end));
267
- gc();
268
266
  return this;
269
267
  }
270
268
  /** Draw an elliptical arc to a relative end point (SVG-style parameters). */
@@ -1,7 +1,7 @@
1
- import { g as getKernel, a as toVec3, d as toOcPnt } from "./occtBoundary-CwegMzqc.js";
2
- import { c as castShape, n as gcWithScope } from "./shapeTypes-BlSElW8z.js";
1
+ import { g as getKernel, a as toVec3, b as toOcPnt } from "./occtBoundary-DYsksDtE.js";
2
+ import { c as castShape, p as gcWithScope } from "./shapeTypes-i7VwMRwc.js";
3
3
  import { u as unwrap, e as err, p as typeCastError, l as ok } from "./errors-wGhcJMpB.js";
4
- import { i as iterTopo, d as downcast } from "./cast-DQaUibmm.js";
4
+ import { i as iterTopo, d as downcast } from "./cast-BEg1mN7n.js";
5
5
  function getSurfaceType(face) {
6
6
  const oc = getKernel().oc;
7
7
  const r = gcWithScope();
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
- const occtBoundary = require("./occtBoundary-du8_ex-p.cjs");
3
- const shapeTypes = require("./shapeTypes-DKhwEnUM.cjs");
2
+ const occtBoundary = require("./occtBoundary-DHtzU4tz.cjs");
3
+ const shapeTypes = require("./shapeTypes-b_lhwQB7.cjs");
4
4
  const errors = require("./errors-DK1VAdP4.cjs");
5
- const cast = require("./cast-DkB0GKmQ.cjs");
5
+ const cast = require("./cast-CqDc8oFW.cjs");
6
6
  function getSurfaceType(face) {
7
7
  const oc = occtBoundary.getKernel().oc;
8
8
  const r = shapeTypes.gcWithScope();