flo-mat 1.2.0 → 2.0.0

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 (469) hide show
  1. package/.mocharc.cjs +17 -0
  2. package/README.md +12 -1
  3. package/browser/index.js +7348 -0
  4. package/browser/index.min.js +2 -1
  5. package/browser/index.min.js.LICENSE.txt +2907 -0
  6. package/browser/index.module.js +7369 -0
  7. package/browser/index.module.min.js +2 -0
  8. package/browser/index.module.min.js.LICENSE.txt +2907 -0
  9. package/node/circle.js +3 -7
  10. package/node/circle.js.map +1 -1
  11. package/node/compare-curvatures-at-interface.d.ts +19 -0
  12. package/node/compare-curvatures-at-interface.js +125 -0
  13. package/node/compare-curvatures-at-interface.js.map +1 -0
  14. package/node/contact-point.d.ts +2 -2
  15. package/node/contact-point.js +3 -6
  16. package/node/contact-point.js.map +1 -1
  17. package/node/cp-node/clone.d.ts +1 -1
  18. package/node/cp-node/clone.js +4 -7
  19. package/node/cp-node/clone.js.map +1 -1
  20. package/node/cp-node/remove.d.ts +2 -2
  21. package/node/cp-node/remove.js +1 -4
  22. package/node/cp-node/remove.js.map +1 -1
  23. package/node/cp-node.d.ts +4 -5
  24. package/node/cp-node.js +8 -12
  25. package/node/cp-node.js.map +1 -1
  26. package/node/curve.d.ts +2 -2
  27. package/node/curve.js +10 -14
  28. package/node/curve.js.map +1 -1
  29. package/node/debug/cp-node-for-debugging.d.ts +2 -2
  30. package/node/debug/cp-node-for-debugging.js +1 -2
  31. package/node/debug/debug-elem-types.d.ts +8 -8
  32. package/node/debug/debug-elem-types.js +1 -2
  33. package/node/debug/debug.d.ts +5 -7
  34. package/node/debug/debug.js +67 -10
  35. package/node/debug/debug.js.map +1 -1
  36. package/node/debug/functions/draw-elem/bounding-hull.js +3 -6
  37. package/node/debug/functions/draw-elem/bounding-hull.js.map +1 -1
  38. package/node/debug/functions/draw-elem/branch.d.ts +1 -1
  39. package/node/debug/functions/draw-elem/branch.js +5 -8
  40. package/node/debug/functions/draw-elem/branch.js.map +1 -1
  41. package/node/debug/functions/draw-elem/culls.d.ts +1 -1
  42. package/node/debug/functions/draw-elem/culls.js +1 -4
  43. package/node/debug/functions/draw-elem/culls.js.map +1 -1
  44. package/node/debug/functions/draw-elem/draw-circle-percent.js +1 -4
  45. package/node/debug/functions/draw-elem/draw-circle-percent.js.map +1 -1
  46. package/node/debug/functions/draw-elem/draw-elem.d.ts +1 -1
  47. package/node/debug/functions/draw-elem/draw-elem.js +34 -37
  48. package/node/debug/functions/draw-elem/draw-elem.js.map +1 -1
  49. package/node/debug/functions/draw-elem/dull-corner.d.ts +1 -1
  50. package/node/debug/functions/draw-elem/dull-corner.js +5 -7
  51. package/node/debug/functions/draw-elem/dull-corner.js.map +1 -1
  52. package/node/debug/functions/draw-elem/leaves.d.ts +1 -1
  53. package/node/debug/functions/draw-elem/leaves.js +3 -6
  54. package/node/debug/functions/draw-elem/leaves.js.map +1 -1
  55. package/node/debug/functions/draw-elem/loop.d.ts +1 -1
  56. package/node/debug/functions/draw-elem/loop.js +1 -4
  57. package/node/debug/functions/draw-elem/loop.js.map +1 -1
  58. package/node/debug/functions/draw-elem/loops.d.ts +1 -1
  59. package/node/debug/functions/draw-elem/loops.js +1 -4
  60. package/node/debug/functions/draw-elem/loops.js.map +1 -1
  61. package/node/debug/functions/draw-elem/loose-bounding-box.js +3 -6
  62. package/node/debug/functions/draw-elem/loose-bounding-box.js.map +1 -1
  63. package/node/debug/functions/draw-elem/mat.d.ts +1 -1
  64. package/node/debug/functions/draw-elem/mat.js +7 -10
  65. package/node/debug/functions/draw-elem/mat.js.map +1 -1
  66. package/node/debug/functions/draw-elem/max-vertex.d.ts +1 -1
  67. package/node/debug/functions/draw-elem/max-vertex.js +3 -6
  68. package/node/debug/functions/draw-elem/max-vertex.js.map +1 -1
  69. package/node/debug/functions/draw-elem/min-y.d.ts +1 -1
  70. package/node/debug/functions/draw-elem/min-y.js +9 -12
  71. package/node/debug/functions/draw-elem/min-y.js.map +1 -1
  72. package/node/debug/functions/draw-elem/one-prong-at-dull-corner.d.ts +1 -1
  73. package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js +7 -10
  74. package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js.map +1 -1
  75. package/node/debug/functions/draw-elem/one-prong.d.ts +1 -1
  76. package/node/debug/functions/draw-elem/one-prong.js +9 -12
  77. package/node/debug/functions/draw-elem/one-prong.js.map +1 -1
  78. package/node/debug/functions/draw-elem/sharp-corner.d.ts +1 -1
  79. package/node/debug/functions/draw-elem/sharp-corner.js +3 -6
  80. package/node/debug/functions/draw-elem/sharp-corner.js.map +1 -1
  81. package/node/debug/functions/draw-elem/three-prong.d.ts +1 -1
  82. package/node/debug/functions/draw-elem/three-prong.js +9 -12
  83. package/node/debug/functions/draw-elem/three-prong.js.map +1 -1
  84. package/node/debug/functions/draw-elem/tight-bounding-box.js +3 -6
  85. package/node/debug/functions/draw-elem/tight-bounding-box.js.map +1 -1
  86. package/node/debug/functions/draw-elem/two-prong.d.ts +1 -1
  87. package/node/debug/functions/draw-elem/two-prong.js +9 -12
  88. package/node/debug/functions/draw-elem/two-prong.js.map +1 -1
  89. package/node/debug/functions/draw-elem/vertex.d.ts +1 -1
  90. package/node/debug/functions/draw-elem/vertex.js +7 -10
  91. package/node/debug/functions/draw-elem/vertex.js.map +1 -1
  92. package/node/debug/functions/general.d.ts +1 -1
  93. package/node/debug/functions/general.js +3 -6
  94. package/node/debug/functions/general.js.map +1 -1
  95. package/node/debug/functions/three-prong.js +24 -27
  96. package/node/debug/functions/three-prong.js.map +1 -1
  97. package/node/debug/functions/two-prong.d.ts +1 -1
  98. package/node/debug/functions/two-prong.js +10 -13
  99. package/node/debug/functions/two-prong.js.map +1 -1
  100. package/node/debug/three-prong-for-debugging.d.ts +4 -4
  101. package/node/debug/three-prong-for-debugging.js +4 -7
  102. package/node/debug/three-prong-for-debugging.js.map +1 -1
  103. package/node/debug/two-prong-for-debugging.d.ts +5 -5
  104. package/node/debug/two-prong-for-debugging.js +1 -2
  105. package/node/find-mats.d.ts +12 -9
  106. package/node/find-mats.js +47 -53
  107. package/node/find-mats.js.map +1 -1
  108. package/node/get-boundary-bezier-parts-to-next.d.ts +3 -3
  109. package/node/get-boundary-bezier-parts-to-next.js +1 -4
  110. package/node/get-boundary-bezier-parts-to-next.js.map +1 -1
  111. package/node/get-boundary-beziers-to-next.d.ts +1 -1
  112. package/node/get-boundary-beziers-to-next.js +8 -8
  113. package/node/get-boundary-beziers-to-next.js.map +1 -1
  114. package/node/get-bounding-box-.d.ts +2 -0
  115. package/node/get-bounding-box-.js +5 -0
  116. package/node/get-bounding-box-.js.map +1 -0
  117. package/node/get-branches.d.ts +1 -1
  118. package/node/get-branches.js +7 -10
  119. package/node/get-branches.js.map +1 -1
  120. package/node/get-curve/get-curve-between.d.ts +1 -1
  121. package/node/get-curve/get-curve-between.js +21 -24
  122. package/node/get-curve/get-curve-between.js.map +1 -1
  123. package/node/get-curve/get-edge-direction.d.ts +1 -1
  124. package/node/get-curve/get-edge-direction.js +12 -15
  125. package/node/get-curve/get-edge-direction.js.map +1 -1
  126. package/node/get-curve-to-next.d.ts +1 -1
  127. package/node/get-curve-to-next.js +3 -6
  128. package/node/get-curve-to-next.js.map +1 -1
  129. package/node/get-interface-ccw.d.ts +24 -0
  130. package/node/get-interface-ccw.js +98 -0
  131. package/node/get-interface-ccw.js.map +1 -0
  132. package/node/index.d.ts +35 -36
  133. package/node/index.js +32 -56
  134. package/node/index.js.map +1 -1
  135. package/node/loop/get-max-coordinate.js +1 -4
  136. package/node/loop/get-max-coordinate.js.map +1 -1
  137. package/node/loop.d.ts +1 -1
  138. package/node/loop.js +1 -4
  139. package/node/loop.js.map +1 -1
  140. package/node/mat/add-to-cp-graph.d.ts +5 -5
  141. package/node/mat/add-to-cp-graph.js +5 -8
  142. package/node/mat/add-to-cp-graph.js.map +1 -1
  143. package/node/mat/bezier-piece.d.ts +1 -1
  144. package/node/mat/bezier-piece.js +1 -2
  145. package/node/mat/closest-boundary-point/closest-points-on-curve.d.ts +1 -1
  146. package/node/mat/closest-boundary-point/closest-points-on-curve.js +15 -14
  147. package/node/mat/closest-boundary-point/closest-points-on-curve.js.map +1 -1
  148. package/node/mat/closest-boundary-point/cull-bezier-pieces.d.ts +1 -1
  149. package/node/mat/closest-boundary-point/cull-bezier-pieces.js +7 -10
  150. package/node/mat/closest-boundary-point/cull-bezier-pieces.js.map +1 -1
  151. package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.d.ts +1 -1
  152. package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.js +5 -8
  153. package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.js.map +1 -1
  154. package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.d.ts +1 -1
  155. package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.js +7 -8
  156. package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.js.map +1 -1
  157. package/node/mat/closest-boundary-point/get-best-distance-squared.d.ts +1 -1
  158. package/node/mat/closest-boundary-point/get-best-distance-squared.js +6 -9
  159. package/node/mat/closest-boundary-point/get-best-distance-squared.js.map +1 -1
  160. package/node/mat/closest-boundary-point/get-close-boundary-points.d.ts +2 -2
  161. package/node/mat/closest-boundary-point/get-close-boundary-points.js +9 -12
  162. package/node/mat/closest-boundary-point/get-close-boundary-points.js.map +1 -1
  163. package/node/mat/closest-boundary-point/get-closest-boundary-point.d.ts +3 -3
  164. package/node/mat/closest-boundary-point/get-closest-boundary-point.js +10 -13
  165. package/node/mat/closest-boundary-point/get-closest-boundary-point.js.map +1 -1
  166. package/node/mat/corner.js +1 -2
  167. package/node/mat/create-new-cp-tree.d.ts +3 -3
  168. package/node/mat/create-new-cp-tree.js +5 -7
  169. package/node/mat/create-new-cp-tree.js.map +1 -1
  170. package/node/mat/elem-type-two-prong.js +1 -2
  171. package/node/mat/find-mat/add-1-prong.d.ts +4 -4
  172. package/node/mat/find-mat/add-1-prong.js +9 -12
  173. package/node/mat/find-mat/add-1-prong.js.map +1 -1
  174. package/node/mat/find-mat/add-2-prong.d.ts +5 -5
  175. package/node/mat/find-mat/add-2-prong.js +19 -22
  176. package/node/mat/find-mat/add-2-prong.js.map +1 -1
  177. package/node/mat/find-mat/add-3-prong.d.ts +5 -5
  178. package/node/mat/find-mat/add-3-prong.js +7 -10
  179. package/node/mat/find-mat/add-3-prong.js.map +1 -1
  180. package/node/mat/find-mat/add-debug-info.d.ts +2 -2
  181. package/node/mat/find-mat/add-debug-info.js +8 -13
  182. package/node/mat/find-mat/add-debug-info.js.map +1 -1
  183. package/node/mat/find-mat/create-get-interesting-points-on-loop.d.ts +3 -3
  184. package/node/mat/find-mat/create-get-interesting-points-on-loop.js +29 -16
  185. package/node/mat/find-mat/create-get-interesting-points-on-loop.js.map +1 -1
  186. package/node/mat/find-mat/create-initial-cp-graph.d.ts +4 -4
  187. package/node/mat/find-mat/create-initial-cp-graph.js +7 -9
  188. package/node/mat/find-mat/create-initial-cp-graph.js.map +1 -1
  189. package/node/mat/find-mat/find-2-prong/add-debug-info.d.ts +5 -5
  190. package/node/mat/find-mat/find-2-prong/add-debug-info.js +3 -6
  191. package/node/mat/find-mat/find-2-prong/add-debug-info.js.map +1 -1
  192. package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.d.ts +1 -1
  193. package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js +5 -8
  194. package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js.map +1 -1
  195. package/node/mat/find-mat/find-2-prong/find-2-prong.d.ts +5 -5
  196. package/node/mat/find-mat/find-2-prong/find-2-prong.js +37 -39
  197. package/node/mat/find-mat/find-2-prong/find-2-prong.js.map +1 -1
  198. package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js +1 -4
  199. package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js.map +1 -1
  200. package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.d.ts +5 -5
  201. package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js +7 -10
  202. package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js.map +1 -1
  203. package/node/mat/find-mat/find-2-prong/x-for-debugging.d.ts +1 -1
  204. package/node/mat/find-mat/find-2-prong/x-for-debugging.js +1 -2
  205. package/node/mat/find-mat/find-3-prong/calc-better-x.d.ts +2 -2
  206. package/node/mat/find-mat/find-3-prong/calc-better-x.js +10 -13
  207. package/node/mat/find-mat/find-3-prong/calc-better-x.js.map +1 -1
  208. package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.d.ts +2 -2
  209. package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.js +6 -8
  210. package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.js.map +1 -1
  211. package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.d.ts +3 -3
  212. package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.js +29 -32
  213. package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.js.map +1 -1
  214. package/node/mat/find-mat/find-3-prong/find-3-prong.d.ts +3 -3
  215. package/node/mat/find-mat/find-3-prong/find-3-prong.js +14 -12
  216. package/node/mat/find-mat/find-3-prong/find-3-prong.js.map +1 -1
  217. package/node/mat/find-mat/find-3-prong/get-closest-points.d.ts +2 -2
  218. package/node/mat/find-mat/find-3-prong/get-closest-points.js +3 -6
  219. package/node/mat/find-mat/find-3-prong/get-closest-points.js.map +1 -1
  220. package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.d.ts +4 -4
  221. package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.js +3 -6
  222. package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.js.map +1 -1
  223. package/node/mat/find-mat/find-and-add-2-prongs.d.ts +4 -4
  224. package/node/mat/find-mat/find-and-add-2-prongs.js +9 -12
  225. package/node/mat/find-mat/find-and-add-2-prongs.js.map +1 -1
  226. package/node/mat/find-mat/find-and-add-3-prongs.d.ts +3 -3
  227. package/node/mat/find-mat/find-and-add-3-prongs.js +8 -11
  228. package/node/mat/find-mat/find-and-add-3-prongs.js.map +1 -1
  229. package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.d.ts +3 -3
  230. package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.js +11 -14
  231. package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.js.map +1 -1
  232. package/node/mat/find-mat/get-potential-2-prongs.d.ts +1 -1
  233. package/node/mat/find-mat/get-potential-2-prongs.js +3 -6
  234. package/node/mat/find-mat/get-potential-2-prongs.js.map +1 -1
  235. package/node/mat/find-mat/get-sharp-corners.d.ts +1 -1
  236. package/node/mat/find-mat/get-sharp-corners.js +3 -6
  237. package/node/mat/find-mat/get-sharp-corners.js.map +1 -1
  238. package/node/mat/geometry/get-closest-square-distance-to-rect.js +21 -15
  239. package/node/mat/geometry/get-closest-square-distance-to-rect.js.map +1 -1
  240. package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.js +5 -8
  241. package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.js.map +1 -1
  242. package/node/mat/get-boundary-piece-beziers.d.ts +2 -2
  243. package/node/mat/get-boundary-piece-beziers.js +6 -9
  244. package/node/mat/get-boundary-piece-beziers.js.map +1 -1
  245. package/node/mat/get-contact-circles-at-interface.d.ts +2 -2
  246. package/node/mat/get-contact-circles-at-interface.js +7 -10
  247. package/node/mat/get-contact-circles-at-interface.js.map +1 -1
  248. package/node/mat/get-largest-vertex.d.ts +1 -1
  249. package/node/mat/get-largest-vertex.js +1 -4
  250. package/node/mat/get-largest-vertex.js.map +1 -1
  251. package/node/mat/get-leaves.d.ts +1 -1
  252. package/node/mat/get-leaves.js +1 -4
  253. package/node/mat/get-leaves.js.map +1 -1
  254. package/node/mat/get-neighboring-cps.d.ts +3 -3
  255. package/node/mat/get-neighboring-cps.js +5 -8
  256. package/node/mat/get-neighboring-cps.js.map +1 -1
  257. package/node/mat/get-two-prong-type.d.ts +2 -2
  258. package/node/mat/get-two-prong-type.js +1 -4
  259. package/node/mat/get-two-prong-type.js.map +1 -1
  260. package/node/mat/is-another-cp-closeby.d.ts +5 -5
  261. package/node/mat/is-another-cp-closeby.js +8 -11
  262. package/node/mat/is-another-cp-closeby.js.map +1 -1
  263. package/node/mat/simplify-mat-map-only.d.ts +1 -1
  264. package/node/mat/simplify-mat-map-only.js +10 -14
  265. package/node/mat/simplify-mat-map-only.js.map +1 -1
  266. package/node/mat/to-scale-axis/add-debug-info.d.ts +1 -1
  267. package/node/mat/to-scale-axis/add-debug-info.js +1 -4
  268. package/node/mat/to-scale-axis/add-debug-info.js.map +1 -1
  269. package/node/mat/to-scale-axis/cull-non-cycles.d.ts +1 -1
  270. package/node/mat/to-scale-axis/cull-non-cycles.js +5 -8
  271. package/node/mat/to-scale-axis/cull-non-cycles.js.map +1 -1
  272. package/node/mat/to-scale-axis/cull.d.ts +2 -2
  273. package/node/mat/to-scale-axis/cull.js +75 -8
  274. package/node/mat/to-scale-axis/cull.js.map +1 -1
  275. package/node/mat/trim-mat.d.ts +1 -1
  276. package/node/mat/trim-mat.js +6 -9
  277. package/node/mat/trim-mat.js.map +1 -1
  278. package/node/mat.d.ts +3 -3
  279. package/node/mat.js +1 -2
  280. package/node/point-on-shape.d.ts +2 -2
  281. package/node/point-on-shape.js +23 -34
  282. package/node/point-on-shape.js.map +1 -1
  283. package/node/simplify-mat.d.ts +4 -3
  284. package/node/simplify-mat.js +14 -16
  285. package/node/simplify-mat.js.map +1 -1
  286. package/node/svg/get-loop-bounds.d.ts +2 -2
  287. package/node/svg/get-loop-bounds.js +11 -13
  288. package/node/svg/get-loop-bounds.js.map +1 -1
  289. package/node/svg/get-min-y-pos.d.ts +3 -2
  290. package/node/svg/get-min-y-pos.js +3 -6
  291. package/node/svg/get-min-y-pos.js.map +1 -1
  292. package/node/svg/get-shape-bounds.d.ts +5 -5
  293. package/node/svg/get-shape-bounds.js +5 -8
  294. package/node/svg/get-shape-bounds.js.map +1 -1
  295. package/node/sweep-line/sweep-line.js +1 -4
  296. package/node/sweep-line/sweep-line.js.map +1 -1
  297. package/node/to-scale-axis.d.ts +2 -1
  298. package/node/to-scale-axis.js +18 -21
  299. package/node/to-scale-axis.js.map +1 -1
  300. package/node/traverse-edges.d.ts +1 -1
  301. package/node/traverse-edges.js +1 -4
  302. package/node/traverse-edges.js.map +1 -1
  303. package/node/traverse-vertices.d.ts +1 -1
  304. package/node/traverse-vertices.js +1 -4
  305. package/node/traverse-vertices.js.map +1 -1
  306. package/package.json +34 -31
  307. package/src/circle.ts +0 -6
  308. package/src/compare-curvatures-at-interface.ts +197 -0
  309. package/src/contact-point.ts +2 -3
  310. package/src/cp-node/clone.ts +1 -2
  311. package/src/cp-node/remove.ts +2 -3
  312. package/src/cp-node.ts +6 -8
  313. package/src/curve.ts +3 -4
  314. package/src/debug/cp-node-for-debugging.ts +2 -3
  315. package/src/debug/debug-elem-types.ts +8 -10
  316. package/src/debug/debug.ts +22 -17
  317. package/src/debug/functions/draw-elem/bounding-hull.ts +0 -1
  318. package/src/debug/functions/draw-elem/branch.ts +2 -3
  319. package/src/debug/functions/draw-elem/culls.ts +1 -2
  320. package/src/debug/functions/draw-elem/draw-elem.ts +18 -19
  321. package/src/debug/functions/draw-elem/dull-corner.ts +3 -3
  322. package/src/debug/functions/draw-elem/leaves.ts +2 -4
  323. package/src/debug/functions/draw-elem/loop.ts +1 -2
  324. package/src/debug/functions/draw-elem/loops.ts +1 -2
  325. package/src/debug/functions/draw-elem/loose-bounding-box.ts +0 -1
  326. package/src/debug/functions/draw-elem/mat.ts +3 -5
  327. package/src/debug/functions/draw-elem/max-vertex.ts +1 -2
  328. package/src/debug/functions/draw-elem/min-y.ts +5 -7
  329. package/src/debug/functions/draw-elem/one-prong-at-dull-corner.ts +1 -2
  330. package/src/debug/functions/draw-elem/one-prong.ts +2 -3
  331. package/src/debug/functions/draw-elem/sharp-corner.ts +1 -2
  332. package/src/debug/functions/draw-elem/three-prong.ts +2 -4
  333. package/src/debug/functions/draw-elem/tight-bounding-box.ts +0 -1
  334. package/src/debug/functions/draw-elem/two-prong.ts +2 -3
  335. package/src/debug/functions/draw-elem/vertex.ts +1 -2
  336. package/src/debug/functions/general.ts +2 -3
  337. package/src/debug/functions/three-prong.ts +3 -4
  338. package/src/debug/functions/two-prong.ts +6 -14
  339. package/src/debug/three-prong-for-debugging.ts +4 -5
  340. package/src/debug/two-prong-for-debugging.ts +5 -6
  341. package/src/find-mats.ts +34 -39
  342. package/src/get-boundary-bezier-parts-to-next.ts +5 -6
  343. package/src/get-boundary-beziers-to-next.ts +8 -7
  344. package/src/get-bounding-box-.ts +7 -0
  345. package/src/get-branches.ts +2 -3
  346. package/src/get-curve/get-curve-between.ts +2 -3
  347. package/src/get-curve/get-edge-direction.ts +2 -5
  348. package/src/get-curve-to-next.ts +2 -3
  349. package/src/get-interface-ccw.ts +112 -0
  350. package/src/index.ts +34 -48
  351. package/src/loop/get-max-coordinate.ts +0 -1
  352. package/src/loop.ts +1 -2
  353. package/src/mat/add-to-cp-graph.ts +7 -8
  354. package/src/mat/bezier-piece.ts +1 -2
  355. package/src/mat/closest-boundary-point/closest-points-on-curve.ts +19 -17
  356. package/src/mat/closest-boundary-point/cull-bezier-pieces.ts +4 -5
  357. package/src/mat/closest-boundary-point/cull-by-loose-bounding-box.ts +4 -5
  358. package/src/mat/closest-boundary-point/cull-by-tight-boundary-box.ts +7 -5
  359. package/src/mat/closest-boundary-point/get-best-distance-squared.ts +1 -2
  360. package/src/mat/closest-boundary-point/get-close-boundary-points.ts +4 -11
  361. package/src/mat/closest-boundary-point/get-closest-boundary-point.ts +5 -6
  362. package/src/mat/cmp-cp-on-delta.ts +2 -3
  363. package/src/mat/create-new-cp-tree.ts +5 -5
  364. package/src/mat/find-mat/add-1-prong.ts +7 -8
  365. package/src/mat/find-mat/add-2-prong.ts +11 -12
  366. package/src/mat/find-mat/add-3-prong.ts +7 -8
  367. package/src/mat/find-mat/add-debug-info.ts +8 -7
  368. package/src/mat/find-mat/create-get-interesting-points-on-loop.ts +22 -8
  369. package/src/mat/find-mat/create-initial-cp-graph.ts +7 -8
  370. package/src/mat/find-mat/find-2-prong/add-debug-info.ts +9 -10
  371. package/src/mat/find-mat/find-2-prong/cull-bezier-pieces.ts +4 -7
  372. package/src/mat/find-mat/find-2-prong/find-2-prong.ts +19 -17
  373. package/src/mat/find-mat/find-2-prong/get-initial-bezier-pieces.ts +7 -8
  374. package/src/mat/find-mat/find-2-prong/x-for-debugging.ts +1 -2
  375. package/src/mat/find-mat/find-3-prong/calc-better-x.ts +3 -6
  376. package/src/mat/find-mat/find-3-prong/calc-initial-3-prong-center.ts +3 -8
  377. package/src/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.ts +10 -14
  378. package/src/mat/find-mat/find-3-prong/find-3-prong.ts +13 -8
  379. package/src/mat/find-mat/find-3-prong/get-closest-points.ts +2 -5
  380. package/src/mat/find-mat/find-and-add-2-prongs-on-all-paths.ts +5 -6
  381. package/src/mat/find-mat/find-and-add-2-prongs.ts +9 -10
  382. package/src/mat/find-mat/find-and-add-3-prongs.ts +8 -9
  383. package/src/mat/find-mat/find-and-add-hole-closing-2-prongs.ts +7 -8
  384. package/src/mat/find-mat/get-potential-2-prongs.ts +1 -2
  385. package/src/mat/find-mat/get-sharp-corners.ts +1 -2
  386. package/src/mat/find-mat/get-total-abs-curvature.ts +2 -3
  387. package/src/mat/find-mat/get-total-by.ts +2 -3
  388. package/src/mat/geometry/get-closest-square-distance-to-rect.ts +15 -4
  389. package/src/mat/geometry/get-closest-squared-distance-to-rotated-rect.ts +0 -1
  390. package/src/mat/get-boundary-piece-beziers.ts +5 -6
  391. package/src/mat/get-contact-circles-at-interface.ts +3 -4
  392. package/src/mat/get-edges-as-array.ts +2 -3
  393. package/src/mat/get-largest-three-prong.ts +1 -2
  394. package/src/mat/get-largest-vertex.ts +1 -2
  395. package/src/mat/get-leaves.ts +1 -2
  396. package/src/mat/get-neighboring-cps.ts +5 -6
  397. package/src/mat/get-two-prong-type.ts +2 -3
  398. package/src/mat/is-another-cp-closeby.ts +6 -7
  399. package/src/mat/simplify-mat-map-only.ts +5 -7
  400. package/src/mat/to-scale-axis/add-debug-info.ts +2 -3
  401. package/src/mat/to-scale-axis/add-to-tree.ts +3 -4
  402. package/src/mat/to-scale-axis/calc-groups.ts +1 -2
  403. package/src/mat/to-scale-axis/create-spacial-tree.ts +3 -4
  404. package/src/mat/to-scale-axis/cull-non-cycles.ts +2 -3
  405. package/src/mat/to-scale-axis/cull.ts +3 -4
  406. package/src/mat/to-scale-axis/get-engulfed-vertices.ts +3 -4
  407. package/src/mat/to-scale-axis/t-tree.ts +1 -2
  408. package/src/mat/to-scale-axis/traverse-spacial-tree.ts +2 -4
  409. package/src/mat/trim-mat.ts +4 -5
  410. package/src/mat.ts +3 -5
  411. package/src/point-on-shape.ts +10 -12
  412. package/src/simplify-mat.ts +11 -13
  413. package/src/svg/get-curvature-at-interface.ts +1 -3
  414. package/src/svg/get-extreme.ts +2 -3
  415. package/src/svg/get-loop-bounds.ts +4 -4
  416. package/src/svg/get-min-y-pos.ts +2 -6
  417. package/src/svg/get-shape-bounds.ts +2 -3
  418. package/src/sweep-line/are-boxes-intersecting.ts +1 -1
  419. package/src/to-scale-axis.ts +15 -16
  420. package/src/traverse-edges.ts +1 -2
  421. package/src/traverse-vertices.ts +1 -2
  422. package/test/lib-load.spec.ts +0 -1
  423. package/tsconfig.json +6 -31
  424. package/webpack.config.cjs +132 -0
  425. package/.nycrc +0 -4
  426. package/node/mat/cmp-cp-on-delta.d.ts +0 -14
  427. package/node/mat/cmp-cp-on-delta.js +0 -45
  428. package/node/mat/cmp-cp-on-delta.js.map +0 -1
  429. package/node/mat/find-mat/get-total-abs-curvature.d.ts +0 -5
  430. package/node/mat/find-mat/get-total-abs-curvature.js +0 -13
  431. package/node/mat/find-mat/get-total-abs-curvature.js.map +0 -1
  432. package/node/mat/find-mat/get-total-by.d.ts +0 -10
  433. package/node/mat/find-mat/get-total-by.js +0 -22
  434. package/node/mat/find-mat/get-total-by.js.map +0 -1
  435. package/node/mat/get-edges-as-array.d.ts +0 -4
  436. package/node/mat/get-edges-as-array.js +0 -12
  437. package/node/mat/get-edges-as-array.js.map +0 -1
  438. package/node/mat/get-largest-three-prong.d.ts +0 -4
  439. package/node/mat/get-largest-three-prong.js +0 -13
  440. package/node/mat/get-largest-three-prong.js.map +0 -1
  441. package/node/mat/to-scale-axis/add-to-tree.d.ts +0 -13
  442. package/node/mat/to-scale-axis/add-to-tree.js +0 -39
  443. package/node/mat/to-scale-axis/add-to-tree.js.map +0 -1
  444. package/node/mat/to-scale-axis/calc-groups.d.ts +0 -28
  445. package/node/mat/to-scale-axis/calc-groups.js +0 -66
  446. package/node/mat/to-scale-axis/calc-groups.js.map +0 -1
  447. package/node/mat/to-scale-axis/create-spacial-tree.d.ts +0 -9
  448. package/node/mat/to-scale-axis/create-spacial-tree.js +0 -24
  449. package/node/mat/to-scale-axis/create-spacial-tree.js.map +0 -1
  450. package/node/mat/to-scale-axis/get-engulfed-vertices.d.ts +0 -12
  451. package/node/mat/to-scale-axis/get-engulfed-vertices.js +0 -95
  452. package/node/mat/to-scale-axis/get-engulfed-vertices.js.map +0 -1
  453. package/node/mat/to-scale-axis/t-tree.d.ts +0 -6
  454. package/node/mat/to-scale-axis/t-tree.js +0 -3
  455. package/node/mat/to-scale-axis/t-tree.js.map +0 -1
  456. package/node/mat/to-scale-axis/traverse-spacial-tree.d.ts +0 -11
  457. package/node/mat/to-scale-axis/traverse-spacial-tree.js +0 -25
  458. package/node/mat/to-scale-axis/traverse-spacial-tree.js.map +0 -1
  459. package/node/svg/get-curvature-at-interface.d.ts +0 -9
  460. package/node/svg/get-curvature-at-interface.js +0 -49
  461. package/node/svg/get-curvature-at-interface.js.map +0 -1
  462. package/node/svg/get-extreme.d.ts +0 -9
  463. package/node/svg/get-extreme.js +0 -16
  464. package/node/svg/get-extreme.js.map +0 -1
  465. package/node/sweep-line/are-boxes-intersecting.d.ts +0 -11
  466. package/node/sweep-line/are-boxes-intersecting.js +0 -42
  467. package/node/sweep-line/are-boxes-intersecting.js.map +0 -1
  468. package/test/mocha.opts +0 -4
  469. package/webpack.config.js +0 -25
@@ -1,11 +1,10 @@
1
-
2
- import LlRbTree from 'flo-ll-rb-tree';
3
- import { Loop } from "../../loop";
4
- import { CpNode } from '../../cp-node';
5
- import { getShapeBounds } from '../../svg/get-shape-bounds';
6
- import { getMinYPos } from '../../svg/get-min-y-pos'
7
- import { find2Prong } from './find-2-prong/find-2-prong';
8
- import { add2Prong } from './add-2-prong';
1
+ import { LlRbTree } from 'flo-ll-rb-tree';
2
+ import { Loop } from '../../loop.js';
3
+ import { CpNode } from '../../cp-node.js';
4
+ import { getShapeBounds } from '../../svg/get-shape-bounds.js';
5
+ import { getMinYPos } from '../../svg/get-min-y-pos.js';
6
+ import { find2Prong } from './find-2-prong/find-2-prong.js';
7
+ import { add2Prong } from './add-2-prong.js';
9
8
 
10
9
 
11
10
  /**
@@ -1,5 +1,4 @@
1
-
2
- import { IPointOnShape, isPosQuiteSharpCorner } from '../../point-on-shape';
1
+ import { IPointOnShape, isPosQuiteSharpCorner } from '../../point-on-shape.js';
3
2
 
4
3
 
5
4
  /** @hidden */
@@ -1,5 +1,4 @@
1
-
2
- import { IPointOnShape, isPosQuiteSharpCorner } from '../../point-on-shape';
1
+ import { IPointOnShape, isPosQuiteSharpCorner } from '../../point-on-shape.js';
3
2
 
4
3
 
5
4
  /** @hidden */
@@ -1,7 +1,6 @@
1
-
2
1
  import { totalAbsoluteCurvature } from 'flo-bezier3';
3
- import { getCurvatureAtInterface } from '../../svg/get-curvature-at-interface';
4
- import { getTotalBy } from './get-total-by';
2
+ import { getCurvatureAtInterface } from '../../svg/get-curvature-at-interface.js';
3
+ import { getTotalBy } from './get-total-by.js';
5
4
 
6
5
 
7
6
  /**
@@ -1,6 +1,5 @@
1
-
2
- import { Curve } from '../../curve';
3
- import { Loop } from '../../loop';
1
+ import { Curve } from '../../curve.js';
2
+ import { Loop } from '../../loop.js';
4
3
 
5
4
 
6
5
  /**
@@ -1,14 +1,25 @@
1
+ import { squaredDistanceBetween as squaredDistanceBetween_ } from 'flo-vector2d';
1
2
 
2
- import { squaredDistanceBetween } from 'flo-vector2d';
3
+ const squaredDistanceBetween = squaredDistanceBetween_;
3
4
 
4
5
 
5
6
  /**
6
7
  * @hidden
7
8
  */
8
- function getClosestSquareDistanceToRect(box: number[][], p: number[]) {
9
+ function getClosestSquareDistanceToRect(
10
+ box: number[][], p: number[]): number {
9
11
 
10
- let [[x0,y0],[x1,y1]] = box;
11
- let [xp,yp] = p;
12
+ const p0 = box[0];
13
+ const p1 = box[1];
14
+ const x0 = p0[0];
15
+ const y0 = p0[1];
16
+ const x1 = p1[0];
17
+ const y1 = p1[1];
18
+ const xp = p[0];
19
+ const yp = p[1];
20
+
21
+ //let [[x0,y0],[x1,y1]] = box;
22
+ //let [xp,yp] = p;
12
23
 
13
24
  if (xp < x0) {
14
25
  if (yp < y0) {
@@ -1,4 +1,3 @@
1
-
2
1
  import {
3
2
  squaredDistanceBetweenPointAndLineSegment, squaredDistanceBetween
4
3
  } from 'flo-vector2d';
@@ -1,9 +1,8 @@
1
-
2
- import { CpNode } from '../cp-node';
3
- import { Curve } from '../curve';
4
- import { BezierPiece } from './bezier-piece';
5
- import { isPosQuiteSharpCorner } from '../point-on-shape';
6
- import { compareCps } from '../contact-point';
1
+ import { CpNode } from '../cp-node.js';
2
+ import { Curve } from '../curve.js';
3
+ import { BezierPiece } from './bezier-piece.js';
4
+ import { isPosQuiteSharpCorner } from '../point-on-shape.js';
5
+ import { compareCps } from '../contact-point.js';
7
6
 
8
7
 
9
8
  /**
@@ -1,7 +1,6 @@
1
-
2
- import { Curve, getCornerAtEnd } from '../curve';
3
- import { PointOnShape } from '../point-on-shape';
4
- import { IPointOnShape } from '..';
1
+ import { Curve, getCornerAtEnd } from '../curve.js';
2
+ import { PointOnShape } from '../point-on-shape.js';
3
+ import { IPointOnShape } from '../point-on-shape.js';
5
4
 
6
5
 
7
6
  /**
@@ -1,6 +1,5 @@
1
-
2
- import { CpNode } from '../cp-node';
3
- import { traverseEdges } from '../traverse-edges';
1
+ import { CpNode } from '../cp-node.js';
2
+ import { traverseEdges } from '../traverse-edges.js';
4
3
 
5
4
 
6
5
  /** @hidden */
@@ -1,5 +1,4 @@
1
-
2
- import { CpNode } from '../cp-node';
1
+ import { CpNode } from '../cp-node.js';
3
2
 
4
3
 
5
4
  /** @hidden */
@@ -1,5 +1,4 @@
1
-
2
- import { CpNode } from '../cp-node';
1
+ import { CpNode } from '../cp-node.js';
3
2
 
4
3
 
5
4
  /** @hidden */
@@ -1,5 +1,4 @@
1
-
2
- import { CpNode } from '../cp-node';
1
+ import { CpNode } from '../cp-node.js';
3
2
 
4
3
 
5
4
  /** @hidden */
@@ -1,7 +1,6 @@
1
-
2
- import LlRbTree from 'flo-ll-rb-tree';
3
- import { IPointOnShape } from '../point-on-shape';
4
- import { CpNode } from '../cp-node';
1
+ import { LlRbTree } from 'flo-ll-rb-tree';
2
+ import { IPointOnShape } from '../point-on-shape.js';
3
+ import { CpNode } from '../cp-node.js';
5
4
 
6
5
 
7
6
  /**
@@ -38,8 +37,8 @@ function getNeighbouringPoints(
38
37
  }
39
38
 
40
39
  return [
41
- cps[0].data,
42
- cps[1].data
40
+ cps[0].datum,
41
+ cps[1].datum
43
42
  ] as CpNode[];
44
43
  }
45
44
 
@@ -1,6 +1,5 @@
1
-
2
- import { TwoProngForDebugging } from "../debug/two-prong-for-debugging";
3
- import { ElemType_TwoProng } from "./elem-type-two-prong";
1
+ import { TwoProngForDebugging } from '../debug/two-prong-for-debugging.js';
2
+ import { ElemType_TwoProng } from './elem-type-two-prong.js';
4
3
 
5
4
 
6
5
  /** @hidden */
@@ -1,11 +1,10 @@
1
-
2
- import LlRbTree from "flo-ll-rb-tree";
1
+ import { LlRbTree } from 'flo-ll-rb-tree';
3
2
  import { distanceBetween, toUnitVector, fromTo, dot } from 'flo-vector2d';
4
- import { Loop } from "../loop";
5
- import { CpNode } from "../cp-node";
6
- import { IPointOnShape } from "../point-on-shape";
7
- import { Circle } from "../circle";
8
- import { getNeighbouringPoints } from "./get-neighboring-cps";
3
+ import { Loop } from '../loop.js';
4
+ import { CpNode } from '../cp-node.js';
5
+ import { IPointOnShape } from '../point-on-shape.js';
6
+ import { Circle } from '../circle.js';
7
+ import { getNeighbouringPoints } from './get-neighboring-cps.js';
9
8
 
10
9
 
11
10
  /** @hidden */
@@ -1,10 +1,8 @@
1
-
2
- import { CpNode } from "../cp-node";
3
- import { getBranches } from "../get-branches";
4
- import { hausdorffDistance, toCubic } from "flo-bezier3";
5
- import { getCurveToNext } from "../get-curve-to-next";
6
- import { getCurveBetween } from "../get-curve/get-curve-between";
7
- import { closestPointOnBezier } from "flo-bezier3/node/simultaneous-properties/closest-point-on-bezier/closest-point-on-bezier";
1
+ import { closestPointOnBezier, hausdorffDistance, toCubic } from 'flo-bezier3';
2
+ import { CpNode } from '../cp-node.js';
3
+ import { getBranches } from '../get-branches.js';
4
+ import { getCurveToNext } from '../get-curve-to-next.js';
5
+ import { getCurveBetween } from '../get-curve/get-curve-between.js';
8
6
 
9
7
 
10
8
  /**
@@ -1,8 +1,7 @@
1
-
2
1
  declare var _debug_: Debug;
3
2
 
4
- import { Debug } from '../../debug/debug';
5
- import { Mat } from '../../mat';
3
+ import { Debug } from '../../debug/debug.js';
4
+ import { Mat } from '../../mat.js';
6
5
 
7
6
 
8
7
  /**
@@ -1,7 +1,6 @@
1
-
2
- import { Circle } from '../../circle';
3
- import { calcGroups } from './calc-groups';
4
- import { TTree } from './t-tree';
1
+ import { Circle } from '../../circle.js';
2
+ import { calcGroups } from './calc-groups.js';
3
+ import { TTree } from './t-tree.js';
5
4
 
6
5
 
7
6
  // DEPTH_LIMIT can be anything from 1 to 16, but from 2 to 6 seem to be the
@@ -1,5 +1,4 @@
1
-
2
- import { Circle } from '../../circle';
1
+ import { Circle } from '../../circle.js';
3
2
 
4
3
 
5
4
  /**
@@ -1,7 +1,6 @@
1
-
2
- import { Circle } from '../../circle';
3
- import { TTree } from './t-tree';
4
- import { addToTree } from './add-to-tree';
1
+ import { Circle } from '../../circle.js';
2
+ import { TTree } from './t-tree.js';
3
+ import { addToTree } from './add-to-tree.js';
5
4
 
6
5
 
7
6
  /** @hidden */
@@ -1,6 +1,5 @@
1
-
2
- import { getLeaves } from '../get-leaves';
3
- import { CpNode } from '../../cp-node';
1
+ import { getLeaves } from '../get-leaves.js';
2
+ import { CpNode } from '../../cp-node.js';
4
3
 
5
4
 
6
5
  /**
@@ -1,7 +1,6 @@
1
-
2
- import { Circle } from '../../circle';
3
- import { getLeaves } from '../get-leaves';
4
- import { CpNode } from '../../cp-node';
1
+ import { Circle } from '../../circle.js';
2
+ import { getLeaves } from '../get-leaves.js';
3
+ import { CpNode } from '../../cp-node.js';
5
4
 
6
5
 
7
6
  /**
@@ -1,7 +1,6 @@
1
-
2
- import { Circle, scaleCircle, engulfsCircle } from '../../circle';
3
- import { TTree } from './t-tree';
4
- import { calcGroups } from './calc-groups';
1
+ import { Circle, scaleCircle, engulfsCircle } from '../../circle.js';
2
+ import { TTree } from './t-tree.js';
3
+ import { calcGroups } from './calc-groups.js';
5
4
 
6
5
 
7
6
  /** @hidden */
@@ -1,5 +1,4 @@
1
-
2
- import { Circle } from '../../circle';
1
+ import { Circle } from '../../circle.js';
3
2
 
4
3
 
5
4
  /** @hidden */
@@ -1,7 +1,5 @@
1
-
2
- import { Circle } from '../../circle';
3
-
4
- import { TTree } from './t-tree';
1
+ import { Circle } from '../../circle.js';
2
+ import { TTree } from './t-tree.js';
5
3
 
6
4
 
7
5
  /**
@@ -1,8 +1,7 @@
1
-
2
- import { Mat } from '../mat';
3
- import { createNewCpTree } from './create-new-cp-tree';
4
- import { cullNonCycles } from './to-scale-axis/cull-non-cycles';
5
- import { clone } from '../cp-node/clone';
1
+ import { Mat } from '../mat.js';
2
+ import { createNewCpTree } from './create-new-cp-tree.js';
3
+ import { cullNonCycles } from './to-scale-axis/cull-non-cycles.js';
4
+ import { clone } from '../cp-node/clone.js';
6
5
 
7
6
 
8
7
  /**
package/src/mat.ts CHANGED
@@ -1,8 +1,6 @@
1
-
2
- import LlRbTree from "flo-ll-rb-tree";
3
-
4
- import { CpNode } from "./cp-node";
5
- import { Loop } from './loop';
1
+ import { LlRbTree } from 'flo-ll-rb-tree';
2
+ import { CpNode } from './cp-node.js';
3
+ import { Loop } from './loop.js';
6
4
 
7
5
 
8
6
  /**
@@ -1,10 +1,8 @@
1
-
2
1
  import { dot, fromTo, toUnitVector, rotateNeg90Degrees } from 'flo-vector2d';
3
2
  import { memoize } from 'flo-memoize';
4
- import { normal, κ as curvature, evalDeCasteljau } from 'flo-bezier3';
5
-
6
- import { Curve, getCornerAtEnd } from './curve'
7
- import { Circle } from './circle';
3
+ import { curvature, evalDeCasteljau, tangent } from 'flo-bezier3';
4
+ import { Curve, getCornerAtEnd } from './curve.js';
5
+ import { Circle } from './circle.js';
8
6
 
9
7
 
10
8
  interface IPointOnShape {
@@ -174,11 +172,11 @@ let calcOsculatingCircleRadius = memoize((pos: IPointOnShape) => {
174
172
  let ps = pos.curve.ps;
175
173
  let t = pos.t;
176
174
 
177
- let κ = -curvature(ps, t);
175
+ let c = -curvature(ps, t);
178
176
 
179
- // κ > 0 => bending inwards
177
+ // c > 0 => bending inwards
180
178
 
181
- return 1/κ;
179
+ return 1/c;
182
180
  });
183
181
 
184
182
 
@@ -192,7 +190,6 @@ function getOsculatingCircle(
192
190
  maxOsculatingCircleRadius: number,
193
191
  pos: IPointOnShape): Circle {
194
192
 
195
- //if (PointOnShape.isSharpCorner(pos)) {
196
193
  if (isPosSharpCorner(pos)) {
197
194
  return { center: pos.p, radius: 0 };
198
195
  }
@@ -208,11 +205,12 @@ function getOsculatingCircle(
208
205
  let ps = pos.curve.ps;
209
206
  let t = pos.t;
210
207
 
211
- let normal_ = toUnitVector(normal(ps,t));
208
+ const tangent_ = tangent(ps,t);
209
+ let normal_ = toUnitVector([-tangent_[1],tangent_[0]]);
212
210
  let p = evalDeCasteljau(ps,t);
213
211
  let circleCenter = [
214
- p[0] + normal_[0]*radius,
215
- p[1] + normal_[1]*radius
212
+ p[0] - normal_[0]*radius,
213
+ p[1] - normal_[1]*radius
216
214
  ];
217
215
 
218
216
  return { center: circleCenter, radius };
@@ -1,12 +1,9 @@
1
-
2
- import { CpNode } from "./cp-node";
3
- import { getBranches } from "./get-branches";
4
- import { hausdorffDistance, toCubic } from "flo-bezier3";
5
- import { getCurveToNext } from "./get-curve-to-next";
6
- import { getCurveBetween } from "./get-curve/get-curve-between";
7
- import { Mat } from "./mat";
8
- import { createNewCpTree } from "./mat/create-new-cp-tree";
9
- import { closestPointOnBezier } from "flo-bezier3/node/simultaneous-properties/closest-point-on-bezier/closest-point-on-bezier";
1
+ import { hausdorffDistance } from 'flo-bezier3';
2
+ import { CpNode } from './cp-node.js';
3
+ import { getBranches } from './get-branches.js';
4
+ import { getCurveToNext } from './get-curve-to-next.js';
5
+ import { getCurveBetween } from './get-curve/get-curve-between.js';
6
+ import { Mat } from './mat.js';
10
7
 
11
8
 
12
9
  /**
@@ -16,16 +13,17 @@ import { closestPointOnBezier } from "flo-bezier3/node/simultaneous-properties/c
16
13
  * @param anlgeTolerance Tolerance given as the degrees difference of the unit
17
14
  * direction vectors at the interface between curves. A tolerance of zero means
18
15
  * perfect smoothness is required - defaults to 15.
16
+ * TODO - the next two params are wrong??
19
17
  * @param hausdorffTolerance The approximate maximum Hausdorff Distance tolerance -
20
18
  * defaults to 0.1
21
- * @param hausdorffSpacing The spacing on the curves used to calculate the Hausdorff
19
+ * @param maxIterations The spacing on the curves used to calculate the Hausdorff
22
20
  * Distance - defaults to 1
23
21
  */
24
22
  function simplifyMat(
25
23
  mat: Mat,
26
24
  anlgeTolerance = 15,
27
- hausdorffTolerance = 1e-1,
28
- hausdorffSpacing = 1e0): Mat {
25
+ hausdorffTolerance = 2**-3,
26
+ maxIterations = 50): Mat {
29
27
 
30
28
  let cpNode = mat.cpNode;
31
29
 
@@ -47,7 +45,7 @@ function simplifyMat(
47
45
 
48
46
  if (j === branch.length) { break; }
49
47
 
50
- let hd = getTotalHausdorffDistance(i, j, branch, hausdorffSpacing);
48
+ let hd = getTotalHausdorffDistance(i, j, branch, maxIterations);
51
49
 
52
50
  if (hd > hausdorffTolerance) {
53
51
  break;
@@ -1,9 +1,7 @@
1
-
2
1
  // TODO - move to another library
3
-
4
2
  import { tangent } from 'flo-bezier3';
5
3
  import { dot, cross, toUnitVector } from 'flo-vector2d';
6
- import { Curve } from '../curve';
4
+ import { Curve } from '../curve.js';
7
5
 
8
6
 
9
7
  /**
@@ -1,6 +1,5 @@
1
-
2
- import { Loop } from '../loop';
3
- import { getShapeBounds } from './get-shape-bounds';
1
+ import { Loop } from '../loop.js';
2
+ import { getShapeBounds } from './get-shape-bounds.js';
4
3
 
5
4
 
6
5
  /**
@@ -1,9 +1,8 @@
1
-
2
1
  import { getBounds } from 'flo-bezier3';
3
- import { Loop } from '../loop';
4
- import { Curve } from '../curve';
5
- import { PointOnShape, IPointOnShape } from '../point-on-shape';
6
2
  import { memoize } from 'flo-memoize';
3
+ import { Loop } from '../loop.js';
4
+ import { Curve } from '../curve.js';
5
+ import { PointOnShape, IPointOnShape } from '../point-on-shape.js';
7
6
 
8
7
 
9
8
  /** @hidden */
@@ -36,6 +35,7 @@ let getLoopBounds = memoize(function(loop: Loop): {
36
35
 
37
36
  loop.curves.forEach(function(curve: Curve): void {
38
37
  let ps = curve.ps;
38
+ // let bounds = getBounds_(ps);
39
39
  let bounds = getBounds(ps);
40
40
 
41
41
 
@@ -1,10 +1,6 @@
1
-
2
1
  /** @hidden */
3
- declare var _debug_: Debug;
4
-
5
- import { Debug } from '../debug/debug';
6
- import { Loop } from '../loop';
7
- import { getLoopBounds } from './get-loop-bounds';
2
+ import { Loop } from '../loop.js';
3
+ import { getLoopBounds } from './get-loop-bounds.js';
8
4
 
9
5
 
10
6
  /**
@@ -1,7 +1,6 @@
1
-
2
1
  import { memoize } from 'flo-memoize';
3
- import { Loop } from '../loop';
4
- import { getLoopBounds } from './get-loop-bounds';
2
+ import { Loop } from '../loop.js';
3
+ import { getLoopBounds } from './get-loop-bounds.js';
5
4
 
6
5
 
7
6
  // TODO - move to another library
@@ -9,7 +9,7 @@
9
9
  * contain their border) or open.
10
10
  */
11
11
  function areBoxesIntersecting(closed: boolean) {
12
- return (a: number[][], b: number[][]) => {
12
+ return (a: number[][], b: number[][]): boolean => {
13
13
 
14
14
  let [[ax0, ay0],[ax1, ay1]] = a;
15
15
  let [[bx0, by0],[bx1, by1]] = b;
@@ -1,21 +1,20 @@
1
-
2
1
  /** @hidden */
3
2
  declare var _debug_: Debug;
4
3
 
5
- import { Debug } from './debug/debug';
6
4
  import { length } from 'flo-bezier3';
7
- import { CpNode } from './cp-node';
8
- import { Circle } from './circle';
9
- import { Mat } from './mat';
10
- import { traverseEdges } from './traverse-edges';
11
- import { traverseVertices } from './traverse-vertices';
12
- import { getLargestVertex } from './mat/get-largest-vertex';
13
- import { createNewCpTree } from './mat/create-new-cp-tree';
14
- import { getLeaves } from './mat/get-leaves';
15
- import { cull } from './mat/to-scale-axis/cull';
16
- import { addDebugInfo } from './mat/to-scale-axis/add-debug-info';
17
- import { clone } from './cp-node/clone';
18
- import { getCurveToNext } from './get-curve-to-next';
5
+ import { Debug } from './debug/debug.js';
6
+ import { CpNode } from './cp-node.js';
7
+ import { Circle } from './circle.js';
8
+ import { Mat } from './mat.js';
9
+ import { traverseEdges } from './traverse-edges.js';
10
+ import { traverseVertices } from './traverse-vertices.js';
11
+ import { getLargestVertex } from './mat/get-largest-vertex.js';
12
+ import { createNewCpTree } from './mat/create-new-cp-tree.js';
13
+ import { getLeaves } from './mat/get-leaves.js';
14
+ import { cull } from './mat/to-scale-axis/cull.js';
15
+ import { addDebugInfo } from './mat/to-scale-axis/add-debug-info.js';
16
+ import { clone } from './cp-node/clone.js';
17
+ import { getCurveToNext } from './get-curve-to-next.js';
19
18
 
20
19
 
21
20
  function linearScale(s: number) {
@@ -26,7 +25,7 @@ function linearScale(s: number) {
26
25
 
27
26
 
28
27
  /** @hidden */
29
- let len = length([0,1]);
28
+ //let len = length([0,1]);
30
29
 
31
30
 
32
31
  /**
@@ -80,7 +79,7 @@ function toScaleAxis(
80
79
 
81
80
  let cpNode_ = cpNode.next;
82
81
 
83
- let l = len(getCurveToNext(cpNode));
82
+ let l = length([0,1], getCurveToNext(cpNode));
84
83
 
85
84
  let r = cpNode_.cp.circle.radius;
86
85
  let r_ = f_(r);
@@ -1,5 +1,4 @@
1
-
2
- import { CpNode } from './cp-node';
1
+ import { CpNode } from './cp-node.js';
3
2
 
4
3
 
5
4
  /**
@@ -1,5 +1,4 @@
1
-
2
- import { CpNode } from './cp-node';
1
+ import { CpNode } from './cp-node.js';
3
2
 
4
3
 
5
4
  /**
@@ -1,4 +1,3 @@
1
-
2
1
  import { describe } from 'mocha';
3
2
  import { assert, expect } from 'chai';
4
3
  import { findMats } from '../node/index.js';