@weasel-js/geom 1.15.1 → 1.16.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.d.ts +16 -2
- package/dist/3d/index.js +17 -10
- package/dist/3d/index.js.map +1 -1
- package/dist/booleans/index.js +5 -5
- package/dist/{chunk-B3D6KWW3.js → chunk-346XYYMX.js} +154 -3
- package/dist/chunk-346XYYMX.js.map +1 -0
- package/dist/{chunk-FROQPADA.js → chunk-5W425HJA.js} +82 -16
- package/dist/chunk-5W425HJA.js.map +1 -0
- package/dist/chunk-DNX24KBT.js +82 -0
- package/dist/chunk-DNX24KBT.js.map +1 -0
- package/dist/chunk-FOXMA54X.js +266 -0
- package/dist/chunk-FOXMA54X.js.map +1 -0
- package/dist/{chunk-3HQJGI63.js → chunk-HTT5AQIU.js} +3 -4
- package/dist/chunk-HTT5AQIU.js.map +1 -0
- package/dist/chunk-IOD2NFHQ.js +212 -0
- package/dist/chunk-IOD2NFHQ.js.map +1 -0
- package/dist/{chunk-HNLJO3E7.js → chunk-MOCSUHEI.js} +22 -8
- package/dist/chunk-MOCSUHEI.js.map +1 -0
- package/dist/{chunk-3YH5XU3H.js → chunk-OBPXEPUH.js} +14 -23
- package/dist/chunk-OBPXEPUH.js.map +1 -0
- package/dist/chunk-QSVZO7QZ.js +40 -0
- package/dist/chunk-QSVZO7QZ.js.map +1 -0
- package/dist/{chunk-EURWZUNY.js → chunk-TBS4NHGQ.js} +70 -93
- package/dist/chunk-TBS4NHGQ.js.map +1 -0
- package/dist/{chunk-HMGGJZTM.js → chunk-VJG5ZWCR.js} +7 -21
- package/dist/chunk-VJG5ZWCR.js.map +1 -0
- package/dist/{chunk-ZOMUTU7J.js → chunk-ZV24QZ6X.js} +5 -11
- package/dist/chunk-ZV24QZ6X.js.map +1 -0
- package/dist/{curvature-CDOI32hv.d.ts → curvature-DKPO4Qeh.d.ts} +0 -27
- package/dist/curves/index.d.ts +1 -1
- package/dist/curves/index.js +4 -4
- package/dist/index.d.ts +193 -13
- package/dist/index.js +409 -273
- package/dist/index.js.map +1 -1
- package/dist/lengthTable-Cv3W6lsH.d.ts +64 -0
- package/dist/nd/index.d.ts +28 -1
- package/dist/nd/index.js +2 -5
- package/dist/nd/index.js.map +1 -1
- package/dist/tessellate/index.d.ts +23 -1
- package/dist/tessellate/index.js +31 -17
- package/dist/tessellate/index.js.map +1 -1
- package/dist/warp/index.js +9 -15
- package/dist/warp/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-2N6OWA7E.js +0 -104
- package/dist/chunk-2N6OWA7E.js.map +0 -1
- package/dist/chunk-3HQJGI63.js.map +0 -1
- package/dist/chunk-3YH5XU3H.js.map +0 -1
- package/dist/chunk-755Y4YZS.js +0 -32
- package/dist/chunk-755Y4YZS.js.map +0 -1
- package/dist/chunk-B3D6KWW3.js.map +0 -1
- package/dist/chunk-EURWZUNY.js.map +0 -1
- package/dist/chunk-FROQPADA.js.map +0 -1
- package/dist/chunk-HMGGJZTM.js.map +0 -1
- package/dist/chunk-HNLJO3E7.js.map +0 -1
- package/dist/chunk-ZOMUTU7J.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
|
-
import { A as Affine, a as AnchorSet, P as PenAnchor, b as SpiroPoint, S as SpiroKind, c as Scale2 } from './curvature-
|
|
2
|
-
export { d as AnchorRect, e as CombTooth, f as CurvatureCombOptions, C as CurvatureSource, E as EulerFit, g as EulerSegment, h as SPIRO_KINDS, i as SegmentComb, j as SegmentHit, k as SpiroSegment, l as anchorAt, m as anchorCount, n as anchorsInRect, o as anchorsToPath, p as applyToPoint, q as boxToBox, r as combTeeth, s as countPathAnchors, t as cubicCurvatureAt, u as cubicCurvatureSource, v as cubicDerivativeAt, w as curvatureComb, x as deleteAnchorsAt, y as editAnchorSet, z as eulerAngleAt, B as eulerCurvatureAt, D as eulerCurvatureDerivativesAt, F as eulerPointAt, G as fitEulerSegment, H as flatAnchorIndex, I as identity, J as insertAnchorOnSegment, K as invert, L as isAnchorSmooth, M as isSpiroKind, N as isStraightSegment, O as locateAnchor, Q as moveHandleTo, R as multiply, T as nearestSegmentT, U as openSubpathAt, V as pathToAnchors, W as placeEulerSegment, X as pxExtent, Y as pxExtentInFrame, Z as rotate, _ as rotateAboutPoint, $ as scale, a0 as scaleDelta, a1 as screenAngleOf, a2 as segmentAt, a3 as segmentEnds, a4 as solveSpiro, a5 as standoff, a6 as transformCoords, a7 as translate, a8 as translateAnchorBy, a9 as withinPxBox, aa as withinPxRadius } from './curvature-
|
|
1
|
+
import { A as Affine, a as AnchorSet, P as PenAnchor, b as SpiroPoint, S as SpiroKind, c as Scale2 } from './curvature-DKPO4Qeh.js';
|
|
2
|
+
export { d as AnchorRect, e as CombTooth, f as CurvatureCombOptions, C as CurvatureSource, E as EulerFit, g as EulerSegment, h as SPIRO_KINDS, i as SegmentComb, j as SegmentHit, k as SpiroSegment, l as anchorAt, m as anchorCount, n as anchorsInRect, o as anchorsToPath, p as applyToPoint, q as boxToBox, r as combTeeth, s as countPathAnchors, t as cubicCurvatureAt, u as cubicCurvatureSource, v as cubicDerivativeAt, w as curvatureComb, x as deleteAnchorsAt, y as editAnchorSet, z as eulerAngleAt, B as eulerCurvatureAt, D as eulerCurvatureDerivativesAt, F as eulerPointAt, G as fitEulerSegment, H as flatAnchorIndex, I as identity, J as insertAnchorOnSegment, K as invert, L as isAnchorSmooth, M as isSpiroKind, N as isStraightSegment, O as locateAnchor, Q as moveHandleTo, R as multiply, T as nearestSegmentT, U as openSubpathAt, V as pathToAnchors, W as placeEulerSegment, X as pxExtent, Y as pxExtentInFrame, Z as rotate, _ as rotateAboutPoint, $ as scale, a0 as scaleDelta, a1 as screenAngleOf, a2 as segmentAt, a3 as segmentEnds, a4 as solveSpiro, a5 as standoff, a6 as transformCoords, a7 as translate, a8 as translateAnchorBy, a9 as withinPxBox, aa as withinPxRadius } from './curvature-DKPO4Qeh.js';
|
|
3
3
|
import { b as Point, a as Path, c as PathOpenFill, P as PolygonPath, d as PathFillRule, R as RectPath, C as CornerSpec, e as CornerPiece } from './path-t80OoJnM.js';
|
|
4
4
|
export { f as CORNER_FIT_TOLERANCE, g as CORNER_KEYWORDS, h as CornerKeyword, i as CornerShape, j as CornerShapeFrame, k as compactCorners, l as cornerAt, m as cornerCenter, n as cornerKeywordOf, o as cornerShapeK, p as cornerShapePieces, q as cornerShapePoint, r as cornerSpecAt, s as cubicPointAt, t as hasCorners, u as isCornerShape, v as lerpCorners, w as nextCornerShape, x as scaleCorners, y as splitCubicAtT, z as withCorner, A as withoutCorners } from './path-t80OoJnM.js';
|
|
5
|
+
import { L as LengthTable, a as LengthSpan } from './lengthTable-Cv3W6lsH.js';
|
|
6
|
+
export { b as LengthRun, c as anchorAtLength, d as closingAnchor, l as lengthAtAnchor, e as lengthAtSegmentFraction, f as lengthAtSubpath, g as lengthTable } from './lengthTable-Cv3W6lsH.js';
|
|
5
7
|
export { P as PORT_REACH } from './portCurve-C5HDWuuV.js';
|
|
6
8
|
|
|
9
|
+
/** Measuring one Bézier segment by arc length, and finding where a run of it ends. */
|
|
10
|
+
/**
|
|
11
|
+
* Length of a Bézier segment between parameters `a` and `b`, by Gauss–Legendre
|
|
12
|
+
* over eight panels, split where a component of its derivative is zero and
|
|
13
|
+
* the speed dips there within a panel's width. The panels beside such a root
|
|
14
|
+
* are halved until they settle, and so is any other where the eight- and
|
|
15
|
+
* four-point rules disagree. `coords` holds its control
|
|
16
|
+
* points flat, `dim` components each: two points for a line, three for a
|
|
17
|
+
* quadratic, four for a cubic. NaN when a coordinate is not finite.
|
|
18
|
+
*/
|
|
19
|
+
declare function segmentLength(coords: ArrayLike<number>, dim: 2 | 3, a?: number, b?: number): number;
|
|
20
|
+
/**
|
|
21
|
+
* The parameter at which the segment {@link segmentLength} reads has run
|
|
22
|
+
* `length` from its start, clamped to 0..1: Newton steps on the arc length,
|
|
23
|
+
* held inside a shrinking bracket. `total` is its whole length, when the
|
|
24
|
+
* caller has it; it is trusted, not checked, and a wrong one misplaces the
|
|
25
|
+
* clamp and the first guess. 0 when a coordinate is not finite, as for a
|
|
26
|
+
* segment of no length.
|
|
27
|
+
*/
|
|
28
|
+
declare function segmentTAtLength(coords: ArrayLike<number>, dim: 2 | 3, length: number, total?: number): number;
|
|
29
|
+
|
|
7
30
|
/**
|
|
8
31
|
* Scalar / 2-vector primitives and the kernel-wide epsilon policy.
|
|
9
32
|
*
|
|
@@ -15,6 +38,10 @@ export { P as PORT_REACH } from './portCurve-C5HDWuuV.js';
|
|
|
15
38
|
declare const EPS = 0.000001;
|
|
16
39
|
/** `v` held to `lo`..`hi`. `lo` wins when the bounds cross; `NaN` passes through. */
|
|
17
40
|
declare function clamp(v: number, lo: number, hi: number): number;
|
|
41
|
+
/** `v` held to `0`..`1`; `NaN` passes through. */
|
|
42
|
+
declare function clamp01(v: number): number;
|
|
43
|
+
/** The number `t` of the way from `a` to `b`; `t` outside [0, 1] extrapolates. */
|
|
44
|
+
declare function lerp(a: number, b: number, t: number): number;
|
|
18
45
|
/** 2D cross (wedge) product of vectors (ax,ay) and (bx,by). */
|
|
19
46
|
declare function cross(ax: number, ay: number, bx: number, by: number): number;
|
|
20
47
|
/** 2D dot product. */
|
|
@@ -38,6 +65,30 @@ declare function sign(n: number): -1 | 0 | 1;
|
|
|
38
65
|
*/
|
|
39
66
|
declare function approxEq(a: number, b: number, eps?: number): boolean;
|
|
40
67
|
|
|
68
|
+
/** Angle units and wrapping: one definition of each, so callers agree on where a half turn lands. */
|
|
69
|
+
/** Multiply degrees by this to get radians. */
|
|
70
|
+
declare const DEG_TO_RAD: number;
|
|
71
|
+
/** Multiply radians by this to get degrees. */
|
|
72
|
+
declare const RAD_TO_DEG: number;
|
|
73
|
+
/**
|
|
74
|
+
* Where {@link wrapAngle} puts a half turn, the one angle with two names:
|
|
75
|
+
* `'max'` at `π`, `'min'` at `-π`, and `'sign'` at whichever of the two has
|
|
76
|
+
* the input's sign, so `-3π` stays a turn the negative way.
|
|
77
|
+
*/
|
|
78
|
+
type HalfTurn = 'max' | 'min' | 'sign';
|
|
79
|
+
/**
|
|
80
|
+
* `a` radians as the turn of at most half a circle that reaches it, in
|
|
81
|
+
* `(-π, π]` by default. `half` picks the closed end (see {@link HalfTurn}).
|
|
82
|
+
* `NaN` and infinities give `NaN`.
|
|
83
|
+
*/
|
|
84
|
+
declare function wrapAngle(a: number, half?: HalfTurn): number;
|
|
85
|
+
/**
|
|
86
|
+
* `a` in `[0, period)`: radians by default, `wrapPositive(deg, 360)` for
|
|
87
|
+
* degrees. Never returns `period` itself, however close to zero a negative
|
|
88
|
+
* `a` is. `NaN` and infinities give `NaN`.
|
|
89
|
+
*/
|
|
90
|
+
declare function wrapPositive(a: number, period?: number): number;
|
|
91
|
+
|
|
41
92
|
/**
|
|
42
93
|
* Viewport state. `(view.x, view.y)` is the world point currently rendered at
|
|
43
94
|
* the canvas top-left; `view.scale.x` / `view.scale.y` is pixels per world
|
|
@@ -69,6 +120,38 @@ declare const ZOOM_FLOOR = 1e-9;
|
|
|
69
120
|
* floor.
|
|
70
121
|
*/
|
|
71
122
|
declare function normalizeZoom(zoom: number): number;
|
|
123
|
+
/** The screen pixel `view` draws world point `p` at, from the canvas top-left. */
|
|
124
|
+
declare function viewWorldToScreen(view: View, p: {
|
|
125
|
+
x: number;
|
|
126
|
+
y: number;
|
|
127
|
+
}): {
|
|
128
|
+
x: number;
|
|
129
|
+
y: number;
|
|
130
|
+
};
|
|
131
|
+
/** The world point under screen pixel `p`; the inverse of {@link viewWorldToScreen}. */
|
|
132
|
+
declare function viewScreenToWorld(view: View, p: {
|
|
133
|
+
x: number;
|
|
134
|
+
y: number;
|
|
135
|
+
}): {
|
|
136
|
+
x: number;
|
|
137
|
+
y: number;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* World rect `r` in screen pixels through `view`. A flipped axis (negative
|
|
141
|
+
* scale) still gives a positive width and height, with `x` / `y` at the
|
|
142
|
+
* rect's top-left on screen.
|
|
143
|
+
*/
|
|
144
|
+
declare function viewRectToScreen(view: View, r: {
|
|
145
|
+
x: number;
|
|
146
|
+
y: number;
|
|
147
|
+
width: number;
|
|
148
|
+
height: number;
|
|
149
|
+
}): {
|
|
150
|
+
x: number;
|
|
151
|
+
y: number;
|
|
152
|
+
width: number;
|
|
153
|
+
height: number;
|
|
154
|
+
};
|
|
72
155
|
|
|
73
156
|
/** Axis-aligned box as [minX, minY, maxX, maxY]. */
|
|
74
157
|
type Box = readonly [number, number, number, number];
|
|
@@ -94,6 +177,23 @@ declare function boxContainsBox(outer: Box, inner: Box): boolean;
|
|
|
94
177
|
* `pointInPolygon` takes, and what a repeated first vertex would leave as a
|
|
95
178
|
* zero-length segment for anything that strokes it. */
|
|
96
179
|
declare function rectToContour(x: number, y: number, w: number, h: number): Float64Array;
|
|
180
|
+
/** Whether `a` and `b` meet, edges inclusive: boxes touching along an edge or
|
|
181
|
+
* at a corner answer true. */
|
|
182
|
+
declare function boxesIntersect(a: Box, b: Box): boolean;
|
|
183
|
+
/** Whether `a` and `b` share interior: rects that only touch along an edge or
|
|
184
|
+
* at a corner answer false. */
|
|
185
|
+
declare function rectsOverlap(a: Readonly<Rect>, b: Readonly<Rect>): boolean;
|
|
186
|
+
/** Whether `a` and `b` meet, edges inclusive: rects touching along an edge or
|
|
187
|
+
* at a corner answer true. {@link rectsOverlap} is the interior-only test. */
|
|
188
|
+
declare function rectsIntersect(a: Readonly<Rect>, b: Readonly<Rect>): boolean;
|
|
189
|
+
/** Inclusive point-in-rect test: a point on any edge is inside. */
|
|
190
|
+
declare function rectContainsPoint(r: Readonly<Rect>, x: number, y: number): boolean;
|
|
191
|
+
/** Half-open point-in-rect test: the left and top edges are inside, the right
|
|
192
|
+
* and bottom ones outside, so rects that tile a plane never both claim a point. */
|
|
193
|
+
declare function rectContainsPointHalfOpen(r: Readonly<Rect>, x: number, y: number): boolean;
|
|
194
|
+
/** Smallest rect containing every one of `rects`, or null for none. A `NaN`
|
|
195
|
+
* coordinate makes the matching edge of the result `NaN`. */
|
|
196
|
+
declare function unionRects(rects: Iterable<Readonly<Rect>>): Rect | null;
|
|
97
197
|
|
|
98
198
|
/**
|
|
99
199
|
* SVG-style command-stream encoding — the kit's single declaration of the path
|
|
@@ -231,13 +331,6 @@ declare function nearestOnQuadratic(px: number, py: number, x0: number, y0: numb
|
|
|
231
331
|
*/
|
|
232
332
|
declare function nearestOnPath(commands: ArrayLike<number>, coords: ArrayLike<number>, px: number, py: number): PathNearest | null;
|
|
233
333
|
|
|
234
|
-
/**
|
|
235
|
-
* A path measured once by arc length, so many stations along it cost a binary
|
|
236
|
-
* search each rather than a fresh flatten: what `pointAlongPath` answers one
|
|
237
|
-
* fraction at a time, and what anything placing or bending geometry along a
|
|
238
|
-
* path reads many times over.
|
|
239
|
-
*/
|
|
240
|
-
|
|
241
334
|
/** A point on a path and its heading there. */
|
|
242
335
|
interface PathStation {
|
|
243
336
|
point: Point;
|
|
@@ -246,7 +339,8 @@ interface PathStation {
|
|
|
246
339
|
}
|
|
247
340
|
/** Options for {@link measurePath}. */
|
|
248
341
|
interface MeasurePathOptions {
|
|
249
|
-
/** Curve flattening tolerance, in world units
|
|
342
|
+
/** Curve flattening tolerance, in world units, for the headings `at` and the search `nearest` read; lengths
|
|
343
|
+
* and points are exact whatever it is. Default 0.5. */
|
|
250
344
|
flattenTolerance?: number;
|
|
251
345
|
/** Keep a vertex that turns further than flattening at the tolerance could as a corner: `at`'s `smooth` heading then
|
|
252
346
|
* blends only across the vertices flattening made, and a straight edge heads along itself. Default false. */
|
|
@@ -269,7 +363,7 @@ interface PathMeasure {
|
|
|
269
363
|
/**
|
|
270
364
|
* The station `s` along the path, `s` clamped to `0..length`.
|
|
271
365
|
*
|
|
272
|
-
* The tangent is the heading of the flattened segment under `s`. With
|
|
366
|
+
* The point is exact. The tangent is the heading of the flattened segment under `s`. With
|
|
273
367
|
* `smooth`, it is instead blended across each segment from the heading at
|
|
274
368
|
* one vertex to the next, so geometry bent along it turns without facets.
|
|
275
369
|
*/
|
|
@@ -527,6 +621,7 @@ declare function portCurvePoints(ax: number, ay: number, bx: number, by: number,
|
|
|
527
621
|
* rendering at 1× zoom; consumers that zoom in heavily should pass a
|
|
528
622
|
* tighter tolerance.
|
|
529
623
|
*/
|
|
624
|
+
/** The tolerance, in world units, the flatteners use when none is given. */
|
|
530
625
|
declare const DEFAULT_FLATTEN_TOLERANCE = 0.5;
|
|
531
626
|
/**
|
|
532
627
|
* Recursively subdivide a cubic bezier (P0..P3) and append `lineTo`-style
|
|
@@ -558,6 +653,13 @@ declare function flattenQuadraticWithArcLen(x0: number, y0: number, x1: number,
|
|
|
558
653
|
* inside a buffer holding several.
|
|
559
654
|
*/
|
|
560
655
|
declare function pointInPolygon(coords: ArrayLike<number>, px: number, py: number, start?: number, end?: number): boolean;
|
|
656
|
+
/**
|
|
657
|
+
* Signed shoelace area of an interleaved, unclosed ring, its closing edge
|
|
658
|
+
* implicit as in {@link pointInPolygon}: positive when the ring runs
|
|
659
|
+
* counterclockwise with y up, so clockwise on a y-down screen. `start`/`end`
|
|
660
|
+
* are vertex indices bounding one ring in a buffer holding several.
|
|
661
|
+
*/
|
|
662
|
+
declare function ringSignedArea(coords: ArrayLike<number>, start?: number, end?: number): number;
|
|
561
663
|
/**
|
|
562
664
|
* True if segments (ax,ay)-(bx,by) and (cx,cy)-(dx,dy) intersect at a single
|
|
563
665
|
* point. An endpoint landing on the other segment counts (a T-junction and a
|
|
@@ -566,8 +668,77 @@ declare function pointInPolygon(coords: ArrayLike<number>, px: number, py: numbe
|
|
|
566
668
|
* point, so the sign test both segments rely on is zero on all four sides.
|
|
567
669
|
*/
|
|
568
670
|
declare function segmentsCross(ax: number, ay: number, bx: number, by: number, cx: number, cy: number, dx: number, dy: number): boolean;
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* The rules of `./points` in the 2D kernel's currency. The segment functions
|
|
674
|
+
* take loose scalars and allocate nothing, since hit tests call them per
|
|
675
|
+
* pointermove and per vertex; the point functions take `Point`. Each goes
|
|
676
|
+
* through the same scalar steps as its `./nd` counterpart, so the two agree
|
|
677
|
+
* to the bit.
|
|
678
|
+
*/
|
|
679
|
+
|
|
680
|
+
/** Squared distance between two points. */
|
|
681
|
+
declare function distance2(a: Point, b: Point): number;
|
|
682
|
+
/** Euclidean distance between two points. */
|
|
683
|
+
declare function distance(a: Point, b: Point): number;
|
|
684
|
+
/** The point `t` of the way from `a` to `b`; `t` outside [0, 1] extrapolates. */
|
|
685
|
+
declare function lerpPoint(a: Point, b: Point, t: number): Point;
|
|
686
|
+
/** The parameter, 0 to 1, of the point of segment (ax,ay)-(bx,by) nearest
|
|
687
|
+
* (px,py). A zero-length segment answers 0. */
|
|
688
|
+
declare function segmentT(px: number, py: number, ax: number, ay: number, bx: number, by: number): number;
|
|
569
689
|
/** Squared distance from (px,py) to segment (ax,ay)-(bx,by), endpoint-clamped. */
|
|
570
690
|
declare function pointSegmentDist2(px: number, py: number, ax: number, ay: number, bx: number, by: number): number;
|
|
691
|
+
/** Distance from (px,py) to segment (ax,ay)-(bx,by), endpoint-clamped. */
|
|
692
|
+
declare function pointSegmentDist(px: number, py: number, ax: number, ay: number, bx: number, by: number): number;
|
|
693
|
+
|
|
694
|
+
type Comps = [number, number, number];
|
|
695
|
+
/**
|
|
696
|
+
* The point at pen-order length `s`, and the unit tangent of the segment
|
|
697
|
+
* arriving there (leaving, at a run's start); on a curve, the exact point and
|
|
698
|
+
* the curve's own direction. Components past the table's
|
|
699
|
+
* `dim` read 0. Clamps to the path; where two runs meet, answers the end of the
|
|
700
|
+
* earlier one. A path with no length answers a zero tangent.
|
|
701
|
+
*/
|
|
702
|
+
declare function pointAtLength(t: LengthTable, s: number): {
|
|
703
|
+
point: Comps;
|
|
704
|
+
tangent: Comps;
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* A place on a path that no flattening moves: curve parameter `t` of segment
|
|
709
|
+
* `segment` of run `run`, segments counted from each run's first point, a
|
|
710
|
+
* closed run's closing edge last. Every flattening of the path cuts at the same
|
|
711
|
+
* point for it, whatever its tolerance.
|
|
712
|
+
*/
|
|
713
|
+
interface CurvePosition {
|
|
714
|
+
run: number;
|
|
715
|
+
segment: number;
|
|
716
|
+
t: number;
|
|
717
|
+
}
|
|
718
|
+
/** A stretch of a path between two curve positions, `from` before `to` in pen order. */
|
|
719
|
+
interface CurveSpan {
|
|
720
|
+
from: CurvePosition;
|
|
721
|
+
to: CurvePosition;
|
|
722
|
+
}
|
|
723
|
+
/** How many segments run `r` of `t` has: its closing edge included when closed. */
|
|
724
|
+
declare function runSegments(t: LengthTable, r: number): number;
|
|
725
|
+
/**
|
|
726
|
+
* `span`, pen-order lengths along `t`, as curve positions: where a length falls
|
|
727
|
+
* on a run boundary, `from` starts the later run and `to` ends the earlier one,
|
|
728
|
+
* so neither carries a run of no length. Null when the span is empty.
|
|
729
|
+
*/
|
|
730
|
+
declare function curveSpan(t: LengthTable, span: LengthSpan): CurveSpan | null;
|
|
731
|
+
/** The pen-order length at curve position `at`: the inverse of {@link curveSpan}. */
|
|
732
|
+
declare function lengthAtCurve(t: LengthTable, at: CurvePosition): number;
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* The exact length table of `path` as a stroke draws it: corners resolved,
|
|
736
|
+
* each curve measured by its arc length rather than by any flattening of it,
|
|
737
|
+
* anchors in authored numbering. Its runs are `extractPolylines`' subpaths,
|
|
738
|
+
* one point per anchor, with each curve's control points, so a curve position
|
|
739
|
+
* on it names the same place on every flattening of the path. Kept per path.
|
|
740
|
+
*/
|
|
741
|
+
declare function pathLengthTable(path: Path): LengthTable;
|
|
571
742
|
|
|
572
743
|
/** Set whether a fill closes an open subpath, for every path that names no
|
|
573
744
|
* `openFill` of its own. Starts at `'close'`. */
|
|
@@ -1942,6 +2113,10 @@ interface StrokeHitTestOptions {
|
|
|
1942
2113
|
px: number;
|
|
1943
2114
|
transform: Affine;
|
|
1944
2115
|
};
|
|
2116
|
+
/** Only the stretch of the outline between these curve positions counts,
|
|
2117
|
+
* as `pathLengthTable` numbers them: a visible window of a trimmed stroke,
|
|
2118
|
+
* cut at the same points whatever `tolerance` flattens the outline at. */
|
|
2119
|
+
span?: CurveSpan;
|
|
1945
2120
|
}
|
|
1946
2121
|
/** Filled-region hit-test for a path. Rect short-circuits to AABB; polygons run ray-cast / winding per `fillRule`. */
|
|
1947
2122
|
declare function pointInPath(path: Path, x: number, y: number, opts?: PointInPathOptions): boolean;
|
|
@@ -2379,7 +2554,12 @@ declare function boxFrameOf(pose: unknown): Affine | null;
|
|
|
2379
2554
|
* the `transform` is singular and nothing maps back.
|
|
2380
2555
|
*/
|
|
2381
2556
|
declare function poseFrameInverseOf(pose: unknown): Affine | null;
|
|
2382
|
-
/**
|
|
2557
|
+
/**
|
|
2558
|
+
* `path`, given in the pose's unrotated box frame, as the node draws it. The
|
|
2559
|
+
* renderer rounds `corners` in the box frame and then frames the result, so a
|
|
2560
|
+
* stretch or skew rounds them first here too; a uniform frame keeps them as
|
|
2561
|
+
* corners, which it maps exactly.
|
|
2562
|
+
*/
|
|
2383
2563
|
declare function pathThroughPoseFrame(path: Path, pose: unknown): Path;
|
|
2384
2564
|
|
|
2385
2565
|
/**
|
|
@@ -3275,4 +3455,4 @@ declare function reviveTypedArrays(value: unknown): unknown;
|
|
|
3275
3455
|
/** `tagTypedArrays` as a `JSON.stringify` replacer. */
|
|
3276
3456
|
declare function typedArrayReplacer(_key: string, value: unknown): unknown;
|
|
3277
3457
|
|
|
3278
|
-
export { ANCHOR_FIELDS, Affine, type AnchorField, type AnchorFieldValues, type AnchorPair, type AnchorPathMeasure, AnchorSet, type AnchorSubpathMeasure, type AnchorSymmetry, type ArcTrackShape, type ArcTrackSpec, type AverageAxis, type BendAlongPathOptions, type BendGrip, type BezierEasing, type BlendPathsOptions, type Box, CONSTRAINT_TOLERANCE, CORNER_RESTORE_TOLERANCE, type ConflictingConstraintsOptions, type ConstrainPathEditOptions, type ConstrainedPathEdit, type ConstrainedPathsEdit, type ConstraintPoint, type CornerCut, type CornerFrame, CornerPiece, CornerSpec, type CornerTrace, type CubicContour, type CubicCoords, type CubicSegment, type CurveNearest, DEFAULT_FLATTEN_TOLERANCE, type DirectionMark, EASINGS, EPS, type EaseOptions, type EasingFn, type EasingName, type EasingSpec, type EllipseTrackShape, type EllipseTrackSpec, type ExtendToMeetOptions, type ExtensionPiece, type ExtremaAxes, type FramedBox, type GlMat3, type GrowRegionOptions, type HandleBalance, type HandleRef, type JoinOptions, type LengthenMode, type LineCoords, type MeasureAnchorPathOptions, type MeasurePathOptions, type MergeRegionOptions, type NumberEntry, type NumberTypedArray, ORIGIN_THRESHOLD, type OpenPathEnd, PATH_C, PATH_CMD_LENGTHS, PATH_COMMANDS, PATH_L, PATH_M, PATH_Q, PATH_SNAP_KINDS, PATH_Z, Path, type PathAnchorHit, type PathAwayFromAnchors, type PathBlend, PathBuilder, type PathCommandCode, type PathCommandName, type PathConstraint, type PathConstraintKind, type PathCrossing, type PathEndFrame, PathFillRule, type PathInWorldPose, type PathLink, type PathMeasure, type PathNearest, type PathNearestStation, PathOpenFill, type PathSegment, type PathSnapHit, type PathSnapIndex, type PathSnapKind, type PathSnapQuery, type PathSnapTarget, type PathStation, type PathStop, type PathTrackShape, type PathsEditItem, PenAnchor, type PlaceAlongRunOptions, type PlaceRectOptions, type PlacedRect, type Placement, type PlacementAlign, type PlacementSide, Point, type PointAlongPathOptions, type PointInPathOptions, type PointOrigin, type PolygonIntersectsPathOptions, PolygonPath, type PoseLinear, type PoseRotation, type PuckerBloatPathOptions, type QuadraticCoords, type Rect, RectPath, type RepeatAlongPathOptions, type RepeatStation, type ResamplePathOptions, type ResolvedCorners, type RoughenPathOptions, type RunAlign, type RunOrder, type RunPast, type RunPlace, type RunSpot, SPRING_PRESETS, Scale2, type SegmentCrossing, type SegmentMeasure, type SegmentRef, type SegmentType, type SimplifyPathOptions, type SmudgePathOptions, type SoftFalloff, type SolveConstraintsOptions, type SolveConstraintsResult, type SolvePathConstraintsResult, type SpiroContour, SpiroKind, type SpiroPath, SpiroPoint, type SpiroToPathOptions, type SpringPreset, type SpringPresetName, type StaticPathSnapKind, type StrokeHitTestOptions, type SubpathEnd, TYPED_ARRAY_CONSTRUCTORS, type TaggedTypedArray, type TrackAtOptions, type TrackNearest, type TrackNearestOptions, type TrackPlace, type TrackRun, type TrackRunOptions, type TrackShape, type TrackShapeKind, type TrackSide, type TrackStation, type TransformPathOptions, type TrimPathOptions, type TrimResult, type TypedArrayTag, type UnsatisfiedConstraintsOptions, type View, ZOOM_FLOOR, type ZigzagPathOptions, addExtremaAnchors, addOrigin, anchorOriginsOf, anchorSymmetries, anchorSymmetry, anchorsBefore, anchorsUnderBrush, anchorsWhere, approxEq, arcShape, asPolygonPath, averageAnchorsAt, balanceFactorToward, bendAlongPath, bendSegment, bendSide, blendPaths, boundsOfCoords, boundsOfPath, boxContainsBox, boxContainsPoint, boxFrameOf, circlePath, clamp, clampRectWithin, closestOpenEnds, composePath, conflictingConstraints, constrainPathEdit, constrainPathsEdit, constraintAnchors, constraintApplies, constraintFits, convertSegments, coordsFrom, cornerAnchors, cornerCuts, cornerFrameAt, cornerFrames, cornerTraces, createPathSnapIndex, cross, cubicAxisExtremaTs, cubicBezierEasing, cubicBounds, cubicContoursToPath, cubicEvalAt, decomposePath, defaultOpenFill, directionMarks, dot, easeIn, easeInBack, easeInBounce, easeInCirc, easeInCubic, easeInElastic, easeInExpo, easeInOut, easeInOutBack, easeInOutBounce, easeInOutCirc, easeInOutCubic, easeInOutElastic, easeInOutExpo, easeInOutQuad, easeInOutQuart, easeInOutQuint, easeInOutSine, easeInQuad, easeInQuart, easeInQuint, easeInSine, easeLength, easeOut, easeOutBack, easeOutBounce, easeOutCirc, easeOutCubic, easeOutElastic, easeOutExpo, easeOutQuad, easeOutQuart, easeOutQuint, easeOutSine, editAnchorSetTracked, elevateQuadraticToCubic, ellipsePath, ellipseShape, equalizeSegmentHandles, everyNthAnchor, extendToMeet, extensionPieces, fillsOpenSubpaths, findPathSnap, findPathSnaps, fitAffine, fitCubicThroughDeletion, fitCubicWithTangents, flatIndexesAfterReverse, flattenCubic, flattenCubicWithArcLen, flattenQuadratic, flattenQuadraticWithArcLen, forEachSegment, growAnchorSelection, growRegion, handleAlongItsAngle, handleAtItsLength, handleBalances, harmonizeAnchors, hasOpenSubpath, intersectSegments, invertAnchorSelection, isSegmentStraight, joinAnchorsAt, joinPaths, joinSubpathEnds, keepCorners, len2, lengthToward, lengthenOpenEnd, lengthenPathEnd, linePath, lineShape, linear, makeHandlesSymmetric, mapConstraintAnchors, mat3, meanScale, measureAnchorPath, measurePath, mergeRegion, moveHandleSymmetric, nearestOnCubic, nearestOnLine, nearestOnPath, nearestOnQuadratic, nearestPathAnchor, normalizeZoom, offsetCornerTraces, openEndAt, openEndRay, openPathEnds, originFor, originOf, pathAnchorPoints, pathAwayFromAnchors, pathCommandCoordCount, pathContainsPoint, pathContainsPolygon, pathContainsRect, pathCrossings, pathDistanceToPoint, pathEndAnchorIndex, pathEndFrame, pathFromD, pathInPoseFrame, pathInWorld, pathIntersectsPolygon, pathIntersectsRect, pathPoint, pathSegments, pathShape, pathSignedArea, pathThroughPoseFrame, pathToCubicContours, pathToD, placeAlongRun, placeRect, pointAlongPath, pointInPath, pointInPolygon, pointSegmentDist2, polygonContainsPath, polygonFromPoints, polygonIntersectsPath, polylineFromPoints, portControls, portCurvePoints, poseFrameInverseOf, poseFrameOf, poseLinearOf, poseRotationOf, prepareBlend, puckerBloatPath, quadraticEvalAt, readAnchorFields, rectMarkerPath, rectPath, rectToContour, regularPolygonPath, remapAnchorValues, remapConstraints, remapPerAnchor, remapPointValues, repeatAlongPath, resamplePath, resolveCorners, resolveCornersWithSources, resolveEasing, restoreCorners, retractHandles, reverseAnchors, reversePath, reverseSubpaths, reviveTypedArrays, rotatePathAround, roughenPath, roundRectPath, runLength, runPlaces, runStationAt, scalePathToBounds, scaleSegmentHandles, schneiderFit, segmentBetween, segmentExtremaTs, segmentsBetweenAnchors, segmentsCross, setDefaultOpenFill, setSubpathStart, shiftTrack, shrinkAnchorSelection, sign, simplifyAnchorsAt, simplifyPath, simplifySpan, simplifySubpath, smoothAnchors, smudgePath, softFalloff, softSelectionBand, softSelectionWeights, solveConstraints, solvePathConstraints, spiroContoursFromControl, spiroContoursOf, spiroControlPath, spiroToPath, splitByClosure, splitCubicAt, splitLineAt, splitQuadraticAt, splitSubpaths, squarePath, starPath, stationsAlongPath, strokeHitTest, sub, subpathEndAt, subpathsOfAnchors, tagTypedArray, tagTypedArrays, trackRun, trackShapeD, trackSlice, transformPath, translateAnchorsSymmetric, translatePath, trimPathAt, typedArrayReplacer, unionBoundsPath, unionBox, unsatisfiedConstraints, untagTypedArray, viewToMat3, withAnchorPoints, worldCoords, worldEditToStorage, writeAnchorField, zigzagPath };
|
|
3458
|
+
export { ANCHOR_FIELDS, Affine, type AnchorField, type AnchorFieldValues, type AnchorPair, type AnchorPathMeasure, AnchorSet, type AnchorSubpathMeasure, type AnchorSymmetry, type ArcTrackShape, type ArcTrackSpec, type AverageAxis, type BendAlongPathOptions, type BendGrip, type BezierEasing, type BlendPathsOptions, type Box, CONSTRAINT_TOLERANCE, CORNER_RESTORE_TOLERANCE, type ConflictingConstraintsOptions, type ConstrainPathEditOptions, type ConstrainedPathEdit, type ConstrainedPathsEdit, type ConstraintPoint, type CornerCut, type CornerFrame, CornerPiece, CornerSpec, type CornerTrace, type CubicContour, type CubicCoords, type CubicSegment, type CurveNearest, type CurvePosition, type CurveSpan, DEFAULT_FLATTEN_TOLERANCE, DEG_TO_RAD, type DirectionMark, EASINGS, EPS, type EaseOptions, type EasingFn, type EasingName, type EasingSpec, type EllipseTrackShape, type EllipseTrackSpec, type ExtendToMeetOptions, type ExtensionPiece, type ExtremaAxes, type FramedBox, type GlMat3, type GrowRegionOptions, type HalfTurn, type HandleBalance, type HandleRef, type JoinOptions, LengthSpan, LengthTable, type LengthenMode, type LineCoords, type MeasureAnchorPathOptions, type MeasurePathOptions, type MergeRegionOptions, type NumberEntry, type NumberTypedArray, ORIGIN_THRESHOLD, type OpenPathEnd, PATH_C, PATH_CMD_LENGTHS, PATH_COMMANDS, PATH_L, PATH_M, PATH_Q, PATH_SNAP_KINDS, PATH_Z, Path, type PathAnchorHit, type PathAwayFromAnchors, type PathBlend, PathBuilder, type PathCommandCode, type PathCommandName, type PathConstraint, type PathConstraintKind, type PathCrossing, type PathEndFrame, PathFillRule, type PathInWorldPose, type PathLink, type PathMeasure, type PathNearest, type PathNearestStation, PathOpenFill, type PathSegment, type PathSnapHit, type PathSnapIndex, type PathSnapKind, type PathSnapQuery, type PathSnapTarget, type PathStation, type PathStop, type PathTrackShape, type PathsEditItem, PenAnchor, type PlaceAlongRunOptions, type PlaceRectOptions, type PlacedRect, type Placement, type PlacementAlign, type PlacementSide, Point, type PointAlongPathOptions, type PointInPathOptions, type PointOrigin, type PolygonIntersectsPathOptions, PolygonPath, type PoseLinear, type PoseRotation, type PuckerBloatPathOptions, type QuadraticCoords, RAD_TO_DEG, type Rect, RectPath, type RepeatAlongPathOptions, type RepeatStation, type ResamplePathOptions, type ResolvedCorners, type RoughenPathOptions, type RunAlign, type RunOrder, type RunPast, type RunPlace, type RunSpot, SPRING_PRESETS, Scale2, type SegmentCrossing, type SegmentMeasure, type SegmentRef, type SegmentType, type SimplifyPathOptions, type SmudgePathOptions, type SoftFalloff, type SolveConstraintsOptions, type SolveConstraintsResult, type SolvePathConstraintsResult, type SpiroContour, SpiroKind, type SpiroPath, SpiroPoint, type SpiroToPathOptions, type SpringPreset, type SpringPresetName, type StaticPathSnapKind, type StrokeHitTestOptions, type SubpathEnd, TYPED_ARRAY_CONSTRUCTORS, type TaggedTypedArray, type TrackAtOptions, type TrackNearest, type TrackNearestOptions, type TrackPlace, type TrackRun, type TrackRunOptions, type TrackShape, type TrackShapeKind, type TrackSide, type TrackStation, type TransformPathOptions, type TrimPathOptions, type TrimResult, type TypedArrayTag, type UnsatisfiedConstraintsOptions, type View, ZOOM_FLOOR, type ZigzagPathOptions, addExtremaAnchors, addOrigin, anchorOriginsOf, anchorSymmetries, anchorSymmetry, anchorsBefore, anchorsUnderBrush, anchorsWhere, approxEq, arcShape, asPolygonPath, averageAnchorsAt, balanceFactorToward, bendAlongPath, bendSegment, bendSide, blendPaths, boundsOfCoords, boundsOfPath, boxContainsBox, boxContainsPoint, boxFrameOf, boxesIntersect, circlePath, clamp, clamp01, clampRectWithin, closestOpenEnds, composePath, conflictingConstraints, constrainPathEdit, constrainPathsEdit, constraintAnchors, constraintApplies, constraintFits, convertSegments, coordsFrom, cornerAnchors, cornerCuts, cornerFrameAt, cornerFrames, cornerTraces, createPathSnapIndex, cross, cubicAxisExtremaTs, cubicBezierEasing, cubicBounds, cubicContoursToPath, cubicEvalAt, curveSpan, decomposePath, defaultOpenFill, directionMarks, distance, distance2, dot, easeIn, easeInBack, easeInBounce, easeInCirc, easeInCubic, easeInElastic, easeInExpo, easeInOut, easeInOutBack, easeInOutBounce, easeInOutCirc, easeInOutCubic, easeInOutElastic, easeInOutExpo, easeInOutQuad, easeInOutQuart, easeInOutQuint, easeInOutSine, easeInQuad, easeInQuart, easeInQuint, easeInSine, easeLength, easeOut, easeOutBack, easeOutBounce, easeOutCirc, easeOutCubic, easeOutElastic, easeOutExpo, easeOutQuad, easeOutQuart, easeOutQuint, easeOutSine, editAnchorSetTracked, elevateQuadraticToCubic, ellipsePath, ellipseShape, equalizeSegmentHandles, everyNthAnchor, extendToMeet, extensionPieces, fillsOpenSubpaths, findPathSnap, findPathSnaps, fitAffine, fitCubicThroughDeletion, fitCubicWithTangents, flatIndexesAfterReverse, flattenCubic, flattenCubicWithArcLen, flattenQuadratic, flattenQuadraticWithArcLen, forEachSegment, growAnchorSelection, growRegion, handleAlongItsAngle, handleAtItsLength, handleBalances, harmonizeAnchors, hasOpenSubpath, intersectSegments, invertAnchorSelection, isSegmentStraight, joinAnchorsAt, joinPaths, joinSubpathEnds, keepCorners, len2, lengthAtCurve, lengthToward, lengthenOpenEnd, lengthenPathEnd, lerp, lerpPoint, linePath, lineShape, linear, makeHandlesSymmetric, mapConstraintAnchors, mat3, meanScale, measureAnchorPath, measurePath, mergeRegion, moveHandleSymmetric, nearestOnCubic, nearestOnLine, nearestOnPath, nearestOnQuadratic, nearestPathAnchor, normalizeZoom, offsetCornerTraces, openEndAt, openEndRay, openPathEnds, originFor, originOf, pathAnchorPoints, pathAwayFromAnchors, pathCommandCoordCount, pathContainsPoint, pathContainsPolygon, pathContainsRect, pathCrossings, pathDistanceToPoint, pathEndAnchorIndex, pathEndFrame, pathFromD, pathInPoseFrame, pathInWorld, pathIntersectsPolygon, pathIntersectsRect, pathLengthTable, pathPoint, pathSegments, pathShape, pathSignedArea, pathThroughPoseFrame, pathToCubicContours, pathToD, placeAlongRun, placeRect, pointAlongPath, pointAtLength, pointInPath, pointInPolygon, pointSegmentDist, pointSegmentDist2, polygonContainsPath, polygonFromPoints, polygonIntersectsPath, polylineFromPoints, portControls, portCurvePoints, poseFrameInverseOf, poseFrameOf, poseLinearOf, poseRotationOf, prepareBlend, puckerBloatPath, quadraticEvalAt, readAnchorFields, rectContainsPoint, rectContainsPointHalfOpen, rectMarkerPath, rectPath, rectToContour, rectsIntersect, rectsOverlap, regularPolygonPath, remapAnchorValues, remapConstraints, remapPerAnchor, remapPointValues, repeatAlongPath, resamplePath, resolveCorners, resolveCornersWithSources, resolveEasing, restoreCorners, retractHandles, reverseAnchors, reversePath, reverseSubpaths, reviveTypedArrays, ringSignedArea, rotatePathAround, roughenPath, roundRectPath, runLength, runPlaces, runSegments, runStationAt, scalePathToBounds, scaleSegmentHandles, schneiderFit, segmentBetween, segmentExtremaTs, segmentLength, segmentT, segmentTAtLength, segmentsBetweenAnchors, segmentsCross, setDefaultOpenFill, setSubpathStart, shiftTrack, shrinkAnchorSelection, sign, simplifyAnchorsAt, simplifyPath, simplifySpan, simplifySubpath, smoothAnchors, smudgePath, softFalloff, softSelectionBand, softSelectionWeights, solveConstraints, solvePathConstraints, spiroContoursFromControl, spiroContoursOf, spiroControlPath, spiroToPath, splitByClosure, splitCubicAt, splitLineAt, splitQuadraticAt, splitSubpaths, squarePath, starPath, stationsAlongPath, strokeHitTest, sub, subpathEndAt, subpathsOfAnchors, tagTypedArray, tagTypedArrays, trackRun, trackShapeD, trackSlice, transformPath, translateAnchorsSymmetric, translatePath, trimPathAt, typedArrayReplacer, unionBoundsPath, unionBox, unionRects, unsatisfiedConstraints, untagTypedArray, viewRectToScreen, viewScreenToWorld, viewToMat3, viewWorldToScreen, withAnchorPoints, worldCoords, worldEditToStorage, wrapAngle, wrapPositive, writeAnchorField, zigzagPath };
|