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
|
@@ -11,7 +11,7 @@ import { compareCps } from '../contact-point/contact-point.js';
|
|
|
11
11
|
function getBoundaryPieceBeziers(cpNodes) {
|
|
12
12
|
let cpThis = cpNodes[0];
|
|
13
13
|
const cpEnd = cpNodes[1];
|
|
14
|
-
const
|
|
14
|
+
const curvePieces = [];
|
|
15
15
|
// As opposed to going around the circle and taking the last exit
|
|
16
16
|
let goStraight = true;
|
|
17
17
|
do {
|
|
@@ -30,28 +30,28 @@ function getBoundaryPieceBeziers(cpNodes) {
|
|
|
30
30
|
}
|
|
31
31
|
else if (posNext.curve === posThis.curve &&
|
|
32
32
|
compareCps(cpThis.next.cp, cpThis.cp) > 0) {
|
|
33
|
-
|
|
33
|
+
curvePieces.push({ curve: posThis.curve, ts: [posThis.t, posNext.t] });
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
|
-
|
|
36
|
+
curvePieces.push({ curve: posThis.curve, ts: [posThis.t, 1] });
|
|
37
37
|
if (posThis.curve.loop === posNext.curve.loop) {
|
|
38
|
-
addSkippedBeziers(
|
|
38
|
+
addSkippedBeziers(curvePieces, posThis.curve, posNext.curve, posNext.t);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
cpThis = cpThis.next;
|
|
42
42
|
} while (cpThis !== cpEnd);
|
|
43
|
-
return
|
|
43
|
+
return curvePieces;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* @internal
|
|
47
47
|
* Adds pieces of skipped beziers
|
|
48
48
|
*/
|
|
49
|
-
function addSkippedBeziers(
|
|
49
|
+
function addSkippedBeziers(curvePieces, curveStart, curveEnd, t1) {
|
|
50
50
|
let curveThis = curveStart;
|
|
51
51
|
do {
|
|
52
52
|
curveThis = curveThis.next;
|
|
53
53
|
const tEnd = curveThis === curveEnd ? t1 : 1;
|
|
54
|
-
|
|
54
|
+
curvePieces.push({ curve: curveThis, ts: [0, tEnd] });
|
|
55
55
|
} while (curveThis !== curveEnd);
|
|
56
56
|
}
|
|
57
57
|
export { getBoundaryPieceBeziers };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-boundary-piece-beziers.js","sourceRoot":"","sources":["../../src/mat/get-boundary-piece-beziers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAG/D;;;;;;;GAOG;AACH,SAAS,uBAAuB,CAAC,OAAiB;IAC9C,IAAI,MAAM,GAAG,OAAO,CAAC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AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAGhE,gBAAgB;AAChB,SAAS,gBAAgB,CAAC,MAAc;
|
|
1
|
+
{"version":3,"file":"get-largest-vertex.js","sourceRoot":"","sources":["../../src/mat/get-largest-vertex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAGhE,gBAAgB;AAChB,SAAS,gBAAgB,CAAC,MAAc;IACpC,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAErC,OAAO,OAAO,CAAC,MAAM,CAAC,UAAS,SAAiB,EAAE,MAAc;QAC5D,OAAO,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM;YACxD,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,MAAM,CAAA;IAChB,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|
package/node/mat/trim-mat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trim-mat.js","sourceRoot":"","sources":["../../src/mat/trim-mat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAG/C;;;;GAIG;AACH,SAAS,OAAO,CAAC,GAAQ;
|
|
1
|
+
{"version":3,"file":"trim-mat.js","sourceRoot":"","sources":["../../src/mat/trim-mat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAG/C;;;;GAIG;AACH,SAAS,OAAO,CAAC,GAAQ;IACrB,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAEhD,IAAI,CAAC,MAAM,EAAE,CAAC;QAAC,OAAO,SAAU,CAAC;IAAC,CAAC;IAEnC,OAAO;QACH,MAAM;QACN,IAAI,EAAE;YACF,GAAG,GAAG,CAAC,IAAI;YACX,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC;SACnC;KACJ,CAAA;AACL,CAAC;AAGD,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memoize-primitive.js","sourceRoot":"","sources":["../src/memoize-primitive.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,SAAS,gBAAgB,CAAO,CAAc;
|
|
1
|
+
{"version":3,"file":"memoize-primitive.js","sourceRoot":"","sources":["../src/memoize-primitive.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,SAAS,gBAAgB,CAAO,CAAc;IAC1C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAO,CAAC;IAE/B,OAAO,UAAS,CAAI;QAChB,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACvB,2BAA2B;YAC3B,OAAO,MAAM,CAAC;QAClB,CAAC;QAED,4BAA4B;QAC5B,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QAEvB,OAAO,MAAM,CAAC;IAClB,CAAC,CAAA;AACL,CAAC;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-debug-info.js","sourceRoot":"","sources":["../../src/sat/add-debug-info.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,SAAS,YAAY,
|
|
1
|
+
{"version":3,"file":"add-debug-info.js","sourceRoot":"","sources":["../../src/sat/add-debug-info.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,SAAS,YAAY,CACb,WAAmB;IAEvB,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IAE/C,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC;IACxC,MAAM,CAAC,IAAI,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC;AAClD,CAAC;AAGD,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
package/node/sat/cull.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { CpNode } from '../cp-node/cp-node.js';
|
|
2
|
-
import { DualSet } from '../utils/dual-set.js';
|
|
1
|
+
import type { CpNode } from '../cp-node/cp-node.js';
|
|
2
|
+
import type { DualSet } from '../utils/dual-set.js';
|
|
3
3
|
/**
|
|
4
|
-
* @internal
|
|
5
4
|
* Returns the set of Vertices passing the following test: walk the MAT tree and
|
|
6
5
|
* keep all Vertices not in the current cull set and any Vertices that have a
|
|
7
6
|
* non-culled node further down the line toward the tree leaves.
|
|
8
|
-
*
|
|
9
|
-
* @param
|
|
7
|
+
*
|
|
8
|
+
* @param culls the `CpNode`s (referred to by circles) that should be culled
|
|
9
|
+
* @param maxCpNode the start `CpNode` which must represent the maximal vertex
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
10
12
|
*/
|
|
11
13
|
declare function cull(culls: DualSet<number, number>, maxCpNode: CpNode): void;
|
|
12
14
|
export { cull };
|
package/node/sat/cull.js
CHANGED
|
@@ -4,8 +4,9 @@ import { isTerminating } from '../cp-node/fs/is-terminating.js';
|
|
|
4
4
|
import { DualSetFs } from '../utils/dual-set.js';
|
|
5
5
|
const { isOnSameCircle } = CpNodeFs;
|
|
6
6
|
/**
|
|
7
|
+
* Returns the set of non-trivial forward edges starting from the given `CpNode`.
|
|
7
8
|
*
|
|
8
|
-
* @param cpStart
|
|
9
|
+
* @param cpStart the start `CpNode`
|
|
9
10
|
*/
|
|
10
11
|
function getNonTrivialForwardEdges(cpStart) {
|
|
11
12
|
let cpNode = cpStart;
|
|
@@ -23,12 +24,14 @@ function getNonTrivialForwardEdges(cpStart) {
|
|
|
23
24
|
return cps;
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
|
-
* @internal
|
|
27
27
|
* Returns the set of Vertices passing the following test: walk the MAT tree and
|
|
28
28
|
* keep all Vertices not in the current cull set and any Vertices that have a
|
|
29
29
|
* non-culled node further down the line toward the tree leaves.
|
|
30
|
-
*
|
|
31
|
-
* @param
|
|
30
|
+
*
|
|
31
|
+
* @param culls the `CpNode`s (referred to by circles) that should be culled
|
|
32
|
+
* @param maxCpNode the start `CpNode` which must represent the maximal vertex
|
|
33
|
+
*
|
|
34
|
+
* @internal
|
|
32
35
|
*/
|
|
33
36
|
function cull(culls, maxCpNode) {
|
|
34
37
|
const leaves = getLeaves(maxCpNode);
|
package/node/sat/cull.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cull.js","sourceRoot":"","sources":["../../src/sat/cull.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cull.js","sourceRoot":"","sources":["../../src/sat/cull.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,MAAM,EAAE,cAAc,EAAE,GAAG,QAAQ,CAAC;AAGpC;;;;GAIG;AACH,SAAS,yBAAyB,CAAC,OAAe;IAC9C,IAAI,MAAM,GAAG,OAAO,CAAC;IACrB,IAAI,KAAK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AC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpC,qDAAqD;gBACrD,OAAO,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;oBACxC,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC;gBACjC,CAAC;gBACD,GAAG,GAAG,IAAI,CAAC;YACf,CAAC;iBAAM,IAAI,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC;gBAC3C,GAAG,GAAG,IAAI,CAAC,CAAC,0CAA0C;YAC1D,CAAC;iBAAM,CAAC;gBACJ,MAAM,GAAG,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;gBAE9C,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBACnB,SAAS;gBACb,CAAC;qBAAM,CAAC;oBACJ,GAAG,GAAG,IAAI,CAAC;gBACf,CAAC;YACL,CAAC;QACL,CAAC;QAED,IAAI,GAAG,EAAE,CAAC;YACN,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC;YAChC,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC;YAClB,MAAM,CAAC,IAAI,GAAG,GAAG,CAAC;YAElB,GAAG,CAAC,YAAY,GAAG,MAAM,CAAC;YAC1B,MAAM,CAAC,YAAY,GAAG,GAAG,CAAC;QAC9B,CAAC;IACL,CAAC;AACL,CAAC;AAGD,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-leaves.js","sourceRoot":"","sources":["../../src/sat/get-leaves.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"get-leaves.js","sourceRoot":"","sources":["../../src/sat/get-leaves.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAE3E,MAAM,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAC;AAGlC,gBAAgB;AAChB,SAAS,SAAS,CAAC,MAAc;IAC7B,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACjC,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACnB,IAAI,kBAAkB,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;YAC9C,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACpB,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAGD,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -8,8 +8,9 @@ import { Mat } from '../mat/mat.js';
|
|
|
8
8
|
* boundary of the shape. The SAT is a simplification of the MAT that preserves
|
|
9
9
|
* less detail the higher the applied scale factor. The severity at which noise
|
|
10
10
|
* are removed depends on the local scale of the shape.
|
|
11
|
-
*
|
|
12
|
-
* @param
|
|
11
|
+
*
|
|
12
|
+
* @param mat the Medial Axis Transform (MAT) on which to apply the SAT
|
|
13
|
+
* @param s the scale factor >= 1 (e.g. 1.3)
|
|
13
14
|
*/
|
|
14
15
|
declare function toScaleAxis(mat: Mat, s: number): Mat;
|
|
15
16
|
export { toScaleAxis };
|
|
@@ -13,8 +13,9 @@ import { getSatCulls } from './get-sat-culls.js';
|
|
|
13
13
|
* boundary of the shape. The SAT is a simplification of the MAT that preserves
|
|
14
14
|
* less detail the higher the applied scale factor. The severity at which noise
|
|
15
15
|
* are removed depends on the local scale of the shape.
|
|
16
|
-
*
|
|
17
|
-
* @param
|
|
16
|
+
*
|
|
17
|
+
* @param mat the Medial Axis Transform (MAT) on which to apply the SAT
|
|
18
|
+
* @param s the scale factor >= 1 (e.g. 1.3)
|
|
18
19
|
*/
|
|
19
20
|
function toScaleAxis(mat, s) {
|
|
20
21
|
let timingStart = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-scale-axis.js","sourceRoot":"","sources":["../../src/sat/to-scale-axis.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD
|
|
1
|
+
{"version":3,"file":"to-scale-axis.js","sourceRoot":"","sources":["../../src/sat/to-scale-axis.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD;;;;;;;;;;;;GAYG;AACH,SAAS,WAAW,CACZ,GAAQ,EACR,CAAS;IAEb,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;QACjC,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IACpC,CAAC;IAED,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAErC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAEpB,MAAM,GAAG,GAAQ;QACb,MAAM,EAAE,MAAM;QACd,IAAI,EAAE;YACF,GAAG,GAAG,CAAC,IAAI;YACX,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC;SACnC;KACJ,CAAC;IAGF,YAAY,CAAC,WAAW,CAAC,CAAC;IAE1B,OAAO,GAAG,CAAC;AACf,CAAC;AAGD,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-loop-bounds.js","sourceRoot":"","sources":["../../src/svg/get-loop-bounds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAItC,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG5D,gBAAgB;AAChB,MAAM,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAGrC;;GAEG;AACH,MAAM,aAAa,GAAG,OAAO,CAAC,UAAS,IAAU;
|
|
1
|
+
{"version":3,"file":"get-loop-bounds.js","sourceRoot":"","sources":["../../src/svg/get-loop-bounds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAItC,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG5D,gBAAgB;AAChB,MAAM,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAGrC;;GAEG;AACH,MAAM,aAAa,GAAG,OAAO,CAAC,UAAS,IAAU;IAM7C,MAAM,QAAQ,GAIN;QACJ;YACI,EAAE,MAAM,EAAE,SAAU,EAAE,CAAC,EAAE,SAAU,EAAE,GAAG,EAAE,GAAG,EAAC;YAC9C,EAAE,MAAM,EAAE,SAAU,EAA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,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-min-y-pos.js","sourceRoot":"","sources":["../../src/svg/get-min-y-pos.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD;;;GAGG;AACH,SAAS,UAAU,CAAC,IAAU;
|
|
1
|
+
{"version":3,"file":"get-min-y-pos.js","sourceRoot":"","sources":["../../src/svg/get-min-y-pos.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD;;;GAGG;AACH,SAAS,UAAU,CAAC,IAAU;IAC1B,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;AACpC,CAAC;AAGD,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sweep-line.js","sourceRoot":"","sources":["../../src/sweep-line/sweep-line.ts"],"names":[],"mappings":"AACA,gBAAgB;AAChB,MAAM,UAAU,GAAI,CAAC,CAAC;AACtB,gBAAgB;AAChB,MAAM,WAAW,GAAG,CAAC,CAAC;AAOtB;;;;;;;;;;;;;;;GAeG;AACH,SAAS,SAAS,CACV,KAAU,EACV,WAAgC,EAChC,YAAiC,EACjC,SAA0C;IAE9C,mDAAmD;IACnD,MAAM,MAAM,GAAgB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"sweep-line.js","sourceRoot":"","sources":["../../src/sweep-line/sweep-line.ts"],"names":[],"mappings":"AACA,gBAAgB;AAChB,MAAM,UAAU,GAAI,CAAC,CAAC;AACtB,gBAAgB;AAChB,MAAM,WAAW,GAAG,CAAC,CAAC;AAOtB;;;;;;;;;;;;;;;GAeG;AACH,SAAS,SAAS,CACV,KAAU,EACV,WAAgC,EAChC,YAAiC,EACjC,SAA0C;IAE9C,mDAAmD;IACnD,MAAM,MAAM,GAAgB,EAAE,CAAC;IAC/B,KAAK,MAAM,IAAI,IAA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,CAAC;IAAC,CAAC;IAE9B,2CAA2C;IAC3C,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC;AAGD,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "flo-mat",
|
|
3
3
|
"sideEffects": false,
|
|
4
4
|
"description": "Medial / Scale Axis Transform (MAT/SAT) Library.",
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.11",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Floris Steenkamp"
|
|
8
8
|
},
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"big-float-ts": "^4.0.2",
|
|
35
35
|
"double-double": "^3.0.4",
|
|
36
|
-
"flo-bezier3": "^6.0.
|
|
36
|
+
"flo-bezier3": "^6.0.8",
|
|
37
37
|
"flo-boolean": "^5.0.3",
|
|
38
38
|
"flo-draw": "^2.0.5",
|
|
39
39
|
"flo-gauss-quadrature": "^2.1.4",
|
|
@@ -44,22 +44,22 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@jest/globals": "^30.4.1",
|
|
47
|
-
"@swc/core": "^1.15.
|
|
47
|
+
"@swc/core": "^1.15.40",
|
|
48
48
|
"@swc/jest": "^0.2.39",
|
|
49
49
|
"@types/jest": "^30.0.0",
|
|
50
|
-
"@types/node": "^25.9.
|
|
50
|
+
"@types/node": "^25.9.1",
|
|
51
51
|
"jest": "^30.4.2",
|
|
52
52
|
"jest-ts-webcompat-resolver": "^1.0.1",
|
|
53
53
|
"c8": "^11.0.0",
|
|
54
54
|
"chai": "^6.2.2",
|
|
55
55
|
"circular-dependency-plugin": "^5.2.2",
|
|
56
|
-
"mocha": "^11.7.
|
|
56
|
+
"mocha": "^11.7.6",
|
|
57
57
|
"rimraf": "^6.1.3",
|
|
58
58
|
"source-map-support": "^0.5.21",
|
|
59
59
|
"ts-loader": "^9.5.7",
|
|
60
60
|
"ts-node": "^10.9.2",
|
|
61
61
|
"typescript": "^6.0.3",
|
|
62
|
-
"webpack": "^5.
|
|
62
|
+
"webpack": "^5.107.1",
|
|
63
63
|
"webpack-cli": "^7.0.2"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
@@ -18,21 +18,21 @@ function joinSpokes(
|
|
|
18
18
|
|
|
19
19
|
/** @internal */
|
|
20
20
|
function byAngle(circle: Circle) {
|
|
21
|
-
|
|
21
|
+
const c = circle.center;
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
return function(_a: CpNode, _b: CpNode) {
|
|
24
|
+
let a = _a.cp.pointOnShape.p;
|
|
25
|
+
let b = _b.cp.pointOnShape.p;
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
// Move onto origin
|
|
28
|
+
a = [a[0] - c[0], a[1] - c[1]];
|
|
29
|
+
b = [b[0] - c[0], b[1] - c[1]];
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const a_ = Math.atan2(a[1], a[0]);
|
|
32
|
+
const b_ = Math.atan2(b[1], b[0]);
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
return b_ - a_;
|
|
35
|
+
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
|
|
@@ -5,31 +5,32 @@ import { cullByTightBoundingBox } from './cull-by-tight-boundary-box.js';
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @
|
|
9
|
-
* @param bezierPieces
|
|
8
|
+
* @param curvePieces
|
|
10
9
|
* @param p
|
|
11
10
|
* @param extreme
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
12
13
|
*/
|
|
13
|
-
function
|
|
14
|
-
|
|
14
|
+
function cullCurvePieces1(
|
|
15
|
+
curvePieces: CurvePiece[],
|
|
15
16
|
p: number[]) {
|
|
16
17
|
|
|
17
18
|
const bestSquaredDistance = getBestDistanceSquared(
|
|
18
|
-
|
|
19
|
+
curvePieces, p
|
|
19
20
|
);
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
curvePieces = cullByLooseBoundingBox(
|
|
22
|
+
curvePieces, p,
|
|
22
23
|
bestSquaredDistance
|
|
23
24
|
);
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
curvePieces = cullByTightBoundingBox(
|
|
27
|
+
curvePieces, p,
|
|
27
28
|
bestSquaredDistance
|
|
28
29
|
);
|
|
29
30
|
|
|
30
31
|
|
|
31
|
-
return
|
|
32
|
+
return curvePieces;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
export {
|
|
36
|
+
export { cullCurvePieces1 }
|
|
@@ -8,20 +8,20 @@ import { getBoundingBox$ } from '../geometry/get-bounding-box-.js';
|
|
|
8
8
|
* @internal
|
|
9
9
|
* When checking distances, ignore all those with closest possible distance
|
|
10
10
|
* further than 'bestSquaredDistance', i.e. cull them.
|
|
11
|
-
* @param
|
|
11
|
+
* @param curvePieces
|
|
12
12
|
* @param p
|
|
13
13
|
* @param dSquared
|
|
14
14
|
*/
|
|
15
15
|
function cullByLooseBoundingBox(
|
|
16
|
-
|
|
16
|
+
curvePieces: CurvePiece[],
|
|
17
17
|
p: number[],
|
|
18
18
|
dSquared: number) {
|
|
19
19
|
|
|
20
|
-
const
|
|
20
|
+
const candidateCurvePieces = [];
|
|
21
21
|
|
|
22
|
-
for (let i=0; i<
|
|
23
|
-
const
|
|
24
|
-
const ps =
|
|
22
|
+
for (let i=0; i<curvePieces.length; i++) {
|
|
23
|
+
const curvePiece = curvePieces[i];
|
|
24
|
+
const ps = curvePiece.curve.ps;
|
|
25
25
|
|
|
26
26
|
const boundingBox = getBoundingBox$(ps);
|
|
27
27
|
|
|
@@ -30,11 +30,11 @@ function cullByLooseBoundingBox(
|
|
|
30
30
|
p
|
|
31
31
|
);
|
|
32
32
|
if (d <= dSquared) {
|
|
33
|
-
|
|
33
|
+
candidateCurvePieces.push(curvePiece);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
return
|
|
37
|
+
return candidateCurvePieces;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
|
|
@@ -11,20 +11,20 @@ const getBoundingBoxTight_ = memoize(getBoundingBoxTight);
|
|
|
11
11
|
* @internal
|
|
12
12
|
* When checking distances, ignore all those with closest possible distance
|
|
13
13
|
* further than 'bestSquaredDistance', i.e. cull them.
|
|
14
|
-
* @param
|
|
14
|
+
* @param curvePieces
|
|
15
15
|
* @param p
|
|
16
16
|
* @param bestSquaredDistance
|
|
17
17
|
*/
|
|
18
18
|
function cullByTightBoundingBox(
|
|
19
|
-
|
|
19
|
+
curvePieces: CurvePiece[],
|
|
20
20
|
p: number[],
|
|
21
21
|
bestSquaredDistance: number) {
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const candidateCurvePieces = [];
|
|
24
24
|
|
|
25
|
-
for (let i=0; i<
|
|
26
|
-
const
|
|
27
|
-
const ps =
|
|
25
|
+
for (let i=0; i<curvePieces.length; i++) {
|
|
26
|
+
const curvePiece = curvePieces[i];
|
|
27
|
+
const ps = curvePiece.curve.ps;
|
|
28
28
|
|
|
29
29
|
const tightBoundingBox = getBoundingBoxTight_(ps);
|
|
30
30
|
const d = getClosestSquaredDistanceToRotatedRect(
|
|
@@ -32,11 +32,11 @@ function cullByTightBoundingBox(
|
|
|
32
32
|
p
|
|
33
33
|
);
|
|
34
34
|
if (d <= bestSquaredDistance) {
|
|
35
|
-
|
|
35
|
+
candidateCurvePieces.push(curvePiece);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
return
|
|
39
|
+
return candidateCurvePieces;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
|
|
@@ -34,14 +34,14 @@ const γγ3 = γγ(3);
|
|
|
34
34
|
* @doc
|
|
35
35
|
*/
|
|
36
36
|
function ddDeflateWithRunningError(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
p: number[][],
|
|
38
|
+
pE: number[],
|
|
39
|
+
t: number): {
|
|
40
|
+
coeffs: number[][];
|
|
41
|
+
errBound: number[];
|
|
42
|
+
} {
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
//--------------------------------------------------------------------------
|
|
45
45
|
// `var` -> a variable
|
|
46
46
|
// `$var` -> the double precision approximation to `var`
|
|
47
47
|
// `_var` -> the absolute value of $var (a prefix underscore on a variable means absolute value)
|
|
@@ -56,29 +56,29 @@ function ddDeflateWithRunningError(
|
|
|
56
56
|
// due to multiplication by 3*γ² and not 3*u²
|
|
57
57
|
//--------------------------------------------------------------------------
|
|
58
58
|
const d = p.length - 1;
|
|
59
|
-
|
|
59
|
+
const bs = [p[0]]; // coefficients
|
|
60
60
|
let b_ = pE[0]; // running error
|
|
61
|
-
|
|
61
|
+
const bEs = [b_]; // coefficient-wise error bound
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
for (let i=1; i<d; i++) {
|
|
64
64
|
// p[i] + t*bs[i-1];
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
const a = bs[i-1];
|
|
67
|
+
const $m = t*a[1];
|
|
68
|
+
const _t = abs(t);
|
|
69
|
+
const m_ = _t*b_ + abs($m);
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
const pi = p[i];
|
|
72
|
+
const p_ = pE[i];
|
|
73
|
+
b_ = p_ + m_ + abs(pi[1] + $m);
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
const b = qaq(pi,qmd(t,a));
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
bs.push(b);
|
|
78
|
+
bEs.push(b_);
|
|
79
|
+
}
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
return {
|
|
82
82
|
coeffs: bs,
|
|
83
83
|
errBound: bEs.map(e => γγ3*e)
|
|
84
84
|
};
|
|
@@ -9,17 +9,17 @@ import { CurvePiece } from "../mat/curve-piece.js";
|
|
|
9
9
|
* this distance away.
|
|
10
10
|
*/
|
|
11
11
|
function getBestDistanceSquared(
|
|
12
|
-
|
|
12
|
+
curvePieces: CurvePiece[],
|
|
13
13
|
p: number[]) {
|
|
14
14
|
|
|
15
15
|
let bestSquaredDistance = Number.POSITIVE_INFINITY;
|
|
16
|
-
for (let i=0; i<
|
|
17
|
-
const
|
|
16
|
+
for (let i=0; i<curvePieces.length; i++) {
|
|
17
|
+
const curvePiece = curvePieces[i];
|
|
18
18
|
|
|
19
|
-
const ps =
|
|
19
|
+
const ps = curvePiece.curve.ps;
|
|
20
20
|
|
|
21
|
-
const p1 = evalDeCasteljau(ps,
|
|
22
|
-
const p2 = evalDeCasteljau(ps,
|
|
21
|
+
const p1 = evalDeCasteljau(ps, curvePiece.ts[0]);
|
|
22
|
+
const p2 = evalDeCasteljau(ps, curvePiece.ts[1]);
|
|
23
23
|
|
|
24
24
|
const d = Math.min(
|
|
25
25
|
squaredDistanceBetween(p, p1),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CurvePiece } from '../mat/curve-piece.js';
|
|
2
2
|
import { getPotentialClosestPointsOnCurveCertified } from './get-potential-closest-points-on-curve-certified.js';
|
|
3
|
-
import {
|
|
3
|
+
import { cullCurvePieces1 } from './cull-bezier-pieces.js';
|
|
4
4
|
import { Curve } from '../curve/curve.js';
|
|
5
5
|
import { FootAndEndpointInfo } from './foot-and-endpoint-info.js';
|
|
6
6
|
import { PointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
@@ -13,7 +13,7 @@ import { createPos } from '../point-on-shape/create-pos.js';
|
|
|
13
13
|
* bezier pieces, including the beziers actually checked after culling.
|
|
14
14
|
*
|
|
15
15
|
* @param pow
|
|
16
|
-
* @param
|
|
16
|
+
* @param curvePieces
|
|
17
17
|
* @param x
|
|
18
18
|
* @param touchedCurve
|
|
19
19
|
* @param t
|
|
@@ -21,53 +21,53 @@ import { createPos } from '../point-on-shape/create-pos.js';
|
|
|
21
21
|
* @param angle defaults to `0`
|
|
22
22
|
*/
|
|
23
23
|
function getCloseBoundaryPointsCertified(
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
pow: number,
|
|
25
|
+
curvePieces: CurvePiece[],
|
|
26
26
|
x: number[],
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
touchedCurve: Curve | undefined = undefined,
|
|
28
|
+
t: number | undefined = undefined,
|
|
29
|
+
for1Prong = false,
|
|
30
|
+
angle = 0): PointOnShape[] {
|
|
31
|
+
|
|
32
|
+
curvePieces = cullCurvePieces1(curvePieces, x);
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
const pInfoss: FootAndEndpointInfo[] = [];
|
|
35
|
+
for (let i=0; i<curvePieces.length; i++) {
|
|
36
|
+
const curvePiece = curvePieces[i];
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
const pInfos = getPotentialClosestPointsOnCurveCertified(
|
|
39
|
+
pow,
|
|
40
|
+
curvePiece.curve,
|
|
41
|
+
x,
|
|
42
|
+
curvePiece.ts,
|
|
43
|
+
touchedCurve,
|
|
44
|
+
t,
|
|
45
|
+
for1Prong,
|
|
46
|
+
angle
|
|
47
|
+
);
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
pInfoss.push(...pInfos);
|
|
50
|
+
}
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
/** the minimum max interval value */
|
|
53
|
+
let minMax = Number.POSITIVE_INFINITY;
|
|
54
|
+
for (let i=0; i<pInfoss.length; i++) {
|
|
55
|
+
const diMax = pInfoss[i].dSquaredI[1];
|
|
56
|
+
if (diMax < minMax) {
|
|
57
|
+
minMax = diMax;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
const closestPointInfos: FootAndEndpointInfo[] = [];
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
for (let i=0; i<pInfoss.length; i++) {
|
|
64
|
+
const info = pInfoss[i];
|
|
65
|
+
if (info.dSquaredI[0] <= minMax) {
|
|
66
|
+
closestPointInfos.push(info);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
return closestPointInfos.map(info => createPos(info.curve, info.t, false));
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
|