brepjs 8.3.0 → 8.4.0

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 (79) hide show
  1. package/dist/2d/lib/Curve2D.d.ts.map +1 -1
  2. package/dist/2d.cjs +2 -2
  3. package/dist/2d.js +3 -3
  4. package/dist/{Blueprint-CdVaHDSx.js → Blueprint-Bp45tnh0.js} +16 -13
  5. package/dist/{Blueprint-a3ukJMG4.cjs → Blueprint-zgFe_5Qj.cjs} +16 -13
  6. package/dist/{boolean2D-pvPIs21j.cjs → boolean2D-CfEbRMPF.cjs} +11 -11
  7. package/dist/{boolean2D-DzA0STqC.js → boolean2D-DN6ETTCq.js} +11 -11
  8. package/dist/{booleanFns-Cd414V3l.cjs → booleanFns-5dDG0jpA.cjs} +5 -5
  9. package/dist/{booleanFns-BcQUqjUu.js → booleanFns-C-M6qqvB.js} +5 -5
  10. package/dist/brepjs.cjs +186 -20
  11. package/dist/brepjs.js +208 -42
  12. package/dist/{cast-C107o5ow.cjs → cast-CPNOTNFm.cjs} +3 -3
  13. package/dist/{cast-D0OhP1nV.js → cast-Cerqtxtb.js} +3 -3
  14. package/dist/core/errors.d.ts +7 -0
  15. package/dist/core/errors.d.ts.map +1 -1
  16. package/dist/core.cjs +4 -4
  17. package/dist/core.js +4 -4
  18. package/dist/{cornerFinder-BdKtobgb.cjs → cornerFinder-BQ-_VJx0.cjs} +1 -1
  19. package/dist/{cornerFinder-DvPiz-VR.js → cornerFinder-CC_MunIh.js} +1 -1
  20. package/dist/{curveBuilders-CN72XaIQ.js → curveBuilders-BREwqvuc.js} +3 -3
  21. package/dist/{curveBuilders-Du03_Yyf.cjs → curveBuilders-BkEJ-RVn.cjs} +3 -3
  22. package/dist/{curveFns-B5EQsSwv.cjs → curveFns-VMxgfkqw.cjs} +3 -3
  23. package/dist/{curveFns-CyHyk29c.js → curveFns-ZuQUBZvd.js} +3 -3
  24. package/dist/{drawFns-CAAE4Z88.js → drawFns-BbhX1IUq.js} +19 -16
  25. package/dist/{drawFns-Mr2pghU8.cjs → drawFns-CKaHgGSK.cjs} +19 -16
  26. package/dist/{errors-wGhcJMpB.js → errors-CSYOlCCR.js} +10 -1
  27. package/dist/{errors-DK1VAdP4.cjs → errors-D13q2HCk.cjs} +10 -1
  28. package/dist/{faceFns-ub3CugDN.js → faceFns-CfJIbHY3.js} +4 -4
  29. package/dist/{faceFns-D1Sqnlu6.cjs → faceFns-es3GENII.cjs} +4 -4
  30. package/dist/{helpers-CP2KrBZl.cjs → helpers-C0q_FVxq.cjs} +7 -7
  31. package/dist/{helpers-r_e-u1JM.js → helpers-CmVkMubc.js} +7 -7
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/io.cjs +5 -5
  35. package/dist/io.js +5 -5
  36. package/dist/kernel/hullOps.d.ts +22 -0
  37. package/dist/kernel/hullOps.d.ts.map +1 -0
  38. package/dist/kernel/occtAdapter.d.ts +6 -0
  39. package/dist/kernel/occtAdapter.d.ts.map +1 -1
  40. package/dist/kernel/types.d.ts +6 -0
  41. package/dist/kernel/types.d.ts.map +1 -1
  42. package/dist/{loft-PMRx9iMG.cjs → loft-B-UCPW9P.cjs} +5 -5
  43. package/dist/{loft-BHn7GKm8.js → loft-oJq2OD3A.js} +5 -5
  44. package/dist/{measurement-B06hNs89.cjs → measurement-CYmT-C77.cjs} +3 -3
  45. package/dist/{measurement-BfhEneUl.js → measurement-Cf_SoIiR.js} +3 -3
  46. package/dist/measurement.cjs +1 -1
  47. package/dist/measurement.js +1 -1
  48. package/dist/{meshFns-BEvGVcym.js → meshFns-CqNwW0PO.js} +3 -3
  49. package/dist/{meshFns-CJV_k_EQ.cjs → meshFns-DDC_2U81.cjs} +3 -3
  50. package/dist/{occtBoundary-BFAaUtA7.cjs → occtBoundary-CocN2VKx.cjs} +419 -2
  51. package/dist/{occtBoundary-CoXB2xvx.js → occtBoundary-D_gjqgzo.js} +419 -2
  52. package/dist/{operations-B314mytX.js → operations-6hdpuYmY.js} +6 -6
  53. package/dist/{operations-CYGNxn5D.cjs → operations-BQeW_DSM.cjs} +6 -6
  54. package/dist/operations.cjs +2 -2
  55. package/dist/operations.js +2 -2
  56. package/dist/query.cjs +5 -5
  57. package/dist/query.js +6 -6
  58. package/dist/result.cjs +1 -1
  59. package/dist/result.js +1 -1
  60. package/dist/{shapeFns-Z_ScEjmn.cjs → shapeFns-B0zSdO9c.cjs} +4 -4
  61. package/dist/{shapeFns-CWd_ASDV.js → shapeFns-k1YHFwmB.js} +15 -15
  62. package/dist/{shapeTypes-UqVCIO_T.cjs → shapeTypes-BxVxLdiD.cjs} +1 -1
  63. package/dist/{shapeTypes-BU2LKv2S.js → shapeTypes-c-_pgYCx.js} +1 -1
  64. package/dist/sketching.cjs +2 -2
  65. package/dist/sketching.js +2 -2
  66. package/dist/text/textBlueprints.d.ts.map +1 -1
  67. package/dist/topology/hullFns.d.ts +16 -0
  68. package/dist/topology/hullFns.d.ts.map +1 -0
  69. package/dist/topology/minkowskiFns.d.ts +20 -0
  70. package/dist/topology/minkowskiFns.d.ts.map +1 -0
  71. package/dist/{topology-A7-jUtHB.cjs → topology-CycEc6Oe.cjs} +9 -9
  72. package/dist/{topology-BupialMm.js → topology-tMKHJgw2.js} +9 -9
  73. package/dist/topology.cjs +7 -7
  74. package/dist/topology.js +27 -27
  75. package/dist/{vectors-BhfKwL9J.js → vectors-DE0XriuQ.js} +2 -2
  76. package/dist/{vectors-t1XG4LpL.cjs → vectors-DVmHF4zt.cjs} +2 -2
  77. package/dist/vectors.cjs +2 -2
  78. package/dist/vectors.js +2 -2
  79. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"Curve2D.d.ts","sourceRoot":"","sources":["../../../src/2d/lib/Curve2D.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,C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AAyE;IACzE,IAAI,IAAI,WAEP;IAED,6EAA6E;IAC7E,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,6FAA6F;IAC7F,SAAS,IAAI,MAAM;IAKnB,yEAAyE;IACzE,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAOjC,8EAA8E;IAC9E,IAAI,UAAU,IAAI,OAAO,CAKxB;IAED,4EAA4E;IAC5E,IAAI,SAAS,IAAI,OAAO,CAKvB;IAED,4DAA4D;IAC5D,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED,0DAA0D;IAC1D,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,mFAAmF;IACnF,OAAO,IAAI,MAAM;IAKjB,wFAAwF;IACxF,IAAI,QAAQ,IAAI,SAAS,CAKxB;IAED,qDAAqD;IACrD,KAAK,IAAI,OAAO;IAQhB,sDAAsD;IACtD,OAAO,IAAI,IAAI;IAQf,OAAO,CAAC,iBAAiB;IAqBzB,OAAO,CAAC,iBAAiB;IAgCzB,gFAAgF;IAChF,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM;IAQhD,8EAA8E;IAC9E,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAIlC;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,SAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IA6B3D;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO;IAwB3C;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,EAAE,SAAS,SAAO,GAAG,OAAO,EAAE;CAmEnE"}
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-a3ukJMG4.cjs");
4
- const boolean2D = require("./boolean2D-pvPIs21j.cjs");
3
+ const Blueprint = require("./Blueprint-zgFe_5Qj.cjs");
4
+ const boolean2D = require("./boolean2D-CfEbRMPF.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-CdVaHDSx.js";
2
- import { e, C, f } from "./Blueprint-CdVaHDSx.js";
3
- import { b, C as C2, c, d, f as f2, e as e2, i, g, o, p, r } from "./boolean2D-DzA0STqC.js";
1
+ import { B as Blueprint } from "./Blueprint-Bp45tnh0.js";
2
+ import { e, C, f } from "./Blueprint-Bp45tnh0.js";
3
+ import { b, C as C2, c, d, f as f2, e as e2, i, g, o, p, r } from "./boolean2D-DN6ETTCq.js";
4
4
  function reverseCurve(curve) {
5
5
  const cloned = curve.clone();
6
6
  cloned.reverse();
@@ -1,14 +1,14 @@
1
- import { r as resolvePlane } from "./vectors-BhfKwL9J.js";
2
- import { g as getKernel, a as toVec3, m as makeOcAx2 } from "./occtBoundary-CoXB2xvx.js";
3
- import { t as localGC, u as createFace, e as isFace, y as registerForCleanup, z as unregisterFromCleanup, p as gcWithScope, o as createEdge, n as createWire } from "./shapeTypes-BU2LKv2S.js";
4
- import { u as uvBounds, a as faceGeomType, f as faceCenter, h as uvCoordinates } from "./faceFns-ub3CugDN.js";
5
- import { j as findCurveType, m as getOrientation } from "./curveFns-CyHyk29c.js";
6
- import { e as err, o as occtError, l as ok, a as andThen, x as validationError, u as unwrap, b as computationError } from "./errors-wGhcJMpB.js";
7
- import { d as distance2d, s as samePoint, k as scalarMultiply2d, i as add2d, n as normalize2d, h as subtract2d, g as getSingleFace } from "./helpers-r_e-u1JM.js";
8
- import { c as cast } from "./cast-D0OhP1nV.js";
1
+ import { r as resolvePlane } from "./vectors-DE0XriuQ.js";
2
+ import { g as getKernel, a as toVec3, m as makeOcAx2 } from "./occtBoundary-D_gjqgzo.js";
3
+ import { t as localGC, u as createFace, e as isFace, y as registerForCleanup, z as unregisterFromCleanup, p as gcWithScope, o as createEdge, n as createWire } from "./shapeTypes-c-_pgYCx.js";
4
+ import { u as uvBounds, a as faceGeomType, f as faceCenter, h as uvCoordinates } from "./faceFns-CfJIbHY3.js";
5
+ import { j as findCurveType, m as getOrientation } from "./curveFns-ZuQUBZvd.js";
6
+ import { e as err, o as occtError, l as ok, a as andThen, x as validationError, u as unwrap, b as computationError } from "./errors-CSYOlCCR.js";
7
+ import { d as distance2d, s as samePoint, k as scalarMultiply2d, i as add2d, n as normalize2d, h as subtract2d, g as getSingleFace } from "./helpers-CmVkMubc.js";
8
+ import { c as cast } from "./cast-Cerqtxtb.js";
9
9
  import { R as RAD2DEG, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
10
- import { c as getEdges } from "./shapeFns-CWd_ASDV.js";
11
- import { m as makeLine, a as assembleWire$1 } from "./curveBuilders-CN72XaIQ.js";
10
+ import { e as getEdges } from "./shapeFns-k1YHFwmB.js";
11
+ import { m as makeLine, a as assembleWire$1 } from "./curveBuilders-BREwqvuc.js";
12
12
  import { bug } from "./result.js";
13
13
  function makePlane(plane, origin) {
14
14
  if (plane && typeof plane !== "string") {
@@ -363,7 +363,7 @@ class Curve2D {
363
363
  const oc = getKernel().oc;
364
364
  const r = gcWithScope();
365
365
  const projector = r(new oc.Geom2dAPI_ProjectPointOnCurve_2(r(pnt(point)), this.wrapped));
366
- let curveToPoint = Infinity;
366
+ let curveToPoint;
367
367
  try {
368
368
  curveToPoint = projector.LowerDistance();
369
369
  } catch {
@@ -378,7 +378,7 @@ class Curve2D {
378
378
  distanceFromCurve(curve) {
379
379
  const oc = getKernel().oc;
380
380
  const r = gcWithScope();
381
- let curveDistance = Infinity;
381
+ let curveDistance;
382
382
  const projector = r(
383
383
  new oc.Geom2dAPI_ExtremaCurveCurve(
384
384
  this.wrapped,
@@ -517,7 +517,10 @@ class Curve2D {
517
517
  const trimmed = new oc.Geom2d_TrimmedCurve(this.wrapped, first, last, true, true);
518
518
  return new Curve2D(new oc.Handle_Geom2d_Curve_2(trimmed));
519
519
  } catch (e) {
520
- throw new Error(`Failed to split the curve: ${e instanceof Error ? e.message : String(e)}`);
520
+ throw new Error(
521
+ `Failed to split the curve: ${e instanceof Error ? e.message : String(e)}`,
522
+ { cause: e }
523
+ );
521
524
  }
522
525
  });
523
526
  }
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
- const vectors = require("./vectors-t1XG4LpL.cjs");
3
- const occtBoundary = require("./occtBoundary-BFAaUtA7.cjs");
4
- const shapeTypes = require("./shapeTypes-UqVCIO_T.cjs");
5
- const faceFns = require("./faceFns-D1Sqnlu6.cjs");
6
- const curveFns = require("./curveFns-B5EQsSwv.cjs");
7
- const errors = require("./errors-DK1VAdP4.cjs");
8
- const helpers = require("./helpers-CP2KrBZl.cjs");
9
- const cast = require("./cast-C107o5ow.cjs");
2
+ const vectors = require("./vectors-DVmHF4zt.cjs");
3
+ const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
4
+ const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
5
+ const faceFns = require("./faceFns-es3GENII.cjs");
6
+ const curveFns = require("./curveFns-VMxgfkqw.cjs");
7
+ const errors = require("./errors-D13q2HCk.cjs");
8
+ const helpers = require("./helpers-C0q_FVxq.cjs");
9
+ const cast = require("./cast-CPNOTNFm.cjs");
10
10
  const vecOps = require("./vecOps-CjRL1jau.cjs");
11
- const shapeFns = require("./shapeFns-Z_ScEjmn.cjs");
12
- const curveBuilders = require("./curveBuilders-Du03_Yyf.cjs");
11
+ const shapeFns = require("./shapeFns-B0zSdO9c.cjs");
12
+ const curveBuilders = require("./curveBuilders-BkEJ-RVn.cjs");
13
13
  const result = require("./result.cjs");
14
14
  function makePlane(plane, origin) {
15
15
  if (plane && typeof plane !== "string") {
@@ -364,7 +364,7 @@ class Curve2D {
364
364
  const oc = occtBoundary.getKernel().oc;
365
365
  const r = shapeTypes.gcWithScope();
366
366
  const projector = r(new oc.Geom2dAPI_ProjectPointOnCurve_2(r(pnt(point)), this.wrapped));
367
- let curveToPoint = Infinity;
367
+ let curveToPoint;
368
368
  try {
369
369
  curveToPoint = projector.LowerDistance();
370
370
  } catch {
@@ -379,7 +379,7 @@ class Curve2D {
379
379
  distanceFromCurve(curve) {
380
380
  const oc = occtBoundary.getKernel().oc;
381
381
  const r = shapeTypes.gcWithScope();
382
- let curveDistance = Infinity;
382
+ let curveDistance;
383
383
  const projector = r(
384
384
  new oc.Geom2dAPI_ExtremaCurveCurve(
385
385
  this.wrapped,
@@ -518,7 +518,10 @@ class Curve2D {
518
518
  const trimmed = new oc.Geom2d_TrimmedCurve(this.wrapped, first, last, true, true);
519
519
  return new Curve2D(new oc.Handle_Geom2d_Curve_2(trimmed));
520
520
  } catch (e) {
521
- throw new Error(`Failed to split the curve: ${e instanceof Error ? e.message : String(e)}`);
521
+ throw new Error(
522
+ `Failed to split the curve: ${e instanceof Error ? e.message : String(e)}`,
523
+ { cause: e }
524
+ );
522
525
  }
523
526
  });
524
527
  }
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
- const vectors = require("./vectors-t1XG4LpL.cjs");
3
- const errors = require("./errors-DK1VAdP4.cjs");
4
- const cast = require("./cast-C107o5ow.cjs");
5
- const occtBoundary = require("./occtBoundary-BFAaUtA7.cjs");
2
+ const vectors = require("./vectors-DVmHF4zt.cjs");
3
+ const errors = require("./errors-D13q2HCk.cjs");
4
+ const cast = require("./cast-CPNOTNFm.cjs");
5
+ const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
6
6
  const vecOps = require("./vecOps-CjRL1jau.cjs");
7
- const loft = require("./loft-PMRx9iMG.cjs");
8
- const shapeTypes = require("./shapeTypes-UqVCIO_T.cjs");
9
- const curveFns = require("./curveFns-B5EQsSwv.cjs");
10
- const Blueprint = require("./Blueprint-a3ukJMG4.cjs");
11
- const faceFns = require("./faceFns-D1Sqnlu6.cjs");
7
+ const loft = require("./loft-B-UCPW9P.cjs");
8
+ const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
9
+ const curveFns = require("./curveFns-VMxgfkqw.cjs");
10
+ const Blueprint = require("./Blueprint-zgFe_5Qj.cjs");
11
+ const faceFns = require("./faceFns-es3GENII.cjs");
12
12
  const result = require("./result.cjs");
13
- const helpers = require("./helpers-CP2KrBZl.cjs");
14
- const curveBuilders = require("./curveBuilders-Du03_Yyf.cjs");
13
+ const helpers = require("./helpers-C0q_FVxq.cjs");
14
+ const curveBuilders = require("./curveBuilders-BkEJ-RVn.cjs");
15
15
  function* pointsIteration(intersector) {
16
16
  const nPoints = intersector.NbPoints();
17
17
  if (!nPoints) return;
@@ -1,16 +1,16 @@
1
- import { a as createPlane } from "./vectors-BhfKwL9J.js";
2
- import { l as ok, e as err, b as computationError, u as unwrap, g as isOk } from "./errors-wGhcJMpB.js";
3
- import { d as downcast } from "./cast-D0OhP1nV.js";
4
- import { g as getKernel, a as toVec3 } from "./occtBoundary-CoXB2xvx.js";
1
+ import { a as createPlane } from "./vectors-DE0XriuQ.js";
2
+ import { l as ok, e as err, b as computationError, u as unwrap, g as isOk } from "./errors-CSYOlCCR.js";
3
+ import { d as downcast } from "./cast-Cerqtxtb.js";
4
+ import { g as getKernel, a as toVec3 } from "./occtBoundary-D_gjqgzo.js";
5
5
  import { n as vecScale, j as vecNormalize, b as vecCross, D as DEG2RAD, R as RAD2DEG } from "./vecOps-ZDdZWbwT.js";
6
- import { r as revolution, k as complexExtrude, t as twistExtrude, i as basicFaceExtrusion, j as genericSweep, l as loft } from "./loft-BHn7GKm8.js";
7
- import { p as gcWithScope, u as createFace, n as createWire, t as localGC, o as createEdge } from "./shapeTypes-BU2LKv2S.js";
8
- import { e as curveStartPoint, a as curveTangentAt, c as curveIsClosed } from "./curveFns-CyHyk29c.js";
9
- import { C as Curve2D, i as make2dSegmentCurve, r as approximateAsBSpline, j as make2dArcFromCenter, s as isPoint2D, o as make2dCircle, t as make2dThreePointArc, e as BoundingBox2d, v as viewbox, u as asSVG, B as Blueprint, m as makeFace, d as makeNewFaceWithinFace, w as make2dEllipseArc, x as make2dTangentArc, y as make2dBezierCurve, f as axis2d, z as zip, A as removeDuplicatePoints } from "./Blueprint-CdVaHDSx.js";
10
- import { u as uvBounds, p as pointOnSurface, n as normalAt } from "./faceFns-ub3CugDN.js";
6
+ import { r as revolution, k as complexExtrude, t as twistExtrude, i as basicFaceExtrusion, j as genericSweep, l as loft } from "./loft-oJq2OD3A.js";
7
+ import { p as gcWithScope, u as createFace, n as createWire, t as localGC, o as createEdge } from "./shapeTypes-c-_pgYCx.js";
8
+ import { e as curveStartPoint, a as curveTangentAt, c as curveIsClosed } from "./curveFns-ZuQUBZvd.js";
9
+ import { C as Curve2D, i as make2dSegmentCurve, r as approximateAsBSpline, j as make2dArcFromCenter, s as isPoint2D, o as make2dCircle, t as make2dThreePointArc, e as BoundingBox2d, v as viewbox, u as asSVG, B as Blueprint, m as makeFace, d as makeNewFaceWithinFace, w as make2dEllipseArc, x as make2dTangentArc, y as make2dBezierCurve, f as axis2d, z as zip, A as removeDuplicatePoints } from "./Blueprint-Bp45tnh0.js";
10
+ import { u as uvBounds, p as pointOnSurface, n as normalAt } from "./faceFns-CfJIbHY3.js";
11
11
  import { bug } from "./result.js";
12
- import { s as samePoint$1, n as normalize2d, h as subtract2d, i as add2d, j as crossProduct2d, k as scalarMultiply2d, b as polarToCartesian, r as rotate2d, l as cartesianToPolar, d as distance2d, p as polarAngle2d, m as PRECISION_INTERSECTION } from "./helpers-r_e-u1JM.js";
13
- import { a as assembleWire } from "./curveBuilders-CN72XaIQ.js";
12
+ import { s as samePoint$1, n as normalize2d, h as subtract2d, i as add2d, j as crossProduct2d, k as scalarMultiply2d, b as polarToCartesian, r as rotate2d, l as cartesianToPolar, d as distance2d, p as polarAngle2d, m as PRECISION_INTERSECTION } from "./helpers-CmVkMubc.js";
13
+ import { a as assembleWire } from "./curveBuilders-BREwqvuc.js";
14
14
  function* pointsIteration(intersector) {
15
15
  const nPoints = intersector.NbPoints();
16
16
  if (!nPoints) return;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
- const occtBoundary = require("./occtBoundary-BFAaUtA7.cjs");
3
- const shapeTypes = require("./shapeTypes-UqVCIO_T.cjs");
4
- const errors = require("./errors-DK1VAdP4.cjs");
5
- const vectors = require("./vectors-t1XG4LpL.cjs");
2
+ const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
3
+ const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
4
+ const errors = require("./errors-D13q2HCk.cjs");
5
+ const vectors = require("./vectors-DVmHF4zt.cjs");
6
6
  const vecOps = require("./vecOps-CjRL1jau.cjs");
7
- const shapeFns = require("./shapeFns-Z_ScEjmn.cjs");
7
+ const shapeFns = require("./shapeFns-B0zSdO9c.cjs");
8
8
  function applyGlue(op, optimisation) {
9
9
  const oc = occtBoundary.getKernel().oc;
10
10
  if (optimisation === "commonFace") {
@@ -1,9 +1,9 @@
1
- import { g as getKernel } from "./occtBoundary-CoXB2xvx.js";
2
- import { p as gcWithScope, c as castShape, h as isShape3D } from "./shapeTypes-BU2LKv2S.js";
3
- import { l as ok, d as isErr, e as err, x as validationError, B as BrepErrorCode, p as typeCastError, o as occtError } from "./errors-wGhcJMpB.js";
4
- import { r as resolvePlane } from "./vectors-BhfKwL9J.js";
1
+ import { g as getKernel } from "./occtBoundary-D_gjqgzo.js";
2
+ import { p as gcWithScope, c as castShape, h as isShape3D } from "./shapeTypes-c-_pgYCx.js";
3
+ import { l as ok, d as isErr, e as err, x as validationError, B as BrepErrorCode, p as typeCastError, o as occtError } from "./errors-CSYOlCCR.js";
4
+ import { r as resolvePlane } from "./vectors-DE0XriuQ.js";
5
5
  import { n as vecScale, v as vecAdd } from "./vecOps-ZDdZWbwT.js";
6
- import { p as propagateOrigins, a as propagateOriginsByHash } from "./shapeFns-CWd_ASDV.js";
6
+ import { p as propagateOrigins, a as propagateOriginsByHash } from "./shapeFns-k1YHFwmB.js";
7
7
  function applyGlue(op, optimisation) {
8
8
  const oc = getKernel().oc;
9
9
  if (optimisation === "commonFace") {
package/dist/brepjs.cjs CHANGED
@@ -1,30 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const occtBoundary = require("./occtBoundary-BFAaUtA7.cjs");
4
- const errors = require("./errors-DK1VAdP4.cjs");
5
- const shapeTypes = require("./shapeTypes-UqVCIO_T.cjs");
3
+ const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
4
+ const errors = require("./errors-D13q2HCk.cjs");
5
+ const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
6
6
  const vecOps = require("./vecOps-CjRL1jau.cjs");
7
- const Blueprint = require("./Blueprint-a3ukJMG4.cjs");
8
- const curveFns = require("./curveFns-B5EQsSwv.cjs");
9
- const loft$2 = require("./loft-PMRx9iMG.cjs");
10
- const operations = require("./operations-CYGNxn5D.cjs");
11
- const boolean2D = require("./boolean2D-pvPIs21j.cjs");
7
+ const Blueprint = require("./Blueprint-zgFe_5Qj.cjs");
8
+ const curveFns = require("./curveFns-VMxgfkqw.cjs");
9
+ const loft$2 = require("./loft-B-UCPW9P.cjs");
10
+ const operations = require("./operations-BQeW_DSM.cjs");
11
+ const boolean2D = require("./boolean2D-CfEbRMPF.cjs");
12
12
  const _2d = require("./2d.cjs");
13
- const helpers = require("./helpers-CP2KrBZl.cjs");
13
+ const helpers = require("./helpers-C0q_FVxq.cjs");
14
14
  const io = require("./io.cjs");
15
- const drawFns = require("./drawFns-Mr2pghU8.cjs");
16
- const vectors = require("./vectors-t1XG4LpL.cjs");
17
- const shapeFns = require("./shapeFns-Z_ScEjmn.cjs");
18
- const topology = require("./topology-A7-jUtHB.cjs");
19
- const faceFns = require("./faceFns-D1Sqnlu6.cjs");
20
- const meshFns = require("./meshFns-CJV_k_EQ.cjs");
21
- const booleanFns = require("./booleanFns-Cd414V3l.cjs");
22
- const measurement = require("./measurement-B06hNs89.cjs");
23
- const curveBuilders = require("./curveBuilders-Du03_Yyf.cjs");
24
- const cast = require("./cast-C107o5ow.cjs");
15
+ const drawFns = require("./drawFns-CKaHgGSK.cjs");
16
+ const vectors = require("./vectors-DVmHF4zt.cjs");
17
+ const shapeFns = require("./shapeFns-B0zSdO9c.cjs");
18
+ const topology = require("./topology-CycEc6Oe.cjs");
19
+ const faceFns = require("./faceFns-es3GENII.cjs");
20
+ const meshFns = require("./meshFns-DDC_2U81.cjs");
21
+ const booleanFns = require("./booleanFns-5dDG0jpA.cjs");
22
+ const measurement = require("./measurement-CYmT-C77.cjs");
23
+ const curveBuilders = require("./curveBuilders-BkEJ-RVn.cjs");
24
+ const cast = require("./cast-CPNOTNFm.cjs");
25
25
  const query = require("./query.cjs");
26
26
  const result = require("./result.cjs");
27
- const cornerFinder = require("./cornerFinder-BdKtobgb.cjs");
27
+ const cornerFinder = require("./cornerFinder-BQ-_VJx0.cjs");
28
28
  const worker = require("./worker.cjs");
29
29
  const errorFactories = {
30
30
  OCCT_OPERATION: (code, message, cause) => ({ kind: "OCCT_OPERATION", code, message, cause }),
@@ -145,6 +145,170 @@ function buildVertexFinder(filters) {
145
145
  function vertexFinder() {
146
146
  return buildVertexFinder([]);
147
147
  }
148
+ function validateNotNull$1(shape2, label) {
149
+ if (shape2.wrapped.IsNull()) {
150
+ return errors.err(errors.validationError(errors.BrepErrorCode.NULL_SHAPE_INPUT, `${label} is a null shape`));
151
+ }
152
+ return errors.ok(void 0);
153
+ }
154
+ function hull(shapes, options = {}) {
155
+ if (shapes.length === 0) {
156
+ return errors.err(
157
+ errors.validationError(
158
+ errors.BrepErrorCode.HULL_EMPTY_INPUT,
159
+ "hull: at least one shape is required",
160
+ void 0,
161
+ void 0,
162
+ "Provide one or more shapes to compute a convex hull"
163
+ )
164
+ );
165
+ }
166
+ for (const [i, shape2] of shapes.entries()) {
167
+ const check = validateNotNull$1(shape2, `hull: shapes[${i}]`);
168
+ if (errors.isErr(check)) return check;
169
+ }
170
+ const tolerance = options.tolerance ?? 0.1;
171
+ try {
172
+ const kernel = occtBoundary.getKernel();
173
+ const ocShapes = shapes.map((s) => s.wrapped);
174
+ const resultOc = kernel.hull(ocShapes, tolerance);
175
+ const cast2 = shapeTypes.castShape(resultOc);
176
+ if (!shapeTypes.isSolid(cast2)) {
177
+ return errors.err(
178
+ errors.occtError(errors.BrepErrorCode.HULL_NOT_3D, "Hull result is not a solid; input may be degenerate")
179
+ );
180
+ }
181
+ return errors.ok(cast2);
182
+ } catch (e) {
183
+ const raw = e instanceof Error ? e.message : String(e);
184
+ if (raw.includes("coplanar") || raw.includes("fewer than") || raw.includes("degenerate")) {
185
+ return errors.err(errors.occtError(errors.BrepErrorCode.HULL_DEGENERATE, `Hull degenerate: ${raw}`, e));
186
+ }
187
+ return errors.err(errors.occtError(errors.BrepErrorCode.HULL_FAILED, `Hull operation failed: ${raw}`, e));
188
+ }
189
+ }
190
+ function detectSphere(shape2) {
191
+ const oc = occtBoundary.getKernel().oc;
192
+ const faces = shapeFns.getFaces(shape2);
193
+ if (faces.length !== 1) return null;
194
+ const face2 = faces[0];
195
+ const r = shapeTypes.gcWithScope();
196
+ const adaptor = r(new oc.BRepAdaptor_Surface_2(face2.wrapped, true));
197
+ const surfType = adaptor.GetType();
198
+ if (surfType !== oc.GeomAbs_SurfaceType.GeomAbs_Sphere) return null;
199
+ const ocSphere = adaptor.Sphere();
200
+ const radius = ocSphere.Radius();
201
+ ocSphere.delete();
202
+ return radius;
203
+ }
204
+ function minkowskiSphere(shape2, radius, tolerance) {
205
+ const oc = occtBoundary.getKernel().oc;
206
+ const r = shapeTypes.gcWithScope();
207
+ try {
208
+ const offsetMaker = r(new oc.BRepOffsetAPI_MakeOffsetShape());
209
+ const progress = r(new oc.Message_ProgressRange_1());
210
+ offsetMaker.PerformByJoin(
211
+ shape2.wrapped,
212
+ radius,
213
+ tolerance,
214
+ oc.BRepOffset_Mode.BRepOffset_Skin,
215
+ false,
216
+ false,
217
+ oc.GeomAbs_JoinType.GeomAbs_Arc,
218
+ false,
219
+ progress
220
+ );
221
+ const resultShape = offsetMaker.Shape();
222
+ const wrapped = shapeTypes.castShape(resultShape);
223
+ if (!shapeTypes.isShape3D(wrapped)) {
224
+ wrapped[Symbol.dispose]();
225
+ return errors.err(
226
+ errors.typeCastError(
227
+ errors.BrepErrorCode.MINKOWSKI_NOT_3D,
228
+ "Minkowski sphere offset did not produce a 3D shape"
229
+ )
230
+ );
231
+ }
232
+ return errors.ok(wrapped);
233
+ } catch (e) {
234
+ const raw = e instanceof Error ? e.message : String(e);
235
+ return errors.err(
236
+ errors.occtError(errors.BrepErrorCode.MINKOWSKI_FAILED, `Minkowski sphere offset failed: ${raw}`, e, {
237
+ operation: "minkowski",
238
+ fastPath: "sphere"
239
+ })
240
+ );
241
+ }
242
+ }
243
+ function minkowskiGeneral(shape2, tool, _tolerance) {
244
+ const oc = occtBoundary.getKernel().oc;
245
+ try {
246
+ const shapeVerts = shapeFns.getVertices(shape2);
247
+ const toolVerts = shapeFns.getVertices(tool);
248
+ if (shapeVerts.length === 0 || toolVerts.length === 0) {
249
+ return errors.err(
250
+ errors.occtError(
251
+ errors.BrepErrorCode.MINKOWSKI_FAILED,
252
+ "Minkowski sum: one or both shapes have no vertices",
253
+ void 0,
254
+ {
255
+ operation: "minkowski"
256
+ }
257
+ )
258
+ );
259
+ }
260
+ const sumPoints = [];
261
+ for (const sv of shapeVerts) {
262
+ const r1 = shapeTypes.gcWithScope();
263
+ const pa = r1(oc.BRep_Tool.Pnt(sv.wrapped));
264
+ const ax = pa.X(), ay = pa.Y(), az = pa.Z();
265
+ for (const tv of toolVerts) {
266
+ const r2 = shapeTypes.gcWithScope();
267
+ const pb = r2(oc.BRep_Tool.Pnt(tv.wrapped));
268
+ const bx = pb.X(), by = pb.Y(), bz = pb.Z();
269
+ sumPoints.push({ x: ax + bx, y: ay + by, z: az + bz });
270
+ }
271
+ }
272
+ const kernel = occtBoundary.getKernel();
273
+ const hullShape = kernel.hullFromPoints(sumPoints, _tolerance);
274
+ const wrapped = shapeTypes.castShape(hullShape);
275
+ if (!shapeTypes.isShape3D(wrapped)) {
276
+ wrapped[Symbol.dispose]();
277
+ return errors.err(
278
+ errors.typeCastError(errors.BrepErrorCode.MINKOWSKI_NOT_3D, "Minkowski hull did not produce a 3D shape")
279
+ );
280
+ }
281
+ return errors.ok(wrapped);
282
+ } catch (e) {
283
+ const raw = e instanceof Error ? e.message : String(e);
284
+ return errors.err(
285
+ errors.occtError(errors.BrepErrorCode.MINKOWSKI_FAILED, `Minkowski general path failed: ${raw}`, e, {
286
+ operation: "minkowski"
287
+ })
288
+ );
289
+ }
290
+ }
291
+ function minkowski(shape2, tool, options = {}) {
292
+ const { tolerance = 1e-6 } = options;
293
+ if (shape2.wrapped.IsNull()) {
294
+ return errors.err(errors.validationError(errors.BrepErrorCode.NULL_SHAPE_INPUT, "minkowski: shape is a null shape"));
295
+ }
296
+ if (tool.wrapped.IsNull()) {
297
+ return errors.err(
298
+ errors.validationError(errors.BrepErrorCode.MINKOWSKI_NULL_TOOL, "minkowski: tool is a null shape")
299
+ );
300
+ }
301
+ if (!shapeTypes.isShape3D(shape2) || !shapeTypes.isShape3D(tool)) {
302
+ return errors.err(
303
+ errors.validationError(errors.BrepErrorCode.MINKOWSKI_NOT_3D, "minkowski: both shape and tool must be 3D")
304
+ );
305
+ }
306
+ const sphereRadius = detectSphere(tool);
307
+ if (sphereRadius !== null) {
308
+ return minkowskiSphere(shape2, sphereRadius, tolerance);
309
+ }
310
+ return minkowskiGeneral(shape2, tool, tolerance);
311
+ }
148
312
  function checkInterference(shape1, shape2, tolerance = 1e-6) {
149
313
  if (shape1.wrapped.IsNull()) {
150
314
  return errors.err(
@@ -1455,6 +1619,7 @@ exports.fromBREP = fromBREP;
1455
1619
  exports.fuse = fuse;
1456
1620
  exports.heal = heal;
1457
1621
  exports.helix = helix;
1622
+ exports.hull = hull;
1458
1623
  exports.intersect = intersect;
1459
1624
  exports.isChamferRadius = isChamferRadius;
1460
1625
  exports.isEmpty = isEmpty;
@@ -1467,6 +1632,7 @@ exports.line = line;
1467
1632
  exports.loft = loft;
1468
1633
  exports.mesh = mesh;
1469
1634
  exports.meshEdges = meshEdges;
1635
+ exports.minkowski = minkowski;
1470
1636
  exports.mirror = mirror;
1471
1637
  exports.mirrorJoin = mirrorJoin;
1472
1638
  exports.offset = offset;