brepjs 18.124.0 → 18.124.2

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 (86) hide show
  1. package/dist/2d.cjs +10 -8
  2. package/dist/2d.js +10 -8
  3. package/dist/{adjacencyFns-BJ6jcQ-N.cjs → adjacencyFns-CpKlADYt.cjs} +3 -3
  4. package/dist/{adjacencyFns-CnehwLNj.js → adjacencyFns-DECdcer5.js} +3 -3
  5. package/dist/{blueprint-BGWbpQ-w.js → blueprint-CaY00-X2.js} +16 -11
  6. package/dist/{blueprint-BSfG0Uik.cjs → blueprint-CpJLcUJV.cjs} +14 -10
  7. package/dist/{blueprintFns-C0-nGqlW.cjs → blueprintFns-B5nFaJI0.cjs} +2 -2
  8. package/dist/{blueprintFns-Bt1hKlL7.js → blueprintFns-vgwEIgI0.js} +2 -2
  9. package/dist/{blueprintSketcher-Bd5ZS9p6.cjs → blueprintSketcher-4e0yYtCY.cjs} +19 -11
  10. package/dist/{blueprintSketcher-BTGRoQ_G.js → blueprintSketcher-BjBjj2cK.js} +19 -11
  11. package/dist/{boolean2D-Cr6oLsbf.cjs → boolean2D-7heWA1co.cjs} +12 -8
  12. package/dist/{boolean2D-zZ9-qR5a.js → boolean2D-Bk-VrRyQ.js} +14 -9
  13. package/dist/brepjs.cjs +121 -81
  14. package/dist/brepjs.js +132 -85
  15. package/dist/{cameraFns-j2I9G3L_.cjs → cameraFns-CGwrxgqB.cjs} +5 -4
  16. package/dist/{cameraFns-CGMawqfi.js → cameraFns-DKEilV2v.js} +5 -4
  17. package/dist/core.cjs +2 -2
  18. package/dist/core.js +2 -2
  19. package/dist/{cornerFinder-CaXBdZz9.js → cornerFinder-C4s6pVZ-.js} +1 -1
  20. package/dist/{cornerFinder-CPwSLgpM.cjs → cornerFinder-zEgIFMnk.cjs} +1 -1
  21. package/dist/{curveFns-BBLaLG1U.cjs → curveFns-BZZYHVow.cjs} +8 -5
  22. package/dist/{curveFns-BoHbhtqX.js → curveFns-RczIU30U.js} +8 -5
  23. package/dist/{drawFns-DOkSdo8E.cjs → drawFns-BcXzWFfn.cjs} +59 -30
  24. package/dist/{drawFns-BrRbAeYB.js → drawFns-BjT3RaeQ.js} +59 -30
  25. package/dist/{faceFns-UozswcwP.cjs → faceFns-C4xNv2zn.cjs} +4 -3
  26. package/dist/{faceFns-Ce7Fq6j5.js → faceFns-fvp_zfuI.js} +6 -4
  27. package/dist/{healingFns-Dn0EFSHm.js → healingFns-AE5182Ds.js} +38 -21
  28. package/dist/{healingFns-mKogaVOk.cjs → healingFns-SxSiVPQa.cjs} +38 -21
  29. package/dist/{helpers-DuTAcGVX.cjs → helpers-CHYzwQMk.cjs} +6 -6
  30. package/dist/{helpers-CZsK8STz.js → helpers-CyLQ07aD.js} +6 -6
  31. package/dist/{importFns-Ch2YwieP.cjs → importFns-90S7P_7P.cjs} +5 -6
  32. package/dist/{importFns-CE4byS-8.js → importFns-DdXOAX6k.js} +5 -6
  33. package/dist/io.cjs +2 -2
  34. package/dist/io.js +2 -2
  35. package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
  36. package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
  37. package/dist/{loftFns-BYiUcAxk.cjs → loftFns-B3mbh5RA.cjs} +15 -9
  38. package/dist/{loftFns-DQVg8qxM.js → loftFns-CyY4qfvC.js} +15 -9
  39. package/dist/{measureFns-BbLLBg5q.js → measureFns-B1uLQugf.js} +3 -3
  40. package/dist/{measureFns-Cao9gY1L.cjs → measureFns-Cx2XJVVC.cjs} +3 -3
  41. package/dist/measurement.cjs +1 -1
  42. package/dist/measurement.js +1 -1
  43. package/dist/{meshFns-CnYIUU9b.cjs → meshFns-2ZxW-X9I.cjs} +3 -3
  44. package/dist/{meshFns-B6NveFwc.js → meshFns-DrO3d03M.js} +3 -3
  45. package/dist/{occtWasmAdapter-BQKQXF63.js → occtWasmAdapter-BEe---7w.js} +3 -1
  46. package/dist/{occtWasmAdapter-Aubfbks6.cjs → occtWasmAdapter-DEpy64ji.cjs} +3 -1
  47. package/dist/operations.cjs +2 -2
  48. package/dist/operations.js +2 -2
  49. package/dist/{originTrackingFns-uz38yuMp.cjs → originTrackingFns-D3rUK08B.cjs} +2 -2
  50. package/dist/{originTrackingFns-DXcggmgf.js → originTrackingFns-DIAwMSih.js} +2 -2
  51. package/dist/{primitiveFns-CmmTWOkO.js → primitiveFns-CDPqVTcc.js} +7 -5
  52. package/dist/{primitiveFns-DmEPf6av.cjs → primitiveFns-c7wqS-K2.cjs} +7 -5
  53. package/dist/projection.cjs +1 -1
  54. package/dist/projection.js +1 -1
  55. package/dist/query.cjs +2 -2
  56. package/dist/query.js +2 -2
  57. package/dist/{refResolveFns-CnPEaqHw.cjs → refResolveFns-Cm8ZHPl5.cjs} +10 -8
  58. package/dist/{refResolveFns-DqY7Cd00.js → refResolveFns-o3-Gdnjn.js} +10 -8
  59. package/dist/{rolldown-runtime-DakpK96I.cjs → rolldown-runtime-C0BPl7ul.cjs} +1 -1
  60. package/dist/{shapeFns-BLZ1dDSz.cjs → shapeFns-CJ6mph9b.cjs} +2 -2
  61. package/dist/{shapeFns-mYczuWOy.js → shapeFns-DEpbxB9Z.js} +2 -2
  62. package/dist/shapeRef.cjs +1 -1
  63. package/dist/shapeRef.js +1 -1
  64. package/dist/{shapeTypes-bHlssytH.js → shapeTypes-BHRboc_x.js} +235 -20
  65. package/dist/{shapeTypes-DZKuRt24.cjs → shapeTypes-D5Y41q7x.cjs} +219 -12
  66. package/dist/sketching.cjs +3 -3
  67. package/dist/sketching.js +3 -3
  68. package/dist/{solidBuilders-5tA9O1SM.cjs → solidBuilders-CsUkRC69.cjs} +14 -9
  69. package/dist/{solidBuilders-9s-j-ZiW.js → solidBuilders-DQQ0re9T.js} +14 -9
  70. package/dist/{surfaceBuilders-0x7j0ibk.cjs → surfaceBuilders-BXNZydNl.cjs} +7 -5
  71. package/dist/{surfaceBuilders-B7UnwkQz.js → surfaceBuilders-C8k0K7DR.js} +7 -5
  72. package/dist/text.cjs +2 -2
  73. package/dist/text.js +2 -2
  74. package/dist/{textBlueprints-DE3M-E9o.js → textBlueprints-BAyLXffK.js} +36 -21
  75. package/dist/{textBlueprints-BPbIpA4-.cjs → textBlueprints-t8MdWfki.cjs} +37 -22
  76. package/dist/{textMetrics-D3Bly1w4.js → textMetrics-CefI-bMN.js} +3 -2
  77. package/dist/{textMetrics-rRuWxQG_.cjs → textMetrics-DUEI9s5M.cjs} +3 -2
  78. package/dist/{threadFns-BAjFNk2_.js → threadFns-Bau5Sqad.js} +17 -12
  79. package/dist/{threadFns-BMT6ziG_.cjs → threadFns-OVYAleOH.cjs} +17 -12
  80. package/dist/topology.cjs +9 -9
  81. package/dist/topology.js +9 -9
  82. package/dist/{topologyQueryFns-DVhWxBwT.js → topologyQueryFns-QvPyCF-7.js} +1 -1
  83. package/dist/{topologyQueryFns-DZUpJz2p.cjs → topologyQueryFns-gah07J7-.cjs} +1 -1
  84. package/dist/{validityTypes-19mfqWVv.js → validityTypes-DokbYKzd.js} +1 -1
  85. package/dist/{validityTypes-CCnRq3A9.cjs → validityTypes-Dx-04qO0.cjs} +1 -1
  86. package/package.json +7 -7
@@ -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-DuTAcGVX.cjs");
3
+ const require_helpers = require("./helpers-CHYzwQMk.cjs");
4
4
  //#region src/query/cornerFinder.ts
5
5
  var PI_2 = 2 * Math.PI;
6
6
  function positiveHalfAngle(angle) {
@@ -1,4 +1,4 @@
1
- const require_shapeTypes = require("./shapeTypes-DZKuRt24.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-D5Y41q7x.cjs");
2
2
  const require_errors = require("./errors-RHkKO5bZ.cjs");
3
3
  //#region src/topology/curveFns.ts
4
4
  /**
@@ -133,7 +133,8 @@ function flipOrientation(shape) {
133
133
  function interpolateCurve(points, options = {}) {
134
134
  if (points.length < 2) return require_errors.err(require_errors.typeCastError("INTERPOLATE_MIN_POINTS", "Interpolation requires at least 2 points"));
135
135
  try {
136
- const cast = require_shapeTypes.castResultShape(require_shapeTypes.getKernel().interpolatePoints(points, options));
136
+ const result = require_shapeTypes.getKernel().interpolatePoints(points, options);
137
+ const cast = require_shapeTypes.castResultShape(result);
137
138
  if (!require_shapeTypes.isEdge(cast)) {
138
139
  require_shapeTypes.disposeResultShape(cast);
139
140
  return require_errors.err(require_errors.typeCastError("INTERPOLATE_NOT_EDGE", "Interpolation did not produce an edge"));
@@ -153,7 +154,8 @@ function interpolateCurve(points, options = {}) {
153
154
  function approximateCurve(points, options = {}) {
154
155
  if (points.length < 2) return require_errors.err(require_errors.typeCastError("APPROXIMATE_MIN_POINTS", "Approximation requires at least 2 points"));
155
156
  try {
156
- const cast = require_shapeTypes.castResultShape(require_shapeTypes.getKernel().approximatePoints(points, options));
157
+ const result = require_shapeTypes.getKernel().approximatePoints(points, options);
158
+ const cast = require_shapeTypes.castResultShape(result);
157
159
  if (!require_shapeTypes.isEdge(cast)) {
158
160
  require_shapeTypes.disposeResultShape(cast);
159
161
  return require_errors.err(require_errors.typeCastError("APPROXIMATE_NOT_EDGE", "Approximation did not produce an edge"));
@@ -172,12 +174,13 @@ function approximateCurve(points, options = {}) {
172
174
  * @returns Ok with the offset wire, or Err if the operation fails.
173
175
  */
174
176
  function offsetWire2D(wire, offset, kind = "arc") {
175
- const wrapped = require_shapeTypes.castResultShape(require_shapeTypes.getKernel().offsetWire2D(wire.wrapped, offset, {
177
+ const resultShape = require_shapeTypes.getKernel().offsetWire2D(wire.wrapped, offset, {
176
178
  arc: "arc",
177
179
  intersection: "intersection",
178
180
  tangent: "tangent",
179
181
  chamfer: "intersection"
180
- }[kind]));
182
+ }[kind]);
183
+ const wrapped = require_shapeTypes.castResultShape(resultShape);
181
184
  if (!require_shapeTypes.isWire(wrapped)) {
182
185
  require_shapeTypes.disposeResultShape(wrapped);
183
186
  return require_errors.err(require_errors.typeCastError("OFFSET_NOT_WIRE", "Offset did not produce a Wire"));
@@ -1,4 +1,4 @@
1
- import { K as getKernel, T as isWire, h as disposeResultShape, n as castResultShape, v as isEdge } from "./shapeTypes-bHlssytH.js";
1
+ import { K as getKernel, T as isWire, h as disposeResultShape, n as castResultShape, v as isEdge } from "./shapeTypes-BHRboc_x.js";
2
2
  import { E as ok, g as err, l as typeCastError } from "./errors-MHLiNE-C.js";
3
3
  //#region src/topology/curveFns.ts
4
4
  /**
@@ -133,7 +133,8 @@ function flipOrientation(shape) {
133
133
  function interpolateCurve(points, options = {}) {
134
134
  if (points.length < 2) return err(typeCastError("INTERPOLATE_MIN_POINTS", "Interpolation requires at least 2 points"));
135
135
  try {
136
- const cast = castResultShape(getKernel().interpolatePoints(points, options));
136
+ const result = getKernel().interpolatePoints(points, options);
137
+ const cast = castResultShape(result);
137
138
  if (!isEdge(cast)) {
138
139
  disposeResultShape(cast);
139
140
  return err(typeCastError("INTERPOLATE_NOT_EDGE", "Interpolation did not produce an edge"));
@@ -153,7 +154,8 @@ function interpolateCurve(points, options = {}) {
153
154
  function approximateCurve(points, options = {}) {
154
155
  if (points.length < 2) return err(typeCastError("APPROXIMATE_MIN_POINTS", "Approximation requires at least 2 points"));
155
156
  try {
156
- const cast = castResultShape(getKernel().approximatePoints(points, options));
157
+ const result = getKernel().approximatePoints(points, options);
158
+ const cast = castResultShape(result);
157
159
  if (!isEdge(cast)) {
158
160
  disposeResultShape(cast);
159
161
  return err(typeCastError("APPROXIMATE_NOT_EDGE", "Approximation did not produce an edge"));
@@ -172,12 +174,13 @@ function approximateCurve(points, options = {}) {
172
174
  * @returns Ok with the offset wire, or Err if the operation fails.
173
175
  */
174
176
  function offsetWire2D(wire, offset, kind = "arc") {
175
- const wrapped = castResultShape(getKernel().offsetWire2D(wire.wrapped, offset, {
177
+ const resultShape = getKernel().offsetWire2D(wire.wrapped, offset, {
176
178
  arc: "arc",
177
179
  intersection: "intersection",
178
180
  tangent: "tangent",
179
181
  chamfer: "intersection"
180
- }[kind]));
182
+ }[kind]);
183
+ const wrapped = castResultShape(resultShape);
181
184
  if (!isWire(wrapped)) {
182
185
  disposeResultShape(wrapped);
183
186
  return err(typeCastError("OFFSET_NOT_WIRE", "Offset did not produce a Wire"));
@@ -1,22 +1,22 @@
1
- const require_shapeTypes = require("./shapeTypes-DZKuRt24.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-D5Y41q7x.cjs");
2
2
  const require_bug = require("./bug-O02CsAmt.cjs");
3
3
  const require_errors = require("./errors-RHkKO5bZ.cjs");
4
- const require_topologyQueryFns = require("./topologyQueryFns-DZUpJz2p.cjs");
4
+ const require_topologyQueryFns = require("./topologyQueryFns-gah07J7-.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
8
  const require_planeOps = require("./planeOps-VlFxtvzY.cjs");
9
- const require_faceFns = require("./faceFns-UozswcwP.cjs");
10
- const require_curveFns = require("./curveFns-BBLaLG1U.cjs");
9
+ const require_faceFns = require("./faceFns-C4xNv2zn.cjs");
10
+ const require_curveFns = require("./curveFns-BZZYHVow.cjs");
11
11
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
12
- const require_surfaceBuilders = require("./surfaceBuilders-0x7j0ibk.cjs");
13
- const require_blueprintSketcher = require("./blueprintSketcher-Bd5ZS9p6.cjs");
14
- const require_helpers = require("./helpers-DuTAcGVX.cjs");
15
- const require_blueprint = require("./blueprint-BSfG0Uik.cjs");
16
- const require_cornerFinder = require("./cornerFinder-CPwSLgpM.cjs");
17
- const require_boolean2D = require("./boolean2D-Cr6oLsbf.cjs");
18
- const require_textBlueprints = require("./textBlueprints-BPbIpA4-.cjs");
19
- const require_cameraFns = require("./cameraFns-j2I9G3L_.cjs");
12
+ const require_surfaceBuilders = require("./surfaceBuilders-BXNZydNl.cjs");
13
+ const require_blueprintSketcher = require("./blueprintSketcher-4e0yYtCY.cjs");
14
+ const require_helpers = require("./helpers-CHYzwQMk.cjs");
15
+ const require_blueprint = require("./blueprint-CpJLcUJV.cjs");
16
+ const require_cornerFinder = require("./cornerFinder-zEgIFMnk.cjs");
17
+ const require_boolean2D = require("./boolean2D-7heWA1co.cjs");
18
+ const require_textBlueprints = require("./textBlueprints-t8MdWfki.cjs");
19
+ const require_cameraFns = require("./cameraFns-CGwrxgqB.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.
@@ -116,7 +116,8 @@ var Sketcher = class extends require_blueprintSketcher.BaseSketcher2d {
116
116
  var _usingCtx$4 = require_shapeTypes._usingCtx();
117
117
  if (!this.pendingCurves.length) require_bug.bug("Sketcher.buildWire", "No lines to convert into a wire");
118
118
  const scope = _usingCtx$4.u(new require_shapeTypes.DisposalScope());
119
- return require_errors.unwrap(require_surfaceBuilders.assembleWire(require_blueprint.curvesAsEdgesOnPlane(this.pendingCurves, this.plane).map((e) => scope.register(e))));
119
+ const edges = require_blueprint.curvesAsEdgesOnPlane(this.pendingCurves, this.plane).map((e) => scope.register(e));
120
+ return require_errors.unwrap(require_surfaceBuilders.assembleWire(edges));
120
121
  } catch (_) {
121
122
  _usingCtx$4.e = _;
122
123
  } finally {
@@ -145,9 +146,16 @@ var Sketcher = class extends require_blueprintSketcher.BaseSketcher2d {
145
146
  if (require_helpers.samePoint(this.pointer, this.firstPoint)) require_bug.bug("Sketcher.closeWithMirror", "Cannot close with a mirror when the sketch is already closed");
146
147
  const wire = this.buildWire();
147
148
  const pointer3d = require_planeOps.planeToWorld(this.plane, this.pointer);
148
- const normal = require_vecOps.vecCross(require_vecOps.vecNormalize(require_vecOps.vecSub(pointer3d, require_planeOps.planeToWorld(this.plane, this.firstPoint))), this.plane.zDir);
149
+ const firstPoint3d = require_planeOps.planeToWorld(this.plane, this.firstPoint);
150
+ const diff = require_vecOps.vecSub(pointer3d, firstPoint3d);
151
+ const startToEndVector = require_vecOps.vecNormalize(diff);
152
+ const normal = require_vecOps.vecCross(startToEndVector, this.plane.zDir);
149
153
  const clonedWrapped = require_errors.unwrap(require_faceFns.downcast(wire.wrapped));
150
- return new require_textBlueprints.Sketch(require_errors.unwrap(require_surfaceBuilders.assembleWire([wire, require_shapeTypes.createWire(require_errors.unwrap(require_faceFns.downcast(require_shapeTypes.getKernel().mirror(clonedWrapped, require_types.toVec3(pointer3d), require_types.toVec3(normal)))))])), {
154
+ const mirroredRaw = require_shapeTypes.getKernel().mirror(clonedWrapped, require_types.toVec3(pointer3d), require_types.toVec3(normal));
155
+ const mirroredWrapped = require_errors.unwrap(require_faceFns.downcast(mirroredRaw));
156
+ const mirroredWire = require_shapeTypes.createWire(mirroredWrapped);
157
+ const combinedWire = require_errors.unwrap(require_surfaceBuilders.assembleWire([wire, mirroredWire]));
158
+ return new require_textBlueprints.Sketch(combinedWire, {
151
159
  defaultOrigin: this.plane.origin,
152
160
  defaultDirection: this.plane.zDir
153
161
  });
@@ -205,9 +213,10 @@ var FaceSketcher = class extends require_blueprintSketcher.BaseSketcher2d {
205
213
  buildWire() {
206
214
  const kernel = require_shapeTypes.getKernel();
207
215
  const geomSurf = this._adaptSurface();
208
- const wire = require_errors.unwrap(require_surfaceBuilders.assembleWire(this.pendingCurves.map((curve) => {
216
+ const edges = this.pendingCurves.map((curve) => {
209
217
  return require_shapeTypes.createEdge(kernel.buildEdgeOnSurface(curve.wrapped, geomSurf));
210
- })));
218
+ });
219
+ const wire = require_errors.unwrap(require_surfaceBuilders.assembleWire(edges));
211
220
  kernel.buildCurves3d(wire.wrapped);
212
221
  return wire;
213
222
  }
@@ -221,7 +230,8 @@ var FaceSketcher = class extends require_blueprintSketcher.BaseSketcher2d {
221
230
  if (require_curveFns.curveIsClosed(wire)) {
222
231
  const face = scope.register(sketch.clone().face());
223
232
  const origin = require_faceFns.pointOnSurface(face, .5, .5);
224
- const direction = require_vecOps.vecScale(require_faceFns.normalAt(face), -1);
233
+ const normal = require_faceFns.normalAt(face);
234
+ const direction = require_vecOps.vecScale(normal, -1);
225
235
  sketch.defaultOrigin = [
226
236
  origin[0],
227
237
  origin[1],
@@ -302,7 +312,9 @@ var sketchCircle = (radius, planeConfig = {}) => {
302
312
  try {
303
313
  var _usingCtx$2 = require_shapeTypes._usingCtx();
304
314
  const plane = planeConfig.plane && typeof planeConfig.plane !== "string" ? { ...planeConfig.plane } : require_errors.unwrap(require_planeOps.resolvePlane(planeConfig.plane ?? "XY", planeConfig.origin));
305
- return new require_textBlueprints.Sketch(require_errors.unwrap(require_surfaceBuilders.assembleWire([_usingCtx$2.u(new require_shapeTypes.DisposalScope()).register(require_surfaceBuilders.makeCircle(radius, plane.origin, plane.zDir))])), {
315
+ const scope = _usingCtx$2.u(new require_shapeTypes.DisposalScope());
316
+ const wire = require_errors.unwrap(require_surfaceBuilders.assembleWire([scope.register(require_surfaceBuilders.makeCircle(radius, plane.origin, plane.zDir))]));
317
+ return new require_textBlueprints.Sketch(wire, {
306
318
  defaultOrigin: [...plane.origin],
307
319
  defaultDirection: [...plane.zDir]
308
320
  });
@@ -334,7 +346,9 @@ var sketchEllipse = (xRadius = 1, yRadius = 2, planeConfig = {}) => {
334
346
  majR = yRadius;
335
347
  minR = xRadius;
336
348
  }
337
- return new require_textBlueprints.Sketch(require_errors.unwrap(require_surfaceBuilders.assembleWire([_usingCtx3.u(new require_shapeTypes.DisposalScope()).register(require_errors.unwrap(require_surfaceBuilders.makeEllipse(majR, minR, plane.origin, plane.zDir, xDir)))])), {
349
+ const scope = _usingCtx3.u(new require_shapeTypes.DisposalScope());
350
+ const wire = require_errors.unwrap(require_surfaceBuilders.assembleWire([scope.register(require_errors.unwrap(require_surfaceBuilders.makeEllipse(majR, minR, plane.origin, plane.zDir, xDir)))]));
351
+ return new require_textBlueprints.Sketch(wire, {
338
352
  defaultOrigin: [...plane.origin],
339
353
  defaultDirection: [...plane.zDir]
340
354
  });
@@ -440,7 +454,8 @@ var polysideInnerRadius = (outerRadius, sidesCount, sagitta = 0) => {
440
454
  var sketchFaceOffset = (face, offset) => {
441
455
  const defaultOrigin = [...require_faceFns.faceCenter(face)];
442
456
  const defaultDirection = [...require_faceFns.normalAt(face)];
443
- return new require_textBlueprints.Sketch(require_errors.unwrap(require_curveFns.offsetWire2D(require_faceFns.outerWire(face), offset)), {
457
+ const wire = require_errors.unwrap(require_curveFns.offsetWire2D(require_faceFns.outerWire(face), offset));
458
+ return new require_textBlueprints.Sketch(wire, {
444
459
  defaultOrigin,
445
460
  defaultDirection
446
461
  });
@@ -468,7 +483,8 @@ var sketchParametricFunction = (func, planeConfig = {}, { pointsCount = 400, sta
468
483
  const point = func(start + t * stepSize);
469
484
  return require_planeOps.planeToWorld(plane, point);
470
485
  });
471
- return new require_textBlueprints.Sketch(require_errors.unwrap(require_surfaceBuilders.assembleWire([scope.register(require_errors.unwrap(require_surfaceBuilders.makeBSplineApproximation(points, approximationConfig)))])), {
486
+ const wire = require_errors.unwrap(require_surfaceBuilders.assembleWire([scope.register(require_errors.unwrap(require_surfaceBuilders.makeBSplineApproximation(points, approximationConfig)))]));
487
+ return new require_textBlueprints.Sketch(wire, {
472
488
  defaultOrigin: [...plane.origin],
473
489
  defaultDirection: [...plane.zDir]
474
490
  });
@@ -500,7 +516,9 @@ var sketchHelix = (pitch, height, radius, center = [
500
516
  0,
501
517
  1
502
518
  ], lefthand = false) => {
503
- return new require_textBlueprints.Sketch(require_errors.unwrap(require_surfaceBuilders.assembleWire([require_surfaceBuilders.makeHelix(pitch, height, radius, require_types.toVec3(center), require_types.toVec3(dir), lefthand)])));
519
+ const centerVec3 = require_types.toVec3(center);
520
+ const dirVec3 = require_types.toVec3(dir);
521
+ return new require_textBlueprints.Sketch(require_errors.unwrap(require_surfaceBuilders.assembleWire([require_surfaceBuilders.makeHelix(pitch, height, radius, centerVec3, dirVec3, lefthand)])));
504
522
  };
505
523
  //#endregion
506
524
  //#region src/sketching/shortcuts.ts
@@ -552,7 +570,8 @@ function joinMiter(appendCurve, previousLastPoint, firstPoint, previousCurve, cu
552
570
  appendCurve(bevelJoiner);
553
571
  return;
554
572
  }
555
- const miterDist = require_helpers.squareDistance2d([(previousLastPoint[0] + firstPoint[0]) / 2, (previousLastPoint[1] + firstPoint[1]) / 2], offsetIntersectionPoint);
573
+ const midpoint = [(previousLastPoint[0] + firstPoint[0]) / 2, (previousLastPoint[1] + firstPoint[1]) / 2];
574
+ const miterDist = require_helpers.squareDistance2d(midpoint, offsetIntersectionPoint);
556
575
  const endpointDist = require_helpers.squareDistance2d(previousLastPoint, firstPoint);
557
576
  if (endpointDist < 1e-18 || miterDist > 16 * endpointDist) {
558
577
  const bevelJoiner = require_blueprint.make2dSegmentCurve(previousLastPoint, firstPoint);
@@ -837,7 +856,10 @@ function modifyCorners(makeCorner, blueprint, radius, finder) {
837
856
  function modifyCorner2D(makeCorner, shape, radius, finder) {
838
857
  if (shape instanceof require_blueprint.Blueprint) return modifyCorners(makeCorner, shape, radius, finder);
839
858
  if (shape instanceof require_blueprintSketcher.CompoundBlueprint) return new require_blueprintSketcher.CompoundBlueprint(shape.blueprints.map((b) => modifyCorners(makeCorner, b, radius, finder)));
840
- if (shape instanceof require_blueprintSketcher.Blueprints) return new require_blueprintSketcher.Blueprints(shape.blueprints.map((b) => modifyCorner2D(makeCorner, b, radius, finder)).filter((b) => b !== null));
859
+ if (shape instanceof require_blueprintSketcher.Blueprints) {
860
+ const bps = shape.blueprints.map((b) => modifyCorner2D(makeCorner, b, radius, finder)).filter((b) => b !== null);
861
+ return new require_blueprintSketcher.Blueprints(bps);
862
+ }
841
863
  return null;
842
864
  }
843
865
  /**
@@ -1078,10 +1100,16 @@ var Drawing = class Drawing {
1078
1100
  */
1079
1101
  function deserializeDrawing(data) {
1080
1102
  function deserializeHelper(json) {
1081
- if (json["type"] === "CompoundBlueprint") return new require_blueprintSketcher.CompoundBlueprint(json["blueprints"].map(deserializeHelper));
1082
- else if (json["type"] === "Blueprints") return new require_blueprintSketcher.Blueprints(json["blueprints"].map(deserializeHelper));
1083
- else if (json["type"] === "Blueprint") return new require_blueprint.Blueprint(json["curves"].map((c) => require_blueprint.deserializeCurve2D(c)));
1084
- else require_bug.bug("Drawing.deserialize", "Unknown shape type for deserialization");
1103
+ if (json["type"] === "CompoundBlueprint") {
1104
+ const blueprints = json["blueprints"].map(deserializeHelper);
1105
+ return new require_blueprintSketcher.CompoundBlueprint(blueprints);
1106
+ } else if (json["type"] === "Blueprints") {
1107
+ const blueprints = json["blueprints"].map(deserializeHelper);
1108
+ return new require_blueprintSketcher.Blueprints(blueprints);
1109
+ } else if (json["type"] === "Blueprint") {
1110
+ const curves = json["curves"].map((c) => require_blueprint.deserializeCurve2D(c));
1111
+ return new require_blueprint.Blueprint(curves);
1112
+ } else require_bug.bug("Drawing.deserialize", "Unknown shape type for deserialization");
1085
1113
  }
1086
1114
  return new Drawing(deserializeHelper(JSON.parse(data)));
1087
1115
  }
@@ -1299,7 +1327,8 @@ function drawFaceOutline(face) {
1299
1327
  var _usingCtx3 = require_shapeTypes._usingCtx();
1300
1328
  const scope = _usingCtx3.u(new require_shapeTypes.DisposalScope());
1301
1329
  const clonedFace = scope.register(require_shapeTypes.createFace(require_errors.unwrap(require_faceFns.copyShape(face.wrapped))));
1302
- const stitchedCurves = stitchCurves(require_topologyQueryFns.getEdges(scope.register(require_faceFns.outerWire(clonedFace))).map((e) => require_blueprint.edgeToCurve(e, face))).map((s) => new require_blueprint.Blueprint(s));
1330
+ const faceOuterWire = scope.register(require_faceFns.outerWire(clonedFace));
1331
+ const stitchedCurves = stitchCurves(require_topologyQueryFns.getEdges(faceOuterWire).map((e) => require_blueprint.edgeToCurve(e, face))).map((s) => new require_blueprint.Blueprint(s));
1303
1332
  if (stitchedCurves.length === 0) return new Drawing();
1304
1333
  if (stitchedCurves.length === 1) return new Drawing(stitchedCurves[0]);
1305
1334
  return new Drawing(new require_blueprintSketcher.Blueprints(stitchedCurves));
@@ -1,22 +1,22 @@
1
- import { K as getKernel, M as DisposalScope, W as _usingCtx, c as createEdge, l as createFace, p as createWire } from "./shapeTypes-bHlssytH.js";
1
+ import { K as getKernel, M as DisposalScope, W as _usingCtx, c as createEdge, l as createFace, p as createWire } from "./shapeTypes-BHRboc_x.js";
2
2
  import { i as wasmIndex, n as bug } from "./bug-BdOHwn_e.js";
3
3
  import { P as unwrap, s as safeIndex } from "./errors-MHLiNE-C.js";
4
- import { s as getEdges } from "./topologyQueryFns-DVhWxBwT.js";
4
+ import { s as getEdges } from "./topologyQueryFns-QvPyCF-7.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
8
  import { a as planeToWorld, o as resolvePlane } from "./planeOps-CQahLrCx.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-Ce7Fq6j5.js";
10
- import { h as offsetWire2D, i as curveIsClosed, l as curveStartPoint } from "./curveFns-BoHbhtqX.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-fvp_zfuI.js";
10
+ import { h as offsetWire2D, i as curveIsClosed, l as curveStartPoint } from "./curveFns-RczIU30U.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-B7UnwkQz.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-BTGRoQ_G.js";
14
- import { _ as samePoint$1, b as subtract2d, c as add2d, s as PRECISION_OFFSET, y as squareDistance2d } from "./helpers-CZsK8STz.js";
15
- import { _ as Curve2D, a as edgeToCurve, b as BoundingBox2d, c as make2dCircle, d as make2dInerpolatedBSplineCurve, f as make2dSegmentCurve, g as approximateAsSvgCompatibleCurve, i as curvesAsEdgesOnPlane, l as make2dEllipse, o as make2dArcFromCenter, t as Blueprint, v as deserializeCurve2D } from "./blueprint-BGWbpQ-w.js";
16
- import { t as cornerFinder } from "./cornerFinder-CaXBdZz9.js";
17
- import { c as roundedRectangleBlueprint, n as fuse2D, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-zZ9-qR5a.js";
18
- import { _ as wrapSketchDataArray, a as Sketch, g as wrapSketchData, i as Sketches, t as textBlueprints } from "./textBlueprints-DE3M-E9o.js";
19
- import { i as projectEdges, t as cameraFromPlane } from "./cameraFns-CGMawqfi.js";
12
+ import { c as makeBSplineApproximation, d as makeCircle, f as makeEllipse, m as makeHelix, r as makeFace, s as assembleWire } from "./surfaceBuilders-C8k0K7DR.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-BjBjj2cK.js";
14
+ import { _ as samePoint$1, b as subtract2d, c as add2d, s as PRECISION_OFFSET, y as squareDistance2d } from "./helpers-CyLQ07aD.js";
15
+ import { _ as Curve2D, a as edgeToCurve, b as BoundingBox2d, c as make2dCircle, d as make2dInerpolatedBSplineCurve, f as make2dSegmentCurve, g as approximateAsSvgCompatibleCurve, i as curvesAsEdgesOnPlane, l as make2dEllipse, o as make2dArcFromCenter, t as Blueprint, v as deserializeCurve2D } from "./blueprint-CaY00-X2.js";
16
+ import { t as cornerFinder } from "./cornerFinder-C4s6pVZ-.js";
17
+ import { c as roundedRectangleBlueprint, n as fuse2D, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-Bk-VrRyQ.js";
18
+ import { _ as wrapSketchDataArray, a as Sketch, g as wrapSketchData, i as Sketches, t as textBlueprints } from "./textBlueprints-BAyLXffK.js";
19
+ import { i as projectEdges, t as cameraFromPlane } from "./cameraFns-DKEilV2v.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.
@@ -116,7 +116,8 @@ var Sketcher = class extends BaseSketcher2d {
116
116
  var _usingCtx$4 = _usingCtx();
117
117
  if (!this.pendingCurves.length) bug("Sketcher.buildWire", "No lines to convert into a wire");
118
118
  const scope = _usingCtx$4.u(new DisposalScope());
119
- return unwrap(assembleWire(curvesAsEdgesOnPlane(this.pendingCurves, this.plane).map((e) => scope.register(e))));
119
+ const edges = curvesAsEdgesOnPlane(this.pendingCurves, this.plane).map((e) => scope.register(e));
120
+ return unwrap(assembleWire(edges));
120
121
  } catch (_) {
121
122
  _usingCtx$4.e = _;
122
123
  } finally {
@@ -145,9 +146,16 @@ var Sketcher = class extends BaseSketcher2d {
145
146
  if (samePoint$1(this.pointer, this.firstPoint)) bug("Sketcher.closeWithMirror", "Cannot close with a mirror when the sketch is already closed");
146
147
  const wire = this.buildWire();
147
148
  const pointer3d = planeToWorld(this.plane, this.pointer);
148
- const normal = vecCross(vecNormalize(vecSub(pointer3d, planeToWorld(this.plane, this.firstPoint))), this.plane.zDir);
149
+ const firstPoint3d = planeToWorld(this.plane, this.firstPoint);
150
+ const diff = vecSub(pointer3d, firstPoint3d);
151
+ const startToEndVector = vecNormalize(diff);
152
+ const normal = vecCross(startToEndVector, this.plane.zDir);
149
153
  const clonedWrapped = unwrap(downcast(wire.wrapped));
150
- return new Sketch(unwrap(assembleWire([wire, createWire(unwrap(downcast(getKernel().mirror(clonedWrapped, toVec3(pointer3d), toVec3(normal)))))])), {
154
+ const mirroredRaw = getKernel().mirror(clonedWrapped, toVec3(pointer3d), toVec3(normal));
155
+ const mirroredWrapped = unwrap(downcast(mirroredRaw));
156
+ const mirroredWire = createWire(mirroredWrapped);
157
+ const combinedWire = unwrap(assembleWire([wire, mirroredWire]));
158
+ return new Sketch(combinedWire, {
151
159
  defaultOrigin: this.plane.origin,
152
160
  defaultDirection: this.plane.zDir
153
161
  });
@@ -205,9 +213,10 @@ var FaceSketcher = class extends BaseSketcher2d {
205
213
  buildWire() {
206
214
  const kernel = getKernel();
207
215
  const geomSurf = this._adaptSurface();
208
- const wire = unwrap(assembleWire(this.pendingCurves.map((curve) => {
216
+ const edges = this.pendingCurves.map((curve) => {
209
217
  return createEdge(kernel.buildEdgeOnSurface(curve.wrapped, geomSurf));
210
- })));
218
+ });
219
+ const wire = unwrap(assembleWire(edges));
211
220
  kernel.buildCurves3d(wire.wrapped);
212
221
  return wire;
213
222
  }
@@ -221,7 +230,8 @@ var FaceSketcher = class extends BaseSketcher2d {
221
230
  if (curveIsClosed(wire)) {
222
231
  const face = scope.register(sketch.clone().face());
223
232
  const origin = pointOnSurface(face, .5, .5);
224
- const direction = vecScale(normalAt(face), -1);
233
+ const normal = normalAt(face);
234
+ const direction = vecScale(normal, -1);
225
235
  sketch.defaultOrigin = [
226
236
  origin[0],
227
237
  origin[1],
@@ -302,7 +312,9 @@ var sketchCircle = (radius, planeConfig = {}) => {
302
312
  try {
303
313
  var _usingCtx$2 = _usingCtx();
304
314
  const plane = planeConfig.plane && typeof planeConfig.plane !== "string" ? { ...planeConfig.plane } : unwrap(resolvePlane(planeConfig.plane ?? "XY", planeConfig.origin));
305
- return new Sketch(unwrap(assembleWire([_usingCtx$2.u(new DisposalScope()).register(makeCircle(radius, plane.origin, plane.zDir))])), {
315
+ const scope = _usingCtx$2.u(new DisposalScope());
316
+ const wire = unwrap(assembleWire([scope.register(makeCircle(radius, plane.origin, plane.zDir))]));
317
+ return new Sketch(wire, {
306
318
  defaultOrigin: [...plane.origin],
307
319
  defaultDirection: [...plane.zDir]
308
320
  });
@@ -334,7 +346,9 @@ var sketchEllipse = (xRadius = 1, yRadius = 2, planeConfig = {}) => {
334
346
  majR = yRadius;
335
347
  minR = xRadius;
336
348
  }
337
- return new Sketch(unwrap(assembleWire([_usingCtx3.u(new DisposalScope()).register(unwrap(makeEllipse(majR, minR, plane.origin, plane.zDir, xDir)))])), {
349
+ const scope = _usingCtx3.u(new DisposalScope());
350
+ const wire = unwrap(assembleWire([scope.register(unwrap(makeEllipse(majR, minR, plane.origin, plane.zDir, xDir)))]));
351
+ return new Sketch(wire, {
338
352
  defaultOrigin: [...plane.origin],
339
353
  defaultDirection: [...plane.zDir]
340
354
  });
@@ -440,7 +454,8 @@ var polysideInnerRadius = (outerRadius, sidesCount, sagitta = 0) => {
440
454
  var sketchFaceOffset = (face, offset) => {
441
455
  const defaultOrigin = [...faceCenter(face)];
442
456
  const defaultDirection = [...normalAt(face)];
443
- return new Sketch(unwrap(offsetWire2D(outerWire(face), offset)), {
457
+ const wire = unwrap(offsetWire2D(outerWire(face), offset));
458
+ return new Sketch(wire, {
444
459
  defaultOrigin,
445
460
  defaultDirection
446
461
  });
@@ -468,7 +483,8 @@ var sketchParametricFunction = (func, planeConfig = {}, { pointsCount = 400, sta
468
483
  const point = func(start + t * stepSize);
469
484
  return planeToWorld(plane, point);
470
485
  });
471
- return new Sketch(unwrap(assembleWire([scope.register(unwrap(makeBSplineApproximation(points, approximationConfig)))])), {
486
+ const wire = unwrap(assembleWire([scope.register(unwrap(makeBSplineApproximation(points, approximationConfig)))]));
487
+ return new Sketch(wire, {
472
488
  defaultOrigin: [...plane.origin],
473
489
  defaultDirection: [...plane.zDir]
474
490
  });
@@ -500,7 +516,9 @@ var sketchHelix = (pitch, height, radius, center = [
500
516
  0,
501
517
  1
502
518
  ], lefthand = false) => {
503
- return new Sketch(unwrap(assembleWire([makeHelix(pitch, height, radius, toVec3(center), toVec3(dir), lefthand)])));
519
+ const centerVec3 = toVec3(center);
520
+ const dirVec3 = toVec3(dir);
521
+ return new Sketch(unwrap(assembleWire([makeHelix(pitch, height, radius, centerVec3, dirVec3, lefthand)])));
504
522
  };
505
523
  //#endregion
506
524
  //#region src/sketching/shortcuts.ts
@@ -552,7 +570,8 @@ function joinMiter(appendCurve, previousLastPoint, firstPoint, previousCurve, cu
552
570
  appendCurve(bevelJoiner);
553
571
  return;
554
572
  }
555
- const miterDist = squareDistance2d([(previousLastPoint[0] + firstPoint[0]) / 2, (previousLastPoint[1] + firstPoint[1]) / 2], offsetIntersectionPoint);
573
+ const midpoint = [(previousLastPoint[0] + firstPoint[0]) / 2, (previousLastPoint[1] + firstPoint[1]) / 2];
574
+ const miterDist = squareDistance2d(midpoint, offsetIntersectionPoint);
556
575
  const endpointDist = squareDistance2d(previousLastPoint, firstPoint);
557
576
  if (endpointDist < 1e-18 || miterDist > 16 * endpointDist) {
558
577
  const bevelJoiner = make2dSegmentCurve(previousLastPoint, firstPoint);
@@ -837,7 +856,10 @@ function modifyCorners(makeCorner, blueprint, radius, finder) {
837
856
  function modifyCorner2D(makeCorner, shape, radius, finder) {
838
857
  if (shape instanceof Blueprint) return modifyCorners(makeCorner, shape, radius, finder);
839
858
  if (shape instanceof CompoundBlueprint) return new CompoundBlueprint(shape.blueprints.map((b) => modifyCorners(makeCorner, b, radius, finder)));
840
- if (shape instanceof Blueprints) return new Blueprints(shape.blueprints.map((b) => modifyCorner2D(makeCorner, b, radius, finder)).filter((b) => b !== null));
859
+ if (shape instanceof Blueprints) {
860
+ const bps = shape.blueprints.map((b) => modifyCorner2D(makeCorner, b, radius, finder)).filter((b) => b !== null);
861
+ return new Blueprints(bps);
862
+ }
841
863
  return null;
842
864
  }
843
865
  /**
@@ -1078,10 +1100,16 @@ var Drawing = class Drawing {
1078
1100
  */
1079
1101
  function deserializeDrawing(data) {
1080
1102
  function deserializeHelper(json) {
1081
- if (json["type"] === "CompoundBlueprint") return new CompoundBlueprint(json["blueprints"].map(deserializeHelper));
1082
- else if (json["type"] === "Blueprints") return new Blueprints(json["blueprints"].map(deserializeHelper));
1083
- else if (json["type"] === "Blueprint") return new Blueprint(json["curves"].map((c) => deserializeCurve2D(c)));
1084
- else bug("Drawing.deserialize", "Unknown shape type for deserialization");
1103
+ if (json["type"] === "CompoundBlueprint") {
1104
+ const blueprints = json["blueprints"].map(deserializeHelper);
1105
+ return new CompoundBlueprint(blueprints);
1106
+ } else if (json["type"] === "Blueprints") {
1107
+ const blueprints = json["blueprints"].map(deserializeHelper);
1108
+ return new Blueprints(blueprints);
1109
+ } else if (json["type"] === "Blueprint") {
1110
+ const curves = json["curves"].map((c) => deserializeCurve2D(c));
1111
+ return new Blueprint(curves);
1112
+ } else bug("Drawing.deserialize", "Unknown shape type for deserialization");
1085
1113
  }
1086
1114
  return new Drawing(deserializeHelper(JSON.parse(data)));
1087
1115
  }
@@ -1299,7 +1327,8 @@ function drawFaceOutline(face) {
1299
1327
  var _usingCtx3 = _usingCtx();
1300
1328
  const scope = _usingCtx3.u(new DisposalScope());
1301
1329
  const clonedFace = scope.register(createFace(unwrap(copyShape(face.wrapped))));
1302
- const stitchedCurves = stitchCurves(getEdges(scope.register(outerWire(clonedFace))).map((e) => edgeToCurve(e, face))).map((s) => new Blueprint(s));
1330
+ const faceOuterWire = scope.register(outerWire(clonedFace));
1331
+ const stitchedCurves = stitchCurves(getEdges(faceOuterWire).map((e) => edgeToCurve(e, face))).map((s) => new Blueprint(s));
1303
1332
  if (stitchedCurves.length === 0) return new Drawing();
1304
1333
  if (stitchedCurves.length === 1) return new Drawing(stitchedCurves[0]);
1305
1334
  return new Drawing(new Blueprints(stitchedCurves));
@@ -1,6 +1,6 @@
1
- const require_shapeTypes = require("./shapeTypes-DZKuRt24.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-D5Y41q7x.cjs");
2
2
  const require_errors = require("./errors-RHkKO5bZ.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-DZUpJz2p.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-gah07J7-.cjs");
4
4
  const require_types = require("./types-KjA8tY4Y.cjs");
5
5
  //#region src/topology/cast.ts
6
6
  var TOPO_ENUM = {
@@ -180,10 +180,11 @@ function projectPointOnFace(face, point) {
180
180
  const dx = v[0] - projectedPoint[0];
181
181
  const dy = v[1] - projectedPoint[1];
182
182
  const dz = v[2] - projectedPoint[2];
183
+ const distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
183
184
  return require_errors.ok({
184
185
  uv: uvResult,
185
186
  point: projectedPoint,
186
- distance: Math.sqrt(dx * dx + dy * dy + dz * dz)
187
+ distance
187
188
  });
188
189
  } catch (e) {
189
190
  return require_errors.err(require_errors.typeCastError("PROJECTION_FAILED", `Point projection failed: ${e instanceof Error ? e.message : String(e)}`));
@@ -1,6 +1,6 @@
1
- import { K as getKernel, i as castShape } from "./shapeTypes-bHlssytH.js";
1
+ import { K as getKernel, i as castShape } from "./shapeTypes-BHRboc_x.js";
2
2
  import { E as ok, P as unwrap, g as err, l as typeCastError } from "./errors-MHLiNE-C.js";
3
- import { a as getCachedSurfaceType } from "./topologyQueryFns-DVhWxBwT.js";
3
+ import { a as getCachedSurfaceType } from "./topologyQueryFns-QvPyCF-7.js";
4
4
  import { r as toVec3 } from "./types-D24Y27N0.js";
5
5
  //#region src/topology/cast.ts
6
6
  var TOPO_ENUM = {
@@ -125,7 +125,8 @@ var KERNEL_TO_PUBLIC_SURFACE_TYPE = {
125
125
  * @returns Ok with the surface type, or Err for unrecognized kernel surface types.
126
126
  */
127
127
  function getSurfaceType(face) {
128
- return ok(KERNEL_TO_PUBLIC_SURFACE_TYPE[getCachedSurfaceType(face)]);
128
+ const kernelType = getCachedSurfaceType(face);
129
+ return ok(KERNEL_TO_PUBLIC_SURFACE_TYPE[kernelType]);
129
130
  }
130
131
  /** Get the surface type of a face (unwrapped convenience). */
131
132
  function faceGeomType(face) {
@@ -179,10 +180,11 @@ function projectPointOnFace(face, point) {
179
180
  const dx = v[0] - projectedPoint[0];
180
181
  const dy = v[1] - projectedPoint[1];
181
182
  const dz = v[2] - projectedPoint[2];
183
+ const distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
182
184
  return ok({
183
185
  uv: uvResult,
184
186
  point: projectedPoint,
185
- distance: Math.sqrt(dx * dx + dy * dy + dz * dz)
187
+ distance
186
188
  });
187
189
  } catch (e) {
188
190
  return err(typeCastError("PROJECTION_FAILED", `Point projection failed: ${e instanceof Error ? e.message : String(e)}`));