@weasel-js/geom 1.11.0 → 1.12.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/booleans/index.d.ts +3 -1
- package/dist/booleans/index.js +138 -11
- package/dist/booleans/index.js.map +1 -1
- package/dist/{chunk-J2O2B54M.js → chunk-2PKPKU4P.js} +178 -174
- package/dist/chunk-2PKPKU4P.js.map +1 -0
- package/dist/{chunk-HGF5OVEN.js → chunk-STGSBIOL.js} +29 -6
- package/dist/chunk-STGSBIOL.js.map +1 -0
- package/dist/{chunk-SASMXDBE.js → chunk-UGE57OTX.js} +83 -35
- package/dist/chunk-UGE57OTX.js.map +1 -0
- package/dist/{chunk-6XSJY3TC.js → chunk-VHXOCDZ2.js} +3 -3
- package/dist/{chunk-6XSJY3TC.js.map → chunk-VHXOCDZ2.js.map} +1 -1
- package/dist/{chunk-7KLJZFBY.js → chunk-YPWFGFQX.js} +3 -3
- package/dist/{chunk-7KLJZFBY.js.map → chunk-YPWFGFQX.js.map} +1 -1
- package/dist/index.d.ts +261 -42
- package/dist/index.js +786 -124
- package/dist/index.js.map +1 -1
- package/dist/nd/index.d.ts +2 -1
- package/dist/nd/index.js +44 -29
- package/dist/nd/index.js.map +1 -1
- package/dist/tessellate/index.js +3 -3
- package/dist/warp/index.d.ts +7 -5
- package/dist/warp/index.js +145 -13
- package/dist/warp/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-HGF5OVEN.js.map +0 -1
- package/dist/chunk-J2O2B54M.js.map +0 -1
- package/dist/chunk-SASMXDBE.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
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-BW8d_2RY.js';
|
|
2
2
|
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-BW8d_2RY.js';
|
|
3
3
|
import { A as AnchorSet, P as PenAnchor, a as SpiroPoint, S as SpiroKind, b as Scale2 } from './curvature-PkoLduGc.js';
|
|
4
4
|
export { c as AnchorRect, d as CombTooth, e as CurvatureCombOptions, C as CurvatureSource, E as EulerFit, f as EulerSegment, g as SPIRO_KINDS, h as SegmentComb, i as SegmentHit, j as SpiroSegment, k as anchorAt, l as anchorCount, m as anchorsInRect, n as anchorsToPath, o as combTeeth, p as countPathAnchors, q as cubicCurvatureAt, r as cubicCurvatureSource, s as cubicDerivativeAt, t as curvatureComb, u as deleteAnchorsAt, v as editAnchorSet, w as eulerAngleAt, x as eulerCurvatureAt, y as eulerCurvatureDerivativesAt, z as eulerPointAt, B as fitEulerSegment, D as flatAnchorIndex, F as insertAnchorOnSegment, G as isAnchorSmooth, H as isSpiroKind, I as isStraightSegment, J as locateAnchor, K as moveHandleTo, L as nearestSegmentT, M as openSubpathAt, N as pathToAnchors, O as placeEulerSegment, Q as pxExtent, R as scaleDelta, T as screenAngleOf, U as segmentAt, V as segmentEnds, W as solveSpiro, X as standoff, Y as translateAnchorBy, Z as withinPxBox, _ as withinPxRadius } from './curvature-PkoLduGc.js';
|
|
@@ -262,6 +262,235 @@ declare function nearestOnQuadratic(px: number, py: number, x0: number, y0: numb
|
|
|
262
262
|
*/
|
|
263
263
|
declare function nearestOnPath(commands: ArrayLike<number>, coords: ArrayLike<number>, px: number, py: number): PathNearest | null;
|
|
264
264
|
|
|
265
|
+
/**
|
|
266
|
+
* A path measured once by arc length, so many stations along it cost a binary
|
|
267
|
+
* search each rather than a fresh flatten: what `pointAlongPath` answers one
|
|
268
|
+
* fraction at a time, and what anything placing or bending geometry along a
|
|
269
|
+
* path reads many times over.
|
|
270
|
+
*/
|
|
271
|
+
|
|
272
|
+
/** A point on a path and its heading there. */
|
|
273
|
+
interface PathStation {
|
|
274
|
+
point: Point;
|
|
275
|
+
/** Unit vector along the path at `point`, pointing toward the end. */
|
|
276
|
+
tangent: Point;
|
|
277
|
+
}
|
|
278
|
+
/** Options for {@link measurePath}. */
|
|
279
|
+
interface MeasurePathOptions {
|
|
280
|
+
/** Curve flattening tolerance, in world units. Default 0.5. */
|
|
281
|
+
flattenTolerance?: number;
|
|
282
|
+
/** Keep a vertex that turns further than flattening at the tolerance could as a corner: `at`'s `smooth` heading then
|
|
283
|
+
* blends only across the vertices flattening made, and a straight edge heads along itself. Default false. */
|
|
284
|
+
keepCorners?: boolean;
|
|
285
|
+
}
|
|
286
|
+
/** The station on a path nearest a point. */
|
|
287
|
+
interface PathNearestStation extends PathStation {
|
|
288
|
+
/** Arc length at `point`, on the scale {@link PathMeasure.at} reads. */
|
|
289
|
+
s: number;
|
|
290
|
+
/** Distance from the queried point to `point`. */
|
|
291
|
+
dist: number;
|
|
292
|
+
}
|
|
293
|
+
/** A measured path: its length, and the station at any distance along it. */
|
|
294
|
+
interface PathMeasure {
|
|
295
|
+
/** Total arc length, every subpath counted in order. */
|
|
296
|
+
readonly length: number;
|
|
297
|
+
/** True when the path is a single closed contour, so a distance past the
|
|
298
|
+
* end can wrap round to the start. */
|
|
299
|
+
readonly closed: boolean;
|
|
300
|
+
/**
|
|
301
|
+
* The station `s` along the path, `s` clamped to `0..length`.
|
|
302
|
+
*
|
|
303
|
+
* The tangent is the heading of the flattened segment under `s`. With
|
|
304
|
+
* `smooth`, it is instead blended across each segment from the heading at
|
|
305
|
+
* one vertex to the next, so geometry bent along it turns without facets.
|
|
306
|
+
*/
|
|
307
|
+
at(s: number, smooth?: boolean): PathStation;
|
|
308
|
+
/**
|
|
309
|
+
* The inverse of `at`: the station nearest `p`. On a tie the earliest
|
|
310
|
+
* segment wins. The tangent is the heading of the segment holding it.
|
|
311
|
+
*/
|
|
312
|
+
nearest(p: Point): PathNearestStation;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Measure `path` by arc length. Subpaths are measured in order and treated as
|
|
316
|
+
* one run, the way a browser measures a whole `<path>`. Returns `null` for a
|
|
317
|
+
* path with no points; a path of zero length answers at its single point,
|
|
318
|
+
* heading along +X.
|
|
319
|
+
*/
|
|
320
|
+
declare function measurePath(path: Path, opts?: MeasurePathOptions): PathMeasure | null;
|
|
321
|
+
|
|
322
|
+
/** A station on a track, plus the side items stand on. */
|
|
323
|
+
interface TrackStation extends PathStation {
|
|
324
|
+
/** Unit vector the items stand on: away from an arc's center, left of travel on a line. */
|
|
325
|
+
normal: Point;
|
|
326
|
+
}
|
|
327
|
+
/** The nearest spot on a track to a point: its fraction along and the distance to it. */
|
|
328
|
+
interface TrackNearest {
|
|
329
|
+
f: number;
|
|
330
|
+
dist: number;
|
|
331
|
+
}
|
|
332
|
+
/** How `nearest` treats a track's ends. */
|
|
333
|
+
interface TrackNearestOptions {
|
|
334
|
+
/** Let `f` run on past 0 and 1: a line extends straight, an arc, an ellipse or a closed path round itself, unwrapped about
|
|
335
|
+
* `about`. A shape that cannot extend clamps. `dist` is to the track either way. */
|
|
336
|
+
open?: boolean;
|
|
337
|
+
/** Where along the track an open arc is unwrapped about, in the same terms as the `f` this `nearest` answers (a
|
|
338
|
+
* `TrackRun` reads it in reading order): a point is placed on whichever side of it is nearer by angle. Default 0.5,
|
|
339
|
+
* the middle. */
|
|
340
|
+
about?: number;
|
|
341
|
+
}
|
|
342
|
+
/** Which family a track shape belongs to. `'path'` is a shape over a measured `Path` (`pathShape`). */
|
|
343
|
+
type TrackShapeKind = 'line' | 'arc' | 'ellipse' | 'path';
|
|
344
|
+
/** A curve a control lies along, addressed by fraction 0..1 of its length. */
|
|
345
|
+
interface TrackShape {
|
|
346
|
+
readonly kind: TrackShapeKind;
|
|
347
|
+
readonly length: number;
|
|
348
|
+
/** True when the track's end meets its start: a whole circle or ellipse, or a path that is one closed contour. */
|
|
349
|
+
readonly closed: boolean;
|
|
350
|
+
/** The station at fraction `f`, clamped to 0..1. */
|
|
351
|
+
at(f: number): TrackStation;
|
|
352
|
+
/** The spot on the track nearest `p`. */
|
|
353
|
+
nearest(p: Point, options?: TrackNearestOptions): TrackNearest;
|
|
354
|
+
}
|
|
355
|
+
/** A straight track from `from` to `to`; its normal is the left of travel. */
|
|
356
|
+
declare function lineShape(from: Point, to: Point): TrackShape;
|
|
357
|
+
|
|
358
|
+
/** An arc track: degrees clockwise from 12 o'clock on a y-down plane. Equal `start` and `end` is a whole circle. */
|
|
359
|
+
interface ArcTrackSpec {
|
|
360
|
+
center: Point;
|
|
361
|
+
radius: number;
|
|
362
|
+
start: number;
|
|
363
|
+
end: number;
|
|
364
|
+
/** Which way the track runs from `start` to `end`. Default `'cw'`. */
|
|
365
|
+
direction?: 'cw' | 'ccw';
|
|
366
|
+
}
|
|
367
|
+
/** A track shape that remembers the arc it was built from, so path data can be drawn as arcs. */
|
|
368
|
+
type ArcTrackShape = TrackShape & {
|
|
369
|
+
readonly arc: ArcTrackSpec;
|
|
370
|
+
};
|
|
371
|
+
/** An arc track; its normal points away from the center, whichever way it runs. */
|
|
372
|
+
declare function arcShape(spec: ArcTrackSpec): ArcTrackShape;
|
|
373
|
+
|
|
374
|
+
/** An axis-aligned elliptical arc track. `start` and `end` are directions seen from the center, in degrees clockwise
|
|
375
|
+
* from 12 o'clock on a y-down plane, as an arc's are; equal `start` and `end` is the whole ellipse. */
|
|
376
|
+
interface EllipseTrackSpec {
|
|
377
|
+
center: Point;
|
|
378
|
+
/** Half the width. */
|
|
379
|
+
radiusX: number;
|
|
380
|
+
/** Half the height. */
|
|
381
|
+
radiusY: number;
|
|
382
|
+
start: number;
|
|
383
|
+
end: number;
|
|
384
|
+
/** Which way the track runs from `start` to `end`. Default `'cw'`. */
|
|
385
|
+
direction?: 'cw' | 'ccw';
|
|
386
|
+
}
|
|
387
|
+
/** A track shape that remembers the ellipse it was built from, so path data can be drawn as elliptical arcs. */
|
|
388
|
+
type EllipseTrackShape = TrackShape & {
|
|
389
|
+
readonly ellipse: EllipseTrackSpec;
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* An elliptical arc track, addressed by fraction of its length; its normal points away from the center, square to the
|
|
393
|
+
* ellipse, whichever way it runs. With equal radii it is `arcShape`'s arc.
|
|
394
|
+
*/
|
|
395
|
+
declare function ellipseShape(spec: EllipseTrackSpec): EllipseTrackShape;
|
|
396
|
+
|
|
397
|
+
/** A track shape that remembers the path it was built from, so path data can be drawn as the path itself. */
|
|
398
|
+
type PathTrackShape = TrackShape & {
|
|
399
|
+
readonly path: Path;
|
|
400
|
+
};
|
|
401
|
+
/**
|
|
402
|
+
* A track along any path, every subpath counted in order, addressed by fraction of its length. Its normal is the left of
|
|
403
|
+
* travel, as a line's is: outward on a contour drawn clockwise on screen. `null` for a path with no points.
|
|
404
|
+
*/
|
|
405
|
+
declare function pathShape(path: Path, options?: {
|
|
406
|
+
flattenTolerance?: number;
|
|
407
|
+
}): PathTrackShape | null;
|
|
408
|
+
|
|
409
|
+
/** A station as a run places an item: `normal` is the item's up after any flip, `tangent` its reading direction,
|
|
410
|
+
* `angle` the CSS rotation in degrees that tips an upright item to it (0 = upright, clockwise positive, in (-180, 180]). */
|
|
411
|
+
interface TrackPlace extends TrackStation {
|
|
412
|
+
angle: number;
|
|
413
|
+
}
|
|
414
|
+
/** The stretch `from..to` of a shape in reading order. It is itself a TrackShape: `at(g)` and `nearest(p).f` are
|
|
415
|
+
* in reading order, g = 0 at the reading start. */
|
|
416
|
+
interface TrackRun extends TrackShape {
|
|
417
|
+
readonly shape: TrackShape;
|
|
418
|
+
readonly from: number;
|
|
419
|
+
readonly to: number;
|
|
420
|
+
/** True when items stand on the shape's normal turned over: under `side: 'auto'`, when that normal points down the screen
|
|
421
|
+
* at `about`, so they stand upright. */
|
|
422
|
+
readonly flipped: boolean;
|
|
423
|
+
/** True when reading order runs against the shape's own direction. */
|
|
424
|
+
readonly reversed: boolean;
|
|
425
|
+
at(g: number): TrackPlace;
|
|
426
|
+
}
|
|
427
|
+
/** Which side of a shape a run's items stand on: `'auto'` whichever is upright, `'path'` the shape's own normal, `'flipped'`
|
|
428
|
+
* the other. */
|
|
429
|
+
type TrackSide = 'auto' | 'path' | 'flipped';
|
|
430
|
+
/** How {@link trackRun} reads a shape: which side of it is up, and where that is judged. */
|
|
431
|
+
interface TrackRunOptions {
|
|
432
|
+
/** Default `'auto'`. */
|
|
433
|
+
side?: TrackSide;
|
|
434
|
+
/** The shape fraction `'auto'` judges the side at. Default the run's middle, `(from + to) / 2`. */
|
|
435
|
+
about?: number;
|
|
436
|
+
}
|
|
437
|
+
/** The stretch `from..to` (default the whole shape) as items read it: on the side `options.side` picks, reversed to read
|
|
438
|
+
* left to right on that side. */
|
|
439
|
+
declare function trackRun(shape: TrackShape, from?: number, to?: number, options?: TrackRunOptions): TrackRun;
|
|
440
|
+
|
|
441
|
+
/** SVG path data for the stretch `from..to` of a shape: a segment for a line, true arcs for an arc or an ellipse, else a
|
|
442
|
+
* 64-step polyline. A whole path shape is its path's own data. */
|
|
443
|
+
declare function trackShapeD(shape: TrackShape, from?: number, to?: number): string;
|
|
444
|
+
|
|
445
|
+
/** Where a sequence sits along a run: against its reading start, its middle, or its reading end. */
|
|
446
|
+
type RunAlign = 'start' | 'center' | 'end';
|
|
447
|
+
/** The order {@link placeAlongRun} lays items in: along the run's reading order, or from the end where the underlying
|
|
448
|
+
* shape's own direction starts. The two differ only on a run that is `reversed`. */
|
|
449
|
+
type RunOrder = 'reading' | 'track';
|
|
450
|
+
/** Where one item of a run falls: its center along the run, and how much of it lies past the run's ends. */
|
|
451
|
+
interface RunSpot {
|
|
452
|
+
center: number;
|
|
453
|
+
clipped: 'none' | 'part' | 'past';
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Where each item's center falls along a run `room` px long, gaps measured along it. Without `at`, a sequence that fits
|
|
457
|
+
* sits as `align` says, and one that does not is laid from the start less `offset`. With `at`, the sequence's align
|
|
458
|
+
* point sits at `at - offset` whether or not it fits.
|
|
459
|
+
*/
|
|
460
|
+
declare function runPlaces(lengths: readonly number[], gap: number, room: number, align: RunAlign, offset: number, at?: number): RunSpot[];
|
|
461
|
+
/** How long items of `lengths` are laid end to end with `gap` between each two. */
|
|
462
|
+
declare function runLength(lengths: readonly number[], gap: number): number;
|
|
463
|
+
/** The place `distance` along `run`; past either end it carries on straight along that end, tipped as it is there. The
|
|
464
|
+
* point then moves `shift` along the place's up. */
|
|
465
|
+
declare function runStationAt(run: TrackRun, distance: number, shift?: number): TrackPlace;
|
|
466
|
+
/** How {@link placeAlongRun} lays its items: spacing, alignment, offset, anchor, stand-off, wrap and past-end handling. */
|
|
467
|
+
interface PlaceAlongRunOptions {
|
|
468
|
+
/** Space between each two items, along the run. Default 0. */
|
|
469
|
+
gap?: number;
|
|
470
|
+
/** Default `'center'`. */
|
|
471
|
+
align?: RunAlign;
|
|
472
|
+
/** How far the sequence is laid back along the run. Default 0. */
|
|
473
|
+
offset?: number;
|
|
474
|
+
/** Where along the run the sequence's align point sits, fitting or not; see {@link runPlaces}. */
|
|
475
|
+
at?: number;
|
|
476
|
+
/** How far each item stands off the run, along its up. Default 0. */
|
|
477
|
+
shift?: number;
|
|
478
|
+
/** Carry items on round a closed run past its seam, and count an item past once it is a whole lap on from the first
|
|
479
|
+
* item's start. Default false. */
|
|
480
|
+
wrap?: boolean;
|
|
481
|
+
/** Where an item wholly past an end is placed: carried on beyond it (`'extend'`, the default) or held at it. */
|
|
482
|
+
past?: 'extend' | 'hold';
|
|
483
|
+
/** `'reading'` (the default) lays item 1 at the run's reading start. `'track'` lays it at the shape's own start and
|
|
484
|
+
* proceeds in the shape's direction; items still stand as the run reads them. In `'track'` order `align`, `at`,
|
|
485
|
+
* `offset` and each `center` are measured from the shape's start. */
|
|
486
|
+
order?: RunOrder;
|
|
487
|
+
}
|
|
488
|
+
/** One item laid along a run: where its center falls and the place there. `center` is unwrapped. */
|
|
489
|
+
interface RunPlace extends RunSpot, TrackPlace {
|
|
490
|
+
}
|
|
491
|
+
/** Items of `lengths` laid end to end along `run`, each centered on its place and tipped to it. */
|
|
492
|
+
declare function placeAlongRun(run: TrackRun, lengths: readonly number[], options?: PlaceAlongRunOptions): RunPlace[];
|
|
493
|
+
|
|
265
494
|
/**
|
|
266
495
|
* The port-curve rule in the 2D kernel's currency: loose scalars, the way
|
|
267
496
|
* `cubicEvalAt` and `applyToPoint` take them. The rule itself lives in
|
|
@@ -677,46 +906,16 @@ declare function reversePath(path: PolygonPath): PolygonPath;
|
|
|
677
906
|
declare function pathFromD(d: string, onWarn?: (message: string) => void): ReturnType<PathBuilder['build']>;
|
|
678
907
|
|
|
679
908
|
/**
|
|
680
|
-
*
|
|
681
|
-
*
|
|
682
|
-
*
|
|
683
|
-
*
|
|
909
|
+
* `pathToD` — a weasel `Path` as an SVG `d=` string, the inverse of
|
|
910
|
+
* `pathFromD`. `RectPath` lowers to `M h v h Z`; `PolygonPath` walks the
|
|
911
|
+
* (commands, coords) arrays, one SVG command per kit command, with corner
|
|
912
|
+
* shapes expanded into the geometry they draw.
|
|
913
|
+
*
|
|
914
|
+
* Absolute commands only; numbers are rounded to 6 decimals.
|
|
684
915
|
*/
|
|
685
916
|
|
|
686
|
-
/**
|
|
687
|
-
|
|
688
|
-
point: Point;
|
|
689
|
-
/** Unit vector along the path at `point`, pointing toward the end. */
|
|
690
|
-
tangent: Point;
|
|
691
|
-
}
|
|
692
|
-
/** Options for {@link measurePath}. */
|
|
693
|
-
interface MeasurePathOptions {
|
|
694
|
-
/** Curve flattening tolerance, in world units. Default 0.5. */
|
|
695
|
-
flattenTolerance?: number;
|
|
696
|
-
}
|
|
697
|
-
/** A measured path: its length, and the station at any distance along it. */
|
|
698
|
-
interface PathMeasure {
|
|
699
|
-
/** Total arc length, every subpath counted in order. */
|
|
700
|
-
readonly length: number;
|
|
701
|
-
/** True when the path is a single closed contour, so a distance past the
|
|
702
|
-
* end can wrap round to the start. */
|
|
703
|
-
readonly closed: boolean;
|
|
704
|
-
/**
|
|
705
|
-
* The station `s` along the path, `s` clamped to `0..length`.
|
|
706
|
-
*
|
|
707
|
-
* The tangent is the heading of the flattened segment under `s`. With
|
|
708
|
-
* `smooth`, it is instead blended across each segment from the heading at
|
|
709
|
-
* one vertex to the next, so geometry bent along it turns without facets.
|
|
710
|
-
*/
|
|
711
|
-
at(s: number, smooth?: boolean): PathStation;
|
|
712
|
-
}
|
|
713
|
-
/**
|
|
714
|
-
* Measure `path` by arc length. Subpaths are measured in order and treated as
|
|
715
|
-
* one run, the way a browser measures a whole `<path>`. Returns `null` for a
|
|
716
|
-
* path with no points; a path of zero length answers at its single point,
|
|
717
|
-
* heading along +X.
|
|
718
|
-
*/
|
|
719
|
-
declare function measurePath(path: Path, opts?: MeasurePathOptions): PathMeasure | null;
|
|
917
|
+
/** `path` as SVG path data. */
|
|
918
|
+
declare function pathToD(given: Path): string;
|
|
720
919
|
|
|
721
920
|
/**
|
|
722
921
|
* A station along a path: where it is at a fraction of its length, and which
|
|
@@ -1294,7 +1493,8 @@ interface GrowRegionOptions {
|
|
|
1294
1493
|
* overlap rather than merge, and a hole grown shut winds back on itself and
|
|
1295
1494
|
* fills. At an inside corner the two offset edges are cut back to where they
|
|
1296
1495
|
* cross; where they do not, the gap is passed through the corner's original
|
|
1297
|
-
* point, which closes it with a loop inside the fill.
|
|
1496
|
+
* point, which closes it with a loop inside the fill. `mergeRegion`
|
|
1497
|
+
* redraws the result as its outline alone, for a stroke.
|
|
1298
1498
|
*
|
|
1299
1499
|
* What it costs: one segment per curve, more where `tolerance` needs the curve
|
|
1300
1500
|
* split; a miter corner between two straight edges costs nothing, one beside
|
|
@@ -1303,6 +1503,22 @@ interface GrowRegionOptions {
|
|
|
1303
1503
|
*/
|
|
1304
1504
|
declare function growRegion(path: Path, distance: number, opts?: GrowRegionOptions): PolygonPath;
|
|
1305
1505
|
|
|
1506
|
+
/** Options for {@link mergeRegion}. */
|
|
1507
|
+
interface MergeRegionOptions {
|
|
1508
|
+
/** How far from an edge a point is taken to tell which side is filled, in
|
|
1509
|
+
* the path's units; a sliver of region thinner than this may be lost.
|
|
1510
|
+
* Default 0.01. */
|
|
1511
|
+
tolerance?: number;
|
|
1512
|
+
}
|
|
1513
|
+
/**
|
|
1514
|
+
* The region `path` fills under `'nonzero'`, as contours that neither cross
|
|
1515
|
+
* nor overlap, wound so the fill lies on the same side of each as it does on
|
|
1516
|
+
* most of `path`. Stroking it traces only the region's edge. Every subpath
|
|
1517
|
+
* counts as closed. Answers `path`'s own contours, unchanged, where nothing
|
|
1518
|
+
* needs cutting or dropping.
|
|
1519
|
+
*/
|
|
1520
|
+
declare function mergeRegion(path: Path, opts?: MergeRegionOptions): PolygonPath;
|
|
1521
|
+
|
|
1306
1522
|
/**
|
|
1307
1523
|
* Simplify only where `flatIndexes` say: each unbroken run of those anchors
|
|
1308
1524
|
* along a subpath is refitted as one span by the fitter {@link simplifyPath}
|
|
@@ -2542,6 +2758,8 @@ interface PathsEditItem extends ConstrainPathEditOptions {
|
|
|
2542
2758
|
/** `before` as the edit left it; `before` itself for a path the edit did not touch. */
|
|
2543
2759
|
after: PolygonPath;
|
|
2544
2760
|
constraints: readonly PathConstraint[];
|
|
2761
|
+
/** For a path the edit left alone: its anchors give way as freely as any the edit did not move, rather than only when the edited paths cannot. */
|
|
2762
|
+
yields?: boolean;
|
|
2545
2763
|
}
|
|
2546
2764
|
/**
|
|
2547
2765
|
* A constraint across paths. Its anchors are numbered over the anchors of
|
|
@@ -2573,7 +2791,8 @@ interface ConstrainedPathsEdit {
|
|
|
2573
2791
|
* An edit of constrained paths, finished so their constraints and the links
|
|
2574
2792
|
* between them hold, as one solve over every anchor: the anchors and handles
|
|
2575
2793
|
* the edit moved are held, and so are the anchors of a path it left alone
|
|
2576
|
-
* (`after === before`), except one held on a segment
|
|
2794
|
+
* (`after === before`), except one held on a segment or on a path that
|
|
2795
|
+
* `yields`; `fixed` anchors go
|
|
2577
2796
|
* back to where they were, and the rest move the least they must. A constraint
|
|
2578
2797
|
* that did not hold before the edit is left out of the solve, and reported.
|
|
2579
2798
|
* Each item's own `horizontal` and `vertical` read its own `axisAngle`.
|
|
@@ -2855,4 +3074,4 @@ declare function reviveTypedArrays(value: unknown): unknown;
|
|
|
2855
3074
|
/** `tagTypedArrays` as a `JSON.stringify` replacer. */
|
|
2856
3075
|
declare function typedArrayReplacer(_key: string, value: unknown): unknown;
|
|
2857
3076
|
|
|
2858
|
-
export { ANCHOR_FIELDS, type Affine, type AnchorField, type AnchorFieldValues, type AnchorPair, type AnchorPathMeasure, AnchorSet, type AnchorSubpathMeasure, type AnchorSymmetry, 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 EasingFn, type EasingName, type EasingSpec, type ExtendToMeetOptions, type FramedBox, type GlMat3, type GrowRegionOptions, type HandleBalance, type HandleRef, type JoinOptions, type LengthenMode, type LineCoords, type MeasureAnchorPathOptions, type MeasurePathOptions, type NumberEntry, type NumberTypedArray, 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, PathOpenFill, type PathSegment, type PathSnapHit, type PathSnapIndex, type PathSnapKind, type PathSnapQuery, type PathSnapTarget, type PathStation, type PathStop, type PathsEditItem, PenAnchor, 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 QuadraticCoords, type Rect, RectPath, type RepeatAlongPathOptions, type RepeatStation, type ResamplePathOptions, type ResolvedCorners, 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 TrimPathOptions, type TrimResult, type TypedArrayTag, type UnsatisfiedConstraintsOptions, type View, ZOOM_FLOOR, addExtremaAnchors, anchorOriginsOf, anchorSymmetries, anchorSymmetry, anchorsBefore, anchorsUnderBrush, anchorsWhere, applyToPoint, approxEq, asPolygonPath, averageAnchorsAt, balanceFactorToward, bendAlongPath, bendSegment, blendPaths, boundsOfCoords, boundsOfPath, boxContainsBox, boxContainsPoint, boxToBox, circlePath, clamp, clampRectWithin, closestOpenEnds, composePath, conflictingConstraints, constrainPathEdit, constrainPathsEdit, constraintAnchors, constraintApplies, constraintFits, convertSegments, 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, easeOut, easeOutBack, easeOutBounce, easeOutCirc, easeOutCubic, easeOutElastic, easeOutExpo, easeOutQuad, easeOutQuart, easeOutQuint, easeOutSine, editAnchorSetTracked, elevateQuadraticToCubic, ellipsePath, equalizeSegmentHandles, everyNthAnchor, extendToMeet, fillsOpenSubpaths, findPathSnap, findPathSnaps, fitAffine, fitCubicThroughDeletion, fitCubicWithTangents, flatIndexesAfterReverse, flattenCubic, flattenCubicWithArcLen, flattenQuadratic, flattenQuadraticWithArcLen, forEachSegment, growAnchorSelection, growRegion, handleAlongItsAngle, handleAtItsLength, handleBalances, harmonizeAnchors, hasOpenSubpath, identity$1 as identity, intersectSegments, invert$1 as invert, invertAnchorSelection, isSegmentStraight, joinAnchorsAt, joinSubpathEnds, keepCorners, len2, lengthToward, lengthenOpenEnd, lengthenPathEnd, linePath, linear, makeHandlesSymmetric, mapConstraintAnchors, mat3, meanScale, measureAnchorPath, measurePath, moveHandleSymmetric, multiply$1 as multiply, nearestOnCubic, nearestOnLine, nearestOnPath, nearestOnQuadratic, nearestPathAnchor, normalizeZoom, offsetCornerTraces, openEndAt, openEndRay, openPathEnds, pathAnchorPoints, pathAwayFromAnchors, pathCommandCoordCount, pathContainsPoint, pathContainsPolygon, pathContainsRect, pathCrossings, pathDistanceToPoint, pathEndAnchorIndex, pathEndFrame, pathFromD, pathInPoseFrame, pathInWorld, pathIntersectsPolygon, pathIntersectsRect, pathSegments, pathSignedArea, pathThroughPoseFrame, pathToCubicContours, placeRect, pointAlongPath, pointInPath, pointInPolygon, pointSegmentDist2, polygonContainsPath, polygonFromPoints, polygonIntersectsPath, polylineFromPoints, portControls, portCurvePoints, poseFrameInverseOf, poseFrameOf, poseLinearOf, poseRotationOf, prepareBlend, quadraticEvalAt, readAnchorFields, rectMarkerPath, rectPath, rectToContour, regularPolygonPath, remapAnchorValues, remapConstraints, remapPerAnchor, remapPointValues, repeatAlongPath, resamplePath, resolveCorners, resolveCornersWithSources, resolveEasing, restoreCorners, retractHandles, reverseAnchors, reversePath, reverseSubpaths, reviveTypedArrays, rotate, rotateAboutPoint, rotatePathAround, roundRectPath, scale, scalePathToBounds, scaleSegmentHandles, schneiderFit, segmentBetween, segmentExtremaTs, segmentsBetweenAnchors, segmentsCross, setDefaultOpenFill, setSubpathStart, 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, transformCoords, transformPath, translate, translateAnchorsSymmetric, translatePath, trimPathAt, typedArrayReplacer, unionBoundsPath, unionBox, unsatisfiedConstraints, untagTypedArray, viewToMat3, withAnchorPoints, worldEditToStorage, writeAnchorField };
|
|
3077
|
+
export { ANCHOR_FIELDS, type 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 EasingFn, type EasingName, type EasingSpec, type EllipseTrackShape, type EllipseTrackSpec, type ExtendToMeetOptions, 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, 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 QuadraticCoords, type Rect, RectPath, type RepeatAlongPathOptions, type RepeatStation, type ResamplePathOptions, type ResolvedCorners, type RunAlign, type RunOrder, 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 TrackNearest, type TrackNearestOptions, type TrackPlace, type TrackRun, type TrackRunOptions, type TrackShape, type TrackShapeKind, type TrackSide, type TrackStation, type TrimPathOptions, type TrimResult, type TypedArrayTag, type UnsatisfiedConstraintsOptions, type View, ZOOM_FLOOR, addExtremaAnchors, anchorOriginsOf, anchorSymmetries, anchorSymmetry, anchorsBefore, anchorsUnderBrush, anchorsWhere, applyToPoint, approxEq, arcShape, asPolygonPath, averageAnchorsAt, balanceFactorToward, bendAlongPath, bendSegment, blendPaths, boundsOfCoords, boundsOfPath, boxContainsBox, boxContainsPoint, boxToBox, circlePath, clamp, clampRectWithin, closestOpenEnds, composePath, conflictingConstraints, constrainPathEdit, constrainPathsEdit, constraintAnchors, constraintApplies, constraintFits, convertSegments, 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, easeOut, easeOutBack, easeOutBounce, easeOutCirc, easeOutCubic, easeOutElastic, easeOutExpo, easeOutQuad, easeOutQuart, easeOutQuint, easeOutSine, editAnchorSetTracked, elevateQuadraticToCubic, ellipsePath, ellipseShape, equalizeSegmentHandles, everyNthAnchor, extendToMeet, fillsOpenSubpaths, findPathSnap, findPathSnaps, fitAffine, fitCubicThroughDeletion, fitCubicWithTangents, flatIndexesAfterReverse, flattenCubic, flattenCubicWithArcLen, flattenQuadratic, flattenQuadraticWithArcLen, forEachSegment, growAnchorSelection, growRegion, handleAlongItsAngle, handleAtItsLength, handleBalances, harmonizeAnchors, hasOpenSubpath, identity$1 as identity, intersectSegments, invert$1 as invert, invertAnchorSelection, isSegmentStraight, joinAnchorsAt, joinSubpathEnds, keepCorners, len2, lengthToward, lengthenOpenEnd, lengthenPathEnd, linePath, lineShape, linear, makeHandlesSymmetric, mapConstraintAnchors, mat3, meanScale, measureAnchorPath, measurePath, mergeRegion, moveHandleSymmetric, multiply$1 as multiply, nearestOnCubic, nearestOnLine, nearestOnPath, nearestOnQuadratic, nearestPathAnchor, normalizeZoom, offsetCornerTraces, openEndAt, openEndRay, openPathEnds, pathAnchorPoints, pathAwayFromAnchors, pathCommandCoordCount, pathContainsPoint, pathContainsPolygon, pathContainsRect, pathCrossings, pathDistanceToPoint, pathEndAnchorIndex, pathEndFrame, pathFromD, pathInPoseFrame, pathInWorld, pathIntersectsPolygon, pathIntersectsRect, pathSegments, pathShape, pathSignedArea, pathThroughPoseFrame, pathToCubicContours, pathToD, placeAlongRun, placeRect, pointAlongPath, pointInPath, pointInPolygon, pointSegmentDist2, polygonContainsPath, polygonFromPoints, polygonIntersectsPath, polylineFromPoints, portControls, portCurvePoints, poseFrameInverseOf, poseFrameOf, poseLinearOf, poseRotationOf, prepareBlend, quadraticEvalAt, readAnchorFields, rectMarkerPath, rectPath, rectToContour, regularPolygonPath, remapAnchorValues, remapConstraints, remapPerAnchor, remapPointValues, repeatAlongPath, resamplePath, resolveCorners, resolveCornersWithSources, resolveEasing, restoreCorners, retractHandles, reverseAnchors, reversePath, reverseSubpaths, reviveTypedArrays, rotate, rotateAboutPoint, rotatePathAround, roundRectPath, runLength, runPlaces, runStationAt, scale, scalePathToBounds, scaleSegmentHandles, schneiderFit, segmentBetween, segmentExtremaTs, segmentsBetweenAnchors, segmentsCross, setDefaultOpenFill, setSubpathStart, 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, transformCoords, transformPath, translate, translateAnchorsSymmetric, translatePath, trimPathAt, typedArrayReplacer, unionBoundsPath, unionBox, unsatisfiedConstraints, untagTypedArray, viewToMat3, withAnchorPoints, worldEditToStorage, writeAnchorField };
|