flo-mat 2.0.4 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (652) hide show
  1. package/.quokka +4 -0
  2. package/browser/index.js +18434 -14538
  3. package/browser/index.min.js +1 -1
  4. package/node/closest-boundary-point/cull-bezier-pieces.d.ts +9 -0
  5. package/node/closest-boundary-point/cull-bezier-pieces.js +17 -0
  6. package/node/closest-boundary-point/cull-bezier-pieces.js.map +1 -0
  7. package/node/{mat/closest-boundary-point → closest-boundary-point}/cull-by-loose-bounding-box.d.ts +2 -2
  8. package/node/{mat/closest-boundary-point → closest-boundary-point}/cull-by-loose-bounding-box.js +2 -2
  9. package/node/closest-boundary-point/cull-by-loose-bounding-box.js.map +1 -0
  10. package/node/{mat/closest-boundary-point → closest-boundary-point}/cull-by-tight-boundary-box.d.ts +2 -2
  11. package/node/{mat/closest-boundary-point → closest-boundary-point}/cull-by-tight-boundary-box.js +1 -1
  12. package/node/closest-boundary-point/cull-by-tight-boundary-box.js.map +1 -0
  13. package/node/closest-boundary-point/dd-deflate-with-running-error.d.ts +25 -0
  14. package/node/closest-boundary-point/dd-deflate-with-running-error.js +68 -0
  15. package/node/closest-boundary-point/dd-deflate-with-running-error.js.map +1 -0
  16. package/node/closest-boundary-point/foot-and-endpoint-info.d.ts +10 -0
  17. package/node/closest-boundary-point/foot-and-endpoint-info.js +2 -0
  18. package/node/closest-boundary-point/foot-and-endpoint-info.js.map +1 -0
  19. package/node/{mat/closest-boundary-point → closest-boundary-point}/get-best-distance-squared.d.ts +2 -2
  20. package/node/{mat/closest-boundary-point → closest-boundary-point}/get-best-distance-squared.js +2 -3
  21. package/node/closest-boundary-point/get-best-distance-squared.js.map +1 -0
  22. package/node/closest-boundary-point/get-close-boundary-points-certified.d.ts +15 -0
  23. package/node/closest-boundary-point/get-close-boundary-points-certified.js +40 -0
  24. package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -0
  25. package/node/closest-boundary-point/get-closest-boundary-point-certified.d.ts +15 -0
  26. package/node/closest-boundary-point/get-closest-boundary-point-certified.js +42 -0
  27. package/node/closest-boundary-point/get-closest-boundary-point-certified.js.map +1 -0
  28. package/node/closest-boundary-point/get-p-from-box.d.ts +3 -0
  29. package/node/closest-boundary-point/get-p-from-box.js +11 -0
  30. package/node/closest-boundary-point/get-p-from-box.js.map +1 -0
  31. package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.d.ts +12 -0
  32. package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js +93 -0
  33. package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js.map +1 -0
  34. package/node/closest-boundary-point/root-interval-to-distance-squared-interval.d.ts +13 -0
  35. package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js +58 -0
  36. package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js.map +1 -0
  37. package/node/{contact-point.d.ts → contact-point/contact-point.d.ts} +3 -3
  38. package/node/{contact-point.js → contact-point/contact-point.js} +1 -5
  39. package/node/contact-point/contact-point.js.map +1 -0
  40. package/node/{compare-curvatures-at-interface.js → corner/compare-curvatures-at-interface.js} +2 -2
  41. package/node/corner/compare-curvatures-at-interface.js.map +1 -0
  42. package/node/{mat → corner}/corner.d.ts +1 -1
  43. package/node/{mat → corner}/corner.js.map +1 -1
  44. package/node/corner/get-corner.d.ts +15 -0
  45. package/node/{curve.js → corner/get-corner.js} +6 -17
  46. package/node/corner/get-corner.js.map +1 -0
  47. package/node/{get-interface-ccw.js → corner/get-interface-ccw.js} +18 -33
  48. package/node/corner/get-interface-ccw.js.map +1 -0
  49. package/node/cp-node/clone.d.ts +1 -1
  50. package/node/cp-node/clone.js +6 -4
  51. package/node/cp-node/clone.js.map +1 -1
  52. package/node/cp-node/cp-node.d.ts +196 -0
  53. package/node/cp-node/cp-node.js +249 -0
  54. package/node/cp-node/cp-node.js.map +1 -0
  55. package/node/cp-node/create-cp-node.d.ts +4 -0
  56. package/node/cp-node/create-cp-node.js +8 -0
  57. package/node/cp-node/create-cp-node.js.map +1 -0
  58. package/node/cp-node/enhance-cp-node.d.ts +24 -0
  59. package/node/cp-node/enhance-cp-node.js +20 -0
  60. package/node/cp-node/enhance-cp-node.js.map +1 -0
  61. package/node/{get-boundary-bezier-parts-to-next.js → cp-node/get-boundary-bezier-parts-to-next.js} +1 -1
  62. package/node/cp-node/get-boundary-bezier-parts-to-next.js.map +1 -0
  63. package/node/{get-boundary-beziers-to-next.d.ts → cp-node/get-boundary-beziers-to-next.d.ts} +1 -1
  64. package/node/{get-boundary-beziers-to-next.js → cp-node/get-boundary-beziers-to-next.js} +1 -1
  65. package/node/cp-node/get-boundary-beziers-to-next.js.map +1 -0
  66. package/node/cp-node/get-cp-node-ordering.d.ts +8 -0
  67. package/node/cp-node/get-cp-node-ordering.js +12 -0
  68. package/node/cp-node/get-cp-node-ordering.js.map +1 -0
  69. package/node/{get-curve-to-next.js → cp-node/get-curve-to-next.js} +1 -1
  70. package/node/cp-node/get-curve-to-next.js.map +1 -0
  71. package/node/cp-node/remove.d.ts +1 -1
  72. package/node/cp-node/traverse-cp.d.ts +12 -0
  73. package/node/cp-node/traverse-cp.js +26 -0
  74. package/node/cp-node/traverse-cp.js.map +1 -0
  75. package/node/{traverse-edges.js → cp-node/traverse-edges.js} +4 -3
  76. package/node/cp-node/traverse-edges.js.map +1 -0
  77. package/node/{traverse-vertices.js → cp-node/traverse-vertices.js} +4 -3
  78. package/node/cp-node/traverse-vertices.js.map +1 -0
  79. package/node/{curve.d.ts → curve/curve.d.ts} +4 -17
  80. package/node/curve/curve.js +14 -0
  81. package/node/curve/curve.js.map +1 -0
  82. package/node/debug/cp-node-for-debugging.d.ts +2 -2
  83. package/node/debug/debug-elem-types.d.ts +8 -8
  84. package/node/debug/debug.d.ts +6 -6
  85. package/node/debug/debug.js +2 -2
  86. package/node/debug/debug.js.map +1 -1
  87. package/node/debug/functions/draw-elem/bounding-hull.d.ts +2 -2
  88. package/node/debug/functions/draw-elem/bounding-hull.js +3 -3
  89. package/node/debug/functions/draw-elem/bounding-hull.js.map +1 -1
  90. package/node/debug/functions/draw-elem/branch.d.ts +2 -2
  91. package/node/debug/functions/draw-elem/branch.js +4 -3
  92. package/node/debug/functions/draw-elem/branch.js.map +1 -1
  93. package/node/debug/functions/draw-elem/culls.d.ts +2 -2
  94. package/node/debug/functions/draw-elem/culls.js +2 -2
  95. package/node/debug/functions/draw-elem/culls.js.map +1 -1
  96. package/node/debug/functions/draw-elem/draw-circle-percent.d.ts +1 -1
  97. package/node/debug/functions/draw-elem/draw-circle-percent.js +1 -1
  98. package/node/debug/functions/draw-elem/draw-circle-percent.js.map +1 -1
  99. package/node/debug/functions/draw-elem/draw-elem.d.ts +3 -3
  100. package/node/debug/functions/draw-elem/draw-elem.js +3 -3
  101. package/node/debug/functions/draw-elem/draw-elem.js.map +1 -1
  102. package/node/debug/functions/draw-elem/dull-corner.d.ts +3 -3
  103. package/node/debug/functions/draw-elem/dull-corner.js +3 -4
  104. package/node/debug/functions/draw-elem/dull-corner.js.map +1 -1
  105. package/node/debug/functions/draw-elem/leaves.d.ts +2 -2
  106. package/node/debug/functions/draw-elem/leaves.js +1 -1
  107. package/node/debug/functions/draw-elem/leaves.js.map +1 -1
  108. package/node/debug/functions/draw-elem/loop.d.ts +2 -2
  109. package/node/debug/functions/draw-elem/loop.js +1 -2
  110. package/node/debug/functions/draw-elem/loop.js.map +1 -1
  111. package/node/debug/functions/draw-elem/loops.d.ts +1 -1
  112. package/node/debug/functions/draw-elem/loops.js +0 -1
  113. package/node/debug/functions/draw-elem/loops.js.map +1 -1
  114. package/node/debug/functions/draw-elem/loose-bounding-box.d.ts +2 -2
  115. package/node/debug/functions/draw-elem/loose-bounding-box.js +3 -3
  116. package/node/debug/functions/draw-elem/loose-bounding-box.js.map +1 -1
  117. package/node/debug/functions/draw-elem/mat.d.ts +3 -3
  118. package/node/debug/functions/draw-elem/mat.js +9 -7
  119. package/node/debug/functions/draw-elem/mat.js.map +1 -1
  120. package/node/debug/functions/draw-elem/max-vertex.d.ts +2 -2
  121. package/node/debug/functions/draw-elem/max-vertex.js +1 -1
  122. package/node/debug/functions/draw-elem/max-vertex.js.map +1 -1
  123. package/node/debug/functions/draw-elem/min-y.d.ts +3 -3
  124. package/node/debug/functions/draw-elem/min-y.js +2 -6
  125. package/node/debug/functions/draw-elem/min-y.js.map +1 -1
  126. package/node/debug/functions/draw-elem/one-prong-at-dull-corner.d.ts +2 -2
  127. package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js +2 -2
  128. package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js.map +1 -1
  129. package/node/debug/functions/draw-elem/one-prong.d.ts +2 -2
  130. package/node/debug/functions/draw-elem/one-prong.js +6 -11
  131. package/node/debug/functions/draw-elem/one-prong.js.map +1 -1
  132. package/node/debug/functions/draw-elem/sharp-corner.d.ts +3 -3
  133. package/node/debug/functions/draw-elem/sharp-corner.js +3 -4
  134. package/node/debug/functions/draw-elem/sharp-corner.js.map +1 -1
  135. package/node/debug/functions/draw-elem/three-prong.d.ts +2 -2
  136. package/node/debug/functions/draw-elem/three-prong.js +8 -10
  137. package/node/debug/functions/draw-elem/three-prong.js.map +1 -1
  138. package/node/debug/functions/draw-elem/tight-bounding-box.d.ts +2 -2
  139. package/node/debug/functions/draw-elem/tight-bounding-box.js +3 -3
  140. package/node/debug/functions/draw-elem/tight-bounding-box.js.map +1 -1
  141. package/node/debug/functions/draw-elem/two-prong.d.ts +2 -2
  142. package/node/debug/functions/draw-elem/two-prong.js +7 -8
  143. package/node/debug/functions/draw-elem/two-prong.js.map +1 -1
  144. package/node/debug/functions/draw-elem/vertex.d.ts +4 -3
  145. package/node/debug/functions/draw-elem/vertex.js +11 -9
  146. package/node/debug/functions/draw-elem/vertex.js.map +1 -1
  147. package/node/debug/functions/general.d.ts +8 -8
  148. package/node/debug/functions/general.js +8 -8
  149. package/node/debug/functions/general.js.map +1 -1
  150. package/node/debug/functions/three-prong.d.ts +2 -2
  151. package/node/debug/functions/three-prong.js +10 -13
  152. package/node/debug/functions/three-prong.js.map +1 -1
  153. package/node/debug/functions/two-prong.d.ts +16 -5
  154. package/node/debug/functions/two-prong.js +56 -58
  155. package/node/debug/functions/two-prong.js.map +1 -1
  156. package/node/debug/three-prong-for-debugging.d.ts +6 -6
  157. package/node/debug/three-prong-for-debugging.js +1 -1
  158. package/node/debug/three-prong-for-debugging.js.map +1 -1
  159. package/node/debug/two-prong-for-debugging.d.ts +7 -7
  160. package/node/error-analysis/gamma.d.ts +26 -0
  161. package/node/error-analysis/gamma.js +35 -0
  162. package/node/error-analysis/gamma.js.map +1 -0
  163. package/node/find-2-prong/add-1-prong.d.ts +12 -0
  164. package/node/{mat/find-mat → find-2-prong}/add-1-prong.js +11 -11
  165. package/node/find-2-prong/add-1-prong.js.map +1 -0
  166. package/node/{mat/find-mat → find-2-prong}/add-2-prong.d.ts +6 -9
  167. package/node/{mat/find-mat → find-2-prong}/add-2-prong.js +26 -74
  168. package/node/find-2-prong/add-2-prong.js.map +1 -0
  169. package/node/find-2-prong/add-debug-info.d.ts +8 -0
  170. package/node/{mat/find-mat/find-2-prong → find-2-prong}/add-debug-info.js +5 -4
  171. package/node/find-2-prong/add-debug-info.js.map +1 -0
  172. package/node/find-2-prong/cull-bezier-pieces.d.ts +11 -0
  173. package/node/find-2-prong/cull-bezier-pieces.js +28 -0
  174. package/node/find-2-prong/cull-bezier-pieces.js.map +1 -0
  175. package/node/{mat/find-mat/find-2-prong → find-2-prong}/find-2-prong.d.ts +9 -13
  176. package/node/find-2-prong/find-2-prong.js +144 -0
  177. package/node/find-2-prong/find-2-prong.js.map +1 -0
  178. package/node/find-2-prong/find-and-add-2-prongs-on-all-paths.d.ts +15 -0
  179. package/node/{mat/find-mat → find-2-prong}/find-and-add-2-prongs-on-all-paths.js +5 -4
  180. package/node/find-2-prong/find-and-add-2-prongs-on-all-paths.js.map +1 -0
  181. package/node/{mat/find-mat → find-2-prong}/find-and-add-2-prongs.d.ts +5 -5
  182. package/node/find-2-prong/find-and-add-2-prongs.js +60 -0
  183. package/node/find-2-prong/find-and-add-2-prongs.js.map +1 -0
  184. package/node/{mat/find-mat → find-2-prong}/find-and-add-hole-closing-2-prongs.d.ts +3 -3
  185. package/node/{mat/find-mat → find-2-prong}/find-and-add-hole-closing-2-prongs.js +5 -5
  186. package/node/find-2-prong/find-and-add-hole-closing-2-prongs.js.map +1 -0
  187. package/node/find-2-prong/find-equidistant-point-on-line-dd.d.ts +10 -0
  188. package/node/find-2-prong/find-equidistant-point-on-line-dd.js +56 -0
  189. package/node/find-2-prong/find-equidistant-point-on-line-dd.js.map +1 -0
  190. package/node/find-2-prong/get-initial-bezier-pieces.d.ts +15 -0
  191. package/node/find-2-prong/get-initial-bezier-pieces.js +40 -0
  192. package/node/find-2-prong/get-initial-bezier-pieces.js.map +1 -0
  193. package/node/find-2-prong/reduce-radius.d.ts +8 -0
  194. package/node/find-2-prong/reduce-radius.js +72 -0
  195. package/node/find-2-prong/reduce-radius.js.map +1 -0
  196. package/node/find-2-prong/squared-distance-between-dd.d.ts +2 -0
  197. package/node/find-2-prong/squared-distance-between-dd.js +17 -0
  198. package/node/find-2-prong/squared-distance-between-dd.js.map +1 -0
  199. package/node/find-2-prong/x-for-debugging.d.ts +9 -0
  200. package/node/find-2-prong/x-for-debugging.js.map +1 -0
  201. package/node/{mat/find-mat → find-3-prong.ts}/add-3-prong.d.ts +12 -7
  202. package/node/find-3-prong.ts/add-3-prong.js +82 -0
  203. package/node/find-3-prong.ts/add-3-prong.js.map +1 -0
  204. package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-better-x.d.ts +4 -4
  205. package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-better-x.js +1 -1
  206. package/node/find-3-prong.ts/calc-better-x.js.map +1 -0
  207. package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-initial-3-prong-center.d.ts +3 -3
  208. package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-initial-3-prong-center.js +5 -7
  209. package/node/find-3-prong.ts/calc-initial-3-prong-center.js.map +1 -0
  210. package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong-for-delta3s.d.ts +6 -6
  211. package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong-for-delta3s.js +11 -12
  212. package/node/find-3-prong.ts/find-3-prong-for-delta3s.js.map +1 -0
  213. package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong.d.ts +5 -5
  214. package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong.js +52 -39
  215. package/node/find-3-prong.ts/find-3-prong.js.map +1 -0
  216. package/node/find-3-prong.ts/find-and-add-3-prongs.d.ts +5 -0
  217. package/node/find-3-prong.ts/find-and-add-3-prongs.js +74 -0
  218. package/node/find-3-prong.ts/find-and-add-3-prongs.js.map +1 -0
  219. package/node/{mat/find-mat/find-and-add-3-prongs.d.ts → find-3-prong.ts/find-and-add-all-3-prongs.d.ts} +3 -3
  220. package/node/find-3-prong.ts/find-and-add-all-3-prongs.js +66 -0
  221. package/node/find-3-prong.ts/find-and-add-all-3-prongs.js.map +1 -0
  222. package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/get-closest-points.d.ts +3 -3
  223. package/node/find-3-prong.ts/get-closest-points.js +14 -0
  224. package/node/find-3-prong.ts/get-closest-points.js.map +1 -0
  225. package/node/{mat/find-mat → find-mat}/add-debug-info.d.ts +4 -4
  226. package/node/{mat/find-mat → find-mat}/add-debug-info.js +6 -6
  227. package/node/find-mat/add-debug-info.js.map +1 -0
  228. package/node/{mat/find-mat → find-mat}/create-initial-cp-graph.d.ts +5 -5
  229. package/node/{mat/find-mat → find-mat}/create-initial-cp-graph.js +5 -6
  230. package/node/find-mat/create-initial-cp-graph.js.map +1 -0
  231. package/node/find-mat/find-mat.d.ts +10 -0
  232. package/node/find-mat/find-mat.js +57 -0
  233. package/node/find-mat/find-mat.js.map +1 -0
  234. package/node/{find-mats.d.ts → find-mat/find-mats.d.ts} +1 -1
  235. package/node/find-mat/find-mats.js +58 -0
  236. package/node/find-mat/find-mats.js.map +1 -0
  237. package/node/find-mat/fix-ordering.d.ts +8 -0
  238. package/node/find-mat/fix-ordering.js +59 -0
  239. package/node/find-mat/fix-ordering.js.map +1 -0
  240. package/node/find-mat/get-dull-corners.d.ts +5 -0
  241. package/node/find-mat/get-dull-corners.js +22 -0
  242. package/node/find-mat/get-dull-corners.js.map +1 -0
  243. package/node/find-mat/get-for-1-prongs-on-loop.d.ts +11 -0
  244. package/node/find-mat/get-for-1-prongs-on-loop.js +28 -0
  245. package/node/find-mat/get-for-1-prongs-on-loop.js.map +1 -0
  246. package/node/find-mat/get-for-2-prongs-on-loop.d.ts +11 -0
  247. package/node/find-mat/get-for-2-prongs-on-loop.js +30 -0
  248. package/node/find-mat/get-for-2-prongs-on-loop.js.map +1 -0
  249. package/node/find-mat/get-sharp-corners.d.ts +5 -0
  250. package/node/find-mat/get-sharp-corners.js +21 -0
  251. package/node/find-mat/get-sharp-corners.js.map +1 -0
  252. package/node/find-mat/get-size-params.d.ts +7 -0
  253. package/node/find-mat/get-size-params.js +33 -0
  254. package/node/find-mat/get-size-params.js.map +1 -0
  255. package/node/geometry/circle.js.map +1 -0
  256. package/node/geometry/get-bounding-box-.js.map +1 -0
  257. package/node/{mat/geometry → geometry}/get-closest-square-distance-to-rect.d.ts +1 -1
  258. package/node/{mat/geometry → geometry}/get-closest-square-distance-to-rect.js +1 -1
  259. package/node/geometry/get-closest-square-distance-to-rect.js.map +1 -0
  260. package/node/{mat/geometry → geometry}/get-closest-squared-distance-to-rotated-rect.d.ts +1 -1
  261. package/node/{mat/geometry → geometry}/get-closest-squared-distance-to-rotated-rect.js +1 -1
  262. package/node/geometry/get-closest-squared-distance-to-rotated-rect.js.map +1 -0
  263. package/node/get-curve/get-curve-between.d.ts +1 -1
  264. package/node/get-curve/get-curve-between.js +2 -2
  265. package/node/get-curve/get-curve-between.js.map +1 -1
  266. package/node/get-curve/get-edge-direction.d.ts +2 -2
  267. package/node/get-curve/get-edge-direction.js +2 -4
  268. package/node/get-curve/get-edge-direction.js.map +1 -1
  269. package/node/index.d.ts +24 -20
  270. package/node/index.js +21 -16
  271. package/node/index.js.map +1 -1
  272. package/node/loop/get-max-coordinate.d.ts +1 -1
  273. package/node/loop/get-max-coordinate.js +1 -1
  274. package/node/mat/add-to-cp-graph.d.ts +8 -7
  275. package/node/mat/add-to-cp-graph.js +6 -4
  276. package/node/mat/add-to-cp-graph.js.map +1 -1
  277. package/node/mat/bezier-piece.d.ts +2 -2
  278. package/node/mat/create-new-cp-tree.d.ts +3 -3
  279. package/node/mat/create-new-cp-tree.js +5 -7
  280. package/node/mat/create-new-cp-tree.js.map +1 -1
  281. package/node/mat/elem-type-two-prong.d.ts +1 -1
  282. package/node/mat/get-boundary-piece-beziers.d.ts +2 -2
  283. package/node/mat/get-boundary-piece-beziers.js +4 -4
  284. package/node/mat/get-boundary-piece-beziers.js.map +1 -1
  285. package/node/{get-branches.d.ts → mat/get-branches.d.ts} +1 -1
  286. package/node/{get-branches.js → mat/get-branches.js} +7 -6
  287. package/node/mat/get-branches.js.map +1 -0
  288. package/node/mat/get-largest-vertex.d.ts +2 -2
  289. package/node/mat/get-largest-vertex.js +1 -1
  290. package/node/mat/get-largest-vertex.js.map +1 -1
  291. package/node/mat/get-neighboring-cps.d.ts +6 -4
  292. package/node/mat/get-neighboring-cps.js +5 -3
  293. package/node/mat/get-neighboring-cps.js.map +1 -1
  294. package/node/mat/get-two-prong-type.d.ts +1 -1
  295. package/node/mat/get-two-prong-type.js +1 -1
  296. package/node/mat/get-two-prong-type.js.map +1 -1
  297. package/node/mat/is-another-cp-closeby.d.ts +9 -8
  298. package/node/mat/is-another-cp-closeby.js +21 -29
  299. package/node/mat/is-another-cp-closeby.js.map +1 -1
  300. package/node/{mat.d.ts → mat/mat.d.ts} +2 -2
  301. package/node/mat/mat.js.map +1 -0
  302. package/node/mat/simplify-mat-map-only.d.ts +1 -1
  303. package/node/mat/simplify-mat-map-only.js +4 -3
  304. package/node/mat/simplify-mat-map-only.js.map +1 -1
  305. package/node/{simplify-mat.d.ts → mat/simplify-mat.d.ts} +3 -5
  306. package/node/{simplify-mat.js → mat/simplify-mat.js} +11 -13
  307. package/node/mat/simplify-mat.js.map +1 -0
  308. package/node/mat/trim-mat.d.ts +1 -1
  309. package/node/mat/trim-mat.js +1 -1
  310. package/node/mat/trim-mat.js.map +1 -1
  311. package/node/point-on-shape/calc-pos-order.d.ts +13 -0
  312. package/node/point-on-shape/calc-pos-order.js +27 -0
  313. package/node/point-on-shape/calc-pos-order.js.map +1 -0
  314. package/node/point-on-shape/compare-poss.d.ts +10 -0
  315. package/node/point-on-shape/compare-poss.js +18 -0
  316. package/node/point-on-shape/compare-poss.js.map +1 -0
  317. package/node/point-on-shape/create-pos.d.ts +4 -0
  318. package/node/point-on-shape/create-pos.js +12 -0
  319. package/node/point-on-shape/create-pos.js.map +1 -0
  320. package/node/point-on-shape/get-osculating-circle.d.ts +10 -0
  321. package/node/point-on-shape/get-osculating-circle.js +25 -0
  322. package/node/point-on-shape/get-osculating-circle.js.map +1 -0
  323. package/node/point-on-shape/get-pos-corner.d.ts +7 -0
  324. package/node/point-on-shape/get-pos-corner.js +9 -0
  325. package/node/point-on-shape/get-pos-corner.js.map +1 -0
  326. package/node/point-on-shape/is-pos-corner.d.ts +6 -0
  327. package/node/point-on-shape/is-pos-corner.js +8 -0
  328. package/node/point-on-shape/is-pos-corner.js.map +1 -0
  329. package/node/point-on-shape/is-pos-dull-corner.d.ts +6 -0
  330. package/node/point-on-shape/is-pos-dull-corner.js +14 -0
  331. package/node/point-on-shape/is-pos-dull-corner.js.map +1 -0
  332. package/node/point-on-shape/is-pos-quite-sharp-corner.d.ts +6 -0
  333. package/node/point-on-shape/is-pos-quite-sharp-corner.js +14 -0
  334. package/node/point-on-shape/is-pos-quite-sharp-corner.js.map +1 -0
  335. package/node/point-on-shape/is-pos-sharp-corner.d.ts +6 -0
  336. package/node/point-on-shape/is-pos-sharp-corner.js +14 -0
  337. package/node/point-on-shape/is-pos-sharp-corner.js.map +1 -0
  338. package/node/point-on-shape/point-on-shape.d.ts +11 -0
  339. package/node/point-on-shape/point-on-shape.js +2 -0
  340. package/node/point-on-shape/point-on-shape.js.map +1 -0
  341. package/node/point-on-shape/pos-to-human-string.d.ts +8 -0
  342. package/node/point-on-shape/pos-to-human-string.js +12 -0
  343. package/node/point-on-shape/pos-to-human-string.js.map +1 -0
  344. package/node/{mat/to-scale-axis → sat}/add-debug-info.d.ts +2 -2
  345. package/node/{mat/to-scale-axis → sat}/add-debug-info.js +1 -1
  346. package/node/sat/add-debug-info.js.map +1 -0
  347. package/node/{mat/to-scale-axis → sat}/cull-non-cycles.d.ts +3 -3
  348. package/node/{mat/to-scale-axis → sat}/cull-non-cycles.js +6 -6
  349. package/node/sat/cull-non-cycles.js.map +1 -0
  350. package/node/{mat/to-scale-axis → sat}/cull.d.ts +3 -3
  351. package/node/{mat/to-scale-axis → sat}/cull.js +4 -4
  352. package/node/sat/cull.js.map +1 -0
  353. package/node/{mat → sat}/get-leaves.d.ts +2 -2
  354. package/node/sat/get-leaves.js +14 -0
  355. package/node/sat/get-leaves.js.map +1 -0
  356. package/node/{to-scale-axis.d.ts → sat/to-scale-axis.d.ts} +2 -2
  357. package/node/{to-scale-axis.js → sat/to-scale-axis.js} +11 -10
  358. package/node/sat/to-scale-axis.js.map +1 -0
  359. package/node/svg/get-loop-bounds.d.ts +7 -7
  360. package/node/svg/get-loop-bounds.js +11 -7
  361. package/node/svg/get-loop-bounds.js.map +1 -1
  362. package/node/svg/get-min-y-pos.d.ts +4 -4
  363. package/node/svg/get-min-y-pos.js +1 -1
  364. package/node/svg/get-shape-bounds.d.ts +6 -5
  365. package/node/svg/get-shape-bounds.js +6 -2
  366. package/node/svg/get-shape-bounds.js.map +1 -1
  367. package/node/sweep-line/sweep-line.d.ts +1 -1
  368. package/node/sweep-line/sweep-line.js +4 -4
  369. package/node/sweep-line/sweep-line.js.map +1 -1
  370. package/package.json +10 -10
  371. package/src/closest-boundary-point/closest-points-on-curve-precise.ts +75 -0
  372. package/src/closest-boundary-point/closest-points-on-curve.ts +72 -0
  373. package/src/closest-boundary-point/cull-bezier-pieces.ts +35 -0
  374. package/src/{mat/closest-boundary-point → closest-boundary-point}/cull-by-loose-bounding-box.ts +4 -3
  375. package/src/{mat/closest-boundary-point → closest-boundary-point}/cull-by-tight-boundary-box.ts +2 -2
  376. package/src/closest-boundary-point/dd-deflate-with-running-error.ts +88 -0
  377. package/src/closest-boundary-point/foot-and-endpoint-info.ts +16 -0
  378. package/src/{mat/closest-boundary-point → closest-boundary-point}/get-best-distance-squared.ts +3 -4
  379. package/src/closest-boundary-point/get-close-boundary-points-certified.ts +69 -0
  380. package/src/closest-boundary-point/get-closest-boundary-point-certified.ts +70 -0
  381. package/src/closest-boundary-point/get-p-from-box.ts +14 -0
  382. package/src/closest-boundary-point/get-potential-closest-points-on-curve-certified.ts +122 -0
  383. package/src/closest-boundary-point/root-interval-to-distance-squared-interval.ts +75 -0
  384. package/src/{contact-point.ts → contact-point/contact-point.ts} +4 -6
  385. package/src/{compare-curvatures-at-interface.ts → corner/compare-curvatures-at-interface.ts} +2 -2
  386. package/src/{mat → corner}/corner.ts +1 -1
  387. package/src/{curve.ts → corner/get-corner.ts} +10 -49
  388. package/src/{get-interface-ccw.ts → corner/get-interface-ccw.ts} +28 -35
  389. package/src/cp-node/clone.ts +17 -6
  390. package/src/cp-node/cp-node.ts +422 -0
  391. package/src/cp-node/create-cp-node.ts +21 -0
  392. package/src/cp-node/enhance-cp-node.ts +27 -0
  393. package/src/{get-boundary-bezier-parts-to-next.ts → cp-node/get-boundary-bezier-parts-to-next.ts} +3 -3
  394. package/src/{get-boundary-beziers-to-next.ts → cp-node/get-boundary-beziers-to-next.ts} +2 -2
  395. package/src/cp-node/get-cp-node-ordering.ts +17 -0
  396. package/src/{get-curve-to-next.ts → cp-node/get-curve-to-next.ts} +1 -1
  397. package/src/cp-node/remove.ts +1 -1
  398. package/src/cp-node/traverse-cp.ts +35 -0
  399. package/src/{traverse-edges.ts → cp-node/traverse-edges.ts} +5 -5
  400. package/src/{traverse-vertices.ts → cp-node/traverse-vertices.ts} +5 -5
  401. package/src/curve/curve.ts +46 -0
  402. package/src/debug/cp-node-for-debugging.ts +2 -2
  403. package/src/debug/debug-elem-types.ts +8 -8
  404. package/src/debug/debug.ts +11 -11
  405. package/src/debug/functions/draw-elem/bounding-hull.ts +5 -3
  406. package/src/debug/functions/draw-elem/branch.ts +4 -4
  407. package/src/debug/functions/draw-elem/culls.ts +3 -3
  408. package/src/debug/functions/draw-elem/draw-circle-percent.ts +1 -1
  409. package/src/debug/functions/draw-elem/draw-elem.ts +10 -6
  410. package/src/debug/functions/draw-elem/dull-corner.ts +10 -6
  411. package/src/debug/functions/draw-elem/leaves.ts +2 -2
  412. package/src/debug/functions/draw-elem/loop.ts +4 -3
  413. package/src/debug/functions/draw-elem/loops.ts +1 -2
  414. package/src/debug/functions/draw-elem/loose-bounding-box.ts +8 -3
  415. package/src/debug/functions/draw-elem/mat.ts +16 -8
  416. package/src/debug/functions/draw-elem/max-vertex.ts +2 -2
  417. package/src/debug/functions/draw-elem/min-y.ts +4 -9
  418. package/src/debug/functions/draw-elem/one-prong-at-dull-corner.ts +10 -2
  419. package/src/debug/functions/draw-elem/one-prong.ts +12 -15
  420. package/src/debug/functions/draw-elem/sharp-corner.ts +10 -6
  421. package/src/debug/functions/draw-elem/three-prong.ts +13 -11
  422. package/src/debug/functions/draw-elem/tight-bounding-box.ts +9 -3
  423. package/src/debug/functions/draw-elem/two-prong.ts +12 -8
  424. package/src/debug/functions/draw-elem/vertex.ts +12 -11
  425. package/src/debug/functions/general.ts +10 -10
  426. package/src/debug/functions/three-prong.ts +16 -20
  427. package/src/debug/functions/two-prong.ts +89 -77
  428. package/src/debug/three-prong-for-debugging.ts +17 -16
  429. package/src/debug/two-prong-for-debugging.ts +7 -7
  430. package/src/error-analysis/gamma.ts +41 -0
  431. package/src/{mat/find-mat → find-2-prong}/add-1-prong.ts +19 -16
  432. package/src/{mat/find-mat → find-2-prong}/add-2-prong.ts +45 -91
  433. package/src/find-2-prong/add-debug-info.ts +49 -0
  434. package/src/{mat/find-mat/find-2-prong → find-2-prong}/cull-bezier-pieces.ts +9 -11
  435. package/src/find-2-prong/find-2-prong.ts +191 -0
  436. package/src/{mat/find-mat → find-2-prong}/find-and-add-2-prongs-on-all-paths.ts +12 -9
  437. package/src/find-2-prong/find-and-add-2-prongs.ts +88 -0
  438. package/src/{mat/find-mat → find-2-prong}/find-and-add-hole-closing-2-prongs.ts +7 -7
  439. package/src/find-2-prong/find-equidistant-point-on-line-dd.ts +77 -0
  440. package/src/{mat/find-mat/find-2-prong → find-2-prong}/find-equidistant-point-on-line.ts +1 -1
  441. package/src/find-2-prong/get-initial-bezier-pieces.ts +61 -0
  442. package/src/find-2-prong/pyth-trips.ts +146 -0
  443. package/src/find-2-prong/reduce-radius.ts +98 -0
  444. package/src/find-2-prong/squared-distance-between-dd.ts +25 -0
  445. package/src/find-2-prong/x-for-debugging.ts +13 -0
  446. package/src/find-3-prong.ts/add-3-prong.ts +110 -0
  447. package/src/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-better-x.ts +5 -5
  448. package/src/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-initial-3-prong-center.ts +11 -12
  449. package/src/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong-for-delta3s.ts +28 -28
  450. package/src/find-3-prong.ts/find-3-prong.ts +148 -0
  451. package/src/find-3-prong.ts/find-and-add-3-prongs.ts +111 -0
  452. package/src/find-3-prong.ts/find-and-add-all-3-prongs.ts +109 -0
  453. package/src/find-3-prong.ts/get-closest-points.ts +24 -0
  454. package/src/{mat/find-mat → find-mat}/add-debug-info.ts +10 -10
  455. package/src/{mat/find-mat → find-mat}/create-initial-cp-graph.ts +11 -12
  456. package/src/find-mat/find-mat.ts +89 -0
  457. package/src/find-mat/find-mats.ts +83 -0
  458. package/src/find-mat/fix-ordering.ts +69 -0
  459. package/src/find-mat/get-dull-corners.ts +34 -0
  460. package/src/find-mat/get-for-1-prongs-on-loop.ts +40 -0
  461. package/src/find-mat/get-for-2-prongs-on-loop.ts +44 -0
  462. package/src/find-mat/get-sharp-corners.ts +33 -0
  463. package/src/find-mat/get-size-params.ts +34 -0
  464. package/src/{mat/find-mat → find-mat}/get-total-by.ts +4 -4
  465. package/src/{mat/geometry → geometry}/get-closest-square-distance-to-rect.ts +1 -1
  466. package/src/{mat/geometry → geometry}/get-closest-squared-distance-to-rotated-rect.ts +2 -2
  467. package/src/get-curve/get-curve-between.ts +7 -7
  468. package/src/get-curve/get-edge-direction.ts +11 -11
  469. package/src/index.ts +64 -21
  470. package/src/loop/get-max-coordinate.ts +1 -1
  471. package/src/mat/add-to-cp-graph.ts +15 -12
  472. package/src/mat/bezier-piece.ts +2 -2
  473. package/src/mat/cmp-cp-on-delta.ts +6 -3
  474. package/src/mat/create-new-cp-tree.ts +6 -9
  475. package/src/mat/elem-type-two-prong.ts +1 -1
  476. package/src/mat/get-boundary-piece-beziers.ts +7 -7
  477. package/src/{get-branches.ts → mat/get-branches.ts} +8 -8
  478. package/src/mat/get-edges-as-array.ts +2 -2
  479. package/src/mat/get-largest-three-prong.ts +3 -3
  480. package/src/mat/get-largest-vertex.ts +2 -2
  481. package/src/mat/get-neighboring-cps.ts +9 -6
  482. package/src/mat/get-two-prong-type.ts +1 -1
  483. package/src/mat/is-another-cp-closeby.ts +29 -44
  484. package/src/{mat.ts → mat/mat.ts} +2 -2
  485. package/src/mat/simplify-mat-map-only.ts +5 -5
  486. package/src/{simplify-mat.ts → mat/simplify-mat.ts} +12 -14
  487. package/src/mat/trim-mat.ts +3 -3
  488. package/src/point-on-shape/calc-pos-order.ts +35 -0
  489. package/src/point-on-shape/compare-poss.ts +26 -0
  490. package/src/point-on-shape/create-pos.ts +21 -0
  491. package/src/point-on-shape/get-osculating-circle.ts +39 -0
  492. package/src/point-on-shape/get-pos-corner.ts +16 -0
  493. package/src/point-on-shape/is-pos-corner.ts +12 -0
  494. package/src/point-on-shape/is-pos-dull-corner.ts +16 -0
  495. package/src/point-on-shape/is-pos-quite-dull-corner.ts +17 -0
  496. package/src/point-on-shape/is-pos-quite-sharp-corner.ts +17 -0
  497. package/src/point-on-shape/is-pos-sharp-corner.ts +17 -0
  498. package/src/point-on-shape/point-on-shape.ts +15 -0
  499. package/src/point-on-shape/pos-to-human-string.ts +16 -0
  500. package/src/{mat/to-scale-axis → sat}/add-debug-info.ts +3 -3
  501. package/src/{mat/to-scale-axis → sat}/cull-non-cycles.ts +7 -7
  502. package/src/{mat/to-scale-axis → sat}/cull.ts +6 -6
  503. package/src/{mat → sat}/get-leaves.ts +4 -4
  504. package/src/{mat/to-scale-axis → sat}/t-tree.ts +2 -2
  505. package/src/{to-scale-axis.ts → sat/to-scale-axis.ts} +16 -16
  506. package/src/{mat/to-scale-axis → sat}/traverse-spacial-tree.ts +5 -5
  507. package/src/svg/get-loop-bounds.ts +22 -17
  508. package/src/svg/get-min-y-pos.ts +3 -3
  509. package/src/svg/get-shape-bounds.ts +12 -9
  510. package/src/sweep-line/are-boxes-intersecting.ts +1 -1
  511. package/src/sweep-line/sweep-line.ts +7 -7
  512. package/tsconfig.json +3 -7
  513. package/wallaby.mjs +32 -0
  514. package/node/circle.js.map +0 -1
  515. package/node/compare-curvatures-at-interface.js.map +0 -1
  516. package/node/contact-point.js.map +0 -1
  517. package/node/cp-node.d.ts +0 -202
  518. package/node/cp-node.js +0 -321
  519. package/node/cp-node.js.map +0 -1
  520. package/node/curve.js.map +0 -1
  521. package/node/find-mats.js +0 -123
  522. package/node/find-mats.js.map +0 -1
  523. package/node/get-boundary-bezier-parts-to-next.js.map +0 -1
  524. package/node/get-boundary-beziers-to-next.js.map +0 -1
  525. package/node/get-bounding-box-.js.map +0 -1
  526. package/node/get-branches.js.map +0 -1
  527. package/node/get-curve-to-next.js.map +0 -1
  528. package/node/get-interface-ccw.js.map +0 -1
  529. package/node/loop.d.ts +0 -16
  530. package/node/loop.js +0 -35
  531. package/node/loop.js.map +0 -1
  532. package/node/mat/closest-boundary-point/closest-points-on-curve.d.ts +0 -14
  533. package/node/mat/closest-boundary-point/closest-points-on-curve.js +0 -73
  534. package/node/mat/closest-boundary-point/closest-points-on-curve.js.map +0 -1
  535. package/node/mat/closest-boundary-point/cull-bezier-pieces.d.ts +0 -9
  536. package/node/mat/closest-boundary-point/cull-bezier-pieces.js +0 -20
  537. package/node/mat/closest-boundary-point/cull-bezier-pieces.js.map +0 -1
  538. package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.js.map +0 -1
  539. package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.js.map +0 -1
  540. package/node/mat/closest-boundary-point/get-best-distance-squared.js.map +0 -1
  541. package/node/mat/closest-boundary-point/get-close-boundary-points.d.ts +0 -17
  542. package/node/mat/closest-boundary-point/get-close-boundary-points.js +0 -81
  543. package/node/mat/closest-boundary-point/get-close-boundary-points.js.map +0 -1
  544. package/node/mat/closest-boundary-point/get-closest-boundary-point.d.ts +0 -18
  545. package/node/mat/closest-boundary-point/get-closest-boundary-point.js +0 -41
  546. package/node/mat/closest-boundary-point/get-closest-boundary-point.js.map +0 -1
  547. package/node/mat/find-mat/add-1-prong.d.ts +0 -12
  548. package/node/mat/find-mat/add-1-prong.js.map +0 -1
  549. package/node/mat/find-mat/add-2-prong.js.map +0 -1
  550. package/node/mat/find-mat/add-3-prong.js +0 -55
  551. package/node/mat/find-mat/add-3-prong.js.map +0 -1
  552. package/node/mat/find-mat/add-debug-info.js.map +0 -1
  553. package/node/mat/find-mat/create-get-interesting-points-on-loop.d.ts +0 -11
  554. package/node/mat/find-mat/create-get-interesting-points-on-loop.js +0 -52
  555. package/node/mat/find-mat/create-get-interesting-points-on-loop.js.map +0 -1
  556. package/node/mat/find-mat/create-initial-cp-graph.js.map +0 -1
  557. package/node/mat/find-mat/find-2-prong/add-debug-info.d.ts +0 -8
  558. package/node/mat/find-mat/find-2-prong/add-debug-info.js.map +0 -1
  559. package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.d.ts +0 -11
  560. package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js +0 -30
  561. package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js.map +0 -1
  562. package/node/mat/find-mat/find-2-prong/find-2-prong.js +0 -233
  563. package/node/mat/find-mat/find-2-prong/find-2-prong.js.map +0 -1
  564. package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.d.ts +0 -9
  565. package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js +0 -40
  566. package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js.map +0 -1
  567. package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.d.ts +0 -11
  568. package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js +0 -38
  569. package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js.map +0 -1
  570. package/node/mat/find-mat/find-2-prong/x-for-debugging.d.ts +0 -9
  571. package/node/mat/find-mat/find-2-prong/x-for-debugging.js.map +0 -1
  572. package/node/mat/find-mat/find-3-prong/calc-better-x.js.map +0 -1
  573. package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.js.map +0 -1
  574. package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.js.map +0 -1
  575. package/node/mat/find-mat/find-3-prong/find-3-prong.js.map +0 -1
  576. package/node/mat/find-mat/find-3-prong/get-closest-points.js +0 -17
  577. package/node/mat/find-mat/find-3-prong/get-closest-points.js.map +0 -1
  578. package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.d.ts +0 -15
  579. package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.js.map +0 -1
  580. package/node/mat/find-mat/find-and-add-2-prongs.js +0 -74
  581. package/node/mat/find-mat/find-and-add-2-prongs.js.map +0 -1
  582. package/node/mat/find-mat/find-and-add-3-prongs.js +0 -147
  583. package/node/mat/find-mat/find-and-add-3-prongs.js.map +0 -1
  584. package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.js.map +0 -1
  585. package/node/mat/find-mat/get-potential-2-prongs.d.ts +0 -4
  586. package/node/mat/find-mat/get-potential-2-prongs.js +0 -17
  587. package/node/mat/find-mat/get-potential-2-prongs.js.map +0 -1
  588. package/node/mat/find-mat/get-sharp-corners.d.ts +0 -4
  589. package/node/mat/find-mat/get-sharp-corners.js +0 -18
  590. package/node/mat/find-mat/get-sharp-corners.js.map +0 -1
  591. package/node/mat/geometry/get-closest-square-distance-to-rect.js.map +0 -1
  592. package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.js.map +0 -1
  593. package/node/mat/get-contact-circles-at-interface.d.ts +0 -8
  594. package/node/mat/get-contact-circles-at-interface.js +0 -21
  595. package/node/mat/get-contact-circles-at-interface.js.map +0 -1
  596. package/node/mat/get-leaves.js +0 -13
  597. package/node/mat/get-leaves.js.map +0 -1
  598. package/node/mat/to-scale-axis/add-debug-info.js.map +0 -1
  599. package/node/mat/to-scale-axis/cull-non-cycles.js.map +0 -1
  600. package/node/mat/to-scale-axis/cull.js.map +0 -1
  601. package/node/mat.js.map +0 -1
  602. package/node/point-on-shape.d.ts +0 -73
  603. package/node/point-on-shape.js +0 -168
  604. package/node/point-on-shape.js.map +0 -1
  605. package/node/simplify-mat.js.map +0 -1
  606. package/node/to-scale-axis.js.map +0 -1
  607. package/node/traverse-edges.js.map +0 -1
  608. package/node/traverse-vertices.js.map +0 -1
  609. package/src/cp-node.ts +0 -388
  610. package/src/find-mats.ts +0 -171
  611. package/src/loop.ts +0 -56
  612. package/src/mat/closest-boundary-point/closest-point-on-curve-old.ts_ +0 -88
  613. package/src/mat/closest-boundary-point/closest-point-on-curve.ts_ +0 -95
  614. package/src/mat/closest-boundary-point/closest-points-on-curve.ts +0 -84
  615. package/src/mat/closest-boundary-point/cull-bezier-pieces.ts +0 -38
  616. package/src/mat/closest-boundary-point/get-close-boundary-points.ts +0 -107
  617. package/src/mat/closest-boundary-point/get-closest-boundary-point.ts +0 -64
  618. package/src/mat/find-mat/add-3-prong.ts +0 -75
  619. package/src/mat/find-mat/create-get-interesting-points-on-loop.ts +0 -73
  620. package/src/mat/find-mat/find-2-prong/add-debug-info.ts +0 -46
  621. package/src/mat/find-mat/find-2-prong/find-2-prong.ts +0 -316
  622. package/src/mat/find-mat/find-2-prong/get-initial-bezier-pieces.ts +0 -52
  623. package/src/mat/find-mat/find-2-prong/x-for-debugging.ts +0 -13
  624. package/src/mat/find-mat/find-3-prong/find-3-prong.ts +0 -106
  625. package/src/mat/find-mat/find-3-prong/get-closest-points.ts +0 -28
  626. package/src/mat/find-mat/find-and-add-2-prongs.ts +0 -108
  627. package/src/mat/find-mat/find-and-add-3-prongs.ts +0 -218
  628. package/src/mat/find-mat/get-potential-2-prongs.ts +0 -24
  629. package/src/mat/find-mat/get-sharp-corners.ts +0 -25
  630. package/src/mat/find-mat/get-total-abs-curvature.ts +0 -17
  631. package/src/mat/get-contact-circles-at-interface.ts +0 -26
  632. package/src/mat/to-scale-axis/add-to-tree.ts +0 -66
  633. package/src/mat/to-scale-axis/calc-groups.ts +0 -82
  634. package/src/mat/to-scale-axis/create-spacial-tree.ts +0 -41
  635. package/src/mat/to-scale-axis/get-engulfed-vertices.ts +0 -135
  636. package/src/point-on-shape.ts +0 -231
  637. package/src/svg/get-curvature-at-interface.ts +0 -55
  638. /package/node/{compare-curvatures-at-interface.d.ts → corner/compare-curvatures-at-interface.d.ts} +0 -0
  639. /package/node/{mat → corner}/corner.js +0 -0
  640. /package/node/{get-interface-ccw.d.ts → corner/get-interface-ccw.d.ts} +0 -0
  641. /package/node/{get-boundary-bezier-parts-to-next.d.ts → cp-node/get-boundary-bezier-parts-to-next.d.ts} +0 -0
  642. /package/node/{get-curve-to-next.d.ts → cp-node/get-curve-to-next.d.ts} +0 -0
  643. /package/node/{traverse-edges.d.ts → cp-node/traverse-edges.d.ts} +0 -0
  644. /package/node/{traverse-vertices.d.ts → cp-node/traverse-vertices.d.ts} +0 -0
  645. /package/node/{mat/find-mat/find-2-prong → find-2-prong}/x-for-debugging.js +0 -0
  646. /package/node/{circle.d.ts → geometry/circle.d.ts} +0 -0
  647. /package/node/{circle.js → geometry/circle.js} +0 -0
  648. /package/node/{get-bounding-box-.d.ts → geometry/get-bounding-box-.d.ts} +0 -0
  649. /package/node/{get-bounding-box-.js → geometry/get-bounding-box-.js} +0 -0
  650. /package/node/{mat.js → mat/mat.js} +0 -0
  651. /package/src/{circle.ts → geometry/circle.ts} +0 -0
  652. /package/src/{get-bounding-box-.ts → geometry/get-bounding-box-.ts} +0 -0
@@ -0,0 +1,70 @@
1
+ import { getObjClosestTo } from 'flo-vector2d';
2
+ import { Curve } from '../curve/curve.js';
3
+ import { PointOnShape } from '../point-on-shape/point-on-shape.js';
4
+ import { createPos } from '../point-on-shape/create-pos.js';
5
+ import { BezierPiece } from '../mat/bezier-piece.js';
6
+ import { cullBezierPieces1 } from './cull-bezier-pieces.js';
7
+ import { getPotentialClosestPointsOnCurveCertified } from './get-potential-closest-points-on-curve-certified.js';
8
+ import { squaredDistanceBetweenDd } from '../find-2-prong/squared-distance-between-dd.js';
9
+
10
+
11
+ /**
12
+ * @internal
13
+ * Returns the closest boundary point to the given point, limited to the given
14
+ * bezier pieces, including the beziers actually checked after culling.
15
+ * @param bezierPieces
16
+ * @param x
17
+ * @param touchedCurve
18
+ * @param t
19
+ * @param extreme
20
+ */
21
+ function getClosestBoundaryPointCertified(
22
+ angle: number,
23
+ bezierPieces: BezierPiece[],
24
+ x: number[],
25
+ touchedCurve: Curve,
26
+ t: number,
27
+ for1Prong: boolean) {
28
+
29
+ bezierPieces = cullBezierPieces1(bezierPieces, x);
30
+
31
+ let bestDistance = Number.POSITIVE_INFINITY;
32
+ let pos: PointOnShape;
33
+ for (let i=0; i<bezierPieces.length; i++) {
34
+ const bezierPiece = bezierPieces[i];
35
+
36
+ const ps = getPotentialClosestPointsOnCurveCertified(
37
+ bezierPiece.curve,
38
+ x,
39
+ bezierPiece.ts,
40
+ touchedCurve,
41
+ t,
42
+ for1Prong,
43
+ angle
44
+ );
45
+
46
+ const p = getObjClosestTo(x, ps, p => p.p)
47
+
48
+ if (p === undefined) { continue; }
49
+
50
+ const d = squaredDistanceBetweenDd(p.p, x);
51
+
52
+ let curve = bezierPiece.curve;
53
+ let t_= p.t;
54
+
55
+ if (d < bestDistance) {
56
+ if (t_ === 0) {
57
+ t_ = 1;
58
+ curve = bezierPiece.curve.prev;
59
+ }
60
+
61
+ pos = createPos(curve, t_, false);
62
+ bestDistance = d;
63
+ }
64
+ }
65
+
66
+ return pos!;
67
+ }
68
+
69
+
70
+ export { getClosestBoundaryPointCertified };
@@ -0,0 +1,14 @@
1
+
2
+ /** @internal */
3
+ function getPFromBox(box: number[][]) {
4
+ const tl = box[0];
5
+ const br = box[1];
6
+
7
+ return [
8
+ (tl[0] + br[0])/2,
9
+ (tl[1] + br[1])/2,
10
+ ];
11
+ }
12
+
13
+
14
+ export { getPFromBox }
@@ -0,0 +1,122 @@
1
+ import { allRootsCertified } from 'flo-poly';
2
+ import { getFootPointsOnBezierPolysCertified, getIntervalBox } from 'flo-bezier3';
3
+ import { Curve } from "../curve/curve.js";
4
+ import { ddDeflateWithRunningError } from './dd-deflate-with-running-error.js';
5
+ import { eDeflate } from 'flo-poly';
6
+ import { γγ } from '../error-analysis/gamma.js';
7
+ import { rootIntervalToDistanceSquaredInterval } from './root-interval-to-distance-squared-interval.js';
8
+ import { getPFromBox } from './get-p-from-box.js';
9
+ import { FootAndEndpointInfo } from './foot-and-endpoint-info.js';
10
+
11
+
12
+ const γγ3 = γγ(3);
13
+
14
+ const { sqrt } = Math;
15
+
16
+
17
+ /**
18
+ * @internal
19
+ * @param curve The curve
20
+ * @param x The point from which to check
21
+ * @param tRange The allowed t range
22
+ * @param touchedCurve The bezier on which p is located
23
+ * @param t The t value of the bezier that locates p
24
+ */
25
+ function getPotentialClosestPointsOnCurveCertified(
26
+ curve: Curve,
27
+ x: number[],
28
+ [tS,tE]: number[] = [0,1],
29
+ touchedCurve: Curve | undefined = undefined,
30
+ t: number | undefined = undefined,
31
+ for1Prong = false,
32
+ angle = 0): FootAndEndpointInfo[] {
33
+
34
+ const ps = curve.ps;
35
+
36
+ const shouldDeflate = angle === 0 && curve === touchedCurve;
37
+
38
+ let { polyDd: polyDdO, polyE: polyEO, getPolyExact: getPolyExactO } =
39
+ getFootPointsOnBezierPolysCertified(ps, x);
40
+
41
+ const def = shouldDeflate
42
+ ? ddDeflateWithRunningError(polyDdO, polyEO.map(e => e/γγ3), t!)
43
+ : undefined;
44
+
45
+ const def2 = for1Prong && shouldDeflate
46
+ ? ddDeflateWithRunningError(def!.coeffs, def!.errBound.map(e => e/γγ3), t!)
47
+ : undefined;
48
+
49
+ const def3 = for1Prong && shouldDeflate
50
+ ? ddDeflateWithRunningError(def2!.coeffs, def2!.errBound.map(e => e/γγ3), t!)
51
+ : undefined;
52
+
53
+ const { polyDd, polyE, getPolyExact } =
54
+ def3 !== undefined
55
+ ? { polyDd: def3.coeffs, polyE: def3.errBound.map(e => e/γγ3), getPolyExact: () => eDeflate(eDeflate(eDeflate(getPolyExactO(), t!), t!), t!) }
56
+ : def !== undefined
57
+ ? { polyDd: def.coeffs, polyE: def.errBound.map(e => e/γγ3), getPolyExact: () => eDeflate(getPolyExactO(), t!) }
58
+ : { polyDd: polyDdO, polyE: polyEO, getPolyExact: getPolyExactO };
59
+
60
+ const ris = allRootsCertified(polyDd, tS, tE, polyE, getPolyExact);
61
+
62
+ const dontPush0 = (
63
+ (t === 1 && curve === touchedCurve!.next) ||
64
+ (t === 0 && curve === touchedCurve)
65
+ );
66
+ const dontPush1 = (
67
+ (t === 0 && curve === touchedCurve!.prev) ||
68
+ (t === 1 && curve === touchedCurve)
69
+ );
70
+
71
+ if (tS === 0) {
72
+ if (!dontPush0) { ris.push({ tS: 0, tE: 0, multiplicity: 1 }); }
73
+ } else if (tS === 1) {
74
+ if (!dontPush1) { ris.push({ tS: 1, tE: 1, multiplicity: 1 }); }
75
+ } else {
76
+ ris.push({ tS: tS, tE: tS, multiplicity: 1 });
77
+ }
78
+
79
+ if (tE === 0) {
80
+ if (!dontPush0) { ris.push({ tS: 0, tE: 0, multiplicity: 1 }); }
81
+ } else if (tE === 1) {
82
+ if (!dontPush1) { ris.push({ tS: 1, tE: 1, multiplicity: 1 }); }
83
+ } else {
84
+ ris.push({ tS: tE, tE: tE, multiplicity: 1 });
85
+ }
86
+
87
+ const infos = ris
88
+ .map(ri => {
89
+ const { tS: ts, tE: te } = ri;
90
+
91
+ if (te < tS || ts > tE) {
92
+ return undefined;
93
+ }
94
+
95
+ const _t = (ts + te)/2;
96
+ const t = _t < 0 ? 0 : _t > 1 ? 1 : _t;
97
+
98
+ const box = getIntervalBox(ps, [ts, te]);
99
+ const p_ = getPFromBox(box);
100
+
101
+ const dSquaredI = rootIntervalToDistanceSquaredInterval(box, x);
102
+
103
+ const t_ = t === 0 ? 1 : t;
104
+ const curve_ = t === 0 ? curve.prev : curve;
105
+
106
+ return {
107
+ curve: curve_,
108
+ p: p_,
109
+ t: t_,
110
+ d: (sqrt(dSquaredI[0]) + sqrt(dSquaredI[1]))/2,
111
+ dSquaredI,
112
+ box,
113
+ }
114
+ });
115
+
116
+ const infos_ = infos.filter(info => info !== undefined) as FootAndEndpointInfo[];
117
+
118
+ return infos_;
119
+ }
120
+
121
+
122
+ export { getPotentialClosestPointsOnCurveCertified }
@@ -0,0 +1,75 @@
1
+ import { twoDiff, eEstimate, eMult, eAdd } from 'big-float-ts';
2
+
3
+
4
+ // We *have* to do the below to improve performance with bundlers❗ The assignee is a getter❗ The assigned is a pure function❗
5
+ const estimate = eEstimate;
6
+ const td = twoDiff;
7
+ const emult = eMult;
8
+ const eadd = eAdd;
9
+
10
+ const eps = Number.EPSILON;
11
+
12
+
13
+ /**
14
+ * Returns the distance interval squared given the root interval (currently
15
+ * ignoring multiplicity).
16
+ *
17
+ * * the result is returned as `[minPossibleSquared, maxPossibleSquared]` distance.
18
+ *
19
+ * @param box
20
+ * @param p
21
+ *
22
+ * @internal
23
+ */
24
+ function rootIntervalToDistanceSquaredInterval(
25
+ box: number[][],
26
+ p: number[]) {
27
+
28
+ const bl = box[0];
29
+ const tr = box[1];
30
+ const minX = bl[0];
31
+ const minY = bl[1];
32
+ const maxX = tr[0];
33
+ const maxY = tr[1];
34
+
35
+ const x = p[0]; // <0>
36
+ const y = p[1]; // <0>
37
+
38
+ let minDSquared = Number.POSITIVE_INFINITY;
39
+ let maxDSquared = Number.NEGATIVE_INFINITY;
40
+
41
+ // for each corner of the interval box
42
+ for (const [a,b] of [[minX,minY],[minX,maxY],[maxX,minY],[maxX,maxY]]) {
43
+ /*
44
+ // distance to 1st corner of interval box - `distance² = x² + y²`
45
+ const dc1 = (a - x)**2 + (b - y)**2;
46
+ // max absolute roundoff error of `dc1`
47
+ // <4>dc1 <-- <4>(<3>(<1>(a - x)**2) + <3>(<1>((b - y)**2))
48
+ const dc1E = 4*γ1*((a + x)**2 + (b + y)**2);
49
+ const dc1Min = dc1 - dc1E; // distance minus max error
50
+ const dc1Max = dc1 + dc1E; // distance plus max error
51
+ */
52
+
53
+ /** distance to 1st corner of interval box - `distance² = x² + y²` */
54
+ const ax = td(a,x); // a - x
55
+ const by = td(b,y); // b - y
56
+ const dc1Exact = eadd(emult(ax,ax),emult(by,by)); // ax**2 + bx**2
57
+ const dc1 = estimate(dc1Exact);
58
+
59
+ const dc1Min = dc1*(1 - eps); // distance minus max error
60
+ const dc1Max = dc1*(1 + eps); // distance plus max error
61
+
62
+ if (dc1Min <= minDSquared) {
63
+ minDSquared = dc1Min;
64
+ }
65
+
66
+ if (dc1Max >= maxDSquared) {
67
+ maxDSquared = dc1Max;
68
+ }
69
+ }
70
+
71
+ return [minDSquared,maxDSquared];
72
+ }
73
+
74
+
75
+ export { rootIntervalToDistanceSquaredInterval }
@@ -1,5 +1,6 @@
1
- import { comparePoss, IPointOnShape } from './point-on-shape.js';
2
- import { Circle } from './circle.js';
1
+ import { PointOnShape } from '../point-on-shape/point-on-shape.js';
2
+ import { comparePoss } from '../point-on-shape/compare-poss.js';
3
+ import { Circle } from '../geometry/circle.js';
3
4
 
4
5
 
5
6
  /**
@@ -8,7 +9,7 @@ import { Circle } from './circle.js';
8
9
  */
9
10
  interface ContactPoint {
10
11
  /** Identifies the point on the shape boundary. */
11
- pointOnShape: IPointOnShape;
12
+ pointOnShape: PointOnShape;
12
13
  /** The maximal disk circle touching this point. */
13
14
  circle: Circle;
14
15
  /** Internally used to order two points lying at the same planar point. */
@@ -27,11 +28,8 @@ interface ContactPoint {
27
28
  * @param b The second contact point.
28
29
  */
29
30
  function compareCps(a: ContactPoint, b: ContactPoint) {
30
- //let res = PointOnShape.compare(a.pointOnShape, b.pointOnShape);
31
31
  let res = comparePoss(a.pointOnShape, b.pointOnShape);
32
32
 
33
- if (res === undefined) { return undefined; }
34
-
35
33
  if (res !== 0) { return res; }
36
34
 
37
35
  res = a.order - b.order;
@@ -125,8 +125,8 @@ function compareCurvaturesAtInterface(
125
125
  // <=> i²b⁵ > j²d⁵
126
126
 
127
127
  // Get x′′′ and y′′′ for incoming curve evaluated at 1
128
- const [dddxI, dddyI] = toPowerBasis_3rdDerivative(psI); // max bitlength increase === max shift === 6
129
- const [dddxO, dddyO] = toPowerBasis_3rdDerivative(psO); // max bitlength increase === max shift === 6
128
+ const [[dddxI], [dddyI]] = toPowerBasis_3rdDerivative(psI); // max bitlength increase === max shift === 6
129
+ const [[dddxO], [dddyO]] = toPowerBasis_3rdDerivative(psO); // max bitlength increase === max shift === 6
130
130
 
131
131
  const e = eDiff(
132
132
  twoProduct(dxI, dddyI),
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * @hidden
3
+ * @internal
4
4
  * Represents a corner on the shape boundary, i.e. a point where two bezier
5
5
  * curves meet. Typically used internally only.
6
6
  */
@@ -1,39 +1,10 @@
1
- import { memoize } from 'flo-memoize';
2
- import { cross, dot, toUnitVector } from 'flo-vector2d';
1
+ import { cross, dot, toUnitVector } from "flo-vector2d";
2
+ import { Corner } from "./corner";
3
3
  import { getInterfaceCcw } from './get-interface-ccw.js';
4
- import { Loop } from './loop.js';
5
- import { Corner } from './mat/corner.js';
6
-
7
-
8
- /**
9
- * Represents a bezier curve on the shape boundary / loop.
10
- */
11
- interface Curve {
12
-
13
- /**
14
- * Primarily for internal use.
15
- * @param loop The closed loop of bezier curves representing the shape
16
- * boundary this curve belongs to.
17
- * @param ps The bezier control points.
18
- * @param prev The previous curve (when going in a negative direction around
19
- * the shape boundary, i.e. clockwise for the outer shape and anti-clockwise
20
- * for the holes (if any)).
21
- * @param next The next curve (when going in a positive direction around
22
- * the shape boundary, i.e. anti-clockwise for the outer shape and clockwise
23
- * for the holes (if any)).
24
- * @param idx The curve's ordered index in the loop. This imposes a cycling
25
- * ordering of the curves in the loop.
26
- */
27
- loop : Loop;
28
- ps : number[][];
29
- prev : Curve;
30
- next : Curve;
31
- idx : number;
32
- }
33
4
 
34
5
 
35
6
  /**
36
- * @hidden
7
+ * @internal
37
8
  * Angle in degrees to radians.
38
9
  */
39
10
  const DEGREES = {
@@ -45,14 +16,14 @@ const DEGREES = {
45
16
  };
46
17
 
47
18
 
48
- /** @hidden */
19
+ /** @internal */
49
20
  //const DEGREE_LIMIT = DEGREES[1];
50
21
  const DEGREE_LIMIT = DEGREES[4];
51
22
  //const DEGREE_LIMIT = DEGREES[16];
52
23
 
53
24
 
54
25
  /**
55
- * @hidden
26
+ * @internal
56
27
  * Returns a new corner with properties.
57
28
  *
58
29
  * PRECONDITION: The beziers has control points with max bit-length of 26 and
@@ -63,7 +34,10 @@ const DEGREE_LIMIT = DEGREES[4];
63
34
  * @param psI The incoming bezier that ends in the corner
64
35
  * @param psO The outgoing bezier that starts at the corner
65
36
  */
66
- function getCorner(psI: number[][], psO: number[][]): Corner {
37
+ function getCorner(
38
+ psI: number[][],
39
+ psO: number[][]): Corner {
40
+
67
41
  // getInterfaceCcw must return a number !== 0 if psI and psO are not the
68
42
  // same as seen as a curve extension with t ∈ [-∞,+∞]
69
43
  const ccw = getInterfaceCcw(psI, psO);
@@ -117,17 +91,4 @@ function getCorner(psI: number[][], psO: number[][]): Corner {
117
91
  }
118
92
 
119
93
 
120
- /**
121
- * @hidden
122
- * Returns information about the corner created at the end of this curve
123
- * (at t === 1) and the start of the next curve (at t === 0).
124
- */
125
- const getCornerAtEnd = memoize(function(curve: Curve) {
126
- const psE = curve.ps;
127
- const psS = curve.next.ps;
128
-
129
- return getCorner(psE, psS);
130
- });
131
-
132
-
133
- export { Curve, getCorner, getCornerAtEnd }
94
+ export { getCorner }
@@ -1,4 +1,4 @@
1
- import { orient2d } from 'big-float-ts';
1
+ import { eAdd, eEstimate, eMult, eNegativeOf, eProduct, orient2d, twoDiff } from 'big-float-ts';
2
2
  import { dot } from "flo-vector2d";
3
3
  import { compareCurvaturesAtInterface } from "./compare-curvatures-at-interface.js";
4
4
 
@@ -36,32 +36,6 @@ function getInterfaceCcw(psI: number[][], psO: number[][]) {
36
36
  // second control point of outgoing curve
37
37
  const p2 = psO[1];
38
38
 
39
- /*
40
- if (typeof _bez_debug_ !== 'undefined') {
41
- let maxBitLength = 25;
42
- let p1_ = psI[lenI-1];
43
- // ---- precondition: does endpoints coincide
44
- if (p1_[0] !== p1[0] || p1_[1] !== p1[1]) {
45
- throw new Error('Curve endpoints must coincide.');
46
- }
47
- // ---- precondition: are coordinates grid-aligned
48
- // Get all coordinate values into an array
49
- let xs: number[] = [];
50
- [psI, psO].forEach(ps => ps.forEach(p => p.forEach(x => {
51
- xs.push(x);
52
- })));
53
-
54
- let msb = xs.reduce((prevX, x) => Math.max(prevX, msbExponent(x)), Number.NEGATIVE_INFINITY);
55
- let lsb = xs.reduce((prevX, x) => Math.min(prevX, lsbExponent(x)), Number.POSITIVE_INFINITY);
56
- let bitlengthAll = msb - lsb + 1;
57
- if (bitlengthAll > maxBitLength) {
58
- throw new Error(
59
- `Curve control point coordinates must be bit-aligned and <= ${maxBitLength}. bitlength === ${bitlengthAll}, coordinates: ${xs}`
60
- );
61
- }
62
- }
63
- */
64
-
65
39
  // Max one bit can be added in the calculations below due to bit-alignment
66
40
  const xE = p1[0] - p0[0]; // tangent x-coordinate
67
41
  const yE = p1[1] - p0[1]; // tangent y-coordinate
@@ -76,20 +50,15 @@ function getInterfaceCcw(psI: number[][], psO: number[][]) {
76
50
  // (non-normalized) tangent of outgoing curve at t === 0
77
51
  const tangentAtStart = [xS,yS];
78
52
 
79
- // The cross calculated below will have a max bitlength of
80
- // (2*(maxBitLength+1))+1 === e.g. (2*(25+1)) + 1 === 53
81
- // If the preconditions are met it is exact
82
- //let crossTangents = cross(tangentAtEnd, tangentAtStart);
83
-
84
- // The cross below is exact by adaptive infinite precision
85
- const crossTangents = orient2d(p0, p1, p2);
53
+ // const crossTangents = orient2d(p0, p1, p2);
54
+ const crossTangents = orient2dPrecise(p0, p1, p2);
86
55
 
87
56
  if (crossTangents !== 0) {
88
57
  return crossTangents;
89
58
  }
90
59
 
91
60
  // The dot calculated below will have a max bitlength of
92
- // (2*(maxBitLength+1))+1 === e.g. (2*(25+1)) + 1 === 53
61
+ // (2*(maxBitLength + 1)) + 1 === e.g. (2*(25 + 1)) + 1 === 53
93
62
  // If the preconditions are met it is exact
94
63
  const dotTangents = dot(tangentAtEnd, tangentAtStart);
95
64
  if (dotTangents > 0) {
@@ -109,4 +78,28 @@ function getInterfaceCcw(psI: number[][], psO: number[][]) {
109
78
  }
110
79
 
111
80
 
81
+ /** Returns the cross from A to B to C */
82
+ function orient2dPrecise(
83
+ A: number[],
84
+ B: number[],
85
+ C: number[]) {
86
+
87
+ // const detleft = (A[0] - C[0]) * (B[1] - C[1]);
88
+ // const detright = (A[1] - C[1]) * (B[0] - C[0]);
89
+ // const det = detleft - detright;
90
+
91
+ const a = twoDiff(A[0],C[0]);
92
+ const b = twoDiff(B[1],C[1]);
93
+ const c = twoDiff(A[1],C[1]);
94
+ const d = twoDiff(B[0],C[0]);
95
+
96
+ const e = eMult(a,b);
97
+ const f = eMult(c,d);
98
+
99
+ const g = eAdd(e,eNegativeOf(f));
100
+
101
+ return eEstimate(g);
102
+ }
103
+
104
+
112
105
  export { getInterfaceCcw }
@@ -1,14 +1,15 @@
1
- import { CpNode } from "../cp-node.js";
1
+ import { CpNode } from "./cp-node.js";
2
+ import { createCpNode } from "./create-cp-node.js";
2
3
 
3
4
 
4
- /** @hidden */
5
+ /** @internal */
5
6
  type Edge =
6
7
  | 'prev'
7
8
  | 'next'
8
9
  | 'prevOnCircle'
9
10
  | 'nextOnCircle';
10
11
 
11
- /** @hidden */
12
+ /** @internal */
12
13
  const EDGES: Edge[] = ['prev', 'next', 'prevOnCircle', 'nextOnCircle'];
13
14
 
14
15
 
@@ -23,19 +24,29 @@ function clone(cpNode: CpNode): CpNode {
23
24
 
24
25
  const nodeMap: Map<CpNode, CpNode> = new Map();
25
26
 
26
- const newCpNode = new CpNode(cpNode.cp, cpNode.isHoleClosing, cpNode.isIntersection);
27
+ // const newCpNode = new CpNode(cpNode.cp, cpNode.isHoleClosing, cpNode.isIntersection);
28
+ const newCpNode = createCpNode(
29
+ cpNode.cp,
30
+ cpNode.isHoleClosing,
31
+ cpNode.isIntersection
32
+ );
27
33
 
28
34
  nodeMap.set(cpNode, newCpNode);
29
35
  const cpStack = [{ cpNode, newCpNode }];
30
36
 
31
37
  while (cpStack.length) {
32
- const { cpNode, newCpNode } = cpStack.pop();
38
+ const { cpNode, newCpNode } = cpStack.pop()!;
33
39
 
34
40
  for (const edge of EDGES) {
35
41
  const node = cpNode[edge];
36
42
  let newNode = nodeMap.get(node);
37
43
  if (!newNode) {
38
- newNode = new CpNode(node.cp, node.isHoleClosing, node.isIntersection);
44
+ // newNode = new CpNode(node.cp, node.isHoleClosing, node.isIntersection);
45
+ newNode = createCpNode(
46
+ node.cp,
47
+ node.isHoleClosing,
48
+ node.isIntersection,
49
+ );
39
50
  nodeMap.set(node, newNode);
40
51
  cpStack.push({cpNode: node, newCpNode: newNode });
41
52
  }