flo-mat 4.0.3 → 4.1.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 (313) hide show
  1. package/__tests__/find-2-prong/get-medial/dd-get-medial-point-coeffs-same-curve.spec.ts +106 -0
  2. package/__tests__/find-2-prong/get-medial/dd-get-medial-point-coeffs.spec.ts +73 -0
  3. package/__tests__/find-2-prong/get-medial/get-closest-points.spec.ts +5 -2
  4. package/__tests__/helpers/close-to.ts +5 -5
  5. package/__tests__/specific-cases/load-svg/load-svg.ts +30 -0
  6. package/__tests__/specific-cases/specific-cases.spec.ts +168 -4
  7. package/__tests__/specific-cases/test-svgs/achispado.svg +5052 -0
  8. package/browser/index.js +1686 -2738
  9. package/browser/index.min.js +1 -1
  10. package/{jest.config.cjs → jest.config.ts} +8 -3
  11. package/node/closest-boundary-point/get-close-boundary-points-certified.js +3 -2
  12. package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -1
  13. package/node/corner/get-corner.js +1 -1
  14. package/node/corner/get-corner.js.map +1 -1
  15. package/node/{reconstruct-from-mat → cp-node/fs}/get-all-on-loop-by-loop.d.ts +6 -2
  16. package/node/{reconstruct-from-mat → cp-node/fs}/get-all-on-loop-by-loop.js +5 -1
  17. package/node/cp-node/fs/get-all-on-loop-by-loop.js.map +1 -0
  18. package/node/cp-node/fs/get-boundary-beziers-to-next.d.ts +1 -0
  19. package/node/cp-node/fs/get-boundary-beziers-to-next.js +1 -59
  20. package/node/cp-node/fs/get-boundary-beziers-to-next.js.map +1 -1
  21. package/node/cp-node/fs/get-edge-direction.d.ts +3 -1
  22. package/node/cp-node/fs/get-edge-direction.js +5 -3
  23. package/node/cp-node/fs/get-edge-direction.js.map +1 -1
  24. package/node/cp-node/fs/get-mat-curve-between.js +6 -6
  25. package/node/cp-node/fs/get-mat-curve-between.js.map +1 -1
  26. package/node/cp-node/fs/is-fully-terminating.js +12 -0
  27. package/node/cp-node/fs/is-fully-terminating.js.map +1 -1
  28. package/node/debug/debug.d.ts +4 -13
  29. package/node/debug/debug.js +3 -30
  30. package/node/debug/debug.js.map +1 -1
  31. package/node/find-2-prong/find-2-prong.js +24 -10
  32. package/node/find-2-prong/find-2-prong.js.map +1 -1
  33. package/node/find-2-prong/get-medial/get-antipodal-points.d.ts +1 -1
  34. package/node/find-2-prong/get-medial/get-antipodal-points.js +2 -2
  35. package/node/find-2-prong/get-medial/get-antipodal-points.js.map +1 -1
  36. package/node/find-2-prong/get-medial/get-closest-points.d.ts +7 -1
  37. package/node/find-2-prong/get-medial/get-closest-points.js +60 -14
  38. package/node/find-2-prong/get-medial/get-closest-points.js.map +1 -1
  39. package/node/find-2-prong/reduce-radius.d.ts +3 -1
  40. package/node/find-2-prong/reduce-radius.js +8 -6
  41. package/node/find-2-prong/reduce-radius.js.map +1 -1
  42. package/node/find-3-prong/calc-better-x.js +1 -3
  43. package/node/find-3-prong/calc-better-x.js.map +1 -1
  44. package/node/find-3-prong/calc-initial-3-prong-center.js +1 -2
  45. package/node/find-3-prong/calc-initial-3-prong-center.js.map +1 -1
  46. package/node/find-3-prong/find-3-prong-for-delta3s.js +1 -4
  47. package/node/find-3-prong/find-3-prong-for-delta3s.js.map +1 -1
  48. package/node/find-3-prong/find-3-prong.js.map +1 -1
  49. package/node/find-3-prong/find-and-add-3-prong.js +0 -14
  50. package/node/find-3-prong/find-and-add-3-prong.js.map +1 -1
  51. package/node/find-mat/find-mat.js +2 -1
  52. package/node/find-mat/find-mat.js.map +1 -1
  53. package/node/find-mat/find-mats.js.map +1 -1
  54. package/node/find-mat/get-dull-corners-on-loop.js +3 -2
  55. package/node/find-mat/get-dull-corners-on-loop.js.map +1 -1
  56. package/node/find-mat/get-for-1-prongs-on-loop.js +6 -3
  57. package/node/find-mat/get-for-1-prongs-on-loop.js.map +1 -1
  58. package/node/find-mat/get-for-2-prongs-on-loop.js +5 -1
  59. package/node/find-mat/get-for-2-prongs-on-loop.js.map +1 -1
  60. package/node/find-mat/get-meta.d.ts +4 -1
  61. package/node/find-mat/get-meta.js +9 -1
  62. package/node/find-mat/get-meta.js.map +1 -1
  63. package/node/find-mat/get-sharp-corners.js +4 -2
  64. package/node/find-mat/get-sharp-corners.js.map +1 -1
  65. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0.d.ts +21 -0
  66. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0.js +46 -0
  67. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0.js.map +1 -0
  68. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez1.d.ts +28 -0
  69. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez1.js +97 -0
  70. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez1.js.map +1 -0
  71. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2-same-curve.d.ts +28 -0
  72. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2-same-curve.js +109 -0
  73. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2-same-curve.js.map +1 -0
  74. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2.d.ts +29 -0
  75. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2.js +123 -0
  76. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2.js.map +1 -0
  77. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.d.ts +30 -0
  78. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.js +177 -0
  79. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.js.map +1 -0
  80. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.d.ts +29 -0
  81. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.js +156 -0
  82. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.js.map +1 -0
  83. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs.d.ts +28 -0
  84. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs.js +40 -0
  85. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs.js.map +1 -0
  86. package/node/index.d.ts +4 -10
  87. package/node/index.js +3 -6
  88. package/node/index.js.map +1 -1
  89. package/node/point-on-shape/point-on-shape.d.ts +2 -0
  90. package/node/point-on-shape/to-p.d.ts +1 -1
  91. package/node/point-on-shape/to-p.js +1 -1
  92. package/node/point-on-shape/to-p.js.map +1 -1
  93. package/node/reconstruct-from-mat/get-cp-nodess-for-sat.js +2 -2
  94. package/node/reconstruct-from-mat/get-cp-nodess-for-sat.js.map +1 -1
  95. package/node/reconstruct-from-mat/reconstruct-from-mat.d.ts +8 -2
  96. package/node/reconstruct-from-mat/reconstruct-from-mat.js +154 -22
  97. package/node/reconstruct-from-mat/reconstruct-from-mat.js.map +1 -1
  98. package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js +1 -1
  99. package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js.map +1 -1
  100. package/node/svg/get-loop-bounds.js +6 -2
  101. package/node/svg/get-loop-bounds.js.map +1 -1
  102. package/node/utils/map-deep.d.ts +15 -0
  103. package/node/utils/map-deep.js +34 -0
  104. package/node/utils/map-deep.js.map +1 -0
  105. package/package.json +14 -8
  106. package/src/closest-boundary-point/get-close-boundary-points-certified.ts +3 -2
  107. package/src/corner/get-corner.ts +1 -1
  108. package/src/{reconstruct-from-mat → cp-node/fs}/get-all-on-loop-by-loop.ts +7 -3
  109. package/src/cp-node/fs/get-all-on-loop.ts +1 -1
  110. package/src/cp-node/fs/get-boundary-beziers-to-next.ts +1 -72
  111. package/src/cp-node/fs/get-edge-direction.ts +8 -4
  112. package/src/cp-node/fs/get-mat-curve-between.ts +6 -6
  113. package/src/cp-node/fs/is-fully-terminating.ts +16 -0
  114. package/src/debug/debug.ts +8 -50
  115. package/src/find-2-prong/find-2-prong.ts +37 -14
  116. package/src/find-2-prong/get-medial/get-antipodal-points.ts +3 -2
  117. package/src/find-2-prong/get-medial/get-closest-points-d.ts +213 -0
  118. package/src/find-2-prong/get-medial/get-closest-points.ts +74 -13
  119. package/src/find-2-prong/reduce-radius.ts +8 -5
  120. package/src/find-3-prong/calc-better-x.ts +1 -3
  121. package/src/find-3-prong/calc-initial-3-prong-center.ts +1 -2
  122. package/src/find-3-prong/find-3-prong-for-delta3s.ts +1 -4
  123. package/src/find-3-prong/find-3-prong.ts +0 -1
  124. package/src/find-3-prong/find-and-add-3-prong.ts +1 -15
  125. package/src/find-mat/find-mat.ts +3 -1
  126. package/src/find-mat/find-mats.ts +0 -1
  127. package/src/find-mat/get-dull-corners-on-loop.ts +4 -3
  128. package/src/find-mat/get-for-1-prongs-on-loop.ts +8 -3
  129. package/src/find-mat/get-for-2-prongs-on-loop.ts +6 -1
  130. package/src/find-mat/get-meta.ts +11 -0
  131. package/src/find-mat/get-sharp-corners.ts +5 -1
  132. package/src/get-medial-curve/__pycache__/get-cubic-self-medial-curve.cpython-313.pyc +0 -0
  133. package/src/get-medial-curve/get-cubic-self-medial-curve.py +419 -0
  134. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0-with-running-err.ts +76 -0
  135. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0.ts +61 -0
  136. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez1.ts +116 -0
  137. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2-same-curve.ts +129 -0
  138. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2.ts +142 -0
  139. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.ts +199 -0
  140. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.ts +177 -0
  141. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs.ts +48 -0
  142. package/src/get-medial-points/double-double/error-bound-calc.txt +72 -0
  143. package/src/index.ts +4 -10
  144. package/src/point-on-shape/point-on-shape.ts +3 -0
  145. package/src/point-on-shape/to-p.ts +2 -2
  146. package/src/reconstruct-from-mat/get-cp-nodess-for-sat.ts +2 -2
  147. package/src/reconstruct-from-mat/reconstruct-from-mat.ts +202 -21
  148. package/src/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.ts +1 -1
  149. package/src/svg/get-loop-bounds.ts +11 -3
  150. package/src/utils/map-deep.ts +75 -0
  151. package/src/utils/map-map.ts +33 -0
  152. package/wallaby.mjs +4 -4
  153. package/node/debug/debug-elem-types.d.ts +0 -26
  154. package/node/debug/debug-elem-types.js +0 -22
  155. package/node/debug/debug-elem-types.js.map +0 -1
  156. package/node/debug/functions/draw/draw-beziers-as-single-path.d.ts +0 -2
  157. package/node/debug/functions/draw/draw-beziers-as-single-path.js +0 -30
  158. package/node/debug/functions/draw/draw-beziers-as-single-path.js.map +0 -1
  159. package/node/debug/functions/draw/xmlns.d.ts +0 -2
  160. package/node/debug/functions/draw/xmlns.js +0 -3
  161. package/node/debug/functions/draw/xmlns.js.map +0 -1
  162. package/node/debug/functions/draw-elem/bounding-hull.d.ts +0 -3
  163. package/node/debug/functions/draw-elem/bounding-hull.js +0 -8
  164. package/node/debug/functions/draw-elem/bounding-hull.js.map +0 -1
  165. package/node/debug/functions/draw-elem/draw-branch.d.ts +0 -4
  166. package/node/debug/functions/draw-elem/draw-branch.js +0 -26
  167. package/node/debug/functions/draw-elem/draw-branch.js.map +0 -1
  168. package/node/debug/functions/draw-elem/draw-circle-percent.d.ts +0 -3
  169. package/node/debug/functions/draw-elem/draw-circle-percent.js +0 -13
  170. package/node/debug/functions/draw-elem/draw-circle-percent.js.map +0 -1
  171. package/node/debug/functions/draw-elem/draw-cp-node.d.ts +0 -4
  172. package/node/debug/functions/draw-elem/draw-cp-node.js +0 -26
  173. package/node/debug/functions/draw-elem/draw-cp-node.js.map +0 -1
  174. package/node/debug/functions/draw-elem/draw-cull.d.ts +0 -3
  175. package/node/debug/functions/draw-elem/draw-cull.js +0 -9
  176. package/node/debug/functions/draw-elem/draw-cull.js.map +0 -1
  177. package/node/debug/functions/draw-elem/draw-dull-corner.d.ts +0 -4
  178. package/node/debug/functions/draw-elem/draw-dull-corner.js +0 -10
  179. package/node/debug/functions/draw-elem/draw-dull-corner.js.map +0 -1
  180. package/node/debug/functions/draw-elem/draw-elem.d.ts +0 -10
  181. package/node/debug/functions/draw-elem/draw-elem.js +0 -39
  182. package/node/debug/functions/draw-elem/draw-elem.js.map +0 -1
  183. package/node/debug/functions/draw-elem/draw-leaves.d.ts +0 -4
  184. package/node/debug/functions/draw-elem/draw-leaves.js +0 -34
  185. package/node/debug/functions/draw-elem/draw-leaves.js.map +0 -1
  186. package/node/debug/functions/draw-elem/draw-loop.d.ts +0 -4
  187. package/node/debug/functions/draw-elem/draw-loop.js +0 -11
  188. package/node/debug/functions/draw-elem/draw-loop.js.map +0 -1
  189. package/node/debug/functions/draw-elem/draw-loops.d.ts +0 -4
  190. package/node/debug/functions/draw-elem/draw-loops.js +0 -6
  191. package/node/debug/functions/draw-elem/draw-loops.js.map +0 -1
  192. package/node/debug/functions/draw-elem/draw-loose-bounding-box.d.ts +0 -3
  193. package/node/debug/functions/draw-elem/draw-loose-bounding-box.js +0 -10
  194. package/node/debug/functions/draw-elem/draw-loose-bounding-box.js.map +0 -1
  195. package/node/debug/functions/draw-elem/draw-mat.d.ts +0 -4
  196. package/node/debug/functions/draw-elem/draw-mat.js +0 -34
  197. package/node/debug/functions/draw-elem/draw-mat.js.map +0 -1
  198. package/node/debug/functions/draw-elem/draw-max-vertex.d.ts +0 -4
  199. package/node/debug/functions/draw-elem/draw-max-vertex.js +0 -9
  200. package/node/debug/functions/draw-elem/draw-max-vertex.js.map +0 -1
  201. package/node/debug/functions/draw-elem/draw-min-y.d.ts +0 -4
  202. package/node/debug/functions/draw-elem/draw-min-y.js +0 -10
  203. package/node/debug/functions/draw-elem/draw-min-y.js.map +0 -1
  204. package/node/debug/functions/draw-elem/draw-one-prong-at-dull-corner.d.ts +0 -4
  205. package/node/debug/functions/draw-elem/draw-one-prong-at-dull-corner.js +0 -22
  206. package/node/debug/functions/draw-elem/draw-one-prong-at-dull-corner.js.map +0 -1
  207. package/node/debug/functions/draw-elem/draw-one-prong.d.ts +0 -4
  208. package/node/debug/functions/draw-elem/draw-one-prong.js +0 -13
  209. package/node/debug/functions/draw-elem/draw-one-prong.js.map +0 -1
  210. package/node/debug/functions/draw-elem/draw-sharp-corner.d.ts +0 -4
  211. package/node/debug/functions/draw-elem/draw-sharp-corner.js +0 -10
  212. package/node/debug/functions/draw-elem/draw-sharp-corner.js.map +0 -1
  213. package/node/debug/functions/draw-elem/draw-three-prong.d.ts +0 -4
  214. package/node/debug/functions/draw-elem/draw-three-prong.js +0 -26
  215. package/node/debug/functions/draw-elem/draw-three-prong.js.map +0 -1
  216. package/node/debug/functions/draw-elem/draw-tight-bounding-box.d.ts +0 -3
  217. package/node/debug/functions/draw-elem/draw-tight-bounding-box.js +0 -8
  218. package/node/debug/functions/draw-elem/draw-tight-bounding-box.js.map +0 -1
  219. package/node/debug/functions/draw-elem/draw-two-prong.d.ts +0 -4
  220. package/node/debug/functions/draw-elem/draw-two-prong.js +0 -49
  221. package/node/debug/functions/draw-elem/draw-two-prong.js.map +0 -1
  222. package/node/debug/functions/draw-elem/draw-vertex.d.ts +0 -4
  223. package/node/debug/functions/draw-elem/draw-vertex.js +0 -13
  224. package/node/debug/functions/draw-elem/draw-vertex.js.map +0 -1
  225. package/node/find-3-prong/timed-cc.d.ts +0 -3
  226. package/node/find-3-prong/timed-cc.js +0 -5
  227. package/node/find-3-prong/timed-cc.js.map +0 -1
  228. package/node/reconstruct-from-mat/filter-zero-length.d.ts +0 -10
  229. package/node/reconstruct-from-mat/filter-zero-length.js +0 -14
  230. package/node/reconstruct-from-mat/filter-zero-length.js.map +0 -1
  231. package/node/reconstruct-from-mat/get-all-on-loop-by-loop.js.map +0 -1
  232. package/node/reconstruct-from-mat/get-bezier-piece-length.d.ts +0 -3
  233. package/node/reconstruct-from-mat/get-bezier-piece-length.js +0 -6
  234. package/node/reconstruct-from-mat/get-bezier-piece-length.js.map +0 -1
  235. package/node/reconstruct-from-mat/get-boundary.d.ts +0 -7
  236. package/node/reconstruct-from-mat/get-boundary.js +0 -18
  237. package/node/reconstruct-from-mat/get-boundary.js.map +0 -1
  238. package/node/reconstruct-from-mat/get-matching-beziers.d.ts +0 -10
  239. package/node/reconstruct-from-mat/get-matching-beziers.js +0 -29
  240. package/node/reconstruct-from-mat/get-matching-beziers.js.map +0 -1
  241. package/node/reconstruct-from-mat/get-mbss-by-loop-per-sat.d.ts +0 -6
  242. package/node/reconstruct-from-mat/get-mbss-by-loop-per-sat.js +0 -10
  243. package/node/reconstruct-from-mat/get-mbss-by-loop-per-sat.js.map +0 -1
  244. package/node/reconstruct-from-mat/get-mbss-by-loop-with-opp-arr.d.ts +0 -7
  245. package/node/reconstruct-from-mat/get-mbss-by-loop-with-opp-arr.js +0 -47
  246. package/node/reconstruct-from-mat/get-mbss-by-loop-with-opp-arr.js.map +0 -1
  247. package/node/reconstruct-from-mat/get-sats2.d.ts +0 -10
  248. package/node/reconstruct-from-mat/get-sats2.js +0 -16
  249. package/node/reconstruct-from-mat/get-sats2.js.map +0 -1
  250. package/node/reconstruct-from-mat/is-fully-terminating.d.ts +0 -3
  251. package/node/reconstruct-from-mat/is-fully-terminating.js +0 -19
  252. package/node/reconstruct-from-mat/is-fully-terminating.js.map +0 -1
  253. package/node/reconstruct-from-mat/matched-beziers.d.ts +0 -10
  254. package/node/reconstruct-from-mat/matched-beziers.js +0 -2
  255. package/node/reconstruct-from-mat/matched-beziers.js.map +0 -1
  256. package/node/reconstruct-from-mat/split-tri-path.d.ts +0 -5
  257. package/node/reconstruct-from-mat/split-tri-path.js +0 -209
  258. package/node/reconstruct-from-mat/split-tri-path.js.map +0 -1
  259. package/node/utils/clip.d.ts +0 -2
  260. package/node/utils/clip.js +0 -6
  261. package/node/utils/clip.js.map +0 -1
  262. package/node/utils/time-function-call.d.ts +0 -14
  263. package/node/utils/time-function-call.js +0 -32
  264. package/node/utils/time-function-call.js.map +0 -1
  265. package/src/debug/debug-elem-types.ts +0 -43
  266. package/src/debug/functions/draw-elem/bounding-hull.ts +0 -18
  267. package/src/debug/functions/draw-elem/culls.ts +0 -39
  268. package/src/debug/functions/draw-elem/draw-branch.ts +0 -37
  269. package/src/debug/functions/draw-elem/draw-circle-percent.ts +0 -23
  270. package/src/debug/functions/draw-elem/draw-cp-node.ts +0 -46
  271. package/src/debug/functions/draw-elem/draw-cull.ts +0 -21
  272. package/src/debug/functions/draw-elem/draw-dull-corner.ts +0 -21
  273. package/src/debug/functions/draw-elem/draw-elem.ts +0 -64
  274. package/src/debug/functions/draw-elem/draw-leaves.ts +0 -51
  275. package/src/debug/functions/draw-elem/draw-loop.ts +0 -16
  276. package/src/debug/functions/draw-elem/draw-loops.ts +0 -10
  277. package/src/debug/functions/draw-elem/draw-loose-bounding-box.ts +0 -21
  278. package/src/debug/functions/draw-elem/draw-mat.ts +0 -43
  279. package/src/debug/functions/draw-elem/draw-max-vertex.ts +0 -15
  280. package/src/debug/functions/draw-elem/draw-min-y.ts +0 -18
  281. package/src/debug/functions/draw-elem/draw-one-prong-at-dull-corner.ts +0 -40
  282. package/src/debug/functions/draw-elem/draw-one-prong.ts +0 -25
  283. package/src/debug/functions/draw-elem/draw-sharp-corner.ts +0 -21
  284. package/src/debug/functions/draw-elem/draw-three-prong.ts +0 -44
  285. package/src/debug/functions/draw-elem/draw-tight-bounding-box.ts +0 -18
  286. package/src/debug/functions/draw-elem/draw-two-prong.ts +0 -68
  287. package/src/debug/functions/draw-elem/draw-vertex.ts +0 -27
  288. package/src/debug/functions/draw-elem/dull-corner.ts +0 -21
  289. package/src/debug/functions/draw-elem/leaves.ts +0 -20
  290. package/src/debug/functions/draw-elem/loop.ts +0 -16
  291. package/src/debug/functions/draw-elem/loops.ts +0 -10
  292. package/src/debug/functions/draw-elem/loose-bounding-box.ts +0 -21
  293. package/src/debug/functions/draw-elem/mat.ts +0 -47
  294. package/src/debug/functions/draw-elem/max-vertex.ts +0 -15
  295. package/src/debug/functions/draw-elem/min-y.ts +0 -18
  296. package/src/debug/functions/draw-elem/one-prong-at-dull-corner.ts +0 -26
  297. package/src/debug/functions/draw-elem/one-prong.ts +0 -23
  298. package/src/debug/functions/draw-elem/sharp-corner.ts +0 -20
  299. package/src/debug/functions/draw-elem/three-prong.ts +0 -30
  300. package/src/debug/functions/draw-elem/tight-bounding-box.ts +0 -18
  301. package/src/debug/functions/draw-elem/two-prong.ts +0 -50
  302. package/src/debug/functions/draw-elem/vertex.ts +0 -51
  303. package/src/find-3-prong/timed-cc.ts +0 -9
  304. package/src/reconstruct-from-mat/filter-zero-length.ts +0 -23
  305. package/src/reconstruct-from-mat/get-bezier-piece-length.ts +0 -12
  306. package/src/reconstruct-from-mat/get-boundary.ts +0 -32
  307. package/src/reconstruct-from-mat/get-matching-beziers.ts +0 -46
  308. package/src/reconstruct-from-mat/get-mbss-by-loop-per-sat.ts +0 -19
  309. package/src/reconstruct-from-mat/get-mbss-by-loop-with-opp-arr.ts +0 -69
  310. package/src/reconstruct-from-mat/get-sats2.ts +0 -25
  311. package/src/reconstruct-from-mat/is-fully-terminating.ts +0 -27
  312. package/src/reconstruct-from-mat/matched-beziers.ts +0 -14
  313. package/src/reconstruct-from-mat/split-tri-path.ts +0 -280
@@ -1,209 +0,0 @@
1
- import { getTAtLength } from 'flo-bezier3';
2
- import { sum } from '../utils/sum.js';
3
- import { clip } from '../utils/clip.js';
4
- import { getBezierPieceLength } from './get-bezier-piece-length.js';
5
- const EPS = 1e-9;
6
- function splitTriPath(boundaryBeziers, medialBezier, boundaryBeziersOpp) {
7
- const _boundaryBeziersOpp = boundaryBeziersOpp ?? [];
8
- const boundaryBeziersOpp_ = _boundaryBeziersOpp.map(reverseBezierPiece).toReversed();
9
- // Importantly, we need to split on boundaryBeziersOpp_ as well, to ensure
10
- // the number of returned pieces is the same for both sides, so that they
11
- // can be interpolated.
12
- const _paths = boundaryBeziersOpp_.length > 0
13
- ? [boundaryBeziers, [medialBezier], boundaryBeziersOpp_]
14
- : [boundaryBeziers, [medialBezier]];
15
- const paths = splitTriPath_(_paths);
16
- const matchedBezierss = [];
17
- for (let i = 0; i < paths.length; i++) {
18
- const path = paths[i];
19
- // const pathOpp = paths[paths.length - 1 - i];
20
- const [boundaryBezier, medialBezier] = path;
21
- // const boundaryBezierOpp = pathOpp[2];
22
- const matchedBeziers = {
23
- boundaryBezier,
24
- medialBezier,
25
- // boundaryBezierOpp
26
- };
27
- matchedBezierss.push(matchedBeziers);
28
- }
29
- return matchedBezierss;
30
- }
31
- function reverseBezierPiece(bezierPiece) {
32
- const { ps, ts: [tS, tE] } = bezierPiece;
33
- return {
34
- ps: ps.toReversed(),
35
- ts: [1 - tE, 1 - tS]
36
- };
37
- }
38
- /**
39
- * Returns an array of arrays of `BezierPiece`s, where each inner array
40
- * contains `BezierPiece`s that correspond to each other across the different
41
- * paths by normalized length.
42
- *
43
- * For example, if there are 3 paths, then each inner array will contain 3
44
- * `BezierPiece`s, one from each path, that correspond to each other by normalized
45
- * length.
46
- *
47
- * @param bezierPiecess
48
- */
49
- function splitTriPath_(bezierPiecess) {
50
- const lenss = mapmap(bezierPiecess, getBezierPieceLength);
51
- const lens = lenss.map(sum);
52
- const cums = lenss.map(getCumLengths);
53
- const normCums = cums.map((cum, i) => {
54
- const len = lens[i];
55
- if (len <= EPS) {
56
- return cum.map((_, j) => j === 0 ? 0 : 1);
57
- // return cum.map(() => Number.POSITIVE_INFINITY);
58
- }
59
- return cum.map(l => l / len);
60
- });
61
- /** Current position of start t */
62
- let ts = new Array(bezierPiecess.length).fill(0);
63
- /** Current position of i */
64
- let is = new Array(bezierPiecess.length).fill(0);
65
- const matchedBezierss = [];
66
- normCums; //?
67
- let ii = 0;
68
- const maxIterations = 100;
69
- while (ts.some(t => t < 1) && ii++ < maxIterations) {
70
- const normCumsNext = [];
71
- for (let k = 0; k < bezierPiecess.length; k++) {
72
- const i_ = is[k];
73
- const normCum_ = normCums[k][i_ + 1]; //?
74
- const normCum = normCum_ === undefined
75
- ? Number.POSITIVE_INFINITY
76
- : normCum_;
77
- normCumsNext.push(normCum);
78
- }
79
- normCumsNext; //?
80
- const minIdx = getMinIdx(normCumsNext); //?
81
- const idxs = getIdxs(normCumsNext, normCumsNext[minIdx]); //?
82
- const curCum = normCumsNext[minIdx];
83
- // if (idxs.length === 0) {
84
- // throw new Error('splitTriPath_: unable to make progress');
85
- // }
86
- const nextPieces = new Array(bezierPiecess.length).fill([]);
87
- for (let m = 0; m < bezierPiecess.length; m++) {
88
- const bezierPieces = bezierPiecess[m];
89
- const _i = is[m];
90
- // This path is already finished; keep emitting a degenerate tail.
91
- if (_i >= bezierPieces.length) {
92
- const lastBezierPiece = bezierPieces[bezierPieces.length - 1];
93
- nextPieces[m] = {
94
- ps: lastBezierPiece.ps,
95
- ts: [1, 1]
96
- };
97
- ts[m] = 1;
98
- continue;
99
- }
100
- if (idxs.includes(m)) {
101
- const _t = ts[m];
102
- const bezierPiece = bezierPieces[_i];
103
- const [pieceTS, pieceTE] = bezierPiece.ts;
104
- const pieceDt = pieceTE - pieceTS;
105
- nextPieces[m] = {
106
- ps: bezierPiece.ps,
107
- ts: [pieceTS + _t * pieceDt, pieceTE]
108
- };
109
- const nextI = _i + 1;
110
- is[m] = nextI;
111
- ts[m] = nextI >= bezierPieces.length ? 1 : 0;
112
- }
113
- else {
114
- const _t = ts[m];
115
- const bezierPiece = bezierPieces[_i];
116
- const [pieceTS, pieceTE] = bezierPiece.ts;
117
- const pieceDt = pieceTE - pieceTS;
118
- const bezierLen = getBezierPieceLength({ ps: bezierPiece.ps, ts: [0, 1] });
119
- const normCumStart = normCums[m][_i];
120
- const normCumEnd = normCums[m][_i + 1];
121
- const normCumDt = normCumEnd - normCumStart;
122
- const normWithinPiece = normCumDt <= EPS
123
- ? _t
124
- : clip((curCum - normCumStart) / normCumDt, _t, 1);
125
- const t1 = bezierLen <= EPS
126
- ? _t
127
- : clip(getTAtLength(bezierPiece.ps, bezierLen * normWithinPiece), _t, 1);
128
- nextPieces[m] = {
129
- ps: bezierPiece.ps,
130
- ts: [pieceTS + _t * pieceDt, pieceTS + t1 * pieceDt]
131
- };
132
- if (closeToEps(t1, 1)) {
133
- const nextI = _i + 1;
134
- is[m] = nextI;
135
- ts[m] = nextI >= bezierPieces.length ? 1 : 0;
136
- }
137
- else {
138
- is[m] = _i;
139
- ts[m] = t1;
140
- }
141
- }
142
- }
143
- matchedBezierss.push(nextPieces);
144
- }
145
- if (ts.some(t => t < 1)) {
146
- throw new Error('splitTriPath_: exceeded maximum iterations');
147
- }
148
- return matchedBezierss;
149
- }
150
- function getCumLengths(lens) {
151
- const cum = [0];
152
- let cumLen = 0;
153
- for (let j = 0; j < lens.length; j++) {
154
- cumLen += lens[j];
155
- cum.push(cumLen);
156
- }
157
- return cum;
158
- }
159
- /**
160
- * Returns the index within the given array of the number with the highest
161
- * value.
162
- *
163
- * * returns `undefined` if the array is empty
164
- */
165
- function getMinIdx(vs) {
166
- let minIdx = undefined;
167
- let minVal = Number.POSITIVE_INFINITY;
168
- for (let i = 0; i < vs.length; i++) {
169
- if (vs[i] <= minVal) {
170
- minVal = vs[i];
171
- minIdx = i;
172
- }
173
- }
174
- return minIdx;
175
- }
176
- /**
177
- * Returns the indices within the given array of the numbers that are equal to
178
- * the given max value (within an EPS value).
179
- *
180
- * @param vs
181
- * @param maxVal
182
- */
183
- function getIdxs(vs, maxVal) {
184
- const maxIdxs = [];
185
- for (let i = 0; i < vs.length; i++) {
186
- if (vs[i] === maxVal || closeToEps(vs[i], maxVal)) {
187
- maxIdxs.push(i);
188
- }
189
- }
190
- return maxIdxs;
191
- }
192
- function closeToEps(a, b) {
193
- return Math.abs(a - b) <= EPS;
194
- }
195
- export { splitTriPath, getCumLengths };
196
- // KEEP FOR TESTING! - one in opentype-ts doesn't work with tests due to aliases
197
- function mapmap(tss, f) {
198
- const tss_ = [];
199
- for (let i = 0; i < tss.length; i++) {
200
- const ts = tss[i];
201
- const ts_ = [];
202
- for (let j = 0; j < ts.length; j++) {
203
- ts_.push(f(ts[j]));
204
- }
205
- tss_.push(ts_);
206
- }
207
- return tss_;
208
- }
209
- //# sourceMappingURL=split-tri-path.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"split-tri-path.js","sourceRoot":"","sources":["../../src/reconstruct-from-mat/split-tri-path.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAGpE,MAAM,GAAG,GAAG,IAAI,CAAC;AAGjB,SAAS,YAAY,CACb,eAA8B,EAC9B,YAAyB,EACzB,kBAA6C;IAEjD,MAAM,mBAAmB,GAAG,kBAAkB,IAAI,EAAE,CAAC;IAErD,MAAM,mBAAmB,GACrB,mBAAmB,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,UAAU,EAAE,CAAC;IAE7D,0EAA0E;IAC1E,yEAAyE;IACzE,uBAAuB;IACvB,MAAM,MAAM,GAAG,mBAAmB,CAAC,MAAM,GAAG,CAAC;QACzC,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,YAAY,CAAC,EAAE,mBAAmB,CAAC;QACxD,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAExC,MAAM,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAEpC,MAAM,eAAe,GAAqB,EAAE,CAAC;IAC7C,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,+CAA+C;QAE/C,MAAM,CAAC,cAAc,EAAE,YAA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C;QACpB,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7B,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvB,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC"}
@@ -1,2 +0,0 @@
1
- declare function clip(v: number, vMin: number, vMax: number): number;
2
- export { clip };
@@ -1,6 +0,0 @@
1
- const { max, min } = Math;
2
- function clip(v, vMin, vMax) {
3
- return max(vMin, min(vMax, v));
4
- }
5
- export { clip };
6
- //# sourceMappingURL=clip.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clip.js","sourceRoot":"","sources":["../../src/utils/clip.ts"],"names":[],"mappings":"AACA,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE1B,SAAS,IAAI,CACL,CAAS,EACT,IAAY,EACZ,IAAY;IAEhB,OAAO,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC;AAGD,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -1,14 +0,0 @@
1
- type TimedFunction<T extends (...args: any[]) => any> = ((this: ThisParameterType<T>, ...args: Parameters<T>) => ReturnType<T>) & {
2
- getStats: () => {
3
- count: number;
4
- totalMs: number;
5
- avg: number;
6
- };
7
- resetStats: () => void;
8
- };
9
- /**
10
- *
11
- * @param f
12
- */
13
- declare function timeFunctionCalls<T extends (...args: any[]) => any>(f: T): TimedFunction<T>;
14
- export { timeFunctionCalls };
@@ -1,32 +0,0 @@
1
- import { sum } from './sum.js';
2
- /**
3
- *
4
- * @param f
5
- */
6
- function timeFunctionCalls(f) {
7
- const history = [];
8
- function wrapper(...args) {
9
- const start = performance.now();
10
- const result = f.apply(this, args); // Execute original function
11
- const end = performance.now();
12
- history.push(end - start); // Track the duration
13
- return result;
14
- }
15
- ;
16
- // Attach a helper method to inspect stats at any time
17
- wrapper.getStats = () => {
18
- const total = sum(history);
19
- return {
20
- totalMs: total,
21
- count: history.length,
22
- avg: history.length === 0 ? 0 : total / history.length,
23
- // history: history
24
- };
25
- };
26
- wrapper.resetStats = () => {
27
- history.length = 0;
28
- };
29
- return wrapper;
30
- }
31
- export { timeFunctionCalls };
32
- //# sourceMappingURL=time-function-call.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"time-function-call.js","sourceRoot":"","sources":["../../src/utils/time-function-call.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAgB/B;;;GAGG;AACH,SAAS,iBAAiB,CAAoC,CAAI;IAC9D,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,SAAS,OAAO,CAA6B,GAAG,IAAmB;QAC/D,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,4BAA4B;QAChE,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QAE9B,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,qBAAqB;QAEhD,OAAO,MAAM,CAAC;IAClB,CAAC;IAAA,CAAC;IAEF,sDAAsD;IACtD,OAAO,CAAC,QAAQ,GAAG,GAAG,EAAE;QACpB,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC;QAC3B,OAAO;YACH,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,OAAO,CAAC,MAAM;YACrB,GAAG,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM;YACtD,mBAAmB;SACtB,CAAC;IACN,CAAC,CAAC;IAEF,OAAO,CAAC,UAAU,GAAG,GAAG,EAAE;QACtB,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IACvB,CAAC,CAAA;IAED,OAAO,OAA2B,CAAC;AACvC,CAAC;AAGD,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
@@ -1,43 +0,0 @@
1
- import { Mat } from '../mat/mat.js';
2
- import { CpNode } from '../cp-node/cp-node.js';
3
-
4
-
5
- type DebugElemKey = keyof typeof emptyDebugElems;
6
-
7
-
8
- const emptyDebugElems = {
9
- oneProng: [] as CpNode[],
10
- // oneProngAtDullCorner: [] as PointOnShape[],
11
- twoProng: [] as CpNode[],
12
- threeProng: [] as CpNode[],
13
- looseBoundingBox: [] as number[][][],
14
- tightBoundingBox: [] as number[][][],
15
- boundingHull: [] as number[][][],
16
- // sharpCorner: [] as Curve[],
17
- // dullCorner: [] as Curve[],
18
- vertex: [] as CpNode[],
19
- mat: [] as Mat[],
20
- maxVertex: [] as CpNode[],
21
- leaves: [] as CpNode[][],
22
- cull: [] as number[][],
23
- cpNode: [] as CpNode[],
24
- branch: [] as CpNode[][],
25
- holeCloser: [] as CpNode[]
26
- } as const;
27
-
28
-
29
- const debugElemNames =
30
- Object.keys(emptyDebugElems) as Array<keyof typeof emptyDebugElems>;
31
-
32
-
33
- /** @internal */
34
- type DebugElems = typeof emptyDebugElems;
35
-
36
- type DebugElem = { [T in keyof DebugElems]: DebugElems[T][number]; }
37
-
38
-
39
- export {
40
- DebugElems, DebugElemKey, DebugElem,
41
- emptyDebugElems, debugElemNames,
42
- }
43
-
@@ -1,18 +0,0 @@
1
- import { drawFs } from 'flo-draw';
2
-
3
-
4
- /** @internal */
5
- function boundingHull(
6
- g: SVGGElement,
7
- hull: number[][],
8
- classes = 'thin5 black nofill',
9
- delay = 0,
10
- scaleFactor = 1) {
11
-
12
- const $polygon = drawFs.polygon(g, hull, classes, delay);
13
-
14
- return $polygon;
15
- }
16
-
17
-
18
- export { boundingHull }
@@ -1,39 +0,0 @@
1
- import { Circle } from '../../../geometry/circle.js';
2
-
3
-
4
- /** @internal */
5
- function culls(g: SVGGElement, culls: Circle[]) {
6
- const $elems: SVGElement[] = [];
7
-
8
- for (const circle of culls) {
9
- const p = circle.center;
10
-
11
- $elems.push(drawCircle(g, p, 0.4, 'cyan thin5 nofill'));
12
- }
13
-
14
- return $elems;
15
- }
16
-
17
-
18
- /** @internal */
19
- function drawCircle(
20
- g: SVGGElement,
21
- center: number[],
22
- radiusPercent: number,
23
- classes: string) {
24
-
25
- const XMLNS = 'http://www.w3.org/2000/svg';
26
-
27
- const $circle = document.createElementNS(XMLNS, 'circle');
28
- $circle.setAttributeNS(null, "cx", center[0].toString());
29
- $circle.setAttributeNS(null, "cy", center[1].toString());
30
- $circle.setAttributeNS(null, "r", radiusPercent.toString() + '%');
31
- $circle.setAttributeNS(null, "class", classes);
32
-
33
- g.appendChild($circle);
34
-
35
- return $circle;
36
- }
37
-
38
-
39
- export { culls }
@@ -1,37 +0,0 @@
1
- import type { CpNode } from '../../../cp-node/cp-node.js';
2
- import { getMatCurveToNext } from '../../../cp-node/fs/get-mat-curve-to-next.js';
3
- import { isTerminating } from '../../../cp-node/fs/is-terminating.js';
4
- import { drawBeziersAsSinglePath } from '../draw/draw-beziers-as-single-path.js';
5
-
6
-
7
- /** @internal */
8
- function drawBranch(
9
- g: SVGGElement,
10
- branch: CpNode[],
11
- classes = 'thin5 purple nofill',
12
- delay = 0,
13
- scaleFactor = 1) {
14
-
15
-
16
- const $svgs: SVGElement[] = [];
17
- let i = 0;
18
-
19
- const pss: number[][][] = [];
20
- for (const cpNode of branch) {
21
- if (isTerminating(cpNode)) { continue; }
22
- const bezier = getMatCurveToNext(cpNode);
23
- if (!bezier) { continue; }
24
- i++;
25
- // $svgs.push( ...drawFs.bezier(g, bezier, classes, delay));
26
- pss.push(bezier);
27
- }
28
-
29
- // return $svgs;
30
-
31
- $svgs.push(...drawBeziersAsSinglePath(g, pss, classes, delay));
32
-
33
- return $svgs;
34
- }
35
-
36
-
37
- export { drawBranch }
@@ -1,23 +0,0 @@
1
-
2
- /** @internal */
3
- function drawCirclePercent(
4
- g: SVGGElement,
5
- center: number[],
6
- radiusPercent: number,
7
- classes: string) {
8
-
9
- const XMLNS = 'http://www.w3.org/2000/svg';
10
-
11
- const $circle = document.createElementNS(XMLNS, 'circle');
12
- $circle.setAttributeNS(null, "cx", center[0].toString());
13
- $circle.setAttributeNS(null, "cy", center[1].toString());
14
- $circle.setAttributeNS(null, "r", radiusPercent.toString() + '%');
15
- $circle.setAttributeNS(null, "class", classes);
16
-
17
- g.appendChild($circle);
18
-
19
- return $circle;
20
- }
21
-
22
-
23
- export { drawCirclePercent }
@@ -1,46 +0,0 @@
1
- import type { CpNode } from '../../../cp-node/cp-node.js';
2
- import { drawFs } from 'flo-draw';
3
- import { scaleCircle } from '../../../geometry/circle.js';
4
- import { getAllOnCircle } from '../../../cp-node/fs/get-all-on-circle.js';
5
-
6
-
7
- /** @internal */
8
- function drawCpNode(
9
- g: SVGGElement,
10
- cpNode: CpNode,
11
- classes = 'blue thin2 nofill',
12
- delay = 0,
13
- scaleFactor = 1) {
14
-
15
- const circle = scaleCircle(
16
- cpNode.pointOnShape.circle,
17
- 1
18
- );
19
- const { center: c, radius: r } = circle;
20
-
21
- const poss = getAllOnCircle(cpNode)
22
- .map(cpNode => cpNode.pointOnShape)
23
-
24
- const { dot, circle: drawCircle, crossHair } = drawFs;
25
-
26
- const $circle = drawCircle(g, circle, classes, delay);
27
-
28
- const $cps: SVGElement[] = [];
29
- const $ls: SVGElement[] = [];
30
- for (let i=0; i<poss.length; i++) {
31
- const p = poss[i].p;
32
- $cps.push(...dot(g, p, 0.01*(i+1)*scaleFactor, 'blue', delay));
33
- $ls.push(...drawFs.line(g, [p, c], 'thin5 red', delay));
34
- }
35
-
36
- const $cross = crossHair(g, c, 'orange thin10 nofill', 2*scaleFactor, delay);
37
-
38
- // if (r === 0) {
39
- // const $cross = crossHair(g, circle.center, 'red thin2 nofill', 0.02*scaleFactor, delay);
40
- // }
41
-
42
- return [...$cps, ...$ls, ...$circle, ...$cross] as SVGElement[];
43
- }
44
-
45
-
46
- export { drawCpNode }
@@ -1,21 +0,0 @@
1
- import { drawFs } from "flo-draw";
2
-
3
- /** @internal */
4
- function drawCull(
5
- g: SVGGElement,
6
- cull: number[],
7
- classes = 'thin10 cyan nofill',
8
- delay = 0,
9
- scaleFactor = 1) {
10
-
11
- const $elems: SVGElement[] = [];
12
-
13
- $elems.push(...drawFs.crossHair(
14
- g, cull, classes, 0.1*scaleFactor, delay)
15
- )
16
-
17
- return $elems;
18
- }
19
-
20
-
21
- export { drawCull }
@@ -1,21 +0,0 @@
1
- import type { Curve } from 'flo-boolean';
2
- import { drawFs } from 'flo-draw';
3
-
4
-
5
- /** @internal */
6
- function dullCorner(
7
- g: SVGGElement,
8
- curve: Curve,
9
- classes = 'orange',
10
- delay = 0,
11
- scaleFactor = 1) {
12
-
13
- const ps = curve.ps;
14
- const p = ps[ps.length-1];
15
- const $pos = drawFs.dot(g, p, 0.1*0.5*scaleFactor, classes, delay);
16
-
17
- return $pos;
18
- }
19
-
20
-
21
- export { dullCorner }
@@ -1,64 +0,0 @@
1
- import { DebugElem, DebugElemKey } from '../../debug-elem-types.js';
2
- import { drawOneProng } from './draw-one-prong.js';
3
- import { drawTwoProng } from './draw-two-prong.js';
4
- import { drawThreeProng } from './draw-three-prong.js';
5
- import { vertex } from './draw-vertex.js';
6
- import { minY } from './draw-min-y.js';
7
- import { boundingHull } from './bounding-hull.js';
8
- import { looseBoundingBox } from './draw-loose-bounding-box.js';
9
- import { tightBoundingBox } from './draw-tight-bounding-box.js';
10
- import { sharpCorner } from './draw-sharp-corner.js';
11
- import { dullCorner } from './draw-dull-corner.js';
12
- import { drawMat } from './draw-mat.js';
13
- import { loop } from './draw-loop.js';
14
- import { loops } from './draw-loops.js';
15
- import { maxVertex } from './draw-max-vertex.js';
16
- import { drawLeaves } from './draw-leaves.js';
17
- import { drawCull } from './draw-cull.js';
18
- import { drawBranch } from './draw-branch.js';
19
- import { oneProngAtDullCorner } from './draw-one-prong-at-dull-corner.js';
20
- import { drawCpNode } from './draw-cp-node.js';
21
-
22
-
23
- type DrawElemFunction<T extends DebugElemKey> = (
24
- g: SVGGElement,
25
- elem: DebugElem[T],
26
- classes?: string,
27
- delay?: number,
28
- scaleFactor?: number,
29
- options?: any) => SVGElement[];
30
-
31
-
32
- /** @internal */
33
- type DrawElemFunctions = { [T in DebugElemKey]: DrawElemFunction<T> }
34
-
35
-
36
- /** @internal */
37
- const drawElemFs: DrawElemFunctions = {
38
- oneProng: drawOneProng,
39
- twoProng: drawTwoProng(false, true),
40
- threeProng: drawThreeProng,
41
- boundingHull,
42
- looseBoundingBox,
43
- tightBoundingBox,
44
- // sharpCorner,
45
- // dullCorner,
46
- vertex,
47
- mat: drawMat,
48
- // sat: drawMat('sat'),
49
- maxVertex,
50
- leaves: drawLeaves,
51
- cull: drawCull,
52
- cpNode: drawCpNode,
53
- branch: drawBranch,
54
- holeCloser: drawTwoProng(false, false)
55
- }
56
-
57
-
58
- const drawElemFsDetailed: DrawElemFunctions = {
59
- ...drawElemFs,
60
- twoProng: drawTwoProng(true, true),
61
- }
62
-
63
-
64
- export { drawElemFs, drawElemFsDetailed, DrawElemFunctions }
@@ -1,51 +0,0 @@
1
- import type { CpNode } from '../../../cp-node/cp-node.js';
2
- import { drawFs } from 'flo-draw';
3
- import { drawCirclePercent } from './draw-circle-percent.js';
4
- import { getAllOnCircle } from '../../../cp-node/fs/get-all-on-circle.js';
5
-
6
-
7
- /** @internal */
8
- function drawLeaves(
9
- g: SVGGElement,
10
- leaves: CpNode[],
11
- classes = 'thin10 deeppink nofill',
12
- delay = 0,
13
- scaleFactor = 1) {
14
-
15
- const $elems: SVGElement[] = [];
16
- const { line, dot, circle: drawCircle } = drawFs;
17
-
18
- for (const cpNode of leaves) {
19
- const cp = cpNode.pointOnShape;
20
- const { circle } = cp;
21
- const { center: c, radius: r } = circle;
22
-
23
- const $center = [drawCirclePercent(g, c, 0.5, 'pinker thin5 nofill')];
24
-
25
- const poss = getAllOnCircle(cpNode)
26
- .map(cpNode => cpNode.pointOnShape);
27
-
28
- const $ls: SVGElement[] = [];
29
- const $cps: SVGElement[] = [];
30
- for (let i=0; i<poss.length; i++) {
31
- const p = poss[i].p;
32
- $cps.push(...dot(g, p, 0.01*(i+1)*scaleFactor, 'pinker', delay));
33
- $ls.push(...line(g, [p, c], 'thin5 red', delay));
34
- }
35
-
36
- const $circle = drawCircle(g, circle, classes, delay);
37
- // const $cp = dot(g, p, 0.005*scaleFactor, 'pinker', delay);
38
-
39
- $elems.push(...[
40
- ...$circle,
41
- ...$cps,
42
- ...$ls,
43
- ...$center
44
- ]);
45
- }
46
-
47
- return $elems;
48
- }
49
-
50
-
51
- export { drawLeaves }