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
|
@@ -7,23 +7,23 @@ const { getAllOnCircle } = CpNodeFs;
|
|
|
7
7
|
|
|
8
8
|
/** @internal */
|
|
9
9
|
function vertex(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
g: SVGGElement,
|
|
11
|
+
cpNode: CpNode,
|
|
12
|
+
classes?: string,
|
|
13
|
+
delay = 0,
|
|
14
|
+
scaleFactor = 1) {
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
const circle = cpNode.cp.circle;
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
let $svgs: SVGElement[] = [];
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
// const $circle = drawFs.circle(g, circle, 'red ' + THIN + ' nofill ', delay);
|
|
21
|
+
// const $crossHair = drawFs.crossHair(g, circle.center, 'red ' + THIN + ' nofill ', 3, delay);
|
|
22
|
+
const $dot = drawFs.dot(g, circle.center, 0.01*scaleFactor, 'darkgreen', delay);
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
$svgs = [...$dot];
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
return $svgs;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
|
|
@@ -4,17 +4,17 @@ import { Curve } from '../../../curve/curve.js';
|
|
|
4
4
|
|
|
5
5
|
/** @internal */
|
|
6
6
|
function dullCorner(
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
g: SVGGElement,
|
|
8
|
+
curve: Curve,
|
|
9
9
|
classes = 'orange',
|
|
10
10
|
delay = 0,
|
|
11
11
|
scaleFactor = 1) {
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const ps = curve.ps;
|
|
14
|
+
const p = curve.ps[ps.length-1];
|
|
15
|
+
const $pos = drawFs.dot(g, p, 0.1*0.5*scaleFactor, classes, delay);
|
|
16
|
+
|
|
17
|
+
return $pos;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
|
|
@@ -3,7 +3,7 @@ import { drawCirclePercent } from './draw-circle-percent.js';
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
/** @internal */
|
|
6
|
-
function leaves(g: SVGGElement, leaves: CpNode[]) {
|
|
6
|
+
function leaves(g: SVGGElement, leaves: CpNode[]) {
|
|
7
7
|
const $elems: SVGElement[] = [];
|
|
8
8
|
|
|
9
9
|
for (const cpNode of leaves) {
|
|
@@ -13,7 +13,7 @@ function leaves(g: SVGGElement, leaves: CpNode[]) {
|
|
|
13
13
|
$elems.push(drawCirclePercent(g, p, 0.5, 'pinker thin5 nofill'));
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
return $elems;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
|
|
@@ -3,18 +3,18 @@ import { drawFs } from "flo-draw";
|
|
|
3
3
|
|
|
4
4
|
/** @internal */
|
|
5
5
|
function looseBoundingBox(
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
g: SVGGElement,
|
|
7
|
+
box: number[][],
|
|
8
8
|
classes = 'thin5 brown nofill',
|
|
9
9
|
delay = 0,
|
|
10
10
|
scaleFactor = 1) {
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const [[x0, y0],[x1, y1]] = box;
|
|
13
|
+
box = [[x0, y0],[x1, y0],[x1,y1],[x0,y1]];
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const $box = drawFs.polygon(g, box, classes, delay);
|
|
16
|
+
|
|
17
|
+
return $box;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
|
|
@@ -3,12 +3,12 @@ import { CpNode } from '../../../cp-node/cp-node.js';
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
/** @internal */
|
|
6
|
-
function maxVertex(g: SVGGElement, cpNode: CpNode) {
|
|
6
|
+
function maxVertex(g: SVGGElement, cpNode: CpNode) {
|
|
7
7
|
const circle = cpNode.cp.circle;
|
|
8
8
|
|
|
9
9
|
const $elems = drawFs.circle(g, circle, 'brown thin10 nofill');
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
return $elems;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
|
|
@@ -19,7 +19,7 @@ function oneProngAtDullCorner(
|
|
|
19
19
|
const $circle = drawFs.dot(g, oCircle.center, 0.25, 'orange');
|
|
20
20
|
const $pos = drawFs.circle(g, oCircle, 'orange thin10 nofill');
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
return [...$center, ...$circle, ...$pos];
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
|
|
@@ -16,7 +16,7 @@ function drawOneProng(
|
|
|
16
16
|
const $circle = drawFs.dot(g, circle.center, 0.05*scaleFactor, 'deeppink', delay);
|
|
17
17
|
const $pos = drawFs.circle(g, circle, 'deeppink thin5 nofill', delay);
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
return [...$center, ...$circle, ...$pos];
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
|
|
@@ -4,16 +4,16 @@ import { Curve } from '../../../curve/curve.js';
|
|
|
4
4
|
|
|
5
5
|
/** @internal */
|
|
6
6
|
function sharpCorner(
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
g: SVGGElement,
|
|
8
|
+
curve: Curve,
|
|
9
9
|
classes = 'green',
|
|
10
10
|
delay = 0,
|
|
11
11
|
scaleFactor = 1) {
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const p = curve.ps[curve.ps.length-1];
|
|
14
|
+
const $pos = drawFs.dot(g, p, 0.6*scaleFactor, 'green', delay);
|
|
15
|
+
|
|
16
|
+
return $pos;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
|
|
@@ -5,26 +5,26 @@ import { Circle, scaleCircle } from '../../../geometry/circle.js';
|
|
|
5
5
|
|
|
6
6
|
/** @internal */
|
|
7
7
|
function threeProng(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
g: SVGGElement,
|
|
9
|
+
threeProng: ThreeProngForDebugging,
|
|
10
|
+
classes?: string,
|
|
11
|
+
delay = 0,
|
|
12
|
+
scaleFactor = 1) {
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
14
|
+
const circle = scaleCircle(
|
|
15
|
+
threeProng.circle,
|
|
16
|
+
1
|
|
17
|
+
);
|
|
18
|
+
const poss = threeProng.poss;
|
|
19
|
+
|
|
20
|
+
const $cp1 = drawFs.dot(g, poss[0].p, 0.01*1*scaleFactor, 'blue', delay);
|
|
21
|
+
const $cp2 = drawFs.dot(g, poss[1].p, 0.01*2*scaleFactor, 'blue', delay);
|
|
22
|
+
const $cp3 = drawFs.dot(g, poss[2].p, 0.01*3*scaleFactor, 'blue', delay);
|
|
23
|
+
const $center = drawFs.dot(g, circle.center, 0.03*scaleFactor, 'blue', delay);
|
|
24
|
+
const $circle = drawFs.circle(g, circle, 'blue thin2 nofill', delay);
|
|
25
|
+
|
|
26
|
+
return [...$center, ...$cp1, ...$cp2, ...$cp3, ...$circle];
|
|
27
|
+
}
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
export { threeProng }
|
|
@@ -3,15 +3,15 @@ import { drawFs } from 'flo-draw';
|
|
|
3
3
|
|
|
4
4
|
/** @internal */
|
|
5
5
|
function tightBoundingBox(
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
g: SVGGElement,
|
|
7
|
+
box: number[][],
|
|
8
8
|
classes = 'thin5 pinker nofill',
|
|
9
9
|
delay = 0,
|
|
10
10
|
scaleFactor = 1) {
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const $box = drawFs.polygon(g, box, 'thin5 pinker nofill', delay);
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
return $box;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { drawFs } from 'flo-draw';
|
|
2
|
-
import { TwoProngForDebugging } from '../../two-prong-for-debugging.js';
|
|
3
|
-
import { getTwoProngType } from '../../../mat/get-two-prong-type.js';
|
|
1
|
+
// import { drawFs } from 'flo-draw';
|
|
2
|
+
// import { TwoProngForDebugging } from '../../two-prong-for-debugging.js';
|
|
3
|
+
// import { getTwoProngType } from '../../../mat/get-two-prong-type.js';
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
/** @internal */
|
|
7
|
-
function twoProng(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
// /** @internal */
|
|
7
|
+
// function twoProng(
|
|
8
|
+
// g: SVGGElement,
|
|
9
|
+
// twoProng: TwoProngForDebugging,
|
|
10
|
+
// classes?: string,
|
|
11
|
+
// delay = 0,
|
|
12
|
+
// scaleFactor = 1) {
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
// let $failedDot : SVGElement[] = [];
|
|
15
|
+
// let $center : SVGElement[] = [];
|
|
16
|
+
// let $circle : SVGElement[] = [];
|
|
17
|
+
// let $cp1 : SVGElement[] = [];
|
|
18
|
+
// let $cp2 : SVGElement[] = [];
|
|
19
|
+
|
|
20
|
+
// let color;
|
|
21
|
+
// let thin;
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
23
|
+
// switch (getTwoProngType(twoProng)) {
|
|
24
|
+
// case 'twoProng_regular': {
|
|
25
|
+
// color = 'red ';
|
|
26
|
+
// thin = '2';
|
|
27
|
+
// break;
|
|
28
|
+
// }
|
|
29
|
+
// case 'twoProng_holeClosing': {
|
|
30
|
+
// color = 'cyan ';
|
|
31
|
+
// thin = '10';
|
|
32
|
+
// break;
|
|
33
|
+
// }
|
|
34
|
+
// }
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
// if (twoProng.failed) {
|
|
38
|
+
// $failedDot = drawFs.dot(g, twoProng.pos.p, 1*scaleFactor, 'black', delay);
|
|
39
|
+
// } else if (!twoProng.failed) {
|
|
40
|
+
// $center = drawFs.dot (g, twoProng.circle.center, 0.01*scaleFactor, 'yellow', delay);
|
|
41
|
+
// $circle = drawFs.circle(g, twoProng.circle, color + 'thin' + thin + ' nofill', delay);
|
|
42
|
+
// $cp1 = drawFs.dot (g, twoProng.pos.p, 0.0175*scaleFactor, color, delay);
|
|
43
|
+
// $cp2 = drawFs.dot (g, twoProng.z, 0.035*scaleFactor, color, delay);
|
|
44
|
+
// }
|
|
45
|
+
|
|
46
|
+
// return [...$failedDot, ...$center, ...$circle, ...$cp1, ...$cp2];
|
|
47
|
+
// }
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
export { twoProng }
|
|
50
|
+
// export { twoProng }
|
|
@@ -4,47 +4,47 @@ import { CpNode, getCpNodesOnCircle } from '../../../cp-node/cp-node.js';
|
|
|
4
4
|
|
|
5
5
|
/** @internal */
|
|
6
6
|
function vertex(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
g: SVGGElement,
|
|
8
|
+
cpNode: CpNode,
|
|
9
|
+
classes?: string,
|
|
10
|
+
delay?: number,/*
|
|
11
|
+
visible = true*/
|
|
12
|
+
scaleFactor = 1) {
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// const visibleClass = visible ? '' : ' invisible';
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
const circle = cpNode.cp.circle;
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
const THIN = 'thin20';
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const cps = getCpNodesOnCircle(cpNode);
|
|
21
|
+
console.log(cps)
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
let $svgs: SVGElement[] = [];
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const $circle = drawFs.circle(g, circle, 'red ' + THIN + ' nofill '/* + visibleClass*/, delay);
|
|
26
|
+
const $crossHair = drawFs.crossHair(g, circle.center, 'red ' + THIN + ' nofill '/* + visibleClass*/, 3, delay);
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
$svgs = [...$circle, ...$crossHair];
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
for (let i=0; i<cps.length; i++) {
|
|
31
|
+
const cp = cps[i];
|
|
32
|
+
const edgeCircle = cp.next.cp.circle;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const $circle = drawFs.circle(g, edgeCircle, 'pink ' + THIN + ' nofill '/* + visibleClass*/, delay);
|
|
35
|
+
const $crossHair = drawFs.crossHair(g, edgeCircle.center, 'pink ' + THIN + ' nofill '/* + visibleClass*/, 3, delay);
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
$svgs.push(...$circle, ...$crossHair)
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
const p1 = circle.center;
|
|
40
|
+
const p2 = edgeCircle.center;
|
|
41
|
+
const thin = i === 0 ? 'thin10' : (i === 1 ? 'thin20' : 'thin35');
|
|
42
|
+
const $line = drawFs.line(g, [p1, p2], 'yellow ' + thin + ' nofill '/* + visibleClass*/, delay);
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
$svgs.push(...$line);
|
|
45
|
+
}
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
return $svgs;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
|
|
@@ -4,11 +4,11 @@ import { posToHumanString } from '../../point-on-shape/pos-to-human-string.js';
|
|
|
4
4
|
|
|
5
5
|
/** @internal */
|
|
6
6
|
export interface IGeneralDebugFunctions {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
nameObj : (obj: any, pre?: string) => void,
|
|
8
|
+
δToString : (cpNodes: CpNode[]) => string[],
|
|
9
|
+
δsToString : (cpNodes: CpNode[][]) => string[][],
|
|
10
|
+
pointToStr : (p: number[], decimalPlaces?: number) => string
|
|
11
|
+
pointsToStr : (ps: number[][], decimalPlaces?: number) => string[],
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
|
|
@@ -19,7 +19,7 @@ let i = 0;
|
|
|
19
19
|
* Name the given object - for debugging purposes only
|
|
20
20
|
*/
|
|
21
21
|
function nameObj(o: any, pre = '') {
|
|
22
|
-
|
|
22
|
+
o.name = '' + pre + i++;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
|
|
@@ -29,9 +29,9 @@ function nameObj(o: any, pre = '') {
|
|
|
29
29
|
* @param cpNodes A boundary piece given by two CpNodes.
|
|
30
30
|
*/
|
|
31
31
|
function δToString(cpNodes: CpNode[]) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
return cpNodes.map(
|
|
33
|
+
cpNode => posToHumanString(cpNode.cp.pointOnShape)
|
|
34
|
+
);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
|
|
@@ -41,7 +41,7 @@ function δToString(cpNodes: CpNode[]) {
|
|
|
41
41
|
* @param cpNodes An array of boundary pieces.
|
|
42
42
|
*/
|
|
43
43
|
function δsToString(cpNodes: CpNode[][]) {
|
|
44
|
-
|
|
44
|
+
return cpNodes.map(δToString);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
|
|
@@ -51,7 +51,7 @@ function δsToString(cpNodes: CpNode[][]) {
|
|
|
51
51
|
* @param ps
|
|
52
52
|
*/
|
|
53
53
|
function pointsToStr(ps: number[][], decimalPlaces = 3) {
|
|
54
|
-
|
|
54
|
+
return ps.map(p => pointToStr(p, decimalPlaces));
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
|
|
@@ -62,18 +62,18 @@ function pointsToStr(ps: number[][], decimalPlaces = 3) {
|
|
|
62
62
|
* @param decimalPlaces number of decimal places
|
|
63
63
|
*/
|
|
64
64
|
function pointToStr(p: number[], decimalPlaces = 3) {
|
|
65
|
-
|
|
65
|
+
return p[0].toFixed(decimalPlaces) + ', ' + p[1].toFixed(decimalPlaces);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
/** @internal */
|
|
70
70
|
const generalDebugFunctions/*: IGeneralDebugFunctions*/ = {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
71
|
+
δToString,
|
|
72
|
+
δsToString,
|
|
73
|
+
pointToStr,
|
|
74
|
+
pointsToStr,
|
|
75
|
+
nameObj,
|
|
76
|
+
}
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
export { generalDebugFunctions }
|