curvy 2.0.0-alpha.4 → 2.0.0-alpha.5

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 (64) hide show
  1. package/dist/characteristic/{index.d.mts → characteristic.d.ts} +9 -17
  2. package/dist/characteristic/index.d.ts +1 -0
  3. package/dist/curve/cubic2d.d.ts +219 -0
  4. package/dist/curve/index.d.ts +12 -0
  5. package/dist/curve/linear2d.d.ts +199 -0
  6. package/dist/curve/quadratic2d.d.ts +227 -0
  7. package/dist/curve/rationalCubic2d.d.ts +200 -0
  8. package/dist/dimensions.d.ts +23 -0
  9. package/dist/interval/index.d.ts +6 -0
  10. package/dist/interval/interval.d.ts +525 -0
  11. package/dist/interval/interval2d.d.ts +167 -0
  12. package/dist/length.d.ts +32 -0
  13. package/dist/matrix/index.d.ts +9 -0
  14. package/dist/matrix/matrix2x2.d.ts +339 -0
  15. package/dist/matrix/matrix3x3.d.ts +400 -0
  16. package/dist/matrix/matrix4x4.d.ts +443 -0
  17. package/dist/number.d.ts +276 -0
  18. package/dist/path/cubic2d.d.ts +155 -0
  19. package/dist/path/index.d.ts +12 -0
  20. package/dist/path/linear2d.d.ts +135 -0
  21. package/dist/path/quadratic2d.d.ts +127 -0
  22. package/dist/path/rationalCubic2d.d.ts +120 -0
  23. package/dist/path/traits.d.ts +31 -0
  24. package/dist/polynomial/cubic.d.ts +381 -0
  25. package/dist/polynomial/index.d.ts +9 -0
  26. package/dist/polynomial/linear.d.ts +321 -0
  27. package/dist/polynomial/monotonicity.d.ts +3 -0
  28. package/dist/polynomial/quadratic.d.ts +375 -0
  29. package/dist/polynomial/traits.d.ts +56 -0
  30. package/dist/solution/index.d.ts +3 -0
  31. package/dist/solution/solution.d.ts +264 -0
  32. package/dist/splines/basis2d.d.ts +122 -0
  33. package/dist/splines/bezier2d.d.ts +202 -0
  34. package/dist/splines/cardinal2d.d.ts +273 -0
  35. package/dist/splines/hermite2d.d.ts +117 -0
  36. package/dist/splines/index.d.ts +15 -0
  37. package/dist/splines/rationalBezier2d.d.ts +148 -0
  38. package/dist/splines/util.d.ts +5 -0
  39. package/dist/utils.d.ts +73 -0
  40. package/dist/vector/index.d.ts +9 -0
  41. package/dist/vector/vector2.d.ts +446 -0
  42. package/dist/vector/vector3.d.ts +449 -0
  43. package/dist/vector/vector4.d.ts +253 -0
  44. package/package.json +13 -13
  45. package/dist/curve/index.d.mts +0 -10
  46. package/dist/interval/index.d.mts +0 -9
  47. package/dist/matrix/index.d.mts +0 -9
  48. package/dist/number.d.mts +0 -280
  49. package/dist/path/index.d.mts +0 -53
  50. package/dist/polynomial/index.d.mts +0 -9
  51. package/dist/shared/cubic-DkBqcZf-.d.mts +0 -121
  52. package/dist/shared/interval-Bhzeqp8M.d.mts +0 -62
  53. package/dist/shared/interval2d-BMk5UYXD.d.mts +0 -29
  54. package/dist/shared/matrix4x4-CaytTaB_.d.mts +0 -168
  55. package/dist/shared/rationalCubic2d-D-UevGKu.d.mts +0 -60
  56. package/dist/shared/rationalCubic2d-MgMSJaAU.d.mts +0 -104
  57. package/dist/shared/solution-DInDT2Hq.d.mts +0 -60
  58. package/dist/shared/utils-MCckigYk.d.mts +0 -76
  59. package/dist/shared/vector2-euuV_bNQ.d.mts +0 -58
  60. package/dist/shared/vector3-3Xx7GVk7.d.mts +0 -37
  61. package/dist/solution/index.d.mts +0 -7
  62. package/dist/splines/index.d.mts +0 -132
  63. package/dist/utils.d.mts +0 -2
  64. package/dist/vector/index.d.mts +0 -10
@@ -0,0 +1,155 @@
1
+ import type { Interval2d } from '../interval/interval2d';
2
+ import type { CubicCurve2d } from '../curve/cubic2d';
3
+ import type { Closed } from '../interval/interval';
4
+ import type { Pipeable } from '../utils';
5
+ import type { Vector2 } from '../vector/vector2';
6
+
7
+ import type { Continuous, PathTraits } from './traits';
8
+
9
+ declare const CubicPath2dTypeId: unique symbol;
10
+ type CubicPath2dTypeId = typeof CubicPath2dTypeId;
11
+
12
+ export type { Continuous } from './traits';
13
+ /**
14
+ * A cubic path in 2D space.
15
+ *
16
+ * All fields are readonly and immutable, and all operations create new instances.
17
+ *
18
+ * The `Trait` type parameter accumulates trait brands as the path is refined
19
+ * via `isContinuous` / `asContinuous`.
20
+ *
21
+ * @since 1.0.0
22
+ */
23
+ export interface CubicPath2d<out Trait = unknown> extends Pipeable, Iterable<CubicCurve2d> {
24
+ readonly [CubicPath2dTypeId]: CubicPath2dTypeId;
25
+ readonly [PathTraits]: Trait;
26
+ }
27
+ /**
28
+ * Creates a new `CubicPath2d` instance from a sequence of curves.
29
+ *
30
+ * @param curves - The curves to create the path from.
31
+ * @returns A new `CubicPath2d` instance.
32
+ * @since 2.0.0
33
+ */
34
+ export declare const make: (...curves: ReadonlyArray<CubicCurve2d>) => CubicPath2d;
35
+ /**
36
+ * Creates a new `CubicPath2d` instance from an array of curves.
37
+ *
38
+ * @param curves - The curves to create the path from.
39
+ * @returns A new `CubicPath2d` instance.
40
+ * @since 2.0.0
41
+ */
42
+ export declare const fromArray: (curves: ReadonlyArray<CubicCurve2d>) => CubicPath2d;
43
+ /**
44
+ * Checks if a value is a `CubicPath2d`.
45
+ *
46
+ * @param p - The value to check.
47
+ * @returns `true` if the value is a `CubicPath2d`, `false` otherwise.
48
+ * @since 1.0.0
49
+ */
50
+ export declare const isCubicPath2d: (p: unknown) => p is CubicPath2d;
51
+ export declare const append: {
52
+ /**
53
+ * Appends a cubic curve to a cubic path.
54
+ *
55
+ * @param c - The cubic curve to append.
56
+ * @returns A function that takes a cubic path and returns a new cubic path.
57
+ * @since 1.0.0
58
+ */
59
+ (c: CubicCurve2d): (p: CubicPath2d) => CubicPath2d;
60
+ /**
61
+ * Appends a cubic curve to a cubic path.
62
+ *
63
+ * @param p - The cubic path to append to.
64
+ * @param c - The cubic curve to append.
65
+ * @returns A new cubic path.
66
+ * @since 1.0.0
67
+ */
68
+ (p: CubicPath2d, c: CubicCurve2d): CubicPath2d;
69
+ };
70
+ /**
71
+ * Calculates the length of a cubic path.
72
+ *
73
+ * @param p - The cubic path to calculate the length of.
74
+ * @returns The length of the cubic path.
75
+ * @since 1.0.0
76
+ */
77
+ export declare const length: (p: CubicPath2d) => number;
78
+ export declare const solve: {
79
+ /**
80
+ * Solves a cubic path for a given parameter.
81
+ *
82
+ * @param u - The parameter to solve for.
83
+ * @returns A function that takes a cubic path and returns the solved vector.
84
+ * @since 1.0.0
85
+ */
86
+ (u: number): (p: CubicPath2d) => Vector2;
87
+ /**
88
+ * Solves a cubic path for a given parameter.
89
+ *
90
+ * @param p - The cubic path to solve.
91
+ * @param u - The parameter to solve for.
92
+ * @returns The solved vector.
93
+ * @since 1.0.0
94
+ */
95
+ (p: CubicPath2d, u: number): Vector2;
96
+ };
97
+ /**
98
+ * Serializes a cubic path as an SVG path data string (the value of a `<path>`
99
+ * element's `d` attribute), using `M` and `C` commands. Discontinuities between
100
+ * curves emit a fresh `M` command.
101
+ *
102
+ * @param p - The cubic path to serialize.
103
+ * @returns The SVG path data string.
104
+ * @since 2.0.0
105
+ */
106
+ export declare const toPathData: (p: CubicPath2d) => string;
107
+ /**
108
+ * Type-narrowing predicate: refines `CubicPath2d<T>` to
109
+ * `CubicPath2d<T & Continuous>` when adjacent curves connect.
110
+ *
111
+ * @since 2.0.0
112
+ */
113
+ export declare const isContinuous: <T>(p: CubicPath2d<T>) => p is CubicPath2d<T & Continuous>;
114
+ /**
115
+ * Asserts that the cubic path is continuous, throwing on failure.
116
+ *
117
+ * @since 2.0.0
118
+ */
119
+ export declare const asContinuous: <T>(p: CubicPath2d<T>) => CubicPath2d<T & Continuous>;
120
+ export declare const solveByDistance: {
121
+ /**
122
+ * Solves a cubic path by normalized arc length. Unlike {@link solve}, which
123
+ * is parameterized by curve `u`, this samples points at constant speed along
124
+ * the path — `s = 0.5` returns the point exactly halfway along the curve by
125
+ * arc length, regardless of how the underlying parameterization stretches.
126
+ *
127
+ * Cumulative segment lengths are cached by path identity so repeated calls
128
+ * with the same path are fast.
129
+ *
130
+ * @param p - The cubic path to sample.
131
+ * @param s - Normalized arc length in `[0, 1]`. Values outside the range are
132
+ * clamped to path endpoints.
133
+ * @returns The point on the path at the given normalized arc length.
134
+ * @since 1.1.0
135
+ */
136
+ (p: CubicPath2d, s: number): Vector2;
137
+ /**
138
+ * Solves a cubic path by normalized arc length.
139
+ *
140
+ * @param s - Normalized arc length in `[0, 1]`.
141
+ * @returns A function that takes a cubic path and returns the point at that
142
+ * arc length.
143
+ * @since 1.1.0
144
+ */
145
+ (s: number): (p: CubicPath2d) => Vector2;
146
+ };
147
+ /**
148
+ * Computes the axis-aligned bounding box of the path — the smallest closed
149
+ * `Box2d` enclosing every segment.
150
+ *
151
+ * @param p - The cubic path.
152
+ * @returns A closed `Box2d` enclosing the path.
153
+ * @since 2.0.0
154
+ */
155
+ export declare const boundingBox: (p: CubicPath2d) => Interval2d<Closed, Closed>;
@@ -0,0 +1,12 @@
1
+ import * as LinearPath2dNs from './linear2d';
2
+ import * as QuadraticPath2dNs from './quadratic2d';
3
+ import * as CubicPath2dNs from './cubic2d';
4
+ import * as RationalCubicPath2dNs from './rationalCubic2d';
5
+ export { LinearPath2dNs as LinearPath2d };
6
+ export type LinearPath2d = LinearPath2dNs.LinearPath2d;
7
+ export { QuadraticPath2dNs as QuadraticPath2d };
8
+ export type QuadraticPath2d = QuadraticPath2dNs.QuadraticPath2d;
9
+ export { CubicPath2dNs as CubicPath2d };
10
+ export type CubicPath2d = CubicPath2dNs.CubicPath2d;
11
+ export { RationalCubicPath2dNs as RationalCubicPath2d };
12
+ export type RationalCubicPath2d = RationalCubicPath2dNs.RationalCubicPath2d;
@@ -0,0 +1,135 @@
1
+ import type { Interval2d } from '../interval/interval2d';
2
+ import type { LinearCurve2d } from '../curve/linear2d';
3
+ import type { Closed } from '../interval/interval';
4
+ import type { Pipeable } from '../utils';
5
+ import type { Vector2 } from '../vector/vector2';
6
+
7
+ import type { Continuous, PathTraits } from './traits';
8
+
9
+ declare const LinearPath2dTypeId: unique symbol;
10
+ type LinearPath2dTypeId = typeof LinearPath2dTypeId;
11
+
12
+ export type { Continuous } from './traits';
13
+ /**
14
+ * A linear path in 2D space.
15
+ *
16
+ * All fields are readonly and immutable, and all operations create new instances.
17
+ *
18
+ * The `Trait` type parameter accumulates trait brands as the path is refined
19
+ * via `isContinuous` / `asContinuous`. A `Continuous` path's `toPathData`
20
+ * skips the per-segment discontinuity check.
21
+ *
22
+ * @since 1.0.0
23
+ */
24
+ export interface LinearPath2d<out Trait = unknown> extends Pipeable, Iterable<LinearCurve2d> {
25
+ readonly [LinearPath2dTypeId]: LinearPath2dTypeId;
26
+ readonly [PathTraits]: Trait;
27
+ }
28
+ /**
29
+ * Creates a new `LinearPath2d` instance from a sequence of curves.
30
+ *
31
+ * @param curves - The curves to create the path from.
32
+ * @returns A new `LinearPath2d` instance.
33
+ * @since 2.0.0
34
+ */
35
+ export declare const make: (...curves: ReadonlyArray<LinearCurve2d>) => LinearPath2d;
36
+ /**
37
+ * Creates a new `LinearPath2d` instance from an array of curves.
38
+ *
39
+ * @param curves - The curves to create the path from.
40
+ * @returns A new `LinearPath2d` instance.
41
+ * @since 2.0.0
42
+ */
43
+ export declare const fromArray: (curves: ReadonlyArray<LinearCurve2d>) => LinearPath2d;
44
+ /**
45
+ * Checks if a value is a `LinearPath2d`.
46
+ *
47
+ * @param p - The value to check.
48
+ * @returns `true` if the value is a `LinearPath2d`, `false` otherwise.
49
+ * @since 1.0.0
50
+ */
51
+ export declare const isLinearPath2d: (p: unknown) => p is LinearPath2d;
52
+ export declare const append: {
53
+ /**
54
+ * Appends a linear curve to a linear path.
55
+ *
56
+ * @param c - The linear curve to append.
57
+ * @returns A function that takes a linear path and returns a new linear path.
58
+ * @since 1.0.0
59
+ */
60
+ (c: LinearCurve2d): (p: LinearPath2d) => LinearPath2d;
61
+ /**
62
+ * Appends a linear curve to a linear path.
63
+ *
64
+ * @param p - The linear path to append to.
65
+ * @param c - The linear curve to append.
66
+ * @returns A new `LinearPath2d` instance with the appended curve.
67
+ * @since 1.0.0
68
+ */
69
+ (p: LinearPath2d, c: LinearCurve2d): LinearPath2d;
70
+ };
71
+ /**
72
+ * Calculates the length of a linear path.
73
+ *
74
+ * @param p - The linear path to calculate the length of.
75
+ * @returns The length of the linear path.
76
+ * @since 1.0.0
77
+ */
78
+ export declare const length: (p: LinearPath2d) => number;
79
+ export declare const solve: {
80
+ /**
81
+ * Solves a linear path for a given parameter.
82
+ *
83
+ * @param u - The parameter to solve for.
84
+ * @returns A function that takes a linear path and returns the solved point.
85
+ * @since 1.0.0
86
+ */
87
+ (u: number): (p: LinearPath2d) => Vector2;
88
+ /**
89
+ * Solves a linear path for a given parameter.
90
+ *
91
+ * @param p - The linear path to solve.
92
+ * @param u - The parameter to solve for.
93
+ * @returns The solved point on the linear path.
94
+ * @since 1.0.0
95
+ */
96
+ (p: LinearPath2d, u: number): Vector2;
97
+ };
98
+ /**
99
+ * Serializes a linear path as an SVG path data string (the value of a `<path>`
100
+ * element's `d` attribute), using `M` and `L` commands. Discontinuities between
101
+ * curves emit a fresh `M` command.
102
+ *
103
+ * @param p - The linear path to serialize.
104
+ * @returns The SVG path data string.
105
+ * @since 2.0.0
106
+ */
107
+ export declare const toPathData: (p: LinearPath2d) => string;
108
+ /**
109
+ * Type-narrowing predicate: refines `LinearPath2d<T>` to
110
+ * `LinearPath2d<T & Continuous>` when adjacent curves connect at their join
111
+ * points.
112
+ *
113
+ * @param p - The linear path to check.
114
+ * @returns `true` when the path is continuous (G⁰).
115
+ * @since 2.0.0
116
+ */
117
+ export declare const isContinuous: <T>(p: LinearPath2d<T>) => p is LinearPath2d<T & Continuous>;
118
+ /**
119
+ * Asserts that the linear path is continuous, throwing on failure.
120
+ *
121
+ * @param p - The linear path to assert against.
122
+ * @returns The same path, typed with the `Continuous` brand.
123
+ * @throws When the path has a discontinuity between adjacent curves.
124
+ * @since 2.0.0
125
+ */
126
+ export declare const asContinuous: <T>(p: LinearPath2d<T>) => LinearPath2d<T & Continuous>;
127
+ /**
128
+ * Computes the axis-aligned bounding box of the path — the smallest closed
129
+ * `Box2d` enclosing every segment.
130
+ *
131
+ * @param p - The linear path.
132
+ * @returns A closed `Box2d` enclosing the path.
133
+ * @since 2.0.0
134
+ */
135
+ export declare const boundingBox: (p: LinearPath2d) => Interval2d<Closed, Closed>;
@@ -0,0 +1,127 @@
1
+ import type { Interval2d } from '../interval/interval2d';
2
+ import type { QuadraticCurve2d } from '../curve/quadratic2d';
3
+ import type { Closed } from '../interval/interval';
4
+ import type { Pipeable } from '../utils';
5
+ import type { Vector2 } from '../vector/vector2';
6
+
7
+ import type { Continuous, PathTraits } from './traits';
8
+
9
+ declare const QuadraticPath2dTypeId: unique symbol;
10
+ type QuadraticPath2dTypeId = typeof QuadraticPath2dTypeId;
11
+
12
+ export type { Continuous } from './traits';
13
+ /**
14
+ * A quadratic path in 2D space.
15
+ *
16
+ * All fields are readonly and immutable, and all operations create new instances.
17
+ *
18
+ * The `Trait` type parameter accumulates trait brands as the path is refined
19
+ * via `isContinuous` / `asContinuous`.
20
+ *
21
+ * @since 1.0.0
22
+ */
23
+ export interface QuadraticPath2d<out Trait = unknown> extends Pipeable, Iterable<QuadraticCurve2d> {
24
+ readonly [QuadraticPath2dTypeId]: QuadraticPath2dTypeId;
25
+ readonly [PathTraits]: Trait;
26
+ }
27
+ /**
28
+ * Creates a new `QuadraticPath2d` instance from a sequence of curves.
29
+ *
30
+ * @param curves - The curves to create the path from.
31
+ * @returns A new `QuadraticPath2d` instance.
32
+ * @since 2.0.0
33
+ */
34
+ export declare const make: (...curves: ReadonlyArray<QuadraticCurve2d>) => QuadraticPath2d;
35
+ /**
36
+ * Creates a new `QuadraticPath2d` instance from an array of curves.
37
+ *
38
+ * @param curves - The curves to create the path from.
39
+ * @returns A new `QuadraticPath2d` instance.
40
+ * @since 2.0.0
41
+ */
42
+ export declare const fromArray: (curves: ReadonlyArray<QuadraticCurve2d>) => QuadraticPath2d;
43
+ /**
44
+ * Checks if a value is a `QuadraticPath2d`.
45
+ *
46
+ * @param p - The value to check.
47
+ * @returns `true` if the value is a `QuadraticPath2d`, `false` otherwise.
48
+ * @since 1.0.0
49
+ */
50
+ export declare const isQuadraticPath2d: (p: unknown) => p is QuadraticPath2d;
51
+ export declare const append: {
52
+ /**
53
+ * Appends a quadratic curve to a quadratic path.
54
+ *
55
+ * @param c - The quadratic curve to append.
56
+ * @returns A function that takes a quadratic path and returns a new quadratic path.
57
+ * @since 1.0.0
58
+ */
59
+ (c: QuadraticCurve2d): (p: QuadraticPath2d) => QuadraticPath2d;
60
+ /**
61
+ * Appends a quadratic curve to a quadratic path.
62
+ *
63
+ * @param p - The quadratic path to append to.
64
+ * @param c - The quadratic curve to append.
65
+ * @returns A new `QuadraticPath2d` instance with the appended curve.
66
+ * @since 1.0.0
67
+ */
68
+ (p: QuadraticPath2d, c: QuadraticCurve2d): QuadraticPath2d;
69
+ };
70
+ /**
71
+ * Calculates the length of a quadratic path.
72
+ *
73
+ * @param p - The quadratic path to calculate the length of.
74
+ * @returns The length of the path.
75
+ */
76
+ export declare const length: (p: QuadraticPath2d) => number;
77
+ export declare const solve: {
78
+ /**
79
+ * Solves a quadratic path at a given parameter.
80
+ *
81
+ * @param u - The parameter to solve for.
82
+ * @returns A function that takes a quadratic path and returns the solved point.
83
+ * @since 1.0.0
84
+ */
85
+ (u: number): (p: QuadraticPath2d) => Vector2;
86
+ /**
87
+ * Solves a quadratic path at a given parameter.
88
+ *
89
+ * @param p - The quadratic path to solve.
90
+ * @param u - The parameter to solve for.
91
+ * @returns The solved point.
92
+ * @since 1.0.0
93
+ */
94
+ (p: QuadraticPath2d, u: number): Vector2;
95
+ };
96
+ /**
97
+ * Serializes a quadratic path as an SVG path data string (the value of a
98
+ * `<path>` element's `d` attribute), using `M` and `Q` commands. Discontinuities
99
+ * between curves emit a fresh `M` command.
100
+ *
101
+ * @param p - The quadratic path to serialize.
102
+ * @returns The SVG path data string.
103
+ * @since 2.0.0
104
+ */
105
+ export declare const toPathData: (p: QuadraticPath2d) => string;
106
+ /**
107
+ * Type-narrowing predicate: refines `QuadraticPath2d<T>` to
108
+ * `QuadraticPath2d<T & Continuous>` when adjacent curves connect.
109
+ *
110
+ * @since 2.0.0
111
+ */
112
+ export declare const isContinuous: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T & Continuous>;
113
+ /**
114
+ * Asserts that the quadratic path is continuous, throwing on failure.
115
+ *
116
+ * @since 2.0.0
117
+ */
118
+ export declare const asContinuous: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & Continuous>;
119
+ /**
120
+ * Computes the axis-aligned bounding box of the path — the smallest closed
121
+ * `Box2d` enclosing every segment.
122
+ *
123
+ * @param p - The quadratic path.
124
+ * @returns A closed `Box2d` enclosing the path.
125
+ * @since 2.0.0
126
+ */
127
+ export declare const boundingBox: (p: QuadraticPath2d) => Interval2d<Closed, Closed>;
@@ -0,0 +1,120 @@
1
+ import type { RationalCubicCurve2d } from '../curve/rationalCubic2d';
2
+ import type { Pipeable } from '../utils';
3
+ import type { Vector2 } from '../vector/vector2';
4
+ import type { CubicPath2d } from './cubic2d';
5
+
6
+ declare const RationalCubicPath2dTypeId: unique symbol;
7
+ type RationalCubicPath2dTypeId = typeof RationalCubicPath2dTypeId;
8
+
9
+
10
+ /**
11
+ * A rational cubic path in 2D space.
12
+ *
13
+ * Holds a non-empty sequence of `RationalCubicCurve2d` segments; iteration
14
+ * yields the segments in order. The path parameter `u ∈ [0, 1]` is mapped
15
+ * uniformly across segments — `u = 0` is the start of the first segment,
16
+ * `u = 1` is the end of the last segment, and intermediate values pick a
17
+ * segment by index and a local parameter within it.
18
+ *
19
+ * Counterpart to `CubicPath2d` for curves whose evaluation includes the
20
+ * homogeneous-to-plane projection.
21
+ *
22
+ * All fields are readonly and immutable, and all operations create new instances.
23
+ *
24
+ * @since 2.0.0
25
+ */
26
+ export interface RationalCubicPath2d extends Pipeable, Iterable<RationalCubicCurve2d> {
27
+ readonly [RationalCubicPath2dTypeId]: RationalCubicPath2dTypeId;
28
+ }
29
+ /**
30
+ * Checks if a value is a `RationalCubicPath2d`.
31
+ *
32
+ * @param p - The value to check.
33
+ * @returns `true` if the value is a `RationalCubicPath2d`, `false` otherwise.
34
+ * @since 2.0.0
35
+ */
36
+ export declare const isRationalCubicPath2d: (p: unknown) => p is RationalCubicPath2d;
37
+ /**
38
+ * Creates a new `RationalCubicPath2d` from a sequence of curves.
39
+ *
40
+ * @param curves - The curves to create the path from.
41
+ * @returns A new `RationalCubicPath2d` instance.
42
+ * @since 2.0.0
43
+ */
44
+ export declare const make: (...curves: ReadonlyArray<RationalCubicCurve2d>) => RationalCubicPath2d;
45
+ /**
46
+ * Creates a new `RationalCubicPath2d` from an array of curves.
47
+ *
48
+ * @param curves - The curves to create the path from.
49
+ * @returns A new `RationalCubicPath2d` instance.
50
+ * @since 2.0.0
51
+ */
52
+ export declare const fromArray: (curves: ReadonlyArray<RationalCubicCurve2d>) => RationalCubicPath2d;
53
+ export declare const append: {
54
+ /**
55
+ * Appends a curve to a `RationalCubicPath2d`.
56
+ *
57
+ * @param c - The curve to append.
58
+ * @returns A function that takes a path and returns a new path with the appended curve.
59
+ * @since 2.0.0
60
+ */
61
+ (c: RationalCubicCurve2d): (p: RationalCubicPath2d) => RationalCubicPath2d;
62
+ /**
63
+ * Appends a curve to a `RationalCubicPath2d`.
64
+ *
65
+ * @param p - The path to append to.
66
+ * @param c - The curve to append.
67
+ * @returns A new path with the appended curve.
68
+ * @since 2.0.0
69
+ */
70
+ (p: RationalCubicPath2d, c: RationalCubicCurve2d): RationalCubicPath2d;
71
+ };
72
+ export declare const solve: {
73
+ /**
74
+ * Evaluates the rational cubic path at parameter `u ∈ [0, 1]`.
75
+ *
76
+ * Picks the segment containing `u` (uniform mapping across segments) and
77
+ * delegates to `RationalCubicCurve2d.solve` on that segment with the local
78
+ * parameter.
79
+ *
80
+ * @param p - The path to evaluate.
81
+ * @param u - The path parameter in `[0, 1]`.
82
+ * @returns The point on the path at parameter `u`.
83
+ * @since 2.0.0
84
+ */
85
+ (p: RationalCubicPath2d, u: number): Vector2;
86
+ /**
87
+ * Evaluates the rational cubic path at parameter `u ∈ [0, 1]`.
88
+ *
89
+ * @param u - The path parameter in `[0, 1]`.
90
+ * @returns A function that takes a path and returns the point at `u`.
91
+ * @since 2.0.0
92
+ */
93
+ (u: number): (p: RationalCubicPath2d) => Vector2;
94
+ };
95
+ export declare const approximateAsCubicPath: {
96
+ /**
97
+ * Approximates the rational cubic path as a `CubicPath2d` via per-segment
98
+ * recursive subdivision. Each input segment is split until its midpoint
99
+ * deviates from a polynomial-cubic candidate by at most `tolerance`; the
100
+ * surviving candidates are concatenated into a new path.
101
+ *
102
+ * Lossy in general — only exact when every input segment has uniform
103
+ * weights, in which case segment count is preserved. Tighter tolerance
104
+ * produces more segments.
105
+ *
106
+ * @param p - The rational cubic path to approximate.
107
+ * @param tolerance - Maximum allowed midpoint deviation per segment; must be positive.
108
+ * @returns A new `CubicPath2d` approximating the input.
109
+ * @since 2.0.0
110
+ */
111
+ (p: RationalCubicPath2d, tolerance: number): CubicPath2d;
112
+ /**
113
+ * Approximates the rational cubic path as a `CubicPath2d`.
114
+ *
115
+ * @param tolerance - Maximum allowed midpoint deviation per segment; must be positive.
116
+ * @returns A function that takes a rational path and returns its approximation.
117
+ * @since 2.0.0
118
+ */
119
+ (tolerance: number): (p: RationalCubicPath2d) => CubicPath2d;
120
+ };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Trait brands for paths.
3
+ *
4
+ * Brands are phantom types — they exist only at the type level and carry no
5
+ * runtime data. Refiners (`isContinuous`) and assertions (`asContinuous`) on
6
+ * each path module attach these brands to the path's `Trait` parameter at the
7
+ * type level.
8
+ *
9
+ * @since 2.0.0
10
+ */
11
+ declare const ContinuousId: unique symbol;
12
+ /**
13
+ * Brand for paths whose adjacent curves connect at their join points (G⁰
14
+ * continuity). Calling `toPathData` on a `Continuous` path skips the
15
+ * per-segment discontinuity check and emits a single `M` followed by drawing
16
+ * commands.
17
+ *
18
+ * @since 2.0.0
19
+ */
20
+ export type Continuous = {
21
+ readonly [ContinuousId]: 'continuous';
22
+ };
23
+ /**
24
+ * Phantom property key used by path interfaces to hold their `Trait` type
25
+ * parameter. The runtime object never has a value at this key.
26
+ *
27
+ * @since 2.0.0
28
+ */
29
+ export declare const PathTraits: unique symbol;
30
+ export type PathTraits = typeof PathTraits;
31
+ export {};