brepjs 18.20.3 → 18.20.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.
- package/dist/2d.cjs +7 -7
- package/dist/2d.js +7 -7
- package/dist/{blueprint-Cy5veXS3.js → blueprint-0bBVK6Be.js} +11 -11
- package/dist/{blueprint-Bl0YQjkk.cjs → blueprint-B6vmOy5_.cjs} +11 -11
- package/dist/{blueprintFns-Dkccxo6d.cjs → blueprintFns-Aiise3pc.cjs} +3 -3
- package/dist/{blueprintFns-CSB51aXT.js → blueprintFns-BJbTjW94.js} +3 -3
- package/dist/{blueprintSketcher-DeEogKbs.js → blueprintSketcher-BkZrvGoG.js} +7 -7
- package/dist/{blueprintSketcher-Cr9A-R8I.cjs → blueprintSketcher-D_Z8NfOF.cjs} +7 -7
- package/dist/{boolean2D-BZ1UjpjX.cjs → boolean2D-1gc4kqNS.cjs} +7 -7
- package/dist/{boolean2D-lE2uy4Mm.js → boolean2D-BAJ3efk_.js} +7 -7
- package/dist/{booleanFns-CtvYfQZq.js → booleanFns-BsjoPJAS.js} +9 -9
- package/dist/{booleanFns-CD25YZGm.cjs → booleanFns-D3mYqZxL.cjs} +9 -9
- package/dist/brepjs.cjs +151 -101
- package/dist/brepjs.js +151 -101
- package/dist/{cameraFns-CR2inEBU.cjs → cameraFns-DgTBC2w3.cjs} +4 -4
- package/dist/{cameraFns-Dg1lQP0S.js → cameraFns-QK8ahyDz.js} +4 -4
- package/dist/core.cjs +6 -6
- package/dist/core.js +6 -6
- package/dist/{cornerFinder-tfWhcA2M.js → cornerFinder-BaSsAk69.js} +3 -3
- package/dist/{cornerFinder-CXN1IxPg.cjs → cornerFinder-CkLZ23Kp.cjs} +3 -3
- package/dist/csg/evaluate.d.ts +1 -1
- package/dist/{curveFns-BEF8t7XY.js → curveFns-BiSx9FTh.js} +2 -2
- package/dist/{curveFns-CcheHkr4.cjs → curveFns-CE3b2sDD.cjs} +2 -2
- package/dist/{drawFns-CuzUHFyD.cjs → drawFns-BaxDgrlX.cjs} +19 -19
- package/dist/{drawFns-CEjshioX.js → drawFns-BtHAHYa-.js} +19 -19
- package/dist/{errors-8GZS3vy9.js → errors-BJSTLaDI.js} +1 -1
- package/dist/{errors-BiY8-q1s.cjs → errors-DxoD7zgx.cjs} +1 -1
- package/dist/{extrudeFns-gcWJSK9T.js → extrudeFns-CRG478Q3.js} +3 -3
- package/dist/{extrudeFns-BwU4ng1V.cjs → extrudeFns-DUPpueiL.cjs} +3 -3
- package/dist/{faceFns-BNhFoEII.js → faceFns-C3C6l-X0.js} +4 -4
- package/dist/{faceFns-BbESdudy.cjs → faceFns-CLzDRrUE.cjs} +4 -4
- package/dist/{helpers-BU3ANziG.cjs → helpers-DwG3OFk0.cjs} +9 -9
- package/dist/{helpers-D1J5VHbk.js → helpers-rNVdiDLn.js} +9 -9
- package/dist/{historyFns-XZp1D_aA.js → historyFns-CEr9D6ay.js} +6 -6
- package/dist/{historyFns-DHOoBh6G.cjs → historyFns-DSCnjCkQ.cjs} +6 -6
- package/dist/{importFns-CsRJ9lbm.cjs → importFns-A8v4Pdw2.cjs} +5 -5
- package/dist/{importFns-D1oB3yU8.js → importFns-Hh3S9NPm.js} +5 -5
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/brepkit/sweepOps.d.ts +3 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
- package/dist/{measureFns-C3y_WX_E.js → measureFns--uvW_r_P.js} +4 -4
- package/dist/{measureFns-BkoPw5JT.cjs → measureFns-DMyJp_x3.cjs} +4 -4
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-k0BdoBGR.js → meshFns-Bxt57KX1.js} +3 -3
- package/dist/{meshFns-CFMr9FBb.cjs → meshFns-DTn__aNb.cjs} +3 -3
- package/dist/{occtWasmAdapter-C2VW-uYg.cjs → occtWasmAdapter-BaidTDJk.cjs} +1 -1
- package/dist/{occtWasmAdapter--TZGP9DX.js → occtWasmAdapter-Dtp7Wu27.js} +1 -1
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{planeOps-2EyPq0tU.cjs → planeOps-C6wxugvC.cjs} +4 -4
- package/dist/{planeOps-Bea3T3mc.js → planeOps-CblVcWbn.js} +4 -4
- package/dist/{primitiveFns-CkMua35m.cjs → primitiveFns-CX5c_YGt.cjs} +10 -10
- package/dist/{primitiveFns-BsO-feBX.js → primitiveFns-w1zNsxTH.js} +10 -10
- package/dist/projection.cjs +1 -1
- package/dist/projection.js +1 -1
- package/dist/query.cjs +2 -2
- package/dist/query.js +2 -2
- package/dist/result.cjs +1 -1
- package/dist/result.js +1 -1
- package/dist/{shapeFns-x8vqq2fR.js → shapeFns-Dsxp5d_u.js} +4 -4
- package/dist/{shapeFns-CHTLdb_n.cjs → shapeFns-cTuUm-aP.cjs} +4 -4
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeRefFns-CDRLEUik.cjs → shapeRefFns-SctbRFju.cjs} +8 -8
- package/dist/{shapeRefFns-CE0yS0EB.js → shapeRefFns-zFWzAmQZ.js} +8 -8
- package/dist/{shapeTypes-BpKhed-9.cjs → shapeTypes-C1FUZ2zE.cjs} +336 -288
- package/dist/{shapeTypes-DGtDTS9s.js → shapeTypes-DmHPJc_M.js} +336 -288
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/{solidBuilders-BlBaFSCS.cjs → solidBuilders-BGJvTrDt.cjs} +3 -3
- package/dist/{solidBuilders-Cot05qzs.js → solidBuilders-CJ8ckc61.js} +3 -3
- package/dist/{surfaceBuilders-frj7YRrD.cjs → surfaceBuilders-B7A2uoBJ.cjs} +3 -3
- package/dist/{surfaceBuilders-zJyikeav.js → surfaceBuilders-B_wXW8QS.js} +3 -3
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-CHh9SChA.cjs → textBlueprints-BCTQk9T8.cjs} +12 -12
- package/dist/{textBlueprints-Bv6zhEyn.js → textBlueprints-LYHgEdsx.js} +12 -12
- package/dist/{textMetrics-CKNdQX02.cjs → textMetrics-BNfyRNxm.cjs} +2 -2
- package/dist/{textMetrics-vUJTTEFi.js → textMetrics-Dd-Vva8S.js} +2 -2
- package/dist/topology.cjs +7 -7
- package/dist/topology.js +7 -7
- package/dist/{topologyQueryFns-CcWaCxeb.js → topologyQueryFns-CcHXn5M2.js} +2 -2
- package/dist/{topologyQueryFns-CHsPXNbI.cjs → topologyQueryFns-DCICDnwA.cjs} +2 -2
- package/dist/vectors.cjs +4 -4
- package/dist/vectors.js +4 -4
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +1 -1
- package/package.json +2 -5
- /package/dist/{arrayAccess-C5IWcxs9.js → arrayAccess-DrUGPADn.js} +0 -0
- /package/dist/{arrayAccess-7pTWqkJu.cjs → arrayAccess-e4H9cBfh.cjs} +0 -0
- /package/dist/{constants-DTorLmes.cjs → constants-BOVyEYGH.cjs} +0 -0
- /package/dist/{constants-Ci5CA3aZ.js → constants-ITRzCnCp.js} +0 -0
- /package/dist/{types-BIdk_GJY.js → types-D24Y27N0.js} +0 -0
- /package/dist/{types-CDkxah-M.cjs → types-KjA8tY4Y.cjs} +0 -0
- /package/dist/{vec3-S4Oh59IX.cjs → vec3-CFwOI0ZI.cjs} +0 -0
- /package/dist/{vec3-BRj3eI54.js → vec3-Dpha8d5k.js} +0 -0
- /package/dist/{vecOps-D7xplSx8.cjs → vecOps-CCnJt-yH.cjs} +0 -0
- /package/dist/{vecOps-DVROrqTV.js → vecOps-SKPRvPH-.js} +0 -0
- /package/dist/{workerHandler-DaulgMax.js → workerHandler-CFetYgIm.js} +0 -0
- /package/dist/{workerHandler-C7seK7H-.cjs → workerHandler-CdlOTwJg.cjs} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_vec3 = require("./vec3-
|
|
2
|
-
const require_occtWasmAdapter = require("./occtWasmAdapter-
|
|
3
|
-
const require_errors = require("./errors-
|
|
1
|
+
const require_vec3 = require("./vec3-CFwOI0ZI.cjs");
|
|
2
|
+
const require_occtWasmAdapter = require("./occtWasmAdapter-BaidTDJk.cjs");
|
|
3
|
+
const require_errors = require("./errors-DxoD7zgx.cjs");
|
|
4
4
|
//#region src/kernel/kernel2dTypes.ts
|
|
5
5
|
/** Check if the kernel supports 2D geometry operations. */
|
|
6
6
|
function supportsKernel2D(kernel) {
|
|
@@ -5838,88 +5838,95 @@ function resolveUniformAngle(faces, angleDeg) {
|
|
|
5838
5838
|
}
|
|
5839
5839
|
//#endregion
|
|
5840
5840
|
//#region src/kernel/brepkit/topologyOps.ts
|
|
5841
|
+
function iterCompound(bk, h, type) {
|
|
5842
|
+
const children = syntheticCompounds.get(h);
|
|
5843
|
+
if (children) return children.flatMap((child) => child.type === type ? [child] : iterShapes(bk, child, type));
|
|
5844
|
+
if (type === "solid") return toArray(bk.getCompoundSolids(h)).map(solidHandle);
|
|
5845
|
+
if (type === "face" || type === "edge" || type === "vertex" || type === "wire") return toArray(bk.getCompoundSolids(h)).map(solidHandle).flatMap((s) => iterShapes(bk, s, type));
|
|
5846
|
+
return [];
|
|
5847
|
+
}
|
|
5848
|
+
function iterSolid(bk, h, type) {
|
|
5849
|
+
switch (type) {
|
|
5850
|
+
case "face": return toArray(bk.getSolidFaces(h)).map(faceHandle);
|
|
5851
|
+
case "edge": return toArray(bk.getSolidEdges(h)).map(edgeHandle);
|
|
5852
|
+
case "vertex": return toArray(bk.getSolidVertices(h)).map(vertexHandle);
|
|
5853
|
+
case "wire": return toArray(bk.getSolidFaces(h)).flatMap((faceId) => toArray(bk.getFaceWires(faceId)).map(wireHandle));
|
|
5854
|
+
default: return [];
|
|
5855
|
+
}
|
|
5856
|
+
}
|
|
5857
|
+
function iterShellChildren(bk, h, type) {
|
|
5858
|
+
const faces = toArray(bk.getShellFaces(h)).map(faceHandle);
|
|
5859
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5860
|
+
const results = [];
|
|
5861
|
+
for (const face of faces) for (const child of iterShapes(bk, face, type)) {
|
|
5862
|
+
const childId = unwrap(child);
|
|
5863
|
+
if (seen.has(childId)) continue;
|
|
5864
|
+
seen.add(childId);
|
|
5865
|
+
results.push(child);
|
|
5866
|
+
}
|
|
5867
|
+
return results;
|
|
5868
|
+
}
|
|
5869
|
+
function iterShell(bk, h, type) {
|
|
5870
|
+
if (type === "face") return toArray(bk.getShellFaces(h)).map(faceHandle);
|
|
5871
|
+
if (type === "edge" || type === "vertex") return iterShellChildren(bk, h, type);
|
|
5872
|
+
return [];
|
|
5873
|
+
}
|
|
5874
|
+
function iterFace(bk, shape, h, type) {
|
|
5875
|
+
if (type === "face") return [shape];
|
|
5876
|
+
if (type === "edge") return toArray(bk.getFaceEdges(h)).map(edgeHandle);
|
|
5877
|
+
if (type === "vertex") return toArray(bk.getFaceVertices(h)).map(vertexHandle);
|
|
5878
|
+
if (type === "wire") return toArray(bk.getFaceWires(h)).map(wireHandle);
|
|
5879
|
+
return [];
|
|
5880
|
+
}
|
|
5881
|
+
function uniqueWireVertices(bk, h) {
|
|
5882
|
+
const edgeIds = toArray(bk.getWireEdges(h));
|
|
5883
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5884
|
+
const results = [];
|
|
5885
|
+
for (const eid of edgeIds) {
|
|
5886
|
+
const verts = bk.getEdgeVertices(eid);
|
|
5887
|
+
const coords = [[
|
|
5888
|
+
require_vec3.wasmIndex(verts, 0),
|
|
5889
|
+
require_vec3.wasmIndex(verts, 1),
|
|
5890
|
+
require_vec3.wasmIndex(verts, 2)
|
|
5891
|
+
], [
|
|
5892
|
+
require_vec3.wasmIndex(verts, 3),
|
|
5893
|
+
require_vec3.wasmIndex(verts, 4),
|
|
5894
|
+
require_vec3.wasmIndex(verts, 5)
|
|
5895
|
+
]];
|
|
5896
|
+
for (const [x, y, z] of coords) {
|
|
5897
|
+
const key = `${x},${y},${z}`;
|
|
5898
|
+
if (seen.has(key)) continue;
|
|
5899
|
+
seen.add(key);
|
|
5900
|
+
results.push(vertexHandle(bk.makeVertex(x, y, z)));
|
|
5901
|
+
}
|
|
5902
|
+
}
|
|
5903
|
+
return results;
|
|
5904
|
+
}
|
|
5905
|
+
function iterWire(bk, shape, h, type) {
|
|
5906
|
+
if (type === "wire") return [shape];
|
|
5907
|
+
if (type === "edge") return toArray(bk.getWireEdges(h)).map(edgeHandle);
|
|
5908
|
+
if (type === "vertex") return uniqueWireVertices(bk, h);
|
|
5909
|
+
return [];
|
|
5910
|
+
}
|
|
5911
|
+
function iterEdge(bk, shape, h, type) {
|
|
5912
|
+
if (type === "edge") return [shape];
|
|
5913
|
+
if (type === "vertex") {
|
|
5914
|
+
const verts = bk.getEdgeVertices(h);
|
|
5915
|
+
const v1 = bk.makeVertex(require_vec3.wasmIndex(verts, 0), require_vec3.wasmIndex(verts, 1), require_vec3.wasmIndex(verts, 2));
|
|
5916
|
+
const v2 = bk.makeVertex(require_vec3.wasmIndex(verts, 3), require_vec3.wasmIndex(verts, 4), require_vec3.wasmIndex(verts, 5));
|
|
5917
|
+
return [vertexHandle(v1), vertexHandle(v2)];
|
|
5918
|
+
}
|
|
5919
|
+
return [];
|
|
5920
|
+
}
|
|
5841
5921
|
function iterShapes(bk, shape, type) {
|
|
5842
5922
|
const h = unwrap(shape);
|
|
5843
5923
|
switch (shape.type) {
|
|
5844
|
-
case "compound":
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
return results;
|
|
5851
|
-
}
|
|
5852
|
-
if (type === "solid") return toArray(bk.getCompoundSolids(h)).map(solidHandle);
|
|
5853
|
-
if (type === "face" || type === "edge" || type === "vertex" || type === "wire") return toArray(bk.getCompoundSolids(h)).map(solidHandle).flatMap((s) => iterShapes(bk, s, type));
|
|
5854
|
-
return [];
|
|
5855
|
-
}
|
|
5856
|
-
case "solid": switch (type) {
|
|
5857
|
-
case "face": return toArray(bk.getSolidFaces(h)).map(faceHandle);
|
|
5858
|
-
case "edge": return toArray(bk.getSolidEdges(h)).map(edgeHandle);
|
|
5859
|
-
case "vertex": return toArray(bk.getSolidVertices(h)).map(vertexHandle);
|
|
5860
|
-
case "wire": return toArray(bk.getSolidFaces(h)).flatMap((faceId) => toArray(bk.getFaceWires(faceId)).map(wireHandle));
|
|
5861
|
-
default: return [];
|
|
5862
|
-
}
|
|
5863
|
-
case "shell":
|
|
5864
|
-
if (type === "face") return toArray(bk.getShellFaces(h)).map(faceHandle);
|
|
5865
|
-
if (type === "edge" || type === "vertex") {
|
|
5866
|
-
const faces = toArray(bk.getShellFaces(h)).map(faceHandle);
|
|
5867
|
-
const seen = /* @__PURE__ */ new Set();
|
|
5868
|
-
const results = [];
|
|
5869
|
-
for (const face of faces) for (const child of iterShapes(bk, face, type)) {
|
|
5870
|
-
const childId = unwrap(child);
|
|
5871
|
-
if (!seen.has(childId)) {
|
|
5872
|
-
seen.add(childId);
|
|
5873
|
-
results.push(child);
|
|
5874
|
-
}
|
|
5875
|
-
}
|
|
5876
|
-
return results;
|
|
5877
|
-
}
|
|
5878
|
-
return [];
|
|
5879
|
-
case "face":
|
|
5880
|
-
if (type === "face") return [shape];
|
|
5881
|
-
if (type === "edge") return toArray(bk.getFaceEdges(h)).map(edgeHandle);
|
|
5882
|
-
if (type === "vertex") return toArray(bk.getFaceVertices(h)).map(vertexHandle);
|
|
5883
|
-
if (type === "wire") return toArray(bk.getFaceWires(h)).map(wireHandle);
|
|
5884
|
-
return [];
|
|
5885
|
-
case "wire":
|
|
5886
|
-
if (type === "wire") return [shape];
|
|
5887
|
-
if (type === "edge") return toArray(bk.getWireEdges(h)).map(edgeHandle);
|
|
5888
|
-
if (type === "vertex") {
|
|
5889
|
-
const edgeIds = toArray(bk.getWireEdges(h));
|
|
5890
|
-
const seen = /* @__PURE__ */ new Set();
|
|
5891
|
-
const results = [];
|
|
5892
|
-
for (const eid of edgeIds) {
|
|
5893
|
-
const verts = bk.getEdgeVertices(eid);
|
|
5894
|
-
const coords = [[
|
|
5895
|
-
require_vec3.wasmIndex(verts, 0),
|
|
5896
|
-
require_vec3.wasmIndex(verts, 1),
|
|
5897
|
-
require_vec3.wasmIndex(verts, 2)
|
|
5898
|
-
], [
|
|
5899
|
-
require_vec3.wasmIndex(verts, 3),
|
|
5900
|
-
require_vec3.wasmIndex(verts, 4),
|
|
5901
|
-
require_vec3.wasmIndex(verts, 5)
|
|
5902
|
-
]];
|
|
5903
|
-
for (const [x, y, z] of coords) {
|
|
5904
|
-
const key = `${x},${y},${z}`;
|
|
5905
|
-
if (!seen.has(key)) {
|
|
5906
|
-
seen.add(key);
|
|
5907
|
-
results.push(vertexHandle(bk.makeVertex(x, y, z)));
|
|
5908
|
-
}
|
|
5909
|
-
}
|
|
5910
|
-
}
|
|
5911
|
-
return results;
|
|
5912
|
-
}
|
|
5913
|
-
return [];
|
|
5914
|
-
case "edge":
|
|
5915
|
-
if (type === "edge") return [shape];
|
|
5916
|
-
if (type === "vertex") {
|
|
5917
|
-
const verts = bk.getEdgeVertices(h);
|
|
5918
|
-
const v1 = bk.makeVertex(require_vec3.wasmIndex(verts, 0), require_vec3.wasmIndex(verts, 1), require_vec3.wasmIndex(verts, 2));
|
|
5919
|
-
const v2 = bk.makeVertex(require_vec3.wasmIndex(verts, 3), require_vec3.wasmIndex(verts, 4), require_vec3.wasmIndex(verts, 5));
|
|
5920
|
-
return [vertexHandle(v1), vertexHandle(v2)];
|
|
5921
|
-
}
|
|
5922
|
-
return [];
|
|
5924
|
+
case "compound": return iterCompound(bk, h, type);
|
|
5925
|
+
case "solid": return iterSolid(bk, h, type);
|
|
5926
|
+
case "shell": return iterShell(bk, h, type);
|
|
5927
|
+
case "face": return iterFace(bk, shape, h, type);
|
|
5928
|
+
case "wire": return iterWire(bk, shape, h, type);
|
|
5929
|
+
case "edge": return iterEdge(bk, shape, h, type);
|
|
5923
5930
|
default: return [];
|
|
5924
5931
|
}
|
|
5925
5932
|
}
|
|
@@ -5964,14 +5971,15 @@ function adjacentFaces(bk, shape, face) {
|
|
|
5964
5971
|
const faceId = unwrap(face, "face");
|
|
5965
5972
|
return Array.from(bk.adjacentFaces(solidId, faceId)).map((id) => faceHandle(id));
|
|
5966
5973
|
}
|
|
5974
|
+
function faceIdsForSew(bk, shape) {
|
|
5975
|
+
const h = shape;
|
|
5976
|
+
if (h.type === "face") return [h.id];
|
|
5977
|
+
if (h.type === "solid") return toArray(bk.getSolidFaces(h.id));
|
|
5978
|
+
if (h.type === "shell") return toArray(bk.getShellFaces(h.id));
|
|
5979
|
+
return [];
|
|
5980
|
+
}
|
|
5967
5981
|
function sew(bk, shapes, tolerance) {
|
|
5968
|
-
const faceIds =
|
|
5969
|
-
for (const s of shapes) {
|
|
5970
|
-
const h = s;
|
|
5971
|
-
if (h.type === "face") faceIds.push(h.id);
|
|
5972
|
-
else if (h.type === "solid") for (const fid of toArray(bk.getSolidFaces(h.id))) faceIds.push(fid);
|
|
5973
|
-
else if (h.type === "shell") for (const fid of toArray(bk.getShellFaces(h.id))) faceIds.push(fid);
|
|
5974
|
-
}
|
|
5982
|
+
const faceIds = shapes.flatMap((s) => faceIdsForSew(bk, s));
|
|
5975
5983
|
const tol = tolerance ?? 1e-7;
|
|
5976
5984
|
try {
|
|
5977
5985
|
return shellHandle(bk.weldShellsAndFaces(faceIds, tol));
|
|
@@ -7288,9 +7296,9 @@ function makeCircleNurbs(bk, center, normal, radius, startAngle, endAngle) {
|
|
|
7288
7296
|
weights.push(1);
|
|
7289
7297
|
}
|
|
7290
7298
|
const degree = 2;
|
|
7291
|
-
const knots = Array(
|
|
7299
|
+
const knots = Array(3).fill(0);
|
|
7292
7300
|
for (let i = 1; i < nSegments; i++) knots.push(i, i);
|
|
7293
|
-
knots.push(...Array(
|
|
7301
|
+
knots.push(...Array(3).fill(nSegments));
|
|
7294
7302
|
const kMax = require_vec3.wasmIndex(knots, knots.length - 1);
|
|
7295
7303
|
for (let i = 0; i < knots.length; i++) knots[i] = require_vec3.wasmIndex(knots, i) / kMax;
|
|
7296
7304
|
const sx = require_vec3.wasmIndex(controlPoints, 0);
|
|
@@ -7369,9 +7377,9 @@ function makeEllipseNurbs(bk, center, normal, majorRadius, minorRadius, startAng
|
|
|
7369
7377
|
weights.push(1);
|
|
7370
7378
|
}
|
|
7371
7379
|
const degree = 2;
|
|
7372
|
-
const knots = Array(
|
|
7380
|
+
const knots = Array(3).fill(0);
|
|
7373
7381
|
for (let i = 1; i < nSegments; i++) knots.push(i, i);
|
|
7374
|
-
knots.push(...Array(
|
|
7382
|
+
knots.push(...Array(3).fill(nSegments));
|
|
7375
7383
|
const kMax = require_vec3.wasmIndex(knots, knots.length - 1);
|
|
7376
7384
|
for (let i = 0; i < knots.length; i++) knots[i] = require_vec3.wasmIndex(knots, i) / kMax;
|
|
7377
7385
|
const sx = require_vec3.wasmIndex(controlPoints, 0);
|
|
@@ -7490,69 +7498,73 @@ function chamferDistAngle(bk, shape, edges, distance, angleDeg) {
|
|
|
7490
7498
|
warnOnce("chamfer-dist-angle", "chamferAsymmetric not available; using averaged distance.");
|
|
7491
7499
|
return solidHandle(bk.chamfer(solidId, edgeIds, (distance + d2) / 2));
|
|
7492
7500
|
}
|
|
7501
|
+
function faceCentroid(bk, faceId) {
|
|
7502
|
+
const verts = toArray(bk.getFaceVertices(faceId));
|
|
7503
|
+
if (verts.length < 1) return null;
|
|
7504
|
+
let x = 0, y = 0, z = 0;
|
|
7505
|
+
for (const vid of verts) {
|
|
7506
|
+
const pos = bk.getVertexPosition(vid);
|
|
7507
|
+
x += require_vec3.wasmIndex(pos, 0);
|
|
7508
|
+
y += require_vec3.wasmIndex(pos, 1);
|
|
7509
|
+
z += require_vec3.wasmIndex(pos, 2);
|
|
7510
|
+
}
|
|
7511
|
+
const n = verts.length;
|
|
7512
|
+
return {
|
|
7513
|
+
x: x / n,
|
|
7514
|
+
y: y / n,
|
|
7515
|
+
z: z / n
|
|
7516
|
+
};
|
|
7517
|
+
}
|
|
7518
|
+
function findBestNormalMatch(bk, origFaceId, solidFaces) {
|
|
7519
|
+
try {
|
|
7520
|
+
const origNormal = bk.getFaceNormal(origFaceId);
|
|
7521
|
+
let bestMatch = -1;
|
|
7522
|
+
let bestDot = -2;
|
|
7523
|
+
for (const sf of solidFaces) try {
|
|
7524
|
+
const sn = bk.getFaceNormal(sf);
|
|
7525
|
+
const dot = (origNormal[0] ?? 0) * (sn[0] ?? 0) + (origNormal[1] ?? 0) * (sn[1] ?? 0) + (origNormal[2] ?? 0) * (sn[2] ?? 0);
|
|
7526
|
+
if (dot > bestDot) {
|
|
7527
|
+
bestDot = dot;
|
|
7528
|
+
bestMatch = sf;
|
|
7529
|
+
}
|
|
7530
|
+
} catch {}
|
|
7531
|
+
if (bestMatch >= 0 && bestDot > .99) return bestMatch;
|
|
7532
|
+
} catch {}
|
|
7533
|
+
return null;
|
|
7534
|
+
}
|
|
7535
|
+
function findBestCentroidMatch(bk, origFaceId, solidFaces) {
|
|
7536
|
+
try {
|
|
7537
|
+
const origCentroid = faceCentroid(bk, origFaceId);
|
|
7538
|
+
if (origCentroid === null) return null;
|
|
7539
|
+
let bestMatch = -1;
|
|
7540
|
+
let bestDist = Infinity;
|
|
7541
|
+
for (const sf of solidFaces) try {
|
|
7542
|
+
const sc = faceCentroid(bk, sf);
|
|
7543
|
+
if (sc === null) continue;
|
|
7544
|
+
const dist = Math.sqrt((origCentroid.x - sc.x) ** 2 + (origCentroid.y - sc.y) ** 2 + (origCentroid.z - sc.z) ** 2);
|
|
7545
|
+
if (dist < bestDist) {
|
|
7546
|
+
bestDist = dist;
|
|
7547
|
+
bestMatch = sf;
|
|
7548
|
+
}
|
|
7549
|
+
} catch {}
|
|
7550
|
+
if (bestMatch >= 0 && bestDist < .001) return bestMatch;
|
|
7551
|
+
} catch {}
|
|
7552
|
+
return null;
|
|
7553
|
+
}
|
|
7554
|
+
function resolveShellFaceId(bk, fid, solidFaces, solidFaceSet) {
|
|
7555
|
+
if (solidFaceSet.has(fid)) return fid;
|
|
7556
|
+
const normalMatch = findBestNormalMatch(bk, fid, solidFaces);
|
|
7557
|
+
if (normalMatch !== null) return normalMatch;
|
|
7558
|
+
const centroidMatch = findBestCentroidMatch(bk, fid, solidFaces);
|
|
7559
|
+
if (centroidMatch !== null) return centroidMatch;
|
|
7560
|
+
return fid;
|
|
7561
|
+
}
|
|
7493
7562
|
function shell(bk, shape, faces, thickness, tolerance) {
|
|
7494
7563
|
if (tolerance !== void 0) warnOnce("shell-tolerance", "shell() tolerance parameter is not supported; brepkit uses its own internal tolerance.");
|
|
7495
7564
|
const solidId = unwrapSolidOrThrow(shape, "shell");
|
|
7496
7565
|
const solidFaces = toArray(bk.getSolidFaces(solidId));
|
|
7497
7566
|
const solidFaceSet = new Set(solidFaces);
|
|
7498
|
-
const resolvedFaceIds = faces.map((f) =>
|
|
7499
|
-
const fid = unwrap(f, "face");
|
|
7500
|
-
if (solidFaceSet.has(fid)) return fid;
|
|
7501
|
-
try {
|
|
7502
|
-
const origNormal = bk.getFaceNormal(fid);
|
|
7503
|
-
let bestMatch = -1;
|
|
7504
|
-
let bestDot = -2;
|
|
7505
|
-
for (const sf of solidFaces) try {
|
|
7506
|
-
const sn = bk.getFaceNormal(sf);
|
|
7507
|
-
const dot = (origNormal[0] ?? 0) * (sn[0] ?? 0) + (origNormal[1] ?? 0) * (sn[1] ?? 0) + (origNormal[2] ?? 0) * (sn[2] ?? 0);
|
|
7508
|
-
if (dot > bestDot) {
|
|
7509
|
-
bestDot = dot;
|
|
7510
|
-
bestMatch = sf;
|
|
7511
|
-
}
|
|
7512
|
-
} catch {}
|
|
7513
|
-
if (bestMatch >= 0 && bestDot > .99) return bestMatch;
|
|
7514
|
-
} catch {}
|
|
7515
|
-
try {
|
|
7516
|
-
const origVerts = toArray(bk.getFaceVertices(fid));
|
|
7517
|
-
if (origVerts.length >= 1) {
|
|
7518
|
-
let ox = 0, oy = 0, oz = 0;
|
|
7519
|
-
for (const vid of origVerts) {
|
|
7520
|
-
const pos = bk.getVertexPosition(vid);
|
|
7521
|
-
ox += require_vec3.wasmIndex(pos, 0);
|
|
7522
|
-
oy += require_vec3.wasmIndex(pos, 1);
|
|
7523
|
-
oz += require_vec3.wasmIndex(pos, 2);
|
|
7524
|
-
}
|
|
7525
|
-
const n = origVerts.length;
|
|
7526
|
-
ox /= n;
|
|
7527
|
-
oy /= n;
|
|
7528
|
-
oz /= n;
|
|
7529
|
-
let bestCentroidMatch = -1;
|
|
7530
|
-
let bestCentroidDist = Infinity;
|
|
7531
|
-
for (const sf of solidFaces) try {
|
|
7532
|
-
const sv = toArray(bk.getFaceVertices(sf));
|
|
7533
|
-
if (sv.length < 1) continue;
|
|
7534
|
-
let sx = 0, sy = 0, sz = 0;
|
|
7535
|
-
for (const svid of sv) {
|
|
7536
|
-
const spos = bk.getVertexPosition(svid);
|
|
7537
|
-
sx += require_vec3.wasmIndex(spos, 0);
|
|
7538
|
-
sy += require_vec3.wasmIndex(spos, 1);
|
|
7539
|
-
sz += require_vec3.wasmIndex(spos, 2);
|
|
7540
|
-
}
|
|
7541
|
-
const sn = sv.length;
|
|
7542
|
-
sx /= sn;
|
|
7543
|
-
sy /= sn;
|
|
7544
|
-
sz /= sn;
|
|
7545
|
-
const dist = Math.sqrt((ox - sx) ** 2 + (oy - sy) ** 2 + (oz - sz) ** 2);
|
|
7546
|
-
if (dist < bestCentroidDist) {
|
|
7547
|
-
bestCentroidDist = dist;
|
|
7548
|
-
bestCentroidMatch = sf;
|
|
7549
|
-
}
|
|
7550
|
-
} catch {}
|
|
7551
|
-
if (bestCentroidMatch >= 0 && bestCentroidDist < .001) return bestCentroidMatch;
|
|
7552
|
-
}
|
|
7553
|
-
} catch {}
|
|
7554
|
-
return fid;
|
|
7555
|
-
});
|
|
7567
|
+
const resolvedFaceIds = faces.map((f) => resolveShellFaceId(bk, unwrap(f, "face"), solidFaces, solidFaceSet));
|
|
7556
7568
|
return solidHandle(bk.shell(solidId, thickness, resolvedFaceIds));
|
|
7557
7569
|
}
|
|
7558
7570
|
function thicken(bk, shape, thickness) {
|
|
@@ -7704,6 +7716,70 @@ function faceCentroidById(bk, faceId) {
|
|
|
7704
7716
|
}
|
|
7705
7717
|
}
|
|
7706
7718
|
/**
|
|
7719
|
+
* Snapshot a face's signature (hash + normal + centroid). Non-planar faces
|
|
7720
|
+
* fall back to a zero normal so they still participate in centroid-only matching.
|
|
7721
|
+
*/
|
|
7722
|
+
function snapshotFaceSignature(bk, faceId, hash) {
|
|
7723
|
+
try {
|
|
7724
|
+
return {
|
|
7725
|
+
hash,
|
|
7726
|
+
normal: bk.getFaceNormal(faceId),
|
|
7727
|
+
centroid: faceCentroidById(bk, faceId)
|
|
7728
|
+
};
|
|
7729
|
+
} catch {
|
|
7730
|
+
return {
|
|
7731
|
+
hash,
|
|
7732
|
+
normal: [
|
|
7733
|
+
0,
|
|
7734
|
+
0,
|
|
7735
|
+
0
|
|
7736
|
+
],
|
|
7737
|
+
centroid: faceCentroidById(bk, faceId)
|
|
7738
|
+
};
|
|
7739
|
+
}
|
|
7740
|
+
}
|
|
7741
|
+
var NORMAL_THRESHOLD = .707;
|
|
7742
|
+
var CENTROID_DIST_SQ_MAX = 100;
|
|
7743
|
+
var SCORE_TIE_TOL = .05;
|
|
7744
|
+
/**
|
|
7745
|
+
* Score every input face against `out` by combined normal/centroid similarity,
|
|
7746
|
+
* returning the candidate matches above thresholds plus the best observed score.
|
|
7747
|
+
*/
|
|
7748
|
+
function collectOutputMatches(out, inputSigs) {
|
|
7749
|
+
let bestScore = -Infinity;
|
|
7750
|
+
const matches = [];
|
|
7751
|
+
for (let i = 0; i < inputSigs.length; i++) {
|
|
7752
|
+
const inp = require_vec3.wasmIndex(inputSigs, i);
|
|
7753
|
+
const dot = (out.normal[0] ?? 0) * (inp.normal[0] ?? 0) + (out.normal[1] ?? 0) * (inp.normal[1] ?? 0) + (out.normal[2] ?? 0) * (inp.normal[2] ?? 0);
|
|
7754
|
+
if (dot < NORMAL_THRESHOLD) continue;
|
|
7755
|
+
const distSq = centroidDistSq(out.centroid, inp.centroid);
|
|
7756
|
+
if (distSq > CENTROID_DIST_SQ_MAX) continue;
|
|
7757
|
+
const score = dot - distSq / CENTROID_DIST_SQ_MAX;
|
|
7758
|
+
if (score > bestScore) bestScore = score;
|
|
7759
|
+
matches.push({
|
|
7760
|
+
idx: i,
|
|
7761
|
+
score
|
|
7762
|
+
});
|
|
7763
|
+
}
|
|
7764
|
+
return {
|
|
7765
|
+
matches,
|
|
7766
|
+
bestScore
|
|
7767
|
+
};
|
|
7768
|
+
}
|
|
7769
|
+
/** Pick the input signature whose centroid is closest to `out`, or undefined if none. */
|
|
7770
|
+
function findNearestInputByCentroid(out, inputSigs) {
|
|
7771
|
+
let bestDistSq = Infinity;
|
|
7772
|
+
let nearest;
|
|
7773
|
+
for (const inp of inputSigs) {
|
|
7774
|
+
const distSq = centroidDistSq(out.centroid, inp.centroid);
|
|
7775
|
+
if (distSq < bestDistSq) {
|
|
7776
|
+
bestDistSq = distSq;
|
|
7777
|
+
nearest = inp;
|
|
7778
|
+
}
|
|
7779
|
+
}
|
|
7780
|
+
return nearest;
|
|
7781
|
+
}
|
|
7782
|
+
/**
|
|
7707
7783
|
* Match input->output faces geometrically using normal dot product and centroid distance.
|
|
7708
7784
|
* Mirrors the algorithm in brepkit's `boolean_with_evolution`.
|
|
7709
7785
|
*/
|
|
@@ -7715,66 +7791,12 @@ function matchFacesGeometrically(bk, originalShape, inputFaceHashes, outputFaceI
|
|
|
7715
7791
|
const inputSigs = [];
|
|
7716
7792
|
for (let i = 0; i < hashCount; i++) {
|
|
7717
7793
|
const fid = require_vec3.wasmIndex(inputFaceIds, i);
|
|
7718
|
-
|
|
7719
|
-
const normal = bk.getFaceNormal(fid);
|
|
7720
|
-
const centroid = faceCentroidById(bk, fid);
|
|
7721
|
-
inputSigs.push({
|
|
7722
|
-
hash: inputFaceHashes[i] ?? fid % hashUpperBound,
|
|
7723
|
-
normal,
|
|
7724
|
-
centroid
|
|
7725
|
-
});
|
|
7726
|
-
} catch {
|
|
7727
|
-
inputSigs.push({
|
|
7728
|
-
hash: inputFaceHashes[i] ?? fid % hashUpperBound,
|
|
7729
|
-
normal: [
|
|
7730
|
-
0,
|
|
7731
|
-
0,
|
|
7732
|
-
0
|
|
7733
|
-
],
|
|
7734
|
-
centroid: faceCentroidById(bk, fid)
|
|
7735
|
-
});
|
|
7736
|
-
}
|
|
7794
|
+
inputSigs.push(snapshotFaceSignature(bk, fid, inputFaceHashes[i] ?? fid % hashUpperBound));
|
|
7737
7795
|
}
|
|
7738
|
-
const outputSigs =
|
|
7739
|
-
for (const fid of outputFaceIds) try {
|
|
7740
|
-
const normal = bk.getFaceNormal(fid);
|
|
7741
|
-
const centroid = faceCentroidById(bk, fid);
|
|
7742
|
-
outputSigs.push({
|
|
7743
|
-
hash: fid % hashUpperBound,
|
|
7744
|
-
normal,
|
|
7745
|
-
centroid
|
|
7746
|
-
});
|
|
7747
|
-
} catch {
|
|
7748
|
-
outputSigs.push({
|
|
7749
|
-
hash: fid % hashUpperBound,
|
|
7750
|
-
normal: [
|
|
7751
|
-
0,
|
|
7752
|
-
0,
|
|
7753
|
-
0
|
|
7754
|
-
],
|
|
7755
|
-
centroid: faceCentroidById(bk, fid)
|
|
7756
|
-
});
|
|
7757
|
-
}
|
|
7758
|
-
const NORMAL_THRESHOLD = .707;
|
|
7759
|
-
const CENTROID_DIST_SQ_MAX = 100;
|
|
7760
|
-
const SCORE_TIE_TOL = .05;
|
|
7796
|
+
const outputSigs = outputFaceIds.map((fid) => snapshotFaceSignature(bk, fid, fid % hashUpperBound));
|
|
7761
7797
|
const matchedInputIndices = /* @__PURE__ */ new Set();
|
|
7762
7798
|
for (const out of outputSigs) {
|
|
7763
|
-
|
|
7764
|
-
const matches = [];
|
|
7765
|
-
for (let i = 0; i < inputSigs.length; i++) {
|
|
7766
|
-
const inp = require_vec3.wasmIndex(inputSigs, i);
|
|
7767
|
-
const dot = (out.normal[0] ?? 0) * (inp.normal[0] ?? 0) + (out.normal[1] ?? 0) * (inp.normal[1] ?? 0) + (out.normal[2] ?? 0) * (inp.normal[2] ?? 0);
|
|
7768
|
-
if (dot < NORMAL_THRESHOLD) continue;
|
|
7769
|
-
const distSq = centroidDistSq(out.centroid, inp.centroid);
|
|
7770
|
-
if (distSq > CENTROID_DIST_SQ_MAX) continue;
|
|
7771
|
-
const score = dot - distSq / CENTROID_DIST_SQ_MAX;
|
|
7772
|
-
if (score > bestScore) bestScore = score;
|
|
7773
|
-
matches.push({
|
|
7774
|
-
idx: i,
|
|
7775
|
-
score
|
|
7776
|
-
});
|
|
7777
|
-
}
|
|
7799
|
+
const { matches, bestScore } = collectOutputMatches(out, inputSigs);
|
|
7778
7800
|
if (matches.length > 0) {
|
|
7779
7801
|
for (const m of matches) if (m.score >= bestScore - SCORE_TIE_TOL) {
|
|
7780
7802
|
const inp = require_vec3.wasmIndex(inputSigs, m.idx);
|
|
@@ -7784,15 +7806,7 @@ function matchFacesGeometrically(bk, originalShape, inputFaceHashes, outputFaceI
|
|
|
7784
7806
|
matchedInputIndices.add(m.idx);
|
|
7785
7807
|
}
|
|
7786
7808
|
} else {
|
|
7787
|
-
|
|
7788
|
-
let nearestInput;
|
|
7789
|
-
for (const inp of inputSigs) {
|
|
7790
|
-
const distSq = centroidDistSq(out.centroid, inp.centroid);
|
|
7791
|
-
if (distSq < bestDistSq) {
|
|
7792
|
-
bestDistSq = distSq;
|
|
7793
|
-
nearestInput = inp;
|
|
7794
|
-
}
|
|
7795
|
-
}
|
|
7809
|
+
const nearestInput = findNearestInputByCentroid(out, inputSigs);
|
|
7796
7810
|
if (nearestInput) {
|
|
7797
7811
|
const existing = generated.get(nearestInput.hash) ?? [];
|
|
7798
7812
|
existing.push(out.hash);
|
|
@@ -7901,6 +7915,55 @@ function chainEvolutionMap(map, stepModified, stepDeleted, intermediateOutputs,
|
|
|
7901
7915
|
}
|
|
7902
7916
|
}
|
|
7903
7917
|
/**
|
|
7918
|
+
* Fold one child solid of a compound tool into the running boolean accumulator.
|
|
7919
|
+
* Chains existing modified/generated outputs through this step's evolution,
|
|
7920
|
+
* then merges in any step entries not already covered by the chain.
|
|
7921
|
+
*/
|
|
7922
|
+
function mergeCompoundChildStep(result, accum) {
|
|
7923
|
+
const intermediateOutputs = /* @__PURE__ */ new Set();
|
|
7924
|
+
chainEvolutionMap(accum.combinedModified, result.evolution.modified, result.evolution.deleted, intermediateOutputs, accum.combinedDeleted);
|
|
7925
|
+
chainEvolutionMap(accum.combinedGenerated, result.evolution.modified, result.evolution.deleted, intermediateOutputs);
|
|
7926
|
+
for (const [k, v] of result.evolution.modified) {
|
|
7927
|
+
if (accum.combinedModified.has(k) || intermediateOutputs.has(k)) continue;
|
|
7928
|
+
accum.combinedModified.set(k, [...v]);
|
|
7929
|
+
}
|
|
7930
|
+
for (const [k, v] of result.evolution.generated) {
|
|
7931
|
+
if (intermediateOutputs.has(k)) continue;
|
|
7932
|
+
const existing = accum.combinedGenerated.get(k) ?? [];
|
|
7933
|
+
accum.combinedGenerated.set(k, [...existing, ...v]);
|
|
7934
|
+
}
|
|
7935
|
+
for (const d of result.evolution.deleted) {
|
|
7936
|
+
if (!accum.inputFaceHashSet.has(d)) continue;
|
|
7937
|
+
accum.combinedDeleted.add(d);
|
|
7938
|
+
}
|
|
7939
|
+
}
|
|
7940
|
+
/**
|
|
7941
|
+
* Iteratively apply native evolution for each solid in a compound tool, chaining
|
|
7942
|
+
* evolution maps so the original input face hashes resolve to final output hashes
|
|
7943
|
+
* rather than intermediates.
|
|
7944
|
+
*/
|
|
7945
|
+
function applyCompoundBooleanWithHistory(bk, shape, compoundToolId, inputFaceHashes, hashUpperBound, nativeFn) {
|
|
7946
|
+
const childSolidIds = toArray(bk.getCompoundSolids(compoundToolId));
|
|
7947
|
+
let currentShape = shape;
|
|
7948
|
+
const accum = {
|
|
7949
|
+
combinedModified: /* @__PURE__ */ new Map(),
|
|
7950
|
+
combinedGenerated: /* @__PURE__ */ new Map(),
|
|
7951
|
+
combinedDeleted: /* @__PURE__ */ new Set(),
|
|
7952
|
+
inputFaceHashSet: new Set(inputFaceHashes)
|
|
7953
|
+
};
|
|
7954
|
+
for (const childId of childSolidIds) {
|
|
7955
|
+
const ch = currentShape;
|
|
7956
|
+
if (ch.type !== "solid") break;
|
|
7957
|
+
const result = parseNativeEvolution(nativeFn(ch.id, childId), hashUpperBound);
|
|
7958
|
+
currentShape = result.shape;
|
|
7959
|
+
mergeCompoundChildStep(result, accum);
|
|
7960
|
+
}
|
|
7961
|
+
return {
|
|
7962
|
+
shape: currentShape,
|
|
7963
|
+
accum
|
|
7964
|
+
};
|
|
7965
|
+
}
|
|
7966
|
+
/**
|
|
7904
7967
|
* Shared implementation for boolean-with-history operations (fuse, cut, intersect).
|
|
7905
7968
|
*/
|
|
7906
7969
|
function booleanWithHistoryImpl(bk, shape, tool, inputFaceHashes, hashUpperBound, options, nativeFn, fallbackFn, _label) {
|
|
@@ -7921,33 +7984,13 @@ function booleanWithHistoryImpl(bk, shape, tool, inputFaceHashes, hashUpperBound
|
|
|
7921
7984
|
if (!isEmptyBooleanError(e)) throw e;
|
|
7922
7985
|
}
|
|
7923
7986
|
if (th.type === "compound") {
|
|
7924
|
-
const
|
|
7925
|
-
let currentShape = shape;
|
|
7926
|
-
const combinedModified = /* @__PURE__ */ new Map();
|
|
7927
|
-
const combinedGenerated = /* @__PURE__ */ new Map();
|
|
7928
|
-
const combinedDeleted = /* @__PURE__ */ new Set();
|
|
7929
|
-
const inputFaceHashSet = new Set(inputFaceHashes);
|
|
7930
|
-
for (const childId of childSolidIds) {
|
|
7931
|
-
const ch = currentShape;
|
|
7932
|
-
if (ch.type !== "solid") break;
|
|
7933
|
-
const result = parseNativeEvolution(nativeFn(ch.id, childId), hashUpperBound);
|
|
7934
|
-
currentShape = result.shape;
|
|
7935
|
-
const intermediateOutputs = /* @__PURE__ */ new Set();
|
|
7936
|
-
chainEvolutionMap(combinedModified, result.evolution.modified, result.evolution.deleted, intermediateOutputs, combinedDeleted);
|
|
7937
|
-
chainEvolutionMap(combinedGenerated, result.evolution.modified, result.evolution.deleted, intermediateOutputs);
|
|
7938
|
-
for (const [k, v] of result.evolution.modified) if (!combinedModified.has(k) && !intermediateOutputs.has(k)) combinedModified.set(k, [...v]);
|
|
7939
|
-
for (const [k, v] of result.evolution.generated) if (!intermediateOutputs.has(k)) {
|
|
7940
|
-
const existing = combinedGenerated.get(k) ?? [];
|
|
7941
|
-
combinedGenerated.set(k, [...existing, ...v]);
|
|
7942
|
-
}
|
|
7943
|
-
for (const d of result.evolution.deleted) if (inputFaceHashSet.has(d)) combinedDeleted.add(d);
|
|
7944
|
-
}
|
|
7987
|
+
const { shape: resultShape, accum } = applyCompoundBooleanWithHistory(bk, shape, th.id, inputFaceHashes, hashUpperBound, nativeFn);
|
|
7945
7988
|
return {
|
|
7946
|
-
shape:
|
|
7989
|
+
shape: resultShape,
|
|
7947
7990
|
evolution: {
|
|
7948
|
-
modified: combinedModified,
|
|
7949
|
-
generated: combinedGenerated,
|
|
7950
|
-
deleted: combinedDeleted
|
|
7991
|
+
modified: accum.combinedModified,
|
|
7992
|
+
generated: accum.combinedGenerated,
|
|
7993
|
+
deleted: accum.combinedDeleted
|
|
7951
7994
|
},
|
|
7952
7995
|
diagnostics: noDiagnostics
|
|
7953
7996
|
};
|
|
@@ -8975,7 +9018,7 @@ function fillSurface(bk, wires, _options) {
|
|
|
8975
9018
|
pts.push(require_vec3.wasmIndex(p, 0), require_vec3.wasmIndex(p, 1), require_vec3.wasmIndex(p, 2));
|
|
8976
9019
|
}
|
|
8977
9020
|
allCoords.push(...pts);
|
|
8978
|
-
curveLengths.push(
|
|
9021
|
+
curveLengths.push(11);
|
|
8979
9022
|
}
|
|
8980
9023
|
try {
|
|
8981
9024
|
return faceHandle(bk.fillCoonsPatch(allCoords, curveLengths));
|
|
@@ -9631,61 +9674,66 @@ function mapStringTransitionMode(mode) {
|
|
|
9631
9674
|
default: return;
|
|
9632
9675
|
}
|
|
9633
9676
|
}
|
|
9634
|
-
function
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
firstShape: profile,
|
|
9646
|
-
lastShape: profile
|
|
9647
|
-
};
|
|
9648
|
-
return shape;
|
|
9677
|
+
function wrapPipeShellResult(shape, profile, shellMode) {
|
|
9678
|
+
if (shellMode) return {
|
|
9679
|
+
shape,
|
|
9680
|
+
firstShape: profile,
|
|
9681
|
+
lastShape: profile
|
|
9682
|
+
};
|
|
9683
|
+
return shape;
|
|
9684
|
+
}
|
|
9685
|
+
function tryContactModeSweep(bk, faceId, edgeId, contactMode) {
|
|
9686
|
+
try {
|
|
9687
|
+
return solidHandle(bk.sweepWithOptions(faceId, edgeId, contactMode, [], 0, "transformed"));
|
|
9649
9688
|
} catch (e) {
|
|
9650
9689
|
console.warn("brepkit: sweepWithOptions failed, falling back to sweepSmooth/simplePipe:", e);
|
|
9690
|
+
return;
|
|
9651
9691
|
}
|
|
9652
|
-
|
|
9692
|
+
}
|
|
9693
|
+
function resolveContactModeEdge(bk, spine) {
|
|
9694
|
+
try {
|
|
9695
|
+
if (spine.type !== "wire") return { edgeId: unwrap(spine, "edge") };
|
|
9653
9696
|
const edges = iterShapes(bk, spine, "edge");
|
|
9654
9697
|
if (edges.length === 1) {
|
|
9655
9698
|
const first = edges[0];
|
|
9656
|
-
if (first)
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
|
|
9664
|
-
return shape;
|
|
9665
|
-
} catch (e) {
|
|
9666
|
-
console.warn("brepkit: sweepWithOptions failed, falling back to sweepSmooth/simplePipe:", e);
|
|
9667
|
-
}
|
|
9668
|
-
} else warnOnce("sweepPipeShell-transition-multi-edge", "sweepPipeShell transition mode not supported for multi-edge wires; ignored.");
|
|
9699
|
+
if (first) return { edgeId: unwrap(first, "edge") };
|
|
9700
|
+
return;
|
|
9701
|
+
}
|
|
9702
|
+
warnOnce("sweepPipeShell-transition-multi-edge", "sweepPipeShell transition mode not supported for multi-edge wires; ignored.");
|
|
9703
|
+
return;
|
|
9704
|
+
} catch (e) {
|
|
9705
|
+
console.warn("brepkit: resolveContactModeEdge failed for unexpected spine type, falling through:", e);
|
|
9706
|
+
return;
|
|
9669
9707
|
}
|
|
9708
|
+
}
|
|
9709
|
+
function tryContactModePipeShell(bk, faceId, spine, contactMode) {
|
|
9710
|
+
const resolved = resolveContactModeEdge(bk, spine);
|
|
9711
|
+
if (!resolved) return void 0;
|
|
9712
|
+
return tryContactModeSweep(bk, faceId, resolved.edgeId, contactMode);
|
|
9713
|
+
}
|
|
9714
|
+
function trySmoothPipeShell(bk, faceId, spine) {
|
|
9670
9715
|
const nurbsData = extractNurbsFromEdge(bk, spine);
|
|
9671
|
-
if (nurbsData
|
|
9672
|
-
|
|
9673
|
-
|
|
9674
|
-
shape,
|
|
9675
|
-
firstShape: profile,
|
|
9676
|
-
lastShape: profile
|
|
9677
|
-
};
|
|
9678
|
-
return shape;
|
|
9716
|
+
if (!nurbsData || nurbsData.degree <= 1) return void 0;
|
|
9717
|
+
try {
|
|
9718
|
+
return solidHandle(bk.sweepSmooth(faceId, nurbsData.degree, nurbsData.knots, nurbsData.controlPoints, nurbsData.weights));
|
|
9679
9719
|
} catch (e) {
|
|
9680
9720
|
console.warn("brepkit: sweepSmooth failed, falling back to simplePipe:", e);
|
|
9721
|
+
return;
|
|
9681
9722
|
}
|
|
9682
|
-
|
|
9683
|
-
|
|
9684
|
-
|
|
9685
|
-
|
|
9686
|
-
|
|
9687
|
-
|
|
9688
|
-
|
|
9723
|
+
}
|
|
9724
|
+
function sweepPipeShell(bk, profile, spine, options) {
|
|
9725
|
+
const profileHandle = profile;
|
|
9726
|
+
const faceId = profileHandle.type === "wire" ? bk.makeFaceFromWire(profileHandle.id) : unwrap(profile, "face");
|
|
9727
|
+
const shellMode = !!(options && options["shellMode"]);
|
|
9728
|
+
const transitionMode = options?.["transitionMode"];
|
|
9729
|
+
const contactMode = transitionMode ? mapStringTransitionMode(transitionMode) : void 0;
|
|
9730
|
+
if (contactMode) {
|
|
9731
|
+
const shape = tryContactModePipeShell(bk, faceId, spine, contactMode);
|
|
9732
|
+
if (shape) return wrapPipeShellResult(shape, profile, shellMode);
|
|
9733
|
+
}
|
|
9734
|
+
const smoothShape = trySmoothPipeShell(bk, faceId, spine);
|
|
9735
|
+
if (smoothShape) return wrapPipeShellResult(smoothShape, profile, shellMode);
|
|
9736
|
+
return wrapPipeShellResult(simplePipe(bk, profile, spine), profile, shellMode);
|
|
9689
9737
|
}
|
|
9690
9738
|
function loftAdvanced(bk, wires, options) {
|
|
9691
9739
|
const faceIds = wires.map((w) => {
|
|
@@ -9956,7 +10004,7 @@ async function init() {
|
|
|
9956
10004
|
throw new Error("brepjs: no kernel package found. Install one of:\n npm install brepjs-opencascade (recommended)\n npm install brepkit-wasm\n npm install occt-wasm (requires manual registerKernel)");
|
|
9957
10005
|
}
|
|
9958
10006
|
//#endregion
|
|
9959
|
-
//#region \0@oxc-project+runtime@0.
|
|
10007
|
+
//#region \0@oxc-project+runtime@0.132.0/helpers/usingCtx.js
|
|
9960
10008
|
function _usingCtx() {
|
|
9961
10009
|
var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
|
|
9962
10010
|
var n = Error();
|