curvy 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/curve/cubic2d.d.mts +80 -2
  2. package/dist/curve/cubic2d.d.ts +80 -2
  3. package/dist/curve/cubic2d.mjs +9 -26
  4. package/dist/curve/cubic2d.mjs.map +1 -0
  5. package/dist/curve/linear2d.d.mts +68 -2
  6. package/dist/curve/linear2d.d.ts +68 -2
  7. package/dist/curve/linear2d.mjs +11 -14
  8. package/dist/curve/linear2d.mjs.map +1 -0
  9. package/dist/curve/quadratic2d.d.mts +86 -2
  10. package/dist/curve/quadratic2d.d.ts +86 -2
  11. package/dist/curve/quadratic2d.mjs +10 -15
  12. package/dist/curve/quadratic2d.mjs.map +1 -0
  13. package/dist/interval.d.mts +195 -2
  14. package/dist/interval.d.ts +195 -2
  15. package/dist/interval.mjs +9 -12
  16. package/dist/interval.mjs.map +1 -0
  17. package/dist/matrix/matrix2x2.d.mts +273 -2
  18. package/dist/matrix/matrix2x2.d.ts +273 -2
  19. package/dist/matrix/matrix2x2.mjs +5 -4
  20. package/dist/matrix/matrix2x2.mjs.map +1 -0
  21. package/dist/matrix/matrix3x3.d.mts +308 -1
  22. package/dist/matrix/matrix3x3.d.ts +308 -1
  23. package/dist/matrix/matrix3x3.mjs +5 -4
  24. package/dist/matrix/matrix3x3.mjs.map +1 -0
  25. package/dist/matrix/matrix4x4.d.mts +310 -1
  26. package/dist/matrix/matrix4x4.d.ts +310 -1
  27. package/dist/matrix/matrix4x4.mjs +24 -61
  28. package/dist/matrix/matrix4x4.mjs.map +1 -0
  29. package/dist/path/cubic2d.d.mts +68 -2
  30. package/dist/path/cubic2d.d.ts +68 -2
  31. package/dist/path/cubic2d.mjs +10 -12
  32. package/dist/path/cubic2d.mjs.map +1 -0
  33. package/dist/path/linear2d.d.mts +68 -2
  34. package/dist/path/linear2d.d.ts +68 -2
  35. package/dist/path/linear2d.mjs +7 -9
  36. package/dist/path/linear2d.mjs.map +1 -0
  37. package/dist/path/quadratic2d.d.mts +67 -2
  38. package/dist/path/quadratic2d.d.ts +67 -2
  39. package/dist/path/quadratic2d.mjs +9 -13
  40. package/dist/path/quadratic2d.mjs.map +1 -0
  41. package/dist/pipe.mjs +1 -0
  42. package/dist/pipe.mjs.map +1 -0
  43. package/dist/polynomial/cubic.d.mts +1 -1
  44. package/dist/polynomial/cubic.d.ts +1 -1
  45. package/dist/polynomial/cubic.mjs +13 -28
  46. package/dist/polynomial/cubic.mjs.map +1 -0
  47. package/dist/polynomial/linear.d.mts +1 -1
  48. package/dist/polynomial/linear.d.ts +1 -1
  49. package/dist/polynomial/linear.mjs +2 -1
  50. package/dist/polynomial/linear.mjs.map +1 -0
  51. package/dist/polynomial/quadratic.d.mts +2 -2
  52. package/dist/polynomial/quadratic.d.ts +2 -2
  53. package/dist/polynomial/quadratic.mjs +5 -2
  54. package/dist/polynomial/quadratic.mjs.map +1 -0
  55. package/dist/shared/{curvy.Cps2R_RU.mjs → curvy.BkkW8Tx9.mjs} +11 -29
  56. package/dist/shared/curvy.BkkW8Tx9.mjs.map +1 -0
  57. package/dist/shared/{curvy.BzVmUIKm.mjs → curvy.BxdGW9he.mjs} +17 -32
  58. package/dist/shared/curvy.BxdGW9he.mjs.map +1 -0
  59. package/dist/shared/{curvy.C2XGH0R0.mjs → curvy.C_sCeg9J.mjs} +15 -24
  60. package/dist/shared/curvy.C_sCeg9J.mjs.map +1 -0
  61. package/dist/shared/curvy.Cg8lZVUz.d.ts +688 -0
  62. package/dist/shared/{curvy.CE4X6_Is.mjs → curvy.DCt1gGII.mjs} +11 -45
  63. package/dist/shared/curvy.DCt1gGII.mjs.map +1 -0
  64. package/dist/shared/{curvy.BZ_mTkJe.mjs → curvy.DJ4xO0al.mjs} +9 -6
  65. package/dist/shared/curvy.DJ4xO0al.mjs.map +1 -0
  66. package/dist/shared/curvy.DmVFTi0N.mjs +1 -0
  67. package/dist/shared/curvy.DmVFTi0N.mjs.map +1 -0
  68. package/dist/shared/curvy.FDaj5rlj.d.mts +688 -0
  69. package/dist/shared/{curvy.NLeFCr-9.mjs → curvy.lktriTpx.mjs} +19 -42
  70. package/dist/shared/curvy.lktriTpx.mjs.map +1 -0
  71. package/dist/shared/{curvy.Ck0of1PI.mjs → curvy.mLFprrGm.mjs} +26 -22
  72. package/dist/shared/curvy.mLFprrGm.mjs.map +1 -0
  73. package/dist/shared/{curvy.BDhiZ7He.mjs → curvy.r6f1j287.mjs} +8 -12
  74. package/dist/shared/curvy.r6f1j287.mjs.map +1 -0
  75. package/dist/splines/basis2d.d.mts +94 -2
  76. package/dist/splines/basis2d.d.ts +94 -2
  77. package/dist/splines/basis2d.mjs +13 -12
  78. package/dist/splines/basis2d.mjs.map +1 -0
  79. package/dist/splines/bezier2d.d.mts +136 -2
  80. package/dist/splines/bezier2d.d.ts +136 -2
  81. package/dist/splines/bezier2d.mjs +10 -9
  82. package/dist/splines/bezier2d.mjs.map +1 -0
  83. package/dist/splines/cardinal2d.d.mts +131 -2
  84. package/dist/splines/cardinal2d.d.ts +131 -2
  85. package/dist/splines/cardinal2d.mjs +15 -24
  86. package/dist/splines/cardinal2d.mjs.map +1 -0
  87. package/dist/splines/hermite2d.d.mts +94 -3
  88. package/dist/splines/hermite2d.d.ts +94 -3
  89. package/dist/splines/hermite2d.mjs +22 -36
  90. package/dist/splines/hermite2d.mjs.map +1 -0
  91. package/dist/utils.d.mts +179 -1
  92. package/dist/utils.d.ts +179 -1
  93. package/dist/utils.mjs +16 -7
  94. package/dist/utils.mjs.map +1 -0
  95. package/dist/vector/vector2.d.mts +259 -1
  96. package/dist/vector/vector2.d.ts +259 -1
  97. package/dist/vector/vector2.mjs +4 -2
  98. package/dist/vector/vector2.mjs.map +1 -0
  99. package/dist/vector/vector3.d.mts +345 -1
  100. package/dist/vector/vector3.d.ts +345 -1
  101. package/dist/vector/vector3.mjs +9 -2
  102. package/dist/vector/vector3.mjs.map +1 -0
  103. package/dist/vector/vector4.d.mts +163 -1
  104. package/dist/vector/vector4.d.ts +163 -1
  105. package/dist/vector/vector4.mjs +4 -2
  106. package/dist/vector/vector4.mjs.map +1 -0
  107. package/package.json +4 -4
  108. package/dist/shared/curvy.BsHoYJNv.d.ts +0 -155
  109. package/dist/shared/curvy.NsmY7zcr.d.mts +0 -155
@@ -4,70 +4,414 @@ import { Pipeable } from '../pipe.mjs';
4
4
  declare const Vector3TypeId: unique symbol;
5
5
  type Vector3TypeId = typeof Vector3TypeId;
6
6
 
7
+ /**
8
+ * A 3D vector.
9
+ *
10
+ * All fields are readonly and immutable, and all operations create new instances.
11
+ *
12
+ * @since 1.0.0
13
+ */
7
14
  interface Vector3 extends Pipeable, ThreeDimensional<number> {
8
15
  readonly [Vector3TypeId]: Vector3TypeId;
9
16
  }
17
+ /**
18
+ * Checks if a value is a `Vector3`.
19
+ *
20
+ * @param v - The value to check.
21
+ * @returns `true` if the value is a `Vector3`, `false` otherwise.
22
+ * @since 1.0.0
23
+ */
10
24
  declare const isVector3: (v: unknown) => v is Vector3;
11
25
  declare const make: {
26
+ /**
27
+ * Creates a new `Vector3` instance.
28
+ *
29
+ * @param xyz - The x, y, and z components of the vector.
30
+ * @returns A new `Vector3` instance.
31
+ * @since 1.0.0
32
+ */
12
33
  (xyz: number): Vector3;
34
+ /**
35
+ * Creates a new `Vector3` instance.
36
+ *
37
+ * @param x - The x component of the vector.
38
+ * @param yz - The y and z components of the vector.
39
+ * @returns A new `Vector3` instance.
40
+ * @since 1.0.0
41
+ */
13
42
  (x: number, yz: number): Vector3;
43
+ /**
44
+ * Creates a new `Vector3` instance.
45
+ *
46
+ * @param x - The x component of the vector.
47
+ * @param y - The y component of the vector.
48
+ * @param z - The z component of the vector.
49
+ * @returns A new `Vector3` instance.
50
+ * @since 1.0.0
51
+ */
14
52
  (x: number, y: number, z: number): Vector3;
15
53
  };
54
+ /**
55
+ * Creates a new `Vector3` instance from spherical coordinates.
56
+ *
57
+ * @param r - The radius.
58
+ * @param theta - The polar angle, in radians. Ranges from 0 to π
59
+ * @param phi - The azimuthal angle, in radians. Ranges from 0 to 2π
60
+ * @returns A new `Vector3` instance.
61
+ * @since 1.0.0
62
+ */
16
63
  declare const fromSpherical: (r: number, theta: number, phi: number) => Vector3;
64
+ /**
65
+ * Calculates the magnitude of a `Vector3`.
66
+ *
67
+ * @param vector - The vector to calculate the magnitude of.
68
+ * @returns The magnitude of the vector.
69
+ * @since 1.0.0
70
+ */
17
71
  declare const magnitude: (vector: Vector3) => number;
72
+ /**
73
+ * Calculates the length of a `Vector3`.
74
+ *
75
+ * @param vector - The vector to calculate the length of.
76
+ * @returns The length of the vector.
77
+ * @see {@link magnitude}
78
+ * @since 1.0.0
79
+ */
80
+ declare const length: (vector: Vector3) => number;
81
+ /**
82
+ * Normalizes a `Vector3`.
83
+ *
84
+ * @param vector - The vector to normalize.
85
+ * @returns A new `Vector3` instance with the same direction as the input vector, but with a magnitude of 1.
86
+ * @since 1.0.0
87
+ */
18
88
  declare const normalize: (vector: Vector3) => Vector3;
19
89
  declare const dot: {
90
+ /**
91
+ * Calculates the dot product of two `Vector3` instances.
92
+ *
93
+ * @param a - The first vector.
94
+ * @param b - The second vector.
95
+ * @returns The dot product of the two vectors.
96
+ * @since 1.0.0
97
+ */
20
98
  (a: Vector3, b: Vector3): number;
99
+ /**
100
+ * Calculates the dot product of two `Vector3` instances.
101
+ *
102
+ * @param b - The second vector.
103
+ * @returns A function that takes the first vector and returns the dot product.
104
+ * @since 1.0.0
105
+ */
21
106
  (b: Vector3): (a: Vector3) => number;
22
107
  };
108
+ declare const cross: {
109
+ /**
110
+ * Calculates the cross product of two `Vector3` instances.
111
+ *
112
+ * @param a - The first vector.
113
+ * @param b - The second vector.
114
+ * @returns A new `Vector3` instance representing the cross product of the two vectors.
115
+ * @since 1.0.0
116
+ */
117
+ (a: Vector3, b: Vector3): Vector3;
118
+ /**
119
+ * Calculates the cross product of two `Vector3` instances.
120
+ *
121
+ * @param b - The second vector.
122
+ * @returns A function that takes the first vector and returns the cross product.
123
+ * @since 1.0.0
124
+ */
125
+ (b: Vector3): (a: Vector3) => Vector3;
126
+ };
127
+ /**
128
+ * Returns the components of a `Vector3` as an array.
129
+ *
130
+ * @param v - The vector to get the components of.
131
+ * @returns An array containing the x, y, and z components of the vector.
132
+ * @since 1.0.0
133
+ */
23
134
  declare const components: (v: Vector3) => [number, number, number];
135
+ /**
136
+ * Calculates the softmax of a `Vector3`.
137
+ *
138
+ * @param v - The vector to calculate the softmax of.
139
+ * @returns A new `Vector3` instance representing the softmax of the input vector.
140
+ * @since 1.0.0
141
+ */
24
142
  declare const softmax: (v: Vector3) => Vector3;
143
+ /**
144
+ * Creates a zero vector.
145
+ *
146
+ * @since 1.0.0
147
+ */
25
148
  declare const zero: Vector3;
149
+ /**
150
+ * Creates a unit vector.
151
+ *
152
+ * @since 1.0.0
153
+ */
154
+ declare const unit: Vector3;
155
+ /**
156
+ * Creates a unit vector in the x direction.
157
+ *
158
+ * @since 1.0.0
159
+ */
160
+ declare const unitX: Vector3;
161
+ /**
162
+ * Creates a unit vector in the y direction.
163
+ *
164
+ * @since 1.0.0
165
+ */
166
+ declare const unitY: Vector3;
167
+ /**
168
+ * Creates a unit vector in the z direction.
169
+ *
170
+ * @since 1.0.0
171
+ */
172
+ declare const unitZ: Vector3;
26
173
  declare const add: {
174
+ /**
175
+ * Adds two `Vector3` instances.
176
+ *
177
+ * @param a - The first vector.
178
+ * @param b - The second vector.
179
+ * @returns A new `Vector3` instance representing the sum of the two vectors.
180
+ * @since 1.0.0
181
+ */
27
182
  (a: Vector3, b: Vector3): Vector3;
183
+ /**
184
+ * Adds two `Vector3` instances.
185
+ *
186
+ * @param b - The second vector.
187
+ * @returns A function that takes the first vector and returns the sum.
188
+ * @since 1.0.0
189
+ */
28
190
  (b: Vector3): (a: Vector3) => Vector3;
29
191
  };
30
192
  declare const subtract: {
193
+ /**
194
+ * Subtracts one `Vector3` instance from another.
195
+ *
196
+ * @param a - The vector to subtract from.
197
+ * @param b - The vector to subtract.
198
+ * @returns A new `Vector3` instance representing the difference of the two vectors.
199
+ * @since 1.0.0
200
+ */
31
201
  (a: Vector3, b: Vector3): Vector3;
202
+ /**
203
+ * Subtracts one `Vector3` instance from another.
204
+ *
205
+ * @param b - The vector to subtract.
206
+ * @returns A function that takes the first vector and returns the difference.
207
+ * @since 1.0.0
208
+ */
32
209
  (b: Vector3): (a: Vector3) => Vector3;
33
210
  };
34
211
  declare const hadamard: {
212
+ /**
213
+ * Calculates the Hadamard product of two `Vector3` instances.
214
+ *
215
+ * The Hadamard product is an element-wise multiplication of two vectors.
216
+ *
217
+ * @param a - The first vector.
218
+ * @param b - The second vector.
219
+ * @returns A new `Vector3` instance representing the Hadamard product of the two vectors.
220
+ * @since 1.0.0
221
+ */
35
222
  (a: Vector3, b: Vector3): Vector3;
223
+ /**
224
+ * Calculates the Hadamard product of two `Vector3` instances.
225
+ *
226
+ * The Hadamard product is an element-wise multiplication of two vectors.
227
+ *
228
+ * @param b - The second vector.
229
+ * @returns A function that takes the first vector and returns the Hadamard product.
230
+ * @since 1.0.0
231
+ */
36
232
  (b: Vector3): (a: Vector3) => Vector3;
37
233
  };
38
234
  declare const scale: {
235
+ /**
236
+ * Scales a `Vector3` instance by a scalar value.
237
+ *
238
+ * @param s - The scalar value to scale by.
239
+ * @return A function that takes a vector and returns the scaled vector.
240
+ * @since 1.0.0
241
+ */
39
242
  (s: number): (v: Vector3) => Vector3;
243
+ /**
244
+ * Scales a `Vector3` instance by a scalar value.
245
+ *
246
+ * @param s - The scalar value to scale by.
247
+ * @param v - The vector to scale.
248
+ * @returns A new `Vector3` instance representing the scaled vector.
249
+ * @since 1.0.0
250
+ */
40
251
  (v: Vector3, s: number): Vector3;
41
252
  };
253
+ /**
254
+ * Gets the x component of a `Vector3`.
255
+ *
256
+ * @param v - The vector to get the x component of.
257
+ * @returns The x component of the vector.
258
+ * @since 1.0.0
259
+ */
42
260
  declare const getX: (v: Vector3) => number;
43
261
  declare const setX: {
262
+ /**
263
+ * Sets the x component of a `Vector3`.
264
+ *
265
+ * @param v - The vector to set the x component of.
266
+ * @param x - The new x component.
267
+ * @returns A new `Vector3` instance with the updated x component.
268
+ * @since 1.0.0
269
+ */
44
270
  (v: Vector3, x: number): Vector3;
271
+ /**
272
+ * Sets the x component of a `Vector3`.
273
+ *
274
+ * @param x - The new x component.
275
+ * @returns A function that takes the vector and returns a new `Vector3` instance with the updated x component.
276
+ * @since 1.0.0
277
+ */
45
278
  (x: number): (v: Vector3) => Vector3;
46
279
  };
280
+ /**
281
+ * Gets the y component of a `Vector3`.
282
+ *
283
+ * @param v - The vector of which to get the y component.
284
+ * @returns The y component of the vector.
285
+ * @since 1.0.0
286
+ */
47
287
  declare const getY: (v: Vector3) => number;
48
288
  declare const setY: {
289
+ /**
290
+ * Sets the y component of a `Vector3`.
291
+ *
292
+ * @param v - The vector of which to set the y component.
293
+ * @param y - The new y component.
294
+ * @returns A new `Vector3` instance with the updated y component.
295
+ * @since 1.0.0
296
+ */
49
297
  (v: Vector3, y: number): Vector3;
298
+ /**
299
+ * Sets the y component of a `Vector3`.
300
+ *
301
+ * @param y - The new y component.
302
+ * @returns A function that takes the vector and returns a new `Vector3` instance with the updated y component.
303
+ * @since 1.0.0
304
+ */
50
305
  (y: number): (v: Vector3) => Vector3;
51
306
  };
307
+ /**
308
+ * Gets the z component of a `Vector3`.
309
+ *
310
+ * @param v - The vector of which to get the z component.
311
+ * @returns The z component of the vector.
312
+ * @since 1.0.0
313
+ */
52
314
  declare const getZ: (v: Vector3) => number;
53
315
  declare const setZ: {
316
+ /**
317
+ * Sets the z component of a `Vector3`.
318
+ *
319
+ * @param v - The vector of which to set the z component.
320
+ * @param z - The new z component.
321
+ * @returns A new `Vector3` instance with the updated z component.
322
+ * @since 1.0.0
323
+ */
54
324
  (v: Vector3, z: number): Vector3;
325
+ /**
326
+ * Sets the z component of a `Vector3`.
327
+ *
328
+ * @param z - The new z component.
329
+ * @returns A function that takes the vector and returns a new `Vector3` instance with the updated z component.
330
+ * @since 1.0.0
331
+ */
55
332
  (z: number): (v: Vector3) => Vector3;
56
333
  };
334
+ /**
335
+ * Gets the radius of a `Vector3`.
336
+ *
337
+ * @param v - The vector of which to get the radius.
338
+ * @returns The radius of the vector.
339
+ * @since 1.0.0
340
+ */
57
341
  declare const getR: (v: Vector3) => number;
58
342
  declare const setR: {
343
+ /**
344
+ * Sets the radius of a `Vector3`.
345
+ *
346
+ * @param v - The vector of which to set the radius.
347
+ * @param r - The new radius.
348
+ * @returns A new `Vector3` instance with the updated radius.
349
+ * @since 1.0.0
350
+ */
59
351
  (v: Vector3, r: number): Vector3;
352
+ /**
353
+ * Sets the radius of a `Vector3`.
354
+ *
355
+ * @param r - The new radius.
356
+ * @returns A function that takes the vector and returns the updated vector.
357
+ * @since 1.0.0
358
+ */
60
359
  (r: number): (v: Vector3) => Vector3;
61
360
  };
361
+ /**
362
+ * Gets the polar angle (theta) of a `Vector3`.
363
+ *
364
+ * @param v - The vector of which to get the polar angle.
365
+ * @returns The polar angle of the vector.
366
+ * @since 1.0.0
367
+ */
62
368
  declare const getTheta: (v: Vector3) => number;
63
369
  declare const setTheta: {
370
+ /**
371
+ * Sets the polar angle (theta) of a `Vector3`.
372
+ *
373
+ * @param v - The vector of which to set the polar angle.
374
+ * @param theta - The new polar angle.
375
+ * @returns A new `Vector3` instance with the updated polar angle.
376
+ * @since 1.0.0
377
+ */
64
378
  (v: Vector3, theta: number): Vector3;
379
+ /**
380
+ * Sets the polar angle (theta) of a `Vector3`.
381
+ *
382
+ * @param theta - The new polar angle.
383
+ * @returns A function that takes the vector and returns the updated vector.
384
+ * @since 1.0.0
385
+ */
65
386
  (theta: number): (v: Vector3) => Vector3;
66
387
  };
388
+ /**
389
+ * Gets the azimuthal angle (phi) of a `Vector3`.
390
+ *
391
+ * @param v - The vector of which to get the azimuthal angle.
392
+ * @returns The azimuthal angle of the vector.
393
+ * @since 1.0.0
394
+ */
67
395
  declare const getPhi: (v: Vector3) => number;
68
396
  declare const setPhi: {
397
+ /**
398
+ * Sets the azimuthal angle (phi) of a `Vector3`.
399
+ *
400
+ * @param v - The vector of which to set the azimuthal angle.
401
+ * @param phi - The new azimuthal angle.
402
+ * @returns A new `Vector3` instance with the updated azimuthal angle.
403
+ * @since 1.0.0
404
+ */
69
405
  (v: Vector3, phi: number): Vector3;
406
+ /**
407
+ * Sets the azimuthal angle (phi) of a `Vector3`.
408
+ *
409
+ * @param phi - The new azimuthal angle.
410
+ * @returns A function that takes the vector and returns the updated vector.
411
+ * @since 1.0.0
412
+ */
70
413
  (phi: number): (v: Vector3) => Vector3;
71
414
  };
72
415
 
73
- export { type Vector3, add, components, dot, fromSpherical, getPhi, getR, getTheta, getX, getY, getZ, hadamard, isVector3, magnitude, make, normalize, scale, setPhi, setR, setTheta, setX, setY, setZ, softmax, subtract, zero };
416
+ export { add, components, cross, dot, fromSpherical, getPhi, getR, getTheta, getX, getY, getZ, hadamard, isVector3, length, magnitude, make, normalize, scale, setPhi, setR, setTheta, setX, setY, setZ, softmax, subtract, unit, unitX, unitY, unitZ, zero };
417
+ export type { Vector3 };