@weasel-js/geom 1.9.3 → 1.10.0
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/dist/3d/index.js +1 -1
- package/dist/booleans/index.d.ts +51 -29
- package/dist/booleans/index.js +562 -482
- package/dist/booleans/index.js.map +1 -1
- package/dist/{chunk-7ROQRYOA.js → chunk-755Y4YZS.js} +6 -3
- package/dist/chunk-755Y4YZS.js.map +1 -0
- package/dist/{chunk-6T5I3PR5.js → chunk-MDT7F32A.js} +16 -5
- package/dist/chunk-MDT7F32A.js.map +1 -0
- package/dist/{chunk-HEZTRG2M.js → chunk-OXH3NOXC.js} +10 -3
- package/dist/chunk-OXH3NOXC.js.map +1 -0
- package/dist/{chunk-RQYCDPU5.js → chunk-WQMYOCFB.js} +27 -18
- package/dist/chunk-WQMYOCFB.js.map +1 -0
- package/dist/{chunk-HPVINMOM.js → chunk-XS6ERH3X.js} +2 -2
- package/dist/chunk-XS6ERH3X.js.map +1 -0
- package/dist/cubicMath-CFXbq6vp.d.ts +116 -0
- package/dist/curves/index.d.ts +1 -1
- package/dist/curves/index.js +18 -71
- package/dist/curves/index.js.map +1 -1
- package/dist/index.d.ts +612 -116
- package/dist/index.js +904 -112
- package/dist/index.js.map +1 -1
- package/dist/{path-D0CoudGM.d.ts → path-Bf9KeVxC.d.ts} +10 -11
- package/dist/tessellate/index.d.ts +8 -12
- package/dist/tessellate/index.js +36 -10
- package/dist/tessellate/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-6T5I3PR5.js.map +0 -1
- package/dist/chunk-7ROQRYOA.js.map +0 -1
- package/dist/chunk-HEZTRG2M.js.map +0 -1
- package/dist/chunk-HPVINMOM.js.map +0 -1
- package/dist/chunk-RQYCDPU5.js.map +0 -1
- package/dist/cubicMath-CpCvuEl8.d.ts +0 -37
package/dist/3d/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PORT_REACH, portControls, portCurvePoints, cubicAt } from '../chunk-YQADYJJ7.js';
|
|
2
2
|
export { PORT_REACH } from '../chunk-YQADYJJ7.js';
|
|
3
|
-
import { SINGULAR_RATIO } from '../chunk-
|
|
3
|
+
import { SINGULAR_RATIO } from '../chunk-755Y4YZS.js';
|
|
4
4
|
|
|
5
5
|
// src/3d/vec3.ts
|
|
6
6
|
function add(a, b) {
|
package/dist/booleans/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as
|
|
2
|
-
import { P as Point } from '../cubicMath-
|
|
1
|
+
import { P as PolygonPath, a as Path } from '../path-Bf9KeVxC.js';
|
|
2
|
+
import { P as Point } from '../cubicMath-CFXbq6vp.js';
|
|
3
3
|
|
|
4
4
|
/** Union of N paths. Commutative. Returns an empty path if all inputs are empty. */
|
|
5
5
|
declare function pathUnion(...paths: Path[]): PolygonPath;
|
|
@@ -9,30 +9,55 @@ declare function pathIntersect(...paths: Path[]): PolygonPath;
|
|
|
9
9
|
declare function pathSubtract(a: Path, b: Path): PolygonPath;
|
|
10
10
|
/** Symmetric difference (XOR) of N paths. Commutative. */
|
|
11
11
|
declare function pathExclude(...paths: Path[]): PolygonPath;
|
|
12
|
+
/** One path of a result that keeps its pieces apart, and the inputs it came
|
|
13
|
+
* from: their indices in the call, ascending, so the last is the topmost of
|
|
14
|
+
* inputs given back to front. */
|
|
15
|
+
interface BooleanPiece {
|
|
16
|
+
path: PolygonPath;
|
|
17
|
+
sources: number[];
|
|
18
|
+
}
|
|
19
|
+
/** {@link pathDividePieces} as bare paths. */
|
|
20
|
+
declare function pathDivide(...paths: Path[]): PolygonPath[];
|
|
21
|
+
/** {@link pathCropPieces} as bare paths. */
|
|
22
|
+
declare function pathCrop(...paths: Path[]): PolygonPath[];
|
|
12
23
|
/**
|
|
13
24
|
* Fracture N paths along every intersection into the maximal set of
|
|
14
|
-
* non-overlapping regions. Returns one
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* `(∩ S) − (∪ complement)` — points covered by exactly the members of S
|
|
18
|
-
* and no others. By construction the emitted regions are pairwise disjoint
|
|
19
|
-
* and their union equals `pathUnion(A1..AN)`.
|
|
25
|
+
* non-overlapping regions. Returns one piece per region, naming every input
|
|
26
|
+
* that covers it. For N=2 these are the three Illustrator "Divide" outputs
|
|
27
|
+
* (A−B, B−A, A∩B).
|
|
20
28
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* subset count limits this to small N in practice; passing more than ~8
|
|
24
|
-
* inputs is a misuse — the polygon-clipping kernel dominates anyway.
|
|
29
|
+
* One region per non-empty subset of the inputs, so the 2^N − 1 subset count
|
|
30
|
+
* limits this to small N; passing more than ~8 inputs is a misuse.
|
|
25
31
|
*/
|
|
26
|
-
declare function
|
|
32
|
+
declare function pathDividePieces(...paths: Path[]): BooleanPiece[];
|
|
27
33
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* Empty results (a source that lies entirely outside the mask) are
|
|
33
|
-
* filtered. With `<2` inputs the result is empty.
|
|
34
|
+
* Remove from each path what the paths after it cover (Illustrator "Trim"):
|
|
35
|
+
* given back to front, every piece is the part of its input left showing.
|
|
36
|
+
* One piece per input in input order, less the inputs wholly hidden.
|
|
34
37
|
*/
|
|
35
|
-
declare function
|
|
38
|
+
declare function pathTrim(...paths: Path[]): BooleanPiece[];
|
|
39
|
+
/**
|
|
40
|
+
* {@link pathTrim}, then unite the pieces of the inputs `keyOf` gives the same
|
|
41
|
+
* key (Illustrator "Merge", keyed by paint). Keys compare with `===`. A piece
|
|
42
|
+
* names every input left showing in it, and the pieces are ordered by their
|
|
43
|
+
* topmost one. Pieces that share a key and do not touch come back as one path
|
|
44
|
+
* of several contours.
|
|
45
|
+
*/
|
|
46
|
+
declare function pathMerge(paths: readonly Path[], keyOf: (index: number) => unknown): BooleanPiece[];
|
|
47
|
+
/**
|
|
48
|
+
* Clip each non-topmost path to the topmost path (Illustrator "Crop"), which
|
|
49
|
+
* acts purely as the mask and is discarded. Returns up to `N - 1` pieces in
|
|
50
|
+
* input order, each naming the one input it was clipped from; a source
|
|
51
|
+
* entirely outside the mask is dropped.
|
|
52
|
+
*/
|
|
53
|
+
declare function pathCropPieces(...paths: Path[]): BooleanPiece[];
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Union the triangles of an indexed mesh (`vertices` as x, y pairs; `indices`
|
|
57
|
+
* three per triangle) into canonical, non-overlapping rings. Overlaps count
|
|
58
|
+
* once, and triangles with no area are skipped. The result holds only M/L/Z.
|
|
59
|
+
*/
|
|
60
|
+
declare function trianglesToPath(vertices: ArrayLike<number>, indices: ArrayLike<number>): PolygonPath;
|
|
36
61
|
|
|
37
62
|
/** A `[x, y]` 2-tuple. */
|
|
38
63
|
type Pair = [number, number];
|
|
@@ -67,16 +92,13 @@ interface SplitBySegmentOptions {
|
|
|
67
92
|
*/
|
|
68
93
|
declare function splitPathBySegment(path: Path, a: Point, b: Point, opts?: SplitBySegmentOptions): Path[] | null;
|
|
69
94
|
/**
|
|
70
|
-
* Split `path` along the open polyline `cut` into closed pieces (Knife).
|
|
71
|
-
* freehand cut is a polyline through its samples.
|
|
95
|
+
* Split `path` along the open polyline `cut` into closed pieces (Knife).
|
|
72
96
|
*
|
|
73
97
|
* Only chords the cut crosses end to end are cut: a stretch of the cut that
|
|
74
98
|
* starts or stops inside the fill cuts nothing, and nothing beyond the cut's
|
|
75
|
-
* ends is touched
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* its quadratic and cubic segments; the new edges follow the cut as straight
|
|
79
|
-
* lines, bends included.
|
|
99
|
+
* ends is touched. Curves are split at the crossing parameters by de Casteljau
|
|
100
|
+
* subdivision, so every piece keeps its quadratic and cubic segments; the new
|
|
101
|
+
* edges follow the cut as straight lines, bends included.
|
|
80
102
|
*
|
|
81
103
|
* A loop the cut draws inside the fill, where it crosses its own track, cuts
|
|
82
104
|
* out the region it encloses: that region is returned as its own piece, with
|
|
@@ -84,7 +106,7 @@ declare function splitPathBySegment(path: Path, a: Point, b: Point, opts?: Split
|
|
|
84
106
|
* running through a loop leaves the loop uncut. A closed cut (its last point
|
|
85
107
|
* equal to its first) is one such loop or, where it crosses the boundary, is
|
|
86
108
|
* cut as the chords it makes. Chords that cross each other are cut one after
|
|
87
|
-
* another
|
|
109
|
+
* another.
|
|
88
110
|
*
|
|
89
111
|
* Each connected piece the cut produces is returned as its own path, holes
|
|
90
112
|
* included. Contours the cut misses entirely are returned together as one
|
|
@@ -115,4 +137,4 @@ declare function splitPathByPolyline(path: Path, cut: readonly Point[], opts?: S
|
|
|
115
137
|
*/
|
|
116
138
|
declare function snipPathByPolyline(path: Path, cut: readonly Point[]): Path[] | null;
|
|
117
139
|
|
|
118
|
-
export { type MultiPolygon, type Pair, type PathToMultiPolygonOptions, type Polygon, type Ring, type SplitBySegmentOptions, multiPolygonToPath, pathCrop, pathDivide, pathExclude, pathIntersect, pathSubtract, pathToMultiPolygon, pathUnion, snipPathByPolyline, splitPathByPolyline, splitPathBySegment };
|
|
140
|
+
export { type BooleanPiece, type MultiPolygon, type Pair, type PathToMultiPolygonOptions, type Polygon, type Ring, type SplitBySegmentOptions, multiPolygonToPath, pathCrop, pathCropPieces, pathDivide, pathDividePieces, pathExclude, pathIntersect, pathMerge, pathSubtract, pathToMultiPolygon, pathTrim, pathUnion, snipPathByPolyline, splitPathByPolyline, splitPathBySegment, trianglesToPath };
|