brepjs 18.119.2 → 18.119.3

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 (96) hide show
  1. package/dist/2d/lib/curve2D.d.ts +6 -1
  2. package/dist/2d/lib/curve2dFns.d.ts +6 -1
  3. package/dist/2d.cjs +7 -7
  4. package/dist/2d.js +7 -7
  5. package/dist/{adjacencyFns-BdM5p58J.js → adjacencyFns-DLityMyV.js} +2 -2
  6. package/dist/{adjacencyFns-Brrc7jlS.cjs → adjacencyFns-DSxuQYnb.cjs} +2 -2
  7. package/dist/{blueprint-DTNT4qYJ.cjs → blueprint-BGcBMy3b.cjs} +39 -9
  8. package/dist/{blueprint-DJJo8WkI.js → blueprint-CAG6jseD.js} +33 -9
  9. package/dist/{blueprintFns-CcpboZ80.js → blueprintFns-B4C3zH7N.js} +9 -4
  10. package/dist/{blueprintFns-2XDZfCxX.cjs → blueprintFns-CnoqynzI.cjs} +9 -4
  11. package/dist/{blueprintSketcher-C0EXFVb2.cjs → blueprintSketcher-BNz6f36D.cjs} +166 -61
  12. package/dist/{blueprintSketcher-DDPyypmC.js → blueprintSketcher-CKKxvxB-.js} +159 -54
  13. package/dist/{boolean2D-Ddfo_dd0.cjs → boolean2D-B-0xobBP.cjs} +5 -5
  14. package/dist/{boolean2D-C_PVz8xT.js → boolean2D-C_1gMcZ6.js} +5 -5
  15. package/dist/brepjs.cjs +105 -92
  16. package/dist/brepjs.js +39 -27
  17. package/dist/{cameraFns-Czr5vABD.cjs → cameraFns-2-haLzLi.cjs} +4 -4
  18. package/dist/{cameraFns-D9tdBYLM.js → cameraFns-CG_J66Hl.js} +4 -4
  19. package/dist/core.cjs +12 -11
  20. package/dist/core.js +4 -3
  21. package/dist/{cornerFinder-Cqg-Dz74.js → cornerFinder-CPFM7bA0.js} +1 -1
  22. package/dist/{cornerFinder-DETRDOMz.cjs → cornerFinder-mfsUMi5g.cjs} +1 -1
  23. package/dist/{curveFns-RENXKp64.js → curveFns-DX13KRh2.js} +2 -2
  24. package/dist/{curveFns-D7utcbnf.cjs → curveFns-GmFnqNo3.cjs} +2 -2
  25. package/dist/{drawFns-D9Rf4foW.cjs → drawFns-B14M5M68.cjs} +14 -14
  26. package/dist/{drawFns-B9HbtAoc.js → drawFns-BShGVVXW.js} +14 -14
  27. package/dist/{errors-B3CDG537.js → errors-MHLiNE-C.js} +1 -92
  28. package/dist/{errors-CJU8CHng.cjs → errors-RHkKO5bZ.cjs} +0 -103
  29. package/dist/{faceFns-CPswi9Cm.cjs → faceFns-BK4r7Dxk.cjs} +3 -3
  30. package/dist/{faceFns-CB6uzvOg.js → faceFns-DJj9Nb6T.js} +3 -3
  31. package/dist/{healingFns-BFTYLiAm.js → healingFns-DxcRyVCG.js} +5 -6
  32. package/dist/{healingFns-bhMxTTqw.cjs → healingFns-Hx4oTlq8.cjs} +27 -28
  33. package/dist/{helpers-Cu4ag5bh.cjs → helpers-BfkBvokP.cjs} +8 -24
  34. package/dist/{helpers-BiN4qQZP.js → helpers-Du_OdHuy.js} +9 -25
  35. package/dist/{importFns-X8vBhZI2.js → importFns-BHs19muu.js} +3 -3
  36. package/dist/{importFns-DS4J1xLv.cjs → importFns-GySbuvVv.cjs} +3 -3
  37. package/dist/io.cjs +2 -2
  38. package/dist/io.js +2 -2
  39. package/dist/{loftFns-ChHjzUK-.cjs → loftFns-BdpZ8FMN.cjs} +2 -125
  40. package/dist/{loftFns-BF5X7ltI.js → loftFns-BeGJ6dxx.js} +4 -109
  41. package/dist/{measureFns-B5Zzg1qM.cjs → measureFns-CJGrmhHT.cjs} +4 -4
  42. package/dist/{measureFns-CC7HhAH3.js → measureFns-CMnbcUZC.js} +4 -4
  43. package/dist/measurement.cjs +1 -1
  44. package/dist/measurement.js +1 -1
  45. package/dist/{meshFns-D57Fyqyf.js → meshFns-Cs5EBsf7.js} +4 -4
  46. package/dist/{meshFns-CaXmWmhe.cjs → meshFns-Dqf5QBhQ.cjs} +5 -5
  47. package/dist/operations.cjs +2 -2
  48. package/dist/operations.js +2 -2
  49. package/dist/originTrackingFns-DZmdiQ-O.js +203 -0
  50. package/dist/originTrackingFns-fpEgTIwV.cjs +226 -0
  51. package/dist/{planeOps-Cp6GQ23-.js → planeOps-CQahLrCx.js} +1 -1
  52. package/dist/{planeOps-Cr25KWWA.cjs → planeOps-VlFxtvzY.cjs} +1 -1
  53. package/dist/primitiveFns-B_rflH83.cjs +773 -0
  54. package/dist/primitiveFns-Cxo3xDKY.js +558 -0
  55. package/dist/projection.cjs +1 -1
  56. package/dist/projection.js +1 -1
  57. package/dist/query.cjs +2 -2
  58. package/dist/query.js +2 -2
  59. package/dist/{refResolveFns-3bw9-U-e.js → refResolveFns-BbRLD8LA.js} +6 -6
  60. package/dist/{refResolveFns-BxmgIhQM.cjs → refResolveFns-CVDLwh12.cjs} +6 -6
  61. package/dist/result.cjs +1 -1
  62. package/dist/result.js +1 -1
  63. package/dist/rolldown-runtime-DakpK96I.cjs +43 -0
  64. package/dist/shapeFns-BTFx-os7.js +43 -0
  65. package/dist/shapeFns-D_5TgiUi.cjs +84 -0
  66. package/dist/shapeRef.cjs +1 -1
  67. package/dist/shapeRef.js +1 -1
  68. package/dist/{shapeTypes-Bpsu5KJO.cjs → shapeTypes-CkcIL7zv.cjs} +1 -222
  69. package/dist/{shapeTypes-CnKFSfDT.js → shapeTypes-t49f64Dx.js} +2 -139
  70. package/dist/sketching.cjs +3 -3
  71. package/dist/sketching.js +3 -3
  72. package/dist/{solidBuilders-I8_V8qqU.js → solidBuilders-DTgqQC3W.js} +310 -8
  73. package/dist/{solidBuilders-Bp7lQW62.cjs → solidBuilders-IiIzjKAr.cjs} +401 -15
  74. package/dist/{surfaceBuilders-D8_08oOR.cjs → surfaceBuilders-Biqx51el.cjs} +6 -5
  75. package/dist/{surfaceBuilders-BNR7yMQO.js → surfaceBuilders-BryY-i0F.js} +4 -3
  76. package/dist/text.cjs +2 -2
  77. package/dist/text.js +2 -2
  78. package/dist/{textBlueprints-B5zcLGvJ.cjs → textBlueprints-8EcWreab.cjs} +138 -51
  79. package/dist/{textBlueprints-igbNvKcd.js → textBlueprints-rA1HT6j1.js} +116 -11
  80. package/dist/{textMetrics-CJvtpbc3.js → textMetrics-Bcbso1Ns.js} +2 -2
  81. package/dist/{textMetrics-08fF0QNf.cjs → textMetrics-GPBu9JKi.cjs} +2 -2
  82. package/dist/{threadFns-CqSMNyTZ.js → threadFns-BOtXTHZ9.js} +8 -8
  83. package/dist/{threadFns-Co6vWEWx.cjs → threadFns-DRrk9Qod.cjs} +8 -8
  84. package/dist/topology.cjs +9 -9
  85. package/dist/topology.js +9 -9
  86. package/dist/{topologyQueryFns-C3fhJndG.cjs → topologyQueryFns-Bia7o8l_.cjs} +97 -6
  87. package/dist/{topologyQueryFns-DNqT88yx.js → topologyQueryFns-BkQ6Q7gN.js} +93 -2
  88. package/dist/validityTypes-DiTgeCD9.js +129 -0
  89. package/dist/validityTypes-ZGMVlv7b.cjs +200 -0
  90. package/dist/vectors.cjs +1 -1
  91. package/dist/vectors.js +1 -1
  92. package/package.json +8 -8
  93. package/dist/primitiveFns-CRy_CUVg.cjs +0 -492
  94. package/dist/primitiveFns-DCIH-SBm.js +0 -331
  95. package/dist/shapeFns-BrHFNLMA.js +0 -771
  96. package/dist/shapeFns-qm9VRo4i.cjs +0 -962
@@ -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-BNz6f36D.cjs");
6
+ const require_blueprint = require("./blueprint-BGcBMy3b.cjs");
7
+ const require_boolean2D = require("./boolean2D-B-0xobBP.cjs");
8
+ const require_blueprintFns = require("./blueprintFns-CnoqynzI.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-CKKxvxB-.js";
5
+ import { _ as Curve2D, b as BoundingBox2d, t as Blueprint } from "./blueprint-CAG6jseD.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_1gMcZ6.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-B4C3zH7N.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
- 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
@@ -1116,6 +1140,12 @@ Object.defineProperty(exports, "make2dThreePointArc", {
1116
1140
  return make2dThreePointArc;
1117
1141
  }
1118
1142
  });
1143
+ Object.defineProperty(exports, "normalize2d", {
1144
+ enumerable: true,
1145
+ get: function() {
1146
+ return normalize2d;
1147
+ }
1148
+ });
1119
1149
  Object.defineProperty(exports, "removeDuplicatePoints", {
1120
1150
  enumerable: true,
1121
1151
  get: function() {
@@ -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();
@@ -1001,4 +1025,4 @@ var Blueprint = class Blueprint {
1001
1025
  }
1002
1026
  };
1003
1027
  //#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 };
1028
+ 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,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-CKKxvxB-.js";
3
+ import { t as Blueprint } from "./blueprint-CAG6jseD.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-BNz6f36D.cjs");
3
+ const require_blueprint = require("./blueprint-BGcBMy3b.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
  }
@@ -1,10 +1,10 @@
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_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
6
- const require_helpers = require("./helpers-Cu4ag5bh.cjs");
7
- const require_blueprint = require("./blueprint-DTNT4qYJ.cjs");
6
+ const require_helpers = require("./helpers-BfkBvokP.cjs");
7
+ const require_blueprint = require("./blueprint-BGcBMy3b.cjs");
8
8
  //#region node_modules/flatqueue/index.js
9
9
  /**
10
10
  * @typedef {Float64ArrayConstructor | Float32ArrayConstructor |
@@ -587,7 +587,7 @@ var selfIntersections = (curve, precision = 1e-9) => {
587
587
  //#endregion
588
588
  //#region src/2d/lib/offset.ts
589
589
  var offsetEndPoints = (firstPoint, lastPoint, offset) => {
590
- const tangent = require_helpers.normalize2d(require_helpers.subtract2d(lastPoint, firstPoint));
590
+ const tangent = require_blueprint.normalize2d(require_helpers.subtract2d(lastPoint, firstPoint));
591
591
  const normal = [tangent[1], -tangent[0]];
592
592
  const offsetVec = [require_bug.wasmIndex(normal, 0) * offset, require_bug.wasmIndex(normal, 1) * offset];
593
593
  return {
@@ -629,7 +629,7 @@ var make2dOffset = (curve, offset) => {
629
629
  if (newRadius < 1e-10) {
630
630
  const center = [cx, cy];
631
631
  const offsetViaCenter = (point) => {
632
- const [x, y] = require_helpers.normalize2d(require_helpers.subtract2d(point, center));
632
+ const [x, y] = require_blueprint.normalize2d(require_helpers.subtract2d(point, center));
633
633
  return require_helpers.add2d(point, [orientedOffset * x, orientedOffset * y]);
634
634
  };
635
635
  return {
@@ -668,32 +668,99 @@ var make2dOffset = (curve, offset) => {
668
668
  };
669
669
  //#endregion
670
670
  //#region src/2d/lib/customCorners.ts
671
+ /** Unwrap an intersection, discarding the common-segment curves the caller does not use. */
672
+ function intersectionPoints(first, second) {
673
+ const result = require_errors.unwrap(intersectCurves(first, second));
674
+ result.commonSegments.forEach((c) => {
675
+ c.delete();
676
+ });
677
+ return result.intersections;
678
+ }
679
+ /**
680
+ * Delete the split pieces the caller is discarding. `splitAt` returns the curve
681
+ * itself when there is nothing to split, so the source is never deleted here.
682
+ */
683
+ function disposeSplitPieces(pieces, source, kept) {
684
+ pieces.forEach((piece) => {
685
+ if (piece !== source && piece !== kept) piece.delete();
686
+ });
687
+ }
688
+ /**
689
+ * Run `split` and, if it throws, dispose the pieces an earlier split already
690
+ * produced. Splitting the second curve of a corner can fail (its parameter may
691
+ * not project onto the offset), stranding the first curve's pieces.
692
+ */
693
+ function splitOrDiscard(split, earlier) {
694
+ try {
695
+ return split();
696
+ } catch (e) {
697
+ disposeSplitPieces(earlier.pieces, earlier.source);
698
+ throw e;
699
+ }
700
+ }
701
+ /**
702
+ * Build the corner result, disposing the trimmed halves if the connecting curve
703
+ * cannot be built. They are unreachable once the error propagates.
704
+ */
705
+ function discardTrimsOnError(firstCurve, secondCurve, first, second, build) {
706
+ try {
707
+ return build();
708
+ } catch (e) {
709
+ if (first !== firstCurve) first.delete();
710
+ if (second !== secondCurve) second.delete();
711
+ throw e;
712
+ }
713
+ }
671
714
  function removeCorner(firstCurve, secondCurve, radius) {
672
715
  const sinAngle = require_helpers.crossProduct2d(firstCurve.tangentAt(1), secondCurve.tangentAt(0));
673
716
  if (Math.abs(sinAngle) < 1e-10) return null;
674
717
  const offset = Math.abs(radius) * (sinAngle > 0 ? -1 : 1);
675
- const firstOffset = make2dOffset(firstCurve, offset);
676
- const secondOffset = make2dOffset(secondCurve, offset);
677
- if (!(firstOffset instanceof require_blueprint.Curve2D) || !(secondOffset instanceof require_blueprint.Curve2D)) return null;
678
- const intersectionResult = intersectCurves(firstOffset, secondOffset, 1e-9);
679
- if (!require_errors.isOk(intersectionResult)) return null;
680
- const potentialCenter = intersectionResult.value.intersections.at(-1);
681
- if (!require_blueprint.isPoint2D(potentialCenter)) return null;
682
- const center = potentialCenter;
683
- const splitForFillet = (curve, offsetCurve) => {
684
- const [x, y] = offsetCurve.tangentAt(center);
685
- const normal = require_helpers.normalize2d([-y, x]);
686
- const splitPoint = require_helpers.add2d(center, require_helpers.scalarMultiply2d(normal, offset));
687
- const splitParam = require_errors.unwrap(curve.parameter(splitPoint, 1e-6));
688
- return curve.splitAt([splitParam]);
689
- };
690
- const firstSplit = splitForFillet(firstCurve, firstOffset);
691
- const secondSplit = splitForFillet(secondCurve, secondOffset);
692
- return {
693
- first: require_bug.wasmIndex(firstSplit, 0),
694
- second: require_bug.wasmIndex(secondSplit, 1),
695
- center
696
- };
718
+ let firstOffset = null;
719
+ let secondOffset = null;
720
+ try {
721
+ firstOffset = make2dOffset(firstCurve, offset);
722
+ secondOffset = make2dOffset(secondCurve, offset);
723
+ if (!(firstOffset instanceof require_blueprint.Curve2D) || !(secondOffset instanceof require_blueprint.Curve2D)) return null;
724
+ const firstOffsetCurve = firstOffset;
725
+ const secondOffsetCurve = secondOffset;
726
+ const intersectionResult = intersectCurves(firstOffsetCurve, secondOffsetCurve, 1e-9);
727
+ if (!require_errors.isOk(intersectionResult)) return null;
728
+ intersectionResult.value.commonSegments.forEach((c) => {
729
+ c.delete();
730
+ });
731
+ const potentialCenter = intersectionResult.value.intersections.at(-1);
732
+ if (!require_blueprint.isPoint2D(potentialCenter)) return null;
733
+ const center = potentialCenter;
734
+ const splitForFillet = (curve, offsetCurve) => {
735
+ const [x, y] = offsetCurve.tangentAt(center);
736
+ const normal = require_blueprint.normalize2d([-y, x]);
737
+ const splitPoint = require_helpers.add2d(center, require_helpers.scalarMultiply2d(normal, offset));
738
+ const splitParam = require_errors.unwrap(curve.parameter(splitPoint, 1e-6));
739
+ return curve.splitAt([splitParam]);
740
+ };
741
+ const firstSplit = splitForFillet(firstCurve, firstOffsetCurve);
742
+ const secondSplit = splitOrDiscard(() => splitForFillet(secondCurve, secondOffsetCurve), {
743
+ pieces: firstSplit,
744
+ source: firstCurve
745
+ });
746
+ const first = firstSplit[0];
747
+ const second = secondSplit[1];
748
+ if (!first || !second) {
749
+ disposeSplitPieces(firstSplit, firstCurve);
750
+ disposeSplitPieces(secondSplit, secondCurve);
751
+ return null;
752
+ }
753
+ disposeSplitPieces(firstSplit, firstCurve, first);
754
+ disposeSplitPieces(secondSplit, secondCurve, second);
755
+ return {
756
+ first,
757
+ second,
758
+ center
759
+ };
760
+ } finally {
761
+ if (firstOffset instanceof require_blueprint.Curve2D) firstOffset.delete();
762
+ if (secondOffset instanceof require_blueprint.Curve2D) secondOffset.delete();
763
+ }
697
764
  }
698
765
  /**
699
766
  * Insert a circular fillet arc at the corner between two curves.
@@ -711,11 +778,11 @@ function filletCurves(firstCurve, secondCurve, radius) {
711
778
  const cornerRemoved = removeCorner(firstCurve, secondCurve, radius);
712
779
  if (!cornerRemoved) return [firstCurve, secondCurve];
713
780
  const { first, second, center } = cornerRemoved;
714
- return [
781
+ return discardTrimsOnError(firstCurve, secondCurve, first, second, () => [
715
782
  first,
716
783
  require_blueprint.make2dArcFromCenter(first.lastPoint, second.firstPoint, center),
717
784
  second
718
- ];
785
+ ]);
719
786
  }
720
787
  /**
721
788
  * Insert a straight chamfer segment at the corner between two curves.
@@ -727,11 +794,11 @@ function chamferCurves(firstCurve, secondCurve, radius) {
727
794
  const cornerRemoved = removeCorner(firstCurve, secondCurve, radius);
728
795
  if (!cornerRemoved) return [firstCurve, secondCurve];
729
796
  const { first, second } = cornerRemoved;
730
- return [
797
+ return discardTrimsOnError(firstCurve, secondCurve, first, second, () => [
731
798
  first,
732
799
  require_blueprint.make2dSegmentCurve(first.lastPoint, second.firstPoint),
733
800
  second
734
- ];
801
+ ]);
735
802
  }
736
803
  /**
737
804
  * Insert a dogbone fillet at an inner corner for CNC milling clearance.
@@ -740,34 +807,58 @@ function chamferCurves(firstCurve, secondCurve, radius) {
740
807
  * round end-mill of the given radius can fully reach the corner.
741
808
  */
742
809
  function dogboneFilletCurves(firstCurve, secondCurve, radius) {
743
- const sinAngle = require_helpers.crossProduct2d(require_helpers.normalize2d(firstCurve.tangentAt(1)), require_helpers.normalize2d(secondCurve.tangentAt(0)));
810
+ const sinAngle = require_helpers.crossProduct2d(require_blueprint.normalize2d(firstCurve.tangentAt(1)), require_blueprint.normalize2d(secondCurve.tangentAt(0)));
744
811
  const a = Math.asin(sinAngle);
745
812
  if (Math.abs(sinAngle) < 1e-10) return [firstCurve, secondCurve];
746
813
  const orientationCorrection = sinAngle > 0 ? -1 : 1;
747
814
  const offset = Math.abs(radius) * Math.sin(a / 2) * orientationCorrection;
748
- const firstOffset = make2dOffset(firstCurve, offset);
749
- const secondOffset = make2dOffset(secondCurve, offset);
750
- if (!(firstOffset instanceof require_blueprint.Curve2D) || !(secondOffset instanceof require_blueprint.Curve2D)) return [firstCurve, secondCurve];
751
- const intersectionResult2 = intersectCurves(firstOffset, secondOffset, 1e-9);
752
- if (!require_errors.isOk(intersectionResult2)) return [firstCurve, secondCurve];
753
- const potentialCenter = intersectionResult2.value.intersections.at(-1);
754
- if (!require_blueprint.isPoint2D(potentialCenter)) return [firstCurve, secondCurve];
755
- const circle = require_blueprint.make2dCircle(radius, potentialCenter);
756
- const firstInt = require_errors.unwrap(intersectCurves(firstCurve, circle)).intersections[0];
757
- const secondInt = require_errors.unwrap(intersectCurves(secondCurve, circle)).intersections.at(-1);
758
- if (!firstInt || !secondInt) return [firstCurve, secondCurve];
759
- const firstSplit = firstCurve.splitAt([firstInt]);
760
- const secondSplit = secondCurve.splitAt([secondInt]);
761
- const firstPart = require_bug.wasmIndex(firstSplit, 0);
762
- const secondPart = require_bug.wasmIndex(secondSplit, secondSplit.length - 1);
815
+ let firstOffset = null;
816
+ let secondOffset = null;
817
+ let circle = null;
763
818
  try {
764
- return [
765
- firstPart,
766
- require_blueprint.make2dThreePointArc(firstPart.lastPoint, firstCurve.lastPoint, secondPart.firstPoint),
767
- secondPart
768
- ];
769
- } catch {
770
- return [firstCurve, secondCurve];
819
+ firstOffset = make2dOffset(firstCurve, offset);
820
+ secondOffset = make2dOffset(secondCurve, offset);
821
+ if (!(firstOffset instanceof require_blueprint.Curve2D) || !(secondOffset instanceof require_blueprint.Curve2D)) return [firstCurve, secondCurve];
822
+ const intersectionResult2 = intersectCurves(firstOffset, secondOffset, 1e-9);
823
+ if (!require_errors.isOk(intersectionResult2)) return [firstCurve, secondCurve];
824
+ intersectionResult2.value.commonSegments.forEach((c) => {
825
+ c.delete();
826
+ });
827
+ const potentialCenter = intersectionResult2.value.intersections.at(-1);
828
+ if (!require_blueprint.isPoint2D(potentialCenter)) return [firstCurve, secondCurve];
829
+ circle = require_blueprint.make2dCircle(radius, potentialCenter);
830
+ const firstInt = intersectionPoints(firstCurve, circle)[0];
831
+ const secondInt = intersectionPoints(secondCurve, circle).at(-1);
832
+ if (!firstInt || !secondInt) return [firstCurve, secondCurve];
833
+ const firstSplit = firstCurve.splitAt([firstInt]);
834
+ const secondSplit = splitOrDiscard(() => secondCurve.splitAt([secondInt]), {
835
+ pieces: firstSplit,
836
+ source: firstCurve
837
+ });
838
+ const firstPart = firstSplit[0];
839
+ const secondPart = secondSplit[secondSplit.length - 1];
840
+ if (!firstPart || !secondPart) {
841
+ disposeSplitPieces(firstSplit, firstCurve);
842
+ disposeSplitPieces(secondSplit, secondCurve);
843
+ return [firstCurve, secondCurve];
844
+ }
845
+ disposeSplitPieces(firstSplit, firstCurve, firstPart);
846
+ disposeSplitPieces(secondSplit, secondCurve, secondPart);
847
+ try {
848
+ return [
849
+ firstPart,
850
+ require_blueprint.make2dThreePointArc(firstPart.lastPoint, firstCurve.lastPoint, secondPart.firstPoint),
851
+ secondPart
852
+ ];
853
+ } catch {
854
+ if (firstPart !== firstCurve) firstPart.delete();
855
+ if (secondPart !== secondCurve) secondPart.delete();
856
+ return [firstCurve, secondCurve];
857
+ }
858
+ } finally {
859
+ if (firstOffset instanceof require_blueprint.Curve2D) firstOffset.delete();
860
+ if (secondOffset instanceof require_blueprint.Curve2D) secondOffset.delete();
861
+ circle?.delete();
771
862
  }
772
863
  }
773
864
  //#endregion
@@ -1121,7 +1212,7 @@ function makeEllipseArcFromSvgParams(startUV, endUV, majorRadius, minorRadius, r
1121
1212
  const convertAxis = (ax) => require_helpers.distance2d(convertToUV(ax));
1122
1213
  const r1 = convertAxis(require_helpers.polarToCartesian(majorRadius, radRotationAngle));
1123
1214
  const r2 = convertAxis(require_helpers.polarToCartesian(minorRadius, radRotationAngle + Math.PI / 2));
1124
- const xDir = require_helpers.normalize2d(convertToUV(require_helpers.rotate2d([1, 0], radRotationAngle)));
1215
+ const xDir = require_blueprint.normalize2d(convertToUV(require_helpers.rotate2d([1, 0], radRotationAngle)));
1125
1216
  const [, newRotationAngle] = require_helpers.cartesianToPolar(xDir);
1126
1217
  const { cx, cy, startAngle, endAngle, clockwise, rx, ry } = convertSvgEllipseParams(startUV, endUV, r1, r2, newRotationAngle, longAxis, sweep);
1127
1218
  const arc = require_blueprint.make2dEllipseArc(rx, ry, clockwise ? startAngle : endAngle, clockwise ? endAngle : startAngle, [cx, cy], xDir);
@@ -1213,6 +1304,16 @@ var cornerModeFns = {
1213
1304
  dogbone: dogboneFilletCurves,
1214
1305
  fillet: filletCurves
1215
1306
  };
1307
+ /**
1308
+ * Delete the curves a corner function consumed. Corner functions return their
1309
+ * inputs untouched when they bail (collinear curves, failed offset), so only
1310
+ * the ones absent from the result are ours to free.
1311
+ */
1312
+ function disposeConsumedCurves(consumed, produced) {
1313
+ consumed.forEach((curve) => {
1314
+ if (!produced.includes(curve)) curve.delete();
1315
+ });
1316
+ }
1216
1317
  function buildCornerFunction(radius, mode) {
1217
1318
  if (typeof radius === "function") return radius;
1218
1319
  const makeFn = cornerModeFns[mode];
@@ -1295,7 +1396,9 @@ var BaseSketcher2d = class {
1295
1396
  }
1296
1397
  const previousCurve = this.pendingCurves.pop();
1297
1398
  if (!previousCurve) require_bug.bug("Sketcher2d.saveCurve", "No previous curve available for custom corner");
1298
- this.pendingCurves.push(...this._nextCorner(previousCurve, curve));
1399
+ const cornered = this._nextCorner(previousCurve, curve);
1400
+ disposeConsumedCurves([previousCurve, curve], cornered);
1401
+ this.pendingCurves.push(...cornered);
1299
1402
  this._nextCorner = null;
1300
1403
  }
1301
1404
  /** Draw a straight line to an absolute 2D point. */
@@ -1335,7 +1438,7 @@ var BaseSketcher2d = class {
1335
1438
  /** Draw a line tangent to the previous curve, extending by the given distance. */
1336
1439
  tangentLine(distance) {
1337
1440
  const previousCurve = this._requireLastCurve("Sketcher2d.tangentLine", "sketch a tangent line");
1338
- const direction = require_helpers.normalize2d(this._convertFromUV(previousCurve.tangentAt(1)));
1441
+ const direction = require_blueprint.normalize2d(this._convertFromUV(previousCurve.tangentAt(1)));
1339
1442
  return this.line(direction[0] * distance, direction[1] * distance);
1340
1443
  }
1341
1444
  /** Draw a circular arc passing through a mid-point to an absolute end point. */
@@ -1445,12 +1548,12 @@ var BaseSketcher2d = class {
1445
1548
  if (startTangent) startPoleDirection = startTangent;
1446
1549
  else if (!previousCurve) startPoleDirection = [1, 0];
1447
1550
  else startPoleDirection = this._convertFromUV(previousCurve.tangentAt(1));
1448
- startPoleDirection = require_helpers.normalize2d(startPoleDirection);
1551
+ startPoleDirection = require_blueprint.normalize2d(startPoleDirection);
1449
1552
  const startControl = [this.pointer[0] + startPoleDirection[0] * startFactor * defaultDistance, this.pointer[1] + startPoleDirection[1] * startFactor * defaultDistance];
1450
1553
  let endPoleDirection;
1451
1554
  if (endTangent === "symmetric") endPoleDirection = [-startPoleDirection[0], -startPoleDirection[1]];
1452
1555
  else endPoleDirection = endTangent;
1453
- endPoleDirection = require_helpers.normalize2d(endPoleDirection);
1556
+ endPoleDirection = require_blueprint.normalize2d(endPoleDirection);
1454
1557
  const endControl = [end[0] - endPoleDirection[0] * endFactor * defaultDistance, end[1] - endPoleDirection[1] * endFactor * defaultDistance];
1455
1558
  return this.cubicBezierCurveTo(end, startControl, endControl);
1456
1559
  }
@@ -1469,7 +1572,9 @@ var BaseSketcher2d = class {
1469
1572
  const previousCurve = this.pendingCurves.pop();
1470
1573
  const curve = this.pendingCurves.shift();
1471
1574
  if (!previousCurve || !curve) require_bug.bug("Sketcher2d._customCornerLastWithFirst", "Not enough curves to close and fillet");
1472
- this.pendingCurves.push(...buildCornerFunction(radius, mode)(previousCurve, curve));
1575
+ const cornered = buildCornerFunction(radius, mode)(previousCurve, curve);
1576
+ disposeConsumedCurves([previousCurve, curve], cornered);
1577
+ this.pendingCurves.push(...cornered);
1473
1578
  }
1474
1579
  _closeSketch() {
1475
1580
  if (!require_helpers.samePoint(this.pointer, this.firstPoint)) this.lineTo(this.firstPoint);