brepjs 9.3.5 → 9.3.7

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 (75) hide show
  1. package/dist/2d.cjs +2 -2
  2. package/dist/2d.js +3 -3
  3. package/dist/{Blueprint-D-l9y6vQ.js → Blueprint-RZ4nOpeP.js} +5 -5
  4. package/dist/{Blueprint-pgzr1snT.cjs → Blueprint-UqKTCIA-.cjs} +5 -5
  5. package/dist/{boolean2D-DEQvy9jN.cjs → boolean2D-B1uobQA4.cjs} +7 -7
  6. package/dist/{boolean2D-S1fQJkDs.js → boolean2D-LUH72saA.js} +7 -7
  7. package/dist/{booleanFns-CKJpkL-W.cjs → booleanFns-Bl2o8KOm.cjs} +64 -17
  8. package/dist/{booleanFns-Ct7VfmjG.js → booleanFns-DU8S1pUR.js} +78 -31
  9. package/dist/brepjs.cjs +25 -16
  10. package/dist/brepjs.js +89 -80
  11. package/dist/core/shapeTypes.d.ts.map +1 -1
  12. package/dist/core.cjs +1 -1
  13. package/dist/core.js +1 -1
  14. package/dist/{cornerFinder-BKSnwYl_.cjs → cornerFinder-BPV6q1Vj.cjs} +1 -1
  15. package/dist/{cornerFinder-DiwhBI6W.js → cornerFinder-xTPiKfSk.js} +1 -1
  16. package/dist/{curveFns-CJ_Rhqu7.cjs → curveFns-CjhxIaTL.cjs} +1 -1
  17. package/dist/{curveFns-Vcss8w3g.js → curveFns-D1h3vwCh.js} +1 -1
  18. package/dist/{drawFns-DR-Pn6Ox.js → drawFns-CJShPJQl.js} +10 -10
  19. package/dist/{drawFns-BMN2P_95.cjs → drawFns-Dcy-HIjE.cjs} +10 -10
  20. package/dist/{faceFns-Cqgs0uTB.cjs → faceFns-CPfQsXwJ.cjs} +14 -14
  21. package/dist/{faceFns-CScUN5LN.js → faceFns-D309c5WF.js} +14 -14
  22. package/dist/{helpers-orCR-9t0.cjs → helpers-DK4mR8qk.cjs} +17 -8
  23. package/dist/{helpers-BUdSB_hP.js → helpers-DW9uVcCI.js} +18 -9
  24. package/dist/io.cjs +3 -3
  25. package/dist/io.js +3 -3
  26. package/dist/kernel/booleanOps.d.ts +13 -0
  27. package/dist/kernel/booleanOps.d.ts.map +1 -1
  28. package/dist/kernel/evolutionOps.d.ts.map +1 -1
  29. package/dist/kernel/index.d.ts.map +1 -1
  30. package/dist/kernel/meshOps.d.ts.map +1 -1
  31. package/dist/kernel/types.d.ts +11 -0
  32. package/dist/kernel/types.d.ts.map +1 -1
  33. package/dist/{loft-DttG6eeq.cjs → loft-C6S8hKeh.cjs} +3 -3
  34. package/dist/{loft-B6AuFlWT.js → loft-CRTLqcVq.js} +3 -3
  35. package/dist/measurement/interferenceFns.d.ts.map +1 -1
  36. package/dist/{measurement-Xm1XusbA.js → measurement-9152QCSW.js} +5 -5
  37. package/dist/{measurement-D61iSCBv.cjs → measurement-CgFnyeP-.cjs} +5 -5
  38. package/dist/measurement.cjs +1 -1
  39. package/dist/measurement.js +1 -1
  40. package/dist/{meshFns-B8LxlRhm.js → meshFns-CwCEIK-J.js} +6 -6
  41. package/dist/{meshFns-CCrO47TM.cjs → meshFns-DI87__D1.cjs} +6 -6
  42. package/dist/operations/patternFns.d.ts.map +1 -1
  43. package/dist/{operations-B1uuSLB2.cjs → operations-U2R99SDL.cjs} +5 -5
  44. package/dist/{operations-D-htN8K3.js → operations-o4_10ixl.js} +5 -5
  45. package/dist/operations.cjs +2 -2
  46. package/dist/operations.js +2 -2
  47. package/dist/query/finderCore.d.ts.map +1 -1
  48. package/dist/query.cjs +4 -4
  49. package/dist/query.js +5 -5
  50. package/dist/{shapeFns-BiMiqVm0.js → shapeFns-BvyqHHY6.js} +21 -17
  51. package/dist/{shapeFns-BvwnrLYU.cjs → shapeFns-DEMjdpl7.cjs} +12 -8
  52. package/dist/{shapeTypes-DIwQBQKB.cjs → shapeTypes-BN_jZhmp.cjs} +45 -51
  53. package/dist/{shapeTypes-D5th-THo.js → shapeTypes-TnFxk2_h.js} +45 -51
  54. package/dist/sketching.cjs +2 -2
  55. package/dist/sketching.js +2 -2
  56. package/dist/{surfaceBuilders-DbvODAS_.cjs → surfaceBuilders-Bj5RfOfU.cjs} +2 -2
  57. package/dist/{surfaceBuilders-CkDPvbwD.js → surfaceBuilders-Cyr7_YMW.js} +2 -2
  58. package/dist/topology/booleanFns.d.ts +7 -16
  59. package/dist/topology/booleanFns.d.ts.map +1 -1
  60. package/dist/topology/cast.d.ts +0 -5
  61. package/dist/topology/cast.d.ts.map +1 -1
  62. package/dist/topology/colorFns.d.ts +2 -0
  63. package/dist/topology/colorFns.d.ts.map +1 -1
  64. package/dist/topology/faceTagFns.d.ts +2 -0
  65. package/dist/topology/faceTagFns.d.ts.map +1 -1
  66. package/dist/topology/meshCache.d.ts +1 -1
  67. package/dist/topology/meshCache.d.ts.map +1 -1
  68. package/dist/topology/modifierFns.d.ts.map +1 -1
  69. package/dist/topology/shapeFns.d.ts +1 -1
  70. package/dist/topology/shapeFns.d.ts.map +1 -1
  71. package/dist/{topology-BndoQLIN.cjs → topology-D2rTk0_j.cjs} +6 -6
  72. package/dist/{topology-BvUvMNMo.js → topology-DAoT6iZV.js} +6 -6
  73. package/dist/topology.cjs +6 -6
  74. package/dist/topology.js +19 -19
  75. package/package.json +2 -1
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-pgzr1snT.cjs");
4
- const boolean2D = require("./boolean2D-DEQvy9jN.cjs");
3
+ const Blueprint = require("./Blueprint-UqKTCIA-.cjs");
4
+ const boolean2D = require("./boolean2D-B1uobQA4.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-D-l9y6vQ.js";
2
- import { d, C } from "./Blueprint-D-l9y6vQ.js";
3
- import { e, C as C2, f, l, g, n, k, q, o, p, r } from "./boolean2D-S1fQJkDs.js";
1
+ import { B as Blueprint } from "./Blueprint-RZ4nOpeP.js";
2
+ import { d, C } from "./Blueprint-RZ4nOpeP.js";
3
+ import { e, C as C2, f, l, g, n, k, q, o, p, r } from "./boolean2D-LUH72saA.js";
4
4
  function reverseCurve(curve) {
5
5
  const cloned = curve.clone();
6
6
  cloned.reverse();
@@ -1,12 +1,12 @@
1
1
  import { r as resolvePlane } from "./vectors-CpZfWX0T.js";
2
2
  import { a as toVec3 } from "./types-CWDdqcrq.js";
3
- import { q as getKernel, y as getKernel2D, z as registerForCleanup, A as unregisterFromCleanup, s as createEdge, r as createWire } from "./shapeTypes-D5th-THo.js";
4
- import { u as uvBounds, f as faceGeomType, e as faceCenter, h as uvCoordinates, c as cast } from "./faceFns-CScUN5LN.js";
5
- import { g as getOrientation } from "./curveFns-Vcss8w3g.js";
3
+ import { q as getKernel, y as getKernel2D, z as registerForCleanup, A as unregisterFromCleanup, s as createEdge, r as createWire } from "./shapeTypes-TnFxk2_h.js";
4
+ import { u as uvBounds, f as faceGeomType, e as faceCenter, h as uvCoordinates, c as cast } from "./faceFns-D309c5WF.js";
5
+ import { g as getOrientation } from "./curveFns-D1h3vwCh.js";
6
6
  import { o as ok, e as err, b as computationError, u as unwrap, x as validationError } from "./errors-C_XjfNt5.js";
7
- import { d as distance2d, s as samePoint, b as scalarMultiply2d, c as add2d, n as normalize2d, e as subtract2d, g as getSingleFace } from "./helpers-BUdSB_hP.js";
7
+ import { d as distance2d, s as samePoint, b as scalarMultiply2d, c as add2d, n as normalize2d, e as subtract2d, g as getSingleFace } from "./helpers-DW9uVcCI.js";
8
8
  import { R as RAD2DEG, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
9
- import { m as makeFace } from "./surfaceBuilders-CkDPvbwD.js";
9
+ import { m as makeFace } from "./surfaceBuilders-Cyr7_YMW.js";
10
10
  import { bug } from "./result.js";
11
11
  function makePlane(plane, origin) {
12
12
  if (plane && typeof plane !== "string") {
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  const vectors = require("./vectors-BwRTfFd1.cjs");
3
3
  const types = require("./types-CA_xrgDq.cjs");
4
- const shapeTypes = require("./shapeTypes-DIwQBQKB.cjs");
5
- const faceFns = require("./faceFns-Cqgs0uTB.cjs");
6
- const curveFns = require("./curveFns-CJ_Rhqu7.cjs");
4
+ const shapeTypes = require("./shapeTypes-BN_jZhmp.cjs");
5
+ const faceFns = require("./faceFns-CPfQsXwJ.cjs");
6
+ const curveFns = require("./curveFns-CjhxIaTL.cjs");
7
7
  const errors = require("./errors-HU7EpHt3.cjs");
8
- const helpers = require("./helpers-orCR-9t0.cjs");
8
+ const helpers = require("./helpers-DK4mR8qk.cjs");
9
9
  const vecOps = require("./vecOps-CjRL1jau.cjs");
10
- const surfaceBuilders = require("./surfaceBuilders-DbvODAS_.cjs");
10
+ const surfaceBuilders = require("./surfaceBuilders-Bj5RfOfU.cjs");
11
11
  const result = require("./result.cjs");
12
12
  function makePlane(plane, origin) {
13
13
  if (plane && typeof plane !== "string") {
@@ -46,16 +46,16 @@ var __callDispose = (stack, error, hasError) => {
46
46
  };
47
47
  const vectors = require("./vectors-BwRTfFd1.cjs");
48
48
  const errors = require("./errors-HU7EpHt3.cjs");
49
- const faceFns = require("./faceFns-Cqgs0uTB.cjs");
49
+ const faceFns = require("./faceFns-CPfQsXwJ.cjs");
50
50
  const types = require("./types-CA_xrgDq.cjs");
51
51
  const vecOps = require("./vecOps-CjRL1jau.cjs");
52
- const loft = require("./loft-DttG6eeq.cjs");
53
- const shapeTypes = require("./shapeTypes-DIwQBQKB.cjs");
54
- const curveFns = require("./curveFns-CJ_Rhqu7.cjs");
55
- const surfaceBuilders = require("./surfaceBuilders-DbvODAS_.cjs");
52
+ const loft = require("./loft-C6S8hKeh.cjs");
53
+ const shapeTypes = require("./shapeTypes-BN_jZhmp.cjs");
54
+ const curveFns = require("./curveFns-CjhxIaTL.cjs");
55
+ const surfaceBuilders = require("./surfaceBuilders-Bj5RfOfU.cjs");
56
56
  const result = require("./result.cjs");
57
- const helpers = require("./helpers-orCR-9t0.cjs");
58
- const Blueprint = require("./Blueprint-pgzr1snT.cjs");
57
+ const helpers = require("./helpers-DK4mR8qk.cjs");
58
+ const Blueprint = require("./Blueprint-UqKTCIA-.cjs");
59
59
  const intersectCurves = (first, second, precision = 1e-9) => {
60
60
  if (first.boundingBox.isOut(second.boundingBox))
61
61
  return errors.ok({ intersections: [], commonSegments: [], commonSegmentsPoints: [] });
@@ -45,16 +45,16 @@ var __callDispose = (stack, error, hasError) => {
45
45
  };
46
46
  import { a as createPlane } from "./vectors-CpZfWX0T.js";
47
47
  import { o as ok, e as err, b as computationError, u as unwrap, g as isOk } from "./errors-C_XjfNt5.js";
48
- import { d as downcast, u as uvBounds, p as pointOnSurface, n as normalAt } from "./faceFns-CScUN5LN.js";
48
+ import { d as downcast, u as uvBounds, p as pointOnSurface, n as normalAt } from "./faceFns-D309c5WF.js";
49
49
  import { a as toVec3 } from "./types-CWDdqcrq.js";
50
50
  import { n as vecScale, j as vecNormalize, b as vecCross, D as DEG2RAD, R as RAD2DEG } from "./vecOps-ZDdZWbwT.js";
51
- import { r as revolution, c as complexExtrude, t as twistExtrude, b as basicFaceExtrusion, g as genericSweep, l as loft } from "./loft-B6AuFlWT.js";
52
- import { y as getKernel2D, t as createFace, r as createWire, q as getKernel, s as createEdge, D as DisposalScope } from "./shapeTypes-D5th-THo.js";
53
- import { d as curveStartPoint, c as curveTangentAt, e as curveIsClosed } from "./curveFns-Vcss8w3g.js";
54
- import { m as makeFace, l as makeNewFaceWithinFace, b as assembleWire, z as zip } from "./surfaceBuilders-CkDPvbwD.js";
51
+ import { r as revolution, c as complexExtrude, t as twistExtrude, b as basicFaceExtrusion, g as genericSweep, l as loft } from "./loft-CRTLqcVq.js";
52
+ import { y as getKernel2D, t as createFace, r as createWire, q as getKernel, s as createEdge, D as DisposalScope } from "./shapeTypes-TnFxk2_h.js";
53
+ import { d as curveStartPoint, c as curveTangentAt, e as curveIsClosed } from "./curveFns-D1h3vwCh.js";
54
+ import { m as makeFace, l as makeNewFaceWithinFace, b as assembleWire, z as zip } from "./surfaceBuilders-Cyr7_YMW.js";
55
55
  import { bug } from "./result.js";
56
- import { s as samePoint$1, n as normalize2d, e as subtract2d, c as add2d, i as crossProduct2d, b as scalarMultiply2d, f as polarToCartesian, r as rotate2d, j as cartesianToPolar, d as distance2d, p as polarAngle2d, k as PRECISION_INTERSECTION } from "./helpers-BUdSB_hP.js";
57
- import { C as Curve2D, a as make2dSegmentCurve, j as approximateAsBSpline, b as make2dArcFromCenter, k as isPoint2D, g as make2dCircle, l as make2dThreePointArc, d as BoundingBox2d, v as viewbox, n as asSVG, B as Blueprint, o as make2dEllipseArc, p as make2dTangentArc, q as make2dBezierCurve, r as removeDuplicatePoints } from "./Blueprint-D-l9y6vQ.js";
56
+ import { s as samePoint$1, n as normalize2d, e as subtract2d, c as add2d, i as crossProduct2d, b as scalarMultiply2d, f as polarToCartesian, r as rotate2d, j as cartesianToPolar, d as distance2d, p as polarAngle2d, k as PRECISION_INTERSECTION } from "./helpers-DW9uVcCI.js";
57
+ import { C as Curve2D, a as make2dSegmentCurve, j as approximateAsBSpline, b as make2dArcFromCenter, k as isPoint2D, g as make2dCircle, l as make2dThreePointArc, d as BoundingBox2d, v as viewbox, n as asSVG, B as Blueprint, o as make2dEllipseArc, p as make2dTangentArc, q as make2dBezierCurve, r as removeDuplicatePoints } from "./Blueprint-RZ4nOpeP.js";
58
58
  const intersectCurves = (first, second, precision = 1e-9) => {
59
59
  if (first.boundingBox.isOut(second.boundingBox))
60
60
  return ok({ intersections: [], commonSegments: [], commonSegmentsPoints: [] });
@@ -1,12 +1,15 @@
1
1
  "use strict";
2
- const shapeTypes = require("./shapeTypes-DIwQBQKB.cjs");
2
+ const shapeTypes = require("./shapeTypes-BN_jZhmp.cjs");
3
3
  const errors = require("./errors-HU7EpHt3.cjs");
4
4
  const vectors = require("./vectors-BwRTfFd1.cjs");
5
5
  const vecOps = require("./vecOps-CjRL1jau.cjs");
6
- const shapeFns = require("./shapeFns-BvwnrLYU.cjs");
7
- const surfaceBuilders = require("./surfaceBuilders-DbvODAS_.cjs");
6
+ const shapeFns = require("./shapeFns-DEMjdpl7.cjs");
7
+ const surfaceBuilders = require("./surfaceBuilders-Bj5RfOfU.cjs");
8
8
  const shapeTagStore = /* @__PURE__ */ new WeakMap();
9
9
  const tagMetadataStore = /* @__PURE__ */ new WeakMap();
10
+ function hasFaceTags(shape) {
11
+ return shapeTagStore.has(shape.wrapped);
12
+ }
10
13
  function getTagMap(shape) {
11
14
  let map = shapeTagStore.get(shape.wrapped);
12
15
  if (!map) {
@@ -121,6 +124,9 @@ function propagateFaceTagsFromEvolution(evolution, inputs, result) {
121
124
  }
122
125
  const shapeColorStore = /* @__PURE__ */ new WeakMap();
123
126
  const faceColorStore = /* @__PURE__ */ new WeakMap();
127
+ function hasColorMetadata(shape) {
128
+ return shapeColorStore.has(shape.wrapped) || faceColorStore.has(shape.wrapped);
129
+ }
124
130
  function getFaceColorMap(shape) {
125
131
  let map = faceColorStore.get(shape.wrapped);
126
132
  if (!map) {
@@ -221,6 +227,10 @@ function castToShape3D(shape, errorCode, errorMsg) {
221
227
  return errors.ok(wrapped);
222
228
  }
223
229
  function collectInputFaceHashes(inputs) {
230
+ const hasMetadata = inputs.some(
231
+ (s) => shapeFns.getFaceOrigins(s) !== void 0 || hasFaceTags(s) || hasColorMetadata(s)
232
+ );
233
+ if (!hasMetadata) return [];
224
234
  const hashes = [];
225
235
  for (const input of inputs) {
226
236
  const faces = shapeTypes.getKernel().iterShapes(input.wrapped, "face");
@@ -230,7 +240,7 @@ function collectInputFaceHashes(inputs) {
230
240
  }
231
241
  return hashes;
232
242
  }
233
- function fuse(a, b, { optimisation = "none", simplify = false, signal } = {}) {
243
+ function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValue } = {}) {
234
244
  if (signal?.aborted) throw signal.reason;
235
245
  const checkA = validateShape3D(a, "fuse: first operand");
236
246
  if (errors.isErr(checkA)) return checkA;
@@ -242,7 +252,7 @@ function fuse(a, b, { optimisation = "none", simplify = false, signal } = {}) {
242
252
  b.wrapped,
243
253
  inputFaceHashes,
244
254
  vecOps.HASH_CODE_MAX,
245
- { optimisation, simplify }
255
+ { optimisation, simplify, fuzzyValue }
246
256
  );
247
257
  const fuseResult = castToShape3D(resultShape, "FUSE_NOT_3D", "Fuse did not produce a 3D shape");
248
258
  if (fuseResult.ok) {
@@ -252,7 +262,7 @@ function fuse(a, b, { optimisation = "none", simplify = false, signal } = {}) {
252
262
  }
253
263
  return fuseResult;
254
264
  }
255
- function cut(base, tool, { optimisation = "none", simplify = false, signal } = {}) {
265
+ function cut(base, tool, { optimisation = "none", simplify = false, signal, fuzzyValue } = {}) {
256
266
  if (signal?.aborted) throw signal.reason;
257
267
  const checkBase = validateShape3D(base, "cut: base");
258
268
  if (errors.isErr(checkBase)) return checkBase;
@@ -264,7 +274,7 @@ function cut(base, tool, { optimisation = "none", simplify = false, signal } = {
264
274
  tool.wrapped,
265
275
  inputFaceHashes,
266
276
  vecOps.HASH_CODE_MAX,
267
- { optimisation, simplify }
277
+ { optimisation, simplify, fuzzyValue }
268
278
  );
269
279
  const cutResult = castToShape3D(resultShape, "CUT_NOT_3D", "Cut did not produce a 3D shape");
270
280
  if (cutResult.ok) {
@@ -274,7 +284,7 @@ function cut(base, tool, { optimisation = "none", simplify = false, signal } = {
274
284
  }
275
285
  return cutResult;
276
286
  }
277
- function intersect(a, b, { simplify = false, signal } = {}) {
287
+ function intersect(a, b, { simplify = false, signal, fuzzyValue } = {}) {
278
288
  if (signal?.aborted) throw signal.reason;
279
289
  const checkA = validateShape3D(a, "intersect: first operand");
280
290
  if (errors.isErr(checkA)) return checkA;
@@ -286,7 +296,7 @@ function intersect(a, b, { simplify = false, signal } = {}) {
286
296
  b.wrapped,
287
297
  inputFaceHashes,
288
298
  vecOps.HASH_CODE_MAX,
289
- { simplify }
299
+ { simplify, fuzzyValue }
290
300
  );
291
301
  const intResult = castToShape3D(
292
302
  resultShape,
@@ -300,7 +310,7 @@ function intersect(a, b, { simplify = false, signal } = {}) {
300
310
  }
301
311
  return intResult;
302
312
  }
303
- function fuseAllPairwise(shapes, start, end, optimisation, simplify, isTopLevel, signal) {
313
+ function fuseAllPairwise(shapes, start, end, optimisation, simplify, isTopLevel, signal, fuzzyValue) {
304
314
  if (signal?.aborted) throw signal.reason;
305
315
  const count = end - start;
306
316
  if (count === 1) return errors.ok(shapes[start]);
@@ -308,21 +318,47 @@ function fuseAllPairwise(shapes, start, end, optimisation, simplify, isTopLevel,
308
318
  return fuse(shapes[start], shapes[start + 1], {
309
319
  optimisation,
310
320
  simplify: isTopLevel ? simplify : false,
321
+ fuzzyValue,
311
322
  ...signal ? { signal } : {}
312
323
  });
313
324
  }
314
325
  const mid = start + Math.ceil(count / 2);
315
- const leftResult = fuseAllPairwise(shapes, start, mid, optimisation, simplify, false, signal);
326
+ const leftResult = fuseAllPairwise(
327
+ shapes,
328
+ start,
329
+ mid,
330
+ optimisation,
331
+ simplify,
332
+ false,
333
+ signal,
334
+ fuzzyValue
335
+ );
316
336
  if (errors.isErr(leftResult)) return leftResult;
317
- const rightResult = fuseAllPairwise(shapes, mid, end, optimisation, simplify, false, signal);
337
+ const rightResult = fuseAllPairwise(
338
+ shapes,
339
+ mid,
340
+ end,
341
+ optimisation,
342
+ simplify,
343
+ false,
344
+ signal,
345
+ fuzzyValue
346
+ );
318
347
  if (errors.isErr(rightResult)) return rightResult;
319
348
  return fuse(leftResult.value, rightResult.value, {
320
349
  optimisation,
321
350
  simplify: isTopLevel ? simplify : false,
351
+ fuzzyValue,
322
352
  ...signal ? { signal } : {}
323
353
  });
324
354
  }
325
- function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "native", signal } = {}) {
355
+ function fuseAll(shapes, {
356
+ optimisation = "none",
357
+ simplify = false,
358
+ strategy = "native",
359
+ signal,
360
+ fuzzyValue
361
+ } = {}) {
326
362
  if (signal?.aborted) throw signal.reason;
327
363
  if (shapes.length === 0)
328
364
  return errors.err(errors.validationError("FUSE_ALL_EMPTY", "fuseAll requires at least one shape"));
@@ -334,7 +370,7 @@ function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "
334
370
  if (strategy === "native") {
335
371
  const result = shapeTypes.getKernel().fuseAll(
336
372
  shapes.map((s) => s.wrapped),
337
- { optimisation, simplify, strategy, ...signal ? { signal } : {} }
373
+ { optimisation, simplify, strategy, fuzzyValue, ...signal ? { signal } : {} }
338
374
  );
339
375
  const fuseAllResult = castToShape3D(
340
376
  result,
@@ -346,9 +382,18 @@ function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "
346
382
  }
347
383
  return fuseAllResult;
348
384
  }
349
- return fuseAllPairwise(shapes, 0, shapes.length, optimisation, simplify, true, signal);
385
+ return fuseAllPairwise(
386
+ shapes,
387
+ 0,
388
+ shapes.length,
389
+ optimisation,
390
+ simplify,
391
+ true,
392
+ signal,
393
+ fuzzyValue
394
+ );
350
395
  }
351
- function cutAll(base, tools, { optimisation = "none", simplify = false, signal } = {}) {
396
+ function cutAll(base, tools, { optimisation = "none", simplify = false, signal, fuzzyValue } = {}) {
352
397
  if (signal?.aborted) throw signal.reason;
353
398
  if (tools.length === 0) return errors.ok(base);
354
399
  const checkBase = validateShape3D(base, "cutAll: base");
@@ -365,7 +410,7 @@ function cutAll(base, tools, { optimisation = "none", simplify = false, signal }
365
410
  toolCompound,
366
411
  inputFaceHashes,
367
412
  vecOps.HASH_CODE_MAX,
368
- { optimisation, simplify }
413
+ { optimisation, simplify, fuzzyValue }
369
414
  );
370
415
  toolCompound.delete();
371
416
  const cutAllResult = castToShape3D(
@@ -559,6 +604,8 @@ exports.getFaceColor = getFaceColor;
559
604
  exports.getFaceTags = getFaceTags;
560
605
  exports.getShapeColor = getShapeColor;
561
606
  exports.getTagMetadata = getTagMetadata;
607
+ exports.hasColorMetadata = hasColorMetadata;
608
+ exports.hasFaceTags = hasFaceTags;
562
609
  exports.intersect = intersect;
563
610
  exports.propagateColorsFromEvolution = propagateColorsFromEvolution;
564
611
  exports.propagateFaceTagsFromEvolution = propagateFaceTagsFromEvolution;
@@ -1,11 +1,14 @@
1
- import { q as getKernel, c as castShape, j as isShape3D } from "./shapeTypes-D5th-THo.js";
1
+ import { q as getKernel, c as castShape, j as isShape3D } from "./shapeTypes-TnFxk2_h.js";
2
2
  import { o as ok, d as isErr, e as err, x as validationError, B as BrepErrorCode, p as typeCastError, k as kernelError } from "./errors-C_XjfNt5.js";
3
3
  import { r as resolvePlane } from "./vectors-CpZfWX0T.js";
4
4
  import { H as HASH_CODE_MAX, n as vecScale, v as vecAdd } from "./vecOps-ZDdZWbwT.js";
5
- import { a as getFaces, p as propagateOriginsFromEvolution, b as propagateOriginsByHash, c as getWires, d as getEdges, e as getVertices } from "./shapeFns-BiMiqVm0.js";
6
- import { m as makeFace } from "./surfaceBuilders-CkDPvbwD.js";
5
+ import { a as getFaces, p as propagateOriginsFromEvolution, b as propagateOriginsByHash, g as getFaceOrigins, c as getWires, d as getEdges, e as getVertices } from "./shapeFns-BvyqHHY6.js";
6
+ import { m as makeFace } from "./surfaceBuilders-Cyr7_YMW.js";
7
7
  const shapeTagStore = /* @__PURE__ */ new WeakMap();
8
8
  const tagMetadataStore = /* @__PURE__ */ new WeakMap();
9
+ function hasFaceTags(shape) {
10
+ return shapeTagStore.has(shape.wrapped);
11
+ }
9
12
  function getTagMap(shape) {
10
13
  let map = shapeTagStore.get(shape.wrapped);
11
14
  if (!map) {
@@ -120,6 +123,9 @@ function propagateFaceTagsFromEvolution(evolution, inputs, result) {
120
123
  }
121
124
  const shapeColorStore = /* @__PURE__ */ new WeakMap();
122
125
  const faceColorStore = /* @__PURE__ */ new WeakMap();
126
+ function hasColorMetadata(shape) {
127
+ return shapeColorStore.has(shape.wrapped) || faceColorStore.has(shape.wrapped);
128
+ }
123
129
  function getFaceColorMap(shape) {
124
130
  let map = faceColorStore.get(shape.wrapped);
125
131
  if (!map) {
@@ -220,6 +226,10 @@ function castToShape3D(shape, errorCode, errorMsg) {
220
226
  return ok(wrapped);
221
227
  }
222
228
  function collectInputFaceHashes(inputs) {
229
+ const hasMetadata = inputs.some(
230
+ (s) => getFaceOrigins(s) !== void 0 || hasFaceTags(s) || hasColorMetadata(s)
231
+ );
232
+ if (!hasMetadata) return [];
223
233
  const hashes = [];
224
234
  for (const input of inputs) {
225
235
  const faces = getKernel().iterShapes(input.wrapped, "face");
@@ -229,7 +239,7 @@ function collectInputFaceHashes(inputs) {
229
239
  }
230
240
  return hashes;
231
241
  }
232
- function fuse(a, b, { optimisation = "none", simplify = false, signal } = {}) {
242
+ function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValue } = {}) {
233
243
  if (signal?.aborted) throw signal.reason;
234
244
  const checkA = validateShape3D(a, "fuse: first operand");
235
245
  if (isErr(checkA)) return checkA;
@@ -241,7 +251,7 @@ function fuse(a, b, { optimisation = "none", simplify = false, signal } = {}) {
241
251
  b.wrapped,
242
252
  inputFaceHashes,
243
253
  HASH_CODE_MAX,
244
- { optimisation, simplify }
254
+ { optimisation, simplify, fuzzyValue }
245
255
  );
246
256
  const fuseResult = castToShape3D(resultShape, "FUSE_NOT_3D", "Fuse did not produce a 3D shape");
247
257
  if (fuseResult.ok) {
@@ -251,7 +261,7 @@ function fuse(a, b, { optimisation = "none", simplify = false, signal } = {}) {
251
261
  }
252
262
  return fuseResult;
253
263
  }
254
- function cut(base, tool, { optimisation = "none", simplify = false, signal } = {}) {
264
+ function cut(base, tool, { optimisation = "none", simplify = false, signal, fuzzyValue } = {}) {
255
265
  if (signal?.aborted) throw signal.reason;
256
266
  const checkBase = validateShape3D(base, "cut: base");
257
267
  if (isErr(checkBase)) return checkBase;
@@ -263,7 +273,7 @@ function cut(base, tool, { optimisation = "none", simplify = false, signal } = {
263
273
  tool.wrapped,
264
274
  inputFaceHashes,
265
275
  HASH_CODE_MAX,
266
- { optimisation, simplify }
276
+ { optimisation, simplify, fuzzyValue }
267
277
  );
268
278
  const cutResult = castToShape3D(resultShape, "CUT_NOT_3D", "Cut did not produce a 3D shape");
269
279
  if (cutResult.ok) {
@@ -273,7 +283,7 @@ function cut(base, tool, { optimisation = "none", simplify = false, signal } = {
273
283
  }
274
284
  return cutResult;
275
285
  }
276
- function intersect(a, b, { simplify = false, signal } = {}) {
286
+ function intersect(a, b, { simplify = false, signal, fuzzyValue } = {}) {
277
287
  if (signal?.aborted) throw signal.reason;
278
288
  const checkA = validateShape3D(a, "intersect: first operand");
279
289
  if (isErr(checkA)) return checkA;
@@ -285,7 +295,7 @@ function intersect(a, b, { simplify = false, signal } = {}) {
285
295
  b.wrapped,
286
296
  inputFaceHashes,
287
297
  HASH_CODE_MAX,
288
- { simplify }
298
+ { simplify, fuzzyValue }
289
299
  );
290
300
  const intResult = castToShape3D(
291
301
  resultShape,
@@ -299,7 +309,7 @@ function intersect(a, b, { simplify = false, signal } = {}) {
299
309
  }
300
310
  return intResult;
301
311
  }
302
- function fuseAllPairwise(shapes, start, end, optimisation, simplify, isTopLevel, signal) {
312
+ function fuseAllPairwise(shapes, start, end, optimisation, simplify, isTopLevel, signal, fuzzyValue) {
303
313
  if (signal?.aborted) throw signal.reason;
304
314
  const count = end - start;
305
315
  if (count === 1) return ok(shapes[start]);
@@ -307,21 +317,47 @@ function fuseAllPairwise(shapes, start, end, optimisation, simplify, isTopLevel,
307
317
  return fuse(shapes[start], shapes[start + 1], {
308
318
  optimisation,
309
319
  simplify: isTopLevel ? simplify : false,
320
+ fuzzyValue,
310
321
  ...signal ? { signal } : {}
311
322
  });
312
323
  }
313
324
  const mid = start + Math.ceil(count / 2);
314
- const leftResult = fuseAllPairwise(shapes, start, mid, optimisation, simplify, false, signal);
325
+ const leftResult = fuseAllPairwise(
326
+ shapes,
327
+ start,
328
+ mid,
329
+ optimisation,
330
+ simplify,
331
+ false,
332
+ signal,
333
+ fuzzyValue
334
+ );
315
335
  if (isErr(leftResult)) return leftResult;
316
- const rightResult = fuseAllPairwise(shapes, mid, end, optimisation, simplify, false, signal);
336
+ const rightResult = fuseAllPairwise(
337
+ shapes,
338
+ mid,
339
+ end,
340
+ optimisation,
341
+ simplify,
342
+ false,
343
+ signal,
344
+ fuzzyValue
345
+ );
317
346
  if (isErr(rightResult)) return rightResult;
318
347
  return fuse(leftResult.value, rightResult.value, {
319
348
  optimisation,
320
349
  simplify: isTopLevel ? simplify : false,
350
+ fuzzyValue,
321
351
  ...signal ? { signal } : {}
322
352
  });
323
353
  }
324
- function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "native", signal } = {}) {
354
+ function fuseAll(shapes, {
355
+ optimisation = "none",
356
+ simplify = false,
357
+ strategy = "native",
358
+ signal,
359
+ fuzzyValue
360
+ } = {}) {
325
361
  if (signal?.aborted) throw signal.reason;
326
362
  if (shapes.length === 0)
327
363
  return err(validationError("FUSE_ALL_EMPTY", "fuseAll requires at least one shape"));
@@ -333,7 +369,7 @@ function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "
333
369
  if (strategy === "native") {
334
370
  const result = getKernel().fuseAll(
335
371
  shapes.map((s) => s.wrapped),
336
- { optimisation, simplify, strategy, ...signal ? { signal } : {} }
372
+ { optimisation, simplify, strategy, fuzzyValue, ...signal ? { signal } : {} }
337
373
  );
338
374
  const fuseAllResult = castToShape3D(
339
375
  result,
@@ -345,9 +381,18 @@ function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "
345
381
  }
346
382
  return fuseAllResult;
347
383
  }
348
- return fuseAllPairwise(shapes, 0, shapes.length, optimisation, simplify, true, signal);
384
+ return fuseAllPairwise(
385
+ shapes,
386
+ 0,
387
+ shapes.length,
388
+ optimisation,
389
+ simplify,
390
+ true,
391
+ signal,
392
+ fuzzyValue
393
+ );
349
394
  }
350
- function cutAll(base, tools, { optimisation = "none", simplify = false, signal } = {}) {
395
+ function cutAll(base, tools, { optimisation = "none", simplify = false, signal, fuzzyValue } = {}) {
351
396
  if (signal?.aborted) throw signal.reason;
352
397
  if (tools.length === 0) return ok(base);
353
398
  const checkBase = validateShape3D(base, "cutAll: base");
@@ -364,7 +409,7 @@ function cutAll(base, tools, { optimisation = "none", simplify = false, signal }
364
409
  toolCompound,
365
410
  inputFaceHashes,
366
411
  HASH_CODE_MAX,
367
- { optimisation, simplify }
412
+ { optimisation, simplify, fuzzyValue }
368
413
  );
369
414
  toolCompound.delete();
370
415
  const cutAllResult = castToShape3D(
@@ -549,23 +594,25 @@ function slice(shape, planes, options = {}) {
549
594
  }
550
595
  export {
551
596
  propagateColorsFromEvolution as a,
552
- sectionToFace as b,
597
+ hasColorMetadata as b,
553
598
  cut as c,
554
- slice as d,
555
- split as e,
599
+ sectionToFace as d,
600
+ slice as e,
556
601
  fuse as f,
557
- fuseAll as g,
558
- cutAll as h,
602
+ split as g,
603
+ hasFaceTags as h,
559
604
  intersect as i,
560
- colorFaces as j,
561
- colorShape as k,
562
- findFacesByTag as l,
563
- getFaceColor as m,
564
- getFaceTags as n,
565
- getShapeColor as o,
605
+ fuseAll as j,
606
+ cutAll as k,
607
+ colorFaces as l,
608
+ colorShape as m,
609
+ findFacesByTag as n,
610
+ getFaceColor as o,
566
611
  propagateFaceTagsFromEvolution as p,
567
- getTagMetadata as q,
568
- setTagMetadata as r,
612
+ getFaceTags as q,
613
+ getShapeColor as r,
569
614
  section as s,
570
- tagFaces as t
615
+ getTagMetadata as t,
616
+ setTagMetadata as u,
617
+ tagFaces as v
571
618
  };
package/dist/brepjs.cjs CHANGED
@@ -45,30 +45,30 @@ var __callDispose = (stack, error, hasError) => {
45
45
  return next();
46
46
  };
47
47
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
48
- const shapeTypes = require("./shapeTypes-DIwQBQKB.cjs");
48
+ const shapeTypes = require("./shapeTypes-BN_jZhmp.cjs");
49
49
  const errors = require("./errors-HU7EpHt3.cjs");
50
50
  const vecOps = require("./vecOps-CjRL1jau.cjs");
51
- const Blueprint = require("./Blueprint-pgzr1snT.cjs");
52
- const loft$2 = require("./loft-DttG6eeq.cjs");
53
- const operations = require("./operations-B1uuSLB2.cjs");
54
- const boolean2D = require("./boolean2D-DEQvy9jN.cjs");
51
+ const Blueprint = require("./Blueprint-UqKTCIA-.cjs");
52
+ const loft$2 = require("./loft-C6S8hKeh.cjs");
53
+ const operations = require("./operations-U2R99SDL.cjs");
54
+ const boolean2D = require("./boolean2D-B1uobQA4.cjs");
55
55
  const _2d = require("./2d.cjs");
56
- const helpers = require("./helpers-orCR-9t0.cjs");
56
+ const helpers = require("./helpers-DK4mR8qk.cjs");
57
57
  const io = require("./io.cjs");
58
- const drawFns = require("./drawFns-BMN2P_95.cjs");
58
+ const drawFns = require("./drawFns-Dcy-HIjE.cjs");
59
59
  const types = require("./types-CA_xrgDq.cjs");
60
60
  const vectors = require("./vectors-BwRTfFd1.cjs");
61
- const shapeFns = require("./shapeFns-BvwnrLYU.cjs");
62
- const booleanFns = require("./booleanFns-CKJpkL-W.cjs");
63
- const topology = require("./topology-BndoQLIN.cjs");
64
- const curveFns = require("./curveFns-CJ_Rhqu7.cjs");
65
- const faceFns = require("./faceFns-Cqgs0uTB.cjs");
66
- const meshFns = require("./meshFns-CCrO47TM.cjs");
67
- const measurement = require("./measurement-D61iSCBv.cjs");
68
- const surfaceBuilders = require("./surfaceBuilders-DbvODAS_.cjs");
61
+ const shapeFns = require("./shapeFns-DEMjdpl7.cjs");
62
+ const booleanFns = require("./booleanFns-Bl2o8KOm.cjs");
63
+ const topology = require("./topology-D2rTk0_j.cjs");
64
+ const curveFns = require("./curveFns-CjhxIaTL.cjs");
65
+ const faceFns = require("./faceFns-CPfQsXwJ.cjs");
66
+ const meshFns = require("./meshFns-DI87__D1.cjs");
67
+ const measurement = require("./measurement-CgFnyeP-.cjs");
68
+ const surfaceBuilders = require("./surfaceBuilders-Bj5RfOfU.cjs");
69
69
  const query = require("./query.cjs");
70
70
  const result = require("./result.cjs");
71
- const cornerFinder = require("./cornerFinder-BKSnwYl_.cjs");
71
+ const cornerFinder = require("./cornerFinder-BPV6q1Vj.cjs");
72
72
  const worker = require("./worker.cjs");
73
73
  function supportsProjection(kernel) {
74
74
  return "projectShape" in kernel;
@@ -1355,8 +1355,10 @@ function checkInterference(shape1, shape2, tolerance = 1e-6) {
1355
1355
  }
1356
1356
  function checkAllInterferences(shapes, tolerance = 1e-6) {
1357
1357
  const pairs = [];
1358
+ const boxes = shapes.map((s) => shapeFns.getBounds(s));
1358
1359
  shapes.forEach((si, i) => {
1359
1360
  for (let j = i + 1; j < shapes.length; j++) {
1361
+ if (aabbDisjoint(boxes[i], boxes[j], tolerance)) continue;
1360
1362
  const result2 = errors.unwrap(checkInterference(si, shapes[j], tolerance));
1361
1363
  if (result2.hasInterference) {
1362
1364
  pairs.push({ i, j, result: result2 });
@@ -1365,6 +1367,9 @@ function checkAllInterferences(shapes, tolerance = 1e-6) {
1365
1367
  });
1366
1368
  return pairs;
1367
1369
  }
1370
+ function aabbDisjoint(a, b, tolerance) {
1371
+ return a.xMax + tolerance < b.xMin || b.xMax + tolerance < a.xMin || a.yMax + tolerance < b.yMin || b.yMax + tolerance < a.yMin || a.zMax + tolerance < b.zMin || b.zMax + tolerance < a.zMin;
1372
+ }
1368
1373
  function parseEntities(text) {
1369
1374
  const lines = text.split(/\r?\n/);
1370
1375
  const entities = [];
@@ -1838,6 +1843,10 @@ function validateNotNull(shape2, label) {
1838
1843
  return errors.ok(void 0);
1839
1844
  }
1840
1845
  function collectInputFaceHashes(inputs) {
1846
+ const hasMetadata = inputs.some((s) => {
1847
+ return shapeFns.getFaceOrigins(s) !== void 0 || booleanFns.hasFaceTags(s) || booleanFns.hasColorMetadata(s);
1848
+ });
1849
+ if (!hasMetadata) return [];
1841
1850
  const hashes = [];
1842
1851
  for (const input of inputs) {
1843
1852
  const faces = shapeTypes.getKernel().iterShapes(input.wrapped, "face");