@flighthq/path-boolean 0.5.1-next.3269.831c174 → 0.5.1-next.3302.76ece6b
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/README.md +2 -2
- package/dist/booleanPaths.d.ts +5 -5
- package/dist/booleanPaths.d.ts.map +1 -1
- package/dist/booleanPaths.js +10 -10
- package/dist/booleanPaths.js.map +1 -1
- package/dist/explainPathBoolean.js +7 -7
- package/dist/explainPathBoolean.js.map +1 -1
- package/dist/offsetPath.d.ts +1 -1
- package/dist/offsetPath.d.ts.map +1 -1
- package/dist/offsetPath.js +3 -3
- package/dist/offsetPath.js.map +1 -1
- package/dist/resolvePathRegions.d.ts +1 -1
- package/dist/resolvePathRegions.d.ts.map +1 -1
- package/dist/resolvePathRegions.js +6 -4
- package/dist/resolvePathRegions.js.map +1 -1
- package/dist/simplifyPath.d.ts +1 -1
- package/dist/simplifyPath.d.ts.map +1 -1
- package/dist/simplifyPath.js +2 -2
- package/dist/simplifyPath.js.map +1 -1
- package/dist/unionAllPaths.d.ts +1 -1
- package/dist/unionAllPaths.d.ts.map +1 -1
- package/dist/unionAllPaths.js +2 -2
- package/dist/unionAllPaths.js.map +1 -1
- package/dist/writePathBooleanContours.d.ts +1 -1
- package/dist/writePathBooleanContours.d.ts.map +1 -1
- package/dist/writePathBooleanContours.js +8 -10
- package/dist/writePathBooleanContours.js.map +1 -1
- package/package.json +4 -4
- package/src/booleanPaths.test.ts +49 -37
- package/src/fuzzInvariants.test.ts +32 -16
- package/src/offsetPath.test.ts +32 -28
- package/src/resolvePathRegions.test.ts +7 -4
- package/src/simplifyPath.test.ts +17 -10
- package/src/unionAllPaths.test.ts +15 -10
- package/src/writePathBooleanContours.test.ts +1 -1
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/path-boolean`. The `
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/path-boolean@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/path-boolean@0.5.1-next.3302.76ece6b](https://github.com/flighthq/flight/tree/76ece6bee38e3d07816f341b7f017bfcec3e8e29/packages/path-boolean)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/76ece6bee38e3d07816f341b7f017bfcec3e8e29/LICENSE.md)
|
package/dist/booleanPaths.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PathBooleanKernel, Path, PathBooleanOperation, PathBooleanOptions } from '@flighthq/types/contract';
|
|
2
|
-
export declare function booleanPaths(pathBooleanKernel: Readonly<PathBooleanKernel>, subject: Readonly<Path>, clip: Readonly<Path>, operation: PathBooleanOperation,
|
|
3
|
-
export declare function differencePaths(pathBooleanKernel: Readonly<PathBooleanKernel>, a: Readonly<Path>, b: Readonly<Path>,
|
|
4
|
-
export declare function intersectPaths(pathBooleanKernel: Readonly<PathBooleanKernel>, a: Readonly<Path>, b: Readonly<Path>,
|
|
5
|
-
export declare function unionPaths(pathBooleanKernel: Readonly<PathBooleanKernel>, a: Readonly<Path>, b: Readonly<Path>,
|
|
6
|
-
export declare function xorPaths(pathBooleanKernel: Readonly<PathBooleanKernel>, a: Readonly<Path>, b: Readonly<Path>,
|
|
2
|
+
export declare function booleanPaths(out: Path, pathBooleanKernel: Readonly<PathBooleanKernel>, subject: Readonly<Path>, clip: Readonly<Path>, operation: PathBooleanOperation, options?: Readonly<PathBooleanOptions>): void;
|
|
3
|
+
export declare function differencePaths(out: Path, pathBooleanKernel: Readonly<PathBooleanKernel>, a: Readonly<Path>, b: Readonly<Path>, options?: Readonly<PathBooleanOptions>): void;
|
|
4
|
+
export declare function intersectPaths(out: Path, pathBooleanKernel: Readonly<PathBooleanKernel>, a: Readonly<Path>, b: Readonly<Path>, options?: Readonly<PathBooleanOptions>): void;
|
|
5
|
+
export declare function unionPaths(out: Path, pathBooleanKernel: Readonly<PathBooleanKernel>, a: Readonly<Path>, b: Readonly<Path>, options?: Readonly<PathBooleanOptions>): void;
|
|
6
|
+
export declare function xorPaths(out: Path, pathBooleanKernel: Readonly<PathBooleanKernel>, a: Readonly<Path>, b: Readonly<Path>, options?: Readonly<PathBooleanOptions>): void;
|
|
7
7
|
//# sourceMappingURL=booleanPaths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"booleanPaths.d.ts","sourceRoot":"","sources":["../src/booleanPaths.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAIlH,wBAAgB,YAAY,CAC1B,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAC9C,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,EACvB,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,EACpB,SAAS,EAAE,oBAAoB,EAC/B,
|
|
1
|
+
{"version":3,"file":"booleanPaths.d.ts","sourceRoot":"","sources":["../src/booleanPaths.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAIlH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,IAAI,EACT,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAC9C,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,EACvB,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,EACpB,SAAS,EAAE,oBAAoB,EAC/B,OAAO,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GACrC,IAAI,CAMN;AAED,wBAAgB,eAAe,CAC7B,GAAG,EAAE,IAAI,EACT,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAC9C,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,EACjB,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,EACjB,OAAO,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GACrC,IAAI,CAEN;AAED,wBAAgB,cAAc,CAC5B,GAAG,EAAE,IAAI,EACT,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAC9C,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,EACjB,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,EACjB,OAAO,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GACrC,IAAI,CAEN;AAED,wBAAgB,UAAU,CACxB,GAAG,EAAE,IAAI,EACT,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAC9C,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,EACjB,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,EACjB,OAAO,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GACrC,IAAI,CAEN;AAED,wBAAgB,QAAQ,CACtB,GAAG,EAAE,IAAI,EACT,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAC9C,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,EACjB,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,EACjB,OAAO,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GACrC,IAAI,CAEN"}
|
package/dist/booleanPaths.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { flattenPath } from '@flighthq/path/contract';
|
|
2
2
|
import { writePathBooleanContours } from "./writePathBooleanContours.js";
|
|
3
|
-
export function booleanPaths(pathBooleanKernel, subject, clip, operation,
|
|
3
|
+
export function booleanPaths(out, pathBooleanKernel, subject, clip, operation, options) {
|
|
4
4
|
const fillRule = options?.fillRule ?? 'nonZero';
|
|
5
5
|
const subjectContours = flattenPath(subject, options?.tolerance);
|
|
6
6
|
const clipContours = flattenPath(clip, options?.tolerance);
|
|
7
7
|
const result = pathBooleanKernel.computePathBoolean(subjectContours, clipContours, operation, fillRule);
|
|
8
|
-
|
|
8
|
+
writePathBooleanContours(out, result);
|
|
9
9
|
}
|
|
10
|
-
export function differencePaths(pathBooleanKernel, a, b,
|
|
11
|
-
|
|
10
|
+
export function differencePaths(out, pathBooleanKernel, a, b, options) {
|
|
11
|
+
booleanPaths(out, pathBooleanKernel, a, b, 'difference', options);
|
|
12
12
|
}
|
|
13
|
-
export function intersectPaths(pathBooleanKernel, a, b,
|
|
14
|
-
|
|
13
|
+
export function intersectPaths(out, pathBooleanKernel, a, b, options) {
|
|
14
|
+
booleanPaths(out, pathBooleanKernel, a, b, 'intersection', options);
|
|
15
15
|
}
|
|
16
|
-
export function unionPaths(pathBooleanKernel, a, b,
|
|
17
|
-
|
|
16
|
+
export function unionPaths(out, pathBooleanKernel, a, b, options) {
|
|
17
|
+
booleanPaths(out, pathBooleanKernel, a, b, 'union', options);
|
|
18
18
|
}
|
|
19
|
-
export function xorPaths(pathBooleanKernel, a, b,
|
|
20
|
-
|
|
19
|
+
export function xorPaths(out, pathBooleanKernel, a, b, options) {
|
|
20
|
+
booleanPaths(out, pathBooleanKernel, a, b, 'xor', options);
|
|
21
21
|
}
|
|
22
22
|
//# sourceMappingURL=booleanPaths.js.map
|
package/dist/booleanPaths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"booleanPaths.js","sourceRoot":"","sources":["../src/booleanPaths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,MAAM,UAAU,YAAY,CAC1B,iBAA8C,EAC9C,OAAuB,EACvB,IAAoB,EACpB,SAA+B,EAC/B,
|
|
1
|
+
{"version":3,"file":"booleanPaths.js","sourceRoot":"","s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AC/D,CAAC;AAED,MAAM,UAAU,QAAQ,CACtB,GAAS,EACT,iBAA8C,EAC9C,CAAiB,EACjB,CAAiB,EACjB,OAAsC;IAEtC,YAAY,CAAC,GAAG,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { flattenPath } from '@flighthq/path/contract';
|
|
1
|
+
import { createPath, flattenPath } from '@flighthq/path/contract';
|
|
2
2
|
import { offsetPath } from "./offsetPath.js";
|
|
3
3
|
import { simplifyPath } from "./simplifyPath.js";
|
|
4
4
|
export function explainOffsetPath(pathBooleanKernel, path, delta, options) {
|
|
@@ -6,15 +6,15 @@ export function explainOffsetPath(pathBooleanKernel, path, delta, options) {
|
|
|
6
6
|
return { operation: 'offset', reason: 'non-finite-delta' };
|
|
7
7
|
if (flattenPath(path, options?.tolerance).length === 0)
|
|
8
8
|
return { operation: 'offset', reason: 'empty-input' };
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const out = createPath('nonZero');
|
|
10
|
+
offsetPath(out, pathBooleanKernel, path, delta, options);
|
|
11
|
+
return out.commands.length === 0 ? { operation: 'offset', reason: 'collapsed-or-degenerate' } : null;
|
|
12
12
|
}
|
|
13
13
|
export function explainSimplifyPath(pathBooleanKernel, path, options) {
|
|
14
14
|
if (flattenPath(path, options?.tolerance).length === 0)
|
|
15
15
|
return { operation: 'simplify', reason: 'empty-input' };
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const out = createPath('nonZero');
|
|
17
|
+
simplifyPath(out, pathBooleanKernel, path, options);
|
|
18
|
+
return out.commands.length === 0 ? { operation: 'simplify', reason: 'collapsed-or-degenerate' } : null;
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=explainPathBoolean.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explainPathBoolean.js","sourceRoot":"","sources":["../src/explainPathBoolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"explainPathBoolean.js","sourceRoot":"","sources":["../src/explainPathBoolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AASlE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,UAAU,iBAAiB,CAC/B,iBAA8C,EAC9C,IAAoB,EACpB,KAAa,EACb,OAAqC;IAErC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC;IACxF,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;IAC9G,MAAM,GAAG,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IAClC,UAAU,CAAC,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACzD,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACvG,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,iBAA8C,EAC9C,IAAoB,EACpB,OAAsC;IAEtC,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;IAChH,MAAM,GAAG,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IAClC,YAAY,CAAC,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACpD,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACzG,CAAC"}
|
package/dist/offsetPath.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PathBooleanKernel, Path, PathOffsetOptions } from '@flighthq/types/contract';
|
|
2
|
-
export declare function offsetPath(pathBooleanKernel: Readonly<PathBooleanKernel>, path: Readonly<Path>, delta: number, options?: Readonly<PathOffsetOptions
|
|
2
|
+
export declare function offsetPath(out: Path, pathBooleanKernel: Readonly<PathBooleanKernel>, path: Readonly<Path>, delta: number, options?: Readonly<PathOffsetOptions>): void;
|
|
3
3
|
//# sourceMappingURL=offsetPath.d.ts.map
|
package/dist/offsetPath.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offsetPath.d.ts","sourceRoot":"","sources":["../src/offsetPath.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EACjB,IAAI,EAGJ,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAclC,wBAAgB,UAAU,CACxB,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAC9C,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,EACpB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"offsetPath.d.ts","sourceRoot":"","sources":["../src/offsetPath.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EACjB,IAAI,EAGJ,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAclC,wBAAgB,UAAU,CACxB,GAAG,EAAE,IAAI,EACT,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAC9C,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,EACpB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GACpC,IAAI,CAgDN"}
|
package/dist/offsetPath.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { flattenPath } from '@flighthq/path/contract';
|
|
2
2
|
import { resolvePathRegions } from "./resolvePathRegions.js";
|
|
3
3
|
// Offsets a path outward (positive `delta`, inflate) or inward (negative `delta`, deflate) by a signed
|
|
4
|
-
// distance,
|
|
4
|
+
// distance, writing a polygon outline into `out`. The input is flattened to polygon contours at the
|
|
5
5
|
// option tolerance; each closed contour is offset into a grown/shrunk ring and each open contour is
|
|
6
6
|
// offset into a closed slab outline capped at both terminals. Corner style on the convex side of a
|
|
7
7
|
// vertex is chosen by `options.join` (miter/bevel/round/square); open-path terminals by `options.end`
|
|
@@ -10,7 +10,7 @@ import { resolvePathRegions } from "./resolvePathRegions.js";
|
|
|
10
10
|
// clean, hole-correct outline. `delta` is signed against a canonical orientation, so positive always
|
|
11
11
|
// grows regardless of input winding. Over-deflating a region past self-collapse drops it, so the result
|
|
12
12
|
// can be an empty path (no commands).
|
|
13
|
-
export function offsetPath(pathBooleanKernel, path, delta, options
|
|
13
|
+
export function offsetPath(out, pathBooleanKernel, path, delta, options) {
|
|
14
14
|
const join = options?.join ?? 'miter';
|
|
15
15
|
const end = options?.end ?? 'butt';
|
|
16
16
|
const miterLimit = options?.miterLimit ?? DEFAULT_MITER_LIMIT;
|
|
@@ -61,7 +61,7 @@ export function offsetPath(pathBooleanKernel, path, delta, options, out) {
|
|
|
61
61
|
// corner's inner-miter emission overshoots on a feature narrower than 2·|delta|, it dissolves the
|
|
62
62
|
// negatively-wound self-overlap that non-zero fill would have kept; it also merges touching rings and
|
|
63
63
|
// emits a clean, hole-correct outline (empty ring set → empty path).
|
|
64
|
-
|
|
64
|
+
resolvePathRegions(out, pathBooleanKernel, rawRings, 'positive');
|
|
65
65
|
}
|
|
66
66
|
// Assembles one offset ring for a closed vertex loop by walking its vertices and emitting, at each, the
|
|
67
67
|
// join (or end cap, for the flagged terminal indices of an open-path loop) that bridges the offset end
|
package/dist/offsetPath.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offsetPath.js","sourceRoot":"","sources":["../src/offsetPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAStD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,uGAAuG;AACvG,wGAAwG;AACxG,oGAAoG;AACpG,mGAAmG;AACnG,sGAAsG;AACtG,qGAAqG;AACrG,sGAAsG;AACtG,qGAAqG;AACrG,wGAAwG;AACxG,sCAAsC;AACtC,MAAM,UAAU,UAAU,CACxB,iBAA8C,EAC9C,IAAoB,EACpB,KAAa,EACb,OAAqC,EACrC,GAAU;IAEV,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,OAAO,CAAC;IACtC,MAAM,GAAG,GAAG,OAAO,EAAE,GAAG,IAAI,MAAM,CAAC;IACnC,MAAM,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,mBAAmB,CAAC;IAC9D,MAAM,YAAY,GAAG,OAAO,EAAE,YAAY,IAAI,qBAAqB,CAAC;IACpE,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IACvD,iGAAiG;IACjG,oGAAoG;IACpG,oFAAoF;IACpF,MAAM,UAAU,GAAG,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAErD,MAAM,QAAQ,GAAe,EAAE,CAAC;IAChC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CA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,MAAM,CAAC,CAAC;IAC/C,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACrB,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;QAC/B,MAAM,MAAM,GAAG,KAAK,GAAG,CAAC,CAAC;QACzB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;QAClC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,wGAAwG;AACxG,2EAA2E;AAC3E,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,oGAAoG;AACpG,6BAA6B;AAC7B,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;AAE5B,MAAM,OAAO,GAAwB,IAAI,GAAG,EAAU,CAAC;AAEvD,sGAAsG;AACtG,wEAAwE;AACxE,MAAM,SAAS,GAAG,IAAI,CAAC;AAEvB,oGAAoG;AACpG,4FAA4F;AAC5F,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEhC,uGAAuG;AACvG,6CAA6C;AAC7C,MAAM,YAAY,GAAG,KAAK,CAAC;AAE3B,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PathBooleanKernel, Path, PathBooleanContour, PathBooleanFillRule } from '@flighthq/types/contract';
|
|
2
|
-
export declare function resolvePathRegions(pathBooleanKernel: Readonly<PathBooleanKernel>, rings: readonly PathBooleanContour[], fillRule: PathBooleanFillRule
|
|
2
|
+
export declare function resolvePathRegions(out: Path, pathBooleanKernel: Readonly<PathBooleanKernel>, rings: readonly PathBooleanContour[], fillRule: PathBooleanFillRule): void;
|
|
3
3
|
//# sourceMappingURL=resolvePathRegions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvePathRegions.d.ts","sourceRoot":"","sources":["../src/resolvePathRegions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAIjH,wBAAgB,kBAAkB,CAChC,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAC9C,KAAK,EAAE,SAAS,kBAAkB,EAAE,EACpC,QAAQ,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"resolvePathRegions.d.ts","sourceRoot":"","sources":["../src/resolvePathRegions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAIjH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,IAAI,EACT,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAC9C,KAAK,EAAE,SAAS,kBAAkB,EAAE,EACpC,QAAQ,EAAE,mBAAmB,GAC5B,IAAI,CAON"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { writePathBooleanContours } from "./writePathBooleanContours.js";
|
|
2
|
-
export function resolvePathRegions(pathBooleanKernel, rings, fillRule
|
|
3
|
-
if (rings.length === 0)
|
|
4
|
-
|
|
2
|
+
export function resolvePathRegions(out, pathBooleanKernel, rings, fillRule) {
|
|
3
|
+
if (rings.length === 0) {
|
|
4
|
+
writePathBooleanContours(out, EMPTY_CONTOURS);
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
5
7
|
const resolved = pathBooleanKernel.computePathBoolean(rings, EMPTY_CONTOURS, 'union', fillRule);
|
|
6
|
-
|
|
8
|
+
writePathBooleanContours(out, resolved);
|
|
7
9
|
}
|
|
8
10
|
const EMPTY_CONTOURS = [];
|
|
9
11
|
//# sourceMappingURL=resolvePathRegions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvePathRegions.js","sourceRoot":"","sources":["../src/resolvePathRegions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,MAAM,UAAU,kBAAkB,CAChC,iBAA8C,EAC9C,KAAoC,EACpC,QAA6B
|
|
1
|
+
{"version":3,"file":"resolvePathRegions.js","sourceRoot":"","sources":["../src/resolvePathRegions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,MAAM,UAAU,kBAAkB,CAChC,GAAS,EACT,iBAA8C,EAC9C,KAAoC,EACpC,QAA6B;IAE7B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,wBAAwB,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QAC9C,OAAO;IACT,CAAC;IACD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAChG,wBAAwB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,cAAc,GAAkC,EAAE,CAAC"}
|
package/dist/simplifyPath.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PathBooleanKernel, Path, PathBooleanOptions } from '@flighthq/types/contract';
|
|
2
|
-
export declare function simplifyPath(pathBooleanKernel: Readonly<PathBooleanKernel>, path: Readonly<Path>, options?: Readonly<PathBooleanOptions
|
|
2
|
+
export declare function simplifyPath(out: Path, pathBooleanKernel: Readonly<PathBooleanKernel>, path: Readonly<Path>, options?: Readonly<PathBooleanOptions>): void;
|
|
3
3
|
//# sourceMappingURL=simplifyPath.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplifyPath.d.ts","sourceRoot":"","sources":["../src/simplifyPath.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI5F,wBAAgB,YAAY,CAC1B,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAC9C,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,EACpB,OAAO,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"simplifyPath.d.ts","sourceRoot":"","sources":["../src/simplifyPath.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI5F,wBAAgB,YAAY,CAC1B,GAAG,EAAE,IAAI,EACT,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAC9C,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,EACpB,OAAO,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GACrC,IAAI,CAIN"}
|
package/dist/simplifyPath.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { flattenPath } from '@flighthq/path/contract';
|
|
2
2
|
import { resolvePathRegions } from "./resolvePathRegions.js";
|
|
3
|
-
export function simplifyPath(pathBooleanKernel, path, options
|
|
3
|
+
export function simplifyPath(out, pathBooleanKernel, path, options) {
|
|
4
4
|
const fillRule = options?.fillRule ?? 'nonZero';
|
|
5
5
|
const contours = flattenPath(path, options?.tolerance);
|
|
6
|
-
|
|
6
|
+
resolvePathRegions(out, pathBooleanKernel, contours, fillRule);
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=simplifyPath.js.map
|
package/dist/simplifyPath.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplifyPath.js","sourceRoot":"","sources":["../src/simplifyPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,UAAU,YAAY,CAC1B,iBAA8C,EAC9C,IAAoB,EACpB,OAAsC
|
|
1
|
+
{"version":3,"file":"simplifyPath.js","sourceRoot":"","sources":["../src/simplifyPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,UAAU,YAAY,CAC1B,GAAS,EACT,iBAA8C,EAC9C,IAAoB,EACpB,OAAsC;IAEtC,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,SAAS,CAAC;IAChD,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IACvD,kBAAkB,CAAC,GAAG,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACjE,CAAC"}
|
package/dist/unionAllPaths.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PathBooleanKernel, Path, PathBooleanOptions } from '@flighthq/types/contract';
|
|
2
|
-
export declare function unionAllPaths(pathBooleanKernel: Readonly<PathBooleanKernel>, paths: readonly Readonly<Path>[],
|
|
2
|
+
export declare function unionAllPaths(out: Path, pathBooleanKernel: Readonly<PathBooleanKernel>, paths: readonly Readonly<Path>[], options?: Readonly<PathBooleanOptions>): void;
|
|
3
3
|
//# sourceMappingURL=unionAllPaths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unionAllPaths.d.ts","sourceRoot":"","sources":["../src/unionAllPaths.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAsB,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAIhH,wBAAgB,aAAa,CAC3B,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAC9C,KAAK,EAAE,SAAS,QAAQ,CAAC,IAAI,CAAC,EAAE,EAChC,
|
|
1
|
+
{"version":3,"file":"unionAllPaths.d.ts","sourceRoot":"","sources":["../src/unionAllPaths.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAsB,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAIhH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,IAAI,EACT,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAC9C,KAAK,EAAE,SAAS,QAAQ,CAAC,IAAI,CAAC,EAAE,EAChC,OAAO,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GACrC,IAAI,CAYN"}
|
package/dist/unionAllPaths.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { flattenPath } from '@flighthq/path/contract';
|
|
2
2
|
import { writePathBooleanContours } from "./writePathBooleanContours.js";
|
|
3
|
-
export function unionAllPaths(pathBooleanKernel, paths,
|
|
3
|
+
export function unionAllPaths(out, pathBooleanKernel, paths, options) {
|
|
4
4
|
const fillRule = options?.fillRule ?? 'nonZero';
|
|
5
5
|
const contours = [];
|
|
6
6
|
for (const path of paths) {
|
|
@@ -10,7 +10,7 @@ export function unionAllPaths(pathBooleanKernel, paths, out, options) {
|
|
|
10
10
|
const result = contours.length === 0
|
|
11
11
|
? EMPTY_CONTOURS
|
|
12
12
|
: pathBooleanKernel.computePathBoolean(contours, EMPTY_CONTOURS, 'union', fillRule);
|
|
13
|
-
|
|
13
|
+
writePathBooleanContours(out, result);
|
|
14
14
|
}
|
|
15
15
|
const EMPTY_CONTOURS = [];
|
|
16
16
|
//# sourceMappingURL=unionAllPaths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unionAllPaths.js","sourceRoot":"","sources":["../src/unionAllPaths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,MAAM,UAAU,aAAa,CAC3B,iBAA8C,EAC9C,KAAgC,EAChC,
|
|
1
|
+
{"version":3,"file":"unionAllPaths.js","sourceRoot":"","sources":["../src/unionAllPaths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,MAAM,UAAU,aAAa,CAC3B,GAAS,EACT,iBAA8C,EAC9C,KAAgC,EAChC,OAAsC;IAEtC,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,SAAS,CAAC;IAChD,MAAM,QAAQ,GAAyB,EAAE,CAAC;IAC1C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,MAAM,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtF,CAAC;IACD,MAAM,MAAM,GACV,QAAQ,CAAC,MAAM,KAAK,CAAC;QACnB,CAAC,CAAC,cAAc;QAChB,CAAC,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAExF,wBAAwB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,cAAc,GAAkC,EAAE,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Path, PathBooleanContour } from '@flighthq/types/contract';
|
|
2
|
-
export declare function writePathBooleanContours(contours: readonly PathBooleanContour[]
|
|
2
|
+
export declare function writePathBooleanContours(out: Path, contours: readonly PathBooleanContour[]): void;
|
|
3
3
|
//# sourceMappingURL=writePathBooleanContours.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writePathBooleanContours.d.ts","sourceRoot":"","sources":["../src/writePathBooleanContours.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEzE,wBAAgB,wBAAwB,CAAC,
|
|
1
|
+
{"version":3,"file":"writePathBooleanContours.d.ts","sourceRoot":"","sources":["../src/writePathBooleanContours.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEzE,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,kBAAkB,EAAE,GAAG,IAAI,CAUjG"}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { appendPathClose, appendPathLineTo, appendPathMoveTo
|
|
2
|
-
export function writePathBooleanContours(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
path.winding = 'nonZero';
|
|
1
|
+
import { appendPathClose, appendPathLineTo, appendPathMoveTo } from '@flighthq/path/contract';
|
|
2
|
+
export function writePathBooleanContours(out, contours) {
|
|
3
|
+
out.commands.length = 0;
|
|
4
|
+
out.data.length = 0;
|
|
5
|
+
out.winding = 'nonZero';
|
|
7
6
|
for (const ring of contours) {
|
|
8
7
|
if (ring.length < 6)
|
|
9
8
|
continue;
|
|
10
|
-
appendPathMoveTo(
|
|
9
|
+
appendPathMoveTo(out, ring[0], ring[1]);
|
|
11
10
|
for (let i = 2; i < ring.length; i += 2)
|
|
12
|
-
appendPathLineTo(
|
|
13
|
-
appendPathClose(
|
|
11
|
+
appendPathLineTo(out, ring[i], ring[i + 1]);
|
|
12
|
+
appendPathClose(out);
|
|
14
13
|
}
|
|
15
|
-
return path;
|
|
16
14
|
}
|
|
17
15
|
//# sourceMappingURL=writePathBooleanContours.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writePathBooleanContours.js","sourceRoot":"","sources":["../src/writePathBooleanContours.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"writePathBooleanContours.js","sourceRoot":"","sources":["../src/writePathBooleanContours.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG9F,MAAM,UAAU,wBAAwB,CAAC,GAAS,EAAE,QAAuC;IACzF,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IACxB,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IACpB,GAAG,CAAC,OAAO,GAAG,SAAS,CAAC;IACxB,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC5B,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;YAAE,SAAS;QAC9B,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC;YAAE,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACrF,eAAe,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/path-boolean",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.3302.76ece6b",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/path": "0.5.1-next.
|
|
43
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.3302.76ece6b",
|
|
42
|
+
"@flighthq/path": "0.5.1-next.3302.76ece6b",
|
|
43
|
+
"@flighthq/types": "0.5.1-next.3302.76ece6b"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"typescript": "^5.3.0"
|
package/src/booleanPaths.test.ts
CHANGED
|
@@ -49,39 +49,39 @@ describe('booleanPaths', () => {
|
|
|
49
49
|
it('dispatches to the operation named in the argument', () => {
|
|
50
50
|
const a = rectanglePath(0, 0, 10, 10);
|
|
51
51
|
const b = rectanglePath(5, 5, 10, 10);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
const union = createPath();
|
|
53
|
+
const intersection = createPath();
|
|
54
|
+
const difference = createPath();
|
|
55
|
+
const xor = createPath();
|
|
56
|
+
booleanPaths(union, kernel, a, b, 'union');
|
|
57
|
+
booleanPaths(intersection, kernel, a, b, 'intersection');
|
|
58
|
+
booleanPaths(difference, kernel, a, b, 'difference');
|
|
59
|
+
booleanPaths(xor, kernel, a, b, 'xor');
|
|
60
|
+
expect(pathFilledArea(union)).toBeCloseTo(175, 4);
|
|
61
|
+
expect(pathFilledArea(intersection)).toBeCloseTo(25, 4);
|
|
62
|
+
expect(pathFilledArea(difference)).toBeCloseTo(75, 4);
|
|
63
|
+
expect(pathFilledArea(xor)).toBeCloseTo(150, 4);
|
|
56
64
|
});
|
|
57
65
|
|
|
58
|
-
it('
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
expect(result.commands.length).toBeGreaterThan(0);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('writes into the provided out path and returns it', () => {
|
|
65
|
-
const out = createPath('nonZero');
|
|
66
|
-
const returned = booleanPaths(kernel, rectanglePath(0, 0, 10, 10), rectanglePath(5, 5, 10, 10), 'union', out);
|
|
67
|
-
expect(returned).toBe(out);
|
|
66
|
+
it('writes into the required out path', () => {
|
|
67
|
+
const out = createPath('evenOdd');
|
|
68
|
+
booleanPaths(out, kernel, rectanglePath(0, 0, 10, 10), rectanglePath(5, 5, 10, 10), 'union');
|
|
68
69
|
expect(pathFilledArea(out)).toBeCloseTo(175, 4);
|
|
70
|
+
expect(out.winding).toBe('nonZero');
|
|
69
71
|
});
|
|
70
72
|
|
|
71
73
|
it('is safe when out aliases the subject input', () => {
|
|
72
74
|
const a = rectanglePath(0, 0, 10, 10);
|
|
73
75
|
const b = rectanglePath(5, 5, 10, 10);
|
|
74
|
-
|
|
75
|
-
expect(
|
|
76
|
-
expect(pathFilledArea(result)).toBeCloseTo(175, 4);
|
|
76
|
+
booleanPaths(a, kernel, a, b, 'union');
|
|
77
|
+
expect(pathFilledArea(a)).toBeCloseTo(175, 4);
|
|
77
78
|
});
|
|
78
79
|
|
|
79
80
|
it('is safe when out aliases the clip input', () => {
|
|
80
81
|
const a = rectanglePath(0, 0, 10, 10);
|
|
81
82
|
const b = rectanglePath(5, 5, 10, 10);
|
|
82
|
-
|
|
83
|
-
expect(
|
|
84
|
-
expect(pathFilledArea(result)).toBeCloseTo(25, 4);
|
|
83
|
+
booleanPaths(b, kernel, a, b, 'intersection');
|
|
84
|
+
expect(pathFilledArea(b)).toBeCloseTo(25, 4);
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
it('honors the even-odd fill rule option on self-overlapping input', () => {
|
|
@@ -89,26 +89,27 @@ describe('booleanPaths', () => {
|
|
|
89
89
|
appendPathRectangle(a, 0, 0, 10, 10);
|
|
90
90
|
appendPathRectangle(a, 5, 5, 10, 10);
|
|
91
91
|
const empty = createPath('nonZero');
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
);
|
|
96
|
-
expect(pathFilledArea(
|
|
97
|
-
|
|
98
|
-
4,
|
|
99
|
-
);
|
|
92
|
+
const nonZero = createPath();
|
|
93
|
+
const evenOdd = createPath();
|
|
94
|
+
booleanPaths(nonZero, kernel, a, empty, 'union', { fillRule: 'nonZero' });
|
|
95
|
+
booleanPaths(evenOdd, kernel, a, empty, 'union', { fillRule: 'evenOdd' });
|
|
96
|
+
expect(pathFilledArea(nonZero)).toBeCloseTo(175, 4);
|
|
97
|
+
expect(pathFilledArea(evenOdd)).toBeCloseTo(150, 4);
|
|
100
98
|
});
|
|
101
99
|
|
|
102
100
|
it('accepts a coarser tolerance option without error', () => {
|
|
103
101
|
const a = rectanglePath(0, 0, 10, 10);
|
|
104
102
|
const b = rectanglePath(5, 5, 10, 10);
|
|
105
|
-
|
|
103
|
+
const out = createPath();
|
|
104
|
+
booleanPaths(out, kernel, a, b, 'union', { tolerance: 2 });
|
|
105
|
+
expect(pathFilledArea(out)).toBeCloseTo(175, 4);
|
|
106
106
|
});
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
describe('differencePaths', () => {
|
|
110
110
|
it('cuts a contained hole', () => {
|
|
111
|
-
const result =
|
|
111
|
+
const result = createPath();
|
|
112
|
+
differencePaths(result, kernel, rectanglePath(0, 0, 30, 30), rectanglePath(10, 10, 10, 10));
|
|
112
113
|
expect(pathFilledArea(result)).toBeCloseTo(800, 4);
|
|
113
114
|
expect(pathFillContains(result, 15, 15)).toBe(false);
|
|
114
115
|
expect(pathFillContains(result, 2, 2)).toBe(true);
|
|
@@ -117,32 +118,41 @@ describe('differencePaths', () => {
|
|
|
117
118
|
it('is empty for a path differenced against itself', () => {
|
|
118
119
|
const a = rectanglePath(0, 0, 10, 10);
|
|
119
120
|
const b = rectanglePath(0, 0, 10, 10);
|
|
120
|
-
|
|
121
|
+
const result = createPath();
|
|
122
|
+
differencePaths(result, kernel, a, b);
|
|
123
|
+
expect(pathFilledArea(result)).toBeCloseTo(0, 4);
|
|
121
124
|
});
|
|
122
125
|
});
|
|
123
126
|
|
|
124
127
|
describe('intersectPaths', () => {
|
|
125
128
|
it('keeps the overlap', () => {
|
|
126
|
-
const result =
|
|
129
|
+
const result = createPath();
|
|
130
|
+
intersectPaths(result, kernel, rectanglePath(0, 0, 10, 10), rectanglePath(5, 5, 10, 10));
|
|
127
131
|
expect(pathFilledArea(result)).toBeCloseTo(25, 4);
|
|
128
132
|
});
|
|
129
133
|
|
|
130
134
|
it('is empty for disjoint inputs', () => {
|
|
131
|
-
const result =
|
|
135
|
+
const result = createPath();
|
|
136
|
+
intersectPaths(result, kernel, rectanglePath(0, 0, 10, 10), rectanglePath(20, 20, 10, 10));
|
|
132
137
|
expect(pathFilledArea(result)).toBeCloseTo(0, 4);
|
|
133
138
|
});
|
|
134
139
|
});
|
|
135
140
|
|
|
136
141
|
describe('unionPaths', () => {
|
|
137
142
|
it('merges overlapping rectangles', () => {
|
|
138
|
-
const result =
|
|
143
|
+
const result = createPath();
|
|
144
|
+
unionPaths(result, kernel, rectanglePath(0, 0, 10, 10), rectanglePath(5, 5, 10, 10));
|
|
139
145
|
expect(pathFilledArea(result)).toBeCloseTo(175, 4);
|
|
140
146
|
});
|
|
141
147
|
|
|
142
148
|
it('commutes', () => {
|
|
143
149
|
const a = rectanglePath(0, 0, 10, 10);
|
|
144
150
|
const b = rectanglePath(4, 4, 10, 10);
|
|
145
|
-
|
|
151
|
+
const ab = createPath();
|
|
152
|
+
const ba = createPath();
|
|
153
|
+
unionPaths(ab, kernel, a, b);
|
|
154
|
+
unionPaths(ba, kernel, b, a);
|
|
155
|
+
expect(pathFilledArea(ab)).toBeCloseTo(pathFilledArea(ba), 4);
|
|
146
156
|
});
|
|
147
157
|
|
|
148
158
|
it('routes through a provided kernel', () => {
|
|
@@ -155,7 +165,8 @@ describe('unionPaths', () => {
|
|
|
155
165
|
};
|
|
156
166
|
return finishEntity(out);
|
|
157
167
|
})();
|
|
158
|
-
const result =
|
|
168
|
+
const result = createPath();
|
|
169
|
+
unionPaths(result, custom, rectanglePath(0, 0, 10, 10), rectanglePath(5, 5, 10, 10));
|
|
159
170
|
expect(seen).toBe(true);
|
|
160
171
|
expect(result.commands.length).toBe(0);
|
|
161
172
|
});
|
|
@@ -163,7 +174,8 @@ describe('unionPaths', () => {
|
|
|
163
174
|
|
|
164
175
|
describe('xorPaths', () => {
|
|
165
176
|
it('keeps the symmetric difference', () => {
|
|
166
|
-
const result =
|
|
177
|
+
const result = createPath();
|
|
178
|
+
xorPaths(result, kernel, rectanglePath(0, 0, 10, 10), rectanglePath(5, 5, 10, 10));
|
|
167
179
|
expect(pathFilledArea(result)).toBeCloseTo(150, 4);
|
|
168
180
|
});
|
|
169
181
|
});
|
|
@@ -109,8 +109,10 @@ describe('fuzz invariants', () => {
|
|
|
109
109
|
for (let i = start; i < vertices.length; i += 2) appendPathLineTo(path, vertices[i], vertices[i + 1]);
|
|
110
110
|
}
|
|
111
111
|
appendPathClose(path);
|
|
112
|
-
const nonZero =
|
|
113
|
-
const evenOdd =
|
|
112
|
+
const nonZero = createPath();
|
|
113
|
+
const evenOdd = createPath();
|
|
114
|
+
simplifyPath(nonZero, kernel, path, { fillRule: 'nonZero' });
|
|
115
|
+
simplifyPath(evenOdd, kernel, path, { fillRule: 'evenOdd' });
|
|
114
116
|
expect(pathArea(nonZero)).toBeGreaterThan(0);
|
|
115
117
|
expect(pathArea(evenOdd)).toBeCloseTo(0, 6);
|
|
116
118
|
}
|
|
@@ -121,8 +123,10 @@ describe('fuzz invariants', () => {
|
|
|
121
123
|
for (let iteration = 0; iteration < 40; iteration++) {
|
|
122
124
|
const a = polygonPath(randomSimplePolygon(random, 3 + (iteration % 6)));
|
|
123
125
|
const b = polygonPath(randomSimplePolygon(random, 3 + ((iteration + 3) % 6)));
|
|
124
|
-
const ab =
|
|
125
|
-
const ba =
|
|
126
|
+
const ab = createPath();
|
|
127
|
+
const ba = createPath();
|
|
128
|
+
unionPaths(ab, kernel, a, b);
|
|
129
|
+
unionPaths(ba, kernel, b, a);
|
|
126
130
|
expect(areasClose(pathArea(ab), pathArea(ba))).toBe(true);
|
|
127
131
|
expect(ringCount(ab)).toBe(ringCount(ba));
|
|
128
132
|
}
|
|
@@ -132,7 +136,8 @@ describe('fuzz invariants', () => {
|
|
|
132
136
|
const random = makeRandom(0x55aa33cc);
|
|
133
137
|
for (let iteration = 0; iteration < 40; iteration++) {
|
|
134
138
|
const a = polygonPath(randomMessyPolygon(random, 4 + (iteration % 5)));
|
|
135
|
-
const result =
|
|
139
|
+
const result = createPath();
|
|
140
|
+
differencePaths(result, kernel, a, a);
|
|
136
141
|
expect(pathArea(result)).toBeCloseTo(0, 6);
|
|
137
142
|
}
|
|
138
143
|
});
|
|
@@ -141,8 +146,10 @@ describe('fuzz invariants', () => {
|
|
|
141
146
|
const random = makeRandom(0x0f0f0f0f);
|
|
142
147
|
for (let iteration = 0; iteration < 40; iteration++) {
|
|
143
148
|
const a = polygonPath(randomSimplePolygon(random, 3 + (iteration % 6)));
|
|
144
|
-
const union =
|
|
145
|
-
const simplified =
|
|
149
|
+
const union = createPath();
|
|
150
|
+
const simplified = createPath();
|
|
151
|
+
unionPaths(union, kernel, a, a);
|
|
152
|
+
simplifyPath(simplified, kernel, a);
|
|
146
153
|
expect(areasClose(pathArea(union), pathArea(simplified))).toBe(true);
|
|
147
154
|
expect(ringCount(union)).toBe(ringCount(simplified));
|
|
148
155
|
}
|
|
@@ -152,8 +159,10 @@ describe('fuzz invariants', () => {
|
|
|
152
159
|
const random = makeRandom(0x7e577e57);
|
|
153
160
|
for (let iteration = 0; iteration < 40; iteration++) {
|
|
154
161
|
const a = polygonPath(randomMessyPolygon(random, 4 + (iteration % 6)));
|
|
155
|
-
const once =
|
|
156
|
-
const twice =
|
|
162
|
+
const once = createPath();
|
|
163
|
+
const twice = createPath();
|
|
164
|
+
simplifyPath(once, kernel, a);
|
|
165
|
+
simplifyPath(twice, kernel, once);
|
|
157
166
|
expect(areasClose(pathArea(once), pathArea(twice))).toBe(true);
|
|
158
167
|
expect(ringCount(once)).toBe(ringCount(twice));
|
|
159
168
|
}
|
|
@@ -163,8 +172,10 @@ describe('fuzz invariants', () => {
|
|
|
163
172
|
const random = makeRandom(0x13571357);
|
|
164
173
|
for (let iteration = 0; iteration < 40; iteration++) {
|
|
165
174
|
const a = polygonPath(randomMessyPolygon(random, 4 + (iteration % 6)));
|
|
166
|
-
const union =
|
|
167
|
-
const simplified =
|
|
175
|
+
const union = createPath();
|
|
176
|
+
const simplified = createPath();
|
|
177
|
+
unionAllPaths(union, kernel, [a]);
|
|
178
|
+
simplifyPath(simplified, kernel, a);
|
|
168
179
|
expect(areasClose(pathArea(union), pathArea(simplified))).toBe(true);
|
|
169
180
|
expect(ringCount(union)).toBe(ringCount(simplified));
|
|
170
181
|
}
|
|
@@ -175,7 +186,8 @@ describe('fuzz invariants', () => {
|
|
|
175
186
|
for (let iteration = 0; iteration < 40; iteration++) {
|
|
176
187
|
const vertices = randomSimplePolygon(random, 3 + (iteration % 6));
|
|
177
188
|
const a = polygonPath(vertices);
|
|
178
|
-
const zeroOffset =
|
|
189
|
+
const zeroOffset = createPath();
|
|
190
|
+
offsetPath(zeroOffset, kernel, a, 0);
|
|
179
191
|
expect(areasClose(pathArea(zeroOffset), pathArea(a), 1e-2, 1e-2)).toBe(true);
|
|
180
192
|
expect(ringCount(zeroOffset)).toBe(1);
|
|
181
193
|
}
|
|
@@ -189,8 +201,10 @@ describe('fuzz invariants', () => {
|
|
|
189
201
|
const a = polygonPath(vertices);
|
|
190
202
|
const baseArea = pathArea(a);
|
|
191
203
|
if (baseArea < 50) continue;
|
|
192
|
-
const grown =
|
|
193
|
-
const recovered =
|
|
204
|
+
const grown = createPath();
|
|
205
|
+
const recovered = createPath();
|
|
206
|
+
offsetPath(grown, kernel, a, 3, { join: 'miter', miterLimit: 100 });
|
|
207
|
+
offsetPath(recovered, kernel, grown, -3, { join: 'miter', miterLimit: 100 });
|
|
194
208
|
expect(ringCount(recovered)).toBe(1);
|
|
195
209
|
expect(areasClose(pathArea(recovered), baseArea, 3e-2, 1)).toBe(true);
|
|
196
210
|
}
|
|
@@ -200,9 +214,11 @@ describe('fuzz invariants', () => {
|
|
|
200
214
|
const random = makeRandom(0x0c0ffee0);
|
|
201
215
|
for (let iteration = 0; iteration < 40; iteration++) {
|
|
202
216
|
const a = polygonPath(randomSimplePolygon(random, 5 + (iteration % 8)));
|
|
203
|
-
const offset =
|
|
217
|
+
const offset = createPath();
|
|
218
|
+
offsetPath(offset, kernel, a, 4);
|
|
204
219
|
if (offset.commands.length === 0) continue;
|
|
205
|
-
const simplified =
|
|
220
|
+
const simplified = createPath();
|
|
221
|
+
simplifyPath(simplified, kernel, offset, { fillRule: 'nonZero' });
|
|
206
222
|
expect(areasClose(pathArea(simplified), pathArea(offset), 1e-2, 1e-2)).toBe(true);
|
|
207
223
|
expect(ringCount(simplified)).toBe(ringCount(offset));
|
|
208
224
|
}
|
package/src/offsetPath.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createPath, appendPathClose, appendPathLineTo, appendPathMoveTo, flattenPath } from '@flighthq/path/contract';
|
|
2
|
-
import type { Path } from '@flighthq/types/contract';
|
|
2
|
+
import type { Path, PathOffsetOptions } from '@flighthq/types/contract';
|
|
3
3
|
import { describe, expect, it } from 'vitest';
|
|
4
4
|
|
|
5
5
|
import { martinezPathBooleanKernel } from './martinezKernel.ts';
|
|
@@ -55,19 +55,24 @@ function ringCount(path: Readonly<Path>): number {
|
|
|
55
55
|
return flattenPath(path).length;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
function runOffsetPath(path: Readonly<Path>, delta: number, options?: Readonly<PathOffsetOptions>): Path {
|
|
59
|
+
const out = createPath('nonZero');
|
|
60
|
+
offsetPath(out, kernel, path, delta, options);
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
|
|
58
64
|
const UNIT_SQUARE = [0, 0, 1, 0, 1, 1, 0, 1];
|
|
59
65
|
|
|
60
66
|
describe('offsetPath', () => {
|
|
61
67
|
it('writes into an existing output and is alias-safe', () => {
|
|
62
68
|
const path = polygonPath([0, 0, 4, 0, 4, 4, 0, 4], true);
|
|
63
|
-
|
|
69
|
+
offsetPath(path, kernel, path, 1);
|
|
64
70
|
|
|
65
|
-
expect(result).toBe(path);
|
|
66
71
|
expect(pathBounds(path)).toEqual({ minX: -1, minY: -1, maxX: 5, maxY: 5 });
|
|
67
72
|
});
|
|
68
73
|
|
|
69
74
|
it('inflates a closed square by delta on every side with a miter join', () => {
|
|
70
|
-
const result =
|
|
75
|
+
const result = runOffsetPath(polygonPath(UNIT_SQUARE, true), 1);
|
|
71
76
|
const bounds = pathBounds(result);
|
|
72
77
|
expect(bounds.minX).toBeCloseTo(-1, 6);
|
|
73
78
|
expect(bounds.minY).toBeCloseTo(-1, 6);
|
|
@@ -77,7 +82,7 @@ describe('offsetPath', () => {
|
|
|
77
82
|
});
|
|
78
83
|
|
|
79
84
|
it('deflates a closed square on a negative delta', () => {
|
|
80
|
-
const result =
|
|
85
|
+
const result = runOffsetPath(polygonPath([0, 0, 4, 0, 4, 4, 0, 4], true), -1);
|
|
81
86
|
const bounds = pathBounds(result);
|
|
82
87
|
expect(bounds.minX).toBeCloseTo(1, 6);
|
|
83
88
|
expect(bounds.minY).toBeCloseTo(1, 6);
|
|
@@ -87,13 +92,13 @@ describe('offsetPath', () => {
|
|
|
87
92
|
});
|
|
88
93
|
|
|
89
94
|
it('emits an empty path when deflation collapses the region', () => {
|
|
90
|
-
const result =
|
|
95
|
+
const result = runOffsetPath(polygonPath(UNIT_SQUARE, true), -1);
|
|
91
96
|
expect(result.commands.length).toBe(0);
|
|
92
97
|
expect(pathArea(result)).toBe(0);
|
|
93
98
|
});
|
|
94
99
|
|
|
95
100
|
it('chamfers corners with a bevel join', () => {
|
|
96
|
-
const result =
|
|
101
|
+
const result = runOffsetPath(polygonPath(UNIT_SQUARE, true), 1, { join: 'bevel' });
|
|
97
102
|
const bounds = pathBounds(result);
|
|
98
103
|
expect(bounds.minX).toBeCloseTo(-1, 6);
|
|
99
104
|
expect(bounds.maxX).toBeCloseTo(2, 6);
|
|
@@ -101,19 +106,17 @@ describe('offsetPath', () => {
|
|
|
101
106
|
});
|
|
102
107
|
|
|
103
108
|
it('rounds corners with a round join and tessellates denser with radius and finer tolerance', () => {
|
|
104
|
-
const rounded =
|
|
109
|
+
const rounded = runOffsetPath(polygonPath(UNIT_SQUARE, true), 1, { join: 'round' });
|
|
105
110
|
const bounds = pathBounds(rounded);
|
|
106
111
|
expect(bounds.minX).toBeCloseTo(-1, 6);
|
|
107
112
|
expect(bounds.maxX).toBeCloseTo(2, 6);
|
|
108
|
-
const fineArea = pathArea(
|
|
109
|
-
offsetPath(kernel, polygonPath(UNIT_SQUARE, true), 1, { join: 'round', arcTolerance: 0.001 }),
|
|
110
|
-
);
|
|
113
|
+
const fineArea = pathArea(runOffsetPath(polygonPath(UNIT_SQUARE, true), 1, { join: 'round', arcTolerance: 0.001 }));
|
|
111
114
|
expect(fineArea).toBeCloseTo(5 + Math.PI, 1);
|
|
112
115
|
|
|
113
|
-
const largeRadius =
|
|
116
|
+
const largeRadius = runOffsetPath(polygonPath(UNIT_SQUARE, true), 5, { join: 'round' });
|
|
114
117
|
expect(pathVertexCount(largeRadius)).toBeGreaterThan(pathVertexCount(rounded));
|
|
115
118
|
|
|
116
|
-
const fineTolerance =
|
|
119
|
+
const fineTolerance = runOffsetPath(polygonPath(UNIT_SQUARE, true), 1, {
|
|
117
120
|
join: 'round',
|
|
118
121
|
arcTolerance: 0.01,
|
|
119
122
|
});
|
|
@@ -122,26 +125,26 @@ describe('offsetPath', () => {
|
|
|
122
125
|
|
|
123
126
|
it('falls back to a bevel when a sharp miter exceeds the miter limit', () => {
|
|
124
127
|
const wedge = [0, 0, 4, 0.5, 4, -0.5];
|
|
125
|
-
const clipped =
|
|
126
|
-
const sharp =
|
|
128
|
+
const clipped = runOffsetPath(polygonPath(wedge, true), 1, { miterLimit: 2 });
|
|
129
|
+
const sharp = runOffsetPath(polygonPath(wedge, true), 1, { miterLimit: 50 });
|
|
127
130
|
expect(pathBounds(clipped).minX).toBeGreaterThan(pathBounds(sharp).minX + 3);
|
|
128
131
|
expect(pathBounds(sharp).minX).toBeLessThan(-5);
|
|
129
132
|
});
|
|
130
133
|
|
|
131
134
|
it('squares corners with a square join', () => {
|
|
132
|
-
const result =
|
|
135
|
+
const result = runOffsetPath(polygonPath(UNIT_SQUARE, true), 1, { join: 'square' });
|
|
133
136
|
const bounds = pathBounds(result);
|
|
134
137
|
expect(bounds.minX).toBeCloseTo(-1, 6);
|
|
135
138
|
expect(bounds.maxX).toBeCloseTo(2, 6);
|
|
136
139
|
expect(pathArea(result)).toBeCloseTo(9, 4);
|
|
137
140
|
expect(pathArea(result)).toBeGreaterThan(
|
|
138
|
-
pathArea(
|
|
141
|
+
pathArea(runOffsetPath(polygonPath(UNIT_SQUARE, true), 1, { join: 'bevel' })),
|
|
139
142
|
);
|
|
140
143
|
});
|
|
141
144
|
|
|
142
145
|
it('cleans a concave corner into a single valid outline', () => {
|
|
143
146
|
const lShape = [0, 0, 2, 0, 2, 2, 1, 2, 1, 1, 0, 1];
|
|
144
|
-
const result =
|
|
147
|
+
const result = runOffsetPath(polygonPath(lShape, true), 0.25);
|
|
145
148
|
const bounds = pathBounds(result);
|
|
146
149
|
expect(bounds.minX).toBeCloseTo(-0.25, 6);
|
|
147
150
|
expect(bounds.minY).toBeCloseTo(-0.25, 6);
|
|
@@ -153,14 +156,15 @@ describe('offsetPath', () => {
|
|
|
153
156
|
|
|
154
157
|
it('closes a concave slot narrower than 2·delta into a valid self-intersection-free outline', () => {
|
|
155
158
|
const uShape = [0, 0, 10, 0, 10, 10, 5.5, 10, 5.5, 3, 4.5, 3, 4.5, 10, 0, 10];
|
|
156
|
-
const result =
|
|
159
|
+
const result = runOffsetPath(polygonPath(uShape, true), 1);
|
|
157
160
|
expect(ringCount(result)).toBe(1);
|
|
158
161
|
const bounds = pathBounds(result);
|
|
159
162
|
expect(bounds.minX).toBeCloseTo(-1, 6);
|
|
160
163
|
expect(bounds.maxX).toBeCloseTo(11, 6);
|
|
161
164
|
expect(bounds.minY).toBeCloseTo(-1, 6);
|
|
162
165
|
expect(bounds.maxY).toBeCloseTo(11, 6);
|
|
163
|
-
const simplified =
|
|
166
|
+
const simplified = createPath();
|
|
167
|
+
simplifyPath(simplified, kernel, result, { fillRule: 'nonZero' });
|
|
164
168
|
expect(ringCount(simplified)).toBe(ringCount(result));
|
|
165
169
|
expect(pathArea(simplified)).toBeCloseTo(pathArea(result), 4);
|
|
166
170
|
});
|
|
@@ -168,9 +172,9 @@ describe('offsetPath', () => {
|
|
|
168
172
|
it('offsets consistently across a 1e9 span of coordinate scales (magnitude-relative epsilons)', () => {
|
|
169
173
|
const lShape = (s: number): number[] => [0, 0, 2 * s, 0, 2 * s, 2 * s, s, 2 * s, s, s, 0, s];
|
|
170
174
|
const at = (s: number): Readonly<Path> => polygonPath(lShape(s), true);
|
|
171
|
-
const small =
|
|
172
|
-
const mid =
|
|
173
|
-
const large =
|
|
175
|
+
const small = runOffsetPath(at(1e-3), 0.25e-3);
|
|
176
|
+
const mid = runOffsetPath(at(1), 0.25);
|
|
177
|
+
const large = runOffsetPath(at(1e6), 0.25e6);
|
|
174
178
|
expect(ringCount(small)).toBe(ringCount(mid));
|
|
175
179
|
expect(ringCount(large)).toBe(ringCount(mid));
|
|
176
180
|
expect(pathArea(small) / 1e-3 ** 2).toBeCloseTo(pathArea(mid), 4);
|
|
@@ -178,7 +182,7 @@ describe('offsetPath', () => {
|
|
|
178
182
|
});
|
|
179
183
|
|
|
180
184
|
it('strokes an open path into a butt-capped rectangle', () => {
|
|
181
|
-
const result =
|
|
185
|
+
const result = runOffsetPath(polygonPath([0, 0, 2, 0], false), 0.5, { end: 'butt' });
|
|
182
186
|
const bounds = pathBounds(result);
|
|
183
187
|
expect(bounds.minX).toBeCloseTo(0, 6);
|
|
184
188
|
expect(bounds.maxX).toBeCloseTo(2, 6);
|
|
@@ -188,7 +192,7 @@ describe('offsetPath', () => {
|
|
|
188
192
|
});
|
|
189
193
|
|
|
190
194
|
it('extends an open path past its ends with a square cap', () => {
|
|
191
|
-
const result =
|
|
195
|
+
const result = runOffsetPath(polygonPath([0, 0, 2, 0], false), 0.5, { end: 'square' });
|
|
192
196
|
const bounds = pathBounds(result);
|
|
193
197
|
expect(bounds.minX).toBeCloseTo(-0.5, 6);
|
|
194
198
|
expect(bounds.maxX).toBeCloseTo(2.5, 6);
|
|
@@ -196,7 +200,7 @@ describe('offsetPath', () => {
|
|
|
196
200
|
});
|
|
197
201
|
|
|
198
202
|
it('caps an open path with half-circles on a round end', () => {
|
|
199
|
-
const result =
|
|
203
|
+
const result = runOffsetPath(polygonPath([0, 0, 2, 0], false), 0.5, { end: 'round', arcTolerance: 0.001 });
|
|
200
204
|
const bounds = pathBounds(result);
|
|
201
205
|
expect(bounds.minX).toBeCloseTo(-0.5, 2);
|
|
202
206
|
expect(bounds.maxX).toBeCloseTo(2.5, 2);
|
|
@@ -205,8 +209,8 @@ describe('offsetPath', () => {
|
|
|
205
209
|
|
|
206
210
|
it('offsets the same vertices differently as an open vs a closed contour', () => {
|
|
207
211
|
const vertices = [0, 0, 2, 0, 2, 2, 0, 2];
|
|
208
|
-
const closed =
|
|
209
|
-
const open =
|
|
212
|
+
const closed = runOffsetPath(polygonPath(vertices, true), 0.5);
|
|
213
|
+
const open = runOffsetPath(polygonPath(vertices, false), 0.5, { end: 'butt' });
|
|
210
214
|
expect(pathArea(closed)).toBeCloseTo(9, 4);
|
|
211
215
|
expect(pathArea(open)).toBeLessThan(pathArea(closed));
|
|
212
216
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { flattenPath } from '@flighthq/path/contract';
|
|
1
|
+
import { createPath, flattenPath } from '@flighthq/path/contract';
|
|
2
2
|
import type { Path } from '@flighthq/types/contract';
|
|
3
3
|
import { describe, expect, it } from 'vitest';
|
|
4
4
|
|
|
@@ -27,20 +27,23 @@ const SQUARE_B = [2, 2, 6, 2, 6, 6, 2, 6];
|
|
|
27
27
|
|
|
28
28
|
describe('resolvePathRegions', () => {
|
|
29
29
|
it('returns an empty path for no rings', () => {
|
|
30
|
-
const result =
|
|
30
|
+
const result = createPath('evenOdd');
|
|
31
|
+
resolvePathRegions(result, kernel, [], 'nonZero');
|
|
31
32
|
expect(result.commands).toHaveLength(0);
|
|
32
33
|
expect(result.data).toHaveLength(0);
|
|
33
34
|
expect(result.winding).toBe('nonZero');
|
|
34
35
|
});
|
|
35
36
|
|
|
36
37
|
it('self-unions overlapping rings into one outline under nonZero', () => {
|
|
37
|
-
const result =
|
|
38
|
+
const result = createPath('nonZero');
|
|
39
|
+
resolvePathRegions(result, kernel, [SQUARE_A, SQUARE_B], 'nonZero');
|
|
38
40
|
expect(ringCount(result)).toBe(1);
|
|
39
41
|
expect(pathArea(result)).toBeCloseTo(28, 6);
|
|
40
42
|
});
|
|
41
43
|
|
|
42
44
|
it('applies the fill rule to self-overlap under evenOdd', () => {
|
|
43
|
-
const result =
|
|
45
|
+
const result = createPath('nonZero');
|
|
46
|
+
resolvePathRegions(result, kernel, [SQUARE_A, SQUARE_B], 'evenOdd');
|
|
44
47
|
expect(pathArea(result)).toBeCloseTo(24, 6);
|
|
45
48
|
expect(ringCount(result)).toBeGreaterThan(1);
|
|
46
49
|
});
|
package/src/simplifyPath.test.ts
CHANGED
|
@@ -63,15 +63,15 @@ const UNIT_SQUARE = [0, 0, 3, 0, 3, 3, 0, 3];
|
|
|
63
63
|
describe('simplifyPath', () => {
|
|
64
64
|
it('writes into an existing output and is alias-safe', () => {
|
|
65
65
|
const path = polygonPath(BOWTIE);
|
|
66
|
-
|
|
66
|
+
simplifyPath(path, kernel, path);
|
|
67
67
|
|
|
68
|
-
expect(result).toBe(path);
|
|
69
68
|
expect(ringCount(path)).toBe(2);
|
|
70
69
|
expect(pathArea(path)).toBeCloseTo(2, 6);
|
|
71
70
|
});
|
|
72
71
|
|
|
73
72
|
it('resolves a self-intersecting bowtie into two triangles', () => {
|
|
74
|
-
const result =
|
|
73
|
+
const result = createPath();
|
|
74
|
+
simplifyPath(result, kernel, polygonPath(BOWTIE));
|
|
75
75
|
expect(ringCount(result)).toBe(2);
|
|
76
76
|
expect(pathArea(result)).toBeCloseTo(2, 6);
|
|
77
77
|
});
|
|
@@ -88,7 +88,8 @@ describe('simplifyPath', () => {
|
|
|
88
88
|
appendPathLineTo(path, 6, 6);
|
|
89
89
|
appendPathLineTo(path, 2, 6);
|
|
90
90
|
appendPathClose(path);
|
|
91
|
-
const result =
|
|
91
|
+
const result = createPath();
|
|
92
|
+
simplifyPath(result, kernel, path, { fillRule: 'nonZero' });
|
|
92
93
|
expect(ringCount(result)).toBe(1);
|
|
93
94
|
expect(pathArea(result)).toBeCloseTo(28, 6);
|
|
94
95
|
});
|
|
@@ -105,14 +106,17 @@ describe('simplifyPath', () => {
|
|
|
105
106
|
appendPathLineTo(path, 6, 6);
|
|
106
107
|
appendPathLineTo(path, 2, 6);
|
|
107
108
|
appendPathClose(path);
|
|
108
|
-
const result =
|
|
109
|
+
const result = createPath();
|
|
110
|
+
simplifyPath(result, kernel, path, { fillRule: 'evenOdd' });
|
|
109
111
|
expect(pathArea(result)).toBeCloseTo(24, 6);
|
|
110
112
|
expect(ringCount(result)).toBeGreaterThan(1);
|
|
111
113
|
});
|
|
112
114
|
|
|
113
115
|
it('fills a self-overlapping star solid under nonZero but hollow under evenOdd', () => {
|
|
114
|
-
const solid =
|
|
115
|
-
const hollow =
|
|
116
|
+
const solid = createPath();
|
|
117
|
+
const hollow = createPath();
|
|
118
|
+
simplifyPath(solid, kernel, pentagramPath(10, 'nonZero'), { fillRule: 'nonZero' });
|
|
119
|
+
simplifyPath(hollow, kernel, pentagramPath(10, 'evenOdd'), { fillRule: 'evenOdd' });
|
|
116
120
|
expect(ringCount(solid)).toBe(1);
|
|
117
121
|
expect(pathArea(solid)).toBeCloseTo(112.257, 2);
|
|
118
122
|
expect(ringCount(hollow)).toBeGreaterThan(1);
|
|
@@ -121,7 +125,8 @@ describe('simplifyPath', () => {
|
|
|
121
125
|
});
|
|
122
126
|
|
|
123
127
|
it('passes an already-simple convex path through unchanged', () => {
|
|
124
|
-
const result =
|
|
128
|
+
const result = createPath();
|
|
129
|
+
simplifyPath(result, kernel, polygonPath(UNIT_SQUARE));
|
|
125
130
|
expect(ringCount(result)).toBe(1);
|
|
126
131
|
expect(pathArea(result)).toBeCloseTo(9, 6);
|
|
127
132
|
const bounds = pathBounds(result);
|
|
@@ -132,13 +137,15 @@ describe('simplifyPath', () => {
|
|
|
132
137
|
});
|
|
133
138
|
|
|
134
139
|
it('returns an empty path for empty input', () => {
|
|
135
|
-
const result =
|
|
140
|
+
const result = createPath();
|
|
141
|
+
simplifyPath(result, kernel, createPath('nonZero'));
|
|
136
142
|
expect(result.commands).toHaveLength(0);
|
|
137
143
|
expect(result.data).toHaveLength(0);
|
|
138
144
|
});
|
|
139
145
|
|
|
140
146
|
it('returns an empty path for a degenerate zero-area contour', () => {
|
|
141
|
-
const result =
|
|
147
|
+
const result = createPath();
|
|
148
|
+
simplifyPath(result, kernel, polygonPath([0, 0, 5, 0, 10, 0]));
|
|
142
149
|
expect(result.commands).toHaveLength(0);
|
|
143
150
|
expect(result.data).toHaveLength(0);
|
|
144
151
|
});
|
|
@@ -34,7 +34,8 @@ function ringCount(path: Readonly<Path>): number {
|
|
|
34
34
|
|
|
35
35
|
describe('unionAllPaths', () => {
|
|
36
36
|
it('returns an empty path for an empty list', () => {
|
|
37
|
-
const result =
|
|
37
|
+
const result = createPath('nonZero');
|
|
38
|
+
unionAllPaths(result, kernel, []);
|
|
38
39
|
expect(result.commands).toHaveLength(0);
|
|
39
40
|
expect(result.data).toHaveLength(0);
|
|
40
41
|
});
|
|
@@ -51,20 +52,23 @@ describe('unionAllPaths', () => {
|
|
|
51
52
|
appendPathLineTo(overlap, 6, 6);
|
|
52
53
|
appendPathLineTo(overlap, 2, 6);
|
|
53
54
|
appendPathClose(overlap);
|
|
54
|
-
const result =
|
|
55
|
+
const result = createPath('nonZero');
|
|
56
|
+
unionAllPaths(result, kernel, [overlap]);
|
|
55
57
|
expect(ringCount(result)).toBe(1);
|
|
56
58
|
expect(pathArea(result)).toBeCloseTo(28, 6);
|
|
57
59
|
});
|
|
58
60
|
|
|
59
61
|
it('merges a list of overlapping squares into one outline', () => {
|
|
60
|
-
const result =
|
|
62
|
+
const result = createPath('nonZero');
|
|
63
|
+
unionAllPaths(result, kernel, [squarePath(0, 0, 10), squarePath(5, 5, 10), squarePath(8, 8, 10)]);
|
|
61
64
|
expect(ringCount(result)).toBe(1);
|
|
62
65
|
expect(pathArea(result)).toBeGreaterThan(100);
|
|
63
66
|
expect(pathArea(result)).toBeLessThan(300);
|
|
64
67
|
});
|
|
65
68
|
|
|
66
69
|
it('keeps disjoint squares as separate rings summing their areas', () => {
|
|
67
|
-
const result =
|
|
70
|
+
const result = createPath('nonZero');
|
|
71
|
+
unionAllPaths(result, kernel, [squarePath(0, 0, 10), squarePath(20, 20, 10), squarePath(40, 0, 10)]);
|
|
68
72
|
expect(ringCount(result)).toBe(3);
|
|
69
73
|
expect(pathArea(result)).toBeCloseTo(300, 6);
|
|
70
74
|
});
|
|
@@ -73,8 +77,10 @@ describe('unionAllPaths', () => {
|
|
|
73
77
|
const a = squarePath(0, 0, 10);
|
|
74
78
|
const b = squarePath(5, 5, 10);
|
|
75
79
|
const c = squarePath(2, 8, 10);
|
|
76
|
-
const forward =
|
|
77
|
-
const reversed =
|
|
80
|
+
const forward = createPath('nonZero');
|
|
81
|
+
const reversed = createPath('nonZero');
|
|
82
|
+
unionAllPaths(forward, kernel, [a, b, c]);
|
|
83
|
+
unionAllPaths(reversed, kernel, [c, b, a]);
|
|
78
84
|
expect(pathArea(forward)).toBeCloseTo(pathArea(reversed), 6);
|
|
79
85
|
expect(ringCount(forward)).toBe(ringCount(reversed));
|
|
80
86
|
});
|
|
@@ -82,9 +88,8 @@ describe('unionAllPaths', () => {
|
|
|
82
88
|
it('writes into a provided out path that aliases an input', () => {
|
|
83
89
|
const a = squarePath(0, 0, 10);
|
|
84
90
|
const b = squarePath(5, 5, 10);
|
|
85
|
-
|
|
86
|
-
expect(
|
|
87
|
-
expect(
|
|
88
|
-
expect(pathArea(result)).toBeCloseTo(175, 6);
|
|
91
|
+
unionAllPaths(a, kernel, [a, b]);
|
|
92
|
+
expect(ringCount(a)).toBe(1);
|
|
93
|
+
expect(pathArea(a)).toBeCloseTo(175, 6);
|
|
89
94
|
});
|
|
90
95
|
});
|
|
@@ -6,7 +6,7 @@ import { writePathBooleanContours } from './writePathBooleanContours.ts';
|
|
|
6
6
|
describe('writePathBooleanContours', () => {
|
|
7
7
|
it('rebuilds into a supplied path without allocation', () => {
|
|
8
8
|
const out = createPath('evenOdd');
|
|
9
|
-
|
|
9
|
+
writePathBooleanContours(out, [[0, 0, 1, 0, 0, 1]]);
|
|
10
10
|
expect(out.winding).toBe('nonZero');
|
|
11
11
|
expect(out.commands.length).toBe(4);
|
|
12
12
|
});
|