brepjs 18.64.0 → 18.66.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/2d.cjs +6 -6
  2. package/dist/2d.js +6 -6
  3. package/dist/{blueprint-CnGsBG6y.cjs → blueprint-B7iZ_BZT.cjs} +5 -5
  4. package/dist/{blueprint-B-auug94.js → blueprint-DEtjb9pL.js} +5 -5
  5. package/dist/{blueprintFns-CocKjMHz.cjs → blueprintFns-Bf5TA7pN.cjs} +2 -2
  6. package/dist/{blueprintFns-Bpp0oBUG.js → blueprintFns-Bmd98FWr.js} +2 -2
  7. package/dist/{blueprintSketcher-J9bAQDhD.cjs → blueprintSketcher-Bj39XtSt.cjs} +3 -3
  8. package/dist/{blueprintSketcher-BmCyc7s1.js → blueprintSketcher-nuOhijiI.js} +3 -3
  9. package/dist/{boolean2D-zhHdr4EG.cjs → boolean2D-BfDgoaT7.cjs} +4 -4
  10. package/dist/{boolean2D-C-tW10ip.js → boolean2D-DWbUmSlH.js} +4 -4
  11. package/dist/{booleanFns-4_KnvEil.js → booleanFns-CN5sVkm6.js} +4 -4
  12. package/dist/{booleanFns-9qTQX1iM.cjs → booleanFns-D-wTRioN.cjs} +4 -4
  13. package/dist/brepjs.cjs +33 -25
  14. package/dist/brepjs.js +26 -26
  15. package/dist/{cameraFns-5FSJmH9r.js → cameraFns-BTkg-7od.js} +2 -2
  16. package/dist/{cameraFns-Bz11Ik2z.cjs → cameraFns-BXAgEEUR.cjs} +2 -2
  17. package/dist/core.cjs +1 -1
  18. package/dist/core.js +1 -1
  19. package/dist/{cornerFinder-mD9AqCfR.cjs → cornerFinder-0DmLYmdL.cjs} +1 -1
  20. package/dist/{cornerFinder-C10oNGL4.js → cornerFinder-C_w8TN9u.js} +1 -1
  21. package/dist/{curveFns-BcS0DZLj.js → curveFns-BIj3b16T.js} +1 -1
  22. package/dist/{curveFns-DOW3Rs1A.cjs → curveFns-BlfkX_gl.cjs} +1 -1
  23. package/dist/{drawFns-0ojbwK2X.js → drawFns-CNOti33I.js} +12 -12
  24. package/dist/{drawFns-B4BFzsPq.cjs → drawFns-CluLvJOJ.cjs} +12 -12
  25. package/dist/{extrudeFns-CrTb7bjb.js → extrudeFns-CaBzNeiI.js} +1 -1
  26. package/dist/{extrudeFns-D0IrXWsB.cjs → extrudeFns-DYn4rntp.cjs} +1 -1
  27. package/dist/{faceFns-FVl-7nu7.cjs → faceFns-7g1e493t.cjs} +2 -2
  28. package/dist/{faceFns-DFbEW9oz.js → faceFns-Bd3zdzrq.js} +2 -2
  29. package/dist/{helpers-CIucvYwe.js → helpers-DQ634U2V.js} +6 -6
  30. package/dist/{helpers-BqrszPEI.cjs → helpers-qJvSmWhx.cjs} +6 -6
  31. package/dist/{historyFns-h6FtvY5t.js → historyFns-C6TSTHV4.js} +4 -4
  32. package/dist/{historyFns-B-C4Cp9C.cjs → historyFns-CyXK3XjV.cjs} +4 -4
  33. package/dist/{importFns-Q9jZUGn_.cjs → importFns-DK85PN5U.cjs} +2 -2
  34. package/dist/{importFns-8wNWf6zt.js → importFns-DpXocvJY.js} +2 -2
  35. package/dist/index.d.ts +5 -1
  36. package/dist/io.cjs +2 -2
  37. package/dist/io.js +2 -2
  38. package/dist/kernel/brepkit/brepkitAdapter.d.ts +2 -0
  39. package/dist/kernel/capabilities.d.ts +35 -0
  40. package/dist/kernel/index.d.ts +30 -0
  41. package/dist/kernel/interfaces/core.d.ts +15 -0
  42. package/dist/kernel/manifold/manifoldAdapter.d.ts +9 -0
  43. package/dist/kernel/manifold/profileOps.d.ts +1 -1
  44. package/dist/kernel/occt/defaultAdapter.d.ts +2 -0
  45. package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
  46. package/dist/kernel/occtWasm/occtWasmAdapter.d.ts +2 -0
  47. package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
  48. package/dist/kernel/quality.d.ts +29 -0
  49. package/dist/{measureFns-DSUJdWbH.cjs → measureFns-LAuiTxIU.cjs} +3 -3
  50. package/dist/{measureFns-DXQSqDH0.js → measureFns-Pxrwu7Nl.js} +3 -3
  51. package/dist/measurement.cjs +1 -1
  52. package/dist/measurement.js +1 -1
  53. package/dist/{meshFns-D2rcmVr_.cjs → meshFns-0wmojo6X.cjs} +12 -6
  54. package/dist/{meshFns-DZA-Hsya.js → meshFns-BYLqZcfo.js} +12 -6
  55. package/dist/{occtWasmAdapter-BuIYbIwy.cjs → occtWasmAdapter-BPu07Zxg.cjs} +33 -0
  56. package/dist/{occtWasmAdapter-B0PIezOZ.js → occtWasmAdapter-Ctfykwr2.js} +22 -1
  57. package/dist/operations.cjs +2 -2
  58. package/dist/operations.js +2 -2
  59. package/dist/{primitiveFns-_A-uhxX7.js → primitiveFns-BJ5PwAOM.js} +7 -7
  60. package/dist/{primitiveFns-B7BJjuHU.cjs → primitiveFns-BVpOZIFy.cjs} +7 -7
  61. package/dist/projection.cjs +1 -1
  62. package/dist/projection.js +1 -1
  63. package/dist/query.cjs +2 -2
  64. package/dist/query.js +2 -2
  65. package/dist/{shapeFns-Uplvk1Jx.cjs → shapeFns-B15j-oke.cjs} +2 -2
  66. package/dist/{shapeFns-Cu8myB5f.js → shapeFns-Bf3fSMLC.js} +2 -2
  67. package/dist/shapeRef.cjs +1 -1
  68. package/dist/shapeRef.js +1 -1
  69. package/dist/{shapeRefFns-Drrf8qS4.js → shapeRefFns-C1nNU4at.js} +4 -4
  70. package/dist/{shapeRefFns-DZS2Y-8H.cjs → shapeRefFns-Cu3aH-S0.cjs} +4 -4
  71. package/dist/{shapeTypes-0gU7DOBf.cjs → shapeTypes-C6gF9fGL.cjs} +174 -12
  72. package/dist/{shapeTypes-B2tufXyI.js → shapeTypes-KIrwDkmg.js} +133 -13
  73. package/dist/sketching.cjs +3 -3
  74. package/dist/sketching.js +3 -3
  75. package/dist/{solidBuilders-3Is-YjEI.js → solidBuilders-CN91DyTF.js} +2 -2
  76. package/dist/{solidBuilders-CdWC9FZI.cjs → solidBuilders-Ii8I669S.cjs} +2 -2
  77. package/dist/{surfaceBuilders-BjiUI8f_.cjs → surfaceBuilders-DSgKSrN-.cjs} +2 -2
  78. package/dist/{surfaceBuilders-BZOjOk6T.js → surfaceBuilders-VOedQa9z.js} +2 -2
  79. package/dist/text.cjs +2 -2
  80. package/dist/text.js +2 -2
  81. package/dist/{textBlueprints-Dl-qQ5Hm.cjs → textBlueprints-BROqnpya.cjs} +7 -7
  82. package/dist/{textBlueprints-BPi0wGxq.js → textBlueprints-k0trqpEg.js} +7 -7
  83. package/dist/{textMetrics-yWTfUPqx.js → textMetrics-DnOTH1ld.js} +1 -1
  84. package/dist/{textMetrics-CDEnxSK0.cjs → textMetrics-dS4ldSza.cjs} +1 -1
  85. package/dist/topology/meshFns.d.ts +5 -5
  86. package/dist/topology.cjs +7 -7
  87. package/dist/topology.js +7 -7
  88. package/dist/{topologyQueryFns-CxPWWuGB.js → topologyQueryFns-Bkr82t7v.js} +1 -1
  89. package/dist/{topologyQueryFns-CI4gmFyi.cjs → topologyQueryFns-CseKGFog.cjs} +1 -1
  90. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
- import { Z as getKernel, _ as isSolid, c as createSolid, h as isShape3D, p as isFace, r as castShapeWithKnownType, t as castShape, x as isClosedWire, y as isWire } from "./shapeTypes-B2tufXyI.js";
1
+ import { Z as getKernel, _ as isSolid, c as createSolid, h as isShape3D, p as isFace, r as castShapeWithKnownType, t as castShape, x as isClosedWire, y as isWire } from "./shapeTypes-KIrwDkmg.js";
2
2
  import { A as ok, T as isOk, b as err, d as validationError, i as kernelError, l as typeCastError, t as BrepErrorCode, v as andThen, w as isErr } from "./errors-DNWJsfVU.js";
3
- import { c as getFaces, i as getCachedIsValid, l as getOrCreateCache, m as invalidateShapeCache, p as getWires, s as getEdges } from "./topologyQueryFns-CxPWWuGB.js";
3
+ import { c as getFaces, i as getCachedIsValid, l as getOrCreateCache, m as invalidateShapeCache, p as getWires, s as getEdges } from "./topologyQueryFns-Bkr82t7v.js";
4
4
  import { n as HASH_CODE_MAX, t as DEG2RAD } from "./constants-ITRzCnCp.js";
5
- import { _ as downcast } from "./faceFns-DFbEW9oz.js";
6
- import { _ as propagateAllMetadata, g as collectInputFaceHashes, h as translate } from "./shapeFns-Cu8myB5f.js";
5
+ import { _ as downcast } from "./faceFns-Bd3zdzrq.js";
6
+ import { _ as propagateAllMetadata, g as collectInputFaceHashes, h as translate } from "./shapeFns-Bf3fSMLC.js";
7
7
  import { t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
8
- import { _ as makeThreePointArc, a as makeNonPlanarFace, c as makeBSplineApproximation, d as makeCircle, f as makeEllipse, g as makeTangentArc, h as makeLine, i as makeNewFaceWithinFace, m as makeHelix, o as makePolygon, p as makeEllipseArc, r as makeFace, s as assembleWire, t as addHolesInFace, u as makeBezierCurve } from "./surfaceBuilders-BZOjOk6T.js";
9
- import { a as fuseAll, i as fuse, n as cut, r as cutAll } from "./booleanFns-4_KnvEil.js";
10
- import { a as makeOffset, c as makeTorus, i as makeEllipsoid, l as makeVertex, n as makeCone, o as makeSolid, r as makeCylinder, s as makeSphere, t as makeCompound, u as weldShellsAndFaces } from "./solidBuilders-3Is-YjEI.js";
8
+ import { _ as makeThreePointArc, a as makeNonPlanarFace, c as makeBSplineApproximation, d as makeCircle, f as makeEllipse, g as makeTangentArc, h as makeLine, i as makeNewFaceWithinFace, m as makeHelix, o as makePolygon, p as makeEllipseArc, r as makeFace, s as assembleWire, t as addHolesInFace, u as makeBezierCurve } from "./surfaceBuilders-VOedQa9z.js";
9
+ import { a as fuseAll, i as fuse, n as cut, r as cutAll } from "./booleanFns-CN5sVkm6.js";
10
+ import { a as makeOffset, c as makeTorus, i as makeEllipsoid, l as makeVertex, n as makeCone, o as makeSolid, r as makeCylinder, s as makeSphere, t as makeCompound, u as weldShellsAndFaces } from "./solidBuilders-CN91DyTF.js";
11
11
  //#region src/topology/threeHelpers.ts
12
12
  /**
13
13
  * Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
@@ -1,13 +1,13 @@
1
- const require_shapeTypes = require("./shapeTypes-0gU7DOBf.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-C6gF9fGL.cjs");
2
2
  const require_errors = require("./errors-CXJtc4I7.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-CI4gmFyi.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-CseKGFog.cjs");
4
4
  const require_constants = require("./constants-BOVyEYGH.cjs");
5
- const require_faceFns = require("./faceFns-FVl-7nu7.cjs");
6
- const require_shapeFns = require("./shapeFns-Uplvk1Jx.cjs");
5
+ const require_faceFns = require("./faceFns-7g1e493t.cjs");
6
+ const require_shapeFns = require("./shapeFns-B15j-oke.cjs");
7
7
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
8
- const require_surfaceBuilders = require("./surfaceBuilders-BjiUI8f_.cjs");
9
- const require_booleanFns = require("./booleanFns-9qTQX1iM.cjs");
10
- const require_solidBuilders = require("./solidBuilders-CdWC9FZI.cjs");
8
+ const require_surfaceBuilders = require("./surfaceBuilders-DSgKSrN-.cjs");
9
+ const require_booleanFns = require("./booleanFns-D-wTRioN.cjs");
10
+ const require_solidBuilders = require("./solidBuilders-Ii8I669S.cjs");
11
11
  //#region src/topology/threeHelpers.ts
12
12
  /**
13
13
  * Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_cameraFns = require("./cameraFns-Bz11Ik2z.cjs");
2
+ const require_cameraFns = require("./cameraFns-BXAgEEUR.cjs");
3
3
  exports.PROJECTION_PLANES = require_cameraFns.PROJECTION_PLANES;
4
4
  exports.cameraFromPlane = require_cameraFns.cameraFromPlane;
5
5
  exports.cameraLookAt = require_cameraFns.cameraLookAt;
@@ -1,2 +1,2 @@
1
- import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, o as PROJECTION_PLANES, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-5FSJmH9r.js";
1
+ import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, o as PROJECTION_PLANES, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-BTkg-7od.js";
2
2
  export { PROJECTION_PLANES, cameraFromPlane, cameraLookAt, createCamera, isProjectionPlane, makeProjectedEdges, projectEdges };
package/dist/query.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_helpers = require("./helpers-BqrszPEI.cjs");
3
- const require_cornerFinder = require("./cornerFinder-mD9AqCfR.cjs");
2
+ const require_helpers = require("./helpers-qJvSmWhx.cjs");
3
+ const require_cornerFinder = require("./cornerFinder-0DmLYmdL.cjs");
4
4
  exports.cornerFinder = require_cornerFinder.cornerFinder;
5
5
  exports.edgeFinder = require_helpers.edgeFinder;
6
6
  exports.faceFinder = require_helpers.faceFinder;
package/dist/query.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-CIucvYwe.js";
2
- import { t as cornerFinder } from "./cornerFinder-C10oNGL4.js";
1
+ import { n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-DQ634U2V.js";
2
+ import { t as cornerFinder } from "./cornerFinder-C_w8TN9u.js";
3
3
  export { cornerFinder, edgeFinder, faceFinder, getSingleFace };
@@ -1,6 +1,6 @@
1
- const require_shapeTypes = require("./shapeTypes-0gU7DOBf.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-C6gF9fGL.cjs");
2
2
  const require_errors = require("./errors-CXJtc4I7.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-CI4gmFyi.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-CseKGFog.cjs");
4
4
  const require_constants = require("./constants-BOVyEYGH.cjs");
5
5
  //#region src/topology/metadata/originTrackingFns.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { Z as getKernel, t as castShape } from "./shapeTypes-B2tufXyI.js";
1
+ import { Z as getKernel, t as castShape } from "./shapeTypes-KIrwDkmg.js";
2
2
  import { A as ok, b as err, d as validationError, t as BrepErrorCode } from "./errors-DNWJsfVU.js";
3
- import { C as kernelCall, c as getFaces, l as getOrCreateCache, r as getCacheEntry, w as kernelCallRaw } from "./topologyQueryFns-CxPWWuGB.js";
3
+ import { C as kernelCall, c as getFaces, l as getOrCreateCache, r as getCacheEntry, w as kernelCallRaw } from "./topologyQueryFns-Bkr82t7v.js";
4
4
  import { n as HASH_CODE_MAX, t as DEG2RAD } from "./constants-ITRzCnCp.js";
5
5
  //#region src/topology/metadata/originTrackingFns.ts
6
6
  /**
package/dist/shapeRef.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_shapeRefFns = require("./shapeRefFns-DZS2Y-8H.cjs");
2
+ const require_shapeRefFns = require("./shapeRefFns-Cu3aH-S0.cjs");
3
3
  exports.assignRoles = require_shapeRefFns.assignRoles;
4
4
  exports.captureHint = require_shapeRefFns.captureHint;
5
5
  exports.createRef = require_shapeRefFns.createRef;
package/dist/shapeRef.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as updateRoles, i as resolveRef, n as captureHint, o as defaultScorer, r as createRef, t as assignRoles } from "./shapeRefFns-Drrf8qS4.js";
1
+ import { a as updateRoles, i as resolveRef, n as captureHint, o as defaultScorer, r as createRef, t as assignRoles } from "./shapeRefFns-C1nNU4at.js";
2
2
  export { assignRoles, captureHint, createRef, defaultScorer, resolveRef, updateRoles };
@@ -1,8 +1,8 @@
1
1
  import { n as wasmIndex } from "./vec3-Dpha8d5k.js";
2
- import { c as getFaces } from "./topologyQueryFns-CxPWWuGB.js";
3
- import { c as normalAt, n as faceCenter, r as faceGeomType } from "./faceFns-DFbEW9oz.js";
4
- import { n as getHashCode } from "./shapeFns-Cu8myB5f.js";
5
- import { n as measureArea } from "./measureFns-DXQSqDH0.js";
2
+ import { c as getFaces } from "./topologyQueryFns-Bkr82t7v.js";
3
+ import { c as normalAt, n as faceCenter, r as faceGeomType } from "./faceFns-Bd3zdzrq.js";
4
+ import { n as getHashCode } from "./shapeFns-Bf3fSMLC.js";
5
+ import { n as measureArea } from "./measureFns-Pxrwu7Nl.js";
6
6
  //#region src/topology/shapeRef/scoring.ts
7
7
  /**
8
8
  * Default face scorer combining surface type, normal alignment, centroid proximity,
@@ -1,8 +1,8 @@
1
1
  const require_vec3 = require("./vec3-CFwOI0ZI.cjs");
2
- const require_topologyQueryFns = require("./topologyQueryFns-CI4gmFyi.cjs");
3
- const require_faceFns = require("./faceFns-FVl-7nu7.cjs");
4
- const require_shapeFns = require("./shapeFns-Uplvk1Jx.cjs");
5
- const require_measureFns = require("./measureFns-DSUJdWbH.cjs");
2
+ const require_topologyQueryFns = require("./topologyQueryFns-CseKGFog.cjs");
3
+ const require_faceFns = require("./faceFns-7g1e493t.cjs");
4
+ const require_shapeFns = require("./shapeFns-B15j-oke.cjs");
5
+ const require_measureFns = require("./measureFns-LAuiTxIU.cjs");
6
6
  //#region src/topology/shapeRef/scoring.ts
7
7
  /**
8
8
  * Default face scorer combining surface type, normal alignment, centroid proximity,
@@ -1,6 +1,40 @@
1
+ const require_occtWasmAdapter = require("./occtWasmAdapter-BPu07Zxg.cjs");
1
2
  const require_vec3 = require("./vec3-CFwOI0ZI.cjs");
2
- const require_occtWasmAdapter = require("./occtWasmAdapter-BuIYbIwy.cjs");
3
3
  const require_errors = require("./errors-CXJtc4I7.cjs");
4
+ //#region src/kernel/quality.ts
5
+ /**
6
+ * Extract-time deflection per level. `'standard'` matches brepjs's historical
7
+ * `mesh()` defaults (1e-3 / 0.1) so behaviour is unchanged when no quality is
8
+ * set.
9
+ */
10
+ var DEFLECTION = {
11
+ draft: {
12
+ tolerance: .01,
13
+ angularTolerance: .5
14
+ },
15
+ standard: {
16
+ tolerance: .001,
17
+ angularTolerance: .1
18
+ },
19
+ fine: {
20
+ tolerance: 1e-4,
21
+ angularTolerance: .05
22
+ }
23
+ };
24
+ var _current = "standard";
25
+ /** The active quality level (defaults to `'standard'`). */
26
+ function currentQuality() {
27
+ return _current;
28
+ }
29
+ /** Deflection params for a level (defaults to the active level). */
30
+ function qualityDeflection(level = _current) {
31
+ return DEFLECTION[level];
32
+ }
33
+ /** @internal — set by `withQuality`/`withTier`; restored in their `finally`. */
34
+ function setQualityState(level) {
35
+ _current = level;
36
+ }
37
+ //#endregion
4
38
  //#region src/kernel/kernel2dTypes.ts
5
39
  /** Check if the kernel supports 2D geometry operations. */
6
40
  function supportsKernel2D(kernel) {
@@ -5291,6 +5325,7 @@ function makeDraftAdapter(oc) {
5291
5325
  var DefaultAdapter = class {
5292
5326
  oc;
5293
5327
  kernelId = "occt";
5328
+ capabilities = require_occtWasmAdapter.EXACT_BREP_CAPABILITIES;
5294
5329
  constructor(oc) {
5295
5330
  this.oc = oc;
5296
5331
  Object.assign(this, makeBooleanOps$2(oc), makeBooleanPipelineOps(oc), makeHullOps(oc), makeConstructorOps(oc), makeExtendedConstructorOps(oc), makeSweepOps$2(oc), makeModifierOps$2(oc), makeTransformOps$2(oc), makeMeshOps$2(oc), makeIoOps$2(oc), makeMeasureOps$2(oc), makeTopologyOps$2(oc), makeGeometryQueryOps(oc), makeNurbsQueryOps(oc), makeCurveOps(oc), makeHealingOps(oc), makeHistoryOps(oc), makeAdvancedOps(oc), makeKernel2dOps$1(oc), makeDraftAdapter(oc), makeBrepkitOnlyStubs());
@@ -9630,6 +9665,7 @@ function makeCoreOps$1(bk) {
9630
9665
  var BrepkitAdapter = class {
9631
9666
  oc;
9632
9667
  kernelId = "brepkit";
9668
+ capabilities = require_occtWasmAdapter.EXACT_BREP_CAPABILITIES;
9633
9669
  /** The underlying brepkit WASM kernel instance (typed). */
9634
9670
  bk;
9635
9671
  constructor(brepkitKernel) {
@@ -10070,8 +10106,8 @@ function translationMatrix(x, y, z) {
10070
10106
  m[14] = z;
10071
10107
  return m;
10072
10108
  }
10073
- function rotationMatrix(angleDeg, axis, center) {
10074
- const rad = angleDeg * Math.PI / 180;
10109
+ function rotationMatrix(angleRad, axis, center) {
10110
+ const rad = angleRad;
10075
10111
  const [ax, ay, az] = normalizeAxis(axis);
10076
10112
  const c = Math.cos(rad);
10077
10113
  const s = Math.sin(rad);
@@ -10867,10 +10903,22 @@ function rotationMinimizingFrames(path, seed) {
10867
10903
  }
10868
10904
  //#endregion
10869
10905
  //#region src/kernel/manifold/profileOps.ts
10870
- /** Segments used to approximate a full circle; arcs scale by angle span. */
10906
+ /** Fallback full-circle segment count when the kernel exposes no quality fn. */
10871
10907
  var FULL_CIRCLE_SEGMENTS = 24;
10872
10908
  /** Bezier sampling segments per edge. */
10873
10909
  var BEZIER_SEGMENTS = 24;
10910
+ /**
10911
+ * Full-circle segment count, following the Manifold global quality setting
10912
+ * (`getCircularSegments`) when available so profile-curve fidelity scales with
10913
+ * the kernel's tessellation quality — fine for accuracy-sensitive callers,
10914
+ * coarse for fast preview — instead of a hardcoded constant. Set by
10915
+ * {@link makeProfileBuilders}.
10916
+ */
10917
+ var circularSegmentsFor = null;
10918
+ function fullCircleSegments(radius) {
10919
+ const n = circularSegmentsFor ? circularSegmentsFor(Math.max(Math.abs(radius), 1e-6)) : FULL_CIRCLE_SEGMENTS;
10920
+ return Math.max(FULL_CIRCLE_SEGMENTS, n);
10921
+ }
10874
10922
  var ZERO3 = [
10875
10923
  0,
10876
10924
  0,
@@ -10884,8 +10932,8 @@ var PLACEHOLDER = {
10884
10932
  function at3(pts, i) {
10885
10933
  return pts[i] ?? ZERO3;
10886
10934
  }
10887
- function arcSegments(angleSpan) {
10888
- return Math.max(2, Math.ceil(Math.abs(angleSpan) / (2 * Math.PI) * FULL_CIRCLE_SEGMENTS));
10935
+ function arcSegments(angleSpan, radius = 1) {
10936
+ return Math.max(2, Math.ceil(Math.abs(angleSpan) / (2 * Math.PI) * fullCircleSegments(radius)));
10889
10937
  }
10890
10938
  function pickPerp(n) {
10891
10939
  return normalize3(cross(n, Math.abs(n[0]) < .9 ? [
@@ -10904,7 +10952,7 @@ function sampleArc(center, normal, radius, startAngle, endAngle, xDir) {
10904
10952
  const x = xDir ? normalize3(xDir) : pickPerp(n);
10905
10953
  const y = normalize3(cross(n, x));
10906
10954
  const span = endAngle - startAngle;
10907
- const segs = arcSegments(span);
10955
+ const segs = arcSegments(span, radius);
10908
10956
  const pts = [];
10909
10957
  for (let i = 0; i <= segs; i++) {
10910
10958
  const a = startAngle + span * i / segs;
@@ -11040,7 +11088,9 @@ function sampleOcctEdge(occt, edge) {
11040
11088
  function discretizeOcctWire(occt, wire) {
11041
11089
  return chainEdges(occt.iterShapes(wire, "edge").map((e) => sampleOcctEdge(occt, e)));
11042
11090
  }
11043
- function makeProfileBuilders(_module) {
11091
+ function makeProfileBuilders(module) {
11092
+ const getSegs = module.getCircularSegments;
11093
+ if (typeof getSegs === "function") circularSegmentsFor = (r) => getSegs(r);
11044
11094
  function edge(pts, curve) {
11045
11095
  return wrap(PLACEHOLDER, makeNode("profileEdge", curve ? {
11046
11096
  pts,
@@ -11173,8 +11223,9 @@ function makeProfileBuilders(_module) {
11173
11223
  const x = xDir ? normalize3(xDir) : pickPerp(n);
11174
11224
  const y = normalize3(cross(n, x));
11175
11225
  const pts = [];
11176
- for (let i = 0; i <= FULL_CIRCLE_SEGMENTS; i++) {
11177
- const a = 2 * Math.PI * i / FULL_CIRCLE_SEGMENTS;
11226
+ const segs = fullCircleSegments(Math.max(majorRadius, minorRadius));
11227
+ for (let i = 0; i <= segs; i++) {
11228
+ const a = 2 * Math.PI * i / segs;
11178
11229
  pts.push(add(center, add(scaleVec(x, majorRadius * Math.cos(a)), scaleVec(y, minorRadius * Math.sin(a)))));
11179
11230
  }
11180
11231
  return pts;
@@ -13413,8 +13464,7 @@ function hashCode(shape, upperBound) {
13413
13464
  function isNull(shape) {
13414
13465
  const s = asManifoldShape(shape);
13415
13466
  if (!s) return true;
13416
- const solid = unwrap(s);
13417
- return !solid || typeof solid.isEmpty === "function" && solid.isEmpty();
13467
+ return !unwrap(s);
13418
13468
  }
13419
13469
  function iterShapes(shape, type) {
13420
13470
  const s = asManifoldShape(shape);
@@ -14967,9 +15017,32 @@ function makeCoreOps(_module) {
14967
15017
  discardCheckpoint: () => notImplemented("discardCheckpoint")
14968
15018
  };
14969
15019
  }
15020
+ /** Manifold min circular angle (degrees) per quality level: finer ⇒ smaller angle ⇒ more segments. */
15021
+ var MIN_CIRCULAR_ANGLE_DEG = {
15022
+ draft: 30,
15023
+ standard: 10,
15024
+ fine: 3
15025
+ };
14970
15026
  var ManifoldAdapter = class {
14971
15027
  oc;
14972
15028
  kernelId = "manifold";
15029
+ capabilities = {
15030
+ exact: false,
15031
+ brepExport: false,
15032
+ exactMeasurement: false,
15033
+ tessellationModel: "build-time"
15034
+ };
15035
+ /**
15036
+ * Map a quality level to Manifold's global tessellation. Clearing the segment
15037
+ * count and driving by an angle bound makes it radius-adaptive (a small sphere
15038
+ * still gets enough facets).
15039
+ */
15040
+ setQuality(level) {
15041
+ const m = this.oc;
15042
+ m.setCircularSegments?.(0);
15043
+ m.setMinCircularEdgeLength?.(0);
15044
+ m.setMinCircularAngle?.(MIN_CIRCULAR_ANGLE_DEG[level]);
15045
+ }
14973
15046
  constructor(module) {
14974
15047
  this.oc = module;
14975
15048
  Object.assign(this, makePrimitiveOps(module), makeBooleanOps(module), makeTransformOps(module), makeBuilderOps(module), makeSweepOps(module), makeModifierOps(module), makeMeshOps(module), makeMeasureOps(module), makeTopologyOps(module), makeIoOps(module), makeGeometryOps(module), makeEvolutionOps(module), makeRepairOps(module), makeKernel2DOps(module), makeConstraintSketchOps(module), makeProjectionOps(module), makeCoreOps(module));
@@ -15051,6 +15124,53 @@ function withKernel(id, fn) {
15051
15124
  _cachedDefault = prev ? _kernels.get(prev) ?? null : null;
15052
15125
  }
15053
15126
  }
15127
+ /** Capabilities of a kernel (defaults to the active kernel). */
15128
+ function getKernelCapabilities(id) {
15129
+ return getKernel(id).capabilities;
15130
+ }
15131
+ /**
15132
+ * Run `fn` at a tessellation quality level. For `build-time` kernels (Manifold)
15133
+ * the level is pushed to the kernel's global setting on enter and restored on
15134
+ * exit; for `extract-time` kernels (OCCT) it becomes the default deflection at
15135
+ * `mesh()`/export inside `fn`. Synchronous only (mirrors {@link withKernel}).
15136
+ */
15137
+ function withQuality(level, fn) {
15138
+ const prevLevel = currentQuality();
15139
+ try {
15140
+ setQualityState(level);
15141
+ getKernel().setQuality?.(level);
15142
+ const result = fn();
15143
+ if (result instanceof Promise) throw new Error("withQuality() callback returned a Promise. Async code must read currentQuality()/getKernel() directly.");
15144
+ return result;
15145
+ } finally {
15146
+ setQualityState(prevLevel);
15147
+ getKernel().setQuality?.(prevLevel);
15148
+ }
15149
+ }
15150
+ var _tiers = /* @__PURE__ */ new Map();
15151
+ /**
15152
+ * Bind a named tier to a (kernel, quality) pair — e.g. a `'preview'` tier on a
15153
+ * fast mesh kernel at `'draft'` quality, and an `'exact'` tier on an OCCT
15154
+ * kernel at `'fine'`. Lets call sites express intent (`withTier('preview', …)`)
15155
+ * instead of hard-coding a kernel id + quality knob.
15156
+ */
15157
+ function registerKernelTier(name, tier) {
15158
+ _tiers.set(name, tier);
15159
+ }
15160
+ /** The (kernel, quality) a tier resolves to, or undefined if unregistered. */
15161
+ function getKernelTier(name) {
15162
+ return _tiers.get(name);
15163
+ }
15164
+ /**
15165
+ * Run `fn` under a registered tier: switches to the tier's kernel and applies
15166
+ * its quality (both restored on exit). Composes {@link withKernel} and
15167
+ * {@link withQuality}. Throws if the tier is unregistered.
15168
+ */
15169
+ function withTier(name, fn) {
15170
+ const tier = _tiers.get(name);
15171
+ if (!tier) throw new Error(`withTier: no tier registered for "${name}". Call registerKernelTier("${name}", { kernel, quality }) first.`);
15172
+ return withKernel(tier.kernel, () => withQuality(tier.quality, fn));
15173
+ }
15054
15174
  /** Initialise the brepjs kernel from a loaded WASM instance. */
15055
15175
  function initFromOC(oc) {
15056
15176
  resetMeasureDetectionCache();
@@ -15819,6 +15939,12 @@ Object.defineProperty(exports, "createWire", {
15819
15939
  return createWire;
15820
15940
  }
15821
15941
  });
15942
+ Object.defineProperty(exports, "currentQuality", {
15943
+ enumerable: true,
15944
+ get: function() {
15945
+ return currentQuality;
15946
+ }
15947
+ });
15822
15948
  Object.defineProperty(exports, "getActiveKernelId", {
15823
15949
  enumerable: true,
15824
15950
  get: function() {
@@ -15843,6 +15969,18 @@ Object.defineProperty(exports, "getKernel2D", {
15843
15969
  return getKernel2D;
15844
15970
  }
15845
15971
  });
15972
+ Object.defineProperty(exports, "getKernelCapabilities", {
15973
+ enumerable: true,
15974
+ get: function() {
15975
+ return getKernelCapabilities;
15976
+ }
15977
+ });
15978
+ Object.defineProperty(exports, "getKernelTier", {
15979
+ enumerable: true,
15980
+ get: function() {
15981
+ return getKernelTier;
15982
+ }
15983
+ });
15846
15984
  Object.defineProperty(exports, "getOrQueryType", {
15847
15985
  enumerable: true,
15848
15986
  get: function() {
@@ -16017,6 +16155,12 @@ Object.defineProperty(exports, "prewarm", {
16017
16155
  return prewarm;
16018
16156
  }
16019
16157
  });
16158
+ Object.defineProperty(exports, "qualityDeflection", {
16159
+ enumerable: true,
16160
+ get: function() {
16161
+ return qualityDeflection;
16162
+ }
16163
+ });
16020
16164
  Object.defineProperty(exports, "registerForCleanup", {
16021
16165
  enumerable: true,
16022
16166
  get: function() {
@@ -16029,6 +16173,12 @@ Object.defineProperty(exports, "registerKernel", {
16029
16173
  return registerKernel;
16030
16174
  }
16031
16175
  });
16176
+ Object.defineProperty(exports, "registerKernelTier", {
16177
+ enumerable: true,
16178
+ get: function() {
16179
+ return registerKernelTier;
16180
+ }
16181
+ });
16032
16182
  Object.defineProperty(exports, "resetDisposalStats", {
16033
16183
  enumerable: true,
16034
16184
  get: function() {
@@ -16071,6 +16221,12 @@ Object.defineProperty(exports, "withKernel", {
16071
16221
  return withKernel;
16072
16222
  }
16073
16223
  });
16224
+ Object.defineProperty(exports, "withQuality", {
16225
+ enumerable: true,
16226
+ get: function() {
16227
+ return withQuality;
16228
+ }
16229
+ });
16074
16230
  Object.defineProperty(exports, "withScope", {
16075
16231
  enumerable: true,
16076
16232
  get: function() {
@@ -16089,3 +16245,9 @@ Object.defineProperty(exports, "withScopeResultAsync", {
16089
16245
  return withScopeResultAsync;
16090
16246
  }
16091
16247
  });
16248
+ Object.defineProperty(exports, "withTier", {
16249
+ enumerable: true,
16250
+ get: function() {
16251
+ return withTier;
16252
+ }
16253
+ });