brepjs 8.4.0 → 8.7.4

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 (114) hide show
  1. package/dist/2d.cjs +2 -2
  2. package/dist/2d.js +13 -13
  3. package/dist/{Blueprint-zgFe_5Qj.cjs → Blueprint-BcbOBF-9.cjs} +11 -99
  4. package/dist/{Blueprint-Bp45tnh0.js → Blueprint-Cmh8lKc4.js} +29 -117
  5. package/dist/{boolean2D-CfEbRMPF.cjs → boolean2D-CqacqjME.cjs} +24 -25
  6. package/dist/{boolean2D-DN6ETTCq.js → boolean2D-D94Axs3i.js} +23 -24
  7. package/dist/{booleanFns-C-M6qqvB.js → booleanFns-DdjtpcM6.js} +306 -12
  8. package/dist/{booleanFns-5dDG0jpA.cjs → booleanFns-NtKxkiXn.cjs} +299 -5
  9. package/dist/brepjs.cjs +1619 -71
  10. package/dist/brepjs.js +1880 -333
  11. package/dist/core/errors.d.ts +18 -0
  12. package/dist/core/errors.d.ts.map +1 -1
  13. package/dist/core.cjs +4 -4
  14. package/dist/core.js +4 -4
  15. package/dist/{cornerFinder-CC_MunIh.js → cornerFinder-BBOYfsXl.js} +1 -1
  16. package/dist/{cornerFinder-BQ-_VJx0.cjs → cornerFinder-Bqy8Lw2p.cjs} +1 -1
  17. package/dist/{curveFns-ZuQUBZvd.js → curveFns-B85Glnfo.js} +19 -17
  18. package/dist/{curveFns-VMxgfkqw.cjs → curveFns-BXCbASW-.cjs} +6 -4
  19. package/dist/{drawFns-BbhX1IUq.js → drawFns-B-gJ2WUc.js} +47 -21
  20. package/dist/{drawFns-CKaHgGSK.cjs → drawFns-CAmFEqd1.cjs} +63 -37
  21. package/dist/{errors-CSYOlCCR.js → errors-Coh_5_19.js} +26 -1
  22. package/dist/{errors-D13q2HCk.cjs → errors-eRQu29oc.cjs} +26 -1
  23. package/dist/{faceFns-CfJIbHY3.js → faceFns-CltrEfOo.js} +109 -12
  24. package/dist/{faceFns-es3GENII.cjs → faceFns-DcndPHWm.cjs} +103 -6
  25. package/dist/{helpers-C0q_FVxq.cjs → helpers-CC21GeAr.cjs} +8 -9
  26. package/dist/{helpers-CmVkMubc.js → helpers-SksQIreB.js} +16 -17
  27. package/dist/index.d.ts +18 -3
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/io/dxfImportFns.d.ts +17 -0
  30. package/dist/io/dxfImportFns.d.ts.map +1 -0
  31. package/dist/io/objImportFns.d.ts +19 -0
  32. package/dist/io/objImportFns.d.ts.map +1 -0
  33. package/dist/io/threemfImportFns.d.ts +19 -0
  34. package/dist/io/threemfImportFns.d.ts.map +1 -0
  35. package/dist/io.cjs +5 -5
  36. package/dist/io.js +5 -5
  37. package/dist/kernel/hullOps.d.ts +1 -0
  38. package/dist/kernel/hullOps.d.ts.map +1 -1
  39. package/dist/kernel/occtAdapter.d.ts +5 -0
  40. package/dist/kernel/occtAdapter.d.ts.map +1 -1
  41. package/dist/kernel/solverAdapter.d.ts +39 -0
  42. package/dist/kernel/solverAdapter.d.ts.map +1 -0
  43. package/dist/kernel/types.d.ts +5 -0
  44. package/dist/kernel/types.d.ts.map +1 -1
  45. package/dist/{loft-B-UCPW9P.cjs → loft-BcyyvWCj.cjs} +28 -28
  46. package/dist/{loft-oJq2OD3A.js → loft-CJMPx1NQ.js} +16 -16
  47. package/dist/{measurement-Cf_SoIiR.js → measurement-ByOztLxb.js} +3 -3
  48. package/dist/{measurement-CYmT-C77.cjs → measurement-DU3ry-0Q.cjs} +3 -3
  49. package/dist/measurement.cjs +1 -1
  50. package/dist/measurement.js +1 -1
  51. package/dist/{meshFns-CqNwW0PO.js → meshFns-D2gLyLFt.js} +3 -3
  52. package/dist/{meshFns-DDC_2U81.cjs → meshFns-DawUwI3W.cjs} +3 -3
  53. package/dist/{occtBoundary-D_gjqgzo.js → occtBoundary-CWzWqBCm.js} +17 -5
  54. package/dist/{occtBoundary-CocN2VKx.cjs → occtBoundary-DH2VO-rq.cjs} +12 -0
  55. package/dist/operations/assemblyFns.d.ts +1 -0
  56. package/dist/operations/assemblyFns.d.ts.map +1 -1
  57. package/dist/operations/guidedSweepFns.d.ts +25 -0
  58. package/dist/operations/guidedSweepFns.d.ts.map +1 -0
  59. package/dist/operations/mateFns.d.ts +50 -0
  60. package/dist/operations/mateFns.d.ts.map +1 -0
  61. package/dist/operations/multiSweepFns.d.ts +32 -0
  62. package/dist/operations/multiSweepFns.d.ts.map +1 -0
  63. package/dist/operations/roofFns.d.ts +16 -0
  64. package/dist/operations/roofFns.d.ts.map +1 -0
  65. package/dist/operations/straightSkeleton.d.ts +28 -0
  66. package/dist/operations/straightSkeleton.d.ts.map +1 -0
  67. package/dist/{operations-BQeW_DSM.cjs → operations-CdELWxgv.cjs} +7 -7
  68. package/dist/{operations-6hdpuYmY.js → operations-DiXo_4t9.js} +15 -15
  69. package/dist/operations.cjs +2 -2
  70. package/dist/operations.js +13 -13
  71. package/dist/query.cjs +5 -5
  72. package/dist/query.js +7 -7
  73. package/dist/result.cjs +1 -1
  74. package/dist/result.js +1 -1
  75. package/dist/{shapeFns-B0zSdO9c.cjs → shapeFns-3RYtsUVY.cjs} +54 -21
  76. package/dist/{shapeFns-k1YHFwmB.js → shapeFns-4ioRrhih.js} +52 -19
  77. package/dist/{shapeTypes-BxVxLdiD.cjs → shapeTypes-CMjrTv36.cjs} +1 -1
  78. package/dist/{shapeTypes-c-_pgYCx.js → shapeTypes-D0vfRxWb.js} +13 -13
  79. package/dist/sketching.cjs +2 -2
  80. package/dist/sketching.js +2 -2
  81. package/dist/{curveBuilders-BREwqvuc.js → surfaceBuilders-B7Jxob8g.js} +106 -13
  82. package/dist/{curveBuilders-BkEJ-RVn.cjs → surfaceBuilders-Xx9DRRxs.cjs} +96 -3
  83. package/dist/text/textBlueprints.d.ts +38 -0
  84. package/dist/text/textBlueprints.d.ts.map +1 -1
  85. package/dist/topology/api.d.ts +5 -0
  86. package/dist/topology/api.d.ts.map +1 -1
  87. package/dist/topology/booleanFns.d.ts +10 -1
  88. package/dist/topology/booleanFns.d.ts.map +1 -1
  89. package/dist/topology/colorFns.d.ts +38 -0
  90. package/dist/topology/colorFns.d.ts.map +1 -0
  91. package/dist/topology/curveFns.d.ts +1 -1
  92. package/dist/topology/curveFns.d.ts.map +1 -1
  93. package/dist/topology/faceTagFns.d.ts +44 -0
  94. package/dist/topology/faceTagFns.d.ts.map +1 -0
  95. package/dist/topology/modifierFns.d.ts.map +1 -1
  96. package/dist/topology/polyhedronFns.d.ts +8 -0
  97. package/dist/topology/polyhedronFns.d.ts.map +1 -0
  98. package/dist/topology/shapeFns.d.ts +4 -0
  99. package/dist/topology/shapeFns.d.ts.map +1 -1
  100. package/dist/topology/surfaceBuilders.d.ts +7 -0
  101. package/dist/topology/surfaceBuilders.d.ts.map +1 -1
  102. package/dist/topology/surfaceFns.d.ts +38 -0
  103. package/dist/topology/surfaceFns.d.ts.map +1 -0
  104. package/dist/{topology-CycEc6Oe.cjs → topology-D-nGjCzV.cjs} +19 -20
  105. package/dist/{topology-tMKHJgw2.js → topology-DRP9zreU.js} +8 -9
  106. package/dist/topology.cjs +13 -14
  107. package/dist/topology.js +51 -52
  108. package/dist/{vectors-DE0XriuQ.js → vectors-CZV4ZrTz.js} +2 -2
  109. package/dist/{vectors-DVmHF4zt.cjs → vectors-DwFeX0Ja.cjs} +2 -2
  110. package/dist/vectors.cjs +2 -2
  111. package/dist/vectors.js +2 -2
  112. package/package.json +4 -3
  113. package/dist/cast-CPNOTNFm.cjs +0 -102
  114. package/dist/cast-Cerqtxtb.js +0 -103
@@ -1,10 +1,11 @@
1
1
  "use strict";
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");
2
+ const occtBoundary = require("./occtBoundary-DH2VO-rq.cjs");
3
+ const shapeTypes = require("./shapeTypes-CMjrTv36.cjs");
4
+ const errors = require("./errors-eRQu29oc.cjs");
5
+ const vectors = require("./vectors-DwFeX0Ja.cjs");
6
6
  const vecOps = require("./vecOps-CjRL1jau.cjs");
7
- const shapeFns = require("./shapeFns-B0zSdO9c.cjs");
7
+ const shapeFns = require("./shapeFns-3RYtsUVY.cjs");
8
+ const surfaceBuilders = require("./surfaceBuilders-Xx9DRRxs.cjs");
8
9
  function applyGlue(op, optimisation) {
9
10
  const oc = occtBoundary.getKernel().oc;
10
11
  if (optimisation === "commonFace") {
@@ -14,6 +15,211 @@ function applyGlue(op, optimisation) {
14
15
  op.SetGlue(oc.BOPAlgo_GlueEnum.BOPAlgo_GlueFull);
15
16
  }
16
17
  }
18
+ const shapeTagStore = /* @__PURE__ */ new WeakMap();
19
+ const tagMetadataStore = /* @__PURE__ */ new WeakMap();
20
+ function getTagMap(shape) {
21
+ let map = shapeTagStore.get(shape.wrapped);
22
+ if (!map) {
23
+ map = /* @__PURE__ */ new Map();
24
+ shapeTagStore.set(shape.wrapped, map);
25
+ }
26
+ return map;
27
+ }
28
+ function getMetaMap(shape) {
29
+ let map = tagMetadataStore.get(shape.wrapped);
30
+ if (!map) {
31
+ map = /* @__PURE__ */ new Map();
32
+ tagMetadataStore.set(shape.wrapped, map);
33
+ }
34
+ return map;
35
+ }
36
+ function tagFaces(shape, selector, tag) {
37
+ const faces = Array.isArray(selector) ? selector : shapeFns.getFaces(shape).filter(selector);
38
+ const tagMap = getTagMap(shape);
39
+ const existing = tagMap.get(tag) ?? /* @__PURE__ */ new Set();
40
+ for (const face of faces) {
41
+ existing.add(face.wrapped.HashCode(vecOps.HASH_CODE_MAX));
42
+ }
43
+ tagMap.set(tag, existing);
44
+ return shape;
45
+ }
46
+ function findFacesByTag(shape, tag) {
47
+ const tagMap = shapeTagStore.get(shape.wrapped);
48
+ if (!tagMap) return [];
49
+ const hashes = tagMap.get(tag);
50
+ if (!hashes || hashes.size === 0) return [];
51
+ const result = [];
52
+ for (const face of shapeFns.getFaces(shape)) {
53
+ const hash = face.wrapped.HashCode(vecOps.HASH_CODE_MAX);
54
+ if (hashes.has(hash)) {
55
+ result.push(face);
56
+ }
57
+ }
58
+ return result;
59
+ }
60
+ function getFaceTags(shape) {
61
+ const result = /* @__PURE__ */ new Map();
62
+ const tagMap = shapeTagStore.get(shape.wrapped);
63
+ if (!tagMap) return result;
64
+ const faces = shapeFns.getFaces(shape);
65
+ const faceByHash = /* @__PURE__ */ new Map();
66
+ for (const face of faces) {
67
+ faceByHash.set(face.wrapped.HashCode(vecOps.HASH_CODE_MAX), face);
68
+ }
69
+ for (const [tag, hashes] of tagMap) {
70
+ const taggedFaces = [];
71
+ for (const hash of hashes) {
72
+ const face = faceByHash.get(hash);
73
+ if (face) taggedFaces.push(face);
74
+ }
75
+ if (taggedFaces.length > 0) {
76
+ result.set(tag, taggedFaces);
77
+ }
78
+ }
79
+ return result;
80
+ }
81
+ function setTagMetadata(shape, tag, metadata) {
82
+ const metaMap = getMetaMap(shape);
83
+ metaMap.set(tag, metadata);
84
+ return shape;
85
+ }
86
+ function getTagMetadata(shape, tag) {
87
+ return tagMetadataStore.get(shape.wrapped)?.get(tag);
88
+ }
89
+ function propagateFaceTags(op, inputs, result) {
90
+ const resultTagMap = getTagMap(result);
91
+ for (const input of inputs) {
92
+ const inputTagMap = shapeTagStore.get(input.wrapped);
93
+ if (!inputTagMap) continue;
94
+ const hashToTags = /* @__PURE__ */ new Map();
95
+ for (const [tag, hashes] of inputTagMap) {
96
+ for (const hash of hashes) {
97
+ const tags = hashToTags.get(hash) ?? [];
98
+ tags.push(tag);
99
+ hashToTags.set(hash, tags);
100
+ }
101
+ }
102
+ for (const face of shapeFns.getFaces(input)) {
103
+ const hash = face.wrapped.HashCode(vecOps.HASH_CODE_MAX);
104
+ const tags = hashToTags.get(hash);
105
+ if (!tags) continue;
106
+ if (op.IsDeleted?.(face.wrapped)) continue;
107
+ const modifiedList = op.Modified(face.wrapped);
108
+ const modSize = modifiedList.Size?.() ?? 0;
109
+ if (modSize > 0) {
110
+ const oc = occtBoundary.getKernel().oc;
111
+ const copy = new oc.TopTools_ListOfShape_3(modifiedList);
112
+ while (copy.Size() > 0) {
113
+ const modFace = copy.First_1();
114
+ const modHash = modFace.HashCode(vecOps.HASH_CODE_MAX);
115
+ for (const tag of tags) {
116
+ const set = resultTagMap.get(tag) ?? /* @__PURE__ */ new Set();
117
+ set.add(modHash);
118
+ resultTagMap.set(tag, set);
119
+ }
120
+ copy.RemoveFirst();
121
+ }
122
+ copy.delete();
123
+ } else {
124
+ for (const tag of tags) {
125
+ const set = resultTagMap.get(tag) ?? /* @__PURE__ */ new Set();
126
+ set.add(hash);
127
+ resultTagMap.set(tag, set);
128
+ }
129
+ }
130
+ }
131
+ const inputMetaMap = tagMetadataStore.get(input.wrapped);
132
+ if (inputMetaMap) {
133
+ const resultMetaMap = getMetaMap(result);
134
+ for (const [tag, meta] of inputMetaMap) {
135
+ if (!resultMetaMap.has(tag)) {
136
+ resultMetaMap.set(tag, meta);
137
+ }
138
+ }
139
+ }
140
+ }
141
+ }
142
+ const shapeColorStore = /* @__PURE__ */ new WeakMap();
143
+ const faceColorStore = /* @__PURE__ */ new WeakMap();
144
+ function getFaceColorMap(shape) {
145
+ let map = faceColorStore.get(shape.wrapped);
146
+ if (!map) {
147
+ map = /* @__PURE__ */ new Map();
148
+ faceColorStore.set(shape.wrapped, map);
149
+ }
150
+ return map;
151
+ }
152
+ function parseColor(input) {
153
+ if (typeof input === "string") {
154
+ let hex = input.startsWith("#") ? input.slice(1) : input;
155
+ if (hex.length === 3) {
156
+ hex = hex.charAt(0) + hex.charAt(0) + hex.charAt(1) + hex.charAt(1) + hex.charAt(2) + hex.charAt(2);
157
+ }
158
+ const r = parseInt(hex.slice(0, 2), 16) / 255;
159
+ const g = parseInt(hex.slice(2, 4), 16) / 255;
160
+ const b = parseInt(hex.slice(4, 6), 16) / 255;
161
+ return [r, g, b, 1];
162
+ }
163
+ if (input.length === 3) {
164
+ return [input[0], input[1], input[2], 1];
165
+ }
166
+ return [input[0], input[1], input[2], input[3]];
167
+ }
168
+ function colorShape(shape, color) {
169
+ shapeColorStore.set(shape.wrapped, parseColor(color));
170
+ return shape;
171
+ }
172
+ function colorFaces(shape, faces, color) {
173
+ const parsed = parseColor(color);
174
+ const map = getFaceColorMap(shape);
175
+ for (const face of faces) {
176
+ map.set(face.wrapped.HashCode(vecOps.HASH_CODE_MAX), parsed);
177
+ }
178
+ return shape;
179
+ }
180
+ function getShapeColor(shape) {
181
+ return shapeColorStore.get(shape.wrapped);
182
+ }
183
+ function getFaceColor(shape, face) {
184
+ const map = faceColorStore.get(shape.wrapped);
185
+ if (!map) return void 0;
186
+ return map.get(face.wrapped.HashCode(vecOps.HASH_CODE_MAX));
187
+ }
188
+ function propagateColors(op, inputs, result) {
189
+ for (const input of inputs) {
190
+ const c = shapeColorStore.get(input.wrapped);
191
+ if (c) {
192
+ shapeColorStore.set(result.wrapped, c);
193
+ break;
194
+ }
195
+ }
196
+ const resultFaceMap = getFaceColorMap(result);
197
+ for (const input of inputs) {
198
+ const inputFaceMap = faceColorStore.get(input.wrapped);
199
+ if (!inputFaceMap || inputFaceMap.size === 0) continue;
200
+ for (const face of shapeFns.getFaces(input)) {
201
+ const hash = face.wrapped.HashCode(vecOps.HASH_CODE_MAX);
202
+ const color = inputFaceMap.get(hash);
203
+ if (!color) continue;
204
+ if (op.IsDeleted?.(face.wrapped)) continue;
205
+ const modifiedList = op.Modified(face.wrapped);
206
+ const modSize = modifiedList.Size?.() ?? 0;
207
+ if (modSize > 0) {
208
+ const oc = occtBoundary.getKernel().oc;
209
+ const copy = new oc.TopTools_ListOfShape_3(modifiedList);
210
+ while (copy.Size() > 0) {
211
+ const modFace = copy.First_1();
212
+ const modHash = modFace.HashCode(vecOps.HASH_CODE_MAX);
213
+ resultFaceMap.set(modHash, color);
214
+ copy.RemoveFirst();
215
+ }
216
+ copy.delete();
217
+ } else {
218
+ resultFaceMap.set(hash, color);
219
+ }
220
+ }
221
+ }
222
+ }
17
223
  function validateShape3D(shape, label) {
18
224
  if (shape.wrapped.IsNull()) {
19
225
  return errors.err(errors.validationError(errors.BrepErrorCode.NULL_SHAPE_INPUT, `${label} is a null shape`));
@@ -72,6 +278,8 @@ function fuse(a, b, { optimisation = "none", simplify = false, signal } = {}) {
72
278
  );
73
279
  if (fuseResult.ok) {
74
280
  shapeFns.propagateOrigins(fuseOp, [a, b], fuseResult.value);
281
+ propagateFaceTags(fuseOp, [a, b], fuseResult.value);
282
+ propagateColors(fuseOp, [a, b], fuseResult.value);
75
283
  }
76
284
  return fuseResult;
77
285
  }
@@ -91,6 +299,8 @@ function cut(base, tool, { optimisation = "none", simplify = false, signal } = {
91
299
  const cutResult = castToShape3D(cutOp.Shape(), "CUT_NOT_3D", "Cut did not produce a 3D shape");
92
300
  if (cutResult.ok) {
93
301
  shapeFns.propagateOrigins(cutOp, [base, tool], cutResult.value);
302
+ propagateFaceTags(cutOp, [base, tool], cutResult.value);
303
+ propagateColors(cutOp, [base, tool], cutResult.value);
94
304
  }
95
305
  return cutResult;
96
306
  }
@@ -113,6 +323,8 @@ function intersect(a, b, { simplify = false, signal } = {}) {
113
323
  );
114
324
  if (intResult.ok) {
115
325
  shapeFns.propagateOrigins(intOp, [a, b], intResult.value);
326
+ propagateFaceTags(intOp, [a, b], intResult.value);
327
+ propagateColors(intOp, [a, b], intResult.value);
116
328
  }
117
329
  return intResult;
118
330
  }
@@ -188,6 +400,8 @@ function cutAll(base, tools, { optimisation = "none", simplify = false, signal }
188
400
  );
189
401
  if (cutAllResult.ok) {
190
402
  shapeFns.propagateOrigins(cutOp, [base, ...tools], cutAllResult.value);
403
+ propagateFaceTags(cutOp, [base, ...tools], cutAllResult.value);
404
+ propagateColors(cutOp, [base, ...tools], cutAllResult.value);
191
405
  }
192
406
  return cutAllResult;
193
407
  }
@@ -250,6 +464,74 @@ function section(shape, plane, { approximation = true, planeSize = 1e4 } = {}) {
250
464
  sectionFace.delete();
251
465
  }
252
466
  }
467
+ function sectionToFace(shape, plane, options = {}) {
468
+ const sectionResult = section(shape, plane, options);
469
+ if (!sectionResult.ok) return sectionResult;
470
+ const wires = shapeFns.getWires(sectionResult.value);
471
+ if (wires.length === 0) {
472
+ const edges = shapeFns.getEdges(sectionResult.value);
473
+ if (edges.length === 0) {
474
+ return errors.err(errors.occtError("SECTION_FAILED", "sectionToFace: section produced no geometry"));
475
+ }
476
+ const oc = occtBoundary.getKernel().oc;
477
+ const remaining = [...edges];
478
+ while (remaining.length > 0) {
479
+ const first = remaining.shift();
480
+ if (!first) break;
481
+ const wireEdges = [first];
482
+ let added = true;
483
+ while (added && remaining.length > 0) {
484
+ added = false;
485
+ for (let i = 0; i < remaining.length; i++) {
486
+ const candidate = remaining[i];
487
+ if (!candidate) continue;
488
+ const probe = new oc.BRepBuilderAPI_MakeWire_1();
489
+ for (const e of wireEdges) {
490
+ probe.Add_1(e.wrapped);
491
+ }
492
+ probe.Add_1(candidate.wrapped);
493
+ const connects = probe.Error() === oc.BRepBuilderAPI_WireError.BRepBuilderAPI_WireDone;
494
+ probe.delete();
495
+ if (connects) {
496
+ wireEdges.push(candidate);
497
+ remaining.splice(i, 1);
498
+ added = true;
499
+ break;
500
+ }
501
+ }
502
+ }
503
+ const wb = new oc.BRepBuilderAPI_MakeWire_1();
504
+ for (const e of wireEdges) {
505
+ wb.Add_1(e.wrapped);
506
+ }
507
+ if (wb.IsDone()) {
508
+ wires.push(shapeTypes.castShape(wb.Wire()));
509
+ }
510
+ wb.delete();
511
+ }
512
+ }
513
+ if (wires.length === 0) {
514
+ return errors.err(errors.occtError("SECTION_FAILED", "sectionToFace: section produced no usable geometry"));
515
+ }
516
+ let outerIdx = 0;
517
+ let maxDiag = -1;
518
+ for (let i = 0; i < wires.length; i++) {
519
+ const w = wires[i];
520
+ if (!w) continue;
521
+ const bb = occtBoundary.getKernel().boundingBox(w.wrapped);
522
+ const dx = bb.max[0] - bb.min[0];
523
+ const dy = bb.max[1] - bb.min[1];
524
+ const dz = bb.max[2] - bb.min[2];
525
+ const diag = dx * dx + dy * dy + dz * dz;
526
+ if (diag > maxDiag) {
527
+ maxDiag = diag;
528
+ outerIdx = i;
529
+ }
530
+ }
531
+ const outer = wires[outerIdx];
532
+ const holes = wires.filter((_, i) => i !== outerIdx);
533
+ return surfaceBuilders.makeFace(outer, holes.length > 0 ? holes : void 0);
534
+ }
253
535
  function split(shape, tools) {
254
536
  if (tools.length === 0) return errors.ok(shape);
255
537
  if (shape.wrapped.IsNull()) {
@@ -291,11 +573,23 @@ function slice(shape, planes, options = {}) {
291
573
  return errors.ok(results);
292
574
  }
293
575
  exports.applyGlue = applyGlue;
576
+ exports.colorFaces = colorFaces;
577
+ exports.colorShape = colorShape;
294
578
  exports.cut = cut;
295
579
  exports.cutAll = cutAll;
580
+ exports.findFacesByTag = findFacesByTag;
296
581
  exports.fuse = fuse;
297
582
  exports.fuseAll = fuseAll;
583
+ exports.getFaceColor = getFaceColor;
584
+ exports.getFaceTags = getFaceTags;
585
+ exports.getShapeColor = getShapeColor;
586
+ exports.getTagMetadata = getTagMetadata;
298
587
  exports.intersect = intersect;
588
+ exports.propagateColors = propagateColors;
589
+ exports.propagateFaceTags = propagateFaceTags;
299
590
  exports.section = section;
591
+ exports.sectionToFace = sectionToFace;
592
+ exports.setTagMetadata = setTagMetadata;
300
593
  exports.slice = slice;
301
594
  exports.split = split;
595
+ exports.tagFaces = tagFaces;