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.
Files changed (173) hide show
  1. package/dist/characteristic/index.d.mts +88 -0
  2. package/dist/characteristic/index.mjs +2 -0
  3. package/dist/curve/index.d.mts +2 -0
  4. package/dist/curve/index.mjs +2 -0
  5. package/dist/interval/index.d.mts +3 -0
  6. package/dist/interval/index.mjs +3 -0
  7. package/dist/matrix/index.d.mts +2 -0
  8. package/dist/matrix/index.mjs +267 -0
  9. package/dist/matrix/index.mjs.map +1 -0
  10. package/dist/number.d.mts +280 -0
  11. package/dist/number.mjs +140 -0
  12. package/dist/number.mjs.map +1 -0
  13. package/dist/path/index.d.mts +261 -0
  14. package/dist/path/index.mjs +325 -0
  15. package/dist/path/index.mjs.map +1 -0
  16. package/dist/polynomial/index.d.mts +2 -0
  17. package/dist/polynomial/index.mjs +3 -0
  18. package/dist/shared/characteristic-B9nCh_cx.mjs +104 -0
  19. package/dist/shared/characteristic-B9nCh_cx.mjs.map +1 -0
  20. package/dist/shared/chunk-25Hzd3z8.mjs +13 -0
  21. package/dist/shared/cubic-BajUY0JT.d.mts +1100 -0
  22. package/dist/shared/cubic-CpHAx8cC.mjs +479 -0
  23. package/dist/shared/cubic-CpHAx8cC.mjs.map +1 -0
  24. package/dist/shared/interval-05CR6eBf.mjs +421 -0
  25. package/dist/shared/interval-05CR6eBf.mjs.map +1 -0
  26. package/dist/shared/interval-Dy-RMEE3.d.mts +533 -0
  27. package/dist/shared/interval2d-8IBZnUOq.mjs +108 -0
  28. package/dist/shared/interval2d-8IBZnUOq.mjs.map +1 -0
  29. package/dist/shared/interval2d-C2id9u31.d.mts +172 -0
  30. package/dist/shared/matrix4x4-Ck2WROK-.mjs +440 -0
  31. package/dist/shared/matrix4x4-Ck2WROK-.mjs.map +1 -0
  32. package/dist/shared/matrix4x4-Dm_tSiH1.d.mts +1183 -0
  33. package/dist/shared/quadratic-CamozcFc.mjs +330 -0
  34. package/dist/shared/quadratic-CamozcFc.mjs.map +1 -0
  35. package/dist/shared/rationalCubic2d-B6g97ryJ.d.mts +308 -0
  36. package/dist/shared/rationalCubic2d-BEgUGSFf.mjs +295 -0
  37. package/dist/shared/rationalCubic2d-BEgUGSFf.mjs.map +1 -0
  38. package/dist/shared/rationalCubic2d-Bys2Uory.mjs +695 -0
  39. package/dist/shared/rationalCubic2d-Bys2Uory.mjs.map +1 -0
  40. package/dist/shared/rationalCubic2d-DlQfBURs.d.mts +818 -0
  41. package/dist/shared/solution-CrtLfqEq.mjs +306 -0
  42. package/dist/shared/solution-CrtLfqEq.mjs.map +1 -0
  43. package/dist/shared/solution-sNQ-ZVhN.d.mts +251 -0
  44. package/dist/{pipe.d.mts → shared/utils-MCckigYk.d.mts} +44 -26
  45. package/dist/shared/vector2-CL1HDdPr.mjs +187 -0
  46. package/dist/shared/vector2-CL1HDdPr.mjs.map +1 -0
  47. package/dist/shared/vector2-DPUY3_eA.d.mts +470 -0
  48. package/dist/shared/vector2.internal-DU_E808S.mjs +97 -0
  49. package/dist/shared/vector2.internal-DU_E808S.mjs.map +1 -0
  50. package/dist/shared/vector3-D-tv_aKL.mjs +204 -0
  51. package/dist/shared/vector3-D-tv_aKL.mjs.map +1 -0
  52. package/dist/shared/vector3-DqeOZtOB.d.mts +703 -0
  53. package/dist/shared/vector4-5KbjoHVj.mjs +109 -0
  54. package/dist/shared/vector4-5KbjoHVj.mjs.map +1 -0
  55. package/dist/shared/vector4.internal-5XcaX12X.mjs +163 -0
  56. package/dist/shared/vector4.internal-5XcaX12X.mjs.map +1 -0
  57. package/dist/solution/index.d.mts +2 -0
  58. package/dist/solution/index.mjs +2 -0
  59. package/dist/splines/index.d.mts +701 -0
  60. package/dist/splines/index.mjs +734 -0
  61. package/dist/splines/index.mjs.map +1 -0
  62. package/dist/utils.d.mts +2 -205
  63. package/dist/utils.mjs +88 -52
  64. package/dist/utils.mjs.map +1 -1
  65. package/dist/vector/index.d.mts +3 -0
  66. package/dist/vector/index.mjs +4 -0
  67. package/package.json +49 -92
  68. package/dist/curve/cubic2d.d.mts +0 -109
  69. package/dist/curve/cubic2d.d.ts +0 -109
  70. package/dist/curve/cubic2d.mjs +0 -80
  71. package/dist/curve/cubic2d.mjs.map +0 -1
  72. package/dist/curve/linear2d.d.mts +0 -94
  73. package/dist/curve/linear2d.d.ts +0 -94
  74. package/dist/curve/linear2d.mjs +0 -46
  75. package/dist/curve/linear2d.mjs.map +0 -1
  76. package/dist/curve/quadratic2d.d.mts +0 -117
  77. package/dist/curve/quadratic2d.d.ts +0 -117
  78. package/dist/curve/quadratic2d.mjs +0 -82
  79. package/dist/curve/quadratic2d.mjs.map +0 -1
  80. package/dist/interval.d.mts +0 -251
  81. package/dist/interval.d.ts +0 -251
  82. package/dist/interval.mjs +0 -86
  83. package/dist/interval.mjs.map +0 -1
  84. package/dist/matrix/matrix2x2.d.mts +0 -320
  85. package/dist/matrix/matrix2x2.d.ts +0 -320
  86. package/dist/matrix/matrix2x2.mjs +0 -25
  87. package/dist/matrix/matrix2x2.mjs.map +0 -1
  88. package/dist/matrix/matrix3x3.d.mts +0 -370
  89. package/dist/matrix/matrix3x3.d.ts +0 -370
  90. package/dist/matrix/matrix3x3.mjs +0 -28
  91. package/dist/matrix/matrix3x3.mjs.map +0 -1
  92. package/dist/matrix/matrix4x4.d.mts +0 -381
  93. package/dist/matrix/matrix4x4.d.ts +0 -381
  94. package/dist/matrix/matrix4x4.mjs +0 -178
  95. package/dist/matrix/matrix4x4.mjs.map +0 -1
  96. package/dist/path/cubic2d.d.mts +0 -95
  97. package/dist/path/cubic2d.d.ts +0 -95
  98. package/dist/path/cubic2d.mjs +0 -60
  99. package/dist/path/cubic2d.mjs.map +0 -1
  100. package/dist/path/linear2d.d.mts +0 -95
  101. package/dist/path/linear2d.d.ts +0 -95
  102. package/dist/path/linear2d.mjs +0 -53
  103. package/dist/path/linear2d.mjs.map +0 -1
  104. package/dist/path/quadratic2d.d.mts +0 -95
  105. package/dist/path/quadratic2d.d.ts +0 -95
  106. package/dist/path/quadratic2d.mjs +0 -57
  107. package/dist/path/quadratic2d.mjs.map +0 -1
  108. package/dist/pipe.d.ts +0 -58
  109. package/dist/pipe.mjs +0 -92
  110. package/dist/pipe.mjs.map +0 -1
  111. package/dist/polynomial/cubic.d.mts +0 -7
  112. package/dist/polynomial/cubic.d.ts +0 -7
  113. package/dist/polynomial/cubic.mjs +0 -133
  114. package/dist/polynomial/cubic.mjs.map +0 -1
  115. package/dist/polynomial/linear.d.mts +0 -7
  116. package/dist/polynomial/linear.d.ts +0 -7
  117. package/dist/polynomial/linear.mjs +0 -24
  118. package/dist/polynomial/linear.mjs.map +0 -1
  119. package/dist/polynomial/quadratic.d.mts +0 -7
  120. package/dist/polynomial/quadratic.d.ts +0 -7
  121. package/dist/polynomial/quadratic.mjs +0 -27
  122. package/dist/polynomial/quadratic.mjs.map +0 -1
  123. package/dist/shared/curvy.Bf5TIk31.d.mts +0 -22
  124. package/dist/shared/curvy.Bf5TIk31.d.ts +0 -22
  125. package/dist/shared/curvy.BkkW8Tx9.mjs +0 -102
  126. package/dist/shared/curvy.BkkW8Tx9.mjs.map +0 -1
  127. package/dist/shared/curvy.BxdGW9he.mjs +0 -116
  128. package/dist/shared/curvy.BxdGW9he.mjs.map +0 -1
  129. package/dist/shared/curvy.C_sCeg9J.mjs +0 -66
  130. package/dist/shared/curvy.C_sCeg9J.mjs.map +0 -1
  131. package/dist/shared/curvy.Cg8lZVUz.d.ts +0 -688
  132. package/dist/shared/curvy.DCt1gGII.mjs +0 -147
  133. package/dist/shared/curvy.DCt1gGII.mjs.map +0 -1
  134. package/dist/shared/curvy.DJ4xO0al.mjs +0 -63
  135. package/dist/shared/curvy.DJ4xO0al.mjs.map +0 -1
  136. package/dist/shared/curvy.DmVFTi0N.mjs +0 -35
  137. package/dist/shared/curvy.DmVFTi0N.mjs.map +0 -1
  138. package/dist/shared/curvy.FDaj5rlj.d.mts +0 -688
  139. package/dist/shared/curvy.lktriTpx.mjs +0 -101
  140. package/dist/shared/curvy.lktriTpx.mjs.map +0 -1
  141. package/dist/shared/curvy.mLFprrGm.mjs +0 -85
  142. package/dist/shared/curvy.mLFprrGm.mjs.map +0 -1
  143. package/dist/shared/curvy.r6f1j287.mjs +0 -76
  144. package/dist/shared/curvy.r6f1j287.mjs.map +0 -1
  145. package/dist/splines/basis2d.d.mts +0 -130
  146. package/dist/splines/basis2d.d.ts +0 -130
  147. package/dist/splines/basis2d.mjs +0 -90
  148. package/dist/splines/basis2d.mjs.map +0 -1
  149. package/dist/splines/bezier2d.d.mts +0 -182
  150. package/dist/splines/bezier2d.d.ts +0 -182
  151. package/dist/splines/bezier2d.mjs +0 -23
  152. package/dist/splines/bezier2d.mjs.map +0 -1
  153. package/dist/splines/cardinal2d.d.mts +0 -178
  154. package/dist/splines/cardinal2d.d.ts +0 -178
  155. package/dist/splines/cardinal2d.mjs +0 -114
  156. package/dist/splines/cardinal2d.mjs.map +0 -1
  157. package/dist/splines/hermite2d.d.mts +0 -124
  158. package/dist/splines/hermite2d.d.ts +0 -124
  159. package/dist/splines/hermite2d.mjs +0 -63
  160. package/dist/splines/hermite2d.mjs.map +0 -1
  161. package/dist/utils.d.ts +0 -205
  162. package/dist/vector/vector2.d.mts +0 -324
  163. package/dist/vector/vector2.d.ts +0 -324
  164. package/dist/vector/vector2.mjs +0 -30
  165. package/dist/vector/vector2.mjs.map +0 -1
  166. package/dist/vector/vector3.d.mts +0 -417
  167. package/dist/vector/vector3.d.ts +0 -417
  168. package/dist/vector/vector3.mjs +0 -38
  169. package/dist/vector/vector3.mjs.map +0 -1
  170. package/dist/vector/vector4.d.mts +0 -205
  171. package/dist/vector/vector4.d.ts +0 -205
  172. package/dist/vector/vector4.mjs +0 -20
  173. package/dist/vector/vector4.mjs.map +0 -1
@@ -1,324 +0,0 @@
1
- import { T as TwoDimensional } from '../shared/curvy.Bf5TIk31.js';
2
- import { Pipeable } from '../pipe.js';
3
-
4
- declare const Vector2TypeId: unique symbol;
5
- type Vector2TypeId = typeof Vector2TypeId;
6
-
7
- /**
8
- * A 2D vector.
9
- *
10
- * All fields are readonly and immutable, and all operations create new instances.
11
- *
12
- * @since 1.0.0
13
- */
14
- interface Vector2 extends Pipeable, TwoDimensional<number> {
15
- readonly [Vector2TypeId]: Vector2TypeId;
16
- }
17
- /**
18
- * Checks if a value is a `Vector2`.
19
- *
20
- * @param v - The value to check.
21
- * @returns `true` if the value is a `Vector2`, `false` otherwise.
22
- * @since 1.0.0
23
- */
24
- declare const isVector2: (v: unknown) => v is Vector2;
25
- declare const make: {
26
- /**
27
- * Creates a new `Vector2` instance.
28
- *
29
- * @param xy - The x and y components of the vector.
30
- * @returns A new `Vector2` instance.
31
- * @since 1.0.0
32
- */
33
- (xy: number): Vector2;
34
- /**
35
- * Creates a new `Vector2` instance.
36
- *
37
- * @param x - The x component of the vector.
38
- * @param y - The y component of the vector.
39
- * @returns A new `Vector2` instance.
40
- * @since 1.0.0
41
- */
42
- (x: number, y: number): Vector2;
43
- };
44
- /**
45
- * Creates a new `Vector2` instance from polar coordinates.
46
- *
47
- * @param r - The radius.
48
- * @param theta - The angle, in radians.
49
- * @returns A new `Vector2` instance.
50
- * @since 1.0.0
51
- */
52
- declare const fromPolar: (r: number, theta: number) => Vector2;
53
- /**
54
- * Calculates the magnitude of a `Vector2`.
55
- *
56
- * @param vector - The vector to calculate the magnitude of.
57
- * @returns The magnitude of the vector.
58
- * @since 1.0.0
59
- */
60
- declare const magnitude: (vector: Vector2) => number;
61
- /**
62
- * Normalizes a `Vector2`.
63
- *
64
- * @param vector - The vector to normalize.
65
- * @returns A new `Vector2` instance with the same direction and a magnitude of 1.
66
- * @since 1.0.0
67
- */
68
- declare const normalize: (vector: Vector2) => Vector2;
69
- declare const dot: {
70
- /**
71
- * Calculates the dot product of two `Vector2` instances.
72
- *
73
- * @param a - The first vector.
74
- * @param b - The second vector.
75
- * @returns The dot product of the two vectors.
76
- * @since 1.0.0
77
- */
78
- (a: Vector2, b: Vector2): number;
79
- /**
80
- * Calculates the dot product of two `Vector2` instances.
81
- *
82
- * @param b - The second vector.
83
- * @returns A function that takes the first vector and returns the dot product.
84
- * @since 1.0.0
85
- */
86
- (b: Vector2): (a: Vector2) => number;
87
- };
88
- declare const cross: {
89
- /**
90
- * Calculates the cross product of two `Vector2` instances.
91
- *
92
- * @param a - The first vector.
93
- * @param b - The second vector.
94
- * @returns The cross product of the two vectors.
95
- * @since 1.0.0
96
- */
97
- (a: Vector2, b: Vector2): number;
98
- /**
99
- * Calculates the cross product of two `Vector2` instances.
100
- *
101
- * @param b - The second vector.
102
- * @returns A function that takes the first vector and returns the cross product.
103
- * @since 1.0.0
104
- */
105
- (b: Vector2): (a: Vector2) => number;
106
- };
107
- /**
108
- * Returns the components of a `Vector2` as an array.
109
- *
110
- * @param r - The radius.
111
- * @param theta - The angle, in radians.
112
- * @returns A new `Vector2` instance.
113
- * @since 1.0.0
114
- */
115
- declare const components: (v: Vector2) => [number, number];
116
- /**
117
- * Applies the softmax function to a `Vector2`.
118
- *
119
- * @param v - The vector to apply the softmax function to.
120
- * @returns A new `Vector2` instance with the softmax applied.
121
- * @since 1.0.0
122
- */
123
- declare const softmax: (v: Vector2) => Vector2;
124
- /**
125
- * Creates a zero vector.
126
- *
127
- * @returns A new `Vector2` instance with both components set to 0.
128
- * @since 1.0.0
129
- */
130
- declare const zero: Vector2;
131
- /**
132
- * Creates a unit vector.
133
- *
134
- * @returns A new `Vector2` instance with both components set to 1.
135
- * @since 1.0.0
136
- */
137
- declare const unit: Vector2;
138
- declare const add: {
139
- /**
140
- * Adds two `Vector2` instances together.
141
- *
142
- * @param a - The first vector.
143
- * @param b - The second vector.
144
- * @returns A new `Vector2` instance representing the sum of the two vectors.
145
- * @since 1.0.0
146
- */
147
- (a: Vector2, b: Vector2): Vector2;
148
- /**
149
- * Adds two `Vector2` instances together.
150
- *
151
- * @param b - The second vector.
152
- * @returns A function that takes the first vector and returns the sum.
153
- * @since 1.0.0
154
- */
155
- (b: Vector2): (a: Vector2) => Vector2;
156
- };
157
- declare const subtract: {
158
- /**
159
- * Subtracts one `Vector2` instance from another.
160
- *
161
- * @param a - The first vector.
162
- * @param b - The second vector.
163
- * @returns A new `Vector2` instance representing the difference of the two vectors.
164
- * @since 1.0.0
165
- */
166
- (a: Vector2, b: Vector2): Vector2;
167
- /**
168
- * Subtracts one `Vector2` instance from another.
169
- *
170
- * @param b - The second vector.
171
- * @returns A function that takes the first vector and returns the difference.
172
- * @since 1.0.0
173
- */
174
- (b: Vector2): (a: Vector2) => Vector2;
175
- };
176
- declare const hadamard: {
177
- /**
178
- * Performs the Hadamard product of two `Vector2` instances.
179
- *
180
- * @param a - The first vector.
181
- * @param b - The second vector.
182
- * @returns A new `Vector2` instance representing the Hadamard product of the two vectors.
183
- * @since 1.0.0
184
- */
185
- (a: Vector2, b: Vector2): Vector2;
186
- /**
187
- * Performs the Hadamard product of two `Vector2` instances.
188
- *
189
- * @param b - The second vector.
190
- * @returns A function that takes the first vector and returns the Hadamard product.
191
- * @since 1.0.0
192
- */
193
- (b: Vector2): (a: Vector2) => Vector2;
194
- };
195
- declare const scale: {
196
- /**
197
- * Scales a `Vector2` by a scalar value.
198
- *
199
- * @param s - The scalar value to scale by.
200
- * @returns A function that takes a vector and returns the scaled vector.
201
- * @since 1.0.0
202
- */
203
- (s: number): (v: Vector2) => Vector2;
204
- /**
205
- * Scales a `Vector2` by a scalar value.
206
- *
207
- * @param v - The vector to scale.
208
- * @param s - The scalar value to scale by.
209
- * @returns A new `Vector2` instance representing the scaled vector.
210
- * @since 1.0.0
211
- */
212
- (v: Vector2, s: number): Vector2;
213
- };
214
- /**
215
- * Gets the x component of a `Vector2`.
216
- *
217
- * @param v - The vector to get the x component from.
218
- * @returns The x component of the vector.
219
- * @since 1.0.0
220
- */
221
- declare const getX: (v: Vector2) => number;
222
- declare const setX: {
223
- /**
224
- * Sets the x component of a `Vector2`.
225
- *
226
- * @param v - The vector to set the x component of.
227
- * @param x - The new x component.
228
- * @returns A new `Vector2` instance with the updated x component.
229
- * @since 1.0.0
230
- */
231
- (v: Vector2, x: number): Vector2;
232
- /**
233
- * Sets the x component of a `Vector2`.
234
- *
235
- * @param x - The new x component.
236
- * @returns A function that takes a vector and returns the updated vector.
237
- * @since 1.0.0
238
- */
239
- (x: number): (v: Vector2) => Vector2;
240
- };
241
- /**
242
- * Gets the y component of a `Vector2`.
243
- *
244
- * @param v - The vector to get the y component from.
245
- * @returns The y component of the vector.
246
- * @since 1.0.0
247
- */
248
- declare const getY: (v: Vector2) => number;
249
- declare const setY: {
250
- /**
251
- * Sets the y component of a `Vector2`.
252
- *
253
- * @param v - The vector to set the y component of.
254
- * @param y - The new y component.
255
- * @returns A new `Vector2` instance with the updated y component.
256
- * @since 1.0.0
257
- */
258
- (v: Vector2, y: number): Vector2;
259
- /**
260
- * Sets the y component of a `Vector2`.
261
- *
262
- * @param y - The new y component.
263
- * @returns A function that takes a vector and returns the updated vector.
264
- * @since 1.0.0
265
- */
266
- (y: number): (v: Vector2) => Vector2;
267
- };
268
- /**
269
- * Gets the radius of a `Vector2`.
270
- *
271
- * @param v - The vector to get the radius from.
272
- * @returns The radius of the vector.
273
- * @since 1.0.0
274
- */
275
- declare const getR: (v: Vector2) => number;
276
- declare const setR: {
277
- /**
278
- * Sets the radius of a `Vector2`.
279
- *
280
- * @param v - The vector to set the radius of.
281
- * @param r - The new radius.
282
- * @returns A new `Vector2` instance with the updated radius.
283
- * @since 1.0.0
284
- */
285
- (v: Vector2, r: number): Vector2;
286
- /**
287
- * Sets the radius of a `Vector2`.
288
- *
289
- * @param r - The new radius.
290
- * @returns A function that takes a vector and returns the updated vector.
291
- * @since 1.0.0
292
- */
293
- (r: number): (v: Vector2) => Vector2;
294
- };
295
- /**
296
- * Gets the angle of a `Vector2`.
297
- *
298
- * @param v - The vector to get the angle from.
299
- * @returns The angle of the vector in radians.
300
- * @since 1.0.0
301
- */
302
- declare const getTheta: (v: Vector2) => number;
303
- declare const setTheta: {
304
- /**
305
- * Sets the angle of a `Vector2`.
306
- *
307
- * @param v - The vector to set the angle of.
308
- * @param theta - The new angle, in radians.
309
- * @returns A new `Vector2` instance with the updated angle.
310
- * @since 1.0.0
311
- */
312
- (v: Vector2, theta: number): Vector2;
313
- /**
314
- * Sets the angle of a `Vector2`.
315
- *
316
- * @param theta - The new angle, in radians.
317
- * @returns A function that takes a vector and returns the updated vector.
318
- * @since 1.0.0
319
- */
320
- (theta: number): (v: Vector2) => Vector2;
321
- };
322
-
323
- export { add, components, cross, dot, fromPolar, getR, getTheta, getX, getY, hadamard, isVector2, magnitude, make, normalize, scale, setR, setTheta, setX, setY, softmax, subtract, unit, zero };
324
- export type { Vector2 };
@@ -1,30 +0,0 @@
1
- import { m as make$1, i as isVector2$1, f as fromPolar$1, a as magnitude$1, n as normalize$1, d as dot$1, c as cross$1, b as components$1, s as softmax$1, e as add$1, g as subtract$1, h as hadamard$1, j as scale$1, k as getX$1, l as setX$1, o as getY$1, p as setY$1, q as setR$1, r as getTheta$1, t as setTheta$1 } from '../shared/curvy.DJ4xO0al.mjs';
2
- import '../pipe.mjs';
3
- import '../utils.mjs';
4
-
5
- const isVector2 = isVector2$1;
6
- const make = make$1;
7
- const fromPolar = fromPolar$1;
8
- const magnitude = magnitude$1;
9
- const normalize = normalize$1;
10
- const dot = dot$1;
11
- const cross = cross$1;
12
- const components = components$1;
13
- const softmax = softmax$1;
14
- const zero = make(0);
15
- const unit = make(1);
16
- const add = add$1;
17
- const subtract = subtract$1;
18
- const hadamard = hadamard$1;
19
- const scale = scale$1;
20
- const getX = getX$1;
21
- const setX = setX$1;
22
- const getY = getY$1;
23
- const setY = setY$1;
24
- const getR = magnitude;
25
- const setR = setR$1;
26
- const getTheta = getTheta$1;
27
- const setTheta = setTheta$1;
28
-
29
- export { add, components, cross, dot, fromPolar, getR, getTheta, getX, getY, hadamard, isVector2, magnitude, make, normalize, scale, setR, setTheta, setX, setY, softmax, subtract, unit, zero };
30
- //# sourceMappingURL=vector2.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vector2.mjs","sources":["../../src/vector/vector2.ts"],"sourcesContent":["import type { TwoDimensional } from '../dimensions'\nimport type { Pipeable } from '../pipe'\nimport * as internal from './vector2.internal'\nimport type { Vector2TypeId } from './vector2.internal'\n\n/**\n * A 2D vector.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * @since 1.0.0\n */\nexport interface Vector2 extends Pipeable, TwoDimensional<number> {\n readonly [Vector2TypeId]: Vector2TypeId\n}\n\n/**\n * Checks if a value is a `Vector2`.\n *\n * @param v - The value to check.\n * @returns `true` if the value is a `Vector2`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isVector2: (v: unknown) => v is Vector2 = internal.isVector2\n\nexport const make: {\n /**\n * Creates a new `Vector2` instance.\n *\n * @param xy - The x and y components of the vector.\n * @returns A new `Vector2` instance.\n * @since 1.0.0\n */\n (xy: number): Vector2\n /**\n * Creates a new `Vector2` instance.\n *\n * @param x - The x component of the vector.\n * @param y - The y component of the vector.\n * @returns A new `Vector2` instance.\n * @since 1.0.0\n */\n (x: number, y: number): Vector2\n} = internal.make\n\n/**\n * Creates a new `Vector2` instance from polar coordinates.\n *\n * @param r - The radius.\n * @param theta - The angle, in radians.\n * @returns A new `Vector2` instance.\n * @since 1.0.0\n */\nexport const fromPolar: (r: number, theta: number) => Vector2 = internal.fromPolar\n\n/**\n * Calculates the magnitude of a `Vector2`.\n *\n * @param vector - The vector to calculate the magnitude of.\n * @returns The magnitude of the vector.\n * @since 1.0.0\n */\nexport const magnitude: (vector: Vector2) => number = internal.magnitude\n\n/**\n * Normalizes a `Vector2`.\n *\n * @param vector - The vector to normalize.\n * @returns A new `Vector2` instance with the same direction and a magnitude of 1.\n * @since 1.0.0\n */\nexport const normalize: (vector: Vector2) => Vector2 = internal.normalize\n\nexport const dot: {\n /**\n * Calculates the dot product of two `Vector2` instances.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns The dot product of the two vectors.\n * @since 1.0.0\n */\n (a: Vector2, b: Vector2): number\n /**\n * Calculates the dot product of two `Vector2` instances.\n *\n * @param b - The second vector.\n * @returns A function that takes the first vector and returns the dot product.\n * @since 1.0.0\n */\n (b: Vector2): (a: Vector2) => number\n} = internal.dot\n\nexport const cross: {\n /**\n * Calculates the cross product of two `Vector2` instances.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns The cross product of the two vectors.\n * @since 1.0.0\n */\n (a: Vector2, b: Vector2): number\n /**\n * Calculates the cross product of two `Vector2` instances.\n *\n * @param b - The second vector.\n * @returns A function that takes the first vector and returns the cross product.\n * @since 1.0.0\n */\n (b: Vector2): (a: Vector2) => number\n} = internal.cross\n\n/**\n * Returns the components of a `Vector2` as an array.\n *\n * @param r - The radius.\n * @param theta - The angle, in radians.\n * @returns A new `Vector2` instance.\n * @since 1.0.0\n */\nexport const components: (v: Vector2) => [number, number] = internal.components\n\n/**\n * Applies the softmax function to a `Vector2`.\n *\n * @param v - The vector to apply the softmax function to.\n * @returns A new `Vector2` instance with the softmax applied.\n * @since 1.0.0\n */\nexport const softmax: (v: Vector2) => Vector2 = internal.softmax\n\n/**\n * Creates a zero vector.\n *\n * @returns A new `Vector2` instance with both components set to 0.\n * @since 1.0.0\n */\nexport const zero = make(0)\n\n/**\n * Creates a unit vector.\n *\n * @returns A new `Vector2` instance with both components set to 1.\n * @since 1.0.0\n */\nexport const unit = make(1)\n\nexport const add: {\n /**\n * Adds two `Vector2` instances together.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns A new `Vector2` instance representing the sum of the two vectors.\n * @since 1.0.0\n */\n (a: Vector2, b: Vector2): Vector2\n /**\n * Adds two `Vector2` instances together.\n *\n * @param b - The second vector.\n * @returns A function that takes the first vector and returns the sum.\n * @since 1.0.0\n */\n (b: Vector2): (a: Vector2) => Vector2\n} = internal.add\n\nexport const subtract: {\n /**\n * Subtracts one `Vector2` instance from another.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns A new `Vector2` instance representing the difference of the two vectors.\n * @since 1.0.0\n */\n (a: Vector2, b: Vector2): Vector2\n /**\n * Subtracts one `Vector2` instance from another.\n *\n * @param b - The second vector.\n * @returns A function that takes the first vector and returns the difference.\n * @since 1.0.0\n */\n (b: Vector2): (a: Vector2) => Vector2\n} = internal.subtract\n\nexport const hadamard: {\n /**\n * Performs the Hadamard product of two `Vector2` instances.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns A new `Vector2` instance representing the Hadamard product of the two vectors.\n * @since 1.0.0\n */\n (a: Vector2, b: Vector2): Vector2\n /**\n * Performs the Hadamard product of two `Vector2` instances.\n *\n * @param b - The second vector.\n * @returns A function that takes the first vector and returns the Hadamard product.\n * @since 1.0.0\n */\n (b: Vector2): (a: Vector2) => Vector2\n} = internal.hadamard\n\nexport const scale: {\n /**\n * Scales a `Vector2` by a scalar value.\n *\n * @param s - The scalar value to scale by.\n * @returns A function that takes a vector and returns the scaled vector.\n * @since 1.0.0\n */\n (s: number): (v: Vector2) => Vector2\n /**\n * Scales a `Vector2` by a scalar value.\n *\n * @param v - The vector to scale.\n * @param s - The scalar value to scale by.\n * @returns A new `Vector2` instance representing the scaled vector.\n * @since 1.0.0\n */\n (v: Vector2, s: number): Vector2\n} = internal.scale\n\n/**\n * Gets the x component of a `Vector2`.\n *\n * @param v - The vector to get the x component from.\n * @returns The x component of the vector.\n * @since 1.0.0\n */\nexport const getX: (v: Vector2) => number = internal.getX\n\nexport const setX: {\n /**\n * Sets the x component of a `Vector2`.\n *\n * @param v - The vector to set the x component of.\n * @param x - The new x component.\n * @returns A new `Vector2` instance with the updated x component.\n * @since 1.0.0\n */\n (v: Vector2, x: number): Vector2\n /**\n * Sets the x component of a `Vector2`.\n *\n * @param x - The new x component.\n * @returns A function that takes a vector and returns the updated vector.\n * @since 1.0.0\n */\n (x: number): (v: Vector2) => Vector2\n} = internal.setX\n\n/**\n * Gets the y component of a `Vector2`.\n *\n * @param v - The vector to get the y component from.\n * @returns The y component of the vector.\n * @since 1.0.0\n */\nexport const getY: (v: Vector2) => number = internal.getY\n\nexport const setY: {\n /**\n * Sets the y component of a `Vector2`.\n *\n * @param v - The vector to set the y component of.\n * @param y - The new y component.\n * @returns A new `Vector2` instance with the updated y component.\n * @since 1.0.0\n */\n (v: Vector2, y: number): Vector2\n /**\n * Sets the y component of a `Vector2`.\n *\n * @param y - The new y component.\n * @returns A function that takes a vector and returns the updated vector.\n * @since 1.0.0\n */\n (y: number): (v: Vector2) => Vector2\n} = internal.setY\n\n/**\n * Gets the radius of a `Vector2`.\n *\n * @param v - The vector to get the radius from.\n * @returns The radius of the vector.\n * @since 1.0.0\n */\nexport const getR: (v: Vector2) => number = magnitude\n\nexport const setR: {\n /**\n * Sets the radius of a `Vector2`.\n *\n * @param v - The vector to set the radius of.\n * @param r - The new radius.\n * @returns A new `Vector2` instance with the updated radius.\n * @since 1.0.0\n */\n (v: Vector2, r: number): Vector2\n /**\n * Sets the radius of a `Vector2`.\n *\n * @param r - The new radius.\n * @returns A function that takes a vector and returns the updated vector.\n * @since 1.0.0\n */\n (r: number): (v: Vector2) => Vector2\n} = internal.setR\n\n/**\n * Gets the angle of a `Vector2`.\n *\n * @param v - The vector to get the angle from.\n * @returns The angle of the vector in radians.\n * @since 1.0.0\n */\nexport const getTheta: (v: Vector2) => number = internal.getTheta\n\nexport const setTheta: {\n /**\n * Sets the angle of a `Vector2`.\n *\n * @param v - The vector to set the angle of.\n * @param theta - The new angle, in radians.\n * @returns A new `Vector2` instance with the updated angle.\n * @since 1.0.0\n */\n (v: Vector2, theta: number): Vector2\n /**\n * Sets the angle of a `Vector2`.\n *\n * @param theta - The new angle, in radians.\n * @returns A function that takes a vector and returns the updated vector.\n * @since 1.0.0\n */\n (theta: number): (v: Vector2) => Vector2\n} = internal.setTheta\n"],"names":["internal.isVector2","internal.make","internal.fromPolar","internal.magnitude","internal.normalize","internal.dot","internal.cross","internal.components","internal.softmax","internal.add","internal.subtract","internal.hadamard","internal.scale","internal.getX","internal.setX","internal.getY","internal.setY","internal.setR","internal.getTheta","internal.setTheta"],"mappings":";;;;AAuBO,MAAM,YAA0CA;AAEhD,MAAM,OAkBTC;AAUG,MAAM,YAAmDC;AASzD,MAAM,YAAyCC;AAS/C,MAAM,YAA0CC;AAEhD,MAAM,MAkBTC;AAEG,MAAM,QAkBTC;AAUG,MAAM,aAA+CC;AASrD,MAAM,UAAmCC;AAQnC,MAAA,IAAA,GAAO,KAAK,CAAC;AAQb,MAAA,IAAA,GAAO,KAAK,CAAC;AAEnB,MAAM,MAkBTC;AAEG,MAAM,WAkBTC;AAEG,MAAM,WAkBTC;AAEG,MAAM,QAkBTC;AASG,MAAM,OAA+BC;AAErC,MAAM,OAkBTC;AASG,MAAM,OAA+BC;AAErC,MAAM,OAkBTC;AASG,MAAM,IAA+B,GAAA;AAErC,MAAM,OAkBTC;AASG,MAAM,WAAmCC;AAEzC,MAAM,WAkBTC;;;;"}