curvy 1.0.9 → 2.0.0-alpha.2
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 +88 -0
- package/dist/characteristic/index.mjs +2 -0
- package/dist/curve/index.d.mts +2 -0
- package/dist/curve/index.mjs +2 -0
- package/dist/interval/index.d.mts +3 -0
- package/dist/interval/index.mjs +3 -0
- package/dist/matrix/index.d.mts +2 -0
- package/dist/matrix/index.mjs +267 -0
- package/dist/matrix/index.mjs.map +1 -0
- package/dist/number.d.mts +280 -0
- package/dist/number.mjs +140 -0
- package/dist/number.mjs.map +1 -0
- package/dist/path/index.d.mts +261 -0
- package/dist/path/index.mjs +325 -0
- package/dist/path/index.mjs.map +1 -0
- package/dist/polynomial/index.d.mts +2 -0
- package/dist/polynomial/index.mjs +3 -0
- package/dist/shared/characteristic-B9nCh_cx.mjs +104 -0
- package/dist/shared/characteristic-B9nCh_cx.mjs.map +1 -0
- package/dist/shared/chunk-25Hzd3z8.mjs +13 -0
- package/dist/shared/cubic-BajUY0JT.d.mts +1100 -0
- package/dist/shared/cubic-CpHAx8cC.mjs +479 -0
- package/dist/shared/cubic-CpHAx8cC.mjs.map +1 -0
- package/dist/shared/interval-05CR6eBf.mjs +421 -0
- package/dist/shared/interval-05CR6eBf.mjs.map +1 -0
- package/dist/shared/interval-Dy-RMEE3.d.mts +533 -0
- package/dist/shared/interval2d-8IBZnUOq.mjs +108 -0
- package/dist/shared/interval2d-8IBZnUOq.mjs.map +1 -0
- package/dist/shared/interval2d-C2id9u31.d.mts +172 -0
- package/dist/shared/matrix4x4-Ck2WROK-.mjs +440 -0
- package/dist/shared/matrix4x4-Ck2WROK-.mjs.map +1 -0
- package/dist/shared/matrix4x4-Dm_tSiH1.d.mts +1183 -0
- package/dist/shared/quadratic-CamozcFc.mjs +330 -0
- package/dist/shared/quadratic-CamozcFc.mjs.map +1 -0
- package/dist/shared/rationalCubic2d-B6g97ryJ.d.mts +308 -0
- package/dist/shared/rationalCubic2d-BEgUGSFf.mjs +295 -0
- package/dist/shared/rationalCubic2d-BEgUGSFf.mjs.map +1 -0
- package/dist/shared/rationalCubic2d-Bys2Uory.mjs +695 -0
- package/dist/shared/rationalCubic2d-Bys2Uory.mjs.map +1 -0
- package/dist/shared/rationalCubic2d-DlQfBURs.d.mts +818 -0
- package/dist/shared/solution-CrtLfqEq.mjs +306 -0
- package/dist/shared/solution-CrtLfqEq.mjs.map +1 -0
- package/dist/shared/solution-sNQ-ZVhN.d.mts +251 -0
- package/dist/{pipe.d.mts → shared/utils-MCckigYk.d.mts} +44 -26
- package/dist/shared/vector2-CL1HDdPr.mjs +187 -0
- package/dist/shared/vector2-CL1HDdPr.mjs.map +1 -0
- package/dist/shared/vector2-DPUY3_eA.d.mts +470 -0
- package/dist/shared/vector2.internal-DU_E808S.mjs +97 -0
- package/dist/shared/vector2.internal-DU_E808S.mjs.map +1 -0
- package/dist/shared/vector3-D-tv_aKL.mjs +204 -0
- package/dist/shared/vector3-D-tv_aKL.mjs.map +1 -0
- package/dist/shared/vector3-DqeOZtOB.d.mts +703 -0
- package/dist/shared/vector4-5KbjoHVj.mjs +109 -0
- package/dist/shared/vector4-5KbjoHVj.mjs.map +1 -0
- package/dist/shared/vector4.internal-5XcaX12X.mjs +163 -0
- package/dist/shared/vector4.internal-5XcaX12X.mjs.map +1 -0
- package/dist/solution/index.d.mts +2 -0
- package/dist/solution/index.mjs +2 -0
- package/dist/splines/index.d.mts +701 -0
- package/dist/splines/index.mjs +734 -0
- package/dist/splines/index.mjs.map +1 -0
- package/dist/utils.d.mts +2 -205
- package/dist/utils.mjs +88 -52
- package/dist/utils.mjs.map +1 -1
- package/dist/vector/index.d.mts +3 -0
- package/dist/vector/index.mjs +4 -0
- package/package.json +49 -92
- package/dist/curve/cubic2d.d.mts +0 -109
- package/dist/curve/cubic2d.d.ts +0 -109
- package/dist/curve/cubic2d.mjs +0 -80
- package/dist/curve/cubic2d.mjs.map +0 -1
- package/dist/curve/linear2d.d.mts +0 -94
- package/dist/curve/linear2d.d.ts +0 -94
- package/dist/curve/linear2d.mjs +0 -46
- package/dist/curve/linear2d.mjs.map +0 -1
- package/dist/curve/quadratic2d.d.mts +0 -117
- package/dist/curve/quadratic2d.d.ts +0 -117
- package/dist/curve/quadratic2d.mjs +0 -82
- package/dist/curve/quadratic2d.mjs.map +0 -1
- package/dist/interval.d.mts +0 -251
- package/dist/interval.d.ts +0 -251
- package/dist/interval.mjs +0 -86
- package/dist/interval.mjs.map +0 -1
- package/dist/matrix/matrix2x2.d.mts +0 -320
- package/dist/matrix/matrix2x2.d.ts +0 -320
- package/dist/matrix/matrix2x2.mjs +0 -25
- package/dist/matrix/matrix2x2.mjs.map +0 -1
- package/dist/matrix/matrix3x3.d.mts +0 -370
- package/dist/matrix/matrix3x3.d.ts +0 -370
- package/dist/matrix/matrix3x3.mjs +0 -28
- package/dist/matrix/matrix3x3.mjs.map +0 -1
- package/dist/matrix/matrix4x4.d.mts +0 -381
- package/dist/matrix/matrix4x4.d.ts +0 -381
- package/dist/matrix/matrix4x4.mjs +0 -178
- package/dist/matrix/matrix4x4.mjs.map +0 -1
- package/dist/path/cubic2d.d.mts +0 -95
- package/dist/path/cubic2d.d.ts +0 -95
- package/dist/path/cubic2d.mjs +0 -60
- package/dist/path/cubic2d.mjs.map +0 -1
- package/dist/path/linear2d.d.mts +0 -95
- package/dist/path/linear2d.d.ts +0 -95
- package/dist/path/linear2d.mjs +0 -53
- package/dist/path/linear2d.mjs.map +0 -1
- package/dist/path/quadratic2d.d.mts +0 -95
- package/dist/path/quadratic2d.d.ts +0 -95
- package/dist/path/quadratic2d.mjs +0 -57
- package/dist/path/quadratic2d.mjs.map +0 -1
- package/dist/pipe.d.ts +0 -58
- package/dist/pipe.mjs +0 -92
- package/dist/pipe.mjs.map +0 -1
- package/dist/polynomial/cubic.d.mts +0 -7
- package/dist/polynomial/cubic.d.ts +0 -7
- package/dist/polynomial/cubic.mjs +0 -133
- package/dist/polynomial/cubic.mjs.map +0 -1
- package/dist/polynomial/linear.d.mts +0 -7
- package/dist/polynomial/linear.d.ts +0 -7
- package/dist/polynomial/linear.mjs +0 -24
- package/dist/polynomial/linear.mjs.map +0 -1
- package/dist/polynomial/quadratic.d.mts +0 -7
- package/dist/polynomial/quadratic.d.ts +0 -7
- package/dist/polynomial/quadratic.mjs +0 -27
- package/dist/polynomial/quadratic.mjs.map +0 -1
- package/dist/shared/curvy.Bf5TIk31.d.mts +0 -22
- package/dist/shared/curvy.Bf5TIk31.d.ts +0 -22
- package/dist/shared/curvy.BkkW8Tx9.mjs +0 -102
- package/dist/shared/curvy.BkkW8Tx9.mjs.map +0 -1
- package/dist/shared/curvy.BxdGW9he.mjs +0 -116
- package/dist/shared/curvy.BxdGW9he.mjs.map +0 -1
- package/dist/shared/curvy.C_sCeg9J.mjs +0 -66
- package/dist/shared/curvy.C_sCeg9J.mjs.map +0 -1
- package/dist/shared/curvy.Cg8lZVUz.d.ts +0 -688
- package/dist/shared/curvy.DCt1gGII.mjs +0 -147
- package/dist/shared/curvy.DCt1gGII.mjs.map +0 -1
- package/dist/shared/curvy.DJ4xO0al.mjs +0 -63
- package/dist/shared/curvy.DJ4xO0al.mjs.map +0 -1
- package/dist/shared/curvy.DmVFTi0N.mjs +0 -35
- package/dist/shared/curvy.DmVFTi0N.mjs.map +0 -1
- package/dist/shared/curvy.FDaj5rlj.d.mts +0 -688
- package/dist/shared/curvy.lktriTpx.mjs +0 -101
- package/dist/shared/curvy.lktriTpx.mjs.map +0 -1
- package/dist/shared/curvy.mLFprrGm.mjs +0 -85
- package/dist/shared/curvy.mLFprrGm.mjs.map +0 -1
- package/dist/shared/curvy.r6f1j287.mjs +0 -76
- package/dist/shared/curvy.r6f1j287.mjs.map +0 -1
- package/dist/splines/basis2d.d.mts +0 -130
- package/dist/splines/basis2d.d.ts +0 -130
- package/dist/splines/basis2d.mjs +0 -90
- package/dist/splines/basis2d.mjs.map +0 -1
- package/dist/splines/bezier2d.d.mts +0 -182
- package/dist/splines/bezier2d.d.ts +0 -182
- package/dist/splines/bezier2d.mjs +0 -23
- package/dist/splines/bezier2d.mjs.map +0 -1
- package/dist/splines/cardinal2d.d.mts +0 -178
- package/dist/splines/cardinal2d.d.ts +0 -178
- package/dist/splines/cardinal2d.mjs +0 -114
- package/dist/splines/cardinal2d.mjs.map +0 -1
- package/dist/splines/hermite2d.d.mts +0 -124
- package/dist/splines/hermite2d.d.ts +0 -124
- package/dist/splines/hermite2d.mjs +0 -63
- package/dist/splines/hermite2d.mjs.map +0 -1
- package/dist/utils.d.ts +0 -205
- package/dist/vector/vector2.d.mts +0 -324
- package/dist/vector/vector2.d.ts +0 -324
- package/dist/vector/vector2.mjs +0 -30
- package/dist/vector/vector2.mjs.map +0 -1
- package/dist/vector/vector3.d.mts +0 -417
- package/dist/vector/vector3.d.ts +0 -417
- package/dist/vector/vector3.mjs +0 -38
- package/dist/vector/vector3.mjs.map +0 -1
- package/dist/vector/vector4.d.mts +0 -205
- package/dist/vector/vector4.d.ts +0 -205
- package/dist/vector/vector4.mjs +0 -20
- package/dist/vector/vector4.mjs.map +0 -1
|
@@ -0,0 +1,701 @@
|
|
|
1
|
+
import { n as Weighted, t as Vector2 } from "../shared/vector2-DPUY3_eA.mjs";
|
|
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
|
+
|
|
6
|
+
//#region src/splines/rationalBezier2d.internal.d.ts
|
|
7
|
+
declare const RationalBezier2dTypeId: unique symbol;
|
|
8
|
+
type RationalBezier2dTypeId = typeof RationalBezier2dTypeId;
|
|
9
|
+
declare namespace rationalBezier2d_d_exports {
|
|
10
|
+
export { RationalBezier2d, fromArray$4 as fromArray, fromBezier, fromPoints, isRationalBezier2d, make$4 as make, subdivide$1 as subdivide, toPath$4 as toPath };
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A piecewise rational cubic Bézier curve in 2D space.
|
|
14
|
+
*
|
|
15
|
+
* Each control point is a `Vector2.Weighted` carrying a positive scalar
|
|
16
|
+
* weight; the curve evaluates to `Σ w_i · N_i(t) · P_i / Σ w_i · N_i(t)`,
|
|
17
|
+
* where `N_i` are the cubic Bernstein basis functions. With all weights
|
|
18
|
+
* equal, the curve coincides with a non-rational `Bezier2d`. With unequal
|
|
19
|
+
* weights, the curve can exactly represent conic sections — circles,
|
|
20
|
+
* ellipses, parabolas, and hyperbolas — that polynomial Béziers can only
|
|
21
|
+
* approximate.
|
|
22
|
+
*
|
|
23
|
+
* Internally each control point is stored in homogeneous form `(w·x, w·y, w)`,
|
|
24
|
+
* so de Casteljau evaluation is three independent linear interpolations
|
|
25
|
+
* followed by a single division. Iteration projects back to `Vector2.Weighted`
|
|
26
|
+
* — the same shape accepted by {@link make}.
|
|
27
|
+
*
|
|
28
|
+
* All fields are readonly and immutable, and all operations create new instances.
|
|
29
|
+
*
|
|
30
|
+
* @since 2.1.0
|
|
31
|
+
*/
|
|
32
|
+
interface RationalBezier2d extends Pipeable {
|
|
33
|
+
readonly [RationalBezier2dTypeId]: RationalBezier2dTypeId;
|
|
34
|
+
[Symbol.iterator](): IterableIterator<Weighted>;
|
|
35
|
+
}
|
|
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
|
+
//#endregion
|
|
141
|
+
//#region src/splines/bezier2d.internal.d.ts
|
|
142
|
+
declare const Bezier2dTypeId: unique symbol;
|
|
143
|
+
type Bezier2dTypeId = typeof Bezier2dTypeId;
|
|
144
|
+
declare namespace bezier2d_d_exports {
|
|
145
|
+
export { Bezier2d, append$3 as append, appendAccelerationAligned, appendCurvatureAligned, appendTangentAligned, appendVelocityAligned, fromArray$3 as fromArray, fromRational, isCubicBezier2d, make$3 as make, subdivide, toPath$3 as toPath };
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* A Bézier curve in 2D space.
|
|
149
|
+
*
|
|
150
|
+
* All fields are readonly and immutable, and all operations create new instances.
|
|
151
|
+
*
|
|
152
|
+
* The characteristic matrix that identifies this spline family lives in the
|
|
153
|
+
* `characteristic` module as `Characteristic.cubicBezier`.
|
|
154
|
+
*
|
|
155
|
+
* @since 1.0.0
|
|
156
|
+
*/
|
|
157
|
+
interface Bezier2d extends Pipeable {
|
|
158
|
+
readonly [Bezier2dTypeId]: Bezier2dTypeId;
|
|
159
|
+
[Symbol.iterator](): IterableIterator<Vector2>;
|
|
160
|
+
}
|
|
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
|
+
//#endregion
|
|
331
|
+
//#region src/splines/cardinal2d.internal.d.ts
|
|
332
|
+
declare const Cardinal2dTypeId: unique symbol;
|
|
333
|
+
type Cardinal2dTypeId = typeof Cardinal2dTypeId;
|
|
334
|
+
declare namespace cardinal2d_d_exports {
|
|
335
|
+
export { Cardinal2d, append$2 as append, fromArray$2 as fromArray, isCardinal2d, make$2 as make, prepend$2 as prepend, toBezier$2 as toBezier, toPath$2 as toPath, withDuplicatedEndpoints, withReflectedEndpoints };
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* A Cardinal spline in 2D space.
|
|
339
|
+
*
|
|
340
|
+
* All fields are readonly and immutable, and all operations create new instances.
|
|
341
|
+
*
|
|
342
|
+
* The characteristic matrix that identifies this spline family lives in the
|
|
343
|
+
* `characteristic` module as `Characteristic.cubicCardinal(tension)` (and
|
|
344
|
+
* the Catmull-Rom variant as `Characteristic.cubicCatmullRom`).
|
|
345
|
+
*
|
|
346
|
+
* @since 1.0.0
|
|
347
|
+
*/
|
|
348
|
+
interface Cardinal2d extends Pipeable {
|
|
349
|
+
readonly [Cardinal2dTypeId]: Cardinal2dTypeId;
|
|
350
|
+
[Symbol.iterator](): IterableIterator<Vector2>;
|
|
351
|
+
}
|
|
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
|
+
//#endregion
|
|
482
|
+
//#region src/splines/hermite2d.internal.d.ts
|
|
483
|
+
declare const Hermite2dTypeId: unique symbol;
|
|
484
|
+
type Hermite2dTypeId = typeof Hermite2dTypeId;
|
|
485
|
+
declare namespace hermite2d_d_exports {
|
|
486
|
+
export { Hermite2d, append$1 as append, fromArray$1 as fromArray, isHermite2d, make$1 as make, prepend$1 as prepend, toBezier$1 as toBezier, toPath$1 as toPath };
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* A Hermite spline in 2D space.
|
|
490
|
+
*
|
|
491
|
+
* All fields are readonly and immutable, and all operations create new instances.
|
|
492
|
+
*
|
|
493
|
+
* The characteristic matrix that identifies this spline family lives in the
|
|
494
|
+
* `characteristic` module as `Characteristic.cubicHermite`.
|
|
495
|
+
*
|
|
496
|
+
* @since 1.0.0
|
|
497
|
+
*/
|
|
498
|
+
interface Hermite2d extends Pipeable {
|
|
499
|
+
readonly [Hermite2dTypeId]: Hermite2dTypeId;
|
|
500
|
+
[Symbol.iterator](): IterableIterator<Vector2>;
|
|
501
|
+
}
|
|
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
|
+
//#endregion
|
|
588
|
+
//#region src/splines/basis2d.internal.d.ts
|
|
589
|
+
declare const Basis2dTypeId: unique symbol;
|
|
590
|
+
type Basis2dTypeId = typeof Basis2dTypeId;
|
|
591
|
+
declare namespace basis2d_d_exports {
|
|
592
|
+
export { Basis2d, append, fromArray, isBasis2d, make, prepend, toBezier, toPath, withTriplicatedEndpoints };
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* A Basis Spline (uniform cubic B-spline) in 2D space.
|
|
596
|
+
*
|
|
597
|
+
* All fields are readonly and immutable, and all operations create new instances.
|
|
598
|
+
*
|
|
599
|
+
* The characteristic matrix that identifies this spline family lives in the
|
|
600
|
+
* `characteristic` module as `Characteristic.cubicBasisSpline`.
|
|
601
|
+
*
|
|
602
|
+
* @since 1.0.0
|
|
603
|
+
*/
|
|
604
|
+
interface Basis2d extends Pipeable {
|
|
605
|
+
readonly [Basis2dTypeId]: Basis2dTypeId;
|
|
606
|
+
[Symbol.iterator](): Iterator<Vector2>;
|
|
607
|
+
}
|
|
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
|
+
//#endregion
|
|
700
|
+
export { basis2d_d_exports as Basis2d, bezier2d_d_exports as Bezier2d, cardinal2d_d_exports as Cardinal2d, hermite2d_d_exports as Hermite2d, rationalBezier2d_d_exports as RationalBezier2d };
|
|
701
|
+
//# sourceMappingURL=index.d.mts.map
|