flo-mat 3.0.9 → 3.0.10
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/browser/index.js +193 -190
- package/browser/index.min.js +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/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/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-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/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/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/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/mat/get-boundary-piece-beziers.js +7 -7
- package/node/mat/get-boundary-piece-beziers.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/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/package.json +5 -5
- 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/get-best-distance-squared.ts +6 -6
- package/src/closest-boundary-point/get-close-boundary-points-certified.ts +8 -8
- 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-salience.ts +2 -2
- package/src/cp-node/fs/get-speed.ts +1 -6
- package/src/curve/curve.ts +5 -5
- package/src/debug/functions/draw-elem/two-prong.ts +40 -40
- package/src/debug/functions/two-prong.ts +195 -195
- package/src/debug/two-prong-for-debugging.ts +26 -26
- 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 +8 -8
- 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 +16 -16
- package/src/find-3-prong.ts/find-3-prong.ts +2 -2
- package/src/find-3-prong.ts/get-closest-points.ts +4 -4
- package/src/find-mat/add-2-prongs-by-error.ts +7 -7
- package/src/index.ts +1 -1
- package/src/mat/get-boundary-piece-beziers.ts +7 -7
- package/src/mat/get-two-prong-type.ts +8 -8
- package/src/sat/cull.ts +10 -7
- package/src/sat/to-scale-axis.ts +18 -17
- package/src/utils/bezier-piece-to-bezier.ts +7 -7
- 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
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { CurvePiece } from '../mat/curve-piece.js';
|
|
2
2
|
/**
|
|
3
|
-
* @
|
|
4
|
-
* @param bezierPieces
|
|
3
|
+
* @param curvePieces
|
|
5
4
|
* @param p
|
|
6
5
|
* @param extreme
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
7
8
|
*/
|
|
8
|
-
declare function
|
|
9
|
-
export {
|
|
9
|
+
declare function cullCurvePieces1(curvePieces: CurvePiece[], p: number[]): CurvePiece[];
|
|
10
|
+
export { cullCurvePieces1 };
|
|
@@ -2,16 +2,17 @@ import { getBestDistanceSquared } from './get-best-distance-squared.js';
|
|
|
2
2
|
import { cullByLooseBoundingBox } from './cull-by-loose-bounding-box.js';
|
|
3
3
|
import { cullByTightBoundingBox } from './cull-by-tight-boundary-box.js';
|
|
4
4
|
/**
|
|
5
|
-
* @
|
|
6
|
-
* @param bezierPieces
|
|
5
|
+
* @param curvePieces
|
|
7
6
|
* @param p
|
|
8
7
|
* @param extreme
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
9
10
|
*/
|
|
10
|
-
function
|
|
11
|
-
const bestSquaredDistance = getBestDistanceSquared(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return
|
|
11
|
+
function cullCurvePieces1(curvePieces, p) {
|
|
12
|
+
const bestSquaredDistance = getBestDistanceSquared(curvePieces, p);
|
|
13
|
+
curvePieces = cullByLooseBoundingBox(curvePieces, p, bestSquaredDistance);
|
|
14
|
+
curvePieces = cullByTightBoundingBox(curvePieces, p, bestSquaredDistance);
|
|
15
|
+
return curvePieces;
|
|
15
16
|
}
|
|
16
|
-
export {
|
|
17
|
+
export { cullCurvePieces1 };
|
|
17
18
|
//# sourceMappingURL=cull-bezier-pieces.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cull-bezier-pieces.js","sourceRoot":"","sources":["../../src/closest-boundary-point/cull-bezier-pieces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAGzE
|
|
1
|
+
{"version":3,"file":"cull-bezier-pieces.js","sourceRoot":"","sources":["../../src/closest-boundary-point/cull-bezier-pieces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAGzE;;;;;;GAMG;AACH,SAAS,gBAAgB,CACjB,WAAyB,EACzB,CAAW;IAEf,MAAM,mBAAmB,GAAG,sBAAsB,CAC9C,WAAW,EAAE,CAAC,CACjB,CAAC;IACF,WAAW,GAAG,sBAAsB,CAChC,WAAW,EAAE,CAAC,EACd,mBAAmB,CACtB,CAAC;IAEF,WAAW,GAAG,sBAAsB,CAChC,WAAW,EAAE,CAAC,EACd,mBAAmB,CACtB,CAAC;IAGF,OAAO,WAAW,CAAC;AACvB,CAAC;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -3,9 +3,9 @@ import { CurvePiece } from '../mat/curve-piece.js';
|
|
|
3
3
|
* @internal
|
|
4
4
|
* When checking distances, ignore all those with closest possible distance
|
|
5
5
|
* further than 'bestSquaredDistance', i.e. cull them.
|
|
6
|
-
* @param
|
|
6
|
+
* @param curvePieces
|
|
7
7
|
* @param p
|
|
8
8
|
* @param dSquared
|
|
9
9
|
*/
|
|
10
|
-
declare function cullByLooseBoundingBox(
|
|
10
|
+
declare function cullByLooseBoundingBox(curvePieces: CurvePiece[], p: number[], dSquared: number): CurvePiece[];
|
|
11
11
|
export { cullByLooseBoundingBox };
|
|
@@ -4,22 +4,22 @@ import { getBoundingBox$ } from '../geometry/get-bounding-box-.js';
|
|
|
4
4
|
* @internal
|
|
5
5
|
* When checking distances, ignore all those with closest possible distance
|
|
6
6
|
* further than 'bestSquaredDistance', i.e. cull them.
|
|
7
|
-
* @param
|
|
7
|
+
* @param curvePieces
|
|
8
8
|
* @param p
|
|
9
9
|
* @param dSquared
|
|
10
10
|
*/
|
|
11
|
-
function cullByLooseBoundingBox(
|
|
12
|
-
const
|
|
13
|
-
for (let i = 0; i <
|
|
14
|
-
const
|
|
15
|
-
const ps =
|
|
11
|
+
function cullByLooseBoundingBox(curvePieces, p, dSquared) {
|
|
12
|
+
const candidateCurvePieces = [];
|
|
13
|
+
for (let i = 0; i < curvePieces.length; i++) {
|
|
14
|
+
const curvePiece = curvePieces[i];
|
|
15
|
+
const ps = curvePiece.curve.ps;
|
|
16
16
|
const boundingBox = getBoundingBox$(ps);
|
|
17
17
|
const d = getClosestSquareDistanceToRect(boundingBox, p);
|
|
18
18
|
if (d <= dSquared) {
|
|
19
|
-
|
|
19
|
+
candidateCurvePieces.push(curvePiece);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
return
|
|
22
|
+
return candidateCurvePieces;
|
|
23
23
|
}
|
|
24
24
|
export { cullByLooseBoundingBox };
|
|
25
25
|
//# sourceMappingURL=cull-by-loose-bounding-box.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cull-by-loose-bounding-box.js","sourceRoot":"","sources":["../../src/closest-boundary-point/cull-by-loose-bounding-box.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AACpG,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGnE;;;;;;;GAOG;AACH,SAAS,sBAAsB,CACvB,
|
|
1
|
+
{"version":3,"file":"cull-by-loose-bounding-box.js","sourceRoot":"","sources":["../../src/closest-boundary-point/cull-by-loose-bounding-box.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AACpG,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGnE;;;;;;;GAOG;AACH,SAAS,sBAAsB,CACvB,WAAyB,EACzB,CAAW,EACX,QAAgB;IAEpB,MAAM,oBAAoB,GAAG,EAAE,CAAC;IAEhC,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAE/B,MAAM,WAAW,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC;QAExC,MAAM,CAAC,GAAG,8BAA8B,CACpC,WAAW,EACX,CAAC,CACJ,CAAC;QACF,IAAI,CAAC,IAAI,QAAQ,EAAE,CAAC;YAChB,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC1C,CAAC;IACL,CAAC;IAED,OAAO,oBAAoB,CAAC;AAChC,CAAC;AAGD,OAAO,EAAE,sBAAsB,EAAE,CAAA"}
|
|
@@ -3,9 +3,9 @@ import { CurvePiece } from "../mat/curve-piece.js";
|
|
|
3
3
|
* @internal
|
|
4
4
|
* When checking distances, ignore all those with closest possible distance
|
|
5
5
|
* further than 'bestSquaredDistance', i.e. cull them.
|
|
6
|
-
* @param
|
|
6
|
+
* @param curvePieces
|
|
7
7
|
* @param p
|
|
8
8
|
* @param bestSquaredDistance
|
|
9
9
|
*/
|
|
10
|
-
declare function cullByTightBoundingBox(
|
|
10
|
+
declare function cullByTightBoundingBox(curvePieces: CurvePiece[], p: number[], bestSquaredDistance: number): CurvePiece[];
|
|
11
11
|
export { cullByTightBoundingBox };
|
|
@@ -6,22 +6,22 @@ const getBoundingBoxTight_ = memoize(getBoundingBoxTight);
|
|
|
6
6
|
* @internal
|
|
7
7
|
* When checking distances, ignore all those with closest possible distance
|
|
8
8
|
* further than 'bestSquaredDistance', i.e. cull them.
|
|
9
|
-
* @param
|
|
9
|
+
* @param curvePieces
|
|
10
10
|
* @param p
|
|
11
11
|
* @param bestSquaredDistance
|
|
12
12
|
*/
|
|
13
|
-
function cullByTightBoundingBox(
|
|
14
|
-
const
|
|
15
|
-
for (let i = 0; i <
|
|
16
|
-
const
|
|
17
|
-
const ps =
|
|
13
|
+
function cullByTightBoundingBox(curvePieces, p, bestSquaredDistance) {
|
|
14
|
+
const candidateCurvePieces = [];
|
|
15
|
+
for (let i = 0; i < curvePieces.length; i++) {
|
|
16
|
+
const curvePiece = curvePieces[i];
|
|
17
|
+
const ps = curvePiece.curve.ps;
|
|
18
18
|
const tightBoundingBox = getBoundingBoxTight_(ps);
|
|
19
19
|
const d = getClosestSquaredDistanceToRotatedRect(tightBoundingBox, p);
|
|
20
20
|
if (d <= bestSquaredDistance) {
|
|
21
|
-
|
|
21
|
+
candidateCurvePieces.push(curvePiece);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return candidateCurvePieces;
|
|
25
25
|
}
|
|
26
26
|
export { cullByTightBoundingBox };
|
|
27
27
|
//# sourceMappingURL=cull-by-tight-boundary-box.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cull-by-tight-boundary-box.js","sourceRoot":"","sources":["../../src/closest-boundary-point/cull-by-tight-boundary-box.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,sCAAsC,EAAE,MAAM,6DAA6D,CAAC;AAGrH,MAAM,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAG1D;;;;;;;GAOG;AACH,SAAS,sBAAsB,CACvB,
|
|
1
|
+
{"version":3,"file":"cull-by-tight-boundary-box.js","sourceRoot":"","sources":["../../src/closest-boundary-point/cull-by-tight-boundary-box.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,sCAAsC,EAAE,MAAM,6DAA6D,CAAC;AAGrH,MAAM,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAG1D;;;;;;;GAOG;AACH,SAAS,sBAAsB,CACvB,WAAyB,EACzB,CAAW,EACX,mBAA2B;IAE/B,MAAM,oBAAoB,GAAG,EAAE,CAAC;IAEhC,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAE/B,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,EAAE,CAAC,CAAC;QAClD,MAAM,CAAC,GAAG,sCAAsC,CACxC,gBAAgB,EAChB,CAAC,CACR,CAAC;QACF,IAAI,CAAC,IAAI,mBAAmB,EAAE,CAAC;YAC3B,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC1C,CAAC;IACL,CAAC;IAED,OAAO,oBAAoB,CAAC;AAChC,CAAC;AAGD,OAAO,EAAE,sBAAsB,EAAE,CAAA"}
|
|
@@ -4,5 +4,5 @@ import { CurvePiece } from "../mat/curve-piece.js";
|
|
|
4
4
|
* Finds an initial distance such that the closest point can not be further than
|
|
5
5
|
* this distance away.
|
|
6
6
|
*/
|
|
7
|
-
declare function getBestDistanceSquared(
|
|
7
|
+
declare function getBestDistanceSquared(curvePieces: CurvePiece[], p: number[]): number;
|
|
8
8
|
export { getBestDistanceSquared };
|
|
@@ -5,13 +5,13 @@ import { squaredDistanceBetween } from 'flo-vector2d';
|
|
|
5
5
|
* Finds an initial distance such that the closest point can not be further than
|
|
6
6
|
* this distance away.
|
|
7
7
|
*/
|
|
8
|
-
function getBestDistanceSquared(
|
|
8
|
+
function getBestDistanceSquared(curvePieces, p) {
|
|
9
9
|
let bestSquaredDistance = Number.POSITIVE_INFINITY;
|
|
10
|
-
for (let i = 0; i <
|
|
11
|
-
const
|
|
12
|
-
const ps =
|
|
13
|
-
const p1 = evalDeCasteljau(ps,
|
|
14
|
-
const p2 = evalDeCasteljau(ps,
|
|
10
|
+
for (let i = 0; i < curvePieces.length; i++) {
|
|
11
|
+
const curvePiece = curvePieces[i];
|
|
12
|
+
const ps = curvePiece.curve.ps;
|
|
13
|
+
const p1 = evalDeCasteljau(ps, curvePiece.ts[0]);
|
|
14
|
+
const p2 = evalDeCasteljau(ps, curvePiece.ts[1]);
|
|
15
15
|
const d = Math.min(squaredDistanceBetween(p, p1), squaredDistanceBetween(p, p2));
|
|
16
16
|
if (d < bestSquaredDistance) {
|
|
17
17
|
bestSquaredDistance = d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-best-distance-squared.js","sourceRoot":"","sources":["../../src/closest-boundary-point/get-best-distance-squared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAItD;;;;GAIG;AACH,SAAS,sBAAsB,CACvB,
|
|
1
|
+
{"version":3,"file":"get-best-distance-squared.js","sourceRoot":"","sources":["../../src/closest-boundary-point/get-best-distance-squared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAItD;;;;GAIG;AACH,SAAS,sBAAsB,CACvB,WAAyB,EACzB,CAAW;IAEf,IAAI,mBAAmB,GAAG,MAAM,CAAC,iBAAiB,CAAC;IACnD,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAElC,MAAM,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAE/B,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACjD,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAEjD,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CACd,sBAAsB,CAAC,CAAC,EAAE,EAAE,CAAC,EAC7B,sBAAsB,CAAC,CAAC,EAAE,EAAE,CAAC,CAChC,CAAC;QAEF,IAAI,CAAC,GAAG,mBAAmB,EAAE,CAAC;YAC1B,mBAAmB,GAAG,CAAC,CAAC;QAC5B,CAAC;IACL,CAAC;IAED,mEAAmE;IACnE,OAAO,CAAC,CAAC,GAAG,CAAC,IAAE,CAAC,EAAE,CAAC,GAAC,mBAAmB,CAAC;AAC5C,CAAC;AAGD,OAAO,EAAE,sBAAsB,EAAE,CAAA"}
|
|
@@ -7,12 +7,12 @@ import { PointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
|
7
7
|
* bezier pieces, including the beziers actually checked after culling.
|
|
8
8
|
*
|
|
9
9
|
* @param pow
|
|
10
|
-
* @param
|
|
10
|
+
* @param curvePieces
|
|
11
11
|
* @param x
|
|
12
12
|
* @param touchedCurve
|
|
13
13
|
* @param t
|
|
14
14
|
* @param for1Prong defaults to `false`;
|
|
15
15
|
* @param angle defaults to `0`
|
|
16
16
|
*/
|
|
17
|
-
declare function getCloseBoundaryPointsCertified(pow: number,
|
|
17
|
+
declare function getCloseBoundaryPointsCertified(pow: number, curvePieces: CurvePiece[], x: number[], touchedCurve?: Curve | undefined, t?: number | undefined, for1Prong?: boolean, angle?: number): PointOnShape[];
|
|
18
18
|
export { getCloseBoundaryPointsCertified };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getPotentialClosestPointsOnCurveCertified } from './get-potential-closest-points-on-curve-certified.js';
|
|
2
|
-
import {
|
|
2
|
+
import { cullCurvePieces1 } from './cull-bezier-pieces.js';
|
|
3
3
|
import { createPos } from '../point-on-shape/create-pos.js';
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
@@ -7,19 +7,19 @@ import { createPos } from '../point-on-shape/create-pos.js';
|
|
|
7
7
|
* bezier pieces, including the beziers actually checked after culling.
|
|
8
8
|
*
|
|
9
9
|
* @param pow
|
|
10
|
-
* @param
|
|
10
|
+
* @param curvePieces
|
|
11
11
|
* @param x
|
|
12
12
|
* @param touchedCurve
|
|
13
13
|
* @param t
|
|
14
14
|
* @param for1Prong defaults to `false`;
|
|
15
15
|
* @param angle defaults to `0`
|
|
16
16
|
*/
|
|
17
|
-
function getCloseBoundaryPointsCertified(pow,
|
|
18
|
-
|
|
17
|
+
function getCloseBoundaryPointsCertified(pow, curvePieces, x, touchedCurve = undefined, t = undefined, for1Prong = false, angle = 0) {
|
|
18
|
+
curvePieces = cullCurvePieces1(curvePieces, x);
|
|
19
19
|
const pInfoss = [];
|
|
20
|
-
for (let i = 0; i <
|
|
21
|
-
const
|
|
22
|
-
const pInfos = getPotentialClosestPointsOnCurveCertified(pow,
|
|
20
|
+
for (let i = 0; i < curvePieces.length; i++) {
|
|
21
|
+
const curvePiece = curvePieces[i];
|
|
22
|
+
const pInfos = getPotentialClosestPointsOnCurveCertified(pow, curvePiece.curve, x, curvePiece.ts, touchedCurve, t, for1Prong, angle);
|
|
23
23
|
pInfoss.push(...pInfos);
|
|
24
24
|
}
|
|
25
25
|
/** the minimum max interval value */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-close-boundary-points-certified.js","sourceRoot":"","sources":["../../src/closest-boundary-point/get-close-boundary-points-certified.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yCAAyC,EAAE,MAAM,sDAAsD,CAAC;AACjH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"get-close-boundary-points-certified.js","sourceRoot":"","sources":["../../src/closest-boundary-point/get-close-boundary-points-certified.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yCAAyC,EAAE,MAAM,sDAAsD,CAAC;AACjH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAI3D,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG5D;;;;;;;;;;;;GAYG;AACH,SAAS,+BAA+B,CACtC,GAAW,EACL,WAAyB,EACzB,CAAW,EACjB,eAAkC,SAAS,EAC3C,IAAwB,SAAS,EACjC,SAAS,GAAG,KAAK,EACjB,KAAK,GAAG,CAAC;IAEV,WAAW,GAAG,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAE/C,MAAM,OAAO,GAA0B,EAAE,CAAC;IAC1C,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAElC,MAAM,MAAM,GAAG,yCAAyC,CACvD,GAAG,EACH,UAAU,CAAC,KAAK,EAChB,CAAC,EACD,UAAU,CAAC,EAAE,EACb,YAAY,EACZ,CAAC,EACD,SAAS,EACT,KAAK,CACL,CAAC;QAEF,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;IACzB,CAAC;IAED,qCAAqC;IACrC,IAAI,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC;IACtC,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACtC,IAAI,KAAK,GAAG,MAAM,EAAE,CAAC;YACpB,MAAM,GAAG,KAAK,CAAC;QAChB,CAAC;IACF,CAAC;IAED,MAAM,iBAAiB,GAA0B,EAAE,CAAC;IAEpD,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC;YACjC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC;IACF,CAAC;IAED,OAAO,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAC5E,CAAC;AAGD,OAAO,EAAE,+BAA+B,EAAE,CAAC"}
|
|
@@ -9,5 +9,5 @@ import type { CpNode } from '../cp-node.js';
|
|
|
9
9
|
*
|
|
10
10
|
* @param cpNode
|
|
11
11
|
*/
|
|
12
|
-
declare function getBoundaryBezierPartsToNext(cpNode: CpNode): BezierPiece[]
|
|
12
|
+
declare function getBoundaryBezierPartsToNext(cpNode: CpNode): BezierPiece[];
|
|
13
13
|
export { getBoundaryBezierPartsToNext };
|
|
@@ -17,36 +17,31 @@ function getBoundaryBezierPartsToNext(cpNode) {
|
|
|
17
17
|
if (curveThis.loop !== curveNext.loop) {
|
|
18
18
|
// It is a hole-closer going over to the other loop - a kind of terminal
|
|
19
19
|
// CpNode.
|
|
20
|
-
return undefined;
|
|
20
|
+
// return undefined;
|
|
21
|
+
return [];
|
|
21
22
|
}
|
|
22
23
|
const bezierPieces = [];
|
|
23
24
|
if (curveNext === curveThis) {
|
|
24
|
-
bezierPieces.push({
|
|
25
|
-
ps: posThis.curve.ps,
|
|
26
|
-
ts: [posThis.t, posNext.t]
|
|
27
|
-
});
|
|
25
|
+
bezierPieces.push({ ps: posThis.curve.ps, ts: [posThis.t, posNext.t] });
|
|
28
26
|
}
|
|
29
27
|
else {
|
|
30
|
-
bezierPieces.push({
|
|
31
|
-
|
|
32
|
-
ts: [posThis.t, 1]
|
|
33
|
-
});
|
|
34
|
-
addSkippedBeziers(bezierPieces, posThis.curve, posNext.curve, posNext.t);
|
|
28
|
+
bezierPieces.push({ ps: posThis.curve.ps, ts: [posThis.t, 1] });
|
|
29
|
+
addSkippedBezierPiecess(bezierPieces, posThis.curve, posNext.curve, posNext.t);
|
|
35
30
|
}
|
|
36
31
|
return bezierPieces;
|
|
37
32
|
}
|
|
38
33
|
/**
|
|
39
|
-
* @internal
|
|
40
34
|
* Adds pieces of skipped beziers.
|
|
35
|
+
* @internal
|
|
41
36
|
*/
|
|
42
|
-
function
|
|
37
|
+
function addSkippedBezierPiecess(bezierPieces, curveStart, curveEnd, t1) {
|
|
43
38
|
let curveThis = curveStart;
|
|
44
39
|
do {
|
|
45
40
|
curveThis = curveThis.next;
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
const tEnd = curveThis === curveEnd ? t1 : 1;
|
|
42
|
+
bezierPieces.push({
|
|
43
|
+
ps: curveThis.ps, ts: [0, tEnd]
|
|
44
|
+
});
|
|
50
45
|
} while (curveThis !== curveEnd);
|
|
51
46
|
}
|
|
52
47
|
export { getBoundaryBezierPartsToNext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-boundary-bezier-parts-to-next.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-boundary-bezier-parts-to-next.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,SAAS,4BAA4B,CAC7B,MAAc;IAElB,MAAM,MAAM,GAAG,MAAM,CAAC;IACtB,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC;IAE3B,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC;IACvC,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC;IAEvC,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC;IAChC,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC;IAEhC,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,EAAE,CAAC;QACpC,wEAAwE;QACxE,UAAU;QACV,OAAO,
|
|
1
|
+
{"version":3,"file":"get-boundary-bezier-parts-to-next.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-boundary-bezier-parts-to-next.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,SAAS,4BAA4B,CAC7B,MAAc;IAElB,MAAM,MAAM,GAAG,MAAM,CAAC;IACtB,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC;IAE3B,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC;IACvC,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC;IAEvC,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC;IAChC,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC;IAEhC,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,EAAE,CAAC;QACpC,wEAAwE;QACxE,UAAU;QACV,oBAAoB;QACpB,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,YAAY,GAAkB,EAAE,CAAC;IAEvC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC1B,YAAY,CAAC,IAAI,CACb,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CACvD,CAAC;IACN,CAAC;SAAM,CAAC;QACJ,YAAY,CAAC,IAAI,CACb,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAC/C,CAAC;QAEF,uBAAuB,CACnB,YAAY,EACZ,OAAO,CAAC,KAAK,EACb,OAAO,CAAC,KAAK,EACb,OAAO,CAAC,CAAC,CACZ,CAAC;IACN,CAAC;IAED,OAAO,YAAY,CAAC;AACxB,CAAC;AAGD;;;GAGG;AACH,SAAS,uBAAuB,CACxB,YAA2B,EAC3B,UAAiB,EACjB,QAAe,EACf,EAAU;IAEd,IAAI,SAAS,GAAG,UAAU,CAAC;IAC3B,GAAG,CAAC;QACA,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC;QAC3B,MAAM,IAAI,GAAG,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7C,YAAY,CAAC,IAAI,CAAC;YACd,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC;SAClC,CAAC,CAAC;IACP,CAAC,QAAQ,SAAS,KAAK,QAAQ,EAAE;AACrC,CAAC;AAGD,OAAO,EAAE,4BAA4B,EAAE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cpNodesToBoundaryBeziers } from "./cp-nodes-to-boundary-beziers.js";
|
|
2
1
|
import { getAllBetween } from "./get-all-between.js";
|
|
2
|
+
import { getBoundaryBeziersToNext } from "./get-boundary-beziers-to-next.js";
|
|
3
3
|
/**
|
|
4
4
|
* Returns all `CpNode`s between the two given ones (inclusive).
|
|
5
5
|
*
|
|
@@ -12,11 +12,9 @@ import { getAllBetween } from "./get-all-between.js";
|
|
|
12
12
|
* include all `CpNode`s around the loop, otherwise include none.
|
|
13
13
|
*/
|
|
14
14
|
function getBoundaryBeziersBetween(cpNode1, cpNode2, inclAllIfEqual = true) {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
hasHoleCloser: allBetween.hasHoleCloser
|
|
19
|
-
};
|
|
15
|
+
const { cpNodes, hasHoleCloser } = getAllBetween(cpNode1, cpNode2, inclAllIfEqual);
|
|
16
|
+
const pss = cpNodes.flatMap(getBoundaryBeziersToNext);
|
|
17
|
+
return { pss, hasHoleCloser };
|
|
20
18
|
}
|
|
21
19
|
export { getBoundaryBeziersBetween };
|
|
22
20
|
//# sourceMappingURL=get-boundary-beziers-between.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-boundary-beziers-between.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-boundary-beziers-between.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-boundary-beziers-between.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-boundary-beziers-between.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAG7E;;;;;;;;;;GAUG;AACH,SAAS,yBAAyB,CAC1B,OAAe,EACf,OAAe,EACf,cAAc,GAAG,IAAI;IAKzB,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAC5B,aAAa,CAAC,OAAO,EAAC,OAAO,EAAC,cAAc,CAAC,CAAC;IAElD,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAEtD,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,CAAA;AACjC,CAAC;AAGD,OAAO,EAAE,yBAAyB,EAAE,CAAA"}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
import { CpNode } from '../cp-node.js';
|
|
1
|
+
import type { CpNode } from '../cp-node.js';
|
|
2
|
+
/**
|
|
3
|
+
// * Returns the boundary beziers between this `CpNode` and the next
|
|
4
|
+
// * one.
|
|
5
|
+
// *
|
|
6
|
+
// * * returns `[]` if the next `CpNode` is on a different loop,
|
|
7
|
+
// * as this is a hole-closer and there are no boundary beziers between them.
|
|
8
|
+
// *
|
|
9
|
+
// * @param cpNode
|
|
10
|
+
// */
|
|
2
11
|
declare function getBoundaryBeziersToNext(cpNode: CpNode): number[][][];
|
|
3
12
|
export { getBoundaryBeziersToNext };
|
|
@@ -1,40 +1,75 @@
|
|
|
1
1
|
import { fromTo } from 'flo-bezier3';
|
|
2
|
-
|
|
3
|
-
const cpThis = cpNode;
|
|
4
|
-
const cpNext = cpNode.next;
|
|
5
|
-
const posThis = cpThis.cp.pointOnShape;
|
|
6
|
-
const posNext = cpNext.cp.pointOnShape;
|
|
7
|
-
const curveThis = posThis.curve;
|
|
8
|
-
const curveNext = posNext.curve;
|
|
9
|
-
if (curveThis.loop !== curveNext.loop) {
|
|
10
|
-
// It is a hole-closer going over to the other loop - a kind of terminal
|
|
11
|
-
// CpNode.
|
|
12
|
-
// return undefined!;
|
|
13
|
-
return [];
|
|
14
|
-
}
|
|
15
|
-
const beziers = [];
|
|
16
|
-
if (curveNext === curveThis) {
|
|
17
|
-
beziers.push(fromTo(posThis.curve.ps, posThis.t, posNext.t));
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
beziers.push(fromTo(posThis.curve.ps, posThis.t, 1));
|
|
21
|
-
addSkippedBeziers(beziers, posThis.curve, posNext.curve, posNext.t);
|
|
22
|
-
}
|
|
23
|
-
return beziers;
|
|
24
|
-
}
|
|
2
|
+
import { getBoundaryBezierPartsToNext } from './get-boundary-bezier-parts-to-next.js';
|
|
25
3
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
fromTo(curveThis.ps, 0, tEnd));
|
|
37
|
-
} while (curveThis !== curveEnd);
|
|
4
|
+
// * Returns the boundary beziers between this `CpNode` and the next
|
|
5
|
+
// * one.
|
|
6
|
+
// *
|
|
7
|
+
// * * returns `[]` if the next `CpNode` is on a different loop,
|
|
8
|
+
// * as this is a hole-closer and there are no boundary beziers between them.
|
|
9
|
+
// *
|
|
10
|
+
// * @param cpNode
|
|
11
|
+
// */
|
|
12
|
+
function getBoundaryBeziersToNext(cpNode) {
|
|
13
|
+
return getBoundaryBezierPartsToNext(cpNode).map(bp => fromTo(bp.ps, bp.ts[0], bp.ts[1]));
|
|
38
14
|
}
|
|
15
|
+
// /**
|
|
16
|
+
// * Returns the boundary beziers between this `CpNode` and the next
|
|
17
|
+
// * one.
|
|
18
|
+
// *
|
|
19
|
+
// * * returns `[]` if the next `CpNode` is on a different loop,
|
|
20
|
+
// * as this is a hole-closer and there are no boundary beziers between them.
|
|
21
|
+
// *
|
|
22
|
+
// * @param cpNode
|
|
23
|
+
// */
|
|
24
|
+
// function getBoundaryBeziersToNext(
|
|
25
|
+
// cpNode: CpNode): number[][][] {
|
|
26
|
+
// const cpThis = cpNode;
|
|
27
|
+
// const cpNext = cpNode.next;
|
|
28
|
+
// const posThis = cpThis.cp.pointOnShape;
|
|
29
|
+
// const posNext = cpNext.cp.pointOnShape;
|
|
30
|
+
// const curveThis = posThis.curve;
|
|
31
|
+
// const curveNext = posNext.curve;
|
|
32
|
+
// if (curveThis.loop !== curveNext.loop) {
|
|
33
|
+
// // It is a hole-closer going over to the other loop - a kind of terminal
|
|
34
|
+
// // CpNode.
|
|
35
|
+
// // return undefined!;
|
|
36
|
+
// return [];
|
|
37
|
+
// }
|
|
38
|
+
// const beziers: number[][][] = [];
|
|
39
|
+
// if (curveNext === curveThis) {
|
|
40
|
+
// beziers.push(
|
|
41
|
+
// fromTo(posThis.curve.ps, posThis.t, posNext.t)
|
|
42
|
+
// );
|
|
43
|
+
// } else {
|
|
44
|
+
// beziers.push(
|
|
45
|
+
// fromTo(posThis.curve.ps, posThis.t, 1)
|
|
46
|
+
// );
|
|
47
|
+
// addSkippedBeziers(
|
|
48
|
+
// beziers,
|
|
49
|
+
// posThis.curve,
|
|
50
|
+
// posNext.curve,
|
|
51
|
+
// posNext.t
|
|
52
|
+
// );
|
|
53
|
+
// }
|
|
54
|
+
// return beziers;
|
|
55
|
+
// }
|
|
56
|
+
// /**
|
|
57
|
+
// * Adds pieces of skipped beziers.
|
|
58
|
+
// * @internal
|
|
59
|
+
// */
|
|
60
|
+
// function addSkippedBeziers(
|
|
61
|
+
// beziers: number[][][],
|
|
62
|
+
// curveStart: Curve,
|
|
63
|
+
// curveEnd: Curve,
|
|
64
|
+
// t1: number) {
|
|
65
|
+
// let curveThis = curveStart;
|
|
66
|
+
// do {
|
|
67
|
+
// curveThis = curveThis.next;
|
|
68
|
+
// const tEnd = curveThis === curveEnd ? t1 : 1;
|
|
69
|
+
// beziers.push(
|
|
70
|
+
// fromTo(curveThis.ps, 0, tEnd)
|
|
71
|
+
// );
|
|
72
|
+
// } while (curveThis !== curveEnd);
|
|
73
|
+
// }
|
|
39
74
|
export { getBoundaryBeziersToNext };
|
|
40
75
|
//# sourceMappingURL=get-boundary-beziers-to-next.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-boundary-beziers-to-next.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-boundary-beziers-to-next.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-boundary-beziers-to-next.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-boundary-beziers-to-next.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AAGtF;;;;;;;;MAQM;AACN,SAAS,wBAAwB,CACzB,MAAc;IAElB,OAAO,4BAA4B,CAAC,MAAM,CAAC,CAAC,GAAG,CAC3C,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAC1C,CAAC;AACN,CAAC;AAGD,MAAM;AACN,qEAAqE;AACrE,UAAU;AACV,MAAM;AACN,iEAAiE;AACjE,8EAA8E;AAC9E,MAAM;AACN,oBAAoB;AACpB,MAAM;AACN,qCAAqC;AACrC,0CAA0C;AAE1C,8BAA8B;AAC9B,kCAAkC;AAElC,8CAA8C;AAC9C,8CAA8C;AAE9C,uCAAuC;AACvC,uCAAuC;AAEvC,+CAA+C;AAC/C,mFAAmF;AACnF,qBAAqB;AACrB,gCAAgC;AAChC,qBAAqB;AACrB,QAAQ;AAER,wCAAwC;AAExC,qCAAqC;AACrC,wBAAwB;AACxB,6DAA6D;AAC7D,aAAa;AACb,eAAe;AACf,wBAAwB;AACxB,qDAAqD;AACrD,aAAa;AAEb,6BAA6B;AAC7B,uBAAuB;AACvB,6BAA6B;AAC7B,6BAA6B;AAC7B,wBAAwB;AACxB,aAAa;AACb,QAAQ;AAER,sBAAsB;AACtB,IAAI;AAGJ,MAAM;AACN,qCAAqC;AACrC,eAAe;AACf,MAAM;AACN,8BAA8B;AAC9B,iCAAiC;AACjC,6BAA6B;AAC7B,2BAA2B;AAC3B,wBAAwB;AAExB,kCAAkC;AAClC,WAAW;AACX,sCAAsC;AACtC,wDAAwD;AACxD,yBAAyB;AACzB,4CAA4C;AAC5C,aAAa;AACb,wCAAwC;AACxC,IAAI;AAGJ,OAAO,EAAE,wBAAwB,EAAE,CAAA"}
|
|
@@ -12,8 +12,8 @@ function getSalience(cpNode) {
|
|
|
12
12
|
const bp1 = cpNode1.cp.pointOnShape.p;
|
|
13
13
|
const bp2 = cpNode2.cp.pointOnShape.p;
|
|
14
14
|
const d = distanceBetween(bp1, bp2);
|
|
15
|
-
const { pss
|
|
16
|
-
const s = sum(
|
|
15
|
+
const { pss, hasHoleCloser } = getBoundaryBeziersBetween(cpNode1, cpNode2);
|
|
16
|
+
const s = sum(pss.map(ps => totalLength(ps)));
|
|
17
17
|
return hasHoleCloser ? Number.POSITIVE_INFINITY : s / d;
|
|
18
18
|
}
|
|
19
19
|
export { getSalience };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-salience.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-salience.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAGzC;;;GAGG;AACH,SAAS,WAAW,CAAC,MAAc;IAC/B,MAAM,OAAO,GAAG,MAAM,CAAC;IACvB,MAAM,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC;IACpC,MAAM,GAAG,GAAG,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IACtC,MAAM,GAAG,GAAG,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEtC,MAAM,CAAC,GAAG,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAEpC,MAAM,EAAE,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"get-salience.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-salience.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAGzC;;;GAGG;AACH,SAAS,WAAW,CAAC,MAAc;IAC/B,MAAM,OAAO,GAAG,MAAM,CAAC;IACvB,MAAM,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC;IACpC,MAAM,GAAG,GAAG,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IACtC,MAAM,GAAG,GAAG,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEtC,MAAM,CAAC,GAAG,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAEpC,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,yBAAyB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAE3E,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAE9C,OAAO,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAC,CAAC,CAAC;AAC1D,CAAC;AAGD,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -2,7 +2,6 @@ import { totalAbsoluteCurvature, totalLength } from "flo-bezier3";
|
|
|
2
2
|
import { memoize } from "flo-memoize";
|
|
3
3
|
import { getMatCurveToNext } from "./get-mat-curve-to-next.js";
|
|
4
4
|
import { getRealProngCount } from "./get-real-prong-count.js";
|
|
5
|
-
const { min, abs } = Math;
|
|
6
5
|
const getSpeed$ = memoize(getSpeed);
|
|
7
6
|
function getSpeed(cpNode) {
|
|
8
7
|
if (getRealProngCount(cpNode) !== 2) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-speed.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-speed.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"get-speed.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-speed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAGpC,SAAS,QAAQ,CAAC,MAAc;IAC5B,IAAI,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAClC,OAAO,CAAC,CAAC;IACb,CAAC;IAED,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC;IACvC,MAAM,KAAK,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,sBAAsB,CAAC,KAAK,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC;IAClD,MAAM,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACV,OAAO,SAAS,CAAC,CAAE,QAAQ;IAC/B,CAAC;IACD,uBAAuB;IACvB,MAAM,IAAI,GAAG,IAAI,CAAC;IAElB,OAAO,IAAI,GAAC,CAAC,CAAC;AAClB,CAAC;AAKD,wBAAwB;AACpB,0BAA0B;AAC1B,4CAA4C;AAC5C,4CAA4C;AAC5C,yDAAyD;AACzD,yDAAyD;AAEzD,0DAA0D;AAC1D,0DAA0D;AAE1D,gCAAgC;AAChC,kCAAkC;AAElC,yBAAyB;AACzB,yBAAyB;AAEzB,4CAA4C;AAC5C,4CAA4C;AAG5C,qCAAqC;AAErC,gBAAgB;AACpB,IAAI;AAEJ,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { CurvePiece } from '../mat/curve-piece.js';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
|
-
* Cull all
|
|
4
|
+
* Cull all curvePieces not within given radius of a given point.
|
|
5
5
|
* @param extreme
|
|
6
|
-
* @param
|
|
6
|
+
* @param curvePieces
|
|
7
7
|
* @param p
|
|
8
8
|
* @param rSquared
|
|
9
9
|
*/
|
|
10
|
-
declare function
|
|
11
|
-
export {
|
|
10
|
+
declare function cullCurvePieces2(curvePieces: CurvePiece[], p: number[], rSquared: number): CurvePiece[];
|
|
11
|
+
export { cullCurvePieces2 };
|
|
@@ -2,27 +2,27 @@ import { getClosestSquareDistanceToRect } from '../geometry/get-closest-square-d
|
|
|
2
2
|
import { getBoundingBox$ } from '../geometry/get-bounding-box-.js';
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
|
-
* Cull all
|
|
5
|
+
* Cull all curvePieces not within given radius of a given point.
|
|
6
6
|
* @param extreme
|
|
7
|
-
* @param
|
|
7
|
+
* @param curvePieces
|
|
8
8
|
* @param p
|
|
9
9
|
* @param rSquared
|
|
10
10
|
*/
|
|
11
|
-
function
|
|
11
|
+
function cullCurvePieces2(curvePieces, p, rSquared) {
|
|
12
12
|
const TOLERANCE = 1 + 2 ** -10;
|
|
13
|
-
if (
|
|
14
|
-
return
|
|
13
|
+
if (curvePieces.length <= 1) {
|
|
14
|
+
return curvePieces;
|
|
15
15
|
}
|
|
16
16
|
const newPieces = [];
|
|
17
|
-
for (const
|
|
18
|
-
const ps =
|
|
17
|
+
for (const curvePiece of curvePieces) {
|
|
18
|
+
const ps = curvePiece.curve.ps;
|
|
19
19
|
const rect = getBoundingBox$(ps);
|
|
20
20
|
const bd = getClosestSquareDistanceToRect(rect, p);
|
|
21
21
|
if (bd <= TOLERANCE * rSquared) {
|
|
22
|
-
newPieces.push(
|
|
22
|
+
newPieces.push(curvePiece);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
return newPieces;
|
|
26
26
|
}
|
|
27
|
-
export {
|
|
27
|
+
export { cullCurvePieces2 };
|
|
28
28
|
//# sourceMappingURL=cull-bezier-pieces.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cull-bezier-pieces.js","sourceRoot":"","sources":["../../src/find-2-prong/cull-bezier-pieces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AAEpG,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGnE;;;;;;;GAOG;AACH,SAAS,
|
|
1
|
+
{"version":3,"file":"cull-bezier-pieces.js","sourceRoot":"","sources":["../../src/find-2-prong/cull-bezier-pieces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AAEpG,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGnE;;;;;;;GAOG;AACH,SAAS,gBAAgB,CACjB,WAAyB,EACzB,CAAW,EACX,QAAgB;IAEpB,MAAM,SAAS,GAAG,CAAC,GAAG,CAAC,IAAE,CAAC,EAAE,CAAC;IAE7B,IAAI,WAAW,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QAC1B,OAAO,WAAW,CAAC;IACvB,CAAC;IAGD,MAAM,SAAS,GAAG,EAAE,CAAC;IACrB,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACnC,MAAM,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAE/B,MAAM,IAAI,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC;QACjC,MAAM,EAAE,GAAG,8BAA8B,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACnD,IAAI,EAAE,IAAI,SAAS,GAAC,QAAQ,EAAE,CAAC;YAC3B,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC/B,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|