brepjs 13.4.0 → 14.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/2d.cjs +15 -14
  2. package/dist/2d.js +6 -5
  3. package/dist/arrayAccess-CmulMesb.cjs +40 -0
  4. package/dist/arrayAccess-xxcB3YNq.js +23 -0
  5. package/dist/{blueprint-CDnBM-tA.cjs → blueprint-C6B--LQ6.cjs} +13 -13
  6. package/dist/{blueprint-CB_85Lz_.js → blueprint-CzFYcmzV.js} +9 -9
  7. package/dist/{blueprintFns-D4YucGaQ.cjs → blueprintFns-B2AvzIXt.cjs} +3 -142
  8. package/dist/{blueprintFns-DVDommWB.js → blueprintFns-wka8INr_.js} +4 -125
  9. package/dist/{boolean2D-lqfKJKUY.cjs → boolean2D-6bQx64bR.cjs} +19 -18
  10. package/dist/{boolean2D-Mzp-0g7o.js → boolean2D-CfCt_m29.js} +12 -11
  11. package/dist/{booleanFns-B46fgObh.js → booleanFns-B6zxpf96.js} +8 -6
  12. package/dist/{booleanFns-Bw8sAMgI.cjs → booleanFns-C2pjUC6-.cjs} +24 -22
  13. package/dist/brepjs.cjs +301 -90
  14. package/dist/brepjs.js +189 -26
  15. package/dist/constants-B9u763C3.js +9 -0
  16. package/dist/constants-unWN8k4c.cjs +26 -0
  17. package/dist/core/errors.d.ts +5 -1
  18. package/dist/core/errors.d.ts.map +1 -1
  19. package/dist/core/kernelCall.d.ts.map +1 -1
  20. package/dist/core/kernelErrorTranslation.d.ts +2 -0
  21. package/dist/core/kernelErrorTranslation.d.ts.map +1 -1
  22. package/dist/core.cjs +8 -7
  23. package/dist/core.js +5 -4
  24. package/dist/{cornerFinder-aBLykolI.js → cornerFinder-DBXma4vL.js} +3 -3
  25. package/dist/{cornerFinder-BszIcLqj.cjs → cornerFinder-DrHIlWCS.cjs} +4 -4
  26. package/dist/{curveFns-CZszKLQB.cjs → curveFns-C_vQNb7-.cjs} +2 -2
  27. package/dist/{curveFns-DY4dFcP-.js → curveFns-DmID8AQO.js} +2 -2
  28. package/dist/{drawFns-BHNDF8hb.cjs → drawFns-DRG-UpkW.cjs} +34 -17
  29. package/dist/{drawFns-l5CY2s-l.js → drawFns-rLQIZezc.js} +16 -14
  30. package/dist/{errors-BlC5ZWv4.cjs → errors-9zQcQK1H.cjs} +28 -0
  31. package/dist/{errors-BVOlxlIA.js → errors-C-cgQA3w.js} +23 -1
  32. package/dist/{extrudeFns-b0uLn4E4.js → extrudeFns-1qcdK9dq.js} +3 -3
  33. package/dist/{extrudeFns-GpCB_Uzs.cjs → extrudeFns-BP7fNL5O.cjs} +3 -3
  34. package/dist/{faceFns-Cat-4X74.js → faceFns-BHT5DAOL.js} +93 -3
  35. package/dist/{faceFns-BywUjlJ7.cjs → faceFns-BwzwlBjE.cjs} +110 -2
  36. package/dist/{helpers-DgX1UucG.js → helpers-B94CkHQe.js} +8 -7
  37. package/dist/{helpers-1iCCEElA.cjs → helpers-C4Ajoc6x.cjs} +18 -17
  38. package/dist/{historyFns-BFwp8NLX.js → historyFns-BsSuAQ0m.js} +10 -10
  39. package/dist/{historyFns-DqxDtXIZ.cjs → historyFns-CrsjeD69.cjs} +10 -10
  40. package/dist/{importFns-ChXEJAvu.cjs → importFns-DPwXjtkm.cjs} +4 -4
  41. package/dist/{importFns-Cb8fcldB.js → importFns-DQsQOpRY.js} +4 -4
  42. package/dist/index.d.ts +11 -0
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/io.cjs +2 -2
  45. package/dist/io.js +2 -2
  46. package/dist/kernel/brepkit/brepkitAdapter.d.ts +149 -242
  47. package/dist/kernel/brepkit/brepkitAdapter.d.ts.map +1 -1
  48. package/dist/kernel/brepkit/evolutionOps.d.ts +1 -0
  49. package/dist/kernel/brepkit/evolutionOps.d.ts.map +1 -1
  50. package/dist/kernel/index.d.ts +1 -1
  51. package/dist/kernel/index.d.ts.map +1 -1
  52. package/dist/{measureFns-D3rAp1X1.js → measureFns-iarjC69-.js} +9 -16
  53. package/dist/{measureFns-Bx-kl7_g.cjs → measureFns-j1ze9DDM.cjs} +9 -16
  54. package/dist/measurement/measureFns.d.ts.map +1 -1
  55. package/dist/measurement.cjs +1 -1
  56. package/dist/measurement.js +1 -1
  57. package/dist/{meshFns-D3KAZ_ma.cjs → meshFns-CONktkIA.cjs} +4 -4
  58. package/dist/{meshFns-BPi0bhm9.js → meshFns-DRl9xnbO.js} +3 -3
  59. package/dist/ns/booleans.d.ts +10 -0
  60. package/dist/ns/booleans.d.ts.map +1 -0
  61. package/dist/ns/construction.d.ts +10 -0
  62. package/dist/ns/construction.d.ts.map +1 -0
  63. package/dist/ns/ioNs.d.ts +18 -0
  64. package/dist/ns/ioNs.d.ts.map +1 -0
  65. package/dist/ns/measurement.d.ts +6 -0
  66. package/dist/ns/measurement.d.ts.map +1 -0
  67. package/dist/ns/modifiers.d.ts +6 -0
  68. package/dist/ns/modifiers.d.ts.map +1 -0
  69. package/dist/ns/patterns.d.ts +5 -0
  70. package/dist/ns/patterns.d.ts.map +1 -0
  71. package/dist/ns/primitives.d.ts +7 -0
  72. package/dist/ns/primitives.d.ts.map +1 -0
  73. package/dist/ns/query.d.ts +6 -0
  74. package/dist/ns/query.d.ts.map +1 -0
  75. package/dist/ns/transforms.d.ts +5 -0
  76. package/dist/ns/transforms.d.ts.map +1 -0
  77. package/dist/operations.cjs +2 -2
  78. package/dist/operations.js +2 -2
  79. package/dist/{planeOps-BqLav0Ir.cjs → planeOps-6Wu7dMDN.cjs} +4 -3
  80. package/dist/{planeOps-D88tfyJs.js → planeOps-gTOEarV2.js} +3 -2
  81. package/dist/{primitiveFns-BGh9A9jR.cjs → primitiveFns-CGg6EBKg.cjs} +69 -69
  82. package/dist/{primitiveFns-CnZkW6Bi.js → primitiveFns-CMIscOrN.js} +7 -7
  83. package/dist/query.cjs +2 -2
  84. package/dist/query.js +2 -2
  85. package/dist/result.cjs +1 -1
  86. package/dist/result.js +1 -1
  87. package/dist/{arrayAccess-B5LgmXBo.js → shapeFns-Brq2J-mW.js} +8 -30
  88. package/dist/{arrayAccess-t2dlxGSK.cjs → shapeFns-DY7pjzrz.cjs} +24 -64
  89. package/dist/shapeRef.cjs +8 -0
  90. package/dist/shapeRef.d.ts +5 -0
  91. package/dist/shapeRef.d.ts.map +1 -0
  92. package/dist/shapeRef.js +2 -0
  93. package/dist/shapeRefFns-BOljxSxd.cjs +229 -0
  94. package/dist/shapeRefFns-BqOlRA7C.js +194 -0
  95. package/dist/{shapeTypes-8eK48l-X.cjs → shapeTypes-B3kwoJWf.cjs} +2643 -2551
  96. package/dist/{shapeTypes-Di6GlhPk.js → shapeTypes-CoNj-AHu.js} +2644 -2552
  97. package/dist/sketching.cjs +2 -2
  98. package/dist/sketching.js +2 -2
  99. package/dist/{solidBuilders-ctO_wFrm.js → solidBuilders-BzIatk9a.js} +3 -3
  100. package/dist/{solidBuilders-D9KYP9sL.cjs → solidBuilders-V8qvmW7h.cjs} +3 -3
  101. package/dist/{surfaceBuilders-BaqeZa0x.js → surfaceBuilders-Cfo4nH6A.js} +3 -3
  102. package/dist/{surfaceBuilders-CZzipftq.cjs → surfaceBuilders-CoiofY0Y.cjs} +3 -3
  103. package/dist/topology/api.d.ts +3 -3
  104. package/dist/topology/api.d.ts.map +1 -1
  105. package/dist/topology/shapeFns.d.ts +4 -3
  106. package/dist/topology/shapeFns.d.ts.map +1 -1
  107. package/dist/topology/shapeRef/index.d.ts +7 -0
  108. package/dist/topology/shapeRef/index.d.ts.map +1 -0
  109. package/dist/topology/shapeRef/scoring.d.ts +16 -0
  110. package/dist/topology/shapeRef/scoring.d.ts.map +1 -0
  111. package/dist/topology/shapeRef/shapeRefFns.d.ts +47 -0
  112. package/dist/topology/shapeRef/shapeRefFns.d.ts.map +1 -0
  113. package/dist/topology/shapeRef/shapeRefTypes.d.ts +40 -0
  114. package/dist/topology/shapeRef/shapeRefTypes.d.ts.map +1 -0
  115. package/dist/topology.cjs +20 -20
  116. package/dist/topology.js +6 -6
  117. package/dist/{vecOps-DKGelwGL.cjs → vecOps-BXvBYIor.cjs} +0 -26
  118. package/dist/{vecOps-DFfUfsmc.js → vecOps-D9etjPgV.js} +1 -9
  119. package/dist/vectors.cjs +5 -4
  120. package/dist/vectors.js +3 -2
  121. package/dist/worker.cjs +1 -1
  122. package/dist/worker.js +1 -1
  123. package/package.json +14 -4
  124. /package/dist/{workerHandler-nLkvSOKX.cjs → workerHandler-C-7OUJsa.cjs} +0 -0
  125. /package/dist/{workerHandler-BrOTzYRI.js → workerHandler-o2xzAfFk.js} +0 -0
@@ -1,9 +1,11 @@
1
- import { Y as getKernel, h as isShape3D, t as castShape } from "./shapeTypes-Di6GlhPk.js";
2
- import { C as isErr, L as unwrap, d as validationError, i as kernelError, k as ok, l as typeCastError, t as BrepErrorCode, y as err } from "./errors-BVOlxlIA.js";
3
- import { h as vecScale, t as vecAdd, v as HASH_CODE_MAX } from "./vecOps-DFfUfsmc.js";
4
- import { o as resolvePlane } from "./planeOps-D88tfyJs.js";
5
- import { F as getEdges, R as getVertices, b as propagateAllMetadata, n as getAtOrThrow, t as firstOrThrow, x as propagateMetadataByHash, y as collectInputFaceHashes, z as getWires } from "./arrayAccess-B5LgmXBo.js";
6
- import { r as makeFace } from "./surfaceBuilders-BaqeZa0x.js";
1
+ import { Y as getKernel, h as isShape3D, t as castShape } from "./shapeTypes-CoNj-AHu.js";
2
+ import { A as ok, R as unwrap, b as err, d as validationError, i as kernelError, l as typeCastError, t as BrepErrorCode, w as isErr } from "./errors-C-cgQA3w.js";
3
+ import { n as HASH_CODE_MAX } from "./constants-B9u763C3.js";
4
+ import { h as vecScale, t as vecAdd } from "./vecOps-D9etjPgV.js";
5
+ import { o as resolvePlane } from "./planeOps-gTOEarV2.js";
6
+ import { F as getVertices, I as getWires, M as getEdges, _ as propagateAllMetadata, g as collectInputFaceHashes, v as propagateMetadataByHash } from "./shapeFns-Brq2J-mW.js";
7
+ import { n as getAtOrThrow, t as firstOrThrow } from "./arrayAccess-xxcB3YNq.js";
8
+ import { r as makeFace } from "./surfaceBuilders-Cfo4nH6A.js";
7
9
  //#region src/topology/booleanFns.ts
8
10
  /**
9
11
  * Boolean and compound operations — functional replacements for _3DShape boolean methods.
@@ -1,9 +1,11 @@
1
- const require_shapeTypes = require("./shapeTypes-8eK48l-X.cjs");
2
- const require_errors = require("./errors-BlC5ZWv4.cjs");
3
- const require_vecOps = require("./vecOps-DKGelwGL.cjs");
4
- const require_planeOps = require("./planeOps-BqLav0Ir.cjs");
5
- const require_arrayAccess = require("./arrayAccess-t2dlxGSK.cjs");
6
- const require_surfaceBuilders = require("./surfaceBuilders-CZzipftq.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-B3kwoJWf.cjs");
2
+ const require_errors = require("./errors-9zQcQK1H.cjs");
3
+ const require_constants = require("./constants-unWN8k4c.cjs");
4
+ const require_vecOps = require("./vecOps-BXvBYIor.cjs");
5
+ const require_planeOps = require("./planeOps-6Wu7dMDN.cjs");
6
+ const require_shapeFns = require("./shapeFns-DY7pjzrz.cjs");
7
+ const require_arrayAccess = require("./arrayAccess-CmulMesb.cjs");
8
+ const require_surfaceBuilders = require("./surfaceBuilders-CoiofY0Y.cjs");
7
9
  //#region src/topology/booleanFns.ts
8
10
  /**
9
11
  * Boolean and compound operations — functional replacements for _3DShape boolean methods.
@@ -39,8 +41,8 @@ function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValu
39
41
  if (require_errors.isErr(checkA)) return checkA;
40
42
  const checkB = validateShape3D(b, "fuse: second operand");
41
43
  if (require_errors.isErr(checkB)) return checkB;
42
- const inputFaceHashes = require_arrayAccess.collectInputFaceHashes([a, b]);
43
- const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().fuseWithHistory(a.wrapped, b.wrapped, inputFaceHashes, require_vecOps.HASH_CODE_MAX, {
44
+ const inputFaceHashes = require_shapeFns.collectInputFaceHashes([a, b]);
45
+ const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().fuseWithHistory(a.wrapped, b.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
44
46
  optimisation,
45
47
  simplify,
46
48
  fuzzyValue
@@ -50,7 +52,7 @@ function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValu
50
52
  return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.BOOLEAN_HAS_ERRORS, "Boolean operation reported internal errors. The result may be invalid.", void 0, { diagnostics }, "Use checkBoolean() to pre-validate operands, or try autoHeal() on inputs."));
51
53
  }
52
54
  const fuseResult = castToShape3D(resultShape, "FUSE_NOT_3D", "Fuse did not produce a 3D shape", "Common causes: overlapping coplanar faces, zero-thickness geometry, or non-manifold input. Try autoHeal() on inputs first.", diagnostics);
53
- if (fuseResult.ok) require_arrayAccess.propagateAllMetadata(evolution, [a, b], fuseResult.value);
55
+ if (fuseResult.ok) require_shapeFns.propagateAllMetadata(evolution, [a, b], fuseResult.value);
54
56
  return fuseResult;
55
57
  }
56
58
  function cut(base, tool, { optimisation = "none", simplify = false, signal, fuzzyValue, unsafe: _unsafe } = {}) {
@@ -59,8 +61,8 @@ function cut(base, tool, { optimisation = "none", simplify = false, signal, fuzz
59
61
  if (require_errors.isErr(checkBase)) return checkBase;
60
62
  const checkTool = validateShape3D(tool, "cut: tool");
61
63
  if (require_errors.isErr(checkTool)) return checkTool;
62
- const inputFaceHashes = require_arrayAccess.collectInputFaceHashes([base, tool]);
63
- const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().cutWithHistory(base.wrapped, tool.wrapped, inputFaceHashes, require_vecOps.HASH_CODE_MAX, {
64
+ const inputFaceHashes = require_shapeFns.collectInputFaceHashes([base, tool]);
65
+ const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().cutWithHistory(base.wrapped, tool.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
64
66
  optimisation,
65
67
  simplify,
66
68
  fuzzyValue
@@ -70,7 +72,7 @@ function cut(base, tool, { optimisation = "none", simplify = false, signal, fuzz
70
72
  return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.BOOLEAN_HAS_ERRORS, "Boolean operation reported internal errors. The result may be invalid.", void 0, { diagnostics }, "Use checkBoolean() to pre-validate operands, or try autoHeal() on inputs."));
71
73
  }
72
74
  const cutResult = castToShape3D(resultShape, "CUT_NOT_3D", "Cut did not produce a 3D shape", "Common causes: tool does not fully intersect the base, or produces a zero-thickness sliver. Ensure the tool extends through the shape.", diagnostics);
73
- if (cutResult.ok) require_arrayAccess.propagateAllMetadata(evolution, [base, tool], cutResult.value);
75
+ if (cutResult.ok) require_shapeFns.propagateAllMetadata(evolution, [base, tool], cutResult.value);
74
76
  return cutResult;
75
77
  }
76
78
  function intersect(a, b, { simplify = false, signal, fuzzyValue, unsafe: _unsafe } = {}) {
@@ -79,8 +81,8 @@ function intersect(a, b, { simplify = false, signal, fuzzyValue, unsafe: _unsafe
79
81
  if (require_errors.isErr(checkA)) return checkA;
80
82
  const checkB = validateShape3D(b, "intersect: second operand");
81
83
  if (require_errors.isErr(checkB)) return checkB;
82
- const inputFaceHashes = require_arrayAccess.collectInputFaceHashes([a, b]);
83
- const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().intersectWithHistory(a.wrapped, b.wrapped, inputFaceHashes, require_vecOps.HASH_CODE_MAX, {
84
+ const inputFaceHashes = require_shapeFns.collectInputFaceHashes([a, b]);
85
+ const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().intersectWithHistory(a.wrapped, b.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
84
86
  simplify,
85
87
  fuzzyValue
86
88
  });
@@ -89,7 +91,7 @@ function intersect(a, b, { simplify = false, signal, fuzzyValue, unsafe: _unsafe
89
91
  return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.BOOLEAN_HAS_ERRORS, "Boolean operation reported internal errors. The result may be invalid.", void 0, { diagnostics }, "Use checkBoolean() to pre-validate operands, or try autoHeal() on inputs."));
90
92
  }
91
93
  const intResult = castToShape3D(resultShape, "INTERSECT_NOT_3D", "Intersect did not produce a 3D shape", "Shapes may not overlap. Verify they share a common volume before intersecting.", diagnostics);
92
- if (intResult.ok) require_arrayAccess.propagateAllMetadata(evolution, [a, b], intResult.value);
94
+ if (intResult.ok) require_shapeFns.propagateAllMetadata(evolution, [a, b], intResult.value);
93
95
  return intResult;
94
96
  }
95
97
  /**
@@ -135,7 +137,7 @@ function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "
135
137
  fuzzyValue,
136
138
  ...signal ? { signal } : {}
137
139
  }), "FUSE_ALL_NOT_3D", "fuseAll did not produce a 3D shape");
138
- if (fuseAllResult.ok) require_arrayAccess.propagateMetadataByHash(shapes, fuseAllResult.value);
140
+ if (fuseAllResult.ok) require_shapeFns.propagateMetadataByHash(shapes, fuseAllResult.value);
139
141
  return fuseAllResult;
140
142
  }
141
143
  return fuseAllPairwise(shapes, 0, shapes.length, optimisation, simplify, true, signal, fuzzyValue);
@@ -155,7 +157,7 @@ function cutAll(base, tools, { optimisation = "none", simplify = false, signal,
155
157
  simplify,
156
158
  fuzzyValue
157
159
  }), "CUT_ALL_NOT_3D", "cutAll did not produce a 3D shape");
158
- if (cutAllResult.ok) require_arrayAccess.propagateMetadataByHash(allInputs, cutAllResult.value);
160
+ if (cutAllResult.ok) require_shapeFns.propagateMetadataByHash(allInputs, cutAllResult.value);
159
161
  return cutAllResult;
160
162
  }
161
163
  /**
@@ -220,9 +222,9 @@ function buildEdgeAdjacency(edges) {
220
222
  const vertexToEdges = /* @__PURE__ */ new Map();
221
223
  const edgeVertexHashes = /* @__PURE__ */ new Map();
222
224
  for (const edge of edges) {
223
- const verts = require_arrayAccess.getVertices(edge);
224
- const h0 = verts[0] ? kernel.hashCode(verts[0].wrapped, require_vecOps.HASH_CODE_MAX) : -1;
225
- const h1 = verts.length > 1 && verts[1] ? kernel.hashCode(verts[1].wrapped, require_vecOps.HASH_CODE_MAX) : h0;
225
+ const verts = require_shapeFns.getVertices(edge);
226
+ const h0 = verts[0] ? kernel.hashCode(verts[0].wrapped, require_constants.HASH_CODE_MAX) : -1;
227
+ const h1 = verts.length > 1 && verts[1] ? kernel.hashCode(verts[1].wrapped, require_constants.HASH_CODE_MAX) : h0;
226
228
  edgeVertexHashes.set(edge, [h0, h1]);
227
229
  for (const h of [h0, h1]) {
228
230
  const bucket = vertexToEdges.get(h) ?? [];
@@ -326,9 +328,9 @@ function findOuterWireIndex(wires) {
326
328
  function sectionToFace(shape, plane, options = {}) {
327
329
  const sectionResult = section(shape, plane, options);
328
330
  if (!sectionResult.ok) return sectionResult;
329
- const wires = require_arrayAccess.getWires(sectionResult.value);
331
+ const wires = require_shapeFns.getWires(sectionResult.value);
330
332
  if (wires.length === 0) {
331
- const edges = require_arrayAccess.getEdges(sectionResult.value);
333
+ const edges = require_shapeFns.getEdges(sectionResult.value);
332
334
  if (edges.length === 0) return require_errors.err(require_errors.kernelError("SECTION_FAILED", "sectionToFace: section produced no geometry", void 0, void 0, "The cutting plane may not intersect the shape. Verify plane position relative to shape bounds."));
333
335
  wires.push(...assembleWiresFromEdges(edges));
334
336
  }