brepjs 20.1.5 → 20.3.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 (115) hide show
  1. package/dist/2d.cjs +7 -7
  2. package/dist/2d.js +7 -7
  3. package/dist/{adjacencyFns-BrfM5HuO.cjs → adjacencyFns-1rxgJ6Hw.cjs} +3 -3
  4. package/dist/{adjacencyFns-BKNCTFyz.js → adjacencyFns-DeyXahej.js} +3 -3
  5. package/dist/{blueprint-cDEPhHO0.cjs → blueprint-Yyoiz-U1.cjs} +7 -7
  6. package/dist/{blueprint-DQaebcah.js → blueprint-rwJjYPzo.js} +7 -7
  7. package/dist/{blueprintFns-41EvpjiC.cjs → blueprintFns-Ce6OoPSX.cjs} +3 -3
  8. package/dist/{blueprintFns-DdIWHIxE.js → blueprintFns-Q3Sq-Fse.js} +3 -3
  9. package/dist/{blueprintSketcher-DX8NeWqA.cjs → blueprintSketcher-CzKbxeTk.cjs} +4 -4
  10. package/dist/{blueprintSketcher-BnVu9r7p.js → blueprintSketcher-FywUpRiV.js} +4 -4
  11. package/dist/{boolean2D-B0jPhKO1.cjs → boolean2D-BzZ9iBSn.cjs} +5 -5
  12. package/dist/{boolean2D-Dp7Bjzvc.js → boolean2D-D8igCYc9.js} +5 -5
  13. package/dist/brepjs.cjs +305 -81
  14. package/dist/brepjs.js +305 -82
  15. package/dist/{cameraFns-CcgzxZ-9.js → cameraFns-Cs6v3bWQ.js} +4 -4
  16. package/dist/{cameraFns-DUKz-5_d.cjs → cameraFns-RHCb1F1s.cjs} +4 -4
  17. package/dist/core/errors.d.ts +4 -0
  18. package/dist/core.cjs +4 -4
  19. package/dist/core.js +4 -4
  20. package/dist/{cornerFinder-B-eLajMt.cjs → cornerFinder-Cji_BK-R.cjs} +1 -1
  21. package/dist/{cornerFinder-D589drKe.js → cornerFinder-Dlae8IX5.js} +1 -1
  22. package/dist/csg/builders.d.ts +13 -1
  23. package/dist/csg/evaluate.d.ts +10 -1
  24. package/dist/csg/evaluators/context.d.ts +2 -1
  25. package/dist/csg/evaluators/extension.d.ts +5 -0
  26. package/dist/csg/hash.d.ts +1 -0
  27. package/dist/csg/index.d.ts +2 -2
  28. package/dist/csg/jsonData.d.ts +8 -0
  29. package/dist/csg/serialize.d.ts +1 -1
  30. package/dist/csg/types.d.ts +50 -1
  31. package/dist/{curveFns-D-hc0_6t.cjs → curveFns-6-ULFrEB.cjs} +2 -2
  32. package/dist/{curveFns-Q-tL9uNq.js → curveFns-KS1BWGhF.js} +2 -2
  33. package/dist/{drawFns-CrBzPDfw.js → drawFns-BD5OqwLF.js} +14 -14
  34. package/dist/{drawFns-BGW37YtA.cjs → drawFns-Dcvgj3Xg.cjs} +14 -14
  35. package/dist/{errors-CTn8i3lY.js → errors-Zb3jBa0u.js} +4 -0
  36. package/dist/{errors-DWezb9DI.cjs → errors-jwhfQJZK.cjs} +4 -0
  37. package/dist/{faceFns-DQ51W4Eg.js → faceFns-CTlJC5IY.js} +3 -3
  38. package/dist/{faceFns-iyZwpUFe.cjs → faceFns-CZeHWke7.cjs} +3 -3
  39. package/dist/{healingFns-DxEg4twQ.js → healingFns-BDkAwJNy.js} +5 -5
  40. package/dist/{healingFns-DlyPwsRq.cjs → healingFns-DziPRwmh.cjs} +5 -5
  41. package/dist/{helpers-Hna44lMW.js → helpers-BN1mVMuZ.js} +7 -7
  42. package/dist/{helpers-DzuHzyWn.cjs → helpers-NRZVshPb.cjs} +7 -7
  43. package/dist/{importFns-CzX0LzER.js → importFns-0kHGg-b8.js} +3 -3
  44. package/dist/{importFns-BygnKmG8.cjs → importFns-BEi-HsSw.cjs} +3 -3
  45. package/dist/index.d.ts +1 -0
  46. package/dist/io.cjs +2 -2
  47. package/dist/io.js +2 -2
  48. package/dist/kernel/interfaces/measureOps.d.ts +19 -0
  49. package/dist/kernel/occtWasm/measureOps.d.ts +2 -1
  50. package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
  51. package/dist/kernel/occtWasm/occtWasmAdapter.d.ts +2 -1
  52. package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
  53. package/dist/kernel/occtWasm/occtWasmTypes.d.ts +2 -0
  54. package/dist/{loftFns-Bo6ngjcA.js → loftFns-B5mq1WDh.js} +2 -2
  55. package/dist/{loftFns-DfF8LMRm.cjs → loftFns-DL9UsQhd.cjs} +2 -2
  56. package/dist/{measureFns-DnZsoSsE.js → measureFns-CyDVZomf.js} +5 -5
  57. package/dist/{measureFns-Czv8iOd1.cjs → measureFns-D_GpQw5z.cjs} +16 -4
  58. package/dist/measurement/measureCache.d.ts +2 -1
  59. package/dist/measurement/measureTypes.d.ts +9 -0
  60. package/dist/measurement/principalBoxFns.d.ts +33 -0
  61. package/dist/measurement.cjs +3 -1
  62. package/dist/measurement.d.ts +1 -0
  63. package/dist/measurement.js +3 -2
  64. package/dist/{meshFns-82W7072d.cjs → meshFns-CAxkaRTm.cjs} +4 -4
  65. package/dist/{meshFns-DegHraku.js → meshFns-COlno8TY.js} +4 -4
  66. package/dist/ns/measurement.d.ts +1 -0
  67. package/dist/{occtWasmAdapter-D4I0n537.js → occtWasmAdapter-BX10fyla.js} +21 -0
  68. package/dist/{occtWasmAdapter-wCKnmevS.cjs → occtWasmAdapter-CA6PmIIj.cjs} +21 -0
  69. package/dist/operations.cjs +2 -2
  70. package/dist/operations.js +2 -2
  71. package/dist/{originTrackingFns-DP_yN44Z.cjs → originTrackingFns-CWo6NWHK.cjs} +2 -2
  72. package/dist/{originTrackingFns-BbTSRuQj.js → originTrackingFns-DiHy5BZC.js} +2 -2
  73. package/dist/{planeOps-CkpMeheg.js → planeOps-Cxws4Tiu.js} +1 -1
  74. package/dist/{planeOps-CpupTCRM.cjs → planeOps-DJuclNxa.cjs} +1 -1
  75. package/dist/{primitiveFns-D1ayK5yN.js → primitiveFns-CcaoYdzl.js} +5 -5
  76. package/dist/{primitiveFns-_Kid-gYL.cjs → primitiveFns-DayTOw7C.cjs} +5 -5
  77. package/dist/principalBoxFns-5FSbxAj-.cjs +212 -0
  78. package/dist/principalBoxFns-BJgGEoik.js +207 -0
  79. package/dist/projection.cjs +1 -1
  80. package/dist/projection.js +1 -1
  81. package/dist/query.cjs +2 -2
  82. package/dist/query.js +2 -2
  83. package/dist/{refResolveFns-BL_6tDQG.cjs → refResolveFns-BJG5h8ce.cjs} +6 -6
  84. package/dist/{refResolveFns-BujrL8at.js → refResolveFns-C0_Wx7nM.js} +6 -6
  85. package/dist/result.cjs +1 -1
  86. package/dist/result.js +1 -1
  87. package/dist/{shapeFns-sbLSffyZ.js → shapeFns--1wNlcc_.js} +3 -3
  88. package/dist/{shapeFns-SdMLvQ7n.cjs → shapeFns-C2j6oZ2u.cjs} +3 -3
  89. package/dist/shapeRef.cjs +1 -1
  90. package/dist/shapeRef.js +1 -1
  91. package/dist/{shapeTypes-DVpJHhgk.js → shapeTypes-CqNJoSam.js} +1 -1
  92. package/dist/{shapeTypes-BWsKDxzf.cjs → shapeTypes-DH2ShBU_.cjs} +1 -1
  93. package/dist/sketching.cjs +3 -3
  94. package/dist/sketching.js +3 -3
  95. package/dist/{solidBuilders-CZdfdC4S.cjs → solidBuilders-6eLtWBLM.cjs} +7 -7
  96. package/dist/{solidBuilders-BmUEjbhs.js → solidBuilders-BwOF7M-p.js} +7 -7
  97. package/dist/{surfaceBuilders-DW56oYUA.js → surfaceBuilders-8nLk2PWk.js} +4 -4
  98. package/dist/{surfaceBuilders-BujH-WLG.cjs → surfaceBuilders-vYgSvgI6.cjs} +4 -4
  99. package/dist/text.cjs +2 -2
  100. package/dist/text.js +2 -2
  101. package/dist/{textBlueprints-BlTo-FeX.js → textBlueprints-3jLY3G3u.js} +9 -9
  102. package/dist/{textBlueprints-BaRZlz2x.cjs → textBlueprints-BE9lHH5V.cjs} +9 -9
  103. package/dist/{textMetrics-C6AkkXLu.cjs → textMetrics-DMhzyYGs.cjs} +2 -2
  104. package/dist/{textMetrics-KJFOH0hq.js → textMetrics-cyLUdKx1.js} +2 -2
  105. package/dist/{threadFns-D-Qy8nQN.cjs → threadFns-Bc1QOMeh.cjs} +8 -8
  106. package/dist/{threadFns-CRq0YEAj.js → threadFns-CJT2NW3G.js} +8 -8
  107. package/dist/topology.cjs +9 -9
  108. package/dist/topology.js +9 -9
  109. package/dist/{topologyQueryFns-C8Dv3AdW.js → topologyQueryFns-DnfjQgP7.js} +3 -3
  110. package/dist/{topologyQueryFns-DbQBANFg.cjs → topologyQueryFns-q2bGyuEV.cjs} +8 -2
  111. package/dist/{validityTypes-4nhcQAdO.cjs → validityTypes-r0A2YdNq.cjs} +2 -2
  112. package/dist/{validityTypes-D6M4CiEI.js → validityTypes-t7JpS0Ki.js} +2 -2
  113. package/dist/vectors.cjs +1 -1
  114. package/dist/vectors.js +1 -1
  115. package/package.json +1 -1
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_occtWasmAdapter = require("../../occtWasmAdapter-wCKnmevS.cjs");
2
+ const require_occtWasmAdapter = require("../../occtWasmAdapter-CA6PmIIj.cjs");
3
3
  exports.OcctWasmAdapter = require_occtWasmAdapter.OcctWasmAdapter;
@@ -1,6 +1,6 @@
1
1
  import { KernelCapabilities } from '../capabilities.js';
2
2
  import { BooleanOpType, BooleanOptions, CheckBooleanResult, DiagnosticOperationResult, DistanceResult, KernelAdapter, KernelEdgeMeshResult, KernelInstance, KernelMeshResult, KernelShape, KernelType, MeshOptions, NurbsCurveData, OperationResult, ShapeOrientation, ShapeType, StepAssemblyPart, SurfaceType } from '../types.js';
3
- import { BulkMeasurement } from '../interfaces/measureOps.js';
3
+ import { BulkMeasurement, Matrix3 } from '../interfaces/measureOps.js';
4
4
  import { TransformEntry } from '../interfaces/transformOps.js';
5
5
  import { Curve2dHandle, BBox2dHandle } from '../kernel2dTypes.js';
6
6
  import { OcctWasmModule, OcctKernelWasm } from './occtWasmTypes.js';
@@ -249,6 +249,7 @@ export declare class OcctWasmAdapter implements KernelAdapter {
249
249
  min: [number, number, number];
250
250
  max: [number, number, number];
251
251
  };
252
+ inertia(shape: KernelShape): Matrix3;
252
253
  distance(shape1: KernelShape, shape2: KernelShape): DistanceResult;
253
254
  surfaceCurvature(face: KernelShape, u: number, v: number): {
254
255
  gaussian: number;
@@ -1,2 +1,2 @@
1
- import { t as OcctWasmAdapter } from "../../occtWasmAdapter-D4I0n537.js";
1
+ import { t as OcctWasmAdapter } from "../../occtWasmAdapter-BX10fyla.js";
2
2
  export { OcctWasmAdapter };
@@ -229,6 +229,8 @@ export interface OcctKernelWasm {
229
229
  getSurfaceArea(id: number): number;
230
230
  getLength(id: number): number;
231
231
  getCenterOfMass(id: number): EmVectorDouble;
232
+ /** Row-major 3x3 volume matrix of inertia about the center of mass (occt-wasm >= 3.3.0). */
233
+ getInertia(id: number): EmVectorDouble;
232
234
  getSurfaceCenterOfMass(faceId: number): EmVectorDouble;
233
235
  getLinearCenterOfMass(id: number): EmVectorDouble;
234
236
  surfaceCurvature(faceId: number, u: number, v: number): EmVectorDouble;
@@ -1,5 +1,5 @@
1
- import { G as _usingCtx, T as isWire, h as disposeResultShape, n as castResultShape, q as getKernel, x as isShape3D } from "./shapeTypes-DVpJHhgk.js";
2
- import { E as ok, b as isErr, d as validationError, g as err, i as kernelError, l as typeCastError, t as BrepErrorCode } from "./errors-CTn8i3lY.js";
1
+ import { G as _usingCtx, T as isWire, h as disposeResultShape, n as castResultShape, q as getKernel, x as isShape3D } from "./shapeTypes-CqNJoSam.js";
2
+ import { E as ok, b as isErr, d as validationError, g as err, i as kernelError, l as typeCastError, t as BrepErrorCode } from "./errors-Zb3jBa0u.js";
3
3
  import { r as toVec3 } from "./types-D24Y27N0.js";
4
4
  import { c as vecLength, t as vecAdd } from "./vecOps-SKPRvPH-.js";
5
5
  //#region src/operations/extrudeUtils.ts
@@ -1,5 +1,5 @@
1
- const require_shapeTypes = require("./shapeTypes-BWsKDxzf.cjs");
2
- const require_errors = require("./errors-DWezb9DI.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-DH2ShBU_.cjs");
2
+ const require_errors = require("./errors-jwhfQJZK.cjs");
3
3
  const require_types = require("./types-KjA8tY4Y.cjs");
4
4
  const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
5
5
  //#region src/operations/extrudeUtils.ts
@@ -1,7 +1,7 @@
1
- import { q as getKernel } from "./shapeTypes-DVpJHhgk.js";
2
- import { E as ok, d as validationError, g as err, t as BrepErrorCode } from "./errors-CTn8i3lY.js";
3
- import { T as kernelCallRaw } from "./topologyQueryFns-C8Dv3AdW.js";
4
- import { m as uvBounds } from "./faceFns-DQ51W4Eg.js";
1
+ import { q as getKernel } from "./shapeTypes-CqNJoSam.js";
2
+ import { E as ok, d as validationError, g as err, t as BrepErrorCode } from "./errors-Zb3jBa0u.js";
3
+ import { E as kernelCallRaw } from "./topologyQueryFns-DnfjQgP7.js";
4
+ import { m as uvBounds } from "./faceFns-CTlJC5IY.js";
5
5
  //#region src/measurement/measureCache.ts
6
6
  var cache = /* @__PURE__ */ new WeakMap();
7
7
  function getCachedMeasurement(shape, key) {
@@ -224,4 +224,4 @@ function measureCurvatureAtMid(face) {
224
224
  });
225
225
  }
226
226
  //#endregion
227
- export { measureDistance as a, measureLinearProps as c, measureVolumeProps as d, measureCurvatureAtMid as i, measureSurfaceProps as l, measureArea as n, measureDistanceProps as o, measureCurvatureAt as r, measureLength as s, createDistanceQuery as t, measureVolume as u };
227
+ export { measureDistance as a, measureLinearProps as c, measureVolumeProps as d, getCachedMeasurement as f, measureCurvatureAtMid as i, measureSurfaceProps as l, measureArea as n, measureDistanceProps as o, setCachedMeasurement as p, measureCurvatureAt as r, measureLength as s, createDistanceQuery as t, measureVolume as u };
@@ -1,7 +1,7 @@
1
- const require_shapeTypes = require("./shapeTypes-BWsKDxzf.cjs");
2
- const require_errors = require("./errors-DWezb9DI.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-DbQBANFg.cjs");
4
- const require_faceFns = require("./faceFns-iyZwpUFe.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-DH2ShBU_.cjs");
2
+ const require_errors = require("./errors-jwhfQJZK.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-q2bGyuEV.cjs");
4
+ const require_faceFns = require("./faceFns-CZeHWke7.cjs");
5
5
  //#region src/measurement/measureCache.ts
6
6
  var cache = /* @__PURE__ */ new WeakMap();
7
7
  function getCachedMeasurement(shape, key) {
@@ -230,6 +230,12 @@ Object.defineProperty(exports, "createDistanceQuery", {
230
230
  return createDistanceQuery;
231
231
  }
232
232
  });
233
+ Object.defineProperty(exports, "getCachedMeasurement", {
234
+ enumerable: true,
235
+ get: function() {
236
+ return getCachedMeasurement;
237
+ }
238
+ });
233
239
  Object.defineProperty(exports, "measureArea", {
234
240
  enumerable: true,
235
241
  get: function() {
@@ -290,3 +296,9 @@ Object.defineProperty(exports, "measureVolumeProps", {
290
296
  return measureVolumeProps;
291
297
  }
292
298
  });
299
+ Object.defineProperty(exports, "setCachedMeasurement", {
300
+ enumerable: true,
301
+ get: function() {
302
+ return setCachedMeasurement;
303
+ }
304
+ });
@@ -1,9 +1,10 @@
1
- import { VolumeProps, SurfaceProps, LinearProps } from './measureTypes.js';
1
+ import { VolumeProps, SurfaceProps, LinearProps, PrincipalBoundingBox } from './measureTypes.js';
2
2
  /** Maps measurement keys to their corresponding result types. */
3
3
  export interface MeasurementValueMap {
4
4
  volume: VolumeProps;
5
5
  surface: SurfaceProps;
6
6
  linear: LinearProps;
7
+ principal: PrincipalBoundingBox;
7
8
  }
8
9
  /** Valid measurement cache keys. */
9
10
  export type MeasurementKey = keyof MeasurementValueMap;
@@ -18,6 +18,15 @@ export interface SurfaceProps extends PhysicalProps {
18
18
  export interface LinearProps extends PhysicalProps {
19
19
  readonly length: number;
20
20
  }
21
+ /** A box aligned to a solid's principal axes of inertia. */
22
+ export interface PrincipalBoundingBox {
23
+ /** Box center in world coordinates. */
24
+ readonly center: Vec3;
25
+ /** Box axes: orthonormal, right-handed, ordered by decreasing extent. */
26
+ readonly axes: readonly [Vec3, Vec3, Vec3];
27
+ /** Full edge lengths along `axes`, largest first. */
28
+ readonly size: Vec3;
29
+ }
21
30
  /** Distance measurement result including witness points. */
22
31
  export interface DistanceProps {
23
32
  /** The minimum distance between the two shapes. */
@@ -0,0 +1,33 @@
1
+ import { AnyShape, Dimension } from '../core/shapeTypes.js';
2
+ import { Result } from '../core/result.js';
3
+ import { PrincipalBoundingBox } from './measureTypes.js';
4
+ export type { PrincipalBoundingBox };
5
+ /**
6
+ * Measure a solid's bounding box on its principal axes of inertia.
7
+ *
8
+ * `getBounds` answers in world axes, so a board turned 30 degrees reports an
9
+ * inflated box with no frame. This box follows the part's own frame instead:
10
+ * it is the axis-aligned box in the frame of the principal axes of the volume
11
+ * inertia tensor about the center of mass.
12
+ *
13
+ * This is NOT a minimum-volume oriented bounding box. When principal moments
14
+ * coincide, the principal axes in that plane are not unique and the box can be
15
+ * larger than the tightest one: a 100 x 100 x 2 plate rotated 30 degrees about
16
+ * Z reports 136.6 x 136.6 x 2, because any in-plane pair of axes is principal
17
+ * for a square plate.
18
+ *
19
+ * @param shape - A solid, compsolid, or compound containing solids.
20
+ * @returns `Result` with the box center in world coordinates, orthonormal
21
+ * right-handed axes ordered by decreasing extent, and the full edge lengths
22
+ * along those axes. Fails with `NOT_A_SOLID` for any other shape type
23
+ * (face, wire, shell, ...), `ZERO_VOLUME` when the shape encloses no volume
24
+ * (e.g. a compound of faces), and an `UNSUPPORTED` error on kernels without
25
+ * an inertia query.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const { size, axes, center } = unwrap(principalBoundingBox(board));
30
+ * // size: [length, width, thickness]; axes[2] is the board's normal
31
+ * ```
32
+ */
33
+ export declare function principalBoundingBox(shape: AnyShape<Dimension>): Result<PrincipalBoundingBox>;
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_measureFns = require("./measureFns-Czv8iOd1.cjs");
2
+ const require_measureFns = require("./measureFns-D_GpQw5z.cjs");
3
+ const require_principalBoxFns = require("./principalBoxFns-5FSbxAj-.cjs");
3
4
  exports.createDistanceQuery = require_measureFns.createDistanceQuery;
4
5
  exports.measureArea = require_measureFns.measureArea;
5
6
  exports.measureDistance = require_measureFns.measureDistance;
@@ -9,3 +10,4 @@ exports.measureLinearProps = require_measureFns.measureLinearProps;
9
10
  exports.measureSurfaceProps = require_measureFns.measureSurfaceProps;
10
11
  exports.measureVolume = require_measureFns.measureVolume;
11
12
  exports.measureVolumeProps = require_measureFns.measureVolumeProps;
13
+ exports.principalBoundingBox = require_principalBoxFns.principalBoundingBox;
@@ -2,3 +2,4 @@
2
2
  * brepjs/measurement — Shape measurement functions.
3
3
  */
4
4
  export { measureVolume, measureArea, measureLength, measureDistance, measureDistanceProps, createDistanceQuery, measureVolumeProps, measureSurfaceProps, measureLinearProps, type PhysicalProps, type DistanceProps, } from './measurement/measureFns.js';
5
+ export { principalBoundingBox, type PrincipalBoundingBox } from './measurement/principalBoxFns.js';
@@ -1,2 +1,3 @@
1
- import { a as measureDistance, c as measureLinearProps, d as measureVolumeProps, l as measureSurfaceProps, n as measureArea, o as measureDistanceProps, s as measureLength, t as createDistanceQuery, u as measureVolume } from "./measureFns-DnZsoSsE.js";
2
- export { createDistanceQuery, measureArea, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps };
1
+ import { a as measureDistance, c as measureLinearProps, d as measureVolumeProps, l as measureSurfaceProps, n as measureArea, o as measureDistanceProps, s as measureLength, t as createDistanceQuery, u as measureVolume } from "./measureFns-CyDVZomf.js";
2
+ import { t as principalBoundingBox } from "./principalBoxFns-BJgGEoik.js";
3
+ export { createDistanceQuery, measureArea, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps, principalBoundingBox };
@@ -1,7 +1,7 @@
1
- const require_shapeTypes = require("./shapeTypes-BWsKDxzf.cjs");
2
- const require_errors = require("./errors-DWezb9DI.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-DbQBANFg.cjs");
4
- const require_originTrackingFns = require("./originTrackingFns-DP_yN44Z.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-DH2ShBU_.cjs");
2
+ const require_errors = require("./errors-jwhfQJZK.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-q2bGyuEV.cjs");
4
+ const require_originTrackingFns = require("./originTrackingFns-CWo6NWHK.cjs");
5
5
  //#region src/topology/meshCache.ts
6
6
  /**
7
7
  * Build a parameter key for the inner cache map (excludes shape identity).
@@ -1,7 +1,7 @@
1
- import { q as getKernel, ut as qualityDeflection } from "./shapeTypes-DVpJHhgk.js";
2
- import { E as ok, g as err, r as ioError } from "./errors-CTn8i3lY.js";
3
- import { d as getSolids, n as getBounds } from "./topologyQueryFns-C8Dv3AdW.js";
4
- import { t as getFaceOrigins } from "./originTrackingFns-BbTSRuQj.js";
1
+ import { q as getKernel, ut as qualityDeflection } from "./shapeTypes-CqNJoSam.js";
2
+ import { E as ok, g as err, r as ioError } from "./errors-Zb3jBa0u.js";
3
+ import { d as getSolids, n as getBounds } from "./topologyQueryFns-DnfjQgP7.js";
4
+ import { t as getFaceOrigins } from "./originTrackingFns-DiHy5BZC.js";
5
5
  //#region src/topology/meshCache.ts
6
6
  /**
7
7
  * Build a parameter key for the inner cache map (excludes shape identity).
@@ -3,3 +3,4 @@
3
3
  */
4
4
  export { measureVolume, measureArea, measureLength, measureDistance, measureDistanceProps, createDistanceQuery, measureVolumeProps, measureSurfaceProps, measureLinearProps, measureCurvatureAt, measureCurvatureAtMid, } from '../measurement/measureFns.js';
5
5
  export { checkInterference, checkAllInterferences } from '../measurement/interferenceFns.js';
6
+ export { principalBoundingBox } from '../measurement/principalBoxFns.js';
@@ -2362,6 +2362,24 @@ function linearCenterOfMass(k, shape) {
2362
2362
  vec.delete();
2363
2363
  }
2364
2364
  }
2365
+ function inertia(k, shape) {
2366
+ const vec = k.getInertia(unwrap(shape));
2367
+ try {
2368
+ return [
2369
+ vec.get(0),
2370
+ vec.get(1),
2371
+ vec.get(2),
2372
+ vec.get(3),
2373
+ vec.get(4),
2374
+ vec.get(5),
2375
+ vec.get(6),
2376
+ vec.get(7),
2377
+ vec.get(8)
2378
+ ];
2379
+ } finally {
2380
+ vec.delete();
2381
+ }
2382
+ }
2365
2383
  function boundingBox(k, shape) {
2366
2384
  const bb = k.getBoundingBox(unwrap(shape), true);
2367
2385
  return {
@@ -5435,6 +5453,9 @@ var OcctWasmAdapter = class OcctWasmAdapter {
5435
5453
  boundingBox(shape) {
5436
5454
  return boundingBox(this.k, shape);
5437
5455
  }
5456
+ inertia(shape) {
5457
+ return inertia(this.k, shape);
5458
+ }
5438
5459
  distance(shape1, shape2) {
5439
5460
  return distance(this.k, this.Module, shape1, shape2);
5440
5461
  }
@@ -2362,6 +2362,24 @@ function linearCenterOfMass(k, shape) {
2362
2362
  vec.delete();
2363
2363
  }
2364
2364
  }
2365
+ function inertia(k, shape) {
2366
+ const vec = k.getInertia(unwrap(shape));
2367
+ try {
2368
+ return [
2369
+ vec.get(0),
2370
+ vec.get(1),
2371
+ vec.get(2),
2372
+ vec.get(3),
2373
+ vec.get(4),
2374
+ vec.get(5),
2375
+ vec.get(6),
2376
+ vec.get(7),
2377
+ vec.get(8)
2378
+ ];
2379
+ } finally {
2380
+ vec.delete();
2381
+ }
2382
+ }
2365
2383
  function boundingBox(k, shape) {
2366
2384
  const bb = k.getBoundingBox(unwrap(shape), true);
2367
2385
  return {
@@ -5435,6 +5453,9 @@ var OcctWasmAdapter = class OcctWasmAdapter {
5435
5453
  boundingBox(shape) {
5436
5454
  return boundingBox(this.k, shape);
5437
5455
  }
5456
+ inertia(shape) {
5457
+ return inertia(this.k, shape);
5458
+ }
5438
5459
  distance(shape1, shape2) {
5439
5460
  return distance(this.k, this.Module, shape1, shape2);
5440
5461
  }
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_threadFns = require("./threadFns-D-Qy8nQN.cjs");
3
- const require_loftFns = require("./loftFns-DfF8LMRm.cjs");
2
+ const require_threadFns = require("./threadFns-Bc1QOMeh.cjs");
3
+ const require_loftFns = require("./loftFns-DL9UsQhd.cjs");
4
4
  exports.addChild = require_threadFns.addChild;
5
5
  exports.addJoint = require_threadFns.addJoint;
6
6
  exports.addStep = require_threadFns.addStep;
@@ -1,3 +1,3 @@
1
- import { A as setJointValue, B as walkAssembly, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as countNodes, H as circularPattern, I as createAssemblyNode, L as findNode, M as sphericalJoint, N as addChild, O as prismaticJoint, P as collectShapes, R as removeChild, S as addJoint, T as jointTransform, U as gridPattern, V as exportAssemblySTEP, W as linearPattern, 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, 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 updateNode } from "./threadFns-CRq0YEAj.js";
2
- import { c as twistExtrude, o as supportExtrude, r as complexExtrude, s as sweep } from "./loftFns-Bo6ngjcA.js";
1
+ import { A as setJointValue, B as walkAssembly, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as countNodes, H as circularPattern, I as createAssemblyNode, L as findNode, M as sphericalJoint, N as addChild, O as prismaticJoint, P as collectShapes, R as removeChild, S as addJoint, T as jointTransform, U as gridPattern, V as exportAssemblySTEP, W as linearPattern, 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, 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 updateNode } from "./threadFns-CJT2NW3G.js";
2
+ import { c as twistExtrude, o as supportExtrude, r as complexExtrude, s as sweep } from "./loftFns-B5mq1WDh.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 };
@@ -1,5 +1,5 @@
1
- const require_shapeTypes = require("./shapeTypes-BWsKDxzf.cjs");
2
- const require_topologyQueryFns = require("./topologyQueryFns-DbQBANFg.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-DH2ShBU_.cjs");
2
+ const require_topologyQueryFns = require("./topologyQueryFns-q2bGyuEV.cjs");
3
3
  const require_constants = require("./constants-BOVyEYGH.cjs");
4
4
  //#region src/topology/metadata/originTrackingFns.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { q as getKernel } from "./shapeTypes-DVpJHhgk.js";
2
- import { S as subShapeHashes, c as getFaces, l as getOrCreateCache, r as getCacheEntry } from "./topologyQueryFns-C8Dv3AdW.js";
1
+ import { q as getKernel } from "./shapeTypes-CqNJoSam.js";
2
+ import { C as subShapeHashes, c as getFaces, l as getOrCreateCache, r as getCacheEntry } from "./topologyQueryFns-DnfjQgP7.js";
3
3
  import { n as HASH_CODE_MAX } from "./constants-ITRzCnCp.js";
4
4
  //#region src/topology/metadata/originTrackingFns.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { E as ok, P as unwrap, d as validationError, g as err } from "./errors-CTn8i3lY.js";
1
+ import { E as ok, P as unwrap, d as validationError, g as err } from "./errors-Zb3jBa0u.js";
2
2
  import { t as DEG2RAD } from "./constants-ITRzCnCp.js";
3
3
  import { r as toVec3 } from "./types-D24Y27N0.js";
4
4
  import { d as vecNormalize, h as vecScale, m as vecRotate, r as vecCross, s as vecIsZero, t as vecAdd } from "./vecOps-SKPRvPH-.js";
@@ -1,4 +1,4 @@
1
- const require_errors = require("./errors-DWezb9DI.cjs");
1
+ const require_errors = require("./errors-jwhfQJZK.cjs");
2
2
  const require_constants = require("./constants-BOVyEYGH.cjs");
3
3
  const require_types = require("./types-KjA8tY4Y.cjs");
4
4
  const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
@@ -1,9 +1,9 @@
1
- import { E as GeometryCleanupError, G as _usingCtx, d as createSolid, n as castResultShape, q as getKernel } from "./shapeTypes-DVpJHhgk.js";
2
- import { E as ok, d as validationError, g as err, m as andThen, t as BrepErrorCode } from "./errors-CTn8i3lY.js";
3
- import { n as isClosedWire } from "./validityTypes-D6M4CiEI.js";
1
+ import { E as GeometryCleanupError, G as _usingCtx, d as createSolid, n as castResultShape, q as getKernel } from "./shapeTypes-CqNJoSam.js";
2
+ import { E as ok, d as validationError, g as err, m as andThen, t as BrepErrorCode } from "./errors-Zb3jBa0u.js";
3
+ import { n as isClosedWire } from "./validityTypes-t7JpS0Ki.js";
4
4
  import { n as HASH_CODE_MAX, t as DEG2RAD } from "./constants-ITRzCnCp.js";
5
- import { C as propagateAllMetadata, S as hasAnyMetadata, T as propagateMetadataThroughRelocation, 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, w as propagateMetadataByHash, x as collectInputFaceHashes } from "./solidBuilders-BmUEjbhs.js";
6
- 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-DW56oYUA.js";
5
+ import { C as propagateAllMetadata, S as hasAnyMetadata, T as propagateMetadataThroughRelocation, 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, w as propagateMetadataByHash, x as collectInputFaceHashes } from "./solidBuilders-BwOF7M-p.js";
6
+ 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-8nLk2PWk.js";
7
7
  //#region src/topology/transformFns.ts
8
8
  /**
9
9
  * Immutable shape transforms — translate, rotate, scale, mirror, applyMatrix.
@@ -1,9 +1,9 @@
1
- const require_shapeTypes = require("./shapeTypes-BWsKDxzf.cjs");
2
- const require_errors = require("./errors-DWezb9DI.cjs");
3
- const require_validityTypes = require("./validityTypes-4nhcQAdO.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-DH2ShBU_.cjs");
2
+ const require_errors = require("./errors-jwhfQJZK.cjs");
3
+ const require_validityTypes = require("./validityTypes-r0A2YdNq.cjs");
4
4
  const require_constants = require("./constants-BOVyEYGH.cjs");
5
- const require_solidBuilders = require("./solidBuilders-CZdfdC4S.cjs");
6
- const require_surfaceBuilders = require("./surfaceBuilders-BujH-WLG.cjs");
5
+ const require_solidBuilders = require("./solidBuilders-6eLtWBLM.cjs");
6
+ const require_surfaceBuilders = require("./surfaceBuilders-vYgSvgI6.cjs");
7
7
  //#region src/topology/transformFns.ts
8
8
  /**
9
9
  * Immutable shape transforms — translate, rotate, scale, mirror, applyMatrix.
@@ -0,0 +1,212 @@
1
+ const require_shapeTypes = require("./shapeTypes-DH2ShBU_.cjs");
2
+ const require_bug = require("./bug-O02CsAmt.cjs");
3
+ const require_errors = require("./errors-jwhfQJZK.cjs");
4
+ const require_topologyQueryFns = require("./topologyQueryFns-q2bGyuEV.cjs");
5
+ const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
6
+ const require_measureFns = require("./measureFns-D_GpQw5z.cjs");
7
+ //#region src/measurement/principalBoxFns.ts
8
+ /**
9
+ * Principal-axes bounding box: a solid's extent measured in the frame of its
10
+ * principal axes of inertia instead of the world axes.
11
+ */
12
+ var ZERO_VOLUME_TOLERANCE = 1e-9;
13
+ var OFF_DIAGONAL_TOLERANCE = 1e-12;
14
+ var JACOBI_MAX_SWEEPS = 32;
15
+ var JACOBI_PLANES = [
16
+ [0, 1],
17
+ [0, 2],
18
+ [1, 2]
19
+ ];
20
+ var ORIGIN = [
21
+ 0,
22
+ 0,
23
+ 0
24
+ ];
25
+ function validatePrincipalBoxInput(shape) {
26
+ const kernel = require_shapeTypes.getKernel();
27
+ if (kernel.isNull(shape.wrapped)) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.NULL_SHAPE_INPUT, "principalBoundingBox: shape is a null shape"));
28
+ const type = kernel.shapeType(shape.wrapped);
29
+ if (type !== "solid" && type !== "compsolid" && type !== "compound") return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.NOT_A_SOLID, `principalBoundingBox: expected a solid, got a ${type}`, void 0, { shapeType: type }, "Use getBounds() for faces, wires, and shells"));
30
+ const volume = require_topologyQueryFns.kernelCallRaw(() => type === "solid" || require_topologyQueryFns.subShapeCount(shape, "solid") > 0 ? kernel.volume(shape.wrapped) : 0, require_errors.BrepErrorCode.PRINCIPAL_BOX_FAILED, "principalBoundingBox: failed to measure volume");
31
+ if (!volume.ok) return volume;
32
+ if (volume.value <= ZERO_VOLUME_TOLERANCE) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.ZERO_VOLUME, "principalBoundingBox: shape encloses no volume", void 0, { volume: volume.value }, "Use getBounds() for shapes without volume, or build a solid first"));
33
+ }
34
+ /** One cyclic-Jacobi rotation that zeroes `a[p][q]`, accumulated into the eigenvector matrix `v`. */
35
+ function jacobiRotate(a, v, p, q) {
36
+ const apq = require_bug.wasmIndex(a, p * 3 + q);
37
+ const theta = (require_bug.wasmIndex(a, q * 3 + q) - require_bug.wasmIndex(a, p * 3 + p)) / (2 * apq);
38
+ const t = (theta >= 0 ? 1 : -1) / (Math.abs(theta) + Math.sqrt(theta * theta + 1));
39
+ const c = 1 / Math.sqrt(t * t + 1);
40
+ const s = t * c;
41
+ for (let k = 0; k < 3; k++) {
42
+ const akp = require_bug.wasmIndex(a, k * 3 + p);
43
+ const akq = require_bug.wasmIndex(a, k * 3 + q);
44
+ a[k * 3 + p] = c * akp - s * akq;
45
+ a[k * 3 + q] = s * akp + c * akq;
46
+ }
47
+ for (let k = 0; k < 3; k++) {
48
+ const apk = require_bug.wasmIndex(a, p * 3 + k);
49
+ const aqk = require_bug.wasmIndex(a, q * 3 + k);
50
+ a[p * 3 + k] = c * apk - s * aqk;
51
+ a[q * 3 + k] = s * apk + c * aqk;
52
+ const vkp = require_bug.wasmIndex(v, k * 3 + p);
53
+ const vkq = require_bug.wasmIndex(v, k * 3 + q);
54
+ v[k * 3 + p] = c * vkp - s * vkq;
55
+ v[k * 3 + q] = s * vkp + c * vkq;
56
+ }
57
+ a[p * 3 + q] = 0;
58
+ a[q * 3 + p] = 0;
59
+ }
60
+ /**
61
+ * Eigenvectors of a symmetric 3x3 matrix by cyclic Jacobi. Every rotation is
62
+ * proper, so the returned axes form a right-handed orthonormal frame.
63
+ */
64
+ function principalAxes(m) {
65
+ const a = [...m];
66
+ const v = [
67
+ 1,
68
+ 0,
69
+ 0,
70
+ 0,
71
+ 1,
72
+ 0,
73
+ 0,
74
+ 0,
75
+ 1
76
+ ];
77
+ const threshold = OFF_DIAGONAL_TOLERANCE * Math.hypot(...m);
78
+ for (let sweep = 0; sweep < JACOBI_MAX_SWEEPS; sweep++) {
79
+ let rotated = false;
80
+ for (const [p, q] of JACOBI_PLANES) {
81
+ if (Math.abs(require_bug.wasmIndex(a, p * 3 + q)) <= threshold) continue;
82
+ jacobiRotate(a, v, p, q);
83
+ rotated = true;
84
+ }
85
+ if (!rotated) break;
86
+ }
87
+ const column = (j) => [
88
+ require_bug.wasmIndex(v, j),
89
+ require_bug.wasmIndex(v, 3 + j),
90
+ require_bug.wasmIndex(v, 6 + j)
91
+ ];
92
+ return [
93
+ column(0),
94
+ column(1),
95
+ column(2)
96
+ ];
97
+ }
98
+ /** Flip `v` so its largest-magnitude component is positive. */
99
+ function canonicalSign(v) {
100
+ const x = Math.abs(v[0]);
101
+ const y = Math.abs(v[1]);
102
+ const z = Math.abs(v[2]);
103
+ return (x >= y && x >= z ? v[0] : y >= z ? v[1] : v[2]) < 0 ? [
104
+ -v[0],
105
+ -v[1],
106
+ -v[2]
107
+ ] : v;
108
+ }
109
+ function withoutNegativeZero(v) {
110
+ return [
111
+ v[0] + 0,
112
+ v[1] + 0,
113
+ v[2] + 0
114
+ ];
115
+ }
116
+ function boundsInFrame(shape, axes) {
117
+ try {
118
+ var _usingCtx$1 = require_shapeTypes._usingCtx();
119
+ const kernel = require_shapeTypes.getKernel();
120
+ const [a0, a1, a2] = axes;
121
+ const framed = _usingCtx$1.u(require_shapeTypes.castResultShape(kernel.generalTransform(shape.wrapped, [
122
+ ...a0,
123
+ ...a1,
124
+ ...a2
125
+ ], ORIGIN, true)));
126
+ return kernel.boundingBox(framed.wrapped);
127
+ } catch (_) {
128
+ _usingCtx$1.e = _;
129
+ } finally {
130
+ _usingCtx$1.d();
131
+ }
132
+ }
133
+ function assembleBox(axes, bounds) {
134
+ const extents = axes.map((axis, i) => ({
135
+ axis,
136
+ size: require_bug.wasmIndex(bounds.max, i) - require_bug.wasmIndex(bounds.min, i),
137
+ mid: (require_bug.wasmIndex(bounds.min, i) + require_bug.wasmIndex(bounds.max, i)) / 2
138
+ }));
139
+ const centerAlong = (c) => extents.reduce((sum, e) => sum + e.mid * require_bug.wasmIndex(e.axis, c), 0);
140
+ const sorted = [...extents].sort((p, q) => q.size - p.size);
141
+ const major = canonicalSign(require_bug.wasmIndex(sorted, 0).axis);
142
+ const middle = canonicalSign(require_bug.wasmIndex(sorted, 1).axis);
143
+ return {
144
+ center: [
145
+ centerAlong(0),
146
+ centerAlong(1),
147
+ centerAlong(2)
148
+ ],
149
+ axes: [
150
+ withoutNegativeZero(major),
151
+ withoutNegativeZero(middle),
152
+ withoutNegativeZero(require_vecOps.vecCross(major, middle))
153
+ ],
154
+ size: [
155
+ require_bug.wasmIndex(sorted, 0).size,
156
+ require_bug.wasmIndex(sorted, 1).size,
157
+ require_bug.wasmIndex(sorted, 2).size
158
+ ]
159
+ };
160
+ }
161
+ /**
162
+ * Measure a solid's bounding box on its principal axes of inertia.
163
+ *
164
+ * `getBounds` answers in world axes, so a board turned 30 degrees reports an
165
+ * inflated box with no frame. This box follows the part's own frame instead:
166
+ * it is the axis-aligned box in the frame of the principal axes of the volume
167
+ * inertia tensor about the center of mass.
168
+ *
169
+ * This is NOT a minimum-volume oriented bounding box. When principal moments
170
+ * coincide, the principal axes in that plane are not unique and the box can be
171
+ * larger than the tightest one: a 100 x 100 x 2 plate rotated 30 degrees about
172
+ * Z reports 136.6 x 136.6 x 2, because any in-plane pair of axes is principal
173
+ * for a square plate.
174
+ *
175
+ * @param shape - A solid, compsolid, or compound containing solids.
176
+ * @returns `Result` with the box center in world coordinates, orthonormal
177
+ * right-handed axes ordered by decreasing extent, and the full edge lengths
178
+ * along those axes. Fails with `NOT_A_SOLID` for any other shape type
179
+ * (face, wire, shell, ...), `ZERO_VOLUME` when the shape encloses no volume
180
+ * (e.g. a compound of faces), and an `UNSUPPORTED` error on kernels without
181
+ * an inertia query.
182
+ *
183
+ * @example
184
+ * ```ts
185
+ * const { size, axes, center } = unwrap(principalBoundingBox(board));
186
+ * // size: [length, width, thickness]; axes[2] is the board's normal
187
+ * ```
188
+ */
189
+ function principalBoundingBox(shape) {
190
+ const cached = require_measureFns.getCachedMeasurement(shape.wrapped, "principal");
191
+ if (cached) return require_errors.ok(cached);
192
+ const invalid = validatePrincipalBoxInput(shape);
193
+ if (invalid) return invalid;
194
+ const kernel = require_shapeTypes.getKernel();
195
+ const inertiaOf = kernel.inertia?.bind(kernel);
196
+ if (!inertiaOf) return require_errors.err(require_errors.unsupportedError(require_errors.BrepErrorCode.UNSUPPORTED_CAPABILITY, `principalBoundingBox: the ${kernel.kernelId} kernel has no inertia query`, void 0, { kernel: kernel.kernelId }, "Use the occt-wasm kernel, which provides the inertia query"));
197
+ const inertia = require_topologyQueryFns.kernelCallRaw(() => inertiaOf(shape.wrapped), require_errors.BrepErrorCode.PRINCIPAL_BOX_FAILED, "principalBoundingBox: failed to compute the matrix of inertia");
198
+ if (!inertia.ok) return inertia;
199
+ const axes = principalAxes(inertia.value);
200
+ const bounds = require_topologyQueryFns.kernelCallRaw(() => boundsInFrame(shape, axes), require_errors.BrepErrorCode.PRINCIPAL_BOX_FAILED, "principalBoundingBox: failed to measure bounds in the principal frame");
201
+ if (!bounds.ok) return bounds;
202
+ const result = assembleBox(axes, bounds.value);
203
+ require_measureFns.setCachedMeasurement(shape.wrapped, "principal", result);
204
+ return require_errors.ok(result);
205
+ }
206
+ //#endregion
207
+ Object.defineProperty(exports, "principalBoundingBox", {
208
+ enumerable: true,
209
+ get: function() {
210
+ return principalBoundingBox;
211
+ }
212
+ });