flo-mat 4.0.2 → 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 (294) 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 +170 -0
  7. package/__tests__/specific-cases/test-svgs/achispado.svg +5052 -0
  8. package/browser/index.js +5129 -8785
  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/cp-node/fs/get-all-on-loop-by-loop.d.ts +11 -0
  16. package/node/cp-node/fs/get-all-on-loop-by-loop.js +42 -0
  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/cp-node/fs/is-on-same-loop.d.ts +3 -0
  29. package/node/cp-node/fs/is-on-same-loop.js +6 -0
  30. package/node/cp-node/fs/is-on-same-loop.js.map +1 -0
  31. package/node/debug/debug.d.ts +8 -22
  32. package/node/debug/debug.js +12 -50
  33. package/node/debug/debug.js.map +1 -1
  34. package/node/find-2-prong/add-1-prong.js +1 -4
  35. package/node/find-2-prong/add-1-prong.js.map +1 -1
  36. package/node/find-2-prong/find-2-prong.js +24 -10
  37. package/node/find-2-prong/find-2-prong.js.map +1 -1
  38. package/node/find-2-prong/get-medial/get-antipodal-points.d.ts +1 -1
  39. package/node/find-2-prong/get-medial/get-antipodal-points.js +2 -2
  40. package/node/find-2-prong/get-medial/get-antipodal-points.js.map +1 -1
  41. package/node/find-2-prong/get-medial/get-closest-points.d.ts +7 -1
  42. package/node/find-2-prong/get-medial/get-closest-points.js +60 -14
  43. package/node/find-2-prong/get-medial/get-closest-points.js.map +1 -1
  44. package/node/find-2-prong/reduce-radius.d.ts +3 -1
  45. package/node/find-2-prong/reduce-radius.js +8 -6
  46. package/node/find-2-prong/reduce-radius.js.map +1 -1
  47. package/node/find-3-prong/calc-better-x.js +1 -3
  48. package/node/find-3-prong/calc-better-x.js.map +1 -1
  49. package/node/find-3-prong/calc-initial-3-prong-center.js +1 -2
  50. package/node/find-3-prong/calc-initial-3-prong-center.js.map +1 -1
  51. package/node/find-3-prong/find-3-prong-for-delta3s.js +1 -4
  52. package/node/find-3-prong/find-3-prong-for-delta3s.js.map +1 -1
  53. package/node/find-3-prong/find-3-prong.js.map +1 -1
  54. package/node/find-3-prong/find-and-add-3-prong.js +0 -14
  55. package/node/find-3-prong/find-and-add-3-prong.js.map +1 -1
  56. package/node/find-mat/find-mat.js +2 -2
  57. package/node/find-mat/find-mat.js.map +1 -1
  58. package/node/find-mat/find-mats.js.map +1 -1
  59. package/node/find-mat/get-dull-corners-on-loop.js +3 -2
  60. package/node/find-mat/get-dull-corners-on-loop.js.map +1 -1
  61. package/node/find-mat/get-for-1-prongs-on-loop.js +6 -3
  62. package/node/find-mat/get-for-1-prongs-on-loop.js.map +1 -1
  63. package/node/find-mat/get-for-2-prongs-on-loop.js +5 -1
  64. package/node/find-mat/get-for-2-prongs-on-loop.js.map +1 -1
  65. package/node/find-mat/get-meta.d.ts +4 -6
  66. package/node/find-mat/get-meta.js +12 -26
  67. package/node/find-mat/get-meta.js.map +1 -1
  68. package/node/find-mat/get-sharp-corners.js +4 -2
  69. package/node/find-mat/get-sharp-corners.js.map +1 -1
  70. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0.d.ts +21 -0
  71. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0.js +46 -0
  72. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0.js.map +1 -0
  73. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez1.d.ts +28 -0
  74. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez1.js +97 -0
  75. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez1.js.map +1 -0
  76. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2-same-curve.d.ts +28 -0
  77. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2-same-curve.js +109 -0
  78. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2-same-curve.js.map +1 -0
  79. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2.d.ts +29 -0
  80. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2.js +123 -0
  81. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2.js.map +1 -0
  82. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.d.ts +30 -0
  83. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.js +177 -0
  84. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.js.map +1 -0
  85. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.d.ts +29 -0
  86. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.js +156 -0
  87. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.js.map +1 -0
  88. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs.d.ts +28 -0
  89. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs.js +40 -0
  90. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs.js.map +1 -0
  91. package/node/index.d.ts +6 -10
  92. package/node/index.js +5 -6
  93. package/node/index.js.map +1 -1
  94. package/node/point-on-shape/point-on-shape.d.ts +2 -0
  95. package/node/point-on-shape/to-p.d.ts +1 -1
  96. package/node/point-on-shape/to-p.js +1 -1
  97. package/node/point-on-shape/to-p.js.map +1 -1
  98. package/node/reconstruct-from-mat/get-cp-nodess-for-sat.d.ts +4 -0
  99. package/node/reconstruct-from-mat/get-cp-nodess-for-sat.js +15 -0
  100. package/node/reconstruct-from-mat/get-cp-nodess-for-sat.js.map +1 -0
  101. package/node/reconstruct-from-mat/reconstruct-from-mat.d.ts +10 -0
  102. package/node/reconstruct-from-mat/reconstruct-from-mat.js +160 -0
  103. package/node/reconstruct-from-mat/reconstruct-from-mat.js.map +1 -0
  104. package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.d.ts +12 -0
  105. package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js +46 -0
  106. package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js.map +1 -0
  107. package/node/sat/add-debug-info.js +1 -2
  108. package/node/sat/add-debug-info.js.map +1 -1
  109. package/node/svg/get-loop-bounds.js +6 -2
  110. package/node/svg/get-loop-bounds.js.map +1 -1
  111. package/node/utils/map-deep.d.ts +15 -0
  112. package/node/utils/map-deep.js +34 -0
  113. package/node/utils/map-deep.js.map +1 -0
  114. package/package.json +14 -8
  115. package/src/closest-boundary-point/get-close-boundary-points-certified.ts +3 -2
  116. package/src/corner/get-corner.ts +1 -1
  117. package/src/cp-node/fs/get-all-on-loop-by-loop.ts +56 -0
  118. package/src/cp-node/fs/get-all-on-loop.ts +1 -1
  119. package/src/cp-node/fs/get-boundary-beziers-to-next.ts +1 -72
  120. package/src/cp-node/fs/get-edge-direction.ts +8 -4
  121. package/src/cp-node/fs/get-mat-curve-between.ts +6 -6
  122. package/src/cp-node/fs/is-fully-terminating.ts +16 -0
  123. package/src/cp-node/fs/is-on-same-loop.ts +15 -0
  124. package/src/debug/debug.ts +27 -87
  125. package/src/find-2-prong/add-1-prong.ts +1 -5
  126. package/src/find-2-prong/find-2-prong.ts +37 -14
  127. package/src/find-2-prong/get-medial/get-antipodal-points.ts +3 -2
  128. package/src/find-2-prong/get-medial/get-closest-points-d.ts +213 -0
  129. package/src/find-2-prong/get-medial/get-closest-points.ts +74 -13
  130. package/src/find-2-prong/reduce-radius.ts +8 -5
  131. package/src/find-3-prong/calc-better-x.ts +1 -3
  132. package/src/find-3-prong/calc-initial-3-prong-center.ts +1 -2
  133. package/src/find-3-prong/find-3-prong-for-delta3s.ts +1 -4
  134. package/src/find-3-prong/find-3-prong.ts +0 -1
  135. package/src/find-3-prong/find-and-add-3-prong.ts +1 -15
  136. package/src/find-mat/find-mat.ts +3 -2
  137. package/src/find-mat/find-mats.ts +0 -1
  138. package/src/find-mat/get-dull-corners-on-loop.ts +4 -3
  139. package/src/find-mat/get-for-1-prongs-on-loop.ts +8 -3
  140. package/src/find-mat/get-for-2-prongs-on-loop.ts +6 -1
  141. package/src/find-mat/get-meta.ts +14 -38
  142. package/src/find-mat/get-sharp-corners.ts +5 -1
  143. package/src/get-medial-curve/__pycache__/get-cubic-self-medial-curve.cpython-313.pyc +0 -0
  144. package/src/get-medial-curve/get-cubic-self-medial-curve.py +419 -0
  145. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0-with-running-err.ts +76 -0
  146. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0.ts +61 -0
  147. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez1.ts +116 -0
  148. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2-same-curve.ts +129 -0
  149. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2.ts +142 -0
  150. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.ts +199 -0
  151. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.ts +177 -0
  152. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs.ts +48 -0
  153. package/src/get-medial-points/double-double/error-bound-calc.txt +72 -0
  154. package/src/index.ts +7 -11
  155. package/src/point-on-shape/point-on-shape.ts +3 -0
  156. package/src/point-on-shape/to-p.ts +2 -2
  157. package/src/reconstruct-from-mat/get-cp-nodess-for-sat.ts +24 -0
  158. package/src/reconstruct-from-mat/reconstruct-from-mat.ts +226 -0
  159. package/src/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.ts +62 -0
  160. package/src/sat/add-debug-info.ts +1 -2
  161. package/src/svg/get-loop-bounds.ts +11 -3
  162. package/src/utils/clip.ts +13 -0
  163. package/src/utils/map-deep.ts +75 -0
  164. package/src/utils/map-map.ts +33 -0
  165. package/wallaby.mjs +4 -4
  166. package/node/debug/debug-elem-types.d.ts +0 -26
  167. package/node/debug/debug-elem-types.js +0 -22
  168. package/node/debug/debug-elem-types.js.map +0 -1
  169. package/node/debug/functions/draw/draw-beziers-as-single-path.d.ts +0 -2
  170. package/node/debug/functions/draw/draw-beziers-as-single-path.js +0 -30
  171. package/node/debug/functions/draw/draw-beziers-as-single-path.js.map +0 -1
  172. package/node/debug/functions/draw/xmlns.d.ts +0 -2
  173. package/node/debug/functions/draw/xmlns.js +0 -3
  174. package/node/debug/functions/draw/xmlns.js.map +0 -1
  175. package/node/debug/functions/draw-elem/bounding-hull.d.ts +0 -3
  176. package/node/debug/functions/draw-elem/bounding-hull.js +0 -8
  177. package/node/debug/functions/draw-elem/bounding-hull.js.map +0 -1
  178. package/node/debug/functions/draw-elem/draw-branch.d.ts +0 -4
  179. package/node/debug/functions/draw-elem/draw-branch.js +0 -26
  180. package/node/debug/functions/draw-elem/draw-branch.js.map +0 -1
  181. package/node/debug/functions/draw-elem/draw-circle-percent.d.ts +0 -3
  182. package/node/debug/functions/draw-elem/draw-circle-percent.js +0 -13
  183. package/node/debug/functions/draw-elem/draw-circle-percent.js.map +0 -1
  184. package/node/debug/functions/draw-elem/draw-cp-node.d.ts +0 -4
  185. package/node/debug/functions/draw-elem/draw-cp-node.js +0 -26
  186. package/node/debug/functions/draw-elem/draw-cp-node.js.map +0 -1
  187. package/node/debug/functions/draw-elem/draw-cull.d.ts +0 -3
  188. package/node/debug/functions/draw-elem/draw-cull.js +0 -9
  189. package/node/debug/functions/draw-elem/draw-cull.js.map +0 -1
  190. package/node/debug/functions/draw-elem/draw-dull-corner.d.ts +0 -4
  191. package/node/debug/functions/draw-elem/draw-dull-corner.js +0 -10
  192. package/node/debug/functions/draw-elem/draw-dull-corner.js.map +0 -1
  193. package/node/debug/functions/draw-elem/draw-elem.d.ts +0 -10
  194. package/node/debug/functions/draw-elem/draw-elem.js +0 -39
  195. package/node/debug/functions/draw-elem/draw-elem.js.map +0 -1
  196. package/node/debug/functions/draw-elem/draw-leaves.d.ts +0 -4
  197. package/node/debug/functions/draw-elem/draw-leaves.js +0 -34
  198. package/node/debug/functions/draw-elem/draw-leaves.js.map +0 -1
  199. package/node/debug/functions/draw-elem/draw-loop.d.ts +0 -4
  200. package/node/debug/functions/draw-elem/draw-loop.js +0 -11
  201. package/node/debug/functions/draw-elem/draw-loop.js.map +0 -1
  202. package/node/debug/functions/draw-elem/draw-loops.d.ts +0 -4
  203. package/node/debug/functions/draw-elem/draw-loops.js +0 -6
  204. package/node/debug/functions/draw-elem/draw-loops.js.map +0 -1
  205. package/node/debug/functions/draw-elem/draw-loose-bounding-box.d.ts +0 -3
  206. package/node/debug/functions/draw-elem/draw-loose-bounding-box.js +0 -10
  207. package/node/debug/functions/draw-elem/draw-loose-bounding-box.js.map +0 -1
  208. package/node/debug/functions/draw-elem/draw-mat.d.ts +0 -4
  209. package/node/debug/functions/draw-elem/draw-mat.js +0 -34
  210. package/node/debug/functions/draw-elem/draw-mat.js.map +0 -1
  211. package/node/debug/functions/draw-elem/draw-max-vertex.d.ts +0 -4
  212. package/node/debug/functions/draw-elem/draw-max-vertex.js +0 -9
  213. package/node/debug/functions/draw-elem/draw-max-vertex.js.map +0 -1
  214. package/node/debug/functions/draw-elem/draw-min-y.d.ts +0 -4
  215. package/node/debug/functions/draw-elem/draw-min-y.js +0 -10
  216. package/node/debug/functions/draw-elem/draw-min-y.js.map +0 -1
  217. package/node/debug/functions/draw-elem/draw-one-prong-at-dull-corner.d.ts +0 -4
  218. package/node/debug/functions/draw-elem/draw-one-prong-at-dull-corner.js +0 -22
  219. package/node/debug/functions/draw-elem/draw-one-prong-at-dull-corner.js.map +0 -1
  220. package/node/debug/functions/draw-elem/draw-one-prong.d.ts +0 -4
  221. package/node/debug/functions/draw-elem/draw-one-prong.js +0 -13
  222. package/node/debug/functions/draw-elem/draw-one-prong.js.map +0 -1
  223. package/node/debug/functions/draw-elem/draw-sharp-corner.d.ts +0 -4
  224. package/node/debug/functions/draw-elem/draw-sharp-corner.js +0 -10
  225. package/node/debug/functions/draw-elem/draw-sharp-corner.js.map +0 -1
  226. package/node/debug/functions/draw-elem/draw-three-prong.d.ts +0 -4
  227. package/node/debug/functions/draw-elem/draw-three-prong.js +0 -26
  228. package/node/debug/functions/draw-elem/draw-three-prong.js.map +0 -1
  229. package/node/debug/functions/draw-elem/draw-tight-bounding-box.d.ts +0 -3
  230. package/node/debug/functions/draw-elem/draw-tight-bounding-box.js +0 -8
  231. package/node/debug/functions/draw-elem/draw-tight-bounding-box.js.map +0 -1
  232. package/node/debug/functions/draw-elem/draw-two-prong.d.ts +0 -4
  233. package/node/debug/functions/draw-elem/draw-two-prong.js +0 -49
  234. package/node/debug/functions/draw-elem/draw-two-prong.js.map +0 -1
  235. package/node/debug/functions/draw-elem/draw-vertex.d.ts +0 -4
  236. package/node/debug/functions/draw-elem/draw-vertex.js +0 -13
  237. package/node/debug/functions/draw-elem/draw-vertex.js.map +0 -1
  238. package/node/debug/functions/general.d.ts +0 -48
  239. package/node/debug/functions/general.js +0 -53
  240. package/node/debug/functions/general.js.map +0 -1
  241. package/node/find-3-prong/timed-cc.d.ts +0 -3
  242. package/node/find-3-prong/timed-cc.js +0 -5
  243. package/node/find-3-prong/timed-cc.js.map +0 -1
  244. package/node/point-on-shape/pos-to-human-string.d.ts +0 -8
  245. package/node/point-on-shape/pos-to-human-string.js +0 -12
  246. package/node/point-on-shape/pos-to-human-string.js.map +0 -1
  247. package/node/utils/time-function-call.d.ts +0 -14
  248. package/node/utils/time-function-call.js +0 -32
  249. package/node/utils/time-function-call.js.map +0 -1
  250. package/src/debug/debug-elem-types.ts +0 -43
  251. package/src/debug/elem-type-two-prong.ts +0 -8
  252. package/src/debug/functions/cmp-cp-on-delta.ts +0 -54
  253. package/src/debug/functions/draw-elem/bounding-hull.ts +0 -18
  254. package/src/debug/functions/draw-elem/culls.ts +0 -39
  255. package/src/debug/functions/draw-elem/draw-branch.ts +0 -37
  256. package/src/debug/functions/draw-elem/draw-circle-percent.ts +0 -23
  257. package/src/debug/functions/draw-elem/draw-cp-node.ts +0 -46
  258. package/src/debug/functions/draw-elem/draw-cull.ts +0 -21
  259. package/src/debug/functions/draw-elem/draw-dull-corner.ts +0 -21
  260. package/src/debug/functions/draw-elem/draw-elem.ts +0 -64
  261. package/src/debug/functions/draw-elem/draw-leaves.ts +0 -51
  262. package/src/debug/functions/draw-elem/draw-loop.ts +0 -16
  263. package/src/debug/functions/draw-elem/draw-loops.ts +0 -10
  264. package/src/debug/functions/draw-elem/draw-loose-bounding-box.ts +0 -21
  265. package/src/debug/functions/draw-elem/draw-mat.ts +0 -43
  266. package/src/debug/functions/draw-elem/draw-max-vertex.ts +0 -15
  267. package/src/debug/functions/draw-elem/draw-min-y.ts +0 -18
  268. package/src/debug/functions/draw-elem/draw-one-prong-at-dull-corner.ts +0 -40
  269. package/src/debug/functions/draw-elem/draw-one-prong.ts +0 -25
  270. package/src/debug/functions/draw-elem/draw-sharp-corner.ts +0 -21
  271. package/src/debug/functions/draw-elem/draw-three-prong.ts +0 -44
  272. package/src/debug/functions/draw-elem/draw-tight-bounding-box.ts +0 -18
  273. package/src/debug/functions/draw-elem/draw-two-prong.ts +0 -68
  274. package/src/debug/functions/draw-elem/draw-vertex.ts +0 -27
  275. package/src/debug/functions/draw-elem/dull-corner.ts +0 -21
  276. package/src/debug/functions/draw-elem/leaves.ts +0 -20
  277. package/src/debug/functions/draw-elem/loop.ts +0 -16
  278. package/src/debug/functions/draw-elem/loops.ts +0 -10
  279. package/src/debug/functions/draw-elem/loose-bounding-box.ts +0 -21
  280. package/src/debug/functions/draw-elem/mat.ts +0 -47
  281. package/src/debug/functions/draw-elem/max-vertex.ts +0 -15
  282. package/src/debug/functions/draw-elem/min-y.ts +0 -18
  283. package/src/debug/functions/draw-elem/one-prong-at-dull-corner.ts +0 -26
  284. package/src/debug/functions/draw-elem/one-prong.ts +0 -23
  285. package/src/debug/functions/draw-elem/sharp-corner.ts +0 -20
  286. package/src/debug/functions/draw-elem/three-prong.ts +0 -30
  287. package/src/debug/functions/draw-elem/tight-bounding-box.ts +0 -18
  288. package/src/debug/functions/draw-elem/two-prong.ts +0 -50
  289. package/src/debug/functions/draw-elem/vertex.ts +0 -51
  290. package/src/debug/functions/general.ts +0 -79
  291. package/src/debug/functions/three-prong.ts +0 -249
  292. package/src/debug/functions/two-prong.ts +0 -203
  293. package/src/find-2-prong/add-debug-info.ts +0 -45
  294. package/src/find-3-prong/timed-cc.ts +0 -9
@@ -1,18 +0,0 @@
1
- import { toCubic, evalDeCasteljau } from 'flo-bezier3';
2
- import { drawFs } from 'flo-draw';
3
- import { PointOnShape } from '../../../point-on-shape/point-on-shape.js';
4
-
5
-
6
- /** @internal */
7
- function minY(g: SVGGElement, pos: PointOnShape) {
8
- const p = evalDeCasteljau(pos.curve.ps, pos.t);
9
-
10
- const $elems = drawFs.crossHair(
11
- g, p, 'red thin10 nofill'
12
- );
13
-
14
- return $elems;
15
- }
16
-
17
-
18
- export { minY }
@@ -1,26 +0,0 @@
1
-
2
- import { drawFs } from 'flo-draw';
3
- import { PointOnShape } from '../../../point-on-shape/point-on-shape.js';
4
- import { getOsculatingCircle } from '../../../point-on-shape/get-osculating-circle.js';
5
-
6
-
7
- /** @hidden */
8
- function oneProngAtDullCorner(
9
- g: SVGGElement,
10
- pos: PointOnShape,
11
- classes?: string,
12
- delay = 1000,
13
- scaleFactor = 1) {
14
-
15
- //let oCircle = PointOnShape.getOsculatingCircle(Infinity, pos);
16
- const oCircle = getOsculatingCircle(Infinity, pos);
17
-
18
- const $center = drawFs.dot(g, pos.p, 0.1, 'orange');
19
- const $circle = drawFs.dot(g, oCircle.center, 0.25, 'orange');
20
- const $pos = drawFs.circle(g, oCircle, 'orange thin10 nofill');
21
-
22
- return [...$center, ...$circle, ...$pos];
23
- }
24
-
25
-
26
- export { oneProngAtDullCorner }
@@ -1,23 +0,0 @@
1
- import { drawFs } from 'flo-draw';
2
- import { CpNode } from '../../../cp-node/cp-node.js';
3
-
4
-
5
- /** @hidden */
6
- function drawOneProng(
7
- g: SVGGElement,
8
- cpNodes: CpNode[],
9
- classes?: string,
10
- delay = 0,
11
- scaleFactor = 1) {
12
-
13
- const cp = cpNodes[0].cp;
14
- const { circle, pointOnShape: pos } = cp;
15
- const $center = drawFs.dot(g, pos.p, 0.02*scaleFactor, 'deeppink', delay);
16
- const $circle = drawFs.dot(g, circle.center, 0.05*scaleFactor, 'deeppink', delay);
17
- const $pos = drawFs.circle(g, circle, 'deeppink thin5 nofill', delay);
18
-
19
- return [...$center, ...$circle, ...$pos];
20
- }
21
-
22
-
23
- export { drawOneProng }
@@ -1,20 +0,0 @@
1
- import { drawFs } from 'flo-draw';
2
- import { Curve } from '../../../curve/curve.js';
3
-
4
-
5
- /** @internal */
6
- function sharpCorner(
7
- g: SVGGElement,
8
- curve: Curve,
9
- classes = 'green',
10
- delay = 0,
11
- scaleFactor = 1) {
12
-
13
- const p = curve.ps[curve.ps.length-1];
14
- const $pos = drawFs.dot(g, p, 0.6*scaleFactor, 'green', delay);
15
-
16
- return $pos;
17
- }
18
-
19
-
20
- export { sharpCorner }
@@ -1,30 +0,0 @@
1
- import { drawFs } from 'flo-draw';
2
- import { ThreeProngForDebugging } from '../../three-prong-for-debugging.js';
3
- import { Circle, scaleCircle } from '../../../geometry/circle.js';
4
-
5
-
6
- /** @internal */
7
- function threeProng(
8
- g: SVGGElement,
9
- threeProng: ThreeProngForDebugging,
10
- classes?: string,
11
- delay = 0,
12
- scaleFactor = 1) {
13
-
14
- const circle = scaleCircle(
15
- threeProng.circle,
16
- 1
17
- );
18
- const poss = threeProng.poss;
19
-
20
- const $cp1 = drawFs.dot(g, poss[0].p, 0.01*1*scaleFactor, 'blue', delay);
21
- const $cp2 = drawFs.dot(g, poss[1].p, 0.01*2*scaleFactor, 'blue', delay);
22
- const $cp3 = drawFs.dot(g, poss[2].p, 0.01*3*scaleFactor, 'blue', delay);
23
- const $center = drawFs.dot(g, circle.center, 0.03*scaleFactor, 'blue', delay);
24
- const $circle = drawFs.circle(g, circle, 'blue thin2 nofill', delay);
25
-
26
- return [...$center, ...$cp1, ...$cp2, ...$cp3, ...$circle];
27
- }
28
-
29
-
30
- export { threeProng }
@@ -1,18 +0,0 @@
1
- import { drawFs } from 'flo-draw';
2
-
3
-
4
- /** @internal */
5
- function tightBoundingBox(
6
- g: SVGGElement,
7
- box: number[][],
8
- classes = 'thin5 pinker nofill',
9
- delay = 0,
10
- scaleFactor = 1) {
11
-
12
- const $box = drawFs.polygon(g, box, 'thin5 pinker nofill', delay);
13
-
14
- return $box;
15
- }
16
-
17
-
18
- export { tightBoundingBox }
@@ -1,50 +0,0 @@
1
- // import { drawFs } from 'flo-draw';
2
- // import { TwoProngForDebugging } from '../../two-prong-for-debugging.js';
3
- // import { getTwoProngType } from '../../../mat/get-two-prong-type.js';
4
-
5
-
6
- // /** @internal */
7
- // function twoProng(
8
- // g: SVGGElement,
9
- // twoProng: TwoProngForDebugging,
10
- // classes?: string,
11
- // delay = 0,
12
- // scaleFactor = 1) {
13
-
14
- // let $failedDot : SVGElement[] = [];
15
- // let $center : SVGElement[] = [];
16
- // let $circle : SVGElement[] = [];
17
- // let $cp1 : SVGElement[] = [];
18
- // let $cp2 : SVGElement[] = [];
19
-
20
- // let color;
21
- // let thin;
22
-
23
- // switch (getTwoProngType(twoProng)) {
24
- // case 'twoProng_regular': {
25
- // color = 'red ';
26
- // thin = '2';
27
- // break;
28
- // }
29
- // case 'twoProng_holeClosing': {
30
- // color = 'cyan ';
31
- // thin = '10';
32
- // break;
33
- // }
34
- // }
35
-
36
-
37
- // if (twoProng.failed) {
38
- // $failedDot = drawFs.dot(g, twoProng.pos.p, 1*scaleFactor, 'black', delay);
39
- // } else if (!twoProng.failed) {
40
- // $center = drawFs.dot (g, twoProng.circle.center, 0.01*scaleFactor, 'yellow', delay);
41
- // $circle = drawFs.circle(g, twoProng.circle, color + 'thin' + thin + ' nofill', delay);
42
- // $cp1 = drawFs.dot (g, twoProng.pos.p, 0.0175*scaleFactor, color, delay);
43
- // $cp2 = drawFs.dot (g, twoProng.z, 0.035*scaleFactor, color, delay);
44
- // }
45
-
46
- // return [...$failedDot, ...$center, ...$circle, ...$cp1, ...$cp2];
47
- // }
48
-
49
-
50
- // export { twoProng }
@@ -1,51 +0,0 @@
1
- import { drawFs } from 'flo-draw';
2
- import { CpNode, getCpNodesOnCircle } from '../../../cp-node/cp-node.js';
3
-
4
-
5
- /** @internal */
6
- function vertex(
7
- g: SVGGElement,
8
- cpNode: CpNode,
9
- classes?: string,
10
- delay?: number,/*
11
- visible = true*/
12
- scaleFactor = 1) {
13
-
14
- // const visibleClass = visible ? '' : ' invisible';
15
-
16
- const circle = cpNode.cp.circle;
17
-
18
- const THIN = 'thin20';
19
-
20
- const cps = getCpNodesOnCircle(cpNode);
21
- console.log(cps)
22
-
23
- let $svgs: SVGElement[] = [];
24
-
25
- const $circle = drawFs.circle(g, circle, 'red ' + THIN + ' nofill '/* + visibleClass*/, delay);
26
- const $crossHair = drawFs.crossHair(g, circle.center, 'red ' + THIN + ' nofill '/* + visibleClass*/, 3, delay);
27
-
28
- $svgs = [...$circle, ...$crossHair];
29
-
30
- for (let i=0; i<cps.length; i++) {
31
- const cp = cps[i];
32
- const edgeCircle = cp.next.cp.circle;
33
-
34
- const $circle = drawFs.circle(g, edgeCircle, 'pink ' + THIN + ' nofill '/* + visibleClass*/, delay);
35
- const $crossHair = drawFs.crossHair(g, edgeCircle.center, 'pink ' + THIN + ' nofill '/* + visibleClass*/, 3, delay);
36
-
37
- $svgs.push(...$circle, ...$crossHair)
38
-
39
- const p1 = circle.center;
40
- const p2 = edgeCircle.center;
41
- const thin = i === 0 ? 'thin10' : (i === 1 ? 'thin20' : 'thin35');
42
- const $line = drawFs.line(g, [p1, p2], 'yellow ' + thin + ' nofill '/* + visibleClass*/, delay);
43
-
44
- $svgs.push(...$line);
45
- }
46
-
47
- return $svgs;
48
- }
49
-
50
-
51
- export { vertex }
@@ -1,79 +0,0 @@
1
- import { CpNode } from '../../cp-node/cp-node.js';
2
- import { posToHumanString } from '../../point-on-shape/pos-to-human-string.js';
3
-
4
-
5
- /** @internal */
6
- export interface IGeneralDebugFunctions {
7
- nameObj : (obj: any, pre?: string) => void,
8
- δToString : (cpNodes: CpNode[]) => string[],
9
- δsToString : (cpNodes: CpNode[][]) => string[][],
10
- pointToStr : (p: number[], decimalPlaces?: number) => string
11
- pointsToStr : (ps: number[][], decimalPlaces?: number) => string[],
12
- }
13
-
14
-
15
- /** @internal */
16
- let i = 0;
17
- /**
18
- * @internal
19
- * Name the given object - for debugging purposes only
20
- */
21
- function nameObj(o: any, pre = '') {
22
- o.name = '' + pre + i++;
23
- }
24
-
25
-
26
- /**
27
- * @internal
28
- * Transforms a boundary piece (δ) into a human readable string.
29
- * @param cpNodes A boundary piece given by two CpNodes.
30
- */
31
- function δToString(cpNodes: CpNode[]) {
32
- return cpNodes.map(
33
- cpNode => posToHumanString(cpNode.pointOnShape)
34
- );
35
- }
36
-
37
-
38
- /**
39
- * @internal
40
- * Transforms an array of boundary pieces (δs) into a human readable string.
41
- * @param cpNodes An array of boundary pieces.
42
- */
43
- function δsToString(cpNodes: CpNode[][]) {
44
- return cpNodes.map(δToString);
45
- }
46
-
47
-
48
- /**
49
- * @internal
50
- * Convert the given points into a human readable string.
51
- * @param ps
52
- */
53
- function pointsToStr(ps: number[][], decimalPlaces = 3) {
54
- return ps.map(p => pointToStr(p, decimalPlaces));
55
- }
56
-
57
-
58
- /**
59
- * @internal
60
- * Converts the given point into a human readable string.
61
- * @param p The point
62
- * @param decimalPlaces number of decimal places
63
- */
64
- function pointToStr(p: number[], decimalPlaces = 3) {
65
- return p[0].toFixed(decimalPlaces) + ', ' + p[1].toFixed(decimalPlaces);
66
- }
67
-
68
-
69
- /** @internal */
70
- const generalDebugFunctions/*: IGeneralDebugFunctions*/ = {
71
- δToString,
72
- δsToString,
73
- pointToStr,
74
- pointsToStr,
75
- nameObj,
76
- }
77
-
78
-
79
- export { generalDebugFunctions }
@@ -1,249 +0,0 @@
1
- // /** @internal */
2
- // declare let _debug_: Debug;
3
-
4
- // import { drawFs } from 'flo-draw';
5
- // import { equal, getObjClosestTo } from 'flo-vector2d';
6
- // import { Debug } from '../debug.js';
7
- // import { ThreeProngForDebugging } from '../three-prong-for-debugging.js';
8
-
9
-
10
- // /** @internal */
11
- // export interface IThreeProngDebugFunctions {
12
- // drawSpokes : (g: SVGGElement, n: number) => void,
13
- // traceConvergence : (g: SVGGElement, n: number, indx: number) => void,
14
- // showBoundary : (g: SVGGElement, n: number, indx: number) => void,
15
- // logδs : (n: number) => void,
16
- // logNearest : (
17
- // showSpokes? : boolean,
18
- // showTrace? : boolean,
19
- // showBoundaries? : boolean
20
- // ) => (g: SVGGElement, p: number[], showDelay?: number) => void
21
- // }
22
-
23
-
24
- // /**
25
- // * @internal
26
- // * Draws 3 lines from the given 3-prong center to its 3 contact points.
27
- // * @param n - The 3-prong's zero-based index.
28
- // */
29
- // function drawSpokes(g: SVGGElement, n: number): void {
30
- // const threeProng = _debug_.generated.elems.threeProng[n];
31
- // const cc = threeProng.circle.center;
32
- // const poss = threeProng.poss;
33
-
34
- // for (let i=0; i<poss.length; i++) {
35
- // const pos = poss[i];
36
- // drawFs.line(g, [pos.p, cc], 'thin5 red');
37
- // }
38
- // }
39
-
40
-
41
- // /**
42
- // * @internal
43
- // * Shows the circle for each boundary iteration.
44
- // * @param n_ - The 3-prong's zero-based index. If ommitted, all will be shown.
45
- // * @param idx - The specific boundary iteration index to view. If ommitted, all
46
- // * will be shown.
47
- // */
48
- // function traceConvergence(g: SVGGElement, n_: number, idx: number): void {
49
- // let sIndx;
50
- // let eIndx;
51
- // if (n_ === undefined) {
52
- // sIndx = 0;
53
- // eIndx = _debug_.generated.elems.threeProng.length;
54
- // } else {
55
- // sIndx = n_;
56
- // eIndx = n_ + 1;
57
- // }
58
-
59
- // for (let n=sIndx; n<eIndx; n++) {
60
-
61
- // const forDebugging = _debug_.generated.elems.threeProng[n];
62
- // //const g = forDebugging.generated.g;
63
-
64
- // console.log(forDebugging);
65
-
66
- // const candidateThreeProngs = forDebugging.candidateThreeProngs;
67
-
68
- // //-----------------------------
69
- // //---- Get start and end index
70
- // //-----------------------------
71
- // let startIndx;
72
- // let endIndx;
73
- // if (n_ === undefined || idx === -1) {
74
- // startIndx = forDebugging.bestIndx;
75
- // endIndx = forDebugging.bestIndx + 1;
76
- // } else {
77
- // if (idx === undefined) {
78
- // startIndx = 0;
79
- // endIndx = candidateThreeProngs.length;
80
- // } else {
81
- // startIndx = idx;
82
- // endIndx = idx + 1;
83
- // }
84
- // }
85
-
86
- // //---------------------------------
87
- // //---- Draw candidate three-prongs
88
- // //---------------------------------
89
- // for (let i=startIndx; i<endIndx; i++) {
90
- // const circle = candidateThreeProngs[i].circle;
91
- // if (forDebugging.bestIndx === i) {
92
- // drawFs.dot(g, circle.center, 0.2, 'green');
93
- // drawFs.circle(g, circle, 'black thin10 nofill');
94
- // } else {
95
- // drawFs.dot(g, circle.center, 0.2, 'cyan');
96
- // drawFs.circle(g, circle, 'cyan thin5 nofill');
97
- // }
98
- // }
99
- // }
100
- // }
101
-
102
-
103
- // /**
104
- // * @internal
105
- // * Shows the actual boundary for each iteration.
106
- // * @param n The 3-prong's zero-based index.
107
- // * @param idx The specific boundary iteration index to view. If ommitted will
108
- // * show all.
109
- // */
110
- // function showBoundary(g: SVGGElement, n: number, idx: number): void {
111
- // const debugInfo = _debug_.generated.elems.threeProng[n];
112
- // //const g = debugInfo.generated.g;
113
-
114
- // const candidateThreeProngs = debugInfo.candidateThreeProngs;
115
-
116
- // const startIndx = idx === undefined ? 0 : idx;
117
- // const endIndx = idx === undefined ? candidateThreeProngs.length : idx;
118
-
119
- // // Draw relevant δs
120
- // const cpss = debugInfo.cpss;
121
- // let j = 0;
122
- // // For each iteration of δ3s (indexed by j)
123
- // for (let idx=1; idx<cpss.length-1; idx++) {
124
-
125
- // if (!(j >= startIndx && j <= endIndx)) {
126
- // j++;
127
- // continue;
128
- // }
129
-
130
- // const δ3s = [
131
- // cpss[0],
132
- // cpss[idx],
133
- // cpss[cpss.length-1]
134
- // ];
135
-
136
-
137
- // // For each of the 3 δs
138
- // for (let i=0; i<3; i++) {
139
- // const δ = δ3s[i];
140
- // const δS = δ[0]; // Delta Start
141
- // const δE = δ[1]; // Delta End
142
-
143
- // const posS = δS.cp.pointOnShape;
144
- // const posE = δE.cp.pointOnShape;
145
-
146
- // const pS = posS.p;
147
- // const pE = posE.p;
148
-
149
- // const r = 1 + (i*0.5);
150
-
151
- // if (equal(pS, pE)) {
152
- // drawFs.crossHair(g, pS, 'red thin10 nofill', r);
153
- // } else {
154
- // drawFs.crossHair(g, pS, 'green thin10 nofill', r);
155
- // drawFs.crossHair(g, pE, 'blue thin10 nofill', r);
156
- // }
157
- // }
158
-
159
- // j++;
160
- // }
161
- // }
162
-
163
-
164
- // /**
165
- // * @internal
166
- // * @param n The 3-prong's zero-based index.
167
- // */
168
- // function logδs(n: number): void {
169
- // const threeProng = _debug_.generated.elems.threeProng[n];
170
-
171
- // console.log(threeProng.cpss);
172
- // }
173
-
174
-
175
- // /**
176
- // * @internal
177
- // * @param p
178
- // */
179
- // function logNearest(
180
- // showSpokes = true,
181
- // showTrace = true,
182
- // showBoundaries = true) {
183
-
184
- // return function(g: SVGGElement, p: number[], showDelay = 1000) {
185
- // const generated = _debug_.generated;
186
-
187
- // const threeProng = getObjClosestTo<ThreeProngForDebugging>(
188
- // p,
189
- // generated.elems.threeProng,
190
- // threeProng => threeProng.circle ? threeProng.circle.center : [0,0]
191
- // )!;
192
-
193
-
194
- // const circle = threeProng.circle;
195
- // //const g = threeProng.generated.g;
196
-
197
- // console.log(threeProng);
198
-
199
- // const circle2 = {
200
- // center: circle.center,
201
- // radius: circle.radius || 1
202
- // };
203
-
204
- // //const draw = _debug_.fs.draw;
205
-
206
- // drawFs.circle(g, circle2, 'blue thin10 nofill', showDelay);
207
- // drawFs.crossHair(g, circle.center, 'red thin2 nofill', 2, showDelay);
208
-
209
- // if (showSpokes) {
210
- // drawFs.line(g, [threeProng.poss[0].p, circle.center], 'blue thin5 nofill', showDelay);
211
- // drawFs.line(g, [threeProng.poss[1].p, circle.center], 'blue thin5 nofill', showDelay);
212
- // drawFs.line(g, [threeProng.poss[2].p, circle.center], 'blue thin5 nofill', showDelay);
213
- // }
214
-
215
-
216
- // if (showBoundaries) {
217
- // const boundaries = threeProng.boundaries;
218
- // const boundaryS = boundaries[0];
219
- // const boundaryE = boundaries[boundaries.length-1];
220
-
221
- // drawFs.beziers(g, boundaryS, 'red thin20 nofill', showDelay);
222
- // for (let i=1; i<boundaries.length-1; i++) {
223
- // const boundary = boundaries[i];
224
- // drawFs.beziers(g, boundary, 'green thin20 nofill', showDelay);
225
- // }
226
- // drawFs.beziers(g, boundaryE, 'blue thin20 nofill', showDelay);
227
- // }
228
-
229
- // if (showTrace) {
230
- // const traces = threeProng.traces;
231
- // for (const trace of traces) {
232
- // drawFs.polyline(g, trace, 'red thin5 nofill', showDelay)
233
- // }
234
- // }
235
- // }
236
- // }
237
-
238
-
239
- // /** @internal */
240
- // const threeProngDebugFunctions: IThreeProngDebugFunctions = {
241
- // drawSpokes,
242
- // traceConvergence,
243
- // showBoundary,
244
- // logδs,
245
- // logNearest
246
- // }
247
-
248
-
249
- // export { threeProngDebugFunctions }