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,703 @@
|
|
|
1
|
+
import { i as FourDimensional, s as ThreeDimensional } from "./vector2-DPUY3_eA.mjs";
|
|
2
|
+
import { t as Pipeable } from "./utils-MCckigYk.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/vector/vector4.internal.d.ts
|
|
5
|
+
declare const Vector4TypeId: unique symbol;
|
|
6
|
+
type Vector4TypeId = typeof Vector4TypeId;
|
|
7
|
+
declare namespace vector4_d_exports {
|
|
8
|
+
export { Vector4, add$1 as add, components$1 as components, dot$1 as dot, equals$1 as equals, hadamard$1 as hadamard, isVector4, magnitude$1 as magnitude, make$1 as make, normalize$1 as normalize, scale$1 as scale, softmax$1 as softmax, subtract$1 as subtract, transpose$1 as transpose, unit$1 as unit, zero$1 as zero };
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A 4D vector.
|
|
12
|
+
*
|
|
13
|
+
* All fields are readonly and immutable, and all operations create new instances.
|
|
14
|
+
*
|
|
15
|
+
* @since 1.0.0
|
|
16
|
+
*/
|
|
17
|
+
interface Vector4 extends Pipeable, FourDimensional<number> {
|
|
18
|
+
readonly [Vector4TypeId]: Vector4TypeId;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Checks if a value is a `Vector4`.
|
|
22
|
+
*
|
|
23
|
+
* @param v - The value to check.
|
|
24
|
+
* @returns `true` if the value is a `Vector4`, `false` otherwise.
|
|
25
|
+
* @since 1.0.0
|
|
26
|
+
*/
|
|
27
|
+
declare const isVector4: (v: unknown) => v is Vector4;
|
|
28
|
+
declare const equals$1: {
|
|
29
|
+
/**
|
|
30
|
+
* Checks if two `Vector4` instances are approximately equal within the
|
|
31
|
+
* default absolute tolerance ({@link EPSILON}).
|
|
32
|
+
*
|
|
33
|
+
* @param a - The first vector.
|
|
34
|
+
* @param b - The second vector.
|
|
35
|
+
* @returns `true` when each pair of components is within tolerance.
|
|
36
|
+
* @since 1.1.0
|
|
37
|
+
*/
|
|
38
|
+
(a: Vector4, b: Vector4): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Checks if two `Vector4` instances are approximately equal within the
|
|
41
|
+
* default absolute tolerance ({@link EPSILON}).
|
|
42
|
+
*
|
|
43
|
+
* @param b - The second vector.
|
|
44
|
+
* @returns A function that takes the first vector and returns the comparison result.
|
|
45
|
+
* @since 1.1.0
|
|
46
|
+
*/
|
|
47
|
+
(b: Vector4): (a: Vector4) => boolean;
|
|
48
|
+
};
|
|
49
|
+
declare const make$1: {
|
|
50
|
+
/**
|
|
51
|
+
* Creates a new `Vector4` instance.
|
|
52
|
+
*
|
|
53
|
+
* @param xyzw - The x, y, z, and w components of the vector.
|
|
54
|
+
* @returns A new `Vector4` instance.
|
|
55
|
+
* @since 1.0.0
|
|
56
|
+
*/
|
|
57
|
+
(xyzw: number): Vector4;
|
|
58
|
+
/**
|
|
59
|
+
* Creates a new `Vector4` instance.
|
|
60
|
+
*
|
|
61
|
+
* @param x - The x component of the vector.
|
|
62
|
+
* @param yzw - The y, z, and w components of the vector.
|
|
63
|
+
* @returns A new `Vector4` instance.
|
|
64
|
+
* @since 1.0.0
|
|
65
|
+
*/
|
|
66
|
+
(x: number, yzw: number): Vector4;
|
|
67
|
+
/**
|
|
68
|
+
* Creates a new `Vector4` instance.
|
|
69
|
+
*
|
|
70
|
+
* @param x - The x component of the vector.
|
|
71
|
+
* @param y - The y component of the vector.
|
|
72
|
+
* @param zw - The z and w components of the vector.
|
|
73
|
+
* @returns A new `Vector4` instance.
|
|
74
|
+
* @since 1.0.0
|
|
75
|
+
*/
|
|
76
|
+
(x: number, y: number, zw: number): Vector4;
|
|
77
|
+
/**
|
|
78
|
+
* Creates a new `Vector4` instance.
|
|
79
|
+
*
|
|
80
|
+
* @param x - The x component of the vector.
|
|
81
|
+
* @param y - The y component of the vector.
|
|
82
|
+
* @param z - The z component of the vector.
|
|
83
|
+
* @param w - The w component of the vector.
|
|
84
|
+
* @returns A new `Vector4` instance.
|
|
85
|
+
* @since 1.0.0
|
|
86
|
+
*/
|
|
87
|
+
(x: number, y: number, z: number, w: number): Vector4;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Transposes a 4-tuple of items into one or more `Vector4`s, one per channel
|
|
91
|
+
* extracted by the projection function.
|
|
92
|
+
*
|
|
93
|
+
* For each output channel, takes the corresponding number from each of the
|
|
94
|
+
* four projected items and packs them into a `Vector4` — the data-layout
|
|
95
|
+
* transformation NumPy calls a transpose, FP calls `unzip`, GPUs call a
|
|
96
|
+
* gather, and DSP people inexplicably call deinterleaving.
|
|
97
|
+
*
|
|
98
|
+
* The projection's return-tuple arity determines the number of output
|
|
99
|
+
* vectors, and that arity is preserved in the return type.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* // Pack the x and y coordinates of four control points into two Vector4s.
|
|
104
|
+
* const [xs, ys] = Vector4.transpose(
|
|
105
|
+
* [p0, p1, p2, p3],
|
|
106
|
+
* (p) => [p.x, p.y],
|
|
107
|
+
* )
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @param inputs - Exactly four items of any type.
|
|
111
|
+
* @param project - A function returning a fixed-arity tuple of numbers — one per output channel.
|
|
112
|
+
* @returns A tuple of `Vector4`s with the same arity as the projection's return tuple.
|
|
113
|
+
* @since 2.1.0
|
|
114
|
+
*/
|
|
115
|
+
declare const transpose$1: <T, const Channels extends ReadonlyArray<number>>(inputs: readonly [T, T, T, T], project: (item: T) => Channels) => { readonly [K in keyof Channels]: Vector4 };
|
|
116
|
+
/**
|
|
117
|
+
* Gets the magnitude of a `Vector4`.
|
|
118
|
+
*
|
|
119
|
+
* @param vector - The vector to calculate the magnitude of.
|
|
120
|
+
* @returns The magnitude of the vector.
|
|
121
|
+
* @since 1.0.0
|
|
122
|
+
*/
|
|
123
|
+
declare const magnitude$1: (vector: Vector4) => number;
|
|
124
|
+
/**
|
|
125
|
+
* Normalizes a `Vector4`.
|
|
126
|
+
*
|
|
127
|
+
* @param vector - The vector to normalize.
|
|
128
|
+
* @returns A new `Vector4` instance with the same direction as the input vector but with a magnitude of 1.
|
|
129
|
+
* @since 1.0.0
|
|
130
|
+
*/
|
|
131
|
+
declare const normalize$1: (vector: Vector4) => Vector4;
|
|
132
|
+
declare const dot$1: {
|
|
133
|
+
/**
|
|
134
|
+
* Computes the dot product of two `Vector4` instances.
|
|
135
|
+
*
|
|
136
|
+
* @param a - The first vector.
|
|
137
|
+
* @param b - The second vector.
|
|
138
|
+
* @returns The dot product of the two vectors.
|
|
139
|
+
* @since 1.0.0
|
|
140
|
+
*/
|
|
141
|
+
(a: Vector4, b: Vector4): number;
|
|
142
|
+
/**
|
|
143
|
+
* Computes the dot product of a `Vector4` instance and another vector.
|
|
144
|
+
*
|
|
145
|
+
* @param b - The second vector.
|
|
146
|
+
* @returns A function that takes the first vector and returns the dot product.
|
|
147
|
+
* @since 1.0.0
|
|
148
|
+
*/
|
|
149
|
+
(b: Vector4): (a: Vector4) => number;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Returns the components of a `Vector4` as an array.
|
|
153
|
+
*
|
|
154
|
+
* @param v - The vector to get the components of.
|
|
155
|
+
* @returns An array containing the x, y, z, and w components of the vector.
|
|
156
|
+
* @since 1.0.0
|
|
157
|
+
*/
|
|
158
|
+
declare const components$1: (v: Vector4) => [number, number, number, number];
|
|
159
|
+
/**
|
|
160
|
+
* Applies the softmax function to a `Vector4`.
|
|
161
|
+
*
|
|
162
|
+
* @param v - The vector to calculate the softmax of.
|
|
163
|
+
* @returns A new `Vector4` instance representing the softmax of the input vector.
|
|
164
|
+
*/
|
|
165
|
+
declare const softmax$1: (v: Vector4) => Vector4;
|
|
166
|
+
/**
|
|
167
|
+
* Creates a zero vector.
|
|
168
|
+
*
|
|
169
|
+
* @since 1.0.0
|
|
170
|
+
*/
|
|
171
|
+
declare const zero$1: Vector4;
|
|
172
|
+
/**
|
|
173
|
+
* Creates a unit vector.
|
|
174
|
+
*
|
|
175
|
+
* @since 1.0.0
|
|
176
|
+
*/
|
|
177
|
+
declare const unit$1: Vector4;
|
|
178
|
+
declare const add$1: {
|
|
179
|
+
/**
|
|
180
|
+
* Adds two `Vector4` instances.
|
|
181
|
+
*
|
|
182
|
+
* @param a - The first vector.
|
|
183
|
+
* @param b - The second vector.
|
|
184
|
+
* @returns A new `Vector4` instance representing the sum of the two vectors.
|
|
185
|
+
* @since 1.0.0
|
|
186
|
+
*/
|
|
187
|
+
(a: Vector4, b: Vector4): Vector4;
|
|
188
|
+
/**
|
|
189
|
+
* Adds a `Vector4` instance to another vector.
|
|
190
|
+
*
|
|
191
|
+
* @param b - The second vector.
|
|
192
|
+
* @returns A function that takes the first vector and returns the sum.
|
|
193
|
+
* @since 1.0.0
|
|
194
|
+
*/
|
|
195
|
+
(b: Vector4): (a: Vector4) => Vector4;
|
|
196
|
+
};
|
|
197
|
+
declare const subtract$1: {
|
|
198
|
+
/**
|
|
199
|
+
* Subtracts one `Vector4` instance from another.
|
|
200
|
+
*
|
|
201
|
+
* @param a - The first vector.
|
|
202
|
+
* @param b - The second vector.
|
|
203
|
+
* @returns A new `Vector4` instance representing the difference of the two vectors.
|
|
204
|
+
* @since 1.0.0
|
|
205
|
+
*/
|
|
206
|
+
(a: Vector4, b: Vector4): Vector4;
|
|
207
|
+
/**
|
|
208
|
+
* Subtracts a `Vector4` instance from another vector.
|
|
209
|
+
*
|
|
210
|
+
* @param b - The second vector.
|
|
211
|
+
* @returns A function that takes the first vector and returns the difference.
|
|
212
|
+
* @since 1.0.0
|
|
213
|
+
*/
|
|
214
|
+
(b: Vector4): (a: Vector4) => Vector4;
|
|
215
|
+
};
|
|
216
|
+
declare const hadamard$1: {
|
|
217
|
+
/**
|
|
218
|
+
* Computes the Hadamard product of two `Vector4` instances.
|
|
219
|
+
*
|
|
220
|
+
* @param a - The first vector.
|
|
221
|
+
* @param b - The second vector.
|
|
222
|
+
* @returns A new `Vector4` instance representing the Hadamard product of the two vectors.
|
|
223
|
+
* @since 1.0.0
|
|
224
|
+
*/
|
|
225
|
+
(a: Vector4, b: Vector4): Vector4;
|
|
226
|
+
/**
|
|
227
|
+
* Computes the Hadamard product of a `Vector4` instance and another vector.
|
|
228
|
+
*
|
|
229
|
+
* @param b - The second vector.
|
|
230
|
+
* @returns A function that takes the first vector and returns the Hadamard product.
|
|
231
|
+
* @since 1.0.0
|
|
232
|
+
*/
|
|
233
|
+
(b: Vector4): (a: Vector4) => Vector4;
|
|
234
|
+
};
|
|
235
|
+
declare const scale$1: {
|
|
236
|
+
/**
|
|
237
|
+
* Scales a `Vector4` by a scalar.
|
|
238
|
+
*
|
|
239
|
+
* @param s - The scalar to scale the vector by.
|
|
240
|
+
* @returns A function that takes the vector and returns the scaled vector.
|
|
241
|
+
* @since 1.0.0
|
|
242
|
+
*/
|
|
243
|
+
(s: number): (v: Vector4) => Vector4;
|
|
244
|
+
/**
|
|
245
|
+
* Scales a `Vector4` by a scalar.
|
|
246
|
+
*
|
|
247
|
+
* @param s - The scalar to scale the vector by.
|
|
248
|
+
* @param v - The vector to scale.
|
|
249
|
+
* @returns A new `Vector4` instance representing the scaled vector.
|
|
250
|
+
* @since 1.0.0
|
|
251
|
+
*/
|
|
252
|
+
(v: Vector4, s: number): Vector4;
|
|
253
|
+
};
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region src/vector/vector3.internal.d.ts
|
|
256
|
+
declare const Vector3TypeId: unique symbol;
|
|
257
|
+
type Vector3TypeId = typeof Vector3TypeId;
|
|
258
|
+
declare namespace vector3_d_exports {
|
|
259
|
+
export { Vector3, add, components, cross, dot, equals, fromSpherical, getPhi, getR, getTheta, getX, getY, getZ, hadamard, isVector3, length, magnitude, make, normalize, scale, setPhi, setR, setTheta, setX, setY, setZ, softmax, subtract, transpose, unit, unitX, unitY, unitZ, zero };
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* A 3D vector.
|
|
263
|
+
*
|
|
264
|
+
* All fields are readonly and immutable, and all operations create new instances.
|
|
265
|
+
*
|
|
266
|
+
* @since 1.0.0
|
|
267
|
+
*/
|
|
268
|
+
interface Vector3 extends Pipeable, ThreeDimensional<number> {
|
|
269
|
+
readonly [Vector3TypeId]: Vector3TypeId;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Checks if a value is a `Vector3`.
|
|
273
|
+
*
|
|
274
|
+
* @param v - The value to check.
|
|
275
|
+
* @returns `true` if the value is a `Vector3`, `false` otherwise.
|
|
276
|
+
* @since 1.0.0
|
|
277
|
+
*/
|
|
278
|
+
declare const isVector3: (v: unknown) => v is Vector3;
|
|
279
|
+
declare const equals: {
|
|
280
|
+
/**
|
|
281
|
+
* Checks if two `Vector3` instances are approximately equal within the
|
|
282
|
+
* default absolute tolerance ({@link EPSILON}).
|
|
283
|
+
*
|
|
284
|
+
* @param a - The first vector.
|
|
285
|
+
* @param b - The second vector.
|
|
286
|
+
* @returns `true` when each pair of components is within tolerance.
|
|
287
|
+
* @since 1.1.0
|
|
288
|
+
*/
|
|
289
|
+
(a: Vector3, b: Vector3): boolean;
|
|
290
|
+
/**
|
|
291
|
+
* Checks if two `Vector3` instances are approximately equal within the
|
|
292
|
+
* default absolute tolerance ({@link EPSILON}).
|
|
293
|
+
*
|
|
294
|
+
* @param b - The second vector.
|
|
295
|
+
* @returns A function that takes the first vector and returns the comparison result.
|
|
296
|
+
* @since 1.1.0
|
|
297
|
+
*/
|
|
298
|
+
(b: Vector3): (a: Vector3) => boolean;
|
|
299
|
+
};
|
|
300
|
+
declare const make: {
|
|
301
|
+
/**
|
|
302
|
+
* Creates a new `Vector3` instance.
|
|
303
|
+
*
|
|
304
|
+
* @param xyz - The x, y, and z components of the vector.
|
|
305
|
+
* @returns A new `Vector3` instance.
|
|
306
|
+
* @since 1.0.0
|
|
307
|
+
*/
|
|
308
|
+
(xyz: number): Vector3;
|
|
309
|
+
/**
|
|
310
|
+
* Creates a new `Vector3` instance.
|
|
311
|
+
*
|
|
312
|
+
* @param x - The x component of the vector.
|
|
313
|
+
* @param yz - The y and z components of the vector.
|
|
314
|
+
* @returns A new `Vector3` instance.
|
|
315
|
+
* @since 1.0.0
|
|
316
|
+
*/
|
|
317
|
+
(x: number, yz: number): Vector3;
|
|
318
|
+
/**
|
|
319
|
+
* Creates a new `Vector3` instance.
|
|
320
|
+
*
|
|
321
|
+
* @param x - The x component of the vector.
|
|
322
|
+
* @param y - The y component of the vector.
|
|
323
|
+
* @param z - The z component of the vector.
|
|
324
|
+
* @returns A new `Vector3` instance.
|
|
325
|
+
* @since 1.0.0
|
|
326
|
+
*/
|
|
327
|
+
(x: number, y: number, z: number): Vector3;
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* Transposes a 3-tuple of items into one or more `Vector3`s, one per channel
|
|
331
|
+
* extracted by the projection function. See {@link Vector4.transpose} for the
|
|
332
|
+
* full operation description; this is the 3-component analog.
|
|
333
|
+
*
|
|
334
|
+
* @param inputs - Exactly three items of any type.
|
|
335
|
+
* @param project - A function returning a fixed-arity tuple of numbers — one per output channel.
|
|
336
|
+
* @returns A tuple of `Vector3`s with the same arity as the projection's return tuple.
|
|
337
|
+
* @since 2.1.0
|
|
338
|
+
*/
|
|
339
|
+
declare const transpose: <T, const Channels extends ReadonlyArray<number>>(inputs: readonly [T, T, T], project: (item: T) => Channels) => { readonly [K in keyof Channels]: Vector3 };
|
|
340
|
+
/**
|
|
341
|
+
* Creates a new `Vector3` instance from spherical coordinates.
|
|
342
|
+
*
|
|
343
|
+
* @param r - The radius.
|
|
344
|
+
* @param theta - The polar angle, in radians. Ranges from 0 to π
|
|
345
|
+
* @param phi - The azimuthal angle, in radians. Ranges from 0 to 2π
|
|
346
|
+
* @returns A new `Vector3` instance.
|
|
347
|
+
* @since 1.0.0
|
|
348
|
+
*/
|
|
349
|
+
declare const fromSpherical: (r: number, theta: number, phi: number) => Vector3;
|
|
350
|
+
/**
|
|
351
|
+
* Calculates the magnitude of a `Vector3`.
|
|
352
|
+
*
|
|
353
|
+
* @param vector - The vector to calculate the magnitude of.
|
|
354
|
+
* @returns The magnitude of the vector.
|
|
355
|
+
* @since 1.0.0
|
|
356
|
+
*/
|
|
357
|
+
declare const magnitude: (vector: Vector3) => number;
|
|
358
|
+
/**
|
|
359
|
+
* Calculates the length of a `Vector3`.
|
|
360
|
+
*
|
|
361
|
+
* @param vector - The vector to calculate the length of.
|
|
362
|
+
* @returns The length of the vector.
|
|
363
|
+
* @see {@link magnitude}
|
|
364
|
+
* @since 1.0.0
|
|
365
|
+
*/
|
|
366
|
+
declare const length: (vector: Vector3) => number;
|
|
367
|
+
/**
|
|
368
|
+
* Normalizes a `Vector3`.
|
|
369
|
+
*
|
|
370
|
+
* @param vector - The vector to normalize.
|
|
371
|
+
* @returns A new `Vector3` instance with the same direction as the input vector, but with a magnitude of 1.
|
|
372
|
+
* @since 1.0.0
|
|
373
|
+
*/
|
|
374
|
+
declare const normalize: (vector: Vector3) => Vector3;
|
|
375
|
+
declare const dot: {
|
|
376
|
+
/**
|
|
377
|
+
* Calculates the dot product of two `Vector3` instances.
|
|
378
|
+
*
|
|
379
|
+
* @param a - The first vector.
|
|
380
|
+
* @param b - The second vector.
|
|
381
|
+
* @returns The dot product of the two vectors.
|
|
382
|
+
* @since 1.0.0
|
|
383
|
+
*/
|
|
384
|
+
(a: Vector3, b: Vector3): number;
|
|
385
|
+
/**
|
|
386
|
+
* Calculates the dot product of two `Vector3` instances.
|
|
387
|
+
*
|
|
388
|
+
* @param b - The second vector.
|
|
389
|
+
* @returns A function that takes the first vector and returns the dot product.
|
|
390
|
+
* @since 1.0.0
|
|
391
|
+
*/
|
|
392
|
+
(b: Vector3): (a: Vector3) => number;
|
|
393
|
+
};
|
|
394
|
+
declare const cross: {
|
|
395
|
+
/**
|
|
396
|
+
* Calculates the cross product of two `Vector3` instances.
|
|
397
|
+
*
|
|
398
|
+
* @param a - The first vector.
|
|
399
|
+
* @param b - The second vector.
|
|
400
|
+
* @returns A new `Vector3` instance representing the cross product of the two vectors.
|
|
401
|
+
* @since 1.0.0
|
|
402
|
+
*/
|
|
403
|
+
(a: Vector3, b: Vector3): Vector3;
|
|
404
|
+
/**
|
|
405
|
+
* Calculates the cross product of two `Vector3` instances.
|
|
406
|
+
*
|
|
407
|
+
* @param b - The second vector.
|
|
408
|
+
* @returns A function that takes the first vector and returns the cross product.
|
|
409
|
+
* @since 1.0.0
|
|
410
|
+
*/
|
|
411
|
+
(b: Vector3): (a: Vector3) => Vector3;
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* Returns the components of a `Vector3` as an array.
|
|
415
|
+
*
|
|
416
|
+
* @param v - The vector to get the components of.
|
|
417
|
+
* @returns An array containing the x, y, and z components of the vector.
|
|
418
|
+
* @since 1.0.0
|
|
419
|
+
*/
|
|
420
|
+
declare const components: (v: Vector3) => [number, number, number];
|
|
421
|
+
/**
|
|
422
|
+
* Calculates the softmax of a `Vector3`.
|
|
423
|
+
*
|
|
424
|
+
* @param v - The vector to calculate the softmax of.
|
|
425
|
+
* @returns A new `Vector3` instance representing the softmax of the input vector.
|
|
426
|
+
* @since 1.0.0
|
|
427
|
+
*/
|
|
428
|
+
declare const softmax: (v: Vector3) => Vector3;
|
|
429
|
+
/**
|
|
430
|
+
* Creates a zero vector.
|
|
431
|
+
*
|
|
432
|
+
* @since 1.0.0
|
|
433
|
+
*/
|
|
434
|
+
declare const zero: Vector3;
|
|
435
|
+
/**
|
|
436
|
+
* Creates a unit vector.
|
|
437
|
+
*
|
|
438
|
+
* @since 1.0.0
|
|
439
|
+
*/
|
|
440
|
+
declare const unit: Vector3;
|
|
441
|
+
/**
|
|
442
|
+
* Creates a unit vector in the x direction.
|
|
443
|
+
*
|
|
444
|
+
* @since 1.0.0
|
|
445
|
+
*/
|
|
446
|
+
declare const unitX: Vector3;
|
|
447
|
+
/**
|
|
448
|
+
* Creates a unit vector in the y direction.
|
|
449
|
+
*
|
|
450
|
+
* @since 1.0.0
|
|
451
|
+
*/
|
|
452
|
+
declare const unitY: Vector3;
|
|
453
|
+
/**
|
|
454
|
+
* Creates a unit vector in the z direction.
|
|
455
|
+
*
|
|
456
|
+
* @since 1.0.0
|
|
457
|
+
*/
|
|
458
|
+
declare const unitZ: Vector3;
|
|
459
|
+
declare const add: {
|
|
460
|
+
/**
|
|
461
|
+
* Adds two `Vector3` instances.
|
|
462
|
+
*
|
|
463
|
+
* @param a - The first vector.
|
|
464
|
+
* @param b - The second vector.
|
|
465
|
+
* @returns A new `Vector3` instance representing the sum of the two vectors.
|
|
466
|
+
* @since 1.0.0
|
|
467
|
+
*/
|
|
468
|
+
(a: Vector3, b: Vector3): Vector3;
|
|
469
|
+
/**
|
|
470
|
+
* Adds two `Vector3` instances.
|
|
471
|
+
*
|
|
472
|
+
* @param b - The second vector.
|
|
473
|
+
* @returns A function that takes the first vector and returns the sum.
|
|
474
|
+
* @since 1.0.0
|
|
475
|
+
*/
|
|
476
|
+
(b: Vector3): (a: Vector3) => Vector3;
|
|
477
|
+
};
|
|
478
|
+
declare const subtract: {
|
|
479
|
+
/**
|
|
480
|
+
* Subtracts one `Vector3` instance from another.
|
|
481
|
+
*
|
|
482
|
+
* @param a - The vector to subtract from.
|
|
483
|
+
* @param b - The vector to subtract.
|
|
484
|
+
* @returns A new `Vector3` instance representing the difference of the two vectors.
|
|
485
|
+
* @since 1.0.0
|
|
486
|
+
*/
|
|
487
|
+
(a: Vector3, b: Vector3): Vector3;
|
|
488
|
+
/**
|
|
489
|
+
* Subtracts one `Vector3` instance from another.
|
|
490
|
+
*
|
|
491
|
+
* @param b - The vector to subtract.
|
|
492
|
+
* @returns A function that takes the first vector and returns the difference.
|
|
493
|
+
* @since 1.0.0
|
|
494
|
+
*/
|
|
495
|
+
(b: Vector3): (a: Vector3) => Vector3;
|
|
496
|
+
};
|
|
497
|
+
declare const hadamard: {
|
|
498
|
+
/**
|
|
499
|
+
* Calculates the Hadamard product of two `Vector3` instances.
|
|
500
|
+
*
|
|
501
|
+
* The Hadamard product is an element-wise multiplication of two vectors.
|
|
502
|
+
*
|
|
503
|
+
* @param a - The first vector.
|
|
504
|
+
* @param b - The second vector.
|
|
505
|
+
* @returns A new `Vector3` instance representing the Hadamard product of the two vectors.
|
|
506
|
+
* @since 1.0.0
|
|
507
|
+
*/
|
|
508
|
+
(a: Vector3, b: Vector3): Vector3;
|
|
509
|
+
/**
|
|
510
|
+
* Calculates the Hadamard product of two `Vector3` instances.
|
|
511
|
+
*
|
|
512
|
+
* The Hadamard product is an element-wise multiplication of two vectors.
|
|
513
|
+
*
|
|
514
|
+
* @param b - The second vector.
|
|
515
|
+
* @returns A function that takes the first vector and returns the Hadamard product.
|
|
516
|
+
* @since 1.0.0
|
|
517
|
+
*/
|
|
518
|
+
(b: Vector3): (a: Vector3) => Vector3;
|
|
519
|
+
};
|
|
520
|
+
declare const scale: {
|
|
521
|
+
/**
|
|
522
|
+
* Scales a `Vector3` instance by a scalar value.
|
|
523
|
+
*
|
|
524
|
+
* @param s - The scalar value to scale by.
|
|
525
|
+
* @return A function that takes a vector and returns the scaled vector.
|
|
526
|
+
* @since 1.0.0
|
|
527
|
+
*/
|
|
528
|
+
(s: number): (v: Vector3) => Vector3;
|
|
529
|
+
/**
|
|
530
|
+
* Scales a `Vector3` instance by a scalar value.
|
|
531
|
+
*
|
|
532
|
+
* @param s - The scalar value to scale by.
|
|
533
|
+
* @param v - The vector to scale.
|
|
534
|
+
* @returns A new `Vector3` instance representing the scaled vector.
|
|
535
|
+
* @since 1.0.0
|
|
536
|
+
*/
|
|
537
|
+
(v: Vector3, s: number): Vector3;
|
|
538
|
+
};
|
|
539
|
+
/**
|
|
540
|
+
* Gets the x component of a `Vector3`.
|
|
541
|
+
*
|
|
542
|
+
* @param v - The vector to get the x component of.
|
|
543
|
+
* @returns The x component of the vector.
|
|
544
|
+
* @since 1.0.0
|
|
545
|
+
*/
|
|
546
|
+
declare const getX: (v: Vector3) => number;
|
|
547
|
+
declare const setX: {
|
|
548
|
+
/**
|
|
549
|
+
* Sets the x component of a `Vector3`.
|
|
550
|
+
*
|
|
551
|
+
* @param v - The vector to set the x component of.
|
|
552
|
+
* @param x - The new x component.
|
|
553
|
+
* @returns A new `Vector3` instance with the updated x component.
|
|
554
|
+
* @since 1.0.0
|
|
555
|
+
*/
|
|
556
|
+
(v: Vector3, x: number): Vector3;
|
|
557
|
+
/**
|
|
558
|
+
* Sets the x component of a `Vector3`.
|
|
559
|
+
*
|
|
560
|
+
* @param x - The new x component.
|
|
561
|
+
* @returns A function that takes the vector and returns a new `Vector3` instance with the updated x component.
|
|
562
|
+
* @since 1.0.0
|
|
563
|
+
*/
|
|
564
|
+
(x: number): (v: Vector3) => Vector3;
|
|
565
|
+
};
|
|
566
|
+
/**
|
|
567
|
+
* Gets the y component of a `Vector3`.
|
|
568
|
+
*
|
|
569
|
+
* @param v - The vector of which to get the y component.
|
|
570
|
+
* @returns The y component of the vector.
|
|
571
|
+
* @since 1.0.0
|
|
572
|
+
*/
|
|
573
|
+
declare const getY: (v: Vector3) => number;
|
|
574
|
+
declare const setY: {
|
|
575
|
+
/**
|
|
576
|
+
* Sets the y component of a `Vector3`.
|
|
577
|
+
*
|
|
578
|
+
* @param v - The vector of which to set the y component.
|
|
579
|
+
* @param y - The new y component.
|
|
580
|
+
* @returns A new `Vector3` instance with the updated y component.
|
|
581
|
+
* @since 1.0.0
|
|
582
|
+
*/
|
|
583
|
+
(v: Vector3, y: number): Vector3;
|
|
584
|
+
/**
|
|
585
|
+
* Sets the y component of a `Vector3`.
|
|
586
|
+
*
|
|
587
|
+
* @param y - The new y component.
|
|
588
|
+
* @returns A function that takes the vector and returns a new `Vector3` instance with the updated y component.
|
|
589
|
+
* @since 1.0.0
|
|
590
|
+
*/
|
|
591
|
+
(y: number): (v: Vector3) => Vector3;
|
|
592
|
+
};
|
|
593
|
+
/**
|
|
594
|
+
* Gets the z component of a `Vector3`.
|
|
595
|
+
*
|
|
596
|
+
* @param v - The vector of which to get the z component.
|
|
597
|
+
* @returns The z component of the vector.
|
|
598
|
+
* @since 1.0.0
|
|
599
|
+
*/
|
|
600
|
+
declare const getZ: (v: Vector3) => number;
|
|
601
|
+
declare const setZ: {
|
|
602
|
+
/**
|
|
603
|
+
* Sets the z component of a `Vector3`.
|
|
604
|
+
*
|
|
605
|
+
* @param v - The vector of which to set the z component.
|
|
606
|
+
* @param z - The new z component.
|
|
607
|
+
* @returns A new `Vector3` instance with the updated z component.
|
|
608
|
+
* @since 1.0.0
|
|
609
|
+
*/
|
|
610
|
+
(v: Vector3, z: number): Vector3;
|
|
611
|
+
/**
|
|
612
|
+
* Sets the z component of a `Vector3`.
|
|
613
|
+
*
|
|
614
|
+
* @param z - The new z component.
|
|
615
|
+
* @returns A function that takes the vector and returns a new `Vector3` instance with the updated z component.
|
|
616
|
+
* @since 1.0.0
|
|
617
|
+
*/
|
|
618
|
+
(z: number): (v: Vector3) => Vector3;
|
|
619
|
+
};
|
|
620
|
+
/**
|
|
621
|
+
* Gets the radius of a `Vector3`.
|
|
622
|
+
*
|
|
623
|
+
* @param v - The vector of which to get the radius.
|
|
624
|
+
* @returns The radius of the vector.
|
|
625
|
+
* @since 1.0.0
|
|
626
|
+
*/
|
|
627
|
+
declare const getR: (v: Vector3) => number;
|
|
628
|
+
declare const setR: {
|
|
629
|
+
/**
|
|
630
|
+
* Sets the radius of a `Vector3`.
|
|
631
|
+
*
|
|
632
|
+
* @param v - The vector of which to set the radius.
|
|
633
|
+
* @param r - The new radius.
|
|
634
|
+
* @returns A new `Vector3` instance with the updated radius.
|
|
635
|
+
* @since 1.0.0
|
|
636
|
+
*/
|
|
637
|
+
(v: Vector3, r: number): Vector3;
|
|
638
|
+
/**
|
|
639
|
+
* Sets the radius of a `Vector3`.
|
|
640
|
+
*
|
|
641
|
+
* @param r - The new radius.
|
|
642
|
+
* @returns A function that takes the vector and returns the updated vector.
|
|
643
|
+
* @since 1.0.0
|
|
644
|
+
*/
|
|
645
|
+
(r: number): (v: Vector3) => Vector3;
|
|
646
|
+
};
|
|
647
|
+
/**
|
|
648
|
+
* Gets the polar angle (theta) of a `Vector3`.
|
|
649
|
+
*
|
|
650
|
+
* @param v - The vector of which to get the polar angle.
|
|
651
|
+
* @returns The polar angle of the vector.
|
|
652
|
+
* @since 1.0.0
|
|
653
|
+
*/
|
|
654
|
+
declare const getTheta: (v: Vector3) => number;
|
|
655
|
+
declare const setTheta: {
|
|
656
|
+
/**
|
|
657
|
+
* Sets the polar angle (theta) of a `Vector3`.
|
|
658
|
+
*
|
|
659
|
+
* @param v - The vector of which to set the polar angle.
|
|
660
|
+
* @param theta - The new polar angle.
|
|
661
|
+
* @returns A new `Vector3` instance with the updated polar angle.
|
|
662
|
+
* @since 1.0.0
|
|
663
|
+
*/
|
|
664
|
+
(v: Vector3, theta: number): Vector3;
|
|
665
|
+
/**
|
|
666
|
+
* Sets the polar angle (theta) of a `Vector3`.
|
|
667
|
+
*
|
|
668
|
+
* @param theta - The new polar angle.
|
|
669
|
+
* @returns A function that takes the vector and returns the updated vector.
|
|
670
|
+
* @since 1.0.0
|
|
671
|
+
*/
|
|
672
|
+
(theta: number): (v: Vector3) => Vector3;
|
|
673
|
+
};
|
|
674
|
+
/**
|
|
675
|
+
* Gets the azimuthal angle (phi) of a `Vector3`.
|
|
676
|
+
*
|
|
677
|
+
* @param v - The vector of which to get the azimuthal angle.
|
|
678
|
+
* @returns The azimuthal angle of the vector.
|
|
679
|
+
* @since 1.0.0
|
|
680
|
+
*/
|
|
681
|
+
declare const getPhi: (v: Vector3) => number;
|
|
682
|
+
declare const setPhi: {
|
|
683
|
+
/**
|
|
684
|
+
* Sets the azimuthal angle (phi) of a `Vector3`.
|
|
685
|
+
*
|
|
686
|
+
* @param v - The vector of which to set the azimuthal angle.
|
|
687
|
+
* @param phi - The new azimuthal angle.
|
|
688
|
+
* @returns A new `Vector3` instance with the updated azimuthal angle.
|
|
689
|
+
* @since 1.0.0
|
|
690
|
+
*/
|
|
691
|
+
(v: Vector3, phi: number): Vector3;
|
|
692
|
+
/**
|
|
693
|
+
* Sets the azimuthal angle (phi) of a `Vector3`.
|
|
694
|
+
*
|
|
695
|
+
* @param phi - The new azimuthal angle.
|
|
696
|
+
* @returns A function that takes the vector and returns the updated vector.
|
|
697
|
+
* @since 1.0.0
|
|
698
|
+
*/
|
|
699
|
+
(phi: number): (v: Vector3) => Vector3;
|
|
700
|
+
};
|
|
701
|
+
//#endregion
|
|
702
|
+
export { vector4_d_exports as i, vector3_d_exports as n, Vector4 as r, Vector3 as t };
|
|
703
|
+
//# sourceMappingURL=vector3-DqeOZtOB.d.mts.map
|