flo-mat 3.0.9 → 3.0.11
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.
- package/__tests__/jsog/check-jsog-eql-calc.spec.ts +81 -0
- package/__tests__/jsog/decode-jsog.ts +85 -0
- package/__tests__/jsog/get-mats1.ts +41 -0
- package/__tests__/{cp-node/fs → jsog}/mat-dummys.ts +51 -564
- package/__tests__/jsog/to-jsog-breath-first.ts +107 -0
- package/__tests__/jsog/to-jsog-depth-first.ts +55 -0
- package/browser/index.js +280 -236
- package/browser/index.min.js +1 -1
- package/node/add-n-prong.ts/join-spokes.js.map +1 -1
- package/node/closest-boundary-point/cull-bezier-pieces.d.ts +5 -4
- package/node/closest-boundary-point/cull-bezier-pieces.js +9 -8
- package/node/closest-boundary-point/cull-bezier-pieces.js.map +1 -1
- package/node/closest-boundary-point/cull-by-loose-bounding-box.d.ts +2 -2
- package/node/closest-boundary-point/cull-by-loose-bounding-box.js +8 -8
- package/node/closest-boundary-point/cull-by-loose-bounding-box.js.map +1 -1
- package/node/closest-boundary-point/cull-by-tight-boundary-box.d.ts +2 -2
- package/node/closest-boundary-point/cull-by-tight-boundary-box.js +8 -8
- package/node/closest-boundary-point/cull-by-tight-boundary-box.js.map +1 -1
- package/node/closest-boundary-point/dd-deflate-with-running-error.js.map +1 -1
- package/node/closest-boundary-point/get-best-distance-squared.d.ts +1 -1
- package/node/closest-boundary-point/get-best-distance-squared.js +6 -6
- package/node/closest-boundary-point/get-best-distance-squared.js.map +1 -1
- package/node/closest-boundary-point/get-close-boundary-points-certified.d.ts +2 -2
- package/node/closest-boundary-point/get-close-boundary-points-certified.js +7 -7
- package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -1
- package/node/contact-point/contact-point.js.map +1 -1
- package/node/corner/get-corner.js.map +1 -1
- package/node/corner/get-interface-ccw.js.map +1 -1
- package/node/cp-node/cp-node-fs.d.ts +2 -1
- package/node/cp-node/cp-node-fs.js +1 -2
- package/node/cp-node/cp-node-fs.js.map +1 -1
- package/node/cp-node/fs/cp-node-comparator.d.ts +3 -0
- package/node/cp-node/fs/cp-node-comparator.js +6 -0
- package/node/cp-node/fs/cp-node-comparator.js.map +1 -0
- package/node/cp-node/fs/find-first.js.map +1 -1
- package/node/cp-node/fs/get-all-on-loop.js.map +1 -1
- package/node/cp-node/fs/get-boundary-bezier-parts-to-next.d.ts +1 -1
- package/node/cp-node/fs/get-boundary-bezier-parts-to-next.js +11 -16
- package/node/cp-node/fs/get-boundary-bezier-parts-to-next.js.map +1 -1
- package/node/cp-node/fs/get-boundary-beziers-between.js +4 -6
- package/node/cp-node/fs/get-boundary-beziers-between.js.map +1 -1
- package/node/cp-node/fs/get-boundary-beziers-to-next.d.ts +10 -1
- package/node/cp-node/fs/get-boundary-beziers-to-next.js +70 -35
- package/node/cp-node/fs/get-boundary-beziers-to-next.js.map +1 -1
- package/node/cp-node/fs/get-branch-beziers.js.map +1 -1
- package/node/cp-node/fs/get-branch.js.map +1 -1
- package/node/cp-node/fs/get-children.js.map +1 -1
- package/node/cp-node/fs/get-first-exit.js.map +1 -1
- package/node/cp-node/fs/get-mat-curve-to-next.js.map +1 -1
- package/node/cp-node/fs/get-mat-curves-between.js.map +1 -1
- package/node/cp-node/fs/get-prong-count.js.map +1 -1
- package/node/cp-node/fs/get-real-prong-count.js.map +1 -1
- package/node/cp-node/fs/get-salience.js +2 -2
- package/node/cp-node/fs/get-salience.js.map +1 -1
- package/node/cp-node/fs/get-speed.js +0 -1
- package/node/cp-node/fs/get-speed.js.map +1 -1
- package/node/cp-node/fs/get-vertex-forward-children.js.map +1 -1
- package/node/cp-node/fs/is-fully-terminating.d.ts +1 -1
- package/node/cp-node/fs/is-fully-terminating.js.map +1 -1
- package/node/cp-node/fs/is-one-prong.js.map +1 -1
- package/node/cp-node/fs/is-sharp.js.map +1 -1
- package/node/cp-node/fs/is-terminating.js.map +1 -1
- package/node/cp-node/fs/traverse-cp.js.map +1 -1
- package/node/cp-node/fs/traverse-edges.js.map +1 -1
- package/node/cp-node/fs/traverse-vertices.js.map +1 -1
- package/node/debug/functions/draw-elem/bounding-hull.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-cp-node.js +1 -1
- package/node/debug/functions/draw-elem/draw-cp-node.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-cull.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-dull-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-elem.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-leaves.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-loose-bounding-box.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-max-vertex.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-min-y.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-one-prong-at-dull-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-one-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-sharp-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-speed.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-three-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-tight-bounding-box.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-two-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-vertex.js.map +1 -1
- package/node/debug/functions/general.js.map +1 -1
- package/node/find-2-prong/add-1-prong.js.map +1 -1
- package/node/find-2-prong/cull-bezier-pieces.d.ts +4 -4
- package/node/find-2-prong/cull-bezier-pieces.js +9 -9
- package/node/find-2-prong/cull-bezier-pieces.js.map +1 -1
- package/node/find-2-prong/find-2-prong.js +8 -8
- package/node/find-2-prong/find-2-prong.js.map +1 -1
- package/node/find-2-prong/find-equidistant-point-on-line-dd.js.map +1 -1
- package/node/find-2-prong/get-initial-bezier-pieces.d.ts +2 -2
- package/node/find-2-prong/get-initial-bezier-pieces.js +2 -2
- package/node/find-2-prong/get-initial-bezier-pieces.js.map +1 -1
- package/node/find-2-prong/reduce-radius.d.ts +1 -1
- package/node/find-2-prong/reduce-radius.js +5 -5
- package/node/find-2-prong/reduce-radius.js.map +1 -1
- package/node/find-3-prong.ts/calc-better-x.d.ts +2 -2
- package/node/find-3-prong.ts/calc-better-x.js +3 -3
- package/node/find-3-prong.ts/calc-better-x.js.map +1 -1
- package/node/find-3-prong.ts/calc-initial-3-prong-center.d.ts +2 -2
- package/node/find-3-prong.ts/calc-initial-3-prong-center.js +3 -3
- package/node/find-3-prong.ts/calc-initial-3-prong-center.js.map +1 -1
- package/node/find-3-prong.ts/find-3-prong-for-delta3s.d.ts +2 -2
- package/node/find-3-prong.ts/find-3-prong-for-delta3s.js +16 -16
- package/node/find-3-prong.ts/find-3-prong-for-delta3s.js.map +1 -1
- package/node/find-3-prong.ts/find-3-prong.js +2 -2
- package/node/find-3-prong.ts/find-3-prong.js.map +1 -1
- package/node/find-3-prong.ts/find-and-add-3-prong.js.map +1 -1
- package/node/find-3-prong.ts/find-and-add-3-prongs.js.map +1 -1
- package/node/find-3-prong.ts/get-closest-points.d.ts +2 -2
- package/node/find-3-prong.ts/get-closest-points.js +4 -4
- package/node/find-3-prong.ts/get-closest-points.js.map +1 -1
- package/node/find-mat/find-mats.js.map +1 -1
- package/node/geometry/get-closest-square-distance-to-rect.js.map +1 -1
- package/node/geometry/get-closest-squared-distance-to-rotated-rect.js.map +1 -1
- package/node/index.d.ts +35 -1
- package/node/index.js +36 -1
- package/node/index.js.map +1 -1
- package/node/mat/create-new-cp-tree.js.map +1 -1
- package/node/mat/get-boundary-piece-beziers.js +7 -7
- package/node/mat/get-boundary-piece-beziers.js.map +1 -1
- package/node/mat/get-largest-vertex.js.map +1 -1
- package/node/mat/trim-mat.js.map +1 -1
- package/node/memoize-primitive.js.map +1 -1
- package/node/sat/add-debug-info.js.map +1 -1
- package/node/sat/cull.d.ts +7 -5
- package/node/sat/cull.js +7 -4
- package/node/sat/cull.js.map +1 -1
- package/node/sat/get-leaves.js.map +1 -1
- package/node/sat/to-scale-axis.d.ts +3 -2
- package/node/sat/to-scale-axis.js +3 -2
- package/node/sat/to-scale-axis.js.map +1 -1
- package/node/svg/get-loop-bounds.js.map +1 -1
- package/node/svg/get-min-y-pos.js.map +1 -1
- package/node/sweep-line/sweep-line.js.map +1 -1
- package/package.json +6 -6
- package/src/add-n-prong.ts/join-spokes.ts +11 -11
- package/src/closest-boundary-point/cull-bezier-pieces.ts +12 -11
- package/src/closest-boundary-point/cull-by-loose-bounding-box.ts +8 -8
- package/src/closest-boundary-point/cull-by-tight-boundary-box.ts +8 -8
- package/src/closest-boundary-point/dd-deflate-with-running-error.ts +22 -22
- package/src/closest-boundary-point/get-best-distance-squared.ts +6 -6
- package/src/closest-boundary-point/get-close-boundary-points-certified.ts +41 -41
- package/src/contact-point/contact-point.ts +13 -13
- package/src/corner/get-corner.ts +39 -39
- package/src/corner/get-interface-ccw.ts +3 -3
- package/src/cp-node/cp-node-fs.ts +132 -135
- package/src/cp-node/cp-node.ts +30 -30
- package/src/cp-node/fs/clone.ts +4 -4
- package/src/cp-node/fs/cp-node-comparator.ts +13 -0
- package/src/cp-node/fs/find-first.ts +6 -6
- package/src/cp-node/fs/get-all-on-loop.ts +1 -1
- package/src/cp-node/fs/get-boundary-bezier-parts-to-next.ts +12 -18
- package/src/cp-node/fs/get-boundary-beziers-between.ts +6 -7
- package/src/cp-node/fs/get-boundary-beziers-to-next.ts +79 -53
- package/src/cp-node/fs/get-branch-beziers.ts +1 -1
- package/src/cp-node/fs/get-branch.ts +1 -1
- package/src/cp-node/fs/get-children.ts +8 -8
- package/src/cp-node/fs/get-first-exit.ts +11 -11
- package/src/cp-node/fs/get-mat-curve-to-next.ts +1 -1
- package/src/cp-node/fs/get-mat-curves-between.ts +1 -1
- package/src/cp-node/fs/get-prong-count.ts +8 -8
- package/src/cp-node/fs/get-real-prong-count.ts +3 -3
- package/src/cp-node/fs/get-salience.ts +2 -2
- package/src/cp-node/fs/get-speed.ts +1 -6
- package/src/cp-node/fs/get-vertex-forward-children.ts +10 -10
- package/src/cp-node/fs/is-fully-terminating.ts +3 -3
- package/src/cp-node/fs/is-one-prong.ts +8 -8
- package/src/cp-node/fs/is-sharp.ts +1 -1
- package/src/cp-node/fs/is-terminating.ts +1 -1
- package/src/cp-node/fs/iterate-all-on-loop.ts +6 -6
- package/src/cp-node/fs/traverse-all-forward.ts +11 -11
- package/src/cp-node/fs/traverse-cp.ts +19 -17
- package/src/cp-node/fs/traverse-edges.ts +10 -10
- package/src/cp-node/fs/traverse-vertices.ts +17 -17
- package/src/curve/curve.ts +26 -26
- package/src/debug/functions/cmp-cp-on-delta.ts +1 -1
- package/src/debug/functions/draw-elem/bounding-hull.ts +2 -2
- package/src/debug/functions/draw-elem/culls.ts +2 -2
- package/src/debug/functions/draw-elem/draw-cp-node.ts +30 -30
- package/src/debug/functions/draw-elem/draw-cull.ts +2 -2
- package/src/debug/functions/draw-elem/draw-dull-corner.ts +7 -7
- package/src/debug/functions/draw-elem/draw-elem.ts +28 -28
- package/src/debug/functions/draw-elem/draw-leaves.ts +12 -12
- package/src/debug/functions/draw-elem/draw-loose-bounding-box.ts +7 -7
- package/src/debug/functions/draw-elem/draw-max-vertex.ts +2 -2
- package/src/debug/functions/draw-elem/draw-min-y.ts +2 -2
- package/src/debug/functions/draw-elem/draw-one-prong-at-dull-corner.ts +1 -1
- package/src/debug/functions/draw-elem/draw-one-prong.ts +1 -1
- package/src/debug/functions/draw-elem/draw-sharp-corner.ts +6 -6
- package/src/debug/functions/draw-elem/draw-speed.ts +2 -2
- package/src/debug/functions/draw-elem/draw-three-prong.ts +28 -28
- package/src/debug/functions/draw-elem/draw-tight-bounding-box.ts +4 -4
- package/src/debug/functions/draw-elem/draw-two-prong.ts +51 -51
- package/src/debug/functions/draw-elem/draw-vertex.ts +12 -12
- package/src/debug/functions/draw-elem/dull-corner.ts +7 -7
- package/src/debug/functions/draw-elem/leaves.ts +2 -2
- package/src/debug/functions/draw-elem/loose-bounding-box.ts +7 -7
- package/src/debug/functions/draw-elem/max-vertex.ts +2 -2
- package/src/debug/functions/draw-elem/min-y.ts +2 -2
- package/src/debug/functions/draw-elem/one-prong-at-dull-corner.ts +1 -1
- package/src/debug/functions/draw-elem/one-prong.ts +1 -1
- package/src/debug/functions/draw-elem/sharp-corner.ts +6 -6
- package/src/debug/functions/draw-elem/three-prong.ts +19 -19
- package/src/debug/functions/draw-elem/tight-bounding-box.ts +4 -4
- package/src/debug/functions/draw-elem/two-prong.ts +44 -44
- package/src/debug/functions/draw-elem/vertex.ts +28 -28
- package/src/debug/functions/general.ts +18 -18
- package/src/debug/functions/three-prong.ts +184 -184
- package/src/debug/functions/two-prong.ts +201 -201
- package/src/debug/two-prong-for-debugging.ts +26 -26
- package/src/find-2-prong/add-1-prong.ts +25 -25
- package/src/find-2-prong/add-debug-info.ts +38 -38
- package/src/find-2-prong/cull-bezier-pieces.ts +10 -10
- package/src/find-2-prong/find-2-prong.ts +158 -158
- package/src/find-2-prong/find-equidistant-point-on-line-dd.ts +50 -50
- package/src/find-2-prong/find-equidistant-point-on-line.ts +27 -27
- package/src/find-2-prong/get-initial-bezier-pieces.ts +2 -2
- package/src/find-2-prong/reduce-radius.ts +5 -5
- package/src/find-3-prong.ts/calc-better-x.ts +3 -3
- package/src/find-3-prong.ts/calc-initial-3-prong-center.ts +3 -3
- package/src/find-3-prong.ts/find-3-prong-for-delta3s.ts +17 -17
- package/src/find-3-prong.ts/find-3-prong.ts +23 -23
- package/src/find-3-prong.ts/find-and-add-3-prong.ts +37 -37
- package/src/find-3-prong.ts/find-and-add-3-prongs.ts +30 -30
- package/src/find-3-prong.ts/get-closest-points.ts +4 -4
- package/src/find-mat/add-2-prongs-by-error.ts +8 -8
- package/src/find-mat/find-mats.ts +49 -49
- package/src/find-mat/fix-ordering.ts +2 -2
- package/src/find-mat/get-total-by.ts +12 -12
- package/src/geometry/get-closest-square-distance-to-rect.ts +37 -37
- package/src/geometry/get-closest-squared-distance-to-rotated-rect.ts +14 -14
- package/src/get-curve/get-curve-between.ts +1 -1
- package/src/index.ts +41 -4
- package/src/mat/cmp-cp-on-delta.ts +1 -1
- package/src/mat/create-new-cp-tree.ts +12 -12
- package/src/mat/get-boundary-piece-beziers.ts +7 -7
- package/src/mat/get-edges-as-array.ts +9 -9
- package/src/mat/get-largest-3-prong.ts +8 -8
- package/src/mat/get-largest-three-prong.ts +5 -5
- package/src/mat/get-largest-vertex.ts +6 -6
- package/src/mat/get-two-prong-type.ts +9 -9
- package/src/mat/trim-mat.ts +1 -1
- package/src/memoize-primitive.ts +14 -14
- package/src/sat/add-debug-info.ts +4 -4
- package/src/sat/cull-by-salience.ts +1 -1
- package/src/sat/cull.ts +10 -7
- package/src/sat/get-leaves.ts +0 -1
- package/src/sat/to-scale-axis.ts +18 -17
- package/src/svg/get-extreme.ts +8 -8
- package/src/svg/get-loop-bounds.ts +84 -84
- package/src/svg/get-min-y-pos.ts +1 -1
- package/src/sweep-line/sweep-line.ts +23 -23
- package/src/utils/bezier-piece-to-bezier.ts +7 -7
- package/__tests__/cp-node/fs/check-jsog-eql-calc.spec.ts +0 -30
- package/node/cp-node/fs/cp-nodes-to-boundary-beziers.d.ts +0 -3
- package/node/cp-node/fs/cp-nodes-to-boundary-beziers.js +0 -6
- package/node/cp-node/fs/cp-nodes-to-boundary-beziers.js.map +0 -1
- package/src/closest-boundary-point/get-closest-boundary-point-certified.ts +0 -70
- package/src/cp-node/fs/cp-nodes-to-boundary-beziers.ts +0 -10
|
@@ -9,15 +9,15 @@ import { ThreeProngForDebugging } from '../three-prong-for-debugging.js';
|
|
|
9
9
|
|
|
10
10
|
/** @internal */
|
|
11
11
|
export interface IThreeProngDebugFunctions {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
21
|
}
|
|
22
22
|
|
|
23
23
|
|
|
@@ -27,14 +27,14 @@ export interface IThreeProngDebugFunctions {
|
|
|
27
27
|
* @param n - The 3-prong's zero-based index.
|
|
28
28
|
*/
|
|
29
29
|
function drawSpokes(g: SVGGElement, n: number): void {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
38
|
}
|
|
39
39
|
|
|
40
40
|
|
|
@@ -46,57 +46,57 @@ function drawSpokes(g: SVGGElement, n: number): void {
|
|
|
46
46
|
* will be shown.
|
|
47
47
|
*/
|
|
48
48
|
function traceConvergence(g: SVGGElement, n_: number, idx: number): void {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
100
|
}
|
|
101
101
|
|
|
102
102
|
|
|
@@ -108,56 +108,56 @@ function traceConvergence(g: SVGGElement, n_: number, idx: number): void {
|
|
|
108
108
|
* show all.
|
|
109
109
|
*/
|
|
110
110
|
function showBoundary(g: SVGGElement, n: number, idx: number): void {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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
161
|
}
|
|
162
162
|
|
|
163
163
|
|
|
@@ -166,9 +166,9 @@ function showBoundary(g: SVGGElement, n: number, idx: number): void {
|
|
|
166
166
|
* @param n The 3-prong's zero-based index.
|
|
167
167
|
*/
|
|
168
168
|
function logδs(n: number): void {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
const threeProng = _debug_.generated.elems.threeProng[n];
|
|
170
|
+
|
|
171
|
+
console.log(threeProng.cpss);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
|
|
@@ -177,73 +177,73 @@ function logδs(n: number): void {
|
|
|
177
177
|
* @param p
|
|
178
178
|
*/
|
|
179
179
|
function logNearest(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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
236
|
}
|
|
237
237
|
|
|
238
238
|
|
|
239
239
|
/** @internal */
|
|
240
240
|
const threeProngDebugFunctions: IThreeProngDebugFunctions = {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
|
|
241
|
+
drawSpokes,
|
|
242
|
+
traceConvergence,
|
|
243
|
+
showBoundary,
|
|
244
|
+
logδs,
|
|
245
|
+
logNearest
|
|
246
|
+
}
|
|
247
|
+
|
|
248
248
|
|
|
249
249
|
export { threeProngDebugFunctions }
|