flo-mat 2.0.1 → 2.0.3

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 (405) hide show
  1. package/.eslintrc.cjs +69 -0
  2. package/README.md +9 -27
  3. package/browser/index.js +29604 -7008
  4. package/browser/index.min.js +1 -2
  5. package/node/circle.d.ts +20 -20
  6. package/node/circle.js +31 -31
  7. package/node/circle.js.map +1 -1
  8. package/node/compare-curvatures-at-interface.d.ts +19 -19
  9. package/node/compare-curvatures-at-interface.js +124 -124
  10. package/node/compare-curvatures-at-interface.js.map +1 -1
  11. package/node/contact-point.d.ts +26 -26
  12. package/node/contact-point.js +25 -25
  13. package/node/cp-node/clone.d.ts +8 -8
  14. package/node/cp-node/clone.js +31 -31
  15. package/node/cp-node/clone.js.map +1 -1
  16. package/node/cp-node/remove.d.ts +9 -9
  17. package/node/cp-node/remove.js +19 -19
  18. package/node/cp-node/remove.js.map +1 -1
  19. package/node/cp-node.d.ts +202 -202
  20. package/node/cp-node.js +320 -320
  21. package/node/cp-node.js.map +1 -1
  22. package/node/curve.d.ts +46 -46
  23. package/node/curve.js +88 -88
  24. package/node/curve.js.map +1 -1
  25. package/node/debug/cp-node-for-debugging.d.ts +11 -11
  26. package/node/debug/cp-node-for-debugging.js +1 -1
  27. package/node/debug/debug-elem-types.d.ts +32 -32
  28. package/node/debug/debug-elem-types.js +1 -1
  29. package/node/debug/debug.d.ts +50 -50
  30. package/node/debug/debug.js +75 -75
  31. package/node/debug/functions/draw-elem/bounding-hull.d.ts +3 -3
  32. package/node/debug/functions/draw-elem/bounding-hull.js +7 -7
  33. package/node/debug/functions/draw-elem/bounding-hull.js.map +1 -1
  34. package/node/debug/functions/draw-elem/branch.d.ts +4 -4
  35. package/node/debug/functions/draw-elem/branch.js +22 -22
  36. package/node/debug/functions/draw-elem/branch.js.map +1 -1
  37. package/node/debug/functions/draw-elem/culls.d.ts +4 -4
  38. package/node/debug/functions/draw-elem/culls.js +21 -21
  39. package/node/debug/functions/draw-elem/culls.js.map +1 -1
  40. package/node/debug/functions/draw-elem/draw-circle-percent.d.ts +3 -3
  41. package/node/debug/functions/draw-elem/draw-circle-percent.js +12 -12
  42. package/node/debug/functions/draw-elem/draw-circle-percent.js.map +1 -1
  43. package/node/debug/functions/draw-elem/draw-elem.d.ts +8 -8
  44. package/node/debug/functions/draw-elem/draw-elem.js +45 -45
  45. package/node/debug/functions/draw-elem/draw-elem.js.map +1 -1
  46. package/node/debug/functions/draw-elem/dull-corner.d.ts +4 -4
  47. package/node/debug/functions/draw-elem/dull-corner.js +10 -10
  48. package/node/debug/functions/draw-elem/dull-corner.js.map +1 -1
  49. package/node/debug/functions/draw-elem/leaves.d.ts +4 -4
  50. package/node/debug/functions/draw-elem/leaves.js +12 -12
  51. package/node/debug/functions/draw-elem/leaves.js.map +1 -1
  52. package/node/debug/functions/draw-elem/loop.d.ts +4 -4
  53. package/node/debug/functions/draw-elem/loop.js +11 -11
  54. package/node/debug/functions/draw-elem/loops.d.ts +4 -4
  55. package/node/debug/functions/draw-elem/loops.js +6 -6
  56. package/node/debug/functions/draw-elem/loose-bounding-box.d.ts +3 -3
  57. package/node/debug/functions/draw-elem/loose-bounding-box.js +9 -9
  58. package/node/debug/functions/draw-elem/loose-bounding-box.js.map +1 -1
  59. package/node/debug/functions/draw-elem/mat.d.ts +4 -4
  60. package/node/debug/functions/draw-elem/mat.js +30 -30
  61. package/node/debug/functions/draw-elem/mat.js.map +1 -1
  62. package/node/debug/functions/draw-elem/max-vertex.d.ts +4 -4
  63. package/node/debug/functions/draw-elem/max-vertex.js +8 -8
  64. package/node/debug/functions/draw-elem/max-vertex.js.map +1 -1
  65. package/node/debug/functions/draw-elem/min-y.d.ts +4 -4
  66. package/node/debug/functions/draw-elem/min-y.js +13 -13
  67. package/node/debug/functions/draw-elem/min-y.js.map +1 -1
  68. package/node/debug/functions/draw-elem/one-prong-at-dull-corner.d.ts +4 -4
  69. package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js +12 -12
  70. package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js.map +1 -1
  71. package/node/debug/functions/draw-elem/one-prong.d.ts +4 -4
  72. package/node/debug/functions/draw-elem/one-prong.js +16 -16
  73. package/node/debug/functions/draw-elem/one-prong.js.map +1 -1
  74. package/node/debug/functions/draw-elem/sharp-corner.d.ts +4 -4
  75. package/node/debug/functions/draw-elem/sharp-corner.js +9 -9
  76. package/node/debug/functions/draw-elem/sharp-corner.js.map +1 -1
  77. package/node/debug/functions/draw-elem/three-prong.d.ts +4 -4
  78. package/node/debug/functions/draw-elem/three-prong.js +16 -16
  79. package/node/debug/functions/draw-elem/three-prong.js.map +1 -1
  80. package/node/debug/functions/draw-elem/tight-bounding-box.d.ts +3 -3
  81. package/node/debug/functions/draw-elem/tight-bounding-box.js +7 -7
  82. package/node/debug/functions/draw-elem/tight-bounding-box.js.map +1 -1
  83. package/node/debug/functions/draw-elem/two-prong.d.ts +4 -4
  84. package/node/debug/functions/draw-elem/two-prong.js +36 -36
  85. package/node/debug/functions/draw-elem/two-prong.js.map +1 -1
  86. package/node/debug/functions/draw-elem/vertex.d.ts +4 -4
  87. package/node/debug/functions/draw-elem/vertex.js +27 -27
  88. package/node/debug/functions/draw-elem/vertex.js.map +1 -1
  89. package/node/debug/functions/general.d.ts +48 -48
  90. package/node/debug/functions/general.js +52 -52
  91. package/node/debug/functions/general.js.map +1 -1
  92. package/node/debug/functions/three-prong.d.ts +11 -11
  93. package/node/debug/functions/three-prong.js +184 -184
  94. package/node/debug/functions/three-prong.js.map +1 -1
  95. package/node/debug/functions/two-prong.d.ts +13 -13
  96. package/node/debug/functions/two-prong.js +117 -117
  97. package/node/debug/functions/two-prong.js.map +1 -1
  98. package/node/debug/three-prong-for-debugging.d.ts +31 -31
  99. package/node/debug/three-prong-for-debugging.js +20 -20
  100. package/node/debug/two-prong-for-debugging.d.ts +26 -26
  101. package/node/debug/two-prong-for-debugging.js +1 -1
  102. package/node/find-mats.d.ts +26 -26
  103. package/node/find-mats.js +122 -125
  104. package/node/find-mats.js.map +1 -1
  105. package/node/get-boundary-bezier-parts-to-next.d.ts +9 -9
  106. package/node/get-boundary-bezier-parts-to-next.js +42 -42
  107. package/node/get-boundary-bezier-parts-to-next.js.map +1 -1
  108. package/node/get-boundary-beziers-to-next.d.ts +8 -8
  109. package/node/get-boundary-beziers-to-next.js +44 -44
  110. package/node/get-boundary-beziers-to-next.js.map +1 -1
  111. package/node/get-bounding-box-.d.ts +2 -2
  112. package/node/get-bounding-box-.js +4 -4
  113. package/node/get-branches.d.ts +12 -12
  114. package/node/get-branches.js +68 -68
  115. package/node/get-branches.js.map +1 -1
  116. package/node/get-curve/get-curve-between.d.ts +9 -9
  117. package/node/get-curve/get-curve-between.js +56 -56
  118. package/node/get-curve/get-curve-between.js.map +1 -1
  119. package/node/get-curve/get-edge-direction.d.ts +9 -9
  120. package/node/get-curve/get-edge-direction.js +53 -53
  121. package/node/get-curve/get-edge-direction.js.map +1 -1
  122. package/node/get-curve-to-next.d.ts +9 -9
  123. package/node/get-curve-to-next.js +11 -11
  124. package/node/get-interface-ccw.d.ts +24 -24
  125. package/node/get-interface-ccw.js +97 -97
  126. package/node/get-interface-ccw.js.map +1 -1
  127. package/node/index.d.ts +36 -36
  128. package/node/index.js +32 -32
  129. package/node/loop/get-max-coordinate.d.ts +10 -10
  130. package/node/loop/get-max-coordinate.js +43 -43
  131. package/node/loop/get-max-coordinate.js.map +1 -1
  132. package/node/loop.d.ts +16 -16
  133. package/node/loop.js +34 -34
  134. package/node/loop.js.map +1 -1
  135. package/node/mat/add-to-cp-graph.d.ts +16 -16
  136. package/node/mat/add-to-cp-graph.js +30 -30
  137. package/node/mat/add-to-cp-graph.js.map +1 -1
  138. package/node/mat/bezier-piece.d.ts +12 -12
  139. package/node/mat/bezier-piece.js +1 -1
  140. package/node/mat/closest-boundary-point/closest-points-on-curve.d.ts +14 -14
  141. package/node/mat/closest-boundary-point/closest-points-on-curve.js +72 -73
  142. package/node/mat/closest-boundary-point/closest-points-on-curve.js.map +1 -1
  143. package/node/mat/closest-boundary-point/cull-bezier-pieces.d.ts +9 -9
  144. package/node/mat/closest-boundary-point/cull-bezier-pieces.js +19 -19
  145. package/node/mat/closest-boundary-point/cull-bezier-pieces.js.map +1 -1
  146. package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.d.ts +11 -11
  147. package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.js +24 -24
  148. package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.js.map +1 -1
  149. package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.d.ts +11 -11
  150. package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.js +26 -26
  151. package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.js.map +1 -1
  152. package/node/mat/closest-boundary-point/get-best-distance-squared.d.ts +8 -8
  153. package/node/mat/closest-boundary-point/get-best-distance-squared.js +24 -24
  154. package/node/mat/closest-boundary-point/get-best-distance-squared.js.map +1 -1
  155. package/node/mat/closest-boundary-point/get-close-boundary-points.d.ts +17 -17
  156. package/node/mat/closest-boundary-point/get-close-boundary-points.js +80 -80
  157. package/node/mat/closest-boundary-point/get-close-boundary-points.js.map +1 -1
  158. package/node/mat/closest-boundary-point/get-closest-boundary-point.d.ts +18 -18
  159. package/node/mat/closest-boundary-point/get-closest-boundary-point.js +40 -40
  160. package/node/mat/closest-boundary-point/get-closest-boundary-point.js.map +1 -1
  161. package/node/mat/corner.d.ts +37 -37
  162. package/node/mat/corner.js +1 -1
  163. package/node/mat/create-new-cp-tree.d.ts +9 -9
  164. package/node/mat/create-new-cp-tree.js +23 -23
  165. package/node/mat/create-new-cp-tree.js.map +1 -1
  166. package/node/mat/elem-type-two-prong.d.ts +3 -3
  167. package/node/mat/elem-type-two-prong.js +1 -1
  168. package/node/mat/find-mat/add-1-prong.d.ts +12 -12
  169. package/node/mat/find-mat/add-1-prong.js +42 -42
  170. package/node/mat/find-mat/add-1-prong.js.map +1 -1
  171. package/node/mat/find-mat/add-2-prong.d.ts +21 -21
  172. package/node/mat/find-mat/add-2-prong.js +192 -192
  173. package/node/mat/find-mat/add-2-prong.js.map +1 -1
  174. package/node/mat/find-mat/add-3-prong.d.ts +19 -19
  175. package/node/mat/find-mat/add-3-prong.js +54 -54
  176. package/node/mat/find-mat/add-3-prong.js.map +1 -1
  177. package/node/mat/find-mat/add-debug-info.d.ts +9 -9
  178. package/node/mat/find-mat/add-debug-info.js +67 -69
  179. package/node/mat/find-mat/add-debug-info.js.map +1 -1
  180. package/node/mat/find-mat/create-get-interesting-points-on-loop.d.ts +11 -11
  181. package/node/mat/find-mat/create-get-interesting-points-on-loop.js +51 -51
  182. package/node/mat/find-mat/create-get-interesting-points-on-loop.js.map +1 -1
  183. package/node/mat/find-mat/create-initial-cp-graph.d.ts +12 -12
  184. package/node/mat/find-mat/create-initial-cp-graph.js +40 -40
  185. package/node/mat/find-mat/create-initial-cp-graph.js.map +1 -1
  186. package/node/mat/find-mat/find-2-prong/add-debug-info.d.ts +8 -8
  187. package/node/mat/find-mat/find-2-prong/add-debug-info.js +21 -21
  188. package/node/mat/find-mat/find-2-prong/add-debug-info.js.map +1 -1
  189. package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.d.ts +11 -11
  190. package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js +29 -29
  191. package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js.map +1 -1
  192. package/node/mat/find-mat/find-2-prong/find-2-prong.d.ts +37 -37
  193. package/node/mat/find-mat/find-2-prong/find-2-prong.js +232 -232
  194. package/node/mat/find-mat/find-2-prong/find-2-prong.js.map +1 -1
  195. package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.d.ts +9 -9
  196. package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js +39 -39
  197. package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js.map +1 -1
  198. package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.d.ts +11 -11
  199. package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js +37 -37
  200. package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js.map +1 -1
  201. package/node/mat/find-mat/find-2-prong/x-for-debugging.d.ts +9 -9
  202. package/node/mat/find-mat/find-2-prong/x-for-debugging.js +1 -1
  203. package/node/mat/find-mat/find-3-prong/calc-better-x.d.ts +19 -19
  204. package/node/mat/find-mat/find-3-prong/calc-better-x.js +36 -36
  205. package/node/mat/find-mat/find-3-prong/calc-better-x.js.map +1 -1
  206. package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.d.ts +13 -13
  207. package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.js +25 -25
  208. package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.js.map +1 -1
  209. package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.d.ts +22 -22
  210. package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.js +159 -159
  211. package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.js.map +1 -1
  212. package/node/mat/find-mat/find-3-prong/find-3-prong.d.ts +16 -16
  213. package/node/mat/find-mat/find-3-prong/find-3-prong.js +76 -76
  214. package/node/mat/find-mat/find-3-prong/find-3-prong.js.map +1 -1
  215. package/node/mat/find-mat/find-3-prong/get-closest-points.d.ts +9 -9
  216. package/node/mat/find-mat/find-3-prong/get-closest-points.js +16 -16
  217. package/node/mat/find-mat/find-3-prong/get-closest-points.js.map +1 -1
  218. package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.d.ts +15 -15
  219. package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.js +20 -20
  220. package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.js.map +1 -1
  221. package/node/mat/find-mat/find-and-add-2-prongs.d.ts +16 -16
  222. package/node/mat/find-mat/find-and-add-2-prongs.js +73 -74
  223. package/node/mat/find-mat/find-and-add-2-prongs.js.map +1 -1
  224. package/node/mat/find-mat/find-and-add-3-prongs.d.ts +13 -13
  225. package/node/mat/find-mat/find-and-add-3-prongs.js +146 -147
  226. package/node/mat/find-mat/find-and-add-3-prongs.js.map +1 -1
  227. package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.d.ts +14 -14
  228. package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.js +33 -33
  229. package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.js.map +1 -1
  230. package/node/mat/find-mat/get-potential-2-prongs.d.ts +4 -4
  231. package/node/mat/find-mat/get-potential-2-prongs.js +16 -16
  232. package/node/mat/find-mat/get-potential-2-prongs.js.map +1 -1
  233. package/node/mat/find-mat/get-sharp-corners.d.ts +4 -4
  234. package/node/mat/find-mat/get-sharp-corners.js +17 -17
  235. package/node/mat/find-mat/get-sharp-corners.js.map +1 -1
  236. package/node/mat/geometry/get-closest-square-distance-to-rect.d.ts +5 -5
  237. package/node/mat/geometry/get-closest-square-distance-to-rect.js +49 -49
  238. package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.d.ts +5 -5
  239. package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.js +15 -15
  240. package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.js.map +1 -1
  241. package/node/mat/get-boundary-piece-beziers.d.ts +11 -11
  242. package/node/mat/get-boundary-piece-beziers.js +58 -58
  243. package/node/mat/get-boundary-piece-beziers.js.map +1 -1
  244. package/node/mat/get-contact-circles-at-interface.d.ts +8 -8
  245. package/node/mat/get-contact-circles-at-interface.js +20 -20
  246. package/node/mat/get-contact-circles-at-interface.js.map +1 -1
  247. package/node/mat/get-largest-vertex.d.ts +4 -4
  248. package/node/mat/get-largest-vertex.js +9 -9
  249. package/node/mat/get-leaves.d.ts +4 -4
  250. package/node/mat/get-leaves.js +12 -12
  251. package/node/mat/get-leaves.js.map +1 -1
  252. package/node/mat/get-neighboring-cps.d.ts +14 -14
  253. package/node/mat/get-neighboring-cps.js +30 -30
  254. package/node/mat/get-neighboring-cps.js.map +1 -1
  255. package/node/mat/get-two-prong-type.d.ts +5 -5
  256. package/node/mat/get-two-prong-type.js +8 -8
  257. package/node/mat/is-another-cp-closeby.d.ts +20 -20
  258. package/node/mat/is-another-cp-closeby.js +55 -55
  259. package/node/mat/is-another-cp-closeby.js.map +1 -1
  260. package/node/mat/simplify-mat-map-only.d.ts +23 -23
  261. package/node/mat/simplify-mat-map-only.js +80 -80
  262. package/node/mat/simplify-mat-map-only.js.map +1 -1
  263. package/node/mat/to-scale-axis/add-debug-info.d.ts +7 -7
  264. package/node/mat/to-scale-axis/add-debug-info.js +13 -13
  265. package/node/mat/to-scale-axis/add-debug-info.js.map +1 -1
  266. package/node/mat/to-scale-axis/cull-non-cycles.d.ts +9 -9
  267. package/node/mat/to-scale-axis/cull-non-cycles.js +51 -51
  268. package/node/mat/to-scale-axis/cull-non-cycles.js.map +1 -1
  269. package/node/mat/to-scale-axis/cull.d.ts +12 -12
  270. package/node/mat/to-scale-axis/cull.js +132 -132
  271. package/node/mat/to-scale-axis/cull.js.map +1 -1
  272. package/node/mat/trim-mat.d.ts +8 -8
  273. package/node/mat/trim-mat.js +16 -16
  274. package/node/mat/trim-mat.js.map +1 -1
  275. package/node/mat.d.ts +22 -22
  276. package/node/mat.js +1 -1
  277. package/node/point-on-shape.d.ts +73 -73
  278. package/node/point-on-shape.js +167 -167
  279. package/node/point-on-shape.js.map +1 -1
  280. package/node/simplify-mat.d.ts +16 -16
  281. package/node/simplify-mat.js +71 -71
  282. package/node/simplify-mat.js.map +1 -1
  283. package/node/svg/get-loop-bounds.d.ts +12 -12
  284. package/node/svg/get-loop-bounds.js +80 -80
  285. package/node/svg/get-loop-bounds.js.map +1 -1
  286. package/node/svg/get-min-y-pos.d.ts +8 -8
  287. package/node/svg/get-min-y-pos.js +9 -9
  288. package/node/svg/get-shape-bounds.d.ts +9 -9
  289. package/node/svg/get-shape-bounds.js +35 -35
  290. package/node/svg/get-shape-bounds.js.map +1 -1
  291. package/node/sweep-line/sweep-line.d.ts +18 -18
  292. package/node/sweep-line/sweep-line.js +72 -72
  293. package/node/sweep-line/sweep-line.js.map +1 -1
  294. package/node/to-scale-axis.d.ts +16 -16
  295. package/node/to-scale-axis.js +74 -73
  296. package/node/to-scale-axis.js.map +1 -1
  297. package/node/traverse-edges.d.ts +10 -10
  298. package/node/traverse-edges.js +21 -21
  299. package/node/traverse-edges.js.map +1 -1
  300. package/node/traverse-vertices.d.ts +12 -12
  301. package/node/traverse-vertices.js +27 -27
  302. package/node/traverse-vertices.js.map +1 -1
  303. package/package.json +29 -24
  304. package/src/circle.ts +3 -3
  305. package/src/compare-curvatures-at-interface.ts +36 -36
  306. package/src/cp-node/clone.ts +6 -6
  307. package/src/cp-node/remove.ts +4 -4
  308. package/src/cp-node.ts +20 -20
  309. package/src/curve.ts +19 -19
  310. package/src/debug/functions/draw-elem/bounding-hull.ts +2 -2
  311. package/src/debug/functions/draw-elem/branch.ts +4 -4
  312. package/src/debug/functions/draw-elem/culls.ts +4 -4
  313. package/src/debug/functions/draw-elem/draw-circle-percent.ts +2 -2
  314. package/src/debug/functions/draw-elem/draw-elem.ts +1 -1
  315. package/src/debug/functions/draw-elem/dull-corner.ts +3 -3
  316. package/src/debug/functions/draw-elem/leaves.ts +4 -4
  317. package/src/debug/functions/draw-elem/loose-bounding-box.ts +2 -2
  318. package/src/debug/functions/draw-elem/mat.ts +4 -4
  319. package/src/debug/functions/draw-elem/max-vertex.ts +2 -2
  320. package/src/debug/functions/draw-elem/min-y.ts +3 -3
  321. package/src/debug/functions/draw-elem/one-prong-at-dull-corner.ts +4 -4
  322. package/src/debug/functions/draw-elem/one-prong.ts +4 -4
  323. package/src/debug/functions/draw-elem/sharp-corner.ts +2 -2
  324. package/src/debug/functions/draw-elem/three-prong.ts +7 -7
  325. package/src/debug/functions/draw-elem/tight-bounding-box.ts +1 -1
  326. package/src/debug/functions/draw-elem/two-prong.ts +1 -1
  327. package/src/debug/functions/draw-elem/vertex.ts +20 -14
  328. package/src/debug/functions/general.ts +3 -3
  329. package/src/debug/functions/three-prong.ts +37 -37
  330. package/src/debug/functions/two-prong.ts +15 -15
  331. package/src/find-mats.ts +19 -19
  332. package/src/get-boundary-bezier-parts-to-next.ts +8 -8
  333. package/src/get-boundary-beziers-to-next.ts +8 -8
  334. package/src/get-branches.ts +7 -7
  335. package/src/get-curve/get-curve-between.ts +21 -21
  336. package/src/get-curve/get-edge-direction.ts +13 -14
  337. package/src/get-interface-ccw.ts +12 -12
  338. package/src/loop/get-max-coordinate.ts +7 -7
  339. package/src/loop.ts +4 -4
  340. package/src/mat/add-to-cp-graph.ts +8 -8
  341. package/src/mat/closest-boundary-point/closest-points-on-curve.ts +5 -6
  342. package/src/mat/closest-boundary-point/cull-bezier-pieces.ts +1 -1
  343. package/src/mat/closest-boundary-point/cull-by-loose-bounding-box.ts +5 -5
  344. package/src/mat/closest-boundary-point/cull-by-tight-boundary-box.ts +5 -5
  345. package/src/mat/closest-boundary-point/get-best-distance-squared.ts +5 -5
  346. package/src/mat/closest-boundary-point/get-close-boundary-points.ts +15 -15
  347. package/src/mat/closest-boundary-point/get-closest-boundary-point.ts +4 -4
  348. package/src/mat/cmp-cp-on-delta.ts +5 -5
  349. package/src/mat/create-new-cp-tree.ts +3 -3
  350. package/src/mat/find-mat/add-1-prong.ts +5 -5
  351. package/src/mat/find-mat/add-2-prong.ts +42 -42
  352. package/src/mat/find-mat/add-3-prong.ts +1 -1
  353. package/src/mat/find-mat/add-debug-info.ts +18 -20
  354. package/src/mat/find-mat/create-get-interesting-points-on-loop.ts +4 -4
  355. package/src/mat/find-mat/create-initial-cp-graph.ts +11 -11
  356. package/src/mat/find-mat/find-2-prong/add-debug-info.ts +4 -4
  357. package/src/mat/find-mat/find-2-prong/cull-bezier-pieces.ts +5 -5
  358. package/src/mat/find-mat/find-2-prong/find-2-prong.ts +27 -27
  359. package/src/mat/find-mat/find-2-prong/find-equidistant-point-on-line.ts +7 -7
  360. package/src/mat/find-mat/find-2-prong/get-initial-bezier-pieces.ts +4 -4
  361. package/src/mat/find-mat/find-3-prong/calc-better-x.ts +4 -4
  362. package/src/mat/find-mat/find-3-prong/calc-initial-3-prong-center.ts +3 -3
  363. package/src/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.ts +37 -37
  364. package/src/mat/find-mat/find-3-prong/find-3-prong.ts +16 -16
  365. package/src/mat/find-mat/find-3-prong/get-closest-points.ts +1 -1
  366. package/src/mat/find-mat/find-and-add-2-prongs-on-all-paths.ts +2 -2
  367. package/src/mat/find-mat/find-and-add-2-prongs.ts +14 -16
  368. package/src/mat/find-mat/find-and-add-3-prongs.ts +19 -19
  369. package/src/mat/find-mat/find-and-add-hole-closing-2-prongs.ts +6 -6
  370. package/src/mat/find-mat/get-potential-2-prongs.ts +4 -4
  371. package/src/mat/find-mat/get-sharp-corners.ts +4 -4
  372. package/src/mat/find-mat/get-total-abs-curvature.ts +1 -1
  373. package/src/mat/geometry/get-closest-squared-distance-to-rotated-rect.ts +3 -3
  374. package/src/mat/get-boundary-piece-beziers.ts +5 -5
  375. package/src/mat/get-contact-circles-at-interface.ts +1 -1
  376. package/src/mat/get-edges-as-array.ts +2 -2
  377. package/src/mat/get-leaves.ts +2 -2
  378. package/src/mat/get-neighboring-cps.ts +1 -1
  379. package/src/mat/is-another-cp-closeby.ts +9 -9
  380. package/src/mat/simplify-mat-map-only.ts +15 -15
  381. package/src/mat/to-scale-axis/add-debug-info.ts +6 -3
  382. package/src/mat/to-scale-axis/add-to-tree.ts +10 -10
  383. package/src/mat/to-scale-axis/calc-groups.ts +19 -19
  384. package/src/mat/to-scale-axis/create-spacial-tree.ts +4 -4
  385. package/src/mat/to-scale-axis/cull-non-cycles.ts +5 -5
  386. package/src/mat/to-scale-axis/cull.ts +5 -5
  387. package/src/mat/to-scale-axis/get-engulfed-vertices.ts +18 -18
  388. package/src/mat/trim-mat.ts +1 -1
  389. package/src/point-on-shape.ts +16 -16
  390. package/src/simplify-mat.ts +10 -10
  391. package/src/svg/get-curvature-at-interface.ts +6 -8
  392. package/src/svg/get-extreme.ts +1 -1
  393. package/src/svg/get-loop-bounds.ts +13 -13
  394. package/src/svg/get-shape-bounds.ts +4 -4
  395. package/src/sweep-line/are-boxes-intersecting.ts +4 -4
  396. package/src/sweep-line/sweep-line.ts +8 -8
  397. package/src/to-scale-axis.ts +18 -17
  398. package/src/traverse-edges.ts +2 -2
  399. package/src/traverse-vertices.ts +2 -2
  400. package/tsconfig.json +0 -1
  401. package/webpack.config.cjs +12 -63
  402. package/browser/index.min.js.LICENSE.txt +0 -2819
  403. package/browser/index.module.js +0 -7149
  404. package/browser/index.module.min.js +0 -2
  405. package/browser/index.module.min.js.LICENSE.txt +0 -2819
@@ -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,
@@ -1,5 +1,5 @@
1
- /** @hidden */
2
- declare var _debug_: Debug;
1
+ /** @internal */
2
+ declare const _debug_: Debug;
3
3
 
4
4
  import {
5
5
  fromTo, circumCenter, len, distanceBetween, toUnitVector, rotate90Degrees,
@@ -40,33 +40,33 @@ function find3ProngForDelta3s(
40
40
  const TOLERANCE = extreme * 1e-10;
41
41
  const MAX_ITERATIONS = 10;
42
42
 
43
- let δs_ = [
43
+ const δs_ = [
44
44
  δs[0],
45
45
  δs[idx],
46
46
  δs[δs.length-1]
47
47
  ];
48
48
 
49
- let bezierPieces_ = [
49
+ const bezierPieces_ = [
50
50
  bezierPiecess[0],
51
51
  bezierPiecess[idx],
52
52
  bezierPiecess[δs.length-1]
53
53
  ];
54
54
 
55
- let δ3ss = [
55
+ const δ3ss = [
56
56
  [δs_[0], δs_[1], δs_[2]],
57
57
  [δs_[1], δs_[2], δs_[0]],
58
58
  [δs_[2], δs_[0], δs_[1]],
59
59
  ];
60
60
 
61
- let bezierPiecess_ = [
61
+ const bezierPiecess_ = [
62
62
  [bezierPieces_[0], bezierPieces_[1], bezierPieces_[2]],
63
63
  [bezierPieces_[1], bezierPieces_[2], bezierPieces_[0]],
64
64
  [bezierPieces_[2], bezierPieces_[0], bezierPieces_[1]],
65
65
  ]
66
66
 
67
67
 
68
- let δ3s = δ3ss[k];
69
- let bezierPiece3s = bezierPiecess_[k];
68
+ const δ3s = δ3ss[k];
69
+ const bezierPiece3s = bezierPiecess_[k];
70
70
 
71
71
  if (δ3s[0][0].isSharp()) { return undefined; }
72
72
 
@@ -77,9 +77,9 @@ function find3ProngForDelta3s(
77
77
  let x = calcInitial3ProngCenter(δ3s, bezierPiece3s);
78
78
 
79
79
  if (typeof _debug_ !== 'undefined') {
80
- let threeProngs = _debug_.generated.elems.threeProng;
81
- let d = threeProngs[threeProngs.length-1];
82
- let trace = d.traces[d.traces.length-1];
80
+ const threeProngs = _debug_.generated.elems.threeProng;
81
+ const d = threeProngs[threeProngs.length-1];
82
+ const trace = d.traces[d.traces.length-1];
83
83
  trace.push(x);
84
84
  }
85
85
 
@@ -99,7 +99,7 @@ function find3ProngForDelta3s(
99
99
 
100
100
  circumCenter_ = circumCenter(ps.map(x => x.p));
101
101
 
102
- let vectorToZeroV = calcVectorToZeroV_StraightToIt(x, circumCenter_);
102
+ const vectorToZeroV = calcVectorToZeroV_StraightToIt(x, circumCenter_);
103
103
 
104
104
  if (!Number.isFinite(vectorToZeroV[0]) || !Number.isFinite(vectorToZeroV[1])) {
105
105
 
@@ -109,27 +109,27 @@ function find3ProngForDelta3s(
109
109
  // loop. This check, for instance, would be eliminated completely.
110
110
  return undefined;
111
111
  }
112
- let upds = calcBetterX(bezierPiece3s, x, vectorToZeroV);
112
+ const upds = calcBetterX(bezierPiece3s, x, vectorToZeroV);
113
113
  x = upds.newX;
114
114
  ps = upds.newPs;
115
115
 
116
116
  if (typeof _debug_ !== 'undefined') {
117
- let threeProngs = _debug_.generated.elems.threeProng;
118
- let d = threeProngs[threeProngs.length-1];
119
- let trace = d.traces[d.traces.length-1];
117
+ const threeProngs = _debug_.generated.elems.threeProng;
118
+ const d = threeProngs[threeProngs.length-1];
119
+ const trace = d.traces[d.traces.length-1];
120
120
  trace.push(x);
121
121
  }
122
122
 
123
- let V = len(vectorToZeroV); // The 'potential'
123
+ const V = len(vectorToZeroV); // The 'potential'
124
124
 
125
125
  tolerance = Math.abs(V - upds.newV);
126
126
  }
127
127
 
128
- let radius = (distanceBetween(x, ps[0].p) +
128
+ const radius = (distanceBetween(x, ps[0].p) +
129
129
  distanceBetween(x, ps[1].p) +
130
130
  distanceBetween(x, ps[2].p)) / 3;
131
131
 
132
- let circle = { center: x, radius };
132
+ const circle = { center: x, radius };
133
133
 
134
134
  //-------------------------------------------------------------------------
135
135
  // Calculate the unit tangent vector at 3-prong circle points - they should
@@ -138,12 +138,12 @@ function find3ProngForDelta3s(
138
138
  //-------------------------------------------------------------------------
139
139
  let totalAngleError = 0;
140
140
  for (let i=0; i<3; i++) {
141
- let p = ps[i];
141
+ const p = ps[i];
142
142
  //----------------------------
143
143
  // Tangent of circle at point
144
144
  //----------------------------
145
- let v = toUnitVector(fromTo(p.p, x));
146
- let v1 = rotate90Degrees(v);
145
+ const v = toUnitVector(fromTo(p.p, x));
146
+ const v1 = rotate90Degrees(v);
147
147
 
148
148
 
149
149
  //-----------------------------------
@@ -151,13 +151,13 @@ function find3ProngForDelta3s(
151
151
  //-----------------------------------
152
152
  //if (PointOnShape.isDullCorner(p)) {
153
153
  if (isPosDullCorner(p)) {
154
- //let corner = Curve.getCornerAtEnd(p.curve);
155
- let corner = getCornerAtEnd(p.curve);
156
- let tans = corner.tangents;
157
- let perps = tans.map( rotate90Degrees );
154
+ //const corner = Curve.getCornerAtEnd(p.curve);
155
+ const corner = getCornerAtEnd(p.curve);
156
+ const tans = corner.tangents;
157
+ const perps = tans.map( rotate90Degrees );
158
158
 
159
- let angleError1 = Math.asin( cross( perps[0], v ) );
160
- let angleError2 = Math.asin( cross( v, perps[1] ) );
159
+ const angleError1 = Math.asin( cross( perps[0], v ) );
160
+ const angleError2 = Math.asin( cross( v, perps[1] ) );
161
161
 
162
162
  let angleError = 0;
163
163
  if (angleError1 > 0) { angleError += angleError1; }
@@ -168,7 +168,7 @@ function find3ProngForDelta3s(
168
168
  //---------------------------
169
169
  // Tangent of curve at point
170
170
  //---------------------------
171
- let v2 = toUnitVector( tangent(p.curve.ps, p.t) );
171
+ const v2 = toUnitVector( tangent(p.curve.ps, p.t) );
172
172
 
173
173
  // Cross is more numerically stable than Vector.dot at angles a
174
174
  // multiple of Math.PI **and** is close to the actual angle value
@@ -176,7 +176,7 @@ function find3ProngForDelta3s(
176
176
  // tolerance.
177
177
 
178
178
  // Should be close to zero and is close to the actual angle.
179
- let cross_ = Math.abs( Math.asin( cross(v1, v2) ) );
179
+ const cross_ = Math.abs( Math.asin( cross(v1, v2) ) );
180
180
 
181
181
  totalAngleError += cross_;
182
182
  }
@@ -187,21 +187,21 @@ function find3ProngForDelta3s(
187
187
  // point to the 3-prong. It should be around 0. If not, this is not a good
188
188
  // candidate for the 3-prong.
189
189
  //-------------------------------------------------------------------------
190
- let closestDs = [];
190
+ const closestDs = [];
191
191
  for (let i=0; i<bezierPiecess.length; i++) {
192
- let p = getClosestBoundaryPoint(
192
+ const p = getClosestBoundaryPoint(
193
193
  bezierPiecess[i], x, undefined, undefined
194
194
  );
195
195
 
196
196
  closestDs.push( distanceBetween(p.pos.p, x) );
197
197
  }
198
- let closestD = Math.min(...closestDs);
199
- let radiusDelta = Math.abs(radius - closestD);
198
+ const closestD = Math.min(...closestDs);
199
+ const radiusDelta = Math.abs(radius - closestD);
200
200
 
201
201
  // Weights below still need to be optimized.
202
- let W1 = 1;
203
- let W2 = 1;
204
- let error = W1*radiusDelta + W2*totalAngleError;
202
+ const W1 = 1;
203
+ const W2 = 1;
204
+ const error = W1*radiusDelta + W2*totalAngleError;
205
205
 
206
206
  return { ps, circle, error, δ3s };
207
207
  }