flo-mat 4.1.4 → 5.0.1

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 (379) 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/circle-identity.spec.ts +56 -0
  4. package/__tests__/cp-node/fs/get-all-on-loop-by-loop.spec.ts +55 -0
  5. package/__tests__/cp-node/fs/get-angle-between-mat-curves.spec.ts +39 -3
  6. package/__tests__/cp-node/fs/get-boundary-bezier-parts-to-next.spec.ts +87 -3
  7. package/__tests__/cp-node/fs/get-boundary-beziers-between.spec.ts +68 -3
  8. package/__tests__/cp-node/fs/get-boundary-beziers-to-next.spec.ts +41 -3
  9. package/__tests__/cp-node/fs/get-boundary-distance-to-next.spec.ts +20 -3
  10. package/__tests__/cp-node/fs/get-branch-beziers.spec.ts +42 -3
  11. package/__tests__/cp-node/fs/get-branch.spec.ts +60 -3
  12. package/__tests__/cp-node/fs/get-cp-node-ordering.spec.ts +19 -3
  13. package/__tests__/cp-node/fs/get-distance-to-next.spec.ts +37 -4
  14. package/__tests__/cp-node/fs/get-edge-direction.spec.ts +50 -3
  15. package/__tests__/cp-node/fs/get-first-exit.spec.ts +78 -3
  16. package/__tests__/cp-node/fs/get-hole-closers.spec.ts +32 -3
  17. package/__tests__/cp-node/fs/get-implied-boundary-bezier-between.spec.ts +48 -3
  18. package/__tests__/cp-node/fs/get-mat-curve-between.spec.ts +77 -3
  19. package/__tests__/cp-node/fs/get-mat-curve-to-next.spec.ts +17 -4
  20. package/__tests__/cp-node/fs/get-mat-curves-between.spec.ts +38 -3
  21. package/__tests__/cp-node/fs/get-salience.spec.ts +68 -3
  22. package/__tests__/cp-node/fs/get-vertex-forward-children.spec.ts +40 -3
  23. package/__tests__/cp-node/fs/insert-cp-node.spec.ts +87 -3
  24. package/__tests__/cp-node/fs/is-special.spec.ts +1 -1
  25. package/__tests__/cp-node/fs/remove-cp-node.spec.ts +42 -3
  26. package/__tests__/find-2-prong/calc-seperation-tolerance.spec.ts +46 -0
  27. package/__tests__/find-2-prong/get-medial/dd-get-medial-point-coeffs-same-curve.spec.ts +7 -5
  28. package/__tests__/find-2-prong/get-medial/dd-get-medial-point-coeffs.spec.ts +4 -2
  29. package/__tests__/find-2-prong/get-medial/get-closest-points.spec.ts +1 -1
  30. package/__tests__/floyd-warshall/get-graph.spec.ts +100 -0
  31. package/__tests__/get-mats-with-hole.ts +28 -0
  32. package/__tests__/get-mats1.spec.ts +61 -0
  33. package/__tests__/get-mats1.ts +75 -67
  34. package/__tests__/helpers/cp-node-by-id.ts +27 -0
  35. package/__tests__/helpers/expect-point-close.ts +42 -0
  36. package/__tests__/mat/hausdorff-distance-one-sided-exceeds.spec.ts +129 -0
  37. package/__tests__/mat/simplify-mat.spec.ts +85 -0
  38. package/__tests__/reconstruct-from-mat/reconstruct-from-mat.spec.ts +39 -0
  39. package/__tests__/specific-cases/test-svgs/achispado.svg +14 -0
  40. package/__tests__/utils/get-beziers-from-tangents.spec.ts +142 -0
  41. package/browser/index.js +17882 -13800
  42. package/browser/index.min.js +1 -1
  43. package/node/add-n-prong.ts/join-spokes.js +3 -2
  44. package/node/add-n-prong.ts/join-spokes.js.map +1 -1
  45. package/node/closest-boundary-point/cull-curve-pieces.d.ts +21 -0
  46. package/node/closest-boundary-point/cull-curve-pieces.js +40 -0
  47. package/node/closest-boundary-point/cull-curve-pieces.js.map +1 -0
  48. package/node/closest-boundary-point/get-close-boundary-points-certified.js +5 -2
  49. package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -1
  50. package/node/closest-boundary-point/get-endpoint-info.d.ts +39 -0
  51. package/node/closest-boundary-point/get-endpoint-info.js +78 -0
  52. package/node/closest-boundary-point/get-endpoint-info.js.map +1 -0
  53. package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js +5 -19
  54. package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js.map +1 -1
  55. package/node/closest-boundary-point/root-interval-to-distance-squared-interval.d.ts +17 -5
  56. package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js +37 -50
  57. package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js.map +1 -1
  58. package/node/corner/get-corner.d.ts +18 -1
  59. package/node/corner/get-corner.js +8 -1
  60. package/node/corner/get-corner.js.map +1 -1
  61. package/node/corner/get-interface-ccw.js.map +1 -1
  62. package/node/cp-node/cp-node.d.ts +4 -3
  63. package/node/cp-node/fs/enhance-cp-node.d.ts +9 -9
  64. package/node/cp-node/fs/get-all-on-loop-by-loop.js +0 -4
  65. package/node/cp-node/fs/get-all-on-loop-by-loop.js.map +1 -1
  66. package/node/cp-node/fs/get-angle-between-mat-curves.d.ts +1 -1
  67. package/node/cp-node/fs/get-angle-between-mat-curves.js +7 -4
  68. package/node/cp-node/fs/get-angle-between-mat-curves.js.map +1 -1
  69. package/node/cp-node/fs/get-boundary-beziers-between.d.ts +6 -4
  70. package/node/cp-node/fs/get-boundary-beziers-between.js +6 -4
  71. package/node/cp-node/fs/get-boundary-beziers-between.js.map +1 -1
  72. package/node/cp-node/fs/get-branch-beziers.d.ts +2 -1
  73. package/node/cp-node/fs/get-branch-beziers.js +3 -2
  74. package/node/cp-node/fs/get-branch-beziers.js.map +1 -1
  75. package/node/cp-node/fs/get-branch.js +1 -2
  76. package/node/cp-node/fs/get-branch.js.map +1 -1
  77. package/node/cp-node/fs/get-distance-to-next.js +4 -2
  78. package/node/cp-node/fs/get-distance-to-next.js.map +1 -1
  79. package/node/cp-node/fs/get-edge-direction.js +3 -2
  80. package/node/cp-node/fs/get-edge-direction.js.map +1 -1
  81. package/node/cp-node/fs/get-first-exit.d.ts +7 -3
  82. package/node/cp-node/fs/get-first-exit.js +13 -11
  83. package/node/cp-node/fs/get-first-exit.js.map +1 -1
  84. package/node/cp-node/fs/get-implied-boundary-bezier-between.d.ts +10 -2
  85. package/node/cp-node/fs/get-implied-boundary-bezier-between.js +11 -54
  86. package/node/cp-node/fs/get-implied-boundary-bezier-between.js.map +1 -1
  87. package/node/cp-node/fs/get-mat-curve-between.d.ts +5 -3
  88. package/node/cp-node/fs/get-mat-curve-between.js +6 -49
  89. package/node/cp-node/fs/get-mat-curve-between.js.map +1 -1
  90. package/node/cp-node/fs/get-mat-curve-to-next.d.ts +1 -1
  91. package/node/cp-node/fs/get-mat-curves-between.d.ts +8 -0
  92. package/node/cp-node/fs/get-mat-curves-between.js +9 -2
  93. package/node/cp-node/fs/get-mat-curves-between.js.map +1 -1
  94. package/node/cp-node/fs/get-real-prong-count.d.ts +2 -1
  95. package/node/cp-node/fs/get-real-prong-count.js +11 -5
  96. package/node/cp-node/fs/get-real-prong-count.js.map +1 -1
  97. package/node/cp-node/fs/get-salience.d.ts +10 -0
  98. package/node/cp-node/fs/get-salience.js +17 -1
  99. package/node/cp-node/fs/get-salience.js.map +1 -1
  100. package/node/cp-node/fs/is-fully-terminating.d.ts +4 -2
  101. package/node/cp-node/fs/is-fully-terminating.js +6 -17
  102. package/node/cp-node/fs/is-fully-terminating.js.map +1 -1
  103. package/node/cp-node/fs/is-on-same-circle.d.ts +3 -0
  104. package/node/cp-node/fs/is-on-same-circle.js +4 -4
  105. package/node/cp-node/fs/is-on-same-circle.js.map +1 -1
  106. package/node/cp-node/fs/is-on-same-loop.d.ts +1 -1
  107. package/node/cp-node/fs/is-special.d.ts +7 -0
  108. package/node/cp-node/fs/is-special.js +9 -2
  109. package/node/cp-node/fs/is-special.js.map +1 -1
  110. package/node/cp-node/fs/is-vertex.d.ts +1 -1
  111. package/node/cp-node/fs/traverse-edges.d.ts +7 -3
  112. package/node/cp-node/fs/traverse-edges.js +7 -3
  113. package/node/cp-node/fs/traverse-edges.js.map +1 -1
  114. package/node/cp-node/stringification/from-stringifyable.d.ts +2 -2
  115. package/node/cp-node/stringification/from-stringifyable.js +17 -1
  116. package/node/cp-node/stringification/from-stringifyable.js.map +1 -1
  117. package/node/cp-node/stringification/to-stringifyable.d.ts +3 -3
  118. package/node/cp-node/stringification/to-stringifyable.js +3 -3
  119. package/node/debug/debug.d.ts +26 -3
  120. package/node/debug/debug.js +16 -5
  121. package/node/debug/debug.js.map +1 -1
  122. package/node/find-2-prong/add-2-prong.js +7 -9
  123. package/node/find-2-prong/add-2-prong.js.map +1 -1
  124. package/node/find-2-prong/calc-seperation-tolerance.d.ts +28 -5
  125. package/node/find-2-prong/calc-seperation-tolerance.js +32 -89
  126. package/node/find-2-prong/calc-seperation-tolerance.js.map +1 -1
  127. package/node/find-2-prong/find-2-prong.js +8 -10
  128. package/node/find-2-prong/find-2-prong.js.map +1 -1
  129. package/node/find-2-prong/find-and-add-2-prongs.js +2 -2
  130. package/node/find-2-prong/find-and-add-2-prongs.js.map +1 -1
  131. package/node/find-2-prong/get-medial/get-antipodal-points.d.ts +1 -2
  132. package/node/find-2-prong/get-medial/get-antipodal-points.js +2 -3
  133. package/node/find-2-prong/get-medial/get-antipodal-points.js.map +1 -1
  134. package/node/find-2-prong/get-medial/get-closest-points.d.ts +1 -8
  135. package/node/find-2-prong/get-medial/get-closest-points.js +4 -40
  136. package/node/find-2-prong/get-medial/get-closest-points.js.map +1 -1
  137. package/node/find-2-prong/reduce-radius.d.ts +1 -1
  138. package/node/find-2-prong/reduce-radius.js +6 -3
  139. package/node/find-2-prong/reduce-radius.js.map +1 -1
  140. package/node/find-3-prong/calc-better-x.js +1 -1
  141. package/node/find-3-prong/calc-better-x.js.map +1 -1
  142. package/node/find-3-prong/find-3-prong-for-delta3s.d.ts +3 -2
  143. package/node/find-3-prong/find-3-prong-for-delta3s.js +36 -42
  144. package/node/find-3-prong/find-3-prong-for-delta3s.js.map +1 -1
  145. package/node/find-3-prong/find-3-prong.js +3 -1
  146. package/node/find-3-prong/find-3-prong.js.map +1 -1
  147. package/node/find-3-prong/find-and-add-3-prongs.js +16 -0
  148. package/node/find-3-prong/find-and-add-3-prongs.js.map +1 -1
  149. package/node/find-mat/create-initial-cp-tree.js +2 -2
  150. package/node/find-mat/create-initial-cp-tree.js.map +1 -1
  151. package/node/find-mat/find-mat.js +3 -4
  152. package/node/find-mat/find-mat.js.map +1 -1
  153. package/node/find-mat/find-mats.d.ts +6 -12
  154. package/node/find-mat/find-mats.js +10 -27
  155. package/node/find-mat/find-mats.js.map +1 -1
  156. package/node/find-mat/get-dull-corners-on-loop.js +2 -2
  157. package/node/find-mat/get-dull-corners-on-loop.js.map +1 -1
  158. package/node/find-mat/get-for-1-prongs-on-loop.js +36 -8
  159. package/node/find-mat/get-for-1-prongs-on-loop.js.map +1 -1
  160. package/node/find-mat/get-meta.d.ts +14 -4
  161. package/node/find-mat/get-meta.js +30 -24
  162. package/node/find-mat/get-meta.js.map +1 -1
  163. package/node/find-mat/get-sharp-corners.js +2 -2
  164. package/node/find-mat/get-sharp-corners.js.map +1 -1
  165. package/node/find-mat/mat-options.d.ts +2 -2
  166. package/node/floyd-warshall/get-graph.d.ts +12 -1
  167. package/node/floyd-warshall/get-graph.js +41 -38
  168. package/node/floyd-warshall/get-graph.js.map +1 -1
  169. package/node/geometry/get-bounding-box-.d.ts +16 -2
  170. package/node/geometry/get-bounding-box-.js +5 -2
  171. package/node/geometry/get-bounding-box-.js.map +1 -1
  172. package/node/geometry/get-closest-square-distance-to-rect.d.ts +3 -0
  173. package/node/geometry/get-closest-square-distance-to-rect.js +7 -5
  174. package/node/geometry/get-closest-square-distance-to-rect.js.map +1 -1
  175. package/node/geometry/get-closest-squared-distance-to-rotated-rect.d.ts +4 -0
  176. package/node/geometry/get-closest-squared-distance-to-rotated-rect.js +12 -5
  177. package/node/geometry/get-closest-squared-distance-to-rotated-rect.js.map +1 -1
  178. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.js +1 -2
  179. package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.js.map +1 -1
  180. package/node/index.d.ts +3 -2
  181. package/node/index.js +2 -1
  182. package/node/index.js.map +1 -1
  183. package/node/mat/clone-mat.d.ts +9 -0
  184. package/node/mat/clone-mat.js +17 -0
  185. package/node/mat/clone-mat.js.map +1 -0
  186. package/node/mat/clone-meta.d.ts +12 -0
  187. package/node/mat/clone-meta.js +24 -0
  188. package/node/mat/clone-meta.js.map +1 -0
  189. package/node/mat/get-boundary-piece-beziers.d.ts +5 -0
  190. package/node/mat/get-boundary-piece-beziers.js +7 -93
  191. package/node/mat/get-boundary-piece-beziers.js.map +1 -1
  192. package/node/mat/get-closeby-cp-if-exist.js +2 -1
  193. package/node/mat/get-closeby-cp-if-exist.js.map +1 -1
  194. package/node/mat/get-largest-3-prong.d.ts +6 -0
  195. package/node/mat/get-largest-3-prong.js +8 -5
  196. package/node/mat/get-largest-3-prong.js.map +1 -1
  197. package/node/mat/get-largest-vertex.d.ts +15 -1
  198. package/node/mat/get-largest-vertex.js +20 -7
  199. package/node/mat/get-largest-vertex.js.map +1 -1
  200. package/node/mat/hausdorff-distance-one-sided-exceeds.d.ts +79 -0
  201. package/node/mat/hausdorff-distance-one-sided-exceeds.js +251 -0
  202. package/node/mat/hausdorff-distance-one-sided-exceeds.js.map +1 -0
  203. package/node/mat/mat-meta.d.ts +0 -6
  204. package/node/mat/simplify-mat.d.ts +25 -8
  205. package/node/mat/simplify-mat.js +182 -53
  206. package/node/mat/simplify-mat.js.map +1 -1
  207. package/node/mat/trim-mat.d.ts +4 -2
  208. package/node/mat/trim-mat.js +3 -1
  209. package/node/mat/trim-mat.js.map +1 -1
  210. package/node/point-on-shape/get-boundary-tangent-line.d.ts +19 -0
  211. package/node/point-on-shape/get-boundary-tangent-line.js +33 -0
  212. package/node/point-on-shape/get-boundary-tangent-line.js.map +1 -0
  213. package/node/point-on-shape/get-osculating-circle.d.ts +6 -4
  214. package/node/point-on-shape/get-osculating-circle.js +6 -4
  215. package/node/point-on-shape/get-osculating-circle.js.map +1 -1
  216. package/node/point-on-shape/get-pos-corner.js +2 -2
  217. package/node/point-on-shape/get-pos-corner.js.map +1 -1
  218. package/node/point-on-shape/point-on-shape.d.ts +5 -0
  219. package/node/reconstruct-from-mat/reconstruct-from-mat.js +20 -80
  220. package/node/reconstruct-from-mat/reconstruct-from-mat.js.map +1 -1
  221. package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.d.ts +4 -0
  222. package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js +4 -0
  223. package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js.map +1 -1
  224. package/node/sat/cull.d.ts +7 -6
  225. package/node/sat/cull.js +13 -16
  226. package/node/sat/cull.js.map +1 -1
  227. package/node/sat/get-sat-culls.d.ts +12 -2
  228. package/node/sat/get-sat-culls.js +21 -16
  229. package/node/sat/get-sat-culls.js.map +1 -1
  230. package/node/svg/get-shape-bounds.d.ts +1 -12
  231. package/node/svg/get-shape-bounds.js +2 -3
  232. package/node/svg/get-shape-bounds.js.map +1 -1
  233. package/node/sweep-line/sweep-line.js.map +1 -1
  234. package/node/utils/get-beziers-from-tangents.d.ts +28 -0
  235. package/node/utils/get-beziers-from-tangents.js +92 -0
  236. package/node/utils/get-beziers-from-tangents.js.map +1 -0
  237. package/node/vertex/remove-vertex.d.ts +5 -3
  238. package/node/vertex/remove-vertex.js +5 -3
  239. package/node/vertex/remove-vertex.js.map +1 -1
  240. package/package.json +16 -16
  241. package/qv-infinite-loop.md +120 -0
  242. package/src/add-n-prong.ts/join-spokes.ts +4 -2
  243. package/src/closest-boundary-point/cull-curve-pieces.ts +49 -0
  244. package/src/closest-boundary-point/get-close-boundary-points-certified.ts +5 -2
  245. package/src/closest-boundary-point/get-endpoint-info.ts +96 -0
  246. package/src/closest-boundary-point/get-potential-closest-points-on-curve-certified.ts +5 -23
  247. package/src/closest-boundary-point/root-interval-to-distance-squared-interval.ts +42 -60
  248. package/src/corner/get-corner.ts +10 -1
  249. package/src/corner/get-interface-ccw.ts +2 -2
  250. package/src/cp-node/cp-node.ts +4 -3
  251. package/src/cp-node/fs/get-all-on-loop-by-loop.ts +0 -4
  252. package/src/cp-node/fs/get-angle-between-mat-curves.ts +9 -5
  253. package/src/cp-node/fs/get-boundary-beziers-between.ts +10 -8
  254. package/src/cp-node/fs/get-branch-beziers.ts +3 -2
  255. package/src/cp-node/fs/get-branch.ts +1 -2
  256. package/src/cp-node/fs/get-distance-to-next.ts +4 -2
  257. package/src/cp-node/fs/get-edge-direction.ts +4 -2
  258. package/src/cp-node/fs/get-first-exit.ts +15 -14
  259. package/src/cp-node/fs/get-implied-boundary-bezier-between.ts +18 -70
  260. package/src/cp-node/fs/get-mat-curve-between.ts +10 -67
  261. package/src/cp-node/fs/get-mat-curves-between.ts +9 -2
  262. package/src/cp-node/fs/get-real-prong-count.ts +11 -7
  263. package/src/cp-node/fs/get-salience.ts +15 -2
  264. package/src/cp-node/fs/is-fully-terminating.ts +6 -22
  265. package/src/cp-node/fs/is-on-same-circle.ts +6 -7
  266. package/src/cp-node/fs/is-on-same-loop.ts +2 -2
  267. package/src/cp-node/fs/is-special.ts +11 -6
  268. package/src/cp-node/fs/is-vertex.ts +1 -1
  269. package/src/cp-node/fs/traverse-edges.ts +8 -4
  270. package/src/cp-node/stringification/from-stringifyable.ts +75 -58
  271. package/src/cp-node/stringification/to-stringifyable.ts +3 -3
  272. package/src/debug/debug.ts +44 -8
  273. package/src/find-2-prong/add-2-prong.ts +9 -11
  274. package/src/find-2-prong/calc-seperation-tolerance.ts +34 -115
  275. package/src/find-2-prong/find-2-prong.ts +9 -11
  276. package/src/find-2-prong/find-and-add-2-prongs.ts +2 -2
  277. package/src/find-2-prong/get-medial/get-antipodal-points.ts +1 -3
  278. package/src/find-2-prong/get-medial/get-closest-points.ts +6 -51
  279. package/src/find-2-prong/reduce-radius.ts +6 -4
  280. package/src/find-3-prong/calc-better-x.ts +2 -2
  281. package/src/find-3-prong/find-3-prong-for-delta3s.ts +197 -214
  282. package/src/find-3-prong/find-3-prong.ts +54 -51
  283. package/src/find-3-prong/find-and-add-3-prongs.ts +20 -1
  284. package/src/find-mat/create-initial-cp-tree.ts +2 -2
  285. package/src/find-mat/find-mat.ts +4 -6
  286. package/src/find-mat/find-mats.ts +83 -105
  287. package/src/find-mat/get-dull-corners-on-loop.ts +2 -2
  288. package/src/find-mat/get-for-1-prongs-on-loop.ts +40 -8
  289. package/src/find-mat/get-meta.ts +34 -39
  290. package/src/find-mat/get-sharp-corners.ts +2 -2
  291. package/src/find-mat/mat-options.ts +2 -2
  292. package/src/floyd-warshall/get-graph.ts +46 -47
  293. package/src/geometry/get-bounding-box-.ts +5 -2
  294. package/src/geometry/get-closest-square-distance-to-rect.ts +7 -7
  295. package/src/geometry/get-closest-squared-distance-to-rotated-rect.ts +15 -13
  296. package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.ts +1 -2
  297. package/src/index.ts +3 -2
  298. package/src/mat/clone-mat.ts +9 -3
  299. package/src/mat/clone-meta.ts +8 -0
  300. package/src/mat/get-boundary-piece-beziers.ts +16 -117
  301. package/src/mat/get-closeby-cp-if-exist.ts +3 -1
  302. package/src/mat/get-largest-3-prong.ts +9 -6
  303. package/src/mat/get-largest-vertex.ts +25 -9
  304. package/src/mat/hausdorff-distance-one-sided-exceeds.ts +314 -0
  305. package/src/mat/mat-meta.ts +0 -9
  306. package/src/mat/simplify-mat.ts +254 -116
  307. package/src/mat/trim-mat.ts +6 -4
  308. package/src/point-on-shape/get-boundary-tangent-line.ts +36 -0
  309. package/src/point-on-shape/get-osculating-circle.ts +7 -5
  310. package/src/point-on-shape/get-pos-corner.ts +2 -2
  311. package/src/point-on-shape/point-on-shape.ts +5 -0
  312. package/src/reconstruct-from-mat/reconstruct-from-mat.ts +22 -111
  313. package/src/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.ts +4 -0
  314. package/src/sat/cull.ts +16 -20
  315. package/src/sat/get-sat-culls.ts +28 -23
  316. package/src/svg/get-shape-bounds.ts +2 -3
  317. package/src/sweep-line/sweep-line.ts +1 -1
  318. package/src/utils/deg-to-rad.ts +4 -2
  319. package/src/utils/get-beziers-from-tangents.ts +110 -0
  320. package/src/utils/map-map.ts +1 -1
  321. package/src/utils/rad-to-deg.ts +4 -1
  322. package/src/vertex/remove-vertex.ts +5 -3
  323. package/webpack.config.cjs +7 -2
  324. package/__tests__/cp-node/fs/get-distance-between.spec.ts +0 -7
  325. package/__tests__/cp-node/fs/get-terminating-on-circle.spec.ts +0 -24
  326. package/__tests__/cp-node/fs/is-single-3-prong.spec.ts +0 -17
  327. package/__tests__/cp-node/fs/iterate-all-on-loop.spec.ts +0 -17
  328. package/__tests__/cp-node/fs/traverse-all-forward.spec.ts +0 -14
  329. package/node/closest-boundary-point/cull-bezier-pieces-1.d.ts +0 -9
  330. package/node/closest-boundary-point/cull-bezier-pieces-1.js +0 -17
  331. package/node/closest-boundary-point/cull-bezier-pieces-1.js.map +0 -1
  332. package/node/closest-boundary-point/cull-by-loose-bounding-box.d.ts +0 -13
  333. package/node/closest-boundary-point/cull-by-loose-bounding-box.js +0 -27
  334. package/node/closest-boundary-point/cull-by-loose-bounding-box.js.map +0 -1
  335. package/node/closest-boundary-point/cull-by-tight-boundary-box.d.ts +0 -11
  336. package/node/closest-boundary-point/cull-by-tight-boundary-box.js +0 -27
  337. package/node/closest-boundary-point/cull-by-tight-boundary-box.js.map +0 -1
  338. package/node/cp-node/fs/find-first.d.ts +0 -10
  339. package/node/cp-node/fs/find-first.js +0 -19
  340. package/node/cp-node/fs/find-first.js.map +0 -1
  341. package/node/debug/functions/check-ordering.d.ts +0 -4
  342. package/node/debug/functions/check-ordering.js +0 -43
  343. package/node/debug/functions/check-ordering.js.map +0 -1
  344. package/node/find-2-prong/cull-bezier-pieces.d.ts +0 -13
  345. package/node/find-2-prong/cull-bezier-pieces.js +0 -43
  346. package/node/find-2-prong/cull-bezier-pieces.js.map +0 -1
  347. package/node/floyd-warshall/get-hole-closer-pairs.d.ts +0 -8
  348. package/node/floyd-warshall/get-hole-closer-pairs.js +0 -27
  349. package/node/floyd-warshall/get-hole-closer-pairs.js.map +0 -1
  350. package/node/utils/dual-set.d.ts +0 -27
  351. package/node/utils/dual-set.js +0 -55
  352. package/node/utils/dual-set.js.map +0 -1
  353. package/node/utils/tri-map.d.ts +0 -27
  354. package/node/utils/tri-map.js +0 -49
  355. package/node/utils/tri-map.js.map +0 -1
  356. package/src/closest-boundary-point/cull-bezier-pieces-1.ts +0 -36
  357. package/src/closest-boundary-point/cull-by-loose-bounding-box.ts +0 -42
  358. package/src/closest-boundary-point/cull-by-tight-boundary-box.ts +0 -43
  359. package/src/closest-boundary-point/get-p-from-box.ts +0 -14
  360. package/src/cp-node/fs/add-distance-from.ts +0 -49
  361. package/src/cp-node/fs/get-distance-between.ts +0 -16
  362. package/src/cp-node/fs/get-terminating-on-circle.ts +0 -24
  363. package/src/cp-node/fs/is-single-3-prong.ts +0 -15
  364. package/src/cp-node/fs/iterate-all-on-loop.ts +0 -15
  365. package/src/cp-node/fs/traverse-all-forward.ts +0 -24
  366. package/src/debug/functions/draw/draw-beziers-as-single-path.ts +0 -40
  367. package/src/debug/functions/draw/draw-disk.ts +0 -34
  368. package/src/debug/functions/draw/xmlns.ts +0 -5
  369. package/src/find-2-prong/cull-bezier-pieces.ts +0 -61
  370. package/src/find-2-prong/find-and-add-2-prong.ts +0 -30
  371. package/src/find-2-prong/get-medial/get-closest-points-d.ts +0 -213
  372. package/src/find-2-prong/x-for-debugging.ts +0 -13
  373. package/src/floyd-warshall/get-hole-closer-pairs.ts +0 -35
  374. package/src/mat/get-two-prong-type.ts +0 -13
  375. package/src/point-on-shape/is-pos-dull-corner.ts +0 -18
  376. package/src/point-on-shape/is-pos-quite-dull-corner.ts +0 -18
  377. package/src/point-on-shape/is-pos-quite-sharp-corner.ts +0 -18
  378. package/src/point-on-shape/pos-to-human-string.ts +0 -18
  379. package/src/sweep-line/are-boxes-intersecting.ts +0 -37
@@ -3,6 +3,9 @@ import { CpNode } from "../cp-node.js";
3
3
  * Returns true if the 2 given `CpNode`s are on the same maximal disk
4
4
  * circle.
5
5
  *
6
+ * * O(1): all `CpNode`s on the same on-circle ring share the same `Circle`
7
+ * object, and no other ring does (see `PointOnShape.circle`)
8
+ *
6
9
  * @param cpNode1 A `CpNode`.
7
10
  * @param cpNode2 Another `CpNode`
8
11
  */
@@ -1,15 +1,15 @@
1
- import { getAllOnCircle } from "./get-all-on-circle.js";
2
1
  /**
3
2
  * Returns true if the 2 given `CpNode`s are on the same maximal disk
4
3
  * circle.
5
4
  *
5
+ * * O(1): all `CpNode`s on the same on-circle ring share the same `Circle`
6
+ * object, and no other ring does (see `PointOnShape.circle`)
7
+ *
6
8
  * @param cpNode1 A `CpNode`.
7
9
  * @param cpNode2 Another `CpNode`
8
10
  */
9
11
  function isOnSameCircle(cpNode1, cpNode2) {
10
- // const cpNodes = getAllOnCircle(cpNode1, true);
11
- const cpNodes = getAllOnCircle(cpNode1);
12
- return cpNodes.indexOf(cpNode2) >= 0;
12
+ return cpNode1.pointOnShape.circle === cpNode2.pointOnShape.circle;
13
13
  }
14
14
  export { isOnSameCircle };
15
15
  //# sourceMappingURL=is-on-same-circle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-on-same-circle.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-on-same-circle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD;;;;;;GAMG;AACH,SAAS,cAAc,CACf,OAAe,EACf,OAAe;IAEnB,iDAAiD;IACjD,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAExC,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAGD,OAAO,EAAE,cAAc,EAAE,CAAA"}
1
+ {"version":3,"file":"is-on-same-circle.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-on-same-circle.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,SAAS,cAAc,CACf,OAAe,EACf,OAAe;IAEnB,OAAO,OAAO,CAAC,YAAY,CAAC,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC;AACvE,CAAC;AAGD,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -1,3 +1,3 @@
1
- import type { CpNode } from "flo-mat";
1
+ import { CpNode } from "../cp-node.js";
2
2
  declare function isOnSameLoop(cpNode1: CpNode, cpNode2: CpNode): boolean;
3
3
  export { isOnSameLoop };
@@ -1,3 +1,10 @@
1
1
  import type { CpNode } from "../cp-node.js";
2
+ /**
3
+ * Returns `true` if the given `CpNode` is on a 'special' MAT vertex, i.e. one
4
+ * that is not a plain 2-prong: a leaf, a 3-prong (or higher) or a hole-closer.
5
+ *
6
+ * * these are the vertices that must be kept when simplifying the MAT and
7
+ * the vertices of the MAT seen as a graph
8
+ */
2
9
  declare function isSpecial(cpNode: CpNode): boolean;
3
10
  export { isSpecial };
@@ -1,7 +1,14 @@
1
1
  import { getRealProngCount } from "./get-real-prong-count.js";
2
+ /**
3
+ * Returns `true` if the given `CpNode` is on a 'special' MAT vertex, i.e. one
4
+ * that is not a plain 2-prong: a leaf, a 3-prong (or higher) or a hole-closer.
5
+ *
6
+ * * these are the vertices that must be kept when simplifying the MAT and
7
+ * the vertices of the MAT seen as a graph
8
+ */
2
9
  function isSpecial(cpNode) {
3
- return ((getRealProngCount(cpNode) !== 2) &&
4
- !cpNode.isHoleClosing);
10
+ return (getRealProngCount(cpNode) !== 2 ||
11
+ cpNode.isHoleClosing);
5
12
  }
6
13
  export { isSpecial };
7
14
  //# sourceMappingURL=is-special.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-special.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-special.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG9D,SAAS,SAAS,CACV,MAAc;IAElB,OAAO,CACH,CAAC,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC,MAAM,CAAC,aAAa,CACxB,CAAA;AACL,CAAC;AAGD,OAAO,EAAE,SAAS,EAAE,CAAA"}
1
+ {"version":3,"file":"is-special.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-special.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG9D;;;;;;GAMG;AACH,SAAS,SAAS,CAAC,MAAc;IAC7B,OAAO,CACH,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC;QAC/B,MAAM,CAAC,aAAa,CACvB,CAAC;AACN,CAAC;AAGD,OAAO,EAAE,SAAS,EAAE,CAAA"}
@@ -1,3 +1,3 @@
1
- import { CpNode } from "../cp-node.js";
1
+ import type { CpNode } from "../cp-node.js";
2
2
  declare function isVertex(f: (cpNode: CpNode) => boolean): (cpNode: CpNode) => boolean;
3
3
  export { isVertex };
@@ -1,8 +1,12 @@
1
1
  import { CpNode } from '../cp-node.js';
2
2
  /**
3
- * Traverses all edges (depth first) of the given MAT tree starting at the given
4
- * vertex (represented by a `CpNode`).
5
- * @param cpNode Any `CpNode` representing the start vertex.
3
+ * Traverses all edges of the given MAT tree exactly once each, calling the
4
+ * callback for one of the two `CpNode`s representing each edge.
5
+ *
6
+ * * the edges are visited in boundary order starting from the given `CpNode`
7
+ * (not depth first)
8
+ *
9
+ * @param cpNode Any `CpNode` on the MAT.
6
10
  * @param traverseEdgesCallback A callback function for each CpNode representing the vertex at the
7
11
  * start of an edge.
8
12
  */
@@ -1,9 +1,13 @@
1
1
  import { isTerminating } from './is-terminating.js';
2
2
  import { getAllOnLoop } from './get-all-on-loop.js';
3
3
  /**
4
- * Traverses all edges (depth first) of the given MAT tree starting at the given
5
- * vertex (represented by a `CpNode`).
6
- * @param cpNode Any `CpNode` representing the start vertex.
4
+ * Traverses all edges of the given MAT tree exactly once each, calling the
5
+ * callback for one of the two `CpNode`s representing each edge.
6
+ *
7
+ * * the edges are visited in boundary order starting from the given `CpNode`
8
+ * (not depth first)
9
+ *
10
+ * @param cpNode Any `CpNode` on the MAT.
7
11
  * @param traverseEdgesCallback A callback function for each CpNode representing the vertex at the
8
12
  * start of an edge.
9
13
  */
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-edges.js","sourceRoot":"","sources":["../../../src/cp-node/fs/traverse-edges.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD;;;;;;GAMG;AACH,SAAS,aAAa,CACd,MAAc,EACd,qBAA+C;IAEnD,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,KAAK,MAAM,IAAI,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YAChE,qBAAqB,CAAC,MAAM,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,CAAC;AACL,CAAC;AAGD,OAAO,EAAE,aAAa,EAAE,CAAA"}
1
+ {"version":3,"file":"traverse-edges.js","sourceRoot":"","sources":["../../../src/cp-node/fs/traverse-edges.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD;;;;;;;;;;GAUG;AACH,SAAS,aAAa,CACd,MAAc,EACd,qBAA+C;IAEnD,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,KAAK,MAAM,IAAI,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YAChE,qBAAqB,CAAC,MAAM,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,CAAC;AACL,CAAC;AAGD,OAAO,EAAE,aAAa,EAAE,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { CpNode } from "../cp-node";
2
- import type { CpNodeStringifyable } from "./cp-node-stringifyable";
1
+ import type { CpNode } from "../cp-node.js";
2
+ import type { CpNodeStringifyable } from "./cp-node-stringifyable.js";
3
3
  declare function fromStringifyable(cpNodesStringifyable: CpNodeStringifyable): CpNode;
4
4
  export { fromStringifyable };
@@ -1,4 +1,5 @@
1
- import { EDGES } from "./cp-node-stringifyable";
1
+ import { EDGES } from "./cp-node-stringifyable.js";
2
+ import { getAllOnCircle } from "../fs/get-all-on-circle.js";
2
3
  import { loopFromStringifyable } from './loop-from-stringifyable.js';
3
4
  function fromStringifyable(cpNodesStringifyable) {
4
5
  const { cpNodes: _cpNodes, loops: _loops } = cpNodesStringifyable;
@@ -38,6 +39,21 @@ function fromStringifyable(cpNodesStringifyable) {
38
39
  cpNode[edge] = nodeMap.get(id);
39
40
  }
40
41
  }
42
+ //--------------------------------------------------------------------------
43
+ // Third pass: one shared `Circle` object per on-circle ring, as when the
44
+ // MAT was built (the JSON gave every contact point its own copy).
45
+ //--------------------------------------------------------------------------
46
+ const done = new Set();
47
+ for (const cpNode of cpNodes) {
48
+ if (done.has(cpNode)) {
49
+ continue;
50
+ }
51
+ const { circle } = cpNode.pointOnShape;
52
+ for (const cp of getAllOnCircle(cpNode)) {
53
+ done.add(cp);
54
+ cp.pointOnShape.circle = circle;
55
+ }
56
+ }
41
57
  return cpNodes[0];
42
58
  }
43
59
  export { fromStringifyable };
@@ -1 +1 @@
1
- {"version":3,"file":"from-stringifyable.js","sourceRoot":"","sources":["../../../src/cp-node/stringification/from-stringifyable.ts"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QACpC,CAAC;IACL,CAAC;IAED,4EAA4E;IAC5E,yEAAyE;IACzE,kEAAkE;IAClE,4EAA4E;IAC5E,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC3B,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YAAC,SAAS;QAAC,CAAC;QAEnC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,YAAY,CAAC;QACvC,KAAK,MAAM,EAAE,IAAI,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;YACtC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACZ,EAAE,CAAC,YAAsC,CAAC,MAAM,GAAG,MAAM,CAAC;QAC/D,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC;AAGD,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
@@ -1,9 +1,9 @@
1
1
  import type { CpNodeStringifyable } from "./cp-node-stringifyable.js";
2
2
  import type { CpNode } from "../cp-node.js";
3
3
  /**
4
- * Returns a deep clone of this `CpNode`. Can be used to copy the MAT
5
- * since cloning a single `CpNode` necessarily implies cloning all
6
- * `CpNode`s on the same MAT tree.
4
+ * Returns a plain, acyclic representation of the entire MAT the given `CpNode`
5
+ * is part of (the `CpNode` edges replaced by ids and the boundary loops
6
+ * included) suitable for `JSON.stringify`; `fromStringifyable` reverses it.
7
7
  */
8
8
  declare function toStringifyable(cpNode: CpNode): CpNodeStringifyable;
9
9
  export { toStringifyable };
@@ -1,8 +1,8 @@
1
1
  import { loopToStringifyable } from "./loop-to-stringifyable.js";
2
2
  /**
3
- * Returns a deep clone of this `CpNode`. Can be used to copy the MAT
4
- * since cloning a single `CpNode` necessarily implies cloning all
5
- * `CpNode`s on the same MAT tree.
3
+ * Returns a plain, acyclic representation of the entire MAT the given `CpNode`
4
+ * is part of (the `CpNode` edges replaced by ids and the boundary loops
5
+ * included) suitable for `JSON.stringify`; `fromStringifyable` reverses it.
6
6
  */
7
7
  function toStringifyable(cpNode) {
8
8
  const cpNodes_ = [];
@@ -1,7 +1,8 @@
1
+ import type { Curve } from 'flo-boolean';
1
2
  /** @internal */
2
3
  interface Debug {
3
4
  /** Generated by debug object for later inspection */
4
- elems: {};
5
+ elems: Elems;
5
6
  timing: Timing;
6
7
  /**
7
8
  * These functions are meant to be used in the console, e.g. in the
@@ -10,6 +11,26 @@ interface Debug {
10
11
  fs: {};
11
12
  directives: Directives;
12
13
  }
14
+ /**
15
+ * Elements generated during `findMats` for later inspection (only available
16
+ * if debug has been enabled via `enableDebugForMat(true)`).
17
+ *
18
+ * The arrays are reset at the start of each `findMats` call and accumulate
19
+ * over all MATs found in that call, one entry per boundary bezier curve in the
20
+ * order the curves are encountered.
21
+ */
22
+ interface Elems {
23
+ /** The loose (axis-aligned) bounding box of each boundary bezier curve */
24
+ readonly looseBoundingBoxes: number[][][];
25
+ /** The tight (rotated) bounding box of each boundary bezier curve */
26
+ readonly tightBoundingBoxes: number[][][];
27
+ /** The bounding hull of each boundary bezier curve */
28
+ readonly boundingHulls: number[][][];
29
+ /** The curves whose end point forms a quite sharp corner with the next curve */
30
+ readonly sharpCorners: Curve[];
31
+ /** The curves whose end point forms a quite dull corner with the next curve */
32
+ readonly dullCorners: Curve[];
33
+ }
13
34
  /** @internal */
14
35
  interface Timing {
15
36
  holeClosers: number;
@@ -27,6 +48,8 @@ interface Directives {
27
48
  stopAfterThreeProngs: boolean;
28
49
  stopAfterThreeProngsNum: number;
29
50
  }
51
+ /** Returns a fresh (empty) set of debug `Elems`. */
52
+ declare function createEmptyElems(): Elems;
30
53
  declare function enableDebugForMat(debugOn: boolean): void;
31
- export type { Debug, Timing, Directives };
32
- export { enableDebugForMat };
54
+ export type { Debug, Elems, Timing, Directives };
55
+ export { enableDebugForMat, createEmptyElems };
@@ -1,13 +1,24 @@
1
+ /** Returns a fresh (empty) set of debug `Elems`. */
2
+ function createEmptyElems() {
3
+ return {
4
+ looseBoundingBoxes: [],
5
+ tightBoundingBoxes: [],
6
+ boundingHulls: [],
7
+ sharpCorners: [],
8
+ dullCorners: []
9
+ };
10
+ }
1
11
  function enableDebugForMat(debugOn) {
2
12
  if (!debugOn) {
3
- window._debug_ = undefined;
13
+ globalThis._debug_ = undefined;
4
14
  return;
5
15
  }
6
- let debug = window._debug_;
16
+ let debug = globalThis._debug_;
7
17
  debug = {
8
18
  ...debug,
9
19
  elems: {
10
- ...debug?.elems
20
+ ...debug?.elems,
21
+ ...createEmptyElems()
11
22
  },
12
23
  timing: {
13
24
  ...debug?.timing,
@@ -31,7 +42,7 @@ function enableDebugForMat(debugOn) {
31
42
  stopAfterThreeProngsNum: undefined,
32
43
  }
33
44
  };
34
- window._debug_ = debug;
45
+ globalThis._debug_ = debug;
35
46
  }
36
- export { enableDebugForMat };
47
+ export { enableDebugForMat, createEmptyElems };
37
48
  //# sourceMappingURL=debug.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/debug/debug.ts"],"names":[],"mappings":"AAqCA,SAAS,iBAAiB,CAAC,OAAgB;IACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACV,MAAc,CAAC,OAAO,GAAG,SAAS,CAAC;QACpC,OAAO;IACX,CAAC;IAED,IAAI,KAAK,GAAW,MAAc,CAAC,OAAO,CAAC;IAE3C,KAAK,GAAG;QACJ,GAAG,KAAK;QACR,KAAK,EAAE;YACH,GAAG,KAAK,EAAE,KAAK;SAClB;QACD,MAAM,EAAE;YACJ,GAAG,KAAK,EAAE,MAAM;YAChB,WAAW,EAAE,CAAC;YACd,aAAa,EAAE,CAAC;YAChB,WAAW,EAAE,CAAC;YACd,IAAI,EAAE,CAAC;YACP,WAAW,EAAE,CAAC;SACjB;QACD,EAAE,EAAE;YACA,GAAG,KAAK,EAAE,EAAE;SACf;QACD,UAAU,EAAE;YACR,uBAAuB;YACvB,GA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AE,SAAU;YACjC,oBAAoB,EAAE,KAAK;YAC3B,uBAAuB,EAAE,SAAU;SACtC;KACJ,CAAC;IAED,UAAkB,CAAC,OAAO,GAAG,KAAK,CAAC;AACxC,CAAC;AAID,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAA"}
@@ -20,12 +20,6 @@ function add2Prong(meta, circle, pposSource, pposAntipode, isHoleClosing) {
20
20
  : pposSource;
21
21
  const orderSource = calcPosOrder(circle.center, pposSource);
22
22
  const orderAntipode = calcPosOrder(circle.center, pposAntipode);
23
- const posAntipode = {
24
- ...pposAntipode, circle, order: orderAntipode, order2: 0
25
- };
26
- const posSource = {
27
- ...pposSource, circle, order: orderSource, order2: 0
28
- };
29
23
  // Make sure there isn't already a ContactPoint close by - it can cause
30
24
  // floating point stability issues.
31
25
  if (!!getCloseByCpIfExist(meta, pposSource, circle, orderSource, 0, 2)) {
@@ -34,7 +28,7 @@ function add2Prong(meta, circle, pposSource, pposAntipode, isHoleClosing) {
34
28
  if (!!getCloseByCpIfExist(meta, pposAntipode, circle, orderAntipode, 0, 2)) {
35
29
  return undefined;
36
30
  }
37
- const { anyFailed, cpNodes } = addToCpTree(isHoleClosing, isHoleClosing, circle, [orderSource, orderAntipode], meta, [posSource, posAntipode]);
31
+ const { anyFailed, cpNodes } = addToCpTree(isHoleClosing, isHoleClosing, circle, [orderSource, orderAntipode], meta, [pposSource, pposAntipode]);
38
32
  if (anyFailed) {
39
33
  cpNodes.forEach(cpNode => {
40
34
  if (cpNode !== undefined) {
@@ -51,15 +45,19 @@ function add2Prong(meta, circle, pposSource, pposAntipode, isHoleClosing) {
51
45
  function closeHole(meta, cpNodes) {
52
46
  const { cpTrees } = meta;
53
47
  const [cpNodeSource, cpNodeAntipode] = cpNodes;
48
+ // The twins form their own on-circle ring (a separate MAT vertex - that
49
+ // is what cuts the hole), so they get their own (equal) `Circle` object:
50
+ // one `Circle` object per ring.
51
+ const twinCircle = { ...cpNodeSource.pointOnShape.circle };
54
52
  // Antipode - create and insert twin
55
53
  const posAntipode = cpNodeAntipode.pointOnShape;
56
- const cpNodeAntipodeTwin = insertCpNode(true, true, false, cpTrees.get(posAntipode.curve.loop), { ...posAntipode, order2: +1 }, cpNodeAntipode, undefined, // unused
54
+ const cpNodeAntipodeTwin = insertCpNode(true, true, false, cpTrees.get(posAntipode.curve.loop), { ...posAntipode, circle: twinCircle, order2: +1 }, cpNodeAntipode, undefined, // unused
57
55
  meta.lastInsertId);
58
56
  cpNodeAntipodeTwin.holeCloserTwin = cpNodeAntipode;
59
57
  cpNodeAntipode.holeCloserTwin = cpNodeAntipodeTwin;
60
58
  // Source - create and insert twin
61
59
  const posSource = cpNodeSource.pointOnShape;
62
- const cpNodeSourceTwin = insertCpNode(true, true, false, cpTrees.get(posSource.curve.loop), { ...posSource, order2: -1 }, cpNodeSource.prev, undefined, // unused
60
+ const cpNodeSourceTwin = insertCpNode(true, true, false, cpTrees.get(posSource.curve.loop), { ...posSource, circle: twinCircle, order2: -1 }, cpNodeSource.prev, undefined, // unused
63
61
  meta.lastInsertId);
64
62
  cpNodeSourceTwin.holeCloserTwin = cpNodeSource;
65
63
  cpNodeSource.holeCloserTwin = cpNodeSourceTwin;
@@ -1 +1 @@
1
- {"version":3,"file":"add-2-prong.js","sourceRoot":"","sources":["../../src/find-2-prong/add-2-prong.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAG/D;;;;;;;;;;GAUG;AACH,SAAS,SAAS,CACV,IAAa,EACb,MAAc,EACd,UAA2B,EAC3B,YAA6B,EAC7B,aAAsB;IAE1B,UAAU,GAAG,UAAU,C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AAkB,CAAC;IAC3C,kBAAkB,CAAC,IAAI,GAAG,gBAAgB,CAAC;AAC/C,CAAC;AAGD,OAAO,EAAE,SAAS,EAAE,CAAA"}
@@ -1,9 +1,32 @@
1
1
  /**
2
- * Calculates and returns an appropriate seperation tolerance between `CpNode`s.
2
+ * Returns the *squared* separation tolerance between the two contact points
3
+ * `y` (the source point) and `z` (the antipode) of a candidate 2-prong: if
4
+ * `|yz|²` is below it the antipode is indistinguishable (to within the error
5
+ * tolerance `δ`) from the circle merely grazing the boundary at `y` - the
6
+ * near-1-prong case - and the 2-prong should be rejected.
3
7
  *
4
- * @param R radius of the circle implied by the curvature at the boundary
8
+ * Derivation: the MAT circle (radius `r`) is tangent to the boundary at `y`
9
+ * and so is the osculating circle there (radius `R`), both centers lying on
10
+ * the inward normal at `y`. Approximating the boundary near `y` by the
11
+ * osculating circle, the MAT circle enlarged by `δ` crosses it at the angle
12
+ * `θ` (at the MAT center, measured from `y`) given by the law of cosines:
13
+ *
14
+ * cos θ = (r(R-r) - rδ - δ²/2) / ((R-r)(r+δ))
15
+ *
16
+ * Points of the MAT circle within that angle of `y` are within `δ` of the
17
+ * boundary. The chord `|yz|` subtending `θ` is `2r·sin(θ/2)`, and since
18
+ * `2sin²(θ/2) = 1 - cos θ = (Rδ + δ²/2) / ((R-r)(r+δ))` the squared chord is
19
+ *
20
+ * |yz|² = r²(2Rδ + δ²) / ((R-r)(r+δ))
21
+ *
22
+ * which is what is returned - in closed form, without the cancellation that
23
+ * recovering a tiny `θ` from `cos θ` suffers from.
24
+ *
25
+ * @param R radius of the osculating circle of the boundary at `y`
5
26
  * @param r radius of the MAT circle
6
- * @param θ angle between point...
27
+ * @param δ the error tolerance on distances
28
+ *
29
+ * @internal
7
30
  */
8
- declare function calcSeperationTolerance(R: number, r: number, δ: number): number;
9
- export { calcSeperationTolerance };
31
+ declare function calcSquaredSeperationTolerance(R: number, r: number, δ: number): number;
32
+ export { calcSquaredSeperationTolerance };
@@ -1,97 +1,40 @@
1
- import { ddAddDd, twoProduct, ddDiffDd, ddDivDd, twoDiff, ddMultDouble1 } from 'double-double';
2
- const tp = twoProduct;
3
- const qaq = ddAddDd;
4
- const qdq = ddDiffDd;
5
- const qmd = ddMultDouble1;
6
- const { acos } = Math;
7
1
  /**
8
- * Calculates and returns an appropriate seperation tolerance between `CpNode`s.
2
+ * Returns the *squared* separation tolerance between the two contact points
3
+ * `y` (the source point) and `z` (the antipode) of a candidate 2-prong: if
4
+ * `|yz|²` is below it the antipode is indistinguishable (to within the error
5
+ * tolerance `δ`) from the circle merely grazing the boundary at `y` - the
6
+ * near-1-prong case - and the 2-prong should be rejected.
9
7
  *
10
- * @param R radius of the circle implied by the curvature at the boundary
8
+ * Derivation: the MAT circle (radius `r`) is tangent to the boundary at `y`
9
+ * and so is the osculating circle there (radius `R`), both centers lying on
10
+ * the inward normal at `y`. Approximating the boundary near `y` by the
11
+ * osculating circle, the MAT circle enlarged by `δ` crosses it at the angle
12
+ * `θ` (at the MAT center, measured from `y`) given by the law of cosines:
13
+ *
14
+ * cos θ = (r(R-r) - rδ - δ²/2) / ((R-r)(r+δ))
15
+ *
16
+ * Points of the MAT circle within that angle of `y` are within `δ` of the
17
+ * boundary. The chord `|yz|` subtending `θ` is `2r·sin(θ/2)`, and since
18
+ * `2sin²(θ/2) = 1 - cos θ = (Rδ + δ²/2) / ((R-r)(r+δ))` the squared chord is
19
+ *
20
+ * |yz|² = r²(2Rδ + δ²) / ((R-r)(r+δ))
21
+ *
22
+ * which is what is returned - in closed form, without the cancellation that
23
+ * recovering a tiny `θ` from `cos θ` suffers from.
24
+ *
25
+ * @param R radius of the osculating circle of the boundary at `y`
11
26
  * @param r radius of the MAT circle
12
- * @param θ angle between point...
27
+ * @param δ the error tolerance on distances
28
+ *
29
+ * @internal
13
30
  */
14
- function calcSeperationTolerance(R, r, δ) {
15
- const a = r + δ;
16
- if (a >= R) {
31
+ function calcSquaredSeperationTolerance(R, r, δ) {
32
+ if (r + δ >= R) {
33
+ // The enlarged MAT circle is at least as large as the osculating
34
+ // circle: every point on it is within tolerance of the boundary.
17
35
  return Infinity;
18
36
  }
19
- const R_r_ = twoDiff(R, r);
20
- const A_ = qmd(r, R_r_);
21
- const N_ = qdq(qdq(A_, tp(r, δ)), tp(δ, δ / 2));
22
- const D_ = qaq(A_, qmd(δ, R_r_));
23
- const R_r = R - r;
24
- const A = r * R_r;
25
- const N = A - r * δ - (δ * δ) / 2;
26
- const D = A + R_r * δ;
27
- const cosC = N / D;
28
- const Q = ddDivDd(N_, D_)[1];
29
- // const Q = N_[1]/D_[1];
30
- const C = acos(cosC);
31
- const CC = acos(Q);
32
- const θ = CC;
33
- // return r*θ;
34
- return r * θ;
37
+ return r * r * (2 * R * δ + δ * δ) / ((R - r) * (r + δ));
35
38
  }
36
- export { calcSeperationTolerance };
37
- // Quokka tests
38
- // /**
39
- // * Calculates and returns an appropriate seperation tolerance between `CpNode`s.
40
- // *
41
- // * @param R radius of the circle implied by the curvature at the boundary
42
- // * @param r radius of the MAT circle
43
- // * @param θ angle between point...
44
- // */
45
- // function calcSeperationTolerance2(
46
- // R: number,
47
- // r: number,
48
- // δ: number) {
49
- // const a = r + δ;
50
- // if (a >= R) {
51
- // return Infinity;
52
- // }
53
- // const b = R - r;
54
- // const c = R;
55
- // const N = c*c - a*a - b*b;
56
- // const N_ = qdq(qdq(tp(c,c), tp(a,a)), tp(b,b));
57
- // const D = 2*a*b;
58
- // const D_ = tp(-2*a,b);
59
- // const Q = ddDivDd(N_,D_)[1];
60
- // const cosC = -N/D;
61
- // const C = acos(cosC);
62
- // const CC = acos(Q);
63
- // const θ = π - CC;
64
- // return θ;
65
- // // return r*θ; // approximate arc with line
66
- // }
67
- // function degToRad(degrees: number) {
68
- // return degrees/360*2*Math.PI;
69
- // }
70
- // function radToDeg(rad: number) {
71
- // return rad*360/2/Math.PI;
72
- // }
73
- // const R = 699;
74
- // const r = 698;
75
- // const δ = 1000*2**-46;
76
- // calcSeperationTolerance(R,r,δ);
77
- // calcSeperationTolerance2(R,r,δ);
78
- // calcSeperationTolerance3(R,r,δ);
79
- // // * see https://en.wikipedia.org/wiki/Law_of_cosines, Version suited to small angles
80
- // function calcSeperationTolerance3(
81
- // R: number,
82
- // r: number,
83
- // δ: number) {
84
- // const a = r + δ;
85
- // const c = R - r;
86
- // const b = R;
87
- // // c² = (a - b)² + 4ab*sin²(θ/2) OR
88
- // // (c² - (a - b)²)/4ab = sin²(θ/2)
89
- // const cc = c*c;
90
- // const abc = a*a + b*b - 2*a*b;
91
- // const A = cc - abc;
92
- // const B = sqrt(A/(4*a*b));
93
- // const θ = 2*asin(B);
94
- // return θ;
95
- // // return r*θ; // approximate arc with line
96
- // }
39
+ export { calcSquaredSeperationTolerance };
97
40
  //# sourceMappingURL=calc-seperation-tolerance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"calc-seperation-tolerance.js","sourceRoot":"","sources":["../../src/find-2-prong/calc-seperation-tolerance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE/F,MAAM,EAAE,GAAG,UAAU,CAAC;AACtB,MAAM,GAAG,GAAG,OAAO,CAAC;AACpB,MAAM,GAAG,GAAG,QAAQ,CAAC;AACrB,MAAM,GAAG,GAAG,aAAa,CAAC;AAE1B,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;AAGtB;;;;;;GAMG;AACH,SAAS,uBAAuB,CACxB,CAAS,EACT,CAAS,EACT,CAAS;IAEb,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACT,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;IAC1B,MAAM,EAAE,GAAI,GAAG,CAAC,CAAC,EAAC,IAAI,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,6BAA6B;AAC7B,mCAAmC;AACnC,yBAAyB;AACzB,4BAA4B;AAC5B,0BAA0B;AAE1B,wBAAwB;AAExB,gBAAgB;AAChB,mDAAmD;AACnD,IAAI;AAGJ,uCAAuC;AACvC,oCAAoC;AACpC,IAAI;AACJ,mCAAmC;AACnC,gCAAgC;AAChC,IAAI;AAGJ,iBAAiB;AACjB,iBAAiB;AACjB,yBAAyB;AACzB,mCAAmC;AACnC,mCAAmC;AACnC,mCAAmC;AAEnC,wFAAwF;AACxF,qCAAqC;AACrC,qBAAqB;AACrB,qBAAqB;AACrB,uBAAuB;AAEvB,uBAAuB;AACvB,uBAAuB;AACvB,uBAAuB;AAEvB,0CAA0C;AAC1C,yCAAyC;AACzC,uBAAuB;AACvB,qCAAqC;AACrC,0BAA0B;AAC1B,iCAAiC;AAEjC,2BAA2B;AAE3B,gBAAgB;AAChB,mDAAmD;AACnD,IAAI"}
1
+ {"version":3,"file":"calc-seperation-tolerance.js","sourceRoot":"","sources":["../../src/find-2-prong/calc-seperation-tolerance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,SAAS,8BAA8B,CAC/B,CAAS,EACT,CAAS,EACT,CAAS;IAEb,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACb,iEAAiE;QACjE,iEAAiE;QACjE,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,OAAO,CAAC,GAAC,CAAC,GAAC,CAAC,CAAC,GAAC,CAAC,GAAC,CAAC,GAAG,CAAC,GAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC;AAGD,OAAO,EAAE,8BAA8B,EAAE,CAAA"}
@@ -2,10 +2,10 @@ import { getInitialCurvePieces } from './get-initial-bezier-pieces.js';
2
2
  import { getAntipodalPoints } from './get-medial/get-antipodal-points.js';
3
3
  import { reduceRadius } from './reduce-radius.js';
4
4
  import { squaredDistanceBetweenDd } from './squared-distance-between-dd.js';
5
- import { cullCurvePieces } from './cull-bezier-pieces.js';
5
+ import { cullCurvePieces } from '../closest-boundary-point/cull-curve-pieces.js';
6
6
  import { add1Prong } from './add-1-prong.js';
7
7
  import { toP } from '../point-on-shape/to-p.js';
8
- import { calcSeperationTolerance } from './calc-seperation-tolerance.js';
8
+ import { calcSquaredSeperationTolerance } from './calc-seperation-tolerance.js';
9
9
  import { getInitialX } from './get-initial-x.js';
10
10
  import { ddNormal } from 'flo-bezier3';
11
11
  import { rotate } from 'flo-vector2d';
@@ -58,18 +58,16 @@ function find2Prong(meta) {
58
58
  // the 2-prong circle. (Defined by start and end points).
59
59
  const curvePieces = getInitialCurvePieces(angle, isHoleClosing, loop, loops, meta, yPos, xO);
60
60
  // The lines below is an optimization.
61
- const xy2 = reduceRadius(maxCoordPowerOf2, rO, curvePieces, y, nnorm);
61
+ const xy2 = reduceRadius(rO, curvePieces, y, nnorm);
62
62
  const xy = sqrt(xy2);
63
63
  const l = sqrt(nnorm[0] ** 2 + nnorm[1] ** 2);
64
64
  xO = [y[0] + nnorm[0] / l * xy, y[1] + nnorm[1] / l * xy];
65
- cullCurvePieces(curvePieces, xO, xy2);
66
- const antipodalPoints = getAntipodalPoints(maxCoordPowerOf2, nnorm, nnormDd, yPos, for1Prong, angle, curvePieces);
65
+ // (the extra multiplier accounts for floating point error)
66
+ const culledCurvePieces = cullCurvePieces(curvePieces, xO, (1 + 2 ** -20) * xy2);
67
+ const antipodalPoints = getAntipodalPoints(maxCoordPowerOf2, nnormDd, yPos, for1Prong, angle, culledCurvePieces);
67
68
  // FUTURE - if antipodalPoints.length > 1 let's just add an n-prong;
68
69
  if (antipodalPoints.length !== 1) {
69
70
  if (antipodalPoints.length === 0) {
70
- if (isHoleClosing) {
71
- console.log(yPos);
72
- }
73
71
  return undefined;
74
72
  }
75
73
  if (!isHoleClosing && !areAllAntipodesSame(antipodalPoints, maxCoordPowerOf2)) {
@@ -99,7 +97,7 @@ function find2Prong(meta) {
99
97
  }
100
98
  // The lines below eliminate cases where the found 2-prong is too
101
99
  // close to a one-prong
102
- const squaredSeperationTolerance = max(calcSeperationTolerance(rO, sqrt(xz), (2 ** 2) * errorTolerance), minSquaredSeperationTolerance);
100
+ const squaredSeperationTolerance = max(calcSquaredSeperationTolerance(rO, sqrt(xz), (2 ** 2) * errorTolerance), minSquaredSeperationTolerance);
103
101
  if (yz <= squaredSeperationTolerance) {
104
102
  return undefined;
105
103
  }
@@ -117,7 +115,7 @@ function areAllAntipodesSame(point, maxCoordPowerOf2) {
117
115
  // return false;
118
116
  // }
119
117
  const { x: x_ } = point[i];
120
- if (abs(x[0] - x_[0]) > tol || abs(x[0] - x_[0]) > tol) {
118
+ if (abs(x[0] - x_[0]) > tol || abs(x[1] - x_[1]) > tol) {
121
119
  return false;
122
120
  }
123
121
  }
@@ -1 +1 @@
1
- {"version":3,"file":"find-2-prong.js","sourceRoot":"","sources":["../../src/find-2-prong/find-2-prong.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;A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