flo-mat 3.0.7 → 3.0.10

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 (117) hide show
  1. package/browser/index.js +215 -208
  2. package/browser/index.min.js +1 -1
  3. package/node/closest-boundary-point/cull-bezier-pieces.d.ts +5 -4
  4. package/node/closest-boundary-point/cull-bezier-pieces.js +9 -8
  5. package/node/closest-boundary-point/cull-bezier-pieces.js.map +1 -1
  6. package/node/closest-boundary-point/cull-by-loose-bounding-box.d.ts +2 -2
  7. package/node/closest-boundary-point/cull-by-loose-bounding-box.js +8 -8
  8. package/node/closest-boundary-point/cull-by-loose-bounding-box.js.map +1 -1
  9. package/node/closest-boundary-point/cull-by-tight-boundary-box.d.ts +2 -2
  10. package/node/closest-boundary-point/cull-by-tight-boundary-box.js +8 -8
  11. package/node/closest-boundary-point/cull-by-tight-boundary-box.js.map +1 -1
  12. package/node/closest-boundary-point/get-best-distance-squared.d.ts +1 -1
  13. package/node/closest-boundary-point/get-best-distance-squared.js +6 -6
  14. package/node/closest-boundary-point/get-best-distance-squared.js.map +1 -1
  15. package/node/closest-boundary-point/get-close-boundary-points-certified.d.ts +2 -2
  16. package/node/closest-boundary-point/get-close-boundary-points-certified.js +7 -7
  17. package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -1
  18. package/node/cp-node/cp-node-fs.d.ts +11 -11
  19. package/node/cp-node/cp-node-fs.js +11 -11
  20. package/node/cp-node/cp-node.d.ts +15 -15
  21. package/node/cp-node/fs/get-boundary-bezier-parts-to-next.d.ts +1 -1
  22. package/node/cp-node/fs/get-boundary-bezier-parts-to-next.js +11 -16
  23. package/node/cp-node/fs/get-boundary-bezier-parts-to-next.js.map +1 -1
  24. package/node/cp-node/fs/get-boundary-beziers-between.js +4 -6
  25. package/node/cp-node/fs/get-boundary-beziers-between.js.map +1 -1
  26. package/node/cp-node/fs/get-boundary-beziers-to-next.d.ts +10 -1
  27. package/node/cp-node/fs/get-boundary-beziers-to-next.js +70 -35
  28. package/node/cp-node/fs/get-boundary-beziers-to-next.js.map +1 -1
  29. package/node/cp-node/fs/get-salience.js +2 -2
  30. package/node/cp-node/fs/get-salience.js.map +1 -1
  31. package/node/cp-node/fs/get-speed.js +0 -1
  32. package/node/cp-node/fs/get-speed.js.map +1 -1
  33. package/node/find-2-prong/cull-bezier-pieces.d.ts +4 -4
  34. package/node/find-2-prong/cull-bezier-pieces.js +9 -9
  35. package/node/find-2-prong/cull-bezier-pieces.js.map +1 -1
  36. package/node/find-2-prong/find-2-prong.js +8 -8
  37. package/node/find-2-prong/find-2-prong.js.map +1 -1
  38. package/node/find-2-prong/get-initial-bezier-pieces.d.ts +2 -2
  39. package/node/find-2-prong/get-initial-bezier-pieces.js +2 -2
  40. package/node/find-2-prong/get-initial-bezier-pieces.js.map +1 -1
  41. package/node/find-2-prong/reduce-radius.d.ts +1 -1
  42. package/node/find-2-prong/reduce-radius.js +5 -5
  43. package/node/find-2-prong/reduce-radius.js.map +1 -1
  44. package/node/find-3-prong.ts/calc-better-x.d.ts +2 -2
  45. package/node/find-3-prong.ts/calc-better-x.js +3 -3
  46. package/node/find-3-prong.ts/calc-better-x.js.map +1 -1
  47. package/node/find-3-prong.ts/calc-initial-3-prong-center.d.ts +2 -2
  48. package/node/find-3-prong.ts/calc-initial-3-prong-center.js +3 -3
  49. package/node/find-3-prong.ts/calc-initial-3-prong-center.js.map +1 -1
  50. package/node/find-3-prong.ts/find-3-prong-for-delta3s.d.ts +2 -2
  51. package/node/find-3-prong.ts/find-3-prong-for-delta3s.js +16 -16
  52. package/node/find-3-prong.ts/find-3-prong-for-delta3s.js.map +1 -1
  53. package/node/find-3-prong.ts/find-3-prong.js +2 -2
  54. package/node/find-3-prong.ts/find-3-prong.js.map +1 -1
  55. package/node/find-3-prong.ts/get-closest-points.d.ts +2 -2
  56. package/node/find-3-prong.ts/get-closest-points.js +4 -4
  57. package/node/find-3-prong.ts/get-closest-points.js.map +1 -1
  58. package/node/find-mat/find-mat.js +4 -0
  59. package/node/find-mat/find-mat.js.map +1 -1
  60. package/node/find-mat/get-meta.js.map +1 -1
  61. package/node/index.d.ts +1 -0
  62. package/node/index.js +1 -1
  63. package/node/index.js.map +1 -1
  64. package/node/mat/get-boundary-piece-beziers.js +7 -7
  65. package/node/mat/get-boundary-piece-beziers.js.map +1 -1
  66. package/node/mat/mat.d.ts +1 -1
  67. package/node/point-on-shape/compare-poss.d.ts +3 -3
  68. package/node/point-on-shape/compare-poss.js +3 -3
  69. package/node/point-on-shape/get-osculating-circle.d.ts +1 -1
  70. package/node/point-on-shape/get-osculating-circle.js +1 -1
  71. package/node/point-on-shape/pos-to-human-string.d.ts +1 -1
  72. package/node/point-on-shape/pos-to-human-string.js +1 -1
  73. package/node/sat/cull.d.ts +7 -5
  74. package/node/sat/cull.js +7 -4
  75. package/node/sat/cull.js.map +1 -1
  76. package/node/sat/to-scale-axis.d.ts +3 -2
  77. package/node/sat/to-scale-axis.js +3 -2
  78. package/node/sat/to-scale-axis.js.map +1 -1
  79. package/package.json +5 -5
  80. package/src/closest-boundary-point/cull-bezier-pieces.ts +12 -11
  81. package/src/closest-boundary-point/cull-by-loose-bounding-box.ts +8 -8
  82. package/src/closest-boundary-point/cull-by-tight-boundary-box.ts +8 -8
  83. package/src/closest-boundary-point/get-best-distance-squared.ts +6 -6
  84. package/src/closest-boundary-point/get-close-boundary-points-certified.ts +8 -8
  85. package/src/cp-node/fs/get-boundary-bezier-parts-to-next.ts +12 -18
  86. package/src/cp-node/fs/get-boundary-beziers-between.ts +6 -7
  87. package/src/cp-node/fs/get-boundary-beziers-to-next.ts +79 -53
  88. package/src/cp-node/fs/get-salience.ts +2 -2
  89. package/src/cp-node/fs/get-speed.ts +1 -6
  90. package/src/curve/curve.ts +5 -5
  91. package/src/debug/functions/draw-elem/two-prong.ts +40 -40
  92. package/src/debug/functions/two-prong.ts +195 -195
  93. package/src/debug/two-prong-for-debugging.ts +26 -26
  94. package/src/find-2-prong/add-debug-info.ts +38 -38
  95. package/src/find-2-prong/cull-bezier-pieces.ts +10 -10
  96. package/src/find-2-prong/find-2-prong.ts +8 -8
  97. package/src/find-2-prong/get-initial-bezier-pieces.ts +2 -2
  98. package/src/find-2-prong/reduce-radius.ts +5 -5
  99. package/src/find-3-prong.ts/calc-better-x.ts +3 -3
  100. package/src/find-3-prong.ts/calc-initial-3-prong-center.ts +3 -3
  101. package/src/find-3-prong.ts/find-3-prong-for-delta3s.ts +16 -16
  102. package/src/find-3-prong.ts/find-3-prong.ts +2 -2
  103. package/src/find-3-prong.ts/get-closest-points.ts +4 -4
  104. package/src/find-mat/add-2-prongs-by-error.ts +7 -7
  105. package/src/find-mat/find-mat.ts +6 -0
  106. package/src/find-mat/get-meta.ts +7 -1
  107. package/src/index.ts +2 -2
  108. package/src/mat/get-boundary-piece-beziers.ts +7 -7
  109. package/src/mat/get-two-prong-type.ts +8 -8
  110. package/src/sat/cull.ts +10 -7
  111. package/src/sat/to-scale-axis.ts +18 -17
  112. package/src/utils/bezier-piece-to-bezier.ts +7 -7
  113. package/node/cp-node/fs/cp-nodes-to-boundary-beziers.d.ts +0 -3
  114. package/node/cp-node/fs/cp-nodes-to-boundary-beziers.js +0 -6
  115. package/node/cp-node/fs/cp-nodes-to-boundary-beziers.js.map +0 -1
  116. package/src/closest-boundary-point/get-closest-boundary-point-certified.ts +0 -70
  117. package/src/cp-node/fs/cp-nodes-to-boundary-beziers.ts +0 -10
package/browser/index.js CHANGED
@@ -1,25 +1,3 @@
1
- /******/ // The require scope
2
- /******/ var __webpack_require__ = {};
3
- /******/
4
- /************************************************************************/
5
- /******/ /* webpack/runtime/define property getters */
6
- /******/ (() => {
7
- /******/ // define getter functions for harmony exports
8
- /******/ __webpack_require__.d = (exports, definition) => {
9
- /******/ for(var key in definition) {
10
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
11
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
12
- /******/ }
13
- /******/ }
14
- /******/ };
15
- /******/ })();
16
- /******/
17
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
18
- /******/ (() => {
19
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
20
- /******/ })();
21
- /******/
22
- /************************************************************************/
23
1
 
24
2
  ;// ./node_modules/flo-boolean/node/loop/loop-from-beziers.js
25
3
  /**
@@ -916,10 +894,10 @@ function floydWarshall(graph) {
916
894
 
917
895
  ;// ./src/point-on-shape/compare-poss.ts
918
896
  /**
919
- * Compares two [[PointOnShape]]s according to their cyclic ordering imposed
897
+ * Compares two `PointOnShape`s according to their cyclic ordering imposed
920
898
  * by their relative positions on the shape boundary.
921
- * @param a The first [[PointOnShape]].
922
- * @param b The second [[PointOnShape]].
899
+ * @param a The first `PointOnShape`.
900
+ * @param b The second `PointOnShape`.
923
901
  * @internal
924
902
  */
925
903
  function comparePoss(a, b) {
@@ -3167,7 +3145,7 @@ const cubicDegenPoint = { order: 3, realOrder: 0, collinear: true, nodeType: 'n/
3167
3145
  * possible planar polynomial bezier curves (of order <= 3) are represented and
3168
3146
  * all options are mutually exclusive.
3169
3147
  */
3170
- const classifications = {
3148
+ const classifications = (/* unused pure expression or super */ null && ({
3171
3149
  point,
3172
3150
  lineGeneral,
3173
3151
  lineDegenPoint,
@@ -3184,7 +3162,7 @@ const classifications = {
3184
3162
  cubicDegenCollinearQuad,
3185
3163
  cubicDegenLine,
3186
3164
  cubicDegenPoint
3187
- };
3165
+ }));
3188
3166
  function classify_isPoint(ps) {
3189
3167
  return classify(ps) === point;
3190
3168
  }
@@ -3233,7 +3211,7 @@ function isCubicDegenLine(ps) {
3233
3211
  function isCubicDegenPoint(ps) {
3234
3212
  return classify(ps) === cubicDegenPoint;
3235
3213
  }
3236
- const classification = {
3214
+ const classification = (/* unused pure expression or super */ null && ({
3237
3215
  isPoint: classify_isPoint,
3238
3216
  isLineGeneral,
3239
3217
  isLineDegenPoint,
@@ -3250,7 +3228,7 @@ const classification = {
3250
3228
  isCubicDegenCollinearQuad,
3251
3229
  isCubicDegenLine,
3252
3230
  isCubicDegenPoint,
3253
- };
3231
+ }));
3254
3232
  /**
3255
3233
  * Returns a classification of the given bezier curve.
3256
3234
  *
@@ -6454,7 +6432,6 @@ function getRealProngCount(cpNode) {
6454
6432
 
6455
6433
 
6456
6434
 
6457
- const { min, abs: get_speed_abs } = Math;
6458
6435
  const getSpeed$ = memoize(getSpeed);
6459
6436
  function getSpeed(cpNode) {
6460
6437
  if (getRealProngCount(cpNode) !== 2) {
@@ -6820,79 +6797,109 @@ function getBoundaryBezierPartsToNext(cpNode) {
6820
6797
  if (curveThis.loop !== curveNext.loop) {
6821
6798
  // It is a hole-closer going over to the other loop - a kind of terminal
6822
6799
  // CpNode.
6823
- return undefined;
6800
+ // return undefined;
6801
+ return [];
6824
6802
  }
6825
6803
  const bezierPieces = [];
6826
6804
  if (curveNext === curveThis) {
6827
- bezierPieces.push({
6828
- ps: posThis.curve.ps,
6829
- ts: [posThis.t, posNext.t]
6830
- });
6805
+ bezierPieces.push({ ps: posThis.curve.ps, ts: [posThis.t, posNext.t] });
6831
6806
  }
6832
6807
  else {
6833
- bezierPieces.push({
6834
- ps: posThis.curve.ps,
6835
- ts: [posThis.t, 1]
6836
- });
6837
- addSkippedBeziers(bezierPieces, posThis.curve, posNext.curve, posNext.t);
6808
+ bezierPieces.push({ ps: posThis.curve.ps, ts: [posThis.t, 1] });
6809
+ addSkippedBezierPiecess(bezierPieces, posThis.curve, posNext.curve, posNext.t);
6838
6810
  }
6839
6811
  return bezierPieces;
6840
6812
  }
6841
6813
  /**
6842
- * @internal
6843
6814
  * Adds pieces of skipped beziers.
6815
+ * @internal
6844
6816
  */
6845
- function addSkippedBeziers(bezierPieces, curveStart, curveEnd, t1) {
6817
+ function addSkippedBezierPiecess(bezierPieces, curveStart, curveEnd, t1) {
6846
6818
  let curveThis = curveStart;
6847
6819
  do {
6848
6820
  curveThis = curveThis.next;
6849
- const bezierPart = curveThis === curveEnd
6850
- ? { ps: curveThis.ps, ts: [0, t1] }
6851
- : { ps: curveThis.ps, ts: [0, 1] };
6852
- bezierPieces.push(bezierPart);
6821
+ const tEnd = curveThis === curveEnd ? t1 : 1;
6822
+ bezierPieces.push({
6823
+ ps: curveThis.ps, ts: [0, tEnd]
6824
+ });
6853
6825
  } while (curveThis !== curveEnd);
6854
6826
  }
6855
6827
 
6856
6828
 
6857
6829
  ;// ./src/cp-node/fs/get-boundary-beziers-to-next.ts
6858
6830
 
6859
- function getBoundaryBeziersToNext(cpNode) {
6860
- const cpThis = cpNode;
6861
- const cpNext = cpNode.next;
6862
- const posThis = cpThis.cp.pointOnShape;
6863
- const posNext = cpNext.cp.pointOnShape;
6864
- const curveThis = posThis.curve;
6865
- const curveNext = posNext.curve;
6866
- if (curveThis.loop !== curveNext.loop) {
6867
- // It is a hole-closer going over to the other loop - a kind of terminal
6868
- // CpNode.
6869
- // return undefined!;
6870
- return [];
6871
- }
6872
- const beziers = [];
6873
- if (curveNext === curveThis) {
6874
- beziers.push(fromTo(posThis.curve.ps, posThis.t, posNext.t));
6875
- }
6876
- else {
6877
- beziers.push(fromTo(posThis.curve.ps, posThis.t, 1));
6878
- get_boundary_beziers_to_next_addSkippedBeziers(beziers, posThis.curve, posNext.curve, posNext.t);
6879
- }
6880
- return beziers;
6881
- }
6831
+
6882
6832
  /**
6883
- * Adds pieces of skipped beziers.
6884
- * @internal
6885
- */
6886
- function get_boundary_beziers_to_next_addSkippedBeziers(beziers, curveStart, curveEnd, t1) {
6887
- let curveThis = curveStart;
6888
- do {
6889
- curveThis = curveThis.next;
6890
- const tEnd = curveThis === curveEnd ? t1 : 1;
6891
- beziers.push(
6892
- // qqq from0ToT(curveThis.ps, tEnd)
6893
- fromTo(curveThis.ps, 0, tEnd));
6894
- } while (curveThis !== curveEnd);
6833
+ // * Returns the boundary beziers between this `CpNode` and the next
6834
+ // * one.
6835
+ // *
6836
+ // * * returns `[]` if the next `CpNode` is on a different loop,
6837
+ // * as this is a hole-closer and there are no boundary beziers between them.
6838
+ // *
6839
+ // * @param cpNode
6840
+ // */
6841
+ function getBoundaryBeziersToNext(cpNode) {
6842
+ return getBoundaryBezierPartsToNext(cpNode).map(bp => fromTo(bp.ps, bp.ts[0], bp.ts[1]));
6895
6843
  }
6844
+ // /**
6845
+ // * Returns the boundary beziers between this `CpNode` and the next
6846
+ // * one.
6847
+ // *
6848
+ // * * returns `[]` if the next `CpNode` is on a different loop,
6849
+ // * as this is a hole-closer and there are no boundary beziers between them.
6850
+ // *
6851
+ // * @param cpNode
6852
+ // */
6853
+ // function getBoundaryBeziersToNext(
6854
+ // cpNode: CpNode): number[][][] {
6855
+ // const cpThis = cpNode;
6856
+ // const cpNext = cpNode.next;
6857
+ // const posThis = cpThis.cp.pointOnShape;
6858
+ // const posNext = cpNext.cp.pointOnShape;
6859
+ // const curveThis = posThis.curve;
6860
+ // const curveNext = posNext.curve;
6861
+ // if (curveThis.loop !== curveNext.loop) {
6862
+ // // It is a hole-closer going over to the other loop - a kind of terminal
6863
+ // // CpNode.
6864
+ // // return undefined!;
6865
+ // return [];
6866
+ // }
6867
+ // const beziers: number[][][] = [];
6868
+ // if (curveNext === curveThis) {
6869
+ // beziers.push(
6870
+ // fromTo(posThis.curve.ps, posThis.t, posNext.t)
6871
+ // );
6872
+ // } else {
6873
+ // beziers.push(
6874
+ // fromTo(posThis.curve.ps, posThis.t, 1)
6875
+ // );
6876
+ // addSkippedBeziers(
6877
+ // beziers,
6878
+ // posThis.curve,
6879
+ // posNext.curve,
6880
+ // posNext.t
6881
+ // );
6882
+ // }
6883
+ // return beziers;
6884
+ // }
6885
+ // /**
6886
+ // * Adds pieces of skipped beziers.
6887
+ // * @internal
6888
+ // */
6889
+ // function addSkippedBeziers(
6890
+ // beziers: number[][][],
6891
+ // curveStart: Curve,
6892
+ // curveEnd: Curve,
6893
+ // t1: number) {
6894
+ // let curveThis = curveStart;
6895
+ // do {
6896
+ // curveThis = curveThis.next;
6897
+ // const tEnd = curveThis === curveEnd ? t1 : 1;
6898
+ // beziers.push(
6899
+ // fromTo(curveThis.ps, 0, tEnd)
6900
+ // );
6901
+ // } while (curveThis !== curveEnd);
6902
+ // }
6896
6903
 
6897
6904
 
6898
6905
  ;// ./src/cp-node/fs/remove-cp-node.ts
@@ -7039,13 +7046,6 @@ function getBranchBeziers(cpNode) {
7039
7046
  }
7040
7047
 
7041
7048
 
7042
- ;// ./src/cp-node/fs/cp-nodes-to-boundary-beziers.ts
7043
-
7044
- function cpNodesToBoundaryBeziers(cpNodes) {
7045
- return cpNodes.flatMap(getBoundaryBeziersToNext);
7046
- }
7047
-
7048
-
7049
7049
  ;// ./src/cp-node/fs/get-all-between.ts
7050
7050
  /**
7051
7051
  * Returns all `CpNode`s between the two given ones (excluding the last one).
@@ -7093,11 +7093,9 @@ function getAllBetween(cpNodeS, cpNodeE, inclAllIfEqual = true) {
7093
7093
  * include all `CpNode`s around the loop, otherwise include none.
7094
7094
  */
7095
7095
  function getBoundaryBeziersBetween(cpNode1, cpNode2, inclAllIfEqual = true) {
7096
- const allBetween = getAllBetween(cpNode1, cpNode2, inclAllIfEqual);
7097
- return {
7098
- pss: cpNodesToBoundaryBeziers(allBetween.cpNodes),
7099
- hasHoleCloser: allBetween.hasHoleCloser
7100
- };
7096
+ const { cpNodes, hasHoleCloser } = getAllBetween(cpNode1, cpNode2, inclAllIfEqual);
7097
+ const pss = cpNodes.flatMap(getBoundaryBeziersToNext);
7098
+ return { pss, hasHoleCloser };
7101
7099
  }
7102
7100
 
7103
7101
 
@@ -7126,8 +7124,8 @@ function getSalience(cpNode) {
7126
7124
  const bp1 = cpNode1.cp.pointOnShape.p;
7127
7125
  const bp2 = cpNode2.cp.pointOnShape.p;
7128
7126
  const d = distanceBetween(bp1, bp2);
7129
- const { pss: bps, hasHoleCloser } = getBoundaryBeziersBetween(cpNode1, cpNode2);
7130
- const s = sum(bps.map(ps => totalLength(ps)));
7127
+ const { pss, hasHoleCloser } = getBoundaryBeziersBetween(cpNode1, cpNode2);
7128
+ const s = sum(pss.map(ps => totalLength(ps)));
7131
7129
  return hasHoleCloser ? Number.POSITIVE_INFINITY : s / d;
7132
7130
  }
7133
7131
 
@@ -7217,17 +7215,17 @@ const CpNodeFs = {
7217
7215
  /**
7218
7216
  * Returns the children of this `CpNode` when seen as a MAT edge. Only
7219
7217
  * children in a 'forward' direction are returned. These include all edges
7220
- * except the 'backward' edge given by [[prevOnCircle]], even terminating
7218
+ * except the 'backward' edge given by `prevOnCircle`, even terminating
7221
7219
  * edges.
7222
7220
  */
7223
7221
  getChildren: getChildren,
7224
7222
  /**
7225
- * Similar to [[getChildren]] but returns the child nodes of the tree when
7223
+ * Similar to `getChildren` but returns the child nodes of the tree when
7226
7224
  * `CpNode` is seen as a MAT vertex point (as opposed to edge). In this
7227
7225
  * way the dual graph of the tree can easily be traversed - see e.g.
7228
- * [[traverseVertices]]. Generally, however, traversing the edges is
7226
+ * `traverseVertices`. Generally, however, traversing the edges is
7229
7227
  * preferred as it returns the entire Medial Axis (by utilizing
7230
- * [[getMatCurveToNext]] on each returned edge).
7228
+ * `getMatCurveToNext` on each returned edge).
7231
7229
  */
7232
7230
  getVertexForwardChildren: getVertexForwardChildren,
7233
7231
  /**
@@ -7259,7 +7257,7 @@ const CpNodeFs = {
7259
7257
  * maximal disk. It can be seen as a limiting case of a two-prong where the
7260
7258
  * distance between two of the contact points tend to zero. One point
7261
7259
  * (represented by a `CpNode` of course) will be terminating with the
7262
- * other point being its [[next]], whereas the other point will *not* be
7260
+ * other point being its `next`, whereas the other point will *not* be
7263
7261
  * terminating and 'points' back into the shape.
7264
7262
  */
7265
7263
  isTerminating: isTerminating,
@@ -7278,7 +7276,7 @@ const CpNodeFs = {
7278
7276
  * limiting case of a two-prong having zero radius.
7279
7277
  *
7280
7278
  * Note that two `CpNode`s are stored for each sharp corner, one being
7281
- * terminating and one not. See [[isTerminating]] for more details.
7279
+ * terminating and one not. See `isTerminating` for more details.
7282
7280
  */
7283
7281
  isSharp: isSharp,
7284
7282
  /**
@@ -7287,7 +7285,7 @@ const CpNodeFs = {
7287
7285
  * corners.
7288
7286
  *
7289
7287
  * Note, however, that two `CpNode`s are stored for each such point to
7290
- * preserve symmetry - see [[isTerminating]] for more details.
7288
+ * preserve symmetry - see `isTerminating` for more details.
7291
7289
  */
7292
7290
  isOneProng: isOneProng,
7293
7291
  /**
@@ -7295,15 +7293,15 @@ const CpNodeFs = {
7295
7293
  * by this `CpNode`.
7296
7294
  *
7297
7295
  * Note, however, that even one-prongs and sharp corners will return 2 (see
7298
- * [[isTerminating]] for more details); if this is not desired use
7299
- * [[getRealProngCount]] instead which will return 1 in these cases.
7296
+ * `isTerminating` for more details); if this is not desired use
7297
+ * `getRealProngCount` instead which will return 1 in these cases.
7300
7298
  */
7301
7299
  getProngCount: getProngCount,
7302
7300
  /**
7303
7301
  * Returns the number of contact points (up to planar coordinates) on the
7304
7302
  * maximal disk circle implied by this `CpNode`.
7305
7303
  *
7306
- * See also [[getProngCount]].
7304
+ * See also `getProngCount`.
7307
7305
  */
7308
7306
  getRealProngCount: getRealProngCount,
7309
7307
  /**
@@ -7340,7 +7338,7 @@ const CpNodeFs = {
7340
7338
  * Traverses the MAT tree and calls the given callback function for each vertex
7341
7339
  * (represented by a `CpNode`) on the MAT.
7342
7340
  *
7343
- * It is usually preferable to use [[traverseEdges]] as it allows for the
7341
+ * It is usually preferable to use `traverseEdges` as it allows for the
7344
7342
  * traversal of all the smooth curves representing the MAT.
7345
7343
  * @param cpNode Any `CpNode` representing the start vertex.
7346
7344
  * @param traverseVerticesCallback A callback function taking a single `CpNode` as parameter.
@@ -8263,7 +8261,7 @@ const all_roots_certified_eEstimate = eEstimate;
8263
8261
  const all_roots_certified_hornerWithRunningError = hornerWithRunningError;
8264
8262
  const all_roots_certified_eSign = eSign;
8265
8263
  const all_roots_certified_max = Math.max;
8266
- const all_roots_certified_min = Math.min;
8264
+ const min = Math.min;
8267
8265
  const all_roots_certified_abs = Math.abs;
8268
8266
  const all_roots_certified_eps = Number.EPSILON;
8269
8267
  const onePlusEps = 1 + all_roots_certified_eps;
@@ -8639,7 +8637,7 @@ function allRootsCertified(p, lb = 0, ub = 1, pE, getPExact, returnUndefinedForZ
8639
8637
  mult *= d * onePlusEps;
8640
8638
  }
8641
8639
  // maxDdP is now calculated
8642
- const AMinMax = A_ > 0 ? all_roots_certified_min(_A, A_) : all_roots_certified_max(_A, A_);
8640
+ const AMinMax = A_ > 0 ? min(_A, A_) : all_roots_certified_max(_A, A_);
8643
8641
  const δ = 2 * Number.EPSILON * all_roots_certified_max(1, all_roots_certified_abs(a_));
8644
8642
  const dMax = maxDdP * (2 * δ); // since the first derivative === 0 somewhere in [_a,a_]
8645
8643
  const yShift = A_ > 0 ? -dMax * 2 * δ : dMax * 2 * δ;
@@ -25567,8 +25565,9 @@ const DualSetFs = { has, add: dual_set_add, remove };
25567
25565
 
25568
25566
  const { isOnSameCircle: cull_isOnSameCircle } = CpNodeFs;
25569
25567
  /**
25568
+ * Returns the set of non-trivial forward edges starting from the given `CpNode`.
25570
25569
  *
25571
- * @param cpStart
25570
+ * @param cpStart the start `CpNode`
25572
25571
  */
25573
25572
  function getNonTrivialForwardEdges(cpStart) {
25574
25573
  let cpNode = cpStart;
@@ -25586,12 +25585,14 @@ function getNonTrivialForwardEdges(cpStart) {
25586
25585
  return cps;
25587
25586
  }
25588
25587
  /**
25589
- * @internal
25590
25588
  * Returns the set of Vertices passing the following test: walk the MAT tree and
25591
25589
  * keep all Vertices not in the current cull set and any Vertices that have a
25592
25590
  * non-culled node further down the line toward the tree leaves.
25593
- * @param culls The CpNodes (referred to by circles) that should be culled.
25594
- * @param maxCpNode The start CpNode which must reprsesent the maximal vertex.
25591
+ *
25592
+ * @param culls the `CpNode`s (referred to by circles) that should be culled
25593
+ * @param maxCpNode the start `CpNode` which must represent the maximal vertex
25594
+ *
25595
+ * @internal
25595
25596
  */
25596
25597
  function cull(culls, maxCpNode) {
25597
25598
  const leaves = getLeaves(maxCpNode);
@@ -25741,8 +25742,9 @@ function getSatCulls(cpNode, s) {
25741
25742
  * boundary of the shape. The SAT is a simplification of the MAT that preserves
25742
25743
  * less detail the higher the applied scale factor. The severity at which noise
25743
25744
  * are removed depends on the local scale of the shape.
25744
- * @param mat The Medial Axis Transform ([[Mat]]) on which to apply the SAT.
25745
- * @param s The scale factor >= 1 (e.g. 1.3)
25745
+ *
25746
+ * @param mat the Medial Axis Transform (MAT) on which to apply the SAT
25747
+ * @param s the scale factor >= 1 (e.g. 1.3)
25746
25748
  */
25747
25749
  function toScaleAxis(mat, s) {
25748
25750
  let timingStart = 0;
@@ -26254,13 +26256,13 @@ function getPotentialClosestPointsOnCurveCertified(pow, curve, x, tRange = [0, 1
26254
26256
  * Finds an initial distance such that the closest point can not be further than
26255
26257
  * this distance away.
26256
26258
  */
26257
- function getBestDistanceSquared(bezierPieces, p) {
26259
+ function getBestDistanceSquared(curvePieces, p) {
26258
26260
  let bestSquaredDistance = Number.POSITIVE_INFINITY;
26259
- for (let i = 0; i < bezierPieces.length; i++) {
26260
- const bezierPiece = bezierPieces[i];
26261
- const ps = bezierPiece.curve.ps;
26262
- const p1 = evalDeCasteljau(ps, bezierPiece.ts[0]);
26263
- const p2 = evalDeCasteljau(ps, bezierPiece.ts[1]);
26261
+ for (let i = 0; i < curvePieces.length; i++) {
26262
+ const curvePiece = curvePieces[i];
26263
+ const ps = curvePiece.curve.ps;
26264
+ const p1 = evalDeCasteljau(ps, curvePiece.ts[0]);
26265
+ const p2 = evalDeCasteljau(ps, curvePiece.ts[1]);
26264
26266
  const d = Math.min(squaredDistanceBetween(p, p1), squaredDistanceBetween(p, p2));
26265
26267
  if (d < bestSquaredDistance) {
26266
26268
  bestSquaredDistance = d;
@@ -26335,22 +26337,22 @@ const get_bounding_box_getBoundingBox$ = memoize(getBoundingBox);
26335
26337
  * @internal
26336
26338
  * When checking distances, ignore all those with closest possible distance
26337
26339
  * further than 'bestSquaredDistance', i.e. cull them.
26338
- * @param bezierPieces
26340
+ * @param curvePieces
26339
26341
  * @param p
26340
26342
  * @param dSquared
26341
26343
  */
26342
- function cullByLooseBoundingBox(bezierPieces, p, dSquared) {
26343
- const candidateBezierPieces = [];
26344
- for (let i = 0; i < bezierPieces.length; i++) {
26345
- const bezierPiece = bezierPieces[i];
26346
- const ps = bezierPiece.curve.ps;
26344
+ function cullByLooseBoundingBox(curvePieces, p, dSquared) {
26345
+ const candidateCurvePieces = [];
26346
+ for (let i = 0; i < curvePieces.length; i++) {
26347
+ const curvePiece = curvePieces[i];
26348
+ const ps = curvePiece.curve.ps;
26347
26349
  const boundingBox = get_bounding_box_getBoundingBox$(ps);
26348
26350
  const d = getClosestSquareDistanceToRect(boundingBox, p);
26349
26351
  if (d <= dSquared) {
26350
- candidateBezierPieces.push(bezierPiece);
26352
+ candidateCurvePieces.push(curvePiece);
26351
26353
  }
26352
26354
  }
26353
- return candidateBezierPieces;
26355
+ return candidateCurvePieces;
26354
26356
  }
26355
26357
 
26356
26358
 
@@ -26402,22 +26404,22 @@ const getBoundingBoxTight_ = memoize(getBoundingBoxTight);
26402
26404
  * @internal
26403
26405
  * When checking distances, ignore all those with closest possible distance
26404
26406
  * further than 'bestSquaredDistance', i.e. cull them.
26405
- * @param bezierPieces
26407
+ * @param curvePieces
26406
26408
  * @param p
26407
26409
  * @param bestSquaredDistance
26408
26410
  */
26409
- function cullByTightBoundingBox(bezierPieces, p, bestSquaredDistance) {
26410
- const candidateBezierPieces = [];
26411
- for (let i = 0; i < bezierPieces.length; i++) {
26412
- const bezierPiece = bezierPieces[i];
26413
- const ps = bezierPiece.curve.ps;
26411
+ function cullByTightBoundingBox(curvePieces, p, bestSquaredDistance) {
26412
+ const candidateCurvePieces = [];
26413
+ for (let i = 0; i < curvePieces.length; i++) {
26414
+ const curvePiece = curvePieces[i];
26415
+ const ps = curvePiece.curve.ps;
26414
26416
  const tightBoundingBox = getBoundingBoxTight_(ps);
26415
26417
  const d = getClosestSquaredDistanceToRotatedRect(tightBoundingBox, p);
26416
26418
  if (d <= bestSquaredDistance) {
26417
- candidateBezierPieces.push(bezierPiece);
26419
+ candidateCurvePieces.push(curvePiece);
26418
26420
  }
26419
26421
  }
26420
- return candidateBezierPieces;
26422
+ return candidateCurvePieces;
26421
26423
  }
26422
26424
 
26423
26425
 
@@ -26426,16 +26428,17 @@ function cullByTightBoundingBox(bezierPieces, p, bestSquaredDistance) {
26426
26428
 
26427
26429
 
26428
26430
  /**
26429
- * @internal
26430
- * @param bezierPieces
26431
+ * @param curvePieces
26431
26432
  * @param p
26432
26433
  * @param extreme
26434
+ *
26435
+ * @internal
26433
26436
  */
26434
- function cullBezierPieces1(bezierPieces, p) {
26435
- const bestSquaredDistance = getBestDistanceSquared(bezierPieces, p);
26436
- bezierPieces = cullByLooseBoundingBox(bezierPieces, p, bestSquaredDistance);
26437
- bezierPieces = cullByTightBoundingBox(bezierPieces, p, bestSquaredDistance);
26438
- return bezierPieces;
26437
+ function cullCurvePieces1(curvePieces, p) {
26438
+ const bestSquaredDistance = getBestDistanceSquared(curvePieces, p);
26439
+ curvePieces = cullByLooseBoundingBox(curvePieces, p, bestSquaredDistance);
26440
+ curvePieces = cullByTightBoundingBox(curvePieces, p, bestSquaredDistance);
26441
+ return curvePieces;
26439
26442
  }
26440
26443
 
26441
26444
 
@@ -26449,19 +26452,19 @@ function cullBezierPieces1(bezierPieces, p) {
26449
26452
  * bezier pieces, including the beziers actually checked after culling.
26450
26453
  *
26451
26454
  * @param pow
26452
- * @param bezierPieces
26455
+ * @param curvePieces
26453
26456
  * @param x
26454
26457
  * @param touchedCurve
26455
26458
  * @param t
26456
26459
  * @param for1Prong defaults to `false`;
26457
26460
  * @param angle defaults to `0`
26458
26461
  */
26459
- function getCloseBoundaryPointsCertified(pow, bezierPieces, x, touchedCurve = undefined, t = undefined, for1Prong = false, angle = 0) {
26460
- bezierPieces = cullBezierPieces1(bezierPieces, x);
26462
+ function getCloseBoundaryPointsCertified(pow, curvePieces, x, touchedCurve = undefined, t = undefined, for1Prong = false, angle = 0) {
26463
+ curvePieces = cullCurvePieces1(curvePieces, x);
26461
26464
  const pInfoss = [];
26462
- for (let i = 0; i < bezierPieces.length; i++) {
26463
- const bezierPiece = bezierPieces[i];
26464
- const pInfos = getPotentialClosestPointsOnCurveCertified(pow, bezierPiece.curve, x, bezierPiece.ts, touchedCurve, t, for1Prong, angle);
26465
+ for (let i = 0; i < curvePieces.length; i++) {
26466
+ const curvePiece = curvePieces[i];
26467
+ const pInfos = getPotentialClosestPointsOnCurveCertified(pow, curvePiece.curve, x, curvePiece.ts, touchedCurve, t, for1Prong, angle);
26465
26468
  pInfoss.push(...pInfos);
26466
26469
  }
26467
26470
  /** the minimum max interval value */
@@ -26494,14 +26497,14 @@ const { max: calc_initial_3_prong_center_max, ceil, log2 } = Math;
26494
26497
  * must be within the shape.
26495
26498
  * @param δ3s - The three boundary pieces of which we need to find the three
26496
26499
  * 3-prong points.
26497
- * @param bezierPiece3s
26500
+ * @param curvePiece3s
26498
26501
  * @param extreme
26499
26502
  */
26500
- function calcInitial3ProngCenter(maxCoordinate, δ3s, bezierPiece3s) {
26503
+ function calcInitial3ProngCenter(maxCoordinate, δ3s, curvePiece3s) {
26501
26504
  const circle = δ3s[0][0].cp.circle;
26502
26505
  const twoProngCircleCenter = circle.center;
26503
26506
  const pow = calc_initial_3_prong_center_max(0, ceil(log2(maxCoordinate / circle.radius))) + 1; // determines accuracy;
26504
- const pos = getCloseBoundaryPointsCertified(pow, bezierPiece3s[1], twoProngCircleCenter)[0];
26507
+ const pos = getCloseBoundaryPointsCertified(pow, curvePiece3s[1], twoProngCircleCenter)[0];
26505
26508
  const meanPoints = [
26506
26509
  δ3s[0][0].cp.pointOnShape.p,
26507
26510
  pos.p,
@@ -26516,13 +26519,13 @@ function calcInitial3ProngCenter(maxCoordinate, δ3s, bezierPiece3s) {
26516
26519
  /**
26517
26520
  * @internal
26518
26521
  * @param x
26519
- * @param bezierPiece3s
26522
+ * @param curvePiece3s
26520
26523
  * @param extreme
26521
26524
  */
26522
- function getClosestPoints(x, bezierPiece3s) {
26523
- return bezierPiece3s.map(bezierPieces => {
26525
+ function getClosestPoints(x, curvePiece3s) {
26526
+ return curvePiece3s.map(curvePieces => {
26524
26527
  return getCloseBoundaryPointsCertified(5, // TODO - see find-2-prong
26525
- bezierPieces, x)[0];
26528
+ curvePieces, x)[0];
26526
26529
  });
26527
26530
  }
26528
26531
 
@@ -26546,13 +26549,13 @@ function scale(p, c) {
26546
26549
  * Find new x and ps that are a better estimate of the 3-prong circle.
26547
26550
  * The potential function, V, is defined as the distance to the actual 3 prong
26548
26551
  * circle center.
26549
- * @param bezierPiece3s The three boundary pieces, each of which should contain
26552
+ * @param curvePiece3s The three boundary pieces, each of which should contain
26550
26553
  * a point of the 3-prong to be found.
26551
26554
  * @param x The currently best guess at the center of the 3-prong circle.
26552
26555
  * @param vectorToZeroV
26553
26556
  * @param extreme
26554
26557
  */
26555
- function calcBetterX(bezierPiece3s, x, vectorToZeroV) {
26558
+ function calcBetterX(curvePiece3s, x, vectorToZeroV) {
26556
26559
  const V = len(vectorToZeroV);
26557
26560
  let nu = 1;
26558
26561
  let better;
@@ -26563,7 +26566,7 @@ function calcBetterX(bezierPiece3s, x, vectorToZeroV) {
26563
26566
  do {
26564
26567
  const shift = scale(vectorToZeroV, nu);
26565
26568
  newX = translate(shift, x);
26566
- newPoss = getClosestPoints(newX, bezierPiece3s);
26569
+ newPoss = getClosestPoints(newX, curvePiece3s);
26567
26570
  // Point of zero V
26568
26571
  const newCircleCenter = circumCenter(newPoss.map(pos => pos.p));
26569
26572
  const newVectorToZeroV = from_to_fromTo(newX, newCircleCenter);
@@ -26595,11 +26598,11 @@ const calcVectorToZeroV_StraightToIt = from_to_fromTo;
26595
26598
  * Finds a 3-prong using only the 3 given δs.
26596
26599
  * @param δs The boundary pieces
26597
26600
  * @param idx δ identifier
26598
- * @param bezierPiecess
26601
+ * @param curvePiecess
26599
26602
  * @param maxCoordinate The maximum coordinate value used to calculate floating point
26600
26603
  * tolerances.
26601
26604
  */
26602
- function find3ProngForDelta3s(δs, idx, k, bezierPiecess, maxCoordinate) {
26605
+ function find3ProngForDelta3s(δs, idx, k, curvePiecess, maxCoordinate) {
26603
26606
  const TOLERANCE = 2 ** -32 * maxCoordinate;
26604
26607
  const MAX_ITERATIONS = 10;
26605
26608
  const δs_ = [
@@ -26607,34 +26610,34 @@ function find3ProngForDelta3s(δs, idx, k, bezierPiecess, maxCoordinate) {
26607
26610
  δs[idx],
26608
26611
  δs[δs.length - 1]
26609
26612
  ];
26610
- const bezierPieces_ = [
26611
- bezierPiecess[0],
26612
- bezierPiecess[idx],
26613
- bezierPiecess[δs.length - 1]
26613
+ const curvePieces_ = [
26614
+ curvePiecess[0],
26615
+ curvePiecess[idx],
26616
+ curvePiecess[δs.length - 1]
26614
26617
  ];
26615
26618
  const δ3ss = [
26616
26619
  [δs_[0], δs_[1], δs_[2]],
26617
26620
  [δs_[1], δs_[2], δs_[0]],
26618
26621
  [δs_[2], δs_[0], δs_[1]],
26619
26622
  ];
26620
- const bezierPiecess_ = [
26621
- [bezierPieces_[0], bezierPieces_[1], bezierPieces_[2]],
26622
- [bezierPieces_[1], bezierPieces_[2], bezierPieces_[0]],
26623
- [bezierPieces_[2], bezierPieces_[0], bezierPieces_[1]],
26623
+ const curvePiecess_ = [
26624
+ [curvePieces_[0], curvePieces_[1], curvePieces_[2]],
26625
+ [curvePieces_[1], curvePieces_[2], curvePieces_[0]],
26626
+ [curvePieces_[2], curvePieces_[0], curvePieces_[1]],
26624
26627
  ];
26625
26628
  const δ3s = δ3ss[k];
26626
- const bezierPiece3s = bezierPiecess_[k];
26629
+ const curvePiece3s = curvePiecess_[k];
26627
26630
  if (find_3_prong_for_delta3s_isSharp(δ3s[0][0])) {
26628
26631
  return undefined;
26629
26632
  }
26630
26633
  let poss = undefined;
26631
26634
  let circumCenter_;
26632
26635
  let j = 0; // Safeguard for slow convergence
26633
- let x = calcInitial3ProngCenter(maxCoordinate, δ3s, bezierPiece3s);
26636
+ let x = calcInitial3ProngCenter(maxCoordinate, δ3s, curvePiece3s);
26634
26637
  let tolerance = Number.POSITIVE_INFINITY;
26635
26638
  while (tolerance > TOLERANCE && j < MAX_ITERATIONS) {
26636
26639
  j++;
26637
- poss = getClosestPoints(x, bezierPiece3s);
26640
+ poss = getClosestPoints(x, curvePiece3s);
26638
26641
  if (!Number.isFinite(x[0]) || !Number.isFinite(x[1])) {
26639
26642
  // TODO - the code can be cleaned up and sped up a lot if we don't
26640
26643
  // use this function as is but instead use δs[0] and δs[2] as is
@@ -26651,7 +26654,7 @@ function find3ProngForDelta3s(δs, idx, k, bezierPiecess, maxCoordinate) {
26651
26654
  // loop. This check, for instance, would be eliminated completely.
26652
26655
  return undefined;
26653
26656
  }
26654
- const upds = calcBetterX(bezierPiece3s, x, vectorToZeroV);
26657
+ const upds = calcBetterX(curvePiece3s, x, vectorToZeroV);
26655
26658
  x = upds.newX;
26656
26659
  poss = upds.newPoss;
26657
26660
  const V = len(vectorToZeroV); // The 'potential'
@@ -26712,9 +26715,9 @@ function find3ProngForDelta3s(δs, idx, k, bezierPiecess, maxCoordinate) {
26712
26715
  // candidate for the 3-prong.
26713
26716
  //-------------------------------------------------------------------------
26714
26717
  const closestDs = [];
26715
- for (let i = 0; i < bezierPiecess.length; i++) {
26718
+ for (let i = 0; i < curvePiecess.length; i++) {
26716
26719
  const p = getCloseBoundaryPointsCertified(5, // TODO - see find-2-prong
26717
- bezierPiecess[i], x)[0];
26720
+ curvePiecess[i], x)[0];
26718
26721
  closestDs.push(distanceBetween(p.p, x));
26719
26722
  }
26720
26723
  const closestD = Math.min(...closestDs);
@@ -26756,7 +26759,7 @@ const isPosQuiteSharpCorner = memoize((pos) => {
26756
26759
  function getBoundaryPieceBeziers(cpNodes) {
26757
26760
  let cpThis = cpNodes[0];
26758
26761
  const cpEnd = cpNodes[1];
26759
- const bezierPieces = [];
26762
+ const curvePieces = [];
26760
26763
  // As opposed to going around the circle and taking the last exit
26761
26764
  let goStraight = true;
26762
26765
  do {
@@ -26775,28 +26778,28 @@ function getBoundaryPieceBeziers(cpNodes) {
26775
26778
  }
26776
26779
  else if (posNext.curve === posThis.curve &&
26777
26780
  compareCps(cpThis.next.cp, cpThis.cp) > 0) {
26778
- bezierPieces.push({ curve: posThis.curve, ts: [posThis.t, posNext.t] });
26781
+ curvePieces.push({ curve: posThis.curve, ts: [posThis.t, posNext.t] });
26779
26782
  }
26780
26783
  else {
26781
- bezierPieces.push({ curve: posThis.curve, ts: [posThis.t, 1] });
26784
+ curvePieces.push({ curve: posThis.curve, ts: [posThis.t, 1] });
26782
26785
  if (posThis.curve.loop === posNext.curve.loop) {
26783
- get_boundary_piece_beziers_addSkippedBeziers(bezierPieces, posThis.curve, posNext.curve, posNext.t);
26786
+ addSkippedBeziers(curvePieces, posThis.curve, posNext.curve, posNext.t);
26784
26787
  }
26785
26788
  }
26786
26789
  cpThis = cpThis.next;
26787
26790
  } while (cpThis !== cpEnd);
26788
- return bezierPieces;
26791
+ return curvePieces;
26789
26792
  }
26790
26793
  /**
26791
26794
  * @internal
26792
26795
  * Adds pieces of skipped beziers
26793
26796
  */
26794
- function get_boundary_piece_beziers_addSkippedBeziers(bezierPieces, curveStart, curveEnd, t1) {
26797
+ function addSkippedBeziers(curvePieces, curveStart, curveEnd, t1) {
26795
26798
  let curveThis = curveStart;
26796
26799
  do {
26797
26800
  curveThis = curveThis.next;
26798
26801
  const tEnd = curveThis === curveEnd ? t1 : 1;
26799
- bezierPieces.push({ curve: curveThis, ts: [0, tEnd] });
26802
+ curvePieces.push({ curve: curveThis, ts: [0, tEnd] });
26800
26803
  } while (curveThis !== curveEnd);
26801
26804
  }
26802
26805
 
@@ -26812,13 +26815,13 @@ function get_boundary_piece_beziers_addSkippedBeziers(bezierPieces, curveStart,
26812
26815
  * tolerances.
26813
26816
  */
26814
26817
  function find3Prong(δs, extreme) {
26815
- const bezierPiecess = δs.map(getBoundaryPieceBeziers);
26818
+ const curvePiecess = δs.map(getBoundaryPieceBeziers);
26816
26819
  // The best candidate amongst the different 'permutations' of the given δs.
26817
26820
  let threeProng;
26818
26821
  let smallestError = Number.POSITIVE_INFINITY;
26819
26822
  for (let i = 1; i < δs.length - 1; i++) {
26820
26823
  for (let k = 0; k < 3; k++) {
26821
- const threeProngInfo = find3ProngForDelta3s(δs, i, k, bezierPiecess, extreme);
26824
+ const threeProngInfo = find3ProngForDelta3s(δs, i, k, curvePiecess, extreme);
26822
26825
  if (!threeProngInfo) {
26823
26826
  continue;
26824
26827
  }
@@ -27714,7 +27717,7 @@ function tangentExact(ps, t) {
27714
27717
  *
27715
27718
  * @param minCurvature If not Number.POSITIVE_INFINITY then the
27716
27719
  * circle radius will be limited to this value.
27717
- * @param pos The [[PointOnShape]] identifying the point.
27720
+ * @param pos The `PointOnShape` identifying the point.
27718
27721
  * @param useMaxRadius
27719
27722
  */
27720
27723
  function getOsculatingCircle(minCurvature, pos,
@@ -27801,7 +27804,7 @@ function findEquidistantPointOnLineDd(x, y, z) {
27801
27804
 
27802
27805
 
27803
27806
  /** @internal */
27804
- function getInitialBezierPieces(angle, isHoleClosing, loop, loops,
27807
+ function getInitialCurvePieces(angle, isHoleClosing, loop, loops,
27805
27808
  // cpTrees: Map<Loop,LlRbTree<CpNode>>,
27806
27809
  meta, y, circle) {
27807
27810
  const { cpTrees } = meta;
@@ -27838,16 +27841,16 @@ meta, y, circle) {
27838
27841
  *
27839
27842
  * Reduces the circle radius initially as an optimization step.
27840
27843
  */
27841
- function reduceRadius(extreme, bezierPieces, p, x) {
27844
+ function reduceRadius(extreme, curvePieces, p, x) {
27842
27845
  const TOLERANCE = 1 + 2 ** -10;
27843
27846
  let minRadius = Number.POSITIVE_INFINITY;
27844
- for (let i = 0; i < bezierPieces.length; i++) {
27845
- const bezierPiece = bezierPieces[i];
27846
- const ps = bezierPiece.curve.ps;
27847
+ for (let i = 0; i < curvePieces.length; i++) {
27848
+ const curvePiece = curvePieces[i];
27849
+ const ps = curvePiece.curve.ps;
27847
27850
  // let min = Number.POSITIVE_INFINITY;
27848
27851
  const num = 2;
27849
27852
  for (let j = 0; j < (num + 1); j++) {
27850
- const p_ = evalDeCasteljau(ps, bezierPiece.ts[j / num]);
27853
+ const p_ = evalDeCasteljau(ps, curvePiece.ts[j / num]);
27851
27854
  const cc = getCircleCenterFrom2PointsAndNormal(extreme, p, x, p_);
27852
27855
  if (cc) {
27853
27856
  let r = squaredDistanceBetween(p, cc);
@@ -27917,24 +27920,24 @@ function squaredDistanceBetweenDd(x, y) {
27917
27920
 
27918
27921
  /**
27919
27922
  * @internal
27920
- * Cull all bezierPieces not within given radius of a given point.
27923
+ * Cull all curvePieces not within given radius of a given point.
27921
27924
  * @param extreme
27922
- * @param bezierPieces
27925
+ * @param curvePieces
27923
27926
  * @param p
27924
27927
  * @param rSquared
27925
27928
  */
27926
- function cullBezierPieces2(bezierPieces, p, rSquared) {
27929
+ function cullCurvePieces2(curvePieces, p, rSquared) {
27927
27930
  const TOLERANCE = 1 + 2 ** -10;
27928
- if (bezierPieces.length <= 1) {
27929
- return bezierPieces;
27931
+ if (curvePieces.length <= 1) {
27932
+ return curvePieces;
27930
27933
  }
27931
27934
  const newPieces = [];
27932
- for (const bezierPiece of bezierPieces) {
27933
- const ps = bezierPiece.curve.ps;
27935
+ for (const curvePiece of curvePieces) {
27936
+ const ps = curvePiece.curve.ps;
27934
27937
  const rect = get_bounding_box_getBoundingBox$(ps);
27935
27938
  const bd = getClosestSquareDistanceToRect(rect, p);
27936
27939
  if (bd <= TOLERANCE * rSquared) {
27937
- newPieces.push(bezierPiece);
27940
+ newPieces.push(curvePiece);
27938
27941
  }
27939
27942
  }
27940
27943
  return newPieces;
@@ -28138,12 +28141,12 @@ function find2Prong(meta, isHoleClosing, for1Prong, angle, y) {
28138
28141
  const p = y.p;
28139
28142
  // The boundary piece that should contain the other point of
28140
28143
  // the 2-prong circle. (Defined by start and end points).
28141
- let bezierPieces = getInitialBezierPieces(angle, isHoleClosing, loop, loops, meta, y, { center: xO, radius: rO });
28142
- // console.log(bezierPieces.length);
28144
+ let curvePieces = getInitialCurvePieces(angle, isHoleClosing, loop, loops, meta, y, { center: xO, radius: rO });
28145
+ // console.log(curvePieces.length);
28143
28146
  /** The center of the two-prong (successively refined) */
28144
28147
  let x = xO;
28145
28148
  // The lines below is an optimization.
28146
- const r_ = find_2_prong_sqrt(reduceRadius(maxCoordinate, bezierPieces, p, xO));
28149
+ const r_ = find_2_prong_sqrt(reduceRadius(maxCoordinate, curvePieces, p, xO));
28147
28150
  if (rO > r_) {
28148
28151
  x = interpolate(p, xO, r_ / rO);
28149
28152
  }
@@ -28154,11 +28157,11 @@ function find2Prong(meta, isHoleClosing, for1Prong, angle, y) {
28154
28157
  while (i < MAX_ITERATIONS) {
28155
28158
  const xy = squaredDistanceBetweenDd(x, y.p);
28156
28159
  if (i < 2) {
28157
- bezierPieces = cullBezierPieces2(bezierPieces, x, xy);
28160
+ curvePieces = cullCurvePieces2(curvePieces, x, xy);
28158
28161
  }
28159
28162
  const pow = find_2_prong_max(0, find_2_prong_ceil(find_2_prong_log2(maxCoordinate / xy))) + 1; // determines accuracy
28160
28163
  // console.log(pow);
28161
- const _zs = getCloseBoundaryPointsCertified(pow, bezierPieces, x, y.curve, y.t, for1Prong && i == 0 && rO !== 1 / minCurvature, angle).map(info => createPos(info.curve, info.t, false));
28164
+ const _zs = getCloseBoundaryPointsCertified(pow, curvePieces, x, y.curve, y.t, for1Prong && i == 0 && rO !== 1 / minCurvature, angle).map(info => createPos(info.curve, info.t, false));
28162
28165
  let maxD = Number.NEGATIVE_INFINITY;
28163
28166
  let maxPos = undefined;
28164
28167
  zs = [];
@@ -28216,7 +28219,7 @@ function find2Prong(meta, isHoleClosing, for1Prong, angle, y) {
28216
28219
  }
28217
28220
  }
28218
28221
  const circle = { center: x, radius: distanceBetween(x, z.p) };
28219
- // if (typeof _debug_ !== 'undefined') { addDebugInfo(bezierPieces, false, x, y, z, circle!, δ!, xs, isHoleClosing); }
28222
+ // if (typeof _debug_ !== 'undefined') { addDebugInfo(curvePieces, false, x, y, z, circle!, δ!, xs, isHoleClosing); }
28220
28223
  // return { circle, zs };
28221
28224
  // zs = zs.filter(z => z !== undefined)
28222
28225
  return { circle, zs: [z] };
@@ -29055,6 +29058,10 @@ function findMat(loops, maxCoordinate, options) {
29055
29058
  maxCoordinate, squaredDiagonalLength, loops, cpTrees, pointToCpNode,
29056
29059
  lastInsertId, ..._meta
29057
29060
  };
29061
+ // const cpTrees: Map<Loop, LlRbTree<CpNode>> = new Map();
29062
+ // const lastInsertId = { id: 0 };
29063
+ // createInitialCpTree(loops, cpTrees, sharpCornersPerLoop, lastInsertId);
29064
+ // const meta = getMeta(maxCoordinate, squaredDiagonalLength, loops, cpTrees, lastInsertId);
29058
29065
  let cpNode;
29059
29066
  cpNode = findAndAddHoleClosing2Prongs(meta);
29060
29067
  if (typeof _debug_ !== 'undefined') {
@@ -29251,7 +29258,7 @@ function trimMat(mat) {
29251
29258
 
29252
29259
  ;// ./src/point-on-shape/pos-to-human-string.ts
29253
29260
  /**
29254
- * Returns a human-readable string of the given [[PointOnShape]].
29261
+ * Returns a human-readable string of the given `PointOnShape`.
29255
29262
  * For debugging only.
29256
29263
  * @internal
29257
29264
  */
@@ -30730,7 +30737,7 @@ function holeCloserNext(pairs, holeCloser) {
30730
30737
 
30731
30738
 
30732
30739
 
30733
- // export { getMeta } from './find-mat/get-meta.js';
30734
30740
 
30735
30741
 
30736
- export { CpNodeFs, beziersToSvgPathStr, connectHoleClosers, createInitialCpTree, createPos, debugElemNames, drawBeziersAsSinglePath, drawBranch, drawElemFs, drawElemFsDetailed, drawMat, emptyDebugElems, enableDebugForMat, find2Prong, findAndAdd2Prong, findAndAddHoleClosing2Prongs, findMats, floydWarshall, getBoundaryBeziersToNext, getBoundaryPieceBeziers, getBranches, getCloseBoundaryPointsCertified, getClosestSquareDistanceToRect, getFor2ProngsOnLoop, getGraph, getImpliedBoundaryBezierBetween, getPathsFromStr, getPotentialClosestPointsOnCurveCertified, getSatCulls, get_shape_bounds_getShapeBounds as getShapeBounds, getSharpCornersOnLoop, isVertexSpecial, loopFromBeziers, simplifyMat, sweep_line_sweepLine as sweepLine, toScaleAxis, trimMat };
30742
+
30743
+ export { CpNodeFs, beziersToSvgPathStr, connectHoleClosers, createInitialCpTree, createPos, debugElemNames, drawBeziersAsSinglePath, drawBranch, drawElemFs, drawElemFsDetailed, drawMat, emptyDebugElems, enableDebugForMat, find2Prong, findAndAdd2Prong, findAndAddHoleClosing2Prongs, findMats, floydWarshall, getBoundaryBeziersToNext, getBoundaryPieceBeziers, getBranches, getCloseBoundaryPointsCertified, getClosestSquareDistanceToRect, getFor2ProngsOnLoop, getGraph, getImpliedBoundaryBezierBetween, getPartialMeta, getPathsFromStr, getPointToCpNode, getPotentialClosestPointsOnCurveCertified, getSatCulls, get_shape_bounds_getShapeBounds as getShapeBounds, getSharpCornersOnLoop, isVertexSpecial, loopFromBeziers, simplifyMat, sweep_line_sweepLine as sweepLine, toScaleAxis, trimMat };