curvy 2.0.0-alpha.2 → 2.0.0-alpha.4
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/characteristic/index.d.mts +9 -9
- package/dist/characteristic/index.mjs +1 -1
- package/dist/curve/index.d.mts +10 -2
- package/dist/curve/index.mjs +1 -1
- package/dist/interval/index.d.mts +9 -3
- package/dist/interval/index.mjs +2 -2
- package/dist/matrix/index.d.mts +9 -2
- package/dist/path/index.d.mts +15 -223
- package/dist/path/index.mjs +6 -6
- package/dist/path/index.mjs.map +1 -1
- package/dist/polynomial/index.d.mts +9 -2
- package/dist/polynomial/index.mjs +2 -2
- package/dist/shared/{characteristic-B9nCh_cx.mjs → characteristic-DLlhja-I.mjs} +9 -9
- package/dist/shared/{characteristic-B9nCh_cx.mjs.map → characteristic-DLlhja-I.mjs.map} +1 -1
- package/dist/shared/{cubic-CpHAx8cC.mjs → cubic-CMonq6bg.mjs} +26 -5
- package/dist/shared/cubic-CMonq6bg.mjs.map +1 -0
- package/dist/shared/cubic-DkBqcZf-.d.mts +121 -0
- package/dist/shared/interval-Bhzeqp8M.d.mts +62 -0
- package/dist/shared/{interval-05CR6eBf.mjs → interval-X1EYuf-T.mjs} +2 -2
- package/dist/shared/{interval-05CR6eBf.mjs.map → interval-X1EYuf-T.mjs.map} +1 -1
- package/dist/shared/interval2d-BMk5UYXD.d.mts +29 -0
- package/dist/shared/{interval2d-8IBZnUOq.mjs → interval2d-ca0J1NMr.mjs} +8 -8
- package/dist/shared/{interval2d-8IBZnUOq.mjs.map → interval2d-ca0J1NMr.mjs.map} +1 -1
- package/dist/shared/matrix4x4-CaytTaB_.d.mts +168 -0
- package/dist/shared/{quadratic-CamozcFc.mjs → quadratic-DyeMtvET.mjs} +20 -2
- package/dist/shared/quadratic-DyeMtvET.mjs.map +1 -0
- package/dist/shared/rationalCubic2d-D-UevGKu.d.mts +60 -0
- package/dist/shared/{rationalCubic2d-Bys2Uory.mjs → rationalCubic2d-D658ltUM.mjs} +17 -17
- package/dist/shared/{rationalCubic2d-Bys2Uory.mjs.map → rationalCubic2d-D658ltUM.mjs.map} +1 -1
- package/dist/shared/rationalCubic2d-MgMSJaAU.d.mts +104 -0
- package/dist/shared/{rationalCubic2d-BEgUGSFf.mjs → rationalCubic2d-Vw4qGPZj.mjs} +9 -9
- package/dist/shared/{rationalCubic2d-BEgUGSFf.mjs.map → rationalCubic2d-Vw4qGPZj.mjs.map} +1 -1
- package/dist/shared/{solution-CrtLfqEq.mjs → solution-3TDATEMn.mjs} +28 -2
- package/dist/shared/solution-3TDATEMn.mjs.map +1 -0
- package/dist/shared/solution-DInDT2Hq.d.mts +60 -0
- package/dist/shared/{vector2-CL1HDdPr.mjs → vector2-CCuJx1rX.mjs} +6 -6
- package/dist/shared/{vector2-CL1HDdPr.mjs.map → vector2-CCuJx1rX.mjs.map} +1 -1
- package/dist/shared/vector2-euuV_bNQ.d.mts +58 -0
- package/dist/shared/vector3-3Xx7GVk7.d.mts +37 -0
- package/dist/shared/{vector3-D-tv_aKL.mjs → vector3-C-qgKAjR.mjs} +2 -2
- package/dist/shared/{vector3-D-tv_aKL.mjs.map → vector3-C-qgKAjR.mjs.map} +1 -1
- package/dist/shared/{vector4-5KbjoHVj.mjs → vector4-BhOKDhD5.mjs} +2 -2
- package/dist/shared/{vector4-5KbjoHVj.mjs.map → vector4-BhOKDhD5.mjs.map} +1 -1
- package/dist/solution/index.d.mts +7 -2
- package/dist/solution/index.mjs +1 -1
- package/dist/splines/index.d.mts +37 -606
- package/dist/splines/index.mjs +193 -35
- package/dist/splines/index.mjs.map +1 -1
- package/dist/vector/index.d.mts +10 -3
- package/dist/vector/index.mjs +3 -3
- package/package.json +1 -1
- package/dist/shared/cubic-BajUY0JT.d.mts +0 -1100
- package/dist/shared/cubic-CpHAx8cC.mjs.map +0 -1
- package/dist/shared/interval-Dy-RMEE3.d.mts +0 -533
- package/dist/shared/interval2d-C2id9u31.d.mts +0 -172
- package/dist/shared/matrix4x4-Dm_tSiH1.d.mts +0 -1183
- package/dist/shared/quadratic-CamozcFc.mjs.map +0 -1
- package/dist/shared/rationalCubic2d-B6g97ryJ.d.mts +0 -308
- package/dist/shared/rationalCubic2d-DlQfBURs.d.mts +0 -818
- package/dist/shared/solution-CrtLfqEq.mjs.map +0 -1
- package/dist/shared/solution-sNQ-ZVhN.d.mts +0 -251
- package/dist/shared/vector2-DPUY3_eA.d.mts +0 -470
- package/dist/shared/vector3-DqeOZtOB.d.mts +0 -703
package/dist/splines/index.d.mts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { n as Weighted, t as Vector2 } from "../shared/vector2-
|
|
1
|
+
import { n as Weighted, t as Vector2 } from "../shared/vector2-euuV_bNQ.mjs";
|
|
2
2
|
import { t as Pipeable } from "../shared/utils-MCckigYk.mjs";
|
|
3
|
-
import { t as AtMostOne } from "../shared/solution-sNQ-ZVhN.mjs";
|
|
4
|
-
import { r as CubicPath2d, t as RationalCubicPath2d } from "../shared/rationalCubic2d-B6g97ryJ.mjs";
|
|
5
3
|
|
|
6
4
|
//#region src/splines/rationalBezier2d.internal.d.ts
|
|
7
5
|
declare const RationalBezier2dTypeId: unique symbol;
|
|
8
6
|
type RationalBezier2dTypeId = typeof RationalBezier2dTypeId;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/splines/rationalBezier2d.d.ts
|
|
12
9
|
/**
|
|
13
10
|
* A piecewise rational cubic Bézier curve in 2D space.
|
|
14
11
|
*
|
|
@@ -27,123 +24,18 @@ declare namespace rationalBezier2d_d_exports {
|
|
|
27
24
|
*
|
|
28
25
|
* All fields are readonly and immutable, and all operations create new instances.
|
|
29
26
|
*
|
|
30
|
-
* @since 2.
|
|
27
|
+
* @since 2.0.0
|
|
31
28
|
*/
|
|
32
|
-
interface RationalBezier2d extends Pipeable {
|
|
29
|
+
interface RationalBezier2d$1 extends Pipeable {
|
|
33
30
|
readonly [RationalBezier2dTypeId]: RationalBezier2dTypeId;
|
|
34
31
|
[Symbol.iterator](): IterableIterator<Weighted>;
|
|
35
32
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Checks if a value is a `RationalBezier2d`.
|
|
38
|
-
*
|
|
39
|
-
* @param p - The value to check.
|
|
40
|
-
* @returns `true` if the value is a `RationalBezier2d`, `false` otherwise.
|
|
41
|
-
* @since 2.1.0
|
|
42
|
-
*/
|
|
43
|
-
declare const isRationalBezier2d: (p: unknown) => p is RationalBezier2d;
|
|
44
|
-
/**
|
|
45
|
-
* Creates a new single-segment `RationalBezier2d` from four weighted control points.
|
|
46
|
-
*
|
|
47
|
-
* Equal weights produce a curve coincident with the corresponding polynomial
|
|
48
|
-
* cubic Bézier; unequal weights produce a true rational curve capable of
|
|
49
|
-
* representing conics exactly.
|
|
50
|
-
*
|
|
51
|
-
* @param p0 - The first weighted control point (curve start).
|
|
52
|
-
* @param p1 - The second weighted control point (start handle).
|
|
53
|
-
* @param p2 - The third weighted control point (end handle).
|
|
54
|
-
* @param p3 - The fourth weighted control point (curve end).
|
|
55
|
-
* @returns A new `RationalBezier2d` instance.
|
|
56
|
-
* @since 2.1.0
|
|
57
|
-
*/
|
|
58
|
-
declare const make$4: (p0: Weighted, p1: Weighted, p2: Weighted, p3: Weighted) => RationalBezier2d;
|
|
59
|
-
/**
|
|
60
|
-
* Creates a new `RationalBezier2d` from an array of weighted control points.
|
|
61
|
-
*
|
|
62
|
-
* The array must contain `(n * 3) + 1` entries to describe `n` joined cubic
|
|
63
|
-
* segments.
|
|
64
|
-
*
|
|
65
|
-
* @param points - The weighted control points.
|
|
66
|
-
* @returns A new `RationalBezier2d` instance.
|
|
67
|
-
* @since 2.1.0
|
|
68
|
-
*/
|
|
69
|
-
declare const fromArray$4: (points: ReadonlyArray<Weighted>) => RationalBezier2d;
|
|
70
|
-
/**
|
|
71
|
-
* Creates a new single-segment `RationalBezier2d` from four points with all
|
|
72
|
-
* weights equal to one.
|
|
73
|
-
*
|
|
74
|
-
* Convenience constructor for callers who want the rational evaluator but
|
|
75
|
-
* don't yet have non-unit weights — the resulting curve is mathematically
|
|
76
|
-
* equivalent to the corresponding `Bezier2d.make(p0, p1, p2, p3)` and can
|
|
77
|
-
* later be subdivided or recombined using the rational machinery without
|
|
78
|
-
* conversion overhead.
|
|
79
|
-
*
|
|
80
|
-
* @param p0 - The first control point (curve start).
|
|
81
|
-
* @param p1 - The second control point (start handle).
|
|
82
|
-
* @param p2 - The third control point (end handle).
|
|
83
|
-
* @param p3 - The fourth control point (curve end).
|
|
84
|
-
* @returns A new `RationalBezier2d` with unit weights.
|
|
85
|
-
* @since 2.1.0
|
|
86
|
-
*/
|
|
87
|
-
declare const fromPoints: (p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2) => RationalBezier2d;
|
|
88
|
-
/**
|
|
89
|
-
* Lifts a non-rational `Bezier2d` into a `RationalBezier2d` by assigning
|
|
90
|
-
* unit weight to every control point. The two curves trace the same path.
|
|
91
|
-
*
|
|
92
|
-
* @param b - The non-rational bezier to lift.
|
|
93
|
-
* @returns A new `RationalBezier2d` with unit weights.
|
|
94
|
-
* @since 2.1.0
|
|
95
|
-
*/
|
|
96
|
-
declare const fromBezier: (b: Bezier2d) => RationalBezier2d;
|
|
97
|
-
/**
|
|
98
|
-
* Converts a `RationalBezier2d` to a `RationalCubicPath2d`.
|
|
99
|
-
*
|
|
100
|
-
* Each segment's four homogeneous control points are expanded into three
|
|
101
|
-
* per-segment monomial cubic polynomials — `x`, `y`, and the shared
|
|
102
|
-
* denominator `w` — yielding a path whose evaluator is three Horner passes
|
|
103
|
-
* plus two divisions per call.
|
|
104
|
-
*
|
|
105
|
-
* Mirrors `Bezier2d.toPath`: spline construction is converted to path
|
|
106
|
-
* evaluation form, and forward evaluation thereafter routes through the
|
|
107
|
-
* path's `solve`.
|
|
108
|
-
*
|
|
109
|
-
* @param r - The rational bezier to convert.
|
|
110
|
-
* @returns A new `RationalCubicPath2d` instance representing the same curve.
|
|
111
|
-
* @since 2.1.0
|
|
112
|
-
*/
|
|
113
|
-
declare const toPath$4: (r: RationalBezier2d) => RationalCubicPath2d;
|
|
114
|
-
declare const subdivide$1: {
|
|
115
|
-
/**
|
|
116
|
-
* Splits a `RationalBezier2d` at the given global parameter `u ∈ (0, 1)`
|
|
117
|
-
* using de Casteljau's algorithm in homogeneous coordinates. The two
|
|
118
|
-
* returned beziers together trace the same curve as the input — the left
|
|
119
|
-
* covers `[0, u]`, the right covers `[u, 1]`.
|
|
120
|
-
*
|
|
121
|
-
* The subdivided halves' control-point weights generally differ from the
|
|
122
|
-
* original's even at unit input weights; this is expected and preserves
|
|
123
|
-
* the curve shape exactly.
|
|
124
|
-
*
|
|
125
|
-
* @param r - The rational bezier to split.
|
|
126
|
-
* @param u - The split parameter in the open interval `(0, 1)`.
|
|
127
|
-
* @returns A two-element tuple of the left and right halves.
|
|
128
|
-
* @since 2.1.0
|
|
129
|
-
*/
|
|
130
|
-
(r: RationalBezier2d, u: number): [RationalBezier2d, RationalBezier2d];
|
|
131
|
-
/**
|
|
132
|
-
* Splits a `RationalBezier2d` at the given global parameter `u ∈ (0, 1)`.
|
|
133
|
-
*
|
|
134
|
-
* @param u - The split parameter in the open interval `(0, 1)`.
|
|
135
|
-
* @returns A function that takes a rational bezier and returns the halves.
|
|
136
|
-
* @since 2.1.0
|
|
137
|
-
*/
|
|
138
|
-
(u: number): (r: RationalBezier2d) => [RationalBezier2d, RationalBezier2d];
|
|
139
|
-
};
|
|
140
33
|
//#endregion
|
|
141
34
|
//#region src/splines/bezier2d.internal.d.ts
|
|
142
35
|
declare const Bezier2dTypeId: unique symbol;
|
|
143
36
|
type Bezier2dTypeId = typeof Bezier2dTypeId;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/splines/bezier2d.d.ts
|
|
147
39
|
/**
|
|
148
40
|
* A Bézier curve in 2D space.
|
|
149
41
|
*
|
|
@@ -154,337 +46,46 @@ declare namespace bezier2d_d_exports {
|
|
|
154
46
|
*
|
|
155
47
|
* @since 1.0.0
|
|
156
48
|
*/
|
|
157
|
-
interface Bezier2d extends Pipeable {
|
|
49
|
+
interface Bezier2d$1 extends Pipeable {
|
|
158
50
|
readonly [Bezier2dTypeId]: Bezier2dTypeId;
|
|
159
51
|
[Symbol.iterator](): IterableIterator<Vector2>;
|
|
160
52
|
}
|
|
161
|
-
/**
|
|
162
|
-
* Creates a new `Bezier2d` instance.
|
|
163
|
-
*
|
|
164
|
-
* @param p0 - The first control point.
|
|
165
|
-
* @param p1 - The second control point.
|
|
166
|
-
* @param p2 - The third control point.
|
|
167
|
-
* @param p3 - The fourth control point.
|
|
168
|
-
* @returns A new `Bezier2d` instance.
|
|
169
|
-
* @since 1.0.0
|
|
170
|
-
*/
|
|
171
|
-
declare const make$3: (p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2) => Bezier2d;
|
|
172
|
-
/**
|
|
173
|
-
* Creates a new `Bezier2d` instance from an array of control points.
|
|
174
|
-
*
|
|
175
|
-
* @param points - The control points.
|
|
176
|
-
* @returns A new `Bezier2d` instance.
|
|
177
|
-
* @since 1.0.0
|
|
178
|
-
*/
|
|
179
|
-
declare const fromArray$3: (points: ReadonlyArray<Vector2>) => Bezier2d;
|
|
180
|
-
/**
|
|
181
|
-
* Checks if a value is a `Bezier2d`.
|
|
182
|
-
*
|
|
183
|
-
* @param p - The value to check.
|
|
184
|
-
* @returns `true` if the value is a `Bezier2d`, `false` otherwise.
|
|
185
|
-
* @since 1.0.0
|
|
186
|
-
*/
|
|
187
|
-
declare const isCubicBezier2d: (p: unknown) => p is Bezier2d;
|
|
188
|
-
declare const append$3: {
|
|
189
|
-
/**
|
|
190
|
-
* Appends control points to a `Bezier2d`.
|
|
191
|
-
*
|
|
192
|
-
* @param p1 - The second control point (first tangent).
|
|
193
|
-
* @param p2 - The third control point (second tangent).
|
|
194
|
-
* @param p3 - The fourth control point (end point).
|
|
195
|
-
* @returns A function that takes a `Bezier2d` and returns a new `Bezier2d` instance with the appended control points.
|
|
196
|
-
*/
|
|
197
|
-
(p1: Vector2, p2: Vector2, p3: Vector2): (p: Bezier2d) => Bezier2d;
|
|
198
|
-
/**
|
|
199
|
-
* Appends control points to a `Bezier2d`.
|
|
200
|
-
*
|
|
201
|
-
* @param p - The `Bezier2d` to append the control points to.
|
|
202
|
-
* @param p1 - The second control point (first tangent).
|
|
203
|
-
* @param p2 - The third control point (second tangent).
|
|
204
|
-
* @param p3 - The fourth control point (end point).
|
|
205
|
-
* @returns A new `Bezier2d` instance with the appended control points.
|
|
206
|
-
*/
|
|
207
|
-
(p: Bezier2d, p1: Vector2, p2: Vector2, p3: Vector2): Bezier2d;
|
|
208
|
-
};
|
|
209
|
-
declare const appendTangentAligned: {
|
|
210
|
-
/**
|
|
211
|
-
* Appends control points to a `Bezier2d` with aligned tangents.
|
|
212
|
-
*
|
|
213
|
-
* @param ratio - The ratio of the tangents.
|
|
214
|
-
* @param p2 - The third control point (second tangent).
|
|
215
|
-
* @param p3 - The fourth control point (end point).
|
|
216
|
-
* @returns A function that takes a `Bezier2d` and returns a new `Bezier2d` instance with the appended control points.
|
|
217
|
-
*/
|
|
218
|
-
(ratio: number, p2: Vector2, p3: Vector2): (p: Bezier2d) => Bezier2d;
|
|
219
|
-
/**
|
|
220
|
-
* Appends control points to a `Bezier2d` with aligned tangents.
|
|
221
|
-
*
|
|
222
|
-
* @param p - The `Bezier2d` to append the control points to.
|
|
223
|
-
* @param ratio - The ratio of the tangents.
|
|
224
|
-
* @param p2 - The third control point (second tangent).
|
|
225
|
-
* @param p3 - The fourth control point (end point).
|
|
226
|
-
* @returns A new `Bezier2d` instance with the appended control points.
|
|
227
|
-
*/
|
|
228
|
-
(p: Bezier2d, ratio: number, p2: Vector2, p3: Vector2): Bezier2d;
|
|
229
|
-
};
|
|
230
|
-
declare const appendCurvatureAligned: {
|
|
231
|
-
/**
|
|
232
|
-
* Appends control points to a `Bezier2d` with aligned curvature (G² continuity).
|
|
233
|
-
*
|
|
234
|
-
* @param a - The first curvature parameter.
|
|
235
|
-
* @param b - The second curvature parameter.
|
|
236
|
-
* @param p6 - The sixth control point (end point).
|
|
237
|
-
* @returns A function that takes a `Bezier2d` and returns a new `Bezier2d` instance with the appended control points.
|
|
238
|
-
*/
|
|
239
|
-
(a: number, b: number, p6: Vector2): (p: Bezier2d) => Bezier2d;
|
|
240
|
-
/**
|
|
241
|
-
* Appends control points to a `Bezier2d` with aligned curvature (G² continuity).
|
|
242
|
-
*
|
|
243
|
-
* @param p - The `Bezier2d` to append the control points to.
|
|
244
|
-
* @param a - The first curvature parameter.
|
|
245
|
-
* @param b - The second curvature parameter.
|
|
246
|
-
* @param p6 - The sixth control point (end point).
|
|
247
|
-
* @returns A new `Bezier2d` instance with the appended control points.
|
|
248
|
-
*/
|
|
249
|
-
(p: Bezier2d, a: number, b: number, p6: Vector2): Bezier2d;
|
|
250
|
-
};
|
|
251
|
-
declare const appendVelocityAligned: {
|
|
252
|
-
/**
|
|
253
|
-
* Appends control points to a `Bezier2d` with aligned velocity.
|
|
254
|
-
*
|
|
255
|
-
* @param p2 - The second control point (first tangent).
|
|
256
|
-
* @param p3 - The third control point (second tangent).
|
|
257
|
-
* @returns A function that takes a `Bezier2d` and returns a new `Bezier2d` instance with the appended control points.
|
|
258
|
-
*/
|
|
259
|
-
(p2: Vector2, p3: Vector2): (p: Bezier2d) => Bezier2d;
|
|
260
|
-
/**
|
|
261
|
-
* Appends control points to a `Bezier2d` with aligned velocity.
|
|
262
|
-
*
|
|
263
|
-
* @param p - The `Bezier2d` to append the control points to.
|
|
264
|
-
* @param p2 - The second control point (first tangent).
|
|
265
|
-
* @param p3 - The third control point (second tangent).
|
|
266
|
-
* @returns A new `Bezier2d` instance with the appended control points.
|
|
267
|
-
*/
|
|
268
|
-
(p: Bezier2d, p2: Vector2, p3: Vector2): Bezier2d;
|
|
269
|
-
};
|
|
270
|
-
declare const appendAccelerationAligned: {
|
|
271
|
-
/**
|
|
272
|
-
* Appends control points to a `Bezier2d` with aligned acceleration.
|
|
273
|
-
*
|
|
274
|
-
* @param p3 - The third control point (second tangent).
|
|
275
|
-
* @returns A function that takes a `Bezier2d` and returns a new `Bezier2d` instance with the appended control points.
|
|
276
|
-
*/
|
|
277
|
-
(p3: Vector2): (p: Bezier2d) => Bezier2d;
|
|
278
|
-
/**
|
|
279
|
-
* Appends control points to a `Bezier2d` with aligned acceleration.
|
|
280
|
-
*
|
|
281
|
-
* @param p - The `Bezier2d` to append the control points to.
|
|
282
|
-
* @param p3 - The third control point (second tangent).
|
|
283
|
-
* @returns A new `Bezier2d` instance with the appended control points.
|
|
284
|
-
*/
|
|
285
|
-
(p: Bezier2d, p3: Vector2): Bezier2d;
|
|
286
|
-
};
|
|
287
|
-
/**
|
|
288
|
-
* Converts a `Bezier2d` to a `CubicPath2d`.
|
|
289
|
-
*
|
|
290
|
-
* @param p - The `Bezier2d` to convert.
|
|
291
|
-
* @returns A new `CubicPath2d` instance representing the same curve as the `Bezier2d`.
|
|
292
|
-
* @since 1.0.0
|
|
293
|
-
*/
|
|
294
|
-
declare const toPath$3: (p: Bezier2d) => CubicPath2d;
|
|
295
|
-
/**
|
|
296
|
-
* Attempts to lower a `RationalBezier2d` to a non-rational `Bezier2d`.
|
|
297
|
-
*
|
|
298
|
-
* Succeeds with `Solution.one(bezier)` when the rational curve's weights are
|
|
299
|
-
* uniform (the curve is mathematically a polynomial Bézier) and returns
|
|
300
|
-
* `Solution.none` otherwise — the rational curve cannot be represented
|
|
301
|
-
* exactly by a non-rational cubic Bézier.
|
|
302
|
-
*
|
|
303
|
-
* @param r - The rational bezier to convert.
|
|
304
|
-
* @returns Either a `Bezier2d` instance or `Solution.none`.
|
|
305
|
-
* @since 2.1.0
|
|
306
|
-
*/
|
|
307
|
-
declare const fromRational: (r: RationalBezier2d) => AtMostOne<Bezier2d>;
|
|
308
|
-
declare const subdivide: {
|
|
309
|
-
/**
|
|
310
|
-
* Splits a `Bezier2d` at the given global parameter `u ∈ (0, 1)` using
|
|
311
|
-
* de Casteljau's algorithm. The two returned beziers together trace the
|
|
312
|
-
* same curve as the input — the left covers `[0, u]`, the right covers
|
|
313
|
-
* `[u, 1]`.
|
|
314
|
-
*
|
|
315
|
-
* @param b - The bezier to split.
|
|
316
|
-
* @param u - The split parameter in the open interval `(0, 1)`.
|
|
317
|
-
* @returns A two-element tuple of the left and right halves.
|
|
318
|
-
* @since 1.1.0
|
|
319
|
-
*/
|
|
320
|
-
(b: Bezier2d, u: number): [Bezier2d, Bezier2d];
|
|
321
|
-
/**
|
|
322
|
-
* Splits a `Bezier2d` at the given global parameter `u ∈ (0, 1)`.
|
|
323
|
-
*
|
|
324
|
-
* @param u - The split parameter in the open interval `(0, 1)`.
|
|
325
|
-
* @returns A function that takes a bezier and returns the two halves.
|
|
326
|
-
* @since 1.1.0
|
|
327
|
-
*/
|
|
328
|
-
(u: number): (b: Bezier2d) => [Bezier2d, Bezier2d];
|
|
329
|
-
};
|
|
330
53
|
//#endregion
|
|
331
54
|
//#region src/splines/cardinal2d.internal.d.ts
|
|
332
55
|
declare const Cardinal2dTypeId: unique symbol;
|
|
333
56
|
type Cardinal2dTypeId = typeof Cardinal2dTypeId;
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
}
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/splines/cardinal2d.d.ts
|
|
337
59
|
/**
|
|
338
60
|
* A Cardinal spline in 2D space.
|
|
339
61
|
*
|
|
62
|
+
* Carries its parameterization (`tension` and `alpha`) as part of the spline's
|
|
63
|
+
* identity rather than as evaluation arguments — the same control points with
|
|
64
|
+
* different tensions describe different curves, so the spline TYPE includes
|
|
65
|
+
* them. See {@link Options} for parameter semantics.
|
|
66
|
+
*
|
|
340
67
|
* All fields are readonly and immutable, and all operations create new instances.
|
|
341
68
|
*
|
|
342
|
-
* The characteristic matrix
|
|
343
|
-
*
|
|
344
|
-
*
|
|
69
|
+
* The classical Cardinal characteristic matrix (uniform parameterization,
|
|
70
|
+
* arbitrary tension) is exposed as `Characteristic.cubicCardinal(tension)`.
|
|
71
|
+
* For non-uniform parameterization (any `alpha != 0`), the per-segment cubic
|
|
72
|
+
* is computed directly from chord-length-weighted tangents.
|
|
345
73
|
*
|
|
346
74
|
* @since 1.0.0
|
|
347
75
|
*/
|
|
348
|
-
interface Cardinal2d extends Pipeable {
|
|
76
|
+
interface Cardinal2d$1 extends Pipeable {
|
|
349
77
|
readonly [Cardinal2dTypeId]: Cardinal2dTypeId;
|
|
78
|
+
readonly points: ReadonlyArray<Vector2>;
|
|
79
|
+
readonly tension: number;
|
|
80
|
+
readonly alpha: number;
|
|
350
81
|
[Symbol.iterator](): IterableIterator<Vector2>;
|
|
351
82
|
}
|
|
352
|
-
/**
|
|
353
|
-
* Checks if a value is a `Cardinal2d`.
|
|
354
|
-
*
|
|
355
|
-
* @param p - The value to check.
|
|
356
|
-
* @returns `true` if the value is a `Cardinal2d`, `false` otherwise.
|
|
357
|
-
* @since 1.0.0
|
|
358
|
-
*/
|
|
359
|
-
declare const isCardinal2d: (p: unknown) => p is Cardinal2d;
|
|
360
|
-
/**
|
|
361
|
-
* Creates a new `Cardinal2d` instance.
|
|
362
|
-
*
|
|
363
|
-
* @param p0 - The first control point.
|
|
364
|
-
* @param p1 - The second control point.
|
|
365
|
-
* @param points - The remaining control points.
|
|
366
|
-
* @returns A new `Cardinal2d` instance.
|
|
367
|
-
* @since 1.0.0
|
|
368
|
-
*/
|
|
369
|
-
declare const make$2: (p0: Vector2, p1: Vector2, ...points: ReadonlyArray<Vector2>) => Cardinal2d;
|
|
370
|
-
/**
|
|
371
|
-
* Creates a new `Cardinal2d` instance from an array of control points.
|
|
372
|
-
*
|
|
373
|
-
* @param points - The control points.
|
|
374
|
-
* @returns A new `Cardinal2d` instance.
|
|
375
|
-
* @since 1.0.0
|
|
376
|
-
*/
|
|
377
|
-
declare const fromArray$2: (points: ReadonlyArray<Vector2>) => Cardinal2d;
|
|
378
|
-
declare const append$2: {
|
|
379
|
-
/**
|
|
380
|
-
* Appends control points to a `Cardinal2d`.
|
|
381
|
-
*
|
|
382
|
-
* @param points - The control points to append.
|
|
383
|
-
* @returns A function that takes a `Cardinal2d` and returns a new `Cardinal2d` instance with the appended control points.
|
|
384
|
-
* @since 1.0.0
|
|
385
|
-
*/
|
|
386
|
-
(...points: ReadonlyArray<Vector2>): (c: Cardinal2d) => Cardinal2d;
|
|
387
|
-
/**
|
|
388
|
-
* Appends control points to a `Cardinal2d`.
|
|
389
|
-
*
|
|
390
|
-
* @param c - The `Cardinal2d` to append the control points to.
|
|
391
|
-
* @param points - The control points to append.
|
|
392
|
-
* @returns A new `Cardinal2d` instance with the appended control points.
|
|
393
|
-
* @since 1.0.0
|
|
394
|
-
*/
|
|
395
|
-
(c: Cardinal2d, ...points: ReadonlyArray<Vector2>): Cardinal2d;
|
|
396
|
-
};
|
|
397
|
-
declare const prepend$2: {
|
|
398
|
-
/**
|
|
399
|
-
* Prepends control points to a `Cardinal2d`.
|
|
400
|
-
*
|
|
401
|
-
* @param points - The control points to prepend.
|
|
402
|
-
* @returns A function that takes a `Cardinal2d` and returns a new `Cardinal2d` instance with the prepended control points.
|
|
403
|
-
* @since 1.0.0
|
|
404
|
-
*/
|
|
405
|
-
(...points: ReadonlyArray<Vector2>): (c: Cardinal2d) => Cardinal2d;
|
|
406
|
-
/**
|
|
407
|
-
* Prepends control points to a `Cardinal2d`.
|
|
408
|
-
*
|
|
409
|
-
* @param c - The `Cardinal2d` to prepend the control points to.
|
|
410
|
-
* @param points - The control points to prepend.
|
|
411
|
-
* @returns A new `Cardinal2d` instance with the prepended control points.
|
|
412
|
-
* @since 1.0.0
|
|
413
|
-
*/
|
|
414
|
-
(c: Cardinal2d, ...points: ReadonlyArray<Vector2>): Cardinal2d;
|
|
415
|
-
};
|
|
416
|
-
/**
|
|
417
|
-
* Doubles the endpoints of a `Cardinal2d` spline.
|
|
418
|
-
*
|
|
419
|
-
* @param c - The `Cardinal2d` to duplicate the endpoints of.
|
|
420
|
-
* @returns A new `Cardinal2d` instance with the duplicated endpoints.
|
|
421
|
-
* @since 1.0.0
|
|
422
|
-
*/
|
|
423
|
-
declare const withDuplicatedEndpoints: (c: Cardinal2d) => Cardinal2d;
|
|
424
|
-
declare const withReflectedEndpoints: {
|
|
425
|
-
/**
|
|
426
|
-
* Reflects the endpoints of a `Cardinal2d` spline.
|
|
427
|
-
*
|
|
428
|
-
* @param scale - The scale factor for the reflection.
|
|
429
|
-
* @returns A function that takes a `Cardinal2d` and returns a new `Cardinal2d` instance with the reflected endpoints.
|
|
430
|
-
* @since 1.0.0
|
|
431
|
-
*/
|
|
432
|
-
(scale: number): (c: Cardinal2d) => Cardinal2d;
|
|
433
|
-
/**
|
|
434
|
-
* Reflects the endpoints of a `Cardinal2d` spline.
|
|
435
|
-
*
|
|
436
|
-
* @param c - The `Cardinal2d` to reflect the endpoints of.
|
|
437
|
-
* @param scale - The scale factor for the reflection.
|
|
438
|
-
* @returns A new `Cardinal2d` instance with the reflected endpoints.
|
|
439
|
-
* @since 1.0.0
|
|
440
|
-
*/
|
|
441
|
-
(c: Cardinal2d, scale?: number): Cardinal2d;
|
|
442
|
-
};
|
|
443
|
-
declare const toPath$2: {
|
|
444
|
-
/**
|
|
445
|
-
* Converts a `Cardinal2d` to a `CubicPath2d`.
|
|
446
|
-
*
|
|
447
|
-
* @param scale - The scale factor for the conversion.
|
|
448
|
-
* @returns A Function that takes a `Cardinal2d` and returns a new `CubicPath2d` instance.
|
|
449
|
-
* @since 1.0.0
|
|
450
|
-
*/
|
|
451
|
-
(scale: number): (c: Cardinal2d) => CubicPath2d;
|
|
452
|
-
/**
|
|
453
|
-
* Converts a `Cardinal2d` to a `CubicPath2d`.
|
|
454
|
-
*
|
|
455
|
-
* @param c - The `Cardinal2d` to convert.
|
|
456
|
-
* @param scale - The scale factor for the conversion.
|
|
457
|
-
* @returns A new `CubicPath2d` instance representing the same curve as the `Cardinal2d`.
|
|
458
|
-
* @since 1.0.0
|
|
459
|
-
*/
|
|
460
|
-
(c: Cardinal2d, scale?: number): CubicPath2d;
|
|
461
|
-
};
|
|
462
|
-
declare const toBezier$2: {
|
|
463
|
-
/**
|
|
464
|
-
* Converts a `Cardinal2d` to a `Bezier2d`.
|
|
465
|
-
*
|
|
466
|
-
* @param p - The `Cardinal2d` to convert.
|
|
467
|
-
* @returns A new `Bezier2d` instance representing the same curve as the `Cardinal2d`.
|
|
468
|
-
* @since 1.0.0
|
|
469
|
-
*/
|
|
470
|
-
(p: Cardinal2d): Bezier2d;
|
|
471
|
-
/**
|
|
472
|
-
* Converts a `Cardinal2d` to a `Bezier2d`.
|
|
473
|
-
*
|
|
474
|
-
* @param p - The `Cardinal2d` to convert.
|
|
475
|
-
* @param scale - The scale factor for the conversion.
|
|
476
|
-
* @returns A new `Bezier2d` instance representing the same curve as the `Cardinal2d`.
|
|
477
|
-
* @since 1.0.0
|
|
478
|
-
*/
|
|
479
|
-
(p: Cardinal2d, scale: number): Bezier2d;
|
|
480
|
-
};
|
|
481
83
|
//#endregion
|
|
482
84
|
//#region src/splines/hermite2d.internal.d.ts
|
|
483
85
|
declare const Hermite2dTypeId: unique symbol;
|
|
484
86
|
type Hermite2dTypeId = typeof Hermite2dTypeId;
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
}
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/splines/hermite2d.d.ts
|
|
488
89
|
/**
|
|
489
90
|
* A Hermite spline in 2D space.
|
|
490
91
|
*
|
|
@@ -495,102 +96,16 @@ declare namespace hermite2d_d_exports {
|
|
|
495
96
|
*
|
|
496
97
|
* @since 1.0.0
|
|
497
98
|
*/
|
|
498
|
-
interface Hermite2d extends Pipeable {
|
|
99
|
+
interface Hermite2d$1 extends Pipeable {
|
|
499
100
|
readonly [Hermite2dTypeId]: Hermite2dTypeId;
|
|
500
101
|
[Symbol.iterator](): IterableIterator<Vector2>;
|
|
501
102
|
}
|
|
502
|
-
/**
|
|
503
|
-
* Checks if a value is a `Hermite2d`.
|
|
504
|
-
*
|
|
505
|
-
* @param p - The value to check.
|
|
506
|
-
* @returns `true` if the value is a `Hermite2d`, `false` otherwise.
|
|
507
|
-
* @since 1.0.0
|
|
508
|
-
*/
|
|
509
|
-
declare const isHermite2d: (p: unknown) => p is Hermite2d;
|
|
510
|
-
/**
|
|
511
|
-
* Creates a new `Hermite2d` instance.
|
|
512
|
-
*
|
|
513
|
-
* @param p0 - The first control point.
|
|
514
|
-
* @param v0 - The first tangent vector.
|
|
515
|
-
* @param p1 - The second control point.
|
|
516
|
-
* @param v1 - The second tangent vector.
|
|
517
|
-
* @returns A new `Hermite2d` instance.
|
|
518
|
-
* @since 1.0.0
|
|
519
|
-
*/
|
|
520
|
-
declare const make$1: (p0: Vector2, v0: Vector2, p1: Vector2, v1: Vector2) => Hermite2d;
|
|
521
|
-
/**
|
|
522
|
-
* Creates a new `Hermite2d` instance from an array of control points.
|
|
523
|
-
*
|
|
524
|
-
* @param points - The control points.
|
|
525
|
-
* @returns A new `Hermite2d` instance.
|
|
526
|
-
* @since 1.0.0
|
|
527
|
-
*/
|
|
528
|
-
declare const fromArray$1: (points: ReadonlyArray<Vector2>) => Hermite2d;
|
|
529
|
-
declare const append$1: {
|
|
530
|
-
/**
|
|
531
|
-
* Appends a new control point and tangent vector to the Hermite spline.
|
|
532
|
-
*
|
|
533
|
-
* @param p1 - The new control point.
|
|
534
|
-
* @param v1 - The new tangent vector.
|
|
535
|
-
* @returns A new `Hermite2d` instance with the appended control point and tangent vector.
|
|
536
|
-
* @since 1.0.0
|
|
537
|
-
*/
|
|
538
|
-
(p1: Vector2, v1: Vector2): (p: Hermite2d) => Hermite2d;
|
|
539
|
-
/**
|
|
540
|
-
* Appends a new control point and tangent vector to the Hermite spline.
|
|
541
|
-
*
|
|
542
|
-
* @param p - The `Hermite2d` to append the control point and tangent vector to.
|
|
543
|
-
* @param p1 - The new control point.
|
|
544
|
-
* @param v1 - The new tangent vector.
|
|
545
|
-
* @returns A new `Hermite2d` instance with the appended control point and tangent vector.
|
|
546
|
-
* @since 1.0.0
|
|
547
|
-
*/
|
|
548
|
-
(p: Hermite2d, p1: Vector2, v1: Vector2): Hermite2d;
|
|
549
|
-
};
|
|
550
|
-
declare const prepend$1: {
|
|
551
|
-
/**
|
|
552
|
-
* Prepends a new control point and tangent vector to the Hermite spline.
|
|
553
|
-
*
|
|
554
|
-
* @param p0 - The new control point.
|
|
555
|
-
* @param v0 - The new tangent vector.
|
|
556
|
-
* @returns A new `Hermite2d` instance with the prepended control point and tangent vector.
|
|
557
|
-
* @since 1.0.0
|
|
558
|
-
*/
|
|
559
|
-
(p0: Vector2, v0: Vector2): (p: Hermite2d) => Hermite2d;
|
|
560
|
-
/**
|
|
561
|
-
* Prepends a new control point and tangent vector to the Hermite spline.
|
|
562
|
-
*
|
|
563
|
-
* @param p - The `Hermite2d` to prepend the control point and tangent vector to.
|
|
564
|
-
* @param p0 - The new control point.
|
|
565
|
-
* @param v0 - The new tangent vector.
|
|
566
|
-
* @returns A new `Hermite2d` instance with the prepended control point and tangent vector.
|
|
567
|
-
* @since 1.0.0
|
|
568
|
-
*/
|
|
569
|
-
(p: Hermite2d, p0: Vector2, v0: Vector2): Hermite2d;
|
|
570
|
-
};
|
|
571
|
-
/**
|
|
572
|
-
* Creates a new `CubicPath2d` instance from a `Hermite2d`.
|
|
573
|
-
*
|
|
574
|
-
* @param p - The `Hermite2d` to convert.
|
|
575
|
-
* @returns A new `CubicPath2d` instance.
|
|
576
|
-
* @since 1.0.0
|
|
577
|
-
*/
|
|
578
|
-
declare const toPath$1: (p: Hermite2d) => CubicPath2d;
|
|
579
|
-
/**
|
|
580
|
-
* Converts a `Hermite2d` to a `Bezier2d`.
|
|
581
|
-
*
|
|
582
|
-
* @param p - The `Hermite2d` to convert.
|
|
583
|
-
* @returns A new `Bezier2d` instance.
|
|
584
|
-
* @since 1.0.0
|
|
585
|
-
*/
|
|
586
|
-
declare const toBezier$1: (p: Hermite2d) => Bezier2d;
|
|
587
103
|
//#endregion
|
|
588
104
|
//#region src/splines/basis2d.internal.d.ts
|
|
589
105
|
declare const Basis2dTypeId: unique symbol;
|
|
590
106
|
type Basis2dTypeId = typeof Basis2dTypeId;
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
}
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/splines/basis2d.d.ts
|
|
594
109
|
/**
|
|
595
110
|
* A Basis Spline (uniform cubic B-spline) in 2D space.
|
|
596
111
|
*
|
|
@@ -601,101 +116,17 @@ declare namespace basis2d_d_exports {
|
|
|
601
116
|
*
|
|
602
117
|
* @since 1.0.0
|
|
603
118
|
*/
|
|
604
|
-
interface Basis2d extends Pipeable {
|
|
119
|
+
interface Basis2d$1 extends Pipeable {
|
|
605
120
|
readonly [Basis2dTypeId]: Basis2dTypeId;
|
|
606
121
|
[Symbol.iterator](): Iterator<Vector2>;
|
|
607
122
|
}
|
|
608
|
-
/**
|
|
609
|
-
* Checks if a value is a `Basis2d`.
|
|
610
|
-
*
|
|
611
|
-
* @param p - The value to check.
|
|
612
|
-
* @returns `true` if the value is a `Basis2d`, `false` otherwise.
|
|
613
|
-
* @since 1.0.0
|
|
614
|
-
*/
|
|
615
|
-
declare const isBasis2d: (p: unknown) => p is Basis2d;
|
|
616
|
-
/**
|
|
617
|
-
* Creates a new `Basis2d` instance.
|
|
618
|
-
*
|
|
619
|
-
* @param p0 - The first control point.
|
|
620
|
-
* @param p1 - The second control point.
|
|
621
|
-
* @param p2 - The third control point.
|
|
622
|
-
* @param p3 - The fourth control point.
|
|
623
|
-
* @returns A new `Basis2d` instance.
|
|
624
|
-
* @since 1.0.0
|
|
625
|
-
*/
|
|
626
|
-
declare const make: (p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2) => Basis2d;
|
|
627
|
-
/**
|
|
628
|
-
* Creates a new `Basis2d` instance from an array of control points.
|
|
629
|
-
*
|
|
630
|
-
* @param points - The control points.
|
|
631
|
-
* @returns A new `Basis2d` instance.
|
|
632
|
-
* @since 1.0.0
|
|
633
|
-
*/
|
|
634
|
-
declare const fromArray: (points: ReadonlyArray<Vector2>) => Basis2d;
|
|
635
|
-
declare const append: {
|
|
636
|
-
/**
|
|
637
|
-
* Appends control points to a `Basis2d`.
|
|
638
|
-
*
|
|
639
|
-
* @param points - The control points to append.
|
|
640
|
-
* @returns A function that takes a `Basis2d` and returns a new `Basis2d` instance with the appended control points.
|
|
641
|
-
* @since 1.0.0
|
|
642
|
-
*/
|
|
643
|
-
(...points: ReadonlyArray<Vector2>): (p: Basis2d) => Basis2d;
|
|
644
|
-
/**
|
|
645
|
-
* Appends control points to a `Basis2d`.
|
|
646
|
-
*
|
|
647
|
-
* @param p - The `Basis2d` to append the control points to.
|
|
648
|
-
* @param points - The control points to append.
|
|
649
|
-
* @returns A new `Basis2d` instance with the appended control points.
|
|
650
|
-
* @since 1.0.0
|
|
651
|
-
*/
|
|
652
|
-
(p: Basis2d, ...points: ReadonlyArray<Vector2>): Basis2d;
|
|
653
|
-
};
|
|
654
|
-
declare const prepend: {
|
|
655
|
-
/**
|
|
656
|
-
* Prepends control points to a `Basis2d`.
|
|
657
|
-
*
|
|
658
|
-
* @param points - The control points to prepend.
|
|
659
|
-
* @returns A function that takes a `Basis2d` and returns a new `Basis2d` instance with the prepended control points.
|
|
660
|
-
* @since 1.0.0
|
|
661
|
-
*/
|
|
662
|
-
(...points: ReadonlyArray<Vector2>): (p: Basis2d) => Basis2d;
|
|
663
|
-
/**
|
|
664
|
-
* Prepends control points to a `Basis2d`.
|
|
665
|
-
*
|
|
666
|
-
* @param p - The `Basis2d` to prepend the control points to.
|
|
667
|
-
* @param points - The control points to prepend.
|
|
668
|
-
* @returns A new `Basis2d` instance with the prepended control points.
|
|
669
|
-
* @since 1.0.0
|
|
670
|
-
*/
|
|
671
|
-
(p: Basis2d, ...points: ReadonlyArray<Vector2>): Basis2d;
|
|
672
|
-
};
|
|
673
|
-
/**
|
|
674
|
-
* Triplicates the endpoints of a `Basis2d`.
|
|
675
|
-
*
|
|
676
|
-
* This is useful for creating a closed loop spline.
|
|
677
|
-
*
|
|
678
|
-
* @param p - The `Basis2d` to triplicate the endpoints of.
|
|
679
|
-
* @returns A new `Basis2d` instance with the triplicated endpoints.
|
|
680
|
-
* @since 1.0.0
|
|
681
|
-
*/
|
|
682
|
-
declare const withTriplicatedEndpoints: (p: Basis2d) => Basis2d;
|
|
683
|
-
/**
|
|
684
|
-
* Creates a new `Path2d` from a `Basis2d`.
|
|
685
|
-
*
|
|
686
|
-
* @param p - The `Basis2d` to convert to a `Path2d`.
|
|
687
|
-
* @returns A new `Path2d` instance.
|
|
688
|
-
* @since 1.0.0
|
|
689
|
-
*/
|
|
690
|
-
declare const toPath: (p: Basis2d) => CubicPath2d;
|
|
691
|
-
/**
|
|
692
|
-
* Converts a `Basis2d` to a `Bezier2d`.
|
|
693
|
-
*
|
|
694
|
-
* @param p - The `Basis2d` to convert.
|
|
695
|
-
* @returns A new `Bezier2d` instance.
|
|
696
|
-
* @since 1.0.0
|
|
697
|
-
*/
|
|
698
|
-
declare const toBezier: (p: Basis2d) => Bezier2d;
|
|
699
123
|
//#endregion
|
|
700
|
-
|
|
124
|
+
//#region src/splines/index.d.ts
|
|
125
|
+
type Bezier2d = Bezier2d$1;
|
|
126
|
+
type Cardinal2d = Cardinal2d$1;
|
|
127
|
+
type Hermite2d = Hermite2d$1;
|
|
128
|
+
type Basis2d = Basis2d$1;
|
|
129
|
+
type RationalBezier2d = RationalBezier2d$1;
|
|
130
|
+
//#endregion
|
|
131
|
+
export { Basis2d, Bezier2d, Cardinal2d, Hermite2d, RationalBezier2d };
|
|
701
132
|
//# sourceMappingURL=index.d.mts.map
|