brepjs 12.8.0 → 12.8.1

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 (70) hide show
  1. package/dist/2d/blueprints/boolean2D.d.ts.map +1 -1
  2. package/dist/2d/blueprints/lib.d.ts.map +1 -1
  3. package/dist/2d/blueprints/offset.d.ts.map +1 -1
  4. package/dist/2d.cjs +2 -2
  5. package/dist/2d.js +3 -3
  6. package/dist/{Blueprint-CnDVffSX.cjs → Blueprint-CQ28WJhz.cjs} +29 -30
  7. package/dist/{Blueprint-C3lWY1Jf.js → Blueprint-DbVaf6k7.js} +7 -8
  8. package/dist/{boolean2D-DyQJt8Na.cjs → boolean2D-0blbVtJ8.cjs} +70 -61
  9. package/dist/{boolean2D-CwZAIJDS.js → boolean2D-y3E92F0u.js} +37 -28
  10. package/dist/{booleanFns-CcNUsgI8.js → booleanFns-BCTjYZAg.js} +4 -4
  11. package/dist/{booleanFns-D7HmkpYt.cjs → booleanFns-gmsX3Cv2.cjs} +59 -59
  12. package/dist/brepjs.cjs +304 -305
  13. package/dist/brepjs.js +343 -344
  14. package/dist/core/errors.d.ts +14 -5
  15. package/dist/core/errors.d.ts.map +1 -1
  16. package/dist/core.cjs +30 -31
  17. package/dist/core.js +19 -20
  18. package/dist/{cornerFinder-BV-l1BCw.js → cornerFinder-Ckz-mPHE.js} +1 -1
  19. package/dist/{cornerFinder-3zfbQvXg.cjs → cornerFinder-ZmOyOOsh.cjs} +1 -1
  20. package/dist/{curveFns-Ch87sD5O.cjs → curveFns-BZngcnQ1.cjs} +17 -17
  21. package/dist/{curveFns-CloOqAQ_.js → curveFns-mROFhiuG.js} +1 -1
  22. package/dist/{drawFns-5myJTgtX.js → drawFns-Bwakrq7w.js} +24 -25
  23. package/dist/{drawFns-CDNafQhv.cjs → drawFns-CjRc1NfQ.cjs} +51 -52
  24. package/dist/{faceFns-B6ebRh5I.js → faceFns-B8GnxjdY.js} +1 -1
  25. package/dist/{faceFns-BLTEPBKq.cjs → faceFns-DB1Fc5gy.cjs} +20 -20
  26. package/dist/{helpers-6kn30cSD.cjs → helpers-C8NoT0Wu.cjs} +14 -14
  27. package/dist/{helpers-C9KvE1RW.js → helpers-X0juxnwj.js} +4 -4
  28. package/dist/io.cjs +26 -26
  29. package/dist/io.js +3 -3
  30. package/dist/kernel/brepkitAdapter.d.ts +8 -8
  31. package/dist/kernel/brepkitAdapter.d.ts.map +1 -1
  32. package/dist/kernel/historyOps.d.ts +3 -3
  33. package/dist/kernel/historyOps.d.ts.map +1 -1
  34. package/dist/kernel/types.d.ts +8 -8
  35. package/dist/kernel/types.d.ts.map +1 -1
  36. package/dist/{loft-BcZUCGKi.js → loft-Bhw-FMoL.js} +4 -4
  37. package/dist/{loft-DR1UN5uN.cjs → loft-hp3pc1M7.cjs} +43 -43
  38. package/dist/{measurement-DoYXRaKI.cjs → measurement-BoNTUBAp.cjs} +1 -1
  39. package/dist/{measurement-oWvhSVZG.js → measurement-D8EJ694A.js} +1 -1
  40. package/dist/measurement.cjs +1 -1
  41. package/dist/measurement.js +1 -1
  42. package/dist/{meshFns-3gy0empP.cjs → meshFns-BnV0ZR8w.cjs} +17 -17
  43. package/dist/{meshFns-DsLRd3tA.js → meshFns-nQjK38EC.js} +2 -2
  44. package/dist/{operations-Dcz6YlOt.js → operations-BfbkK6DU.js} +5 -5
  45. package/dist/{operations-DLFzmdFX.cjs → operations-CYpmLSC4.cjs} +75 -75
  46. package/dist/operations.cjs +2 -2
  47. package/dist/operations.js +2 -2
  48. package/dist/query.cjs +3 -3
  49. package/dist/query.js +4 -4
  50. package/dist/{errors-B7kgv0cd.js → result-BaSD1fqR.js} +43 -23
  51. package/dist/{errors-9fDehDNc.cjs → result-fAX0OZzI.cjs} +20 -0
  52. package/dist/result.cjs +30 -41
  53. package/dist/result.js +18 -29
  54. package/dist/{shapeFns-D-MOoqJd.cjs → shapeFns-C2SnNvdH.cjs} +39 -39
  55. package/dist/{shapeFns-D2PlLFE6.js → shapeFns-FDuKkrDR.js} +4 -4
  56. package/dist/sketching.cjs +2 -2
  57. package/dist/sketching.js +2 -2
  58. package/dist/{solidBuilders-BzfRBizW.cjs → solidBuilders-994_MQwB.cjs} +12 -12
  59. package/dist/{solidBuilders-BXhh5hP2.js → solidBuilders-DmwhTCCd.js} +2 -2
  60. package/dist/{surfaceBuilders-Be_ENWSA.cjs → surfaceBuilders-5VA34a3_.cjs} +27 -27
  61. package/dist/{surfaceBuilders-D6iDVPIM.js → surfaceBuilders-nQdJ56fe.js} +2 -2
  62. package/dist/{topology-CKtCGLmb.cjs → topology-ANwCzGL8.cjs} +54 -54
  63. package/dist/{topology-DxD58iQ6.js → topology-C7x98OVn.js} +8 -8
  64. package/dist/topology.cjs +6 -6
  65. package/dist/topology.js +6 -6
  66. package/dist/{vectors-CESkzEm6.js → vectors-Bx8wkNui.js} +1 -1
  67. package/dist/{vectors-BafmMf96.cjs → vectors-D_IiZx0q.cjs} +6 -6
  68. package/dist/vectors.cjs +1 -1
  69. package/dist/vectors.js +1 -1
  70. package/package.json +3 -6
@@ -1 +1 @@
1
- {"version":3,"file":"boolean2D.d.ts","sourceRoot":"","sources":["../../../src/2d/blueprints/boolean2D.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAMvD;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,IAAI,CAAC;AA2LxE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,MAAM,GACjB,OAAO,OAAO,EACd,QAAQ,OAAO,KACd,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,IAoD/C,CAAC;AAcF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,KAAK,GAChB,OAAO,OAAO,EACd,QAAQ,OAAO,KACd,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,IA8C/C,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,OAAO,GACd,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,IAAI,CAwDnD"}
1
+ {"version":3,"file":"boolean2D.d.ts","sourceRoot":"","sources":["../../../src/2d/blueprints/boolean2D.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAMvD;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,IAAI,CAAC;AAyLxE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,MAAM,GACjB,OAAO,OAAO,EACd,QAAQ,OAAO,KACd,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,IAmD/C,CAAC;AAaF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,KAAK,GAChB,OAAO,OAAO,EACd,QAAQ,OAAO,KACd,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,IA2C/C,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,OAAO,GACd,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,IAAI,CAoDnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../../src/2d/blueprints/lib.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,KAAK,EAAE,KAA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;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,YAAY,GAAE,cAAmB,GAChC,OAAO,CAmGT;AAUD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAC5B,EAAE,EAAE,OAAO,EACX,cAAc,EAAE,MAAM,EACtB,YAAY,GAAE,cAAmB,GAChC,OAAO,CAeT"}
package/dist/2d.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const Blueprint = require("./Blueprint-CnDVffSX.cjs");
4
- const boolean2D = require("./boolean2D-DyQJt8Na.cjs");
3
+ const Blueprint = require("./Blueprint-CQ28WJhz.cjs");
4
+ const boolean2D = require("./boolean2D-0blbVtJ8.cjs");
5
5
  function reverseCurve(curve) {
6
6
  const cloned = curve.clone();
7
7
  cloned.reverse();
package/dist/2d.js CHANGED
@@ -1,6 +1,6 @@
1
- import { B as Blueprint } from "./Blueprint-C3lWY1Jf.js";
2
- import { e, C } from "./Blueprint-C3lWY1Jf.js";
3
- import { c, C as C2, d, j, f, k, h, l, o, p, r } from "./boolean2D-CwZAIJDS.js";
1
+ import { B as Blueprint } from "./Blueprint-DbVaf6k7.js";
2
+ import { e, C } from "./Blueprint-DbVaf6k7.js";
3
+ import { c, C as C2, d, j, f, k, h, l, o, p, r } from "./boolean2D-y3E92F0u.js";
4
4
  function reverseCurve(curve) {
5
5
  const cloned = curve.clone();
6
6
  cloned.reverse();
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
- const vectors = require("./vectors-BafmMf96.cjs");
2
+ const vectors = require("./vectors-D_IiZx0q.cjs");
3
3
  const types = require("./types-CA_xrgDq.cjs");
4
4
  const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
5
- const faceFns = require("./faceFns-BLTEPBKq.cjs");
6
- const curveFns = require("./curveFns-Ch87sD5O.cjs");
7
- const errors = require("./errors-9fDehDNc.cjs");
8
- const helpers = require("./helpers-6kn30cSD.cjs");
5
+ const faceFns = require("./faceFns-DB1Fc5gy.cjs");
6
+ const curveFns = require("./curveFns-BZngcnQ1.cjs");
7
+ const result = require("./result-fAX0OZzI.cjs");
8
+ const helpers = require("./helpers-C8NoT0Wu.cjs");
9
9
  const vecOps = require("./vecOps-CjRL1jau.cjs");
10
- const surfaceBuilders = require("./surfaceBuilders-Be_ENWSA.cjs");
11
- const result = require("./result.cjs");
10
+ const surfaceBuilders = require("./surfaceBuilders-5VA34a3_.cjs");
12
11
  function makePlane(plane, origin) {
13
12
  if (plane && typeof plane !== "string") {
14
13
  return { ...plane };
@@ -34,7 +33,7 @@ function mirror(shape, inputPlane, origin) {
34
33
  originVec = plane.origin;
35
34
  directionVec = plane.zDir;
36
35
  }
37
- const newShape = shapeTypes.getKernel().mirror(shape, [...originVec], [...directionVec]);
36
+ const newShape = shapeTypes.getKernel().mirror(shape, originVec, directionVec);
38
37
  return newShape;
39
38
  }
40
39
  function isPoint2D(point) {
@@ -288,19 +287,19 @@ class Curve2D {
288
287
  lowerDistance = proj.distance;
289
288
  lowerDistanceParameter = proj.param;
290
289
  } catch {
291
- if (helpers.samePoint(point, this.firstPoint, precision)) return errors.ok(this.firstParameter);
292
- if (helpers.samePoint(point, this.lastPoint, precision)) return errors.ok(this.lastParameter);
293
- return errors.err(errors.computationError("PARAMETER_NOT_FOUND", "Failed to find parameter"));
290
+ if (helpers.samePoint(point, this.firstPoint, precision)) return result.ok(this.firstParameter);
291
+ if (helpers.samePoint(point, this.lastPoint, precision)) return result.ok(this.lastParameter);
292
+ return result.err(result.computationError("PARAMETER_NOT_FOUND", "Failed to find parameter"));
294
293
  }
295
294
  if (lowerDistance > precision) {
296
- return errors.err(
297
- errors.computationError(
295
+ return result.err(
296
+ result.computationError(
298
297
  "POINT_NOT_ON_CURVE",
299
298
  `Point ${reprPnt(point)} not on curve ${this.repr}, ${lowerDistance.toFixed(9)}`
300
299
  )
301
300
  );
302
301
  }
303
- return errors.ok(lowerDistanceParameter);
302
+ return result.ok(lowerDistanceParameter);
304
303
  }
305
304
  /**
306
305
  * Compute the tangent vector at a parameter position or at the projection of a point.
@@ -310,14 +309,14 @@ class Curve2D {
310
309
  tangentAt(index) {
311
310
  let param;
312
311
  if (Array.isArray(index)) {
313
- param = errors.unwrap(this.parameter(index));
312
+ param = result.unwrap(this.parameter(index));
314
313
  } else {
315
314
  const bounds = shapeTypes.getKernel().getCurve2dBounds(this.wrapped);
316
315
  const paramLength = bounds.last - bounds.first;
317
316
  param = paramLength * index + bounds.first;
318
317
  }
319
- const result2 = shapeTypes.getKernel().evaluateCurve2dD1(this.wrapped, param);
320
- return result2.tangent;
318
+ const result$1 = shapeTypes.getKernel().evaluateCurve2dD1(this.wrapped, param);
319
+ return result$1.tangent;
321
320
  }
322
321
  /**
323
322
  * Split this curve at the given points or parameter values.
@@ -326,7 +325,7 @@ class Curve2D {
326
325
  */
327
326
  splitAt(points, precision = 1e-9) {
328
327
  let parameters = points.map((point) => {
329
- if (isPoint2D(point)) return errors.unwrap(this.parameter(point, precision));
328
+ if (isPoint2D(point)) return result.unwrap(this.parameter(point, precision));
330
329
  return point;
331
330
  });
332
331
  parameters = Array.from(
@@ -503,9 +502,9 @@ function make2dInerpolatedBSplineCurve(points, {
503
502
  degMin,
504
503
  continuity: "C2"
505
504
  });
506
- return errors.ok(new Curve2D(handle));
505
+ return result.ok(new Curve2D(handle));
507
506
  } catch {
508
- return errors.err(errors.computationError("BSPLINE_2D_FAILED", "B-spline approximation failed"));
507
+ return result.err(result.computationError("BSPLINE_2D_FAILED", "B-spline approximation failed"));
509
508
  }
510
509
  }
511
510
  const make2dArcFromCenter = (startPoint, endPoint, center, longArc = false) => {
@@ -629,16 +628,16 @@ function curvesAsEdgesOnFace(curves, face, scale = "original") {
629
628
  let transformation = null;
630
629
  if (scale === "original" && faceFns.faceGeomType(face) !== "PLANE") {
631
630
  if (faceFns.faceGeomType(face) !== "CYLINDRE")
632
- return errors.err(
633
- errors.validationError(
631
+ return result.err(
632
+ result.validationError(
634
633
  "UNSUPPORTED_FACE_TYPE",
635
634
  "Only planar and cylindrical faces can be unwrapped for sketching"
636
635
  )
637
636
  );
638
637
  const cylData = kernel.getSurfaceCylinderData(geomSurf);
639
638
  if (!cylData) {
640
- return errors.err(
641
- errors.validationError(
639
+ return result.err(
640
+ result.validationError(
642
641
  "UNSUPPORTED_FACE_TYPE",
643
642
  "Could not extract cylinder data from face surface"
644
643
  )
@@ -678,7 +677,7 @@ function curvesAsEdgesOnFace(curves, face, scale = "original") {
678
677
  const modifiedCurves = transformCurves(curves, transformation);
679
678
  const edges = curvesAsEdgesOnSurface(modifiedCurves, geomSurf);
680
679
  if (transformation) transformation.delete();
681
- return errors.ok(edges);
680
+ return result.ok(edges);
682
681
  }
683
682
  function edgeToCurve(e, face) {
684
683
  const kernel = shapeTypes.getKernel();
@@ -844,7 +843,7 @@ class Blueprint {
844
843
  */
845
844
  sketchOnFace(face, scaleMode) {
846
845
  const kernel = shapeTypes.getKernel();
847
- const edges = errors.unwrap(curvesAsEdgesOnFace(this.curves, face, scaleMode));
846
+ const edges = result.unwrap(curvesAsEdgesOnFace(this.curves, face, scaleMode));
848
847
  const wire = assembleWire(edges);
849
848
  kernel.buildCurves3d(wire.wrapped);
850
849
  kernel.fixWireOnFace(wire.wrapped, face.wrapped, 1e-9);
@@ -861,7 +860,7 @@ class Blueprint {
861
860
  const originPoint = origin || [...faceFns.faceCenter(face)];
862
861
  const originVec3 = types.toVec3(originPoint);
863
862
  const sketch = this.translate(faceFns.uvCoordinates(face, originVec3)).sketchOnFace(face, "original");
864
- return errors.unwrap(surfaceBuilders.makeFace(sketch.wire));
863
+ return result.unwrap(surfaceBuilders.makeFace(sketch.wire));
865
864
  }
866
865
  /**
867
866
  * Cut a prism-shaped hole through a solid along a face using this blueprint.
@@ -879,9 +878,9 @@ class Blueprint {
879
878
  origin = null,
880
879
  draftAngle = 0
881
880
  } = {}) {
882
- const foundFace = errors.unwrap(helpers.getSingleFace(face, shape));
881
+ const foundFace = result.unwrap(helpers.getSingleFace(face, shape));
883
882
  const hole = this.subFace(foundFace, origin);
884
- const result2 = shapeTypes.getKernel().draftPrism(
883
+ const result$1 = shapeTypes.getKernel().draftPrism(
885
884
  shape.wrapped,
886
885
  hole.wrapped,
887
886
  foundFace.wrapped,
@@ -889,7 +888,7 @@ class Blueprint {
889
888
  draftAngle,
890
889
  false
891
890
  );
892
- return errors.unwrap(faceFns.cast(result2));
891
+ return result.unwrap(faceFns.cast(result$1));
893
892
  }
894
893
  /** Convert the blueprint to an SVG path `d` attribute string. */
895
894
  toSVGPathD() {
@@ -1,13 +1,12 @@
1
- import { r as resolvePlane } from "./vectors-CESkzEm6.js";
1
+ import { r as resolvePlane } from "./vectors-Bx8wkNui.js";
2
2
  import { a as toVec3 } from "./types-CWDdqcrq.js";
3
3
  import { B as getKernel, J as getKernel2D, K as registerForCleanup, L as unregisterFromCleanup, H as createEdge, G as createWire } from "./shapeTypes-CpSaBLDv.js";
4
- import { u as uvBounds, f as faceGeomType, e as faceCenter, h as uvCoordinates, c as cast } from "./faceFns-B6ebRh5I.js";
5
- import { g as getOrientation } from "./curveFns-CloOqAQ_.js";
6
- import { o as ok, e as err, b as computationError, r as unwrap, y as validationError } from "./errors-B7kgv0cd.js";
7
- import { d as distance2d, s as samePoint, b as scalarMultiply2d, c as add2d, e as subtract2d, g as getSingleFace } from "./helpers-C9KvE1RW.js";
4
+ import { u as uvBounds, f as faceGeomType, e as faceCenter, h as uvCoordinates, c as cast } from "./faceFns-B8GnxjdY.js";
5
+ import { g as getOrientation } from "./curveFns-mROFhiuG.js";
6
+ import { b as bug, o as ok, e as err, d as computationError, v as unwrap, z as validationError } from "./result-BaSD1fqR.js";
7
+ import { d as distance2d, s as samePoint, b as scalarMultiply2d, c as add2d, e as subtract2d, g as getSingleFace } from "./helpers-X0juxnwj.js";
8
8
  import { R as RAD2DEG, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
9
- import { m as makeFace } from "./surfaceBuilders-D6iDVPIM.js";
10
- import { bug } from "./result.js";
9
+ import { m as makeFace } from "./surfaceBuilders-nQdJ56fe.js";
11
10
  function makePlane(plane, origin) {
12
11
  if (plane && typeof plane !== "string") {
13
12
  return { ...plane };
@@ -33,7 +32,7 @@ function mirror(shape, inputPlane, origin) {
33
32
  originVec = plane.origin;
34
33
  directionVec = plane.zDir;
35
34
  }
36
- const newShape = getKernel().mirror(shape, [...originVec], [...directionVec]);
35
+ const newShape = getKernel().mirror(shape, originVec, directionVec);
37
36
  return newShape;
38
37
  }
39
38
  function isPoint2D(point) {
@@ -44,21 +44,20 @@ var __callDispose = (stack, error, hasError) => {
44
44
  };
45
45
  return next();
46
46
  };
47
- const vectors = require("./vectors-BafmMf96.cjs");
48
- const errors = require("./errors-9fDehDNc.cjs");
49
- const faceFns = require("./faceFns-BLTEPBKq.cjs");
47
+ const vectors = require("./vectors-D_IiZx0q.cjs");
48
+ const result = require("./result-fAX0OZzI.cjs");
49
+ const faceFns = require("./faceFns-DB1Fc5gy.cjs");
50
50
  const types = require("./types-CA_xrgDq.cjs");
51
51
  const vecOps = require("./vecOps-CjRL1jau.cjs");
52
- const loft = require("./loft-DR1UN5uN.cjs");
52
+ const loft = require("./loft-hp3pc1M7.cjs");
53
53
  const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
54
- const curveFns = require("./curveFns-Ch87sD5O.cjs");
55
- const surfaceBuilders = require("./surfaceBuilders-Be_ENWSA.cjs");
56
- const result = require("./result.cjs");
57
- const helpers = require("./helpers-6kn30cSD.cjs");
58
- const Blueprint = require("./Blueprint-CnDVffSX.cjs");
54
+ const curveFns = require("./curveFns-BZngcnQ1.cjs");
55
+ const surfaceBuilders = require("./surfaceBuilders-5VA34a3_.cjs");
56
+ const helpers = require("./helpers-C8NoT0Wu.cjs");
57
+ const Blueprint = require("./Blueprint-CQ28WJhz.cjs");
59
58
  const intersectCurves = (first, second, precision = 1e-9) => {
60
59
  if (first.boundingBox.isOut(second.boundingBox))
61
- return errors.ok({ intersections: [], commonSegments: [], commonSegmentsPoints: [] });
60
+ return result.ok({ intersections: [], commonSegments: [], commonSegmentsPoints: [] });
62
61
  const kernel = shapeTypes.getKernel2D();
63
62
  let intersections;
64
63
  let commonSegments;
@@ -67,7 +66,7 @@ const intersectCurves = (first, second, precision = 1e-9) => {
67
66
  intersections = result2.points;
68
67
  commonSegments = result2.segments.map((h) => new Blueprint.Curve2D(h));
69
68
  } catch (e) {
70
- return errors.err(errors.computationError("INTERSECTION_FAILED", "Intersections failed between curves", e));
69
+ return result.err(result.computationError("INTERSECTION_FAILED", "Intersections failed between curves", e));
71
70
  }
72
71
  const segmentsAsPoints = commonSegments.filter((c) => helpers.samePoint(c.firstPoint, c.lastPoint, precision)).map((c) => c.firstPoint);
73
72
  if (segmentsAsPoints.length) {
@@ -75,7 +74,7 @@ const intersectCurves = (first, second, precision = 1e-9) => {
75
74
  commonSegments = commonSegments.filter((c) => !helpers.samePoint(c.firstPoint, c.lastPoint, precision));
76
75
  }
77
76
  const commonSegmentsPoints = commonSegments.flatMap((c) => [c.firstPoint, c.lastPoint]);
78
- return errors.ok({ intersections, commonSegments, commonSegmentsPoints });
77
+ return result.ok({ intersections, commonSegments, commonSegmentsPoints });
79
78
  };
80
79
  const selfIntersections = (curve, precision = 1e-9) => {
81
80
  const kernel = shapeTypes.getKernel2D();
@@ -87,9 +86,9 @@ const selfIntersections = (curve, precision = 1e-9) => {
87
86
  seg.delete();
88
87
  }
89
88
  } catch (e) {
90
- return errors.err(errors.computationError("SELF_INTERSECTION_FAILED", "Self intersection failed", e));
89
+ return result.err(result.computationError("SELF_INTERSECTION_FAILED", "Self intersection failed", e));
91
90
  }
92
- return errors.ok(intersections);
91
+ return result.ok(intersections);
93
92
  };
94
93
  const offsetEndPoints = (firstPoint, lastPoint, offset) => {
95
94
  const tangent = Blueprint.normalize2d(helpers.subtract2d(lastPoint, firstPoint));
@@ -139,7 +138,7 @@ const make2dOffset = (curve, offset) => {
139
138
  const offsetHandle = kernel.offsetCurve2d(curve.wrapped, offset);
140
139
  const offsetCurve = new Blueprint.Curve2D(offsetHandle);
141
140
  const approximation = Blueprint.approximateAsBSpline(offsetCurve);
142
- const selfIntersects = errors.unwrap(selfIntersections(approximation));
141
+ const selfIntersects = result.unwrap(selfIntersections(approximation));
143
142
  if (selfIntersects.length) {
144
143
  return {
145
144
  collapsed: true,
@@ -160,7 +159,7 @@ function removeCorner(firstCurve, secondCurve, radius) {
160
159
  return null;
161
160
  }
162
161
  const intersectionResult = intersectCurves(firstOffset, secondOffset, 1e-9);
163
- if (!errors.isOk(intersectionResult)) {
162
+ if (!result.isOk(intersectionResult)) {
164
163
  return null;
165
164
  }
166
165
  const potentialCenter = intersectionResult.value.intersections.at(-1);
@@ -172,7 +171,7 @@ function removeCorner(firstCurve, secondCurve, radius) {
172
171
  const [x, y] = offsetCurve.tangentAt(center);
173
172
  const normal = Blueprint.normalize2d([-y, x]);
174
173
  const splitPoint = helpers.add2d(center, helpers.scalarMultiply2d(normal, offset));
175
- const splitParam = errors.unwrap(curve.parameter(splitPoint, 1e-6));
174
+ const splitParam = result.unwrap(curve.parameter(splitPoint, 1e-6));
176
175
  return curve.splitAt([splitParam]);
177
176
  };
178
177
  const [first] = splitForFillet(firstCurve, firstOffset);
@@ -209,7 +208,7 @@ function dogboneFilletCurves(firstCurve, secondCurve, radius) {
209
208
  return [firstCurve, secondCurve];
210
209
  }
211
210
  const intersectionResult2 = intersectCurves(firstOffset, secondOffset, 1e-9);
212
- if (!errors.isOk(intersectionResult2)) {
211
+ if (!result.isOk(intersectionResult2)) {
213
212
  return [firstCurve, secondCurve];
214
213
  }
215
214
  const potentialCenter = intersectionResult2.value.intersections.at(-1);
@@ -217,8 +216,8 @@ function dogboneFilletCurves(firstCurve, secondCurve, radius) {
217
216
  return [firstCurve, secondCurve];
218
217
  }
219
218
  const circle = Blueprint.make2dCircle(radius, potentialCenter);
220
- const firstInt = errors.unwrap(intersectCurves(firstCurve, circle)).intersections[0];
221
- const secondInt = errors.unwrap(intersectCurves(secondCurve, circle)).intersections.at(-1);
219
+ const firstInt = result.unwrap(intersectCurves(firstCurve, circle)).intersections[0];
220
+ const secondInt = result.unwrap(intersectCurves(secondCurve, circle)).intersections.at(-1);
222
221
  if (!firstInt || !secondInt) return [firstCurve, secondCurve];
223
222
  const firstPart = firstCurve.splitAt([firstInt])[0];
224
223
  const secondPart = secondCurve.splitAt([secondInt]).at(-1);
@@ -864,7 +863,7 @@ class Blueprints {
864
863
  }
865
864
  const groupByBoundingBoxOverlap = (blueprints) => {
866
865
  if (blueprints.length === 0) return [];
867
- if (blueprints.length === 1) return [[blueprints[0]]];
866
+ if (blueprints.length === 1) return [[result.safeIndex(blueprints, 0, "groupByBoundingBoxOverlap")]];
868
867
  const index = new Flatbush(blueprints.length);
869
868
  for (const bp of blueprints) {
870
869
  const [[xMin, yMin], [xMax, yMax]] = bp.boundingBox.bounds;
@@ -875,8 +874,9 @@ const groupByBoundingBoxOverlap = (blueprints) => {
875
874
  const [[xMin, yMin], [xMax, yMax]] = blueprint.boundingBox.bounds;
876
875
  const candidates = index.search(xMin, yMin, xMax, yMax);
877
876
  return candidates.filter(
878
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- index from spatial query within bounds
879
- (j) => j > i && !blueprint.boundingBox.isOut(blueprints[j].boundingBox)
877
+ (j) => j > i && !blueprint.boundingBox.isOut(
878
+ result.safeIndex(blueprints, j, "groupByBoundingBoxOverlap").boundingBox
879
+ )
880
880
  );
881
881
  });
882
882
  const groups = [];
@@ -887,7 +887,7 @@ const groupByBoundingBoxOverlap = (blueprints) => {
887
887
  myGroup = [];
888
888
  groups.push(myGroup);
889
889
  }
890
- myGroup.push(blueprints[i]);
890
+ myGroup.push(result.safeIndex(blueprints, i, "groupByBoundingBoxOverlap"));
891
891
  if (indices.length) {
892
892
  indices.forEach((idx) => {
893
893
  groupsInOverlaps[idx] = myGroup;
@@ -898,7 +898,7 @@ const groupByBoundingBoxOverlap = (blueprints) => {
898
898
  };
899
899
  const addContainmentInfo = (groupedBlueprints) => {
900
900
  return groupedBlueprints.map((blueprint, index) => {
901
- const firstCurve = blueprint.curves[0];
901
+ const firstCurve = result.safeIndex(blueprint.curves, 0, "addContainmentInfo");
902
902
  const point = firstCurve.value((firstCurve.lastParameter + firstCurve.firstParameter) / 2);
903
903
  const isIn = groupedBlueprints.filter((potentialOuterBlueprint, j) => {
904
904
  if (index === j) return false;
@@ -942,7 +942,7 @@ const organiseBlueprints = (blueprints) => {
942
942
  const basicGrouping = groupByBoundingBoxOverlap(blueprints).map(addContainmentInfo);
943
943
  return new Blueprints(
944
944
  basicGrouping.flatMap(cleanEdgeCases).map((compounds) => {
945
- if (compounds.length === 1) return compounds[0].blueprint;
945
+ if (compounds.length === 1) return result.safeIndex(compounds, 0, "organiseBlueprints").blueprint;
946
946
  compounds.sort((a, b) => a.isIn.length - b.isIn.length);
947
947
  return new CompoundBlueprint(compounds.map(({ blueprint }) => blueprint));
948
948
  })
@@ -973,7 +973,7 @@ class Sketch {
973
973
  }
974
974
  set baseFace(newFace) {
975
975
  if (this._baseFace) this._baseFace.delete();
976
- this._baseFace = newFace ? shapeTypes.createFace(errors.unwrap(faceFns.downcast(newFace.wrapped))) : newFace;
976
+ this._baseFace = newFace ? shapeTypes.createFace(result.unwrap(faceFns.downcast(newFace.wrapped))) : newFace;
977
977
  }
978
978
  /** Release all kernel resources held by this sketch. */
979
979
  delete() {
@@ -982,11 +982,11 @@ class Sketch {
982
982
  }
983
983
  /** Create an independent deep copy of this sketch. */
984
984
  clone() {
985
- const sketch = new Sketch(shapeTypes.createWire(errors.unwrap(faceFns.downcast(this.wire.wrapped))), {
985
+ const sketch = new Sketch(shapeTypes.createWire(result.unwrap(faceFns.downcast(this.wire.wrapped))), {
986
986
  defaultOrigin: this.defaultOrigin,
987
987
  defaultDirection: this.defaultDirection
988
988
  });
989
- if (this.baseFace) sketch.baseFace = shapeTypes.createFace(errors.unwrap(faceFns.downcast(this.baseFace.wrapped)));
989
+ if (this.baseFace) sketch.baseFace = shapeTypes.createFace(result.unwrap(faceFns.downcast(this.baseFace.wrapped)));
990
990
  return sketch;
991
991
  }
992
992
  /** Get the 3D origin used as default for extrusion and revolution. */
@@ -1012,7 +1012,7 @@ class Sketch {
1012
1012
  let face;
1013
1013
  const closedWire = this.wire;
1014
1014
  if (!this.baseFace) {
1015
- face = errors.unwrap(surfaceBuilders.makeFace(closedWire));
1015
+ face = result.unwrap(surfaceBuilders.makeFace(closedWire));
1016
1016
  } else {
1017
1017
  face = surfaceBuilders.makeNewFaceWithinFace(this.baseFace, closedWire);
1018
1018
  }
@@ -1020,7 +1020,7 @@ class Sketch {
1020
1020
  }
1021
1021
  /** Return a clone of the underlying wire. */
1022
1022
  wires() {
1023
- return shapeTypes.createWire(errors.unwrap(faceFns.downcast(this.wire.wrapped)));
1023
+ return shapeTypes.createWire(result.unwrap(faceFns.downcast(this.wire.wrapped)));
1024
1024
  }
1025
1025
  /** Alias for {@link Sketch.face}. */
1026
1026
  faces() {
@@ -1031,8 +1031,8 @@ class Sketch {
1031
1031
  * (defaults to the sketch origin)
1032
1032
  */
1033
1033
  revolve(revolutionAxis, { origin } = {}) {
1034
- const face = errors.unwrap(surfaceBuilders.makeFace(this.wire));
1035
- const solid = errors.unwrap(loft.revolution(face, origin || this.defaultOrigin, revolutionAxis));
1034
+ const face = result.unwrap(surfaceBuilders.makeFace(this.wire));
1035
+ const solid = result.unwrap(loft.revolution(face, origin || this.defaultOrigin, revolutionAxis));
1036
1036
  face.delete();
1037
1037
  this.delete();
1038
1038
  return solid;
@@ -1057,20 +1057,20 @@ class Sketch {
1057
1057
  const extrusionVec = vecOps.vecScale(vecOps.vecNormalize(direction), extrusionDistance);
1058
1058
  const originVec = origin ? types.toVec3(origin) : this.defaultOrigin;
1059
1059
  if (extrusionProfile && !twistAngle) {
1060
- const solid2 = errors.unwrap(
1060
+ const solid2 = result.unwrap(
1061
1061
  loft.complexExtrude(this.wire, [...originVec], [...extrusionVec], extrusionProfile)
1062
1062
  );
1063
1063
  this.delete();
1064
1064
  return solid2;
1065
1065
  }
1066
1066
  if (twistAngle) {
1067
- const solid2 = errors.unwrap(
1067
+ const solid2 = result.unwrap(
1068
1068
  loft.twistExtrude(this.wire, twistAngle, [...originVec], [...extrusionVec], extrusionProfile)
1069
1069
  );
1070
1070
  this.delete();
1071
1071
  return solid2;
1072
1072
  }
1073
- const face = errors.unwrap(surfaceBuilders.makeFace(this.wire));
1073
+ const face = result.unwrap(surfaceBuilders.makeFace(this.wire));
1074
1074
  const solid = loft.basicFaceExtrusion(face, [...extrusionVec]);
1075
1075
  this.delete();
1076
1076
  return solid;
@@ -1095,7 +1095,7 @@ class Sketch {
1095
1095
  if (this.baseFace) {
1096
1096
  config.support = this.baseFace.wrapped;
1097
1097
  }
1098
- const shape = errors.unwrap(loft.genericSweep(sketch.wire, this.wire, config));
1098
+ const shape = result.unwrap(loft.genericSweep(sketch.wire, this.wire, config));
1099
1099
  this.delete();
1100
1100
  return shape;
1101
1101
  }
@@ -1110,7 +1110,7 @@ class Sketch {
1110
1110
  */
1111
1111
  loftWith(otherSketches, loftConfig = {}, returnShell = false) {
1112
1112
  const sketchArray = Array.isArray(otherSketches) ? [this, ...otherSketches] : [this, otherSketches];
1113
- const shape = errors.unwrap(
1113
+ const shape = result.unwrap(
1114
1114
  loft.loft(
1115
1115
  sketchArray.map((s) => s.wire),
1116
1116
  loftConfig,
@@ -1651,7 +1651,7 @@ class FaceSketcher extends BaseSketcher2d {
1651
1651
  _bounds;
1652
1652
  constructor(face, origin = [0, 0]) {
1653
1653
  super(origin);
1654
- this.face = shapeTypes.createFace(errors.unwrap(faceFns.downcast(face.wrapped)));
1654
+ this.face = shapeTypes.createFace(result.unwrap(faceFns.downcast(face.wrapped)));
1655
1655
  this._bounds = faceFns.uvBounds(face);
1656
1656
  }
1657
1657
  _convertToUV([x, y]) {
@@ -1674,7 +1674,7 @@ class FaceSketcher extends BaseSketcher2d {
1674
1674
  const edges = this.pendingCurves.map((curve) => {
1675
1675
  return shapeTypes.createEdge(kernel.buildEdgeOnSurface(curve.wrapped, geomSurf));
1676
1676
  });
1677
- const wire = errors.unwrap(surfaceBuilders.assembleWire(edges));
1677
+ const wire = result.unwrap(surfaceBuilders.assembleWire(edges));
1678
1678
  kernel.buildCurves3d(wire.wrapped);
1679
1679
  return wire;
1680
1680
  }
@@ -1945,7 +1945,7 @@ function findAllIntersections(first, second) {
1945
1945
  const secondCurvePoints = second.curves.map(() => []);
1946
1946
  first.curves.forEach((thisCurve, firstIndex) => {
1947
1947
  second.curves.forEach((otherCurve, secondIndex) => {
1948
- const { intersections, commonSegments, commonSegmentsPoints } = errors.unwrap(
1948
+ const { intersections, commonSegments, commonSegmentsPoints } = result.unwrap(
1949
1949
  intersectCurves(thisCurve, otherCurve, helpers.PRECISION_INTERSECTION / 100)
1950
1950
  );
1951
1951
  allIntersections.push(...intersections);
@@ -2202,7 +2202,7 @@ const genericIntersects = (first, second) => {
2202
2202
  let allIntersections = [];
2203
2203
  first.curves.forEach((thisCurve) => {
2204
2204
  second.curves.forEach((otherCurve) => {
2205
- const { intersections, commonSegmentsPoints } = errors.unwrap(
2205
+ const { intersections, commonSegmentsPoints } = result.unwrap(
2206
2206
  intersectCurves(thisCurve, otherCurve)
2207
2207
  );
2208
2208
  allIntersections.push(...intersections);
@@ -2267,7 +2267,11 @@ const fuseIntersectingBlueprints = (blueprints) => {
2267
2267
  if (!genericIntersects(blueprint, otherBlueprint)) return;
2268
2268
  let newFused;
2269
2269
  if (blueprint instanceof Blueprints || otherBlueprint instanceof Blueprints) {
2270
- newFused = fuse2D(blueprint, otherBlueprint);
2270
+ const fused2 = fuse2D(blueprint, otherBlueprint);
2271
+ if (fused2 === null) {
2272
+ result.bug("fuseIntersectingBlueprints", "fuse2D returned null for non-null inputs");
2273
+ }
2274
+ newFused = fused2;
2271
2275
  } else {
2272
2276
  newFused = genericFuse(blueprint, otherBlueprint);
2273
2277
  }
@@ -2275,7 +2279,7 @@ const fuseIntersectingBlueprints = (blueprints) => {
2275
2279
  if (newFused instanceof Blueprints && newFused.blueprints.length === 2) {
2276
2280
  return;
2277
2281
  } else if (newFused instanceof Blueprints && newFused.blueprints.length === 1) {
2278
- newFused = newFused.blueprints[0];
2282
+ newFused = result.safeIndex(newFused.blueprints, 0, "fuseIntersectingBlueprints");
2279
2283
  } else if (!(newFused instanceof Blueprints)) {
2280
2284
  result.bug("fuseIntersectingBlueprints", "Fuse produced unexpected non-blueprint result");
2281
2285
  }
@@ -2294,7 +2298,10 @@ const allBlueprints = (shape) => {
2294
2298
  return [];
2295
2299
  };
2296
2300
  const fuseBlueprintWithCompound = (blueprint, compound) => {
2297
- const outerFused = fuseBlueprints(blueprint, compound.blueprints[0]);
2301
+ const outerFused = fuseBlueprints(
2302
+ blueprint,
2303
+ result.safeIndex(compound.blueprints, 0, "fuseBlueprintWithCompound")
2304
+ );
2298
2305
  const innerFused = compound.blueprints.slice(1).map((c) => cutBlueprints(c, blueprint));
2299
2306
  return organiseBlueprints([
2300
2307
  ...allBlueprints(outerFused),
@@ -2311,9 +2318,11 @@ function allPairs(list1, list2) {
2311
2318
  return result2;
2312
2319
  }
2313
2320
  const fuseCompoundWithCompound = (first, second) => {
2314
- const outerFused = fuseBlueprints(first.blueprints[0], second.blueprints[0]);
2315
- const inner1Fused = second.blueprints.slice(1).map((c) => cutBlueprints(c, first.blueprints[0]));
2316
- const inner2Fused = first.blueprints.slice(1).map((c) => cutBlueprints(c, second.blueprints[0]));
2321
+ const firstOuter = result.safeIndex(first.blueprints, 0, "fuseCompoundWithCompound");
2322
+ const secondOuter = result.safeIndex(second.blueprints, 0, "fuseCompoundWithCompound");
2323
+ const outerFused = fuseBlueprints(firstOuter, secondOuter);
2324
+ const inner1Fused = second.blueprints.slice(1).map((c) => cutBlueprints(c, firstOuter));
2325
+ const inner2Fused = first.blueprints.slice(1).map((c) => cutBlueprints(c, secondOuter));
2317
2326
  const innerIntersections = allPairs(
2318
2327
  first.blueprints.slice(1),
2319
2328
  second.blueprints.slice(1)
@@ -2341,7 +2350,7 @@ const fuse2D = (first, second) => {
2341
2350
  return fuseIntersectingBlueprints([second, ...first.blueprints]);
2342
2351
  }
2343
2352
  if (first instanceof Blueprints && second instanceof Blueprints) {
2344
- let out = fuse2D(first.blueprints[0], second);
2353
+ let out = fuse2D(result.safeIndex(first.blueprints, 0, "fuse2D"), second);
2345
2354
  first.blueprints.slice(1).forEach((bp) => {
2346
2355
  out = fuse2D(bp, out);
2347
2356
  });
@@ -2380,7 +2389,7 @@ const mergeNonIntersecting = (shapes) => {
2380
2389
  if (s instanceof Blueprints) return s.blueprints;
2381
2390
  return s;
2382
2391
  });
2383
- if (exploded.length === 1) return exploded[0];
2392
+ if (exploded.length === 1) return result.safeIndex(exploded, 0, "mergeNonIntersecting");
2384
2393
  return new Blueprints(exploded);
2385
2394
  };
2386
2395
  const cut2D = (first, second) => {
@@ -2394,13 +2403,13 @@ const cut2D = (first, second) => {
2394
2403
  return mergeNonIntersecting(first.blueprints.map((bp) => cut2D(bp, second)));
2395
2404
  }
2396
2405
  if (first instanceof CompoundBlueprint) {
2397
- const wrapper = first.blueprints[0];
2406
+ const wrapper = result.safeIndex(first.blueprints, 0, "cut2D");
2398
2407
  if (second instanceof Blueprint.Blueprint && !second.intersects(wrapper)) {
2399
2408
  if (!wrapper.isInside(second.firstPoint)) return null;
2400
2409
  const cuts = fuse2D(second, new Blueprints(first.blueprints.slice(1)));
2401
2410
  return organiseBlueprints([wrapper, ...allBlueprints(cuts)]);
2402
2411
  } else {
2403
- let out = cut2D(first.blueprints[0], second);
2412
+ let out = cut2D(wrapper, second);
2404
2413
  first.blueprints.slice(1).forEach((bp) => {
2405
2414
  out = cut2D(out, bp);
2406
2415
  });
@@ -2411,7 +2420,7 @@ const cut2D = (first, second) => {
2411
2420
  return mergeNonIntersecting(second.blueprints.map((bp) => cut2D(first, bp)));
2412
2421
  }
2413
2422
  if (second instanceof CompoundBlueprint) {
2414
- let out = cutBlueprints(first, second.blueprints[0]);
2423
+ let out = cutBlueprints(first, result.safeIndex(second.blueprints, 0, "cut2D"));
2415
2424
  second.blueprints.slice(1).forEach((bp) => {
2416
2425
  out = fuse2D(out, intersectBlueprints(bp, first));
2417
2426
  });
@@ -2431,31 +2440,31 @@ function intersect2D(first, second) {
2431
2440
  return mergeNonIntersecting(first.blueprints.map((bp) => intersect2D(bp, second)));
2432
2441
  }
2433
2442
  if (first instanceof CompoundBlueprint) {
2434
- const wrapper = first.blueprints[0];
2443
+ const wrapper = result.safeIndex(first.blueprints, 0, "intersect2D");
2435
2444
  const cuts = first.blueprints.slice(1);
2436
2445
  if (cuts.length === 0) {
2437
2446
  return intersect2D(wrapper, second);
2438
2447
  }
2439
- let result2 = intersect2D(wrapper, second);
2448
+ let result$1 = intersect2D(wrapper, second);
2440
2449
  for (const cut of cuts) {
2441
- result2 = cut2D(result2, cut);
2450
+ result$1 = cut2D(result$1, cut);
2442
2451
  }
2443
- return result2;
2452
+ return result$1;
2444
2453
  }
2445
2454
  if (second instanceof Blueprints) {
2446
2455
  return mergeNonIntersecting(second.blueprints.map((bp) => intersect2D(first, bp)));
2447
2456
  }
2448
2457
  if (second instanceof CompoundBlueprint) {
2449
- const wrapper = second.blueprints[0];
2458
+ const wrapper = result.safeIndex(second.blueprints, 0, "intersect2D");
2450
2459
  const cuts = second.blueprints.slice(1);
2451
2460
  if (cuts.length === 0) {
2452
2461
  return intersect2D(wrapper, first);
2453
2462
  }
2454
- let result2 = intersect2D(wrapper, first);
2463
+ let result$1 = intersect2D(wrapper, first);
2455
2464
  for (const cut of cuts) {
2456
- result2 = cut2D(result2, cut);
2465
+ result$1 = cut2D(result$1, cut);
2457
2466
  }
2458
- return result2;
2467
+ return result$1;
2459
2468
  }
2460
2469
  result.bug("intersect2D", "Unhandled Shape2D combination");
2461
2470
  }