curvy 2.0.0-alpha.0 → 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 +3 -3
- package/dist/characteristic/index.mjs +1 -1
- package/dist/curve/index.d.mts +1 -1
- package/dist/curve/index.mjs +1 -1
- package/dist/interval/index.d.mts +3 -2
- package/dist/interval/index.mjs +3 -2
- package/dist/matrix/index.d.mts +1 -1
- package/dist/number.mjs.map +1 -1
- package/dist/path/index.d.mts +26 -6
- package/dist/path/index.mjs +36 -3
- package/dist/path/index.mjs.map +1 -1
- package/dist/polynomial/index.d.mts +1 -1
- package/dist/polynomial/index.mjs +2 -2
- package/dist/shared/{characteristic-BGRxcxUH.mjs → characteristic-B9nCh_cx.mjs} +2 -2
- package/dist/shared/{characteristic-BGRxcxUH.mjs.map → characteristic-B9nCh_cx.mjs.map} +1 -1
- package/dist/shared/{cubic-Dfn6DB02.d.mts → cubic-BajUY0JT.d.mts} +12 -11
- package/dist/shared/{cubic-CYYEUHNm.mjs → cubic-CpHAx8cC.mjs} +5 -5
- package/dist/shared/cubic-CpHAx8cC.mjs.map +1 -0
- package/dist/shared/{interval-CCEqzPgA.mjs → interval-05CR6eBf.mjs} +47 -2
- package/dist/shared/interval-05CR6eBf.mjs.map +1 -0
- package/dist/shared/{interval-hQDiKqj0.d.mts → interval-Dy-RMEE3.d.mts} +43 -4
- 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-Bt_DBlP0.d.mts → matrix4x4-Dm_tSiH1.d.mts} +4 -3
- package/dist/shared/{quadratic-DEhuAKuE.mjs → quadratic-CamozcFc.mjs} +3 -3
- package/dist/shared/quadratic-CamozcFc.mjs.map +1 -0
- package/dist/shared/{rationalCubic2d-D_-XWxcm.d.mts → rationalCubic2d-B6g97ryJ.d.mts} +16 -5
- package/dist/shared/{rationalCubic2d-CXa7Yren.mjs → rationalCubic2d-BEgUGSFf.mjs} +20 -3
- package/dist/shared/rationalCubic2d-BEgUGSFf.mjs.map +1 -0
- package/dist/shared/{rationalCubic2d-CP4oGpnk.mjs → rationalCubic2d-Bys2Uory.mjs} +44 -7
- package/dist/shared/rationalCubic2d-Bys2Uory.mjs.map +1 -0
- package/dist/shared/{rationalCubic2d-BPLohNuI.d.mts → rationalCubic2d-DlQfBURs.d.mts} +40 -9
- package/dist/shared/{solution-CbSWzXCn.mjs → solution-CrtLfqEq.mjs} +2 -2
- package/dist/shared/{solution-CbSWzXCn.mjs.map → solution-CrtLfqEq.mjs.map} +1 -1
- package/dist/shared/{solution-BjoW7ov4.d.mts → solution-sNQ-ZVhN.d.mts} +3 -3
- package/dist/shared/{utils-DqTGyXrP.d.mts → utils-MCckigYk.d.mts} +1 -1
- package/dist/shared/vector2-DPUY3_eA.d.mts +470 -0
- package/dist/shared/{vector2-TV0UnlxY.d.mts → vector3-DqeOZtOB.d.mts} +43 -508
- package/dist/solution/index.d.mts +1 -1
- package/dist/solution/index.mjs +1 -1
- package/dist/splines/index.d.mts +4 -4
- package/dist/splines/index.mjs +4 -4
- package/dist/utils.d.mts +1 -1
- package/dist/vector/index.d.mts +2 -1
- package/package.json +1 -1
- package/dist/shared/cubic-CYYEUHNm.mjs.map +0 -1
- package/dist/shared/interval-CCEqzPgA.mjs.map +0 -1
- package/dist/shared/quadratic-DEhuAKuE.mjs.map +0 -1
- package/dist/shared/rationalCubic2d-CP4oGpnk.mjs.map +0 -1
- package/dist/shared/rationalCubic2d-CXa7Yren.mjs.map +0 -1
|
@@ -1,32 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as FourDimensional, s as ThreeDimensional } from "./vector2-DPUY3_eA.mjs";
|
|
2
|
+
import { t as Pipeable } from "./utils-MCckigYk.mjs";
|
|
2
3
|
|
|
3
|
-
//#region src/dimensions.d.ts
|
|
4
|
-
type TwoDimensionalIndex = 0 | 1;
|
|
5
|
-
type TwoDimensionalComponent = 'x' | 'y';
|
|
6
|
-
interface TwoDimensional<out T1, out T2 = T1> {
|
|
7
|
-
readonly x: T1;
|
|
8
|
-
readonly y: T2;
|
|
9
|
-
readonly 0: T1;
|
|
10
|
-
readonly 1: T2;
|
|
11
|
-
}
|
|
12
|
-
type ThreeDimensionalIndex = TwoDimensionalIndex | 2;
|
|
13
|
-
type ThreeDimensionalComponent = TwoDimensionalComponent | 'z';
|
|
14
|
-
interface ThreeDimensional<out T1, out T2 = T1, out T3 = T2> extends TwoDimensional<T1, T2> {
|
|
15
|
-
readonly z: T3;
|
|
16
|
-
readonly 2: T3;
|
|
17
|
-
}
|
|
18
|
-
type FourDimensionalIndex = ThreeDimensionalIndex | 3;
|
|
19
|
-
type FourDimensionalComponent = ThreeDimensionalComponent | 'w';
|
|
20
|
-
interface FourDimensional<out T1, out T2 = T1, out T3 = T2, out T4 = T3> extends ThreeDimensional<T1, T2, T3> {
|
|
21
|
-
readonly w: T4;
|
|
22
|
-
readonly 3: T4;
|
|
23
|
-
}
|
|
24
|
-
//#endregion
|
|
25
4
|
//#region src/vector/vector4.internal.d.ts
|
|
26
5
|
declare const Vector4TypeId: unique symbol;
|
|
27
6
|
type Vector4TypeId = typeof Vector4TypeId;
|
|
28
7
|
declare namespace vector4_d_exports {
|
|
29
|
-
export { Vector4, add$
|
|
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 };
|
|
30
9
|
}
|
|
31
10
|
/**
|
|
32
11
|
* A 4D vector.
|
|
@@ -46,7 +25,7 @@ interface Vector4 extends Pipeable, FourDimensional<number> {
|
|
|
46
25
|
* @since 1.0.0
|
|
47
26
|
*/
|
|
48
27
|
declare const isVector4: (v: unknown) => v is Vector4;
|
|
49
|
-
declare const equals$
|
|
28
|
+
declare const equals$1: {
|
|
50
29
|
/**
|
|
51
30
|
* Checks if two `Vector4` instances are approximately equal within the
|
|
52
31
|
* default absolute tolerance ({@link EPSILON}).
|
|
@@ -67,7 +46,7 @@ declare const equals$2: {
|
|
|
67
46
|
*/
|
|
68
47
|
(b: Vector4): (a: Vector4) => boolean;
|
|
69
48
|
};
|
|
70
|
-
declare const make$
|
|
49
|
+
declare const make$1: {
|
|
71
50
|
/**
|
|
72
51
|
* Creates a new `Vector4` instance.
|
|
73
52
|
*
|
|
@@ -133,7 +112,7 @@ declare const make$2: {
|
|
|
133
112
|
* @returns A tuple of `Vector4`s with the same arity as the projection's return tuple.
|
|
134
113
|
* @since 2.1.0
|
|
135
114
|
*/
|
|
136
|
-
declare const transpose$
|
|
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 };
|
|
137
116
|
/**
|
|
138
117
|
* Gets the magnitude of a `Vector4`.
|
|
139
118
|
*
|
|
@@ -141,7 +120,7 @@ declare const transpose$2: <T, const Channels extends ReadonlyArray<number>>(inp
|
|
|
141
120
|
* @returns The magnitude of the vector.
|
|
142
121
|
* @since 1.0.0
|
|
143
122
|
*/
|
|
144
|
-
declare const magnitude$
|
|
123
|
+
declare const magnitude$1: (vector: Vector4) => number;
|
|
145
124
|
/**
|
|
146
125
|
* Normalizes a `Vector4`.
|
|
147
126
|
*
|
|
@@ -149,8 +128,8 @@ declare const magnitude$2: (vector: Vector4) => number;
|
|
|
149
128
|
* @returns A new `Vector4` instance with the same direction as the input vector but with a magnitude of 1.
|
|
150
129
|
* @since 1.0.0
|
|
151
130
|
*/
|
|
152
|
-
declare const normalize$
|
|
153
|
-
declare const dot$
|
|
131
|
+
declare const normalize$1: (vector: Vector4) => Vector4;
|
|
132
|
+
declare const dot$1: {
|
|
154
133
|
/**
|
|
155
134
|
* Computes the dot product of two `Vector4` instances.
|
|
156
135
|
*
|
|
@@ -176,27 +155,27 @@ declare const dot$2: {
|
|
|
176
155
|
* @returns An array containing the x, y, z, and w components of the vector.
|
|
177
156
|
* @since 1.0.0
|
|
178
157
|
*/
|
|
179
|
-
declare const components$
|
|
158
|
+
declare const components$1: (v: Vector4) => [number, number, number, number];
|
|
180
159
|
/**
|
|
181
160
|
* Applies the softmax function to a `Vector4`.
|
|
182
161
|
*
|
|
183
162
|
* @param v - The vector to calculate the softmax of.
|
|
184
163
|
* @returns A new `Vector4` instance representing the softmax of the input vector.
|
|
185
164
|
*/
|
|
186
|
-
declare const softmax$
|
|
165
|
+
declare const softmax$1: (v: Vector4) => Vector4;
|
|
187
166
|
/**
|
|
188
167
|
* Creates a zero vector.
|
|
189
168
|
*
|
|
190
169
|
* @since 1.0.0
|
|
191
170
|
*/
|
|
192
|
-
declare const zero$
|
|
171
|
+
declare const zero$1: Vector4;
|
|
193
172
|
/**
|
|
194
173
|
* Creates a unit vector.
|
|
195
174
|
*
|
|
196
175
|
* @since 1.0.0
|
|
197
176
|
*/
|
|
198
|
-
declare const unit$
|
|
199
|
-
declare const add$
|
|
177
|
+
declare const unit$1: Vector4;
|
|
178
|
+
declare const add$1: {
|
|
200
179
|
/**
|
|
201
180
|
* Adds two `Vector4` instances.
|
|
202
181
|
*
|
|
@@ -215,7 +194,7 @@ declare const add$2: {
|
|
|
215
194
|
*/
|
|
216
195
|
(b: Vector4): (a: Vector4) => Vector4;
|
|
217
196
|
};
|
|
218
|
-
declare const subtract$
|
|
197
|
+
declare const subtract$1: {
|
|
219
198
|
/**
|
|
220
199
|
* Subtracts one `Vector4` instance from another.
|
|
221
200
|
*
|
|
@@ -234,7 +213,7 @@ declare const subtract$2: {
|
|
|
234
213
|
*/
|
|
235
214
|
(b: Vector4): (a: Vector4) => Vector4;
|
|
236
215
|
};
|
|
237
|
-
declare const hadamard$
|
|
216
|
+
declare const hadamard$1: {
|
|
238
217
|
/**
|
|
239
218
|
* Computes the Hadamard product of two `Vector4` instances.
|
|
240
219
|
*
|
|
@@ -253,7 +232,7 @@ declare const hadamard$2: {
|
|
|
253
232
|
*/
|
|
254
233
|
(b: Vector4): (a: Vector4) => Vector4;
|
|
255
234
|
};
|
|
256
|
-
declare const scale$
|
|
235
|
+
declare const scale$1: {
|
|
257
236
|
/**
|
|
258
237
|
* Scales a `Vector4` by a scalar.
|
|
259
238
|
*
|
|
@@ -277,7 +256,7 @@ declare const scale$2: {
|
|
|
277
256
|
declare const Vector3TypeId: unique symbol;
|
|
278
257
|
type Vector3TypeId = typeof Vector3TypeId;
|
|
279
258
|
declare namespace vector3_d_exports {
|
|
280
|
-
export { Vector3, add
|
|
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 };
|
|
281
260
|
}
|
|
282
261
|
/**
|
|
283
262
|
* A 3D vector.
|
|
@@ -297,7 +276,7 @@ interface Vector3 extends Pipeable, ThreeDimensional<number> {
|
|
|
297
276
|
* @since 1.0.0
|
|
298
277
|
*/
|
|
299
278
|
declare const isVector3: (v: unknown) => v is Vector3;
|
|
300
|
-
declare const equals
|
|
279
|
+
declare const equals: {
|
|
301
280
|
/**
|
|
302
281
|
* Checks if two `Vector3` instances are approximately equal within the
|
|
303
282
|
* default absolute tolerance ({@link EPSILON}).
|
|
@@ -318,7 +297,7 @@ declare const equals$1: {
|
|
|
318
297
|
*/
|
|
319
298
|
(b: Vector3): (a: Vector3) => boolean;
|
|
320
299
|
};
|
|
321
|
-
declare const make
|
|
300
|
+
declare const make: {
|
|
322
301
|
/**
|
|
323
302
|
* Creates a new `Vector3` instance.
|
|
324
303
|
*
|
|
@@ -357,7 +336,7 @@ declare const make$1: {
|
|
|
357
336
|
* @returns A tuple of `Vector3`s with the same arity as the projection's return tuple.
|
|
358
337
|
* @since 2.1.0
|
|
359
338
|
*/
|
|
360
|
-
declare const transpose
|
|
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 };
|
|
361
340
|
/**
|
|
362
341
|
* Creates a new `Vector3` instance from spherical coordinates.
|
|
363
342
|
*
|
|
@@ -375,7 +354,7 @@ declare const fromSpherical: (r: number, theta: number, phi: number) => Vector3;
|
|
|
375
354
|
* @returns The magnitude of the vector.
|
|
376
355
|
* @since 1.0.0
|
|
377
356
|
*/
|
|
378
|
-
declare const magnitude
|
|
357
|
+
declare const magnitude: (vector: Vector3) => number;
|
|
379
358
|
/**
|
|
380
359
|
* Calculates the length of a `Vector3`.
|
|
381
360
|
*
|
|
@@ -392,8 +371,8 @@ declare const length: (vector: Vector3) => number;
|
|
|
392
371
|
* @returns A new `Vector3` instance with the same direction as the input vector, but with a magnitude of 1.
|
|
393
372
|
* @since 1.0.0
|
|
394
373
|
*/
|
|
395
|
-
declare const normalize
|
|
396
|
-
declare const dot
|
|
374
|
+
declare const normalize: (vector: Vector3) => Vector3;
|
|
375
|
+
declare const dot: {
|
|
397
376
|
/**
|
|
398
377
|
* Calculates the dot product of two `Vector3` instances.
|
|
399
378
|
*
|
|
@@ -412,7 +391,7 @@ declare const dot$1: {
|
|
|
412
391
|
*/
|
|
413
392
|
(b: Vector3): (a: Vector3) => number;
|
|
414
393
|
};
|
|
415
|
-
declare const cross
|
|
394
|
+
declare const cross: {
|
|
416
395
|
/**
|
|
417
396
|
* Calculates the cross product of two `Vector3` instances.
|
|
418
397
|
*
|
|
@@ -438,7 +417,7 @@ declare const cross$1: {
|
|
|
438
417
|
* @returns An array containing the x, y, and z components of the vector.
|
|
439
418
|
* @since 1.0.0
|
|
440
419
|
*/
|
|
441
|
-
declare const components
|
|
420
|
+
declare const components: (v: Vector3) => [number, number, number];
|
|
442
421
|
/**
|
|
443
422
|
* Calculates the softmax of a `Vector3`.
|
|
444
423
|
*
|
|
@@ -446,19 +425,19 @@ declare const components$1: (v: Vector3) => [number, number, number];
|
|
|
446
425
|
* @returns A new `Vector3` instance representing the softmax of the input vector.
|
|
447
426
|
* @since 1.0.0
|
|
448
427
|
*/
|
|
449
|
-
declare const softmax
|
|
428
|
+
declare const softmax: (v: Vector3) => Vector3;
|
|
450
429
|
/**
|
|
451
430
|
* Creates a zero vector.
|
|
452
431
|
*
|
|
453
432
|
* @since 1.0.0
|
|
454
433
|
*/
|
|
455
|
-
declare const zero
|
|
434
|
+
declare const zero: Vector3;
|
|
456
435
|
/**
|
|
457
436
|
* Creates a unit vector.
|
|
458
437
|
*
|
|
459
438
|
* @since 1.0.0
|
|
460
439
|
*/
|
|
461
|
-
declare const unit
|
|
440
|
+
declare const unit: Vector3;
|
|
462
441
|
/**
|
|
463
442
|
* Creates a unit vector in the x direction.
|
|
464
443
|
*
|
|
@@ -477,7 +456,7 @@ declare const unitY: Vector3;
|
|
|
477
456
|
* @since 1.0.0
|
|
478
457
|
*/
|
|
479
458
|
declare const unitZ: Vector3;
|
|
480
|
-
declare const add
|
|
459
|
+
declare const add: {
|
|
481
460
|
/**
|
|
482
461
|
* Adds two `Vector3` instances.
|
|
483
462
|
*
|
|
@@ -496,7 +475,7 @@ declare const add$1: {
|
|
|
496
475
|
*/
|
|
497
476
|
(b: Vector3): (a: Vector3) => Vector3;
|
|
498
477
|
};
|
|
499
|
-
declare const subtract
|
|
478
|
+
declare const subtract: {
|
|
500
479
|
/**
|
|
501
480
|
* Subtracts one `Vector3` instance from another.
|
|
502
481
|
*
|
|
@@ -515,7 +494,7 @@ declare const subtract$1: {
|
|
|
515
494
|
*/
|
|
516
495
|
(b: Vector3): (a: Vector3) => Vector3;
|
|
517
496
|
};
|
|
518
|
-
declare const hadamard
|
|
497
|
+
declare const hadamard: {
|
|
519
498
|
/**
|
|
520
499
|
* Calculates the Hadamard product of two `Vector3` instances.
|
|
521
500
|
*
|
|
@@ -538,7 +517,7 @@ declare const hadamard$1: {
|
|
|
538
517
|
*/
|
|
539
518
|
(b: Vector3): (a: Vector3) => Vector3;
|
|
540
519
|
};
|
|
541
|
-
declare const scale
|
|
520
|
+
declare const scale: {
|
|
542
521
|
/**
|
|
543
522
|
* Scales a `Vector3` instance by a scalar value.
|
|
544
523
|
*
|
|
@@ -564,8 +543,8 @@ declare const scale$1: {
|
|
|
564
543
|
* @returns The x component of the vector.
|
|
565
544
|
* @since 1.0.0
|
|
566
545
|
*/
|
|
567
|
-
declare const getX
|
|
568
|
-
declare const setX
|
|
546
|
+
declare const getX: (v: Vector3) => number;
|
|
547
|
+
declare const setX: {
|
|
569
548
|
/**
|
|
570
549
|
* Sets the x component of a `Vector3`.
|
|
571
550
|
*
|
|
@@ -591,8 +570,8 @@ declare const setX$1: {
|
|
|
591
570
|
* @returns The y component of the vector.
|
|
592
571
|
* @since 1.0.0
|
|
593
572
|
*/
|
|
594
|
-
declare const getY
|
|
595
|
-
declare const setY
|
|
573
|
+
declare const getY: (v: Vector3) => number;
|
|
574
|
+
declare const setY: {
|
|
596
575
|
/**
|
|
597
576
|
* Sets the y component of a `Vector3`.
|
|
598
577
|
*
|
|
@@ -645,8 +624,8 @@ declare const setZ: {
|
|
|
645
624
|
* @returns The radius of the vector.
|
|
646
625
|
* @since 1.0.0
|
|
647
626
|
*/
|
|
648
|
-
declare const getR
|
|
649
|
-
declare const setR
|
|
627
|
+
declare const getR: (v: Vector3) => number;
|
|
628
|
+
declare const setR: {
|
|
650
629
|
/**
|
|
651
630
|
* Sets the radius of a `Vector3`.
|
|
652
631
|
*
|
|
@@ -672,8 +651,8 @@ declare const setR$1: {
|
|
|
672
651
|
* @returns The polar angle of the vector.
|
|
673
652
|
* @since 1.0.0
|
|
674
653
|
*/
|
|
675
|
-
declare const getTheta
|
|
676
|
-
declare const setTheta
|
|
654
|
+
declare const getTheta: (v: Vector3) => number;
|
|
655
|
+
declare const setTheta: {
|
|
677
656
|
/**
|
|
678
657
|
* Sets the polar angle (theta) of a `Vector3`.
|
|
679
658
|
*
|
|
@@ -720,449 +699,5 @@ declare const setPhi: {
|
|
|
720
699
|
(phi: number): (v: Vector3) => Vector3;
|
|
721
700
|
};
|
|
722
701
|
//#endregion
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
type Vector2TypeId = typeof Vector2TypeId;
|
|
726
|
-
declare const WeightedVector2TypeId: unique symbol;
|
|
727
|
-
type WeightedVector2TypeId = typeof WeightedVector2TypeId;
|
|
728
|
-
declare namespace vector2_d_exports {
|
|
729
|
-
export { Vector2, Weighted, add, components, cross, dot, equals, fromPolar, getR, getTheta, getX, getY, hadamard, isVector2, isWeighted, magnitude, make, makeWeighted, normalize, scale, setR, setTheta, setX, setY, softmax, subtract, transpose, unit, unweighted, weightedEquals, withWeight, zero };
|
|
730
|
-
}
|
|
731
|
-
/**
|
|
732
|
-
* A 2D vector.
|
|
733
|
-
*
|
|
734
|
-
* All fields are readonly and immutable, and all operations create new instances.
|
|
735
|
-
*
|
|
736
|
-
* @since 1.0.0
|
|
737
|
-
*/
|
|
738
|
-
interface Vector2 extends Pipeable, TwoDimensional<number> {
|
|
739
|
-
readonly [Vector2TypeId]: Vector2TypeId;
|
|
740
|
-
}
|
|
741
|
-
/**
|
|
742
|
-
* A 2D point with an associated positive scalar weight.
|
|
743
|
-
*
|
|
744
|
-
* Used by rational primitives (e.g. `RationalBezier2d`) where each control
|
|
745
|
-
* point carries an influence weight. The interface is structurally distinct
|
|
746
|
-
* from `Vector2` — its brand prevents accidental use with vector arithmetic
|
|
747
|
-
* (`add`, `subtract`, `scale`, etc.) where weighted operations are not
|
|
748
|
-
* well-defined.
|
|
749
|
-
*
|
|
750
|
-
* Construct via {@link makeWeighted} (from raw components) or
|
|
751
|
-
* {@link withWeight} (from an existing `Vector2`).
|
|
752
|
-
*
|
|
753
|
-
* @since 2.1.0
|
|
754
|
-
*/
|
|
755
|
-
interface Weighted extends Pipeable {
|
|
756
|
-
readonly [WeightedVector2TypeId]: WeightedVector2TypeId;
|
|
757
|
-
readonly x: number;
|
|
758
|
-
readonly y: number;
|
|
759
|
-
readonly weight: number;
|
|
760
|
-
}
|
|
761
|
-
/**
|
|
762
|
-
* Checks if a value is a `Vector2`.
|
|
763
|
-
*
|
|
764
|
-
* @param v - The value to check.
|
|
765
|
-
* @returns `true` if the value is a `Vector2`, `false` otherwise.
|
|
766
|
-
* @since 1.0.0
|
|
767
|
-
*/
|
|
768
|
-
declare const isVector2: (v: unknown) => v is Vector2;
|
|
769
|
-
/**
|
|
770
|
-
* Checks if a value is a `Vector2.Weighted`.
|
|
771
|
-
*
|
|
772
|
-
* @param v - The value to check.
|
|
773
|
-
* @returns `true` if the value is a `Vector2.Weighted`, `false` otherwise.
|
|
774
|
-
* @since 2.1.0
|
|
775
|
-
*/
|
|
776
|
-
declare const isWeighted: (v: unknown) => v is Weighted;
|
|
777
|
-
/**
|
|
778
|
-
* Creates a new `Vector2.Weighted` from raw components. The weight must be
|
|
779
|
-
* finite and positive.
|
|
780
|
-
*
|
|
781
|
-
* @param x - The x component.
|
|
782
|
-
* @param y - The y component.
|
|
783
|
-
* @param weight - The positive scalar weight.
|
|
784
|
-
* @returns A new `Vector2.Weighted` instance.
|
|
785
|
-
* @since 2.1.0
|
|
786
|
-
*/
|
|
787
|
-
declare const makeWeighted: (x: number, y: number, weight: number) => Weighted;
|
|
788
|
-
declare const withWeight: {
|
|
789
|
-
/**
|
|
790
|
-
* Promotes a `Vector2` to a `Vector2.Weighted` by attaching the given
|
|
791
|
-
* positive scalar weight.
|
|
792
|
-
*
|
|
793
|
-
* @param v - The point to weight.
|
|
794
|
-
* @param weight - The positive scalar weight.
|
|
795
|
-
* @returns A new `Vector2.Weighted` instance.
|
|
796
|
-
* @since 2.1.0
|
|
797
|
-
*/
|
|
798
|
-
(v: Vector2, weight: number): Weighted;
|
|
799
|
-
/**
|
|
800
|
-
* Promotes a `Vector2` to a `Vector2.Weighted` by attaching the given
|
|
801
|
-
* positive scalar weight.
|
|
802
|
-
*
|
|
803
|
-
* @param weight - The positive scalar weight.
|
|
804
|
-
* @returns A function that takes a `Vector2` and returns a weighted point.
|
|
805
|
-
* @since 2.1.0
|
|
806
|
-
*/
|
|
807
|
-
(weight: number): (v: Vector2) => Weighted;
|
|
808
|
-
};
|
|
809
|
-
/**
|
|
810
|
-
* Strips the weight from a `Vector2.Weighted`, returning the underlying point.
|
|
811
|
-
*
|
|
812
|
-
* @param w - The weighted point.
|
|
813
|
-
* @returns A new `Vector2` instance with the same x and y components.
|
|
814
|
-
* @since 2.1.0
|
|
815
|
-
*/
|
|
816
|
-
declare const unweighted: (w: Weighted) => Vector2;
|
|
817
|
-
declare const weightedEquals: {
|
|
818
|
-
/**
|
|
819
|
-
* Checks if two `Vector2.Weighted` instances are approximately equal —
|
|
820
|
-
* point components and weight all within the default absolute tolerance.
|
|
821
|
-
*
|
|
822
|
-
* @param a - The first weighted point.
|
|
823
|
-
* @param b - The second weighted point.
|
|
824
|
-
* @returns `true` when components and weight are within tolerance.
|
|
825
|
-
* @since 2.1.0
|
|
826
|
-
*/
|
|
827
|
-
(a: Weighted, b: Weighted): boolean;
|
|
828
|
-
/**
|
|
829
|
-
* Checks if two `Vector2.Weighted` instances are approximately equal.
|
|
830
|
-
*
|
|
831
|
-
* @param b - The second weighted point.
|
|
832
|
-
* @returns A function that takes the first weighted point and returns the comparison result.
|
|
833
|
-
* @since 2.1.0
|
|
834
|
-
*/
|
|
835
|
-
(b: Weighted): (a: Weighted) => boolean;
|
|
836
|
-
};
|
|
837
|
-
declare const equals: {
|
|
838
|
-
/**
|
|
839
|
-
* Checks if two `Vector2` instances are approximately equal within the
|
|
840
|
-
* default absolute tolerance ({@link EPSILON}).
|
|
841
|
-
*
|
|
842
|
-
* @param a - The first vector.
|
|
843
|
-
* @param b - The second vector.
|
|
844
|
-
* @returns `true` when each pair of components is within tolerance.
|
|
845
|
-
* @since 1.1.0
|
|
846
|
-
*/
|
|
847
|
-
(a: Vector2, b: Vector2): boolean;
|
|
848
|
-
/**
|
|
849
|
-
* Checks if two `Vector2` instances are approximately equal within the
|
|
850
|
-
* default absolute tolerance ({@link EPSILON}).
|
|
851
|
-
*
|
|
852
|
-
* @param b - The second vector.
|
|
853
|
-
* @returns A function that takes the first vector and returns the comparison result.
|
|
854
|
-
* @since 1.1.0
|
|
855
|
-
*/
|
|
856
|
-
(b: Vector2): (a: Vector2) => boolean;
|
|
857
|
-
};
|
|
858
|
-
declare const make: {
|
|
859
|
-
/**
|
|
860
|
-
* Creates a new `Vector2` instance.
|
|
861
|
-
*
|
|
862
|
-
* @param xy - The x and y components of the vector.
|
|
863
|
-
* @returns A new `Vector2` instance.
|
|
864
|
-
* @since 1.0.0
|
|
865
|
-
*/
|
|
866
|
-
(xy: number): Vector2;
|
|
867
|
-
/**
|
|
868
|
-
* Creates a new `Vector2` instance.
|
|
869
|
-
*
|
|
870
|
-
* @param x - The x component of the vector.
|
|
871
|
-
* @param y - The y component of the vector.
|
|
872
|
-
* @returns A new `Vector2` instance.
|
|
873
|
-
* @since 1.0.0
|
|
874
|
-
*/
|
|
875
|
-
(x: number, y: number): Vector2;
|
|
876
|
-
};
|
|
877
|
-
/**
|
|
878
|
-
* Transposes a 2-tuple of items into one or more `Vector2`s, one per channel
|
|
879
|
-
* extracted by the projection function. See {@link Vector4.transpose} for the
|
|
880
|
-
* full operation description; this is the 2-component analog.
|
|
881
|
-
*
|
|
882
|
-
* @param inputs - Exactly two items of any type.
|
|
883
|
-
* @param project - A function returning a fixed-arity tuple of numbers — one per output channel.
|
|
884
|
-
* @returns A tuple of `Vector2`s with the same arity as the projection's return tuple.
|
|
885
|
-
* @since 2.1.0
|
|
886
|
-
*/
|
|
887
|
-
declare const transpose: <T, const Channels extends ReadonlyArray<number>>(inputs: readonly [T, T], project: (item: T) => Channels) => { readonly [K in keyof Channels]: Vector2 };
|
|
888
|
-
/**
|
|
889
|
-
* Creates a new `Vector2` instance from polar coordinates.
|
|
890
|
-
*
|
|
891
|
-
* @param r - The radius.
|
|
892
|
-
* @param theta - The angle, in radians.
|
|
893
|
-
* @returns A new `Vector2` instance.
|
|
894
|
-
* @since 1.0.0
|
|
895
|
-
*/
|
|
896
|
-
declare const fromPolar: (r: number, theta: number) => Vector2;
|
|
897
|
-
/**
|
|
898
|
-
* Calculates the magnitude of a `Vector2`.
|
|
899
|
-
*
|
|
900
|
-
* @param vector - The vector to calculate the magnitude of.
|
|
901
|
-
* @returns The magnitude of the vector.
|
|
902
|
-
* @since 1.0.0
|
|
903
|
-
*/
|
|
904
|
-
declare const magnitude: (vector: Vector2) => number;
|
|
905
|
-
/**
|
|
906
|
-
* Normalizes a `Vector2`.
|
|
907
|
-
*
|
|
908
|
-
* @param vector - The vector to normalize.
|
|
909
|
-
* @returns A new `Vector2` instance with the same direction and a magnitude of 1.
|
|
910
|
-
* @since 1.0.0
|
|
911
|
-
*/
|
|
912
|
-
declare const normalize: (vector: Vector2) => Vector2;
|
|
913
|
-
declare const dot: {
|
|
914
|
-
/**
|
|
915
|
-
* Calculates the dot product of two `Vector2` instances.
|
|
916
|
-
*
|
|
917
|
-
* @param a - The first vector.
|
|
918
|
-
* @param b - The second vector.
|
|
919
|
-
* @returns The dot product of the two vectors.
|
|
920
|
-
* @since 1.0.0
|
|
921
|
-
*/
|
|
922
|
-
(a: Vector2, b: Vector2): number;
|
|
923
|
-
/**
|
|
924
|
-
* Calculates the dot product of two `Vector2` instances.
|
|
925
|
-
*
|
|
926
|
-
* @param b - The second vector.
|
|
927
|
-
* @returns A function that takes the first vector and returns the dot product.
|
|
928
|
-
* @since 1.0.0
|
|
929
|
-
*/
|
|
930
|
-
(b: Vector2): (a: Vector2) => number;
|
|
931
|
-
};
|
|
932
|
-
declare const cross: {
|
|
933
|
-
/**
|
|
934
|
-
* Calculates the cross product of two `Vector2` instances.
|
|
935
|
-
*
|
|
936
|
-
* @param a - The first vector.
|
|
937
|
-
* @param b - The second vector.
|
|
938
|
-
* @returns The cross product of the two vectors.
|
|
939
|
-
* @since 1.0.0
|
|
940
|
-
*/
|
|
941
|
-
(a: Vector2, b: Vector2): number;
|
|
942
|
-
/**
|
|
943
|
-
* Calculates the cross product of two `Vector2` instances.
|
|
944
|
-
*
|
|
945
|
-
* @param b - The second vector.
|
|
946
|
-
* @returns A function that takes the first vector and returns the cross product.
|
|
947
|
-
* @since 1.0.0
|
|
948
|
-
*/
|
|
949
|
-
(b: Vector2): (a: Vector2) => number;
|
|
950
|
-
};
|
|
951
|
-
/**
|
|
952
|
-
* Returns the components of a `Vector2` as an array.
|
|
953
|
-
*
|
|
954
|
-
* @param r - The radius.
|
|
955
|
-
* @param theta - The angle, in radians.
|
|
956
|
-
* @returns A new `Vector2` instance.
|
|
957
|
-
* @since 1.0.0
|
|
958
|
-
*/
|
|
959
|
-
declare const components: (v: Vector2) => [number, number];
|
|
960
|
-
/**
|
|
961
|
-
* Applies the softmax function to a `Vector2`.
|
|
962
|
-
*
|
|
963
|
-
* @param v - The vector to apply the softmax function to.
|
|
964
|
-
* @returns A new `Vector2` instance with the softmax applied.
|
|
965
|
-
* @since 1.0.0
|
|
966
|
-
*/
|
|
967
|
-
declare const softmax: (v: Vector2) => Vector2;
|
|
968
|
-
/**
|
|
969
|
-
* Creates a zero vector.
|
|
970
|
-
*
|
|
971
|
-
* @returns A new `Vector2` instance with both components set to 0.
|
|
972
|
-
* @since 1.0.0
|
|
973
|
-
*/
|
|
974
|
-
declare const zero: Vector2;
|
|
975
|
-
/**
|
|
976
|
-
* Creates a unit vector.
|
|
977
|
-
*
|
|
978
|
-
* @returns A new `Vector2` instance with both components set to 1.
|
|
979
|
-
* @since 1.0.0
|
|
980
|
-
*/
|
|
981
|
-
declare const unit: Vector2;
|
|
982
|
-
declare const add: {
|
|
983
|
-
/**
|
|
984
|
-
* Adds two `Vector2` instances together.
|
|
985
|
-
*
|
|
986
|
-
* @param a - The first vector.
|
|
987
|
-
* @param b - The second vector.
|
|
988
|
-
* @returns A new `Vector2` instance representing the sum of the two vectors.
|
|
989
|
-
* @since 1.0.0
|
|
990
|
-
*/
|
|
991
|
-
(a: Vector2, b: Vector2): Vector2;
|
|
992
|
-
/**
|
|
993
|
-
* Adds two `Vector2` instances together.
|
|
994
|
-
*
|
|
995
|
-
* @param b - The second vector.
|
|
996
|
-
* @returns A function that takes the first vector and returns the sum.
|
|
997
|
-
* @since 1.0.0
|
|
998
|
-
*/
|
|
999
|
-
(b: Vector2): (a: Vector2) => Vector2;
|
|
1000
|
-
};
|
|
1001
|
-
declare const subtract: {
|
|
1002
|
-
/**
|
|
1003
|
-
* Subtracts one `Vector2` instance from another.
|
|
1004
|
-
*
|
|
1005
|
-
* @param a - The first vector.
|
|
1006
|
-
* @param b - The second vector.
|
|
1007
|
-
* @returns A new `Vector2` instance representing the difference of the two vectors.
|
|
1008
|
-
* @since 1.0.0
|
|
1009
|
-
*/
|
|
1010
|
-
(a: Vector2, b: Vector2): Vector2;
|
|
1011
|
-
/**
|
|
1012
|
-
* Subtracts one `Vector2` instance from another.
|
|
1013
|
-
*
|
|
1014
|
-
* @param b - The second vector.
|
|
1015
|
-
* @returns A function that takes the first vector and returns the difference.
|
|
1016
|
-
* @since 1.0.0
|
|
1017
|
-
*/
|
|
1018
|
-
(b: Vector2): (a: Vector2) => Vector2;
|
|
1019
|
-
};
|
|
1020
|
-
declare const hadamard: {
|
|
1021
|
-
/**
|
|
1022
|
-
* Performs the Hadamard product of two `Vector2` instances.
|
|
1023
|
-
*
|
|
1024
|
-
* @param a - The first vector.
|
|
1025
|
-
* @param b - The second vector.
|
|
1026
|
-
* @returns A new `Vector2` instance representing the Hadamard product of the two vectors.
|
|
1027
|
-
* @since 1.0.0
|
|
1028
|
-
*/
|
|
1029
|
-
(a: Vector2, b: Vector2): Vector2;
|
|
1030
|
-
/**
|
|
1031
|
-
* Performs the Hadamard product of two `Vector2` instances.
|
|
1032
|
-
*
|
|
1033
|
-
* @param b - The second vector.
|
|
1034
|
-
* @returns A function that takes the first vector and returns the Hadamard product.
|
|
1035
|
-
* @since 1.0.0
|
|
1036
|
-
*/
|
|
1037
|
-
(b: Vector2): (a: Vector2) => Vector2;
|
|
1038
|
-
};
|
|
1039
|
-
declare const scale: {
|
|
1040
|
-
/**
|
|
1041
|
-
* Scales a `Vector2` by a scalar value.
|
|
1042
|
-
*
|
|
1043
|
-
* @param s - The scalar value to scale by.
|
|
1044
|
-
* @returns A function that takes a vector and returns the scaled vector.
|
|
1045
|
-
* @since 1.0.0
|
|
1046
|
-
*/
|
|
1047
|
-
(s: number): (v: Vector2) => Vector2;
|
|
1048
|
-
/**
|
|
1049
|
-
* Scales a `Vector2` by a scalar value.
|
|
1050
|
-
*
|
|
1051
|
-
* @param v - The vector to scale.
|
|
1052
|
-
* @param s - The scalar value to scale by.
|
|
1053
|
-
* @returns A new `Vector2` instance representing the scaled vector.
|
|
1054
|
-
* @since 1.0.0
|
|
1055
|
-
*/
|
|
1056
|
-
(v: Vector2, s: number): Vector2;
|
|
1057
|
-
};
|
|
1058
|
-
/**
|
|
1059
|
-
* Gets the x component of a `Vector2`.
|
|
1060
|
-
*
|
|
1061
|
-
* @param v - The vector to get the x component from.
|
|
1062
|
-
* @returns The x component of the vector.
|
|
1063
|
-
* @since 1.0.0
|
|
1064
|
-
*/
|
|
1065
|
-
declare const getX: (v: Vector2) => number;
|
|
1066
|
-
declare const setX: {
|
|
1067
|
-
/**
|
|
1068
|
-
* Sets the x component of a `Vector2`.
|
|
1069
|
-
*
|
|
1070
|
-
* @param v - The vector to set the x component of.
|
|
1071
|
-
* @param x - The new x component.
|
|
1072
|
-
* @returns A new `Vector2` instance with the updated x component.
|
|
1073
|
-
* @since 1.0.0
|
|
1074
|
-
*/
|
|
1075
|
-
(v: Vector2, x: number): Vector2;
|
|
1076
|
-
/**
|
|
1077
|
-
* Sets the x component of a `Vector2`.
|
|
1078
|
-
*
|
|
1079
|
-
* @param x - The new x component.
|
|
1080
|
-
* @returns A function that takes a vector and returns the updated vector.
|
|
1081
|
-
* @since 1.0.0
|
|
1082
|
-
*/
|
|
1083
|
-
(x: number): (v: Vector2) => Vector2;
|
|
1084
|
-
};
|
|
1085
|
-
/**
|
|
1086
|
-
* Gets the y component of a `Vector2`.
|
|
1087
|
-
*
|
|
1088
|
-
* @param v - The vector to get the y component from.
|
|
1089
|
-
* @returns The y component of the vector.
|
|
1090
|
-
* @since 1.0.0
|
|
1091
|
-
*/
|
|
1092
|
-
declare const getY: (v: Vector2) => number;
|
|
1093
|
-
declare const setY: {
|
|
1094
|
-
/**
|
|
1095
|
-
* Sets the y component of a `Vector2`.
|
|
1096
|
-
*
|
|
1097
|
-
* @param v - The vector to set the y component of.
|
|
1098
|
-
* @param y - The new y component.
|
|
1099
|
-
* @returns A new `Vector2` instance with the updated y component.
|
|
1100
|
-
* @since 1.0.0
|
|
1101
|
-
*/
|
|
1102
|
-
(v: Vector2, y: number): Vector2;
|
|
1103
|
-
/**
|
|
1104
|
-
* Sets the y component of a `Vector2`.
|
|
1105
|
-
*
|
|
1106
|
-
* @param y - The new y component.
|
|
1107
|
-
* @returns A function that takes a vector and returns the updated vector.
|
|
1108
|
-
* @since 1.0.0
|
|
1109
|
-
*/
|
|
1110
|
-
(y: number): (v: Vector2) => Vector2;
|
|
1111
|
-
};
|
|
1112
|
-
/**
|
|
1113
|
-
* Gets the radius of a `Vector2`.
|
|
1114
|
-
*
|
|
1115
|
-
* @param v - The vector to get the radius from.
|
|
1116
|
-
* @returns The radius of the vector.
|
|
1117
|
-
* @since 1.0.0
|
|
1118
|
-
*/
|
|
1119
|
-
declare const getR: (v: Vector2) => number;
|
|
1120
|
-
declare const setR: {
|
|
1121
|
-
/**
|
|
1122
|
-
* Sets the radius of a `Vector2`.
|
|
1123
|
-
*
|
|
1124
|
-
* @param v - The vector to set the radius of.
|
|
1125
|
-
* @param r - The new radius.
|
|
1126
|
-
* @returns A new `Vector2` instance with the updated radius.
|
|
1127
|
-
* @since 1.0.0
|
|
1128
|
-
*/
|
|
1129
|
-
(v: Vector2, r: number): Vector2;
|
|
1130
|
-
/**
|
|
1131
|
-
* Sets the radius of a `Vector2`.
|
|
1132
|
-
*
|
|
1133
|
-
* @param r - The new radius.
|
|
1134
|
-
* @returns A function that takes a vector and returns the updated vector.
|
|
1135
|
-
* @since 1.0.0
|
|
1136
|
-
*/
|
|
1137
|
-
(r: number): (v: Vector2) => Vector2;
|
|
1138
|
-
};
|
|
1139
|
-
/**
|
|
1140
|
-
* Gets the angle of a `Vector2`.
|
|
1141
|
-
*
|
|
1142
|
-
* @param v - The vector to get the angle from.
|
|
1143
|
-
* @returns The angle of the vector in radians.
|
|
1144
|
-
* @since 1.0.0
|
|
1145
|
-
*/
|
|
1146
|
-
declare const getTheta: (v: Vector2) => number;
|
|
1147
|
-
declare const setTheta: {
|
|
1148
|
-
/**
|
|
1149
|
-
* Sets the angle of a `Vector2`.
|
|
1150
|
-
*
|
|
1151
|
-
* @param v - The vector to set the angle of.
|
|
1152
|
-
* @param theta - The new angle, in radians.
|
|
1153
|
-
* @returns A new `Vector2` instance with the updated angle.
|
|
1154
|
-
* @since 1.0.0
|
|
1155
|
-
*/
|
|
1156
|
-
(v: Vector2, theta: number): Vector2;
|
|
1157
|
-
/**
|
|
1158
|
-
* Sets the angle of a `Vector2`.
|
|
1159
|
-
*
|
|
1160
|
-
* @param theta - The new angle, in radians.
|
|
1161
|
-
* @returns A function that takes a vector and returns the updated vector.
|
|
1162
|
-
* @since 1.0.0
|
|
1163
|
-
*/
|
|
1164
|
-
(theta: number): (v: Vector2) => Vector2;
|
|
1165
|
-
};
|
|
1166
|
-
//#endregion
|
|
1167
|
-
export { vector3_d_exports as a, FourDimensionalComponent as c, ThreeDimensionalIndex as d, TwoDimensional as f, Vector3 as i, FourDimensionalIndex as l, TwoDimensionalIndex as m, Weighted as n, Vector4 as o, TwoDimensionalComponent as p, vector2_d_exports as r, vector4_d_exports as s, Vector2 as t, ThreeDimensionalComponent as u };
|
|
1168
|
-
//# sourceMappingURL=vector2-TV0UnlxY.d.mts.map
|
|
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
|