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
@@ -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 { exponent } from 'big-float-ts';
@@ -34,8 +34,8 @@ function add2Prong(
34
34
  extreme : number): CpNode {
35
35
 
36
36
  //let orderSource = PointOnShape.calcOrder(circle, posSource);
37
- let orderSource = calcPosOrder(circle, posSource);
38
- let orderAntipodes = posAntipodes.map(
37
+ const orderSource = calcPosOrder(circle, posSource);
38
+ const orderAntipodes = posAntipodes.map(
39
39
  posAntipode => {
40
40
  //console.log(circle.center)
41
41
  //return PointOnShape.calcOrder(circle, posAntipode.pos);
@@ -58,8 +58,8 @@ function add2Prong(
58
58
 
59
59
  let isCloseByAntipodes = false;
60
60
  for (let i=0; i<posAntipodes.length; i++) {
61
- let posAntipode = posAntipodes[i];
62
- let orderAntipode = orderAntipodes[i];
61
+ const posAntipode = posAntipodes[i];
62
+ const orderAntipode = orderAntipodes[i];
63
63
 
64
64
  if (isAnotherCpCloseby(cpGraphs, posAntipode.pos, circle, orderAntipode, 0, extreme, 'red')) {
65
65
  isCloseByAntipodes = true;
@@ -80,22 +80,22 @@ function add2Prong(
80
80
  }
81
81
 
82
82
  // Antipode
83
- let newCpAntipodes: CpNode[] = [];
84
- let cpAntipodes: ContactPoint[] = [];
85
- let cpTreeAntipodes: LlRbTree<CpNode>[] = [];
86
- let deltaAntipodes: CpNode[][] = [];
87
- let loopAntipodes: Loop[] = [];
83
+ const newCpAntipodes: CpNode[] = [];
84
+ const cpAntipodes: ContactPoint[] = [];
85
+ const cpTreeAntipodes: LlRbTree<CpNode>[] = [];
86
+ const deltaAntipodes: CpNode[][] = [];
87
+ const loopAntipodes: Loop[] = [];
88
88
  for (let i=0; i<posAntipodes.length; i++) {
89
- let posAntipode = posAntipodes[i];
90
- let orderAntipode = orderAntipodes[i];
89
+ const posAntipode = posAntipodes[i];
90
+ const orderAntipode = orderAntipodes[i];
91
91
 
92
- let cpAntipode: ContactPoint = { pointOnShape: posAntipode.pos, circle, order: orderAntipode, order2: 0 };
92
+ const cpAntipode: ContactPoint = { pointOnShape: posAntipode.pos, circle, order: orderAntipode, order2: 0 };
93
93
  cpAntipodes.push(cpAntipode);
94
- let loopAntipode = posAntipode.pos.curve.loop;
94
+ const loopAntipode = posAntipode.pos.curve.loop;
95
95
  loopAntipodes.push(loopAntipode);
96
- let cpTreeAntipode = cpGraphs.get(loopAntipode);
96
+ const cpTreeAntipode = cpGraphs.get(loopAntipode);
97
97
  cpTreeAntipodes.push(cpTreeAntipode);
98
- let deltaAntipode = getNeighbouringPoints(
98
+ const deltaAntipode = getNeighbouringPoints(
99
99
  cpTreeAntipode, posAntipode.pos, orderAntipode, 0
100
100
  );
101
101
  deltaAntipodes.push(deltaAntipode);
@@ -111,13 +111,13 @@ function add2Prong(
111
111
 
112
112
 
113
113
  // Source
114
- let cpSource: ContactPoint = { pointOnShape: posSource, circle, order: orderSource, order2: 0 };
115
- let loopSource = posSource.curve.loop;
116
- let cpTreeSource = cpGraphs.get(loopSource);
117
- let deltaSource = getNeighbouringPoints(
114
+ const cpSource: ContactPoint = { pointOnShape: posSource, circle, order: orderSource, order2: 0 };
115
+ const loopSource = posSource.curve.loop;
116
+ const cpTreeSource = cpGraphs.get(loopSource);
117
+ const deltaSource = getNeighbouringPoints(
118
118
  cpTreeSource, posSource, orderSource, 0
119
119
  );
120
- let newCpSource = CpNode.insert(
120
+ const newCpSource = CpNode.insert(
121
121
  holeClosing,
122
122
  false,
123
123
  cpTreeSource,
@@ -134,19 +134,19 @@ function add2Prong(
134
134
  newCpAntipodes[0].prevOnCircle = newCpSource;
135
135
  newCpAntipodes[0].nextOnCircle = newCpSource;
136
136
  } else {
137
- let cpNodes = newCpAntipodes.slice();
137
+ const cpNodes = newCpAntipodes.slice();
138
138
  cpNodes.push(newCpSource);
139
139
 
140
140
  // Order points according to their angle with the x-axis
141
141
  cpNodes.sort(byAngle(circle));
142
142
 
143
143
  for (let i=0; i<cpNodes.length; i++) {
144
- let iNext = (i+1 === cpNodes.length) ? 0 : i+1;
145
- let iPrev = (i === 0) ? cpNodes.length-1 : i-1;
144
+ const iNext = (i+1 === cpNodes.length) ? 0 : i+1;
145
+ const iPrev = (i === 0) ? cpNodes.length-1 : i-1;
146
146
 
147
- let cpNodeCurr = cpNodes[i];
148
- let cpNodeNext = cpNodes[iNext];
149
- let cpNodePrev = cpNodes[iPrev];
147
+ const cpNodeCurr = cpNodes[i];
148
+ const cpNodeNext = cpNodes[iNext];
149
+ const cpNodePrev = cpNodes[iPrev];
150
150
 
151
151
  cpNodeCurr.nextOnCircle = cpNodeNext;
152
152
  cpNodeCurr.prevOnCircle = cpNodePrev;
@@ -157,11 +157,11 @@ function add2Prong(
157
157
  if (holeClosing) {
158
158
  // TODO - important - take care of case where there are more than 1 antipode
159
159
  // Duplicate ContactPoints
160
- let cpB2: ContactPoint = { pointOnShape: posAntipodes[0].pos, circle, order: cpAntipodes[0].order, order2: +1 };
161
- let newCpB2Node = CpNode.insert(true, false, cpTreeAntipodes[0], cpB2, newCpAntipodes[0]);
160
+ const cpB2: ContactPoint = { pointOnShape: posAntipodes[0].pos, circle, order: cpAntipodes[0].order, order2: +1 };
161
+ const newCpB2Node = CpNode.insert(true, false, cpTreeAntipodes[0], cpB2, newCpAntipodes[0]);
162
162
 
163
- let cpB1: ContactPoint = { pointOnShape: posSource, circle, order: cpSource.order, order2: -1 };
164
- let newCpB1Node = CpNode.insert(true, false, cpTreeSource, cpB1, newCpSource.prev);
163
+ const cpB1: ContactPoint = { pointOnShape: posSource, circle, order: cpSource.order, order2: -1 };
164
+ const newCpB1Node = CpNode.insert(true, false, cpTreeSource, cpB1, newCpSource.prev);
165
165
 
166
166
  // Connect graph
167
167
  newCpB1Node.prevOnCircle = newCpB2Node;
@@ -185,7 +185,7 @@ function add2Prong(
185
185
  elems = _debug_.generated.elems['twoProng_regular'];
186
186
  }
187
187
 
188
- let elem = elems[elems.length-1];
188
+ const elem = elems[elems.length-1];
189
189
 
190
190
  if (!newCpSource) { console.log('asas')}
191
191
  elem.cpNode = newCpSource;
@@ -230,10 +230,10 @@ function getSize(x: number, y: number) {
230
230
 
231
231
  /** @hidden */
232
232
  function byAngle(circle: Circle) {
233
- let c = circle.center;
234
- let r = circle.radius;
233
+ const c = circle.center;
234
+ const r = circle.radius;
235
235
 
236
- let exp = exponent(r);
236
+ const exp = exponent(r);
237
237
 
238
238
  return function(_a: CpNode, _b: CpNode) {
239
239
  let a = _a.cp.pointOnShape.p;
@@ -244,14 +244,14 @@ function byAngle(circle: Circle) {
244
244
  b = [b[0]-c[0], b[1]-c[1]];
245
245
 
246
246
  // Scale
247
- let ax = scale(a[0], exp);
248
- let ay = scale(a[1], exp);
249
- let bx = scale(b[0], exp);
250
- let by = scale(b[1], exp);
247
+ const ax = scale(a[0], exp);
248
+ const ay = scale(a[1], exp);
249
+ const bx = scale(b[0], exp);
250
+ const by = scale(b[1], exp);
251
251
 
252
252
  // Get 'size'
253
- let sa = getSize(ax, ay);
254
- let sb = getSize(bx, by);
253
+ const sa = getSize(ax, ay);
254
+ const sb = getSize(bx, by);
255
255
 
256
256
  return sb - sa;
257
257
  }
@@ -24,7 +24,7 @@ function add3Prong(
24
24
  δ3s: CpNode[][]
25
25
  }) {
26
26
 
27
- let { circle, ps: poss, δ3s } = threeProng;
27
+ const { circle, ps: poss, δ3s } = threeProng;
28
28
 
29
29
  // Keep for possible future debugging.
30
30
  /*
@@ -6,13 +6,11 @@ import { Mat } from '../../mat.js';
6
6
  import { getBoundingBox_ } from '../../get-bounding-box-.js';
7
7
 
8
8
 
9
- /** @hidden */
10
- declare var _debug_: Debug;
9
+ /** @internal */
10
+ declare const _debug_: Debug;
11
11
 
12
12
 
13
- if (typeof _debug_ !== 'undefined') {
14
- var timingStart: number;
15
- }
13
+ let timingStart: number;
16
14
 
17
15
 
18
16
  /** @hidden */
@@ -21,30 +19,30 @@ function addDebugInfo1(loops: Loop[]) {
21
19
 
22
20
  timingStart = performance.now();
23
21
 
24
- for (let loop of loops) {
22
+ for (const loop of loops) {
25
23
  _debug_.fs.nameObj(loop,'l|');
26
24
  }
27
25
 
28
- let generated = _debug_.generated;
26
+ const generated = _debug_.generated;
29
27
 
30
28
  //generated.elems.loop.push(...loops);
31
29
  //generated.elems.loops.push(loops);
32
30
 
33
- for (let loop of loops) {
31
+ for (const loop of loops) {
34
32
  let i = 0;
35
33
  loop.curves.forEach(function(curve: Curve) {
36
- let ps = curve.ps;
37
- let hull = getBoundingHull(ps);
34
+ const ps = curve.ps;
35
+ const hull = getBoundingHull(ps);
38
36
 
39
37
  generated.elems.boundingHull.push(hull);
40
38
 
41
- let looseBoundingBox = getBoundingBox_(ps);
39
+ const looseBoundingBox = getBoundingBox_(ps);
42
40
  generated.elems.looseBoundingBox.push(looseBoundingBox);
43
41
 
44
- let tightBoundingBox = getBoundingBoxTight(ps);
42
+ const tightBoundingBox = getBoundingBoxTight(ps);
45
43
  generated.elems.tightBoundingBox.push(tightBoundingBox);
46
44
 
47
- let corner = getCornerAtEnd(curve);
45
+ const corner = getCornerAtEnd(curve);
48
46
  if (corner.isSharp) {
49
47
  generated.elems.sharpCorner.push(curve);
50
48
  } else if (corner.isDull) {
@@ -61,8 +59,8 @@ function addDebugInfo1(loops: Loop[]) {
61
59
  function addDebugInfo2() {
62
60
  if (typeof _debug_ === 'undefined') { return; }
63
61
 
64
- let timing = _debug_.generated.timing;
65
- let now = performance.now();
62
+ const timing = _debug_.generated.timing;
63
+ const now = performance.now();
66
64
  timing.holeClosers += now - timingStart;
67
65
  timingStart = now;
68
66
  }
@@ -71,9 +69,9 @@ function addDebugInfo2() {
71
69
  function addDebugInfo3() {
72
70
  if (typeof _debug_ === 'undefined') { return; }
73
71
 
74
- let generated = _debug_.generated;
75
- let timing = generated.timing;
76
- let now = performance.now();
72
+ const generated = _debug_.generated;
73
+ const timing = generated.timing;
74
+ const now = performance.now();
77
75
 
78
76
  timing.oneAnd2Prongs += now - timingStart;
79
77
  timingStart = now;
@@ -83,8 +81,8 @@ function addDebugInfo3() {
83
81
  function addDebugInfo4(mat: Mat) {
84
82
  if (typeof _debug_ === 'undefined') { return; }
85
83
 
86
- let generated = _debug_.generated;
87
- let timing = generated.timing;
84
+ const generated = _debug_.generated;
85
+ const timing = generated.timing;
88
86
 
89
87
  generated.elems.mat.push(mat);
90
88
 
@@ -17,10 +17,10 @@ function getInterestingPointsOnLoop(
17
17
  maxLength: number) {
18
18
 
19
19
  return function(loop: Loop) {
20
- let allPoints: IPointOnShape[] = [];
20
+ const allPoints: IPointOnShape[] = [];
21
21
 
22
22
  for (let i=0; i<loop.curves.length; i++) {
23
- let curve = loop.curves[i];
23
+ const curve = loop.curves[i];
24
24
 
25
25
  // qqq if (lengthSquaredUpperBound(curve.ps) < minBezLength) {
26
26
  if (controlPointLinesLength(curve.ps) < minBezLength) {
@@ -43,10 +43,10 @@ function getInterestingPointsOnLoop(
43
43
 
44
44
  // let { maxima } = getCurvatureExtrema(curve.ps);
45
45
  // qqq let { maxCurvatureTs, maxNegativeCurvatureTs } = getCurvatureExtrema(curve.ps);
46
- let { maxima } = getCurvatureExtrema(curve.ps);
46
+ const { maxima } = getCurvatureExtrema(curve.ps);
47
47
  // let maxAbsCurvatures = maxima.map(t => new PointOnShape(curve, t));
48
48
  // qqq let maxAbsCurvatures = [...maxCurvatureTs, ...maxNegativeCurvatureTs].map(t => new PointOnShape(curve, t));
49
- let maxAbsCurvatures = [...maxima].map(t => new PointOnShape(curve, t));
49
+ const maxAbsCurvatures = [...maxima].map(t => new PointOnShape(curve, t));
50
50
 
51
51
  allPoints.push(
52
52
  ...getContactCirclesAtInterface(curve),
@@ -20,22 +20,22 @@ function createInitialCpGraph(
20
20
  let cpNode;
21
21
 
22
22
  for (let k=0; k<sharpCornerss.length; k++) {
23
- let sharpCorners = sharpCornerss[k];
23
+ const sharpCorners = sharpCornerss[k];
24
24
 
25
- // qqq let cpTree = new LlRbTree(CpNode.comparator, [], true);
26
- let cpTree = new LlRbTree(CpNode.comparator, false);
25
+ // qqq const cpTree = new LlRbTree(CpNode.comparator, [], true);
26
+ const cpTree = new LlRbTree(CpNode.comparator, false);
27
27
 
28
28
  let cpNode1 = undefined;
29
29
  let cpNode2 = undefined;
30
- for (let pos of sharpCorners) {
31
- let ps = pos.curve.next.ps;
32
- //let x = xMap.get(ps);
33
- //let isIntersection = !!x;
30
+ for (const pos of sharpCorners) {
31
+ const ps = pos.curve.next.ps;
32
+ //const x = xMap.get(ps);
33
+ //const isIntersection = !!x;
34
34
 
35
- let circle = { center: pos.p, radius: 0 };
35
+ const circle = { center: pos.p, radius: 0 };
36
36
 
37
- let cp1: ContactPoint = { pointOnShape: pos, circle, order: -1, order2: 0 };
38
- let cp2: ContactPoint = { pointOnShape: pos, circle, order: +1, order2: 0 };
37
+ const cp1: ContactPoint = { pointOnShape: pos, circle, order: -1, order2: 0 };
38
+ const cp2: ContactPoint = { pointOnShape: pos, circle, order: +1, order2: 0 };
39
39
 
40
40
  cpNode1 = CpNode.insert(false, /*isIntersection*/ false, cpTree, cp1, cpNode2);
41
41
  cpNode2 = CpNode.insert(false, /*isIntersection*/ false, cpTree, cp2, cpNode1);
@@ -49,7 +49,7 @@ function createInitialCpGraph(
49
49
 
50
50
  if (!cpNode) { cpNode = cpNode1; }
51
51
 
52
- let loop = loops[k];
52
+ const loop = loops[k];
53
53
  cpTrees.set(loop, cpTree);
54
54
  }
55
55
 
@@ -1,5 +1,5 @@
1
- /** @hidden */
2
- declare var _debug_: Debug;
1
+ /** @internal */
2
+ declare const _debug_: Debug;
3
3
 
4
4
  import { Debug } from '../../../debug/debug.js';
5
5
  import { IPointOnShape } from '../../../point-on-shape.js';
@@ -23,7 +23,7 @@ function addDebugInfo(
23
23
  xs: TXForDebugging[],
24
24
  holeClosing: boolean) {
25
25
 
26
- let twoProng: TwoProngForDebugging = {
26
+ const twoProng: TwoProngForDebugging = {
27
27
  generated: _debug_.generated,
28
28
  bezierPieces,
29
29
  pos,
@@ -38,7 +38,7 @@ function addDebugInfo(
38
38
  cpNode: undefined
39
39
  };
40
40
 
41
- let twoProngType = getTwoProngType(twoProng) as ElemType_TwoProng;
41
+ const twoProngType = getTwoProngType(twoProng) as ElemType_TwoProng;
42
42
  _debug_.generated.elems[twoProngType].push(twoProng);
43
43
  }
44
44
 
@@ -25,12 +25,12 @@ function cullBezierPieces(
25
25
  }
26
26
 
27
27
 
28
- let newPieces = [];
29
- for (let bezierPiece of bezierPieces) {
30
- let ps = bezierPiece.curve.ps;
28
+ const newPieces = [];
29
+ for (const bezierPiece of bezierPieces) {
30
+ const ps = bezierPiece.curve.ps;
31
31
 
32
- let rect = getBoundingBox_(ps);
33
- let bd = getClosestSquareDistanceToRect(rect, p);
32
+ const rect = getBoundingBox_(ps);
33
+ const bd = getClosestSquareDistanceToRect(rect, p);
34
34
  if (bd <= rSquared * TOLERANCE) {
35
35
  newPieces.push(bezierPiece);
36
36
  }
@@ -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 { lineLineIntersection, distanceBetween, squaredDistanceBetween, interpolate, dot } from 'flo-vector2d';
@@ -67,7 +67,7 @@ function find2Prong(
67
67
 
68
68
  // The boundary piece that should contain the other point of
69
69
  // the 2-prong circle. (Defined by start and end points).
70
- let { bezierPieces, δ } = getInitialBezierPieces(
70
+ const { bezierPieces, δ } = getInitialBezierPieces(
71
71
  isHoleClosing, k, loops, cpTrees, y
72
72
  );
73
73
  //console.log(bezierPieces.length)
@@ -88,14 +88,14 @@ function find2Prong(
88
88
  }
89
89
 
90
90
  // The lines below is an optimization.
91
- let r_ = reduceRadius(extreme, bezierPieces, p, x);
91
+ const r_ = reduceRadius(extreme, bezierPieces, p, x);
92
92
  if (r > r_) {
93
93
  x = interpolate(p, x, Math.sqrt(r_/r));
94
94
  }
95
95
 
96
96
 
97
97
  /** Trace the convergence (for debugging). */
98
- let xs: TXForDebugging[] = [];
98
+ const xs: TXForDebugging[] = [];
99
99
  /** The antipode of the two-prong (successively refined) */
100
100
  let z: { pos: IPointOnShape; d: number };
101
101
  let i = 0;
@@ -107,7 +107,7 @@ function find2Prong(
107
107
  i++
108
108
 
109
109
  /** squared distance between source boundary point and circle center */
110
- let r = squaredDistanceBetween(x, y.p);
110
+ const r = squaredDistanceBetween(x, y.p);
111
111
 
112
112
  bezierPieces_ = cullBezierPieces(bezierPieces_, x, r);
113
113
 
@@ -120,11 +120,11 @@ function find2Prong(
120
120
 
121
121
  if (z === undefined) {
122
122
  if (typeof _debug_ !== 'undefined') {
123
- let elems = _debug_.generated.elems;
124
- let elem = isHoleClosing
123
+ const elems = _debug_.generated.elems;
124
+ const elem = isHoleClosing
125
125
  ? elems.twoProng_holeClosing
126
126
  : elems.twoProng_regular
127
- let elemStr = isHoleClosing
127
+ const elemStr = isHoleClosing
128
128
  ? 'hole-closing: ' + elem.length
129
129
  : 'regular: ' + elem.length;
130
130
  console.log(
@@ -140,7 +140,7 @@ function find2Prong(
140
140
  }
141
141
 
142
142
  /** squared distance between anti-pode boundary point and circle center */
143
- let d = squaredDistanceBetween(x, z.pos.p);
143
+ const d = squaredDistanceBetween(x, z.pos.p);
144
144
  //if (i === 1 && d*oneProngTolerance >= r) {
145
145
  if (i === 1 && r < d+oneProngTolerance) {
146
146
  // It is a 1-prong.
@@ -174,9 +174,9 @@ function find2Prong(
174
174
 
175
175
  // Find the point on the line connecting y with x that is
176
176
  // equidistant from y and z. This will be our next x.
177
- let nextX = findEquidistantPointOnLine(x, y.p, z.pos.p);
177
+ const nextX = findEquidistantPointOnLine(x, y.p, z.pos.p);
178
178
 
179
- let squaredError = squaredDistanceBetween(x, nextX);
179
+ const squaredError = squaredDistanceBetween(x, nextX);
180
180
 
181
181
  x = nextX;
182
182
 
@@ -235,28 +235,28 @@ function reduceRadius(
235
235
  let prevP = undefined;
236
236
  let minRadius = Number.POSITIVE_INFINITY;
237
237
  for (let i=0; i<bezierPieces.length; i++) {
238
- let bezierPiece = bezierPieces[i];
238
+ const bezierPiece = bezierPieces[i];
239
239
 
240
- let ps = bezierPiece.curve.ps;
240
+ const ps = bezierPiece.curve.ps;
241
241
 
242
- let p1 = evalDeCasteljau(ps, bezierPiece.ts[0]);
242
+ const p1 = evalDeCasteljau(ps, bezierPiece.ts[0]);
243
243
  let r1 = Number.POSITIVE_INFINITY;
244
244
 
245
245
  // Prevent evaluating the same points twice
246
246
  if (!prevP || prevP[0] !== p1[0] || prevP[1] !== p1[1]) {
247
- let cc1 = getCircleCenterFrom2PointsAndNormal(extreme, p, x, p1);
247
+ const cc1 = getCircleCenterFrom2PointsAndNormal(extreme, p, x, p1);
248
248
  if (cc1) { r1 = squaredDistanceBetween(p, cc1); }
249
249
  }
250
250
 
251
251
  let r2 = Number.POSITIVE_INFINITY;
252
- let p2 = evalDeCasteljau(ps, bezierPiece.ts[1]);
252
+ const p2 = evalDeCasteljau(ps, bezierPiece.ts[1]);
253
253
 
254
- let cc2 = getCircleCenterFrom2PointsAndNormal(extreme, p, x, p2);
254
+ const cc2 = getCircleCenterFrom2PointsAndNormal(extreme, p, x, p2);
255
255
  if (cc2) { r2 = squaredDistanceBetween(p, cc2); }
256
256
 
257
257
  prevP = p2;
258
258
 
259
- let d = Math.min(r1, r2);
259
+ const d = Math.min(r1, r2);
260
260
 
261
261
  if (d < minRadius) {
262
262
  minRadius = d;
@@ -283,7 +283,7 @@ function getCircleCenterFrom2PointsAndNormal(
283
283
  p1: number[]) {
284
284
 
285
285
  // TODO - remove delta
286
- let TOLERANCE = (1e-4 * extreme)**2;
286
+ const TOLERANCE = (1e-4 * extreme)**2;
287
287
 
288
288
  // Ignore if p and p1 are too close together
289
289
  if (squaredDistanceBetween(p,p1) < TOLERANCE) {
@@ -291,20 +291,20 @@ function getCircleCenterFrom2PointsAndNormal(
291
291
  }
292
292
 
293
293
  /** The perpindicular bisector between the two given points on the circle */
294
- let pb = [
294
+ const pb = [
295
295
  (p[0] + p1[0]) / 2,
296
296
  (p[1] + p1[1]) / 2,
297
297
  ];
298
- let tan = [p1[0] - p[0], p1[1] - p[1]];
299
- let norm = [-tan[1], tan[0]]; // Rotate by 90 degrees
300
- let pb2 = [pb[0] + norm[0], pb[1] + norm[1]];
298
+ const tan = [p1[0] - p[0], p1[1] - p[1]];
299
+ const norm = [-tan[1], tan[0]]; // Rotate by 90 degrees
300
+ const pb2 = [pb[0] + norm[0], pb[1] + norm[1]];
301
301
 
302
- let res = lineLineIntersection([p,x], [pb, pb2]);
302
+ const res = lineLineIntersection([p,x], [pb, pb2]);
303
303
 
304
304
  if (!res) { return undefined; }
305
305
 
306
- let resO = [res[0] - p[0], res[1] - p[1]];
307
- let xO = [x[0] - p[0], x[1] - p[1]];
306
+ const resO = [res[0] - p[0], res[1] - p[1]];
307
+ const xO = [x[0] - p[0], x[1] - p[1]];
308
308
  if (dot(resO, xO) < 0) {
309
309
  return undefined;
310
310
  }
@@ -10,7 +10,7 @@ function findEquidistantPointOnLine(x: number[], y: number[], z: number[]) {
10
10
  // Some basic algebra (not shown) finds the required point.
11
11
 
12
12
  // Swap axes if x and y are more aligned to y-axis than to x-axis.
13
- let swapAxes = Math.abs((x[1] - y[1]) / (x[0] - y[0])) > 1;
13
+ const swapAxes = Math.abs((x[1] - y[1]) / (x[0] - y[0])) > 1;
14
14
 
15
15
  // Cache
16
16
  let x1, x2, y1, y2, z1, z2;
@@ -26,12 +26,12 @@ function findEquidistantPointOnLine(x: number[], y: number[], z: number[]) {
26
26
  }
27
27
 
28
28
  // a <= 1 (due to swapped axes)
29
- let a = (x2 - y2) / (x1 - y1);
30
- let b = y2 - a*y1;
31
- let c = (y1*y1 + y2*y2 - z1*z1 - z2*z2) + 2*b*(z2 - y2);
32
- let d = y1 - z1 + a*(y2 - z2);
33
- let t1 = c/(2*d);
34
- let t2 = a*t1 + b;
29
+ const a = (x2 - y2) / (x1 - y1);
30
+ const b = y2 - a*y1;
31
+ const c = (y1*y1 + y2*y2 - z1*z1 - z2*z2) + 2*b*(z2 - y2);
32
+ const d = y1 - z1 + a*(y2 - z2);
33
+ const t1 = c/(2*d);
34
+ const t2 = a*t1 + b;
35
35
 
36
36
  return swapAxes ? [t2,t1] : [t1,t2];
37
37
  }
@@ -21,17 +21,17 @@ function getInitialBezierPieces(
21
21
  if (isHoleClosing) {
22
22
  bezierPieces = [];
23
23
  for (let k2=0; k2<k; k2++) {
24
- let pieces: BezierPiece[] = loops[k2].curves
24
+ const pieces: BezierPiece[] = loops[k2].curves
25
25
  .map(curve => ({ curve, ts: [0,1] }))
26
26
  bezierPieces.push(...pieces);
27
27
  }
28
28
  } else {
29
29
  //let order = PointOnShape.isDullCorner(y)
30
- let order = isPosDullCorner(y)
30
+ const order = isPosDullCorner(y)
31
31
  ? y.t === 1 ? -1 : +1
32
32
  : 0;
33
- let loop = loops[k];
34
- let cpNode = getNeighbouringPoints(cpTrees.get(loop), y, order, 0)[0];
33
+ const loop = loops[k];
34
+ const cpNode = getNeighbouringPoints(cpTrees.get(loop), y, order, 0)[0];
35
35
  δ = [cpNode, cpNode];
36
36
  if (!cpNode ||
37
37
  // The special case if there is only a single sharp corner or
@@ -20,7 +20,7 @@ function calcBetterX(
20
20
  x: number[],
21
21
  vectorToZeroV: number[]) {
22
22
 
23
- let V = len(vectorToZeroV);
23
+ const V = len(vectorToZeroV);
24
24
 
25
25
  let nu = 1;
26
26
  let better;
@@ -29,15 +29,15 @@ function calcBetterX(
29
29
  let newV;
30
30
  let i = 0; // Safeguard
31
31
  do {
32
- let shift = scale(vectorToZeroV, nu);
32
+ const shift = scale(vectorToZeroV, nu);
33
33
  newX = translate(shift, x);
34
34
 
35
35
 
36
36
  newPs = getClosestPoints(newX, bezierPiece3s);
37
37
 
38
38
  // Point of zero V
39
- let newCircleCenter = circumCenter(newPs.map(pos => pos.p));
40
- let newVectorToZeroV = fromTo(newX, newCircleCenter);
39
+ const newCircleCenter = circumCenter(newPs.map(pos => pos.p));
40
+ const newVectorToZeroV = fromTo(newX, newCircleCenter);
41
41
  newV = len(newVectorToZeroV);
42
42
 
43
43
  better = newV < V;
@@ -18,16 +18,16 @@ function calcInitial3ProngCenter(
18
18
  δ3s: CpNode[][],
19
19
  bezierPiece3s: BezierPiece[][]) {
20
20
 
21
- let twoProngCircleCenter = δ3s[0][0].cp.circle.center;
21
+ const twoProngCircleCenter = δ3s[0][0].cp.circle.center;
22
22
 
23
- let posInfo = getClosestBoundaryPoint(
23
+ const posInfo = getClosestBoundaryPoint(
24
24
  bezierPiece3s[1],
25
25
  twoProngCircleCenter,
26
26
  undefined, // curve
27
27
  undefined // t
28
28
  );
29
29
 
30
- let meanPoints = [
30
+ const meanPoints = [
31
31
  δ3s[0][0].cp.pointOnShape.p,
32
32
  posInfo.pos.p,
33
33
  δ3s[2][1].cp.pointOnShape.p,