flo-mat 4.1.5 → 5.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 (356) hide show
  1. package/__tests__/closest-boundary-point/get-endpoint-info.spec.ts +140 -0
  2. package/__tests__/closest-boundary-point/root-interval-to-distance-squared-interval.spec.ts +87 -0
  3. package/__tests__/cp-node/fs/get-all-on-loop-by-loop.spec.ts +55 -0
  4. package/__tests__/cp-node/fs/get-angle-between-mat-curves.spec.ts +39 -3
  5. package/__tests__/cp-node/fs/get-boundary-bezier-parts-to-next.spec.ts +87 -3
  6. package/__tests__/cp-node/fs/get-boundary-beziers-between.spec.ts +68 -3
  7. package/__tests__/cp-node/fs/get-boundary-beziers-to-next.spec.ts +41 -3
  8. package/__tests__/cp-node/fs/get-boundary-distance-to-next.spec.ts +20 -3
  9. package/__tests__/cp-node/fs/get-branch-beziers.spec.ts +42 -3
  10. package/__tests__/cp-node/fs/get-branch.spec.ts +60 -3
  11. package/__tests__/cp-node/fs/get-cp-node-ordering.spec.ts +19 -3
  12. package/__tests__/cp-node/fs/get-distance-to-next.spec.ts +37 -4
  13. package/__tests__/cp-node/fs/get-edge-direction.spec.ts +50 -3
  14. package/__tests__/cp-node/fs/get-first-exit.spec.ts +78 -3
  15. package/__tests__/cp-node/fs/get-hole-closers.spec.ts +32 -3
  16. package/__tests__/cp-node/fs/get-implied-boundary-bezier-between.spec.ts +48 -3
  17. package/__tests__/cp-node/fs/get-mat-curve-between.spec.ts +77 -3
  18. package/__tests__/cp-node/fs/get-mat-curve-to-next.spec.ts +17 -4
  19. package/__tests__/cp-node/fs/get-mat-curves-between.spec.ts +38 -3
  20. package/__tests__/cp-node/fs/get-salience.spec.ts +68 -3
  21. package/__tests__/cp-node/fs/get-vertex-forward-children.spec.ts +40 -3
  22. package/__tests__/cp-node/fs/insert-cp-node.spec.ts +87 -3
  23. package/__tests__/cp-node/fs/is-special.spec.ts +1 -1
  24. package/__tests__/cp-node/fs/remove-cp-node.spec.ts +42 -3
  25. package/__tests__/find-2-prong/calc-seperation-tolerance.spec.ts +46 -0
  26. package/__tests__/find-2-prong/get-medial/get-closest-points.spec.ts +1 -1
  27. package/__tests__/floyd-warshall/get-graph.spec.ts +100 -0
  28. package/__tests__/get-mats-with-hole.ts +28 -0
  29. package/__tests__/get-mats1.spec.ts +61 -0
  30. package/__tests__/get-mats1.ts +75 -67
  31. package/__tests__/helpers/cp-node-by-id.ts +27 -0
  32. package/__tests__/helpers/expect-point-close.ts +42 -0
  33. package/__tests__/mat/hausdorff-distance-one-sided-exceeds.spec.ts +129 -0
  34. package/__tests__/mat/simplify-mat.spec.ts +85 -0
  35. package/__tests__/reconstruct-from-mat/reconstruct-from-mat.spec.ts +39 -0
  36. package/__tests__/specific-cases/test-svgs/achispado.svg +14 -0
  37. package/__tests__/utils/get-beziers-from-tangents.spec.ts +142 -0
  38. package/browser/index.js +12985 -9965
  39. package/browser/index.min.js +1 -1
  40. package/node/closest-boundary-point/cull-curve-pieces.d.ts +21 -0
  41. package/node/closest-boundary-point/cull-curve-pieces.js +40 -0
  42. package/node/closest-boundary-point/cull-curve-pieces.js.map +1 -0
  43. package/node/closest-boundary-point/get-close-boundary-points-certified.js +5 -2
  44. package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -1
  45. package/node/closest-boundary-point/get-endpoint-info.d.ts +39 -0
  46. package/node/closest-boundary-point/get-endpoint-info.js +78 -0
  47. package/node/closest-boundary-point/get-endpoint-info.js.map +1 -0
  48. package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js +5 -19
  49. package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js.map +1 -1
  50. package/node/closest-boundary-point/root-interval-to-distance-squared-interval.d.ts +17 -5
  51. package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js +37 -50
  52. package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js.map +1 -1
  53. package/node/corner/get-corner.d.ts +18 -1
  54. package/node/corner/get-corner.js +8 -1
  55. package/node/corner/get-corner.js.map +1 -1
  56. package/node/corner/get-interface-ccw.js.map +1 -1
  57. package/node/cp-node/cp-node.d.ts +4 -3
  58. package/node/cp-node/fs/get-all-on-loop-by-loop.js +0 -4
  59. package/node/cp-node/fs/get-all-on-loop-by-loop.js.map +1 -1
  60. package/node/cp-node/fs/get-angle-between-mat-curves.js +6 -4
  61. package/node/cp-node/fs/get-angle-between-mat-curves.js.map +1 -1
  62. package/node/cp-node/fs/get-boundary-beziers-between.d.ts +6 -4
  63. package/node/cp-node/fs/get-boundary-beziers-between.js +6 -4
  64. package/node/cp-node/fs/get-boundary-beziers-between.js.map +1 -1
  65. package/node/cp-node/fs/get-branch-beziers.d.ts +2 -1
  66. package/node/cp-node/fs/get-branch-beziers.js +3 -2
  67. package/node/cp-node/fs/get-branch-beziers.js.map +1 -1
  68. package/node/cp-node/fs/get-branch.js +1 -2
  69. package/node/cp-node/fs/get-branch.js.map +1 -1
  70. package/node/cp-node/fs/get-distance-to-next.js +4 -2
  71. package/node/cp-node/fs/get-distance-to-next.js.map +1 -1
  72. package/node/cp-node/fs/get-first-exit.d.ts +7 -3
  73. package/node/cp-node/fs/get-first-exit.js +13 -11
  74. package/node/cp-node/fs/get-first-exit.js.map +1 -1
  75. package/node/cp-node/fs/get-implied-boundary-bezier-between.d.ts +9 -1
  76. package/node/cp-node/fs/get-implied-boundary-bezier-between.js +11 -55
  77. package/node/cp-node/fs/get-implied-boundary-bezier-between.js.map +1 -1
  78. package/node/cp-node/fs/get-mat-curve-between.d.ts +4 -3
  79. package/node/cp-node/fs/get-mat-curve-between.js +5 -49
  80. package/node/cp-node/fs/get-mat-curve-between.js.map +1 -1
  81. package/node/cp-node/fs/get-mat-curve-to-next.d.ts +1 -1
  82. package/node/cp-node/fs/get-mat-curves-between.d.ts +8 -0
  83. package/node/cp-node/fs/get-mat-curves-between.js +9 -2
  84. package/node/cp-node/fs/get-mat-curves-between.js.map +1 -1
  85. package/node/cp-node/fs/get-real-prong-count.d.ts +2 -1
  86. package/node/cp-node/fs/get-real-prong-count.js +11 -5
  87. package/node/cp-node/fs/get-real-prong-count.js.map +1 -1
  88. package/node/cp-node/fs/get-salience.d.ts +10 -0
  89. package/node/cp-node/fs/get-salience.js +17 -1
  90. package/node/cp-node/fs/get-salience.js.map +1 -1
  91. package/node/cp-node/fs/is-fully-terminating.d.ts +4 -2
  92. package/node/cp-node/fs/is-fully-terminating.js +6 -15
  93. package/node/cp-node/fs/is-fully-terminating.js.map +1 -1
  94. package/node/cp-node/fs/is-on-same-loop.d.ts +1 -1
  95. package/node/cp-node/fs/is-special.d.ts +7 -0
  96. package/node/cp-node/fs/is-special.js +9 -2
  97. package/node/cp-node/fs/is-special.js.map +1 -1
  98. package/node/cp-node/fs/is-vertex.d.ts +1 -1
  99. package/node/cp-node/fs/traverse-edges.d.ts +7 -3
  100. package/node/cp-node/fs/traverse-edges.js +7 -3
  101. package/node/cp-node/fs/traverse-edges.js.map +1 -1
  102. package/node/cp-node/stringification/from-stringifyable.d.ts +2 -2
  103. package/node/cp-node/stringification/from-stringifyable.js +1 -1
  104. package/node/cp-node/stringification/from-stringifyable.js.map +1 -1
  105. package/node/cp-node/stringification/to-stringifyable.d.ts +3 -3
  106. package/node/cp-node/stringification/to-stringifyable.js +3 -3
  107. package/node/debug/debug.d.ts +26 -3
  108. package/node/debug/debug.js +16 -5
  109. package/node/debug/debug.js.map +1 -1
  110. package/node/find-2-prong/add-2-prong.js +1 -7
  111. package/node/find-2-prong/add-2-prong.js.map +1 -1
  112. package/node/find-2-prong/calc-seperation-tolerance.d.ts +28 -5
  113. package/node/find-2-prong/calc-seperation-tolerance.js +32 -89
  114. package/node/find-2-prong/calc-seperation-tolerance.js.map +1 -1
  115. package/node/find-2-prong/find-2-prong.js +8 -10
  116. package/node/find-2-prong/find-2-prong.js.map +1 -1
  117. package/node/find-2-prong/find-and-add-2-prongs.js +2 -2
  118. package/node/find-2-prong/find-and-add-2-prongs.js.map +1 -1
  119. package/node/find-2-prong/get-medial/get-antipodal-points.d.ts +1 -2
  120. package/node/find-2-prong/get-medial/get-antipodal-points.js +2 -3
  121. package/node/find-2-prong/get-medial/get-antipodal-points.js.map +1 -1
  122. package/node/find-2-prong/get-medial/get-closest-points.d.ts +1 -8
  123. package/node/find-2-prong/get-medial/get-closest-points.js +4 -40
  124. package/node/find-2-prong/get-medial/get-closest-points.js.map +1 -1
  125. package/node/find-2-prong/reduce-radius.d.ts +1 -1
  126. package/node/find-2-prong/reduce-radius.js +6 -3
  127. package/node/find-2-prong/reduce-radius.js.map +1 -1
  128. package/node/find-3-prong/calc-better-x.js +1 -1
  129. package/node/find-3-prong/calc-better-x.js.map +1 -1
  130. package/node/find-3-prong/find-3-prong-for-delta3s.d.ts +3 -2
  131. package/node/find-3-prong/find-3-prong-for-delta3s.js +35 -41
  132. package/node/find-3-prong/find-3-prong-for-delta3s.js.map +1 -1
  133. package/node/find-3-prong/find-3-prong.js +3 -1
  134. package/node/find-3-prong/find-3-prong.js.map +1 -1
  135. package/node/find-3-prong/find-and-add-3-prongs.js +16 -0
  136. package/node/find-3-prong/find-and-add-3-prongs.js.map +1 -1
  137. package/node/find-mat/create-initial-cp-tree.js +2 -2
  138. package/node/find-mat/create-initial-cp-tree.js.map +1 -1
  139. package/node/find-mat/find-mat.js +3 -4
  140. package/node/find-mat/find-mat.js.map +1 -1
  141. package/node/find-mat/find-mats.d.ts +6 -12
  142. package/node/find-mat/find-mats.js +10 -27
  143. package/node/find-mat/find-mats.js.map +1 -1
  144. package/node/find-mat/get-dull-corners-on-loop.js +2 -2
  145. package/node/find-mat/get-dull-corners-on-loop.js.map +1 -1
  146. package/node/find-mat/get-for-1-prongs-on-loop.js +36 -8
  147. package/node/find-mat/get-for-1-prongs-on-loop.js.map +1 -1
  148. package/node/find-mat/get-meta.d.ts +14 -4
  149. package/node/find-mat/get-meta.js +30 -24
  150. package/node/find-mat/get-meta.js.map +1 -1
  151. package/node/find-mat/get-sharp-corners.js +2 -2
  152. package/node/find-mat/get-sharp-corners.js.map +1 -1
  153. package/node/find-mat/mat-options.d.ts +2 -2
  154. package/node/floyd-warshall/get-graph.d.ts +12 -1
  155. package/node/floyd-warshall/get-graph.js +41 -38
  156. package/node/floyd-warshall/get-graph.js.map +1 -1
  157. package/node/geometry/get-bounding-box-.d.ts +16 -2
  158. package/node/geometry/get-bounding-box-.js +5 -2
  159. package/node/geometry/get-bounding-box-.js.map +1 -1
  160. package/node/geometry/get-closest-square-distance-to-rect.d.ts +3 -0
  161. package/node/geometry/get-closest-square-distance-to-rect.js +7 -5
  162. package/node/geometry/get-closest-square-distance-to-rect.js.map +1 -1
  163. package/node/geometry/get-closest-squared-distance-to-rotated-rect.d.ts +4 -0
  164. package/node/geometry/get-closest-squared-distance-to-rotated-rect.js +11 -5
  165. package/node/geometry/get-closest-squared-distance-to-rotated-rect.js.map +1 -1
  166. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.js +1 -2
  167. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.js.map +1 -1
  168. package/node/index.d.ts +3 -2
  169. package/node/index.js +2 -1
  170. package/node/index.js.map +1 -1
  171. package/node/mat/clone-mat.d.ts +9 -0
  172. package/node/mat/clone-mat.js +17 -0
  173. package/node/mat/clone-mat.js.map +1 -0
  174. package/node/mat/clone-meta.d.ts +12 -0
  175. package/node/mat/clone-meta.js +24 -0
  176. package/node/mat/clone-meta.js.map +1 -0
  177. package/node/mat/get-boundary-piece-beziers.d.ts +5 -0
  178. package/node/mat/get-boundary-piece-beziers.js +7 -93
  179. package/node/mat/get-boundary-piece-beziers.js.map +1 -1
  180. package/node/mat/get-largest-3-prong.d.ts +6 -0
  181. package/node/mat/get-largest-3-prong.js +8 -5
  182. package/node/mat/get-largest-3-prong.js.map +1 -1
  183. package/node/mat/get-largest-vertex.d.ts +15 -1
  184. package/node/mat/get-largest-vertex.js +20 -7
  185. package/node/mat/get-largest-vertex.js.map +1 -1
  186. package/node/mat/hausdorff-distance-one-sided-exceeds.d.ts +79 -0
  187. package/node/mat/hausdorff-distance-one-sided-exceeds.js +251 -0
  188. package/node/mat/hausdorff-distance-one-sided-exceeds.js.map +1 -0
  189. package/node/mat/mat-meta.d.ts +0 -6
  190. package/node/mat/simplify-mat.d.ts +25 -8
  191. package/node/mat/simplify-mat.js +182 -53
  192. package/node/mat/simplify-mat.js.map +1 -1
  193. package/node/mat/trim-mat.d.ts +4 -2
  194. package/node/mat/trim-mat.js +3 -1
  195. package/node/mat/trim-mat.js.map +1 -1
  196. package/node/point-on-shape/get-boundary-tangent-line.d.ts +19 -0
  197. package/node/point-on-shape/get-boundary-tangent-line.js +33 -0
  198. package/node/point-on-shape/get-boundary-tangent-line.js.map +1 -0
  199. package/node/point-on-shape/get-osculating-circle.d.ts +6 -4
  200. package/node/point-on-shape/get-osculating-circle.js +6 -4
  201. package/node/point-on-shape/get-osculating-circle.js.map +1 -1
  202. package/node/point-on-shape/get-pos-corner.js +2 -2
  203. package/node/point-on-shape/get-pos-corner.js.map +1 -1
  204. package/node/reconstruct-from-mat/reconstruct-from-mat.js +20 -80
  205. package/node/reconstruct-from-mat/reconstruct-from-mat.js.map +1 -1
  206. package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.d.ts +4 -0
  207. package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js +4 -0
  208. package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js.map +1 -1
  209. package/node/sat/cull.d.ts +7 -6
  210. package/node/sat/cull.js +13 -16
  211. package/node/sat/cull.js.map +1 -1
  212. package/node/sat/get-sat-culls.d.ts +12 -2
  213. package/node/sat/get-sat-culls.js +21 -16
  214. package/node/sat/get-sat-culls.js.map +1 -1
  215. package/node/svg/get-shape-bounds.d.ts +1 -12
  216. package/node/svg/get-shape-bounds.js +2 -3
  217. package/node/svg/get-shape-bounds.js.map +1 -1
  218. package/node/sweep-line/sweep-line.js.map +1 -1
  219. package/node/utils/get-beziers-from-tangents.d.ts +28 -0
  220. package/node/utils/get-beziers-from-tangents.js +92 -0
  221. package/node/utils/get-beziers-from-tangents.js.map +1 -0
  222. package/node/vertex/remove-vertex.d.ts +5 -3
  223. package/node/vertex/remove-vertex.js +5 -3
  224. package/node/vertex/remove-vertex.js.map +1 -1
  225. package/package.json +9 -9
  226. package/qv-infinite-loop.md +120 -0
  227. package/src/closest-boundary-point/cull-curve-pieces.ts +49 -0
  228. package/src/closest-boundary-point/get-close-boundary-points-certified.ts +5 -2
  229. package/src/closest-boundary-point/get-endpoint-info.ts +96 -0
  230. package/src/closest-boundary-point/get-potential-closest-points-on-curve-certified.ts +5 -23
  231. package/src/closest-boundary-point/root-interval-to-distance-squared-interval.ts +42 -60
  232. package/src/corner/get-corner.ts +10 -1
  233. package/src/corner/get-interface-ccw.ts +2 -2
  234. package/src/cp-node/cp-node.ts +4 -3
  235. package/src/cp-node/fs/get-all-on-loop-by-loop.ts +0 -4
  236. package/src/cp-node/fs/get-angle-between-mat-curves.ts +6 -4
  237. package/src/cp-node/fs/get-boundary-beziers-between.ts +10 -8
  238. package/src/cp-node/fs/get-branch-beziers.ts +3 -2
  239. package/src/cp-node/fs/get-branch.ts +1 -2
  240. package/src/cp-node/fs/get-distance-to-next.ts +4 -2
  241. package/src/cp-node/fs/get-first-exit.ts +15 -14
  242. package/src/cp-node/fs/get-implied-boundary-bezier-between.ts +17 -69
  243. package/src/cp-node/fs/get-mat-curve-between.ts +9 -67
  244. package/src/cp-node/fs/get-mat-curves-between.ts +9 -2
  245. package/src/cp-node/fs/get-real-prong-count.ts +11 -7
  246. package/src/cp-node/fs/get-salience.ts +15 -2
  247. package/src/cp-node/fs/is-fully-terminating.ts +6 -18
  248. package/src/cp-node/fs/is-on-same-loop.ts +2 -2
  249. package/src/cp-node/fs/is-special.ts +11 -6
  250. package/src/cp-node/fs/is-vertex.ts +1 -1
  251. package/src/cp-node/fs/traverse-edges.ts +8 -4
  252. package/src/cp-node/stringification/from-stringifyable.ts +75 -75
  253. package/src/cp-node/stringification/to-stringifyable.ts +3 -3
  254. package/src/debug/debug.ts +44 -8
  255. package/src/find-2-prong/add-2-prong.ts +2 -9
  256. package/src/find-2-prong/calc-seperation-tolerance.ts +34 -115
  257. package/src/find-2-prong/find-2-prong.ts +9 -11
  258. package/src/find-2-prong/find-and-add-2-prongs.ts +2 -2
  259. package/src/find-2-prong/get-medial/get-antipodal-points.ts +1 -3
  260. package/src/find-2-prong/get-medial/get-closest-points.ts +6 -51
  261. package/src/find-2-prong/reduce-radius.ts +6 -4
  262. package/src/find-3-prong/calc-better-x.ts +2 -2
  263. package/src/find-3-prong/find-3-prong-for-delta3s.ts +197 -214
  264. package/src/find-3-prong/find-3-prong.ts +54 -51
  265. package/src/find-3-prong/find-and-add-3-prongs.ts +20 -1
  266. package/src/find-mat/create-initial-cp-tree.ts +2 -2
  267. package/src/find-mat/find-mat.ts +4 -6
  268. package/src/find-mat/find-mats.ts +83 -105
  269. package/src/find-mat/get-dull-corners-on-loop.ts +2 -2
  270. package/src/find-mat/get-for-1-prongs-on-loop.ts +40 -8
  271. package/src/find-mat/get-meta.ts +34 -39
  272. package/src/find-mat/get-sharp-corners.ts +2 -2
  273. package/src/find-mat/mat-options.ts +2 -2
  274. package/src/floyd-warshall/get-graph.ts +46 -47
  275. package/src/geometry/get-bounding-box-.ts +5 -2
  276. package/src/geometry/get-closest-square-distance-to-rect.ts +7 -7
  277. package/src/geometry/get-closest-squared-distance-to-rotated-rect.ts +12 -10
  278. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.ts +1 -2
  279. package/src/index.ts +3 -2
  280. package/src/mat/clone-mat.ts +9 -3
  281. package/src/mat/clone-meta.ts +8 -0
  282. package/src/mat/get-boundary-piece-beziers.ts +16 -117
  283. package/src/mat/get-largest-3-prong.ts +9 -6
  284. package/src/mat/get-largest-vertex.ts +25 -9
  285. package/src/mat/hausdorff-distance-one-sided-exceeds.ts +314 -0
  286. package/src/mat/mat-meta.ts +0 -9
  287. package/src/mat/simplify-mat.ts +254 -116
  288. package/src/mat/trim-mat.ts +6 -4
  289. package/src/point-on-shape/get-boundary-tangent-line.ts +36 -0
  290. package/src/point-on-shape/get-osculating-circle.ts +7 -5
  291. package/src/point-on-shape/get-pos-corner.ts +2 -2
  292. package/src/reconstruct-from-mat/reconstruct-from-mat.ts +22 -111
  293. package/src/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.ts +4 -0
  294. package/src/sat/cull.ts +16 -20
  295. package/src/sat/get-sat-culls.ts +28 -23
  296. package/src/svg/get-shape-bounds.ts +2 -3
  297. package/src/sweep-line/sweep-line.ts +1 -1
  298. package/src/utils/get-beziers-from-tangents.ts +110 -0
  299. package/src/utils/map-map.ts +1 -1
  300. package/src/vertex/remove-vertex.ts +5 -3
  301. package/__tests__/cp-node/fs/get-distance-between.spec.ts +0 -7
  302. package/__tests__/cp-node/fs/get-terminating-on-circle.spec.ts +0 -24
  303. package/__tests__/cp-node/fs/is-single-3-prong.spec.ts +0 -17
  304. package/__tests__/cp-node/fs/iterate-all-on-loop.spec.ts +0 -17
  305. package/__tests__/cp-node/fs/traverse-all-forward.spec.ts +0 -14
  306. package/node/closest-boundary-point/cull-bezier-pieces-1.d.ts +0 -9
  307. package/node/closest-boundary-point/cull-bezier-pieces-1.js +0 -17
  308. package/node/closest-boundary-point/cull-bezier-pieces-1.js.map +0 -1
  309. package/node/closest-boundary-point/cull-by-loose-bounding-box.d.ts +0 -13
  310. package/node/closest-boundary-point/cull-by-loose-bounding-box.js +0 -27
  311. package/node/closest-boundary-point/cull-by-loose-bounding-box.js.map +0 -1
  312. package/node/closest-boundary-point/cull-by-tight-boundary-box.d.ts +0 -11
  313. package/node/closest-boundary-point/cull-by-tight-boundary-box.js +0 -27
  314. package/node/closest-boundary-point/cull-by-tight-boundary-box.js.map +0 -1
  315. package/node/cp-node/fs/find-first.d.ts +0 -10
  316. package/node/cp-node/fs/find-first.js +0 -19
  317. package/node/cp-node/fs/find-first.js.map +0 -1
  318. package/node/debug/functions/check-ordering.d.ts +0 -4
  319. package/node/debug/functions/check-ordering.js +0 -43
  320. package/node/debug/functions/check-ordering.js.map +0 -1
  321. package/node/find-2-prong/cull-bezier-pieces.d.ts +0 -13
  322. package/node/find-2-prong/cull-bezier-pieces.js +0 -43
  323. package/node/find-2-prong/cull-bezier-pieces.js.map +0 -1
  324. package/node/floyd-warshall/get-hole-closer-pairs.d.ts +0 -8
  325. package/node/floyd-warshall/get-hole-closer-pairs.js +0 -27
  326. package/node/floyd-warshall/get-hole-closer-pairs.js.map +0 -1
  327. package/node/utils/dual-set.d.ts +0 -27
  328. package/node/utils/dual-set.js +0 -55
  329. package/node/utils/dual-set.js.map +0 -1
  330. package/node/utils/tri-map.d.ts +0 -27
  331. package/node/utils/tri-map.js +0 -49
  332. package/node/utils/tri-map.js.map +0 -1
  333. package/src/closest-boundary-point/cull-bezier-pieces-1.ts +0 -36
  334. package/src/closest-boundary-point/cull-by-loose-bounding-box.ts +0 -42
  335. package/src/closest-boundary-point/cull-by-tight-boundary-box.ts +0 -43
  336. package/src/closest-boundary-point/get-p-from-box.ts +0 -14
  337. package/src/cp-node/fs/add-distance-from.ts +0 -49
  338. package/src/cp-node/fs/get-distance-between.ts +0 -16
  339. package/src/cp-node/fs/get-terminating-on-circle.ts +0 -24
  340. package/src/cp-node/fs/is-single-3-prong.ts +0 -15
  341. package/src/cp-node/fs/iterate-all-on-loop.ts +0 -15
  342. package/src/cp-node/fs/traverse-all-forward.ts +0 -24
  343. package/src/debug/functions/draw/draw-beziers-as-single-path.ts +0 -40
  344. package/src/debug/functions/draw/draw-disk.ts +0 -34
  345. package/src/debug/functions/draw/xmlns.ts +0 -5
  346. package/src/find-2-prong/cull-bezier-pieces.ts +0 -61
  347. package/src/find-2-prong/find-and-add-2-prong.ts +0 -30
  348. package/src/find-2-prong/get-medial/get-closest-points-d.ts +0 -213
  349. package/src/find-2-prong/x-for-debugging.ts +0 -13
  350. package/src/floyd-warshall/get-hole-closer-pairs.ts +0 -35
  351. package/src/mat/get-two-prong-type.ts +0 -13
  352. package/src/point-on-shape/is-pos-dull-corner.ts +0 -18
  353. package/src/point-on-shape/is-pos-quite-dull-corner.ts +0 -18
  354. package/src/point-on-shape/is-pos-quite-sharp-corner.ts +0 -18
  355. package/src/point-on-shape/pos-to-human-string.ts +0 -18
  356. package/src/sweep-line/are-boxes-intersecting.ts +0 -37
@@ -1,43 +0,0 @@
1
- import { getClosestSquareDistanceToRect } from '../geometry/get-closest-square-distance-to-rect.js';
2
- import { getBoundingBox$ } from '../geometry/get-bounding-box-.js';
3
- import { memoize } from 'flo-memoize';
4
- import { getBoundingBoxTight } from 'flo-bezier3';
5
- import { getClosestSquaredDistanceToRotatedRect } from '../geometry/get-closest-squared-distance-to-rotated-rect.js';
6
- const TOLERANCE = 1 + 2 ** -20;
7
- const getBoundingBoxTight$ = memoize(getBoundingBoxTight);
8
- /**
9
- * Cull all `curvePieces` not within the given radius of a given point.
10
- *
11
- * @param extreme
12
- * @param curvePieces
13
- * @param xO
14
- * @param xy2
15
- *
16
- * @internal
17
- */
18
- function cullCurvePieces(curvePieces, xO, xy2) {
19
- if (curvePieces.length <= 2) {
20
- // Curve pieces can never be less than 2 at this stage since a curve
21
- // endpoint will be shared between 2 curves
22
- return curvePieces;
23
- }
24
- let lastIdx = 0;
25
- for (let i = 0; i < curvePieces.length; i++) {
26
- const curvePiece = curvePieces[i];
27
- const { ps } = curvePiece.curve;
28
- const rect = getBoundingBox$(ps);
29
- const d = getClosestSquareDistanceToRect(rect, xO);
30
- if (d <= TOLERANCE * xy2) {
31
- const tightBoundingBox = getBoundingBoxTight$(ps);
32
- const d2 = getClosestSquaredDistanceToRotatedRect(tightBoundingBox, xO);
33
- if (d2 <= TOLERANCE * xy2) {
34
- curvePieces[lastIdx] = curvePiece;
35
- lastIdx++;
36
- }
37
- }
38
- }
39
- curvePieces.length = lastIdx;
40
- return curvePieces;
41
- }
42
- export { cullCurvePieces };
43
- //# sourceMappingURL=cull-bezier-pieces.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cull-bezier-pieces.js","sourceRoot":"","sources":["../../src/find-2-prong/cull-bezier-pieces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AACpG,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,sCAAsC,EAAE,MAAM,6DAA6D,CAAC;AAGrH,MAAM,SAAS,GAAG,CAAC,GAAG,CAAC,IAAE,CAAC,EAAE,CAAC;AAC7B,MAAM,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAG1D;;;;;;;;;GASG;AACH,SAAS,eAAe,CAChB,WAAyB,EACzB,EAAY,EACZ,GAAW;IAEf,IAAI,WAAW,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QAC1B,oEAAoE;QACpE,2CAA2C;QAC3C,OAAO,WAA2B,CAAC;IACvC,CAAC;IAED,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,EAAE,EAAE,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC;QAEhC,MAAM,IAAI,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC;QACjC,MAAM,CAAC,GAAG,8BAA8B,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,SAAS,GAAC,GAAG,EAAE,CAAC;YACrB,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,EAAE,CAAC,CAAC;YAClD,MAAM,EAAE,GAAG,sCAAsC,CAC7C,gBAAgB,EAChB,EAAE,CACL,CAAC;YAEF,IAAI,EAAE,IAAI,SAAS,GAAC,GAAG,EAAE,CAAC;gBACtB,WAAW,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC;gBAClC,OAAO,EAAE,CAAC;YACd,CAAC;QACL,CAAC;IACL,CAAC;IAED,WAAW,CAAC,MAAM,GAAG,OAAO,CAAC;IAE7B,OAAO,WAAW,CAAC;AACvB,CAAC;AAGD,OAAO,EAAE,eAAe,EAAE,CAAA"}
@@ -1,8 +0,0 @@
1
- import type { CpNode } from "../cp-node/cp-node.js";
2
- /**
3
- *
4
- * @param holeClosers
5
- * @returns
6
- */
7
- declare function getHoleCloserPairs(holeClosers: CpNode[]): Map<CpNode, CpNode>;
8
- export { getHoleCloserPairs };
@@ -1,27 +0,0 @@
1
- /**
2
- *
3
- * @param holeClosers
4
- * @returns
5
- */
6
- // FUTURE - this function is currently O(n^2) but could be made O(n).
7
- // FUTURE - only `pointOnShape.p` is checked but `pointOnShape.t` should also be checked
8
- // or better yet, `CpNode.cp.order` and `CpNode.cp.order2`, etc.
9
- function getHoleCloserPairs(holeClosers) {
10
- const pairs = new Map();
11
- for (let hcA of holeClosers) {
12
- for (let hcB of holeClosers) {
13
- const cA = hcA.pointOnShape.circle.center;
14
- const cB = hcB.pointOnShape.circle.center;
15
- const cpA = hcA.pointOnShape.p;
16
- const cpB = hcB.pointOnShape.p;
17
- if (hcB !== hcA &&
18
- cA[0] === cB[0] && cA[1] === cB[1] &&
19
- cpA[0] === cpB[0] && cpA[1] === cpB[1]) {
20
- pairs.set(hcA, hcB);
21
- }
22
- }
23
- }
24
- return pairs;
25
- }
26
- export { getHoleCloserPairs };
27
- //# sourceMappingURL=get-hole-closer-pairs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-hole-closer-pairs.js","sourceRoot":"","sources":["../../src/floyd-warshall/get-hole-closer-pairs.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,qEAAqE;AACrE,wFAAwF;AACxF,gEAAgE;AAChE,SAAS,kBAAkB,CACnB,WAAqB;IAEzB,MAAM,KAAK,GAAuB,IAAI,GAAG,EAAE,CAAC;IAC5C,KAAK,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;QAC1B,KAAK,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;YAC1B,MAAM,EAAE,GAAG,GAAG,CAAC,YAAa,CAAC,MAAO,CAAC,MAAM,CAAC;YAC5C,MAAM,EAAE,GAAG,GAAG,CAAC,YAAa,CAAC,MAAO,CAAC,MAAM,CAAC;YAC5C,MAAM,GAAG,GAAG,GAAG,CAAC,YAAa,CAAC,CAAC,CAAC;YAChC,MAAM,GAAG,GAAG,GAAG,CAAC,YAAa,CAAC,CAAC,CAAC;YAChC,IAAI,GAAG,KAAK,GAAG;gBACX,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;gBAClC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBAEzC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAC,GAAG,CAAC,CAAC;YACvB,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAGD,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
@@ -1,27 +0,0 @@
1
- /**
2
- * A 'dual-set' in the sense that it needs two ordered keys.
3
- */
4
- type DualSet<K, L> = Map<K, Set<L>>;
5
- /**
6
- * Get a value from the dual-set.
7
- * @param set
8
- * @param k
9
- */
10
- declare function has<K, L>(set: DualSet<K, L>, k: K, l: L): boolean;
11
- /**
12
- * Adds a value to the dual-set.
13
- *
14
- * * destructively sets the value
15
- *
16
- * @param set
17
- * @param k
18
- * @param l
19
- */
20
- declare function add<K, L>(set: DualSet<K, L>, k: K, l: L): void;
21
- declare function remove<K, L>(set: DualSet<K, L>, k: K, l: L): boolean;
22
- declare const DualSetFs: {
23
- has: typeof has;
24
- add: typeof add;
25
- remove: typeof remove;
26
- };
27
- export { DualSet, DualSetFs };
@@ -1,55 +0,0 @@
1
- /**
2
- * Get a value from the dual-set.
3
- * @param set
4
- * @param k
5
- */
6
- function has(set, k, l) {
7
- const lSet = set.get(k);
8
- if (lSet === undefined) {
9
- return false;
10
- }
11
- return lSet.has(l);
12
- }
13
- /**
14
- * Adds a value to the dual-set.
15
- *
16
- * * destructively sets the value
17
- *
18
- * @param set
19
- * @param k
20
- * @param l
21
- */
22
- function add(set, k, l) {
23
- let lSet = set.get(k);
24
- if (lSet === undefined) {
25
- lSet = new Set();
26
- set.set(k, lSet);
27
- }
28
- lSet.add(l);
29
- }
30
- function remove(set, k, l) {
31
- let lSet = set.get(k);
32
- if (lSet === undefined) {
33
- return false;
34
- }
35
- const r = lSet.delete(l);
36
- if (!r) {
37
- return false;
38
- }
39
- if (lSet.size === 0) {
40
- set.delete(k);
41
- }
42
- return true;
43
- }
44
- const DualSetFs = { has, add, remove };
45
- export { DualSetFs };
46
- // TESTING
47
- // const s: DualSet<number,number> = new Map();
48
- // add(s,1,2);
49
- // has(s,1,2);//?
50
- // has(s,2,1);//?
51
- // has(s,1,1);//?
52
- // add(s,1,1);
53
- // has(s,1,1);//?
54
- // has(s,1,2);//?
55
- //# sourceMappingURL=dual-set.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dual-set.js","sourceRoot":"","sources":["../../src/utils/dual-set.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,SAAS,GAAG,CACJ,GAAiB,EACjB,CAAI,EACJ,CAAI;IAER,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAAC,OAAO,KAAK,CAAC;IAAC,CAAC;IAEzC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC;AAGD;;;;;;;;GAQG;AACH,SAAS,GAAG,CACJ,GAAiB,EACjB,CAAI,EACJ,CAAI;IAER,IAAI,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACrB,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;QACjB,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACrB,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAChB,CAAC;AAGD,SAAS,MAAM,CACP,GAAiB,EACjB,CAAI,EACJ,CAAI;IAER,IAAI,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACzB,IAAI,CAAC,CAAC,EAAE,CAAC;QAAC,OAAO,KAAK,CAAC;IAAC,CAAC;IAEzB,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QAClB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAGD,MAAM,SAAS,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;AAGvC,OAAO,EAAW,SAAS,EAAE,CAAA;AAG7B,UAAU;AACV,+CAA+C;AAC/C,cAAc;AACd,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,cAAc;AACd,iBAAiB;AACjB,iBAAiB"}
@@ -1,27 +0,0 @@
1
- /**
2
- * A 'tri-map' in the sense that it needs two ordered keys to return one
3
- * value.
4
- */
5
- type TriMap<K, L, M, V> = Map<K, Map<L, Map<M, V>>>;
6
- /**
7
- * Get a value from the tri-map.
8
- * @param map
9
- * @param k
10
- * @param l
11
- * @param m
12
- */
13
- declare function get<K, L, M, V>(map: TriMap<K, L, M, V>, k: K, l: L, m: M): V | undefined;
14
- /**
15
- * Set a value in the tri-map.
16
- * * destructively sets the value
17
- * @param map
18
- * @param k
19
- * @param l
20
- * @param v
21
- */
22
- declare function set<K, L, M, V>(map: TriMap<K, L, M, V>, k: K, l: L, m: M, v: V): void;
23
- declare const TriMapFs: {
24
- get: typeof get;
25
- set: typeof set;
26
- };
27
- export { TriMap, TriMapFs };
@@ -1,49 +0,0 @@
1
- /**
2
- * Get a value from the tri-map.
3
- * @param map
4
- * @param k
5
- * @param l
6
- * @param m
7
- */
8
- function get(map, k, l, m) {
9
- const lMap = map.get(k);
10
- if (lMap === undefined) {
11
- return undefined;
12
- }
13
- const mMap = lMap.get(l);
14
- if (mMap === undefined) {
15
- return undefined;
16
- }
17
- return mMap.get(m);
18
- }
19
- /**
20
- * Set a value in the tri-map.
21
- * * destructively sets the value
22
- * @param map
23
- * @param k
24
- * @param l
25
- * @param v
26
- */
27
- function set(map, k, l, m, v) {
28
- let lMap = map.get(k);
29
- if (lMap === undefined) {
30
- lMap = new Map();
31
- map.set(k, lMap);
32
- }
33
- let mMap = lMap.get(l);
34
- if (mMap === undefined) {
35
- mMap = new Map();
36
- lMap.set(l, mMap);
37
- }
38
- mMap.set(m, v);
39
- }
40
- const TriMapFs = {
41
- get, set
42
- };
43
- export { TriMapFs };
44
- // Test
45
- // const triMap = new Map<number,Map<number,Map<number,number>>>();
46
- // set(triMap, 1,2,3, 4);
47
- // set(triMap, 4,3,2, 1);
48
- // get(triMap, 4,2,3); //?
49
- //# sourceMappingURL=tri-map.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tri-map.js","sourceRoot":"","sources":["../../src/utils/tri-map.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,SAAS,GAAG,CACJ,GAAoB,EACpB,CAAI,EACJ,CAAI,EACJ,CAAI;IAER,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAAC,OAAO,SAAS,CAAC;IAAC,CAAC;IAE7C,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACzB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAAC,OAAO,SAAS,CAAC;IAAC,CAAC;IAE7C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC;AAGD;;;;;;;GAOG;AACH,SAAS,GAAG,CACJ,GAAoB,EACpB,CAAI,EACJ,CAAI,EACJ,CAAI,EACJ,CAAI;IAER,IAAI,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACrB,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;QACjB,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACrB,CAAC;IAED,IAAI,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACvB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACrB,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACnB,CAAC;AAGD,MAAM,QAAQ,GAAG;IACb,GAAG,EAAE,GAAG;CACX,CAAA;AAGD,OAAO,EAAU,QAAQ,EAAE,CAAA;AAG3B,OAAO;AACP,mEAAmE;AACnE,yBAAyB;AACzB,yBAAyB;AACzB,0BAA0B"}
@@ -1,36 +0,0 @@
1
- import type { CurvePiece } from '../mat/curve-piece.js';
2
- import { getBestDistanceSquared } from './get-best-distance-squared.js';
3
- import { cullByLooseBoundingBox } from './cull-by-loose-bounding-box.js';
4
- import { cullByTightBoundingBox } from './cull-by-tight-boundary-box.js';
5
-
6
-
7
- /**
8
- * @param curvePieces
9
- * @param xO
10
- *
11
- * @internal
12
- */
13
- function cullCurvePieces1(
14
- curvePieces: CurvePiece[],
15
- xO: number[]) {
16
-
17
- const bestSquaredDistance = getBestDistanceSquared(
18
- curvePieces, xO
19
- );
20
-
21
- curvePieces = cullByLooseBoundingBox(
22
- curvePieces, xO,
23
- bestSquaredDistance
24
- );
25
-
26
- curvePieces = cullByTightBoundingBox(
27
- curvePieces, xO,
28
- bestSquaredDistance
29
- );
30
-
31
-
32
- return curvePieces;
33
- }
34
-
35
-
36
- export { cullCurvePieces1 }
@@ -1,42 +0,0 @@
1
- import type { CurvePiece } from '../mat/curve-piece.js';
2
- import { getClosestSquareDistanceToRect } from '../geometry/get-closest-square-distance-to-rect.js';
3
- import { getBoundingBox$ } from '../geometry/get-bounding-box-.js';
4
-
5
-
6
- /**
7
- * When checking distances, ignore all those with closest possible distance
8
- * further than 'bestSquaredDistance', i.e. cull them.
9
- *
10
- * @param curvePieces
11
- * @param xO
12
- * @param xy2
13
- *
14
- * @internal
15
- */
16
- function cullByLooseBoundingBox(
17
- curvePieces: CurvePiece[],
18
- xO: number[],
19
- xy2: number) {
20
-
21
- const curvePieces_ = [];
22
-
23
- for (let i=0; i<curvePieces.length; i++) {
24
- const curvePiece = curvePieces[i];
25
- const { ps } = curvePiece.curve;
26
-
27
- const boundingBox = getBoundingBox$(ps);
28
-
29
- const d = getClosestSquareDistanceToRect(
30
- boundingBox,
31
- xO
32
- );
33
- if (d <= xy2) {
34
- curvePieces_.push(curvePiece);
35
- }
36
- }
37
-
38
- return curvePieces_;
39
- }
40
-
41
-
42
- export { cullByLooseBoundingBox }
@@ -1,43 +0,0 @@
1
- import { getBoundingBoxTight } from "flo-bezier3";
2
- import { memoize } from "flo-memoize";
3
- import { CurvePiece } from "../mat/curve-piece.js";
4
- import { getClosestSquaredDistanceToRotatedRect } from '../geometry/get-closest-squared-distance-to-rotated-rect.js';
5
-
6
-
7
- const getBoundingBoxTight$ = memoize(getBoundingBoxTight);
8
-
9
-
10
- /**
11
- * @internal
12
- * When checking distances, ignore all those with closest possible distance
13
- * further than 'bestSquaredDistance', i.e. cull them.
14
- * @param curvePieces
15
- * @param p
16
- * @param bestSquaredDistance
17
- */
18
- function cullByTightBoundingBox(
19
- curvePieces: CurvePiece[],
20
- p: number[],
21
- bestSquaredDistance: number) {
22
-
23
- const candidateCurvePieces = [];
24
-
25
- for (let i=0; i<curvePieces.length; i++) {
26
- const curvePiece = curvePieces[i];
27
- const ps = curvePiece.curve.ps;
28
-
29
- const tightBoundingBox = getBoundingBoxTight$(ps);
30
- const d = getClosestSquaredDistanceToRotatedRect(
31
- tightBoundingBox,
32
- p
33
- );
34
- if (d <= bestSquaredDistance) {
35
- candidateCurvePieces.push(curvePiece);
36
- }
37
- }
38
-
39
- return candidateCurvePieces;
40
- }
41
-
42
-
43
- export { cullByTightBoundingBox }
@@ -1,14 +0,0 @@
1
-
2
- /** @internal */
3
- function getPFromBox(box: number[][]) {
4
- const tl = box[0];
5
- const br = box[1];
6
-
7
- return [
8
- (tl[0] + br[0])/2,
9
- (tl[1] + br[1])/2,
10
- ];
11
- }
12
-
13
-
14
- export { getPFromBox }
@@ -1,49 +0,0 @@
1
- //------------------------------
2
- // KEEP FOR POSSIBLE FUTURE USE
3
- //------------------------------
4
-
5
- // import { getTAtLength, length } from "flo-bezier3";
6
- // import { CpNode } from "../cp-node.js";
7
-
8
-
9
- // function addDistanceFrom(
10
- // d: number,
11
- // cpNode: CpNode) {
12
-
13
- // const posS = cpNode.cp.pointOnShape;
14
- // const curveS = posS.curve;
15
-
16
- // let tS = posS.t;
17
- // let cumL = 0;
18
- // let dist = 0;
19
- // let curve = curveS;
20
- // let ps;
21
- // let dLeft = d;
22
- // while (true) {
23
- // ps = curve.ps;
24
- // dist = length([tS,1], ps);
25
- // cumL += dist;
26
-
27
- // if (cumL < d) {
28
- // tS = 0;
29
- // dLeft -= dist;
30
- // curve = curve.next;
31
- // } else {
32
- // break;
33
- // }
34
- // }
35
-
36
- // // const overshoot = cumL - d;
37
- // const lL = length([0,tS], curve.ps);
38
- // const l = lL + dLeft;
39
-
40
- // const t = getTAtLength(curve.ps, l);
41
-
42
- // const posE: PrePointOnShape = { curve, t ;
43
-
44
- // return posE;
45
- // }
46
-
47
-
48
-
49
- // export { addDistanceFrom }
@@ -1,16 +0,0 @@
1
- import { CpNode } from "../cp-node.js";
2
- import { getMatDistanceToNext$ } from "./get-distance-to-next.js";
3
-
4
-
5
- // const dMap = new WeakMap<CpNode>
6
-
7
- function getDistanceBetween(
8
- a: CpNode,
9
- b: CpNode) {
10
-
11
- const d = getMatDistanceToNext$(a);
12
-
13
- }
14
-
15
-
16
- export { getDistanceBetween }
@@ -1,24 +0,0 @@
1
- import { CpNode } from "../cp-node.js";
2
- import { isTerminating } from "./is-terminating.js";
3
-
4
-
5
- function getTerminatingOnCircle(
6
- cpNode: CpNode,
7
- exclThis = false) {
8
-
9
- const startCpNode = cpNode;
10
- let cpNode_ = startCpNode;
11
-
12
- const cpNodes: CpNode[] = [];
13
- do {
14
- if (!(exclThis && cpNode_ === startCpNode) && isTerminating(cpNode_)) {
15
- cpNodes.push(cpNode_);
16
- }
17
- cpNode_ = cpNode_.nextOnCircle;
18
- } while (cpNode_ !== startCpNode)
19
-
20
- return cpNodes;
21
- }
22
-
23
-
24
- export { getTerminatingOnCircle }
@@ -1,15 +0,0 @@
1
- import { CpNode } from "../cp-node.js";
2
-
3
-
4
- function isSingle3Prong(
5
- cpNode: CpNode) {
6
-
7
- return (
8
- cpNode.next === cpNode.nextOnCircle &&
9
- cpNode.next.next === cpNode.next.nextOnCircle &&
10
- cpNode.prev.next === cpNode.prev.nextOnCircle
11
- );
12
- }
13
-
14
-
15
- export { isSingle3Prong }
@@ -1,15 +0,0 @@
1
- import { CpNode } from "../cp-node.js";
2
-
3
-
4
- function* iterateAllOnLoop(cpNode: CpNode) {
5
- yield cpNode;
6
-
7
- let cpNode_ = cpNode.next;
8
- while (cpNode_ !== cpNode) {
9
- yield cpNode_;
10
- cpNode_ = cpNode_.next;
11
- }
12
- }
13
-
14
-
15
- export { iterateAllOnLoop }
@@ -1,24 +0,0 @@
1
- import { CpNode } from '../cp-node.js';
2
- import { isTerminating } from './is-terminating.js';
3
- import { getChildren } from './get-children.js';
4
-
5
-
6
- function traverseAllForward(
7
- cpNode: CpNode,
8
- traverseEdgesCallback: (cpNode: CpNode) => void) {
9
-
10
- // Since the tree is unrooted we must iterate in all directions from the
11
- // given vertex.
12
- const cps = [cpNode];
13
-
14
- while (cps.length) {
15
- const cp = cps.pop()!;
16
- traverseEdgesCallback(cp);
17
-
18
- if (isTerminating(cp)) { continue; }
19
- cps.push(...getChildren(cp));
20
- }
21
- }
22
-
23
-
24
- export { traverseAllForward }
@@ -1,40 +0,0 @@
1
- import { XMLNS } from "./xmlns.js";
2
-
3
-
4
- function drawBeziersAsSinglePath(
5
- g: SVGGElement,
6
- beziers: number[][][],
7
- class_ = 'thin10 red nofill',
8
- delay = 0) {
9
-
10
- if (beziers.length === 0) { return []; }
11
-
12
- const x0 = beziers[0][0][0];
13
- const y0 = beziers[0][0][1];
14
- let d = `M${x0} ${y0} `;
15
-
16
- for (let i=0; i<beziers.length; i++) {
17
- const ps = beziers[i];
18
-
19
- if (ps.length <= 1) { continue; }
20
-
21
- const [,p1,p2,p3] = ps;
22
- d +=
23
- ps.length === 2
24
- ? `L ${p1[0]} ${p1[1]} `
25
- : ps.length === 3
26
- ? `Q ${p1[0]} ${p1[1]} ${p2[0]} ${p2[1]} `
27
- : `C ${p1[0]} ${p1[1]} ${p2[0]} ${p2[1]} ${p3[0]} ${p3[1]} `
28
- }
29
-
30
- // d += ' z';
31
- const $path = document.createElementNS(XMLNS, 'path');
32
- $path.setAttributeNS(null, "d", d);
33
- $path.setAttributeNS(null, "class", class_);
34
- g.appendChild($path);
35
-
36
- return [$path];
37
- }
38
-
39
-
40
- export { drawBeziersAsSinglePath }
@@ -1,34 +0,0 @@
1
- import { XMLNS } from "./xmlns.js";
2
-
3
-
4
- /**
5
- * Draws a circle
6
- * @param g An SVG group element wherein to draw the circle.
7
- * @param circle
8
- * @param classes
9
- * @param delay
10
- */
11
- function drawDisk(
12
- g: SVGGElement,
13
- circle: { radius: number, center: number[] },
14
- color = 'black',
15
- delay?: number) {
16
-
17
- const c = circle.center;
18
- const r = circle.radius;
19
-
20
- const $disk = document.createElementNS(XMLNS, 'circle');
21
- $disk.setAttributeNS(null, "cx", c[0].toString());
22
- $disk.setAttributeNS(null, "cy", c[1].toString());
23
- $disk.setAttributeNS(null, "r", r.toString());
24
- $disk.setAttributeNS(null, "fill", color);
25
-
26
- g.appendChild($disk);
27
-
28
- if (delay) { setTimeout(() => $disk.remove(), delay); }
29
-
30
- return [$disk];
31
- }
32
-
33
-
34
- export { drawDisk }
@@ -1,5 +0,0 @@
1
-
2
- const XMLNS = 'http://www.w3.org/2000/svg';
3
-
4
-
5
- export { XMLNS }