brepjs 18.118.23 → 18.118.24

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.
@@ -315,7 +315,41 @@ function sharedEdgesJS(face1, face2) {
315
315
  for (const e2 of edges2) kernel.dispose(e2);
316
316
  return shared;
317
317
  }
318
+ var nativeAdjacentFacesSupported = /* @__PURE__ */ new Map();
319
+ /**
320
+ * Hashes of the faces adjacent to `face` within `parent`, keyed like the kernel's
321
+ * `hashCode(_, HASH_CODE_MAX)` (so they index the parent's cached faces).
322
+ *
323
+ * Prefers the kernel-native adjacency (occt-wasm/brepkit) — markedly faster than
324
+ * the borrowed JS edge-map path, which pays per-call edge extraction + hashing —
325
+ * and disposes the owned result handles here so none escape. Returns only hashes,
326
+ * keeping callers clear of the borrowed-vs-owned handle contract; falls back to
327
+ * the borrowed-view {@link adjacentFaces} where the native op is unsupported.
328
+ */
329
+ function adjacentFaceHashes(parent, face) {
330
+ const kernel = require_shapeTypes.getKernel();
331
+ const kernelId = require_shapeTypes.getActiveKernelId() ?? "";
332
+ if (nativeAdjacentFacesSupported.get(kernelId) !== false) try {
333
+ const raw = kernel.adjacentFaces(parent.wrapped, face.wrapped);
334
+ nativeAdjacentFacesSupported.set(kernelId, true);
335
+ try {
336
+ return raw.map((r) => kernel.hashCode(r, require_constants.HASH_CODE_MAX));
337
+ } finally {
338
+ for (const r of raw) kernel.dispose(r);
339
+ }
340
+ } catch (e) {
341
+ if (!require_occtWasmAdapter.isUnsupportedKernelOperationError(e)) throw e;
342
+ nativeAdjacentFacesSupported.set(kernelId, false);
343
+ }
344
+ return adjacentFaces(parent, face).map((f) => kernel.hashCode(f.wrapped, require_constants.HASH_CODE_MAX));
345
+ }
318
346
  //#endregion
347
+ Object.defineProperty(exports, "adjacentFaceHashes", {
348
+ enumerable: true,
349
+ get: function() {
350
+ return adjacentFaceHashes;
351
+ }
352
+ });
319
353
  Object.defineProperty(exports, "adjacentFaces", {
320
354
  enumerable: true,
321
355
  get: function() {
@@ -315,5 +315,33 @@ function sharedEdgesJS(face1, face2) {
315
315
  for (const e2 of edges2) kernel.dispose(e2);
316
316
  return shared;
317
317
  }
318
+ var nativeAdjacentFacesSupported = /* @__PURE__ */ new Map();
319
+ /**
320
+ * Hashes of the faces adjacent to `face` within `parent`, keyed like the kernel's
321
+ * `hashCode(_, HASH_CODE_MAX)` (so they index the parent's cached faces).
322
+ *
323
+ * Prefers the kernel-native adjacency (occt-wasm/brepkit) — markedly faster than
324
+ * the borrowed JS edge-map path, which pays per-call edge extraction + hashing —
325
+ * and disposes the owned result handles here so none escape. Returns only hashes,
326
+ * keeping callers clear of the borrowed-vs-owned handle contract; falls back to
327
+ * the borrowed-view {@link adjacentFaces} where the native op is unsupported.
328
+ */
329
+ function adjacentFaceHashes(parent, face) {
330
+ const kernel = getKernel();
331
+ const kernelId = getActiveKernelId() ?? "";
332
+ if (nativeAdjacentFacesSupported.get(kernelId) !== false) try {
333
+ const raw = kernel.adjacentFaces(parent.wrapped, face.wrapped);
334
+ nativeAdjacentFacesSupported.set(kernelId, true);
335
+ try {
336
+ return raw.map((r) => kernel.hashCode(r, HASH_CODE_MAX));
337
+ } finally {
338
+ for (const r of raw) kernel.dispose(r);
339
+ }
340
+ } catch (e) {
341
+ if (!isUnsupportedKernelOperationError(e)) throw e;
342
+ nativeAdjacentFacesSupported.set(kernelId, false);
343
+ }
344
+ return adjacentFaces(parent, face).map((f) => kernel.hashCode(f.wrapped, HASH_CODE_MAX));
345
+ }
318
346
  //#endregion
319
- export { sharedEdges as a, wiresOfFace as c, facesOfVertex as i, edgesOfFace as n, verticesOfEdge as o, facesOfEdge as r, verticesOfFace as s, adjacentFaces as t };
347
+ export { facesOfVertex as a, verticesOfFace as c, facesOfEdge as i, wiresOfFace as l, adjacentFaces as n, sharedEdges as o, edgesOfFace as r, verticesOfEdge as s, adjacentFaceHashes as t };
package/dist/brepjs.cjs CHANGED
@@ -17,7 +17,7 @@ const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
17
17
  const require_surfaceBuilders = require("./surfaceBuilders-QPtrtoXG.cjs");
18
18
  const require_solidBuilders = require("./solidBuilders-BLsga6fa.cjs");
19
19
  const require_healingFns = require("./healingFns-B6qvJ_ua.cjs");
20
- const require_threadFns = require("./threadFns-D_wKVcfO.cjs");
20
+ const require_threadFns = require("./threadFns-E5vCbxQn.cjs");
21
21
  const require_blueprintSketcher = require("./blueprintSketcher-BMy51I6w.cjs");
22
22
  const require_helpers = require("./helpers-BslGOVYN.cjs");
23
23
  const require_drawFns = require("./drawFns-Cspcghnk.cjs");
@@ -29,8 +29,8 @@ const require_importFns = require("./importFns-1OeDbirB.cjs");
29
29
  const require_loftFns = require("./loftFns-DjHxcgNY.cjs");
30
30
  const require_cameraFns = require("./cameraFns-DC1Bqs3i.cjs");
31
31
  const require_textMetrics = require("./textMetrics-CE0SzDYa.cjs");
32
- const require_adjacencyFns = require("./adjacencyFns-BHTNz8_O.cjs");
33
- const require_refResolveFns = require("./refResolveFns-BIhtsmdZ.cjs");
32
+ const require_adjacencyFns = require("./adjacencyFns-D3E5mqNS.cjs");
33
+ const require_refResolveFns = require("./refResolveFns-3sZ6IeCH.cjs");
34
34
  const require_workerPool = require("./workerPool-D30NsiIW.cjs");
35
35
  const require_primitiveFns = require("./primitiveFns-pxjaTk8i.cjs");
36
36
  //#region src/topology/shapeBooleans.ts
package/dist/brepjs.js CHANGED
@@ -15,7 +15,7 @@ import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayA
15
15
  import { _ as makeThreePointArc, d as makeCircle, h as makeLine, l as makeBSplineInterpolation, n as fill, r as makeFace, s as assembleWire } from "./surfaceBuilders-DI0oXs1Z.js";
16
16
  import { _ as section$1, b as split$1, d as booleanPipeline, f as cut$2, g as intersect$2, h as fuseAll$2, m as fuse$2, p as cutAll$2, r as makeCylinder, t as makeCompound, v as sectionToFace$1, y as slice$1 } from "./solidBuilders-CVs9uVKO.js";
17
17
  import { A as toBufferGeometryData, C as shellWithEvolution, D as getNurbsCurveData, E as fuseAllBisect, M as toLODGeometryData, N as toLODGeometryLevels, O as getNurbsSurfaceData, P as toLineGeometryData, S as intersectWithEvolution, T as cutAllBisect, _ as positionOnCurve, a as healFace, b as filletWithEvolution, c as isValid$1, d as draft$1, f as fillet$1, g as variableFillet, h as thicken$1, i as heal$1, j as toGroupedBufferGeometryData, k as chamferDistAngle, l as solidFromShell, m as shell$1, n as fixSelfIntersection, o as healSolid, p as offset$1, r as fixShape, s as healWire, t as autoHeal, u as chamfer$1, v as chamferWithEvolution, w as checkBoolean, x as fuseWithEvolution, y as cutWithEvolution } from "./healingFns-CzAgSI4a.js";
18
- import { A as setJointValue, B as createAssemblyNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as quatMultiply, G as circularPattern, H as removeChild, I as quatRotate, J as exportAssemblySTEP, K as gridPattern, L as addChild, M as sphericalJoint, N as quatFromAxisAngle, O as prismaticJoint, P as quatFromTo, R as collectShapes, S as addJoint, T as jointTransform, U as updateNode, V as findNode, W as walkAssembly, Y as createAssembly, _ as exportURDF, a as deserializeHistory, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, q as linearPattern, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as countNodes } from "./threadFns-D5BCp0GF.js";
18
+ import { A as setJointValue, B as createAssemblyNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as quatMultiply, G as circularPattern, H as removeChild, I as quatRotate, J as exportAssemblySTEP, K as gridPattern, L as addChild, M as sphericalJoint, N as quatFromAxisAngle, O as prismaticJoint, P as quatFromTo, R as collectShapes, S as addJoint, T as jointTransform, U as updateNode, V as findNode, W as walkAssembly, Y as createAssembly, _ as exportURDF, a as deserializeHistory, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, q as linearPattern, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as countNodes } from "./threadFns-AgLw8IrM.js";
19
19
  import { n as BaseSketcher2d, r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-DsJQXRpk.js";
20
20
  import { a as createTypedFinder, i as wireFinder, n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-D4DOutu7.js";
21
21
  import { A as sketchEllipse, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-D26G4W6g.js";
@@ -28,8 +28,8 @@ import { a as revolve$1, c as multiSectionSweep, d as twistExtrude, i as extrude
28
28
  import { a as Sketch, c as compoundSketchLoft, d as sketchFace, f as sketchLoft, h as sketchWires, i as Sketches, l as compoundSketchRevolve, m as sketchSweep, n as getFont, o as compoundSketchExtrude, p as sketchRevolve, r as loadFont, s as compoundSketchFace, t as textBlueprints, u as sketchExtrude, v as CompoundSketch } from "./textBlueprints-GmfesKnp.js";
29
29
  import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-ZCIt2Vwu.js";
30
30
  import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-Cj4BPjs4.js";
31
- import { a as sharedEdges, c as wiresOfFace, i as facesOfVertex, n as edgesOfFace, o as verticesOfEdge, r as facesOfEdge, s as verticesOfFace, t as adjacentFaces } from "./adjacencyFns-W7QMVMW2.js";
32
- import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-3u3H3kGf.js";
31
+ import { a as facesOfVertex, c as verticesOfFace, i as facesOfEdge, l as wiresOfFace, n as adjacentFaces, o as sharedEdges, r as edgesOfFace, s as verticesOfEdge } from "./adjacencyFns-sWRL_pkB.js";
32
+ import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-CJHl5wMS.js";
33
33
  import { _ as isSuccessResponse, a as createWorkerClient, c as enqueueTask, d as rejectAll, f as isBatchRequest, g as isOperationRequest, h as isInitRequest, i as registerHandler, l as isEmpty$1, m as isErrorResponse, n as createOperationRegistry, o as createTaskQueue, p as isDisposeRequest, r as createWorkerHandler, s as dequeueTask, t as createWorkerPool, u as pendingCount } from "./workerPool-XcYX2UZ0.js";
34
34
  import { C as threePointArc, D as wireLoop, E as wire, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere$1, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, l as ellipse, m as helix, n as bezier, o as compound, p as filledFace, r as box, s as cone, t as addHoles, u as ellipseArc, v as sewShells, w as torus$1, x as subFace, y as solid } from "./primitiveFns-D8Vwk98k.js";
35
35
  //#region \0rolldown/runtime.js
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_threadFns = require("./threadFns-D_wKVcfO.cjs");
2
+ const require_threadFns = require("./threadFns-E5vCbxQn.cjs");
3
3
  const require_loftFns = require("./loftFns-DjHxcgNY.cjs");
4
4
  exports.addChild = require_threadFns.addChild;
5
5
  exports.addJoint = require_threadFns.addJoint;
@@ -1,3 +1,3 @@
1
- import { A as setJointValue, B as createAssemblyNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, G as circularPattern, H as removeChild, J as exportAssemblySTEP, K as gridPattern, L as addChild, M as sphericalJoint, O as prismaticJoint, R as collectShapes, S as addJoint, T as jointTransform, U as updateNode, V as findNode, W as walkAssembly, Y as createAssembly, _ as exportURDF, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, q as linearPattern, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as countNodes } from "./threadFns-D5BCp0GF.js";
1
+ import { A as setJointValue, B as createAssemblyNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, G as circularPattern, H as removeChild, J as exportAssemblySTEP, K as gridPattern, L as addChild, M as sphericalJoint, O as prismaticJoint, R as collectShapes, S as addJoint, T as jointTransform, U as updateNode, V as findNode, W as walkAssembly, Y as createAssembly, _ as exportURDF, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, q as linearPattern, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as countNodes } from "./threadFns-AgLw8IrM.js";
2
2
  import { d as twistExtrude, l as supportExtrude, o as complexExtrude, u as sweep } from "./loftFns-RdVrGF1B.js";
3
3
  export { addChild, addJoint, addStep, circularPattern, collectShapes, complexExtrude, countNodes, createAssembly, createAssemblyNode, createHistory, createRegistry, cylindricalJoint, exportAssemblySTEP, exportURDF, findNode, findStep, forwardKinematics, getShape as getHistoryShape, gridPattern, importURDF, inverseKinematics, jointTrajectory, jointTransform, jointsFromDH, linearPattern, mechanismDOF, modifyStep, planarJoint, prismaticJoint, registerOperation, registerShape, removeChild, replayFrom, replayHistory, revoluteJoint, setJointValue, setJointValues, sphericalJoint, stepCount, stepsFrom, supportExtrude, sweep, thread, twistExtrude, undoLast, updateNode, walkAssembly };
@@ -3,7 +3,7 @@ const require_topologyQueryFns = require("./topologyQueryFns-D5hBmDkc.cjs");
3
3
  const require_faceFns = require("./faceFns-B4X-xM8V.cjs");
4
4
  const require_shapeFns = require("./shapeFns-ql8ziUaG.cjs");
5
5
  const require_measureFns = require("./measureFns-Vb49femb.cjs");
6
- const require_adjacencyFns = require("./adjacencyFns-BHTNz8_O.cjs");
6
+ const require_adjacencyFns = require("./adjacencyFns-D3E5mqNS.cjs");
7
7
  //#region src/topology/shapeRef/scoring.ts
8
8
  /**
9
9
  * Default face scorer combining surface type, normal alignment, centroid proximity,
@@ -561,23 +561,26 @@ function facesByNormal(shape, normal) {
561
561
  return require_topologyQueryFns.getFaces(shape).filter((f) => normalDot(require_faceFns.normalAt(f), normal) > NORMAL_MATCH);
562
562
  }
563
563
  /**
564
- * Faces adjacent to BOTH face sets, excluding the sets themselves. Uses the
565
- * cached edge→faces adjacency (`adjacentFaces`) rather than an O(F·N) per-pair
566
- * `sharedEdges` scan.
564
+ * Faces adjacent to BOTH face sets, excluding the sets themselves. Works purely
565
+ * in face-hash space via `adjacentFaceHashes` (kernel-native adjacency where
566
+ * available, no per-call edge extraction), then maps the surviving hashes back to
567
+ * the parent's borrowed cache faces — so the returned handles keep the same
568
+ * borrowed lifetime (freed with `shape`) the resolution path already assumes.
567
569
  */
568
570
  function betweenFaces(shape, aFaces, bFaces) {
569
571
  const exclude = new Set([...aFaces, ...bFaces].map(require_shapeFns.getHashCode));
570
572
  const adjacentToA = /* @__PURE__ */ new Set();
571
- for (const a of aFaces) for (const f of require_adjacencyFns.adjacentFaces(shape, a)) adjacentToA.add(require_shapeFns.getHashCode(f));
572
- const result = [];
573
+ for (const a of aFaces) for (const h of require_adjacencyFns.adjacentFaceHashes(shape, a)) adjacentToA.add(h);
574
+ const betweenHashes = [];
573
575
  const seen = /* @__PURE__ */ new Set();
574
- for (const b of bFaces) for (const f of require_adjacencyFns.adjacentFaces(shape, b)) {
575
- const h = require_shapeFns.getHashCode(f);
576
+ for (const b of bFaces) for (const h of require_adjacencyFns.adjacentFaceHashes(shape, b)) {
576
577
  if (exclude.has(h) || seen.has(h) || !adjacentToA.has(h)) continue;
577
578
  seen.add(h);
578
- result.push(f);
579
+ betweenHashes.push(h);
579
580
  }
580
- return result;
581
+ if (betweenHashes.length === 0) return [];
582
+ const byHash = new Map(require_topologyQueryFns.getFaces(shape).map((f) => [require_shapeFns.getHashCode(f), f]));
583
+ return betweenHashes.map((h) => byHash.get(h)).filter((f) => f !== void 0);
581
584
  }
582
585
  /** Face whose center is nearest `point`; undefined on a tie (→ ambiguous). */
583
586
  function nearestFace(faces, point) {
@@ -3,7 +3,7 @@ import { C as vertexPosition, c as getFaces } from "./topologyQueryFns-BT4CdXa2.
3
3
  import { i as faceGeomType, l as normalAt, r as faceCenter } from "./faceFns-Bk5OdHMb.js";
4
4
  import { n as getHashCode } from "./shapeFns-CsNSoHH6.js";
5
5
  import { n as measureArea, s as measureLength } from "./measureFns-Dy4ebDq2.js";
6
- import { a as sharedEdges, i as facesOfVertex, o as verticesOfEdge, r as facesOfEdge, s as verticesOfFace, t as adjacentFaces } from "./adjacencyFns-W7QMVMW2.js";
6
+ import { a as facesOfVertex, c as verticesOfFace, i as facesOfEdge, o as sharedEdges, s as verticesOfEdge, t as adjacentFaceHashes } from "./adjacencyFns-sWRL_pkB.js";
7
7
  //#region src/topology/shapeRef/scoring.ts
8
8
  /**
9
9
  * Default face scorer combining surface type, normal alignment, centroid proximity,
@@ -561,23 +561,26 @@ function facesByNormal(shape, normal) {
561
561
  return getFaces(shape).filter((f) => normalDot(normalAt(f), normal) > NORMAL_MATCH);
562
562
  }
563
563
  /**
564
- * Faces adjacent to BOTH face sets, excluding the sets themselves. Uses the
565
- * cached edge→faces adjacency (`adjacentFaces`) rather than an O(F·N) per-pair
566
- * `sharedEdges` scan.
564
+ * Faces adjacent to BOTH face sets, excluding the sets themselves. Works purely
565
+ * in face-hash space via `adjacentFaceHashes` (kernel-native adjacency where
566
+ * available, no per-call edge extraction), then maps the surviving hashes back to
567
+ * the parent's borrowed cache faces — so the returned handles keep the same
568
+ * borrowed lifetime (freed with `shape`) the resolution path already assumes.
567
569
  */
568
570
  function betweenFaces(shape, aFaces, bFaces) {
569
571
  const exclude = new Set([...aFaces, ...bFaces].map(getHashCode));
570
572
  const adjacentToA = /* @__PURE__ */ new Set();
571
- for (const a of aFaces) for (const f of adjacentFaces(shape, a)) adjacentToA.add(getHashCode(f));
572
- const result = [];
573
+ for (const a of aFaces) for (const h of adjacentFaceHashes(shape, a)) adjacentToA.add(h);
574
+ const betweenHashes = [];
573
575
  const seen = /* @__PURE__ */ new Set();
574
- for (const b of bFaces) for (const f of adjacentFaces(shape, b)) {
575
- const h = getHashCode(f);
576
+ for (const b of bFaces) for (const h of adjacentFaceHashes(shape, b)) {
576
577
  if (exclude.has(h) || seen.has(h) || !adjacentToA.has(h)) continue;
577
578
  seen.add(h);
578
- result.push(f);
579
+ betweenHashes.push(h);
579
580
  }
580
- return result;
581
+ if (betweenHashes.length === 0) return [];
582
+ const byHash = new Map(getFaces(shape).map((f) => [getHashCode(f), f]));
583
+ return betweenHashes.map((h) => byHash.get(h)).filter((f) => f !== void 0);
581
584
  }
582
585
  /** Face whose center is nearest `point`; undefined on a tie (→ ambiguous). */
583
586
  function nearestFace(faces, point) {
package/dist/shapeRef.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_refResolveFns = require("./refResolveFns-BIhtsmdZ.cjs");
2
+ const require_refResolveFns = require("./refResolveFns-3sZ6IeCH.cjs");
3
3
  exports.assignRoles = require_refResolveFns.assignRoles;
4
4
  exports.captureHint = require_refResolveFns.captureHint;
5
5
  exports.createDerivedFaceRef = require_refResolveFns.createDerivedFaceRef;
package/dist/shapeRef.js CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-3u3H3kGf.js";
1
+ import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-CJHl5wMS.js";
2
2
  export { assignRoles, captureHint, createDerivedFaceRef, createEdgeRef, createRef, createVertexRef, defaultScorer, isDerivedFaceRef, isEdgeRef, isFaceRef, isLineageRef, isVertexRef, resolveDerivedFaceRef, resolveEdgeRef, resolveLineageRef, resolveRef, resolveRefIn, resolveRefParams, resolveVertexRef, updateRoles };
@@ -5,7 +5,7 @@ import { b as fromBREP } from "./faceFns-Bk5OdHMb.js";
5
5
  import { s as toBREP } from "./shapeFns-CsNSoHH6.js";
6
6
  import { h as fuseAll } from "./solidBuilders-CVs9uVKO.js";
7
7
  import { t as loft } from "./loftFns-RdVrGF1B.js";
8
- import { c as resolveRefParams } from "./refResolveFns-3u3H3kGf.js";
8
+ import { c as resolveRefParams } from "./refResolveFns-CJHl5wMS.js";
9
9
  import { E as wire, h as line } from "./primitiveFns-D8Vwk98k.js";
10
10
  //#region src/utils/uuid.ts
11
11
  /** Generate a v4-style UUID string using `crypto.getRandomValues`. */
@@ -5,7 +5,7 @@ const require_faceFns = require("./faceFns-B4X-xM8V.cjs");
5
5
  const require_shapeFns = require("./shapeFns-ql8ziUaG.cjs");
6
6
  const require_solidBuilders = require("./solidBuilders-BLsga6fa.cjs");
7
7
  const require_loftFns = require("./loftFns-DjHxcgNY.cjs");
8
- const require_refResolveFns = require("./refResolveFns-BIhtsmdZ.cjs");
8
+ const require_refResolveFns = require("./refResolveFns-3sZ6IeCH.cjs");
9
9
  const require_primitiveFns = require("./primitiveFns-pxjaTk8i.cjs");
10
10
  //#region src/utils/uuid.ts
11
11
  /** Generate a v4-style UUID string using `crypto.getRandomValues`. */
@@ -69,3 +69,14 @@ export declare function adjacentFaces<D extends Dimension>(parent: AnyShape<D>,
69
69
  * @returns Array of edges present in both faces (via isSame comparison).
70
70
  */
71
71
  export declare function sharedEdges<D extends Dimension>(face1: Face<D>, face2: Face<D>): Edge<D>[];
72
+ /**
73
+ * Hashes of the faces adjacent to `face` within `parent`, keyed like the kernel's
74
+ * `hashCode(_, HASH_CODE_MAX)` (so they index the parent's cached faces).
75
+ *
76
+ * Prefers the kernel-native adjacency (occt-wasm/brepkit) — markedly faster than
77
+ * the borrowed JS edge-map path, which pays per-call edge extraction + hashing —
78
+ * and disposes the owned result handles here so none escape. Returns only hashes,
79
+ * keeping callers clear of the borrowed-vs-owned handle contract; falls back to
80
+ * the borrowed-view {@link adjacentFaces} where the native op is unsupported.
81
+ */
82
+ export declare function adjacentFaceHashes<D extends Dimension>(parent: AnyShape<D>, face: Face<D>): number[];
package/dist/topology.cjs CHANGED
@@ -6,7 +6,7 @@ const require_curveFns = require("./curveFns-CLG5eRx5.cjs");
6
6
  const require_meshFns = require("./meshFns-C1-S8YRk.cjs");
7
7
  const require_solidBuilders = require("./solidBuilders-BLsga6fa.cjs");
8
8
  const require_healingFns = require("./healingFns-B6qvJ_ua.cjs");
9
- const require_adjacencyFns = require("./adjacencyFns-BHTNz8_O.cjs");
9
+ const require_adjacencyFns = require("./adjacencyFns-D3E5mqNS.cjs");
10
10
  const require_primitiveFns = require("./primitiveFns-pxjaTk8i.cjs");
11
11
  exports.addHoles = require_primitiveFns.addHoles;
12
12
  exports.adjacentFaces = require_adjacencyFns.adjacentFaces;
package/dist/topology.js CHANGED
@@ -5,6 +5,6 @@ import { a as curveIsPeriodic, c as curvePointAt, d as flipOrientation, f as get
5
5
  import { d as createMeshCache, n as exportSTEP, r as exportSTL, t as exportIGES, u as clearMeshCache } from "./meshFns-Bsz0MOp6.js";
6
6
  import { h as fuseAll, p as cutAll } from "./solidBuilders-CVs9uVKO.js";
7
7
  import { A as toBufferGeometryData, C as shellWithEvolution, D as getNurbsCurveData, E as fuseAllBisect, O as getNurbsSurfaceData, P as toLineGeometryData, S as intersectWithEvolution, T as cutAllBisect, _ as positionOnCurve, a as healFace, b as filletWithEvolution, g as variableFillet, j as toGroupedBufferGeometryData, k as chamferDistAngle, l as solidFromShell, n as fixSelfIntersection, o as healSolid, r as fixShape, s as healWire, t as autoHeal, v as chamferWithEvolution, w as checkBoolean, x as fuseWithEvolution, y as cutWithEvolution } from "./healingFns-CzAgSI4a.js";
8
- import { a as sharedEdges, c as wiresOfFace, n as edgesOfFace, o as verticesOfEdge, r as facesOfEdge, t as adjacentFaces } from "./adjacencyFns-W7QMVMW2.js";
8
+ import { i as facesOfEdge, l as wiresOfFace, n as adjacentFaces, o as sharedEdges, r as edgesOfFace, s as verticesOfEdge } from "./adjacencyFns-sWRL_pkB.js";
9
9
  import { C as threePointArc, D as wireLoop, E as wire, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, l as ellipse, m as helix, n as bezier, o as compound, p as filledFace, r as box, s as cone, t as addHoles, u as ellipseArc, v as sewShells, w as torus, x as subFace, y as solid } from "./primitiveFns-D8Vwk98k.js";
10
10
  export { addHoles, adjacentFaces, approximateCurve, asTopo, autoHeal, bezier, box, bsplineApprox, cast, chamferDistAngle as chamferDistAngleShape, chamferWithEvolution, checkBoolean, circle, classifyPointOnFace, clearMeshCache, compound, cone, createMeshCache, curveAxis, curveEndPoint, curveIsClosed, curveIsPeriodic, curveLength, curvePeriod, curvePointAt, curveStartPoint, curveTangentAt, cutAll, cutAllBisect, cutWithEvolution, cylinder, fromBREP as deserializeShape, downcast, edgesOfFace, ellipse, ellipseArc, ellipsoid, exportIGES, exportSTEP, exportSTL, face, faceAxis, faceCenter, faceGeomType, faceOrientation, facesOfEdge, filledFace, filletWithEvolution, fixSelfIntersection, fixShape, flipFaceOrientation, flipOrientation, fuseAll, fuseAllBisect, fuseWithEvolution, getBounds, getCurveType, getEdges, getFaces, getHashCode, getNurbsCurveData, getNurbsSurfaceData, getOrientation, getSurfaceType, getVertices, getWires, healFace, healSolid, healWire, helix, innerWires, interpolateCurve, intersectWithEvolution, invalidateShapeCache, isCompSolid, isEqualShape, isSameShape, iterEdges, iterFaces, iterTopo, iterVertices, iterWires, line, normalAt, offsetFace, offsetWire2D, outerWire, pointOnSurface, polygon, positionOnCurve, projectPointOnFace, sewShells, shapeType, sharedEdges, shellWithEvolution, solid, solidFromShell, sphere, subFace, tangentArc, threePointArc, toBufferGeometryData, toGroupedBufferGeometryData, toLineGeometryData, torus, uvBounds, uvCoordinates, variableFillet, vertex, vertexPosition, verticesOfEdge, wire, wireLoop, wiresOfFace };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brepjs",
3
- "version": "18.118.23",
3
+ "version": "18.118.24",
4
4
  "description": "Web CAD library with pluggable geometry kernel",
5
5
  "keywords": [
6
6
  "cad",