flo-mat 2.0.0 → 2.0.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 (289) hide show
  1. package/.eslintrc.cjs +69 -0
  2. package/README.md +9 -27
  3. package/browser/index.js +29720 -7345
  4. package/browser/index.min.js +1 -2
  5. package/node/circle.js +3 -3
  6. package/node/circle.js.map +1 -1
  7. package/node/compare-curvatures-at-interface.js +36 -36
  8. package/node/compare-curvatures-at-interface.js.map +1 -1
  9. package/node/cp-node/clone.js +6 -6
  10. package/node/cp-node/clone.js.map +1 -1
  11. package/node/cp-node/remove.js +4 -4
  12. package/node/cp-node/remove.js.map +1 -1
  13. package/node/cp-node.js +18 -18
  14. package/node/cp-node.js.map +1 -1
  15. package/node/curve.d.ts +1 -1
  16. package/node/curve.js +19 -19
  17. package/node/curve.js.map +1 -1
  18. package/node/debug/debug.d.ts +1 -1
  19. package/node/debug/functions/draw-elem/bounding-hull.js +1 -1
  20. package/node/debug/functions/draw-elem/bounding-hull.js.map +1 -1
  21. package/node/debug/functions/draw-elem/branch.js +4 -4
  22. package/node/debug/functions/draw-elem/branch.js.map +1 -1
  23. package/node/debug/functions/draw-elem/culls.js +4 -4
  24. package/node/debug/functions/draw-elem/culls.js.map +1 -1
  25. package/node/debug/functions/draw-elem/draw-circle-percent.js +1 -1
  26. package/node/debug/functions/draw-elem/draw-circle-percent.js.map +1 -1
  27. package/node/debug/functions/draw-elem/draw-elem.d.ts +2 -2
  28. package/node/debug/functions/draw-elem/draw-elem.js +1 -1
  29. package/node/debug/functions/draw-elem/draw-elem.js.map +1 -1
  30. package/node/debug/functions/draw-elem/dull-corner.js +3 -3
  31. package/node/debug/functions/draw-elem/dull-corner.js.map +1 -1
  32. package/node/debug/functions/draw-elem/leaves.js +4 -4
  33. package/node/debug/functions/draw-elem/leaves.js.map +1 -1
  34. package/node/debug/functions/draw-elem/loose-bounding-box.js +2 -2
  35. package/node/debug/functions/draw-elem/loose-bounding-box.js.map +1 -1
  36. package/node/debug/functions/draw-elem/mat.js +4 -4
  37. package/node/debug/functions/draw-elem/mat.js.map +1 -1
  38. package/node/debug/functions/draw-elem/max-vertex.js +2 -2
  39. package/node/debug/functions/draw-elem/max-vertex.js.map +1 -1
  40. package/node/debug/functions/draw-elem/min-y.js +3 -3
  41. package/node/debug/functions/draw-elem/min-y.js.map +1 -1
  42. package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js +4 -4
  43. package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js.map +1 -1
  44. package/node/debug/functions/draw-elem/one-prong.js +4 -4
  45. package/node/debug/functions/draw-elem/one-prong.js.map +1 -1
  46. package/node/debug/functions/draw-elem/sharp-corner.js +2 -2
  47. package/node/debug/functions/draw-elem/sharp-corner.js.map +1 -1
  48. package/node/debug/functions/draw-elem/three-prong.js +7 -7
  49. package/node/debug/functions/draw-elem/three-prong.js.map +1 -1
  50. package/node/debug/functions/draw-elem/tight-bounding-box.js +1 -1
  51. package/node/debug/functions/draw-elem/tight-bounding-box.js.map +1 -1
  52. package/node/debug/functions/draw-elem/two-prong.js +1 -1
  53. package/node/debug/functions/draw-elem/two-prong.js.map +1 -1
  54. package/node/debug/functions/draw-elem/vertex.js +13 -13
  55. package/node/debug/functions/draw-elem/vertex.js.map +1 -1
  56. package/node/debug/functions/general.d.ts +1 -1
  57. package/node/debug/functions/general.js +1 -1
  58. package/node/debug/functions/general.js.map +1 -1
  59. package/node/debug/functions/three-prong.d.ts +1 -1
  60. package/node/debug/functions/three-prong.js +37 -37
  61. package/node/debug/functions/three-prong.js.map +1 -1
  62. package/node/debug/functions/two-prong.d.ts +1 -1
  63. package/node/debug/functions/two-prong.js +15 -15
  64. package/node/debug/functions/two-prong.js.map +1 -1
  65. package/node/find-mats.js +16 -19
  66. package/node/find-mats.js.map +1 -1
  67. package/node/get-boundary-bezier-parts-to-next.js +8 -8
  68. package/node/get-boundary-bezier-parts-to-next.js.map +1 -1
  69. package/node/get-boundary-beziers-to-next.js +8 -8
  70. package/node/get-boundary-beziers-to-next.js.map +1 -1
  71. package/node/get-branches.js +7 -7
  72. package/node/get-branches.js.map +1 -1
  73. package/node/get-curve/get-curve-between.js +21 -21
  74. package/node/get-curve/get-curve-between.js.map +1 -1
  75. package/node/get-curve/get-edge-direction.js +13 -13
  76. package/node/get-curve/get-edge-direction.js.map +1 -1
  77. package/node/get-interface-ccw.js +12 -12
  78. package/node/get-interface-ccw.js.map +1 -1
  79. package/node/loop/get-max-coordinate.js +9 -9
  80. package/node/loop/get-max-coordinate.js.map +1 -1
  81. package/node/loop.js +4 -4
  82. package/node/loop.js.map +1 -1
  83. package/node/mat/add-to-cp-graph.js +8 -8
  84. package/node/mat/add-to-cp-graph.js.map +1 -1
  85. package/node/mat/closest-boundary-point/closest-points-on-curve.js +5 -6
  86. package/node/mat/closest-boundary-point/closest-points-on-curve.js.map +1 -1
  87. package/node/mat/closest-boundary-point/cull-bezier-pieces.js +1 -1
  88. package/node/mat/closest-boundary-point/cull-bezier-pieces.js.map +1 -1
  89. package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.js +5 -5
  90. package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.js.map +1 -1
  91. package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.js +5 -5
  92. package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.js.map +1 -1
  93. package/node/mat/closest-boundary-point/get-best-distance-squared.js +5 -5
  94. package/node/mat/closest-boundary-point/get-best-distance-squared.js.map +1 -1
  95. package/node/mat/closest-boundary-point/get-close-boundary-points.js +15 -15
  96. package/node/mat/closest-boundary-point/get-close-boundary-points.js.map +1 -1
  97. package/node/mat/closest-boundary-point/get-closest-boundary-point.js +4 -4
  98. package/node/mat/closest-boundary-point/get-closest-boundary-point.js.map +1 -1
  99. package/node/mat/create-new-cp-tree.js +3 -3
  100. package/node/mat/create-new-cp-tree.js.map +1 -1
  101. package/node/mat/elem-type-two-prong.d.ts +1 -1
  102. package/node/mat/find-mat/add-1-prong.js +3 -3
  103. package/node/mat/find-mat/add-1-prong.js.map +1 -1
  104. package/node/mat/find-mat/add-2-prong.js +40 -40
  105. package/node/mat/find-mat/add-2-prong.js.map +1 -1
  106. package/node/mat/find-mat/add-3-prong.js +1 -1
  107. package/node/mat/find-mat/add-3-prong.js.map +1 -1
  108. package/node/mat/find-mat/add-debug-info.js +16 -18
  109. package/node/mat/find-mat/add-debug-info.js.map +1 -1
  110. package/node/mat/find-mat/create-get-interesting-points-on-loop.js +4 -4
  111. package/node/mat/find-mat/create-get-interesting-points-on-loop.js.map +1 -1
  112. package/node/mat/find-mat/create-initial-cp-graph.js +11 -11
  113. package/node/mat/find-mat/create-initial-cp-graph.js.map +1 -1
  114. package/node/mat/find-mat/find-2-prong/add-debug-info.js +2 -2
  115. package/node/mat/find-mat/find-2-prong/add-debug-info.js.map +1 -1
  116. package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js +5 -5
  117. package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js.map +1 -1
  118. package/node/mat/find-mat/find-2-prong/find-2-prong.js +25 -25
  119. package/node/mat/find-mat/find-2-prong/find-2-prong.js.map +1 -1
  120. package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js +7 -7
  121. package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js.map +1 -1
  122. package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js +4 -4
  123. package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js.map +1 -1
  124. package/node/mat/find-mat/find-2-prong/x-for-debugging.d.ts +1 -1
  125. package/node/mat/find-mat/find-3-prong/calc-better-x.js +4 -4
  126. package/node/mat/find-mat/find-3-prong/calc-better-x.js.map +1 -1
  127. package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.js +3 -3
  128. package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.js.map +1 -1
  129. package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.js +35 -35
  130. package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.js.map +1 -1
  131. package/node/mat/find-mat/find-3-prong/find-3-prong.js +14 -14
  132. package/node/mat/find-mat/find-3-prong/find-3-prong.js.map +1 -1
  133. package/node/mat/find-mat/find-3-prong/get-closest-points.js +1 -1
  134. package/node/mat/find-mat/find-3-prong/get-closest-points.js.map +1 -1
  135. package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.js +2 -2
  136. package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.js.map +1 -1
  137. package/node/mat/find-mat/find-and-add-2-prongs.js +12 -13
  138. package/node/mat/find-mat/find-and-add-2-prongs.js.map +1 -1
  139. package/node/mat/find-mat/find-and-add-3-prongs.js +16 -17
  140. package/node/mat/find-mat/find-and-add-3-prongs.js.map +1 -1
  141. package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.js +6 -6
  142. package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.js.map +1 -1
  143. package/node/mat/find-mat/get-potential-2-prongs.js +4 -4
  144. package/node/mat/find-mat/get-potential-2-prongs.js.map +1 -1
  145. package/node/mat/find-mat/get-sharp-corners.js +4 -4
  146. package/node/mat/find-mat/get-sharp-corners.js.map +1 -1
  147. package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.js +3 -3
  148. package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.js.map +1 -1
  149. package/node/mat/get-boundary-piece-beziers.js +5 -5
  150. package/node/mat/get-boundary-piece-beziers.js.map +1 -1
  151. package/node/mat/get-contact-circles-at-interface.js +1 -1
  152. package/node/mat/get-contact-circles-at-interface.js.map +1 -1
  153. package/node/mat/get-leaves.js +2 -2
  154. package/node/mat/get-leaves.js.map +1 -1
  155. package/node/mat/get-neighboring-cps.js +1 -1
  156. package/node/mat/get-neighboring-cps.js.map +1 -1
  157. package/node/mat/is-another-cp-closeby.js +9 -9
  158. package/node/mat/is-another-cp-closeby.js.map +1 -1
  159. package/node/mat/simplify-mat-map-only.js +15 -15
  160. package/node/mat/simplify-mat-map-only.js.map +1 -1
  161. package/node/mat/to-scale-axis/add-debug-info.js +1 -1
  162. package/node/mat/to-scale-axis/add-debug-info.js.map +1 -1
  163. package/node/mat/to-scale-axis/cull-non-cycles.js +5 -5
  164. package/node/mat/to-scale-axis/cull-non-cycles.js.map +1 -1
  165. package/node/mat/to-scale-axis/cull.js +5 -5
  166. package/node/mat/to-scale-axis/cull.js.map +1 -1
  167. package/node/mat/trim-mat.js +1 -1
  168. package/node/mat/trim-mat.js.map +1 -1
  169. package/node/point-on-shape.d.ts +4 -4
  170. package/node/point-on-shape.js +16 -16
  171. package/node/point-on-shape.js.map +1 -1
  172. package/node/simplify-mat.js +10 -10
  173. package/node/simplify-mat.js.map +1 -1
  174. package/node/svg/get-loop-bounds.d.ts +1 -1
  175. package/node/svg/get-loop-bounds.js +13 -13
  176. package/node/svg/get-loop-bounds.js.map +1 -1
  177. package/node/svg/get-shape-bounds.d.ts +2 -2
  178. package/node/svg/get-shape-bounds.js +4 -4
  179. package/node/svg/get-shape-bounds.js.map +1 -1
  180. package/node/sweep-line/sweep-line.js +8 -8
  181. package/node/sweep-line/sweep-line.js.map +1 -1
  182. package/node/to-scale-axis.js +16 -15
  183. package/node/to-scale-axis.js.map +1 -1
  184. package/node/traverse-edges.js +2 -2
  185. package/node/traverse-edges.js.map +1 -1
  186. package/node/traverse-vertices.js +2 -2
  187. package/node/traverse-vertices.js.map +1 -1
  188. package/package.json +30 -25
  189. package/src/circle.ts +3 -3
  190. package/src/compare-curvatures-at-interface.ts +36 -36
  191. package/src/cp-node/clone.ts +6 -6
  192. package/src/cp-node/remove.ts +4 -4
  193. package/src/cp-node.ts +20 -20
  194. package/src/curve.ts +19 -19
  195. package/src/debug/functions/draw-elem/bounding-hull.ts +2 -2
  196. package/src/debug/functions/draw-elem/branch.ts +4 -4
  197. package/src/debug/functions/draw-elem/culls.ts +4 -4
  198. package/src/debug/functions/draw-elem/draw-circle-percent.ts +2 -2
  199. package/src/debug/functions/draw-elem/draw-elem.ts +1 -1
  200. package/src/debug/functions/draw-elem/dull-corner.ts +3 -3
  201. package/src/debug/functions/draw-elem/leaves.ts +4 -4
  202. package/src/debug/functions/draw-elem/loose-bounding-box.ts +2 -2
  203. package/src/debug/functions/draw-elem/mat.ts +4 -4
  204. package/src/debug/functions/draw-elem/max-vertex.ts +2 -2
  205. package/src/debug/functions/draw-elem/min-y.ts +3 -3
  206. package/src/debug/functions/draw-elem/one-prong-at-dull-corner.ts +4 -4
  207. package/src/debug/functions/draw-elem/one-prong.ts +4 -4
  208. package/src/debug/functions/draw-elem/sharp-corner.ts +2 -2
  209. package/src/debug/functions/draw-elem/three-prong.ts +7 -7
  210. package/src/debug/functions/draw-elem/tight-bounding-box.ts +1 -1
  211. package/src/debug/functions/draw-elem/two-prong.ts +1 -1
  212. package/src/debug/functions/draw-elem/vertex.ts +20 -14
  213. package/src/debug/functions/general.ts +3 -3
  214. package/src/debug/functions/three-prong.ts +37 -37
  215. package/src/debug/functions/two-prong.ts +15 -15
  216. package/src/find-mats.ts +19 -19
  217. package/src/get-boundary-bezier-parts-to-next.ts +8 -8
  218. package/src/get-boundary-beziers-to-next.ts +8 -8
  219. package/src/get-branches.ts +7 -7
  220. package/src/get-curve/get-curve-between.ts +21 -21
  221. package/src/get-curve/get-edge-direction.ts +13 -14
  222. package/src/get-interface-ccw.ts +12 -12
  223. package/src/loop/get-max-coordinate.ts +7 -7
  224. package/src/loop.ts +4 -4
  225. package/src/mat/add-to-cp-graph.ts +8 -8
  226. package/src/mat/closest-boundary-point/closest-points-on-curve.ts +5 -6
  227. package/src/mat/closest-boundary-point/cull-bezier-pieces.ts +1 -1
  228. package/src/mat/closest-boundary-point/cull-by-loose-bounding-box.ts +5 -5
  229. package/src/mat/closest-boundary-point/cull-by-tight-boundary-box.ts +5 -5
  230. package/src/mat/closest-boundary-point/get-best-distance-squared.ts +5 -5
  231. package/src/mat/closest-boundary-point/get-close-boundary-points.ts +15 -15
  232. package/src/mat/closest-boundary-point/get-closest-boundary-point.ts +4 -4
  233. package/src/mat/cmp-cp-on-delta.ts +5 -5
  234. package/src/mat/create-new-cp-tree.ts +3 -3
  235. package/src/mat/find-mat/add-1-prong.ts +5 -5
  236. package/src/mat/find-mat/add-2-prong.ts +42 -42
  237. package/src/mat/find-mat/add-3-prong.ts +1 -1
  238. package/src/mat/find-mat/add-debug-info.ts +18 -20
  239. package/src/mat/find-mat/create-get-interesting-points-on-loop.ts +4 -4
  240. package/src/mat/find-mat/create-initial-cp-graph.ts +11 -11
  241. package/src/mat/find-mat/find-2-prong/add-debug-info.ts +4 -4
  242. package/src/mat/find-mat/find-2-prong/cull-bezier-pieces.ts +5 -5
  243. package/src/mat/find-mat/find-2-prong/find-2-prong.ts +27 -27
  244. package/src/mat/find-mat/find-2-prong/find-equidistant-point-on-line.ts +7 -7
  245. package/src/mat/find-mat/find-2-prong/get-initial-bezier-pieces.ts +4 -4
  246. package/src/mat/find-mat/find-3-prong/calc-better-x.ts +4 -4
  247. package/src/mat/find-mat/find-3-prong/calc-initial-3-prong-center.ts +3 -3
  248. package/src/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.ts +37 -37
  249. package/src/mat/find-mat/find-3-prong/find-3-prong.ts +16 -16
  250. package/src/mat/find-mat/find-3-prong/get-closest-points.ts +1 -1
  251. package/src/mat/find-mat/find-and-add-2-prongs-on-all-paths.ts +2 -2
  252. package/src/mat/find-mat/find-and-add-2-prongs.ts +14 -16
  253. package/src/mat/find-mat/find-and-add-3-prongs.ts +19 -19
  254. package/src/mat/find-mat/find-and-add-hole-closing-2-prongs.ts +6 -6
  255. package/src/mat/find-mat/get-potential-2-prongs.ts +4 -4
  256. package/src/mat/find-mat/get-sharp-corners.ts +4 -4
  257. package/src/mat/find-mat/get-total-abs-curvature.ts +1 -1
  258. package/src/mat/geometry/get-closest-squared-distance-to-rotated-rect.ts +3 -3
  259. package/src/mat/get-boundary-piece-beziers.ts +5 -5
  260. package/src/mat/get-contact-circles-at-interface.ts +1 -1
  261. package/src/mat/get-edges-as-array.ts +2 -2
  262. package/src/mat/get-leaves.ts +2 -2
  263. package/src/mat/get-neighboring-cps.ts +1 -1
  264. package/src/mat/is-another-cp-closeby.ts +9 -9
  265. package/src/mat/simplify-mat-map-only.ts +15 -15
  266. package/src/mat/to-scale-axis/add-debug-info.ts +6 -3
  267. package/src/mat/to-scale-axis/add-to-tree.ts +10 -10
  268. package/src/mat/to-scale-axis/calc-groups.ts +19 -19
  269. package/src/mat/to-scale-axis/create-spacial-tree.ts +4 -4
  270. package/src/mat/to-scale-axis/cull-non-cycles.ts +5 -5
  271. package/src/mat/to-scale-axis/cull.ts +5 -5
  272. package/src/mat/to-scale-axis/get-engulfed-vertices.ts +18 -18
  273. package/src/mat/trim-mat.ts +1 -1
  274. package/src/point-on-shape.ts +16 -16
  275. package/src/simplify-mat.ts +10 -10
  276. package/src/svg/get-curvature-at-interface.ts +6 -8
  277. package/src/svg/get-extreme.ts +1 -1
  278. package/src/svg/get-loop-bounds.ts +13 -13
  279. package/src/svg/get-shape-bounds.ts +4 -4
  280. package/src/sweep-line/are-boxes-intersecting.ts +4 -4
  281. package/src/sweep-line/sweep-line.ts +8 -8
  282. package/src/to-scale-axis.ts +18 -17
  283. package/src/traverse-edges.ts +2 -2
  284. package/src/traverse-vertices.ts +2 -2
  285. package/webpack.config.cjs +12 -63
  286. package/browser/index.min.js.LICENSE.txt +0 -2907
  287. package/browser/index.module.js +0 -7369
  288. package/browser/index.module.min.js +0 -2
  289. package/browser/index.module.min.js.LICENSE.txt +0 -2907
@@ -5,14 +5,14 @@ import { IPointOnShape } from '../../../point-on-shape.js';
5
5
 
6
6
  /** @hidden */
7
7
  function minY(g: SVGGElement, pos: IPointOnShape) {
8
- let p = evalDeCasteljau(pos.curve.ps, pos.t) ;
8
+ const p = evalDeCasteljau(pos.curve.ps, pos.t) ;
9
9
 
10
- let ps = toCubic(pos.curve.ps);
10
+ const ps = toCubic(pos.curve.ps);
11
11
  //console.log('x: ', getX(ps));
12
12
  //console.log('y: ', getY(ps));
13
13
  //console.log('t: ', pos.t);
14
14
 
15
- let $elems = drawFs.crossHair(
15
+ const $elems = drawFs.crossHair(
16
16
  g, p, 'red thin10 nofill'
17
17
  );
18
18
 
@@ -5,11 +5,11 @@ import { getOsculatingCircle, IPointOnShape } from '../../../point-on-shape.js';
5
5
  /** @hidden */
6
6
  function oneProngAtDullCorner(g: SVGGElement, pos: IPointOnShape) {
7
7
  //let oCircle = PointOnShape.getOsculatingCircle(Number.POSITIVE_INFINITY, pos);
8
- let oCircle = getOsculatingCircle(Number.POSITIVE_INFINITY, pos);
8
+ const oCircle = getOsculatingCircle(Number.POSITIVE_INFINITY, pos);
9
9
 
10
- let $center = drawFs.dot(g, pos.p, 0.1, 'orange');
11
- let $circle = drawFs.dot(g, oCircle.center, 0.25, 'orange');
12
- let $pos = drawFs.circle(g, oCircle, 'orange thin10 nofill');
10
+ const $center = drawFs.dot(g, pos.p, 0.1, 'orange');
11
+ const $circle = drawFs.dot(g, oCircle.center, 0.25, 'orange');
12
+ const $pos = drawFs.circle(g, oCircle, 'orange thin10 nofill');
13
13
 
14
14
  return [...$center, ...$circle, ...$pos];
15
15
  }
@@ -9,15 +9,15 @@ const scaleFactor = 0.5;
9
9
 
10
10
  /** @hidden */
11
11
  function drawOneProng(g: SVGGElement, pos: IPointOnShape, classes: string, delay = 0) {
12
- let circle = scaleCircle(
12
+ const circle = scaleCircle(
13
13
  //PointOnShape.getOsculatingCircle(Number.POSITIVE_INFINITY, pos),
14
14
  getOsculatingCircle(Number.POSITIVE_INFINITY, pos),
15
15
  1
16
16
  );
17
17
 
18
- let $center = drawFs.dot(g, pos.p, 0.1*scaleFactor, 'gray', delay);
19
- let $circle = drawFs.dot(g, circle.center, 0.25*scaleFactor, 'gray', delay);
20
- let $pos = drawFs.circle(g, circle, 'gray thin10 nofill', delay);
18
+ const $center = drawFs.dot(g, pos.p, 0.1*scaleFactor, 'gray', delay);
19
+ const $circle = drawFs.dot(g, circle.center, 0.25*scaleFactor, 'gray', delay);
20
+ const $pos = drawFs.circle(g, circle, 'gray thin10 nofill', delay);
21
21
 
22
22
  return [...$center, ...$circle, ...$pos];
23
23
  }
@@ -6,8 +6,8 @@ import { Curve } from '../../../curve.js';
6
6
  function sharpCorner(g: SVGGElement, curve: Curve) {
7
7
  const scaleFactor = 1;
8
8
 
9
- let p = curve.ps[curve.ps.length-1];
10
- let $pos = drawFs.dot(g, p, 0.6*scaleFactor, 'green');
9
+ const p = curve.ps[curve.ps.length-1];
10
+ const $pos = drawFs.dot(g, p, 0.6*scaleFactor, 'green');
11
11
 
12
12
  return $pos;
13
13
  }
@@ -9,17 +9,17 @@ const scaleFactor = 0.3;
9
9
 
10
10
  /** @hidden */
11
11
  function threeProng(g: SVGGElement, threeProng: ThreeProngForDebugging) {
12
- let circle = scaleCircle(
12
+ const circle = scaleCircle(
13
13
  threeProng.circle,
14
14
  1
15
15
  );
16
- let poss = threeProng.poss;
16
+ const poss = threeProng.poss;
17
17
 
18
- let $cp1 = drawFs.dot(g, poss[0].p, 0.1*1*scaleFactor, 'blue');
19
- let $cp2 = drawFs.dot(g, poss[1].p, 0.1*2*scaleFactor, 'blue');
20
- let $cp3 = drawFs.dot(g, poss[2].p, 0.1*3*scaleFactor, 'blue');
21
- let $center = drawFs.dot(g, circle.center, 0.3*scaleFactor, 'blue');
22
- let $circle = drawFs.circle(g, circle, 'blue thin2 nofill');
18
+ const $cp1 = drawFs.dot(g, poss[0].p, 0.1*1*scaleFactor, 'blue');
19
+ const $cp2 = drawFs.dot(g, poss[1].p, 0.1*2*scaleFactor, 'blue');
20
+ const $cp3 = drawFs.dot(g, poss[2].p, 0.1*3*scaleFactor, 'blue');
21
+ const $center = drawFs.dot(g, circle.center, 0.3*scaleFactor, 'blue');
22
+ const $circle = drawFs.circle(g, circle, 'blue thin2 nofill');
23
23
 
24
24
  return [...$center, ...$cp1, ...$cp2, ...$cp3, ...$circle];
25
25
  }
@@ -3,7 +3,7 @@ import { drawFs } from 'flo-draw';
3
3
 
4
4
  /** @hidden */
5
5
  function tightBoundingBox(g: SVGGElement, box: number[][]) {
6
- let $box = drawFs.polygon(g, box, 'thin5 pinker nofill');
6
+ const $box = drawFs.polygon(g, box, 'thin5 pinker nofill');
7
7
 
8
8
  return $box;
9
9
  }
@@ -5,7 +5,7 @@ import { getTwoProngType } from '../../../mat/get-two-prong-type.js';
5
5
 
6
6
  /** @hidden */
7
7
  function twoProng(g: SVGGElement, twoProng: TwoProngForDebugging) {
8
- let scaleFactor = 0.3;
8
+ const scaleFactor = 0.3;
9
9
 
10
10
  let $failedDot : SVGElement[] = [];
11
11
  let $center : SVGElement[] = [];
@@ -3,36 +3,42 @@ import { CpNode } from '../../../cp-node.js';
3
3
 
4
4
 
5
5
  /** @hidden */
6
- function vertex(g: SVGGElement, cpNode: CpNode, classes?: string , delay?: number, visible: boolean = true) {
7
- let visibleClass = visible ? '' : ' invisible';
6
+ function vertex(
7
+ g: SVGGElement,
8
+ cpNode: CpNode,
9
+ classes?: string,
10
+ delay?: number,
11
+ visible = true) {
8
12
 
9
- let circle = cpNode.cp.circle;
13
+ const visibleClass = visible ? '' : ' invisible';
14
+
15
+ const circle = cpNode.cp.circle;
10
16
 
11
17
  const THIN = 'thin20';
12
18
 
13
- let cps = cpNode.getCpNodesOnCircle();
19
+ const cps = cpNode.getCpNodesOnCircle();
14
20
  console.log(cps)
15
21
 
16
22
  let $svgs: SVGElement[] = [];
17
23
 
18
- let $circle = drawFs.circle(g, circle, 'red ' + THIN + ' nofill ' + visibleClass, delay);
19
- let $crossHair = drawFs.crossHair(g, circle.center, 'red ' + THIN + ' nofill ' + visibleClass, 3, delay);
24
+ const $circle = drawFs.circle(g, circle, 'red ' + THIN + ' nofill ' + visibleClass, delay);
25
+ const $crossHair = drawFs.crossHair(g, circle.center, 'red ' + THIN + ' nofill ' + visibleClass, 3, delay);
20
26
 
21
27
  $svgs = [...$circle, ...$crossHair];
22
28
 
23
29
  for (let i=0; i<cps.length; i++) {
24
- let cp = cps[i];
25
- let edgeCircle = cp.next.cp.circle;
30
+ const cp = cps[i];
31
+ const edgeCircle = cp.next.cp.circle;
26
32
 
27
- let $circle = drawFs.circle(g, edgeCircle, 'pink ' + THIN + ' nofill ' + visibleClass, delay);
28
- let $crossHair = drawFs.crossHair(g, edgeCircle.center, 'pink ' + THIN + ' nofill ' + visibleClass, 3, delay);
33
+ const $circle = drawFs.circle(g, edgeCircle, 'pink ' + THIN + ' nofill ' + visibleClass, delay);
34
+ const $crossHair = drawFs.crossHair(g, edgeCircle.center, 'pink ' + THIN + ' nofill ' + visibleClass, 3, delay);
29
35
 
30
36
  $svgs.push(...$circle, ...$crossHair)
31
37
 
32
- let p1 = circle.center;
33
- let p2 = edgeCircle.center;
34
- let thin = i === 0 ? 'thin10' : (i === 1 ? 'thin20' : 'thin35');
35
- let $line = drawFs.line(g, [p1, p2], 'yellow ' + thin + ' nofill ' + visibleClass, delay);
38
+ const p1 = circle.center;
39
+ const p2 = edgeCircle.center;
40
+ const thin = i === 0 ? 'thin10' : (i === 1 ? 'thin20' : 'thin35');
41
+ const $line = drawFs.line(g, [p1, p2], 'yellow ' + thin + ' nofill ' + visibleClass, delay);
36
42
 
37
43
  $svgs.push(...$line);
38
44
  }
@@ -18,7 +18,7 @@ let i = 0;
18
18
  * @hidden
19
19
  * Name the given object - for debugging purposes only
20
20
  */
21
- function nameObj(o: any, pre: string = '') {
21
+ function nameObj(o: any, pre = '') {
22
22
  o.name = '' + pre + i++;
23
23
  }
24
24
 
@@ -61,13 +61,13 @@ function pointsToStr(ps: number[][], decimalPlaces = 3) {
61
61
  * @param p The point
62
62
  * @param decimalPlaces number of decimal places
63
63
  */
64
- function pointToStr(p: number[], decimalPlaces: number = 3) {
64
+ function pointToStr(p: number[], decimalPlaces = 3) {
65
65
  return p[0].toFixed(decimalPlaces) + ', ' + p[1].toFixed(decimalPlaces);
66
66
  }
67
67
 
68
68
 
69
69
  /** @hidden */
70
- let generalDebugFunctions/*: IGeneralDebugFunctions*/ = {
70
+ const generalDebugFunctions/*: IGeneralDebugFunctions*/ = {
71
71
  δToString,
72
72
  δsToString,
73
73
  pointToStr,
@@ -27,10 +27,10 @@ export interface IThreeProngDebugFunctions {
27
27
  * @param n - The 3-prong's zero-based index.
28
28
  */
29
29
  function drawSpokes(g: SVGGElement, n: number): void {
30
- let threeProng = _debug_.generated.elems.threeProng[n];
31
- //let g = threeProng.generated.g;
32
- let cc = threeProng.circle.center;
33
- let poss = threeProng.poss;
30
+ const threeProng = _debug_.generated.elems.threeProng[n];
31
+ //const g = threeProng.generated.g;
32
+ const cc = threeProng.circle.center;
33
+ const poss = threeProng.poss;
34
34
 
35
35
  //_debug_.fs.draw.line(g, [poss[0].p, cc], 'thin5 red');
36
36
  //_debug_.fs.draw.line(g, [poss[1].p, cc], 'thin5 red');
@@ -62,12 +62,12 @@ function traceConvergence(g: SVGGElement, n_: number, idx: number): void {
62
62
 
63
63
  for (let n=sIndx; n<eIndx; n++) {
64
64
 
65
- let forDebugging = _debug_.generated.elems.threeProng[n];
66
- //let g = forDebugging.generated.g;
65
+ const forDebugging = _debug_.generated.elems.threeProng[n];
66
+ //const g = forDebugging.generated.g;
67
67
 
68
68
  console.log(forDebugging);
69
69
 
70
- let candidateThreeProngs = forDebugging.candidateThreeProngs;
70
+ const candidateThreeProngs = forDebugging.candidateThreeProngs;
71
71
 
72
72
  //-----------------------------
73
73
  //---- Get start and end index
@@ -91,7 +91,7 @@ function traceConvergence(g: SVGGElement, n_: number, idx: number): void {
91
91
  //---- Draw candidate three-prongs
92
92
  //---------------------------------
93
93
  for (let i=startIndx; i<endIndx; i++) {
94
- let circle = candidateThreeProngs[i].circle;
94
+ const circle = candidateThreeProngs[i].circle;
95
95
  if (forDebugging.bestIndx === i) {
96
96
  drawFs.dot(g, circle.center, 0.2, 'green');
97
97
  drawFs.circle(g, circle, 'black thin10 nofill');
@@ -112,16 +112,16 @@ function traceConvergence(g: SVGGElement, n_: number, idx: number): void {
112
112
  * show all.
113
113
  */
114
114
  function showBoundary(g: SVGGElement, n: number, idx: number): void {
115
- let debugInfo = _debug_.generated.elems.threeProng[n];
116
- //let g = debugInfo.generated.g;
115
+ const debugInfo = _debug_.generated.elems.threeProng[n];
116
+ //const g = debugInfo.generated.g;
117
117
 
118
- let candidateThreeProngs = debugInfo.candidateThreeProngs;
118
+ const candidateThreeProngs = debugInfo.candidateThreeProngs;
119
119
 
120
- let startIndx = idx === undefined ? 0 : idx;
121
- let endIndx = idx === undefined ? candidateThreeProngs.length : idx;
120
+ const startIndx = idx === undefined ? 0 : idx;
121
+ const endIndx = idx === undefined ? candidateThreeProngs.length : idx;
122
122
 
123
123
  // Draw relevant δs
124
- let cpss = debugInfo.cpss;
124
+ const cpss = debugInfo.cpss;
125
125
  let j = 0;
126
126
  // For each iteration of δ3s (indexed by j)
127
127
  for (let idx=1; idx<cpss.length-1; idx++) {
@@ -131,7 +131,7 @@ function showBoundary(g: SVGGElement, n: number, idx: number): void {
131
131
  continue;
132
132
  }
133
133
 
134
- let δ3s = [
134
+ const δ3s = [
135
135
  cpss[0],
136
136
  cpss[idx],
137
137
  cpss[cpss.length-1]
@@ -140,17 +140,17 @@ function showBoundary(g: SVGGElement, n: number, idx: number): void {
140
140
 
141
141
  // For each of the 3 δs
142
142
  for (let i=0; i<3; i++) {
143
- let δ = δ3s[i];
144
- let δS = δ[0]; // Delta Start
145
- let δE = δ[1]; // Delta End
143
+ const δ = δ3s[i];
144
+ const δS = δ[0]; // Delta Start
145
+ const δE = δ[1]; // Delta End
146
146
 
147
- let posS = δS.cp.pointOnShape;
148
- let posE = δE.cp.pointOnShape;
147
+ const posS = δS.cp.pointOnShape;
148
+ const posE = δE.cp.pointOnShape;
149
149
 
150
- let pS = posS.p;
151
- let pE = posE.p;
150
+ const pS = posS.p;
151
+ const pE = posE.p;
152
152
 
153
- let r = 1 + (i*0.5);
153
+ const r = 1 + (i*0.5);
154
154
 
155
155
  if (equal(pS, pE)) {
156
156
  drawFs.crossHair(g, pS, 'red thin10 nofill', r);
@@ -170,7 +170,7 @@ function showBoundary(g: SVGGElement, n: number, idx: number): void {
170
170
  * @param n The 3-prong's zero-based index.
171
171
  */
172
172
  function logδs(n: number): void {
173
- let threeProng = _debug_.generated.elems.threeProng[n];
173
+ const threeProng = _debug_.generated.elems.threeProng[n];
174
174
 
175
175
  console.log(threeProng.cpss);
176
176
  }
@@ -186,26 +186,26 @@ function logNearest(
186
186
  showBoundaries = true) {
187
187
 
188
188
  return function(g: SVGGElement, p: number[], showDelay = 1000) {
189
- let generated = _debug_.generated;
189
+ const generated = _debug_.generated;
190
190
 
191
- let threeProng = getObjClosestTo<ThreeProngForDebugging>(
191
+ const threeProng = getObjClosestTo<ThreeProngForDebugging>(
192
192
  p,
193
193
  generated.elems.threeProng,
194
194
  threeProng => threeProng.circle ? threeProng.circle.center : [0,0]
195
195
  );
196
196
 
197
197
 
198
- let circle = threeProng.circle;
199
- //let g = threeProng.generated.g;
198
+ const circle = threeProng.circle;
199
+ //const g = threeProng.generated.g;
200
200
 
201
201
  console.log(threeProng);
202
202
 
203
- let circle2 = {
203
+ const circle2 = {
204
204
  center: circle.center,
205
205
  radius: circle.radius || 1
206
206
  };
207
207
 
208
- //let draw = _debug_.fs.draw;
208
+ //const draw = _debug_.fs.draw;
209
209
 
210
210
  drawFs.circle(g, circle2, 'blue thin10 nofill', showDelay);
211
211
  drawFs.crossHair(g, circle.center, 'red thin2 nofill', 2, showDelay);
@@ -218,21 +218,21 @@ function logNearest(
218
218
 
219
219
 
220
220
  if (showBoundaries) {
221
- let boundaries = threeProng.boundaries;
222
- let boundaryS = boundaries[0];
223
- let boundaryE = boundaries[boundaries.length-1];
221
+ const boundaries = threeProng.boundaries;
222
+ const boundaryS = boundaries[0];
223
+ const boundaryE = boundaries[boundaries.length-1];
224
224
 
225
225
  drawFs.beziers(g, boundaryS, 'red thin20 nofill', showDelay);
226
226
  for (let i=1; i<boundaries.length-1; i++) {
227
- let boundary = boundaries[i];
227
+ const boundary = boundaries[i];
228
228
  drawFs.beziers(g, boundary, 'green thin20 nofill', showDelay);
229
229
  }
230
230
  drawFs.beziers(g, boundaryE, 'blue thin20 nofill', showDelay);
231
231
  }
232
232
 
233
233
  if (showTrace) {
234
- let traces = threeProng.traces;
235
- for (let trace of traces) {
234
+ const traces = threeProng.traces;
235
+ for (const trace of traces) {
236
236
  drawFs.polyline(g, trace, 'red thin5 nofill', showDelay)
237
237
  }
238
238
  }
@@ -241,7 +241,7 @@ function logNearest(
241
241
 
242
242
 
243
243
  /** @hidden */
244
- let threeProngDebugFunctions: IThreeProngDebugFunctions = {
244
+ const threeProngDebugFunctions: IThreeProngDebugFunctions = {
245
245
  drawSpokes,
246
246
  traceConvergence,
247
247
  showBoundary,
@@ -25,7 +25,7 @@ interface ITwoProngDebugFunctions {
25
25
  * @hidden
26
26
  */
27
27
  function logδ(n: number, type: ElemType_TwoProng = 'twoProng_regular') {
28
- let δ =_debug_.generated.elems[type][n].δ;
28
+ const δ =_debug_.generated.elems[type][n].δ;
29
29
 
30
30
  console.log(δ);
31
31
  }
@@ -35,7 +35,7 @@ function logδ(n: number, type: ElemType_TwoProng = 'twoProng_regular') {
35
35
  * @hidden
36
36
  */
37
37
  function log(n: number, type: ElemType_TwoProng = 'twoProng_regular') {
38
- let twoProng = _debug_.generated.elems[type][n];
38
+ const twoProng = _debug_.generated.elems[type][n];
39
39
  console.log(twoProng);
40
40
  }
41
41
 
@@ -49,7 +49,7 @@ function drawNormal(
49
49
  showDelay = 1000,
50
50
  type: ElemType_TwoProng = 'twoProng_regular') {
51
51
 
52
- let twoProngs = _debug_.generated.elems[type];
52
+ const twoProngs = _debug_.generated.elems[type];
53
53
 
54
54
  // If not specified which, draw all
55
55
  if (n === undefined) {
@@ -58,7 +58,7 @@ function drawNormal(
58
58
  }
59
59
  }
60
60
 
61
- let twoProng = twoProngs[n];
61
+ const twoProng = twoProngs[n];
62
62
 
63
63
  //let g = twoProng.generated.g;
64
64
 
@@ -77,10 +77,10 @@ function logδBasic(
77
77
  n: number,
78
78
  type: ElemType_TwoProng = 'twoProng_regular') {
79
79
 
80
- let delta = _debug_.generated.elems[type][n].δ;
80
+ const delta = _debug_.generated.elems[type][n].δ;
81
81
 
82
82
  function f(x: CpNode) {
83
- let pos = x.cp.pointOnShape;
83
+ const pos = x.cp.pointOnShape;
84
84
  return {
85
85
  bez: pos.curve.ps,
86
86
  t: pos.t
@@ -96,10 +96,10 @@ function logδBasic(
96
96
  * @hidden
97
97
  */
98
98
  function logNearest(g: SVGGElement, p: number[], showDelay = 1000, type: ElemType_TwoProng = 'twoProng_regular') {
99
- let closestPerLoops: TwoProngForDebugging[] = [];
99
+ const closestPerLoops: TwoProngForDebugging[] = [];
100
100
 
101
- let generated = _debug_.generated;
102
- let twoProng = getObjClosestTo<TwoProngForDebugging>(
101
+ const generated = _debug_.generated;
102
+ const twoProng = getObjClosestTo<TwoProngForDebugging>(
103
103
  p,
104
104
  generated.elems[type],
105
105
  twoProng => twoProng.circle.center
@@ -110,7 +110,7 @@ function logNearest(g: SVGGElement, p: number[], showDelay = 1000, type: ElemTyp
110
110
 
111
111
  let n;
112
112
  for (let i=0; i<_debug_.generated.elems[type].length; i++) {
113
- let twoProng_ = _debug_.generated.elems[type][i];
113
+ const twoProng_ = _debug_.generated.elems[type][i];
114
114
  if (twoProng_ === twoProng) {
115
115
  n = i;
116
116
  break;
@@ -136,8 +136,8 @@ function traceConvergence(
136
136
 
137
137
  if (n === undefined) { return; }
138
138
 
139
- let twoProngInfo = _debug_.generated.elems[type][n];
140
- let xs = twoProngInfo.xs;
139
+ const twoProngInfo = _debug_.generated.elems[type][n];
140
+ const xs = twoProngInfo.xs;
141
141
  //let g = twoProngInfo.generated.g;
142
142
 
143
143
  console.log(twoProngInfo);
@@ -160,9 +160,9 @@ function traceConvergence(
160
160
  continue;
161
161
  }
162
162
 
163
- let x = twoProngInfo.xs[i];
163
+ const x = twoProngInfo.xs[i];
164
164
 
165
- let circle = { center: x.x, radius: distanceBetween(x.x, x.y.p) };
165
+ const circle = { center: x.x, radius: distanceBetween(x.x, x.y.p) };
166
166
  drawFs.crossHair(g, x.x, 'red thin10 nofill', undefined, showDelay);
167
167
  drawFs.circle(g, circle, 'blue thin10 nofill', showDelay);
168
168
  if (x.z !== undefined) {
@@ -177,7 +177,7 @@ function traceConvergence(
177
177
 
178
178
 
179
179
  /** @hidden */
180
- let twoProngDebugFunctions: ITwoProngDebugFunctions = {
180
+ const twoProngDebugFunctions: ITwoProngDebugFunctions = {
181
181
  logδ,
182
182
  log,
183
183
  drawNormal,
package/src/find-mats.ts CHANGED
@@ -1,5 +1,5 @@
1
- /** @hidden */
2
- declare var _debug_: Debug;
1
+ /** @internal */
2
+ declare const _debug_: Debug;
3
3
 
4
4
  import { LlRbTree } from 'flo-ll-rb-tree';
5
5
  import { simplifyPaths } from 'flo-boolean';
@@ -8,7 +8,7 @@ import { CpNode } from './cp-node.js';
8
8
  import { Loop } from './loop.js';
9
9
  import { Mat } from './mat.js';
10
10
  import { findAndAddAll3Prongs } from './mat/find-mat/find-and-add-3-prongs.js';
11
- import { createInitialCpGraph } from './mat/find-mat/create-initial-cp-graph.js';;
11
+ import { createInitialCpGraph } from './mat/find-mat/create-initial-cp-graph.js';
12
12
  import { addDebugInfo1, addDebugInfo2, addDebugInfo3, addDebugInfo4 } from './mat/find-mat/add-debug-info.js';
13
13
  import { getPotential2Prongs } from './mat/find-mat/get-potential-2-prongs.js';
14
14
  import { getSharpCorners } from './mat/find-mat/get-sharp-corners.js';
@@ -46,18 +46,18 @@ function findMats(
46
46
  maxCurviness = 0.4,
47
47
  maxLength = 4): Mat[] {
48
48
 
49
- if (typeof _debug_ !== 'undefined') { var timingStart = performance.now(); }
49
+ // if (typeof _debug_ !== 'undefined') { var timingStart = performance.now(); }
50
50
 
51
51
  let maxCoordinate: number;
52
52
  let minBezLength: number;
53
53
  ({ maxCurviness, maxLength, maxCoordinate, minBezLength } =
54
54
  getSizeParams(bezierLoops, maxCurviness, maxLength));
55
55
 
56
- let loopss = simplifyPaths(bezierLoops, maxCoordinate);
56
+ const loopss = simplifyPaths(bezierLoops, maxCoordinate);
57
57
 
58
- let mats: Mat[] = [];
59
- for (let loops of loopss) {
60
- let mat = findMat(
58
+ const mats: Mat[] = [];
59
+ for (const loops of loopss) {
60
+ const mat = findMat(
61
61
  loops,
62
62
  minBezLength,
63
63
  maxCurviness,
@@ -77,14 +77,14 @@ function getSizeParams(
77
77
  maxLength: number) {
78
78
 
79
79
  // Gather some shape metrics
80
- let { maxCoordinate, maxRadius } = getLoopsMetrics(bezierLoops);
81
- let expMax = Math.ceil(Math.log2(maxCoordinate));
82
- let minBezLengthSigBits = 14;
80
+ const { maxCoordinate, maxRadius } = getLoopsMetrics(bezierLoops);
81
+ const expMax = Math.ceil(Math.log2(maxCoordinate));
82
+ const minBezLengthSigBits = 14;
83
83
  /**
84
84
  * If a curve is shorter than this value then no points on it will be
85
85
  * selected for the purpose of finding the MAT.
86
86
  */
87
- let minBezLength = 2**expMax * 2**(-minBezLengthSigBits);
87
+ const minBezLength = 2**expMax * 2**(-minBezLengthSigBits);
88
88
 
89
89
  // Limit the tolerance to a reasonable level
90
90
  if (maxCurviness < 0.05) { maxCurviness = 0.05; }
@@ -93,8 +93,8 @@ function getSizeParams(
93
93
  if (maxLength < 0.1) { maxLength = 0.1; }
94
94
  if (maxLength > 100) { maxLength = 100; }
95
95
  // Adjust length tolerance according to a reference max coordinate
96
- let expMaxRadius = Math.ceil(Math.log2(maxRadius));
97
- let maxLengthSigBits = 10; // 1024 x 1024
96
+ const expMaxRadius = Math.ceil(Math.log2(maxRadius));
97
+ const maxLengthSigBits = 10; // 1024 x 1024
98
98
  maxLength = maxLength * (2**expMaxRadius * 2**(-maxLengthSigBits));
99
99
 
100
100
  return { maxCurviness, maxLength, maxCoordinate, minBezLength };
@@ -118,14 +118,14 @@ function findMat(
118
118
 
119
119
  // Gets interesting points on the shape, i.e. those that makes sense to use
120
120
  // for the 2-prong procedure.
121
- let pointsPerLoop = loops.map(
121
+ const pointsPerLoop = loops.map(
122
122
  getInterestingPointsOnLoop(minBezLength, maxCurviness, maxLength)
123
123
  );
124
124
 
125
- let for2ProngsPerLoop = getPotential2Prongs(pointsPerLoop);
126
- let sharpCornersPerLoop = getSharpCorners(pointsPerLoop);
125
+ const for2ProngsPerLoop = getPotential2Prongs(pointsPerLoop);
126
+ const sharpCornersPerLoop = getSharpCorners(pointsPerLoop);
127
127
 
128
- let cpTrees: Map<Loop, LlRbTree<CpNode>> = new Map();
128
+ const cpTrees: Map<Loop, LlRbTree<CpNode>> = new Map();
129
129
  let cpNode = createInitialCpGraph(loops, cpTrees, sharpCornersPerLoop);
130
130
 
131
131
  findAndAddHoleClosing2Prongs(loops, cpTrees, maxCoordinate);
@@ -160,7 +160,7 @@ function findMat(
160
160
  }
161
161
  }
162
162
 
163
- let mat = { cpNode, cpTrees };
163
+ const mat = { cpNode, cpTrees };
164
164
 
165
165
  addDebugInfo4(mat);
166
166
 
@@ -9,14 +9,14 @@ import { Curve } from './curve.js';
9
9
  * @param cpNode
10
10
  */
11
11
  function getBoundaryBezierPartsToNext(cpNode: CpNode): BezierPiece[] {
12
- let cpThis = cpNode;
13
- let cpNext = cpNode.next;
12
+ const cpThis = cpNode;
13
+ const cpNext = cpNode.next;
14
14
 
15
- let posThis = cpThis.cp.pointOnShape;
16
- let posNext = cpNext.cp.pointOnShape;
15
+ const posThis = cpThis.cp.pointOnShape;
16
+ const posNext = cpNext.cp.pointOnShape;
17
17
 
18
- let curveThis = posThis.curve;
19
- let curveNext = posNext.curve;
18
+ const curveThis = posThis.curve;
19
+ const curveNext = posNext.curve;
20
20
 
21
21
  if (curveThis.loop !== curveNext.loop) {
22
22
  // It is a hole-closer going over to the other loop - a kind of terminal
@@ -24,7 +24,7 @@ function getBoundaryBezierPartsToNext(cpNode: CpNode): BezierPiece[] {
24
24
  return undefined;
25
25
  }
26
26
 
27
- let bezierParts: BezierPiece[] = [];
27
+ const bezierParts: BezierPiece[] = [];
28
28
 
29
29
  if (curveNext === curveThis) {
30
30
  bezierParts.push(
@@ -60,7 +60,7 @@ function addSkippedBeziers(
60
60
  let curveThis = curveStart;
61
61
  do {
62
62
  curveThis = curveThis.next;
63
- let bezierPart = curveThis === curveEnd
63
+ const bezierPart = curveThis === curveEnd
64
64
  ? { ps: curveThis.ps, ts: [0, t1] }
65
65
  : { ps: curveThis.ps, ts: [0, 1] }
66
66
 
@@ -10,14 +10,14 @@ import { Curve } from './curve.js';
10
10
  * @param cpNode
11
11
  */
12
12
  function getBoundaryBeziersToNext(cpNode: CpNode) {
13
- let cpThis = cpNode;
14
- let cpNext = cpNode.next;
13
+ const cpThis = cpNode;
14
+ const cpNext = cpNode.next;
15
15
 
16
- let posThis = cpThis.cp.pointOnShape;
17
- let posNext = cpNext.cp.pointOnShape;
16
+ const posThis = cpThis.cp.pointOnShape;
17
+ const posNext = cpNext.cp.pointOnShape;
18
18
 
19
- let curveThis = posThis.curve;
20
- let curveNext = posNext.curve;
19
+ const curveThis = posThis.curve;
20
+ const curveNext = posNext.curve;
21
21
 
22
22
  if (curveThis.loop !== curveNext.loop) {
23
23
  // It is a hole-closer going over to the other loop - a kind of terminal
@@ -25,7 +25,7 @@ function getBoundaryBeziersToNext(cpNode: CpNode) {
25
25
  return undefined;
26
26
  }
27
27
 
28
- let beziers = [];
28
+ const beziers = [];
29
29
 
30
30
  if (curveNext === curveThis) {
31
31
  beziers.push(
@@ -61,7 +61,7 @@ function addSkippedBeziers(
61
61
  let curveThis = curveStart;
62
62
  do {
63
63
  curveThis = curveThis.next;
64
- let tEnd = curveThis === curveEnd ? t1 : 1;
64
+ const tEnd = curveThis === curveEnd ? t1 : 1;
65
65
  beziers.push(
66
66
  // qqq from0ToT(curveThis.ps, tEnd)
67
67
  fromTo(curveThis.ps, 0, tEnd)