brepjs 18.134.0 → 18.136.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/2d/lib/svgPath.d.ts +0 -11
  2. package/dist/2d.cjs +6 -6
  3. package/dist/2d.js +6 -6
  4. package/dist/{adjacencyFns-CwcdjOsT.js → adjacencyFns-BMgFDWFO.js} +3 -3
  5. package/dist/{adjacencyFns-BhdfZany.cjs → adjacencyFns-Clu4DbkI.cjs} +3 -3
  6. package/dist/{blueprint-DRvc1LOz.js → blueprint-BzDq9Rfb.js} +40 -15
  7. package/dist/{blueprint-BgbVmx4L.cjs → blueprint-CdOcvuG4.cjs} +40 -15
  8. package/dist/{blueprintFns-COSD5yZH.js → blueprintFns-B0wbS9PN.js} +2 -2
  9. package/dist/{blueprintFns-oatmkSjh.cjs → blueprintFns-B6zG47o1.cjs} +2 -2
  10. package/dist/{blueprintSketcher-yZiAeqft.js → blueprintSketcher-DI_qQhBg.js} +3 -3
  11. package/dist/{blueprintSketcher-B5UqD0FO.cjs → blueprintSketcher-DeQYScWX.cjs} +3 -3
  12. package/dist/{boolean2D-p7RMNFtG.cjs → boolean2D-C-Azd06V.cjs} +4 -4
  13. package/dist/{boolean2D-BuM5xJSa.js → boolean2D-CdDn7AFp.js} +4 -4
  14. package/dist/brepjs.cjs +200 -37
  15. package/dist/brepjs.js +201 -38
  16. package/dist/{cameraFns-VVI0cWLa.js → cameraFns-BqSTuHN2.js} +3 -3
  17. package/dist/{cameraFns-i1otOZ0V.cjs → cameraFns-CdPdw2Ma.cjs} +3 -3
  18. package/dist/core.cjs +2 -2
  19. package/dist/core.js +2 -2
  20. package/dist/{cornerFinder-CiHpo7kU.js → cornerFinder-CBNgUcWy.js} +1 -1
  21. package/dist/{cornerFinder-DIe6pMPU.cjs → cornerFinder-WICP_RPb.cjs} +1 -1
  22. package/dist/csg/builders.d.ts +8 -2
  23. package/dist/csg/evaluators/shell.d.ts +5 -0
  24. package/dist/csg/index.d.ts +2 -2
  25. package/dist/csg/serialize.d.ts +1 -1
  26. package/dist/csg/types.d.ts +10 -2
  27. package/dist/{curveFns-jmKL1KZp.cjs → curveFns-BYcLLDAB.cjs} +1 -1
  28. package/dist/{curveFns-Bh_PHl9N.js → curveFns-BtXR6kJ7.js} +1 -1
  29. package/dist/{drawFns-BFktlDIi.js → drawFns-BAwR4uoC.js} +12 -12
  30. package/dist/{drawFns-CP82Xdma.cjs → drawFns-CYW65QTr.cjs} +12 -12
  31. package/dist/{faceFns-C0A8O-2a.cjs → faceFns-B5UiJH4H.cjs} +2 -2
  32. package/dist/{faceFns-CaBQNffu.js → faceFns-BfTHYEiw.js} +2 -2
  33. package/dist/{healingFns-BqmIvfPm.cjs → healingFns-ChcvzVB8.cjs} +4 -4
  34. package/dist/{healingFns-BrrTpxjI.js → healingFns-DAVYFXVB.js} +4 -4
  35. package/dist/{helpers-DLZUxawd.cjs → helpers-C9PIppuU.cjs} +12 -6
  36. package/dist/{helpers-BiqV-wPK.js → helpers-CvwerZfP.js} +7 -7
  37. package/dist/{importFns-ncp_0vEl.cjs → importFns-Bt9YEImO.cjs} +2 -2
  38. package/dist/{importFns-BId6d2pt.js → importFns-DSY1pI70.js} +2 -2
  39. package/dist/io.cjs +2 -2
  40. package/dist/io.js +2 -2
  41. package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
  42. package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
  43. package/dist/{loftFns-m7LoJWE2.js → loftFns-Bl8reWqk.js} +1 -1
  44. package/dist/{loftFns-u-yPHpJ9.cjs → loftFns-CdwKSxw1.cjs} +1 -1
  45. package/dist/{measureFns-CaEuNAZO.cjs → measureFns-B-UbL3Rw.cjs} +3 -3
  46. package/dist/{measureFns-9-1Ng0wR.js → measureFns-DtiZvj_X.js} +3 -3
  47. package/dist/measurement.cjs +1 -1
  48. package/dist/measurement.js +1 -1
  49. package/dist/{meshFns-CB7HsxzB.cjs → meshFns-B461Ku2S.cjs} +3 -3
  50. package/dist/{meshFns-CpfeEN1b.js → meshFns-CqJScqWa.js} +3 -3
  51. package/dist/{occtWasmAdapter-BEe---7w.js → occtWasmAdapter-Bzx2d8zN.js} +39 -10
  52. package/dist/{occtWasmAdapter-DEpy64ji.cjs → occtWasmAdapter-G8mkVxgw.cjs} +39 -10
  53. package/dist/operations.cjs +2 -2
  54. package/dist/operations.js +2 -2
  55. package/dist/{originTrackingFns-JxAlPJXX.js → originTrackingFns-BWA8gv5V.js} +2 -2
  56. package/dist/{originTrackingFns-CKKmLIUH.cjs → originTrackingFns-rh_FbN6R.cjs} +2 -2
  57. package/dist/{primitiveFns-C6Trlz8m.cjs → primitiveFns-BTxppy_Y.cjs} +4 -4
  58. package/dist/{primitiveFns-BSMbMRf1.js → primitiveFns-C-p7jKZt.js} +4 -4
  59. package/dist/projection.cjs +1 -1
  60. package/dist/projection.js +1 -1
  61. package/dist/query.cjs +2 -2
  62. package/dist/query.js +2 -2
  63. package/dist/{refResolveFns-DcyIQSDi.js → refResolveFns-BPnjuRUW.js} +6 -6
  64. package/dist/{refResolveFns-c7RWIsZy.cjs → refResolveFns-DEU2yvJU.cjs} +6 -6
  65. package/dist/{shapeFns-DyDRpo6K.js → shapeFns-s6VgcNkU.js} +2 -2
  66. package/dist/{shapeFns-DDTLk0mJ.cjs → shapeFns-xApQafn6.cjs} +2 -2
  67. package/dist/shapeRef.cjs +1 -1
  68. package/dist/shapeRef.js +1 -1
  69. package/dist/{shapeTypes-pxoxsXIo.js → shapeTypes-D3bntzog.js} +1 -1
  70. package/dist/{shapeTypes-DVExh1xP.cjs → shapeTypes-Dz5JzlYx.cjs} +1 -1
  71. package/dist/sketching.cjs +3 -3
  72. package/dist/sketching.js +3 -3
  73. package/dist/{solidBuilders-CgW7Ge_s.cjs → solidBuilders-B3EZcVNw.cjs} +5 -5
  74. package/dist/{solidBuilders-Devga1Vk.js → solidBuilders-FOfRGZq0.js} +5 -5
  75. package/dist/{surfaceBuilders-DUTDN2Ay.cjs → surfaceBuilders-CVLhWPtB.cjs} +3 -3
  76. package/dist/{surfaceBuilders-B7WlmoVr.js → surfaceBuilders-Dcf7LRqM.js} +3 -3
  77. package/dist/text.cjs +2 -2
  78. package/dist/text.js +2 -2
  79. package/dist/{textBlueprints-BMvBJ79v.cjs → textBlueprints-hV1kO8tW.cjs} +7 -7
  80. package/dist/{textBlueprints-myJW6Fzl.js → textBlueprints-kwXeudLb.js} +7 -7
  81. package/dist/{textMetrics-CPFqh2a1.js → textMetrics-BlhkYGHT.js} +1 -1
  82. package/dist/{textMetrics-Byfb_37y.cjs → textMetrics-BmN3SBkI.cjs} +1 -1
  83. package/dist/{threadFns-B6-3UeCZ.js → threadFns-CQErpnNd.js} +7 -7
  84. package/dist/{threadFns-BQIE5dO9.cjs → threadFns-Dd0C7WLp.cjs} +7 -7
  85. package/dist/topology.cjs +9 -9
  86. package/dist/topology.js +9 -9
  87. package/dist/{topologyQueryFns-BtLGfXgL.cjs → topologyQueryFns-DzYSYw51.cjs} +1 -1
  88. package/dist/{topologyQueryFns-CwYkfE3v.js → topologyQueryFns-qvptbhqO.js} +1 -1
  89. package/dist/{validityTypes-C2nklkrH.cjs → validityTypes-Beci6AC-.cjs} +1 -1
  90. package/dist/{validityTypes-Bl3adWZb.js → validityTypes-DF2h0WJo.js} +1 -1
  91. package/package.json +1 -1
@@ -1,14 +1,3 @@
1
1
  import { Point2D } from './definitions.js';
2
2
  import { Curve2D } from './curve2D.js';
3
- /**
4
- * Convert a 2D curve to an SVG path command string.
5
- *
6
- * Supports lines, degree-1/2/3 Bezier curves, circular arcs, and elliptical
7
- * arcs. The caller must ensure the curve has already been converted to an
8
- * SVG-compatible type (see {@link approximateAsSvgCompatibleCurve}).
9
- *
10
- * @param curve - A `Curve2D` for the segment to render.
11
- * @param lastPoint - The endpoint of the curve, used as the SVG command target.
12
- * @returns An SVG path command such as `L`, `Q`, `C`, or `A`.
13
- */
14
3
  export declare const adaptedCurveToPathElem: (curve: Curve2D, lastPoint: Point2D) => string;
package/dist/2d.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_shapeTypes = require("./shapeTypes-DVExh1xP.cjs");
2
+ const require_shapeTypes = require("./shapeTypes-Dz5JzlYx.cjs");
3
3
  const require_errors = require("./errors-RHkKO5bZ.cjs");
4
- const require_topologyQueryFns = require("./topologyQueryFns-BtLGfXgL.cjs");
5
- const require_blueprintSketcher = require("./blueprintSketcher-B5UqD0FO.cjs");
6
- const require_blueprint = require("./blueprint-BgbVmx4L.cjs");
7
- const require_boolean2D = require("./boolean2D-p7RMNFtG.cjs");
8
- const require_blueprintFns = require("./blueprintFns-oatmkSjh.cjs");
4
+ const require_topologyQueryFns = require("./topologyQueryFns-DzYSYw51.cjs");
5
+ const require_blueprintSketcher = require("./blueprintSketcher-DeQYScWX.cjs");
6
+ const require_blueprint = require("./blueprint-CdOcvuG4.cjs");
7
+ const require_boolean2D = require("./boolean2D-C-Azd06V.cjs");
8
+ const require_blueprintFns = require("./blueprintFns-B6zG47o1.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 { P as createKernelHandle, c as createEdge, q as getKernel2D } from "./shapeTypes-pxoxsXIo.js";
1
+ import { P as createKernelHandle, c as createEdge, q as getKernel2D } from "./shapeTypes-D3bntzog.js";
2
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-CwYkfE3v.js";
4
- import { a as Blueprints, i as CompoundBlueprint, r as organiseBlueprints } from "./blueprintSketcher-yZiAeqft.js";
5
- import { _ as Curve2D, b as BoundingBox2d, t as Blueprint } from "./blueprint-DRvc1LOz.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-BuM5xJSa.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-COSD5yZH.js";
3
+ import { T as kernelCallRaw } from "./topologyQueryFns-qvptbhqO.js";
4
+ import { a as Blueprints, i as CompoundBlueprint, r as organiseBlueprints } from "./blueprintSketcher-DI_qQhBg.js";
5
+ import { _ as Curve2D, b as BoundingBox2d, t as Blueprint } from "./blueprint-BzDq9Rfb.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-CdDn7AFp.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-B0wbS9PN.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 { G as getActiveKernelId, K as getKernel, r as castResultShapeWithKnownType, t as borrowShapeWithKnownType } from "./shapeTypes-pxoxsXIo.js";
2
- import { O as isUnsupportedKernelOperationError } from "./occtWasmAdapter-BEe---7w.js";
3
- import { c as getFaces, f as getVertices, l as getOrCreateCache, s as getEdges } from "./topologyQueryFns-CwYkfE3v.js";
1
+ import { G as getActiveKernelId, K as getKernel, r as castResultShapeWithKnownType, t as borrowShapeWithKnownType } from "./shapeTypes-D3bntzog.js";
2
+ import { O as isUnsupportedKernelOperationError } from "./occtWasmAdapter-Bzx2d8zN.js";
3
+ import { c as getFaces, f as getVertices, l as getOrCreateCache, s as getEdges } from "./topologyQueryFns-qvptbhqO.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-DVExh1xP.cjs");
2
- const require_occtWasmAdapter = require("./occtWasmAdapter-DEpy64ji.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-BtLGfXgL.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-Dz5JzlYx.cjs");
2
+ const require_occtWasmAdapter = require("./occtWasmAdapter-G8mkVxgw.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-DzYSYw51.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 { K as getKernel, L as registerForCleanup, c as createEdge, p as createWire, q as getKernel2D, z as unregisterFromCleanup } from "./shapeTypes-pxoxsXIo.js";
1
+ import { K as getKernel, L as registerForCleanup, c as createEdge, p as createWire, q as getKernel2D, z as unregisterFromCleanup } from "./shapeTypes-D3bntzog.js";
2
2
  import { i as wasmIndex, n as bug } from "./bug-BdOHwn_e.js";
3
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
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-CaBQNffu.js";
8
- import { p as getOrientation } from "./curveFns-Bh_PHl9N.js";
7
+ import { _ as cast, h as uvCoordinates, i as faceGeomType, m as uvBounds, r as faceCenter } from "./faceFns-BfTHYEiw.js";
8
+ import { p as getOrientation } from "./curveFns-BtXR6kJ7.js";
9
9
  import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
10
- import { r as makeFace } from "./surfaceBuilders-B7WlmoVr.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-BiqV-wPK.js";
10
+ import { r as makeFace } from "./surfaceBuilders-Dcf7LRqM.js";
11
+ import { l as add2d, m as normalize2d$1, p as distance2d, t as getSingleFace, v as samePoint, x as subtract2d, y as scalarMultiply2d } from "./helpers-CvwerZfP.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) {
@@ -401,7 +401,7 @@ function approximateAsSvgCompatibleCurve(curves, options = {
401
401
  const kernel = getKernel2D();
402
402
  return curves.flatMap((curve) => {
403
403
  const curveType = curve.geomType;
404
- if (curveType === "ELLIPSE" || curveType === "CIRCLE" && samePoint(curve.firstPoint, curve.lastPoint)) return curve.splitAt([.5]);
404
+ if (curveType === "ELLIPSE" || curveType === "CIRCLE" && samePoint(curve.firstPoint, curve.lastPoint)) return curve.splitAt([(curve.firstParameter + curve.lastParameter) / 2]);
405
405
  if ([
406
406
  "LINE",
407
407
  "ELLIPSE",
@@ -540,6 +540,39 @@ var make2dArcFromCenter = (startPoint, endPoint, center, longArc = false) => {
540
540
  * @param lastPoint - The endpoint of the curve, used as the SVG command target.
541
541
  * @returns An SVG path command such as `L`, `Q`, `C`, or `A`.
542
542
  */
543
+ /** Positive CCW angular distance from `from` to `to`. */
544
+ var ccwFrom = (from, to) => {
545
+ let a = (to - from) % (2 * Math.PI);
546
+ if (a < 0) a += 2 * Math.PI;
547
+ return a;
548
+ };
549
+ /** Emit an `A` command for a circular arc, deriving the large-arc and sweep
550
+ * flags from geometry: trimmed-curve bounds may be normalized rather than
551
+ * angular, so the on-arc midpoint (the parameter midpoint IS the angular
552
+ * midpoint on a circle) decides the traversal direction and which of the
553
+ * two candidate arcs this is. */
554
+ function circleArcPathElem(curve, endX, endY, endpoint) {
555
+ const k2d = getKernel2D();
556
+ const circleData = k2d.getCurve2dCircleData(curve.wrapped);
557
+ if (!circleData) bug("adaptedCurveToPathElem", "Expected circle data");
558
+ const { radius, isDirect } = circleData;
559
+ const [startX, startY] = curve.firstPoint;
560
+ if (samePoint([startX, startY], [endX, endY])) return `A ${radius} ${radius} 0 1 ${isDirect ? "1" : "0"} ${round5(endX)} ${round5(endY + 1e-4)}`;
561
+ const bounds = k2d.getCurve2dBounds(curve.wrapped);
562
+ const [midX, midY] = curve.value((bounds.first + bounds.last) / 2);
563
+ const d = 2 * (startX * (midY - endY) + midX * (endY - startY) + endX * (startY - midY));
564
+ if (Math.abs(d) < Math.hypot(endX - startX, endY - startY) * 1e-6) return `L ${endpoint}`;
565
+ const s2 = startX * startX + startY * startY;
566
+ const m2 = midX * midX + midY * midY;
567
+ const e2 = endX * endX + endY * endY;
568
+ const cx = (s2 * (midY - endY) + m2 * (endY - startY) + e2 * (startY - midY)) / d;
569
+ const cy = (s2 * (endX - midX) + m2 * (startX - endX) + e2 * (midX - startX)) / d;
570
+ const thetaS = Math.atan2(startY - cy, startX - cx);
571
+ const thetaM = Math.atan2(midY - cy, midX - cx);
572
+ const thetaE = Math.atan2(endY - cy, endX - cx);
573
+ const goesCcw = ccwFrom(thetaS, thetaM) <= ccwFrom(thetaS, thetaE);
574
+ return `A ${radius} ${radius} 0 ${(goesCcw ? ccwFrom(thetaS, thetaE) : ccwFrom(thetaE, thetaS)) > Math.PI ? "1" : "0"} ${goesCcw ? "1" : "0"} ${endpoint}`;
575
+ }
543
576
  var adaptedCurveToPathElem = (curve, lastPoint) => {
544
577
  const k2d = getKernel2D();
545
578
  const curveType = curve.geomType;
@@ -561,15 +594,7 @@ var adaptedCurveToPathElem = (curve, lastPoint) => {
561
594
  return `C ${round2(p1x)} ${round2(p1y)} ${round2(p2x)} ${round2(p2y)} ${endpoint}`;
562
595
  }
563
596
  }
564
- if (curveType === "CIRCLE") {
565
- const circleData = k2d.getCurve2dCircleData(curve.wrapped);
566
- if (!circleData) bug("adaptedCurveToPathElem", "Expected circle data");
567
- const { radius, isDirect } = circleData;
568
- const bounds = k2d.getCurve2dBounds(curve.wrapped);
569
- const paramAngle = (bounds.last - bounds.first) * RAD2DEG;
570
- const end = paramAngle !== 360 ? endpoint : `${round5(endX)} ${round5(endY + 1e-4)}`;
571
- return `A ${radius} ${radius} 0 ${Math.abs(paramAngle) > 180 ? "1" : "0"} ${isDirect ? "1" : "0"} ${end}`;
572
- }
597
+ if (curveType === "CIRCLE") return circleArcPathElem(curve, endX, endY, endpoint);
573
598
  if (curveType === "ELLIPSE") {
574
599
  const ellipseData = k2d.getCurve2dEllipseData(curve.wrapped);
575
600
  if (!ellipseData) bug("adaptedCurveToPathElem", "Expected ellipse data");
@@ -1,14 +1,14 @@
1
- const require_shapeTypes = require("./shapeTypes-DVExh1xP.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-Dz5JzlYx.cjs");
2
2
  const require_bug = require("./bug-O02CsAmt.cjs");
3
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
6
  const require_planeOps = require("./planeOps-VlFxtvzY.cjs");
7
- const require_faceFns = require("./faceFns-C0A8O-2a.cjs");
8
- const require_curveFns = require("./curveFns-jmKL1KZp.cjs");
7
+ const require_faceFns = require("./faceFns-B5UiJH4H.cjs");
8
+ const require_curveFns = require("./curveFns-BYcLLDAB.cjs");
9
9
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
10
- const require_surfaceBuilders = require("./surfaceBuilders-DUTDN2Ay.cjs");
11
- const require_helpers = require("./helpers-DLZUxawd.cjs");
10
+ const require_surfaceBuilders = require("./surfaceBuilders-CVLhWPtB.cjs");
11
+ const require_helpers = require("./helpers-C9PIppuU.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) {
@@ -401,7 +401,7 @@ function approximateAsSvgCompatibleCurve(curves, options = {
401
401
  const kernel = require_shapeTypes.getKernel2D();
402
402
  return curves.flatMap((curve) => {
403
403
  const curveType = curve.geomType;
404
- if (curveType === "ELLIPSE" || curveType === "CIRCLE" && require_helpers.samePoint(curve.firstPoint, curve.lastPoint)) return curve.splitAt([.5]);
404
+ if (curveType === "ELLIPSE" || curveType === "CIRCLE" && require_helpers.samePoint(curve.firstPoint, curve.lastPoint)) return curve.splitAt([(curve.firstParameter + curve.lastParameter) / 2]);
405
405
  if ([
406
406
  "LINE",
407
407
  "ELLIPSE",
@@ -540,6 +540,39 @@ var make2dArcFromCenter = (startPoint, endPoint, center, longArc = false) => {
540
540
  * @param lastPoint - The endpoint of the curve, used as the SVG command target.
541
541
  * @returns An SVG path command such as `L`, `Q`, `C`, or `A`.
542
542
  */
543
+ /** Positive CCW angular distance from `from` to `to`. */
544
+ var ccwFrom = (from, to) => {
545
+ let a = (to - from) % (2 * Math.PI);
546
+ if (a < 0) a += 2 * Math.PI;
547
+ return a;
548
+ };
549
+ /** Emit an `A` command for a circular arc, deriving the large-arc and sweep
550
+ * flags from geometry: trimmed-curve bounds may be normalized rather than
551
+ * angular, so the on-arc midpoint (the parameter midpoint IS the angular
552
+ * midpoint on a circle) decides the traversal direction and which of the
553
+ * two candidate arcs this is. */
554
+ function circleArcPathElem(curve, endX, endY, endpoint) {
555
+ const k2d = require_shapeTypes.getKernel2D();
556
+ const circleData = k2d.getCurve2dCircleData(curve.wrapped);
557
+ if (!circleData) require_bug.bug("adaptedCurveToPathElem", "Expected circle data");
558
+ const { radius, isDirect } = circleData;
559
+ const [startX, startY] = curve.firstPoint;
560
+ if (require_helpers.samePoint([startX, startY], [endX, endY])) return `A ${radius} ${radius} 0 1 ${isDirect ? "1" : "0"} ${round5(endX)} ${round5(endY + 1e-4)}`;
561
+ const bounds = k2d.getCurve2dBounds(curve.wrapped);
562
+ const [midX, midY] = curve.value((bounds.first + bounds.last) / 2);
563
+ const d = 2 * (startX * (midY - endY) + midX * (endY - startY) + endX * (startY - midY));
564
+ if (Math.abs(d) < Math.hypot(endX - startX, endY - startY) * 1e-6) return `L ${endpoint}`;
565
+ const s2 = startX * startX + startY * startY;
566
+ const m2 = midX * midX + midY * midY;
567
+ const e2 = endX * endX + endY * endY;
568
+ const cx = (s2 * (midY - endY) + m2 * (endY - startY) + e2 * (startY - midY)) / d;
569
+ const cy = (s2 * (endX - midX) + m2 * (startX - endX) + e2 * (midX - startX)) / d;
570
+ const thetaS = Math.atan2(startY - cy, startX - cx);
571
+ const thetaM = Math.atan2(midY - cy, midX - cx);
572
+ const thetaE = Math.atan2(endY - cy, endX - cx);
573
+ const goesCcw = ccwFrom(thetaS, thetaM) <= ccwFrom(thetaS, thetaE);
574
+ return `A ${radius} ${radius} 0 ${(goesCcw ? ccwFrom(thetaS, thetaE) : ccwFrom(thetaE, thetaS)) > Math.PI ? "1" : "0"} ${goesCcw ? "1" : "0"} ${endpoint}`;
575
+ }
543
576
  var adaptedCurveToPathElem = (curve, lastPoint) => {
544
577
  const k2d = require_shapeTypes.getKernel2D();
545
578
  const curveType = curve.geomType;
@@ -561,15 +594,7 @@ var adaptedCurveToPathElem = (curve, lastPoint) => {
561
594
  return `C ${round2(p1x)} ${round2(p1y)} ${round2(p2x)} ${round2(p2y)} ${endpoint}`;
562
595
  }
563
596
  }
564
- if (curveType === "CIRCLE") {
565
- const circleData = k2d.getCurve2dCircleData(curve.wrapped);
566
- if (!circleData) require_bug.bug("adaptedCurveToPathElem", "Expected circle data");
567
- const { radius, isDirect } = circleData;
568
- const bounds = k2d.getCurve2dBounds(curve.wrapped);
569
- const paramAngle = (bounds.last - bounds.first) * require_constants.RAD2DEG;
570
- const end = paramAngle !== 360 ? endpoint : `${round5(endX)} ${round5(endY + 1e-4)}`;
571
- return `A ${radius} ${radius} 0 ${Math.abs(paramAngle) > 180 ? "1" : "0"} ${isDirect ? "1" : "0"} ${end}`;
572
- }
597
+ if (curveType === "CIRCLE") return circleArcPathElem(curve, endX, endY, endpoint);
573
598
  if (curveType === "ELLIPSE") {
574
599
  const ellipseData = k2d.getCurve2dEllipseData(curve.wrapped);
575
600
  if (!ellipseData) require_bug.bug("adaptedCurveToPathElem", "Expected ellipse data");
@@ -1,6 +1,6 @@
1
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-yZiAeqft.js";
3
- import { t as Blueprint } from "./blueprint-DRvc1LOz.js";
2
+ import { i as CompoundBlueprint } from "./blueprintSketcher-DI_qQhBg.js";
3
+ import { t as Blueprint } from "./blueprint-BzDq9Rfb.js";
4
4
  //#region src/2d/lib/curve2dFns.ts
5
5
  /**
6
6
  * Return a reversed copy of the curve (non-mutating).
@@ -1,6 +1,6 @@
1
1
  const require_errors = require("./errors-RHkKO5bZ.cjs");
2
- const require_blueprintSketcher = require("./blueprintSketcher-B5UqD0FO.cjs");
3
- const require_blueprint = require("./blueprint-BgbVmx4L.cjs");
2
+ const require_blueprintSketcher = require("./blueprintSketcher-DeQYScWX.cjs");
3
+ const require_blueprint = require("./blueprint-CdOcvuG4.cjs");
4
4
  //#region src/2d/lib/curve2dFns.ts
5
5
  /**
6
6
  * Return a reversed copy of the curve (non-mutating).
@@ -1,10 +1,10 @@
1
- import { K as getKernel, q as getKernel2D } from "./shapeTypes-pxoxsXIo.js";
1
+ import { K as getKernel, q as getKernel2D } from "./shapeTypes-D3bntzog.js";
2
2
  import { i as wasmIndex, n as bug } from "./bug-BdOHwn_e.js";
3
3
  import { E as ok, P as unwrap, g as err, n as computationError, s as safeIndex, x as isOk } from "./errors-MHLiNE-C.js";
4
4
  import { r as RAD2DEG, t as DEG2RAD } from "./constants-ITRzCnCp.js";
5
5
  import { t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
6
- import { _ as samePoint, b as subtract2d, c as add2d, d as crossProduct2d, f as distance2d, g as rotate2d, h as polarToCartesian, m as polarAngle2d, u as cartesianToPolar, v as scalarMultiply2d } from "./helpers-BiqV-wPK.js";
7
- import { S as isPoint2D, _ as Curve2D, b as BoundingBox2d, c as make2dCircle, f as make2dSegmentCurve, h as approximateAsBSpline, m as make2dThreePointArc, n as asSVG, o as make2dArcFromCenter, p as make2dTangentArc, r as viewbox, s as make2dBezierCurve, t as Blueprint, u as make2dEllipseArc, y as normalize2d } from "./blueprint-DRvc1LOz.js";
6
+ import { _ as rotate2d, d as cartesianToPolar, f as crossProduct2d, g as polarToCartesian, h as polarAngle2d, l as add2d, p as distance2d, v as samePoint, x as subtract2d, y as scalarMultiply2d } from "./helpers-CvwerZfP.js";
7
+ import { S as isPoint2D, _ as Curve2D, b as BoundingBox2d, c as make2dCircle, f as make2dSegmentCurve, h as approximateAsBSpline, m as make2dThreePointArc, n as asSVG, o as make2dArcFromCenter, p as make2dTangentArc, r as viewbox, s as make2dBezierCurve, t as Blueprint, u as make2dEllipseArc, y as normalize2d } from "./blueprint-BzDq9Rfb.js";
8
8
  //#region node_modules/flatqueue/index.js
9
9
  /**
10
10
  * @typedef {Float64ArrayConstructor | Float32ArrayConstructor |
@@ -1,10 +1,10 @@
1
- const require_shapeTypes = require("./shapeTypes-DVExh1xP.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-Dz5JzlYx.cjs");
2
2
  const require_bug = require("./bug-O02CsAmt.cjs");
3
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-DLZUxawd.cjs");
7
- const require_blueprint = require("./blueprint-BgbVmx4L.cjs");
6
+ const require_helpers = require("./helpers-C9PIppuU.cjs");
7
+ const require_blueprint = require("./blueprint-CdOcvuG4.cjs");
8
8
  //#region node_modules/flatqueue/index.js
9
9
  /**
10
10
  * @typedef {Float64ArrayConstructor | Float32ArrayConstructor |
@@ -1,10 +1,10 @@
1
1
  const require_bug = require("./bug-O02CsAmt.cjs");
2
2
  const require_errors = require("./errors-RHkKO5bZ.cjs");
3
3
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
4
- const require_surfaceBuilders = require("./surfaceBuilders-DUTDN2Ay.cjs");
5
- const require_blueprintSketcher = require("./blueprintSketcher-B5UqD0FO.cjs");
6
- const require_helpers = require("./helpers-DLZUxawd.cjs");
7
- const require_blueprint = require("./blueprint-BgbVmx4L.cjs");
4
+ const require_surfaceBuilders = require("./surfaceBuilders-CVLhWPtB.cjs");
5
+ const require_blueprintSketcher = require("./blueprintSketcher-DeQYScWX.cjs");
6
+ const require_helpers = require("./helpers-C9PIppuU.cjs");
7
+ const require_blueprint = require("./blueprint-CdOcvuG4.cjs");
8
8
  //#region src/2d/blueprints/cannedBlueprints.ts
9
9
  /**
10
10
  * Create a regular polygon blueprint inscribed in a circle of the given radius.
@@ -1,10 +1,10 @@
1
1
  import { i as wasmIndex, n as bug } from "./bug-BdOHwn_e.js";
2
2
  import { P as unwrap, s as safeIndex } from "./errors-MHLiNE-C.js";
3
3
  import { r as lastOrThrow } from "./arrayAccess-DrUGPADn.js";
4
- import { v as zip } from "./surfaceBuilders-B7WlmoVr.js";
5
- import { a as Blueprints, i as CompoundBlueprint, l as intersectCurves, r as organiseBlueprints, t as BlueprintSketcher, u as Flatbush } from "./blueprintSketcher-yZiAeqft.js";
6
- import { _ as samePoint$1, b as subtract2d, d as crossProduct2d, o as PRECISION_INTERSECTION } from "./helpers-BiqV-wPK.js";
7
- import { f as make2dSegmentCurve, t as Blueprint, x as removeDuplicatePoints } from "./blueprint-DRvc1LOz.js";
4
+ import { v as zip } from "./surfaceBuilders-Dcf7LRqM.js";
5
+ import { a as Blueprints, i as CompoundBlueprint, l as intersectCurves, r as organiseBlueprints, t as BlueprintSketcher, u as Flatbush } from "./blueprintSketcher-DI_qQhBg.js";
6
+ import { f as crossProduct2d, o as PRECISION_INTERSECTION, v as samePoint$1, x as subtract2d } from "./helpers-CvwerZfP.js";
7
+ import { f as make2dSegmentCurve, t as Blueprint, x as removeDuplicatePoints } from "./blueprint-BzDq9Rfb.js";
8
8
  //#region src/2d/blueprints/cannedBlueprints.ts
9
9
  /**
10
10
  * Create a regular polygon blueprint inscribed in a circle of the given radius.