brepjs 18.119.2 → 18.119.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/2d/blueprints/blueprints.d.ts +3 -0
  2. package/dist/2d/blueprints/compoundBlueprint.d.ts +3 -0
  3. package/dist/2d/blueprints/lib.d.ts +6 -0
  4. package/dist/2d/lib/curve2D.d.ts +6 -1
  5. package/dist/2d/lib/curve2dFns.d.ts +6 -1
  6. package/dist/2d.cjs +7 -7
  7. package/dist/2d.js +7 -7
  8. package/dist/{adjacencyFns-BdM5p58J.js → adjacencyFns-DLityMyV.js} +2 -2
  9. package/dist/{adjacencyFns-Brrc7jlS.cjs → adjacencyFns-DSxuQYnb.cjs} +2 -2
  10. package/dist/{blueprint-DJJo8WkI.js → blueprint-DEMSX-hc.js} +37 -10
  11. package/dist/{blueprint-DTNT4qYJ.cjs → blueprint-DUnNPwQL.cjs} +43 -10
  12. package/dist/{blueprintFns-CcpboZ80.js → blueprintFns-DSj4RTjU.js} +9 -4
  13. package/dist/{blueprintFns-2XDZfCxX.cjs → blueprintFns-Dg8V99O9.cjs} +9 -4
  14. package/dist/{blueprintSketcher-DDPyypmC.js → blueprintSketcher-gMuUUPb-.js} +185 -54
  15. package/dist/{blueprintSketcher-C0EXFVb2.cjs → blueprintSketcher-gXVPrPlj.cjs} +192 -61
  16. package/dist/{boolean2D-Ddfo_dd0.cjs → boolean2D-BpmxQ1AH.cjs} +5 -5
  17. package/dist/{boolean2D-C_PVz8xT.js → boolean2D-DKT0BgZs.js} +5 -5
  18. package/dist/brepjs.cjs +105 -92
  19. package/dist/brepjs.js +39 -27
  20. package/dist/{cameraFns-Czr5vABD.cjs → cameraFns-2-haLzLi.cjs} +4 -4
  21. package/dist/{cameraFns-D9tdBYLM.js → cameraFns-CG_J66Hl.js} +4 -4
  22. package/dist/core.cjs +12 -11
  23. package/dist/core.js +4 -3
  24. package/dist/{cornerFinder-Cqg-Dz74.js → cornerFinder-CPFM7bA0.js} +1 -1
  25. package/dist/{cornerFinder-DETRDOMz.cjs → cornerFinder-mfsUMi5g.cjs} +1 -1
  26. package/dist/{curveFns-RENXKp64.js → curveFns-DX13KRh2.js} +2 -2
  27. package/dist/{curveFns-D7utcbnf.cjs → curveFns-GmFnqNo3.cjs} +2 -2
  28. package/dist/{drawFns-D9Rf4foW.cjs → drawFns-CI6CpqO8.cjs} +35 -16
  29. package/dist/{drawFns-B9HbtAoc.js → drawFns-CrfBz_wj.js} +35 -16
  30. package/dist/{errors-B3CDG537.js → errors-MHLiNE-C.js} +1 -92
  31. package/dist/{errors-CJU8CHng.cjs → errors-RHkKO5bZ.cjs} +0 -103
  32. package/dist/{faceFns-CPswi9Cm.cjs → faceFns-BK4r7Dxk.cjs} +3 -3
  33. package/dist/{faceFns-CB6uzvOg.js → faceFns-DJj9Nb6T.js} +3 -3
  34. package/dist/{healingFns-BFTYLiAm.js → healingFns-DxcRyVCG.js} +5 -6
  35. package/dist/{healingFns-bhMxTTqw.cjs → healingFns-Hx4oTlq8.cjs} +27 -28
  36. package/dist/{helpers-Cu4ag5bh.cjs → helpers-BfkBvokP.cjs} +8 -24
  37. package/dist/{helpers-BiN4qQZP.js → helpers-Du_OdHuy.js} +9 -25
  38. package/dist/{importFns-X8vBhZI2.js → importFns-DqxAZFb-.js} +3 -3
  39. package/dist/{importFns-DS4J1xLv.cjs → importFns-pr-r5qiV.cjs} +3 -3
  40. package/dist/io.cjs +2 -2
  41. package/dist/io.js +2 -2
  42. package/dist/{loftFns-ChHjzUK-.cjs → loftFns-BdpZ8FMN.cjs} +2 -125
  43. package/dist/{loftFns-BF5X7ltI.js → loftFns-BeGJ6dxx.js} +4 -109
  44. package/dist/{measureFns-B5Zzg1qM.cjs → measureFns-CJGrmhHT.cjs} +4 -4
  45. package/dist/{measureFns-CC7HhAH3.js → measureFns-CMnbcUZC.js} +4 -4
  46. package/dist/measurement.cjs +1 -1
  47. package/dist/measurement.js +1 -1
  48. package/dist/{meshFns-D57Fyqyf.js → meshFns-Cs5EBsf7.js} +4 -4
  49. package/dist/{meshFns-CaXmWmhe.cjs → meshFns-Dqf5QBhQ.cjs} +5 -5
  50. package/dist/operations.cjs +2 -2
  51. package/dist/operations.js +2 -2
  52. package/dist/originTrackingFns-DZmdiQ-O.js +203 -0
  53. package/dist/originTrackingFns-fpEgTIwV.cjs +226 -0
  54. package/dist/{planeOps-Cp6GQ23-.js → planeOps-CQahLrCx.js} +1 -1
  55. package/dist/{planeOps-Cr25KWWA.cjs → planeOps-VlFxtvzY.cjs} +1 -1
  56. package/dist/primitiveFns-B_rflH83.cjs +773 -0
  57. package/dist/primitiveFns-Cxo3xDKY.js +558 -0
  58. package/dist/projection.cjs +1 -1
  59. package/dist/projection.js +1 -1
  60. package/dist/query.cjs +2 -2
  61. package/dist/query.js +2 -2
  62. package/dist/{refResolveFns-3bw9-U-e.js → refResolveFns-BbRLD8LA.js} +6 -6
  63. package/dist/{refResolveFns-BxmgIhQM.cjs → refResolveFns-CVDLwh12.cjs} +6 -6
  64. package/dist/result.cjs +1 -1
  65. package/dist/result.js +1 -1
  66. package/dist/rolldown-runtime-DakpK96I.cjs +43 -0
  67. package/dist/shapeFns-BTFx-os7.js +43 -0
  68. package/dist/shapeFns-D_5TgiUi.cjs +84 -0
  69. package/dist/shapeRef.cjs +1 -1
  70. package/dist/shapeRef.js +1 -1
  71. package/dist/{shapeTypes-Bpsu5KJO.cjs → shapeTypes-CkcIL7zv.cjs} +1 -222
  72. package/dist/{shapeTypes-CnKFSfDT.js → shapeTypes-t49f64Dx.js} +2 -139
  73. package/dist/sketching/drawing.d.ts +9 -1
  74. package/dist/sketching.cjs +3 -3
  75. package/dist/sketching.js +3 -3
  76. package/dist/{solidBuilders-I8_V8qqU.js → solidBuilders-DTgqQC3W.js} +310 -8
  77. package/dist/{solidBuilders-Bp7lQW62.cjs → solidBuilders-IiIzjKAr.cjs} +401 -15
  78. package/dist/{surfaceBuilders-D8_08oOR.cjs → surfaceBuilders-Biqx51el.cjs} +6 -5
  79. package/dist/{surfaceBuilders-BNR7yMQO.js → surfaceBuilders-BryY-i0F.js} +4 -3
  80. package/dist/text.cjs +2 -2
  81. package/dist/text.js +2 -2
  82. package/dist/{textBlueprints-B5zcLGvJ.cjs → textBlueprints-BY0FEg59.cjs} +138 -51
  83. package/dist/{textBlueprints-igbNvKcd.js → textBlueprints-ZzYg3XTS.js} +116 -11
  84. package/dist/{textMetrics-CJvtpbc3.js → textMetrics-Diakbtem.js} +2 -2
  85. package/dist/{textMetrics-08fF0QNf.cjs → textMetrics-f5yXR4OG.cjs} +2 -2
  86. package/dist/{threadFns-CqSMNyTZ.js → threadFns-BOtXTHZ9.js} +8 -8
  87. package/dist/{threadFns-Co6vWEWx.cjs → threadFns-DRrk9Qod.cjs} +8 -8
  88. package/dist/topology.cjs +9 -9
  89. package/dist/topology.js +9 -9
  90. package/dist/{topologyQueryFns-C3fhJndG.cjs → topologyQueryFns-Bia7o8l_.cjs} +97 -6
  91. package/dist/{topologyQueryFns-DNqT88yx.js → topologyQueryFns-BkQ6Q7gN.js} +93 -2
  92. package/dist/validityTypes-DiTgeCD9.js +129 -0
  93. package/dist/validityTypes-ZGMVlv7b.cjs +200 -0
  94. package/dist/vectors.cjs +1 -1
  95. package/dist/vectors.js +1 -1
  96. package/package.json +8 -8
  97. package/dist/primitiveFns-CRy_CUVg.cjs +0 -492
  98. package/dist/primitiveFns-DCIH-SBm.js +0 -331
  99. package/dist/shapeFns-BrHFNLMA.js +0 -771
  100. package/dist/shapeFns-qm9VRo4i.cjs +0 -962
@@ -23,6 +23,9 @@ export default class Blueprints implements DrawingInterface {
23
23
  protected _boundingBox: BoundingBox2d | null;
24
24
  /** Create a collection from an array of blueprints and/or compound blueprints. */
25
25
  constructor(blueprints: Array<Blueprint | CompoundBlueprint>);
26
+ /** Release the resources held by every child blueprint and the cached bounding box. */
27
+ delete(): void;
28
+ [Symbol.dispose](): void;
26
29
  /** Return a multi-line debug representation of every child blueprint. */
27
30
  get repr(): string;
28
31
  /** Return a deep copy of this collection and all its children. */
@@ -32,6 +32,9 @@ export default class CompoundBlueprint implements DrawingInterface {
32
32
  * @throws BrepBugError if the array is empty (use {@link createCompoundBlueprint} for Result-based validation).
33
33
  */
34
34
  constructor(blueprints: Blueprint[]);
35
+ /** Release the resources held by every child blueprint and the cached bounding box. */
36
+ delete(): void;
37
+ [Symbol.dispose](): void;
35
38
  /** Return a deep copy of this compound blueprint and all its children. */
36
39
  clone(): CompoundBlueprint;
37
40
  /** Compute (and cache) the combined bounding box of all child blueprints. */
@@ -23,6 +23,12 @@ export interface SketchData {
23
23
  }
24
24
  export interface DrawingInterface {
25
25
  clone(): DrawingInterface;
26
+ /**
27
+ * Release the resources held by this drawing, cascading to child blueprints
28
+ * and their curves. The `boundingBox` handed out earlier dies with it.
29
+ */
30
+ delete(): void;
31
+ [Symbol.dispose](): void;
26
32
  boundingBox: BoundingBox2d;
27
33
  stretch(ratio: number, direction: Point2D, origin: Point2D): DrawingInterface;
28
34
  rotate(angle: number, center: Point2D): DrawingInterface;
@@ -27,7 +27,12 @@ export declare class Curve2D {
27
27
  get wrapped(): KernelType;
28
28
  delete(): void;
29
29
  [Symbol.dispose](): void;
30
- /** Compute (and cache) the 2D bounding box of this curve. */
30
+ /**
31
+ * Compute (and cache) the 2D bounding box of this curve.
32
+ *
33
+ * @remarks The returned box is owned by the curve and is disposed when the
34
+ * curve is deleted. Clone it if it must outlive the curve.
35
+ */
31
36
  get boundingBox(): BoundingBox2d;
32
37
  /** Return a human-readable representation, e.g. `LINE (0,0) - (1,1)`. */
33
38
  get repr(): string;
@@ -8,7 +8,12 @@ import { Result } from '../../core/result.js';
8
8
  * @returns A new `Curve2D` with swapped start/end orientation.
9
9
  */
10
10
  export declare function reverseCurve(curve: Curve2D): Curve2D;
11
- /** Get the bounding box of a 2D curve. */
11
+ /**
12
+ * Get the bounding box of a 2D curve.
13
+ *
14
+ * @remarks The box is borrowed from the curve's cache and is disposed with the
15
+ * curve. Clone it if it must outlive the curve.
16
+ */
12
17
  export declare function curve2dBoundingBox(curve: Curve2D): BoundingBox2d;
13
18
  /** Get the first point of a 2D curve. */
14
19
  export declare function curve2dFirstPoint(curve: Curve2D): Point2D;
package/dist/2d.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_shapeTypes = require("./shapeTypes-Bpsu5KJO.cjs");
3
- const require_errors = require("./errors-CJU8CHng.cjs");
4
- const require_topologyQueryFns = require("./topologyQueryFns-C3fhJndG.cjs");
5
- const require_blueprintSketcher = require("./blueprintSketcher-C0EXFVb2.cjs");
6
- const require_blueprint = require("./blueprint-DTNT4qYJ.cjs");
7
- const require_boolean2D = require("./boolean2D-Ddfo_dd0.cjs");
8
- const require_blueprintFns = require("./blueprintFns-2XDZfCxX.cjs");
2
+ const require_shapeTypes = require("./shapeTypes-CkcIL7zv.cjs");
3
+ const require_errors = require("./errors-RHkKO5bZ.cjs");
4
+ const require_topologyQueryFns = require("./topologyQueryFns-Bia7o8l_.cjs");
5
+ const require_blueprintSketcher = require("./blueprintSketcher-gXVPrPlj.cjs");
6
+ const require_blueprint = require("./blueprint-DUnNPwQL.cjs");
7
+ const require_boolean2D = require("./boolean2D-BpmxQ1AH.cjs");
8
+ const require_blueprintFns = require("./blueprintFns-Dg8V99O9.cjs");
9
9
  //#region src/core/curve2dHandle.ts
10
10
  /**
11
11
  * Wrap a raw kernel 2D curve handle with brand + disposal tracking.
package/dist/2d.js CHANGED
@@ -1,10 +1,10 @@
1
- import { K as createKernelHandle, at as getKernel2D, c as createEdge } from "./shapeTypes-CnKFSfDT.js";
2
- import { O as ok, d as validationError, t as BrepErrorCode, v as err } from "./errors-B3CDG537.js";
3
- import { T as kernelCallRaw } from "./topologyQueryFns-DNqT88yx.js";
4
- import { a as Blueprints, i as CompoundBlueprint, r as organiseBlueprints } from "./blueprintSketcher-DDPyypmC.js";
5
- import { _ as Curve2D, t as Blueprint, y as BoundingBox2d } from "./blueprint-DJJo8WkI.js";
6
- import { a as fuseBlueprints, c as roundedRectangleBlueprint, i as cutBlueprints, n as fuse2D, o as intersectBlueprints, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-C_PVz8xT.js";
7
- import { S as reverseCurve, _ as curve2dIsOnCurve, a as isInside2D, b as curve2dSplitAt, c as scale2D, d as stretch2D, f as toSVGPathD, g as curve2dFirstPoint, h as curve2dDistanceFrom, i as getOrientation2D, l as sketchOnFace2D, m as curve2dBoundingBox, o as mirror2D, p as translate2D, r as getBounds2D, s as rotate2D, t as createBlueprint, u as sketchOnPlane2D, v as curve2dLastPoint, x as curve2dTangentAt, y as curve2dParameter } from "./blueprintFns-CcpboZ80.js";
1
+ import { P as createKernelHandle, c as createEdge, q as getKernel2D } from "./shapeTypes-t49f64Dx.js";
2
+ import { E as ok, d as validationError, g as err, t as BrepErrorCode } from "./errors-MHLiNE-C.js";
3
+ import { T as kernelCallRaw } from "./topologyQueryFns-BkQ6Q7gN.js";
4
+ import { a as Blueprints, i as CompoundBlueprint, r as organiseBlueprints } from "./blueprintSketcher-gMuUUPb-.js";
5
+ import { _ as Curve2D, b as BoundingBox2d, t as Blueprint } from "./blueprint-DEMSX-hc.js";
6
+ import { a as fuseBlueprints, c as roundedRectangleBlueprint, i as cutBlueprints, n as fuse2D, o as intersectBlueprints, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-DKT0BgZs.js";
7
+ import { S as reverseCurve, _ as curve2dIsOnCurve, a as isInside2D, b as curve2dSplitAt, c as scale2D, d as stretch2D, f as toSVGPathD, g as curve2dFirstPoint, h as curve2dDistanceFrom, i as getOrientation2D, l as sketchOnFace2D, m as curve2dBoundingBox, o as mirror2D, p as translate2D, r as getBounds2D, s as rotate2D, t as createBlueprint, u as sketchOnPlane2D, v as curve2dLastPoint, x as curve2dTangentAt, y as curve2dParameter } from "./blueprintFns-DSj4RTjU.js";
8
8
  //#region src/core/curve2dHandle.ts
9
9
  /**
10
10
  * Wrap a raw kernel 2D curve handle with brand + disposal tracking.
@@ -1,6 +1,6 @@
1
- import { it as getKernel, r as castResultShapeWithKnownType, rt as getActiveKernelId, t as borrowShapeWithKnownType } from "./shapeTypes-CnKFSfDT.js";
1
+ import { G as getActiveKernelId, K as getKernel, r as castResultShapeWithKnownType, t as borrowShapeWithKnownType } from "./shapeTypes-t49f64Dx.js";
2
2
  import { O as isUnsupportedKernelOperationError } from "./occtWasmAdapter-CE6nV8_2.js";
3
- import { c as getFaces, f as getVertices, l as getOrCreateCache, s as getEdges } from "./topologyQueryFns-DNqT88yx.js";
3
+ import { c as getFaces, f as getVertices, l as getOrCreateCache, s as getEdges } from "./topologyQueryFns-BkQ6Q7gN.js";
4
4
  import { n as HASH_CODE_MAX } from "./constants-ITRzCnCp.js";
5
5
  //#region src/topology/adjacencyFns.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
- const require_shapeTypes = require("./shapeTypes-Bpsu5KJO.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-CkcIL7zv.cjs");
2
2
  const require_occtWasmAdapter = require("./occtWasmAdapter-BAzyxAJw.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-C3fhJndG.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-Bia7o8l_.cjs");
4
4
  const require_constants = require("./constants-BOVyEYGH.cjs");
5
5
  //#region src/topology/adjacencyFns.ts
6
6
  /**
@@ -1,14 +1,14 @@
1
- import { Y as registerForCleanup, Z as unregisterFromCleanup, at as getKernel2D, c as createEdge, it as getKernel, p as createWire } from "./shapeTypes-CnKFSfDT.js";
1
+ import { K as getKernel, L as registerForCleanup, c as createEdge, p as createWire, q as getKernel2D, z as unregisterFromCleanup } from "./shapeTypes-t49f64Dx.js";
2
2
  import { i as wasmIndex, n as bug } from "./bug-BdOHwn_e.js";
3
- import { I as unwrap, O as ok, d as validationError, n as computationError, v as err } from "./errors-B3CDG537.js";
3
+ import { E as ok, P as unwrap, d as validationError, g as err, n as computationError } from "./errors-MHLiNE-C.js";
4
4
  import { r as RAD2DEG, t as DEG2RAD } from "./constants-ITRzCnCp.js";
5
5
  import { r as toVec3 } from "./types-D24Y27N0.js";
6
- import { r as makePlane } from "./planeOps-Cp6GQ23-.js";
7
- import { _ as cast, h as uvCoordinates, i as faceGeomType, m as uvBounds, r as faceCenter } from "./faceFns-CB6uzvOg.js";
8
- import { p as getOrientation } from "./curveFns-RENXKp64.js";
6
+ import { r as makePlane } from "./planeOps-CQahLrCx.js";
7
+ import { _ as cast, h as uvCoordinates, i as faceGeomType, m as uvBounds, r as faceCenter } from "./faceFns-DJj9Nb6T.js";
8
+ import { p as getOrientation } from "./curveFns-DX13KRh2.js";
9
9
  import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
10
- import { r as makeFace } from "./surfaceBuilders-BNR7yMQO.js";
11
- import { _ as samePoint, b as subtract2d, l as add2d, o as normalize2d, p as distance2d, t as getSingleFace, v as scalarMultiply2d } from "./helpers-BiN4qQZP.js";
10
+ import { r as makeFace } from "./surfaceBuilders-BryY-i0F.js";
11
+ import { _ as samePoint, b as subtract2d, c as add2d, f as distance2d, p as normalize2d$1, t as getSingleFace, v as scalarMultiply2d } from "./helpers-Du_OdHuy.js";
12
12
  //#region src/2d/lib/definitions.ts
13
13
  /** Type guard that checks whether a value is a `Point2D`. */
14
14
  function isPoint2D(point) {
@@ -133,6 +133,21 @@ var BoundingBox2d = class {
133
133
  }
134
134
  };
135
135
  //#endregion
136
+ //#region src/2d/lib/vectorOperations.ts
137
+ /**
138
+ * Normalize a 2D vector to unit length.
139
+ *
140
+ * Unlike the Layer 0 version (which returns [0,0] for zero-length vectors),
141
+ * this throws a BrepBugError — Layer 2 code should never pass zero-length vectors.
142
+ *
143
+ * @throws When the vector has near-zero length.
144
+ */
145
+ var normalize2d = ([x, y]) => {
146
+ const result = normalize2d$1([x, y]);
147
+ if (result[0] === 0 && result[1] === 0) bug("normalize2d", "Cannot normalize zero-length vector");
148
+ return result;
149
+ };
150
+ //#endregion
136
151
  //#region src/2d/lib/curve2D.ts
137
152
  /**
138
153
  * Deserialize a curve from a string produced by {@link Curve2D.serialize}.
@@ -168,6 +183,10 @@ var Curve2D = class Curve2D {
168
183
  delete() {
169
184
  if (!this._deleted) {
170
185
  this._deleted = true;
186
+ if (this._boundingBox) {
187
+ this._boundingBox.delete();
188
+ this._boundingBox = null;
189
+ }
171
190
  if (typeof this._wrapped.delete === "function") {
172
191
  unregisterFromCleanup(this._wrapped);
173
192
  this._wrapped.delete();
@@ -177,7 +196,12 @@ var Curve2D = class Curve2D {
177
196
  [Symbol.dispose]() {
178
197
  this.delete();
179
198
  }
180
- /** Compute (and cache) the 2D bounding box of this curve. */
199
+ /**
200
+ * Compute (and cache) the 2D bounding box of this curve.
201
+ *
202
+ * @remarks The returned box is owned by the curve and is disposed when the
203
+ * curve is deleted. Clone it if it must outlive the curve.
204
+ */
181
205
  get boundingBox() {
182
206
  if (this._boundingBox) return this._boundingBox;
183
207
  const kernel = getKernel();
@@ -754,7 +778,10 @@ var Blueprint = class Blueprint {
754
778
  this.curves.forEach((c) => {
755
779
  c.delete();
756
780
  });
757
- if (this._boundingBox) this._boundingBox.delete();
781
+ if (this._boundingBox) {
782
+ this._boundingBox.delete();
783
+ this._boundingBox = null;
784
+ }
758
785
  }
759
786
  [Symbol.dispose]() {
760
787
  this.delete();
@@ -1001,4 +1028,4 @@ var Blueprint = class Blueprint {
1001
1028
  }
1002
1029
  };
1003
1030
  //#endregion
1004
- export { Curve2D as _, edgeToCurve as a, removeDuplicatePoints as b, make2dCircle as c, make2dInerpolatedBSplineCurve as d, make2dSegmentCurve as f, approximateAsSvgCompatibleCurve as g, approximateAsBSpline as h, curvesAsEdgesOnPlane as i, make2dEllipse as l, make2dThreePointArc as m, asSVG as n, make2dArcFromCenter as o, make2dTangentArc as p, viewbox as r, make2dBezierCurve as s, Blueprint as t, make2dEllipseArc as u, deserializeCurve2D as v, isPoint2D as x, BoundingBox2d as y };
1031
+ export { isPoint2D as S, Curve2D as _, edgeToCurve as a, BoundingBox2d as b, make2dCircle as c, make2dInerpolatedBSplineCurve as d, make2dSegmentCurve as f, approximateAsSvgCompatibleCurve as g, approximateAsBSpline as h, curvesAsEdgesOnPlane as i, make2dEllipse as l, make2dThreePointArc as m, asSVG as n, make2dArcFromCenter as o, make2dTangentArc as p, viewbox as r, make2dBezierCurve as s, Blueprint as t, make2dEllipseArc as u, deserializeCurve2D as v, removeDuplicatePoints as x, normalize2d as y };
@@ -1,14 +1,14 @@
1
- const require_shapeTypes = require("./shapeTypes-Bpsu5KJO.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-CkcIL7zv.cjs");
2
2
  const require_bug = require("./bug-O02CsAmt.cjs");
3
- const require_errors = require("./errors-CJU8CHng.cjs");
3
+ const require_errors = require("./errors-RHkKO5bZ.cjs");
4
4
  const require_constants = require("./constants-BOVyEYGH.cjs");
5
5
  const require_types = require("./types-KjA8tY4Y.cjs");
6
- const require_planeOps = require("./planeOps-Cr25KWWA.cjs");
7
- const require_faceFns = require("./faceFns-CPswi9Cm.cjs");
8
- const require_curveFns = require("./curveFns-D7utcbnf.cjs");
6
+ const require_planeOps = require("./planeOps-VlFxtvzY.cjs");
7
+ const require_faceFns = require("./faceFns-BK4r7Dxk.cjs");
8
+ const require_curveFns = require("./curveFns-GmFnqNo3.cjs");
9
9
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
10
- const require_surfaceBuilders = require("./surfaceBuilders-D8_08oOR.cjs");
11
- const require_helpers = require("./helpers-Cu4ag5bh.cjs");
10
+ const require_surfaceBuilders = require("./surfaceBuilders-Biqx51el.cjs");
11
+ const require_helpers = require("./helpers-BfkBvokP.cjs");
12
12
  //#region src/2d/lib/definitions.ts
13
13
  /** Type guard that checks whether a value is a `Point2D`. */
14
14
  function isPoint2D(point) {
@@ -133,6 +133,21 @@ var BoundingBox2d = class {
133
133
  }
134
134
  };
135
135
  //#endregion
136
+ //#region src/2d/lib/vectorOperations.ts
137
+ /**
138
+ * Normalize a 2D vector to unit length.
139
+ *
140
+ * Unlike the Layer 0 version (which returns [0,0] for zero-length vectors),
141
+ * this throws a BrepBugError — Layer 2 code should never pass zero-length vectors.
142
+ *
143
+ * @throws When the vector has near-zero length.
144
+ */
145
+ var normalize2d = ([x, y]) => {
146
+ const result = require_helpers.normalize2d([x, y]);
147
+ if (result[0] === 0 && result[1] === 0) require_bug.bug("normalize2d", "Cannot normalize zero-length vector");
148
+ return result;
149
+ };
150
+ //#endregion
136
151
  //#region src/2d/lib/curve2D.ts
137
152
  /**
138
153
  * Deserialize a curve from a string produced by {@link Curve2D.serialize}.
@@ -168,6 +183,10 @@ var Curve2D = class Curve2D {
168
183
  delete() {
169
184
  if (!this._deleted) {
170
185
  this._deleted = true;
186
+ if (this._boundingBox) {
187
+ this._boundingBox.delete();
188
+ this._boundingBox = null;
189
+ }
171
190
  if (typeof this._wrapped.delete === "function") {
172
191
  require_shapeTypes.unregisterFromCleanup(this._wrapped);
173
192
  this._wrapped.delete();
@@ -177,7 +196,12 @@ var Curve2D = class Curve2D {
177
196
  [Symbol.dispose]() {
178
197
  this.delete();
179
198
  }
180
- /** Compute (and cache) the 2D bounding box of this curve. */
199
+ /**
200
+ * Compute (and cache) the 2D bounding box of this curve.
201
+ *
202
+ * @remarks The returned box is owned by the curve and is disposed when the
203
+ * curve is deleted. Clone it if it must outlive the curve.
204
+ */
181
205
  get boundingBox() {
182
206
  if (this._boundingBox) return this._boundingBox;
183
207
  const kernel = require_shapeTypes.getKernel();
@@ -499,7 +523,7 @@ function make2dInerpolatedBSplineCurve(points, { tolerance = .001, smoothing = n
499
523
  var make2dArcFromCenter = (startPoint, endPoint, center, longArc = false) => {
500
524
  const midChord = require_helpers.scalarMultiply2d(require_helpers.add2d(startPoint, endPoint), .5);
501
525
  const orientedRadius = require_helpers.distance2d(center, startPoint) * (longArc ? -1 : 1);
502
- const midChordDir = require_helpers.normalize2d(require_helpers.subtract2d(midChord, center));
526
+ const midChordDir = normalize2d(require_helpers.subtract2d(midChord, center));
503
527
  return make2dThreePointArc(startPoint, require_helpers.add2d(require_helpers.scalarMultiply2d(midChordDir, orientedRadius), center), endPoint);
504
528
  };
505
529
  //#endregion
@@ -755,7 +779,10 @@ var Blueprint = class Blueprint {
755
779
  this.curves.forEach((c) => {
756
780
  c.delete();
757
781
  });
758
- if (this._boundingBox) this._boundingBox.delete();
782
+ if (this._boundingBox) {
783
+ this._boundingBox.delete();
784
+ this._boundingBox = null;
785
+ }
759
786
  }
760
787
  [Symbol.dispose]() {
761
788
  this.delete();
@@ -1116,6 +1143,12 @@ Object.defineProperty(exports, "make2dThreePointArc", {
1116
1143
  return make2dThreePointArc;
1117
1144
  }
1118
1145
  });
1146
+ Object.defineProperty(exports, "normalize2d", {
1147
+ enumerable: true,
1148
+ get: function() {
1149
+ return normalize2d;
1150
+ }
1151
+ });
1119
1152
  Object.defineProperty(exports, "removeDuplicatePoints", {
1120
1153
  enumerable: true,
1121
1154
  get: function() {
@@ -1,6 +1,6 @@
1
- import { O as ok, d as validationError, t as BrepErrorCode, v as err } from "./errors-B3CDG537.js";
2
- import { i as CompoundBlueprint } from "./blueprintSketcher-DDPyypmC.js";
3
- import { t as Blueprint } from "./blueprint-DJJo8WkI.js";
1
+ import { E as ok, d as validationError, g as err, t as BrepErrorCode } from "./errors-MHLiNE-C.js";
2
+ import { i as CompoundBlueprint } from "./blueprintSketcher-gMuUUPb-.js";
3
+ import { t as Blueprint } from "./blueprint-DEMSX-hc.js";
4
4
  //#region src/2d/lib/curve2dFns.ts
5
5
  /**
6
6
  * Return a reversed copy of the curve (non-mutating).
@@ -12,7 +12,12 @@ function reverseCurve(curve) {
12
12
  cloned.reverse();
13
13
  return cloned;
14
14
  }
15
- /** Get the bounding box of a 2D curve. */
15
+ /**
16
+ * Get the bounding box of a 2D curve.
17
+ *
18
+ * @remarks The box is borrowed from the curve's cache and is disposed with the
19
+ * curve. Clone it if it must outlive the curve.
20
+ */
16
21
  function curve2dBoundingBox(curve) {
17
22
  return curve.boundingBox;
18
23
  }
@@ -1,6 +1,6 @@
1
- const require_errors = require("./errors-CJU8CHng.cjs");
2
- const require_blueprintSketcher = require("./blueprintSketcher-C0EXFVb2.cjs");
3
- const require_blueprint = require("./blueprint-DTNT4qYJ.cjs");
1
+ const require_errors = require("./errors-RHkKO5bZ.cjs");
2
+ const require_blueprintSketcher = require("./blueprintSketcher-gXVPrPlj.cjs");
3
+ const require_blueprint = require("./blueprint-DUnNPwQL.cjs");
4
4
  //#region src/2d/lib/curve2dFns.ts
5
5
  /**
6
6
  * Return a reversed copy of the curve (non-mutating).
@@ -12,7 +12,12 @@ function reverseCurve(curve) {
12
12
  cloned.reverse();
13
13
  return cloned;
14
14
  }
15
- /** Get the bounding box of a 2D curve. */
15
+ /**
16
+ * Get the bounding box of a 2D curve.
17
+ *
18
+ * @remarks The box is borrowed from the curve's cache and is disposed with the
19
+ * curve. Clone it if it must outlive the curve.
20
+ */
16
21
  function curve2dBoundingBox(curve) {
17
22
  return curve.boundingBox;
18
23
  }