flo-mat 2.0.1 → 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 -7125
  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 +28 -23
  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 -2819
  287. package/browser/index.module.js +0 -7149
  288. package/browser/index.module.min.js +0 -2
  289. package/browser/index.module.min.js.LICENSE.txt +0 -2819
@@ -6,8 +6,8 @@ import { getLoopBounds } from './get-loop-bounds.js';
6
6
  // TODO - move to another library
7
7
 
8
8
 
9
- /** @hidden */
10
- let getShapeBounds = memoize(function(loops: Loop[]) {
9
+ /** @internal */
10
+ const getShapeBounds = memoize(function(loops: Loop[]) {
11
11
  let minX_ = Number.POSITIVE_INFINITY;
12
12
  let maxX_ = Number.NEGATIVE_INFINITY;
13
13
  let minY_ = Number.POSITIVE_INFINITY;
@@ -18,8 +18,8 @@ let getShapeBounds = memoize(function(loops: Loop[]) {
18
18
  let minY;
19
19
  let maxY;
20
20
 
21
- for (let loop of loops) {
22
- let bounds = getLoopBounds(loop);
21
+ for (const loop of loops) {
22
+ const bounds = getLoopBounds(loop);
23
23
  if (bounds.minX.p[0] < minX_) {
24
24
  minX = bounds.minX;
25
25
  minX_ = bounds.minX.p[0];
@@ -15,10 +15,10 @@ function areBoxesIntersecting(closed: boolean) {
15
15
  let [[bx0, by0],[bx1, by1]] = b;
16
16
 
17
17
  // Swap so smaller coordinate comes first
18
- if (ay0 > ay1) { [ay0,ay1] = [ay1,ay0] };
19
- if (by0 > by1) { [by0,by1] = [by1,by0] };
20
- if (ax0 > ax1) { [ax0,ax1] = [ax1,ax0] };
21
- if (bx0 > bx1) { [bx0,bx1] = [bx1,bx0] };
18
+ if (ay0 > ay1) { [ay0,ay1] = [ay1,ay0] }
19
+ if (by0 > by1) { [by0,by1] = [by1,by0] }
20
+ if (ax0 > ax1) { [ax0,ax1] = [ax1,ax0] }
21
+ if (bx0 > bx1) { [bx0,bx1] = [bx1,bx0] }
22
22
 
23
23
  return closed
24
24
  ? (
@@ -32,8 +32,8 @@ function sweepLine<T>(
32
32
  predicate: (item1: T, item2: T) => boolean): [T,T][] {
33
33
 
34
34
  // Initialize event queue to contain all endpoints.
35
- let events: IEvent<T>[] = [];
36
- for (let item of items) {
35
+ const events: IEvent<T>[] = [];
36
+ for (const item of items) {
37
37
  events.push({
38
38
  type: EVENT_LEFT,
39
39
  item,
@@ -48,15 +48,15 @@ function sweepLine<T>(
48
48
 
49
49
  events.sort(compare);
50
50
 
51
- let activeItems = new Set<T>();
51
+ const activeItems = new Set<T>();
52
52
 
53
53
  /** A list of pairs of items that passed the predicate */
54
- let pairedItems: [T,T][] = [];
55
- for (let event of events) {
56
- let { item } = event;
54
+ const pairedItems: [T,T][] = [];
55
+ for (const event of events) {
56
+ const { item } = event;
57
57
 
58
58
  if (event.type === EVENT_LEFT) {
59
- for (let activeItem of activeItems.values()) {
59
+ for (const activeItem of activeItems.values()) {
60
60
  if (predicate(item, activeItem)) {
61
61
  pairedItems.push([item, activeItem]);
62
62
  }
@@ -93,7 +93,7 @@ interface IEvent<T> {
93
93
  * @param b Another event
94
94
  */
95
95
  function compare<T>(a: IEvent<T>, b: IEvent<T>) {
96
- let res = a.x - b.x;
96
+ const res = a.x - b.x;
97
97
 
98
98
  if (res !== 0) { return res; }
99
99
 
@@ -1,5 +1,5 @@
1
- /** @hidden */
2
- declare var _debug_: Debug;
1
+ /** @internal */
2
+ declare const _debug_: Debug;
3
3
 
4
4
  import { length } from 'flo-bezier3';
5
5
  import { Debug } from './debug/debug.js';
@@ -45,21 +45,22 @@ function toScaleAxis(
45
45
  s: number,
46
46
  f: (s: number) => (r: number) => number = linearScale): Mat {
47
47
 
48
+ let timingStart = 0;
48
49
  if (typeof _debug_ !== 'undefined') {
49
- var timingStart = performance.now();
50
- let leaves = getLeaves(mat.cpNode);
50
+ timingStart = performance.now();
51
+ const leaves = getLeaves(mat.cpNode);
51
52
  _debug_.generated.elems.leaves.push(leaves);
52
53
  }
53
54
 
54
55
  /** The largest vertex (as measured by its inscribed disk) */
55
- let cpNodes: CpNode[] = [];
56
+ const cpNodes: CpNode[] = [];
56
57
  traverseVertices(
57
58
  clone(mat.cpNode),
58
59
  cpNode => { cpNodes.push(cpNode); }
59
60
  );
60
61
 
61
- let cpNode = getLargestVertex(cpNodes);
62
- let f_ = f(s);
62
+ const cpNode = getLargestVertex(cpNodes);
63
+ const f_ = f(s);
63
64
 
64
65
  if (typeof _debug_ !== 'undefined') {
65
66
  _debug_.generated.elems.maxVertex.push(cpNode);
@@ -69,22 +70,22 @@ function toScaleAxis(
69
70
  * All vertices that are set to be culled initially. This may change later
70
71
  * in order to preserve topology.
71
72
  */
72
- let culls: Set<Circle> = new Set();
73
+ const culls: Set<Circle> = new Set();
73
74
 
74
- let rMap: Map<CpNode,number> = new Map();
75
+ const rMap: Map<CpNode,number> = new Map();
75
76
 
76
77
  traverseEdges(cpNode, function(cpNode) {
77
78
  /** The occulating radius stored with this vertex. */
78
- let R = rMap.get(cpNode) || f_(cpNode.cp.circle.radius);
79
+ const R = rMap.get(cpNode) || f_(cpNode.cp.circle.radius);
79
80
 
80
- let cpNode_ = cpNode.next;
81
+ const cpNode_ = cpNode.next;
81
82
 
82
- let l = length([0,1], getCurveToNext(cpNode));
83
+ const l = length([0,1], getCurveToNext(cpNode));
83
84
 
84
- let r = cpNode_.cp.circle.radius;
85
- let r_ = f_(r);
85
+ const r = cpNode_.cp.circle.radius;
86
+ const r_ = f_(r);
86
87
  if (R - l > r_) {
87
- for (let cpNode of cpNode_.getCpNodesOnCircle()) {
88
+ for (const cpNode of cpNode_.getCpNodesOnCircle()) {
88
89
  rMap.set(cpNode, R - l); // Update osculating radii
89
90
  }
90
91
  culls.add(cpNode_.cp.circle);
@@ -98,8 +99,8 @@ function toScaleAxis(
98
99
  }
99
100
 
100
101
  // TODO - put line below back - goes into infinite loop
101
- //let sat: Mat = { cpNode, cpTrees: createNewCpTree(cpNode) };
102
- let sat: Mat = { cpNode, cpTrees: undefined };
102
+ //const sat: Mat = { cpNode, cpTrees: createNewCpTree(cpNode) };
103
+ const sat: Mat = { cpNode, cpTrees: undefined };
103
104
 
104
105
  addDebugInfo(sat, timingStart);
105
106
 
@@ -14,10 +14,10 @@ function traverseEdges(
14
14
 
15
15
  // Since the tree is unrooted we must iterate in all directions from the
16
16
  // given vertex.
17
- let cps = cpNode.getCpNodesOnCircle();
17
+ const cps = cpNode.getCpNodesOnCircle();
18
18
 
19
19
  while (cps.length) {
20
- let cp = cps.pop();
20
+ const cp = cps.pop();
21
21
  f(cp);
22
22
 
23
23
  if (cp.isTerminating()) { continue; }
@@ -24,9 +24,9 @@ function traverseVertices(
24
24
  .forEach(f_);
25
25
 
26
26
  function f_(cpNode: CpNode) {
27
- let cps = [cpNode];
27
+ const cps = [cpNode];
28
28
  while (cps.length) {
29
- let cp = cps.pop();
29
+ const cp = cps.pop();
30
30
  f(cp);
31
31
  cps.push(...cp.vertexChildren);
32
32
  }
@@ -3,11 +3,6 @@ const CircularDependencyPlugin = require('circular-dependency-plugin');
3
3
  const ResolveTypeScriptPlugin = require("resolve-typescript-plugin");
4
4
 
5
5
 
6
- ////////////////////////////////
7
- const library = 'FloMat';
8
- ////////////////////////////////
9
-
10
-
11
6
  const extensions = [
12
7
  '.js', '.mjs', '.cjs',
13
8
  '.jsx', '.cjsx', '.mjsx'
@@ -15,8 +10,8 @@ const extensions = [
15
10
 
16
11
 
17
12
  const config_Basic = {
18
- // mode: 'production',
19
- mode: 'development',
13
+ mode: 'production',
14
+ // mode: 'development',
20
15
  entry: './src/index.ts',
21
16
  resolve: {
22
17
  extensions,
@@ -49,40 +44,12 @@ const config_Basic = {
49
44
  // set the current working directory for displaying module paths
50
45
  cwd: process.cwd(),
51
46
  })
52
- ]
53
- }
54
-
55
-
56
- const lib = {
57
- path: path.resolve(__dirname, 'browser'),
58
- library,
59
- libraryTarget: 'var'
60
- };
61
-
62
-
63
- /** Global var library, minified */
64
- const config_VarMinify = {
65
- ...config_Basic,
66
- output: {
67
- filename: 'index.min.js',
68
- ...lib
69
- },
70
- optimization: {
71
- minimize: true
72
- }
73
- };
74
-
75
-
76
- /** Global var library, not minified */
77
- const config_VarNoMinify = {
78
- ...config_Basic,
47
+ ],
79
48
  output: {
80
- filename: 'index.js',
81
- ...lib
49
+ path: path.resolve(__dirname, 'browser'),
50
+ library: { type: 'module' }
82
51
  },
83
- optimization: {
84
- minimize: false
85
- }
52
+ experiments: { outputModule: true }
86
53
  }
87
54
 
88
55
 
@@ -90,18 +57,10 @@ const config_VarNoMinify = {
90
57
  const config_EsmMinify = {
91
58
  ...config_Basic,
92
59
  output: {
93
- filename: 'index.module.min.js',
94
- path: path.resolve(__dirname, 'browser'),
95
- library: {
96
- type: 'module'
97
- }
98
- },
99
- optimization: {
100
- minimize: true
60
+ ...config_Basic.output,
61
+ filename: 'index.min.js',
101
62
  },
102
- experiments: {
103
- outputModule: true
104
- }
63
+ optimization: { minimize: true }
105
64
  };
106
65
 
107
66
 
@@ -109,24 +68,14 @@ const config_EsmMinify = {
109
68
  const config_EsmNoMinify = {
110
69
  ...config_Basic,
111
70
  output: {
112
- filename: 'index.module.js',
113
- path: path.resolve(__dirname, 'browser'),
114
- library: {
115
- type: 'module'
116
- }
117
- },
118
- optimization: {
119
- minimize: false
71
+ ...config_Basic.output,
72
+ filename: 'index.js',
120
73
  },
121
- experiments: {
122
- outputModule: true
123
- }
74
+ optimization: { minimize: false },
124
75
  };
125
76
 
126
77
 
127
78
  module.exports = [
128
- config_VarMinify,
129
- config_VarNoMinify,
130
79
  config_EsmMinify,
131
80
  config_EsmNoMinify
132
81
  ];