curvy 2.0.0-alpha.16 → 2.0.0-alpha.17

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.
Files changed (63) hide show
  1. package/dist/characteristic/index.mjs +1 -1
  2. package/dist/curve/cubic2d.d.ts +15 -1
  3. package/dist/curve/curve2d.d.ts +8 -0
  4. package/dist/curve/index.mjs +2 -1
  5. package/dist/curve/linear2d.d.ts +15 -1
  6. package/dist/curve/quadratic2d.d.ts +15 -1
  7. package/dist/interval/index.mjs +2 -2
  8. package/dist/matrix/index.mjs +2 -2
  9. package/dist/path/cubic2d.d.ts +41 -0
  10. package/dist/path/index.mjs +3 -304
  11. package/dist/path/linear2d.d.ts +41 -0
  12. package/dist/path/path2d.d.ts +2 -0
  13. package/dist/path/quadratic2d.d.ts +42 -0
  14. package/dist/piecewise/index.d.ts +4 -0
  15. package/dist/piecewise/index.mjs +409 -0
  16. package/dist/piecewise/index.mjs.map +1 -0
  17. package/dist/piecewise/piecewise.d.ts +388 -0
  18. package/dist/piecewise/piecewise.internal.d.ts +2 -0
  19. package/dist/piecewise/traits.d.ts +63 -0
  20. package/dist/polynomial/cubic.d.ts +14 -2
  21. package/dist/polynomial/index.mjs +2 -2
  22. package/dist/polynomial/linear.d.ts +14 -2
  23. package/dist/polynomial/polynomial.d.ts +47 -0
  24. package/dist/polynomial/quadratic.d.ts +14 -2
  25. package/dist/polynomial/traits.d.ts +11 -0
  26. package/dist/shared/{affine2d-Bpn5tc1u.mjs → affine2d-CFfmB3LQ.mjs} +3 -3
  27. package/dist/shared/{affine2d-Bpn5tc1u.mjs.map → affine2d-CFfmB3LQ.mjs.map} +1 -1
  28. package/dist/shared/{characteristic-DQNPi4wd.mjs → characteristic-CL3bnjgJ.mjs} +3 -3
  29. package/dist/shared/{characteristic-DQNPi4wd.mjs.map → characteristic-CL3bnjgJ.mjs.map} +1 -1
  30. package/dist/shared/{cubic-Bly8kxxo.mjs → cubic-EPyClIq0.mjs} +61 -4
  31. package/dist/shared/cubic-EPyClIq0.mjs.map +1 -0
  32. package/dist/shared/{rationalCubic2d-D_TBd-3i.mjs → cubic2d-CI82mN9o.mjs} +291 -944
  33. package/dist/shared/cubic2d-CI82mN9o.mjs.map +1 -0
  34. package/dist/shared/{rationalCubic2d-D9bMCQ8P.mjs → cubic2d-q1HU0uM9.mjs} +104 -141
  35. package/dist/shared/cubic2d-q1HU0uM9.mjs.map +1 -0
  36. package/dist/shared/{interval-Dv6eHXJH.mjs → interval-8-erxD4h.mjs} +2 -2
  37. package/dist/shared/{interval-Dv6eHXJH.mjs.map → interval-8-erxD4h.mjs.map} +1 -1
  38. package/dist/shared/{interval2d-B8wt0szh.mjs → interval2d-CVS66YmV.mjs} +2 -2
  39. package/dist/shared/{interval2d-B8wt0szh.mjs.map → interval2d-CVS66YmV.mjs.map} +1 -1
  40. package/dist/shared/{matrix3x3.internal-CFbYATcm.mjs → matrix3x3.internal-eK-9vsoI.mjs} +2 -2
  41. package/dist/shared/{matrix3x3.internal-CFbYATcm.mjs.map → matrix3x3.internal-eK-9vsoI.mjs.map} +1 -1
  42. package/dist/shared/{matrix4x4-DNcb1l5T.mjs → matrix4x4-DCRpqQsP.mjs} +3 -3
  43. package/dist/shared/{matrix4x4-DNcb1l5T.mjs.map → matrix4x4-DCRpqQsP.mjs.map} +1 -1
  44. package/dist/shared/{quadratic-BBQDu0at.mjs → quadratic-DY3a1MVJ.mjs} +29 -3
  45. package/dist/shared/quadratic-DY3a1MVJ.mjs.map +1 -0
  46. package/dist/shared/quadratic2d-CXlMyyCs.mjs +326 -0
  47. package/dist/shared/quadratic2d-CXlMyyCs.mjs.map +1 -0
  48. package/dist/shared/rationalCubic2d-CGU2mYjs.mjs +103 -0
  49. package/dist/shared/rationalCubic2d-CGU2mYjs.mjs.map +1 -0
  50. package/dist/shared/rationalCubic2d-aT1o6oCm.mjs +720 -0
  51. package/dist/shared/rationalCubic2d-aT1o6oCm.mjs.map +1 -0
  52. package/dist/shared/{solution-Cgq_KclT.mjs → solution-Bi6zCdQH.mjs} +3 -3
  53. package/dist/shared/{solution-Cgq_KclT.mjs.map → solution-Bi6zCdQH.mjs.map} +1 -1
  54. package/dist/solution/index.mjs +1 -1
  55. package/dist/splines/index.mjs +10 -8
  56. package/dist/splines/index.mjs.map +1 -1
  57. package/dist/transform/index.mjs +1 -1
  58. package/package.json +5 -1
  59. package/dist/path/index.mjs.map +0 -1
  60. package/dist/shared/cubic-Bly8kxxo.mjs.map +0 -1
  61. package/dist/shared/quadratic-BBQDu0at.mjs.map +0 -1
  62. package/dist/shared/rationalCubic2d-D9bMCQ8P.mjs.map +0 -1
  63. package/dist/shared/rationalCubic2d-D_TBd-3i.mjs.map +0 -1
@@ -1,2 +1,2 @@
1
- import { n as characteristic_exports } from "../shared/characteristic-DQNPi4wd.mjs";
1
+ import { n as characteristic_exports } from "../shared/characteristic-CL3bnjgJ.mjs";
2
2
  export { characteristic_exports as Characteristic };
@@ -3,7 +3,7 @@ import type { TwoDimensional } from '../dimensions.ts';
3
3
  import type { Closed, Interval } from '../interval/interval.ts';
4
4
  import type { Pipeable } from '../utils.ts';
5
5
  import type { CubicPolynomial } from '../polynomial/cubic.ts';
6
- import type { Decreasing, Increasing, Monotonic } from '../polynomial/traits.ts';
6
+ import type { Decreasing, Increasing, Monotonic, Reflected } from '../polynomial/traits.ts';
7
7
  import type * as Solution from '../solution/solution.ts';
8
8
  import type { Affine2d } from '../transform/affine2d.ts';
9
9
  import type { Vector2 } from '../vector/vector2.ts';
@@ -396,3 +396,17 @@ export declare const transform: {
396
396
  */
397
397
  (a: Affine2d): (c: CubicCurve2d) => CubicCurve2d;
398
398
  };
399
+ /**
400
+ * Reverses the curve's parameter direction, returning the curve traced from
401
+ * `t = 1` back to `t = 0`. The geometric image is identical — the same points
402
+ * in the same places — but the start and end swap and each axis's monotonic
403
+ * sense inverts: an `Increasing` axis becomes `Decreasing` and vice versa
404
+ * (`Reflected`), a bare `Monotonic` axis stays monotonic. Per component this
405
+ * reflects each coordinate polynomial about its domain midpoint
406
+ * (`CubicPolynomial.reflectDomain`).
407
+ *
408
+ * @param c - The cubic curve to reverse.
409
+ * @returns The reversed curve, its per-axis direction brands flipped.
410
+ * @since 2.0.0
411
+ */
412
+ export declare const reverse: <XT, YT>(c: CubicCurve2d<XT, YT>) => CubicCurve2d<Reflected<XT>, Reflected<YT>>;
@@ -78,4 +78,12 @@ export interface Curve2dOps<C> {
78
78
  * denominator. Path-level callers route through this op per curve.
79
79
  */
80
80
  transform(c: C, a: Affine2d): C;
81
+ /**
82
+ * Reverse the curve's parameter direction, returning the curve traced from
83
+ * t = 1 to t = 0. The geometric image is unchanged — start and end swap and
84
+ * any monotonic axis inverts — since per component this reflects each
85
+ * coordinate polynomial about its domain midpoint (`p(1 - u)`). Path-level
86
+ * `reverse` routes through this op per curve.
87
+ */
88
+ reverse(c: C): C;
81
89
  }
@@ -1,2 +1,3 @@
1
- import { i as rationalCubic2d_exports, m as quadratic2d_exports, s as cubic2d_exports, v as linear2d_exports } from "../shared/rationalCubic2d-D_TBd-3i.mjs";
1
+ import { n as cubic2d_exports, p as quadratic2d_exports, y as linear2d_exports } from "../shared/cubic2d-CI82mN9o.mjs";
2
+ import { i as rationalCubic2d_exports } from "../shared/rationalCubic2d-aT1o6oCm.mjs";
2
3
  export { cubic2d_exports as CubicCurve2d, linear2d_exports as LinearCurve2d, quadratic2d_exports as QuadraticCurve2d, rationalCubic2d_exports as RationalCubicCurve2d };
@@ -3,7 +3,7 @@ import type { TwoDimensional } from '../dimensions.ts';
3
3
  import type { Closed, Interval } from '../interval/interval.ts';
4
4
  import type { Pipeable } from '../utils.ts';
5
5
  import type { LinearPolynomial } from '../polynomial/linear.ts';
6
- import type { Decreasing, Increasing, Monotonic } from '../polynomial/traits.ts';
6
+ import type { Decreasing, Increasing, Monotonic, Reflected } from '../polynomial/traits.ts';
7
7
  import type * as Solution from '../solution/solution.ts';
8
8
  import type { Affine2d } from '../transform/affine2d.ts';
9
9
  import type { Vector2 } from '../vector/vector2.ts';
@@ -356,3 +356,17 @@ export declare const transform: {
356
356
  */
357
357
  (a: Affine2d): (c: LinearCurve2d) => LinearCurve2d;
358
358
  };
359
+ /**
360
+ * Reverses the curve's parameter direction, returning the curve traced from
361
+ * `t = 1` back to `t = 0`. The geometric image is identical — the same points
362
+ * in the same places — but the start and end swap and each axis's monotonic
363
+ * sense inverts: an `Increasing` axis becomes `Decreasing` and vice versa
364
+ * (`Reflected`), a bare `Monotonic` axis stays monotonic. Per component this
365
+ * reflects each coordinate polynomial about its domain midpoint
366
+ * (`LinearPolynomial.reflectDomain`).
367
+ *
368
+ * @param c - The linear curve to reverse.
369
+ * @returns The reversed curve, its per-axis direction brands flipped.
370
+ * @since 2.0.0
371
+ */
372
+ export declare const reverse: <XT, YT>(c: LinearCurve2d<XT, YT>) => LinearCurve2d<Reflected<XT>, Reflected<YT>>;
@@ -3,7 +3,7 @@ import type { TwoDimensional } from '../dimensions.ts';
3
3
  import type { Closed, Interval } from '../interval/interval.ts';
4
4
  import type { Pipeable } from '../utils.ts';
5
5
  import type { QuadraticPolynomial } from '../polynomial/quadratic.ts';
6
- import type { Decreasing, Increasing, Monotonic } from '../polynomial/traits.ts';
6
+ import type { Decreasing, Increasing, Monotonic, Reflected } from '../polynomial/traits.ts';
7
7
  import type * as Solution from '../solution/solution.ts';
8
8
  import type { Affine2d } from '../transform/affine2d.ts';
9
9
  import type { Vector2 } from '../vector/vector2.ts';
@@ -402,3 +402,17 @@ export declare const transform: {
402
402
  */
403
403
  (a: Affine2d): (c: QuadraticCurve2d) => QuadraticCurve2d;
404
404
  };
405
+ /**
406
+ * Reverses the curve's parameter direction, returning the curve traced from
407
+ * `t = 1` back to `t = 0`. The geometric image is identical — the same points
408
+ * in the same places — but the start and end swap and each axis's monotonic
409
+ * sense inverts: an `Increasing` axis becomes `Decreasing` and vice versa
410
+ * (`Reflected`), a bare `Monotonic` axis stays monotonic. Per component this
411
+ * reflects each coordinate polynomial about its domain midpoint
412
+ * (`QuadraticPolynomial.reflectDomain`).
413
+ *
414
+ * @param c - The quadratic curve to reverse.
415
+ * @returns The reversed curve, its per-axis direction brands flipped.
416
+ * @since 2.0.0
417
+ */
418
+ export declare const reverse: <XT, YT>(c: QuadraticCurve2d<XT, YT>) => QuadraticCurve2d<Reflected<XT>, Reflected<YT>>;
@@ -1,3 +1,3 @@
1
- import { c as interval_exports } from "../shared/interval-Dv6eHXJH.mjs";
2
- import { n as interval2d_exports } from "../shared/interval2d-B8wt0szh.mjs";
1
+ import { l as interval_exports } from "../shared/interval-8-erxD4h.mjs";
2
+ import { n as interval2d_exports } from "../shared/interval2d-CVS66YmV.mjs";
3
3
  export { interval_exports as Interval, interval2d_exports as Interval2d };
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "../shared/chunk-25Hzd3z8.mjs";
2
- import { A as fromRows$2, B as toRows$2, C as transpose$3, D as determinant$2, E as columnVector$2, F as rowVector$2, H as vectorProductLeft$2, I as setColumn$2, L as setRow$2, M as make$2, N as reverseColumns$2, O as equals$2, P as reverseRows$2, R as solveSystem$2, S as toRows$3, T as vectorProductRight$3, U as vectorProductRight$2, V as transpose$2, _ as rowVector$3, a as fromColumns$3, b as solveSystem$3, c as inverse$1, d as isMatrix3x3$1, f as make$3, g as reverseRows$3, h as reverseColumns$3, i as equals$3, j as isMatrix2x2$1, k as fromColumns$2, l as inverseUnsafe$1, m as multiply$1, n as columnVector$3, o as fromRows$3, p as minor$1, r as determinant$3, s as identity$1, t as asInvertible$1, u as isInvertible$1, v as setColumn$3, w as vectorProductLeft$3, x as toColumns$3, y as setRow$3, z as toColumns$2 } from "../shared/matrix3x3.internal-CFbYATcm.mjs";
3
- import { r as matrix4x4_exports } from "../shared/matrix4x4-DNcb1l5T.mjs";
2
+ import { A as fromRows$2, B as toRows$2, C as transpose$3, D as determinant$2, E as columnVector$2, F as rowVector$2, H as vectorProductLeft$2, I as setColumn$2, L as setRow$2, M as make$2, N as reverseColumns$2, O as equals$2, P as reverseRows$2, R as solveSystem$2, S as toRows$3, T as vectorProductRight$3, U as vectorProductRight$2, V as transpose$2, _ as rowVector$3, a as fromColumns$3, b as solveSystem$3, c as inverse$1, d as isMatrix3x3$1, f as make$3, g as reverseRows$3, h as reverseColumns$3, i as equals$3, j as isMatrix2x2$1, k as fromColumns$2, l as inverseUnsafe$1, m as multiply$1, n as columnVector$3, o as fromRows$3, p as minor$1, r as determinant$3, s as identity$1, t as asInvertible$1, u as isInvertible$1, v as setColumn$3, w as vectorProductLeft$3, x as toColumns$3, y as setRow$3, z as toColumns$2 } from "../shared/matrix3x3.internal-eK-9vsoI.mjs";
3
+ import { r as matrix4x4_exports } from "../shared/matrix4x4-DCRpqQsP.mjs";
4
4
  //#region src/matrix/matrix2x2.ts
5
5
  var matrix2x2_exports = /* @__PURE__ */ __exportAll({
6
6
  columnVector: () => columnVector$1,
@@ -67,6 +67,33 @@ export declare const append: {
67
67
  */
68
68
  (p: CubicPath2d, c: CubicCurve2d): CubicPath2d;
69
69
  };
70
+ export declare const appendContinuous: {
71
+ /**
72
+ * Appends a cubic curve to a `Continuous` path, preserving the brand.
73
+ *
74
+ * @param c - The cubic curve to append.
75
+ * @returns A function that takes a `Continuous` cubic path and returns a new one with the curve appended.
76
+ * @since 2.0.0
77
+ */
78
+ (c: CubicCurve2d): (p: CubicPath2d<Continuous>) => CubicPath2d<Continuous>;
79
+ /**
80
+ * Appends a cubic curve to a `Continuous` cubic path, preserving the brand.
81
+ * The curve's start point must coincide with the path's current end point
82
+ * (G^0 continuity), compared with `coincident` tolerance (see `PRECISION.md`).
83
+ *
84
+ * Only the new join is checked — the input's `Continuous` brand already
85
+ * vouches for the rest. Other trait brands are dropped, since a new curve can
86
+ * still reverse an axis and break monotonicity; reassert them with the
87
+ * relevant refiner if needed.
88
+ *
89
+ * @param p - A continuous cubic path.
90
+ * @param c - The cubic curve to append.
91
+ * @returns A new `Continuous` cubic path with the curve appended.
92
+ * @throws `Error` when the curve does not connect to the path's end point.
93
+ * @since 2.0.0
94
+ */
95
+ (p: CubicPath2d<Continuous>, c: CubicCurve2d): CubicPath2d<Continuous>;
96
+ };
70
97
  /**
71
98
  * Calculates the total arc length of a cubic path.
72
99
  *
@@ -349,3 +376,17 @@ export declare const transform: {
349
376
  */
350
377
  (a: Affine2d): (p: CubicPath2d) => CubicPath2d;
351
378
  };
379
+ /**
380
+ * Reverses the path, returning it traced end-to-start: the segment order is
381
+ * reversed and each segment's parameter direction flipped. The geometric image
382
+ * is identical. `Continuous` survives the reversal in substance but, like every
383
+ * brand, is dropped from the type — reversal turns `IncreasingX` into
384
+ * `DecreasingX` (and likewise on the y axis), so the direction brands cannot
385
+ * carry through. Reassert what still holds with `isContinuous`, `isIncreasingX`,
386
+ * and their siblings.
387
+ *
388
+ * @param p - The path to reverse.
389
+ * @returns The reversed path, with all trait brands dropped.
390
+ * @since 2.0.0
391
+ */
392
+ export declare const reverse: (p: CubicPath2d) => CubicPath2d;
@@ -1,305 +1,4 @@
1
- import { t as __exportAll } from "../shared/chunk-25Hzd3z8.mjs";
2
- import { invariant } from "../utils.mjs";
3
- import { g as Ops } from "../shared/rationalCubic2d-D_TBd-3i.mjs";
4
- import { n as rationalCubic2d_exports, o as linear2d_exports, r as cubic2d_exports, s as makeMethods } from "../shared/rationalCubic2d-D9bMCQ8P.mjs";
5
- //#region src/path/quadratic2d.internal.ts
6
- const QuadraticPath2dTypeId = Symbol("curvy/path/quadratic2d");
7
- const methods = makeMethods(QuadraticPath2dTypeId, Ops);
8
- /** @internal */
9
- const isQuadraticPath2d$1 = (p) => typeof p === "object" && p !== null && QuadraticPath2dTypeId in p;
10
- /** @internal */
11
- const make$1 = methods.make;
12
- /** @internal */
13
- const fromArray$1 = methods.fromArray;
14
- /** @internal */
15
- const append$1 = methods.append;
16
- /** @internal */
17
- const length$1 = methods.length;
18
- /** @internal */
19
- const solve$1 = methods.solve;
20
- /** @internal */
21
- const toPathData$1 = methods.toPathData;
22
- /** @internal */
23
- const isContinuous$1 = methods.isContinuous;
24
- /** @internal */
25
- const asContinuous$1 = (p) => {
26
- invariant(isContinuous$1(p), "quadratic path is not continuous");
27
- return p;
28
- };
29
- /** @internal */
30
- const isIncreasingX$1 = methods.isIncreasingX;
31
- /** @internal */
32
- const isDecreasingX$1 = methods.isDecreasingX;
33
- /** @internal */
34
- const isMonotonicX$1 = methods.isMonotonicX;
35
- /** @internal */
36
- const isIncreasingY$1 = methods.isIncreasingY;
37
- /** @internal */
38
- const isDecreasingY$1 = methods.isDecreasingY;
39
- /** @internal */
40
- const isMonotonicY$1 = methods.isMonotonicY;
41
- /** @internal */
42
- const asIncreasingX$1 = (p) => {
43
- invariant(isIncreasingX$1(p), "quadratic path is not increasing in x");
44
- return p;
45
- };
46
- /** @internal */
47
- const asDecreasingX$1 = (p) => {
48
- invariant(isDecreasingX$1(p), "quadratic path is not decreasing in x");
49
- return p;
50
- };
51
- /** @internal */
52
- const asMonotonicX$1 = (p) => {
53
- invariant(isMonotonicX$1(p), "quadratic path is not monotonic in x");
54
- return p;
55
- };
56
- /** @internal */
57
- const asIncreasingY$1 = (p) => {
58
- invariant(isIncreasingY$1(p), "quadratic path is not increasing in y");
59
- return p;
60
- };
61
- /** @internal */
62
- const asDecreasingY$1 = (p) => {
63
- invariant(isDecreasingY$1(p), "quadratic path is not decreasing in y");
64
- return p;
65
- };
66
- /** @internal */
67
- const asMonotonicY$1 = (p) => {
68
- invariant(isMonotonicY$1(p), "quadratic path is not monotonic in y");
69
- return p;
70
- };
71
- /** @internal */
72
- const solveAtX$1 = methods.solveAtX;
73
- /** @internal */
74
- const solveAtY$1 = methods.solveAtY;
75
- /** @internal */
76
- const boundingBox$1 = methods.boundingBox;
77
- /** @internal */
78
- const transform$1 = methods.transform;
79
- //#endregion
80
- //#region src/path/quadratic2d.ts
81
- var quadratic2d_exports = /* @__PURE__ */ __exportAll({
82
- append: () => append,
83
- asContinuous: () => asContinuous,
84
- asDecreasingX: () => asDecreasingX,
85
- asDecreasingY: () => asDecreasingY,
86
- asIncreasingX: () => asIncreasingX,
87
- asIncreasingY: () => asIncreasingY,
88
- asMonotonicX: () => asMonotonicX,
89
- asMonotonicY: () => asMonotonicY,
90
- boundingBox: () => boundingBox,
91
- fromArray: () => fromArray,
92
- isContinuous: () => isContinuous,
93
- isDecreasingX: () => isDecreasingX,
94
- isDecreasingY: () => isDecreasingY,
95
- isIncreasingX: () => isIncreasingX,
96
- isIncreasingY: () => isIncreasingY,
97
- isMonotonicX: () => isMonotonicX,
98
- isMonotonicY: () => isMonotonicY,
99
- isQuadraticPath2d: () => isQuadraticPath2d,
100
- length: () => length,
101
- make: () => make,
102
- solve: () => solve,
103
- solveAtX: () => solveAtX,
104
- solveAtY: () => solveAtY,
105
- toPathData: () => toPathData,
106
- transform: () => transform
107
- });
108
- /**
109
- * Creates a new `QuadraticPath2d` instance from a sequence of curves.
110
- *
111
- * @param curves - The curves to create the path from. At least one is required.
112
- * @returns A new `QuadraticPath2d` instance.
113
- * @throws `Error` when called with no curves.
114
- * @since 2.0.0
115
- */
116
- const make = make$1;
117
- /**
118
- * Creates a new `QuadraticPath2d` instance from an array of curves.
119
- *
120
- * @param curves - The curves to create the path from. At least one is required.
121
- * @returns A new `QuadraticPath2d` instance.
122
- * @throws `Error` when the array is empty.
123
- * @since 2.0.0
124
- */
125
- const fromArray = fromArray$1;
126
- /**
127
- * Checks if a value is a `QuadraticPath2d`.
128
- *
129
- * @param p - The value to check.
130
- * @returns `true` if the value is a `QuadraticPath2d`, `false` otherwise.
131
- * @since 1.0.0
132
- */
133
- const isQuadraticPath2d = isQuadraticPath2d$1;
134
- const append = append$1;
135
- /**
136
- * Calculates the total arc length of a quadratic path.
137
- *
138
- * @param p - The quadratic path to measure.
139
- * @returns The sum of the segments' arc lengths.
140
- * @since 1.0.0
141
- */
142
- const length = length$1;
143
- const solve = solve$1;
144
- /**
145
- * Serializes a quadratic path as an SVG path data string (the value of a
146
- * `<path>` element's `d` attribute), using `M` and `Q` commands. Discontinuities
147
- * between curves emit a fresh `M` command.
148
- *
149
- * @param p - The quadratic path to serialize.
150
- * @returns The SVG path data string.
151
- * @since 2.0.0
152
- */
153
- const toPathData = toPathData$1;
154
- /**
155
- * Checks if adjacent curves connect at their join points (G^0 continuity),
156
- * each junction compared with `coincident` tolerance (see `PRECISION.md`),
157
- * adding `Continuous` to the path's traits.
158
- *
159
- * @param p - The quadratic path to check.
160
- * @returns `true` when every junction connects, narrowing to `QuadraticPath2d<T & Continuous>`.
161
- * @since 2.0.0
162
- */
163
- const isContinuous = isContinuous$1;
164
- /**
165
- * Asserts that the quadratic path is continuous, throwing on failure.
166
- *
167
- * @param p - The quadratic path to assert against.
168
- * @returns The same path, with `Continuous` added to its traits.
169
- * @throws `Error` when adjacent curves do not connect.
170
- * @since 2.0.0
171
- */
172
- const asContinuous = asContinuous$1;
173
- /**
174
- * Checks if the path's x-coordinate increases as the path parameter
175
- * advances. Every segment's x polynomial is strictly increasing on
176
- * `[0, 1]` and adjacent segments' x-ranges don't overlap. Adds
177
- * `IncreasingX` to the path's traits.
178
- *
179
- * @param p - The quadratic path to check.
180
- * @returns `true` when x increases along the path, narrowing to `QuadraticPath2d<T & IncreasingX>`.
181
- * @since 2.0.0
182
- */
183
- const isIncreasingX = isIncreasingX$1;
184
- /**
185
- * Checks if the path's x-coordinate decreases as the path parameter
186
- * advances. Every segment's x polynomial is strictly decreasing on
187
- * `[0, 1]` and adjacent segments' x-ranges don't overlap. Adds
188
- * `DecreasingX` to the path's traits.
189
- *
190
- * @param p - The quadratic path to check.
191
- * @returns `true` when x decreases along the path, narrowing to `QuadraticPath2d<T & DecreasingX>`.
192
- * @since 2.0.0
193
- */
194
- const isDecreasingX = isDecreasingX$1;
195
- /**
196
- * Checks if the path's x-coordinate is monotonic (increasing or
197
- * decreasing) as the path parameter advances, the property the brand
198
- * `solveAtX` requires. Adds `MonotonicX` to the path's traits.
199
- *
200
- * @param p - The quadratic path to check.
201
- * @returns `true` when x is monotonic along the path, narrowing to `QuadraticPath2d<T & MonotonicX>`.
202
- * @since 2.0.0
203
- */
204
- const isMonotonicX = isMonotonicX$1;
205
- /**
206
- * Checks if the path's y-coordinate increases as the path parameter
207
- * advances. Every segment's y polynomial is strictly increasing on
208
- * `[0, 1]` and adjacent segments' y-ranges don't overlap. Adds
209
- * `IncreasingY` to the path's traits.
210
- *
211
- * @param p - The quadratic path to check.
212
- * @returns `true` when y increases along the path, narrowing to `QuadraticPath2d<T & IncreasingY>`.
213
- * @since 2.0.0
214
- */
215
- const isIncreasingY = isIncreasingY$1;
216
- /**
217
- * Checks if the path's y-coordinate decreases as the path parameter
218
- * advances. Every segment's y polynomial is strictly decreasing on
219
- * `[0, 1]` and adjacent segments' y-ranges don't overlap. Adds
220
- * `DecreasingY` to the path's traits.
221
- *
222
- * @param p - The quadratic path to check.
223
- * @returns `true` when y decreases along the path, narrowing to `QuadraticPath2d<T & DecreasingY>`.
224
- * @since 2.0.0
225
- */
226
- const isDecreasingY = isDecreasingY$1;
227
- /**
228
- * Checks if the path's y-coordinate is monotonic (increasing or
229
- * decreasing) as the path parameter advances, the property the brand
230
- * `solveAtY` requires. Adds `MonotonicY` to the path's traits.
231
- *
232
- * @param p - The quadratic path to check.
233
- * @returns `true` when y is monotonic along the path, narrowing to `QuadraticPath2d<T & MonotonicY>`.
234
- * @since 2.0.0
235
- */
236
- const isMonotonicY = isMonotonicY$1;
237
- /**
238
- * Asserts that the path is strictly increasing in x, throwing on failure.
239
- *
240
- * @param p - The quadratic path to assert against.
241
- * @returns The same path, with `IncreasingX` added to its traits.
242
- * @throws `Error` when the path is not strictly increasing in x.
243
- * @since 2.0.0
244
- */
245
- const asIncreasingX = asIncreasingX$1;
246
- /**
247
- * Asserts that the path is strictly decreasing in x, throwing on failure.
248
- *
249
- * @param p - The quadratic path to assert against.
250
- * @returns The same path, with `DecreasingX` added to its traits.
251
- * @throws `Error` when the path is not strictly decreasing in x.
252
- * @since 2.0.0
253
- */
254
- const asDecreasingX = asDecreasingX$1;
255
- /**
256
- * Asserts that the path is monotonic in x, throwing on failure.
257
- *
258
- * @param p - The quadratic path to assert against.
259
- * @returns The same path, with `MonotonicX` added to its traits.
260
- * @throws `Error` when the path is not monotonic in x.
261
- * @since 2.0.0
262
- */
263
- const asMonotonicX = asMonotonicX$1;
264
- /**
265
- * Asserts that the path is strictly increasing in y, throwing on failure.
266
- *
267
- * @param p - The quadratic path to assert against.
268
- * @returns The same path, with `IncreasingY` added to its traits.
269
- * @throws `Error` when the path is not strictly increasing in y.
270
- * @since 2.0.0
271
- */
272
- const asIncreasingY = asIncreasingY$1;
273
- /**
274
- * Asserts that the path is strictly decreasing in y, throwing on failure.
275
- *
276
- * @param p - The quadratic path to assert against.
277
- * @returns The same path, with `DecreasingY` added to its traits.
278
- * @throws `Error` when the path is not strictly decreasing in y.
279
- * @since 2.0.0
280
- */
281
- const asDecreasingY = asDecreasingY$1;
282
- /**
283
- * Asserts that the path is monotonic in y, throwing on failure.
284
- *
285
- * @param p - The quadratic path to assert against.
286
- * @returns The same path, with `MonotonicY` added to its traits.
287
- * @throws `Error` when the path is not monotonic in y.
288
- * @since 2.0.0
289
- */
290
- const asMonotonicY = asMonotonicY$1;
291
- const solveAtX = solveAtX$1;
292
- const solveAtY = solveAtY$1;
293
- /**
294
- * Computes the axis-aligned bounding box of the path.
295
- *
296
- * @param p - The quadratic path.
297
- * @returns The smallest closed `Interval2d` enclosing every segment.
298
- * @since 2.0.0
299
- */
300
- const boundingBox = boundingBox$1;
301
- const transform = transform$1;
302
- //#endregion
1
+ import { f as linear2d_exports, r as cubic2d_exports } from "../shared/cubic2d-q1HU0uM9.mjs";
2
+ import { a as quadratic2d_exports } from "../shared/quadratic2d-CXlMyyCs.mjs";
3
+ import { n as rationalCubic2d_exports } from "../shared/rationalCubic2d-CGU2mYjs.mjs";
303
4
  export { cubic2d_exports as CubicPath2d, linear2d_exports as LinearPath2d, quadratic2d_exports as QuadraticPath2d, rationalCubic2d_exports as RationalCubicPath2d };
304
-
305
- //# sourceMappingURL=index.mjs.map
@@ -68,6 +68,33 @@ export declare const append: {
68
68
  */
69
69
  (p: LinearPath2d, c: LinearCurve2d): LinearPath2d;
70
70
  };
71
+ export declare const appendContinuous: {
72
+ /**
73
+ * Appends a linear curve to a `Continuous` path, preserving the brand.
74
+ *
75
+ * @param c - The linear curve to append.
76
+ * @returns A function that takes a `Continuous` linear path and returns a new one with the curve appended.
77
+ * @since 2.0.0
78
+ */
79
+ (c: LinearCurve2d): (p: LinearPath2d<Continuous>) => LinearPath2d<Continuous>;
80
+ /**
81
+ * Appends a linear curve to a `Continuous` linear path, preserving the brand.
82
+ * The curve's start point must coincide with the path's current end point
83
+ * (G^0 continuity), compared with `coincident` tolerance (see `PRECISION.md`).
84
+ *
85
+ * Only the new join is checked — the input's `Continuous` brand already
86
+ * vouches for the rest. Other trait brands are dropped, since a new curve can
87
+ * still reverse an axis and break monotonicity; reassert them with the
88
+ * relevant refiner if needed.
89
+ *
90
+ * @param p - A continuous linear path.
91
+ * @param c - The linear curve to append.
92
+ * @returns A new `Continuous` linear path with the curve appended.
93
+ * @throws `Error` when the curve does not connect to the path's end point.
94
+ * @since 2.0.0
95
+ */
96
+ (p: LinearPath2d<Continuous>, c: LinearCurve2d): LinearPath2d<Continuous>;
97
+ };
71
98
  /**
72
99
  * Calculates the total arc length of a linear path.
73
100
  *
@@ -326,3 +353,17 @@ export declare const transform: {
326
353
  */
327
354
  (a: Affine2d): (p: LinearPath2d) => LinearPath2d;
328
355
  };
356
+ /**
357
+ * Reverses the path, returning it traced end-to-start: the segment order is
358
+ * reversed and each segment's parameter direction flipped. The geometric image
359
+ * is identical. `Continuous` survives the reversal in substance but, like every
360
+ * brand, is dropped from the type — reversal turns `IncreasingX` into
361
+ * `DecreasingX` (and likewise on the y axis), so the direction brands cannot
362
+ * carry through. Reassert what still holds with `isContinuous`, `isIncreasingX`,
363
+ * and their siblings.
364
+ *
365
+ * @param p - The path to reverse.
366
+ * @returns The reversed path, with all trait brands dropped.
367
+ * @since 2.0.0
368
+ */
369
+ export declare const reverse: (p: LinearPath2d) => LinearPath2d;
@@ -39,6 +39,7 @@ export declare const makeMethods: <C>(typeId: symbol, ops: Curve2dOps<C>) => {
39
39
  fromArray: (curves: ReadonlyArray<C>) => Path2d<C>;
40
40
  make: (...curves: ReadonlyArray<C>) => Path2d<C>;
41
41
  append: ((c: C) => (p: Path2d<C>) => Path2d<C>) & ((p: Path2d<C>, c: C) => Path2d<C>);
42
+ appendContinuous: ((c: C) => (p: Path2d<C, Continuous>) => Path2d<C, Continuous>) & ((p: Path2d<C, Continuous>, c: C) => Path2d<C, Continuous>);
42
43
  length: (p: Path2d<C>) => number;
43
44
  solve: ((u: number) => (p: Path2d<C>) => Vector2) & ((p: Path2d<C>, u: number) => Vector2);
44
45
  toPathData: (p: Path2d<C>) => string;
@@ -53,4 +54,5 @@ export declare const makeMethods: <C>(typeId: symbol, ops: Curve2dOps<C>) => {
53
54
  solveAtY: ((...args: Array<any>) => any) & ((p: Path2d<C>, y: number) => Solution.AtMostOne<number>);
54
55
  boundingBox: (p: Path2d<C>) => Interval2d.Interval2d<Interval.Closed, Interval.Closed>;
55
56
  transform: ((a: Affine2d) => (p: Path2d<C>) => Path2d<C>) & ((p: Path2d<C>, a: Affine2d) => Path2d<C>);
57
+ reverse: (p: Path2d<C>) => Path2d<C>;
56
58
  };
@@ -67,6 +67,34 @@ export declare const append: {
67
67
  */
68
68
  (p: QuadraticPath2d, c: QuadraticCurve2d): QuadraticPath2d;
69
69
  };
70
+ export declare const appendContinuous: {
71
+ /**
72
+ * Appends a quadratic curve to a `Continuous` path, preserving the brand.
73
+ *
74
+ * @param c - The quadratic curve to append.
75
+ * @returns A function that takes a `Continuous` quadratic path and returns a new one with the curve appended.
76
+ * @since 2.0.0
77
+ */
78
+ (c: QuadraticCurve2d): (p: QuadraticPath2d<Continuous>) => QuadraticPath2d<Continuous>;
79
+ /**
80
+ * Appends a quadratic curve to a `Continuous` quadratic path, preserving the
81
+ * brand. The curve's start point must coincide with the path's current end
82
+ * point (G^0 continuity), compared with `coincident` tolerance (see
83
+ * `PRECISION.md`).
84
+ *
85
+ * Only the new join is checked — the input's `Continuous` brand already
86
+ * vouches for the rest. Other trait brands are dropped, since a new curve can
87
+ * still reverse an axis and break monotonicity; reassert them with the
88
+ * relevant refiner if needed.
89
+ *
90
+ * @param p - A continuous quadratic path.
91
+ * @param c - The quadratic curve to append.
92
+ * @returns A new `Continuous` quadratic path with the curve appended.
93
+ * @throws `Error` when the curve does not connect to the path's end point.
94
+ * @since 2.0.0
95
+ */
96
+ (p: QuadraticPath2d<Continuous>, c: QuadraticCurve2d): QuadraticPath2d<Continuous>;
97
+ };
70
98
  /**
71
99
  * Calculates the total arc length of a quadratic path.
72
100
  *
@@ -321,3 +349,17 @@ export declare const transform: {
321
349
  */
322
350
  (a: Affine2d): (p: QuadraticPath2d) => QuadraticPath2d;
323
351
  };
352
+ /**
353
+ * Reverses the path, returning it traced end-to-start: the segment order is
354
+ * reversed and each segment's parameter direction flipped. The geometric image
355
+ * is identical. `Continuous` survives the reversal in substance but, like every
356
+ * brand, is dropped from the type — reversal turns `IncreasingX` into
357
+ * `DecreasingX` (and likewise on the y axis), so the direction brands cannot
358
+ * carry through. Reassert what still holds with `isContinuous`, `isIncreasingX`,
359
+ * and their siblings.
360
+ *
361
+ * @param p - The path to reverse.
362
+ * @returns The reversed path, with all trait brands dropped.
363
+ * @since 2.0.0
364
+ */
365
+ export declare const reverse: (p: QuadraticPath2d) => QuadraticPath2d;
@@ -0,0 +1,4 @@
1
+ import * as PiecewiseNs from './piecewise.ts';
2
+ export type Piecewise<P, Trait = unknown> = PiecewiseNs.Piecewise<P, Trait>;
3
+ export type Piece<P> = PiecewiseNs.Piece<P>;
4
+ export { PiecewiseNs as Piecewise };