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
@@ -22,6 +22,7 @@ export declare const BrepErrorCode: {
22
22
  readonly SOLID_FROM_SHELL_FAILED: "SOLID_FROM_SHELL_FAILED";
23
23
  readonly FIX_SELF_INTERSECTION_FAILED: "FIX_SELF_INTERSECTION_FAILED";
24
24
  readonly MESH_FAILED: "MESH_FAILED";
25
+ readonly PRINCIPAL_BOX_FAILED: "PRINCIPAL_BOX_FAILED";
25
26
  readonly ELLIPSE_RADII: "ELLIPSE_RADII";
26
27
  readonly FUSE_ALL_EMPTY: "FUSE_ALL_EMPTY";
27
28
  readonly FILLET_NO_EDGES: "FILLET_NO_EDGES";
@@ -47,6 +48,9 @@ export declare const BrepErrorCode: {
47
48
  readonly DRAFT_INVALID_ANGLE: "DRAFT_INVALID_ANGLE";
48
49
  readonly DRAFT_NOT_3D: "DRAFT_NOT_3D";
49
50
  readonly DRAFT_FAILED: "DRAFT_FAILED";
51
+ readonly CSG_EXTENSION_UNKNOWN: "CSG_EXTENSION_UNKNOWN";
52
+ readonly NOT_A_SOLID: "NOT_A_SOLID";
53
+ readonly ZERO_VOLUME: "ZERO_VOLUME";
50
54
  readonly FUSE_NOT_3D: "FUSE_NOT_3D";
51
55
  readonly CUT_NOT_3D: "CUT_NOT_3D";
52
56
  readonly INTERSECT_NOT_3D: "INTERSECT_NOT_3D";
package/dist/core.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_shapeTypes = require("./shapeTypes-BWsKDxzf.cjs");
2
+ const require_shapeTypes = require("./shapeTypes-DH2ShBU_.cjs");
3
3
  const require_bug = require("./bug-O02CsAmt.cjs");
4
- const require_errors = require("./errors-DWezb9DI.cjs");
5
- const require_validityTypes = require("./validityTypes-4nhcQAdO.cjs");
4
+ const require_errors = require("./errors-jwhfQJZK.cjs");
5
+ const require_validityTypes = require("./validityTypes-r0A2YdNq.cjs");
6
6
  const require_constants = require("./constants-BOVyEYGH.cjs");
7
7
  const require_types = require("./types-KjA8tY4Y.cjs");
8
8
  const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
9
- const require_planeOps = require("./planeOps-CpupTCRM.cjs");
9
+ const require_planeOps = require("./planeOps-DJuclNxa.cjs");
10
10
  exports.BrepBugError = require_bug.BrepBugError;
11
11
  exports.DEG2RAD = require_constants.DEG2RAD;
12
12
  exports.DisposalScope = require_shapeTypes.DisposalScope;
package/dist/core.js CHANGED
@@ -1,9 +1,9 @@
1
- import { C as isSolid, D as getShapeKind, E as GeometryCleanupError, F as createKernelHandle, H as withScope, L as isLive, M as is3D, N as DisposalScope, P as createHandle, S as isShell, T as isWire, U as withScopeResult, W as withScopeResultAsync, _ as isCompound, b as isShape1D, i as castShape, j as is2D, v as isEdge, w as isVertex, x as isShape3D, y as isFace } from "./shapeTypes-DVpJHhgk.js";
1
+ import { C as isSolid, D as getShapeKind, E as GeometryCleanupError, F as createKernelHandle, H as withScope, L as isLive, M as is3D, N as DisposalScope, P as createHandle, S as isShell, T as isWire, U as withScopeResult, W as withScopeResultAsync, _ as isCompound, b as isShape1D, i as castShape, j as is2D, v as isEdge, w as isVertex, x as isShape3D, y as isFace } from "./shapeTypes-CqNJoSam.js";
2
2
  import { n as bug, t as BrepBugError } from "./bug-BdOHwn_e.js";
3
- import { E as ok, F as unwrapErr, I as unwrapOr, L as unwrapOrElse, M as tryCatch, N as tryCatchAsync, P as unwrap, S as map, T as match, _ as flatMap, a as moduleInitError, b as isErr, c as sketcherStateError, d as validationError, f as OK, g as err, h as collect, i as kernelError, l as typeCastError, m as andThen, n as computationError, o as queryError, r as ioError, u as unsupportedError, w as mapErr, x as isOk } from "./errors-CTn8i3lY.js";
4
- import { c as manifoldShell, f as validSolid, i as isOrientedFace, l as orientedFace, n as isClosedWire, r as isManifoldShell, s as isValidSolid, t as closedWire } from "./validityTypes-D6M4CiEI.js";
3
+ import { E as ok, F as unwrapErr, I as unwrapOr, L as unwrapOrElse, M as tryCatch, N as tryCatchAsync, P as unwrap, S as map, T as match, _ as flatMap, a as moduleInitError, b as isErr, c as sketcherStateError, d as validationError, f as OK, g as err, h as collect, i as kernelError, l as typeCastError, m as andThen, n as computationError, o as queryError, r as ioError, u as unsupportedError, w as mapErr, x as isOk } from "./errors-Zb3jBa0u.js";
4
+ import { c as manifoldShell, f as validSolid, i as isOrientedFace, l as orientedFace, n as isClosedWire, r as isManifoldShell, s as isValidSolid, t as closedWire } from "./validityTypes-t7JpS0Ki.js";
5
5
  import { n as HASH_CODE_MAX, r as RAD2DEG, t as DEG2RAD } from "./constants-ITRzCnCp.js";
6
6
  import { n as toVec2, r as toVec3, t as resolveDirection } from "./types-D24Y27N0.js";
7
7
  import { a as vecDot, c as vecLength, d as vecNormalize, f as vecProjectToPlane, g as vecSub, h as vecScale, i as vecDistance, l as vecLengthSq, m as vecRotate, n as vecAngle, o as vecEquals, p as vecRepr, r as vecCross, s as vecIsZero, t as vecAdd, u as vecNegate } from "./vecOps-SKPRvPH-.js";
8
- import { i as pivotPlane, n as createPlane, o as resolvePlane, s as translatePlane, t as createNamedPlane } from "./planeOps-CkpMeheg.js";
8
+ import { i as pivotPlane, n as createPlane, o as resolvePlane, s as translatePlane, t as createNamedPlane } from "./planeOps-Cxws4Tiu.js";
9
9
  export { BrepBugError, DEG2RAD, DisposalScope, GeometryCleanupError, HASH_CODE_MAX, OK, RAD2DEG, andThen, bug, castShape, closedWire, collect, computationError, createHandle, createKernelHandle, createNamedPlane, createPlane, err, flatMap, getShapeKind, ioError, is2D, is3D, isClosedWire, isCompound, isEdge, isErr, isFace, isLive, isManifoldShell, isOk, isOrientedFace, isShape1D, isShape3D, isShell, isSolid, isValidSolid, isVertex, isWire, kernelError, manifoldShell, map, mapErr, match, moduleInitError, ok, orientedFace, pivotPlane, queryError, resolveDirection, resolvePlane, sketcherStateError, toVec2, toVec3, translatePlane, tryCatch, tryCatchAsync, typeCastError, unsupportedError, unwrap, unwrapErr, unwrapOr, unwrapOrElse, validSolid, validationError, vecAdd, vecAngle, vecCross, vecDistance, vecDot, vecEquals, vecIsZero, vecLength, vecLengthSq, vecNegate, vecNormalize, vecProjectToPlane, vecRepr, vecRotate, vecScale, vecSub, withScope, withScopeResult, withScopeResultAsync };
@@ -1,6 +1,6 @@
1
1
  const require_constants = require("./constants-BOVyEYGH.cjs");
2
2
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
3
- const require_helpers = require("./helpers-DzuHzyWn.cjs");
3
+ const require_helpers = require("./helpers-NRZVshPb.cjs");
4
4
  //#region src/query/cornerFinder.ts
5
5
  var PI_2 = 2 * Math.PI;
6
6
  function positiveHalfAngle(angle) {
@@ -1,6 +1,6 @@
1
1
  import { t as DEG2RAD } from "./constants-ITRzCnCp.js";
2
2
  import { n as getAtOrThrow } from "./arrayAccess-DrUGPADn.js";
3
- import { p as distance2d, u as angle2d, v as samePoint } from "./helpers-Hna44lMW.js";
3
+ import { p as distance2d, u as angle2d, v as samePoint } from "./helpers-BN1mVMuZ.js";
4
4
  //#region src/query/cornerFinder.ts
5
5
  var PI_2 = 2 * Math.PI;
6
6
  function positiveHalfAngle(angle) {
@@ -3,7 +3,7 @@ import { Contour, Segment2D } from './segments.js';
3
3
  import { Matrix4x4 } from '../core/types.js';
4
4
  import { ColorInput } from '../topology/metadata/colorFns.js';
5
5
  import { EdgeRef, ShapeRef } from '../topology/shapeRef/shapeRefTypes.js';
6
- import { BoxNode, SphereNode, CylinderNode, ConeNode, TorusNode, PolygonNode, CircleNode, LineNode, VertexLitNode, EmptyNode, FuseNode, CutNode, IntersectNode, FuseAllNode, CutAllNode, TranslateNode, RotateNode, ScaleNode, MirrorNode, ExtrudeNode, RevolveNode, LoftNode, SweepNode, ProfileNode, PathNode, ColorNode, ShellNode, FilletNode, ChamferNode, CompoundNode, InstanceNode, IRNode, SolidNode, FaceNode, EdgeNode, VertexNode } from './types.js';
6
+ import { BoxNode, SphereNode, CylinderNode, ConeNode, TorusNode, PolygonNode, CircleNode, LineNode, VertexLitNode, EmptyNode, FuseNode, CutNode, IntersectNode, FuseAllNode, CutAllNode, TranslateNode, RotateNode, ScaleNode, MirrorNode, ExtrudeNode, RevolveNode, LoftNode, SweepNode, ProfileNode, PathNode, ColorNode, ShellNode, FilletNode, ChamferNode, CompoundNode, InstanceNode, ExtensionNode, IRNode, JsonValue, OutputKind, SolidNode, FaceNode, EdgeNode, VertexNode } from './types.js';
7
7
  export declare function box(x: ScalarInput, y: ScalarInput, z: ScalarInput): BoxNode;
8
8
  export declare function sphere(radius: ScalarInput): SphereNode;
9
9
  export declare function cylinder(radius: ScalarInput, height: ScalarInput): CylinderNode;
@@ -83,4 +83,16 @@ export interface RevolveOptions {
83
83
  export declare function revolve(profile: FaceNode, angle?: ScalarInput, options?: RevolveOptions): RevolveNode;
84
84
  export declare function compound(children: ReadonlyArray<IRNode>): CompoundNode;
85
85
  export declare function instance(source: IRNode, placements: ReadonlyArray<Matrix4x4>, fuse?: boolean): InstanceNode;
86
+ export interface ExtensionOptions {
87
+ readonly children?: ReadonlyArray<IRNode> | undefined;
88
+ readonly params?: Readonly<Record<string, ScalarInput>> | undefined;
89
+ /** Must be JSON-safe; defaults to `null`. */
90
+ readonly data?: JsonValue | undefined;
91
+ }
92
+ /** A caller-defined operation, materialized at evaluation by the
93
+ * `ExtensionEvaluator` registered under `name` in
94
+ * `EvaluatorOptions.extensions`. Unlike the other builders this one validates
95
+ * eagerly and throws a TypeError: a node whose data cannot be hashed
96
+ * canonically has no content address. */
97
+ export declare function extension(name: string, output: OutputKind, options?: ExtensionOptions): ExtensionNode;
86
98
  export type { FaceNode, EdgeNode, VertexNode, SolidNode };
@@ -2,7 +2,7 @@ import { Result } from '../core/result.js';
2
2
  import { AnyShape, Dimension } from '../core/shapeTypes.js';
3
3
  import { ShapeMesh, MeshOptions } from '../topology/meshFns.js';
4
4
  import { Env } from './expressions.js';
5
- import { IRNode } from './types.js';
5
+ import { IRNode, ExtensionEvaluator } from './types.js';
6
6
  export interface EvaluatorOptions {
7
7
  /** Kernel id to materialize against. Defaults to the currently-active kernel. */
8
8
  readonly kernel?: string | undefined;
@@ -30,6 +30,14 @@ export interface EvaluatorOptions {
30
30
  * positive integer.
31
31
  */
32
32
  readonly maxMeshCacheEntries?: number | undefined;
33
+ /**
34
+ * Evaluators for `Extension` nodes, keyed by node name. The registry is
35
+ * copied at construction (the cache key does not include it, so it must not
36
+ * change under a live cache). An Extension whose name is not registered
37
+ * evaluates to an Err with code `CSG_EXTENSION_UNKNOWN`. See
38
+ * {@link ExtensionEvaluator} for the ownership contract.
39
+ */
40
+ readonly extensions?: Readonly<Record<string, ExtensionEvaluator>> | undefined;
33
41
  }
34
42
  export interface StepInfo {
35
43
  readonly node: IRNode;
@@ -54,6 +62,7 @@ export declare class Evaluator implements Disposable {
54
62
  private readonly maxMeshCacheEntries;
55
63
  private readonly meshCache;
56
64
  private readonly onStep?;
65
+ private readonly extensions;
57
66
  private hits;
58
67
  private misses;
59
68
  private evictions;
@@ -1,9 +1,10 @@
1
1
  import { AnyShape, Dimension } from '../../core/shapeTypes.js';
2
2
  import { Result } from '../../core/result.js';
3
3
  import { Env } from '../expressions.js';
4
- import { IRNode } from '../types.js';
4
+ import { ExtensionEvaluator, IRNode } from '../types.js';
5
5
  export interface EvalContext {
6
6
  readonly env: Env;
7
7
  readonly tolerance: number | undefined;
8
8
  readonly evalNode: (node: IRNode) => Result<AnyShape<Dimension>>;
9
+ readonly extensions: ReadonlyMap<string, ExtensionEvaluator>;
9
10
  }
@@ -0,0 +1,5 @@
1
+ import { Result } from '../../core/result.js';
2
+ import { AnyShape, Dimension } from '../../core/shapeTypes.js';
3
+ import { ExtensionNode } from '../types.js';
4
+ import { EvalContext } from './context.js';
5
+ export declare function evalExtension(node: ExtensionNode, ctx: EvalContext): Result<AnyShape<Dimension>>;
@@ -5,5 +5,6 @@ export declare function fnvMixString(h: bigint, s: string): bigint;
5
5
  export declare function fnvMixNumber(h: bigint, n: number): bigint;
6
6
  export declare function fnvMixHash(h: bigint, child: bigint): bigint;
7
7
  export declare function fnvMixInt32(h: bigint, n: number): bigint;
8
+ export declare function fnvMixText(h: bigint, s: string): bigint;
8
9
  export declare function fnvMixBool(h: bigint, b: boolean): bigint;
9
10
  export declare function toHex(h: bigint): string;
@@ -5,9 +5,9 @@
5
5
  * parameterize via named expression bindings; evaluate against the active
6
6
  * kernel with subtree-level cache reuse for incremental parametric edits.
7
7
  */
8
- export { box, sphere, cylinder, cone, torus, polygon, circle, line, vertex, emptySolid, emptyFace, emptyWire, fuse, cut, intersect, fuseAll, cutAll, translate, rotate, scale, mirror, extrude, revolve, loft, sweep, profile, path, color, fillet, chamfer, shell, compound, instance, type RevolveOptions, type LoftOptions, type SweepNodeOptions, type RotateOptions, type ScaleOptions, type MirrorOptions, } from './builders.js';
8
+ export { box, sphere, cylinder, cone, torus, polygon, circle, line, vertex, emptySolid, emptyFace, emptyWire, fuse, cut, intersect, fuseAll, cutAll, translate, rotate, scale, mirror, extrude, revolve, loft, sweep, profile, path, color, fillet, chamfer, shell, compound, instance, extension, type ExtensionOptions, type RevolveOptions, type LoftOptions, type SweepNodeOptions, type RotateOptions, type ScaleOptions, type MirrorOptions, } from './builders.js';
9
9
  export { numLit, vec3Lit, vec2Lit, param, binOp, unaryOp, component, buildVec, add, mul, asScalarExpr, asVec3Expr, asVec2Expr, type Expr, type ExprValue, type Env, type ScalarInput, type Vec3Input, type Vec2Input, type BinaryOp, type UnaryOp, } from './expressions.js';
10
- export type { IRNode, NodeKind, OutputKind, PrimitiveNode, BooleanNode, TransformIRNode, ExtrudeNode, RevolveNode, LoftNode, SweepNode, ProfileNode, PathNode, ColorNode, FilletNode, ChamferNode, ShellNode, InstanceNode, SolidNode, FaceNode, EdgeNode, VertexNode, AnyNode, } from './types.js';
10
+ export type { IRNode, NodeKind, OutputKind, PrimitiveNode, BooleanNode, TransformIRNode, ExtrudeNode, RevolveNode, LoftNode, SweepNode, ProfileNode, PathNode, ColorNode, FilletNode, ChamferNode, ShellNode, InstanceNode, ExtensionNode, ExtensionEvaluator, ExtensionInput, JsonValue, SolidNode, FaceNode, EdgeNode, VertexNode, AnyNode, } from './types.js';
11
11
  export { outputKindOf } from './types.js';
12
12
  export { lineTo, arcTo, bezierTo, ellipseArcTo, contour, type Contour, type Segment2D, type SegmentOptions, type EllipseArcOptions, } from './segments.js';
13
13
  export { rectangularProfile, circularProfile, iBeamProfile, asymmetricIProfile, lShapeProfile, tShapeProfile, uShapeProfile, zShapeProfile, cShapeProfile, ellipseProfile, trapeziumProfile, rectangleHollowProfile, circleHollowProfile, arbitraryClosedProfile, arbitraryProfileWithVoids, type IBeamParams, type AsymmetricIParams, type LShapeParams, type TShapeParams, type UShapeParams, type ZShapeParams, type CShapeParams, type TrapeziumParams, type RectangleHollowParams, type CircleHollowParams, } from './profiles.js';
@@ -0,0 +1,8 @@
1
+ import { Result } from '../core/result.js';
2
+ import { JsonValue } from './types.js';
3
+ /** Validate `value` as JSON-safe and return its canonical frozen copy, or a
4
+ * message naming the first offending path (rooted at `path`). */
5
+ export declare function canonicalJson(value: unknown, path: string): Result<JsonValue, string>;
6
+ /** Type-tagged, length-prefixed Merkle mix of a JSON value; object keys are
7
+ * hashed in sorted order, so key order never changes the result. */
8
+ export declare function hashJson(h: bigint, v: JsonValue): bigint;
@@ -1,6 +1,6 @@
1
1
  import { Result } from '../core/result.js';
2
2
  import { IRNode } from './types.js';
3
- export declare const CSG_VERSION = 8;
3
+ export declare const CSG_VERSION = 9;
4
4
  export interface CsgEnvelope {
5
5
  readonly csgVersion: number;
6
6
  readonly defs?: readonly unknown[];
@@ -2,7 +2,10 @@ import { Expr } from './expressions.js';
2
2
  import { Contour, Segment2D } from './segments.js';
3
3
  import { EdgeRef, ShapeRef } from '../topology/shapeRef/shapeRefTypes.js';
4
4
  import { Matrix4x4 } from '../core/types.js';
5
+ import { AnyShape, Dimension } from '../core/shapeTypes.js';
6
+ import { Result } from '../core/result.js';
5
7
  export type OutputKind = 'Solid' | 'Face' | 'Wire' | 'Edge' | 'Vertex' | 'Compound';
8
+ export declare function isOutputKind(v: unknown): v is OutputKind;
6
9
  /** Output kinds that have a corresponding empty-shape builder + serializer. */
7
10
  export type EmptyOutputKind = 'Solid' | 'Face' | 'Wire';
8
11
  export interface IRNodeBase {
@@ -198,10 +201,56 @@ export interface InstanceNode extends IRNodeBase {
198
201
  /** Fuse the placed copies into one solid; otherwise a Compound. */
199
202
  readonly fuse: boolean;
200
203
  }
204
+ /** A value `JSON.stringify` / `JSON.parse` round-trips exactly. */
205
+ export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
206
+ readonly [key: string]: JsonValue;
207
+ };
208
+ /** An operation the IR has no built-in kind for, materialized by the
209
+ * {@link ExtensionEvaluator} registered under `name` in
210
+ * `EvaluatorOptions.extensions`. `optimize` treats it as opaque: its
211
+ * children and params are optimized, the node itself is never folded. */
212
+ export interface ExtensionNode extends IRNodeBase {
213
+ readonly kind: 'Extension';
214
+ readonly name: string;
215
+ /** Declared at build time for `outputKindOf`; evaluation does not check the
216
+ * materialized shape against it. */
217
+ readonly output: OutputKind;
218
+ readonly children: readonly IRNode[];
219
+ /** Scalar inputs, resolved to numbers against the env before the evaluator
220
+ * runs, so they take part in param invalidation. */
221
+ readonly params: Readonly<Record<string, Expr>>;
222
+ /** Frozen canonical copy of the builder input; neither key order nor `-0`
223
+ * changes the hash. */
224
+ readonly data: JsonValue;
225
+ }
226
+ export interface ExtensionInput {
227
+ readonly params: Readonly<Record<string, number>>;
228
+ readonly data: JsonValue;
229
+ /** The node's children, materialized in order. */
230
+ readonly children: readonly AnyShape<Dimension>[];
231
+ }
232
+ /**
233
+ * Materializes an {@link ExtensionNode}; registered by name through
234
+ * `EvaluatorOptions.extensions` and called under the Evaluator's kernel.
235
+ *
236
+ * The Evaluator caches the result by the node's content address, so it must
237
+ * depend only on `input`.
238
+ *
239
+ * Ownership: `children` are borrowed from the Evaluator's cache. Do not
240
+ * dispose them or keep them past the call (a bounded cache may evict them).
241
+ * Return either a fresh shape or one of `children` unchanged; the Evaluator
242
+ * owns and disposes the result, and reference-counts handles so a returned
243
+ * child is freed once. Never return a handle owned elsewhere, such as a
244
+ * borrowed sub-shape from `getFaces`.
245
+ *
246
+ * Return an `Err` for expected failures; a throw escapes `evaluate()` like a
247
+ * throw from any built-in evaluator.
248
+ */
249
+ export type ExtensionEvaluator = (input: ExtensionInput) => Result<AnyShape<Dimension>>;
201
250
  export type PrimitiveNode = BoxNode | SphereNode | CylinderNode | ConeNode | TorusNode | PolygonNode | CircleNode | LineNode | VertexLitNode | EmptyNode;
202
251
  export type BooleanNode = FuseNode | CutNode | IntersectNode | FuseAllNode | CutAllNode;
203
252
  export type TransformIRNode = TranslateNode | RotateNode | ScaleNode | MirrorNode;
204
- export type IRNode = PrimitiveNode | BooleanNode | TransformIRNode | ExtrudeNode | RevolveNode | LoftNode | SweepNode | ProfileNode | PathNode | ColorNode | FilletNode | ChamferNode | ShellNode | CompoundNode | InstanceNode;
253
+ export type IRNode = PrimitiveNode | BooleanNode | TransformIRNode | ExtrudeNode | RevolveNode | LoftNode | SweepNode | ProfileNode | PathNode | ColorNode | FilletNode | ChamferNode | ShellNode | CompoundNode | InstanceNode | ExtensionNode;
205
254
  export type NodeKind = IRNode['kind'];
206
255
  export type AnyNode = IRNode;
207
256
  /** Nodes that produce a 3D solid. */
@@ -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
  //#region src/topology/curveFns.ts
4
4
  /**
5
5
  * Curve and 1D shape functions — functional replacements for _1DShape/Curve methods.
@@ -1,5 +1,5 @@
1
- import { T as isWire, h as disposeResultShape, n as castResultShape, q as getKernel, v as isEdge } from "./shapeTypes-DVpJHhgk.js";
2
- import { E as ok, g as err, l as typeCastError } from "./errors-CTn8i3lY.js";
1
+ import { T as isWire, h as disposeResultShape, n as castResultShape, q as getKernel, v as isEdge } from "./shapeTypes-CqNJoSam.js";
2
+ import { E as ok, g as err, l as typeCastError } from "./errors-Zb3jBa0u.js";
3
3
  //#region src/topology/curveFns.ts
4
4
  /**
5
5
  * Curve and 1D shape functions — functional replacements for _1DShape/Curve methods.
@@ -1,22 +1,22 @@
1
- import { G as _usingCtx, N as DisposalScope, c as createEdge, l as createFace, p as createWire, q as getKernel } from "./shapeTypes-DVpJHhgk.js";
1
+ import { G as _usingCtx, N as DisposalScope, c as createEdge, l as createFace, p as createWire, q as getKernel } from "./shapeTypes-CqNJoSam.js";
2
2
  import { i as wasmIndex, n as bug } from "./bug-BdOHwn_e.js";
3
- import { P as unwrap, s as safeIndex } from "./errors-CTn8i3lY.js";
4
- import { s as getEdges } from "./topologyQueryFns-C8Dv3AdW.js";
3
+ import { P as unwrap, s as safeIndex } from "./errors-Zb3jBa0u.js";
4
+ import { s as getEdges } from "./topologyQueryFns-DnfjQgP7.js";
5
5
  import { t as DEG2RAD } from "./constants-ITRzCnCp.js";
6
6
  import { r as toVec3 } from "./types-D24Y27N0.js";
7
7
  import { d as vecNormalize, g as vecSub, h as vecScale, m as vecRotate, r as vecCross } from "./vecOps-SKPRvPH-.js";
8
- import { a as planeToWorld, o as resolvePlane } from "./planeOps-CkpMeheg.js";
9
- import { d as pointOnSurface, l as normalAt, m as uvBounds, r as faceCenter, u as outerWire, v as copyShape, y as downcast } from "./faceFns-DQ51W4Eg.js";
10
- import { h as offsetWire2D, i as curveIsClosed, l as curveStartPoint } from "./curveFns-Q-tL9uNq.js";
8
+ import { a as planeToWorld, o as resolvePlane } from "./planeOps-Cxws4Tiu.js";
9
+ import { d as pointOnSurface, l as normalAt, m as uvBounds, r as faceCenter, u as outerWire, v as copyShape, y as downcast } from "./faceFns-CTlJC5IY.js";
10
+ import { h as offsetWire2D, i as curveIsClosed, l as curveStartPoint } from "./curveFns-KS1BWGhF.js";
11
11
  import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
12
- import { c as makeBSplineApproximation, d as makeCircle, f as makeEllipse, m as makeHelix, r as makeFace, s as assembleWire } from "./surfaceBuilders-DW56oYUA.js";
13
- import { a as Blueprints, c as make2dOffset, i as CompoundBlueprint, l as intersectCurves, n as BaseSketcher2d, o as chamferCurves, s as filletCurves, u as Flatbush } from "./blueprintSketcher-BnVu9r7p.js";
14
- import { b as squareDistance2d, l as add2d, s as PRECISION_OFFSET, v as samePoint$1, x as subtract2d } from "./helpers-Hna44lMW.js";
15
- import { _ as approximateAsSvgCompatibleCurve, a as edgeToCurve, f as make2dInerpolatedBSplineCurve, i as curvesAsEdgesOnPlane, l as make2dCircle, p as make2dSegmentCurve, s as make2dArcFromCenter, t as Blueprint, u as make2dEllipse, v as Curve2D, x as BoundingBox2d, y as deserializeCurve2D } from "./blueprint-DQaebcah.js";
16
- import { t as cornerFinder } from "./cornerFinder-D589drKe.js";
17
- import { c as roundedRectangleBlueprint, n as fuse2D, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-Dp7Bjzvc.js";
18
- import { _ as wrapSketchDataArray, a as Sketch, g as wrapSketchData, i as Sketches, t as textBlueprints } from "./textBlueprints-BlTo-FeX.js";
19
- import { i as projectEdges, t as cameraFromPlane } from "./cameraFns-CcgzxZ-9.js";
12
+ import { c as makeBSplineApproximation, d as makeCircle, f as makeEllipse, m as makeHelix, r as makeFace, s as assembleWire } from "./surfaceBuilders-8nLk2PWk.js";
13
+ import { a as Blueprints, c as make2dOffset, i as CompoundBlueprint, l as intersectCurves, n as BaseSketcher2d, o as chamferCurves, s as filletCurves, u as Flatbush } from "./blueprintSketcher-FywUpRiV.js";
14
+ import { b as squareDistance2d, l as add2d, s as PRECISION_OFFSET, v as samePoint$1, x as subtract2d } from "./helpers-BN1mVMuZ.js";
15
+ import { _ as approximateAsSvgCompatibleCurve, a as edgeToCurve, f as make2dInerpolatedBSplineCurve, i as curvesAsEdgesOnPlane, l as make2dCircle, p as make2dSegmentCurve, s as make2dArcFromCenter, t as Blueprint, u as make2dEllipse, v as Curve2D, x as BoundingBox2d, y as deserializeCurve2D } from "./blueprint-rwJjYPzo.js";
16
+ import { t as cornerFinder } from "./cornerFinder-Dlae8IX5.js";
17
+ import { c as roundedRectangleBlueprint, n as fuse2D, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-D8igCYc9.js";
18
+ import { _ as wrapSketchDataArray, a as Sketch, g as wrapSketchData, i as Sketches, t as textBlueprints } from "./textBlueprints-3jLY3G3u.js";
19
+ import { i as projectEdges, t as cameraFromPlane } from "./cameraFns-Cs6v3bWQ.js";
20
20
  //#region src/2d/lib/stitching.ts
21
21
  /**
22
22
  * Group a flat list of curves into connected chains by matching endpoints.
@@ -1,22 +1,22 @@
1
- const require_shapeTypes = require("./shapeTypes-BWsKDxzf.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-DH2ShBU_.cjs");
2
2
  const require_bug = require("./bug-O02CsAmt.cjs");
3
- const require_errors = require("./errors-DWezb9DI.cjs");
4
- const require_topologyQueryFns = require("./topologyQueryFns-DbQBANFg.cjs");
3
+ const require_errors = require("./errors-jwhfQJZK.cjs");
4
+ const require_topologyQueryFns = require("./topologyQueryFns-q2bGyuEV.cjs");
5
5
  const require_constants = require("./constants-BOVyEYGH.cjs");
6
6
  const require_types = require("./types-KjA8tY4Y.cjs");
7
7
  const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
8
- const require_planeOps = require("./planeOps-CpupTCRM.cjs");
9
- const require_faceFns = require("./faceFns-iyZwpUFe.cjs");
10
- const require_curveFns = require("./curveFns-D-hc0_6t.cjs");
8
+ const require_planeOps = require("./planeOps-DJuclNxa.cjs");
9
+ const require_faceFns = require("./faceFns-CZeHWke7.cjs");
10
+ const require_curveFns = require("./curveFns-6-ULFrEB.cjs");
11
11
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
12
- const require_surfaceBuilders = require("./surfaceBuilders-BujH-WLG.cjs");
13
- const require_blueprintSketcher = require("./blueprintSketcher-DX8NeWqA.cjs");
14
- const require_helpers = require("./helpers-DzuHzyWn.cjs");
15
- const require_blueprint = require("./blueprint-cDEPhHO0.cjs");
16
- const require_cornerFinder = require("./cornerFinder-B-eLajMt.cjs");
17
- const require_boolean2D = require("./boolean2D-B0jPhKO1.cjs");
18
- const require_textBlueprints = require("./textBlueprints-BaRZlz2x.cjs");
19
- const require_cameraFns = require("./cameraFns-DUKz-5_d.cjs");
12
+ const require_surfaceBuilders = require("./surfaceBuilders-vYgSvgI6.cjs");
13
+ const require_blueprintSketcher = require("./blueprintSketcher-CzKbxeTk.cjs");
14
+ const require_helpers = require("./helpers-NRZVshPb.cjs");
15
+ const require_blueprint = require("./blueprint-Yyoiz-U1.cjs");
16
+ const require_cornerFinder = require("./cornerFinder-Cji_BK-R.cjs");
17
+ const require_boolean2D = require("./boolean2D-BzZ9iBSn.cjs");
18
+ const require_textBlueprints = require("./textBlueprints-BE9lHH5V.cjs");
19
+ const require_cameraFns = require("./cameraFns-RHCb1F1s.cjs");
20
20
  //#region src/2d/lib/stitching.ts
21
21
  /**
22
22
  * Group a flat list of curves into connected chains by matching endpoints.
@@ -190,6 +190,7 @@ var BrepErrorCode = {
190
190
  SOLID_FROM_SHELL_FAILED: "SOLID_FROM_SHELL_FAILED",
191
191
  FIX_SELF_INTERSECTION_FAILED: "FIX_SELF_INTERSECTION_FAILED",
192
192
  MESH_FAILED: "MESH_FAILED",
193
+ PRINCIPAL_BOX_FAILED: "PRINCIPAL_BOX_FAILED",
193
194
  ELLIPSE_RADII: "ELLIPSE_RADII",
194
195
  FUSE_ALL_EMPTY: "FUSE_ALL_EMPTY",
195
196
  FILLET_NO_EDGES: "FILLET_NO_EDGES",
@@ -215,6 +216,9 @@ var BrepErrorCode = {
215
216
  DRAFT_INVALID_ANGLE: "DRAFT_INVALID_ANGLE",
216
217
  DRAFT_NOT_3D: "DRAFT_NOT_3D",
217
218
  DRAFT_FAILED: "DRAFT_FAILED",
219
+ CSG_EXTENSION_UNKNOWN: "CSG_EXTENSION_UNKNOWN",
220
+ NOT_A_SOLID: "NOT_A_SOLID",
221
+ ZERO_VOLUME: "ZERO_VOLUME",
218
222
  FUSE_NOT_3D: "FUSE_NOT_3D",
219
223
  CUT_NOT_3D: "CUT_NOT_3D",
220
224
  INTERSECT_NOT_3D: "INTERSECT_NOT_3D",
@@ -190,6 +190,7 @@ var BrepErrorCode = {
190
190
  SOLID_FROM_SHELL_FAILED: "SOLID_FROM_SHELL_FAILED",
191
191
  FIX_SELF_INTERSECTION_FAILED: "FIX_SELF_INTERSECTION_FAILED",
192
192
  MESH_FAILED: "MESH_FAILED",
193
+ PRINCIPAL_BOX_FAILED: "PRINCIPAL_BOX_FAILED",
193
194
  ELLIPSE_RADII: "ELLIPSE_RADII",
194
195
  FUSE_ALL_EMPTY: "FUSE_ALL_EMPTY",
195
196
  FILLET_NO_EDGES: "FILLET_NO_EDGES",
@@ -215,6 +216,9 @@ var BrepErrorCode = {
215
216
  DRAFT_INVALID_ANGLE: "DRAFT_INVALID_ANGLE",
216
217
  DRAFT_NOT_3D: "DRAFT_NOT_3D",
217
218
  DRAFT_FAILED: "DRAFT_FAILED",
219
+ CSG_EXTENSION_UNKNOWN: "CSG_EXTENSION_UNKNOWN",
220
+ NOT_A_SOLID: "NOT_A_SOLID",
221
+ ZERO_VOLUME: "ZERO_VOLUME",
218
222
  FUSE_NOT_3D: "FUSE_NOT_3D",
219
223
  CUT_NOT_3D: "CUT_NOT_3D",
220
224
  INTERSECT_NOT_3D: "INTERSECT_NOT_3D",
@@ -1,6 +1,6 @@
1
- import { i as castShape, q as getKernel } from "./shapeTypes-DVpJHhgk.js";
2
- import { E as ok, P as unwrap, g as err, l as typeCastError } from "./errors-CTn8i3lY.js";
3
- import { a as getCachedSurfaceType } from "./topologyQueryFns-C8Dv3AdW.js";
1
+ import { i as castShape, q as getKernel } from "./shapeTypes-CqNJoSam.js";
2
+ import { E as ok, P as unwrap, g as err, l as typeCastError } from "./errors-Zb3jBa0u.js";
3
+ import { a as getCachedSurfaceType } from "./topologyQueryFns-DnfjQgP7.js";
4
4
  import { r as toVec3 } from "./types-D24Y27N0.js";
5
5
  //#region src/topology/cast.ts
6
6
  var TOPO_ENUM = {
@@ -1,6 +1,6 @@
1
- const require_shapeTypes = require("./shapeTypes-BWsKDxzf.cjs");
2
- const require_errors = require("./errors-DWezb9DI.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-DbQBANFg.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
4
  const require_types = require("./types-KjA8tY4Y.cjs");
5
5
  //#region src/topology/cast.ts
6
6
  var TOPO_ENUM = {
@@ -1,9 +1,9 @@
1
- import { C as isSolid, D as getShapeKind, T as isWire, h as disposeResultShape, i as castShape, m as disposeDowncastSource, n as castResultShape, q as getKernel, x as isShape3D, y as isFace } 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, x as isOk } from "./errors-CTn8i3lY.js";
3
- import { c as getFaces, i as getCachedIsValid, m as invalidateShapeCache, p as getWires, s as getEdges } from "./topologyQueryFns-C8Dv3AdW.js";
1
+ import { C as isSolid, D as getShapeKind, T as isWire, h as disposeResultShape, i as castShape, m as disposeDowncastSource, n as castResultShape, q as getKernel, x as isShape3D, y as isFace } 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, x as isOk } from "./errors-Zb3jBa0u.js";
3
+ import { c as getFaces, i as getCachedIsValid, m as invalidateShapeCache, p as getWires, s as getEdges } from "./topologyQueryFns-DnfjQgP7.js";
4
4
  import { n as HASH_CODE_MAX } from "./constants-ITRzCnCp.js";
5
- import { y as downcast } from "./faceFns-DQ51W4Eg.js";
6
- import { C as propagateAllMetadata, f as cut, h as fuseAll, m as fuse, p as cutAll, x as collectInputFaceHashes } from "./solidBuilders-BmUEjbhs.js";
5
+ import { y as downcast } from "./faceFns-CTlJC5IY.js";
6
+ import { C as propagateAllMetadata, f as cut, h as fuseAll, m as fuse, p as cutAll, x as collectInputFaceHashes } from "./solidBuilders-BwOF7M-p.js";
7
7
  import { t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
8
8
  //#region src/topology/threeHelpers.ts
9
9
  /**
@@ -1,9 +1,9 @@
1
- const require_shapeTypes = require("./shapeTypes-BWsKDxzf.cjs");
2
- const require_errors = require("./errors-DWezb9DI.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-DbQBANFg.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
4
  const require_constants = require("./constants-BOVyEYGH.cjs");
5
- const require_faceFns = require("./faceFns-iyZwpUFe.cjs");
6
- const require_solidBuilders = require("./solidBuilders-CZdfdC4S.cjs");
5
+ const require_faceFns = require("./faceFns-CZeHWke7.cjs");
6
+ const require_solidBuilders = require("./solidBuilders-6eLtWBLM.cjs");
7
7
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
8
8
  //#region src/topology/threeHelpers.ts
9
9
  /**
@@ -1,12 +1,12 @@
1
- import { q as getKernel, y as isFace } from "./shapeTypes-DVpJHhgk.js";
2
- import { E as ok, g as err, o as queryError, x as isOk } from "./errors-CTn8i3lY.js";
3
- import { c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-C8Dv3AdW.js";
1
+ import { q as getKernel, y as isFace } from "./shapeTypes-CqNJoSam.js";
2
+ import { E as ok, g as err, o as queryError, x as isOk } from "./errors-Zb3jBa0u.js";
3
+ import { c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-DnfjQgP7.js";
4
4
  import { t as DEG2RAD } from "./constants-ITRzCnCp.js";
5
5
  import { a as vecDot, d as vecNormalize } from "./vecOps-SKPRvPH-.js";
6
- import { l as normalAt, s as getSurfaceType } from "./faceFns-DQ51W4Eg.js";
7
- import { a as isSameShape, n as getHashCode } from "./shapeFns-sbLSffyZ.js";
8
- import { f as getCurveType, i as curveIsClosed, o as curveLength } from "./curveFns-Q-tL9uNq.js";
9
- import { n as measureArea } from "./measureFns-DnZsoSsE.js";
6
+ import { l as normalAt, s as getSurfaceType } from "./faceFns-CTlJC5IY.js";
7
+ import { a as isSameShape, n as getHashCode } from "./shapeFns--1wNlcc_.js";
8
+ import { f as getCurveType, i as curveIsClosed, o as curveLength } from "./curveFns-KS1BWGhF.js";
9
+ import { n as measureArea } from "./measureFns-CyDVZomf.js";
10
10
  //#region src/utils/vec2d.ts
11
11
  /** Precision for curve intersection and parameter operations. */
12
12
  var PRECISION_INTERSECTION = 1e-9;
@@ -1,12 +1,12 @@
1
- const require_shapeTypes = require("./shapeTypes-BWsKDxzf.cjs");
2
- const require_errors = require("./errors-DWezb9DI.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-DbQBANFg.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
4
  const require_constants = require("./constants-BOVyEYGH.cjs");
5
5
  const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
6
- const require_faceFns = require("./faceFns-iyZwpUFe.cjs");
7
- const require_shapeFns = require("./shapeFns-SdMLvQ7n.cjs");
8
- const require_curveFns = require("./curveFns-D-hc0_6t.cjs");
9
- const require_measureFns = require("./measureFns-Czv8iOd1.cjs");
6
+ const require_faceFns = require("./faceFns-CZeHWke7.cjs");
7
+ const require_shapeFns = require("./shapeFns-C2j6oZ2u.cjs");
8
+ const require_curveFns = require("./curveFns-6-ULFrEB.cjs");
9
+ const require_measureFns = require("./measureFns-D_GpQw5z.cjs");
10
10
  //#region src/utils/vec2d.ts
11
11
  /** Precision for curve intersection and parameter operations. */
12
12
  var PRECISION_INTERSECTION = 1e-9;
@@ -1,8 +1,8 @@
1
- import { n as castResultShape, q as getKernel } from "./shapeTypes-DVpJHhgk.js";
1
+ import { n as castResultShape, q as getKernel } from "./shapeTypes-CqNJoSam.js";
2
2
  import { i as wasmIndex, r as vec3At$1 } from "./bug-BdOHwn_e.js";
3
- import { E as ok, g as err, r as ioError, t as BrepErrorCode } from "./errors-CTn8i3lY.js";
3
+ import { E as ok, g as err, r as ioError, t as BrepErrorCode } from "./errors-Zb3jBa0u.js";
4
4
  import { n as getAtOrThrow } from "./arrayAccess-DrUGPADn.js";
5
- import { c as make2dBezierCurve, h as make2dThreePointArc, p as make2dSegmentCurve, t as Blueprint } from "./blueprint-DQaebcah.js";
5
+ import { c as make2dBezierCurve, h as make2dThreePointArc, p as make2dSegmentCurve, t as Blueprint } from "./blueprint-rwJjYPzo.js";
6
6
  //#region src/io/objExportFns.ts
7
7
  /** Read a vec3 from a typed array at the given vertex index. */
8
8
  function vec3At(arr, i) {
@@ -1,8 +1,8 @@
1
- const require_shapeTypes = require("./shapeTypes-BWsKDxzf.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-DH2ShBU_.cjs");
2
2
  const require_bug = require("./bug-O02CsAmt.cjs");
3
- const require_errors = require("./errors-DWezb9DI.cjs");
3
+ const require_errors = require("./errors-jwhfQJZK.cjs");
4
4
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
5
- const require_blueprint = require("./blueprint-cDEPhHO0.cjs");
5
+ const require_blueprint = require("./blueprint-Yyoiz-U1.cjs");
6
6
  //#region src/io/objExportFns.ts
7
7
  /** Read a vec3 from a typed array at the given vertex index. */
8
8
  function vec3At(arr, i) {
package/dist/index.d.ts CHANGED
@@ -131,6 +131,7 @@ export { exportURDF, importURDF, type UrdfExportOptions, type UrdfDocument, } fr
131
131
  export { createHistory, addStep, undoLast, findStep, getShape as getHistoryShape, stepCount, stepsFrom, registerShape, createRegistry, registerOperation, replayHistory, replayFrom, modifyStep, serializeHistory, deserializeHistory, type OperationStep, type ModelHistory, type SerializedHistory, type OperationFn, type OperationRegistry as HistoryOperationRegistry, } from './operations/historyFns.js';
132
132
  export { measureVolume, measureArea, measureLength, measureDistance, measureDistanceProps, createDistanceQuery, measureVolumeProps, measureSurfaceProps, measureLinearProps, type PhysicalProps, type VolumeProps, type SurfaceProps, type LinearProps, type DistanceProps, measureCurvatureAt, measureCurvatureAtMid, type CurvatureResult, } from './measurement/measureFns.js';
133
133
  export { checkInterference, checkAllInterferences, type InterferenceResult, type InterferencePair, } from './measurement/interferenceFns.js';
134
+ export { principalBoundingBox, type PrincipalBoundingBox } from './measurement/principalBoxFns.js';
134
135
  export { importSTEP, importSTL, importIGES } from './io/importFns.js';
135
136
  export { importDXF } from './io/dxfImportFns.js';
136
137
  export { importOBJ } from './io/objImportFns.js';
package/dist/io.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_meshFns = require("./meshFns-82W7072d.cjs");
3
- const require_importFns = require("./importFns-BygnKmG8.cjs");
2
+ const require_meshFns = require("./meshFns-CAxkaRTm.cjs");
3
+ const require_importFns = require("./importFns-BEi-HsSw.cjs");
4
4
  exports.blueprintToDXF = require_importFns.blueprintToDXF;
5
5
  exports.exportDXF = require_importFns.exportDXF;
6
6
  exports.exportGlb = require_importFns.exportGlb;
package/dist/io.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-DegHraku.js";
2
- import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-CzX0LzER.js";
1
+ import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-COlno8TY.js";
2
+ import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-0kHGg-b8.js";
3
3
  export { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD };
@@ -1,4 +1,16 @@
1
1
  import { DistanceResult, KernelShape } from '../types.js';
2
+ /** A 3x3 matrix as nine row-major entries. */
3
+ export type Matrix3 = readonly [
4
+ number,
5
+ number,
6
+ number,
7
+ number,
8
+ number,
9
+ number,
10
+ number,
11
+ number,
12
+ number
13
+ ];
2
14
  /** All scalar measurements for a shape, computed in bulk. */
3
15
  export interface BulkMeasurement {
4
16
  volume: number;
@@ -20,6 +32,13 @@ export interface KernelMeasureOps {
20
32
  min: [number, number, number];
21
33
  max: [number, number, number];
22
34
  };
35
+ /**
36
+ * Volume matrix of inertia about the center of mass (unit density), in axes
37
+ * parallel to world X/Y/Z. Products of inertia carry the tensor's negative
38
+ * sign, so the matrix is symmetric with `[1]==[3]`, `[2]==[6]`, `[5]==[7]`.
39
+ * Optional: kernels without it cannot answer principal-axes queries.
40
+ */
41
+ inertia?(shape: KernelShape): Matrix3;
23
42
  /** Minimum distance between two shapes with witness points. */
24
43
  distance(shape1: KernelShape, shape2: KernelShape): DistanceResult;
25
44
  /** Compute surface curvature at a UV point on a face. */
@@ -1,11 +1,12 @@
1
1
  import { DistanceResult, KernelShape } from '../types.js';
2
- import { BulkMeasurement } from '../interfaces/measureOps.js';
2
+ import { BulkMeasurement, Matrix3 } from '../interfaces/measureOps.js';
3
3
  import { OcctKernelWasm, OcctWasmModule } from './occtWasmTypes.js';
4
4
  export declare function volume(k: OcctKernelWasm, shape: KernelShape): number;
5
5
  export declare function area(k: OcctKernelWasm, shape: KernelShape): number;
6
6
  export declare function length(k: OcctKernelWasm, shape: KernelShape): number;
7
7
  export declare function centerOfMass(k: OcctKernelWasm, shape: KernelShape): [number, number, number];
8
8
  export declare function linearCenterOfMass(k: OcctKernelWasm, shape: KernelShape): [number, number, number];
9
+ export declare function inertia(k: OcctKernelWasm, shape: KernelShape): Matrix3;
9
10
  export declare function boundingBox(k: OcctKernelWasm, shape: KernelShape): {
10
11
  min: [number, number, number];
11
12
  max: [number, number, number];