flo-mat 4.0.1 → 4.0.3

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 (220) hide show
  1. package/README.md +1 -1
  2. package/__tests__/find-2-prong/get-medial/get-closest-points.spec.ts +49 -0
  3. package/__tests__/specific-cases/specific-cases.spec.ts +6 -0
  4. package/browser/index.js +9994 -12650
  5. package/browser/index.min.js +1 -1
  6. package/node/closest-boundary-point/foot-and-endpoint-info.d.ts +0 -3
  7. package/node/closest-boundary-point/get-close-boundary-points-certified.d.ts +1 -1
  8. package/node/closest-boundary-point/get-close-boundary-points-certified.js +2 -2
  9. package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -1
  10. package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.d.ts +1 -2
  11. package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js +34 -24
  12. package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js.map +1 -1
  13. package/node/closest-boundary-point/root-interval-to-distance-squared-interval.d.ts +1 -1
  14. package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js +6 -9
  15. package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js.map +1 -1
  16. package/node/cp-node/fs/insert-cp-node.d.ts +2 -2
  17. package/node/cp-node/fs/insert-cp-node.js.map +1 -1
  18. package/node/cp-node/fs/is-on-same-loop.d.ts +3 -0
  19. package/node/cp-node/fs/is-on-same-loop.js +6 -0
  20. package/node/cp-node/fs/is-on-same-loop.js.map +1 -0
  21. package/node/cp-node/fs/is-order-correct.d.ts +2 -2
  22. package/node/cp-node/fs/is-order-correct.js.map +1 -1
  23. package/node/cp-node/fs/traverse-cp.js.map +1 -1
  24. package/node/cp-node/fs/traverse-vertices.d.ts +1 -1
  25. package/node/cp-node/fs/traverse-vertices.js.map +1 -1
  26. package/node/debug/debug.d.ts +10 -15
  27. package/node/debug/debug.js +35 -46
  28. package/node/debug/debug.js.map +1 -1
  29. package/node/debug/functions/draw-elem/draw-branch.d.ts +1 -1
  30. package/node/debug/functions/draw-elem/draw-branch.js.map +1 -1
  31. package/node/debug/functions/draw-elem/draw-cp-node.d.ts +1 -1
  32. package/node/debug/functions/draw-elem/draw-cp-node.js +2 -2
  33. package/node/debug/functions/draw-elem/draw-cp-node.js.map +1 -1
  34. package/node/debug/functions/draw-elem/draw-leaves.d.ts +1 -1
  35. package/node/debug/functions/draw-elem/draw-leaves.js +2 -2
  36. package/node/debug/functions/draw-elem/draw-leaves.js.map +1 -1
  37. package/node/debug/functions/draw-elem/draw-mat.d.ts +1 -1
  38. package/node/debug/functions/draw-elem/draw-mat.js +1 -2
  39. package/node/debug/functions/draw-elem/draw-mat.js.map +1 -1
  40. package/node/debug/functions/draw-elem/draw-min-y.d.ts +1 -1
  41. package/node/debug/functions/draw-elem/draw-min-y.js.map +1 -1
  42. package/node/debug/functions/draw-elem/draw-three-prong.d.ts +1 -1
  43. package/node/debug/functions/draw-elem/draw-three-prong.js +2 -2
  44. package/node/debug/functions/draw-elem/draw-three-prong.js.map +1 -1
  45. package/node/debug/functions/draw-elem/draw-vertex.d.ts +1 -1
  46. package/node/debug/functions/draw-elem/draw-vertex.js +0 -2
  47. package/node/debug/functions/draw-elem/draw-vertex.js.map +1 -1
  48. package/node/error-analysis/gamma.d.ts +32 -0
  49. package/node/error-analysis/gamma.js +39 -0
  50. package/node/error-analysis/gamma.js.map +1 -0
  51. package/node/find-2-prong/add-1-prong.js +1 -4
  52. package/node/find-2-prong/add-1-prong.js.map +1 -1
  53. package/node/find-2-prong/find-2-prong.js +5 -5
  54. package/node/find-2-prong/find-2-prong.js.map +1 -1
  55. package/node/find-2-prong/get-medial/get-closest-points.js +27 -23
  56. package/node/find-2-prong/get-medial/get-closest-points.js.map +1 -1
  57. package/node/find-3-prong/calc-better-x.d.ts +1 -1
  58. package/node/find-3-prong/calc-better-x.js +6 -4
  59. package/node/find-3-prong/calc-better-x.js.map +1 -1
  60. package/node/find-3-prong/calc-initial-3-prong-center.d.ts +1 -1
  61. package/node/find-3-prong/calc-initial-3-prong-center.js +4 -3
  62. package/node/find-3-prong/calc-initial-3-prong-center.js.map +1 -1
  63. package/node/find-3-prong/find-3-prong-for-delta3s.js +22 -5
  64. package/node/find-3-prong/find-3-prong-for-delta3s.js.map +1 -1
  65. package/node/find-3-prong/find-and-add-3-prong.d.ts +2 -2
  66. package/node/find-3-prong/find-and-add-3-prong.js +15 -0
  67. package/node/find-3-prong/find-and-add-3-prong.js.map +1 -1
  68. package/node/find-3-prong/find-and-add-3-prongs-on-loop.js +8 -21
  69. package/node/find-3-prong/find-and-add-3-prongs-on-loop.js.map +1 -1
  70. package/node/find-3-prong/find-and-add-3-prongs.d.ts +1 -4
  71. package/node/find-3-prong/find-and-add-3-prongs.js +1 -2
  72. package/node/find-3-prong/find-and-add-3-prongs.js.map +1 -1
  73. package/node/find-3-prong/get-closest-points.d.ts +1 -1
  74. package/node/find-3-prong/get-closest-points.js +2 -2
  75. package/node/find-3-prong/get-closest-points.js.map +1 -1
  76. package/node/find-3-prong/timed-cc.d.ts +3 -0
  77. package/node/find-3-prong/timed-cc.js +5 -0
  78. package/node/find-3-prong/timed-cc.js.map +1 -0
  79. package/node/find-mat/create-initial-cp-tree.d.ts +2 -2
  80. package/node/find-mat/create-initial-cp-tree.js +2 -2
  81. package/node/find-mat/create-initial-cp-tree.js.map +1 -1
  82. package/node/find-mat/find-mat.d.ts +4 -4
  83. package/node/find-mat/find-mat.js +1 -2
  84. package/node/find-mat/find-mat.js.map +1 -1
  85. package/node/find-mat/find-mats.js +2 -2
  86. package/node/find-mat/find-mats.js.map +1 -1
  87. package/node/find-mat/get-meta.d.ts +1 -6
  88. package/node/find-mat/get-meta.js +4 -25
  89. package/node/find-mat/get-meta.js.map +1 -1
  90. package/node/index.d.ts +5 -2
  91. package/node/index.js +4 -1
  92. package/node/index.js.map +1 -1
  93. package/node/mat/create-new-cp-trees.d.ts +2 -2
  94. package/node/mat/create-new-cp-trees.js +2 -2
  95. package/node/mat/create-new-cp-trees.js.map +1 -1
  96. package/node/mat/get-cp-node-to-left-or-same.d.ts +2 -2
  97. package/node/mat/get-cp-node-to-left-or-same.js +2 -1
  98. package/node/mat/get-cp-node-to-left-or-same.js.map +1 -1
  99. package/node/mat/mat-meta.d.ts +2 -2
  100. package/node/point-on-shape/get-osculating-circle.js +2 -1
  101. package/node/point-on-shape/get-osculating-circle.js.map +1 -1
  102. package/node/reconstruct-from-mat/filter-zero-length.d.ts +10 -0
  103. package/node/reconstruct-from-mat/filter-zero-length.js +14 -0
  104. package/node/reconstruct-from-mat/filter-zero-length.js.map +1 -0
  105. package/node/reconstruct-from-mat/get-all-on-loop-by-loop.d.ts +7 -0
  106. package/node/reconstruct-from-mat/get-all-on-loop-by-loop.js +38 -0
  107. package/node/reconstruct-from-mat/get-all-on-loop-by-loop.js.map +1 -0
  108. package/node/reconstruct-from-mat/get-bezier-piece-length.d.ts +3 -0
  109. package/node/reconstruct-from-mat/get-bezier-piece-length.js +6 -0
  110. package/node/reconstruct-from-mat/get-bezier-piece-length.js.map +1 -0
  111. package/node/reconstruct-from-mat/get-boundary.d.ts +7 -0
  112. package/node/reconstruct-from-mat/get-boundary.js +18 -0
  113. package/node/reconstruct-from-mat/get-boundary.js.map +1 -0
  114. package/node/reconstruct-from-mat/get-cp-nodess-for-sat.d.ts +4 -0
  115. package/node/reconstruct-from-mat/get-cp-nodess-for-sat.js +15 -0
  116. package/node/reconstruct-from-mat/get-cp-nodess-for-sat.js.map +1 -0
  117. package/node/reconstruct-from-mat/get-matching-beziers.d.ts +10 -0
  118. package/node/reconstruct-from-mat/get-matching-beziers.js +29 -0
  119. package/node/reconstruct-from-mat/get-matching-beziers.js.map +1 -0
  120. package/node/reconstruct-from-mat/get-mbss-by-loop-per-sat.d.ts +6 -0
  121. package/node/reconstruct-from-mat/get-mbss-by-loop-per-sat.js +10 -0
  122. package/node/reconstruct-from-mat/get-mbss-by-loop-per-sat.js.map +1 -0
  123. package/node/reconstruct-from-mat/get-mbss-by-loop-with-opp-arr.d.ts +7 -0
  124. package/node/reconstruct-from-mat/get-mbss-by-loop-with-opp-arr.js +47 -0
  125. package/node/reconstruct-from-mat/get-mbss-by-loop-with-opp-arr.js.map +1 -0
  126. package/node/reconstruct-from-mat/get-sats2.d.ts +10 -0
  127. package/node/reconstruct-from-mat/get-sats2.js +16 -0
  128. package/node/reconstruct-from-mat/get-sats2.js.map +1 -0
  129. package/node/reconstruct-from-mat/is-fully-terminating.d.ts +3 -0
  130. package/node/reconstruct-from-mat/is-fully-terminating.js +19 -0
  131. package/node/reconstruct-from-mat/is-fully-terminating.js.map +1 -0
  132. package/node/reconstruct-from-mat/matched-beziers.d.ts +10 -0
  133. package/node/reconstruct-from-mat/matched-beziers.js +2 -0
  134. package/node/reconstruct-from-mat/matched-beziers.js.map +1 -0
  135. package/node/reconstruct-from-mat/reconstruct-from-mat.d.ts +4 -0
  136. package/node/reconstruct-from-mat/reconstruct-from-mat.js +28 -0
  137. package/node/reconstruct-from-mat/reconstruct-from-mat.js.map +1 -0
  138. package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.d.ts +12 -0
  139. package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js +46 -0
  140. package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js.map +1 -0
  141. package/node/reconstruct-from-mat/split-tri-path.d.ts +5 -0
  142. package/node/reconstruct-from-mat/split-tri-path.js +209 -0
  143. package/node/reconstruct-from-mat/split-tri-path.js.map +1 -0
  144. package/node/sat/add-debug-info.js +1 -2
  145. package/node/sat/add-debug-info.js.map +1 -1
  146. package/node/utils/clip.d.ts +2 -0
  147. package/node/utils/clip.js +6 -0
  148. package/node/utils/clip.js.map +1 -0
  149. package/package.json +6 -7
  150. package/src/closest-boundary-point/foot-and-endpoint-info.ts +0 -3
  151. package/src/closest-boundary-point/get-close-boundary-points-certified.ts +0 -2
  152. package/src/closest-boundary-point/get-potential-closest-points-on-curve-certified.ts +41 -27
  153. package/src/closest-boundary-point/root-interval-to-distance-squared-interval.ts +5 -10
  154. package/src/cp-node/fs/insert-cp-node.ts +2 -2
  155. package/src/cp-node/fs/is-on-same-loop.ts +15 -0
  156. package/src/cp-node/fs/is-order-correct.ts +2 -2
  157. package/src/cp-node/fs/traverse-cp.ts +1 -1
  158. package/src/cp-node/fs/traverse-vertices.ts +1 -2
  159. package/src/debug/debug.ts +54 -72
  160. package/src/debug/functions/check-ordering.ts +0 -1
  161. package/src/debug/functions/draw-elem/draw-branch.ts +1 -3
  162. package/src/debug/functions/draw-elem/draw-cp-node.ts +3 -4
  163. package/src/debug/functions/draw-elem/draw-leaves.ts +3 -3
  164. package/src/debug/functions/draw-elem/draw-mat.ts +2 -5
  165. package/src/debug/functions/draw-elem/draw-min-y.ts +2 -2
  166. package/src/debug/functions/draw-elem/draw-three-prong.ts +3 -3
  167. package/src/debug/functions/draw-elem/draw-vertex.ts +1 -4
  168. package/src/error-analysis/gamma.ts +9 -2
  169. package/src/find-2-prong/add-1-prong.ts +1 -5
  170. package/src/find-2-prong/find-2-prong.ts +7 -6
  171. package/src/find-2-prong/get-medial/get-closest-points.ts +24 -26
  172. package/src/find-3-prong/calc-better-x.ts +7 -4
  173. package/src/find-3-prong/calc-initial-3-prong-center.ts +2 -3
  174. package/src/find-3-prong/find-3-prong-for-delta3s.ts +23 -5
  175. package/src/find-3-prong/find-and-add-3-prong.ts +18 -4
  176. package/src/find-3-prong/find-and-add-3-prongs-on-loop.ts +7 -23
  177. package/src/find-3-prong/find-and-add-3-prongs.ts +5 -3
  178. package/src/find-3-prong/get-closest-points.ts +0 -2
  179. package/src/find-3-prong/timed-cc.ts +9 -0
  180. package/src/find-mat/create-initial-cp-tree.ts +3 -3
  181. package/src/find-mat/find-mat.ts +6 -8
  182. package/src/find-mat/find-mats.ts +4 -2
  183. package/src/find-mat/get-meta.ts +3 -38
  184. package/src/index.ts +6 -3
  185. package/src/mat/create-new-cp-trees.ts +3 -3
  186. package/src/mat/get-cp-node-to-left-or-same.ts +4 -3
  187. package/src/mat/mat-meta.ts +2 -2
  188. package/src/point-on-shape/get-osculating-circle.ts +2 -1
  189. package/src/reconstruct-from-mat/filter-zero-length.ts +23 -0
  190. package/src/reconstruct-from-mat/get-all-on-loop-by-loop.ts +52 -0
  191. package/src/reconstruct-from-mat/get-bezier-piece-length.ts +12 -0
  192. package/src/reconstruct-from-mat/get-boundary.ts +32 -0
  193. package/src/reconstruct-from-mat/get-cp-nodess-for-sat.ts +24 -0
  194. package/src/reconstruct-from-mat/get-matching-beziers.ts +46 -0
  195. package/src/reconstruct-from-mat/get-mbss-by-loop-per-sat.ts +19 -0
  196. package/src/reconstruct-from-mat/get-mbss-by-loop-with-opp-arr.ts +69 -0
  197. package/src/reconstruct-from-mat/get-sats2.ts +25 -0
  198. package/src/reconstruct-from-mat/is-fully-terminating.ts +27 -0
  199. package/src/reconstruct-from-mat/matched-beziers.ts +14 -0
  200. package/src/reconstruct-from-mat/reconstruct-from-mat.ts +45 -0
  201. package/src/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.ts +62 -0
  202. package/src/reconstruct-from-mat/split-tri-path.ts +280 -0
  203. package/src/sat/add-debug-info.ts +1 -2
  204. package/src/utils/clip.ts +13 -0
  205. package/wallaby.mjs +1 -0
  206. package/node/closest-boundary-point/get-p-from-box.d.ts +0 -3
  207. package/node/closest-boundary-point/get-p-from-box.js +0 -11
  208. package/node/closest-boundary-point/get-p-from-box.js.map +0 -1
  209. package/node/debug/functions/general.d.ts +0 -48
  210. package/node/debug/functions/general.js +0 -53
  211. package/node/debug/functions/general.js.map +0 -1
  212. package/node/point-on-shape/pos-to-human-string.d.ts +0 -8
  213. package/node/point-on-shape/pos-to-human-string.js +0 -12
  214. package/node/point-on-shape/pos-to-human-string.js.map +0 -1
  215. package/src/debug/elem-type-two-prong.ts +0 -8
  216. package/src/debug/functions/cmp-cp-on-delta.ts +0 -54
  217. package/src/debug/functions/general.ts +0 -79
  218. package/src/debug/functions/three-prong.ts +0 -249
  219. package/src/debug/functions/two-prong.ts +0 -203
  220. package/src/find-2-prong/add-debug-info.ts +0 -45
@@ -1,249 +0,0 @@
1
- // /** @internal */
2
- // declare let _debug_: Debug;
3
-
4
- // import { drawFs } from 'flo-draw';
5
- // import { equal, getObjClosestTo } from 'flo-vector2d';
6
- // import { Debug } from '../debug.js';
7
- // import { ThreeProngForDebugging } from '../three-prong-for-debugging.js';
8
-
9
-
10
- // /** @internal */
11
- // export interface IThreeProngDebugFunctions {
12
- // drawSpokes : (g: SVGGElement, n: number) => void,
13
- // traceConvergence : (g: SVGGElement, n: number, indx: number) => void,
14
- // showBoundary : (g: SVGGElement, n: number, indx: number) => void,
15
- // logδs : (n: number) => void,
16
- // logNearest : (
17
- // showSpokes? : boolean,
18
- // showTrace? : boolean,
19
- // showBoundaries? : boolean
20
- // ) => (g: SVGGElement, p: number[], showDelay?: number) => void
21
- // }
22
-
23
-
24
- // /**
25
- // * @internal
26
- // * Draws 3 lines from the given 3-prong center to its 3 contact points.
27
- // * @param n - The 3-prong's zero-based index.
28
- // */
29
- // function drawSpokes(g: SVGGElement, n: number): void {
30
- // const threeProng = _debug_.generated.elems.threeProng[n];
31
- // const cc = threeProng.circle.center;
32
- // const poss = threeProng.poss;
33
-
34
- // for (let i=0; i<poss.length; i++) {
35
- // const pos = poss[i];
36
- // drawFs.line(g, [pos.p, cc], 'thin5 red');
37
- // }
38
- // }
39
-
40
-
41
- // /**
42
- // * @internal
43
- // * Shows the circle for each boundary iteration.
44
- // * @param n_ - The 3-prong's zero-based index. If ommitted, all will be shown.
45
- // * @param idx - The specific boundary iteration index to view. If ommitted, all
46
- // * will be shown.
47
- // */
48
- // function traceConvergence(g: SVGGElement, n_: number, idx: number): void {
49
- // let sIndx;
50
- // let eIndx;
51
- // if (n_ === undefined) {
52
- // sIndx = 0;
53
- // eIndx = _debug_.generated.elems.threeProng.length;
54
- // } else {
55
- // sIndx = n_;
56
- // eIndx = n_ + 1;
57
- // }
58
-
59
- // for (let n=sIndx; n<eIndx; n++) {
60
-
61
- // const forDebugging = _debug_.generated.elems.threeProng[n];
62
- // //const g = forDebugging.generated.g;
63
-
64
- // console.log(forDebugging);
65
-
66
- // const candidateThreeProngs = forDebugging.candidateThreeProngs;
67
-
68
- // //-----------------------------
69
- // //---- Get start and end index
70
- // //-----------------------------
71
- // let startIndx;
72
- // let endIndx;
73
- // if (n_ === undefined || idx === -1) {
74
- // startIndx = forDebugging.bestIndx;
75
- // endIndx = forDebugging.bestIndx + 1;
76
- // } else {
77
- // if (idx === undefined) {
78
- // startIndx = 0;
79
- // endIndx = candidateThreeProngs.length;
80
- // } else {
81
- // startIndx = idx;
82
- // endIndx = idx + 1;
83
- // }
84
- // }
85
-
86
- // //---------------------------------
87
- // //---- Draw candidate three-prongs
88
- // //---------------------------------
89
- // for (let i=startIndx; i<endIndx; i++) {
90
- // const circle = candidateThreeProngs[i].circle;
91
- // if (forDebugging.bestIndx === i) {
92
- // drawFs.dot(g, circle.center, 0.2, 'green');
93
- // drawFs.circle(g, circle, 'black thin10 nofill');
94
- // } else {
95
- // drawFs.dot(g, circle.center, 0.2, 'cyan');
96
- // drawFs.circle(g, circle, 'cyan thin5 nofill');
97
- // }
98
- // }
99
- // }
100
- // }
101
-
102
-
103
- // /**
104
- // * @internal
105
- // * Shows the actual boundary for each iteration.
106
- // * @param n The 3-prong's zero-based index.
107
- // * @param idx The specific boundary iteration index to view. If ommitted will
108
- // * show all.
109
- // */
110
- // function showBoundary(g: SVGGElement, n: number, idx: number): void {
111
- // const debugInfo = _debug_.generated.elems.threeProng[n];
112
- // //const g = debugInfo.generated.g;
113
-
114
- // const candidateThreeProngs = debugInfo.candidateThreeProngs;
115
-
116
- // const startIndx = idx === undefined ? 0 : idx;
117
- // const endIndx = idx === undefined ? candidateThreeProngs.length : idx;
118
-
119
- // // Draw relevant δs
120
- // const cpss = debugInfo.cpss;
121
- // let j = 0;
122
- // // For each iteration of δ3s (indexed by j)
123
- // for (let idx=1; idx<cpss.length-1; idx++) {
124
-
125
- // if (!(j >= startIndx && j <= endIndx)) {
126
- // j++;
127
- // continue;
128
- // }
129
-
130
- // const δ3s = [
131
- // cpss[0],
132
- // cpss[idx],
133
- // cpss[cpss.length-1]
134
- // ];
135
-
136
-
137
- // // For each of the 3 δs
138
- // for (let i=0; i<3; i++) {
139
- // const δ = δ3s[i];
140
- // const δS = δ[0]; // Delta Start
141
- // const δE = δ[1]; // Delta End
142
-
143
- // const posS = δS.cp.pointOnShape;
144
- // const posE = δE.cp.pointOnShape;
145
-
146
- // const pS = posS.p;
147
- // const pE = posE.p;
148
-
149
- // const r = 1 + (i*0.5);
150
-
151
- // if (equal(pS, pE)) {
152
- // drawFs.crossHair(g, pS, 'red thin10 nofill', r);
153
- // } else {
154
- // drawFs.crossHair(g, pS, 'green thin10 nofill', r);
155
- // drawFs.crossHair(g, pE, 'blue thin10 nofill', r);
156
- // }
157
- // }
158
-
159
- // j++;
160
- // }
161
- // }
162
-
163
-
164
- // /**
165
- // * @internal
166
- // * @param n The 3-prong's zero-based index.
167
- // */
168
- // function logδs(n: number): void {
169
- // const threeProng = _debug_.generated.elems.threeProng[n];
170
-
171
- // console.log(threeProng.cpss);
172
- // }
173
-
174
-
175
- // /**
176
- // * @internal
177
- // * @param p
178
- // */
179
- // function logNearest(
180
- // showSpokes = true,
181
- // showTrace = true,
182
- // showBoundaries = true) {
183
-
184
- // return function(g: SVGGElement, p: number[], showDelay = 1000) {
185
- // const generated = _debug_.generated;
186
-
187
- // const threeProng = getObjClosestTo<ThreeProngForDebugging>(
188
- // p,
189
- // generated.elems.threeProng,
190
- // threeProng => threeProng.circle ? threeProng.circle.center : [0,0]
191
- // )!;
192
-
193
-
194
- // const circle = threeProng.circle;
195
- // //const g = threeProng.generated.g;
196
-
197
- // console.log(threeProng);
198
-
199
- // const circle2 = {
200
- // center: circle.center,
201
- // radius: circle.radius || 1
202
- // };
203
-
204
- // //const draw = _debug_.fs.draw;
205
-
206
- // drawFs.circle(g, circle2, 'blue thin10 nofill', showDelay);
207
- // drawFs.crossHair(g, circle.center, 'red thin2 nofill', 2, showDelay);
208
-
209
- // if (showSpokes) {
210
- // drawFs.line(g, [threeProng.poss[0].p, circle.center], 'blue thin5 nofill', showDelay);
211
- // drawFs.line(g, [threeProng.poss[1].p, circle.center], 'blue thin5 nofill', showDelay);
212
- // drawFs.line(g, [threeProng.poss[2].p, circle.center], 'blue thin5 nofill', showDelay);
213
- // }
214
-
215
-
216
- // if (showBoundaries) {
217
- // const boundaries = threeProng.boundaries;
218
- // const boundaryS = boundaries[0];
219
- // const boundaryE = boundaries[boundaries.length-1];
220
-
221
- // drawFs.beziers(g, boundaryS, 'red thin20 nofill', showDelay);
222
- // for (let i=1; i<boundaries.length-1; i++) {
223
- // const boundary = boundaries[i];
224
- // drawFs.beziers(g, boundary, 'green thin20 nofill', showDelay);
225
- // }
226
- // drawFs.beziers(g, boundaryE, 'blue thin20 nofill', showDelay);
227
- // }
228
-
229
- // if (showTrace) {
230
- // const traces = threeProng.traces;
231
- // for (const trace of traces) {
232
- // drawFs.polyline(g, trace, 'red thin5 nofill', showDelay)
233
- // }
234
- // }
235
- // }
236
- // }
237
-
238
-
239
- // /** @internal */
240
- // const threeProngDebugFunctions: IThreeProngDebugFunctions = {
241
- // drawSpokes,
242
- // traceConvergence,
243
- // showBoundary,
244
- // logδs,
245
- // logNearest
246
- // }
247
-
248
-
249
- // export { threeProngDebugFunctions }
@@ -1,203 +0,0 @@
1
- // declare let _debug_: Debug;
2
-
3
- // import { drawFs } from 'flo-draw';
4
- // import { getObjClosestTo, distanceBetween, squaredDistanceBetween } from 'flo-vector2d';
5
- // import { Debug, Generated } from '../debug.js';
6
- // import { CpNode } from '../../cp-node/cp-node.js';
7
- // import { Circle } from '../../geometry/circle.js';
8
- // import { TwoProngForDebugging } from '../two-prong-for-debugging.js';
9
- // import { ElemType_TwoProng } from '../../mat/elem-type-two-prong.js';
10
-
11
-
12
- // /** @internal */
13
- // interface ITwoProngDebugFunctions {
14
- // logδ : (n: number, type?: ElemType_TwoProng) => void,
15
- // log : (n: number, type?: ElemType_TwoProng) => void,
16
- // drawNormal : typeof drawNormal,
17
- // logδBasic : (n: number) => void,
18
- // logNearest : (
19
- // showSpokes? : boolean,
20
- // showTrace? : boolean,
21
- // showBoundaries? : boolean
22
- // ) => (g: SVGGElement, p: number[], showDelay?: number, scale?: number) => void,
23
- // traceConvergence: typeof traceConvergence,
24
- // }
25
-
26
-
27
- // /**
28
- // * @internal
29
- // */
30
- // function logδ(n: number, type: ElemType_TwoProng = 'twoProng_regular') {
31
- // const δ =_debug_.generated.elems[type][n].δ;
32
-
33
- // console.log(δ);
34
- // }
35
-
36
-
37
- // /**
38
- // * @internal
39
- // */
40
- // function log(n: number, type: ElemType_TwoProng = 'twoProng_regular') {
41
- // const twoProng = _debug_.generated.elems[type][n];
42
- // console.log(twoProng);
43
- // }
44
-
45
-
46
- // /**
47
- // * @internal
48
- // */
49
- // function drawNormal(
50
- // g: SVGGElement,
51
- // twoProng: TwoProngForDebugging,
52
- // showDelay = 1000) {
53
-
54
- // drawFs.line(
55
- // g, [twoProng.pos.p, twoProng.circle.center], 'thin10 blue', showDelay
56
- // );
57
- // }
58
-
59
-
60
- // /**
61
- // * @internal
62
- // */
63
- // function logδBasic(
64
- // n: number,
65
- // type: ElemType_TwoProng = 'twoProng_regular') {
66
-
67
- // const delta = _debug_.generated.elems[type][n].δ;
68
-
69
- // function logδBasic_(x: CpNode) {
70
- // const pos = x.cp.pointOnShape;
71
- // return {
72
- // bez: pos.curve.ps,
73
- // t: pos.t
74
- // }
75
- // }
76
-
77
- // console.log(logδBasic_(delta[0]));
78
- // console.log(logδBasic_(delta[1]));
79
- // }
80
-
81
-
82
- // /**
83
- // * @internal
84
- // * Draws 3 lines from the given 3-prong center to its 3 contact points.
85
- // * @param n - The 3-prong's zero-based index.
86
- // */
87
- // function drawSpokes(
88
- // g: SVGGElement,
89
- // twoProng: TwoProngForDebugging,
90
- // showDelay = 1000): void {
91
-
92
- // const cc = twoProng.circle.center;
93
- // const { pos, circle, cpNode, xs, z, δ } = twoProng;
94
-
95
- // drawFs.line(g, [pos.p, cc], 'thin5 red', showDelay);
96
- // drawFs.line(g, [z, cc], 'thin5 red', showDelay);
97
- // }
98
-
99
-
100
- // /**
101
- // * @internal
102
- // */
103
- // function logNearest(
104
- // showSpokes?: boolean,
105
- // showTrace?: boolean,
106
- // showBoundaries?: boolean) {
107
-
108
- // return (g: SVGGElement,
109
- // p: number[],
110
- // showDelay = 1000,
111
- // scale = 1) => {
112
-
113
- // const closestPerLoops: TwoProngForDebugging[] = [];
114
-
115
- // const generated = _debug_.generated;
116
- // const twoProng = getObjClosestTo<TwoProngForDebugging>(
117
- // p,
118
- // // generated.elems[type],
119
- // generated.elems['twoProng_regular'],
120
- // twoProng => twoProng.circle.center
121
- // )!;
122
- // closestPerLoops.push(twoProng!);
123
-
124
- // console.log(twoProng);
125
-
126
- // let n;
127
- // //for (let i=0; i<_debug_.generated.elems[type].length; i++) {
128
- // // const twoProng_ = _debug_.generated.elems[type][i];
129
- // for (let i=0; i<_debug_.generated.elems['twoProng_regular'].length; i++) {
130
- // const twoProng_ = _debug_.generated.elems['twoProng_regular'][i];
131
- // if (twoProng_ === twoProng) {
132
- // n = i;
133
- // break;
134
- // }
135
- // }
136
-
137
- // if (showSpokes) {
138
- // drawSpokes(g, twoProng, showDelay)
139
- // }
140
-
141
- // if (n !== undefined && showTrace) {
142
- // traceConvergence(g, twoProng, showDelay, scale);
143
- // }
144
- // }
145
- // }
146
-
147
-
148
- // /**
149
- // * @internal
150
- // * @param n - The 2-prong's zero-based index.
151
- // * @param range
152
- // */
153
- // function traceConvergence(
154
- // g: SVGGElement,
155
- // twoProng: TwoProngForDebugging,
156
- // showDelay = 1000,
157
- // scale = 1) {
158
-
159
- // const xs = twoProng.xs;
160
-
161
- // console.log(twoProng);
162
- // console.log(
163
- // twoProng.xs.map(x => ({
164
- // x: x.x,
165
- // y: x.y,
166
- // z: x.z,
167
- // d: x.z ? squaredDistanceBetween(x.y.p, x.z.p) : 0,
168
- // t: x.t,
169
- // })
170
- // )
171
- // );
172
-
173
- // console.log(xs.length)
174
- // for (let i=0; i<xs.length; i++) {
175
- // const x = twoProng.xs[i];
176
-
177
- // const circle = { center: x.x, radius: distanceBetween(x.x, x.y.p) };
178
- // drawFs.crossHair(g, x.x, 'red thin10 nofill', 0.002*scale, showDelay);
179
- // drawFs.circle(g, circle, 'blue thin10 nofill', showDelay);
180
- // if (x.z !== undefined) {
181
- // drawFs.crossHair(
182
- // g, x.z.p, 'yellow thin10 nofill', 0.001*scale, showDelay
183
- // );
184
- // }
185
- // }
186
-
187
- // // twoProngDebugFunctions.drawNormal(g, twoProng, showDelay);
188
- // }
189
-
190
-
191
- // /** @internal */
192
- // const twoProngDebugFunctions: ITwoProngDebugFunctions = {
193
- // logδ,
194
- // log,
195
- // drawNormal,
196
- // logδBasic,
197
- // traceConvergence,
198
- // logNearest,
199
- // }
200
-
201
-
202
- // export { ITwoProngDebugFunctions, twoProngDebugFunctions };
203
-
@@ -1,45 +0,0 @@
1
- // import { PointOnShape } from '../point-on-shape/point-on-shape.js';
2
- // import { Circle } from '../geometry/circle.js';
3
- // import { CpNode } from '../cp-node/cp-node.js';
4
- // import { CurvePiece } from '../mat/bezier-piece.js';
5
- // import { TwoProngForDebugging } from '../debug/two-prong-for-debugging.js';
6
- // import { getTwoProngType } from '../mat/get-two-prong-type.js';
7
- // import { ElemType_TwoProng } from '../mat/elem-type-two-prong.js';
8
- // import { TXForDebugging } from './x-for-debugging.js';
9
-
10
-
11
- // /** @internal */
12
- // function addDebugInfo(
13
- // bezierPieces: CurvePiece[],
14
- // failed: boolean,
15
- // x: number[],
16
- // y: PointOnShape,
17
- // z: PointOnShape,
18
- // circle: Circle,
19
- // δ: CpNode[],
20
- // xs: TXForDebugging[],
21
- // holeClosing: boolean) {
22
-
23
- // // xs.push({ x, y, z, t: y.t });
24
-
25
- // // const twoProng: TwoProngForDebugging = {
26
- // // generated: _debug_.generated,
27
- // // bezierPieces,
28
- // // pos: y,
29
- // // δ,
30
- // // z: z ? z.p : undefined!,
31
- // // circle,
32
- // // xs,
33
- // // failed,
34
- // // holeClosing,
35
- // // notAdded: false,
36
- // // deleted: false,
37
- // // cpNode: undefined!
38
- // // };
39
-
40
- // // const twoProngType = getTwoProngType(twoProng) as ElemType_TwoProng;
41
- // // _debug_.generated.elems[twoProngType].push(twoProng);
42
- // }
43
-
44
-
45
- // export { addDebugInfo }