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
|
-
import { n as wasmIndex, t as vec3At } from "./vec3-
|
|
2
|
-
import { _ as serializeCurve2d$2, a as curveTypeName, c as intersectCurves2dFn, d as makeEllipse2d$2, f as makeLine2d$2, g as scaleCurve2d$2, h as rotateCurve2d$2, i as curveBounds, l as makeBezier2d$2, m as mirrorAtPoint, n as addCurveToBBox, o as deserializeCurve2d$2, p as mirrorAcrossAxis, r as createBBox2d, s as evaluateCurve2d$2, u as makeCircle2d$2, v as tangentCurve2d, y as translateCurve2d$2 } from "./occtWasmAdapter
|
|
3
|
-
import { A as ok, b as err } from "./errors-
|
|
1
|
+
import { n as wasmIndex, t as vec3At } from "./vec3-Dpha8d5k.js";
|
|
2
|
+
import { _ as serializeCurve2d$2, a as curveTypeName, c as intersectCurves2dFn, d as makeEllipse2d$2, f as makeLine2d$2, g as scaleCurve2d$2, h as rotateCurve2d$2, i as curveBounds, l as makeBezier2d$2, m as mirrorAtPoint, n as addCurveToBBox, o as deserializeCurve2d$2, p as mirrorAcrossAxis, r as createBBox2d, s as evaluateCurve2d$2, u as makeCircle2d$2, v as tangentCurve2d, y as translateCurve2d$2 } from "./occtWasmAdapter-Dtp7Wu27.js";
|
|
3
|
+
import { A as ok, b as err } from "./errors-BJSTLaDI.js";
|
|
4
4
|
//#region src/kernel/kernel2dTypes.ts
|
|
5
5
|
/** Check if the kernel supports 2D geometry operations. */
|
|
6
6
|
function supportsKernel2D(kernel) {
|
|
@@ -5834,88 +5834,95 @@ function resolveUniformAngle(faces, angleDeg) {
|
|
|
5834
5834
|
}
|
|
5835
5835
|
//#endregion
|
|
5836
5836
|
//#region src/kernel/brepkit/topologyOps.ts
|
|
5837
|
+
function iterCompound(bk, h, type) {
|
|
5838
|
+
const children = syntheticCompounds.get(h);
|
|
5839
|
+
if (children) return children.flatMap((child) => child.type === type ? [child] : iterShapes(bk, child, type));
|
|
5840
|
+
if (type === "solid") return toArray(bk.getCompoundSolids(h)).map(solidHandle);
|
|
5841
|
+
if (type === "face" || type === "edge" || type === "vertex" || type === "wire") return toArray(bk.getCompoundSolids(h)).map(solidHandle).flatMap((s) => iterShapes(bk, s, type));
|
|
5842
|
+
return [];
|
|
5843
|
+
}
|
|
5844
|
+
function iterSolid(bk, h, type) {
|
|
5845
|
+
switch (type) {
|
|
5846
|
+
case "face": return toArray(bk.getSolidFaces(h)).map(faceHandle);
|
|
5847
|
+
case "edge": return toArray(bk.getSolidEdges(h)).map(edgeHandle);
|
|
5848
|
+
case "vertex": return toArray(bk.getSolidVertices(h)).map(vertexHandle);
|
|
5849
|
+
case "wire": return toArray(bk.getSolidFaces(h)).flatMap((faceId) => toArray(bk.getFaceWires(faceId)).map(wireHandle));
|
|
5850
|
+
default: return [];
|
|
5851
|
+
}
|
|
5852
|
+
}
|
|
5853
|
+
function iterShellChildren(bk, h, type) {
|
|
5854
|
+
const faces = toArray(bk.getShellFaces(h)).map(faceHandle);
|
|
5855
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5856
|
+
const results = [];
|
|
5857
|
+
for (const face of faces) for (const child of iterShapes(bk, face, type)) {
|
|
5858
|
+
const childId = unwrap(child);
|
|
5859
|
+
if (seen.has(childId)) continue;
|
|
5860
|
+
seen.add(childId);
|
|
5861
|
+
results.push(child);
|
|
5862
|
+
}
|
|
5863
|
+
return results;
|
|
5864
|
+
}
|
|
5865
|
+
function iterShell(bk, h, type) {
|
|
5866
|
+
if (type === "face") return toArray(bk.getShellFaces(h)).map(faceHandle);
|
|
5867
|
+
if (type === "edge" || type === "vertex") return iterShellChildren(bk, h, type);
|
|
5868
|
+
return [];
|
|
5869
|
+
}
|
|
5870
|
+
function iterFace(bk, shape, h, type) {
|
|
5871
|
+
if (type === "face") return [shape];
|
|
5872
|
+
if (type === "edge") return toArray(bk.getFaceEdges(h)).map(edgeHandle);
|
|
5873
|
+
if (type === "vertex") return toArray(bk.getFaceVertices(h)).map(vertexHandle);
|
|
5874
|
+
if (type === "wire") return toArray(bk.getFaceWires(h)).map(wireHandle);
|
|
5875
|
+
return [];
|
|
5876
|
+
}
|
|
5877
|
+
function uniqueWireVertices(bk, h) {
|
|
5878
|
+
const edgeIds = toArray(bk.getWireEdges(h));
|
|
5879
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5880
|
+
const results = [];
|
|
5881
|
+
for (const eid of edgeIds) {
|
|
5882
|
+
const verts = bk.getEdgeVertices(eid);
|
|
5883
|
+
const coords = [[
|
|
5884
|
+
wasmIndex(verts, 0),
|
|
5885
|
+
wasmIndex(verts, 1),
|
|
5886
|
+
wasmIndex(verts, 2)
|
|
5887
|
+
], [
|
|
5888
|
+
wasmIndex(verts, 3),
|
|
5889
|
+
wasmIndex(verts, 4),
|
|
5890
|
+
wasmIndex(verts, 5)
|
|
5891
|
+
]];
|
|
5892
|
+
for (const [x, y, z] of coords) {
|
|
5893
|
+
const key = `${x},${y},${z}`;
|
|
5894
|
+
if (seen.has(key)) continue;
|
|
5895
|
+
seen.add(key);
|
|
5896
|
+
results.push(vertexHandle(bk.makeVertex(x, y, z)));
|
|
5897
|
+
}
|
|
5898
|
+
}
|
|
5899
|
+
return results;
|
|
5900
|
+
}
|
|
5901
|
+
function iterWire(bk, shape, h, type) {
|
|
5902
|
+
if (type === "wire") return [shape];
|
|
5903
|
+
if (type === "edge") return toArray(bk.getWireEdges(h)).map(edgeHandle);
|
|
5904
|
+
if (type === "vertex") return uniqueWireVertices(bk, h);
|
|
5905
|
+
return [];
|
|
5906
|
+
}
|
|
5907
|
+
function iterEdge(bk, shape, h, type) {
|
|
5908
|
+
if (type === "edge") return [shape];
|
|
5909
|
+
if (type === "vertex") {
|
|
5910
|
+
const verts = bk.getEdgeVertices(h);
|
|
5911
|
+
const v1 = bk.makeVertex(wasmIndex(verts, 0), wasmIndex(verts, 1), wasmIndex(verts, 2));
|
|
5912
|
+
const v2 = bk.makeVertex(wasmIndex(verts, 3), wasmIndex(verts, 4), wasmIndex(verts, 5));
|
|
5913
|
+
return [vertexHandle(v1), vertexHandle(v2)];
|
|
5914
|
+
}
|
|
5915
|
+
return [];
|
|
5916
|
+
}
|
|
5837
5917
|
function iterShapes(bk, shape, type) {
|
|
5838
5918
|
const h = unwrap(shape);
|
|
5839
5919
|
switch (shape.type) {
|
|
5840
|
-
case "compound":
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
return results;
|
|
5847
|
-
}
|
|
5848
|
-
if (type === "solid") return toArray(bk.getCompoundSolids(h)).map(solidHandle);
|
|
5849
|
-
if (type === "face" || type === "edge" || type === "vertex" || type === "wire") return toArray(bk.getCompoundSolids(h)).map(solidHandle).flatMap((s) => iterShapes(bk, s, type));
|
|
5850
|
-
return [];
|
|
5851
|
-
}
|
|
5852
|
-
case "solid": switch (type) {
|
|
5853
|
-
case "face": return toArray(bk.getSolidFaces(h)).map(faceHandle);
|
|
5854
|
-
case "edge": return toArray(bk.getSolidEdges(h)).map(edgeHandle);
|
|
5855
|
-
case "vertex": return toArray(bk.getSolidVertices(h)).map(vertexHandle);
|
|
5856
|
-
case "wire": return toArray(bk.getSolidFaces(h)).flatMap((faceId) => toArray(bk.getFaceWires(faceId)).map(wireHandle));
|
|
5857
|
-
default: return [];
|
|
5858
|
-
}
|
|
5859
|
-
case "shell":
|
|
5860
|
-
if (type === "face") return toArray(bk.getShellFaces(h)).map(faceHandle);
|
|
5861
|
-
if (type === "edge" || type === "vertex") {
|
|
5862
|
-
const faces = toArray(bk.getShellFaces(h)).map(faceHandle);
|
|
5863
|
-
const seen = /* @__PURE__ */ new Set();
|
|
5864
|
-
const results = [];
|
|
5865
|
-
for (const face of faces) for (const child of iterShapes(bk, face, type)) {
|
|
5866
|
-
const childId = unwrap(child);
|
|
5867
|
-
if (!seen.has(childId)) {
|
|
5868
|
-
seen.add(childId);
|
|
5869
|
-
results.push(child);
|
|
5870
|
-
}
|
|
5871
|
-
}
|
|
5872
|
-
return results;
|
|
5873
|
-
}
|
|
5874
|
-
return [];
|
|
5875
|
-
case "face":
|
|
5876
|
-
if (type === "face") return [shape];
|
|
5877
|
-
if (type === "edge") return toArray(bk.getFaceEdges(h)).map(edgeHandle);
|
|
5878
|
-
if (type === "vertex") return toArray(bk.getFaceVertices(h)).map(vertexHandle);
|
|
5879
|
-
if (type === "wire") return toArray(bk.getFaceWires(h)).map(wireHandle);
|
|
5880
|
-
return [];
|
|
5881
|
-
case "wire":
|
|
5882
|
-
if (type === "wire") return [shape];
|
|
5883
|
-
if (type === "edge") return toArray(bk.getWireEdges(h)).map(edgeHandle);
|
|
5884
|
-
if (type === "vertex") {
|
|
5885
|
-
const edgeIds = toArray(bk.getWireEdges(h));
|
|
5886
|
-
const seen = /* @__PURE__ */ new Set();
|
|
5887
|
-
const results = [];
|
|
5888
|
-
for (const eid of edgeIds) {
|
|
5889
|
-
const verts = bk.getEdgeVertices(eid);
|
|
5890
|
-
const coords = [[
|
|
5891
|
-
wasmIndex(verts, 0),
|
|
5892
|
-
wasmIndex(verts, 1),
|
|
5893
|
-
wasmIndex(verts, 2)
|
|
5894
|
-
], [
|
|
5895
|
-
wasmIndex(verts, 3),
|
|
5896
|
-
wasmIndex(verts, 4),
|
|
5897
|
-
wasmIndex(verts, 5)
|
|
5898
|
-
]];
|
|
5899
|
-
for (const [x, y, z] of coords) {
|
|
5900
|
-
const key = `${x},${y},${z}`;
|
|
5901
|
-
if (!seen.has(key)) {
|
|
5902
|
-
seen.add(key);
|
|
5903
|
-
results.push(vertexHandle(bk.makeVertex(x, y, z)));
|
|
5904
|
-
}
|
|
5905
|
-
}
|
|
5906
|
-
}
|
|
5907
|
-
return results;
|
|
5908
|
-
}
|
|
5909
|
-
return [];
|
|
5910
|
-
case "edge":
|
|
5911
|
-
if (type === "edge") return [shape];
|
|
5912
|
-
if (type === "vertex") {
|
|
5913
|
-
const verts = bk.getEdgeVertices(h);
|
|
5914
|
-
const v1 = bk.makeVertex(wasmIndex(verts, 0), wasmIndex(verts, 1), wasmIndex(verts, 2));
|
|
5915
|
-
const v2 = bk.makeVertex(wasmIndex(verts, 3), wasmIndex(verts, 4), wasmIndex(verts, 5));
|
|
5916
|
-
return [vertexHandle(v1), vertexHandle(v2)];
|
|
5917
|
-
}
|
|
5918
|
-
return [];
|
|
5920
|
+
case "compound": return iterCompound(bk, h, type);
|
|
5921
|
+
case "solid": return iterSolid(bk, h, type);
|
|
5922
|
+
case "shell": return iterShell(bk, h, type);
|
|
5923
|
+
case "face": return iterFace(bk, shape, h, type);
|
|
5924
|
+
case "wire": return iterWire(bk, shape, h, type);
|
|
5925
|
+
case "edge": return iterEdge(bk, shape, h, type);
|
|
5919
5926
|
default: return [];
|
|
5920
5927
|
}
|
|
5921
5928
|
}
|
|
@@ -5960,14 +5967,15 @@ function adjacentFaces(bk, shape, face) {
|
|
|
5960
5967
|
const faceId = unwrap(face, "face");
|
|
5961
5968
|
return Array.from(bk.adjacentFaces(solidId, faceId)).map((id) => faceHandle(id));
|
|
5962
5969
|
}
|
|
5970
|
+
function faceIdsForSew(bk, shape) {
|
|
5971
|
+
const h = shape;
|
|
5972
|
+
if (h.type === "face") return [h.id];
|
|
5973
|
+
if (h.type === "solid") return toArray(bk.getSolidFaces(h.id));
|
|
5974
|
+
if (h.type === "shell") return toArray(bk.getShellFaces(h.id));
|
|
5975
|
+
return [];
|
|
5976
|
+
}
|
|
5963
5977
|
function sew(bk, shapes, tolerance) {
|
|
5964
|
-
const faceIds =
|
|
5965
|
-
for (const s of shapes) {
|
|
5966
|
-
const h = s;
|
|
5967
|
-
if (h.type === "face") faceIds.push(h.id);
|
|
5968
|
-
else if (h.type === "solid") for (const fid of toArray(bk.getSolidFaces(h.id))) faceIds.push(fid);
|
|
5969
|
-
else if (h.type === "shell") for (const fid of toArray(bk.getShellFaces(h.id))) faceIds.push(fid);
|
|
5970
|
-
}
|
|
5978
|
+
const faceIds = shapes.flatMap((s) => faceIdsForSew(bk, s));
|
|
5971
5979
|
const tol = tolerance ?? 1e-7;
|
|
5972
5980
|
try {
|
|
5973
5981
|
return shellHandle(bk.weldShellsAndFaces(faceIds, tol));
|
|
@@ -7284,9 +7292,9 @@ function makeCircleNurbs(bk, center, normal, radius, startAngle, endAngle) {
|
|
|
7284
7292
|
weights.push(1);
|
|
7285
7293
|
}
|
|
7286
7294
|
const degree = 2;
|
|
7287
|
-
const knots = Array(
|
|
7295
|
+
const knots = Array(3).fill(0);
|
|
7288
7296
|
for (let i = 1; i < nSegments; i++) knots.push(i, i);
|
|
7289
|
-
knots.push(...Array(
|
|
7297
|
+
knots.push(...Array(3).fill(nSegments));
|
|
7290
7298
|
const kMax = wasmIndex(knots, knots.length - 1);
|
|
7291
7299
|
for (let i = 0; i < knots.length; i++) knots[i] = wasmIndex(knots, i) / kMax;
|
|
7292
7300
|
const sx = wasmIndex(controlPoints, 0);
|
|
@@ -7365,9 +7373,9 @@ function makeEllipseNurbs(bk, center, normal, majorRadius, minorRadius, startAng
|
|
|
7365
7373
|
weights.push(1);
|
|
7366
7374
|
}
|
|
7367
7375
|
const degree = 2;
|
|
7368
|
-
const knots = Array(
|
|
7376
|
+
const knots = Array(3).fill(0);
|
|
7369
7377
|
for (let i = 1; i < nSegments; i++) knots.push(i, i);
|
|
7370
|
-
knots.push(...Array(
|
|
7378
|
+
knots.push(...Array(3).fill(nSegments));
|
|
7371
7379
|
const kMax = wasmIndex(knots, knots.length - 1);
|
|
7372
7380
|
for (let i = 0; i < knots.length; i++) knots[i] = wasmIndex(knots, i) / kMax;
|
|
7373
7381
|
const sx = wasmIndex(controlPoints, 0);
|
|
@@ -7486,69 +7494,73 @@ function chamferDistAngle(bk, shape, edges, distance, angleDeg) {
|
|
|
7486
7494
|
warnOnce("chamfer-dist-angle", "chamferAsymmetric not available; using averaged distance.");
|
|
7487
7495
|
return solidHandle(bk.chamfer(solidId, edgeIds, (distance + d2) / 2));
|
|
7488
7496
|
}
|
|
7497
|
+
function faceCentroid(bk, faceId) {
|
|
7498
|
+
const verts = toArray(bk.getFaceVertices(faceId));
|
|
7499
|
+
if (verts.length < 1) return null;
|
|
7500
|
+
let x = 0, y = 0, z = 0;
|
|
7501
|
+
for (const vid of verts) {
|
|
7502
|
+
const pos = bk.getVertexPosition(vid);
|
|
7503
|
+
x += wasmIndex(pos, 0);
|
|
7504
|
+
y += wasmIndex(pos, 1);
|
|
7505
|
+
z += wasmIndex(pos, 2);
|
|
7506
|
+
}
|
|
7507
|
+
const n = verts.length;
|
|
7508
|
+
return {
|
|
7509
|
+
x: x / n,
|
|
7510
|
+
y: y / n,
|
|
7511
|
+
z: z / n
|
|
7512
|
+
};
|
|
7513
|
+
}
|
|
7514
|
+
function findBestNormalMatch(bk, origFaceId, solidFaces) {
|
|
7515
|
+
try {
|
|
7516
|
+
const origNormal = bk.getFaceNormal(origFaceId);
|
|
7517
|
+
let bestMatch = -1;
|
|
7518
|
+
let bestDot = -2;
|
|
7519
|
+
for (const sf of solidFaces) try {
|
|
7520
|
+
const sn = bk.getFaceNormal(sf);
|
|
7521
|
+
const dot = (origNormal[0] ?? 0) * (sn[0] ?? 0) + (origNormal[1] ?? 0) * (sn[1] ?? 0) + (origNormal[2] ?? 0) * (sn[2] ?? 0);
|
|
7522
|
+
if (dot > bestDot) {
|
|
7523
|
+
bestDot = dot;
|
|
7524
|
+
bestMatch = sf;
|
|
7525
|
+
}
|
|
7526
|
+
} catch {}
|
|
7527
|
+
if (bestMatch >= 0 && bestDot > .99) return bestMatch;
|
|
7528
|
+
} catch {}
|
|
7529
|
+
return null;
|
|
7530
|
+
}
|
|
7531
|
+
function findBestCentroidMatch(bk, origFaceId, solidFaces) {
|
|
7532
|
+
try {
|
|
7533
|
+
const origCentroid = faceCentroid(bk, origFaceId);
|
|
7534
|
+
if (origCentroid === null) return null;
|
|
7535
|
+
let bestMatch = -1;
|
|
7536
|
+
let bestDist = Infinity;
|
|
7537
|
+
for (const sf of solidFaces) try {
|
|
7538
|
+
const sc = faceCentroid(bk, sf);
|
|
7539
|
+
if (sc === null) continue;
|
|
7540
|
+
const dist = Math.sqrt((origCentroid.x - sc.x) ** 2 + (origCentroid.y - sc.y) ** 2 + (origCentroid.z - sc.z) ** 2);
|
|
7541
|
+
if (dist < bestDist) {
|
|
7542
|
+
bestDist = dist;
|
|
7543
|
+
bestMatch = sf;
|
|
7544
|
+
}
|
|
7545
|
+
} catch {}
|
|
7546
|
+
if (bestMatch >= 0 && bestDist < .001) return bestMatch;
|
|
7547
|
+
} catch {}
|
|
7548
|
+
return null;
|
|
7549
|
+
}
|
|
7550
|
+
function resolveShellFaceId(bk, fid, solidFaces, solidFaceSet) {
|
|
7551
|
+
if (solidFaceSet.has(fid)) return fid;
|
|
7552
|
+
const normalMatch = findBestNormalMatch(bk, fid, solidFaces);
|
|
7553
|
+
if (normalMatch !== null) return normalMatch;
|
|
7554
|
+
const centroidMatch = findBestCentroidMatch(bk, fid, solidFaces);
|
|
7555
|
+
if (centroidMatch !== null) return centroidMatch;
|
|
7556
|
+
return fid;
|
|
7557
|
+
}
|
|
7489
7558
|
function shell(bk, shape, faces, thickness, tolerance) {
|
|
7490
7559
|
if (tolerance !== void 0) warnOnce("shell-tolerance", "shell() tolerance parameter is not supported; brepkit uses its own internal tolerance.");
|
|
7491
7560
|
const solidId = unwrapSolidOrThrow(shape, "shell");
|
|
7492
7561
|
const solidFaces = toArray(bk.getSolidFaces(solidId));
|
|
7493
7562
|
const solidFaceSet = new Set(solidFaces);
|
|
7494
|
-
const resolvedFaceIds = faces.map((f) =>
|
|
7495
|
-
const fid = unwrap(f, "face");
|
|
7496
|
-
if (solidFaceSet.has(fid)) return fid;
|
|
7497
|
-
try {
|
|
7498
|
-
const origNormal = bk.getFaceNormal(fid);
|
|
7499
|
-
let bestMatch = -1;
|
|
7500
|
-
let bestDot = -2;
|
|
7501
|
-
for (const sf of solidFaces) try {
|
|
7502
|
-
const sn = bk.getFaceNormal(sf);
|
|
7503
|
-
const dot = (origNormal[0] ?? 0) * (sn[0] ?? 0) + (origNormal[1] ?? 0) * (sn[1] ?? 0) + (origNormal[2] ?? 0) * (sn[2] ?? 0);
|
|
7504
|
-
if (dot > bestDot) {
|
|
7505
|
-
bestDot = dot;
|
|
7506
|
-
bestMatch = sf;
|
|
7507
|
-
}
|
|
7508
|
-
} catch {}
|
|
7509
|
-
if (bestMatch >= 0 && bestDot > .99) return bestMatch;
|
|
7510
|
-
} catch {}
|
|
7511
|
-
try {
|
|
7512
|
-
const origVerts = toArray(bk.getFaceVertices(fid));
|
|
7513
|
-
if (origVerts.length >= 1) {
|
|
7514
|
-
let ox = 0, oy = 0, oz = 0;
|
|
7515
|
-
for (const vid of origVerts) {
|
|
7516
|
-
const pos = bk.getVertexPosition(vid);
|
|
7517
|
-
ox += wasmIndex(pos, 0);
|
|
7518
|
-
oy += wasmIndex(pos, 1);
|
|
7519
|
-
oz += wasmIndex(pos, 2);
|
|
7520
|
-
}
|
|
7521
|
-
const n = origVerts.length;
|
|
7522
|
-
ox /= n;
|
|
7523
|
-
oy /= n;
|
|
7524
|
-
oz /= n;
|
|
7525
|
-
let bestCentroidMatch = -1;
|
|
7526
|
-
let bestCentroidDist = Infinity;
|
|
7527
|
-
for (const sf of solidFaces) try {
|
|
7528
|
-
const sv = toArray(bk.getFaceVertices(sf));
|
|
7529
|
-
if (sv.length < 1) continue;
|
|
7530
|
-
let sx = 0, sy = 0, sz = 0;
|
|
7531
|
-
for (const svid of sv) {
|
|
7532
|
-
const spos = bk.getVertexPosition(svid);
|
|
7533
|
-
sx += wasmIndex(spos, 0);
|
|
7534
|
-
sy += wasmIndex(spos, 1);
|
|
7535
|
-
sz += wasmIndex(spos, 2);
|
|
7536
|
-
}
|
|
7537
|
-
const sn = sv.length;
|
|
7538
|
-
sx /= sn;
|
|
7539
|
-
sy /= sn;
|
|
7540
|
-
sz /= sn;
|
|
7541
|
-
const dist = Math.sqrt((ox - sx) ** 2 + (oy - sy) ** 2 + (oz - sz) ** 2);
|
|
7542
|
-
if (dist < bestCentroidDist) {
|
|
7543
|
-
bestCentroidDist = dist;
|
|
7544
|
-
bestCentroidMatch = sf;
|
|
7545
|
-
}
|
|
7546
|
-
} catch {}
|
|
7547
|
-
if (bestCentroidMatch >= 0 && bestCentroidDist < .001) return bestCentroidMatch;
|
|
7548
|
-
}
|
|
7549
|
-
} catch {}
|
|
7550
|
-
return fid;
|
|
7551
|
-
});
|
|
7563
|
+
const resolvedFaceIds = faces.map((f) => resolveShellFaceId(bk, unwrap(f, "face"), solidFaces, solidFaceSet));
|
|
7552
7564
|
return solidHandle(bk.shell(solidId, thickness, resolvedFaceIds));
|
|
7553
7565
|
}
|
|
7554
7566
|
function thicken(bk, shape, thickness) {
|
|
@@ -7700,6 +7712,70 @@ function faceCentroidById(bk, faceId) {
|
|
|
7700
7712
|
}
|
|
7701
7713
|
}
|
|
7702
7714
|
/**
|
|
7715
|
+
* Snapshot a face's signature (hash + normal + centroid). Non-planar faces
|
|
7716
|
+
* fall back to a zero normal so they still participate in centroid-only matching.
|
|
7717
|
+
*/
|
|
7718
|
+
function snapshotFaceSignature(bk, faceId, hash) {
|
|
7719
|
+
try {
|
|
7720
|
+
return {
|
|
7721
|
+
hash,
|
|
7722
|
+
normal: bk.getFaceNormal(faceId),
|
|
7723
|
+
centroid: faceCentroidById(bk, faceId)
|
|
7724
|
+
};
|
|
7725
|
+
} catch {
|
|
7726
|
+
return {
|
|
7727
|
+
hash,
|
|
7728
|
+
normal: [
|
|
7729
|
+
0,
|
|
7730
|
+
0,
|
|
7731
|
+
0
|
|
7732
|
+
],
|
|
7733
|
+
centroid: faceCentroidById(bk, faceId)
|
|
7734
|
+
};
|
|
7735
|
+
}
|
|
7736
|
+
}
|
|
7737
|
+
var NORMAL_THRESHOLD = .707;
|
|
7738
|
+
var CENTROID_DIST_SQ_MAX = 100;
|
|
7739
|
+
var SCORE_TIE_TOL = .05;
|
|
7740
|
+
/**
|
|
7741
|
+
* Score every input face against `out` by combined normal/centroid similarity,
|
|
7742
|
+
* returning the candidate matches above thresholds plus the best observed score.
|
|
7743
|
+
*/
|
|
7744
|
+
function collectOutputMatches(out, inputSigs) {
|
|
7745
|
+
let bestScore = -Infinity;
|
|
7746
|
+
const matches = [];
|
|
7747
|
+
for (let i = 0; i < inputSigs.length; i++) {
|
|
7748
|
+
const inp = wasmIndex(inputSigs, i);
|
|
7749
|
+
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);
|
|
7750
|
+
if (dot < NORMAL_THRESHOLD) continue;
|
|
7751
|
+
const distSq = centroidDistSq(out.centroid, inp.centroid);
|
|
7752
|
+
if (distSq > CENTROID_DIST_SQ_MAX) continue;
|
|
7753
|
+
const score = dot - distSq / CENTROID_DIST_SQ_MAX;
|
|
7754
|
+
if (score > bestScore) bestScore = score;
|
|
7755
|
+
matches.push({
|
|
7756
|
+
idx: i,
|
|
7757
|
+
score
|
|
7758
|
+
});
|
|
7759
|
+
}
|
|
7760
|
+
return {
|
|
7761
|
+
matches,
|
|
7762
|
+
bestScore
|
|
7763
|
+
};
|
|
7764
|
+
}
|
|
7765
|
+
/** Pick the input signature whose centroid is closest to `out`, or undefined if none. */
|
|
7766
|
+
function findNearestInputByCentroid(out, inputSigs) {
|
|
7767
|
+
let bestDistSq = Infinity;
|
|
7768
|
+
let nearest;
|
|
7769
|
+
for (const inp of inputSigs) {
|
|
7770
|
+
const distSq = centroidDistSq(out.centroid, inp.centroid);
|
|
7771
|
+
if (distSq < bestDistSq) {
|
|
7772
|
+
bestDistSq = distSq;
|
|
7773
|
+
nearest = inp;
|
|
7774
|
+
}
|
|
7775
|
+
}
|
|
7776
|
+
return nearest;
|
|
7777
|
+
}
|
|
7778
|
+
/**
|
|
7703
7779
|
* Match input->output faces geometrically using normal dot product and centroid distance.
|
|
7704
7780
|
* Mirrors the algorithm in brepkit's `boolean_with_evolution`.
|
|
7705
7781
|
*/
|
|
@@ -7711,66 +7787,12 @@ function matchFacesGeometrically(bk, originalShape, inputFaceHashes, outputFaceI
|
|
|
7711
7787
|
const inputSigs = [];
|
|
7712
7788
|
for (let i = 0; i < hashCount; i++) {
|
|
7713
7789
|
const fid = wasmIndex(inputFaceIds, i);
|
|
7714
|
-
|
|
7715
|
-
const normal = bk.getFaceNormal(fid);
|
|
7716
|
-
const centroid = faceCentroidById(bk, fid);
|
|
7717
|
-
inputSigs.push({
|
|
7718
|
-
hash: inputFaceHashes[i] ?? fid % hashUpperBound,
|
|
7719
|
-
normal,
|
|
7720
|
-
centroid
|
|
7721
|
-
});
|
|
7722
|
-
} catch {
|
|
7723
|
-
inputSigs.push({
|
|
7724
|
-
hash: inputFaceHashes[i] ?? fid % hashUpperBound,
|
|
7725
|
-
normal: [
|
|
7726
|
-
0,
|
|
7727
|
-
0,
|
|
7728
|
-
0
|
|
7729
|
-
],
|
|
7730
|
-
centroid: faceCentroidById(bk, fid)
|
|
7731
|
-
});
|
|
7732
|
-
}
|
|
7790
|
+
inputSigs.push(snapshotFaceSignature(bk, fid, inputFaceHashes[i] ?? fid % hashUpperBound));
|
|
7733
7791
|
}
|
|
7734
|
-
const outputSigs =
|
|
7735
|
-
for (const fid of outputFaceIds) try {
|
|
7736
|
-
const normal = bk.getFaceNormal(fid);
|
|
7737
|
-
const centroid = faceCentroidById(bk, fid);
|
|
7738
|
-
outputSigs.push({
|
|
7739
|
-
hash: fid % hashUpperBound,
|
|
7740
|
-
normal,
|
|
7741
|
-
centroid
|
|
7742
|
-
});
|
|
7743
|
-
} catch {
|
|
7744
|
-
outputSigs.push({
|
|
7745
|
-
hash: fid % hashUpperBound,
|
|
7746
|
-
normal: [
|
|
7747
|
-
0,
|
|
7748
|
-
0,
|
|
7749
|
-
0
|
|
7750
|
-
],
|
|
7751
|
-
centroid: faceCentroidById(bk, fid)
|
|
7752
|
-
});
|
|
7753
|
-
}
|
|
7754
|
-
const NORMAL_THRESHOLD = .707;
|
|
7755
|
-
const CENTROID_DIST_SQ_MAX = 100;
|
|
7756
|
-
const SCORE_TIE_TOL = .05;
|
|
7792
|
+
const outputSigs = outputFaceIds.map((fid) => snapshotFaceSignature(bk, fid, fid % hashUpperBound));
|
|
7757
7793
|
const matchedInputIndices = /* @__PURE__ */ new Set();
|
|
7758
7794
|
for (const out of outputSigs) {
|
|
7759
|
-
|
|
7760
|
-
const matches = [];
|
|
7761
|
-
for (let i = 0; i < inputSigs.length; i++) {
|
|
7762
|
-
const inp = wasmIndex(inputSigs, i);
|
|
7763
|
-
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);
|
|
7764
|
-
if (dot < NORMAL_THRESHOLD) continue;
|
|
7765
|
-
const distSq = centroidDistSq(out.centroid, inp.centroid);
|
|
7766
|
-
if (distSq > CENTROID_DIST_SQ_MAX) continue;
|
|
7767
|
-
const score = dot - distSq / CENTROID_DIST_SQ_MAX;
|
|
7768
|
-
if (score > bestScore) bestScore = score;
|
|
7769
|
-
matches.push({
|
|
7770
|
-
idx: i,
|
|
7771
|
-
score
|
|
7772
|
-
});
|
|
7773
|
-
}
|
|
7795
|
+
const { matches, bestScore } = collectOutputMatches(out, inputSigs);
|
|
7774
7796
|
if (matches.length > 0) {
|
|
7775
7797
|
for (const m of matches) if (m.score >= bestScore - SCORE_TIE_TOL) {
|
|
7776
7798
|
const inp = wasmIndex(inputSigs, m.idx);
|
|
@@ -7780,15 +7802,7 @@ function matchFacesGeometrically(bk, originalShape, inputFaceHashes, outputFaceI
|
|
|
7780
7802
|
matchedInputIndices.add(m.idx);
|
|
7781
7803
|
}
|
|
7782
7804
|
} else {
|
|
7783
|
-
|
|
7784
|
-
let nearestInput;
|
|
7785
|
-
for (const inp of inputSigs) {
|
|
7786
|
-
const distSq = centroidDistSq(out.centroid, inp.centroid);
|
|
7787
|
-
if (distSq < bestDistSq) {
|
|
7788
|
-
bestDistSq = distSq;
|
|
7789
|
-
nearestInput = inp;
|
|
7790
|
-
}
|
|
7791
|
-
}
|
|
7805
|
+
const nearestInput = findNearestInputByCentroid(out, inputSigs);
|
|
7792
7806
|
if (nearestInput) {
|
|
7793
7807
|
const existing = generated.get(nearestInput.hash) ?? [];
|
|
7794
7808
|
existing.push(out.hash);
|
|
@@ -7897,6 +7911,55 @@ function chainEvolutionMap(map, stepModified, stepDeleted, intermediateOutputs,
|
|
|
7897
7911
|
}
|
|
7898
7912
|
}
|
|
7899
7913
|
/**
|
|
7914
|
+
* Fold one child solid of a compound tool into the running boolean accumulator.
|
|
7915
|
+
* Chains existing modified/generated outputs through this step's evolution,
|
|
7916
|
+
* then merges in any step entries not already covered by the chain.
|
|
7917
|
+
*/
|
|
7918
|
+
function mergeCompoundChildStep(result, accum) {
|
|
7919
|
+
const intermediateOutputs = /* @__PURE__ */ new Set();
|
|
7920
|
+
chainEvolutionMap(accum.combinedModified, result.evolution.modified, result.evolution.deleted, intermediateOutputs, accum.combinedDeleted);
|
|
7921
|
+
chainEvolutionMap(accum.combinedGenerated, result.evolution.modified, result.evolution.deleted, intermediateOutputs);
|
|
7922
|
+
for (const [k, v] of result.evolution.modified) {
|
|
7923
|
+
if (accum.combinedModified.has(k) || intermediateOutputs.has(k)) continue;
|
|
7924
|
+
accum.combinedModified.set(k, [...v]);
|
|
7925
|
+
}
|
|
7926
|
+
for (const [k, v] of result.evolution.generated) {
|
|
7927
|
+
if (intermediateOutputs.has(k)) continue;
|
|
7928
|
+
const existing = accum.combinedGenerated.get(k) ?? [];
|
|
7929
|
+
accum.combinedGenerated.set(k, [...existing, ...v]);
|
|
7930
|
+
}
|
|
7931
|
+
for (const d of result.evolution.deleted) {
|
|
7932
|
+
if (!accum.inputFaceHashSet.has(d)) continue;
|
|
7933
|
+
accum.combinedDeleted.add(d);
|
|
7934
|
+
}
|
|
7935
|
+
}
|
|
7936
|
+
/**
|
|
7937
|
+
* Iteratively apply native evolution for each solid in a compound tool, chaining
|
|
7938
|
+
* evolution maps so the original input face hashes resolve to final output hashes
|
|
7939
|
+
* rather than intermediates.
|
|
7940
|
+
*/
|
|
7941
|
+
function applyCompoundBooleanWithHistory(bk, shape, compoundToolId, inputFaceHashes, hashUpperBound, nativeFn) {
|
|
7942
|
+
const childSolidIds = toArray(bk.getCompoundSolids(compoundToolId));
|
|
7943
|
+
let currentShape = shape;
|
|
7944
|
+
const accum = {
|
|
7945
|
+
combinedModified: /* @__PURE__ */ new Map(),
|
|
7946
|
+
combinedGenerated: /* @__PURE__ */ new Map(),
|
|
7947
|
+
combinedDeleted: /* @__PURE__ */ new Set(),
|
|
7948
|
+
inputFaceHashSet: new Set(inputFaceHashes)
|
|
7949
|
+
};
|
|
7950
|
+
for (const childId of childSolidIds) {
|
|
7951
|
+
const ch = currentShape;
|
|
7952
|
+
if (ch.type !== "solid") break;
|
|
7953
|
+
const result = parseNativeEvolution(nativeFn(ch.id, childId), hashUpperBound);
|
|
7954
|
+
currentShape = result.shape;
|
|
7955
|
+
mergeCompoundChildStep(result, accum);
|
|
7956
|
+
}
|
|
7957
|
+
return {
|
|
7958
|
+
shape: currentShape,
|
|
7959
|
+
accum
|
|
7960
|
+
};
|
|
7961
|
+
}
|
|
7962
|
+
/**
|
|
7900
7963
|
* Shared implementation for boolean-with-history operations (fuse, cut, intersect).
|
|
7901
7964
|
*/
|
|
7902
7965
|
function booleanWithHistoryImpl(bk, shape, tool, inputFaceHashes, hashUpperBound, options, nativeFn, fallbackFn, _label) {
|
|
@@ -7917,33 +7980,13 @@ function booleanWithHistoryImpl(bk, shape, tool, inputFaceHashes, hashUpperBound
|
|
|
7917
7980
|
if (!isEmptyBooleanError(e)) throw e;
|
|
7918
7981
|
}
|
|
7919
7982
|
if (th.type === "compound") {
|
|
7920
|
-
const
|
|
7921
|
-
let currentShape = shape;
|
|
7922
|
-
const combinedModified = /* @__PURE__ */ new Map();
|
|
7923
|
-
const combinedGenerated = /* @__PURE__ */ new Map();
|
|
7924
|
-
const combinedDeleted = /* @__PURE__ */ new Set();
|
|
7925
|
-
const inputFaceHashSet = new Set(inputFaceHashes);
|
|
7926
|
-
for (const childId of childSolidIds) {
|
|
7927
|
-
const ch = currentShape;
|
|
7928
|
-
if (ch.type !== "solid") break;
|
|
7929
|
-
const result = parseNativeEvolution(nativeFn(ch.id, childId), hashUpperBound);
|
|
7930
|
-
currentShape = result.shape;
|
|
7931
|
-
const intermediateOutputs = /* @__PURE__ */ new Set();
|
|
7932
|
-
chainEvolutionMap(combinedModified, result.evolution.modified, result.evolution.deleted, intermediateOutputs, combinedDeleted);
|
|
7933
|
-
chainEvolutionMap(combinedGenerated, result.evolution.modified, result.evolution.deleted, intermediateOutputs);
|
|
7934
|
-
for (const [k, v] of result.evolution.modified) if (!combinedModified.has(k) && !intermediateOutputs.has(k)) combinedModified.set(k, [...v]);
|
|
7935
|
-
for (const [k, v] of result.evolution.generated) if (!intermediateOutputs.has(k)) {
|
|
7936
|
-
const existing = combinedGenerated.get(k) ?? [];
|
|
7937
|
-
combinedGenerated.set(k, [...existing, ...v]);
|
|
7938
|
-
}
|
|
7939
|
-
for (const d of result.evolution.deleted) if (inputFaceHashSet.has(d)) combinedDeleted.add(d);
|
|
7940
|
-
}
|
|
7983
|
+
const { shape: resultShape, accum } = applyCompoundBooleanWithHistory(bk, shape, th.id, inputFaceHashes, hashUpperBound, nativeFn);
|
|
7941
7984
|
return {
|
|
7942
|
-
shape:
|
|
7985
|
+
shape: resultShape,
|
|
7943
7986
|
evolution: {
|
|
7944
|
-
modified: combinedModified,
|
|
7945
|
-
generated: combinedGenerated,
|
|
7946
|
-
deleted: combinedDeleted
|
|
7987
|
+
modified: accum.combinedModified,
|
|
7988
|
+
generated: accum.combinedGenerated,
|
|
7989
|
+
deleted: accum.combinedDeleted
|
|
7947
7990
|
},
|
|
7948
7991
|
diagnostics: noDiagnostics
|
|
7949
7992
|
};
|
|
@@ -8967,7 +9010,7 @@ function fillSurface(bk, wires, _options) {
|
|
|
8967
9010
|
pts.push(wasmIndex(p, 0), wasmIndex(p, 1), wasmIndex(p, 2));
|
|
8968
9011
|
}
|
|
8969
9012
|
allCoords.push(...pts);
|
|
8970
|
-
curveLengths.push(
|
|
9013
|
+
curveLengths.push(11);
|
|
8971
9014
|
}
|
|
8972
9015
|
try {
|
|
8973
9016
|
return faceHandle(bk.fillCoonsPatch(allCoords, curveLengths));
|
|
@@ -9623,61 +9666,66 @@ function mapStringTransitionMode(mode) {
|
|
|
9623
9666
|
default: return;
|
|
9624
9667
|
}
|
|
9625
9668
|
}
|
|
9626
|
-
function
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
firstShape: profile,
|
|
9638
|
-
lastShape: profile
|
|
9639
|
-
};
|
|
9640
|
-
return shape;
|
|
9669
|
+
function wrapPipeShellResult(shape, profile, shellMode) {
|
|
9670
|
+
if (shellMode) return {
|
|
9671
|
+
shape,
|
|
9672
|
+
firstShape: profile,
|
|
9673
|
+
lastShape: profile
|
|
9674
|
+
};
|
|
9675
|
+
return shape;
|
|
9676
|
+
}
|
|
9677
|
+
function tryContactModeSweep(bk, faceId, edgeId, contactMode) {
|
|
9678
|
+
try {
|
|
9679
|
+
return solidHandle(bk.sweepWithOptions(faceId, edgeId, contactMode, [], 0, "transformed"));
|
|
9641
9680
|
} catch (e) {
|
|
9642
9681
|
console.warn("brepkit: sweepWithOptions failed, falling back to sweepSmooth/simplePipe:", e);
|
|
9682
|
+
return;
|
|
9643
9683
|
}
|
|
9644
|
-
|
|
9684
|
+
}
|
|
9685
|
+
function resolveContactModeEdge(bk, spine) {
|
|
9686
|
+
try {
|
|
9687
|
+
if (spine.type !== "wire") return { edgeId: unwrap(spine, "edge") };
|
|
9645
9688
|
const edges = iterShapes(bk, spine, "edge");
|
|
9646
9689
|
if (edges.length === 1) {
|
|
9647
9690
|
const first = edges[0];
|
|
9648
|
-
if (first)
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
return shape;
|
|
9657
|
-
} catch (e) {
|
|
9658
|
-
console.warn("brepkit: sweepWithOptions failed, falling back to sweepSmooth/simplePipe:", e);
|
|
9659
|
-
}
|
|
9660
|
-
} else warnOnce("sweepPipeShell-transition-multi-edge", "sweepPipeShell transition mode not supported for multi-edge wires; ignored.");
|
|
9691
|
+
if (first) return { edgeId: unwrap(first, "edge") };
|
|
9692
|
+
return;
|
|
9693
|
+
}
|
|
9694
|
+
warnOnce("sweepPipeShell-transition-multi-edge", "sweepPipeShell transition mode not supported for multi-edge wires; ignored.");
|
|
9695
|
+
return;
|
|
9696
|
+
} catch (e) {
|
|
9697
|
+
console.warn("brepkit: resolveContactModeEdge failed for unexpected spine type, falling through:", e);
|
|
9698
|
+
return;
|
|
9661
9699
|
}
|
|
9700
|
+
}
|
|
9701
|
+
function tryContactModePipeShell(bk, faceId, spine, contactMode) {
|
|
9702
|
+
const resolved = resolveContactModeEdge(bk, spine);
|
|
9703
|
+
if (!resolved) return void 0;
|
|
9704
|
+
return tryContactModeSweep(bk, faceId, resolved.edgeId, contactMode);
|
|
9705
|
+
}
|
|
9706
|
+
function trySmoothPipeShell(bk, faceId, spine) {
|
|
9662
9707
|
const nurbsData = extractNurbsFromEdge(bk, spine);
|
|
9663
|
-
if (nurbsData
|
|
9664
|
-
|
|
9665
|
-
|
|
9666
|
-
shape,
|
|
9667
|
-
firstShape: profile,
|
|
9668
|
-
lastShape: profile
|
|
9669
|
-
};
|
|
9670
|
-
return shape;
|
|
9708
|
+
if (!nurbsData || nurbsData.degree <= 1) return void 0;
|
|
9709
|
+
try {
|
|
9710
|
+
return solidHandle(bk.sweepSmooth(faceId, nurbsData.degree, nurbsData.knots, nurbsData.controlPoints, nurbsData.weights));
|
|
9671
9711
|
} catch (e) {
|
|
9672
9712
|
console.warn("brepkit: sweepSmooth failed, falling back to simplePipe:", e);
|
|
9713
|
+
return;
|
|
9673
9714
|
}
|
|
9674
|
-
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
|
|
9715
|
+
}
|
|
9716
|
+
function sweepPipeShell(bk, profile, spine, options) {
|
|
9717
|
+
const profileHandle = profile;
|
|
9718
|
+
const faceId = profileHandle.type === "wire" ? bk.makeFaceFromWire(profileHandle.id) : unwrap(profile, "face");
|
|
9719
|
+
const shellMode = !!(options && options["shellMode"]);
|
|
9720
|
+
const transitionMode = options?.["transitionMode"];
|
|
9721
|
+
const contactMode = transitionMode ? mapStringTransitionMode(transitionMode) : void 0;
|
|
9722
|
+
if (contactMode) {
|
|
9723
|
+
const shape = tryContactModePipeShell(bk, faceId, spine, contactMode);
|
|
9724
|
+
if (shape) return wrapPipeShellResult(shape, profile, shellMode);
|
|
9725
|
+
}
|
|
9726
|
+
const smoothShape = trySmoothPipeShell(bk, faceId, spine);
|
|
9727
|
+
if (smoothShape) return wrapPipeShellResult(smoothShape, profile, shellMode);
|
|
9728
|
+
return wrapPipeShellResult(simplePipe(bk, profile, spine), profile, shellMode);
|
|
9681
9729
|
}
|
|
9682
9730
|
function loftAdvanced(bk, wires, options) {
|
|
9683
9731
|
const faceIds = wires.map((w) => {
|
|
@@ -9948,7 +9996,7 @@ async function init() {
|
|
|
9948
9996
|
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)");
|
|
9949
9997
|
}
|
|
9950
9998
|
//#endregion
|
|
9951
|
-
//#region \0@oxc-project+runtime@0.
|
|
9999
|
+
//#region \0@oxc-project+runtime@0.132.0/helpers/usingCtx.js
|
|
9952
10000
|
function _usingCtx() {
|
|
9953
10001
|
var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
|
|
9954
10002
|
var n = Error();
|